diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..8c1a0fad --- /dev/null +++ b/.babelrc @@ -0,0 +1,13 @@ +{ + "presets": [ + ["@babel/env", { + "targets": { + "ios": "9.3", + "chrome": "50" + }, + "useBuiltIns": "usage", + "corejs": 3 + }] + ], + "plugins": ["@babel/plugin-proposal-object-rest-spread"] +} diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index bc487890..00000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -app -sessions \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..e54938f4 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +jquery.*.js diff --git a/.eslintrc.json b/.eslintrc.json index 1f9fff30..ed1546be 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,16 +1,21 @@ { + "parser": "babel-eslint", "env": { - "es2021": true, + "es6": true, "browser": true, "node": true }, "extends": "eslint:recommended", "parserOptions": { - "sourceType": "module" + "sourceType": "module", + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } }, "rules": { "no-prototype-builtins": "off", "no-console": "off", + "no-undef": "off", "no-useless-escape": "off", "no-self-assign": "off", "no-empty": [ @@ -46,12 +51,14 @@ ], "quotes": [ "error", - "single", - { "allowTemplateLiterals": true } + "single" ], "semi": [ "error", "never" ] + }, + "globals": { + "module": true } } diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml deleted file mode 100644 index 68eaa5f3..00000000 --- a/.forgejo/workflows/build.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build -on: [workflow_dispatch] - -jobs: - Deploy: - runs-on: docker - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - lfs: 'true' - - - name: Docker Login - run: | - docker login -u riksolo -p ${{secrets.CONTAINER_REGISTRY_TOKEN}} git.riksolo.com - - - name: Build and push - run: | - docker build -t git.riksolo.com/riksolo/open-stage-control:latest -t git.riksolo.com/riksolo/open-stage-control:${{github.sha}} . - docker push git.riksolo.com/riksolo/open-stage-control:latest - docker push git.riksolo.com/riksolo/open-stage-control:${{github.sha}} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 00000000..f5e6c623 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,21 @@ +--- +name: Bug report +about: Report a bug in Open Stage Control +title: '[Bug] ' +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 00000000..35cc697c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,5 @@ +--- +name: Feature request +about: Suggest an idea for Open Stage Control +title: '[Feature] ' +--- diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 00000000..ed92d3d7 --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,5 @@ +## How do I get help ? + +- If you found a bug, open a bug report +- If you have a suggestion, open a feature request +- If you have a question or want to share your experience with other users, please use the dedicated forum at https://openstagecontrol.discourse.group/ diff --git a/.gitignore b/.gitignore index 71086d11..69e47197 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,12 @@ -# npmg -node_modules/ - -# build -/app/ - -# python/midi build -src/server/python/* -!src/server/python/*.py - -# docs build -src/docs/widgets-reference.js -properties-reference.md - -# packaging -dist/ -sessions/ \ No newline at end of file +node_modules +dist +app/LICENSE +app/assets/*.css* +app/assets/*.png +app/client/*.js* +app/launcher/*.js* +app/server/* +!app/server/.keep +app/package.json +package-lock.json +*.pyc diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..cd090fc2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,49 @@ +anHsudo: required +dist: trusty +language: node_js +node_js: + - "9" +before_install: + - sudo dpkg --add-architecture i386 + - sudo apt-get update -qq + - sudo apt-get install -qq wine fakeroot xvfb +install: npm install +before_deploy: +deploy: + provider: releases + api-key: + secure: Nb4qJlmLEE2/ETHEYe8V8eGI08d4GuE5kdQef5ZnB4PrstppLlAjShv5E4DNTsyalMOMDjpw9v+9aQNzxGiGv+lCVVL5oFvqvDpcYusRuF9Qua7oJtFh+5FvjgC1DDjauk5Z7WQWMvzWwfNmqbY/lxPbA4zVy4kdYkGV/8WnzA9AL5fU0ZU8gDsFjcr9Pz81XDsDXtPH/+iMuclMsEl8V/ZuswWlZaFn1Jnb1tcGC5WUCsuNQo/+gGfSK6Qcf9AKsIrOjdzi55s4jqH1N7P/kKi4a2tWUTwmSLrOxdUmSYjXVOxMu0cAEnHSeYREv/5o6J0MbfQrDoxh2y5roPZzqE+FAuFLl+b/+bYlW0mrfYfSuP/VX9LYh5JSvrhN7rZuUfMqS1iM7c9Dx8sZadMnvYEAAJhH8IV/9SkuRa/8QoIpXf7YB9v1jERxs4gk5CPT5Aml6nY/CvMWiEQ/wJhC7iZd/QRHshgfNLfAGlbbNU2KP6ZsVAGD601fyST/8neoQqLqS9mteOr1QME3c5EFw+XaauIQNYZSl+wJr8Y1YMcKY+fbJqqR0TXkbsoxFgV9PRf/4ZCjIJYtmelQVlM7j20XavOHM/Ko6/y7a3pohFz+ql3YR9jGF5XW2foXb4+e6DwTGL91/f75hYcsvXxoKbeaBjWpaSK8532UTeVkhPM= + file_glob: true + file: dist/packages/* + skip_cleanup: true + on: + tags: true +before_deploy: + - export VERSION=$(sed -nE 's/^\s*"version":\ "(.*?)",$/\1/p' package.json) + - npm run package -- --all + - npm run package-node + - npm run deb32 + - npm run deb64 + - npm run debarm + - cd dist + - mkdir packages + - mv open-stage-control-linux-ia32/*.deb packages/open-stage-control-${VERSION}-i386.deb + - mv open-stage-control-linux-x64/*.deb packages/open-stage-control-${VERSION}-amd64.deb + - mv open-stage-control-linux-armv7l/*.deb packages/open-stage-control-${VERSION}-armv7l.deb + - mv open-stage-control-node open-stage-control-${VERSION}-node + - mv open-stage-control-win32-ia32 open-stage-control-${VERSION}-win32-ia32 + - mv open-stage-control-win32-x64 open-stage-control-${VERSION}-win32-x64 + - mv open-stage-control-linux-ia32 open-stage-control-${VERSION}-linux-ia32 + - mv open-stage-control-linux-x64 open-stage-control-${VERSION}-linux-x64 + - mv open-stage-control-linux-armv7l open-stage-control-${VERSION}-linux-armv7l + - mv open-stage-control-linux-arm64 open-stage-control-${VERSION}-linux-arm64 + - zip -q -r --symlinks packages/open-stage-control-${VERSION}-osx.zip open-stage-control-darwin-x64/open-stage-control.app + - zip -q -r packages/open-stage-control-${VERSION}-node.zip open-stage-control-${VERSION}-node + - zip -q -r packages/open-stage-control-${VERSION}-win32-ia32.zip open-stage-control-${VERSION}-win32-ia32 + - zip -q -r packages/open-stage-control-${VERSION}-win32-x64.zip open-stage-control-${VERSION}-win32-x64 + - zip -q -r packages/open-stage-control-${VERSION}-linux-ia32.zip open-stage-control-${VERSION}-linux-ia32 + - zip -q -r packages/open-stage-control-${VERSION}-linux-x64.zip open-stage-control-${VERSION}-linux-x64 + - zip -q -r packages/open-stage-control-${VERSION}-linux-armv7l.zip open-stage-control-${VERSION}-linux-armv7l + - zip -q -r packages/open-stage-control-${VERSION}-linux-arm64.zip open-stage-control-${VERSION}-linux-arm64 + - ls packages + - cd .. diff --git a/AI_POLICY.md b/AI_POLICY.md deleted file mode 100644 index 20067a2d..00000000 --- a/AI_POLICY.md +++ /dev/null @@ -1,7 +0,0 @@ -Anything AI-related is strictly prohibited from this project. - -If you think this project could benefit from a smart use of AI, think harder. - -Think harder about the (hundreds of) millions of data workers that make your AI "smart", not to mention the monumental ecological waste it represents. - -If you still think this way, don't tell me. diff --git a/CHANGELOG.md b/CHANGELOG.md index ff189256..27939c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1778 +1,1843 @@ # Changelog -## 1.31.2 +## 0.49.12 + + +**This is the last release of the v0 branch** - bug fixes - - editor: fix regression (1.30.0) causing errors when editing the value property - + - dropdown: value update issue on iOS 13 - widgets - - canvas: allow `onResize` to send and trigger widget synchronization and scripts + - html: allow `class`, `title` and `style` attributes -## 1.31.1 +## 0.49.11 - bug fixes - - clone: regression causing error when some widgets have a non-string id + - regression (0.49.10) breaking icon with short names (minimum valid length set to 2 characters) + - html widget: content not initialized properly -## 1.31.0 - -- widgets - - clone, fragment: add `scoped` property. This allows making the widget self-contained (independent from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) +## 0.49.10 - bug fixes - - midi: unrecognized `no_auto_note_off` option - - MacOs: the app now quits when all windows are closed - - launcher: if the Tray icon is enabled, closing the launcher window won't quit the app if the server is running - - scrollbar widget: fix initial value in vertical mode - - console: fix copying using CmdOrCtrl+C when the editor is enabled - -- custom module - - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) - -## 1.30.4 - -- bug fixes - - remote control: add support for icon transform suffixes - - editor: fix moving/resing widgets inside folders when using percent units - - clone: `@{parent.propertyName}` blocks in target widget now update when clone's parent property updates - -- widgets - - encoder: add `horizontal` mode - - knob: add `encoder` design - -## 1.30.3 - -- bug fixes - - scrollbar: missing update upon target container resize - - server: regression breaking reception of osc message over tcp - -- widgets - - file: remember last visited directy per widget if `directory` property is not set - - knob: add `horizontal` mode - - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. - - plot, eq: unclip line drawing on y-axis - -- scripting - - add `uploadFile` function for reading client-side files - - add `scrollIntoView` function - -## 1.30.2 - -- bug fixes - - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts - - rgb: fix rendering issue - - patchbay: interaction and rendering issues - - `event.preventDefault` in `onTouch` now affect modal buttons - - menu: use click event instead of tap in `toggle` and `doubleTap-toggle` modes - - button: missing `move` events in `onTouch` - - error when logging `event` object in `onTouch` - -- widgets - - modal/button/file: add `click` property - -- editor - - preserve code editor undo history between consecutive edits of a same widget's property - - preserve fullscreen code editor focus when saving / submitting - -- client - - add `noWarning` client option - -## 1.30.1 - -- bug fixes - - regression breaking user asset loading from a root directory named "assets" - - regression breaking custom module's `nativeRequire()` for locally installed modules - -## 1.30.0 - -- bug fixes - - server: fix resolving absolute file urls containing the remote-root path - - prevent editor zoom level from affecting drag events when the editor is disabled - - prevent changing editor zoom level when it's disabled - - fader: fix touchZone == knob for compact design - - separator labels missing in inspector - - make the client app more robust to restrictive browser settings (cookie must still be enabled for the app to fully work) - -- widgets - - the html property is no longer restricted / sanitized - - input/textarea/select no longer have their appearance property reset in custom html - - canvas: added `contextType` property - - file: honor server's `remote-root` option (remove root path from displayed path and returned value) - - menu: changed default `layout` to `vertical` - - root/panel/modal/tab: support setting `scroll` to `hidden` (hides scrollbars and allows scrolling) - - add new `scrollbar` widget that connects to a scrolling container widget and acts as it scrollbar - - input: add `noCanvas` option to avoid blurry text under some circumstances - - xy: add `clipX` and `clipY` proprties (allows multixy to set per-pads anges limits) - - button: add `onTouch` script - - switch: make `values` property dynamic - -- editor - - selecting a widget automatically shows it in the widget tree if it's not minimized - - submitting an unchanged value for the `value` property will now affect the value state of the widget even if the property content itself did not change - -- scripting - - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) - - `toolbar()` can now target menu actions by id instead of index - - `getToolbar()` function added (returns the state of a menu entry toggle) - - calling `setFocus()` without argument now unfocuses current active element - -- midi - - add `no_auto_note_off` option - - add `Restart backend` action to the launcher's menu - - add `restartMidiBackend()` function to custom module context - -- breaking change - - dropped support for iOS 10.3 - - minimum chromium version requirement raised to 70 - - macOS 11 (Big Sur) or above is now required (the node package will work on older system) - - scrollbars are no longer emulated on iOS - - scrollbar styling is now done using only the standard css scrollbar-* properties) to be more in line with system scrollbars in general - - panels no longer use their value to set/get their scrolling state, nor do they sync scrolling automatically. Instead there's now a dedicated scrollbar widget that can be used for this. + - svg files not loading + - canvas glitches when hardware acceleration is disabled (--disable-gpu) (built-in gui only) - misc - - now using electron v36.9.5 + - prevent `--disable-gpu` from bypassing the launcher window + - prevent converting `"^icon-name"` to an icon (in text widgets and labels) when `icon-name` is too short to be a valid icon name (minimum 4 characters) -## 1.29.9 - -- build - - fix building from sources now that open stage control is not hosted on github - -- scripting - - user scripts are longer protected against infinite loop - -## 1.29.8 +## 0.49.9 - bug fixes - - firefox: `onTouch` error when the cursor goes outside the page - - dropdown: label not initialized until a value is set - - editor: regression (1.29.0) preventing color changes made with the color to be undoable unless validaed with the enter key - - editor: color picker interaction issue in near #000000 - - rgb: incoming values were not queued when during user interaction + - downgrade electron engine to fix regression (v0.49.8) on some systems -- client - - add `title` client option - -## 1.29.7 - -- launcher - - add tray icon and menu (landed in 1.29.6 accidentally), disabled by default (can be enabled from the launcher's menu) - - -## 1.29.6 +## 0.49.8 - bug fixes - - matrix: prevent error when `quantity` is invalid - - multixy/xy: send value when setting `spring` to `true` (only if current value is different than spring value) - - switch/menu/fader: more consistent rendering when `borderRadius` is set + - rgb: range not applied when receiving value -- widgets - - multixy/xy: add `stepsX` and `stepsY` properties +## 0.49.7 +- bug fixes + - sync issues when widgets have a single target set + +## 0.49.6 + +- bug fixes + - windows users launching the app from a terminal now need to add a double dash (--) before their options + - launcher: disabled unstable `Relaunch` action + +## 0.49.5 + +- bug fixes + - launcher: file/folder browsing not working + +## 0.49.4 + +- bug fixes + - image: fixed absolute paths + - image: reset to 'default' instead of 'value' when receiving an empty value + - launcher: use current midi config for "List devices" action + - fader built-in meter: use fader's target (allows midi sync) + +## 0.49.3 + +- bug fixes + - windows: process not terminated properly when exiting the app + +## 0.49.2 + + - bug fixes + - plots: prevent `plot/*` widgets from sending messages when using the sidepanel's "send all" function + - editor: assign correct `address` when emptying the field + - sidepanel: shadow color issue - misc - - native silicon buids (osx-arm64) + - alt-buttons & flat theme tweaks -## 1.29.5 +## 0.49.1 - bug fixes - - keyboard: regression (1.27.5) breaking `velocity` property - - editor: retain scroll position in code editors - - cli: regression (1.28) preventing from setting options from a terminal on windows + - modal: error when `label` depends on a child's property + - custom module: `send()` function casting numbers to integers instead of floats by default + - menu: push mode not working on touch devices +## 0.49.0 -## 1.29.4 +**Deprecation** +MathJS syntax is now deprecated and will be removed in the future, sessions using it will be working for a few more versions but users are strongly encouraged to migrate to the javascript syntax. -- bug fixes - - regression (1.29.3) breaking some widget recreation routines - -## 1.29.3 - -- widgets - - frame: add `allow` property - - matrix: make `quantity` a dynamic property to avoid losing widget state when it changes - - patchbay: missing `preArgs` implementation - -## 1.29.1 / 1.29.2 - -- bug fixes - - scripting: `setFocus` not working on iOS - - fader/range: drawing error with `pips` enabled - -## 1.29.0 - -- bug fixes - - file browser: drive listing failing on recent windows - - root: `hideMenu` not working when `--read-only` is set - - combining `--read-only` and `--fullscreen` now disables `F11` on built-in client - - regression breaking `pips` for range widget - -- widgets - - add `onTouch` to all container widgets - - allow starting a traversing gesture outside a touchable widget - - fader: make `knobSize` dynamic - -## 1.28.5 - -- bug fixes - - multixy: error when `points` is `0` (or empty array) (again) - -## 1.28.4 - -- bug fixes - - multixy: error when `points` is `0` (or empty array) - -## 1.28.3 - -- bug fixes - - multixy: correclty handle incoming feedback values and simultaneous touch releases - -## 1.28.2 - -- bug fixes - - regression in feedback handling (unfixes multixy simultaneous spring issue temporarily) - -## 1.28.1 - -- bug fixes - - eq: `highpass` filter not working as expected with `poles` set - - fader: `touchZone` not applied to `doubleTap` events - - fader: `touchZone` not affecting mousewheel interactions - - fader: regression causing issues with `onTouch` scripts - -## 1.28.0 - -- bug fixes - - ui: global zoom (CmdOrCtrl + scroll / + / - / 0) issues and conflits with native browser zoom; - - ui: limit ctrl + scroll zoom speed - - broken cli when `ELECTRON_RUN_AS_NODE` is set - - inspector: input bug when a code editor was focused using the tab key - - inspector: prevent editing non-editable widgets (e.g matrix items) when clicking on their ids in error logs - - multixy: simultaneous touch releases not working correctly when `spring` is set and feedback values are received shortly after being sent - -- widgets - - fader: add `touchZone` property to allow restricting interaction to a part of the widget - - eq: add support for n-poles lowpass and highpass filters with the filter's `poles` property - - eq: adapt sampling frequency to the x-axis range - - xy/multixy: add `auto` choice to `axisLock` (locks on the first moved axis) - - file: `extension` can now be an array of strings - - plot/eq: smoother curves - - sliders/pads: `doubleTap` can now be `"script"`, in which case `onTouch` will be called with `event.type` set to `doubleTap` - - xy: add `label` property - - multixy: add `padsAttr` property for per-pad customization - - panel: `tabsPosition` can now be `hidden` - - pads: support percents in `pointSize` - -- scripting - - `console.log` now always print the id of the widget that called it - -- editor - - inspector: tab key navigation now works, property categories can be fold/unfold with enter/space when focused - - inspector: `F2` now focuses the `html` property in the inpector if `label` is not present - - tree: add `mod + f` to focus the search input - - - -## 1.27.5 - -- bug fixes - - patchbay: layout issue - - widget: regression causing error when emptying the css property and leaving only class declarations - - modal: incorrect position in scrolled containers when `relative` is `true` - - menu: incorrect position in scrlled containers depending on menu's alignment - - button: `locals.touchCoords` not updated upon release and incorrect when `doubleTap` is set - -## 1.27.4 - -- bug fixes - - fader: pips drawing issue causing small a position offset or errors with some browsers - - script: setFocus not working with textarea widgets - -## 1.27.3 - -- bug fixes - - regression causing circular loop errors upon certain editions - - fader: glitch with large `lineWidth` values in default design mode - -## 1.27.2 - -- bug fixes - - multixy: `default` not applied when points are named - - clone: avoid some unnecessary property checks - - clone: prevent missing editions in target properties (e.g. VAR{} renamed with the same return value) - -- client - - show 3-dots menu in read-only mode with access to allowed items (e.g fullscreen) - - hide console in read-only mode - -- widgets - - matrix: don't implicitely override children's `label`, do it explicitely in `props`' default - -- custom module - - `receive()` and `send()` now accept `host` and `port` to be provided as a single string argument joined by a colon - -## 1.27.1 - -- bug fixes - - server: `fullscreen` option not working when `read-only` is set - - led and text widgets not client-syncing - - patchbay: `address` not working properly when set to `auto` - - patchbay: `ignoreDefaults` not working properly - - editor: missing position indicator in color picker pad - - file browser: fallback to home directory when last visited directory is not accessible - -- mobile - - apply root's (or themes) background color the the browser's topbar when possible - - -## 1.27.0 - -- bug fixes - - app address / qr code not updating when network changes - - issue after theme auto reload (broken grid, colors not updated) - -- widgets - - pads: expose css variable `--point-size` - -- custom module - - provide error backtraces in module.exports functions - - add `reload()` callback to provide finer control over the module's lifecycle - - add `stop()` callback (runs when the server stops) - -- remote control - - add /SESSION/CREATE command - -- client - - file browser now remembers the last displayed directory - - allow dismissing notifications by clicking on them - - allow toggling notifications globally from main menu - - add `notifications` client option - -## 1.26.2 - -- bug fixes - - user resources not loading when using an external browser - - advanced syntaxes resolution order issue - -- advanced syntaxes - - display an error in the console in some unsupported advanced syntaxes use cases - -## 1.26.1 - -- bug fixes - - mac: unable to show launcher windows when starting minimized - -## 1.26.0 - -- bug fixes - - scripting: `getProp()` now correctly returns a copy of the property if it is an object - - prevent infinite loop when loading widgets with complex inter-dependencies - - modal: layout issue on iOS 15+ - -- widgets - - dropdown: allow resubmitting the same value - - switch: allow resubmitting the same value - - plot: missing `logScaleX` and `logScaleY` properties - - xy/multixy: add `axisLock` property; allow locking one the axis by holding `Shift` while dragging if `axisLock` is not set, bypasses it otherwise. - - knob/fader/range: add `colorKnob` property - -- launcher - - on Mac, start hidden if `Start minimized` is set - - allow dropping files into file fields - -- custom module - - expose `tcpServer` to allow monitoring the state of tcp connections - -## 1.25.7 - -- bug fixes - - rare issue that made the last widget(s) in a container disappear when other widgets in the same container had a specific property dependency pattern - -- remote control - - `/EDIT*` commands sent by a custom module are not affected by the server's `read-only` option anymore - -- widgets - - input: allow using a number in `numeric` to specify stepping value for mousewheel interaction - - root: add `onPreload` scripting property - -## 1.25.6 - -- bug fixes - - sliders: error when `steps` is an array - -- scripting - - `stateSet`: add optional `{send: false}` flag - -## 1.25.5 - -- bug fixes - - code editor: issue when middle clicking in the editor on linux - - code editor: modern js operators such as `**` not recognized - - sliders: prevent error when `steps` is not a number, add `auto` mode for using ranges values as steps (it did not work before) - - pads, range: value not initialized as an array, causing errors in some cases - - modal: popup not closing when `doubleTap` is true - -## 1.25.4 - -- bug fixes - - custom module: `receive()` not passing boolean arguments properly - - fix `--authentication` on iOS clients - -- editor - - display current widget value in the `value` property's help modal - -## 1.25.3 - -- bug fixes - - input: rendering issues with big font sizes - - panel: tab rendering issue when initialized with a non-numeric value - - panel: minor style issue in tab navigation bar - - scripting: scripting functions not working inside `browseFile()` callback - - scripting: using `external: true` in `set()` should prevent affected widget from sending any message - - button: inconsistent value in `push` mode with `decoupled` enabled when setting value from script - -## 1.25.2 - -- bug fixes - - textarea: escape key not restoring previous value - - scripting: `setFocus(id)` not affecting textarea widgets - - led, text, variable: value not synchronized between different clients - - error when running from sources on Mac - -## 1.25.1 - -- bug fixes - - regression in inter-widget sync mechanism - - regression breaking `set()` function in scripts - - textarea: display nothing instead of "null" when receing no value, null or an empty string - -## 1.25.0 - -- bug fixes - - multixy: doubleTap not working on touch devices - - button: `x` and `y` variables not passed to `onValue` when `doubleTap` is true on touch devices - - advanced syntax: update issue with clones using their own value in their properties - - client: minor keyboard shortcut issues - - panel: mitigate client synchronization issue with scrollbars - -- widgets - - menu: add a background to menu items to help distinguish them - - menu: merge different interaction modes into a single `mode` property - - menu: add `swipe` mode - -- remote control - - `/STATE/SET`: add optional argument to prevent widgets from sending their value - -## 1.24.2 - -- bug fixes - - editor: regression breaking widget context menu actions under "Position" submenu - - touch devices: touchend event not fired on elements removed/detached during touchstart/touchmove callbacks (caused issues when switching tabs using a button inside a tab) - - -## 1.24.1 - -- bug fixes - - launcher: `Ctrl+M` keyboard shortcut not working - - widgets: regression incurring a small delay before resolving a property that depends on a widget's own value - - server: `--client-size` and `--client-position` options not parsed correctly - -- advanced syntaxes - - support `@{}` inside `IMPORT{}` - -## 1.24.0 - -- bug fixes - - widgets: circular value feedback issues - - editor: `ctrl + e` not working when hit multiple times without releasing `ctrl` - - mobile: "prevent sleep" feature not working - -- widgets - - patchbay: add `in`, `out` and `both` modes to `exclusive` property - - panel: replace `verticalTabs` property with `tabsPosition` (supports 4 directions) - -- custom module - - add optional `errorCallback` argument to`loadJSON` and `saveJSON` - -- server - - print multiple qrcodes if multiple network interfaces are available and prevent printing a qrcode for the localhost address - -- misc - - add linux rpm packages - -## 1.23.0 - -- bug fixes - - linkId not working between two encoder widgets - - fader: `gradient` breakpoints not positioned correctly - - canvas: `onDraw()` called twice when calling `updateCanvas()` - -- midi - - optional rpn/nrpn parsing as single messages - -- widgets - - keyboard: incoming values different than the `off` property are now interpreted as `on` - -- editor - - when focusing the label property with `F2`, select all text in the text area - - preserve scroll position in code editor when validating - - display the id of selected widget in the inspector's header - -- scripting - - expose file browser (from the file widget) as a scripting function - -- custom module - - don't restrict file extension in `loadJSON()` and `saveJSON` functions - -- misc - - add polish locales (@ Manz4rk) - - add css classes to some notification popups to allow targetting them with css themes - -## 1.22.0 - -- bug fixes - - keyboard widget: `linkId` not working (unable to link 2 keyboard widgets) - - slides: issues with ranges containing decimal keys - -- launcher - - add menu options to show the qr code again - - mac: change "List MIDI devices" keyboard shortcut to `Ctrl+m` - -- widgets - - image: add support for special value "qrcode" - -- misc - - add german locales (@ Magnus Reichel) - - package file names changed to follow debian's convention - - add a cli option to disable the qr code (`--no-qrcode`) - -## 1.21.0 - -- bug fixes - - custom module: fix autoreload on nested submodules - -- launcher - - print a qrcode when the server starts to help connecting mobile devices - -- editor - - horizontal scrolling issues with maximized code editor - -- widgets - - switch/menu/dropdown: add a syntax that supports duplicate labels in `values` property - -- custom module - - expose `global` object that persists accross module reloads. - -- scripting - - onCreate: expose `value` - -## 1.20.0 - -- bug fixes - - scripting: prevent some functions to be marked as undefined - - advanced syntaxes: ignores quotes around file path in `IMPORT{}` - -- launcher - - add `Start minimized` menu option - -- misc - - change noFocus client option behavior: the default client window now doesn't take the focus at all, even when a text input is clicked. - - colorize debug messages for sent and received osc/midi messages - -- scripting - - add `setFocusable()` function to change the focusability of the window on the fly (allows reenabling focus temporarily to interact with a text widget using a dedicated toggle button for example) - - add `reload()` function - - expose Navigator object with `getNavigator()` - -- widgets - - fragment: add `fallback` property - -## 1.19.2 - -- bug fixes - - regression breaking touch move events on desktop touchscreens - -## 1.19.1 - -- bug fixes - - editor zoom: adjust root widget size when zooming out - -## 1.19.0 - -- editor - - add keyboard shortcut "h" to hide selection and widget drag / resize handles while pressed - - inspector: add some shortcut buttons in the header - -- widgets - - add folder widget (flat container that doesn't affect layout) - - input: add `maxLength` property - - multixy: allow setting its own value from onValue script while touched - -- ui - - add a virtual onscreen keyboard for desktop clients (can be enabled from the clients main menu) - - change local zoom (alt+scroll) behavior so that it only affect widgets and add scrollbars to navigate while zooming instead of following the mouse - -- server - - client-options: add `virtualKeyboard` option to enable virtual keyboard by default (desktop clients only) - -## 1.18.3 - -- bug fixes - - button: regression in push mode (`on` value not passed to `onValue` script when triggered from another widget) - - button: decoupled push mode returning wrong value when activated from a widget script - -## 1.18.2 - -- bug fixes - - canvas: `onTouch` not triggered on iOS when when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` changes - - switch: interaction issue when value labels contain icons - - ios: attempt to fix rendering glitch when waking up after sleep - -## 1.18.1 - -- widgets - - button: add `decoupled` property, compatible with all button modes - - button: remove `decoupled` mode - -## 1.18.0 - -- bug fixes - - client script source map not loading (helps providing useful error messages) - -- widgets - - button: add `decoupled` mode (toggle mode that only updates its state when it receives a value from osc/midi messages) - - button: add client option `altTraversing` to allow one-way response to traversing gestures for toggle buttons - - canvas: iOS: trigger `onTouch` when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` updates - - knob: add `snap-alt` mode (snap mode that allows jumping between range.min and range.max) - - all: add `borderRadius` property - -- scripting - - add `updateCanvas()` function (forces a canvas widget to redraw) - -- remote control - - `/NOTIFY`: if multiple arguments are provided, interpret the first one as the icon's name for the client notification - -- midi - - on Mac, name virtual ports after the device name to avoid confusion - -- server - - client-options: add `clientSync` option to allow disabling client synchronization - - client-options: add `altTraversing` option - -- editor - - add `F2` keyboard shortcut to bring label property input into view if selected widget has one - -## 1.17.0 - -- bug fixes - - editor: error when ctrl+clicking on a root's child - - range: multitouch interaction issue - -- widget - - knob / encoder: `sensitivity` and ctrl+drag gesture preserve `circular` mode behavior - - knob / encoder: `snap` mode now works like `circular` mode except for the touch start event (value can't jump from start to end anymore) - - patchbay: add `exclusive` option - -- editor - - allow interacting with a widget without selecting it by using the middle mouse button or by holding shift+win (shift+cmd on mac). - -## 1.16.6 - -- bug fixes - - visibility property update issues - -## 1.16.4 - -- bug fixes - - modal: display issue when a modal receives the same value multiple times - - patchbay: `outputs` property not handling object value properly - - server: resolution conflict between app files and user files - -- widgets - - patchbay: trigger `onValue` script when a connection changes - -- misc - - windows: allow accessing other drives than the default one (list drives when the file browser reaches the filesystem's root) - -## 1.16.3 - -- bug fixes - - custom module: submodules not loading their own submodules with relative paths properly - - custom module: issue with circular submodule requires - - server: harmless error message when importing css files from the main theme file - - server: allow using folder names "client" and "assets" for user files (eg for images used in a session) - -- widgets - - canvas: add `onResize` script property - - scripting: expose javascript's `Image` constructor - -## 1.16.2 - -- bug fixes - - widget visibility not updated properly when set as a non-boolean value - -- widgets - - tabs: detach hidden tabs from the DOM (reduces lag caused by heavy tabs) - -## 1.16.1 - -- bug fixes - - eq widgets not properly converted when importing v0 sessions - - image paths with url queries not loaded properly - - @{} syntax not returning truncated value according to the widget's precision property (fixed for primitive values only, object values are still returned as is) - -## 1.16.0 - -- advanced syntaxes - - `@{}` and `VAR{}` that return objects / arrays do not return a copy of their value anymore as it may introduce a significant overhead when used extensively. Mutating these objects in `#{}` and `JS{}` scripts will now affect the actual values and should be avoided at all cost. -- widgets - - `comments` property flagged as dynamic - - multixy: add `doubleTap` property - -## 1.15.8 - -- bug fixes - - range: value update issue (internal touch state not updated properly) - - scripting: send(): ignore `ignoreDefaults` property - - script: onKeyboard script not cleaned upon edition / removal - - editor: some variables not appearing as defined in `onKeyboard` - -## 1.15.7 - -- bug fixes - - matrix: property resolution issue with object/array items in `props` - - bypass client option `nofocus=1` when the editor is enabled - - menu/dropdown: display label when value is undefined - -- misc - - updated midi bridge: provide more information when loading fails; may fix some compatibility issue on windows - -## 1.15.6 - -- bug fixes - - ios: prevent server error related to the use of cookies - - scripting: `getVar()` now returns a copy of the variable to prevent mutations on saved object - -## 1.15.5 - -- bug fixes - - matrix: advanced property issue in `props` property (bis) - -- editor - - inspector: add solo mode with `alt+click` for category panels - -## 1.15.4 - -- bug fixes - - matrix: advanced property issue in `props` property - -## 1.15.3 - -- bug fixes - - interaction issue ("deadzone") on touch screens - - main menu not hidden when `read-only` is set - - osc messages containing unicode characters not encoded correctly - -## 1.15.2 - -- bug fixes - - modal: scroll state not restored when the modal container is recreated - - server: allow spaces and accentuated characters in client id - -## 1.15.1 - -- bug fixes - - prevent flickering on canvas based widgets when they are recreated - -- editor - - added code editor for `html` and `css` properties - -- remote control - - add `/RELOAD` command - -## 1.15.0 - -- bug fixes - - editor: prevent accessing non-editable widgets with right arrow - - multixy: regression causing interaction issue - -- widgets - - add `lock` property to all widgets - -- launcher - - add `Autostart` menu option - -- misc - - update FontAwesome icon font to version 6 - -## 1.14.6 - -- bug fixes - - inspector: script editor: cursor alignment issue in indented lines - - clone: prevent freeze and print an error when attempting to create a circular clone - - modal: regression on android that prevents focusing input widgets in modals - -## 1.14.5 - -- bug fixes - - session loading error with some malformed property cases - -## 1.14.4 - -- bug fixes - - broken console interpreter since v1.14.0 - -- widgets - - button: add `momentary` mode for sending messages with no value; prevent button from getting stuck when `on` and `off` are equal in `momentary` and `tap` modes - -- inspector - - color picker: inline picker widget (no longer in a modal); show color changes on the fly - - code editor: validate input with `cmd+enter` instead of `ctrl+enter` on Mac - -- scripting - - `screen.height` and `screen.width` always returns the current screen dimensions - - added `screen.orientation` global variable - -- misc - - some performance improvements - -## 1.14.3 - -- bug fixes - - osc receivers (`OSC{}` syntax) now apply the same rule as widgets regarding midi messages (only receive if the message's origin matches one of the host widget's midi targets) - - modal: rendering issue on iOS - - button: `locals.touchCoords` not updated since v1.14.0 - -- widgets - - clone/fragment: remove scripting properties as they are supposed to be overridden in `props` - -## 1.14.2 - -- bug fixes - - context-menu: double click issue in submenus on small touch screens - - clone/fragment: broken onDraw / onTouch scripts if cloned widget is a canvas - -## 1.14.0, 1.14.1 - -- bug fixes - - misc: sending typed arguments (`{type, value}` objects) should override the widget's `typeTags` definition - - multixy: errors when `ephemeral` is `true` - - scripting: `setVar` not affecting all widgets when multiple widgets match provided id - -- widgets - - renamed `script` property to `onValue`, `draw` to `onDraw`, `touch` to `onTouch` - - added `onCreate` script property to all widgets - - added `onTouch` script to widgets that supported the touch state variable in scripts (now deprecated) - - script: added `onKeyboard` property, removed `event` property - - canvas: expose additional touch event informations (`radiusX`, `radiusY`, `rotationAngle` and iOS-only `altitudeAngle`, `azimuthAngle` and `touchType`) - -- scripting - - special keyword `this` now returns the string `"this"` - -- advanced syntaxes - - added `IMPORT{file}` syntax to allow loading external files in properties - -- editor - - add fullscreen mode for properties with code editor enabled - -## 1.13.2 - -- bug fixes - - editor: keep relative sizes and positions when resizing multiple widgets at a time - -- widgets - - canvas: expose touch pressure (as `event.force`) in the `touch` script. - - canvas: expose touch events for extra elements added with the `html` property - -## 1.13.1 - -- bug fixes - - editor: data loss when leaving the editor's focus with no modifications - -## 1.13.0 - -- bug fixes - - scripting: `storage.getItem()` not returning anything - -- editor - - new code editor for `script`, `touch`, `draw` and `props` properties with syntax highlighting, line numbers, etc - -- scripting - - `set()`: add an option to prevent target widget's script - -- widgets - - root: add `hideMenu` property - -- misc - - minor cosmetic changes - -## 1.12.0 - -- widgets - - new **canvas** widget (under `pads`): allows creating custom widgets - - button: expose normalized touch coordinates in scripts as `locals.touchCoords` - - print a warning in the console when using advanced syntaxes in the script property - -## 1.11.1 - -- bug fixes - - client options specified in server config not working unless lowercased - - make disconnection detection less aggressive (don't display notification if reconnection succeeds quickly) - - panel: initial scroll state issue - -## 1.11.0 - -- bug fixes - - menu: interaction issue on iOS - - script: prevent script functions from being called in the wrong scope (ie when leaked using the `globals` object) and print an explicit error - - containers: prevent errors with some color formats in colorWidget - - theme: relative url not resolved correctly - -- widgets - - when a panel contains widgets and has `scroll` set to `true`, its value will be used to represent the scroll position for x-axis and y-axis between 0 and 1. - -## 1.10.3 - -- bug fixes - - config not persistent on windows - -- misc - - read-only mode now hides and disables the main menu - -## 1.10.2 - -- bug fixes - - certificate expiration issue - - regression breaking colors in canvas-based widgets - -## 1.10.0 - -- bug fixes - - sliders: ignore key order in `range` - - sliders: handle mousewheel increment when starting from a value between two steps with `steps` property defined - - inspector: allow scrolling in the help modal - - console: fix command history behavior and increase history size - -- widgets - - encoder: expose angle in script (as `locals.angle`) - - new textarea widget (multi line input) - - expose the computed dimensions of canvas-based widgets in `css` (as `--widget-width` and `--widget-height`) and `script` (as `locals.width` and `locals.height`) - -- client - - add `Save backup` menu action (saves a backup copy of current session with an incremented suffix appended to the file name) - -## 1.9.14 - -- bug fixes - - modal: remove `html` property - - matrix: nested property inheritance (eg. `@{id_@{id_x}}`) not working in `props` - -## 1.9.13 - -- bug fixes - - nested property inheritance (eg. `@{id_@{id_x}}`) not updating properly - - canvas based widgets not updating when hidden - -## 1.9.12 - -- bug fixes - - client options: options ignored if not lowercased - - sliders: prevent errors for some edge-case `range` values - -## 1.9.11 - -- bug fixes - - range: value not properly updated with set() - -- misc - - (built-in client only) add `nofocus` client option to prevent the client window from taking focus unless a text input or a dropdown is clicked. - - -## 1.9.10 - -- bug fixes - - matrix: regression from 1.9.8 (broken nested @{} syntax in props property) - -- misc - - midi: detect missing binary (eg when deleted by antivirus) and print a message - -## 1.9.9 - -- bug fixes - - matrix: regression from 1.9.8 - -## 1.9.8 - -- bug fixes - - matrix: update children when `props` is modified even when the result for `$ = 0` doesn't change - - fragments: fragment widgets empty when reloading - - panel: scrollbar issue on iOS 13+ - -- scripting - - expose `console.clear()` - -## 1.9.7 - -- bug fixes - - issue when resizing widget using keyboard shortcuts - - advanced syntaxes (VAR{}): avoid storing default value as string if it can be parsed as a javascript primitive (boolean, number, etc) - - advanced syntaxes (VAR{}): ignore quotes around variable name - -- editor - - change keyboard shortcuts for moving widgets (now `mod + arrows`) and navigating in widgets (now `arrows`) to feel more natural with the project tree view. - -- widgets - - script: bypass keyboard shortcuts already used by the editor if it is enabled - - matrix: removed ambiguous `start` property - - matrix: advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket - - text: add `soft` mode for the `wrap` property - - input: improve `numeric` mode on iOS - -## 1.9.6 - -- bug fixes - - advanced syntaxes: `VAR{}` not updating when the default value is edited - - editor: fix "Bring to front" and "Send to back" context menu actions - -- ui - - add keyboard shortcuts `mod + "+"` and `mod + "-"` to control zoom level - -- widgets - - input: add `numeric` property (allows numeric values only and displays numeric keyboard on mobile devices) - - button: add `soft` mode for the `wrap` property - - switch: add `wrap` property - -- editor - - display dropdown and checkbox for boolean properties with extra choices - -## 1.9.5 - -- bug fixes - - advanced syntaxes: various issues and regressions - - editor: preserve advanced syntaxes in `left` and `top` when pasting a widget - -- editor - - tree: update widget visibility when it changes dynamically - -## 1.9.4 - -- bug fixes - - prevent error with empty `OSC{}` blocks - - regression breaking advanced syntax blocks containing nested brackets - -- advanced syntaxes - - new syntax for creating and using custom variables in properties: `VAR{name, default}` - - `JS{}` blocks don't require 2 brackets anymore (`JS\{\{}}` still works) - -- scripting - - add `getVar()` and `setVar()` for reading and modifying custom variables. This allows modifying properties directly from scripts (if they contain `VAR{}` blocks). - - expose session path as `globals.session` - -- editor - - make tree item blink when hitting "Show in tree" - -- remote control - - add `/SCRIPT` command to run scripts remotely - -## 1.9.3 - -- bug fixes - - scripting: set() not working from a slider to a pad - - tabs not sending messages / triggering scripts when clicked in editing mode - - prevent hang with some syntax errors in advanced syntaxes - - don't show project tree if minimized when creating a new widget (1.9.2 regression) - - fix "ID + 1" paste for widgets with numeric ids - - dropdown: reset the underlying dropdown when the widget's value is undefined - -- editor - - tree: allow specifying multiple type filters - - tree: add "Show in session" context menu action - -## 1.9.2 - -- bug fixes - - visualizer: remove `bars` and `dots` option - - plot: fix `bars` option - - project tree: clear filter input when loading a session - - server: fix serving files from paths containing accents - - editor: keep editor open when loading a session - - menu: prevent clipping in container on iOS - -- widgets - - image: add pre defined values for `size`, `position` and `repeat` properties - - text: add vertical alignment choices to `align` - -- editor - - tree: add icons before widget ids depending on the category - - tree: activate tab when selecting it in the project tree - - tree: allow dragging widgets from a container to another - - tree: expand container when a new widget is created inside it - - tree: add support for filtering widgets by type (by typing `type:fader` for example) - - smarter shift+drag selection: allow selecting widgets in the area when the event started on the parent container - - select newly created widgets/tab except when copy-pasting - -- remote control - - add `/STATE/SEND` command - -## 1.9.1 - -- bug fixes - - button: allow writing strings like `"1.0"` in `label` without removing the decimals - - editor: use css variable `--grid-width` at startup and after disabling & enabling the grid - - launcher: regression preventing server halt when built-in client is closed manually beforehand - - scripting: prevent crash (built-in client only) when using the variable `navigator` - -- widgets - - menu/switch/dropdown: reset value to `undefined` when receiving a value that's not defined in `values` - -- scripting - - expose instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) as `globals.clipboard` - -- midi - - allow sending note off with velocity - - add option for receiving note off with velocity - -- misc - - v0->v1 session conversion: remove `JS\{\{}}` in script property - -## 1.9.0 - -**Warning** Sessions saved with this version will not open in older versions (sessions saved with older version will open in this version). - -- bug fixes - - remote-root option not applied on resources loaded by the client app (css images, etc) - - input: display issue when resizing the window - - launcher: cancel stopping the server when there are unsaved changes in the built-in client - -- editor - - context menu: add `export` action to export a widget as a fragment file - - show project tree if minimized when clicking on "Show in tree" - -- widget - - **new** `fragment` widgets (under `containers`): embedded session or fragment file with overridable properties. - - add `comments` property to all widgets - -- launcher - - add `Always on top` menu toggle - -## 1.8.15 - -- bug fixes - - editor: error when duplicating widget while if the clipboard is empty - - ui: local zoom move issue when not in fullscreen - - custom module: `clearInterval()` not working - - regression breaking style attribute in html property - -- misc - - faster local zoom - -## 1.8.14 - -- bug fixes - - `alt+shift+c` not working when pressed before dragging - - incremental pasting issue with address property - - generate scrollbars for panels on iOS 13+ - - fix scrolling on chrome for iOS 13+ - -- editor - - add `mod+d` and `mod+shift+d` for duplicating widgets - - use a temporary clipboard when duplicating widgets - -- misc - - inspector: move `script` property to `scripting` category - - ui: minor style tweaks - - -## 1.8.13 - -- widgets - - file: show save icon when mode is set to save - - file: center icon when hidePath is set to true - - sliders/pads: apply `spring` property dynamically - -- ui - - add `alt`+`wheel` for local zoom centered on cursor - -- editor - - add `alt+c+drag` and `alt+shift+c+drag` for duplicating dragged widgets - -## 1.8.12 - bug fixes: - - project tree: filter input position issue when scrolling - - sliders/pads: apply `spring` property dynamically + - multiclient sync not working when `targets` is empty + - widgets: missing `target` property for `plots/*` widgets, required for MIDI bindings + - editor: set `label` to `auto` instead of `true` when using the toggle button + - editor: errors when hitting `mod + a` and unselecting widgets + - modal: correct popup title color + - options: allow `midi:port_name` pairs in `--send` option + - sidepanel/state: opening a state file now properly sets it as the next default save location +- widgets: + - **new** `menu` widget, circular alternative to the dropdown & switch widgets + - file: allow selecting folders + - text: optimize value update when there's no icon to draw +- editor: + - convert invalid quote characters automatically to avoid errors + - tab: added `detached` property (set to false to prevent iframes from reloading when the tab opens) -- project tree - - select range of contiguous widgets with shift + click - -- misc - - plot: remove unused `filters` property; fix description for `rangeX` and `rangeY` - - console: focus input when the console opens - -## 1.8.11 +## 0.48.8 - bug fixes - - switch: widget not reacting at first touch when traversing is enabled on parent - - sliders: disable mousewheel when `spring` is enabled + - strip: layout issues when moving widget in a strip (min width/height still active) + - tcp: prevent sending osc messages on udp port when the same port number is set as a tcp target + - midi: take server default targets into account to determine widget matching + - save dialog: prevent keys widgets from capturing keystrokes when typing the filename + +## 0.48.7 + +- bug fixes + - xy: broken `spring` property + - macOs: add support for emulated right click via `ctrl+click` + - midi: messages received from a midi port now only affect widgets that send to this port + +## 0.48.6 + +- bug fixes + - ios: prevent color issues with sliders + - editor: prevent all keyboard shortcuts from triggering default browser actions +- main + - detect http server silent setup failure + +## 0.48.5 + +- bug fixes + - regression breaking support for utf-8 strings in received osc messages + +## 0.48.4 + +- bug fixes + - launcher: limit terminal history size to prevent slowdown/freeze +- widgets + - knob: text pips support + - fader: add css variable `--gauge-width` + +## 0.48.3 + +- bug fixes + - widgets: prevent update errors when widgets are not fully initialized + - prevent pinch-zoom on touch screen + +## 0.48.2 + +- bug fixes + - editor: checkbox position in multiline fields + - patchbay: widget not responding to osc after being edited +- widgets + - script: added `httpGet` function for simple local http requests + + +## 0.48.1 + +- bug fixes + - modal: `popupLabel` update issues + - modal: `popupTop` not correctly interpreting percents + - editor: scrollbar issue in editor's input fields on recent chromium + +## 0.48.0 + +- bug fixes + - midi: listing devices from context menu not working when the midi options is empty + - package: broken build from sources on Windows + - editor: incorrect position when moving a widget from an edge with the keyboard + - modal: prevent touchend event from reaching the inner widgets when opening the container + - matrix: clone matrices not properly storing their children's values + - multipad/range: errors when dragging over when the gesture was initiated on a traversing widget (ie matrix) - widgets - - script: add `once` event mode - - encoder: remove `spring` property + - **new** html widget + - frames: allow loading local html files without requiring a web server to serve them + - text: escape html tags characters (`<` & `>`) + - input: added `asYouType` property + - sliders/pads: added `sensitivity` property + +## 0.47.4 + +- bug fixes + - keys: prevent default browser actions when a combo is bound to a widget (for example print dialog with ctrl+p) + - xy: broken `doubleTap` + - widget: error when two sibling widgets have a non-dynamic property depending on each others and on another widget at the same time + - cli: broken `--version` option + +## 0.47.3 + +- bug fixes + - regression causing errors with the `value` property + +## 0.47.2 + +- bug fixes + - midi: `path` option not applied to launcher's `list` contextual action + - midi: pitchbend messages not received correctly + - style: layout issues in recent chromium + - encoder: `0` value in `back` property not working + - editor: state not completely restored under some conditions + - push: force release when the widget is removed/recreated while pressed + +## 0.47.1 + +- bug fixes + - css font faces not loading from absolute/relative paths +- midi + - added `path` option for setting python binary path manually + +## 0.47.0 + +- bug fixes + - launcher: spaces not properly escaped in quoted strings +- widgets + - sliders: `default` and `spring` properties are now dynamic +- server + - images urls are now resolved relatively to the session path directory by default (fallback to absolute path resolution if not found) - custom module - - expose `process` global + - added `loadJSON` and `saveJSON` functions -- scripting - - add `openUrl` function +## 0.46.2 -## 1.8.10 +- improved canvas rendering speed on chrome v69 and above +- widgets + - modal: `scroll` option + - script: `get(id)` function added in `script`execution context + - script: `getProp(id, property)` function added in `script`execution context + - script: `id` variable added in `script`execution context (id of the widget that triggered the script) + +## 0.46.1 - bug fixes - - modal: issues with children's visibility - - console: allow multiple arguments in console.log() + - windows: midi debug strings not printed +## 0.46.0 + +- bug fixes: + - modal: `css` not properly applied if the property was previously empty and the modal had been opened at least once + - image: allow overriding css background-image when value is empty +- widgets + - switchers: new `state` widget +- remote control + - added `/STATE/[GET|SET|STORE|RECALL]` methods +- midi + - print port name in debug messages + - added `pc_offset` option to act as if program change numbers where between 1 and 128 + +## 0.45.7 + +- bug fixes + - image: `cache` option inverted + - image: allow whitespaces in url +- widgets + - keyboard: `toggles` options + +## 0.45.6 + +- bug fixes + - bottom horizontal scrollbar not responding on small screens + - remote file browser: hitting a letter to select a file based on its name was looping on the first two matches only + - editor: preserve backslashes in enquoted strings (not in objects/arrays) + - editor: clear the editor when selected widget is removed by an undo/redo action +- widgets + - `logScale` can be set to a number to use a logarithm base different from the default + - knob: `compact` mode is back + +## 0.45.5 + +- bug fixes + - absolute file paths not resolved under windows + - nested `@{}` calls issue ([#516](https://github.com/jean-emmanuel/open-stage-control/issues/516)) + +## 0.45.4 + +- bug fixes + - handle network drops correctly (notify immediately and fix reconnection mechanism) + - formulas breaking the property update mechanism when not resolved + - modal: title layout issue + +## 0.45.3 + +- bug fixes + - broken client sync for widgets with `split` set + - custom module: `receive` function not working when omitting host/port and sending only one argument + - file browser: prevent error when files/folders cannot be read + +## 0.45.2 + +- bug fixes + - potential security issue in `JS{{}}` parser + +## 0.45.1 + +- bug fixes + - broken session local export + - potential security issue in custom module parser + +## 0.45.0 + +- bug fixes + - regression (v0.41.4) breaking sync between clients + - sessions not added to history when opened + - switch: traversing mode issue + - remote file browser reactivity issue + - encoder: broken because `ticks` default was `auto` instead of `360` +- main + - state files can be saved remotely +- widgets + - **removed** deprecated widgets `multifader`, `multitoggle`, `multipush` and `formula` + - new `JS{{}}` property syntax, allows writing formulas using javascript + - errors encountered in `#{}` blocks are now printed to the client console (F12) + - keys: renamed formula context variable `super` to `meta` + +## 0.44.0 + +- bug fixes + - ios: clone widget not displaying properly + - keys: error when leaving the window with the cursor while holding a key-combbo pressed + - session: disable saving when `--read-only` is set +- main + - sessions can be opened and saved from/to the server's filesystem directly +- widgets + - new `file` input widget (allows selecting a file on the the serve and sending its absolute filename) +- midi + - :warning: **breaking changes** :warning: + - replaced python dependency `rtmidi` with `python-rtmidi` (provides pre-compiled binaries for all major platforms) + - sysex messages are now discarded by default, they can be enabled by adding `sysex` to the midi options + +## 0.43.0 + +- bug fixes + - sidepanel: resize handle overflow issue - ui - - launcher: add many keyboard shortcuts - - client: add keyboard shortcuts for clearing the console - -- scripting - - add `setFocus` function to focus an input widget programmatically - -- misc - - add `usePercents` client option - -## 1.8.9 - -- bug fixes - - script: issue when using the `options` argument in `set()` (options leaked to subsequent set() calls in the script) - - multixy: `decimals` property not applied - - multixy: spring behavior not working until all points are released - - custom module: prevent require() from reading submodules files each time and instead return the object in memory - -## 1.8.8 - + - sidepanel: hidden resize handle; show edge resize handle on hover - launcher - - add file browser button for the `theme` option and fix parsing path containing spaces if only one theme is set - -- windows - - remove `ctrl+w` shortcut for closing a window (use `alt+f4` instead) - - -## 1.8.7 - -- midi - - add active sensing messages support (received as sysex) - -- remote control - - restore `/TABS` command (for opening tabs by ids) - + - added context menu action to display midi device list without starting the server - widgets - - encoder: expose rotation speed in script (as `locals.speed`) - -## 1.8.6 - -- bug fixes - - range: per-fader touch event not emitted properly - - rgb: fix `spring` property - - rgb: touch event not emitted - -## 1.8.5 - -- bug fixes - - midi: debug messages displayed as errors - - launcher: broken context menu - -## 1.8.4 - -- bug fixes - - input: prevent focus when selecting the widget for edition - - input: submit content when leaving focus, not only when hitting `enter` or `tab` (`esc` still cancels) - - midi: prevent midi bridge from stopping when an error occurs; provide meaningful errors when connection fails - -- editor - - inspector: hitting ctrl+s while editing a property will submit the change before saving - -- ui - - hide the console toggle button when the bottom panel is minimized and the editor is disabled - -- widgets - - file: add `mode` property, for choosing between `open` and `save` modes - - switch: add `flip` mode - -## 1.8.3 - -- bug fixes - - keyboard: allow note numbers up to 127 - - server: return http 404 error when a user-requested resource is not found instead of keeping a pending request - - modal: `visible` property not applied correctly - - -- project tree - - add an input for filtering displayed widget by id - -## 1.8.2 - -- bug fixes - - menu: allow manual line breaks ("`\n`") in labels / values - - custom module: parsing issue when sending widget data using `receive()` (`type` attribute erroneously parsed as an osc typetag) - -- widgets - - html property: allow "href" attribute on "a" elements - - -## 1.8.1 - -- bug fixes - - script: stops triggering osc messages under some circumstances - -## 1.8.0 - -- bug fixes - - project tree: layout issue with deeply nested widgets - - ios 10.3 regression - - file browser: layout issue with long paths - + - switch: add `traversing` option (`true` by default) + - knob: act as a relative encoder when traversing gestures are enabled and `snap` is `false` + - keys: `key` variable in `keydown` and `keyup` is now always lowercased when referencing a single character + - keys; expose `code` variable from the keyboard event object (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#Code_values) - custom module - - add `nativeRequire` function (allows loading native node modules or locally installed modules) + - expose shorthand functions `send` and `receives` + - expose a client object instead of just an id in `app` event handlers to allow retrieving the client's ip address as well + - custom modules can now be written like standard nodejs modules (using `module.exports` assignement instead of a self-invoking function pattern) -## 1.7.8 - -- bug fixes - - canvas-based widgets not drawn when placed in a modal while having a conditional visibility set - - text: missing `decimals` property - - clone: fix usage of osc listener syntax (acts as if clone has an `address` property set to `auto`) +## 0.42.0 - widgets - - clone: make `props` property dynamic (avoid full widget rebuild when possible) - -- misc - - increase client console history size and allow changing it with client url options - -## 1.7.7 - -- bug fixes - - startup regression - -## 1.7.6 - -- bug fixes - - (harmless) error raised when starting the server from the launcher with `debug` set to `true` - + - `OSC{}` syntax accepts an optional third argument (`false`) to bypass the host widget's `preArgs` - editor - - display/save color picked values with css rgba notation instead of hexadecimal + - sticky header to remind selected widget's id + - sidepanel can now be resized by dragging its edge +## 0.41.7 + +- bug fixes + - matrix: `$` variable not starting at `start` + - matrix: properties not reset to default when removed from `props` + +## 0.41.6 + +- bug fixes + - keys: binding conflict with editor + - xy: drawing performance issue + +## 0.41.5 + +- bug fixes + - editor: changes applied to wrong widget when clicking on a widget while editing another widget's property + - push: allow setting `value` property + - allow whitespaces in path for `--custom-module` + - error when changing a property that's inherited by a widget to define its address and at least one non-dynamic property - widgets - - modal: add `ignoreTabs` option (allows overflowing tab ancestors) - - menu: add `ignoreTabs` option + - sliders: when `steps` is set, scrolling on the widget makes it go directly from one step to another -## 1.7.5 +## 0.41.4 - bug fixes - - ios: cloned menu not displayed correctly - - engine: downgrade to fix startup issue on windows + - broken `--remote-saving` option* + - `fader`: built-in `meter` not updating its `address`, `preArgs` & `color` properties + - incorrect osc messsages when widget's `split` and `preArgs` are set -## 1.7.4 +## 0.41.3 - bug fixes - - editor: cloned `dropdown` and `input` widgets not opening when selected - - widgets: prevent value-stateless widgets (tap buttons, clone, scripts, html and svg) from sending a value for cross-client synchronization (leads to unexpected script execution) and exclude them from state saves - - input: apply `decimals` number before checking the value against the `validation` expression - - range: `steps` and `dashed` property not working; remove `origin` property - - config conflicts between launcher and server (affecting at least session history) + - `rgb`: values were rounded even with `precision` different from `0` +- osc + - add support for utf8 string argments (encoded/decoded as per standard https://encoding.spec.whatwg.org/#utf-8) -## 1.7.3 +## 0.41.2 - bug fixes - - custom module / theme: prevent reloading the module while the file is being written to - - server: if a theme is used, attempt to resolve image urls against the theme file's location - - modal/button: prevent error when `label` is updated + - geometry properties not properly applied when reset to `auto` + - `strip` layout not properly applied when changing the widget's `horizontal` property + - `modal` glitch on chromium v70 -- widgets - - encoder: add `ticks` property back - -## 1.7.2 +## 0.41.1 - bug fixes - - midi: mtc parsing error - - custom module: hot reload cache issue on windows + - error when loading session file + - prevent sidepanel issue when toggling quickly - -## 1.7.1 - -- bug fixes - - regression causing server errors - -## 1.7.0 - -**Important change** - -Prebuilt binaries are now supplied only for 64bit Linux/MacOs/Windows. Other platforms should use the `node` package or build it from sources. - -**MIDI support** - -As of this version, packages except the `node` package are bundled with a midi binary that will be used whenever midi's `path` option is not set. It is no longer necessary to install `python` and `python-rtmidi`. - -**Changelog** - - -- bug fixes - - editor: missing context menu (copy, paste) in inspector inputs - - widgets: osc listeners not resolving "auto" address - - cli: `ELECTRON_RUN_AS_NODE` headless mode not working without `--no-gui` option - - ios: clone widget not laid out properly in horizontal panels - - ui: missing vertical scrollbar when root's height overflows the workspace - - server: provide readable error when a file requested by the client file is not found - - tab: content not drawn when changing visible property - - matrix: addresses not generated property when matrix' address is `auto` - -- ui - - add console bottom panel with a simple script interpreter - -- widgets - - keyboard: add `velocity` property (allows mapping the touch coordinates between `off` (top) and `on` (bottom)) - - input: add `validation` property (allows defining a regular expression that the value must match) - - modal: add `relative` position property - -- midi - - accept sending sysex strings without spaces between the bytes - - load prebuilt midi binary on 64bit linux/windows/osx - - add support for midi time code messages - -- misc - - sessions converted from v0 will use the widget's html property to display the former label property - -## 1.6.2 - -- bug fixes - - matrix: issues when changing non-dynamic properties (content not properly removed) - - input: apply default value when receiving an empty value or no value at all - -## 1.6.1 - -- bug fixes - - keyboard: prevent `script` property from being copied to each key - -- widgets - - keyboard: make `on` and `off` properties dynamic - - script: add `getIndex` function - - matrix/keyboard: `id` variable in script is now the `id` of the child widget that triggered the event - -## 1.6.0 - -- bug fixes - - range: error when setting `default` property - - range: fix `doubleTap` property - -- widgets - - all: add `html` property to allow inserting custom content in widgets (label, value, etc) and style it with the `css` property. - -- scripting: - - `send()`: ignore the widget's `bypass` property (allows bypassing default messages and define custom ones) - - `set()`: add supports for wildcards in the id parameter - - `set()`: add a 3rd optional parameter for preventing further script executions and/or osc messages from being sent - -- custom module - - automatically reload custom module when the file is modified - - add support for loading submodules with `require()` - -- theme - - automatically reload theme when the file is modified - -## 1.5.4 - -- bug fixes - - ssl: generate unique certificates (with random serial numbers) to avoid reuse errors. Certificates generated with older versions of o-s-c will be updated automatically. - - `~/` path prefix not recognized when using remote control commands like `/SESSION/SAVE` - - `~/` path prefix not recognized in `remote-root` option - - editor: paste ID+1: midi-related addresses should not be incremented - -- remote control - - add `/STATE/OPEN` and `/STATE/SAVE` commands - - ignore unsaved changes when loading a session with `/SESSION/OPEN` - - resolve relative file paths against `remote-root` setting - -## 1.5.3 - -- bug fixes - - editor: error when `preArgs` and `address` are modified at the same time (affects `/EDIT` command and matrix/clone widgets) - -## 1.5.2 - -- bug fixes - - launcher: midi device names containing multiple spaces not parsed correctly - - fullscreen: lack of support not detected on some ios devices - - multixy: labels not hidden when `ephemeral` is `true` - -- remote control - - add `/SESSION/OPEN` and `/SESSION/SAVE` commands - -## 1.5.1 - -- bug fixes - - widgets: touch state scripts not triggering some synchronization mechanism - -- widgets - - encoder: remove `steps`, `ticks` and `origin` properties - - encoder: make `sensitivity` work with values below 1 - -## 1.5.0 - -- bug fixes - - image: broken value validation - - menu/dropdown: use correct z-index - - dropdown: prevent dropdown from opening when selecting the widget for edition - -- editor - - holding `alt` extends the north-west handle to the widget's size to ease dragging - - widget properties reordered (e.g. style-related properties, even widget-specific, are now under the "style" category) - -- widgets - - remove `colorBg` for all widgets except containers - - widgets background color is now transparent by default (can be overridden with css) - - keyboard: added `colorBlack` and `colorWhite` properties to customize key colors - - dropdown/menu: add `label` property (with support easy key/value display) - - dropdown/menu: add `icon` toggle property - - modal: add `popupPadding` property to control the button's and the container's padding independently - -## 1.4.1 - -- bug fixes - - multixy/range: prevent some extra touch state events;` - -## 1.4.0 - -- bug fixes - - project tree: error when dropping a widget at its initial position - -- editor - - validate property change when clicking on a widget - - cancel property change when hitting escape - - add menu and keyboard shortcuts to reorder widgets - - add keyboard shortcut to show widget in project tree - - selected widget is not showed on top of the others anymore - -- widgets - - expose widgets unique identifiers with property name "uuid" - - xy/multixy: add `ephemeral` property - - fader/knob/xy/range/multixy: remove `touchAddress` property - - fader/knob/xy/range/multixy: expose touch state in `script` property (`touchAddress` usages will be converted automatically) - -## 1.3.0 - -- bug fixes - - editor: hide impossible actions from context-menu (eg adding widgets in tab containers) - - editor: error when selecting a tab/root widget while a property field contains unsubmitted changes - - panel: layout issue with tabs & lineWidth property - - input: extend focusable area - -- midi - - remove variable args in sysex messages (dynamic properties and scripting can be used to this effect) - - add support for sending sysex bytes as integers - - allow sending any system message (eg MIDI time code) - - add support for receiving MIDI time code messages (as raw sysex) (requires adding the `mtc` flag to the midi configuration) - - -## 1.2.1 - -- scripting - - expose toolbar menu actions - -- remote control - - optimise small changes made with /EDIT - -- widgets - - button: add `wrap` and `vertical` properties - - root: add `width` and `height` properties (helps building mobile layouts) - -## 1.2.0 - -- bug fixes - - editor: id not incremented when pasting multiple widgets with id+1 +## 0.41.0 - main - - remove support for extra args in the `custom-module` option (fixes some path issues) + - `--send` accepts `ip:port` and `domain:port` targets + - removed previously deprecated `--sync` option + - `--custom-module` now accepts extra options that can be consumed from the custom module's code + - sessions located on the server can now be saved remotely, this becomes the default behavior for keyboard shortcut `mod + s`, local export is still available via `mod + shift + s` + - added `--remote-saving` options to limit remote session saving feature to hosts that match the provided regular expression +- ui + - added notifications +- widgets + - `matrices`: **new** `patchbay` widget +- bug fixes + - layout break when hitting tab with sidepanel closed and editor enabled + - crash when running the server in an environnement without user home folder + +## 0.40.5 + +- bug fixes + - clone: editor's selection rectangle appearing after editing the clone's target widget + - windows: midi issue (python path not found) +- widgets + - input: hitting `tab` now validates the value before focusing the next input (hitting `esc` or clicking outside the widget still cancels); when focusing an input widget, its whole value is selected by default; focused/selected text color hint changes. + - matrix: widgets inherit from the matrix' `id` and osc properties by default + +## 0.40.4 + +- bug fixes + - editor: widgets/tabs not properly reordered when changing a widget or tab's index by more than 1 + - main: `--no-gui` switch not working when running the app from a different directory + - regression causing osc receivers (`OSC{}`) to conflict with property listeners (`@{}`) +- widgets + - push: add `doubleTap` option + - osc listeners (`OSC{}`) now accept relative addresses (without leading '/'), automatically prefixed with the widget's address + +## 0.40.3 + +- bug fixes + - editor: sidepanel & dragging handles not always updated after edition + - widgets: parsing error when a property contains more than 10 variables + +## 0.40.2 + +- bug fixes + - regression reversing tabs order + +## 0.40.1 + +- bug fixes + - editor: issue with tabs selection / edition + - regression breaking `svg` + +## 0.40.0 + +- bug fixes + - `--read-only` option not properly working + - `keyboard`: dynamic properties `target`, `precision` & `preArgs` not being updated dynamically +- widgets + - formulas: added `indexOf` function + - **deprecated** `multifader` / `multipush` / `multitoggle` in favor of the generic `matrix` widget + - meter: `gradient` can be set as an object to define uneven color breakpoints + +## 0.39.8 + +- bug fixes + - meter's properties not accessible (overridden with fader's properties) +- mobile + - button for preventing device sleep + +## 0.39.7 + +- bug fixes + - iOS 9.3 compatibility +- widgets + - sliders: `steps` property is now dynamic + +## 0.39.6 + +- bug fixes + - `modal` widgets not working since chrome v70 + +## 0.39.5 + +- bug fixes + - sliders: `steps` option not working when `range.min` is not `0` + - regression breaking the app for iOS 9.3 + +## 0.39.4 - widgets - - all: add `lineWidth` style property - - knob: add `solid` & `line` designs - - fader: add `knobSize` property + - multiXy: added `.pad-N` class to inner xy pads to help with css customization + - xy/multiXy: added css variables `--background`, `--color-pips`, `--pips-opacity` and `--point-opacity` + - rgb: added `alpha` option + - xy/multiXy/rgb: design impovements; + - sliders: new `steps` option +## 0.39.3 + +- bug fixes + - broken tabs color property + - broken `/TABS` command; this command doesn't makes panels send osc messages anymore + +## 0.39.2 + +- bug fixes + - regresssion: broken --theme option + - regression: missing 'edit parent' action in editor's context menu + +## 0.39.1 + +- bug fixes + - regression breaking icons in switches' labels + +## 0.39.0 + +- performance + - rendering speed improved (session loading time reduced by about 30%) +- widgets + - remove support for deprecated properties `path`, `noPip` and `noSync` + - sliders/pads: `precision` is no longer a dynamic property + +## 0.38.7 + +- bug fixes + - launcher compatibility issues with electron v3 + +## 0.38.6 + +- bug fixes + - regression with dynamic property `color` in panels and matrices +- packaging + - node-only package can be run with electron too + +## 0.38.5 + +- packaging + - regression causing the client js bundle to be much bigger than needed + - added node-only package built without electron for unsupported platforms (armv6, etc) + +## 0.38.4 + +- bug fixes + - `@{parent}` calls not working consistently in clone widgets + - `slider/pads`: inteverted ranges not working + - fix `doubleTap` for sliders with `snap` set to `true` + - undo/redo errors +- widgets + - 1-level nested property inheritance calls (`@{id_@{id_2}}`) are now updated dynamically + - support special css property `class` for adding custom classes to widgets + - added "smart" traversing gestures mode that limits affected widgets by the type of the first touched widget + - root: added `traversing` property - editor - - preserve percentages in position/size - - add 'Relative units (%)' option to use percents automatically on new widgets + - major performance improvements (containers' children are reused whenever possible instead of being recreated) + - removed widget deletion confirmation popup + - properties categories can now be folded + - added keyboard shortcut `F2` for editing the label quickly + - added keyboard shortcut `mod + s` for saving the session + - added keyboard shortcut `mod + o` for opening a session + - use `backspace` instead of `delete` for deleting widgets on MacOs + - added keyboard shortcut `mod + e` for enabling / disabling the editor + - added keyboard shortcuts `mod + arrows` for selecting widgets + - added keyboard shortcut `mod + a` for selecting a widget's siblings and itself + - added keyboard shortcut `mod + shift + a` for cancelling selection + - added multi widget selection with mouse when `shift` is pressed + - right-click doesn't modify current selection when `mod` or `shift` is pressed +- formulas + - added `extend(x, y)` function for merging two objects + - objects' closing brackets (`}`) don't need to be escaped with a backslash anymore + - show property's computed value in the help popup -## 1.1.0 +## 0.37.4 - bug fixes - - iOS 14+ scrolling issue - -- midi - - add support for channel pressure and key pressure messages - -- widgets - - svg: remove support for non-standard `%x` and `%y` units; fixed layout update when resized; - - knob: add support for custom dash/gap size in `dashed` property - -## 1.0.4 - -- bug fixes - - script: broken `storage.getItem` and `storage.removeItem` - - regression breaking `remote-root` option when starting with the launcher - - -## 1.0.3 - -- bug fixes - - modal: layout issue on iOS - -- widgets - - panels: added `contain` property to allow scrolling in vertical/horizontal layouts - -- midi - - add support for named ports in midi configuration - - -## 1.0.2 - -- bug fixes - - broken scrolling on iPhone iOS 13 - - window geometry issue - -## 1.0.1 - -- UI - - windows' dimensions and position are now saved upon closing and restored at startup - -## 1.0.0 - -*This list is not exhaustive* - -- compatibility - - dropped support for iOS 9 - - firefox (75+) support - -- UI - - overhaul design reworked - - foldable sidepanels - - removed lobby - - added toolbar menu - - display loading (spinner) in a notification instead of a modal - - mod + w to close window - - context-menu now use click event to trigger actions, not mousedown/touchstart - - no more uppercase text by default - -- themes - - built-in themes removed except `orange` - -- translations - - incomplete russian translation removed - -- editor - - project tree - - dropdown for properties with multiple choices - - color picker - - preview numeric values for style-related properties set to auto - - context menu: added "show in tree" action - - context menu: removed "edit parent" action - - allow copying tabs (to tab containers only) - - shared clipboard across all clients - - prevent interaction with widgets when `shift` or `ctrl` is held - - ensure @{} bindings are always updated upon edition - - -- widget changes - - all: removed `label` option except for buttons, tabs and modals (one should use `text` widgets if needed) - - all: removed support for `null` and `"self"` targets - - all: added `ignoreDefaults` property (allows ignoring the server's default targets) - - all: `precision` property to `decimals`, don't set osc integer typetag when 0 - - all: added `typeTags` property - - all: multiple style properties to control visibility, colors, alphas and padding - - all: added `interaction` (=> css `pointer-events: none;`) - - all: added `expand` (=> css `flex: 1;`) - - all: prevent html tags in label - - pads: removed `split` property -> use custom-module or script instead - - root: can contain widgets or tabs - - panels: added `layout`, `justify` and `gridTemplate` to help managing layouts (especially responsive ones) - - panels: added `verticalTabs` property - - panels: added `traversing` property, allow restricting `traversing` to a specific widget type - - fader: removed `input` - - fader: removed `meter` - - fader: added `gradient` - - fader: added `round` design style - - fader: support setting dash size and gap size in `dashed` property - - switch: added `layout` (including grid) - - switch: added `click` mode - - plot/eq: removed `smooth` - - plots/sliders/pads: reversed `logScale` behavior to match standard implementations; can be either `false` (disabled), `true` (logarithmic scale) or `number` (manual log scale, negative for exponential scale) - - visualizer: added `framerate` property - - visualizer: added `freeze` property - - menu: always centered menu - - modal: modals can't overflow parent tab boundaries - - input: removed `vertical` - - pads, range: when `touchAddress` is set, one message per touched point is sent, in addition to the former touch state message - - eq: removed `logScaleX` property, always draw logarithmic frequency response - - eq: logarithmic x-axis scale fixed - - eq: filters are now defined with the `filters` property, leaving the `value` to its default purpose - - eq: added `rangeX` - - html: allow `class`, `title` and `style` attributes - - dropdown: close menu when receiving a value - - dropdown: removed empty 1st option - - switch: removed `showValues` (inconsistent with menu/dropdown, feature covered by `values` property) - - frame: allow loading non local urls - -- widget removals - - `push`, `toggle`: merged into `button` - - `strip`: features now covered by `panel` - - `meter`: duplicate of `fader` with `design` to `compact` and `interaction` to `false` - - `switcher`, `state`, `crossfader`: removed => state management functions added to the `script` widget - - `keys`: merged with `script` - - `gyroscope`: not compatible since chrome 74 unless o-s-c goes HTTPS - - + - osc receivers (`OSC{}`) not working in non-dynamic properties - remote control - - removed /TABS - - added /NOTIFY + - added `/GET/#` to get a widget's value without using `/GET` as reply address -- scripting (general) - - removed MathJS language - - reuse #{} syntax as as shorthand for JS\{\{}} (one liner, implicit return) - - added `locals` variable, a variable store scoped to the widget - - renamed `global` to `globals` - - expose environment variables in `globals`: `url`, `env` (query parameters), `platform`, `screen` (width/height) +## 0.37.3 -- script widget - - always hidden except in project tree - - `script` property must not be wrapped in a JS\{\{}} block anymore - - added `stateGet` and `stateSet` functions - - added `storage` object, proxy to the document's localStorage object (allows storing data that persist after refresh/close (cleared with the browser's cache) - - added `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` function proxies with an extra `id` argument (they clear automatically when called multiple times and upon widget removal. `id` is scoped to the widget) +- bug fixes + - gyroscope: osc sendings not properly triggered on value updates +## 0.37.2 + +- bug fixes + - osc: regression making empty `preArgs` count as one empty string argument + +## 0.37.1 + +- bug fixes + - closing popups when clicking precisely on the "x" +- translations + - fr: corrections + - ru: added russian translation + +## 0.37.0 + +- bug fixes + - editor: opening the sidepanel doesn't select the root widget anymore + - ios: fix `doubleTap` +- widgets + - **new** `gyroscope` widget + - **new** `frame` widget + - **breaking change** in `panel`: dropped Visual Format Language support (`layout` and `spacing` properties) + - maths: added `timestamp()` function +- editor + - widget property names can be clicked to show documentation +- misc + - the client app can be translated (https://github.com/jean-emmanuel/open-stage-control/issues/302) + +## 0.36.0 + +- bug fixes + - `linkId` synchronizations now correctly trigger property updates + - widgets with multiple `linkId` are now properly handled + - synchronization issue between `visualizer` widgets +- widgets + - `keys` (**breaking changes**): formulas in `keydown` and `keyup` must be explicitely written using the `#{}` syntax; variable `value` got removed from these formulas context (use `@{this}` instead); removed `widgetId` property, the value emitted by the widget on keypress events can be linked with other widgets via the `linkId` property or the property inheritance syntax; + - `visualizer`: update rate set to default canvas framerate +- editor + - **new** keyboard shortcuts (undo, redo, copy, paste, etc) + +## 0.35.0 + +- main + - added `--state` option for loading a state file with a session file - state - - quickstate (store/recall from menu) is now stored in the clients cache and persists after refresh/close (cleared with the browser's cache) + - loading a state file doesn't replace the quick save slot anymore +- widgets + - **new** `script` widget +- misc + - reduced session file size (indentation set to 2 instead of 4) +## 0.34.4 + +- bug fixes + - widgets: dynamic `address` when `split` is `true` + - strip: missing osc properties (`address` and `preArgs`) for remote control + - switcher: update linked widgets' osc properties before sending if they depend on the switcher's value + +## 0.34.3 + +- bug fixes + - launcher: regression breaking the `port` option + +## 0.34.2 + +- bug fixes + - matrices: spacing issue when wrapped in strips + - launcher: regression preventing options to be applied + +## 0.34.1 + +- bug fixes + - switch: display object-values properly when `showValues` is set to `true` + - prevent non-dynamic properties updates from breaking an osc sending event chain +- deprecations + - `formula` has been removed from the editor's context menu - custom module - - `settings.read(name)`: `name` is now the long name of command-line options (not a camelCased one) - - `receive()`: optional last argument to pass extra options such as `clientId` - - client id persist upon page refresh and can be set manually with the client url option `id` + - expose `app` to the custom module's scope: an event emitter for monitoring the events sent by the different clients +- misc + - fixed rpi build +## 0.33.3 + +- bug fixes + - matrix: recreation loop issue with matrices of clones + - multixy: glitch when some letters are used in the points' labels + +## 0.33.2 + +- bug fixes + - matrix: set initial value at widget's creation; missing border under widget's label +- widgets + - property math syntax: add `values()` and `keys()` functions + +## 0.33.1 + +- bug fixes + - widgets: remove unnused properties to avoid having hidden properties laying around when the type changes (especially dangerous when those properties where linked to other widgets) + +## 0.33.0 + +- bug fixes + - osc receivers: unregister properly when widgets are recreated (memory leak); allow non-string values (eg. objects) + - circular property update issues +- widgets + - **new** generic `matrix` widget + - fader: restore right-click focusing the input in compact mode (mouse only) + +## 0.32.6 + +- bug fixes + - css border-radius not applying correctly for some widgets +- themes + - multiple adjustments + +## 0.32.5 + +- bug fixes + - missing feedback support for widgets with typed preArgs +- themes + - improved `dark` theme + - added `flat` + +## 0.32.4 + +- bug fixes + - regression breaking typed osc args + + +## 0.32.3 + +- bug fixes + - regression in editor/resize function + +## 0.32.2 + +- bug fixes + - sliders colors not displayed correctly on iOS +- widgets + - xy: tiny knob style change +- editor + - reallow editing disabled properties + +## 0.32.1 + +- bug fixes + - error in osc receivers + +## 0.32.0 + +- main + - add tcp support + +## 0.31.0 + +- bug fixes + - regression breaking multitouch widgets +- widgets + - fader/knob/pad: right-click / long tap doesn't give focus to the input anymore + +## 0.30.4 + +- bug fixes + - regression breaking touch traversing gestures + - clone widgets becomming unselectable for edition + - `preArgs` property still being coerced to an array + +## 0.30.3 + +- bug fixes + - big regression breaking many touch gestures + +## 0.30.2 + +- bug fixes + - broken remote-control /TABS command + - disabled `spacing` property in strips + - disabled properties in modals + - broken arm build + + +## 0.30.1 + +- midi + - prevent the main process from exiting when MIDI setup fails + +## 0.30.0 + +- widgets + - `target` and `preArgs` properties are no longer coerced to arrays and can be written as single string values + - `linkId` supports master and slave modes with `>>` and `<<` prefixes + - the special `target` token `null` can now be used in conjunction with regular targets, it disables the default global targets set via the `--send` option +- editor + - disabled widget properties are now greyed out + +## 0.29.2 + +- bug fixes + - launcher: parsing errors are not fatal anymore + - css parsing error on iOS + +## 0.29.1 + +- bug fixes + - editor: "wrap" deleting the widget just before the one being wrapped + - regression breaking traversing gestures and high precision gestures (0.29.0) +- server + - allow sending osc to broadcast ip addresses +- widgets + - limited support for property inheritance nesting (`@{id_@{id_2}}`) + - support using property inheritance syntax in osc listeners' addresses + +## 0.29.0 + +- beaking changes + - dropped supported for `.js` sessions (deprecated in 0.20.0) +- bug fixes + - zeroconf: unpublish when shutting down + - ios 9.3 compatibility issue + - function mispelling in rgb widget +- widgets + - modal: added `popupLeft` and `popupTop` properties + - faders/meter: add css variable `--gauge-opacity` to allow setting a fixed gauge opacity for meters and compact faders +- custom module + - messages converted from midi inputs can be filtered + + +## 0.28.3 + +- bug fixes + - widgets not correctly drawn when hidden/shown with dynamic css + - iOS: file upload failing sometimes +- widgets + - knob: small design improvements (pips don't take extra space anymore) + +## 0.28.2 + +- bug fixes + - session list: fix "remove from history" always removing the first item in the list +- custom module + - expose `setInterval` + - expose `clearTimeout` and `clearInterval` + - prevent errors when failing to run the module + + +## 0.28.1 + +- bug fixes + - regression in nested clones structures handling + + +## 0.28.0 + +- widgets + - matrices: support setting `split` property as a string to allow using children's indexes in their address (`$` is replaced with the index number) + - text: `wrap` property doesn't break words by default anymore + - rgb: added `range` property +- launcher + - right-click context menu (copy, paste, clear console, toggle console autoscoll, relaunch app) + - better font for the console + +## 0.27.2 + +- bug fixes + - session/state file upload sometimes failing silently + - regression breaking the app for iOS + +## 0.27.1 + +- bug fixes + - error when resizing a widget and its clone(s) at the same time + - error with non string css property + - session list not reappearing when failing to load + - broken state file loading +- misc + - added a loading indicator when uploading a session file or a state file + +## 0.27.0 + +- bug fixes + - strip: nested strips were inheriting their parent's `spacing` + - modal: prevent error when retrieving a child's property + - modal: prevent touch event from affecting elements behind the popup when closing it + - clone: some properies in target widget were not applied to the clone + - clone: prevent clone from resetting its target value when created + - text: vertical centering issues in narrow widgets + - dynamic properties: when using a widget's own value to determine its osc settings, these are checked and updated if needed before sending the message + - prevent error when loading a session containing invalid property inheritance calls + - broken build for iOS 9.3 +- editor + - wrap in: insert wrapper at selected widget's index + - wrap in: set label to false by default when wrapping in a strip or a panel + - css property `pointer-events:none;` is now ignored when the editor is enabled + - preverve pecentages when dragging/resizing a widget that has its position/size written in percents +- widgets + - **new** `OSC{/address, default_value}` syntax +- ui + - sidepanel is now resizable +- themes + - `responsive-fonts`: increase size for big screens +- build + - dropped support for node < 4.8 + +## 0.26.3 + +- bug fixes + - ios: broken default accent color in clone Widgets + - ios/android: closing the sidepanel opened the tab next to the menu button +- editor + - mac: use `shift` instead of `command` for multi widget selection to match native behaviour and prevent unwanted zoom with trackpads +- widgets + - strip: `spacing` now accepts percents + +## 0.26.2 + +- bug fixes + - regression preventing glass effect from using the widget's color + - missing last key in keyboard widget + - editor: select parent widget after deleting a widget + - regression letting user to scroll the main document + - editor: wrap/cut/delete multiple widget not working properly +- widgets + - text: set line-height relative to font size + - meter: added `gradient` feature + +## 0.26.1 + +- bug fixes + - ios: text input fields not editable +- editor + - mac: use `command` instead of `ctrl` for multi widget selection + +## 0.26.0 + +- bug fixes + - editor: when selecting another widget while editing a property, changes where applied to the newly selected widget + - widgets: css: @media queries parsing + - prevent some errors when synchronizing clients + - use command key instead of ctrl for zooming on mac + - clone: memory leak / freeze +- default client + - mac: disabled unsupported pinch zoom +- themes + - alt-buttons: modal font-weight & color fix; push button active state colored border + - added "responsive-fonts" theme +- editor + - allow multi widget resizing/dragging + - tweaked ctrl+click/right-click selection behaviors + - **new** "Wrap in" context menu + + +## 0.25.0 + +- bug fixes + - launcher: parse array options correctly when an item contains spaces, + - launcher: the terminal now grows and scrolls to bottom automatically + - editor: broken children reordering; children + list display bug with long `id`s +- main + - add `--fullscreen` switch (default gui only, bypasses the sidepanel fullscreen button) + - added/updated some themes: `orange`, `light`, `dark`, `alt-buttons` (the latter can be combined with other themes) +- widgets + - knob: big knobs design tweaks + - **new** `default` property that sets a widgets initial/doubleTap/spring value. The `value` property does no longer serve this purpose. + - **new** `bypass` property that disable osc messages (except when requested via `/GET` and `/EDIT/GET`) + - panel: **removed** `noSync` property (backward compatible fallback to `bypass`) + - property inheritance: `@{widget_id.value}`, `@{widget_id}` and `@{widget_id._value}` now all refer to the widget's current value (the latter being kept for backward compatibility); If a property update triggers an osc message, it will now be sent after the other dynamic properties changes are resolved (such as osc `address`, `target`, etc) + - text: added `align` and `wrap` properties + - input: added `align` property + - sliders/xy: `doubleTap` can be an osc address to send a special message instead of resetting the widget's value +- editor + - allow selecting multiple widgets (`ctrl + click`) if they share the same parent. Context-menu and sidepanel editing actions apply to all selected widgets + +## 0.24.3 + +- bug fixes + - property maths: variables names declared in a formula were replaced by their associated value if found in the formula's result + - missing console logs on windows +- ui + - add iOS fullscreen support via add-to-home feature +- editor + - ask for confirmation when closing or refreshing the page if the editor has been enabled at least once + - prevent default widget interaction when selecting a widget for edition +- widgets + - knob: small design tweaks +- misc + - remove proprietary ffmepg codec from package + +## 0.24.2 + +- bug fixes + - macOs app menu & shortcuts + +## 0.24.1 + +- bug fixes + - server/client communication errors + - prevent error windows from spawning +- main + - added some menu items on macOs (including "Quit" !) + +## 0.24.0 + +:warning: **BREAKING CHANGES** :warning: + +Read the changelog carefully, old sessions files are likely to need some adjustements to work as they used to. Plots and input widgets had their `widgetId` option removed because it was redundant with the generic `linkId` property. + +- bug fixes + - regression preventing dropdown to display no option selected + - crossfaders display issue on iOS + - restored compatibility options for server-client communications + - xy: `doubleTap` option + - range: `spring` option + - plot: crash when drawing only one point + - widget css: fixed @media queries @keyframes parsings +- main + - theme files changes are automatically applied + - server-client communication system rewritten -> HUGE latency reduction and stability improvement especially under stress conditions + - engine update (electron@1.8.2) +- widgets + - **new** svg plot widget + - switch: wrap non-array `values` property in an array + - dropdown: wrap non-array `values` property in an array; always add a default empty value + - property inheritance: added shorthand default to `_value` when no property is specified (`@{widgetId}`); some properties can now be dynamically changed without recreating the widget entirely + - property maths: added support for math expressions everywhere via `#{}` + - input: add glass effect when `editable` is `false` + - `linkId` can now be set as an array of linkIds + - plot: added `dots` options; **removed** `points` options (use `value` and property inheritance instead) + - eq: **removed** `filters` options (use `value` and property inheritance instead) + - plot/meter/led/rgbled/text: **removed** `widgetId` option + - input: **removed** `widgetId` option + - math: **deprecated** `formula` widget + +## 0.23.1 + +- bug fixes + - regression breaking modal's position in scrolled tab containers + - widget with a `touchAddress` set now send their touch-off message when removed or recreated while being interacted with + - broken windows builds (long path issue) + +## 0.23.0 + +- bug fixes + - plots now send their value to other widget for synchronization as expected + - text widgets now apply their target widget's precision + - property inheritance accepts targetting a parent widget by its id + - multiple icons not displayed correctly + - broken `--blank` option +- main + - added `--disable-gpu` option for disabling hardware acceleration (fixes rendering glitches and reduces input lag on some systems) +- widgets + - inputs: **new** `keys` widget, for keyboard bindings + - property inheritance: new special property name `_value` (retrieve the widget's value, and update when it changes) + - switch: added `showValues` to display both values and labels in the buttons; array values can now be selected via osc + - range: both handles can be moved by holding `shift` while dragging + - rgb: **removed** `touchAddress` option + - labels/texts: multiple white spaces are no longer merged + - plot: can receive stringified arrays of coordinates or stringified objects for merging coordinates sets; added `bars` option for drawing barcharts; + - widgets' `precision` option allows setting a specific data type for numbers (sliders can send doubles !) +- misc + - event system rewritten + - js build size reduced + +## 0.22.0 + +- bug fixes + - sessions opened from command line with relative paths are now added to the history with their absolute path + - sending an empty message to a `text` widget resets it to its initial value and without ignoring its `value` property + - sending no value to a widget with `preArgs` is now possible : all the arguments found in incomming osc messages are now taken into account to match the widgets in the session + - regression breaking state quicksave from sidepanel +- engine + - downgraded to the latest *stable* electron release +- main + - added `zeroconf` / `bonjour` publishing for the app's http and osc input ports + - added `--instance-name` option to differenciate mulitple instances in zeroconf networks +- widgets + - sliders/pads: holding `Ctrl` now enables high precision dragging with the mouse and bypasses the `snap` option + - inputs: renamed `input`'s property `horizontal` to `vertical` to match how the widget actually displays + - sliders: **new** `range` widget + - plots: **new** `image` widget +- remote control + - **removed** deprecated `/EXEC` + - renamed `/EDIT_SOFT` to `/EDIT/MERGE` + - added `/EDIT/GET` (get a widget's data) + - added `/GET` (get a widget's value) + - added `/SET` (set a widget's value as if it was interacted with from the interface) + + +## 0.21.3 + +- bug fixes + - session/state: regression (0.21.2) breaking save-to-file function +- ui + - FontAwesome 5 (icon font) ! + +## 0.21.2 + +- bug fixes + - cli: broken long flag `--no-gui` + - headless: when running with `node`, errors don't stop the server; when running with `electron` (default), errors are logged in the console instead of being showed in a dialog window + - switcher widgets regression (broken) +- midi + - float values are now allowed and automatically rounded +- misc + - some code refactoring + +## 0.21.1 + +- bug fixes + - visualizer: fix memory leak when editing; fix ignored `smooth` option + - plots: regression preventing widgets with no `target` option from receiving messages sent by other clients + +## 0.21.0 + +- main + - renamed `--sync` option to `--send` (deprecation, backward-compatible) +- widgets + - sliders/pads: when receiving feedback while touched, the widget waits to be released before updating to the latest received value. + - input: the widget's value is no longer validated when leaving focus by clicking somewhere else or hitting the `Tab` key (it must be submitted by hitting the `Enter` key); when submitting a value to another widget, the feedback from this widget doesn't trigger a second osc message anymore; non-editable inputs can't steal focus anymore + - added support for `null` value in `target` option to disable osc sending +- misc + - property fields are now parsed using [JSON5](https://github.com/json5/json5), a more flexible notation. Session files are still written in standard JSON format, this is just a way to avoid typing mistakes when using the editor. + - remote editing also accepts JSON5 notation + +## 0.20.3 + +- bug fixes + - allow loading `.json` session files from the launcher +- launcher + - new log/error console (shows once the app is started) + +## 0.20.2 + +- bug fixes + - pads: regression breaking the built-in input + - multifader: inverted order in horizontal mode +- widgets + - plots: add `smooth` option (thanks to [cardinal-spline-js](https://github.com/epistemex/cardinal-spline-js)); draw thicker lines + - pads: draw thicker inner circle + - mobile + - prevent devices from entering sleep mode + + +## 0.20.1 + +- bug fixes + - error popups not created +- misc + - rename sessions files to `.json` + +## 0.20.0 + +- **breaking changes** + - sessions are now saved as `.json`files by default (the deprecated `.js` extension can still be opened). + - states are now saved as `.state` files (the old `.preset` files can be renamed without any problem) +- bug fixes + - touch release event is properly dispatched in traversing containers (ie keyboards and matrices) (#94) +- widgets + - css `border-radius` support enhanced + - css `color` applies locally while `--color-text` applies to children too + - plot/text: new lines are properly printed +- packaging + - added `arm64` binaries +- iOS + - compatibility improved (version 9.3 and above) +- engine + - electron 1.8.0 (chrome 59) + +## 0.19.6 + +- hot fix + - broken formula widget + +## 0.19.5 - launcher - - config save/load - - allow starting/stopping server without rebooting - - syntax check on `--midi` option - -- server - - renamed `--url-options` to `--client-options` and make them apply even in remote browsers (can be overridden with url queries) - - removed `--blank`, `--gui-only`, `--examples` - - hide `--disable-gpu` (cli-only) - - added cli-only `--cache-dir` and `--config-file` - - added `--authentication` option - - added `--use-ssl` option - - + - fixed typo in new version message - misc - - canvas: better visibility checks to avoid unnecessary draw calls - - visualizer: perf improvement (avoid data processing when not visible), all visualizers hook on the same loop to avoid concurrent timeouts - - button: in 'tap' mode (formerly push with `noRelease`), never send/sync `off` value, automatically reset to `off` when receiving `on` - - more detached DOM for lighter nested canvas widgets (ie multixy) - - unified (kind of) dom html structure for widgets, known css tricks will require adjustments. - - cache and config files are now stored in a folder named `open-stage-control` (located in the system's default location for config file). The `.open-stage-control` is no longer used. - - added support for icons rotate/flip transform suffixes (example: `^cog.spin`, `^play.rotate-horizontal`) + - client-side javascript's size reduced, now for real !! + +## 0.19.4 + +- bug fixes + - buttons: changing `css` background works as expected + - widgets: changing `css` (text) color works as expected + - fader: fix hidden input in horizontal + compact mode + - pads: pips scaling bug +- widgets + - `css` font-sizes apply correctly to all children (better use percents) + - formula: add `unit` option +- misc + - client-side javascript's size reduced ! + +## 0.19.3 + +- bug fixes + - midi: noteOff messages not being sent; + +## 0.19.2 + +- bug fixes + - lobby: regression breaking the lobby for touch devices + + +## 0.19.1 + +- bug fixes + - launcher: load correct font + - midi: python3 compatibility fix + +## 0.19.0 + +- ui + - general design improved, heavily inspired by [budislavTVP](http://budislavtvp.deviantart.com/) works; color schemes are much simpler and easier to customize (try `--theme light` !); Font changed to Roboto; Texts are slightly thicker and uppercased in most cases for better readability (use css `text-transform:none` to disable the latter). +- widgets + - fader: added `dashed` option; added `input` option; + - meter: added `alignRight` option; added `dashed` option; + - knob: removed `compact` option; added `dashed` option; added `input` option; + - xy/rgb: added `input` option; added `pips` option: + - panel/strip: removed inner widgets dark borders; added `border` option; + - buttons: new `dropdown` widget; + - toggle: added `led` option to choose between the old appearance and the new one; added `douleTap` option + - new `input` widget + - containers: new `clone` widgets + - added support for `"self"` value in `target` option (sends the message back to the clients, useful for sending `/EDIT` messages...) +- editor + - option fields are now multiline (`ctrl + enter` to add a new line), and pretty printed + - added checkboxes for boolean options + - added `Edit Parent` context menu option +- midi + - replaced `pyo` dependency with [`pyrtmidi`](https://github.com/patrickkidd/pyrtmidi): lighter, dedicated to midi only, and handling virtual ports (no `mididings` dependency anymore) + - pitchbend value is now a single integer between 0 and 16383 +- bug fixes + - fixed VisualFormat errors in iOS +- main + - added `--url-options` command line option + - fixed `--disable-vsync` not working when starting from the launcher +- documentation + - new style, better organization + +## 0.18.0 + +:warning: **Breaking changes** :warning: + +Sessions saved with this version will not be readable with older versions (old sessions a can be opened but wont be backward-compatible once saved). + + +- widgets + - add property inheritance between widgets with statements `@{parent.propertyName}`, `@{this.propertyName}` and `@{widgetID.propertyName}` + - containers: added `variables` options (arbitrary varibles to pass to children) + - panel: added full osc support (for sending/receiving tab changes) + - modal: changed style to fit popups' appearance; added `popupWidth` and `popupHeight` options; :warning: removed `tabs` option; added full osc support; added `doubleTap` option (makes it openable with double taps instead of single taps) + - strip: refactored widget using `panel` as base; added `stretch` and `spacing` option; now it's really cool + - sliders: added `doubleTap` option (double taps reset the widget to its initial value when enabled) + - knob/fader: renamed `noPip` option to `pips` (inverted behaviour; backward compatible) + - encoder: mousewheel support + - knob: compact design remake +- bug fixes + - sliders: fixed `spring` when `value` equals `0` + - modal: fixed osc values (was `True`/`False` instead of `1`/`0`) +- session + - the root panel is now saved as a special `panel` widget (which means it has savable options) +- custom module + - add access to the app's `settings` object + +## 0.17.8 + +- bug fixes + - regression breaking widgets' `split` option (0.17.6) + - regression breaking the state export button (0.17.7) + - regression breaking editor's `cut` action (0.17.7) +- osc + - javascript object are now stringifyied before beeing sent +- widgets + - maths: add `condition` option to [`formula`](http://osc.ammd.net/user-guide/widgets-specifics/maths/#formula) + - sliders/pads: add `touchAddress` option + - fader: add `meterAddress` + +## 0.17.7 + +- engine + - socket.io v2 +- client + - scripts are now transpiled to ES5 javascript code, thus increasing compatibility with some browser (iOS9's chrome, firefox, etc) + - scripts size reduced from 2.4M to 1M thanks to minification +- bug fixes + - elements duplications in sidepanel when loading another session + +## 0.17.6 + +- main + - osc sending speed optimization: all static infos (target, address, preArgs) are cached server side to reduce network overhead +- widgets + - **new** encoder widget +- mobile + - `hdpi` support (add `?hdpi=1` to the server's url) +- bug fixes + - launcher: link to the app's address is now clickable + - sidepanel: layout glitches with iOS + - midi: `program` now works with the correct number of arguments +- misc + - some little style fixes + +## 0.17.5 + +- bug fixes + - `multixy` snap mode position offset +- widgets + - **new** [`rgbled`](http://osc.ammd.net/user-guide/widgets-specifics/plots/#rgbled) + + +## 0.17.4 + +- bug fixes + - broken `--blank` option fixed (false-positive detection of concurrency with `--read-only`) + - remove debug message in console when closing windows + +## 0.17.3 + +Hot fix for `--read-only` switch. +Dependencies updates. + +## 0.17.2 (deleted) + +- bug fixes + - `editor`: correctly remove editing state when disabling the editor right after going to another tab +- main + - **new** `--read-only` switch for disabling the editor and preventing change to the session history +- widgets + - `panel/modal`: add `layout` option ([Visual Format Language](https://github.com/IjzerenHein/autolayout.js)) + - `css` option now interprets `&` as a selector for the widget's element itself (useful for targetting pseudo-elements such as `&:after`) + - `plots`: add `widgetId` option to `text`, `meter` and `led` + +## 0.17.1 + +- bug fixes + - `midi`: missing dependency + - `headless`: terminate `midi` correctly when process exits + +## 0.17.0 + +- main + - **new** `midi` support ([documentation](http://osc.ammd.net/user-guide/midi/)) +- ui + - **new** `/TABS id1 id2 etc` osc address to remotely enable tabs + - remote editing through `/EXEC` command is now deprecated, use `/EDIT` and `/EDIT_SOFT` instead +- bug fixes + - `push` widgets (and `keyboards`) not correctly synchronizing each other (with shared widget ids or between different clients) +- widgets + - `css` option now supports css selectors, scoped to the widgets element + - `matrices` don't pass `css` option to their children anymore; subwidgets' indexes are now append to `preArgs` instead of being prepended. +- misc + - app's title uppercased + - tabs titles' letter-spacing increased + +## 0.16.5 + +- bug fixes + - `modal`: correct z-stacking with absolutely positionned widgets; proper rendering for inner widgets; disable parent tab's scrolling when opened; fix various style glitches; + - `strip`: resize glitch when containing compact horizontal sliders + +## 0.16.4 + +- bug fixes + - tab links broken after activating traversing gestures + - `push` release is now handled per touch point (releasing one finger used to release all pressed buttons) +- misc + - destroy default client window when the app process exits + +## 0.16.3 + +- bug fixes + - crash when remote-editing widgets in disabled tabs + - desktop client touch screen support restored + +## 0.16.1 + +- bug fixes + - string arguments overquoted in sent osc messages +- custom module + - added support for initialization script + - unified expected formatting in sendOsc and receiveOsc methods +- ui + - reduced scrollbars width + + +## 0.16.0 + +- new logo :) +- bug fixes + - editor: new widgets are correctly positionned in scrolled areas +- widgets + - **new** `formula` widget, a [mathjs](http://mathjs.org/) expression evaluator that can process other widgets' values + - `multixy` supports named points; fixed drag-dead zone in the border + +## 0.15.1 + +- widgets + - multifader: add `snap` option +- misc + - minor css-related performance fix + - some titles in the editor had the first-letter uppercased + +## 0.15.0 + +- style + - improved coherence, no more pure greys, better differenciation between clickable and static elements. Went back from "pure flat" to "flatty" to help with that (ie a few shadows to make layout more self-explanatory). Some widgets were slightly repimped. +- bug fixes + - `push`: options separators not hidden in the editor + - error when touching a non-interractive object while touching a widget with the other fingers +- widgets + - `multixy` now behaves smarter: points are assigned to the closest touch points +- main + - modifying a session file will automatically update clients that have loaded the same file + +## 0.14.0 + +- bug fixes + - some layout regressions in chrome v49 +- main + - osc input port (`-o`) is now set to the http port (`-p`) by default +- widgets + - **new** `crossfader` and `switcher` widgets that store and recall the state of other widgets + - `matrices` now accept multiple color values (that will be sequencially passed to their children) + - `switches` accept icons in their values' labels +- engine + - electron v1.4.13 +- misc + - all widgets classes were rewritten using ES6 class expressions + - firefox's minimal version is now 46 because of a ES6 related bug (*note that it's still not officially supported*) + +## 0.13.1 + +- bug fixes + - regression preventing received osc messages to be properly routed to widgets with `preArgs` +- debug + - errors occuring in the browser process are now piped to the main process' console with the source file name and the line number. + +## 0.13.0 + +- main + - **new** `-b / --blank` option to start editing a new session directly + - **new** `--disable-vsync` option that improves performance (reduce input lag) on some systems + - some inconsistent parameter combinations are now prevented + - firefox compatibility improved (yet not perfect) + - launcher window is no longer of the `splash` type, as it was difficult to close with some window managers +- widgets + - **new** `modal` container : a button that turns into a fullscreen panel when clicked. + - sliders/xy: add `spring` option that makes that widget jump back to its initial value when released + - fader: horizontal mode default height fixed + - keyboard: black keys pressed state is more noticeable + - matrices: added `start` option to choose the first subwidget's `id` + - labels' height reduced +- editor + - **new** snap-to-grid feature + - widgets' min-width set to grid's width +- misc + - building with node 4 is fixed + +## 0.12.0 + +- bug fixes + - error popups raised by the main process can be closed + - sliders don't send same value over network when the value change is below the widget's precision +- widgets + - **new** (piano) keyboard widget + - matrices: fixed `preArgs` option; added `split` option (default to `false`), *this changes the default osc messages formatting for these widgets* + - icons in labels are inserted using the `^` prefix + - text: icons support in value +- tabs + - icons support in label +- misc + - fontawesome update (4.7.0) + +## 0.11.6 + +- widgets + - meter: rewritten using fader as base + - strip: center widget horizontally if width is set + - fader/knob: compact gauge's alpha varies slightly as the distance to the origin grows +- misc + - one example session added + +## 0.11.5 + +- bug fixes + - [regression] broken horizontal fader and pads + +## 0.11.4 + +- bug fixes + - fader: default `height/width` not set when `top/left` is `auto` + +## 0.11.3 + +- widgets + - knob: gesture's precision is proportionnal to the widget's size + - fader: `height:auto` (or `width` for `horizontal` mode) makes the fader expand automatically +- ui + - cleaner forms in editor and launcher + +## 0.11.2 + +- touch + - using multiple fingers to control a widget increases the precision (reduces the gesture's computed speed) +- widgets + - fader: display pips in `compact` mode when `range` has multiple breakpoints + - pads: display pips when `range` has multiple breakpoints + - multixy: style update (stroked dots, bold number font); `snap` option added; points are automatically assigned to touches as they come; fix `logScale(X|Y)` options + +## 0.11.1 + +- bug fixes + - meters in faders were not always properly positionned +- widgets + - knob: gauge's width is proportionnal to the knob's size in `compact` mode; widget's content centering fixed; `compact` style update; + +## 0.11.0 + +- bug fixes + - `-g / --no-gui` not preventing the launcher from spawning + - `-e / --examples` not correctly parsed +- main + - launcher displays options descriptions for booleans too +- widgets + - added generic `value` option for setting a widget's initial value (does not sync linked widgets nor send osc message) + - **text** widget's `defaultText` replaced with `value` + - multixy dots are drawn with filled background instead of stroke + +## 0.10.4 + +- main + - launcher displays new version if available + - launcher stays opened after starting the server and/or the gui except if `--gui-only` is set + +## 0.10.3 + +- main + - launcher: resetting boolean option properly sets it to false + - launcher: display package's version + - guis: adjust window's background to match the app's +- ui + - launcher and session lobby appear more smoothly + +## 0.10.2 + +- main + - when executing the app with no CLI argument, a launcher window is created allowing user to adjust settings before starting the server (config is saved in the user's directory) + +## 0.10.1 + +- bug fixes + - rgb: minor visual glitch on extreme value, drawing performance improved + - main: examples sessions path are properly stored as absolute paths (fixes `-e / --examples` mode) +- ui + - lobby: session file names are diplayed first, then shortened paths +- misc + - widgets `precision` doesn't affect their visual interraction accuracy since values are now rounded only before osc sending + +## 0.10.0-alpha-2 + +- bug fixes + - [windows] fix long path issue (#35) returns + +## 0.10.0-alpha + +- main + - **new** `-c / --custom-module` switch allowing user to define custom osc filtering fonctions + - `address` is now used everywhere instead of `path` to describe osc address to avoid confusion. Session files using the old `path` option for widgets are still supported. + - **osc bundles** are properly received (subsequent messages are processed separately with a delay if the timetag is set) + - widgets can be edited via osc messages using the special `/EXEC` address + +## 0.9.2 + +- bug fixes + - [windows] fix long path issue (#35) + +## 0.9.1 + +- widgets + - multiXy: added `pointSize` option; made default size bigger; points don't overflow the pad anymore + +## 0.9.0 + +- widgets + - **new** `multixy` pad +- misc + - rewritten `pads` with prototype inheritance and using faders under the hood to handle events (this adds *fader*'s `range` capabilities to *xy*) +- engine + - electron 1.4.4 + +## 0.8.3 + +- bug fixes + - scrollbar arrows not showing + - `fader` pips position when `noPip` is `true` +- widgets + - matrices : all `fader`, `push` and `toggle` options are now available to `multifader`, `multipush` and `multitoggle` + +## 0.8.2 + +- bug + - avoid crash when sending osc with incorrect typetags + - fixed fallback typetag ('s') + - fixed broken `null` value for `push` & `toggle` + +## 0.8.1 + +- bug + - broken `fader` with `horizontal` set to `true` and `compact` set to `false` +- widgets + - remove margins from `plots` + - added `origin` options to `plots` + +## 0.8.0 + +- main + - the headless server/clients model is now the only one beeing used : the GUI mode is nothing more than an embedded chromium (electron) client + - when a new client opens a session on the server, it is synchronized with the other clients + - **new switches** : `--no-gui`, `--gui-only`, `--port`, `--osc-port`, `--version` (see docs) +- ui + - explicit loadings +- widgets + - make push's backlight only respond to external osc messages (not to synchronization messages from other widgets or clients) + - removed special `false` value case for push/toggles (which used to disable osc sending) + - add `norelease` option to `push` for disabling osc messages when releasing the button + - `true` and `false` values are now properly sent as boolean + - **args type definition** in `preArgs` option now uses the osc typetags only ('f', 'i', 'T', 'F', etc) +- engine + - electron 1.4.3 +- misc + - rewritten matrices with prototypes inheritance + +## 0.7.0 + +- bug fixes + - osc messages with 0-item and 1-item args are correctly unpacked and routed + - buttons can handle messages with 0 arg if one of their state has the value "null" +- ui + - nice and bigger scrollbar + - right-click no longer starts a dragging gesture +- editor + - copy/paste data auto-incrementation fix +- widgets + - new equalizer plotter + - push/toggles made more obvious + - knob's new options: angle and origin + - fader's new option: origin +- engine + - electron 1.4.1 (chrome 53, node 6.5.0) +- misc + - added `--examples` switch for showing the availabe example sessions instead of the history + - rewritten sliders and plots using canvas and prototypes inheritance + - reorganized package using the two-package.json structure: js and css assets are now create at build time, and only necessary dependencies are shipped with the app + +## 0.6.3 + +- bug fixes + - regression (since 498ba4a06adf63d76fe7181691299c1cc55e8240) breaking the editor on touch devices + +## 0.6.2 + +- cool stuff + - armv7l prebuilt binaries ! (raspberry 2, etc) +- engine + - electron 1.3.5 + +## 0.6.1 + +- bug fixes + - editor: widgets/tabs can be accessed through their parent's children list (#27) +- engine + - electron 1.3.1 + +## 0.6.0 + +- bug fixes + - pasted widget properly use the pointer's position + - traversing gestures are effective from the first touch, not after the first move + - out-of-range values are properly clipped by faders/knob +- ui + - Faders & Meters design improved + - The main font (droid sans) is now loaded... + - Knob's sizing got smarter + - Widgets don't blink not jump when they appear for the first time or when they resize +- misc + - Fader's `align` option replaced with boolean option `alignRight` + - Widget's `label` now accepts special directive `icon: fontawesome-class` to display icons from [FontAwesome](http://fontawesome.io/icons/) + - Text widget `defaultText` option added +- engine + - electron 1.2.2 + +## 0.5.4 + +- bug fixes + - [desktop] menu bar auto-hide + - [headless] multitouch support +- ui + - [mobile] better faders pips rendering + - fixed horizontal fader knob centering + - [mobile] better numeric inputs rendering (not blurred anymore) +- engine + - [desktop] electron 1.2.0 (chrome 51) + +## 0.5.3 + +- bug fixes + - [again] touch fake-right-click only fires on long touch, not after every tap + - traversing gestures bug with touch +- misc + - better mouse/touch drag events handlers +- engine + - electron 1.1.1 + +## 0.5.2 + +- bug fixes + - touch fake-right-click only fires on long touch, not after every tap + +## 0.5.1 + +- bug fixes + - feedback is now handled precisely by widets (ie not rounded according to the `precision` option, see issue #21) +- engine + - electron 1.1.0 + +## 0.5.0 + +- bug fixes + - touch/mouse events are both handled simultaneously, module rewritten for better performances (see issue #18) +- engine + - electron 1.0.2 + + +## 0.4.8 + +- bug fixes + - regression preventing newly created widgets from using the pointer's coordinates as position + - add 0.4.7's fix to headless mode + +## 0.4.7 + +- bug fixes + - regression causing widgets with `preArgs` to not receive osc correctly + +## 0.4.6 + +- engine + - electron 0.37.6 + - node-osc 2.0.3 +- features + - `compact` option added to knob and fader + - if an osc input port is specified, osc messages will be sent from it. This enhances compatibility with apps that send their feedback messages directly to the sender. +- misc + - mouse/touch dragging handler rewritten, now using event delegation and direct handler calls instead of DOM event bubbling whenever it's possible + +## 0.4.5 + +- engine + - electron 0.37.3 +- ui + - new logo + - better lobby design +- misc + - renamed sliders/pads' `absolute` property to `snap` + +## 0.4.4 + +- bug fixes + - [headless] scripts are no longer bundled on the fly, it didn't work on some systems + - touching widgets without changing their value doesn't make them send the same value again anymore +- ui + - slightly tightened layout +- features + - `noPip` option added to knob and fader + - `preArgs` accepts object if the arg's type needs to be specified + - knob supports breakpoints scale, same as fader's + - fader and knob pip scales now support custom label + - a push/toggle's value can be set to `null` if only the path needs to be sent in the osc messages + - push buttons do not update their own leds and return their value (for state save and widgets sync) based on their last changed property (led state or touch on/off) +- misc + - refining the fader's pip scale that looked choppy on mobile devices. All pips are now evenly spaced, not relatively to the fader's height. + - [desktop mode] saved sessions are added to history + +## 0.4.3 + +- features + - text widget can be `vertical` + - panel widget `scroll` option +- bug fixes + - smart pasting now works when the clipboard contains several widgets whose unsuffixed ids are the identical + - osc received array that contain only one item are correctly unpacked (fixes cross-app sync for widgets that don't accept array, broken since the introduction of `preArgs`) + - memory leak when loading a new session (cached tabs were not properly purged) +- misc + - push widget doesn't fire its 'on' value if pressed while stuck in 'on' position + - panel widgets don't have inner margins anymore + - fader widget optimization : the pip scale is generated from a single gradient plus some elements for each breakpoint (instead of one element per percent), thus reducing the number of elements to draw. + +## 0.4.2 + +- features + - new widget : text (just displays received values) +- bug fixes + - widget linking doesn't cause multiple unwanted osc sends anymore + +## 0.4.1 + +- features + - `preArgs` option for widgets (prepends constants to osc messages args) + +## 0.4.0 + +- engine + - electron 0.37.2 (chrome 49) +- ui + - new flat ui + - tab system rewritten : inactive tabs are detached from the DOM tree, thus improving performances while slowing down tab switching. + - widget categories in editor's context menu +- features + - logarithmic scaling (log10) support added to knob, fader & xy + - mousewheel support added to knob and fader (ctrlKey for fine control) + - new widgets : plot, visualizer & meter. Fader built-in feedback meter option + - traversing gestures switch in sidepanel + - custom color property for all widgets with inheritance (containers) + - editor pasting function now smartly increments widget's id and path while keeping label if different from default + - true theming support +- misc + - sync/link event handling improved + - stylesheets cannot be recompiled on the fly anymore (`--c` switch removed) + - **new state save file format, no backward compatibility** + +## 0.3.1 + +- electron updated to 0.36.11 +- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID` (resets id, label, linkId, and path) +- minor style updates + +## 0.3.0 + +- 3 new widgets + - multifader + - multitoggle + - multipush + + +## 0.2.1 + +- style update (push/toggle widgets, widgets' dragging handle) +- widget dragging/resizing doesn't get broken when editing the root +- sidepanel toggle doesn't select root for edition anymore + +## 0.2.0 + +- editor code rewriting + - right-click context-menu quick editing (widget copy/cut/paste, add & delete tabs/widgets) diff --git a/CHANGELOG.v0.md b/CHANGELOG.v0.md deleted file mode 100644 index 32d3b1a5..00000000 --- a/CHANGELOG.v0.md +++ /dev/null @@ -1,1843 +0,0 @@ -# Changelog (v0) - -## 0.49.12 - - -**This is the last release of the v0 branch** - -- bug fixes - - dropdown: value update issue on iOS 13 -- widgets - - html: allow `class`, `title` and `style` attributes - -## 0.49.11 - -- bug fixes - - regression (0.49.10) breaking icon with short names (minimum valid length set to 2 characters) - - html widget: content not initialized properly - -## 0.49.10 - -- bug fixes - - svg files not loading - - canvas glitches when hardware acceleration is disabled (--disable-gpu) (built-in gui only) - -- misc - - prevent `--disable-gpu` from bypassing the launcher window - - prevent converting `"^icon-name"` to an icon (in text widgets and labels) when `icon-name` is too short to be a valid icon name (minimum 4 characters) - -## 0.49.9 - -- bug fixes - - downgrade electron engine to fix regression (v0.49.8) on some systems - -## 0.49.8 - -- bug fixes - - rgb: range not applied when receiving value - -## 0.49.7 - -- bug fixes - - sync issues when widgets have a single target set - -## 0.49.6 - -- bug fixes - - windows users launching the app from a terminal now need to add a double dash (--) before their options - - launcher: disabled unstable `Relaunch` action - -## 0.49.5 - -- bug fixes - - launcher: file/folder browsing not working - -## 0.49.4 - -- bug fixes - - image: fixed absolute paths - - image: reset to 'default' instead of 'value' when receiving an empty value - - launcher: use current midi config for "List devices" action - - fader built-in meter: use fader's target (allows midi sync) - -## 0.49.3 - -- bug fixes - - windows: process not terminated properly when exiting the app - -## 0.49.2 - - - bug fixes - - plots: prevent `plot/*` widgets from sending messages when using the sidepanel's "send all" function - - editor: assign correct `address` when emptying the field - - sidepanel: shadow color issue -- misc - - alt-buttons & flat theme tweaks - -## 0.49.1 - -- bug fixes - - modal: error when `label` depends on a child's property - - custom module: `send()` function casting numbers to integers instead of floats by default - - menu: push mode not working on touch devices - -## 0.49.0 - -**Deprecation** -MathJS syntax is now deprecated and will be removed in the future, sessions using it will be working for a few more versions but users are strongly encouraged to migrate to the javascript syntax. - - -- bug fixes: - - multiclient sync not working when `targets` is empty - - widgets: missing `target` property for `plots/*` widgets, required for MIDI bindings - - editor: set `label` to `auto` instead of `true` when using the toggle button - - editor: errors when hitting `mod + a` and unselecting widgets - - modal: correct popup title color - - options: allow `midi:port_name` pairs in `--send` option - - sidepanel/state: opening a state file now properly sets it as the next default save location -- widgets: - - **new** `menu` widget, circular alternative to the dropdown & switch widgets - - file: allow selecting folders - - text: optimize value update when there's no icon to draw -- editor: - - convert invalid quote characters automatically to avoid errors - - tab: added `detached` property (set to false to prevent iframes from reloading when the tab opens) - -## 0.48.8 - -- bug fixes - - strip: layout issues when moving widget in a strip (min width/height still active) - - tcp: prevent sending osc messages on udp port when the same port number is set as a tcp target - - midi: take server default targets into account to determine widget matching - - save dialog: prevent keys widgets from capturing keystrokes when typing the filename - -## 0.48.7 - -- bug fixes - - xy: broken `spring` property - - macOs: add support for emulated right click via `ctrl+click` - - midi: messages received from a midi port now only affect widgets that send to this port - -## 0.48.6 - -- bug fixes - - ios: prevent color issues with sliders - - editor: prevent all keyboard shortcuts from triggering default browser actions -- main - - detect http server silent setup failure - -## 0.48.5 - -- bug fixes - - regression breaking support for utf-8 strings in received osc messages - -## 0.48.4 - -- bug fixes - - launcher: limit terminal history size to prevent slowdown/freeze -- widgets - - knob: text pips support - - fader: add css variable `--gauge-width` - -## 0.48.3 - -- bug fixes - - widgets: prevent update errors when widgets are not fully initialized - - prevent pinch-zoom on touch screen - -## 0.48.2 - -- bug fixes - - editor: checkbox position in multiline fields - - patchbay: widget not responding to osc after being edited -- widgets - - script: added `httpGet` function for simple local http requests - - -## 0.48.1 - -- bug fixes - - modal: `popupLabel` update issues - - modal: `popupTop` not correctly interpreting percents - - editor: scrollbar issue in editor's input fields on recent chromium - -## 0.48.0 - -- bug fixes - - midi: listing devices from context menu not working when the midi options is empty - - package: broken build from sources on Windows - - editor: incorrect position when moving a widget from an edge with the keyboard - - modal: prevent touchend event from reaching the inner widgets when opening the container - - matrix: clone matrices not properly storing their children's values - - multipad/range: errors when dragging over when the gesture was initiated on a traversing widget (ie matrix) - -- widgets - - **new** html widget - - frames: allow loading local html files without requiring a web server to serve them - - text: escape html tags characters (`<` & `>`) - - input: added `asYouType` property - - sliders/pads: added `sensitivity` property - - -## 0.47.4 - -- bug fixes - - keys: prevent default browser actions when a combo is bound to a widget (for example print dialog with ctrl+p) - - xy: broken `doubleTap` - - widget: error when two sibling widgets have a non-dynamic property depending on each others and on another widget at the same time - - cli: broken `--version` option - -## 0.47.3 - -- bug fixes - - regression causing errors with the `value` property - -## 0.47.2 - -- bug fixes - - midi: `path` option not applied to launcher's `list` contextual action - - midi: pitchbend messages not received correctly - - style: layout issues in recent chromium - - encoder: `0` value in `back` property not working - - editor: state not completely restored under some conditions - - push: force release when the widget is removed/recreated while pressed - -## 0.47.1 - -- bug fixes - - css font faces not loading from absolute/relative paths -- midi - - added `path` option for setting python binary path manually - -## 0.47.0 - -- bug fixes - - launcher: spaces not properly escaped in quoted strings -- widgets - - sliders: `default` and `spring` properties are now dynamic -- server - - images urls are now resolved relatively to the session path directory by default (fallback to absolute path resolution if not found) -- custom module - - added `loadJSON` and `saveJSON` functions - -## 0.46.2 - -- improved canvas rendering speed on chrome v69 and above -- widgets - - modal: `scroll` option - - script: `get(id)` function added in `script`execution context - - script: `getProp(id, property)` function added in `script`execution context - - script: `id` variable added in `script`execution context (id of the widget that triggered the script) - -## 0.46.1 - -- bug fixes - - windows: midi debug strings not printed - -## 0.46.0 - -- bug fixes: - - modal: `css` not properly applied if the property was previously empty and the modal had been opened at least once - - image: allow overriding css background-image when value is empty -- widgets - - switchers: new `state` widget -- remote control - - added `/STATE/[GET|SET|STORE|RECALL]` methods -- midi - - print port name in debug messages - - added `pc_offset` option to act as if program change numbers where between 1 and 128 - -## 0.45.7 - -- bug fixes - - image: `cache` option inverted - - image: allow whitespaces in url -- widgets - - keyboard: `toggles` options - -## 0.45.6 - -- bug fixes - - bottom horizontal scrollbar not responding on small screens - - remote file browser: hitting a letter to select a file based on its name was looping on the first two matches only - - editor: preserve backslashes in enquoted strings (not in objects/arrays) - - editor: clear the editor when selected widget is removed by an undo/redo action -- widgets - - `logScale` can be set to a number to use a logarithm base different from the default - - knob: `compact` mode is back - -## 0.45.5 - -- bug fixes - - absolute file paths not resolved under windows - - nested `@{}` calls issue ([#516](https://github.com/jean-emmanuel/open-stage-control/issues/516)) - -## 0.45.4 - -- bug fixes - - handle network drops correctly (notify immediately and fix reconnection mechanism) - - formulas breaking the property update mechanism when not resolved - - modal: title layout issue - -## 0.45.3 - -- bug fixes - - broken client sync for widgets with `split` set - - custom module: `receive` function not working when omitting host/port and sending only one argument - - file browser: prevent error when files/folders cannot be read - -## 0.45.2 - -- bug fixes - - potential security issue in `JS{{}}` parser - -## 0.45.1 - -- bug fixes - - broken session local export - - potential security issue in custom module parser - -## 0.45.0 - -- bug fixes - - regression (v0.41.4) breaking sync between clients - - sessions not added to history when opened - - switch: traversing mode issue - - remote file browser reactivity issue - - encoder: broken because `ticks` default was `auto` instead of `360` -- main - - state files can be saved remotely -- widgets - - **removed** deprecated widgets `multifader`, `multitoggle`, `multipush` and `formula` - - new `JS{{}}` property syntax, allows writing formulas using javascript - - errors encountered in `#{}` blocks are now printed to the client console (F12) - - keys: renamed formula context variable `super` to `meta` - -## 0.44.0 - -- bug fixes - - ios: clone widget not displaying properly - - keys: error when leaving the window with the cursor while holding a key-combbo pressed - - session: disable saving when `--read-only` is set -- main - - sessions can be opened and saved from/to the server's filesystem directly -- widgets - - new `file` input widget (allows selecting a file on the the serve and sending its absolute filename) -- midi - - :warning: **breaking changes** :warning: - - replaced python dependency `rtmidi` with `python-rtmidi` (provides pre-compiled binaries for all major platforms) - - sysex messages are now discarded by default, they can be enabled by adding `sysex` to the midi options - -## 0.43.0 - -- bug fixes - - sidepanel: resize handle overflow issue -- ui - - sidepanel: hidden resize handle; show edge resize handle on hover -- launcher - - added context menu action to display midi device list without starting the server -- widgets - - switch: add `traversing` option (`true` by default) - - knob: act as a relative encoder when traversing gestures are enabled and `snap` is `false` - - keys: `key` variable in `keydown` and `keyup` is now always lowercased when referencing a single character - - keys; expose `code` variable from the keyboard event object (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#Code_values) -- custom module - - expose shorthand functions `send` and `receives` - - expose a client object instead of just an id in `app` event handlers to allow retrieving the client's ip address as well - - custom modules can now be written like standard nodejs modules (using `module.exports` assignement instead of a self-invoking function pattern) - -## 0.42.0 - -- widgets - - `OSC{}` syntax accepts an optional third argument (`false`) to bypass the host widget's `preArgs` -- editor - - sticky header to remind selected widget's id - - sidepanel can now be resized by dragging its edge - -## 0.41.7 - -- bug fixes - - matrix: `$` variable not starting at `start` - - matrix: properties not reset to default when removed from `props` - -## 0.41.6 - -- bug fixes - - keys: binding conflict with editor - - xy: drawing performance issue - -## 0.41.5 - -- bug fixes - - editor: changes applied to wrong widget when clicking on a widget while editing another widget's property - - push: allow setting `value` property - - allow whitespaces in path for `--custom-module` - - error when changing a property that's inherited by a widget to define its address and at least one non-dynamic property -- widgets - - sliders: when `steps` is set, scrolling on the widget makes it go directly from one step to another - -## 0.41.4 - -- bug fixes - - broken `--remote-saving` option* - - `fader`: built-in `meter` not updating its `address`, `preArgs` & `color` properties - - incorrect osc messsages when widget's `split` and `preArgs` are set - -## 0.41.3 - -- bug fixes - - `rgb`: values were rounded even with `precision` different from `0` -- osc - - add support for utf8 string argments (encoded/decoded as per standard https://encoding.spec.whatwg.org/#utf-8) - -## 0.41.2 - -- bug fixes - - geometry properties not properly applied when reset to `auto` - - `strip` layout not properly applied when changing the widget's `horizontal` property - - `modal` glitch on chromium v70 - -## 0.41.1 - -- bug fixes - - error when loading session file - - prevent sidepanel issue when toggling quickly - -## 0.41.0 - -- main - - `--send` accepts `ip:port` and `domain:port` targets - - removed previously deprecated `--sync` option - - `--custom-module` now accepts extra options that can be consumed from the custom module's code - - sessions located on the server can now be saved remotely, this becomes the default behavior for keyboard shortcut `mod + s`, local export is still available via `mod + shift + s` - - added `--remote-saving` options to limit remote session saving feature to hosts that match the provided regular expression -- ui - - added notifications -- widgets - - `matrices`: **new** `patchbay` widget -- bug fixes - - layout break when hitting tab with sidepanel closed and editor enabled - - crash when running the server in an environnement without user home folder - -## 0.40.5 - -- bug fixes - - clone: editor's selection rectangle appearing after editing the clone's target widget - - windows: midi issue (python path not found) -- widgets - - input: hitting `tab` now validates the value before focusing the next input (hitting `esc` or clicking outside the widget still cancels); when focusing an input widget, its whole value is selected by default; focused/selected text color hint changes. - - matrix: widgets inherit from the matrix' `id` and osc properties by default - -## 0.40.4 - -- bug fixes - - editor: widgets/tabs not properly reordered when changing a widget or tab's index by more than 1 - - main: `--no-gui` switch not working when running the app from a different directory - - regression causing osc receivers (`OSC{}`) to conflict with property listeners (`@{}`) -- widgets - - push: add `doubleTap` option - - osc listeners (`OSC{}`) now accept relative addresses (without leading '/'), automatically prefixed with the widget's address - -## 0.40.3 - -- bug fixes - - editor: sidepanel & dragging handles not always updated after edition - - widgets: parsing error when a property contains more than 10 variables - -## 0.40.2 - -- bug fixes - - regression reversing tabs order - -## 0.40.1 - -- bug fixes - - editor: issue with tabs selection / edition - - regression breaking `svg` - -## 0.40.0 - -- bug fixes - - `--read-only` option not properly working - - `keyboard`: dynamic properties `target`, `precision` & `preArgs` not being updated dynamically -- widgets - - formulas: added `indexOf` function - - **deprecated** `multifader` / `multipush` / `multitoggle` in favor of the generic `matrix` widget - - meter: `gradient` can be set as an object to define uneven color breakpoints - -## 0.39.8 - -- bug fixes - - meter's properties not accessible (overridden with fader's properties) -- mobile - - button for preventing device sleep - -## 0.39.7 - -- bug fixes - - iOS 9.3 compatibility -- widgets - - sliders: `steps` property is now dynamic - -## 0.39.6 - -- bug fixes - - `modal` widgets not working since chrome v70 - -## 0.39.5 - -- bug fixes - - sliders: `steps` option not working when `range.min` is not `0` - - regression breaking the app for iOS 9.3 - -## 0.39.4 - -- widgets - - multiXy: added `.pad-N` class to inner xy pads to help with css customization - - xy/multiXy: added css variables `--background`, `--color-pips`, `--pips-opacity` and `--point-opacity` - - rgb: added `alpha` option - - xy/multiXy/rgb: design impovements; - - sliders: new `steps` option - -## 0.39.3 - -- bug fixes - - broken tabs color property - - broken `/TABS` command; this command doesn't makes panels send osc messages anymore - -## 0.39.2 - -- bug fixes - - regresssion: broken --theme option - - regression: missing 'edit parent' action in editor's context menu - -## 0.39.1 - -- bug fixes - - regression breaking icons in switches' labels - -## 0.39.0 - -- performance - - rendering speed improved (session loading time reduced by about 30%) -- widgets - - remove support for deprecated properties `path`, `noPip` and `noSync` - - sliders/pads: `precision` is no longer a dynamic property - -## 0.38.7 - -- bug fixes - - launcher compatibility issues with electron v3 - -## 0.38.6 - -- bug fixes - - regression with dynamic property `color` in panels and matrices -- packaging - - node-only package can be run with electron too - -## 0.38.5 - -- packaging - - regression causing the client js bundle to be much bigger than needed - - added node-only package built without electron for unsupported platforms (armv6, etc) - -## 0.38.4 - -- bug fixes - - `@{parent}` calls not working consistently in clone widgets - - `slider/pads`: inteverted ranges not working - - fix `doubleTap` for sliders with `snap` set to `true` - - undo/redo errors -- widgets - - 1-level nested property inheritance calls (`@{id_@{id_2}}`) are now updated dynamically - - support special css property `class` for adding custom classes to widgets - - added "smart" traversing gestures mode that limits affected widgets by the type of the first touched widget - - root: added `traversing` property -- editor - - major performance improvements (containers' children are reused whenever possible instead of being recreated) - - removed widget deletion confirmation popup - - properties categories can now be folded - - added keyboard shortcut `F2` for editing the label quickly - - added keyboard shortcut `mod + s` for saving the session - - added keyboard shortcut `mod + o` for opening a session - - use `backspace` instead of `delete` for deleting widgets on MacOs - - added keyboard shortcut `mod + e` for enabling / disabling the editor - - added keyboard shortcuts `mod + arrows` for selecting widgets - - added keyboard shortcut `mod + a` for selecting a widget's siblings and itself - - added keyboard shortcut `mod + shift + a` for cancelling selection - - added multi widget selection with mouse when `shift` is pressed - - right-click doesn't modify current selection when `mod` or `shift` is pressed -- formulas - - added `extend(x, y)` function for merging two objects - - objects' closing brackets (`}`) don't need to be escaped with a backslash anymore - - show property's computed value in the help popup - -## 0.37.4 - -- bug fixes - - osc receivers (`OSC{}`) not working in non-dynamic properties -- remote control - - added `/GET/#` to get a widget's value without using `/GET` as reply address - -## 0.37.3 - -- bug fixes - - gyroscope: osc sendings not properly triggered on value updates - - -## 0.37.2 - -- bug fixes - - osc: regression making empty `preArgs` count as one empty string argument - -## 0.37.1 - -- bug fixes - - closing popups when clicking precisely on the "x" -- translations - - fr: corrections - - ru: added russian translation - -## 0.37.0 - -- bug fixes - - editor: opening the sidepanel doesn't select the root widget anymore - - ios: fix `doubleTap` -- widgets - - **new** `gyroscope` widget - - **new** `frame` widget - - **breaking change** in `panel`: dropped Visual Format Language support (`layout` and `spacing` properties) - - maths: added `timestamp()` function -- editor - - widget property names can be clicked to show documentation -- misc - - the client app can be translated (https://github.com/jean-emmanuel/open-stage-control/issues/302) - -## 0.36.0 - -- bug fixes - - `linkId` synchronizations now correctly trigger property updates - - widgets with multiple `linkId` are now properly handled - - synchronization issue between `visualizer` widgets -- widgets - - `keys` (**breaking changes**): formulas in `keydown` and `keyup` must be explicitely written using the `#{}` syntax; variable `value` got removed from these formulas context (use `@{this}` instead); removed `widgetId` property, the value emitted by the widget on keypress events can be linked with other widgets via the `linkId` property or the property inheritance syntax; - - `visualizer`: update rate set to default canvas framerate -- editor - - **new** keyboard shortcuts (undo, redo, copy, paste, etc) - -## 0.35.0 - -- main - - added `--state` option for loading a state file with a session file -- state - - loading a state file doesn't replace the quick save slot anymore -- widgets - - **new** `script` widget -- misc - - reduced session file size (indentation set to 2 instead of 4) - -## 0.34.4 - -- bug fixes - - widgets: dynamic `address` when `split` is `true` - - strip: missing osc properties (`address` and `preArgs`) for remote control - - switcher: update linked widgets' osc properties before sending if they depend on the switcher's value - -## 0.34.3 - -- bug fixes - - launcher: regression breaking the `port` option - -## 0.34.2 - -- bug fixes - - matrices: spacing issue when wrapped in strips - - launcher: regression preventing options to be applied - -## 0.34.1 - -- bug fixes - - switch: display object-values properly when `showValues` is set to `true` - - prevent non-dynamic properties updates from breaking an osc sending event chain -- deprecations - - `formula` has been removed from the editor's context menu -- custom module - - expose `app` to the custom module's scope: an event emitter for monitoring the events sent by the different clients -- misc - - fixed rpi build - -## 0.33.3 - -- bug fixes - - matrix: recreation loop issue with matrices of clones - - multixy: glitch when some letters are used in the points' labels - -## 0.33.2 - -- bug fixes - - matrix: set initial value at widget's creation; missing border under widget's label -- widgets - - property math syntax: add `values()` and `keys()` functions - -## 0.33.1 - -- bug fixes - - widgets: remove unnused properties to avoid having hidden properties laying around when the type changes (especially dangerous when those properties where linked to other widgets) - -## 0.33.0 - -- bug fixes - - osc receivers: unregister properly when widgets are recreated (memory leak); allow non-string values (eg. objects) - - circular property update issues -- widgets - - **new** generic `matrix` widget - - fader: restore right-click focusing the input in compact mode (mouse only) - -## 0.32.6 - -- bug fixes - - css border-radius not applying correctly for some widgets -- themes - - multiple adjustments - -## 0.32.5 - -- bug fixes - - missing feedback support for widgets with typed preArgs -- themes - - improved `dark` theme - - added `flat` - -## 0.32.4 - -- bug fixes - - regression breaking typed osc args - - -## 0.32.3 - -- bug fixes - - regression in editor/resize function - -## 0.32.2 - -- bug fixes - - sliders colors not displayed correctly on iOS -- widgets - - xy: tiny knob style change -- editor - - reallow editing disabled properties - -## 0.32.1 - -- bug fixes - - error in osc receivers - -## 0.32.0 - -- main - - add tcp support - -## 0.31.0 - -- bug fixes - - regression breaking multitouch widgets -- widgets - - fader/knob/pad: right-click / long tap doesn't give focus to the input anymore - -## 0.30.4 - -- bug fixes - - regression breaking touch traversing gestures - - clone widgets becoming unselectable for edition - - `preArgs` property still being coerced to an array - -## 0.30.3 - -- bug fixes - - big regression breaking many touch gestures - -## 0.30.2 - -- bug fixes - - broken remote-control /TABS command - - disabled `spacing` property in strips - - disabled properties in modals - - broken arm build - - -## 0.30.1 - -- midi - - prevent the main process from exiting when MIDI setup fails - -## 0.30.0 - -- widgets - - `target` and `preArgs` properties are no longer coerced to arrays and can be written as single string values - - `linkId` supports master and slave modes with `>>` and `<<` prefixes - - the special `target` token `null` can now be used in conjunction with regular targets, it disables the default global targets set via the `--send` option -- editor - - disabled widget properties are now greyed out - -## 0.29.2 - -- bug fixes - - launcher: parsing errors are not fatal anymore - - css parsing error on iOS - -## 0.29.1 - -- bug fixes - - editor: "wrap" deleting the widget just before the one being wrapped - - regression breaking traversing gestures and high precision gestures (0.29.0) -- server - - allow sending osc to broadcast ip addresses -- widgets - - limited support for property inheritance nesting (`@{id_@{id_2}}`) - - support using property inheritance syntax in osc listeners' addresses - -## 0.29.0 - -- beaking changes - - dropped supported for `.js` sessions (deprecated in 0.20.0) -- bug fixes - - zeroconf: unpublish when shutting down - - ios 9.3 compatibility issue - - function mispelling in rgb widget -- widgets - - modal: added `popupLeft` and `popupTop` properties - - faders/meter: add css variable `--gauge-opacity` to allow setting a fixed gauge opacity for meters and compact faders -- custom module - - messages converted from midi inputs can be filtered - - -## 0.28.3 - -- bug fixes - - widgets not correctly drawn when hidden/shown with dynamic css - - iOS: file upload failing sometimes -- widgets - - knob: small design improvements (pips don't take extra space anymore) - -## 0.28.2 - -- bug fixes - - session list: fix "remove from history" always removing the first item in the list -- custom module - - expose `setInterval` - - expose `clearTimeout` and `clearInterval` - - prevent errors when failing to run the module - - -## 0.28.1 - -- bug fixes - - regression in nested clones structures handling - - -## 0.28.0 - -- widgets - - matrices: support setting `split` property as a string to allow using children's indexes in their address (`$` is replaced with the index number) - - text: `wrap` property doesn't break words by default anymore - - rgb: added `range` property -- launcher - - right-click context menu (copy, paste, clear console, toggle console autoscoll, relaunch app) - - better font for the console - -## 0.27.2 - -- bug fixes - - session/state file upload sometimes failing silently - - regression breaking the app for iOS - -## 0.27.1 - -- bug fixes - - error when resizing a widget and its clone(s) at the same time - - error with non string css property - - session list not reappearing when failing to load - - broken state file loading -- misc - - added a loading indicator when uploading a session file or a state file - -## 0.27.0 - -- bug fixes - - strip: nested strips were inheriting their parent's `spacing` - - modal: prevent error when retrieving a child's property - - modal: prevent touch event from affecting elements behind the popup when closing it - - clone: some properies in target widget were not applied to the clone - - clone: prevent clone from resetting its target value when created - - text: vertical centering issues in narrow widgets - - dynamic properties: when using a widget's own value to determine its osc settings, these are checked and updated if needed before sending the message - - prevent error when loading a session containing invalid property inheritance calls - - broken build for iOS 9.3 -- editor - - wrap in: insert wrapper at selected widget's index - - wrap in: set label to false by default when wrapping in a strip or a panel - - css property `pointer-events:none;` is now ignored when the editor is enabled - - preverve pecentages when dragging/resizing a widget that has its position/size written in percents -- widgets - - **new** `OSC{/address, default_value}` syntax -- ui - - sidepanel is now resizable -- themes - - `responsive-fonts`: increase size for big screens -- build - - dropped support for node < 4.8 - -## 0.26.3 - -- bug fixes - - ios: broken default accent color in clone Widgets - - ios/android: closing the sidepanel opened the tab next to the menu button -- editor - - mac: use `shift` instead of `command` for multi widget selection to match native behaviour and prevent unwanted zoom with trackpads -- widgets - - strip: `spacing` now accepts percents - -## 0.26.2 - -- bug fixes - - regression preventing glass effect from using the widget's color - - missing last key in keyboard widget - - editor: select parent widget after deleting a widget - - regression letting user to scroll the main document - - editor: wrap/cut/delete multiple widget not working properly -- widgets - - text: set line-height relative to font size - - meter: added `gradient` feature - -## 0.26.1 - -- bug fixes - - ios: text input fields not editable -- editor - - mac: use `command` instead of `ctrl` for multi widget selection - -## 0.26.0 - -- bug fixes - - editor: when selecting another widget while editing a property, changes where applied to the newly selected widget - - widgets: css: @media queries parsing - - prevent some errors when synchronizing clients - - use command key instead of ctrl for zooming on mac - - clone: memory leak / freeze -- default client - - mac: disabled unsupported pinch zoom -- themes - - alt-buttons: modal font-weight & color fix; push button active state colored border - - added "responsive-fonts" theme -- editor - - allow multi widget resizing/dragging - - tweaked ctrl+click/right-click selection behaviors - - **new** "Wrap in" context menu - - -## 0.25.0 - -- bug fixes - - launcher: parse array options correctly when an item contains spaces, - - launcher: the terminal now grows and scrolls to bottom automatically - - editor: broken children reordering; children - list display bug with long `id`s -- main - - add `--fullscreen` switch (default gui only, bypasses the sidepanel fullscreen button) - - added/updated some themes: `orange`, `light`, `dark`, `alt-buttons` (the latter can be combined with other themes) -- widgets - - knob: big knobs design tweaks - - **new** `default` property that sets a widgets initial/doubleTap/spring value. The `value` property does no longer serve this purpose. - - **new** `bypass` property that disable osc messages (except when requested via `/GET` and `/EDIT/GET`) - - panel: **removed** `noSync` property (backward compatible fallback to `bypass`) - - property inheritance: `@{widget_id.value}`, `@{widget_id}` and `@{widget_id._value}` now all refer to the widget's current value (the latter being kept for backward compatibility); If a property update triggers an osc message, it will now be sent after the other dynamic properties changes are resolved (such as osc `address`, `target`, etc) - - text: added `align` and `wrap` properties - - input: added `align` property - - sliders/xy: `doubleTap` can be an osc address to send a special message instead of resetting the widget's value -- editor - - allow selecting multiple widgets (`ctrl + click`) if they share the same parent. Context-menu and sidepanel editing actions apply to all selected widgets - -## 0.24.3 - -- bug fixes - - property maths: variables names declared in a formula were replaced by their associated value if found in the formula's result - - missing console logs on windows -- ui - - add iOS fullscreen support via add-to-home feature -- editor - - ask for confirmation when closing or refreshing the page if the editor has been enabled at least once - - prevent default widget interaction when selecting a widget for edition -- widgets - - knob: small design tweaks -- misc - - remove proprietary ffmepg codec from package - -## 0.24.2 - -- bug fixes - - macOs app menu & shortcuts - -## 0.24.1 - -- bug fixes - - server/client communication errors - - prevent error windows from spawning -- main - - added some menu items on macOs (including "Quit" !) - -## 0.24.0 - -:warning: **BREAKING CHANGES** :warning: - -Read the changelog carefully, old sessions files are likely to need some adjustements to work as they used to. Plots and input widgets had their `widgetId` option removed because it was redundant with the generic `linkId` property. - -- bug fixes - - regression preventing dropdown to display no option selected - - crossfaders display issue on iOS - - restored compatibility options for server-client communications - - xy: `doubleTap` option - - range: `spring` option - - plot: crash when drawing only one point - - widget css: fixed @media queries @keyframes parsings -- main - - theme files changes are automatically applied - - server-client communication system rewritten -> HUGE latency reduction and stability improvement especially under stress conditions - - engine update (electron@1.8.2) -- widgets - - **new** svg plot widget - - switch: wrap non-array `values` property in an array - - dropdown: wrap non-array `values` property in an array; always add a default empty value - - property inheritance: added shorthand default to `_value` when no property is specified (`@{widgetId}`); some properties can now be dynamically changed without recreating the widget entirely - - property maths: added support for math expressions everywhere via `#{}` - - input: add glass effect when `editable` is `false` - - `linkId` can now be set as an array of linkIds - - plot: added `dots` options; **removed** `points` options (use `value` and property inheritance instead) - - eq: **removed** `filters` options (use `value` and property inheritance instead) - - plot/meter/led/rgbled/text: **removed** `widgetId` option - - input: **removed** `widgetId` option - - math: **deprecated** `formula` widget - -## 0.23.1 - -- bug fixes - - regression breaking modal's position in scrolled tab containers - - widget with a `touchAddress` set now send their touch-off message when removed or recreated while being interacted with - - broken windows builds (long path issue) - -## 0.23.0 - -- bug fixes - - plots now send their value to other widget for synchronization as expected - - text widgets now apply their target widget's precision - - property inheritance accepts targetting a parent widget by its id - - multiple icons not displayed correctly - - broken `--blank` option -- main - - added `--disable-gpu` option for disabling hardware acceleration (fixes rendering glitches and reduces input lag on some systems) -- widgets - - inputs: **new** `keys` widget, for keyboard bindings - - property inheritance: new special property name `_value` (retrieve the widget's value, and update when it changes) - - switch: added `showValues` to display both values and labels in the buttons; array values can now be selected via osc - - range: both handles can be moved by holding `shift` while dragging - - rgb: **removed** `touchAddress` option - - labels/texts: multiple white spaces are no longer merged - - plot: can receive stringified arrays of coordinates or stringified objects for merging coordinates sets; added `bars` option for drawing barcharts; - - widgets' `precision` option allows setting a specific data type for numbers (sliders can send doubles !) -- misc - - event system rewritten - - js build size reduced - -## 0.22.0 - -- bug fixes - - sessions opened from command line with relative paths are now added to the history with their absolute path - - sending an empty message to a `text` widget resets it to its initial value and without ignoring its `value` property - - sending no value to a widget with `preArgs` is now possible : all the arguments found in incoming osc messages are now taken into account to match the widgets in the session - - regression breaking state quicksave from sidepanel -- engine - - downgraded to the latest *stable* electron release -- main - - added `zeroconf` / `bonjour` publishing for the app's http and osc input ports - - added `--instance-name` option to differenciate mulitple instances in zeroconf networks -- widgets - - sliders/pads: holding `Ctrl` now enables high precision dragging with the mouse and bypasses the `snap` option - - inputs: renamed `input`'s property `horizontal` to `vertical` to match how the widget actually displays - - sliders: **new** `range` widget - - plots: **new** `image` widget -- remote control - - **removed** deprecated `/EXEC` - - renamed `/EDIT_SOFT` to `/EDIT/MERGE` - - added `/EDIT/GET` (get a widget's data) - - added `/GET` (get a widget's value) - - added `/SET` (set a widget's value as if it was interacted with from the interface) - - -## 0.21.3 - -- bug fixes - - session/state: regression (0.21.2) breaking save-to-file function -- ui - - FontAwesome 5 (icon font) ! - -## 0.21.2 - -- bug fixes - - cli: broken long flag `--no-gui` - - headless: when running with `node`, errors don't stop the server; when running with `electron` (default), errors are logged in the console instead of being showed in a dialog window - - switcher widgets regression (broken) -- midi - - float values are now allowed and automatically rounded -- misc - - some code refactoring - -## 0.21.1 - -- bug fixes - - visualizer: fix memory leak when editing; fix ignored `smooth` option - - plots: regression preventing widgets with no `target` option from receiving messages sent by other clients - -## 0.21.0 - -- main - - renamed `--sync` option to `--send` (deprecation, backward-compatible) -- widgets - - sliders/pads: when receiving feedback while touched, the widget waits to be released before updating to the latest received value. - - input: the widget's value is no longer validated when leaving focus by clicking somewhere else or hitting the `Tab` key (it must be submitted by hitting the `Enter` key); when submitting a value to another widget, the feedback from this widget doesn't trigger a second osc message anymore; non-editable inputs can't steal focus anymore - - added support for `null` value in `target` option to disable osc sending -- misc - - property fields are now parsed using [JSON5](https://github.com/json5/json5), a more flexible notation. Session files are still written in standard JSON format, this is just a way to avoid typing mistakes when using the editor. - - remote editing also accepts JSON5 notation - -## 0.20.3 - -- bug fixes - - allow loading `.json` session files from the launcher -- launcher - - new log/error console (shows once the app is started) - -## 0.20.2 - -- bug fixes - - pads: regression breaking the built-in input - - multifader: inverted order in horizontal mode -- widgets - - plots: add `smooth` option (thanks to [cardinal-spline-js](https://github.com/epistemex/cardinal-spline-js)); draw thicker lines - - pads: draw thicker inner circle - - mobile - - prevent devices from entering sleep mode - - -## 0.20.1 - -- bug fixes - - error popups not created -- misc - - rename sessions files to `.json` - -## 0.20.0 - -- **breaking changes** - - sessions are now saved as `.json`files by default (the deprecated `.js` extension can still be opened). - - states are now saved as `.state` files (the old `.preset` files can be renamed without any problem) -- bug fixes - - touch release event is properly dispatched in traversing containers (ie keyboards and matrices) (#94) -- widgets - - css `border-radius` support enhanced - - css `color` applies locally while `--color-text` applies to children too - - plot/text: new lines are properly printed -- packaging - - added `arm64` binaries -- iOS - - compatibility improved (version 9.3 and above) -- engine - - electron 1.8.0 (chrome 59) - -## 0.19.6 - -- hot fix - - broken formula widget - -## 0.19.5 - -- launcher - - fixed typo in new version message -- misc - - client-side javascript's size reduced, now for real !! - -## 0.19.4 - -- bug fixes - - buttons: changing `css` background works as expected - - widgets: changing `css` (text) color works as expected - - fader: fix hidden input in horizontal + compact mode - - pads: pips scaling bug -- widgets - - `css` font-sizes apply correctly to all children (better use percents) - - formula: add `unit` option -- misc - - client-side javascript's size reduced ! - -## 0.19.3 - -- bug fixes - - midi: noteOff messages not being sent; - -## 0.19.2 - -- bug fixes - - lobby: regression breaking the lobby for touch devices - - -## 0.19.1 - -- bug fixes - - launcher: load correct font - - midi: python3 compatibility fix - -## 0.19.0 - -- ui - - general design improved, heavily inspired by [budislavTVP](http://budislavtvp.deviantart.com/) works; color schemes are much simpler and easier to customize (try `--theme light` !); Font changed to Roboto; Texts are slightly thicker and uppercased in most cases for better readability (use css `text-transform:none` to disable the latter). -- widgets - - fader: added `dashed` option; added `input` option; - - meter: added `alignRight` option; added `dashed` option; - - knob: removed `compact` option; added `dashed` option; added `input` option; - - xy/rgb: added `input` option; added `pips` option: - - panel/strip: removed inner widgets dark borders; added `border` option; - - buttons: new `dropdown` widget; - - toggle: added `led` option to choose between the old appearance and the new one; added `douleTap` option - - new `input` widget - - containers: new `clone` widgets - - added support for `"self"` value in `target` option (sends the message back to the clients, useful for sending `/EDIT` messages...) -- editor - - option fields are now multiline (`ctrl + enter` to add a new line), and pretty printed - - added checkboxes for boolean options - - added `Edit Parent` context menu option -- midi - - replaced `pyo` dependency with [`pyrtmidi`](https://github.com/patrickkidd/pyrtmidi): lighter, dedicated to midi only, and handling virtual ports (no `mididings` dependency anymore) - - pitchbend value is now a single integer between 0 and 16383 -- bug fixes - - fixed VisualFormat errors in iOS -- main - - added `--url-options` command line option - - fixed `--disable-vsync` not working when starting from the launcher -- documentation - - new style, better organization - -## 0.18.0 - -:warning: **Breaking changes** :warning: - -Sessions saved with this version will not be readable with older versions (old sessions a can be opened but wont be backward-compatible once saved). - - -- widgets - - add property inheritance between widgets with statements `@{parent.propertyName}`, `@{this.propertyName}` and `@{widgetID.propertyName}` - - containers: added `variables` options (arbitrary varibles to pass to children) - - panel: added full osc support (for sending/receiving tab changes) - - modal: changed style to fit popups' appearance; added `popupWidth` and `popupHeight` options; :warning: removed `tabs` option; added full osc support; added `doubleTap` option (makes it openable with double taps instead of single taps) - - strip: refactored widget using `panel` as base; added `stretch` and `spacing` option; now it's really cool - - sliders: added `doubleTap` option (double taps reset the widget to its initial value when enabled) - - knob/fader: renamed `noPip` option to `pips` (inverted behaviour; backward compatible) - - encoder: mousewheel support - - knob: compact design remake -- bug fixes - - sliders: fixed `spring` when `value` equals `0` - - modal: fixed osc values (was `True`/`False` instead of `1`/`0`) -- session - - the root panel is now saved as a special `panel` widget (which means it has savable options) -- custom module - - add access to the app's `settings` object - -## 0.17.8 - -- bug fixes - - regression breaking widgets' `split` option (0.17.6) - - regression breaking the state export button (0.17.7) - - regression breaking editor's `cut` action (0.17.7) -- osc - - javascript object are now stringifyied before beeing sent -- widgets - - maths: add `condition` option to [`formula`](http://osc.ammd.net/user-guide/widgets-specifics/maths/#formula) - - sliders/pads: add `touchAddress` option - - fader: add `meterAddress` - -## 0.17.7 - -- engine - - socket.io v2 -- client - - scripts are now transpiled to ES5 javascript code, thus increasing compatibility with some browser (iOS9's chrome, firefox, etc) - - scripts size reduced from 2.4M to 1M thanks to minification -- bug fixes - - elements duplications in sidepanel when loading another session - -## 0.17.6 - -- main - - osc sending speed optimization: all static infos (target, address, preArgs) are cached server side to reduce network overhead -- widgets - - **new** encoder widget -- mobile - - `hdpi` support (add `?hdpi=1` to the server's url) -- bug fixes - - launcher: link to the app's address is now clickable - - sidepanel: layout glitches with iOS - - midi: `program` now works with the correct number of arguments -- misc - - some little style fixes - -## 0.17.5 - -- bug fixes - - `multixy` snap mode position offset -- widgets - - **new** [`rgbled`](http://osc.ammd.net/user-guide/widgets-specifics/plots/#rgbled) - - -## 0.17.4 - -- bug fixes - - broken `--blank` option fixed (false-positive detection of concurrency with `--read-only`) - - remove debug message in console when closing windows - -## 0.17.3 - -Hot fix for `--read-only` switch. -Dependencies updates. - -## 0.17.2 (deleted) - -- bug fixes - - `editor`: correctly remove editing state when disabling the editor right after going to another tab -- main - - **new** `--read-only` switch for disabling the editor and preventing change to the session history -- widgets - - `panel/modal`: add `layout` option ([Visual Format Language](https://github.com/IjzerenHein/autolayout.js)) - - `css` option now interprets `&` as a selector for the widget's element itself (useful for targetting pseudo-elements such as `&:after`) - - `plots`: add `widgetId` option to `text`, `meter` and `led` - -## 0.17.1 - -- bug fixes - - `midi`: missing dependency - - `headless`: terminate `midi` correctly when process exits - -## 0.17.0 - -- main - - **new** `midi` support ([documentation](http://osc.ammd.net/user-guide/midi/)) -- ui - - **new** `/TABS id1 id2 etc` osc address to remotely enable tabs - - remote editing through `/EXEC` command is now deprecated, use `/EDIT` and `/EDIT_SOFT` instead -- bug fixes - - `push` widgets (and `keyboards`) not correctly synchronizing each other (with shared widget ids or between different clients) -- widgets - - `css` option now supports css selectors, scoped to the widgets element - - `matrices` don't pass `css` option to their children anymore; subwidgets' indexes are now append to `preArgs` instead of being prepended. -- misc - - app's title uppercased - - tabs titles' letter-spacing increased - -## 0.16.5 - -- bug fixes - - `modal`: correct z-stacking with absolutely positionned widgets; proper rendering for inner widgets; disable parent tab's scrolling when opened; fix various style glitches; - - `strip`: resize glitch when containing compact horizontal sliders - -## 0.16.4 - -- bug fixes - - tab links broken after activating traversing gestures - - `push` release is now handled per touch point (releasing one finger used to release all pressed buttons) -- misc - - destroy default client window when the app process exits - -## 0.16.3 - -- bug fixes - - crash when remote-editing widgets in disabled tabs - - desktop client touch screen support restored - -## 0.16.1 - -- bug fixes - - string arguments overquoted in sent osc messages -- custom module - - added support for initialization script - - unified expected formatting in sendOsc and receiveOsc methods -- ui - - reduced scrollbars width - - -## 0.16.0 - -- new logo :) -- bug fixes - - editor: new widgets are correctly positionned in scrolled areas -- widgets - - **new** `formula` widget, a [mathjs](http://mathjs.org/) expression evaluator that can process other widgets' values - - `multixy` supports named points; fixed drag-dead zone in the border - -## 0.15.1 - -- widgets - - multifader: add `snap` option -- misc - - minor css-related performance fix - - some titles in the editor had the first-letter uppercased - -## 0.15.0 - -- style - - improved coherence, no more pure greys, better differenciation between clickable and static elements. Went back from "pure flat" to "flatty" to help with that (ie a few shadows to make layout more self-explanatory). Some widgets were slightly repimped. -- bug fixes - - `push`: options separators not hidden in the editor - - error when touching a non-interractive object while touching a widget with the other fingers -- widgets - - `multixy` now behaves smarter: points are assigned to the closest touch points -- main - - modifying a session file will automatically update clients that have loaded the same file - -## 0.14.0 - -- bug fixes - - some layout regressions in chrome v49 -- main - - osc input port (`-o`) is now set to the http port (`-p`) by default -- widgets - - **new** `crossfader` and `switcher` widgets that store and recall the state of other widgets - - `matrices` now accept multiple color values (that will be sequencially passed to their children) - - `switches` accept icons in their values' labels -- engine - - electron v1.4.13 -- misc - - all widgets classes were rewritten using ES6 class expressions - - firefox's minimal version is now 46 because of a ES6 related bug (*note that it's still not officially supported*) - -## 0.13.1 - -- bug fixes - - regression preventing received osc messages to be properly routed to widgets with `preArgs` -- debug - - errors occuring in the browser process are now piped to the main process' console with the source file name and the line number. - -## 0.13.0 - -- main - - **new** `-b / --blank` option to start editing a new session directly - - **new** `--disable-vsync` option that improves performance (reduce input lag) on some systems - - some inconsistent parameter combinations are now prevented - - firefox compatibility improved (yet not perfect) - - launcher window is no longer of the `splash` type, as it was difficult to close with some window managers -- widgets - - **new** `modal` container : a button that turns into a fullscreen panel when clicked. - - sliders/xy: add `spring` option that makes that widget jump back to its initial value when released - - fader: horizontal mode default height fixed - - keyboard: black keys pressed state is more noticeable - - matrices: added `start` option to choose the first subwidget's `id` - - labels' height reduced -- editor - - **new** snap-to-grid feature - - widgets' min-width set to grid's width -- misc - - building with node 4 is fixed - -## 0.12.0 - -- bug fixes - - error popups raised by the main process can be closed - - sliders don't send same value over network when the value change is below the widget's precision -- widgets - - **new** (piano) keyboard widget - - matrices: fixed `preArgs` option; added `split` option (default to `false`), *this changes the default osc messages formatting for these widgets* - - icons in labels are inserted using the `^` prefix - - text: icons support in value -- tabs - - icons support in label -- misc - - fontawesome update (4.7.0) - -## 0.11.6 - -- widgets - - meter: rewritten using fader as base - - strip: center widget horizontally if width is set - - fader/knob: compact gauge's alpha varies slightly as the distance to the origin grows -- misc - - one example session added - -## 0.11.5 - -- bug fixes - - [regression] broken horizontal fader and pads - -## 0.11.4 - -- bug fixes - - fader: default `height/width` not set when `top/left` is `auto` - -## 0.11.3 - -- widgets - - knob: gesture's precision is proportionnal to the widget's size - - fader: `height:auto` (or `width` for `horizontal` mode) makes the fader expand automatically -- ui - - cleaner forms in editor and launcher - -## 0.11.2 - -- touch - - using multiple fingers to control a widget increases the precision (reduces the gesture's computed speed) -- widgets - - fader: display pips in `compact` mode when `range` has multiple breakpoints - - pads: display pips when `range` has multiple breakpoints - - multixy: style update (stroked dots, bold number font); `snap` option added; points are automatically assigned to touches as they come; fix `logScale(X|Y)` options - -## 0.11.1 - -- bug fixes - - meters in faders were not always properly positionned -- widgets - - knob: gauge's width is proportionnal to the knob's size in `compact` mode; widget's content centering fixed; `compact` style update; - -## 0.11.0 - -- bug fixes - - `-g / --no-gui` not preventing the launcher from spawning - - `-e / --examples` not correctly parsed -- main - - launcher displays options descriptions for booleans too -- widgets - - added generic `value` option for setting a widget's initial value (does not sync linked widgets nor send osc message) - - **text** widget's `defaultText` replaced with `value` - - multixy dots are drawn with filled background instead of stroke - -## 0.10.4 - -- main - - launcher displays new version if available - - launcher stays opened after starting the server and/or the gui except if `--gui-only` is set - -## 0.10.3 - -- main - - launcher: resetting boolean option properly sets it to false - - launcher: display package's version - - guis: adjust window's background to match the app's -- ui - - launcher and session lobby appear more smoothly - -## 0.10.2 - -- main - - when executing the app with no CLI argument, a launcher window is created allowing user to adjust settings before starting the server (config is saved in the user's directory) - -## 0.10.1 - -- bug fixes - - rgb: minor visual glitch on extreme value, drawing performance improved - - main: examples sessions path are properly stored as absolute paths (fixes `-e / --examples` mode) -- ui - - lobby: session file names are diplayed first, then shortened paths -- misc - - widgets `precision` doesn't affect their visual interraction accuracy since values are now rounded only before osc sending - -## 0.10.0-alpha-2 - -- bug fixes - - [windows] fix long path issue (#35) returns - -## 0.10.0-alpha - -- main - - **new** `-c / --custom-module` switch allowing user to define custom osc filtering fonctions - - `address` is now used everywhere instead of `path` to describe osc address to avoid confusion. Session files using the old `path` option for widgets are still supported. - - **osc bundles** are properly received (subsequent messages are processed separately with a delay if the timetag is set) - - widgets can be edited via osc messages using the special `/EXEC` address - -## 0.9.2 - -- bug fixes - - [windows] fix long path issue (#35) - -## 0.9.1 - -- widgets - - multiXy: added `pointSize` option; made default size bigger; points don't overflow the pad anymore - -## 0.9.0 - -- widgets - - **new** `multixy` pad -- misc - - rewritten `pads` with prototype inheritance and using faders under the hood to handle events (this adds *fader*'s `range` capabilities to *xy*) -- engine - - electron 1.4.4 - -## 0.8.3 - -- bug fixes - - scrollbar arrows not showing - - `fader` pips position when `noPip` is `true` -- widgets - - matrices : all `fader`, `push` and `toggle` options are now available to `multifader`, `multipush` and `multitoggle` - -## 0.8.2 - -- bug - - avoid crash when sending osc with incorrect typetags - - fixed fallback typetag ('s') - - fixed broken `null` value for `push` & `toggle` - -## 0.8.1 - -- bug - - broken `fader` with `horizontal` set to `true` and `compact` set to `false` -- widgets - - remove margins from `plots` - - added `origin` options to `plots` - -## 0.8.0 - -- main - - the headless server/clients model is now the only one beeing used : the GUI mode is nothing more than an embedded chromium (electron) client - - when a new client opens a session on the server, it is synchronized with the other clients - - **new switches** : `--no-gui`, `--gui-only`, `--port`, `--osc-port`, `--version` (see docs) -- ui - - explicit loadings -- widgets - - make push's backlight only respond to external osc messages (not to synchronization messages from other widgets or clients) - - removed special `false` value case for push/toggles (which used to disable osc sending) - - add `norelease` option to `push` for disabling osc messages when releasing the button - - `true` and `false` values are now properly sent as boolean - - **args type definition** in `preArgs` option now uses the osc typetags only ('f', 'i', 'T', 'F', etc) -- engine - - electron 1.4.3 -- misc - - rewritten matrices with prototypes inheritance - -## 0.7.0 - -- bug fixes - - osc messages with 0-item and 1-item args are correctly unpacked and routed - - buttons can handle messages with 0 arg if one of their state has the value "null" -- ui - - nice and bigger scrollbar - - right-click no longer starts a dragging gesture -- editor - - copy/paste data auto-incrementation fix -- widgets - - new equalizer plotter - - push/toggles made more obvious - - knob's new options: angle and origin - - fader's new option: origin -- engine - - electron 1.4.1 (chrome 53, node 6.5.0) -- misc - - added `--examples` switch for showing the availabe example sessions instead of the history - - rewritten sliders and plots using canvas and prototypes inheritance - - reorganized package using the two-package.json structure: js and css assets are now create at build time, and only necessary dependencies are shipped with the app - -## 0.6.3 - -- bug fixes - - regression (since 498ba4a06adf63d76fe7181691299c1cc55e8240) breaking the editor on touch devices - -## 0.6.2 - -- cool stuff - - armv7l prebuilt binaries ! (raspberry 2, etc) -- engine - - electron 1.3.5 - -## 0.6.1 - -- bug fixes - - editor: widgets/tabs can be accessed through their parent's children list (#27) -- engine - - electron 1.3.1 - -## 0.6.0 - -- bug fixes - - pasted widget properly use the pointer's position - - traversing gestures are effective from the first touch, not after the first move - - out-of-range values are properly clipped by faders/knob -- ui - - Faders & Meters design improved - - The main font (droid sans) is now loaded... - - Knob's sizing got smarter - - Widgets don't blink not jump when they appear for the first time or when they resize -- misc - - Fader's `align` option replaced with boolean option `alignRight` - - Widget's `label` now accepts special directive `icon: fontawesome-class` to display icons from [FontAwesome](http://fontawesome.io/icons/) - - Text widget `defaultText` option added -- engine - - electron 1.2.2 - -## 0.5.4 - -- bug fixes - - [desktop] menu bar auto-hide - - [headless] multitouch support -- ui - - [mobile] better faders pips rendering - - fixed horizontal fader knob centering - - [mobile] better numeric inputs rendering (not blurred anymore) -- engine - - [desktop] electron 1.2.0 (chrome 51) - -## 0.5.3 - -- bug fixes - - [again] touch fake-right-click only fires on long touch, not after every tap - - traversing gestures bug with touch -- misc - - better mouse/touch drag events handlers -- engine - - electron 1.1.1 - -## 0.5.2 - -- bug fixes - - touch fake-right-click only fires on long touch, not after every tap - -## 0.5.1 - -- bug fixes - - feedback is now handled precisely by widets (ie not rounded according to the `precision` option, see issue #21) -- engine - - electron 1.1.0 - -## 0.5.0 - -- bug fixes - - touch/mouse events are both handled simultaneously, module rewritten for better performances (see issue #18) -- engine - - electron 1.0.2 - - -## 0.4.8 - -- bug fixes - - regression preventing newly created widgets from using the pointer's coordinates as position - - add 0.4.7's fix to headless mode - -## 0.4.7 - -- bug fixes - - regression causing widgets with `preArgs` to not receive osc correctly - -## 0.4.6 - -- engine - - electron 0.37.6 - - node-osc 2.0.3 -- features - - `compact` option added to knob and fader - - if an osc input port is specified, osc messages will be sent from it. This enhances compatibility with apps that send their feedback messages directly to the sender. -- misc - - mouse/touch dragging handler rewritten, now using event delegation and direct handler calls instead of DOM event bubbling whenever it's possible - -## 0.4.5 - -- engine - - electron 0.37.3 -- ui - - new logo - - better lobby design -- misc - - renamed sliders/pads' `absolute` property to `snap` - -## 0.4.4 - -- bug fixes - - [headless] scripts are no longer bundled on the fly, it didn't work on some systems - - touching widgets without changing their value doesn't make them send the same value again anymore -- ui - - slightly tightened layout -- features - - `noPip` option added to knob and fader - - `preArgs` accepts object if the arg's type needs to be specified - - knob supports breakpoints scale, same as fader's - - fader and knob pip scales now support custom label - - a push/toggle's value can be set to `null` if only the path needs to be sent in the osc messages - - push buttons do not update their own leds and return their value (for state save and widgets sync) based on their last changed property (led state or touch on/off) -- misc - - refining the fader's pip scale that looked choppy on mobile devices. All pips are now evenly spaced, not relatively to the fader's height. - - [desktop mode] saved sessions are added to history - -## 0.4.3 - -- features - - text widget can be `vertical` - - panel widget `scroll` option -- bug fixes - - smart pasting now works when the clipboard contains several widgets whose unsuffixed ids are the identical - - osc received array that contain only one item are correctly unpacked (fixes cross-app sync for widgets that don't accept array, broken since the introduction of `preArgs`) - - memory leak when loading a new session (cached tabs were not properly purged) -- misc - - push widget doesn't fire its 'on' value if pressed while stuck in 'on' position - - panel widgets don't have inner margins anymore - - fader widget optimization : the pip scale is generated from a single gradient plus some elements for each breakpoint (instead of one element per percent), thus reducing the number of elements to draw. - -## 0.4.2 - -- features - - new widget : text (just displays received values) -- bug fixes - - widget linking doesn't cause multiple unwanted osc sends anymore - -## 0.4.1 - -- features - - `preArgs` option for widgets (prepends constants to osc messages args) - -## 0.4.0 - -- engine - - electron 0.37.2 (chrome 49) -- ui - - new flat ui - - tab system rewritten : inactive tabs are detached from the DOM tree, thus improving performances while slowing down tab switching. - - widget categories in editor's context menu -- features - - logarithmic scaling (log10) support added to knob, fader & xy - - mousewheel support added to knob and fader (ctrlKey for fine control) - - new widgets : plot, visualizer & meter. Fader built-in feedback meter option - - traversing gestures switch in sidepanel - - custom color property for all widgets with inheritance (containers) - - editor pasting function now smartly increments widget's id and path while keeping label if different from default - - true theming support -- misc - - sync/link event handling improved - - stylesheets cannot be recompiled on the fly anymore (`--c` switch removed) - - **new state save file format, no backward compatibility** - -## 0.3.1 - -- electron updated to 0.36.11 -- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID` (resets id, label, linkId, and path) -- minor style updates - -## 0.3.0 - -- 3 new widgets - - multifader - - multitoggle - - multipush - - -## 0.2.1 - -- style update (push/toggle widgets, widgets' dragging handle) -- widget dragging/resizing doesn't get broken when editing the root -- sidepanel toggle doesn't select root for edition anymore - -## 0.2.0 - -- editor code rewriting - - right-click context-menu quick editing (widget copy/cut/paste, add & delete tabs/widgets) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 921666c8..00000000 --- a/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM node:24-alpine - -RUN apk --no-cache add git - -WORKDIR /usr/src/app - -COPY package*.json ./ - -RUN npm install - -COPY . . - -RUN npm run build - -RUN mkdir /sessions -RUN touch /sessions/session.json - -EXPOSE 8080 - -ENV ELECTRON_RUN_AS_NODE=1 - -ENV SEND="127.0.0.1:8080" -ENV LOAD="/sessions/main.json" -ENV PORT=8080 -ENV OSC_PORT=8080 -ENV READ_ONLY=false - -RUN chmod +x entrypoint.sh -ENTRYPOINT ["./entrypoint.sh"] diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..90e85874 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node app/ -n -p $PORT --remote-saving 127.0.0.1 $OPTIONS diff --git a/README.md b/README.md index 89da9bd5..8526b913 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,10 @@ -Open Stage Control - -Open Stage Control +Open Stage Control *Libre and modular OSC / MIDI controller* - -- Website: https://openstagecontrol.ammd.net/ -- Forum: https://openstagecontrol.discourse.group/ -- IRC: Libera.chat #openstagecontrol +https://openstagecontrol.ammd.net/ ---- -Docker additions by Rik Berkelder. - -mount `/sessions` directory. default session file is created and loaded there. - ---- - -Copyleft © Jean-Emmanuel Doucet 2014-2025. -This program is a free software released under the [GNU/GPL3](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE) license. +Copyleft © Jean-Emmanuel Doucet @ [AMMD](http://ammd.net) 2014-2020. +This program is a free software released under the [GNU/GPL3](ttps://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE) license. diff --git a/app/assets/fonts/fa-solid-900.woff b/app/assets/fonts/fa-solid-900.woff new file mode 100644 index 00000000..86d9b32b Binary files /dev/null and b/app/assets/fonts/fa-solid-900.woff differ diff --git a/app/assets/fonts/fa-solid.css b/app/assets/fonts/fa-solid.css new file mode 100644 index 00000000..28d2889f --- /dev/null +++ b/app/assets/fonts/fa-solid.css @@ -0,0 +1,14 @@ +/*! + * Font Awesome Free 5.0.8 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face { + font-family: FontAwesome; + font-style: normal; + font-weight: 900; + src: url("./fa-solid-900.woff") format("woff")} + +.fa, +.fas { + font-family: FontAwesome; + font-weight: 900; } diff --git a/app/assets/fonts/fontawesome.min.css b/app/assets/fonts/fontawesome.min.css new file mode 100644 index 00000000..13a472a0 --- /dev/null +++ b/app/assets/fonts/fontawesome.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-balance-scale:before{content:"\f24e"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-wizard:before{content:"\f6e8"}.fa-haykal:before{content:"\f666"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-nintendo-switch:before{content:"\f418"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-volume:before{content:"\f2a0"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto} \ No newline at end of file diff --git a/app/assets/fonts/roboto-medium.css b/app/assets/fonts/roboto-medium.css new file mode 100644 index 00000000..bd223e5b --- /dev/null +++ b/app/assets/fonts/roboto-medium.css @@ -0,0 +1,13 @@ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + src: url('roboto-medium.woff') format('woff'); +} + +@font-face { + font-family: 'RobotoMono'; + font-style: normal; + font-weight: 500; + src: url('roboto-mono.woff') format('woff'); +} diff --git a/app/assets/fonts/roboto-medium.woff b/app/assets/fonts/roboto-medium.woff new file mode 100644 index 00000000..ced7907e Binary files /dev/null and b/app/assets/fonts/roboto-medium.woff differ diff --git a/resources/fonts/roboto-mono.woff b/app/assets/fonts/roboto-mono.woff similarity index 100% rename from resources/fonts/roboto-mono.woff rename to app/assets/fonts/roboto-mono.woff diff --git a/app/assets/themes/.gitignore b/app/assets/themes/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/app/assets/themes/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/app/client/index.html b/app/client/index.html new file mode 100644 index 00000000..4799c8ba --- /dev/null +++ b/app/client/index.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + diff --git a/app/examples/ardour.json b/app/examples/ardour.json new file mode 100644 index 00000000..ae064466 --- /dev/null +++ b/app/examples/ardour.json @@ -0,0 +1,3787 @@ +{ + "type": "root", + "tabs": [ + { + "type": "tab", + "id": "settings_tab", + "linkId": "", + "label": "Settings", + "color": "auto", + "css": "", + "default": "", + "value": "", + "precision": 0, + "address": "/tab_1", + "preArgs": [], + "target": [], + "bypass": false, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "widgets": [ + { + "type": "strip", + "id": "greeter", + "linkId": "", + "height": 40, + "label": false, + "color": "auto", + "css": "", + "scroll": true, + "border": true, + "spacing": 0, + "address": "/panel_1", + "preArgs": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "svg", + "id": "logo", + "linkId": "", + "label": false, + "css": "--color-track:transparent", + "svg": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", + "preArgs": [], + "address": "/svg_1", + "width": 50, + "default": "", + "value": "", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "text", + "id": "greeter_text", + "linkId": "", + "label": false, + "color": "auto", + "css": "flex:1", + "vertical": false, + "wrap": false, + "align": "", + "default": "", + "value": "Ardour Control", + "preArgs": [], + "address": "/text_4", + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "image", + "id": "osc_logo", + "linkId": "", + "width": 50, + "label": false, + "css": "", + "default": "", + "value": "/assets/favicon.png", + "address": "/fader_13", + "preArgs": [], + "size": "60%", + "position": "center", + "repeat": "no-repeat", + "border": true, + "cache": true, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "horizontal": true, + "stretch": false, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "strip_types_select", + "label": "strip types", + "height": 80, + "color": "auto", + "css": "", + "widgets": [ + { + "type": "toggle", + "id": "strip_type_1", + "linkId": "", + "label": "Audio", + "color": "auto", + "css": "", + "on": 1, + "off": 0, + "value": 1, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_1", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_2", + "label": "Midi", + "color": "auto", + "css": "", + "on": 2, + "off": 0, + "value": 2, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_2", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_3", + "label": "AudioBus", + "color": "auto", + "css": "", + "on": 4, + "off": 0, + "value": 4, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_3", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_4", + "label": "MidiBus", + "color": "auto", + "css": "", + "on": 8, + "off": 0, + "value": 8, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_4", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_5", + "label": "VCA", + "color": "auto", + "css": "", + "on": 16, + "off": 0, + "value": 16, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_5", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_6", + "label": "Master", + "color": "auto", + "css": "", + "on": 32, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_6", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_7", + "label": "Monitor", + "color": "auto", + "css": "", + "on": 64, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_7", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_8", + "label": "Aux", + "color": "auto", + "css": "", + "on": 128, + "off": 0, + "value": 128, + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_8", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_9", + "label": "Selected", + "color": "auto", + "on": 256, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_9", + "linkId": "", + "css": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "strip_type_10", + "label": "Hidden", + "color": "auto", + "css": "", + "on": 512, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [ + null + ], + "address": "/strip_type_10", + "linkId": "", + "led": false, + "doubleTap": false, + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "input", + "id": "trip_type_bitsum", + "linkId": "", + "label": "bits", + "color": "auto", + "css": ".label{height:25rem}", + "precision": 0, + "address": "/set_surface/strip_types", + "preArgs": [], + "target": [], + "unit": "", + "vertical": false, + "editable": false, + "value": "#{\n@{strip_type_1} + \n@{strip_type_2} + \n@{strip_type_3} + \n@{strip_type_4} + \n@{strip_type_5} + \n@{strip_type_6} + \n@{strip_type_7} + \n@{strip_type_8} + \n@{strip_type_9} + \n@{strip_type_10}\n}", + "align": "", + "default": "", + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "horizontal": true, + "stretch": true, + "spacing": 0, + "variables": {}, + "border": true, + "scroll": true, + "address": "/strip_types_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "widgets": [ + { + "type": "switch", + "id": "bank_size", + "linkId": "", + "label": "Bank size", + "height": 80, + "color": "auto", + "css": "", + "horizontal": true, + "address": "/set_surface/bank_size", + "default": 6, + "value": "", + "precision": 0, + "preArgs": [], + "target": [], + "bypass": false, + "showValues": false, + "values": [ + 6, + 8, + 10, + 12 + ], + "left": "auto", + "top": "auto", + "width": "auto", + "traversing": true + } + ], + "label": false, + "id": "bank_size_wrapper", + "linkId": "", + "height": 80, + "color": "auto", + "css": "", + "scroll": true, + "horizontal": false, + "stretch": false, + "border": true, + "spacing": 0, + "variables": "@{parent.variables}", + "preArgs": [], + "address": "/bank_size_wrapper", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "display_layout", + "linkId": "", + "height": 80, + "label": "Layout options", + "color": "auto", + "css": "", + "scroll": true, + "border": true, + "spacing": 0, + "address": "/panel_13", + "preArgs": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "display_session_name", + "linkId": "", + "label": "Session name", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_session_name", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_transport", + "linkId": "", + "label": "Transport", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_transport", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_monitor", + "linkId": "", + "label": "Monitor", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_monitor", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "horizontal": true, + "stretch": true, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "display_strip", + "linkId": "", + "height": 80, + "label": "Strip options", + "color": "auto", + "css": "", + "scroll": true, + "border": true, + "spacing": 0, + "address": "/panel_13", + "preArgs": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "display_trim", + "linkId": "", + "label": "Trim", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_trim", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_recbar", + "linkId": "", + "label": "Rec / Mic / Disk", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_recbar", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": 100, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_input", + "linkId": "", + "label": "Gain Input", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_pan", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_pan", + "linkId": "", + "label": "Pan", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_pan", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_expand", + "linkId": "", + "label": "Sel²", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_expand", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_compact_faders", + "linkId": "", + "label": "Compact", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": "", + "value": "", + "precision": 2, + "address": "/display_compact_faders", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "horizontal": true, + "stretch": true, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "display_selected", + "linkId": "", + "height": 80, + "label": "Select options", + "color": "auto", + "css": "", + "scroll": true, + "border": true, + "spacing": 0, + "address": "/panel_13", + "preArgs": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "display_polarity_sel", + "linkId": "", + "label": "Polarity", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_polarity_sel", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_trim_sel", + "linkId": "", + "label": "Trim", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_trim_sel", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_recbar_sel", + "linkId": "", + "label": "Rec / Mic / Disk", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_recbar_sel", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "display_pan_sel", + "linkId": "", + "label": "Pan", + "color": "auto", + "css": "", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": 1, + "value": "", + "precision": 2, + "address": "/display_pan_sel", + "preArgs": [], + "target": [ + null + ], + "bypass": false, + "width": "auto", + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "horizontal": true, + "stretch": true, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "panel", + "id": "spacer", + "linkId": "", + "height": "auto", + "label": false, + "color": "auto", + "css": "flex:1", + "scroll": true, + "border": true, + "default": "", + "value": "", + "precision": 0, + "address": "/panel_2", + "preArgs": [], + "target": [], + "bypass": false, + "variables": "@{parent.variables}", + "widgets": [], + "tabs": [], + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "push", + "id": "connect", + "label": "Connect", + "css": "", + "on": null, + "off": 0, + "precision": 0, + "target": [], + "color": "auto", + "preArgs": "#{\nf = 1 + 2 + 16 + 128 + 8192 + 16384;\n@{display_transport}==1?f=f+64:\"\";\n}\n\n[\n @{bank_size},\n @{trip_type_bitsum},\n #{f},\n 0,\n 0,\n 1\n]", + "norelease": true, + "address": "/set_surface", + "linkId": "", + "bypass": false, + "height": 70, + "left": "auto", + "top": "auto", + "width": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "panel", + "id": "hidden_utils", + "linkId": "", + "height": "auto", + "label": false, + "color": "auto", + "css": "display:none;", + "default": "", + "value": "", + "precision": 2, + "address": "/fader_13", + "preArgs": [], + "target": [], + "bypass": false, + "scroll": true, + "border": true, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "text", + "id": "loading", + "linkId": "", + "left": "auto", + "top": "auto", + "width": "auto", + "height": "auto", + "label": false, + "color": "transparent", + "css": "*{background:transparent}", + "default": "", + "value": "
", + "address": "/fader_14", + "preArgs": [], + "vertical": false, + "wrap": false, + "align": "" + } + ], + "tabs": [], + "left": "auto", + "top": "auto", + "width": "auto" + } + ], + "label": false, + "top": 0, + "left": "auto", + "id": "strip_2", + "linkId": "", + "width": "100%", + "height": "100%", + "color": "auto", + "css": "", + "scroll": true, + "horizontal": false, + "stretch": false, + "border": true, + "spacing": 0, + "variables": "@{parent.variables}", + "preArgs": [], + "address": "/strip_2", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "tabs": [] + } + ], + "tabs": [], + "scroll": true + }, + { + "label": "mixer", + "widgets": [ + { + "type": "strip", + "top": 0, + "left": 0, + "id": "mixer_main", + "label": false, + "width": "100%", + "height": "100%", + "scroll": true, + "color": "auto", + "css": "", + "spacing": 0, + "variables": {}, + "widgets": [ + { + "type": "text", + "id": "sess_name", + "label": false, + "height": 40, + "vertical": false, + "css": "#{\n@{display_session_name}==0?\"display:none\":\"\"\n}", + "preArgs": [], + "value": " ", + "address": "/session_name", + "color": "auto", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "transport", + "label": false, + "height": 40, + "color": "auto", + "widgets": [ + { + "type": "fader", + "id": "shttl", + "label": false, + "alignRight": false, + "horizontal": true, + "compact": true, + "color": "auto", + "snap": false, + "spring": true, + "range": { + "min": -8, + "max": 8 + }, + "origin": 0, + "value": "", + "logScale": false, + "precision": 2, + "meter": false, + "address": "/set_transport_speed", + "preArgs": [], + "target": [], + "touchAddress": "", + "meterAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": false, + "unit": "", + "width": 114, + "css": "", + "linkId": "", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + }, + { + "type": "push", + "id": "zero", + "linkId": "", + "label": "^step-backward", + "css": "margin: 3rem 2rem", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "color": "auto", + "norelease": true, + "address": "/goto_start", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "push", + "id": "end", + "linkId": "", + "label": "^step-forward", + "css": "margin: 3rem 2rem", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "color": "auto", + "norelease": true, + "address": "/goto_end", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "push", + "id": "play", + "linkId": "", + "label": "^play", + "color": "lime", + "css": "margin: 3rem 2rem", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": true, + "address": "/transport_play", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "push", + "id": "transport_stop", + "linkId": "", + "label": "^stop", + "color": "red", + "css": "margin: 3rem 2rem", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": true, + "address": "/transport_stop", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "push", + "id": "masterrec", + "linkId": "", + "label": "^circle", + "color": "red", + "css": "margin: 3rem 2rem", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": true, + "address": "/rec_enable_toggle", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "text", + "id": "time", + "label": false, + "vertical": false, + "css": "font-size:120%; flex:4", + "preArgs": [], + "value": "00:00:00:00", + "address": "/position/smpte", + "width": 100, + "color": "auto", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "variables": {}, + "border": false, + "css": "#{\n@{display_transport}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "spacing": 4, + "scroll": false, + "address": "/transport", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "widgets": [ + { + "type": "strip", + "id": "strip_scroll_panel", + "label": false, + "color": "auto", + "spacing": 0, + "variables": { + "n": 1 + }, + "widgets": [ + { + "type": "strip", + "id": "channel_strip", + "label": false, + "css": "", + "widgets": [ + { + "type": "text", + "id": "chan_@{parent.variables.n}", + "label": false, + "height": 40, + "css": "", + "preArgs": [ + "@{parent.variables.n}" + ], + "vertical": false, + "address": "/strip/name", + "value": "@{parent.variables.n}", + "color": "auto", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "trim_@{parent.variables.n}", + "label": false, + "height": 60, + "color": "auto", + "css": "#{\n@{display_trim}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "id": "trim_meta_@{parent.variables.n}", + "label": false, + "width": 50, + "color": "auto", + "horizontal": false, + "stretch": true, + "border": false, + "spacing": 0, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "text", + "id": "trim_label_@{parent.variables.n}", + "label": false, + "color": "auto", + "value": "Trim", + "preArgs": [], + "address": "/trim_label_@{parent.variables.n}", + "vertical": false, + "css": "", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "input", + "id": "trim_input_@{parent.variables.n}", + "label": false, + "color": "auto", + "preArgs": [], + "linkId": "trim_knob_@{parent.variables.n}", + "unit": "", + "editable": true, + "precision": 1, + "target": [], + "value": "", + "address": "/trim_input_@{parent.variables.n}", + "css": "", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + } + ], + "scroll": true, + "css": "", + "address": "/trim_meta_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "knob", + "id": "trim_knob_@{parent.variables.n}", + "linkId": "trim_knob_@{parent.variables.n}", + "label": false, + "unit": "", + "range": { + "min": -20, + "max": 20 + }, + "logScale": false, + "precision": 2, + "target": [], + "preArgs": [ + "@{parent.variables.n}" + ], + "snap": false, + "origin": 0, + "spring": false, + "value": "", + "address": "/strip/trimdB", + "touchAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": false, + "css": "", + "color": "auto", + "angle": 270, + "width": "auto", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "scroll": true, + "address": "/trim_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "rec_buttons_@{parent.variables.n}", + "label": false, + "height": 40, + "color": "auto", + "css": "#{\n@{display_recbar}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "record_@{parent.variables.n}", + "linkId": "", + "label": "^circle", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "red", + "preArgs": [ + "@{parent.variables.n}" + ], + "value": "", + "address": "/strip/recenable", + "led": false, + "css": "", + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "mon_@{parent.variables.n}", + "linkId": "", + "label": "^microphone", + "precision": 0, + "target": [], + "color": "orange", + "preArgs": [ + "@{parent.variables.n}" + ], + "off": 0, + "on": 1, + "value": "", + "address": "/strip/monitor_input", + "led": false, + "css": "", + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "disk_@{parent.variables.n}", + "linkId": "", + "label": "^hdd", + "css": "", + "on": 1, + "off": 0, + "precision": 0, + "target": [], + "color": "orange", + "preArgs": [ + "@{parent.variables.n}" + ], + "value": "", + "address": "/strip/monitor_disk", + "led": false, + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/top_buttons_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "fader_strip_@{parent.variables.n}", + "label": false, + "color": "auto", + "css": "flex:1;", + "spacing": 3, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "meter", + "id": "meter_@{parent.variables.n}", + "label": false, + "unit": "", + "alignRight": false, + "horizontal": false, + "pips": false, + "dashed": true, + "color": "auto", + "range": { + "min": { + "inf": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "origin": "auto", + "value": "", + "address": "/strip/meter", + "preArgs": [ + "@{parent.variables.n}" + ], + "css": "#{\n@{display_compact_faders} ? \n\"\" : \"margin: 20rem 0 20rem 20rem\"\n}", + "width": 10, + "linkId": "", + "default": "", + "left": "auto", + "top": "auto", + "height": "auto", + "gradient": [], + "compact": true, + "input": false + }, + { + "type": "fader", + "id": "fader_@{parent.variables.n}", + "linkId": "fader_@{parent.variables.n}", + "label": false, + "unit": "dB", + "horizontal": false, + "css": "flex:1", + "range": { + "min": { + "-∞": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "color": "auto", + "preArgs": [ + "@{parent.variables.n}" + ], + "snap": false, + "compact": "#{@{display_compact_faders}}", + "alignRight": "#{@{display_compact_faders}}", + "origin": "auto", + "spring": false, + "value": "", + "address": "/strip/gain", + "touchAddress": "", + "meterAddress": "/strip/meter", + "pips": true, + "input": false, + "dashed": false, + "doubleTap": false, + "width": 80, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "height": "auto", + "border": false, + "horizontal": true, + "stretch": false, + "scroll": false, + "address": "/fader_strip_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "input", + "id": "fader_input_@{parent.variables.n}", + "linkId": "fader_@{parent.variables.n}", + "label": false, + "unit": "dB", + "height": 30, + "color": "auto", + "css": "margin:3rem 3rem 0;\n#{\n@{display_input}==0?\"display:none\":\"\"\n}", + "editable": true, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "address": "/fader_input_@{parent.variables.n}", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "fader", + "id": "pan_@{parent.variables.n}", + "linkId": "", + "label": false, + "unit": "", + "height": 30, + "horizontal": true, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "preArgs": [ + "@{parent.variables.n}" + ], + "snap": false, + "compact": true, + "alignRight": false, + "origin": 0.5, + "spring": false, + "value": "", + "address": "/strip/pan_stereo_position", + "touchAddress": "", + "meterAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": true, + "color": "auto", + "css": "margin:3rem;\n#{\n@{display_pan}==0?\"display:none\":\"\"\n}", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "steps": "" + }, + { + "type": "strip", + "id": "mute_buttons_@{parent.variables.n}", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "mute_@{parent.variables.n}", + "linkId": "", + "label": "Mute", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "yellow", + "preArgs": [ + "@{parent.variables.n}" + ], + "value": "", + "address": "/strip/mute", + "led": false, + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "solo_@{parent.variables.n}", + "linkId": "", + "label": "Solo", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "lime", + "preArgs": [ + "@{parent.variables.n}" + ], + "value": "", + "address": "/strip/solo", + "led": false, + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/bottom_buttons_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "sel_buttons_@{parent.variables.n}", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": true, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "push", + "id": "sel_@{parent.variables.n}", + "linkId": "", + "label": "#{\n@{display_expand}==0?\n\"Select\":\"Sel\"\n}", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "white", + "preArgs": [ + "@{parent.variables.n}" + ], + "norelease": false, + "address": "/strip/select", + "width": "auto", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "toggle", + "id": "expand_@{parent.variables.n}", + "linkId": "", + "label": "Sel²", + "css": "#{\n@{display_expand}==0?\"display:none\":\"\"\n}", + "on": 1, + "off": 0, + "precision": 0, + "target": [], + "color": "pink", + "preArgs": [ + "@{parent.variables.n}" + ], + "value": "", + "address": "/strip/expand", + "led": false, + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/bottom_buttons_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "color": "auto", + "spacing": 0, + "border": false, + "horizontal": false, + "stretch": false, + "scroll": true, + "variables": { + "n": 1 + }, + "address": "/channel_strip", + "preArgs": [], + "linkId": "", + "width": 120, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "clone", + "id": "clone_2", + "widgetId": "channel_strip", + "css": "", + "props": { + "variables": { + "n": 2 + }, + "id": "channel_strip_2" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_3", + "widgetId": "channel_strip", + "css": "", + "props": { + "variables": { + "n": 3 + }, + "id": "channel_strip_3" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_4", + "widgetId": "channel_strip", + "css": "", + "props": { + "variables": { + "n": 4 + }, + "id": "channel_strip_4" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_5", + "widgetId": "channel_strip", + "css": "", + "props": { + "variables": { + "n": 5 + }, + "id": "channel_strip_5" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_6", + "widgetId": "channel_strip", + "css": "", + "props": { + "variables": { + "n": 6 + }, + "id": "channel_strip_6" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_7", + "widgetId": "#{\n@{bank_size}>6?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<8?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 7 + }, + "id": "channel_strip_7" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_8", + "widgetId": "#{\n@{bank_size}>6?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<8?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 8 + }, + "id": "channel_strip_8" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_9", + "widgetId": "#{\n@{bank_size}>8?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<10?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 9 + }, + "id": "channel_strip_9" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_10", + "widgetId": "#{\n@{bank_size}>8?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<10?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 10 + }, + "id": "channel_strip_10" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_11", + "widgetId": "#{\n@{bank_size}>10?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<12?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 11 + }, + "id": "channel_strip_11" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "clone_12", + "widgetId": "#{\n@{bank_size}>10?\n\"channel_strip\" : \"\"\n}", + "css": "#{\n@{bank_size}<12?\n\"display:none\" : \"\"\n}", + "props": { + "variables": { + "n": 12 + }, + "id": "channel_strip_12" + }, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + } + ], + "css": "flex:1;\nmargin-right:1px;", + "border": true, + "scroll": true, + "address": "/strip_scroll_panel", + "preArgs": [], + "linkId": "", + "width": "auto", + "horizontal": true, + "stretch": false, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "ch_master", + "label": false, + "css": "", + "widgets": [ + { + "type": "text", + "id": "master_label", + "label": false, + "height": 40, + "css": "", + "vertical": false, + "value": "Master", + "address": "/master_label", + "color": "auto", + "preArgs": [], + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "master_trim_strip", + "label": false, + "height": 60, + "color": "auto", + "css": "#{\n@{display_trim}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "id": "trim_meta_@{parent.variables.n}", + "label": false, + "width": 50, + "color": "auto", + "horizontal": false, + "stretch": true, + "border": false, + "spacing": 0, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "text", + "id": "mastertrim_label", + "label": false, + "color": "auto", + "css": "line-height:12rem", + "value": "Trim", + "preArgs": [], + "address": "/mastertrim_label", + "vertical": false, + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "input", + "id": "mastertrim_input", + "label": false, + "color": "auto", + "preArgs": [], + "linkId": "mastertrim", + "unit": "", + "editable": true, + "precision": 1, + "target": [], + "value": "", + "address": "/mastertrim_input", + "css": "", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + } + ], + "scroll": true, + "css": "", + "address": "/trim_meta_@{parent.variables.n}", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "knob", + "id": "mastertrim", + "linkId": "mastertrim", + "label": false, + "unit": "", + "range": { + "min": -20, + "max": 20 + }, + "logScale": false, + "precision": 2, + "target": [], + "snap": false, + "origin": 0, + "spring": false, + "value": "", + "address": "/master/trimdB", + "touchAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": false, + "css": "", + "color": "auto", + "angle": 270, + "width": "auto", + "preArgs": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "scroll": true, + "address": "/master_trim_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "monitor_modal_strip", + "label": false, + "height": 40, + "color": "auto", + "css": "#{\n@{display_monitor}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": true, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "modal", + "id": "monitor_modal", + "label": "^headphones", + "width": "auto", + "color": "auto", + "css": "", + "doubleTap": false, + "popupWidth": "140rem", + "popupHeight": "80%", + "value": "", + "precision": 0, + "address": "/modal_1", + "preArgs": [], + "target": [ + null + ], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "id": "monitor_strip", + "label": false, + "height": "100%", + "color": "auto", + "css": "", + "horizontal": false, + "stretch": false, + "border": true, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "fader", + "id": "monitor", + "linkId": "", + "label": false, + "color": "auto", + "compact": false, + "css": "flex:1", + "snap": false, + "range": { + "min": { + "inf": -200 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 10 + }, + "logScale": false, + "precision": 2, + "preArgs": [], + "target": [], + "origin": "auto", + "spring": false, + "value": "", + "address": "/monitor/gain", + "touchAddress": "", + "alignRight": false, + "horizontal": false, + "meter": false, + "meterAddress": "", + "unit": "", + "pips": true, + "input": true, + "dashed": false, + "doubleTap": false, + "height": "auto", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "steps": "" + }, + { + "type": "strip", + "id": "monitor_buttons", + "label": false, + "color": "auto", + "css": "font-size:10rem", + "horizontal": true, + "stretch": false, + "border": false, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "monmute", + "linkId": "", + "label": "M", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "yellow", + "value": "", + "address": "/monitor/mute", + "led": false, + "css": "", + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "mondim", + "linkId": "", + "label": "Dim", + "precision": 0, + "target": [], + "color": "orange", + "off": 0, + "on": 1, + "value": "", + "address": "/monitor/dim", + "led": false, + "css": "", + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "monmono", + "linkId": "", + "label": "Mono", + "css": "", + "on": 1, + "off": 0, + "precision": 0, + "target": [], + "color": "cyan", + "value": "", + "address": "/monitor/mono", + "led": false, + "preArgs": [], + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "height": 50, + "spacing": 4, + "scroll": true, + "address": "/monitor_buttons", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "width": "100%", + "left": "auto", + "top": "auto", + "spacing": 0, + "scroll": true, + "address": "/monitor_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "tabs": [] + } + ], + "popupLabel": "Monitor", + "linkId": "", + "popupLeft": "auto", + "popupTop": "auto", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "scroll": true + } + ], + "scroll": true, + "address": "/monitor_modal_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "master_fader_strip", + "label": false, + "color": "auto", + "css": "flex:1", + "spacing": 3, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "meter", + "id": "Master_meter", + "label": false, + "unit": "", + "alignRight": false, + "horizontal": false, + "pips": false, + "dashed": true, + "color": "auto", + "range": { + "min": { + "inf": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "origin": "auto", + "value": "", + "address": "/master/meter", + "preArgs": [], + "css": "#{\n@{display_compact_faders} ? \n\"\" : \"margin: 20rem 0 20rem 20rem\"\n}", + "width": 10, + "linkId": "", + "default": "", + "left": "auto", + "top": "auto", + "height": "auto", + "gradient": [], + "compact": true, + "input": false + }, + { + "type": "fader", + "id": "Master", + "linkId": "Master", + "label": false, + "unit": "dB", + "horizontal": false, + "css": "flex:1", + "range": { + "min": { + "inf": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "color": "auto", + "snap": false, + "compact": "#{@{display_compact_faders}}", + "alignRight": "#{@{display_compact_faders}}", + "origin": "auto", + "spring": false, + "value": "", + "address": "/master/gain", + "touchAddress": "", + "pips": true, + "input": false, + "dashed": false, + "doubleTap": false, + "width": 80, + "preArgs": [], + "meterAddress": "", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "height": "auto", + "border": false, + "horizontal": true, + "stretch": false, + "scroll": false, + "address": "/master_fader_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "input", + "id": "master_input", + "linkId": "Master", + "label": false, + "unit": "dB", + "height": 30, + "color": "auto", + "css": "margin:3rem 3rem 0;\n#{\n@{display_input}==0?\"display:none\":\"\"\n}", + "editable": true, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "address": "/master_input", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "fader", + "id": "master_pan", + "linkId": "", + "label": false, + "unit": "", + "height": 30, + "horizontal": true, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "snap": false, + "compact": true, + "alignRight": false, + "origin": 0.5, + "spring": false, + "value": "", + "address": "/master/pan_stereo_position", + "touchAddress": "", + "meterAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": true, + "color": "auto", + "css": "margin:3rem;\n#{\n@{display_pan}==0?\"display:none\":\"\"\n}", + "preArgs": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "steps": "" + }, + { + "type": "strip", + "id": "master_mute_strip", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": true, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "mastermute", + "linkId": "", + "label": "Mute", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "yellow", + "value": "", + "address": "/master/mute", + "led": false, + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "push", + "id": "solocan", + "linkId": "", + "label": "Solo", + "color": "red", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": true, + "address": "/cancel_all_solos", + "css": ":host:not(.on) {\n opacity:0.75;\n}", + "width": 55, + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + } + ], + "scroll": true, + "address": "/master_mute_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "bank_strip", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": true, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "push", + "id": "bank_dn", + "linkId": "", + "label": "^angle-left", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": false, + "address": "/bank_down", + "css": ":host:not(.on) {opacity:0.75}", + "width": 50, + "color": "auto", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + }, + { + "type": "push", + "id": "bank_up", + "linkId": "", + "label": "^angle-right", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "norelease": false, + "address": "/bank_up", + "css": ":host:not(.on) {opacity:0.75}", + "width": 50, + "color": "auto", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "doubleTap": false, + "value": "" + } + ], + "scroll": true, + "address": "/monitor_modal_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "spacing": 0, + "border": false, + "horizontal": false, + "stretch": false, + "variables": "@{parent.variables}", + "scroll": false, + "color": "auto", + "address": "/ch_master", + "preArgs": [], + "linkId": "", + "width": 120, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + } + ], + "label": false, + "id": "strip_1", + "linkId": "", + "height": "auto", + "color": "auto", + "css": "flex:1", + "scroll": true, + "horizontal": true, + "stretch": false, + "border": true, + "spacing": 0, + "variables": "@{parent.variables}", + "preArgs": [], + "address": "/strip_1", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "address": "/mixer_main", + "preArgs": [], + "border": true, + "linkId": "", + "horizontal": false, + "stretch": false, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "tabs": [] + } + ], + "id": "mixer_tab", + "type": "tab", + "css": "", + "value": "", + "precision": 0, + "preArgs": [], + "target": [], + "variables": {}, + "tabs": [], + "color": "auto", + "address": "/mixer_tab", + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + }, + { + "type": "tab", + "id": "track_tab", + "label": "Track", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "top": 0, + "left": 0, + "id": "mixer_main", + "label": false, + "width": "100%", + "height": "100%", + "scroll": true, + "color": "auto", + "css": "", + "spacing": 0, + "variables": {}, + "widgets": [ + { + "type": "clone", + "id": "sess_name_clone", + "height": 40, + "css": "#{\n@{display_session_name}==0?\"display:none\":\"\"\n}", + "widgetId": "sess_name", + "props": {}, + "left": "auto", + "top": "auto", + "width": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "clone", + "id": "transport_clone", + "height": 40, + "css": "#{\n@{display_transport}==0?\"display:none\":\"\"\n}", + "widgetId": "transport", + "props": {}, + "left": "auto", + "top": "auto", + "width": "auto", + "label": "", + "variables": "@{parent.variables}" + }, + { + "type": "strip", + "id": "track_panel", + "label": false, + "color": "auto", + "spacing": 0, + "variables": {}, + "widgets": [ + { + "type": "strip", + "id": "select_chn", + "label": false, + "css": "", + "widgets": [ + { + "type": "text", + "id": "select_name", + "label": false, + "height": 40, + "css": "", + "vertical": false, + "address": "/select/name", + "value": " sel", + "preArgs": [], + "color": "auto", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "trim_select_strip", + "label": false, + "height": 60, + "color": "auto", + "css": "#{\n@{display_trim_sel}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "id": "trim_meta_select", + "label": false, + "width": 50, + "color": "auto", + "horizontal": false, + "stretch": true, + "border": false, + "spacing": 0, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "text", + "id": "select_trim_label", + "label": false, + "color": "auto", + "css": "", + "value": "Trim", + "preArgs": [], + "address": "/select_trim_label", + "vertical": false, + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "input", + "id": "select_trim_input", + "label": false, + "color": "auto", + "css": "", + "preArgs": [], + "linkId": "select_trim_knob", + "unit": "", + "editable": true, + "precision": 1, + "target": [], + "address": "/select_trim_input", + "value": "", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "height": "auto", + "left": "auto", + "top": "auto", + "width": "auto" + } + ], + "scroll": true, + "css": "", + "address": "/trim_meta_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "knob", + "id": "select_trim_knob", + "linkId": "select_trim_knob", + "label": false, + "unit": "", + "range": { + "min": -20, + "max": 20 + }, + "logScale": false, + "precision": 2, + "target": [], + "snap": false, + "origin": 0, + "spring": false, + "value": "", + "address": "/select/trimdB", + "touchAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": false, + "css": "", + "color": "auto", + "angle": 270, + "width": "auto", + "preArgs": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "scroll": true, + "address": "/trim_select_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "toggle", + "id": "polarity_select", + "linkId": "", + "height": 32, + "label": "∅", + "color": "auto", + "css": "margin:4rem;\nfont-weight:bold;\n#{\n@{display_polarity_sel}==0?\"display:none\":\"\"\n}", + "doubleTap": false, + "led": false, + "on": 1, + "off": 0, + "default": "", + "value": "", + "precision": 0, + "address": "/select/polarity", + "preArgs": [], + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "top_buttons_select", + "label": false, + "height": 40, + "color": "auto", + "css": "#{\n@{display_recbar_sel}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "record_select", + "linkId": "", + "label": "^circle", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "red", + "value": "", + "address": "/select/recenable", + "led": false, + "css": "", + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "mon_select", + "linkId": "", + "label": "^microphone", + "precision": 0, + "target": [], + "color": "orange", + "off": 0, + "on": 1, + "value": "", + "address": "/select/monitor_input", + "led": false, + "css": "", + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "disk_select", + "linkId": "", + "label": "^hdd", + "css": "", + "on": 1, + "off": 0, + "precision": 0, + "target": [], + "color": "orange", + "value": "", + "address": "/select/monitor_disk", + "led": false, + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/top_buttons_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "sends_receive_buttons_select", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": false, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "modal", + "id": "receives_panel", + "label": "Receives", + "color": "auto", + "css": "display:none", + "widgets": [], + "popupWidth": "75%", + "popupHeight": "75%", + "address": "/receives_panel", + "variables": {}, + "value": "", + "precision": 0, + "preArgs": [], + "target": [], + "doubleTap": false, + "height": "auto", + "popupLabel": "", + "linkId": "", + "popupLeft": "auto", + "popupTop": "auto", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "scroll": true + }, + { + "type": "modal", + "id": "sends_panel", + "label": "Sends", + "color": "auto", + "css": "", + "widgets": [], + "popupWidth": "75%", + "popupHeight": "75%", + "address": "/sends_panel", + "variables": {}, + "value": "", + "precision": 0, + "preArgs": [], + "target": [], + "doubleTap": false, + "height": "auto", + "popupLabel": "", + "linkId": "", + "popupLeft": "auto", + "popupTop": "auto", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "scroll": true + } + ], + "scroll": true, + "address": "/sends_receive_buttons_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "fader_select_strip", + "label": false, + "color": "auto", + "css": "flex:1", + "spacing": 3, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "meter", + "id": "meter_select", + "label": false, + "unit": "", + "alignRight": false, + "horizontal": false, + "pips": false, + "dashed": true, + "color": "auto", + "range": { + "min": { + "inf": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "origin": "auto", + "value": "", + "address": "/select/meter", + "css": "#{\n@{display_compact_faders} ? \n\"\" : \"margin: 20rem 0 20rem 20rem\"\n}", + "width": 10, + "preArgs": [], + "linkId": "", + "default": "", + "left": "auto", + "top": "auto", + "height": "auto", + "gradient": [], + "compact": true, + "input": false + }, + { + "type": "fader", + "id": "fader_select", + "linkId": "fader_select", + "label": false, + "unit": "dB", + "horizontal": false, + "css": "flex:1", + "range": { + "min": { + "inf": -193 + }, + "6%": -60, + "12%": -50, + "20%": -40, + "30%": -30, + "42%": -20, + "60%": -10, + "80%": 0, + "max": 6 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "color": "auto", + "snap": false, + "compact": "#{@{display_compact_faders}}", + "alignRight": "#{@{display_compact_faders}}", + "origin": "auto", + "spring": false, + "value": "", + "address": "/select/gain", + "touchAddress": "", + "pips": true, + "input": false, + "dashed": false, + "doubleTap": false, + "width": 80, + "meterAddress": "", + "preArgs": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "height": "auto", + "border": false, + "horizontal": true, + "stretch": false, + "scroll": false, + "address": "/fader_select_strip", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "input", + "id": "fader_input_select", + "linkId": "fader_select", + "label": false, + "unit": "dB", + "height": 30, + "color": "auto", + "css": "margin:3rem 3rem 0;\n#{\n@{display_input}==0?\"display:none\":\"\"\n}", + "editable": true, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "address": "/fader_input_select", + "vertical": false, + "align": "", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "fader", + "id": "pan_select", + "linkId": "", + "label": false, + "unit": "", + "height": 30, + "horizontal": true, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "precision": 2, + "meter": false, + "target": [], + "snap": false, + "compact": true, + "alignRight": false, + "origin": 0.5, + "spring": false, + "value": "", + "address": "/select/pan_stereo_position", + "touchAddress": "", + "meterAddress": "", + "pips": false, + "input": false, + "dashed": false, + "doubleTap": true, + "color": "auto", + "css": "margin:3rem;\n#{\n@{display_pan_sel}==0?\"display:none\":\"\"\n}", + "preArgs": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "steps": "" + }, + { + "type": "strip", + "id": "bottom_buttons_select", + "label": false, + "height": 40, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "mute_select", + "linkId": "", + "label": "Mute", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "yellow", + "value": "", + "address": "/select/mute", + "led": false, + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "solo_select", + "linkId": "", + "label": "Solo", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "target": [], + "color": "lime", + "value": "", + "address": "/select/solo", + "led": false, + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/bottom_buttons_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "bottom_buttons_select", + "label": false, + "height": 40, + "color": "auto", + "css": "#{\n@{display_expand}==0?\"display:none\":\"\"\n}", + "horizontal": true, + "stretch": true, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "expand_select", + "linkId": "", + "label": "Sel²", + "css": "", + "on": 1, + "off": 0, + "precision": 0, + "target": [], + "color": "pink", + "value": "", + "address": "/select/expand", + "led": false, + "width": "auto", + "preArgs": [], + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "scroll": true, + "address": "/bottom_buttons_select", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "color": "auto", + "spacing": 0, + "border": false, + "horizontal": false, + "stretch": false, + "variables": "@{parent.variables}", + "scroll": true, + "address": "/select_chn", + "preArgs": [], + "linkId": "", + "width": 120, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "plugins_panel_wrapper", + "label": false, + "scroll": true, + "color": "auto", + "css": "flex:1", + "spacing": 0, + "variables": {}, + "widgets": [ + { + "type": "text", + "label": false, + "height": 40, + "value": "Plugins", + "id": "text_1", + "color": "auto", + "css": "", + "vertical": false, + "preArgs": [], + "address": "/text_1", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "plugins_panel", + "linkId": "", + "label": false, + "height": "auto", + "color": "auto", + "css": "flex:1;margin:0rem", + "scroll": true, + "horizontal": false, + "stretch": false, + "border": false, + "spacing": 4, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "push", + "height": 60, + "label": "^sync-alt", + "address": "/refresh_plugin_list", + "norelease": true, + "id": "push_6", + "linkId": "", + "color": "auto", + "css": "", + "on": 1, + "off": 0, + "precision": 2, + "preArgs": [], + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "doubleTap": false, + "value": "" + } + ], + "preArgs": [], + "address": "/plugins_panel", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "address": "/plugins_panel", + "preArgs": [], + "border": false, + "linkId": "", + "horizontal": false, + "stretch": false, + "width": "auto", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "tabs": [] + }, + { + "type": "clone", + "id": "master_clone", + "css": "", + "widgetId": "ch_master", + "props": {}, + "width": 120, + "left": "auto", + "top": "auto", + "height": "auto", + "label": "", + "variables": "@{parent.variables}" + } + ], + "css": "flex:1", + "height": "auto", + "border": true, + "scroll": true, + "address": "/strip_scroll_panel", + "preArgs": [], + "linkId": "", + "horizontal": true, + "stretch": false, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "address": "/mixer_main", + "preArgs": [], + "border": true, + "linkId": "", + "horizontal": false, + "stretch": false, + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "tabs": [] + } + ], + "tabs": [], + "address": "/track_tab", + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + } + ], + "value": "", + "precision": 0, + "address": "/root", + "preArgs": [], + "target": [ + null + ], + "variables": {}, + "color": "auto", + "css": "", + "id": "root", + "linkId": "", + "default": "", + "bypass": false, + "traversing": false, + "scroll": true, + "label": false +} \ No newline at end of file diff --git a/app/examples/demo.json b/app/examples/demo.json new file mode 100644 index 00000000..0f5e3a8b --- /dev/null +++ b/app/examples/demo.json @@ -0,0 +1,959 @@ +{ + "type": "root", + "tabs": [ + { + "type": "tab", + "id": "tab_2", + "label": "Open Stage Control", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_2", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "strip", + "top": 10, + "left": 10, + "id": "strip_4", + "label": "Strips", + "width": 100, + "height": 450, + "color": "auto", + "css": "", + "horizontal": false, + "stretch": false, + "spacing": 5, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "text", + "id": "text_1", + "label": false, + "height": 30, + "vertical": false, + "color": "auto", + "css": "", + "value": 1, + "preArgs": [], + "address": "/text_1", + "linkId": "", + "wrap": false, + "align": "", + "default": "", + "left": "auto", + "top": "auto", + "width": "auto" + }, + { + "type": "strip", + "id": "strip_5", + "label": false, + "height": 30, + "color": "auto", + "horizontal": true, + "stretch": true, + "spacing": 5, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "toggle_1", + "linkId": "", + "label": false, + "led": false, + "color": "auto", + "css": "", + "on": 1, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "width": "auto", + "address": "/toggle_1", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "linkId": "", + "label": false, + "led": false, + "color": "auto", + "css": "", + "on": 1, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "width": "auto", + "id": "toggle_2", + "address": "/toggle_2", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "toggle_3", + "label": false, + "led": false, + "color": "auto", + "css": "", + "on": 1, + "off": 0, + "value": "", + "precision": 2, + "address": "/toggle_3", + "preArgs": [], + "target": [], + "linkId": "", + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "css": "", + "border": true, + "scroll": true, + "address": "/strip_5", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "strip_6", + "label": false, + "height": 50, + "color": "auto", + "css": "margin-bottom:-10rem", + "horizontal": true, + "stretch": true, + "spacing": 0, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "knob", + "id": "knob_1", + "linkId": "", + "label": false, + "unit": "", + "width": "auto", + "color": "auto", + "pips": false, + "input": false, + "dashed": false, + "angle": 270, + "css": "", + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "origin": "auto", + "value": "", + "logScale": false, + "precision": 2, + "touchAddress": "", + "preArgs": [], + "target": [], + "address": "/knob_1", + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + }, + { + "type": "knob", + "id": "knob_2", + "linkId": "", + "label": false, + "unit": "", + "width": "auto", + "color": "auto", + "pips": false, + "input": false, + "dashed": false, + "angle": 270, + "css": "", + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "origin": "auto", + "value": "", + "logScale": false, + "precision": 2, + "address": "/knob_2", + "touchAddress": "", + "preArgs": [], + "target": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "border": false, + "scroll": true, + "address": "/strip_6", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "strip", + "id": "strip_1", + "label": false, + "color": "auto", + "css": "flex:1", + "horizontal": true, + "stretch": false, + "spacing": 0, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "meter", + "id": "meter_1", + "label": false, + "unit": "", + "alignRight": false, + "horizontal": false, + "pips": false, + "dashed": true, + "color": "auto", + "css": "margin: 20rem 0 20rem 10rem;", + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "origin": "auto", + "value": "@{knob_1}", + "address": "/meter_1", + "preArgs": [], + "width": 10, + "linkId": "", + "gradient": [], + "default": "", + "left": "auto", + "top": "auto", + "height": "auto", + "compact": true, + "input": false + }, + { + "type": "meter", + "id": "meter_2", + "label": false, + "unit": "", + "alignRight": false, + "horizontal": false, + "pips": false, + "dashed": true, + "color": "auto", + "css": "margin: 20rem 0", + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "origin": "auto", + "value": "@{knob_2}", + "address": "/meter_1", + "preArgs": [], + "width": 10, + "linkId": "", + "gradient": [], + "default": "", + "left": "auto", + "top": "auto", + "height": "auto", + "compact": true, + "input": false + }, + { + "type": "fader", + "id": "fader_1", + "linkId": "", + "label": false, + "unit": "", + "width": "auto", + "alignRight": false, + "horizontal": false, + "pips": true, + "input": false, + "compact": false, + "dashed": false, + "color": "auto", + "css": "", + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "origin": "auto", + "value": "", + "logScale": false, + "precision": 2, + "meter": false, + "address": "/fader_1", + "touchAddress": "", + "meterAddress": "", + "preArgs": [], + "target": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto", + "steps": "" + } + ], + "height": "auto", + "border": false, + "scroll": true, + "address": "/strip_1", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + }, + { + "type": "fader", + "id": "fader_2", + "linkId": "", + "label": false, + "unit": "", + "height": 30, + "alignRight": false, + "horizontal": true, + "pips": false, + "input": false, + "compact": true, + "dashed": false, + "color": "auto", + "css": "", + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "origin": 0.5, + "value": 0.5, + "logScale": false, + "precision": 2, + "meter": false, + "address": "/fader_2", + "touchAddress": "", + "meterAddress": "", + "preArgs": [], + "target": [], + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "steps": "" + }, + { + "type": "strip", + "id": "strip_3", + "label": false, + "height": 30, + "color": "auto", + "css": "", + "horizontal": true, + "stretch": false, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "toggle", + "id": "toggle_4", + "linkId": "", + "label": "M", + "led": false, + "color": "yellow", + "css": "", + "on": 1, + "off": 0, + "value": "", + "precision": 2, + "preArgs": [], + "target": [], + "width": "auto", + "address": "/toggle_4", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + }, + { + "type": "toggle", + "id": "toggle_5", + "linkId": "", + "label": "S", + "led": false, + "color": "lime", + "css": "", + "on": 1, + "off": 0, + "value": "", + "precision": 2, + "address": "/toggle_5", + "preArgs": [], + "target": [], + "width": "auto", + "doubleTap": false, + "default": "", + "bypass": false, + "left": "auto", + "top": "auto", + "height": "auto" + } + ], + "spacing": 0, + "border": true, + "scroll": true, + "address": "/strip_3", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "left": "auto", + "top": "auto", + "width": "auto", + "tabs": [] + } + ], + "border": true, + "scroll": true, + "address": "/strip_4", + "preArgs": [], + "linkId": "", + "default": "", + "value": "", + "precision": 0, + "target": [], + "bypass": false, + "tabs": [] + }, + { + "type": "panel", + "top": 10, + "left": 120, + "id": "panel_1", + "label": "Pads", + "width": 350, + "height": 350, + "scroll": true, + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/panel_1", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [], + "tabs": [ + { + "type": "tab", + "id": "tab_3", + "label": "Xy", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_3", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "xy", + "top": 0, + "left": 0, + "id": "xy_1", + "linkId": "", + "label": false, + "width": "100%", + "height": "100%", + "input": true, + "pips": true, + "color": "auto", + "css": "", + "snap": false, + "spring": false, + "doubleTap": false, + "rangeX": { + "min": 0, + "25%": 0.25, + "50%": 0.5, + "75%": 0.75, + "max": 1 + }, + "rangeY": { + "min": 0, + "25%": 0.25, + "50%": 0.5, + "75%": 0.75, + "max": 1 + }, + "logScaleX": false, + "logScaleY": false, + "value": [ + 0.5, + 0.5 + ], + "precision": 2, + "address": "/xy_1", + "touchAddress": "", + "preArgs": [], + "split": false, + "target": [], + "pointSize": 20, + "default": "", + "bypass": false + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + }, + { + "type": "tab", + "id": "tab_5", + "label": "rgb", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_5", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "rgb", + "id": "rgb_1", + "linkId": "", + "label": false, + "left": 0, + "top": 0, + "width": "100%", + "height": "100%", + "input": true, + "css": "", + "snap": false, + "spring": false, + "value": "", + "precision": 0, + "address": "/rgb_1", + "preArgs": [], + "split": false, + "target": [], + "range": { + "min": 0, + "max": 255 + }, + "default": "", + "bypass": false, + "alpha": false, + "pointSize": 10 + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + }, + { + "type": "tab", + "id": "tab_4", + "label": "MultiXy", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_4", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "multixy", + "id": "xy_2", + "label": false, + "width": "100%", + "height": "100%", + "pips": true, + "color": "auto", + "css": "", + "snap": false, + "spring": false, + "rangeX": { + "min": 0, + "25%": 0.25, + "50%": 0.5, + "75%": 0.75, + "max": 1 + }, + "rangeY": { + "min": 0, + "25%": 0.25, + "50%": 0.5, + "75%": 0.75, + "max": 1 + }, + "logScaleX": false, + "logScaleY": false, + "value": [ + 0.25, + 0.5, + 0.75, + 0.5 + ], + "precision": 2, + "address": "/xy_2", + "touchAddress": "", + "preArgs": [], + "split": false, + "target": [], + "linkId": "", + "left": "auto", + "top": "auto", + "points": 2, + "pointSize": 20, + "default": "", + "bypass": false + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + } + ], + "border": true, + "linkId": "", + "default": "", + "bypass": false + }, + { + "type": "rgb", + "top": 10, + "left": 480, + "id": "color_picker", + "linkId": "", + "label": "Color", + "width": 130, + "height": 60, + "css": "/* Cool hack ::\nOnly display the hue slider.\nWe ensure the initial color \nby setting the default property \n*/\n.pad > :first-child{display:none;}\n.hue-wrapper{height:100%;}\n.hue-wrapper *{height:100%;}", + "precision": 0, + "value": "", + "address": "/dropdown_1", + "preArgs": [], + "target": [], + "default": [ + 86, + 168, + 255 + ], + "bypass": false, + "snap": false, + "spring": false, + "range": { + "min": 0, + "max": 255 + }, + "input": true, + "alpha": false, + "split": false, + "pointSize": 10 + }, + { + "type": "keyboard", + "top": 370, + "left": 120, + "id": "keyboard", + "keys": 36, + "start": 60, + "label": "auto", + "width": 350, + "height": 90, + "color": "auto", + "css": "", + "traversing": true, + "on": 1, + "off": 0, + "precision": 2, + "address": "/keyboard_1", + "preArgs": [], + "split": false, + "target": [], + "bypass": false, + "linkId": "" + }, + { + "type": "matrix", + "top": 80, + "left": 480, + "id": "multifader", + "label": "auto", + "width": 130, + "height": 380, + "color": "auto", + "css": "", + "value": "", + "precision": 2, + "address": "/multifader_1", + "preArgs": [], + "target": [], + "default": "", + "bypass": false, + "linkId": "", + "widgetType": "fader", + "matrix": [ + 1, + 12 + ], + "start": 0, + "spacing": 0, + "traversing": true, + "border": true, + "props": { + "compact": true, + "horizontal": true, + "label": false, + "pips": false, + "input": false + } + }, + { + "type": "matrix", + "top": 10, + "left": 620, + "id": "multipush", + "label": "auto", + "width": 130, + "height": 220, + "color": "auto", + "css": "", + "precision": 2, + "address": "/multipush", + "preArgs": [], + "target": [], + "bypass": false, + "linkId": "", + "default": "", + "value": "", + "widgetType": "push", + "matrix": [ + 2, + 4 + ], + "start": 0, + "spacing": 4, + "traversing": true, + "border": true, + "props": {} + }, + { + "type": "matrix", + "top": 240, + "left": 620, + "label": "auto", + "width": 130, + "height": 220, + "color": "auto", + "css": "", + "value": "", + "precision": 2, + "address": "/multitoggle", + "preArgs": [], + "target": [], + "id": "multitoggle", + "default": "", + "bypass": false, + "linkId": "", + "widgetType": "toggle", + "matrix": [ + 2, + 4 + ], + "start": 0, + "spacing": 4, + "traversing": true, + "border": true, + "props": {} + }, + { + "type": "plot", + "top": 470, + "left": 10, + "id": "plot_1", + "width": 240, + "height": 140, + "label": "Plot (multifader)", + "color": "auto", + "css": "", + "rangeX": { + "min": 0, + "max": 1 + }, + "rangeY": { + "min": 0, + "max": 1 + }, + "origin": "auto", + "logScaleX": false, + "logScaleY": false, + "pips": false, + "address": "/plot_1", + "preArgs": [], + "smooth": true, + "linkId": "", + "dots": true, + "bars": false, + "value": "@{multifader}", + "default": "" + }, + { + "type": "patchbay", + "top": 470, + "left": 480, + "id": "patchbay_1", + "linkId": "", + "width": 270, + "height": 140, + "label": "Patchbay", + "color": "auto", + "css": "", + "inputs": [ + "input_1", + "input_2" + ], + "outputs": [ + "output_1", + "output_2" + ], + "default": "", + "value": "", + "precision": 2, + "address": "/patchbay_1", + "preArgs": "", + "target": "", + "bypass": false + }, + { + "type": "visualizer", + "top": 470, + "left": 260, + "id": "visualizer_1", + "linkId": "", + "width": 210, + "height": 140, + "label": "Visualizer (fader)", + "color": "auto", + "css": "", + "origin": "auto", + "smooth": false, + "pips": false, + "default": "", + "value": "@{fader_1}", + "address": "/plot_2", + "preArgs": "", + "duration": 1, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + } + ], + "color": "JS{{\nreturn 'rgb(' + @{color_picker}.join(',') + ')'\n}}", + "css": "", + "value": "", + "precision": 0, + "address": "/root", + "preArgs": [], + "target": [], + "variables": {}, + "id": "root", + "linkId": "", + "default": "", + "bypass": false, + "traversing": false, + "scroll": true, + "label": false +} \ No newline at end of file diff --git a/app/examples/keys.json b/app/examples/keys.json new file mode 100644 index 00000000..093d27b5 --- /dev/null +++ b/app/examples/keys.json @@ -0,0 +1,168 @@ +{ + "type": "root", + "tabs": [ + { + "type": "tab", + "id": "tab_1", + "label": "auto", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_1", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "keys", + "top": 300, + "left": 0, + "id": "keys_1", + "width": "auto", + "height": "auto", + "label": "auto", + "color": "auto", + "css": "", + "binding": [ + "r", + "f" + ], + "keydown": "#{\nx = key == \"r\" ? 0.1 : -0.1;\n@{fader_1} + x\n}", + "repeat": true, + "keyup": "", + "linkId": ">> A", + "default": "", + "value": "", + "precision": 2, + "address": "/keys_1", + "preArgs": "", + "target": "", + "bypass": false + }, + { + "type": "fader", + "top": 0, + "left": 0, + "id": "fader_1", + "linkId": "<< A", + "width": "auto", + "height": "auto", + "label": "auto", + "color": "auto", + "css": "", + "horizontal": false, + "alignRight": false, + "pips": true, + "input": true, + "meter": false, + "compact": false, + "dashed": false, + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "unit": "", + "origin": "auto", + "value": "", + "precision": 2, + "address": "/fader_1", + "touchAddress": "", + "meterAddress": "", + "preArgs": [], + "target": [], + "default": "", + "bypass": false, + "steps": "" + }, + { + "type": "xy", + "top": 50, + "left": 170, + "id": "xy_1", + "linkId": "<< B", + "width": 210, + "height": 220, + "label": "auto", + "color": "auto", + "css": "", + "input": true, + "pips": true, + "pointSize": 20, + "snap": false, + "spring": false, + "doubleTap": false, + "rangeX": { + "min": 0, + "max": 1 + }, + "rangeY": { + "min": 0, + "max": 1 + }, + "logScaleX": false, + "logScaleY": false, + "value": "", + "precision": 2, + "address": "/xy_1", + "touchAddress": "", + "preArgs": [], + "split": false, + "target": [], + "default": "", + "bypass": false + }, + { + "type": "keys", + "top": 270, + "left": 170, + "id": "keys_2", + "width": 210, + "height": "auto", + "label": "auto", + "color": "auto", + "css": "", + "binding": [ + "g", + "t" + ], + "keydown": "#{\nx = key == \"t\" ? 0.1 : -0.1;\n@{xy_1}[0] + x\n@{xy_1}[1] + x\n}", + "keyup": "", + "repeat": false, + "linkId": ">> B", + "default": "", + "value": "", + "precision": 2, + "address": "/keys_2", + "preArgs": "", + "target": "", + "bypass": false + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + } + ], + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/root", + "preArgs": [], + "target": [], + "variables": {}, + "id": "root", + "linkId": "", + "default": "", + "bypass": false, + "traversing": false, + "scroll": true, + "label": false +} \ No newline at end of file diff --git a/app/examples/svg.json b/app/examples/svg.json new file mode 100644 index 00000000..23db1b0b --- /dev/null +++ b/app/examples/svg.json @@ -0,0 +1,88 @@ +{ + "type": "root", + "tabs": [ + { + "type": "tab", + "id": "tab_1", + "linkId": "", + "label": "Rgb Levels", + "color": "auto", + "css": "", + "default": "", + "value": "", + "precision": 0, + "address": "/tab_1", + "preArgs": [], + "target": [], + "bypass": false, + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "svg", + "top": 150, + "left": 0, + "id": "rgb_svg", + "linkId": "", + "width": "100%", + "height": 190, + "label": "auto", + "css": "path {\n fill:none;\n stroke-width:3rem\n}", + "svg": "#{\n\n# build the data array\n# [ [r,g,b], [r,g,b], [r,g,b], etc ]\ndata = @{rgb_matrix};\n\n# extract channels and convert to relative y-axis coordinates\n# assuming the y-range is 0-255\n# 96 - val * 94 for padding and y-axis reversal\n# we add a small offset to make sure the 3 lines are always visible\n\nred = 96 - flatten(data[0:end,0]) / 255 * 94 + 2;\ngreen = 96 - flatten(data[0:end,1]) / 255 * 94;\nblue = 96 - flatten(data[0:end,2]) / 255 * 94 - 2;\n\n# build the x-axis relative coordinates array\n\nlength = size(red)[0]\nxaxis = (0:length) / (length-1) * 100;\n\n\n# convert coords to svg path string\nsvgCoords(color) = map(color, f(c,i)=print(\"L$0%x $1%y\", [xaxis[i], c]));\n\n# svg path first command must be \"M\", not \"L\" \nsvgString(color) = concat(\"M\", unpack(svgCoords(color))[1:end]);\n\n}\n\n\n\n\n", + "preArgs": [], + "address": "/rgb_svg", + "default": "", + "value": "" + }, + { + "type": "matrix", + "top": 0, + "left": 0, + "id": "rgb_matrix", + "width": "100.60%", + "height": 150, + "label": "auto", + "color": "auto", + "css": "", + "widgetType": "rgb", + "matrix": [ + 8, + 1 + ], + "start": 0, + "spacing": 0, + "traversing": false, + "props": { + "input": false, + "label": false + }, + "default": "", + "value": "", + "precision": 2, + "address": "/matrix_1", + "preArgs": [], + "target": [], + "bypass": false, + "linkId": "", + "border": true + } + ], + "tabs": [], + "scroll": true + } + ], + "id": "root", + "linkId": "", + "color": "auto", + "css": "", + "default": "", + "value": "", + "precision": 0, + "address": "/root", + "preArgs": [], + "target": [], + "bypass": false, + "variables": {}, + "traversing": false, + "scroll": true, + "label": false +} \ No newline at end of file diff --git a/app/examples/sysex.json b/app/examples/sysex.json new file mode 100644 index 00000000..ee90c7cb --- /dev/null +++ b/app/examples/sysex.json @@ -0,0 +1,102 @@ +{ + "type": "root", + "tabs": [ + { + "type": "tab", + "id": "tab_1", + "label": "Sysex Example", + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/tab_1", + "preArgs": [], + "target": [], + "variables": "@{parent.variables}", + "widgets": [ + { + "type": "push", + "top": 10, + "left": 20, + "id": "push_1", + "linkId": "", + "width": 200, + "height": "auto", + "label": "Send Device Inquiry", + "color": "auto", + "css": "", + "on": "f0 7e 7f 06 01 f7", + "norelease": true, + "precision": 0, + "address": "/sysex", + "target": [ + "midi:osc" + ], + "preArgs": [], + "off": 0, + "doubleTap": false, + "value": "", + "bypass": false + }, + { + "type": "text", + "top": 80, + "left": 20, + "id": "text_1", + "width": 200, + "height": 60, + "label": "Device Inquiry Response", + "color": "auto", + "css": "", + "vertical": false, + "preArgs": [], + "address": "/sysex", + "value": "", + "linkId": "", + "wrap": false, + "align": "", + "default": "" + }, + { + "type": "text", + "top": 150, + "left": 20, + "id": "text_2", + "width": 200, + "height": 240, + "label": "^info-circle", + "color": "auto", + "css": "", + "preArgs": [], + "address": "/text_2", + "vertical": false, + "value": "", + "linkId": "", + "wrap": false, + "align": "", + "default": "" + } + ], + "tabs": [], + "linkId": "", + "default": "", + "bypass": false, + "scroll": true + } + ], + "color": "auto", + "css": "", + "value": "", + "precision": 0, + "address": "/root", + "preArgs": [], + "target": [], + "variables": {}, + "id": "root", + "linkId": "", + "default": "", + "bypass": false, + "traversing": false, + "scroll": true, + "label": false +} \ No newline at end of file diff --git a/app/index.js b/app/index.js new file mode 100644 index 00000000..cb716413 --- /dev/null +++ b/app/index.js @@ -0,0 +1 @@ +require('./server/open-stage-control-server') diff --git a/app/launcher/index.html b/app/launcher/index.html new file mode 100644 index 00000000..9ec8299a --- /dev/null +++ b/app/launcher/index.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + +
+ + + diff --git a/app/server/.keep b/app/server/.keep new file mode 100644 index 00000000..e69de29b diff --git a/basesession.json b/basesession.json deleted file mode 100644 index 9ddad0bb..00000000 --- a/basesession.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "createdWith": "Open Stage Control", - "version": "1.31.2", - "type": "session", - "content": { - "type": "root", - "lock": false, - "id": "root", - "visible": true, - "interaction": true, - "comments": "", - "width": "auto", - "height": "auto", - "colorText": "auto", - "colorWidget": "auto", - "alphaFillOn": "auto", - "borderRadius": "auto", - "padding": "auto", - "html": "", - "css": "", - "colorBg": "auto", - "layout": "default", - "justify": "start", - "gridTemplate": "", - "contain": true, - "scroll": true, - "innerPadding": true, - "tabsPosition": "top", - "hideMenu": false, - "variables": "@{parent.variables}", - "traversing": false, - "value": "", - "default": "", - "linkId": "", - "address": "auto", - "preArgs": "", - "typeTags": "", - "decimals": 2, - "target": "", - "ignoreDefaults": false, - "bypass": false, - "onCreate": "", - "onValue": "", - "onTouch": "", - "onPreload": "", - "widgets": [], - "tabs": [] - } -} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 314d2769..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - app: - build: . - volumes: - - ./sessions:/sessions - ports: - - 8080:8080 - \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index f4720cdf..00000000 --- a/entrypoint.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -test -f "$LOAD" || cp "basesession.json" "$LOAD" - -exec node app/index.js \ - --port $PORT \ - --osc-port $OSC_PORT \ - --send $SEND \ - --load $LOAD \ - --read-only=$READ_ONLY diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 3956e018..00000000 --- a/package-lock.json +++ /dev/null @@ -1,9718 +0,0 @@ -{ - "name": "open-stage-control", - "version": "1.31.2", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "open-stage-control", - "version": "1.31.2", - "hasInstallScript": true, - "license": "GPL-3.0", - "dependencies": { - "@babel/core": "7.18.0", - "@babel/preset-env": "7.18.0", - "@electron/packager": "18.4.4", - "@electron/remote": "2.1.3", - "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-commonjs": "^28.0.6", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^16.0.1", - "@rollup/plugin-terser": "^0.4.4", - "ace-builds": "1.39.0", - "ansi-html": "0.0.9", - "babelify": "10.0.0", - "balanced-match": "2.0.0", - "bonjour": "git+https://framagit.org/jean-emmanuel/bonjour.git", - "chokidar": "3.5.3", - "chroma-js": "2.4.2", - "core-js": "3.22.5", - "cpr": "3.0.1", - "deep-extend": "0.6.0", - "electron-localshortcut": "3.2.1", - "electron-packager-plugin-non-proprietary-codecs-ffmpeg": "1.0.2", - "env-paths": "2.2.1", - "eslint": "8.16.0", - "fastdom": "1.0.10", - "file-saver": "2.0.5", - "http-auth": "4.1.9", - "json5": "2.2.1", - "jsondiffpatch": "0.4.1", - "keyboardjs": "2.6.4", - "minimatch": "5.1.0", - "nanohtml": "1.10.0", - "nanoid": "3.3.4", - "nanomorph": "5.4.3", - "node-forge": "1.3.1", - "node-mouse": "0.0.2", - "nodemon": "2.0.16", - "nosleep.js": "0.12.0", - "open": "8.4.0", - "osc": "2.4.5", - "python-shell": "3.0.1", - "qrcode": "1.5.1", - "replacestream": "4.0.3", - "rollup": "4.50.1", - "rollup-plugin-copy": "3.5.0", - "rollup-plugin-license": "^3.6.0", - "rollup-plugin-node-externals": "^8.1.1", - "sass": "1.89.2", - "scope-css": "1.2.1", - "screenfull": "5.2.0", - "semver": "7.3.7", - "send": "0.18.0", - "sortablejs": "1.15.0", - "source-map-support": "0.5.21", - "stacktrace-js": "2.0.2", - "ua-parser-js": "2.0.7", - "ws": "8.6.0", - "yargs": "17.5.1" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "electron": "36.9.5", - "electron-installer-debian": "3.1.0", - "electron-installer-redhat": "git+https://framagit.org/jean-emmanuel/electron-installer-redhat.git" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.27.1", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", - "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.0.tgz", - "integrity": "sha512-Xyw74OlJwDijToNi0+6BBI5mLLR5+5R3bcSH80LXzjzEGEUlvNzujEE71BaD/ApEZHAvFI/Mlmp4M5lIkdeeWw==", - "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.18.0", - "@babel/helper-compilation-targets": "^7.17.10", - "@babel/helper-module-transforms": "^7.18.0", - "@babel/helpers": "^7.18.0", - "@babel/parser": "^7.18.0", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.18.0", - "@babel/types": "^7.18.0", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/generator": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", - "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", - "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.27.3", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz", - "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", - "dependencies": { - "@babel/types": "^7.27.3" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", - "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", - "dependencies": { - "@babel/compat-data": "^7.27.2", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.28.5.tgz", - "integrity": "sha512-q3WC4JfdODypvxArsJQROfupPBq9+lMwjKq7C33GhbFYJsufD0yd/ziwD+hJucLeWsnFPWZjsU2DNFqBPE7jwQ==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.27.3", - "@babel/helper-member-expression-to-functions": "^7.28.5", - "@babel/helper-optimise-call-expression": "^7.27.1", - "@babel/helper-replace-supers": "^7.27.1", - "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", - "@babel/traverse": "^7.28.5", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.28.5.tgz", - "integrity": "sha512-N1EhvLtHzOvj7QQOUCCS3NrPJP8c5W6ZXCHDn7Yialuy1iu4r5EmIYkXlKNqT99Ciw+W0mDqWoR6HWMZlFP3hw==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.27.3", - "regexpu-core": "^6.3.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", - "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", - "dependencies": { - "@babel/helper-compilation-targets": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0-0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", - "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.28.5.tgz", - "integrity": "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg==", - "dependencies": { - "@babel/traverse": "^7.28.5", - "@babel/types": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", - "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", - "dependencies": { - "@babel/traverse": "^7.27.1", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", - "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", - "dependencies": { - "@babel/helper-module-imports": "^7.27.1", - "@babel/helper-validator-identifier": "^7.27.1", - "@babel/traverse": "^7.28.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz", - "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", - "dependencies": { - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", - "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz", - "integrity": "sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.27.1", - "@babel/helper-wrap-function": "^7.27.1", - "@babel/traverse": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz", - "integrity": "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA==", - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.27.1", - "@babel/helper-optimise-call-expression": "^7.27.1", - "@babel/traverse": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz", - "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", - "dependencies": { - "@babel/traverse": "^7.27.1", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.28.3.tgz", - "integrity": "sha512-zdf983tNfLZFletc0RRXYrHrucBEg95NIFMkn6K9dbeMYnsgHaSBGcQqdsCSStG2PYwRre0Qc2NNSCXbG+xc6g==", - "dependencies": { - "@babel/template": "^7.27.2", - "@babel/traverse": "^7.28.3", - "@babel/types": "^7.28.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", - "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", - "dependencies": { - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", - "dependencies": { - "@babel/types": "^7.28.5" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz", - "integrity": "sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz", - "integrity": "sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", - "@babel/plugin-transform-optional-chaining": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" - } - }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", - "integrity": "sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.", - "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.21.0.tgz", - "integrity": "sha512-XP5G9MWNUskFuP30IfFSEFB0Z6HzLIUcjYM4bYOPHXl7eiJ9HFv8tWj6TXTN5QODiEhDZAeI4hLok2iHFFV4hw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-static-block instead.", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.21.0", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" - } - }, - "node_modules/@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz", - "integrity": "sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz", - "integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz", - "integrity": "sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-json-strings instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.20.7.tgz", - "integrity": "sha512-y7C7cZgpMIjWlKE5T7eJwp+tnRYM89HmRvWM5EQuB5BoHEONjmQ8lSNmBUwOyy/GFRsohJED51YBF79hE1djug==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-logical-assignment-operators instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz", - "integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.", - "dependencies": { - "@babel/compat-data": "^7.20.5", - "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.20.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz", - "integrity": "sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz", - "integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.", - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.11", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.11.tgz", - "integrity": "sha512-0QZ8qP/3RLDVBwBFoWAwCtgcDZJVwA5LUJRZU8x2YFfKNuFq161wK3cuGrALu5yiPu+vzwTAg/sMWVNeWeNyaw==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.21.0", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz", - "integrity": "sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead.", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz", - "integrity": "sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz", - "integrity": "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz", - "integrity": "sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA==", - "dependencies": { - "@babel/helper-module-imports": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-remap-async-to-generator": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz", - "integrity": "sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.5.tgz", - "integrity": "sha512-45DmULpySVvmq9Pj3X9B+62Xe+DJGov27QravQJU1LLcapR6/10i+gYVAucGGJpHBp5mYxIMK4nDAT/QDLr47g==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.4.tgz", - "integrity": "sha512-cFOlhIYPBv/iBoc+KS3M6et2XPtbT2HiCRfBXWtfpc9OAyostldxIf9YAYB6ypURBBbx+Qv6nyrLzASfJe+hBA==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.27.3", - "@babel/helper-compilation-targets": "^7.27.2", - "@babel/helper-globals": "^7.28.0", - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-replace-supers": "^7.27.1", - "@babel/traverse": "^7.28.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz", - "integrity": "sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/template": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.5.tgz", - "integrity": "sha512-Kl9Bc6D0zTUcFUvkNuQh4eGXPKKNDOJQXVyyM4ZAQPMveniJdxi8XMJwLo+xSoW3MIq81bD33lcUe9kZpl0MCw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/traverse": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz", - "integrity": "sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw==", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz", - "integrity": "sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.28.5.tgz", - "integrity": "sha512-D4WIMaFtwa2NizOp+dnoFjRez/ClKiC2BqqImwKd1X28nqBtZEyCYJ2ozQrrzlxAFrcrjxo39S6khe9RNDlGzw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz", - "integrity": "sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz", - "integrity": "sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ==", - "dependencies": { - "@babel/helper-compilation-targets": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/traverse": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz", - "integrity": "sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz", - "integrity": "sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz", - "integrity": "sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA==", - "dependencies": { - "@babel/helper-module-transforms": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz", - "integrity": "sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw==", - "dependencies": { - "@babel/helper-module-transforms": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.28.5.tgz", - "integrity": "sha512-vn5Jma98LCOeBy/KpeQhXcV2WZgaRUtjwQmjoBuLNlOmkg0fB5pdvYVeWRYI69wWKwK2cD1QbMiUQnoujWvrew==", - "dependencies": { - "@babel/helper-module-transforms": "^7.28.3", - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz", - "integrity": "sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w==", - "dependencies": { - "@babel/helper-module-transforms": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz", - "integrity": "sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng==", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz", - "integrity": "sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz", - "integrity": "sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-replace-supers": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-chaining": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.28.5.tgz", - "integrity": "sha512-N6fut9IZlPnjPwgiQkXNhb+cT8wQKFlJNqcZkWlcTqkcqx6/kU4ynGmLFoa4LViBSirn05YAwk+sQBbPfxtYzQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.27.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz", - "integrity": "sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz", - "integrity": "sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.4.tgz", - "integrity": "sha512-+ZEdQlBoRg9m2NnzvEeLgtvBMO4tkFBw5SQIUgLICgTrumLoU7lr+Oghi6km2PFj+dbUt2u1oby2w3BDO9YQnA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz", - "integrity": "sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz", - "integrity": "sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz", - "integrity": "sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz", - "integrity": "sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz", - "integrity": "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz", - "integrity": "sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz", - "integrity": "sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz", - "integrity": "sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw==", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.27.1", - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.18.0.tgz", - "integrity": "sha512-cP74OMs7ECLPeG1reiCQ/D/ypyOxgfm8uR6HRYV23vTJ7Lu1nbgj9DQDo/vH59gnn7GOAwtTDPPYV4aXzsMKHA==", - "dependencies": { - "@babel/compat-data": "^7.17.10", - "@babel/helper-compilation-targets": "^7.17.10", - "@babel/helper-plugin-utils": "^7.17.12", - "@babel/helper-validator-option": "^7.16.7", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.17.12", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.17.12", - "@babel/plugin-proposal-async-generator-functions": "^7.17.12", - "@babel/plugin-proposal-class-properties": "^7.17.12", - "@babel/plugin-proposal-class-static-block": "^7.18.0", - "@babel/plugin-proposal-dynamic-import": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.17.12", - "@babel/plugin-proposal-json-strings": "^7.17.12", - "@babel/plugin-proposal-logical-assignment-operators": "^7.17.12", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.18.0", - "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.17.12", - "@babel/plugin-proposal-private-methods": "^7.17.12", - "@babel/plugin-proposal-private-property-in-object": "^7.17.12", - "@babel/plugin-proposal-unicode-property-regex": "^7.17.12", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.17.12", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.17.12", - "@babel/plugin-transform-async-to-generator": "^7.17.12", - "@babel/plugin-transform-block-scoped-functions": "^7.16.7", - "@babel/plugin-transform-block-scoping": "^7.17.12", - "@babel/plugin-transform-classes": "^7.17.12", - "@babel/plugin-transform-computed-properties": "^7.17.12", - "@babel/plugin-transform-destructuring": "^7.18.0", - "@babel/plugin-transform-dotall-regex": "^7.16.7", - "@babel/plugin-transform-duplicate-keys": "^7.17.12", - "@babel/plugin-transform-exponentiation-operator": "^7.16.7", - "@babel/plugin-transform-for-of": "^7.17.12", - "@babel/plugin-transform-function-name": "^7.16.7", - "@babel/plugin-transform-literals": "^7.17.12", - "@babel/plugin-transform-member-expression-literals": "^7.16.7", - "@babel/plugin-transform-modules-amd": "^7.18.0", - "@babel/plugin-transform-modules-commonjs": "^7.18.0", - "@babel/plugin-transform-modules-systemjs": "^7.18.0", - "@babel/plugin-transform-modules-umd": "^7.18.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.17.12", - "@babel/plugin-transform-new-target": "^7.17.12", - "@babel/plugin-transform-object-super": "^7.16.7", - "@babel/plugin-transform-parameters": "^7.17.12", - "@babel/plugin-transform-property-literals": "^7.16.7", - "@babel/plugin-transform-regenerator": "^7.18.0", - "@babel/plugin-transform-reserved-words": "^7.17.12", - "@babel/plugin-transform-shorthand-properties": "^7.16.7", - "@babel/plugin-transform-spread": "^7.17.12", - "@babel/plugin-transform-sticky-regex": "^7.16.7", - "@babel/plugin-transform-template-literals": "^7.17.12", - "@babel/plugin-transform-typeof-symbol": "^7.17.12", - "@babel/plugin-transform-unicode-escapes": "^7.16.7", - "@babel/plugin-transform-unicode-regex": "^7.16.7", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.18.0", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.5.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "core-js-compat": "^3.22.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-env/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6.tgz", - "integrity": "sha512-ID2yj6K/4lKfhuU3+EX4UvNbIt7eACFbHmNUjzA+ep+B5971CknnA/9DEWKbRokfbbtblxxxXFJJrH47UEAMVg==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/@babel/template": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", - "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/parser": "^7.27.2", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", - "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.5", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@electron/asar": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.4.1.tgz", - "integrity": "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA==", - "dependencies": { - "commander": "^5.0.0", - "glob": "^7.1.6", - "minimatch": "^3.0.4" - }, - "bin": { - "asar": "bin/asar.js" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/@electron/asar/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/@electron/asar/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@electron/asar/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@electron/get": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-3.1.0.tgz", - "integrity": "sha512-F+nKc0xW+kVbBRhFzaMgPy3KwmuNTYX1fx6+FxxoSnNgwYX6LD7AKBTWkU0MQ6IBoe7dz069CNkR673sPAgkCQ==", - "dependencies": { - "debug": "^4.1.1", - "env-paths": "^2.2.0", - "fs-extra": "^8.1.0", - "got": "^11.8.5", - "progress": "^2.0.3", - "semver": "^6.2.0", - "sumchecker": "^3.0.1" - }, - "engines": { - "node": ">=14" - }, - "optionalDependencies": { - "global-agent": "^3.0.0" - } - }, - "node_modules/@electron/get/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@electron/get/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@electron/get/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@electron/get/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@electron/notarize": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.5.0.tgz", - "integrity": "sha512-jNT8nwH1f9X5GEITXaQ8IF/KdskvIkOFfB2CvwumsveVidzpSc+mvhhTMdAGSYF3O+Nq49lJ7y+ssODRXu06+A==", - "dependencies": { - "debug": "^4.1.1", - "fs-extra": "^9.0.1", - "promise-retry": "^2.0.1" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/@electron/notarize/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@electron/osx-sign": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.3.3.tgz", - "integrity": "sha512-KZ8mhXvWv2rIEgMbWZ4y33bDHyUKMXnx4M0sTyPNK/vcB81ImdeY9Ggdqy0SWbMDgmbqyQ+phgejh6V3R2QuSg==", - "dependencies": { - "compare-version": "^0.1.2", - "debug": "^4.3.4", - "fs-extra": "^10.0.0", - "isbinaryfile": "^4.0.8", - "minimist": "^1.2.6", - "plist": "^3.0.5" - }, - "bin": { - "electron-osx-flat": "bin/electron-osx-flat.js", - "electron-osx-sign": "bin/electron-osx-sign.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@electron/osx-sign/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@electron/packager": { - "version": "18.4.4", - "resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.4.4.tgz", - "integrity": "sha512-fTUCmgL25WXTcFpM1M72VmFP8w3E4d+KNzWxmTDRpvwkfn/S206MAtM2cy0GF78KS9AwASMOUmlOIzCHeNxcGQ==", - "dependencies": { - "@electron/asar": "^3.2.13", - "@electron/get": "^3.0.0", - "@electron/notarize": "^2.1.0", - "@electron/osx-sign": "^1.0.5", - "@electron/universal": "^2.0.1", - "@electron/windows-sign": "^1.0.0", - "@malept/cross-spawn-promise": "^2.0.0", - "debug": "^4.0.1", - "extract-zip": "^2.0.0", - "filenamify": "^4.1.0", - "fs-extra": "^11.1.0", - "galactus": "^1.0.0", - "get-package-info": "^1.0.0", - "junk": "^3.1.0", - "parse-author": "^2.0.0", - "plist": "^3.0.0", - "prettier": "^3.4.2", - "resedit": "^2.0.0", - "resolve": "^1.1.6", - "semver": "^7.1.3", - "yargs-parser": "^21.1.1" - }, - "bin": { - "electron-packager": "bin/electron-packager.js" - }, - "engines": { - "node": ">= 16.13.0" - }, - "funding": { - "url": "https://github.com/electron/packager?sponsor=1" - } - }, - "node_modules/@electron/remote": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@electron/remote/-/remote-2.1.3.tgz", - "integrity": "sha512-XlpxC8S4ttj/v2d+PKp9na/3Ev8bV7YWNL7Cw5b9MAWgTphEml7iYgbc7V0r9D6yDOfOkj06bchZgOZdlWJGNA==", - "peerDependencies": { - "electron": ">= 13.0.0" - } - }, - "node_modules/@electron/universal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-2.0.3.tgz", - "integrity": "sha512-Wn9sPYIVFRFl5HmwMJkARCCf7rqK/EurkfQ/rJZ14mHP3iYTjZSIOSVonEAnhWeAXwtw7zOekGRlc6yTtZ0t+g==", - "dependencies": { - "@electron/asar": "^3.3.1", - "@malept/cross-spawn-promise": "^2.0.0", - "debug": "^4.3.1", - "dir-compare": "^4.2.0", - "fs-extra": "^11.1.1", - "minimatch": "^9.0.3", - "plist": "^3.1.0" - }, - "engines": { - "node": ">=16.4" - } - }, - "node_modules/@electron/universal/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@electron/windows-sign": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@electron/windows-sign/-/windows-sign-1.2.2.tgz", - "integrity": "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ==", - "dependencies": { - "cross-dirname": "^0.1.0", - "debug": "^4.3.4", - "fs-extra": "^11.1.1", - "minimist": "^1.2.8", - "postject": "^1.0.0-alpha.6" - }, - "bin": { - "electron-windows-sign": "bin/electron-windows-sign.js" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", - "deprecated": "Use @eslint/config-array instead", - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "deprecated": "Use @eslint/object-schema instead" - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.11", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", - "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@malept/cross-spawn-promise": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz", - "integrity": "sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/malept" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" - } - ], - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "engines": { - "node": ">= 12.13.0" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@parcel/watcher": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", - "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "detect-libc": "^1.0.3", - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "node-addon-api": "^7.0.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "@parcel/watcher-android-arm64": "2.5.1", - "@parcel/watcher-darwin-arm64": "2.5.1", - "@parcel/watcher-darwin-x64": "2.5.1", - "@parcel/watcher-freebsd-x64": "2.5.1", - "@parcel/watcher-linux-arm-glibc": "2.5.1", - "@parcel/watcher-linux-arm-musl": "2.5.1", - "@parcel/watcher-linux-arm64-glibc": "2.5.1", - "@parcel/watcher-linux-arm64-musl": "2.5.1", - "@parcel/watcher-linux-x64-glibc": "2.5.1", - "@parcel/watcher-linux-x64-musl": "2.5.1", - "@parcel/watcher-win32-arm64": "2.5.1", - "@parcel/watcher-win32-ia32": "2.5.1", - "@parcel/watcher-win32-x64": "2.5.1" - } - }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz", - "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz", - "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz", - "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz", - "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz", - "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", - "cpu": [ - "arm" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-musl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz", - "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", - "cpu": [ - "arm" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz", - "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", - "cpu": [ - "arm64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz", - "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", - "cpu": [ - "arm64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz", - "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz", - "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", - "cpu": [ - "x64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz", - "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz", - "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz", - "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@rollup/plugin-babel": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.1.0.tgz", - "integrity": "sha512-dFZNuFD2YRcoomP4oYf+DvQNSUA9ih+A3vUqopQx5EdtPGo3WBnQcI/S8pwpz91UsGfL0HsMSOlaMld8HrbubA==", - "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@rollup/pluginutils": "^5.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "@types/babel__core": "^7.1.9", - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "@types/babel__core": { - "optional": true - }, - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-commonjs": { - "version": "28.0.9", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.9.tgz", - "integrity": "sha512-PIR4/OHZ79romx0BVVll/PkwWpJ7e5lsqFa3gFfcrFPWwLXLV39JVUzQV9RKjWerE7B845Hqjj9VYlQeieZ2dA==", - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "commondir": "^1.0.1", - "estree-walker": "^2.0.2", - "fdir": "^6.2.0", - "is-reference": "1.2.1", - "magic-string": "^0.30.3", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=16.0.0 || 14 >= 14.17" - }, - "peerDependencies": { - "rollup": "^2.68.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-json": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", - "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", - "dependencies": { - "@rollup/pluginutils": "^5.1.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz", - "integrity": "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==", - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "@types/resolve": "1.20.2", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.22.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.78.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-terser": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", - "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", - "dependencies": { - "serialize-javascript": "^6.0.1", - "smob": "^1.0.0", - "terser": "^5.17.4" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.50.1.tgz", - "integrity": "sha512-HJXwzoZN4eYTdD8bVV22DN8gsPCAj3V20NHKOs8ezfXanGpmVPR7kalUHd+Y31IJp9stdB87VKPFbsGY3H/2ag==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.50.1.tgz", - "integrity": "sha512-PZlsJVcjHfcH53mOImyt3bc97Ep3FJDXRpk9sMdGX0qgLmY0EIWxCag6EigerGhLVuL8lDVYNnSo8qnTElO4xw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.50.1.tgz", - "integrity": "sha512-xc6i2AuWh++oGi4ylOFPmzJOEeAa2lJeGUGb4MudOtgfyyjr4UPNK+eEWTPLvmPJIY/pgw6ssFIox23SyrkkJw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.50.1.tgz", - "integrity": "sha512-2ofU89lEpDYhdLAbRdeyz/kX3Y2lpYc6ShRnDjY35bZhd2ipuDMDi6ZTQ9NIag94K28nFMofdnKeHR7BT0CATw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.50.1.tgz", - "integrity": "sha512-wOsE6H2u6PxsHY/BeFHA4VGQN3KUJFZp7QJBmDYI983fgxq5Th8FDkVuERb2l9vDMs1D5XhOrhBrnqcEY6l8ZA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.50.1.tgz", - "integrity": "sha512-A/xeqaHTlKbQggxCqispFAcNjycpUEHP52mwMQZUNqDUJFFYtPHCXS1VAG29uMlDzIVr+i00tSFWFLivMcoIBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.50.1.tgz", - "integrity": "sha512-54v4okehwl5TaSIkpp97rAHGp7t3ghinRd/vyC1iXqXMfjYUTm7TfYmCzXDoHUPTTf36L8pr0E7YsD3CfB3ZDg==", - "cpu": [ - "arm" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.50.1.tgz", - "integrity": "sha512-p/LaFyajPN/0PUHjv8TNyxLiA7RwmDoVY3flXHPSzqrGcIp/c2FjwPPP5++u87DGHtw+5kSH5bCJz0mvXngYxw==", - "cpu": [ - "arm" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.50.1.tgz", - "integrity": "sha512-2AbMhFFkTo6Ptna1zO7kAXXDLi7H9fGTbVaIq2AAYO7yzcAsuTNWPHhb2aTA6GPiP+JXh85Y8CiS54iZoj4opw==", - "cpu": [ - "arm64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.50.1.tgz", - "integrity": "sha512-Cgef+5aZwuvesQNw9eX7g19FfKX5/pQRIyhoXLCiBOrWopjo7ycfB292TX9MDcDijiuIJlx1IzJz3IoCPfqs9w==", - "cpu": [ - "arm64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.50.1.tgz", - "integrity": "sha512-RPhTwWMzpYYrHrJAS7CmpdtHNKtt2Ueo+BlLBjfZEhYBhK00OsEqM08/7f+eohiF6poe0YRDDd8nAvwtE/Y62Q==", - "cpu": [ - "loong64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.50.1.tgz", - "integrity": "sha512-eSGMVQw9iekut62O7eBdbiccRguuDgiPMsw++BVUg+1K7WjZXHOg/YOT9SWMzPZA+w98G+Fa1VqJgHZOHHnY0Q==", - "cpu": [ - "ppc64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.50.1.tgz", - "integrity": "sha512-S208ojx8a4ciIPrLgazF6AgdcNJzQE4+S9rsmOmDJkusvctii+ZvEuIC4v/xFqzbuP8yDjn73oBlNDgF6YGSXQ==", - "cpu": [ - "riscv64" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.50.1.tgz", - "integrity": "sha512-3Ag8Ls1ggqkGUvSZWYcdgFwriy2lWo+0QlYgEFra/5JGtAd6C5Hw59oojx1DeqcA2Wds2ayRgvJ4qxVTzCHgzg==", - "cpu": [ - "riscv64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.50.1.tgz", - "integrity": "sha512-t9YrKfaxCYe7l7ldFERE1BRg/4TATxIg+YieHQ966jwvo7ddHJxPj9cNFWLAzhkVsbBvNA4qTbPVNsZKBO4NSg==", - "cpu": [ - "s390x" - ], - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.1.tgz", - "integrity": "sha512-MCgtFB2+SVNuQmmjHf+wfI4CMxy3Tk8XjA5Z//A0AKD7QXUYFMQcns91K6dEHBvZPCnhJSyDWLApk40Iq/H3tA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.50.1.tgz", - "integrity": "sha512-nEvqG+0jeRmqaUMuwzlfMKwcIVffy/9KGbAGyoa26iu6eSngAYQ512bMXuqqPrlTyfqdlB9FVINs93j534UJrg==", - "cpu": [ - "x64" - ], - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.50.1.tgz", - "integrity": "sha512-RDsLm+phmT3MJd9SNxA9MNuEAO/J2fhW8GXk62G/B4G7sLVumNFbRwDL6v5NrESb48k+QMqdGbHgEtfU0LCpbA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.50.1.tgz", - "integrity": "sha512-hpZB/TImk2FlAFAIsoElM3tLzq57uxnGYwplg6WDyAxbYczSi8O2eQ+H2Lx74504rwKtZ3N2g4bCUkiamzS6TQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.50.1.tgz", - "integrity": "sha512-SXjv8JlbzKM0fTJidX4eVsH+Wmnp0/WcD8gJxIZyR6Gay5Qcsmdbi9zVtnbkGPG8v2vMR1AD06lGWy5FLMcG7A==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.50.1.tgz", - "integrity": "sha512-StxAO/8ts62KZVRAm4JZYq9+NqNsV7RvimNK+YM7ry//zebEH6meuugqW/P5OFUCjyQgui+9fUxT6d5NShvMvA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@serialport/binding-mock": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-10.2.2.tgz", - "integrity": "sha512-HAFzGhk9OuFMpuor7aT5G1ChPgn5qSsklTFOTUX72Rl6p0xwcSVsRtG/xaGp6bxpN7fI9D/S8THLBWbBgS6ldw==", - "optional": true, - "dependencies": { - "@serialport/bindings-interface": "^1.2.1", - "debug": "^4.3.3" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@serialport/bindings-cpp": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/@serialport/bindings-cpp/-/bindings-cpp-12.0.1.tgz", - "integrity": "sha512-r2XOwY2dDvbW7dKqSPIk2gzsr6M6Qpe9+/Ngs94fNaNlcTRCV02PfaoDmRgcubpNVVcLATlxSxPTIDw12dbKOg==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "@serialport/bindings-interface": "1.2.2", - "@serialport/parser-readline": "11.0.0", - "debug": "4.3.4", - "node-addon-api": "7.0.0", - "node-gyp-build": "4.6.0" - }, - "engines": { - "node": ">=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-delimiter": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-11.0.0.tgz", - "integrity": "sha512-aZLJhlRTjSmEwllLG7S4J8s8ctRAS0cbvCpO87smLvl3e4BgzbVgF6Z6zaJd3Aji2uSiYgfedCdNc4L6W+1E2g==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-readline": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-11.0.0.tgz", - "integrity": "sha512-rRAivhRkT3YO28WjmmG4FQX6L+KMb5/ikhyylRfzWPw0nSXy97+u07peS9CbHqaNvJkMhH1locp2H36aGMOEIA==", - "optional": true, - "dependencies": { - "@serialport/parser-delimiter": "11.0.0" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/bindings-cpp/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "optional": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@serialport/bindings-cpp/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "optional": true - }, - "node_modules/@serialport/bindings-cpp/node_modules/node-addon-api": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz", - "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==", - "optional": true - }, - "node_modules/@serialport/bindings-interface": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@serialport/bindings-interface/-/bindings-interface-1.2.2.tgz", - "integrity": "sha512-CJaUd5bLvtM9c5dmO9rPBHPXTa9R2UwpkJ0wdh9JCYcbrPWsKz+ErvR0hBLeo7NPeiFdjFO4sonRljiw4d2XiA==", - "optional": true, - "engines": { - "node": "^12.22 || ^14.13 || >=16" - } - }, - "node_modules/@serialport/parser-byte-length": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-12.0.0.tgz", - "integrity": "sha512-0ei0txFAj+s6FTiCJFBJ1T2hpKkX8Md0Pu6dqMrYoirjPskDLJRgZGLqoy3/lnU1bkvHpnJO+9oJ3PB9v8rNlg==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-cctalk": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-12.0.0.tgz", - "integrity": "sha512-0PfLzO9t2X5ufKuBO34DQKLXrCCqS9xz2D0pfuaLNeTkyGUBv426zxoMf3rsMRodDOZNbFblu3Ae84MOQXjnZw==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-delimiter": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-12.0.0.tgz", - "integrity": "sha512-gu26tVt5lQoybhorLTPsH2j2LnX3AOP2x/34+DUSTNaUTzu2fBXw+isVjQJpUBFWu6aeQRZw5bJol5X9Gxjblw==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-inter-byte-timeout": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-inter-byte-timeout/-/parser-inter-byte-timeout-12.0.0.tgz", - "integrity": "sha512-GnCh8K0NAESfhCuXAt+FfBRz1Cf9CzIgXfp7SdMgXwrtuUnCC/yuRTUFWRvuzhYKoAo1TL0hhUo77SFHUH1T/w==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-packet-length": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-packet-length/-/parser-packet-length-12.0.0.tgz", - "integrity": "sha512-p1hiCRqvGHHLCN/8ZiPUY/G0zrxd7gtZs251n+cfNTn+87rwcdUeu9Dps3Aadx30/sOGGFL6brIRGK4l/t7MuQ==", - "optional": true, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/@serialport/parser-readline": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-12.0.0.tgz", - "integrity": "sha512-O7cywCWC8PiOMvo/gglEBfAkLjp/SENEML46BXDykfKP5mTPM46XMaX1L0waWU6DXJpBgjaL7+yX6VriVPbN4w==", - "optional": true, - "dependencies": { - "@serialport/parser-delimiter": "12.0.0" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-ready": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-12.0.0.tgz", - "integrity": "sha512-ygDwj3O4SDpZlbrRUraoXIoIqb8sM7aMKryGjYTIF0JRnKeB1ys8+wIp0RFMdFbO62YriUDextHB5Um5cKFSWg==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-regex": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-12.0.0.tgz", - "integrity": "sha512-dCAVh4P/pZrLcPv9NJ2mvPRBg64L5jXuiRxIlyxxdZGH4WubwXVXY/kBTihQmiAMPxbT3yshSX8f2+feqWsxqA==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-slip-encoder": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-slip-encoder/-/parser-slip-encoder-12.0.0.tgz", - "integrity": "sha512-0APxDGR9YvJXTRfY+uRGhzOhTpU5akSH183RUcwzN7QXh8/1jwFsFLCu0grmAUfi+fItCkR+Xr1TcNJLR13VNA==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/parser-spacepacket": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/parser-spacepacket/-/parser-spacepacket-12.0.0.tgz", - "integrity": "sha512-dozONxhPC/78pntuxpz/NOtVps8qIc/UZzdc/LuPvVsqCoJXiRxOg6ZtCP/W58iibJDKPZPAWPGYeZt9DJxI+Q==", - "optional": true, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/stream": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-12.0.0.tgz", - "integrity": "sha512-9On64rhzuqKdOQyiYLYv2lQOh3TZU/D3+IWCR5gk0alPel2nwpp4YwDEGiUBfrQZEdQ6xww0PWkzqth4wqwX3Q==", - "optional": true, - "dependencies": { - "@serialport/bindings-interface": "1.2.2", - "debug": "4.3.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/@serialport/stream/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "optional": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@serialport/stream/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "optional": true - }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, - "node_modules/@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "dependencies": { - "defer-to-connect": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==" - }, - "node_modules/@types/fs-extra": { - "version": "9.0.13", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", - "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", - "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==" - }, - "node_modules/@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/minimatch": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-6.0.0.tgz", - "integrity": "sha512-zmPitbQ8+6zNutpwgcQuLcsEpn/Cj54Kbn7L5pX0Os5kdWplB7xPgEh/g+SWOB/qmows2gpuCaPyduq8ZZRnxA==", - "deprecated": "This is a stub types definition. minimatch provides its own type definitions, so you do not need this installed.", - "dependencies": { - "minimatch": "*" - } - }, - "node_modules/@types/node": { - "version": "22.19.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz", - "integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/@types/resolve": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", - "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==" - }, - "node_modules/@types/responselike": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", - "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/yauzl": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@xmldom/xmldom": { - "version": "0.8.11", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz", - "integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/7zip": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/7zip/-/7zip-0.0.6.tgz", - "integrity": "sha512-ns8vKbKhIQm338AeWo/YdDSWil3pldwCMoyR2npoM2qDAzF8Vuko8BtDxpNt/wE15SXOh5K5WbjSLR4kTOAHLA==", - "deprecated": "Deprecated as outdated and risky. Please migrate to some modern alternatives. See: https://www.npmjs.com/search", - "bin": { - "7z": "7zip-lite/7z.exe" - } - }, - "node_modules/ace-builds": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.39.0.tgz", - "integrity": "sha512-MqoZojv4gpc5QyTMor/dS6kmruDV9db9LVZbCiT4qYz6WsDiv4qyG5f7ZPc+wjUl6oLMqgCAsBjo1whdSVyMlQ==" - }, - "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-node": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", - "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", - "dependencies": { - "acorn": "^7.0.0", - "acorn-walk": "^7.0.0", - "xtend": "^4.0.2" - } - }, - "node_modules/acorn-node/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-html": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.9.tgz", - "integrity": "sha512-ozbS3LuenHVxNRh/wdnN16QapUHzauqSomAl1jwwJRRsGwFwtj644lIhxfWu0Fy0acCij2+AEgHvjscq3dlVXg==", - "engines": [ - "node >= 0.8.0" - ], - "bin": { - "ansi-html": "bin/ansi-html" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/apache-crypt": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/apache-crypt/-/apache-crypt-1.2.6.tgz", - "integrity": "sha512-072WetlM4blL8PREJVeY+WHiUh1R5VNt2HfceGS8aKqttPHcmqE5pkKuXPz/ULmJOFkc8Hw3kfKl6vy7Qka6DA==", - "dependencies": { - "unix-crypt-td-js": "^1.1.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/apache-md5": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/apache-md5/-/apache-md5-1.1.8.tgz", - "integrity": "sha512-FCAJojipPn0bXjuEpjOOOMN8FZDkxfWWp4JGN9mifU2IhxvKyXZYqpzPHdnTSUpmPDy+tsslB6Z1g+Vg6nVbYA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-flatten": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", - "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==" - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/author-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/author-regex/-/author-regex-1.0.0.tgz", - "integrity": "sha512-KbWgR8wOYRAPekEmMXrYYdc7BRyhn2Ftk7KWfMUnQ43hFdojWEFRxhhRUm3/OFEdPa1r0KAvTTg9YQK57xTe0g==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz", - "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==" - }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", - "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", - "dependencies": { - "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.3", - "semver": "^6.1.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz", - "integrity": "sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A==", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babelify": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/babelify/-/babelify-10.0.0.tgz", - "integrity": "sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg==", - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/balanced-match": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", - "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/baseline-browser-mapping": { - "version": "2.9.11", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz", - "integrity": "sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==", - "bin": { - "baseline-browser-mapping": "dist/cli.js" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/bcryptjs": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", - "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, - "node_modules/bonjour": { - "version": "4.0.0", - "resolved": "git+https://framagit.org/jean-emmanuel/bonjour.git#5def16384fa4c1a2263ba8762500a707057c4edc", - "dependencies": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "git+https://framagit.org/jean-emmanuel/dns-txt.git", - "multicast-dns": "git+https://framagit.org/jean-emmanuel/multicast-dns.git", - "multicast-dns-service-types": "^1.1.0" - } - }, - "node_modules/boolean": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", - "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "optional": true - }, - "node_modules/boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dependencies": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/brace-expansion/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browser-process-hrtime": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", - "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==" - }, - "node_modules/browserslist": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", - "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "baseline-browser-mapping": "^2.9.0", - "caniuse-lite": "^1.0.30001759", - "electron-to-chromium": "^1.5.263", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.2.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "engines": { - "node": "*" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" - }, - "node_modules/buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" - }, - "node_modules/cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "engines": { - "node": ">=10.6.0" - } - }, - "node_modules/cacheable-request": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", - "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/call-bind": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", - "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.0", - "es-define-property": "^1.0.0", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==", - "dependencies": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001761", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz", - "integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chroma-js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", - "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" - }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" - }, - "node_modules/cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", - "engines": { - "node": ">= 6" - } - }, - "node_modules/commenting": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/commenting/-/commenting-1.1.0.tgz", - "integrity": "sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA==" - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" - }, - "node_modules/compare-version": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", - "integrity": "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dependencies": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" - }, - "node_modules/core-js": { - "version": "3.22.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.22.5.tgz", - "integrity": "sha512-VP/xYuvJ0MJWRAobcmQ8F2H6Bsn+s7zqAAjFaHGBMc5AQm7zaelhD1LGduFn2EehEcQcU+br6t+fwbpQ5d1ZWA==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-js-compat": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz", - "integrity": "sha512-IGfuznZ/n7Kp9+nypamBhvwdwLsW6KC8IOaURw2doAK5e98AG3acVLdh0woOnEqCfUtS+Vu882JE4k/DAm3ItQ==", - "dependencies": { - "browserslist": "^4.28.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" - }, - "node_modules/cpr": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cpr/-/cpr-3.0.1.tgz", - "integrity": "sha512-Xch4PXQ/KC8lJ+KfJ9JI6eG/nmppLrPPWg5Q+vh65Qr9EjuJEubxh/H/Le1TmCZ7+Xv7iJuNRqapyOFZB+wsxA==", - "dependencies": { - "graceful-fs": "^4.1.5", - "minimist": "^1.2.0", - "mkdirp": "~0.5.1", - "rimraf": "^2.5.4" - }, - "bin": { - "cpr": "bin/cpr" - } - }, - "node_modules/cross-dirname": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/cross-dirname/-/cross-dirname-0.1.0.tgz", - "integrity": "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/cross-unzip": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/cross-unzip/-/cross-unzip-0.0.2.tgz", - "integrity": "sha512-nRJ5c+aqHz0OJVU4V1bqoaDggydfauK/Gha/H/ScBvuIjhZvl8YIpdWVzSR3vUhzCloqB1tvBdQ4V7J8qK7HzQ==" - }, - "node_modules/crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/dash-ast": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", - "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==" - }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-equal": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", - "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", - "dependencies": { - "is-arguments": "^1.1.1", - "is-date-object": "^1.0.5", - "is-regex": "^1.1.4", - "object-is": "^1.1.5", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.5.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "engines": { - "node": ">=10" - } - }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/define-lazy-prop": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", - "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", - "engines": { - "node": ">=8" - } - }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/detect-europe-js": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.2.tgz", - "integrity": "sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - } - ] - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "optional": true, - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/detect-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "optional": true - }, - "node_modules/diff-match-patch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", - "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==" - }, - "node_modules/dijkstrajs": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", - "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" - }, - "node_modules/dir-compare": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.2.0.tgz", - "integrity": "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ==", - "dependencies": { - "minimatch": "^3.0.5", - "p-limit": "^3.1.0 " - } - }, - "node_modules/dir-compare/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/dir-compare/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/dir-compare/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/dir-glob/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg==" - }, - "node_modules/dns-packet": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.4.tgz", - "integrity": "sha512-BQ6F4vycLXBvdrJZ6S3gZewt6rcrks9KBgM9vrhW+knGRqc8uEdT7fuCwloc7nny5xNoMJ17HGH0R/6fpo8ECA==", - "dependencies": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/dns-txt": { - "version": "2.0.3", - "resolved": "git+https://framagit.org/jean-emmanuel/dns-txt.git#3bee7785c32d8bc71230d5e01383c61fb72a4b4f", - "dependencies": { - "buffer-indexof": "^1.0.0" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/duplexer3": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", - "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==" - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/electron": { - "version": "36.9.5", - "resolved": "https://registry.npmjs.org/electron/-/electron-36.9.5.tgz", - "integrity": "sha512-1UCss2IqxqujSzg/2jkRjuiT3G+EEXgd6UKB5kUekwQW1LJ6d4QCr8YItfC3Rr9VIGRDJ29eOERmnRNO1Eh+NA==", - "hasInstallScript": true, - "dependencies": { - "@electron/get": "^2.0.0", - "@types/node": "^22.7.7", - "extract-zip": "^2.0.1" - }, - "bin": { - "electron": "cli.js" - }, - "engines": { - "node": ">= 12.20.55" - } - }, - "node_modules/electron-installer-common": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/electron-installer-common/-/electron-installer-common-0.10.4.tgz", - "integrity": "sha512-8gMNPXfAqUE5CfXg8RL0vXpLE9HAaPkgLXVoHE3BMUzogMWenf4LmwQ27BdCUrEhkjrKl+igs2IHJibclR3z3Q==", - "optional": true, - "dependencies": { - "@electron/asar": "^3.2.5", - "@malept/cross-spawn-promise": "^1.0.0", - "debug": "^4.1.1", - "fs-extra": "^9.0.0", - "glob": "^7.1.4", - "lodash": "^4.17.15", - "parse-author": "^2.0.0", - "semver": "^7.1.1", - "tmp-promise": "^3.0.2" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "url": "https://github.com/electron-userland/electron-installer-common?sponsor=1" - }, - "optionalDependencies": { - "@types/fs-extra": "^9.0.1" - } - }, - "node_modules/electron-installer-common/node_modules/@malept/cross-spawn-promise": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", - "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/malept" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" - } - ], - "optional": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/electron-installer-common/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "optional": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-installer-debian": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/electron-installer-debian/-/electron-installer-debian-3.1.0.tgz", - "integrity": "sha512-k6KChvx0Fw8XTlCqwwbBfh19yGQaKjGdbugokmr1IpzINOm4QFyACKMTHAYFHW5LCBUZQShZD96hwxUZ+8Kx+w==", - "optional": true, - "os": [ - "darwin", - "linux" - ], - "dependencies": { - "@malept/cross-spawn-promise": "^1.0.0", - "debug": "^4.1.1", - "electron-installer-common": "^0.10.2", - "fs-extra": "^9.0.0", - "get-folder-size": "^2.0.1", - "lodash": "^4.17.4", - "word-wrap": "^1.2.3", - "yargs": "^15.0.1" - }, - "bin": { - "electron-installer-debian": "src/cli.js" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/electron-installer-debian/node_modules/@malept/cross-spawn-promise": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", - "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/malept" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" - } - ], - "optional": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/electron-installer-debian/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "optional": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/electron-installer-debian/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "optional": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/electron-installer-debian/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "optional": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "optional": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-installer-debian/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "optional": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "optional": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-installer-debian/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "optional": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "optional": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "optional": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "optional": true - }, - "node_modules/electron-installer-debian/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "optional": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-installer-debian/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "optional": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/electron-installer-redhat": { - "name": "@dennisrijsdijk/electron-installer-redhat", - "version": "3.5.0", - "resolved": "git+https://framagit.org/jean-emmanuel/electron-installer-redhat.git#eacb6a6e2a09aa9776af7fe92aabcbd2e3a17b94", - "optional": true, - "os": [ - "darwin", - "linux" - ], - "dependencies": { - "@malept/cross-spawn-promise": "^1.0.0", - "debug": "^4.1.1", - "electron-installer-common": "^0.10.2", - "fs-extra": "^9.0.0", - "lodash": "^4.17.15", - "word-wrap": "^1.2.3", - "yargs": "^16.0.2" - }, - "bin": { - "electron-installer-redhat": "src/cli.js" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/electron-installer-redhat/node_modules/@malept/cross-spawn-promise": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", - "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/malept" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" - } - ], - "optional": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/electron-installer-redhat/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "optional": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-installer-redhat/node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "optional": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-installer-redhat/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "optional": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-is-accelerator": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/electron-is-accelerator/-/electron-is-accelerator-0.1.2.tgz", - "integrity": "sha512-fLGSAjXZtdn1sbtZxx52+krefmtNuVwnJCV2gNiVt735/ARUboMl8jnNC9fZEqQdlAv2ZrETfmBUsoQci5evJA==" - }, - "node_modules/electron-localshortcut": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/electron-localshortcut/-/electron-localshortcut-3.2.1.tgz", - "integrity": "sha512-DWvhKv36GsdXKnaFFhEiK8kZZA+24/yFLgtTwJJHc7AFgDjNRIBJZ/jq62Y/dWv9E4ypYwrVWN2bVrCYw1uv7Q==", - "dependencies": { - "debug": "^4.0.1", - "electron-is-accelerator": "^0.1.0", - "keyboardevent-from-electron-accelerator": "^2.0.0", - "keyboardevents-areequal": "^0.2.1" - } - }, - "node_modules/electron-packager-plugin-non-proprietary-codecs-ffmpeg": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/electron-packager-plugin-non-proprietary-codecs-ffmpeg/-/electron-packager-plugin-non-proprietary-codecs-ffmpeg-1.0.2.tgz", - "integrity": "sha512-xPkbzndg2KODqmNe9yIx0dhNOfaOqrdNZ1ZSSZN4h1wT0T5SV/YES0tNyN932jQd+c5cFPv6AWYYjuPWKvcITg==", - "dependencies": { - "7zip": "0.0.6", - "cross-unzip": "0.0.2", - "mkdirp": "^0.5.1", - "request": "^2.73.0", - "semver": "^5.2.0" - } - }, - "node_modules/electron-packager-plugin-non-proprietary-codecs-ffmpeg/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.267", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz", - "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==" - }, - "node_modules/electron/node_modules/@electron/get": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz", - "integrity": "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==", - "dependencies": { - "debug": "^4.1.1", - "env-paths": "^2.2.0", - "fs-extra": "^8.1.0", - "got": "^11.8.5", - "progress": "^2.0.3", - "semver": "^6.2.0", - "sumchecker": "^3.0.1" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "global-agent": "^3.0.0" - } - }, - "node_modules/electron/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/electron/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/electron/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/electron/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, - "node_modules/encode-utf8": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", - "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/end-of-stream": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", - "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/env-paths": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/err-code": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" - }, - "node_modules/error-ex": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", - "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/error-stack-parser": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", - "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", - "dependencies": { - "stackframe": "^1.3.4" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "optional": true - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/escaper": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/escaper/-/escaper-2.5.3.tgz", - "integrity": "sha512-QGb9sFxBVpbzMggrKTX0ry1oiI4CSDAl9vIL702hzl1jGW8VZs7qfqTRX7WDOjoNDoEVGcEtu1ZOQgReSfT2kQ==" - }, - "node_modules/eslint": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz", - "integrity": "sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==", - "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", - "dependencies": { - "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estree-is-member-expression": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/estree-is-member-expression/-/estree-is-member-expression-1.0.0.tgz", - "integrity": "sha512-Ec+X44CapIGExvSZN+pGkmr5p7HwUVQoPQSd458Lqwvaf4/61k/invHSh4BYK8OXnCkfEhWuIoG5hayKLQStIg==" - }, - "node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" - }, - "node_modules/fastdom": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fastdom/-/fastdom-1.0.10.tgz", - "integrity": "sha512-sbL4h358IlZn8VsTvA5TYnKVLYif46XhPEll+HTSxVtDSpqZEO/17D/QqlxE9V2K7AQ82GXeYeQLU2HWwKgk1A==", - "dependencies": { - "strictdom": "^1.0.1" - } - }, - "node_modules/fastq": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", - "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "dependencies": { - "pend": "~1.2.0" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/file-saver": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", - "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" - }, - "node_modules/filename-reserved-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/filenamify": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", - "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", - "dependencies": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.1", - "trim-repeated": "^1.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==" - }, - "node_modules/flora-colossus": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-2.0.0.tgz", - "integrity": "sha512-dz4HxH6pOvbUzZpZ/yXhafjbR2I8cenK5xL0KtBFb7U2ADsR+OwXifnxZjij/pZWF775uSCMzWVd+jDik2H2IA==", - "dependencies": { - "debug": "^4.3.4", - "fs-extra": "^10.1.0" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/flora-colossus/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fs-extra": { - "version": "11.3.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", - "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==" - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/galactus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/galactus/-/galactus-1.0.0.tgz", - "integrity": "sha512-R1fam6D4CyKQGNlvJne4dkNF+PvUUl7TAJInvTGa9fti9qAv95quQz29GXapA4d8Ec266mJJxFVh82M4GIIGDQ==", - "dependencies": { - "debug": "^4.3.4", - "flora-colossus": "^2.0.0", - "fs-extra": "^10.1.0" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/galactus/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/gar": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/gar/-/gar-1.0.4.tgz", - "integrity": "sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "optional": true - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-folder-size": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/get-folder-size/-/get-folder-size-2.0.1.tgz", - "integrity": "sha512-+CEb+GDCM7tkOS2wdMKTn9vU7DgnKUTuDlehkNJKNSovdCOVxs14OfKCk4cvSaR3za4gj+OBdl9opPN9xrJ0zA==", - "optional": true, - "dependencies": { - "gar": "^1.0.4", - "tiny-each-async": "2.0.3" - }, - "bin": { - "get-folder-size": "bin/get-folder-size" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-package-info": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-package-info/-/get-package-info-1.0.0.tgz", - "integrity": "sha512-SCbprXGAPdIhKAXiG+Mk6yeoFH61JlYunqdFQFHDtLjJlDjFf6x07dsS8acO+xWt52jpdVo49AlVDnUVK1sDNw==", - "dependencies": { - "bluebird": "^3.1.1", - "debug": "^2.2.0", - "lodash.get": "^4.0.0", - "read-pkg-up": "^2.0.0" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/get-package-info/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/get-package-info/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/global-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", - "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", - "optional": true, - "dependencies": { - "boolean": "^3.0.1", - "es6-error": "^4.1.1", - "matcher": "^3.0.0", - "roarr": "^2.15.3", - "semver": "^7.3.2", - "serialize-error": "^7.0.1" - }, - "engines": { - "node": ">=10.0" - } - }, - "node_modules/global-dirs": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", - "integrity": "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==", - "dependencies": { - "ini": "2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globalthis": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", - "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", - "optional": true, - "dependencies": { - "define-properties": "^1.2.1", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/globby": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", - "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", - "dependencies": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dependencies": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=10.19.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-ansi/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" - }, - "node_modules/http-auth": { - "version": "4.1.9", - "resolved": "https://registry.npmjs.org/http-auth/-/http-auth-4.1.9.tgz", - "integrity": "sha512-kvPYxNGc9EKGTXvOMnTBQw2RZfuiSihK/mLw/a4pbtRueTE45S55Lw/3k5CktIf7Ak0veMKEIteDj4YkNmCzmQ==", - "dependencies": { - "apache-crypt": "^1.1.2", - "apache-md5": "^1.0.6", - "bcryptjs": "^2.4.3", - "uuid": "^8.3.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", - "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==" - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "node_modules/http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - }, - "engines": { - "node": ">=10.19.0" - } - }, - "node_modules/hyperscript-attribute-to-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hyperscript-attribute-to-property/-/hyperscript-attribute-to-property-1.0.2.tgz", - "integrity": "sha512-oerMul16jZCmrbNsUw8QgrtDzF8lKgFri1bKQjReLw1IhiiNkI59CWuzZjJDGT79UQ1YiWqXhJMv/tRMVqgtkA==" - }, - "node_modules/hyperx": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/hyperx/-/hyperx-2.5.4.tgz", - "integrity": "sha512-iOkSh7Yse7lsN/B9y7OsevLWjeXPqGuHQ5SbwaiJM5xAhWFqhoN6erpK1dQsS12OFU36lyai1pnx1mmzWLQqcA==", - "dependencies": { - "hyperscript-attribute-to-property": "^1.0.0" - } - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==" - }, - "node_modules/immutable": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.4.tgz", - "integrity": "sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==" - }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A==", - "engines": { - "node": ">=4" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "engines": { - "node": ">=10" - } - }, - "node_modules/ip": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", - "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==" - }, - "node_modules/is-arguments": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", - "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", - "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-boolean-attribute": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/is-boolean-attribute/-/is-boolean-attribute-0.0.1.tgz", - "integrity": "sha512-0kXT52Scokg2Miscvsn5UVqg6y1691vcLJcagie1YHJB4zOEuAhMERLX992jtvaStGy2xQTqOtJhvmG/MK1T5w==" - }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, - "node_modules/is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", - "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", - "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dependencies": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==" - }, - "node_modules/is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-plain-object": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", - "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dependencies": { - "@types/estree": "*" - } - }, - "node_modules/is-regex": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", - "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", - "dependencies": { - "call-bound": "^1.0.2", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", - "integrity": "sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-standalone-pwa": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz", - "integrity": "sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - } - ] - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" - }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, - "node_modules/isbinaryfile": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", - "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", - "engines": { - "node": ">= 8.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/gjtorikian/" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" - }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" - }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" - }, - "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsondiffpatch": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/jsondiffpatch/-/jsondiffpatch-0.4.1.tgz", - "integrity": "sha512-t0etAxTUk1w5MYdNOkZBZ8rvYYN5iL+2dHCCx/DpkFm/bW28M6y5nUS83D4XdZiHy35Fpaw6LBb+F88fHZnVCw==", - "dependencies": { - "chalk": "^2.3.0", - "diff-match-patch": "^1.0.0" - }, - "bin": { - "jsondiffpatch": "bin/jsondiffpatch" - }, - "engines": { - "node": ">=8.17.0" - } - }, - "node_modules/jsondiffpatch/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jsondiffpatch/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jsondiffpatch/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jsondiffpatch/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/jsondiffpatch/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/jsondiffpatch/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/jsondiffpatch/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jsonfile": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", - "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/junk": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", - "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/keyboardevent-from-electron-accelerator": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/keyboardevent-from-electron-accelerator/-/keyboardevent-from-electron-accelerator-2.0.0.tgz", - "integrity": "sha512-iQcmNA0M4ETMNi0kG/q0h/43wZk7rMeKYrXP7sqKIJbHkTU8Koowgzv+ieR/vWJbOwxx5nDC3UnudZ0aLSu4VA==" - }, - "node_modules/keyboardevents-areequal": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz", - "integrity": "sha512-Nv+Kr33T0mEjxR500q+I6IWisOQ0lK1GGOncV0kWE6n4KFmpcu7RUX5/2B0EUtX51Cb0HjZ9VJsSY3u4cBa0kw==" - }, - "node_modules/keyboardjs": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/keyboardjs/-/keyboardjs-2.6.4.tgz", - "integrity": "sha512-xDiNwiwH3KUqap++RFJiLAXzbvRB5Yw08xliuceOgLhM1o7g1puKKR9vWy6wp9H/Bi4VP0+SQMpiWXMWWmR6rA==" - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dependencies": { - "package-json": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" - }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead." - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==" - }, - "node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/matcher": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", - "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", - "optional": true, - "dependencies": { - "escape-string-regexp": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/merge-source-map": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz", - "integrity": "sha512-PGSmS0kfnTnMJCzJ16BLLCEe6oeYCamKFFdQKshi4BmM6FUwipjVOcBFGxqtQtirtAG4iZvHlqST9CpZKqlRjA==", - "dependencies": { - "source-map": "^0.5.6" - } - }, - "node_modules/merge-source-map/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", - "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/moment": { - "version": "2.30.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", - "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", - "engines": { - "node": "*" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/multicast-dns": { - "version": "7.2.1", - "resolved": "git+https://framagit.org/jean-emmanuel/multicast-dns.git#1bb9f6ba892eba88f2cb12ca96a1c1b3088413c0", - "dependencies": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - }, - "bin": { - "multicast-dns": "cli.js" - } - }, - "node_modules/multicast-dns-service-types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ==" - }, - "node_modules/mutexify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/mutexify/-/mutexify-1.4.0.tgz", - "integrity": "sha512-pbYSsOrSB/AKN5h/WzzLRMFgZhClWccf2XIB4RSMC8JbquiB0e0/SH5AIfdQMdyHmYtv4seU7yV/TvAwPLJ1Yg==", - "dependencies": { - "queue-tick": "^1.0.0" - } - }, - "node_modules/nanoassert": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", - "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==" - }, - "node_modules/nanobench": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nanobench/-/nanobench-2.1.1.tgz", - "integrity": "sha512-z+Vv7zElcjN+OpzAxAquUayFLGK3JI/ubCl0Oh64YQqsTGG09CGqieJVQw4ui8huDnnAgrvTv93qi5UaOoNj8A==", - "dependencies": { - "browser-process-hrtime": "^0.1.2", - "chalk": "^1.1.3", - "mutexify": "^1.1.0", - "pretty-hrtime": "^1.0.2" - }, - "bin": { - "nanobench": "run.js", - "nanobench-compare": "compare.js" - } - }, - "node_modules/nanobench/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanobench/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanobench/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanobench/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/nanobench/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanobench/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/nanohtml": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/nanohtml/-/nanohtml-1.10.0.tgz", - "integrity": "sha512-r/3AQl+jxAxUIJRiKExUjBtFcE1cm4yTOsTIdVqqlxPNtBxJh522ANrcQYzdNHhPzbPgb7j6qujq6eGehBX0kg==", - "dependencies": { - "acorn-node": "^1.8.2", - "camel-case": "^3.0.0", - "convert-source-map": "^1.5.1", - "estree-is-member-expression": "^1.0.0", - "hyperx": "^2.5.0", - "is-boolean-attribute": "0.0.1", - "nanoassert": "^1.1.0", - "nanobench": "^2.1.0", - "normalize-html-whitespace": "^0.2.0", - "through2": "^2.0.3", - "transform-ast": "^2.4.0" - } - }, - "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/nanomorph": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/nanomorph/-/nanomorph-5.4.3.tgz", - "integrity": "sha512-uPP5y0x21KISffZCKHh1A0QW0RHZFQS0BR7LetlHBlay6UWAbjwhjiJTxOO6JeMHko5Cigl617zFoGrYFJ8ZLg==", - "dependencies": { - "nanoassert": "^1.1.0" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" - }, - "node_modules/no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "dependencies": { - "lower-case": "^1.1.1" - } - }, - "node_modules/node-addon-api": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", - "optional": true - }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "engines": { - "node": ">= 6.13.0" - } - }, - "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "optional": true, - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/node-mouse": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/node-mouse/-/node-mouse-0.0.2.tgz", - "integrity": "sha512-qqm+c/uKB1ceGMrKW+mxAxPKFTu0HD1DWoCElJHA0VQDloudzZD4bI++Z18mSDA3n5lix+RTXiOiu3XAOSYVHA==" - }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==" - }, - "node_modules/nodemon": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.16.tgz", - "integrity": "sha512-zsrcaOfTWRuUzBn3P44RDliLlp263Z/76FPoHFr3cFFkOz0lTPAcIw8dCzfdVIx/t3AtDYCZRCDkoCojJqaG3w==", - "hasInstallScript": true, - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5", - "update-notifier": "^5.1.0" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/nodemon/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/nodemon/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/nodemon/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/nodemon/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/nodemon/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/normalize-html-whitespace": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/normalize-html-whitespace/-/normalize-html-whitespace-0.2.0.tgz", - "integrity": "sha512-5CZAEQ4bQi8Msqw0GAT6rrkrjNN4ZKqAG3+jJMwms4O6XoMvh6ekwOueG4mRS1LbPUR1r9EdnhxxfpzMTOdzKw==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/nosleep.js": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz", - "integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA==" - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-is": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", - "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/open": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz", - "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==", - "dependencies": { - "define-lazy-prop": "^2.0.0", - "is-docker": "^2.1.1", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/osc": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/osc/-/osc-2.4.5.tgz", - "integrity": "sha512-Nc4/qcl+vA/CMxiKS1xrYgzjfnyB3W94gZnrkn3eTzihlndbEml6+wj1YQNKBI4r+qrw3obCcEoU7SVH/OxpxA==", - "dependencies": { - "long": "4.0.0", - "slip": "1.0.2", - "wolfy87-eventemitter": "5.2.9", - "ws": "8.18.0" - }, - "optionalDependencies": { - "serialport": "12.0.0" - } - }, - "node_modules/osc/node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-locate/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dependencies": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dependencies": { - "defer-to-connect": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/package-json/node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" - }, - "node_modules/package-json/node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==" - }, - "node_modules/package-json/node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dependencies": { - "json-buffer": "3.0.0" - } - }, - "node_modules/package-json/node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==", - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, - "node_modules/package-json/node_modules/responselike/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/package-name-regex": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/package-name-regex/-/package-name-regex-2.0.6.tgz", - "integrity": "sha512-gFL35q7kbE/zBaPA3UKhp2vSzcPYx2ecbYuwv1ucE9Il6IIgBDweBlH8D68UFGZic2MkllKa2KHCfC1IQBQUYA==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/dword-design" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-author": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/parse-author/-/parse-author-2.0.0.tgz", - "integrity": "sha512-yx5DfvkN8JsHL2xk2Os9oTia467qnvRgey4ahSm2X8epehBLx/gWLcy5KI+Y36ful5DzGbCS6RazqZGgy1gHNw==", - "dependencies": { - "author-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==", - "dependencies": { - "pify": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pe-library": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pe-library/-/pe-library-1.0.1.tgz", - "integrity": "sha512-nh39Mo1eGWmZS7y+mK/dQIqg7S1lp38DpRxkyoHf0ZcUs/HDc+yyTjuOtTvSMZHmfSLuSQaX945u05Y2Q6UWZg==", - "engines": { - "node": ">=14", - "npm": ">=7" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/jet2jet" - } - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/plist": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", - "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", - "dependencies": { - "@xmldom/xmldom": "^0.8.8", - "base64-js": "^1.5.1", - "xmlbuilder": "^15.1.1" - }, - "engines": { - "node": ">=10.4.0" - } - }, - "node_modules/pngjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", - "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/postject": { - "version": "1.0.0-alpha.6", - "resolved": "https://registry.npmjs.org/postject/-/postject-1.0.0-alpha.6.tgz", - "integrity": "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==", - "dependencies": { - "commander": "^9.4.0" - }, - "bin": { - "postject": "dist/cli.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/postject/node_modules/commander": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", - "engines": { - "node": "^12.20.0 || >=14" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/prettier": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", - "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/pretty-hrtime": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/promise-retry": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", - "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", - "dependencies": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/psl": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", - "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", - "dependencies": { - "punycode": "^2.3.1" - }, - "funding": { - "url": "https://github.com/sponsors/lupomontero" - } - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" - }, - "node_modules/pump": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", - "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dependencies": { - "escape-goat": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/python-shell": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/python-shell/-/python-shell-3.0.1.tgz", - "integrity": "sha512-TWeotuxe1auhXa5bGRScxnc2J+0r41NBntSa6RYZtMBLtAEsvCboKrEbW6DvASosWQepVkhZZlT3B5Ei766G+Q==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/qrcode": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.1.tgz", - "integrity": "sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg==", - "dependencies": { - "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - }, - "bin": { - "qrcode": "bin/qrcode" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/qrcode/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/qrcode/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/qrcode/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/qrcode/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" - }, - "node_modules/qrcode/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" - }, - "node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==", - "dependencies": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==", - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/readdirp/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.2.tgz", - "integrity": "sha512-m03P+zhBeQd1RGnYxrGyDAPpWX/epKirLrp8e3qevZdVkKtnCrjjWczIbYc8+xd6vcTStVlqfycTx1KR4LOr0g==", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", - "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", - "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-errors": "^1.3.0", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "set-function-name": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/regexpu-core": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", - "integrity": "sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA==", - "dependencies": { - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.2.2", - "regjsgen": "^0.8.0", - "regjsparser": "^0.13.0", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.2.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/registry-auth-token": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.2.tgz", - "integrity": "sha512-PC5ZysNb42zpFME6D/XlIgtNGdTl8bBOCw90xQLVMpzuuubJKYDWFAEuUNc+Cn8Z8724tg2SDhDRrkVEsqfDMg==", - "dependencies": { - "rc": "1.2.8" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==" - }, - "node_modules/regjsparser": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.13.0.tgz", - "integrity": "sha512-NZQZdC5wOE/H3UT28fVGL+ikOZcEzfMGk/c3iN9UGxzWHMa1op7274oyiUVrAG4B2EuFhus8SvkaYnhvW92p9Q==", - "dependencies": { - "jsesc": "~3.1.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/replacestream": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", - "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", - "dependencies": { - "escape-string-regexp": "^1.0.3", - "object-assign": "^4.0.1", - "readable-stream": "^2.0.2" - } - }, - "node_modules/replacestream/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, - "node_modules/resedit": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/resedit/-/resedit-2.0.3.tgz", - "integrity": "sha512-oTeemxwoMuxxTYxXUwjkrOPfngTQehlv0/HoYFNkB4uzsP1Un1A9nI8JQKGOFkxpqkC7qkMs0lUsGrvUlbLNUA==", - "dependencies": { - "pe-library": "^1.0.1" - }, - "engines": { - "node": ">=14", - "npm": ">=7" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/jet2jet" - } - }, - "node_modules/resolve": { - "version": "1.22.11", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", - "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", - "dependencies": { - "is-core-module": "^2.16.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "engines": { - "node": ">=4" - } - }, - "node_modules/responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "dependencies": { - "lowercase-keys": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/roarr": { - "version": "2.15.4", - "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", - "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", - "optional": true, - "dependencies": { - "boolean": "^3.0.1", - "detect-node": "^2.0.4", - "globalthis": "^1.0.1", - "json-stringify-safe": "^5.0.1", - "semver-compare": "^1.0.0", - "sprintf-js": "^1.1.2" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/rollup": { - "version": "4.50.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.50.1.tgz", - "integrity": "sha512-78E9voJHwnXQMiQdiqswVLZwJIzdBKJ1GdI5Zx6XwoFKUIk09/sSrr+05QFzvYb8q6Y9pPV45zzDuYa3907TZA==", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.50.1", - "@rollup/rollup-android-arm64": "4.50.1", - "@rollup/rollup-darwin-arm64": "4.50.1", - "@rollup/rollup-darwin-x64": "4.50.1", - "@rollup/rollup-freebsd-arm64": "4.50.1", - "@rollup/rollup-freebsd-x64": "4.50.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.50.1", - "@rollup/rollup-linux-arm-musleabihf": "4.50.1", - "@rollup/rollup-linux-arm64-gnu": "4.50.1", - "@rollup/rollup-linux-arm64-musl": "4.50.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.50.1", - "@rollup/rollup-linux-ppc64-gnu": "4.50.1", - "@rollup/rollup-linux-riscv64-gnu": "4.50.1", - "@rollup/rollup-linux-riscv64-musl": "4.50.1", - "@rollup/rollup-linux-s390x-gnu": "4.50.1", - "@rollup/rollup-linux-x64-gnu": "4.50.1", - "@rollup/rollup-linux-x64-musl": "4.50.1", - "@rollup/rollup-openharmony-arm64": "4.50.1", - "@rollup/rollup-win32-arm64-msvc": "4.50.1", - "@rollup/rollup-win32-ia32-msvc": "4.50.1", - "@rollup/rollup-win32-x64-msvc": "4.50.1", - "fsevents": "~2.3.2" - } - }, - "node_modules/rollup-plugin-copy": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.5.0.tgz", - "integrity": "sha512-wI8D5dvYovRMx/YYKtUNt3Yxaw4ORC9xo6Gt9t22kveWz1enG9QrhVlagzwrxSC455xD1dHMKhIJkbsQ7d48BA==", - "dependencies": { - "@types/fs-extra": "^8.0.1", - "colorette": "^1.1.0", - "fs-extra": "^8.1.0", - "globby": "10.0.1", - "is-plain-object": "^3.0.0" - }, - "engines": { - "node": ">=8.3" - } - }, - "node_modules/rollup-plugin-copy/node_modules/@types/fs-extra": { - "version": "8.1.5", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.5.tgz", - "integrity": "sha512-0dzKcwO+S8s2kuF5Z9oUWatQJj5Uq/iqphEtE3GQJVRRYm/tD1LglU2UnXi2A8jLq5umkGouOXOR9y0n613ZwQ==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/rollup-plugin-copy/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/rollup-plugin-copy/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/rollup-plugin-license": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-3.6.0.tgz", - "integrity": "sha512-1ieLxTCaigI5xokIfszVDRoy6c/Wmlot1fDEnea7Q/WXSR8AqOjYljHDLObAx7nFxHC2mbxT3QnTSPhaic2IYw==", - "dependencies": { - "commenting": "~1.1.0", - "fdir": "^6.4.3", - "lodash": "~4.17.21", - "magic-string": "~0.30.0", - "moment": "~2.30.1", - "package-name-regex": "~2.0.6", - "spdx-expression-validate": "~2.0.0", - "spdx-satisfies": "~5.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" - } - }, - "node_modules/rollup-plugin-node-externals": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-externals/-/rollup-plugin-node-externals-8.1.2.tgz", - "integrity": "sha512-EuB6/lolkMLK16gvibUjikERq5fCRVIGwD2xue/CrM8D0pz5GXD2V6N8IrgxegwbcUoKkUFI8VYCEEv8MMvgpA==", - "funding": [ - { - "type": "patreon", - "url": "https://patreon.com/Septh" - }, - { - "type": "paypal", - "url": "https://paypal.me/septh07" - } - ], - "engines": { - "node": ">= 21 || ^20.6.0 || ^18.19.0" - }, - "peerDependencies": { - "rollup": "^4.0.0" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sass": { - "version": "1.89.2", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.89.2.tgz", - "integrity": "sha512-xCmtksBKd/jdJ9Bt9p7nPKiuqrlBMBuuGkQlkhZjjQk3Ty48lv93k5Dq6OPkKt4XwxDJ7tvlfrTa1MPA9bf+QA==", - "dependencies": { - "chokidar": "^4.0.0", - "immutable": "^5.0.2", - "source-map-js": ">=0.6.2 <2.0.0" - }, - "bin": { - "sass": "sass.js" - }, - "engines": { - "node": ">=14.0.0" - }, - "optionalDependencies": { - "@parcel/watcher": "^2.4.1" - } - }, - "node_modules/sass/node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/sass/node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/scope-css": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/scope-css/-/scope-css-1.2.1.tgz", - "integrity": "sha512-UjLRmyEYaDNiOS673xlVkZFlVCtckJR/dKgr434VMm7Lb+AOOqXKdAcY7PpGlJYErjXXJzKN7HWo4uRPiZZG0Q==", - "dependencies": { - "escaper": "^2.5.3", - "slugify": "^1.3.1", - "strip-css-comments": "^3.0.0" - } - }, - "node_modules/screenfull": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz", - "integrity": "sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==", - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", - "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", - "optional": true - }, - "node_modules/semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dependencies": { - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver-diff/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/serialize-error": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", - "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", - "optional": true, - "dependencies": { - "type-fest": "^0.13.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/serialize-error/node_modules/type-fest": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", - "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "optional": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/serialport": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/serialport/-/serialport-12.0.0.tgz", - "integrity": "sha512-AmH3D9hHPFmnF/oq/rvigfiAouAKyK/TjnrkwZRYSFZxNggJxwvbAbfYrLeuvq7ktUdhuHdVdSjj852Z55R+uA==", - "optional": true, - "dependencies": { - "@serialport/binding-mock": "10.2.2", - "@serialport/bindings-cpp": "12.0.1", - "@serialport/parser-byte-length": "12.0.0", - "@serialport/parser-cctalk": "12.0.0", - "@serialport/parser-delimiter": "12.0.0", - "@serialport/parser-inter-byte-timeout": "12.0.0", - "@serialport/parser-packet-length": "12.0.0", - "@serialport/parser-readline": "12.0.0", - "@serialport/parser-ready": "12.0.0", - "@serialport/parser-regex": "12.0.0", - "@serialport/parser-slip-encoder": "12.0.0", - "@serialport/parser-spacepacket": "12.0.0", - "@serialport/stream": "12.0.0", - "debug": "4.3.4" - }, - "engines": { - "node": ">=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/serialport/donate" - } - }, - "node_modules/serialport/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "optional": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/serialport/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "optional": true - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/set-function-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", - "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/slip": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/slip/-/slip-1.0.2.tgz", - "integrity": "sha512-XrcHe3NAcyD3wO+O4I13RcS4/3AF+S9RvGNj9JhJeS02HyImwD2E3QWLrmn9hBfL+fB6yapagwxRkeyYzhk98g==" - }, - "node_modules/slugify": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz", - "integrity": "sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/smob": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", - "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==" - }, - "node_modules/sortablejs": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.0.tgz", - "integrity": "sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w==" - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead" - }, - "node_modules/spdx-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", - "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", - "dependencies": { - "array-find-index": "^1.0.2", - "spdx-expression-parse": "^3.0.0", - "spdx-ranges": "^2.0.0" - } - }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-expression-validate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-validate/-/spdx-expression-validate-2.0.0.tgz", - "integrity": "sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg==", - "dependencies": { - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.22", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.22.tgz", - "integrity": "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==" - }, - "node_modules/spdx-ranges": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz", - "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==" - }, - "node_modules/spdx-satisfies": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-5.0.1.tgz", - "integrity": "sha512-Nwor6W6gzFp8XX4neaKQ7ChV4wmpSh2sSDemMFSzHxpTw460jxFYeOn+jq4ybnSSw/5sc3pjka9MQPouksQNpw==", - "dependencies": { - "spdx-compare": "^1.0.0", - "spdx-expression-parse": "^3.0.0", - "spdx-ranges": "^2.0.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", - "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "optional": true - }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stack-generator": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.10.tgz", - "integrity": "sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==", - "dependencies": { - "stackframe": "^1.3.4" - } - }, - "node_modules/stackframe": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", - "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==" - }, - "node_modules/stacktrace-gps": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-3.1.2.tgz", - "integrity": "sha512-GcUgbO4Jsqqg6RxfyTHFiPxdPqF+3LFmQhm7MgCuYQOYuWyqxo5pwRPz5d/u6/WYJdEnWfK4r+jGbyD8TSggXQ==", - "dependencies": { - "source-map": "0.5.6", - "stackframe": "^1.3.4" - } - }, - "node_modules/stacktrace-gps/node_modules/source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha512-MjZkVp0NHr5+TPihLcadqnlVoGIoWo4IBHptutGh9wI3ttUYvCG26HkSuDi+K6lsZ25syXJXcctwgyVCt//xqA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stacktrace-js": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-2.0.2.tgz", - "integrity": "sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg==", - "dependencies": { - "error-stack-parser": "^2.0.6", - "stack-generator": "^2.0.5", - "stacktrace-gps": "^3.0.4" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/strictdom": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strictdom/-/strictdom-1.0.1.tgz", - "integrity": "sha512-cEmp9QeXXRmjj/rVp9oyiqcvyocWab/HaoN4+bwFeZ7QzykJD6L3yD4v12K1x0tHpqRqVpJevN3gW7kyM39Bqg==" - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/strip-css-comments": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-css-comments/-/strip-css-comments-3.0.0.tgz", - "integrity": "sha512-xJwk2yMZ6j+0Clj7ETUfqQ6frsaCIqNGg3zjTVswIt3SbiOsCQgRI1E93hdt/JgGfh5De/sTwxrnrBhhWzMwcg==", - "dependencies": { - "is-regexp": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-outer/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/sumchecker": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", - "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", - "dependencies": { - "debug": "^4.1.0" - }, - "engines": { - "node": ">= 8.0" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/terser": { - "version": "5.44.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.1.tgz", - "integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==", - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.15.0", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" - }, - "node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/thunky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", - "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" - }, - "node_modules/tiny-each-async": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/tiny-each-async/-/tiny-each-async-2.0.3.tgz", - "integrity": "sha512-5ROII7nElnAirvFn8g7H7MtpfV1daMcyfTGQwsn/x2VtyV+VPiO5CjReCJtWLvoKTDEDmZocf3cNPraiMnBXLA==", - "optional": true - }, - "node_modules/tmp": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", - "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", - "optional": true, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/tmp-promise": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", - "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", - "optional": true, - "dependencies": { - "tmp": "^0.2.0" - } - }, - "node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "engines": { - "node": ">=6" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/transform-ast": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/transform-ast/-/transform-ast-2.4.4.tgz", - "integrity": "sha512-AxjeZAcIOUO2lev2GDe3/xZ1Q0cVGjIMk5IsriTy8zbWlsEnjeB025AhkhBJHoy997mXpLd4R+kRbvnnQVuQHQ==", - "dependencies": { - "acorn-node": "^1.3.0", - "convert-source-map": "^1.5.1", - "dash-ast": "^1.0.0", - "is-buffer": "^2.0.0", - "magic-string": "^0.23.2", - "merge-source-map": "1.0.4", - "nanobench": "^2.1.1" - } - }, - "node_modules/transform-ast/node_modules/magic-string": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.23.2.tgz", - "integrity": "sha512-oIUZaAxbcxYIp4AyLafV6OVKoB3YouZs0UTCJ8mOKBHNyJgGDaMJ4TgA+VylJh6fx7EQCC52XkbURxxG9IoJXA==", - "dependencies": { - "sourcemap-codec": "^1.4.1" - } - }, - "node_modules/trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/trim-repeated/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/ua-is-frozen": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz", - "integrity": "sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - } - ] - }, - "node_modules/ua-parser-js": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-2.0.7.tgz", - "integrity": "sha512-CFdHVHr+6YfbktNZegH3qbYvYgC7nRNEUm2tk7nSFXSODUu4tDBpaFpP1jdXBUOKKwapVlWRfTtS8bCPzsQ47w==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - }, - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - } - ], - "dependencies": { - "detect-europe-js": "^0.1.2", - "is-standalone-pwa": "^0.1.1", - "ua-is-frozen": "^0.1.2" - }, - "bin": { - "ua-parser-js": "script/cli.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" - }, - "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", - "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.1.tgz", - "integrity": "sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.2.0.tgz", - "integrity": "sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dependencies": { - "crypto-random-string": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/unix-crypt-td-js": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/unix-crypt-td-js/-/unix-crypt-td-js-1.1.4.tgz", - "integrity": "sha512-8rMeVYWSIyccIJscb9NdCfZKSRBKYTeVnwmiRYT2ulE3qd1RaDQ0xQDP+rI3ccIWbhu/zuo5cgN8z73belNZgw==" - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dependencies": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/yeoman/update-notifier?sponsor=1" - } - }, - "node_modules/upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==" - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==", - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", - "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==" - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/verror/node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" - }, - "node_modules/widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dependencies": { - "string-width": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wolfy87-eventemitter": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz", - "integrity": "sha512-P+6vtWyuDw+MB01X7UeF8TaHBvbCovf4HPEMF/SV7BdDc1SMTiBy13SRD71lQh4ExFTG1d/WNzDGDCyOKSMblw==" - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/ws": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz", - "integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/xmlbuilder": { - "version": "15.1.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", - "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", - "engines": { - "node": ">=8.0" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, - "node_modules/yargs": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "engines": { - "node": ">=12" - } - }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/package.json b/package.json index 9bc10d3d..25d3a65d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.31.2", + "version": "0.49.12", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" @@ -15,96 +15,89 @@ ], "repository": { "type": "git", - "url": "https://framagit.org/jean-emmanuel/open-stage-control" + "url": "https://github.com/jean-emmanuel/open-stage-control" }, "homepage": "http://openstagecontrol.ammd.net/", "license": "GPL-3.0", "dependencies": { - "@babel/core": "7.18.0", - "@babel/preset-env": "7.18.0", - "@electron/packager": "18.4.4", - "@electron/remote": "2.1.3", - "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-commonjs": "^28.0.6", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^16.0.1", - "@rollup/plugin-terser": "^0.4.4", - "ace-builds": "1.39.0", - "ansi-html": "0.0.9", + "@babel/compat-data": "7.8.0", + "@babel/core": "7.8.3", + "@babel/plugin-proposal-object-rest-spread": "7.8.3", + "@babel/polyfill": "7.8.3", + "@babel/preset-env": "7.8.7", + "ansi-html": "0.0.7", + "babel-eslint": "10.0.3", "babelify": "10.0.0", - "balanced-match": "2.0.0", - "bonjour": "git+https://framagit.org/jean-emmanuel/bonjour.git", - "chokidar": "3.5.3", - "chroma-js": "2.4.2", - "core-js": "3.22.5", + "bonjour": "github:jean-emmanuel/bonjour", + "browserify": "16.5.0", + "cardinal-spline-js": "2.3.10", + "core-js": "3.6.4", "cpr": "3.0.1", "deep-extend": "0.6.0", "electron-localshortcut": "3.2.1", + "electron-packager": "14.2.0", "electron-packager-plugin-non-proprietary-codecs-ffmpeg": "1.0.2", - "env-paths": "2.2.1", - "eslint": "8.16.0", - "fastdom": "1.0.10", - "file-saver": "2.0.5", - "http-auth": "4.1.9", - "json5": "2.2.1", + "eslint": "6.8.0", + "exorcist": "1.0.1", + "file-saver": "2.0.2", + "gyronorm": "2.0.6", + "jquery": "3.4.1", + "json5": "2.1.1", "jsondiffpatch": "0.4.1", - "keyboardjs": "2.6.4", - "minimatch": "5.1.0", - "nanohtml": "1.10.0", - "nanoid": "3.3.4", - "nanomorph": "5.4.3", - "node-forge": "1.3.1", - "node-mouse": "0.0.2", - "nodemon": "2.0.16", - "nosleep.js": "0.12.0", - "open": "8.4.0", - "osc": "2.4.5", - "python-shell": "3.0.1", - "qrcode": "1.5.1", - "replacestream": "4.0.3", - "rollup": "4.50.1", - "rollup-plugin-copy": "3.5.0", - "rollup-plugin-license": "^3.6.0", - "rollup-plugin-node-externals": "^8.1.1", - "sass": "1.89.2", + "keyboardjs": "github:jean-emmanuel/KeyboardJS", + "licensify": "3.1.3", + "loop-protect": "github:jean-emmanuel/loop-protect#v1.0.1", + "mathjs": "5.10.0", + "minimatch": "3.0.4", + "nanohtml": "1.9.0", + "nanoid": "2.1.10", + "nanomorph": "5.4.0", + "node-sass": "4.13.1", + "nodemon": "2.0.2", + "nosleep.js": "0.9.0", + "osc": "2.4.0", + "python-shell": "1.0.8", + "sanitize-html": "1.20.1", "scope-css": "1.2.1", - "screenfull": "5.2.0", - "semver": "7.3.7", - "send": "0.18.0", - "sortablejs": "1.15.0", - "source-map-support": "0.5.21", + "screenfull": "5.0.1", + "send": "0.17.1", + "source-map-support": "0.5.16", "stacktrace-js": "2.0.2", - "ua-parser-js": "2.0.7", - "ws": "8.6.0", - "yargs": "17.5.1" + "through": "2.3.8", + "uglifyify": "5.0.2", + "webworkify": "1.5.0", + "ws": "7.2.1", + "yargs": "15.1.0" }, "optionalDependencies": { - "electron": "36.9.5", - "electron-installer-debian": "3.1.0", - "electron-installer-redhat": "git+https://framagit.org/jean-emmanuel/electron-installer-redhat.git" + "electron": "7.1.11", + "electron-installer-debian": "3.0.0" }, "scripts": { "postinstall": "echo '\\033[36m=> Dependencies installed successfully. Run \"npm run build\" to build the assets.\\033[0m\n'", "start": "electron app/", - "build": "npm run build-css && npm run build-js && echo '\\033[36m=> JS and CSS assets built successfully. Run \"npm run package\" to build an executable or \"npm start\" to run the app.\\033[0m\n'", + "build": "npm run build-css && npm run build-js && node scripts/copy-assets.js && echo '\\033[36m=> JS and CSS assets built successfully. Run \"npm run package\" to build an executable or \"npm start\" to run the app.\\033[0m\n'", "package": "node scripts/package.js", + "package-rpi": "node scripts/package.js --old-rpi", "package-node": "node scripts/package-node.js", - "deb64": "electron-installer-debian --src dist/open-stage-control-linux-x64/ --arch amd64 --dest dist/ --icon resources/images/logo.png", - "rpm64": "electron-installer-redhat --src dist/open-stage-control-linux-x64/ --arch x86_64 --dest dist/ --icon resources/images/logo.png", + "deb32": "electron-installer-debian --src dist/open-stage-control-linux-ia32/ --arch i386 --dest dist/open-stage-control-linux-ia32/ --icon resources/images/logo.png", + "deb64": "electron-installer-debian --src dist/open-stage-control-linux-x64/ --arch amd64 --dest dist/open-stage-control-linux-x64/ --icon resources/images/logo.png", + "debarm": "electron-installer-debian --src dist/open-stage-control-linux-armv7l/ --arch armv7l --dest dist/open-stage-control-linux-armv7l/ --icon resources/images/logo.png", "build-css": "node scripts/build-css.js", - "watch-css": "nodemon --watch src/scss -e scss -x \"npm run build-css -- --reload\"", - "build-js": "npm run build-launcher-js && npm run build-client-js && npm run build-server-js", - "build-client-js": "rollup -c scripts/client.rollup.config.js", + "build-js": "npm run build-launcher-js && npm run build-client-js -- --prod && npm run build-server-js", + "build-client-js": "node scripts/build-client.js", + "build-launcher-js": "node scripts/build-launcher.js", + "build-server-js": "node scripts/build-server.js", "watch-client": "npm run build-client-js -- --watch", - "build-server-js": "rollup -c scripts/server.rollup.config.js", - "watch-server": "npm run build-server-js -- --watch", - "build-launcher-js": "rollup -c scripts/launcher.rollup.config.js", - "watch-launcher": "npm run build-launcher-js -- --watch", - "build-docs": "rollup -c scripts/docs.rollup.config.js && node src/docs/widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && python3 -m mkdocs build", - "lint": "eslint src --ext mjs", - "test": "npm run lint && npm run build" + "watch-browser": "npm run build-client-js -- --watch", + "watch-css": "nodemon --watch src/scss -e scss -x \"npm run build-css -- --reload\"", + "build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets-reference.md && cd resources && npm run build", + "test": "eslint src && npm run build && node tests/test.js" }, "engines": { - "node": ">=16" + "node": ">=6" + }, + "devDependencies": { + "watchify": "3.11.1" } } diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 00000000..4c7cb9f5 --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1,3 @@ +theme/styles.css +site/* +!site/.htaccess diff --git a/resources/README.md b/resources/README.md index ebcd94c9..c7520065 100644 --- a/resources/README.md +++ b/resources/README.md @@ -1,9 +1,9 @@ # How to build the docs ```bash -# https://squidfunk.github.io/mkdocs-material/getting-started/ -$ python3 -m pip install mkdocs-material - +$ sudo apt-get install python python-pip # python package manager +$ sudo pip install mkdocs # docs site builder +$ sudo pip install mkdocs-material # theme $ mkdocs serve # make docs available on http://127.0.0.1:8000 # or diff --git a/resources/docs/docs.md b/resources/docs/docs.md new file mode 120000 index 00000000..2539e41e --- /dev/null +++ b/resources/docs/docs.md @@ -0,0 +1 @@ +docs/getting-started.md \ No newline at end of file diff --git a/resources/docs/docs/advanced-property-syntax.md b/resources/docs/docs/advanced-property-syntax.md new file mode 100644 index 00000000..6efdfa87 --- /dev/null +++ b/resources/docs/docs/advanced-property-syntax.md @@ -0,0 +1,101 @@ +# Advanced property syntax + +## Inheritance: `@{id.property}` + +Widgets can use each other's properties values and update automatically when they change by using this syntax. + +- `id`: the target widget's `id` +- `property`: is the target widget's property name + + +#### Value + +The property name (and the dot) can be omitted and defaults to `value` (`@{widgetId}` => `@{widgetId.value}`). `value` always resolves to the target widget's current value, not its `value` property + +#### `this` & `parent` + +A widget can fetch its own properties or its direct parent's by using the keywords `this` or `parent` instead of `id`. When `this` or `parent` can be used, using the target widget's `id` instead won't work. + +#### Dynamic properties + +Some properties, when changed, trigger a complete widget recreation that ends any ongoing user interaction. Also, updating these properties continuously (e.g. when linked to a slider's dynamic value) can be very cpu expensive. + +Some properties have much cheaper update routines and can be considered as `dynamic`, as in performance safe. These properties are marked in the documentation with a . + + +#### Circular references cases + +- container widgets can inherit their children's properties only to define `dynamic` properties +- widgets can inherit their own `value` property only to define `dynamic` properties + +#### Object properties + +If the retreived property is an object (`{}`) or an array (`[]`), a subset can be retreived directly by appending a dot and a key (array index or object key) : `@{parent.variables.key}` + + +#### Nesting + +The inheritance syntax supports 1-level nesting : `@{fader_@{toggle_1}}` + + +## OSC listeners: `OSC{address, default, usePreArgs}` + +This syntax allows listening on an osc address to define a property. + +- `address`: osc address to listen to; if the leading slash (`/`) is omitted, the address will be prefixed with the widget's `address` property +- `default` (optional): default value returned before any message is received +- `usePreArgs` (optional): by default, osc listeners inherit the widget's `preArgs` and (these must be matched for the osc messages to be processed). Set to `false` bypass them. + + +#### Dynamic address + +The `address` can contain `@{}` blocks + + + +## Javascript: `JS{{ }}` + +This syntax allows writing formulas in pure javascript. The code will be compiled as a function and executed in a restricted context. + +- if no `return` statement is found, the formula will return an empty string +- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled +- `setTimeout` and `setInterval` functions are not available +- the `global` object is shared between all javascript formulas (changing its properties *does not* trigger any synchronisation even if the value is used somewhere else) + +In this context, `@{} / OSC{}` are seen as variables, not as the value they hold, + +Parsing errors can be read in the DevTool console (F12). + +## Formulas: `#{}` + +!!! warning "Deprecated" + This syntax is now deprecated and will be removed in the future, sessions using it will be working for a few more versions but users are strongly encouraged to migrate to the javascript syntax. + +The following syntax allow writing mathematical formulas in widgets' properties: + +``` +#{FORMULA} +``` + +Where FORMULA is a valid [MathJS](http://mathjs.org/docs/expressions/syntax.html) expression: + +- [syntax documentation](http://mathjs.org/docs/expressions/syntax.html) +- [available functions](http://mathjs.org/docs/reference/functions.html) +- [available constants](http://mathjs.org/docs/reference/constants.html) +- formulas can be [multiline](http://mathjs.org/docs/expressions/syntax.html#multiline-expressions) +- property inheritance calls (`@{...}`) are always resolved before formulas +- arrays / matrices indexes are **zero-based** (ie `["a","b"][0]` returns `"a"`) +- strings can be multiline when enclosed in backticks instead of double quotes (``` ` ` ```) + +Additionnal functions: + +- `indexOf(a, x)`: returns index of item `x` in array `a` +- `unpack(x)`: remove an array's brackets (`unpack([1,2])` returns `"1, 2"`) +- `pad(x, padding)`: add leading zeros if the length of the integer part of `x` is smaller than `padding` (`pad(1,2)` returns `"01"`) +- `length(x)`: returns the length of an array or string +- `keys(x)`: returns an array of a given object's property names (from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)) +- `values(x)`: returns an array of a given object's own enumerable property values (from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values)) +- `extend(x, y)`: merges two objects into one + +!!! tip "" + A single widget property can contain multiple formulas. Variables and functions declared in a formula are available to subsequent formulas in the same property definition. diff --git a/resources/docs/docs/changelog.md b/resources/docs/docs/changelog.md deleted file mode 120000 index 79b747ae..00000000 --- a/resources/docs/docs/changelog.md +++ /dev/null @@ -1 +0,0 @@ -../../../CHANGELOG.md \ No newline at end of file diff --git a/resources/docs/docs/client-options.md b/resources/docs/docs/client-options.md deleted file mode 100644 index 0a6e4a7b..00000000 --- a/resources/docs/docs/client-options.md +++ /dev/null @@ -1,26 +0,0 @@ -Client options can be set either with the server's `--client-options` option, or per client by adding query parameters to the server's url. One must prepend the url with a question mark (`?`) followed by `parameter=value` pairs separated with ampersands (`&`). - - -| Option | Value | Default | Description | -|----|----|----|----| -| hdpi | 1 / 0 | 0 | enable high resolution canvas | -| forceHdpi | number | 0 | force canvas scaling (ignore `hdpi`) | -| doubleTap | number | 375 | sets the double tap/click time threshold in milliseconds | -| zoom | number | 1 | sets the initial zoom | -| framerate | number | 60 | limit canvas drawing framerate | -| desyncCanvas | number | 0 | set to 1 to enable desynchronized canvas (may improve rendering performances) | -| lang | string | *system_default* | use a different language than the default if available (available languages: en, fr, de, pl) | -| consoleLength | number | 300 | sets the maximum number of log messages in the client's console | -| id | string | *random_id* | client's unique id (use with caution: two clients should never have the same id) | -| usePercents | 1 / 0 | 0 | sets the editor's "relative units" option | -| noFocus | 1 / 0 | 0 | (built-in client only) prevent the client window from taking focus | -| clientSync | 1 / 0 | 1 | set to 0 to prevent the client from syncing with other clients | -| altTraversing | 1 / 0 | 0 | set to 1 to enable an alternative traversing behavior for toggle buttons (traversing gestures on toggle buttons will change their values in only one way depending on the first touched button's state) | -| virtualKeyboard | 1 / 0 | 0 | (desktop only) set to 1 to enable the virtual keyboard by default | -| notifications | 1 / 0 | 1 | set to 0 to hide notifications by default | -| title | string | '' | replace window title | -| noWarning | 1 / 0 | 0 | set to 0 to disable unsaved session warnings | - -Example: - -`http://server-ip:port?hdpi=1` diff --git a/resources/docs/docs/credits.md b/resources/docs/docs/credits.md index cdbd8df7..f19ae400 100644 --- a/resources/docs/docs/credits.md +++ b/resources/docs/docs/credits.md @@ -1,40 +1,12 @@ ## License -Copyleft © Jean-Emmanuel Doucet 2014-2025. -This program is a free software released under the [GNU/GPL3](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE) license. +Copyleft © Jean-Emmanuel Doucet @ [AMMD](http://ammd.net) 2014-2020. +This program is a free software released under the [GNU/GPL3](https://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE) license. ## Dependencies -Open Stage Control relies on several other free softwares listed in [package.json](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/package.json). - -The default theme was based on [Nord](https://www.nordtheme.com/), some UI components were inspired by the text editor formerly known as Atom (now [Pulsar](https://pulsar-edit.dev/)). +Open Stage Control relies on several other free softwares, including [Node.js](https://nodejs.org/), [Electron](http://electron.atom.io/), [osc.js](https://github.com/colinbdclark/osc.js), [babel](http://babeljs.io/), [browserify](http://browserify.org), [exorcist](https://github.com/thlorenz/exorcist), [express](http://expressjs.com), [node-sass](https://github.com/sass/node-sass), [jQuery](http://jquery.com/), [jQuery-UI](http://jqueryui.com/), [Font Awesome](http://fontawesome.io/), [stacktracejs](http://stacktracejs.com), [mathjs](http://mathjs.org/). A comprehensive and up-to-date list can be found [here](https://github.com/jean-emmanuel/open-stage-control/network/dependencies). ## Contributors -[Jean-Emmanuel](https://framagit.org/jean-emmanuel), [MartinHN](https://github.com/MartinHN), [Eric Theise](https://github.com/erictheise), [danielappelt](https://github.com/erictheise), [ritschwumm](https://github.com/ritschwumm), [matthijskooijman](https://github.com/matthijskooijman), [WillyKaze](https://github.com/WillyKaze), [stefanboca](https://github.com/stefanboca), [pixelnerve](https://github.com/pixelnerve), [AdamAdamsMusic](https://github.com/AdamAdamsMusic), [wicast](https://github.com/wicast), [kdallafior](https://github.com/kdallafior), [brunetton](https://github.com/brunetton), [cyberic99](https://github.com/cyberic99), [kdejaeger](https://github.com/kdejaeger), [trebmuh](https://github.com/trebmuh), [MagnusReichel](https://github.com/MagnusReichel), [jpcima](https://github.com/jpcima), [t1st3](https://github.com/t1st3") - -## Infrastructure supports - ----- - - - -AMMD hosts this website and made this project possible by funding its first 2 years of development. - ----- - - - -Discourse provides the community forum. - ----- - - - -BrowserStack provides remote browsers for debugging. +https://github.com/jean-emmanuel/open-stage-control/graphs/contributors diff --git a/resources/docs/docs/customization/css-tips.md b/resources/docs/docs/css-tips.md similarity index 50% rename from resources/docs/docs/customization/css-tips.md rename to resources/docs/docs/css-tips.md index 95e7c236..a06d9c52 100644 --- a/resources/docs/docs/customization/css-tips.md +++ b/resources/docs/docs/css-tips.md @@ -1,17 +1,11 @@ # CSS Tips -## Browser inspector - - -Hit ++f12++ to open the developers tools panel. The html/css inspector helps retrieving the class names needed to style specific parts of the widgets: hit ++ctrl+shift+c++ or click on the inspect icon (![x](/img/inspect.png)) and click on a element in the interface to reveal its html code. - - ## Inline syntax For simple use cases, the `css` property can be written as a HTML inline styles (without any CSS selector). CSS rules will apply to the widget element. ```css -opacity: 0.5; /* make the widget transparent */ +opacity: 0.5; /* make the widget's transparent */ font-size: 120%; /* increase font-size */ ``` @@ -27,17 +21,17 @@ CSS selectors can be used to apply styles to specific elements: */ } -label { - /* style for the label elements */ +.label { + /* style for the .label elements */ } -> label { - /* style for the direct child label element */ +> .label { + /* style for the direct child .label element */ } ``` -!!! info "" +!!! warning "" Mixing Inline and Selector syntaxes doesn't work, once you use selectors, you have to use the `:host` selector to target the widget element. ## Extra css classes: `class` @@ -45,16 +39,23 @@ label { This non-standard css property can be used to add custom css classes to the widget element: `class: my-custom-class;` Multiple classes can be added (one per `class` statement). Custom classes are always added to the widget's root element, css selectors are ignored. -!!! info "" +!!! warning "" Using class names that are already used in the app can be hazardous. In order to avoid that, custom class names should be prefixed with something uncommon and preferably cool, such as `xxx-myclass` or `crispy-seitan-myclass`. ## Layering: `z-index` -Z-Axis ordering can be set using the `z-index` rule. Widgets positioned at absolute coordinates (when `top` or `left` is different from `auto`) have `z-index:10;` by default. +Z-Axis ordering can be set using the `z-index` rule. Absolutely positionned widgets (when `top` or `left` is different from `auto`) have `z-index:10;` by default. + +## Layering: `pointer-events` + +To make a widget ignore interactions (ie to be able to click through it), add `pointer-events:none;`. + +!!! note "" + This is always ignored when the editor is enabled. ## Responsive sizing -In most cases, using `vertical`, `horizontal` or `grid` layouts as well as using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts): +In most cases, using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts): ```css :host { @@ -85,16 +86,22 @@ Media queries can also be used: - use `%` for font-size -## CSS variables +## CSS Variables -[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overridden. +CSS Variables declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overriden. Some widgets also use specific CSS variables (mostly to define colors) documented on their respective pages. -Widgets also rely on CSS variables for the style properties (colors, padding, etc). These are documented in the widgets' `css` property description. +## Other tips -# Loading images +#### Use the inspector -Image urls are resolved in this order: -- in the session's directory -- in theme's directory -- in the server's `remote-root` directory if the option is set -- as absolute paths +Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets. + +#### Panel's background-color + +This works for panel, strip and tabs: + +```css +> .panel { + background-color: red; +} +``` diff --git a/resources/docs/docs/custom-module.md b/resources/docs/docs/custom-module.md new file mode 100644 index 00000000..669f43fe --- /dev/null +++ b/resources/docs/docs/custom-module.md @@ -0,0 +1,126 @@ +# Custom module + +## Writing a custom module + +Using the `-c / --custom-module` command-line switch, users can load a javascript file to tune the way Open Stage Control behaves regarding osc. + +```js + +// Do whatever you want, initialize some variables, declare some functions, ... + +module.exports = { + + init: function(){ + // this will be executed once when the osc server starts + }, + + oscInFilter:function(data){ + // Filter incomming osc messages + + var {address, args, host, port} = data + + // do what you want + + // address = string + // args = array of {value, type} objects + // host = string + // port = integer + + // return data if you want the message to be processed + return {address, args, host, port} + + }, + + oscOutFilter:function(data){ + // Filter outgoing osc messages + + var {address, args, host, port} = data + + // same as oscInFilter + + // return data if you want the message to be and sent + return {address, args, host, port} + } + +} + +``` + +## Available globals + +The module is executed in a restricted context, only a few globals are available : + +- `console`: `object` +- `sendOsc`: `function({host, port, address, args})` +- `receiveOsc`: `function({host, port, address, args})` +- `send`: `function(host, port, address, arg1, arg2, ...)` +- `receive`: `function(host, port, address, arg1, arg2, ...)` +- `receive`: `function(address, arg1, arg2, ...)` +- `setTimeout`: `function(function, delay)` +- `clearTimeout`: `function(timeout)` +- `setInterval`: `function(function, delay)` +- `clearInterval`: `function(interval)` +- `settings.read`: `function(name)`, see [settings.js](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/server/settings.js#L55-L103) for available options +- `app`: an [event emitter](https://nodejs.org/api/events.html#events_class_eventemitter) for monitoring the events sent by the different clients. Event names can be found in [callbacks.js](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/server/callbacks.js), callbacks are called with 2 arguments: `data` (object) and `client` (object: `{address, id}`) +- `options`: `array` containing the extra options passed to `--custom-module` after the filename +- `loadJSON`: `function(path)` loads a json file (path is relative to the custom module location) +- `saveJSON`: `function(path, object)` save an object/array to a json file (path is relative to the custom module location) + + +`sendOsc` and `receiveOsc` expect arguments formatted as follow: + +- `address`: `string` +- `args`: `array` of `{type: "OSC_TYPE_LETTER", value: VALUE}` `objects` +- `host`: `string` ip address, valid hostname or `midi` +- `port`: `integer` port number or `string` midi device name + +`send` and `receive` are shorthands for `sendOsc` and `receiveOsc` that don't require args to be formatted as objects (numbers are casted to floats by default): + +```js +// calling +send('127.0.0.1', 5555, '/test' 1, 2, {type: 'i', value: 3}) + +// equals +sendOsc({ + host: '127.0.0.1', + port: 5555, + address: '/test', + args: [ + {type: 'f', value: 1}, + {type: 'f', value: 2}, + {type: 'i', value: 3}, + ] +}) +``` + +## Managing big modules + +Custom modules don't let you use node's `require` function at runtime, but you can manage your sources in multiple files and bundle them into a single file before loading it in Open Stage Control. + +The common pattern for this is using the [browserify](http://browserify.org/) library: + +**1**. define some variable in `number.js` + +```javascript +module.exports = 42 +``` + +**2**. retreive it in your main module file (`main.js`): + +```javascript +var num = require('./number.js') + +module.exports = { + init: function(){ + console.log(num) // 42 + }, + oscInFilter: function(data){ + // etc + } +} +``` + + +**3**. bundle your sources into `custom-module.js`: + +`browserify main.js -o custom-module.js --standalone module.exports` diff --git a/resources/docs/docs/custom-module/custom-module.md b/resources/docs/docs/custom-module/custom-module.md deleted file mode 100644 index 985c5eed..00000000 --- a/resources/docs/docs/custom-module/custom-module.md +++ /dev/null @@ -1,220 +0,0 @@ -# Custom module - -Using the server's `custom-module` option, users can load a custom javascript module that filters incoming and outgoing OSC / MIDI messages. - -## Writing a custom module - - -```js - -// Do whatever you want -// initialize variables -// declare functions -// listen to app events -// load modules -// etc - -module.exports = { - - init: function(){ - // this will be executed once when the osc server starts after - // connections are set up - // it is called for the main module only - }, - - stop: function(){ - // this will be executed once when the osc server stops - // it is called for the main module only - }, - - reload: function(){ - // this will be executed after the custom module is reloaded - // it is called for the main module only - }, - - oscInFilter:function(data){ - // Filter incoming osc messages - - var {address, args, host, port} = data - - // do what you want - - // address = string - // args = array of {value, type} objects - // host = string - // port = integer - - // return data if you want the message to be processed - return {address, args, host, port} - - }, - - oscOutFilter:function(data){ - // Filter outgoing osc messages - - var {address, args, host, port, clientId} = data - - // same as oscInFilter - - // return data if you want the message to be and sent - return {address, args, host, port} - }, - - unload: function(){ - // this will be executed before the custom module is reloaded - // it is called for all modules, including other loaded modules - }, - -} - -``` - -## Available globals - -The module is executed in a restricted context, only a few globals are available : - ----- - -#### `app` -[`Event Emitter`](https://nodejs.org/api/events.html#events_class_eventemitter), useful for monitoring the events sent by the different clients. Event names can be found in [callbacks.js](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/src/server/node/ipc/callbacks.mjs), callbacks are called with 2 arguments: `data` (object) and `client` (object: `{address, id}`) - ----- - -#### `receive(host, port, address, ...args, options)` - -Send osc/midi message to connected clients. `host` and `port` can be specified to simulate a specific origin for the message. - -- `host` (optional): `string` ip address, valid hostname or `"midi"` -- `port` (optional): `integer` port number or `string` midi device name -- `address`: osc address -- `args`: value or `{type: "OSC_TYPE_LETTER", value: VALUE}` `object` (objects that don't match this format will simply be turned to a JSON string). -- `options` (optional): set to `{clientId: id}` to define which client receives the message (where `id` is the client's id as retrieved from `app` events or `oscOutFilter`) - -For convenience, `host` and `port` can be provided both as single string argument joined with a colon. - ----- - -#### `send(host, port, address, ...args)` - -Send osc/midi to a target (see `receive()`). - ----- - -#### `settings.read(name)` - -Returns specified server option. `name` must be the option's long name without the leading dashes (ie: `"send"`, not `"s"`) - ----- - -#### `settings.appAddresses()` - -Returns the server's http addresses. - ----- - -#### `loadJSON(path, errorCallback)` - -Loads a json file (path is relative to the custom module location) - -- `path`: `string`, path to file (any extension allowed, but the content must be valid JSON) -- `errorCallback` (optional): `function`, called with the error as argument if the file can't be loaded - - ----- - -#### `saveJSON(path, data, errorCallback)` - -Saves an object/array to a json file (path is relative to the custom module location) - -- `path`: `string`, path to file (any extension allowed) -- `data`: `object`, `array` or any value that can be encoded to JSON -- `errorCallback` (optional): `function`, called with the error as argument if the file can't be loaded - ----- - -#### `require(path)` - -Load another javascript module. Returns the value of `module.exports` defined in this module. If `path` is a relative path, it will be resolved against its parent module's path. See [Managing Big Modules](../managing-big-modules). - -This function is different from node's native `require` function, it's merely a way to split a custom module into separate files. - ----- - -#### `nativeRequire(moduleName)` - -This function can be used to load native node modules or locally installed modules (e.g. with npm) if a `node_modules` folder is found in the custom module's location. - -??? "Installing node modules: resources" - - https://nodejs.dev/ - - https://nodejs.dev/learn/an-introduction-to-the-npm-package-manager - - https://nodejs.dev/learn/the-package-json-guide - ----- - -#### `tcpServer` - -Raw access to the server's [TCP backend](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/src/server/node/osc/tcp.mjs). Can be used to monitor the state of TCP connections: - -```js -for (var ip in tcpServer.clients) { - tcpServer.clients[ip].port.on('ready', ()=>{ - console.log(`TCP connection established with ${ip}:${tcpServer.clients[ip].remotePort}`) - }) - tcpServer.clients[ip].port.on('close', ()=>{ - console.log(`TCP connection lost with ${ip}:${tcpServer.clients[ip].remotePort}`) - }) -} -``` - - -#### `restartMidiBackend()` - -This function can be used to restart the midi backend (if already running) without restarting the server - -#### Other javascript globals - -- `console` -- `setTimeout` -- `clearTimeout` -- `setInterval` -- `clearInterval` -- `__dirname` -- `__filename` -- `process` -- `global` - ----- - - -## Autoreload - -Custom modules (including submodules loaded with `require()`) are reloaded automatically when they are modified. Upon reload, timers (`setTimeout` and `setInterval`) and event listeners (added to the  `app` object) are reset. After each reload the `module.exports.reload()` function (if any) is called. - -The `global` object persists accross reloads. - -??? "Reloading native modules" - - When using modules loaded with `nativeRequire()`, you may need to tell the custom module how to unload some components to allow reloading using the `module.exports.unload` definition. For example, if a port is bound using the `http` module, you'll need to unbind it otherwise the custom module will fail to bind it again when reloading: - - ```js - - var http = nativeRequire('http'), - server = http.createServer((req, res)=>{ - res.writeHead(200) - res.end('Hello world') - }) - - server.listen(5555, 'localhost') - - - module.exports = { - - unload: function() { - - server.close() - // otherwise you'd get "Error: listen EADDRINUSE: address already in use 127.0.0.1:5555" - - } - - } - ``` diff --git a/resources/docs/docs/custom-module/examples.md b/resources/docs/docs/custom-module/examples.md deleted file mode 100644 index d903870c..00000000 --- a/resources/docs/docs/custom-module/examples.md +++ /dev/null @@ -1,471 +0,0 @@ -## Basic address routing - -```js -module.exports = { - - oscInFilter:function(data){ - - var {address, args, host, port} = data - - if (address === '/some_address') { - address = '/fader_1' - } - - return {address, args, host, port} - - }, - - oscOutFilter:function(data){ - - var {address, args, host, port, clientId} = data - - if (address === '/fader_1') { - address = '/some_address' - } - - return {address, args, host, port} - } - -} -``` - -## Value conversion - -```js -module.exports = { - - oscInFilter:function(data){ - - var {address, args, host, port} = data - - if (address === '/some_address') { - - args[0].value = args[0].value * 10 - - } - - return {address, args, host, port} - - }, - - oscOutFilter:function(data){ - - var {address, args, host, port, clientId} = data - - if (address === '/some_address') { - - args[0].value = args[0].value / 10 - - } - - return {address, args, host, port} - } - -} -``` - -## Arguments split / merge - -```js - -var xyValue = [0, 0] - -module.exports = { - - oscInFilter:function(data){ - - var {address, args, host, port} = data - - // split - if (address === '/some_xy_address') { - var arg1 = args[0].value, - arg2 = args[1].value - - receive('/fader_1', arg1) - receive('/fader_2', arg2) - - return // bypass original message - } - - return {address, args, host, port} - - }, - - oscOutFilter:function(data){ - - var {address, args, host, port, clientId} = data - - // merge - if (address === '/fader_1') { - - xyValue[0] = args[0].value - send(host, port, '/some_xy_address', ...xyValue) - return // bypass original message - - } else if (address === '/fader_2') { - - xyValue[1] = args[1].value - send(host, port, '/some_xy_address', ...xyValue) - return // bypass original message - - } - - return {address, args, host, port} - } - -} -``` - -## Reply - -```js - -module.exports = { - - oscInFilter:function(data){ - - var {address, args, host, port} = data - - if (address === '/knock_knock') { - - send(host, port, '/who_is_there') - - return // bypass original message - } - - return {address, args, host, port} - - }, - -} -``` - -## Simulate user input on a single client - -```js - -// keep track of connected clients - -var clients = [] - -app.on('open', (data, client)=>{ - if (!clients.includes(client.id)) clients.push(client.id) -}) - -app.on('close', (data, client)=>{ - if (clients.includes(client.id)) clients.splice(clients.indexOf(client.id)) -}) - -module.exports = { - - oscInFilter:function(data){ - - var {address, args, host, port} = data - - if (address === '/some_osc_address') { - - // simulate user input on the first client in the array - - receive('/SET', 'widget_id', 1, {clientId: clients[0]}) - - return // bypass original message - } - - return {address, args, host, port} - - } - -} - - -``` - -## Auto-save client state - -```js -// store state in a variable -var state = {} - -// keep track of connected clients -var clients = [] - -app.on('sessionOpened', (data, client)=>{ - - // client connected (and in a session) - if (!clients.includes(client.id)) clients.push(client.id) - - // when a client opens a session, send the state - // but only if it's the only connected client (otherwise, let the regular sync happen) - if (clients.length === 1) { - receive('/STATE/SET', state, {clientId: clients[0]}) - } - -}) - -app.on('close', (data, client)=>{ - - // client disconnected - if (clients.includes(client.id)) clients.splice(clients.indexOf(client.id)) - -}) - -// request 1st client's state every 10 seconds -setInterval(()=>{ - - if (clients.length > 0) { - receive('/STATE/GET', '127.0.0.1:8888', {clientId: clients[0]}) - } - -}, 10000) - - -module.exports = { - - oscOutFilter: function(data) { - - if (data.address === '/STATE/GET') { - // update state variable when the client responds - state = data.args[0].value - - // bypass the osc message - return - } - - return data - - } - -} - -``` - -## MIDI routing - -```js -var routing = { - // midi cc vs widget id - 60: 'fader_1', - 61: 'fader_2', - // etc -} - -module.exports = { - - oscInFilter:function(data){ - // Filter incoming osc messages - - var {address, args, host, port} = data - - if (host === 'midi') { - - // MIDI routing ! - if (address === '/control') { - - // assign args to variables - var [channel, ctrl, value] = args.map(arg=>arg.value) - - // simple conditions - if (ctrl === 80) receive('/SET', 'widget_id', value / 127) - - // simple routing table (midi cc vs widget id) - if (routing[ctrl]) receive('/SET', routing[ctrl], value / 127) - - // note: /SET simulates a user interaction and makes the widget send its osc message - // but it adds some delay (we wait for the UI to respond) - // AND it may trigger multiple replies if more than one client are connected. - // Alternatively, we could do this: - // send('/osc_address', value / 127) - // receive('/osc_address', value / 127) - // Or, to send /SET to a single client: - // receive('/SET', '/osc_address', value / 127, {clientId: ID}) - - - } - - return // bypass original message - - } - - - // return data if you want the message to be processed - return {address, args, host, port} - - } - - -} -``` - - -## Read file - -```js - -var fs = nativeRequire('fs') - -module.exports = { - - oscOutFilter:function(data){ - // Filter outgoing osc messages - - var {address, args, host, port} = data - - if (address === '/file') { - - fs.readFile(args[0].value, 'utf8' , (err, data) => { - if (err) { - console.error(err) - return - } - receive('/html', data) - }) - - return // bypass original message - - } - - - // return data if you want the message to be processed - return {address, args, host, port} - - } - - -} -``` - -## Display RTSP Stream - -```js -// requires ffmpeg installed on the system -// and rtsp-ffmpeg installed in the custom module's folder (by running npm install rtsp-ffmpeg) -// see https://github.com/agsh/rtsp-ffmpeg#ffmpeg for available options - -var rtsp = nativeRequire('rtsp-ffmpeg') - -var stream = new rtsp.FFMpeg({ - input: 'rtsp://freja.hiof.no:1935/rtplive/_definst_/hessdalen03.stream', -}) - -stream.on('data', (data)=>{ - - // send frame to image widget with address set to "/stream" - receive('/stream', 'data:image/jpeg;base64,' + data.toString('base64')) - -}) - -module.exports = { - - unload: ()=>{ - stream.stop() - } - -} -``` - -## Custom module merger -```js -var submodules = [ - require('./custom_modA.js'), - require('./custom_modB.js'), - // etc -] - - -module.exports = { - init: function(){ - for (var m of submodules) { - if (m.init) m.init() - } - }, - reload: function(){ - for (var m of submodules) { - if (m.reload) m.reload() - } - }, - oscInFilter: function(data){ - - for (var m of submodules) { - if (m.oscInFilter) data = m.oscInFilter(data) - if (!data) return - } - - return data - - }, - oscOutFilter: function(data){ - - for (var m of submodules) { - if (m.oscOutFilter) data = m.oscOutFilter(data) - if (!data) return - } - - return data - } -} -``` - -## Dynamic widget creation -```js -function create_widgets() { - receive('', '', '/EDIT', 'root', { - widgets: [{ - type: 'panel', - id: 'my_panel', - layout: 'vertical', - width: '100%', - height: '200%', - widgets: [ - { - type: 'text', - id: 'notice', - value: 'Hello, world!', - width: '100%', - }, - { - type: 'button', - id: 'button', - address: '/foo', - preArgs: [1], - }, - ] - }] - }) -} - -module.exports = { - reload: function(){ - // Create widgets whenever the custom modules is edited - create_widgets() - }, -} - -// Create widgets whenever an existing session is loaded -app.on('sessionOpened', ()=>{ - create_widgets() -}) - -// And when a new session is created -app.on('sessionSetPath', (e)=>{ - if (e.path === '') { - create_widgets() - } -}) -``` - - -## Simple bridge - -```js -module.exports = { - - oscInFilter: function(data) { - - // pass through incoming messages directly to another application - send('127.0.0.1', 12345, data.address, ...args) - - return data // let original message reach clients / widgets - } - -} -``` diff --git a/resources/docs/docs/custom-module/managing-big-modules.md b/resources/docs/docs/custom-module/managing-big-modules.md deleted file mode 100644 index 1a335c83..00000000 --- a/resources/docs/docs/custom-module/managing-big-modules.md +++ /dev/null @@ -1,22 +0,0 @@ -Starting with `v1.6.0`, custom modules can load submodules with the `require()` function. - -**1**. define some variable in `number.js` - -```javascript -module.exports = 42 -``` - -**2**. retrieve it in your main module file (`main.js`): - -```javascript -var num = require('./number.js') - -module.exports = { - init: function(){ - console.log(num) // 42 - }, - oscInFilter: function(data){ - // etc - } -} -``` diff --git a/resources/docs/docs/customization/themes.md b/resources/docs/docs/customization/themes.md deleted file mode 100644 index 0af1d8fe..00000000 --- a/resources/docs/docs/customization/themes.md +++ /dev/null @@ -1,36 +0,0 @@ -## Built-in themes - -Themes can be loaded with the `--theme` option. Multiple themes can be combined. Built-in themes can be loaded using their name, custom theme files can be loaded using their path. - -Available themes (full color scheme): - -- `nord`: arctic color palette (https://www.nordtheme.com/) -- `orange`: grey and orange theme - -## Creating a custom theme - -Creating a custom theme is as simple as writing a tiny css file that will override the default css variables defined in [default.scss](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) : - -```css -:root { - --color-accent: red; -} -``` - -This will change the default accent color to red. Variables can also be overridden for a specific subset of elements, for example : - -```css -.panel-container { - --color-accent: blue; -} -``` - -This will change the default accent color to blue for all elements in panel widgets. - -## Autoreload - -Theme files are reloaded automatically when they are modified. - -## SCSS - -If you want to use the [SCSS](https://sass-lang.com/documentation/syntax) syntax to write your theme, follow the [Running from sources](../../getting-started/running-from-sources) instructions, create a `.scss` file in `src/scss/themes/` and run `npm run watch-css`. The theme will be watched and compiled automatically to a css file located in `app/assets/themes/` (css files in this directory can be selected from the theme option by their name, without .css suffix). diff --git a/resources/docs/docs/editing-sessions.md b/resources/docs/docs/editing-sessions.md new file mode 100644 index 00000000..2e0e0d31 --- /dev/null +++ b/resources/docs/docs/editing-sessions.md @@ -0,0 +1,99 @@ +# Editing sessions + +The session editor can be enabled from the sidepanel. Once enabled, clicking on a widget will make it the *selected widget*. + +## Root panel + +The root panel can be selected by clicking on the "Root" button in the sidepanel. + +## Context menu + +Right clicking / long touch on a widget or on a tab will also display a context menu providing useful utilities : + +- `Edit parent`: select widget's parent for edition +- `Copy`: copy widget's data +- `Cut`: copy widget's data and delete selected widget +- `Wrap in`: wrap the widget in a new container +- `Paste`: paste copied widget in selected container + - `Paste`: paste the widget as is + - `ID + 1` : increments the id of the copied widget (and all its children) before pasting + - `Clone` : create a clone widget targetting the copied widget +- `Add widget`: create a new widget in selected container +- `Add tab`: create a new tab in selected container +- `Delete`: delete selected tab or widget + +## Open / Save + +By default, sessions are saved and opened on the server's filesystem. When saving a session opened by mutliple clients, these will reload the session file automatically. + +!!! note + It is possible to limit this feature to specific client addresses by using the server's `--remote-saving` option. For example: + `open-stage-control --remote-saving 127.0.0.1|192.168.0.10` + + Will disable remote saving except for the clients with ip addresses `127.0.0.1` (the server's local address) and `192.168.0.10`. + + + +## Import / Export + +Sessions can be exported/imported on the device's filesystem, doing so has a few limitations: +- the session's name won't appear in the window's title +- the session won't be added to the session history + +## Grid + +By default, widget resizing / dragging snaps to a 10 pixel wide grid. Its width can be customized in the editor (when it's enabled). Setting its width to 1 will disable it. Note that the grid doesn't affect manual setting of a widget's size / position. + +## Properties + +Selected widget's properties are displayed and can be modified in the sidepanel. The [widgets reference](/docs/widgets-reference) section lists the available properties for each widget type. Property fields are all multiline (press `shift + enter` for new line). + +Properties are written in JSON, with some flexibility brought by the [JSON5](https://github.com/json5/json5) format. For example, doubles quotes around object keys are not mandatory. All input will be converted to standard JSON. + + +## Widget resizing / dragging + +Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle. Using this feature will convert position and size values to plain number values, thus breaking previously set percent or inherited values. + +## Keyboard shortcuts + +The following shortcuts are always available: + +| Shortcut | Description | +|---|---| +| `mod + e` | enable/disable editor | +| `mod + s` | save session | +| `mod + shift s` | export session as... | +| `mod + o` | open a session file | + +The following shortcuts are available only when the editor is enabled: + +| Shortcut | Description | +|---|---| +| `mod + click`* | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.| +| `shift + click + drag`* | Draw a selection rectangle and attempt to select widgets in it (starts by selecting the widget under the cursor). If `mod` is pressed too, current selection is kept and will be merged with the new one if possible. | +| `f2` | Edit selected widget's label | +| `mod + z` | Undo | +| `mod + y / mod + shift + z` | Redo | +| `delete` (`backspace` on Mac) | Delete selected widgets | +| `mod + c` | Copy selected widgets | +| `mod + x` | Cut selected widgets | +| `mod + v` | Paste clipboard in selected widget | +| `mod + shift + v` | Paste and increment id | +| `up, down, left, right` | Move selected widgets (1 grid unit, hold `shift` for 5 grid units) | +| `alt + [up, down, left, right]` | Resize selected widgets (1 grid unit, hold `shift` for 5 grid units) | +| `mod + a` | Select current widget's siblings and itself | +| `mod + shift + a` | Cancel current widget selection | +| `mod + up` | Select current widget's parent | +| `mod + down` | Select current widget's first child | +| `mod + right` | Select current widget's next sibling | +| `mod + left` | Select current widget's previous sibling | + + +Where `mod` is `ctrl` except on MacOs (`command`) + + +!!! note "* Multi-widgets editing" + - selection can only contain sibling widgets (same direct parent) + - context-menu actions and properties changes apply to all selected widgets + - resizing / dragging will affect all selected widgets, relatively to the first selected widget diff --git a/resources/docs/docs/examples.md b/resources/docs/docs/examples.md new file mode 100644 index 00000000..50e5f5b8 --- /dev/null +++ b/resources/docs/docs/examples.md @@ -0,0 +1,46 @@ +# Community examples + +Feel free to submit your own by [opening an issue](https://github.com/jean-emmanuel/open-stage-control/issues/new?title=[example]) on github. + +## Ardour + +[Ardour Control](https://github.com/jean-emmanuel/ardour-control) + +![](https://user-images.githubusercontent.com/5261671/30510969-39451104-9acf-11e7-8ee0-6e93fa34464d.png) + +## Reaper + +[Reaper OSC Panels](https://github.com/ThrashJazzAssassin/REAPER-OSC-panels) + +![](https://raw.githubusercontent.com/ThrashJazzAssassin/REAPER-OSC-panels/master/ReaperOSCtja0.1.7-1.PNG) + +## QLab + +[QLab Cook Book / Open Stage Control](https://qlabcookbook.com/tag/open-stage-control/) + +![](https://user-images.githubusercontent.com/36141834/37744217-be4b5f7e-2d65-11e8-9b83-64ca245417d4.jpg) + +## Bitwig + +[Open Stage Control Bitwig](https://github.com/kdejaeger/open-stage-control-bitwig) + +![](https://raw.githubusercontent.com/kdejaeger/open-stage-control-bitwig/master/img/mixer_nexus_9.png) + + +[OpenStageControl4Bitwig](http://www.mossgrabers.de/Software/Bitwig/Bitwig.html) + +- https://www.youtube.com/watch?v=u-fgArpsHQQ +- https://www.youtube.com/watch?v=RvEMlo72ynQ + + +## Cubase + +[Manaberry's UI](https://vi-control.net/community/threads/open-stage-control-tutorial-an-alternative-to-lemur-and-touchosc.72643/) + +![](https://user-images.githubusercontent.com/5261671/57039426-dce07780-6c5c-11e9-96ce-1f11b472c704.jpg) + +# Ableton + +[Hiram's AaMakro5oul](https://github.com/hiramegl/AaMakro5oul) (v0.23.0 only) + +![](https://raw.githubusercontent.com/hiramegl/AaMakro5oul/master/AaMakro5oul/doc/images/AaMakro5oul_Mix.jpg) diff --git a/resources/docs/docs/getting-started.md b/resources/docs/docs/getting-started.md new file mode 100644 index 00000000..e3b44f89 --- /dev/null +++ b/resources/docs/docs/getting-started.md @@ -0,0 +1,206 @@ +# Getting started + +!!! tip "" + Prebuilt binaries for Linux, Windows and OS X can be found on the [release](https://github.com/jean-emmanuel/open-stage-control/releases) page. + +## Supported platforms + +Open Stage Control is a *desktop* server application. It runs on all [platforms supported by Electron](https://electron.atom.io/docs/tutorial/supported-platforms/) or [Node](https://nodejs.org/en/) (in headless mode only, see [Running without Electron](#running-without-electron)). Any device running a compatible browser can connect to the server : + +- Chrome/Chromium version `50` or later (Linux, MacOS, Windows, Android, etc) +- iOS version `9.3` or later + +!!! tip "Android / iOS native app ?" + There is no native mobile application. The server's url can be added to the home screen to launch the interface in fullscreen. + + +## Options + +Below are the available command-line options. Note that when running without any command-line switch (ie from a file browser), a launcher window will spawn to help setting them. + +!!! tip "" + Preferences are stored in the user's home folder in a file named `.open-stage-control` (hidden under Linux / macOS) + +|| Option | Description | +|---||---| +| `-s` | `--send` | default targets for all widgets (ip:port / domain:port / midi:port_name pairs) | +| `-l` | `--load` | session file to load | +| | `--state` | state file to load (osc messages will be sent, unless there are other clients connected) | +| `-b` | `--blank` | load a blank session and start the editor | +| `-c` | `--custom-module` | custom module file to load (custom options can be passed after the filename) | +| `-p` | `--port` | http port of the server (default to 8080) | +| `-o` | `--osc-port` | osc input port (default to --port) | +| | `--tcp-port` | tcp server input port | +| | `--tcp-targets` | tcp servers to connect to (ip:port pairs), does not susbtitute for --send | +| `-m` | `--midi` | midi router settings | +| `-d` | `--debug` | log received osc messages in the console | +| `-n` | `--no-gui` | disable default gui | +| `-g` | `--gui-only` | app server's url. If true, local port (--port) is used | +| `-t` | `--theme` | theme name or path (mutliple values allowed) see [theming](/docs/theming/) | +| `-e` | `--examples` | list examples instead of recent sessions | +| | `--url-options` | [url options](/docs/url-options) (opt=value pairs) | +| |`--disable-vsync` | disable gui's vertical synchronization | +| |`--disable-gpu` | disable hardware acceleration | +| |`--force-gpu` | ignore chrome's gpu blacklist | +| |`--read-only` | disable session editing and session history changes | +| |`--remote-saving` | disable remote session saving for hosts that don\'t match the regular expresion | +| |`--remote-root` | set remote file browsing root folder | +| |`--instance-name` | used to differenciate multiple instances in a zeroconf network | +| |`--fullscreen` | launch in fullscreen mode (only affects the default gui, F11 to exit) | + +Command-line only : + +|| Option | Description | +|---||---| +| `-h` | `--help` | print available options | +| `-v` | `--version` | print version number | +| | `--inspect` | enable node/electron inspector (visit chrome://inspect with chromium to access DevTools) | + +**Examples** + +```bash +open-stage-control --send 127.0.0.1:5555 127.0.0.1:6666 --port 7777 +``` + +This will create an app listening on port 7777 for synchronization messages, and sending its widgets state changes to ports 5555 and 6666. + +```bash +open-stage-control --no-gui --load path/to/session.js --port 9999 +``` + +This will create a headless app available through http on port 9999 with session.js loaded automatically. + +!!! tip "What about HTTPS ?" + Security is out of the app's scope. If you are concerned about safety, using a private - protected - network should be enough. + + +## Run from sources + +Running the app from the sources slightly differs from using built binaries : we'll build and launch the app with npm (node package manager). + +**1. Requirements** + +- [Node.js >= 4.8](https://nodejs.org/en/#download) +- [git](https://git-scm.com/downloads) + +**2. Download sources** + +```bash +git clone https://github.com/jean-emmanuel/open-stage-control +cd open-stage-control/ +# uncomment next line if you want the latest release +# instead of the current development version +# git checkout $(git describe --tags `git rev-list --tags --max-count=1`) +npm install +npm run build +``` + +!!! note "Updating from sources" + ```bash + git pull + npm install + npm run build + ``` + +**3. Run !** + +```bash +npm start [ -- options] +``` + +!!! note "" + A double hyphen (`--`) is used here to tell npm that the options are to be passed to the app. + + +## Build from sources + +**1. Requirements** + +- [Node.js >= 4.8](https://nodejs.org/en/#download) +- [git](https://git-scm.com/downloads) + +**2. Download sources & build package** + +```bash +git clone https://github.com/jean-emmanuel/open-stage-control +cd open-stage-control/ +# uncomment next line if you want the latest release +# instead of the current development version +# git checkout $(git describe --tags `git rev-list --tags --max-count=1`) + +# TARGET_PLATFORM can be linux, win32 (windows) or darwin (os x) +export PLATFORM=TARGET_PLATFORM +# TARGET_ARCH can be ia32, x64, armv7l or arm64 +export ARCH=TARGET_ARCH + + +npm install + +# run this instead if ARCH is armv7l +# npm install --arch=armv7l + + +npm run build + +npm run package + +# Do one of the following if you want a deb package for debian/ubuntu +npm run deb32 +npm run deb64 +npm run debarm +``` + +This will build the app in `dist/open-stage-control-PLATFORM-ARCH`. + +!!! note "" + Building the app for windows from a linux system requires wine to be installed.* + +## Running in a headless context + +Electron, Open Stage Control's engine, is based on chromium and can't run out of the box without a display server. However, using a virtual framebuffer does the trick. Detailed instructions can be found in Electron's [documentation](http://electron.atom.io/docs/tutorial/testing-on-headless-ci/). + +In short: install [xvfb](https://en.wikipedia.org/wiki/Xvfb) and prepend your command with `xvfb-run`: + +```bash +xvfb-run open-stage-control -n +``` + +## Running without Electron + +It is possible to run the server in headless mode without Electron using [node](https://nodejs.org/en/download/package-manager/) (v6 or higher) : + +```bash +node /path/to/packaged/open-stage-control/resources/app/ -n +node /path/to/sources/open-stage-control/app/ -n +``` + +Or using the precompilled binaries for node: + +```bash +node /path/to/packaged/open-stage-control-node/ -n +``` + +To build the app for node only from sources: + +```bash + +# git clone, etc... + +npm install + +npm run build + +npm run package-node + +``` + +## Running in a terminal on Windows + +Windows users launching the app from a terminal need to add a double dash (`--`) before their options: + +```bash +open-stage-control.exe -- --port 5555 [...] + +# when running from sources +npm start -- -- [options] +``` diff --git a/resources/docs/docs/getting-started/introduction.md b/resources/docs/docs/getting-started/introduction.md deleted file mode 100644 index bcff82e9..00000000 --- a/resources/docs/docs/getting-started/introduction.md +++ /dev/null @@ -1,70 +0,0 @@ -Welcome to Open Stage Control documentation. Along these pages you'll learn how to setup OSC on your system and everything you need to start building your own control interface. - -## Overview - -Open Stage Control consists of 3 modules: the server, the launcher and the client. - -The **server** is the core of the software, it is responsible for sending and receiving all osc/midi messages, and act as a web server that serves the clients web application. It is written in Javascript and runs with Electron, a cross-platform framework based on Chromium. By default, the server always opens a client window when it starts but it can be run in *headless* mode, without any window. - -The **launcher** provides a simple way to configure and start the server. It appears whenever the server is not launched from a terminal or without being configured. - -The **client** is the web application made available by the server when it starts. Any compatible browser that connects to the server by browsing to its address will create a new client instance and be able to open and modify sessions. - - -## Requirements - -The **server** can run on all [platforms supported by Electron](https://www.electronjs.org/docs/tutorial/support#supported-platforms). Systems that can run [Node.js](https://nodejs.org/en/) may also be able to run it in headless mode (see [Running with Node](./running-with-node.md)). - -The **client** is compatible with the following browsers: - -- Firefox: version `75` and higher -- Chromium / Chrome: version `75` and higher - -iOS devices must be of version `11` or higher. - - -## Installation - -=== "Linux 64bit" - - **Ubuntu / Debian** - - - [Download](/download) `open-stage-control-VERSION-amd64.deb` - - Install it by running this as root in a terminal: - ```bash - dpkg -i path/to/open-stage-control-VERSION-ARCH.deb - ``` - - **Other linux distributions** - - - [Download](/download) `open-stage-control-VERSION-linux-x64.zip` - - Extract it in the location of your choice - - The file inside it named `open-stage-control` is the app's main executable - -=== "Mac 64bit" - - - [Download](/download) `open-stage-control-VERSION-osx-x64.zip` - - Extract it in the location of your choice - - Drag `open-stage-control.app` in your `Application` folder - - -=== "Mac Silicon (arm)" - - - [Download](/download) `open-stage-control-VERSION-osx-arm.zip` - - Extract it in the location of your choice - - Drag `open-stage-control.app` in your `Application` folder - - See [https://disable-gatekeeper.github.io/](https://disable-gatekeeper.github.io/) to workaround the "damaged and can't be opened" error. - -=== "Windows 64bit" - - - [Download](/download) `open-stage-control-VERSION-win32-x64.zip` - - Extract it in the location of your choice - - The file inside it named `open-stage-control.exe` is the app's main executable - -=== "Other systems" - - - Install [Node.js](https://nodejs.org/en/download/package-manager/) - - Download `open-stage-control-VERSION-node.zip` - - Extract it in the location of your choice - - In a terminal, run `node /path/to/open-stage-control-VERSION-node --help` diff --git a/resources/docs/docs/getting-started/running-from-sources.md b/resources/docs/docs/getting-started/running-from-sources.md deleted file mode 100644 index dd4a90c0..00000000 --- a/resources/docs/docs/getting-started/running-from-sources.md +++ /dev/null @@ -1,109 +0,0 @@ -Running the app from the sources slightly differs from using prebuilt binaries: we'll build and launch the app with npm (node package manager). - -## Requirements - -- [Node.js](https://nodejs.org/en/#download) -- [git](https://git-scm.com/downloads) - - -## Run from sources - - -**Download** - -```bash -git clone https://framagit.org/jean-emmanuel/open-stage-control.git -cd open-stage-control/ -# uncomment next line if you want the latest release -# instead of the current development version -# git checkout $(git describe --tags `git rev-list --tags --max-count=1`) -npm install -npm run build -``` - -!!! tip "Raspberry systems" - Run one of these instead of `npm install` (you can get the system's `arch` by running `uname -m` in a terminal) - ``` - npm install --arch=arm64 - npm install --arch=armv7l - ``` - - -!!! info "Updating from sources" - ```bash - git pull - npm install - npm run build - ``` - -**Run** - -```bash -npm start [ -- options] -``` - -!!! info "" - A double hyphen (`--`) is used here to tell npm that the options are to be passed to the app. - - -!!! warning "MIDI support" - When running from sources, MIDI support won't be enabled unless the [MIDI configuration procedure](../../midi/midi-configuration/) for "other systems" is followed. - -## Build documentation - -In order to make the local documentation available through the server's `--docs` option and the launcher's `Documentation` menu action, an extra step is needed. - - -```bash -# install docs website theme -python3 -m pip install mkdocs-material -# build docs website -npm run build-docs -``` - -## Package from sources - -Follow the "Run from sources" instructions, then: - -```bash - -# TARGET_PLATFORM can be linux, win32 (windows) or darwin (os x) -export PLATFORM=TARGET_PLATFORM -# TARGET_ARCH can be ia32, x64, armv7l or arm64 -export ARCH=TARGET_ARCH - - -npm run package - - -# The node-only package can be built with -npm run package-node - -``` - -This will build the app in `dist/open-stage-control-PLATFORM-ARCH`. - -!!! info "" - Building the app for windows from a linux system requires wine to be installed. - - -## Debian / Ubuntu and RPM installers - -=== "Debian / Ubuntu" - - ``` - npm run deb64 - ``` - -=== "RPM" - - ``` - npm run rpm - ``` - - -## Build script on Mac Silicon - -This user-contributed script can be used to build open stage control on recent Macs: - -https://github.com/rewgs/osc-as diff --git a/resources/docs/docs/getting-started/running-with-node.md b/resources/docs/docs/getting-started/running-with-node.md deleted file mode 100644 index 39a9e400..00000000 --- a/resources/docs/docs/getting-started/running-with-node.md +++ /dev/null @@ -1,24 +0,0 @@ -## Lite headless mode - -It's possible to run the server in headless mode with the nodejs engine embedded in Electron, this reduces memory / cpu usage significantly. - -``` -ELECTRON_RUN_AS_NODE=1 open-stage-control path/to/open-stage-control/resources/app/ [options] -``` - - -## Running with node - -If Electron does not run on your platform, it is possible to run the server in headless mode using [Node.js](https://nodejs.org/en/download/package-manager/). - - -1. Install [Node.js](https://nodejs.org/en/download/package-manager/) -2. Download `open-stage-control-[version]-node.zip` package and extract it -3. Run `node /path/to/open-stage-control [options]` - - -!!! info - When running from sources or with regular binaries (packaged with electron), the command slightly differs: - - - electron package: `node /path/to/open-stage-control/resources/app [options]` - - from sources: `node /path/to/open-stage-control/app [options]` diff --git a/resources/docs/docs/getting-started/server-configuration.md b/resources/docs/docs/getting-started/server-configuration.md deleted file mode 100644 index 63fa6ca8..00000000 --- a/resources/docs/docs/getting-started/server-configuration.md +++ /dev/null @@ -1,230 +0,0 @@ -The **server** can be configured with many options, either from a terminal or with the help of the **launcher**. - -## Options - -!!! quote "" - #### `send` - - Defines the default osc/midi targets. These will be added to the widget's individual targets. Targets must be separated by a space and formatted as follows: - - - `ip_address:port` - - `host_name:port` - - `midi:device_name` - -!!! quote "" - #### `load` - - Path to a session file (.json). All clients connecting the server will load it. - -!!! quote "" - #### `state` - - Path to a state file (.state). All clients connecting the server will load it. - - -!!! quote "" - #### `custom-module` - - Path to a custom module file (.js). - - **WARNING:** custom module can access the file system, use at your own risk. - - -!!! quote "" - #### `port` - - HTTP port for the server (default: `8080`). - - -!!! quote "" - #### `osc-port` - - OSC (UDP) input port (default: `port`). - - -!!! quote "" - #### `tcp-port` - - OSC (TCP) input port. - - -!!! quote "" - #### `tcp-targets` - - TCP servers to connect to. When sending osc messages, if the target matches one of these, TCP protocol will be used instead of UDP. Targets must be separated by a space and formatted as follows: - - - `ip_address:port` - - `host_name:port` - - -!!! quote "" - #### `midi` - - MIDI options separated by spaces, MIDI support must be enabled, see [MIDI configuration](../midi/midi-configuration.md). - - -!!! quote "" - #### `debug` - - Print sent and received messages in the console. This may impact performance and should not be enabled in production. - - - -!!! quote "" - #### `no-gui` - - Disable built-in client window. - - -!!! quote "" - #### `fullscreen` - - Start the built-in client window in fullscreen. - - -!!! quote "" - #### `theme` - - Theme names or paths. See [Themes](../customization/themes.md). - - -!!! quote "" - #### `client-options` - - Default [client options](../client-options.md), separated by spaces. - - -!!! quote "" - #### `disable-vsync` - - Disable built-in client window's vertical synchronization. - - -!!! quote "" - #### `force-gpu` - - Disable built-in client window's gpu blacklist (may improve rendering performance in some cases). - - -!!! quote "" - #### `read-only` - - Disable session editing, and file saving. - - -!!! quote "" - #### `remote-saving` - - Disable file saving for hosts that don't match the regular expression. - - Sessions are saved and opened on the server's filesystem. It is possible to limit this feature to specific client with a regular expression. For example, `"127.0.0.1|192.168.0.10"` disables remote saving except for clients with ip addresses `127.0.0.1` (the server's local address) and `192.168.0.10`. - - -!!! quote "" - #### `remote-root` - - Set file browsing root folder. Prevent writing files outside of this folder. - -!!! quote "" - #### `authentication` - - Restrict access to `user:password` (remote clients will be prompted for these credentials). - -!!! quote "" - #### `instance-name` - - Server's name on zeroconf/bonjour network. Incremented automatically if not available. - -!!! quote "" - #### `use-ssl` - - Use HTTPS protocol instead of HTTP (a self-signed certificate will be created) - - - -## Command-line options - -The following options can only be set from a terminal. - -!!! quote "" - #### `disable-gpu` - - Disable hardware acceleration for the launcher window and the built-in client window. - - -!!! quote "" - #### `inspect` - - Enable node inspector. - - -!!! quote "" - #### `cache-dir` - - Override default cache directory (contains browser cache and localStorage data). - - -!!! quote "" - #### `config-file` - - Override default config file location (contains session history and launcher config). Defaults to `cache-dir/config.json`. - - - -!!! quote "" - #### `client-position` - - Define the built-in client window position, must be a pair of integers separated by a comma (`x,y`). - - - -!!! quote "" - #### `client-size` - - Define the built-in client window size, must be a pair of integers separated by a comma (`width,height`). - -!!! quote "" - #### `no-qrcode` - - Disable qrcode when the server starts. - - -!!! quote "" - #### `help` - - Show help. - -!!! quote "" - #### `docs` - - Serve documentation website locally and open it with the system's default browser - - -!!! quote "" - #### `version` - - Show version number. - - -## Running in a terminal - -Options name must be prepended with a double dash (`--`) in a terminal. - -!!! example "Example" - ``` - open-stage-control --no-gui --load path/to/your/session.json --theme path/to/your/theme.css - ``` - - Launches the server in headless mode, and makes all clients load provided session and theme automatically. - - -## Running in a terminal on Windows - -Windows users launching the app from a terminal need to add a double dash (`--`) and a space before their options: - -```bash -open-stage-control.exe -- --port 5555 [...] - -# when running from sources -npm start -- -- [options] -``` diff --git a/resources/docs/docs/interface.md b/resources/docs/docs/interface.md new file mode 100644 index 00000000..a555209a --- /dev/null +++ b/resources/docs/docs/interface.md @@ -0,0 +1,45 @@ +# User interface + +The interface is made of two main components: the widgets and the sidepanel. + +## Widgets + +All widgets are contained in the `root` widget, a special `panel` widget that can only contain tabs. + +### Interacting with widgets + +| Mouse | Touch | Description | +|---|---|---| +| Click | Tap | Handled at pressing time, not releasing. | +| Double Click | Double Tap | Some widgets handle double click / tap events. | +| Drag | Drag | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. | +| `Ctrl` + Drag | | Holding the `Ctrl` key while dragging with the mouse increases the gesture's precision by 10.| +| | Two-fingers drag (single target) | Using two fingers on a single-touch target increases the gesture's precision by 10. | + + +## Sidepanel + +The sidepanel can be opened by clicking the navigation icon in the upper right corner or by pressing `F10`. + +### State management + +- Store: save the state of all widgets in the temporary slot +- Recall: reload saved state from the temporary slot +- Send All: make all widgets send their current value +- Save / Save As: save the state of all widgets to a `.state` file on the server +- Load: load a state from a `.state` file on the server +- Export: save to local filesystem +- Import: load from local filesystem + +### Traversing gestures + +By default, a dragging gesture can only affect the widget it started on. Enabling traversing gesture does two things: + +- make gestures affect every widgets no matter where they started +- make sliders-like widgets respond as if their `snap` option is enabled + +When traversing gestures are set to `auto`, these will only affect widgets that have the same type as the first touched widget. + +### Editor + +See [Editing sessions](/docs/editing-sessions.md). diff --git a/resources/docs/docs/midi.md b/resources/docs/docs/midi.md new file mode 100644 index 00000000..1cd9647e --- /dev/null +++ b/resources/docs/docs/midi.md @@ -0,0 +1,107 @@ +## Requirements + +MIDI support requires additional software to be installed on the server's system: + +- python (2 or 3) +- python package [python-rtmidi](https://spotlightkid.github.io/python-rtmidi/installation.html) + +To install `python-rtmidi`, run `pip install python-rtmidi` (python 2) in a terminal or `pip3 install python-rtmidi` (python 3). + +!!! note "Why an additionnal dependency ?" + Providing cross-platform MIDI support is not trivial, as it requires OS-specific compilation that cannot be automated within Open Stage Control's current packaging workflow. Using a python addon seems to be the best compromise so far : the core app remains easy to build, and the extra dependency is easy to install. + +## Setup + +When running the app, the `-m / --midi` switch must be set; it accepts the following options (separated by spaces): + +- `list`: prints the available MIDI ports to the console; numbers in the first column may be used for `input`/`output` definition below +- `device_name:input,output`: connect to midi ports `input` and `output`; osc messages sent to target `midi:device_name` will be processed as midi events; Multiple devices can be declared. If the `device_name` contains white spaces, the declaration must be enquoted (ie `"spaced name:input,output"`). `device_name` doesn't need to match the actual midi device name, it is just an identifier (see [Widget settings](#widget-settings)). +- `sysex`: parse incomming system exclusive messages (disabled by default) +- `pc_offset`: send program changes with a `-1` offset to match some software/hardware implementations +- `path=/path/to/python`: indicates where to find python or python3 binary in case open stage control doesn't (`Error: spawn python3 ENOENT`) + +*Linux only:* + +- `device_name:virtual`: creates a virtual midi device with one input port and one output port +- `jack`: use JACK MIDI instead of ALSA (add as extra parameter). `rtmidi` must be compiled with `--jack-midi` flag for this to work. + +!!! tip + When using the launcher window, midi devices can be listed by right-clicking and choosing `Midi > List Devices` + +## Widget settings + +In order to send MIDI messages, a widget must have at least one `target` formatted as follows: + +`midi:device_name` (where `device_name` is one of the declared midi devices) + +!!! warning + Messages received from a MIDI port only affect widgets that send to this port. + + +## Supported MIDI messages + +!!! warning "" + Define static argument values using the [`preArgs`](/docs/widgets-reference/#preArgs) option in order to complete the respective MIDI message. + + + +#### `/note channel note velocity` + +NoteOn event or noteOff if velocity equals `0`. + +- `channel`: integer between 1 and 16 +- `note`: integer between 0 and 127 +- `velocity`: integer between 0 and 127 + +Example: + +A push button might be configured as follows in order to send a MIDI note whose velocity is defined by the button's on/off value: + +- `address`: /note +- `preArgs`: [1, 60] (for MIDI channel 1, and note 60 / C4) +- `on`: 100 (for noteOn velocity of 100 on button push) +- `off`: 0 (to send a noteOff on button release) +- `target`: ["midi:device_name"] (where device_name is one of the declared midi devices defined during [setup](#setup)) + +#### `/control channel cc value` + +Control change event. + +- `channel`: integer between 1 and 16 +- `cc`: integer between 0 and 127 +- `value`: integer between 0 and 127 + +Example: + +A fader might be configured as follows in order to send a MIDI control message (a volume control in this example): + +- `address`: /control +- `pre-args`: [1, 7] (MIDI channel 1, control number 7 generally used as volume control) +- `range`: {"min": 0, "max": 127} (MIDI values are encoded in this range) +- `target`: ["midi:device_name"] + +#### `/program channel program` + +Program change event. + +- `channel`: integer between 1 and 16 +- `program`: integer between 0 and 127* + +!!! note + \* Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on. Enable the `pc_offset` option to make Open Stage Control behave this way. + +#### `/pitch channel pitch` + +PitchWheel event. + +- `channel`: integer between 1 and 16 +- `pitch`: integer between 0 and 16383 + +#### `/sysex msg v1 .. vN` + +System exclusive message. + +- `msg`: hexadecimal sysex data string of the form `f0 ... f7`. You may include placeholders of the form `nn` which will be replaced by `v1, .., vN` respectively. +- `v1, .., vN`: values encoded as hexadecimal data strings to include in `msg`. Most probably, you will need to sepcify a [custom module](/docs/custom-module/) in order to convert numeric widget values into the required hexadecimal format. In general, this conversion will be different for each manufacturer / device. + +For a very simple example, refer to session 'sysex.json' found in the application's sub folder 'resources/app/examples/'. Please remember to adjust the button's `target` to the `device_name` used in your MIDI setup. diff --git a/resources/docs/docs/midi/midi-configuration.md b/resources/docs/docs/midi/midi-configuration.md deleted file mode 100644 index feb3984a..00000000 --- a/resources/docs/docs/midi/midi-configuration.md +++ /dev/null @@ -1,144 +0,0 @@ -## Installation - - -=== "Linux / Windows / OSX" - - Open Stage Control comes bundled with built-in MIDI support if you're using the official package for Linux, OSX or Windows. - - -=== "Other systems / Node" - - Enabling MIDI support on other systems or when building Open Stage Control from sources requires additional softwares to be installed on the server's system: - - - [python 3](https://www.python.org/downloads/) - - python package [python-rtmidi](https://spotlightkid.github.io/python-rtmidi/installation.html#from-pypi) - - - ??? example "Linux" - - Install `python3-rtmidi` from your distribution's package repository, or if it's not available: - - - Install `python3` and `python3-pip` from your distribution's package repository - - Run this command in a terminal - ```bash - python3 -m pip install python-rtmidi --upgrade - ``` - - ??? example "Mac" - - - Download and install [Python 3 for Mac OS](https://www.python.org/downloads/mac-osx/) - - Open a terminal - - Install `pip` (package installer for python) by executing these commands - ``` - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python get-pip.py - ``` - - Install `python-rtmidi` by executing this command - ```bash - python -m pip install python-rtmidi --upgrade - ``` - - ??? example "Windows" - - - Download and install [Python 3 for Windows](https://www.python.org/downloads/windows/) - - **make sure to check the option** "Add Python 3.x to PATH" - - Open a terminal (++win+r++) - - Install `pip` (package installer for python) by executing these commands - ``` - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python get-pip.py - ``` - - Install `python-rtmidi` by executing this command - ```bash - python -m pip install python-rtmidi --upgrade - ``` - -## Configuration - -The server's `midi` option accepts the following parameters, separated by spaces. - -!!! warning "" - If an option contains space characters, it must be quoted. - -**`list`** - -Print the available MIDI ports to the console when the server starts. This action is also available in the launcher's menu. - -**`device_name:input,output`** - -Create a virtual MIDI device that will translate OSC messages to MIDI messages - -- `device_name` is an arbitrary identifier that can be used as a target by widgets (see [Widget setup](#widget-setup)). It doesn't have to match any device's real name. -- `input` / `output` can be port numbers or strings (as reported by the `list` action). If a string is specified, the first port whose name contains the string will be used (comparison is case-insensitive). - -**`sysex`** - -Enable parsing of system exclusive messages (disabled by default). - -**`mtc`** - -Enable parsing of midi time code messages (disabled by default). - -**`rpn`** - -Enable sending and receiving [RPN/NRPN](https://en.wikipedia.org/wiki/NRPN) controls on as single `/rpn` / `/nrpn` messages instead of 3 or 4 control changes that constitute them. - - -**`active_sensing`** - -Enable parsing of midi active sensing messages (disabled by default). Active sensing messages will be received as sysex. - -**`pc_offset`** - -Send program changes with a `-1` offset to match some software/hardware implementations - -**`note_off_velocity`** - -Use `/note_on` for noteOn messages and `/note_off` for noteOff messages instead of the defaut `/note` and velocity 0 for note off. - -**`auto_note_off`** - -Prevent converting outgoing noteOn messages with velocity 0 to noteOff messages. - - -**`device_name:virtual`** (*Linux / Mac only*): creates a virtual midi device with one input port and one output port - - -**`jack`** (*Linux only*): use JACK MIDI instead of ALSA. `python-rtmidi` must be compiled with [jack support](https://spotlightkid.github.io/python-rtmidi/installation.html#linux) for this to work. - - -**`path=/path/to/python`** - -*Only use this if you know what you are doing. This option should not be set when using the official Linux / Windows / OSX packages.* - -Indicates where to find python binary in case open stage control doesn't (`Error: spawn python3 ENOENT`). - - -## Widget setup - -In order to send MIDI messages, a widget must have at least one `target` formatted as follows: - -`midi:device_name` (where `device_name` is one of the declared midi devices) - -Its `address` and `preArgs` properties must be set according to Open Stage Control's [midi messages](../midi-messages) specification. - -!!! warning - Messages received from a MIDI port only affect widgets that send to this port. - -## Debug - -Enabling the server's `debug` options will print some extra information (sent/received midi messages, midi setup information, etc) - -## Example configuration - -Setting the server's `midi` option as follows: - -``` -sysex synth:1,2 daw:3,3 -``` - -- enables sysex support (sysex messages will not be ignored) -- creates a midi device "synth" connected with input 1 and output 2 -- creates a midi device "daw" connected with input 3 and output 3 - -If a widget has its `target` set to `midi:synth`, it will receive MIDI from port 1 and send MIDI to port 2. diff --git a/resources/docs/docs/midi/midi-messages.md b/resources/docs/docs/midi/midi-messages.md deleted file mode 100644 index e189dcfe..00000000 --- a/resources/docs/docs/midi/midi-messages.md +++ /dev/null @@ -1,130 +0,0 @@ -!!! info "" - Define static argument values using the [`preArgs`](/docs/widgets/properties-reference/#preArgs) option in order to complete the respective MIDI message. - ----- - -#### `/note channel note velocity` - -NoteOn event or noteOff if velocity equals `0`. Incoming noteOff events will be received as `/note` with velocity 0 if `note_off_velocity` is not set during [setup](../midi-configuration). - -- `channel`: integer between 1 and 16 -- `note`: integer between 0 and 127 -- `velocity`: integer between 0 and 127 - -!!! example "Example" - - A push button might be configured as follows in order to send a MIDI note whose velocity is defined by the button's on/off value: - - - `address`: `/note` - - `preArgs`: `[1, 60]` (for MIDI channel 1, and note 60 / C4) - - `on`: `100` (for noteOn velocity of 100 on button push) - - `off`: `0` (to send a noteOff on button release) - - `target`: `midi:device_name` (where device_name is one of the declared midi devices defined during [setup](../midi-configuration)) - ----- - -#### `/note_off channel note velocity` - -NoteOff event with any velocity. Incoming noteOff events will be received as `/note_off` if `note_off_velocity` is set during [setup](../midi-configuration). - ----- - -#### `/control channel cc value` - -Control change event. - -- `channel`: integer between 1 and 16 -- `cc`: integer between 0 and 127 -- `value`: integer between 0 and 127 - -!!! example "Example" - - A fader might be configured as follows in order to send a MIDI control message (a volume control in this example): - - - `address`: `/control` - - `pre-args`: `[1, 7]` (MIDI channel 1, control number 7 generally used as volume control) - - `range`: `{"min": 0, "max": 127}` (MIDI values are encoded in this range) - - `target`: `midi:device_name` - ----- - -#### `/program channel program` - -Program change event. - -- `channel`: integer between 1 and 16 -- `program`: integer between 0 and 127* - -!!! info - \* Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on. Add the `pc_offset` parameter to the server's `midi` option to make Open Stage Control behave this way. - ----- - -#### `/pitch channel pitch` - -PitchWheel event. - -- `channel`: integer between 1 and 16 -- `pitch`: integer between 0 and 16383 - ----- - -#### `/sysex msg` - -System exclusive message. - -- `msg`: hexadecimal sysex data string of the form `f0 ... f7`. - -Instead of a single hexadecimal string, arguments can be separated and defined either as hexadecimal bytes or as integers. When received, system messages are always formatted as a single hexadecimal string. - ----- - -#### `/mtc timecode` - -MIDI time code message. - -- `timecode`: `hh:mm:ss:ff` string. - - ----- - -#### `/channel_pressure channel pressure` - -Channel pressure event. - -- `channel`: integer between 1 and 16 -- `pressure`: integer between 0 and 127 - ----- - - -#### `/key_pressure channel note pressure` - -Polyphonic key pressure event. - -- `channel`: integer between 1 and 16 -- `note`: integer between 0 and 127 -- `pressure`: integer between 0 and 127 - ----- - - -#### `/rpn channel rpn value` - -Registered Parameter Number event. - -- `channel`: integer between 1 and 16 -- `rpn`: integer between 0 and 16383 -- `value`: integer between 0 and 16383 - ----- - -#### `/nrpn channel nrpn value` - -Non-Registered Parameter Number event. - -- `channel`: integer between 1 and 16 -- `nrpn`: integer between 0 and 16383 -- `value`: integer between 0 and 16383 - ----- diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md index a25fb9db..f936615f 100644 --- a/resources/docs/docs/remote-control.md +++ b/resources/docs/docs/remote-control.md @@ -1,47 +1,42 @@ # Remote control -When osc messages are received, the default behavior is to update the value of all widgets that match the address and preArgs. Additionally, Open Stage Control clients respond to some general osc commands. - -!!! note "Multi-client setup" - These commands are interpreted by each client connected to the server so there might be more than one reply. Using a custom module is the only way to send a message to a single client. +All widgets that send osc messages respond to the same messages. Additionnaly, Open Stage Control responds to some general osc commands. ----- - -#### `/EDIT id properties options` +## `/EDIT id options` -Apply a set of options to an existing widget by replacing the old ones with the new ones. This ignores the widget's `lock` property. If sent by a custom module using `receive()`, this command will not be prevented by the server's `read-only` option. +Apply a set of options to an existing widget by replacing the old ones with the new ones. + - `id`: `string`, widget's `id` -- `properties`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge +- `options`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge - example: `{"label":"New Label", "color":"red"}` -- `options` (optional): `string`, [JSON5](https://github.com/json5/json5) stringified object defining extra option flags: - - `noWarning`: set to `true` to prevent further warning when exiting. ----- +!!! warning "" + Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea -#### `/EDIT/MERGE id properties options` +## `/EDIT/MERGE id options` Apply a set of options to an existing widget by merging them to the widget's options. ----- -#### `/EDIT/UNDO` +- `id`: `string`, widget's `id` +- `options`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge + - example: `{"label":"New Label", "color":"red"}` + +!!! warning "" + Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea + +## `/EDIT/UNDO` Undo editing action - ----- - -#### `/EDIT/REDO` +## `/EDIT/REDO` Redo editing action - ----- - -#### `/EDIT/GET target id` +## `/EDIT/GET target id` Sends back a widget's data (JSON stringified object), including its children, to specified target. @@ -53,10 +48,7 @@ Replies `/EDIT/GET id data` - `id`: `string` - `data`: `string` - ----- - -#### `/EDIT/GET target address preArg1 preArg2 ...` +## `/EDIT/GET target address preArg1 preArg2 ...` Sends back a widget's data (JSON stringified object), including its children, to specified target. @@ -71,10 +63,7 @@ Replies `/EDIT/GET address preArg1 preArg2 ... data` - `data`: `string` - ----- - -#### `/GET target id` +## `/GET target id` Sends back a widget's value to specified target. @@ -86,10 +75,7 @@ Replies `/GET id value` - `id`: `string` - `value`: `*` - ----- - -#### `/GET target address preArg1 preArg2 ...` +## `/GET target address preArg1 preArg2 ...` Sends back a widget's value to specified target. @@ -103,42 +89,18 @@ Replies `/GET address preArg1 preArg2 ... value` - `preArg[1...]`: `*`, widget's `preArgs` - `value`: `*` - ----- - -#### `/GET/#` +## `/GET/#` Same as `/GET` but uses the widget's address instead of `/GET` to reply. ----- - -#### `/NOTIFY icon message` - -Sends a notification message to the client. - -- `icon`: icon for the notification, for example : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free) -- `message`: message content - - ----- - -#### `/LOG message` - -Print message in the client's console. - ----- - -#### `/SET id value` +## `/SET target id value` Set a widget's value as if it was interacted with from the interface. This is likely to make it send its value. - `id`: `string`, widget's `id` - `value`: `*`, widget's new value - ----- - -#### `/SET address preArg1 preArg2 ... value` +## `/SET address preArg1 preArg2 ... value` Set a widget's value as if it was interacted with from the interface. This is likely to make it send its value. @@ -147,91 +109,28 @@ Set a widget's value as if it was interacted with from the interface. This is li - `value`: `*`, widget's new value - ----- - -#### `/STATE/GET target` +## `/STATE/GET target` Sends back the app's state to specified target - `target`: `string`, `ip:port` pair - ----- - -#### `/STATE/SET state send` +## `/STATE/SET state` Set widgets' state - `state`: `string`, json stringified object (`"widget_id": value` pairs) -- `send` (optional): `boolean`, set to `false` to prevent widgets from sending their values when the state is applied - ----- - -#### `/STATE/STORE` +## `/STATE/STORE` Save the state of all widgets in the temporary slot. - ----- - -#### `/STATE/RECALL` +## `/STATE/RECALL` Reload saved state from the temporary slot. ----- +## `/TABS id id etc` -#### `/STATE/SEND` - -Make all widgets send their current value. - ----- - -#### `/STATE/OPEN path.state` - -Open state file `path.state`. - ----- - -#### `/STATE/SAVE path.state` - -Save state session to `path.state`. - ----- - -#### `/SESSION/CREATE` - -Create a new empty session. Unsaved changes will be lost. - ----- -#### `/SESSION/OPEN path.json` - -Open session file `path.json`. - ----- - -#### `/SESSION/SAVE path.json` - -Save current session to `path.json`. If `path.json` is omitted, current session's path is used. - ----- - -#### `/TABS tab_id1 tab_id2 ...` - -Open the tabs designated by the id parameters. - ----- - -#### `/SCRIPT code` - -Run code as if it where executed by a script widget. - - ----- - -#### `/RELOAD` - -Reload page in the browser. +Open the tabs designated by the `id` parameters. diff --git a/resources/docs/docs/theming.md b/resources/docs/docs/theming.md new file mode 100644 index 00000000..6f47c976 --- /dev/null +++ b/resources/docs/docs/theming.md @@ -0,0 +1,44 @@ +## Built-in themes + +Themes can be loaded with the `--theme` option. Multiple themes can be combined. Built-in themes can be loaded using their name, custom theme files can be loaded using their path. + +Available themes (full color scheme): + +- `orange`: grey and orange theme +- `light`: light and blue +- `dark`: blue night theme + +Available extensions (alternative visual settings) + +- `flat`: remove 3d effects +- `alt-buttons`: colorful active buttons +- `responsive-fonts`: bigger texts for bigger screens + +## Creating a custom theme + +Creating a custom theme is as simple as writing a tiny css file that will override the default css variables defined in [default.scss](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) : + +```css +:root { + --color-accent:red; +} +``` + +This will change the default accent color to red. Variables can also be overridden for a specific subset of elements, for example : + +```css +.panel-container { + --color-text:blue; +} +``` + +This will change the default text color to blue for all elements in panel widgets. + +## Scss / autoreload + +When running the app [from sources](/docs/getting-started), custom themes can be written in scss: + +- the scss file must be located in `src/browser/scss/themes/` +- run `npm run watch-css` + +The theme will be watched and compiled automatically to a css file located in app/browser/themes/ (css files in this directory can be selected from the theme option by their name, without .css suffix). If the app is running on default http port, clients will reload the theme automatically. diff --git a/resources/docs/docs/tutorials/change-property-with-osc.md b/resources/docs/docs/tutorials/change-property-with-osc.md deleted file mode 100644 index 1c9a83c8..00000000 --- a/resources/docs/docs/tutorials/change-property-with-osc.md +++ /dev/null @@ -1,149 +0,0 @@ -# Change a widget property with an osc message - -By default, widgets only expose their value to incoming messages, but there are multiple ways to allow changing any widget property using osc messages as well. In this tutorial we'll explore the different possibilities for exposing the `visible` property of a widget to incoming messages, but it applies to any other property. - -## 1. Using a variable widget - -Create a variable widget and set up its `address` (and `preArgs` if needed) so that it receives the messages you want to use, and then in your other widget's `visible` property, use the [inheritance syntax](../widgets/advanced-syntaxes.md#inheritance-idproperty) to retrieve the variable's value: - - -=== "Inheritance syntax" - ``` - @{variable_id} - ``` -=== "Inheritance syntax + Javascript" - ```js - JS{ - // bonus, in case you don't want to use the variable's value as-is - if (@{variable_id} > 0.5) { - return true - } else { - return false - } - } - ``` - -Now the variable's value will determine the visibility of the widget. The `visible` property expects a boolean value (`true` for visible, `false` for invisible) but any [truthy](https://developer.mozilla.org/en-US/docs/Glossary/truthy) / [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) will do (e.g. `1` for visible, `0` for invisible is a sensible choice). - -## 2. Using the OSC listener syntax - -The [OSC listener syntax](../widgets/advanced-syntaxes.md#osc-listeners-oscaddress-default-usepreargs) might be a more straightforward solution for simple use cases. Writing this in a widget's `visible` property: - - -=== "Relative address" - ``` - OSC{show} - ``` - -will listen for messages on address `/widget_address/show` and return the last received value. - - -If we write this instead: - -=== "Absolute address" - ``` - OSC{/show} - ``` - -the address will be `/show` and won't be prefixed with the widget's address as before. - - -It is often needed to specify the initial state of the listener (before it receives any message), this is done via the second argument of the listener syntax: - - -=== "Default value (true)" - ``` - OSC{show, true} - ``` -=== "Default value (truthy)" - ``` - OSC{show, 1} - ``` -=== "Default value (false)" - ``` - OSC{show, false} - ``` -=== "Default value (falsy)" - ``` - OSC{show, 0} - ``` - -If the widget has any preArgs set, the osc listener will inherit them by default, this means that for a message to change the listener's value it will not only have to match its address but also the widget's `preArgs`, this can be prevented using the third argument of the listener syntax: - -=== "Ignore preArgs" - ``` - OSC{show, 1, false} - ``` - - -## 3. Using custom variables - -The [custom variable syntax](../widgets/advanced-syntaxes.md#custom-variables-varvariablename-default) connects regular properties and scripting properties (`onCreate`, `onValue`, etc), writing this in the `visible` property: - -``` -VAR{show} -``` - -will create a custom variable named `show` scoped to the widget (custom variables do not use a global namespace and multiple widgets may use the same names for their custom variables without conflict). This custom variable can be read and set from any widget scripting property using the [`getVar()` / `setVar()`](../widgets/scripting.md#getvarid-name) functions. - -For instance, we could use a variable widget as osc receiver like in the first example of this tutorial and use it's `onValue` script to change the custom variable's value (instead of using the inheritance syntax): - -```js -// variable widget onValue -// simply pass received value to the custom variable -setVar('widget_id', 'show', value) -``` - - -The custom variable's initial state can be specified: - -``` -VAR{show, 1} -``` - -## 4. Using /EDIT commands - -The [`/EDIT`](../remote-control.md) remote control command can be used to modify any widget property in the session, for instance: - -``` -/EDIT widget_id '{visible: false}' -``` - -Will hide the widget with id `widget_id`. Note that this is different from the 3 techniques described above in that it actually modifies the session and changes the property value in a destructive way (the property is rewritten, not just its state). When quitting the session after using it a warning indicating the session has unsaved changes will be shown, this can be prevented by appending a extra argument to the message: - -``` -/EDIT widget_id '{visible: false}' '{noWarning: true}' -``` - -Note that the arguments after `widget_id` are sent as strings ([JSON5](https://github.com/json5/json5)-encoded objects), this is because sending plain javascript object over osc is not possible. - -## Bonus: custom module - -Any of these techniques can be used in conjunction with a [custom module](../custom-module/custom-module.md). Using the `receive()` function allows simulating incoming osc messages and can be used to trigger property changes: - -=== "Variable widget" - ```js - var visible = true - receive('/variable_id', visible) - // or if variable widgets has preArgs - receive('/variable_id', preArg1, preArg2, visible) - ``` -=== "OSC listener" - ```js - var visible = true - receive('/widget_address/show', visible) - // or if listener has preArgs - receive('/widget_address/show', preArg1, preArg2, visible) - ``` -=== "Custom variable" - ```js - var visible = true - receive('/SCRIPT', `setVar('widget_id', 'show', ${visible})`) - ``` -=== "/EDIT command" - ```js - var visible = true - // what's really cool here is that you don't need to stringify objects arguments - // receive() will take care of that for you - receive('/EDIT', 'widget_id', {visible: visible}}, {noWarning: true}) - ``` diff --git a/resources/docs/docs/tutorials/first-steps.md b/resources/docs/docs/tutorials/first-steps.md deleted file mode 100644 index 71df540c..00000000 --- a/resources/docs/docs/tutorials/first-steps.md +++ /dev/null @@ -1,252 +0,0 @@ -# First Steps with Open Stage Control - -*Contributed by H. James Harkins, Feb. 2023* - -Let's walk through the basic steps to build a simple interface in Open Stage Control, send information to another app, and deploy the interface to remote (even mobile) devices. - -Before beginning, you should already have installed Open Stage Control -- see the [Introduction](../getting-started/introduction.md). - -Also: This document provides sample patches for SuperCollider, Pure Data and Max/MSP, to receive control data from the Open Stage Control interface. If you do not have any of these tools, I suggest to install [Pure Data](https://puredata.info/downloads/pure-data) because it has the smallest footprint. - -## The Launcher - -Use your system's application launcher, open the Open Stage Control app. Here, you can configure options for the interface server. - -For now, go to the first box ("send") and type in `127.0.0.1:57120`. This will tell the server to send Open Sound Control messages to the same machine where the server is running, on port 57120. - -NOTE: For your own applications, you can use any port that is not in use. For this example, I chose 57120 because it is SuperCollider's default UDP port (and I set the Pure Data and Max patches to use the same port, to simplify.) - -You don't need to set any other options at this time. - -### Addresses and ports - -Many users approaching Open Sound Control for the first time get confused about ports. You need to be aware of the FROM and TO addresses. The "send" field in the Launcher should reference the address TO which messages should be sent. In this demo, we are assuming that Open Stage Control and the target app are running on the same machine. So the TO address is localhost: `127.0.0.1`. The "send" box should use the port *on which the target app is receiving messages*. This is typically under control of the target app: 1/ SuperCollider opens 57120 by default; 2/ Pd's [netreceive] object, and Max's [udpreceive], both require the TO port as an argument. So the TO port is your choice, as long as they match. - -Open Stage Control sends messages FROM the IP address of the machine where Open Stage Control is running, and from port 8080 (or localhost = `127.0.0.1` if on the same machine). Thus, if the receiving app will filter incoming messages based on address, the filtering address should be the FROM address, port 8080. The target app can also update Open Stage Control's display by sending messages back to exactly this address. So you will see later, in the demo patches, that messages are sent to `127.0.0.1:8080` so that the user's interaction with the target app appears in Open Stage Control as well. - -## Starting the server - -Click the "play" button near the top left of the window. You should see status messages in the launcher window such as: - -``` -(INFO) Server started, app available at - http://127.0.0.1:8080 - http://your.ip.ad.dress:8080 -``` - -And a new, mostly empty, window will open. This new, larger window is the *client*. - -## The client - -The client allows you to edit and perform your interface. - -The interface design is called a *session*. To create a new session, go to the "three-dots" menu at the top left, and choose Session > New session. - -Two new panels are displayed: a project browser, and an object inspector (to set properties). The empty space in the middle is the editor, where you will build the interface. - -Let's start with a toggle button. Right-click in the empty editor panel in the middle, and navigate to Add widget > Basics > button. For this demo, we don't need to change anything else: the button defaults to toggle behavior, and the display text is not important for now (although you can change it in the inspector, if you want). - -And let's add one more control, to the right of this: Right-click, Add widget > Sliders > fader. - -![](./first-steps/two-widgets.png) - -When a widget is selected, you can move it by dragging the top-left handle, and resize it by dragging the bottom-right handle. Let's use these handles to position the fader to the right of the button, and stretch it to be horizontal instead of vertical. - -![](./first-steps/resized-fader.png) - -Notice, however, that the fader's value handle is still vertical. To fix this, look in the Inspector at the right, expand "Fader style," and check the "horizontal" checkbox. - -![](./first-steps/fader-style.png) - -![](./first-steps/horizontal-fader.png) - -By the way: I suggest to keep the widgets closer to the top left, so that they are still visible on a phone screen (later). - -When designing an interface for production, you would change other object properties as well. In particular, the Open Sound Control addresses `/button_1` and `/fader_1` are not very descriptive. You would probably want to assign different command paths, in the "osc" tab. As this is just an introduction, we won't do that now. - -## Receiving the data - -At this time, the interface can already be used: three-dots menu > Editor > "Enabled" (click to disable the editor). (The controls will respond also when the editor is enabled, but you have to click an extra time to select the widget before changing its value.) - -To see the effect, launch one of the following apps and open the given patch. The Open Stage Control button should open and close the envelope, and the fader should control frequency. The patches also send control data from their own GUIs back to Open Stage Control, so all of the controls should be synced in both directions. - -NOTE: In Pure Data and Max, the default slider/fader range is 0-127, integers. Open Stage Control uses the range 0.0 - 1.0 by default. If you just create a slider and connect it, you won't see much action. In the example patches, the slider's properties have been modified to take a 0.0 - 1.0 floating-point range, matching the data from Open Stage Control. - -NOTE: Because all of the patches bind to the same UDP port, you can open only one at a time. You could, if you like, change the port number in one patch, and add that port by specifying multiple "send" targets in the Launcher, e.g. `127.0.0.1:57120 127.0.0.1:7374`. - -NOTE: These patches are provided as a courtesy to get you started more quickly. Maintaining, extending or developing them is outside the scope of the Open Stage Control community. - -!!! Example "Choose your app" - - === "Pure Data" - - Copy the code below, and save it into a text file `osc-first-steps.pd`. Then open it in Pure Data. - - ``` - #N canvas 436 127 562 502 12; - #X obj 86 51 loadbang; - #X msg 86 76 \; pd dsp 1; - #X obj 253 51 netreceive -u -b 57120; - #X obj 253 76 oscparse; - #X obj 253 101 list trim; - #X obj 253 126 route fader_1 button_1; - #X msg 253 190 4 \$1; - #X obj 253 215 pow; - #X obj 253 240 * 200; - #X obj 253 265 lop~ 3; - #X msg 328 265 \$1 100; - #X obj 328 304 line~; - #X obj 279 356 *~; - #X obj 279 381 *~ 0.1; - #X obj 266 424 dac~; - #X text 38 139 Open Stage Control \; "First Steps" tutorial \; hjh - 2023; - #X obj 253 304 osc~ 200; - #X obj 328 159 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 - #000000 0 1; - #X obj 256 159 hsl 60 15 0 1 0 0 empty empty empty -2 -8 0 10 #fcfcfc - #000000 #000000 0 1; - #X obj 70 251 unpack f s; - #X obj 70 325 oscformat; - #X msg 137 283 set \$1; - #X obj 70 424 netsend -u -b; - #X obj 93 356 loadbang; - #X msg 93 381 connect 127.0.0.1 8080; - #X obj 70 226 r sendback; - #X msg 379 200 \; sendback \$1 button_1; - #X msg 379 233 \; sendback \$1 fader_1; - #X connect 0 0 1 0; - #X connect 2 0 3 0; - #X connect 3 0 4 0; - #X connect 4 0 5 0; - #X connect 5 0 18 0; - #X connect 5 1 17 0; - #X connect 6 0 7 0; - #X connect 7 0 8 0; - #X connect 8 0 9 0; - #X connect 9 0 16 0; - #X connect 10 0 11 0; - #X connect 11 0 12 1; - #X connect 12 0 13 0; - #X connect 13 0 14 0; - #X connect 13 0 14 1; - #X connect 16 0 12 0; - #X connect 17 0 10 0; - #X connect 17 0 26 0; - #X connect 18 0 6 0; - #X connect 18 0 27 0; - #X connect 19 0 20 0; - #X connect 19 1 21 0; - #X connect 20 0 22 0; - #X connect 21 0 20 0; - #X connect 23 0 24 0; - #X connect 24 0 22 0; - #X connect 25 0 19 0; - ``` - - === "Max/MSP" - - Copy the text below. In Max, choose File > New from clipboard. - - ``` - ----------begin_max5_patcher---------- - 949.3oc0XkraaCCD8rCP9GHDxo.GWRJpEWzaEnW6gdrInfVlwgoxjBRTYEMe - 6khTx0HgVlwP1MFAwBZnjl2algyBe9zSFELS9.qJ.7YvOAiF8rVxHirFIi5D - LJXI8grbZk4ACVxppnKXAiaWTwdPYV3SWSmyJ+EBbFZ0h74lkjyt8BDdkzBp - J6FtXwuJYYJq1wwjIvw.LJt4RRh4F7DH3ptWRTujKxYJCJvqIUVq5Di5Dako - drfY+7AAfqLK8mSOo4p9x3AfwypUJoXiTNtWFSBaHIJB1bIM5iDiEr603+sD - tddQESLGfvZGj9ODHElBc5s8f5gnTqEHdKbG4l6vcleYxkKYB0aI32KXBvOT - ZuM3qRgpTlCtL3a7xJkVJqn5x.fpVIK4zbvEfat8F.FhCW8cx4BVlrVX9XgN - LK3DerKv0BLHoGNyRUNWuC1k6DG0GtsHEAM9wXCGvvsC6qykTkF3E0pdnC5e - JtjtjozoXXB5rbSbNruv+t0p3OYjhlr6lFkbwhblSSCoOSCBkLIZksAS5988 - 4R2Qa.uIP7pgeWxWt3BPVNO62.kDXABfVOmKcZe5MuOJzj3iDEYLSsUAfGtX - d1SyoYu3D3vdi4mNIQiXhcKKIp622W5a3fmh97W.57xNSIOsO9jfab.gSmZH - xfW+shuPPy2G0jN2oyCk5AYiwFZNs4liCx1TfwMeS7HKTaAWBb27t3sQ3wff - YTwh8RuVmgzIQc2pQrGTGaqQEAOFZyJ6wr7M3lIauNbqWd3o5+ivZz14KNM7 - XNpNxcPMzCh21gX3wPL845p5vItnZpGL0NVHYvGRxzB5dwyR1vLgIdzHc693 - ihQBKj26hl9LufceaX3GNm5l3ZoVULvpy4X03+tL.djn11rKJhrECPnaCP3l - 8yia+e+bD.Zdv32w.QIHryjWgdTjxFBfR1sQ+eOw31uroFyqOpKC7ZV3UVhJ - YcYV2Wr6vq.qgw4rJEWPUboX8mx9Pa1l6s9Zl21C88JTIKaFeu+wJ7GBDefP - 7dDAwGVadpWpCNX5KwG8EMXpyqHpzAScdE8fiFT8g1p9HCl9B8gejCbBgjMr - aDcvxGfh2iPn4DL7HnB9w.Bn8TZQjeIplNXwdHuxTYfEZXTneY9SFNFR7lgC - jBQdovgK+AB5kBcWMssCJZQwcrxp1WwpKcSi2JMg1ois2yE16ssnETxti28J - 1SpNfVp6IToaHrtz.wfGha6VNXoTuQQTy61t1v1FUa5KUP0SaUPs7xz+5omn - ef+B9C+QQC - -----------end_max5_patcher----------- - ``` - - === "SuperCollider" - - Copy/paste the code below into a new code document. Run the entire block to start. It will clean up when you close the GUI window. - - ``` - // OSC response part - ( - var addr = NetAddr("127.0.0.1", 8080); // FROM address - var freqRange = ControlSpec(200.0, 800.0, \exp); - var button, slider; - - OSCdef(\button, { |msg| - defer { button.value = msg[1] }; - if(x.notNil) { x.set(\gate, msg[1]) }; - }, '/button_1', addr); - - OSCdef(\slider, { |msg| - defer { slider.value = msg[1] }; - if(x.notNil) { x.set(\freq, freqRange.map(msg[1])) }; - }, '/fader_1', addr); - - w = Window("Open Stage Control", Rect(800, 200, 400, 100)).front; - w.layout = HLayout( - button = Button(), - slider = Slider().orientation_(\horizontal) - ); - w.alwaysOnTop = true; // may not take effect in all window managers - - button.states = [["off"], ["playing", Color.black, Color(0.7, 1, 0.7)]]; - button.action = { |view| - if(x.notNil) { x.set(\gate, view.value) }; - addr.sendMsg('/button_1', view.value); - }; - - slider.action = { |view| - if(x.notNil) { x.set(\freq, freqRange.map(view.value)) }; - addr.sendMsg('/fader_1', view.value); - }; - - w.onClose = { - if(x.notNil) { x.free }; - OSCdef(\button).free; - OSCdef(\slider).free; - }; - - // audio part - // if this fails (if you have an issue with audio devices), - // you won't hear anything but the onscreen GUIs - // will reflect changes from Open Stage Control - s.waitForBoot { - x = { |freq = 200, amp = 0.1, gate = 0| - var eg = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate); - (SinOsc.ar(Lag.kr(freq, 0.1)) * amp * eg).dup - }.play; - }; - ) - ``` - -## Deploying the interface - -The whole point of Open Stage Control is to make the interface available on other devices, especially mobile devices. - -The interface will not be visible to other clients, however, until you save it to disk: three-dots menu > Session > Save, and give the file a name such as `open-stage-demo` (you don't need to type the `.json` extension). - -Now -- remember those status messages in the launcher window? On another device (computer, phone or tablet), go to the `http://192.168.xxx.yyy:8080` address. The device should be on the same (W)LAN. (If there is another remote address, it may or may not work, depending on your network.) Supported browsers are Firefox v. 75 and higher, or Chromium/Chrome v. 60 and higher. - -This should open an empty client window, similar to the one you saw before. - -From here, you can open the session that you just saved: three-dots menu *in the webpage* > Session > Open Recent (yes, this is synced from the server!). This should display the controls created in that session, and the controls should function the same as in the other client window. - -And that is... it! Basic usage is as simple as that. - -For convenience, if there is a session you know that you will use often, and you don't want to load it in the webpage by hand every time, you can choose the file under "load" in the initial Launcher window. This is also useful for public deployments with audience participation, where you don't want audience members to have to load manually. - -When not using Open Stage Control, you can also stop the server from the launcher window (stop button, top-left). diff --git a/resources/docs/docs/tutorials/first-steps/fader-style.png b/resources/docs/docs/tutorials/first-steps/fader-style.png deleted file mode 100644 index a09ecd9c..00000000 Binary files a/resources/docs/docs/tutorials/first-steps/fader-style.png and /dev/null differ diff --git a/resources/docs/docs/tutorials/first-steps/horizontal-fader.png b/resources/docs/docs/tutorials/first-steps/horizontal-fader.png deleted file mode 100644 index 82916a6d..00000000 Binary files a/resources/docs/docs/tutorials/first-steps/horizontal-fader.png and /dev/null differ diff --git a/resources/docs/docs/tutorials/first-steps/resized-fader.png b/resources/docs/docs/tutorials/first-steps/resized-fader.png deleted file mode 100644 index e69acf21..00000000 Binary files a/resources/docs/docs/tutorials/first-steps/resized-fader.png and /dev/null differ diff --git a/resources/docs/docs/tutorials/first-steps/two-widgets.png b/resources/docs/docs/tutorials/first-steps/two-widgets.png deleted file mode 100644 index 62fa2a74..00000000 Binary files a/resources/docs/docs/tutorials/first-steps/two-widgets.png and /dev/null differ diff --git a/resources/docs/docs/url-options.md b/resources/docs/docs/url-options.md new file mode 100644 index 00000000..7dcae063 --- /dev/null +++ b/resources/docs/docs/url-options.md @@ -0,0 +1,23 @@ +# URL Options + +Client specific options can be set by adding query parameters to the server's url. One must prepend the url with a question mark (`?`) followed by `parameter=value` pairs separated with ampersands (`&`). + + +| Option | Value | Default | Description | +|----|----|----|----| +| hdpi | 1 / 0 | 0 | enable high resolution canvas | +| forceHdpi | number | 0 | force canvas scaling (ignore `hdpi`) | +| doubletab | number | 375 | sets the double tap/click time thershold in milliseconds | +| zoom | number | 1 | sets the initial zoom | +| framerate | number | 60 | limit canvas drawing framerate | +| lang | string | *system_default* | use a different language than the default if available (available languages: en, fr, ru) | + +Example: + +`http://server-ip:port?hdpi=1` + + +!!! note "" + When using the built-in client, url options can be set through the `--url-options` switch. + + Example: `open-stage-control --url-options zoom=2 doubletap=200` diff --git a/resources/docs/docs/user-interface/client.md b/resources/docs/docs/user-interface/client.md deleted file mode 100644 index 2133c01f..00000000 --- a/resources/docs/docs/user-interface/client.md +++ /dev/null @@ -1,96 +0,0 @@ -![](../../img/screenshots/client.png) - -## 1. Menu - -- Session - - New session: create a new empty session and enable the editor - - Open: browse session files on the server - - Open recent: open a recent session on the server - - Save / Save as: save session file on the server - - Fragment mode: when enabled, the session will be saved as a fragment file (only the root's first child will be saved) - - Save backup: save a copy of current session with a incremented suffix appended to the file name - - Import: import a session file from the client's filesystem - - Export: export a session file to the client's filesystem -- State - - Store: save all widgets' state to a persistent slot (stored in the client's cache) - - Recall: apply state storer in the persistent slot (updated widgets may send messages) - - Send All: make all widgets send their current value - - Open: browse state files on the server - - Save / Save as: save state file on the server - - Import: import a state file from the client's filesystem - - Export: export a state file to the client's filesystem -- Editor - - Enable: toggle editor's state - - Grid: toggle grid - - Project tree: toggle project tree's visibility - - Inspector: toggle inspector's visibility - - Relative units (%): when enabled, newly created widgets will have their position and size set in percents. -- Console - - Enable: toggle console's state - - Clear console: remove logged messages from the console -- Virtual keyboard: (desktop only) toggle virtual keyboard (displayed only when a text input is in focus, except for code editors in the inspector) -- Fullscreen: toggle fullscreen -- Notifications: toggle visibility of notifications -- Prevent sleep (mobile only): attempt to prevent device from going to sleep when idle - -## 2. Sidepanels - -The sidepanels are only visible when the editor is active, they can be resized and/or hidden. Both are described in the [editor](./editor.md) section. - -## 3. Session - -It is the main component, it contains all the widgets and takes all the available space when the sidepanels are closed. - -## 4. Notifications - -Notifications appear in the lower right corner, they are usually used to convey server status information and can be dismissed with a single click. - -## 5. Modals - -![](../../img/screenshots/modal.png) - -Modals are virtual popup windows that may contain various content: file browser, color picker, error, widgets... - -## Keyboard shortcuts - -=== "Linux" - - | Shortcut | Description | - |---|---| - | ++ctrl+"Mousewheel"++ | change global zoom (pixel scaling) | - | ++ctrl+0++ | reset global zoom | - | ++ctrl+e++ | enable/disable editor | - | ++ctrl+k++ | show/hide console | - | ++ctrl+l++ | clear console | - | ++ctrl+s++ | save session | - | ++ctrl+shift+s++ | save session as... | - | ++ctrl+o++ | open a session file | - | ++ctrl+w++ | close client | - -=== "Windows" - - | Shortcut | Description | - |---|---| - | ++ctrl+"Mousewheel"++ | change global zoom (pixel scaling) | - | ++ctrl+0++ | reset global zoom | - | ++ctrl+e++ | enable/disable editor | - | ++ctrl+k++ | show/hide console | - | ++ctrl+l++ | clear console | - | ++ctrl+s++ | save session | - | ++ctrl+shift+s++ | save session as... | - | ++ctrl+o++ | open a session file | - | ++alt+f4++ | close client | - -=== "Mac" - - | Shortcut | Description | - |---|---| - | ++cmd+"Mousewheel"++ | change global zoom (pixel scaling) | - | ++cmd+0++ | reset zoom | - | ++cmd+e++ | enable/disable editor | - | ++cmd+k++ | show/hide console | - | ++cmd+l++ | clear console | - | ++cmd+s++ | save session | - | ++cmd+shift+s++ | save session as... | - | ++cmd+o++ | open a session file | - | ++cmd+w++ | close client | diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md deleted file mode 100644 index bfa62544..00000000 --- a/resources/docs/docs/user-interface/editor.md +++ /dev/null @@ -1,156 +0,0 @@ -## Widget selection - -Clicking on a widget, on a tab label or on an item in the project tree selects the widgets for editing: - -- All its editable properties are shown in the inspector panel -- The corresponding item in the project tree is highlighted -- A selection outline is drawn around the widget -- Dragging / Resizing handles are added to the widget - -![](../../img/screenshots/editor.png) - -To interact with a widget directly without selecting it, either use the middle mouse button or hold ++shift+win++ (++shift+cmd++ on Mac). - -## Menu - -Right clicking on a widget displays a menu with the following actions - -- `Show in tree`: show widget in project tree (hidden when clicking in the project tree) -- `Position`: - - `Send to back`: Send selected widget to back (first of siblings) - - `Send farther`: Send selected widget farther - - `Bring closer`: Bring selected widget closer - - `Bring to front`: Bring selected widget to front (last of siblings) -- `Copy`: copy widget's data -- `Cut`: copy widget's data and delete selected widget -- `Paste`: paste copied widget in selected container - - `Paste`: paste the widget as is - - `ID + 1` : increments the id of the copied widget (and all its children) before pasting - - `Clone` : create a clone widget targetting the copied widget -- `Add widget`: create a new widget in selected container -- `Add tab`: create a new tab in selected container -- `Export`: export as fragment file -- `Delete`: delete selected tab or widget - - -## Inspector - -Selected widget's properties are displayed and can be modified in the inspector. The [properties reference](../widgets/properties-reference.md) lists the available properties for each widget type. - -- Property fields are all multiline (press `shift + enter` for new line). -- Properties are written in JSON, with some flexibility brought by the [JSON5](https://github.com/json5/json5) format. For example, double quotes around object keys are not mandatory. -- Clicking on a property name spawns a help modal window -- Properties are divided into multiple categories that can be toggled with a click. ++alt+"Click"++ on a category closes the other categories before toggling selected category. - -Some properties (for example `onValue`) have a special code editor with syntax highlighting and many keyboard shortcuts (available by clicking on the "Help" button). In these properties, pressing `enter` will not submit pending changes but instead insert a new line at the cursor position (as you would expect in a regular editor). To submit pending changes, press ++ctrl+enter++ (or ++cmd+enter== on Mac) or click outside the editor. - -Widgets can be locked for edition by enabling their `lock` property. When locked, a widget can't be modified by the editor but it remains possible to delete it or to move it from a container to another in the project tree. - -## Project tree - -The project tree displays the whole widget structure of the session. Widgets can be reordered or moved to another container with drag-and-drop. - -The "Filter" input allows filtering displayed widgets by their `id`. It's also possible to only display a single type of widget by typing `type:fader` for example. - -Invisible widgets are displayed with a lower opacity and their name in italic. Locked widgets are displayed with a lock icon after their name. - -## Widget resizing / dragging - -Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle (holding ++alt++ extends this handle to the widget's size to ease dragging). If the widget's position/size was written in percents, the editor will try to keep using percents. - -When the grid is enabled, widget resizing / dragging snaps to a 10 pixel wide grid. - -## Multi-widgets editing - -Multiple widgets can be edited at once. - -- The inspector will only display properties that are shared by all selected widgets -- Selection can only contain sibling widgets (same direct parent) -- Context-menu actions and properties changes apply to all selected widgets -- Resizing / Dragging will affect all selected widgets, relatively the selection's size and position - - -## Keyboard shortcuts - -=== "Linux / Windows" - - | Shortcut | Description | - |---|---| - | ++ctrl+g++ | Toggle grid. | - | ++ctrl+t++ | Toggle session tree. | - | ++ctrl+i++ | Toggle inspector. | - | ++"Click"++ | Widget selection. | - | ++ctrl+"Click"++ | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.| - | ++shift+"Click"+"Drag"++ | Draw a selection rectangle and attempt to select widgets in it. If ++ctrl++ is pressed too, current selection is kept and will be merged with the new one if possible. | - | ++ctrl+z++ | Undo | - | ++ctrl+y++
++ctrl+shift+z++ | Redo | - | ++delete++ | Delete selected widgets | - | ++ctrl+c++ | Copy selected widgets | - | ++ctrl+x++ | Cut selected widgets | - | ++ctrl+v++ | Paste clipboard in selected widget | - | ++ctrl+shift+v++ | Paste and increment id | - | ++ctrl+d++ | Duplicate selected widget | - | ++ctrl+shift+d++ | Duplicate selected widget and increment id | - | ++alt+c+"Drag"++ | Paste selection to position | - | ++alt+c+shift+"Drag"++ | Paste selection to dragged position and increment id | - | ++ctrl+up++
++ctrl+down++
++ctrl+left++
++ctrl+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | - | ++alt+up++
++alt+down++
++alt+left++
++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | - | ++ctrl+a++ | Select current widget's siblings and itself | - | ++ctrl+shift+a++ | Cancel current widget selection | - | ++up++ | Select current widget's previous sibling | - | ++down++ | Select current widget's next sibling | - | ++left++ | Select current widget's parent | - | ++right++ | Select current widget's first child | - | ++t++ | Show selected widget(s) in the project tree | - | ++y++ | Show selected widget(s) in the session | - | ++ctrl+f++ | Focus search input in project tree | - | ++"Home"++ | Send selected widget to back | - | ++"Page Up"++ | Send selected widget farther | - | ++"Page Down"++ | Bring selected widget closer | - | ++"End"++ | Bring selected widget to front | - | ++"F2"++ | Bring "label" property input into view if selected widget has one | - | ++h++ | Hide selection area and widget resize / drag handles while pressed | - | ++alt+"Mousewheel"++ | change editor zoom | - | ++ctrl+0++ | reset zoom | - - -=== "Mac" - - | Shortcut | Description | - |---|---| - | ++cmd+g++ | Toggle grid. | - | ++cmd+t++ | Toggle session tree. | - | ++cmd+i++ | Toggle inspector. | - | ++"Click"++ | Widget selection. | - | ++cmd+"Click"++ | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.| - | ++shift+"Click"+"Drag"++ | Draw a selection rectangle and attempt to select widgets in it. If ++cmd++ is pressed too, current selection is kept and will be merged with the new one if possible. | - | ++cmd+z++ | Undo | - | ++cmd+y++
++cmd+shift+z++ | Redo | - | ++backspace++ | Delete selected widgets | - | ++cmd+c++ | Copy selected widgets | - | ++cmd+x++ | Cut selected widgets | - | ++cmd+v++ | Paste clipboard in selected widget | - | ++cmd+shift+v++ | Paste and increment id | - | ++cmd+d++ | Duplicate selected widget | - | ++cmd+shift+d++ | Duplicate selected widget and increment id | - | ++alt+c+"Drag"++ | Paste selection to position | - | ++alt+c+shift+"Drag"++ | Paste selection to dragged position and increment id | - | ++cmd+up++
++cmd+down++
++cmd+left++
++cmd+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | - | ++alt+up++
++alt+down++
++alt+left++
++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | - | ++cmd+a++ | Select current widget's siblings and itself | - | ++cmd+shift+a++ | Cancel current widget selection | - | ++up++ | Select current widget's previous sibling | - | ++down++ | Select current widget's next sibling | - | ++left++ | Select current widget's parent | - | ++right++ | Select current widget's first child | - | ++t++ | Show selected widget in the project tree | - | ++y++ | Show selected widget(s) in the session | - | ++cmd+f++ | Focus search input in project tree | - | ++"Home"++ | Send selected widget to back | - | ++"Page Up"++ | Send selected widget farther | - | ++"Page Down"++ | Bring selected widget closer | - | ++"End"++ | Bring selected widget to front | - | ++"F2"++ | Bring "label" property input into view if selected widget has one | - | ++h++ | Hide selection area and widget resize / drag handles while pressed | - | ++alt+"Mousewheel"++ | change editor zoom | - | ++cmd+0++ | reset zoom | diff --git a/resources/docs/docs/user-interface/launcher.md b/resources/docs/docs/user-interface/launcher.md deleted file mode 100644 index 87ba9d67..00000000 --- a/resources/docs/docs/user-interface/launcher.md +++ /dev/null @@ -1,81 +0,0 @@ -![](../../img/screenshots/launcher.png) - -## 1. Menu - -- Start: start the server (hidden when started) -- Stop: stop the server (hidden when stopped) -- New window: open a new client window (hidden when stopped) -- Load: load server configuration from file -- Save / Save as: save server configuration to file -- MIDI - - List devices: list available MIDI devices in the console - - Restart backend: restart midi backend without restarting the server -- Console: - - Clear: clear console - - Autoscroll: enable/disable console autoscroll - - Check for update at startup: enable/disable this feature -- Launcher - - Autostart: start the server automatically when launcher is started - - Always on top: pin the launcher window above other the windows - - Use tray: enable tray icon and menu - - Start minimized: starts the launcher minimized (or hidden in tray) - -The "play/stop" icon can be used to start and stop the server without opening the menu. - -## 2. Configuration form - -Each server option is displayed here. When clicking on an option's label, a short help will be printed in the console. When an option is not correctly set, its label will turn to orange and an error message will be printed in the console. - -## 3. Console - -The console displays various information, runtime errors and server debug messages. - -## Tray icon - -If `Use tray` is set, the launcher comes with a system tray icon that keeps the launcher alive when closed if there is at least one client window opened or if the server is running. Its context menu can be used to toggle the launcher's visibility and access some of the launcher's menu actions. - -## Keyboard shortcuts - -=== "Linux" - - | Shortcut | Description | - |---|---| - | ++f5++ | start server | - | ++f6++ | stop server | - | ++ctrl+n++ | open new client window | - | ++ctrl+o++ | load settings | - | ++ctrl+s++ | save settings | - | ++ctrl+shift+s++ | save settings as... | - | ++ctrl+m++ | list midi devices | - | ++ctrl+l++ | clear console | - | ++ctrl+w++ | close window | - - -=== "Windows" - - | Shortcut | Description | - |---|---| - | ++f5++ | start server | - | ++f6++ | stop server | - | ++ctrl+n++ | open new client window | - | ++ctrl+o++ | load settings | - | ++ctrl+s++ | save settings | - | ++ctrl+shift+s++ | save settings as... | - | ++ctrl+m++ | list midi devices | - | ++ctrl+l++ | clear console | - | ++alt+f4++ | close window | - -=== "Mac" - - | Shortcut | Description | - |---|---| - | ++f5++ | start server | - | ++f6++ | stop server | - | ++cmd+n++ | open new client window | - | ++cmd+o++ | load settings | - | ++cmd+s++ | save settings | - | ++cmd+shift+s++ | save settings as... | - | ++cmd+m++ | list midi devices | - | ++cmd+l++ | clear console | - | ++cmd+w++ | close window | - | ++cmd+q++ | quit app | diff --git a/resources/docs/docs/widgets-reference.md b/resources/docs/docs/widgets-reference.md new file mode 100644 index 00000000..481cf3f0 --- /dev/null +++ b/resources/docs/docs/widgets-reference.md @@ -0,0 +1,832 @@ + + +# Widget reference + +
+ + +
Properties shared by all widgets
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

type#

| `string` | "auto" | | +|

id#

| `string` | "auto" | Widgets sharing the same `id` will act as clones and update each other's value(s) without sending extra osc messages. | +|

linkId#

| `string`|
`array` | "" | Widgets sharing the same `linkId` update each other's value(s) AND send their respective osc messages.

When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)

When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending) | +|

geometry#

|||| +|

left#

| `number`|
`string` | "auto" | When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).

Otherwise, the widget will be absolutely positioned | +|

top#

| `number`|
`percentage` | "auto" | When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).

Otherwise, the widget will be absolutely positioned | +|

width#

| `number`|
`percentage` | "auto" | | +|

height#

| `number`|
`percentage` | "auto" | | +|

style#

|||| +|

label#

| `string`|
`boolean` | "auto" | Set to `false` to hide completely

Insert icons using the prefix ^ followed by the icon's name : ^play, ^pause, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free) | +|

color#

| `string` | "auto" | Defines the widget's accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget. | +|

css#

| `string` | "" | CSS rules. See documentation. | +|

value#

|||| +|

default#

| `*` | "" | If set, the widget will be initialized with this value when the session is loaded. | +|

value#

| `*` | "" | Define the widget's value depending on other widget's values / properties using property inheritance and property maths | +|

osc#

|||| +|

precision#

| `integer`|
`string` | 2 | Defines the number of decimals to display and to send.

Set to `0` to send integers only.

Data type can be specified by appending a valid osc type tag to the precision value, for example : `3d` will make the widget send double precision numbers rounded to three decimals | +|

address#

| `string` | "auto" | OSC address for sending messages, it must start with a / | +|

preArgs#

| `*`|
`array` | "" | A value or array of values that will be prepended to the OSC messages.

Values can be defined as objects if the osc type tag needs to be specified: `{type: "i", value: 1}` | +|

target#

| `string`|
`array`|
`null` | "" | This defines the targets of the widget's OSC messages
- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`
- If midi is enabled, targets can be `midi:device_name`
- The special item `"self"` can be used to refer to the emitting client directly.
- If no target is set, messages can still be sent if the server has default targets
- The server's default targets can be bypassed by setting one of the items to `null` | +|

bypass#

| `boolean` | false | Set to `true` to prevent the widget from sending any osc message |
+ +## Sliders + + +
+ + +
Vertical / horizontal slider.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--color-gauge: color;`
- `--color-knob: color;`
- `--color-pips: color;`
- `--gauge-opacity: number;`
- `--gauge-width: number;` (2-16, requires a manual resize to take effect) | +|

fader#

|||| +|

horizontal#

| `boolean` | false | Set to `true` to display the fader horizontally | +|

alignRight#

| `boolean` | false | Set to `true` to invert the pip's and fader's position | +|

pips#

| `boolean` | true | Set to `false` to hide the scale | +|

input#

| `boolean` | true | Set to `false` to hide the built-in input | +|

meter#

| `boolean` | false | Set to true to display a vu-meter next in the fader
- the meter's `id` will be the same as the widget's with `/meter` appended to it
- the meter's `address` will be the same as the widget's with `/meter` appended to it | +|

compact#

| `boolean` | false | Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled. | +|

dashed#

| `boolean` | false | Set to `true` to display a dashed gauge | +|

snap#

| `boolean` | false | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position | +|

spring#

| `boolean` | false | When set to `true`, the widget will go back to its `default` value when released | +|

doubleTap#

| `boolean` | false | Set to `true` to make the fader reset to its `default` value when receiving a double tap.

Can also be an osc address, in which case the widget will just send an osc message (`/ `) | +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the breakpoints of the fader's scale:
- keys can be percentages and/or `min` / `max`
- values can be `number` or `object` if a custom label is needed

Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`) | +|

logScale#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. | +|

sensitivity#

| `number` | 1 | Defines the fader's sensitivity when `snap` is `false` | +|

steps#

| `string`|
`number`|
`array` | "" | Restricts the widget's value:
- `auto`: use values defined in `range`
- `number`: define a number of evenly spaced steps
- `array`: use arbitrary values | +|

unit#

| `string` | "" | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) | +|

origin#

| `number` | "auto" | Defines the starting point's value of the fader's gauge | +|

osc#

|||| +|

touchAddress#

| `string` | "" | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` | +|

meterAddress#

| `string` | "" | OSC address for the built-in meter |
+ + + + +
+ + +
Rotative knob slider.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--color-gauge: color;`
- `--color-knob: color;`
- `--color-pips: color;` | +|

knob#

|||| +|

pips#

| `boolean` | false | Set to `true` to show the scale's breakpoints | +|

input#

| `boolean` | true | Set to `false` to hide the built-in input | +|

compact#

| `boolean` | false | Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled. | +|

dashed#

| `boolean` | false | Set to `true` to display a dashed gauge | +|

angle#

| `number` | 270 | Defines the angle's width of the knob, in degrees | +|

snap#

| `boolean` | false | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position | +|

spring#

| `boolean` | false | When set to `true`, the widget will go back to its `default` value when released | +|

doubleTap#

| `boolean` | false | Set to `true` to make the knob reset to its `default` value when receiving a double tap.

Can also be an osc address, in which case the widget will just send an osc message (`/ `) | +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the breakpoints of the fader's scale:
- keys can be percentages and/or `min` / `max`
- values can be `number` or `object` if a custom label is needed

Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`) | +|

logScale#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. | +|

sensitivity#

| `number` | 1 | Defines the knob's sensitivity when `snap` is `false` | +|

steps#

| `string`|
`number`|
`array` | "" | Restricts the widget's value:
- `auto`: use values defined in `range`
- `number`: define a number of evenly spaced steps
- `array`: use arbitrary values | +|

unit#

| `string` | "" | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) | +|

origin#

| `number` | "auto" | Defines the starting point's value of the knob's gauge | +|

osc#

|||| +|

touchAddress#

| `string` | "" | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` |
+ + + + +
+ + +
A knob that sends a relative direction infomation instead of an absolute value.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

encoder#

|||| +|

compact#

| `boolean` | false | Set to `true` to display a compact alternative for the widget. | +|

ticks#

| `number` | 360 | defines the granularity / verbosity of the encoder (number of step for a 360° arc) | +|

back#

| `*` | -1 | Defines which value is sent when rotating the encoder anticlockwise | +|

forth#

| `*` | 1 | Defines which value is sent when rotating the encoder clockwise | +|

release#

| `number` | "" | Defines which value is sent when releasing the encoder:
- Set to `null` to send send no argument in the osc message
- Can be an `object` if the type needs to be specified | +|

snap#

| `boolean` | false | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position | +|

doubleTap#

| `boolean` | false | Set to `true` to make the fader reset to its `default` value when receiving a double tap.

Can also be an osc address, in which case the widget will just send an osc message (`/ `) | +|

osc#

|||| +|

touchAddress#

| `string` | "" | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` |
+ + + + +
+ + +
A fader with two heads for setting a range.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--color-gauge: color;`
- `--color-knob: color;`
- `--color-pips: color;`
- `--gauge-opacity: number;` | +|

range#

|||| +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| See fader's `range` | +|

horizontal#

| `boolean` | false | See fader's `horizontal` | +|

alignRight#

| `boolean` | false | See fader's `alignRight` | +|

input#

| `boolean` | true | See fader's `input` | +|

compact#

| `boolean` | false | See fader's `compact` | +|

pips#

| `boolean` | true | See fader's `pips` | +|

snap#

| `boolean` | false | See fader's `snap` | +|

spring#

| `boolean` | false | See fader's `spring` | +|

logScale#

| `boolean` | false | See fader's `logScale` | +|

sensitivity#

| `number` | 1 | See fader's `sensitivity` | +|

osc#

|||| +|

touchAddress#

| `string` | "" | See fader's `touchAddress` | +|

split#

| `boolean`|
`object` | false | Set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget's with `/low` or `/high` appended to it

Can be set as an object to specify a different `address` : `['/osc_address_low', '/osc_address_high']`

Note: the widget will only respond to its original osc address, not to the splitted version |
+ + + +## Buttons + + +
+ + +
On / off button.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

toggle#

|||| +|

doubleTap#

| `boolean` | false | Set to `true` to make the button require a double tap to be toggled instead of a single tap | +|

led#

| `boolean` | false | Set to `true` to display the toggle's state with a led | +|

on#

| `*` | 1 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) | +|

off#

| `*` | 0 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) |
+ + + + +
+ + +
On / off button that turns off when released.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

push#

|||| +|

doubleTap#

| `boolean` | false | Set to `true` to make the button require a double tap to be pushed instead of a single tap | +|

on#

| `*` | 1 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) | +|

off#

| `*` | 0 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) | +|

norelease#

| `boolean` | false | Set to `true` to prevent sending any osc message when releasing the button |
+ + + + +
+ + +
Value selector button.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

switch#

|||| +|

horizontal#

| `boolean` | false | Set to `true` to display values horizontally | +|

showValues#

| `boolean` | false | If values is an object, set to `true` to display both values and labels instead of labels only | +|

values#

| `array`|
`object` | \{
 "Value 1": 1,
 "Value 2": 2
}
| `Array` of possible values to switch between : `[1,2,3]`

`Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept | +|

traversing#

| `boolean` | true | Set to `false` to disable traversing gestures |
+ + + + +
+ + +
Native dropdown menu.
+ +| property | type |default | description | +| --- | --- | --- | --- | +| |||| +| | `array`|
`object` | \{
 "Value 1": 1,
 "Value 2": 2
}
| `Array` of possible values to switch between : `[1,2,3]`

`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept

An empty option will always be prepended to values (sends an osc message without any value); it can be hidden by adding `option:first-child{display:none}` to the widget's `css` |
+ + + + +
+ + +
Drag and drop menu with a circular or grid layout.
+ +| property | type |default | description | +| --- | --- | --- | --- | +| |||| +| | `number`|
`array` | 200 | - If `circular` is `true`: diameter (in px)
- If `circular` is `false`: square size or `[width, height]` array | +| | `boolean` | true | Defines whether the menu should be rendered in a circle or in a box | +| | `boolean`|
`number` | false | If `circular` is `false`, set this to `true` for vertical layout

Ignored when `grid` is `true` | +| | `boolean`|
`number` | false | - If `circular` is `false`, set this to `true` for grid layout
- Can be a `number` to define the number of columns | +| | `boolean` | false | Set to `true` to make the menu stay opened after mouse/touch release | +| | `boolean` | false | Set to `true` to make the menu require a double tap to be opened instead of a single tap | +| | `array`|
`object` | \{
 "Value 1": 1,
 "Value 2": 2
}
| `Array` of possible values to switch between : `[1,2,3]`

`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept | +| | `array` | "" | `Array` of `number` defining the weights of each value in `values`

Ignored when `grid` is `true` |
+ + + +## Pads + + +
+ + +
Two-dimensional slider.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--background: background;`: sets the dragging area's background
- `--pips-color: color;`
- `--pips-opacity: number;`
- `--point-opacity: number;` | +|

xy#

|||| +|

pointSize#

| `integer` | 20 | Defines the points' size | +|

snap#

| `boolean` | false | By default, the points are dragged from their initial position.

If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates | +|

spring#

| `boolean` | false | When set to `true`, the widget will go back to its default value when released | +|

pips#

| `boolean` | true | Set to `false` to hide the scale | +|

rangeX#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the x axis | +|

rangeY#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the y axis | +|

logScaleX#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. | +|

logScaleY#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. | +|

input#

| `boolean` | true | Set to false to hide the built-in input widget | +|

doubleTap#

| `boolean`|
`string` | false | Set to `true` to make the fader reset to its default value when receiving a double tap.

Can also be an osc address, which case the widget will just send an osc message: `/ ` | +|

sensitivity#

| `number` | 1 | Defines the pad's sensitivity when `snap` is `false` | +|

osc#

|||| +|

touchAddress#

| `string` | "" | OSC address for touched state messages: `/touchAddress [preArgs] 0/1`) | +|

split#

| `boolean`|
`object` | false | Set to `true` to send separate osc messages for each point's x and y axis. The address will be the same as the widget's with `/x` or `/y` appended to it

Can be set as an `object` to specify a different address : ['/osc_address_x', '/osc_address_y']

Note: the widget will only respond to its original osc address, not to the splitted version |
+ + + + +
+ + +
Color picker with optional alpha slider.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

rgb#

|||| +|

snap#

| `boolean` | false | By default, the points are dragged from their initial position.

If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates | +|

spring#

| `boolean` | false | When set to `true`, the widget will go back to its default value when released | +|

range#

| `object` | \{
 "min": 0,
 "max": 255
}
| Defines the widget's output scale. | +|

input#

| `boolean` | true | Set to `false` to hide the built-in input widget | +|

alpha#

| `boolean` | false | Set to `true` to enable alpha channel | +|

osc#

|||| +|

split#

| `boolean`|
`object` | false | Set to `true` to send separate osc messages for for r and g & b. The address will be the same as the widget's with `/r`, `/g` or `/b` appended to it

Can be set as an `object` to specify a different address : `['/r', '/g', 'b']`

Note: the widget will only respond to its original osc address, not to the splitted version |
+ + + + +
+ + +
Multi-point XY pad.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--background: background;`: sets the dragging area's background
- `--pips-color: color;`
- `--pips-opacity: number;`
- `--color-text: point-color;`

Pads can be targetted individually with the .pad-X selector (where X is the pad's index) | +|

multi xy#

|||| +|

points#

| `integer`|
`array` | 2 | Defines the number of points on the pad

Can be an array of strings that will be used as labels for the points (ex: `['A', 'B']`) | +|

xy#

|||| +|

pointSize#

| `integer` | 20 | Defines the points' size | +|

snap#

| `boolean` | false | By default, the points are dragged from their initial position.

If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates | +|

spring#

| `boolean` | false | When set to `true`, the widget will go back to its default value when released | +|

pips#

| `boolean` | true | Set to `false` to hide the scale | +|

rangeX#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the x axis | +|

rangeY#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the y axis | +|

logScaleX#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. | +|

logScaleY#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. | +|

sensitivity#

| `number` | 1 | Defines the pad's sensitivity when `snap` is `false` | +|

osc#

|||| +|

touchAddress#

| `string` | "" | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` | +|

split#

| `boolean`|
`object` | false | Set to `true` to send separate osc messages for each point's x and y axis. The address will be the same as the widget's with `/N/x` or `/N/y` appended to it, where N is the point's id (or the point's label if points is an array)

Can be set as an `object` to specify a different address : `['/0/x', '/0/y', '/1/x', '/2/y']`

Note: the widget will only respond to its original osc address, not to the splitted version |
+ + + +## Matrices + + +
+ + +
Generic matrix for creating rows/columns of widgets.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

matrix#

|||| +|

widgetType#

| `string` | "toggle" | Defines the type of the widgets in the matrix | +|

matrix#

| `array` | [
 2,
 2
]
| Defines the number of columns and and rows in the matrix | +|

start#

| `integer` | 0 | First widget's index | +|

spacing#

| `integer` | 0 | Adds space between widgets | +|

traversing#

| `boolean` | true | Set to `false` to disable traversing gestures | +|

border#

| `boolean` | true | Set to `false` to disables the widgets' borders | +|

props#

| `object` | \{} | Defines a set of property to override the widgets' defaults.

Formulas in this field are resolved with an extra variable representing each widget's index: `$`

Note: by default, the widgets inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) |
+ + + + +
+ + +
Piano keyboard.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--color-white:color;` (white keys color)
- `--color-black:color;` (black keys color) | +|

matrix#

|||| +|

keys#

| `number` | 25 | Defines the number keys | +|

start#

| `number` | 48 | MIDI note number to start with (default is C4)

Standard keyboards settings are: `[25, 48]`, `[49, 36]`, `[61, 36]`, `[88, 21]` | +|

traversing#

| `boolean` | true | Set to `false` to disable traversing gestures | +|

on#

| `*` | 1 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) | +|

off#

| `*` | 0 | Set to `null` to send send no argument in the osc message

Can be an `object` if the type needs to be specified (see preArgs) | +|

toggles#

| `boolean` | false | Set to `true` to make keys bahave like toggle buttons | +|

osc#

|||| +|

split#

| `boolean`|
`string` | false | `true`: the widget's index will be appended to the matrice's osc address

`false`: it will be prepended to the widget's preArgs

`string`: will be used to define the widgets' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\$`)) |
+ + + + +
+ + +
Connect inputs to outputs.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | The inputs/ouputs width can be adjusted by using the `.nodes` selector:

`.nodes { width: 25% }` | +|

patchbay#

|||| +|

inputs#

| `array`|
`object` | [
 "input_1",
 "input_2"
]
| - `Array` of input names : `['input_1', 'input_2']`
- `Object` of `"label_1": "input_1"` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept



Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected:

`/patchbay_address input_x output_x output_y etc`

If no output is connected to the input, the message will be `/patchbay_address input_x`

The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1` | +|

outputs#

| `array`|
`object` | [
 "output_1",
 "output_2"
]
| List of output values the inputs can connect to (see `inputs`). |
+ + + +## Plots + + +
+ + +
XY coordinates plot.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

plot#

|||| +|

rangeX#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the x axis | +|

rangeY#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the y axis | +|

logScaleX#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. | +|

logScaleY#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. | +|

origin#

| `number` | "auto" | Defines the y axis origin. Set to `false` to disable it. | +|

dots#

| `boolean` | true | | +|

bars#

| `boolean` | false | Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing) | +|

smooth#

| `boolean`|
`number` | false | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) | +|

pips#

| `boolean` | true | Set to `false` to hide the scale | +|

value#

|||| +|

value#

| `array`|
`string` | "" | - `Array` of `y` values
- `Array` of `[x, y]` `array` values
- `String` `array`
- `String` `object` to update specific coordinates only: `{0:1, 4:0}` will change the 1st and 5th points' coordinates |
+ + + + +
+ + +
Draws frequency response between from from an array of filter objects.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

eq#

|||| +|

pips#

| `boolean` | true | Set to false to hide the scale | +|

resolution#

| `number` | 128 | Defines the number of points used to compute the frequency response | +|

rangeY#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the y axis | +|

origin#

| `number`|
`boolean` | "auto" | Defines the y axis origin. Set to `false` to disable it | +|

logScaleX#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. | +|

smooth#

| `boolean`|
`number` | false | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) | +|

value#

|||| +|

value#

| `array` | "" | Each item must be an object with the following properties
- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak" or "notch")
- `freq`: number (filter's resonant frequency)
- `q`: number (Q factor)
- `gain`: number
- `on`: boolean |
+ + + + +
+ + +
Display its value over time.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

visualizer#

|||| +|

duration#

| `number` | 1 | Defines visualization duration in seconds | +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| Defines the min and max values for the y axis | +|

origin#

| `number` | "auto" | Defines the y axis origin. Set to `false` to disable it | +|

logScale#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. | +|

smooth#

| `boolean`|
`number` | false | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) | +|

pips#

| `boolean` | true | Set to `false` to hide the scale |
+ + + + +
+ + +
Intensity display.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

led#

|||| +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| Value to led intensity mapping range | +|

logScale#

| `boolean`|
`number` | false | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. |
+ + + + +
+ + +
Rgb / rgba color display
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

value#

|||| +|

value#

| `array`|
`string` | "" | - `Array`: `[r, g, b]` (`r`, `g` and `b` between `0` and `255`)
- `Array`: `[r, g, b, alpha]` (`alpha` between `0` and `255`)
- `String`: CSS color |
+ + + + +
+ + +
Non-interactable fader.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

css#

| `string` | "" | Available CSS variables:
- `--color-gauge: color;`
- `--color-knob: color;`
- `--color-pips: color;`
- `--gauge-opacity: number;` | +|

meter#

|||| +|

range#

| `object` | \{
 "min": 0,
 "max": 1
}
| See fader's `range` | +|

logScale#

| `boolean` | false | See fader's `logScale` | +|

origin#

| `number` | "auto" | See fader's `origin` | +|

unit#

| `string` | "auto" | See fader's `unit` | +|

alignRight#

| `boolean` | false | See fader's `alignRight` | +|

horizontal#

| `boolean` | false | See fader's `horizontal` | +|

pips#

| `boolean` | false | See fader's `pips` | +|

dashed#

| `boolean` | false | See fader's `dashed` | +|

gradient#

| `array`|
`object` | [] | When set, the meter's gauge will be filled with a linear color gradient
- each item must be a CSS color string.
- as an `object`: each key must be a number between 0 and 1
- each item must be a CSS color string.

Examples: `['blue', 'red']`, {'0': 'blue', '0.9': 'blue', '1': 'red'} |
+ + + + +
+ + +
Display text.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

text#

|||| +|

vertical#

| `boolean` | false | Set to `true` to display the text vertically | +|

wrap#

| `boolean` | false | Set to `true` to wrap long lines automatically.

This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property | +|

align#

| `string` | "" | Set to `left` or `right` to change text alignment (otherwise center) |
+ + + + +
+ + +
Load a image (url or base64-encoded).
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

image#

|||| +|

size#

| `string` | "cover" | CSS background-size | +|

position#

| `string` | "center" | CSS background-position | +|

repeat#

| `string` | "no-repeat" | CSS background-repeat | +|

border#

| `boolean` | true | Set to `false` to disable the borders and background-color | +|

cache#

| `boolean` | true | Set to false to disable image caching (forces file reload when updating or editing the widget).

When true, sending `reload` to the widget reloads its image without changing its value | +|

value#

|||| +|

value#

| `string` | "" | - File `url` or `path` (relative to the session file location by default, falling back to absolute path)
- Base64 encoded image : `data:image/...` |
+ + + + +
+ + +
Svg parser.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

svg#

|||| +|

svg#

| `string` | "" | Svg xml definition:
- will be wrapped in a `< svg />` element
- `` commands support a special percent notation (`%x` and `%y`) | +|

border#

| `boolean` | true | Set to `false` to disable the borders and background-color |
+ + + + +
+ + +
Simple HTML parser.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

html#

|||| +|

html#

| `string` | "" | Allowed HTML tags:

  h1-6, blockquote, p, a, ul, ol, nl, li,

  b, i, strong, em, strike, code, hr, br, div,

  table, thead, img, caption, tbody, tr, th, td, pre | +|

border#

| `boolean` | true | Set to `false` to disable the borders and background-color |
+ + + + +
+ + +
Embed a page in a frame (local network only).
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

style#

|||| +|

label#

| `string`|
`boolean` | "auto" | Set to `false` to hide completely

Insert icons using the prefix ^ followed by the icon's name : ^play, ^pause, etc

If set to `false`, all pointer-events will be disabled on the frame as long as the editor is enabled to ensure it can be selected | +|

frame#

|||| +|

border#

| `boolean` | true | Set to `false` to disable the borders and background-color | +|

value#

|||| +|

value#

| `string` | "" | External web page URL. Only local URLs are allowed (starting with `http://127.0.0.1/`, `http://10.x.x.x/`, `http://192.168.x.x/`, etc) |
+ + + +## Containers + + +
+ + +
Widgets or Tabs container.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

panel#

|||| +|

scroll#

| `boolean` | true | Set to `false` to disable scrollbars | +|

border#

| `boolean` | true | By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too | +|

value#

|||| +|

value#

| `integer` | "" | Defines currently opened tab in the widget

A tab can be opened only by setting its parent's value | +|

children#

|||| +|

variables#

| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | +|

widgets#

| `array` | [] | Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously. | +|

tabs#

| `array` | [] | Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously |
+ + + + +
+ + +
Widget container that display its children in a single column or row.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

strip#

|||| +|

scroll#

| `boolean` | true | Set to `false` to disable scrollbars | +|

horizontal#

| `boolean` | false | Set to `true` to display widgets horizontally | +|

stretch#

| `boolean` | false | Set to `true` to stretch widgets evenly | +|

border#

| `boolean` | true | By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too | +|

spacing#

| `integer`|
`percentage` | 0 | Adds space between widgets. Percents are always relative to the strips width | +|

children#

|||| +|

variables#

| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | +|

widgets#

| `array` | [] | Each element of the array must be a widget object
- By default, children widgets that don't have an explicit `width`/`height` set will be shrinked to respect the sizes specified by others
- Adding `flex:1;` to a children's `css` will give it the ability the fill the remaining space
- Multiple children can have a `flex:x;` css property (`x` will ponderate their expansion) |
+ + + + +
+ + +
A toggle button that opens a popup panel. Cannot contain tabs directly.
+ +| property | type |default | description | +| --- | --- | --- | --- | +| |||| +| | `boolean` | false | Set to `true` to make the modal require a double tap to open instead of a single tap | +| | `string` | "" | Alternative label for the modal popup | +| | `number`|
`percentage` | "80%" | Modal popup's size | +| | `number`|
`percentage` | "80%" | Modal popup's size | +| | `number`|
`percentage` | "auto" | Modal popup's position | +| | `number`|
`percentage` | "auto" | Modal popup's position | +| | `boolean` | true | Set to `false` to disable scrollbars | +| |||| +| | `integer` | "" | Defines the modal's state:`0` for closed, `1` for opened | +| |||| +| | `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | +| | `array` | [] | Each element of the array must be a widget object |
+ + + + +
+ + +
Widget replication with overridable properties.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

clone#

|||| +|

widgetId#

| `string` | "" | `id` of the widget to clone | +|

overrides#

|||| +|

props#

| `object` | \{} | Cloned widget's properties to override |
+ + + + +
+ + +
Main (unique) container
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

id#

| `string` | "root" | Widgets sharing the same id will act as clones and update each other's value(s) without sending extra osc messages | +|

value#

|||| +|

value#

| `integer` | "" | Defines currently opened tab in the widget

A tab can be opened only by setting its parent's value | +|

children#

|||| +|

traversing#

| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | +|

variables#

| `*` | \{} | Defines one or more arbitrary variables that can be inherited by children widgets | +|

tabs#

| `array` | [
 \{}
]
| Each element of the array must be a tab object |
+ + + + +
+ + +
Tabbed panel widget
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

tab#

|||| +|

detached#

| `boolean` | true | Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens | +|

value#

|||| +|

value#

| `integer` | "" | Defines currently opened tab in the widget

A tab can be opened only by setting its parent's value | +|

children#

|||| +|

variables#

| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | +|

widgets#

| `array` | [] | Each element of the array must be a widget object. A tab cannot contain widgets and tabs simultaneously | +|

tabs#

| `array` | [] | Each element of the array must be a tab object. A tab cannot contain widgets and tabs simultaneously |
+ + + +## Switchers + + +
+ + +
Save and recall the state of other widgets.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

state#

|||| +|

filter#

| `string`|
`array` | "" | Only save state from widgets contained in widgets designated by id. If empty, the whole session's state is saved. Switchers are always ignored.
- widget id `string`
- `array` of widget id strings | +|

saveLabel#

| `string` | "Save" | Label for save button | +|

loadLabel#

| `string` | "Load" | Label for load button | +|

horizontal#

| `boolean` | false | Set to `true` to display buttons horizontally | +|

value#

|||| +|

value#

| `object`|
`string` | "" | - `object`: `"widget_id": VALUE` pairs
- `string`: `"save"` (trigger save action), `"load"` (trigger load action) or `""` (reset value)



Note: the widget's actual value is never `"save"` or `"load"`, it's either an empty string or an object. |
+ + + + +
+ + +
Store other widgets' values and recall them.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

switcher#

|||| +|

linkedWidgets#

| `string`|
`array` | "" | - `String`: a widget's `id` whose state changes will be stored
- `Array`: a list of widget `id` string | +|

horizontal#

| `boolean` | false | Set to `true` to display values horizontally | +|

values#

| `array`|
`object` | \{
 "Value 1": 1,
 "Value 2": 2
}
| Each item represents a bank that stores the values from the widgets listed in `linkedWidgets`
- `Array` of possible values to switch between : `[1,2,3]`
- `Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept |
+ + + + +
+ + +
Switcher with linear interpolation slider.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

crossfader#

|||| +|

linkedWidgets#

| `string`|
`array` | "" | - `String`: a widget's `id` whose state changes will be stored
- `Array`: a list of widget `id` string | +|

horizontal#

| `boolean` | false | Set to `true` to display values horizontally |
+ + + +## Inputs + + +
+ + +
Text input.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

input#

|||| +|

vertical#

| `boolean` | false | Set to `true` to display the text vertically | +|

align#

| `string` | "" | Set to `left` or `right` to change text alignment (otherwise center) | +|

unit#

| `string` | "" | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) | +|

editable#

| `boolean` | true | Set to `false` to make the input non-editable | +|

asYouType#

| `boolean` | false | Set to `true` to make the input send its value at each keystroke |
+ + + + +
+ + +
Keyboard binding.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

keys#

|||| +|

binding#

| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation) | +|

keydown#

| `string` | "" | This property is evaluated each time the key combo is pressed and defines the widget's own value. Formulas are given extras variables in this context:
- `key`: pressed key name (usefull for handling multiple keys with a single keys widget, lowercased when referencing a character key)
- `code`: pressed key code name (full list)
- `ctrl`: control key state
- `alt`: alt key state
- `shift`: shift key state
- `meta`: command/windows key state | +|

keyup#

| `string` | "" | Same as `keydown`, but evaluated when releasing the key combo | +|

repeat#

| `boolean` | true | Set to `false` to prevent keydown repeats when holding the key combo pressed |
+ + + + +
+ + +
Evaluates a script each time it receives a value.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

script#

|||| +|

condition#

| `string` | 1 | When the widget receives a value, if this property return a falsy value, the script property won't be evaluated. If it's non-falsy, it will be evaluated normally. Formulas are given one extra variable in this context:
- `value`: the value received by the widget | +|

script#

| `string` | "" | This property is evaluated each time the widget receives a value* if condition is non-falsy. Formulas are given extras variables in this context:
- `value`: value received by the widget
- `id`: id of the widget that triggered the script
- `send(target, address, arg1, arg2, ...)`: function for sending osc messages (ignores the script's targets and the server's defaults unless `target` is `false`; ignores the script's `preArgs`)
- `set(id, value)`: function for setting a widget's value
- `get(id)`: function for getting a widget's value (dynamic equivalent of @{id})
- `getProp(id, property)`: function for getting a widget's property value ((dynamic equivalent of @{id.property})
- `httpGet(url, callback)`: function for making http requests (asynchronous "GET" request and local urls only)



* Note: `value` or `linkId` properties can be used to receive other widgets' values. The `value` property must actually change to trigger the execution, where linked widgets via `linkId` can submit the same value over and over and trigger the execution |
+ + + + +
+ + +
Device motion/orientation sensor.
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

gyroscope#

|||| +|

frequency#

| `number` | 30 | Value update frequency (updates per seconds) | +|

normalize#

| `boolean` | true | Normalize gravity related values | +|

compass#

| `boolean` | false | Set to `true` to return the orientation values with respect to the actual north direction of the world instead of the head direction of the device | +|

screenAdjusted#

| `boolean` | false | Set to `true` to return screen adjusted values | +|

value#

|||| +|

value#

| `object` | "" | The gyroscope's value is an object containing multiple values, which can be used by other widgets via the property maths syntax
- `value.do.alpha`: deviceorientation event alpha
- `value.do.beta`: deviceorientation event beta
- `value.do.gamma`: deviceorientation event gamma
- `value.do.absolute`: deviceorientation event absolute
- `value.dm.x`: devicemotion event acceleration x
- `value.dm.y`: devicemotion event acceleration y
- `value.dm.z`: devicemotion event acceleration z
- `value.dm.gx`: devicemotion event accelerationIncludingGravity x
- `value.dm.gy`: devicemotion event accelerationIncludingGravity y
- `value.dm.gz`: devicemotion event accelerationIncludingGravity z
- `value.dm.alpha`: devicemotion event rotationRate alpha
- `value.dm.beta`: devicemotion event rotationRate beta
- `value.dm.gamma`: devicemotion event rotationRate gamma |
+ + + + +
+ + +
File/Folder selector (server-side).
+ +| property | type |default | description | +| --- | --- | --- | --- | +|

input#

|||| +|

directory#

| `string` | "auto" | Default browsing directory | +|

extension#

| `string` | "*" | Only display files with this extension | +|

hidePath#

| `boolean` | false | Set to `true` to only display the filename (the whole path will still be used as value) | +|

allowDir#

| `boolean` | false | Allow selecting a folder (by pressing "open" when no file is selected) |
+ + + + + + diff --git a/resources/docs/docs/widgets/advanced-syntaxes.md b/resources/docs/docs/widgets/advanced-syntaxes.md deleted file mode 100644 index 8db8e3ab..00000000 --- a/resources/docs/docs/widgets/advanced-syntaxes.md +++ /dev/null @@ -1,124 +0,0 @@ -# Advanced syntaxes - -Advanced syntaxes are special blocks of code that can be written in the widgets properties to customize the widgets and how they behave. These blocks end up replaced with the value they hold before the widgets evaluate the properties they're in. - - -## Inheritance: `@{id.property}` - -The inheritance syntax returns either a widget's value or one of its properties. When using this syntax, value or property changes will be applied automatically. - -- `id`: target widget's `id`. A widget can fetch its own properties or its direct parent's by using the keywords `this` or `parent` instead of `id`. When `this` or `parent` can be used, using the target widget's `id` instead won't work. -- `property`: target widget's property name. If omitted (along with the dot), the widget's value will be returned (`@{widgetId}` is the same as `@{widgetId.value}`). `value` always resolves to the target widget's current value, not its `value` property. - - -!!! note "Unique identifier" - Each widget has a unique random identifier that can be retrieved with the property name `uuid` (e.g. `@{this.uuid}`, `@{parent.uuid}`). - -#### Dynamic properties - -Some properties, when changed, trigger a complete widget recreation that ends any ongoing user interaction. Also, updating these properties continuously (e.g. when linked to a slider's dynamic value) can be very cpu expensive. - -Some properties have much cheaper update routines and can be considered as `dynamic`, as in performance safe. These properties are marked in the documentation with a . - - -#### Circular references cases - -- container widgets can inherit their children's properties only to define `dynamic` properties -- widgets can inherit their own `value` property only to define `dynamic` properties - -#### Object properties - -If the retrieved property is an object (`{}`), a subset can be retrieved directly by appending a dot and a key (array index or object key) : `@{parent.variables.key}` - - -#### Nesting - -The inheritance syntax supports 1-level nesting for defining the target widget's id dynamically : `@{fader_@{toggle_1}}` - - -## OSC listeners: `OSC{address, default, usePreArgs}` - -The OSC listener syntax returns the value received on specified address (or the `default` value if none has been received yet). - -- `address`: osc address to listen to; if the leading slash (`/`) is omitted, the address will be prefixed with the widget's `address` property -- `default` (optional): default value returned before any message is received. Must be a primitive value, not an object or an array. -- `usePreArgs` (optional): by default, osc listeners inherit the widget's `preArgs` (these must be matched for the osc messages to be processed). Set to `false` bypass them. - -Options can contain `@{}` blocks. - -!!! note "Receiving MIDI" - Midi messages will be processed only if the receiver's widget includes the emitting MIDI device in its targets. - -??? example "Array/Object default value" - ```js - JS{ - return OSC{address} || { - "key a": 1, - "key b": 2 - } - } - ``` - -## Custom variables: `VAR{variableName, default}` - -This syntax creates a custom variable in the widget that can be read and modified from any widget's script property (see [scripting](./scripting.md#getvarid-name)). Changes made to this variable using `setVar()` in scripts will be applied automatically where `VAR{}` is used.` - -## File imports: `IMPORT{file_name}` - -This allows loading the content of an external file in a property. If used in a `JS{}` of `#{}` block, it will be seen as a string variable containing the raw content of the file. Changes made to the file be applied automatically. - -File paths are resolved in this order: - -- in the session's directory -- in theme's directory -- in the server's `remote-root` directory if the option is set -- as absolute paths - -!!! warning - [Fragments](../fragments/) and session files already loaded with fragment widgets should not be imported using this syntax. - -## Javascript: `JS{ }` - -This syntax allows defining a property using [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript). The code will be compiled as a function and executed in a restricted context. - -- if no `return` statement is found, the formula will return an empty string -- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled -- `setTimeout` and `setInterval` functions are not available - -A property *cannot* contain multiple `JS{}` blocks - -#### Available variables - -- `console`: javascript console -- `locals`: object for storing/reading arbitrary values. Changing its properties *does not* trigger any synchronisation even if the value is used somewhere else. -- `globals`: same as `locals` but shared between all widgets, contains a few useful variables: - - `screen`: client screen informations (`{width, height, orientation}`) - - `env`: client options (ie: url query options), - - `ip`: client's ip address, - - `url`: server url, - - `platform`: operating system as seen by the client - - `session`: session file path - - `clipboard`: instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) - -Parsing errors can be read in the console (++ctrl+k++). - -!!! warning - Modifying values in `locals` or `globals` **does not** trigger anything if they are used somewhere else. - -#### Using in advanced syntaxes - -In this context, `@{}`, `VAR{}` and `OSC{}` syntaxes are seen as variables. When they change, the whole block will be evaluated again. - -!!! danger "Do not mutate" - When these syntaxes return objects or arrays, mutating said objects will affect the underlying variables in memory and may lead to unexpected behavior. - - The `@{}` syntax, when used for anything else than the widget's value, will always return a copy of the property and is not affected by this. - -## Javascript: `#{ }` - -This is a shorthand for the `JS{}` syntax, the only difference being that `` is automatically prepended with a `return` statement. - -A property *can* contain multiple `#{}` blocks. - -!!! note "Compilation order" - `#{}` blocks are compiled after `JS{}` blocks diff --git a/resources/docs/docs/widgets/canvas.md b/resources/docs/docs/widgets/canvas.md deleted file mode 100644 index dffea008..00000000 --- a/resources/docs/docs/widgets/canvas.md +++ /dev/null @@ -1,195 +0,0 @@ -# Canvas widget - -The canvas widget allows creating custom widgets with user-defined drawings and touch reactions. - -It has dedicated scripting properties (`onTouch`, `onDraw` and `onResize`) that work like the `onValue` property : they are used to defined scripts that will be executed when specific events occurs. - -This widget requires a good understanding of the javascript [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and of the javascript programming language in general. - -## Canvas properties - -### `valueLength` - -This property must be set to the number of values held by the widget : 1 for a simple slider, 2 for an XY pad, etc. Attempts to set the widget's value with a different number of values will be ignored. - -```js -set("this", 1) // works if valueLength == 1 -set("this", [1, 2]) // works if valueLength == 2 -``` - -### `autoClear` - -This is a convenience option that clears the canvas context and calls [`beginPath`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/beginPath) before each drawing. When this property is set to `false`, the canvas must be cleared manually. - -### `continuous` - -If this property is enabled, the widget will be redrawn at a fixed rate even if not interacted with (see [`onDraw`](#onDraw)). - - -### `onTouch` - -This script is executed when the widget is touched, when it is released, and during the movement of the pointer while the widget is touched. - -This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - -- `value`: widget value -- `width`: canvas width in pixels -- `height`: canvas height in pixels -- `event`: object containing the following: - - `type`: `"start"`, `"move"` or `"stop"` - - `target`: id of the widget under the pointer, `"this"` if it's the canvas widget itself, `null` if no widget is under the pointer - - `targetName`: name attribute of the html element under the pointer - - `targetTagName`: tag name of the html element under the pointer - - `offsetX`, `offsetY`: touch coordinates in pixels, relative to the html element under the pointer - - `movementX`, `movementY`: movement of the pointer in pixels since the last event - - `pageX`, `pageY`: touch coordinates in pixels, relative to the page - - `pointerId`: unique identifier used to differentiate fingers in multitouch situation - - `altKey`, `ctrlKey`, `shiftKey`: keyboard modifier states - - `force`: amount of pressure applied to the touch surface between `0` and `1` (see [Touch.force](https://developer.mozilla.org/en-US/docs/Web/API/Touch/force)). Equals `0` if the API is not supported or if no pressure information is found. - - `radiusX`, `radiusY`, `rotationAngle`: see [Touch.rotationAngle](https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle) - - (iOS only) `altitudeAngle`, `azimuthAngle`: see [Touch.altitudeAngle](https://w3c.github.io/touch-events/#dom-touch-altitudeangle) - - (iOS only) `touchType`: "direct" or "stylus" - - -!!! note "Extra html elements" - Elements added using the `html` property can be touched as well, `event.targetName` can be used to determine which element is touched. - - -### `onDraw` - -This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value. - -This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - -- `value`: widget value -- `width`: canvas width in pixels -- `height`: canvas height in pixels -- `ctx`: [canvas rendering context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) of the widget -- `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc - -In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. - -### `onResize` - -This script is executed when the widget has resized, before it is redrawn. - -This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - -- `value`: widget value -- `width`: canvas width in pixels -- `height`: canvas height in pixels -- `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc - -## Example: XY pad - -Let's create a simple xy pad, with a value made of two numbers between 0 and 1. We set `valueLength` to `2` to make sure the widget only accepts incoming messages with two values (x and y). - -First, we use the `onTouch` property to store the touch coordinates in the `locals` object. We also call `set()` to store these in the widget's value (this way, the widget can send messages and sync with other widgets). - -```js -// onTouch - -// store normalized coordinates -if (event.type == "start") { - locals.x = event.offsetX / width - locals.y = event.offsetY / height -} else { - // when the pointer is moving, increment coordinates - // because offsetX and offsetY may not be relevant - // if the pointer hovers a different widgets - locals.x += event.movementX / width - locals.y += event.movementY / height -} - -// update widget value and send -set("this", [locals.x, locals.y]) -``` - -Then, we use the `onDraw` property to draw a circle at the touch coordinates. - -```js -// onDraw - -// draw circle at touch coordinates -ctx.arc(value[0] * width, value[1] * height, 6, 0, Math.PI * 2) -// use colorFill property as stroke color -ctx.strokeStyle = cssVars.colorFill -// draw stroke -ctx.stroke() -``` - -Finally, we use the `onValue` property to apply limits to the values. - -```js -// onValue - -// apply limits -var x = Math.max(0, Math.min(1, value[0])), - y = Math.max(0, Math.min(1, value[1])) - -// re-update widget value without retriggering script or sending message -set("this", [x, y], {sync: false, send: false}) - -// the widget will automatically send its value if -// this script was triggered by a user interaction -// no need to call send() here but we could, for example -// if we want to split the value in to multiple messages -``` - -## Example: multi slider - -Let's build a row of 20-sliders with a single widget. We first set `valueLength` to... 20 ! - -```js -// onTouch - -// store normalized coordinates -if (event.type == "start") { - locals.x = event.offsetX / width - locals.y = event.offsetY / height -} else { - // when the pointer is moving, increment coordinates - // because offsetX and offsetY may not be relevant - // if the pointer hovers a different widgets - locals.x += event.movementX / width - locals.y += event.movementY / height -} - - -// which slider are we touching ? -var n = parseInt(locals.x * value.length) -n = Math.max(0, Math.min(n, value.length-1)) - -// update value at slider's index -// 1 - locals.y because y axis is from top to bottom in js canvas -value[n] = 1 - locals.y - -// update widget value and send -set("this", value) -``` - -```js -// onDraw - -ctx.fillStyle = cssVars.colorFill -ctx.globalAlpha = cssVars.alphaFillOn - -var sliderWidth = width / value.length - 1 -for (var i in value){ - ctx.beginPath() - ctx.rect(i * width / value.length, height, sliderWidth, - value[i] * height) - ctx.fill() -} -``` - -```js -// onValue - -// apply limits -for (var i in value) { - value[i] = Math.max(0, Math.min(1, value[i])) -} - -// re-update widget value without retriggering script or sending message -set("this", value, {sync: false, send: false}) -``` diff --git a/resources/docs/docs/widgets/fragments.md b/resources/docs/docs/widgets/fragments.md deleted file mode 100644 index 69e3b473..00000000 --- a/resources/docs/docs/widgets/fragments.md +++ /dev/null @@ -1,15 +0,0 @@ -# Fragments - -Fragments allow breaking sessions into multiple files and reusable components made of multiple widgets. - -## Fragment files - - -When right-clicking on a widget in the editor mode, it is possible to export it as a fragment file. - -Fragment files have the same extension as session files (`.json`) and can be opened like regular sessions. When doing so, keep in mind that only the first child of the root widget will be saved. It is possible to save a fragment file as a session file (and vice versa) by toggling the `Fragment mode` in the main menu. - - -## Fragment widgets - -Fragment widgets work like clone widget except their source widget are loaded from fragment files or session files. When the sources files are modified, the fragment widgets are updated automatically. diff --git a/resources/docs/docs/widgets/general-mechanics.md b/resources/docs/docs/widgets/general-mechanics.md deleted file mode 100644 index 631bdd0b..00000000 --- a/resources/docs/docs/widgets/general-mechanics.md +++ /dev/null @@ -1,62 +0,0 @@ -## Interaction - -These are interaction events widgets are likely to respond to: - -| Mouse | Touch | Description | -|---|---|---| -| Mousedown | Tap | Handled at pressing time, not releasing. | -| Click | Click | Handled at release time. | -| Double Click | Double Tap | Some widgets handle double click / double tap events. | -| Drag | Drag | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. | - - -Widgets sensibility can be tuned with the `sensibility` property. Single-touch widgets (i.e. all widgets except `mutlixy` and `range`) also accept an alternate interaction event for fine control. - -| Mouse | Touch | Description | -|---|---|---| -| `Ctrl` + Drag | / | Holding the `Ctrl` key while dragging with the mouse increases the gesture's precision by 10.| -| / | Two-fingers drag | Using two fingers on a single-touch target increases the gesture's precision by 10. | - - -## Sending messages - -When interacted with, widgets with at least one target (including the server's defaults) send osc messages of the following form: - -``` -/address ...preArgs ...value -``` - -If they have MIDI targets, the server will try to convert the osc messages into a MIDI messages (see [MIDI messages](../midi/midi-messages.md)). - - -## Receiving messages - -When an osc message is received, it updates every widgets that meets the following conditions - -- same `address` -- same `preArgs` (no distinction between integers and round floats ) - -The remaining arguments after `preArgs` are passed to the widget. - - -When a MIDI message is received, it's converted into an osc message (see [MIDI messages](../midi/midi-messages.md)) and follows the same rules, except that only the widgets that include the emitting MIDI device in their targets will be able to receive it. - - -## Widget synchronization - -Within a single client's scope, there are multiple ways to synchronize widgets: - -- If they share the same `id`: in this case, the synchronized widget doesn't send any osc/midi message. This case is mostly used for widget cloning. -- If they share a `linkId`: in this case, the synchronized widget sends its osc/midi message normally. -- If their `value` properties depend on each other using the [advanced syntaxes](./advanced-syntaxes.md) -- Using [scripting](./scripting.md) - -## Client synchronization - -From a client to another, widgets are automatically synchronized if they share the following properties: - -- `address` -- `preArgs` -- `targets` - -Client synchronization can be disabled globally with the `clientSync` [client option](../client-options.md). Widgets with `bypass` set to `true` will not send synchronization messages to other clients. diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md deleted file mode 100644 index c02e975c..00000000 --- a/resources/docs/docs/widgets/scripting.md +++ /dev/null @@ -1,437 +0,0 @@ -# Scripting - -Widgets can run [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) scripts upon specific events. These scripts are written in special properties under the scripting category. - -!!! warning "Advanced syntaxes" - Most [advanced syntaxes](../advanced-syntaxes/) should be avoided as much as possible in scripting properties: - - - `@{}`: use `get()` and `getProp()` instead - - `OSC{}`: use `get()` instead (using another widget as receiver) - - `VAR{}`: use `getVar()`instead - - `JS{}` and `#{}` are useless (scripting properties are already interpreted as javascript code) unless you want to generate code procedurally - - The editor will always fail to recognize these syntaxes as they don't comply with the javacript language specification, even if the resulting code is valid. - -## Events - -### `onCreate` - -This script is called when the widget is created. If the widget has children, it will be executed after the children are created. - -!!! warning "Modifying parent container" - Modifying a non-dynamic property on a parent container from this script **will not work**. - -The following variables are available in this context: - -- `value`: widget's value - -### `onValue` - -This script is called when the widget's value updates and when it receives a value. - -The following variables are available in this context: - -- `id` (`string`): id of the widget that's responsible for the value update -- `value`: widget's value -- `touch`: see [Touch state](#touch-state) - -??? infos "Keyboard & Matrix" - In keyboards and matrices, `id` is the id of the child widget that triggered the event, and `value` is an array containing the children's values. - The touched widget's value can be retrieved with: - ```javascript - value[getIndex(id)] - ``` - -??? infos "Touch state (deprecated)" - - *This feature is deprecated, use `onTouch` instead* - - When some widgets are touched or released, a special value event can be caught to trigger custom actions. - - If the variable `touch` is not `undefined`, this means it holds the widget's current touch state: - - - `0/1` for the widget's touch state (`fader`, `knob` and `xy`, `range` and `multixy`) - - `[i, 0/1]` if the widget is multi touch (`range` and `multixy`). In this case `i` is the touched handle's index, starting with `0`. - - ```js - if (touch !== undefined) { - // send multi touch state - if (touch.length) send('/touch_address', touch[0], touch[1]) - // send global touch state - else send('/touch_address', touch) - } else { - // do something with the value ? - } - ``` - - To avoid unwanted script executions, touch state events will only be caught if the script contains the word `touch` and if `onTouch` is empty. - - -### `onTouch` - -This script is executed when the widget is touched, and when it is released. - -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: - -- `value`: widget value -- `event`: object containing the following: - - `type`: `"start"` or `"stop"` - - `handle`: `undefined` if the event concerns the widget, `integer` if it concerns one of it's handles (`multixy` and `range` widgets only) - -[Canvas](../canvas/) and containers expose more informations in their `onTouch` script. - -??? infos "Containers onTouch" - - Containers (root, panel, etc) can monitor touch events happening inside them, it works like with [Canvas](../canvas/#ontouch), with a few differences: - - - `event.firstTarget` will return the id of the first touched widget - - setting `event.preventDefault` to `true` will prevent the event from reaching widgets in the container ('start' and 'move' events only) - - setting `event.allowScroll` to `true` will allow touch scrolling where it would normally be prevented ('start' event only) - - setting `event.inertia` will affect 'move' events (works like widget `sensitivity` in reverse (1 = normal, 10 = slow move)) - - `width` and `height` are undefined - - Containers with `traversing` enabled change how touch events are emitted: - - - a new 'stop' event is emitted whenever the pointer exits a touchable widget while pressed. - - a new 'start' event is emitted whenever the pointer enters a touchable widget while pressed. - - -### `onDraw` - -See [canvas](../canvas/). - -### `onKeyboard` - -*Script widget only* - -This script is executed when the key(s) defined in the widget's `keyBinding` property are pressed. - - -The following variables are available in this context: - - -- `type` (`string`): `keydown` or `keyup` -- `key` (`string`): key name, -- `code` (`number`): key code -- `ctrl` (`boolean)`: `true` if ctrl key is pressed -- `shift` (`boolean`): `true` if shift key is pressed -- `alt` (`boolean`): `true` if alt key is pressed -- `meta` (`boolean`): `true` if meta key is pressed - - -### `onPreload` - -This script is specific to the root widget, it's called before any other widget is created and can be used to create global variables / functions accessible in other scripts. - -In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. - -## Available variables - -The following variables and functions are accessible in this context. - - -- `console`: javascript console -- `locals`: object for storing/reading arbitrary values. Changing its properties *does not* trigger any synchronisation even if the value is used somewhere else. -- `globals`: same as `locals` but shared between all widgets, contains a few useful variables: - - `screen`: client screen informations (`{width, height, orientation}`) - - `env`: client options (ie: url query options), - - `ip`: client's ip address, - - `url`: server url, - - `platform`: operating system as seen by the client - - `session`: session file path - - `clipboard`: instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) -- `Image`: javascript's [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) constructor - - -!!! note "this" - Unlike in most javascript contexts, the special keyword `this` doesn't point to an object but instead returns the string `"this"`. - - ----- - -#### `get(id)` -- `id`: widget `id` as a string. - -Returns the value of the first matching widget. If the returned value is an object, a copy is returned to allow safe mutation. - ----- - -#### `set(id, value, options)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` may contains wildcards ('\*'). -- `value`: new value for the widget. -- `options` (optional): `object`, accepts the following items: - - `sync: false`: prevents widgets from triggering synchronization and scripts - - `script: false`: prevents scripts but not synchronization - - `send: false`: prevents widgets from sending osc messages - - `external: true`: simulates a value coming from an osc/midi message (implies `send: false` automatically) - -Sets the value of the first matching widget. If `ìd` contains wildcards, affects all matching widgets **except** the emitting widget. - -If the event that triggered the script's execution was initiated by a user interaction, this will make the widget send its value as well (unless `options` is set to `{send: false}`). - ----- - -#### `getVar(id, name)` -- `id`: widget `id` as a string. -- `name`: variable name as a string. - -Returns the value of a widget's custom variable. If the returned value is an object, a copy is returned to allow safe mutation. - ----- - -#### `setVar(id, name, value)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` may contains wildcards ('\*'). -- `name`: variable name as a string. -- `value`: new value for the variable. - -Sets the value of a widget's custom variable (see [advanced syntaxes](./advanced-syntaxes.md##ustom-variables-varvariablename-default)). If `ìd` contains wildcards, affects all matching widgets. - - ----- - -#### `send(target, address, ...args)` -- `target` (optional): `"ip:port"` or `"midi:device_name"` string. If omitted, the widget's target (or the server's defaults) will be used. -- `address`: osc address, must start with a `/` -- `args`: values or `{type: "OSC_TYPE_LETTER", value: VALUE}` objects - -Sends an osc message. - -If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect. - -This function ignores the widget's `bypass` and `ignoreDefaults` properties. - -??? infos "Examples" - ```javascript - send('127.0.0.1:4444', '/address', 1) - send('127.0.0.1:4444', '/address', 1, 2) - send('/address', 1) // uses the widget's target - send('/address', {type: 'i', value: 1}) // sends 1 as an integer - ``` - - ----- - -#### `getProp(id, name)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. -- `name`: property name. - -Returns the property called `"name"` of the first matching widget. If the returned value is an object, a copy is returned to allow safe mutation. - ----- - -#### `getIndex(id)` -- `id` (optional): widget `id` as a string. Defaults to `"this"`. - -Returns the widget's index in its container. - ----- - -#### `updateProp(id, name)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. -- `name`: property name. - -Forces a widget to check if one of its properties has changed and update itself if needed. - ----- - -#### `updateCanvas(id)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget. - -Forces a canvas widget redraw. - ----- - -#### `httpGet(url, callback)` - -- `url`: url of the resource to fetch (local url only) -- `callback`: function executed when/if the http request succeeds, with the response text as argument - ----- - -#### `stateGet(id)` -- `id`: widget `id` as a string, or array of `id` strings. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. - -Returns a state object (`id:value`) for matching widget and all their children. - ----- - -#### `stateSet(state, options)` - -Loads a state object. If the event that triggered the script's execution was initiated by a user interaction, this will make the updated widgets send their value as well. - -- `options` (optional): `object`, accepts the following items: - - `send: false`: prevents widgets from sending osc messages - ----- - -#### `storage` - -Global [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) instance, allows storing data that persists upon refresh/relaunch. - ----- - -#### `setTimeout(id, callback, delay)` / `setInterval(id, callback, delay)` - -These work like almost their native equivalent, with an extra (optional) `id` argument. - -- `id` (optional): unique identifier, if omitted, defaults to `undefined`. If a timeout with the same id is already running, it is cleared before the new one is created (even if `undefined`). `id`s are scoped to the widget's context: two timeouts with the same `id` in two different widgets can run concurrently -- `callback`: function to be executed -- `delay`: delay before execution is ms - -Reference: - -- https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout -- https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval - - -Usage note: - -If no concurrent timeout / interval is needed, calling `setTimeout`, `setInterval`, `clearTimeout` and `clearInterval` with no `ìd` argument will do. - ------ - -#### `clearTimeout(id)` / `clearInterval(id)` - -Clears timeout with matching `id`. - -Reference: - -- https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearTimeout -- https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval - ----- - -#### `setFocus(id)` - -- `id` (optional): widget `id` as a string - -Gives focus to a widget (ie input widget). If `id` is omitted or falsy, currently focused element will be unfocused. - -*Built-in client only*: tells the operating system to give the focus to the client window - ----- - -#### `unfocus()` - -*Built-in client only*: tells the operating system to give the focus to the window that was focused before. - ----- - -#### `setFocusable(focusable)` - -- `focusable`: `0` or `1` - -*Built-in client only*: define whether the client window can be focused or not. Text inputs cannot be interacted with when the window is not focusable. - ----- - -#### `getScroll(id)` -- `id`: widget `id` as a string. - -Returns the scroll position of a container as a `[x, y]` array. - ----- - -#### `setScroll(id, x, y)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. -- `x`: horizontal scroll, `undefined` to use current value -- `y`: vertical scroll, `undefined` to use current value - -Sets the scroll state of a container. - ----- - -#### `scrollIntoView(id, option)` -- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. -- `option`: `alignToTop` or `options` argument as defined in https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView - -Scroll containers to make widget(s) visible. - - ----- - -#### `toolbar(id)` -- `id` menu entry id (string) - -Triggers toobar action if currently available (ie accessible from the menu). `id` can be one of the following: - -- `session-new`,`session-open`, `session-save`, `session-save-as`, `session-fragment`, `session-backup`, `session-import`, `session-export` -- `state-store`, `state-recall`, `state-send`, `state-open`, `state-save`, `state-save-as`, `state-import`, `state-export` -- `editor-enabled`, `editor-grid`, `editor-tree`, `editor-inspector`, `editor-percents` -- `console-enabled`, `console-clear` -- `fullscreen`, `notifictions`, `prevent-sleep`, `virtual-keyboard` - -Some actions will only be triggered if initiated with a physical user interaction, check the console for errors if it doesn't work as expected. - - -=== "Legacy syntax: `toolbar(i1, i2, ...)`" - - - `iX`: menu entry index - - Triggers toolbar action at specified index. - - !!! example "Examples" - - - `toolbar(0, 0)` -> Open a new session - - `toolbar(4)` -> Toggle full screen - - ----- - -#### `getToolbar(id)` -- `id` menu entry id (string) - -Returns `true` if the toolbar entry exists and is currently activated. - -#### `openUrl(url)` -- `url`: http(s) url - -*Built-in client only*: opens url with the system's default browser -*External client only*: opens url in a new tab - -If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect. - ----- - -#### `runAs(id, callback)` -- `id`: widget `id` as a string. -- `callback`: function to be executed - -Run `callback` function as if executed by another that widget matches specified id. This will not change the value of any local variable but `"this"` and `"parent"` arguments (accepted by functions such as `set()`) will be interpreted differently. Timeouts and intervals will be created and cleared in the target widget's scope. - ----- - -#### `reload(keepState)` -- `keepState` (optional): `true` by default, set to false to discard the client's state. - -Reload the client application. Cannot be called from the `onCreate` property. - -If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect. - - ----- - -#### `getNavigator()` - -Returns the instance of [Navigator](https://developer.mozilla.org/en-US/docs/Web/API/Navigator). - ----- - -#### `browseFile(options, callback)` - -Opens the server file browser and pass selected file to a callback function (does not create nor read files by itself). - -- `options`: object with the following keys: - - `extension`: allowed extension (default: "*") - - `directory`: starting directory for browser (default: user's home) - - `allowDir`: allow choosing a directory instead of a file (default: false) - - `mode`: "save" or "open" -- `callback`: function called with 1 argument (file path) - -#### `uploadFile(options, callback)` - -Opens the client file upload prompt and pass the raw content of selected file to a callback function. - -- `options`: object with the following keys: - - `types`: equivalent of HTML attribute [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept) -- `callback`: function called with 1 argument (file content) diff --git a/resources/docs/download.md b/resources/docs/download.md deleted file mode 100644 index d5089028..00000000 --- a/resources/docs/download.md +++ /dev/null @@ -1,65 +0,0 @@ -# Download the latest release - -!!! tip "" - [*Click here*](/docs/getting-started/introduction/#installation) to read the installation guide. - - - Open Stage Control v{{config.latest_release}} - - - - - - - - diff --git a/resources/docs/extra/scripts.js b/resources/docs/extra/scripts.js deleted file mode 100644 index f75c16a1..00000000 --- a/resources/docs/extra/scripts.js +++ /dev/null @@ -1,27 +0,0 @@ -document.addEventListener('DOMContentLoaded', ()=>{ - - if (window.location.hash && window.location.href.includes('properties-reference')) { - // show target in tabs/details - document.querySelectorAll('[id='+window.location.hash.split("#")[1]+']').forEach(function(item){ - var tab = item.closest('.tabbed-block'), - container= item.closest('.tabbed-set'), - details = item.closest('details'), - index = 0 - while (tab.previousElementSibling) { - index++ - tab = tab.previousElementSibling - } - console.log(index) - container.querySelectorAll('.tabbed-labels label:nth-child('+(index+1)+')').forEach(function(item,i){ - item.click() - }) - - if (item) { - item.scrollIntoView() - document.documentElement.scrollTop -= 70 - } - }) - } - - -}) diff --git a/resources/docs/extra/styles.css b/resources/docs/extra/styles.css deleted file mode 100644 index 83093318..00000000 --- a/resources/docs/extra/styles.css +++ /dev/null @@ -1,123 +0,0 @@ -:root { - --osc-background-color: rgb(21,26,36); - --osc-accent-color: #448aff; -} - -html { - overflow-y: scroll; -} - -.md-header, .md-nav__title[for=__drawer] { - background-color: var(--osc-background-color)!important; -} - -@media screen and (min-width:1220px) { - .md-nav__title[for=__drawer] { - background-color: transparent!important; - } -} - -.md-header-nav__title { - padding-top: 1px; - padding-left: 0!important -} - -.md-source__facts { - display: none; -} - -td:first-child { - white-space: pre!important; - vertical-align: top; -} - - -.force-full-table + .md-typeset__scrollwrap .md-typeset__table { - width:100%; -} -.force-full-table + .md-typeset__scrollwrap .md-typeset__table table { - display: table!important; - width:100%; -} - - -.accordion { - margin: 1.5625em 0; - padding: .6rem; - overflow: hidden; - font-size: .64rem; - page-break-inside: avoid; - border-left: .2rem solid var(--osc-accent-color); - border-radius: .1rem; - box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,.05), 0 0 0.05rem rgba(0,0,0,.1); -} -.accordion h6 { - cursor: pointer; - margin-top: 0; -} - -.accordion > :last-child { - display: none; -} -.accordion .md-typeset__table { - margin-bottom: 0; -} -.accordion.show > :last-child { - display: block; - margin-bottom: 0; -} -.accordionlink > .headerlink { - opacity: 1!important; - visibility: visible!important; - text-decoration: none; - color: inherit!important; - display: block; - outline: none; - box-shadow: none; - margin-left: 0; -} -.accordion-description { - opacity: 0.8; -} -.accordion.show .accordion-description { - margin-bottom: 8px; -} - -table .thead2 { - background: rgba(0, 0, 0, 0.05); - white-space: nowrap; -} -table .thead2 h6 { - color: #888; -} - -details.api h4 { - padding: 0; - margin: 0; -} -details.api summary { - padding-left: 0.6rem; -} -details.api summary:before { - display: none!important; -} - -details summary div { - display: inline-block; -} - -i[title="dynamic"] { - color: var(--osc-accent-color); -} - - -.patreon-icon { - margin-top: 2em!important; - color: black!important; - display: block; - background-image: url('data:image/svg+xml;charset=UTF-8,'); - background-size: 20px 30px; - background-repeat: no-repeat; - background-position: 20px center; - padding-left: 3em!important; -} diff --git a/resources/docs/fonts b/resources/docs/fonts deleted file mode 120000 index 35bed8b8..00000000 --- a/resources/docs/fonts +++ /dev/null @@ -1 +0,0 @@ -../fonts \ No newline at end of file diff --git a/resources/docs/img/ardour-osc.png b/resources/docs/img/ardour-osc.png new file mode 120000 index 00000000..8666affc --- /dev/null +++ b/resources/docs/img/ardour-osc.png @@ -0,0 +1 @@ +../../images/ardour-osc.png \ No newline at end of file diff --git a/resources/docs/img/icon-bolt.svg b/resources/docs/img/icon-bolt.svg new file mode 120000 index 00000000..c275e354 --- /dev/null +++ b/resources/docs/img/icon-bolt.svg @@ -0,0 +1 @@ +../../images/icons-bolt.svg \ No newline at end of file diff --git a/resources/docs/img/inspect.png b/resources/docs/img/inspect.png deleted file mode 100644 index bad738b1..00000000 Binary files a/resources/docs/img/inspect.png and /dev/null differ diff --git a/resources/docs/img/logo-nobadge.png b/resources/docs/img/logo-nobadge.png new file mode 120000 index 00000000..88c35c42 --- /dev/null +++ b/resources/docs/img/logo-nobadge.png @@ -0,0 +1 @@ +../../images/logo-nobadge.png \ No newline at end of file diff --git a/resources/docs/img/logo-nobadge.svg b/resources/docs/img/logo-nobadge.svg new file mode 120000 index 00000000..71ddf3d3 --- /dev/null +++ b/resources/docs/img/logo-nobadge.svg @@ -0,0 +1 @@ +../../images/logo-nobadge.svg \ No newline at end of file diff --git a/resources/docs/img/logo.png b/resources/docs/img/logo.png deleted file mode 120000 index e018c559..00000000 --- a/resources/docs/img/logo.png +++ /dev/null @@ -1 +0,0 @@ -../../images/logo.png \ No newline at end of file diff --git a/resources/docs/img/logo_discourse.png b/resources/docs/img/logo_discourse.png new file mode 120000 index 00000000..fe0933c4 --- /dev/null +++ b/resources/docs/img/logo_discourse.png @@ -0,0 +1 @@ +../../images/logo_discourse.png \ No newline at end of file diff --git a/resources/docs/img/logo_nobadge.png b/resources/docs/img/logo_nobadge.png deleted file mode 120000 index 8bdc8145..00000000 --- a/resources/docs/img/logo_nobadge.png +++ /dev/null @@ -1 +0,0 @@ -../../images/logo_nobadge.png \ No newline at end of file diff --git a/resources/docs/img/screenshots/client.png b/resources/docs/img/screenshots/client.png deleted file mode 100644 index 163d574e..00000000 Binary files a/resources/docs/img/screenshots/client.png and /dev/null differ diff --git a/resources/docs/img/screenshots/editor.png b/resources/docs/img/screenshots/editor.png deleted file mode 100644 index 7865ff54..00000000 Binary files a/resources/docs/img/screenshots/editor.png and /dev/null differ diff --git a/resources/docs/img/screenshots/launcher.png b/resources/docs/img/screenshots/launcher.png deleted file mode 100644 index 683f2b1d..00000000 Binary files a/resources/docs/img/screenshots/launcher.png and /dev/null differ diff --git a/resources/docs/img/screenshots/modal.png b/resources/docs/img/screenshots/modal.png deleted file mode 100644 index 21dfec52..00000000 Binary files a/resources/docs/img/screenshots/modal.png and /dev/null differ diff --git a/resources/docs/index.md b/resources/docs/index.md index fd34dcd4..e69de29b 100644 --- a/resources/docs/index.md +++ b/resources/docs/index.md @@ -1,10 +0,0 @@ ---- -template: home.html -title: Open Stage Control ---- - - diff --git a/resources/fonts/Roboto-Bold.woff2 b/resources/fonts/Roboto-Bold.woff2 deleted file mode 100644 index 76817cc7..00000000 Binary files a/resources/fonts/Roboto-Bold.woff2 and /dev/null differ diff --git a/resources/fonts/Roboto-Light.woff2 b/resources/fonts/Roboto-Light.woff2 deleted file mode 100644 index ddbf4a92..00000000 Binary files a/resources/fonts/Roboto-Light.woff2 and /dev/null differ diff --git a/resources/fonts/Roboto-Medium.woff2 b/resources/fonts/Roboto-Medium.woff2 deleted file mode 100644 index 6a88805f..00000000 Binary files a/resources/fonts/Roboto-Medium.woff2 and /dev/null differ diff --git a/resources/fonts/Roboto-Regular.woff2 b/resources/fonts/Roboto-Regular.woff2 deleted file mode 100644 index 9a0064ec..00000000 Binary files a/resources/fonts/Roboto-Regular.woff2 and /dev/null differ diff --git a/resources/fonts/fa-solid-900.woff2 b/resources/fonts/fa-solid-900.woff2 deleted file mode 100644 index c7bd59c2..00000000 Binary files a/resources/fonts/fa-solid-900.woff2 and /dev/null differ diff --git a/resources/fonts/fa-solid.css b/resources/fonts/fa-solid.css deleted file mode 100644 index ff9ec65e..00000000 --- a/resources/fonts/fa-solid.css +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) - * Copyright 2022 Fonticons, Inc. - */ -:root, :host { - --fa-font-solid: normal 900 1em/1 "FontAwesome"; } - -@font-face { - font-family: 'FontAwesome'; - font-style: normal; - font-weight: 900; - font-display: block; - src: url("./fa-solid-900.woff2") format("woff2"); } - -.fa, -.fas, -.fa-solid { - font-family: 'FontAwesome'; - font-weight: 900; } diff --git a/resources/fonts/fontawesome.min.css b/resources/fonts/fontawesome.min.css deleted file mode 100644 index 8b21c3d2..00000000 --- a/resources/fonts/fontawesome.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) - * Copyright 2022 Fonticons, Inc. - */ -.fa{font-family:var(--fa-style-family,"Font Awesome 6 Free");font-weight:var(--fa-style,900)}.fa,.fa-brands,.fa-duotone,.fa-light,.fa-regular,.fa-solid,.fa-thin,.fab,.fad,.fal,.far,.fas,.fat{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:var(--fa-display,inline-block);font-style:normal;font-variant:normal;line-height:1;text-rendering:auto}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-2xs{font-size:.625em;line-height:.1em;vertical-align:.225em}.fa-xs{font-size:.75em;line-height:.08333em;vertical-align:.125em}.fa-sm{font-size:.875em;line-height:.07143em;vertical-align:.05357em}.fa-lg{font-size:1.25em;line-height:.05em;vertical-align:-.075em}.fa-xl{font-size:1.5em;line-height:.04167em;vertical-align:-.125em}.fa-2xl{font-size:2em;line-height:.03125em;vertical-align:-.1875em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:var(--fa-li-margin,2.5em);padding-left:0}.fa-ul>li{position:relative}.fa-li{left:calc(var(--fa-li-width, 2em)*-1);position:absolute;text-align:center;width:var(--fa-li-width,2em);line-height:inherit}.fa-border{border-radius:var(--fa-border-radius,.1em);border:var(--fa-border-width,.08em) var(--fa-border-style,solid) var(--fa-border-color,#eee);padding:var(--fa-border-padding,.2em .25em .15em)}.fa-pull-left{float:left;margin-right:var(--fa-pull-margin,.3em)}.fa-pull-right{float:right;margin-left:var(--fa-pull-margin,.3em)}.fa-beat{-webkit-animation-name:fa-beat;animation-name:fa-beat;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-bounce{-webkit-animation-name:fa-bounce;animation-name:fa-bounce;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1))}.fa-fade{-webkit-animation-name:fa-fade;animation-name:fa-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-beat-fade,.fa-fade{-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s)}.fa-beat-fade{-webkit-animation-name:fa-beat-fade;animation-name:fa-beat-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-flip{-webkit-animation-name:fa-flip;animation-name:fa-flip;-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-shake{-webkit-animation-name:fa-shake;animation-name:fa-shake;-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,linear);animation-timing-function:var(--fa-animation-timing,linear)}.fa-shake,.fa-spin{-webkit-animation-delay:var(--fa-animation-delay,0);animation-delay:var(--fa-animation-delay,0);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal)}.fa-spin{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-duration:var(--fa-animation-duration,2s);animation-duration:var(--fa-animation-duration,2s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,linear);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin-reverse{--fa-animation-direction:reverse}.fa-pulse,.fa-spin-pulse{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,steps(8));animation-timing-function:var(--fa-animation-timing,steps(8))}@media (prefers-reduced-motion:reduce){.fa-beat,.fa-beat-fade,.fa-bounce,.fa-fade,.fa-flip,.fa-pulse,.fa-shake,.fa-spin,.fa-spin-pulse{-webkit-animation-delay:-1ms;animation-delay:-1ms;-webkit-animation-duration:1ms;animation-duration:1ms;-webkit-animation-iteration-count:1;animation-iteration-count:1;transition-delay:0s;transition-duration:0s}}@-webkit-keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@-webkit-keyframes fa-bounce{0%{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}10%{-webkit-transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0);transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0)}30%{-webkit-transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em));transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em))}50%{-webkit-transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0);transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0)}57%{-webkit-transform:scale(1) translateY(var(--fa-bounce-rebound,-.125em));transform:scale(1) translateY(var(--fa-bounce-rebound,-.125em))}64%{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}to{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}}@keyframes fa-bounce{0%{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}10%{-webkit-transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0);transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0)}30%{-webkit-transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em));transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em))}50%{-webkit-transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0);transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0)}57%{-webkit-transform:scale(1) translateY(var(--fa-bounce-rebound,-.125em));transform:scale(1) translateY(var(--fa-bounce-rebound,-.125em))}64%{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}to{-webkit-transform:scale(1) translateY(0);transform:scale(1) translateY(0)}}@-webkit-keyframes fa-fade{50%{opacity:var(--fa-fade-opacity,.4)}}@keyframes fa-fade{50%{opacity:var(--fa-fade-opacity,.4)}}@-webkit-keyframes fa-beat-fade{0%,to{opacity:var(--fa-beat-fade-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(var(--fa-beat-fade-scale,1.125));transform:scale(var(--fa-beat-fade-scale,1.125))}}@keyframes fa-beat-fade{0%,to{opacity:var(--fa-beat-fade-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(var(--fa-beat-fade-scale,1.125));transform:scale(var(--fa-beat-fade-scale,1.125))}}@-webkit-keyframes fa-flip{50%{-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@keyframes fa-flip{50%{-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@-webkit-keyframes fa-shake{0%{-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}4%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}8%,24%{-webkit-transform:rotate(-18deg);transform:rotate(-18deg)}12%,28%{-webkit-transform:rotate(18deg);transform:rotate(18deg)}16%{-webkit-transform:rotate(-22deg);transform:rotate(-22deg)}20%{-webkit-transform:rotate(22deg);transform:rotate(22deg)}32%{-webkit-transform:rotate(-12deg);transform:rotate(-12deg)}36%{-webkit-transform:rotate(12deg);transform:rotate(12deg)}40%,to{-webkit-transform:rotate(0deg);transform:rotate(0deg)}}@keyframes fa-shake{0%{-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}4%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}8%,24%{-webkit-transform:rotate(-18deg);transform:rotate(-18deg)}12%,28%{-webkit-transform:rotate(18deg);transform:rotate(18deg)}16%{-webkit-transform:rotate(-22deg);transform:rotate(-22deg)}20%{-webkit-transform:rotate(22deg);transform:rotate(22deg)}32%{-webkit-transform:rotate(-12deg);transform:rotate(-12deg)}36%{-webkit-transform:rotate(12deg);transform:rotate(12deg)}40%,to{-webkit-transform:rotate(0deg);transform:rotate(0deg)}}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}.fa-rotate-by{-webkit-transform:rotate(var(--fa-rotate-angle,none));transform:rotate(var(--fa-rotate-angle,none))}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%;z-index:var(--fa-stack-z-index,auto)}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:var(--fa-inverse,#fff)}.fa-0:before{content:"\30"}.fa-1:before{content:"\31"}.fa-2:before{content:"\32"}.fa-3:before{content:"\33"}.fa-4:before{content:"\34"}.fa-5:before{content:"\35"}.fa-6:before{content:"\36"}.fa-7:before{content:"\37"}.fa-8:before{content:"\38"}.fa-9:before{content:"\39"}.fa-a:before{content:"\41"}.fa-address-book:before,.fa-contact-book:before{content:"\f2b9"}.fa-address-card:before,.fa-contact-card:before,.fa-vcard:before{content:"\f2bb"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-anchor:before{content:"\f13d"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-double-down:before,.fa-angles-down:before{content:"\f103"}.fa-angle-double-left:before,.fa-angles-left:before{content:"\f100"}.fa-angle-double-right:before,.fa-angles-right:before{content:"\f101"}.fa-angle-double-up:before,.fa-angles-up:before{content:"\f102"}.fa-ankh:before{content:"\f644"}.fa-apple-alt:before,.fa-apple-whole:before{content:"\f5d1"}.fa-archway:before{content:"\f557"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-down-1-9:before,.fa-sort-numeric-asc:before,.fa-sort-numeric-down:before{content:"\f162"}.fa-arrow-down-9-1:before,.fa-sort-numeric-desc:before,.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-arrow-down-a-z:before,.fa-sort-alpha-asc:before,.fa-sort-alpha-down:before{content:"\f15d"}.fa-arrow-down-long:before,.fa-long-arrow-down:before{content:"\f175"}.fa-arrow-down-short-wide:before,.fa-sort-amount-desc:before,.fa-sort-amount-down-alt:before{content:"\f884"}.fa-arrow-down-wide-short:before,.fa-sort-amount-asc:before,.fa-sort-amount-down:before{content:"\f160"}.fa-arrow-down-z-a:before,.fa-sort-alpha-desc:before,.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-left-long:before,.fa-long-arrow-left:before{content:"\f177"}.fa-arrow-pointer:before,.fa-mouse-pointer:before{content:"\f245"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-right-arrow-left:before,.fa-exchange:before{content:"\f0ec"}.fa-arrow-right-from-bracket:before,.fa-sign-out:before{content:"\f08b"}.fa-arrow-right-long:before,.fa-long-arrow-right:before{content:"\f178"}.fa-arrow-right-to-bracket:before,.fa-sign-in:before{content:"\f090"}.fa-arrow-left-rotate:before,.fa-arrow-rotate-back:before,.fa-arrow-rotate-backward:before,.fa-arrow-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-arrow-right-rotate:before,.fa-arrow-rotate-forward:before,.fa-arrow-rotate-right:before,.fa-redo:before{content:"\f01e"}.fa-arrow-trend-down:before{content:"\e097"}.fa-arrow-trend-up:before{content:"\e098"}.fa-arrow-turn-down:before,.fa-level-down:before{content:"\f149"}.fa-arrow-turn-up:before,.fa-level-up:before{content:"\f148"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-up-1-9:before,.fa-sort-numeric-up:before{content:"\f163"}.fa-arrow-up-9-1:before,.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-arrow-up-a-z:before,.fa-sort-alpha-up:before{content:"\f15e"}.fa-arrow-up-from-bracket:before{content:"\e09a"}.fa-arrow-up-long:before,.fa-long-arrow-up:before{content:"\f176"}.fa-arrow-up-right-from-square:before,.fa-external-link:before{content:"\f08e"}.fa-arrow-up-short-wide:before,.fa-sort-amount-up-alt:before{content:"\f885"}.fa-arrow-up-wide-short:before,.fa-sort-amount-up:before{content:"\f161"}.fa-arrow-up-z-a:before,.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-arrows-h:before,.fa-arrows-left-right:before{content:"\f07e"}.fa-arrows-rotate:before,.fa-refresh:before,.fa-sync:before{content:"\f021"}.fa-arrows-up-down:before,.fa-arrows-v:before{content:"\f07d"}.fa-arrows-up-down-left-right:before,.fa-arrows:before{content:"\f047"}.fa-asterisk:before{content:"\2a"}.fa-at:before{content:"\40"}.fa-atom:before{content:"\f5d2"}.fa-audio-description:before{content:"\f29e"}.fa-austral-sign:before{content:"\e0a9"}.fa-award:before{content:"\f559"}.fa-b:before{content:"\42"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before,.fa-carriage-baby:before{content:"\f77d"}.fa-backward:before{content:"\f04a"}.fa-backward-fast:before,.fa-fast-backward:before{content:"\f049"}.fa-backward-step:before,.fa-step-backward:before{content:"\f048"}.fa-bacon:before{content:"\f7e5"}.fa-bacteria:before{content:"\e059"}.fa-bacterium:before{content:"\e05a"}.fa-bag-shopping:before,.fa-shopping-bag:before{content:"\f290"}.fa-bahai:before{content:"\f666"}.fa-baht-sign:before{content:"\e0ac"}.fa-ban:before,.fa-cancel:before{content:"\f05e"}.fa-ban-smoking:before,.fa-smoking-ban:before{content:"\f54d"}.fa-band-aid:before,.fa-bandage:before{content:"\f462"}.fa-barcode:before{content:"\f02a"}.fa-bars:before,.fa-navicon:before{content:"\f0c9"}.fa-bars-progress:before,.fa-tasks-alt:before{content:"\f828"}.fa-bars-staggered:before,.fa-reorder:before,.fa-stream:before{content:"\f550"}.fa-baseball-ball:before,.fa-baseball:before{content:"\f433"}.fa-baseball-bat-ball:before{content:"\f432"}.fa-basket-shopping:before,.fa-shopping-basket:before{content:"\f291"}.fa-basketball-ball:before,.fa-basketball:before{content:"\f434"}.fa-bath:before,.fa-bathtub:before{content:"\f2cd"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-battery-5:before,.fa-battery-full:before,.fa-battery:before{content:"\f240"}.fa-battery-3:before,.fa-battery-half:before{content:"\f242"}.fa-battery-2:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-4:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-bed:before{content:"\f236"}.fa-bed-pulse:before,.fa-procedures:before{content:"\f487"}.fa-beer-mug-empty:before,.fa-beer:before{content:"\f0fc"}.fa-bell:before{content:"\f0f3"}.fa-bell-concierge:before,.fa-concierge-bell:before{content:"\f562"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bicycle:before{content:"\f206"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-bitcoin-sign:before{content:"\e0b4"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blog:before{content:"\f781"}.fa-bold:before{content:"\f032"}.fa-bolt:before,.fa-zap:before{content:"\f0e7"}.fa-bolt-lightning:before{content:"\e0b7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-atlas:before,.fa-book-atlas:before{content:"\f558"}.fa-bible:before,.fa-book-bible:before{content:"\f647"}.fa-book-journal-whills:before,.fa-journal-whills:before{content:"\f66a"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-open-reader:before,.fa-book-reader:before{content:"\f5da"}.fa-book-quran:before,.fa-quran:before{content:"\f687"}.fa-book-dead:before,.fa-book-skull:before{content:"\f6b7"}.fa-bookmark:before{content:"\f02e"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before,.fa-border-top-left:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-archive:before,.fa-box-archive:before{content:"\f187"}.fa-box-open:before{content:"\f49e"}.fa-box-tissue:before{content:"\e05b"}.fa-boxes-alt:before,.fa-boxes-stacked:before,.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-brazilian-real-sign:before{content:"\e46c"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broom:before{content:"\f51a"}.fa-broom-ball:before,.fa-quidditch-broom-ball:before,.fa-quidditch:before{content:"\f458"}.fa-brush:before{content:"\f55d"}.fa-bug:before{content:"\f188"}.fa-bug-slash:before{content:"\e490"}.fa-building:before{content:"\f1ad"}.fa-bank:before,.fa-building-columns:before,.fa-institution:before,.fa-museum:before,.fa-university:before{content:"\f19c"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burger:before,.fa-hamburger:before{content:"\f805"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before,.fa-bus-simple:before{content:"\f55e"}.fa-briefcase-clock:before,.fa-business-time:before{content:"\f64a"}.fa-c:before{content:"\43"}.fa-birthday-cake:before,.fa-cake-candles:before,.fa-cake:before{content:"\f1fd"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-alt:before,.fa-calendar-days:before{content:"\f073"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-week:before{content:"\f784"}.fa-calendar-times:before,.fa-calendar-xmark:before{content:"\f273"}.fa-camera-alt:before,.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-camera-rotate:before{content:"\e0d8"}.fa-campground:before{content:"\f6bb"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-battery-car:before,.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-alt:before,.fa-car-rear:before{content:"\f5de"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-flatbed:before,.fa-dolly-flatbed:before{content:"\f474"}.fa-cart-flatbed-suitcase:before,.fa-luggage-cart:before{content:"\f59d"}.fa-cart-plus:before{content:"\f217"}.fa-cart-shopping:before,.fa-shopping-cart:before{content:"\f07a"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cedi-sign:before{content:"\e0df"}.fa-cent-sign:before{content:"\e3f5"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-blackboard:before,.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before,.fa-chalkboard-user:before{content:"\f51c"}.fa-champagne-glasses:before,.fa-glass-cheers:before{content:"\f79f"}.fa-charging-station:before{content:"\f5e7"}.fa-area-chart:before,.fa-chart-area:before{content:"\f1fe"}.fa-bar-chart:before,.fa-chart-bar:before{content:"\f080"}.fa-chart-column:before{content:"\e0e3"}.fa-chart-gantt:before{content:"\e0e4"}.fa-chart-line:before,.fa-line-chart:before{content:"\f201"}.fa-chart-pie:before,.fa-pie-chart:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-double:before{content:"\f560"}.fa-check-to-slot:before,.fa-vote-yea:before{content:"\f772"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-arrow-circle-down:before,.fa-circle-arrow-down:before{content:"\f0ab"}.fa-arrow-circle-left:before,.fa-circle-arrow-left:before{content:"\f0a8"}.fa-arrow-circle-right:before,.fa-circle-arrow-right:before{content:"\f0a9"}.fa-arrow-circle-up:before,.fa-circle-arrow-up:before{content:"\f0aa"}.fa-check-circle:before,.fa-circle-check:before{content:"\f058"}.fa-chevron-circle-down:before,.fa-circle-chevron-down:before{content:"\f13a"}.fa-chevron-circle-left:before,.fa-circle-chevron-left:before{content:"\f137"}.fa-chevron-circle-right:before,.fa-circle-chevron-right:before{content:"\f138"}.fa-chevron-circle-up:before,.fa-circle-chevron-up:before{content:"\f139"}.fa-circle-dollar-to-slot:before,.fa-donate:before{content:"\f4b9"}.fa-circle-dot:before,.fa-dot-circle:before{content:"\f192"}.fa-arrow-alt-circle-down:before,.fa-circle-down:before{content:"\f358"}.fa-circle-exclamation:before,.fa-exclamation-circle:before{content:"\f06a"}.fa-circle-h:before,.fa-hospital-symbol:before{content:"\f47e"}.fa-adjust:before,.fa-circle-half-stroke:before{content:"\f042"}.fa-circle-info:before,.fa-info-circle:before{content:"\f05a"}.fa-arrow-alt-circle-left:before,.fa-circle-left:before{content:"\f359"}.fa-circle-minus:before,.fa-minus-circle:before{content:"\f056"}.fa-circle-notch:before{content:"\f1ce"}.fa-circle-pause:before,.fa-pause-circle:before{content:"\f28b"}.fa-circle-play:before,.fa-play-circle:before{content:"\f144"}.fa-circle-plus:before,.fa-plus-circle:before{content:"\f055"}.fa-circle-question:before,.fa-question-circle:before{content:"\f059"}.fa-circle-radiation:before,.fa-radiation-alt:before{content:"\f7ba"}.fa-arrow-alt-circle-right:before,.fa-circle-right:before{content:"\f35a"}.fa-circle-stop:before,.fa-stop-circle:before{content:"\f28d"}.fa-arrow-alt-circle-up:before,.fa-circle-up:before{content:"\f35b"}.fa-circle-user:before,.fa-user-circle:before{content:"\f2bd"}.fa-circle-xmark:before,.fa-times-circle:before,.fa-xmark-circle:before{content:"\f057"}.fa-city:before{content:"\f64f"}.fa-clapperboard:before{content:"\e131"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock-four:before,.fa-clock:before{content:"\f017"}.fa-clock-rotate-left:before,.fa-history:before{content:"\f1da"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-arrow-down:before,.fa-cloud-download-alt:before,.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-arrow-up:before,.fa-cloud-upload-alt:before,.fa-cloud-upload:before{content:"\f0ee"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-clover:before{content:"\e139"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-code-commit:before{content:"\f386"}.fa-code-compare:before{content:"\e13a"}.fa-code-fork:before{content:"\e13b"}.fa-code-merge:before{content:"\f387"}.fa-code-pull-request:before{content:"\e13c"}.fa-coins:before{content:"\f51e"}.fa-colon-sign:before{content:"\e140"}.fa-comment:before{content:"\f075"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before,.fa-commenting:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comment-sms:before,.fa-sms:before{content:"\f7cd"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compass-drafting:before,.fa-drafting-compass:before{content:"\f568"}.fa-compress:before{content:"\f066"}.fa-computer-mouse:before,.fa-mouse:before{content:"\f8cc"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-credit-card-alt:before,.fa-credit-card:before{content:"\f09d"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before,.fa-crop-simple:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-cruzeiro-sign:before{content:"\e152"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-d:before{content:"\44"}.fa-database:before{content:"\f1c0"}.fa-backspace:before,.fa-delete-left:before{content:"\f55a"}.fa-democrat:before{content:"\f747"}.fa-desktop-alt:before,.fa-desktop:before{content:"\f390"}.fa-dharmachakra:before{content:"\f655"}.fa-diagram-next:before{content:"\e476"}.fa-diagram-predecessor:before{content:"\e477"}.fa-diagram-project:before,.fa-project-diagram:before{content:"\f542"}.fa-diagram-successor:before{content:"\e47a"}.fa-diamond:before{content:"\f219"}.fa-diamond-turn-right:before,.fa-directions:before{content:"\f5eb"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-disease:before{content:"\f7fa"}.fa-divide:before{content:"\f529"}.fa-dna:before{content:"\f471"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before,.fa-dollar:before,.fa-usd:before{content:"\24"}.fa-dolly-box:before,.fa-dolly:before{content:"\f472"}.fa-dong-sign:before{content:"\e169"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dove:before{content:"\f4ba"}.fa-compress-alt:before,.fa-down-left-and-up-right-to-center:before{content:"\f422"}.fa-down-long:before,.fa-long-arrow-alt-down:before{content:"\f309"}.fa-download:before{content:"\f019"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-droplet:before,.fa-tint:before{content:"\f043"}.fa-droplet-slash:before,.fa-tint-slash:before{content:"\f5c7"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-e:before{content:"\45"}.fa-deaf:before,.fa-deafness:before,.fa-ear-deaf:before,.fa-hard-of-hearing:before{content:"\f2a4"}.fa-assistive-listening-systems:before,.fa-ear-listen:before{content:"\f2a2"}.fa-earth-africa:before,.fa-globe-africa:before{content:"\f57c"}.fa-earth-america:before,.fa-earth-americas:before,.fa-earth:before,.fa-globe-americas:before{content:"\f57d"}.fa-earth-asia:before,.fa-globe-asia:before{content:"\f57e"}.fa-earth-europe:before,.fa-globe-europe:before{content:"\f7a2"}.fa-earth-oceania:before,.fa-globe-oceania:before{content:"\e47b"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elevator:before{content:"\e16d"}.fa-ellipsis-h:before,.fa-ellipsis:before{content:"\f141"}.fa-ellipsis-v:before,.fa-ellipsis-vertical:before{content:"\f142"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelopes-bulk:before,.fa-mail-bulk:before{content:"\f674"}.fa-equals:before{content:"\3d"}.fa-eraser:before{content:"\f12d"}.fa-ethernet:before{content:"\f796"}.fa-eur:before,.fa-euro-sign:before,.fa-euro:before{content:"\f153"}.fa-exclamation:before{content:"\21"}.fa-expand:before{content:"\f065"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper-empty:before,.fa-eye-dropper:before,.fa-eyedropper:before{content:"\f1fb"}.fa-eye-low-vision:before,.fa-low-vision:before{content:"\f2a8"}.fa-eye-slash:before{content:"\f070"}.fa-f:before{content:"\46"}.fa-angry:before,.fa-face-angry:before{content:"\f556"}.fa-dizzy:before,.fa-face-dizzy:before{content:"\f567"}.fa-face-flushed:before,.fa-flushed:before{content:"\f579"}.fa-face-frown:before,.fa-frown:before{content:"\f119"}.fa-face-frown-open:before,.fa-frown-open:before{content:"\f57a"}.fa-face-grimace:before,.fa-grimace:before{content:"\f57f"}.fa-face-grin:before,.fa-grin:before{content:"\f580"}.fa-face-grin-beam:before,.fa-grin-beam:before{content:"\f582"}.fa-face-grin-beam-sweat:before,.fa-grin-beam-sweat:before{content:"\f583"}.fa-face-grin-hearts:before,.fa-grin-hearts:before{content:"\f584"}.fa-face-grin-squint:before,.fa-grin-squint:before{content:"\f585"}.fa-face-grin-squint-tears:before,.fa-grin-squint-tears:before{content:"\f586"}.fa-face-grin-stars:before,.fa-grin-stars:before{content:"\f587"}.fa-face-grin-tears:before,.fa-grin-tears:before{content:"\f588"}.fa-face-grin-tongue:before,.fa-grin-tongue:before{content:"\f589"}.fa-face-grin-tongue-squint:before,.fa-grin-tongue-squint:before{content:"\f58a"}.fa-face-grin-tongue-wink:before,.fa-grin-tongue-wink:before{content:"\f58b"}.fa-face-grin-wide:before,.fa-grin-alt:before{content:"\f581"}.fa-face-grin-wink:before,.fa-grin-wink:before{content:"\f58c"}.fa-face-kiss:before,.fa-kiss:before{content:"\f596"}.fa-face-kiss-beam:before,.fa-kiss-beam:before{content:"\f597"}.fa-face-kiss-wink-heart:before,.fa-kiss-wink-heart:before{content:"\f598"}.fa-face-laugh:before,.fa-laugh:before{content:"\f599"}.fa-face-laugh-beam:before,.fa-laugh-beam:before{content:"\f59a"}.fa-face-laugh-squint:before,.fa-laugh-squint:before{content:"\f59b"}.fa-face-laugh-wink:before,.fa-laugh-wink:before{content:"\f59c"}.fa-face-meh:before,.fa-meh:before{content:"\f11a"}.fa-face-meh-blank:before,.fa-meh-blank:before{content:"\f5a4"}.fa-face-rolling-eyes:before,.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-face-sad-cry:before,.fa-sad-cry:before{content:"\f5b3"}.fa-face-sad-tear:before,.fa-sad-tear:before{content:"\f5b4"}.fa-face-smile:before,.fa-smile:before{content:"\f118"}.fa-face-smile-beam:before,.fa-smile-beam:before{content:"\f5b8"}.fa-face-smile-wink:before,.fa-smile-wink:before{content:"\f4da"}.fa-face-surprise:before,.fa-surprise:before{content:"\f5c2"}.fa-face-tired:before,.fa-tired:before{content:"\f5c8"}.fa-fan:before{content:"\f863"}.fa-faucet:before{content:"\e005"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before,.fa-feather-pointed:before{content:"\f56b"}.fa-file:before{content:"\f15b"}.fa-file-arrow-down:before,.fa-file-download:before{content:"\f56d"}.fa-file-arrow-up:before,.fa-file-upload:before{content:"\f574"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-excel:before{content:"\f1c3"}.fa-arrow-right-from-file:before,.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-arrow-right-to-file:before,.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-alt:before,.fa-file-lines:before,.fa-file-text:before{content:"\f15c"}.fa-file-medical:before{content:"\f477"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-video:before{content:"\f1c8"}.fa-file-medical-alt:before,.fa-file-waveform:before{content:"\f478"}.fa-file-word:before{content:"\f1c2"}.fa-file-archive:before,.fa-file-zipper:before{content:"\f1c6"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-filter-circle-dollar:before,.fa-funnel-dollar:before{content:"\f662"}.fa-filter-circle-xmark:before{content:"\e17b"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-extinguisher:before{content:"\f134"}.fa-fire-alt:before,.fa-fire-flame-curved:before{content:"\f7e4"}.fa-burn:before,.fa-fire-flame-simple:before{content:"\f46a"}.fa-fish:before{content:"\f578"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-floppy-disk:before,.fa-save:before{content:"\f0c7"}.fa-florin-sign:before{content:"\e184"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-folder-tree:before{content:"\f802"}.fa-font:before{content:"\f031"}.fa-football-ball:before,.fa-football:before{content:"\f44e"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before,.fa-forward-fast:before{content:"\f050"}.fa-forward-step:before,.fa-step-forward:before{content:"\f051"}.fa-franc-sign:before{content:"\e18f"}.fa-frog:before{content:"\f52e"}.fa-futbol-ball:before,.fa-futbol:before,.fa-soccer-ball:before{content:"\f1e3"}.fa-g:before{content:"\47"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-dashboard:before,.fa-gauge-med:before,.fa-gauge:before,.fa-tachometer-alt-average:before{content:"\f624"}.fa-gauge-high:before,.fa-tachometer-alt-fast:before,.fa-tachometer-alt:before{content:"\f625"}.fa-gauge-simple-med:before,.fa-gauge-simple:before,.fa-tachometer-average:before{content:"\f629"}.fa-gauge-simple-high:before,.fa-tachometer-fast:before,.fa-tachometer:before{content:"\f62a"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-glasses:before{content:"\f530"}.fa-globe:before{content:"\f0ac"}.fa-golf-ball-tee:before,.fa-golf-ball:before{content:"\f450"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-greater-than:before{content:"\3e"}.fa-greater-than-equal:before{content:"\f532"}.fa-grip-horizontal:before,.fa-grip:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-guarani-sign:before{content:"\e19a"}.fa-guitar:before{content:"\f7a6"}.fa-gun:before{content:"\e19b"}.fa-h:before{content:"\48"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-paper:before,.fa-hand:before{content:"\f256"}.fa-hand-back-fist:before,.fa-hand-rock:before{content:"\f255"}.fa-allergies:before,.fa-hand-dots:before{content:"\f461"}.fa-fist-raised:before,.fa-hand-fist:before{content:"\f6de"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-dollar:before,.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-holding-droplet:before,.fa-hand-holding-water:before{content:"\f4c1"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-medical:before{content:"\e05c"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-sparkles:before{content:"\e05d"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before,.fa-sign-language:before,.fa-signing:before{content:"\f2a7"}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before,.fa-hands-american-sign-language-interpreting:before,.fa-hands-asl-interpreting:before{content:"\f2a3"}.fa-hands-bubbles:before,.fa-hands-wash:before{content:"\e05e"}.fa-hands-clapping:before{content:"\e1a8"}.fa-hands-holding:before{content:"\f4c2"}.fa-hands-praying:before,.fa-praying-hands:before{content:"\f684"}.fa-handshake:before{content:"\f2b5"}.fa-hands-helping:before,.fa-handshake-angle:before{content:"\f4c4"}.fa-handshake-alt-slash:before,.fa-handshake-simple-slash:before{content:"\e05f"}.fa-handshake-slash:before{content:"\e060"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-drive:before,.fa-hdd:before{content:"\f0a0"}.fa-hashtag:before{content:"\23"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-head-side-cough:before{content:"\e061"}.fa-head-side-cough-slash:before{content:"\e062"}.fa-head-side-mask:before{content:"\e063"}.fa-head-side-virus:before{content:"\e064"}.fa-header:before,.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before,.fa-headphones-simple:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before,.fa-heart-crack:before{content:"\f7a9"}.fa-heart-pulse:before,.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-hard-hat:before,.fa-hat-hard:before,.fa-helmet-safety:before{content:"\f807"}.fa-highlighter:before{content:"\f591"}.fa-hippo:before{content:"\f6ed"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital-alt:before,.fa-hospital-wide:before,.fa-hospital:before{content:"\f0f8"}.fa-hospital-user:before{content:"\f80d"}.fa-hot-tub-person:before,.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hourglass-2:before,.fa-hourglass-half:before,.fa-hourglass:before{content:"\f254"}.fa-hourglass-empty:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-home-alt:before,.fa-home-lg-alt:before,.fa-home:before,.fa-house:before{content:"\f015"}.fa-home-lg:before,.fa-house-chimney:before{content:"\e3af"}.fa-house-chimney-crack:before,.fa-house-damage:before{content:"\f6f1"}.fa-clinic-medical:before,.fa-house-chimney-medical:before{content:"\f7f2"}.fa-house-chimney-user:before{content:"\e065"}.fa-house-chimney-window:before{content:"\e00d"}.fa-house-crack:before{content:"\e3b1"}.fa-house-laptop:before,.fa-laptop-house:before{content:"\e066"}.fa-house-medical:before{content:"\e3b2"}.fa-home-user:before,.fa-house-user:before{content:"\e1b0"}.fa-hryvnia-sign:before,.fa-hryvnia:before{content:"\f6f2"}.fa-i:before{content:"\49"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-heart-music-camera-bolt:before,.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before,.fa-id-card-clip:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-image-portrait:before,.fa-portrait:before{content:"\f3e0"}.fa-images:before{content:"\f302"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-indian-rupee-sign:before,.fa-indian-rupee:before,.fa-inr:before{content:"\e1bc"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-italic:before{content:"\f033"}.fa-j:before{content:"\4a"}.fa-jedi:before{content:"\f669"}.fa-fighter-jet:before,.fa-jet-fighter:before{content:"\f0fb"}.fa-joint:before{content:"\f595"}.fa-k:before{content:"\4b"}.fa-kaaba:before{content:"\f66b"}.fa-key:before{content:"\f084"}.fa-keyboard:before{content:"\f11c"}.fa-khanda:before{content:"\f66d"}.fa-kip-sign:before{content:"\e1c4"}.fa-first-aid:before,.fa-kit-medical:before{content:"\f479"}.fa-kiwi-bird:before{content:"\f535"}.fa-l:before{content:"\4c"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-lari-sign:before{content:"\e1c8"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-left-long:before,.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-arrows-alt-h:before,.fa-left-right:before{content:"\f337"}.fa-lemon:before{content:"\f094"}.fa-less-than:before{content:"\3c"}.fa-less-than-equal:before{content:"\f537"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-chain-broken:before,.fa-chain-slash:before,.fa-link-slash:before,.fa-unlink:before{content:"\f127"}.fa-lira-sign:before{content:"\f195"}.fa-list-squares:before,.fa-list:before{content:"\f03a"}.fa-list-check:before,.fa-tasks:before{content:"\f0ae"}.fa-list-1-2:before,.fa-list-numeric:before,.fa-list-ol:before{content:"\f0cb"}.fa-list-dots:before,.fa-list-ul:before{content:"\f0ca"}.fa-litecoin-sign:before{content:"\e1d3"}.fa-location-arrow:before{content:"\f124"}.fa-location-crosshairs:before,.fa-location:before{content:"\f601"}.fa-location-dot:before,.fa-map-marker-alt:before{content:"\f3c5"}.fa-location-pin:before,.fa-map-marker:before{content:"\f041"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-lungs:before{content:"\f604"}.fa-lungs-virus:before{content:"\e067"}.fa-m:before{content:"\4d"}.fa-magnet:before{content:"\f076"}.fa-magnifying-glass:before,.fa-search:before{content:"\f002"}.fa-magnifying-glass-dollar:before,.fa-search-dollar:before{content:"\f688"}.fa-magnifying-glass-location:before,.fa-search-location:before{content:"\f689"}.fa-magnifying-glass-minus:before,.fa-search-minus:before{content:"\f010"}.fa-magnifying-glass-plus:before,.fa-search-plus:before{content:"\f00e"}.fa-manat-sign:before{content:"\e1d5"}.fa-map:before{content:"\f279"}.fa-map-location:before,.fa-map-marked:before{content:"\f59f"}.fa-map-location-dot:before,.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-pin:before{content:"\f276"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-and-venus:before{content:"\f224"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before,.fa-mars-stroke-right:before{content:"\f22b"}.fa-mars-stroke-up:before,.fa-mars-stroke-v:before{content:"\f22a"}.fa-glass-martini-alt:before,.fa-martini-glass:before{content:"\f57b"}.fa-cocktail:before,.fa-martini-glass-citrus:before{content:"\f561"}.fa-glass-martini:before,.fa-martini-glass-empty:before{content:"\f000"}.fa-mask:before{content:"\f6fa"}.fa-mask-face:before{content:"\e1d7"}.fa-masks-theater:before,.fa-theater-masks:before{content:"\f630"}.fa-expand-arrows-alt:before,.fa-maximize:before{content:"\f31e"}.fa-medal:before{content:"\f5a2"}.fa-memory:before{content:"\f538"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-comment-alt:before,.fa-message:before{content:"\f27a"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before,.fa-microphone-lines:before{content:"\f3c9"}.fa-microphone-alt-slash:before,.fa-microphone-lines-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-mill-sign:before{content:"\e1ed"}.fa-compress-arrows-alt:before,.fa-minimize:before{content:"\f78c"}.fa-minus:before,.fa-subtract:before{content:"\f068"}.fa-mitten:before{content:"\f7b5"}.fa-mobile-android:before,.fa-mobile-phone:before,.fa-mobile:before{content:"\f3ce"}.fa-mobile-button:before{content:"\f10b"}.fa-mobile-alt:before,.fa-mobile-screen-button:before{content:"\f3cd"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-1:before,.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-1-wave:before,.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before,.fa-money-check-dollar:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mug-hot:before{content:"\f7b6"}.fa-coffee:before,.fa-mug-saucer:before{content:"\f0f4"}.fa-music:before{content:"\f001"}.fa-n:before{content:"\4e"}.fa-naira-sign:before{content:"\e1f6"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-not-equal:before{content:"\f53e"}.fa-note-sticky:before,.fa-sticky-note:before{content:"\f249"}.fa-notes-medical:before{content:"\f481"}.fa-o:before{content:"\4f"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-oil-can:before{content:"\f613"}.fa-om:before{content:"\f679"}.fa-otter:before{content:"\f700"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-p:before{content:"\50"}.fa-pager:before{content:"\f815"}.fa-paint-roller:before{content:"\f5aa"}.fa-paint-brush:before,.fa-paintbrush:before{content:"\f1fc"}.fa-palette:before{content:"\f53f"}.fa-pallet:before{content:"\f482"}.fa-panorama:before{content:"\e209"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-passport:before{content:"\f5ab"}.fa-file-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-pause:before{content:"\f04c"}.fa-paw:before{content:"\f1b0"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before,.fa-pen-clip:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-ruler:before,.fa-pencil-ruler:before{content:"\f5ae"}.fa-edit:before,.fa-pen-to-square:before{content:"\f044"}.fa-pencil-alt:before,.fa-pencil:before{content:"\f303"}.fa-people-arrows-left-right:before,.fa-people-arrows:before{content:"\e068"}.fa-people-carry-box:before,.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before,.fa-percentage:before{content:"\25"}.fa-male:before,.fa-person:before{content:"\f183"}.fa-biking:before,.fa-person-biking:before{content:"\f84a"}.fa-person-booth:before{content:"\f756"}.fa-diagnoses:before,.fa-person-dots-from-line:before{content:"\f470"}.fa-female:before,.fa-person-dress:before{content:"\f182"}.fa-hiking:before,.fa-person-hiking:before{content:"\f6ec"}.fa-person-praying:before,.fa-pray:before{content:"\f683"}.fa-person-running:before,.fa-running:before{content:"\f70c"}.fa-person-skating:before,.fa-skating:before{content:"\f7c5"}.fa-person-skiing:before,.fa-skiing:before{content:"\f7c9"}.fa-person-skiing-nordic:before,.fa-skiing-nordic:before{content:"\f7ca"}.fa-person-snowboarding:before,.fa-snowboarding:before{content:"\f7ce"}.fa-person-swimming:before,.fa-swimmer:before{content:"\f5c4"}.fa-person-walking:before,.fa-walking:before{content:"\f554"}.fa-blind:before,.fa-person-walking-with-cane:before{content:"\f29d"}.fa-peseta-sign:before{content:"\e221"}.fa-peso-sign:before{content:"\e222"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before,.fa-phone-flip:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-volume:before,.fa-volume-control-phone:before{content:"\f2a0"}.fa-photo-film:before,.fa-photo-video:before{content:"\f87c"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-plane-slash:before{content:"\e069"}.fa-play:before{content:"\f04b"}.fa-plug:before{content:"\f1e6"}.fa-add:before,.fa-plus:before{content:"\2b"}.fa-plus-minus:before{content:"\e43c"}.fa-podcast:before{content:"\f2ce"}.fa-poo:before{content:"\f2fe"}.fa-poo-bolt:before,.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-power-off:before{content:"\f011"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before,.fa-prescription-bottle-medical:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-pump-medical:before{content:"\e06a"}.fa-pump-soap:before{content:"\e06b"}.fa-puzzle-piece:before{content:"\f12e"}.fa-q:before{content:"\51"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\3f"}.fa-quote-left-alt:before,.fa-quote-left:before{content:"\f10d"}.fa-quote-right-alt:before,.fa-quote-right:before{content:"\f10e"}.fa-r:before{content:"\52"}.fa-radiation:before{content:"\f7b9"}.fa-rainbow:before{content:"\f75b"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-ad:before,.fa-rectangle-ad:before{content:"\f641"}.fa-list-alt:before,.fa-rectangle-list:before{content:"\f022"}.fa-rectangle-times:before,.fa-rectangle-xmark:before,.fa-times-rectangle:before,.fa-window-close:before{content:"\f410"}.fa-recycle:before{content:"\f1b8"}.fa-registered:before{content:"\f25d"}.fa-repeat:before{content:"\f363"}.fa-mail-reply:before,.fa-reply:before{content:"\f3e5"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-republican:before{content:"\f75e"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-ribbon:before{content:"\f4d6"}.fa-right-from-bracket:before,.fa-sign-out-alt:before{content:"\f2f5"}.fa-exchange-alt:before,.fa-right-left:before{content:"\f362"}.fa-long-arrow-alt-right:before,.fa-right-long:before{content:"\f30b"}.fa-right-to-bracket:before,.fa-sign-in-alt:before{content:"\f2f6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rotate:before,.fa-sync-alt:before{content:"\f2f1"}.fa-rotate-back:before,.fa-rotate-backward:before,.fa-rotate-left:before,.fa-undo-alt:before{content:"\f2ea"}.fa-redo-alt:before,.fa-rotate-forward:before,.fa-rotate-right:before{content:"\f2f9"}.fa-route:before{content:"\f4d7"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-rouble:before,.fa-rub:before,.fa-ruble-sign:before,.fa-ruble:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-rupee-sign:before,.fa-rupee:before{content:"\f156"}.fa-rupiah-sign:before{content:"\e23d"}.fa-s:before{content:"\53"}.fa-sailboat:before{content:"\e445"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-balance-scale:before,.fa-scale-balanced:before{content:"\f24e"}.fa-balance-scale-left:before,.fa-scale-unbalanced:before{content:"\f515"}.fa-balance-scale-right:before,.fa-scale-unbalanced-flip:before{content:"\f516"}.fa-school:before{content:"\f549"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-screwdriver:before{content:"\f54a"}.fa-screwdriver-wrench:before,.fa-tools:before{content:"\f7d9"}.fa-scroll:before{content:"\f70e"}.fa-scroll-torah:before,.fa-torah:before{content:"\f6a0"}.fa-sd-card:before{content:"\f7c2"}.fa-section:before{content:"\e447"}.fa-seedling:before,.fa-sprout:before{content:"\f4d8"}.fa-server:before{content:"\f233"}.fa-shapes:before,.fa-triangle-circle-square:before{content:"\f61f"}.fa-arrow-turn-right:before,.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-share-from-square:before,.fa-share-square:before{content:"\f14d"}.fa-share-alt:before,.fa-share-nodes:before{content:"\f1e0"}.fa-ils:before,.fa-shekel-sign:before,.fa-shekel:before,.fa-sheqel-sign:before,.fa-sheqel:before{content:"\f20b"}.fa-shield:before{content:"\f132"}.fa-shield-alt:before,.fa-shield-blank:before{content:"\f3ed"}.fa-shield-virus:before{content:"\e06c"}.fa-ship:before{content:"\f21a"}.fa-shirt:before,.fa-t-shirt:before,.fa-tshirt:before{content:"\f553"}.fa-shoe-prints:before{content:"\f54b"}.fa-shop:before,.fa-store-alt:before{content:"\f54f"}.fa-shop-slash:before,.fa-store-alt-slash:before{content:"\e070"}.fa-shower:before{content:"\f2cc"}.fa-shrimp:before{content:"\e448"}.fa-random:before,.fa-shuffle:before{content:"\f074"}.fa-shuttle-space:before,.fa-space-shuttle:before{content:"\f197"}.fa-sign-hanging:before,.fa-sign:before{content:"\f4d9"}.fa-signal-5:before,.fa-signal-perfect:before,.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-map-signs:before,.fa-signs-post:before{content:"\f277"}.fa-sim-card:before{content:"\f7c4"}.fa-sink:before{content:"\e06d"}.fa-sitemap:before{content:"\f0e8"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before,.fa-sliders:before{content:"\f1de"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-soap:before{content:"\e06e"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-spa:before{content:"\f5bb"}.fa-pastafarianism:before,.fa-spaghetti-monster-flying:before{content:"\f67b"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spoon:before,.fa-utensil-spoon:before{content:"\f2e5"}.fa-spray-can:before{content:"\f5bd"}.fa-air-freshener:before,.fa-spray-can-sparkles:before{content:"\f5d0"}.fa-square:before{content:"\f0c8"}.fa-external-link-square:before,.fa-square-arrow-up-right:before{content:"\f14c"}.fa-caret-square-down:before,.fa-square-caret-down:before{content:"\f150"}.fa-caret-square-left:before,.fa-square-caret-left:before{content:"\f191"}.fa-caret-square-right:before,.fa-square-caret-right:before{content:"\f152"}.fa-caret-square-up:before,.fa-square-caret-up:before{content:"\f151"}.fa-check-square:before,.fa-square-check:before{content:"\f14a"}.fa-envelope-square:before,.fa-square-envelope:before{content:"\f199"}.fa-square-full:before{content:"\f45c"}.fa-h-square:before,.fa-square-h:before{content:"\f0fd"}.fa-minus-square:before,.fa-square-minus:before{content:"\f146"}.fa-parking:before,.fa-square-parking:before{content:"\f540"}.fa-pen-square:before,.fa-pencil-square:before,.fa-square-pen:before{content:"\f14b"}.fa-phone-square:before,.fa-square-phone:before{content:"\f098"}.fa-phone-square-alt:before,.fa-square-phone-flip:before{content:"\f87b"}.fa-plus-square:before,.fa-square-plus:before{content:"\f0fe"}.fa-poll-h:before,.fa-square-poll-horizontal:before{content:"\f682"}.fa-poll:before,.fa-square-poll-vertical:before{content:"\f681"}.fa-square-root-alt:before,.fa-square-root-variable:before{content:"\f698"}.fa-rss-square:before,.fa-square-rss:before{content:"\f143"}.fa-share-alt-square:before,.fa-square-share-nodes:before{content:"\f1e1"}.fa-external-link-square-alt:before,.fa-square-up-right:before{content:"\f360"}.fa-square-xmark:before,.fa-times-square:before,.fa-xmark-square:before{content:"\f2d3"}.fa-stairs:before{content:"\e289"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before,.fa-star-half-stroke:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-gbp:before,.fa-pound-sign:before,.fa-sterling-sign:before{content:"\f154"}.fa-stethoscope:before{content:"\f0f1"}.fa-stop:before{content:"\f04d"}.fa-stopwatch:before{content:"\f2f2"}.fa-stopwatch-20:before{content:"\e06f"}.fa-store:before{content:"\f54e"}.fa-store-slash:before{content:"\e071"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stroopwafel:before{content:"\f551"}.fa-subscript:before{content:"\f12c"}.fa-suitcase:before{content:"\f0f2"}.fa-medkit:before,.fa-suitcase-medical:before{content:"\f0fa"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superscript:before{content:"\f12b"}.fa-swatchbook:before{content:"\f5c3"}.fa-synagogue:before{content:"\f69b"}.fa-syringe:before{content:"\f48e"}.fa-t:before{content:"\54"}.fa-table:before{content:"\f0ce"}.fa-table-cells:before,.fa-th:before{content:"\f00a"}.fa-table-cells-large:before,.fa-th-large:before{content:"\f009"}.fa-columns:before,.fa-table-columns:before{content:"\f0db"}.fa-table-list:before,.fa-th-list:before{content:"\f00b"}.fa-ping-pong-paddle-ball:before,.fa-table-tennis-paddle-ball:before,.fa-table-tennis:before{content:"\f45d"}.fa-tablet-android:before,.fa-tablet:before{content:"\f3fb"}.fa-tablet-button:before{content:"\f10a"}.fa-tablet-alt:before,.fa-tablet-screen-button:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-digital-tachograph:before,.fa-tachograph-digital:before{content:"\f566"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-temperature-0:before,.fa-temperature-empty:before,.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-temperature-4:before,.fa-temperature-full:before,.fa-thermometer-4:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-temperature-2:before,.fa-temperature-half:before,.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-temperature-1:before,.fa-temperature-quarter:before,.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-temperature-3:before,.fa-temperature-three-quarters:before,.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-tenge-sign:before,.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-remove-format:before,.fa-text-slash:before{content:"\f87d"}.fa-text-width:before{content:"\f035"}.fa-thermometer:before{content:"\f491"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumb-tack:before,.fa-thumbtack:before{content:"\f08d"}.fa-ticket:before{content:"\f145"}.fa-ticket-alt:before,.fa-ticket-simple:before{content:"\f3ff"}.fa-timeline:before{content:"\e29c"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toilet-paper-slash:before{content:"\e072"}.fa-toolbox:before{content:"\f552"}.fa-tooth:before{content:"\f5c9"}.fa-torii-gate:before{content:"\f6a1"}.fa-broadcast-tower:before,.fa-tower-broadcast:before{content:"\f519"}.fa-tractor:before{content:"\f722"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\e041"}.fa-train:before{content:"\f238"}.fa-subway:before,.fa-train-subway:before{content:"\f239"}.fa-train-tram:before,.fa-tram:before{content:"\f7da"}.fa-transgender-alt:before,.fa-transgender:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-arrow-up:before,.fa-trash-restore:before{content:"\f829"}.fa-trash-alt:before,.fa-trash-can:before{content:"\f2ed"}.fa-trash-can-arrow-up:before,.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-exclamation-triangle:before,.fa-triangle-exclamation:before,.fa-warning:before{content:"\f071"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-shipping-fast:before,.fa-truck-fast:before{content:"\f48b"}.fa-ambulance:before,.fa-truck-medical:before{content:"\f0f9"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-truck-loading:before,.fa-truck-ramp-box:before{content:"\f4de"}.fa-teletype:before,.fa-tty:before{content:"\f1e4"}.fa-try:before,.fa-turkish-lira-sign:before,.fa-turkish-lira:before{content:"\e2bb"}.fa-level-down-alt:before,.fa-turn-down:before{content:"\f3be"}.fa-level-up-alt:before,.fa-turn-up:before{content:"\f3bf"}.fa-television:before,.fa-tv-alt:before,.fa-tv:before{content:"\f26c"}.fa-u:before{content:"\55"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-universal-access:before{content:"\f29a"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before,.fa-unlock-keyhole:before{content:"\f13e"}.fa-arrows-alt-v:before,.fa-up-down:before{content:"\f338"}.fa-arrows-alt:before,.fa-up-down-left-right:before{content:"\f0b2"}.fa-long-arrow-alt-up:before,.fa-up-long:before{content:"\f30c"}.fa-expand-alt:before,.fa-up-right-and-down-left-from-center:before{content:"\f424"}.fa-external-link-alt:before,.fa-up-right-from-square:before{content:"\f35d"}.fa-upload:before{content:"\f093"}.fa-user:before{content:"\f007"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-clock:before{content:"\f4fd"}.fa-user-doctor:before,.fa-user-md:before{content:"\f0f0"}.fa-user-cog:before,.fa-user-gear:before{content:"\f4fe"}.fa-user-graduate:before{content:"\f501"}.fa-user-friends:before,.fa-user-group:before{content:"\f500"}.fa-user-injured:before{content:"\f728"}.fa-user-alt:before,.fa-user-large:before{content:"\f406"}.fa-user-alt-slash:before,.fa-user-large-slash:before{content:"\f4fa"}.fa-user-lock:before{content:"\f502"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-edit:before,.fa-user-pen:before{content:"\f4ff"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before,.fa-user-xmark:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before,.fa-users-gear:before{content:"\f509"}.fa-users-slash:before{content:"\e073"}.fa-cutlery:before,.fa-utensils:before{content:"\f2e7"}.fa-v:before{content:"\56"}.fa-shuttle-van:before,.fa-van-shuttle:before{content:"\f5b6"}.fa-vault:before{content:"\e2c5"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-vest:before{content:"\e085"}.fa-vest-patches:before{content:"\e086"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-video-camera:before,.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-virus:before{content:"\e074"}.fa-virus-covid:before{content:"\e4a8"}.fa-virus-covid-slash:before{content:"\e4a9"}.fa-virus-slash:before{content:"\e075"}.fa-viruses:before{content:"\e076"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before,.fa-volleyball:before{content:"\f45f"}.fa-volume-high:before,.fa-volume-up:before{content:"\f028"}.fa-volume-down:before,.fa-volume-low:before{content:"\f027"}.fa-volume-off:before{content:"\f026"}.fa-volume-mute:before,.fa-volume-times:before,.fa-volume-xmark:before{content:"\f6a9"}.fa-vr-cardboard:before{content:"\f729"}.fa-w:before{content:"\57"}.fa-wallet:before{content:"\f555"}.fa-magic:before,.fa-wand-magic:before{content:"\f0d0"}.fa-magic-wand-sparkles:before,.fa-wand-magic-sparkles:before{content:"\e2ca"}.fa-wand-sparkles:before{content:"\f72b"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-ladder-water:before,.fa-swimming-pool:before,.fa-water-ladder:before{content:"\f5c5"}.fa-wave-square:before{content:"\f83e"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weight-scale:before,.fa-weight:before{content:"\f496"}.fa-wheelchair:before{content:"\f193"}.fa-glass-whiskey:before,.fa-whiskey-glass:before{content:"\f7a0"}.fa-wifi-3:before,.fa-wifi-strong:before,.fa-wifi:before{content:"\f1eb"}.fa-wind:before{content:"\f72e"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before,.fa-wine-glass-empty:before{content:"\f5ce"}.fa-krw:before,.fa-won-sign:before,.fa-won:before{content:"\f159"}.fa-wrench:before{content:"\f0ad"}.fa-x:before{content:"\58"}.fa-x-ray:before{content:"\f497"}.fa-close:before,.fa-multiply:before,.fa-remove:before,.fa-times:before,.fa-xmark:before{content:"\f00d"}.fa-y:before{content:"\59"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen-sign:before,.fa-yen:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-z:before{content:"\5a"}.fa-sr-only,.fa-sr-only-focusable:not(:focus),.sr-only,.sr-only-focusable:not(:focus){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0} \ No newline at end of file diff --git a/resources/fonts/roboto.css b/resources/fonts/roboto.css deleted file mode 100644 index 52ba4da3..00000000 --- a/resources/fonts/roboto.css +++ /dev/null @@ -1,35 +0,0 @@ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: url('./Roboto-Bold.woff2') format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: url('./Roboto-Medium.woff2') format('woff2'); -} - - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: url('./Roboto-Regular.woff2') format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 100; - src: url('./Roboto-Light.woff2') format('woff2'); -} - -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 500; - src: url('./roboto-mono.woff') format('woff'); -} diff --git a/resources/images/ardour-osc.png b/resources/images/ardour-osc.png new file mode 100644 index 00000000..08643ca2 Binary files /dev/null and b/resources/images/ardour-osc.png differ diff --git a/resources/images/icons-bolt.svg b/resources/images/icons-bolt.svg new file mode 100644 index 00000000..68c34346 --- /dev/null +++ b/resources/images/icons-bolt.svg @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/resources/images/logo-nobadge.png b/resources/images/logo-nobadge.png new file mode 100644 index 00000000..d0fa5ef9 Binary files /dev/null and b/resources/images/logo-nobadge.png differ diff --git a/resources/images/logo-nobadge.svg b/resources/images/logo-nobadge.svg new file mode 100644 index 00000000..9824cd48 --- /dev/null +++ b/resources/images/logo-nobadge.svg @@ -0,0 +1,86 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/resources/images/logo.icns b/resources/images/logo.icns index 64e718c5..df6d5521 100644 Binary files a/resources/images/logo.icns and b/resources/images/logo.icns differ diff --git a/resources/images/logo.ico b/resources/images/logo.ico index 69fab291..12d3e507 100644 Binary files a/resources/images/logo.ico and b/resources/images/logo.ico differ diff --git a/resources/images/logo.png b/resources/images/logo.png index d14a7074..f16ee0b7 100644 Binary files a/resources/images/logo.png and b/resources/images/logo.png differ diff --git a/resources/images/logo.sh b/resources/images/logo.sh index ea91d019..491d3e4d 100644 --- a/resources/images/logo.sh +++ b/resources/images/logo.sh @@ -1,4 +1,2 @@ -convert logo.png -define icon:auto-resize="256,128,96,64,48,32,16" logo.ico -convert logo.png -resize 128x128 logo-mac.png -png2icns logo.icns logo-mac.png -rm logo-mac.png +png2icns logo.icns logo.png +icotool -c logo.png -o logo.ico diff --git a/resources/images/logo.svg b/resources/images/logo.svg index 619bc9bb..f80bb8cc 100644 --- a/resources/images/logo.svg +++ b/resources/images/logo.svg @@ -1,24 +1,22 @@ + + - + width="191.29887" + height="191.29887" + viewBox="0 0 191.29887 191.29887" + sodipodi:docname="logo-2.svg" + inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"> @@ -27,72 +25,81 @@ image/svg+xml - + + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1024" + inkscape:window-height="732" + id="namedview871" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="1.0826988" + inkscape:cx="41.558745" + inkscape:cy="54.862386" + inkscape:window-x="0" + inkscape:window-y="36" + inkscape:window-maximized="0" + inkscape:current-layer="layer2" + showguides="true" + inkscape:pagecheckerboard="true" /> + inkscape:label="Layer 2" + style="display:inline" + transform="translate(-8.257576,-8.257576)"> - - + cx="103.90701" + id="circle933" + style="display:inline;opacity:1;fill:#313f55;fill-opacity:1;stroke:none;stroke-width:6.05208206;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="opacity:0.25;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#52a8ff;stroke-width:9.8682642;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path1248" + cx="103.94808" + cy="103.94808" + r="71.093147" /> + + style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#52a8ff;stroke-width:9.8682642;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:3.94730568;stroke-opacity:1" + d="m 103.94708,32.512665 a 71.434158,71.434158 0 0 0 -71.434415,71.434415 71.434158,71.434158 0 0 0 21.03688,50.55944 C 87.639333,120.45 128.86768,79.135788 154.45512,53.493007 A 71.434158,71.434158 0 0 0 103.94708,32.512665 Z" + id="circle4863" + inkscape:connector-curvature="0" /> + + + diff --git a/resources/images/logo_discourse.png b/resources/images/logo_discourse.png index 74ed8c44..38997ad4 100644 Binary files a/resources/images/logo_discourse.png and b/resources/images/logo_discourse.png differ diff --git a/resources/images/logo_discourse.svg b/resources/images/logo_discourse.svg deleted file mode 100644 index 7d30ac1d..00000000 --- a/resources/images/logo_discourse.svg +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - - Open Stage Control - - - - - - diff --git a/resources/images/logo_discourse_black.png b/resources/images/logo_discourse_black.png new file mode 100644 index 00000000..884a3de0 Binary files /dev/null and b/resources/images/logo_discourse_black.png differ diff --git a/resources/images/logo_nobadge.png b/resources/images/logo_nobadge.png deleted file mode 100644 index cb1406ed..00000000 Binary files a/resources/images/logo_nobadge.png and /dev/null differ diff --git a/resources/images/logo_nobadge.svg b/resources/images/logo_nobadge.svg deleted file mode 100644 index 9e163b2f..00000000 --- a/resources/images/logo_nobadge.svg +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/resources/images/logo_tray.png b/resources/images/logo_tray.png deleted file mode 100644 index d6670a2a..00000000 Binary files a/resources/images/logo_tray.png and /dev/null differ diff --git a/resources/images/logo_tray@x2.png b/resources/images/logo_tray@x2.png deleted file mode 100644 index c3c4f0c6..00000000 Binary files a/resources/images/logo_tray@x2.png and /dev/null differ diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index e6599ab8..f3e987d9 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -1,71 +1,48 @@ site_name: Open Stage Control repo_name: open-stage-control -repo_url: https://framagit.org/jean-emmanuel/open-stage-control +repo_url: https://github.com/jean-emmanuel/open-stage-control edit_uri: tree/master/resources/docs/ -copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" +copyright: "Open Stage Control is an AMMD software licensed under the GNU/GPLv3 License" site_description: "Libre and modular OSC / MIDI controller" -site_dir: '../app/docs/' -latest_release: 1.31.2 theme: - name: 'material' - custom_dir: 'overrides' - features: - - navigation.tabs - - navigation.instant - palette: - primary: 'Indigo' - accent: 'Indigo' - logo: 'img/logo_nobadge.png' - favicon: 'img/logo_nobadge.png' - include_search_page: false - search_index_only: true + name: null + custom_dir: 'theme/' + favicon: 'img/logo-nobadge.png?1' + include_search_page: true + static_templates: + - 404.html -extra_css: - - 'extra/styles.css' -extra_javascript: - - 'extra/scripts.js' + +extra: + screenshot: img/ardour-osc.png + links: + - + title: Download + url: https://github.com/jean-emmanuel/open-stage-control/releases + primary: true + - + title: Try online (requires chromium 50+) + url : http://openstagecontrol.herokuapp.com nav: - - Home: index.md - - Download: - - download.md - - Documentation: - - Getting started: - - docs/getting-started/introduction.md - - docs/getting-started/server-configuration.md - - docs/getting-started/running-from-sources.md - - docs/getting-started/running-with-node.md - - Tutorials: - - docs/tutorials/first-steps.md - - docs/tutorials/change-property-with-osc.md - - User interface: - - docs/user-interface/launcher.md - - docs/user-interface/client.md - - docs/user-interface/editor.md - - Widgets: - - docs/widgets/general-mechanics.md - - docs/widgets/properties-reference.md - - docs/widgets/advanced-syntaxes.md - - docs/widgets/scripting.md - - docs/widgets/fragments.md - - docs/widgets/canvas.md - - MIDI: - - MIDI configuration: docs/midi/midi-configuration.md - - MIDI messages: docs/midi/midi-messages.md - - Custom module: - - docs/custom-module/custom-module.md - - docs/custom-module/managing-big-modules.md - - docs/custom-module/examples.md - - Customization: - - docs/customization/themes.md - - docs/customization/css-tips.md - - Client options: docs/client-options.md + - Open Stage Control: index.md + - Docs: docs.md + - Docs: + - Getting started: docs/getting-started.md + - User interface: docs/interface.md + - Editing sessions: docs/editing-sessions.md + - Widgets reference: docs/widgets-reference.md + - Advanced property syntax: docs/advanced-property-syntax.md + - CSS Tips: docs/css-tips.md + - Theming: docs/theming.md + - URL options: docs/url-options.md - Remote control: docs/remote-control.md + - Custom module: docs/custom-module.md + - Midi: docs/midi.md + - Examples: docs/examples.md - Credits: docs/credits.md - - Changelog: docs/changelog.md - - Community: - - 'Community forums': 'https://openstagecontrol.discourse.group' + - Support: support.md markdown_extensions: - markdown.extensions.extra @@ -90,11 +67,6 @@ markdown_extensions: - pymdownx.tasklist: custom_checkbox: true - pymdownx.tilde - - pymdownx.keys - - pymdownx.tabbed: - alternate_style: true - - pymdownx.details - plugins: - - macros + - search diff --git a/resources/overrides/404.html b/resources/overrides/404.html deleted file mode 100644 index 158df66d..00000000 --- a/resources/overrides/404.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "main.html" %} - -{% block content %} - -

Woops, nothing here !

- -

(404 error)

- - - - -{% endblock %} diff --git a/resources/overrides/home.html b/resources/overrides/home.html deleted file mode 100644 index 25fbe792..00000000 --- a/resources/overrides/home.html +++ /dev/null @@ -1,191 +0,0 @@ - - -{% extends "main.html" %} - - -{% block tabs %} - {{ super() }} - - - - - -
-
-
- - - - - -
-

Open Stage Control

-

{{ config.site_description }}

- - Download - - - Get started - -
-
-
-
-{% endblock %} - - -{% block content %}{% endblock %} - - -{% block footer %}{% endblock %} diff --git a/resources/overrides/main.html b/resources/overrides/main.html deleted file mode 100644 index ddd35433..00000000 --- a/resources/overrides/main.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} - -{% block fonts %} - - - - - -{% endblock %} diff --git a/resources/package.json b/resources/package.json new file mode 100644 index 00000000..51e6a1df --- /dev/null +++ b/resources/package.json @@ -0,0 +1,17 @@ +{ + "name": "open-stage-control-docs", + "version": "1.0.0", + "description": "```bash $ sudo apt-get install python python-pip # python package manager $ sudo pip install mkdocs # docs site builder $ sudo pip install mkdocs-material # theme", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "build": "node scripts/build-css && mkdocs build" + }, + "author": "", + "license": "ISC", + "dependencies": { + "spectre.css": "^0.5.8" + } +} diff --git a/resources/scripts/build-css.js b/resources/scripts/build-css.js new file mode 100644 index 00000000..1abe0a5f --- /dev/null +++ b/resources/scripts/build-css.js @@ -0,0 +1,12 @@ +var sass = require('node-sass'), + path = require('path'), + fs = require('fs') + +var result = sass.renderSync({ + file: path.resolve(__dirname + '/../src/scss/styles.scss'), + outFile: path.resolve(__dirname + '/../theme/styles.css'), + outputStyle: 'compressed', + sourceMap: false +}) + +fs.writeFileSync(path.resolve(__dirname + '/../theme/styles.css'), result.css) diff --git a/resources/site/.htaccess b/resources/site/.htaccess new file mode 100644 index 00000000..46950d80 --- /dev/null +++ b/resources/site/.htaccess @@ -0,0 +1,14 @@ +RewriteEngine On +RewriteBase / + +RewriteRule ^extras/(.*)$ docs/$1 [QSA,L,R=301] +RewriteRule ^user-guide/(.*)$ docs/$1 [QSA,L,R=301] +RewriteRule ^docs/$ docs/getting-started [QSA,L] + +RewriteCond %{HTTPS} !on +RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301] + +RewriteCond %{HTTP_HOST} ^osc.ammd.net +RewriteRule ^(.*)$ https://openstagecontrol.ammd.net/%{REQUEST_URI} [L,R=301] + +ErrorDocument 404 /404.html diff --git a/resources/src/scss/admonition.scss b/resources/src/scss/admonition.scss new file mode 100644 index 00000000..ba08edf4 --- /dev/null +++ b/resources/src/scss/admonition.scss @@ -0,0 +1,57 @@ +div.admonition { + font-size: 0.9em; + border: 1px solid #cccccc; + background-color: #fafafa; + padding: 0; + border-radius: 3px; + margin: 0 0 1.2rem; +} + +div.admonition p { + margin: 0.5em 1em 0.5em 1em; + padding: 0; +} + +div.admonition li p { + margin-left: 0; +} + +div.admonition pre, div.warning pre { + margin: 0; +} + +div.admonition p.admonition-title { + margin: 0; + padding: 0.5em; + color: white; + font-weight: bold; + background-color: #165e83; +} + +div.danger { border: 1px solid $error-color;} +div.error { border: 1px solid $error-color;} +div.warning { border: 1px solid $warning-color;} +div.caution { border: 1px solid $warning-color;} +div.attention { border: 1px solid $warning-color;} +div.important { border: 1px solid #f8b862;} +div.note { border: 1px solid #f8b862;} +div.hint { border: 1px solid #7ebea5;} +div.tip { border: 1px solid #7ebea5;} + +div.danger p.admonition-title, div.error p.admonition-title { + background-color: $error-color; +} + +div.caution p.admonition-title, +div.warning p.admonition-title, +div.attention p.admonition-title { + background-color: $warning-color; +} + +div.note p.admonition-title, div.important p.admonition-title { + background-color: #f8b862; +} + +div.hint p.admonition-title, div.tip p.admonition-title { + background-color: #7ebea5; +} diff --git a/resources/src/scss/codehilite.scss b/resources/src/scss/codehilite.scss new file mode 100644 index 00000000..1f4925f6 --- /dev/null +++ b/resources/src/scss/codehilite.scss @@ -0,0 +1,315 @@ +/* https://raw.githubusercontent.com/simonsmith/syntax.css */ + +.codehilite { + background: #ffffff; +} + +.codehilite .c { + color: #999988; + font-style: italic +} + +/* Comment */ +.codehilite .err { + color: #a61717; + background-color: #e3d2d2 +} + +/* Error */ +.codehilite .k { + font-weight: bold +} + +/* Keyword */ +.codehilite .o { + font-weight: bold +} + +/* Operator */ +.codehilite .cm { + color: #999988; + font-style: italic +} + +/* Comment.Multiline */ +.codehilite .cp { + color: #999999; + font-weight: bold +} + +/* Comment.Preproc */ +.codehilite .c1 { + color: #999988; + font-style: italic +} + +/* Comment.Single */ +.codehilite .cs { + color: #999999; + font-weight: bold; + font-style: italic +} + +/* Comment.Special */ +.codehilite .gd { + color: #000000; + background-color: #ffdddd +} + +/* Generic.Deleted */ +.codehilite .gd .x { + color: #000000; + background-color: #ffaaaa +} + +/* Generic.Deleted.Specific */ +.codehilite .ge { + font-style: italic +} + +/* Generic.Emph */ +.codehilite .gr { + color: #aa0000 +} + +/* Generic.Error */ +.codehilite .gh { + color: #999999 +} + +/* Generic.Heading */ +.codehilite .gi { + color: #000000; + background-color: #ddffdd +} + +/* Generic.Inserted */ +.codehilite .gi .x { + color: #000000; + background-color: #aaffaa +} + +/* Generic.Inserted.Specific */ +.codehilite .go { + color: #888888 +} + +/* Generic.Output */ +.codehilite .gp { + color: #555555 +} + +/* Generic.Prompt */ +.codehilite .gs { + font-weight: bold +} + +/* Generic.Strong */ +.codehilite .gu { + color: #aaaaaa +} + +/* Generic.Subheading */ +.codehilite .gt { + color: #aa0000 +} + +/* Generic.Traceback */ +.codehilite .kc { + font-weight: bold +} + +/* Keyword.Constant */ +.codehilite .kd { + font-weight: bold; + +} + +/* Keyword.Declaration */ +.codehilite .kp { + font-weight: bold +} + +/* Keyword.Pseudo */ +.codehilite .kr { + font-weight: bold +} + +/* Keyword.Reserved */ +.codehilite .kt { + color: #445588; + font-weight: bold +} + +/* Keyword.Type */ +.codehilite .m { + color: #009999 +} + +/* Literal.Number */ +.codehilite .s { + color: #d14 +} + +/* Literal.String */ +.codehilite .na { + color: #008080 +} + +/* Name.Attribute */ +.codehilite .nb { + color: #0086B3 +} + +/* Name.Builtin */ +.codehilite .nc { + color: #445588; + font-weight: bold +} + +/* Name.Class */ +.codehilite .no { + color: #008080 +} + +/* Name.Constant */ +.codehilite .ni { + color: #800080 +} + +/* Name.Entity */ +.codehilite .ne { + color: #990000; + font-weight: bold +} + +/* Name.Exception */ +.codehilite .nf { + color: #990000; + font-weight: bold +} + +/* Name.Function */ +.codehilite .nn { + color: #555555 +} + +/* Name.Namespace */ +.codehilite .nt { + color: #000080 +} + +/* Name.Tag */ +.codehilite .nv { + color: #008080 +} + +/* Name.Variable */ +.codehilite .ow { + font-weight: bold +} + +/* Operator.Word */ +.codehilite .w { + color: #bbbbbb +} + +/* Text.Whitespace */ +.codehilite .mf { + color: #009999 +} + +/* Literal.Number.Float */ +.codehilite .mh { + color: #009999 +} + +/* Literal.Number.Hex */ +.codehilite .mi { + color: #009999 +} + +/* Literal.Number.Integer */ +.codehilite .mo { + color: #009999 +} + +/* Literal.Number.Oct */ +.codehilite .sb { + color: #d14 +} + +/* Literal.String.Backtick */ +.codehilite .sc { + color: #d14 +} + +/* Literal.String.Char */ +.codehilite .sd { + color: #d14 +} + +/* Literal.String.Doc */ +.codehilite .s2 { + color: #d14 +} + +/* Literal.String.Double */ +.codehilite .se { + color: #d14 +} + +/* Literal.String.Escape */ +.codehilite .sh { + color: #d14 +} + +/* Literal.String.Heredoc */ +.codehilite .si { + color: #d14 +} + +/* Literal.String.Interpol */ +.codehilite .sx { + color: #d14 +} + +/* Literal.String.Other */ +.codehilite .sr { + color: #009926 +} + +/* Literal.String.Regex */ +.codehilite .s1 { + color: #d14 +} + +/* Literal.String.Single */ +.codehilite .ss { + color: #990073 +} + +/* Literal.String.Symbol */ +.codehilite .bp { + color: #999999 +} + +/* Name.Builtin.Pseudo */ +.codehilite .vc { + color: #008080 +} + +/* Name.Variable.Class */ +.codehilite .vg { + color: #008080 +} + +/* Name.Variable.Global */ +.codehilite .vi { + color: #008080 +} + +/* Name.Variable.Instance */ +.codehilite .il { + color: #009999 +} diff --git a/resources/src/scss/discourse.scss b/resources/src/scss/discourse.scss new file mode 100644 index 00000000..f4c4a874 --- /dev/null +++ b/resources/src/scss/discourse.scss @@ -0,0 +1,94 @@ + +.wrap { + max-width: 1110px; +} +@media (max-width: 570px){ + .wrap, .full-width { + min-width: 0; + } +} + +.wrap { + margin-right: auto; + margin-left: auto; + padding: 0 8px; +} +.d-header>.wrap { + width: calc(100% - 16px); + height: 100%; + padding: 0; +} + + +.d-header { + left: 0; + height: 4em; + margin-bottom: 15px; + font-family: Helvetica,Arial,sans-serif; + font-size: 15px; + line-height: 1.4; +} + +.d-header { + display: flex; + align-items: center; + width: 100%; + position: fixed; + top: 0; + z-index: 1000; + background-color: $osc-color; + box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25); +} + +.d-header>.wrap .contents { + display: flex; + align-items: center; + height: 100%; +} + +.wrap .contents { + position: relative; +} + +.d-header .title { + display: flex; + align-items: center; + height: 100%; +} + +.d-header .title img { + height: 2.57em; + vertical-align: middle; +} + + +.d-header .header-buttons-panel { + position: relative; + display: flex; + flex: 0 0 auto; + margin-left: auto; + align-items: center; +} +.d-header .header-buttons { + display: flex; + align-items: center; + margin-top: 0.2em; +} + +.d-header .header-buttons a { + padding: 6px 10px; + color: #fff; + font-size: 1.1487em; +} + +.d-header .header-buttons a { + opacity: 0.5; + transition: opacity .25s; + text-decoration: none; +} +.d-header .header-buttons a:hover { + opacity: 0.75; +} +.d-header .header-buttons a.active { + opacity: 1; +} diff --git a/resources/src/scss/mobile.scss b/resources/src/scss/mobile.scss new file mode 100644 index 00000000..fbea2d0c --- /dev/null +++ b/resources/src/scss/mobile.scss @@ -0,0 +1,29 @@ +@media (max-width:840px) { + #mobile-menu { + flex-direction: column; + position: fixed; + align-items: center; + justify-content: center; + top: 4em; + right: 0; + margin: 0; + background: $osc-color; + border-bottom-left-radius: 3px; + box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25); + + > * { + flex:1; + padding: 8px; + display: block; + width: 100%; + text-align: center; + } + input { + text-align: center; + margin: 0; + } + &.show { + display: flex!important; + } + } +} diff --git a/resources/src/scss/styles.scss b/resources/src/scss/styles.scss new file mode 100644 index 00000000..c5d7e5dc --- /dev/null +++ b/resources/src/scss/styles.scss @@ -0,0 +1,289 @@ +$osc-color: #3c4c68; + +$primary-color: rgb(75, 143, 210); +$font-size: 0.6rem; +@import "node_modules/spectre.css/src/spectre"; +@import "node_modules/spectre.css/src/icons"; + +@import "admonition"; +@import "codehilite"; +@import "discourse"; + + +body { + color: #333; + font-family: Roboto,Helvetica,Arial,sans-serif; + font-weight: normal; + background-color: #fff; + overflow-y: scroll; + direction: ltr; +} +h1,h2,h3,h4,h5 { + font-weight: 100; +} +h2 { + font-weight: 400; +} +h4 { + font-size: 1.1rem; +} +h1 + h2 { + // position: relative; + margin-top: 2rem; +} + +pre, code { + font-size: 0.7rem; + font-family: $mono-font-family; +} + +hr { + border: 0; + border-top: 2px solid rgba(black, 0.15); +} + +.dynamic-prop-icon { + width:12px; + height:12px; + background-image: url(img/icon-bolt.svg); + background-size: cover; + display: inline-block; + margin-left: 4px; +} + +#jumbotron { + text-align: center; + position: relative; + padding: 10em 0 8em; + ul { + list-style: none; + margin: 0; + li { + display:inline-block; + margin: 0 2px; + } + } +} +#jumbotron-showcase { + margin: -4em auto 1em; + box-shadow: 0 4px 8px 0 rgba(0,0,0,0.5); + z-index: 1; + border-radius: 3px; + overflow: hidden; + position: relative; + + #jumbotron-img { + display: block; + z-index: 2; + position: relative; + width: 100%; + } + +} + +#jumbotron + #main { + padding-top: 2em; + padding-bottom: 0; +} + +#logo { + flex-shrink: 0; +} + +#main { + padding-top: 6.5em; + padding-bottom: 4em; + display: flex; +} + +.nav .nav li { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.col-left { + width:240px; + flex-shrink: 0; +} +.col-left > ul { + top: 6.5em; + width: 230px; + position: fixed; + overflow-y: auto; + bottom: 0; + padding-left: 2px; + margin: 0; +} +.col-left > ul ul { + line-height: 1 + li { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +} +.col-right { + flex: 1; + min-width: 0; +} + +.codehilite { + background-color: #fafafa; + color: #37474f; + line-height: 1em; + overflow-x: auto; + border-radius: 3px; + margin-bottom: 1.2rem; + padding: 12px; +} + +.codehilite pre { + white-space: pre; + font-feature-settings: "kern"; + font-family: $mono-font-family; + /* font-family: "Roboto Mono","Courier New",Courier,monospace; */ + direction: ltr; + line-height: 1.1; +} + +table { + border: 1px solid #eee; + border-collapse: collapse; + border-spacing: 0; + font-size: 100%; + font: inherit; + margin: 0 0 1.2rem; +} + +table tr:nth-child(2n +1) { + background-color: #f8f8f8; +} + +table td { + padding: 10px; +} +table h4 { + margin: 0; + font-size: 14px; + font-weight: normal; +} + +table th { + font-weight: bold; + background-color: #888; + color: #fff; + vertical-align: top; + text-align: left; + padding: 10px; +} + +code, tt { + padding: 0 5px; + white-space: nowrap; + border: 1px solid #eaeaea; + border-radius: 3px; + background-color: #f8f8f8; + color: #333333; + font-family: $mono-font-family; + } + + +code { + background-color: #fafafa; + padding: 2px!important; +} + +h1,h2,h3,h4,h5 { + code { + vertical-align: middle; + font-size: 70%; + } +} + + + +table code { + white-space: nowrap; +} + +img { + max-width: 100%; +} + +table .thead2 { + background: #ddd!important; + color: #666; + white-space: nowrap; +} + + +.headerlink { + opacity: 0; + position: relative; + margin-left: 4px; +} +:hover > .headerlink { + opacity: 0.5; +} + + +h1:first-child { + margin-top:0; +} + +#mkdocs-search-query { + /* border: 1px solid rgba(255,255,255,.1); */ + border:0; + box-shadow: 0 -2px 10px 0 rgba(0,0,0,0.1) inset; + background:rgba(0,0,0,0.15); + border-radius: 15px; + color: #eee; + outline: none; + padding:3px 12px; + margin-right: 10px; + transition: background-color .25s, color .25s; + &:focus { + background: white; + color:#333; + } +} + +.sp-logo { + display:inline-block; + margin-top:20px; +} + + +.accordion { + background: rgba(black, 0.05); + padding: 8px; + margin-bottom: 1rem; +} +.accordion h4 { + cursor: pointer; +} + +.accordion table { + display: none; +} +.accordion.show table { + display: table; +} +.accordionlink > .headerlink { + opacity: 1!important; + color: $primary-color!important; + text-decoration: none; + display: block; + outline: none; + box-shadow: none; + margin-left: 0; +} +.accordion-description { + opacity: 0.8; +} +.accordion.show .accordion-description { + margin-bottom: 8px; +} + +@import 'mobile'; diff --git a/resources/theme/404.html b/resources/theme/404.html new file mode 100644 index 00000000..8615bbe9 --- /dev/null +++ b/resources/theme/404.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block content %} + +

404

+

Page not found.

+ +{% endblock %} diff --git a/resources/theme/base.html b/resources/theme/base.html new file mode 100644 index 00000000..01234378 --- /dev/null +++ b/resources/theme/base.html @@ -0,0 +1,128 @@ + + + + + + + + + {% if page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }} + + + + + + {% block extrahead %} + {% endblock %} + + +
+
+
+
+ +
+
+ + +
+
+ +
+
+ Home + Docs + Support + Bug Tracker + Community +
+
+
+
+
+ + {% if page.is_homepage %} +
+ +
+

{{ config.site_name }}

+

{{ config.site_description }}

+
+
    + {% for link in config.extra.links %} +
  • {{link.title}}
  • + {% endfor %} +
+
+
+ {% endif %} + +
+ {% if 'docs' in page.url %} + {% set ns = namespace(navigation=[]) %} + {% for nav_item in nav %} + {% if nav_item.children %} + {% set ns.navigation = nav_item %} + {% endif %} + {% endfor %} +
+ +
+ {% endif %} + + +
+ {% if page.is_homepage %} + {% include 'home.html' %} + {% endif %} + + {% block content %} + {{ page.content }} + {% endblock %} +
+
+ + + + + + + + diff --git a/resources/theme/fonts/Roboto-Light-webfont.woff b/resources/theme/fonts/Roboto-Light-webfont.woff new file mode 100644 index 00000000..8f5552d8 Binary files /dev/null and b/resources/theme/fonts/Roboto-Light-webfont.woff differ diff --git a/resources/theme/fonts/Roboto-Regular-webfont.woff b/resources/theme/fonts/Roboto-Regular-webfont.woff new file mode 100644 index 00000000..8aa07d73 Binary files /dev/null and b/resources/theme/fonts/Roboto-Regular-webfont.woff differ diff --git a/resources/theme/fonts/roboto.css b/resources/theme/fonts/roboto.css new file mode 100644 index 00000000..5f19f8f4 --- /dev/null +++ b/resources/theme/fonts/roboto.css @@ -0,0 +1,16 @@ +@font-face { + font-family: Roboto; + src: url('Roboto-Regular-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; + +} + + +@font-face { + font-family: Roboto; + src: url('Roboto-Light-webfont.woff') format('woff'); + font-weight: 100; + font-style: normal; + +} diff --git a/resources/theme/home.html b/resources/theme/home.html new file mode 100644 index 00000000..935c6916 --- /dev/null +++ b/resources/theme/home.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/resources/theme/main.html b/resources/theme/main.html new file mode 100644 index 00000000..94d9808c --- /dev/null +++ b/resources/theme/main.html @@ -0,0 +1 @@ +{% extends "base.html" %} diff --git a/resources/theme/scripts.js b/resources/theme/scripts.js new file mode 100644 index 00000000..36846f73 --- /dev/null +++ b/resources/theme/scripts.js @@ -0,0 +1,43 @@ +function getOffset(element) { + var offset = 0 + if (element) { + do { + if (!isNaN(element.offsetTop)) { + offset += element.offsetTop - element.scrollTop + } + } while ((element = element.offsetParent)) + } + + return offset +} + +var navHeight = 80 +function offsetScroll(){ + if (document.location.hash) { + var el = document.getElementById(document.location.hash.substring(1)) + if (el) document.body.scrollTop = document.documentElement.scrollTop = getOffset(el) - navHeight + } +} +window.addEventListener('hashchange', offsetScroll) +setTimeout(offsetScroll, 250) + + +var mobileToggle = document.getElementById('mobile-toggle'), + mobileMenu = document.getElementById('mobile-menu'), + show = false + +function toggleMenu(s){ + show = s === undefined ? !show : s + mobileToggle.classList.toggle('show', show) + mobileMenu.classList.toggle('show', show) +} + +mobileToggle.addEventListener('click', function(){ + toggleMenu() +}) + +document.addEventListener('click', function(e){ + if (!mobileToggle.parentNode.contains(e.target)) { + toggleMenu(false) + } +}) diff --git a/resources/theme/search.html b/resources/theme/search.html new file mode 100644 index 00000000..42d98728 --- /dev/null +++ b/resources/theme/search.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block extrahead %} + +{% endblock %} + +{% block content %} + + + +
+
+ +{% endblock %} diff --git a/scripts/build-client.js b/scripts/build-client.js new file mode 100644 index 00000000..30d5ab43 --- /dev/null +++ b/scripts/build-client.js @@ -0,0 +1,98 @@ +var build = require('./build'), + path = require('path'), + babelify = require('babelify'), + nanohtml = require('nanohtml'), + watch = process.argv.includes('--watch'), + prod = process.argv.includes('--prod'), + through = require('through'), + minimatch = require('minimatch').Minimatch + + +var ignores = ['**/*.min.js', '**/jquery.ui.js', 'gyronorm.complete.min.js'], + transformWrapper = function(transform){ + return function(file, opts){ + if (ignores.some(pattern => minimatch(pattern).match(file))) { + return through() + } else { + return transform(file, opts) + } + } + } + +var transforms = [ + [transformWrapper(nanohtml)], + [transformWrapper(babelify)] +] + +if (prod) { + console.warn('\033[36m=> Building minified client bundle, this may take a while...\033[0m') + transforms.push([transformWrapper(require('uglifyify')), {global: true}]) +} + +var bundle = build({ + input: '../src/client/index.js', + output: '../app/client/open-stage-control-client.js', + options: { + debug: true, + insertGlobals: false, + noParse: ['**/*.min.js', '**/jquery.ui.js'], + cache: {}, + packageCache: {} + }, + plugins: watch ? [require('watchify')] : [], + transforms: transforms +}) + +if (watch) { + + var ansiHTML = require('ansi-html'), + WS = require('../node_modules/ws') + + function send(msg, data){ + var ipc = new WS('ws://127.0.0.1:8080/dev') + ipc.on('error', ()=>{}) + ipc.on('open', ()=>{ + ipc.send(JSON.stringify([msg, data])) + ipc.close() + }) + } + + bundle.b.on('update', hotBundle) + bundle.b.on('log', function(msg) {console.warn('\x1b[36m%s\x1b[0m', msg)}) + + function hotBundle() { + + var output = bundle() + + output.on('end', (err)=> { + console.log('Build successful reloading...') + send('reload') + }) + + output.on('error', (err)=> { + + console.error(err.stack) + send('errorPopup', + '
' + + ansiHTML( + err.stack + .replace(/^ at .*/gm, '') // remove useless stack + .replace(new RegExp(path.resolve(__dirname + '/..'), 'g'),'.') // shorten file path + .trim() + .replace('\n','\n\n') // add 1 new line after 1st line + ) + + '
' + ) + + }) + + } + + + hotBundle() + +} else { + + bundle() + +} diff --git a/scripts/build-css.js b/scripts/build-css.js index 1884a440..c2fe2d57 100644 --- a/scripts/build-css.js +++ b/scripts/build-css.js @@ -1,19 +1,16 @@ -var sass = require('sass'), +var sass = require('node-sass'), path = require('path'), fs = require('fs') var indir = path.resolve(__dirname + '/../src/scss/'), outdir= path.resolve(__dirname + '/../app/assets/') -fs.mkdirSync(outdir + '/themes/', {recursive: true}) - fs.readdirSync(indir + '/themes/').forEach(file => { if (file.includes('.scss') && file !== 'default.scss') { let result = sass.renderSync({ file: indir + '/themes/' + file, - outputStyle: 'compressed', - silenceDeprecations: ['mixed-decls', 'slash-div', 'import', 'legacy-js-api'] + outputStyle: 'compressed' }) fs.writeFileSync(outdir + '/themes/' + file.split('/').pop().replace('scss', 'css'), result.css) @@ -25,8 +22,7 @@ var result = sass.renderSync({ file: indir + '/index.scss', outFile: outdir + '/open-stage-control.css', outputStyle: 'compressed', - sourceMap: true, - silenceDeprecations: ['mixed-decls', 'slash-div', 'import', 'legacy-js-api'] + sourceMap: true }) fs.writeFileSync(outdir + '/open-stage-control.css', result.css) @@ -37,7 +33,7 @@ if (process.argv.includes('--reload')) { var WS = require('../node_modules/ws') - var ipc = new WS('ws://127.0.0.1:8080/dev/') + var ipc = new WS('ws://127.0.0.1:8080/dev') ipc.on('error', ()=>{}) ipc.on('open', ()=>{ diff --git a/scripts/build-launcher.js b/scripts/build-launcher.js new file mode 100644 index 00000000..a1f756d3 --- /dev/null +++ b/scripts/build-launcher.js @@ -0,0 +1,13 @@ +var build = require('./build') + +build({ + input: '../src/launcher/index.js', + output: '../app/launcher/open-stage-control-launcher.js', + options: { + debug: true, + ignoreMissing: false, + detectGlobals: false, + bare: true, + noParse: ['**/mathjs/dist/math.min.js'] + } +})() diff --git a/scripts/build-server.js b/scripts/build-server.js new file mode 100644 index 00000000..5b2732fe --- /dev/null +++ b/scripts/build-server.js @@ -0,0 +1,40 @@ +var build = require('./build'), + babelify = require('babelify') + +build({ + input: '../src/server/index.js', + output: '../app/server/open-stage-control-server.js', + options: { + commonDir: false, + ignoreMissing: true, + debug: true, + builtins: false, + commondir: false, + insertGlobalVars: { + __filename: true, + __dirname: true, + process: true, + electron: true, + global: true + }, + browserField: false, + }, + ignore: 'serialport', + exclude: 'electron', + transforms: [ + [babelify, { + 'presets': [ + ['@babel/env', { + 'targets': { + 'node': '6', + }, + 'useBuiltIns': 'usage', + 'corejs': 3 + }] + ], + 'plugins': ['@babel/plugin-proposal-object-rest-spread'], + 'global': true, + 'only': ['**/ws/', '**/yargs/', '**/find-up/', '**/locate-path', '**/p-locate'] + }] + ] +})() diff --git a/scripts/build-widgets-reference.js b/scripts/build-widgets-reference.js new file mode 100644 index 00000000..346d2cf6 --- /dev/null +++ b/scripts/build-widgets-reference.js @@ -0,0 +1,138 @@ +require('./client-shim') + +// Here we go + +var widgets = require('../src/client/app/widgets'), + baseClass = require('../src/client/app/widgets/common/widget'), + base = baseClass.defaults(), + doc = [] + + +doc.push(` + + # Widget reference + +
+ + +
Properties shared by all widgets
+ + | property | type |default | description | + | --- | --- | --- | --- |` +) + +for (var propName in base) { + + var prop = base[propName], + permalink = propName + + if (propName[0] === '_' && propName !== '_props') { + doc.push(` + |

${prop}#

||||` + ) + } + + if (propName === '_props' || propName[0] === '_') continue + + var help = Array.isArray(prop.help) ? prop.help.join('

').replace(/-/g, '-') : prop.help || '', + dynamic = baseClass.dynamicProps.includes(propName) ? '' : '' + + + doc.push(` + |

${propName}${dynamic}#

| \`${prop.type.replace(/\|/g,'\`|
\`')}\` | ${(JSON.stringify(prop.value, null, ' ') || '').replace(/\n/g,'
')}
| ${help} |` + ) + +} + +doc.push('
') + + +for (var k in widgets.categories) { + var category = widgets.categories[k] + if (k == 'Containers') { + category.push('root') + category.push('tab') + } + + doc.push(` + + ## ${k}` + ) + + for (var kk in category) { + var type = category[kk], + defaults = widgets.widgets[type].defaults(), + description = widgets.widgets[type].description(), + separator = false + + + doc.push(` + + +
+ + +
${description}
+ + | property | type |default | description | + | --- | --- | --- | --- |` + ) + + for (var propName in defaults) { + + var prop = defaults[propName], + permalink = type + '_' + propName + + if (propName[0] === '_' && propName !== '_props') { + if (separator) doc.pop() + doc.push(` + |

${prop}#

||||` + ) + separator = true + } + + if (propName === '_props' || propName[0] === '_' || JSON.stringify(prop) == JSON.stringify(base[propName])) continue + + var help = Array.isArray(prop.help) ? prop.help.join('

').replace(/-/g, '-') : prop.help || '', + dynamic = widgets.widgets[type].dynamicProps.includes(propName) ? '' : '' + + doc.push(` + |

${propName}${dynamic}#

| \`${prop.type.replace(/\|/g,'\`|
\`')}\` | ${(JSON.stringify(prop.value, null, ' ') || '').replace(/\n/g,'
').replace('{','\\{')}
| ${help} |` + ) + separator = false + } + + if (separator) doc.pop() + + doc.push('
\n\n') + + } +} + +doc.push(`\n\n + +`) + +console.log(doc.join('').replace(/^ +/gm,'')) diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 00000000..80de408b --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,49 @@ +var browserify = require('browserify'), + exorcist = require('exorcist'), + licensify = require('licensify'), + fs = require('fs'), + path = require('path') + + +module.exports = (opt) => { + + var {input, output, options, ignore, exclude, transforms, plugins} = opt, + inputPath = path.resolve(__dirname + '/' + input), + outputPath = path.resolve(__dirname + '/' + output), + b + + if (!plugins) plugins = [] + if (!plugins.includes(licensify)) plugins.push(licensify) + + b = browserify(inputPath, options) + + if (ignore) b.ignore(ignore) + if (exclude) b.exclude(exclude) + + for (var plugin of plugins) { + b.plugin(plugin) + } + + if (transforms) { + for (var transform of transforms) { + var [t, opts] = transform + b.transform(t, opts) + } + } + + function bundle() { + + var output = b.bundle() + + var toWrite = output.pipe(exorcist(outputPath + '.map')) + toWrite.pipe(fs.createWriteStream(outputPath)) + + return output + + } + + bundle.b = b + + return bundle + +} diff --git a/src/docs/client-shim.mjs b/scripts/client-shim.js similarity index 54% rename from src/docs/client-shim.mjs rename to scripts/client-shim.js index dc87e8ca..a74e5786 100644 --- a/src/docs/client-shim.mjs +++ b/scripts/client-shim.js @@ -1,12 +1,10 @@ // Dirty browser window shim -import * as DOM from '../client/dom.mjs' -// eslint-disable-next-line no-global-assign document = { createElement: x=>({ ownerDocument: document, - addEventListener: ()=>{}, - style: {setProperty: ()=>{}}, + style: {}, + contentWindow: {}, nodeName: '', childNodes: [], setAttribute: ()=>{}, @@ -14,16 +12,14 @@ document = { lastChild: {}, toString: ()=>' ', removeChild: ()=>{}, - getPropertyValue: ()=>{}, contentWindow: { document: { open: ()=>{}, close: ()=>{}, write: ()=>{}, } - }, + } }), - getElementById: ()=>document.createElement(), createTextNode: x=>({ nodeValue: '', nodeName: '', @@ -49,44 +45,31 @@ document = { appendChild: ()=>{}, addEventListener: ()=>{} }, - location: {search: ''}, -} -document.documentElement = document.createElement() - -// eslint-disable-next-line no-global-assign -window = { - screen: {width: 800, height: 600}, - addEventListener: ()=>{}, - location: {search: ''}, - Image: Function, - document: document, - NodeList: Array, - WebSocket: Object, - localStorage: { - getItem(){return null} - }, - sessionStorage: { - getItem(){return null}, - setItem(){}, - }, - getComputedStyle: ()=>document.createElement(), - MutationObserver: class MutationObserver{}, - ELECTRON_NOGPU: false, - CANVAS_FRAMERATE: 1, - LANG: 'en', - ENV: {id: ''}, - IP: '', - DOM -} - -if (!global.navigator) { - // defined as getter since node 22 - window.navigator = { - platform:'', - userAgent: '' + location: {}, + documentElement: { + appendChild: ()=>{}, + removeChild: ()=>{} } } +window = { + addEventListener: ()=>{}, + location: {}, + document: document, + navigator: { + platform:'' + }, + NodeList: Array, + WebSocket: Object +} + Object.assign(global, window) -console.debug = ()=>{} +// Required globals + +DOM = require('../src/client/app/dom') +DOM.get = x=>[{addEventListener:()=>{}}] +DOM.init() +ELECTRON_NOGPU = false +CANVAS_FRAMERATE = 1 +LANG = 'en' diff --git a/scripts/client.plugin-watch.js b/scripts/client.plugin-watch.js deleted file mode 100644 index 41204c80..00000000 --- a/scripts/client.plugin-watch.js +++ /dev/null @@ -1,40 +0,0 @@ -var ansiHTML = require('ansi-html'), - WS = require('../node_modules/ws'), - path = require('path') - -function send(msg, data){ - var ipc = new WS('ws://127.0.0.1:8080/dev/') - ipc.on('error', ()=>{}) - ipc.on('open', ()=>{ - ipc.send(JSON.stringify([msg, data])) - ipc.close() - }) -} - -module.exports = function watchChangePlugin() { - - var reloadClient = false - - return { - - buildEnd(error) { - - if (error) { - var msg = `
- ${error.message.replace(path.resolve(__dirname + '/..'),'')} at line ${error.loc.line}\n${error.frame} -
` - send('errorPopup', msg.trim()) - reloadClient = false - } else { - reloadClient = true - } - - }, - - writeBundle() { - if (reloadClient) { - send('reload') - } - } - } -} diff --git a/scripts/client.rollup.config.js b/scripts/client.rollup.config.js deleted file mode 100644 index c23b26ae..00000000 --- a/scripts/client.rollup.config.js +++ /dev/null @@ -1,98 +0,0 @@ -var commonjs = require('@rollup/plugin-commonjs'), - nodeResolve = require('@rollup/plugin-node-resolve'), - json = require('@rollup/plugin-json'), - babel = require('@rollup/plugin-babel'), - terser = require('@rollup/plugin-terser'), - copy = require('rollup-plugin-copy'), - license = require('rollup-plugin-license'), - watchChange = require('./client.plugin-watch'), - package = require('../package.json'), - path = require('path'), - watch = process.argv.includes('--watch') - -module.exports = { - input: 'src/client/index.mjs', - output: [ - { - dir: 'app/client/', - chunkFileNames: `[name].js`, - entryFileNames: `[name].js`, - format: 'es', - sourcemap: true, - sourcemapExcludeSources: true - }, - ], - treeshake: false, - watch: { - clearScreen: false - }, - plugins: [ - json(), - nodeResolve({ - browser: true - }), - commonjs(), - watch ? {} : babel({ - babelHelpers: 'bundled', - babelrc: false, - exclude: [ - /node_modules\/core-js/, - /node_modules\/ace-builds/ - ], - presets: [[ - '@babel/preset-env', - { - targets: { - ios: '11', - chrome: '70' - }, - useBuiltIns: 'usage', - corejs: 3, - modules:false - } - ]] - }), - watch ? {} : terser({ - sourceMap: true, - keep_classnames: true, - keep_fnames: true, - output: { - comments: false, - }, - }), - { - name: 'remove-node-modules-from-source-map', - enforce: 'post', - transform(code, id) { - if (id.includes('node_modules')) { - return { code, map: { mappings: '' } } - } - } - }, - watch ? {} :license({ - thirdParty: { - includeSelf: true, - output: 'app/client/LICENSES', - }, - }), - watch ? {} : copy({ - targets: [ - {src: 'resources/images/logo_nobadge.png', dest: 'app/assets/', rename: 'favicon.png'}, - {src: 'resources/images/logo.png', dest: 'app/assets/'}, - {src: 'resources/images/logo_tray.png', dest: 'app/assets/'}, - {src: 'resources/images/logo_tray@x2.png', dest: 'app/assets/'}, - {src: 'resources/images/logo_16x16.png', dest: 'app/assets/'}, - {src: 'resources/fonts/*', dest: 'app/assets/fonts/'}, - {src: 'node_modules/ace-builds/src-min/worker-css.js', dest: 'app/client/ace/'}, - {src: 'node_modules/ace-builds/src-min/worker-html.js', dest: 'app/client/ace/'}, - {src: 'node_modules/ace-builds/src-min/worker-javascript.js', dest: 'app/client/ace/'}, - {src: 'node_modules/ace-builds/src-min/ace.js', dest: 'app/client/ace/'}, - {src: 'src/html/client.html', dest: 'app/client/', rename: 'index.html', transform: (contents)=>{ - return contents.toString().replace(/\$\{([^\}]+)\}/g, (m, p1)=>{return package[p1]}) - }}, - - ] - }), - watchChange() - ] -}; diff --git a/scripts/copy-assets.js b/scripts/copy-assets.js new file mode 100644 index 00000000..c64849e9 --- /dev/null +++ b/scripts/copy-assets.js @@ -0,0 +1,50 @@ +var cpr = require('cpr'), + fs = require('fs'), + path = require('path'), + files = [ + ['../resources/images/logo-nobadge.png', '../app/assets/favicon.png'], + ['../resources/images/logo.png', '../app/assets/logo.png'], + ['../LICENSE', '../app/LICENSE'], + ['../src/python/head.py', '../app/server/python/head.py'], + ['../src/python/list.py', '../app/server/python/list.py'], + ['../src/python/utils.py', '../app/server/python/utils.py'], + ['../src/python/midi.py', '../app/server/python/midi.py'], + ] + +for (var i in files) { + cpr(...files[i].map(f => path.resolve(__dirname + '/' + f)), { + overwrite: true + }) +} + + +var packageJson = require('../package.json'), + appJson = {}, + copiedProps = [ + "name", + "productName", + "description", + "version", + "author", + "repository", + "homepage", + "license", + "yargs", + "engines" + ] + +for (var k of copiedProps) { + appJson[k] = packageJson[k] +} + +appJson.main = appJson.bin = "index.js" +appJson.scripts = { + "start": "electron index.js", + "start-node": "node index.js" +} + +appJson.optionalDependencies = { + electron: packageJson.optionalDependencies.electron +} + +fs.writeFileSync(path.resolve(__dirname + '/../app/package.json'), JSON.stringify(appJson, null, ' ')) diff --git a/scripts/dist_packages.sh b/scripts/dist_packages.sh deleted file mode 100755 index 8805f515..00000000 --- a/scripts/dist_packages.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# clean -rm -rf dist app - -# buid -npm run build -npm run build-docs -npm run package -- --all -PLATFORM=darwin ARCH=arm64 npm run package -npm run package-node - -# get current version -VERSION=$(sed -nE 's/^\s*"version":\ "(.*?)",$/\1/p' package.json) - -cd dist - -# fetch & copy midi bins -mkdir tmp && cd tmp -cp ../../bin/osc-midi-* ./ -chmod +x * -touch .expect-midi-bin -cp {.expect-midi-bin,osc-midi-linux} ../open-stage-control-linux-x64/resources/app/server/python/ -cp {.expect-midi-bin,osc-midi-windows.exe} ../open-stage-control-win32-x64/resources/app/server/python/ -cp {.expect-midi-bin,osc-midi-osx} ../open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server/python/ -cp {.expect-midi-bin,osc-midi-osx} ../open-stage-control-darwin-arm64/open-stage-control.app/Contents/Resources/app/server/python/ -cd .. -rm -rf tmp - -# make packages -mkdir packages -npm run deb64 -npm run rpm64 -mv *.{deb,rpm} packages/ - -mv open-stage-control-node open-stage-control_${VERSION}_node -mv open-stage-control-win32-x64 open-stage-control_${VERSION}_win32-x64 -mv open-stage-control-linux-x64 open-stage-control_${VERSION}_linux-x64 - -echo "Creating zip packages..." -zip -q -r --symlinks packages/open-stage-control_${VERSION}_osx-x64.zip open-stage-control-darwin-x64/open-stage-control.app -zip -q -r --symlinks packages/open-stage-control_${VERSION}_osx-arm64.zip open-stage-control-darwin-arm64/open-stage-control.app -zip -q -r packages/open-stage-control_${VERSION}_node.zip open-stage-control_${VERSION}_node -zip -q -r packages/open-stage-control_${VERSION}_win32-x64.zip open-stage-control_${VERSION}_win32-x64 -zip -q -r packages/open-stage-control_${VERSION}_linux-x64.zip open-stage-control_${VERSION}_linux-x64 diff --git a/scripts/docs.rollup.config.js b/scripts/docs.rollup.config.js deleted file mode 100644 index 5b27aa0f..00000000 --- a/scripts/docs.rollup.config.js +++ /dev/null @@ -1,25 +0,0 @@ -var commonjs = require('@rollup/plugin-commonjs'), - nodeResolve = require('@rollup/plugin-node-resolve'), - json = require('@rollup/plugin-json') - -module.exports = { - input: 'src/docs/widgets-reference.mjs', - output: [ - { - file: 'src/docs/widgets-reference.js', - inlineDynamicImports: true, - format: 'commonjs', - sourcemap: false, - strict: false, - indent: false, - name: '_' - }, - ], - plugins: [ - json(), - nodeResolve({ - browser: true - }), - commonjs() - ] -}; diff --git a/scripts/launcher.rollup.config.js b/scripts/launcher.rollup.config.js deleted file mode 100644 index c0b2eda1..00000000 --- a/scripts/launcher.rollup.config.js +++ /dev/null @@ -1,48 +0,0 @@ -var commonjs = require('@rollup/plugin-commonjs'), - nodeResolve = require('@rollup/plugin-node-resolve'), - json = require('@rollup/plugin-json'), - babel = require('@rollup/plugin-babel'), - terser = require('@rollup/plugin-terser'), - copy = require('rollup-plugin-copy'), - license = require('rollup-plugin-license'), - package = require('../package.json'), - path = require('path') - -module.exports = { - input: 'src/launcher/index.mjs', - output: [ - { - dir: 'app/launcher/', - chunkFileNames: `[name].js`, - format: 'commonjs', - sourcemap: true, - sourcemapExcludeSources: true, - strict: false - }, - ], - treeshake: false, - external: ['electron'], - watch: { - clearScreen: false - }, - plugins: [ - json(), - commonjs({ - ignoreGlobal: true, - ignoreDynamicRequires: true - }), - nodeResolve(), - terser(), - license({ - thirdParty: { - includeSelf: true, - output: 'app/launcher/LICENSES', - }, - }), - copy({ - targets: [ - {src: 'src/html/launcher.html', dest: 'app/launcher/', rename: 'index.html'}, - ] - }) - ] -}; diff --git a/scripts/package-node.js b/scripts/package-node.js index 6fdae1bc..c4934eb2 100644 --- a/scripts/package-node.js +++ b/scripts/package-node.js @@ -1,4 +1,8 @@ -var cpr = require('cpr'), +var browserify = require('browserify'), + exorcist = require('exorcist'), + licensify = require('licensify'), + fs = require('fs'), + cpr = require('cpr'), path = require('path'), files = ['../app', '../dist/open-stage-control-node'] diff --git a/scripts/package.js b/scripts/package.js index de33b599..e7690323 100644 --- a/scripts/package.js +++ b/scripts/package.js @@ -1,31 +1,25 @@ -const packager = require('@electron/packager'), +const packager = require('electron-packager'), path = require('path'), appData = require('../app/package.json'), - safeFFMPEG = require('electron-packager-plugin-non-proprietary-codecs-ffmpeg').default, - licensePath = path.resolve(__dirname + '/../LICENSE'), - fs = require('fs') + safeFFMPEG = require('electron-packager-plugin-non-proprietary-codecs-ffmpeg').default -var all = process.argv.includes('--all') +var rpi = process.argv.includes('--old-rpi'), + all = process.argv.includes('--all') packager({ dir: path.resolve(__dirname + '/../app'), name: appData.name, - platform: all ? ['linux', 'win32', 'darwin'] : process.env.PLATFORM, - arch: process.env.ARCH || 'x64', - electronVersion: process.env.ELECTRON_VERSION || require('../package.json').optionalDependencies.electron, + all: all ? true : undefined, + platform: rpi ? 'linux' : process.env.PLATFORM, + arch: rpi ? 'armv7l' : process.env.ARCH, + electronVersion: rpi ? '1.7.11' : require('../package.json').optionalDependencies.electron, overwrite: true, out: path.resolve(__dirname + '/../dist'), icon: path.resolve(__dirname + '/../resources/images/logo'), - ignore: /(node_modules\/(serialport|uws)|docs\/fonts)/, + ignore: /node_modules\/(serialport|uws)/, afterExtract: [safeFFMPEG], prune: false -}).then((appPaths)=>{ - - for (var appPath of appPaths) { - var electronLicensePath = path.join(appPath, 'LICENSE') - fs.copyFileSync(electronLicensePath, electronLicensePath + '.electron') - fs.copyFileSync(licensePath, electronLicensePath) - } +}).then(()=>{ console.warn('\x1b[36m%s\x1b[0m', '=> Build artifacts created in ' + path.resolve(__dirname + '/../dist')) diff --git a/scripts/server.rollup.config.js b/scripts/server.rollup.config.js deleted file mode 100644 index dac5b03a..00000000 --- a/scripts/server.rollup.config.js +++ /dev/null @@ -1,65 +0,0 @@ -var commonjs = require('@rollup/plugin-commonjs'), - nodeResolve = require('@rollup/plugin-node-resolve'), - json = require('@rollup/plugin-json'), - babel = require('@rollup/plugin-babel'), - terser = require('@rollup/plugin-terser'), - copy = require('rollup-plugin-copy'), - license = require('rollup-plugin-license'), - package = require('../package.json'), - path = require('path') - -module.exports = { - input: { - 'node/index': 'src/server/node/index.mjs', - 'electron/index': 'src/server/electron/index.mjs' - }, - output: [ - { - dir: 'app/server/', - chunkFileNames: `[name].js`, - format: 'commonjs', - sourcemap: true, - sourcemapExcludeSources: true, - strict: false - }, - ], - treeshake: false, - external: ['electron', '@serialport'], - watch: { - clearScreen: false - }, - plugins: [ - json(), - commonjs({ - ignoreGlobal: true, - ignoreDynamicRequires: true - }), - nodeResolve({ - preferBuiltins: true - }), - license({ - thirdParty: { - includeSelf: true, - output: 'app/server/LICENSES', - }, - }), - terser({ - sourceMap: true, - keep_classnames: true, - keep_fnames: true, - output: { - comments: false, - }, - }), - copy({ - targets: [ - {src: 'src/index.js', dest: 'app/'}, - {src: 'src/server/index.js', dest: 'app/server/'}, - {src: 'src/server/python/*.py', dest: 'app/server/python/'}, - {src: 'node_modules/fsevents/fsevents.node', dest: 'app/server/'}, - {src: 'LICENSE', dest: 'app/'}, - {src: 'package.json', dest: 'app/'}, - ] - }) - ] -}; diff --git a/src/client/app/dom.js b/src/client/app/dom.js new file mode 100644 index 00000000..4466bb4b --- /dev/null +++ b/src/client/app/dom.js @@ -0,0 +1,107 @@ +var readyCallbacks = [], + initState = false + +module.exports = { + + init: function() { + + for (var i in readyCallbacks) { + readyCallbacks[i]() + } + + initState = true + + }, + + ready: function(callback) { + if (initState) { + callback() + } else { + readyCallbacks.push(callback) + } + }, + + dispatchEvent: function(element, name, data) { + + var event = new CustomEvent(name, { + detail: data, + bubbles: true, + cancelable: true + }) + + element.dispatchEvent(event) + + }, + + addEventListener: function(element, events, listener, capture) { + + var eventsAsObject = typeof events == 'string' ? events.split(' ') : events + + for (var i in eventsAsObject) { + + element.addEventListener(eventsAsObject[i], listener, capture) + + } + + }, + + get: function(a, b) { + + var context = b ? a : document, + selector = b || a, + nodes + + if (selector.indexOf('>') === 0) selector = ':scope ' + selector + + if (selector.indexOf(' ') === -1 && selector.indexOf(',') === -1) { + if (selector.indexOf('#') === 0 && context === document) { + nodes = [document.getElementById(selector.substr(1, selector.length - 1))] + } else if (selector.indexOf('.') === 0) { + nodes = context.getElementsByClassName(selector.substr(1, selector.length - 1)) + } + } + + if (!nodes) nodes = context.querySelectorAll(selector) + + return [...nodes] + + }, + + each: function(context, selector, callback) { + + var nodes = module.exports.get(context, selector) + + nodes.forEach(callback) + + return nodes + + }, + + index: function(element) { + var parent = element.parentNode + return parent ? Array.prototype.indexOf.call(parent.children, element) : -1 + }, + + offset: function(element) { + + var offsetLeft = 0, + offsetTop = 0 + + if (element) { + do { + if (!isNaN(element.offsetLeft)) { + offsetLeft += element.offsetLeft - element.scrollLeft + } + if (!isNaN(element.offsetTop)) { + offsetTop += element.offsetTop - element.scrollTop + } + } while ((element = element.offsetParent)) + } + + return { + left: offsetLeft, + top: offsetTop + } + } + +} diff --git a/src/client/app/editor/context-menu.js b/src/client/app/editor/context-menu.js new file mode 100644 index 00000000..48d23c66 --- /dev/null +++ b/src/client/app/editor/context-menu.js @@ -0,0 +1,250 @@ +var {updateWidget} = require('./data-workers'), + {categories} = require('../widgets/'), + widgetManager = require('../managers/widgets'), + {icon} = require('../ui/utils'), + editor = require('./'), + locales = require('../locales'), + contextMenu = require('../ui/context-menu') + + +var multiSelectKey = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey' + +var handleClick = function(event) { + + if (!EDITING) return + + if (!event.detail[multiSelectKey] && event.type !== 'fast-right-click' && ( + event.target.classList.contains('ui-resizable-handle') || + event.target.classList.contains('ui-draggable-handle') || + event.target.id === 'open-toggle' + )) { return } + + var eventData = event.detail, + widget = widgetManager.getWidgetByElement(eventData.target, ':not(.not-editable)') + + if (!widget) return + + // if the widget is not already selected + if (!widget.container.classList.contains('editing')) { + // add a flag to the original event to prevent draginit + // and prevent any further fast-click (ie input focus) + eventData.capturedByEditor = true + event.capturedByEditor = true + } + + + if (event.type !== 'fast-right-click') { + editor.select(widget, {multi: event.detail[multiSelectKey]}) + } + + // right-click menu + if (event.type !== 'fast-right-click') return + + if (!event.detail.shiftKey && !event.detail[multiSelectKey] && editor.selectedWidgets.length <= 1) { + editor.select(widget) + } + + if (!editor.selectedWidgets.length) return + + var index = editor.selectedWidgets.map((w)=>DOM.index(w.container)).sort((a,b)=>{return b-a}), + data = editor.selectedWidgets.map((w)=>w.props), + type = editor.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget', + parent = editor.selectedWidgets[0].parent, + actions = [] + + // case root: only "add tab" option + if (parent === widgetManager) { + actions.push({ + label: icon('plus') + ' ' + locales('editor_addtab'), + action: ()=>{ + data[0].tabs.push({}) + + var indexes = {addedIndexes: [data[0].tabs.length -1]} + updateWidget(editor.selectedWidgets[0], indexes) + editor.pushHistory(indexes) + } + }) + contextMenu.open(eventData, actions) + + return + } + + // case !root + + var clickX = Math.round((eventData.offsetX + eventData.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH, + clickY = Math.round((eventData.offsetY + eventData.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH + + actions.push({ + label: icon('expand') + ' ' + locales('editor_editparent'), + action: ()=>{ + editor.select(parent) + } + }) + + if (type === 'widget') { + + actions.push({ + label: icon('copy') + ' ' + locales('editor_copy'), + action: editor.copyWidget.bind(editor) + }) + + actions.push({ + label: icon('cut') + ' ' + locales('editor_cut'), + action: editor.cutWidget.bind(editor) + }) + + var wrapActions = [] + for (let c of categories.Containers) { + if (c === 'clone') continue + wrapActions.push({ + label: c, + action: ()=>{ + var wrap = {type: c, widgets:[], label: c === 'modal' ? 'auto' : false} + + wrap.widgets = data + + var minTop = Math.min(...data.map(x=>isNaN(x.top) ? x.top == 'auto' ? 0 : Infinity : x.top)) + var minLeft = Math.min(...data.map(x=>isNaN(x.left) ? x.left == 'auto' ? 0 : Infinity : x.left)) + + wrap.top = minTop === Infinity ? data[0].top : minTop + wrap.left= minLeft === Infinity ? data[0].left : minLeft + + for (var w of wrap.widgets) { + if (!isNaN(w.top)) w.top = Math.max(w.top - minTop, 0) + if (!isNaN(w.left)) w.left = Math.max(w.left - minLeft, 0) + } + + var i + for (i of index) { + parent.props.widgets.splice(i,1) + } + + parent.props.widgets = parent.props.widgets.slice(0, i).concat(wrap, parent.props.widgets.slice(i, parent.props.widgets.length)) + + editor.select(updateWidget(parent, {preventSelect: true, removedIndexes: index, addedIndexes: [i]})) + editor.pushHistory({removedIndexes: index, addedIndexes: [i]}) + + } + }) + } + + actions.push({ + label: icon('box') + ' ' + locales('editor_wrap'), + action: wrapActions + }) + + } + + + if (data.length == 1 && (!data[0].tabs || !data[0].tabs.length) && (data[0].widgets)) { + + if (editor.clipboard !== null) { + + var pasteActions = [] + + pasteActions.push({ + label: icon('paste') + ' ' + locales('editor_paste'), + action: ()=>{ + editor.pasteWidget(clickX, clickY) + } + }) + pasteActions.push({ + label: icon('plus-square') + ' ' + locales('editor_pasteindent'), + action: ()=>{ + editor.pasteWidget(clickX, clickY, true) + } + }) + + if (editor.idClipboard && widgetManager.getWidgetById(editor.idClipboard).length) { + pasteActions.push({ + label: icon('clone') + ' ' + locales('editor_clone'), + action: ()=>{ + editor.pasteWidgetAsClone(clickX, clickY) + } + }) + } + + actions.push({ + label: icon('paste') + ' ' + locales('editor_paste'), + action: pasteActions + }) + + } + + + var addActions = [] + + for (let category in categories) { + + var catActions = [] + + for (let t in categories[category]) { + + let type = categories[category][t] + + catActions.push({ + + label: type, + action: ()=>{ + + var newData = {type: type} + + if (!eventData.target.classList.contains('tablink')) { + newData.top = clickY + newData.left= clickX + } + + data[0].widgets = data[0].widgets || [] + data[0].widgets.push(newData) + + var indexes = {addedIndexes: [data[0].widgets.length -1]} + updateWidget(editor.selectedWidgets[0], indexes) + editor.pushHistory(indexes) + + } + }) + + } + + addActions.push({ + label: category, + action: catActions + }) + + } + + actions.push({ + label: icon('plus') + ' ' + locales('editor_addwidget'), + action: addActions + }) + + } + + if (data.length == 1 && (!data[0].widgets || !data[0].widgets.length) && (data[0].tabs)) { + + actions.push({ + label: icon('plus') + ' ' + locales('editor_addtab'), + action: ()=>{ + data[0].tabs = data[0].tabs || [] + data[0].tabs.push({}) + + var indexes = {addedIndexes: [data[0].tabs.length -1]} + updateWidget(editor.selectedWidgets[0], indexes) + editor.pushHistory(indexes) + + } + }) + + } + + actions.push({ + label: icon('trash') + ' ' + locales('editor_delete'), + action: editor.deleteWidget.bind(editor) + }) + + contextMenu.open(eventData, actions) + +} + +document.body.addEventListener('fast-right-click', handleClick, true) +document.body.addEventListener('fast-click', handleClick, true) diff --git a/src/client/editor/data-workers.mjs b/src/client/app/editor/data-workers.js similarity index 73% rename from src/client/editor/data-workers.mjs rename to src/client/app/editor/data-workers.js index 3a1b1f8e..6b4cfee9 100644 --- a/src/client/editor/data-workers.mjs +++ b/src/client/app/editor/data-workers.js @@ -1,30 +1,29 @@ -import widgetManager from '../managers/widgets.mjs' -import stateManager from '../managers/state.mjs' -import parser from '../parser.mjs' -import * as resize from '../events/resize.mjs' +var widgetManager = require('../managers/widgets'), + resize = require('../events/resize'), + stateManager = require('../managers/state'), + parser = require('../parser'), + Panel, + sidepanel, + editor, + scrollState = {}, + sidepanelScroll -var Panel, Matrix, editor -;(async()=>{ - Panel = (await import('../widgets/containers/panel.mjs')).default - Matrix = (await import('../widgets/containers/matrix.mjs')).default - editor = (await import('./index.mjs')).default -})() - -var scrollState = {} +DOM.ready(()=>{ + sidepanel = DOM.get('#sidepanel')[0] +}) function updateWidget(widget, options={}) { - if (options.editedProps) { + if (options.changedProps) { // alternate routine for small edits - var propNames = options.editedProps + var propNames = options.changedProps if ( // if non dynamic props have changed, skip this and use rebuild routine !propNames.some(n => !widget.isDynamicProp(n)) ) { - var edited = widget.updateProps(options.editedProps, null, {fromEditor: true}) || widget - editor.widgetTree.updateTree(editor.selectedWidgets) + var edited = widget.updateProps(options.changedProps, null, {fromEditor: true}) || widget if (editor.selectedWidgets.includes(widget) && !options.preventSelect) { editor.select(edited) @@ -43,7 +42,6 @@ function updateWidget(widget, options={}) { } var reuseChildren = options.reuseChildren !== false && widget instanceof Panel - && !(widget instanceof Matrix) var children = undefined, removedChildren = [] @@ -69,14 +67,14 @@ function updateWidget(widget, options={}) { var index = widget.parent.children.indexOf(widget) // list widgets to remove - removedChildren = removedChildren.filter(x => x !== undefined) var removedWidgets = reuseChildren ? removedChildren.map(x => x.getAllChildren().concat(x)).concat(widget).reduce((a,b)=>a.concat(b), []) : widget.getAllChildren().concat(widget) // save state if (stateManager.queueCounter === 0) { - scrollState = {} // scrollable modals don't store their scroll state in their value + sidepanelScroll = sidepanel.scrollTop + scrollState = {} } stateManager.incrementQueue() for (let w of removedWidgets) { @@ -88,8 +86,8 @@ function updateWidget(widget, options={}) { stateManager.pushValueState(id, value) if (valueProp !== '' && valueProp !== undefined) stateManager.pushValueOldProp(id, valueProp) } - if (w.getProp('scroll') && w.getProp('type') === 'modal') { - var s = w.getScroll() + if (widgetManager.scrollingWidgets.indexOf(w.hash) > -1 && w.scroll) { + var s = w.scroll() if (s[0] !== 0 || s[1] !== 0) { scrollState[w.getProp('id')] = s } @@ -105,17 +103,15 @@ function updateWidget(widget, options={}) { parent: widget.parent, parentNode: widget.parentNode, reCreateOptions: options.reCreateOptions, - locals: widget.parsersLocalScope, - variables: widget.variables, - hash: widget.hash, children: children, - index: index, - meta: widget.meta + index: index }) + newWidget.container.parentNode.replaceChild(newWidget.container, widget.container) if (newWidget.getProp('type') === 'tab') newWidget.parent.trigger('tab-created', {widget: widget}) + if (newWidget.getProp('id') === 'root') DOM.get('.editor-root')[0].setAttribute('data-widget', newWidget.hash) if (reuseChildren && !(newWidget instanceof Panel)) { @@ -139,15 +135,14 @@ function updateWidget(widget, options={}) { // restore state stateManager.decrementQueue() if (stateManager.queueCounter === 0) { + sidepanel.scrollTop = sidepanelScroll for (let id in scrollState) { for (let w of widgetManager.getWidgetById(id)) { - if (w.getProp('scroll')) w.setScroll(scrollState[id][0], scrollState[id][1]) + if (w.scroll) w.scroll(scrollState[id]) } } } - editor.widgetTree.updateTree(editor.selectedWidgets) - if (editor.selectedWidgets.includes(widget) && !options.preventSelect) { editor.select(newWidget) } @@ -170,26 +165,16 @@ var incrementWidget = function(data, root){ } } - if (Array.isArray(data)) { - for (let i in data) { - data[i] = incrementWidget(data[i], false) - } - return data - } + var id = data.id, + address = data.address - var id = String(data.id), - address = String(data.address) - - if (id && address == '/' + id) { + if (id && address == '/'+id) { data.address = 'auto' - } else if (!address.match(/^(auto|\/control|\/note|\/program|\/sysex|\/mtc|\/key_pressure|\/channel_pressure|\/pitch)$/)) { - - var addressref = widgetManager.createAddressRef(null, data.preArgs,address) - + } else if (address){ + var addressref while (fakeStore.address.indexOf(address) != -1 || widgetManager.getWidgetByAddress(addressref).length) { - address = address.replace(/([0-9]*)$/,function(m){ var n = parseInt(m)+1 n = isNaN(n)?1:n @@ -235,7 +220,10 @@ var incrementWidget = function(data, root){ } -export { - updateWidget, - incrementWidget +module.exports = { + updateWidget:updateWidget, + incrementWidget:incrementWidget } + +editor = require('./') +Panel = require('../widgets/containers/panel') diff --git a/src/client/app/editor/diff.js b/src/client/app/editor/diff.js new file mode 100644 index 00000000..8f2902a9 --- /dev/null +++ b/src/client/app/editor/diff.js @@ -0,0 +1,32 @@ +module.exports = { + + diff: require('jsondiffpatch'), + + diffToWidget: function(widget, diff) { + + // traverse a diff patch and the associated widget + // to return the first node (widget and sub-patch) with actual changes + + var children = diff.tabs || diff.widgets + + if (children) { + var childrenKeys = Object.keys(children), + deletedChildren = childrenKeys.filter(x => typeof x === 'string' && x.match(/_[0-9]+/)), + changedChildren = childrenKeys.filter(x => !isNaN(x)) + } + + if ( + !children || + Array.isArray(children) || // 'tabs' or 'widgets' property created + deletedChildren.length || // 'tabs' or 'widgets' property created + changedChildren.length !== 1 || // children reordered (or same property edited in multiple widgets, but case ignored) + Array.isArray(children[changedChildren[0]]) // child item created + ) { + return [widget, diff] + } + + return module.exports.diffToWidget(widget.children[changedChildren[0]], children[changedChildren[0]]) + + } + +} diff --git a/src/client/app/editor/edit-field.js b/src/client/app/editor/edit-field.js new file mode 100644 index 00000000..e40d8811 --- /dev/null +++ b/src/client/app/editor/edit-field.js @@ -0,0 +1,261 @@ +var widgetCategories = require('../widgets/').categories, + {updateWidget} = require('./data-workers'), + widgetManager = require('../managers/widgets'), + {deepCopy} = require('../utils'), + {icon, Popup} = require('../ui/utils'), + locales = require('../locales'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +module.exports = function editField(editor, widget, propName, defaultValue){ + + let dynamic = widget.isDynamicProp(propName), + disabled = widget.disabledProps.indexOf(propName) > -1, + error = widget.errors[propName] + + let field = html` +
+ +
+ ` + + let input + + if (propName !== 'widgets' && propName !== 'tabs') { + + if (propName == 'type') { + + if (widget.props.type == 'tab' || widget.props.type == 'root') { + field.classList.add('disabled') + field.appendChild(html``) + return field + } + + input = html`` + + DOM.addEventListener(input, ['input', 'focus'], ()=>{ + input.setAttribute('rows',0) + input.setAttribute('rows', input.value.split('\n').length) + }) + + input.addEventListener('keydown', (e)=>{ + if (e.keyCode == 13 && !e.shiftKey) { + e.preventDefault() + DOM.dispatchEvent(input, 'change') + } + }) + + if (defaultValue.type.includes('boolean')) { + + let toggle = html` + + ${raw(icon('check'))} + + ` + + toggle.addEventListener('click', ()=>{ + if (propName === 'label' && !widget.getProp(propName) === true) { + // special case + input.value = 'auto' + } else { + input.value = !widget.getProp(propName) + } + DOM.dispatchEvent(input, 'change') + }) + + field.appendChild(toggle) + + } + + field.appendChild(input) + + } + var lock, + selectedWidgets = [...editor.selectedWidgets] + + var onChange = ()=>{ + + if (lock) return + lock = true + + input.blur() + + var v + var str = input.value.replace(/[‟”]/g, '"').replace(/[‘’]/g, '\'') // convert invalid quote characters + + try { + v = JSON.parseFlex(str) + if (typeof v === 'string') { + // escape backslashes in simple strings only + v = JSON.parseFlex(str.replace(/\\/g, '__BACKSLASH__')) + v = v.replace(/__BACKSLASH__/g, '\\') + } + } catch(err) { + v = str + } + + var newWidgets = [] + for (var w of selectedWidgets) { + if (propName === 'address' && v === '') { + // special case + w.props[propName] = '/' + w.props.id + } else { + w.props[propName] = v !== '' ? v : deepCopy(defaultValue.value) + } + newWidgets.push(updateWidget(w, {changedProps: [propName], preventSelect: selectedWidgets.length > 1})) + } + editor.pushHistory() + if (newWidgets.length > 1) editor.select(newWidgets) + + lock = false + + } + + input.addEventListener('change', onChange) + + + } else if ( + (propName === 'widgets' && (!widget.props.tabs ||! widget.props.tabs.length)) || + (propName === 'tabs' && (!widget.props.widgets ||! widget.props.widgets.length)) + ) { + + if (editor.selectedWidgets.length > 1) return + + var list = html`
    ` + + for (var i in widget.props[propName]) { + + list.appendChild(html` +
  • + ${widget.props[propName][i].id} + ${raw(icon('times'))} +
  • + `) + + } + + list.appendChild(html` +
  • ${raw(icon('plus'))}
  • + `) + + + list.addEventListener('click', (e)=>{ + + switch (e.target.getAttribute('data-action')) { + + case 'select': + editor.select(widgetManager.getWidgetByElement(DOM.get(propName === 'widgets' ? widget.widget : widget.wrapper, '> .widget')[DOM.index(e.target.closest('li'))])) + break + + case 'remove': + var index = DOM.index(e.target.closest('li')) + widget.props[propName].splice(index,1) + updateWidget(widget, {removedIndexes: [index] }) + editor.pushHistory({removedIndexes: [index] }) + break + + case 'add': + widget.props[propName] = widget.props[propName] || [] + widget.props[propName].push({}) + updateWidget(widget, {addedIndexes: [widget.props[propName].length -1] }) + editor.pushHistory({addedIndexes: [widget.props[propName].length -1] }) + break + + } + + }) + + var $list = $(list) + $list.sortable({ + items: '.sortables', + placeholder: 'sortable-placeholder btn small', + start:function(){$(this).sortable( 'refreshPositions' )}, + update: function(e,ui){ + var oldindex = $(ui.item).attr('data-index') + var index = $(ui.item).index() + + widget.props[propName].splice(index, 0, widget.props[propName].splice(oldindex, 1)[0]) + + var indexes = [index, oldindex] + if (Math.abs(oldindex - index) > 1) { + for (var i = Math.min(index, oldindex) + 1; i < Math.max(index, oldindex); i++) { + indexes.push(i) + } + } + updateWidget(widget, {removedIndexes: indexes, addedIndexes: indexes}) + editor.pushHistory({removedIndexes: indexes, addedIndexes: indexes}) + } + }) + + input = html`
    ` + input.appendChild(list) + field.appendChild(input) + + } + + var label = DOM.get(field, 'label')[0] + label.addEventListener('fast-click', ()=>{ + + var htmlHelp = Array.isArray(defaultValue.help) ? defaultValue.help.join('

    ').replace(/-/g, '-') : defaultValue.help + htmlHelp = htmlHelp ? html`

    ${raw(htmlHelp.replace(/`([^`]*)`/g, '$1'))}

    ` : '' + + DOM.each(htmlHelp, 'a', (el)=>{ + el.target = '_blank' + }) + + var htmlError = error ? html`

    ${error}

    ` : '', + computedValue = propName !== 'tabs' && propName !== 'widgets' ? widget.getProp(propName) : ['...'] + + if (typeof computedValue === 'string') { + try { + computedValue = JSON.stringify(JSON.parse(computedValue), null, ' ') + } catch(e) {} + } else { + computedValue = JSON.stringify(computedValue, null, ' ') + } + + new Popup({closable: true, title: html`${propName}`, content: html` +
    + +

    Type: ${defaultValue.type}

    +

    Default: ${JSON.stringify(defaultValue.value)}

    +

    Dynamic: ${dynamic ? 'true' : 'false'}

    +

    Computed: ${computedValue}

    + + ${htmlError} + + ${htmlHelp} +
    + `}) + }) + + if (input) { + return field + } + + +} diff --git a/src/client/app/editor/index.js b/src/client/app/editor/index.js new file mode 100644 index 00000000..69a7a252 --- /dev/null +++ b/src/client/app/editor/index.js @@ -0,0 +1,907 @@ +var {widgets} = require('../widgets/'), + editField = require('./edit-field'), + {updateWidget, incrementWidget} = require('./data-workers'), + keyboardJS = require('keyboardjs'), + {diff, diffToWidget} = require('./diff'), + widgetManager = require('../managers/widgets'), + {deepCopy} = require('../utils'), + macOs = (navigator.platform || '').match('Mac'), + SelectArea = require('./select-area'), + html = require('nanohtml'), + sessionManager + + +const HISTORY_SIZE = 50 + +var Editor = class Editor { + + constructor() { + + this.wrapper = html` +
    +
    +
    +
    + ` + + this.form = DOM.get(this.wrapper, '.form')[0] + this.form.addEventListener('fast-click', (e)=>{ + if (e.target.classList.contains('separator')) { + var name = e.target.getAttribute('data-name'), + foldedIndex = this.foldedCategories.indexOf(name) + e.target.parentNode.classList.toggle('folded', foldedIndex < 0) + if (foldedIndex > -1) { + this.foldedCategories.splice(foldedIndex, 1) + } else { + this.foldedCategories.push(name) + } + + } + }) + + + this.defaults = {} + for (var k in widgets) { + this.defaults[k] = widgets[k].defaults() + } + + this.selectedWidgets = [] + + this.clipboard = null + this.idClipboard = null + + this.enabled = false + + this.unsavedSession = false + window.onbeforeunload = ()=>{ + if (this.unsavedSession) return true + } + + + this.history = [] + this.historyState = -1 + this.historySession = null + + this.foldedCategories = [] + + this.mousePosition = {x:0, y:0} + this.mouveMoveHandler = this.mouseMove.bind(this) + + keyboardJS.withContext('editing', ()=>{ + + var combos = [ + 'mod + z', + 'mod + y', + 'mod + shift + z', + 'mod + c', + 'mod + x', + 'mod + v', + 'mod + shift + v', + macOs ? 'backspace' : 'delete', + 'alt + up', + 'alt + down', + 'alt + right', + 'alt + left', + 'up', + 'down', + 'right', + 'left', + 'mod + shift + a', + 'mod + a', + 'mod + up', + 'mod + down', + 'mod + left', + 'mod + right', + 'f2' + ] + + for (let c of combos) { + keyboardJS.bind(c, (e)=>{ + this.handleKeyboard(c, e) + }) + } + + }) + + keyboardJS.bind('mod + s', (e)=>{ + e.preventDefault() + sessionManager.save() + }) + + keyboardJS.bind('mod + shift + s', (e)=>{ + e.preventDefault() + sessionManager.saveAs() + }) + + keyboardJS.bind('mod + o', (e)=>{ + e.preventDefault() + sessionManager.browse() + }) + + keyboardJS.bind('mod + e', (e)=>{ + e.preventDefault() + if (this.enabled) { + this.disable() + } else { + if (sessionManager.session.type) this.enable() + } + }) + + + this.selectarea = new SelectArea('.widget:not(.not-editable), .tablink', (elements)=>{ + + elements = elements.map(e => widgetManager.getWidgetByElement(e, ':not(.not-editable)')).filter(e => e) + + for (var i in elements) { + this.select(elements[i], {multi:true, fromLasso:true}) + } + this.select(this.selectedWidgets) + + }) + + + } + + handleKeyboard(combo, e){ + + if (e.target && e.target.classList.contains('no-keybinding')) return + e.preventDefault() + + switch (combo) { + + case 'mod + z': + this.undo() + break + + case 'mod + y': + case 'mod + shift + z': + this.redo() + break + + case 'mod + c': + this.copyWidget() + break + + case 'mod + x': + this.cutWidget() + break + + case 'mod + v': + this.pasteWidget(this.mousePosition.x, this.mousePosition.y, false) + break + + case 'mod + shift + v': + this.pasteWidget(this.mousePosition.x, this.mousePosition.y, true) + break + + case 'backspace': + case 'delete': + this.deleteWidget() + break + + case 'alt + up': + case 'alt + down': + case 'alt + right': + case 'alt + left': + if (!this.selectedWidgets.length) return + + if (this.selectedWidgets[0].props.height === undefined && e.key.match(/Arrow(Up|Down)/)) return + if (this.selectedWidgets[0].props.width === undefined && e.key.match(/Arrow(Left|Right)/)) return + + var deltaW = e.key === 'ArrowLeft' ? -GRIDWIDTH : e.key === 'ArrowRight' ? GRIDWIDTH : 0, + deltaH = e.key === 'ArrowUp' ? -GRIDWIDTH : e.key === 'ArrowDown' ? GRIDWIDTH : 0 + + if (e.shiftKey) { + deltaW *= 5 + deltaH *= 5 + } + + this.resizeWidget(deltaW, deltaH) + + break + + case 'up': + case 'down': + case 'right': + case 'left': + if (!this.selectedWidgets.length) return + + if (this.selectedWidgets[0].props.top === undefined && e.key.match(/Arrow(Up|Down)/)) return + if (this.selectedWidgets[0].props.left === undefined && e.key.match(/Arrow(Left|Right)/)) return + + var deltaX = e.key === 'ArrowLeft' ? -GRIDWIDTH : e.key === 'ArrowRight' ? GRIDWIDTH : 0, + deltaY = e.key === 'ArrowUp' ? -GRIDWIDTH : e.key === 'ArrowDown' ? GRIDWIDTH : 0 + + if (e.shiftKey) { + deltaX *= 5 + deltaY *= 5 + } + + this.moveWidget(deltaX, deltaY) + + break + + case 'mod + shift + a': + if (!this.selectedWidgets.length) return + this.unselect() + this.selectedWidgets = [] + break + + case 'mod + a': + if (!this.selectedWidgets.length) return + + var curWidget1 = this.selectedWidgets[0] + + if (curWidget1.parent !== widgetManager) { + this.select([...curWidget1.parent.children]) + } + break + + case 'mod + up': + case 'mod + down': + case 'mod + right': + case 'mod + left': + if (!this.selectedWidgets.length) return + + var curWidget = this.selectedWidgets[0], + toSelect = null + + if (e.key === 'ArrowUp' && curWidget.parent !== widgetManager) { + + toSelect = curWidget.parent + + } else if (e.key === 'ArrowDown') { + + let toSelectList = [...curWidget.children] + + if (toSelectList && toSelectList.length) { + toSelectList.sort((a,b) => a.container.offsetLeft>b.container.offsetLeft) + toSelect = toSelectList[0] + if (toSelect.container.classList.contains('not-editable')) { + toSelect = null + } + } + + } + else if((e.key == 'ArrowLeft') || (e.key == 'ArrowRight')){ + + if (curWidget.parent === widgetManager) return + + let toSelectList = [...curWidget.parent.children] + + if (toSelectList && toSelectList.length) { + toSelectList.sort((a,b) => a.container.offsetLeft > b.container.offsetLeft) + var idx = toSelectList.indexOf(curWidget) + if (idx >= 0) { + var nextIdx = (idx + (e.key === 'ArrowLeft' ? -1 : 1 ) + toSelectList.length) % toSelectList.length + toSelect = toSelectList[nextIdx] + } + } + } + + if (toSelect) { + this.select(toSelect) + } + + break + + case 'f2': + var input = DOM.get(this.form, 'textarea[name="label"]')[0] + if (input) { + var folded = input.closest('.category.folded') + if (folded) DOM.dispatchEvent(DOM.get(folded, '.separator'), 'fast-click') + input.focus() + input.setSelectionRange(0, input.value.length) + } + break + + } + + + } + + enable() { + + if (READ_ONLY) return + + EDITING = true + this.enabled = true + + DOM.get('.editor-root')[0].setAttribute('data-widget', DOM.get('.root-container')[0].getAttribute('data-widget')) + DOM.get('.editor-root')[0].classList.remove('disabled') + DOM.get('.disable-editor')[0].classList.remove('on') + DOM.get('.enable-editor')[0].classList.add('on') + document.body.classList.add('editor-enabled') + document.body.classList.toggle('no-grid', GRIDWIDTH == 1) + + + GRIDWIDTH = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--grid-width')) + + var gridForm = html` +
    +
    Grid
    +
    + + +
    +
    + ` + + DOM.each(gridForm, '#grid-width-input', (input)=>{ + DOM.addEventListener(input, 'keyup mouseup change mousewheel', (e)=>{ + setTimeout(()=>{ + var v = Math.max(Math.min(parseInt(input.value), 100), 1) + if (isNaN(v)) return + input.value = v + GRIDWIDTH = v + document.body.classList.toggle('no-grid', GRIDWIDTH == 1) + document.documentElement.style.setProperty('--grid-width', GRIDWIDTH) + }) + }) + }) + + DOM.get(document, '.editor-menu')[0].appendChild(gridForm) + + keyboardJS.setContext('editing') + + document.body.addEventListener('mousemove', this.mouveMoveHandler) + + this.selectarea.enable() + + } + + disable() { + + EDITING = false + this.enabled = false + + this.unselect() + this.selectedWidgets = [] + DOM.get('.editor-root')[0].classList.add('disabled') + DOM.get('.disable-editor')[0].classList.add('on') + DOM.get('.enable-editor')[0].classList.remove('on') + document.body.classList.remove('editor-enabled') + + var gridForm = DOM.get('#grid-width-form')[0] + if (gridForm) gridForm.parentNode.removeChild(gridForm) + + keyboardJS.setContext('global') + + document.body.removeEventListener('mousemove', this.mouveMoveHandler) + + this.selectarea.disable() + + } + + + unselect() { + + DOM.get('#editor')[0].innerHTML = '' + + this.form.innerHTML = '' + + DOM.each(document, '.editing', (element)=>{ + element.classList.remove('editing') + }) + + $('.widget.ui-resizable').resizable('destroy') + $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() + + } + + select(widget, options={}){ + + if (Array.isArray(widget)) { + + this.selectedWidgets = widget + + } else if (options.multi) { + + var sameLevel = false + + while (!sameLevel && widget.parent !== widgetManager) { + let test = true + for (var w of this.selectedWidgets) { + if (w.parent !== widget.parent) test = false + } + sameLevel = test + if (!sameLevel) widget = widget.parent + } + + if (!this.selectedWidgets.includes(widget) && sameLevel) { + + this.selectedWidgets.push(widget) + + } else if (sameLevel && !options.fromLasso){ + + this.selectedWidgets.splice(this.selectedWidgets.indexOf(widget), 1) + + } + + } else { + + this.selectedWidgets = [widget] + + } + + if (!options.fromLasso) this.unselect() + + if (this.selectedWidgets.length > 0 && !options.fromLasso) { + + this.createEditForm() + this.createSelectionBlock() + + } + + } + + + createEditForm(){ + + var widget = this.selectedWidgets[0], + props = this.defaults[widget.props.type], + multi = this.selectedWidgets.length > 1 + + this.form.appendChild(html` +
    + + Widget${multi ? 's' : ''}: ${multi ? this.selectedWidgets.length + ' selected': widget.getProp('id')} + +
    + `) + + let category + + for (let propName in props) { + + let field, + shared = true + + for (var w of this.selectedWidgets) { + if (this.defaults[w.props.type][propName] === undefined) { + shared = false + } + } + + if (!shared) continue + + if (propName.indexOf('_') === 0 && propName !== '_props') { + + if (category) this.form.appendChild(category) + category = html`
    ` + + field = html`
    ${props[propName]}
    ` + + } else if (widget.props[propName] === undefined) { + + continue + + } else { + + if (widget.parent !== widgetManager && widget.parent.getProp('type') === 'strip') { + // special case for widgets in strips + if (propName === 'top' || propName === 'left' || propName === (widget.parent.getProp('horizontal') ? 'height' : 'width')) continue + } + + field = editField(this, widget, propName, props[propName]) + if (!field) continue + + } + + if (category) { + category.appendChild(field) + } else { + this.form.appendChild(field) + } + + } + + if (category) this.form.appendChild(category) + + this.wrapper.appendChild(this.form) + DOM.get('#editor')[0].appendChild(this.wrapper) + + } + + createSelectionBlock(){ + + for (let widget of this.selectedWidgets) { + DOM.each(document, `[data-widget="${widget.hash}"]`, (item)=>{ + item.classList.add('editing') + }) + } + + var widget = this.selectedWidgets[0] + + if (widget.props.height !== undefined || widget.props.width !== undefined) { + + let $container = $(widget.container) + $container.resizable({ + handles: 's, e, se', + helper: 'ui-helper', + resize: (event, ui)=>{ + ui.size.height = Math.round(ui.size.height / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH * PXSCALE + ui.size.width = Math.round(ui.size.width / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH * PXSCALE + }, + stop: (event, ui)=>{ + + var deltaH = ui.size.height - ui.originalSize.height, + deltaW = ui.size.width - ui.originalSize.width + + this.resizeWidget(deltaW, deltaH, ui) + + }, + grid: [GRIDWIDTH * PXSCALE, GRIDWIDTH * PXSCALE] + }) + + } + + if (widget.props.top !== undefined && widget.parent.getProp('type') !== 'strip') { + let $container = $(widget.container) + $container.draggable({ + cursor:'-webkit-grabbing', + drag: (event, ui)=>{ + ui.position.top = Math.round(ui.position.top / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH * PXSCALE + ui.position.left = Math.round(ui.position.left / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH * PXSCALE + }, + stop: (event, ui)=>{ + event.preventDefault() + + var deltaX = (ui.helper.position().left + $container.parent().scrollLeft()) / PXSCALE - widget.container.offsetLeft / PXSCALE, + deltaY = (ui.helper.position().top + $container.parent().scrollTop()) / PXSCALE - widget.container.offsetTop / PXSCALE + + this.moveWidget(deltaX, deltaY) + + ui.helper.remove() + }, + handle:'.ui-draggable-handle, > .label', + grid: [GRIDWIDTH * PXSCALE, GRIDWIDTH * PXSCALE], + helper:()=>{ + return $('
    ').css({height:$container.outerHeight(),width:$container.outerWidth()}) + } + }).append('
    ') + + } + + + } + + mouseMove(e) { + + this.mousePosition.x = Math.round((e.offsetX + e.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH, + this.mousePosition.y = Math.round((e.offsetY + e.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH + + } + + copyWidget() { + + if (!this.selectedWidgets.length) return + + var data = this.selectedWidgets.map((w)=>w.props), + type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget' + + + if (type !== 'widget') return + + this.clipboard = JSON.stringify(data) + + if (data.length == 1) { + this.idClipboard = this.selectedWidgets[0].getProp('id') + } else { + this.idClipboard =null + } + + } + + cutWidget() { + + if (!this.selectedWidgets.length) return + + var type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget', + parent = this.selectedWidgets[0].parent, + index = this.selectedWidgets.map(w => parent.children.indexOf(w)).sort((a,b)=>{return b-a}), + data = this.selectedWidgets.map((w)=>w.props), + removedIndexes = [] + + if (type !== 'widget') return + + this.clipboard = JSON.stringify(data) + + if (data.length == 1) { + this.idClipboard = this.selectedWidgets[0].getProp('id') + } else { + this.idClipboard =null + } + + for (var i of index) { + removedIndexes.push(i) + parent.props.widgets.splice(i,1) + } + + this.select(updateWidget(parent, { + preventSelect: true, + removedIndexes + })) + this.pushHistory({removedIndexes}) + + } + + pasteWidget(x, y, increment) { + + if (!this.selectedWidgets.length || this.clipboard === null) return + + var data = this.selectedWidgets.map((w)=>w.props) + + var pastedData = JSON.parse(this.clipboard), + minTop = Infinity, + minLeft = Infinity + + for (let i in pastedData) { + if (increment) pastedData[i] = incrementWidget(pastedData[i]) + if (!isNaN(pastedData[i]).top && pastedData[i].top < minTop) { + minTop = pastedData[i].top + } + if (!isNaN(pastedData[i]).left && pastedData[i].left < minLeft) { + minLeft = pastedData[i].left + } + } + + for (let i in pastedData) { + + if (!isNaN(pastedData[i].left)) pastedData[i].left = pastedData[i].left - minLeft + x + if (!isNaN(pastedData[i].top)) pastedData[i].top = pastedData[i].top - minTop + y + + } + + data[0].widgets = data[0].widgets || [] + data[0].widgets = data[0].widgets.concat(pastedData) + + var indexes = {addedIndexes: []} + for (let i = 0; i < pastedData.length; i++) { + indexes.addedIndexes.push(data[0].widgets.length - 1 - i ) + } + updateWidget(this.selectedWidgets[0], indexes) + this.pushHistory(indexes) + + } + + pasteWidgetAsClone(x, y) { + + if (!this.selectedWidgets.length) return + + if (this.clipboard === null || !(this.idClipboard && widgetManager.getWidgetById(this.idClipboard).length)) return + + var data = this.selectedWidgets.map((w)=>w.props) + + var clone = {type: 'clone', widgetId: this.idClipboard}, + pastedData = JSON.parse(this.clipboard) + + clone.width = pastedData.width + clone.height = pastedData.width + clone.css = pastedData.css + + + clone.left = x + clone.top = y + + data[0].widgets = data[0].widgets || [] + data[0].widgets.push(clone) + + var indexes = {addedIndexes: [data[0].widgets.length -1]} + updateWidget(this.selectedWidgets[0], indexes) + this.pushHistory(indexes) + + } + + + deleteWidget() { + + if (!this.selectedWidgets.length) return + + var type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget', + parent = this.selectedWidgets[0].parent, + index = this.selectedWidgets.map(w => parent.children.indexOf(w)).sort((a,b)=>{return b-a}), + removedIndexes = [] + + if (this.selectedWidgets[0].getProp('id') === 'root') return + + if (type === 'widget') { + for (let i of index) { + removedIndexes.push(i) + parent.props.widgets.splice(i,1) + } + } else { + for (let i of index) { + removedIndexes.push(i) + parent.props.tabs.splice(i,1) + } + } + + this.select(updateWidget(parent, { + preventSelect: true, + removedIndexes + })) + this.pushHistory({removedIndexes}) + + } + + resizeWidget(deltaW, deltaH, ui) { + + if (!this.selectedWidgets.length) return + + var newWidgets = [] + + for (var i = 0; i < this.selectedWidgets.length; i++) { + + let w = this.selectedWidgets[i], + nW, nH + + if (i === 0 && ui) { + nW = ui.originalSize.width + deltaW + nH = ui.originalSize.height + deltaH + + } else { + nW = w.container.offsetWidth + deltaW + nH = w.container.offsetHeight + deltaH + } + + if (w.props.width !== undefined) { + var newWidth = Math.max(nW, GRIDWIDTH) / PXSCALE + if (typeof w.props.width === 'string' && w.props.width.indexOf('%') > -1) { + w.props.width = (100 * PXSCALE * newWidth / w.container.parentNode.offsetWidth).toFixed(2) + '%' + } else { + w.props.width = newWidth + } + } + + if (w.props.height !== undefined) { + var newHeight = Math.max(nH, GRIDWIDTH) / PXSCALE + if (typeof w.props.height === 'string' && w.props.height.indexOf('%') > -1) { + w.props.height = (100 * PXSCALE * newHeight / w.container.parentNode.offsetHeight).toFixed(2) + '%' + } else { + w.props.height = newHeight + } + } + + if (w.props.width !== undefined || w.props.height !== undefined) newWidgets.push(updateWidget(w, {changedProps: ['width', 'height'], preventSelect: this.selectedWidgets.length > 1})) + + } + + this.pushHistory() + + if (newWidgets.length > 1) this.select(newWidgets, {preventSelect: this.selectedWidgets.length > 1}) + + } + + moveWidget(deltaX, deltaY) { + + if (!this.selectedWidgets.length) return + + var newWidgets = [] + + for (var w of this.selectedWidgets) { + + var newTop = parseInt(w.container.offsetTop) / PXSCALE + deltaY + if (typeof w.props.top === 'string' && w.props.top.indexOf('%') > -1) { + w.props.top = (100 * PXSCALE * newTop / w.container.parentNode.offsetHeight).toFixed(2) + '%' + } else { + w.props.top = newTop + } + var newLeft = parseInt(w.container.offsetLeft) / PXSCALE + deltaX + if (typeof w.props.left === 'string' && w.props.left.indexOf('%') > -1) { + w.props.left = (100 * PXSCALE * newLeft / w.container.parentNode.offsetWidth).toFixed(2) + '%' + } else { + w.props.left = newLeft + } + + newWidgets.push(updateWidget(w, {changedProps: ['top', 'left'], preventSelect: this.selectedWidgets.length > 1})) + + } + + this.pushHistory() + + if (newWidgets.length > 1) this.select(newWidgets) + + } + + + + pushHistory(indexes) { + + this.unsavedSession = true + + if (this.historyState > -1) { + this.history.splice(0, this.historyState + 1) + this.historyState = -1 + } + + var d = diff.diff(this.historySession, sessionManager.session) + + if (d) { + diff.patch(this.historySession, deepCopy(d)) + this.history.unshift([deepCopy(d), indexes]) + if (this.history.length > HISTORY_SIZE) this.history.pop() + } + + } + + clearHistory() { + + this.history = [] + this.historyState = -1 + this.historySession = deepCopy(sessionManager.session) + + } + + undo() { + + if (this.historyState === this.history.length - 1) return + + this.historyState += 1 + + var [patch, indexes] = this.history[this.historyState], + d1 = deepCopy(patch), + d2 = deepCopy(patch) + + diff.unpatch(this.historySession, d1) + diff.unpatch(sessionManager.session, d2) + + this.updateWidgetFromPatch(patch, indexes ? { + addedIndexes: deepCopy(indexes.removedIndexes), + removedIndexes: deepCopy(indexes.addedIndexes), + } : undefined) + + } + + redo() { + + if (this.historyState === -1) return + + var [patch, indexes] = this.history[this.historyState], + d1 = deepCopy(patch), + d2 = deepCopy(patch) + + diff.patch(this.historySession, d1) + diff.patch(sessionManager.session, d2) + + this.updateWidgetFromPatch(patch, indexes ? { + addedIndexes: deepCopy(indexes.addedIndexes), + removedIndexes: deepCopy(indexes.removedIndexes), + } : undefined) + + this.historyState -= 1 + + } + + updateWidgetFromPatch(patch, indexes) { + + var [widget, subpatch] = diffToWidget(widgetManager.getWidgetById('root')[0], patch), + options = {} + + if (indexes) { + options = {...indexes} + } else { + options.changedProps = Object.keys(subpatch) + options.reuseChildren = false + } + + updateWidget(widget, options) + + if (this.selectedWidgets[0] && !widgetManager.widgets[this.selectedWidgets[0].hash]) { + this.unselect() + this.selectedWidgets = [] + } + + } + + + + +} + +var editor = new Editor() + +module.exports = editor + +require('./context-menu') +sessionManager = require('../managers/session') diff --git a/src/client/ui/ui-selectarea.mjs b/src/client/app/editor/select-area.js similarity index 71% rename from src/client/ui/ui-selectarea.mjs rename to src/client/app/editor/select-area.js index 1ef816a7..cfa023f2 100644 --- a/src/client/ui/ui-selectarea.mjs +++ b/src/client/app/editor/select-area.js @@ -1,7 +1,6 @@ -import html from 'nanohtml' -import {DOM} from '../globals.mjs' +var html = require('nanohtml') -class UiSelectArea { +class SelectArea { constructor(selector, callback){ @@ -14,19 +13,20 @@ class UiSelectArea { this.rectSize = [0, 0] this.elements = [] - this.rect = document.body.appendChild(html``) + this.rect = html`` + document.body.appendChild(this.rect) this.selector = selector this.callback = callback - this.boundMousedown = this.mousedown.bind(this) - this.boundMousemove = this.mousemove.bind(this) - this.boundMouseup = this.mouseup.bind(this) + this.bindedMousedown = this.mousedown.bind(this) + this.bindedMousemove = this.mousemove.bind(this) + this.bindedMouseup = this.mouseup.bind(this) } mousedown(e) { - if (!e.shiftKey || event.altKey || event.button === 2 || (event.shiftKey && event.metaKey)) return + if (!e.shiftKey || event.button === 2) return this.startX = this.curX = e.clientX this.startY = this.curY = e.clientY this.down = true @@ -47,7 +47,7 @@ class UiSelectArea { this.down = false if (this.rectSize[0] > 0 && this.rectSize[1] > 0) { - this.callback(this.getElements(), e) + this.callback(this.getElements()) this.rect.classList.add('hidden') } @@ -110,20 +110,20 @@ class UiSelectArea { enable() { - document.addEventListener('pointerdown', this.boundMousedown) - document.addEventListener('pointermove', this.boundMousemove, true) - document.addEventListener('pointerup', this.boundMouseup) + document.addEventListener('mousedown', this.bindedMousedown) + document.addEventListener('mousemove', this.bindedMousemove, true) + document.addEventListener('mouseup', this.bindedMouseup) } disable() { - document.removeEventListener('pointerdown', this.boundMousedown) - document.removeEventListener('pointermove', this.boundMousemove, true) - document.removeEventListener('pointerup', this.boundMouseup) + document.removeEventListener('mousedown', this.bindedMousedown) + document.removeEventListener('mousemove', this.bindedMousemove, true) + document.removeEventListener('mouseup', this.bindedMouseup) } } -export default UiSelectArea +module.exports = SelectArea diff --git a/src/client/events/click.mjs b/src/client/app/events/click.js similarity index 58% rename from src/client/events/click.mjs rename to src/client/app/events/click.js index 44f76794..d3c648f4 100644 --- a/src/client/events/click.mjs +++ b/src/client/app/events/click.js @@ -1,7 +1,4 @@ -import iOS from '../ui/ios.mjs' -import editor from '../editor/index.mjs' -import {DOM, FOCUSABLE, ENV} from '../globals.mjs' - +const iOS = require('../ui/ios') const macOs = (navigator.platform || '').match('Mac') var longTouchTimer = false, @@ -20,18 +17,13 @@ if (macOs) { DOM.dispatchEvent(event.target, 'fast-right-click', event) }) } else { - document.body.addEventListener('contextmenu', (event)=>{ - if ( - event.target && - !event.target.classList.contains('ace_content') && - !event.target.tagName.match(/INPUT|TEXTAREA|OSC-CONSOLE|OSC-CONSOLE-MESSAGE/) - ) event.preventDefault() - }) + document.body.setAttribute('oncontextmenu', 'return false') } function mouseToFastClick(event) { - if (event.pointerType === 'touch') return + if (event.touchPunch) return + if (event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) return if (event.button == 2) event.preventDefault() var e = event @@ -40,19 +32,12 @@ function mouseToFastClick(event) { DOM.dispatchEvent(e.target, name, e) - if (!FOCUSABLE && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { - console.debug('ELECTRON.BLUR()') - } - } function touchToFastClick(event) { var e = event.changedTouches[0] - e.shiftKey = event.shiftKey - e.ctrlKey = event.ctrlKey - DOM.dispatchEvent(e.target, 'fast-click', e) if (e.preventOriginalEvent) event.preventDefault() @@ -70,13 +55,9 @@ function touchToFastClick(event) { }, 600) - if (ENV.nofocus && !editor.enabled && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { - console.debug('ELECTRON.BLUR()') - } - } -if (!iOS) document.addEventListener('pointerdown', mouseToFastClick, true) +if (!iOS) document.addEventListener('mousedown', mouseToFastClick, true) document.addEventListener('touchstart', touchToFastClick, {passive: false, capture: true}) diff --git a/src/client/app/events/drag.js b/src/client/app/events/drag.js new file mode 100644 index 00000000..922f2058 --- /dev/null +++ b/src/client/app/events/drag.js @@ -0,0 +1,303 @@ +const {normalizeDragEvent, resetEventOffset, TRAVERSING_SAMEWIDGET} = require('./utils') +const iOS = require('../ui/ios') + +var targets = {}, + previousPointers = {} + +function pointerDownHandler(event) { + + if (event.capturedByEditor || event.touchPunch) return + + if (!event.multitouch) { + for (var i in targets) { + if (targets[i] == event.target) return + } + } + + event = normalizeDragEvent(event) + + targets[event.pointerId] = event.target + + if (event.traversing === TRAVERSING_SAMEWIDGET) { + event.traversingType = event.target.closest('.drag-event')._drag_widget.getProp('type') + } + + previousPointers[event.pointerId] = event + + triggerWidgetEvent(targets[event.pointerId], 'draginit', event) + +} + +function pointerMoveHandler(event) { + + event = normalizeDragEvent(event, previousPointers[event.pointerId]) + + event.stopPropagation = true + + if (event.traversing) { + + var previousTarget = targets[event.pointerId], + target = event.isTouch ? + document.elementFromPoint(event.clientX, event.clientY) + : event.target + + if (target) target = target.closest('.drag-event') + + if ( + target && event.traversing === TRAVERSING_SAMEWIDGET + && event.traversingType !== target._drag_widget.getProp('type') + ) { + target = null + } + + if (target && event.isTouch) { + resetEventOffset(event, target) + } + + if (previousTarget !== target) { + triggerWidgetEvent(previousTarget, 'dragend', event) + } + + + if (target) { + if (event.traversingContainer.contains(target)) { + triggerWidgetEvent(target, previousTarget !== target ? 'draginit' : 'drag', event) + } + } + + targets[event.pointerId] = target + + + } else { + triggerWidgetEvent(targets[event.pointerId], 'drag', event) + } + + previousPointers[event.pointerId] = event + +} + +function pointerUpHandler(event) { + + event = normalizeDragEvent(event, previousPointers[event.pointerId]) + + triggerWidgetEvent(targets[event.pointerId], 'dragend', event) + + delete targets[event.pointerId] + delete previousPointers[event.pointerId] + +} + + +// Move / Up Filter + +function pointerMoveFilter(event) { + + if (targets[event.pointerId] !== undefined) { + pointerMoveHandler.call(targets[event.pointerId], event) + } + +} + +function pointerUpFilter(event) { + + if (targets[event.pointerId] !== undefined) { + pointerUpHandler.call(targets[event.pointerId], event) + delete targets[event.pointerId] + } + +} + +// Mouse events wrappers + +function mouseMultiWrapper(event) { + mouseDownCapture(event, true) +} + +function mouseDownCapture(event, multitouch) { + if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return + event.pointerId = 'mouse' + event.multitouch = multitouch + pointerDownHandler(event) +} + +function mouseMoveCapture(event) { + event.pointerId = 'mouse' + event.inertia = event.ctrlKey ? 10 : 1 + pointerMoveFilter(event) +} + +function mouseUpCapture(event){ + if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return + event.pointerId = 'mouse' + pointerUpFilter(event) +} + + +// Touch events wrappers + +function touchMultiWrapper(event) { + touchDownCapture(event, true) +} + +function touchDownCapture(event, multitouch) { + event.preventDefault() + for (var i in event.changedTouches) { + if (isNaN(i) || !event.changedTouches[i]) continue + var touchEvent = event.changedTouches[i] + + if (event.traversing) { + touchEvent.traversing = event.traversing + touchEvent.traversingContainer = event.traversingContainer + } + + touchEvent.pointerId = touchEvent.identifier + touchEvent.multitouch = multitouch + + pointerDownHandler(touchEvent) + } +} + +function touchMoveCapture(event) { + for (var i in event.changedTouches) { + if (isNaN(i) || !event.changedTouches[i]) continue + var touchEvent = event.changedTouches[i] + + var fingers = 0 + for (var j in event.touches) { + if (event.touches[j].target && event.touches[j].target.isSameNode(touchEvent.target)) { + fingers += 1 + if (fingers == 2) { + touchEvent.inertia = 10 + break + } + } + } + + touchEvent.pointerId = touchEvent.identifier + pointerMoveFilter(touchEvent) + } +} + +function touchUpCapture(event) { + for (var i in event.changedTouches) { + if (isNaN(i) || !event.changedTouches[i]) continue + var touchEvent = event.changedTouches[i] + touchEvent.pointerId = touchEvent.identifier + pointerUpFilter(touchEvent) + } +} + +// Callback trigger + +function triggerWidgetEvent(target, name, event) { + if (target !== null && target._drag_widget) { + target._drag_widget.trigger(name, event) + } else if (target !== null) { + triggerWidgetEvent(target.closest('.drag-event'), name, event) + } +} + +// init + +DOM.ready(()=>{ + + if (!iOS) document.addEventListener('mousemove', mouseMoveCapture, true) + if (!iOS) document.addEventListener('mouseup', mouseUpCapture, true) + document.addEventListener('touchmove', touchMoveCapture, true) + DOM.addEventListener(document, 'touchend touchcancel', touchUpCapture, true) + +}) + +module.exports = { + + setup: function(options) { + + if ( + this._customBindings['drag'] !== 0 || + this._customBindings['draginit'] !== 0 || + this._customBindings['dragend'] !== 0 || + !options + ) { + return + } + + var {element, multitouch} = options + + element._drag_widget = this + element.style.touchAction = 'none' + element.classList.add('drag-event') + + if (multitouch) { + element.addEventListener('touchstart', touchMultiWrapper, false) + if (!iOS) element.addEventListener('mousedown', mouseMultiWrapper) + } else { + element.addEventListener('touchstart', touchDownCapture, false) + if (!iOS) element.addEventListener('mousedown', mouseDownCapture) + } + + }, + + teardown: function(options) { + + if ( + this._customBindings['drag'] !== 0 || + this._customBindings['draginit'] !== 0 || + this._customBindings['dragend'] !== 0 || + !options + ) { + return + } + + var {element, multitouch} = options + + delete element._drag_widget + element.style.touchAction = '' + element.classList.remove('drag-event') + + if (multitouch) { + element.removeEventListener('touchstart', touchMultiWrapper, false) + if (!iOS) element.removeEventListener('mousedown', mouseMultiWrapper) + } else { + element.removeEventListener('touchstart', touchDownCapture, false) + if (!iOS) element.removeEventListener('mousedown', mouseDownCapture) + } + + }, + + enableTraversingGestures: function(element, options={}) { + + if (element._traversing) return + + var traversing = options.smart ? TRAVERSING_SAMEWIDGET : true + + element._traversing = traversing + + function makeEventTraversing(event) { + if (event.ctrlKey) return + event.traversing = traversing + if (!event.traversingContainer) event.traversingContainer = element + } + + if (!iOS) element.addEventListener('mousedown', makeEventTraversing, true) + element.addEventListener('touchstart', makeEventTraversing, true) + + element.addEventListener('disableTraversingGestures', ()=>{ + + if (!iOS) element.removeEventListener('mousedown', makeEventTraversing, true) + element.removeEventListener('touchstart', makeEventTraversing, true) + + }) + + }, + + disableTraversingGestures: function(element) { + + if (!element._traversing) return + + delete element._traversing + + DOM.dispatchEvent(element, 'disableTraversingGestures') + + } + +} diff --git a/src/client/events/event-emitter.mjs b/src/client/app/events/event-emitter.js similarity index 82% rename from src/client/events/event-emitter.mjs rename to src/client/app/events/event-emitter.js index 8e0f020d..1cdffd61 100644 --- a/src/client/events/event-emitter.mjs +++ b/src/client/app/events/event-emitter.js @@ -1,25 +1,13 @@ -import domEvent from './dom-event.mjs' -import * as drag from './drag.mjs' -import * as resize from './resize.mjs' - -var customEvents = { - 'draginit': drag, - 'drag': drag, - 'dragend': drag, - 'resize': resize, - 'wheel': domEvent('wheel'), - 'scroll': domEvent('scroll', {capture: true}), - 'click': domEvent('click'), - 'fast-click': domEvent('fast-click'), - 'focus': domEvent('focus', {capture: true}), - 'blur': domEvent('blur', {capture: true}), - 'change': domEvent('change') -} +var customEvents = {} +setTimeout(()=>{ + customEvents['draginit'] = customEvents['drag'] = customEvents['dragend'] = require('./drag') + customEvents['resize'] = require('./resize') +}) // micro optimisation from eventemitter3 var has = Object.prototype.hasOwnProperty -export default class EventEmitter { +module.exports = class EventEmitter { constructor() { @@ -43,8 +31,6 @@ export default class EventEmitter { } // Event bubbling - // DOM events won't bubble - // Virtual events will unless data.stopPropagation is set if (!data || !data.stopPropagation) { if (this.parent) this.parent.trigger(evt, data) } diff --git a/src/client/app/events/resize.js b/src/client/app/events/resize.js new file mode 100644 index 00000000..f7cf8f9a --- /dev/null +++ b/src/client/app/events/resize.js @@ -0,0 +1,64 @@ +var elements = [] + +function checkResizes(context, force){ + // Iterate over all elements to which the 'resize' event is bound. + var resizedElems = [], + cachedStyles = [] + for (let i = elements.length - 1; i >= 0; i--) { + var elem = elements[i] + + if (!context.contains(elem)) continue + + var style = window.getComputedStyle(elem), + width = parseInt(style['width']) - parseInt(style['padding-left']) - parseInt(style['padding-right']), + height = parseInt(style['height']) - parseInt(style['padding-top']) - parseInt(style['padding-bottom']) + + if (!width || !height) continue + + // If element size has changed since the last time, update the element + // data store and trigger the 'resize' event. + if (force || width != elem.resizedataw || height != elem.resizedatah) { + elem.resizedataw = width + elem.resizedatah = height + resizedElems.push(elem) + cachedStyles.push(style) + } + } + for (let i = resizedElems.length - 1; i >= 0; i--) { + resizedElems[i]._resize_widget.trigger('resize', { + width: resizedElems[i].resizedataw, + height: resizedElems[i].resizedatah, + style:cachedStyles[i], + stopPropagation: true + }) + } + +} + +window.addEventListener('resize', ()=>{checkResizes(document)}) + +module.exports = { + + setup: function(options) { + + if (!options) return + if (elements.indexOf(options.element) == -1) { + elements.push(options.element) + options.element._resize_widget = this + } + + }, + teardown: function(options) { + + if (!options) return + + if (elements.indexOf(options.element) != -1) { + elements.splice(elements.indexOf(options.element), 1) + delete options.element._resize_widget + } + + }, + + check: checkResizes + +} diff --git a/src/client/app/events/utils.js b/src/client/app/events/utils.js new file mode 100644 index 00000000..52cfc87a --- /dev/null +++ b/src/client/app/events/utils.js @@ -0,0 +1,92 @@ +const Touch = window.Touch || class Touch {} + +module.exports = { + + fix: function(e) { + + return { + + target: e.target, + offsetX: e.offsetX, + offsetY: e.offsetY, + pageX: e.pageX, + pageY: e.pageY, + clientX: e.clientX, + clientY: e.clientY, + movementX: e.movementX, + movementY: e.movementY, + pointerId: e.pointerId, + pointerType: e.pointerType, + button: e.button, + ctrlKey: e.ctrlKey, + shiftKey: e.shiftKey, + inertia: e.multitouch ? 1 : e.inertia, + traversing: e.traversing, + traversingType: e.traversingType, + traversingContainer: e.traversingContainer, + multitouch: e.multitouch, + isTouch: e instanceof Touch + } + }, + + normalizeDragEvent: function(event, previousEvent) { + + event = module.exports.fix(event) + + if (event.movementX === undefined) { + + event.movementX = previousEvent ? event.pageX - previousEvent.pageX : 0 + event.movementY = previousEvent ? event.pageY - previousEvent.pageY : 0 + + } + + if (event.isTouch && !previousEvent) { + + module.exports.resetEventOffset(event, event.target) + + } else if (event.isTouch && previousEvent) { + + event.offsetX = previousEvent.offsetX + event.movementX + event.offsetY = previousEvent.offsetY + event.movementY + + } + + if (event.inertia === undefined) { + + event.inertia = 1 + + } + + if (previousEvent) { + + if (previousEvent.traversing) { + event.traversing = previousEvent.traversing + event.traversingType = previousEvent.traversingType + event.traversingContainer = previousEvent.traversingContainer + } + + if (previousEvent.multitouch) { + event.multitouch = previousEvent.multitouch + event.inertia = 1 + } + + } + + + + return event + + }, + + resetEventOffset: function(event, target) { + + var off = DOM.offset(target) + + event.offsetX = event.pageX - off.left + event.offsetY = event.pageY - off.top + + }, + + TRAVERSING_SAMEWIDGET: 1 + +} diff --git a/src/client/app/globals.js b/src/client/app/globals.js new file mode 100644 index 00000000..c64567bf --- /dev/null +++ b/src/client/app/globals.js @@ -0,0 +1,42 @@ +window.ARGV = {} +location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (s,k,v)=>{ + ARGV[k]=v +}) + +window.ELECTRON_NOGPU = window.ELECTRON_NOGPU || false +window.ELECTRON_FULLSCREEN = window.ELECTRON_FULLSCREEN || false + +window.LANG = ARGV.lang === 'debug' ? 'debug' : (ARGV.lang || navigator.language || '').substr(0, 2).toLowerCase() + +window.PACKAGE = require('../../../package.json') +document.title = PACKAGE.productName + ' v' + PACKAGE.version + +window.LOADING = null + + +window.CLIPBOARD = null + +window.READ_ONLY = false +window.EDITING = false +window.GRIDWIDTH = 10 + + +window.CANVAS_FRAMERATE = parseFloat(ARGV.framerate || 60) +window.CANVAS_SCALING = parseFloat(ARGV.forceHdpi) || ( ARGV.hdpi ? window.devicePixelRatio : 1 ) +window.INITIALZOOM = ARGV.zoom ? ARGV.zoom : 1 +window.PXSCALE = INITIALZOOM +document.documentElement.style.setProperty('font-size', PXSCALE + 'px') + +window.DOUBLE_TAP_TIME = ARGV.doubletap ? ARGV.doubletap : 375 + + +window.JSON.parseFlex = require('json5').parse + +window.DOM = require('./dom') + +window.$ = require('jquery/dist/jquery.slim.min.js') + +require('../libs/jquery.ui') +require('../libs/jquery.touch') + +require('cardinal-spline-js/curve.min.js') diff --git a/src/client/app/ipc/callbacks.js b/src/client/app/ipc/callbacks.js new file mode 100644 index 00000000..36914248 --- /dev/null +++ b/src/client/app/ipc/callbacks.js @@ -0,0 +1,214 @@ +var utils = require('../ui/utils'), + osc = require('../osc'), + session = require('../managers/session'), + widgetManager = require('../managers/widgets'), + state = require('../managers/state'), + editor = require('../editor/'), + locales = require('../locales'), + {deepCopy} = require('../utils'), + sidepanel = require('../ui/sidepanel'), + notifications = require('../ui/notifications'), + {TRAVERSING_SAMEWIDGET} = require('../events/utils'), + raw = require('nanohtml/raw'), + ipc = require('./'), + windowTitle = document.title + +module.exports = { + + bundle: function(data) { + for (let i in data) { + osc.receive(data[i]) + } + }, + + receiveOsc: function(data){ + osc.receive(data) + }, + + connected:function(){ + LOADING.close() + }, + + sessionList: function(data){ + + session.list(data) + + }, + + sessionOpen: function(data){ + + session.open(data) + + }, + + sessionNew: function(){ + + session.create() + + }, + + sessionSaved: function(data){ + + editor.unsavedSession = false + + }, + + stateLoad: function(data){ + + state.load(data.state, data.send, data.path) + + }, + + stateSend:function(){ + notifications.add({ + icon: 'wifi', + message: locales('loading_newclient') + }) + + setTimeout(function(){ + + osc.syncOnly = true + state.send() + osc.syncOnly = false + + },200) + + }, + + editorDisable: function(data){ + + editor.disable(data.permanent) + + }, + + error: function(data){ + new utils.Popup({title: raw(utils.icon('exclamation-triangle') + '  ' + locales('error')), content: raw(data), closable:true}) + }, + + reloadCss: function(){ + var queryString = '?reload=' + Date.now() + DOM.each(document, 'link[rel="stylesheet"][hot-reload]', (el)=>{ + el.href = el.href.replace(/\?.*|$/, queryString) + }) + + setTimeout(()=>{ + var root = widgetManager.getWidgetById('root')[0] + if (root) root.reCreateWidget() + },100) + + + GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue('--grid-width') + }, + + readOnly: function(){ + READ_ONLY = true + $('.editor-menu .btn').remove() + $('.editor-menu .title').addClass('disabled') + if (editor.enabled) editor.disable() + }, + + reload: function(){ + + var id = Math.random(), + search = location.search, + query = 'backupId=' + id + + // disable editor's warning + window.onbeforeunload = null + + if (!session.session) { + window.location.href = window.location.href + return + } + + try { + + // store session & state backup + ipc.send('storeBackup', { + backupId: id, + session: session.session || {}, + sessionPath: session.sessionPath, + state: state.get(), + history: editor.history, + historyState: editor.historyState, + editorEnabled: editor.enabled, + sidepanelOpened: document.getElementById('sidepanel').classList.contains('sidepanel-open'), + traversing: document.getElementById('container')._traversing + }) + + // reload page and hold backup id + + if (search) { + if (search.includes('backupId=')) { + search = search.replace(/backupId=[^&]*/, query) + } else { + search += '&' + query + } + } else { + search += '?' + query + } + + window.location.search = search + + } catch(e) { + + window.location.href = window.location.href + + } + + }, + + loadBackup: function(data) { + + session.load(data.session, ()=>{ + + state.set(data.state, false) + + editor.historySession = deepCopy(data.session) + editor.history = data.history + editor.historyState = data.historyState + if (data.editorEnabled) editor.enable() + + if (data.sidepanelOpened) sidepanel.open() + + if (data.traversing === TRAVERSING_SAMEWIDGET) { + DOM.get('.traversingSmart')[0].click() + } else if (data.traversing) { + DOM.get('.traversingEnable')[0].click() + } + + ipc.send('sessionSetPath', {path: data.sessionPath}) + session.setSessionPath(data.sessionPath) + ipc.send('deleteBackup', data.backupId) + + }) + + }, + + notify: function(data) { + + var message = data.message || '' + + if (data.locale) message = locales(data.locale) + message + + notifications.add({ + icon: data.icon, + class: data.class, + message: message + }) + + }, + + setTitle: function(data) { + + document.title = windowTitle + (data ? ' (' + data + ')' : '') + + }, + + serverTargets: function(data) { + + if (data) osc.serverTargets = data + + } + +} diff --git a/src/client/ipc/index.mjs b/src/client/app/ipc/index.js similarity index 54% rename from src/client/ipc/index.mjs rename to src/client/app/ipc/index.js index 9a3d4275..67282892 100644 --- a/src/client/ipc/index.mjs +++ b/src/client/app/ipc/index.js @@ -1,30 +1,14 @@ -import {nanoid} from 'nanoid' -import EventEmitter from '../events/event-emitter.mjs' -import cache from '../managers/cache.mjs' -import {ENV} from '../globals.mjs' +var EventEmitter = require('../events/event-emitter'), + uuid = require('nanoid/generate')('0123456789abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10), + notifications, + locales -var notifications, locales, callbacks +setTimeout(()=>{ + notifications = require('../ui/notifications') + locales = require('../locales') +}) -var loadDeps = (async()=>{ - notifications = (await import('../ui/notifications.mjs')).default - locales = (await import('../locales/index.mjs')).default - callbacks = (await import('./callbacks.mjs')).default - - // wait for other js chunks too since we'll connect to the server once this provise resolves - await import('../editor/context-menu.mjs') - await import('../remote-control.mjs') - await import('../ui/ui-keyboard.mjs') -})() - -var uuid, localUuid = ENV.id || cache.get('uuid', false) -if (localUuid) { - uuid = localUuid -} else { - uuid = nanoid(10) - cache.set('uuid', uuid, false) -} - -var reconnectTimeout = 500, +var reconnectTimeout = 2000, hearbeatInterval = 5000, hearbeatTimeout = 3000, protocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://' @@ -40,9 +24,7 @@ class Ipc extends EventEmitter { this.queue = [] this.disconnected = false - - this.reconnectTimeout = undefined - this.disconnectTimeout = undefined + this.reconnect = undefined this.hearbeat = undefined this.hearbeatTimeout = undefined @@ -53,38 +35,34 @@ class Ipc extends EventEmitter { this.socket.send('["pong"]') }) - document.cookie = 'client_id=' + uuid + ';samesite=strict' + document.cookie = 'client_id=' + uuid + + try { + this.open() + } catch(e) { + console.warn('Could not open a WebSocket connection') + console.log(e) + } } - init(callback) { + init() { - loadDeps.then(()=>{ + var callbacks = require('./callbacks') - for (let i in callbacks) { - let callback = callbacks[i] - this.on(i, (data)=>{ - callback(data) - }) - } - - try { - this.open() - } catch(e) { - console.warn('Could not open a WebSocket connection') - console.log(e) - } - - callback() - - }) + for (let i in callbacks) { + let callback = callbacks[i] + this.on(i, (data)=>{ + callback(data) + }) + } } open() { - this.socket = new WebSocket(protocol + window.location.host + '/' + uuid + '/' + window.AUTH) + this.socket = new WebSocket(protocol + window.location.host + '/' + uuid) this.socket.onclose = this.socket.onerror = ()=>{ if (!this.connected()) this.close() @@ -102,13 +80,10 @@ class Ipc extends EventEmitter { if (notifications && this.disconnected) notifications.add({ icon: 'wifi', - class: 'server-connected', message: locales('server_connected'), id: 'ipc_state' }) - this.disconnected = false - this.trigger('connect') this.flush() @@ -131,23 +106,18 @@ class Ipc extends EventEmitter { clearInterval(this.hearbeat) clearTimeout(this.hearbeatTimeout) - clearTimeout(this.disconnectTimeout) - this.disconnectTimeout = setTimeout(()=>{ - // delay notification in case reconnection succeeds quickly - if (notifications && !this.connected()) notifications.add({ - icon: 'wifi', - class: 'error', - message: locales('server_disconnected'), - id: 'ipc_state', - duration: Infinity - }) - this.disconnected = true + notifications.add({ + icon: 'wifi', + class: 'error', + message: locales('server_disconnected'), + id: 'ipc_state', + duration: Infinity + }) - }, reconnectTimeout * 2) + this.disconnected = true - - clearTimeout(this.reconnectTimeout) - this.reconnectTimeout = setTimeout(()=>{ + clearTimeout(this.reconnect) + this.reconnect = setTimeout(()=>{ this.open() }, reconnectTimeout) @@ -203,4 +173,4 @@ class Ipc extends EventEmitter { var ipc = new Ipc() -export default ipc +module.exports = ipc diff --git a/src/client/app/locales/en.js b/src/client/app/locales/en.js new file mode 100644 index 00000000..b0e68112 --- /dev/null +++ b/src/client/app/locales/en.js @@ -0,0 +1,84 @@ +module.exports = { + + // editor + editor_on: 'On', + editor_off: 'Off', + editor_root: 'Root', + editor_load: 'Open', + editor_save: 'Save', + editor_save_as: 'Save as...', + editor_import: 'Import', + editor_export: 'Export', + + + // editor context-menu + editor_editparent: 'Edit parent', + editor_copy: 'Copy', + editor_cut: 'Cut', + editor_wrap: 'Wrap in', + editor_paste: 'Paste', + editor_pasteindent: 'ID + 1', + editor_clone: 'Clone', + editor_addwidget: 'Add widget', + editor_addtab: 'Add tab', + editor_delete: 'Delete', + editor_click_for_help: 'Click on the property name to display help', + + // loadings + loading_upload: 'Uploading file...', + loading_newclient: 'New client connecting...', + loading_server: 'Connecting server...', + loading_session: 'Loading session...', + + // fullscreen error + fs_unnavailable: 'Fullscreen not available', + fs_addtohome: 'You must add this page to your home screen to launch it in fullscreen', + + // remote save + remotesave_open: 'Open (on the server)', + remotesave_save: 'Save (on the server)', + remotesave_overwrite: 'This file already exists, do you want to overwrite it ?', + remotesave_fail: 'The file could not be saved on the server, use "export" instead', + remotesave_success: 'File saved successfully', + remotesave_forbidden: 'You\'re note allowed to save on server, use "export instead"', + + // server + server_disconnected: 'The connection to the server has been interrupted', + server_connected: 'The connection to the server has been restored', + + // session + session_browse: 'Browse...', + session_new: 'New session', + session_malformed: 'Malformed session file.', + session_parsingerror: 'Parsing error.', + session_uploaderror: 'Failed to upload session file.', + session_unsaved: 'Your changes will be lost if you close this session without saving, continue ?', + + // sidepanel + sidepanel_fs: 'Fullscreen', + sidepanel_nosleep: 'Stay awake', + sidepanel_state: 'State', + sidepanel_traversing: 'Traversing gestures', + sidepanel_editor: 'Editor', + + // state + state_store: 'Store', + state_recall: 'Recall', + state_send: 'Send All', + state_import: 'Import', + state_export: 'Export', + state_uploaderror: 'Failed to upload state file.', + state_storesuccess: 'State saved', + state_recallsuccess: 'State recalled', + state_sendsuccess: 'State sent', + + // traversing + traversing_on: 'On', + traversing_smart: 'Smart', + traversing_off: 'Off', + + // misc + error: 'Error' + + +} diff --git a/src/client/app/locales/fr.js b/src/client/app/locales/fr.js new file mode 100644 index 00000000..438f15ea --- /dev/null +++ b/src/client/app/locales/fr.js @@ -0,0 +1,83 @@ +module.exports = { + + // editor + editor_on: 'On', + editor_off: 'Off', + editor_root: 'Root', + editor_load: 'Ouvrir', + editor_save: 'Enregistrer', + editor_save_as: 'Enregistrer sous...', + editor_import: 'Importer', + editor_export: 'Exporter', + + // editor context-menu + editor_editparent: 'Éditer parent', + editor_copy: 'Copier', + editor_cut: 'Couper', + editor_wrap: 'Grouper dans', + editor_paste: 'Coller', + editor_pasteindent: 'ID + 1', + editor_clone: 'Clone', + editor_addwidget: 'Nouveau widget', + editor_addtab: 'Nouvel onglet', + editor_delete: 'Supprimer', + editor_click_for_help: 'Cliquer sur le nom de la propriété pour afficher l\'aide', + + // loadings + loading_upload: 'Téléversement...', + loading_newclient: 'Connexion d\'un nouveau client...', + loading_server: 'Connexion au serveur...', + loading_session: 'Chargement de la session...', + + // fullscreen error + fs_unnavailable: 'Plein écran indisponible', + fs_addtohome: 'Vous devez ajouter cette page à votre écran d\'accueil pour pouvoir l\'ouvrir en plein écran.', + + // remote save + remotesave_open: 'Ouvrir (sur le serveur)', + remotesave_save: 'Enregistrer (sur le serveur)', + remotesave_overwrite: 'Un fichier du même nom existe déjà, voulez le remplacer ?', + remotesave_fail: 'Le fichier n\'a pas pu être enregistré sur le serveur, utilisez la fonction "exporter"', + remotesave_success: 'Le fichier a été enregistré avec succès', + remotesave_forbidden: 'Vous n\'êtes pas autorisé à sauvegarder sur le serveur, utilisez la fonction "exporter"', + + // server + server_disconnected: 'La connexion avec le serveur a été interrompue', + server_connected: 'La connexion avec le serveur a été rétablie', + + // session + session_browse: 'Parcourir...', + session_new: 'Nouvelle session', + session_malformed: 'Fichier de session mal formé.', + session_parsingerror: 'Erreur à l\'ouverture de la session.', + session_uploaderror: 'Échec à l\'envoi du fichier de session.', + session_unsaved: 'Vos modifications seront perdues si vous fermez la session actuelle sans sauvegarder, continuer ?', + + // sidepanel + sidepanel_fs: 'Plein Écran', + sidepanel_nosleep: 'Rester allumé', + sidepanel_state: 'État', + sidepanel_traversing: 'Gestes traversants', + sidepanel_editor: 'Éditeur', + + // state + state_store: 'Sauver', + state_recall: 'Rappeler', + state_send: 'Envoyer', + state_import: 'Importer', + state_export: 'Exporter', + state_uploaderror: 'Échec à l\'envoi du fichier d\'état.', + state_storesuccess: 'État de l\'interface sauvegardé', + state_recallsuccess: 'État de l\'interface restauré', + state_sendsuccess: 'État de de l\'interface envoyé', + + // traversing + traversing_on: 'On', + traversing_smart: 'Auto', + traversing_off: 'Off', + + // misc + error: 'Erreur' + + +} diff --git a/src/client/app/locales/index.js b/src/client/app/locales/index.js new file mode 100644 index 00000000..6b1305ee --- /dev/null +++ b/src/client/app/locales/index.js @@ -0,0 +1,10 @@ +var locales = { + debug: {/* empty */}, + en: require('./en'), + fr: require('./fr'), + ru: require('./ru') +} + +var lang = locales[LANG] ? LANG : 'en' + +module.exports = key=>locales[lang][key] || `!${key}!` diff --git a/src/client/app/locales/ru.js b/src/client/app/locales/ru.js new file mode 100644 index 00000000..13152b9e --- /dev/null +++ b/src/client/app/locales/ru.js @@ -0,0 +1,83 @@ +module.exports = { // @https://github.com/suhr + + // editor + editor_on: 'Вкл', + editor_off: 'Выкл', + editor_root: 'Корень', + editor_load: 'Загрузить', + editor_save: 'Сохранить', + editor_save_as: 'Экспорт', + editor_import: 'Import', + editor_export: 'Export', + + // editor context-menu + editor_editparent: 'К родителю', + editor_copy: 'Копировать', + editor_cut: 'Вырезать', + editor_wrap: 'Обернуть в', + editor_paste: 'Вставить', + editor_pasteindent: 'ID + 1', + editor_clone: 'Клон', + editor_addwidget: 'Добавить виджет', + editor_addtab: 'Добавить вкладку', + editor_delete: 'Удалить', + editor_click_for_help: 'Нажмите на название свойства, чтобы отобразить справку', + + // loadings + loading_upload: 'Загрузка файла...', + loading_newclient: 'Подключается новый клиент...', + loading_server: 'Соединение с сервером...', + loading_session: 'Загрузка сессии...', + + // fullscreen error + fs_unnavailable: 'Полный экран не доступен', + fs_addtohome: 'Необходимо добавить эту страницу на главный экран чтобы запустить её в полноэкранном режиме', + + // remote save + remotesave_open: 'Open (on the server)', + remotesave_save: 'Save (on the server)', + remotesave_overwrite: 'This file already exists, do you want to overwrite it ?', + remotesave_fail: 'The file could not be saved on the server, use "export" instead', + remotesave_success: 'File saved successfully', + remotesave_forbidden: 'You\'re note allowed to save on server, use "export instead"', + + // server + server_disconnected: 'The connection to the server has been interrupted', + server_connected: 'The connection to the server has been restored', + + // session + session_browse: 'Обзор...', + session_new: 'Новая сессия', + session_malformed: 'Файл сессии повреждён.', + session_parsingerror: 'Ошибка разбора.', + session_uploaderror: 'Не удалось загрузить файл сессии.', + session_unsaved: 'Your changes will be lost if you close this session without saving, continue ?', + + // sidepanel + sidepanel_fs: 'Полный экран', + sidepanel_nosleep: 'бодрствовать', + sidepanel_state: 'Состояние', + sidepanel_traversing: 'Скользящие жесты', + sidepanel_editor: 'Редактор', + + // state + state_store: 'Запомнить', + state_recall: 'Вспомнить', + state_send: 'Отправить всё', + state_import: 'Импорт', + state_export: 'Экспорт', + state_uploaderror: 'Не удалось загрузить файл состояния.', + state_storesuccess: 'State saved', + state_recallsuccess: 'State recalled', + state_sendsuccess: 'State sent', + + // traversing + traversing_on: 'Вкл', + traversing_smart: 'Умный', + traversing_off: 'Выкл', + + // misc + error: 'Ошибка' + + +} diff --git a/src/client/app/managers/session.js b/src/client/app/managers/session.js new file mode 100644 index 00000000..084c2255 --- /dev/null +++ b/src/client/app/managers/session.js @@ -0,0 +1,254 @@ +var ipc = require('../ipc/'), + parser = require('../parser'), + editor = require('../editor/'), + lobby = require('../ui/lobby'), + {loading, icon, Popup, upload, remoteBrowse} = require('../ui/utils'), + {saveAs} = require('file-saver'), + widgetManager = require('./widgets'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + locales = require('../locales') + + +var SessionManager = class SessionManager { + + constructor() { + + this.session = null + this.lock = false + this.lastDir = null + this.setSessionPath('') + + ipc.on('connect', ()=>{ + ipc.send('sessionSetPath', {path: this.sessionPath}) + }) + + } + + load(session, callback) { + + if (this.lock) return + + this.lock = true + + var container = DOM.get('#container')[0], + loader = loading(locales('loading_session')) + + setTimeout(()=>{ + try { + + // backward compat + if (Array.isArray(session)) session = session[0] + + // session object must be a root widget + if (session.type !== 'root') throw new Error(locales('session_malformed')) + + // ok + this.session = session + container.innerHTML = '' + parser.reset() + parser.parse({ + data: this.session, + parentNode: DOM.get('#container')[0] + }) + editor.clearHistory() + + } catch (err) { + loader.close() + new Popup({title: locales('session_parsingerror'), content: err.message, icon: 'exclamation-triangle', closable:true}) + this.lock = false + ipc.send('sessionSetPath', {path: this.sessionPath}) + throw err + } + + for (var h in widgetManager.widgets) { + if (widgetManager.widgets[h].value !== undefined) { + widgetManager.trigger('change', { + widget: widgetManager.widgets[h], + id: widgetManager.widgets[h].getProp('id'), + linkId: widgetManager.widgets[h].getProp('linkId'), + options: {} + }) + } + } + + if (editor.enabled) editor.disable() + + DOM.dispatchEvent(window, 'resize') + + setTimeout(()=>{ + lobby.close() + loader.close() + container.classList.add('show') + this.lock = false + editor.unsavedSession = false + this.setSessionPath('') + if (callback) callback() + }, 25) + + }, 25) + + } + + save(path) { + + if (!this.session || READ_ONLY) return + + if (path) this.setSessionPath(path) + + if (!this.sessionPath) return this.saveAs() + + ipc.send('sessionSave', { + session: JSON.stringify(this.session, null, ' '), + path: this.sessionPath + }) + + } + + saveAs() { + + if (!this.session || READ_ONLY) return + + remoteBrowse({extension: 'json', save:true, directory: this.lastDir}, (path)=>{ + this.lastDir = path[0] + this.save(path) + }) + + } + + export() { + + var sessionfile = JSON.stringify(this.session,null,' '), + blob = new Blob([sessionfile],{type : 'application/json'}) + + saveAs(blob, new Date().toJSON().slice(0,10)+'_'+new Date().toJSON().slice(11,16) + '.json') + + editor.unsavedSession = false + + } + + list(data) { + + for (let i in data) { + + var max = 50 + var path = data[i], + file = path.split('\\').pop().split('/').pop(), + length = data[i].length + + path = path.replace(file,'') + + if (length > max - 3) { + path = path.substr(0,Math.floor((path.length)/2)-(length-max)/2) + '...' + path.substr(Math.ceil((path.length)/2)+(length-max)/2, path.length) + } + + lobby.list.appendChild(html` + + ${file} (${path}) + ${READ_ONLY? '' : html`${raw(icon('times'))}`} + + `) + + } + + lobby.list.addEventListener('click', function(e){ + e.preventDefault() + if (e.target.hasAttribute('data-session')) { + ipc.send('sessionOpen',{path:e.target.getAttribute('data-session')}) + } else if (!READ_ONLY && e.target.tagName == 'SPAN') { + ipc.send('sessionRemoveFromHistory',e.target.parentNode.getAttribute('data-session')) + lobby.list.removeChild(e.target.parentNode) + } + }) + + if (!READ_ONLY) { + + var brw = lobby.footer.appendChild(html`${raw(icon('folder-open'))} ${locales('session_browse')}`) + var imp = lobby.footer.appendChild(html`${raw(icon('upload'))} ${locales('editor_import')}`) + var nws = lobby.footer.appendChild(html`${raw(icon('file'))} ${locales('session_new')}`) + + brw.addEventListener('click', (e)=>{ + this.browse() + }) + + imp.addEventListener('click', (e)=>{ + this.import() + }) + + nws.addEventListener('click', (e)=>{ + this.create() + }) + + } + + DOM.addEventListener(lobby.html, 'mousedown touchstart', function(e){ + if (e.type == 'mousedown') e.preventDefault() + e.target.blur() + }) + + lobby.open() + + } + + open(data) { + + this.load(data.session, ()=>{ + this.setSessionPath(data.path) + ipc.send('sessionOpened', {path: data.path}) + }) + + } + + browse() { + + if (READ_ONLY) return + + remoteBrowse({extension: 'json', directory: this.lastDir}, (path)=>{ + if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return + this.lastDir = path[0] + ipc.send('sessionOpen',{path:path}) + }) + + } + + import() { + + if (READ_ONLY) return + + upload('.json', (path, result)=>{ + var session + try { + session = JSON.parse(result) + } catch (err) { + new Popup({title: locales('session_parsingerror'), content: err, icon: 'exclamation-triangle', closable:true}) + } + if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return + if (session) sessionManager.load(session, ()=>{ + ipc.send('sessionSetPath', {path: 'imported'}) + }) + + }, ()=>{ + new Popup({title: locales('error'), content: locales('session_uploaderror'), icon: 'exclamation-triangle', closable:true}) + }) + + } + + create() { + this.load({type: 'root'},function(){ + require('../ui/sidepanel').open() + editor.enable() + editor.select(widgetManager.getWidgetById('root')) + }) + } + + setSessionPath(path) { + + this.sessionPath = path + + } + +} + +var sessionManager = new SessionManager() + +module.exports = sessionManager diff --git a/src/client/managers/state.mjs b/src/client/app/managers/state.js similarity index 76% rename from src/client/managers/state.mjs rename to src/client/app/managers/state.js index 606a436b..ce2f4f5e 100644 --- a/src/client/managers/state.mjs +++ b/src/client/app/managers/state.js @@ -1,12 +1,10 @@ -import {saveAs} from 'file-saver' -import ipc from '../ipc/index.mjs' -import widgetManager from './widgets.mjs' -import cache from './cache.mjs' -import uiFilebrowser from '../ui/ui-filebrowser.mjs' -import uiFileupload from '../ui/ui-fileupload.mjs' -import notifications from '../ui/notifications.mjs' -import locales from '../locales/index.mjs' -import {deepCopy} from '../utils.mjs' +var ipc = require('../ipc'), + widgetManager = require('./widgets'), + {upload, remoteBrowse} = require('../ui/utils'), + notifications = require('../ui/notifications'), + {saveAs} = require('file-saver'), + locales = require('../locales'), + {deepCopy} = require('../utils') var StateManager = class StateManager { @@ -16,7 +14,7 @@ var StateManager = class StateManager { this.statePath = '' this.lastDir = null - this.quickState = cache.get('state.quickState') || null + this.quickState = [] this.valueStateQueue = {} this.valueOldPropQueue = {} @@ -35,7 +33,7 @@ var StateManager = class StateManager { if (filter && !filter(widget)) continue - if (widget.setValue && widget.getValue && !widget.noValueState) { + if (widget.setValue && widget.getValue) { var v = widget.getValue() @@ -63,9 +61,9 @@ var StateManager = class StateManager { for (var j = widgets.length - 1; j >= 0; j--) { - if (widgets[j].setValue && !widgets[j].noValueState) { + if (widgets[j].setValue) { - widgets[j].setValue(value, {send:send, sync:true}) + widgets[j].setValue(value, {send:send, sync:true, fromState:true}) } @@ -83,7 +81,7 @@ var StateManager = class StateManager { var widget = widgetManager.widgets[i] - if (widget.sendValue && !widget.noValueState) { + if (widget.sendValue) { widget.sendValue(null, options) } } @@ -105,24 +103,18 @@ var StateManager = class StateManager { saveAs() { - uiFilebrowser({extension: 'state', save:true, directory: this.lastDir}, (path)=>{ + remoteBrowse({extension: 'state', save:true, directory: this.lastDir}, (path)=>{ this.lastDir = path[0] this.save(path) }) } - requestOpen(path) { - - ipc.send('stateOpen', {path: path}) - - } - browse() { - uiFilebrowser({extension: 'state', directory: this.lastDir}, (path)=>{ + remoteBrowse({extension: 'state', directory: this.lastDir}, (path)=>{ this.lastDir = path[0] - this.requestOpen(path) + ipc.send('stateOpen',{path: path}) }) } @@ -150,7 +142,6 @@ var StateManager = class StateManager { this.set(state, send) notifications.add({ icon: 'sliders-h', - class: 'state-recall', message: locales('state_recallsuccess') }) } catch(e) { @@ -171,7 +162,7 @@ var StateManager = class StateManager { import() { - uiFileupload('.state', (path, result)=>{ + upload('.state', (path, result)=>{ this.load(result, true) }, (e)=>{ this.loadError() @@ -190,7 +181,6 @@ var StateManager = class StateManager { quickSave() { this.quickState = deepCopy(this.get()) - localStorage.setItem('osc.state.quickState', JSON.stringify(this.quickState)) } @@ -204,7 +194,7 @@ var StateManager = class StateManager { if (!path) return this.statePath = path - + } pushValueState(id, value) { @@ -225,8 +215,7 @@ var StateManager = class StateManager { for (let id in this.valueStateQueue) { if (this.valueStateQueue[id] !== undefined) { for (let w of widgetManager.getWidgetById(id)) { - if (w.noValueState) continue - w.setValue(this.valueStateQueue[id], {sync: true, script: false}) + w.setValue(this.valueStateQueue[id], {sync: true, fromState:true}) } } } @@ -234,8 +223,7 @@ var StateManager = class StateManager { for (let id in this.valueNewPropQueue) { if (this.valueNewPropQueue[id] != this.valueOldPropQueue[id]) { for (let w of widgetManager.getWidgetById(id)) { - if (w.noValueState) continue - w.setValue(w.getProp('value'), {sync: true}) + w.setValue(w.getProp('value'), {sync: true, fromState:true}) } } } @@ -260,4 +248,4 @@ var StateManager = class StateManager { var stateManager = new StateManager() -export default stateManager +module.exports = stateManager diff --git a/src/client/managers/widgets.mjs b/src/client/app/managers/widgets.js similarity index 74% rename from src/client/managers/widgets.mjs rename to src/client/app/managers/widgets.js index cf569d9a..d37b5c6b 100644 --- a/src/client/managers/widgets.mjs +++ b/src/client/app/managers/widgets.js @@ -1,7 +1,7 @@ -import EventEmitter from '../events/event-emitter.mjs' -import ipc from '../ipc/index.mjs' +var EventEmitter = require('../events/event-emitter'), + ipc = require('../ipc/') -class WidgetManager extends EventEmitter { +var WidgetManager = class WidgetManager extends EventEmitter { constructor() { @@ -17,9 +17,11 @@ class WidgetManager extends EventEmitter { this.linkIdLock = [] this.linkIdLockDepth = 0 + this.scrollingWidgets = [] + this.preArgsSeparator = '||||' - this.on('value-changed', this.onChange.bind(this)) + this.on('change', this.onChange.bind(this)) ipc.on('connect', ()=>{ for (var hash in this.widgets) { @@ -31,15 +33,11 @@ class WidgetManager extends EventEmitter { onChange(e) { - if (!e) return - var {id, widget, linkId, options} = e if (linkId) { if (!Array.isArray(linkId)) linkId = [linkId] - linkId = linkId.map(x=>String(x).replace(/^>>\s*/, '')).filter(x=>x.indexOf('<<') < 0) - // scopable; prefix linkId with the closest (most restrictive) scope - if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) + linkId = linkId.map(x=>x.replace(/^>>\s*/, '')).filter(x=>x.indexOf('<<') < 0) linkId = linkId.filter(x=>this.linkIdLock.indexOf(x)<0) this.linkIdLock = this.linkIdLock.concat(linkId) this.linkIdLockDepth++ @@ -49,17 +47,12 @@ class WidgetManager extends EventEmitter { widgetsByLinkId = linkId ? this.getWidgetByLinkId(linkId) : [] // Widget that share the same id will update each other - // without sending any extra osc message or running scripts + // without sending any extra osc message if (widgetsById.length > 1) { let v = widget.getValue() for (let i in widgetsById) { if (widgetsById[i] !== widget) { widgetsById[i].setValue(v,{send:false,sync:false, id}) - // Because of sync:false, updated widgets that use @{this} - // in their properties wont update them, we trigger it manually - if (widgetsById[i].linkedPropsValue['this']) { - widgetsById[i].onLinkedPropsChanged({id, widget: widgetsById[i], options: {send: false, sync: false, id}}, 'value-changed') - } } } } @@ -70,7 +63,7 @@ class WidgetManager extends EventEmitter { let v = widget.getValue() for (let i in widgetsByLinkId) { if (widgetsByLinkId[i] !== widget) { - widgetsByLinkId[i].setValue(v,{send: options.send, sync: true, script:options.script, widget, id}) + widgetsByLinkId[i].setValue(v,{send: options.send,sync: true, id}) } } } @@ -81,12 +74,13 @@ class WidgetManager extends EventEmitter { this.linkIdLock = [] } } + } createAddressRef(widget, preArgs, address) { preArgs = widget ? widget.getProp('preArgs') : preArgs - address = widget ? widget.getProp('address') === 'auto' ? '/' + widget.getProp('id') : widget.getProp('address') : address + address = widget ? widget.getProp('address') : address if (!Array.isArray(preArgs) && preArgs !== '') preArgs = [preArgs] if (preArgs === '') preArgs = [] @@ -104,7 +98,9 @@ class WidgetManager extends EventEmitter { var hash = widget.hash, address = this.createAddressRef(widget), id = widget.getProp('id'), - linkId = widget.getProp('linkId') + linkId = widget.getProp('linkId'), + scroll = widget.getProp('scroll') + this.widgets[hash] = widget @@ -118,9 +114,7 @@ class WidgetManager extends EventEmitter { if (linkId) { if (!Array.isArray(linkId)) linkId = [linkId] - linkId = linkId.map(x=>String(x).replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) - // scopable; prefix linkId with the closest (most restrictive) scope - if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) + linkId = linkId.map(x=>x.replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) for (var i in linkId) { if (linkId[i]) { if (!this.linkIdRoute[linkId[i]]) this.linkIdRoute[linkId[i]] = [] @@ -129,6 +123,10 @@ class WidgetManager extends EventEmitter { } } + if (scroll) { + this.scrollingWidgets.push(hash) + } + this.registerWidget(widget) } @@ -138,10 +136,12 @@ class WidgetManager extends EventEmitter { ipc.send('addWidget', { hash: widget.hash, data: updatedData || { + precision: widget.getProp('precision'), preArgs: widget.getProp('preArgs'), + split: widget.getSplit(), target: widget.getProp('target'), - typeTags: widget.getProp('typeTags'), - address: widget.getProp('address') === 'auto' ? '/' + widget.getProp('id') : widget.getProp('address'), + address: widget.getProp('address'), + noSync: widget.getProp('noSync'), } }) @@ -163,12 +163,11 @@ class WidgetManager extends EventEmitter { var hash = widget.hash, address = this.createAddressRef(widget), linkId = widget.getProp('linkId'), - id = widget.getProp('id') + id = widget.getProp('id'), + scroll = widget.getProp('scroll') if (this.widgets[hash]) { - if (this.widgets[hash].onRemove) { - this.widgets[hash].onRemove() - } + if (this.widgets[hash].onRemove) this.widgets[hash].onRemove() delete this.widgets[hash] @@ -177,16 +176,13 @@ class WidgetManager extends EventEmitter { }) widget.trigger('widget-removed', {widget: widget}) - widget.off('widget-removed') } if (id && this.idRoute[id].indexOf(hash) != -1) this.idRoute[id].splice(this.idRoute[id].indexOf(hash), 1) if (address && this.addressRoute[address].indexOf(hash) != -1) this.addressRoute[address].splice(this.addressRoute[address].indexOf(hash), 1) + if (scroll && this.scrollingWidgets.indexOf(hash) != -1) this.scrollingWidgets.splice(this.scrollingWidgets.indexOf(hash), 1) if (!Array.isArray(linkId)) linkId = [linkId] - linkId = linkId.map(x=>String(x).replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) - // scopable; prefix linkId with the closest (most restrictive) scope - if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) for (var i in linkId) { if (linkId[i] && this.linkIdRoute[linkId[i]] && this.linkIdRoute[linkId[i]].indexOf(hash) != -1) this.linkIdRoute[linkId[i]].splice(this.linkIdRoute[linkId[i]].indexOf(hash), 1) } @@ -226,6 +222,12 @@ class WidgetManager extends EventEmitter { } } + for (let i in this.scrollingWidgets) { + if (!this.widgets[this.scrollingWidgets[i]]) { + this.scrollingWidgets.splice(i, 1) + } + } + } reset() { @@ -234,7 +236,7 @@ class WidgetManager extends EventEmitter { this.off() - this.on('value-changed', this.onChange.bind(this)) + this.on('change', this.onChange.bind(this)) } @@ -266,22 +268,7 @@ class WidgetManager extends EventEmitter { } - getWidgetById(id, scope) { - - /* - scopable: return matching widgets only for the closest scope with results - */ - if (scope && scope.length) { - if (!Array.isArray(scope)) scope = [scope] - for (var prefix of scope) { - var prefixedId = Array.isArray(id) ? id.map(i=>prefix + i) : prefix + id - - var widgets = this.getWidgetBy(prefixedId, this.idRoute) - - if (widgets.length) return widgets - } - return [] - } + getWidgetById(id) { return this.getWidgetBy(id, this.idRoute) @@ -347,4 +334,4 @@ class WidgetManager extends EventEmitter { var widgetManager = new WidgetManager() -export default widgetManager +module.exports = widgetManager diff --git a/src/client/app/osc.js b/src/client/app/osc.js new file mode 100644 index 00000000..21859249 --- /dev/null +++ b/src/client/app/osc.js @@ -0,0 +1,80 @@ +var widgetManager = require('./managers/widgets'), + EventEmitter = require('./events/event-emitter'), + ipc = require('./ipc/'), + {deepEqual} = require('./utils') + +var Osc = class Osc extends EventEmitter { + + constructor() { + + super() + + this.syncOnly = false + this.remoteControl = {} + this.serverTargets = [] + + } + + send(data) { + + if (this.syncOnly) { + + this.sync(data) + + } else { + + ipc.send('sendOsc', data) + + } + + } + + sync(data) { + + ipc.send('syncOsc', data) + + } + + receive(data){ + + if (this.remoteControl.exists(data.address)) this.remoteControl.exec(data.address, data.args) + + var [widgets, restArgs] = widgetManager.getWidgetByAddressAndArgs(data.address, data.args) + + for (let i in widgets) { + + let widgetTarget = widgets[i].getProp('target'), + match = true + + if (data._rawTarget) { + // if the message target is provided (when message comes from another client connected to the same server) + // then we only update the widgets that have the exact same target + match = deepEqual(widgetTarget, data._rawTarget) + } else if (data.host === 'midi') { + // if the message comes from a midi port, only update widgets that send to that port + let widgetArrayTarget = Array.isArray(widgetTarget) ? widgetTarget : [widgetTarget], + strTarget = data.host + ':' + data.port + + match = widgetArrayTarget.includes(strTarget) || + (!widgetArrayTarget.includes(null) && this.serverTargets.includes(strTarget)) + + } + + if (match) { + widgets[i].setValue(restArgs,{send:false,sync:true,fromExternal:!data.target}) + } + + } + + this.trigger(data.address, data.args) + + } + +} + + +var osc = new Osc() + +module.exports = osc + +osc.remoteControl = require('./remote-control') diff --git a/src/client/parser.mjs b/src/client/app/parser.js similarity index 77% rename from src/client/parser.mjs rename to src/client/app/parser.js index 38d6da48..0a7fbfd3 100644 --- a/src/client/parser.mjs +++ b/src/client/app/parser.js @@ -1,6 +1,6 @@ -import widgetManager from './managers/widgets.mjs' -import stateManager from './managers/state.mjs' -import {deepCopy} from './utils.mjs' +var widgetManager = require('./managers/widgets'), + stateManager = require('./managers/state'), + {deepCopy} = require('./utils') var Parser = class Parser { @@ -10,13 +10,6 @@ var Parser = class Parser { this.widgets = {} this.defaults = {} - ;(async()=>{ - this.widgets = (await import('./widgets/index.mjs')).widgets - for (var k in this.widgets) { - this.defaults[k] = this.widgets[k].defaults()._props() - } - })() - } getIterator(id) { @@ -42,11 +35,7 @@ var Parser = class Parser { tab, reCreateOptions, children, - index, - hash, - locals, - variables, - meta + index } = options var props = data @@ -67,7 +56,7 @@ var Parser = class Parser { if (i.indexOf('_') !== 0 && props[i] === undefined) props[i] = deepCopy(defaults[i]) } - // Generate widget's id, based on its type + // Genrate widget's id, based on its type if (props.id === 'auto' || !props.id) { var id while (!id || widgetManager.getWidgetById(id).length) { @@ -76,6 +65,10 @@ var Parser = class Parser { props.id = id } + // Generate default address (also handled in editor/edit-field) + props.address = props.address === 'auto' ? '/' + props.id : props.address + + // Remove props that don't apply for (let j in props) { if (defaults[j] === undefined || j[0] === '_') delete props[j] @@ -83,19 +76,18 @@ var Parser = class Parser { // create widget var widget = new this.widgets[props.type]({ + container:true, props, parent, parentNode, reCreateOptions, - children, - hash, - locals, - variables, - meta + children }) widgetManager.addWidget(widget) + widget.created(index) + // set widget's initial state var defaultValue = widget.getProp('default'), currentValue = widget.getProp('value') @@ -106,12 +98,10 @@ var Parser = class Parser { } else if (defaultValue !== '' && defaultValue !== undefined) { - widget.setValue(defaultValue, {defaultInit: true}) + widget.setValue(defaultValue) } - widget.created(index) - parentNode.appendChild(widget.container) widget.mounted = true @@ -125,4 +115,9 @@ var Parser = class Parser { var parser = new Parser() -export default parser +module.exports = parser + +parser.widgets = require('./widgets/').widgets +for (var k in parser.widgets) { + parser.defaults[k] = parser.widgets[k].defaults()._props() +} diff --git a/src/client/remote-control.mjs b/src/client/app/remote-control.js similarity index 58% rename from src/client/remote-control.mjs rename to src/client/app/remote-control.js index 10526a5d..70db4bb4 100644 --- a/src/client/remote-control.mjs +++ b/src/client/app/remote-control.js @@ -1,21 +1,16 @@ -import deepExtend from 'deep-extend' -import {updateWidget} from './editor/data-workers.mjs' -import editor from './editor/index.mjs' -import widgetManager from './managers/widgets.mjs' -import stateManager from './managers/state.mjs' -import sessionManager from './managers/session' -import notifications from './ui/notifications.mjs' -import uiConsole from './ui/ui-console.mjs' -import {READ_ONLY, JSON5} from './globals.mjs' +var {updateWidget} = require('./editor/data-workers'), + editor = require('./editor'), + widgetManager = require('./managers/widgets'), + stateManager = require('./managers/state'), + deepExtend = require('deep-extend') var callbacks = { - '/EDIT': function(args, custom_module) { + '/EDIT': function(args) { - if (READ_ONLY && !custom_module) return + if (READ_ONLY) return - var [id, json, opts] = args, - newdata = typeof json == 'string' ? JSON5.parse(json) : json, - options = typeof opts == 'string' ? JSON5.parse(opts) : {}, + var [id, json] = args, + newdata = typeof json == 'string' ? JSON.parseFlex(json) : json, widgets = widgetManager.getWidgetById(id) if (!widgets.length) return @@ -30,24 +25,20 @@ var callbacks = { } updateWidget(widget, { - reuseChildren: !(newdata.widgets || newdata.tabs), - editedProps: Object.keys(newdata) + reuseChildren: !(newdata.widgets || newdata.tabs) }) } editor.pushHistory() - if (options.noWarning) editor.unsavedSession = false - }, - '/EDIT/MERGE': function(args, custom_module) { + '/EDIT/MERGE': function(args) { - if (READ_ONLY && !custom_module) return + if (READ_ONLY) return - var [id, json, opts] = args, - newdata = typeof json == 'string' ? JSON5.parse(json) : json, - options = typeof opts == 'string' ? JSON5.parse(opts) : {}, + var [id, json] = args, + newdata = typeof json == 'string' ? JSON.parseFlex(json) : json, widgets = widgetManager.getWidgetById(id) if (!widgets.length) return @@ -60,27 +51,24 @@ var callbacks = { deepExtend(data, newdata) updateWidget(widget, { - reuseChildren: !(newdata.widgets || newdata.tabs), - editedProps: Object.keys(newdata) + reuseChildren: !(newdata.widgets || newdata.tabs) }) } editor.pushHistory() - if (options.noWarning) editor.unsavedSession = false - }, - '/EDIT/UNDO': function(args, custom_module) { + '/EDIT/UNDO': function(args) { - if (READ_ONLY && !custom_module) return + if (READ_ONLY) return editor.undo() }, - '/EDIT/REDO': function(args, custom_module) { + '/EDIT/REDO': function(args) { - if (READ_ONLY && !custom_module) return + if (READ_ONLY) return editor.redo() @@ -207,13 +195,12 @@ var callbacks = { }, '/STATE/SET': function(args) { - if (!Array.isArray(args)) args = [args] + if (Array.isArray(args)) args = args[0] - var json = args[0], - data = typeof json == 'string' ? JSON5.parse(json) : json, - send = !(args[1] === 0 || args[1] === false) + var json = args, + data = typeof json == 'string' ? JSON.parseFlex(json) : json - stateManager.set(data, send) + stateManager.set(data) }, '/STATE/STORE': function(args) { @@ -225,66 +212,6 @@ var callbacks = { stateManager.quickLoad() - }, - '/STATE/SEND': function(args) { - - stateManager.send() - - }, - '/STATE/OPEN': function(args) { - - if (!Array.isArray(args)) args = [args] - - stateManager.requestOpen(args[0]) - - }, - '/STATE/SAVE': function(args) { - - if (!Array.isArray(args)) args = [args] - - stateManager.save(args[0]) - - }, - '/NOTIFY': function(args) { - - if (!Array.isArray(args)) args = [args] - - var icon - if (args.length > 1 && typeof args[0] === 'string' && args[0].indexOf(' ') === -1) { - icon = args.shift() - } - - notifications.add({ - message: args.join('\n') || ' ', - icon: icon - }) - - }, - '/LOG': function(args) { - - console.log(args) - - }, - '/SESSION/CREATE': function(args) { - - editor.unsavedSession = false - - sessionManager.create() - - }, - '/SESSION/OPEN': function(args) { - - if (!Array.isArray(args)) args = [args] - - sessionManager.requestOpen(args[0]) - - }, - '/SESSION/SAVE': function(args) { - - if (!Array.isArray(args)) args = [args] - - sessionManager.save(args[0]) - }, '/TABS': function(args) { @@ -299,25 +226,17 @@ var callbacks = { } } } - }, - '/SCRIPT': function(args) { - - if (!Array.isArray(args)) args = [args] - - uiConsole.script.run({input_code: args[0]}, {sync: true, send: true}) - - }, - '/RELOAD': function(args) { - - window.location.href = window.location.href } } -export default { - exec: function(name, args, custom_module){ +// backward-compatibility +callbacks['/EDIT_SOFT'] = callbacks['/EDIT/MERGE'] + +module.exports = { + exec: function(name, args){ if (callbacks[name]) { - callbacks[name](args, custom_module) + callbacks[name](args) } }, exists: function(name){ diff --git a/src/client/app/stacktrace.js b/src/client/app/stacktrace.js new file mode 100644 index 00000000..c8a5381c --- /dev/null +++ b/src/client/app/stacktrace.js @@ -0,0 +1,28 @@ +var StackTrace = require('stacktrace-js'), + ipc = require('./ipc') + +window.onerror = function(msg,url,row,col, error) { + + StackTrace.fromError(error).then((stackframes)=>{ + + var stringifiedStack = stackframes.filter((sf)=>{ + + return !sf.fileName.match('browser-pack') + + }).map(function(sf) { + + if (sf.functionName.match(/Object\./)) sf.functionName = 'require' + + return ` at ${sf.functionName} (${sf.fileName}:${sf.lineNumber}:${sf.columnNumber})` + + }).join('\n') + + ipc.send('errorLog', `[Renderer process error]\n${msg}\n${stringifiedStack}`) + + }).catch(()=>{ + + ipc.send('errorLog', `[Renderer process error]\n${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`) + + }) + +} diff --git a/src/client/app/ui/context-menu.js b/src/client/app/ui/context-menu.js new file mode 100644 index 00000000..a155fe3f --- /dev/null +++ b/src/client/app/ui/context-menu.js @@ -0,0 +1,131 @@ +var html = require('nanohtml'), + raw = require('nanohtml/raw') + +class ContextMenu { + + constructor(){ + + this.menu = null + this.root = document.body + this.clickHandler = (e)=>{ + if (this.menu && !this.menu.contains(e.target)) this.close() + } + + } + + open(e, actions, parent) { + + var menu = html`
    ` + + for (let action of actions) { + + if (Array.isArray(action.action)) { + + let item = html`
    ${raw(action.label)}
    ` + + menu.appendChild(item) + + this.open(e, action.action, item) + + + } else { + + let item = html`
    ${raw(action.label)}
    ` + + menu.appendChild(item) + + if (action.click) { + + item.addEventListener('click', (e)=>{ + e.preventDefault() + action.action() + this.close() + }) + + } else { + + item.addEventListener('fast-click', (e)=>{ + e.detail.preventOriginalEvent = true + action.action() + this.close() + }) + + } + + } + + } + + if (parent) parent.appendChild(menu) + + if (!parent) { + + this.menu = menu + + this.root.appendChild(menu) + + DOM.each(menu, '.item', (item)=>{ + item.addEventListener('mouseenter', ()=>{ + DOM.each(item.parentNode, '.focus', (focused)=>{ + focused.classList.remove('focus') + }) + item.classList.add('focus') + }) + item.addEventListener('mouseleave', ()=>{ + if (!item.classList.contains('has-sub')) item.classList.remove('focus') + }) + }) + + menu.style.top = e.pageY + 'px' + menu.style.left = e.pageX + 'px' + + this.correctPosition(menu) + + DOM.each(menu, '.context-menu', (m)=>{ + this.correctPosition(m, m.parentNode) + }) + + } + + document.addEventListener('fast-click', this.clickHandler, true) + document.addEventListener('fast-right-click', this.clickHandler, true) + + } + + close() { + + if (this.menu) { + + this.menu.parentNode.removeChild(this.menu) + this.menu = null + + } + + document.removeEventListener('fast-click', this.clickHandler, true) + document.removeEventListener('fast-right-click', this.clickHandler, true) + } + + correctPosition(menu, parent) { + + var position = DOM.offset(menu), + width = menu.offsetWidth, + height = menu.offsetHeight, + totalWidth = this.root.offsetWidth, + totalHeight = this.root.offsetHeight + + if (width + position.left > totalWidth) { + menu.style.right = parent ? '100%' : '0' + menu.style.left = 'auto' + menu.style.marginRight = '2rem' + } + + if (height + position.top > totalHeight) { + menu.style.top = 'auto' + menu.style.bottom = '2rem' + } + + } + +} + +module.exports = new ContextMenu() diff --git a/src/client/app/ui/fullscreen.js b/src/client/app/ui/fullscreen.js new file mode 100644 index 00000000..5a347c7f --- /dev/null +++ b/src/client/app/ui/fullscreen.js @@ -0,0 +1,41 @@ +var screenfull = require('screenfull'), + {Popup} = require('./utils'), + locales = require('../locales') + +var fullscreen + +if (screenfull.isEnabled) { + + fullscreen = screenfull + +} else { + + class IOSFullScreen { + + constructor(){ + + this.enabled = !navigator.standalone + this.isFullScreen = navigator.standalone + + } + + toggle(){ + + new Popup({ + title: locales('fs_unnavailable'), + content: locales('fs_addtohome'), + closable: true + }) + + } + + on(){} + + } + + fullscreen = new IOSFullScreen() + +} + + +module.exports = fullscreen diff --git a/src/client/app/ui/init.js b/src/client/app/ui/init.js new file mode 100644 index 00000000..55970d82 --- /dev/null +++ b/src/client/app/ui/init.js @@ -0,0 +1,6 @@ +require('./zoom') +require('./lobby').create() +require('./sidepanel') +require('../events/click') +require('./ios') +require('./notifications') diff --git a/src/client/app/ui/ios.js b/src/client/app/ui/ios.js new file mode 100644 index 00000000..20c25b57 --- /dev/null +++ b/src/client/app/ui/ios.js @@ -0,0 +1,25 @@ +// Prevent iOS Pull-To-Refresh + +var iOS + +if (navigator.platform.match(/iPhone|iPod|iPad/) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) { + + iOS = true + + var preventNextMove = false + + document.addEventListener('touchstart', (e)=>{ + if (e.touches.length === 1 && !e.target._drag_widget) preventNextMove = true + }, false) + + document.addEventListener('touchmove', (e)=>{ + // preventDefault the first overscrolling touchmove + if (preventNextMove) { + preventNextMove = false + e.preventDefault() + } + }, false) + +} + +module.exports = iOS diff --git a/src/client/app/ui/lobby.js b/src/client/app/ui/lobby.js new file mode 100644 index 00000000..48aeb8a1 --- /dev/null +++ b/src/client/app/ui/lobby.js @@ -0,0 +1,51 @@ +var html = require('nanohtml') + +class Lobby { + + constructor() { + + this.state = 0 + + } + + create() { + + this.html = html` +
    +
    +
    + ${PACKAGE.productName} +
    +
    + +
    +
    + ` + + this.main = DOM.get(this.html, '.main')[0] + this.list = DOM.get(this.html, '.list')[0] + this.footer = DOM.get(this.html, '.footer')[0] + + } + + open() { + if (this.state) return + this.state = 1 + document.body.appendChild(this.html) + setTimeout(()=>{ + this.main.classList.add('show') + }) + } + + close() { + if (!this.state) return + this.state = 0 + this.main.classList.remove('show') + document.body.removeChild(this.html) + } + +} + +var lobby = new Lobby() + +module.exports = lobby diff --git a/src/client/ui/notifications.mjs b/src/client/app/ui/notifications.js similarity index 59% rename from src/client/ui/notifications.mjs rename to src/client/app/ui/notifications.js index 19bafba5..37e91168 100644 --- a/src/client/ui/notifications.mjs +++ b/src/client/app/ui/notifications.js @@ -1,9 +1,5 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import morph from 'nanomorph' -import UiWidget from './ui-widget.mjs' -import {DOM, ENV} from '../globals.mjs' -import {icon} from './utils' +var html = require('nanohtml'), + morph = require('nanomorph') var DEFAULT_DURATION = 3500 @@ -22,17 +18,15 @@ class Toast { this.expires = Date.now() + (data.duration || DEFAULT_DURATION) var toast = html` -
    - ${raw(icon(data.icon || (data.class === 'error' ? 'exclamation' : 'bell')))} -
    +
    + +
    + ${data.message} +
    ` - - DOM.get(toast, '.content')[0].textContent = data.message - if (this.html) { this.html = morph(this.html, toast) - this.html.style.height = this.html.offsetHeight + 'px' } else { this.html = toast } @@ -50,31 +44,21 @@ class Toast { this.html.classList.add('remove') setTimeout(()=>{ - if (el.contains(this.html)) el.removeChild(this.html) + el.removeChild(this.html) }, 200) } } -class Notifications extends UiWidget { +class Notifications { - constructor(options) { - - super(options) + constructor() { + this.container = DOM.get('#notifications')[0] this.toasts = [] this.loop = null - this.visible = undefined - - this.setVisibility(ENV.notifications != 0) - - this.container.addEventListener('fast-click', (e)=>{ - for (var toast of this.toasts) { - if (toast.html.contains(e.target)) this.remove(toast) - } - }) } @@ -130,13 +114,6 @@ class Notifications extends UiWidget { } - setVisibility(v) { - - this.visible = v - this.container.style.display = v ? '' : 'none' - - } - } -export default new Notifications({selector: '#notifications'}) +module.exports = new Notifications() diff --git a/src/client/app/ui/sidepanel.js b/src/client/app/ui/sidepanel.js new file mode 100644 index 00000000..79dd07a1 --- /dev/null +++ b/src/client/app/ui/sidepanel.js @@ -0,0 +1,379 @@ +var state = require('../managers/state'), + session = require('../managers/session'), + editor = require('../editor/'), + {icon} = require('./utils'), + fullscreen = require('./fullscreen'), + notifications = require('./notifications'), + {enableTraversingGestures, disableTraversingGestures} = require('../events/drag'), + locales = require('../locales'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + contextMenu = require('./context-menu') + +var sidepanelData = [ + { + actions: [ + { + label: locales('sidepanel_fs') + (ELECTRON_FULLSCREEN ? ' (F11)' : ''), + action:()=>{ + if (fullscreen.isEnabled) fullscreen.toggle() + }, + class:'toggle fullscreenToggle' + (!fullscreen.isEnabled || ELECTRON_FULLSCREEN ? ' disabled' : '') + } + + ] + }, + { + label: icon('sliders-h') + '  ' + locales('sidepanel_state'), + actions: [ + { + label: locales('state_store'), + action:()=>{ + state.quickSave() + DOM.get('.quickload')[0].classList.remove('disabled') + notifications.add({ + icon: 'sliders-h', + message: locales('state_storesuccess') + }) + } + }, + { + label: locales('state_recall'), + action: ()=>{ + state.quickLoad() + }, + class:'disabled quickload' + }, + { + label: locales('state_send'), + action: ()=>{ + state.send() + notifications.add({ + icon: 'sliders-h', + message: locales('state_sendsuccess') + }) + } + }, + { + label: locales('editor_load'), + action:()=>{ + state.browse() + } + }, + { + label: locales('editor_save'), + action:()=>{ + state.save(state.statePath) + } + }, + { + label: raw(icon('ellipsis-h')), + class: 'narrow', + menu: [ + { + label: locales('editor_save_as'), + action:()=>{ + state.saveAs() + } + }, + { + label: locales('state_import'), + click: true, + action:state.import.bind(state) + }, + { + label: locales('state_export'), + click: true, + action:state.export.bind(state) + }, + ] + } + ] + }, + { + label: icon('magic') + '  ' + locales('sidepanel_traversing'), + actions: [ + { + label: locales('traversing_on'), + action:(el)=>{ + DOM.each(el.parentNode, 'a', (el)=>{ + el.classList.remove('on') + }) + el.classList.add('on') + var container = document.getElementById('container') + disableTraversingGestures(container) + enableTraversingGestures(container) + }, + class:'traversingEnable' + }, + { + label: locales('traversing_smart'), + action:(el)=>{ + DOM.each(el.parentNode, 'a', (el)=>{ + el.classList.remove('on') + }) + el.classList.add('on') + var container = document.getElementById('container') + disableTraversingGestures(container) + enableTraversingGestures(container, {smart: true}) + }, + class:'traversingSmart' + }, + { + label: locales('traversing_off'), + action:(el)=>{ + DOM.each(el.parentNode, 'a', (el)=>{ + el.classList.remove('on') + }) + el.classList.add('on') + disableTraversingGestures(document.getElementById('container')) + }, + class:'traversingDisable on' + } + ] + }, + { + label: icon('edit') + '  ' + locales('sidepanel_editor'), + class:'editor-menu', + actions: [ + { + label: locales('editor_on'), + action:editor.enable.bind(editor), + class:'enable-editor' + }, + { + label: locales('editor_off'), + action:editor.disable.bind(editor), + class:'on disable-editor' + }, + { + label: raw(icon('vector-square')), + class:'editor-root disabled narrow', + title: locales('editor_root') + }, + { + label: locales('editor_load'), + action:session.browse.bind(session) + }, + { + label: locales('editor_save'), + action:()=>{ + session.save() + } + }, + { + label: raw(icon('ellipsis-h')), + class: 'narrow', + menu: [ + { + label: locales('editor_save_as'), + action:()=>{ + session.saveAs() + } + }, + { + label: locales('editor_import'), + click: true, + action: ()=>{ + session.import() + } + }, + { + label: locales('editor_export'), + click: true, + action: ()=>{ + session.export() + } + } + ] + } + ] + }, +] + + +if (navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)) { + + var NoSleep = require('nosleep.js'), + noSleep = new NoSleep(), + noSleepState = false + + sidepanelData[0].actions.push({ + label: locales('sidepanel_nosleep'), + class: 'toggle', + action:(el)=>{ + noSleepState = el.classList.toggle('on') + if (noSleepState) { + noSleep.enable() + } else { + noSleep.disable() + } + } + }) + +} + + + +var options = html`
      ` + +for (let i in sidepanelData) { + + let data = sidepanelData[i], + item = html` +
    • +
      +
      + ${data.label ? html`
      ${raw(data.label)}
      ` : ''} +
      +
      +
    • + `, + wrapper = DOM.get(item, '.actions')[0] + + for (let j in data.actions) { + + let actionData = data.actions[j], + element = html`${actionData.label}` + + if (actionData.action) element.addEventListener('click', ()=>{actionData.action(element)}) + + if (actionData.menu) { + + element.addEventListener('fast-click', (e)=>{ + contextMenu.open(e.detail, actionData.menu) + }) + + } + + wrapper.appendChild(element) + } + + options.appendChild(item) + +} + + +var sidepanel = document.getElementById('sidepanel-wrapper'), + sidepanelContainer = document.getElementById('sidepanel') + +sidepanel.appendChild(html` + +`) + +sidepanel.appendChild(options) + +sidepanel.appendChild(html`
      `) + + +// Fullscreen + +var fsToggle = DOM.get(sidepanel, '.fullscreenToggle')[0] + +if (fullscreen.isEnabled) { + fullscreen.on('change', ()=>{ + fsToggle.classList.toggle('on', fullscreen.isFullScreen) + }) +} + +// open / close / toggle + +var sidepaneLock = false + +function sidepanelOpen() { + + sidepaneLock = true + + DOM.get('#sidepanel')[0].classList.remove('hide') + + setTimeout(function(){ + DOM.each(document, '#open-toggle, #sidepanel', (el)=>{ + el.classList.add('sidepanel-open') + }) + }) + + setTimeout(function(){ + DOM.get('#container')[0].classList.add('sidepanel-open') + setTimeout(function(){ + DOM.dispatchEvent(window, 'resize') + sidepaneLock = false + }, 25) + }, 250) + +} + +function sidepanelClose() { + + if (sidepaneLock) return + + DOM.each(document, '#open-toggle, #sidepanel, #container', (el)=>{ + el.classList.remove('sidepanel-open') + }) + + setTimeout(function(){ + if (sidepaneLock) return + DOM.get('#sidepanel')[0].classList.add('hide') + }, 250) + + setTimeout(function(){ + DOM.dispatchEvent(window, 'resize') + }, 25) + +} + +function sidepanelToggle() { + + if (sidepanelContainer.classList.contains('sidepanel-open')) { + sidepanelClose() + } else { + sidepanelOpen() + } + +} + + +DOM.get('#container')[0].addEventListener('fast-click', function(e){ + + if (e.target.id == 'open-toggle') { + e.stopPropagation() + e.detail.preventOriginalEvent = true + sidepanelToggle() + } + +}) + +document.addEventListener('keydown', function(e){ + // F10 + if (e.keyCode==121) sidepanelToggle() +}) + + +// Sidepanel resize + +var sidepanelWidth + +$('#sidepanel-handle').draggable({ + cursor:'col-resize', + start: ()=>{ + sidepanelWidth = parseInt(sidepanelContainer.offsetWidth) / PXSCALE + sidepanelContainer.classList.add('resizing') + }, + drag: (event, ui)=>{ + var delta = (ui.originalPosition.left - ui.position.left) / PXSCALE, + newWidth = Math.max(sidepanelWidth + delta, 300) + if (!isNaN(sidepanelWidth)) { + document.documentElement.style.setProperty('--sidepanel-size', newWidth + 'rem') + } + }, + stop: ()=>{ + sidepanelContainer.classList.remove('resizing') + } +}) + + + +module.exports = { + open: sidepanelOpen, + close: sidepanelClose, + toggle: sidepanelToggle +} diff --git a/src/client/app/ui/utils.js b/src/client/app/ui/utils.js new file mode 100644 index 00000000..5244891d --- /dev/null +++ b/src/client/app/ui/utils.js @@ -0,0 +1,350 @@ +var popupSingleton = null, + uploadSingleton = null, + locales = require('../locales'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + ipc = require('../ipc'), + EventEmitter = require('../events/event-emitter'), + doubleTap = require('../widgets/mixins/double_tap') + +module.exports = { + + Popup: class Popup extends EventEmitter { + + constructor(options) { + + super() + + if (options.closable) { + + if (popupSingleton) { + popupSingleton.close() + popupSingleton = null + } + + popupSingleton = this + + } + + this.closable = options.closable + this.escKey = options.closable || options.escKey + this.enterKey = options.enterKey + this.content = options.content + this.title = options.title + this.state = 0 + + this.html = html` + + ` + + if (this.closable) { + var closer = DOM.get(this.html, '.popup-title .closer')[0] + this.html.addEventListener('fast-click',(e)=>{ + if (e.target === this.html || e.target === closer) { + e.detail.preventOriginalEvent = true + this.close() + } + }) + } + + if (this.escKey) { + this.escKeyHandler = ((e)=>{ + if (e.keyCode==27) this.close() + }).bind(this) + } + + if (this.enterKey) { + this.enterKeyHandler = ((e)=>{ + if (e.keyCode == 13) this.enterKey.call(this, e) + }).bind(this) + } + + if (!options.hide) this.open() + + + } + + + + close() { + + if (!this.state) return + this.state = 0 + + if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler) + if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler) + document.body.removeChild(this.html) + + this.trigger('close') + + } + + open() { + + if (this.state) return + this.state = 1 + + if (this.escKey) document.addEventListener('keydown', this.escKeyHandler) + if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler) + document.body.appendChild(this.html) + + this.trigger('open') + } + }, + + loading: function(title){ + return new module.exports.Popup({ + title: title, + content: html`

      `, + closable: false + }) + }, + icon: function(i) { + return `` + }, + iconify:function(string){ + return String(string).replace(/\^[^\s]{2,}/g,(x)=>{return module.exports.icon(x.substring(1))}) + }, + upload: function(types, ok, error) { + + if (uploadSingleton) document.body.removeChild(uploadSingleton) + + uploadSingleton = html`` + document.body.appendChild(uploadSingleton) + + uploadSingleton.addEventListener('change',function(e){ + + + var reader = new FileReader(), + file = e.target.files[0], + loader = module.exports.loading(locales('loading_upload')) + + reader.onerror = reader.onabort = function() { + loader.close() + error() + } + + reader.onload = function(e) { + loader.close() + ok(file.path, e.target.result) + } + + reader.readAsText(file, 'utf-8') + + }) + + uploadSingleton.click() + + }, + remoteBrowse: function(options, callback) { + + var save = options.save, + saveInputFocus = undefined + + var popup = new module.exports.Popup({ + closable: true, + title: locales(save ? 'remotesave_save' : 'remotesave_open'), + hide: true + }) + + var container = DOM.get(popup.html, '.popup-content')[0], + browser = html`
      `, + ariane = html`
      `, + list = html`
      `, + saveInput = html``, + actions = html` +
      + ${saveInput} +
      ${raw(module.exports.icon('times'))} Cancel
      + ${ + save ? + html`
      ${raw(module.exports.icon('save'))} Save
      ` : + html`
      ${raw(module.exports.icon('folder-open'))} Open
      ` + } +
      + ` + + var files = [], + path = '' + + var extRe = options.extension ? new RegExp('.*\\.' + options.extension + '$') : /.*/ + + if (save) { + saveInput.addEventListener('change', ()=>{ + if (!saveInput.value.match(extRe)) saveInput.value += '.' + options.extension + }) + saveInput.addEventListener('focus', ()=>{ + saveInputFocus = true + }) + list.addEventListener('change', ()=>{ + saveInputFocus = false + var choice = DOM.get(list, ':checked')[0] + if (choice && choice.classList.contains('file')) { + saveInput.value = choice.value + } + }) + } + + doubleTap(list, submit, {click: true}) + + function submit(){ + + var choice = DOM.get(list, ':checked')[0] + + if (!choice && (!save || !saveInput.value) && !options.loadDir) return + + if (choice && choice.classList.contains('folder') && (!save || !saveInputFocus)) { + ipc.send('listDir', {path: [path, choice.value]}) + } else { + if (save) { + if (files.some(x=>x.name===saveInput.value)) { + if (!confirm(locales('remotesave_overwrite'))) return + } + callback([path, saveInput.value]) + popup.close() + } else { + callback([path, choice ? choice.value : '']) + popup.close() + } + } + + } + + actions.addEventListener('click', (e)=>{ + if (e.target.classList.contains('submit')) { + submit() + } else if ((e.target.classList.contains('cancel'))){ + popup.close() + } + }) + + function keyDownHandler(e){ + + if (e.keyCode === 13) { + if (save) { + document.addEventListener('keyup', keyUpHandler) + } else { + submit() + } + } else if (e.target === saveInput) { + return + } else if (e.keyCode === 8) { + list.childNodes[0].firstElementChild.checked = true + submit() + } else if (e.key.length === 1) { + var letter = e.key.toLowerCase(), + current = DOM.get(list, ':checked')[0], + minIndex = -1, + index = -1 + + if (current) minIndex = DOM.index(current.parentNode) + + for (let i in files) { + if (files[i].name[0].toLowerCase() === letter && !list.childNodes[i].firstElementChild.checked) { + if (index === -1) index = i + if (minIndex !== -1 && i < minIndex) continue + index = i + break + } + } + + if (index !== -1) { + list.childNodes[index].firstElementChild.click() + list.childNodes[index].firstElementChild.focus() + } + } + } + function keyUpHandler(e){ + + if (e.keyCode === 13) { + setTimeout(submit, 100) + document.removeEventListener('keyup', keyUpHandler) + } + + } + + document.addEventListener('keydown', keyDownHandler) + + ipc.on('listDir', (data)=>{ + + ariane.textContent = path = data.path + + files = data.files.filter(x=>x.folder || x.name.match(extRe)) + + + function alphaSort(a, b){ + // convert to strings and force lowercase + a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString() + b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString() + return a.localeCompare(b) + } + + var fo = files.filter(x=>x.folder), + fi = files.filter(x=>!x.folder) + + fo.sort(alphaSort) + fi.sort(alphaSort) + + files = fo.concat(fi) + + files.unshift({ + name: '..', + folder: true + }) + + + browser.removeChild(list) + list.innerHTML = '' + for (let i in files) { + var file = files[i] + list.appendChild(html` +
      + +
      ${raw(module.exports.icon(file.folder ? 'folder' : 'osc'))} ${file.name}
      +
      + `) + } + + + browser.insertBefore(list, actions) + + + if (save && saveInputFocus === undefined) { + saveInput.focus() + } else { + list.childNodes[0].firstElementChild.focus() + } + + }, {context: popup}) + + popup.on('close', ()=>{ + ipc.off('listDir', null, popup) + document.removeEventListener('keydown', keyDownHandler) + document.removeEventListener('keyup', keyUpHandler) + }) + + browser.appendChild(ariane) + browser.appendChild(list) + browser.appendChild(actions) + container.appendChild(browser) + + ipc.send('listDir', {extension: options.extension, path: options.directory ? [options.directory] : null}) + + popup.open() + + } + +} diff --git a/src/client/app/ui/zoom.js b/src/client/app/ui/zoom.js new file mode 100644 index 00000000..7bf18a4c --- /dev/null +++ b/src/client/app/ui/zoom.js @@ -0,0 +1,29 @@ +// mousewheel zoom + +var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey' + +document.addEventListener('mousewheel', function(event) { + if (event.ctrlKey) event.preventDefault() + if (event[mod]) { + + event.preventDefault() + + if (event.deltaY === 0) return + + var d = - event.deltaY / (10 * Math.abs(event.deltaY)) + + PXSCALE = parseFloat(d) + parseFloat(PXSCALE) + document.documentElement.style.setProperty('font-size', PXSCALE + 'px') + + DOM.dispatchEvent(window, 'resize') + } +}, {passive: false}) + +document.addEventListener('keydown', function(event){ + if (event[mod] && (event.keyCode == 96 || event.keyCode == 48)) { + PXSCALE = INITIALZOOM + document.documentElement.style.setProperty('font-size', PXSCALE + 'px') + + DOM.dispatchEvent(window, 'resize') + } +}, {passive: true}) diff --git a/src/client/app/utils.js b/src/client/app/utils.js new file mode 100644 index 00000000..7a873517 --- /dev/null +++ b/src/client/app/utils.js @@ -0,0 +1,39 @@ +module.exports = { + + deepCopy: function(obj, precision) { + + var copy = obj + + if (obj === null) { + return obj + } + + if (typeof obj === 'object') { + copy = Array.isArray(obj) ? [] : {} + for (let key in obj) { + copy[key] = module.exports.deepCopy(obj[key], precision) + } + } else if (typeof obj == 'number') { + return precision === undefined ? copy : parseFloat(copy.toFixed(precision)) + } + + return copy + + }, + + deepEqual: function(a, b) { + + var ta = typeof a, + tb = typeof b + + if (ta !== tb) { + return false + } else if (ta === 'object') { + return JSON.stringify(a) === JSON.stringify(b) + } else { + return a === b + } + + } + +} diff --git a/src/client/app/widgets/buttons/dropdown.js b/src/client/app/widgets/buttons/dropdown.js new file mode 100644 index 00000000..a40b6318 --- /dev/null +++ b/src/client/app/widgets/buttons/dropdown.js @@ -0,0 +1,119 @@ +var Widget = require('../common/widget'), + {iconify} = require('../../ui/utils'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + iOS = require('../../ui/ios') + +class Dropdown extends Widget { + + static description() { + + return 'Native dropdown menu.' + + } + + + static defaults() { + + return super.defaults({ + + _dropdown:'dropdown', + + values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [ + '`Array` of possible values to switch between : `[1,2,3]`', + '`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', + 'An empty option will always be prepended to values (sends an osc message without any value); it can be hidden by adding `option:first-child{display:none}` to the widget\'s `css`' + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + this.select = this.widget.appendChild(html``) + + this.values = [] + this.keys = [] + + this.parseValues() + + this.select.addEventListener('change', ()=>{ + this.setValue(this.values[this.select.selectedIndex - 1], {sync:true, send:true, fromLocal:true}) + }) + + this.value = undefined + this.select.selectedIndex = -1 + this.container.classList.add('noselect') + + } + + parseValues() { + + var i = 0, + values = this.getProp('values') + + if (!Array.isArray(values) && !(typeof values === 'object' && values !== null)) { + values = values !== '' ? [values] : [] + } + + this.select.innerHTML = '' + this.select.appendChild(html``) + + this.values = [] + + for (var k in values) { + this.values.push(values[k]) + this.select.appendChild(html` + + `) + i++ + } + + } + + setValue(v,options={}) { + + var i = this.values.indexOf(v) + + this.value = this.values[i] + + if (!options.fromLocal) { + this.select.selectedIndex = i + 1 + if (iOS && document.activeElement === this.select) this.select.blur() + } + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + + onPropChanged(propName, options, oldPropValue) { + + var ret = super.onPropChanged(...arguments) + + switch (propName) { + + case 'values': + this.parseValues() + this.setValue(this.value) + return + + } + + return ret + + } + +} + +Dropdown.dynamicProps = Dropdown.prototype.constructor.dynamicProps.concat( + 'values' +) + + +module.exports = Dropdown diff --git a/src/client/app/widgets/buttons/menu.js b/src/client/app/widgets/buttons/menu.js new file mode 100644 index 00000000..a7e52e31 --- /dev/null +++ b/src/client/app/widgets/buttons/menu.js @@ -0,0 +1,343 @@ +var Widget = require('../common/widget'), + {iconify} = require('../../ui/utils'), + doubletab = require('../mixins/double_tap'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +class Menu extends Widget { + + static description() { + + return 'Drag and drop menu with a circular or grid layout.' + + } + + static defaults() { + + return super.defaults({ + + _menu:'menu', + + size: {type: 'number|array', value: 200, help: [ + '- If `circular` is `true`: diameter (in px)', + '- If `circular` is `false`: square size or `[width, height]` array', + ]}, + circular: {type: 'boolean', value: true, help: [ + 'Defines whether the menu should be rendered in a circle or in a box' + ]}, + vertical: {type: 'boolean|number', value: false, help: [ + 'If `circular` is `false`, set this to `true` for vertical layout', + 'Ignored when `grid` is `true`' + ]}, + grid: {type: 'boolean|number', value: false, help: [ + '- If `circular` is `false`, set this to `true` for grid layout', + '- Can be a `number` to define the number of columns' + ]}, + toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'}, + doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'}, + values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [ + '`Array` of possible values to switch between : `[1,2,3]`', + '`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', + ]}, + weights: {type: 'array', value: '', help: [ + '`Array` of `number` defining the weights of each value in `values`', + 'Ignored when `grid` is `true`' + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + this.menu = this.widget.appendChild(html``) + + this.opened = false + this.values = [] + this.selected = -1 + this.value = undefined + + this.parseValues() + + + this.parentScroll = [0,0] + this.opened = false + + + if (this.getProp('doubleTap')) { + + doubletab(this.widget, (e)=>{ + if (this.opened) return + this.open(e) + }) + + this.on('draginit',(e)=>{ + + if (this.opened && this.getProp('toggle')) { + + this.selectValue(e) + this.submitValue() + + } + + }, {element: this.widget}) + + + } else { + + this.on('draginit',(e)=>{ + + if (this.opened && this.getProp('toggle')) { + + this.selectValue(e) + this.submitValue() + + } else if (!this.opened) { + + this.open(e) + + } + + }, {element: this.widget}) + + } + + if (!this.getProp('toggle')) { + + this.on('drag',(e)=>{ + + this.selectValue(e, true) + + }, {element: this.widget}) + + this.on('dragend',()=>{ + + if (!this.opened) return + this.submitValue() + + }, {element: this.widget}) + + } else { + + this.menu.classList.add('norelease') + this.toggleCloseHandler = (e)=>{ + if (!this.opened || this.menu.contains(e.target)) return + this.close() + } + document.addEventListener('fast-click', this.toggleCloseHandler) + + } + + this.setMode() + this.setSize() + + } + + open(e) { + + this.opened = true + var off = this.scrollOffset() + this.menu.style.setProperty('--x', (e.offsetX - off[0]) / PXSCALE + 'rem') + this.menu.style.setProperty('--y', (e.offsetY - off[1]) / PXSCALE + 'rem') + this.menu.classList.add('show') + this.widget.classList.add('on') + this.container.classList.add('on') + + } + + close() { + + this.opened = false + this.menu.classList.remove('show') + DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) + this.container.classList.remove('on') + this.widget.classList.remove('on') + + } + + selectValue(e, drag) { + + // touch hover fix + var node = drag && e.isTouch ? document.elementFromPoint(e.clientX, e.clientY) + : e.target + + if (node === this.menu || !this.menu.contains(node)) { + DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) + this.selected = -1 + } else if (!node.classList.contains('active')) { + DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) + node.classList.add('active') + this.selected = DOM.index(node) + } + + } + + submitValue(e) { + + this.close() + if (this.selected > -1) { + this.setValue(this.values[this.selected], {send: true, sync: true}) + } + + } + + parseValues() { + + var nval = 0, + i = 0, + circular = this.getProp('circular'), + values = this.getProp('values'), + weights = this.getProp('weights'), + totalWeight + + if (!Array.isArray(values) && !(typeof values === 'object' && values !== null)) { + values = values !== '' ? [values] : [] + } + + this.values = [] + this.widget.removeChild(this.menu) + this.menu.innerHTML = '' + + + nval = Array.isArray(values) ? values.length : Object.keys(values).length + weights = Array.isArray(weights) ? weights.slice(0, nval) : Array(nval).fill(1) + if (weights.length < nval) weights = weights.concat(Array(nval - weights.length).fill(1)) + totalWeight = weights.reduce((a, b) => a + b, 0) + + var ac = 0 + for (let k in values) { + let angle = Math.min(360 * weights[i] / totalWeight, 120), + skew = 90 - angle + this.values.push(values[k]) + this.menu.appendChild(html` +
      +
      ${raw(iconify(parseFloat(k) != k ? k : values[k]))}
      +
      + `) + i++ + ac+=angle + + } + + + this.setValue(this.value) + + this.widget.appendChild(this.menu) + + if (!this.getProp('circular') && this.getProp('grid')) { + this.container.style.setProperty('--grid-columns', this.getProp('grid') === true ? parseInt(nval / 2) : parseInt(this.getProp('grid'))) + } + + } + + setMode() { + + this.container.classList.toggle('box', !this.getProp('circular')) + this.container.classList.toggle('circular', this.getProp('circular')) + this.container.classList.toggle('grid', this.getProp('grid') && !this.getProp('circular')) + this.container.classList.toggle('vertical', this.getProp('vertical') && !this.getProp('circular')) + + } + + setSize() { + + var size = this.getProp('size') + if (Array.isArray(size)) { + this.container.style.setProperty('--size', parseInt(size[0]) + 'rem') + this.container.style.setProperty('--size-box-w', parseInt(size[0]) + 'rem') + this.container.style.setProperty('--size-box-h', parseInt(size[1]) + 'rem') + + } else { + this.container.style.setProperty('--size', parseInt(size) + 'rem') + this.container.style.setProperty('--size-box-w', parseInt(size) + 'rem') + this.container.style.setProperty('--size-box-h', parseInt(size) + 'rem') + } + + } + + scrollOffset() { + + var parent = this.parent, + scrollOffset = [0,0] + + while (parent && parent.props && parent.getProp('type') !== 'tab') { + scrollOffset[0] += parent.widget.scrollLeft + scrollOffset[1] += parent.widget.scrollTop + parent = parent.parent + if (parent.getProp('type') === 'modal') break + } + + return scrollOffset + + } + + setValue(v,options={}) { + + var i = this.values.indexOf(v) + + if (i > -1) { + this.value = this.values[i] + this.selected = i + } + + DOM.each(this.menu, '.on', (el)=>{el.classList.remove('on')}) + if (i > -1) DOM.get(this.menu, '.item')[i].classList.add('on') + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + + onPropChanged(propName, options, oldPropValue) { + + var ret = super.onPropChanged(...arguments) + + switch (propName) { + + case 'size': + this.setSize() + return + case 'vertical': + this.setMode() + return + case 'circular': + this.setMode() + this.parseValues() + return + case 'grid': + this.setMode() + if (this.getProp('grid') === true) this.parseValues() + return + case 'values': + this.parseValues() + return + + } + + return ret + + } + + onRemove() { + + if (this.getProp('toggle')) { + document.removeEventListener('fast-click', this.toggleCloseHandler) + } + super.onRemove() + + } + +} + +Menu.dynamicProps = Menu.prototype.constructor.dynamicProps.concat( + 'size', + 'circular', + 'vertical', + 'grid', + 'values' +) + + +module.exports = Menu diff --git a/src/client/app/widgets/buttons/push.js b/src/client/app/widgets/buttons/push.js new file mode 100644 index 00000000..827c489d --- /dev/null +++ b/src/client/app/widgets/buttons/push.js @@ -0,0 +1,160 @@ +var Widget = require('../common/widget'), + doubletab = require('../mixins/double_tap'), + osc = require('../../osc'), + html = require('nanohtml') + +class Push extends Widget { + + static description() { + + return 'On / off button that turns off when released.' + + } + + + static defaults() { + + + return super.defaults({ + + _push: 'push', + + doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'}, + on: {type: '*', value: 1, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]}, + off: {type: '*', value: 0, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]}, + norelease: {type: 'boolean', value: false, help: 'Set to `true` to prevent sending any osc message when releasing the button'}, + + }, ['default']) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + this.state = 0 + this.active = null + this.lastChanged = 'state' + + if (this.getProp('doubleTap')) { + + doubletab(this.widget, ()=>{ + if (this.active) return + this.setValuePrivate(this.getProp('on'),{send:true,sync:true}) + }) + + } else { + + this.on('draginit',()=>{ + if (this.active) return + this.setValuePrivate(this.getProp('on'),{send:true,sync:true}) + }, {element: this.widget}) + + } + + this.on('dragend',()=>{ + if (!this.active) return + this.setValuePrivate(this.getProp('off'),{send:true,sync:true}) + }, {element: this.widget}) + + this.value = this.getProp('off') + + + } + + updateValue(){ + + this.value = this[this.lastChanged] ? + this.getProp('on') != null && this.getProp('on').value !== undefined ? this.getProp('on').value : this.getProp('on') + : + this.getProp('off') != null && this.getProp('off').value !== undefined ? this.getProp('off').value : this.getProp('off') + + } + + setValuePrivate(v,options={}) { + + if (typeof v == 'object' && v !== null) v = v.value + if (v===this.getProp('on') || (this.getProp('on') != null && v === this.getProp('on').value && v !== undefined)) { + this.widget.classList.add('active') + this.container.classList.add('active') + this.active = options + this.lastChanged = 'active' + this.updateValue() + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + } else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) { + this.widget.classList.remove('active') + this.container.classList.remove('active') + this.active = null + this.lastChanged = 'active' + this.updateValue() + if (options.send) this.sendValue(null, {syncOnly: this.getProp('norelease')}) + if (options.sync) this.changed(options) + } + + } + + setValue(v,options={}) { + + if (!options.fromExternal) { + if (!options.fromState) this.setValuePrivate(v,options) + return + } + + if (typeof v == 'object' && v !== null) v = v.value + if (v===this.getProp('on') || (this.getProp('on') != null && v === this.getProp('on').value && v !== undefined)) { + this.widget.classList.add('on') + this.container.classList.add('on') + this.state = 1 + if (options.send) this.sendValue() + this.lastChanged = 'state' + if (options.sync) this.changed(options) + } else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) { + this.widget.classList.remove('on') + this.container.classList.remove('on') + this.state = 0 + if (options.send) this.sendValue() + this.lastChanged = 'state' + if (options.sync) this.changed(options) + } + + } + + sendValue(overrides, options={}) { + + if (!options.syncOnly) { + + super.sendValue(overrides, options) + + } else { + + osc.sync({ + h: this.hash, + v: this.value + }) + + } + + } + + onRemove() { + + if (this.active) this.setValuePrivate(this.getProp('off'), this.active) + super.onRemove() + + } +} + +Push.dynamicProps = Push.prototype.constructor.dynamicProps.concat( + 'on', + 'off', + 'norelease' +) + +module.exports = Push diff --git a/src/client/app/widgets/buttons/switch.js b/src/client/app/widgets/buttons/switch.js new file mode 100644 index 00000000..46001012 --- /dev/null +++ b/src/client/app/widgets/buttons/switch.js @@ -0,0 +1,120 @@ +var Widget = require('../common/widget'), + {iconify} = require('../../ui/utils'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +module.exports = class Switch extends Widget { + + static description() { + + return 'Value selector button.' + + } + + static defaults() { + + return super.defaults({ + + _switch:'switch', + + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'}, + showValues: {type: 'boolean', value: false, help: 'If values is an object, set to `true` to display both values and labels instead of labels only'}, + values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [ + '`Array` of possible values to switch between : `[1,2,3]`', + '`Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', + ]}, + traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'}, + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + + if (this.getProp('horizontal')) this.widget.classList.add('horizontal') + + this.values = [] + this.stringValues = [] + + var values = this.getProp('values') + + if (!Array.isArray(values) && !(typeof values === 'object' && values !== null)) { + values = [values] + } + + var isArray = Array.isArray(values) + + for (var k in values) { + + this.values.push(values[k]) + + if (typeof values[k] == 'object') { + this.stringValues.push(JSON.stringify(values[k])) + } else { + this.stringValues.push(0) + } + + var label = isArray ? values[k]: k + if (this.getProp('showValues') && !isArray) label = label + ': ' + (this.stringValues[this.stringValues.length - 1] || values[k]) + + this.widget.appendChild(html` +
      ${raw(iconify(label))}
      + `) + + } + + this.value = undefined + + var dragCallback = (e, touchFix)=>{ + + var index = 0, + node = e.target + + if (touchFix && e.isTouch) { + // special traversing touch fix + node = document.elementFromPoint(e.clientX, e.clientY) + } + + if (node === this.widget || !this.widget.contains(node)) return + + while ( (node = node.previousSibling) ) { + if (node.nodeType != 3) { + index++ + } + } + + var value = this.values[index] + + if (value!=this.value || this.value===undefined) this.setValue(value,{sync:true,send:true}) + + } + + this.on('draginit', dragCallback , {element: this.widget}) + this.on('drag', (e)=>{ + if (this.getProp('traversing') || e.traversing) dragCallback(e, true) + } , {element: this.widget}) + + } + + setValue(v, options={}) { + + var i = typeof v == 'object' ? + this.stringValues.indexOf(JSON.stringify(v)) : + this.values.indexOf(v) + + DOM.each(this.widget, '.on', (el)=>{el.classList.remove('on')}) + + if (i!=-1) { + this.value = this.values[i] + DOM.get(this.widget, '.value')[i].classList.add('on') + if (options.send) this.sendValue(this.value) + if (options.sync) this.changed(options) + } else { + this.value = undefined + if (options.sync) this.changed(options) + } + + }} diff --git a/src/client/app/widgets/buttons/toggle.js b/src/client/app/widgets/buttons/toggle.js new file mode 100644 index 00000000..0b1fc7a4 --- /dev/null +++ b/src/client/app/widgets/buttons/toggle.js @@ -0,0 +1,97 @@ +var Widget = require('../common/widget'), + doubletab = require('../mixins/double_tap'), + html = require('nanohtml') + +class Toggle extends Widget { + + static description() { + + return 'On / off button.' + + } + + static defaults() { + + return super.defaults({ + + _toggle: 'toggle', + + doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be toggled instead of a single tap'}, + led: {type: 'boolean', value: false, help: 'Set to `true` to display the toggle\'s state with a led'}, + on: {type: '*', value: 1, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]}, + off: {type: '*', value: 0, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + this.state = 0 + this.active = false + + if (this.getProp('led')) this.container.classList.add('led') + + if (this.getProp('doubleTap')) { + + doubletab(this.widget, ()=>{ + var newVal = this.state?this.getProp('off'):this.getProp('on') + this.setValue(newVal,{sync:true,send:true}) + }) + + } else { + + this.on('draginit',()=>{ + if (this.active) return + this.active = true + var newVal = this.state?this.getProp('off'):this.getProp('on') + this.setValue(newVal,{sync:true,send:true}) + }, {element: this.widget}) + + this.on('dragend',()=>{ + this.active = false + }, {element: this.widget}) + + } + + this.value = this.getProp('off') + + } + + setValue(v,options={}) { + + if (typeof v == 'object' && v !== null) v = v.value + if (v===this.getProp('on') || (this.getProp('on') != null && v === this.getProp('on').value && v !== undefined)) { + this.widget.classList.add('on') + this.container.classList.add('on') + this.state = 1 + this.value = this.getProp('on') + if (options.send) this.sendValue() + } else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) { + this.widget.classList.remove('on') + this.container.classList.remove('on') + this.state = 0 + this.value = this.getProp('off') + if (options.send) this.sendValue() + } + + if (options.sync) this.changed(options) + + } + +} + +Toggle.dynamicProps = Toggle.prototype.constructor.dynamicProps.concat( + 'on', + 'off' +) + +module.exports = Toggle diff --git a/src/client/app/widgets/common/canvas.js b/src/client/app/widgets/common/canvas.js new file mode 100644 index 00000000..0f5edc25 --- /dev/null +++ b/src/client/app/widgets/common/canvas.js @@ -0,0 +1,215 @@ +var Widget = require('./widget') + +class CanvasQueue { + + constructor() { + + this.queue = {} + this.flushed = 0 + this.running = false + this.frameLength = 1000 / CANVAS_FRAMERATE + this.lastFrame = 0 + this.bindedLoop = this.loop.bind(this) + + } + + push(widget) { + + this.queue[widget.hash] = widget + this.flushed = 0 + + if (!this.running) { + this.running = true + requestAnimationFrame(this.bindedLoop) + } + + } + + flush() { + + for (var h in this.queue) { + this.queue[h].draw() + } + + this.queue = {} + this.flushed++ + + } + + loop(timestamp) { + + if (this.flushed >= 10) { + this.running = false + return + } + + requestAnimationFrame(this.bindedLoop) + + var delta = timestamp - this.lastFrame + + if (delta > this.frameLength) { + this.lastFrame = timestamp - (delta % this.frameLength) + this.flush() + } + + } + +} + +var canvasQueue = new CanvasQueue() + + +class Canvas extends Widget { + + constructor(options) { + + super(options) + + this.canvas = DOM.get(this.widget, 'canvas')[0] + + this.ctx = this.canvas.getContext('2d',{ + desynchronized: ELECTRON_NOGPU ? false : true, + lowLatency: true, + alpha: true + }) + + this.height = undefined + this.width = undefined + this.scaling = 1 + + this.clearRect = [] + + this.visible = false + + this.colors = {} + + this.on('resize', this.resizeHandleProxy.bind(this), {element: this.canvas}) + + this.ctx.arc = (x, y, r, s, e, c)=>{ + + this.ctx.__proto__.arc.call(this.ctx, x, y, Math.max(0,r), s, e, c) + + } + + } + + resizeHandleProxy() { + + this.resizeHandle(...arguments) + + } + + resizeHandle(event){ + + var {width, height, style} = event, + ratio = CANVAS_SCALING * this.scaling + + this.height = height + this.width = width + + this.canvas.setAttribute('width', width * ratio) + this.canvas.setAttribute('height', height * ratio) + + this.clearRect = [] + + if (ratio != 1) { + this.ctx.setTransform(1, 0, 0, 1, 0, 0) + this.ctx.scale(ratio, ratio) + } + + this.cacheCanvasStyle(style) + + if (!this.visible) this.visible = true + + requestAnimationFrame(this.draw.bind(this)) + + } + + cacheCanvasStyle(style){ + + style = style || window.getComputedStyle(this.canvas) + + this.colors.custom = style.getPropertyValue('--color-custom') + this.colors.track = style.getPropertyValue('--color-track') + this.colors.text = style.getPropertyValue('--color-text') + this.colors.textFade = style.getPropertyValue('--color-text-fade') + this.colors.raised = style.getPropertyValue('--color-raised') + this.colors.bg = style.getPropertyValue('--color-bg') + this.colors.fg = style.getPropertyValue('--color-fg') + this.colors.faded = style.getPropertyValue('--color-faded') + this.colors.light = style.getPropertyValue('--color-light') + + this.fontFamily = style.getPropertyValue('font-family') + this.textAlign = style.getPropertyValue('text-align') + this.fontSize = parseFloat(style.getPropertyValue('font-size')) + this.fontWeight = parseFloat(style.getPropertyValue('font-weight')) + + this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily + this.ctx.textBaseline = 'middle' + this.ctx.textAlign = this.textAlign + + } + + clear() { + + if (!this.clearRect.length) { + + this.ctx.clearRect(0, 0, this.width, this.height) + + } else if (typeof this.clearRect[0] == 'object') { + + for (let i in this.clearRect) { + this.ctx.clearRect(...this.clearRect[i]) + } + + } else { + + this.ctx.clearRect(...this.clearRect) + + } + + } + + batchDraw() { + + if (this.visible) { + canvasQueue.push(this) + } + + } + + draw(){ + throw new Error('Calling unimplemented draw() method') + } + + onPropChanged(propName, options, oldPropValue) { + + var ret = super.onPropChanged(...arguments) + + switch (propName) { + + case 'color': + this.cacheCanvasStyle() + this.batchDraw() + return + + } + + return ret + + + } + + onRemove() { + this.off('resize') + super.onRemove() + } + +} + +Canvas.dynamicProps = Canvas.prototype.constructor.dynamicProps.concat( + 'on', + 'off' +) + +module.exports = Canvas diff --git a/src/client/widgets/common/container.mjs b/src/client/app/widgets/common/container.js similarity index 95% rename from src/client/widgets/common/container.mjs rename to src/client/app/widgets/common/container.js index 594c4dd3..22bc36f3 100644 --- a/src/client/widgets/common/container.mjs +++ b/src/client/app/widgets/common/container.js @@ -1,4 +1,4 @@ -import Widget from './widget.mjs' +var Widget = require('./widget') var Container = (Class=Widget)=> class extends Class { @@ -6,8 +6,6 @@ var Container = (Class=Widget)=> class extends Class { super(options) - this.isContainer = true - this.on('widget-created', (e)=>{ if (e.widget.parent === this) { @@ -74,4 +72,4 @@ var Container = (Class=Widget)=> class extends Class { } -export default Container +module.exports = Container diff --git a/src/client/app/widgets/common/osc-receiver.js b/src/client/app/widgets/common/osc-receiver.js new file mode 100644 index 00000000..ab4e7201 --- /dev/null +++ b/src/client/app/widgets/common/osc-receiver.js @@ -0,0 +1,70 @@ +var osc = require('../../osc') + +module.exports = class OscReceiver { + + constructor(options) { + + var {address, value, parent, propName, usePreArgs} = options + + try { + this.value = JSON.parse(value) + } catch (err) { + this.value = value + } + + this.parent = parent + this.propNames = [propName] + this.usePreArgs = usePreArgs + this.bindedCallback = this.callback.bind(this) + this.prefix = '' + this.setAddress(address) + + } + + setAddress(address) { + + if (this.address !== address) { + + if (this.address) osc.off(this.prefix + this.address, this.bindedCallback, this.parent) + + if (address) this.address = address + + if (this.address[0] !== '/') { + this.prefix = this.parent.getProp('address') || this.parent.resolveProp('address', undefined, false, this) + if (this.prefix[this.prefix.length - 1] !== '/') this.prefix += '/' + } + + osc.on(this.prefix + this.address, this.bindedCallback, {context: this.parent}) + + } + + } + + addProp(propName){ + + if (!this.propNames.includes(propName)) this.propNames.push(propName) + + } + + callback(args) { + + if (typeof args !== 'object') args = [args] + var preArgs = this.usePreArgs ? (this.parent.getProp('preArgs') || []) : [] + if (!Array.isArray(preArgs) && preArgs !== '') preArgs = [preArgs] + if (args.length >= preArgs.length) { + for (var i in preArgs) { + if (preArgs[i] !== args[i]) return + } + var val = args.slice(preArgs.length) + if (val.length < 2) val = val[0] + try { + this.value = JSON.parse(val) + } catch (err) { + this.value = val + } + this.parent.updateProps(this.propNames, this.parent) + } + + } + +} diff --git a/src/client/app/widgets/common/widget.js b/src/client/app/widgets/common/widget.js new file mode 100644 index 00000000..39a288cf --- /dev/null +++ b/src/client/app/widgets/common/widget.js @@ -0,0 +1,969 @@ +var EventEmitter = require('../../events/event-emitter'), + osc = require('../../osc'), + nanoid = require('nanoid/generate'), + widgetManager = require('../../managers/widgets'), + {math, evaljs, urlParser} = require('../utils'), + scopeCss = require('scope-css'), + {iconify} = require('../../ui/utils'), + resize = require('../../events/resize'), + OscReceiver = require('./osc-receiver'), + {deepCopy, deepEqual} = require('../../utils'), + html = require('nanohtml'), + // ipc = require('../../ipc'), + updateWidget = ()=>{} + + +var oscReceiverState = {} + +var OSCProps = [ + 'precision', + 'address', + 'preArgs', + 'target', + 'bypass' +] + +var dummyDOM + +DOM.ready(()=>{ + dummyDOM = html`
      ` +}) + +setTimeout(()=>{ + updateWidget = require('../../editor/data-workers').updateWidget +}) + +class Widget extends EventEmitter { + + static description() { + + return '' + + } + + static defaults(insert={}, except=[], push={}) { + + var defaults = { + + type: {type: 'string', value: 'auto', help: ''}, + id: {type: 'string', value: 'auto', help: 'Widgets sharing the same `id` will act as clones and update each other\'s value(s) without sending extra osc messages.' }, + linkId: {type: 'string|array', value: '', help: [ + 'Widgets sharing the same `linkId` update each other\'s value(s) AND send their respective osc messages.', + 'When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)', + 'When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending)' + ]}, + + _geometry:'geometry', + + left: {type: 'number|string', value: 'auto', help: [ + 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).', + 'Otherwise, the widget will be absolutely positioned' + ]}, + top: {type: 'number|percentage', value: 'auto', help: [ + 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).', + 'Otherwise, the widget will be absolutely positioned' + ]}, + width: {type: 'number|percentage', value: 'auto', help: ''}, + height: {type: 'number|percentage', value: 'auto', help: ''}, + + _style:'style', + + label: {type: 'string|boolean', value: 'auto', help: [ + 'Set to `false` to hide completely', + 'Insert icons using the prefix ^ followed by the icon\'s name : ^play, ^pause, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)' + ]}, + color: {type: 'string', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, + css: {type: 'string', value: '', help: 'CSS rules. See documentation.'}, + + _value: 'value', + + default: {type: '*', value: '', help: 'If set, the widget will be initialized with this value when the session is loaded.'}, + value: {type: '*', value: '', help: 'Define the widget\'s value depending on other widget\'s values / properties using property inheritance and property maths'}, + + _osc: 'osc', + + precision: {type: 'integer|string', value: 2, help: [ + 'Defines the number of decimals to display and to send.', + 'Set to `0` to send integers only.', + 'Data type can be specified by appending a valid osc type tag to the precision value, for example : `3d` will make the widget send double precision numbers rounded to three decimals' + ]}, + address: {type: 'string', value: 'auto', help: 'OSC address for sending messages, it must start with a /'}, + preArgs: {type: '*|array', value: '', help: [ + 'A value or array of values that will be prepended to the OSC messages.', + 'Values can be defined as objects if the osc type tag needs to be specified: `{type: "i", value: 1}`' + ]}, + target: {type: 'string|array|null', value: '', help: [ + 'This defines the targets of the widget\'s OSC messages', + '- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`', + '- If midi is enabled, targets can be `midi:device_name`', + '- The special item `"self"` can be used to refer to the emitting client directly.', + '- If no target is set, messages can still be sent if the server has default targets', + '- The server\'s default targets can be bypassed by setting one of the items to `null`' + ]}, + bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'} + + } + + // okay that's bad, but keys happen to be ordered anyway... + + var alterDefaults = {} + + for (var k in defaults) { + if (k === '_value') { + for (var l in insert) { + alterDefaults[l] = insert[l] + } + } + if (except.indexOf(k) < 0) alterDefaults[k] = defaults[k] + } + + for (var m in push) { + alterDefaults[m] = push[m] + } + + alterDefaults._props = function() { + var props = {} + for (var k in this) { + if (k[0] !== '_') { + props[k] = this[k].value + } + } + return props + } + + + return alterDefaults + + } + + constructor(options={}) { + + super() + + this.widget = options.html + this.props = options.props + this.errors = {} + this.parsers = {} + this.parent = options.root ? widgetManager : options.parent + this.parentNode = options.parentNode + this.hash = nanoid('abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10) + this.children = [] + this.reCreateOptions = options.reCreateOptions + this.removed = false + this.mounted = false + + this.createPropsCache() + + if (this.getProp('id') == 'root' && !options.root) { + this.cachedProps.id = '_root' + this.errors.id = 'There can only be one root' + } + + this.disabledProps = [] + // this.mathjsDeprecationWarned = false + + // cache precision + if (this.props.precision != undefined) { + this.precision = Math.min(20,Math.max(this.getProp('precision', undefined, false),0)) + } + + if (options.container) { + + this.container = html` +
      + ` + this.label = html`
      ` + this.container.appendChild(this.label) + this.container.appendChild(this.widget) + this.container._widget_instance = this + this.setContainerStyles() + } else { + this.container = dummyDOM + } + + } + + contains(widget) { + + if (this.children.indexOf(widget) > 0) return true + + var parent = widget.parent + while (parent && parent !== widgetManager) { + if (parent === this) return true + parent = parent.parent + } + return false + + } + + getAllChildren() { + + var children = [] + for (var i = 0; i < this.children.length; i++) { + if (!this.children[i]) continue + children.push(this.children[i]) + children = children.concat(this.children[i].getAllChildren()) + } + return children + + + } + + created(index) { + + this.trigger('widget-created', { + id: this.getProp('id'), + widget: this, + options: this.reCreateOptions, + index: index + }) + + } + + changed(options) { + + this.trigger('change', { + widget: this, + options: options, + id: this.getProp('id'), + linkId: this.getProp('linkId') + }) + + } + + sendValue(overrides, options={}) { + + if (this.selfLinkedOSCProps) { + this.updateProps(this.selfLinkedOSCProps, this) + } + + if (this.getProp('bypass') && !options.force) return + + var data = { + h:this.hash, + v:this.value + } + + if (overrides) { + for (var k in overrides) { + data[k] = overrides[k] + } + } + + if (options.syncOnly) { + + osc.sync(data) + + } else { + + osc.send(data) + + } + + } + + setValue() {} + + getValue(withPrecision) { + + return deepCopy(this.value, withPrecision ? this.precision : undefined) + + } + + getSplit() {} + + checkLinkedProps(propNames) { + + // Dynamic props cache check + var linkedProps = [] + + Object.values(this.nestedLinkedProps).forEach(l => linkedProps = linkedProps.concat(l)) + Object.values(this.linkedProps).forEach(l => linkedProps = linkedProps.concat(l)) + Object.values(this.linkedPropsValue).forEach(l => linkedProps = linkedProps.concat(l)) + Object.values(this.oscReceivers).forEach(r => linkedProps = linkedProps.concat(r.propNames)) + + if ( + // if prop/osc listeners have changed (@{} / OSC{}) + // refresh the widget's props cache and update linked props bindings + propNames.map(x => this.props[x]).some(x => typeof x === 'string' && x.match(/OSC\{|@\{/)) + || propNames.some(n => linkedProps.includes(n)) + ) { + this.createPropsCache() + } + + } + + createPropsCache() { + + // @{props} links lists + this.linkedProps = {} + this.nestedLinkedProps = {} + this.linkedPropsValue = {} + + // OSC{/path} receivers + if (this.oscReceivers) { + this.removeOscReceivers() + } + this.oscReceivers = {} + + // Cache resolved props + this.cachedProps = {} + + for (var k in this.props) { + if (k != 'widgets' && k != 'tabs') { + this.cachedProps[k] = this.resolveProp(k, undefined, true) + } else { + this.cachedProps[k] = this.props[k] + } + } + + this.createLinkedPropsBindings() + + } + + createLinkedPropsBindings() { + + if (!this.linkedCreatedCallback && Object.keys(this.linkedProps).length) { + + this.linkedCreatedCallback = (e)=>{ + this.onLinkedPropsChanged(e, 'widget-created') + } + + this.linkedPropChangedCallback = (e)=>{ + this.onLinkedPropsChanged(e, 'prop-changed') + } + + widgetManager.on('widget-created', this.linkedCreatedCallback, {context: this}) + widgetManager.on('prop-changed', this.linkedPropChangedCallback, {context: this}) + + } else if (this.linkedCreatedCallback && !Object.keys(this.linkedProps).length) { + + widgetManager.off('widget-created', this.linkedCreatedCallback) + widgetManager.off('prop-changed', this.linkedPropChangedCallback) + delete this.linkedCreatedCallback + delete this.linkedPropChangedCallback + + } + + if (!this.linkedValueChangedCallback && Object.keys(this.linkedPropsValue).length) { + + this.linkedValueChangedCallback = (e)=>{ + this.onLinkedPropsChanged(e, 'change') + } + + widgetManager.on('change', this.linkedValueChangedCallback, {context: this}) + + } else if (this.linkedPropsValueCallback && !Object.keys(this.linkedPropsValue).length) { + + widgetManager.off('change', this.linkedValueChangedCallback) + delete this.linkedValueChangedCallback + + } + + var selfLinkedOSCProps = (this.linkedPropsValue['this'] || []).filter(i=>OSCProps.indexOf(i) > -1) + this.selfLinkedOSCProps = selfLinkedOSCProps.length ? selfLinkedOSCProps : false + + } + + onLinkedPropsChanged(e, type) { + + var {id, widget, options} = e, + changedProps = type === 'prop-changed' ? e.props : type === 'change' ? ['value'] : undefined, + linkedProps = type === 'change' ? this.linkedPropsValue : this.linkedProps + + if (widget === this.parent) { + if (type === 'widget-created') return + id = 'parent' + } + + if (widget === this) id = 'this' + + if (this.nestedLinkedProps[id]) { + this.updateLinkedPropsWithNesting(id) + } + + if (linkedProps[id]) { + this.updateProps(linkedProps[id], widget, options, changedProps) + } + + } + + removeOscReceivers() { + + osc.off(undefined, undefined, this) + for (var i in this.oscReceivers) { + oscReceiverState[i] = this.oscReceivers[i].value + } + this.oscReceivers = {} + + } + + updateLinkedPropsWithNesting(i) { + + for (var prop of this.nestedLinkedProps[i]) { + + // 1. remove all linked props found in properties bound to the nested link + for (var linksStores of [this.linkedPropsValue, this.linkedProps]) { + for (let id in linksStores) { + if (linksStores[id].includes(prop)) { + linksStores[id].splice(linksStores[id].indexOf(prop), 1) + if (!linksStores[id].length) delete linksStores[id] + } + } + } + + + // 2. resolve these props again and recreate links (3rd arg to true) + this.resolveProp(prop, undefined, true, this) + + } + + + } + + resolveProp(propName, propValue, storeLinks=true, originalWidget, originalPropName, context) { + + propValue = propValue !== undefined ? propValue : deepCopy(this.props[propName]) + originalWidget = originalWidget || this + originalPropName = originalPropName || propName + + var variables = {}, + defaultScope = this.constructor.parsersContexts[propName] || {}, + mathscope = context || {}, + varnumber = 999 + + if (typeof propValue == 'string') { + + propValue = propValue.replace(/@\{[^{}]*((@\{[^{}]*\}|[^{}]*)*)\}/g, (m, nested)=>{ + // pretty regexp: + // @\{ + // [^{}]* + // (( + // @\{ + // [^{}]* + // \} + // | + // [^{}]* + // )*) + // + // \} + + if (nested) { + m = m.replace(nested, this.resolveProp(propName, nested, storeLinks ? 'nested' : false, this)) + } + + let id = m.substr(2, m.length - 3).split('.'), + k, subk + + if (id.length > 1) { + + k = id.pop() + subk = undefined + + if (id.length > 1) { + subk = k + k = id.pop() + } + + id = id.join('.') + + } else { + + id = id[0] + k = 'value' + + } + + // backward compat + if (k === '_value') k = 'value' + + var widgets = id == 'parent' && this.parent ? + [this.parent] : id == 'this' ? [this] : + widgetManager.getWidgetById(id) + + if (!widgets.length) { + var parent = this.parent + while (parent && parent != widgetManager) { + if (parent.getProp('id') == id) { + widgets.push(parent) + break + } + parent = parent.parent + } + } + + + // ignore clone wrapper in @parent stack (https://github.com/jean-emmanuel/open-stage-control/issues/379) + if (widgets[0] === this.parent && this.parent.getProp('type') === 'clone') widgets = [this.parent.parent] + + if (storeLinks) { + + if (k == 'value') { + + if (!this.linkedPropsValue[id]) this.linkedPropsValue[id] = [] + if (this.linkedPropsValue[id].indexOf(propName) == -1) this.linkedPropsValue[id].push(propName) + + } else { + + if (!this.linkedProps[id]) this.linkedProps[id] = [] + if (this.linkedProps[id].indexOf(propName) == -1) this.linkedProps[id].push(propName) + + } + + if (storeLinks === 'nested') { + if (!this.nestedLinkedProps[id]) this.nestedLinkedProps[id] = [] + if (this.nestedLinkedProps[id].indexOf(propName) == -1) this.nestedLinkedProps[id].push(propName) + } + + } + + for (var i in widgets) { + + if (widgets[i] === widgetManager) continue + + if (widgets[i].props[k] !== undefined || k === 'value') { + + if (k !== 'value' && originalPropName === k && widgets[i] === originalWidget) { + return 'ERR_CIRCULAR_REF' + } + + var r = k == 'value' ? + widgets[i].getValue(true) : + widgets[i].resolveProp(k, undefined, storeLinks, originalWidget, originalPropName) + + if (subk !== undefined && r !== undefined) r = r[subk] + + var varname = 'VAR_' + varnumber + varnumber-- + + variables[varname] = r + mathscope[varname] = r + + return varname + + } + + } + + }) + + propValue = propValue.replace(/OSC\{([^}]+)\}/g, (m)=>{ + let [address, value, usePreArgs] = m.substr(4, m.length - 5).split(',').map(x=>x.trim()), + resolvedAddress = address.replace(/VAR_[0-9]+/g, (m)=>{ + return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m]) + }) + + if (!this.oscReceivers[address]) { + this.oscReceivers[address] = new OscReceiver({ + address: resolvedAddress, + value: value, + parent: this, + propName: propName, + usePreArgs: usePreArgs === 'false' ? false : true + }) + if (oscReceiverState[address]) { + this.oscReceivers[address].value = oscReceiverState[address] + delete oscReceiverState[address] + } + } else { + this.oscReceivers[address].setAddress(resolvedAddress) + this.oscReceivers[address].addProp(propName) + this.oscReceivers[address].usePreArgs = usePreArgs === 'false' ? false : true + } + + var r = this.oscReceivers[address].value + + var varname = 'VAR_' + varnumber + varnumber-- + + variables[varname] = r + mathscope[varname] = r + + return varname + }) + + try { + propValue = propValue.replace(/#\{(?:[^{}]|\{[^{}]*\})*\}/g, (m)=>{ + // one bracket nesting allowed, if we need two: #\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\} + + // if (!this.mathjsDeprecationWarned) { + // this.mathjsDeprecationWarned = true + // ipc.send('error', `Warning: Widget#${this.getProp('id')} MathJS syntax (#{}) is deprecated and will be removed in the future. Consider using the Javascript syntax instead.`) + // } + + // unescape brackets (not needed anymore, just here for backward compatibility) + m = m.replace(/\\(\{|\})/g, '$1') + + // espace multiline strings + m = m.replace(/`([^`]*)`/g, (m)=>{ + return m.replace(/"/g,'\\"').replace(/\n/g,'\\n').replace(/`/g,'"') + }) + + if (!this.parsers[m]) this.parsers[m] = math.compile(m.substr(2, m.length - 3).trim()) + + for (var k in defaultScope) { + if (mathscope[k] === undefined) mathscope[k] = defaultScope[k] + } + + let r = this.parsers[m].eval(mathscope) + + if (r instanceof math.type.ResultSet && !r.entries.length) { + r = '' + } else if (typeof r === 'object' && r !== null && r.valueOf) { + r = r.valueOf() + if (Array.isArray(r) && r.length == 1) r = r[0] + } + + return typeof r != 'string' ? JSON.stringify(r) : r + }) + } catch (err) { + console.log((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err) + } + + try { + propValue = propValue.replace(/JS\{\{([\s\S]*)\}\}/g, (m, code)=>{ + + if (!this.parsers[code]) this.parsers[code] = evaljs(code, defaultScope) + + let r = this.parsers[code](mathscope) + + if (r === undefined) r = '' + + return typeof r !== 'string' ? JSON.stringify(r) : r + + }) + } catch (err) { + var stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '', + line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : '' + console.log((this.getProp('id') || this.props.id) + '.' + propName + ': JS{{}} error:\n' + err + line) + } + + for (let k in variables) { + var v = typeof variables[k] === 'string' ? variables[k] : JSON.stringify(variables[k]) + propValue = propValue.replace(new RegExp(k, 'g'), v) + } + + // heuristic to avoid using JSON when unnecessary + // if the string doesn't starts with one of these chars + // it's going to fail + // ref in source: https://github.com/douglascrockford/JSON-js + if (' \n+-eE{([0123456789tfn"'.indexOf(propValue[0]) !== -1) { + try { + propValue = JSON.parse(propValue) + } catch (err) {} + } + + } else if (propValue != null && typeof propValue == 'object') { + for (let k in propValue) { + propValue[k] = this.resolveProp(propName, propValue[k], storeLinks, originalWidget, originalPropName, context) + } + } + + return propValue + + + } + + getProp(propName) { + return this.cachedProps[propName] + } + + + isDynamicProp(propName) { + + return this.constructor.dynamicProps.indexOf(propName) !== -1 + + } + + updateProps(propNames, widget, options, updatedProps = []) { + + if (propNames.includes('value')) { + propNames.splice(propNames.indexOf('value'), 1) + propNames.push('value') + } + + if (widget && options) options.id = widget.getProp('id') + + var reCreate = false, + changedProps = [] + + for (var propName of propNames) { + + if (widget === this && updatedProps.includes(propName)) continue + + let propValue = this.resolveProp(propName, undefined, false), + oldPropValue = this.getProp(propName) + + if (!deepEqual(oldPropValue, propValue)) { + + if (!this.isDynamicProp(propName)) { + + if ((!widget || !this.contains(widget)) && widget !== this && !(widget === this && updatedProps.length === 1 && updatedProps[0] === 'value')) { + reCreate = true + break + } + + } else { + + this.cachedProps[propName] = propValue + changedProps.push({propName, oldPropValue}) + + } + + + } + } + + if (reCreate) { + + return this.reCreateWidget({reCreateOptions: options}) + + } else if (changedProps.length) { + + if (options && options.fromEditor) { + this.checkLinkedProps(propNames) + } + + for (var i in changedProps) { + this.onPropChanged(changedProps[i].propName, options, changedProps[i].oldPropValue) + } + + widgetManager.trigger('prop-changed', { + id: this.getProp('id'), + props: changedProps, + widget: this, + options: options + }) + + } + + } + + onPropChanged(propName, options={}, oldPropValue) { + + switch(propName) { + + case 'value': + this.setValue(this.getProp('value'), {sync: true, send: options.send, id: options.id}) + return + + case 'top': + case 'left': + this.setContainerStyles(['geometry']) + return + + case 'height': + case 'width': + this.setContainerStyles(['geometry']) + resize.check(this.container) + return + + case 'label': + this.setContainerStyles(['label']) + if (oldPropValue === false || this.getProp('label') === false) { + resize.check(this.container) + } + return + + case 'css': + this.setContainerStyles(['css']) + this.onPropChanged('color') + var re = /width|height|display/ + if (re.test(oldPropValue) || re.test(this.getProp('css'))) { + resize.check(this.container) + } + return + + case 'color': + this.setContainerStyles(['color']) + return + + case 'precision': + case 'address': + case 'preArgs': + case 'target': + case 'noSync': + if (propName === 'address') { + for (var k in this.oscReceivers) { + var receiver = this.oscReceivers[k] + if (receiver.prefix !== '') { + receiver.setAddress() + } + } + } + if (propName === 'precision') this.precision = Math.min(20,Math.max(this.getProp('precision', undefined, false),0)) + var data = {}, + oldData = { + preArgs: propName == 'preArgs' ? oldPropValue : this.getProp('preArgs'), + address: propName == 'address' ? oldPropValue : this.getProp('address') + } + data[propName] = this.getProp(propName) + if (propName === 'address' && this.getSplit()) { + data['split'] = this.getSplit() + } + widgetManager.registerWidget(this, data, oldData) + return + + } + + } + + setContainerStyles(styles = ['geometry', 'label', 'css', 'color']) { + + if (styles.includes('geometry')) { + + // geometry + for (let d of ['width', 'height', 'top', 'left']) { + let val = this.getProp(d), + geometry + + if (val !== undefined) { + if (parseFloat(val) < 0) val = 0 + geometry = parseFloat(val) == val ? parseFloat(val)+'rem' : val + } + + if (geometry) { + if (geometry === 'auto') geometry = '' + this.container.style[d] = geometry + if (d === 'width') this.container.style.minWidth = geometry + if (d === 'height') this.container.style.minHeight = geometry + this.container.classList.toggle('absolute-position', geometry && (d === 'top' || d === 'left')) + } + } + + } + + if (styles.includes('label')) { + + // label + if (this.getProp('label') === false) { + this.container.classList.add('nolabel') + } else { + this.container.classList.remove('nolabel') + var label = this.getProp('label') == 'auto'? + this.getProp('id'): + iconify(this.getProp('label')) + + this.label.innerHTML = label + } + + } + + if (styles.includes('css')) { + + // css + var css = String(this.getProp('css')), + extraCssClasses = [] + + // extra css "class" property + css = css.replace(/^[^\S\n]*class[^\S\n]*:[^\S\n]*([^;\n\s]+);?/igm, (m, c)=>{ + if (c === 'widget' || c.includes('-container')) return m + extraCssClasses.push(c.replace(/"'/g,'')) + return '' + }) + + + // escpape windows absolute file paths + css = css.replace(/url\(([^)]*)\)/g, (m, url)=>{ + var parser = urlParser(url) + if (!parser.protocol.match(/http|data/)) m = m.replace(':', '_:_') + m = m.replace(/\\/g, '\\\\') + return m + }) + + + var prefix = '#' + this.hash, + scopedCss = scopeCss(css, prefix), + unScopedCss = '' + + + try { + + dummyDOM.style = css + unScopedCss = dummyDOM.getAttribute('style') || '' + + } catch(err) { + + // fallback for browser that don't allow assigning "style" property + css + .replace(/\{[^}]*\}/g, '') + .replace(/^[^@#.]*:.*/gm, (m)=>{ + unScopedCss += m[m.length - 1] === ';' ? m : m + ';' + }) + + } + + + + if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1') + if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix) + + var style = html``, + oldStyle = DOM.get(this.container, '> style')[0] + + if (oldStyle) { + this.container.replaceChild(style, oldStyle) + } else if (scopedCss.length || unScopedCss.length){ + this.container.insertBefore(style, this.container.childNodes[0] || null) + } + + + // apply extra css classes + + if (this.extraCssClasses && this.extraCssClasses.length) { + this.container.classList.remove(...this.extraCssClasses) + this.extraCssClasses = [] + } + + if (extraCssClasses.length) { + this.container.classList.add(...extraCssClasses) + this.extraCssClasses = extraCssClasses + } + + } + + if (styles.includes('color')) { + + // color + this.container.style.setProperty('--color-custom', this.getProp('color') && this.getProp('color') != 'auto' ? this.getProp('color') : '') + + } + + + } + + reCreateWidget(options={}){ + + if (!this.removed) return updateWidget(this, options) + + } + + onRemove(){ + + this.removed = true + widgetManager.off(undefined, undefined, this) + this.removeOscReceivers() + + } + +} + +Widget.parsersContexts = {} + +Widget.dynamicProps = [ + 'top', + 'left', + 'height', + 'width', + 'label', + 'css', + 'value', + 'color', + 'precision', + 'address', + 'preArgs', + 'target', + 'bypass' +] + +module.exports = Widget diff --git a/src/client/app/widgets/containers/clone.js b/src/client/app/widgets/containers/clone.js new file mode 100644 index 00000000..ee46e385 --- /dev/null +++ b/src/client/app/widgets/containers/clone.js @@ -0,0 +1,299 @@ +var Container = require('../common/container'), + widgetManager = require('../../managers/widgets'), + resize = require('../../events/resize'), + parser = require('../../parser'), + {deepCopy, deepEqual} = require('../../utils'), + {diff, diffToWidget} = require('../../editor/diff'), + html = require('nanohtml') + +var excludedCloneClasses = ['widget', 'absolute-position', 'ui-resizable', 'ui-draggable', 'not-editable', 'editing'] + +class Clone extends Container() { + + static description() { + + return 'Widget replication with overridable properties.' + + } + + static defaults() { + + return super.defaults({ + + _clone:'clone', + + widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'}, + + _overrides:'overrides', + + props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'}, + + }, ['label', 'color', 'linkId', '_value', 'default', 'value', '_osc', 'precision', 'address', 'preArgs', 'target', 'bypass']) + + } + + constructor(options) { + + options.props.label = '' + options.props.variables = '@{parent.variables}' + + super({...options, html: html`
      `}) + + this.cloneLock = false + this.cloneTarget = null + this.cloneClass = [] + + this.container.classList.add('empty') + + this.bindTarget(this.getCloneTarget()) + if (this.cloneTarget) this.createClone(true) + + // global listener to catch cloneTarget's creation if no target is locked + widgetManager.on('widget-created', (e)=>{ + + if (this.cloneTarget) return + + var {id, widget} = e + + if (id === this.getProp('widgetId') && this.isValidCloneTarget(widget)) { + + var clone = this.children[0] + + this.unbindTarget() + + if (!clone) { + + this.updateContainer(false) + this.bindTarget(widget) + this.createClone() + + } else { + + this.bindTarget(widget) + this.updateClone() + + } + + } + + }, {context: this}) + + widgetManager.on('prop-changed', (e)=>{ + + if (!this.cloneTarget) return + + if (e.widget === this.cloneTarget || this.cloneTarget.contains(e.widget)) { + + this.updateClone(e.options) + + } + + }, {context: this}) + + } + + getCloneTarget() { + + // attempt to acquire a cloneTarget if 'widget-created' event has not been catched + // (the target might have been created before the clone itself) + + var widgets = widgetManager.getWidgetById(this.getProp('widgetId')) + .filter(el=>this.isValidCloneTarget(el)) + + if (widgets.length === 0) return null + if (widgets.length === 1) { + return widgets[0] + } + + // when duplicating clones pointing to an object with a static id, + // each clone will recreate an object with the same id internally + // we try to get the original one if there is more than 2 clone pointing to the same id (avoiding cloning the clone) + + function isCreatedByAClone(wi){ + var parent = wi.parent + return parent && parent.getProp('type') === 'clone' + } + + var target = widgets[0] + for (var w of widgets) { + if (!isCreatedByAClone(w)) { + target = w + break + } + } + + return target + + } + + isValidCloneTarget(widget) { + + return !(widget.contains(this) || this.contains(widget)) + + } + + createClone(init) { + + if (this.cloneLock) return + + this.cloneLock = true + + var data = {...deepCopy(this.cloneTarget.props), ...this.getProp('props')} + + parser.parse({ + data: data, + parentNode: this.widget, + parent: this + }) + + this.updateContainer(!init) + + this.cloneLock = false + + } + + unbindTarget() { + + if (!this.cloneTarget) return + + this.cloneTarget.off(undefined, undefined, this) + + this.cloneTarget = null + + } + + bindTarget(target) { + + if (!target) return + + this.cloneTarget = target + + // listen for cloneTarget's deletion + // if it is just edited, its recreation will be catched by the global 'widget-created' event handler + this.cloneTarget.on('widget-removed', (e)=>{ + if (this.cloneTarget === e.widget) { + this.unbindTarget() + } + }, {context: this}) + + // listen for cloneTarget's content updates + this.cloneTarget.on('widget-created', (e)=>{ + + var {widget} = e, + parent = widget.parent + + while (parent !== this.cloneTarget && parent !== widgetManager) { + // if updated widget is in a nested clone, ignore it: + // it will be handled by the nested clone that targets it + if (parent.getProp('type') === 'clone') return + parent = parent.parent + } + + this.updateClone() + + }, {context: this}) + + } + + updateClone(options) { + + if (this.cloneLock) return + + this.cloneLock = true + + var data = {...deepCopy(this.cloneTarget.props), ...this.getProp('props')}, + clone = this.children[0] + + var delta = diff.diff(clone.props, data) || {}, + [widget, patch] = diffToWidget(clone, delta), + changedProps = Object.keys(patch) + + if (changedProps.length) { + + diff.patch(widget.props, patch) + + + if (changedProps.some(x => !widget.isDynamicProp(x))) { + + clone.reCreateWidget({reuseChildren: false}) + this.updateContainer(false) + + } else { + + widget.updateProps(changedProps, this, options) + this.updateContainer(true) + + } + + } + + + + this.cloneLock = false + + } + + updateContainer(checkResize) { + + + if (this.cloneTarget) { + + var classes = [...this.cloneTarget.container.classList].filter(i=>excludedCloneClasses.indexOf(i) === -1) + + if (!deepEqual(classes, this.cloneClass)) { + this.container.classList.remove(...this.cloneClass) + this.cloneClass = classes + this.container.classList.add(...this.cloneClass) + } + + this.container.classList.remove('empty') + + for (var w of this.getAllChildren()) { + w.container.classList.add('not-editable') + } + + if (checkResize) resize.check(this.widget) + + } else if (this.cloneClass.length) { + + this.container.classList.remove(...this.cloneClass) + this.container.classList.add('empty') + this.cloneClass = [] + this.widget.innerHTML = '' + widgetManager.removeWidgets(this.getAllChildren()) + + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'widgetId': + this.unbindTarget() + this.updateContainer(false) + this.bindTarget(this.getCloneTarget()) + if (this.cloneTarget) this.createClone() + return + + } + + } + + onRemove(){ + + this.unbindTarget() + super.onRemove() + + } + +} + +Clone.dynamicProps = Clone.prototype.constructor.dynamicProps.concat( + 'widgetId' +) + +module.exports = Clone diff --git a/src/client/app/widgets/containers/modal.js b/src/client/app/widgets/containers/modal.js new file mode 100644 index 00000000..6fd28fde --- /dev/null +++ b/src/client/app/widgets/containers/modal.js @@ -0,0 +1,230 @@ +var Panel = require('./panel'), + Widget = require('../common/widget'), + {icon, iconify} = require('../../ui/utils'), + resize = require('../../events/resize'), + doubletab = require('../mixins/double_tap'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +class Modal extends Panel { + + static description() { + + return 'A toggle button that opens a popup panel. Cannot contain tabs directly.' + + } + + static defaults() { + + return Widget.defaults({ + + _modal:'modal', + + doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'}, + popupLabel: {type: 'string', value: '', help: 'Alternative label for the modal popup'}, + popupWidth: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'}, + popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'}, + popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, + popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, + scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'}, + + }, [], { + + _chidlren:'children', + + variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, + widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object'}, + value: {type: 'integer', value: '', help: [ + 'Defines the modal\'s state:`0` for closed, `1` for opened' + ]}, + + }) + + } + + constructor(options) { + + super(options) + + this.disabledProps = [] + + this.popup = html` + + ` + + this.container.appendChild(this.popup) + + // convert dimensions / coordinates to rem + var geometry = {} + for (var g of ['Width', 'Height', 'Left', 'Top']) { + geometry[g] = parseFloat(this.getProp('popup' + g)) == this.getProp('popup' + g) ? parseFloat(this.getProp('popup' + g)) + 'rem' : this.getProp('popup' + g) + } + + this.popup.style.setProperty('--width', geometry.Width) + this.popup.style.setProperty('--height', geometry.Height) + + if (geometry.Left !== 'auto') { + this.popup.style.setProperty('--left', geometry.Left) + this.popup.classList.add('x-positionned') + } + + if (geometry.Top !== 'auto') { + this.popup.style.setProperty('--top', geometry.Top) + this.popup.classList.add('y-positionned') + } + + this.light = this.container.appendChild(html`
      `) + + if (this.getProp('doubleTap')) { + doubletab(this.light, ()=>{ + this.setValue(1, {sync:true, send:true}) + }) + } else { + this.light.addEventListener('fast-click',(e)=>{ + if (e.capturedByEditor === true) return + e.detail.preventOriginalEvent = true + this.setValue(1, {sync:true, send:true}) + }) + } + + var closer = DOM.get(this.popup, '.closer')[0] + this.popup.addEventListener('fast-click',(e)=>{ + if ((e.target === this.popup || e.target === closer) && this.value == 1) { + e.detail.preventOriginalEvent = true + this.setValue(0, {sync:true, send:true}) + } + }) + + this.escapeKeyHandler = ((e)=>{ + if (e.keyCode==27) this.setValue(0, {sync:true, send:true}) + }).bind(this) + + this.parentScroll = [0,0] + this.value = 0 + this.init = false + this.labelChange = true + + } + + setValue(v, options={}) { + + if (this.init === undefined) return + + this.value = v ? 1 : 0 + + if (!this.init && this.value) { + DOM.get(this.popup, '.popup-content')[0].appendChild(this.widget) + this.init = true + } + + if (this.value && this.labelChange) { + this.updatePopupLabel() + } + + this.popup.classList.toggle('show', this.value) + this.container.classList.toggle('on', this.value) + this.light.classList.toggle('on', this.value) + + this.bindEscKey(this.value) + + if (this.init) this.fixParents() + + if (this.value) { + resize.check(this.widget, true) + } + + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + + } + + bindEscKey(set) { + + if (set) { + document.addEventListener('keydown', this.escapeKeyHandler) + } else { + document.removeEventListener('keydown', this.escapeKeyHandler) + } + + } + + onRemove() { + this.bindEscKey(false) + this.setValue(0) + super.onRemove() + } + + fixParents() { + + var parent = this.parent, + scrollFixed = false + + while (parent && parent.props && parent.getProp('type') !== 'modal') { + + // scroll + if (!scrollFixed && parent.getProp('type') == 'tab') { + if (this.value) { + this.parentScroll = [parent.widget.scrollLeft, parent.widget.scrollTop] + } + parent.widget.scrollLeft = this.value ? 0 : this.parentScroll[0] + parent.widget.scrollTop = this.value ? 0 : this.parentScroll[1] + parent.widget.style.overflow = this.value ? 'hidden' : '' + scrollFixed = true + } + + // stacking + parent.container.style.zIndex = this.value ? 'initial' : '' + parent.container.style.contain = this.value ? 'style size' : '' + + parent = parent.parent + } + + this.container.style.contain = this.value ? 'style size' : '' + + + } + + updatePopupLabel() { + + if (!this.popup) return + + var label = this.getProp('popupLabel') ? iconify(this.getProp('popupLabel')) : DOM.get(this.container, '> .label')[0].innerHTML + DOM.get(this.popup, '.popup-title .popup-label')[0].innerHTML = label + this.labelChange = false + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'popupLabel': + case 'label': + if (this.value) { + this.updatePopupLabel() + } else { + this.labelChange = true + } + + return + + } + + } + +} + +Modal.dynamicProps = Modal.prototype.constructor.dynamicProps.concat( + 'popupLabel' +) + +module.exports = Modal diff --git a/src/client/app/widgets/containers/panel.js b/src/client/app/widgets/containers/panel.js new file mode 100644 index 00000000..afdf59ba --- /dev/null +++ b/src/client/app/widgets/containers/panel.js @@ -0,0 +1,217 @@ +var Container = require('../common/container'), + widgetManager = require('../../managers/widgets'), + parser = require('../../parser'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +class Panel extends Container() { + + static description() { + + return 'Widgets or Tabs container.' + + } + + static defaults() { + + return super.defaults({ + + _panel:'panel', + + scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'}, + border: {type: 'boolean', value: true, help: 'By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too'}, + + }, [], { + + _children:'children', + + variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, + widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'}, + tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously'}, + + value: {type: 'integer', value: '', help: [ + 'Defines currently opened tab in the widget', + 'A tab can be opened only by setting its parent\'s value' + ]}, + + }) + + + } + + constructor(options) { + + + super({...options, html: html`
      `}) + + if (this.getProp('scroll') === false) this.widget.classList.add('noscroll') + if (this.getProp('border') === false) this.container.classList.add('noborder') + if (this.getProp('tabs') && this.getProp('tabs').length) this.widget.classList.add('has-tabs') + + this.value = -1 + this.tabs = [] + + if (this.getProp('tabs') && this.getProp('tabs').length) { + + this.widget.appendChild(html``) + this.navigation = DOM.get(this.widget, '.tablist')[0] + + this.wrapper = this.widget.appendChild(html`
      `) + + this.children = options.children || new Array(this.getProp('tabs').length) + for (let i = 0; i < this.children.length; i++) { + if (this.children[i]) { + this.wrapper.appendChild(this.children[i].container) + this.children[i].mounted = true + this.children[i].parent = this + this.children[i].parentNode = this.wrapper + } else { + parser.parse({ + data: this.getProp('tabs')[i], + parentNode: this.wrapper, + parent: this, + tab: true, + index: i + }) + } + } + + if (options.children) this.alignChildrenProps() + + this.createNavigation() + + this.navigation.addEventListener('fast-click', (e)=>{ + if (!e.target.hasAttribute('data-widget')) return + var index = DOM.index(e.target) + this.setValue(index, {sync: true, send:this.value != index}) + }) + + this.on('tab-created', (e)=>{ + this.createNavigation() + e.stopPropagation = true + }) + + this.setValue(this.getProp('value') || 0) + + } else if (this.getProp('widgets') && this.getProp('widgets').length) { + + this.children = options.children || new Array(this.getProp('widgets').length) + for (let i = 0; i < this.children.length; i++) { + if (this.children[i]) { + this.widget.appendChild(this.children[i].container) + this.children[i].mounted = true + this.children[i].parent = this + this.children[i].parentNode = this.widget + } else { + parser.parse({ + data: this.getProp('widgets')[i], + parentNode: this.widget, + parent: this, + index: i + }) + } + } + + if (options.children) this.alignChildrenProps() + + + } + + if (this.getProp('tabs') && !this.getProp('tabs').length) { + this.disabledProps.push( + 'precision', 'address', 'preArgs', 'target', 'bypass', + 'value', 'default' + ) + } + if (this.getProp('widgets') && !this.getProp('widgets').length) { + this.disabledProps.push( + 'scroll' + ) + } + + + + } + + createNavigation() { + + this.navigation.innerHTML = '' + this.tabs = [] + + DOM.each(this.wrapper, '> .widget', (tab)=>{ + + let widget = widgetManager.getWidgetByElement(tab), + style = widget.getProp('color') == 'auto' ? '' : `--color-custom:${widget.getProp('color')}` + + this.tabs.push(widget) + this.navigation.appendChild(html` + + `) + + }) + + + this.setValue(this.value) + + } + + setValue(v, options={}) { + if (this.tabs.length && typeof v == 'number' && v >= 0 && v < this.tabs.length) { + + for (let i in this.tabs) { + if (i != v) this.tabs[i].hide() + } + + this.value = v + + this.tabs[v].show() + DOM.each(this.navigation, 'li', (el)=>{el.classList.remove('on')})[v].classList.add('on') + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + } + + scroll(s) { + + if (!s) { + return [this.widget.scrollLeft, this.widget.scrollTop] + } else { + this.widget.scrollLeft = s[0] + this.widget.scrollTop = s[1] + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of this.children) { + if (w) w.onPropChanged('color') + } + return + + } + + } + + + onRemove() { + this.off('resize') + super.onRemove() + } + +} + +Panel.dynamicProps = Panel.prototype.constructor.dynamicProps.concat( + 'variables' +) + +module.exports = Panel diff --git a/src/client/app/widgets/containers/root.js b/src/client/app/widgets/containers/root.js new file mode 100644 index 00000000..df63ccfc --- /dev/null +++ b/src/client/app/widgets/containers/root.js @@ -0,0 +1,101 @@ +var Panel = require('./panel'), + Widget = require('../common/widget'), + {icon} = require('../../ui/utils'), + {enableTraversingGestures, disableTraversingGestures} = require('../../events/drag'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +class Root extends Panel { + + static description() { + + return 'Main (unique) container' + + } + + static defaults() { + + return Widget.defaults({}, ['label', '_geometry', 'left', 'top', 'width', 'height'], { + + _children:'children', + + traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'}, + variables: {type: '*', value: {}, help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, + tabs: {type: 'array', value: [{}], help: 'Each element of the array must be a tab object'}, + id: {type: 'string', value: 'root', help: 'Widgets sharing the same id will act as clones and update each other\'s value(s) without sending extra osc messages' }, + + value: {type: 'integer', value: '', help: [ + 'Defines currently opened tab in the widget', + 'A tab can be opened only by setting its parent\'s value' + ]}, + + }) + + } + + constructor(options) { + + options.root = true + options.props.id = 'root' + options.props.scroll = true + options.props.label = false + + super(options) + + this.widget.classList.add('root') + + this.disabledProps.push('id') + + DOM.each(this.widget, '> .navigation', (el)=>{ + el.classList.add('main') + }) + + if (this.getProp('traversing')) this.setTraversing() + + } + + createNavigation() { + + super.createNavigation() + + this.navigation.appendChild(html` +
    • + ${raw(icon('bars'))} +
    • + `) + + } + + setTraversing(update) { + + var traversing = this.getProp('traversing') + + disableTraversingGestures(this.widget) + + if (traversing) { + enableTraversingGestures(this.widget, {smart: typeof traversing === 'string' && traversing.match(/smart|auto/)}) + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'traversing': + this.setTraversing() + return + + } + + } + +} + +Root.dynamicProps = Root.prototype.constructor.dynamicProps.concat( + 'traversing' +) + +module.exports = Root diff --git a/src/client/app/widgets/containers/strip.js b/src/client/app/widgets/containers/strip.js new file mode 100644 index 00000000..297c59f6 --- /dev/null +++ b/src/client/app/widgets/containers/strip.js @@ -0,0 +1,66 @@ +var Panel = require('./panel'), + Widget = require('../common/widget') + +module.exports = class Strip extends Panel { + + static description() { + + return 'Widget container that display its children in a single column or row.' + + } + + static defaults() { + + return Widget.defaults({ + + _strip: 'strip', + + scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'}, + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display widgets horizontally'}, + stretch: {type: 'boolean', value: false, help: 'Set to `true` to stretch widgets evenly'}, + border: {type: 'boolean', value: true, help: 'By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too'}, + spacing: {type: 'integer|percentage', value: 0, help: 'Adds space between widgets. Percents are always relative to the strips width'} + + }, [], { + + _children:'children', + + variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, + widgets: {type: 'array', value: [], help: [ + 'Each element of the array must be a widget object', + '- By default, children widgets that don\'t have an explicit `width`/`height` set will be shrinked to respect the sizes specified by others', + '- Adding `flex:1;` to a children\'s `css` will give it the ability the fill the remaining space', + '- Multiple children can have a `flex:x;` css property (`x` will ponderate their expansion)' + ]} + + }) + + } + + constructor(options) { + + var defaults = Panel.defaults()._props() + for (var k in defaults) { + if (!options.props.hasOwnProperty(k)) + options.props[k] = defaults[k] + } + + super(options) + + this.disabledProps = [] + + if (this.getProp('spacing')) { + var spacing = this.getProp('spacing') + if (!isNaN(spacing)) spacing += 'rem' + this.widget.style.setProperty('--spacing', spacing) + } + + this.container.classList.add(this.getProp('horizontal') ? 'horizontal' : 'vertical') + if (this.getProp('stretch')) this.container.classList.add('stretch') + + } + + setValue(){} + getValue(){} + +} diff --git a/src/client/app/widgets/containers/tab.js b/src/client/app/widgets/containers/tab.js new file mode 100644 index 00000000..d6089805 --- /dev/null +++ b/src/client/app/widgets/containers/tab.js @@ -0,0 +1,81 @@ +var Panel = require('./panel'), + Widget = require('../common/widget'), + resize = require('../../events/resize') + +module.exports = class Tab extends Panel { + + static description() { + + return 'Tabbed panel widget' + + } + + static defaults() { + + return Widget.defaults({ + + _tab:'tab', + + detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'} + + }, ['_geometry', 'left', 'top', 'width', 'height'], { + + _children:'children', + + variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, + widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A tab cannot contain widgets and tabs simultaneously'}, + tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A tab cannot contain widgets and tabs simultaneously'}, + + value: {type: 'integer', value: '', help: [ + 'Defines currently opened tab in the widget', + 'A tab can be opened only by setting its parent\'s value' + ]}, + + }) + + } + + constructor(options) { + + options.props.scroll = true + + super(options) + + this.container.classList.add('show') + this.widget.classList.add('tab') + + this.detached = false + + } + + hide() { + if (this.detached) return + if (this.getProp('detached')) this.container.removeChild(this.widget) + this.container.classList.remove('show') + this.detached = true + + } + show() { + if (!this.detached) return + if (this.getProp('detached')) this.container.appendChild(this.widget) + this.container.classList.add('show') + this.detached = false + resize.check(this.widget, true) + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'label': + case 'color': + if (this.parent.createNavigation) this.parent.createNavigation() + return + + } + + } + +} diff --git a/src/client/app/widgets/index.js b/src/client/app/widgets/index.js new file mode 100644 index 00000000..7e2c1298 --- /dev/null +++ b/src/client/app/widgets/index.js @@ -0,0 +1,72 @@ +module.exports.widgets = { + // tabs + tab: require('./containers/tab'), + root: require('./containers/root'), + + // sliders + fader: require('./sliders/fader'), + knob: require('./sliders/knob'), + encoder: require('./sliders/encoder'), + range: require('./sliders/range'), + + // buttons + toggle: require('./buttons/toggle'), + push: require('./buttons/push'), + switch: require('./buttons/switch'), + dropdown: require('./buttons/dropdown'), + menu: require('./buttons/menu'), + + // pads + xy: require('./pads/xy'), + rgb: require('./pads/rgb'), + multixy: require('./pads/multixy'), + + // matrices + matrix: require('./matrices/matrix'), + keyboard: require('./matrices/keyboard'), + patchbay: require('./matrices/patchbay').PatchBay, + patchbaynode: require('./matrices/patchbay').PatchBayNode, + + // plots + led: require('./plots/led'), + rgbled: require('./plots/rgbled'), + plot: require('./plots/plot'), + eq: require('./plots/eq'), + visualizer: require('./plots/visualizer'), + meter: require('./plots/meter'), + text: require('./plots/text'), + image: require('./plots/image'), + svg: require('./plots/svg'), + html: require('./plots/html'), + frame: require('./plots/frame'), + + // containers + strip: require('./containers/strip'), + panel: require('./containers/panel'), + modal: require('./containers/modal'), + clone: require('./containers/clone'), + + // state switchers + switcher: require('./switchers/switcher'), + crossfader: require('./switchers/crossfader'), + state: require('./switchers/state'), + + // inputs + input: require('./inputs/input'), + keys: require('./inputs/keys'), + script: require('./inputs/script'), + gyroscope: require('./inputs/gyroscope'), + file: require('./inputs/file'), + +} + +module.exports.categories = { + 'Sliders':['fader','knob', 'encoder', 'range'], + 'Buttons':['toggle','push','switch', 'dropdown', 'menu'], + 'Pads':['xy','rgb','multixy'], + 'Matrices':['matrix', 'keyboard', 'patchbay'], + 'Plots':['plot','eq','visualizer','led', 'rgbled','meter','text', 'image', 'svg', 'html', 'frame'], + 'Containers':['panel','strip','modal', 'clone'], + 'Switchers':['state', 'switcher','crossfader'], + 'Inputs':['input', 'keys', 'script', 'gyroscope', 'file'] +} diff --git a/src/client/app/widgets/inputs/file.js b/src/client/app/widgets/inputs/file.js new file mode 100644 index 00000000..39938da1 --- /dev/null +++ b/src/client/app/widgets/inputs/file.js @@ -0,0 +1,80 @@ +var Widget = require('../common/widget'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + {remoteBrowse, icon} = require('../../ui/utils') + +module.exports = class Input extends Widget { + + static description() { + + return 'File/Folder selector (server-side).' + + } + + static defaults() { + + return super.defaults({ + + _input:'input', + + directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, + extension: {type: 'string', value: '*', help: 'Only display files with this extension'}, + hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'}, + allowDir: {type: 'boolean', value: false, help: 'Allow selecting a folder (by pressing "open" when no file is selected)'} + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      ${raw(icon('folder-open'))}
      + `}) + + this.text = DOM.get(this.widget, 'span')[0] + this.widget.addEventListener('fast-click', (e)=>{ + + if (e.capturedByEditor === true) return + + remoteBrowse({ + extension: this.getProp('extension').replace(/^\.?(.*)$/, '$1'), + directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'), + loadDir: this.getProp('allowDir') + }, (path)=>{ + + this.setValue(path.join(path[0][0] === '/' ? '/' : '\\'), { + sync: true, + send: true + }) + + }) + }) + + } + + + setValue(v, options={}) { + + this.value = v + + var sep = v[0] === '/' ? '/' : '\\' + if (this.getProp('hidePath')) { + if (v[v.length - 1] === sep) { + this.text.textContent = v.substr(0, v.length - 1).split(sep).pop() + sep + } else { + this.text.textContent = v.split(sep).pop() + } + } else { + this.text.textContent = v + } + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + + + + +} diff --git a/src/client/app/widgets/inputs/gyroscope.js b/src/client/app/widgets/inputs/gyroscope.js new file mode 100644 index 00000000..3b074eba --- /dev/null +++ b/src/client/app/widgets/inputs/gyroscope.js @@ -0,0 +1,125 @@ +var Widget = require('../common/widget'), + GyroNorm = require('gyronorm/dist/gyronorm.complete.min.js'), + {icon} = require('../../ui/utils'), + {clip} = require('../utils'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + + +class Gyroscope extends Widget { + + static description() { + + return 'Device motion/orientation sensor.' + + } + + static defaults() { + + return super.defaults({ + + _gyroscope: 'gyroscope', + + frequency: {type: 'number', value: 30, help: 'Value update frequency (updates per seconds)'}, + normalize: {type: 'boolean', value: true, help: 'Normalize gravity related values'}, + compass: {type: 'boolean', value: false, help: 'Set to `true` to return the orientation values with respect to the actual north direction of the world instead of the head direction of the device'}, + screenAdjusted: {type: 'boolean', value: false, help: 'Set to `true` to return screen adjusted values'} + + }, [], { + + value: {type: 'object', value: '', help: [ + 'The gyroscope\'s value is an object containing multiple values, which can be used by other widgets via the property maths syntax', + '- `value.do.alpha`: deviceorientation event alpha', + '- `value.do.beta`: deviceorientation event beta', + '- `value.do.gamma`: deviceorientation event gamma', + '- `value.do.absolute`: deviceorientation event absolute', + '- `value.dm.x`: devicemotion event acceleration x', + '- `value.dm.y`: devicemotion event acceleration y', + '- `value.dm.z`: devicemotion event acceleration z', + '- `value.dm.gx`: devicemotion event accelerationIncludingGravity x', + '- `value.dm.gy`: devicemotion event accelerationIncludingGravity y', + '- `value.dm.gz`: devicemotion event accelerationIncludingGravity z', + '- `value.dm.alpha`: devicemotion event rotationRate alpha', + '- `value.dm.beta`: devicemotion event rotationRate beta', + '- `value.dm.gamma`: devicemotion event rotationRate gamma' + ]}, + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      + ${raw(icon('compass'))} +
      + `}) + + this.sensor = new GyroNorm() + this.sensor.init({ + + frequency: 1000 / clip(this.getProp('frequency'), [0.01, 60]), + gravityNormalized: this.getProp('normalize'), + orientationBase: this.getProp('compass') ? GyroNorm.WORLD : GyroNorm.GAME, + decimalCount: this.getProp('precision'), + screenAdjusted: this.getProp('screenAdjusted'), + logger: null + + }).then(()=>{ + + this.sensor.start((data)=>{ + + this.setValue(data, {sync: true, send: true}) + + // data.do.alpha ( deviceorientation event alpha value ) + // data.do.beta ( deviceorientation event beta value ) + // data.do.gamma ( deviceorientation event gamma value ) + // data.do.absolute ( deviceorientation event absolute value ) + + // data.dm.x ( devicemotion event acceleration x value ) + // data.dm.y ( devicemotion event acceleration y value ) + // data.dm.z ( devicemotion event acceleration z value ) + + // data.dm.gx ( devicemotion event accelerationIncludingGravity x value ) + // data.dm.gy ( devicemotion event accelerationIncludingGravity y value ) + // data.dm.gz ( devicemotion event accelerationIncludingGravity z value ) + + // data.dm.alpha ( devicemotion event rotationRate alpha value ) + // data.dm.beta ( devicemotion event rotationRate beta value ) + // data.dm.gamma ( devicemotion event rotationRate gamma value ) + + + }) + + }).catch((e)=>{ + + console.log(e) + + }) + + } + + + + setValue(v, options={} ) { + + this.value = v + + // if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + + onRemove() { + + this.sensor.end() + + super.onRemove() + + } + + +} + +module.exports = Gyroscope diff --git a/src/client/app/widgets/inputs/input.js b/src/client/app/widgets/inputs/input.js new file mode 100644 index 00000000..9dea5330 --- /dev/null +++ b/src/client/app/widgets/inputs/input.js @@ -0,0 +1,169 @@ +var Canvas = require('../common/canvas'), + {deepCopy} = require('../../utils'), + html = require('nanohtml') + +module.exports = class Input extends Canvas { + + static description() { + + return 'Text input.' + + } + + static defaults() { + + return super.defaults({ + + _input:'input', + + vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'}, + align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, + unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'}, + editable: {type: 'boolean', value: true, help: 'Set to `false` to make the input non-editable'}, + asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'} + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      + +
      + `}) + + this.value = '' + this.stringValue = '' + this.focused = false + this.tabKeyBlur = false + + if (this.getProp('vertical')) this.widget.classList.add('vertical') + if (this.getProp('align') === 'left') this.widget.classList.add('left') + if (this.getProp('align') === 'right') this.widget.classList.add('right') + + + if (this.getProp('editable')) { + this.canvas.setAttribute('tabindex', 0) + this.canvas.addEventListener('focus', this.focus.bind(this)) + this.input = html`` + this.input.addEventListener('blur', (e)=>{ + this.blur(this.tabKeyBlur) + this.tabKeyBlur = false + }) + var asYouType = this.getProp('asYouType') + this.input.addEventListener('keydown', (e)=>{ + if (e.keyCode === 13) this.blur() // enter + else if (e.keyCode === 27) this.blur(false) // esc + else if (e.keyCode === 9) this.tabKeyBlur = true // tab + else if (asYouType) { + setTimeout(()=>{ + this.inputChange() + }) + } + }) + } else { + this.widget.classList.add('not-editable') + } + + } + + focus() { + + if (this.focused) return + this.focused = true + + this.canvas.setAttribute('tabindex','-1') + this.input.value = this.stringValue + this.widget.insertBefore(this.input, this.canvas) + this.input.focus() + this.input.setSelectionRange(0, this.input.value.length) + + } + + blur(change=true) { + + if (!this.focused) return + this.focused = false + + if (change) this.inputChange() + + this.canvas.setAttribute('tabindex','0') + this.widget.removeChild(this.input) + + } + + inputChange() { + + this.setValue(this.input.value, {sync:true, send:true}) + + } + + resizeHandle(event){ + + super.resizeHandle(event) + + if (this.getProp('vertical')){ + + var ratio = CANVAS_SCALING * this.scaling + + this.ctx.setTransform(1, 0, 0, 1, 0, 0) + this.ctx.rotate(-Math.PI/2) + this.ctx.translate(-this.height * ratio, 0) + + + if (ratio != 1) this.ctx.scale(ratio, ratio) + } + + + } + + setValue(v, options={} ) { + + try { + this.value = JSON.parse(v) + } catch (err) { + this.value = v + } + + this.stringValue = this.getStringValue() + this.batchDraw() + + if (options.send && !options.fromSync) this.sendValue() + if (options.sync) this.changed(options) + + } + + draw() { + + var v = this.stringValue, + width = this.getProp('vertical') ? this.height : this.width, + height = !this.getProp('vertical') ? this.height : this.width + + if (this.getProp('unit') && v.length) v += ' ' + this.getProp('unit') + + this.clear() + + this.ctx.fillStyle = this.colors.text + + if (this.textAlign == 'center') { + this.ctx.fillText(v, Math.round(width/2), Math.round(height/2)) + } else if (this.textAlign == 'right') { + this.ctx.fillText(v, width, Math.round(height/2)) + } else { + this.ctx.fillText(v, 0, Math.round(height/2)) + } + + this.clearRect = [0, 0, width, height] + + } + + getStringValue() { + if (this.value === undefined) return '' + return typeof this.value != 'string' ? + JSON.stringify(deepCopy(this.value, this.precision)).replace(/,/g, ', ') : + this.value + } + +} diff --git a/src/client/app/widgets/inputs/keys.js b/src/client/app/widgets/inputs/keys.js new file mode 100644 index 00000000..a0dd2804 --- /dev/null +++ b/src/client/app/widgets/inputs/keys.js @@ -0,0 +1,180 @@ +var Widget = require('../common/widget'), + {icon} = require('../../ui/utils'), + keyboardJS = require('keyboardjs'), + html = require('nanohtml'), + raw = require('nanohtml/raw') + +class Keys extends Widget { + + static description() { + + return 'Keyboard binding.' + + } + + static defaults() { + + return super.defaults({ + + _keys:'keys', + + binding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see KeyboardJS documentation)'}, + keydown: {type: 'string', value: '', help: [ + 'This property is evaluated each time the key combo is pressed and defines the widget\'s own value. Formulas are given extras variables in this context:', + '- `key`: pressed key name (usefull for handling multiple keys with a single keys widget, lowercased when referencing a character key)', + '- `code`: pressed key code name (full list)', + '- `ctrl`: control key state', + '- `alt`: alt key state', + '- `shift`: shift key state', + '- `meta`: command/windows key state' + ]}, + keyup: {type: 'string', value: '', help: 'Same as `keydown`, but evaluated when releasing the key combo'}, + repeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'}, + + }) + + + } + + constructor(options) { + + super({...options, html: html` +
      + ${raw(icon('keyboard'))} +
      + `}) + + if (this.getProp('binding')) { + + this.widget.appendChild(html`${this.getProp('binding')}`) + + this.keyDownHandler = this.keyDown.bind(this) + this.keyUpHandler = this.keyUp.bind(this) + + keyboardJS.withContext('global', ()=>{ + + keyboardJS.bind(this.getProp('binding'), this.keyDownHandler, this.keyUpHandler) + + }) + + } + + } + + onRemove() { + + super.onRemove() + + if (this.getProp('binding')) { + + keyboardJS.withContext('global', ()=>{ + + keyboardJS.unbind(this.getProp('binding'), this.keyDownHandler, this.keyUpHandler) + + }) + + } + + } + + keyDown(e) { + + if (e.target && e.target.classList.contains('no-keybinding')) return + + if (!this.getProp('repeat') && e) e.preventRepeat() + + e.preventDefault() + + if (this.getProp('keydown') !== '') { + + var context = { + key: e.key, + code: e.code, + ctrl: e.ctrlKey, + shift: e.shiftKey, + alt: e.altKey, + meta: e.metaKey + } + + if (context.key.length === 1) { + context.key = context.key.toLowerCase() + } + + this.setValue(this.resolveProp('keydown', undefined, false, false, false, context), {sync: true, send: true}) + + } + + + this.showKeydown() + + } + + + keyUp(e) { + + if (e.target && e.target.classList.contains('no-keybinding')) return + + e.preventDefault() + + if (this.getProp('keyup') !== '') { + + var context = { + key: e.key, + code: e.code, + ctrl: e.ctrlKey, + shift: e.shiftKey, + alt: e.altKey, + meta: e.metaKey + } + + if (context.key.length === 1) { + context.key = context.key.toLowerCase() + } + + this.setValue(this.resolveProp('keyup', undefined, false, false, false, context), {sync: true, send: true}) + + } + + this.showKeyup() + + } + + showKeydown(){ + + this.widget.style.setProperty('--opacity', 1) + + } + + showKeyup(){ + + this.widget.style.setProperty('--opacity', 0.75) + + } + + setValue(v, options = {}) { + + this.value = v + + // if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + +} + +Keys.parsersContexts.keydown = Keys.parsersContexts.keyup = { + key: 'x', + code: 'x', + ctrl: false, + alt: false, + shift: false, + meta: false +} + +Keys.dynamicProps = Keys.prototype.constructor.dynamicProps.concat( + 'keydown', + 'keyup', + 'repeat' +) + +module.exports = Keys diff --git a/src/client/app/widgets/inputs/script.js b/src/client/app/widgets/inputs/script.js new file mode 100644 index 00000000..0ae1f69d --- /dev/null +++ b/src/client/app/widgets/inputs/script.js @@ -0,0 +1,179 @@ +var Widget = require('../common/widget'), + widgetManager = require('../../managers/widgets'), + {icon} = require('../../ui/utils'), + html = require('nanohtml'), + raw = require('nanohtml/raw'), + {urlParser} = require('../utils') + + +class Script extends Widget { + + static description() { + + return 'Evaluates a script each time it receives a value.' + + } + + static defaults() { + + return super.defaults({ + + _script:'script', + + condition: {type: 'string', value: 1, help: [ + 'When the widget receives a value, if this property return a falsy value, the script property won\'t be evaluated. If it\'s non-falsy, it will be evaluated normally. Formulas are given one extra variable in this context:', + '- `value`: the value received by the widget' + ]}, + script: {type: 'string', value: '', help: [ + 'This property is evaluated each time the widget receives a value* if condition is non-falsy. Formulas are given extras variables in this context:', + '- `value`: value received by the widget', + '- `id`: id of the widget that triggered the script', + '- `send(target, address, arg1, arg2, ...)`: function for sending osc messages (ignores the script\'s targets and the server\'s defaults unless `target` is `false`; ignores the script\'s `preArgs`)', + '- `set(id, value)`: function for setting a widget\'s value', + '- `get(id)`: function for getting a widget\'s value (dynamic equivalent of @{id})', + '- `getProp(id, property)`: function for getting a widget\'s property value ((dynamic equivalent of @{id.property})', + '- `httpGet(url, callback)`: function for making http requests (asynchronous "GET" request and local urls only)', + '', + '* Note: `value` or `linkId` properties can be used to receive other widgets\' values. The `value` property must actually change to trigger the execution, where linked widgets via `linkId` can submit the same value over and over and trigger the execution', + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      + ${raw(icon('code'))} +
      + `}) + + this.scriptLock = false + + } + + + static scriptSet(id, value, options) { + + if (id == options.id) options.sync = false + + var widgets = widgetManager.getWidgetById(id) + + for (var i = widgets.length - 1; i >= 0; i--) { + + return widgets[i].setValue(value, options) + + } + + } + + static scriptGet(id) { + + var widgets = widgetManager.getWidgetById(id) + + for (var i = widgets.length - 1; i >= 0; i--) { + + if (widgets[i].getValue) { + + var v = widgets[i].getValue() + if (v !== undefined) return v + + } + + } + + } + + static scriptGetProp(id, prop) { + + var widgets = widgetManager.getWidgetById(id) + + for (var i = widgets.length - 1; i >= 0; i--) { + + var v = widgets[i].getProp(prop) + if (v !== undefined) return v + + } + + } + + scriptSend(target, address, ...args) { + + var overrides = { + address, + v: args, + preArgs: [] + } + + if (target) overrides.target = Array.isArray(target) ? target : [target] + + this.sendValue(overrides) + + } + + setValue(v, options={} ) { + + if (this.scriptLock) return + + var context = { + value: v, + id: options.id, + send: options.send ? this.scriptSend.bind(this) : ()=>{}, + set: (id, value)=>{Script.scriptSet(id, value, options)}, + get: (id)=>{return Script.scriptGet(id)}, + getProp: (id, prop)=>{return Script.scriptGetProp(id, prop)}, + httpGet: (url, callback)=>{ + var parser = urlParser(url), + err = (e)=>{console.error(e)} + + if (!parser.isLocal()) return err('httpGet error (' + url + '): non-local url') + + var xhr = new XMLHttpRequest() + xhr.open('GET', url, true) + xhr.onload = (e)=>{ + if (xhr.readyState === 4 && xhr.status === 200 && callback) { + callback(xhr.responseText) + } + } + xhr.onerror = (e)=>err('httpGet error (' + url + '): ' + xhr.statusText) + xhr.send(null) + } + } + + var condition = this.resolveProp('condition', undefined, false, false, false, {value: v}) + + if (condition) { + this.scriptLock = true + this.resolveProp('script', undefined, false, false, false, context) + this.scriptLock = false + } + + + // if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + +} + +Script.parsersContexts.condition = { + value: '' +} + +Script.parsersContexts.script = { + value: '', + id: '', + send: ()=>{}, + set: ()=>{}, + get: ()=>{}, + getProp: ()=>{}, + httpGet: ()=>{} +} + +Script.dynamicProps = Script.prototype.constructor.dynamicProps.concat( + 'condition', + 'script' +) + +module.exports = Script diff --git a/src/client/app/widgets/matrices/_matrix_base.js b/src/client/app/widgets/matrices/_matrix_base.js new file mode 100644 index 00000000..ca6511b9 --- /dev/null +++ b/src/client/app/widgets/matrices/_matrix_base.js @@ -0,0 +1,34 @@ +var Container = require('../common/container'), + {enableTraversingGestures} = require('../../events/drag'), + html = require('nanohtml') + + +module.exports = class _matrix_base extends Container() { + + constructor(options) { + + super({...options, html: html`
      `}) + + this.value = [] + + if (this.getProp('traversing')) enableTraversingGestures(this.widget) + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of this.children) { + if (w) w.onPropChanged('color') + } + return + + } + + } + +} diff --git a/src/client/app/widgets/matrices/keyboard.js b/src/client/app/widgets/matrices/keyboard.js new file mode 100644 index 00000000..641fe74c --- /dev/null +++ b/src/client/app/widgets/matrices/keyboard.js @@ -0,0 +1,129 @@ +var _matrix_base = require('./_matrix_base'), + parser = require('../../parser') + + +module.exports = class Keyboard extends _matrix_base { + + static description() { + + return 'Piano keyboard.' + + } + + static defaults() { + + return super.defaults({ + + _matrix: 'matrix', + + keys: {type: 'number', value: 25, help: 'Defines the number keys'}, + start: {type: 'number', value: 48, help: [ + 'MIDI note number to start with (default is C4)', + 'Standard keyboards settings are: `[25, 48]`, `[49, 36]`, `[61, 36]`, `[88, 21]`' + ]}, + traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'}, + on: {type: '*', value: 1, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]}, + off: {type: '*', value: 0, help: [ + 'Set to `null` to send send no argument in the osc message', + 'Can be an `object` if the type needs to be specified (see preArgs)' + ]}, + toggles: {type: 'boolean', value: false, help: 'Set to `true` to make keys bahave like toggle buttons'} + + }, ['_value', 'default', 'value'], { + + split: {type: 'boolean|string', value: false, help: [ + '`true`: the widget\'s index will be appended to the matrice\'s osc address', + '`false`: it will be prepended to the widget\'s preArgs', + '`string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))' + ]}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--color-white:color;` (white keys color)', + '- `--color-black:color;` (black keys color)' + ]} + + }) + + } + + constructor(options) { + + super(options) + + this.on('change',(e)=>{ + + if (e.widget === this) return + + this.value[e.widget._index] = e.widget.getValue() + this.changed(e.options) + + }) + + var start = parseInt(this.getProp('start')), + keys = parseInt(this.getProp('keys')) + + var strData = JSON.stringify(options.props), + pattern = 'wbwbwwbwbwbw', + whiteKeys = 0, whiteKeys2 = 0, i + + for (i = start; i < keys + start && i < 109; i++) { + if (pattern[i % 12] == 'w') whiteKeys++ + } + + for (i = start; i < keys + start && i < 109; i++) { + + var data = JSON.parse(strData) + + data.top = data.left = data.height = data.width = 'auto' + data.type = this.getProp('toggles') ? 'toggle' : 'push' + data.id = this.getProp('id') + '/' + i + data.label = false + data.css = '' + + data.target = '@{parent.target}' + data.precision = '@{parent.precision}' + + if (!this.getProp('split')) { + data.address = '@{parent.address}' + data.preArgs = `#{ + a = @{parent.preArgs}; + b = typeof(a) == 'string' and a == '' ? [] : typeof(a) == 'Array' ? a : [a]; + concat(b, [${i}]) + }` + } else if (typeof this.getProp('split') === 'string' && this.getProp('split')[0] === '/' && /[^\\]\$/.test(this.getProp('split'))) { + data.address = this.getProp('split').replace(/([^\\])(\$)/g,'$1' + i).replace(/\\\$/g, '$') + data.preArgs = '@{parent.preArgs}' + } else if (this.getProp('split')) { + data.address = '@{parent.address}/' + i + data.preArgs = '@{parent.preArgs}' + } + + var key = parser.parse({ + data: data, + parentNode: this.widget, + parent: this + }) + + key._index = i - start + key.container.classList.add('not-editable') + + if (pattern[i % 12] == 'w') { + key.container.classList.add('white') + key.container.style.width = `${100/whiteKeys}%` + whiteKeys2++ + } else { + key.container.classList.add('black') + key.container.style.width = `${60 / whiteKeys}%` + key.container.style.left = `${100 / whiteKeys * (whiteKeys2 - 3/10)}%` + } + + this.value[i - start] = this.getProp('off') + + } + + } + +} diff --git a/src/client/app/widgets/matrices/matrix.js b/src/client/app/widgets/matrices/matrix.js new file mode 100644 index 00000000..80b1b888 --- /dev/null +++ b/src/client/app/widgets/matrices/matrix.js @@ -0,0 +1,187 @@ +var _matrix_base = require('./_matrix_base'), + parser = require('../../parser'), + {deepCopy} = require('../../utils') + + + +class Matrix extends _matrix_base { + + static description() { + + return 'Generic matrix for creating rows/columns of widgets.' + + } + + static defaults() { + + return super.defaults({ + + _matrix: 'matrix', + + widgetType: {type: 'string', value: 'toggle', help: 'Defines the type of the widgets in the matrix'}, + matrix: {type: 'array', value: [2,2], help: 'Defines the number of columns and and rows in the matrix'}, + start: {type: 'integer', value: 0, help: 'First widget\'s index'}, + spacing: {type: 'integer', value: 0, help: 'Adds space between widgets'}, + traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'}, + border: {type: 'boolean', value: true, help: 'Set to `false` to disables the widgets\' borders'}, + props: {type: 'object', value: {}, help: [ + 'Defines a set of property to override the widgets\' defaults.', + 'Formulas in this field are resolved with an extra variable representing each widget\'s index: `$`', + 'Note: by default, the widgets inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)' + ]} + + }, [], {}) + + } + + constructor(options) { + + super(options) + + this.on('change',(e)=>{ + + if (e.widget === this) return + + if (this.getProp('widgetType') === 'clone') { + + if (e.widget.parent.parent !== this) return + + this.value[e.widget.parent._index] = e.widget.getValue() + + } else { + + if (e.widget.parent !== this) return + + this.value[e.widget._index] = e.widget.getValue() + + + } + + this.changed(e.options) + + }) + + this.widget.style.setProperty('--columns', this.getProp('matrix')[0]) + this.widget.style.setProperty('--rows', this.getProp('matrix')[1]) + this.widget.style.setProperty('--spacing', this.getProp('spacing') + 'rem') + + if (this.getProp('borders') === false) this.widget.classList.add('noborders') + + this.start = parseInt(this.getProp('start')) + + if (parser.widgets[this.getProp('widgetType')]) { + + for (let i = 0; i < this.getProp('matrix')[0] * this.getProp('matrix')[1]; i++) { + + var props = this.resolveProp('props', undefined, false, false, false, {'$':i + this.start}) + var data = this.defaultProps(i + this.start) + + if (typeof props === 'object' && props !== null) { + Object.assign(data, props) + } + + var widget = parser.parse({ + data: data, + parentNode: this.widget, + parent: this + }) + + widget._index = i + widget.container.classList.add('not-editable') + + this.value[i] = widget.getValue() + + } + + } else { + + this.errors.widgetType = this.getProp('widgetType') + ' is not a valid widget type' + + } + + } + + defaultProps(i) { + + return { + type: this.getProp('widgetType'), + id: '@{parent.id}/' + i, + address: '@{parent.address}/' + i, + preArgs: '@{parent.preArgs}', + target: '@{parent.target}', + precision: '@{parent.precision}', + bypass: '@{parent.bypass}', + label: i, + top: 'auto', + left: 'auto', + height: 'auto', + width: 'auto' + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'props': + + for (let i = this.children.length - 1; i >= 0; i--) { + + let data = this.resolveProp('props', undefined, false, false, false, {'$': i + this.start}) + + if (typeof data !== 'object' || data === null || Array.isArray(data)) { + data = {} + } + + if (typeof oldPropValue === 'object' && oldPropValue !== null) { + // if an overridden default props is removed, set it back to default + let overriddenDefaults, + widgetDefaults + for (var k in oldPropValue) { + if (data[k] === undefined) { + if (Matrix.overriddenDefaults.indexOf(k) !== -1) { + overriddenDefaults = overriddenDefaults || this.defaultProps(i + this.start) + data[k] = overriddenDefaults[k] + } else { + widgetDefaults = widgetDefaults || parser.defaults[data.type || this.getProp('widgetType')] + data[k] = deepCopy(widgetDefaults[k]) + } + } + } + } + + Object.assign(this.children[i].props, data) + + this.children[i].updateProps(Object.keys(data), this, options) + // this.children[i] might have been recreated + this.children[i].container.classList.add('not-editable') + + } + + return + + } + + } + +} + + + +Matrix.overriddenDefaults = [ + 'type', 'id', 'address', 'preArgs', 'target', 'precision', 'bypass', + 'label', 'top', 'left', 'height', 'width' +] + +Matrix.parsersContexts.props = { + $: 0 +} + +Matrix.dynamicProps = Matrix.prototype.constructor.dynamicProps.concat( + 'props' +) + +module.exports = Matrix diff --git a/src/client/widgets/containers/patchbay.mjs b/src/client/app/widgets/matrices/patchbay.js similarity index 54% rename from src/client/widgets/containers/patchbay.mjs rename to src/client/app/widgets/matrices/patchbay.js index cc10fc29..53340f63 100644 --- a/src/client/widgets/containers/patchbay.mjs +++ b/src/client/app/widgets/matrices/patchbay.js @@ -1,29 +1,17 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import Canvas from '../common/canvas.mjs' -import Container from '../common/container.mjs' -import {iconify} from '../../ui/utils.mjs' -import parser from '../../parser.mjs' -import {DOM, PXSCALE} from '../../globals.mjs' +var Widget = require('../common/widget'), + Canvas = require('../common/canvas'), + Container = require('../common/container'), + parser = require('../../parser'), + html = require('nanohtml') class PatchBayNode extends Widget { - - static defaults() { - - return super.defaults().extend({ - style: { - label: {type: 'string', value: ''} - } - }) - - } - constructor(options) { - super({...options, html: html``}) - - this.widget.innerHTML = iconify(this.getProp('label').replace(//g, '>').replace(/\n/g,'
      ')) + super({...options, html: html` +
      +
      + `}) this.value = [] @@ -33,35 +21,13 @@ class PatchBayNode extends Widget { this.value = Array.isArray(v) ? v : v ? [v] : [] - var allowed = this.parent.outputsValues + var allowed = this.parent.getProp('outputs') for (var i = this.value.length -1; i > -1; i--) { if (allowed.indexOf(this.value[i]) === -1) { this.value.splice(i, 1) } } - if ( - (this.parent.getProp('exclusive') === true - || this.parent.getProp('exclusive') === 'in' - || this.parent.getProp('exclusive') === 'both') - && this.value.length > 1 - ) { - this.value = [this.value.pop()] - } - - if ( - (this.parent.getProp('exclusive') === 'out' || this.parent.getProp('exclusive') === 'both') - && this.value.length > 0 - ) { - for (var input of this.parent.inputsWidgets) { - if (input !== this && input.value.some(x=>this.value.includes(x))) { - input.setValue(input.value.filter(x=>!this.value.includes(x)), options) - } - } - } - - - this.parent.batchDraw() if (options.send) this.sendValue() @@ -96,33 +62,29 @@ class PatchBay extends Container(Canvas) { static defaults() { - var defaults = super.defaults().extend({ - class_specific: { - inputs: {type: 'array|object', value: ['input_1', 'input_2'], help: [ - '- `Array` of input names : `[\'input_1\', \'input_2\']`', - '- `Object` of `"label_1": "input_1"` pairs (example: `{"label a": "name 1", "label b": "name 2"}`). Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', - '', - 'Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected: ', - '`/patchbay_address input_x output_x output_y etc`', - 'If no output is connected to the input, the message will be `/patchbay_address input_x`', - 'The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1`.', - 'To change connections via scripting, one must target the input nodes as follows: `set(\'patchbay_id/input_name\', [\'output_x\', \'output_y\'])`' - ]}, - outputs: {type: 'array|object', value: ['output_1', 'output_2'], help: 'List of output values the inputs can connect to (see `inputs`).'}, - exclusive: {type: 'string', value: false, choices: [false, 'in', 'out', 'both'], help: [ - '- `in`: allows only one connection per input', - '- `out`: allows only one connection per output', - '- `both`: allows only one connection per input and output' - ]} - } + return super.defaults({ + + _patchbay:'patchbay', + + inputs: {type: 'array|object', value: ['input_1', 'input_2'], help: [ + '- `Array` of input names : `[\'input_1\', \'input_2\']`', + '- `Object` of `"label_1": "input_1"` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', + '', + 'Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected: ', + '`/patchbay_address input_x output_x output_y etc`', + 'If no output is connected to the input, the message will be `/patchbay_address input_x`', + 'The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1`' + ]}, + outputs: {type: 'array|object', value: ['output_1', 'output_2'], help: 'List of output values the inputs can connect to (see `inputs`).'}, + + }, [], { + + css: {type: 'string', value: '', help: [ + 'The inputs/ouputs width can be adjusted by using the `.nodes` selector:', + '`.nodes { width: 25% }`', + ]} }) - defaults.style.css.help.concat( - 'The inputs/outputs width can be adjusted by using the `.nodes` selector:', - '`.nodes { width: 25% }`', - ) - - return defaults } static normalizeArrayObject(obj) { @@ -146,11 +108,11 @@ class PatchBay extends Container(Canvas) { constructor(options) { super({...options, html: html` - +
      - +
      `}) this.inputs = PatchBay.normalizeArrayObject(this.getProp('inputs')) @@ -162,35 +124,32 @@ class PatchBay extends Container(Canvas) { this.inputNodes = [] this.outputNodes = [] - this.value = {} for (let k in this.inputs) { let w = parser.parse({ data: { type: 'patchbaynode', - comments: this.inputs[k], // TODO: using comment prop to smuggle input identifier, ok but could be more elegant + label: k, id: this.getProp('id') + '/' + this.inputs[k], - address: '#{@{parent.address} == "auto" ? "/" + @{parent.id} : @{parent.address}}', + address: '@{parent.address}', target: '@{parent.target}', - ignoreDefaults: '@{parent.ignoreDefaults}', - preArgs: '#{@{parent.preArgs} == "" ? @{this.comments} : Array.isArray(@{parent.preArgs}) ? @{parent.preArgs}.concat(@{this.comments}) : [@{parent.preArgs}, @{this.comments}]}', + preArgs: this.inputs[k], bypass: '@{parent.bypass}', - label: k + }, parentNode: DOM.get(this.widget, '.inputs')[0], - parent: this, - meta: {not_editable: true} + parent: this }) + w.container.classList.add('not-editable') this.inputsWidgets.push(w) this.inputNodes.push(w.container) - this.value[k] = [] } var outputs = DOM.get(this.widget, '.outputs')[0] for (let k in this.outputs) { var node = html` -
      - +
      +
      ${k}
      ` outputs.appendChild(node) @@ -199,56 +158,34 @@ class PatchBay extends Container(Canvas) { this.connecting = [] - this.mousePosition = [] - this.dragging = false - this.on('draginit', (e)=>{ + this.widget.addEventListener('fast-click', (e)=>{ this.toggleConnection(e.target) - if (e.target === this.canvas) { - this.mousePosition = [e.offsetX, e.offsetY] - } else { - if (this.inputNodes.includes(e.target)) { - this.mousePosition = [e.offsetX - e.target.offsetWidth, e.offsetY + e.target.offsetTop] - } else { - this.mousePosition = [e.offsetX + this.canvas.offsetWidth, e.offsetY + e.target.offsetTop] - } - } - }, {element: this.widget}) + e.stopPropagation() + }) + + this.mousePosition = [] this.on('drag', (e)=>{ if (!this.connecting.length) { this.toggleConnection(e.target) } - this.mousePosition[0] += e.movementX - this.mousePosition[1] += e.movementY - this.dragging = true + if (e.target === this.canvas) { + this.mousePosition = [e.offsetX, e.offsetY] + } else if (this.mousePosition.length) { + this.mousePosition[0] += e.movementX + this.mousePosition[1] += e.movementY + } this.batchDraw() }, {element: this.widget}) - this.on('dragend', (e)=>{ - - if (this.dragging) { - // touch hover fix - var node = e.isTouch ? document.elementFromPoint(e.clientX, e.clientY) : e.target - + if (this.mousePosition.length) { this.mousePosition = [] - this.toggleConnection(node) + this.toggleConnection(e.target) } - this.dragging = false }, {element: this.widget}) - this.on('value-changed',(e)=>{ - - if (e.widget === this || e.widget.parent !== this) return - - var k = e.widget.getProp('label') - this.value[k] = e.widget.getValue() - - this.changed(e.options) - - }) - } toggleConnection(node) { @@ -271,6 +208,14 @@ class PatchBay extends Container(Canvas) { this.batchDraw() } + if (this.connecting.length) { + var cb = (e)=>{ + this.toggleConnection() + document.removeEventListener('fast-click', cb) + } + document.addEventListener('fast-click', cb) + } + } draw() { @@ -320,8 +265,7 @@ class PatchBay extends Container(Canvas) { if (this.connecting.length) { this.ctx.beginPath() - this.ctx.fillStyle = this.cssVars.colorFill - this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.fillStyle = this.colors.custom var side = this.connecting[0] !== undefined ? 0 : 1, cx = side === 0 ? 0 : this.width, @@ -345,10 +289,10 @@ class PatchBay extends Container(Canvas) { } - this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.strokeStyle = this.colors.custom this.ctx.lineWidth = 2 * PXSCALE - this.ctx.globalAlpha = strongLines.length ? this.cssVars.alphaFillOff : this.cssVars.alphaFillOn + this.ctx.globalAlpha = strongLines.length ? 0.3 : 0.7 this.ctx.beginPath() for (i in lines) { this.ctx.moveTo(...lines[i][0]) @@ -358,7 +302,7 @@ class PatchBay extends Container(Canvas) { if (strongLines.length) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.globalAlpha = 0.7 this.ctx.beginPath() for (i in strongLines) { if (strongLines[i] === null) continue @@ -374,7 +318,7 @@ class PatchBay extends Container(Canvas) { } -export { +module.exports = { PatchBay, PatchBayNode } diff --git a/src/client/events/double-click.mjs b/src/client/app/widgets/mixins/double_tap.js similarity index 85% rename from src/client/events/double-click.mjs rename to src/client/app/widgets/mixins/double_tap.js index 1649c411..ac4c2287 100644 --- a/src/client/events/double-click.mjs +++ b/src/client/app/widgets/mixins/double_tap.js @@ -1,6 +1,4 @@ -import {DOUBLE_TAP_TIME} from '../globals.mjs' - -export default (element, callback, options={})=>{ +module.exports = (element, callback, options={})=>{ var lastTapTime = 0, lastTapX, @@ -8,7 +6,7 @@ export default (element, callback, options={})=>{ element.addEventListener(options.click ? 'click' : 'fast-click', (event)=>{ - if (event.capturedByEditor && !options.ignoreEditorCapture) return + if (event.capturedByEditor) return var tapTime = Date.now(), tapLength = tapTime - lastTapTime, diff --git a/src/client/widgets/mixins/static_properties.mjs b/src/client/app/widgets/mixins/static_properties.js similarity index 87% rename from src/client/widgets/mixins/static_properties.mjs rename to src/client/app/widgets/mixins/static_properties.js index 041ffe40..fc415dde 100644 --- a/src/client/widgets/mixins/static_properties.mjs +++ b/src/client/app/widgets/mixins/static_properties.js @@ -13,4 +13,4 @@ let StaticProperties = (superclass, props) => class extends superclass { } -export default StaticProperties +module.exports = StaticProperties diff --git a/src/client/app/widgets/mixins/touch_state.js b/src/client/app/widgets/mixins/touch_state.js new file mode 100644 index 00000000..ce3f857d --- /dev/null +++ b/src/client/app/widgets/mixins/touch_state.js @@ -0,0 +1,51 @@ +module.exports = (self, options)=>{ + + var sendTouchState = self.getProp('touchAddress') && self.getProp('touchAddress').length + + self.touched = 0 + self.setValueTouchedQueue = undefined + + self.on('draginit',(e)=>{ + self.touched += 1 + if (self.touched == 1 && sendTouchState) + self.sendValue({ + address:self.getProp('touchAddress'), + v:1, + split:false + }) + }, options) + + self.on('dragend', (e)=>{ + if (self.touched == 1) { + self.touched = 0 + + if (self.setValueTouchedQueue !== undefined) { + self.setValue(...self.setValueTouchedQueue) + self.setValueTouchedQueue = undefined + } + + if (sendTouchState) { + self.sendValue({ + address:self.getProp('touchAddress'), + v:0, + split:false + }) + } + + } else if (self.touched > 1){ + self.touched -= 1 + } + }, options) + + self.onRemove = ()=>{ + if (sendTouchState && self.touched > 0) { + self.sendValue({ + address:self.getProp('touchAddress'), + v:0, + split:false + }) + } + self.__proto__.onRemove.call(self) + } + +} diff --git a/src/client/app/widgets/pads/_fake_fader.js b/src/client/app/widgets/pads/_fake_fader.js new file mode 100644 index 00000000..11d4bf47 --- /dev/null +++ b/src/client/app/widgets/pads/_fake_fader.js @@ -0,0 +1,16 @@ +var Fader = require('../sliders/fader') + +module.exports = class _fake_fader extends Fader { + + constructor(options) { + + super(options) + + if (options.cancelDraw) this.batchDraw = ()=>{} + } + + sendValue() { + // disabled + } + +} diff --git a/src/client/app/widgets/pads/multixy.js b/src/client/app/widgets/pads/multixy.js new file mode 100644 index 00000000..fd8d6fcc --- /dev/null +++ b/src/client/app/widgets/pads/multixy.js @@ -0,0 +1,293 @@ +var Pad = require('./pad'), + Xy = require('./xy'), + {clip} = require('../utils'), + touchstate = require('../mixins/touch_state') + + +var xyDefaults = Xy.defaults()._props() + + +module.exports = class MultiXy extends Pad { + + static description() { + + return 'Multi-point XY pad.' + + } + + static defaults() { + + return super.defaults({ + + _mutlixy: 'multi xy', + + points: {type: 'integer|array', value: 2, help: [ + 'Defines the number of points on the pad', + 'Can be an array of strings that will be used as labels for the points (ex: `[\'A\', \'B\']`)' + ]}, + + + _xy: 'xy', + + pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'}, + snap: {type: 'boolean', value: false, help: [ + 'By default, the points are dragged from their initial position.', + 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', + ]}, + spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, + pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, + rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis'}, + rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, + logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '}, + + }, [], { + + touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'}, + split: {type: 'boolean|object', value: false, help: [ + 'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/N/x` or `/N/y` appended to it, where N is the point\'s id (or the point\'s label if points is an array)', + 'Can be set as an `object` to specify a different address : `[\'/0/x\', \'/0/y\', \'/1/x\', \'/2/y\']`', + 'Note: the widget will only respond to its original osc address, not to the splitted version' + ]}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--background: background;`: sets the dragging area\'s background', + '- `--pips-color: color;`', + '- `--pips-opacity: number;`', + '- `--color-text: point-color;`', + 'Pads can be targetted individually with the .pad-X selector (where X is the pad\'s index)', + ]} + }) + + } + + constructor(options) { + + super(options) + + this.npoints = typeof this.getProp('points') == 'object' ? this.getProp('points').length : this.getProp('points') + this.labels = typeof this.getProp('points') == 'object' + this.pointSize = parseInt(this.getProp('pointSize')) + + this.pads = [] + + for (let i = 0; i < this.npoints; i++) { + this.pads[i] = new Xy({props:{ + ...xyDefaults, + snap:this.getProp('snap'), + spring:this.getProp('spring'), + default:this.getProp('default').length === this.getProp('points') * 2 ? [this.getProp('default')[i*2], this.getProp('default')[i*2 + 1]] : '', + rangeX:this.getProp('rangeX'), + rangeY:this.getProp('rangeY'), + precision:this.getProp('precision'), + logScaleX:this.getProp('logScaleX'), + logScaleY:this.getProp('logScaleY'), + pointSize: this.getProp('pointSize'), + pips: this.getProp('pips') && i == this.npoints-1, + sensitivity: this.getProp('sensitivity'), + input:false + }, parent: this}) + this.pads[i].sendValue = ()=>{} + this.pads[i].widget.classList.add('pad-' + i) + this.wrapper.appendChild(this.pads[i].widget) + + } + + + this.value = [] + + this.padsCoords = [] + this.touchMap = {} + + touchstate(this, {element: this.wrapper, multitouch: true}) + + this.on('draginit',(e)=>{ + + var id + + if (!this.touchMap[e.pointerId]) { + + var ndiff, diff = -1 + + for (var i in this.pads) { + + if (Object.values(this.touchMap).indexOf(i) != -1) continue + + ndiff = Math.abs(e.offsetX - this.padsCoords[i][0]) + Math.abs(e.offsetY - (this.padsCoords[i][1] + this.height)) + + if (diff == -1 || ndiff < diff) { + id = i + diff = ndiff + } + + } + + this.touchMap[e.pointerId] = id + + + } + + if (!id) return + + e.stopPropagation = true + + this.pads[id].trigger('draginit', e) + + }, {element: this.wrapper, multitouch: true}) + + this.on('drag',(e)=>{ + + var i = this.touchMap[e.pointerId] + + if (!i) return + + this.pads[i].trigger('drag', e) + + }, {element: this.wrapper[0], multitouch: true}) + + this.on('dragend',(e)=>{ + + var i = this.touchMap[e.pointerId] + + if (!i) return + + e.stopPropagation = true + + this.pads[i].trigger('dragend', e) + + delete this.touchMap[e.pointerId] + + }, {element: this.wrapper, multitouch: true}) + + this.on('change',(e)=>{ + if (e.widget == this) return + e.stopPropagation = true + this.setValue(this.getValue(), e.options) + }) + + + var v = [] + for (let i = 0; i < this.npoints * 2; i = i + 2) { + [v[i],v[i+1]] = this.pads[i/2].getValue() + } + + this.setValue(v) + + } + + resizeHandle() { + + super.resizeHandle(...arguments) + this.updateHandlesPosition() + + } + + updateHandlesPosition() { + + for (var i=0;i{ + var s={}, + t + for (var i=0; i +
      + +
      +
      + `}) + + this.wrapper = DOM.get(this.widget, '.wrapper')[0] + + this.pointSize = parseInt(this.getProp('pointSize')) + this.widget.style.setProperty('--pointSize', this.pointSize + 'rem') + + } + + cacheCanvasStyle(style) { + + style = style || window.getComputedStyle(this.canvas) + + super.cacheCanvasStyle(style) + + this.colors.pips = style.getPropertyValue('--color-pips') || this.colors.custom + this.colors.pipsOpacity = style.getPropertyValue('--pips-opacity') + this.colors.pointOpacity = style.getPropertyValue('--point-opacity') + + } + +} + +Pad.dynamicProps = Pad.prototype.constructor.dynamicProps.filter(n => n !== 'precision') + +module.exports = Pad diff --git a/src/client/app/widgets/pads/rgb.js b/src/client/app/widgets/pads/rgb.js new file mode 100644 index 00000000..4a71147c --- /dev/null +++ b/src/client/app/widgets/pads/rgb.js @@ -0,0 +1,272 @@ +var Pad = require('./pad'), + Xy = require('./xy'), + Fader = require('./_fake_fader'), + {clip, mapToScale, hsbToRgb, rgbToHsb} = require('../utils'), + Input = require('../inputs/input'), + html = require('nanohtml') + +var faderDefaults = Fader.defaults()._props(), + xyDefaults = Xy.defaults()._props() + +module.exports = class Rgb extends Pad { + + static description() { + + return 'Color picker with optional alpha slider.' + + } + + static defaults() { + + return super.defaults({ + + _rgb:'rgb', + + snap: {type: 'boolean', value: false, help: [ + 'By default, the points are dragged from their initial position.', + 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', + ]}, + spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, + range: {type: 'object', value: {min: 0, max: 255}, help: 'Defines the widget\'s output scale.'}, + input: {type: 'boolean', value: true, help: 'Set to `false` to hide the built-in input widget'}, + alpha:{type: 'boolean', value: false, help: 'Set to `true` to enable alpha channel'} + + }, ['color'], { + + split: {type: 'boolean|object', value: false, help: [ + 'Set to `true` to send separate osc messages for for r and g & b. The address will be the same as the widget\'s with `/r`, `/g` or `/b` appended to it', + 'Can be set as an `object` to specify a different address : `[\'/r\', \'/g\', \'b\']`', + 'Note: the widget will only respond to its original osc address, not to the splitted version' + ]} + }) + + } + + constructor(options) { + + options.props.pointSize = 10 + + super(options) + + this.hueWrapper = this.widget.appendChild(html`
      `) + + this.hue = new Fader({props:{ + ...faderDefaults, + id:'h', + compact:true, + pips:false, + horizontal:true, + snap:this.getProp('snap'), + range:{min:0,max:360}, + input:false, + precision:2 + }, cancelDraw: false, parent: this}) + this.hue.sendValue = ()=>{} + this.hueWrapper.appendChild(this.hue.widget) + this.hue.on('change',(e)=>{ + e.stopPropagation = true + this.dragHandle(true) + }) + + this.pad = new Xy({props:{ + ...xyDefaults, + snap:this.getProp('snap'), + spring:this.getProp('spring'), + rangeX:{min:0,max:100}, + rangeY:{min:0,max:100}, + precision:2, + pointSize: this.getProp('pointSize'), + pips: false, + input:false + }, parent: this}) + this.pad.sendValue = ()=>{} + this.wrapper.appendChild(this.pad.widget) + this.pad.on('change',(e)=>{ + e.stopPropagation = true + this.dragHandle() + }) + + if (this.getProp('alpha')) { + this.alphaWrapper = this.widget.appendChild(html`
      `) + this.alpha = new Fader({props:{ + ...faderDefaults, + id:'a', + compact:true, + pips:false, + horizontal:true, + snap:this.getProp('snap'), + range:{min:0,max:255}, + default: 255, + input:false, + precision:2 + }, cancelDraw: false, parent: this}) + this.alpha.sendValue = ()=>{} + this.alphaWrapper.appendChild(this.alpha.widget) + this.alpha.on('change',(e)=>{ + e.stopPropagation = true + this.dragAlphaHandle() + }) + } + + if (this.getProp('input')) { + + this.input = new Input({ + props:{...Input.defaults()._props(), precision:this.getProp('precision'), unit:this.getProp('unit')}, + parent:this, parentNode:this.widget + }) + this.widget.appendChild(this.input.widget) + this.input.on('change', (e)=>{ + e.stopPropagation = true + this.setValue(this.input.getValue(), {sync:true, send:true}) + this.showValue() + }) + + } + + + this.value = [] + + this.hsb = {h:0,s:0,b:0} + + this.setValue([this.getProp('range').min, this.getProp('range').min, this.getProp('range').min]) + + } + + dragHandle(hue) { + var h = this.hue.value, + s = this.pad.value[0], + b = this.pad.value[1] + + if (h != this.hsb.h ||s != this.hsb.s || b != this.hsb.b) { + + this.hsb.h = this.hue.value + this.hsb.s = this.pad.value[0] + this.hsb.b = this.pad.value[1] + + this.update({nohue:!hue}) + + var rgb = hsbToRgb(this.hsb) + for (var k in rgb) { + rgb[k] = mapToScale(rgb[k], [0, 255], [this.getProp('range').min, this.getProp('range').max], false) + } + + if (rgb.r != this.value[0] || rgb.g != this.value[1] || rgb.b != this.value[2]) { + this.setValue([rgb.r, rgb.g, rgb.b], { + send: true, + sync: true, + dragged: true, + nohue: !hue + }) + } + } + + } + + dragAlphaHandle() { + + var alpha = this.alpha.value + if (alpha !== this.value[3]) { + this.setValue([this.value[0], this.value[1], this.value[2], alpha], { + send: true, + sync: true, + dragged: true, + nohue: true + }) + } + + + } + + setValue(v, options={}) { + + if (!v || v.length < 3) return + if (this.touched && !options.dragged) return this.setValueTouchedQueue = [v, options] + + var value = Array(this.getProp('alpha') ? 4 : 3) + for (var i = 0; i < value.length; i++) { + value[i] = clip(v[i], [this.getProp('range').min, this.getProp('range').max]) + } + + if (value.length === 4 && value[3] === undefined) value[3] = this.alpha.value + + var hsb = rgbToHsb({ + r: mapToScale(value[0], [this.getProp('range').min, this.getProp('range').max], [0, 255], false), + g: mapToScale(value[1], [this.getProp('range').min, this.getProp('range').max], [0, 255], false), + b: mapToScale(value[2], [this.getProp('range').min, this.getProp('range').max], [0, 255], false) + }) + + if (!options.dragged) { + this.pad.setValue([hsb.s, hsb.b]) + if (value.length === 4) this.alpha.setValue(value[3]) + } + + this.hsb = hsb + this.value = value + + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + this.update({dragged:options.dragged, nohue:options.nohue || (v[0]==v[1]&&v[1]==v[2])}) + + } + + update(options={}) { + + if (!options.nohue && !options.dragged) { + var hue = hsbToRgb({h:this.hsb.h,s:100,b:100}), + hueStr = `rgb(${Math.round(hue.r)},${Math.round(hue.g)},${Math.round(hue.b)})` + this.canvas.setAttribute('style',`background-color:${hueStr}`) + this.hue.setValue(this.hsb.h, {sync: false, send:false, dragged:false}) + } + + + this.showValue() + + } + + draw() {} + + showValue() { + + if (this.getProp('input')) this.input.setValue(this.value) + + } + + getSplit() { + + return this.getProp('split')? + typeof this.getProp('split') == 'object' && this.getProp('split').length == 3 ? + this.getProp('split') + : [this.getProp('address') + '/r', this.getProp('address') + '/g', this.getProp('address') + '/b'] + : false + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of [this.hue, this.pad]) { + w.onPropChanged('color') + } + if (this.input) this.input.onPropChanged('color') + if (this.alpha) this.alpha.onPropChanged('color') + return + + } + + } + + onRemove() { + this.hue.onRemove() + this.pad.onRemove() + if (this.input) this.input.onRemove() + if (this.alpha) this.alpha.onRemove() + super.onRemove() + } + +} diff --git a/src/client/app/widgets/pads/xy.js b/src/client/app/widgets/pads/xy.js new file mode 100644 index 00000000..c651f474 --- /dev/null +++ b/src/client/app/widgets/pads/xy.js @@ -0,0 +1,323 @@ +var Pad = require('./pad'), + Fader = require('./_fake_fader'), + doubletab = require('../mixins/double_tap'), + Input = require('../inputs/input'), + touchstate = require('../mixins/touch_state') + +var faderDefaults = Fader.defaults()._props() + +module.exports = class Xy extends Pad { + + static description() { + + return 'Two-dimensional slider.' + + } + + static defaults() { + + return super.defaults({ + + _xy:'xy', + + pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'}, + snap: {type: 'boolean', value: false, help: [ + 'By default, the points are dragged from their initial position.', + 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', + ]}, + spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, + pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, + rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis'}, + rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, + logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + input: {type: 'boolean', value: true, help: 'Set to false to hide the built-in input widget'}, + doubleTap: {type: 'boolean|string', value: false, help: [ + 'Set to `true` to make the fader reset to its default value when receiving a double tap.', + 'Can also be an osc address, which case the widget will just send an osc message: `/ `' + ]}, + sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '}, + + }, [], { + + touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`)'}, + split: {type: 'boolean|object', value: false, help: [ + 'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/x` or `/y` appended to it', + 'Can be set as an `object` to specify a different address : [\'/osc_address_x\', \'/osc_address_y\']', + 'Note: the widget will only respond to its original osc address, not to the splitted version' + ]}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--background: background;`: sets the dragging area\'s background', + '- `--pips-color: color;`', + '- `--pips-opacity: number;`', + '- `--point-opacity: number;`', + ]} + + }) + + } + + constructor(options) { + + super(options) + + this.faders = { + x: new Fader({props:{ + ...faderDefaults, + id:0, + compact:true, + pips:false, + horizontal:true, + height:'100%', + width:'100%', + default:this.getProp('default').length === 2 ? this.getProp('default')[0] : '', + snap:this.getProp('snap'), + range:this.getProp('rangeX'), + origin:'auto', + precision:this.getProp('precision'), + logScale:this.getProp('logScaleX'), + sensitivity: this.getProp('sensitivity'), + input:false + }, cancelDraw: true, parent: this}), + y: new Fader({props:{ + ...faderDefaults, + id:1, + compact:true, + pips:false, + horizontal:false, + height:'100%', + width:'100%', + default:this.getProp('default').length === 2 ? this.getProp('default')[1] : '', + snap:this.getProp('snap'), + range:this.getProp('rangeY'), + origin:'auto', + precision:this.getProp('precision'), + logScale:this.getProp('logScaleY'), + sensitivity: this.getProp('sensitivity'), + input:false + }, cancelDraw: true, parent: this}), + } + + this.faders.x.margin = this.faders.y.margin = this.pointSize + 1 + + this.value = [this.faders.x.value, this.faders.y.value] + + this.wrapper.appendChild(this.faders.x.widget) + this.wrapper.appendChild(this.faders.y.widget) + + this.faders.x.on('change',(e)=>{ + e.stopPropagation = true + }) + + this.faders.y.on('change',(e)=>{ + e.stopPropagation = true + }) + + touchstate(this, {element: this.wrapper}) + this.active = false + + this.on('draginit',(e)=>{ + e.stopPropagation = true + this.active = true + this.faders.x.trigger('draginit', e) + this.faders.y.trigger('draginit', e) + this.dragHandle() + }, {element: this.wrapper}) + + this.on('drag',(e)=>{ + this.faders.x.trigger('drag', e) + this.faders.y.trigger('drag', e) + this.dragHandle() + }, {element: this.wrapper}) + + this.on('dragend', (e)=>{ + e.stopPropagation = true + this.active = false + this.faders.x.trigger('dragend', e) + this.faders.y.trigger('dragend', e) + if (this.getProp('spring')) { + this.setValue([this.faders.x.getSpringValue(),this.faders.y.getSpringValue()],{sync:true,send:true}) + } else { + this.batchDraw() + } + }, {element: this.wrapper}) + + if (this.getProp('doubleTap')) { + + if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') { + + doubletab(this.widget, ()=>{ + this.sendValue({v:null, address: this.getProp('doubleTap')}) + }) + + } else { + + doubletab(this.wrapper, ()=>{ + this.faders.x.setValue(this.faders.x.getSpringValue(), {sync: false, send:false, dragged:true}) + this.faders.y.setValue(this.faders.y.getSpringValue(), {sync: false, send:false, dragged:true}) + this.setValue([this.faders.x.getSpringValue(),this.faders.y.getSpringValue()],{sync:true, send:true}) + }) + + } + + } + + if (this.getProp('input')) { + + this.input = new Input({ + props:{...Input.defaults()._props(), precision:this.getProp('precision'), unit:this.getProp('unit')}, + parent:this, parentNode:this.widget + }) + this.widget.appendChild(this.input.widget) + this.input.on('change', (e)=>{ + e.stopPropagation = true + this.setValue(this.input.getValue(), {sync:true, send:true}) + this.showValue() + }) + + } + + this.setValue([0,0]) + + } + + dragHandle(){ + + var x = this.faders.x.value, + y = this.faders.y.value + + + if (x != this.value[0] || y != this.value[1]) { + this.setValue([x, y],{send:true,sync:true,dragged:true}) + } else { + this.batchDraw() + } + + } + + + setValue(v, options={}) { + + if (!v || !v.length || v.length!=2) return + if (this.touched && !options.dragged) return this.setValueTouchedQueue = [v, options] + + if (!options.dragged) { + this.faders.x.setValue(v[0], {sync: false, send:false, dragged:false}) + this.faders.y.setValue(v[1], {sync: false, send:false, dragged:false}) + } + + this.value = [ + this.faders.x.value, + this.faders.y.value + ] + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + this.batchDraw() + + this.showValue() + + } + + draw() { + + var pointSize = this.pointSize * PXSCALE, + margin = (this.pointSize + 1) * PXSCALE, + x = this.faders.x.percentToCoord(this.faders.x.percent), + y = this.faders.y.percentToCoord(this.faders.y.percent) + + this.clear() + + this.ctx.lineWidth = PXSCALE + this.ctx.fillStyle = this.colors.custom + + + if (this.getProp('pips')) { + this.ctx.strokeStyle = this.colors.pips + this.ctx.globalAlpha = this.colors.pipsOpacity + this.ctx.beginPath() + for (var pip of this.faders.x.rangeKeys.concat(this.faders.x.valueToPercent(this.faders.x.originValue))) { + if (pip == 0 || pip == 100) continue + var xpip = Math.round(2 * this.faders.x.percentToCoord(pip)) / 2 + if (xpip === parseInt(xpip)) xpip -= 0.5 + this.ctx.moveTo(xpip, margin) + this.ctx.lineTo(xpip, this.height - margin) + } + for (pip of this.faders.y.rangeKeys.concat(this.faders.y.valueToPercent(this.faders.y.originValue))) { + if (pip == 0 || pip == 100) continue + var ypip = Math.round(2 * this.faders.y.percentToCoord(pip)) / 2 + if (ypip === parseInt(ypip)) ypip -= 0.5 + this.ctx.moveTo(margin, ypip) + this.ctx.lineTo(this.width - margin, ypip) + } + this.ctx.stroke() + + } else { + + this.clearRect = [x - margin - PXSCALE, y - margin - PXSCALE, (margin + PXSCALE) * 2, (margin + PXSCALE) * 2] + + } + + + this.ctx.strokeStyle = this.colors.custom + this.ctx.globalAlpha = this.active ? 1 : 0.7 + this.ctx.lineWidth = 2 * PXSCALE + this.ctx.beginPath() + this.ctx.arc(x, y, pointSize, Math.PI * 2, false) + this.ctx.stroke() + + + + this.ctx.fillStyle = this.colors.custom + this.ctx.globalAlpha = this.colors.pointOpacity + this.ctx.beginPath() + this.ctx.arc(x, y, pointSize / 1.5, Math.PI * 2, false) + this.ctx.fill() + + + } + + showValue() { + + if (this.getProp('input')) this.input.setValue(this.value) + + } + + getSplit() { + + return this.getProp('split')? + typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 ? + this.getProp('split') + : [this.getProp('address') + '/x', this.getProp('address') + '/y'] + : false + + } + + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of [this.faders.x, this.faders.y]) { + w.onPropChanged('color') + } + if (this.input) this.input.onPropChanged('color') + return + + } + + } + + onRemove() { + this.faders.x.onRemove() + this.faders.y.onRemove() + if (this.input) this.input.onRemove() + super.onRemove() + } + +} diff --git a/src/client/app/widgets/plots/_biquad_response.js b/src/client/app/widgets/plots/_biquad_response.js new file mode 100644 index 00000000..f3345a96 --- /dev/null +++ b/src/client/app/widgets/plots/_biquad_response.js @@ -0,0 +1,137 @@ +// +// calcBiquad +// +// Dec 14, 2010 njr +// original @ Nigel Redmon + +module.exports = function(options,linear,resolution) { + var {type, freq, q, gain} = options, + Fs = 44100, + a0,a1,a2,b1,b2,norm, + minVal, maxVal, + len = resolution + + var V = Math.pow(10, Math.abs(gain) / 20) + var K = Math.tan(Math.PI * freq / Fs) + switch (type) { + case 'lowpass': + norm = 1 / (1 + K / q + K * K) + a0 = K * K * norm + a1 = 2 * a0 + a2 = a0 + b1 = 2 * (K * K - 1) * norm + b2 = (1 - K / q + K * K) * norm + break + + case 'highpass': + norm = 1 / (1 + K / q + K * K) + a0 = 1 * norm + a1 = -2 * a0 + a2 = a0 + b1 = 2 * (K * K - 1) * norm + b2 = (1 - K / q + K * K) * norm + break + + case 'bandpass': + norm = 1 / (1 + K / q + K * K) + a0 = K / q * norm + a1 = 0 + a2 = -a0 + b1 = 2 * (K * K - 1) * norm + b2 = (1 - K / q + K * K) * norm + break + + case 'notch': + norm = 1 / (1 + K / q + K * K) + a0 = (1 + K * K) * norm + a1 = 2 * (K * K - 1) * norm + a2 = a0 + b1 = a1 + b2 = (1 - K / q + K * K) * norm + break + + case 'peak': + if (gain >= 0) { + norm = 1 / (1 + 1/q * K + K * K) + a0 = (1 + V/q * K + K * K) * norm + a1 = 2 * (K * K - 1) * norm + a2 = (1 - V/q * K + K * K) * norm + b1 = a1 + b2 = (1 - 1/q * K + K * K) * norm + } + else { + norm = 1 / (1 + V/q * K + K * K) + a0 = (1 + 1/q * K + K * K) * norm + a1 = 2 * (K * K - 1) * norm + a2 = (1 - 1/q * K + K * K) * norm + b1 = a1 + b2 = (1 - V/q * K + K * K) * norm + } + break + case 'lowshelf': + if (gain >= 0) { + norm = 1 / (1 + Math.SQRT2 * K + K * K) + a0 = (1 + Math.sqrt(2*V) * K + V * K * K) * norm + a1 = 2 * (V * K * K - 1) * norm + a2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm + b1 = 2 * (K * K - 1) * norm + b2 = (1 - Math.SQRT2 * K + K * K) * norm + } + else { + norm = 1 / (1 + Math.sqrt(2*V) * K + V * K * K) + a0 = (1 + Math.SQRT2 * K + K * K) * norm + a1 = 2 * (K * K - 1) * norm + a2 = (1 - Math.SQRT2 * K + K * K) * norm + b1 = 2 * (V * K * K - 1) * norm + b2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm + } + break + case 'highshelf': + if (gain >= 0) { + norm = 1 / (1 + Math.SQRT2 * K + K * K) + a0 = (V + Math.sqrt(2*V) * K + K * K) * norm + a1 = 2 * (K * K - V) * norm + a2 = (V - Math.sqrt(2*V) * K + K * K) * norm + b1 = 2 * (K * K - 1) * norm + b2 = (1 - Math.SQRT2 * K + K * K) * norm + } + else { + norm = 1 / (V + Math.sqrt(2*V) * K + K * K) + a0 = (1 + Math.SQRT2 * K + K * K) * norm + a1 = 2 * (K * K - 1) * norm + a2 = (1 - Math.SQRT2 * K + K * K) * norm + b1 = 2 * (K * K - V) * norm + b2 = (V - Math.sqrt(2*V) * K + K * K) * norm + } + break + } + + var magPlot = [] + for (var i = 0; i < len; i++) { + var w, phi, y + if (linear) + w = i / (len - 1) * Math.PI // 0 to pi, linear scale + else + w = Math.exp(Math.log(1 / 0.001) * i / (len - 1)) * 0.001 * Math.PI // 0.001 to 1, times pi, log scale + + phi = Math.pow(Math.sin(w/2), 2) + + y = Math.log(Math.pow(a0+a1+a2, 2) - 4*(a0*a1 + 4*a0*a2 + a1*a2)*phi + 16*a0*a2*phi*phi) - Math.log(Math.pow(1+b1+b2, 2) - 4*(b1 + 4*b2 + b1*b2)*phi + 16*b2*phi*phi) + y = y * 10 / Math.LN10 + if (y == -Infinity) y = -200 + + if (linear) + magPlot.push([i / (len - 1) * Fs / 2, y]) + else + magPlot.push([i / (len - 1) * Fs / 2, y]) + + if (i == 0) + minVal = maxVal = y + else if (y < minVal) + minVal = y + else if (y > maxVal) + maxVal = y + } + + return magPlot +} diff --git a/src/client/app/widgets/plots/_plots_base.js b/src/client/app/widgets/plots/_plots_base.js new file mode 100644 index 00000000..85a17fd0 --- /dev/null +++ b/src/client/app/widgets/plots/_plots_base.js @@ -0,0 +1,209 @@ +var {mapToScale} = require('../utils'), + Canvas = require('../common/canvas'), + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class _plots_base extends StaticProperties(Canvas, {bypass: true}) { + + constructor(options) { + + super({...options, html: html` +
      + +
      + `}) + + this.value = [] + this.rangeX = this.getProp('rangeX') || {min:0,max:1} + this.rangeY = this.getProp('rangeY') || {min:0,max:1} + this.logScaleX = this.getProp('logScaleX') + this.logScaleY = this.getProp('logScaleY') + this.pips = { + x : { + min: Math.abs(this.rangeX.min)>=1000?this.rangeY.min/1000+'k':this.rangeX.min, + max: Math.abs(this.rangeX.max)>=1000?this.rangeY.max/1000+'k':this.rangeX.max + }, + y : { + min: Math.abs(this.rangeY.min)>=1000?this.rangeY.min/1000+'k':this.rangeY.min, + max: Math.abs(this.rangeY.max)>=1000?this.rangeY.max/1000+'k':this.rangeY.max + } + } + this.smooth = this.getProp('smooth') === true ? 0.25 : this.getProp('smooth') === false ? 0 : parseFloat(this.getProp('smooth')) || 0 + + } + + resizeHandle() { + + this.updateData() + super.resizeHandle(...arguments) + + } + + draw() { + + this.ctx.clearRect(0,0,this.width,this.height) + + if (this.getProp('bars')) { + this.draw_bars() + } else { + var points = this.draw_line() + if (this.getProp('dots')) { + this.draw_dots(points) + } + } + + if (this.getProp('pips')) this.draw_pips() + + } + + draw_pips() { + + this.ctx.globalAlpha = 1 + this.ctx.fillStyle = this.colors.text + + if (this.pips.x) { + + this.ctx.textBaseline = 'bottom' + this.ctx.textAlign = 'left' + this.ctx.fillText(this.pips.x.min,(this.pips.y?12:2)*PXSCALE,this.height) + this.ctx.textAlign = 'right' + this.ctx.fillText(this.pips.x.max,this.width-2*PXSCALE,this.height) + + } + + if (this.pips.y) { + + this.ctx.save() + this.ctx.translate(0, this.height) + this.ctx.rotate(-Math.PI/2) + + this.ctx.textBaseline = 'top' + this.ctx.textAlign = 'left' + this.ctx.fillText(this.pips.y.min,(this.pips.x?12:2)*PXSCALE,2*PXSCALE) + this.ctx.textAlign = 'right' + this.ctx.fillText(this.pips.y.max,this.height-2*PXSCALE,2*PXSCALE) + this.ctx.rotate(Math.PI/2) + this.ctx.restore() + + } + + } + + draw_line() { + + var points = [] + + for (let i in this.value) { + + if (this.value[i].length) { + points.push(mapToScale(this.value[i][0],[this.rangeX.min,this.rangeX.max],[0,this.width],0,this.logScaleX,true)) + points.push(mapToScale(this.value[i][1],[this.rangeY.min,this.rangeY.max],[this.height-2*PXSCALE,2*PXSCALE],0,this.logScaleY,true)) + } else { + points.push(mapToScale(i,[0,this.value.length-1],[0,this.width],0,this.logScaleX,true)) + points.push(mapToScale(this.value[i],[this.rangeY.min,this.rangeY.max],[this.height-2*PXSCALE,2*PXSCALE],0,this.logScaleY,true)) + } + + } + + if (points.length < 4) return points + + this.ctx.beginPath() + + this.ctx.curve(points, this.smooth, Math.round(this.width/(points.length/2 - 1))) + + this.ctx.globalAlpha = 0.7 + this.ctx.lineWidth = 2 * PXSCALE + this.ctx.strokeStyle = this.colors.custom + this.ctx.stroke() + + if (this.getProp('origin') !== false) { + + var origin = mapToScale(this.getProp('origin'), [this.rangeY.min,this.rangeY.max],[this.height,0],0,this.getProp('logScaleY'),true) + + this.ctx.globalAlpha = 0.1 + this.ctx.fillStyle = this.colors.custom + this.ctx.lineTo(this.width,origin) + this.ctx.lineTo(0,origin) + this.ctx.closePath() + this.ctx.fill() + + } + + return points + + } + + draw_dots(points) { + + this.ctx.globalAlpha = 1 + this.ctx.fillStyle = this.colors.custom + this.ctx.strokeStyle = this.colors.track + this.ctx.lineWidth = 2 * PXSCALE + for (var i = 0; i < points.length; i += 2) { + this.ctx.beginPath() + this.ctx.arc(points[i], points[i + 1], 3 * PXSCALE, 0, 2*Math.PI) + this.ctx.fill() + this.ctx.stroke() + } + + } + + draw_bars() { + + var barWidth = Math.round(this.width / this.value.length), + offset = Math.round((this.width - barWidth * this.value.length) / 2) + + var origin = mapToScale(this.getProp('origin') !== false ? this.getProp('origin') : this.rangeY.min, [this.rangeY.min,this.rangeY.max],[this.height,0],0,this.getProp('logScaleY'),true) + + this.ctx.beginPath() + + for (let i in this.value) { + var y = mapToScale(this.value[i].length ? this.value[i][1] : this.value[i],[this.rangeY.min,this.rangeY.max],[this.height-2*PXSCALE,2*PXSCALE],0,this.logScaleY,true) + this.ctx.rect(offset + i * barWidth, Math.min(y, origin), barWidth - PXSCALE, Math.abs(Math.min(y - origin))) + + } + + this.ctx.globalAlpha = 0.4 + this.ctx.fillStyle = this.colors.custom + this.ctx.fill() + + } + + setValue(v, options={}) { + + if (typeof v == 'string') { + try { + v = JSON.parseFlex(v) + } catch(err) {} + } + + if (typeof v == 'object' && v !== null) { + + if (Array.isArray(v)) { + + this.value = v + + } else { + + for (var i in v) { + if (!isNaN(i)) this.value[i] = v[i] + } + + } + + this.batchDraw() + + if (options.sync) this.changed(options) + + } + + + } + + updateData() { + + // update the coordinates to draw + + } + +} diff --git a/src/client/app/widgets/plots/eq.js b/src/client/app/widgets/plots/eq.js new file mode 100644 index 00000000..dfc77509 --- /dev/null +++ b/src/client/app/widgets/plots/eq.js @@ -0,0 +1,109 @@ +var {clip} = require('../utils'), + _biquad_response = require('./_biquad_response'), + _plots_base = require('./_plots_base') + +module.exports = class Eq extends _plots_base { + + static description() { + + return 'Draws frequency response between from from an array of filter objects.' + + } + + static defaults() { + + return super.defaults({ + + _eq:'eq', + + pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'}, + resolution: {type: 'number', value: 128, help: 'Defines the number of points used to compute the frequency response'}, + rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, + origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, + logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'}, + + }, ['precision', 'bypass'], { + + value: {type: 'array', value: '', help: [ + 'Each item must be an object with the following properties', + '- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak" or "notch")', + '- `freq`: number (filter\'s resonant frequency)', + '- `q`: number (Q factor)', + '- `gain`: number', + '- `on`: boolean', + + ]} + + }) + + } + + constructor(options) { + + // backward compat + if (options.props.filters && options.props.filters.length) { + options.props.value = options.props.filters + delete options.props.filters + } + + super(options) + + this.rangeX = {min:20,max:22050} + this.pips.x.min = '20' + this.pips.x.max = '22k' + + this.resolution = clip(this.getProp('resolution'),[64,1024]) + + } + + setValue(v, options={}) { + + if (typeof v == 'string') { + try { + v = JSON.parseFlex(v) + } catch(err) {} + } + + if (Array.isArray(v)) { + + var filters = v, + eqResponse = [] + + if (v.length === this.resolution) { + + eqResponse = v + + } else { + + for (let i in filters) { + + var filterResponse + + if (!filters[i].type) filters[i].type = 'peak' + + if (!filters[i].on) { + filterResponse = _biquad_response({type:'peak',freq:1,gain:0,q:1},!this.getProp('logScaleX'), this.resolution) + } else { + filterResponse = _biquad_response(filters[i],!this.getProp('logScaleX'), this.resolution) + } + + for (var k in filterResponse) { + if (eqResponse[k]===undefined) { + eqResponse[k]=[0,0] + } + + eqResponse[k] = [filterResponse[k][0], eqResponse[k][1]+filterResponse[k][1]] + } + + } + + } + + if (eqResponse.length) super.setValue(eqResponse, options) + + } + + } + +} diff --git a/src/client/app/widgets/plots/frame.js b/src/client/app/widgets/plots/frame.js new file mode 100644 index 00000000..fcd6e4b5 --- /dev/null +++ b/src/client/app/widgets/plots/frame.js @@ -0,0 +1,78 @@ +var Widget = require('../common/widget'), + html = require('nanohtml'), + {urlParser} = require('../utils'), + locales = require('../../locales'), + StaticProperties = require('../mixins/static_properties') + +class Frame extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Embed a page in a frame (local network only).' + + } + + static defaults() { + + return super.defaults({ + + _frame: 'frame', + + border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'}, + + }, ['color', 'precision', 'bypass'], { + + label: {type: 'string|boolean', value: 'auto', help: [ + 'Set to `false` to hide completely', + 'Insert icons using the prefix ^ followed by the icon\'s name : ^play, ^pause, etc', + 'If set to `false`, all pointer-events will be disabled on the frame as long as the editor is enabled to ensure it can be selected' + ]}, + value: {type: 'string', value: '', help: [ + 'External web page URL. Only local URLs are allowed (starting with `http://127.0.0.1/`, `http://10.x.x.x/`, `http://192.168.x.x/`, etc)', + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + if (!this.getProp('border')) this.container.classList.add('noborder') + + this.frame = DOM.get(this.widget, 'iframe')[0] + this.errorText = html`${locales('iframe_unauthorized')}` + this.errorTextMounted = false + + + } + + setValue(v, options={}) { + + this.value = v + + var parser = urlParser(this.value) + + if (this.value && parser.isLocal()) { + this.frame.setAttribute('src', this.value) + this.widget.classList.remove('error') + if (this.errorTextMounted) { + this.widget.removeChild(this.errorText) + this.errorTextMounted = false + } + } else { + this.frame.setAttribute('src', '') + this.widget.classList.add('error') + this.widget.appendChild(this.errorText) + this.errorTextMounted = true + } + + if (options.sync) this.changed(options) + + } + + +} + +module.exports = Frame diff --git a/src/client/app/widgets/plots/html.js b/src/client/app/widgets/plots/html.js new file mode 100644 index 00000000..b49c7075 --- /dev/null +++ b/src/client/app/widgets/plots/html.js @@ -0,0 +1,89 @@ +var Widget = require('../common/widget'), + morph = require('nanomorph'), + html = require('nanohtml'), + sanitizeHtml = require('sanitize-html'), + StaticProperties = require('../mixins/static_properties') + +var sanitizeOptions = { + allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe'), + allowedAttributes: { + '*': [ 'title', 'class', 'style'], + 'img': [ 'src' , 'title', 'class', 'style', 'width', 'height'] + } +} + +class Html extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Simple HTML parser.' + + } + + + static defaults() { + + return super.defaults({ + + _html:'html', + + html: {type: 'string', value: '', help: [ + 'Allowed HTML tags:', + '  h1-6, blockquote, p, a, ul, ol, nl, li,', + '  b, i, strong, em, strike, code, hr, br, div,', + '  table, thead, img, caption, tbody, tr, th, td, pre', + 'Allowed attributes:', + '  <*>: class, style, title', + '  : src, width, height', + ]}, + border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'}, + + }, ['color', 'precision', 'bypass'], {}) + + } + + constructor(options) { + + super({...options, html: html` +
      +
      + `}) + + if (!this.getProp('border')) this.container.classList.add('noborder') + + if (this.getProp('html') !== '') this.updateHtml() + + } + + updateHtml(){ + + var newHtml = html`
      ` + + newHtml.innerHTML = sanitizeHtml(this.getProp('html'), sanitizeOptions) + + morph(this.widget, newHtml) + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'html': + this.updateHtml() + return + + } + + } + + +} + +Html.dynamicProps = Html.prototype.constructor.dynamicProps.concat( + 'html' +) + +module.exports = Html diff --git a/src/client/app/widgets/plots/image.js b/src/client/app/widgets/plots/image.js new file mode 100644 index 00000000..5cd61125 --- /dev/null +++ b/src/client/app/widgets/plots/image.js @@ -0,0 +1,101 @@ +var Widget = require('../common/widget'), + ipc = require('../../ipc'), + html = require('nanohtml'), + {urlParser} = require('../utils'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class Image extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Load a image (url or base64-encoded).' + + } + + static defaults() { + + return super.defaults({ + + _image:'image', + + size: {type: 'string', value: 'cover', help: 'CSS background-size'}, + position: {type: 'string', value: 'center', help: 'CSS background-position'}, + repeat: {type: 'string', value: 'no-repeat', help: 'CSS background-repeat'}, + border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'}, + cache: {type: 'boolean', value: true, help: [ + 'Set to false to disable image caching (forces file reload when updating or editing the widget).', + 'When true, sending `reload` to the widget reloads its image without changing its value' + ]} + + }, ['color', 'precision', 'bypass'], { + + value: {type: 'string', value: '', help: [ + '- File `url` or `path` (relative to the session file location by default, falling back to absolute path)', + '- Base64 encoded image : `data:image/...`' + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + if (!this.getProp('border')) this.container.classList.add('noborder') + + this.widget.style.setProperty('background-size', this.getProp('size')) + this.widget.style.setProperty('background-position', this.getProp('position')) + this.widget.style.setProperty('background-repeat', this.getProp('repeat')) + + } + + setValue(v, options={}) { + + var s = v==null ? '' : '' + v, + cache_query = '' + + if (!s.length) { + + this.value = this.getProp('default') + + } else if (s != 'reload') { + + if (s.length > 1) this.value = s + + } + + if (typeof this.value === 'string' && this.value.length) { + + if ((s === 'reload' || !this.getProp('cache')) && this.value.indexOf('base64') === -1) { + cache_query = (this.value.indexOf('?') != -1 ? '&' : '?') + Date.now() + } + + } + + var url = this.value, + parser = urlParser(url) + + // escpape windows absolute file paths + if (!parser.protocol.match(/http|data/)) url = url.replace(':', '_:_') + url = url.replace(/\\/g, '\\\\') + + + if (url) { + this.widget.style.setProperty('background-image', `url("${url}${cache_query}")`) + } else { + this.widget.style.setProperty('background-image', '') + } + + if (options.sync) this.changed(options) + + } + + onRemove() { + + if (this.bindedOnStreamUpdate) ipc.off('video', this.bindedOnStreamUpdate) + super.onRemove() + + } + +} diff --git a/src/client/app/widgets/plots/led.js b/src/client/app/widgets/plots/led.js new file mode 100644 index 00000000..ee109c88 --- /dev/null +++ b/src/client/app/widgets/plots/led.js @@ -0,0 +1,52 @@ +var {mapToScale} = require('../utils'), + Widget = require('../common/widget'), + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class Led extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Intensity display.' + + } + + static defaults() { + + return super.defaults({ + + _led:'led', + + range: {type: 'object', value: {min:0,max:1}, help: 'Value to led intensity mapping range'}, + logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm\'s base.'}, + + }, ['precision', 'bypass'], {}) + + } + + constructor(options) { + + // backward compat + if (options.props.widgetId) { + options.props.value = '@{' + options.props.widgetId + '}' + delete options.props.widgetId + } + + super({...options, html: html`
      `}) + + this.setValue(this.getProp('range').min) + + } + + setValue(v, options={}) { + + if (typeof v != 'number') return + + this.value = v + this.widget.style.setProperty('--opacity', mapToScale(v,[this.getProp('range').min,this.getProp('range').max],[0,1],false,this.getProp('logScale'),true)) + + if (options.sync) this.changed(options) + + } + +} diff --git a/src/client/app/widgets/plots/meter.js b/src/client/app/widgets/plots/meter.js new file mode 100644 index 00000000..91ff0b47 --- /dev/null +++ b/src/client/app/widgets/plots/meter.js @@ -0,0 +1,65 @@ +var Fader = require('../sliders/fader'), + Widget = require('../common/widget'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class Meter extends StaticProperties(Fader, {bypass: true, compact: true, input: false}) { + + static description() { + + return 'Non-interactable fader.' + + } + + static defaults() { + + return Widget.defaults({ + + _meter:'meter', + + range: {type: 'object', value: {min:0,max:1}, help: 'See fader\'s `range`'}, + logScale: {type: 'boolean', value: false, help: 'See fader\'s `logScale`'}, + origin: {type: 'number', value: 'auto', help: 'See fader\'s `origin`'}, + unit: {type: 'string', value: 'auto', help: 'See fader\'s `unit`'}, + alignRight: {type: 'boolean', value: false, help: 'See fader\'s `alignRight`'}, + horizontal: {type: 'boolean', value: false, help: 'See fader\'s `horizontal`'}, + pips: {type: 'boolean', value: false, help: 'See fader\'s `pips`'}, + dashed: {type: 'boolean', value: false, help: 'See fader\'s `dashed`'}, + gradient: {type: 'array|object', value: [], help: [ + 'When set, the meter\'s gauge will be filled with a linear color gradient', + '- each item must be a CSS color string.', + '- as an `object`: each key must be a number between 0 and 1', + '- each item must be a CSS color string.', + 'Examples: `[\'blue\', \'red\']`, {\'0\': \'blue\', \'0.9\': \'blue\', \'1\': \'red\'} ' + ]}, + + }, ['precision', 'bypass'], { + + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--color-gauge: color;`', + '- `--color-knob: color;`', + '- `--color-pips: color;`', + '- `--gauge-opacity: number;`' + ]}, + + }) + + } + + constructor(options) { + + // backward compat + if (options.props.widgetId) { + options.props.value = '@{' + options.props.widgetId + '}' + delete options.props.widgetId + } + + super(options) + + this.widget.classList.add('meter') + + this.off(/drag(.*)?/) + + } + +} diff --git a/src/client/app/widgets/plots/plot.js b/src/client/app/widgets/plots/plot.js new file mode 100644 index 00000000..10e6efab --- /dev/null +++ b/src/client/app/widgets/plots/plot.js @@ -0,0 +1,53 @@ +var _plots_base = require('./_plots_base') + +module.exports = class Plot extends _plots_base { + + static description() { + + return 'XY coordinates plot.' + + } + + static defaults() { + + + return super.defaults({ + + _plot:'plot', + + rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis'}, + rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, + logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'}, + dots: {type: 'boolean', value: true, help: ''}, + bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'}, + smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'}, + pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, + + }, ['precision', 'bypass'], { + + value: {type: 'array|string', value: '', help: [ + '- `Array` of `y` values', + '- `Array` of `[x, y]` `array` values', + '- `String` `array`', + '- `String` `object` to update specific coordinates only: `{0:1, 4:0}` will change the 1st and 5th points\' coordinates', + ]} + + }) + + } + + constructor(options) { + + // backward compat + if (options.props.points && options.props.points.length) { + options.props.value = options.props.points + delete options.props.points + } + + super(options) + + } + +} diff --git a/src/client/app/widgets/plots/rgbled.js b/src/client/app/widgets/plots/rgbled.js new file mode 100644 index 00000000..7141965c --- /dev/null +++ b/src/client/app/widgets/plots/rgbled.js @@ -0,0 +1,79 @@ +var Widget = require('../common/widget'), + {clip} = require('../utils'), + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class Rbgled extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Rgb / rgba color display' + + } + + static defaults() { + + return super.defaults({}, ['color', 'precision', 'bypass'], { + + value: {type: 'array|string', value: '', help: [ + '- `Array`: `[r, g, b]` (`r`, `g` and `b` between `0` and `255`)', + '- `Array`: `[r, g, b, alpha]` (`alpha` between `0` and `255`)', + '- `String`: CSS color', + ]} + + }) + + } + + constructor(options) { + + // backward compat + if (options.props.widgetId) { + options.props.value = '@{' + options.props.widgetId + '}' + delete options.props.widgetId + } + + super({...options, html: html` +
      +
      + `}) + + this.setValue([0,0,0,0]) + + } + + + setValue(v, options={}) { + + var c = '' + + if (Array.isArray(v) && v.length >= 3) { + + for (let i in [0,1,2]) { + v[i] = parseInt(clip(v[i],[0,255])) + } + + v[3] = clip(v[3] != undefined ? v[3] : 1,[0,1]) + + c = `rgba(${v[0]}, ${v[1]}, ${v[2]}, ${v[3]})` + + } else if (typeof v == 'string') { + + c = v + + + } else { + + return + + } + + this.value = v + + this.widget.style.setProperty('--color-led', c) + + if (options.sync) this.changed(options) + + } + +} diff --git a/src/client/app/widgets/plots/svg.js b/src/client/app/widgets/plots/svg.js new file mode 100644 index 00000000..5ed6b395 --- /dev/null +++ b/src/client/app/widgets/plots/svg.js @@ -0,0 +1,109 @@ +var Widget = require('../common/widget'), + morph = require('nanomorph'), + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') + + +class Svg extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Svg parser.' + + } + + static defaults() { + + return super.defaults({ + + _svg:'svg', + + svg: {type: 'string', value: '', help: [ + 'Svg xml definition:', + '- will be wrapped in a `< svg />` element', + '- `` commands support a special percent notation (`%x` and `%y`)' + ]}, + border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'}, + + + }, ['color', 'precision', 'bypass'], {}) + + } + + constructor(options) { + + super({...options, html: html` +
      + +
      + `}) + + this.height = undefined + this.width = undefined + + this.on('resize', this.resizeHandleProxy.bind(this), {element: this.widget}) + + if (!this.getProp('border')) this.container.classList.add('noborder') + + } + + updateSvg(){ + + if (!this.width || !this.height) return + + var svg = this.getProp('svg') + + svg = svg.replace(/<\/svg>/gi, 'x') + svg = svg.replace(/([0-9.]+%x)/gi, m=>(parseFloat(m) * this.width / 100).toFixed(2)) + svg = svg.replace(/([0-9.]+%y)/gi, m=>(parseFloat(m) * this.height / 100).toFixed(2)) + + + var newSvg = html``, + node = html`
      ${newSvg}
      ` + + newSvg.innerHTML = svg + + morph(this.widget, node) + + } + + resizeHandleProxy() { + + this.resizeHandle(...arguments) + + } + + resizeHandle(event){ + + var {width, height} = event + + this.height = height + this.width = width + + this.updateSvg() + + } + + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'svg': + this.updateSvg() + return + + } + + } + + +} + +Svg.dynamicProps = Svg.prototype.constructor.dynamicProps.concat( + 'svg' +) + +module.exports = Svg diff --git a/src/client/app/widgets/plots/text.js b/src/client/app/widgets/plots/text.js new file mode 100644 index 00000000..f6aa4fc0 --- /dev/null +++ b/src/client/app/widgets/plots/text.js @@ -0,0 +1,73 @@ +var {iconify} = require('../../ui/utils'), + Widget = require('../common/widget'), + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') + +module.exports = class Text extends StaticProperties(Widget, {bypass: true}) { + + static description() { + + return 'Display text.' + + } + + static defaults() { + + return super.defaults({ + + _text: 'text', + + vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'}, + wrap: {type: 'boolean', value: false, help: [ + 'Set to `true` to wrap long lines automatically.', + 'This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property', + ]}, + align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, + + }, ['precision', 'bypass'], {}) + + } + + constructor(options) { + + // backward compat + if (options.props.widgetId) { + options.props.value = '@{' + options.props.widgetId + '}' + delete options.props.widgetId + } + super({...options, html: html`
      `}) + + if (this.getProp('vertical')) this.widget.classList.add('vertical') + if (this.getProp('align') === 'left') this.widget.classList.add('left') + if (this.getProp('align') === 'right') this.widget.classList.add('right') + if (this.getProp('wrap')) this.widget.classList.add('wrap') + + this.defaultValue = this.getProp('default') || ( this.getProp('label')===false ? + this.getProp('id'): + this.getProp('label')=='auto'? + this.getProp('id'): + this.getProp('label') ) + + this.value = this.defaultValue + + this.setValue(this.value) + + } + + + setValue(v, options={}) { + + this.value = v==null ? this.defaultValue : v + + var s = String(this.value) + if (s.indexOf('^') > -1) { + this.widget.innerHTML = iconify(s.replace(//g, '>').replace(/\n/g,'
      ')) + } else { + this.widget.textContent = s.replace(/\n/g,'\r\n') + } + + if (options.sync) this.changed(options) + + } + +} diff --git a/src/client/app/widgets/plots/visualizer.js b/src/client/app/widgets/plots/visualizer.js new file mode 100644 index 00000000..b96eb461 --- /dev/null +++ b/src/client/app/widgets/plots/visualizer.js @@ -0,0 +1,131 @@ +var {clip} = require('../utils'), + _plots_base = require('./_plots_base') + +module.exports = class Visualizer extends _plots_base { + + static description() { + + return 'Display its value over time.' + + } + + static defaults() { + + return super.defaults({ + + _visualizer:'visualizer', + + duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'}, + range: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, + origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, + logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, + smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'}, + pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, + + }, ['precision', 'bypass'], {}) + + } + + constructor(options) { + + // backward compat + if (options.props.widgetId) { + options.props.value = '@{' + options.props.widgetId + '}' + delete options.props.widgetId + } + + super(options) + + this.fps = CANVAS_FRAMERATE + this.pips.y.min = Math.abs(this.getProp('range').min) >= 1000? this.getProp('range').min/1000+'k' : this.getProp('range').min + this.pips.y.max = Math.abs(this.getProp('range').max) >= 1000? this.getProp('range').max/1000+'k' : this.getProp('range').max + this.pips.x = false + this.rangeY = this.getProp('range') || {min:0,max:1} + this.logScaleY = this.getProp('logScale') + this.length = Math.round(clip(this.fps * this.getProp('duration'), [8, 4096])) + this.value = new Array(this.length).fill(this.rangeY.min) + this.cancel = false + this.looping = false + this.clock = 0 + this.lastUpdate = 0 + this.watchDuration = 1000 * this.getProp('duration') + this.ticks = 0 + + } + + startLoop() { + + this.clock = Date.now() + if (!this.looping) { + this.lastUpdate = Date.now() + this.looping = true + this.ticks = 0 + this.loop() + } + } + + loop() { + + var t = Date.now() + + if (t -this.clock >= this.watchDuration) { + this.looping = false + } + + this.ticks += (t - this.lastUpdate) / (1000/this.fps) + + if (Math.floor(this.ticks) > 0) { + this.shiftData(Math.floor(this.ticks)) + this.ticks -= Math.floor(this.ticks) + this.batchDraw() + } + + this.lastUpdate = t + + if (!this.looping) return + + setTimeout(()=>{ + this.loop() + }, (1000/this.fps)) + + } + + shiftData(n) { + + for (var i=0; i `)' + ]}, + + }, [], { + + touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'}, + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      +
      +
      +
      + `}) + + this.wrapper = DOM.get(this.widget, '.wrapper')[0] + this.ticks = Math.abs(parseInt(this.getProp('ticks')) || 360) + + this.knob = new EncoderKnob({props:{ + label:false, + angle:360, + snap:true, + range:{min:0,max:this.ticks}, + pips:false, + }, parent: this}) + + this.knob.batchDraw = ()=>{} + + this.display = new DisplayKnob({props:{ + label:false, + angle:360, + range:{min:0,max:this.ticks}, + origin:this.ticks/2, + pips:false, + compact: this.getProp('compact') + }, parent: this}) + + this.knob.widget.classList.add('drag-knob') + this.display.widget.classList.add('display-knob') + + this.wrapper.appendChild(this.knob.widget) + this.wrapper.appendChild(this.display.widget) + + this.knob.setValue(this.ticks/2) + this.display.setValue(this.ticks/2) + + this.previousValue = this.ticks/2 + + this.on('change',(e)=>{ + + if (e.widget == this) return + + e.stopPropagation = true + + var value = this.knob.getValue() + + var direction + + if (value < this.previousValue) + direction = this.getProp('back') + if (value > this.previousValue) + direction = this.getProp('forth') + + if ((this.ticks * .75 < value && value < this.ticks) && (0 < this.previousValue && this.previousValue < this.ticks / 4)) + direction = this.getProp('back') + if ((0 < value && value < this.ticks / 4) && (this.ticks * .75 < this.previousValue && this.previousValue < this.ticks)) + direction = this.getProp('forth') + + + if (direction !== undefined && (Math.round(value) != Math.round(this.previousValue))) this.setValue(direction, {sync:true, send:true, dragged: e.options.dragged, draginit: e.options.draginit}) + + this.previousValue = value + + }) + + this.knob.on('draginit', (e)=>{ + if (this.getProp('touchAddress') && this.getProp('touchAddress').length + && e.target == this.wrapper) + this.sendValue({ + address:this.getProp('touchAddress'), + v:1 + }) + }) + + this.knob.on('dragend', (e)=>{ + if (this.getProp('release') !== '' && this.value !== this.getProp('release')) { + this.knob.setValue(this.ticks/2) + this.display.setValue(this.ticks/2) + this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false}) + } + if ( + this.getProp('touchAddress') && this.getProp('touchAddress').length + && e.target == this.wrapper + ) { + this.sendValue({ + address:this.getProp('touchAddress'), + v:0 + }) + } + }) + + if (this.getProp('doubleTap')) { + + doubletab(this.wrapper, ()=>{ + this.knob.setValue(this.ticks/2) + this.display.setValue(this.ticks/2) + if (this.getProp('release') !== '' && this.value !== this.getProp('release')) { + this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false}) + } + }) + + } + + this.wrapper.addEventListener('mousewheel', (e)=>{ + + if (e.wheelDeltaX || e.wheelDelta == 0) return + + var direction = e.wheelDelta / Math.abs(e.wheelDelta) + + this.display.setValue(this.display.value + direction) + this.setValue(direction < 0 ? this.getProp('back') : this.getProp('forth'), {sync:true, send:true}) + + if (this.getProp('release') !== '' && this.value !== this.getProp('release')) { + this.knob.setValue(this.ticks/2) + this.display.setValue(this.ticks/2) + this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false}) + } + }) + + + } + + setValue(v,options={}) { + + if (this.getProp('snap') || (!this.getProp('snap') && !options.draginit)) { + + var match = true + + if (v === this.getProp('back')) { + this.value = this.getProp('back') + } else if (v === this.getProp('forth')) { + this.value = this.getProp('forth') + } else if (v === this.getProp('release') && this.getProp('release') !== '') { + this.value = this.getProp('release') + } else { + match = false + } + + } + + if (options.sync && match) this.changed(options) + if (options.send && match && !(!this.getProp('snap') && options.draginit)) this.sendValue() + + if (options.dragged || options.draginit) this.updateDisplay(options.draginit) + + } + + updateDisplay(init){ + + if (this.getProp('snap')) { + this.display.setValue(this.knob.value) + return + } + + if (init) { + + this.offset = this.knob.value - this.display.value + + } else { + + var v = this.knob.value - this.offset, + updateOffset + + if (v > this.ticks) { + + v = this.ticks - v + updateOffset = true + + + } else if (v < 0) { + + v = v + this.ticks + updateOffset = true + + } + + this.display.setValue(v) + + if (updateOffset) { + this.offset = this.knob.value - this.display.value + } + } + + if (this.offset > this.ticks) this.offset = this.ticks - this.offset + if (this.offset < 0) this.offset = this.offset + this.ticks + + } + + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of [this.knob, this.display]) { + w.onPropChanged('color') + } + return + + } + + } + + onRemove() { + this.knob.onRemove() + this.display.onRemove() + super.onRemove() + } + +} diff --git a/src/client/app/widgets/sliders/fader.js b/src/client/app/widgets/sliders/fader.js new file mode 100644 index 00000000..0cd472b3 --- /dev/null +++ b/src/client/app/widgets/sliders/fader.js @@ -0,0 +1,358 @@ +var {clip} = require('../utils'), + Slider = require('./slider'), + parser = require('../../parser'), + html = require('nanohtml') + +module.exports = class Fader extends Slider { + + static description() { + + return 'Vertical / horizontal slider.' + + } + + static defaults() { + + return super.defaults({ + + _fader:'fader', + + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'}, + alignRight: {type: 'boolean', value: false, help: 'Set to `true` to invert the pip\'s and fader\'s position'}, + pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, + input: {type: 'boolean', value: true, help: 'Set to `false` to hide the built-in input'}, + meter: {type: 'boolean', value: false, help: [ + 'Set to true to display a vu-meter next in the fader', + '- the meter\'s `id` will be the same as the widget\'s with `/meter` appended to it', + '- the meter\'s `address` will be the same as the widget\'s with `/meter` appended to it' + ]}, + compact: {type: 'boolean', value: false, help: 'Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled.'}, + dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'}, + snap: {type: 'boolean', value: false, help: 'By default, dragging the widget will modify it\'s value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position'}, + spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'}, + doubleTap: {type: 'boolean', value: false, help: [ + 'Set to `true` to make the fader reset to its `default` value when receiving a double tap.', + 'Can also be an osc address, in which case the widget will just send an osc message (`/ `)' + ]}, + range: {type: 'object', value: {min:0,max:1}, help: [ + 'Defines the breakpoints of the fader\'s scale:', + '- keys can be percentages and/or `min` / `max`', + '- values can be `number` or `object` if a custom label is needed', + 'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)' + ]}, + logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm\'s base.'}, + sensitivity: {type: 'number', value: 1, help: 'Defines the fader\'s sensitivity when `snap` is `false` '}, + steps: {type: 'string|number|array', value: '', help: [ + 'Restricts the widget\'s value:', + '- `auto`: use values defined in `range`', + '- `number`: define a number of evenly spaced steps', + '- `array`: use arbitrary values', + ]}, + unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'}, + origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the fader\'s gauge'}, + + }, [], { + + touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'}, + meterAddress: {type: 'string', value:'', help: 'OSC address for the built-in meter'}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--color-gauge: color;`', + '- `--color-knob: color;`', + '- `--color-pips: color;`', + '- `--gauge-opacity: number;`', + '- `--gauge-width: number;` (2-16, requires a manual resize to take effect)' + ]} + }) + + } + + constructor(options) { + + super(options) + + this.widget.classList.add('fader') + this.margin = 22 + this.gaugeWidth = 2 + + + if (this.getProp('horizontal')) { + this.widget.classList.add('horizontal') + this.container.classList.add('horizontal') + } + + if (this.getProp('compact')) { + this.margin = 0 + } + + if (this.getProp('alignRight') && !this.getProp('horizontal')) { + this.widget.classList.add('align-right') + } + + if (this.getProp('meter')) { + var data = { + type:'meter', + id: this.getProp('id') + '/meter', + label:false, + horizontal:this.getProp('horizontal'), + range:this.getProp('range'), + logScale:this.getProp('logScale'), + address: '#{@{parent.meterAddress} ? @{parent.meterAddress} : concat(@{parent.address}, "/meter")}', + preArgs: '@{parent.preArgs}', + target: '@{parent.target}', + color: '@{parent.color}', + pips:false, + dashed:true + } + var meter = parser.parse({ + data: data, + parentNode: this.wrapper, + parent: this + }) + + meter.container.classList.add('not-editable') + this.children.push(meter) + this.widget.classList.add('has-meter') + } + + if (this.getProp('pips')) { + + this.widget.classList.add('has-pips') + + + var pipTexts = {} + for (var k in this.rangeKeys) { + pipTexts[this.rangeKeys[k]]=this.rangeLabels[k] + } + + var pips = html`
      ` + for (var i=0;i<=100;i++) { + if (pipTexts[i]==undefined) continue + + var pos = this.getProp('horizontal')?'left':'bottom' + + pips.appendChild(html` +
      + ${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]} +
      + `) + + } + + this.wrapper.appendChild(pips) + + } + + + } + + draginitHandle(e) { + + super.draginitHandle(...arguments) + + this.percent = clip(this.percent,[0,100]) + + if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) return + + this.percent = this.getProp('horizontal')? + (e.offsetX - this.margin * PXSCALE) / (this.width - (this.margin * PXSCALE * 2)) * 100: + (this.height - e.offsetY - this.margin * PXSCALE) / (this.height - (this.margin * PXSCALE * 2)) * 100 + + // this.percent = clip(this.percent,[0,100]) + + this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) + + } + + dragHandle(e, data) { + + super.dragHandle(...arguments) + + this.percent = this.getProp('horizontal')? + this.percent + ( e.movementX/(this.width - this.margin * PXSCALE * 2)) * 100 / e.inertia * this.getProp('sensitivity'): + this.percent + (-e.movementY/(this.height - this.margin * PXSCALE * 2)) * 100 / e.inertia * this.getProp('sensitivity') + + this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) + + } + + percentToCoord(percent) { + + if (this.getProp('horizontal')) { + return clip(percent / 100,[0,1]) * (this.width - 2 * PXSCALE * this.margin) + this.margin * PXSCALE + } else { + return (this.height - this.margin * PXSCALE) - clip(percent / 100, [0,1]) * (this.height - 2 * PXSCALE * this.margin) + } + + } + + resizeHandle(event) { + + var ratio = CANVAS_SCALING * this.scaling + + if (this.getProp('compact') && this.getProp('horizontal')) { + event.height = 1 / ratio + } + + super.resizeHandle(event) + + this.gaugeWidth = Math.max(2, Math.min(16, parseInt(event.style.getPropertyValue('--gauge-width')) || 2)) + + if (this.getProp('horizontal')){ + this.ctx.setTransform(1, 0, 0, 1, 0, 0) + this.ctx.rotate(-Math.PI/2) + this.ctx.translate(-this.height * ratio, 0) + + if (ratio != 1) this.ctx.scale(ratio, ratio) + } + + if (this.getProp('gradient')) { + + var colors = this.getProp('gradient') + + if ( + (Array.isArray(colors) && colors.length > 1) || + (typeof colors === 'object' && Object.keys(colors).length > 1) + ) { + + var grad = this.ctx.createLinearGradient(0, this.getProp('horizontal') ? 0 : this.height, 0, this.getProp('horizontal') ? this.width : 0) + + try { + if (Array.isArray(colors)) { + + for (var i in colors) { + grad.addColorStop(i / (colors.length - 1), colors[i]) + } + this.colors.gradient = grad + + } else { + + for (var k in colors) { + if (!isNaN(k)) { + grad.addColorStop(clip(k, [0, 1]), colors[k]) + } + } + this.colors.gradient = grad + + } + } catch(err) { + this.errors.gradient = err + } + + } + + } + + + } + + + draw() { + + var width = this.getProp('horizontal') ? this.height : this.width, + height = !this.getProp('horizontal') ? this.height : this.width + + var percent = this.getProp('steps') ? this.valueToPercent(this.value) : this.percent, + d = Math.round(this.percentToCoord(percent)), + o = Math.round(this.percentToCoord(this.valueToPercent(this.originValue))), + m = Math.round(this.getProp('horizontal') ? this.height / 2 : this.width / 2) + + var dashed = this.getProp('dashed') + + this.clear() + + if (this.getProp('compact')) { + + this.ctx.globalAlpha = this.colors.gaugeOpacity || (dashed ? .3 : .2) + 0.2 * Math.abs(d-o) / (d `)' + ]}, + range: {type: 'object', value: {min:0,max:1}, help: [ + 'Defines the breakpoints of the fader\'s scale:', + '- keys can be percentages and/or `min` / `max`', + '- values can be `number` or `object` if a custom label is needed', + 'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)' + ]}, + logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm\'s base.'}, + sensitivity: {type: 'number', value: 1, help: 'Defines the knob\'s sensitivity when `snap` is `false` '}, + steps: {type: 'string|number|array', value: '', help: [ + 'Restricts the widget\'s value:', + '- `auto`: use values defined in `range`', + '- `number`: define a number of evenly spaced steps', + '- `array`: use arbitrary values', + ]}, + unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'}, + origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the knob\'s gauge'}, + + }, [], { + + touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--color-gauge: color;`', + '- `--color-knob: color;`', + '- `--color-pips: color;`' + ]} + + }) + + } + + constructor(options) { + + super(options) + + this.widget.classList.add('knob') + + this.lastOffsetX = 0 + this.lastOffsetY = 0 + this.minDimension = 0 + + this.maxAngle = this.getProp('angle') + + // calculate lost height factor + var a = (1 - Math.sin((Math.max(this.maxAngle,247.5) - 180) / 2 * Math.PI / 180)) / 3 + this.lostHeightFactor = a / 4 + + + if (this.getProp('pips')) { + + this.widget.classList.add('has-pips') + this.pipTexts = {} + for (var k in this.rangeKeys) { + this.pipTexts[this.rangeKeys[k]]=this.rangeLabels[k] + } + + } + + } + + draginitHandle(e) { + + this.percent = clip(this.percent,[0,100]) + + this.lastOffsetX = e.offsetX + this.lastOffsetY = e.offsetY + + // if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) return + + if (this.getProp('snap')) { + + this.percent = this.angleToPercent(this.coordsToAngle(e.offsetX, e.offsetY)) + + this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) + + } + + + } + + dragHandle(e) { + + if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) { + // vertical + this.percent = -100 * (e.movementY / e.inertia * this.getProp('sensitivity')) / this.height + this.percent + + } else { + //snap + var offsetX = this.lastOffsetX + e.movementX / e.inertia, + offsetY = this.lastOffsetY + e.movementY / e.inertia + + if (e.traversing && !this.getProp('snap')) { + + var diff = this.angleToPercent(this.coordsToAngle(offsetX, offsetY), true) - this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY), true) + if (Math.abs(diff) < 50 && diff !== 0) this.percent += diff + + } else { + + // snap + this.percent = this.angleToPercent(this.coordsToAngle(offsetX, offsetY)) + + } + + this.lastOffsetX = offsetX + this.lastOffsetY = offsetY + + } + + + this.percent = clip(this.percent,[0,100]) + + this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) + + } + + coordsToAngle(x,y) { + + var xToCenter = x - this.width /2, + yToCenter = y - this.height / 2, + angle = Math.atan2(-yToCenter, -xToCenter) * 180 / Math.PI + 90 + + return angle<0?360+angle:angle + + } + + angleToPercent(angle, ignoreMaxAngle=false) { + + return ignoreMaxAngle ? + clip(angle, [0, 360]) / 360 * 100 : + clip(angle - (360 - this.maxAngle) / 2, [0, this.maxAngle]) / this.maxAngle * 100 + + } + + percentToAngle(percent) { + + percent = clip(percent, [0, 100]) + + return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle + + Math.PI / 2 // quarter circle offset + + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle + + } + + resizeHandle() { + + super.resizeHandle(...arguments) + + this.minDimension = Math.min(this.width, this.height) + + this.wrapper.style.top = (this.minDimension) * this.lostHeightFactor - (this.getProp('label') === false ? 0 : this.gaugeWidth / 4) + 'px' + + } + + draw() { + + var percent = this.getProp('steps') ? this.valueToPercent(this.value) : this.percent, + o = this.percentToAngle(this.valueToPercent(this.originValue)), + d = this.percentToAngle(percent), + min = this.percentToAngle(0), + max = this.percentToAngle(100), + dashed = this.getProp('dashed'), + pips = this.getProp('pips'), + gaugeWidth = Math.max(7 * PXSCALE, this.minDimension / 20), + gaugeRadius = this.minDimension / 2 - gaugeWidth / 2 - 2 * PXSCALE, + knobRadius = gaugeRadius - gaugeWidth, + rad = PXSCALE / gaugeRadius / 2 + + + if (this.getProp('compact')) { + pips = false + gaugeWidth = this.minDimension / 4 + gaugeRadius = this.minDimension / 2 - gaugeWidth / 2 + } + + + if (pips) { + gaugeRadius -= this.fontSize * PXSCALE * 1.5 + gaugeWidth / 2 + knobRadius = gaugeRadius - gaugeWidth + } + + + this.ctx.clearRect(0,0,this.width,this.height) + + this.ctx.globalAlpha = 1 + + this.ctx.strokeStyle = this.colors.light + this.ctx.lineWidth = gaugeWidth + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min - 4 * rad, max + 4 * rad) + this.ctx.stroke() + + this.ctx.strokeStyle = this.colors.bg + this.ctx.lineWidth = gaugeWidth - 2 * PXSCALE + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min - 2 * rad, max + 2 * rad) + this.ctx.stroke() + + if (dashed) this.ctx.setLineDash([1.5 * PXSCALE, 1.5 * PXSCALE]) + + this.ctx.strokeStyle = this.colors.track + this.ctx.lineWidth = gaugeWidth - 4.5 * PXSCALE + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) + this.ctx.stroke() + + this.ctx.globalAlpha = 0.7 + this.ctx.strokeStyle = this.colors.gauge + this.ctx.lineWidth = gaugeWidth - 4.5 * PXSCALE + this.ctx.beginPath() + + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) + this.ctx.stroke() + + if (dashed) this.ctx.setLineDash([]) + + if (this.getProp('compact')) { + this.ctx.globalAlpha = 1 + let r1 = gaugeRadius - gaugeWidth / 2 + 2 * PXSCALE, + r2 = gaugeRadius + gaugeWidth / 2 - 2 * PXSCALE, + a = 2 * Math.PI - d + + this.ctx.beginPath() + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) + + this.ctx.lineWidth = PXSCALE + this.ctx.strokeStyle = this.colors.knob + this.ctx.stroke() + return + } + + if (pips) { + + this.ctx.globalAlpha = 1 + + for (var pip of this.rangeKeys.concat(this.valueToPercent(this.originValue))) { + + let a = this.percentToAngle(pip) + + this.ctx.lineWidth = gaugeWidth + 2 * PXSCALE + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, a - 4.5 * rad, a + 4.5 * rad) + this.ctx.strokeStyle = this.colors.fg + this.ctx.stroke() + this.ctx.strokeStyle = this.colors.light + this.ctx.stroke() + + this.ctx.lineWidth = gaugeWidth + 1.5 * PXSCALE + this.ctx.strokeStyle = this.colors.pips + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, a - 2 * rad, a + 2 * rad) + this.ctx.stroke() + + } + + var radius = gaugeRadius + this.fontSize * PXSCALE + gaugeWidth / 2 + this.ctx.fillStyle = this.colors.textFade + for (var p in this.pipTexts) { + if (this.pipTexts[p] == undefined) continue + var angle = this.percentToAngle(p), + size = this.ctx.measureText(this.pipTexts[p]), + x = this.width / 2 + radius * Math.cos(angle) - size.width / 2, + y = this.height / 2 + radius * Math.sin(angle) + this.ctx.fillText(this.pipTexts[p], x, y) + } + + } + + // knob + + this.ctx.lineWidth = PXSCALE + + this.ctx.fillStyle = this.colors.raised + this.ctx.beginPath() + this.ctx.globalAlpha = 1 + this.ctx.arc(this.width / 2, this.height / 2, knobRadius, 0, Math.PI * 2) + this.ctx.fill() + this.ctx.strokeStyle = this.colors.bg + this.ctx.stroke() + + this.ctx.beginPath() + this.ctx.globalAlpha = 1 + this.ctx.arc(this.width / 2, this.height / 2, knobRadius - PXSCALE * 1.5, 0, Math.PI * 2) + this.ctx.strokeStyle = this.colors.light + this.ctx.stroke() + + var g = this.ctx.createLinearGradient(this.width / 2, this.height / 2 - knobRadius / 2,this.width / 2, this.height / 2 + knobRadius / 2) + g.addColorStop(0.5, 'transparent') + g.addColorStop(0, this.colors.light || 'transparent') + + this.ctx.strokeStyle = g + this.ctx.stroke() + + // cursor + this.ctx.globalAlpha = 1 + + let r1 = knobRadius - PXSCALE, + r2 = knobRadius / 4, + a = 2 * Math.PI - d + + this.ctx.beginPath() + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) + + this.ctx.lineWidth = gaugeWidth - 4.5 * PXSCALE + this.ctx.strokeStyle = this.colors.knob + this.ctx.stroke() + + } + +} diff --git a/src/client/app/widgets/sliders/range.js b/src/client/app/widgets/sliders/range.js new file mode 100644 index 00000000..03beb588 --- /dev/null +++ b/src/client/app/widgets/sliders/range.js @@ -0,0 +1,472 @@ +var {clip} = require('../utils'), + Widget = require('../common/widget'), + Fader = require('./fader'), + Input = require('../inputs/input'), + touchstate = require('../mixins/touch_state'), + html = require('nanohtml') + +var faderDefaults = Fader.defaults()._props() + +var RangeFader = class RangeFader extends Fader { + + constructor(options) { + + super(options) + this.cancelDraw = options.cancelDraw + + } + + sendValue() {} + + draginitHandle() { + + this.percent = clip(this.percent,[ + this.valueToPercent(this.rangeValsMin), + this.valueToPercent(this.rangeValsMax) + ]) + + super.draginitHandle(...arguments) + } + + draw() { + + if (this.cancelDraw || !this.parent.faders) return + + var width = this.getProp('horizontal') ? this.height : this.width, + height = !this.getProp('horizontal') ? this.height : this.width + + var d = Math.round(this.percentToCoord(this.valueToPercent(this.parent.faders[this.getProp('horizontal')?0:1].value))), + d2 = Math.round(this.percentToCoord(this.valueToPercent(this.parent.faders[this.getProp('horizontal')?1:0].value))), + m = Math.round(this.getProp('horizontal') ? this.height / 2 : this.width / 2) + + var dashed = this.getProp('dashed') + + this.clear() + + if (this.getProp('compact')) { + + this.ctx.globalAlpha = this.colors.gaugeOpacity || (dashed ? .3 : .2) + 0.2 * Math.abs(d-d2) / height + this.ctx.strokeStyle = this.colors.gauge + this.ctx.beginPath() + this.ctx.moveTo(m, d2) + this.ctx.lineTo(m, d) + this.ctx.lineWidth = width + 2 * PXSCALE + if (dashed) this.ctx.setLineDash([PXSCALE, PXSCALE]) + this.ctx.stroke() + if (dashed) this.ctx.setLineDash([]) + + this.ctx.globalAlpha = 1 + this.ctx.beginPath() + this.ctx.fillStyle = this.colors.knob + this.ctx.rect(0, Math.min(d, height - PXSCALE), width, PXSCALE) + this.ctx.rect(0, Math.min(d2, height - PXSCALE), width, PXSCALE) + this.ctx.fill() + + this.clearRect = [0, 0, width, height] + + } else { + + this.ctx.lineWidth = 6 * PXSCALE + + this.ctx.beginPath() + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.colors.light + this.ctx.moveTo(m, this.margin * PXSCALE - 2 * PXSCALE) + this.ctx.lineTo(m, height - this.margin * PXSCALE + 2 * PXSCALE) + this.ctx.stroke() + + this.ctx.lineWidth = 4 * PXSCALE + + this.ctx.beginPath() + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.colors.bg + this.ctx.moveTo(m, this.margin * PXSCALE - 1 * PXSCALE) + this.ctx.lineTo(m, height - this.margin * PXSCALE + 1 * PXSCALE) + this.ctx.stroke() + + this.ctx.lineWidth = 2 * PXSCALE + + this.ctx.beginPath() + this.ctx.strokeStyle = this.colors.track + this.ctx.moveTo(m, this.margin * PXSCALE) + this.ctx.lineTo(m, height - this.margin * PXSCALE) + this.ctx.stroke() + + this.ctx.beginPath() + this.ctx.globalAlpha = 0.7 + this.ctx.strokeStyle = this.colors.gauge + this.ctx.moveTo(m, d2) + this.ctx.lineTo(m, d) + if (dashed) this.ctx.setLineDash([PXSCALE, PXSCALE]) + this.ctx.stroke() + if (dashed) this.ctx.setLineDash([]) + + this.ctx.globalAlpha = 1 + + // high knob bg + + this.ctx.beginPath() + this.ctx.rect(m - 9 * PXSCALE, d - 14 * PXSCALE, 18 * PXSCALE, 16 * PXSCALE) + this.ctx.lineWidth = PXSCALE + this.ctx.fillStyle = this.colors.bg + this.ctx.fill() + + // low knob bg + + this.ctx.beginPath() + this.ctx.rect(m - 9 * PXSCALE, d2 - PXSCALE, 18 * PXSCALE, 16 * PXSCALE) + this.ctx.lineWidth = PXSCALE + this.ctx.fillStyle = this.colors.bg + this.ctx.fill() + + // high knob + + this.ctx.beginPath() + this.ctx.rect(m - 8 * PXSCALE, d - 13 * PXSCALE, 16 * PXSCALE, 14 * PXSCALE) + this.ctx.fillStyle = this.colors.raised + this.ctx.fill() + this.ctx.lineWidth = PXSCALE + + this.ctx.beginPath() + this.ctx.rect(m - 7.5 * PXSCALE, d - 12.5 * PXSCALE, 15 * PXSCALE, 13.5 * PXSCALE) + this.ctx.lineWidth = PXSCALE + this.ctx.strokeStyle = this.colors.light + this.ctx.stroke() + + this.ctx.beginPath() + this.ctx.rect(m - 8 * PXSCALE, d - 13 * PXSCALE, 16 * PXSCALE, PXSCALE) + this.ctx.lineWidth = PXSCALE + this.ctx.fillStyle = this.colors.light + this.ctx.fill() + + this.ctx.beginPath() + this.ctx.rect(m - 4 * PXSCALE, d, 8 * PXSCALE, PXSCALE) + this.ctx.fillStyle = this.colors.knob + this.ctx.fill() + + // low knob + + this.ctx.beginPath() + this.ctx.rect(m - 8 * PXSCALE, d2, 16 * PXSCALE, 14 * PXSCALE) + this.ctx.fillStyle = this.colors.raised + this.ctx.fill() + this.ctx.lineWidth = PXSCALE + + this.ctx.beginPath() + this.ctx.rect(m - 7.5 * PXSCALE, d2, 15 * PXSCALE, 13.5 * PXSCALE) + this.ctx.lineWidth = PXSCALE + this.ctx.strokeStyle = this.colors.light + this.ctx.stroke() + + this.ctx.beginPath() + this.ctx.rect(m - 4 * PXSCALE, d2, 8 * PXSCALE, PXSCALE) + this.ctx.fillStyle = this.colors.knob + this.ctx.fill() + + + + this.clearRect = [width / 2 - 11 * PXSCALE, 0, 22 * PXSCALE, height] + } + } + +} + + +class Range extends Widget { + + static description() { + + return 'A fader with two heads for setting a range.' + + } + + static defaults() { + + return super.defaults({ + + _range:'range', + + range: {type: 'object', value: {min:0,max:1}, help: 'See fader\'s `range`'}, + horizontal: {type: 'boolean', value: false, help: 'See fader\'s `horizontal`'}, + alignRight: {type: 'boolean', value: false, help: 'See fader\'s `alignRight`'}, + input: {type: 'boolean', value: true, help: 'See fader\'s `input`'}, + compact: {type: 'boolean', value: false, help: 'See fader\'s `compact`'}, + pips: {type: 'boolean', value: true, help: 'See fader\'s `pips`'}, + snap: {type: 'boolean', value: false, help: 'See fader\'s `snap`'}, + spring: {type: 'boolean', value: false, help: 'See fader\'s `spring`'}, + logScale: {type: 'boolean', value: false, help: 'See fader\'s `logScale`'}, + sensitivity: {type: 'number', value: 1, help: 'See fader\'s `sensitivity`'}, + + }, [], { + + touchAddress: {type: 'string', value: '', help: 'See fader\'s `touchAddress`'}, + split: {type: 'boolean|object', value: false, help: [ + 'Set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget\'s with `/low` or `/high` appended to it', + 'Can be set as an object to specify a different `address` : `[\'/osc_address_low\', \'/osc_address_high\']`', + 'Note: the widget will only respond to its original osc address, not to the splitted version' + ]}, + css: {type: 'string', value: '', help: [ + 'Available CSS variables:', + '- `--color-gauge: color;`', + '- `--color-knob: color;`', + '- `--color-pips: color;`', + '- `--gauge-opacity: number;`' + ]} + + }) + + } + + constructor(options) { + + super({...options, html: html` +
      +
      +
      + `}) + + this.wrapper = DOM.get(this.widget, '.wrapper')[0] + + this.faders = [ + new RangeFader({props:{ + ...faderDefaults, + compact:this.getProp('compact'), + pips:false, + alignRight:false, + horizontal:this.getProp('horizontal'), + height:'100%', + width:'100%', + default:this.getProp('default').length === 2 ? this.getProp('default')[0] : this.getProp('range').min, + snap:this.getProp('snap'), + spring:this.getProp('spring'), + range:this.getProp('range'), + origin:'auto', + precision:this.getProp('precision'), + logScale:this.getProp('logScale'), + sensitivity:this.getProp('sensitivity'), + input:false + }, cancelDraw: true, parent: this}), + new RangeFader({props:{ + ...faderDefaults, + compact:this.getProp('compact'), + pips:this.getProp('pips'), + alignRight:this.getProp('alignRight'), + horizontal:this.getProp('horizontal'), + height:'100%', + width:'100%', + default:this.getProp('default').length === 2 ? this.getProp('default')[1] : this.getProp('range').max, + snap:this.getProp('snap'), + spring:this.getProp('spring'), + range:this.getProp('range'), + origin:'auto', + precision:this.getProp('precision'), + logScale:this.getProp('logScale'), + sensitivity:this.getProp('sensitivity'), + input:false + }, cancelDraw: false, parent: this}) + ] + + this.wrapper.appendChild(this.faders[0].widget) + this.wrapper.appendChild(this.faders[1].widget) + + this.on('change',(e)=>{ + + if (e.widget == this) return + + e.stopPropagation = true + + var v = [ + this.faders[0].getValue(), + this.faders[1].getValue() + ] + + this.setValue(v, e.options) + + }) + + this.touchMap = {} + + touchstate(this, {element: this.wrapper, multitouch: true}) + + this.on('draginit',(e)=>{ + + var id + + if (!this.touchMap[e.pointerId]) { + + var ndiff, diff = -1 + + for (var i in this.faders) { + + if (Object.values(this.touchMap).indexOf(i) != -1) continue + + var coord = this.faders[i].percentToCoord(this.faders[i].valueToPercent(this.faders[i].value)) - (this.getProp('horizontal') ? -1 : 1) * (i == 0 ? -20 : 20) + + ndiff = this.getProp('horizontal')? + Math.abs(e.offsetX - coord) : + Math.abs(e.offsetY - coord) + + if (diff == -1 || ndiff < diff) { + id = i + diff = ndiff + } + + } + + this.touchMap[e.pointerId] = id + + + } else if (e.traversing) { + + id = this.touchMap[e.pointerId] + + } + + if (!id) return + + e.stopPropagation = true + this.faders[id].trigger('draginit', e) + + }, {element: this.wrapper, multitouch: true}) + + this.on('drag',(e)=>{ + + var i = this.touchMap[e.pointerId] + + if (!i) return + + if (e.shiftKey) { + this.faders[0].trigger('drag', e) + this.faders[1].trigger('drag', e) + } else { + this.faders[i].trigger('drag', e) + } + + }, {element: this.wrapper, multitouch: true}) + + this.on('dragend',(e)=>{ + + var i = this.touchMap[e.pointerId] + + if (!i) return + + e.stopPropagation = true + this.faders[i].trigger('dragend', e) + delete this.touchMap[e.pointerId] + + }, {element: this.wrapper, multitouch: true}) + + if (this.getProp('input')) { + + this.input = new Input({ + props:{...Input.defaults()._props(), + precision:this.getProp('precision'), + unit:this.getProp('unit'), + vertical: this.getProp('compact') && !this.getProp('horizontal') + }, + parent:this, parentNode:this.widget, + }) + this.widget.appendChild(this.input.widget) + this.input.on('change', (e)=>{ + e.stopPropagation = true + this.setValue(this.input.getValue(), {sync:true, send:true}) + this.showValue() + }) + + } + + + if (this.getProp('horizontal')) { + this.widget.classList.add('horizontal') + this.container.classList.add('horizontal') + } + if (this.getProp('alignRight') && !this.getProp('horizontal')) { + this.widget.classList.add('align-right') + } + if (this.getProp('compact')) { + this.widget.classList.add('compact') + } + if (this.getProp('pips')) { + this.widget.classList.add('has-pips') + } + + this.setValue([ + this.faders[0].rangeValsMin, + this.faders[1].rangeValsMax + ]) + + } + + setValue(v, options={}) { + if (!v || !v.length || v.length!=2) return + + + this.faders[0].rangeValsMax = v[1] + this.faders[1].rangeValsMin = v[0] + + if (!options.dragged) { + this.faders[0].setValue(v[0]) + this.faders[1].setValue(v[1]) + } + + this.value = [ + this.faders[0].getValue(), + this.faders[1].getValue() + ] + + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + this.faders[1].batchDraw() + + this.showValue() + + + } + + showValue() { + + if (this.getProp('input')) this.input.setValue(this.value) + + } + + getSplit() { + + return this.getProp('split')? + typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 ? + this.getProp('split') + : [this.getProp('address') + '/low', this.getProp('address') + '/high'] + : false + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of this.faders) { + w.onPropChanged('color') + } + return + + } + + } + + onRemove() { + this.faders[0].onRemove() + this.faders[1].onRemove() + if (this.input) this.input.onRemove() + super.onRemove() + } + +} + + +Range.dynamicProps = Range.prototype.constructor.dynamicProps.filter(n => n !== 'precision') + +module.exports = Range diff --git a/src/client/app/widgets/sliders/slider.js b/src/client/app/widgets/sliders/slider.js new file mode 100644 index 00000000..595d9d74 --- /dev/null +++ b/src/client/app/widgets/sliders/slider.js @@ -0,0 +1,310 @@ +var {clip, mapToScale} = require('../utils'), + Canvas = require('../common/canvas'), + touchstate = require('../mixins/touch_state'), + doubletab = require('../mixins/double_tap'), + Input = require('../inputs/input'), + html = require('nanohtml') + +class Slider extends Canvas { + + constructor(options) { + + super({...options, html: html` +
      +
      + +
      +
      + `}) + + this.wrapper = DOM.get(this.widget, '.wrapper')[0] + + this.value = undefined + this.percent = 0 + + this.unit = this.getProp('unit') ? ' ' + this.getProp('unit') : '' + + + this.rangeKeys = [] + this.rangeVals = [] + this.rangeLabels = [] + + for (var k in this.getProp('range')) { + var key = k=='min'?0:k=='max'?100:parseInt(k), + val = typeof this.getProp('range')[k] == 'object'? + this.getProp('range')[k][Object.keys(this.getProp('range')[k])[0]]: + this.getProp('range')[k], + label = typeof this.getProp('range')[k] == 'object'? + Object.keys(this.getProp('range')[k])[0]: + val + + this.rangeKeys.push(key) + this.rangeVals.push(val) + this.rangeLabels.push(label) + } + this.rangeValsMax = Math.max(...this.rangeVals), + this.rangeValsMin = Math.min(...this.rangeVals) + + this.originValue = this.getProp('origin')=='auto'? + this.rangeValsMin: + clip(this.getProp('origin'), [this.rangeValsMin,this.rangeValsMax]) + + if (this.getProp('doubleTap')) { + + if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') { + + doubletab(this.widget, ()=>{ + this.sendValue({v:null, address: this.getProp('doubleTap')}) + }) + + } else { + + doubletab(this.widget, ()=>{ + this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true}) + }) + + } + + } + + + this.wrapper.addEventListener('mousewheel',this.mousewheelHandleProxy.bind(this)) + + this.on('draginit', this.draginitHandleProxy.bind(this), {element:this.wrapper}) + this.on('drag', this.dragHandleProxy.bind(this), {element:this.wrapper}) + this.on('dragend', this.dragendHandleProxy.bind(this), {element:this.wrapper}) + + touchstate(this, {element: this.wrapper}) + + + if (this.getProp('input')) { + + this.input = new Input({ + props:{ + ...Input.defaults()._props(), + precision:this.getProp('precision'), + unit:this.getProp('unit'), + vertical: this.getProp('type') == 'fader' && this.getProp('compact') && !this.getProp('horizontal') + }, + parent:this, parentNode:this.widget + }) + + this.input.sendValue = ()=>{} + this.widget.appendChild(this.input.widget) + this.input.on('change', (e)=>{ + e.stopPropagation = true + this.setValue(this.input.getValue(), {sync:true, send:true}) + this.showValue() + }) + + } + + if (this.getProp('compact')) { + this.widget.classList.add('compact') + if (this.getProp('input')) { + this.widget.addEventListener('fast-right-click', (e)=>{ + if (e.detail.button == 2 && !EDITING) { + // Mouse only + this.input.focus() + } + }) + } + } + + this.setSteps() + + this.setValue(this.getSpringValue()) + + } + + mousewheelHandleProxy() { + + this.mousewheelHandle(...arguments) + + } + + draginitHandleProxy() { + + this.draginitHandle(...arguments) + + } + + dragHandleProxy() { + + this.dragHandle(...arguments) + + } + + dragendHandleProxy() { + + this.dragendHandle(...arguments) + + } + + mousewheelHandle(e) { + + if (e.wheelDeltaX) return + + e.preventDefault() + e.stopPropagation() + + var direction = e.wheelDelta / Math.abs(e.wheelDelta), + increment = e.ctrlKey?0.25:1 + + if (this.getProp('steps')) { + var i = this.steps.indexOf(this.value) + if (i > -1 && i < this.steps.length) { + this.setValue(this.steps[i + direction], {sync: true, send: true, fromLocal: true}) + } + } else { + this.percent = clip(this.percent + Math.max(increment,10/Math.pow(10,this.precision + 1)) * direction, [0,100]) + this.setValue(this.percentToValue(this.percent), {sync: true, send: true, dragged: true}) + } + + } + + draginitHandle(e, data, traversing) { + + } + + dragHandle(e, data, traversing) { + + } + + dragendHandle(e, data, traversing) { + + if (this.getProp('spring')) { + this.setValue(this.getSpringValue(),{sync:true,send:true,fromLocal:true}) + } + + } + + cacheCanvasStyle(style) { + + style = style || window.getComputedStyle(this.canvas) + + super.cacheCanvasStyle(style) + + this.colors.gauge = style.getPropertyValue('--color-gauge') || this.colors.custom + this.colors.knob = style.getPropertyValue('--color-knob') || this.colors.custom + this.colors.pips = style.getPropertyValue('--color-pips') || this.colors.custom + this.colors.gaugeOpacity = style.getPropertyValue('--gauge-opacity') + + + } + + getSpringValue() { + + return this.getProp('default') !== '' ? this.getProp('default') : this.originValue + + } + + + percentToValue(percent) { + + var h = clip(percent,[0,100]) + for (var i=0;i= this.rangeKeys[i]) { + return mapToScale(h,[this.rangeKeys[i],this.rangeKeys[i+1]],[this.rangeVals[i],this.rangeVals[i+1]],false,this.getProp('logScale')) + } + } + + } + + valueToPercent(value) { + + for (var i=0;i this.rangeVals[i] && value <= this.rangeVals[i+1] && value >= this.rangeVals[i]) || + (this.rangeVals[i+1] < this.rangeVals[i] && value >= this.rangeVals[i+1] && value <= this.rangeVals[i]) + ) { + return mapToScale(value,[this.rangeVals[i],this.rangeVals[i+1]],[this.rangeKeys[i],this.rangeKeys[i+1]],false,this.getProp('logScale'),true) + } + } + + } + + setValue(v,options={}) { + + if (typeof v != 'number') return + if (this.touched && !options.dragged) return this.setValueTouchedQueue = [v, options] + + var value = clip(v,[this.rangeValsMin,this.rangeValsMax]) + + if ((options.dragged || options.fromLocal) && this.value.toFixed(this.precision) == value.toFixed(this.precision)) options.send = false + + this.value = value + + if (this.getProp('steps')) { + + var diff = this.steps.map(x => Math.abs(x - this.value)), + index = diff.indexOf(Math.min(...diff)), + val = this.steps[index] + + if (!isNaN(val)) this.value = clip(val, [this.rangeValsMin,this.rangeValsMax]) + + } + + if (!options.dragged) this.percent = this.valueToPercent(this.value) + + this.batchDraw() + + this.showValue() + + if (options.send) this.sendValue() + if (options.sync) this.changed(options) + + } + + showValue() { + + if (this.getProp('input')) this.input.setValue(this.value) + + } + + setSteps() { + + if (this.getProp('steps')) { + var steps = this.getProp('steps') + this.steps = Array.isArray(steps) ? + steps : typeof steps === 'number' ? + Array(steps).fill(0).map((x, i) => i / (steps - 1) * (this.rangeValsMax - this.rangeValsMin) + this.rangeValsMin) + : this.rangeVals + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + if (this.input) this.input.onPropChanged('color') + return + case 'steps': + this.setSteps() + return + + } + + } + + onRemove() { + if (this.input) this.input.onRemove() + super.onRemove() + } + +} + +Slider.dynamicProps = Slider.prototype.constructor.dynamicProps + .filter(n => n !== 'precision') + .concat([ + 'steps', + 'spring', + 'sensitivity', + 'default', + ]) + +module.exports = Slider diff --git a/src/client/app/widgets/switchers/_switchers_base.js b/src/client/app/widgets/switchers/_switchers_base.js new file mode 100644 index 00000000..e5563715 --- /dev/null +++ b/src/client/app/widgets/switchers/_switchers_base.js @@ -0,0 +1,115 @@ +var Widget = require('../common/widget'), + widgetManager = require('../../managers/widgets'), + osc = require('../../osc') + +module.exports = class _switchers_base extends Widget { + + constructor(options) { + + super(options) + + this._isSwitcher = true + this.value = {_selected:false} + this.linkedWidgets = typeof this.getProp('linkedWidgets') == 'object' ? this.getProp('linkedWidgets') : [this.getProp('linkedWidgets')] + + for (var i in this.getProp('values')) { + + this.value[this.getProp('values')[i]] = {} + + } + + widgetManager.on('change', this.syncHandler.bind(this), {context: this}) + + + } + + syncHandler(e) { + + var {id, widget} = e + + if (widget && this.value._selected !== false && this.value[this.value._selected] && widget._isSwitcher !== true && this.isWatching(id, widget)) { + + this.value[this.value._selected][id] = widget.getValue() + + } + + } + + isWatching(id, widget) { + + if (this.linkedWidgets.indexOf(id) != -1) return true + + for (var k in this.linkedWidgets) { + + let widgets = widgetManager.getWidgetById(this.linkedWidgets[k]) + + for (var i in widgets) { + + if (widgets[i].contains(widget) || widgets[i] === widget) return true + + } + + } + } + + setValue(v, options={}) { + + let apply = false + + if (typeof v == 'object') { + + for (var k in this.value) { + + if (v.hasOwnProperty(k)) { + + this.value[k] = v[k] + apply = true + + } + + } + + + } else if (this.value[v] && v != '_selected') { + + this.value._selected = v + apply = true + + } + + if (apply) this.applyState(this.value[this.value._selected], options) + + } + + + applyState(state, options) { + + // extra sync routine to ensure linked widgets' props update before osc is sent + if (options.sync) this.changed({...options, send:false, sync:false}) + // + + for (var id in state) { + var value = state[id], + widgets = widgetManager.getWidgetById(id) + for (var i = widgets.length - 1; i >= 0; i--) { + if (widgets[i].setValue) { + widgets[i].setValue(value,{sync:options.sync, send:options.send}) + } + } + } + + if (options.sync) this.changed(options) + if (options.send) this.sendValue() + + } + + sendValue() { + + osc.sync({ + h:this.hash, + v:this.value + }) + + } + +} diff --git a/src/client/app/widgets/switchers/crossfader.js b/src/client/app/widgets/switchers/crossfader.js new file mode 100644 index 00000000..07d32305 --- /dev/null +++ b/src/client/app/widgets/switchers/crossfader.js @@ -0,0 +1,158 @@ +var Switcher = require('./switcher'), + Widget = require('../common/widget'), + Fader = require('../sliders/fader'), + {mapToScale} = require('../utils') + +var faderDefaults = Fader.defaults()._props() + + +module.exports = class Crossfader extends Switcher { + + static description() { + + return 'Switcher with linear interpolation slider.' + + } + + static defaults(){ + + return Widget.defaults({ + + _crossfader: 'crossfader', + + linkedWidgets: {type: 'string|array', value: '', help: [ + '- `String`: a widget\'s `id` whose state changes will be stored', + '- `Array`: a list of widget `id` string' + ]}, + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'} + + }) + + } + + constructor(options) { + + options.props.values = options.props.horizontal ? ['A', 'B'] : ['B', 'A'] + + super(options) + + this.fader = new Fader({props:{ + ...faderDefaults, + horizontal: this.getProp('horizontal'), + range: {min:{'A':0}, '50%':{' ':0.5},max:{'B':1}}, + input: false + }, parent: this}) + + this.fader.sendValue = ()=>{} + + this.widget.appendChild(this.fader.widget) + + if (this.getProp('horizontal')) { + this.widget.classList.add('horizontal') + } else { + this.widget.classList.add('vertical') + + } + + this.fader.on('change', (e)=>{ + + e.stopPropagation = true + + this.setValue(this.fader.getValue(), e.options) + + }) + + this.value._fader = 0 + + } + + setValue(v, options={}) { + + v = v <= 0 || v == 'A' ? + 'A' : + v >= 1 || v == 'B' ? + 'B' : + v + + super.setValue(v, options) + + if (typeof v == 'object') { + + this.fader.setValue(this.value._fader, {dragged:options.dragged}) + + } + + if (v == 'A') { + + this.fader.setValue(0, {dragged:options.dragged}) + this.value._fader = 0 + + + } else if (v == 'B') { + + this.fader.setValue(1, {dragged:options.dragged}) + this.value._fader = 1 + + + } else if (!isNaN(v)) { + + this.fader.setValue(v, {dragged:options.dragged}) + this.value._fader = this.fader.getValue() + this.value._selected = false + this.switch.setValue() + + var s = this.getValue(), + a = {} + + for (var i in s['A']) { + + if (s['B'][i] === undefined) continue + + if (Array.isArray(s['A'][i])) { + + a[i] = [] + + for (var k in s['A'][i]) { + + if (!isNaN(s['A'][i][k])) { + + a[i][k] = mapToScale(v, [0,1], [s['A'][i][k], s['B'][i][k]], false) + + } + + } + + } else if (!isNaN(s['A'][i])) { + + a[i] = mapToScale(v, [0,1], [s['A'][i], s['B'][i]], false) + } + } + + this.applyState(a, options) + + } + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of [this.fader]) { + w.onPropChanged('color') + } + return + + } + + } + + onRemove() { + this.fader.onRemove() + super.onRemove() + } + +} diff --git a/src/client/app/widgets/switchers/state.js b/src/client/app/widgets/switchers/state.js new file mode 100644 index 00000000..1afabf58 --- /dev/null +++ b/src/client/app/widgets/switchers/state.js @@ -0,0 +1,161 @@ +var Widget = require('../common/widget'), + Push = require('../buttons/push'), + pushDefaults = Push.defaults()._props(), + html = require('nanohtml'), + stateManager = require('../../managers/state'), + widgetManager = require('../../managers/widgets'), + {deepCopy} = require('../../utils'), + osc = require('../../osc') + + +class State extends Widget { + + static description() { + + return 'Save and recall the state of other widgets.' + + } + + static defaults() { + + return super.defaults({ + + _state: 'state', + + filter: {type: 'string|array', value: '', help: [ + 'Only save state from widgets contained in widgets designated by id. If empty, the whole session\'s state is saved. Switchers are always ignored.', + '- widget id `string`', + '- `array` of widget id strings' + ]}, + saveLabel: {type: 'string', value: 'Save', help: 'Label for save button'}, + loadLabel: {type: 'string', value: 'Load', help: 'Label for load button'}, + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display buttons horizontally'}, + + }, [], { + + value: {type: 'object|string', value: '', help: [ + '- `object`: `"widget_id": VALUE` pairs', + '- `string`: `"save"` (trigger save action), `"load"` (trigger load action) or `""` (reset value)', + '', + 'Note: the widget\'s actual value is never `"save"` or `"load"`, it\'s either an empty string or an object.' + ]} + + }) + + } + + + constructor(options) { + + super({...options, html: html`
      `}) + + this._isSwitcher = true + + if (this.getProp('horizontal')) this.widget.classList.add('horizontal') + + this.saveButton = new Push({props: {...pushDefaults, type: 'push', label: this.getProp('saveLabel')}, parent: this, container: true}) + this.loadButton = new Push({props: {...pushDefaults, type: 'push', label: this.getProp('loadLabel')}, parent: this, container: true}) + + this.saveButton.container.classList.add('not-editable', 'value') + this.loadButton.container.classList.add('not-editable', 'value', 'disabled') + + this.saveButton.sendValue = this.loadButton.sendValue = ()=>{} + + this.widget.appendChild(this.saveButton.container) + this.widget.appendChild(this.loadButton.container) + + this.on('change', (e)=>{ + + var {widget} = e + if (widget === this) return + + e.stopPropagation = true + + if (widget.active) this.setValue(widget === this.saveButton ? 'save' : 'load', {sync: true, send: true}) + + }) + + this.filter = this.getProp('filter') ? Array.isArray(this.getProp('filter')) ? this.getProp('filter') : [this.getProp('filter')] : false + this.value = '' + + } + + save() { + + var filter = (widget)=>{ + return !widget._isSwitcher + } + + if (this.filter) { + var containers = this.filter.map(x=>widgetManager.getWidgetById(x)).reduce((a,b)=>a.concat(b), []) + if (!containers.length) return + filter = (widget)=>{ + return !widget._isSwitcher && containers.some(x=>x.contains(widget) || x === widget) + } + } + + if (!this.value) this.loadButton.container.classList.remove('disabled') + + this.value = deepCopy(stateManager.get(filter)) + + } + + load(send) { + + if (this.value) stateManager.set(this.value, send) + + } + + setValue(v,options={}) { + + var valid + + if (v === 'save') { + + this.save() + valid = true + + } else if (v === 'load') { + + this.load(options.send) + valid = true + + } else if (v === '') { + + if (this.value) this.loadButton.container.classList.add('disabled') + this.value = '' + + } else if (typeof v === 'object' && !Array.isArray(v)) { + + if (!this.value) this.loadButton.container.classList.remove('disabled') + this.value = v + valid = true + + } + + if (valid) { + if (options.sync) this.changed(options) + if (options.send) this.sendValue() + } + + } + + sendValue() { + + osc.sync({ + h:this.hash, + v:this.value + }) + + } + + onRemove() { + + this.saveButton.onRemove() + this.loadButton.onRemove() + super.onRemove() + + } +} + +module.exports = State diff --git a/src/client/app/widgets/switchers/switcher.js b/src/client/app/widgets/switchers/switcher.js new file mode 100644 index 00000000..80dd88ff --- /dev/null +++ b/src/client/app/widgets/switchers/switcher.js @@ -0,0 +1,94 @@ +var _switchers_base = require('./_switchers_base'), + Switch = require('../buttons/switch'), + html = require('nanohtml') + +var switchDefaults = Switch.defaults()._props() + +module.exports = class Switcher extends _switchers_base { + + static description() { + + return 'Store other widgets\' values and recall them.' + + } + + static defaults() { + + return super.defaults({ + + _switcher: 'switcher', + + linkedWidgets: {type: 'string|array', value: '', help: [ + '- `String`: a widget\'s `id` whose state changes will be stored', + '- `Array`: a list of widget `id` string' + ]}, + horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'}, + values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [ + 'Each item represents a bank that stores the values from the widgets listed in `linkedWidgets`', + '- `Array` of possible values to switch between : `[1,2,3]`', + '- `Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', + ]} + }) + + } + + constructor(options) { + + super({...options, html: html`
      `}) + + if (this.getProp('horizontal')) this.widget.classList.add('horizontal') + + this.switch = new Switch({props:{ + ...switchDefaults, + label:false, + values:this.getProp('values'), + value: this.getProp('value'), + horizontal:this.getProp('horizontal') + }, parent: this}) + + this.switch.sendValue = ()=>{} + + this.widget.appendChild(this.switch.widget) + + this.switch.on('change', (e)=>{ + + e.stopPropagation = true + e.options.fromSelf = true + + this.setValue(this.switch.getValue(), e.options) + + }) + + + } + + setValue(v, options={}) { + + super.setValue(v, options) + + if (!options.fromSelf) this.switch.setValue(this.value._selected) + + } + + onPropChanged(propName, options, oldPropValue) { + + if (super.onPropChanged(...arguments)) return true + + switch (propName) { + + case 'color': + for (var w of [this.switch]) { + w.onPropChanged('color') + } + return + + } + + } + + onRemove() { + this.switch.onRemove() + super.onRemove() + } + +} diff --git a/src/client/app/widgets/utils.js b/src/client/app/widgets/utils.js new file mode 100644 index 00000000..b77203b6 --- /dev/null +++ b/src/client/app/widgets/utils.js @@ -0,0 +1,251 @@ +var {deepCopy} = require('../utils') + +module.exports = { + + clip: function(value,range) { + + value = parseFloat(value) + + if (isNaN(value)) value = range[0] + return Math.max(Math.min(range[0],range[1]),Math.min(value,Math.max(range[0],range[1]))) + + }, + + // map a value from a scale to another input and output must be range arrays + mapToScale: function(value,rangeIn,rangeOut,precision,log,revertlog) { + + // clip in + value = module.exports.clip(value,[rangeIn[0],rangeIn[1]]) + + // normalize + value = (value - rangeIn[0]) / (rangeIn[1] - rangeIn[0]) + + // log scale + if (log) { + if (log === true) log = 10 + value = revertlog ? + Math.pow(log, value) / (log - 1) - 1 / (log - 1) : + Math.log(value * (log - 1) + 1) / Math.log(log) + } + + // scale out + value = value * (rangeOut[1] - rangeOut[0]) + rangeOut[0] + + // clip out + value = module.exports.clip(value,[rangeOut[0],rangeOut[1]]) + + // precision + if (precision !== false) value = parseFloat(value.toFixed(precision)) + + return value + + }, + + hsbToRgb: function(hsb) { + var rgb = {} + var h = hsb.h + var s = hsb.s*255/100 + var v = hsb.b*255/100 + if(s == 0) { + rgb.r = rgb.g = rgb.b = v + } else { + var t1 = v + var t2 = (255-s)*v/255 + var t3 = (t1-t2)*(h%60)/60 + if(h==360) h = 0 + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return rgb + }, + + rgbToHsb: function(rgb) { + var hsb = {h: 0, s: 0, b: 0} + var min = Math.min(rgb.r, rgb.g, rgb.b) + var max = Math.max(rgb.r, rgb.g, rgb.b) + var delta = max - min + hsb.b = max + hsb.s = max != 0 ? 255 * delta / max : 0 + if (hsb.s != 0) { + if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta + else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta + else hsb.h = 4 + (rgb.r - rgb.g) / delta + } else hsb.h = 0 + hsb.h *= 60 + if (hsb.h < 0) hsb.h += 360 + hsb.s *= 100/255 + hsb.b *= 100/255 + return hsb + }, + + urlParser: (()=>{ + + var parser = document.createElement('a'), + localUrlRe = /(^127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.1[6-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.2[0-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.3[0-1]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^192\.168\.[0-9]{1,3}\.[0-9]{1,3}$)/ + + parser.isLocal = ()=>{ + return parser.hostname.match(localUrlRe) + } + + return (url)=>{ + parser.href = url + return parser + } + + })(), + + math: (()=>{ + var math = require('mathjs/dist/math.min.js').create({ + matrix: 'Array' + }) + math.import({ + unpack: function(a) { return Array.isArray(a) ? a.toString() : a }, + indexOf: function(a, x) { return a.indexOf(x) }, + pad: function(x, padding) { + var str = String(x), + [int, dec] = str.split('.') + while (int.length < padding) { + int = '0' + int + } + return dec ? int + '.' + dec : int + }, + length: function(x) { return x.length }, + values: function(x) { return Object.values(x) }, + keys: function(x) { return Object.keys(x) }, + extend: function(x, y) { return Object.assign(x, y) }, + timestamp: function() { return Date.now() }, + // basic relationnal to keep alphabetical string comparison (v4 change) + equal: function(a, b) { return a == b }, + unequal: function(a, b) { return a != b }, + smaller: function(a, b) { return a < b }, + larger: function(a, b) { return a > b }, + smallerEq: function(a, b) { return a <= b }, + largerEq: function(a, b) { return a >= b } + }, {override:true}) + + // set math's parser array index base to zero + math.expression.mathWithTransform = Object.assign({}, math) + + return math + })(), + + evaljs: (function(){ + + var sandbox = document.createElement('iframe'), + loopProtect = require('loop-protect') + + sandbox.style.display = 'none' + sandbox.sandbox = 'allow-same-origin' + document.documentElement.appendChild(sandbox) + + // block requests + sandbox.contentWindow.document.open() + sandbox.contentWindow.document.write('') + sandbox.contentWindow.document.close() + + // init infinite loop guard + loopProtect.alias = '__protect' + loopProtect.hit = function(line){ + throw 'Potential infinite loop found on line ' + line + } + sandbox.contentWindow.__protect = loopProtect + + + var _Function = sandbox.contentWindow.Function, + parsers = {} + + sandbox.contentWindow.console = console + sandbox.contentWindow.setTimeout = + sandbox.contentWindow.setInterval = ()=>{ + throw 'setTimeout and setInterval can\'t be used in formulas' + } + sandbox.contentWindow.global = {} + + function nuke(o) { + // non-primitives created outside the sandbox context can leak + // the host window object... let's nuke that ! + // (we only nuke function and objects/arrays because we don't pass anything else) + var t = typeof o + if (t === 'function' || (t === 'object' && o !== null)) { + if (o.__proto__) { + if (t === 'function') { + o.__proto__.constructor = _Function + } else { + o.__proto__.constructor.constructor = _Function + } + } + for (var k in o) { + nuke(o[k]) + } + } + } + + for (var imports of ['__protect', 'console', 'setTimeout', 'setInterval', 'global']) { + nuke(sandbox.contentWindow[imports]) + } + + document.documentElement.removeChild(sandbox) + + function evaljs(code, defaultContext) { + + var contextInit = '', + contextKeys = ['__VARS'], + contextValues = [{}] + + if (defaultContext) { + for (var k in defaultContext) { + contextInit += `var ${k} = ${k} || ${JSON.stringify(defaultContext[k])};` + contextKeys.push(k) + contextValues.push(defaultContext[k]) + } + } + + parsers[code] = new _Function( + ...contextKeys, + loopProtect('"use strict";' + contextInit + code) + .replace(/;\n(if \(__protect.*break;)\n/g, ';$1') // prevent loop protect from breaking stack linenumber + .replace(/(VAR_[0-9]+)/g, '__VARS.$1') + ) + + return (context)=>{ + + var ret, err, k + + var __contextValues = deepCopy(contextValues) + var __VARS = __contextValues[0] + for (k in context) { + var index = contextKeys.indexOf(k) + if (index !== -1) { + __contextValues[index] = context[k] + } else { + __VARS[k] = context[k] + } + } + + nuke(contextValues) + + // evaluate + try { + ret = parsers[code].apply(null, __contextValues) + } catch(e) { + err = e + } + + if (err) throw err + + return ret + + } + + } + + return evaljs + + })() + +} diff --git a/src/client/backup.mjs b/src/client/backup.mjs deleted file mode 100644 index 8e1cef83..00000000 --- a/src/client/backup.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import cache from './managers/cache.mjs' - -var session, state, editor, ipc -;(async()=>{ - session = (await import('./managers/session/index.mjs')).default - state = (await import('./managers/state.mjs')).default - editor = (await import('./editor/index.mjs')).default - ipc = (await import('./ipc/index.mjs')).default -})() - -var localBackup = cache.get('backup', false) - - -export const exists = localBackup !== null - -export function save() { - - if (session.session) { - cache.set('backup', { - session: session.session.data, - saveMode: session.saveMode, - sessionPath: session.sessionPath, - fragments: session.fragments, - state: state.get(), - history: editor.history, - historyState: editor.historyState, - editorEnabled: editor.enabled, - }, false) - } - -} - -export function load() { - - if (localBackup) { - - var data = localBackup - - cache.remove('backup', false) - for (let k in data.fragments) { - session.setFragment({path: k, fileContent: data.fragments[k]}) - } - session.load(data.session, ()=>{ - - session.setSaveMode(data.saveMode) - state.set(data.state, false) - - editor.clearHistory() - editor.history = data.history - editor.historyState = data.historyState - - if (data.editorEnabled) editor.enable() - - - ipc.send('sessionSetPath', {path: data.sessionPath}) - session.setSessionPath(data.sessionPath) - - }) - - } - -} diff --git a/src/client/dom.mjs b/src/client/dom.mjs deleted file mode 100644 index 798802b6..00000000 --- a/src/client/dom.mjs +++ /dev/null @@ -1,82 +0,0 @@ -export function dispatchEvent(element, name, data) { - - var event = new CustomEvent(name, { - detail: data, - bubbles: true, - cancelable: true - }) - - element.dispatchEvent(event) - -} - -export function addEventListener(element, events, listener, capture) { - - var eventsAsObject = typeof events == 'string' ? events.split(' ') : events - - for (var i in eventsAsObject) { - - element.addEventListener(eventsAsObject[i], listener, capture) - - } - -} - -export function get(a, b) { - - var context = b ? a : document, - selector = b || a, - nodes - - if (selector.indexOf('>') === 0) selector = ':scope ' + selector - - if (selector.indexOf(' ') === -1 && selector.indexOf(',') === -1 && selector.indexOf('[') === -1) { - if (selector.indexOf('#') === 0 && context === document) { - nodes = [document.getElementById(selector.substr(1, selector.length - 1))] - } else if (selector.lastIndexOf('.') === 0) { - nodes = context.getElementsByClassName(selector.substr(1, selector.length - 1)) - } - } - - if (!nodes) nodes = context.querySelectorAll(selector) - - return [...nodes] - -} - -export function each(context, selector, callback) { - - var nodes = get(context, selector) - - nodes.forEach(callback) - - return nodes - -} - -export function index(element) { - var parent = element.parentNode - return parent ? Array.prototype.indexOf.call(parent.children, element) : -1 -} - -export function offset(element, container) { - - var offsetLeft = 0, - offsetTop = 0 - - if (element) { - do { - if (!isNaN(element.offsetLeft)) { - offsetLeft += element.offsetLeft - element.scrollLeft - } - if (!isNaN(element.offsetTop)) { - offsetTop += element.offsetTop - element.scrollTop - } - } while ((element = element.offsetParent) && element !== container) - } - - return { - left: offsetLeft, - top: offsetTop - } -} diff --git a/src/client/editor/context-menu.mjs b/src/client/editor/context-menu.mjs deleted file mode 100644 index a13fbf26..00000000 --- a/src/client/editor/context-menu.mjs +++ /dev/null @@ -1,364 +0,0 @@ -import {updateWidget} from './data-workers.mjs' -import {categories} from '../widgets/index.mjs' -import widgetManager from '../managers/widgets.mjs' -import {icon} from '../ui/utils.mjs' -import editor from './index.mjs' -import locales from '../locales/index.mjs' -import ContextMenu from '../ui/context-menu.mjs' -import {GRIDWIDTH, PXSCALE} from '../globals.mjs' - -var sessionManager -;(async()=>{ - sessionManager = (await import('../managers/session/index.mjs')).default -})() - - -var contextMenu = new ContextMenu() - -var multiSelectKey = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey' - -var handleClick = function(event) { - - if ( - !editor.enabled || - event.detail.button === 1 || - (event.detail.metaKey && event.detail.shiftKey) - ) return - - if (!event.detail[multiSelectKey] && event.type !== 'fast-right-click' && ( - event.target.classList.contains('no-widget-select') || - event.target.id === 'open-toggle' - )) { return } - - var eventData = event.detail, - targetWidget = widgetManager.getWidgetByElement(eventData.target, ':not(.not-editable)') - - if (!targetWidget) return - - while (targetWidget.meta.not_editable && targetWidget.parent) { - targetWidget = targetWidget.parent - } - - // if the widget is not already selected - if (!targetWidget.container.classList.contains('editing') || event.detail.ctrlKey || event.detail.shiftKey) { - // add a flag to the original event to prevent draginit - // and prevent any further fast-click (ie input focus) - eventData.capturedByEditor = true - event.capturedByEditor = true - } - - - if (editor.inspector.focusedInput) { - editor.inspector.onChange() - editor.inspector.focusedInput = null - if (!document.body.contains(eventData.target)) return - } - - if (event.type !== 'fast-right-click') { - - if (targetWidget.getProp('type') === 'tab') { - targetWidget.parent.setValue(targetWidget.parent.children.indexOf(targetWidget), {sync: true, send: true}) - } - - if ( - event.target.tagName === 'LI' && // Project tree - event.detail.shiftKey && - editor.selectedWidgets.length > 0 && - targetWidget.parent === editor.selectedWidgets[0].parent - ) { - var siblings = targetWidget.parent.children, - from = siblings.indexOf(editor.selectedWidgets[0]), - to = siblings.indexOf(targetWidget), - range = siblings.slice(Math.min(from, to), Math.max(from, to) + 1).filter(w=>!editor.selectedWidgets.includes(w)) - - targetWidget = editor.selectedWidgets.concat(range) - } - - editor.select(targetWidget, {multi: event.detail[multiSelectKey]}) - - } - - // right-click menu - if (event.type !== 'fast-right-click') return - - if (!event.detail.shiftKey && !event.detail[multiSelectKey] && editor.selectedWidgets.length <= 1) { - if (editor.inspector.focusedInput) editor.inspector.onChange() - editor.select(targetWidget) - } - - if (!editor.selectedWidgets.length) return - - var data = editor.selectedWidgets.map((w)=>w.props), - widget = editor.selectedWidgets[0], - parent = widget.parent, - actions = [] - - var clickX = Math.round((eventData.offsetX + eventData.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH, - clickY = Math.round((eventData.offsetY + eventData.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH - - if (parent !== widgetManager) { - - if (event.target.tagName !== 'LI') { // not Project tree - actions.push({ - label: icon('project-diagram') + ' ' + locales('editor_show_in_tree'), - action: ()=>{ - editor.widgetTree.showWidget(editor.selectedWidgets[0]) - editor.widgetTree.blinkSelected() - }, - shortcut: 't' - }) - - } else { - - actions.push({ - label: icon('eye') + ' ' + locales('editor_show_in_session'), - action: ()=>{ - for (let w of editor.selectedWidgets) { - editor.widgetTree.showWidgetInSession(w) - } - }, - shortcut: 'y' - }) - - } - - actions.push({ - separator: true - }) - - actions.push({ - label: icon('copy') + ' ' + locales('editor_copy'), - action: editor.copyWidget.bind(editor), - shortcut: 'mod + c' - }) - - actions.push({ - label: icon('cut') + ' ' + locales('editor_cut'), - action: editor.cutWidget.bind(editor), - shortcut: 'mod + x' - }) - - } - - if (widget.childrenType !== undefined) { - - if (editor.clipboard !== null) { - - var pasteActions = [], - canPaste = true - - if ( - editor.clipboard[0].type === 'tab' && widget.childrenType === 'widget' || - editor.clipboard[0].type !== 'tab' && widget.childrenType === 'tab' - ) canPaste = false - - if (canPaste) { - - pasteActions.push({ - label: icon('paste') + ' ' + locales('editor_paste'), - action: ()=>{ - editor.pasteWidget(clickX, clickY) - }, - shortcut: 'mod + v' - }) - pasteActions.push({ - label: icon('plus-square') + ' ' + locales('editor_pasteindent'), - action: ()=>{ - editor.pasteWidget(clickX, clickY, true) - }, - shortcut: 'mod + shift + v' - - }) - - if (editor.idClipboard && widgetManager.getWidgetById(editor.idClipboard).length && editor.clipboard[0].type !== 'tab') { - pasteActions.push({ - label: icon('clone') + ' ' + locales('editor_clone'), - action: ()=>{ - editor.pasteWidgetAsClone(clickX, clickY) - } - }) - } - - } - - actions.push({ - label: icon('paste') + ' ' + locales('editor_paste'), - action: pasteActions, - class: canPaste ? '' : 'disabled' - }) - - } - - } - - if (parent !== widgetManager && editor.selectedWidgets.length === 1 && editor.selectedWidgets[0].parent.children.length > 1) { - actions.push({ - separator: true - }) - actions.push({ - label: icon('layer-group') + ' Position', - action: [ - { - label: locales('editor_back'), - action: ()=>{ - editor.handleKeydown('home') - }, - shortcut: 'Home' - }, - { - label: locales('editor_farther'), - action: ()=>{ - editor.handleKeydown('pageup') - }, - shortcut: 'Page Up' - }, - { - label: locales('editor_closer'), - action: ()=>{ - editor.handleKeydown('pagedown') - }, - shortcut: 'Page Down' - }, - { - label: locales('editor_front'), - action: ()=>{ - editor.handleKeydown('end') - }, - shortcut: 'End' - } - ] - }) - - } - - if (widget.childrenType !== undefined) { - - var addActions = [] - - for (let category in categories) { - - var catActions = [] - - for (let t in categories[category]) { - - let type = categories[category][t] - - catActions.push({ - - label: type, - action: ()=>{ - - var newData = {type: type} - - if (!eventData.target.classList.contains('tablink')) { - newData.top = clickY - newData.left= clickX - } - - if (editor.usePercents) { - newData.top = (100 * clickY / editor.selectedWidgets[0].widget.offsetHeight).toFixed(2) + '%' - newData.left= (100 * clickX / editor.selectedWidgets[0].widget.offsetWidth).toFixed(2) + '%' - newData.height= '6%' - newData.width = '8%' - } - - data[0].widgets = data[0].widgets || [] - data[0].widgets.push(newData) - - var indexes = {addedIndexes: [data[0].widgets.length -1]} - - updateWidget(editor.selectedWidgets[0], indexes) - editor.pushHistory(indexes) - - var newWidget = editor.selectedWidgets[0].children[editor.selectedWidgets[0].children.length - 1] - editor.select([newWidget]) - if (!editor.widgetTree.parent.minimized) editor.widgetTree.showWidget(newWidget) - - - } - }) - - } - - addActions.push({ - label: category, - action: catActions - }) - - } - - if (data.length == 1 && widget.childrenType !== undefined) { - if (actions.length) actions.push({ - separator: true - }) - } - - if (data.length == 1 && widget.childrenType !== 'tab') { - actions.push({ - label: icon('plus') + ' ' + locales('editor_addwidget'), - action: addActions - }) - } - - if (data.length == 1 && widget.childrenType !== 'widget') { - - actions.push({ - label: icon('plus') + ' ' + locales('editor_addtab'), - action: ()=>{ - data[0].tabs = data[0].tabs || [] - data[0].tabs.push({}) - - var indexes = {addedIndexes: [data[0].tabs.length -1]} - - updateWidget(editor.selectedWidgets[0], indexes) - editor.pushHistory(indexes) - - var newWidget = editor.selectedWidgets[0].children[editor.selectedWidgets[0].children.length - 1] - - editor.select([newWidget]) - if (!editor.widgetTree.parent.minimized) editor.widgetTree.showWidget(newWidget) - newWidget.parent.setValue(newWidget.parent.children.indexOf(newWidget)) - - - } - }) - - } - - } - - - if (parent !== widgetManager && data.length === 1) { - - actions.push({ - separator: true - }) - - actions.push({ - label: icon('file-download') + ' ' + locales('editor_fragment_export'), - action: ()=>{ - sessionManager.saveFragment(editor.selectedWidgets[0].props) - } - }) - } - - if (parent !== widgetManager) { - - actions.push({ - separator: true - }) - - actions.push({ - label: icon('trash') + ' ' + locales('editor_delete'), - action: editor.deleteWidget.bind(editor), - shortcut: 'delete' - }) - - } - - contextMenu.open(eventData, actions) - -} - -document.body.addEventListener('fast-right-click', handleClick, true) -document.body.addEventListener('fast-click', handleClick, true) diff --git a/src/client/editor/diff.mjs b/src/client/editor/diff.mjs deleted file mode 100644 index 1d3bd083..00000000 --- a/src/client/editor/diff.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import diff from 'jsondiffpatch' - -export {diff} -export function diffToWidget(widget, diff) { - - // traverse a diff patch and the associated widget - // to return the first node (widget and sub-patch) with actual changes - - var children = diff.tabs || diff.widgets - - if (children) { - var childrenKeys = Object.keys(children), - deletedChildren = childrenKeys.filter(x => typeof x === 'string' && x.match(/_[0-9]+/)), - changedChildren = childrenKeys.filter(x => !isNaN(x)) - } - - if ( - !children || - Array.isArray(children) || // 'tabs' or 'widgets' property created - deletedChildren.length || // 'tabs' or 'widgets' property created - changedChildren.length !== 1 || // children reordered (or same property edited in multiple widgets, but case ignored) - Array.isArray(children[changedChildren[0]]) // child item created - ) { - return [widget, diff] - } - - return diffToWidget(widget.children[changedChildren[0]], children[changedChildren[0]]) - -} diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs deleted file mode 100644 index d7e262f2..00000000 --- a/src/client/editor/index.mjs +++ /dev/null @@ -1,1136 +0,0 @@ -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import {updateWidget, incrementWidget} from './data-workers.mjs' -import {diff, diffToWidget} from './diff.mjs' -import widgetManager from '../managers/widgets.mjs' -import {deepCopy} from '../utils.mjs' -import {defaults, widgets} from '../widgets/index.mjs' -import UiSelectArea from '../ui/ui-selectarea.mjs' -import UiInspector from '../ui/ui-inspector.mjs' -import UiTree from '../ui/ui-tree.mjs' -import UiDragResize from '../ui/ui-dragresize.mjs' -import uiConsole from '../ui/ui-console.mjs' -import notifications from '../ui/notifications.mjs' -import locales from '../locales/index.mjs' -import {leftUiSidePanel, rightUiSidePanel} from '../ui/index.mjs' -import ipc from '../ipc/index.mjs' -import {DOM, GRIDWIDTH, GRIDWIDTH_CSS, ENV, PXSCALE, setGRIDWIDTH, READ_ONLY} from '../globals.mjs' -import zoom from '../ui/zoom.mjs' - -var sessionManager -;(async()=>{ - sessionManager = (await import('../managers/session/index.mjs')).default - await import('./context-menu.mjs') -})() - -const macOs = (navigator.platform || '').match('Mac') -const HISTORY_SIZE = 50 - -class Editor { - - constructor() { - - zoom.editor = this - - this.inspector = new UiInspector({selector: '#osc-inspector'}) - this.inspector.on('update', (event)=>{ - - var {propName, value, preventHistory} = event, - newWidgets = [], - error = false - - if (this.selectedWidgets.some(w=>w.getProp('lock')) && propName !== 'lock') { - this.select(this.selectedWidgets) - return - } - - for (var w of this.selectedWidgets) { - - let previousValue = w.props[propName] - - if ((propName === 'label' || propName === 'popupLabel') && value === true) { - w.props[propName] = 'auto' - } else { - w.props[propName] = value !== '' ? value : deepCopy(defaults[w.props.type]._props()[propName]) - } - - try { - - newWidgets.push(updateWidget(w, {editedProps: [propName], preventSelect: this.selectedWidgets.length > 1})) - - } catch (e) { - - w.props[propName] = previousValue - updateWidget(w, {editedProps: [propName], preventSelect: this.selectedWidgets.length > 1}) - - if (uiConsole.minimized) notifications.add({ - class: 'error', - message: locales('inspector_error'), - duration: 7000 - }) - console.error( - `Error while setting ${propName} to: ${JSON.stringify(value)}.\n` + - 'It\'s probably a bug, please open a new bug ticket with the following informations at' + - 'https://github.com/jean-emmanuel/open-stage-control/issues' - ) - throw e - // console.error(e) - // error = true - } - } - - if (error) return - - if (!preventHistory) this.pushHistory() - - if (newWidgets.length > 1) this.select(newWidgets) - - }) - - - this.widgetTree = new UiTree({selector: '#osc-tree', parent: leftUiSidePanel}) - this.widgetTree.on('sorted', (event)=>{ - - var {oldIndex, newIndex, from, to} = event, - propName = from.childrenType + 's', - container - - if (from === to) { - - if (to.props[propName].length < 2) return - - to.props[propName].splice(newIndex, 0, to.props[propName].splice(oldIndex, 1)[0]) - - var indices = [newIndex, oldIndex] - if (Math.abs(oldIndex - newIndex) > 1) { - for (var i = Math.min(newIndex, oldIndex) + 1; i < Math.max(newIndex, oldIndex); i++) { - indices.push(i) - } - } - - container = updateWidget(to, {removedIndexes: indices, addedIndexes: indices, preventSelect: true}) - - this.pushHistory({removedIndexes: indices, addedIndexes: indices}) - this.select(container.children[newIndex]) - - } else { - - to.props[propName].splice(newIndex, 0, from.props[propName][oldIndex]) - from.props[propName].splice(oldIndex, 1) - - updateWidget(from, {removedIndexes: [oldIndex], preventSelect: true}) - container = updateWidget(to, {addedIndexes: [newIndex], preventSelect: true}) - - this.pushHistory() - this.select(container.children[newIndex]) - - } - - if (!event.ignoreTree) this.widgetTree.showWidget(container.children[newIndex]) - - - }) - - this.oscContainer = DOM.get('#osc-container')[0] - - - - this.widgetDragResize = new UiDragResize({}) - this.widgetDragResize.on('move', (e)=>{ - var left = Math.round(e.left / GRIDWIDTH) * GRIDWIDTH, - top = Math.round(e.top / GRIDWIDTH) * GRIDWIDTH - - if (e.copying) { - this.duplicateWidget(left, top, e.shiftKey) - } else { - var dX = left - e.initLeft, - dY = top - e.initTop - this.moveWidget(dX, dY) - } - }) - this.widgetDragResize.on('drag-resize', (e)=>{ - var width = Math.round(e.width / GRIDWIDTH) * GRIDWIDTH, - height = Math.round(e.height / GRIDWIDTH) * GRIDWIDTH - var dX = width - e.initWidth, - dY = height - e.initHeight - this.resizeWidget(dX, dY) - }) - - this.selectedWidgets = [] - - this.clipboard = null - this.tmpClipboard = null - this.idClipboard = null - ipc.on('clipboard', (data)=>{ - this.clipboard = data.clipboard - this.idClipboard = data.idClipboard - }) - - this.usePercents = !!ENV.usepercents - - this.enabled = false - this.grid = true - - this.unsavedSession = false - window.onbeforeunload = ()=>{ - if (editor.unsavedSession) return true - } - - this.history = [] - this.historyState = -1 - this.historySession = null - - this.mousePosition = {} - this.mouveMoveHandler = this.mouseMove.bind(this) - this.mouveLeaveHandler = this.mouseLeave.bind(this) - - keyboardJS.withContext('editing', ()=>{ - - var combos = [ - 'mod + z', - 'mod + y', - 'mod + shift + z', - 'mod + c', - 'mod + x', - 'mod + v', - 'mod + shift + v', - 'mod + d', - 'mod + shift + d', - macOs ? 'backspace' : 'delete', - 'alt + up', - 'alt + down', - 'alt + right', - 'alt + left', - 'up', - 'down', - 'right', - 'left', - 'mod + shift + a', - 'mod + a', - 'mod + up', - 'mod + down', - 'mod + left', - 'mod + right', - 'pageup', - 'pagedown', - 'home', - 'end', - 't', - 'y', - 'f2', - 'h', - 'mod + f' - ] - - for (let c of combos) { - keyboardJS.bind(c, (e)=>{ - e.catchedByEditor = true - this.handleKeydown(c, e) - }, (e)=>{ - e.catchedByEditor = true - this.handleKeyup(c, e) - }) - } - - }) - - this.selectarea = new UiSelectArea('[data-widget]:not(.not-editable)', (elements, e)=>{ - - var widgets = elements.map(e => widgetManager.getWidgetByElement(e, ':not(.not-editable)')).filter(e => e) - - if (e.ctrlKey) { - - // only add siblings to current selection - - for (var i in widgets) { - this.select(widgets[i], {multi:true, fromLasso:true, lassoEnd: i == widgets.length - 1}) - } - - } else { - - // select the largest group of siblings in area - - var groups = {} - for (var w of widgets) { - var g = w.parent.hash - if (!g) continue - if (!groups[g]) groups[g] = [] - if (!groups[g].includes(w)) groups[g].push(w) - } - - groups = Object.values(groups) - - // if the event started from a container widget (but not in the project tree) - // remove groups that are more than one level away from that container - if (e.target.tagName !== 'LI' && this.selectedWidgets[0].childrenType !== undefined) { - groups = groups.filter(g=>g[0].parent === this.selectedWidgets[0] || g[0].parent === this.selectedWidgets[0].parent) - } - - var lengths = groups.map(g=>g.length), - selection = groups[lengths.lastIndexOf(Math.max(...lengths))] - - if (selection) this.select(selection) - } - - - - }) - - - } - - handleKeydown(combo, e){ - - if ( - this.inspector.helpModalOpened || - e && e.target && e.target.tagName.match(/INPUT|TEXTAREA|SELECT|OSC-CONSOLE/) - ) return - - if (e) e.preventDefault() - - switch (combo) { - - case 'mod + z': - this.undo() - break - - case 'mod + y': - case 'mod + shift + z': - this.redo() - break - - case 'mod + c': - if (!window.getSelection().toString().length) this.copyWidget() - break - - case 'mod + x': - if (!window.getSelection().toString().length) this.cutWidget() - break - - case 'mod + v': - if (!window.getSelection().toString().length) this.pasteWidget(this.mousePosition.x, this.mousePosition.y, false) - break - - case 'mod + shift + v': - this.pasteWidget(this.mousePosition.x, this.mousePosition.y, true) - break - - case 'mod + d': - this.duplicateWidget(this.mousePosition.x, this.mousePosition.y, false) - break - - case 'mod + shift + d': - this.duplicateWidget(this.mousePosition.x, this.mousePosition.y, true) - break - - case 'backspace': - case 'delete': - this.deleteWidget() - break - - case 'alt + up': - case 'alt + down': - case 'alt + right': - case 'alt + left': - if (!this.selectedWidgets.length || this.selectedWidgets[0].parent === widgetManager) return - - if (this.selectedWidgets[0].props.height === undefined && e.key.match(/Arrow(Up|Down)/)) return - if (this.selectedWidgets[0].props.width === undefined && e.key.match(/Arrow(Left|Right)/)) return - - var deltaW = e.key === 'ArrowLeft' ? -GRIDWIDTH : e.key === 'ArrowRight' ? GRIDWIDTH : 0, - deltaH = e.key === 'ArrowUp' ? -GRIDWIDTH : e.key === 'ArrowDown' ? GRIDWIDTH : 0 - - if (e.shiftKey) { - deltaW *= 5 - deltaH *= 5 - } - - this.resizeWidget(deltaW, deltaH) - - break - - case 'mod + up': - case 'mod + down': - case 'mod + right': - case 'mod + left': - if (!this.selectedWidgets.length) return - - if (this.selectedWidgets[0].props.top === undefined && e.key.match(/Arrow(Up|Down)/)) return - if (this.selectedWidgets[0].props.left === undefined && e.key.match(/Arrow(Left|Right)/)) return - - var deltaX = e.key === 'ArrowLeft' ? -GRIDWIDTH : e.key === 'ArrowRight' ? GRIDWIDTH : 0, - deltaY = e.key === 'ArrowUp' ? -GRIDWIDTH : e.key === 'ArrowDown' ? GRIDWIDTH : 0 - - if (e.shiftKey) { - deltaX *= 5 - deltaY *= 5 - } - - this.moveWidget(deltaX, deltaY) - - break - - case 'mod + shift + a': - if (!this.selectedWidgets.length) return - this.unselect() - this.selectedWidgets = [] - this.inspector.clear() - break - - case 'mod + a': - if (!this.selectedWidgets.length) return - - var curWidget1 = this.selectedWidgets[0] - - if (curWidget1.parent !== widgetManager) { - this.select([...curWidget1.parent.children]) - } - break - - case 'up': - case 'down': - case 'right': - case 'left': - if (!this.selectedWidgets.length) return - - var curWidget = this.selectedWidgets[0], - toSelect = null - - if (e.key === 'ArrowLeft' && curWidget.parent !== widgetManager) { - - toSelect = curWidget.parent - - } else if (e.key === 'ArrowRight') { - - if (curWidget.children[0] && !curWidget.children[0].meta.not_editable) { - toSelect = curWidget.children[0] - } - - } else if((e.key == 'ArrowUp') || (e.key == 'ArrowDown')){ - - if (curWidget.parent === widgetManager) return - - let toSelectList = [...curWidget.parent.children] - - if (toSelectList && toSelectList.length) { - toSelectList.sort((a,b) => a.container.offsetLeft > b.container.offsetLeft) - var idx = toSelectList.indexOf(curWidget) - if (idx >= 0) { - var nextIdx = (idx + (e.key === 'ArrowUp' ? -1 : 1 ) + toSelectList.length) % toSelectList.length - toSelect = toSelectList[nextIdx] - } - } - } - - if (toSelect) { - this.select(toSelect) - } - - break - - case 'pagedown': - case 'pageup': - case 'home': - case 'end': - if (this.selectedWidgets.length !== 1 || this.selectedWidgets[0].parent.children.length <= 1) return - - var curWidget2 = this.selectedWidgets[0], - index = curWidget2.parent.children.indexOf(curWidget2), - maxIndex = curWidget2.parent.children.length - 1, - newIndex - - if (combo === 'pagedown') newIndex = Math.min(index + 1, maxIndex) - else if (combo === 'pageup') newIndex = Math.max(index - 1, 0) - else if (combo === 'end') newIndex = maxIndex - else if (combo === 'home') newIndex = 0 - - if (index !== newIndex) { - this.widgetTree.trigger('sorted', { - from: curWidget2.parent, - to: curWidget2.parent, - oldIndex: index, - newIndex: newIndex, - ignoreTree: true - }) - } - break - - case 't': - if (!this.selectedWidgets.length) return - this.widgetTree.showWidget(editor.selectedWidgets[0]) - this.widgetTree.blinkSelected() - break - case 'y': - if (!this.selectedWidgets.length) return - for (let w of editor.selectedWidgets) { - this.widgetTree.showWidgetInSession(w) - } - this.widgetTree.showWidget(editor.selectedWidgets[0]) - break - case 'f2': - if (!this.selectedWidgets.length) return - if (this.selectedWidgets[0].props.label === undefined && this.selectedWidgets[0].props.html === undefined) return - if (!this.inspector.expandedCategories.includes('style')) { - var header = DOM.get(this.inspector.container, '.category-header[data-name="style"]')[0] - if (header) { - header.parentNode.classList.add('expanded') - this.inspector.expandedCategories.push('style') - } - } - var labelProp = this.selectedWidgets[0].props.label === undefined ? 'html' : 'label' - var input = DOM.get(this.inspector.container, `textarea[name="${labelProp}"]`)[0] - if (input) { - if (input._ace_input) { - input._ace_input.focus() - } else { - input.focus() - input.setSelectionRange(0, input.value.length) - input.scrollIntoView({block: 'center'}) - } - } - break - case 'h': - document.body.classList.add('editor-hide-selection') - break - case 'mod + f': - if (this.widgetTree.parent.minimized) this.widgetTree.parent.restore() - this.widgetTree.filter.focus() - break - - } - - - } - - handleKeyup(combo, e){ - - if ( - this.inspector.helpModalOpened || - (e && e.target && e.target.tagName && e.target.tagName.match(/INPUT|TEXTAREA|SELECT/)) - ) return - - if (e) e.preventDefault() - - switch (combo) { - - case 'h': - document.body.classList.remove('editor-hide-selection') - break - - } - } - - toggleGrid() { - - this.grid = !this.grid - - setGRIDWIDTH(this.grid ? GRIDWIDTH_CSS : 1) - - document.body.style.setProperty('--grid-width', GRIDWIDTH) - document.body.classList.toggle('no-grid', GRIDWIDTH == 1) - - } - - enable() { - - if (READ_ONLY || sessionManager.session === null) return - - this.enabled = true - - document.body.classList.add('editor-enabled') - document.body.classList.remove('editor-disabled') - - this.widgetTree.updateTree(this.selectedWidgets) - - leftUiSidePanel.enable() - rightUiSidePanel.enable() - - - // keyboardJS hack: prevent releaseAllKeys when switching context - var locale = keyboardJS._locale - keyboardJS._locale = null - keyboardJS.setContext('editing') - keyboardJS._locale = locale - - this.oscContainer.addEventListener('mousemove', this.mouveMoveHandler) - this.oscContainer.addEventListener('mouseleave', this.mouveLeaveHandler) - - this.selectarea.enable() - - } - - disable() { - - this.unselect() - this.selectedWidgets = [] - - document.body.classList.add('editor-disabled') - document.body.classList.remove('editor-enabled') - - // keyboardJS hack: prevent releaseAllKeys when switching context - var locale = keyboardJS._locale - keyboardJS._locale = null - keyboardJS.setContext('global') - keyboardJS._locale = locale - - this.oscContainer.removeEventListener('mousemove', this.mouveMoveHandler) - this.oscContainer.removeEventListener('mouseleave', this.mouveLeaveHandler) - - leftUiSidePanel.disable() - rightUiSidePanel.disable() - this.widgetTree.clear() - this.inspector.clear() - - this.selectarea.disable() - - this.enabled = false - - } - - - unselect() { - - this.widgetDragResize.clear() - this.inspector.clear() - - DOM.each(document, '.editing', (element)=>{ - element.classList.remove('editing') - }) - - this.widgetTree.select([]) - - } - - select(widget, options={}){ - - if (!this.enabled) return - - if (Array.isArray(widget)) { - - this.selectedWidgets = widget - - } else if (options.multi) { - - var sameLevel = false - - while (!sameLevel && widget.parent !== widgetManager) { - let test = true - if (this.selectedWidgets.length && this.selectedWidgets[0].parent !== widget.parent) test = false - sameLevel = test - if (!sameLevel) widget = widget.parent - } - - if (!this.selectedWidgets.includes(widget) && sameLevel) { - - this.selectedWidgets.push(widget) - - } else if (sameLevel && !options.fromLasso){ - - this.selectedWidgets.splice(this.selectedWidgets.indexOf(widget), 1) - - } - - } else { - - this.selectedWidgets = [widget] - - } - - if (this.selectedWidgets.length) { - var parent = this.selectedWidgets[0].parent - while (parent !== widgetManager) { - if (parent.getProp('lock')) { - this.selectedWidgets = [parent] - } - parent = parent.parent - } - } - - if (options.fromLasso && !options.lassoEnd) return - - this.unselect() - - if (this.selectedWidgets.length > 0) { - - this.inspector.inspect(this.selectedWidgets) - this.createSelectionBlock() - - } else { - - this.inspector.clear() - - } - - } - - - createSelectionBlock(){ - - for (let widget of this.selectedWidgets) { - DOM.each(document, `[data-widget="${widget.hash}"]`, (item)=>{ - item.classList.add('editing') - }) - } - this.widgetTree.select(this.selectedWidgets) - this.widgetDragResize.create(this.selectedWidgets) - if (!this.widgetTree.parent.minimized) { - this.widgetTree.showWidget(editor.selectedWidgets[editor.selectedWidgets.length-1]) - } - - } - - mouseMove(e) { - - this.mousePosition.x = Math.round((e.offsetX + e.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH, - this.mousePosition.y = Math.round((e.offsetY + e.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH - - } - - mouseLeave(e) { - - this.mousePosition = {} - - } - - copyWidget(tmp) { - - if (!this.selectedWidgets.length) return - if (this.selectedWidgets[0].getProp('type') === 'root') return - - this.clipboard = deepCopy(this.selectedWidgets.map((w)=>w.props)) - this.idClipboard = this.selectedWidgets[0].getProp('id') - - ipc.send('clipboard', { - clipboard: this.clipboard, - idClipboard: this.idClipboard - }) - - } - - duplicateWidget(x, y, increment) { - - if (!this.selectedWidgets.length) return - if (this.selectedWidgets[0].getProp('type') === 'root') return - - this.tmpClipboard = deepCopy(this.selectedWidgets.map((w)=>w.props)) - var index = Math.max(...this.selectedWidgets.map(w=>w.parent.children.indexOf(w))) - this.select(this.selectedWidgets[0].parent) - this.pasteWidget(x, y, increment, index + 1, true) - this.select(this.selectedWidgets[0].children[index + 1]) - - } - - cutWidget() { - - this.copyWidget() - this.deleteWidget() - - } - - pasteWidget(x, y, increment, index, tmp) { - - if (!this.selectedWidgets.length) return - - var clipboard = tmp ? this.tmpClipboard : this.clipboard - - if (clipboard === null) return - - if ( - this.selectedWidgets[0].childrenType === undefined || - clipboard[0].type === 'tab' && this.selectedWidgets[0].childrenType === 'widget' || - clipboard[0].type !== 'tab' && this.selectedWidgets[0].childrenType === 'tab' - ) return - - var pastedData = deepCopy(clipboard), - minTop = Infinity, - minLeft = Infinity - - if (increment) { - pastedData = incrementWidget(pastedData) - } - - - if (x !== undefined) { - - for (let i in pastedData) { - - let top = pastedData[i].top, - left = pastedData[i].left - - if (typeof top === 'string' && top.includes('%')) { - top = parseFloat(top) / 100 * this.selectedWidgets[0].widget.offsetHeight - pastedData[i]._atop = top - pastedData[i]._ptop = true - } - - if (typeof left === 'string' && left.includes('%')) { - left = parseFloat(left) / 100 * this.selectedWidgets[0].widget.offsetWidth - pastedData[i]._aleft = left - pastedData[i]._pleft = true - } - - - if (top < minTop) minTop = top - if (left < minLeft) minLeft = left - - } - - for (let i in pastedData) { - - if (!String(pastedData[i].left).match(/\{/)) { - - if (pastedData[i]._pleft) { - pastedData[i].left = ((pastedData[i]._aleft - minLeft + x) * 100 / this.selectedWidgets[0].widget.offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - pastedData[i].left += - minLeft + x - } - - } - - if (!String(pastedData[i].top).match(/\{/)) { - - if (pastedData[i]._ptop) { - pastedData[i].top = ((pastedData[i]._atop - minTop + y) * 100 / this.selectedWidgets[0].widget.offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - pastedData[i].top += - minTop + y - } - - } - - - } - - } - - - // paste data - - var store = clipboard[0].type === 'tab' ? 'tabs' : 'widgets' - - this.selectedWidgets[0].props[store] = this.selectedWidgets[0].props[store] || [] - - var indexes = {addedIndexes: []}, - start = index || this.selectedWidgets[0].props[store].length - - this.selectedWidgets[0].props[store].splice(start, 0, ...pastedData) - - for (let i = 0; i < pastedData.length; i++) { - indexes.addedIndexes.push(start + pastedData.length - 1 - i ) - } - - if (index)indexes.reuseChildren=false - - updateWidget(this.selectedWidgets[0], indexes) - - this.pushHistory(indexes) - - if (!leftUiSidePanel.minimized) this.widgetTree.showWidget(this.selectedWidgets[0].children[0]) - - } - - pasteWidgetAsClone(x, y) { - - if (!this.selectedWidgets.length || this.clipboard === null) return - if (!this.idClipboard || !widgetManager.getWidgetById(this.idClipboard).length) return - - if ( - this.selectedWidgets[0].childrenType === undefined || - this.clipboard[0].type === 'tab' || - this.clipboard[0].type !== 'tab' && this.selectedWidgets[0].childrenType === 'tab' - ) return - - var clone = {type: 'clone', widgetId: this.idClipboard}, - pastedData = deepCopy(this.clipboard) - - clone.width = pastedData[0].width - clone.height = pastedData[0].height - - - if (x !== undefined) { - - clone.left = x - clone.top = y - - if (this.usePercents) { - clone.top = (100 * y / editor.selectedWidgets[0].widget.offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' - clone.left= (100 * x / editor.selectedWidgets[0].widget.offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' - } - - - } - - this.selectedWidgets[0].props.widgets = this.selectedWidgets[0].props.widgets || [] - this.selectedWidgets[0].props.widgets.push(clone) - - var indexes = {addedIndexes: [this.selectedWidgets[0].props.widgets.length -1]} - - updateWidget(this.selectedWidgets[0], indexes) - - this.pushHistory(indexes) - - if (!leftUiSidePanel.minimized) this.widgetTree.showWidget(this.selectedWidgets[0].children[0]) - - - } - - - deleteWidget() { - - if (!this.selectedWidgets.length) return - if (this.selectedWidgets[0].getProp('type') === 'root') return - - var type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget', - parent = this.selectedWidgets[0].parent, - index = this.selectedWidgets.map(w => parent.children.indexOf(w)).sort((a,b)=>{return b-a}), - removedIndexes = [] - - if (type === 'widget') { - for (let i of index) { - removedIndexes.push(i) - parent.props.widgets.splice(i,1) - } - } else { - for (let i of index) { - removedIndexes.push(i) - parent.props.tabs.splice(i,1) - } - } - - var container = updateWidget(parent, {preventSelect: true, removedIndexes}) - if (container.children.length) { - this.select(container.children[Math.min(index.pop(), container.children.length - 1)]) - } else { - this.select(container) - } - this.pushHistory({removedIndexes}) - - } - - /* Utility function to retrieve the first sizable node */ - getWidgetParentContainer(widget) { - - while (widget.parent instanceof widgets.folder) { - widget = widget.parent - } - - return widget.container.parentNode - - } - - resizeWidget(deltaW, deltaH) { - - if (!this.selectedWidgets.length) return - - if (this.selectedWidgets.some(w=>w.getProp('lock'))) { - this.createSelectionBlock() - return - } - - var newWidgets = [], - area = this.widgetDragResize, - editedProps = [] - - for (var i = 0; i < this.selectedWidgets.length; i++) { - - let w = this.selectedWidgets[i], - nW, nH, nL, nT - - nW = w.container.offsetWidth + deltaW * w.container.offsetWidth / area.initWidth - nH = w.container.offsetHeight + deltaH * w.container.offsetHeight / area.initHeight - - if (this.selectedWidgets.length > 1) { - nL = w.container.offsetLeft + deltaW * (w.container.offsetLeft - area.initLeft) / area.initWidth - nT = w.container.offsetTop + deltaH * (w.container.offsetTop - area.initTop) / area.initHeight - } - - if (deltaW !== 0 && w.props.width !== undefined && w.parent.getProp('layout') !== 'vertical') { - var newWidth = Math.max(nW, GRIDWIDTH) / PXSCALE - if (typeof w.props.width === 'string' && w.props.width.indexOf('%') > -1) { - w.props.width = (100 * PXSCALE * newWidth / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - w.props.width = newWidth - } - editedProps.push('width') - - if (this.selectedWidgets.length > 1) { - var newLeft = Math.max(nL, GRIDWIDTH) / PXSCALE - if (typeof w.props.left === 'string' && w.props.left.indexOf('%') > -1) { - w.props.left = (100 * PXSCALE * newLeft / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' - } else if (w.props.left !== 'auto'){ - w.props.left = newLeft - } - editedProps.push('left') - } - - } - - if (deltaH !== 0 && w.props.height !== undefined && w.parent.getProp('layout') !== 'horizontal') { - var newHeight = Math.max(nH, GRIDWIDTH) / PXSCALE - if (typeof w.props.height === 'string' && w.props.height.indexOf('%') > -1) { - w.props.height = (100 * PXSCALE * newHeight / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - w.props.height = newHeight - } - editedProps.push('height') - - if (this.selectedWidgets.length > 1) { - var newTop = Math.max(nT, GRIDWIDTH) / PXSCALE - if (typeof w.props.top === 'string' && w.props.top.indexOf('%') > -1) { - w.props.top = (100 * PXSCALE * newTop / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' - } else if (w.props.top !== 'auto'){ - w.props.top = newTop - } - editedProps.push('top') - } - } - - if (w.props.width !== undefined || w.props.height !== undefined) newWidgets.push(updateWidget(w, {editedProps: editedProps, preventSelect: this.selectedWidgets.length > 1})) - - } - - this.pushHistory() - - // if (newWidgets.length > 1) this.select(newWidgets, {preventSelect: this.selectedWidgets.length > 1}) - this.createSelectionBlock() - - } - - moveWidget(deltaX, deltaY) { - - if (!this.selectedWidgets.length) return - - if (this.selectedWidgets.some(w=>w.getProp('lock'))) { - this.createSelectionBlock() - return - } - - var newWidgets = [] - - for (var w of this.selectedWidgets) { - - var newTop = Math.max(parseInt(w.container.offsetTop) / PXSCALE + deltaY, 0) - if (typeof w.props.top === 'string' && w.props.top.indexOf('%') > -1) { - w.props.top = (100 * PXSCALE * newTop / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - w.props.top = newTop - } - var newLeft = Math.max(parseInt(w.container.offsetLeft) / PXSCALE + deltaX, 0) - if (typeof w.props.left === 'string' && w.props.left.indexOf('%') > -1) { - w.props.left = (100 * PXSCALE * newLeft / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' - } else { - w.props.left = newLeft - } - - newWidgets.push(updateWidget(w, {editedProps: ['top', 'left'], preventSelect: this.selectedWidgets.length > 1})) - - } - - this.pushHistory() - - // if (newWidgets.length > 1) this.select(newWidgets) - this.createSelectionBlock() - - } - - - - pushHistory(indexes) { - - if (!ENV.noWarning) { - this.unsavedSession = true - } - - if (this.historyState > -1) { - this.history.splice(0, this.historyState + 1) - this.historyState = -1 - } - - var d = diff.diff(this.historySession, sessionManager.session.getRoot()) - - if (d) { - diff.patch(this.historySession, deepCopy(d)) - this.history.unshift([deepCopy(d), indexes]) - if (this.history.length > HISTORY_SIZE) this.history.pop() - } - - } - - clearHistory() { - - this.history = [] - this.historyState = -1 - this.historySession = deepCopy(sessionManager.session.getRoot()) - - } - - undo() { - - if (this.historyState === this.history.length - 1) return - - this.historyState += 1 - - var [patch, indexes] = this.history[this.historyState], - d1 = deepCopy(patch), - d2 = deepCopy(patch) - - diff.unpatch(this.historySession, d1) - diff.unpatch(sessionManager.session.getRoot(), d2) - - this.updateWidgetFromPatch(patch, indexes ? { - addedIndexes: deepCopy(indexes.removedIndexes), - removedIndexes: deepCopy(indexes.addedIndexes), - } : undefined) - - } - - redo() { - - if (this.historyState === -1) return - - var [patch, indexes] = this.history[this.historyState], - d1 = deepCopy(patch), - d2 = deepCopy(patch) - - diff.patch(this.historySession, d1) - diff.patch(sessionManager.session.getRoot(), d2) - - this.updateWidgetFromPatch(patch, indexes ? { - addedIndexes: deepCopy(indexes.addedIndexes), - removedIndexes: deepCopy(indexes.removedIndexes), - } : undefined) - - this.historyState -= 1 - - } - - updateWidgetFromPatch(patch, indexes) { - - var [widget, subpatch] = diffToWidget(widgetManager.getWidgetById('root')[0], patch), - options = {} - - if (indexes) { - options = {...indexes} - } else { - options.editedProps = Object.keys(subpatch) - options.reuseChildren = false - } - - updateWidget(widget, options) - - if (this.selectedWidgets[0] && !widgetManager.widgets[this.selectedWidgets[0].hash]) { - this.unselect() - this.selectedWidgets = [] - this.inspector.clear() - } else if (this.selectedWidgets[0]) { - this.widgetDragResize.create(this.selectedWidgets) - } - - } - - - - -} - -var editor = new Editor() - -export default editor diff --git a/src/client/events/dom-event.mjs b/src/client/events/dom-event.mjs deleted file mode 100644 index 24c81d77..00000000 --- a/src/client/events/dom-event.mjs +++ /dev/null @@ -1,42 +0,0 @@ -export default function(eventName, options={}){ - - var widget_storage_key = '_' + eventName + '_widget' - - function closestWidgetContainer(target) { - var container = target - while (container !== null) { - if (container[widget_storage_key]) { - return container - } else { - container = container.parentNode - } - } - return null - } - - function triggerWidgetEvent(target, event) { - var container = closestWidgetContainer(target) - if (container) container[widget_storage_key].trigger(eventName, event) - } - - document.addEventListener(eventName, (event)=>{ - triggerWidgetEvent(event.target, event) - }, {passive: !!options.passive, capture: !!options.capture}) - - return { - - setup: function(options) { - var {element} = options || {element: this.container} - element[widget_storage_key] = this - }, - - teardown: function(options) { - var {element} = options || {element: this.container} - delete element[widget_storage_key] - } - - - } - - -} diff --git a/src/client/events/drag.mjs b/src/client/events/drag.mjs deleted file mode 100644 index 66799589..00000000 --- a/src/client/events/drag.mjs +++ /dev/null @@ -1,426 +0,0 @@ -import {normalizeDragEvent, resetEventOffset, TRAVERSING_SAMEWIDGET} from './utils.mjs' -import iOS from '../ui/ios.mjs' -import {DOM} from '../globals.mjs' - -var targets = {}, - previousPointers = {} - -function pointerDownHandler(event) { - - if (event.capturedByEditor || event.touchPunch) return event - - if (!event.target._drag_multitouch) { - for (var i in targets) { - if (targets[i] == event.target) return event - } - } - - event = normalizeDragEvent(event) - event.stopPropagation = true - - var target = closestDragContainer(event.target) - - if (!target) return event - - if (event.traversingStack) { - - var widget = target._drag_widget, - local = event.traversingStack.stack[event.traversingStack.stack.length - 1] - - if (widget.getProp) { - // if first touched widget is a container, wait until another widget is touched while moving - event.traversingStack.firstType = widget.isContainer ? '?' : widget.getProp('type') - } - - if (local.mode === TRAVERSING_SAMEWIDGET) { - if (local.type === '') { - local.type = event.traversingStack.firstType - } - event.traversing = local.type === event.traversingStack.firstType || event.traversingStack.firstType === '?' - } else { - event.traversing = true - } - - } - - targets[event.pointerId] = target - previousPointers[event.pointerId] = event - - - if (event.pointerType !== 'mouse') domObserver.activate() - - triggerWidgetEvent(targets[event.pointerId], 'draginit', event) - - if (event.cancelDragEvent) clearPointer(event) - - return event - -} - -function pointerMoveHandler(event) { - - event = normalizeDragEvent(event, previousPointers[event.pointerId]) - - event.stopPropagation = true - - if (event.traversing) { - - var previousTarget = targets[event.pointerId], - target = event.isTouch ? - document.elementFromPoint(event.clientX, event.clientY) - : event.target - - if (target) target = closestDragContainer(target) - - var local = null, - containersOnly = false, - backupTarget = target - - if (target && event.traversingStack) { - for (var i = event.traversingStack.stack.length - 1; i > -1; i--) { - if (event.traversingStack.stack[i].container.contains(target)) { - local = event.traversingStack.stack[i] - break - } - } - if (!local) { - target = null - } else if (local.mode === TRAVERSING_SAMEWIDGET) { - var widget = target._drag_widget - if (local.type === '?' && widget.getProp && !widget.isContainer) local.type = widget.getProp('type') - if (widget.getProp && local.type !== widget.getProp('type')) target = null - } - } - - - - - if (target && event.isTouch) { - resetEventOffset(event, target) - } - - if (previousTarget !== target && !containersOnly) { - triggerWidgetEvent(previousTarget, 'dragend', event) - } - - - if (target) { - - if (previousTarget === target) { - - triggerWidgetEvent(target, 'drag', event) - - } else { - triggerWidgetEvent(target, 'draginit', event) - - } - - } else { - - // notify container of move events if no draggable widget is under the pointer - triggerWidgetEvent(backupTarget, 'drag', event, true) - - } - - targets[event.pointerId] = target - - - } else { - triggerWidgetEvent(targets[event.pointerId], 'drag', event) - } - - previousPointers[event.pointerId] = event - -} - -function pointerUpHandler(event) { - - event = normalizeDragEvent(event, previousPointers[event.pointerId]) - event.stopPropagation = true - - triggerWidgetEvent(targets[event.pointerId], 'dragend', event) - - clearPointer(event) - -} - -function clearPointer(event) { - - delete targets[event.pointerId] - delete previousPointers[event.pointerId] - - if (domObserver.active) { - var t - for (var k in targets) {t=targets[k]} - if (t === undefined) domObserver.deactivate() - } - -} - - -// Move / Up Filter - -function pointerMoveFilter(event) { - - if (targets[event.pointerId] !== undefined) { - pointerMoveHandler.call(targets[event.pointerId], event) - } - -} - -function pointerUpFilter(event) { - - if (targets[event.pointerId] !== undefined) { - pointerUpHandler.call(targets[event.pointerId], event) - delete targets[event.pointerId] - } - -} - -// Mouse events wrappers - -function mouseDownCapture(event) { - if (event.pointerType === 'touch') return - event.stopPropagation() - // event.pointerId = 'mouse' - pointerDownHandler(event) -} - -function mouseMoveCapture(event) { - if (event.pointerType === 'touch') return - // event.pointerId = 'mouse' - event.inertia = event.ctrlKey ? 10 : 1 - pointerMoveFilter(event) -} - -function mouseUpCapture(event){ - if (event.pointerType === 'touch') return - // event.pointerId = 'mouse' - pointerUpFilter(event) -} - - -// Touch events wrappers - -// Touchend event is not emitted when target element is removed/detached -// Watch for DOM mutations and simulate pointerUp if a registered -// target is removed/detached -const domObserver = new MutationObserver(function(mutations) { - for (var id in targets) { - var event = previousPointers[id], - target = targets[id] - - if (!event || event.pointerType === 'mouse') continue - - for (var mutation of mutations) { - for (var node of mutation.removedNodes) { - if (node == target || node.contains(target)){ - pointerUpHandler(event) - } - } - } - } -}) -domObserver.active = false -domObserver.activate = ()=>{ - if (!domObserver.active) { - domObserver.observe(DOM.get('#osc-container')[0], {subtree: true, childList: true}) - domObserver.active = true - } -} -domObserver.deactivate = ()=>{ - if (domObserver.active) { - domObserver.disconnect() - domObserver.active = false - } -} - -function touchDownCapture(event) { - - var preventDefault = true - - event.stopPropagation() - - for (var i in event.changedTouches) { - if (isNaN(i) || !event.changedTouches[i]) continue - var touchEvent = event.changedTouches[i] - - if (event.traversingStack) { - touchEvent.traversingStack = event.traversingStack - } - - touchEvent.pointerId = touchEvent.identifier - - touchEvent = pointerDownHandler(touchEvent) - - // allow scroll if drag is cancelled or widget is a container - if (touchEvent.cancelDragEvent || touchEvent.allowScroll) preventDefault = false - } - if (preventDefault) event.preventDefault() -} - -function touchMoveCapture(event) { - for (var i in event.changedTouches) { - if (isNaN(i) || !event.changedTouches[i]) continue - var touchEvent = event.changedTouches[i] - touchEvent.fingers = 0 - for (var j in event.touches) { - if (event.touches[j].target && event.touches[j].target.isSameNode(touchEvent.target)) { - touchEvent.fingers += 1 - } - } - - touchEvent.pointerId = touchEvent.identifier - pointerMoveFilter(touchEvent) - } -} - -function touchUpCapture(event) { - for (var i in event.changedTouches) { - if (isNaN(i) || !event.changedTouches[i]) continue - var touchEvent = event.changedTouches[i] - touchEvent.pointerId = touchEvent.identifier - pointerUpFilter(touchEvent) - } -} - - - -function ancestorDragContainers(target) { - var containers = [], - container = target - while (container !== null) { - if (container._drag_widget) { - containers.splice(0, 0, container._drag_widget) - if (container._drag_widget.root) break - } - container = container.parentNode - } - return containers -} - -function closestDragContainer(target) { - var container = target - while (container !== null) { - if (container._drag_widget) { - return container - } else { - container = container.parentNode - } - } - return null -} - -// Callback trigger - -function triggerWidgetEvent(target, name, event, containersOnly) { - - // trigger drag events from parent to child - var widgets = ancestorDragContainers(target), - widget - - for (widget of widgets) { - if (containersOnly && !widget.isContainer) continue - widget.trigger(name, event) - if (event.preventDefault) break - } - - // if child is a container, let it scroll - if (widget && widget.scroll) event.allowScroll = true -} - -// init -if (!iOS) { - document.addEventListener('pointermove', mouseMoveCapture, true) - if ('onwebkitmouseforcechanged' in document) document.addEventListener('webkitmouseforcechanged', mouseMoveCapture, true) -} -if (!iOS) document.addEventListener('pointerup', mouseUpCapture, true) - -document.addEventListener('touchmove', touchMoveCapture, true) - -if ('ontouchforcechange' in document) document.addEventListener('touchforcechange', touchMoveCapture, true) - -DOM.addEventListener(document, 'touchend touchcancel', touchUpCapture, true) - -if (!iOS) document.addEventListener('pointerdown', mouseDownCapture) - -export function setup(options) { - - if ( - this._customBindings['drag'] !== 0 || - this._customBindings['draginit'] !== 0 || - this._customBindings['dragend'] !== 0 || - !options || options.ignoreCustomBindings - ) { - return - } - - var {element, multitouch} = options - - element.addEventListener('touchstart', touchDownCapture, false) - element._drag_widget = this - element._drag_multitouch = multitouch - -} - -export function teardown(options) { - - if ( - this._customBindings['drag'] !== 0 || - this._customBindings['draginit'] !== 0 || - this._customBindings['dragend'] !== 0 || - !options || options.ignoreCustomBindings - ) { - return - } - - var {element} = options - - element.style.touchAction = '' - element.removeEventListener('touchstart', touchDownCapture, false) - delete element._drag_widget - delete element._drag_multitouch - -} - -export function enableTraversingGestures(element, options={}) { - - if (element._traversing) return - - var traversing = options.type ? TRAVERSING_SAMEWIDGET : true, - traversingType = options.type === 'smart' || options.type === 'auto' ? '' : options.type - - element._traversing = traversing - - function makeEventTraversing(event) { - if (event.ctrlKey) return - if (!event.traversingStack) event.traversingStack = {firstType: '', stack: []} - event.traversingStack.stack.push({ - container: element.parentNode, - mode: traversing, - type: traversingType - }) - - } - - if (!iOS) element.addEventListener('pointerdown', makeEventTraversing, true) - element.addEventListener('touchstart', makeEventTraversing, true) - - element.addEventListener('disableTraversingGestures', (e)=>{ - e.stopPropagation() - if (!iOS) element.removeEventListener('pointerdown', makeEventTraversing, true) - element.removeEventListener('touchstart', makeEventTraversing, true) - - }) - -} - -export function disableTraversingGestures(element) { - - if (!element._traversing) return - - delete element._traversing - - DOM.dispatchEvent(element, 'disableTraversingGestures') - -} diff --git a/src/client/events/resize.mjs b/src/client/events/resize.mjs deleted file mode 100644 index fab074f9..00000000 --- a/src/client/events/resize.mjs +++ /dev/null @@ -1,63 +0,0 @@ -import fastdom from 'fastdom' - -var elements = [] - -export function check(context, force){ - fastdom.measure(()=>{ - // Iterate over all elements to which the 'resize' event is bound. - let resizedElems = [], - cachedStyles = [] - for (let i = elements.length - 1; i >= 0; i--) { - var elem = elements[i] - - if (!context.contains(elem)) continue - - var style = window.getComputedStyle(elem), - width = parseInt(style['width']) - parseInt(style['padding-left']) - parseInt(style['padding-right']), - height = parseInt(style['height']) - parseInt(style['padding-top']) - parseInt(style['padding-bottom']) - - if (!width || !height) continue - - // If element size has changed since the last time, update the element - // data store and trigger the 'resize' event. - if (force || width != elem.resizedataw || height != elem.resizedatah) { - elem.resizedataw = width - elem.resizedatah = height - resizedElems.push(elem) - cachedStyles.push(style) - } - } - for (let i = resizedElems.length - 1; i >= 0; i--) { - resizedElems[i]._resize_widget.trigger('resize', { - width: resizedElems[i].resizedataw, - height: resizedElems[i].resizedatah, - style:cachedStyles[i], - stopPropagation: true - }) - } - }) - -} - -window.addEventListener('resize', ()=>{check(document)}) - -export function setup(options) { - - if (!options) return - if (elements.indexOf(options.element) == -1) { - elements.push(options.element) - options.element._resize_widget = this - } - -} - -export function teardown(options) { - - if (!options) return - - if (elements.indexOf(options.element) != -1) { - elements.splice(elements.indexOf(options.element), 1) - delete options.element._resize_widget - } - -} diff --git a/src/client/events/transform-coords.mjs b/src/client/events/transform-coords.mjs deleted file mode 100644 index 7978dc3f..00000000 --- a/src/client/events/transform-coords.mjs +++ /dev/null @@ -1,55 +0,0 @@ -/* - - Adapted from https://gist.github.com/Yaffle/1145197#file-convertpointfrompagetonode-js - - Disabled for now - - -*/ - - - -/* global WebKitCSSMatrix */ -var I = new WebKitCSSMatrix() - -function Point(x, y, z) { - this.x = x - this.y = y - this.z = z -} - -Point.prototype.transformBy = function(matrix) { - var tmp = matrix.multiply(I.translate(this.x, this.y, this.z)) - return new Point(tmp.m41, tmp.m42, tmp.m43) -} - -function getTransformationMatrix(w) { - - var transformationMatrix = I, - node = w - - while (node) { - if (node._ignore_css_transforms) break - if (node._drag_widget) { - - var transform = node._drag_widget.cssTransform || 'none', - c = transform === 'none' ? I : new WebKitCSSMatrix(transform) - - transformationMatrix = c.multiply(transformationMatrix) - - } - node = node.parentNode - - } - - transformationMatrix = I.multiply(transformationMatrix) - - return transformationMatrix - -} - -export default function cssTransformCoords(node, x, y) { - - return new Point(x, y, 0).transformBy(getTransformationMatrix(node).inverse()) - -} diff --git a/src/client/events/utils.mjs b/src/client/events/utils.mjs deleted file mode 100644 index 850191a7..00000000 --- a/src/client/events/utils.mjs +++ /dev/null @@ -1,123 +0,0 @@ -import {DOM} from '../globals.mjs' - -var zoom -setTimeout(async()=>{ - // use setTimeout to fix init order in safari... - zoom = (await import('../ui/zoom.mjs')).default -}) - -// impot cssTransformCoords from './transform-coords.mjs' - -const Touch = window.Touch || class Touch {} - - -export function fix(e) { - - var localZoom = zoom.editor && zoom.editor.enabled ? zoom.localZoom : 1 - - return { - - target: e.target === document ? null : e.target, // firefox passes document when outside the page - firstTarget: null, - offsetX: e.offsetX, - offsetY: e.offsetY, - pageX: e.pageX, - pageY: e.pageY, - clientX: e.clientX, - clientY: e.clientY, - movementX: e.movementX === undefined ? undefined : e.movementX / localZoom, - movementY: e.movementY === undefined ? undefined : e.movementY / localZoom, - pointerId: e.pointerId, - pointerType: e.pointerType, - button: e.button, - altKey: e.altKey, - ctrlKey: e.ctrlKey, - shiftKey: e.shiftKey, - inertia: e.multitouch ? 1 : e.inertia, - traversing: e.traversing, - traversingStack: e.traversingStack, - multitouch: e.multitouch, - isTouch: e instanceof Touch, - force: e.webkitForce || e.force || 0, - radiusX: e.radiusX, - radiusY: e.radiusY, - rotationAngle: e.rotationAngle, - // iOS only - altitudeAngle: e.altitudeAngle, - azimuthAngle: e.azimuthAngle, - touchType: e.touchType - } - -} - -export function normalizeDragEvent(event, previousEvent) { - - event = fix(event) - - event.firstTarget = previousEvent ? previousEvent.firstTarget : event.target - - if (event.movementX === undefined) { - - event.movementX = previousEvent ? event.pageX - previousEvent.pageX : 0 - event.movementY = previousEvent ? event.pageY - previousEvent.pageY : 0 - - } - - if (event.isTouch && !previousEvent) { - - resetEventOffset(event, event.target) - - } else if (previousEvent) { - - event.offsetX = previousEvent.offsetX + event.movementX - event.offsetY = previousEvent.offsetY + event.movementY - - } - - if (event.inertia === undefined) { - - event.inertia = 1 - - } - - if (previousEvent) { - - if (previousEvent.traversing) event.traversing = previousEvent.traversing - if (previousEvent.traversingStack) event.traversingStack = previousEvent.traversingStack - - if (previousEvent.multitouch) { - event.multitouch = previousEvent.multitouch - event.inertia = 1 - } - - } - - - // if (!event.traversing) { - // // css transform fix (doesn't work well with traversing gestures) - // var transformedCoords = cssTransformCoords(event.firstTarget, event.movementX, event.movementY) - // event.movementX = transformedCoords.x - // event.movementY = transformedCoords.y - // } - - return event - -} - -export function resetEventOffset(event, target) { - - var off = DOM.offset(target) - - event.offsetX = event.pageX - off.left - event.offsetY = event.pageY - off.top - - // if (!event.traversing) { - // // css transform fix (doesn't work well with traversing gestures) - // var transformedCoords = cssTransformCoords(event.firstTarget, event.offsetX, event.offsetY) - // event.offsetX = transformedCoords.x - // event.offsetY = transformedCoords.y - // } - -} - -export const TRAVERSING_SAMEWIDGET = 1 diff --git a/src/client/globals.mjs b/src/client/globals.mjs deleted file mode 100644 index 6dabbaf3..00000000 --- a/src/client/globals.mjs +++ /dev/null @@ -1,61 +0,0 @@ -import json5 from 'json5' -import pkg from '../../package.json' -import * as dom from './dom.mjs' - -export var IP = window.IP || '' -export var ENV = window.ENV || {} -location.search.replace(/[?&]+([^=&j]+)=([^&]*)/gi, (s,k,v)=>{ - ENV[k]=v -}) -for (var k in ENV) { - ENV[k.toLowerCase()] = ENV[k] -} - -export var LANG = ENV.lang === 'debug' ? 'debug' : (ENV.lang || navigator.language || '').substr(0, 2).toLowerCase() - -export var PACKAGE = pkg - -export var LOADING = null - -export var READ_ONLY = window.READ_ONLY || false -export var KIOSK = window.KIOSK || false -export var GRIDWIDTH_CSS = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--grid-width')) -export function setGRIDWIDTH_CSS(x) {GRIDWIDTH_CSS = x} -export var GRIDWIDTH = GRIDWIDTH_CSS -export function setGRIDWIDTH(x) {GRIDWIDTH = x} - - - - - - -export var ELECTRON_NOGPU = false -export var CANVAS_FRAMERATE = parseFloat(ENV.framerate || 60) -export var CANVAS_SCALING = parseFloat(ENV.forcehdpi) || ( ENV.hdpi ? window.devicePixelRatio : 1 ) -export var INITIALZOOM = ENV.zoom ? parseFloat(ENV.zoom) : 1 -export var PXSCALE = INITIALZOOM -export function setPXSCALE(x) {PXSCALE = x} -document.documentElement.style.setProperty('font-size', PXSCALE + 'px') - -export var DOUBLE_TAP_TIME = ENV.doubletap ? parseInt(ENV.doubletap) : 375 - -export var CLIENT_SYNC = parseInt(ENV.clientSync) !== 0 - -export var TOGGLE_ALT_TRAVERSING = !!ENV.altTraversing - -export var VIRTUAL_KEYBOARD = !!ENV.virtualKeyboard -export function setVIRTUAL_KEYBOARD(x) { - VIRTUAL_KEYBOARD = x -} - -export var FOCUSABLE = !ENV.noFocus -if (!FOCUSABLE) console.debug('ELECTRON.SETFOCUSABLE(0)') -else console.debug('ELECTRON.SETFOCUSABLE(1)') -export function setFOCUSABLE(x) {FOCUSABLE = x} - - -export var JSON5 = json5 - -export var DOM = dom - -export var TITLE = ENV.title || (PACKAGE.productName + ' v' + PACKAGE.version) diff --git a/src/client/index.js b/src/client/index.js new file mode 100644 index 00000000..04b9c6af --- /dev/null +++ b/src/client/index.js @@ -0,0 +1,26 @@ +require('./app/stacktrace') +require('./app/globals') + +var {loading} = require('./app/ui/utils'), + locales = require('./app/locales') + +document.addEventListener('DOMContentLoaded', function(event) { + + DOM.init() + + LOADING = loading(locales('loading_server')) + + setTimeout(()=>{ + + var ipc = require('./app/ipc/') + + ipc.init() + + require('./app/ui/init') + + ipc.send('ready', {backupId: ARGV.backupId}) + + + }, 100) + +}) diff --git a/src/client/index.mjs b/src/client/index.mjs deleted file mode 100644 index 630e8834..00000000 --- a/src/client/index.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import {TITLE} from './globals.mjs' -import './stacktrace.mjs' -import './ui/init.mjs' - -import locales from './locales/index.mjs' -import uiLoading from './ui/ui-loading.mjs' -import ipc from './ipc/index.mjs' -import * as backup from './backup.mjs' - -uiLoading(locales('loading_server')) - -ipc.init(()=>{ - - - document.title = TITLE - - ipc.send('open', {hotReload: backup.exists}) - - window.onunload = ()=>{ - ipc.send('close') - } - - backup.load() - -}) diff --git a/src/client/ipc/callbacks.mjs b/src/client/ipc/callbacks.mjs deleted file mode 100644 index 990a7e61..00000000 --- a/src/client/ipc/callbacks.mjs +++ /dev/null @@ -1,171 +0,0 @@ -import raw from 'nanohtml/raw' -import fastdom from 'fastdom' -import osc from '../osc.mjs' -import session from '../managers/session/index.mjs' -import widgetManager from '../managers/widgets.mjs' -import state from '../managers/state.mjs' -import editor from '../editor/index.mjs' -import locales from '../locales/index.mjs' -import UiModal from '../ui/ui-modal.mjs' -import uiLoading from '../ui/ui-loading.mjs' -import notifications from '../ui/notifications' -import * as backup from '../backup.mjs' -import {updateMobileThemeColor, icon} from '../ui/utils.mjs' -import {CLIENT_SYNC, DOM, ENV, TITLE, setGRIDWIDTH_CSS} from '../globals.mjs' - -export default { - - bundle: function(data) { - for (let i in data) { - osc.receive(data[i]) - } - }, - - receiveOsc: function(data){ - osc.receive(data) - }, - - connected:function(){ - uiLoading(false) - }, - - sessionOpen: function(data){ - - session.open(data) - - }, - - sessionNew: function(){ - - session.create() - - }, - - sessionSaved: function(data){ - - editor.unsavedSession = false - - }, - - fragmentLoad: function(data){ - - session.setFragment(data) - - }, - - stateLoad: function(data){ - - state.load(data.state, data.send, data.path) - - }, - - stateSend:function(){ - - if (!CLIENT_SYNC) return - - notifications.add({ - icon: 'wifi', - class: 'client-connected', - message: locales('loading_newclient') - }) - - setTimeout(function(){ - - osc.syncOnly = true - state.send() - osc.syncOnly = false - - },200) - - }, - - editorDisable: function(data){ - - editor.disable(data.permanent) - - }, - - error: function(data){ - new UiModal({title: raw(icon('exclamation-triangle') + '  ' + locales('error')), content: raw(data), closable:true}) - }, - - errorLog: function(data) { - - console.error(data) - - }, - - reloadCss: function(){ - var queryString = '?__OSC_ASSET__=1&reload=' + Date.now() - var sheets = DOM.get(document, 'link[rel="stylesheet"][hot-reload]') - var loaded = 0 - - for (let stylesheet of sheets) { - stylesheet.href = stylesheet.href.replace(/\?.*|$/, queryString) - - // use image hack to catch stylesheet load event - let img = document.createElement('img') - document.body.appendChild(img) - - img.onerror = img.onload = ()=>{ - img.onerror = img.onload = null - document.body.removeChild(img) - - if (++loaded === sheets.length) { - var root = widgetManager.getWidgetById('root')[0] - if (root) root.onPropChanged('colorWidget') - fastdom.measure(()=>{ - setGRIDWIDTH_CSS(parseInt(getComputedStyle(document.documentElement).getPropertyValue('--grid-width'))) - fastdom.mutate(()=>{ - editor.toggleGrid() - editor.toggleGrid() - }) - }) - updateMobileThemeColor(root) - } - } - - img.src = stylesheet.href - - - } - - }, - - reload: function(){ - - backup.save() - editor.unsavedSession = false - window.location.href = window.location.href - - }, - - notify: function(data) { - - var message = data.message || '' - - if (data.locale) message = locales(data.locale) + message - - notifications.add({ - icon: data.icon, - class: data.class, - message: message - }) - - }, - - setTitle: function(data) { - - if (ENV.title) return - - document.title = TITLE + (data ? ' (' + data + ')' : '') - - }, - - serverTargets: function(data) { - - if (data) osc.serverTargets = data - - } - -} diff --git a/src/client/libs/jquery.touch.js b/src/client/libs/jquery.touch.js new file mode 100644 index 00000000..d8f533d4 --- /dev/null +++ b/src/client/libs/jquery.touch.js @@ -0,0 +1,183 @@ +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function ($) { + + // Detect touch support + $.support.touch = 'ontouchend' in document; + + // Ignore browsers without touch support + if (!$.support.touch) { + return; + } + + var mouseProto = $.ui.mouse.prototype, + _mouseInit = mouseProto._mouseInit, + _mouseDestroy = mouseProto._mouseDestroy, + touchHandled; + + /** + * Simulate a mouse event based on a corresponding touch event + * @param {Object} event A touch event + * @param {String} simulatedType The corresponding mouse event + */ + function simulateMouseEvent (event, simulatedType) { + + // Ignore multi-touch events + if (event.originalEvent.touches.length > 1) { + return; + } + + event.preventDefault(); + + var touch = event.originalEvent.changedTouches[0], + simulatedEvent = document.createEvent('MouseEvents'); + + // Initialize the simulated mouse event using the touch event's coordinates + simulatedEvent.initMouseEvent( + simulatedType, // type + true, // bubbles + true, // cancelable + window, // view + 1, // detail + touch.screenX, // screenX + touch.screenY, // screenY + touch.clientX, // clientX + touch.clientY, // clientY + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 0, // button + null // relatedTarget + ); + + // osc: add a flag to prevent fast-click + simulatedEvent.touchPunch = true + + // Dispatch the simulated event to the target element + event.target.dispatchEvent(simulatedEvent); + } + + /** + * Handle the jQuery UI widget's touchstart events + * @param {Object} event The widget element's touchstart event + */ + mouseProto._touchStart = function (event) { + + var self = this; + + // Ignore the event if another widget is already being handled + if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { + return; + } + + // Set the flag to prevent other widgets from inheriting the touch event + touchHandled = true; + + // Track movement to determine if interaction was a click + self._touchMoved = false; + + // Simulate the mouseover event + simulateMouseEvent(event, 'mouseover'); + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + + // Simulate the mousedown event + simulateMouseEvent(event, 'mousedown'); + }; + + /** + * Handle the jQuery UI widget's touchmove events + * @param {Object} event The document's touchmove event + */ + mouseProto._touchMove = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Interaction was not a click + this._touchMoved = true; + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + }; + + /** + * Handle the jQuery UI widget's touchend events + * @param {Object} event The document's touchend event + */ + mouseProto._touchEnd = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Simulate the mouseup event + simulateMouseEvent(event, 'mouseup'); + + // Simulate the mouseout event + simulateMouseEvent(event, 'mouseout'); + + // If the touch interaction did not move, it should trigger a click + if (!this._touchMoved) { + + // Simulate the click event + simulateMouseEvent(event, 'click'); + } + + // Unset the flag to allow other widgets to inherit the touch event + touchHandled = false; + }; + + /** + * A duck punch of the $.ui.mouse _mouseInit method to support touch events. + * This method extends the widget with bound touch event handlers that + * translate touch events to mouse events and pass them to the widget's + * original mouse event handling methods. + */ + mouseProto._mouseInit = function () { + + var self = this; + + // Delegate the touch handlers to the widget's element + self.element.bind({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse init method + _mouseInit.call(self); + }; + + /** + * Remove the touch event handlers + */ + mouseProto._mouseDestroy = function () { + + var self = this; + + // Delegate the touch handlers to the widget's element + self.element.unbind({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse destroy method + _mouseDestroy.call(self); + }; + +})($); diff --git a/src/client/libs/jquery.ui.js b/src/client/libs/jquery.ui.js new file mode 100644 index 00000000..8ba8cd1d --- /dev/null +++ b/src/client/libs/jquery.ui.js @@ -0,0 +1,8 @@ +/*! jQuery UI - v1.12.0 - 2016-07-29 +* http://jqueryui.com +* Includes: widget.js, data.js, disable-selection.js, scroll-parent.js, widgets/draggable.js, widgets/resizable.js, widgets/sortable.js, widgets/mouse.js +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t($)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.0";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
      ",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var s=!1;t(document).on("mouseup",function(){s=!1}),t.widget("ui.mouse",{version:"1.12.0",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!s){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,n=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,s=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this._blurActiveElement(e),this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
      ").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);this._getHandle(e)&&s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
      ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show()) +}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
      "),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
      "),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.sortable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1 +}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}); diff --git a/src/client/locales/de.mjs b/src/client/locales/de.mjs deleted file mode 100644 index ecf7a2c0..00000000 --- a/src/client/locales/de.mjs +++ /dev/null @@ -1,141 +0,0 @@ -export default { - - // console - console: 'Konsole', - console_enabled: 'Aktiv', - console_clear: 'Konsole leeren', - - - // editor - editor: 'Editor', - editor_enabled: 'Aktiv', - editor_grid: 'Raster', - editor_tree: 'Projektbaum', - editor_inspector: 'Inspektor', - editor_percents: 'Relative Einheiten (%)', - - // editor context-menu - editor_show_in_tree: 'Zeige in Baum', - editor_show_in_session: 'Zeige in Sitzung', - editor_front: 'In den Vordergrund', - editor_closer: 'Eine Ebene nach vorne', - editor_back: 'In den Hintergrund', - editor_farther: 'Eine Ebene nach hinten', - editor_copy: 'Kopieren', - editor_cut: 'Ausschneiden', - editor_paste: 'Einfügen', - editor_pasteindent: 'ID + 1', - editor_clone: 'Duplizieren', - editor_addwidget: 'Widget hinzufügen', - editor_addtab: 'Tab hinzufügen', - editor_delete: 'Löschen', - - editor_fragment: 'Fragment', - editor_fragment_export: 'Export', - editor_fragment_import: 'Import', - - editor_ace_help: 'Hilfe', - editor_ace_help_title: 'Tastenkombinationen für den Code-Editor', - - // loadings - loading_upload: 'Datei wird hochgeladen…', - loading_newclient: 'Neuer Client verbindet sich…', - loading_server: 'Server verbinden…', - loading_session: 'Sitzung laden…', - - // file - file_open: 'Öffnen', - file_open_recent: 'Kürzlich geöffnet', - file_open_recent_wait: 'Liste noch nicht geladen, bitte schließen Sie das Menü und öffnen Sie es erneut', - file_save: 'Speichern', - file_save_as: 'Speichern unter…', - file_backup: 'Backup speichern', - file_import: 'Importieren', - file_export: 'Exportieren', - - // keyboard - keyboard: 'Virtuelle Tastatur', - keyboard_layout: { - default: [ - '{esc} ` 1 2 3 4 5 6 7 8 9 0 - = {zrck}', - '{tab} q w e r t z u i o p [ ] \\', - '{lock} a s d f g h j k l ; \' {enter}', - '{shift} z x c v b n m , . / {shift}', - '{leer}' - ], - shift: [ - '{esc} ~ ! @ # $ % ^ & * ( ) _ + {zrck}', - '{tab} Q W E R T Y U I O P { } |', - '{lock} A S D F G H J K L : " {enter}', - '{shift} Z X C V B N M < > ? {shift}', - '{leer}' - ] - }, - keyboard_escape: 'Esc', - - // fragment mode - fragment_mode: 'Fragment Modus', - fragment_mode_warning: 'Fragment Modus aktiviert', - fragment_mode_explanation: 'Die Sitzung wird als Fragment gespeichert: nur das erste untergeordnete Element von root wird gespeichert.', - - // fullscreen - fullscreen: 'Vollbild', - fullscreen_unnavailable: 'Vollbild nicht verfügbar', - fullscreen_addtohome: 'Sie müssen diese Seite zu Ihrem Startbildschirm hinzufügen, um sie im Vollbildmodus zu starten', - - // inspector - inspector_error: 'Es ist ein Fehler aufgetreten. Öffne die Konsole, um mehr zu lesen.', - inspector_zoom_in: 'Vergrößern', - inspector_zoom_reset: 'Zoom zurücksetzen', - inspector_zoom_ou: 'Verkleinern', - inspector_reset_selection: 'Widget(s) abwählen', - inspector_toggle_grid: 'Raster ein-/ausblenden', - - // nosleep - nosleep: 'Prevent sleep', - - // notifications - notifications: 'Benachrichtigungen', - - // remote save - remotesave_open: 'Öffnen (auf dem Server)', - remotesave_save: 'Speichern (auf dem Server)', - remotesave_overwrite: 'Diese Datei existiert bereits, möchtest du sie überschreiben?', - remotesave_fail: 'Die Datei konnte nicht auf dem Server gespeichert werden, verwende stattdessen "export".', - remotesave_success: 'Datei erfolgreich gespeichert', - remotesave_forbidden: 'Speichern auf dem Server nicht möglich, verwende stattdessen "exportieren".', - - // server - server_disconnected: 'Die Verbindung zum Server ist unterbrochen worden', - server_connected: 'Die Verbindung zum Server wurde wiederhergestellt', - - // session - session: 'Sitzung', - session_new: 'Neue Sitzung', - session_malformed: 'Fehlerhafte Sitzungsdatei.', - session_parsingerror: 'Fehler beim Parsing.', - session_uploaderror: 'Hochladen der Sitzungsdatei fehlgeschlagen.', - session_unsaved: 'Die Änderungen gehen verloren, wenn du diese Sitzung schließt, ohne zu speichern. Fortfahren?', - session_oldversion_title: 'Warnung', - session_oldversion: 'Diese Sitzung wurde mit einer älteren Version dieser Software erstellt - eine automatische Konvertierung wurde durchgeführt. Nach dem Speichern wird diese Sitzung wahrscheinlich nicht korrekt mit älteren Versionen geladen, es wird empfohlen, eine Sicherungskopie davon zu erstellen.', - - // state - state: 'Status', - state_store: 'Laden', - state_recall: 'Abrufen', - state_send: 'Alle senden', - state_import: 'Import', - state_export: 'Export', - state_uploaderror: 'Hochladen der Statusdatei fehlgeschlagen.', - state_storesuccess: 'Status gespeichert', - state_recallsuccess: 'Status abgerufen', - state_sendsuccess: 'Status gesendet', - - // tree - tree_filter: 'Filter', - - // misc - error: 'Error' - - -} diff --git a/src/client/locales/en.mjs b/src/client/locales/en.mjs deleted file mode 100644 index 99b6531f..00000000 --- a/src/client/locales/en.mjs +++ /dev/null @@ -1,141 +0,0 @@ -export default { - - // console - console: 'Console', - console_enabled: 'Enabled', - console_clear: 'Clear console', - - - // editor - editor: 'Editor', - editor_enabled: 'Enabled', - editor_grid: 'Grid', - editor_tree: 'Project tree', - editor_inspector: 'Inspector', - editor_percents: 'Relative units (%)', - - // editor context-menu - editor_show_in_tree: 'Show in tree', - editor_show_in_session: 'Show in session', - editor_front: 'Bring to front', - editor_closer: 'Bring closer', - editor_back: 'Send to back', - editor_farther: 'Send farther', - editor_copy: 'Copy', - editor_cut: 'Cut', - editor_paste: 'Paste', - editor_pasteindent: 'ID + 1', - editor_clone: 'Clone', - editor_addwidget: 'Add widget', - editor_addtab: 'Add tab', - editor_delete: 'Delete', - - editor_fragment: 'Fragment', - editor_fragment_export: 'Export', - editor_fragment_import: 'Import', - - editor_ace_help: 'Help', - editor_ace_help_title: 'Code editor keyboard shortcuts', - - // loadings - loading_upload: 'Uploading file…', - loading_newclient: 'New client connecting…', - loading_server: 'Connecting server…', - loading_session: 'Loading session…', - - // file - file_open: 'Open', - file_open_recent: 'Open recent', - file_open_recent_wait: 'List not loaded yet, please close and reopen the menu', - file_save: 'Save', - file_save_as: 'Save as…', - file_backup: 'Save backup', - file_import: 'Import', - file_export: 'Export', - - // keyboard - keyboard: 'Virtual keyboard', - keyboard_layout: { - default: [ - '{esc} ` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', - '{tab} q w e r t y u i o p [ ] \\', - '{lock} a s d f g h j k l ; \' {enter}', - '{shift} z x c v b n m , . / {shift}', - '{space}' - ], - shift: [ - '{esc} ~ ! @ # $ % ^ & * ( ) _ + {bksp}', - '{tab} Q W E R T Y U I O P { } |', - '{lock} A S D F G H J K L : " {enter}', - '{shift} Z X C V B N M < > ? {shift}', - '{space}' - ] - }, - keyboard_escape: 'Esc', - - // fragment mode - fragment_mode: 'Fragment mode', - fragment_mode_warning: 'Fragment mode enabled', - fragment_mode_explanation: 'The session will be saved as a fragment: only the first child of root will be saved.', - - // fullscreen - fullscreen: 'Fullscreen', - fullscreen_unnavailable: 'Fullscreen not available', - fullscreen_addtohome: 'You must add this page to your home screen to launch it in fullscreen', - - // inspector - inspector_error: 'An error just occurred, open the console to read more.', - inspector_zoom_in: 'Zoom in', - inspector_zoom_reset: 'Reset zoom', - inspector_zoom_ou: 'Zoom out', - inspector_reset_selection: 'Unselect widget(s)', - inspector_toggle_grid: 'Show/hide the grid', - - // nosleep - nosleep: 'Prevent sleep', - - // notifications - notifications: 'Notifications', - - // remote save - remotesave_open: 'Open (on the server)', - remotesave_save: 'Save (on the server)', - remotesave_overwrite: 'This file already exists, do you want to overwrite it?', - remotesave_fail: 'The file could not be saved on the server, use "export" instead', - remotesave_success: 'File saved successfully', - remotesave_forbidden: 'You\'re note allowed to save on server, use "export" instead', - - // server - server_disconnected: 'The connection to the server has been interrupted', - server_connected: 'The connection to the server has been restored', - - // session - session: 'Session', - session_new: 'New session', - session_malformed: 'Malformed session file.', - session_parsingerror: 'Parsing error.', - session_uploaderror: 'Failed to upload session file.', - session_unsaved: 'Your changes will be lost if you close this session without saving, continue?', - session_oldversion_title: 'Warning', - session_oldversion: 'This session was created with an older version of this software, an automatic conversion has been done. Once saved, this session will probably not load correctly with older versions, it is recommended to make a backup copy of it.', - - // state - state: 'State', - state_store: 'Store', - state_recall: 'Recall', - state_send: 'Send All', - state_import: 'Import', - state_export: 'Export', - state_uploaderror: 'Failed to upload state file.', - state_storesuccess: 'State saved', - state_recallsuccess: 'State recalled', - state_sendsuccess: 'State sent', - - // tree - tree_filter: 'Filter', - - // misc - error: 'Error' - - -} diff --git a/src/client/locales/fr.mjs b/src/client/locales/fr.mjs deleted file mode 100644 index 05f6c9b3..00000000 --- a/src/client/locales/fr.mjs +++ /dev/null @@ -1,141 +0,0 @@ -export default { - - // console - console: 'Console', - console_enabled: 'Activée', - console_clear: 'Vider la console', - - // editor - editor: 'Editeur', - editor_enabled: 'Activé', - editor_grid: 'Grille', - editor_tree: 'Arborescence', - editor_inspector: 'Inspecteur', - editor_percents: 'Unités relatives (%)', - - // editor context-menu - editor_show_in_tree: 'Voir dans l\'arborescence', - editor_show_in_session: 'Voir dans la session', - editor_front: 'Amener devant', - editor_closer: 'Amener plus près', - editor_back: 'Envoyer à l\'arrière', - editor_farther: 'Envoyer plus loin', - editor_copy: 'Copier', - editor_cut: 'Couper', - editor_paste: 'Coller', - editor_pasteindent: 'ID + 1', - editor_clone: 'Clone', - editor_addwidget: 'Ajouter widget', - editor_addtab: 'Ajouter onglet', - editor_delete: 'Supprimer', - - editor_fragment: 'Fragment', - editor_fragment_export: 'Exporter', - editor_fragment_import: 'Importer', - - editor_ace_help: 'Aide', - editor_ace_help_title: 'Raccourcis claviers de l\'éditeur', - - // loadings - loading_upload: 'Téléversement…', - loading_newclient: 'Connexion d\'un nouveau client…', - loading_server: 'Connexion au serveur…', - loading_session: 'Chargement de la session…', - - // file - file_open: 'Ouvrir', - file_open_recent: 'Récemment ouvert(s)', - file_open_recent_wait: 'Liste non chargée, veuillez fermer puis ouvrir le menu à nouveau', - file_save: 'Enregistrer', - file_save_as: 'Enregistrer sous…', - file_backup: 'Enregistrer une sauvegarde', - file_import: 'Importer', - file_export: 'Exporter', - - // keyboard - keyboard: 'Clavier virtuel', - keyboard_layout: { - default: [ - '{esc} \u00B2 & \u00E9 \" \' ( - \u00E8 _ \u00E7 \u00E0 ) = {bksp}', - '{tab} a z e r t y u i o p ^ $', - '{lock} q s d f g h j k l m \u00F9 * {enter}', - '{shift} < w x c v b n , ; : ! {shift}', - '{space}', - ], - shift: [ - '{esc} ` 1 2 3 4 5 6 7 8 9 0 \u00B0 + {bksp}', - '{tab} A Z E R T Y U I O P \u00A8 \u00A3', - '{lock} Q S D F G H J K L M % \u00B5 {enter}', - '{shift} > W X C V B N ? . / \u00A7 {shift}', - '{space}' - ] - }, - keyboard_escape: 'Échap', - - // fullscreen - fullscreen: 'Plein écran', - fs_unnavailable: 'Plein écran indisponible', - fs_addtohome: 'Vous devez ajouter cette page à votre écran d\'accueil pour pouvoir l\'ouvrir en plein écran.', - - // fragment mode - fragment_mode: 'Mode fragment', - fragment_mode_warning: 'Mode fragment activé', - fragment_mode_explanation: 'La session sera enregistrée sous forme de fragment : seul le premier descendant de l\'élément root sera sauvegardé.', - - // inspector - inspector_error: 'Une erreur vient de survenir, ouvrez la console pour en savoir plus.', - inspector_zoom_in: 'Zoom avant', - inspector_zoom_reset: 'Zoom initial', - inspector_zoom_out: 'Zoom arrière', - inspector_reset_selection: 'Déséléctionner', - inspector_toggle_grid: 'Afficher / masquer la grille', - - - // nosleep - nosleep: 'Empêcher la veille', - - // notifications - notifications: 'Notifications', - - // remote save - remotesave_open: 'Ouvrir (sur le serveur)', - remotesave_save: 'Enregistrer (sur le serveur)', - remotesave_overwrite: 'Un fichier du même nom existe déjà, voulez le remplacer ?', - remotesave_fail: 'Le fichier n\'a pas pu être enregistré sur le serveur, utilisez la fonction "exporter"', - remotesave_success: 'Le fichier a été enregistré avec succès', - remotesave_forbidden: 'Vous n\'êtes pas autorisé à sauvegarder sur le serveur, utilisez la fonction "exporter"', - - // server - server_disconnected: 'La connexion avec le serveur a été interrompue', - server_connected: 'La connexion avec le serveur a été rétablie', - - // session - session: 'Session', - session_new: 'Nouvelle session', - session_malformed: 'Fichier de session mal formé.', - session_parsingerror: 'Erreur à l\'ouverture de la session.', - session_uploaderror: 'Échec à l\'envoi du fichier de session.', - session_unsaved: 'Vos modifications seront perdues si vous fermez la session actuelle sans sauvegarder, continuer ?', - session_oldversion_title: 'Attention', - session_oldversion: 'Cette session a été créée avec une ancienne version de ce logiciel, une conversion automatique a été appliquée. Une fois sauvegardée, cette session risque de ne plus charger correctement avec les anciennes versions, il est recommandé d\'en faire une copie de sauvegarde.', - - // state - state: 'État', - state_store: 'Sauver', - state_recall: 'Rappeler', - state_send: 'Envoyer', - state_import: 'Importer', - state_export: 'Exporter', - state_uploaderror: 'Échec à l\'envoi du fichier d\'état.', - state_storesuccess: 'État de l\'interface sauvegardé', - state_recallsuccess: 'État de l\'interface restauré', - state_sendsuccess: 'État de de l\'interface envoyé', - - // tree - tree_filter: 'Filtrer', - - // misc - error: 'Erreur' - - -} diff --git a/src/client/locales/index.mjs b/src/client/locales/index.mjs deleted file mode 100644 index 3f8920f7..00000000 --- a/src/client/locales/index.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import en from './en.mjs' -import fr from './fr.mjs' -import de from './de.mjs' -import pl from './pl.mjs' -import {LANG} from '../globals.mjs' - -var locales = { - en, fr, de, pl, - debug: { - /* empty */ - keyboard_layout: en.keyboard_layout - } -} - -var lang = locales[LANG] ? LANG : 'en' - -export default key=>locales[lang][key] || `!${key}!` diff --git a/src/client/locales/pl.mjs b/src/client/locales/pl.mjs deleted file mode 100644 index 059f7cc7..00000000 --- a/src/client/locales/pl.mjs +++ /dev/null @@ -1,141 +0,0 @@ -export default { - - // console - console: 'Terminal', - console_enabled: 'Włączony', - console_clear: 'Wyczyść terminal', - - - // editor - editor: 'Edytor', - editor_enabled: 'Włączony', - editor_grid: 'Siatka', - editor_tree: 'Drzewo projekty', - editor_inspector: 'Inspektor', - editor_percents: 'Jednostki względne (%)', - - // editor context-menu - editor_show_in_tree: 'Pokaż w drzewie', - editor_show_in_session: 'Pokaż w sesji', - editor_front: 'Przenieś na pierwszy plan', - editor_closer: 'Przenieś wyżej', - editor_back: 'Przenieś na ostatni plan', - editor_farther: 'Przenieś niżej', - editor_copy: 'Kopiuj', - editor_cut: 'Wytnij', - editor_paste: 'Wklej', - editor_pasteindent: 'Wklej i zwiększ ID o 1', - editor_clone: 'Sklonuj', - editor_addwidget: 'Dodaj widget', - editor_addtab: 'Dodaj kartę', - editor_delete: 'Usuń', - - editor_fragment: 'Fragment', - editor_fragment_export: 'Eksportuj', - editor_fragment_import: 'Importuj', - - editor_ace_help: 'Pomoc', - editor_ace_help_title: 'Skróty klawiszowe edytora kodu', - - // loadings - loading_upload: 'Wysyłanie pliku…', - loading_newclient: 'Nowy klient podłączony…', - loading_server: 'Podłączanie do serwera…', - loading_session: 'Wczytywanie sesji…', - - // file - file_open: 'Otwórz', - file_open_recent: 'Ostatnio otwierane', - file_open_recent_wait: 'Lista nie jest jeszcze załadowana, zamknij i otwórz ponownie to menu', - file_save: 'Zapisz', - file_save_as: 'Zapisz jako…', - file_backup: 'Zapisz kopię zapasową', - file_import: 'Importuj', - file_export: 'Eksportuj', - - // keyboard - keyboard: 'Klawiatura wirtualna', - keyboard_layout: { - default: [ - '{esc} ` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', - '{tab} q w e r t y u i o p [ ] \\', - '{lock} a s d f g h j k l ; \' {enter}', - '{shift} z x c v b n m , . / {shift}', - '{space}' - ], - shift: [ - '{esc} ~ ! @ # $ % ^ & * ( ) _ + {bksp}', - '{tab} Q W E R T Y U I O P { } |', - '{lock} A S D F G H J K L : " {enter}', - '{shift} Z X C V B N M < > ? {shift}', - '{space}' - ] - }, - keyboard_escape: 'Esc', - - // fragment mode - fragment_mode: 'Tryb fragmentów', - fragment_mode_warning: 'Tryb fragmentów włączony', - fragment_mode_explanation: 'Ta sesja zostanie zapisana jako fragment: tylko pierwsze dziecko roota zostanie zapisane.', - - // fullscreen - fullscreen: 'Tryb pełnoekranowy', - fullscreen_unnavailable: 'Tryb pełnoekranowy niedostęĻny', - fullscreen_addtohome: 'Musisz dodać tę stronę do Twojego ekranu domowego by otworzyć ja w trybie pełnoekranowym', - - // inspector - inspector_error: 'Wystąpił błąd, otwórz terminal by dowiedzieć się więcej.', - inspector_zoom_in: 'Przybliż', - inspector_zoom_reset: 'Domyślny stopień przybliżenia', - inspector_zoom_ou: 'Oddal', - inspector_reset_selection: 'Odznacz widget(y)', - inspector_toggle_grid: 'Pokaż/ukryj siatkę', - - // nosleep - nosleep: 'Nie pozwalaj na uśpienie ekranu', - - // notifications - notifications: 'Powiadomienia', - - // remote save - remotesave_open: 'Otwórz (na serwerze)', - remotesave_save: 'Sapisz (na serwerze)', - remotesave_overwrite: 'Ten plik już istnieje, czy chcesz go nadpisać?', - remotesave_fail: 'Ten plik nie mógł zostać zapisany na serwerze, użyj eksportu', - remotesave_success: 'Plik zapisany pomyślnie', - remotesave_forbidden: 'Nie masz uprawnień do zapisania pliku na serwerze, użyj eksportu', - - // server - server_disconnected: 'Połączenie z serwerem zostało przerwane', - server_connected: 'Połączenie z serwerem zostało nawiązane', - - // session - session: 'Sesja', - session_new: 'Nowa sesja', - session_malformed: 'Niewłaściwy plik sesji.', - session_parsingerror: 'Błąd parsowania pliku sesji.', - session_uploaderror: 'Nie udało się przesłać pliku sesji.', - session_unsaved: 'Jeśli zamkniesz tę sesję bez uprzedniego zapisu, wprowadzone zmiany zostaną utracone. Czy chcesz kontynuować?', - session_oldversion_title: 'Ostrzeżenie', - session_oldversion: 'Ta sesja została stworzona przy użyciu starszej wersji tego oprogramowania - dokonano automatycznej konwersji. Po zapisaniu, sesja ta prawdopodobnie nie będzie ładować się poprawnie ze starszymi wersjami, zaleca się wykonanie kopii bezpieczeństwa.', - - // state - state: 'Stan', - state_store: 'Zachowaj', - state_recall: 'Przywołaj', - state_send: 'Wyślij wszystkie', - state_import: 'Importuj', - state_export: 'Eksportuj', - state_uploaderror: 'Nie udało się przesłać pliku stanu.', - state_storesuccess: 'Zapisano stan', - state_recallsuccess: 'Przywołano stan', - state_sendsuccess: 'Wysłano stan', - - // tree - tree_filter: 'Filtruj', - - // misc - error: 'Błąd' - - -} diff --git a/src/client/managers/cache.mjs b/src/client/managers/cache.mjs deleted file mode 100644 index 1d1cee77..00000000 --- a/src/client/managers/cache.mjs +++ /dev/null @@ -1,71 +0,0 @@ -var keyPrefix = 'osc.' - -class Cache { - - set(key, value, persistent = true) { - - try { - - var storage = persistent ? localStorage : sessionStorage - - storage.setItem(keyPrefix + key, JSON.stringify(value)) - - } catch(e){ - console.error(`Could not write to ${persistent ? 'localStorage' : 'sessionStorage'}: ${e}`) - console.debug(e) - } - - - } - - get(key, persistent = true) { - - try { - - var storage = persistent ? localStorage : sessionStorage - - return JSON.parse(storage.getItem(keyPrefix + key)) - - } catch(e){ - console.error(`Could not read from ${persistent ? 'localStorage' : 'sessionStorage'}: ${e}`) - console.debug(e) - return null - } - - } - - remove(key, persistent = true) { - - var storage = persistent ? localStorage : sessionStorage - - storage.removeItem(keyPrefix + key) - - } - - clear(domain) { - - if (domain) { - - for (let storage of [localStorage, sessionStorage]) { - - for (let k in storage) { - if (k.indexOf(keyPrefix + domain) === 0) { - storage.removeItem(k) - } - } - - } - - - } else { - - localStorage.clear() - sessionStorage.clear() - - } - - } - -} - -export default new Cache() diff --git a/src/client/managers/session/index.mjs b/src/client/managers/session/index.mjs deleted file mode 100644 index 80fc4d16..00000000 --- a/src/client/managers/session/index.mjs +++ /dev/null @@ -1,298 +0,0 @@ -import {saveAs} from 'file-saver' -import ipc from '../../ipc/index.mjs' -import parser from '../../parser.mjs' -import editor from '../../editor/index.mjs' -import uiFilebrowser from '../../ui/ui-filebrowser.mjs' -import uiFileupload from '../../ui/ui-fileupload.mjs' -import UiModal from '../../ui/ui-modal.mjs' -import uiLoading from '../../ui/ui-loading.mjs' -import uiConsole from '../../ui/ui-console' -import widgetManager from '../widgets.mjs' -import locales from '../../locales/index.mjs' -import Session from './session.mjs' -import EventEmitter from '../../events/event-emitter.mjs' -import {deepEqual} from '../../utils.mjs' -import {DOM, READ_ONLY, PACKAGE, CLIENT_SYNC} from '../../globals.mjs' - -var SessionManager = class SessionManager extends EventEmitter { - - constructor() { - - super() - - this.session = null - this.saveMode = 'session' - this.fragments = {} - this.lock = false - this.lastDir = null - this.setSessionPath('') - - ipc.on('connect', ()=>{ - ipc.send('sessionSetPath', {path: this.sessionPath}) - }) - - } - - load(session, callback) { - - if (this.lock) return - - this.lock = true - - var container = DOM.get('#osc-container')[0] - - uiLoading(locales('loading_session')) - - setTimeout(()=>{ - try { - - uiConsole.clear() - this.session = new Session(session, 'session') - container.innerHTML = '' - parser.reset() - parser.parse({ - data: this.session.getRoot(), - parentNode: DOM.get('#osc-container')[0], - parent: widgetManager - }) - editor.clearHistory() - editor.widgetTree.filter.value = '' - DOM.get(document, '#osc-greeting-header')[0].classList.add('hidden') - this.setSaveMode(this.session.isFragment ? 'fragment' : 'session') - - } catch (err) { - uiLoading(false) - new UiModal({title: locales('session_parsingerror'), content: err.message, icon: 'exclamation-triangle', closable:true}) - this.lock = false - ipc.send('sessionSetPath', {path: this.sessionPath}) - throw err - } - - for (var h in widgetManager.widgets) { - if (widgetManager.widgets[h].value !== undefined) { - widgetManager.trigger('value-changed', { - widget: widgetManager.widgets[h], - id: widgetManager.widgets[h].getProp('id'), - linkId: widgetManager.widgets[h].getProp('linkId'), - options: {} - }) - } - } - - if (editor.enabled) { - editor.disable() - editor.enable() - } - - DOM.dispatchEvent(window, 'resize') - - setTimeout(()=>{ - uiLoading(false) - this.lock = false - editor.unsavedSession = false - this.setSessionPath('') - if (callback) callback() - }, 25) - - }, 25) - - } - - save(path, backup=false) { - - if (!this.session || READ_ONLY) return - - if (path) this.setSessionPath(path) - - if (editor.inspector.focusedInput) { - editor.inspector.onChange() - } - - if (!this.sessionPath) return this.saveAs() - - if (this.saveMode === 'session') { - - ipc.send('sessionSave', { - session: this.session.toJSON(), - path: this.sessionPath, - backup: backup - }) - - } else { - - var data = this.session.data.content.widgets.length ? - this.session.data.content.widgets[0] : - this.session.data.content.tabs[0] - - ipc.send('sessionSave', { - session: new Session({ - content: data, - version: PACKAGE.version - }, 'fragment'), - path: this.sessionPath, - backup: backup - }) - - } - - } - - saveBackup() { - this.save('', true) - } - - saveAs() { - - if (!this.session || READ_ONLY) return - - uiFilebrowser({extension: 'json', save:true, directory: this.lastDir}, (path)=>{ - this.lastDir = path[0] - this.save(path) - }) - - } - - export() { - - var sessionfile = this.session.toJSON(), - blob = new Blob([sessionfile],{type : 'application/json'}) - - saveAs(blob, new Date().toJSON().slice(0,10)+'_'+new Date().toJSON().slice(11,16) + '.json') - - editor.unsavedSession = false - - } - - open(data) { - - this.load(data.fileContent, ()=>{ - this.setSessionPath(data.path) - ipc.send('sessionOpened', {path: data.path, sync: CLIENT_SYNC}) - }) - - } - - requestOpen(path) { - - ipc.send('sessionOpen', {path: path}) - - } - - browse() { - - if (READ_ONLY) return - - uiFilebrowser({extension: 'json', directory: this.lastDir}, (path)=>{ - if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return - this.lastDir = path[0] - this.requestOpen(path) - }) - - } - - import() { - - if (READ_ONLY) return - - uiFileupload('.json', (path, result)=>{ - var session - try { - session = JSON.parse(result) - } catch (err) { - new UiModal({title: locales('session_parsingerror'), content: err.message, icon: 'exclamation-triangle', closable:true}) - } - if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return - if (session) sessionManager.load(session, ()=>{ - ipc.send('sessionSetPath', {path: 'imported'}) - }) - - }, ()=>{ - new UiModal({title: locales('error'), content: locales('session_uploaderror'), icon: 'exclamation-triangle', closable:true}) - }) - - } - - create() { - - if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return - - this.load(null, ()=>{ - ipc.send('sessionSetPath', {path: ''}) - editor.enable() - editor.select(widgetManager.getWidgetById('root')) - }) - } - - setSessionPath(path) { - - this.sessionPath = path - - } - - setFragment(data) { - - var {path, fileContent, raw, notFound} = data, - update = false - - if (notFound) { - this.trigger('fragment-not-found', {path: path}) - return - } - - if (raw) { - if (this.fragments[path] !== fileContent) { - this.fragments[path] = fileContent - update = true - } - } else { - var fragment = new Session(fileContent, 'fragment') - if (!deepEqual(this.fragments[path], fragment)) { - this.fragments[path] = fragment - update = true - } - } - - if (update) this.trigger('fragment-updated', {path: path}) - - - } - - getFragment(path, data) { - - return this.fragments[path] - - } - - saveFragment(data) { - - uiFilebrowser({extension: 'json', save:true, directory: this.lastDir}, (path)=>{ - this.lastDir = path[0] - ipc.send('sessionSave', { - session: new Session({ - content: data, - version: PACKAGE.version - }, 'fragment'), - path: path - }) - }) - - } - - loadFragment(path, raw=false) { - - ipc.send('fragmentLoad', {path, raw}) - - } - - setSaveMode(mode) { - - this.saveMode = mode - document.body.classList.toggle('fragment-mode', mode === 'fragment') - - } - -} - -var sessionManager = new SessionManager() - -export default sessionManager diff --git a/src/client/managers/session/session.mjs b/src/client/managers/session/session.mjs deleted file mode 100644 index 0a8eff48..00000000 --- a/src/client/managers/session/session.mjs +++ /dev/null @@ -1,351 +0,0 @@ -import semver from 'semver' -import UiModal from '../../ui/ui-modal.mjs' -import locales from '../../locales/index.mjs' -import {PACKAGE} from '../../globals.mjs' - -class Session { - - constructor(data, type) { - - if (data === null) { - - data = { - content: {type: 'root'} - } - - - } else { - - var version = data.version || '0.0.0', - warning = false - - for (var converter of converters) { - - if (semver.lte(version, converter.version)) { - - if (converter.global) data = converter.global(data) - if (converter.widget) this.applyConvert(data.session || data.content, converter.widget) - - if (converter.warning && type !== 'fragment') warning = true - - } - - } - - - if (warning) { - - new UiModal({title: locales('session_oldversion_title'), content: locales('session_oldversion'), icon: 'exclamation-triangle', closable:true}) - - } - - } - - - - if (type === 'session' && data.type === 'fragment') { - // opening fragment as a session - if (data.content.type === 'tab') { - data.content = {type: 'root', tabs: [data.content]} - } else { - data.content = {type: 'root', widgets: [data.content]} - } - this.isFragment = true - } - - if (type === 'fragment' && data.type === 'session') { - // opening session as a fragment - data.content.type = 'panel' - } - - data.createdWith = PACKAGE.productName - data.version = PACKAGE.version - if (type) data.type = type - - // push content to end of file - var c = data.content - delete data.content - data.content = c - - this.data = data - - } - - applyConvert(data, convert) { - - convert(data) - - if (data.widgets) { - for (let c of data.widgets) { - this.applyConvert(c, convert) - } - } - - if (data.tabs) { - for (let c of data.tabs) { - this.applyConvert(c, convert) - } - } - - } - - getRoot() { - - return this.data.content - - } - - toJSON() { - - return JSON.stringify(this.data, null, ' ') - - } - -} - -var converters = [ - { - version: '0.49.12', - warning: true, - global: (data)=>{ - - if (Array.isArray(data)) data = data[0] - - return { - session: data - } - }, - widget: (data)=>{ - - data.decimals = data.precision - - if (data.precision === 0) { - data.typeTags = 'i' - data.decimals = 0 - } - if (data.color !== 'auto') data.colorWidget = data.color - - switch (data.type) { - - case 'toggle': - data.type = 'button' - data.mode = 'toggle' - break - - case 'push': - data.type = 'button' - data.mode = data.norelease ? 'tap' : 'push' - break - - case 'fader': - data.design = data.compact ? 'compact' : 'default' - break - - case 'meter': - data.type = 'fader' - data.design = 'compact' - data.interaction = false - break - - - case 'tab': - case 'panel': - case 'root': - if (data.widgets && data.widgets.length) { - data.innerPadding = false - data.padding = 0 - data.alphaStroke = 0 - } - break - - case 'strip': - data.type = 'panel' - data.layout = data.horizontal ? 'horizontal' : 'vertical' - data.alphaStroke = 0 - if (data.spacing) { - data.padding = data.spacing - } else { - data.innerPadding = false - data.padding = 0 - } - break - - case 'matrix': - - - data.layout = 'grid' - if (Array.isArray(data.matrix) && data.matrix.every(x=>typeof x === 'number')) { - data.quantity = data.matrix[0] * data.matrix[1] - data.gridTemplate = data.matrix[0] - } - - - var oprops = typeof data.props === 'object' && data.props !== null - - switch (data.widgetType) { - case 'toggle': - data.widgetType = 'button' - if (oprops) data.props.mode = 'toggle' - break - - case 'push': - data.widgetType = 'button' - if (oprops) data.props.mode = data.props.norelease ? 'tap' : 'push' - break - - case 'fader': - if (oprops) data.props.design = data.props.compact ? 'compact' : 'default' - break - - case 'meter': - data.widgetType = 'fader' - if (oprops) { - data.props.design = 'compact' - data.props.interaction = false - } - break - - case 'strip': - data.widgetType = 'panel' - if (oprops) data.props.layout = data.props.horizontal ? 'horizontal' : 'vertical' - break - } - break - case 'eq': - data.filters = data.value - data.value = '' - break - - case 'keys': - data.type = 'script' - data.event = 'keyboard' - data.keyRepeat = data.repeat - data.keyBinding = data.binding - data.keyType = data.keyDown && data.keyUp ? 'both' : data.keyUp ? 'keyup' : 'keydown' - data.script = ` - // converted from keys widget data - if (type === 'keyup') { - ${String(data.keyUp).trim().replace(/JS\{\{(.*)\}\}/s, '$1').trim()} - } else if (type === 'keydown') { - ${String(data.keyDown).trim().replace(/JS\{\{(.*)\}\}/s, '$1').trim()} - } - ` - break - case 'script': - data.script = String(data.script).trim().replace(/JS\{\{(.*)\}\}/s, '$1').trim() - break - - } - - var label = data.label === undefined ? 'auto' : data.label - if (label !== false && data.type && data.type && !data.type.match(/button|menu|modal|clone|html|tab/)) { - label = label === 'auto' ? '@{this.id}' : label - data.html = label - } - - } - }, - { - version: '1.3.0', - widget: (data)=>{ - - switch (data.type) { - - case 'fader': - case 'knob': - case 'xy': - case 'range': - case 'multixy': - if (data.touchAddress && String(data.touchAddress).length) { - let sendScript = data.type.match(/range|multixy/) ? 'if (touch.length) send(address, touch[0], touch[1])\n else send(address, touch)' : 'send(address, touch)', - originalScript = data.script ? ` else {\n // original script\n ${data.script}\n // -----------\n}` : '' - data.script = `\nif (touch !== undefined) {\n // generated automatically\n // from touchAddress\n var address = "${data.touchAddress}"\n ${sendScript}\n}${originalScript}` - } - break - - } - - } - }, - { - version: '1.6.2', - widget: (data)=>{ - - if (data.script && String(data.script).includes('toolbar(')) { - // new "console" submenu in toolbar at index 3 - data.script = String(data.script).replace('toolbar(4)', 'toolbar(5)').replace('toolbar(3)', 'toolbar(4)') - } - - } - }, - { - version: '1.8.15', - global: (data)=>{ - - data.content = data.session - delete data.session - return data - - } - }, - { - version: '1.13.2', - warning: true, - widget: (data)=>{ - - if (data.script !== undefined) { - if (data.type === 'script') { - if (data.event === 'once') { - data.onCreate = data.script - } else if (data.event === 'keyboard') { - data.onKeyboard = data.script - } else if (data.event === 'value') { - data.onValue = data.script - } - } else { - data.onValue = data.script - } - } - if (data.type === 'canvas') { - if (data.draw !== undefined) data.onDraw = data.draw - if (data.touch !== undefined) data.onTouch = data.touch - } - - } - }, - { - version: '1.23.0', - widget: (data)=>{ - if (data.type === 'patchbay' && data.exclusive === true) { - data.exclusive = 'in' - } - else if ((data.type === 'panel' || data.type === 'root') && data.verticalTabs === true) { - data.tabsPosition = 'left' - delete data.verticalTabs - } - } - }, - { - version: '1.24.2', - widget: (data)=>{ - if (data.type === 'menu') { - if (data.toggle) { - data.mode = data.doubleTap ? 'toggle' : 'doubleTap-toggle' - } else if (data.doubleTap) { - data.mode = 'doubleTap' - } else { - data.mode = 'default' - } - delete data.toggle - delete data.doubleTap - } - } - } -] - -Session.converters = {} -for (var i in converters) { - Session.converters[converters[i].version] = converters[i] -} - -export default Session diff --git a/src/client/osc.mjs b/src/client/osc.mjs deleted file mode 100644 index 08223ccb..00000000 --- a/src/client/osc.mjs +++ /dev/null @@ -1,94 +0,0 @@ -import widgetManager from './managers/widgets.mjs' -import EventEmitter from './events/event-emitter.mjs' -import ipc from './ipc/index.mjs' -import {deepEqual} from './utils.mjs' -import {CLIENT_SYNC} from './globals.mjs' - -var Osc = class Osc extends EventEmitter { - - constructor() { - - super() - - this.syncOnly = false - this.remoteControl = {} - this.serverTargets = [] - - ;(async()=>{ - this.remoteControl = (await import('./remote-control.mjs')).default - })() - - } - - send(data) { - - if (this.syncOnly) { - - this.sync(data) - - } else { - - if (!CLIENT_SYNC) data.noSync = 1 - - ipc.send('sendOsc', data) - - } - - } - - sync(data) { - - if (CLIENT_SYNC) ipc.send('syncOsc', data) - - } - - match(widget, data) { - - let widgetTarget = widget.getProp('target'), - match = true - - if (data._rawTarget) { - // if the message target is provided (when message comes from another client connected to the same server) - // then we only update the widgets that have the exact same target - match = deepEqual(widgetTarget, data._rawTarget) - - } else if (data.host === 'midi') { - // if the message comes from a midi port, only update widgets that send to that port - let widgetArrayTarget = Array.isArray(widgetTarget) ? widgetTarget : [widgetTarget], - strTarget = data.host + ':' + data.port - - match = widgetArrayTarget.includes(strTarget) || - (!widgetArrayTarget.includes(null) && this.serverTargets.includes(strTarget)) - - } - - return match - - } - - receive(data){ - - if (data._rawTarget && !CLIENT_SYNC) return - - if (typeof this.remoteControl.exists === 'function' && this.remoteControl.exists(data.address)) this.remoteControl.exec(data.address, data.args, data.cm) - - var [widgets, restArgs] = widgetManager.getWidgetByAddressAndArgs(data.address, data.args) - - for (let i in widgets) { - - if (this.match(widgets[i], data)) { - widgets[i].setValue(restArgs,{send:false,sync:true,fromExternal:!data.target}) - } - - } - - this.trigger(data.address, data) - - } - -} - - -var osc = new Osc() - -export default osc diff --git a/src/client/stacktrace.mjs b/src/client/stacktrace.mjs deleted file mode 100644 index e25bfd2f..00000000 --- a/src/client/stacktrace.mjs +++ /dev/null @@ -1,21 +0,0 @@ -import StackTrace from 'stacktrace-js' -import ipc from './ipc/index.mjs' -import uiConsole from './ui/ui-console.mjs' - -window.onerror = function(msg,url,row,col, error) { - - StackTrace.fromError(error).then((stackframes)=>{ - - var stringifiedStack = ' ' + stackframes.join('\n ') - - uiConsole.log('error', `${msg}\n${stringifiedStack}`) - ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n${stringifiedStack}`) - - }).catch(()=>{ - - uiConsole.log('error', `${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`) - ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`) - - }) - -} diff --git a/src/client/ui/context-menu.mjs b/src/client/ui/context-menu.mjs deleted file mode 100644 index 9630f4d8..00000000 --- a/src/client/ui/context-menu.mjs +++ /dev/null @@ -1,221 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import UiWidget from './ui-widget.mjs' -import {DOM, PXSCALE} from '../globals.mjs' - -var mod = (navigator.platform || '').match('Mac') ? 'cmd' : 'ctrl', - MENU_CONTAINER - -class ContextMenu extends UiWidget { - - constructor(options={}){ - - super(options) - - if (!MENU_CONTAINER) MENU_CONTAINER = DOM.get('osc-workspace')[0] - - - this.container = html`
      ` - this.clickHandler = (e)=>{ - if (this.container && !this.container.contains(e.target)) { - this.close() - } - } - - - this.position = options.position - if (this.position) { - this.container.style.top = this.position[0] + 'rem' - this.container.style.left = this.position[1] + 'rem' - } - - this.container.addEventListener('click', (e)=>{ - e.preventDefault() - if (e.target._action){ - e.target._action() - this.close() - } - }) - - this.hoverNode = null - this.container.addEventListener('mousemove', (e)=>{ - if (this.hoverNode === e.target) return - this.hoverNode = e.target - if (!e.target.classList.contains('focus')) { - DOM.each(e.target.parentNode, '.focus', (el)=>{ - el.classList.remove('focus') - }) - e.target.classList.add('focus') - } - }) - - this.container.addEventListener('touchstart', (e)=>{ - if (e.target.classList.contains('has-sub')) e.preventDefault() - if (!e.target.classList.contains('focus')) { - DOM.each(e.target.parentNode, '.focus', (el)=>{ - el.classList.remove('focus') - }) - e.target.classList.add('focus') - } else { - e.target.classList.remove('focus') - DOM.each(e.target, '.focus', (el)=>{ - el.classList.remove('focus') - }) - } - }) - - - } - - parse(actions, node) { - - for (let action of actions) { - - if (action.separator) { - - node.appendChild(html`
      `) - - } else if (Array.isArray(action.action)) { - - let submenu = html`
      `, - label = typeof action.label === 'function' ? action.label() : action.label, - iclass = typeof action.class === 'function' ? action .class() : action.class, - item = html`
      ${raw(label)}
      ` - - if (action.disabled) { - - item.classList.add('disabled') - - } else { - - item.appendChild(submenu) - - this.parse(action.action, submenu) - - } - - node.appendChild(item) - - } else { - - let label = typeof action.label === 'function' ? action.label() : action.label, - iclass = typeof action.class === 'function' ? action.class() : action.class, - item = html`
      ${raw(label)}
      ` - - if (action.disabled) item.classList.add('disabled') - - item._action = action.action - node.appendChild(item) - - if (action.shortcut) { - - item.appendChild(html`
      ${action.shortcut.replace('mod', mod)}
      `) - - } - - } - - } - - } - - open(e, actions, parent) { - - this.container.innerHTML = '' - this.parse(actions, this.container) - - MENU_CONTAINER.appendChild(this.container) - - if (!this.position) { - this.container.style.top = e.pageY / PXSCALE + 'rem' - this.container.style.left = e.pageX / PXSCALE + 'rem' - } - - - this.correctPosition(this.container) - - DOM.each(this.container, '.context-menu', (m)=>{ - this.correctPosition(m, m.parentNode) - }) - - document.addEventListener('fast-click', this.clickHandler, true) - document.addEventListener('fast-right-click', this.clickHandler, true) - - this.trigger('open') - - } - - close() { - - if (this.container) { - - this.container.parentNode.removeChild(this.container) - - // remove position fix - this.container.style.bottom = '' - this.container.style.right = '' - this.container.style.marginRight = '' - - } - - document.removeEventListener('fast-click', this.clickHandler, true) - document.removeEventListener('fast-right-click', this.clickHandler, true) - - this.hoverNode = null - - this.trigger('close') - - } - - correctPosition(menu, parent) { - - var position = DOM.offset(menu), - width = menu.offsetWidth, - height = menu.offsetHeight, - totalWidth = MENU_CONTAINER.offsetWidth, - totalHeight = MENU_CONTAINER.offsetHeight - - if (width + position.left > totalWidth) { - if (position.left - width > 0) { - menu.style.right = parent ? '100%' : '0' - menu.style.left = 'auto' - menu.style.marginRight = '-0.5rem' - } else { - menu.style.left = (parent.offsetWidth + (totalWidth - width - position.left)) / PXSCALE + 'rem' - } - } - - if (height + position.top > totalHeight && position.top - height > 0) { - menu.style.top = 'auto' - menu.style.bottom = '0rem' - } - - } - - bindShortcuts(actions) { - - for (let action of actions) { - - if (action.disabled) continue - - if (Array.isArray(action.action)) { - - this.bindShortcuts(action.action) - - } else if (action.shortcut && action.action) { - - keyboardJS.bind(action.shortcut, (e)=>{ - e.preventDefault() - action.action() - }) - - } - - } - - } - -} - -export default ContextMenu diff --git a/src/client/ui/fullscreen.mjs b/src/client/ui/fullscreen.mjs deleted file mode 100644 index af0787fb..00000000 --- a/src/client/ui/fullscreen.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import screenfull from 'screenfull' -import UiModal from './ui-modal.mjs' -import locales from '../locales/index.mjs' -import iOS from './ios.mjs' - -var fullscreen - -if (screenfull.isEnabled && !iOS) { - - fullscreen = screenfull - -} else { - - class IOSFullScreen { - - constructor(){ - - this.enabled = !navigator.standalone - this.isFullScreen = navigator.standalone - - } - - toggle(){ - - new UiModal({ - title: locales('fullscreen_unnavailable'), - content: locales('fullscreen_addtohome'), - closable: true - }) - - } - - on(){} - - } - - fullscreen = new IOSFullScreen() - -} - -window.ELECTRON_FULLSCREEN = ()=>{fullscreen.toggle()} - -export default fullscreen diff --git a/src/client/ui/index.mjs b/src/client/ui/index.mjs deleted file mode 100644 index 62a03c9b..00000000 --- a/src/client/ui/index.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import UiSidePanel from './ui-sidepanel.mjs' -import locales from '../locales/index.mjs' - -export const leftUiSidePanel = new UiSidePanel({selector: 'osc-panel-container.left', label: locales('editor_tree')}) -export const rightUiSidePanel= new UiSidePanel({selector: 'osc-panel-container.right', label: locales('editor_inspector')}) diff --git a/src/client/ui/init.mjs b/src/client/ui/init.mjs deleted file mode 100644 index 072a3341..00000000 --- a/src/client/ui/init.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import './zoom.mjs' -import '../events/click.mjs' -import './ios.mjs' -import './notifications.mjs' -import './ui-workspace.mjs' -import './main-menu.mjs' -import './ui-console.mjs' -import {updateMobileThemeColor, device} from './utils.mjs' - -updateMobileThemeColor() - -if (!device.is('mobile') && !device.is('tablet')) { - import('./ui-keyboard.mjs') -} diff --git a/src/client/ui/ios.mjs b/src/client/ui/ios.mjs deleted file mode 100644 index c9f3267e..00000000 --- a/src/client/ui/ios.mjs +++ /dev/null @@ -1,59 +0,0 @@ -import {DOM} from '../globals.mjs' -import {device, os} from './utils.mjs' - - -var iOS = (device.is('mobile') || device.is('tablet')) && os.is('ios') - -// Prevent iOS Pull-To-Refresh - -if (iOS && parseInt(os.version.split('.')[0]) < 13) { - - // prevent overscroll - // breaks scrolling on iOS <= 13 (besides it doesn't seem to be needed) - - var supportsPassiveOption = false - try { - document.createElement('div').addEventListener('test', function() {}, { - get passive() { - supportsPassiveOption = true - return false - } - }) - } catch(e) {} - - iOS = true - - var preventNextMove = false - - document.addEventListener('touchstart', (e)=>{ - if (e.touches.length === 1 && !e.target._drag_widget) preventNextMove = true - }, supportsPassiveOption ? {passive: false} : false) - - document.addEventListener('touchmove', (e)=>{ - // preventDefault the first overscrolling touchmove - if (preventNextMove) { - preventNextMove = false - e.preventDefault() - } - }, supportsPassiveOption ? {passive: false} : false) - - -} - -if (iOS) { - // when waking from sleep, iOS may have trouble rendering the session properly - // this attempts to force a full redraw by shortly resizing the main container - document.onvisibilitychange = ()=>{ - if (document.visibilityState === 'visible') { - var main = DOM.get('osc-panel-container#main')[0] - main.style.marginBottom = '1px' - main.style.marginRight = '1px' - setTimeout(()=>{ - main.style.marginBottom = '' - main.style.marginRight = '' - }) - } - } -} - -export default iOS diff --git a/src/client/ui/main-menu.mjs b/src/client/ui/main-menu.mjs deleted file mode 100644 index 092c002a..00000000 --- a/src/client/ui/main-menu.mjs +++ /dev/null @@ -1,334 +0,0 @@ -import NoSleep from 'nosleep.js' -import UiToolbar from './ui-toolbar.mjs' -import ipc from '../ipc/index.mjs' -import locales from '../locales/index.mjs' -import notifications from './notifications.mjs' -import fullscreen from './fullscreen.mjs' -import editor from '../editor/index.mjs' -import sessionManager from '../managers/session/index.mjs' -import stateManager from '../managers/state.mjs' -import {leftUiSidePanel, rightUiSidePanel} from '../ui/index.mjs' -import uiConsole from '../ui/ui-console.mjs' -import {READ_ONLY, KIOSK, VIRTUAL_KEYBOARD, setVIRTUAL_KEYBOARD} from '../globals.mjs' -import {device} from './utils.mjs' - - -var recentSessions = [{label: locales('file_open_recent_wait'), class: 'disabled'}] -var menuEntries = [ - - { - label: locales('session'), - disabled: READ_ONLY, - action: [ - { - label: locales('session_new'), - action: sessionManager.create.bind(sessionManager), - id: 'session-new' - }, - { - separator: true - }, - { - label: locales('file_open'), - action: sessionManager.browse.bind(sessionManager), - shortcut: 'mod + o', - id: 'session-open' - }, - { - label: locales('file_open_recent'), - action: recentSessions, - class: ()=>{return !recentSessions.length ? 'disabled' :''} - }, - { - separator: true - }, - { - label: locales('file_save'), - action: sessionManager.save.bind(sessionManager), - shortcut: 'mod + s', - class: ()=>{return sessionManager.session === null ? 'disabled' :''}, - id: 'session-save' - }, - { - label: locales('file_save_as'), - action: sessionManager.saveAs.bind(sessionManager), - shortcut: 'mod + shift + s', - class: ()=>{return sessionManager.session === null ? 'disabled' :''}, - id: 'session-save-as' - }, - { - label: locales('fragment_mode'), - class: ()=>{return 'toggle ' + (sessionManager.saveMode === 'fragment' ? 'on' : 'off')}, - action: ()=>{sessionManager.setSaveMode(sessionManager.saveMode === 'session' ? 'fragment' : 'session')}, - id: 'session-fragment' - }, - { - separator: true - }, - { - label: locales('file_backup'), - action: sessionManager.saveBackup.bind(sessionManager), - shortcut: 'mod + b', - class: ()=>{return sessionManager.session === null || !sessionManager.sessionPath ? 'disabled' :''}, - id: 'session-backup' - }, - { - separator: true - }, - { - label: locales('file_import'), - action: sessionManager.import.bind(sessionManager), - id: 'session-import' - }, - { - label: locales('file_export'), - action: sessionManager.export.bind(sessionManager), - class: ()=>{return sessionManager.session === null ? 'disabled' :''}, - id: 'session-export' - }, - - ] - }, - { - label: locales('state'), - disabled: READ_ONLY, - class: ()=>{return sessionManager.session === null ? 'disabled' : ''}, - action: [ - { - label: locales('state_store'), - action: stateManager.quickSave.bind(stateManager), - id: 'state-store' - }, - { - label: locales('state_recall'), - class: ()=>{return stateManager.quickState === null ? 'disabled' : ''}, - action: stateManager.quickLoad.bind(stateManager), - id: 'state-recall' - }, - { - label: locales('state_send'), - action: ()=>{ - stateManager.send() - notifications.add({ - icon: 'sliders-h', - message: locales('state_sendsuccess') - }) - }, - id: 'state-send' - }, - { - separator: true - }, - { - label: locales('file_open'), - action: stateManager.browse.bind(stateManager), - id: 'state-open' - }, - { - label: locales('file_save'), - action: stateManager.save.bind(stateManager), - id: 'state-save' - }, - { - label: locales('file_save_as'), - action: stateManager.saveAs.bind(stateManager), - id: 'state-save-as' - }, - { - separator: true - }, - { - label: locales('file_import'), - action: stateManager.import.bind(stateManager), - id: 'state-import' - }, - { - label: locales('file_export'), - action: stateManager.export.bind(stateManager), - id: 'state-export' - }, - ] - }, - { - label: locales('editor'), - disabled: READ_ONLY, - class: ()=>{return sessionManager.session === null ? 'disabled' : ''}, - action: [ - { - label: locales('editor_enabled'), - class: ()=>{return 'toggle ' + (editor.enabled ? 'on' : 'off')}, - action: ()=>{ - if (editor.enabled) editor.disable() - else editor.enable() - }, - shortcut: 'mod + e', - id: 'editor-enabled' - }, - { - separator: true - }, - { - label: locales('editor_grid'), - class: ()=>{return 'toggle ' + (editor.grid ? 'on' : 'off')}, - action: editor.toggleGrid.bind(editor), - shortcut: 'mod + g', - id: 'editor-grid' - }, - { - label: locales('editor_tree'), - class: ()=>{return 'toggle ' + (leftUiSidePanel.minimized ? 'off' : 'on')}, - action: ()=>{return leftUiSidePanel.minimized ? leftUiSidePanel.restore() : leftUiSidePanel.minimize()}, - shortcut: 'mod + t', - id: 'editor-tree' - }, - { - label: locales('editor_inspector'), - class: ()=>{return 'toggle ' + (rightUiSidePanel.minimized ? 'off' : 'on')}, - action: ()=>{return rightUiSidePanel.minimized ? rightUiSidePanel.restore() : rightUiSidePanel.minimize()}, - shortcut: 'mod + i', - id: 'editor-inspector' - }, - { - separator: true - }, - { - label: locales('editor_percents'), - class: ()=>{return 'toggle ' + (editor.usePercents ? 'on' : 'off')}, - action: ()=>{editor.usePercents = !editor.usePercents}, - id: 'editor-percents' - } - ] - }, - { - label: locales('console'), - disabled: READ_ONLY, - action: [ - { - label: locales('console_enabled'), - class: ()=>{return 'toggle ' + (uiConsole.minimized ? 'off' : 'on')}, - action: ()=>{ - if (uiConsole.minimized) { - uiConsole.restore() - uiConsole.input.focus() - } else { - uiConsole.minimize() - } - }, - shortcut: 'mod + k', - id: 'console-enabled' - }, - { - separator: true - }, - { - label: locales('console_clear'), - action: uiConsole.clear.bind(uiConsole), - shortcut: 'mod + l', - id: 'console-clear' - - }, - ] - }, - { - separator: true - }, - { - label: locales('fullscreen'), - disabled: KIOSK && navigator.userAgent.match(/OpenStageControl/), // built-in electron client only - class: ()=>{return 'toggle ' + (fullscreen.isFullscreen ? 'on' : 'off')}, - action: ()=>{ - if (fullscreen.isEnabled) fullscreen.toggle() - }, - shortcut: 'f11', - id: 'fullscreen' - }, - { - label: locales('notifications'), - class: ()=>{return 'toggle ' + (notifications.visible ? 'on' : 'off')}, - action: ()=>{ - notifications.setVisibility(!notifications.visible) - }, - id: 'notifications' - } - -] - -if (device.is('mobile') || device.is('tablet')) { - - - var noSleep = new NoSleep(), - noSleepState = false, - wakeLock = null - - menuEntries.push({ - label: locales('nosleep'), - class: ()=>{return 'toggle ' + (noSleepState ? 'on' : 'off')}, - action:()=>{ - noSleepState = !noSleepState - if (noSleepState) { - if ('wakeLock' in navigator) { - navigator.wakeLock.request('screen').then((l)=>{ - wakeLock = l - wakeLock.addEventListener('release', ()=>{ - noSleepState = false - }) - }).catch((err)=>{ - console.error(`Could not acquire wake lock:\n${err.name}, ${err.message}`) - wakeLock = null - }) - } - if (wakeLock === null) noSleep.enable() - } else { - if ('wakeLock' in navigator && wakeLock !== null) { - wakeLock.release().then(()=>{ - wakeLock = null - }) - } else { - noSleep.disable() - } - } - }, - id: 'prevent-sleep' - }) - -} else { - - menuEntries.push({ - label: locales('keyboard'), - class: ()=>{return 'toggle ' + (VIRTUAL_KEYBOARD ? 'on' : 'off')}, - action: ()=>{ - setVIRTUAL_KEYBOARD(!VIRTUAL_KEYBOARD) - }, - id: 'virtual-keyboard' - }) - -} - - - - - -class MainMenu extends UiToolbar { - - constructor(options) { - - super(options) - - ipc.on('sessionList', (data)=>{ - if (recentSessions.length) { - recentSessions.splice(0, 10) - } - for (let s of data) [ - recentSessions.push({ - label: s, - action: ()=>{sessionManager.requestOpen(s)} - }) - ] - }) - - } - -} - - -export default new MainMenu({selector: '#main-menu', position: [40, 1], entries: menuEntries}) diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs deleted file mode 100644 index 8998f752..00000000 --- a/src/client/ui/ui-code-editor.mjs +++ /dev/null @@ -1,343 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import UiModal from './ui-modal.mjs' -import locales from '../locales/index.mjs' -import {icon} from '../ui/utils.mjs' -import scriptVm from '../widgets/scripts/script-vm.mjs' -import modeJavascript from 'ace-builds/src-noconflict/mode-javascript.js' -import modeCss from 'ace-builds/src-noconflict/mode-css.js' -import modeHtml from 'ace-builds/src-noconflict/mode-html.js' -import {DOM} from '../globals.mjs' - - -var scriptGlobals = scriptVm.globals, - editors = {}, editorModes = { - javascript: modeJavascript, - css: modeCss, - html: modeHtml - }, - codeEditorModKey = (navigator.platform || '').match('Mac') ? 'Cmd' : 'Ctrl' - - -const ace = window.ace -ace.config.set('basePath', '/__APP_DIR__/client/ace/') - -function setCommandEnabled(editor, name, enabled) { - var command = editor.commands.byName[name] - if (!command.bindKeyOriginal) - command.bindKeyOriginal = command.bindKey - command.bindKey = enabled ? command.bindKeyOriginal : null - editor.commands.addCommand(command) -} - - -class CodeEditor { - - constructor(parent, name, language, syntaxChecker) { - - this.parent = parent - this.name = name - this.language = language - this.syntaxChecker = syntaxChecker - - this.field = null - this.input = null - this.widget = null - this.container = html`
      ` - this.helpBtn = html`
      ${locales('editor_ace_help')}
      ` - this.fsBtn = html`
      ${raw(icon('expand'))}
      ` - - this.helpBtn.addEventListener('fast-click', (e)=>{ - this.help() - }) - this.fsBtn.addEventListener('fast-click', (e)=>{ - this.fullscreen() - }) - - this.closeKey = ((e)=>{ - // this handler may remain dangling if closing with ctrl+enter - // we ignore this as it has no effect - if (e.key != 'Escape') return - this.field.classList.remove('fullscreen') - this.editor.setOptions({maxLines: 30}) - this.editor.fullscreen = false - document.removeEventListener('keydown', this.closeKey) - this.field.removeEventListener('fast-click', this.closeClick) - this.editor.blur() - this.parent.parentContainer.classList.remove('editor-breakout') - }).bind(this) - - this.closeClick = ((e)=>{ - if (e.target === this.field) { - this.closeKey({key: 'Escape'}) - } - }).bind(this) - - this.editor = ace.edit(this.container) - - if (editorModes[language]) this.editor.getSession().setMode('ace/mode/' + language) - - this.editor.setOptions({ - autoScrollEditorIntoView: true, - copyWithEmptySelection: true, - highlightIndentGuides:false, - tooltipFollowsMouse: false, - tabSize: 2, - maxLines: 30, - dragEnabled: false, - useWorker: syntaxChecker !== false - }) - - this.editor.$blockScrolling = Infinity - this.editor.commands.bindKeys({ - 'ctrl-l': null, 'ctrl-f': null, 'ctrl-h': null, 'ctrl-,': null, - 'cmd-l': null, 'cmd-f': null, 'cmd-h': null, 'cmd-,': null, - }) - this.editor.renderer.setScrollMargin(4, 4, 0, 4) - this.editor.element = this.container - this.editor.element.classList.add('ace_dark') - this.editor.textarea = DOM.get(this.container, '.ace_text-input')[0] - this.editor.textarea.name = name - this.editor.textarea._ace = true - this.editor.setHighlightActiveLine(false) - this.editor.setHighlightGutterLine(false) - - if (language === 'javascript' && syntaxChecker !== false) { - this.editor.getSession().$worker.send('setOptions', [{ - asi: true, // no semicolon - esversion: 7, - strict: 'implied', - node: false, - browser: true, - validthis: true, - undef: true, - globals: {} - }]) - } - - this.container.addEventListener('mousedown', (e)=>{ - if (e.button === 1) { - e.preventDefault() - e.stopPropagation() - } - }, {capture: true}) - - } - - bind(widget, field) { - - this.widget = widget - this.field = field - this.input = DOM.get(field, 'textarea')[0] - - var editor = this.editor, - input = this.input - - input.style.display = 'none' - input._ace_input = editor.textarea - input.tabIndex = -1 - - editor.setValue(input.value) - editor.textarea.osc_input = input - editor.textarea.tabIndex = 0 - - this.field.classList.remove('dirty') - - editor.removeAllListeners('focus') - this.editor.on('focus', (e)=>{ - this.parent.focusedInput = this.input - this.editor.setHighlightActiveLine(true) - this.editor.setHighlightGutterLine(true) - - this.editor.removeAllListeners('blur') - this.editor.removeAllListeners('change') - this.editor.removeAllListeners('changeSelection') - this.editor.on('change', (e)=>{ - this.input.value = this.editor.getValue() - this.editor.dirty = true - if (this.editor.fullscreen) { - this.field.classList.add('dirty') - } - }) - - this.typing = false - setCommandEnabled(this.editor, 'indent', false) - setCommandEnabled(this.editor, 'outdent', false) - - setTimeout(()=>{ - if (this.pos) { - this.editor.moveCursorTo(this.pos.row, this.pos.column) - } else { - var pos = this.editor.getCursorPosition() - if (pos.row === undefined || pos.column === undefined) { - this.editor.gotoLine(0) - } - - } - - this.typing = false - this.editor.on('changeSelection', ()=>{ - if (this.typing) return - let pos = this.editor.getCursorPosition() - if (pos.row || pos.column) { - setCommandEnabled(this.editor, 'indent', true) - setCommandEnabled(this.editor, 'outdent', true) - } - this.typing = true - }) - }) - - - this.editor.on('blur', (e)=>{ - this.pos = this.editor.getCursorPosition() - this.editor.setHighlightActiveLine(false) - this.editor.setHighlightGutterLine(false) - this.editor.selection.setRange({start:0,end:0}) - if (this.editor.fullscreen) { - e.preventDefault() - return - } - this.input.value = this.editor.getValue() - this.parent.focusedInput = this.input - if (this.editor.dirty) { - this.editor.dirty = false - this.parent.onChange() - } - this.parent.focusedInput = null - - }) - - }) - - - editor.setOptions({maxLines: 30}) - editor.dirty = false - - if (this.language === 'javascript') { - let globals = {} - - if (this.name === 'onKeyboard') { - globals = {type: true, key: true, code: true, ctrl: true, shift: true, alt: true, meta: true} - } else if (this.name === 'onCreate') { - globals = {value: true} - } else if (this.name === 'onValue') { - globals = {id: true, value: true, touch: true} - } else if (this.name === 'onDraw') { - globals = {value: true, height: true, width: true, ctx: true, cssVars: true} - } else if (this.name === 'onTouch') { - globals = this.widget.getProp('type') === 'canvas' ? - {value: true, height: true, width: true, event: true} : - {value: true, event: true, handle: true} - } else if (this.name === 'onResize') { - globals = {value: true, height: true, width: true, cssVars: true} - } - - for (var k in scriptGlobals) { - globals[k] = true - } - - globals.locals = true - globals.console = true - globals.JS = true - globals.this = false - - if (this.syntaxChecker !== false) editor.getSession().$worker.send('changeOptions', [{ - globals: globals - }]) - } - - field.appendChild(editor.element) - field.appendChild(this.helpBtn) - field.appendChild(this.fsBtn) - - editor.selection.setRange({start:0,end:0}) - - if (this.hash !== widget.hash) { - // preserve undo history if widget is the same - editor.getSession().getUndoManager().reset() - this.hash = widget.hash - this.pos = null - } else if (editor.fullscreen) { - this.fullscreen() - } - - editor.resize() - - } - - fullscreen() { - - this.editor.fullscreen = this.field.classList.toggle('fullscreen') - this.editor.setOptions({maxLines: this.editor.fullscreen ? 0 : 30}) - this.field.style.setProperty('--prefix', this.editor.fullscreen ? '"' + this.widget.getProp('id') + '."' : '') - setTimeout(()=>{ - window.dispatchEvent(new Event('resize')) - }) - - if (this.editor.fullscreen) { - this.parent.parentContainer.classList.add('editor-breakout') - this.editor.focus() - document.addEventListener('keydown', this.closeKey) - this.field.addEventListener('fast-click', this.closeClick) - } else { - this.parent.parentContainer.classList.remove('editor-breakout') - document.removeEventListener('keydown', this.closeKey) - this.field.removeEventListener('fast-click', this.closeClick) - } - } - - help() { - - var keybindings = [] - var commandMap = {} - - this.editor.keyBinding.$handlers.forEach(function(handler) { - var ckb = handler.commandKeyBinding - for (var i in ckb) { - var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase() }) - var commands = ckb[i] - if (!Array.isArray(commands)) - commands = [commands] - commands.forEach(function(command) { - if (typeof command != 'string') - command = command.name - if (commandMap[command]) { - commandMap[command].key += '|' + key - } else { - commandMap[command] = {key: key, command: command} - keybindings.push(commandMap[command]) - } - }) - } - }) - - var modal = new UiModal({closable: true, title: html`${locales('editor_ace_help_title')}`, html: true, content: html` -
      - - - - - - - - - ${keybindings.map(k=>html``)} -
      ShortcutCommand
      ${codeEditorModKey}-Entersave
      ${k.key}${k.command}
      -
      - `}) - - - this.parent.helpModalOpened = true - - modal.on('close', ()=>{ - this.parent.helpModalOpened = false - }) - - } - -} - -export default function(parent, name, language, syntaxChecker) { - if (!editors[name]) editors[name] = new CodeEditor(parent, name, language, syntaxChecker) - return editors[name] -} diff --git a/src/client/ui/ui-colorpicker.mjs b/src/client/ui/ui-colorpicker.mjs deleted file mode 100644 index 2b6df433..00000000 --- a/src/client/ui/ui-colorpicker.mjs +++ /dev/null @@ -1,119 +0,0 @@ -import html from 'nanohtml' -import chroma from 'chroma-js' -import UiWidget from './ui-widget.mjs' -import Rgb from '../widgets/pads/rgb.mjs' -import * as resize from '../events/resize.mjs' - - -class ColorPicker extends UiWidget { - - constructor() { - - super({}) - - this.name = '' - this.value = '' - - this.rgb = new Rgb({props: { - ...Rgb.defaults()._props(), - type: 'rgb', - width: 'auto', - height: 'auto', - alphaStroke: 0, - snap: true, - alpha: true - }, parent: this, meta: {not_editable: true}}) - - this.container = html` -
      - ${this.rgb.container} -
      - ` - - this.rgb.on('value-changed', (e)=>{ - e.stopPropagation = true - this.value = chroma(this.rgb.value).hex() - this.trigger('change', {preventHistory: true}) - }) - - var dragEndCb = (e)=>{ - this.value = chroma(this.rgb.value).hex() - this.trigger('change') - } - this.rgb.pad.on('dragend', dragEndCb) - this.rgb.hue.on('dragend', dragEndCb) - this.rgb.alpha.on('dragend', dragEndCb) - - - this.opened = 0 - - this.escKeyHandler = ((e)=>{ - if (e.key == 'Escape') this.close() - }).bind(this) - - this.enterKeyHandler = ((e)=>{ - if (e.key == 'Enter') this.confirm() - }).bind(this) - - } - - open() { - - this.parentNode.appendChild(this.container) - resize.check(this.rgb.container) - this.opened = 1 - - document.addEventListener('keydown', this.escKeyHandler) - document.addEventListener('keydown', this.enterKeyHandler) - } - - close() { - - if (this.parentNode && this.parentNode.contains(this.container)) { - this.parentNode.removeChild(this.container) - } - this.setName() - this.opened = 0 - - document.removeEventListener('keydown', this.escKeyHandler) - document.removeEventListener('keydown', this.enterKeyHandler) - } - - confirm() { - - this.value = chroma(this.rgb.getValue(true)).css('rgba') - this.trigger('change') - this.close() - - } - - isVisible() { - - return true - - } - - setName(n = '') { - - this.name = n - - } - - setValue(v) { - - if (v === 'transparent') v = '#00000000' - - this.rgb.setValue(chroma(v).rgba()) - - } - - setParent(node) { - - if (this.opened && node !== this.parentNode) this.close() - this.parentNode = node - - } - -} - -export default ColorPicker diff --git a/src/client/ui/ui-console.mjs b/src/client/ui/ui-console.mjs deleted file mode 100644 index 5c960158..00000000 --- a/src/client/ui/ui-console.mjs +++ /dev/null @@ -1,197 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import UiSidePanel from './ui-sidepanel.mjs' -import locales from '../locales/index.mjs' -import {icon} from './utils.mjs' -import Script from '../widgets/scripts/script.mjs' -import Widget from '../widgets/common/widget.mjs' -import widgetManager from '../managers/widgets.mjs' -import {DOM, ENV, READ_ONLY} from '../globals.mjs' - -class UiConsole extends UiSidePanel { - - constructor(options) { - - super(options) - - this.header = DOM.get(this.container, 'osc-panel-header')[0] - - this.header.appendChild(html``) - this.messages = this.content.appendChild(html``) - - this.inputWrapper = this.content.appendChild(html``) - this.input = this.inputWrapper.appendChild(html``) - - this.actions = this.header.appendChild(html`
      `) - this.clearBtn = this.actions.appendChild(html`
      ${raw(icon('trash'))}
      `) - this.clearBtn.addEventListener('click', ()=>{ - this.clear() - }) - - this.length = 0 - this.maxLength = ENV.consolelength || 300 - - this.history = [''] - this.cursor = 0 - - - var _this = this - - console._log = console.log - console.log = function(message){ - for (let arg of arguments) { - _this.log('log', arg) - } - console._log(...arguments) - } - - console._error = console.error - console.error = function(message){ - for (let arg of arguments) { - _this.log('error', arg) - } - console._error(...arguments) - } - - console._clear = console.clear - console.clear = function(){ - _this.clear() - console._clear() - } - - this.widget = new Widget({props: {id: 'CONSOLE'}, parent: widgetManager, meta: {not_editable: true}}) - this.script = new Script({ - widget: this.widget, - property: '', - code: 'var navigator; return eval(input_code)', - context: {input_code: ''} - }) - this.widget.hash = 'CONSOLE' - - this.input.addEventListener('keydown', (event)=>{ - if (event.key === 'Enter' && !event.shiftKey) { - event.preventDefault() - this.inputValidate() - } else if (event.key == 'ArrowUp') { - if (this.cursor < this.history.length - 1) { - - if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== 1) return - - this.cursor += 1 - this.input.value = this.history[this.cursor] - event.preventDefault() - } - } else if (event.key == 'ArrowDown') { - if (this.cursor > 0) { - var nLines = this.input.value.split('\n').length - if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== nLines) return - - this.cursor -= 1 - this.input.value = this.history[this.cursor] - event.preventDefault() - } - } else if (event.key == 'DOM_VK_TAB' && this.input.value !== '') { - var cur = this.input.selectionStart, - val = this.input.value - this.input.value = val.slice(0, cur) + ' ' + val.slice(cur) - event.preventDefault() - } - - this.inputSize() - - }) - - this.input.addEventListener('input', (event)=>{ - this.inputSize() - }) - - this.messages.addEventListener('keydown', (event)=>{ - if (event.key == 'Escape') { - this.messages.blur() - } - }) - - if (!READ_ONLY) this.enable() - - } - - inputSize() { - this.input.setAttribute('rows',0) - this.input.setAttribute('rows', this.input.value.split('\n').length) - } - - inputValidate() { - - if (this.input.value == '') return - - this.log('input', `${this.input.value}`) - - var returnValue = this.script.run({input_code: this.input.value}, {sync: true, send: true}) - if (returnValue === undefined) { - this.log('output undefined', 'undefined') - } else { - this.log('output value', returnValue) - } - - if (this.input.value !== this.history[1]) { - this.history.splice(1, 0, this.input.value) - if (this.history.length > 50) this.history.pop() - } - - this.input.value = '' - this.cursor = 0 - - } - - log(type, message, as_html) { - var msg =html` - - - - ` - - var node = this.messages.appendChild(msg) - if (typeof message === 'object') { - if (!(message instanceof Error)) { - try { - message = JSON.stringify(message) - } catch (_) {} - } else { - message = String(message) + message.stack - } - } - - if (as_html) { - node.innerHTML = message - } else { - node.textContent = message - } - - node.scrollIntoView() - - if (++this.length > this.maxLength) this.purge() - - - } - - purge() { - - var children = [...this.messages.children] - for (var i = 0; i < this.maxLength / 2; i++) { - this.messages.removeChild(children[i]) - } - this.length = this.maxLength / 2 + 1 - - } - - clear() { - - this.messages.innerHTML = '' - this.length = 0 - this.script.onRemove() - - } - -} - -export default new UiConsole({selector: '#osc-console', minSize: 40, size: 200, minimized: true}) diff --git a/src/client/ui/ui-dragresize.mjs b/src/client/ui/ui-dragresize.mjs deleted file mode 100644 index f4e62c59..00000000 --- a/src/client/ui/ui-dragresize.mjs +++ /dev/null @@ -1,241 +0,0 @@ -import html from 'nanohtml' -import fastdom from 'fastdom' -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import UiWidget from './ui-widget.mjs' -import {DOM, PXSCALE, GRIDWIDTH} from '../globals.mjs' - -var Tab, Root, Folder -;(async()=>{ - Tab = (await import('../widgets/containers/tab.mjs')).default - Root = (await import('../widgets/containers/root.mjs')).default - Folder = (await import('../widgets/containers/folder.mjs')).default -})() - -class UiDragResize extends UiWidget { - - constructor(options) { - - super(options) - - this.container = html` -
      -
      -
      -
      -
      -
      -
      - ` - - - this.initLeft = 0 - this.initTop = 0 - this.initWidth = 0 - this.initHeight = 0 - - this.left = 0 - this.top = 0 - this.width = 0 - this.height = 0 - - this.widgets = [] - this.mounted = false - - this.handles = DOM.get(this.container, '.handle') - this.dragging = null - this.copying = null - this.shiftKey = false - - this.on('draginit', (event)=>{ - - var node = event.firstTarget - if ((event.shiftKey && !event.altKey) || !this.handles.includes(node)) return - - this.initLeft = this.left - this.initTop = this.top - this.initWidth = this.width - this.initHeight = this.height - this.matrix = '' - - this.container.classList.add('dragging') - this.dragging = node.getAttribute('data-action').split(',') - delete event.traversingStack - delete event.traversing - - }, {element: this.container}) - - this.on('drag', (event)=>{ - - if (!this.dragging) return - - for (var k of this.dragging) { - - switch (k) { - case 'left': - case 'width': - this[k] += event.movementX / PXSCALE - break - case 'top': - case 'height': - this[k] += event.movementY / PXSCALE - break - - } - - } - - this.updateCss(true) - - - }, {element: this.container}) - - - this.on('dragend', (event)=>{ - - if (!this.dragging) return - - var node = event.firstTarget - if (!this.handles.includes(node)) return - - this.container.classList.remove('dragging') - this.left = Math.max(0, this.left) - this.top = Math.max(0, this.top) - this.shiftKey = event.shiftKey - this.trigger(this.dragging.indexOf('left') > -1 ? 'move' : 'drag-resize', this) - this.dragging = null - this.copying = null - this.shiftKey = false - - }, {element: this.container}) - - window.addEventListener('resize', ()=>{ - if (this.mounted) this.updateRectangle() - }) - - // this.handles[0]._ignore_css_transforms = true - - keyboardJS.withContext('editing', ()=>{ - keyboardJS.bind('alt', (e)=>{ - if (e.target.tagName !== 'TEXTAREA') this.handles[0].classList.add('full') - }, (e)=>{ - if (e.target && e.target.tagName !== 'TEXTAREA') this.handles[0].classList.remove('full') - }) - keyboardJS.bind('alt+c', (e)=>{ - if (e.target.tagName === 'TEXTAREA') return - this.copying = true - this.container.classList.add('copying') - }, (e)=>{ - if (e.target.tagName === 'TEXTAREA') return - this.copying = false - this.container.classList.remove('copying') - }) - }) - - } - - clear() { - - if (!this.mounted) return - - this.container.parentNode.removeChild(this.container) - this.mounted = false - this.widgets = [] - - - } - - create(widgets) { - - this.clear() - - this.widgets = widgets.slice().filter( - w=>w.getProp('visible') && - !(w instanceof Tab) && - !(w instanceof Root) && - !(w instanceof Folder) - ) - - if (!this.widgets.length) return - - this.updateRectangle() - - this.initLeft = this.left - this.initTop = this.top - this.initWidth = this.width - this.initHeight = this.height - - fastdom.mutate(()=>{ - if (this.widgets.length) { - this.widgets[0].parentNode.appendChild(this.container) - this.mounted = true - } - }) - - } - - updateRectangle() { - - var widgets = this.widgets, - widget = widgets[0], - layout = String(widget.parent.getProp('layout')) - - var handlesVisibility = [ - layout === 'default', // nw - layout.match(/horizontal|default/), // e - layout.match(/vertical|default/), // s - ] - handlesVisibility.push(handlesVisibility[1] && handlesVisibility[2]) // se - - fastdom.measure(()=>{ - - var lefts = widgets.map(w => w.container.offsetLeft), - tops = widgets.map(w => w.container.offsetTop), - rights = widgets.map(w => w.container.offsetLeft + w.container.offsetWidth), - bottoms = widgets.map(w => w.container.offsetTop + w.container.offsetHeight) - - this.left = Math.min(...lefts) / PXSCALE - this.top = Math.min(...tops) / PXSCALE - this.width = (Math.max(...rights) - Math.min(...lefts)) / PXSCALE - this.height = (Math.max(...bottoms) - Math.min(...tops)) / PXSCALE - - fastdom.mutate(()=>{ - - for (var i in handlesVisibility) { - this.handles[i].style.display = handlesVisibility[i] ? '' : 'none' - } - - this.updateCss() - - // this.cssTransform = widget.cssTransform || 'none' - // this.cssTransformOrigin = widget.cssTransformOrigin - - }) - - }) - - - } - - updateCss(grid) { - - for (let k of ['top', 'left', 'width', 'height']) { - - var val = this[k] - - if (k === 'width' || k === 'height') val = Math.max(10 * PXSCALE, val) - if (grid && this.dragging.includes(k)) { - val = Math.round(val / GRIDWIDTH) * GRIDWIDTH - } - - this.container.style.setProperty('--' + k, val + 'rem') - - // this.container.style.transform = this.cssTransform - // this.container.style.transformOrigin = this.cssTransformOrigin - - } - - } - -} - -export default UiDragResize diff --git a/src/client/ui/ui-filebrowser.mjs b/src/client/ui/ui-filebrowser.mjs deleted file mode 100644 index 766e3194..00000000 --- a/src/client/ui/ui-filebrowser.mjs +++ /dev/null @@ -1,215 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import locales from '../locales/index.mjs' -import ipc from '../ipc/index.mjs' -import doubleClick from '../events/double-click.mjs' -import {icon} from './utils.mjs' -import UiModal from './ui-modal.mjs' -import {DOM} from '../globals.mjs' - - -export default function UiFilebrowser(options, callback, closeCallback) { - - var save = options.save, - saveInputFocus = undefined, - previousKbContext = keyboardJS.getContext() - - var popup = new UiModal({ - height: 360, - closable: true, - html: true, - title: locales(save ? 'remotesave_save' : 'remotesave_open'), - hide: true - }) - - var container = DOM.get(popup.container, '.popup-content')[0], - browser = html`
      `, - ariane = html`
      `, - list = html`
      `, - saveInput = html``, - actions = html` -
      - ${saveInput} -
      ${raw(icon('times'))} Cancel
      - ${ - save ? - html`
      ${raw(icon('save'))} Save
      ` : - html`
      ${raw(icon('folder-open'))} Open
      ` - } -
      - ` - - var files = [], - root = '', - path = '' - - var extRe = options.extension ? new RegExp('.*\\.' + options.extension + '$') : /.*/ - - if (save) { - saveInput.addEventListener('change', ()=>{ - if (!saveInput.value.match(extRe)) saveInput.value += '.' + options.extension - }) - saveInput.addEventListener('focus', ()=>{ - saveInputFocus = true - }) - list.addEventListener('change', ()=>{ - saveInputFocus = false - var choice = DOM.get(list, ':checked')[0] - if (choice && choice.classList.contains('file')) { - saveInput.value = choice.value - } - }) - } - - doubleClick(list, submit, {click: true}) - - function submit(){ - - var choice = DOM.get(list, ':checked')[0] - - if (!choice && (!save || !saveInput.value) && !options.loadDir) return - - if (choice && choice.classList.contains('folder') && (!save || !saveInputFocus)) { - ipc.send('listDir', {path: [path, choice.value]}) - } else { - if (save) { - if (files.some(x=>x.name===saveInput.value)) { - if (!confirm(locales('remotesave_overwrite'))) return - } - callback([path, saveInput.value], root) - popup.close() - } else { - callback([path, choice ? choice.value : ''], root) - popup.close() - } - } - - } - - actions.addEventListener('click', (e)=>{ - if (e.target.classList.contains('submit')) { - submit() - } else if ((e.target.classList.contains('cancel'))){ - popup.close() - } - }) - - function keyDownHandler(e){ - - if (e.key == 'Enter') { - if (save) { - document.addEventListener('keyup', keyUpHandler) - } else { - submit() - } - } else if (e.target === saveInput) { - return - } else if (e.key == 'DOM_VK_BACK_SPACE' || e.keyCode === 8) { - list.childNodes[0].firstElementChild.checked = true - submit() - } else if (e.key.length === 1) { - var letter = e.key.toLowerCase(), - current = DOM.get(list, ':checked')[0], - minIndex = -1, - index = -1 - - if (current) minIndex = DOM.index(current.parentNode) - - for (let i in files) { - if (files[i].name[0].toLowerCase() === letter && !list.childNodes[i].firstElementChild.checked) { - if (index === -1) index = i - if (minIndex !== -1 && i < minIndex) continue - index = i - break - } - } - - if (index !== -1) { - list.childNodes[index].firstElementChild.click() - list.childNodes[index].firstElementChild.focus() - } - } - } - function keyUpHandler(e){ - - if (e.key == 'Enter') { - setTimeout(submit, 100) - document.removeEventListener('keyup', keyUpHandler) - } - - } - - document.addEventListener('keydown', keyDownHandler) - - ipc.on('listDir', (data)=>{ - path = data.path - root = data.root - ariane.textContent = root ? path.replace(root, '/') : path - - files = data.files.filter(x=>x.folder || x.name.match(extRe)) - - function alphaSort(a, b){ - // convert to strings and force lowercase - a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString() - b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString() - return a.localeCompare(b) - } - - var fo = files.filter(x=>x.folder), - fi = files.filter(x=>!x.folder) - - fo.sort(alphaSort) - fi.sort(alphaSort) - - files = fo.concat(fi) - - files.unshift({ - name: '..', - folder: true - }) - - - browser.removeChild(list) - list.innerHTML = '' - for (let i in files) { - var file = files[i] - list.appendChild(html` -
      - -
      ${raw(icon(file.folder ? 'folder' : 'osc'))} ${file.name}
      -
      - `) - } - - - browser.insertBefore(list, actions) - - - if (save && saveInputFocus === undefined) { - saveInput.focus() - } else { - list.childNodes[0].firstElementChild.focus() - } - - }, {context: popup}) - - popup.on('close', ()=>{ - ipc.off('listDir', null, popup) - document.removeEventListener('keydown', keyDownHandler) - document.removeEventListener('keyup', keyUpHandler) - keyboardJS.setContext(previousKbContext) - if (closeCallback) closeCallback(path) - }) - - browser.appendChild(ariane) - browser.appendChild(list) - browser.appendChild(actions) - container.appendChild(browser) - - ipc.send('listDir', {extension: options.extension, path: options.directory ? [options.directory] : null}) - - popup.open() - keyboardJS.setContext('filebrowser') - -} diff --git a/src/client/ui/ui-fileupload.mjs b/src/client/ui/ui-fileupload.mjs deleted file mode 100644 index 818f5c06..00000000 --- a/src/client/ui/ui-fileupload.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import html from 'nanohtml' -import locales from '../locales/index.mjs' -import uiLoading from './ui-loading.mjs' -import {DOM} from '../globals.mjs' - -var SINGLETON = null, - CONTAINER = null - -export default function uiFileUpload(types, ok, error) { - - if (!CONTAINER) CONTAINER = DOM.get('osc-modal-container')[0] - - if (SINGLETON) CONTAINER.removeChild(SINGLETON) - - SINGLETON = html`` - - if (types) SINGLETON.accept = types - - CONTAINER.appendChild(SINGLETON) - - SINGLETON.addEventListener('change',function(e){ - - - var reader = new FileReader(), - file = e.target.files[0] - - uiLoading(locales('loading_upload')) - - reader.onerror = reader.onabort = function(e) { - uiLoading(false) - error(e) - } - - reader.onload = function(e) { - uiLoading(false) - ok(file.path, e.target.result) - } - - reader.readAsText(file, 'utf-8') - - }) - - SINGLETON.click() - -} diff --git a/src/client/ui/ui-inspector-field.mjs b/src/client/ui/ui-inspector-field.mjs deleted file mode 100644 index ceff8e21..00000000 --- a/src/client/ui/ui-inspector-field.mjs +++ /dev/null @@ -1,137 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import chroma from 'chroma-js' -import UiWidget from './ui-widget.mjs' -import {categories} from '../widgets/index.mjs' -import {icon} from '../ui/utils.mjs' - -class UiInspectorField extends UiWidget { - - constructor(options) { - - super(options) - - this.name = options.name - this.widget = options.widget - this.value = options.value - this.default = options.default - - this.container = html`` - this.label = this.container.appendChild(html``) - - if (this.name === 'type' || this.name === 'widgetType') this.createTypeSelect() - else this.createInput() - - } - - createTypeSelect() { - - - if (this.widget.props.type == 'tab' || this.widget.props.type == 'root') { - this.container.appendChild(html` - - `) - return - } - - this.createInput() - - var select = html`` - - if (this.name === 'id' && this.widget.props.type === 'root') input.disabled = true - - if (this.default.value === 'auto' && stringValue === 'auto') { - input.placeholder = stringValue - } else { - input.textContent = stringValue - } - - this.container.appendChild(input) - - - if (this.default.choices) { - - let wrapper = html``, - select = wrapper.appendChild(html``) - this.wrapper = this.container.appendChild(html`
      `) - this.list = this.wrapper.appendChild(html`
        ` - this.deferredUpdateTimeout = null - - - this.expanded = {} - this.init = false - - this.container.addEventListener('fast-click', (event)=>{ - - var node = event.target - if (node.classList.contains('toggle')) { - var exp = node.parentNode.classList.toggle('expanded') - if (exp) { - this.expanded[node.parentNode.getAttribute('data-widget')] = true - } else { - delete this.expanded[node.parentNode.getAttribute('data-widget')] - } - } - - - }) - - doubleClick(this.container, (event)=>{ - - var node = event.target - if (node.classList.contains('container')) { - var exp = node.classList.toggle('expanded') - if (exp) { - this.expanded[node.getAttribute('data-widget')] = true - } else { - delete this.expanded[node.getAttribute('data-widget')] - } - } - - }, {ignoreEditorCapture: true}) - - - this.sortables = [] - this.sortCallback = (event)=>{ - - var from = widgetManager.widgets[event.from.getAttribute('data-hash')], - to = widgetManager.widgets[event.to.getAttribute('data-hash')] - - if (!to || (from === to && event.oldIndex === event.newIndex)) return - - this.trigger('sorted', { - oldIndex: event.oldIndex, - newIndex: event.newIndex, - from: from, - to: to - }) - - } - - this.filter.addEventListener('change', ()=>{ - this.applyFilter() - }) - var filterTypeTimeout = null - this.filter.addEventListener('keydown', ()=>{ - clearTimeout(filterTypeTimeout) - filterTypeTimeout = setTimeout(()=>{ - this.applyFilter() - }, 100) - }) - - } - - clear() { - - this.list.innerHTML = '' - this.init = false - this.mounted = false - for (var s of this.sortables) { - s.destroy() - } - this.sortables = [] - - } - - updateTree(selectedWidgets) { - - if (this.parent.minimized || this.parent.disabled) { - clearTimeout(this.deferredUpdateTimeout) - this.deferredUpdateTimeout = setTimeout(()=>{ - this.deferredUpdateTree(selectedWidgets) - }) - } else { - this.deferredUpdateTree(selectedWidgets) - } - - } - - deferredUpdateTree(selectedWidgets) { - - this.deferredUpdateTimeout = null - - for (var s of this.sortables) { - s.destroy() - } - this.sortables = [] - - var content = this.parseWidgets(widgetManager.getWidgetById('root')[0], selectedWidgets) - - if (!content) return - - // morph DOM - if (this.mounted) { - morph(this.list.firstChild, content) - } else { - this.list.appendChild(content) - } - - - // sortable lists - DOM.each(this.list, 'ol', (el)=>{ - let placeholder = null - this.sortables.push(new Sortable(el, { - group: { - name: 'group', - pull: (to, from)=>from.el.dataset.childrenType === to.el.dataset.childrenType || to.el.dataset.childrenType === '', - put: (to, from)=>from.el.dataset.childrenType === to.el.dataset.childrenType || to.el.dataset.childrenType === '', - }, - onEnd: (e)=>{ - e.from.removeChild(placeholder) - placeholder = null - if (e.from === e.to && e.newIndex > e.oldIndex) e.newIndex-- - this.sortCallback(e) - }, - setData: (dataTransfer)=>{ - dataTransfer.setDragImage(this.dragDummy, 0, 0) - }, - onStart: (event)=>{ - placeholder = event.from.insertBefore(event.clone.cloneNode(true), event.from.childNodes[event.oldIndex]) - placeholder.style.display = 'block' - }, - })) - }) - - this.mounted = true - this.applyFilter() - - } - - showWidget(widget) { - - var node = DOM.get(this.list, `[data-widget="${widget.hash}"]`) - if (node.length) { - node = node[0] - var parent = node.parentNode - while (parent !== this.list) { - if (parent.classList.contains('container')) { - parent.classList.add('expanded') - this.expanded[parent.getAttribute('data-widget')] = true - } - parent = parent.parentNode - } - var nodeRect = node.classList.contains('container') ? node.firstChild.getBoundingClientRect() : node.getBoundingClientRect(), - treeRect = this.wrapper.getBoundingClientRect() - - if (nodeRect.top < treeRect.top) { - node.scrollIntoView({block: 'start'}) - } else if (nodeRect.bottom > treeRect.bottom) { - node.scrollIntoView({block: 'nearest'}) - } - this.wrapper.scrollLeft = (node.depth - 1) * 20 - } - - if (this.parent.minimized) this.parent.restore() - - } - - blinkSelected() { - - DOM.each(this.list, '.editing', (el)=>{ - el.classList.add('editor-blink') - this.wrapper.scrollLeft = (el.depth - 1) * 20 - setTimeout(()=>{ - el.classList.remove('editor-blink') - }, 800) - }) - - } - - showWidgetInSession(widget) { - - var parent = widget - while (parent !== widgetManager) { - if (parent.getProp('type') === 'tab') parent.parent.setValue(parent.parent.children.indexOf(parent), {sync: true, send: true}) - else if (parent.getProp('type') === 'modal') parent.setValue(1, {sync: true, send: true}) - parent = parent.parent - } - widget.container.classList.add('editor-blink') - widget.container.scrollIntoView({block: 'center'}) - setTimeout(()=>{ - widget.container.classList.remove('editor-blink') - }, 800) - - } - - select() { - - // hint selection in folded containers - DOM.each(this.list, '.contains-editing', (element)=>{ - element.classList.remove('contains-editing') - }) - var selected = DOM.get(this.list, '.editing')[0] - if (selected) { - var node = selected.parentNode - while (node && node !== this.list) { - if (node.classList.contains('container')) { - node.classList.add('contains-editing') - } - node = node.parentNode - } - } - } - - parseWidgets(widget, selectedWidgets, depth = 1) { - - if (!widget) return - - var selected = selectedWidgets.includes(widget), - id = widget.getProp('id'), - node = html`
      1. - ${raw(icon(widgetIcons[widget.getProp('type')] || 'root'))}${id}${widget.getProp('lock')? raw(icon('lock')) :''}
      2. ` - - - node.depth = depth - - if (widget instanceof Panel && !(widget instanceof Matrix || widget instanceof Keyboard)) { - node.insertBefore(html``, node.childNodes[0]) - node.classList.add('container') - if (this.expanded[widget.hash]) node.classList.add('expanded') - if (!this.init && widget instanceof Root) { - node.classList.add('expanded') - this.expanded[widget.hash] = true - this.init = true - } - var sublist = node.appendChild(html`
          `) - for (let child of widget.children) { - if (child) sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth)) - } - - } - - for (var h in this.expanded) { - if (!widgetManager.widgets[h]) delete this.expanded[h] - } - - return node - - } - - applyFilter() { - - var filter = this.filter.value.replace(/type\:[^\s]+/g, '').trim(), - types = this.filter.value.match(/type\:([^\s]+)/g) - - if (types) types = types.map(x=>x.split(':')[1]) - - if (!filter && !types) { - this.list.classList.remove('filter-active') - } else { - this.list.classList.add('filter-active') - - var show = [] - DOM.each(this.list, 'li', (element)=>{ - var match = element.innerText.includes(filter) - if (types && !types.includes(element.dataset.type)) match = false - element.classList.toggle('filter-hide', !match) - if (match) show.push(element) - }) - - DOM.each(this.list, '.container.filter-hide', (element)=>{ - if (show.some(el=>element.contains(el))) element.classList.remove('filter-hide') - }) - - } - - } - - updateVisibility(widget) { - - if (!this.parent.disabled) { - - var w = DOM.get(this.list, '[data-widget="' + widget.hash + '"]')[0] - - if (w) { - w.classList.toggle('invisible', !widget.getProp('visible')) - } - - } - - } - -} - -export default UiTree diff --git a/src/client/ui/ui-widget.mjs b/src/client/ui/ui-widget.mjs deleted file mode 100644 index 9d8db2b6..00000000 --- a/src/client/ui/ui-widget.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import EventEmitter from '../events/event-emitter.mjs' -import {DOM} from '../globals.mjs' - -class UiWidget extends EventEmitter { - - constructor(options={}) { - - super() - - this.container = options.selector ? DOM.get(options.selector)[0] : options.element - this.parent = options.parent - - } - -} - -export default UiWidget diff --git a/src/client/ui/ui-workspace.mjs b/src/client/ui/ui-workspace.mjs deleted file mode 100644 index 41205230..00000000 --- a/src/client/ui/ui-workspace.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import UiWidget from './ui-widget.mjs' -import {setScrollbarColor} from './utils.mjs' - -class UiWorkspace extends UiWidget { - - constructor(options) { - - super(options) - - setScrollbarColor(this.container) - - } - -} - -export default new UiWorkspace({selector: 'osc-workspace'}) diff --git a/src/client/ui/utils.mjs b/src/client/ui/utils.mjs deleted file mode 100644 index c23afcc7..00000000 --- a/src/client/ui/utils.mjs +++ /dev/null @@ -1,66 +0,0 @@ -import chroma from 'chroma-js' -import fastdom from 'fastdom' -import {UAParser} from 'ua-parser-js' -import {DOM} from '../globals.mjs' - -var {device, os} = UAParser().withFeatureCheck() - -export {device, os} - -export function icon(i) { - var iclass = i.split('.').join(' fa-') - return `` -} - -export function iconify(string){ - return String(string).replace(/\^[^\s]{2,}/g,(x)=>{return icon(x.substring(1))}) -} - -export function setScrollbarColor(container) { - - fastdom.measure(()=>{ - - var computedStyle = window.getComputedStyle(container), - alpha = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar')), - alphaOn = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar-on')), - color = computedStyle.getPropertyValue('--color-fill').trim() - - if (color === 'transparent') { - // prevent chroma-js error - // irrelevant case, but still... - color = 'rgb(0, 0, 0)' - alpha = 0 - alphaOn = 0 - } - - if (color) { - fastdom.mutate(()=>{ - try { - container.style.setProperty('--color-scrollbar', chroma(color).alpha(alpha).css()) - container.style.setProperty('--color-scrollbar-on', chroma(color).alpha(alphaOn).css()) - } catch(e) {} - }) - } - - }) - -} - -export function updateMobileThemeColor(root) { - - fastdom.measure(()=>{ - - var style = window.getComputedStyle(root ? root.widget : document.documentElement), - color = style.getPropertyValue('--color-background').trim() - - fastdom.mutate(()=>{ - - for (var el of DOM.get('meta[name="theme-color"], meta[name="apple-mobile-web-app-status-bar-style"]')) { - el.setAttribute('content', color) - } - - }) - - }) - -} diff --git a/src/client/ui/zoom.mjs b/src/client/ui/zoom.mjs deleted file mode 100644 index a39b0837..00000000 --- a/src/client/ui/zoom.mjs +++ /dev/null @@ -1,94 +0,0 @@ -import EventEmitter from '../events/event-emitter.mjs' -import {DOM, PXSCALE, INITIALZOOM, setPXSCALE} from '../globals.mjs' - -var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey' - -class Zoom extends EventEmitter { - - constructor() { - - super() - - this.localZoom = 1 - this.lastWheelZoom = 0 - this.editor = null - - document.addEventListener('wheel', (event)=>{ - if (event.ctrlKey) event.preventDefault() - - var now = Date.now() - if (now - this.lastWheelZoom > 50) { - - if (event[mod]) { - - event.preventDefault() - - if (event.deltaY === 0) return - - let d = - event.deltaY / (10 * Math.abs(event.deltaY)) - if (!isNaN(d)) this.setGlobalZoom(d + PXSCALE) - } - if (event.altKey) { - event.preventDefault() - let d = - event.deltaY / (10 * Math.abs(event.deltaY)) * 2 - if (!isNaN(d)) this.setLocalZoom(d + this.localZoom) - } - - this.lastWheelZoom = now - } - - }, {passive: false}) - - document.addEventListener('keydown', (event)=>{ - if (event[mod]) { - - if (event.key == 'DOM_VK_0' || event.key == 'Numpad0'|| event.code == 'Digit0') { - event.preventDefault() - this.setGlobalZoom(INITIALZOOM) - this.setLocalZoom(1) - } - else if (event.key == '+' || event.key == '=' || event.keyCode === 107) { - event.preventDefault() - this.setGlobalZoom(PXSCALE + 0.1) - } - else if (event.key == '-' || event.keyCode === 109) { - event.preventDefault() - this.setGlobalZoom(PXSCALE - 0.1) - } - - } - }, {passive: false}) - - } - - setLocalZoom(zoom) { - - if (this.editor && !this.editor.enabled) return - - zoom = Math.max(Math.min(zoom, 4), 0.25) - if (zoom !== this.localZoom) { - requestAnimationFrame(()=>{ - this.localZoom = zoom - document.documentElement.style.setProperty('--local-zoom', this.localZoom) - document.body.classList.toggle('local-zoom-in', this.localZoom > 1) - document.body.classList.toggle('local-zoom-out', this.localZoom < 1) - this.trigger('local-zoom-changed') - }) - } - - } - - setGlobalZoom(zoom) { - - if (zoom !== PXSCALE) { - setPXSCALE(zoom) - document.documentElement.style.setProperty('font-size', PXSCALE + 'px') - DOM.dispatchEvent(window, 'resize') - this.trigger('global-zoom-changed') - } - - } - -} - -export default new Zoom() diff --git a/src/client/utils.mjs b/src/client/utils.mjs deleted file mode 100644 index e7c07471..00000000 --- a/src/client/utils.mjs +++ /dev/null @@ -1,49 +0,0 @@ -export function deepCopy(obj, decimals) { - - var copy = obj - - if (obj === null) { - return obj - } - - if (typeof obj === 'object') { - copy = Array.isArray(obj) ? [] : {} - for (let key in obj) { - copy[key] = deepCopy(obj[key], decimals) - } - } else if (typeof obj == 'number') { - return decimals === undefined ? copy : parseFloat(copy.toFixed(decimals)) - } - - return copy - -} - -export function deepEqual(a, b) { - - var ta = typeof a, - tb = typeof b - - if (ta !== tb) { - return false - } else if (ta === 'object') { - return JSON.stringify(a) === JSON.stringify(b) - } else { - return a === b - } - -} - -export function isJSON(str) { - // heuristic to avoid using JSON when unnecessary - // if the string doesn't start with one of these chars - // it's going to fail - // ref in source: https://github.com/douglascrockford/JSON-js - return ' \n+-eE{([0123456789tfn"'.indexOf(str[0]) !== -1 - -} - -export function isJSONObject(str) { - // same, but only for object/array/bool/null - return '{[tfn'.indexOf(str[0]) !== -1 -} diff --git a/src/client/widgets/basics/button.mjs b/src/client/widgets/basics/button.mjs deleted file mode 100644 index 7ce2b3d4..00000000 --- a/src/client/widgets/basics/button.mjs +++ /dev/null @@ -1,438 +0,0 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import doubleTap from '../mixins/double_tap.mjs' -import {deepEqual, isJSON} from '../../utils.mjs' -import {iconify} from '../../ui/utils.mjs' -import parser from '../../parser.mjs' -import {TOGGLE_ALT_TRAVERSING} from '../../globals.mjs' - -class Button extends Widget { - - static description() { - - return 'On / off button.' - - } - - static defaults() { - - var defaults = super.defaults(Button).extend({ - style: { - _separator_button_style: 'Button style', - colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'}, - label: {type: 'string|boolean', value: 'auto', help: [ - 'Set to `false` to hide completely', - '- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/search?m=free&s=solid', - '- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal`', - ]}, - vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'}, - wrap: {type: 'boolean|string', value: false, choices: [false, true, 'soft'], help: [ - 'Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.', - ]}, - }, - class_specific: { - on: {type: '*', value: 1, help: [ - 'Set to `null` to send send no argument in the osc message. Ignored if `mode` is `momentary`.', - ]}, - off: {type: '*', value: 0, help: [ - 'Set to `null` to send send no argument in the osc message. Must be different from `on`. Ignored if `mode` is `momentary` or `tap`.', - ]}, - mode: {type: 'string', value: 'toggle', choices: ['toggle', 'push', 'momentary', 'tap'], help: [ - 'Interaction mode:', - '- `toggle` (classic on/off switch)', - '- `push` (press & release)', - '- `momentary` (no release, no value sent with the address)', - '- `tap` (no release, sends `on` as value)', - ]}, - doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'}, - click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap (ignored if `mode` is `push`)'}, - decoupled: {type: 'boolean', value: false, help: [ - 'Set to `true` make the local feedback update only when it receives a value from an osc/midi message that matches the `on` or `off` property.', - 'When `decoupled`, the button\'s value is ambiguous: when interacted with, it will send the value that\'s requested (`on` or `off` for `toggle` and `push` modes, `on` for `tap` mode, `null` for `momentary`), otherwise it will return the value received from the feedback message (`on` or `off` property).', - 'From a script property, feedback messages can be simulated with:', - '`set("widget_id", value, {external: true})`' - ]}, - }, - scripting: { - onTouch: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the panel is touched and released, and when the pointer moves when the widget is touched. See documentation.',]}, - } - }) - - defaults.scripting.onValue.help.push( - 'Additional variables:', - '- `locals.touchCoords`: `[x, y]` array representing the touch coordinates, normalized between 0 and 1.', - '- `locals.external`: `true` if value was received from an osc/midi message, `false otherwise`.' - ) - - return defaults - - } - - constructor(options) { - - super({...options, html: html``}) - - this.state = 0 - this.touchActive = false - this.localSet = false - this.pulseIn = null - this.pulseOut = null - - this.buttonSize = [100, 100] - this.exposeTouchCoords = String(this.getProp('onValue')).includes('touchCoords') - this.parsersLocalScope.external = false - this.parsersLocalScope.touchCoords = [0.5, 0.5] - if (this.exposeTouchCoords) { - this.on('resize', (e)=>{ - this.buttonSize = [e.width, e.height] - }, {element: this.widget}) - } - - if (this.getProp('onTouch')) { - this.on('draginit',(e)=>this.onTouch(e, 'start'), {element: this.container}) - } - - var mode = this.getProp('mode'), - tap = mode === 'momentary' || mode === 'tap', - push = mode === 'push' || tap, - click = this.getProp('click') && mode !== 'push' - - if (push) { - - if (this.getProp('doubleTap')) { - - doubleTap(this, (e)=>{ - - this.touchActive = true - - if (this.exposeTouchCoords) { - this.parsersLocalScope.touchCoords = [e.offsetX / this.buttonSize[0], 1 - e.offsetY / this.buttonSize[1]] - } - - this.setValue(this.getProp('on'), {sync: true, send: true, local:true, y: e.offsetY}) - - if (tap) this.container.classList.add('active') - - }, {element: this.container, click: click}) - - } else { - - this.on(click ? 'click': 'draginit',(e)=>{ - - if (this.touchActive) return - - this.touchActive = true - - if (this.exposeTouchCoords) { - this.parsersLocalScope.touchCoords = [e.offsetX / this.buttonSize[0], 1 - e.offsetY / this.buttonSize[1]] - } - - this.setValue(this.getProp('on'), {sync: true, send: true, local:true, y: e.offsetY}) - - if (tap) this.container.classList.add('active') - - - }, {element: this.container}) - - } - - if (this.exposeTouchCoords) { - this.on('drag',(e)=>{ - - if (!this.touchActive) return - - this.parsersLocalScope.touchCoords[0] += e.movementX / this.buttonSize[0] - this.parsersLocalScope.touchCoords[1] += e.movementY / this.buttonSize[1] - - }, {element: this.container}) - } - - this.on('dragend',()=>{ - - if (!this.touchActive) return - - this.touchActive = false - - if (!tap) this.setValue(this.getProp('off'), {sync: true, send: true, local:true}) - if (tap) this.container.classList.remove('active') - - - }, {element: this.container}) - - } else { - - if (this.getProp('doubleTap')) { - - doubleTap(this, (e)=>{ - - - this.touchActive = true - this.setValue(this.state ? this.getProp('off') : this.getProp('on'), {sync: true, send: true, y: e.offsetY, x: e.offsetX, local:true}) - - }, {element: this.container, click: click}) - - } else { - - this.on(click ? 'click': 'draginit',(e)=>{ - - if (this.touchActive) return - - if (e.traversingStack && TOGGLE_ALT_TRAVERSING) { - if (e.traversingStack.firstButtonValue === undefined) { - e.traversingStack.firstButtonValue = this.state - } else if (e.traversingStack.firstButtonValue !== this.state) { - return - } - } - - this.touchActive = true - this.setValue(this.state ? this.getProp('off') : this.getProp('on'), {sync: true, send: true, y: e.offsetY, x: e.offsetX, local:true}) - - }, {element: this.container}) - - this.on('dragend',()=>{ - - this.touchActive = false - - }, {element: this.container}) - - } - - } - - if (tap) this.noValueState = true - - this.label = html`` - - if (this.getProp('wrap')) this.label.classList.add('wrap') - if (this.getProp('wrap') === 'soft') this.label.classList.add('wrap-soft') - if (this.getProp('vertical')) this.label.classList.add('vertical') - - this.updateLabel() - - if (this.getProp('decoupled')) { - - this.decoupledValue = parser.parse({ - data: { - type: 'variable', - id: this.getProp('id') + '/decoupledValue', - ignoreDefaults: true, - }, - parentNode: this.widget, - parent: this, - meta: {...this.meta} - }) - this.decoupledValue.on('value-changed', (e)=>{ - this.container.classList.toggle('on', this.decoupledValue.value) - if (e.options.send) this.decoupledValue.sendValue() - }) - - } - - if (this.getProp('onTouch')) { - this.on('drag',(e)=>this.onTouch(e, 'move'), {element: this.container}) - this.on('dragend',(e)=>this.onTouch(e, 'stop'), {element: this.container}) - } - - } - - onTouch(e, name) { - - var event = {...e} - - event.type = name - - this.scripts.onTouch.run({ - value: this.value, - event: event - }, {sync: true, send: true}) - - } - - get value() { - - switch (this.getProp('mode')) { - case 'toggle': - if (this.getProp('decoupled')) { - if (this.localSet) { - // return requested value - return this.getProp(this.decoupledValue.value ? 'off' : 'on') - } else { - // return feedback value - return this.getProp(this.decoupledValue.value ? 'on' : 'off') - } - } else { - return this.getProp(this.state ? 'on' : 'off') - } - case 'push': - if (this.getProp('decoupled')) { - if (this.localSet) { - // return requested value - return this.getProp(this.touchActive ? 'on' : 'off') - } else { - // return feedback value - return this.getProp(this.decoupledValue.value ? 'on' : 'off') - } - } else { - return this.getProp(this.state ? 'on' : 'off') - } - case 'tap': - if (this.localSet || !this.getProp('decoupled')) { - return this.getProp('on') - } else { - return this.getProp(this.decoupledValue.value ? 'on' : 'off') - } - case 'momentary': - if (this.localSet || !this.getProp('decoupled')) { - return null - } else { - return this.getProp(this.decoupledValue.value ? 'on' : 'off') - } - default: - return null - } - - } - - setValue(v, options={}) { - - if (typeof v === 'string' && isJSON(v)) { - try { - v = JSON.parse(v) - } catch (err) {} - } - - var newstate, - mode = this.getProp('mode') - - if (deepEqual(v, this.getProp('on'))) { - - newstate = 1 - - } else if (deepEqual(v, this.getProp('off'))) { - - newstate = 0 - - } else if (mode === 'momentary' && (v === null || v === undefined)) { - newstate = 1 - - } - - if (newstate !== undefined) { - - this.parsersLocalScope.external = !!options.fromExternal - - if (this.getProp('decoupled')) { - - if (options.fromExternal) { - this.state = newstate - this.decoupledValue.setValue(newstate, {sync: true}) - } else if (!options.local && this.getProp('mode') === 'push') { - if (newstate === 1 && !this.touchActive) { - this.touchActive = 1 - setTimeout(()=>{this.touchActive = 0}) - } else { - this.touchActive = 0 - } - } - - } else { - - this.state = newstate - - if (mode === 'toggle' || mode === 'push') { - this.container.classList.toggle('on', this.state) - } - - } - - - if (options.local || !options.fromExternal) this.localSet = true - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - if (options.local || !options.fromExternal) this.localSet = false - - // tap mode - if (newstate && (mode === 'momentary' || mode === 'tap') && !options.tapRelease) { - - // reset value - if (mode === 'tap') this.setValue(this.getProp('off'), {sync: false, send: false, tapRelease: true}) - - // pulse - clearTimeout(this.pulseIn) - clearTimeout(this.pulseOut) - - this.container.classList.remove('pulse') - - if (this.getProp('decoupled') && options.fromExternal) return - - this.pulseIn = setTimeout(()=>{ - this.container.classList.add('pulse') - this.pulseOut = setTimeout(()=>{ - this.container.classList.remove('pulse') - }, 150) - }, 16) - - } - - } - - - - } - - updateLabel() { - - if (!this.label) return - - if (this.getProp('label') === false) { - - if (this.widget.contains(this.label)) this.widget.removeChild(this.label) - - } else { - this.label.innerHTML = this.getProp('label') == 'auto'? - this.getProp('id'): - iconify(String(this.getProp('label')).replace(/ -
          - - - `}) - - if (this.getProp('icon')) { - this.widget.appendChild(html`
          `) - } else { - this.container.classList.add('no-icon') - } - - if (this.getProp('align') === 'left') this.widget.classList.add('left') - if (this.getProp('align') === 'right') this.widget.classList.add('right') - - this.select = this.widget.appendChild(html``) - this.text = DOM.get(this.widget, '.text')[0] - - this.parseValues() - - this.on('change', (e)=>{ - this.setValue(this.values[this.select.selectedIndex], {sync:true, send:true, fromLocal:true}) - }, {element: this.select}) - - this.on('fast-click', (e)=>{ - // allow resubmitting same value - this.select.selectedIndex = -1 - }, {element: this.select}) - - - this.select.selectedIndex = -1 - this.selected = -1 - this.container.classList.add('noselect') - - } - - parseValues() { - - super.parseValues() - - this.select.innerHTML = '' - for (var i = 0; i < this.values.length; i++) { - this.select.appendChild(html` - - `) - } - - } - - setValue(v,options={}) { - - var i = this.getIndex(v) - - this.value = this.values[i] - - this.select.selectedIndex = i - this.selected = i - - this.setLabel() - - if (document.activeElement === this.select && iOS) { - // force menu close on ios - this.select.blur() - } - - for (var j = 0; j < this.select.options.length; j++) { - this.select.options[j].classList.toggle('on', i === j) - } - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - - onPropChanged(propName, options, oldPropValue) { - - var ret = super.onPropChanged(...arguments) - - switch (propName) { - - case 'values': - this.parseValues() - return - case 'label': - this.setLabel() - return - } - - return ret - - } - -} - -Dropdown.dynamicProps = Dropdown.prototype.constructor.dynamicProps.concat( - 'values', - 'label' -) - - -export default Dropdown diff --git a/src/client/widgets/basics/file.mjs b/src/client/widgets/basics/file.mjs deleted file mode 100644 index 61bb427c..00000000 --- a/src/client/widgets/basics/file.mjs +++ /dev/null @@ -1,106 +0,0 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import uiFilebrowser from '../../ui/ui-filebrowser.mjs' -import {DOM} from '../../globals.mjs' - -export default class File extends Widget { - - static description() { - - return 'File/Folder selector (server-side).' - - } - - static defaults() { - - return super.defaults().extend({ - style: { - _separator_file_style: 'File style', - align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, - hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'}, - mode: {type: 'string', value: 'open', choices: ['open', 'save'], help: 'File browser mode'}, - click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap'}, - }, - class_specific: { - directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, - extension: {type: 'string|array', value: '*', help: 'Only display files with this extension. Multiple extensions can be specified with an array of strings (`["jpg", "jpeg"]`)'}, - allowDir: {type: 'boolean', value: false, help: 'Allow selecting a folder (by pressing "open" when no file is selected)'} - } - }) - - } - - constructor(options) { - - super({...options, html: html` - -
          -
          -
          - `}) - - if (this.getProp('align') === 'left') this.widget.classList.add('left') - if (this.getProp('align') === 'right') this.widget.classList.add('right') - if (this.getProp('mode') === 'save') this.widget.classList.add('save') - if (this.getProp('hidePath')) this.widget.classList.add('hide-path') - - this.text = DOM.get(this.widget, '.text')[0] - this.lastDir = null - - var ext = this.getProp('extension') - if (Array.isArray(ext)) { - ext = '(' + ext.join('|') + ')' - } - - this.on(this.getProp('click') ? 'click' : 'fast-click', (e)=>{ - - if (e.capturedByEditor === true) return - - uiFilebrowser({ - extension: ext.replace(/^\.?(.*)$/, '$1'), - directory: this.getProp('directory') === 'auto' ? this.lastDir : this.getProp('directory'), - loadDir: this.getProp('allowDir'), - save: this.getProp('mode') === 'save' - }, (path, root)=>{ - - var sep = path[0][0] === '/' ? '/' : '\\', - val = path.join(sep) - if (root) val = val.replace(root, sep).replace(sep + sep, sep) - - this.setValue(val, { - sync: true, - send: true - }) - - }, (path)=>{ - this.lastDir = path - }) - }, {element: this.widget}) - - } - - - setValue(v, options={}) { - - this.value = v - - if (this.getProp('hidePath') && typeof v === 'string') { - var sep = v[0] === '/' ? '/' : '\\' - if (v[v.length - 1] === sep) { - this.text.textContent = v.substr(0, v.length - 1).split(sep).pop() + sep - } else { - this.text.textContent = v.split(sep).pop() - } - } else { - this.text.textContent = v - } - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - - - - -} diff --git a/src/client/widgets/basics/input.mjs b/src/client/widgets/basics/input.mjs deleted file mode 100644 index ffc89619..00000000 --- a/src/client/widgets/basics/input.mjs +++ /dev/null @@ -1,249 +0,0 @@ -import html from 'nanohtml' -import Canvas from '../common/canvas.mjs' -import {deepCopy} from '../../utils.mjs' - -class Input extends Canvas { - - static description() { - - return 'Text input.' - - } - - static defaults() { - - return super.defaults().extend({ - style: { - _separator_input_style: 'Input style', - align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, - unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'}, - noCanvas: {type: 'boolean', value: false, help: [ - 'Set to `true` to not a use a canvas for rendering the value when not focused.', - 'Use this if the text renders blurry (less effecient when updating the value frequently).' - ]}, - }, - class_specific: { - asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'}, - numeric: {type: 'boolean|number', value: false, help: [ - 'Set to `true` to allow numeric values only and display a numeric keyboard on mobile devices', - 'Can be a number to specify the stepping value for mousewheel interaction (only when the input is focused).']}, - validation: {type: 'string', value: '', help: [ - 'Regular expression: if the submitted value doesn\'t match the regular expression, it will be reset to the last valid value.', - 'If leading and trailing slashes are omitted, they will be added automatically and the flag will be set to "gm"', - 'Examples:', - '- `^[0-9]*$` accepts digits only, any number of them', - '- `/^[a-z\s]{0,10}$/i` accept between 0 and 10 alphabetic characters and spaces (case insensitive)', - ]}, - maxLength: {type: 'number', value: '', help: ['Maximum number of characters allowed']} - }, - }) - - } - - constructor(options) { - - super({...options, html: html` - - - - `}) - - this.value = '' - this.stringValue = '' - this.focused = false - this.validation = null - this.useCanvas = !this.getProp('noCanvas') - - if (this.getProp('vertical')) this.widget.classList.add('vertical') - if (this.getProp('align') === 'left') this.widget.classList.add('left') - if (this.getProp('align') === 'right') this.widget.classList.add('right') - - this.input = html`` - - if (!this.useCanvas) { - this.widget.insertBefore(this.input, this.canvas) - } - - if (this.getProp('numeric')) { - this.input.type = 'number' - this.input.pattern = '[0-9\.]*' - this.input.inputMode = 'decimal' - this.input.step = parseFloat(this.getProp('numeric')) || 1 - } - - if (this.getProp('maxLength') !== '') { - this.maxLength = parseInt(this.getProp('maxLength')) - this.input.maxLength = this.maxLength - } else { - this.maxLength = -1 - } - - var asYouType = this.getProp('asYouType') - - if (this.getProp('validation') !== '') { - var validation = String(this.getProp('validation')), - flags = validation.match(/^\/.*\/.*$/) ? validation.split('/').pop() : 'gm', - regExpString = validation.match(/^\/.*\/.*$/) ? validation.replace(/^\/(.*)\/.*$/, '$1') : validation - - if (!regExpString.match(/^\^.*\$$/)) regExpString = '^' + regExpString + '$' - - this.validation = new RegExp(regExpString, flags) - } - - if (this.getProp('interaction')) { - - if (this.useCanvas) { - this.widget.setAttribute('tabindex', 0) - } - - this.on('focus', this.focus.bind(this), {element: this.widget}) - this.on('blur', (e)=>{ - this.blur(true) - }, {element: this.input}) - this.input.addEventListener('keydown', (e)=>{ - if (e.key == 'Enter') this.blur() - else if (e.key == 'Escape') this.blur(false) - else if (asYouType) { - setTimeout(()=>{ - this.inputChange() - }) - } - }) - } - - } - - focus() { - - if (this.focused) return - this.focused = true - - if (this.useCanvas) { - this.widget.insertBefore(this.input, this.canvas) - this.widget.setAttribute('tabindex','-1') - this.input.value = this.stringValue - this.input.focus() - } - - - setTimeout(()=>{ - this.input.select() - }) - - } - - blur(change=true) { - - if (!this.focused) return - this.focused = false - - if (change) this.inputChange() - - if (this.useCanvas) { - this.widget.removeChild(this.input) - this.widget.setAttribute('tabindex','0') - } else { - this.input.blur() - } - } - - inputChange() { - - this.setValue(this.input.value, {sync:true, send:true}) - - } - - - cacheCanvasStyle(style){ - - if (!this.useCanvas) return - - super.cacheCanvasStyle(style) - - } - - - resizeHandle(event){ - - if (!this.useCanvas) return - - super.resizeHandle(event) - - } - - setValue(v, options={} ) { - - if (this.validation && !this.getStringValue(v).match(this.validation)) { - this.input.value = this.value - return - } - - if (this.maxLength !== -1 && this.getStringValue(v).length > this.maxLength) { - v = this.getStringValue(v).substr(0, this.maxLength) - this.input.value = v - } - - try { - this.value = JSON.parse(v) - } catch (err) { - this.value = v - } - - if (this.value === '' || this.value === null) this.value = this.getProp('default') - - this.stringValue = this.getStringValue(this.value) - - if (this.useCanvas) { - this.batchDraw() - } else { - this.input.value = this.stringValue - } - - if (options.send && !options.fromSync) this.sendValue() - if (options.sync) this.changed(options) - - } - - draw() { - - if (!this.useCanvas) return - - var v = this.stringValue, - width = this.width, - height = this.height - - if (this.getProp('unit') && v.length) v += ' ' + this.getProp('unit') - - this.clear() - - this.ctx.fillStyle = this.cssVars.colorText - - // hack ? prevent weird offset added for unknown reason when font size increases - var offy = this.fontSize / 10 - - if (this.textAlign == 'center') { - this.ctx.fillText(v, Math.round(width/2), Math.round(height/2 + offy)) - } else if (this.textAlign == 'right') { - this.ctx.fillText(v, width, Math.round(height/2 + offy)) - } else { - this.ctx.fillText(v, 0, Math.round(height/2 + offy)) - } - - this.clearRect = [0, 0, width, height] - - } - - getStringValue(v) { - if (v === undefined) return '' - return typeof v != 'string' ? - JSON.stringify(deepCopy(v, this.decimals)).replace(/,/g, ', ') : - v - } - -} - -Input.dynamicProps = Input.prototype.constructor.dynamicProps - .filter(x=>x !== 'interaction') - - -export default Input diff --git a/src/client/widgets/basics/menu-base.mjs b/src/client/widgets/basics/menu-base.mjs deleted file mode 100644 index c5eadf08..00000000 --- a/src/client/widgets/basics/menu-base.mjs +++ /dev/null @@ -1,76 +0,0 @@ -import Widget from '../common/widget.mjs' -import {iconify} from '../../ui/utils.mjs' -import {deepEqual} from '../../utils.mjs' - -class MenuBase extends Widget { - - constructor(options) { - - super(options) - - this.value = undefined - this.values = [] - this.keys = [] - this.objectInValues = false - - } - - parseValues() { - - this.values = [] - this.keys = [] - - var values = this.getProp('values') || [] - - if ( - typeof values === 'object' && values !== null && - Array.isArray(values.labels) && Array.isArray(values.values) && - Object.keys(values).length === 2 && values.labels.length === values.values.length - ) { - - this.values = values.values - this.keys = values.labels - - } else { - - if (!Array.isArray(values) && !(typeof values === 'object' && values !== null)) { - values = values !== '' ? [values] : [] - } - - this.values = !Array.isArray(values) ? Object.values(values) : values - this.keys = !Array.isArray(values) ? Object.keys(values) : this.values - } - - this.objectInValues = this.values.some(x=>typeof x === 'object') - - } - - getIndex(value) { - - var index = this.values.indexOf(value) - if (index === -1 && this.objectInValues) { - for (var i = 0; i < this.values.length; i++) { - if (deepEqual(value, this.values[i])) return i - } - } - return index - - } - - setLabel() { - - var string = this.getProp('label') === 'auto' ? '%value' : this.getProp('label'), - i = this.selected - - - if (i > -1 && string) { - this.text.innerHTML = iconify(String(string).replace(/%value/g, typeof this.value === 'string' ? this.value : JSON.stringify(this.value)).replace(/%key/g, this.keys[i])) - } else { - this.text.innerHTML = iconify(String(string).replace(/%value/g, '').replace(/%key/g, '')) - } - - } - -} - -export default MenuBase diff --git a/src/client/widgets/basics/menu.mjs b/src/client/widgets/basics/menu.mjs deleted file mode 100644 index dd9a6e43..00000000 --- a/src/client/widgets/basics/menu.mjs +++ /dev/null @@ -1,390 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import MenuBase from './menu-base.mjs' -import {iconify} from '../../ui/utils.mjs' -import doubleTap from '../mixins/double_tap' -import iOS from '../../ui/ios.mjs' -import {DOM} from '../../globals.mjs' - -class Menu extends MenuBase { - - static description() { - - return 'Drag and drop menu with a circular or grid layout.' - - } - - static defaults() { - - return super.defaults().extend({ - geometry: { - _separator_menu_geometry: 'Menu geometry', - size: {type: 'number|array', value: 200, help: [ - '- If `layout` is `circular`: diameter (in px)', - '- Else: square size or `[width, height]` array', - ]}, - ignoreTabs: {type: 'boolean', value: false, help: 'Set to `true` to allow the menu overflowing its tab ancestors.'}, - - }, - style: { - _separator_menu_style: 'Menu style', - label: {type: 'string|boolean', value: 'auto', help: 'Displayed text (defaults to current value). Keywords `%key` and `%value` will be replaced by the widget\'s selected key/value.'}, - icon: {type: 'boolean', value: 'true', help: 'Set to `false` to hide the dropdown icon'}, - textAlign: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, - menuAlignV: {type: 'string', value: 'center', choices: ['center', 'top', 'bottom'], help: 'Set to `top` or `bottom` to change menu alignment (otherwise center)'}, - menuAlignH: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change menu alignment (otherwise center)'}, - layout: {type: 'string', value: 'vertical', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [ - 'Defines how the menu\'s item are laid out' - ]}, - gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns or a valid value for the css property "grid-template".'}, - }, - class_specific: { - mode: {type: 'string', value: 'default', choices: ['default', 'toggle', 'swipe', 'doubleTap', 'doubleTap-toggle'], help: [ - 'Interaction modes:', - '- `default`: opens on touch, closes and changes value on release', - '- `toggle`: opens on click, closes and changes value on next click', - '- `swipe`: opens on touch, changes value when the pointer moves above items, closes on release', - '- `doubleTap`: same as `default` but opens on double tap', - '- `doubleTap-toggle`: same as `toggle` but opens on double tap', - ]}, - values: {type: 'array|object', value: [1, 2, 3], help: [ - '`Array` of possible values to switch between : `[1,2,3]`', - '`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', - '`{"labels": [], "values": []}` `object` where `labels` and `values` arrays must be of the same length. This syntax allows using the same label for different values.', - ]}, - weights: {type: 'array', value: '', help: [ - '`Array` of `number` defining the weights of each value in `values`', - 'Ignored when `mode` is `grid`' - ]}, - } - }) - - } - - constructor(options) { - - super({...options, html: html` - -
          -
          - - `}) - - if (this.getProp('icon')) { - this.widget.appendChild(html`
          `) - } else { - this.container.classList.add('no-icon') - } - - this.widget.classList.add('text-align-' + this.getProp('textAlign')) - this.widget.classList.add('menu-align-h-' + this.getProp('menuAlignH')) - this.widget.classList.add('menu-align-v-' + this.getProp('menuAlignV')) - - this.menu = html`` - this.text = DOM.get(this.widget, '.text')[0] - - this.opened = false - - this.selected = -1 - - this.mode = String(this.getProp('mode')) - - this.parseValues() - - if (this.mode.includes('doubleTap')) { - - doubleTap(this, (e)=>{ - if (this.opened) return - this.open(e) - }, {element: this.widget, click: this.mode.includes('toggle')}) - - this.on('draginit',(e)=>{ - - if (this.opened && this.mode.includes('toggle')) { - - this.selectValue(e) - this.submitValue() - - } - - // multitouch is only needed for iOS which fails otherwise - }, {element: this.widget, multitouch: iOS}) - - - } else { - - this.on(this.mode.includes('toggle') ? 'click' : 'draginit',(e)=>{ - - if (this.opened && this.mode.includes('toggle')) { - - this.selectValue(e) - this.submitValue() - - } else if (!this.opened) { - - this.open(e) - - } - - }, {element: this.widget, multitouch: iOS}) - - - } - - if (!this.mode.includes('toggle')) { - - this.on('drag',(e)=>{ - - this.selectValue(e, true) - if (this.mode === 'swipe' && this.values[this.selected] !== this.value) { - this.submitValue() - } - - }, {element: this.widget}) - - this.on('dragend',()=>{ - - if (!this.opened) return - if (this.mode === 'swipe') { - this.close() - } else { - this.submitValue() - } - - }, {element: this.widget}) - - } else { - - this.toggleCloseHandler = (e)=>{ - if (!this.opened || this.menu.contains(e.target)) return - this.close() - } - document.addEventListener('fast-click', this.toggleCloseHandler) - - } - - this.setMode() - this.setSize() - - } - - open(e) { - - if (this.opened) return - - this.opened = true - this.fixParents() - - this.container.classList.add('on') - this.widget.appendChild(this.menu) - - } - - close() { - - if (!this.opened) return - - this.opened = false - this.fixParents() - DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) - this.container.classList.remove('on') - this.widget.removeChild(this.menu) - - } - - selectValue(e, drag) { - - // touch hover fix - var node = drag && e.isTouch ? document.elementFromPoint(e.clientX, e.clientY) - : e.target - - if (node === this.menu || !this.menu.contains(node)) { - DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) - this.selected = -1 - } else if (!node.classList.contains('active')) { - DOM.each(this.menu, '.active', (el)=>{el.classList.remove('active')}) - node.classList.add('active') - this.selected = DOM.index(node) - } - - } - - submitValue(e) { - - if (this.mode !== 'swipe') this.close() - if (this.selected > -1) { - this.setValue(this.values[this.selected], {send: true, sync: true}) - } - - } - - parseValues() { - - super.parseValues() - - var nval = this.values.length, - circular = this.getProp('layout') === 'circular', - weights = this.getProp('weights'), - totalWeight - - if (this.opened) this.widget.removeChild(this.menu) - this.menu.innerHTML = '' - - weights = Array.isArray(weights) ? weights.slice(0, nval) : Array(nval).fill(1) - if (weights.length < nval) weights = weights.concat(Array(nval - weights.length).fill(1)) - totalWeight = weights.reduce((a, b) => a + b, 0) - - var ac = 0 - for (var i = 0; i < nval; i++) { - let angle = Math.min(360 * weights[i] / totalWeight, 120), - skew = 90 - angle - - this.menu.appendChild(html` -
          -
          ${raw(iconify(this.keys[i]))}
          -
          - `) - ac+=angle - - } - - if (circular) this.menu.appendChild(html`
          `) - - - this.setValue(this.value) - - if (this.opened) this.widget.appendChild(this.menu) - - } - - setMode() { - - var layout = this.getProp('layout') - this.container.classList.toggle('box', layout !== 'circular') - this.container.classList.toggle('circular', layout === 'circular') - this.container.classList.toggle('grid', layout === 'grid') - this.container.classList.toggle('vertical', layout === 'vertical') - this.container.classList.toggle('horizontal', layout === 'horizontal') - - if (layout === 'grid') { - var template = this.getProp('gridTemplate') || Math.round(this.values.length / 2) - this.menu.style.gridTemplate = template === parseInt(template) ? `none / repeat(${template}, 1fr)` : template - } - - } - - setSize() { - - var size = this.getProp('size') - if (Array.isArray(size)) { - this.container.style.setProperty('--size', parseInt(size[0]) + 'rem') - this.container.style.setProperty('--size-box-w', parseInt(size[0]) + 'rem') - this.container.style.setProperty('--size-box-h', parseInt(size[1]) + 'rem') - - } else { - this.container.style.setProperty('--size', parseInt(size) + 'rem') - this.container.style.setProperty('--size-box-w', parseInt(size) + 'rem') - this.container.style.setProperty('--size-box-h', parseInt(size) + 'rem') - } - - } - - fixParents() { - - var parent = this.parent, - scrollX = 0, - scrollY = 0, - stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/ - - while (parent && parent.props && !String(parent.getProp('type')).match(stop)) { - - parent.modalBreakout += (this.opened ? 1 : -1) - if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout') - else if (parent.modalBreakout === 0) parent.container.classList.remove('modal-breakout') - else parent.modalBreakout = 0 - - scrollX += parent.widget.scrollLeft - scrollY += parent.widget.scrollTop - - parent = parent.parent - } - - scrollX += parent.widget.scrollLeft - scrollY += parent.widget.scrollTop - - this.container.style.setProperty('--parent-scroll-x', scrollX + 'px') - this.container.style.setProperty('--parent-scroll-y', scrollY + 'px') - - } - - setValue(v,options={}) { - - var i = this.getIndex(v) - - this.value = this.values[i] - this.selected = i - DOM.each(this.menu, '.on', (el)=>{el.classList.remove('on')}) - this.setLabel() - - if (i !== -1) { - DOM.get(this.menu, '.item')[i].classList.add('on') - } - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - - onPropChanged(propName, options, oldPropValue) { - - var ret = super.onPropChanged(...arguments) - - switch (propName) { - - case 'label': - this.setLabel() - return - case 'size': - this.setSize() - return - case 'layout': - this.parseValues() - this.setMode() - return - case 'columns': - this.setMode() - return - case 'values': - this.parseValues() - return - - } - - return ret - - } - - onRemove() { - - if (this.getProp('toggle')) { - document.removeEventListener('fast-click', this.toggleCloseHandler) - } - if (this.opened) { - this.close() - } - super.onRemove() - - } - -} - -Menu.dynamicProps = Menu.prototype.constructor.dynamicProps.concat( - 'label', - 'size', - 'layout', - 'columns', - 'values' -) - - -export default Menu diff --git a/src/client/widgets/basics/switch.mjs b/src/client/widgets/basics/switch.mjs deleted file mode 100644 index 88d12f31..00000000 --- a/src/client/widgets/basics/switch.mjs +++ /dev/null @@ -1,172 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import MenuBase from './menu-base.mjs' -import {iconify} from '../../ui/utils' -import {DOM} from '../../globals.mjs' - -class Switch extends MenuBase { - - static description() { - - return 'Value selector button.' - - } - - static defaults() { - - return super.defaults(Switch).extend({ - style: { - _separator_switch_style: 'Switch style', - colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'}, - layout: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'grid'], help:'Defines how items should be laid out'}, - gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns or a valid value for the css property "grid-template".'}, - wrap: {type: 'boolean|string', value: false, choices: [false, true, 'soft'], help: [ - 'Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.', - ]}, - }, - class_specific: { - values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [ - '`Array` of possible values to switch between : `[1,2,3]`', - '`Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept', - '`{"labels": [], "values": []}` `object` where `labels` and `values` arrays must be of the same length. This syntax allows using the same label for different values.', - ]}, - mode: {type: 'string', value: 'tap', choices: ['tap', 'slide', 'click', 'flip'], help: [ - 'Interaction mode:', - '- `tap`: activates when the pointer is down but prevents further scrolling', - '- `slide`: same as `tap` but allows sliding between values', - '- `click`: activates upon click only and allows further scrolling', - '- `flip`: selects the next value upon click regardless of where the widget is touched', - ]}, - } - }) - - } - - constructor(options) { - - super({...options, html: html``}) - - this.container.classList.add('layout-' + this.getProp('layout')) - if (this.getProp('wrap')) this.container.classList.add('wrap') - if (this.getProp('wrap') === 'soft') this.container.classList.add('wrap-soft') - - if (this.getProp('layout') === 'grid') { - var template = this.getProp('gridTemplate') || 2 - this.widget.style.gridTemplate = template === parseInt(template) ? `none / repeat(${template}, 1fr)` : template - } - - this.parseValues() - - - var dragCallback = (e, slide)=>{ - - var index = 0, - node = e.target - - if (e.target === this.widget && e.traversing === true && e.firstTarget) { - node = e.firstTarget - } - - if (slide && e.isTouch) { - // special traversing touch fix - node = document.elementFromPoint(e.clientX, e.clientY) - } - - if (node === this.widget || !this.widget.contains(node)) return - - while ((node = node.previousSibling)) { - if (node.nodeType != 3) { - index++ - } - } - - var value = this.values[index] - - if (slide && value === this.value) return - - this.setValue(value, {sync: true, send: true}) - - } - - if (this.getProp('mode') === 'tap' || this.getProp('mode') === 'slide') { - this.on('draginit', dragCallback , {element: this.widget}) - this.on('drag', (e)=>{ - if (this.getProp('mode') === 'slide' || e.traversing) dragCallback(e, true) - } , {element: this.widget}) - } else if (this.getProp('mode') === 'click') { - this.on('click', dragCallback, {element: this.widget}) - } else if (this.getProp('mode') === 'flip') { - this.on('click', ()=>{ - var i = (this.getIndex(this.value) + 1) % this.values.length - this.setValue(this.values[i], {sync: true, send: true}) - }, {element: this.widget}) - } - - } - - parseValues() { - - super.parseValues() - - this.widget.innerHTML = '' - - for (var i = 0; i < this.values.length; i++) { - - this.widget.appendChild(html` - ${raw(iconify(this.keys[i]))} - `) - - } - - this.setValue(this.value) - - } - - setValue(v, options={}) { - - var i = this.getIndex(v) - - this.value = this.values[i] - - DOM.each(this.widget, '.on', (el)=>{el.classList.remove('on')}) - - if (i !== -1) { - DOM.get(this.widget, 'value')[i].classList.add('on') - } - - if (options.send) this.sendValue(this.value) - if (options.sync) this.changed(options) - - } - - onPropChanged(propName, options, oldPropValue) { - - var ret = super.onPropChanged(...arguments) - - switch (propName) { - - case 'values': - this.parseValues() - } - - return ret - - } - setCssVariables() { - - super.setCssVariables() - - this.container.classList.toggle('padding-0', this.getProp('padding') === -1) - - } -} - -Switch.dynamicProps = Switch.prototype.constructor.dynamicProps.concat( - 'values' -) - -Switch.cssVariables = Switch.prototype.constructor.cssVariables.concat( - {js: 'colorTextOn', css: '--color-text-on'} -) - -export default Switch diff --git a/src/client/widgets/basics/textarea.mjs b/src/client/widgets/basics/textarea.mjs deleted file mode 100644 index 0e426827..00000000 --- a/src/client/widgets/basics/textarea.mjs +++ /dev/null @@ -1,119 +0,0 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import {DOM} from '../../globals.mjs' - -class TextArea extends Widget { - - static description() { - - return 'Text area (multi line input). Tip: hit shift + enter for new lines.' - - } - - static defaults() { - - return super.defaults().extend({ - style: { - // _separator_input_style: 'Textarea style', - }, - class_specific: { - - }, - }) - - } - - constructor(options) { - - super({...options, html: html` - - - - `}) - - this.value = '' - this.stringValue = '' - this.focused = false - this.validation = null - this.input = DOM.get(this.widget, 'textarea')[0] - - if (this.getProp('align') === 'left') this.widget.classList.add('left') - if (this.getProp('align') === 'right') this.widget.classList.add('right') - - - if (this.getProp('interaction')) { - - this.input.setAttribute('tabindex', 0) - this.on('focus', this.onFocus.bind(this), {element: this.input}) - this.on('blur', (e)=>{ - this.blur(true) - }, {element: this.input}) - - this.input.addEventListener('keydown', (e)=>{ - if (e.key == 'Enter' && !e.shiftKey) { - // enter - e.preventDefault() - this.blur() - } - else if (e.key == 'Escape') { - // esc - this.blur(false) - this.input.value = this.value - } - }) - - } - - } - - onFocus() { - - if (this.focused) return - this.focused = true - - } - - focus() { - - this.input.focus() - - } - - blur(change=true) { - - if (!this.focused) return - this.focused = false - - this.input.blur() - - if (change) this.inputChange() - - } - - inputChange() { - - this.setValue(this.input.value, {sync:true, send:true}) - - } - - - setValue(v, options={} ) { - - this.value = v === '' || v === null ? this.getProp('default') : String(v) - - if (this.value === '') this.value = this.getProp('default') - - if (this.input.value !== this.value) this.input.value = this.value - - if (options.send && !options.fromSync) this.sendValue() - if (options.sync) this.changed(options) - - } - -} - -TextArea.dynamicProps = TextArea.prototype.constructor.dynamicProps - .filter(x=>x !== 'interaction') - - -export default TextArea diff --git a/src/client/widgets/common/canvas.mjs b/src/client/widgets/common/canvas.mjs deleted file mode 100644 index 6f63d34a..00000000 --- a/src/client/widgets/common/canvas.mjs +++ /dev/null @@ -1,253 +0,0 @@ -import html from 'nanohtml' -import fastdom from 'fastdom' -import Widget from './widget.mjs' -import * as resize from '../../events/resize.mjs' -import canvasQueue from './queue.mjs' -import {ENV, CANVAS_SCALING, ELECTRON_NOGPU, DOM} from '../../globals.mjs' - - -class Canvas extends Widget { - - static defaults() { - - var defaults = super.defaults(Canvas) - defaults.style.css.help.push( - 'Canvas-based widget have their computed width and height available as css variables (read-only):', - '- `--widget-width`', - '- `--widget-height`', - ) - defaults.scripting.onValue.help.push( - 'Canvas-based widget have their computed width and height available as local variables:', - '- `locals.width`', - '- `locals.height`', - ) - return defaults - - } - - constructor(options) { - - super(options) - - this.canvas = DOM.get(this.container, 'canvas')[0] - - this.ctx = this.canvas.getContext(this.getProp('contextType') || '2d',{ - desynchronized: !ELECTRON_NOGPU && ENV.desynccanvas ? true : false, - alpha: true - }) - - this.height = undefined - this.width = undefined - this.scaling = 1 - - this.clearRect = [] - - this.hasSize = false - - this.colors = {} - this.cssVars = {} - - this.on('resize', this.resizeHandleProxy.bind(this), {element: this.canvas}) - - this.ctx.arc = (x, y, r, s, e, c)=>{ - - this.ctx.__proto__.arc.call(this.ctx, x, y, Math.max(0,r), s, e, c) - - } - - } - - resizeHandleProxy() { - - fastdom.measure(()=>{ - this.resizeHandle(...arguments) - }) - - } - - resizeHandle(event){ - - var {width, height, style} = event, - ratio = CANVAS_SCALING * this.scaling - - this.height = height - this.width = width - - this.parsersLocalScope.height = this.height - this.parsersLocalScope.width = this.width - - this.clearRect = [] - - this.cacheCanvasStyle(style) - - fastdom.mutate(()=>{ - - this.canvas.setAttribute('width', width * ratio) - this.canvas.setAttribute('height', height * ratio) - this.container.style.setProperty('--widget-height', this.height + 'rem') - this.container.style.setProperty('--widget-width', this.width + 'rem') - - this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily - this.ctx.textBaseline = 'middle' - this.ctx.textAlign = this.textAlign - - if (ratio != 1) { - this.ctx.setTransform(1, 0, 0, 1, 0, 0) - this.ctx.scale(ratio, ratio) - } - - this.extraResizeHandle(event) - - if (!this.hasSize) { - this.hasSize = true - this.setVisibility() - } - - if (this.width > 0 && this.height > 0 && this.visible) { - this.draw() - } - - }) - - } - - extraResizeHandle(event) { - - // to be overridden if subclass needs additional actions - // before redraw - - } - - setVisibility(){ - - var visible = this.visible - super.setVisibility() - if (!visible && this.visible) this.batchDraw() - - } - - cacheCanvasStyle(style){ - - style = style || window.getComputedStyle(this.canvas) - - for (var data of this.constructor.cssVariables) { - - var val = style.getPropertyValue(data.css).trim() - - if (typeof val === 'string' && val.match(/(var|calc)\(/)) { - // property not computed because of calc() or var() in user style - // -> attempt to force calculation - var dummy = html`
          ` - this.container.appendChild(dummy) - let s = window.getComputedStyle(dummy) - val = parseInt(s.getPropertyValue('width')) - this.container.removeChild(dummy) - } - - this.cssVars[data.js] = data.toJs ? data.toJs(val) : val - - - } - - this.fontFamily = style.getPropertyValue('font-family').trim() - this.textAlign = style.getPropertyValue('text-align').trim() - this.fontSize = parseFloat(style.getPropertyValue('font-size').trim()) - this.fontWeight = parseFloat(style.getPropertyValue('font-weight').trim()) - - } - - clear() { - - if (!this.clearRect.length) { - - this.ctx.clearRect(0, 0, this.width, this.height) - - } else if (typeof this.clearRect[0] == 'object') { - - for (let i in this.clearRect) { - this.ctx.clearRect(...this.clearRect[i]) - } - - } else { - - this.ctx.clearRect(...this.clearRect) - - } - - } - - batchDraw() { - - if (this.hasSize && this.visible) canvasQueue.push(this) - - } - - draw(){ - throw new Error('Calling unimplemented draw() method') - } - - onPropChanged(propName, options, oldPropValue) { - - var ret = super.onPropChanged(...arguments) - - switch (propName) { - - case 'colorText': - case 'colorWidget': - case 'colorFill': - case 'colorStroke': - case 'colorKnob': - case 'alphaStroke': - case 'alphaFillOff': - case 'alphaFillOn': - case 'colorBg': - case 'pointSize': - case 'knobSize': - fastdom.measure(()=>{ - this.cacheCanvasStyle() - fastdom.mutate(()=>{ - this.batchDraw() - }) - }) - return - case 'css': - if (!/\/\*\s*noresize\s*\*\//.test(this.getProp('css'))) resize.check(this.canvas, true) - fastdom.measure(()=>{ - this.cacheCanvasStyle() - fastdom.mutate(()=>{ - this.batchDraw() - }) - }) - // falls through - case 'lineWidth': - case 'padding': - resize.check(this.canvas, true) - fastdom.measure(()=>{ - this.cacheCanvasStyle() - fastdom.mutate(()=>{ - this.batchDraw() - }) - }) - return - } - - return ret - - - } - - onRemove() { - this.off('resize') - this.canvas.width = 0 - this.canvas.height = 0 - super.onRemove() - } - -} - -Canvas.cssVariables = Canvas.prototype.constructor.cssVariables.concat( - {js: 'alphaPips', css: '--alpha-pips', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)}, - {js: 'alphaPipsText', css: '--alpha-pips-text', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)} -) - -export default Canvas diff --git a/src/client/widgets/common/osc-receiver.mjs b/src/client/widgets/common/osc-receiver.mjs deleted file mode 100644 index 7809355d..00000000 --- a/src/client/widgets/common/osc-receiver.mjs +++ /dev/null @@ -1,88 +0,0 @@ -import osc from '../../osc.mjs' -import {isJSON, isJSONObject} from '../../utils.mjs' -import {JSON5} from '../../globals.mjs' - -export default class OscReceiver { - - constructor(options) { - - var {address, value, parent, propName, usePreArgs} = options - - if (typeof value === 'string' && isJSON(value)) { - try { - this.value = JSON5.parse(value) - } catch (err) { - this.value = value - } - } else { - this.value = value - } - - this.parent = parent - this.propNames = [propName] - this.usePreArgs = usePreArgs - this.boundCallback = this.callback.bind(this) - this.prefix = '' - this.setAddress(address) - - } - - setAddress(address) { - - if (this.address !== address) { - - if (this.address) osc.off(this.prefix + this.address, this.boundCallback, this.parent) - - if (address) this.address = address - - if (this.address[0] !== '/') { - var parentAddress = this.parent.getProp('address') || this.parent.resolveProp('address', undefined, false, this) - if (parentAddress === 'auto') { - var id = this.parent.getProp('id') || this.parent.resolveProp('id', undefined, false, this) - parentAddress = '/' + id - } - this.prefix = parentAddress - if (this.prefix[this.prefix.length - 1] !== '/') this.prefix += '/' - } - - osc.on(this.prefix + this.address, this.boundCallback, {context: this.parent}) - - } - - } - - addProp(propName){ - - if (!this.propNames.includes(propName)) this.propNames.push(propName) - - } - - callback(data) { - - var {args} = data - - if (!Array.isArray(args)) args = [args] - var preArgs = this.usePreArgs ? (this.parent.getProp('preArgs') || []) : [] - if (!Array.isArray(preArgs) && preArgs !== '') preArgs = [preArgs] - if (args.length >= preArgs.length) { - for (var i in preArgs) { - if (preArgs[i] !== args[i]) return - } - if (!osc.match(this.parent, data)) return - var value = args.slice(preArgs.length) - if (value.length < 2) value = value[0] - if (typeof value === 'string' && isJSONObject(value)) { - try { - this.value = JSON5.parse(value) - } catch (err) { - this.value = value - } - } else { - this.value = value - } - this.parent.updateProps(this.propNames) - } - - } - -} diff --git a/src/client/widgets/common/queue.mjs b/src/client/widgets/common/queue.mjs deleted file mode 100644 index b983e137..00000000 --- a/src/client/widgets/common/queue.mjs +++ /dev/null @@ -1,69 +0,0 @@ -import EventEmitter from '../../events/event-emitter.mjs' -import {CANVAS_FRAMERATE} from '../../globals.mjs' - -class CanvasQueue extends EventEmitter{ - - constructor() { - - super() - - this.queue = {} - this.flushed = 0 - this.running = false - this.frameLength = 1000 / CANVAS_FRAMERATE - this.lastFrame = 0 - this.boundLoop = this.loop.bind(this) - - } - - push(widget) { - - this.queue[widget.hash] = widget - this.flushed = 0 - if (!this.running) this.startLoop() - - } - - startLoop() { - - this.running = true - this.flushed = 0 - requestAnimationFrame(this.boundLoop) - - } - - flush() { - - for (var h in this.queue) { - if (this.queue[h].width > 0 && this.queue[h].height > 0 && this.queue[h].visible) { - this.queue[h].draw() - } - } - - this.queue = {} - this.flushed++ - - } - - loop(timestamp) { - - if (this.flushed >= 10) { - this.running = false - return - } - - requestAnimationFrame(this.boundLoop) - - var delta = timestamp - this.lastFrame - - if (delta > this.frameLength) { - this.lastFrame = timestamp - (delta % this.frameLength) - this.trigger('frame', {timestamp}) - this.flush() - } - - } - -} - -export default new CanvasQueue() diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs deleted file mode 100644 index a5626a35..00000000 --- a/src/client/widgets/common/widget.mjs +++ /dev/null @@ -1,1482 +0,0 @@ -import html from 'nanohtml' -import morph from 'nanomorph' -import scopeCss from 'scope-css' -import {nanoid} from 'nanoid' -import EventEmitter from '../../events/event-emitter.mjs' -import osc from '../../osc.mjs' -import widgetManager from '../../managers/widgets.mjs' -import {urlParser, balancedReplace} from '../utils.mjs' -import Vm from '../vm.mjs' -import * as resize from '../../events/resize.mjs' -import OscReceiver from './osc-receiver.mjs' -import {deepCopy, deepEqual, isJSON} from '../../utils.mjs' -import Script from '../scripts/script.mjs' -import {PXSCALE, JSON5} from '../../globals.mjs' - -var updateWidget = ()=>{}, - uiConsole, widgetTree, widgetDragResize, sessionManager - -setTimeout(async()=>{ - // use setTimeout to fix init order in safari... - updateWidget = (await import('../../editor/data-workers.mjs')).updateWidget - uiConsole = (await import('../../ui/ui-console.mjs')).default - widgetTree = (await import('../../editor/index.mjs')).default.widgetTree - widgetDragResize = (await import('../../editor/index.mjs')).default.widgetDragResize - sessionManager = (await import('../../managers/session/index.mjs')).default -}) - -var vm = new Vm() - -var oscReceiverState = {} - -var OSCProps = [ - 'decimals', - 'address', - 'preArgs', - 'typeTags', - 'target', - 'bypass' -] - -class Widget extends EventEmitter { - - static description() { - - return '' - - } - - static defaults(Class=Widget) { - - var defaults = { - widget: { - lock: {type: 'boolean', value: false, help: 'Set to `true` to prevent modifying this widget with the editor. This will not prevent deleting the widget or moving it from a container to another.'}, - type: {type: 'string', value: 'auto', help: 'Widget type'}, - id: {type: 'string', value: 'auto', help: 'Widgets sharing the same `id` will act as clones and update each other\'s value(s) without sending extra osc messages (avoid doing so unless the widgets expect the exact same values).' }, - visible: {type: 'boolean', value: true, help: 'Set to `false` to hide the widget.'}, - interaction: {type: 'boolean', value: true, help: 'Set to `false` to disable pointer interactions.'}, - comments: {type: 'string', value: '', help: 'User comments.'}, - }, - geometry: { - left: {type: 'number|string', value: 'auto', help: [ - 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).', - 'Otherwise, the widget will be positioned at absolute coordinates' - ]}, - top: {type: 'number|percentage', value: 'auto', help: [ - 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).', - 'Otherwise, the widget will be positioned at absolute coordinates' - ]}, - width: {type: 'number|percentage', value: 'auto', help: 'Widget width'}, - height: {type: 'number|percentage', value: 'auto', help: 'Widget height'}, - expand: {type: 'boolean|number', value: false, help: 'If parent\'s layout is `vertical` or `horizontal`, set this to `true` to stretch the widget to use available space automatically.'}, - }, - style: { - colorText: {type: 'string', value: 'auto', help: 'Text color. Set to "auto" to inherit from parent widget. Must be a valid css color.'}, - colorWidget: {type: 'string', value: 'auto', help: 'Widget\'s default accent color. Set to "auto" to inherit from parent widget. Must be a valid css color.'}, - colorStroke: {type: 'string', value: 'auto', help: 'Stroke color. Set to "auto" to use `colorWidget`. Must be a valid css color.'}, - colorFill: {type: 'string', value: 'auto', help: 'Fill color. Set to "auto" to use `colorWidget`. Must be a valid css color.'}, - alphaStroke: {type: 'number', value: 'auto', help: 'Stroke color opacity.'}, - alphaFillOff: {type: 'number', value: 'auto', help: 'Fill color opacity (off).'}, - alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'}, - lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'}, - borderRadius: {type: 'number|string', value: 'auto', help: 'Border radius expressed as a number or a css string. This property may not work for all widgets.'}, - padding: {type: 'number', value: 'auto', help: 'Inner spacing.'}, - html: {type: 'string', value: '', editor: 'html', syntaxChecker: false, help: [ - 'Custom html content to be inserted in the widget (before the widget\'s content). Elements are all unstyled by default, `css` should be used to customize their appearance.', - 'The code is automatically wrapped in <div class="html"></div>', - 'Note: inserting scripts may break the application.', - ]}, - css: {type: 'string', value: '', editor: 'css', syntaxChecker: false, help: [ - 'CSS rules. See documentation.', - 'Some style-related properties can be set or read from css using css variables:', - ...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`') - ]}, - }, - class_specific: { - - }, - value: { - value: {type: '*', value: '', help: 'Define the widget\'s value depending on other widget\'s values / properties using the advanced property syntax'}, - default: {type: '*', value: '', help: 'If set, the widget will be initialized with this value when the session is loaded.'}, - linkId: {type: 'string|array', value: '', help: [ - 'Widgets sharing the same `linkId` update each other\'s value(s) AND send their respective osc messages.', - 'When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)', - 'When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending)' - ]}, - }, - osc: { - address: {type: 'string', value: 'auto', help: [ - 'OSC address for sending / receiving messages, it must start with a slash (`/`)', - 'By default ("auto"), the widget\'s id is used: `/widget_id`', - ]}, - preArgs: {type: '*|array', value: '', help: [ - 'A value or array of values that will be prepended to the widget\'s value in the OSC messages it sends.', - 'Incoming messages must match these to affect by the widget.', - ]}, - typeTags: {type: 'string', value: '', help: [ - 'Defines the osc argument types, one letter per argument (including preArgs)', - '- If empty, the types are inferred automatically from the values (with numbers casted to floats by default)', - '- If there are more arguments than type letters, the last type is used for the extra arguments', - 'See OSC 1.0 specification for existing typetags' - ]}, - decimals: {type: 'integer', value: 2, help: [ - 'Defines the number of decimals to send.', - ]}, - target: {type: 'string|array|null', value: '', help: [ - 'This defines the targets of the widget\'s OSC messages', - '- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:portA", "ip:portB"]`', - '- If midi is enabled, targets can be `midi:device_name`', - '- If no target is set, messages can still be sent if the server has default targets', - ]}, - ignoreDefaults: {type: 'boolean', value: false, help: 'Set to `true` to ignore the server\'s default targets'}, - bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'} - }, - scripting: { - onCreate: {type: 'script', value: '', editor: 'javascript', help: ['Script executed when the widget (and its children) is created. See documentation.']}, - onValue: {type: 'script', value: '', editor: 'javascript', help: ['Script executed when the widget\'s value updates. See documentation.']}, - } - } - - Object.defineProperty(defaults, '_props', { - enumerable: false, - value: function(){ - let props = {} - for (let category in this) { - for (let k in this[category]) { - if (k[0] === '_') continue - props[k] = this[category][k].value - } - } - return props - } - }) - - Object.defineProperty(defaults, 'extend', { - enumerable: false, - value: function(obj){ - for (let i in obj) { - if (obj[i] === null) delete this[i] - else { - if (this[i] === undefined) this[i] = {} - for (let j in obj[i]) { - if (obj[i][j] === null) delete this[i][j] - else if (j[0] === '_') { - this[i][j] = obj[i][j] - } else { - if (!this[i][j]) this[i][j] = {} - Object.assign(this[i][j], obj[i][j]) - } - } - } - } - return this - } - }) - - return defaults - - } - - constructor(options={}) { - - super() - - this.widget = options.html - this.props = options.props - this.errors = {} - this.parent = options.parent - this.parentNode = options.parentNode - this.hash = options.hash || 'W' + nanoid(9) - this.children = [] - this.reCreateOptions = options.reCreateOptions - this.meta = options.meta || {} - this.removed = false - this.mounted = false - this.visible = true - this.scopes = [] - - if (options.value !== undefined) this.value = options.value - - this.parsers = {} - this.parsersLocalScope = options.locals || {} - this.timeouts = {} - this.intervals = {} - this.variables = options.variables || {} - this.fragments = {} - - this.createPropsCache() - - if (this.getProp('id') == 'root' && this.parent !== widgetManager) { - this.props.id = '_root' - this.cachedProps.id = '_root' - } - - if (this.getProp('type') == 'root' && this.parent !== widgetManager) { - this.props.type = 'panel' - this.cachedProps.type = 'panel' - } - - - - // cache decimals - if (this.props.decimals !== undefined) { - this.decimals = Math.min(20, Math.max(this.getProp('decimals'), 0)) - } - - // scripting - this.scripts = {} - - if (this.getProp('onCreate')) { - this.scripts.onCreate = new Script({ - widget: this, - property: 'onCreate', - code: this.getProp('onCreate'), - context: {value: 0} - }) - } - - if (this.getProp('onValue')) { - this.scripts.onValue = new Script({ - widget: this, - property: 'onValue', - code: this.getProp('onValue'), - context: {value: 0, id: '', touch: undefined} - }) - this.on('value-changed', (e)=>{ - if (e.widget === this && this.mounted && e.options.script !== false) { - this.scripts.onValue.run({ - value: e.options.widget ? e.options.widget.value : this.value, - id: e.options.id || e.id - }, e.options) - } - }) - } - - if (this.getProp('onTouch') && this.getProp('type') !== 'canvas') { - this.scripts.onTouch = new Script({ - widget: this, - property: 'onTouch', - code: this.getProp('onTouch'), - context: {event: {}, value: 0} - }) - this.on('touch', (e)=>{ - var multi = Array.isArray(e.touch), - state = multi ? e.touch[1] : e.touch - this.scripts.onTouch.run({ - event: {type: state ? 'start' : 'stop', handle: multi ? e.touch[0] : undefined}, - value: this.value - }, {sync: true, send: true}) - }) - } - - // legacy touch state in onValue script - if (String(this.getProp('onValue')).includes('touch') && !this.getProp('onTouch')) { - this.on('touch', (e)=>{ - this.scripts.onValue.run({ - value: this.value, - id: this.getProp('id'), - touch: e.touch - }, {sync: true, send: true}) - }) - } - - - this.style = null - this.container = html` -
          - ` - - if (this.widget) this.container.appendChild(this.widget) - this.container._widget_instance = this - - - this.container.classList.toggle('no-interaction', !this.getProp('interaction')) - - this.setContainerStyles() - this.setCssVariables() - this.setVisibility() - - this.extraHtml = null - if (this.getProp('html')) this.updateHtml() - - } - - contains(widget) { - - if (this.children.indexOf(widget) > 0) return true - - var parent = widget.parent - while (parent && parent !== widgetManager) { - if (parent === this) return true - parent = parent.parent - } - return false - - } - - getAllChildren() { - - var children = [] - for (var i = 0; i < this.children.length; i++) { - if (!this.children[i]) continue - children.push(this.children[i]) - children = children.concat(this.children[i].getAllChildren()) - } - return children - - - } - - created(index) { - - this.trigger('widget-created', { - id: this.getProp('id'), - widget: this, - options: this.reCreateOptions, - index: index - }) - - if (this.scripts.onCreate) this.scripts.onCreate.run({value: this.value}, {sync: true, send: true, onCreate: true}) - - } - - changed(options) { - - this.trigger('value-changed', { - widget: this, - options: options, - id: this.getProp('id'), - linkId: this.getProp('linkId') - }) - - } - - sendValue(overrides, options={}) { - - if (this.selfLinkedOSCProps) { - this.updateProps(this.selfLinkedOSCProps, this) - } - - if (this.getProp('bypass') && !options.force) return - - var data = { - h: this.hash, - v: this.getValue(true), - } - - if (this.getProp('ignoreDefaults') && !options.force) data.i = 1 - - if (overrides) { - for (var k in overrides) { - data[k] = overrides[k] - } - } - - if (options.syncOnly) { - - osc.sync(data) - - } else { - - osc.send(data) - - } - - } - - setValue() {} - - getValue(withdecimals) { - - return deepCopy(this.value, withdecimals ? this.decimals : undefined) - - } - - areEquivalentValueProps(a, b) { - /* See commit c1720b4a and https://openstagecontrol.discourse.group/t/widget-update-when-setting-value-via-edit/4186/7 - * for the root of this... - */ - - var currentValue = deepCopy(this.value) - var va, vb - - this.setValue(a, {coerceTest: true}) - va = deepCopy(this.value) - this.setValue(b, {coerceTest: true}) - vb = deepCopy(this.value) - - this.setValue(currentValue) - - return deepEqual(va, vb) - } - - checkLinkedProps(propNames) { - - // Dynamic props cache check - var linkedProps = [] - - Object.values(this.nestedLinkedProps).forEach(l => linkedProps = linkedProps.concat(l)) - Object.values(this.linkedProps).forEach(l => linkedProps = linkedProps.concat(l)) - Object.values(this.linkedPropsValue).forEach(l => linkedProps = linkedProps.concat(l)) - Object.values(this.oscReceivers).forEach(r => linkedProps = linkedProps.concat(r.propNames)) - Object.values(this.variables).forEach(r => linkedProps = linkedProps.concat(r.propNames)) - Object.values(this.fragments).forEach(l => linkedProps = linkedProps.concat(l)) - - if ( - // if prop/osc listeners/custom vars have changed (@{} / OSC{} / VAR{}) - // refresh the widget's props cache and update linked props bindings - propNames.map(x => this.props[x]).some(x => typeof x === 'string' && x.match(/(OSC|@|VAR|IMPORT)\{/)) - || propNames.some(n => linkedProps.includes(n)) - ) { - this.createPropsCache() - return true - } - - } - - createPropsCache() { - - /* - scopable: cache id prefixes (scopes), from nearest to farthest - */ - this.scopes = [] - if (this.meta.scopable) { - var parent = this.parent - do { - if (parent.getProp('scoped')) { - this.scopes.push(parent.scopeId) - } - parent = parent.parent - } while (parent.meta.scopable || parent.getProp('scoped')) - for (var i=0; i < this.scopes.length; i++) { - this.scopes[i] = this.scopes.slice(i).reverse().join('/') + '/' - } - } - // include global scope - if (this.scopes.length) this.scopes.push('') - - // @{props} links lists - this.linkedProps = {} - this.nestedLinkedProps = {} - this.linkedPropsValue = {} - - // reset VAR{} links - for (var name in this.variables) { - this.variables[name].propNames = [] - } - - // OSC{/path} receivers - if (this.oscReceivers) { - this.removeOscReceivers() - } - this.oscReceivers = {} - - // IMPORT{} fragments - this.fragments = {} - - // Cache resolved props - this.cachedProps = {} - this.cachedProps.uuid = this.hash - - for (var k in this.props) { - if (k != 'widgets' && k != 'tabs') { - this.cachedProps[k] = this.resolveProp(k, undefined, true) - } else { - this.cachedProps[k] = this.props[k] - } - } - - this.createLinkedPropsBindings() - - } - - createLinkedPropsBindings() { - - if (!this.linkedCreatedCallback && Object.keys(this.linkedProps).length) { - - this.linkedCreatedCallback = (e)=>{ - this.onLinkedPropsChanged(e, 'widget-created') - } - - this.linkedPropChangedCallback = (e)=>{ - this.onLinkedPropsChanged(e, 'prop-changed') - } - - widgetManager.on('widget-created', this.linkedCreatedCallback, {context: this}) - widgetManager.on('prop-changed', this.linkedPropChangedCallback, {context: this}) - - } else if (this.linkedCreatedCallback && !Object.keys(this.linkedProps).length) { - - widgetManager.off('widget-created', this.linkedCreatedCallback) - widgetManager.off('prop-changed', this.linkedPropChangedCallback) - delete this.linkedCreatedCallback - delete this.linkedPropChangedCallback - - } - - if (!this.linkedValueChangedCallback && Object.keys(this.linkedPropsValue).length) { - - this.linkedValueChangedCallback = (e)=>{ - this.onLinkedPropsChanged(e, 'value-changed') - } - - widgetManager.on('value-changed', this.linkedValueChangedCallback, {context: this}) - - } else if (this.linkedPropsValueCallback && !Object.keys(this.linkedPropsValue).length) { - - widgetManager.off('value-changed', this.linkedValueChangedCallback) - delete this.linkedValueChangedCallback - - } - - if (!this.linkedFragmentCallback && Object.keys(this.fragments).length) { - - this.linkedFragmentCallback = (e)=>{ - var {path} = e - if (this.fragments[path]) this.updateProps(this.fragments[path]) - } - - sessionManager.on('fragment-updated', this.linkedFragmentCallback, {context: this}) - - } else if (this.linkedFragmentCallback && !Object.keys(this.fragments).length) { - - sessionManager.off('fragment-updated', this.linkedFragmentCallback) - delete this.linkedFragmentCallback - - } - - var selfLinkedOSCProps = (this.linkedPropsValue['this'] || []).filter(i=>OSCProps.indexOf(i) > -1) - this.selfLinkedOSCProps = selfLinkedOSCProps.length ? selfLinkedOSCProps : false - - } - - onLinkedPropsChanged(e, type) { - - var {id, widget, options} = e, - changedProps = type === 'prop-changed' ? e.props : type === 'value-changed' ? ['value'] : undefined, - linkedProps = type === 'value-changed' ? this.linkedPropsValue : this.linkedProps - - if (widget === this.parent) { - if (type === 'widget-created') return - id = 'parent' - } else if (this.parent !== widgetManager && widget === this.parent.parent && this.parent.getProp('type') === 'clone') { - // ignore clone wrapper when resolving properties - id = 'parent' - } - - if (widget === this) id = 'this' - - /* - scopable: attempt to resolve scoped widget updates against ids in advanced syntax blocks - */ - if (this.scopes.length) { - var unprefixedId - for (var p of this.scopes) { - if (id.includes(p)) { - unprefixedId = id.replace(p, '') - if (this.nestedLinkedProps[unprefixedId] || linkedProps[unprefixedId]) { - id = unprefixedId - break - } - } - } - } - - if (this.nestedLinkedProps[id]) { - this.updateLinkedPropsWithNesting(id) - } - - if (linkedProps[id]) { - this.updateProps(linkedProps[id], widget, options, changedProps) - } - - } - - removeOscReceivers() { - - osc.off(undefined, undefined, this) - for (var i in this.oscReceivers) { - oscReceiverState[i] = this.oscReceivers[i].value - } - this.oscReceivers = {} - - } - - updateLinkedPropsWithNesting(i) { - - for (var prop of this.nestedLinkedProps[i]) { - - // 1. remove all linked props found in properties bound to the nested link - for (var linksStores of [this.linkedPropsValue, this.linkedProps]) { - for (let id in linksStores) { - if (linksStores[id].includes(prop)) { - linksStores[id].splice(linksStores[id].indexOf(prop), 1) - if (!linksStores[id].length) delete linksStores[id] - } - } - } - - - // 2. resolve these props again and recreate links (3rd arg to true) - this.resolveProp(prop, undefined, true, this) - - } - - - } - - resolveProp(propName, propValue, storeLinks=true, originalWidget, originalPropName, context, recursive) { - - propValue = propValue !== undefined ? propValue : deepCopy(this.props[propName]) - originalWidget = originalWidget || this - originalPropName = originalPropName || propName - - var variables = {}, - defaultScope = this.constructor.parsersContexts[propName] || {}, - jsScope = context || {}, - varnumber = 999 - - if (typeof propValue == 'string') { - - propValue = balancedReplace('@', '{', '}', propValue, (content)=>{ - - if (content.indexOf('@{') >= 0) { - - content = balancedReplace('@', '{', '}', content, (subcontent)=>{ - return this.resolveProp(propName + '-nested', '@{' + subcontent + '}', storeLinks ? 'nested' : false, this) - }) - - } - - let id = content.split('.'), - k, subk - - if (id.length > 1) { - - k = id.pop() - subk = undefined - - if (id.length > 1) { - subk = k - k = id.pop() - } - - id = id.join('.') - - } else { - - id = id[0] - k = 'value' - - } - - var widgets = id == 'parent' && this.parent ? - [this.parent] : id == 'this' ? [this] : - widgetManager.getWidgetById(id, this.scopes) - - if (!widgets.length) { - var parent = this.parent - while (parent && parent != widgetManager) { - if (parent.getProp('id') == id) { - widgets.push(parent) - break - } - parent = parent.parent - } - } - - - // ignore clone wrapper in @parent stack (https://framagit.org/jean-emmanuel/open-stage-control/-/work_items/379) - if (widgets[0] === this.parent && this.parent !== widgetManager && this.parent.getProp('type') === 'clone') widgets = [this.parent.parent] - - if (storeLinks) { - - if (propName.indexOf('-nested') !== -1) propName = propName.replace('-nested', '') - - if (k == 'value') { - - if (!this.linkedPropsValue[id]) this.linkedPropsValue[id] = [] - if (this.linkedPropsValue[id].indexOf(propName) == -1) this.linkedPropsValue[id].push(propName) - - } else { - - if (!this.linkedProps[id]) this.linkedProps[id] = [] - if (this.linkedProps[id].indexOf(propName) == -1) this.linkedProps[id].push(propName) - - } - - if (storeLinks === 'nested') { - if (!this.nestedLinkedProps[id]) this.nestedLinkedProps[id] = [] - if (this.nestedLinkedProps[id].indexOf(propName) == -1) this.nestedLinkedProps[id].push(propName) - } - - } - - for (var i in widgets) { - - if (widgets[i] === widgetManager) continue - - if (widgets[i].props[k] !== undefined || k === 'value' || k === 'uuid') { - - if (k !== 'value' && originalPropName === k && widgets[i] === originalWidget) { - return 'ERR_CIRCULAR_REF' - } - - var r - switch (k) { - case 'value': - r = typeof widgets[i].value === 'object' ? widgets[i].value : widgets[i].getValue(true) - break - case 'uuid': - r = widgets[i].hash - break - case 'tabs': - case 'widgets': - r = widgets[i].props[k] - break - default: - r = widgets[i].resolveProp(k, undefined, storeLinks, originalWidget, originalPropName) - break - } - - if (subk !== undefined && r !== undefined) r = r[subk] - - var varname = 'VAR_' + varnumber - varnumber-- - - variables[varname] = r - jsScope[varname] = r - - return varname - - } - - } - - return 'undefined' - - }) - - propValue = balancedReplace('VAR', '{', '}', propValue, (args)=>{ - - if (args === '') return 'undefined' - - let [name, value] = args.split(',') - .map(x=>x.trim()) - .map(x=>x.replace(/VAR_[0-9]+/g, (m)=>{ - return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m]) - })) - - if (typeof value === 'string' && isJSON(value)) { - try { - value = JSON5.parse(value) - } catch (err) {} - } - - if ( - // remove quotes - (name[0] === '"' && name[name.length - 1] === '"') || - (name[0] === '\'' && name[name.length - 1] === '\'') - ) name = name.slice(1, name.length - 1) - - if (!this.variables[name]) { - - this.variables[name] = {default: value, value: value, propNames: [propName]} - - - } else if (!this.variables[name].propNames.includes(propName)) { - - this.variables[name].propNames.push(propName) - - } - - // update value if default changed - if ( - value !== undefined && - !this.variables[name].updated && // only true on edit - value !== this.variables[name].default - ) { - this.variables[name].default = value - this.variables[name].value = value - if (this.variables[name].propNames.length > 1) { - this.updateProps(this.variables[name].propNames.filter(x=>x!==propName)) - } - } - - var r = this.variables[name].value - - var varname = 'VAR_' + varnumber - varnumber-- - - variables[varname] = r - jsScope[varname] = r - - return varname - }) - - propValue = balancedReplace('IMPORT', '{', '}', propValue, (file)=>{ - - file = file.replace(/VAR_[0-9]+/g, (m)=>{ - return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m]) - }) - - if ( - // remove quotes - (file[0] === '"' && file[file.length - 1] === '"') || - (file[0] === '\'' && file[file.length - 1] === '\'') - ) file = file.slice(1, file.length - 1) - - if (storeLinks) { - if (!this.fragments[file]) this.fragments[file] = [] - if (!this.fragments[file].includes(propName)) this.fragments[file].push(propName) - } - var r - if (sessionManager.getFragment(file)) { - r = sessionManager.getFragment(file) - } else { - sessionManager.loadFragment(file, true) - r = '' - } - - var varname = 'VAR_' + varnumber - varnumber-- - - variables[varname] = r - jsScope[varname] = r - - return varname - }) - - propValue = balancedReplace('OSC', '{', '}', propValue, (args)=>{ - - if (args === '') return 'undefined' - - let [address, value, usePreArgs] = args.split(',') - .map(x=>x.trim()) - .map(x=>x.replace(/VAR_[0-9]+/g, (m)=>{ - return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m]) - })) - - if (!address) return 'undefined' - - if (!this.oscReceivers[args]) { - this.oscReceivers[args] = new OscReceiver({ - address: address, - value: value, - parent: this, - propName: propName, - usePreArgs: usePreArgs === 'false' ? false : true - }) - if (oscReceiverState[args]) { - this.oscReceivers[args].value = oscReceiverState[args] - delete oscReceiverState[args] - } - } else { - this.oscReceivers[args].setAddress(address) - this.oscReceivers[args].addProp(propName) - this.oscReceivers[args].usePreArgs = usePreArgs === 'false' ? false : true - } - - var r = this.oscReceivers[args].value - - var varname = 'VAR_' + varnumber - varnumber-- - - variables[varname] = r - jsScope[varname] = r - - return varname - }) - - try { - propValue = balancedReplace('JS', '{', '}', propValue, (code)=>{ - - if (code[0] === '{' && code[code.length - 1] === '}') code = code.slice(1, code.length - 1) - - if (!this.parsers[code]) this.parsers[code] = vm.compile(code, defaultScope) - - let r - vm.setWidget(this) - try { - r = this.parsers[code](jsScope, this.parsersLocalScope) - } catch (err) { - vm.setWidget() - throw err - } - vm.setWidget() - - if (r === undefined) r = '' - - return typeof r !== 'string' ? JSON.stringify(r) : r - - }) - } catch (err) { - this.errorProp(propName, 'JS{}', err) - } - - try { - propValue = balancedReplace('#', '{', '}', propValue, (code)=>{ - - if (!this.parsers[code]) this.parsers[code] = vm.compile('return ' + code.trim(), defaultScope) - - let r - vm.setWidget(this) - try { - r = this.parsers[code](jsScope, this.parsersLocalScope) - } catch (err) { - vm.setWidget() - throw err - } - vm.setWidget() - - if (r === undefined) r = '' - - return typeof r !== 'string' ? JSON.stringify(r) : r - - }) - } catch (err) { - - this.errorProp(propName, '#{}', err) - } - - for (let k in variables) { - var v = typeof variables[k] === 'string' ? variables[k] : JSON.stringify(variables[k]) - propValue = propValue.replace(new RegExp(k, 'g'), v) - } - - if ( - // json heuristic - isJSON(propValue) && - // allow "false" string in label - (propName !== 'label' || propValue === 'false') && - // don't coerce booleans and numbers as strings in objects - (!recursive || (isNaN(propValue) && propValue != 'true' && propValue != 'false')) - ) { - try { - propValue = JSON.parse(propValue) - } catch (err) {} - } - - } else if (propValue != null && typeof propValue == 'object') { - for (let k in propValue) { - propValue[k] = this.resolveProp(propName, propValue[k], storeLinks, originalWidget, originalPropName, context, true) - } - } - - - return this.transformProp(propName, propValue) - - - } - - transformProp(propName, propValue) { - - switch (propName) { - /* - scopable: prefix id with the closest (most restrictive) scope - */ - case 'id': - if (this.scopes.length) { - propValue = this.scopes[0] + propValue - } - break - } - - return propValue - - } - - getProp(propName) { - return this.cachedProps[propName] - } - - - isDynamicProp(propName) { - - return this.constructor.dynamicProps.indexOf(propName) !== -1 - - } - - updateProps(propNames, widget, options, updatedProps = []) { - - if (propNames.includes('value')) { - propNames.splice(propNames.indexOf('value'), 1) - propNames.push('value') - } - - if (widget && options) options.id = widget.getProp('id') - - var reCreate = false, - changedProps = [] - - for (var propName of propNames) { - - if (widget === this && updatedProps.includes(propName)) continue - - let propValue = this.resolveProp(propName, undefined, false), - oldPropValue = this.getProp(propName) - - if ( - !deepEqual(oldPropValue, propValue) || - (options && options.fromEditor && propName == 'value' && !this.areEquivalentValueProps(propValue, oldPropValue)) - ) { - if (!this.isDynamicProp(propName)) { - - if (this.constructor._defaults[propName] === undefined) { - - // ignore invalid properties - continue - - } else if (widget && this.contains(widget)) { - - this.errorProp(propName, '@{}', `a container can't use its child's properties to define non-dynamic properties.`) - continue - - } else if (widget === this && updatedProps.length === 1 && updatedProps[0] === 'value') { - - this.errorProp(propName, '@{}', `a widget can't use it's own value to define non-dynamic properties.`) - continue - - } else { - - reCreate = true - break - - } - - } else { - - changedProps.push({propName, propValue, oldPropValue}) - - } - - } - } - - if (reCreate) { - - return this.reCreateWidget({reCreateOptions: options}) - - } - - - if (changedProps.length) { - - for (var i in changedProps) { - this.cachedProps[changedProps[i].propName] = changedProps[i].propValue - this.onPropChanged(changedProps[i].propName, options, changedProps[i].oldPropValue) - } - - widgetManager.trigger('prop-changed', { - id: this.getProp('id'), - props: changedProps, - widget: this, - options: options - }) - - } - - if (options && options.fromEditor) { - - // update advanced syntax bindings if its an edition - if (this.checkLinkedProps(propNames)) { - - // emit prop-changed event if not already - // to make sure an advanced syntax changes don't go unnoticed by clone - var unNotified = propNames.filter(n => !changedProps.includes(n)) - widgetManager.trigger('prop-src-changed', { - id: this.getProp('id'), - props: unNotified, - widget: this, - options: options - }) - } - - } - - } - - onPropChanged(propName, options={}, oldPropValue) { - - switch(propName) { - - case 'value': - this.setValue(this.getProp('value'), {sync: true, send: options.send, id: options.id}) - return - - case 'top': - case 'left': - this.setContainerStyles(['geometry']) - return - - case 'height': - case 'width': - case 'expand': { - this.setContainerStyles(['geometry']) - let container = this.parent !== widgetManager && this.parent.getProp('layout') !== 'default' ? this.parent.container : this.container - resize.check(container) - if (widgetDragResize.mounted && widgetDragResize.widgets.includes(this)) widgetDragResize.updateRectangle() - return - } - - case 'visible': { - this.setVisibility() - let container = this.parent !== widgetManager && this.parent.getProp('layout') !== 'default' ? this.parent.container : this.container - resize.check(container) - widgetTree.updateVisibility(this) - return - } - - case 'interaction': - this.container.classList.toggle('no-interaction', !this.getProp('interaction')) - return - - case 'html': - this.updateHtml() - resize.check(this.container) - return - - case 'css': { - this.setContainerStyles(['css']) - var re = /width|height|display|margin|padding|flex/ - if (re.test(oldPropValue) || re.test(this.getProp('css'))) { - let container = this.parent !== widgetManager && this.parent.getProp('layout') !== 'default' ? this.parent.container : this.container - resize.check(container) - if (widgetDragResize.mounted && widgetDragResize.widgets.includes(this)) widgetDragResize.updateRectangle() - } - return - } - - case 'colorText': - case 'colorWidget': - case 'colorFill': - case 'colorStroke': - case 'alphaStroke': - case 'alphaFillOff': - case 'alphaFillOn': - case 'lineWidth': - case 'padding': - this.setCssVariables() - return - - case 'decimals': - this.decimals = Math.min(20, Math.max(this.getProp('decimals'), 0)) - return - - case 'address': - case 'preArgs': - case 'typeTags': - case 'target': - if (propName === 'address') { - for (var k in this.oscReceivers) { - var receiver = this.oscReceivers[k] - if (receiver.prefix !== '') { - receiver.setAddress() - } - } - } - var data = {}, - oldData = { - preArgs: propName == 'preArgs' ? oldPropValue : this.getProp('preArgs'), - address: propName == 'address' ? oldPropValue : this.getProp('address') - } - data[propName] = this.getProp(propName) - - if (data.address === 'auto') data.address = '/' + this.getProp('id') - if (oldData.address === 'auto') oldData.address = '/' + this.getProp('id') - - widgetManager.registerWidget(this, data, oldData) - return - - } - - } - - - log(message) { - - if (!uiConsole) return - - var widget = this, - id = widget.getProp('id') - - console._log(`${id}${name ? '.' + name : ''}: ${message}`) - uiConsole.log('log', `${id}: ${message}`, true) - - } - - errorProp(name, type, error) { - - let stackline = error.stack ? (error.stack.match(/>:([0-9]+):[0-9]+/) || '') : '', - line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - (type.includes('{}') ? 1 : 2)) : '', - id = this.getProp('id') || this.props.id, - widget = this // used for edit link in console - - while (widget.meta.not_editable && widget.parent !== widgetManager) { - // ignore non editable - widget = widget.parent - } - - // ignore clone wrapper - if (widget.parent !== widgetManager && widget.parent.getProp('type') === 'clone') widget = widget.parent - - console._error(`${id}${name ? '.' + name : ''} ${type} error${line}: ${error}`) - console.debug(error) - uiConsole.log('error', `${id}${name ? '.' + name : ''} ${type} error${line}: ${error}`, true) - } - - setContainerStyles(styles = ['geometry', 'css', 'visibility']) { - - if (styles.includes('geometry')) { - - // geometry - var absolutePos = false - for (let d of ['width', 'height', 'top', 'left']) { - let val = this.getProp(d), - geometry - - if (val !== undefined) { - if (parseFloat(val) < 0) val = 0 - geometry = parseFloat(val) == val ? parseFloat(val)+'rem' : val - } - - if (geometry) { - if (geometry === 'auto') geometry = '' - this.container.style[d] = geometry - if (d === 'width') this.container.style.minWidth = geometry - if (d === 'height') this.container.style.minHeight = geometry - absolutePos = absolutePos || geometry && (d === 'top' || d === 'left') - - } - } - this.container.classList.toggle('absolute-position', absolutePos) - this.container.classList.toggle('flex-expand', this.getProp('expand')) - this.container.classList.toggle('not-editable', !!this.meta.not_editable) - - - } - - if (styles.includes('css')) { - - // css - var css = String(this.getProp('css')), - extraCssClasses = [] - - // extra css "class" property - css = css.replace(/^[^\S\n]*class[^\S\n]*:[^\S\n]*([^;\n\s]+);?/igm, (m, c)=>{ - if (c === 'widget' || c.includes('-container')) return m - extraCssClasses.push(c.replace(/"'/g,'')) - return '' - }) - - - // escape windows absolute file paths - css = css.replace(/url\(([^)]*)\)/g, (m, url)=>{ - var parser = urlParser(url) - if (!parser.protocol.match(/http|data/)) m = m.replace(':', '_:_') - m = m.replace(/\\/g, '\\\\') - return m - }) - - - var prefix = '#' + this.hash, - scopedCss = '', - unScopedCss = '' - - if (css.includes('{')) { - - scopedCss = scopeCss(css, prefix) - - css - .replace(/\{[^}]*\}/g, '') - .replace(/^[^@#.]*:.*/gm, (m)=>{ - unScopedCss += m[m.length - 1] === ';' ? m : m + ';' - }) - - if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1') - if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix) - - } else { - - unScopedCss = css - - } - - - - - var style = (unScopedCss ? prefix + '{' + unScopedCss + '}\n' : '') + scopedCss - style = style.trim() - - if (this.style && this.container.contains(this.style)) { - if (style) this.style.innerText = style - else this.container.removeChild(this.style) - } else if (scopedCss.length || unScopedCss.length){ - this.style = html`` - this.container.insertBefore(this.style, this.container.childNodes[0] || null) - } - - - // apply extra css classes - if (!deepEqual(extraCssClasses, this.extraCssClasses)) { - if (this.extraCssClasses && this.extraCssClasses.length) { - this.container.classList.remove(...this.extraCssClasses) - this.extraCssClasses = [] - } - - if (extraCssClasses.length) { - this.container.classList.add(...extraCssClasses) - this.extraCssClasses = extraCssClasses - } - } - - - // store transform matrix if any - // if (css.includes('transform')) { - // setTimeout(()=>{ - // var style = window.getComputedStyle(this.container) - // this.cssTransform = style.transform || 'none' - // this.cssTransformOrigin = style.transformOrigin - // }) - // } else { - // this.cssTransform = 'none' - // } - - - } - - } - - setCssVariables() { - - - for (var data of this.constructor.cssVariables) { - - var val = this.getProp(data.js) - this.container.style.setProperty(data.css, val !== undefined && val !== 'auto' ? data.toCss ? data.toCss(val) : val : '') - - } - - } - - updateHtml(){ - - var extraHtml = this.getProp('html') || null - - if (this.extraHtml) { - if (!extraHtml) { - this.container.removeChild(this.extraHtml) - this.extraHtml = null - } else { - let newHtml = html`
          ` - newHtml.innerHTML = extraHtml - morph(this.extraHtml, newHtml) - } - - } else if (extraHtml) { - let newHtml = html`
          ` - newHtml.innerHTML = extraHtml - this.container.insertBefore(newHtml, this.widget) - this.extraHtml = newHtml - } - - } - - isVisible() { - - return this.getProp('visible') && this.parent.isVisible() - - } - - setVisibility() { - - var visible = this.isVisible() - - if (visible !== this.visible) { - this.visible = !!visible - this.container.style.display = this.visible ? '' : 'none' - - for (var c of this.children) { - if (c) c.setVisibility() - } - - } - - } - - reCreateWidget(options={}){ - - if (!this.removed) return updateWidget(this, options) - - } - - onRemove(){ - - for (var k in this.scripts) { - this.scripts[k].onRemove() - } - - this.removed = true - for (var name in this._listeners) { - if (name !== 'widget-removed') this.off(name) - } - - widgetManager.off(undefined, undefined, this) - sessionManager.off(undefined, undefined, this) - this.removeOscReceivers() - - } - -} - -Widget.parsersContexts = {} - -Widget.cssVariables = [ - {js: 'colorBg', css: '--color-background'}, - {js: 'colorWidget', css: '--color-widget'}, - {js: 'colorFill', css: '--color-fill'}, - {js: 'colorStroke', css: '--color-stroke'}, - {js: 'colorText', css: '--color-text'}, - {js: 'padding', css: '--widget-padding', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE}, - {js: 'lineWidth', css: '--line-width', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE}, - {js: 'borderRadius', css: '--border-radius', toCss: x=>parseFloat(x) == x ? x + 'rem' : x, toJs: x=>parseFloat(x)}, - {js: 'alphaFillOn', css: '--alpha-fill-on', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)}, - {js: 'alphaFillOff', css: '--alpha-fill-off', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)}, - {js: 'alphaStroke', css: '--alpha-stroke', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)}, -] - -Widget.dynamicProps = [ - 'visible', - 'interaction', - 'comments', - - 'top', - 'left', - 'height', - 'width', - 'expand', - - - 'colorText', - 'colorWidget', - 'colorFill', - 'colorStroke', - 'alphaStroke', - 'alphaFillOff', - 'alphaFillOn', - 'padding', - 'lineWidth', - 'html', - 'css', - - 'value', - - 'decimals', - 'address', - 'preArgs', - 'typeTags', - 'target', - 'bypass' -] - -export default Widget diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs deleted file mode 100644 index bf855b51..00000000 --- a/src/client/widgets/containers/clone.mjs +++ /dev/null @@ -1,342 +0,0 @@ -import html from 'nanohtml' -import Container from '../common/container.mjs' -import widgetManager from '../../managers/widgets.mjs' -import * as resize from '../../events/resize.mjs' -import parser from '../../parser.mjs' -import {deepCopy, deepEqual} from '../../utils.mjs' -import {diff, diffToWidget} from '../../editor/diff' -import Session from '../../managers/session/session.mjs' - -var excludedCloneClasses = ['widget', 'absolute-position', 'not-editable', 'editing', 'flex-expand', 'no-interaction'] - -class Clone extends Container() { - - static description() { - - return 'Widget replication with overridable properties.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - - class_specific: { - widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'}, - scoped: {type: 'boolean|string', value: false, help: [ - 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', - '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', - 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' - ]}, - props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Cloned widget\'s properties to override'}, - }, - value: null, - osc: null, - scripting: null - }) - - defaults.style = {css: defaults.style.css} - - return defaults - - } - - constructor(options) { - - options.props.address = 'auto' - options.props.variables = '@{parent.variables}' - - super({...options, html: html`
          `}) - - this.noValueState = true - - this.cloneLock = false - this.cloneTarget = null - this.targetRank = null - this.cloneClass = [] - - this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') - - this.modalBreakout = 0 - - this.container.classList.add('empty') - - var parent = this.parent - while (parent !== widgetManager) { - if (parent.getProp('id') === this.getProp('widgetId')) { - this.errorProp('widgetId', 'circular reference', 'cannot create clone: target widget is a parent of this clone.') - return - } - parent = parent.parent - } - - this.getCloneTarget() - - widgetManager.on('widget-created', (e)=>{ - - // if in a non-scoped context we don't watch for a closer target once we have one - if (!this.scopes.length && this.cloneTarget) return - - var {id, widget} = e - - if (String(id).includes(this.getProp('widgetId')) && this.isValidCloneTarget(widget)) { - - this.getCloneTarget() - - } - - }, {context: this}) - - var onPropChanged = (e)=>{ - // watch for prop changes initiated by the editor - // Other changes (from advanced syntaxes) are already - // handled by standard widget mechanicsé - - if (!this.cloneTarget) return - if (!e.options || !e.options.fromEditor) return - - if (e.widget === this.cloneTarget || this.cloneTarget.contains(e.widget)) { - - this.updateClone(e.options) - - } - - } - - widgetManager.on('prop-changed', onPropChanged, {context: this}) - - // see common/widget.js @ updateProps() - widgetManager.on('prop-src-changed', onPropChanged, {context: this}) - - } - - getCloneTarget() { - - // attempt to acquire a cloneTarget if 'widget-created' event has not been caught - // (the target might have been created before the clone itself) - - var scopes = this.scopes.length ? this.scopes : [''], - target = null, - rank = 0 - - for (var scope of scopes) { - var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) - .filter(w=>this.isValidCloneTarget(w)) - target = widgets[0] - - if (!target) { - rank++ - continue - } - - for (var w of widgets) { - // when duplicating clones pointing to an object with a static id, - // each clone will recreate an object with the same id internally - // we try to get the original one if there is more than 2 clone pointing to the same id (avoiding cloning the clone) - if (!(w.parent && w.parent.getProp('type') == 'clone')) { - target = w - break - } - } - - if (rank < this.targetRank || this.targetRank == null) { - - var clone = this.children[0] - - this.unbindTarget() - - if (!clone) { - - this.updateContainer(false) - this.bindTarget(target, rank) - this.createClone() - - } else { - - this.bindTarget(target, rank) - this.updateClone() - - } - } - - return - - } - - } - - isValidCloneTarget(widget) { - - return !(widget.contains(this) || this.contains(widget)) - - } - - createClone(init) { - - if (this.cloneLock) return - - this.cloneLock = true - - var data = {...deepCopy(this.cloneTarget.props), ...this.getProp('props')} - - Session.converters['1.13.2'].widget(data) - - parser.parse({ - data: data, - parentNode: this.widget, - parent: this, - meta: { - not_editable: true, - clone: true, - scopable: true - } - }) - - this.updateContainer(!init) - - this.cloneLock = false - - } - - unbindTarget() { - - if (!this.cloneTarget) return - - this.cloneTarget.off(undefined, undefined, this) - - this.cloneTarget = null - this.targetRank = null - - } - - bindTarget(target, rank) { - - if (!target) return - - this.cloneTarget = target - this.targetRank = rank - - // listen for cloneTarget's deletion - // if it is just edited, its recreation will be caught by the global 'widget-created' event handler - this.cloneTarget.on('widget-removed', (e)=>{ - if (this.cloneTarget === e.widget) { - this.unbindTarget() - } - }, {context: this}) - - // listen for cloneTarget's content updates - this.cloneTarget.on('widget-created', (e)=>{ - - var {widget} = e - - // if updated widget is in a nested clone, ignore it: - // it will be handled by the nested clone that targets it - if (!widget.meta.clone) { - this.updateClone() - } - - }, {context: this}) - - } - - updateClone(options) { - - if (this.cloneLock) return - - this.cloneLock = true - - var data = {...deepCopy(this.cloneTarget.props), ...this.getProp('props')}, - clone = this.children[0] - - Session.converters['1.13.2'].widget(data) - - var delta = diff.diff(clone.props, data) || {}, - [widget, patch] = diffToWidget(clone, delta), - changedProps = Object.keys(patch) - - if (changedProps.length) { - - diff.patch(widget.props, patch) - - - if (changedProps.some(x => !widget.isDynamicProp(x))) { - - clone.reCreateWidget({reuseChildren: false}) - this.updateContainer(false) - - } else { - - widget.updateProps(changedProps, this, options) - this.updateContainer(true) - - } - - } - - - - this.cloneLock = false - - } - - updateContainer(checkResize) { - - - if (this.cloneTarget) { - - var classes = [...this.cloneTarget.container.classList].filter(i=>excludedCloneClasses.indexOf(i) === -1) - - if (!deepEqual(classes, this.cloneClass)) { - this.container.classList.remove(...this.cloneClass) - this.cloneClass = classes - this.container.classList.add(...this.cloneClass) - } - - this.container.classList.remove('empty') - - if (checkResize) resize.check(this.widget) - - } else if (this.cloneClass.length) { - - this.container.classList.remove(...this.cloneClass) - this.container.classList.add('empty') - this.cloneClass = [] - this.widget.innerHTML = '' - widgetManager.removeWidgets(this.getAllChildren()) - - } - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'widgetId': - this.getCloneTarget() - return - case 'props': - if (this.children[0]) this.updateClone() - return - - } - - } - - onRemove(){ - - this.unbindTarget() - super.onRemove() - - } - -} - -Clone.dynamicProps = Clone.prototype.constructor.dynamicProps.concat( - 'widgetId', - 'props' -) - -export default Clone diff --git a/src/client/widgets/containers/folder.mjs b/src/client/widgets/containers/folder.mjs deleted file mode 100644 index 6f8f3722..00000000 --- a/src/client/widgets/containers/folder.mjs +++ /dev/null @@ -1,60 +0,0 @@ -import Panel from './panel.mjs' - -class Folder extends Panel { - - static description() { - - return 'Flat container that doesn\'t affect layout. Mostly useful for grouping widgets in the tree.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - class_specific: { - traversing: null - }, - style: { - - }, - geometry: null, - osc: null, - scripting: null, - value: null, - children: { - widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'}, - } - }) - - defaults.style = { - colorText: defaults.style.colorText, - colorWidget: defaults.style.colorWidget, - css: defaults.style.css, - } - - return defaults - - } - - constructor(options) { - - super(options) - - } - - getProp(propName) { - - if (propName === 'layout') { - return this.parent.getProp('layout') - } else { - return super.getProp(propName) - } - - } - - -} - - - -export default Folder diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs deleted file mode 100644 index 0979425f..00000000 --- a/src/client/widgets/containers/fragment.mjs +++ /dev/null @@ -1,223 +0,0 @@ -import html from 'nanohtml' -import Container from '../common/container.mjs' -import widgetManager from '../../managers/widgets.mjs' -import * as resize from '../../events/resize.mjs' -import parser from '../../parser.mjs' -import {deepCopy, deepEqual} from '../../utils.mjs' -import {diff, diffToWidget} from '../../editor/diff' -import Session from '../../managers/session/session.mjs' - -var sessionManager -;(async()=>{ - sessionManager = (await import('../../managers/session/index.mjs')).default -})() - -var excludedfragmentClasses = ['widget', 'absolute-position', 'not-editable', 'editing', 'flex-expand', 'no-interaction'] - -class Fragment extends Container() { - - static description() { - - return 'Embedded session or fragment file with overridable properties.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - - class_specific: { - file: {type: 'string', value: '', help: 'Fragment file path (relative to the session or theme file location by default, falling back to absolute path)'}, - fallback: {type: 'string', value: '', help: 'Fallack fragment file path, loaded if `file` can\'t be opened'}, - scoped: {type: 'boolean|string', value: false, help: [ - 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', - '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', - 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' - ]}, - props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Fragment widget\'s properties to override'}, - }, - value: null, - osc: null, - scripting: null - }) - - defaults.style = {css: defaults.style.css} - - return defaults - - } - - constructor(options) { - - options.props.address = 'auto' - options.props.variables = '@{parent.variables}' - - super({...options, html: html`
          `}) - - this.noValueState = true - - this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') - - this.modalBreakout = 0 - - this.fragmentClass = [] - this.container.classList.add('empty') - - sessionManager.on('fragment-updated', (e)=>{ - var {path} = e - if (path === this.getProp('file') || path === this.getProp('fallback')) { - this.createFragment() - } - }, {context: this}) - - sessionManager.on('fragment-not-found', (e)=>{ - var {path} = e - if (path === this.getProp('file')) { - if (this.getProp('fallback')) { - if (this.getFragment()) this.createFragment() - else sessionManager.loadFragment(this.getProp('fallback')) - } else { - this.log('fragment file not found') - } - } else if (path === this.getProp('fallback') && !this.getFragment()) { - this.log('fallback fragment file not found') - } - }, {context: this}) - - if (this.getProp('file')) { - if (sessionManager.getFragment(this.getProp('file'))) { - this.createFragment(true) - } else { - sessionManager.loadFragment(this.getProp('file')) - } - } - - - } - - getFragment() { - - var fragment = sessionManager.getFragment(this.getProp('file')) - - if (!fragment && this.getProp('fallback')) { - fragment = sessionManager.getFragment(this.getProp('fallback')) - } - - return fragment - - } - - createFragment(init) { - - var fragment = this.getFragment() - - if (!fragment) return - - - var data = {...deepCopy(fragment.getRoot()), ...this.getProp('props')} - - Session.converters['1.13.2'].widget(data) - - parser.parse({ - data: data, - parentNode: this.widget, - parent: this, - meta: { - not_editable: true, - fragment: true, - scopable: true - } - }) - - this.updateContainer(!init) - - } - - - updateContainer(checkResize) { - - - if (this.children[0]) { - - var classes = [...this.children[0].container.classList].filter(i=>excludedfragmentClasses.indexOf(i) === -1) - - if (!deepEqual(classes, this.fragmentClass)) { - this.container.classList.remove(...this.fragmentClass) - this.fragmentClass = classes - this.container.classList.add(...this.fragmentClass) - } - - this.container.classList.remove('empty') - - if (checkResize) resize.check(this.widget) - - } else if (this.fragmentClass.length) { - - this.container.classList.remove(...this.fragmentClass) - this.container.classList.add('empty') - this.fragmentClass = [] - this.widget.innerHTML = '' - widgetManager.removeWidgets(this.getAllChildren()) - - } - - } - - updateFragment() { - - - var fragment = this.getFragment() - - if (!fragment) return - - var data = {...deepCopy(fragment.getRoot()), ...this.getProp('props')}, - fragmentWidget = this.children[0] - - Session.converters['1.13.2'].widget(data) - - var delta = diff.diff(fragmentWidget.props, data) || {}, - [widget, patch] = diffToWidget(fragmentWidget, delta), - changedProps = Object.keys(patch) - - if (changedProps.length) { - - diff.patch(widget.props, patch) - - - if (changedProps.some(x => !widget.isDynamicProp(x))) { - - fragmentWidget.reCreateWidget({reuseChildren: false}) - this.updateContainer(false) - - } else { - - widget.updateProps(changedProps, this) - this.updateContainer(true) - - } - - } - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'props': - if (this.children[0]) this.updateFragment() - return - - } - - } - -} - -Fragment.dynamicProps = Fragment.prototype.constructor.dynamicProps.concat( - 'props' -) - -export default Fragment diff --git a/src/client/widgets/containers/keyboard.mjs b/src/client/widgets/containers/keyboard.mjs deleted file mode 100644 index cdbfd8bc..00000000 --- a/src/client/widgets/containers/keyboard.mjs +++ /dev/null @@ -1,195 +0,0 @@ -import Panel from './panel.mjs' -import Widget from '../common/widget.mjs' -import parser from '../../parser.mjs' -import {mapToScale} from '../utils.mjs' - - -class Keyboard extends Panel { - - static description() { - - return 'Piano keyboard.' - - } - - static defaults() { - - return Widget.defaults().extend({ - style: { - _separator_keyboard_style: 'Keyboard style', - colorWhite: {type: 'string', value: 'auto', help: 'White keys color.'}, - colorBlack: {type: 'string', value: 'auto', help: 'Black keys color.'}, - }, - class_specific: { - keys: {type: 'number', value: 25, help: 'Defines the number keys'}, - start: {type: 'number', value: 48, help: [ - 'MIDI note number to start with (default is C4)', - 'Standard keyboards settings are: `[25, 48]`, `[49, 36]`, `[61, 36]`, `[88, 21]`' - ]}, - traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'}, - on: {type: '*', value: 1, help: [ - 'Set to `null` to send send no argument in the osc message', - ]}, - off: {type: '*', value: 0, help: [ - 'Set to `null` to send send no argument in the osc message', - ]}, - velocity: {type: 'boolean', value: false, help: [ - 'Set to `true` to map the touch coordinates between `off` (top) and `on` (bottom). Requires `on` and `off` to be numbers', - ]}, - mode: {type: 'string', value: 'push', choices: ['push', 'toggle', 'tap'], help: [ - 'Interaction mode:', - '- `push` (press & release)', - '- `toggle` (on/off switches)', - '- `tap` (no release)' - ]}, - }, - value: { - value: {type: 'array', value: '', help: [ - 'The keyboard widget accepts the following values:', - '- a `[note, value]` array to set the value of a single key where `note` is the note number and `value` depends on the `on` and `off` properties (any value different from `off` will be interpreted as `on`).', - '- an array of values with one item per key in the keyboard' - ]} - }, - }) - - } - - constructor(options) { - - super(options) - - this.childrenType = undefined - this.value = [] - this.keyHeight = 100 - - this.on('resize', (e)=>{ - this.keyHeight = e.height - }, {element: this.widget}) - - - this.on('value-changed',(e)=>{ - - var widget = e.widget - - if (widget === this) return - - - var value - if (widget.getValue()) { - if (this.getProp('velocity')) { - var height = widget._black ? this.keyHeight * 0.65 : this.keyHeight - value = mapToScale(e.options.y, [0, height * 0.9], [this.getProp('off'), this.getProp('on')], this.decimals) - } else { - value = this.getProp('on') - } - } else { - value = this.getProp('off') - } - - this.value[widget._index] = value - - if (e.options.send) { - var start = parseInt(this.getProp('start')) - this.sendValue({ - v: [e.widget._index + start, value] - }) - } - - this.changed({ - ...e.options, - id: widget.getProp('id') - }) - - - }) - - var start = parseInt(this.getProp('start')), - keys = parseInt(this.getProp('keys')) - - var pattern = 'wbwbwwbwbwbw', - whiteKeys = 0, whiteKeys2 = 0, i - - for (i = start; i < keys + start && i < 128; i++) { - if (pattern[i % 12] == 'w') whiteKeys++ - } - - this.container.style.setProperty('--nkeys', whiteKeys) - - for (i = start; i < keys + start && i < 128; i++) { - - var data = { - top: 'auto', - left: 'auto', - height: 'auto', - width: 'auto', - type: 'button', - mode: this.getProp('mode'), - id: this.getProp('id') + '/' + i, - label: false, - css: '', - bypass: true, - on: 1, - off: 0, - } - - var key = parser.parse({ - data: data, - parentNode: this.widget, - parent: this, - meta: {not_editable: true} - }) - - key._index = i - start - key.container.classList.add('key') - - if (pattern[i % 12] == 'w') { - key.container.classList.add('white') - whiteKeys2++ - } else { - key.container.classList.add('black') - key.container.style.setProperty('--rank', whiteKeys2) - key._black = true - } - - this.value[i - start] = this.getProp('off') - - } - - } - - setValue(v, options={}) { - - if (!Array.isArray(v)) return - - if (v.length === this.children.length) { - for (var i = 0; i < this.children.length; i++){ - this.children[i].setValue(v[i] !== this.getProp('off') ? 1 : 0, options) - } - } - - else if ( - v.length === 2 && - v[0] >= parseInt(this.getProp('start')) && v[0] < 128 - ) { - var index = v[0] - parseInt(this.getProp('start')) - if (this.children[index]) { - this.children[index].setValue(v[1] !== this.getProp('off') ? 1 : 0, options) - } - } - - } - -} - - -Keyboard.dynamicProps = Keyboard.prototype.constructor.dynamicProps.concat( - 'on', - 'off', -) - -Keyboard.cssVariables = Keyboard.prototype.constructor.cssVariables.concat( - {js: 'colorWhite', css: '--color-white-key'}, - {js: 'colorBlack', css: '--color-black-key'} -) - -export default Keyboard diff --git a/src/client/widgets/containers/matrix.mjs b/src/client/widgets/containers/matrix.mjs deleted file mode 100644 index 32cb4c24..00000000 --- a/src/client/widgets/containers/matrix.mjs +++ /dev/null @@ -1,276 +0,0 @@ -import Panel from './panel.mjs' -import parser from '../../parser.mjs' -import {deepCopy} from '../../utils.mjs' -import Session from '../../managers/session/session.mjs' -import widgetManager from '../../managers/widgets.mjs' - - -class Matrix extends Panel { - - static description() { - - return 'Generic matrix for creating rows/columns of widgets.' - - } - - static defaults() { - - return super.defaults().extend({ - class_specific: { - widgetType: {type: 'string', value: 'button', help: 'Defines the type of the widgets in the matrix'}, - quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'}, - props: {type: 'object', value: {label: '#{$}'}, editor: 'javascript', syntaxChecker: false, help: [ - 'Defines a set of property to override the widgets\' defaults.', - 'JS{} and #{} blocks in this field are resolved with an extra variable representing each widget\'s index: `$` (e.g. `#{$}`)', - 'Advanced syntax blocks (@{}, OSC{}, JS{}, VAR{} and #{}) are resolved at the matrix\' scope (ie @{this.variables} returns the matrix\' variables property)', - 'Advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket.', - 'Note: unless overridden, children inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)' - ]}, - }, - style: { - layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help: 'Defines how children are laid out.'}, - tabsPosition: null, - } - }) - - } - - constructor(options) { - - super(options) - - this.childrenType = undefined - - this.value = [] - - this.resolveLock = false - - this.on('value-changed',(e)=>{ - - if (e.widget === this) return - - var widget = this.getProp('widgetType') === 'clone' ? e.widget.parent : e.widget - - if (widget.parent !== this) return - - this.value[widget._index] = e.widget.getValue() - - this.changed({ - ...e.options, - id: widget.getProp('id') - }) - - }) - - if (parser.widgets[this.getProp('widgetType')]) { - - var quantity = Math.max(parseInt(this.getProp('quantity')) || 0, 0) - - for (let i = 0; i < quantity; i++) { - - var props = deepCopy(this.getProp('props')[i]) - var data = this.defaultProps(i) - - if (typeof props === 'object' && props !== null) { - Object.assign(data, props) - } - - data = JSON.parse(JSON.stringify(data).replace(/(JS|#|OSC|@|VAR)_\{/g, '$1{')) - - Session.converters['1.13.2'].widget(data) - - var widget = parser.parse({ - data: data, - parentNode: this.widget, - parent: this, - meta: {not_editable: true} - }) - - widget._index = i - - this.value[i] = widget.getValue() - - } - - } else { - - this.errors.widgetType = this.getProp('widgetType') + ' is not a valid widget type' - - } - - - - } - - defaultProps(i) { - - return { - type: this.getProp('widgetType'), - id: '@{parent.id}/' + i, - address: '#{@{parent.address} == "auto" ? "/" + @{parent.id} : @{parent.address}}/' + i, - preArgs: '@{parent.preArgs}', - target: '@{parent.target}', - decimals: '@{parent.decimals}', - bypass: '@{parent.bypass}', - top: 'auto', - left: 'auto', - height: 'auto', - width: 'auto' - } - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'quantity': - - var quantity = Math.max(parseInt(this.getProp('quantity')) || 0, 0) - oldPropValue = Math.max(parseInt(oldPropValue) || 0, 0) - - if (oldPropValue > quantity) { - - for (let i = oldPropValue - 1; i >= quantity; i--) { - if (this.widget.contains(this.children[i].container)) { - this.widget.removeChild(this.children[i].container) - } - widgetManager.removeWidgets(this.children[i].getAllChildren().concat(this.children[i])) - } - - } else { - - this.cachedProps.props = this.resolveProp('props', undefined, true) - - for (let i = oldPropValue; i < quantity; i++) { - - var props = deepCopy(this.getProp('props')[i]) - var data = this.defaultProps(i) - - if (typeof props === 'object' && props !== null) { - Object.assign(data, props) - } - - data = JSON.parse(JSON.stringify(data).replace(/(JS|#|OSC|@|VAR)_\{/g, '$1{')) - - Session.converters['1.13.2'].widget(data) - - var widget = parser.parse({ - data: data, - parentNode: this.widget, - parent: this, - meta: {not_editable: true} - }) - - widget._index = i - - } - - } - - - return - - case 'props': - - for (let i = this.children.length - 1; i >= 0; i--) { - - let data = deepCopy(this.getProp('props')[i]) - - if (typeof data !== 'object' || data === null || Array.isArray(data)) { - data = {} - } - - data = JSON.parse(JSON.stringify(data).replace(/(JS|#|OSC|@|VAR)_\{/g, '$1{')) - - Session.converters['1.13.2'].widget(data) - - if (typeof oldPropValue[i] === 'object' && oldPropValue[i] !== null) { - // if an overridden default props is removed, set it back to default - let overriddenDefaults, - widgetDefaults - for (var k in oldPropValue[i]) { - if (data[k] === undefined) { - if (Matrix.overriddenDefaults.indexOf(k) !== -1) { - overriddenDefaults = overriddenDefaults || this.defaultProps(i) - data[k] = overriddenDefaults[k] - } else { - widgetDefaults = widgetDefaults || parser.defaults[data.type || this.getProp('widgetType')] - data[k] = deepCopy(widgetDefaults[k]) - } - } - } - } - - Object.assign(this.children[i].props, data) - - this.children[i].updateProps(Object.keys(data), this, options) - - } - - return - - } - - } - - resolveProp(propName, propValue, storeLinks, originalWidget, originalPropName, context) { - - if (propName === 'props' && !this.resolveLock) { - - this.resolveLock = true - - propValue = propValue !== undefined ? propValue : this.props[propName] - - var data = [], - quantity = Math.max(parseInt(this.resolveProp('quantity', undefined, false, false, false)) || 0, 0) - - if (typeof propValue === 'object' && propValue !== null && !Array.isArray(propValue)) { - for (let i = 0; i < quantity; i++) { - data[i] = {} - for (var k in propValue) { - data[i][k] = super.resolveProp(propName, deepCopy(propValue[k]), i === 0 ? storeLinks : false, originalWidget, originalPropName, {$: i}) - } - } - - } else { - - for (let i = 0; i < quantity; i++) { - data[i] = super.resolveProp(propName, deepCopy(propValue), i === 0 ? storeLinks : false, originalWidget, originalPropName, {$: i}) - } - - } - - - this.resolveLock = false - - return data - - } else { - - return super.resolveProp(propName, propValue, storeLinks, originalWidget, originalPropName, context) - - } - - } -} - - - -Matrix.overriddenDefaults = [ - 'type', 'id', 'address', 'preArgs', 'target', 'decimals', 'bypass', - 'label', 'top', 'left', 'height', 'width' -] - -Matrix.parsersContexts.props = { - $: 0 -} - -Matrix.dynamicProps = Matrix.prototype.constructor.dynamicProps.concat( - 'quantity', - 'props' -) - -export default Matrix diff --git a/src/client/widgets/containers/modal.mjs b/src/client/widgets/containers/modal.mjs deleted file mode 100644 index 1b810164..00000000 --- a/src/client/widgets/containers/modal.mjs +++ /dev/null @@ -1,297 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import Panel from './panel.mjs' -import {icon, iconify} from '../../ui/utils.mjs' -import * as resize from '../../events/resize.mjs' -import doubleTap from '../mixins/double_tap' -import {DOM, PXSCALE} from '../../globals.mjs' - -class Modal extends Panel { - - static description() { - - return 'A toggle button that opens a popup panel. Cannot contain tabs directly.' - - } - - static defaults() { - - return super.defaults().extend({ - class_specific: { - doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap (allows scrolling when touching the modal button)'}, - click: {type: 'boolean', value: false, help: 'Set to `true` to make the modal open/close upon click event instead of tap (allows scrolling when touching the modal button)'}, - }, - geometry: { - _separator_modal_geometry: 'Modal geometry', - popupWidth: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'}, - popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'}, - popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, - popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, - relative: {type: 'boolean', value: false, help: 'Set to `true` to make the modal\'s position relative to the button\'s position.'}, - ignoreTabs: {type: 'boolean', value: false, help: 'Set to `true` to allow the modal overflowing its tab ancestors.'}, - }, - style: { - _separator_modal_style: 'Modal style', - label: {type: 'string|boolean', value: 'auto', help: [ - 'Set to `false` to hide completely', - '- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)', - '- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal`', - ]}, - popupLabel: {type: 'string|boolean', value: 'auto', help: 'Alternative label for the modal popup'}, - popupPadding: {type: 'number', value: 'auto', help: 'Modal\'s inner spacing.'}, - tabsPosition: null, - html: null - }, - children: { - tab: null - }, - value: { - value: {type: 'integer', value: '', help: [ - 'Defines the modal\'s state:`0` for closed, `1` for opened' - ]}, - } - }) - - } - - constructor(options) { - - super(options) - - this.popup = html` - - ` - - this.container.appendChild(this.popup) - this.popupContent = DOM.get(this.popup, '.popup-content')[0] - - - // convert dimensions / coordinates to rem - var geometry = {} - for (var g of ['Width', 'Height', 'Left', 'Top']) { - geometry[g] = parseFloat(this.getProp('popup' + g)) == this.getProp('popup' + g) ? parseFloat(this.getProp('popup' + g)) + 'rem' : this.getProp('popup' + g) - } - - this.popup.style.setProperty('--width', geometry.Width) - this.popup.style.setProperty('--height', geometry.Height) - - if (geometry.Left !== 'auto') { - this.popup.style.setProperty('--left', geometry.Left) - this.popup.classList.add('x-positionned') - } - - if (geometry.Top !== 'auto') { - this.popup.style.setProperty('--top', geometry.Top) - this.popup.classList.add('y-positionned') - } - - this.toggle = this.container.appendChild(html`
          `) - - var closer = DOM.get(this.popup, '.closer')[0] - - this.on(this.getProp('click') ? 'click' : 'draginit',(e)=>{ - if ((e.target === this.popup || e.target === closer) && this.value == 1) { - this.setValue(0, {sync:true, send:true}) - } else if (!this.getProp('doubleTap') && e.target === this.toggle) { - if (e.capturedByEditor === true) return - this.setValue(1, {sync:true, send:true}) - } - }, {element: this.container}) - - if (this.getProp('doubleTap')) { - doubleTap(this, ()=>{ - this.setValue(1, {sync:true, send:true}) - }, {element: this.toggle, click: this.getProp('click')}) - } - - this.escapeKeyHandler = ((e)=>{ - if (e.key == 'Escape') this.setValue(0, {sync:true, send:true}) - }).bind(this) - - this.value = 0 - this.init = false - this.labelChange = true - - this.container.classList.toggle('relative', this.getProp('relative')) - this.popupContent.classList.add('layout-' + this.getProp('layout')) - - this.label = html`` - this.updateLabel() - - this.childrenType = 'widget' - - } - - setValue(v, options={}) { - - if (this.init === undefined) return - - var val = v ? 1 : 0 - - if (val === this.value) return - - this.value = val - - if (!this.init && this.value) { - this.popupContent.appendChild(this.widget) - this.init = true - } - - if (this.value && this.labelChange) { - this.updatePopupLabel() - } - - if (this.getProp('scroll') && this.value) this.scrollLock = true - - this.popup.classList.toggle('show', this.value) - this.container.classList.toggle('on', this.value) - - this.bindEscKey(this.value) - - if (this.init) this.fixParents() - - this.setVisibility() - if (this.value) { - resize.check(this.widget, true) - - if (this.getProp('scroll')) { - setTimeout(()=>{ - this.scrollWidth = this.widget.scrollWidth - this.widget.clientWidth - this.scrollHeight = this.widget.scrollHeight - this.widget.clientHeight - this.setScroll(this.scroll[0], this.scroll[1], true) - }) - } - } - - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - - } - - fixParents() { - - var parent = this.parent, - scrollX = 0, - scrollY = 0, - stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/ - - while (parent && parent.props && !String(parent.getProp('type')).match(stop)) { - - parent.modalBreakout += (this.value ? 1 : -1) - if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout') - else if (parent.modalBreakout === 0) parent.container.classList.remove('modal-breakout') - else parent.modalBreakout = 0 - - scrollX += parent.widget.scrollLeft - scrollY += parent.widget.scrollTop - - parent = parent.parent - } - - scrollX += parent.widget.scrollLeft - scrollY += parent.widget.scrollTop - - if (this.getProp('relative')) { - this.container.style.setProperty('--parent-scroll-x', scrollX + 'px') - this.container.style.setProperty('--parent-scroll-y', scrollY + 'px') - } - - this.modalBreakout += (this.value ? 1 : -1) - if (this.modalBreakout > 0) this.container.classList.add('modal-breakout') - else if (this.modalBreakout === 0) this.container.classList.remove('modal-breakout') - else this.modalBreakout = 0 - - - } - - bindEscKey(set) { - - if (set) { - document.addEventListener('keydown', this.escapeKeyHandler) - } else { - document.removeEventListener('keydown', this.escapeKeyHandler) - } - - } - - onRemove() { - this.bindEscKey(false) - this.setValue(0) - super.onRemove() - } - - updateLabel() { - - if (!this.label) return - - if (this.getProp('label') === false) { - - if (this.container.contains(this.label)) this.container.removeChild(this.label) - - } else { - this.label.innerHTML = this.getProp('label') == 'auto'? - this.getProp('id'): - iconify(String(this.getProp('label')).replace(/parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE}, -) - -Modal.dynamicProps = Modal.prototype.constructor.dynamicProps.concat( - 'label', - 'popupLabel', - 'popupPadding' -) - -export default Modal diff --git a/src/client/widgets/containers/panel.mjs b/src/client/widgets/containers/panel.mjs deleted file mode 100644 index 7ab1aa4c..00000000 --- a/src/client/widgets/containers/panel.mjs +++ /dev/null @@ -1,404 +0,0 @@ -import html from 'nanohtml' -import fastdom from 'fastdom' -import Container from '../common/container.mjs' -import widgetManager from '../../managers/widgets.mjs' -import parser from '../../parser.mjs' -import {enableTraversingGestures, disableTraversingGestures} from '../../events/drag.mjs' -import {setScrollbarColor} from '../../ui/utils.mjs' -import Script from '../scripts/script.mjs' -import {DOM} from '../../globals.mjs' - -class Panel extends Container() { - - static description() { - - return 'Widgets or Tabs container.' - - } - - static defaults() { - - return super.defaults().extend({ - class_specific: { - variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, - traversing: {type: 'boolean', value: false, choices: [false, true, 'smart'], help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget'}, - }, - style: { - _separator_panel_style: 'Panel style', - colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'}, - layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'}, - justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'}, - gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns or a valid value for the css property "grid-template".'}, - contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'}, - scroll: {type: 'boolean|string', value: true, choices: [true, false, 'hidden', 'manual'], help: [ - '- `true`: scrollbars are show and content is scrollble', - '- `false`: scrollbars are hidden and content is not scrollble', - '- `"hidden"`: scrollbars are hidden (using css, may not work on old browsers) and content is scrollble', - '- `"manual"`: scrollbars are hidden (using css, may not work on old browsers) and content is scrollble only using scripting or scrollbar widgets', - ]}, - innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'}, - tabsPosition: {type: 'string', value: 'top', choices: ['top', 'bottom', 'left', 'right', 'hidden'], help: 'Defines the position of the navigation bar if the panel contains tabs'}, - }, - value: { - value: {type: 'integer|array', value: '', help: [ - 'If the panel contains tabs, its value defines which tab is selected selected (by index, starting with 0).', - 'If the panel contains widgets and `scroll` is `true`, its value is an array that contains the scrolling state between 0 and 1 for the x and y axis. ' - ]} - }, - children: { - widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'}, - tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously'}, - }, - scripting: { - onTouch: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the panel is touched and released, and when the pointer moves when the widget is touched. See documentation.',]}, - } - }) - - } - - constructor(options) { - - - super({...options, html: html``}) - - this.childrenType = '' - - if (options.root && this.getProp('onPreload')) { - this.scripts.onPreload = new Script({ - widget: this, - property: 'onPreload', - code: this.getProp('onPreload'), - context: {} - }) - if (this.scripts.onPreload) this.scripts.onPreload.run({}, {}) - } - - this.container.classList.toggle('no-inner-padding', !this.getProp('innerPadding')) - this.container.classList.toggle('no-scroll', !this.getProp('scroll') || this.getProp('scroll') == 'manual') - this.container.classList.toggle('hidden-scroll', this.getProp('scroll') == 'hidden') - this.container.classList.add('layout-' + this.getProp('layout')) - this.container.classList.toggle('layout-contain', this.getProp('contain')) - - this.modalBreakout = 0 - - var layout = this.getProp('layout') - if (layout === 'grid') { - - var template = this.getProp('gridTemplate') || 2 - this.widget.style.gridTemplate = template === parseInt(template) ? `none / repeat(${template}, 1fr)` : template - - } else if (layout === 'vertical' || layout === 'horizontal'){ - - var justify = this.getProp('justify') - if (justify === 'start' || justify === 'end') justify = 'flex-' + justify - this.widget.style.justifyContent = justify - - } - - if (this.getProp('tabs') && this.getProp('tabs').length) { - - this.container.classList.add('contains-tabs') - this.container.classList.add('tabs-' + this.getProp('tabsPosition')) - - } else { - - this.container.classList.add('contains-widgets') - - if (this.getProp('scroll')) { - this.scrollLock = false - this.scrollLockTimeout = null - this.scroll = [0, 0] - this.scrollThumb = [1, 1] - this.scrollWidth = 1 - this.scrollHeight = 1 - fastdom.measure(()=>{ - this.scrollWidth = this.widget.scrollWidth - this.widget.clientWidth - this.scrollHeight = this.widget.scrollHeight - this.widget.clientHeight - this.scrollThumb = [this.widget.clientWidth / this.widget.scrollWidth || 1, this.widget.clientHeight / this.widget.scrollHeight || 1] - }) - this.on('scroll', (e)=>{ - if (this.scrollLock) e.locked = true - this.scrollWidth = this.widget.scrollWidth - this.widget.clientWidth - this.scrollHeight = this.widget.scrollHeight - this.widget.clientHeight - this.scroll = [this.widget.scrollLeft / this.scrollWidth || 0, this.widget.scrollTop / this.scrollHeight || 0] - this.scrollThumb = [this.widget.clientWidth / this.widget.scrollWidth || 1, this.widget.clientHeight / this.widget.scrollHeight || 1] - }, {element: this.widget}) - - } - - } - - - - - this.tabs = [] - - if (this.getProp('tabs') && this.getProp('tabs').length) { - - this.childrenType = 'tab' - - this.value = -1 - - this.navigation = this.widget.appendChild(html``) - - this.children = options.children || new Array(this.getProp('tabs').length) - var tlength = this.children.length - - for (let i = 0; i < tlength; i++) { - if (this.children[i]) { - this.widget.appendChild(this.children[i].container) - this.children[i].mounted = true - this.children[i].parent = this - this.children[i].parentNode = this.widget - } else { - parser.parse({ - data: this.getProp('tabs')[i], - parentNode: this.widget, - parent: this, - tab: true, - index: i, - meta: {...this.meta} - }) - } - } - - if (options.children) this.alignChildrenProps() - - this.createNavigation() - - this.on('fast-click', (e)=>{ - if (!e.target.hasAttribute('data-widget') || e.capturedByEditor) return - var index = DOM.index(e.target) - this.setValue(index, {sync: true, send:this.value != index}) - }, {element: this.navigation}) - - this.on('tab-created', (e)=>{ - this.createNavigation() - e.stopPropagation = true - }) - - this.setValue(Number(this.getProp('value')) || 0) - - } else if (this.getProp('widgets') && this.getProp('widgets').length) { - - this.value = -1 - - this.childrenType = 'widget' - - this.children = options.children || new Array(this.getProp('widgets').length) - var wlength = this.children.length - - for (let i = 0; i < wlength; i++) { - if (this.children[i]) { - this.widget.appendChild(this.children[i].container) - this.children[i].mounted = true - this.children[i].parent = this - this.children[i].parentNode = this.widget - } else { - parser.parse({ - data: this.getProp('widgets')[i], - parentNode: this.widget, - parent: this, - index: i, - meta: {...this.meta} - }) - } - } - - if (options.children) this.alignChildrenProps() - - - } - - if (this.getProp('traversing')) this.setTraversing() - - if (this.getProp('onTouch')) { - this.on('draginit',(e)=>this.onTouch(e, 'start'), {element: this.container, multitouch: true}) - this.on('drag',(e)=>this.onTouch(e, 'move'), {element: this.container, multitouch: true}) - this.on('dragend',(e)=>this.onTouch(e, 'stop'), {element: this.container, multitouch: true}) - } - - } - - createNavigation() { - - this.navigation.innerHTML = '' - this.tabs = [] - - DOM.each(this.widget, '> .widget', (tab)=>{ - - let widget = widgetManager.getWidgetByElement(tab), - style = '' - - style += widget.getProp('colorWidget') === 'auto' ? '' : `--color-widget:${widget.getProp('colorWidget')};` - style += widget.getProp('colorFill') === 'auto' ? '' : `--color-fill:${widget.getProp('colorFill')};` - style += widget.getProp('colorText') === 'auto' ? '' : `--color-text:${widget.getProp('colorText')};` - - if (!widget.getProp('visible')) style += 'display:none;' - - this.tabs.push(widget) - var label = html` - - ` - label.innerHTML = widget.label - this.navigation.appendChild(label) - - }) - - - this.setValue(this.value) - - } - - setValue(v, options={}) { - - if (this.childrenType === 'tab' && typeof v == 'number' && v >= 0 && v < this.tabs.length) { - - for (let i in this.tabs) { - if (i != v) this.tabs[i].hide() - } - - this.value = v - - this.tabs[v].show() - DOM.each(this.navigation, 'div', (el)=>{el.classList.remove('on')})[v].classList.add('on') - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - - } - - getScroll() { - - return this.scroll - - } - - setScroll(x, y, updateDom, lock=true) { - - if (x !== undefined) { - this.scroll[0] = x - if (updateDom) { - if (this.widget.scrollLeft != x * this.scrollWidth) { - this.scrollLock = !!lock - this.widget.scrollLeft = x * this.scrollWidth - } - } - } - if (y !== undefined) { - this.scroll[1] = y - if (updateDom) { - if (this.widget.scrollTop != y * this.scrollHeight) { - this.scrollLock = !!lock - this.widget.scrollTop = y * this.scrollHeight - } - } - } - - // unlock scroll events only after some time to prevent smooth scrolling - // issues in firefox and prevent feedback loops - if (this.scrollLock) { - clearTimeout(this.scrollLockTimeout) - this.scrollLockTimeout = setTimeout(()=>{ - this.scrollLock = false - },100) - } - - } - - onTouch(e, name) { - - var event = {...e}, - w - - event.targetName = event.target ? event.target.getAttribute('name') : '' - event.targetTagName = event.target ? event.target.tagName : '' - - w = widgetManager.getWidgetByElement(event.target) - if (w) event.target = w === this ? 'this' : w.getProp('id') - else event.target = null - - w = widgetManager.getWidgetByElement(event.firstTarget) - if (w) event.firstTarget = w === this ? 'this' : w.getProp('id') - else event.firstTarget = null - - event.type = name - - this.scripts.onTouch.run({ - value: this.value, - event: event - }, {sync: true, send: true}) - - e.inertia = parseFloat(event.inertia) || 1 - - if (name != 'stop' && event.preventDefault) e.preventDefault = true - if (event.allowScroll) e.allowScroll = true - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'traversing': - this.setTraversing() - return - - case 'colorBg': - this.setCssVariables() - // falls through - case 'colorWidget': - case 'colorText': - case 'colorFill': - case 'colorStroke': - case 'alphaStroke': - case 'alphaFillOff': - case 'alphaFillOn': - case 'padding': - for (var w of this.children) { - if (w) w.onPropChanged(propName) - } - return - - } - - } - - setCssVariables() { - - super.setCssVariables() - setScrollbarColor(this.container) - - } - - setTraversing(update) { - - var traversing = this.getProp('traversing') - - disableTraversingGestures(this.widget) - - if (traversing) { - enableTraversingGestures(this.widget, {type: typeof traversing === 'string' ? traversing : undefined}) - } - - } - - - onRemove() { - super.onRemove() - } - -} - -Panel.dynamicProps = Panel.prototype.constructor.dynamicProps.concat( - 'colorBg', - 'variables', - 'traversing' -) - -export default Panel diff --git a/src/client/widgets/containers/root.mjs b/src/client/widgets/containers/root.mjs deleted file mode 100644 index c61cdea5..00000000 --- a/src/client/widgets/containers/root.mjs +++ /dev/null @@ -1,120 +0,0 @@ -import Panel from './panel.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {updateMobileThemeColor} from '../../ui/utils.mjs' -import {DOM} from '../../globals.mjs' - -var mainMenu -;(async()=>{ - mainMenu = (await import('../../ui/main-menu.mjs')).default -})() - -class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'root'}) { - - static description() { - - return 'Main (unique) container' - - } - - static defaults() { - - return super.defaults().extend({ - widgets: { - visible: null, - }, - geometry: { - left: null, - top: null, - expand: null, - }, - style: { - colorFill: null, - colorStroke: null, - alphaStroke: null, - alphaFillOff: null, - lineWidth: null, - _separator_root_style: 'Root style', - hideMenu: {type: 'boolean', value: false, help: 'Set to `true` to hide the main menu button.'}, - - }, - scripting: { - onPreload: {type: 'script', value: '', editor: 'javascript', help: ['Script executed before any other widget is created. See documentation.']}, - } - }) - - } - - constructor(options) { - - options.root = true - options.props.id = 'root' - - super(options) - - this.widget.classList.add('root') - this.root = true - - this.checkMenuVisibility() - - DOM.each(this.widget, '> .navigation', (el)=>{ - el.classList.add('main') - }) - - } - - checkMenuVisibility() { - - if (this.getProp('hideMenu')) { - mainMenu.container.style.display = 'none' - } else { - mainMenu.container.style.display = '' - } - - } - - isVisible() { - - return true - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'hideMenu': - this.checkMenuVisibility() - return - case 'colorBg': - updateMobileThemeColor(this) - - } - - } - - - setContainerStyles(styles) { - - super.setContainerStyles(styles) - - this.container.classList.toggle('auto-height', this.getProp('height') === 'auto') - - } - - setCssVariables() { - - super.setCssVariables() - updateMobileThemeColor(this) - - } - -} - -Root.dynamicProps = Root.prototype.constructor.dynamicProps.concat( - 'hideMenu' -) - - -export default Root diff --git a/src/client/widgets/containers/tab.mjs b/src/client/widgets/containers/tab.mjs deleted file mode 100644 index 35f113c9..00000000 --- a/src/client/widgets/containers/tab.mjs +++ /dev/null @@ -1,114 +0,0 @@ -import Panel from './panel.mjs' -import * as resize from '../../events/resize.mjs' -import {iconify} from '../../ui/utils.mjs' - -class Tab extends Panel { - - static description() { - - return 'Tabbed panel widget.mjs' - - } - - static defaults() { - - return super.defaults().extend({ - geometry: null, - style: { - _separator_tab_style: 'Tab style', - label: {type: 'string|boolean', value: 'auto', help: [ - 'Set to `false` to hide completely', - '- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)', - '- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal`', - ]}, - colorStroke: null, - alphaStroke: null, - alphaFillOff: null, - alphaFillOn: null, - lineWidth: null - } - }) - - } - - constructor(options) { - - super(options) - - this.container.classList.add('show') - - this.detached = false - - this.label = '' - this.updateLabel() - - } - - updateLabel() { - - if (this.getProp('label') === false) { - this.label = '' - } else { - this.label = this.getProp('label') == 'auto'? - this.getProp('id'): - iconify(String(this.getProp('label')).replace(/allow attribute', - ]}, - }, - value: { - value: {type: 'string', value: '', help: [ - 'External web page URL.', - ]} - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html` - - - ` - }) - - if (!this.getProp('border')) this.container.classList.add('noborder') - - this.frame = DOM.get(this.widget, '.frame')[0] - - if (this.getProp('allow')) this.frame.setAttribute('allow', this.getProp('allow')) - - } - - setValue(v, options={}) { - - this.value = v - - if (this.value) { - this.frame.setAttribute('src', this.value) - } else { - this.frame.setAttribute('src', '') - } - - if (options.sync) this.changed(options) - - } - - -} - -export default Frame diff --git a/src/client/widgets/frames/html.mjs b/src/client/widgets/frames/html.mjs deleted file mode 100644 index 283ec572..00000000 --- a/src/client/widgets/frames/html.mjs +++ /dev/null @@ -1,75 +0,0 @@ -import morph from 'nanomorph' -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {DOM} from '../../globals.mjs' - -class Html extends StaticProperties(Widget, {bypass: true}) { - - static description() { - - return 'Simple HTML parser.' - - } - - - static defaults() { - - return super.defaults().extend({ - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html` - -
          -
          - `}) - - this.noValueState = true - - if (!this.getProp('border')) this.container.classList.add('noborder') - this.frame = DOM.get(this.widget, '.frame')[0] - - if (this.getProp('html') !== '') this.updateHtmlLegacy() - - } - - updateHtml(){} - - updateHtmlLegacy(){ - - var newHtml = this.frame.cloneNode(false) - - newHtml.innerHTML = this.getProp('html') - - morph(this.frame, newHtml) - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'html': - this.updateHtmlLegacy() - return - - } - - } - - -} - -export default Html diff --git a/src/client/widgets/frames/image.mjs b/src/client/widgets/frames/image.mjs deleted file mode 100644 index 9eae72c4..00000000 --- a/src/client/widgets/frames/image.mjs +++ /dev/null @@ -1,113 +0,0 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import {urlParser} from '../utils.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {DOM} from '../../globals.mjs' - -export default class Image extends StaticProperties(Widget, {bypass: true}) { - - static description() { - - return 'Load a image (url or base64-encoded).' - - } - - static defaults() { - - return super.defaults().extend({ - style: { - _separator_image_style: 'Image style', - size: {type: 'string', value: 'cover', choices: ['cover', 'contain', 'auto'], help: 'CSS background-size'}, - position: {type: 'string', value: 'center', choices: ['center', 'left', 'right', 'top', 'bottom', 'left top', 'left bottom', 'right top', 'right bottom'], help: 'CSS background-position'}, - repeat: {type: 'string', value: 'no-repeat', choices: ['no-repeat', 'repeat', 'repeat-x', 'repeat-y', 'space', 'round'], help: 'CSS background-repeat'}, - }, - class_specific: { - cache: {type: 'boolean', value: true, help: [ - 'Set to false to disable image caching (forces file reload when updating or editing the widget).', - 'When true, sending `reload` to the widget reloads its image without changing its value' - ]} - }, - value: { - value: {type: 'string', value: '', help: [ - '- File `url` or `path` (relative to the session or theme file location by default, falling back to absolute path)', - '- Base64 encoded image : `data:image/...`', - '- Enter "qrcode" to display the server\'s address QR code' - ]} - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html` - -
          -
          - `}) - - if (!this.getProp('border')) this.container.classList.add('noborder') - this.frame = DOM.get(this.widget, '.frame')[0] - - this.frame.style.setProperty('background-size', this.getProp('size')) - this.frame.style.setProperty('background-position', this.getProp('position')) - this.frame.style.setProperty('background-repeat', this.getProp('repeat')) - - } - - setValue(v, options={}) { - - if (typeof v !== 'string') return - - var s = v==null ? '' : '' + v, - cache_query = '' - - if (!s.length) { - - this.value = String(this.getProp('default')) - - } else if (s != 'reload') { - - if (s.length > 1) this.value = s - - } - - if (typeof this.value === 'string' && this.value.length) { - - if ((s === 'reload' || !this.getProp('cache')) && this.value.indexOf('base64') === -1) { - cache_query = (this.value.indexOf('?') != -1 ? '&' : '?') + Date.now() - } - - } - - var url = this.value, - parser = urlParser(url) - - // escape windows absolute file paths - if (!parser.protocol.match(/http|data/)) url = url.replace(':', '_:_') - url = url.replace(/\\/g, '\\\\') - - - if (url) { - this.frame.style.setProperty('background-image', `url("${url}${cache_query}")`) - } else { - this.frame.style.setProperty('background-image', '') - } - - if (options.sync) this.changed(options) - - } - - onRemove() { - - super.onRemove() - - } - -} diff --git a/src/client/widgets/frames/svg.mjs b/src/client/widgets/frames/svg.mjs deleted file mode 100644 index 443cd3ef..00000000 --- a/src/client/widgets/frames/svg.mjs +++ /dev/null @@ -1,115 +0,0 @@ -import morph from 'nanomorph' -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {DOM} from '../../globals.mjs' - - -class Svg extends StaticProperties(Widget, {bypass: true}) { - - static description() { - - return 'Svg parser.' - - } - - static defaults() { - - return super.defaults().extend({ - class_specific: { - svg: {type: 'string', value: '', help: [ - 'Svg xml definition (will be wrapped in a `< svg />` element)', - ]}, - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html` - - - - `}) - - this.noValueState = true - - this.frame = DOM.get(this.widget, '.frame')[0] - - this.height = undefined - this.width = undefined - - this.on('resize', this.resizeHandleProxy.bind(this), {element: this.widget}) - - if (!this.getProp('border')) this.container.classList.add('noborder') - - } - - updateSvg(force){ - - if (!this.width || !this.height) return - - var svg = this.getProp('svg') - - this.frame.setAttribute('width', this.width) - this.frame .setAttribute('height', this.height) - - var node = this.frame.cloneNode(false) - - node.innerHTML = svg - - if (force) { - this.frame.innerHTML = node.innerHTML - } else { - morph(this.frame, node) - } - - } - - resizeHandleProxy() { - - this.resizeHandle(...arguments) - - } - - resizeHandle(event){ - - var {width, height} = event - - this.height = height - this.width = width - - this.updateSvg(true) - - } - - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'svg': - this.updateSvg() - return - - } - - } - - -} - -Svg.dynamicProps = Svg.prototype.constructor.dynamicProps.concat( - 'svg' -) - -export default Svg diff --git a/src/client/widgets/graphs/eq.mjs b/src/client/widgets/graphs/eq.mjs deleted file mode 100644 index b3c0263c..00000000 --- a/src/client/widgets/graphs/eq.mjs +++ /dev/null @@ -1,293 +0,0 @@ -import {mapToScale} from '../utils.mjs' -import Plot from './plot.mjs' -import StaticProperties from '../mixins/static_properties.mjs' - -class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smooth:true}) { - - static description() { - - return 'Draws logarithmic frequency response from an array of filter objects.' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - interaction: {value: false} - }, - class_specific: { - filters: {type: 'array', value: '', help: [ - 'Each item must be an object with the following properties', - '- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak", "bandpass" or "notch", default: "peak")', - '- `freq`: number (filter\'s resonant frequency, default: 1000)', - '- `q`: number (Q factor, default: 1)', - '- `gain`: number (default: 0)', - '- `on`: boolean (default: true)', - '- `poles`: if `type` is "highpass" or "lowpass", indicates the number of poles for the filter (if omitted or 0, a biquad filter with Q factor is used). Set to 1 for 6dB/octaves roll-off, 2 for 12dB/octaves, etc.', - 'See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode' - - ]}, - pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'}, - rangeX: {type: 'object', value: {min: 20, max: 22000}, help: [ - 'Defines the min and max values for the x axis (in Hz, logarithmic scale)', - 'The sampling frequency used to compute the response curve will be 2 * rangeX.max', - - ]}, - rangeY: {type: 'object', value: {min:-6, max:6}, help: 'Defines the min and max values for the y axis (in dB)'}, - origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, - logScaleX: null, - logScaleY: null - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super(options) - - this.setupArrays() - this.calcPending = true - this.batchDraw() - - } - - setupArrays() { - - this.freqs = new Float32Array(this.width) - this.value = new Float32Array(this.width).fill(0) - - var i, - min = this.getProp('rangeX').min, - max = this.getProp('rangeX').max, - width = this.width - - for (i = 0; i < width; ++i) { - this.freqs[i] = mapToScale(i, [0, width], [min, max], -1, true) - } - - } - - calcResponse() { - - this.value.fill(0) - - for (let filter of this.getProp('filters')) { - - if (filter.on !== undefined && !filter.on) continue - - var poles = 1, - type = filter.type - - if ((type === 'lowpass' || type === 'highpass') && filter.poles !== undefined && filter.poles !== 0) { - poles = Math.max(parseInt(filter.poles), 1) - type += '-1p' - } - - biquadResponse({ - type: type || 'peak', - gain: filter.gain || 0, - frequency: filter.freq || 1000, - q: filter.q || 1, - poles, - Fs: this.getProp('rangeX').max * 2 - }, this.freqs, this.value) - } - - } - - draw() { - if (this.calcPending) { - this.calcResponse() - this.calcPending = false - } - super.draw() - } - - resizeHandle(event){ - - super.resizeHandle(event) - if (this.width !== this.value.length) { - this.setupArrays() - this.calcPending = true - this.batchDraw() - } - - } - - onPropChanged(propName, options, oldPropValue) { - - super.onPropChanged(...arguments) - - switch (propName) { - case 'filters': - this.calcPending = true - this.batchDraw() - return - - } - - } - -} - -Eq.dynamicProps = Eq.prototype.constructor.dynamicProps.concat( - 'filters' -) - -export default Eq - - -// biquadResponse -// Based on code by Nigel Redmon @ https://www.earlevel.com -function biquadResponse(options, frequencyHz, filterResponse) { - - var {type, frequency, q, gain, Fs, poles} = options, - len = frequencyHz.length, - a0, a1, a2, b1, b2,norm, - w, phi, y, i - - var V = Math.pow(10, Math.abs(gain) / 20) - var K = Math.tan(Math.PI * frequency / Fs) - - switch (type) { - case 'lowpass': - norm = 1 / (1 + K / q + K * K) - a0 = K * K * norm - a1 = 2 * a0 - a2 = a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case 'highpass': - norm = 1 / (1 + K / q + K * K) - a0 = 1 * norm - a1 = -2 * a0 - a2 = a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case 'lowpass-1p': - // b1 = Math.exp(-2.0 * Math.PI * (frequency / Fs)) - // a0 = 1.0 - b1 - // b1 = -b1 - // a1 = a2 = b2 = 0 - // using lowpass 1p1z instead - norm = 1 / (1 / K + 1) - a0 = a1 = norm - b1 = (1 - 1 / K) * norm - a2 = b2 = 0 - break - - case 'highpass-1p': - // b1 = -Math.exp(-2.0 * Math.PI * (0.5 - frequency / Fs)) - // a0 = 1.0 + b1 - // b1 = -b1 - // a1 = a2 = b2 = 0 - // using highpass 1p1z instead - norm = 1 / (K + 1) - a0 = norm - a1 = -norm - b1 = (K - 1) * norm - a2 = b2 = 0 - break - - case 'bandpass': - norm = 1 / (1 + K / q + K * K) - a0 = K / q * norm - a1 = 0 - a2 = -a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case 'notch': - norm = 1 / (1 + K / q + K * K) - a0 = (1 + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = a0 - b1 = a1 - b2 = (1 - K / q + K * K) * norm - break - - case 'peak': - if (gain >= 0) { - norm = 1 / (1 + 1/q * K + K * K) - a0 = (1 + V/q * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - V/q * K + K * K) * norm - b1 = a1 - b2 = (1 - 1/q * K + K * K) * norm - } - else { - norm = 1 / (1 + V/q * K + K * K) - a0 = (1 + 1/q * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - 1/q * K + K * K) * norm - b1 = a1 - b2 = (1 - V/q * K + K * K) * norm - } - break - case 'lowshelf': - if (gain >= 0) { - norm = 1 / (1 + Math.SQRT2 * K + K * K) - a0 = (1 + Math.sqrt(2*V) * K + V * K * K) * norm - a1 = 2 * (V * K * K - 1) * norm - a2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm - b1 = 2 * (K * K - 1) * norm - b2 = (1 - Math.SQRT2 * K + K * K) * norm - } - else { - norm = 1 / (1 + Math.sqrt(2*V) * K + V * K * K) - a0 = (1 + Math.SQRT2 * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - Math.SQRT2 * K + K * K) * norm - b1 = 2 * (V * K * K - 1) * norm - b2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm - } - break - case 'highshelf': - if (gain >= 0) { - norm = 1 / (1 + Math.SQRT2 * K + K * K) - a0 = (V + Math.sqrt(2*V) * K + K * K) * norm - a1 = 2 * (K * K - V) * norm - a2 = (V - Math.sqrt(2*V) * K + K * K) * norm - b1 = 2 * (K * K - 1) * norm - b2 = (1 - Math.SQRT2 * K + K * K) * norm - } - else { - norm = 1 / (V + Math.sqrt(2*V) * K + K * K) - a0 = (1 + Math.SQRT2 * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - Math.SQRT2 * K + K * K) * norm - b1 = 2 * (K * K - V) * norm - b2 = (V - Math.sqrt(2*V) * K + K * K) * norm - } - break - } - - - for (i = 0; i < len; i++) { - - w = mapToScale(frequencyHz[i], [0, Fs / 2], [0, Math.PI], -1, false), - phi = Math.pow(Math.sin(w / 2), 2), - y = Math.log(Math.pow(a0 + a1 + a2, 2) - 4 * (a0 * a1 + 4 * a0 * a2 + a1 * a2) * phi + 16 * a0 * a2 * phi * phi) - - Math.log(Math.pow(1 + b1 + b2, 2) - 4 * (b1 + 4 * b2 + b1 * b2) * phi + 16 * b2 * phi * phi) - - y = y * 10 / Math.LN10 - - filterResponse[i] += y * poles - - } - - -} diff --git a/src/client/widgets/graphs/plot.mjs b/src/client/widgets/graphs/plot.mjs deleted file mode 100644 index 6259a00e..00000000 --- a/src/client/widgets/graphs/plot.mjs +++ /dev/null @@ -1,257 +0,0 @@ -import html from 'nanohtml' -import {mapToScale} from '../utils.mjs' -import Canvas from '../common/canvas.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {PXSCALE, JSON5} from '../../globals.mjs' - -export default class Plot extends StaticProperties(Canvas, {bypass: true}) { - - static description() { - - return 'XY coordinates plot.' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - interaction: {value: false} - }, - style: { - _separator_plot_style: 'Plot style', - dots: {type: 'boolean', value: false, help: 'Draw dots on the line'}, - bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'}, - pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, - }, - class_specific: { - rangeX: {type: 'object', value: {min: 0, max: 1}, help: 'Defines the min and max values for the x axis'}, - rangeY: {type: 'object', value: {min: 0, max:1}, help: 'Defines the min and max values for the y axis'}, - logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'}, - logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'}, - origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, - }, - value: { - value: {type: 'array|string', value: '', help: [ - '- `Array` of `y` values: `[y1, y2, ...]`', - '- `Array` of `[x, y]` `array` values: `[[x1 , y1], [x2, y2], ...]`', - '- `String` `array`: `"[y1, y2, ...]"` or `"[[x1 , y1], [x2, y2], ...]"`', - '- `String` `object` to update specific coordinates only: `"{0: y1, 1: y2}"` or `"{0: [x1, y1], 1: [x2, y2]}"`', - ]} - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html` - - - - `}) - - this.value = [] - this.rangeX = this.getProp('rangeX') || {min:0,max:1} - this.rangeY = this.getProp('rangeY') || {min:0,max:1} - this.logScaleX = this.getProp('logScaleX') - this.logScaleY = this.getProp('logScaleY') - this.pips = { - x : { - min: Math.abs(this.rangeX.min)>=1000?this.rangeX.min/1000+'k':this.rangeX.min, - max: Math.abs(this.rangeX.max)>=1000?this.rangeX.max/1000+'k':this.rangeX.max - }, - y : { - min: Math.abs(this.rangeY.min)>=1000?this.rangeY.min/1000+'k':this.rangeY.min, - max: Math.abs(this.rangeY.max)>=1000?this.rangeY.max/1000+'k':this.rangeY.max - } - } - - } - - draw() { - - this.ctx.clearRect(0,0,this.width,this.height) - - if (this.getProp('bars')) { - this.draw_bars() - } else { - var points = this.draw_line() - if (this.getProp('dots')) { - this.draw_dots(points) - } - } - - if (this.getProp('pips')) this.draw_pips() - - } - - draw_pips() { - - this.ctx.fillStyle = this.cssVars.colorText - this.ctx.globalAlpha = this.cssVars.alphaPips - - var margin = this.cssVars.padding + this.cssVars.lineWidth - - if (margin < this.fontSize * 1.5) return - - - if (this.pips.x) { - - this.ctx.textAlign = 'center' - this.ctx.fillText(this.pips.x.min, margin, this.height - margin / 2) - this.ctx.fillText(this.pips.x.max, this.width - margin, this.height - margin / 2) - - } - - if (this.pips.y) { - - this.ctx.textAlign = 'right' - this.ctx.fillText(this.pips.y.min, margin / 2 + this.fontSize / 2, this.height - margin) - this.ctx.fillText(this.pips.y.max, margin / 2 + this.fontSize / 2, margin) - - } - - } - - draw_line() { - - var points = [], - padding = this.cssVars.padding + this.cssVars.lineWidth, - length = this.value.length, - x, y, i, previousValue, nx, ny - - for (i = 0; i < length; i++) { - - if (this.value[i].length) { - points.push(mapToScale(this.value[i][0], [this.rangeX.min, this.rangeX.max], [padding, this.width - padding], -1, this.logScaleX, true)) - points.push(mapToScale(this.value[i][1], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true, true)) - } else { - - if (i < length - 2 && this.value[i] === previousValue && this.value[i+1] === previousValue) { - continue - } - nx = mapToScale(i, [0, this.value.length - 1], [padding, this.width - padding], -1, this.logScaleX, true) - ny = mapToScale(this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true, true) - - if (x !== nx || y !== ny) { - points.push(nx) - points.push(ny) - x = nx - y = ny - } - - previousValue = this.value[i] - - } - - } - - if (points.length < 4) return points - - this.ctx.beginPath() - - this.ctx.moveTo(points[0], points[1]) - for (i = 2; i < points.length - 2; i += 2) { - this.ctx.lineTo(points[i], points[i + 1]) - } - this.ctx.lineTo(points[i], points[i + 1]) - - this.ctx.globalAlpha = 1 - this.ctx.lineWidth = 2 * PXSCALE - this.ctx.strokeStyle = this.cssVars.colorWidget - this.ctx.stroke() - - if (this.getProp('origin') !== false) { - - var origin = mapToScale(this.getProp('origin'), [this.rangeY.min, this.rangeY.max], [this.height - padding, padding], 0, this.getProp('logScaleY'), true) - - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.fillStyle = this.cssVars.colorFill - this.ctx.lineTo(this.width - padding, origin) - this.ctx.lineTo(padding, origin) - this.ctx.closePath() - this.ctx.fill() - - } - - return points - - } - - draw_dots(points) { - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorWidget - this.ctx.strokeStyle = this.cssVars.colorBackground - this.ctx.lineWidth = 2 * PXSCALE - for (var i = 0; i < points.length; i += 2) { - this.ctx.beginPath() - this.ctx.arc(points[i], points[i + 1], 2 * PXSCALE, 0, 2*Math.PI) - this.ctx.fill() - this.ctx.stroke() - } - - } - - draw_bars() { - - var padding = this.cssVars.padding, - barWidth = Math.round((this.width - padding * 2) / this.value.length), - offset = Math.round((this.width - barWidth * this.value.length) / 2) - - - var origin = mapToScale(this.getProp('origin') !== false ? this.getProp('origin') : this.rangeY.min, [this.rangeY.min, this.rangeY.max],[this.height - padding, padding], 0, this.getProp('logScaleY'), true) - - this.ctx.beginPath() - - for (let i in this.value) { - var y = mapToScale(this.value[i].length ? this.value[i][1] : this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], 0, this.logScaleY, true) - this.ctx.rect(offset + i * barWidth, Math.min(y, origin), barWidth - PXSCALE, Math.abs(Math.min(y - origin))) - - } - - this.ctx.globalAlpha = 0.4 - this.ctx.fillStyle = this.cssVars.colorWidget - this.ctx.fill() - - } - - setValue(v, options={}) { - - if (typeof v == 'string') { - try { - v = JSON5.parse(v) - } catch(err) {} - } - - if (typeof v == 'object' && v !== null) { - - if (Array.isArray(v)) { - - this.value = v - - } else { - - for (var i in v) { - if (!isNaN(i)) this.value[i] = v[i] - } - - } - - this.batchDraw() - - if (options.sync) this.changed(options) - - } - - - } - -} diff --git a/src/client/widgets/graphs/visualizer.mjs b/src/client/widgets/graphs/visualizer.mjs deleted file mode 100644 index 7ab31d75..00000000 --- a/src/client/widgets/graphs/visualizer.mjs +++ /dev/null @@ -1,172 +0,0 @@ -import {clip} from '../utils.mjs' -import Plot from './plot.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import canvasQueue from '../common/queue.mjs' -import {CANVAS_FRAMERATE} from '../../globals.mjs' - - -class Visualizer extends StaticProperties(Plot, {rangeX: {min: '', max: ''}, dots: false, smooth: false}) { - - static description() { - - return 'Display its value over time.' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - interaction: {value: false} - }, - style: { - bars: null, - dots: null, - }, - class_specific: { - duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'}, - framerate: {type: 'number', value: 30, help: 'Defines visualization framerate'}, - rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'}, - origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, - logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, - freeze: {type: 'boolean', value: false, help: 'Set to `true` to freeze current view and ignore incoming values'} - }, - osc: { - decimals: null, - typeTags: null, - bypass: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super(options) - - this.fps = clip(this.getProp('framerate'), [1, CANVAS_FRAMERATE]) - this.length = Math.round(clip(this.fps * this.getProp('duration'), [8, 4096])) - this.value = new Array(this.length).fill(this.rangeY.min) - this.cancel = false - this.looping = false - this.clock = 0 - this.lastUpdate = 0 - this.watchDuration = 1000 * this.getProp('duration') - this.ticks = 0 - - this.boundLoop = this.loop.bind(this) - - } - - startLoop() { - - this.clock = Date.now() - if (!this.looping && !this.getProp('freeze')) { - this.lastUpdate = Date.now() - canvasQueue.on('frame', this.boundLoop) - if (!canvasQueue.running) canvasQueue.startLoop() - this.looping = true - this.ticks = 0 - } - } - - stopLoop() { - - if (this.looping) { - - canvasQueue.off('frame', this.boundLoop) - this.looping = false - - } - - } - - loop() { - - var t = Date.now() - - if (t - this.clock >= this.watchDuration) { - this.stopLoop() - } - - this.ticks += (t - this.lastUpdate) / (1000 / this.fps) - - if (Math.floor(this.ticks) > 0) { - this.shiftData(Math.floor(this.ticks)) - this.ticks -= Math.floor(this.ticks) - this.batchDraw() - } - - this.lastUpdate = t - - } - - shiftData(n) { - - for (var i = 0; i < n; i++) { - this.value.push(this.value[this.length - 1]) - this.value.splice(0,1) - } - - } - - getValue() { - - return this.value[this.length - 1] - - } - - setValue(v, options={}) { - - - if (typeof(v) === 'number') { - - this.value[this.length - 1] = v - this.startLoop() - - if (options.sync) this.changed(options) - - - } else if (Array.isArray(v) && v.length === this.length) { - - this.value = v - this.startLoop() - - if (options.sync) this.changed(options) - - - } - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return - - switch (propName) { - - case 'freeze': - if (this.getProp('freeze')) this.stopLoop() - else this.startLoop() - return - - } - - } - - onRemove() { - - this.stopLoop() - super.onRemove() - - } - - -} - -Visualizer.dynamicProps = Visualizer.prototype.constructor.dynamicProps.concat( - 'freeze' -) - -export default Visualizer diff --git a/src/client/widgets/index.mjs b/src/client/widgets/index.mjs deleted file mode 100644 index 6ea652cf..00000000 --- a/src/client/widgets/index.mjs +++ /dev/null @@ -1,128 +0,0 @@ -// basics -import button from './basics/button.mjs' -import _switch from './basics/switch.mjs' -import dropdown from './basics/dropdown.mjs' -import menu from './basics/menu.mjs' -import input from './basics/input.mjs' -import textarea from './basics/textarea.mjs' -import file from './basics/file.mjs' - -// containers -import panel from './containers/panel.mjs' -import folder from './containers/folder.mjs' -import root from './containers/root.mjs' -import tab from './containers/tab.mjs' -import modal from './containers/modal.mjs' -import clone from './containers/clone.mjs' -import fragment from './containers/fragment.mjs' -import matrix from './containers/matrix.mjs' -import keyboard from './containers/keyboard.mjs' -import {PatchBay as patchbay, PatchBayNode as patchbaynode} from './containers/patchbay.mjs' - -// frames -import image from './frames/image.mjs' -import svg from './frames/svg.mjs' -import html from './frames/html.mjs' -import frame from './frames/frame.mjs' - -// graphs -import plot from './graphs/plot.mjs' -import eq from './graphs/eq.mjs' -import visualizer from './graphs/visualizer.mjs' - -// indicators -import led from './indicators/led.mjs' -import text from './indicators/text.mjs' - -// pads -import xy from './pads/xy.mjs' -import rgb from './pads/rgb.mjs' -import multixy from './pads/multixy.mjs' -import canvas from './pads/canvas.mjs' - -// sliders -import fader from './sliders/fader.mjs' -import knob from './sliders/knob.mjs' -import encoder from './sliders/encoder.mjs' -import range from './sliders/range.mjs' -import scrollbar from './sliders/scrollbar.mjs' - -// scripts -import script from './scripts/script-widget.mjs' -import variable from './scripts/variable.mjs' - -export const widgets = { - - // basics - button, - switch: _switch, - dropdown, - menu, - input, - textarea, - file, - - // containers - panel, - folder, - root, - tab, - modal, - clone, - fragment, - matrix, - keyboard, - patchbay, - patchbaynode, - - // frames - image, - svg, - html, - frame, - - // graphs - plot, - eq, - visualizer, - - // indicators - led, - text, - - // pads - xy, - rgb, - multixy, - canvas, - - // sliders - fader, - knob, - encoder, - range, - scrollbar, - - // scripts - script, - variable, - -} - -export const categories = { - 'Basics':['button', 'switch', 'dropdown', 'menu', 'input', 'textarea', 'file'], - 'Containers':['panel', 'modal', 'clone', 'fragment', 'matrix', 'keyboard', 'patchbay', 'folder'], - 'Frames':['frame', 'svg', 'html', 'image'], - 'Graphs':['plot','eq','visualizer'], - 'Indicators':['led', 'text'], - 'Pads':['xy','rgb','multixy', 'canvas'], - 'Sliders':['fader','knob', 'encoder', 'range', 'scrollbar'], - 'Scripts':['script', 'variable'], -} - -var defaults = {} -for (var k in widgets) { - defaults[k] = widgets[k].defaults() - widgets[k]._defaults = defaults[k]._props() -} -export {defaults} diff --git a/src/client/widgets/indicators/led.mjs b/src/client/widgets/indicators/led.mjs deleted file mode 100644 index b3b87498..00000000 --- a/src/client/widgets/indicators/led.mjs +++ /dev/null @@ -1,103 +0,0 @@ -import html from 'nanohtml' -import {mapToScale} from '../utils.mjs' -import Widget from '../common/widget.mjs' - -export default class Led extends Widget { - - static description() { - - return 'Intensity display.' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - interaction: {value: false} - }, - class_specific: { - mode: {type: 'string', value: 'intensity', choices: ['intensity', 'color'], help: 'Defines how value is interpreted (see `value`)'}, - range: {type: 'object', value: {min:0, max:1}, help: 'Value range'}, - alphaRange: {type: 'object', value: {min:0, max:1}, help: 'Alpha range (if `mode` is `color`)'}, - logScale: {type: 'boolean', value: false, help: 'If `mode` is `intensity`, set to `true` to use logarithmic scale.'}, - }, - value: { - value: {type: 'number|array|string', value: '', help: [ - 'If `mode` is `intensity`:', - '- `Number`: `intensity` between `range.min` and `range.max`', - 'If `mode` is `color`:', - '- `Array`: `[r, g, b]` (`r`, `g` and `b` between `range.min` and `range.max`)', - '- `Array`: `[r, g, b, alpha]` (`alpha` between `alphaRange.min` and `alphaRange.max`)', - '- `String`: CSS color', - ]} - }, - osc: { - decimals: null, - typeTags: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html``}) - - this.setValueIntensity(this.getProp('mode') === 'intensity' ? this.getProp('range').min : this.getProp('range').max) - - } - - setValue(v, options={}) { - - - var ret = this.getProp('mode') === 'intensity' ? this.setValueIntensity(v) : this.setValueColor(v) - - - if (options.sync && ret !== false) this.changed(options) - if (options.send) this.sendValue(null, {syncOnly: true}) - - } - - setValueIntensity(v) { - - if (typeof v != 'number') return false - - this.value = v - this.container.style.setProperty('--opacity', mapToScale(v, [this.getProp('range').min, this.getProp('range').max], [0, 1], -1, this.getProp('logScale'), true)) - - - } - - setValueColor(v) { - - var c = '' - - if (Array.isArray(v) && v.length >= 3) { - - for (let i in [0, 1, 2]) { - v[i] = parseInt(mapToScale(v[i], [this.getProp('range').min, this.getProp('range').max], [0, 255])) - } - - v[3] = v[3] === undefined ? 1 : mapToScale(v[3], [this.getProp('alphaRange').min, this.getProp('alphaRange').max], [0, 1], -1) - - c = `rgba(${v[0]}, ${v[1]}, ${v[2]}, ${v[3]})` - - } else if (typeof v == 'string') { - - c = v - - } else { - - return false - - } - - this.value = v - - this.container .style.setProperty('--color-led', c) - - } - -} diff --git a/src/client/widgets/indicators/text.mjs b/src/client/widgets/indicators/text.mjs deleted file mode 100644 index 79b154a8..00000000 --- a/src/client/widgets/indicators/text.mjs +++ /dev/null @@ -1,70 +0,0 @@ -import html from 'nanohtml' -import {iconify} from '../../ui/utils.mjs' -import Widget from '../common/widget.mjs' - -export default class Text extends Widget { - - static description() { - - return 'Display text.' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - interaction: {value: false} - }, - style: { - _separator_text_style: 'Text style', - vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'}, - wrap: {type: 'boolean|string', value: false, choices: [false, true, 'soft'], help: [ - 'Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.', - ]}, - align: {type: 'string', value: 'center', choices: ['center', 'left', 'right', 'top', 'bottom', 'left top', 'left bottom', 'right top', 'right bottom'], help: 'Text alignment.'}, - }, - osc: { - typeTags: null, - ignoreDefaults: null - } - }) - - } - - constructor(options) { - - super({...options, html: html``}) - - this.text = this.widget.appendChild(html``) - - if (this.getProp('vertical')) this.text.classList.add('vertical') - if (this.getProp('align').includes('left')) this.text.classList.add('left') - if (this.getProp('align').includes('right')) this.text.classList.add('right') - if (this.getProp('align').includes('top')) this.text.classList.add('top') - if (this.getProp('align').includes('bottom')) this.text.classList.add('bottom') - if (this.getProp('wrap')) this.text.classList.add('wrap') - if (this.getProp('wrap') === 'soft') this.text.classList.add('wrap-soft') - - this.setValue(this.getProp('default')) - - } - - - setValue(v, options={}) { - - this.value = v === '' || v === null ? this.getProp('default') : v - - var s = String(this.getValue(true)) - if (s.indexOf('^') > -1) { - this.text.innerHTML = iconify(s.replace(//g, '>').replace(/\n/g,'
          ')) - } else { - this.text.textContent = s.replace(/\n/g,'\r\n') - } - - if (options.sync) this.changed(options) - if (options.send) this.sendValue(null, {syncOnly: true}) - - } - -} diff --git a/src/client/widgets/mixins/double_tap.mjs b/src/client/widgets/mixins/double_tap.mjs deleted file mode 100644 index 8564e9c5..00000000 --- a/src/client/widgets/mixins/double_tap.mjs +++ /dev/null @@ -1,48 +0,0 @@ -import {normalizeDragEvent} from '../../events/utils.mjs' -import {DOUBLE_TAP_TIME} from '../../globals.mjs' - -export default (self, callback, options={})=>{ - - var lastTapTime = 0, - lastTapX, - lastTapY - - self.on(options.click ? 'click' : 'fast-click', (event)=>{ - - if (event.capturedByEditor) return - - var tapTime = Date.now(), - tapLength = tapTime - lastTapTime, - eventData = options.click ? event : event.detail - - if ( - - tapLength < DOUBLE_TAP_TIME && - Math.abs(lastTapX - eventData.pageX) < 20 && - Math.abs(lastTapY - eventData.pageY) < 20 && - (!options.click || event.pageX !== 0) // prevent fake click emitted with keyboard focus events - - ) { - - // execute callback at next cycle to ensure draginit events are resolved first - // normalize event now or offset gets lost - var e = normalizeDragEvent(event.detail) - setTimeout(()=>{ - callback(e) - }, 0) - lastTapTime = 0 - - // prevent touchend - if (!options.click) event.detail.preventOriginalEvent = true - - } else { - - lastTapTime = tapTime - lastTapX = eventData.pageX - lastTapY = eventData.pageY - - } - - }, {element: options.element}) - -} diff --git a/src/client/widgets/mixins/touch_state.mjs b/src/client/widgets/mixins/touch_state.mjs deleted file mode 100644 index 941cc18a..00000000 --- a/src/client/widgets/mixins/touch_state.mjs +++ /dev/null @@ -1,45 +0,0 @@ -export default (self, options)=>{ - - if (self.parent.preventChildrenTouchState) return - - self.touched = 0 - self.setValueTouchedQueue = undefined - - self.on('draginit',(e)=>{ - self.setValueTouchedQueue = undefined - - if (self.shouldDrag && !self.shouldDrag(e)) { - e.cancelDragEvent = true - return - } - self.touched += 1 - if (self.touched == 1) { - self.trigger('touch', {stopPropagation: true, touch: 1}) - } - }, options) - - self.on('dragend', (e)=>{ - if (self.touched == 1) { - self.touched = 0 - - if (self.setValueTouchedQueue !== undefined) { - self.setValue(...self.setValueTouchedQueue) - self.setValueTouchedQueue = undefined - } - - self.trigger('touch', {stopPropagation: true, touch: 0}) - - } else if (self.touched > 1){ - self.touched -= 1 - } - }, options) - - self.onRemove = ()=>{ - if (self.touched > 0) { - self.setValueTouchedQueue = undefined - self.trigger('touch', {stopPropagation: true, touch: 0}) - } - self.__proto__.onRemove.call(self) - } - -} diff --git a/src/client/widgets/pads/canvas.mjs b/src/client/widgets/pads/canvas.mjs deleted file mode 100644 index 8b0c62e1..00000000 --- a/src/client/widgets/pads/canvas.mjs +++ /dev/null @@ -1,200 +0,0 @@ -import html from 'nanohtml' -import Canvas from '../common/canvas.mjs' -import Script from '../scripts/script.mjs' -import widgetManager from '../../managers/widgets.mjs' - -class CanvasWidget extends Canvas { - - static description() { - - return 'Multitouch canvas widget with user-defined drawing functions and touch reactions.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - class_specific: { - contextType: {type: 'string', value: '2d', choices: ['2d', 'webgl2'], help: 'Context type for the canvas'}, - valueLength: {type: 'number', value: 1, help:[ - 'Defines the number of values accepted by the widget (minimum 1). Incoming messages that don\'t comply will be ignored', - 'When calling `set()` from a script, submitted value should be an array only if `valueLength` is greater than 1.' - ]}, - autoClear: {type: 'boolean', value: true, help: [ - 'If set to `false`, the canvas context won\'t be cleared automatically and `ctx.clearRect()` will need to be called in `onDraw`. Ignored if `contextType` is different from `2d`.' - ]}, - continuous: {type: 'boolean|number', value: false, help: [ - 'If set to `true`, `onDraw` will be called at each frame, otherwise it will be called only when the widget is touched and when it receives a value.', - 'Can be a number between 1 and 60 to specify the framerate (default: 30 fps).' - ]}, - } - }) - defaults.scripting = { - onCreate: {type: 'script', value: '', editor: 'javascript', help: ['Script executed when the widget is created. See documentation.']}, - onValue: {type: 'script', value: '', editor: 'javascript', help: ['Script executed whenever the widget\'s value updates. See documentation.']}, - onTouch: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released, and when the pointer moves when the widget is touched. See documentation.',]}, - onDraw: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is redrawn. See documentation.']}, - onResize: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is resized. See documentation.']}, - } - return defaults - - } - - constructor(options) { - - super({...options, html: html` - - - - `}) - - this.valueLength = Math.max(1, parseInt(this.getProp('valueLength')) || 1) - this.value = this.valueLength > 1 ? Array(this.valueLength).fill(0) : 0 - - if (this.getProp('onResize')) { - this.scripts.onResize = new Script({ - widget: this, - property: 'onResize', - code: this.getProp('onResize'), - context: { - value: 0, - width: 100, - height: 100, - cssVars: {} - } - }) - } - - if (this.getProp('onDraw')) { - this.scripts.onDraw = new Script({ - widget: this, - property: 'onDraw', - code: this.getProp('onDraw'), - context: { - value: 0, - width: 100, - height: 100, - ctx: {}, - cssVars: {} - } - }) - } - - if (this.getProp('onTouch')) { - - this.scripts.onTouch = new Script({ - widget: this, - property: 'onTouch', - code: this.getProp('onTouch'), - context: { - value: 0, - width: 100, - height: 100, - event: {} - } - }) - - this.on('draginit',(e)=>this.onTouch(e, 'start'), {element: this.container, multitouch: true}) - this.on('drag',(e)=>this.onTouch(e, 'move'), {element: this.container, multitouch: true}) - this.on('dragend',(e)=>this.onTouch(e, 'stop'), {element: this.container, multitouch: true}) - - } - - if (this.getProp('continuous')) { - var freq = parseInt(this.getProp('continuous')) || 30 - freq = Math.max(Math.min(60, freq), 1) - this.drawInterval = setInterval(()=>{ - this.batchDraw() - }, 1000/freq) - } - - } - - onTouch(e, name) { - - var event = {...e} - delete event.firstTarget - - event.targetName = event.target ? event.target.getAttribute('name') : '' - event.targetTagName = event.target ? event.target.tagName : '' - - var w = widgetManager.getWidgetByElement(event.target) - if (w) event.target = w === this ? 'this' : w.getProp('id') - else event.target = null - - event.type = name - - this.scripts.onTouch.run({ - value: this.value, - width: this.width, - height: this.height, - event: event, - }, {sync: true, send: true}) - - this.batchDraw() - - } - - setValue(v, options={}) { - - if (Array.isArray(v)) { - if (v.length !== this.valueLength) return - } else if (this.valueLength > 1) return - - this.value = v - - this.batchDraw() - - if (options.sync) this.changed(options) - if (options.send) this.sendValue() - if (options.defaultInit && this.script) this.script.setValue(this.value, {id: this.getProp('id')}) - - } - - - draw() { - - if (!this.getProp('onDraw')) return - - if (this.getProp('autoClear') && this.getProp('contextType') === '2d') { - this.clear() - this.ctx.beginPath() - } - - this.scripts.onDraw.run({ - value: this.value, - ctx: this.ctx, - width: this.width, - height: this.height, - cssVars: this.cssVars - }, {sync: false, send: false}) - - } - - extraResizeHandle(event) { - - if (!this.getProp('onResize')) return - - this.scripts.onResize.run({ - value: this.value, - width: this.width, - height: this.height, - cssVars: this.cssVars - }, {sync: true, send: true}) - - } - - onRemove() { - - clearInterval(this.drawInterval) - - super.onRemove() - - } - -} - -CanvasWidget.dynamicProps = CanvasWidget.prototype.constructor.dynamicProps.concat([ -]) - -export default CanvasWidget diff --git a/src/client/widgets/pads/multixy.mjs b/src/client/widgets/pads/multixy.mjs deleted file mode 100644 index 9ee2b584..00000000 --- a/src/client/widgets/pads/multixy.mjs +++ /dev/null @@ -1,433 +0,0 @@ -import Pad from './pad.mjs' -import Xy from './xy.mjs' -import {clip} from '../utils.mjs' -import doubleTap from '../mixins/double_tap.mjs' -import touchstate from '../mixins/touch_state.mjs' -import {PXSCALE} from '../../globals.mjs' - - -var xyDefaults = Xy.defaults()._props() - - -class MultiXy extends Pad { - - static description() { - - return 'Multi-point XY pad.' - - } - - static defaults() { - - - var defaults = super.defaults().extend({ - style: { - _separator_xy_style: 'Xy style', - pointSize: {type: 'integer', value: 20, help: 'Defines the points\' default size (may be in %)'}, - ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the points will be drawn only while touched.'}, - pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, - }, - class_specific: { - points: {type: 'integer|array', value: 2, help: [ - 'Defines the number of points on the pad', - 'Can be an array of strings that will be used as labels for the points (ex: `[\'A\', \'B\']`)' - ]}, - pointsAttr: {type: 'object', value: [], help: [ - 'Defines per-point properties that are otherwise inherited from the multixy. Must be an array of objects (one per point) that may contain the following keys:', - '- visible (visibility and interactability)', - '- colorFill (background color)', - '- colorStroke (outline color)', - '- colorText (label color)', - '- color (shorthand for colorFill and colorStroke)', - '- alphaFillOn (background opacity)', - '- pointSize', - '- label', - '- clipX', - '- clipY', - '- axisLock' - ]}, - snap: {type: 'boolean', value: false, help: [ - 'By default, the points are dragged from their initial position.', - 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', - ]}, - spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, - rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis (see fader)'}, - rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis (see fader)'}, - logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'}, - logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'}, - stepsX: {type: 'number|array|string', value: false, help: 'Defines `steps` for the x axis (see fader)'}, - stepsY: {type: 'number|array|string', value: false, help: 'Defines `steps` for the x axis (see fader)'}, - axisLock: {type: 'string', value: '', choices: ['', 'x', 'y', 'auto'], help: [ - 'Restrict movements to one of the axes only.', - 'When left empty, holding `Shift` while dragging will lock the pad according the first movement. `auto` will do the opposite.' - ]}, - doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [ - 'Set to `true` to make the knob reset to its `default` value when receiving a double tap.', - 'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).', - 'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. ' - ]}, - sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '}, - } - }) - - defaults.scripting.onTouch = {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released. See documentation.',]} - - return defaults - - } - - constructor(options) { - - super(options) - - this.npoints = Array.isArray(this.getProp('points')) ? this.getProp('points').length : parseInt(this.getProp('points')) - - if (isNaN(this.npoints) || this.npoints < 1) this.npoints = 1 - - this.preventChildrenTouchState = true - this.pads = [] - - for (let i = 0; i < this.npoints; i++) { - this.pads[i] = new Xy({props:{ - ...xyDefaults, - snap:this.getProp('snap'), - spring:this.getProp('spring'), - ephemeral:this.getProp('ephemeral'), - default:this.getProp('default').length === this.npoints * 2 ? [this.getProp('default')[i*2], this.getProp('default')[i*2 + 1]] : '', - rangeX:this.getProp('rangeX'), - rangeY:this.getProp('rangeY'), - decimals:this.getProp('decimals'), - logScaleX:this.getProp('logScaleX'), - logScaleY:this.getProp('logScaleY'), - stepsX:this.getProp('stepsX'), - stepsY:this.getProp('stepsY'), - axisLock:this.getProp('axisLock'), - pointSize: 'auto', - pips: false, - sensitivity: this.getProp('sensitivity'), - input:false - }, parent: this}) - this.pads[i].canvas.classList.add('pad-' + i) - this.widget.append(this.pads[i].canvas) - - } - - // tiny hack for pips until there's a proper range refactoring - this.faders = this.pads[0].faders - - this.pointsAttr = [] - this.updatePadsAttr() - - this.padsCoords = [] - this.touchMap = {} - - this.on('dragend',(e)=>{ - - var i = this.touchMap[e.pointerId] - - if (!i) return - - this.pads[i].touched = 0 - this.pads[i].trigger('dragend', e) - - this.trigger('touch', {stopPropagation: true, touch: [parseInt(this.touchMap[e.pointerId]), 0]}) - - delete this.touchMap[e.pointerId] - - }, {element: this.widget, multitouch: true}) - - touchstate(this, {element: this.widget, multitouch: true}) - - this.on('draginit',(e)=>{ - - var id - - if (!this.touchMap[e.pointerId]) { - - id = this.getPadIdFromCoords(e.offsetX, e.offsetY) - - this.touchMap[e.pointerId] = id - - } - - if (!id) return - - this.trigger('touch', {stopPropagation: true, touch: [parseInt(id), 1]}) - - this.pads[id].trigger('draginit', e) - this.pads[id].touched = 1 - - }, {element: this.widget, multitouch: true}) - - this.on('drag',(e)=>{ - - var i = this.touchMap[e.pointerId] - - if (!i) return - - e.fingers = 1 // cancel mutlifinger inertia - - this.pads[i].trigger('drag', e) - - }, {element: this.widget, multitouch: true}) - - this.on('value-changed',(e)=>{ - if (e.widget == this) return - e.stopPropagation = true - if (e.options.spring) e.options.dragged = true - this.setValue(this.getValue(), e.options) - }) - - if (this.getProp('doubleTap')) { - - if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') { - - doubleTap(this, ()=>{ - this.sendValue({v:null, address: this.getProp('doubleTap')}) - }, {element: this.widget}) - - } else { - - doubleTap(this, (e) => { - var id, ndiff, diff = Infinity - - for (var i in this.pads) { - ndiff = Math.abs(e.offsetX - this.padsCoords[i][0]) + Math.abs(e.offsetY - (this.padsCoords[i][1] + this.height)) - if (ndiff < diff) { - id = i - diff = ndiff - } - } - - var pad = this.pads[id] - - if (this.getProp('doubleTap') == 'script') { - this.scripts.onTouch.run({ - event: {type: 'doubleTap', handle: id}, - value: this.value - }, {sync: true, send: true}) - } else { - pad.setValue([pad.faders.x.getSpringValue(), pad.faders.y.getSpringValue()], { sync: true, send: true, spring: true, doubleTap: true }) - } - - }, { element: this.widget}) - - } - - } - - var v = [] - for (let i = 0; i < this.npoints * 2; i = i + 2) { - [v[i],v[i+1]] = this.pads[i/2].getValue() - } - - this.setValue(v) - - } - - getPadIdFromCoords(x, y) { - - var ndiff, diff = -1, - id - - for (var i in this.pads) { - - if (Object.values(this.touchMap).indexOf(i) != -1) continue - if (!this.pads[i].getProp('visible')) continue - - ndiff = Math.abs(x - this.padsCoords[i][0]) + Math.abs(y - (this.padsCoords[i][1] + this.height)) - - if (diff == -1 || ndiff < diff) { - id = i - diff = ndiff - } - - } - - return id - - } - - extraResizeHandle(event){ - - super.extraResizeHandle(event) - - for (var k in this.pads) { - this.pads[k].width = this.width - this.pads[k].height = this.height - this.pads[k].padPadding = this.padPadding - } - - this.updateHandlesPosition() - - - } - - cacheCanvasStyle(style) { - - super.cacheCanvasStyle(style) - for (var k in this.pads) { - this.pads[k].cacheCanvasStyle() - this.pads[k].batchDraw() - } - this.batchDraw() - - } - - setVisibility() { - - super.setVisibility() - for (var k in this.pads) { - this.pads[k].setVisibility() - } - this.batchDraw() - - } - - updateHandlesPosition() { - - for (var i=0;ix.js==n) - if (cssVar) { - this.pads[i].canvas.style.setProperty(cssVar.css, this.pointsAttr[i][n] == 'auto' ? '' : this.pointsAttr[i][n]) - } - - if (n == 'visible') { - this.pads[i].canvas.style.setProperty('opacity', this.pointsAttr[i][n] ? 1 : 0) - } - - } - } - } - - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'padding': - for (let w of this.pads) { - w.onPropChanged(propName) - } - return - - case 'colorText': - case 'colorWidget': - case 'colorFill': - case 'colorStroke': - case 'alphaStroke': - case 'alphaFillOff': - case 'alphaFillOn': - case 'pointsAttr': - case 'spring': - case 'pointSize': - case 'axisLock': - this.updatePadsAttr(options) - return - } - - } - - onRemove() { - for (var i in this.pads) { - this.pads[i].onRemove() - } - super.onRemove() - } - -} - - -MultiXy.dynamicProps = MultiXy.prototype.constructor.dynamicProps.filter(n => n !== 'decimals').concat([ - 'pointsAttr', -]) - -export default MultiXy diff --git a/src/client/widgets/pads/pad.mjs b/src/client/widgets/pads/pad.mjs deleted file mode 100644 index 68660e64..00000000 --- a/src/client/widgets/pads/pad.mjs +++ /dev/null @@ -1,113 +0,0 @@ -import html from 'nanohtml' -import Canvas from '../common/canvas.mjs' -import {PXSCALE} from '../../globals.mjs' - -class Pad extends Canvas { - - constructor(options) { - - super({...options, value: [], html: html` - - - - `}) - - } - - cacheCanvasStyle(style) { - - style = style || window.getComputedStyle(this.canvas) - - super.cacheCanvasStyle(style) - - this.padPadding = (this.cssVars.padding + this.cssVars.lineWidth) + 2 * PXSCALE - this.pointSize = parseFloat(this.cssVars.pointSize) * (this.cssVars.pointSize.indexOf('%') > -1 ? this.width / 100 : PXSCALE) - - } - - drawPips() { - - var margin = this.padPadding, - pipTexts = margin >= this.fontSize * 1.5 - - this.ctx.lineWidth = PXSCALE - this.ctx.fillStyle = this.cssVars.colorText - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.globalAlpha = this.cssVars.alphaPips - this.ctx.beginPath() - - for (let i in this.faders.x.rangeKeys) { - - let pip = this.faders.x.rangeKeys[i], - px = Math.round(0.5 * this.faders.x.percentToCoord(pip)) * 2 - - if (parseInt(px) === px) px -= 0.5 - - if (pipTexts) { - this.ctx.textAlign = 'center' - let label = this.faders.x.rangeLabels[i] - this.ctx.fillText(label, px, this.height - margin / 2) - } - - if (pip == 0 || pip == 100) continue - this.ctx.moveTo(px, margin - PXSCALE) - this.ctx.lineTo(px, this.height - margin + PXSCALE) - - - } - for (let i in this.faders.y.rangeKeys) { - - let pip = this.faders.y.rangeKeys[i], - py = Math.round(0.5 * this.faders.y.percentToCoord(pip)) * 2 - - if (parseInt(py) === py) py -= 0.5 - - if (pipTexts) { - this.ctx.textAlign = 'right' - let label = this.faders.y.rangeLabels[i] - this.ctx.fillText(label, margin / 2 + this.fontSize / 2, py) - } - - if (pip == 0 || pip == 100) continue - this.ctx.moveTo(margin - PXSCALE, py) - this.ctx.lineTo(this.width - margin + PXSCALE, py) - - - } - - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.stroke() - - } - - onPropChanged(propName, options, oldPropValue) { - - var ret = super.onPropChanged(...arguments) - - switch (propName) { - case 'pointSize': - this.setCssVariables() - return - } - - return ret - - - } - -} - -Pad.cssVariables = Pad.prototype.constructor.cssVariables.concat( - {js: 'pointSize', css: '--point-size'}, -) - -Pad.dynamicProps = Pad.prototype.constructor.dynamicProps.filter(n => n !== 'decimals').concat([ - 'spring', - 'axisLock', - 'pointSize', - 'label', - 'clipX', - 'clipY' -]) - -export default Pad diff --git a/src/client/widgets/pads/rgb.mjs b/src/client/widgets/pads/rgb.mjs deleted file mode 100644 index 4db285b4..00000000 --- a/src/client/widgets/pads/rgb.mjs +++ /dev/null @@ -1,310 +0,0 @@ -import html from 'nanohtml' -import Widget from '../common/widget.mjs' -import Xy from './xy.mjs' -import Fader from '../sliders/fader.mjs' -import {clip, mapToScale, hsbToRgb, rgbToHsb} from '../utils.mjs' -import touchstate from '../mixins/touch_state.mjs' -import {PXSCALE} from '../../globals.mjs' - -var faderDefaults = Fader.defaults()._props(), - xyDefaults = Xy.defaults()._props() - - -export default class Rgb extends Widget { - - static description() { - - return 'Color picker with optional alpha slider.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - class_specific: { - snap: {type: 'boolean', value: false, help: [ - 'By default, the points are dragged from their initial position.', - 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', - ]}, - spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, - range: {type: 'object', value: {min: 0, max: 255}, help: 'Defines the widget\'s output scale.'}, - alpha:{type: 'boolean', value: false, help: 'Set to `true` to enable alpha channel'}, - rangeAlpha: {type: 'object', value: {min: 0, max: 1}, help: 'Defines the widget\'s output scale for the alpha channel.'}, - } - }) - - defaults.scripting.onTouch = {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released. See documentation.',]} - - return defaults - - } - - constructor(options) { - - super({...options, value: [], html: html``}) - - this.container.classList.toggle('contains-alpha', this.getProp('alpha')) - - this.preventChildrenTouchState = true - - this.pad = new Xy({props:{ - ...xyDefaults, - type: 'xy', - label: false, - snap:this.getProp('snap'), - rangeX:{min:0,max:100}, - rangeY:{min:0,max:100}, - decimals:2, - pointSize: 10, - pips: false, - }, parent: this, meta: {not_editable: true}}) - this.pad.sendValue = ()=>{} - this.pad.container.classList.add('pad') - this.widget.appendChild(this.pad.container) - this.pad.on('value-changed',(e)=>{ - e.stopPropagation = true - this.dragHandle() - }) - - this.hue = new HueFader({props:{ - ...faderDefaults, - type: 'fader', - design: 'compact', - label: false, - pips:false, - horizontal:false, - snap:this.getProp('snap'), - range:{min:0,max:360}, - decimals:2 - }, parent: this, meta: {not_editable: true}}) - this.hue.container.classList.add('hue') - this.widget.appendChild(this.hue.container) - this.hue.on('value-changed',(e)=>{ - e.stopPropagation = true - this.dragHandle(true) - }) - - if (this.getProp('alpha')) { - this.alpha = new Fader({props:{ - ...faderDefaults, - type: 'fader', - design: 'compact', - label:false, - pips:false, - horizontal:true, - snap:this.getProp('snap'), - range: this.getProp('rangeAlpha'), - default: 255, - input:false, - decimals:2 - }, parent: this, meta: {not_editable: true}}) - this.alpha.container.classList.add('alpha') - this.widget.appendChild(this.alpha.container) - this.alpha.on('value-changed',(e)=>{ - e.stopPropagation = true - this.dragAlphaHandle() - }) - } - - var initValue = Array.isArray(this.getProp('default')) && this.getProp('default').length >= 3 ? this.getProp('default') : Array(3).fill(this.getProp('range').min) - if (this.getProp('alpha') && initValue.length < 4) { - initValue[3] = this.getProp('rangeAlpha').min - } - - if (this.getProp('spring')) { - - this.on('dragend', (e)=>{ - - e.stopPropagation = true - this.setValue(initValue, {sync:true,send:true}) - - }, {element: this.widget, ignoreCustomBindings: true}) - - } - - touchstate(this, {element: this.widget, multitouch: true, ignoreCustomBindings: false}) - - this.hsb = {h:0,s:0,b:0} - - this.setValue(initValue) - - } - - dragHandle(hue) { - var h = this.hue.value, - s = this.pad.value[0], - b = this.pad.value[1] - - if (h != this.hsb.h ||s != this.hsb.s || b != this.hsb.b) { - - this.hsb.h = this.hue.value - this.hsb.s = this.pad.value[0] - this.hsb.b = this.pad.value[1] - - this.update({nohue:!hue}) - - var rgb = hsbToRgb(this.hsb) - for (var k in rgb) { - rgb[k] = mapToScale(rgb[k], [0, 255], [this.getProp('range').min, this.getProp('range').max], -1) - } - - if (rgb.r != this.value[0] || rgb.g != this.value[1] || rgb.b != this.value[2]) { - this.setValue([rgb.r, rgb.g, rgb.b], { - send: true, - sync: true, - dragged: true, - nohue: !hue - }) - } - } - - } - - dragAlphaHandle() { - - var alpha = this.alpha.value - if (alpha !== this.value[3]) { - this.setValue([this.value[0], this.value[1], this.value[2], alpha], { - send: true, - sync: true, - dragged: true, - nohue: true - }) - } - - - } - - setValue(v, options={}) { - - if (!v || v.length < 3) return - if (this.touched && !options.dragged) return this.setValueTouchedQueue = [v, options] - - var value = Array(this.getProp('alpha') ? 4 : 3) - - for (var i = 0; i < 3; i++) { - value[i] = clip(v[i], [this.getProp('range').min, this.getProp('range').max]) - } - - if (value.length === 4) { - value[3] = v[3] === undefined ? this.alpha.value : clip(v[3], [this.getProp('rangeAlpha').min, this.getProp('rangeAlpha').max]) - } - - var hsb = rgbToHsb({ - r: mapToScale(value[0], [this.getProp('range').min, this.getProp('range').max], [0, 255], -1), - g: mapToScale(value[1], [this.getProp('range').min, this.getProp('range').max], [0, 255], -1), - b: mapToScale(value[2], [this.getProp('range').min, this.getProp('range').max], [0, 255], -1) - }) - - if (!options.dragged) { - this.pad.setValue([hsb.s, hsb.b]) - if (value.length === 4) this.alpha.setValue(value[3]) - } - - this.hsb = hsb - this.value = value - - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - this.update({dragged:options.dragged, nohue:options.nohue || (v[0]==v[1]&&v[1]==v[2])}) - - } - - update(options={}) { - - if (!options.nohue && !options.dragged) { - var hue = hsbToRgb({h:this.hsb.h,s:100,b:100}), - hueStr = `rgb(${Math.round(hue.r)},${Math.round(hue.g)},${Math.round(hue.b)})` - this.pad.container.style.setProperty('background-color', hueStr) - this.hue.setValue(this.hsb.h, {sync: false, send:false, dragged:false}) - } - - } - - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'colorText': - case 'colorWidget': - case 'colorFill': - case 'colorStroke': - case 'alphaStroke': - case 'alphaFillOff': - case 'alphaFillOn': - for (var w of [this.hue, this.pad]) { - w.onPropChanged(propName) - } - if (this.alpha) this.alpha.onPropChanged(propName) - return - - } - - } - - setVisibility() { - - super.setVisibility() - - for (var w of [this.hue, this.pad]) { - if (w) w.setVisibility() - } - if (this.alpha) this.alpha.setVisibility() - - } - - onRemove() { - this.hue.onRemove() - this.pad.onRemove() - if (this.alpha) this.alpha.onRemove() - super.onRemove() - } - -} - -class HueFader extends Fader { - - draw() { - - var width = this.getProp('horizontal') ? this.height : this.width, - height = !this.getProp('horizontal') ? this.height : this.width - - var percent = this.getProp('steps') ? this.valueToPercent(this.value) : this.percent, - d = Math.round(this.percentToCoord(percent)), - m = this.getProp('horizontal') ? this.height / 2 : this.width / 2, - flat = this.getProp('mode') === 'flat' - - // sharp border trick - if (width % 2 && parseInt(m) === m) m -= 0.5 - - this.clear() - - - this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill - - if (flat) { - this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2) - } else { - this.ctx.lineWidth = 2 * PXSCALE - } - - - // flat knob - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorFill - - this.ctx.beginPath() - this.ctx.rect(this.gaugePadding, Math.min(d, height - 2 * PXSCALE), width - this.gaugePadding * 2, 2 * PXSCALE) - this.ctx.fill() - - this.clearRect = [0, 0, width, height] - - } - -} diff --git a/src/client/widgets/pads/xy.mjs b/src/client/widgets/pads/xy.mjs deleted file mode 100644 index fdde2ccc..00000000 --- a/src/client/widgets/pads/xy.mjs +++ /dev/null @@ -1,329 +0,0 @@ -import Pad from './pad.mjs' -import Fader from '../sliders/fader.mjs' -import doubleTap from '../mixins/double_tap.mjs' -import touchstate from '../mixins/touch_state.mjs' -import {PXSCALE} from '../../globals.mjs' - -var faderDefaults = Fader.defaults()._props() - -export default class Xy extends Pad { - - static description() { - - return 'Two-dimensional slider.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - style: { - _separator_xy_style: 'Xy style', - pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size (may be in %)'}, - ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the point will be drawn only while touched.'}, - pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, - label: {type: 'string', value: '', help: 'Text displayed in the handle'} - }, - class_specific: { - snap: {type: 'boolean', value: false, help: [ - 'By default, the points are dragged from their initial position.', - 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates', - ]}, - spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'}, - rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis (see fader)'}, - rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis (see fader)'}, - logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'}, - logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'}, - stepsX: {type: 'number|array|string', value: false, help: 'Defines `steps` for the x axis (see fader)'}, - stepsY: {type: 'number|array|string', value: false, help: 'Defines `steps` for the x axis (see fader)'}, - clipX: {type: 'object', value: '', help: 'Min and max boundaries for the x axis'}, - clipY: {type: 'object', value: '', help: 'Min and max boundaries for the y axis'}, - axisLock: {type: 'string', value: '', choices: ['', 'x', 'y', 'auto'], help: [ - 'Restrict movements to one of the axes only unless `Shift` is held.', - 'When left empty, holding `Shift` while dragging will lock the pad according the first movement. `auto` will do the opposite.' - ]}, - doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [ - 'Set to `true` to make the knob reset to its `default` value when receiving a double tap.', - 'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).', - 'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. ' - ]}, - sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '}, - } - }) - - defaults.scripting.onTouch = {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released. See documentation.',]} - - return defaults - - } - - constructor(options) { - - super(options) - - this.preventChildrenTouchState = true - - this.faders = { - x: new Fader({props:{ - ...faderDefaults, - id:0, - visible:false, - horizontal:true, - default:this.getProp('default').length === 2 ? this.getProp('default')[0] : '', - snap:this.getProp('snap'), - range:this.getProp('rangeX'), - decimals:this.getProp('decimals'), - logScale:this.getProp('logScaleX'), - sensitivity: this.getProp('sensitivity'), - steps: this.getProp('stepsX'), - }, parent: this}), - y: new Fader({props:{ - ...faderDefaults, - id:1, - visible:false, - horizontal:false, - default:this.getProp('default').length === 2 ? this.getProp('default')[1] : '', - snap:this.getProp('snap'), - range:this.getProp('rangeY'), - decimals:this.getProp('decimals'), - logScale:this.getProp('logScaleY'), - sensitivity: this.getProp('sensitivity'), - steps: this.getProp('stepsY'), - }, parent: this}), - } - - this.on('value-changed',(e)=>{ - if (e.widget == this) return - e.stopPropagation = true - }) - - touchstate(this, {element: this.canvas}) - - this.active = false - - this.autoAxisLock = '' - - this.on('draginit',(e)=>{ - this.active = true - this.autoAxisLock = '' - var axis = this.getProp('axisLock') - if (axis !== '' && e.shiftKey) axis = '' - if (axis !== 'y') this.faders.x.trigger('draginit', {...e, stopPropagation: true}) - if (axis !== 'x') this.faders.y.trigger('draginit', {...e, stopPropagation: true}) - this.dragHandle() - }, {element: this.canvas}) - - this.on('drag',(e)=>{ - var axis = this.getProp('axisLock') - if (axis !== '' && e.shiftKey) axis = '' - else if (e.shiftKey && axis === '' || !e.shiftKey && axis === 'auto') { - if (this.autoAxisLock === '') { - if (Math.abs(e.movementX) > Math.abs(e.movementY)) { - this.autoAxisLock = 'x' - } else if (Math.abs(e.movementY) > Math.abs(e.movementX)) { - this.autoAxisLock = 'y' - } - } - axis = this.autoAxisLock - } - if (axis !== 'y') this.faders.x.trigger('drag', e) - if (axis !== 'x') this.faders.y.trigger('drag', e) - this.dragHandle() - }, {element: this.canvas}) - - this.on('dragend', (e)=>{ - this.active = false - var axis = this.getProp('axisLock') - if (axis !== '' && e.shiftKey) axis = '' - if (axis !== 'y') this.faders.x.trigger('dragend', {...e, stopPropagation: true}) - if (axis !== 'x') this.faders.y.trigger('dragend', {...e, stopPropagation: true}) - if (this.getProp('spring')) { - this.setValue([this.faders.x.getSpringValue(),this.faders.y.getSpringValue()],{sync:true, send:true, spring:true}) - } else { - if (this.getProp('clipX')) this.faders.x.setValue(this.value[0]) - if (this.getProp('clipY')) this.faders.y.setValue(this.value[1]) - this.batchDraw() - } - }, {element: this.canvas}) - - if (this.getProp('doubleTap')) { - - if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') { - - doubleTap(this, ()=>{ - this.sendValue({v:null, address: this.getProp('doubleTap')}) - }, {element: this.widget}) - - } else if (this.getProp('doubleTap') == 'script') { - - doubleTap(this, ()=>{ - this.scripts.onTouch.run({ - event: {type: 'doubleTap'}, - value: this.value - }, {sync: true, send: true}) - }, {element: this.widget}) - - - } else { - - doubleTap(this, ()=>{ - this.setValue([this.faders.x.getSpringValue(),this.faders.y.getSpringValue()],{sync:true, send:true, spring:true, doubleTap:true}) - }, {element: this.widget}) - - } - - } - - this.setValue([0,0]) - - } - - dragHandle(){ - - var x = this.faders.x.value, - y = this.faders.y.value - - - if (x != this.value[0] || y != this.value[1]) { - this.setValue([x, y],{send:true,sync:true,dragged:true}) - } else { - this.batchDraw() - } - - } - - extraResizeHandle(event){ - - super.extraResizeHandle(event) - - for (var k in this.faders) { - this.faders[k].width = this.width - this.faders[k].height = this.height - this.faders[k].gaugePadding = this.padPadding - } - - } - - - setValue(v, options={}) { - - if (!v || !v.length || v.length!=2) return - if (this.touched && !options.dragged && !options.doubleTap) return this.setValueTouchedQueue = [v, options] - - if (!options.dragged) { - this.clipValue(v) - this.faders.x.setValue(v[0], {sync: false, send:false, dragged:false, doubleTap: options.doubleTap}) - this.faders.y.setValue(v[1], {sync: false, send:false, dragged:false, doubleTap: options.doubleTap}) - } - - this.value = [ - this.faders.x.value, - this.faders.y.value - ] - - this.clipValue(this.value) - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - this.batchDraw() - - } - - clipValue(v) { - - if (this.getProp('clipX')) { - if (this.getProp('clipX').min !== undefined) v[0] = Math.max(this.getProp('clipX').min, v[0]) - if (this.getProp('clipX').max !== undefined) v[0] = Math.min(this.getProp('clipX').max, v[0]) - } - if (this.getProp('clipY')) { - if (this.getProp('clipY').min !== undefined) v[1] = Math.max(this.getProp('clipY').min, v[1]) - if (this.getProp('clipY').max !== undefined) v[1] = Math.min(this.getProp('clipY').max, v[1]) - } - - } - - draw() { - - if (!this.visible) return - - var pointSize = this.pointSize, - x = this.faders.x.percentToCoord(this.faders.x.valueToPercent(this.value[0])), - y = this.faders.y.percentToCoord(this.faders.y.valueToPercent(this.value[1])), - ephemeral = this.getProp('ephemeral') - - this.clear() - - if (!ephemeral || this.active) { - this.ctx.fillStyle = this.cssVars.colorFill - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(x, y, pointSize - 3 * PXSCALE, Math.PI * 2, false) - this.ctx.fill() - } - - - - if (this.getProp('pips')) this.drawPips() - else { - this.clearRect = [[x - pointSize - 2 * PXSCALE, y - pointSize - 2 * PXSCALE, (pointSize + 2 * PXSCALE) * 2, (pointSize + 2 * PXSCALE) * 2]] - } - - if (!ephemeral || this.active) { - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.globalAlpha = this.active ? 1 : 0.75 - this.ctx.lineWidth = 1.5 * PXSCALE - this.ctx.beginPath() - this.ctx.arc(x, y, pointSize, Math.PI * 2, false) - this.ctx.stroke() - - var t = this.getProp('label') - if (t) { - this.ctx.fillStyle = this.cssVars.colorText - this.ctx.globalAlpha = 1 - this.ctx.textAlign = 'center' - this.ctx.fillText(t, x + 0.5 * PXSCALE, y + PXSCALE) - - if (!this.getProp('pips')) { - var length = this.fontSize * t.length - this.clearRect.push([x - length / 2, y - this.fontSize / 2, length, this.fontSize + 2 * PXSCALE]) - } - - } - } - - - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'label': - this.batchDraw() - return - case 'spring': - if (this.getProp('spring') && !this.touched) { - var x = this.faders.x.getSpringValue(), - y = this.faders.y.getSpringValue() - if (x !== this.value[0] || y !== this.value[1]) this.setValue([x, y], {...options}) - } - return - - } - - } - - - onRemove() { - - this.faders.x.onRemove() - this.faders.y.onRemove() - super.onRemove() - - } - -} diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs deleted file mode 100644 index e5312e32..00000000 --- a/src/client/widgets/scripts/script-vm.mjs +++ /dev/null @@ -1,686 +0,0 @@ -import widgetManager from '../../managers/widgets.mjs' -import stateManager from '../../managers/state.mjs' -import cache from '../../managers/cache.mjs' -import {deepCopy} from '../../utils.mjs' -import {urlParser} from '../utils.mjs' -import Vm from '../vm.mjs' -import ipc from '../../ipc/index.mjs' -import uiFilebrowser from '../../ui/ui-filebrowser.mjs' -import uiFileUpload from '../../ui/ui-fileupload.mjs' -import {setFOCUSABLE} from '../../globals.mjs' - -var toolbar -setTimeout(async()=>{ - // use setTimeout to fix init order in safari... - toolbar = (await import('../../ui/main-menu.mjs')).default -}) - -class ScriptVm extends Vm { - - constructor() { - - super() - - this.valueOptions = [] - - } - - getValueOptions() { - - return this.valueOptions[this.valueOptions.length - 1] || {send: true, sync: true} - - } - - setValueOptions(options) { - - if (!options) this.valueOptions.pop() - else this.valueOptions.push(options) - - } - - resolveId(id) { - - var widget = this.getWidget() - - if (id === 'this') return [widget] - else if (id === 'parent' && widget.parent !== widgetManager) return [widget.parent] - else return widgetManager.getWidgetById(id, widget.scopes) - - } - - checkContext(name) { - if (this.widget.length === 0) throw name + '() cannot be called from outside the script property' - } - - registerGlobals() { - - this.globals.set = (id, value, extraOptions = {send: true, sync: true})=>{ - - this.checkContext('set') - - var widget = this.getWidget() - var options = {}, - valueOptions = this.getValueOptions() - - for (var k in valueOptions) { - if (k === 'widget') options[k] = valueOptions[k] - else options[k] = deepCopy(valueOptions[k]) - } - - options.fromScript = widget.hash - - if (options.dragged) options.dragged = false - if (options.local) options.local = false - - // if (id === options.id) options.sync = false // loop stop - // if (this.getWidget() === options.widget) options.sync = false // loop stop - - if (extraOptions.send === false) options.send = false - if (extraOptions.sync === false) options.sync = false - if (extraOptions.script === false) options.script = false - if (extraOptions.external === true) { - options.fromExternal = true - options.send = false - } - - var widgets - if (id.includes('*')) { - widgets = this.resolveId( - Object.keys(widgetManager.idRoute).filter(key => key.match(new RegExp('^' + id.replace(/\*/g, '.*') + '$'))) - ).filter(w => w !== widget) - } else { - widgets = this.resolveId(id).slice(0, 1) - } - - - for (var i = widgets.length - 1; i >= 0; i--) { - - widgets[i].setValue(value, options) - - } - - } - - this.globals.setVar = (id, name, value)=>{ - - this.checkContext('setVar') - - var widgets - if (id.includes('*')) { - var widget = this.getWidget() - widgets = this.resolveId( - Object.keys(widgetManager.idRoute).filter(key => key.match(new RegExp('^' + id.replace(/\*/g, '.*') + '$'))) - ).filter(w => w !== widget) - } else { - widgets = this.resolveId(id) - } - - - for (var i = widgets.length - 1; i >= 0; i--) { - - - if (widgets[i].variables[name]) { - - widgets[i].variables[name].value = value - widgets[i].variables[name].updated = 1 - widgets[i].updateProps(widgets[i].variables[name].propNames) - widgets[i].variables[name].updated = 0 - - } else { - - widgets[i].variables[name] = {value: value, propNames: []} - - } - - } - - } - - this.globals.send = (target, address, ...args)=>{ - - this.checkContext('send') - - var options = this.getValueOptions() - - if (!options.send) return - - if (target && target[0] === '/') { - args.unshift(address) - address = target - target = null - } - - var overrides = { - address, - v: args, - preArgs: [] - } - - if (target) overrides.target = Array.isArray(target) ? target : [target] - - var widget = this.getWidget() - - widget.sendValue(overrides, {force: true}) - - } - - this.globals.get = (id)=>{ - - this.checkContext('get') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].getValue) { - - var v = widgets[i].getValue() - if (v !== undefined) return v - - } - - } - - } - - this.globals.getVar = (id, name)=>{ - - this.checkContext('getVar') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].variables[name]) return deepCopy(widgets[i].variables[name].value) - - } - - } - - this.globals.getProp = (id, prop)=>{ - - this.checkContext('getProp') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - var v = widgets[i].getProp(prop) - if (v !== undefined) return deepCopy(v) - - } - - } - - this.globals.updateProp = (id, prop)=>{ - - this.checkContext('updateProp') - - var widgets = this.resolveId(id), - widget = this.getWidget() - - for (var i = widgets.length - 1; i >= 0; i--) { - - widgets[i].updateProps(Array.isArray(prop) ? prop : [prop], widget) - - } - - } - - this.globals.updateCanvas = (id)=>{ - - this.checkContext('updateCanvas') - - var widgets = this.resolveId(id) - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].batchDraw) widgets[i].batchDraw() - - } - - } - - this.globals.getIndex = (id = 'this')=>{ - - this.checkContext('getIndex') - - var widget = this.resolveId(id).pop() - if (widget) return widget.parent.children.indexOf(widget) - - } - - this.globals.getScroll = (id)=>{ - - this.checkContext('getScroll') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].getProp('scroll')) return widgets[i].getScroll() - - } - - return [] - - } - - this.globals.setScroll = (id, x, y)=>{ - - this.checkContext('setScroll') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].getProp('scroll')) widgets[i].setScroll(x, y, true, false) - - } - - } - - this.globals.scrollIntoView = (id, options)=>{ - - this.checkContext('setScroll') - - var widgets = this.resolveId(id) - - for (var i = widgets.length - 1; i >= 0; i--) { - - if (widgets[i].container && widgets[i].isVisible()) { - widgets[i].container.scrollIntoView(options) - } - - } - - } - - - - this.globals.httpGet = (url, callback)=>{ - - this.checkContext('httpGet') - - var parser = urlParser(url), - err = (e)=>{console.error(e)} - - if (!parser.isLocal()) return err('httpGet error (' + url + '): non-local url') - - var xhr = new XMLHttpRequest() - xhr.open('GET', url, true) - xhr.onload = (e)=>{ - if (xhr.readyState === 4 && xhr.status === 200 && callback) { - callback(xhr.responseText) - } - } - xhr.onerror = (e)=>err(`httpGet error (${url}): ${xhr.status} ${xhr.statusText}`) - xhr.send(null) - - } - - this.globals.stateGet = (filter)=>{ - - this.checkContext('stateGet') - - if (filter) { - - filter = Array.isArray(filter) ? filter : [filter] - - var containers = filter.map(x=>this.resolveId(x)).reduce((a,b)=>a.concat(b), []) - - if (!containers.length) return - filter = (widget)=>{ - return containers.some(x=>x.contains(widget) || x === widget) - } - } - - return deepCopy(stateManager.get(filter)) - - } - - this.globals.stateSet = (state, extraOptions = {})=>{ - - this.checkContext('stateSet') - - var options = this.getValueOptions() - stateManager.set(state, extraOptions.send === false ? false : options.send) - - } - - - this.globals.storage = { - - setItem: (k, v)=>{ - this.checkContext('storage.setItem') - cache.set('script.' + k, v) - }, - getItem: (k)=>{ - this.checkContext('storage.getItem') - return cache.get('script.' + k) - }, - removeItem: (k)=>{ - this.checkContext('storage.removeItem') - cache.remove('script.' + k) - }, - clear: ()=>{ - this.checkContext('storage.clear') - cache.clear('script.') - } - - } - - this.globals.setTimeout = (id, callback, timeout)=>{ - - this.checkContext('setTimeout') - - if (typeof id === 'function') { - timeout = callback - callback = id - id = undefined - } - - var widget = this.getWidget(), - options = this.getValueOptions() - - - if (widget.timeouts[id] !== undefined) { - clearTimeout(widget.timeouts[id]) - delete widget.timeouts[id] - } - widget.timeouts[id] = setTimeout(()=>{ - this.setWidget(widget) - this.setValueOptions(options) - try { - callback() - } catch(e) { - widget.errorProp('script', 'setTimeout', e) - } - this.setWidget() - this.setValueOptions() - }, timeout) - - return id - - } - - this.globals.clearTimeout = (id)=>{ - - this.checkContext('clearTimeout') - - var widget = this.getWidget() - - clearTimeout(widget.timeouts[id]) - delete widget.timeouts[id] - - } - - this.globals.setInterval = (id, callback, timeout)=>{ - - this.checkContext('setInterval') - - if (typeof id === 'function') { - timeout = callback - callback = id - id = undefined - } - - var widget = this.getWidget(), - options = this.getValueOptions() - - - if (widget.intervals[id] !== undefined) clearTimeout(widget.intervals[id]) - delete widget.intervals[id] - - widget.intervals[id] = setInterval(()=>{ - this.setWidget(widget) - this.setValueOptions(options) - try { - callback() - } catch(e) { - widget.errorProp('script', 'setInterval', e) - } - this.setWidget() - this.setValueOptions() - }, timeout) - - return id - - } - - this.globals.clearInterval = (id)=>{ - - this.checkContext('clearInterval') - - var widget = this.getWidget() - - clearInterval(widget.intervals[id]) - delete widget.intervals[id] - - } - - - this.globals.setFocus = (id)=>{ - - this.checkContext('setFocus') - - if (id) { - var widgets = this.resolveId(id) - - if (widgets.length) { - if (widgets[0].focus) widgets[0].focus() - } - } else if (document.activeElement) { - document.activeElement.blur() - } - - // built-in client only: electron will call window.focus() - console.debug('ELECTRON.FOCUS()') - - } - - this.globals.unfocus = ()=>{ - - this.checkContext('unfocus') - - window.blur() - // built-in client only: electron will call window.blur() - console.debug('ELECTRON.BLUR()') - - } - - this.globals.setFocusable = (focusable)=>{ - - this.checkContext('setFocusable') - setFOCUSABLE(!!focusable) - console.debug('ELECTRON.SETFOCUSABLE('+(focusable ? 1 : 0)+')') - - } - - - function getToolbarActionById(id, entries) { - for (var a of entries) { - if (a.id == id) { - return a - } - if (Array.isArray(a.action)) { - var ret = getToolbarActionById(id, a.action) - if (ret) return ret - } - } - } - - this.globals.toolbar = (...args)=>{ - - this.checkContext('toolbar') - - var options = this.getValueOptions() - - if (!options.send) return - - var action = toolbar.entries.filter(x=>!x.separator) - - if (typeof args[0] == 'string') { - - action = getToolbarActionById(args[0], action) - if (action) action = action.action // get callback - if (action && typeof action.class == 'function') { - if (action.class().match(/disabled/)) action = null - } - - } else { - - for (var i of args) { - if (action[i]) action = action[i].action - if (!Array.isArray(action)) break - action = action.filter(x=>!x.separator) - } - - } - - if (typeof action === 'function') action() - - } - - this.globals.getToolbar = (id)=>{ - - this.checkContext('toolbar') - - var options = this.getValueOptions() - - if (!options.send) return - - var action = getToolbarActionById(id, toolbar.entries.filter(x=>!x.separator)) - - if (action && typeof action.class == 'function') return action.class().split(' ').includes('on') - - } - - this.globals.openUrl = (url)=>{ - - this.checkContext('openUrl') - - var options = this.getValueOptions() - - if (options.send) window.open(url, '_blank') - - } - - this.globals.runAs = (id, callback)=>{ - - this.checkContext('runAs') - - var widgets = this.resolveId(id), - widget = this.getWidget() - - if (widgets.length) { - - this.setWidget(widgets[0]) - try { - callback() - } catch(e) { - widget.errorProp('script', 'runAs', e) - } - this.setWidget() - - } - - } - - this.globals.reload = (keepState = true)=>{ - - this.checkContext('reload') - - var options = this.getValueOptions(), - widget = this.getWidget() - - if (options.onCreate) { - widget.errorProp('onCreate', '', 'reload() cannot be called from onCreate') - } else if (options.send){ - if (keepState) ipc.trigger('reload') - else window.location.href = window.location.href - } - - - } - - this.globals.Image = Image - - this.globals.getNavigator = ()=>{ - this.checkContext('getNavigator') - return navigator - - } - - - this.globals.browseFile = (options, callback)=>{ - this.checkContext('browseFile') - if (typeof options === 'function') { - callback = options - options = {} - } - - - if (typeof callback === 'function') { - - var widget = this.getWidget(), - valueOptions = this.getValueOptions() - - uiFilebrowser({ - extension: options.extention || '*', - directory: options.directory || undefined, - loadDir: !!options.allowDir, - save: options.mode === 'save' - }, (path)=>{ - this.setWidget(widget) - this.setValueOptions(valueOptions) - try { - callback(path.join(path[0][0] === '/' ? '/' : '\\')) - } catch(e) { - widget.errorProp('script', 'browseFile', e) - } - this.setWidget() - this.setValueOptions() - }) - } else { - widget.errorProp('script', 'browseFile', 'callback argument must be a function') - } - } - - this.globals.uploadFile = (options, callback)=>{ - this.checkContext('uploadFile') - if (typeof options === 'function') { - callback = options - options = {} - } - - - if (typeof callback === 'function') { - - var widget = this.getWidget(), - valueOptions = this.getValueOptions() - - uiFileUpload(options.types, (path, content)=>{ - this.setWidget(widget) - this.setValueOptions(valueOptions) - try { - callback(content) - } catch(e) { - widget.errorProp('script', 'uploadFile', e) - } - this.setWidget() - this.setValueOptions() - }, (e)=>{ - widget.errorProp('script', 'uploadFile', e) - }) - } else { - widget.errorProp('script', 'browseFile', 'callback argument must be a function') - } - } - - super.registerGlobals() - - } - -} - -export default new ScriptVm() diff --git a/src/client/widgets/scripts/script-widget.mjs b/src/client/widgets/scripts/script-widget.mjs deleted file mode 100644 index 0db37429..00000000 --- a/src/client/widgets/scripts/script-widget.mjs +++ /dev/null @@ -1,127 +0,0 @@ -import Widget from '../common/widget.mjs' -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import Script from './script.mjs' - -class ScriptWidget extends Widget { - - static description() { - - return 'Scripting widget utility with keyboard bindings.mjs' - - } - - static defaults() { - - var defaults = super.defaults() - delete defaults.widget.visible - delete defaults.widget.interaction - delete defaults.geometry - delete defaults.style - defaults.scripting = { - onCreate: {type: 'script', value: '', editor: 'javascript', help: ['Script executed when the widget is created. See documentation.']}, - onValue: {type: 'script', value: '', editor: 'javascript', help: ['Script executed when the widget\'s value updates. See documentation.']}, - onKeyboard: {type: 'script', value: '', editor:'javascript', help: 'Script executed whenever the widget receives a keyboard event if `keyBinding` is set). See documentation.'}, - - _separator: 'Keyboard events', - - keyBinding: {type: 'string|array', value: '', help: [ - 'Key combo `string` or `array` of strings (see KeyboardJS documentation).', - 'If the editor is enabled, some keys / combos will not work.', - 'To process all keystroke events, write `[\'\']`' - ]}, - keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'}, - keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'}, - - } - return defaults - - } - - constructor(options) { - - super({...options, html: null}) - - this.noValueState = true - - - if (this.getProp('onKeyboard') && this.getProp('keyBinding')) { - - this.keyCb = this.keyboardCallback.bind(this) - - keyboardJS.withContext('global', ()=>{ - - keyboardJS.bind(this.getProp('keyBinding'), this.keyCb, this.keyCb) - - }) - - this.scripts.onKeyboard = new Script({ - widget: this, - property: 'onKeyboard', - code: this.getProp('onKeyboard'), - context: { - type: '', - key: '', - code: 0, - ctrl: false, - shift: false, - alt: false, - meta: false, - } - }) - - } - - } - - setValue(v, options={}) { - - this.value = v - - if (options.sync) this.changed(options) - - } - - keyboardCallback(e) { - - if (e.catchedByEditor) return - - if (e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return - - if (this.getProp('keyType') !== 'both' && e.type !== this.getProp('keyType')) return - - if (e.type === 'keydown' && !this.getProp('keyRepeat')) e.preventRepeat() - - if (e.preventDefault) e.preventDefault() - - this.scripts.onKeyboard.run({ - type: e.type, - key: e.key, - code: e.code, - ctrl: e.ctrlKey, - shift: e.shiftKey, - alt: e.altKey, - meta: e.metaKey - }, {send: true, sync: true}) - - } - - onRemove() { - - - if (this.getProp('onKeyboard') && this.getProp('keyBinding')) { - - keyboardJS.withContext('global', ()=>{ - - keyboardJS.unbind(this.getProp('keyBinding'), this.keyCb, this.keyCb) - - }) - - } - - super.onRemove() - - } - -} - -export default ScriptWidget diff --git a/src/client/widgets/scripts/script.mjs b/src/client/widgets/scripts/script.mjs deleted file mode 100644 index a43d9532..00000000 --- a/src/client/widgets/scripts/script.mjs +++ /dev/null @@ -1,69 +0,0 @@ -import scriptVm from './script-vm.mjs' - -var noop = ()=>{} - -class Script { - - constructor(options) { - - this.lock = false - this.timeouts = {} - this.intervals = {} - this.widget = options.widget - this.property = options.property - - if (!options.code) { - - this.script = noop - - } else { - - try { - this.script = scriptVm.compile(options.code, options.context) - } catch(err) { - this.widget.errorProp(this.property, 'javascript', err) - this.script = noop - } - - } - - } - - run(context, options) { - - if (this.lock) return - - scriptVm.setValueOptions(options) - scriptVm.setWidget(this.widget) - - this.lock = true - var returnValue - try { - returnValue = this.script(context, this.widget.parsersLocalScope) - } catch(err) { - this.widget.errorProp(this.property, 'javascript', err) - } - this.lock = false - - scriptVm.setWidget() - scriptVm.setValueOptions() - - return returnValue - - } - - onRemove() { - - for (let k in this.widget.timeouts) { - clearTimeout(this.widget.timeouts[k]) - } - - for (let k in this.widget.intervals) { - clearInterval(this.widget.intervals[k]) - } - - } - -} - -export default Script diff --git a/src/client/widgets/scripts/variable.mjs b/src/client/widgets/scripts/variable.mjs deleted file mode 100644 index 5bc448b4..00000000 --- a/src/client/widgets/scripts/variable.mjs +++ /dev/null @@ -1,41 +0,0 @@ -import Widget from '../common/widget.mjs' -import StaticProperties from '../mixins/static_properties.mjs' - -export default class Variable extends StaticProperties(Widget, {interaction: false, visible: false}) { - - static description() { - - return 'Receives / stores a value, to be used in scripts (using the get function) or in properties (using the @{} syntax).' - - } - - static defaults() { - - return super.defaults().extend({ - widget: { - visible: null, - interaction: null - }, - geometry: null, - style: null, - }) - - } - - constructor(options) { - - super({...options, html: null}) - - } - - - setValue(v, options={}) { - - this.value = v - - if (options.sync) this.changed(options) - if (options.send) this.sendValue(null, {syncOnly: true}) - - } - -} diff --git a/src/client/widgets/sliders/encoder.mjs b/src/client/widgets/sliders/encoder.mjs deleted file mode 100644 index 5fe30ae6..00000000 --- a/src/client/widgets/sliders/encoder.mjs +++ /dev/null @@ -1,266 +0,0 @@ -import Knob from './knob.mjs' -import StaticProperties from '../mixins/static_properties.mjs' - -export default class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}, design: 'encoder'}) { - - static description() { - - return 'A knob that sends a relative direction information instead of an absolute value.' - - } - - static defaults() { - - var defaults = super.defaults().extend({ - style: { - _separator_knob_style: null, - design: null, - pips: null, - dashed: null, - angle: null, - colorKnob: null - }, - class_specific: { - origin: null, - steps: null, - spring: null, - ticks: {type: 'number', value: '', help: 'Defines the granularity / verbosity of the encoder (number of step for a 360° arc)'}, - sensitivity: {type: 'number', value: 1, help: 'When set between 0 and 1, reduces the encoder\'s verbosity'}, - back: {type: '*', value: -1, help: 'Defines which value is sent when rotating the encoder anticlockwise'}, - forth: {type: '*', value: 1, help: 'Defines which value is sent when rotating the encoder clockwise'}, - release: {type: 'number', value: '', help: [ - 'Defines which value is sent when releasing the encoder:', - '- Set to `null` to send send no argument in the osc message', - '- Can be an `object` if the type needs to be specified' - ]}, - mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical', 'horizontal'], help: [ - '- `circular`: relative move in circular motion', - '- `snap`: snap to touch position and move in vertical motion', - '- `vertical`: relative move in vertical motion', - '- `horizontal`: relative move in horizontal motion', - ]}, - doubleTap: {type: 'boolean', value: false, help: [ - 'Set to `true` to make the fader reset to its `default` value when receiving a double tap.', - 'Can also be an osc address, in which case the widget will just send an osc message (`/ `)' - ]}, - } - }) - - defaults.scripting.onValue.help.push( - 'Additional variables:', - '- `locals.speed`: encoder\'s speed (reduce `sensitivity` to increase averaging)', - '- `locals.angle`: encoder\'s angle in degrees' - ) - - return defaults - - } - - constructor(options) { - - super(options) - - this.previousPercent = 50 - this.percent = 50 - this.ignoredValues = 0 - this.speed = [] - this.setValue(this.getProp('release'), {dragged: true}) - - } - - angleToPercent(angle, snap) { - - // knob.js without clipping - if (snap) return super.angleToPercent(angle) - - var percent = angle - (360 - this.maxAngle) / 2 / this.maxAngle * 100 - if (percent < 0) percent += 100 - else if (percent > 100) percent -= 100 - - return percent - - } - - percentToAngle(percent, snap) { - - // knob.js without clipping - if (snap) return super.percentToAngle(percent) - - return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle - + Math.PI / 2 // quarter circle offset - + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle - - } - - - draginitHandle(e) { - - // knob.js without clipping + extra case for snap - - this.lastOffsetX = e.offsetX - this.lastOffsetY = e.offsetY - - if (this.getProp('mode') === 'snap') { - - this.setPercent(this.angleToPercent(this.coordsToAngle(e.offsetX, e.offsetY), true)) - - } - - - - } - - dragHandle(e) { - - // knob.js without clipping + extra case for snap - var inertia = e.fingers > 1 || e.ctrlKey ? 10 : e.inertia - - if ((this.getProp('mode') === 'vertical' && !e.traversing)) { - // vertical - this.setPercent(this.percent - 100 * (e.movementY / inertia * this.getProp('sensitivity')) / this.minDimension) - - } else if ((this.getProp('mode') === 'horizontal' && !e.traversing)) { - // horizontal - this.setPercent(this.percent + 100 * (e.movementX / inertia * this.getProp('sensitivity')) / this.minDimension) - - } else { - // snap or circular - var offsetX = this.lastOffsetX + e.movementX, - offsetY = this.lastOffsetY + e.movementY - - var diff = this.angleToPercent(this.coordsToAngle(offsetX, offsetY), true) - this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY), true) - if (Math.abs(diff) < 50 && diff !== 0) { - diff = diff * this.getProp('sensitivity') / inertia - this.setPercent(this.percent + diff) - } - - this.lastOffsetX = offsetX - this.lastOffsetY = offsetY - - } - - } - - dragendHandle(e, data, traversing) { - - this.ignoredValues = 0 - - if (this.getProp('release') === '') return - - this.previousPercent = 50 - this.percent = 50 - this.speed = [] - this.setValue(this.getProp('release'), {sync: true, send: true, dragged: true}) - - } - - mousewheelHandle(e) { - - if (e.wheelDeltaX) return - - e.preventDefault() - e.stopPropagation() - - var direction = e.wheelDelta / Math.abs(e.wheelDelta), - increment = e.ctrlKey?0.25:1 - - this.setPercent(this.percent + Math.max(increment, 10 / Math.pow(10, this.decimals + 1)) * direction) - - } - - setPercent(percent) { - - this.previousPercent = this.percent - this.percent = percent - - if (this.getProp('ticks')) { - - var div = 100 / this.getProp('ticks'), - p = Math.round(this.percent / div) * div, - pp = Math.round(this.previousPercent / div) * div - - if (p === pp) return - - } else { - - if (this.percent === this.previousPercent) return - - } - - var dir = this.percent > this.previousPercent - - if ( - (this.percent >= 0 && this.percent < 25 && this.previousPercent > 75 && this.previousPercent <= 100) || - (this.previousPercent >= 0 && this.previousPercent < 25 && this.percent > 75 && this.percent <= 100) - - ) dir = !dir - - var val = dir ? this.getProp('forth') : this.getProp('back') - - this.speed.push(Math.abs(this.percent - this.previousPercent)) - - this.setValue(val, { - sync: true, - send: true, - dragged: true, - }) - - } - - getSpringValue() { - - return this.getProp('release') - - } - - setValue(v,options={}) { - - if (options.fromLocal && v === this.getProp('release')) { - this.percent = 50 - this.previousPercent = 50 - } else if ( - !options.dragged && - (v !== this.getProp('forth') && v !== this.getProp('back') && (this.getProp('release') === '' && v !== this.getProp('release'))) - - ) return - - - // sensitivity = ignore value updates - var sensitivityIgnore = false - if (this.getProp('sensitivity') < 1) { - if (v != this.getProp('release')) { - this.ignoredValues += 1 - if (this.ignoredValues <= 1 / this.getProp('sensitivity')) { - sensitivityIgnore = true - } else { - this.ignoredValues = 0 - } - } - } - - - this.value = v - - this.batchDraw() - - if (sensitivityIgnore) return - - if (!options.dragged && options.widget && options.widget instanceof Encoder) { - this.percent = options.widget.percent - } - - if (this.speed && this.speed.length) { - var s = this.speed.reduce((a,c)=>a+c) / this.speed.length - this.speed = [] - this.parsersLocalScope.speed = s - } else { - this.parsersLocalScope.speed = 0 - } - this.parsersLocalScope.angle = Math.abs(this.percent % 100 / 100 * 360) - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - -} diff --git a/src/client/widgets/sliders/fader.mjs b/src/client/widgets/sliders/fader.mjs deleted file mode 100644 index 180f6a99..00000000 --- a/src/client/widgets/sliders/fader.mjs +++ /dev/null @@ -1,555 +0,0 @@ -import {clip} from '../utils.mjs' -import Slider from './slider.mjs' -import {PXSCALE, CANVAS_SCALING} from '../../globals.mjs' - -class Fader extends Slider { - - static description() { - - return 'Vertical / horizontal slider.' - - } - - static defaults() { - - var defaults = super.defaults(Fader).extend({ - style: { - _separator_fader_style: 'Fader style', - design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'}, - knobSize: {type: 'number', value: 'auto', help: 'Fader knob size'}, - colorKnob: {type: 'string', value: 'auto', help: 'Fader knob color. Must be a valid css color.'}, - horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'}, - pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'}, - dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'}, - gradient: {type: 'array|object', value: [], help: [ - 'When set, the meter\'s gauge will be filled with a linear color gradient', - '- each item must be a CSS color string.', - '- as an `object`: each key must be a number between 0 and 1', - '- each item must be a CSS color string.', - 'Examples: `[\'blue\', \'red\']`, {\'0\': \'blue\', \'0.9\': \'blue\', \'1\': \'red\'} ' - ]}, - }, - class_specific: { - snap: {type: 'boolean', value: false, help: 'By default, dragging the widget will modify it\'s value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position'}, - touchZone: {type: 'string', value: 'all', choices: ['all', 'knob', 'gauge'], help: [ - 'Restrict interaction to a part of the widget:', - '- `all`: touching the widget anywhere will start an interaction', - '- `knob`: touching the knob will start an interaction', - '- `gauge`: touching anywhere in the knob\'s moving range will start an interaction', - 'This setting is ignored in containers with `traversing` set to `true`' - ]}, - spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'}, - doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [ - 'Set to `true` to make the knob reset to its `default` value when receiving a double tap.', - 'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).', - 'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. ' - ]}, - range: {type: 'object', value: {min:0,max:1}, help: [ - 'Defines the breakpoints of the fader\'s scale:', - '- keys can be percentages and/or `min` / `max`', - '- values can be `number` or `object` if a custom label is needed', - 'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)' - ]}, - logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'}, - sensitivity: {type: 'number', value: 1, help: 'Defines the fader\'s sensitivity when `snap` is `false` '}, - steps: {type: 'number|array|string', value: '', help: [ - 'Restricts the widget\'s value:', - '- `number`: define a number of evenly spaced steps', - '- `array` of numbers: use arbitrary values as steps', - '- `auto`: use values defined in `range`' - ]}, - origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the fader\'s gauge'}, - } - }) - - defaults.scripting.onTouch = {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released. See documentation.',]} - defaults.style.borderRadius= {type: 'number', value: 'auto', help: 'Border radius expressed as a number (same for all corners, applies only for compact design).'} - - return defaults - - } - - constructor(options) { - - super(options) - - this.container.classList.toggle('horizontal', this.getProp('horizontal')) - - this.gaugeGradient = null - this.shouldDrawPips = false - - var dashed = this.getProp('dashed') - this.dashed = dashed ? Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1, 1] : false - - } - - draginitHandle(e) { - - super.draginitHandle(...arguments) - - if (!e.traversing && !this.shouldDrag(e)) { - e.cancelDragEvent = true - return - } - - this.percent = clip(this.percent,[0,100]) - - if (!(e.traversing || this.getProp('snap')) || e.ctrlKey) return - - this.percent = this.getProp('horizontal')? - (e.offsetX - this.gaugePadding) / (this.width - this.gaugePadding * 2) * 100: - (this.height - e.offsetY - this.gaugePadding) / (this.height - this.gaugePadding * 2) * 100 - - this.setValue(this.percentToValue(this.percent), {send: true, sync: true, dragged: true}) - - } - - dragHandle(e, data) { - - super.dragHandle(...arguments) - - var padding = this.gaugePadding - if (this.getProp('design') === 'compact') padding += this.cssVars.knobSize / 2 - var inertia = e.fingers > 1 || e.ctrlKey ? 10 : e.inertia - this.percent = this.getProp('horizontal')? - this.percent + ( e.movementX / (this.width - padding * 2)) * 100 / inertia * this.getProp('sensitivity'): - this.percent + (-e.movementY / (this.height - padding * 2)) * 100 / inertia * this.getProp('sensitivity') - - this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) - - } - - shouldDrag(e, testZone) { - - var zone = testZone || this.getProp('touchZone'), - design = this.getProp('design'), - horizontal = this.getProp('horizontal'), - snap = this.getProp('snap') - - if (zone == 'all') return true - if (e.type == 'wheel' && zone == 'knob') zone = 'gauge' - if (design == 'compact' && zone == 'gauge') return true - - var x = e.offsetX, - y = e.offsetY, - percent = this.steps ? this.valueToPercent(this.value) : this.percent, - d = Math.round(this.percentToCoord(percent)), - m = horizontal ? this.height / 2 : this.width / 2, - knobHeight = this.cssVars.knobSize, - knobWidth = knobHeight * .6, - height = !horizontal ? this.height : this.width - - if (design == 'round') knobWidth = knobHeight - if (design == 'compact') { - knobWidth = this.width - // knob position range depends on knob size in compact mode - d = d / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight) - } - if (horizontal) [knobWidth, knobHeight] = [knobHeight, knobWidth] - - // add extra tolerance pixels - knobWidth += 2 * PXSCALE - knobHeight += 2 * PXSCALE - - var knobX = (horizontal ? d : m) - knobWidth / 2, - knobY = (horizontal ? m : d) - knobHeight / 2, - condition - - if (horizontal) { - if (design == 'compact') knobX += knobWidth / 2 - condition = ((x >= knobX && x <= knobX + knobWidth) || (zone == 'gauge' || snap)) && - y >= knobY && y <= knobY + knobHeight - } else { - if (design == 'compact') knobY += knobHeight / 2 - condition = x >= knobX && x <= knobX + knobWidth && - ((y >= knobY && y <= knobY + knobHeight) || (zone == 'gauge' || snap)) - } - - if (condition) { - return true - } else { - return false - } - - } - - percentToCoord(percent) { - - if (this.getProp('horizontal')) { - return clip(percent / 100,[0,1]) * (this.width - this.gaugePadding * 2) + this.gaugePadding - } else { - return (this.height - this.gaugePadding) - clip(percent / 100, [0,1]) * (this.height - this.gaugePadding * 2) - } - - } - - extraResizeHandle(event) { - - var ratio = CANVAS_SCALING * this.scaling - - super.extraResizeHandle(event) - - if (this.getProp('horizontal')){ - - this.ctx.setTransform(1, 0, 0, 1, 0, 0) - this.ctx.rotate(-Math.PI/2) - this.ctx.translate(-this.height * ratio, 0) - - if (ratio != 1) this.ctx.scale(ratio, ratio) - - } - - if (this.getProp('gradient')) { - - var colors = this.getProp('gradient') - - if ( - (Array.isArray(colors) && colors.length > 1) || - (typeof colors === 'object' && Object.keys(colors).length > 1) - ) { - - var grad = this.ctx.createLinearGradient(this.gaugePadding, this.getProp('horizontal') ? this.gaugePadding : this.height - this.gaugePadding, this.gaugePadding, this.getProp('horizontal') ? this.width - this.gaugePadding : this.gaugePadding) - - try { - if (Array.isArray(colors)) { - - for (var i in colors) { - grad.addColorStop(i / (colors.length - 1), colors[i]) - } - this.gaugeGradient = grad - - } else { - - for (var k in colors) { - if (!isNaN(k)) { - grad.addColorStop(clip(k, [0, 1]), colors[k]) - } - } - this.gaugeGradient = grad - - } - } catch(err) { - this.errorProp('gradient', '', err) - } - - } - - } - - } - - cacheCanvasStyle(style) { - - super.cacheCanvasStyle(style) - - if (this.getProp('pips') && this.getProp('design') !== 'compact') this.shouldDrawPips = true - - } - - - draw() { - - var width = this.getProp('horizontal') ? this.height : this.width, - height = !this.getProp('horizontal') ? this.height : this.width - - var percent = this.steps ? this.valueToPercent(this.value) : this.percent, - d = Math.round(this.percentToCoord(percent)), - o = Math.round(this.percentToCoord(this.valueToPercent(this.originValue))), - m = this.getProp('horizontal') ? this.height / 2 : this.width / 2, - dashed = this.dashed, - compact = this.getProp('design') === 'compact', - knobHeight = this.cssVars.knobSize, knobWidth = knobHeight * .6 - - this.clear() - - if (this.getProp('pips') && !compact) m -= 10 * PXSCALE - - // sharp border trick - if (compact) { - if (width % 2 && parseInt(m) === m) m -= 0.5 - } else { - if (width % 2 && parseInt(m) !== m) m -= 0.5 - } - - - this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill - - if (compact) { - this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2) - } else { - this.ctx.lineWidth = this.cssVars.lineWidth - } - - - if (dashed) this.ctx.setLineDash([PXSCALE * dashed[0], PXSCALE * dashed[1]]) - - - if (this.cssVars.alphaFillOff) { - // gaugo off - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.moveTo(m, height - this.gaugePadding) - this.ctx.lineTo(m, this.gaugePadding) - this.ctx.stroke() - } - - - if (this.cssVars.alphaFillOn) { - // gaugo on - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.moveTo(m, o) - this.ctx.lineTo(m, d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - if (compact) { - - // flat knob - - this.ctx.globalAlpha = this.cssVars.alphaKnob || 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - // adjust position to keep knob within gauge boundaries - d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding - this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight) - this.ctx.fill() - - let x, y, w, h, - rad = PXSCALE * this.cssVars.borderRadius - - // border radius: clip gauge & knob - if (rad > 0) { - rad = Math.min(Math.min(height, width) / 2, rad) - x = this.gaugePadding - y = this.gaugePadding - w = width - this.gaugePadding * 2 - h = height - this.gaugePadding * 2 - this.ctx.beginPath() - this.ctx.moveTo(x + rad, y) - this.ctx.arcTo(x + w, y, x + w, y + h, rad) - this.ctx.arcTo(x + w, y + h, x, y + h, rad) - this.ctx.arcTo(x, y + h, x, y, rad) - this.ctx.arcTo(x, y, x + w, y, rad) - this.ctx.closePath() - - var tmpOp = this.ctx.globalCompositeOperation - this.ctx.globalCompositeOperation = 'destination-in' - this.ctx.fillStyle = '#ffffff' - this.ctx.globalAlpha = 1 - this.ctx.fill() - this.ctx.globalCompositeOperation = tmpOp - } - - // stroke - if (this.cssVars.lineWidth) { - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - - // draw stroke - x = 0.5 * this.cssVars.lineWidth - y = 0.5 * this.cssVars.lineWidth - w = width - this.cssVars.lineWidth - h = height - this.cssVars.lineWidth - - this.ctx.beginPath() - if (rad > 0) { - this.ctx.moveTo(x + rad, y) - this.ctx.arcTo(x + w, y, x + w, y + h, rad) - this.ctx.arcTo(x + w, y + h, x, y + h, rad) - this.ctx.arcTo(x, y + h, x, y, rad) - this.ctx.arcTo(x, y, x + w, y, rad) - } else { - this.ctx.moveTo(x, y) - this.ctx.lineTo(x + w, y) - this.ctx.lineTo(x + w, y + h) - this.ctx.lineTo(x, y + h) - } - - this.ctx.closePath() - this.ctx.lineWidth = this.cssVars.lineWidth - this.ctx.stroke() - - } - - - - this.clearRect = [0, 0, width, height] - - - } else if (this.getProp('design') === 'default') { - - - if (this.cssVars.alphaStroke) { - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorBg - - this.ctx.beginPath() - this.ctx.rect(m - knobWidth / 2, d - knobHeight / 2, knobWidth, knobHeight) - this.ctx.fill() - - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.lineWidth = PXSCALE - this.ctx.rect(m - knobWidth / 2 + 0.5 * PXSCALE, d - knobHeight / 2 + 0.5 * PXSCALE, knobWidth - PXSCALE, knobHeight - PXSCALE) - this.ctx.stroke() - - } - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.rect(m - knobWidth / 6, d, knobWidth / 3, PXSCALE) - this.ctx.fill() - - var clearWidth = Math.max(knobWidth, this.cssVars.lineWidth) - this.clearRect = [m - clearWidth / 2 - PXSCALE, this.gaugePadding - knobHeight / 2 - PXSCALE, clearWidth + 2 * PXSCALE, height - 2 * this.gaugePadding + knobHeight + 2 * PXSCALE] - - } else { - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(m, d, knobHeight / 6, 0, 2 * Math.PI) - this.ctx.fill() - - - if (this.cssVars.alphaStroke) { - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(m, d, knobHeight / 2, 0, 2 * Math.PI) - this.ctx.fill() - } - - this.clearRect = [m - knobHeight / 2 - PXSCALE, this.gaugePadding - knobHeight / 2 - PXSCALE, knobHeight + 2 * PXSCALE, height - 2 * this.gaugePadding + knobHeight + 2 * PXSCALE] - - } - - if (this.shouldDrawPips) { - this.drawPips() - this.shouldDrawPips = false - } - - if (this.pips && this.pips.width && this.pips.height) { - this.ctx.globalAlpha = 1 - this.ctx.drawImage(this.pips, 0, 0) - if (!compact) this.clearRect = [this.clearRect, [m + knobWidth / 2, 0, 12 * PXSCALE + this.pipsTextSize, height]] - } - - - } - - drawPips() { - - this.pips = this.pips || this.canvas.cloneNode() - this.pips.width = this.getProp('horizontal') ? this.height : this.width - this.pips.height = !this.getProp('horizontal') ? this.height : this.width - this.pipsTextSize = this.fontSize - - - var ctx = this.pips.getContext('2d',{ - desynchronized: true, - lowLatency: true, - alpha: true, - preserveDrawingBuffer: true - }) - - ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily - ctx.textBaseline = this.ctx.textBaseline - ctx.textAlign = this.ctx.textAlign - - var width = this.getProp('horizontal') ? this.height : this.width, - height = !this.getProp('horizontal') ? this.height : this.width, - m = this.getProp('horizontal') ? this.height / 2 : this.width / 2, - compact = this.getProp('design') === 'compact' - - if (width % 2 && parseInt(m) !== m) m -= 0.5 - - if (!compact) m -= 16 * PXSCALE - this.cssVars.knobSize * .3 * PXSCALE - - - ctx.lineWidth = this.fontSize / 11 - ctx.fillStyle = this.cssVars.colorText - ctx.strokeStyle = this.cssVars.colorFill - - var i = 0 - - for (var pip of this.rangeKeys) { - - let d = Math.round(this.percentToCoord(pip)), - y = compact ? Math.min(d, height - this.gaugePadding - PXSCALE) : d, - pipWidth = 4 * PXSCALE - - y += 0.5 - - - ctx.globalAlpha = this.cssVars.alphaPips - - ctx.beginPath() - - ctx.moveTo(m + 7 * PXSCALE, y) - ctx.lineTo(m + 7 * PXSCALE + pipWidth, y) - ctx.stroke() - - - var textX = m + 10 * PXSCALE + pipWidth + 4 * PXSCALE, - textY = y - - ctx.globalAlpha = this.cssVars.alphaPipsText - - - if (this.getProp('horizontal')) { - - ctx.save() - ctx.translate(textX + 3 * PXSCALE, textY) - ctx.rotate(Math.PI/2) - ctx.textAlign = 'center' - ctx.fillText(this.rangeLabels[i], 0, 0) - ctx.restore() - - } else { - - this.pipsTextSize = Math.max(this.pipsTextSize , ctx.measureText(this.rangeLabels[i]).width) - ctx.fillText(this.rangeLabels[i], textX, textY) - - } - - - i++ - - } - - - } - - onRemove() { - - if (this.pips) { - this.pips.width = 0 - this.pips.height = 0 - } - super.onRemove() - - } - -} - - -Fader.cssVariables = Fader.prototype.constructor.cssVariables.concat( - {js: 'knobSize', css: '--knob-size', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE}, - {js: 'colorKnob', css: '--color-knob'}, -) - -export default Fader diff --git a/src/client/widgets/sliders/knob.mjs b/src/client/widgets/sliders/knob.mjs deleted file mode 100644 index a364e1ff..00000000 --- a/src/client/widgets/sliders/knob.mjs +++ /dev/null @@ -1,435 +0,0 @@ -import {clip} from '../utils.mjs' -import Slider from './slider.mjs' -import {PXSCALE} from '../../globals.mjs' - -class Knob extends Slider { - - static description() { - - return 'Rotative knob slider.' - - } - - static defaults() { - - var defaults = super.defaults(Knob).extend({ - style: { - _separator_knob_style: 'Knob style', - design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line', 'encoder'], help: [ - 'Design style', - 'Note: "solid" design uses "colorStroke" for the central knob color.' - ]}, - colorKnob: {type: 'string', value: 'auto', help: 'Knob color. Must be a valid css color.'}, - pips: {type: 'boolean', value: false, help: 'Set to `true` to show the scale\'s breakpoints'}, - dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'}, - angle: {type: 'number', value: 270, help: 'Defines the angle\'s width of the knob, in degrees'}, - }, - class_specific: { - mode: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'circular', 'snap', 'snap-alt'], help: [ - '- `vertical`: relative move in vertical motion', - '- `horizontal`: relative move in horizontal motion', - '- `circular`: relative move in circular motion', - '- `snap`: snap to touch position', - '- `snap-alt`: alternative snap mode that allow jumping from `range.min` to `range.max`. `sensitivity` is ignored with this mode.', - ]}, - spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'}, - doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [ - 'Set to `true` to make the knob reset to its `default` value when receiving a double tap.', - 'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).', - 'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. ' - ]}, - range: {type: 'object', value: {min:0,max:1}, help: [ - 'Defines the breakpoints of the fader\'s scale:', - '- keys can be percentages and/or `min` / `max`', - '- values can be `number` or `object` if a custom label is needed', - 'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)' - ]}, - logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'}, - sensitivity: {type: 'number', value: 1, help: 'Defines the knob\'s sensitivity when `mode` is not `snap` '}, - steps: {type: 'string|number|array', value: '', help: [ - 'Restricts the widget\'s value:', - '- `number`: define a number of evenly spaced steps', - '- `array` of numbers: use arbitrary values as steps', - '- `auto`: use values defined in `range`' - ]}, - origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the knob\'s gauge'}, - } - }) - - defaults.scripting.onTouch = {type: 'script', value: '', editor:'javascript', help: ['Script executed when the widget is touched and released. See documentation.',]} - - return defaults - - } - - constructor(options) { - - super(options) - - this.lastOffsetX = 0 - this.lastOffsetY = 0 - this.minDimension = 0 - - this.maxAngle = this.getProp('angle') - - if (this.getProp('pips')) { - - this.widget.classList.add('has-pips') - this.pipTexts = {} - for (var k in this.rangeKeys) { - this.pipTexts[this.rangeKeys[k]]=this.rangeLabels[k] - } - - } - - } - - draginitHandle(e) { - - this.percent = clip(this.percent,[0,100]) - - this.lastOffsetX = e.offsetX - this.lastOffsetY = e.offsetY - - if (this.getProp('mode') === 'snap' || this.getProp('mode') === 'snap-alt') { - - this.percent = this.angleToPercent(this.coordsToAngle(e.offsetX, e.offsetY)) - - this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) - - } - - - } - - dragHandle(e) { - - var inertia = e.fingers > 1 || e.ctrlKey ? 10 : e.inertia - - if ((this.getProp('mode') === 'vertical' && !e.traversing)) { - // vertical - this.percent = -100 * (e.movementY / inertia * this.getProp('sensitivity')) / this.minDimension + this.percent - - } else if ((this.getProp('mode') === 'horizontal' && !e.traversing)) { - // horizontal - this.percent = 100 * (e.movementX / inertia * this.getProp('sensitivity')) / this.minDimension + this.percent - - } else { - // snap or circular - var offsetX = this.lastOffsetX + e.movementX, - offsetY = this.lastOffsetY + e.movementY - - if (this.getProp('mode') === 'snap-alt'){ - this.percent = this.angleToPercent(this.coordsToAngle(offsetX, offsetY)) - } else { - var diff = this.angleToPercent(this.coordsToAngle(offsetX, offsetY), true) - this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY), true) - if (Math.abs(diff) < 50 && diff !== 0) this.percent += (diff * 360 / this.maxAngle) * this.getProp('sensitivity') / inertia - } - - this.lastOffsetX = offsetX - this.lastOffsetY = offsetY - - } - - - // this.percent = clip(this.percent,[0,100]) - - this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true}) - - } - - coordsToAngle(x,y) { - - var xToCenter = x - this.width /2, - yToCenter = y - this.height / 2, - angle = Math.atan2(-yToCenter, -xToCenter) * 180 / Math.PI + 90 - - return angle<0?360+angle:angle - - } - - angleToPercent(angle, ignoreMaxAngle=false) { - - return ignoreMaxAngle ? - clip(angle, [0, 360]) / 360 * 100 - : clip(angle - (360 - this.maxAngle) / 2, [0, this.maxAngle]) / this.maxAngle * 100 - - } - - percentToAngle(percent) { - - percent = clip(percent, [0, 100]) - - return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle - + Math.PI / 2 // quarter circle offset - + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle - - } - - extraResizeHandle(event) { - - super.extraResizeHandle(event) - - this.minDimension = Math.min(this.width, this.height) - - } - - draw() { - - var percent = this.steps ? this.valueToPercent(this.value) : this.percent, - o = this.percentToAngle(this.valueToPercent(this.originValue)), - d = this.percentToAngle(percent), - min = this.percentToAngle(0), - max = this.percentToAngle(100), - dashed = this.getProp('dashed'), - pips = this.getProp('pips'), - minRadius = this.minDimension / 6 - (pips ? this.fontSize * 0.75 : 0) - this.cssVars.lineWidth / 2, - maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : 0) - this.cssVars.lineWidth / 2 - - if (dashed) dashed = Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1.5, 1.5] - - var gaugeWidth = maxRadius - minRadius, - gaugeRadius = maxRadius - gaugeWidth / 2 - - this.clear() - - switch (this.getProp('design')) { - case 'default': - { - if (this.minDimension < 40) { - minRadius /= 2 - gaugeWidth = maxRadius - minRadius - gaugeRadius = maxRadius - gaugeWidth / 2 - } - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - - // stroke - if (this.cssVars.lineWidth) { - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.lineWidth = this.cssVars.lineWidth - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) - this.ctx.stroke() - } - - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE - - let r1 = minRadius + this.gaugePadding, - r2 = maxRadius - this.gaugePadding, - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - break - } - case 'solid': - { - // center - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius / 1.25, 0, 2 * Math.PI) - this.ctx.fill() - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorBg - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE - - let r1 = minRadius, - r2 = maxRadius / 1.25 + PXSCALE , - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - break - } - case 'line': - { - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth - - let r1 = minRadius * 1.5, - r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE, - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - break - } - case 'encoder': - { - let angle = 2 * Math.PI / 16 - - // fill - this.ctx.globalAlpha = this.cssVars.alphaFill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min - angle, max + angle) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, d - angle, d + angle) - this.ctx.stroke() - } - - // stroke - if (this.cssVars.lineWidth) { - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.lineWidth = this.cssVars.lineWidth - - if (this.minDimension > 40) { - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI) - this.ctx.stroke() - } - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) - this.ctx.stroke() - - } - - break - } - } - - - // pips - - if (pips) { - - this.ctx.lineWidth = this.fontSize / 11 * 1.5 - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.globalAlpha = this.cssVars.alphaPips - - for (var pip of this.rangeKeys) { - - let r1 = maxRadius + this.cssVars.lineWidth / 2 + 2 * PXSCALE, - r2 = r1 + 4 * PXSCALE, - a = 2 * Math.PI - this.percentToAngle(pip) - - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - - } - var radius = maxRadius + (this.fontSize + this.cssVars.lineWidth / 2 + 2 * PXSCALE) - this.ctx.fillStyle = this.cssVars.colorText - this.ctx.globalAlpha = this.cssVars.alphaPipsText - for (var p in this.pipTexts) { - if (this.pipTexts[p] === undefined || (this.maxAngle === 360 && p === '100')) continue - let angle = this.percentToAngle(p), - size = this.ctx.measureText(this.pipTexts[p]), - x = this.width / 2 + radius * Math.cos(angle) - size.width / 2, - y = this.height / 2 + radius * Math.sin(angle) - this.ctx.fillText(this.pipTexts[p], x, y) - } - - } - - } - -} - -Knob.cssVariables = Knob.prototype.constructor.cssVariables.concat( - {js: 'colorKnob', css: '--color-knob'} -) - -export default Knob diff --git a/src/client/widgets/sliders/range.mjs b/src/client/widgets/sliders/range.mjs deleted file mode 100644 index 55f5097c..00000000 --- a/src/client/widgets/sliders/range.mjs +++ /dev/null @@ -1,423 +0,0 @@ -import html from 'nanohtml' -import {clip} from '../utils.mjs' -import Fader from './fader' -import {PXSCALE} from '../../globals.mjs' - -var faderDefaults = Fader.defaults()._props() - -var rangePassedProps = ['horizontal', 'snap', 'steps', 'spring', 'range', 'decimals', 'logScale', 'sensitivity'] - -class SubFader extends Fader { - - getProp(propName) { - - if (rangePassedProps.includes(propName)) { - - return this.parent.getProp(propName) - - } else { - - return super.getProp(propName) - - } - - } - -} - -class Range extends Fader { - - static description() { - - return 'A fader with two heads for setting a range.' - - } - - static defaults() { - - return super.defaults(Fader).extend({ - class_specific: { - origin: null, - } - }) - } - - constructor(options) { - - options.multitouch = true - - super({...options, value: [], html: html` - - `}) - - this.preventChildrenTouchState = true - - this.faders = [ - new SubFader({props:{ - ...faderDefaults, - pips:false, - visible: false, - default:this.getProp('default').length === 2 ? this.getProp('default')[0] : this.getProp('range').min, - origin:this.getProp('default').length === 2 ? this.getProp('default')[0] : this.getProp('range').min, - }, parent: this}), - new SubFader({props:{ - ...faderDefaults, - pips:false, - visible: false, - default:this.getProp('default').length === 2 ? this.getProp('default')[1] : this.getProp('range').max, - origin:this.getProp('default').length === 2 ? this.getProp('default')[1] : this.getProp('range').max, - }, parent: this}) - ] - - - this.on('value-changed',(e)=>{ - - if (e.widget == this) return - - e.stopPropagation = true - - var v = [ - this.faders[0].getValue(), - this.faders[1].getValue() - ] - - this.setValue(v, e.options) - - }) - - this.touchMap = {} - - - this.originValue = this.faders.map(f => f.originValue) - this.setValue(this.getSpringValue()) - - } - - extraResizeHandle(event){ - - super.extraResizeHandle(event) - - for (var f of this.faders) { - f.width = this.width - f.height = this.height - f.gaugePadding = this.gaugePadding - } - - } - - draginitHandle(e) { - - var id - - if (!this.touchMap[e.pointerId]) { - - var ndiff, diff = -1 - - for (var i in this.faders) { - - if (Object.values(this.touchMap).indexOf(i) != -1) continue - - var coord = this.faders[i].percentToCoord(this.faders[i].valueToPercent(this.faders[i].value)) - (this.getProp('horizontal') ? -1 : 1) * (i == 0 ? -20 : 20) - - ndiff = this.getProp('horizontal')? - Math.abs(e.offsetX - coord) : - Math.abs(e.offsetY - coord) - - if (diff == -1 || ndiff < diff) { - id = i - diff = ndiff - } - - } - - this.touchMap[e.pointerId] = id - - - } else if (e.traversing) { - - id = this.touchMap[e.pointerId] - - } - - if (!id) return - - this.trigger('touch', {stopPropagation: true, touch: [parseInt(id), 1]}) - - for (var f of this.faders) { - f.percent = clip(f.percent,[ - f.valueToPercent(f.rangeValsMin), - f.valueToPercent(f.rangeValsMax) - ]) - } - - - e.stopPropagation = true - this.faders[id].trigger('draginit', e) - this.faders[id].touched = 1 - - } - - dragHandle(e) { - - var i = this.touchMap[e.pointerId] - - if (!i) return - - e.fingers = 1 // cancel multifinger inertia - - if (e.shiftKey) { - this.faders[0].trigger('drag', e) - this.faders[1].trigger('drag', e) - } else { - this.faders[i].trigger('drag', e) - } - - } - - dragendHandle(e) { - - var i = this.touchMap[e.pointerId] - - if (!i) return - - e.stopPropagation = true - this.faders[i].touched = 0 - this.faders[i].trigger('dragend', e) - - - this.trigger('touch', {stopPropagation: true, touch: [parseInt(i), 0]}) - - delete this.touchMap[e.pointerId] - - } - - setValue(v, options={}) { - - if (!this.faders) return // prevent Fader.constructor - if (!v || !v.length || v.length!=2) return - - this.faders[0].rangeValsMax = v[1] - this.faders[1].rangeValsMin = v[0] - - if (!options.dragged || options.fromScript) { - var opt = { - ...options, - send: false, - sync: false - } - this.faders[0].setValue(v[0], opt) - this.faders[1].setValue(v[1], opt) - } - this.value = [ - this.faders[0].getValue(), - this.faders[1].getValue() - ] - - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - this.batchDraw() - - } - - draw() { - - - var width = this.getProp('horizontal') ? this.height : this.width, - height = !this.getProp('horizontal') ? this.height : this.width, - fader = this.faders[0] - - var d = Math.round(fader.percentToCoord(fader.valueToPercent(this.faders[this.getProp('horizontal')?0:1].value))), - d2 = Math.round(fader.percentToCoord(fader.valueToPercent(this.faders[this.getProp('horizontal')?1:0].value))), - m = this.getProp('horizontal') ? this.height / 2 : this.width / 2, - dashed = this.dashed, - compact = this.getProp('design') === 'compact', - knobHeight = this.cssVars.knobSize, knobWidth = knobHeight * .6 - - this.clear() - - if (this.getProp('pips') && !compact) m -= 10 * PXSCALE - - // sharp border trick - if (compact) { - if (width % 2 && parseInt(m) === m) m -= 0.5 - } else { - if (width % 2 && parseInt(m) !== m) m -= 0.5 - } - - - this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill - - if (compact) { - this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2) - } else { - this.ctx.lineWidth = this.cssVars.lineWidth - } - - - if (dashed) this.ctx.setLineDash([PXSCALE * dashed[0], PXSCALE * dashed[1]]) - - - if (this.cssVars.alphaFillOff) { - // gaugo off - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.moveTo(m, height - this.gaugePadding) - this.ctx.lineTo(m, this.gaugePadding) - this.ctx.stroke() - } - - - if (this.cssVars.alphaFillOn) { - // gaugo on - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.moveTo(m, d) - this.ctx.lineTo(m, d2) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - if (compact) { - - // stroke - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - - this.ctx.beginPath() - this.ctx.moveTo(0, 0) - this.ctx.lineTo(width, 0) - this.ctx.lineTo(width, height) - this.ctx.lineTo(0, height) - this.ctx.closePath() - this.ctx.lineWidth = 2 * this.cssVars.lineWidth - this.ctx.stroke() - - - // flat knob - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding - this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight) - this.ctx.fill() - - // extra knob - this.ctx.beginPath() - d2 = (d2 - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding - this.ctx.rect(this.gaugePadding, d2, width - this.gaugePadding * 2, knobHeight) - this.ctx.fill() - - - this.clearRect = [0, 0, width, height] - - - } else if (this.getProp('design') === 'default') { - - for (let _d of [d, d2]) { - - if (this.cssVars.alphaStroke) { - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorBg - - this.ctx.beginPath() - this.ctx.rect(m - knobWidth / 2, _d - knobHeight / 2, knobWidth, knobHeight) - this.ctx.fill() - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = PXSCALE - - this.ctx.beginPath() - this.ctx.rect(m - knobWidth / 2 + 0.5 * PXSCALE, _d - knobHeight / 2 + 0.5 * PXSCALE, knobWidth - PXSCALE, knobHeight - PXSCALE) - this.ctx.stroke() - - } - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.rect(m - knobWidth / 6, _d, knobWidth / 3, PXSCALE) - this.ctx.fill() - - } - - this.clearRect = [m - knobWidth / 2 - PXSCALE, this.gaugePadding - knobHeight / 2 - PXSCALE, knobWidth + 2 * PXSCALE, height - 2 * this.gaugePadding + knobHeight + 2 * PXSCALE] - - } else { - - this.ctx.globalAlpha = 1 - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(m, d, knobHeight / 6, 0, 2 * Math.PI) - this.ctx.fill() - - // extra knob - this.ctx.beginPath() - this.ctx.arc(m, d2, knobHeight / 6, 0, 2 * Math.PI) - this.ctx.fill() - - - if (this.cssVars.alphaStroke) { - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(m, d, knobHeight / 2, 0, 2 * Math.PI) - this.ctx.fill() - - // extra knob - this.ctx.beginPath() - this.ctx.arc(m, d2, knobHeight / 2, 0, 2 * Math.PI) - this.ctx.fill() - } - - this.clearRect = [m - knobHeight / 2 - PXSCALE, this.gaugePadding - knobHeight / 2 - PXSCALE, knobHeight + 2 * PXSCALE, height - 2 * this.gaugePadding + knobHeight + 2 * PXSCALE] - - } - - if (this.shouldDrawPips) { - this.drawPips() - this.shouldDrawPips = false - } - - if (this.pips && this.pips.width && this.pips.height) { - this.ctx.globalAlpha = 1 - this.ctx.drawImage(this.pips, 0, 0) - if (!compact) this.clearRect = [this.clearRect, [m + knobWidth / 2, 0, 12 * PXSCALE + this.pipsTextSize, height]] - } - - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - if (rangePassedProps.includes(propName)) { - for (var f of this.faders) { - f.onPropChanged(...arguments) - } - } - - } - - onRemove() { - - this.faders[0].onRemove() - this.faders[1].onRemove() - super.onRemove() - - } - -} - -export default Range diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs deleted file mode 100644 index e3dafd9f..00000000 --- a/src/client/widgets/sliders/scrollbar.mjs +++ /dev/null @@ -1,350 +0,0 @@ -import fastdom from 'fastdom' -import Fader from './fader.mjs' -import StaticProperties from '../mixins/static_properties.mjs' -import {clip} from '../utils.mjs' -import widgetManager from '../../managers/widgets.mjs' -import {PXSCALE} from '../../globals.mjs' - -export default class Scrollbar extends StaticProperties(Fader, { - range: {min: 0, max: 1}, - touchZone: 'all', - snap: false, - design: 'compact', - sensitivity: 1 -}) { - - static defaults() { - - return super.defaults().extend({ - style: { - _separator_fader_style: 'Scrollbar style', - design: null, - knobSize: null, - pips: null, - }, - class_specific: { - snap: null, - touchZone: null, - spring: null, - doubleTap: null, - range: null, - logScale: null, - steps: null, - origin: null, - sensitivity: null, - widgetId: {type: 'string', value: '', help: '`id` of the container widget to control'}, - } - }) - - } - - constructor(options) { - - super(options) - - this.scrollTarget = null - this.targetRank = null - this.thumbSize = 1 - - if (!this.getProp('horizontal')) { - // invert vertical fader - this.rangeVals[0] = 1 - this.rangeVals[1] = 0 - this.setValue(this.getSpringValue()) - } - - - widgetManager.on('widget-created', (e)=>{ - - // if in a non-scoped context we don't watch for a closer target once we have one - if (!this.scopes.length && this.scrollTarget) return - - var {id, widget} = e - if (id.includes(this.getProp('widgetId')) && widget.getProp('scroll')) { - - this.getScrollTarget() - } - - }, {context: this}) - - this.getScrollTarget() - - } - - getScrollTarget() { - - var scopes = this.scopes.length ? this.scopes : [''], - target = null, - rank = 0 - - for (var scope of scopes) { - var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) - .filter(w=>w.getProp('scroll')) - target = widgets[0] - - if (!target) { - rank++ - continue - } - - if (rank < this.targetRank || this.targetRank == null) { - this.unbindTarget() - this.bindTarget(target, rank) - } - - return - - } - - } - - draginitHandle(e) { - - // super.draginitHandle(...arguments) - - if (!e.traversing && !this.shouldDrag(e)) { - e.cancelDragEvent = true - return - } - - this.percent = clip(this.percent,[0,100]) - - // snap when not touching the knob zone - if (this.shouldDrag(e, 'knob')) return - - this.percent = this.getProp('horizontal')? - (e.offsetX - this.gaugePadding) / (this.width - this.gaugePadding * 2) * 100: - (this.height - e.offsetY - this.gaugePadding) / (this.height - this.gaugePadding * 2) * 100 - - this.setValue(this.percentToValue(this.percent), {send: true, sync: true, dragged: true}) - - } - - - mousewheelHandle(e) { - - e.preventDefault() - e.stopPropagation() - - if (!this.scrollTarget) return - - var increment - if (this.getProp('horizontal')) { - increment = e.deltaY / this.scrollTarget.scrollWidth * 100 - } else { - increment = -e.deltaY / this.scrollTarget.scrollHeight * 100 - } - - this.percent = clip(this.percent + increment, [0,100]) - this.setValue(this.percentToValue(this.percent), {sync: true, send: true, dragged: true}) - - } - - cacheCanvasStyle(style){ - - super.cacheCanvasStyle(style) - - var size = this.getProp('horizontal') ? this.width : this.height - this.cssVars.knobSize = Math.max(this.thumbSize * size, 30) - this.cssVars.alphaKnob = 0.25 - - } - - - unbindTarget() { - - if (!this.scrollTarget) return - - this.scrollTarget.off(undefined, undefined, this) - - this.scrollTarget = null - this.targetRank = null - } - - bindTarget(target, rank) { - - if (!target) return - - this.scrollTarget = target - this.targetRank = rank - - this.scrollTarget.on('widget-removed', (e)=>{ - if (this.scrollTarget === e.widget) { - this.unbindTarget() - } - }, {context: this}) - - fastdom.measure(()=>{ - if (!this.scrollTarget) return - this.scrollTarget.on('scroll', this.targetScroll.bind(this)) - this.scrollTarget.on('resize', ()=>{ - if (this.scrollTarget) { - this.scrollTarget.trigger('scroll', {}) - this.targetScroll({}, true) - } - }, {element: this.scrollTarget.widget}) - this.targetScroll({}, true) - }) - - } - - targetScroll(e, init) { - - if (!this.scrollTarget || (e && e.locked)) return - - var index = this.getProp('horizontal') ? 0 : 1, - size = this.getProp('horizontal') ? this.width : this.height - - this.thumbSize = this.scrollTarget.scrollThumb[index] - this.cssVars.knobSize = Math.max(this.thumbSize * size, 30) - - if (init && this.value) { - // panel (re)createed: restore scroll state - this.setValue(this.value, {fromScrollEvent: false, send: false, sync: false}) - } else if (this.scrollTarget.scroll[index] != this.value) { - // panel scrolling: update scroll state - this.setValue(this.scrollTarget.scroll[index], {fromScrollEvent: true, send: !init, sync: !init}) - } - - } - - - setValue(v, options={}) { - - super.setValue(v, options) - - if (!options.fromScrollEvent && this.scrollTarget) { - if (this.getProp('horizontal')) { - this.scrollTarget.setScroll(this.value, undefined, true) - } else { - this.scrollTarget.setScroll(undefined, this.value, true) - } - } - - } - - draw() { - - var width = this.getProp('horizontal') ? this.height : this.width, - height = !this.getProp('horizontal') ? this.height : this.width - - var percent = this.steps ? this.valueToPercent(this.value) : this.percent, - d = Math.round(this.percentToCoord(percent)), - m = this.getProp('horizontal') ? this.height / 2 : this.width / 2, - dashed = this.dashed, - knobHeight = this.cssVars.knobSize - - this.clear() - - // sharp border trick - if (width % 2 && parseInt(m) === m) m -= 0.5 - - - this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill - - this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2) - - - if (dashed) this.ctx.setLineDash([PXSCALE * dashed[0], PXSCALE * dashed[1]]) - - - if (this.cssVars.alphaFillOff) { - // gaugo off - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.moveTo(m, height - this.gaugePadding) - this.ctx.lineTo(m, this.gaugePadding) - this.ctx.stroke() - } - - - if (dashed) this.ctx.setLineDash([]) - - // flat knob - - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - // adjust position to keep knob within gauge boundaries - d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding - if (this.cssVars.borderRadius > 0 && this.ctx.roundRect) { - this.ctx.roundRect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight, PXSCALE * this.cssVars.borderRadius) - } else { - this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight) - } - this.ctx.fill() - - let x, y, w, h, - rad = PXSCALE * this.cssVars.borderRadius - - // border radius: clip gauge & knob - if (rad > 0) { - rad = Math.min(Math.min(height, width) / 2, rad) - x = this.gaugePadding - y = this.gaugePadding - w = width - this.gaugePadding * 2 - h = height - this.gaugePadding * 2 - this.ctx.beginPath() - this.ctx.moveTo(x + rad, y) - this.ctx.arcTo(x + w, y, x + w, y + h, rad) - this.ctx.arcTo(x + w, y + h, x, y + h, rad) - this.ctx.arcTo(x, y + h, x, y, rad) - this.ctx.arcTo(x, y, x + w, y, rad) - this.ctx.closePath() - - var tmpOp = this.ctx.globalCompositeOperation - this.ctx.globalCompositeOperation = 'destination-in' - this.ctx.fillStyle = '#ffffff' - this.ctx.globalAlpha = 1 - this.ctx.fill() - this.ctx.globalCompositeOperation = tmpOp - } - - // stroke - if (this.cssVars.lineWidth) { - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - - // draw stroke - x = 0.5 * this.cssVars.lineWidth - y = 0.5 * this.cssVars.lineWidth - w = width - this.cssVars.lineWidth - h = height - this.cssVars.lineWidth - - this.ctx.beginPath() - if (rad > 0) { - this.ctx.moveTo(x + rad, y) - this.ctx.arcTo(x + w, y, x + w, y + h, rad) - this.ctx.arcTo(x + w, y + h, x, y + h, rad) - this.ctx.arcTo(x, y + h, x, y, rad) - this.ctx.arcTo(x, y, x + w, y, rad) - } else { - this.ctx.moveTo(x, y) - this.ctx.lineTo(x + w, y) - this.ctx.lineTo(x + w, y + h) - this.ctx.lineTo(x, y + h) - } - - this.ctx.closePath() - this.ctx.lineWidth = this.cssVars.lineWidth - this.ctx.stroke() - - } - - - - this.clearRect = [0, 0, width, height] - - - } - - onRemove(){ - - this.unbindTarget() - super.onRemove() - - } - -} diff --git a/src/client/widgets/sliders/slider.mjs b/src/client/widgets/sliders/slider.mjs deleted file mode 100644 index e3ac837f..00000000 --- a/src/client/widgets/sliders/slider.mjs +++ /dev/null @@ -1,320 +0,0 @@ -import html from 'nanohtml' -import {clip, mapToScale} from '../utils.mjs' -import Canvas from '../common/canvas.mjs' -import touchstate from '../mixins/touch_state.mjs' -import doubleTap from '../mixins/double_tap' - -class Slider extends Canvas { - - constructor(options) { - - super({...options, html: html` - - `}) - - this.container.classList.add('design-' + this.getProp('design')) - - this.percent = 0 - - this.gaugePadding = 0 - - this.rangeKeys = Object.keys(this.getProp('range')).sort((a,b)=>{ - if (a === 'min' || b === 'max') return -1 - else if (a === 'max' || b === 'min') return 1 - else return parseFloat(a) - parseFloat(b) - }) - this.rangeVals = [] - this.rangeLabels = [] - - for (var i in this.rangeKeys) { - var k = this.rangeKeys[i], - key = k == 'min' ? 0 : k == 'max' ? 100 : parseFloat(k), - val = typeof this.getProp('range')[k] === 'object' && this.getProp('range')[k] !== null ? - this.getProp('range')[k][Object.keys(this.getProp('range')[k])[0]]: - this.getProp('range')[k] - - if (isNaN(val) || val === null || val === undefined) val = 0 - - var label = typeof this.getProp('range')[k] === 'object' && this.getProp('range')[k] !== null ? - Object.keys(this.getProp('range')[k])[0]: - val - - if (Math.abs(label) >= 1000) label = Math.round(label / 1000) + 'k' - - this.rangeKeys[i] = key - this.rangeVals.push(val) - this.rangeLabels.push(label) - } - - this.rangeValsMax = Math.max(...this.rangeVals), - this.rangeValsMin = Math.min(...this.rangeVals) - - this.originValue = this.getProp('origin')=='auto'? - this.rangeValsMin: - clip(this.getProp('origin'), [this.rangeValsMin,this.rangeValsMax]) - - if (this.getProp('doubleTap')) { - - if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') { - - doubleTap(this, (e)=>{ - if (!this.shouldDrag(e)) return - this.sendValue({v:null, address: this.getProp('doubleTap')}) - }, {element: this.widget}) - - } - if (this.getProp('doubleTap') == 'script') { - - doubleTap(this, (e)=>{ - if (!this.shouldDrag(e)) return - this.scripts.onTouch.run({ - event: {type: 'doubleTap'}, - value: this.value - }, {sync: true, send: true}) - }, {element: this.widget}) - - - } else { - - doubleTap(this, (e)=>{ - if (!this.shouldDrag(e)) return - this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true, doubleTap:true}) - }, {element: this.widget}) - - } - - } - - - touchstate(this, {element: this.widget, multitouch: options.multitouch}) - - this.on('draginit', this.draginitHandleProxy.bind(this), {element:this.widget, multitouch: options.multitouch}) - this.on('drag', this.dragHandleProxy.bind(this), {element:this.widget, multitouch: options.multitouch}) - this.on('dragend', this.dragendHandleProxy.bind(this), {element:this.widget, multitouch: options.multitouch}) - this.on('wheel',this.mousewheelHandleProxy.bind(this), {element: this.widget}) - - this.steps = null - this.setSteps() - - this.setValue(this.getSpringValue()) - - } - - shouldDrag(e) { - - return true - - } - - mousewheelHandleProxy() { - - this.mousewheelHandle(...arguments) - - } - - draginitHandleProxy() { - - this.draginitHandle(...arguments) - - } - - dragHandleProxy() { - - this.dragHandle(...arguments) - - } - - dragendHandleProxy() { - - this.dragendHandle(...arguments) - - } - - mousewheelHandle(e) { - - if (e.deltaX || this.getProp('spring') || !this.shouldDrag(e)) return - - e.preventDefault() - e.stopPropagation() - - var direction = e.deltaY > 0 ? -1 : 1, - increment = e.ctrlKey ? 0.25 : 1 - - if (this.steps) { - var i = this.steps.indexOf(this.value), - val - if (i === -1) { - val = this.steps.reduce((a, b) => { - let aDiff = Math.abs(a - this.value), - bDiff = Math.abs(b - this.value) - - if (aDiff == bDiff) { - return (direction ? a > b : b > a) ? a : b - } else { - return bDiff < aDiff && ((b - this.value) > 0 != e.deltaY > 0)? b : a - } - }) - } - else if (i < this.steps.length) { - val = this.steps[i + direction] - } - if (val !== undefined) this.setValue(val, {sync: true, send: true, fromLocal: true}) - } else { - this.percent = clip(this.percent + Math.max(increment,10/Math.pow(10,this.decimals + 1)) * direction, [0,100]) - this.setValue(this.percentToValue(this.percent), {sync: true, send: true, dragged: true}) - } - - } - - draginitHandle(e, data, traversing) { - - } - - dragHandle(e, data, traversing) { - - } - - dragendHandle(e, data, traversing) { - - if (this.getProp('spring')) { - this.setValue(this.getSpringValue(),{sync:true,send:true,fromLocal:true}) - } - - } - - cacheCanvasStyle(style) { - - super.cacheCanvasStyle(style) - - this.gaugePadding = this.cssVars.padding + this.cssVars.lineWidth - - } - - - - getSpringValue() { - - return this.getProp('default') !== '' ? this.getProp('default') : this.originValue - - } - - - percentToValue(percent) { - - var h = clip(percent,[0,100]) - for (var i=0;i= this.rangeKeys[i]) { - return mapToScale(h, [this.rangeKeys[i], this.rangeKeys[i + 1]], [this.rangeVals[i], this.rangeVals[i + 1]], -1, this.getProp('logScale')) - } - } - - } - - valueToPercent(value) { - - for (var i=0;i this.rangeVals[i] && value <= this.rangeVals[i+1] && value >= this.rangeVals[i]) || - (this.rangeVals[i+1] < this.rangeVals[i] && value >= this.rangeVals[i+1] && value <= this.rangeVals[i]) - ) { - return mapToScale(value, [this.rangeVals[i], this.rangeVals[i + 1]], [this.rangeKeys[i], this.rangeKeys[i + 1]], -1, this.getProp('logScale'), true) - } - } - - } - - setValue(v,options={}) { - - if (typeof v != 'number') return - if ( - this.touched && - !options.dragged && - !options.doubleTap && - options.fromScript !== this.hash - ) return this.setValueTouchedQueue = [v, options] - - var value = clip(v,[this.rangeValsMin,this.rangeValsMax]) - - if ((options.dragged || options.fromLocal) && this.value.toFixed(this.decimals) == value.toFixed(this.decimals)) options.send = false - - this.value = value - - if (this.steps) { - - var diff = this.steps.map(x => Math.abs(x - this.value)), - index = diff.indexOf(Math.min(...diff)), - val = this.steps[index] - - if (!isNaN(val)) this.value = clip(val, [this.rangeValsMin,this.rangeValsMax]) - - } - - if (!options.dragged || options.fromScript) this.percent = this.valueToPercent(this.value) - - this.batchDraw() - - if (options.send) this.sendValue() - if (options.sync) this.changed(options) - - } - - setSteps() { - - if (this.getProp('steps')) { - var steps = this.getProp('steps') - if (steps === 'auto') { - this.steps = this.rangeVals - } else if (typeof steps === 'number' && Math.round(steps) > 0) { - steps = Math.round(steps) - this.steps = Array(steps).fill(0).map((x, i) => i / (steps - 1) * (this.rangeValsMax - this.rangeValsMin) + this.rangeValsMin) - } else if (Array.isArray(steps) && steps.every(x=>typeof x === 'number')) { - this.steps = steps - } else { - this.steps = null - } - } else { - this.steps = null - } - - } - - onPropChanged(propName, options, oldPropValue) { - - if (super.onPropChanged(...arguments)) return true - - switch (propName) { - - case 'steps': - this.setSteps() - return - case 'spring': - if (this.getProp('spring') && !this.touched) this.setValue(this.getSpringValue(), {...options}) - return - case 'colorKnob': - case 'knobSize': - this.setCssVariables() - return - - } - - } - - onRemove() { - - super.onRemove() - - } - -} - -Slider.dynamicProps = Slider.prototype.constructor.dynamicProps - .concat([ - 'steps', - 'spring', - 'sensitivity', - 'default', - 'colorKnob', - 'knobSize' - ]) - -export default Slider diff --git a/src/client/widgets/utils.mjs b/src/client/widgets/utils.mjs deleted file mode 100644 index 62482c86..00000000 --- a/src/client/widgets/utils.mjs +++ /dev/null @@ -1,156 +0,0 @@ -import balanced from 'balanced-match' - -export function clip(value,range) { - - value = parseFloat(value) - - if (isNaN(value)) value = range[0] - - return Math.max(Math.min(range[0], range[1]), Math.min(value, Math.max(range[0], range[1]))) - -} - -// map a value from a scale to another -// value: number -// rangeIn: [number, number] -// rangeOut: [number, number] -// decimals: number (-1 to bypass) -// log: true, or manual log scale (max log value) -// revertLog: boolean -export function mapToScale(value, rangeIn, rangeOut, decimals, log, revertlog, noClip) { - - // clip in - if (!noClip) { - value = clip(value,[rangeIn[0], rangeIn[1]]) - } - - - // normalize - value = (value - rangeIn[0]) / (rangeIn[1] - rangeIn[0]) - - // log scale - if (log) { - - var logScale = revertlog ? Math.abs(rangeIn[1] - rangeIn[0]) : - Math.abs(rangeOut[1] - rangeOut[0]) - - if (log !== true && log !== -1) logScale = Math.abs(log) - else if (logScale >= 100) logScale /= 10 - else logScale = Math.max(logScale, 10) - - if (log < 0) revertlog = !revertlog - - value = revertlog ? - Math.log(value * (logScale - 1) + 1) / Math.log(logScale) : - Math.pow(logScale, value) / (logScale - 1) - 1 / (logScale - 1) - - } - - // scale out - value = value * (rangeOut[1] - rangeOut[0]) + rangeOut[0] - - // clip out - if (!noClip) { - value = clip(value, [rangeOut[0], rangeOut[1]]) - } - - // decimals - if (decimals !== -1) value = parseFloat(value.toFixed(decimals)) - - return value - -} - -export function hsbToRgb(hsb) { - var rgb = {} - var h = hsb.h - var s = hsb.s*255/100 - var v = hsb.b*255/100 - if(s == 0) { - rgb.r = rgb.g = rgb.b = v - } else { - var t1 = v - var t2 = (255-s)*v/255 - var t3 = (t1-t2)*(h%60)/60 - if(h==360) h = 0 - if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} - else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} - else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} - else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} - else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} - else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} - else {rgb.r=0; rgb.g=0; rgb.b=0} - } - return rgb -} - -export function rgbToHsb(rgb) { - var hsb = {h: 0, s: 0, b: 0} - var min = Math.min(rgb.r, rgb.g, rgb.b) - var max = Math.max(rgb.r, rgb.g, rgb.b) - var delta = max - min - hsb.b = max - hsb.s = max != 0 ? 255 * delta / max : 0 - if (hsb.s != 0) { - if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta - else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta - else hsb.h = 4 + (rgb.r - rgb.g) / delta - } else hsb.h = 0 - hsb.h *= 60 - if (hsb.h < 0) hsb.h += 360 - hsb.s *= 100/255 - hsb.b *= 100/255 - return hsb -} - - -var urlParser = (()=>{ - - var parser = document.createElement('a'), - localUrlRe = /(^127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.1[6-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.2[0-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.3[0-1]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^192\.168\.[0-9]{1,3}\.[0-9]{1,3}$)/ - - parser.isLocal = ()=>{ - return parser.hostname.match(localUrlRe) - } - - return (url)=>{ - parser.href = url - return parser - } - -})() - -export {urlParser} - -export function balancedReplace(tag, open, close, string, replacement) { - - var start, lastStart = -1 - - while ((start = string.indexOf(tag + open)) >= 0 && lastStart !== start) { - - var substring = string.slice(start + tag.length), - b = balanced(open, close, substring) - - if (b) { - - if (typeof replacement === 'function') { - - substring = b.pre + replacement(b.body) + b.post - - } else { - - substring = b.pre + replacement + b.post - - } - - string = string.slice(0, start) + substring - - } - - lastStart = start - - } - - return string - -} diff --git a/src/client/widgets/vm.mjs b/src/client/widgets/vm.mjs deleted file mode 100644 index 389dceaa..00000000 --- a/src/client/widgets/vm.mjs +++ /dev/null @@ -1,152 +0,0 @@ -import {deepCopy} from '../utils.mjs' -import {ENV, IP} from '../globals.mjs' - -var sessionManager -setTimeout(async()=>{ - // use setTimeout to fix init order in safari... - sessionManager = (await import('../managers/session/index.mjs')).default -}) - - -var globals - -class Vm { - - constructor() { - - this.widget = [] - - if (!globals) { - globals = { - screen: { - get width() {return screen.width}, - get height() {return screen.height}, - get orientation() { - return (screen.orientation || {}).type || window.orientation - } - }, - env: deepCopy(ENV), - ip: IP, - url: document.location.host, - platform: navigator.platform, - clipboard: navigator.clipboard, - get session() { - return sessionManager.sessionPath - } - } - } - - this.sandbox = document.createElement('iframe') - this.sandbox.style.display = 'none' - this.sandbox.sandbox = 'allow-same-origin' - - // attach sandbox - document.documentElement.appendChild(this.sandbox) - - // sandboxed function prototype - this.safeFunctionProto = this.sandbox.contentWindow.Function - - // block requests - this.sandbox.contentWindow.document.open() - this.sandbox.contentWindow.document.write('') - this.sandbox.contentWindow.document.close() - - // global context - this.globals = {} - this.globals.console = { - ...console, - log: (...msg)=>{ - msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m, this.jsonReplacer) : m) - this.getWidget().log(msg.join(' ')) - } - } - - this.globals.setTimeout = - this.globals.setInterval = ()=>{ - throw 'setTimeout and setInterval can\'t be used in the JS sandbox' - } - - this.registerGlobals() - - // detach sandbox - document.documentElement.removeChild(this.sandbox) - - } - - setWidget(widget) { - - if (!widget) this.widget.pop() - else this.widget.push(widget) - - } - - getWidget() { - - return this.widget[this.widget.length - 1] - - } - - registerGlobals() { - - this.globals.globals = globals - - for (var k in this.globals) { - this.sandbox.contentWindow[k] = this.globals[k] - } - - } - - compile(code, defaultContext) { - - if (typeof code !== 'string') code = String(code) - - // var contextInit = 'var locals = locals;', - var contextInit = '"use strict";', - contextKeys = ['__VARS'], - contextValues = [{}] - - // detached context + reading global navigator == crash electron - if (code.indexOf('navigator') !== -1) { - contextInit += 'var navigator;' - } - - if (defaultContext) { - for (var k in defaultContext) { - contextInit += `var ${k} = ${k} === undefined ? ${JSON.stringify(defaultContext[k])} : ${k};` - contextKeys.push(k) - contextValues.push(defaultContext[k]) - } - } - - code = contextInit + code.replace(/(VAR_[0-9]+)/g, '__VARS.$1') - - var compiledCode = new this.safeFunctionProto(...contextKeys, 'locals', code) - - return (context, locals)=>{ - - var __contextValues = deepCopy(contextValues) - var __VARS = __contextValues[0] - for (var k in context) { - var index = contextKeys.indexOf(k) - if (index !== -1) { - __contextValues[index] = context[k] - } else { - __VARS[k] = context[k] - } - } - - __contextValues.push(locals) - - return compiledCode.apply('this', __contextValues) - - } - - } - - jsonReplacer(key, value) { - return value instanceof HTMLElement ? `<${value.tagName}#${value.id}>` : value - } - -} - -export default Vm diff --git a/src/docs/widgets-reference.mjs b/src/docs/widgets-reference.mjs deleted file mode 100644 index d4178ff3..00000000 --- a/src/docs/widgets-reference.mjs +++ /dev/null @@ -1,120 +0,0 @@ -import './client-shim.mjs' -import baseClass from '../client/widgets/common/widget.mjs' -import * as widgets from '../client/widgets/index.mjs' - -// Here we go -var base = baseClass.defaults(), - doc = [''] - - -doc.push(` - -## Common - -??? api "
          Generic properties#
          " - Properties shared by all widgets - - ` -) - -for (let categoryName in base) { - doc.push(`\n - - === "${categoryName}" - - | property | type |default | description | - | --- | --- | --- | --- |` - ) - let notEmpty = false - - for (let propName in base[categoryName]) { - - let prop = base[categoryName][propName], - permalink = propName - - if (propName === '_props' || propName[0] === '_') continue - - let help = Array.isArray(prop.help) ? prop.help.join('

          ').replace(/-/g, '-') : prop.help || '', - dynamic = baseClass.dynamicProps.includes(propName) ? '' : '' - - if (prop.choices) { - if (help) help += '

          ' - help += 'Choices: ' + prop.choices.map(x=>'`' + x + '`').join(', ') - } - - doc.push(` - |
          ${propName}${dynamic}#
          | \`${prop.type.replace(/\|/g,'\`|
          \`')}\` | ${(JSON.stringify(prop.value, null, ' ') || '').replace(/\n/g,'
          ').replace('{','\\{')}
          | ${help} |` - ) - notEmpty = true - - } - if (!notEmpty) doc.pop() - -} - -for (var k in widgets.categories) { - var category = widgets.categories[k] - if (k == 'Containers') { - category.push('root') - category.push('tab') - } - - doc.push(` -## ${k}` - ) - - for (var kk in category) { - var type = category[kk], - defaults = widgets.widgets[type].defaults(), - description = widgets.widgets[type].description() - - doc.push(` - -??? api "
          ${type}#
          " - ${description}` - - ) - - for (let categoryName in defaults) { - doc.push(`\n - === "${categoryName == 'class_specific' ? type : categoryName}" - - | property | type |default | description | - | --- | --- | --- | --- |` - ) - let notEmpty = false - - for (let propName in defaults[categoryName]) { - - let prop = defaults[categoryName][propName], - permalink = type + '_' + propName - - - if (propName === '_props' || propName[0] === '_' || JSON.stringify(prop) == JSON.stringify((base[categoryName]||{})[propName])) continue - - let help = Array.isArray(prop.help) ? prop.help.join('

          ').replace(/-/g, '-') : prop.help || '', - dynamic = widgets.widgets[type].dynamicProps.includes(propName) ? '' : '' - - if (prop.choices) { - if (help) help += '

          ' - help += 'Choices: ' + prop.choices.map(x=>'`' + x + '`').join(', ') - } - doc.push(` - |
          ${propName}${dynamic}#
          | \`${prop.type.replace(/\|/g,'\`|
          \`')}\` | ${(JSON.stringify(prop.value, null, ' ') || '').replace(/\n/g,'
          ').replace('{','\\{')}
          | ${help} |` - ) - notEmpty = true - } - - if (!notEmpty) doc.pop() - - - - } - - - } -} - -console.log(doc.join('')) - -process.exit(0) // avoid setTimeout errors in required modules diff --git a/src/html/client.html b/src/html/client.html deleted file mode 100644 index 48ea3ece..00000000 --- a/src/html/client.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          -
          - - - - -
          - - - ${productName} v${version} - - - - -
          -
          - - - - -
          - -
          - - -
          -
          - - - - -
          - - -
          -
          - - - diff --git a/src/html/launcher.html b/src/html/launcher.html deleted file mode 100644 index 6945d250..00000000 --- a/src/html/launcher.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 3680c66b..00000000 --- a/src/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./server/') diff --git a/src/launcher/index.js b/src/launcher/index.js new file mode 100644 index 00000000..f9ef8d01 --- /dev/null +++ b/src/launcher/index.js @@ -0,0 +1,334 @@ +var {remote, ipcRenderer, shell} = eval('require(\'electron\')'), + {dialog, Menu, MenuItem} = remote.require('electron'), + menu = new Menu(), + settings = remote.getGlobal('settings'), + midilist = remote.getGlobal('midilist'), + packageInfos = remote.require('./package.json'), + packageVersion = packageInfos.version, + packageUrl = packageInfos.repository.url, + argv_remote = settings.read('argv'), + ansiHTML = require('ansi-html'), + argv = {}, + $ = require('jquery/dist/jquery.slim.min.js'), + TERMINAL_LENGTH = 400 + +for (i in argv_remote) { + argv[i] = argv_remote[i] +} + +$(document).ready(()=>{ + + var form = $(` +
          +
          Open Stage Control (v${packageVersion}) + + `) + + $.each(settings.options, (i, option)=>{ + + if (option.launcher === false) return + + var name = option.alias || i, + value = (argv[name] == undefined ? '' : argv[name]) || (argv[i] == undefined ? '' : argv[i]), // compat fix for 0.34.2 , + wrapper = $('
          '), + item = $(` +
          + +
          + `).appendTo(wrapper), + input, + cancel + + delete argv[i] // compat fix for 0.34.2 + + var strValue + if (Array.isArray(value)) { + strValue = value.map(x=>x.includes(' ') ? '"'+x+'"' : x).join(' ') + } else { + strValue = value + } + + input = $(``) + input.val(strValue) + + if (option.type == 'boolean') { + + var toggle = $(``) + toggle.appendTo(item) + + toggle.click(function(e){ + e.preventDefault() + input.val(!eval(input.val())).trigger('change') + toggle.toggleClass('on') + }) + + } + + if (option.file) { + + var browse = $('...') + browse.appendTo(item) + + browse.click(function(e){ + e.preventDefault() + dialog.showOpenDialog({ + filters:[{name:option.file.name,extensions:option.file.extensions}], + properties: option.file.folder ? ['openDirectory'] : ['openFile'] + }).then((file)=>{ + input.val(file.filePaths).change() + }) + }) + + } + + + + input.appendTo(item) + + input.on('change',function(e,stop){ + + var v = $(this).val().trim(), + fail = false + + try { + if (option.type == 'boolean') { + v = v == 'true' ? true : '' + input.val(v) + } else if (v && option.type == 'array'){ + v = v.replace(/("[^"]*"|'[^']*')/g, (m)=>{ + return m.substr(1, m.length - 2).replace(/\s/, '_SPaCE_') + }) + v = v.split(' ') + v = v.map(x=>x.replace(/_SPaCE_/g, ' ')) + } else if (v && option.type == 'number'){ + v = parseFloat(v) + } + } catch (err) { + fail = err + } + + if (fail || v !== '' && option.check && option.check(v, argv) !== true) { + wrapper.addClass('error') + wrapper.find('.error-msg').remove() + wrapper.append(`
          ${fail || option.check(v, argv )}
          `) + } else { + wrapper.removeClass('error') + wrapper.find('.error-msg').remove() + argv[name] = v + } + + if (option.restart && v!=value && !wrapper.hasClass('restart')) { + wrapper.addClass('restart') + wrapper.append('
          The app must be restarted for this change to take effect.
          ') + } else if (option.restart && wrapper.hasClass('restart')) { + wrapper.removeClass('restart') + wrapper.find('.restart-msg').remove() + } + + if (!stop) $('input').not(input).trigger('change',true) + }) + + cancel = $('
          ') + cancel.click((e)=>{ + e.preventDefault() + if (option.type == 'boolean') { + input.val('false') + } else { + input.val('') + } + input.trigger('change') + }) + cancel.appendTo(item) + + form.append(wrapper) + + }) + + + var save = $('
          Save
          ').appendTo(form), + saveWithCallback = function(callback) { + $('input').change() + if (form.find('.error').length) return + + setTimeout(()=>{ + + for (i in argv) { + if (argv[i] === '') { + argv[i] = undefined + } + } + try { + settings.makeDefaultConfig(argv) + settings.write('argv',argv) + save.addClass('saved') + setTimeout(()=>{ + save.removeClass('saved') + }, 250) + if (callback) callback() + } catch (err) { + + } + + },1) + } + + save.click((e)=>{ + + e.preventDefault() + saveWithCallback() + + }) + + // Starter (oneshot) + + var start = $('
          Start
          ').appendTo(form) + start.click((e)=>{ + + e.preventDefault() + saveWithCallback(()=>{ + start.off('click') + save.off('click') + $('input').attr('disabled','true') + $('.clear').addClass('disabled') + $('.checkbox').addClass('disabled') + ipcRenderer.send('start') + }) + + }) + + form.appendTo('body') + + + // scroll to bottom for multiple electron versions + function scrollBottom() { + document.body.scrollTop = document.body.offsetHeight + document.body.scrollHeight + document.documentElement.scrollTop = document.documentElement.offsetHeight + document.documentElement.scrollHeight + } + + // server started callback + ipcRenderer.on('started',function(){ + start.remove() + save.remove() + terminal.show() + scrollBottom() + }) + + // Fake console + var terminal = $('
          ').appendTo(form).hide(), + autoscroll = true + + + ipcRenderer.on('stdout', function(e, msg){ + terminal.append(`
          ${ansiHTML(msg)}
          `) + if (autoscroll) scrollBottom() + }) + + ipcRenderer.on('stderr', function(e, msg){ + terminal.append(`
          ${ansiHTML(msg)}
          `) + if (autoscroll) scrollBottom() + }) + + + function purgeTerminal(){ + var len = terminal.children().length + if (len > TERMINAL_LENGTH) { + var children = terminal.children() + for (var i = 0; i < len - TERMINAL_LENGTH; i++){ + children[i].remove() + } + } + } + + setInterval(purgeTerminal, 2000) + + // context-menu + + menu.append(new MenuItem({role: 'copy'})) + menu.append(new MenuItem({role: 'paste'})) + menu.append(new MenuItem({type: 'submenu' , label: 'Midi', submenu: [ + new MenuItem({ + label: 'List Devices', + click: ()=>{ + settings.write('midi', argv.midi) + terminal.show() + midilist() + } + }), + ]})) + menu.append(new MenuItem({type: 'submenu' , label: 'Console', submenu: [ + new MenuItem({ + label: 'Clear', + click: ()=>{ + terminal.empty() + } + }), + new MenuItem({ + label: 'Autoscroll', + type: 'checkbox', + checked: true, + click: function(e){ + autoscroll = e.checked + } + }) + ]})) + // not working currently + // menu.append(new MenuItem({type: 'submenu' , label: 'App', submenu: [ + // new MenuItem({ + // label: 'Relaunch', + // click: ()=>{ + // app.relaunch() + // app.exit(0) + // } + // }), + // ]})) + + + window.addEventListener('contextmenu', function(e) { + menu.items[0].enabled = !!window.getSelection().toString() + menu.items[1].enabled = $(e.target).is('input:not([disabled])') + menu.popup({ window: remote.getCurrentWindow(), x: e.pageX, y: e.pageY - (document.body.scrollTop || document.documentElement.scrollTop) }) + }, false) + + + // ready + + $('input').trigger('change') + + + $('#loading').remove() + setTimeout(()=>{ + form.addClass('loaded') + },0) + + + // open links in system's browser + $(document).click((e)=>{ + var url = $(e.target).attr('href') + if (url) { + e.preventDefault() + shell.openExternal(url) + } + }) + + // New version info + if (navigator.onLine) { + + var request = new XMLHttpRequest() + request.open('GET', 'https://api.github.com/repos/jean-emmanuel/open-stage-control/tags', true) + + request.onload = function() { + if (request.status >= 200 && request.status < 400) { + var data = JSON.parse(request.responseText) + + if (data[0].name != 'v' + packageVersion) { + $('#new-version').html(` [${data[0].name} is available]`) + } + + } + } + + request.send() + + } + +}) diff --git a/src/launcher/index.mjs b/src/launcher/index.mjs deleted file mode 100644 index 745bd104..00000000 --- a/src/launcher/index.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import '../client/globals.mjs' -import '../client/events/event-emitter.mjs' -import '../client/ui/ui-workspace.mjs' -import '../client/ui/zoom.mjs' -import './main.mjs' diff --git a/src/launcher/main.mjs b/src/launcher/main.mjs deleted file mode 100644 index 2dcdeaac..00000000 --- a/src/launcher/main.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import html from 'nanohtml' -import semver from 'semver' -import {ipcRenderer} from 'electron' -import terminal from './terminal.mjs' -import settings from './settings.mjs' -import './toolbar.mjs' -import {DOM, PACKAGE} from '../client/globals.mjs' - -DOM.get(document, '#osc-greeting-header')[0].appendChild(html`${PACKAGE.productName} v${PACKAGE.version}`) - -if (settings.remote.read('checkForUpdates') && navigator.onLine) { - - var request = new XMLHttpRequest() - request.open('GET', 'https://framagit.org/api/v4/projects/jean-emmanuel%2Fopen-stage-control/releases', true) - - request.onload = function() { - if (request.status >= 200 && request.status < 400) { - - var data = JSON.parse(request.responseText).filter(x=>!x.name.match(/alpha|beta/)), - current = 'v' + PACKAGE.version, - latest = data[0].name - - if (semver.gt(latest, current)) { - terminal.log(`(INFO) A new version is available : ${latest}`, 'info') - } else if (semver.gt(current, latest)) { - terminal.log(`(WARNING) Using development version ${current}`, 'warning') - } - - } - } - - request.send() - -} - -if (settings.remote.read('alwaysOnTop')) { - - settings.remote.getCurrentWindow().setAlwaysOnTop(true) - -} - - -if (settings.remote.read('autoStart')) { - - ipcRenderer.send('start') - -} diff --git a/src/launcher/settings.mjs b/src/launcher/settings.mjs deleted file mode 100644 index 61a62073..00000000 --- a/src/launcher/settings.mjs +++ /dev/null @@ -1,264 +0,0 @@ -import html from 'nanohtml' -import raw from 'nanohtml/raw' -import {ipcRenderer} from 'electron' -import remote from '@electron/remote' -import {icon} from '../client/ui/utils.mjs' -import terminal from './terminal.mjs' -import {DOM} from '../client/globals.mjs' - -var {dialog} = remote.require('electron'), - fs = remote.require('fs'), - {settings} = remote.getGlobal('launcherSharedGlobals'), - options_remote = settings.read('options') - -class Settings { - - constructor() { - - this.remote = settings - this.container = DOM.get('#osc-container')[0].appendChild(html``) - this.names = [] - this.options = {} - this.configPath = null - for (var i in options_remote) { - this.options[i] = options_remote[i] - } - - this.create() - this.write(true) - - ipcRenderer.on('server-starting', ()=>{ - this.disable() - }) - ipcRenderer.on('server-stopped', ()=>{ - this.enable() - }) - - } - - save() { - - if (!this.configPath) return this.saveAs() - fs.writeFile(this.configPath, JSON.stringify(this.options), (err, fdata)=>{ - - if (err) console.error(err) - else terminal.log('(INFO) Config saved in ' + this.configPath) - - }) - - } - - saveAs() { - - dialog.showSaveDialog({ - title: 'Open File', - filters:[{name: 'OSC Config (.config)', extensions: ['config']}], - properties: ['openFile'] - }).then((file)=>{ - if (file.canceled || !file.filePath) return - this.configPath = file.filePath - if (this.configPath.split('.').pop() !== 'config') this.configPath += '.config' - this.save() - }) - - } - - load() { - - dialog.showOpenDialog({ - title: 'Open File', - filters:[{name: 'OSC Config (.config)', extensions: ['config']}], - properties: ['openFile'] - }).then((file)=>{ - if (file.canceled || !file.filePaths.length) return - this.options = JSON.parse(fs.readFileSync(file.filePaths[0], 'utf-8')) - this.create() - this.write() - terminal.log('(INFO) Config loaded from ' + file.filePaths[0]) - this.configPath = file.filePaths[0] - }) - - } - - - write(tmp) { - - for (var i in this.options) { - if (this.options[i] === '' || !this.names.includes(i)) { - delete this.options[i] - } - } - - settings.write('options', this.options, tmp) - - } - - - create() { - - this.container.innerHTML = '' - - for (let k in settings.options) { - - if (settings.options[k].launcher === false) continue - - let data = settings.options[k], - name = data.alias || k, - field = html``, - label = field.appendChild(html``), - input = field.appendChild(html``), - toggle, browse, reset - - this.names.push(name) - - let value = this.options[name] === undefined ? '' : this.options[name], - strValue = Array.isArray(value) ? value.map(x=>x.includes(' ') ? '"'+x+'"' : x).join(' ') : value - - - label.addEventListener('click', (e)=>{ - terminal.log(`(HELP) --${name}: ${data.describe}`, 'help') - }) - - if (data.type === 'boolean') { - - toggle = field.appendChild(html` - ${raw(icon('check'))} - `) - toggle.addEventListener('click', (e)=>{ - input.value = toggle.classList.toggle('on') - DOM.dispatchEvent(input, 'change') - }) - - } - - if (data.file) { - - browse = field.appendChild(html` - ${raw(icon('folder-open'))} - `) - - browse.addEventListener('click', (e)=>{ - e.preventDefault() - dialog.showOpenDialog({ - title: 'Open ' + (data.file.folder ? 'folder' : 'file'), - filters:[{name: data.file.name, extensions: data.file.extensions}], - properties: data.file.folder ? ['openDirectory'] : ['openFile'] - }).then((file)=>{ - input.value = file.filePaths - DOM.dispatchEvent(input, 'change') - }) - }) - - field.addEventListener('drop', (e) => { - e.preventDefault() - e.stopPropagation() - let paths = [] - for (var f of event.dataTransfer.files) { - if (f.path.includes(' ')) { - paths.push('"' + f.path + '"') - } else { - paths.push(f.path) - } - } - input.value = paths.join(' ') - DOM.dispatchEvent(input, 'change') - }) - - } - - reset = field.appendChild(html` - ${raw(icon('times'))} - `) - reset.addEventListener('click', ()=>{ - input.value = '' - DOM.dispatchEvent(input, 'change') - }) - - input.value = strValue - - this.container.appendChild(field) - - input.addEventListener('change', (e)=>{ - let v = input.value.trim(), - fail = false - - try { - if (data.type == 'boolean') { - v = v && v !== 'false' ? true : '' - input.value = v - toggle.classList.toggle('on', v) - } else if (v && data.type === 'array'){ - v = v.replace(/("[^"]*"|'[^']*')/g, (m)=>{ - return m.substr(1, m.length - 2).replace(/\s/g, '_SPaCE_') - }) - v = v.split(' ') - v = v.map(x=>x.replace(/_SPaCE_/g, ' ')) - } else if (v && data.type == 'number'){ - v = parseFloat(v) - } - } catch (err) { - fail = err - } - - if (fail || v !== '' && data.check && data.check(v, this.options) !== true) { - let error = `(ERROR) --${name}: ${fail || data.check(v, this.options)}` - field.classList.add('error') - if (field.getAttribute('data-error') !== error) { - terminal.log(error, 'error') - field.setAttribute('data-error', error) - } - } else { - field.classList.remove('error') - field.removeAttribute('data-error') - this.options[name] = v - } - - if (data.restart && !field.classList.contains('restart') && v != value) { - field.classList.add('restart') - field.classList.add('warning') - terminal.log(`(WARNING) --${name}: The launcher must be restarted for this change to take effect.`, 'warning') - } else if (data.restart && field.classList.contains('restart') && v == value) { - field.classList.remove('restart') - field.classList.remove('warning') - } - - - if (!e.detail || !e.detail.stop) { - DOM.each(this.container, 'input', (el)=>{ - if (el === input) return - DOM.dispatchEvent(el, 'change', {stop: true}) - }) - this.write() - } - - }) - - } - - DOM.each(this.container, 'input', (el)=>{ - DOM.dispatchEvent(el, 'change', {stop: true}) - }) - - } - - disable() { - - this.container.classList.add('disabled') - DOM.each(this.container, 'input', (el)=>{ - el.setAttribute('disabled', true) - }) - - } - - enable() { - - this.container.classList.remove('disabled') - DOM.each(this.container, 'input', (el)=>{ - el.removeAttribute('disabled') - }) - - } - -} - -export default new Settings() diff --git a/src/launcher/terminal.mjs b/src/launcher/terminal.mjs deleted file mode 100644 index 9c382675..00000000 --- a/src/launcher/terminal.mjs +++ /dev/null @@ -1,73 +0,0 @@ -import {ipcRenderer} from 'electron' -import ansiHTML from 'ansi-html' -import html from 'nanohtml' -import {DOM} from '../client/globals.mjs' - -ansiHTML.setColors({ - magenta: 'B48EAD', - cyan: '81A1C1', -}) - -class Terminal { - - constructor(options) { - - this.content = DOM.get(options.selector)[0] - this.autoSroll = true - this.length = 0 - this.maxLength = 500 - - ipcRenderer.on('stdout', (e, msg)=>{ - this.log(ansiHTML(msg), 'log') - }) - - ipcRenderer.on('stderr', (e, msg)=>{ - if (msg.includes('\n at') && msg.split('\n at').length > 2) { - msg = msg.replace('\n at', '
          at') + '
          ' - } - this.log(ansiHTML(msg), 'error') - }) - - this.content.addEventListener('click', (e)=>{ - if (e.target.classList.contains('trace-button')) { - e.target.parentNode.classList.toggle('show') - } - }) - - } - - log(message, iclass = '') { - - var node = html`
          ` - node.innerHTML = message - - this.content.appendChild(node) - - if (++this.length > this.maxLength) this.purge() - - if (this.autoSroll) { - node.scrollIntoView() - } - - } - - purge() { - - var children = [...this.content.children] - for (var i = 0; i < this.maxLength / 2; i++) { - this.content.removeChild(children[i]) - } - this.length = this.maxLength / 2 + 1 - - } - - clear() { - - this.content.innerHTML = '' - this.length = 0 - - } - -} - -export default new Terminal({selector: '#osc-terminal'}) diff --git a/src/launcher/toolbar.mjs b/src/launcher/toolbar.mjs deleted file mode 100644 index a6677b4d..00000000 --- a/src/launcher/toolbar.mjs +++ /dev/null @@ -1,253 +0,0 @@ -import {ipcRenderer} from 'electron' -import remote from '@electron/remote' -import keyboardJS from 'keyboardjs/dist/keyboard.min.js' -import terminal from './terminal.mjs' -import settings from './settings.mjs' -import {DOM, PXSCALE} from '../client/globals.mjs' - - - -var {Menu, MenuItem} = remote.require('electron'), - menu = new Menu(), - {midiList, midiRestart, openDocs} = remote.getGlobal('launcherSharedGlobals'), - serverStarting = false, - serverStart = ()=>{ - if (serverStarting) return - ipcRenderer.send('start') - }, - serverStop = ()=>{ - if (!serverStarting) return - ipcRenderer.send('stop') - }, - showQRCode = ()=>{ - ipcRenderer.send('showQRCode') - } - -var start = new MenuItem({ - label: 'Start', - click: serverStart, - accelerator: 'f5' -}) -var stop = new MenuItem({ - label: 'Stop', - click: serverStop, - accelerator: 'f6' -}) -var qrcode = new MenuItem({ - label: 'Show QR code', - click: showQRCode, - accelerator: 'f7' -}) -var newWindow = new MenuItem({ - label: 'New window', - visible: false, - click: ()=>{ - ipcRenderer.send('openClient') - }, - accelerator: 'CmdOrCtrl + n' -}) -menu.append(start) -menu.append(stop) -menu.append(qrcode) -menu.append(newWindow) -menu.append(new MenuItem({ - type: 'separator' -})) -menu.append(new MenuItem({ - label: 'Load', - click: ()=>{ - settings.load() - }, - accelerator: 'CmdOrCtrl + o' -})) -menu.append(new MenuItem({ - label: 'Save', - click: ()=>{ - settings.save() - }, - accelerator: 'CmdOrCtrl + s' -})) -menu.append(new MenuItem({ - label: 'Save as...', - click: ()=>{ - settings.saveAs() - }, - accelerator: 'CmdOrCtrl + shift + s' -})) -menu.append(new MenuItem({ - type: 'separator' -})) - -menu.append(new MenuItem({type: 'submenu' , label: 'MIDI', submenu: [ - new MenuItem({ - label: 'List devices', - click: ()=>{ - midiList() - }, - accelerator: 'ctrl + m' - }), - new MenuItem({ - label: 'Restart backend', - id: 'midiRestart', - click: ()=>{ - midiRestart() - }, - enabled: false - }), - -]})) -menu.append(new MenuItem({type: 'submenu' , label: 'Console', submenu: [ - new MenuItem({ - label: 'Clear', - click: ()=>{ - terminal.clear() - }, - accelerator: 'CmdOrCtrl + l' - }), - new MenuItem({ - label: 'Autoscroll', - type: 'checkbox', - checked: true, - click: function(e){ - terminal.autoSroll = e.checked - } - }), - new MenuItem({ - label: 'Check for updates at startup', - type: 'checkbox', - checked: settings.remote.read('checkForUpdates'), - click: (e)=>{ - settings.remote.write('checkForUpdates', e.checked) - } - }) -]})) -menu.append(new MenuItem({type: 'submenu' , label: 'Launcher', submenu: [ - new MenuItem({ - label: 'Autostart', - type: 'checkbox', - checked: settings.remote.read('autoStart'), - click: (e)=>{ - settings.remote.write('autoStart', e.checked) - remote.getCurrentWindow().setAlwaysOnTop(e.checked) - } - }), - new MenuItem({ - label: 'Always on top', - type: 'checkbox', - checked: settings.remote.read('alwaysOnTop'), - click: (e)=>{ - settings.remote.write('alwaysOnTop', e.checked) - remote.getCurrentWindow().setAlwaysOnTop(e.checked) - } - }), - new MenuItem({ - label: 'Use tray icon', - type: 'checkbox', - checked: settings.remote.read('useTray'), - click: (e)=>{ - settings.remote.write('useTray', e.checked) - } - }), - new MenuItem({ - label: 'Start minimized', - type: 'checkbox', - checked: settings.remote.read('startMinimized'), - click: (e)=>{ - settings.remote.write('startMinimized', e.checked) - } - }), -]})) -menu.append(new MenuItem({ - type: 'separator' -})) -// menu.append(new MenuItem({ -// label: 'Restart', -// click: ()=>{ -// app.relaunch() -// app.exit(0) -// } -// })) -menu.append(new MenuItem({ - label: 'Documentation', - click: ()=>{ - openDocs() - } -})) - -if (settings.remote.read('useTray')) { - menu.append(new MenuItem({ - label: 'Hide', - click: ()=>{ - ipcRenderer.send('hide') - } - })) -} - -menu.append(new MenuItem({ - role: 'Quit' -})) - - -function bindShortcuts(menu) { - - for (let m of menu.items) { - - if (m.type === 'submenu') { - - bindShortcuts(m.submenu) - - } else if (m.accelerator && m.click) { - - keyboardJS.bind(m.accelerator.replace('CmdOrCtrl', 'mod'), (e)=>{ - m.click() - }) - - } - - } - -} - -bindShortcuts(menu) - -class Toolbar { - - constructor() { - - this.container = DOM.get('osc-toolbar#menu')[0] - this.startButton = DOM.get('osc-toolbar#start')[0] - - this.container.addEventListener('click', (e)=>{ - this.container.classList.add('on') - start.visible = !serverStarting - stop.visible = !!serverStarting - qrcode.visible = !!serverStarting - newWindow.visible = !!serverStarting - menu.getMenuItemById('midiRestart').enabled = !!serverStarting - - menu.popup({window: remote.getCurrentWindow(), x: parseInt(PXSCALE), y: parseInt(40 * PXSCALE)}) - }) - - menu.on('menu-will-close', ()=>{ - this.container.classList.remove('on') - }) - - this.startButton.addEventListener('click', (e)=>{ - if (!serverStarting) serverStart() - else serverStop() - }) - - ipcRenderer.on('server-starting', ()=>{ - serverStarting = true - this.startButton.classList.add('started') - }) - ipcRenderer.on('server-stopped', ()=>{ - serverStarting = false - this.startButton.classList.remove('started') - }) - - } - -} - -export default new Toolbar() diff --git a/src/python/head.py b/src/python/head.py new file mode 100644 index 00000000..4c16d558 --- /dev/null +++ b/src/python/head.py @@ -0,0 +1,33 @@ +from sys import argv, stdin, stdout, version_info, version, exit +from binascii import hexlify, unhexlify +import traceback +import json as JSON +import re + +def ipc_send(name, data): + print(JSON.dumps([name, data])) + stdout.flush() + +try: + import rtmidi + from rtmidi.midiconstants import * + + API = rtmidi.API_UNIX_JACK if 'jack' in argv else rtmidi.API_UNSPECIFIED + if API is rtmidi.API_UNIX_JACK and rtmidi.API_UNIX_JACK not in rtmidi.get_compiled_api(): + API = rtmidi.API_UNSPECIFIED + ipc_send('log', 'python-rtmidi was not compiled with jack midi support, falling back to default API') + + JACK = API == rtmidi.API_UNIX_JACK + + in_dev = rtmidi.MidiIn(API, 'MIDI->OSC probe') + out_dev = rtmidi.MidiOut(API, 'OSC->MIDI probe') + +except: + ipc_send('log', 'ERROR: MIDI: python-rtmidi not found (or wrong version)\nRunning with python version %s' % version) + ipc_send('log', '\nGet python-rtmidi at https://spotlightkid.github.io/python-rtmidi/') + exit() + +if version_info.major == 3: + raw_input = input + +debug = 'debug' in argv diff --git a/src/python/list.py b/src/python/list.py new file mode 100644 index 00000000..40392a3d --- /dev/null +++ b/src/python/list.py @@ -0,0 +1,26 @@ +from head import * + +def list(): + + message = [] + + message.append('===========') + message.append('MIDI Inputs') + message.append('-1: Void (bypass)') + + for i in range(in_dev.get_port_count()): + message.append('%i: %s' % (i, in_dev.get_port_name(i))) + + message.append('===========') + message.append('MIDI Outputs') + message.append('-1: Void (bypass)') + + for i in range(out_dev.get_port_count()): + message.append('%i: %s' % (i, out_dev.get_port_name(i))) + + ipc_send('log', '\n'.join(message)) + + +if __name__ == '__main__': + + list() diff --git a/src/python/midi.py b/src/python/midi.py new file mode 100644 index 00000000..5d05f6f3 --- /dev/null +++ b/src/python/midi.py @@ -0,0 +1,216 @@ +from head import * +from list import * +from utils import * + +if 'list' in argv: + list() + +# option: act as if displayed program is between 1-128 instead of 0-127 +PROGRAM_CHANGE_OFFSET = 'pc_offset' in argv + +inputs = {} +outputs = {} + +for arg in argv: + + if type(arg) == str and ':' in arg: + + name, ports = arg.split(':') + + inputs[name] = rtmidi.MidiIn(API, name if not JACK else name + '_in') + outputs[name] = rtmidi.MidiOut(API, name if not JACK else name + '_out') + + if ports == 'virtual': + + try: + inputs[name].open_virtual_port('midi_in') + outputs[name].open_virtual_port('midi_out') + except: + ipc_send('error', 'can\'t open virtual port "%s"' % name) + + elif ',' in ports: + + in_port, out_port = [int(x) for x in ports.split(',')] + + if in_port >= in_dev.get_port_count(): + ipc_send('error', 'can\'t connect to input port %i' % in_port) + break + + if out_port >= out_dev.get_port_count(): + ipc_send('error', 'can\'t connect to output port %i' % in_port) + break + + if in_port != -1: + + try: + inputs[name].open_port(in_port, 'midi_in') + except: + ipc_send('error', 'can\'t connect input to port %i: %s' % (in_port, in_dev.get_port_name(in_port))) + + if out_port != -1: + + try: + outputs[name].open_port(out_port, 'midi_out') + except: + ipc_send('error', 'can\'t connect to output port %i: %s' % (out_port, out_dev.get_port_name(out_port))) + + +def create_callback(name): + + def receive_midi(event, data): + + osc = {} + osc['args'] = [] + osc['host'] = 'midi' + osc['port'] = name + + message, deltatime = event + mtype = message[0] & 0xF0 + + if mtype in MIDI_TO_OSC: + + osc['address'] = MIDI_TO_OSC[mtype] + + if mtype is SYSTEM_EXCLUSIVE: + # Parse the provided data into a hex MIDI data string of the form 'f0 7e 7f 06 01 f7'. + v = ' '.join([hex(x).replace('0x', '').zfill(2) for x in message]) + osc['args'].append({'type': 'string', 'value': v}) + + else: + + status = message[0] + channel = (status & 0xF) + 1 + + osc['args'].append({'type': 'i', 'value': channel}) + + if mtype == NOTE_OFF: + message[2] = 0 + + elif mtype is PITCH_BEND: + message = message[:1] + [message[1] + message[2] * 128] # convert 0-127 pair -> 0-16384 -> + + elif mtype is PROGRAM_CHANGE and PROGRAM_CHANGE_OFFSET: + message[-1] = message[-1] + 1 + + for data in message[1:]: + osc['args'].append({'type': 'i', 'value': data}) + + + ipc_send('osc', osc) + + if debug: + ipc_send('log','MIDI received: %s From: midi:%s' % (midi_str(message), name)) + + + def callback_error_wrapper(event, data): + + try: + receive_midi(event, data) + except: + ipc_send('log', 'ERROR: MIDI: %s' % traceback.format_exc()) + + return callback_error_wrapper + +for name in inputs: + + inputs[name].set_callback(create_callback(name)) + + # Activate sysex support + if 'sysex' in argv: + inputs[name].ignore_types(False, True, True) + + +def midi_message(status, channel, data1=None, data2=None): + + msg = [(status & 0xF0) | (channel - 1 & 0xF)] + + if data1 is not None: + msg.append(data1 & 0x7F) + + if data2 is not None: + msg.append(data2 & 0x7F) + + return msg + + +sysexRegex = re.compile(r'([^0-9A-Fa-f])\1(\1\1)*') + +def send_midi(name, event, *args): + + if name not in outputs: + ipc_send('log','ERROR: MIDI: unknown output (%s)' % name) + return + + if event not in OSC_TO_MIDI: + ipc_send('log','ERROR: MIDI: invalid address (%s)' % event) + return + + m = None + + mtype = OSC_TO_MIDI[event] + + if mtype is SYSTEM_EXCLUSIVE: + + # unhexlify('f0 7e 7f 06 01 f7') creates a sysex message + # from hex MIDI data string 'f0 7e 7f 06 01 f7'. + # We expect all args to be hex strings! args[0] may contain placeholders of + # the form 'nn' that are replaced using args[1..N] to create the final message. + try: + midiBytes = args[0].replace(' ', '') + i = 1 + for m in sysexRegex.finditer(midiBytes): + midiBytes = midiBytes[:m.start()] + args[i].replace(' ', '') + midiBytes[m.end():] + i += 1 + + msg = unhexlify(midiBytes) + + if (msg and msg.startswith(b'\xF0') and msg.endswith(b'\xF7') and + all((val <= 0x7F for val in msg[1:-1]))): + m = msg + + except: + pass + + else: + + args = [int(round(x)) for x in args] + m = [mtype, args[0]] + + if mtype is NOTE_ON: + if args[2] is 0: + mtype = NOTE_OFF + + elif mtype is PITCH_BEND: + args = args[:1] + [args[1] & 0x7f, (args[1] >> 7) & 0x7f] # convert 0-16384 -> 0-127 pair + + elif mtype is PROGRAM_CHANGE and PROGRAM_CHANGE_OFFSET: + args[-1] = args[-1] - 1 + + m = midi_message(mtype, *args) + + if m is None: + + ipc_send('log','ERROR: MIDI: could not convert osc to midi (%s %s)' % (event, " ".join([str(x) for x in args]))) + + else: + + outputs[name].send_message(m) + + if debug: + + ipc_send('log','MIDI sent: %s To: midi:%s' % (midi_str(m), name)) + + +while True: + + try: + msg = raw_input() + except: + break + + try: + msg = JSON.loads(msg) + msg[1] = msg[1].lower() + send_midi(*msg) + except: + ipc_send('log', 'ERROR: MIDI: %s' % traceback.format_exc()) diff --git a/src/python/utils.py b/src/python/utils.py new file mode 100644 index 00000000..95622973 --- /dev/null +++ b/src/python/utils.py @@ -0,0 +1,51 @@ +from head import * + +MIDI_TO_OSC = { + NOTE_ON: '/note', + NOTE_OFF: '/note', + CONTROL_CHANGE: '/control', + PROGRAM_CHANGE: '/program', + PITCH_BEND: '/pitch', + SYSTEM_EXCLUSIVE: '/sysex' +} + +OSC_TO_MIDI = { + '/note': NOTE_ON, + '/control': CONTROL_CHANGE, + '/program': PROGRAM_CHANGE, + '/pitch': PITCH_BEND, + '/sysex': SYSTEM_EXCLUSIVE +} + +def midi_str(message): + + mtype = message[0] & 0xF0 + s = 'UNKNOWN' + + if mtype is SYSTEM_EXCLUSIVE: + + s = 'SYSTEM_EXCLUSIVE: sysex=%s' % ' '.join([hex(x).replace('0x', '').zfill(2) for x in message]) + + else: + + status = message[0] + channel = (status & 0xF) + 1 + + try: + + if mtype is NOTE_ON: + s = 'NOTE_ON: channel=%i, note=%i, velocity=%i' % (channel, message[1], message[2]) + elif mtype is NOTE_OFF: + s = 'NOTE_OFF: channel=%i, note=%i' % (channel, message[1]) + elif mtype is CONTROL_CHANGE: + s = 'CONTROL_CHANGE: channel=%i, cc=%i, value=%i'% (channel, message[1], message[2]) + elif mtype is PROGRAM_CHANGE: + s = 'PROGRAM_CHANGE: channel=%i, program=%i' % (channel, message[1]) + elif mtype is PITCH_BEND: + s = 'PITCH_BEND: channel=%i, pitch=%i' % (channel, message[1] + message[2] * 128 if len(message) == 3 else message[1]) + + except IndexError: + + s = 'NONE (ERROR: wrong number of argument for %s)' % MIDI_TO_OSC[mtype] + + return s diff --git a/src/scss/colors/nord.scss b/src/scss/colors/nord.scss deleted file mode 100644 index 488b8fa4..00000000 --- a/src/scss/colors/nord.scss +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) 2016-present Arctic Ice Studio -// Copyright (c) 2016-present Sven Greb - -// Project: Nord -// Version: 0.2.0 -// Repository: https://github.com/arcticicestudio/nord -// License: MIT -// References: -// http://sass-lang.com -// http://sassdoc.com - -//// -/// An arctic, north-bluish color palette. -/// Created for the clean- and minimal flat design pattern to achieve a optimal focus and readability for code syntax -/// highlighting and UI. -/// It consists of a total of sixteen, carefully selected, dimmed pastel colors for a eye-comfortable, but yet colorful -/// ambiance. -/// -/// @author Arctic Ice Studio -//// - -/// Base component color of "Polar Night". -/// -/// Used for texts, backgrounds, carets and structuring characters like curly- and square brackets. -/// -/// @access public -/// @example scss - SCSS -/// /* For dark ambiance themes */ -/// .background { -/// background-color: $nord0; -/// } -/// /* For light ambiance themes */ -/// .text { -/// color: $nord0; -/// } -/// @group polarnight -/// @since 0.1.0 -$nord0: #2e3440; - -/// Lighter shade color of the base component color. -/// -/// Used as a lighter background color for UI elements like status bars. -/// -/// @access public -/// @group polarnight -/// @see $nord0 -/// @since 0.1.0 -$nord1: #3b4252; - -/// Lighter shade color of the base component color. -/// -/// Used as line highlighting in the editor. -/// In the UI scope it may be used as selection- and highlight color. -/// -/// @access public -/// @example scss - SCSS -/// /* Code Syntax Highlighting scope */ -/// .editor { -/// &.line { -/// background-color: $nord2; -/// } -/// } -/// -/// /* UI scope */ -/// button { -/// &:selected { -/// background-color: $nord2; -/// } -/// } -/// @group polarnight -/// @see $nord0 -/// @since 0.1.0 -$nord2: #434c5e; - -/// Lighter shade color of the base component color. -/// -/// Used for comments, invisibles, indent- and wrap guide marker. -/// In the UI scope used as pseudoclass color for disabled elements. -/// -/// @access public -/// @example scss - SCSS -/// /* Code Syntax Highlighting scope */ -/// .editor { -/// &.indent-guide, -/// &.wrap-guide { -/// &.marker { -/// color: $nord3; -/// } -/// } -/// } -/// .comment, -/// .invisible { -/// color: $nord3; -/// } -/// -/// /* UI scope */ -/// button { -/// &:disabled { -/// background-color: $nord3; -/// } -/// } -/// @group polarnight -/// @see $nord0 -/// @since 0.1.0 -$nord3: #4c566a; - -/// Base component color of "Snow Storm". -/// -/// Main color for text, variables, constants and attributes. -/// In the UI scope used as semi-light background depending on the theme shading design. -/// -/// @access public -/// @example scss - SCSS -/// /* For light ambiance themes */ -/// .background { -/// background-color: $nord4; -/// } -/// /* For dark ambiance themes */ -/// .text { -/// color: $nord4; -/// } -/// @group snowstorm -/// @since 0.1.0 -$nord4: #d8dee9; - -/// Lighter shade color of the base component color. -/// -/// Used as a lighter background color for UI elements like status bars. -/// Used as semi-light background depending on the theme shading design. -/// -/// @access public -/// @group snowstorm -/// @see $nord4 -/// @since 0.1.0 -$nord5: #e5e9f0; - -/// Lighter shade color of the base component color. -/// -/// Used for punctuations, carets and structuring characters like curly- and square brackets. -/// In the UI scope used as background, selection- and highlight color depending on the theme shading design. -/// -/// @access public -/// @group snowstorm -/// @see $nord4 -/// @since 0.1.0 -$nord6: #eceff4; - -/// Bluish core color. -/// -/// Used for classes, types and documentation tags. -/// -/// @access public -/// @group frost -/// @since 0.1.0 -$nord7: #8fbcbb; - -/// Bluish core accent color. -/// -/// Represents the accent color of the color palette. -/// Main color for primary UI elements and methods/functions. -/// -/// Can be used for -/// - Markup quotes -/// - Markup link URLs -/// -/// @access public -/// @group frost -/// @since 0.1.0 -$nord8: #88c0d0; - -/// Bluish core color. -/// -/// Used for language-specific syntactic/reserved support characters and keywords, operators, tags, units and -/// punctuations like (semi)colons,commas and braces. -/// -/// @access public -/// @group frost -/// @since 0.1.0 -$nord9: #81a1c1; - -/// Bluish core color. -/// -/// Used for markup doctypes, import/include/require statements, pre-processor statements and at-rules (`@`). -/// -/// @access public -/// @group frost -/// @since 0.1.0 -$nord10: #5e81ac; - -/// Colorful component color. -/// -/// Used for errors, git/diff deletion and linter marker. -/// -/// @access public -/// @group aurora -/// @since 0.1.0 -$nord11: #bf616a; - -/// Colorful component color. -/// -/// Used for annotations. -/// -/// @access public -/// @group aurora -/// @since 0.1.0 -$nord12: #d08770; - -/// Colorful component color. -/// -/// Used for escape characters, regular expressions and markup entities. -/// In the UI scope used for warnings and git/diff renamings. -/// -/// @access public -/// @group aurora -/// @since 0.1.0 -$nord13: #ebcb8b; - -/// Colorful component color. -/// -/// Main color for strings and attribute values. -/// In the UI scope used for git/diff additions and success visualizations. -/// -/// @access public -/// @group aurora -/// @since 0.1.0 -$nord14: #a3be8c; - -/// Colorful component color. -/// -/// Used for numbers. -/// -/// @access public -/// @group aurora -/// @since 0.1.0 -$nord15: #b48ead; diff --git a/src/scss/editor.scss b/src/scss/editor.scss new file mode 100644 index 00000000..48fd6e45 --- /dev/null +++ b/src/scss/editor.scss @@ -0,0 +1,562 @@ +#editor { + box-shadow: 0 0 0 1rem var(--color-light) inset; + background: var(--color-fg); + padding: 1rem 8rem 8rem; + margin-top: 2rem; + flex-shrink:0; + &:empty { + padding:0; + margin: 0; + } + ul { + padding: 4rem; + list-style:none; + li { + margin-bottom: 4rem; + position: relative; + &:last-child { + margin: 0; + } + } + } + + .form { + margin-top: 10rem; + } +} +.form { + line-height: 18rem; + .input-wrapper { + display: flex; + // margin-bottom:4rem; + margin-top: -1rem; + // box-shadow: 0 0 0 1 var(--color-bg); + background:var(--color-bg); + align-items: stretch; + z-index: 1; + border-bottom: 1rem solid var(--color-bg); + position: relative; + justify-content: center; + text-transform: none; + font-weight: 500; + + &:last-child { + margin-bottom:0; + } + &.disabled { + label { + opacity: .8; + } + } + label { + flex-shrink: 0; + padding: 6rem 7rem 4rem; + min-width: 29%; + margin: 1rem; + margin-bottom: 0; + margin-right: 0; + &:not(.btn) { + background: var(--color-fg); + box-shadow: 1rem 0 0 0 var(--color-bg) inset; + margin: 0; + margin-top: 1rem; + } + &.dynamic:after { + content:"\f0e7"; + font-family: FontAwesome; + vertical-align:super; + font-size: 75%; + opacity: 0.75!important; + position: absolute; + margin-top: -4rem; + } + } + .input { + background: var(--color-bg); + flex: 1 1 100%; + padding:5rem; + border-top:1rem solid var(--color-fg); + border-radius: 0; + -webkit-appearance:none; + cursor: initial; + width: 1px; + } + .column { + padding: 2rem; + ul { + padding: 0!important; + overflow: auto; + li:not(:last-child) { + margin-bottom: 2rem!important; + } + .sortable-placeholder { + background: transparent; + &:after { + content:"|"; + color: transparent; + } + } + li i { + pointer-events: none + } + } + .btn + span { + position: absolute; + right:0rem; + top:0rem; + padding:8rem; + opacity: 0.6; + cursor: pointer; + &:hover { + opacity: 1; + } + } + } + .checkbox { + line-height: 18rem; + height: 18rem; + width: 18rem; + position: absolute; + right:5rem; + top:6rem; + cursor: pointer; + background: var(--color-fg); + text-align: center; + box-shadow: 0 0 0 1rem var(--color-light) inset; + display: flex; + align-items: center; + justify-content: center; + i { + color: transparent; + margin-top: -1rem; + margin-left: 1rem; + } + &.on i { + color:var(--color-accent); + } + } + } + label { + display: block; + font-size: 10rem; + // background: var(--color-track); + } + .info { + color:var(--color-text-fade); + margin-bottom:10rem; + } + .input { + display:block; + border:0; + font:inherit; + color:var(--color-text); + width:auto; + .btn { + background: var(--color-raised); + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 0 0 1rem var(--color-bg); + &:not(:last-child){ + cursor: -webkit-grab; + cursor: grab; + } + } + } + textarea { + display:block; + border:0; + font:inherit; + background: none; + color:var(--color-text); + width:100%; + padding:5rem; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; + border-top:1rem solid var(--color-fg); + resize: none; + font-size: 12rem!important; + -webkit-user-select: text; + user-select: text; + --scrollbar-size: 6rem; + &::-webkit-scrollbar-button { + width:1rem!important; + } + } + .error label{ + color: red; + } + .select-wrapper { + position: relative; + margin: 2rem; + flex: 1 1 100%; + &:after{ + content:"\f107"; + font-family: FontAwesome; + position: absolute; + padding:5rem; + right:0; + top:1rem; + font-size: 20rem; + pointer-events: none; + } + + .input { + border:0; + width: 100%; + cursor: pointer; + background: var(--color-fg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + } + } + select { + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + font-size: 12rem!important; + } + .submit { + margin-top:30rem; + } + .separator { + line-height: 30rem; + height: 30rem; + margin-top: 10rem; + position: relative; + display: flex; + align-items: center; + border: 1rem solid var(--color-bg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + padding: 0 10rem; + + span { + text-transform: lowercase; + font-variant: small-caps; + position: relative; + display: block; + width:100%; + text-align:center; + pointer-events: none; + + text-overflow:ellipsis; + overflow:hidden; + &.accent { + color: var(--color-accent); + } + } + } + .separator + .input-wrapper .input { + border-top-color:transparent; + } + .category { + .separator { + cursor: pointer; + } + .separator:before { + font-family: FontAwesome; + content: "\f0d7"; + line-height: 30rem; + width:30rem; + text-align: center; + position: absolute; + opacity: 0.6; + } + &.folded { + .separator:before { + content: "\f0da"; + } + .input-wrapper { + display: none; + } + } + } +} + +// sticky editor header +.editor-container .form > .separator { + background: var(--color-fg); + position: sticky; + top:10rem; + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 -10rem 0 0 var(--color-fg); + + z-index: 10; +} + + +.widget.editing { + z-index: 9999!important; + // overflow: visible; +} +.widget.editing:after, li.editing a:after, a.editing:before, .content.editing:before, #container.editing:before{ + content:""; + z-index: 999!important; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + border:1rem solid var(--color-accent); + + --opa1: rgba(0,0,0, 1); + --opa2: rgba(0,0,0, 0.2); + --opa3: rgba(0,0,0, 0.8); + -webkit-mask: linear-gradient(to right, var(--opa1) 10rem, var(--opa1) 10rem, var(--opa2) 10rem, var(--opa2) calc(100% - 10rem), var(--opa1) calc(100% - 10rem), var(--opa1)), + linear-gradient(to bottom, var(--opa2) 10rem, var(--opa2) 10rem, var(--opa3) 10rem, var(--opa3) calc(100% - 10rem), var(--opa2) calc(100% - 10rem), var(--opa2)) ; + -webkit-mask-composite: xor; + + pointer-events: none; + box-shadow: none!important; + opacity: 1!important; +} + +.context-menu { + position:fixed; + z-index: 999999999; + background: var(--color-raised); + box-shadow: 0 0 4rem 1rem var(--color-bg); + text-transform: none; + .item { + color:var(--color-text) + } + .context-menu { + position: absolute; + left:100%; + top:0; + opacity:0; + pointer-events: none; + margin-left: 2rem; + &:before { + content:""; + position: absolute; + top:0; + bottom:0; + left:-2rem; + width:2rem; + } + } + > .item { + padding: 10rem 15rem 10rem 10rem; + position:relative; + cursor: pointer; + i { + margin-right:5rem; + width: 15rem; + text-align: center; + } + &.focus, &:focus { + > .context-menu { + pointer-events: auto; + opacity: 1; + } + &:after { + content:""; + position: absolute; + left:0; + top:0; + width: 100%; + height:100%; + background:var(--color-accent); + opacity: 0.5; + z-index: -1; + } + } + &.has-sub:before { + content:"\f105"; + display: block; + font-family: FontAwesome; + float:right; + margin-right:-10rem; + padding-left: 10rem; + } + } +} + +.ui-resizable-handle { + position: absolute; + z-index: 10000; + display: flex; + justify-content: center; + align-items: center; + background: var(--color-accent); + width:8rem; + height:8rem; + padding: 1rem; + background-clip: content-box; + + &:after { + content:""; + position: absolute; + } + &.ui-resizable-se { + content:""; + bottom: 1rem; + right: 1rem; + cursor: se-resize; + &:after { + top:-5rem; + right:-1rem; + left:-5rem; + bottom:-1rem; + } + } + &.ui-resizable-e { + top: 50%; + margin-top:-4rem; + right: 1rem; + cursor: e-resize; + &:after { + top:-5rem; + right:-1rem; + left:-5rem; + bottom:-5rem; + } + } + &.ui-resizable-s { + bottom: 1rem; + left: 50%; + margin-left:-4rem; + cursor: s-resize; + &:after { + top:-5rem; + right:-5rem; + left:-5rem; + bottom:-1rem; + } + } +} + +.ui-helper { + z-index: 10000!important; + opacity: 1!important; + &:before { + content:""; + position: absolute; + top:1rem; + left:1rem; + right:0; + bottom:0; + border:1rem solid var(--color-accent); + --opa1: rgba(0,0,0, 1); + --opa2: rgba(0,0,0, 0.2); + --opa3: rgba(0,0,0, 0.8); + -webkit-mask: linear-gradient(to right, var(--opa1) 10rem, var(--opa1) 10rem, var(--opa2) 10rem, var(--opa2) calc(100% - 10rem), var(--opa1) calc(100% - 10rem), var(--opa1)), + linear-gradient(to bottom, var(--opa2) 10rem, var(--opa2) 10rem, var(--opa3) 10rem, var(--opa3) calc(100% - 10rem), var(--opa2) calc(100% - 10rem), var(--opa2)) ; + -webkit-mask-composite: xor; + + } + &:after { + content:""; + position: absolute; + top:1rem; + left:1rem; + right:0; + bottom:0; + background: var(--color-accent); + opacity: .25; + } +} + +.ui-draggable-handle:not(.label) { + position: absolute; + top: 1rem; + left: 1rem; + z-index: 100000; + height:8rem; + width: 8rem; + display: flex; + justify-content: center; + align-items: center; + background: var(--color-accent); + padding: 1rem; + background-clip: content-box; + &:after { + content:""; + position: absolute; + top:-1rem; + right:-5rem; + left:-1rem; + bottom:-5rem; + } +} + +.ui-draggable-handle { + cursor: -webkit-grab; + &:active { + cursor:-webkit-grabbing; + } +} + +// GRID + +.editor-enabled { + &:not(.no-grid) { + .tab:not(.has-tabs), .panel { + background-image: linear-gradient(to bottom, var(--color-grid) 1rem, transparent 1rem), + linear-gradient(to right, var(--color-grid) 1rem, transparent 1rem); + --size: calc(var(--grid-width) * 1rem); + background-size: var(--size) var(--size); + background-attachment: local; + background-position: 0 0; + } + } + + .widget { + pointer-events: initial!important; + } + +} + +// Help popup + +.editor-help { + .error { + color: red; + margin-top: 10rem; + } + em { + font-style: italic; + } + code { + color: var(--color-accent); + padding: 1rem 3rem; + background: rgba(black, 0.2); + display: inline-block; + user-select: auto; + cursor: auto; + ::selection{/* reset */} + } + a { + text-decoration: underline; + cursor: pointer; + } + .pre { + white-space: pre; + vertical-align: text-top; + } + .help { + margin-top: 10rem; + } +} +.editor-help-title { + text-transform: none; +} + +// selectable + +.select-area { + position:fixed; + z-index:999999; + border: 1rem solid var(--color-accent); + pointer-events: none; + &:after { + content:""; + position: absolute; + top:0;left:0; + right:0;bottom:0; + background: var(--color-accent); + opacity: 0.2; + } + &.hidden { + display: none; + } +} diff --git a/src/scss/index.scss b/src/scss/index.scss index 6bb35dec..b22db55e 100644 --- a/src/scss/index.scss +++ b/src/scss/index.scss @@ -1,21 +1,25 @@ @import 'reset'; -@import 'mixins'; -@import 'themes/default'; -@import 'ui'; -@import 'widgets'; +@import 'scrollbars'; + +@import 'layout'; +@import 'notifications'; + +@import 'editor'; +@import 'sidepanel'; +@import 'widgets'; input, textarea, { - caret-color: var(--color-widget); + caret-color: var(--color-custom); } input:focus::selection, textarea:focus::selection, { - background:var(--color-widget); - color: var(--color-text); + background:var(--color-custom); + color:var(--color-text); } input { cursor: text; @@ -29,16 +33,10 @@ input { } html, body { - - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - + height:100%; + position:relative; overflow:hidden; overscroll-behavior: none; - background-color: var(--color-background); } html{ @@ -57,16 +55,536 @@ body { white-space:nowrap; opacity:1; cursor: default; - font-family: $font; + font-family: 'Roboto', sans-serif; font-size:11rem; line-height:100%; - font-weight: 400; - // text-transform: uppercase; + font-weight: 500; + text-transform: uppercase; letter-spacing: 1rem; - text-rendering: optimizeSpeed; - } +.btn { + background: var(--color-raised); + display: block; + padding:15rem; + position: relative; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + cursor: pointer; + box-shadow: 0 0 0 1rem var(--color-light) inset; + &.small { + padding:8rem; + padding-right: 15rem; + } + &.tiny { + padding:6rem; + } + &.warning { + background:firebrick; + } + &.disabled { + pointer-events: none; + color:var(--color-text-fade); + } + &.align-center { + text-align: center + } +} + + + + + + + + + + +#lobby { + background: var(--color-bg); + position: absolute; + top:0; + left:0; + right: 0; + bottom:0; + z-index: 2; + display: flex; + align-items: center; + justify-content: center; + overflow-y: auto; + padding:20rem; + + .main { + width:600rem; + max-width: 100%; + max-height:100%; + display: flex; + flex-direction: column; + opacity: 0; + transition: opacity .1s; + &.show { + opacity: 1; + overflow: auto; + } + } + .list { + overflow: auto; + background: var(--color-fg); + border-top:2rem solid var(--color-bg); + text-transform: none; + font-weight: 500; + flex: 1 1 auto; + a { + &:focus { + &:after { + content:""; + position: absolute; + top:0; + left:0; + bottom:0; + right:0; + background: var(--color-accent); + opacity: 0.1; + } + } + } + } + .header { + padding:22rem 20rem 20rem; + white-space: nowrap; + text-overflow: ellipsis; + flex-grow: 0; + background-color: var(--color-fg); + color:var(--color-accent); + letter-spacing: 1rem; + font-size: 12rem; + background:var(--color-raised); + box-shadow: 0 0 0 1rem var(--color-light) inset; + } + .footer { + background: var(--color-fg); + white-space: nowrap; + text-overflow: ellipsis; + flex-grow: 0; + border-top:2rem solid var(--color-bg); + a { + background:var(--color-raised); + &:focus { + &:after { + content:""; + position: absolute; + top:0; + left:0; + bottom:0; + right:0; + background: var(--color-accent); + opacity: 0.1; + } + } + } + } + a { + display: block; + overflow: hidden; + padding:17rem; + padding-right:39rem; + position: relative; + white-space: nowrap; + text-overflow: ellipsis; + background: none; + border-bottom:1rem solid var(--color-bg); + em { + pointer-events: none; + } + &:last-child { + border-bottom:0; + } + span { + position: absolute; + right:0rem; + top:0rem; + padding:17rem; + color:var(--color-text-fader); + z-index: 1; + &:hover { + color:var(--color-accent); + } + i { + pointer-events: none; + } + } + } +} + + +#launcher { + overflow: initial; + + body { + background: var(--color-fg); + overflow: auto; + } + + .form { + padding:8rem; + padding-top:58rem; + position: relative; + width: 100%; + background: var(--color-fg); + overflow: hidden; + opacity: 0; + transition: opacity .25s; + &.loaded { + opacity: 1; + overflow: auto; + } + } + .item-wrapper { + // margin-bottom:4rem; + label { + min-width:98rem; + } + .input-wrapper { + position: relative; + // height: 28rem; + // overflow: hidden; + // margin: 0; + box-shadow: none; + + .clear { + padding:0; + height:26rem; + width: 26rem; + line-height: 26rem; + text-align: center; + position: absolute; + right:1rem; + top:2rem; + background: none; + opacity: .7; + box-shadow: none; + } + input { + padding-right:35rem; + box-shadow: none; + } + input[value="true"] { + color: inherit; + } + input[disabled] { + color:var(--color-accent); + } + .checkbox { + right: 30rem; + &.disabled { + pointer-events: none; + &.on i { + color:var(--color-text-fade); + } + } + } + } + .error-msg, .restart-msg { + transition: height .25s; + height: 0rem; + white-space:normal; + padding: 0 4rem; + margin-left:1rem; + text-transform: none; + } + &.error, &.restart { + .error-msg { + height: 28rem; + line-height: 28rem; + background: rgba(red,0.25) + } + .restart-msg { + height: 28rem; + line-height: 28rem; + background: rgba(orange,0.25) + } + } + } + .header { + position: fixed; + top:8rem; + left:8rem; + right:8rem; + background: var(--color-fg); + border: 1rem solid var(--color-bg); + margin-bottom: -1rem; + color: var(--color-accent); + cursor: default; + z-index: 2; + box-shadow: none; + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 -8rem 0 0 var(--color-fg); + padding: 16rem 15rem 14rem; + + #title { + text-transform: uppercase; + letter-spacing: 1rem; + font-size: 12rem; + line-height: 12rem; + } + + #version { + opacity: .5; + text-transform: none; + } + + + #new-version { + color:yellow; + cursor: pointer; + float:right; + } + } + .start { + border: 1rem solid var(--color-bg); + z-index: 1; + margin-top: 8rem; + &:after { + content:""; + position: absolute; + top:0; + left:0; + right: 0; + bottom:0; + box-shadow: 0 0 0 1rem var(--color-light) inset; + pointer-events: none; + } + &.disabled { + opacity: .5; + } + &.started { + color:#fff; + cursor: default; + a { + cursor: pointer; + text-decoration: underline; + } + } + &.started:before { + content:""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + background-color: var(--color-accent); + opacity: 0.25; + z-index: -1; + } + } + .save { + float:left; + width:97rem; + border-right: 0; + &:before { + transition: opacity .5s; + content:""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + background-color: var(--color-accent); + opacity: 0; + z-index: -1; + } + &.saved:before { + transition: none; + opacity: 0.25; + + } + } + + .terminal { + margin-top: 8rem; + background: var(--color-bg); + font-family: 'RobotoMono'; + text-transform: none; + padding:3rem; + border:2rem solid var(--color-bg); + letter-spacing: normal; + cursor: auto; + flex:1; + height: auto; + min-height: 50rem; + + div { + user-select:text; + width: 100%; + white-space: pre-line; + word-wrap: break-word; + text-indent: -10px; + padding-left: 10px; + margin-top: 4rem; + } + .log { + } + .error { + color: rgba(255, 150, 50, 1) + } + } +} + + + + + + + + + + +#loading { + position: fixed; + top:50%; + left:50%; + margin-left:-15rem; + margin-top:-15rem; + text-align: center; +} + +.spinner { + display: block; + margin: 0 auto; + height:36rem; + width:36rem; + border-radius: 50%; + border:5rem solid var(--color-light); + position: relative; + + &:before { + content:""; + position: absolute; + left:-4rem; + top:-4rem; + right:-4rem; + bottom:-4rem; + border:4rem solid var(--color-bg); + border-radius: 50%; + } + &:after { + content:""; + position: absolute; + left:-3rem; + top:-3rem; + right:-3rem; + bottom:-3rem; + border:2rem solid var(--color-track); + border-top:2rem solid var(--color-accent); + transform: rotateZ(0deg); + animation: spin .5s linear infinite; + border-radius: 50%; + } +} + +@keyframes spin { + 0% {transform: rotateZ(0deg);} + 100% {transform: rotateZ(360deg);} +} + + + + + + +.popup { + position: fixed; + top:0; + left:0; + right:0; + bottom:0; + padding:10%; + align-items:center; + justify-content: center; + z-index:1000000; + transform: translate3d(0,0,0); + display: none; + &.show { + display: flex; + } + &:before { + content: ""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + background:var(--color-bg); + opacity: .5; + } + .popup-title { + position: relative; + background:var(--color-raised); + border-bottom: 1rem solid var(--color-bg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + height:46rem; + flex-shrink: 0; + display: flex; + padding:0 15rem; + align-items: center; + .title { + flex:1; + overflow: hidden; + text-overflow: ellipsis; + } + i { + margin-right: 5rem; + } + &.closable { + padding-right: 0; + } + .popup-label { + flex:1; + } + .closer { + padding:0 15rem; + height: 100%; + flex-shrink: 0; + display: flex; + align-items: center; + text-align: center; + color:var(--color-text-fade); + cursor: pointer; + i { + pointer-events: none; + } + } + } + .popup-wrapper { + display: flex; + flex-direction: column; + align-items: stretch; + width:auto; + max-width:600rem; + max-height: 100%; + position: relative; + overflow: hidden; + box-shadow: 1rem 0 0 0 var(--color-bg), + 0 1rem 0 0 var(--color-bg), + 1rem 1rem 0 0 var(--color-bg), + 0 1rem 0 0 var(--color-light) inset; + border-left:1rem solid var(--color-bg); + border-top:1rem solid var(--color-bg); + .popup-content { + height:100%; + width:100%; + flex:1; + padding:10rem; + overflow-y:auto; + white-space: normal; + background:var(--color-fg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + text-transform: none; + position: relative; + } + } +} .error-stack { > span { @@ -74,15 +592,16 @@ body { color: inherit!important; } padding:10rem; - user-select:text; - cursor: text; + user-select:initial; + cursor: initial; * { - user-select:text; - cursor: text; + user-select:initial; + cursor: initial; } overflow:auto; + background: var(--color-bg); white-space:pre; - font-family: $font-mono; + font-family: monospace; font-weight:bold; } @@ -93,7 +612,98 @@ body { .fa-osc:before { content:"\f111"; color: transparent; - background-image: url(../assets/favicon.png?__OSC_ASSET__=1); + background-image: url(../assets/logo.png); background-size: contain; background-repeat: no-repeat; } + +.file-browser { + width: 540px; + height: 360px; + max-width: 100%; + display: flex; + flex-direction: column; + flex: 1; + .ariane { + height: 40rem; + flex-shrink: 0; + line-height: 40rem; + padding-left: 10rem; + } + .file-list { + overflow-y: auto; + flex:1; + background: var(--color-bg); + padding: 0 10rem; + } + .file { + position: relative; + height: 40rem; + line-height: 40rem; + input { + position: absolute; + width:100%; + height: 100%; + opacity: 0; + cursor: pointer; + } + .label { + position: absolute; + width:100%; + height: 100%; + pointer-events: none; + white-space: nowrap; + span { + display: block; + width: 100%; + text-overflow: ellipsis; + overflow: hidden; + } + } + input:checked + .label { + color: var(--color-custom); + &:before { + content:""; + position: absolute; + left:-10rem; + right:-10rem; + height: 100%; + background: var(--color-custom); + opacity: 0.1; + } + } + } + .file-actions { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: flex-end; + height: 40rem; + flex-shrink: 0; + margin-top: 10rem; + div { + margin-left: 10rem; + text-transform: uppercase; + text-overflow: clip; + } + i { + pointer-events: none; + } + .save-as { + flex:1; + height: 40rem; + line-height: 40rem; + border: 0; + padding: 0 10rem; + font-size: 120%; + top: -1rem; + position: relative; + background: var(--color-bg); + &[disabled] { + pointer-events: none; + } + } + } +} + +@import 'themes/default'; diff --git a/src/scss/layout.scss b/src/scss/layout.scss new file mode 100644 index 00000000..efd17612 --- /dev/null +++ b/src/scss/layout.scss @@ -0,0 +1,139 @@ +body { + background:var(--color-bg); +} + +#container { + position: absolute; + top:0; + left:0; + bottom:0; + right:0; + display:flex; + flex-direction: column; + background:var(--color-bg); + padding:2rem; + opacity: 0; + transition: opacity .1s; + min-width: 45rem; + &.show { + opacity: 1; + } + &.sidepanel-open { + right:var(--sidepanel-size); + } +} + + +.navigation { + height:var(--nav-height); + margin-bottom: 1rem; + margin-left: 1rem; + flex-shrink:0; + // font-weight:bold; + text-transform: uppercase; + background: transparent; + height:calc(var(--nav-height) - 2rem); + + &:after { + background: var(--color-bg); + } + a.on { + border-color: var(--color-bg); + } + + &.main { + li:last-child { + width:var(--nav-height); + max-width:var(--nav-height); + min-width:var(--nav-height); + i { + margin:0 auto; + } + } + } + ul { + list-style:none; + display: flex; + overflow: hidden; + height:100%; + + li { + display:block; + min-width:0; + flex: 1 1 100%; + cursor:pointer; + height:100%; + margin-right: 1rem; + + + &:last-child { + margin-right:0; + margin-left: auto; + i { + font-size: 14rem; + } + } + a { + background: var(--color-raised); + pointer-events: none; + padding: 0 5rem; + height:100%; + display: flex; + align-items: center; + overflow:hidden; + text-align:center; + position:relative; + box-shadow: 0 0 0 1rem var(--color-light) inset; + letter-spacing: 1rem; + font-size: 109%; + white-space: pre; + span { + display:block; + width:100%; + padding: 2rem 0; + -webkit-mask: linear-gradient(to left, rgba(0, 0, 0, 0), #000000 10rem) no-repeat; + } + + } + #open-toggle { + pointer-events: auto; + i { + pointer-events: none; + font-size:13rem; + } + } + &.on a, .sidepanel-open { + position: relative; + z-index: 0; + // background:var(--color-fg); + color: var(--color-custom); + &:before { + content: ""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.4; + background: radial-gradient( ellipse at center, transparent, var(--color-bg)); + } + + &:after { + content:""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.3; + box-shadow: 0 0 0 1rem var(--color-custom) inset; + border-radius: inherit; + z-index: -1; + } + } + } + .parent + li a { + padding-left: calc(5rem + 0.5 * var(--nav-height)); + } + } +} diff --git a/src/scss/mixins.scss b/src/scss/mixins.scss deleted file mode 100644 index 5de3094e..00000000 --- a/src/scss/mixins.scss +++ /dev/null @@ -1,32 +0,0 @@ -@mixin pseudo-stroke($z: 0) { - &:before { - content:""; - position: absolute; - border: var(--line-width) solid var(--color-stroke); - opacity: var(--alpha-stroke); - top: 0; - left: 0; - right: 0; - bottom: 0; - pointer-events: none; - z-index: $z; - border-radius: inherit; - } -} - -@mixin pseudo-fill($z: 0) { - &:after { - content:""; - position: absolute; - background: var(--color-fill); - opacity: var(--alpha-fill); - top: var(--line-width); - left: var(--line-width); - right: var(--line-width); - bottom: var(--line-width); - pointer-events: none; - margin: var(--widget-padding); - z-index: $z; - border-radius: inherit; - } -} diff --git a/src/scss/ui/notifications.scss b/src/scss/notifications.scss similarity index 97% rename from src/scss/ui/notifications.scss rename to src/scss/notifications.scss index b9393516..ef0a26d6 100644 --- a/src/scss/ui/notifications.scss +++ b/src/scss/notifications.scss @@ -38,7 +38,7 @@ } .content { padding: 10rem; - white-space: pre-line; + white-space: normal; text-transform: none; line-height: normal; } diff --git a/src/scss/reset.scss b/src/scss/reset.scss index 286c7846..ba991012 100644 --- a/src/scss/reset.scss +++ b/src/scss/reset.scss @@ -1,3 +1,4 @@ + * { margin:0; padding:0; diff --git a/src/scss/scrollbars.scss b/src/scss/scrollbars.scss new file mode 100644 index 00000000..d92f4603 --- /dev/null +++ b/src/scss/scrollbars.scss @@ -0,0 +1,88 @@ + +::-webkit-scrollbar { + width: var(--scrollbar-size); + height:var(--scrollbar-size); + opacity:1; + +} + +::-webkit-scrollbar-track-piece { + background: var(--color-bg); + &:vertical { + border-left:2rem solid var(--color-bg); + } + &:horizontal { + border-top:2rem solid var(--color-bg); + } +} +::-webkit-scrollbar-corner { + background: var(--color-fg); + border-left:2rem solid var(--color-bg); + border-top:2rem solid var(--color-bg); +} +::-webkit-scrollbar-thumb { + background: var(--color-raised); + + &:vertical { + border-left:2rem solid var(--color-bg); + } + &:horizontal { + border-top:2rem solid var(--color-bg); + } +} + + +@mixin arrow($r) { + background-image:url('data:image/svg+xml;utf8,'); + background-blend-mode: difference, normal; +} + +::-webkit-scrollbar-button:decrement:start, ::-webkit-scrollbar-button:increment:end { + + background:var(--color-fg); + height:var(--scrollbar-size); + width: var(--scrollbar-size); + + display: block; + color:red; + + background-size:contain; + background-position: center; + + &:vertical { + &:decrement:start { + border-left:2rem solid var(--color-bg); + border-bottom:1rem solid var(--color-bg); + @include arrow(180) + } + + &:increment:end { + border-left:2rem solid var(--color-bg); + border-top:1rem solid var(--color-bg); + @include arrow(0) + } + } + &:horizontal { + &:decrement:start { + border-right:1rem solid var(--color-bg); + border-top:2rem solid var(--color-bg); + @include arrow(90) + } + + &:increment:end { + border-left:1rem solid var(--color-bg); + border-top:2rem solid var(--color-bg); + @include arrow(-90) + } + } + +} + +// ::-webkit-resizer { +// border-left:2rem solid var(--color-bg); +// border-top:2rem solid var(--color-bg); +// background:var(--color-fg); +// background-size:contain; +// background-position: 2rem 2rem; +// @include arrow(-45) +// } diff --git a/src/scss/sidepanel.scss b/src/scss/sidepanel.scss new file mode 100644 index 00000000..fc8000ca --- /dev/null +++ b/src/scss/sidepanel.scss @@ -0,0 +1,168 @@ + +#sidepanel { + position:absolute; + z-index: 999999; + width:var(--sidepanel-size); + max-width: calc(100% - 45rem); + min-width: 300rem; + border-top: 2rem solid var(--color-bg); + border-bottom: 2rem solid var(--color-bg); + border-right: 2rem solid var(--color-bg); + top:0; + right:0; + bottom:0; + margin-right:calc(-1 * var(--sidepanel-size)); + background:var(--color-bg); + transition:transform .25s, opacity .25s; + transform: translate3d(0,0,0); + opacity: 0; + box-shadow: 0 0 15rem 0 rgba(black, 0.3); + display: flex; + flex-direction: column; + + #sidepanel-wrapper { + overflow-y: auto; + overflow-x: visible; + display: flex; + flex-direction: column; + flex:1; + } + + &.sidepanel-open { + transform: translate3d(calc(-1 * var(--sidepanel-size)),0,0); + opacity: 1; + } + + &.hide { + z-index: -1; + pointer-events: none; + margin-right: 0; +} + + .navigation { + margin-bottom:2rem; + margin-left: 0; + li { + cursor:default; + } + a { + text-transform: none; + color: var(--color-accent); + justify-content: center; + } + } + + #options { + box-shadow: 0 0 0 1rem var(--color-light) inset; + background: var(--color-fg); + padding: 8rem; + flex: 1 1 auto; + flex-shrink:0; + + li { + display: block; + margin-bottom: 8rem; + &:last-child { + margin-bottom:0; + } + } + } + +} +.actions { + padding:0.5rem; + background:var(--color-bg); + display: flex; + align-items: stretch; + flex-wrap:wrap; + .title { + flex: 1 1 100%; + background: var(--color-fg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + padding: 13rem 10rem; + position: relative; + margin: 0.5rem; + &.disabled { + color:var(--color-text-fade); + } + &:before { + content:""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + box-shadow: 0 0 0 1rem; + color:var(--color-bg); + } + + } + a { + // flex: 4 1 32%; + flex:1; + min-width: 32%; + padding:13rem 10rem; + display: block; + text-align: center; + position: relative; + color:var(--color-text); + overflow: visible; + margin: 0.5rem; + &.narrow { + width: auto; + min-width: 40rem; + flex:0; + } + + + &.on { + z-index: 0; + color: var(--color-custom); + &:not(.toggle) { + pointer-events: none; + } + &:after { + content: ""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.4; + background: radial-gradient( ellipse at center, transparent, var(--color-bg)); + } + &:before { + content:""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.3; + box-shadow: 0 0 0 1rem var(--color-custom) inset; + border-radius: inherit; + } + } + + } +} + +#sidepanel-handle { + width: 6rem; + position: fixed; + top:-1rem!important; + bottom:-1rem!important; + left:-1rem!important; + height: auto!important; + background-color: var(--color-custom); + cursor: col-resize; + transition: opacity .25s; + opacity: 0; + &:hover, &.ui-draggable-dragging { + opacity: 0.2; + } +} + +#sidepanel.resizing { + transition: none; +} diff --git a/src/scss/themes/alt-buttons.scss b/src/scss/themes/alt-buttons.scss new file mode 100644 index 00000000..0ec91df9 --- /dev/null +++ b/src/scss/themes/alt-buttons.scss @@ -0,0 +1,35 @@ +.widget.push-container.on .toggle:before, +.widget.modal-container.on > .toggle:before, +.widget.switch-container .value.on:before, +.widget.switcher-container .value.on:before, +.widget.crossfader-container .value.on:before, +.widget.toggle-container.on:not(.led) .toggle:before { + z-index: 1; + opacity: .5; +} + +.widget.push-container.on, +.widget.modal-container.on, +.widget.switch-container .value.on, +.widget.switcher-container .value.on, +.widget.crossfader-container .value.on, +.widget.toggle-container.on:not(.led) { + background : var(--color-custom); + color: var(--color-bg); + font-weight: 900; +} +.widget.modal-container.on > .label, +.widget.toggle-container.on:not(.led) > .label { + color: var(--color-bg); +} + +.widget.push-container.active:not(.on) > .label { + color: var(--color-custom); +} + + + +.widget.modal-container.on .popup { + color: var(--color-text); + font-weight: 500; +} diff --git a/src/scss/themes/dark.scss b/src/scss/themes/dark.scss new file mode 100644 index 00000000..5175407e --- /dev/null +++ b/src/scss/themes/dark.scss @@ -0,0 +1,46 @@ +$base: #0e1215; +$accent: #1585f6; +$tone: #799; +$text: white; + +:root { + + ////////////////////// COLOR SCHEME + + --color-text: #{transparentize($text, .4)}; + --color-text-fade: #{transparentize($text, .6)}; + + --color-accent: #{$accent}; + --color-grid: #{transparentize($accent, 0.95)}; + + --color-bg: #{$base}; + --color-track: #{desaturate(mix($base, $tone, 95), 2)}; + --color-fg: #161a1d; + --color-raised: #171c20; + --color-light: #{desaturate(transparentize($tone, 0.95), 50)}; + + --color-white: white; + + ////////////////////// AUTO + + --color-custom: var(--color-accent); + + + ////////////////////// GLASS EFFET + + --color-glass: var(--color-accent); + --glass-opacity: 0.03; + + + ////////////////////// MISC + + --nav-height:40rem; + --sidepanel-size:300rem; + --scrollbar-size:20rem; + + --grid-width:10; +} + +.keyboard-container { + --color-black: #555; +} diff --git a/src/scss/themes/default.scss b/src/scss/themes/default.scss index 1001ec15..54e35c3d 100644 --- a/src/scss/themes/default.scss +++ b/src/scss/themes/default.scss @@ -1,42 +1,43 @@ -$font: 'Roboto'; -$font-mono: 'Roboto Mono'; -$font-menu: sans-serif; - -@import '../colors/nord'; +$base: rgb(25, 31, 42); +$accent: rgb(82, 168, 255); +$tone: rgb(104, 174, 245); +$text: white; :root { - --nav-height: 40rem; - --grid-width: 10; + ////////////////////// COLOR SCHEME + --color-text: #{transparentize($text, .4)}; + --color-text-fade: #{transparentize($text, .6)}; - --color-background: #21252b; - --color-ui-foreground: hsl(219, 14%, 23%); - --color-ui-background: hsl(217, 14%, 19%); - --color-ui-button: #{$nord1}; - --color-accent: #6db5fd; + --color-accent: #{$accent}; + --color-grid: #{transparentize($accent, 0.95)}; - --color-text: #{$nord4}; - --color-text-solid: #{$nord6}; + --color-bg: #{$base}; + --color-track: #{desaturate(mix($base, $tone, 95), 2)}; + --color-fg: #{desaturate(mix($base, $tone, 88), 5)}; + --color-raised: #{desaturate(mix($base, $tone, 75), 5)}; + --color-light: #{desaturate(transparentize($tone, 0.90), 50)}; + --color-white: white; - --color-accent: #6db5fd; - --color-error: #{$nord11}; - --color-warning: #{$nord13}; - --color-success: #{$nord14}; - - --color-context-menu: #{$nord6}; - --color-context-menu-text: #{$nord1}; - - - --line-width: 1rem; - - --alpha-scrollbar: 0.25; - --alpha-scrollbar-on: 0.75; - - --color-grid: rgba(0,0,0, 0.1); --color-notification: #{rgba(black, 0.8)}; - --color-widget: var(--color-accent); + ////////////////////// AUTO + + --color-custom: var(--color-accent); + + + ////////////////////// GLASS EFFET + + --glass-opacity: 0.15; + + ////////////////////// MISC + + --nav-height:40rem; + --sidepanel-size:300rem; + --scrollbar-size:20rem; + + --grid-width:10; } diff --git a/src/scss/themes/flat.scss b/src/scss/themes/flat.scss new file mode 100644 index 00000000..0b4f58f9 --- /dev/null +++ b/src/scss/themes/flat.scss @@ -0,0 +1,29 @@ +.toggle-container, +.push-container, +.modal-container { + > .toggle:not(.on):before { + box-shadow: 0 0 0 1rem var(--color-light) inset!important; + } +} + +.switch-container .switch .value, +.switcher-container .switch .value, +.dropdown-container .select select { + box-shadow: 0 0 0 1rem var(--color-light) inset!important; +} + +.toggle-container .toggle.on:after, +.modal-container > .toggle.on:after, +.push-container .toggle.active:after, +.switch-container .switch .value.on:after { + background: var(--color-bg) +} + +.navigation .tablink.on a:before { + background: var(--color-bg); +} + +.widget { + --color-glass-1: var(--color-custom); + --color-glass-2: var(--color-custom); +} diff --git a/src/scss/themes/light.scss b/src/scss/themes/light.scss new file mode 100644 index 00000000..b3e48404 --- /dev/null +++ b/src/scss/themes/light.scss @@ -0,0 +1,51 @@ +$base: rgb(200, 200, 200); +$accent: rgb(0, 200, 200); +$tone: white; +$text: black; + + +:root { + + ////////////////////// COLOR SCHEME + + --color-text: #{transparentize($text, .4)}; + --color-text-fade: #{transparentize($text, .6)}; + + --color-accent: #{$accent}; + --color-grid: #{transparentize($accent, 0.95)}; + + --color-bg: #{$base}; + --color-track: #{desaturate(mix($base, $tone, 40), 2)}; + --color-fg: #{desaturate(mix($base, $tone, 30), 5)}; + --color-raised: #{desaturate(mix($base, $tone, 20), 5)}; + --color-light: #{desaturate(transparentize($tone, 0.90), 50)}; + + --color-white: white; + + ////////////////////// AUTO + + --color-custom: var(--color-accent); + + + ////////////////////// GLASS EFFET + + --glass-opacity: 0.05; + + + ////////////////////// MISC + + --nav-height:40rem; + --sidepanel-size:300rem; + --scrollbar-size:20rem; + + --grid-width:10; +} + +.widget { + --color-glass: white; +} + +.keyboard-container { + --color-black-key: #333; + --color-white-key: #fff; +} diff --git a/src/scss/themes/nord.scss b/src/scss/themes/nord.scss deleted file mode 100644 index 4615906e..00000000 --- a/src/scss/themes/nord.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import 'default'; - -:root { - --color-background: #{$nord0}; - --color-ui-foreground: #{$nord2}; - --color-ui-background: #{$nord1}; - --color-ui-button: #{$nord3}; - --color-accent: #{$nord8}; -} diff --git a/src/scss/themes/orange.scss b/src/scss/themes/orange.scss index 712e486e..1deca745 100644 --- a/src/scss/themes/orange.scss +++ b/src/scss/themes/orange.scss @@ -1,9 +1,36 @@ -@import 'default'; + +$base: #181818; +$accent: #d98533; +$tone: rgb(200, 200, 200); +$text: white; :root { - --color-background: #404040; - --color-ui-foreground: #505050; - --color-ui-background: #4A4A4A; - --color-ui-button: #606060; - --color-accent: #d98533; + + ////////////////////// COLOR SCHEME + + --color-text: #{transparentize($text, .4)}; + --color-text-fade: #{transparentize($text, .6)}; + + --color-accent: #{$accent}; + --color-grid: #{transparentize($accent, 0.95)}; + + --color-bg: #{$base}; + --color-track: #{desaturate(mix($base, $tone, 95), 2)}; + --color-fg: #{desaturate(mix($base, $tone, 88), 5)}; + --color-raised: #{desaturate(mix($base, $tone, 75), 5)}; + --color-light: #{desaturate(transparentize($tone, 0.90), 50)}; + + --color-white: white; + + ////////////////////// AUTO + + --color-custom: var(--color-accent); + + ////////////////////// MISC + + --nav-height:40rem; + --sidepanel-size:300rem; + --scrollbar-size:20rem; + + --grid-width:10; } diff --git a/src/scss/themes/responsive-fonts.scss b/src/scss/themes/responsive-fonts.scss new file mode 100644 index 00000000..3478f358 --- /dev/null +++ b/src/scss/themes/responsive-fonts.scss @@ -0,0 +1,11 @@ +@media screen and (min-width:768px) { + body > * { + font-size: 120% + } +} + +@media screen and (min-width:1024px) { + body > * { + font-size: 140% + } +} diff --git a/src/scss/ui.scss b/src/scss/ui.scss deleted file mode 100644 index 107ca9d5..00000000 --- a/src/scss/ui.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import 'ui/button'; -@import 'ui/scrollbars'; -@import 'ui/workspaces'; -@import 'ui/notifications'; -@import 'ui/grid'; -@import 'ui/inspector'; -@import 'ui/console'; -@import 'ui/tree'; -@import 'ui/dragresize'; -@import 'ui/selectarea'; -@import 'ui/contextmenu'; -@import 'ui/modal'; -@import 'ui/filebrowser'; -@import 'ui/loading'; -@import 'ui/toolbar'; -@import 'ui/launcher'; -@import 'ui/keyboard'; diff --git a/src/scss/ui/button.scss b/src/scss/ui/button.scss deleted file mode 100644 index 2f2bb9be..00000000 --- a/src/scss/ui/button.scss +++ /dev/null @@ -1,20 +0,0 @@ -.btn { - background: var(--color-ui-button); - border: 1rem solid var(--color-background); - display: block; - padding: 0 15rem; - position: relative; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - text-align: center; - padding-top: 1rem; - cursor: pointer; - &.disabled { - pointer-events: none; - opacity: 0.5; - } - &.active { - color: var(--color-accent) - } -} diff --git a/src/scss/ui/console.scss b/src/scss/ui/console.scss deleted file mode 100644 index 492f8e60..00000000 --- a/src/scss/ui/console.scss +++ /dev/null @@ -1,196 +0,0 @@ -$padding: 8rem; - -#osc-console { - background: var(--color-background); - osc-panel-header { - background: var(--color-ui-foreground); - border-top: 1rem solid var(--color-background); - } - .toggle-button { - border-bottom: none; - } - - display: flex; - position: relative; - flex-direction: column; - ::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track-piece { - border-left-color: var(--color-background)!important; - border-top-color: var(--color-background)!important; - } - - .actions { - position: absolute; - right: 0; - padding: $padding; - - div { - cursor: pointer; - color: var(--color-text); - opacity: 0.25; - &:hover { - opacity: 0.5 - } - } - i { - pointer-events: none; - } - } - osc-panel-content { - display: flex; - flex-direction: column; - font-family: $font-mono; - } - -} - -.editor-disabled #osc-console.minimized { - &:after { - // disable hover trap - display: none; - } - > .toggle-button { - // disable toggle button - display: none; - } -} - -osc-console { - height: 100%; - padding: $padding 0; - overflow-y: auto; - border-bottom: 1rem dotted rgba(255,255,255,0.2); - user-select: text; -} - -.editor-enabled osc-console:focus { - outline: 1rem dotted var(--color-accent); - outline-offset: -1rem; -} - -osc-console-message { - - user-select: text; - cursor: text; - display: block; - white-space: pre-line; - position: relative; - padding-left: $padding + 18rem; - padding-right: $padding; - padding-bottom: 6rem; - border-bottom: 1rem dotted rgba(255,255,255,0.1); - &:before { - font-family: FontAwesome; - width: 12rem; - display: inline-block; - text-align: center; - position: absolute; - left: $padding; - } - &.log:before { - content: "\f105\f105" - } - &.error { - color: var(--color-error); - &:before { - content: "x" - } - } - &.input { - &:before { - content: "\f105\f105"; - } - } - &.output { - &:before { - content: "\f104\f104" - } - - &.undefined { - // color: var(--color-text) - opacity: 0.5; - border-bottom: 1rem dotted rgba(255,255,255,0.20); - } - - &.value { - color: var(--color-accent); - opacity: 1; - } - } - - - margin-bottom: 4rem; - - &:last-child { - margin-bottom: 0; - } - - .edit-widget { - cursor: pointer; - display: inline-block; - position: relative; - // padding: 2rem; - border-radius: 2rem; - &.editing { - background: var(--color-ui-foreground); - } - &[data-widget="CONSOLE"] { - cursor: default; - background: none; - padding: 1rem; - } - } - * { - user-select: inherit; - } - - flex:1; -} - -osc-console-input { - display: block; - $field-height: 24rem; - padding-left: 10rem; - - &:before { - content: "\f105\f105"; - font-family: FontAwesome; - width: 16rem; - display: inline-block; - text-align: center; - position: absolute; - left: 0; - line-height: $field-height - 6rem; - padding: 4rem 6rem; - color: var(--color-accent); - } - textarea { - font-family: $font-mono; - - line-height: $field-height - 6rem; - padding: 4rem 16rem; - flex: 1; - overflow-x: auto; - overflow-y: hidden; - resize: none; - white-space: pre; - display: block; - background: var(--color-background); - width: 100%; - cursor: text; - - user-select: initial; - - --scrollbar-size: 6rem; - - // Chromium scrollbar - &::-webkit-scrollbar-thumb:horizontal { - cursor: normal; - } - - // Firefox scrollbar (hidden to preserve height) - scrollbar-width: thin; - &[rows="1"] { - scrollbar-width: none; - } - } -} diff --git a/src/scss/ui/contextmenu.scss b/src/scss/ui/contextmenu.scss deleted file mode 100644 index b4c4e3f4..00000000 --- a/src/scss/ui/contextmenu.scss +++ /dev/null @@ -1,114 +0,0 @@ -$line-height: 30rem; - -.context-menu { - - --widget-padding: 0rem; - --alpha-fill: 1; - - position:fixed; - z-index: 9999999; - background: var(--color-context-menu); - box-shadow: 0 0 0 0.5rem rgba(0, 0, 0, 0.15) inset; - text-transform: none; - color: var(--color-context-menu-text); - font-weight: 500; - font-size: 13rem; - line-height: $line-height; - font-family: $font-menu; - letter-spacing: normal; - padding-top: 3rem; - padding-bottom: 3rem; - - .context-menu { - position: absolute; - left:100%; - top:-3rem; - opacity:0; - pointer-events: none; - margin-left: -1rem; - &:before { - content:""; - position: absolute; - top:0; - bottom:0; - left:-2rem; - width:2rem; - } - } - > .item { - padding-left: 30rem; - padding-right: 30rem; - position:relative; - cursor: pointer; - display: flex; - flex-direction: row; - i { - position: absolute; - left: 10rem; - width: 10rem; - text-align: center; - line-height: $line-height - 2; - font-size: 9rem; - pointer-events: none; - } - &.focus { - > .context-menu { - pointer-events: auto; - opacity: 1; - } - @include pseudo-fill($z: -1); - color: var(--color-context-menu); - } - &.has-sub:before { - content:"\f105"; - display: block; - font-family: FontAwesome; - text-align: right; - margin-right: -20rem; - position: relative; - flex: 1; - order: 1; - margin-left: 10rem; - } - &.disabled { - pointer-events: none; - opacity: 0.5; - } - &.toggle:before { - content: ""; - display: block; - font-family: FontAwesome; - position: absolute; - width: 10rem; - height: 10rem; - left: 10rem; - top: 8rem; - border: 1rem solid; - opacity: 0.75; - line-height: 10rem; - font-size: 8rem; - text-align: right; - } - &.toggle.on:before { - content:"\f00c"; - } - .shortcut { - display: inline-block; - margin-left: 20rem; - margin-right: -20rem; - position: relative; - text-align: right; - position: relative; - flex: 1; - text-transform: capitalize; - opacity: 0.5; - pointer-events: none; - } - } - .separator{ - margin: 2rem 1rem; - height: 1rem; - background-color: var(--color-context-menu-text); - opacity: 0.15; - } -} diff --git a/src/scss/ui/dragresize.scss b/src/scss/ui/dragresize.scss deleted file mode 100644 index 2710ce16..00000000 --- a/src/scss/ui/dragresize.scss +++ /dev/null @@ -1,104 +0,0 @@ -#drag-resize { - - --color-fill: var(--color-accent); - --color-stroke: var(--color-accent); - - position: absolute; - z-index: 99999999; - - top: var(--top); - left: var(--left); - - &:before { - content:""; - position: absolute; - top:0;left:0; - width: calc(var(--width) - 2rem); - height: calc(var(--height) - 2rem); - border: 1rem solid var(--color-accent); - opacity: 0.2; - pointer-events: none; - } - - .helper { - - position: absolute; - top:0; - left:0; - width: var(--width); - height: var(--height); - pointer-events: none; - --alpha-fill: 0.5; - --widget-padding: -1rem; - opacity: 0.5; - display: none; - border: 1rem solid var(--color-stroke); - @include pseudo-fill(); - } - - &.dragging .helper { - display: block; - } - - &.copying { - --color-accent: var(--color-warning); - } - - .handle { - - $size: 10rem; - - position: absolute; - background: var(--color-fill); - width: $size; - height: $size; - border: 2rem solid transparent; - background-clip: content-box; - // opacity: 0.75; - - &.nw { - cursor: move; - } - - &.e { - - top: calc(var(--height) / 2); - left: var(--width); - margin-left: -$size; - margin-top: -$size / 2; - cursor: e-resize; - - } - - &.se { - - top: var(--height); - left: var(--width); - margin-left: -$size; - margin-top: -$size; - cursor: se-resize; - - } - - &.s { - - top: var(--height); - left: calc(var(--width) / 2); - margin-left: -$size / 2; - margin-top: -$size; - cursor: s-resize; - - } - - &.full { - width: var(--width); - height: var(--height); - top: 0; - left: 0; - opacity: 0.1; - z-index: 1; - margin:0; - } - } - -} diff --git a/src/scss/ui/filebrowser.scss b/src/scss/ui/filebrowser.scss deleted file mode 100644 index 13884578..00000000 --- a/src/scss/ui/filebrowser.scss +++ /dev/null @@ -1,99 +0,0 @@ -$padding: 8rem; - -.file-browser { - display: flex; - flex-direction: column; - flex: 1; - overflow: hidden; - - .ariane { - height: 40rem; - flex-shrink: 0; - line-height: 40rem; - padding-left: $padding + 2rem; - padding-right: $padding + 2rem; - background: var(--color-ui-button); - overflow-x: auto; - overflow-y: hidden; - --scrollbar-size: 4rem; - } - .file-list { - overflow-y: auto; - flex:1; - background: var(--color-background); - padding: 0 $padding; - margin: 1rem 0; - } - .file { - position: relative; - height: 40rem; - line-height: 40rem; - input { - position: absolute; - width:100%; - height: 100%; - opacity: 0; - cursor: pointer; - } - .label { - position: absolute; - width:100%; - height: 100%; - pointer-events: none; - white-space: nowrap; - span { - display: block; - width: 100%; - text-overflow: ellipsis; - overflow: hidden; - } - } - input:checked + .label { - color: var(--color-widget); - &:before { - content:""; - position: absolute; - left:-$padding; - right:-$padding; - height: 100%; - background: var(--color-widget); - opacity: 0.1; - } - } - } - .file-actions { - display: flex; - flex-direction: row; - align-items: flex-end; - justify-content: stretch; - height: 42rem + $padding * 2; - line-height: 38rem; - flex-shrink: 0; - // border: $padding solid var(--color-ui-foreground); - padding: $padding; - background: var(--color-ui-foreground); - .btn { - margin: 1rem; - margin-left: $padding; - text-overflow: clip; - min-width: 0; - background: var(--color-ui-button); - } - i { - pointer-events: none; - } - .save-as { - flex:1; - border: 0; - margin: 1rem; - padding: 0 10rem; - font-size: 120%; - position: relative; - background: var(--color-background); - min-width: 0; - &[disabled] { - visibility: hidden; - } - } - } -} diff --git a/src/scss/ui/grid.scss b/src/scss/ui/grid.scss deleted file mode 100644 index 112a4bc4..00000000 --- a/src/scss/ui/grid.scss +++ /dev/null @@ -1,22 +0,0 @@ -.editor-enabled { - &:not(.no-grid) { - .root-container, - .tab-container, - .modal-container, - .panel-container { - > inner { - background-image: linear-gradient(to bottom, var(--color-grid) 1rem, transparent 1rem), - linear-gradient(to right, var(--color-grid) 1rem, transparent 1rem); - --size: calc(var(--grid-width) * 1rem); - background-size: var(--size) var(--size); - background-attachment: local; - background-position: 0rem 0; - } - } - } - - .widget:not(.not-editable) { - pointer-events: initial!important; - } - -} diff --git a/src/scss/ui/inspector.scss b/src/scss/ui/inspector.scss deleted file mode 100644 index e668e72d..00000000 --- a/src/scss/ui/inspector.scss +++ /dev/null @@ -1,810 +0,0 @@ -$header-height: 28rem; -$field-height: 24rem; -$label-width: 94rem; -$padding: 8rem; -$radius: 3rem; - -osc-panel-container.right.editor-breakout { - osc-panel-inner { - contain: initial; - } - .resize-handle { - display: none; - } -} - -#osc-inspector { - - select, input, textarea { - -webkit-appearance:none; - -moz-appearance:none; - appearance:none; - -webkit-user-select: auto; - -moz-user-select: auto; - user-select: auto; - } - - - --widget-padding: -1rem; - - .lock { - osc-inspector-field { - filter: saturate(0); - pointer-events: none; - opacity: 0.65; - } - osc-inspector-field[name=lock] { - filter: none; - pointer-events: auto; - opacity: 1.0; - } - } - - .toolbar { - display: flex; - flex-direction: row; - padding: $padding / 2; - height: 46rem; - position: relative; - top:0; - z-index: 21; - background: var(--color-ui-background); - border-bottom:1rem solid var(--color-background); - .btn { - margin: $padding / 2; - padding: 0 8rem 1rem; - align-items: center; - justify-content: center; - display: flex; - span{ - overflow: hidden; - text-overflow: ellipsis; - } - i { - pointer-events: none; - } - &[data-action="toggle-grid"] { - color: var(--color-accent) - } - &[data-action="reset-selection"] i:after { - content: ""; - position: absolute; - border-left: 1.5rem solid; - left: 50%; - top: 50%; - margin-top: -8rem; - margin-left: -1rem; - height: 16rem; - transform: rotate(45deg); - } - } - [data-action="selected-id"] { - flex: 1; - cursor: default; - } - } - - overflow: hidden; - > .content { - overflow: auto; - flex:1; - height: calc(100% - 46rem); - box-shadow: 0 1rem 0 0 inset rgba(white, 0.025); - - } - -} - -body.no-grid #osc-inspector .toolbar .btn[data-action="toggle-grid"] { - color: inherit; -} - - - -osc-inspector-field { - - display: flex; - flex-direction: row; - line-height: $field-height; - margin-top: -1rem; - position: relative; - - &:after { - content:""; - position: absolute; - left:$label-width; - top:0; - right: 1rem; - border-top:1rem solid var(--color-ui-background); - z-index: 1; - // opacity: 0.5; - } - - --widget-padding: -1rem; - - > label { - width: $label-width; - text-transform: none; - padding-left: 4rem; - padding-right: 4rem; - line-height: $field-height; - height: $field-height; - cursor: pointer; - background: var(--color-ui-foreground); - border:1rem solid var(--color-background); - border-right: none; - border-top-left-radius: inherit; - border-bottom-left-radius: inherit; - } - - &.has-editor { - - flex-direction: column; - height: auto; - border-radius: $radius; - - > label { - border:1rem solid var(--color-background); - border-bottom: none; - width: 100%; - position: relative; - border-top-left-radius: inherit; - border-top-right-radius: inherit; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - } - .btn { - position: absolute; - top:3rem; - background: var(--color-ui-button); - line-height: $field-height - 6; - box-shadow: 0 0 1rem 0 var(--color-background); - border: 0; - } - .fullscreen { - right:3rem; - width: 24rem; - padding-left: 0; - padding-right: 0; - border-top-right-radius: inherit; - } - .help { - right:30rem; - } - &:after { - content:none; - } - - &.fullscreen { - position: fixed; - width:auto; - height: auto; - top:0; - left:0; - right:0; - bottom:0; - padding: 50rem; - margin: 0; - z-index: 99; - background: rgba(black, 0.3); - > label:before { - content: var(--prefix); - } - &.dirty label:after{ - content: "*" - } - .btn { - margin-top: 50rem; - margin-right: 50rem; - &.fullscreen { - color: var(--color-accent); - } - } - .ace_editor { - height: 100%!important; - } - } - } - .ace_editor { - min-height: $field-height; - border-bottom-left-radius: inherit; - border-bottom-right-radius: inherit; - } - > textarea, > input { - font-family: $font-mono; - - line-height: $field-height - 8rem; - padding: 4rem 6rem; - flex: 1; - overflow-x: auto; - overflow-y: hidden; - resize: none; - white-space: pre; - display: block; - background: var(--color-background); - cursor: text; - - &:last-child{ - border-top-right-radius: inherit; - border-bottom-right-radius: inherit; - } - - user-select: initial; - - // hide scrollbar to preserve height - scrollbar-width: thin; - &[rows="1"] { - scrollbar-width: none; - } - - - } - - - .computed-value { - position: absolute; - right: 4rem; - text-align: right; - pointer-events: none; - opacity: 0.5; - font-style: italic; - margin-top: 1rem; - } - -} - -osc-inspector-field .ace_editor { - - color: var(--color-text); - font-size: inherit; - background: var(--color-background); - line-height: 1.3; - border: 1rem solid var(--color-background); - - .ace_gutter { - background: var(--color-background); - color: #6a6f7a; - border-right: 1rem solid var(--color-ui-background); - line-height: 1.5 - } - .ace_print-margin { - display: none; - } - .ace_mobile-menu { - display: none; - } - - .ace_cursor { - color: var(--color-accent); - border-right-width: 2rem; - } - .ace_hidden-cursors .ace_cursor { - opacity: 0; - } - .ace_marker-layer .ace_selection { - background: #3d4350 - } - .ace_multiselect .ace_selection.ace_start { - box-shadow: 0 0 3rem 0 #282c34; - border-radius: 2rem - } - .ace_marker-layer .ace_step { - background: #c6dbae - } - .ace_marker-layer .ace_bracket { - border: none; - border-radius: 0; - margin-top: 1rem; - border-bottom: 1rem solid var(--color-accent) - } - .ace_marker-layer .ace_active-line { - background: rgba(white, 0.05); - } - .ace_gutter-active-line { - background-color: rgba(white, 0.05); - z-index: 99 - } - .ace_marker-layer .ace_selected-word { - border: none; - border-bottom: 1rem solid rgba(white, 0.2); - background: none; - } - .ace_fold { - background-color: #61afef; - border-color: #abb2bf - } - .ace_keyword { - color: #c678dd - } - .ace_keyword.ace_operator { - color: #c678dd - } - .ace_keyword.ace_other.ace_unit { - color: #d19a66 - } - .ace_constant.ace_language { - color: #d19a66 - } - .ace_constant.ace_numeric { - color: #d19a66 - } - .ace_constant.ace_character { - color: #56b6c2 - } - .ace_constant.ace_other { - color: #56b6c2 - } - .ace_support.ace_function { - color: #61afef - } - .ace_support.ace_constant { - color: #d19a66 - } - .ace_support.ace_class { - color: #e5c07b - } - .ace_support.ace_type { - color: #e5c07b - } - .ace_storage { - color: #c678dd - } - .ace_storage.ace_type { - color: #c678dd - } - .ace_invalid { - color: #fff; - background-color: #f2777a - } - .ace_invalid.ace_deprecated { - color: #272b33; - background-color: #d27b53 - } - .ace_string { - color: #98c379 - } - .ace_string.ace_regexp { - color: #e06c75 - } - .ace_comment { - font-style: italic; - color: #5c6370 - } - .ace_variable { - color: #e06c75 - } - .ace_variable.ace_parameter { - color: #d19a66 - } - .ace_meta.ace_tag { - color: #e06c75 - } - .ace_entity.ace_other.ace_attribute-name { - color: #e06c75 - } - .ace_entity.ace_name.ace_function { - color: #61afef - } - .ace_entity.ace_name.ace_tag { - color: #e06c75 - } - .ace_markup.ace_heading { - color: #98c379 - } - .ace_indent-guide { - background: none; - border-right: 1rem solid rgba(white, 0.05); - margin-left: -1rem; - } - .ace_tooltip { - left:$padding + 1!important; - max-width: 80%; - white-space: pre-wrap; - background: var(--color-context-menu); - color: var(--color-context-menu-text); - font-family: $font; - box-shadow: 0 0 0 0.5rem rgba(0, 0, 0, 0.15) inset; - border: none; - border-radius: 0; - } - .ace_gutter { - .ace_info { - background: linear-gradient(rgba(black, 0.5), rgba(black, 0.5)), var(--color-text)!important; - color: var(--color-background); - } - .ace_warning { - background: linear-gradient(rgba(black, 0.5), rgba(black, 0.5)), var(--color-warning); - color: var(--color-background); - } - .ace_error { - background: linear-gradient(rgba(black, 0.4), rgba(black, 0.4)), var(--color-error); - color: var(--color-background); - } - } -} - - -osc-inspector-category { - - margin-top: 1rem; - display: block; - padding: 0 8rem; - - &:first-child { - margin-top: 0 - } - - .category-header { - position: relative; - cursor: pointer; - height: $header-height; - line-height: $header-height - 1; - // padding: 0 8rem; - // position: sticky; - // top:46rem;z-index: 20; - // background: var(--color-ui-background); - font-weight: 500; - @include pseudo-fill($z: -1); - &:after { - left:-($padding - 1); - right:-($padding - 1); - } - - &:before { - position: relative; - font-family: FontAwesome; - content: "\f054"; - width: $field-height; - text-align: left; - display: inline-block; - transform-origin: 2rem 3rem; - width: 8rem; - margin-right: 8rem; - top:1rem; - } - - &:focus, &:active { - text-decoration: underline - } - - } - - .separator { - height: $header-height; - line-height: $header-height - 1; - margin: $padding 0; - position: relative; - padding: 0 ($padding - 4); - font-weight: 500; - &:before { - position: relative; - font-family: FontAwesome; - content: "\f078"; - // color: var(--color-background); - width: $field-height; - text-align: left; - display: inline-block; - transform-origin: 2rem 3rem; - width: 8rem; - margin-right: 12rem; - top: 1rem; - } - &:after { - content: ""; - position: absolute; - height: 100%; - left:-($padding); - right:-($padding); - background: var(--color-ui-foreground); - border-top:1rem solid var(--color-background); - border-bottom:1rem solid var(--color-background); - z-index: -1; - } - } - - osc-inspector-field, .separator { - display: none; - } - --alpha-fill: 1; - --color-fill: var(--color-ui-button); - - &.expanded { - // --alpha-fill: 1; - --alpha-fill: 0.5; - --color-fill: var(--color-widget); - - .category-header:before { - content: "\f078"; - } - osc-inspector-field { - display: flex; - } - .separator { - display: block - } - } - - osc-inspector-field.first-child, - .category-header + osc-inspector-field { - margin-top: $padding + 1; - &:after { - content: none; - } - osc-inspector-checkbox { - border-top: 0; - } - osc-inspector-color:after { - top:0; - } - border-top-left-radius: $radius; - border-top-right-radius: $radius; - .color-picker { - margin-top: 2rem; - } - } - osc-inspector-field.last-child, - osc-inspector-field:last-child { - margin-bottom: 8rem; - - osc-inspector-checkbox { - border-bottom: none; - } - - border-bottom-left-radius: $radius; - border-bottom-right-radius: $radius; - } -} - -osc-inspector-checkbox { - - --widget-padding: 1rem; - --color-fill: var(--color-ui-button); - --alpha-fill: 1; - - line-height: $field-height; - height: $field-height; - width: $field-height; - cursor: pointer; - background: var(--color-background); - text-align: center; - display: flex; - align-items: center; - justify-content: center; - border-top: 1rem solid var(--color-background); - border-bottom: 1rem solid var(--color-background); - border-top-right-radius: inherit; - border-bottom-right-radius: inherit; - - i { - // color: transparent; - opacity: 0.5; - margin-top: -1rem; - margin-left: 1rem; - pointer-events: none; - font-size: 10rem; - } - position: relative; - @include pseudo-fill($z: -1); - z-index: 1; - - &.on { - --color-fill: var(--color-widget); - --alpha-fill: 0.5; - - i { - opacity: 1; - color: var(--color-text-solid); - } - } - -} - -osc-inspector-select { - position: relative; - font-family: $font-mono; - line-height: inherit; - padding: 0; - overflow: hidden; - height: $field-height; - width: $field-height; - background: var(--color-background); - cursor: pointer; - - select { - background: var(--color-background); - // width: 100%; - line-height: $field-height - 8rem; - padding: 4rem 6rem; - - position: absolute; - right:2rem; - width: 127rem; - opacity: 0; - optgroup { - background: var(--color-ui-foreground); - font-weight: bold; - option { - background: var(--color-background); - color: var(--color-text); - margin-left: -4rem; - font-weight: normal; - text-indent: -10rem; - margin: 0; - } - } - } - &:after{ - content:"\f107"; - font-family: FontAwesome; - position: absolute; - line-height: $field-height; - height: $field-height; - width: $field-height; - text-align: center; - right:0; - top:1rem; - font-size: 16rem; - pointer-events: none; - } -} - - -osc-inspector-color { - padding: 0; - border: 0; - box-shadow: 0; - outline: 0; - position: relative; - font-family: $font-mono; - line-height: inherit; - overflow: hidden; - height: $field-height; - width: $field-height; - background: var(--color-background); - border-top-right-radius: inherit; - border-bottom-right-radius: inherit; - - cursor: pointer; - - - - --color-fill: var(--color-picker-value); - --alpha-fill: 1; - --widget-padding: 2rem; - @include pseudo-fill(); - &:after { - border: 1rem solid var(--color-ui-button); - right: 0; - left: 0; - } -} - -.color-picker { - position: absolute; - z-index: 99; - height: calc(var(--sidepanel-size) - #{$label-width} - #{$field-height * 2}); - min-height: 111rem; - max-height: 227rem; - top: 0; - right: 22rem; - left: $label-width; - margin: 3rem 2rem; - display: flex; - flex-direction: column; - $padding: 2rem; - border: 1rem solid var(--color-ui-button); - overflow: hidden; - --point-size: 10rem; - .widget { - background: var(--color-ui-background); - flex: 1; - width: auto; - --widget-padding: 0rem; - inner { - padding: 1rem; - } - .hue { - margin-left: 1rem; - width: 16rem; - --knob-size: 1rem; - } - .alpha { - margin-top: 0.5rem; - left:0; - margin-left: 0; - border:0; - } - .hue:after { - left:0; - right:0; - } - } - -} - -.inspector-help { - - width: 100%; - padding: 8rem; - background: var(--color-background); - overflow: auto; - - p { - } - .error { - color: red; - margin-top: 10rem; - } - em { - font-style: italic; - } - code { - color: var(--color-accent); - padding: 4rem; - background: rgba(black, 0.2); - display: inline-block; - user-select: auto; - cursor: auto; - ::selection{/* reset */} - } - a { - text-decoration: underline; - cursor: pointer; - } - .pre { - white-space: pre; - vertical-align: text-top; - margin-top: -4rem; - position: relative; - padding: 5rem; - user-select: text; - } - - .header p { - margin-bottom: 2rem; - user-select: text; - } - .description { - border-top: 2rem solid var(--color-ui-foreground); - margin-top: 10rem; - padding-top: 10rem; - white-space: normal; - * { - user-select: text; - } - } - - .computed { - border-top: 2rem solid var(--color-ui-foreground); - margin-top: 10rem; - padding-top: 10rem; - - } - - .kbd { - background: var(--color-ui-button); - padding: 4rem; - display: inline-block; - margin-bottom: 2rem; - } - - thead tr { - text-align: left; - font-weight: 500; - height: 30rem; - } -} - - -.editor-enabled.local-zoom-in .root-container, -.editor-enabled.local-zoom-out .root-container { - transform-origin: top left; - transform: scale(var(--local-zoom)); - min-width: calc(100% / var(--local-zoom)); - min-height: calc(100% / var(--local-zoom)); -} - -.editor-enabled.local-zoom-out .root-container.auto-height{ - transform-origin: center left; - -} diff --git a/src/scss/ui/keyboard.scss b/src/scss/ui/keyboard.scss deleted file mode 100644 index fd188868..00000000 --- a/src/scss/ui/keyboard.scss +++ /dev/null @@ -1,185 +0,0 @@ -osc-keyboard { - --spacing: 2rem; - --max-height: 300rem; - --max-width: 1200rem; - - height:calc(33% + 40rem); - z-index: 100; - position: fixed; - bottom: 0; - left:0; - right: 0; - backdrop-filter: blur(12px); - @supports not (backdrop-filter: blur(12px)) { - background: var(--color-ui-background); - } - display: none; - flex-direction: column; - padding: var(--spacing); - align-items: center; - background: rgba(black, 0.25); - max-height: var(--max-height); - border-top: 1rem solid var(--color-background); - - @keyframes keyboard-in { - from {opacity: 0} - to {opacity: 1} - } - @keyframes caret-blink { - to {visibility: hidden} - } - - animation: keyboard-in 0.25s forwards; - - .textarea { - height: auto; - overflow-y: auto; - width: 100%; - height: 40rem; - background: transparent; - padding: 14rem 20rem 4rem; - resize: none; - text-align: center; - vertical-align: middle; - font: inherit; - margin-top:var(---spacing); - position: relative; - pointer-events: auto; - cursor: text; - char { - margin: 0 0.25rem; - position: relative; - } - .newline + char:before, char:first-child:before { - content: " "; - display: block; - position: absolute; - left: -100rem; - width: 100rem; - } - .newline:before, char:last-child:before { - content: " "; - display: block; - position: absolute; - top: 0; - right: -100rem; - width: 100rem; - } - .caret { - &:after { - content: ""; - height: 10rem; - box-shadow: 0 0 0 1rem var(--color-accent); - position: relative; - animation: caret-blink 1.2s steps(2, start) infinite; - pointer-events: none; - } - - } - .select { - background: var(--color-accent); - box-shadow: 0 0 0 1rem var(--color-accent); - color: var(--color-background); - } - &.first-char-caret { - &:before { - content: ""; - height: 10rem; - position: absolute; - box-shadow: 0 0 0 1rem var(--color-accent); - animation: caret-blink 1.2s steps(2, start) infinite; - } - } - } - - .row { - flex-direction: row; - display: flex; - flex: 1; - max-width: var(--max-width); - width: 100%; - &:last-child .key { - margin-bottom: 0; - } - &:first-child { - height: 40rem; - min-height: 40rem; - flex-shrink: 0; - overflow: hidden; - margin-bottom: var(--spacing); - } - } - key { - background: rgba(white, 0.05); - border-color: var(--color-ui-background); - flex: 1; - display: inline-flex; - align-items: center; - justify-content: center; - position: relative; - --alpha-fill: 0.1; - --color-fill: var(--color-accent); - --widget-padding: -1rem; - @include pseudo-fill($z: 1); - margin-right: var(--spacing); - margin-bottom: var(--spacing); - &:last-child{ - margin-right: 0; - } - span { - pointer-events: none; - align-items: center; - justify-content: center; - &.display-default { - display: flex; - } - &.display-shift { - display: none; - } - } - - &.active { - --alpha-fill: 0.3!important; - } - } - - .enter { - --alpha-fill: 0.15; - } - - .tab, .shift { - flex: 1.5; - } - - .enter, .right-shift, .lock, .bksp { - flex: 2; - } - - .sep { - display: none; - } - .sep ~ key { - flex-shrink: 0; - flex-grow: 0; - min-width: 5%; - --alpha-fill: 0.15; - - } - - &.shift { - key { - .display-shift { - display: flex; - } - .display-default { - display: none; - } - } - } - @media screen and (max-width: 800px) { - key { - font-size: 80% - } - } - -} diff --git a/src/scss/ui/launcher.scss b/src/scss/ui/launcher.scss deleted file mode 100644 index 78b05ee2..00000000 --- a/src/scss/ui/launcher.scss +++ /dev/null @@ -1,239 +0,0 @@ -#osc-launcher { - - osc-panel-header { - background-color: var(--color-ui-foreground); - --alpha-fill: .75; - text-align: left; - justify-content: center; - .spacer { - flex: 1; - } - span { - opacity: 0.5; - position: absolute; - right: 12rem; - } - flex-shrink: 0; - } - - flex-direction: column; - - osc-panel-container.main { - background-color: var(--color-ui-foreground); - min-height: 0; - min-height: 40rem; - osc-panel-content { - padding: 8rem; - background-color: var(--color-ui-foreground); - } - } - osc-panel-content { - overflow-y: auto; - flex: 1; - } - - osc-panel-container.bottom { - flex: 1; - padding: 12rem 8rem; - min-height: 100rem; - - &.minimized { - padding: 0; - } - - border-top: 2rem solid var(--color-ui-foreground); - max-height: calc(100% - var(--nav-height)); - background-color: var(--color-background); - osc-panel-inner { - background-color: var(--color-background); - } - - // --color-background: --color-ui-foreground; // scrollbar - } - - osc-panel-inner { - contain: layout style; - } - -} - -osc-settings { - - display: grid; - grid-template-columns: repeat(2, 1fr); - -} -osc-settings-field { - display: flex; - flex-direction: row; - // margin: 1rem; - margin-top:-1rem; - line-height: 22rem; - position: relative; - &:after { - content:""; - position: absolute; - left:100rem; - top:0; - right: 0; - border-top:1rem solid var(--color-ui-foreground); - z-index: 11; - } - &:nth-child(2n) { - margin-left: 8rem; - } - &:nth-child(2), &:nth-child(1) { - margin-top:0; - osc-settings-checkbox, osc-settings-reset, osc-settings-file { - border-top: 0; - } - &:after { - content: none; - } - } - &:nth-last-child(2), &:nth-last-child(1) { - osc-settings-checkbox, osc-settings-reset, osc-settings-file { - border-bottom: 0; - } - } - label { - width: 100rem; - // text-align: right; - background: var(--color-ui-background); - border:1rem solid var(--color-background); - border-right: none; - // margin-right: 8rem; - padding: 0 4rem; - position: relative; - line-height: 22rem; - height: 24rem; - cursor: help; - span { - opacity: 0.5; - } - } - input { - appearance: none; - background: var(--color-background); - flex: 1; - padding: 0 4rem; - width: 100rem; - } - [disabled], [disabled] ~ * { - pointer-events: none; - opacity: 0.75!important; - - } - - &.error label { - color: var(--color-error); - } - &.restart label:after { - content: ""; - position: absolute; - top:1rem; - left:4rem; - right:-4rem; - bottom:0; - background: var(--color-warning); - opacity: 0.25; - border-radius: 4rem; - } -} - -osc-settings-checkbox, osc-settings-reset, osc-settings-file { - @extend osc-inspector-checkbox; - - i { - color: var(--color-text); - opacity: 0.75; - } - &:hover i { - opacity: 1; - } - &.on { - --alpha-fill: 0.5; - i { - color: var(--color-text-solid); - opacity: 1; - } - } - &:last-child { - margin-left: -1rem; - border-left: 0; - } -} - -#osc-terminal { - flex: 1; - line-height: 18rem; - user-select:text; - cursor: auto; - - > div { - margin: 0 12rem; - } - - - * { - user-select:text; - cursor: auto; - white-space: pre-wrap; - } - .log span { - background: transparent!important - } - .help { - font-style: italic; - color: var(--color-accent); - } - - .warning { - color: var(--color-warning); - } - - .error { - color: var(--color-error); - } - - .trace { - position: relative; - height: 18rem; - overflow: hidden; - &.show { - height: auto; - .trace-button:before { - content: "\f078"; - } - } - } - .trace-button { - &:before { - content: "\f054"; - font-size: 10rem; - font-family: FontAwesome; - } - position: absolute; - left: 0; - margin-top: -1rem; - cursor: pointer; - user-select: none; - } - - .qrcode svg { - width: 120rem; - margin-top: 5rem; - margin-left: 15rem; - path[fill="#ffffff"] { - fill: var(--color-text)!important; - } - path[stroke="#000000"] { - stroke: var(--color-background)!important; - } - } - - a { - text-decoration: underline; - cursor: pointer; - } -} diff --git a/src/scss/ui/loading.scss b/src/scss/ui/loading.scss deleted file mode 100644 index 4623731c..00000000 --- a/src/scss/ui/loading.scss +++ /dev/null @@ -1,39 +0,0 @@ - -#loading { - position: fixed; - top:50%; - left:50%; - margin-left:-15rem; - margin-top:-15rem; - text-align: center; -} - -.spinner { - display: block; - margin: 0 auto; - height:36rem; - width:36rem; - border-radius: 50%; - position: relative; - margin: 20rem auto; - - - &:after { - content:""; - position: absolute; - left:-3rem; - top:-3rem; - right:-3rem; - bottom:-3rem; - border:4rem solid var(--color-ui-foreground); - border-top: 2rem solid var(--color-widget); - transform: rotateZ(0deg); - animation: spin .5s linear infinite; - border-radius: 50%; - } -} - -@keyframes spin { - 0% {transform: rotateZ(0deg);} - 100% {transform: rotateZ(360deg);} -} diff --git a/src/scss/ui/modal.scss b/src/scss/ui/modal.scss deleted file mode 100644 index 014a925e..00000000 --- a/src/scss/ui/modal.scss +++ /dev/null @@ -1,109 +0,0 @@ -$padding: 8rem; - -@keyframes popup-backdrop-fade-in { - 0% {opacity: 0} - 100% {opacity: .03} -} - -.popup { - - &:before { - - content: ""; - position: fixed; - top:0rem; - left:0; - right:0; - bottom:0; - background: black; - opacity: .3; - // pointer-events: none; - // animation: popup-backdrop-fade-in .25s forwards; - - } - - // backdrop-filter: blur(1rem); - - position: fixed; - top:0; - left:0; - right:0; - bottom:0; - align-items:center; - justify-content: center; - z-index: 99999999; - display: none; - padding: 20rem; - - &.show { - display: flex; - } - - .popup-title { - position: relative; - min-height: var(--nav-height); - height: var(--nav-height); - display: flex; - padding:0 $padding * 2 - 1; - align-items: center; - background: var(--color-ui-foreground); - .title { - flex:1; - overflow: hidden; - } - > i { - display: block; - margin-right: 10rem; - } - &.closable { - padding-right: 0; - } - .popup-label { - flex:1; - overflow: hidden; - } - .closer { - height: var(--nav-height); - width: var(--nav-height); - flex-shrink: 0; - display: flex; - align-items: center; - justify-content: center; - cursor: pointer; - i { - pointer-events: none; - } - } - } - .popup-wrapper { - background: var(--color-background); - display: flex; - flex-direction: column; - align-items: stretch; - width:auto; - position: relative; - overflow: hidden; - - max-width: 100%; - max-height: 100%; - width: var(--width, 540rem); - height: var(--height, auto); - - .popup-content { - flex:1; - width: auto; - // padding: 2rem $padding $padding; - min-height: 0; - display: flex; - } - - .message { - white-space: normal; - line-height: 150%; - background: var(--color-background); - padding: $padding; - overflow-x: auto; - } - - } -} diff --git a/src/scss/ui/scrollbars.scss b/src/scss/ui/scrollbars.scss deleted file mode 100644 index 1bf8f473..00000000 --- a/src/scss/ui/scrollbars.scss +++ /dev/null @@ -1,4 +0,0 @@ -* { - scrollbar-color: var(--color-scrollbar) var(--color-background); - scrollbar-width: normal; -} diff --git a/src/scss/ui/selectarea.scss b/src/scss/ui/selectarea.scss deleted file mode 100644 index 7d5f0ea6..00000000 --- a/src/scss/ui/selectarea.scss +++ /dev/null @@ -1,72 +0,0 @@ -.select-area { - - position:fixed; - z-index:999999; - border: 1rem solid var(--color-accent); - pointer-events: none; - &:after { - content:""; - position: absolute; - top:0;left:0; - right:0;bottom:0; - background: var(--color-accent); - opacity: 0.2; - } - &.hidden { - display: none; - } - -} - -.widget.editing:after, -.tablink.editing:after, -.modal-container.editing > .popup > .popup-wrapper:after { - content:""; - z-index: 999!important; - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - - border-style: solid; - - -webkit-border-image: linear-gradient(to right, var(--color-accent) 10rem, rgba(0, 0, 0, 0) 10rem, rgba(0, 0, 0, 0) calc(100% - 10rem), var(--color-accent) calc(100% - 10rem)) 1 / 1rem; - -webkit-mask-image: linear-gradient(to bottom, white 10rem, rgba(0, 0, 0, 0) 10rem, rgba(0, 0, 0, 0) calc(100% - 10rem), white calc(100% - 10rem)); - - border-image: linear-gradient(to right, var(--color-accent) 10rem, rgba(0, 0, 0, 0) 10rem, rgba(0, 0, 0, 0) calc(100% - 10rem), var(--color-accent) calc(100% - 10rem)) 1 / 1rem; - mask-image: linear-gradient(to bottom, white 10rem, rgba(0, 0, 0, 0) 10rem, rgba(0, 0, 0, 0) calc(100% - 10rem), white calc(100% - 10rem)); - - pointer-events: none; - box-shadow: none!important; - opacity: 1!important; -} - - - -.widget.editing.editor-blink:after, -.modal-container.editing.editor-blink > .popup > .popup-wrapper:after { - display: block!important; - -webkit-mask-image: none; - mask-image: none; - background-color: var(--color-accent); - opacity: 0.5!important; - animation: editor-blink 0.51s steps(3) infinite; -} - -@keyframes editor-blink { - from {--color-accent: var(--color-warning)} - to {--color-accent: transparent} -} - - -.editor-hide-selection { - #drag-resize { - display: none; - } - .widget.editing:after, - .tablink.editing:after, - .modal-container.editing > .popup > .popup-wrapper:after { - display: none; - } -} diff --git a/src/scss/ui/toolbar.scss b/src/scss/ui/toolbar.scss deleted file mode 100644 index 802a0ece..00000000 --- a/src/scss/ui/toolbar.scss +++ /dev/null @@ -1,43 +0,0 @@ -osc-toolbar { - --size: 34rem; - position: absolute; - top: 0; - left: -1rem; - height:var(--size); - width:var(--size); - max-width:var(--size); - min-width:var(--size); - text-align: center; - z-index: 99999999; - cursor: pointer; - &:after { - content:"\f0c9"; - width: 3rem; - display: inline-block; - overflow: hidden; - font-size:13rem; - font-family: FontAwesome; - line-height: calc(var(--size) + 6rem); - } - - &.on { - &:after { - color: var(--color-widget); - } - } -} - -osc-toolbar#start { - - left: var(--size); - &:after { - font-size: 11rem; - content: "\f04b"; - width: auto; - margin-top:-1rem; - } - &.started:after { - content: "\f04d"; - } - -} diff --git a/src/scss/ui/tree.scss b/src/scss/ui/tree.scss deleted file mode 100644 index 3acb8b0d..00000000 --- a/src/scss/ui/tree.scss +++ /dev/null @@ -1,214 +0,0 @@ -#osc-tree { - - --alpha-fill: 0.5; - --widget-padding: -1rem; - - $padding: 8rem; - $radius: 3rem; - $line-height: 28rem; - $field-height: 30rem; - padding-right: 0; - - text-transform: none; - line-height: $line-height; - - display: flex; - flex-direction: column; - overflow: hidden; - - .tree { - width: 100%; - flex: 1; - position: relative; - overflow: auto; - padding-left:$padding + 4rem; - padding-right:$padding; - border-top:1rem solid var(--color-background); - box-shadow: 0 1rem 0 0 inset rgba(white, 0.025); - padding-top:1rem; - - &::-webkit-scrollbar-thumb, &::-webkit-scrollbar-track-piece { - border-color: var(--color-background)!important; - } - - } - - ol { - - list-style: none; - position: relative; - padding-left: 16rem; - display: inline-block; - min-width: 100%; - - ol:before { - content: ""; - position: absolute; - top: 0; - bottom: $line-height / 2 - 1; - left: -12rem; - border-left: 1rem solid var(--color-stroke); - opacity: 0.25; - pointer-events: none; - } - } - - li { - - position: relative;user-select: none; - > ol { - // display: none; - display: block; - height: 0rem; - - > li { - display: none; - } - } - &.expanded > ol { - display: block; - // min-height: 8rem; - opacity: 1; - height: auto; - > li { - display: list-item; - } - - } - - &.sortable-ghost { - height: 2rem; - margin-bottom: 6rem; - margin-top: 4rem; - color: transparent; - overflow: hidden; - display: list-item!important - } - - > i { - position: relative; - top: 1rem; - left: -2rem; - margin-right: 2rem; - pointer-events: none; - } - - li:before { - content: ""; - position: absolute; - top: $line-height / 2; - left: -27rem; - width: 16rem; - border-bottom: 1rem solid var(--color-stroke); - opacity: 0.25; - pointer-events: none; - } - .container:before { - width: 8rem; - } - - &.invisible { - opacity: 0.5; - font-style: italic; - // &:after { - // content: "\f070"; - // font-family: FontAwesome; - // width: 12rem; - // display: block; - // position: absolute; - // right: -12rem; - // } - } - .fa-lock { - position: relative; - margin-left: 4rem; - top:0; - font-size: 80%; - opacity: 0.8; - } - - } - - .toggle { - &:before { - content: "\f054"; - font-family: FontAwesome; - width: 20rem; - display: block; - position: absolute; - left: -21rem; - font-style: normal; - text-align: center; - } - cursor: pointer; - } - - .container.expanded > .toggle:before { - content: "\f078"; - } - - .editing { - z-index: 1; - @include pseudo-fill($z: -1); - &:after { - left: calc(-1 * var(--depth) * 20rem - #{$padding}); - right: 1rem - $padding; - bottom: auto; - height: $line-height; - top: 0; - } - - &.editor-blink:after { - animation: tree-editor-blink 0.51s steps(3) infinite; - } - @keyframes tree-editor-blink { - from {--color-fill: var(--color-warning)} - to {--color-fill: inherit} - } - } - - .contains-editing:not(.expanded):not(.editing) { - z-index: 1; - @include pseudo-fill($z: -1); - &:after { - left: calc(-1 * var(--depth) * 20rem - #{$padding}); - right: 1rem - $padding; - bottom: auto; - height: $line-height; - opacity: 0.1; - } - } - - - .filter { - display: block; - font-family: $font; - // line-height: $field-height; - padding: 0 $padding; - top: 0; - z-index: 2; - background: var(--color-background); - border: 1rem solid var(--color-background); - margin: $padding; - border-radius: $radius; - } - - .filter-active .filter-hide { - display:none; - } - - .fragment-mode-warning { - color: var(--color-warning); - padding: 0 $padding; - text-align: center; - line-height: $field-height; - background: var(--color-ui-foreground); - border-bottom: 1rem solid var(--color-background); - display: none; - } - -} - -.fragment-mode .fragment-mode-warning { - display: block!important; -} diff --git a/src/scss/ui/workspaces.scss b/src/scss/ui/workspaces.scss deleted file mode 100644 index 7db8b4c0..00000000 --- a/src/scss/ui/workspaces.scss +++ /dev/null @@ -1,390 +0,0 @@ -osc-workspace { - - background: var(--color-ui-foreground); - - --color-fill: var(--color-widget); - --color-stroke: var(--color-widget); - - // optimize layout recalc - position: fixed; - top:0; - left:0; - right:0; - bottom:0; - - display: flex; - flex-direction: row; - - &.vertical { - flex-direction: column; - } - &.horizontal { - flex-direction: row; - } - -} - -osc-panel-container { - - background: var(--color-ui-background); - - position: relative; - display:flex; - flex-direction: column; - - &.vertical { - flex-direction: column; - } - &.horizontal { - flex-direction: row; - } - - &.center { - flex: 1; - z-index: 1; - min-width: 100rem; - } - - &.left, &.right { - z-index: 2; - min-width: 0; - width: 0; - box-shadow: 0 0 0 1rem var(--color-background); - - &.minimized { - box-shadow: none; - } - - &:after { - // hover trap to display toggle-button when closed - content: ""; - position: absolute; - top: 0; - bottom: 0; - width: 1rem; - z-index: 1; - } - - ::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track-piece { - border-color: var(--color-ui-foreground)!important; - } - - } - &.left:after { - right: -1rem; - } - &.right:after { - left: -1rem; - } - - &.bottom, &.top { - z-index: 2; - min-height: 0; - height: 0; - &:after { - // hover trap to display toggle-button when closed - content: ""; - position: absolute; - top: -1rem; - height: 1rem; - left: 0; - right: 0; - z-index: 1; - } - &.top:after { - bottom: -1rem; - top: auto; - } - } - - .resize-handle { - position: absolute; - top: 0; - bottom: 0; - width: 4rem; - cursor: ew-resize; - z-index: 4; - &.right { - left: 0; - } - &.left { - right: 0; - } - &.bottom { - top:0; - left:0; - right:0; - height: 4rem; - width: auto; - cursor: ns-resize; - } - &.top { - top: auto; - bottom:0; - left:0; - right:0; - height: 4rem; - width: auto; - cursor: ns-resize; - } - } - - .toggle-button { - - position: absolute; - top: 50%; - height: 50rem; - width: 25rem; - margin-top: -25rem; - cursor: pointer; - background: var(--color-ui-background); - font-size: 14rem; - z-index: 2; - transition: transform 0.2s ease-out 0.1s, border-color 0.1s ease-out 0.1s; - will-change: transform; - - border-style: solid; - border-width: 1rem; - border-color: transparent; - - &:after { - font-family: FontAwesome; - line-height: 50rem; - width: 25rem; - text-align: center; - display: block; - opacity: 0; - transition: opacity 0.2s ease-out 0s; - } - - &.left { - border-top-right-radius: 25rem; - border-bottom-right-radius: 25rem; - right: -25rem; - transform: translateX(-25rem); - border-left-width: 0; - &:after { - content:"\f104"; - margin-left: -4rem; - } - } - &.right { - border-top-left-radius: 25rem; - border-bottom-left-radius: 25rem; - left: -25rem; - transform: translateX(25rem); - border-right-width: 0; - - - &:after { - content:"\f105"; - margin-left: 4rem; - } - } - - &.bottom { - border-top-left-radius: 25rem; - border-top-right-radius: 25rem; - top: -25rem; - height: 25rem; - width: 50rem; - left: 50%; - margin-left: -25rem; - margin-top: 0; - cursor: pointer; - transform: translateY(25rem); - - &:after { - content:"\f107"; - margin-top: 2rem; - width: 50rem; - height: 25rem; - line-height: 25rem; - - } - } - - &.top { - border-bottom-left-radius: 25rem; - border-bottom-right-radius: 25rem; - top: auto; - bottom: -25rem; - height: 25rem; - width: 50rem; - left: 50%; - margin-left: -25rem; - margin-top: 0; - cursor: pointer; - transform: translateY(- 25rem); - - &:after { - content:"\f106"; - margin-bottom: 2rem; - width: 50rem; - height: 25rem; - line-height: 25rem; - - } - } - - } - - &:hover > .toggle-button, .toggle-button:hover { - transition: transform 0.2s ease-out 0s, border-color 0.3s ease-out 0s; - transform: translateX(0) translateY(0); - border-color: var(--color-background); - &:after { - transition: opacity 0.1s ease-in 0.1s; - opacity: 1; - } - } - - &.minimized .toggle-button { - &.left:after { - content:"\f105"; - } - &.right:after { - content:"\f104"; - } - &.bottom:after { - content:"\f106"; - } - &.top:after { - content:"\f107"; - } - } - - &.disabled { - pointer-events: none; - } - - &.disabled .toggle-button { - display: none; - } - - &.minimized osc-panel-inner { - display: none; - } - -} - -osc-modal-container { - - position: absolute; - top: 0; - left: 0; - right: 0; - -} - -osc-panel-inner { - - display: flex; - flex-direction: column; - flex: 1; - overflow: hidden; - z-index: 3; - min-width: 0; - position: relative; - contain: strict; - -} - -// @keyframes test{ -// 0% { -// transform: scaleX(0); -// opacity: 0; -// } -// 100% { -// transform: scaleX(1); -// opacity: var(--alpha-fill); -// } -// } -// -// osc-panel-container:not(.disabled) osc-panel-header:before { -// animation: test 0.1s forwards; -// -// } - -osc-panel-header { - - --alpha-fill: 0.5; - - display: flex; - height: var(--nav-height); - align-items: center; - align-items: center; - justify-content: center; - position:relative; - letter-spacing: 1rem; - font-size: 109%; - font-weight: 500; - text-overflow: ellipsis; - padding: 0 8rem; - flex-shrink: 0; - background: var(--color-ui-foreground); - - &:before { - content: ""; - position: absolute; - left: 0rem; - right: 0rem; - bottom: 0rem; - // opacity: var(--alpha-fill); - height: 1rem; - background: var(--color-background); - z-index: 101; - } - -} - -osc-panel-content { - - - flex: 1; - overflow-y: auto; - - &.left, &.right { - &::-webkit-scrollbar-thumb, &::-webkit-scrollbar-track-piece { - border-right: 1rem solid var(--color-ui-foreground); - } - } - - -} - -#main { - flex: 1; - min-height: 40rem; - contain: strict; -} - -#osc-greeting-header { - --alpha-fill: 0.75; - span { - opacity: 0.5; - position: absolute; - right: 12rem; - } - &.hidden { - display: none; - + #osc-container { - // optimize layout recalc - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - background: rgba(black, 0.35); - } - } - - &:before { - bottom: 0; - } -} - -#osc-container { - background: var(--color-background); - overflow: auto; -} diff --git a/src/scss/widgets.scss b/src/scss/widgets.scss index 01c432b0..d3c00933 100644 --- a/src/scss/widgets.scss +++ b/src/scss/widgets.scss @@ -1,92 +1,107 @@ -.widget { - font-weight: 500; +.widget { + height:auto; overflow: hidden; position:relative; vertical-align:top; - + box-shadow: 1rem 0 0 0 var(--color-border), + 0 1rem 0 0 var(--color-border), + 1rem 1rem 0 0 var(--color-border), + 0 0 0 1rem var(--color-light) inset; + border-left:1rem solid var(--color-border); + border-top:1rem solid var(--color-border); + -webkit-tap-highlight-color:transparent; display: inline-flex; flex-direction: column; - align-items: stretch; - + --default-bg: var(--color-fg); + background: var(--default-bg); max-width: 100%; max-height: 100%; - width: 100rem; - height: 100rem; - - - contain: strict; - @supports not (contain: strict) { - transform: rotateZ(0); // force new stacking context - } - - -webkit-tap-highlight-color:transparent; - - // transform-origin: top left; - - --line-width: 1rem; - --widget-padding: 1rem; - - --color-stroke:var(--color-widget); - --color-fill:var(--color-widget); - - --alpha-stroke: 0.5; - --alpha-fill-off: 0.0; - --alpha-fill-on: 0.25; - --alpha-fill: var(--alpha-fill-off); - - --alpha-pips: 0.5; - --alpha-pips-text: 0.7; - --border-radius: 0; - - border-radius: var(--border-radius); - - + text-transform: uppercase; + contain: style size layout; color: var(--color-text); - - background-color: transparent; - background-clip: content-box; - + --color-glass-1: var(--color-custom); + --color-glass-2: var(--color-track); &.absolute-position { position: absolute; z-index: 10; } - canvas { - flex: 1; - height: auto; + &.nolabel { + > .label { + display:none; + } + } + + > .label ~ div { + border-top-left-radius:0; + border-top-right-radius:0; + border-bottom-right-radius:inherit; + border-bottom-left-radius:inherit; min-height: 0; - min-width: 0; - } + } + &.nolabel > .label ~ div { + border-radius: inherit; + } - > inner { - overflow: hidden; - position: relative; - flex: 1; - border-radius: inherit; - } - - &.no-interaction { - pointer-events: none; - > * { - pointer-events: none + .label { + text-overflow:ellipsis; + overflow:hidden; + text-align:center; + height:30rem; + max-height:30rem; + padding:0 6rem; + width: 100%; + flex-shrink: 0; + display: flex; + justify-content: center; + white-space: pre; + // justify-content: space-around; + align-items: center; + &.accent { + color:var(--color-accent); } } +} - .html { - text-align: center; - line-height: 30rem; - min-height: 0; +.glass-effect { + position: relative; + &:after { + content:""; + position: absolute; + pointer-events: none; + top:0; + left:0; + right:0; + bottom:0; + background: radial-gradient(ellipse farthest-side at center top, var(--color-glass-1), var(--color-glass-2)); + background-size: 150% 150%; + background-repeat: no-repeat; + background-position: center top; + opacity: var(--glass-opacity); + z-index: 3; } - } -@import 'widgets/basics'; -@import 'widgets/containers'; -@import 'widgets/graphs'; -@import 'widgets/frames'; -@import 'widgets/indicators'; +@import 'widgets/fader'; +@import 'widgets/knob'; + +@import 'widgets/matrices'; +@import 'widgets/patchbay'; @import 'widgets/pads'; -@import 'widgets/sliders'; + +@import 'widgets/plots'; + + +@import 'widgets/toggle'; +@import 'widgets/push'; +@import 'widgets/switch'; +@import 'widgets/menu'; + +@import 'widgets/panel'; + +@import 'widgets/inputs'; + +@import 'widgets/maths'; diff --git a/src/scss/widgets/basics.scss b/src/scss/widgets/basics.scss deleted file mode 100644 index 8d7c3cbd..00000000 --- a/src/scss/widgets/basics.scss +++ /dev/null @@ -1,790 +0,0 @@ -.button-container { - width: 90rem; - height: 60rem; -} -.menu-container, -.dropdown-container, -.input-container, -.file-container { - width: 90rem; - height: 30rem; -} - - -@keyframes osc-button-pulse { - 0% {opacity: var(--alpha-fill-on);} - 100% {opacity: var(--alpha-fill-off);} -} - -.button-container { - - --alpha-fill-off: .15; - --alpha-fill-on: .75; - --widget-padding: -1rem; - --color-text-on: var(--color-background); - - inner { - - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - margin: var(--widget-spacing); - padding: var(--widget-padding); - pointer-events: none; - - - @include pseudo-stroke($z: -1); - @include pseudo-fill($z: -1); - - } - - label { - display: flex; - justify-content: center; - align-items: center; - white-space: pre; - overflow: hidden; - text-align: center; - word-wrap: break-word; - height: 100%; - width: 100%; - border: 2rem solid transparent; - - &.wrap { - white-space: pre-wrap; - word-break: break-all; - } - &.wrap-soft { - word-break: normal - } - &.vertical { - transform: rotate(180deg); - text-overflow: ellipsis; - -webkit-writing-mode:vertical-rl; - writing-mode:vertical-rl; - i { - transform: rotate(180deg); - writing-mode: initial; - } - } - } - - &.on { - - --alpha-fill:var(--alpha-fill-on); - color: var(--color-text-on); - - } - - // &.active { - // - // color: var(--color-text-on); - // - // } - - &.pulse inner:after { - animation: osc-button-pulse .15s 1 forwards; - } - -} - -.switch-container { - - --alpha-fill-off: .15; - --alpha-fill-on: 0.75; - --alpha-fill: var(--alpha-fill-off); - --color-text-on: var(--color-background); - - @include pseudo-stroke(); - &:before { - margin: var(--widget-spacing); - } - - inner { - position: relative; - display: flex; - flex-direction: column; - --widget-spacing: calc(var(--widget-padding) / 2); - margin: calc(var(--widget-spacing) + var(--line-width)); - - - } - - &.padding-0 inner { - // style fix for padding == -1 - margin: 0; - - } - - &.layout-horizontal inner { - - flex-direction: row; - - } - - &.layout-grid inner { - - display:grid; - - } - - - value { - - position: relative; - z-index: 1; - padding: 4rem; - flex: 1; - display: flex; - align-items: center; - justify-content: center; - text-overflow: clip; - overflow: hidden; - - white-space: pre; - text-align: center; - word-wrap: break-word; - - - @include pseudo-fill($z: -1); - &:after { - --line-width: 1rem; - margin: calc(var(--widget-spacing) - 1rem); - } - - &.on { - --alpha-fill: var(--alpha-fill-on); - - color: var(--color-text-on); - } - * { - pointer-events: none; - } - } - - &.layout-vertical value:first-child { - border-top-left-radius: inherit; - border-top-right-radius: inherit; - } - &.layout-vertical value:last-child { - border-bottom-left-radius: inherit; - border-bottom-right-radius: inherit; - } - &.layout-horizontal value:first-child { - border-bottom-left-radius: inherit; - border-top-left-radius: inherit; - } - &.layout-horizontal value:last-child { - border-bottom-right-radius: inherit; - border-top-right-radius: inherit; - } - - &.wrap value { - white-space: pre-wrap; - word-break: break-all; - } - - &.wrap-soft value { - word-break: normal - } - -} - -// @keyframes menu-widget-fade { -// 0% { -// transform: scale(0) -// } -// 100% { -// transform: scale(1) -// } -// } - -.menu-container { - - --alpha-fill-off: .15; - --alpha-fill-on: .75; - --alpha-fill-hover: calc(var(--alpha-fill-on) / 2); - --widget-padding: 1rem; - --text-padding: calc(var(--widget-padding) + 8rem); - - &.no-icon .text { - padding-left: var(--widget-padding); - padding-right: var(--widget-padding); - } - - // z-index: initial!important; - // contain: style size; - - --size: 300rem; - --grid-columns: 2; - - --parent-scroll-x: 0; - --parent-scroll-y: 0; - - overflow: hidden; - - - &.on { - z-index: 9999999999999!important; - contain: size; - overflow: visible; - - // modal-breakout - @supports not (contain: strict) { - transform: none!important; // cancel new stacking context - } - } - - - inner { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - position: relative; - @include pseudo-stroke(); - @include pseudo-fill($z: -1); - - &.text-align-right .text { - justify-content: flex-end; - } - &.text-align-left .text{ - justify-content: flex-start; - } - - - &.menu-align-h-right { - justify-content: flex-end; - } - &.menu-align-h-left{ - justify-content: flex-start; - } - &.menu-align-v-top { - align-items: flex-start; - } - &.menu-align-v-bottom{ - align-items: flex-end; - } - - } - - .text { - flex: 1; - height: 100%; - text-align: center; - display: flex; - justify-content: center; - align-items: center; - padding-left: var(--text-padding); - white-space: pre; - overflow: hidden; - text-align: center; - word-wrap: break-word; - } - .icon { - order: 1; - display: block; - display: flex; - justify-content: center; - align-items: center; - width: 30rem; - height: calc(100% - 2rem); - font-family: FontAwesome; - font-size: 120%; - margin: 1rem 0; - margin-right: var(--widget-padding); - z-index: 1; - &:after { - content:"\f107"; - } - } - - - menu { - - // animation: menu-widget-fade .1s forwards; - position: fixed; - z-index: 999999999; - - transform: translate(calc(-1 * var(--parent-scroll-x)), calc(-1 * var(--parent-scroll-y))); - - overflow: hidden; - - background: var(--color-background); - - @include pseudo-stroke($z: 2); - &:before { - border-width: var(--line-width); - } - - - .item { - white-space: pre; - z-index: 1; - overflow: hidden; - div { - text-align: center; - pointer-events: none; - } - - } - - } - - &.circular menu { - - border-radius: 100%; - width:var(--size); - height:var(--size); - - - &:after { - content:""; - position: absolute; - width: calc(var(--size) / 4 - 12rem); - height: calc(var(--size) / 4 - 12rem); - top:50%; - left: 50%; - margin-left: calc(-1 * var(--size) / 8 + 6rem); - margin-top: calc(-1 * var(--size) / 8 + 6rem); - background: var(--color-background); - box-shadow: 0 0 0 2rem var(--color-background), 0 0 0 3rem var(--color-stroke); - border-radius: 100%; - z-index: 10; - opacity: var(--alpha-stroke); - } - - .item { - top: calc(-1 * var(--size) / 2); - left: calc(-1 * var(--size) / 2); - width: 100%; - height: 100%; - transform-origin: 100% 100%; - position: absolute; - box-shadow: 0 0 0 2rem var(--color-background); - - - div { - position: absolute; - bottom: 0; - right: 0; - &:before { - content:""; - position: absolute; - width: calc(var(--size) / 4); - height: calc(var(--size) / 4); - left: calc(-1 * var(--size) / 8); - top: calc(-1 * var(--size) / 8); - border-radius: 100%; - pointer-events: none; - box-shadow: 0 0 0 calc(var(--size) / 2.7 - 2rem) var(--color-fill); - opacity: 0.075; - } - } - - &.on { - color: var(--color-background); - } - - &.on div:before { - opacity: var(--alpha-fill-on)!important; - } - &.active div:before { - opacity: var(--alpha-fill-hover); - } - - - span { - position: absolute; - top: calc(-1 * var(--size) / 3); - width: calc(var(--size) / 2); - margin-left: calc(-1 * var(--size) / 4); - } - - } - - - } - - &.box menu { - - width:var(--size-box-w); - height:var(--size-box-h); - border-radius: inherit; - display: flex; - - flex-direction: row; - padding: calc(var(--widget-padding) / 2 + var(--line-width)); - - .item { - position: relative; - margin: calc(var(--widget-padding) / 2); - - - div { - @include pseudo-fill($z: -1); - display: flex; - justify-content: center; - align-items: center; - height: 100%; - flex: 1; - &:after { - opacity: 0.075; - margin: 0; - top:0;left:0;right:0;bottom:0; - } - } - - &.on { - color: var(--color-background); - div:after { - opacity: var(--alpha-fill-on)!important; - } - } - - &.active { - div:after, div:after { - opacity: var(--alpha-fill-hover); - } - } - - - } - - } - - &.grid.on menu { - - display: grid; - grid-template-columns: repeat(var(--grid-columns), 1fr); - - .item { - border-radius: inherit; - } - } - - &.vertical menu { - - flex-direction: column; - - .item:first-child { - border-top-left-radius: inherit; - border-top-right-radius: inherit; - } - .item:last-child { - border-bottom-left-radius: inherit; - border-bottom-right-radius: inherit; - } - - } - - &.horizontal menu { - - .item:first-child { - border-bottom-left-radius: inherit; - border-top-left-radius: inherit; - } - .item:last-child { - border-bottom-right-radius: inherit; - border-top-right-radius: inherit; - } - - } -} - - -.dropdown-container { - - --alpha-fill-off: .15; - --alpha-fill-on: .75; - --widget-padding: 1rem; - --text-padding: calc(var(--widget-padding) + 8rem); - - // z-index: initial!important; - // contain: style size; - - --size: 300rem; - --grid-columns: 2; - overflow: hidden; - - &.no-icon .text { - padding-left: var(--widget-padding); - padding-right: var(--widget-padding); - } - - &.on { - z-index: 9999999999999!important; - contain: layout; - overflow: visible; - } - - - inner { - display: flex; - flex-direction: row; - justify-content: center; - align-items: stretch; - position: relative; - @include pseudo-stroke(); - @include pseudo-fill($z: -1); - - &.right .text { - justify-content: flex-end; - } - &.left .text{ - justify-content: flex-start; - } - } - - .text { - flex: 1; - text-align: center; - display: flex; - justify-content: center; - align-items: center; - padding-left: var(--text-padding); - white-space: pre; - overflow: hidden; - text-align: center; - word-wrap: break-word; - } - .icon { - order: 1; - display: block; - display: flex; - justify-content: center; - align-items: center; - width: 30rem; - font-family: FontAwesome; - font-size: 120%; - margin-right: var(--widget-padding); - &:after { - content:"\f107"; - } - } - - select { - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - width: 100%; - -webkit-appearance:none; - -moz-appearance:none; - appearance:none; - background: var(--color-background); - opacity: 0; - } - option.on { - background: var(--color-fill) - } -} - -.editor-enabled { - .dropdown-container select { - // prevent input focus when selecting - pointer-events: none; - } - .clone-container.editing .dropdown-container select, - .dropdown-container.editing select { - // prevent input focus when selecting - pointer-events: auto; - } -} - - - -.input-container { - - --alpha-fill-off: 0.05; - --text-padding: calc(var(--widget-padding) + 8rem); - - inner { - position: relative; - @include pseudo-stroke(); - @include pseudo-fill(0.05); - justify-content: center; - align-items: center; - display: flex; - padding: var(--widget-padding); - text-align: center; - &.right { - text-align: right; - } - &.left { - text-align: left; - } - - padding: 0 var(--text-padding); - - } - - input + canvas { - display: none; - width: 0; - } - - canvas { - flex:1; - max-width: 100%; - height: 100%; - } - - input { - display: block; - flex:1; - max-width: 100%; - font: inherit; - border:0; - padding:0; - background: transparent; - border-radius: inherit; - text-align:inherit; - vertical-align: top; - letter-spacing: 1rem; - caret-color: var(--color-fill); - height: 100%; - -webkit-appearance:none; - -moz-appearance:none; - appearance:none; - -webkit-user-select: auto; - -moz-user-select: auto; - user-select: auto; - &:focus { - color:var(--color-fill); - } - &:focus::selection { - background: var(--color-fill); - color: var(--color-text); - } - - &::-webkit-outer-spin-button, - &::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; - } - - &[type="number"] { - -moz-appearance: textfield; - } - - } - -} - -.textarea-container { - - --alpha-fill-off: 0.05; - --widget-padding: 2rem; - - inner { - position: relative; - @include pseudo-stroke(); - @include pseudo-fill(0.05); - justify-content: center; - align-items: center; - display: flex; - padding: var(--widget-padding); - text-align: center; - &.right { - text-align: right; - } - &.left { - text-align: left; - } - - } - textarea { - background: none; - width: 100%; - height: 100%; - resize: none; - padding: var(--widget-padding); - -webkit-appearance:none; - -moz-appearance:none; - appearance:none; - -webkit-user-select: auto; - -moz-user-select: auto; - user-select: auto; - } -} - -.editor-enabled { - .textarea-container textarea, - .input-container inner { - // prevent input focus when selecting - pointer-events: none; - } - .clone-container.editing .textarea-container textarea, - .textarea-container.editing textarea, - .clone-container.editing .input-container inner, - .input-container.editing inner { - // prevent input focus when selecting - pointer-events: auto; - } -} - - -.file-container { - - --alpha-fill-off: .15; - --alpha-fill-on: .75; - --widget-padding: 1rem; - --text-padding: calc(var(--widget-padding) + 8rem); - - inner { - flex:1; - display: flex; - flex-direction: row; - justify-content: center; - align-items: stretch; - position: relative; - @include pseudo-stroke(); - @include pseudo-fill($z: -1); - - &.right .text { - justify-content: flex-end; - } - &.left .text{ - justify-content: flex-start; - } - } - - .text { - flex: 1; - text-align: center; - display: flex; - justify-content: center; - align-items: center; - padding-left: var(--text-padding); - min-width: 0; - overflow: hidden; - } - - &.hide-path .text { - display: none; - } - - .icon { - order: 1; - display: block; - display: flex; - justify-content: center; - align-items: center; - width: 30rem; - font-family: FontAwesome; - font-size: 120%; - margin-right: var(--widget-padding); - &:after { - content:"\f07c"; - } - } - - &.save .icon:after { - content:"\f0c7"; - } - -} diff --git a/src/scss/widgets/containers.scss b/src/scss/widgets/containers.scss deleted file mode 100644 index f10598c4..00000000 --- a/src/scss/widgets/containers.scss +++ /dev/null @@ -1,757 +0,0 @@ -.panel-container { - width: 200rem; - height: 200rem; -} -.modal-container { - width: 90rem; - height: 60rem; -} -.keyboard-container { - width: 220rem; - height: 90rem; -} -.patchbay-container { - width: 240rem; - height: 160rem; -} - - -.widget-panel-base { - - --widget-padding: 4rem; - - background-color: var(--color-background); - - - > inner { - overflow: auto; - scroll-behavior: auto!important; // smooth mode breaks scrollbar widget - } - - - - &.hidden-scroll > inner { - scrollbar-width: none; - } - - &.no-scroll > inner { - overflow: hidden; - } - - &.contains-widgets { - - > inner { - --widget-spacing: calc(var(--widget-padding) / 2); - margin: var(--widget-spacing); - } - - &.no-inner-padding > inner { - margin: calc(var(--widget-spacing) * -1); - } - - > inner > .widget { - padding: var(--widget-spacing); - } - - &.layout-default > inner { - display: block; - } - &.layout-horizontal > inner { - display: flex; - flex-direction: row; - align-items: stretch; - > .widget { - top:auto!important; - left:auto!important; - position: relative!important; - height: auto!important; - min-height: auto!important; - max-height: 100%; - } - > .flex-expand { - flex: 1 - } - } - - &.layout-horizontal.layout-contain > inner > .widget { - min-width: auto!important; - max-width: 100%; - } - - &.layout-vertical > inner, - &.layout-vertical .folder-container > inner { - display: flex; - flex-direction: column; - align-items: stretch; - > .widget { - top:auto!important; - left:auto!important; - position: relative!important; - width: auto!important; - min-width: auto!important; - max-width: 100%; - } - > .flex-expand { - flex: 1 - } - } - &.layout-vertical.layout-contain > inner > .widget { - min-height: auto!important; - max-height: 100%; - } - - &.layout-grid > inner, - &.layout-grid .folder-container > inner { - display: grid; - > .widget { - top:auto!important; - left:auto!important; - position: relative!important; - height: auto!important; - width: auto!important; - min-height: auto!important; - max-height: auto!important; - min-width: auto!important; - max-width: auto!important; - } - } - - } - - - &.contains-tabs { - - > inner { - - --widget-spacing: 0; - - display: flex; - flex-direction: column; - // overflow: hidden; - - > .widget { - flex: 1; - width: 100%; - height: auto; - padding: 0; - } - } - - &.tabs-left > inner { - flex-direction: row; - } - - &.tabs-right > inner { - flex-direction: row-reverse; - } - - &.tabs-bottom > inner { - flex-direction: column-reverse; - } - - &.tabs-hidden > inner > .navigation { - display: none; - } - - } - -} - -.tab-container { - @extend .widget-panel-base; - - // --widget-padding: 0rem; - --alpha-fill-on: 0.75; - - width: 100%; - height: 100%; - background-color: var(--color-background); - - &:not(.show) { - display:none - } - -} -.tab-container.editing { - z-index: initial!important; - &:after { - display:none; - } -} -.tablink.editing:after { - margin: 2rem 2rem 4rem; -} -.tabs-left > .tablink.editing:after, -.tabs-right > .tablink.editing:after { - margin: 2rem 4rem 2rem 2rem; -} - - -.panel-container { - - @extend .widget-panel-base; - - --alpha-fill-on: 0.75; - - @include pseudo-stroke($z: 1); - &:before { - margin: var(--widget-spacing); - } - - &.contains-tabs { - > inner { - margin: calc(var(--line-width)); - } - } - - &.contains-widgets { - - > inner { - margin: calc(var(--widget-spacing) + var(--line-width)); - } - - &.no-inner-padding > inner { - margin: calc(var(--widget-spacing) * -1); - } - } - - -} - -.folder-container { - display: contents; - overflow: visible; - contain: unset; - min-width: 0; - width: 0; - min-height: 0; - height: 0; - padding: 0; - margin: 0; - > inner { - display: contents!important; - padding: 0; - } -} - -.root-container { - - @extend .widget-panel-base; - - --alpha-fill-on: 0.75; - - width: 100%; - height: 100%; - - // optimize layout recalc - &.auto-height { - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - } - - > inner { - margin: var(--widget-spacing); - - // optimize layout recalc - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - } - - margin: auto; - -} - -.root-container.editing { - &:after { - display:none; - } -} - - - -.navigation { - - background-color: var(--color-ui-foreground); - - height:var(--nav-height); - flex-shrink:0; - display: flex; - // padding-bottom: 1rem; - position: relative; - border-bottom: 1rem solid var(--color-background); - - &:before { - content:""; - position: absolute; - // border-bottom: 1rem solid var(--color-stroke); - opacity: var(--alpha-stroke); - left: 0; - right: 0; - bottom: 0; - } - - div { - - // --color-stroke:var(--color-widget); - --color-fill:var(--color-widget); - - color: var(--color-text); - - line-height:calc(var(--nav-height) - 1rem); - display:flex; - min-width:0; - flex: 1 1 100%; - cursor:pointer; - height:100%; - align-items: center; - align-items: center; - justify-content: center; - position:relative; - letter-spacing: 1rem; - font-size: 109%; - text-overflow: ellipsis; - padding: 0 8rem; - overflow: hidden!important; - white-space: pre-wrap; - text-align: center; - - border-right: 1rem solid var(--color-background); - - i { - pointer-events: none; - position: relative; - } - - &.on { - z-index: 1;overflow: visible; - background: var(--color-ui-background); - &:before { - content: ""; - position: absolute; - left: 0rem; - right: 0rem; - bottom: 0rem; - opacity: var(--alpha-fill-on); - height: 2rem; - background: var(--color-fill); - z-index: 101; - } - - - } - } - &.tabs-top, &.bottom { - div { - &:last-child { - border-right: 0; - } - &:first-child:before { - margin-left: 1rem; - } - &:last-child:before { - margin-right: 1rem; - } - } - } - - - &.tabs-left, &.tabs-right { - flex-direction: column; - height: 100%; - padding-bottom: 0; - border-bottom: none; - // padding-right: 1rem; - border-right: 1rem solid var(--color-background); - - div { - height: 100%; - padding: 0 12rem; - line-height: normal; - border-right: none; - border-bottom: 1rem solid var(--color-background); - - // justify-content: flex-start; - // text-align: left; - - &.on:before { - content: ""; - position: absolute; - left: auto; - top: 0rem; - right: 0rem; - bottom: 0rem; - opacity: var(--alpha-fill-on); - width: 2rem; - height: auto; - background: var(--color-fill); - z-index: 101; - } - - &:last-child { - border-bottom:0 - } - &:first-child:before { - margin-top: 1rem; - } - &:last-child:before { - margin-bottom: 1rem; - } - } - } -} - - -.clone-container, .fragment-container { - - &.empty { - @include pseudo-stroke(); - &:before { - margin: var(--widget-spacing); - } - } - - &:before { - content: none - } - - > .clone, - > .fragment { - - --widget-spacing: 0; - flex: 1; - position: relative; - - > .widget { - border:0!important; - box-shadow: none!important; - // on ios, relative position + 100% size and auto position - // does not work well in flex panels - position: absolute!important; - left:0!important; - bottom:0!important; - right:0!important; - top: 0!important; - width: auto!important; - height: auto!important; - min-height: initial!important; - max-height: initial!important; - min-width: initial!important; - max-width: initial!important; - padding: 0!important; - } - } - - &.modal-breakout { - overflow: visible; - } -} - - - -.modal-container { - - --widget-padding: -1rem; - --popup-padding: 4rem; - - --color-text-on: var(--color-background); - --alpha-fill-off: 0.15; - --alpha-fill-on: .75; - - > .toggle { - - // --widget-padding: -1rem; - - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - margin: var(--widget-spacing); - flex: 1; - display: flex; - flex-direction: column; - border-radius: inherit; - - @include pseudo-stroke(); - @include pseudo-fill($z: -1); - - } - - > label { - display: flex; - justify-content: center; - align-items: center; - white-space: pre; - overflow: hidden; - text-align: center; - word-wrap: break-word; - height: 100%; - width: 100%; - border: 2rem solid transparent; - } - - &.on { - - > .toggle { - --alpha-fill:var(--alpha-fill-on); - z-index: 1; - } - > label { - color: var(--color-text-on); - z-index: 2; - } - - overflow: visible; - - contain: size; - @supports not (contain: strict) { - transform: none; // cancel new stacking context - } - - } - - - - - - - > inner { - display: none; - } - - &.no-inner-padding > .popup > .popup-wrapper > .popup-content > inner { - margin: calc(var(--widget-spacing) * -1); - } - &.modal-breakout > .popup > .popup-wrapper > .popup-content { - @extend .modal-breakout; - } - - - > .popup { - padding:0; - z-index: 9999999999999!important; - - > .popup-wrapper { - width: var(--width, 100%); - height: var(--height, 100%); - - > .popup-content { - // contain:unset; // == no restrain - padding: 0; - --widget-padding: var(--popup-padding); - - &:before { - content: none; - } - - > inner { - margin: var(--widget-spacing); - } - } - } - - &.no-label > .popup-wrapper > .popup-title { - display: none; - } - - &.x-positionned { - justify-content: flex-start; - > .popup-wrapper { - left: var(--left); - } - } - &.y-positionned { - align-items:flex-start; - > .popup-wrapper { - top: var(--top); - } - } - - } - - --parent-scroll-x:0; - --parent-scroll-y:0; - &.relative { - > .popup { - left: auto; - right: auto; - top: auto; - bottom: auto; - width: var(--width, 100%); - height: var(--height, 100%); - margin-top: calc(-1 * var(--widget-spacing) - var(--parent-scroll-y)); - margin-left: calc(-1 * var(--widget-spacing) - var(--parent-scroll-x)); - padding: var(--widget-spacing); - align-items:flex-start; - justify-content: flex-start; - } - } - -} - -.modal-breakout { - z-index: initial!important; - contain: size!important; - @supports not (contain: strict) { - transform: none!important; // cancel new stacking context - } -} - - - -.matrix-container { - - @extend .panel-container; - - - &.layout-vertical, &.layout-horizontal { - > inner > .widget { - flex: 1; - } - } - -} - - -.patchbaynode-container { - - justify-content: center; - flex: 1; - background: transparent; - -} -.patchbay-container { - - --alpha-fill-on: .75; - --alpha-fill-off: 0.25; - - inner { - display: flex; - flex-direction: row; - - @include pseudo-stroke(); - padding: var(--widget-padding); - - canvas { - flex: 1; - width: 0; - } - .nodes { - display: flex; - flex-direction: column; - align-items:stretch; - margin-bottom: var(--line-width); - width: 25%; - } - - .inputs, .outputs { - position: relative; - @include pseudo-stroke(); - top: var(--line-width); - margin-top: -1rem; - height: calc(100% - var(--line-width) * 2 + 2rem); - } - - .inputs:before { - border-width: 0 var(--line-width) 0 0; - } - .outputs:before { - border-width: 0 0 0 var(--line-width); - } - } - - label { - display: flex; - justify-content: center; - align-items: center; - white-space: pre; - line-height: 100%; - overflow: hidden; - text-align: center; - word-wrap: break-word; - height: 100%; - width: 100%; - border: 2rem solid transparent; - pointer-events: none; - } - -} - - -.keyboard-container { - - --widget-padding: 0rem; - --alpha-fill-off: 0; - --alpha-fill-on: .75; - - --color-key-on: var(--color-fill); - --alpha-key-off: var(--alpha-fill-off); - --alpha-key-on: var(--alpha-fill-on); - --color-white-key: #ccc; - --color-black-key: #1A1A1A; - - --widget-keypad: calc(var(--widget-padding) + var(--line-width)); - - > inner { - - padding: calc(var(--widget-padding) + var(--line-width)); - flex: 1; - @include pseudo-stroke($z: 2); - position: relative; - display: flex; - flex-direction: row; - overflow: hidden; - } - - .key { - - --alpha-fill-off: var(--alpha-key-off); - --alpha-fill-on: var(--alpha-key-on); - --line-width: 0!important; - inner { - margin: 1rem 0.5rem!important; - --widget-padding: -1rem; - &:before { - content: none; - } - &:after { - background: var(--color-key-on); - z-index: 1; - } - } - } - - .white { - flex: 1; - width: auto; - min-width: auto; - height: auto; - inner { - background: var(--color-white-key); - } - } - - .black { - position: absolute; - z-index: 1; - - left: calc((100% - var(--widget-keypad) * 2) / var(--nkeys) * var(--rank)); - width: calc(100% / var(--nkeys) * 0.6); - margin-left: calc(100% / var(--nkeys) * -0.3 + var(--widget-keypad)); - height: calc((100% - var(--widget-keypad) * 2) * 0.65); - - inner { - margin-left: 0!important; - margin-right: 0!important; - margin-bottom: 0!important; - background: var(--color-black-key); - } - } - -} diff --git a/src/scss/widgets/fader.scss b/src/scss/widgets/fader.scss new file mode 100644 index 00000000..c4943503 --- /dev/null +++ b/src/scss/widgets/fader.scss @@ -0,0 +1,501 @@ +.fader-container { + // note: ios doesn't trim css variables defined as follow + // we must avoid space after ":" otherwise it breaks the canvas colors + --color-pips:var(--color-custom); + --color-gauge:var(--color-custom); + --color-knob:var(--color-custom); + --gauge-width: 2; + padding: 1rem; + width:100rem; + height:300rem; + &.horizontal { + height:130rem; + width:300rem + } +} + +.panel:not(.tab) > .fader-container { + padding: 0rem; + --color-border:transparent; + > .fader.compact { + padding: 1rem; + } + > .fader.compact > .wrapper { + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} + +.fader { + height:100%; + overflow: hidden; + display: flex; + flex-direction: column; + position: relative; + flex: 1; + > .input { + height: 25rem; + flex:initial!important; + flex-shrink: 0!important; + display: block; + background: transparent!important; + border: 0!important; + } + + .wrapper { + overflow: hidden; + flex: 1 1 100%; + max-height: 100%; + width: 100%; + position: relative; + display: flex; + justify-content: center; + border-radius: inherit; + touch-action: none; + + > * { + pointer-events: none; + } + + > canvas { + width: 20rem; + image-rendering:pixelated; + position: relative; + z-index: 1; + } + + .meter-container { + height: auto; + width:6rem!important; + min-width: auto; + flex-grow: 0; + --color-border:transparent; + border:0; + margin: 20rem 6rem 20rem 0; + order: -1 + } + + .pips { + width: 35rem; + // background-color: var(--color-light); + position: relative; + margin: 23rem 0rem 21rem -10rem; + z-index: 0; + + .pip { + height:1rem; + // background: var(--color-track); + color:var(--color-fg); + position: absolute; + left:0; + + &:before { + content:""; + position: absolute; + top:0; + left:-12rem; + width:5rem; + bottom:0; + background: var(--color-custom); + opacity: 0.5; + box-shadow: 0 0 0 1rem var(--color-bg), + 0 0 0 2rem var(--color-light); + } + &:after { + content:""; + position: absolute; + top:0; + left:7rem; + width:5rem; + bottom:0; + background: var(--color-custom); + opacity: 0.5; + box-shadow: 0 0 0 1rem var(--color-bg), + 0 0 0 2rem var(--color-light); + } + + span { + position: absolute; + width:30rem; + display: block; + text-align: center; + font-size:90%; + line-height: 12rem; + left:15rem; + top:-5.5rem; + color:var(--color-text-fade); + text-transform: none; + } + } + } + + } + + &.align-right { + .wrapper { + flex-direction: row-reverse; + .meter-container { + margin: 20rem 0rem 20rem 6rem; + } + .pips { + margin: 23rem -10rem 21rem 0rem; + // margin: 23rem 5rem 21rem 12rem; + // background-position: top right; + .pip { + right:0; + left:auto; + // margin-bottom: 0; + span { + right:15rem; + left:auto; + } + } + } + } + } + + &.horizontal { + .wrapper { + flex-direction: column; + > canvas { + width: auto; + height: 20rem; + } + + .meter-container { + width: auto!important; + height:6rem; + min-height: auto; + margin: 0 20rem 6rem 20rem; + } + + .pips { + width:auto; + height: 25rem; + margin: -10rem 22rem 0 22rem; + .pip { + width:1rem; + height:5rem; + &:before { + left:0; + top:-12rem; + height:5rem; + right:0; + width:1rem; + } + &:after { + left:0; + top:7rem; + height:5rem; + right:0; + width:1rem; + } + span { + top:20rem; + left:-14rem!important; + right:auto; + } + + } + } + } + } + + &.compact { + .wrapper { + border: 1rem solid var(--color-bg); + > canvas { + flex: 1 1 100%; + background: var(--color-track); + order:1; + } + .meter-container { + order:3; + margin: 0; + border: 0; + box-shadow: none; + padding: 0; + .fader { + border: 0; + border-left: 1rem solid var(--color-bg); + .wrapper { + border: 0; + } + } + .pips { + display: none; + } + } + > .pips { + overflow: hidden; + margin: 0; + order:2; + background: var(--color-track); + border:0; + border-left: 1rem solid var(--color-bg); + width: 3rem; + .pip { + left:0; + right: 0; + span { + display: none; + } + &:before { + content:none; + } + &:after { + left:0; + right: 0; + box-shadow: none; + opacity: 1; + } + &:not(:last-child):not(:first-child) { + margin-bottom: -1rem; + } + } + } + } + + &.align-right { + .wrapper { + .meter-container { + .fader { + border: 0; + border-right: 1rem solid var(--color-bg); + } + } + .pips { + border:0; + border-right: 1rem solid var(--color-bg); + } + } + } + + + --input-margin:0rem; + &.has-meter { + --input-margin:-3rem; + } + &.has-pips { + --input-margin:-1rem; + } + &.has-meter.has-pips { + --input-margin:-4rem; + } + + .input { + pointer-events: none; + position: absolute; + border:0; + background:transparent; + overflow: hidden; + position: absolute; + top:50%; + left:50%; + z-index: 1; + } + + &.horizontal { + position:relative; + + .wrapper { + .meter-container { + .fader { + border: 0; + border-top: 1rem solid var(--color-bg); + } + } + } + + .input { + width: 100rem; + height: 24rem; + margin-left: -50rem; + margin-top: calc(-1 * 12rem + var(--input-margin)); + } + + .pips { + height: 3rem; + border:0; + border-top: 1rem solid var(--color-bg); + width: 100%; + .pip { + margin: 0; + &:last-child { + left:auto!important; + right:0; + } + &:after { + top:0; + width: 1rem; + } + } + } + } + + &:not(.horizontal) { + .input { + height: 100rem; + width: 100rem; + margin-top: -50rem; + margin-left: calc(-1 * 50rem + var(--input-margin)); + z-index: 3; + input { + transform: rotate(-90deg); + width: 100rem; + } + } + + &.align-right { + .input { + margin-left: calc(-1 * 50rem - var(--input-margin)); + } + } + + .pips { + .pip:last-child { + top:0; + } + } + } + + + + } + + +} + + +.range-container { + width:100rem; + height:300rem; + &.horizontal { + height:130rem; + width:300rem + } + padding: 1rem; + --color-pips: var(--color-custom); + --color-gauge: var(--color-custom); + --color-knob: var(--color-custom); + .range { + height:100%; + overflow: hidden; + display: flex; + position: relative; + flex-direction: column; + flex: 1; + > .input { + height: 25rem; + flex:initial!important; + flex-shrink: 0!important; + // display: block; + background: transparent!important; + border: 0!important; + } + > .wrapper { + overflow: hidden; + flex: 1 1 100%; + max-height: 100%; + width: 100%; + position: relative; + display: flex; + justify-content: center; + border-radius: inherit; + .fader { + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + pointer-events: none; + .wrapper { + // border: 0; + } + &:first-child { + opacity: 0; + } + } + } + &.compact { + > canvas { + background: var(--color-track); + } + } + + + + &.compact { + + --input-margin:0rem; + &.has-meter { + --input-margin:-3rem; + } + &.has-pips { + --input-margin:-1rem; + } + &.has-meter.has-pips { + --input-margin:-4rem; + } + + .input { + pointer-events: none; + position: absolute; + border:0; + background:transparent; + overflow: hidden; + position: absolute; + top:50%; + left:50%; + z-index: 1; + } + + &.horizontal { + + .input { + width: 100rem; + height: 24rem; + margin-left: -50rem; + margin-top: calc(-1 * 12rem + var(--input-margin)); + } + + } + + &:not(.horizontal) { + .input { + height: 100rem; + width: 100rem; + margin-top: -50rem; + margin-left: calc(-1 * 50rem + var(--input-margin)); + z-index: 3; + input { + transform: rotate(-90deg); + width: 100rem; + } + } + + &.align-right { + .input { + margin-left: calc(-1 * 50rem - var(--input-margin)); + } + } + } + + } + + } +} + +.panel:not(.tab) > .range-container { + padding: 0rem; + --color-border:transparent; + .fader.compact { + padding: 1rem; + } + .fader.compact > .wrapper { + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} diff --git a/src/scss/widgets/frames.scss b/src/scss/widgets/frames.scss deleted file mode 100644 index 781e6d5c..00000000 --- a/src/scss/widgets/frames.scss +++ /dev/null @@ -1,34 +0,0 @@ -.image-container, -.html-container, -.svg-container, -.frame-container { - - width: 120rem; - height: 120rem; - - inner { - position: relative; - flex: 1; - display: flex; - padding: calc(var(--widget-spacing) + var(--line-width)); - background-clip: content-box; - @include pseudo-stroke(); - } - - .frame { - position: relative; - width: 100%; - flex: 1; - } - -} - -.frame-container { - iframe[src=""] { - pointer-events: none; - } -} - -.editor-enabled .frame-container iframe { - pointer-events: none; -} diff --git a/src/scss/widgets/graphs.scss b/src/scss/widgets/graphs.scss deleted file mode 100644 index 016b2c4f..00000000 --- a/src/scss/widgets/graphs.scss +++ /dev/null @@ -1,27 +0,0 @@ -.eq-container, -.visualizer-container, -.plot-container { - - width: 200rem; - height: 200rem; - - --alpha-fill-off: 0.05; - --alpha-fill-on: 0.1; - --widget-padding: 20rem; - - inner { - position: relative; - flex: 1; - display: flex; - - @include pseudo-fill($z: -1); - @include pseudo-stroke(); - // padding: var(--widget-padding); - } - - canvas { - // margin: var(--widget-padding); - width: 100%; - } - -} diff --git a/src/scss/widgets/indicators.scss b/src/scss/widgets/indicators.scss deleted file mode 100644 index f6b8a3c2..00000000 --- a/src/scss/widgets/indicators.scss +++ /dev/null @@ -1,105 +0,0 @@ -.led-container { - - width: 30rem; - height: 30rem; - - --color-led: var(--color-fill); - --alpha-fill-off: 0; - --alpha-fill-on: 1; - - will-change: --opacity; - - inner { - - - --color-fill: var(--color-led); - --alpha-fill: calc(var(--alpha-fill-off) + var(--opacity) * (var(--alpha-fill-on) - var(--alpha-fill-off))); - - position: relative; - flex: 1; - padding: --widget-padding; - - @include pseudo-stroke(); - @include pseudo-fill(); - - &:before, &:after { - border-radius: var(--border-radius); - will-change: opacity; - } - } - -} - -.text-container { - - width: 90rem; - height: 60rem; - - --alpha-stroke: 0; - --alpha-fill-off: 0.1; - --alpha-fill-on: 1; - --widget-padding: -1rem; - --text-padding: calc(var(--widget-padding) + 8rem); - - inner { - @include pseudo-stroke(); - @include pseudo-fill($z: -1); - - padding: var(--widget-padding); - - display: flex; - width: 100%; - - } - - label { - - opacity: var(--alpha-fill-on); - width: 100%; - height: 100%; - display: flex; - justify-content: center; - align-items: center; - white-space: pre; - line-height: 100%; - overflow: hidden; - text-align: center; - word-wrap: break-word; - padding: var(--text-padding); - - &.right { - text-align: right; - justify-content: flex-end; - } - &.left { - text-align: left; - justify-content: flex-start; - } - &.top { - align-items: flex-start; - } - &.bottom { - align-items: flex-end; - } - &.wrap { - white-space: pre-wrap; - word-break: break-all; - } - &.wrap-soft { - word-break: normal - } - &.vertical { - transform: rotate(180deg); - text-overflow: ellipsis; - -webkit-writing-mode:vertical-rl; - writing-mode:vertical-rl; - i { - transform: rotate(180deg); - writing-mode: initial; - } - } - i { - margin-top: -1rem; - } - } -} diff --git a/src/scss/widgets/inputs.scss b/src/scss/widgets/inputs.scss new file mode 100644 index 00000000..38398ef9 --- /dev/null +++ b/src/scss/widgets/inputs.scss @@ -0,0 +1,238 @@ +.input-container { + width: 100rem; + height: 60rem; + padding:1rem; + .vertical { + position: relative; + input { + transform: rotate(-90deg); + vertical-align: middle; + max-width: initial!important; + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%) rotate(-90deg); + margin-top: -1px + } + } + .not-editable { + @extend .glass-effect; + } +} +.widget { + .input { + display: flex; + flex: 1 1 100%; + background:transparent; + color:var(--color-text); + overflow: hidden; + text-align:center; + padding:1rem; + border: 1rem solid var(--color-bg); + background: var(--color-track); + &.right { + text-align: right; + } + &.left { + text-align: left; + } + input { + display: block; + flex:1; + max-width: 100%; + font: inherit; + border:0; + padding:0; + background: transparent; + color:var(--color-accent); + border-radius: inherit; + -webkit-appearance:none; + appearance: none; + text-align:inherit; + line-height: 50rem; + vertical-align: top; + letter-spacing: 1rem; + -webkit-user-select: text; + user-select: text; + &:focus { + color:var(--color-text-fade); + } + &:focus::selection { + color:var(--color-custom); + background: transparent; + } + } + canvas { + flex:1; + max-width: 100%; + } + input + canvas { + display: none; + width: 0; + } + + + } + +} + +.panel:not(.tab) > .input-container { + padding: 0rem; + > .input { + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + margin:1rem; + border: 1rem solid var(--color-bg); + } +} + + +.keys-container { + width: 100rem; + height:60rem; + flex-shrink: 0; + padding:1rem; + --opacity: .75; + .keys { + flex: 1 1 100%; + height:35rem; + padding: 10rem; + justify-content: center; + display: flex; + align-items: center; + background: var(--color-track); + color:var(--color-custom); + border: 1rem solid var(--color-bg); + @extend .glass-effect; + i { + opacity: var(--opacity); + } + span { + font-family: monospace; + letter-spacing: 0; + margin-left: 4rem; + } + } +} + +.panel:not(.tab) > .keys-container { + --color-border:transparent; + padding: 0rem; + .keys { + margin: 1rem; + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} + +.script-container { + width: 100rem; + height:60rem; + flex-shrink: 0; + padding:1rem; + --opacity: .75; + .script { + flex: 1 1 100%; + height:35rem; + padding: 10rem; + justify-content: center; + display: flex; + align-items: center; + background: var(--color-track); + color:var(--color-custom); + border: 1rem solid var(--color-bg); + @extend .glass-effect; + i { + opacity: var(--opacity); + } + span { + font-family: monospace; + letter-spacing: 0; + margin-left: 4rem; + } + } +} + +.panel:not(.tab) > .script-container { + --color-border:transparent; + padding: 0rem; + .script { + margin: 1rem; + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} + + +.gyroscope-container { + width: 100rem; + height:60rem; + flex-shrink: 0; + padding:1rem; + --opacity: .75; + .gyroscope { + flex: 1 1 100%; + height:35rem; + padding: 10rem; + justify-content: center; + display: flex; + align-items: center; + background: var(--color-track); + color:var(--color-custom); + border: 1rem solid var(--color-bg); + @extend .glass-effect; + i { + opacity: var(--opacity); + } + span { + font-family: monospace; + letter-spacing: 0; + margin-left: 4rem; + } + } +} + +.panel:not(.tab) > .gyroscope-container { + --color-border:transparent; + padding: 0rem; + .gyroscope { + margin: 1rem; + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} + + +.file-container { + width: 100rem; + height:60rem; + padding:1rem; + &.nolabel { + --color-border:var(--color-bg); + padding: 0; + .file { + border: 0; + } + } + .file { + border: 1rem solid var(--color-bg); + flex: 1 1 100%; + display: flex; + align-items: center; + justify-content: center; + padding: 0 10rem; + text-transform: none; + i { + margin: 0 5rem; + pointer-events: none; + } + span { + pointer-events: none; + text-overflow: ellipsis; + overflow: hidden; + } + } +} diff --git a/src/scss/widgets/knob.scss b/src/scss/widgets/knob.scss new file mode 100644 index 00000000..a6a83c16 --- /dev/null +++ b/src/scss/widgets/knob.scss @@ -0,0 +1,116 @@ +.knob-container, .encoder-container { + --color-pips:var(--color-custom); + --color-gauge:var(--color-custom); + --color-knob:var(--color-custom); + padding: 1rem; + + width: 100rem; + height: 120rem; + align-items: center; + .input { + // display: none!important; + } +} + +.knob { + height:100%; + width: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + position: relative; + flex: 1; + + > .input { + height: 25rem; + flex:initial!important; + flex-shrink: 0!important; + display: block; + background: transparent!important; + border: 0!important; + } + + &.compact { + > .input { + pointer-events: none; + position: absolute; + border:0; + background:transparent; + overflow: hidden; + position: absolute; + top:50%; + left:50%; + z-index: 1; + width: 100rem; + height: 30rem; + margin-left:-50rem; + margin-top:-15rem; + } + } + + .wrapper { + overflow: hidden; + flex: 1 1 100%; + max-height: 100%; + width: 100%; + position: relative; + display: flex; + touch-action: none; + canvas { + width: 100%; + position: relative; + pointer-events: none; + image-rendering: pixelated; + } + } + +} + +.encoder-container { + + --color-gauge: transparent; + +} + +.encoder { + + height:100%; + width: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + position: relative; + + .wrapper { + overflow: hidden; + flex: 1 1 100%; + max-height: 100%; + width: 100%; + position: relative; + display: flex; + } + + .input { + display: none; + } + + .display-knob { + position: absolute; + top:0; + bottom:0; + left:0; + right:0; + pointer-events: none; + } + + .drag-knob { + opacity: 0; + + // safari fix + position: absolute; + top:0; + bottom:0; + left:0; + right:0; + } +} diff --git a/src/scss/widgets/maths.scss b/src/scss/widgets/maths.scss new file mode 100644 index 00000000..d209f85b --- /dev/null +++ b/src/scss/widgets/maths.scss @@ -0,0 +1,29 @@ +.formula-container { + width: 100rem; + height:60rem; + padding:1rem; + .formula { + display:flex; + height:100%; + background: var(--color-track); + border:1rem solid var(--color-bg); + @extend .glass-effect; + .input { + background: transparent!important; + border: 0!important; + --color-text: var(--color-custom); + pointer-events: none; + } + } +} + +.panel:not(.tab) > .formula-container { + --color-border:transparent; + padding: 0rem; + .formula { + margin: 1rem; + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} diff --git a/src/scss/widgets/matrices.scss b/src/scss/widgets/matrices.scss new file mode 100644 index 00000000..71abc769 --- /dev/null +++ b/src/scss/widgets/matrices.scss @@ -0,0 +1,163 @@ +/* Multiple widgets (push|toggle|fader) matrix */ +.matrix-container, +.multitoggle-container, +.multipush-container, +.multifader-container { + &.editing { + overflow: hidden; + } + height:200rem; + width:200rem; + &.nolabel .matrix { + top:0; + } + +} + +.matrix { + flex: 1 1 100%; + overflow: auto; + display: flex; + flex-wrap: wrap; + flex-direction: row; + padding:1rem 2rem 2rem 1rem; + touch-action: none; + --color-border:var(--color-bg); + --spacing:0; + + > .widget { + min-height: 0; + min-width: 0; + height: auto; + width: calc( 100% / var(--columns) - var(--spacing)); + margin: calc(var(--spacing) / 2); + // .label { + // background:none; + // border:0; + // } + } + + &.noborders { + .widget{ + border: none; + box-shadow:none; + } + } +} + +.multifader-container { + .matrix { + align-items:stretch; + flex-wrap: nowrap; + &.horizontal { + flex-direction: column; + display: flex; + .fader-container { + flex-direction: row; + flex:1; + .fader { + width:100%; + } + .label { + width:30rem; + height:auto; + max-height: initial; + margin-right: -5rem; + } + } + + } + > .widget { + height: auto; + flex:1; + + > .fader { + height: auto; + flex: 1 1 100%; + + } + } + &.compact { + > .widget { + box-shadow: 1rem 0 0 0 var(--color-bg), + 0 1rem 0 0 var(--color-bg), + 1rem 1rem 0 0 var(--color-bg); + .label { + box-shadow: 0 0 0 1rem var(--color-light) inset; + } + padding:0; + .wrapper { + border:0; + border-top:1rem solid var(--color-bg); + canvas{ + border:none; + } + } + } + &.horizontal { + > .widget { + .wrapper { + border:0; + border-left:1rem solid var(--color-bg); + } + .label { + margin-right: 0; + } + } + } + } + } + .fader-wrapper { + padding:10rem 0 20rem!important; + .fader { + left:0!important; + } + } + +} + +.keyboard-container { + --color-black-key: var(--color-raised); + --color-white-key: #aaa; + height:90rem; + width:240rem; + .matrix { + position: relative; + overflow: hidden; + > .widget { + border-radius: 0!important; + &.white:first-child { + border-top-left-radius:inherit!important; + border-bottom-left-radius:inherit!important; + } + &.white:last-child { + border-top-right-radius:inherit!important; + border-bottom-right-radius:inherit!important; + } + } + .white { + --color-raised: var(--color-white-key); + .toggle:before { + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 0 0 1rem var(--color-light) inset; + } + + + } + .black { + --color-raised: var(--color-black-key); + position: absolute; + z-index: 2; + top:1rem; + height: 65%; + .toggle:before { + border-bottom:2rem solid var(--color-bg); + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 -1rem 0 0 var(--color-light) inset; + } + } + .on { + background: var(--color-custom) + } + } +} diff --git a/src/scss/widgets/menu.scss b/src/scss/widgets/menu.scss new file mode 100644 index 00000000..2884c763 --- /dev/null +++ b/src/scss/widgets/menu.scss @@ -0,0 +1,199 @@ +// @keyframes menu-widget-fade { +// 0%{opacity: 0; transform: scale(0.9);} +// 100%{opacity: 1; transform: scale(1);} +// } +.menu-container { + @extend .modal-container; + + + border-radius: 0!important; // border radius breaks it somehow + z-index: initial!important; + contain: style size; + + --size: 300rem; + --grid-columns: 2; + + .menu { + display:none; + &.show { + display:block; + } + // animation: menu-widget-fade .1s forwards; + + position: fixed; + z-index: 999999999; + + background: var(--color-fg); + + overflow: hidden; + box-shadow: 0 0 0 1rem var(--color-light) inset, 0 0 5rem 0 var(--color-bg) ; + + + + .item { + + z-index: 1; + overflow: hidden; + + &.on:before { + content:""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + pointer-events: none; + background: var(--color-custom); + opacity: 0.3; + + } + + div { + text-align: center; + pointer-events: none; + } + + } + + .item.active:after, &.norelease .item:hover:after { + content:""; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + pointer-events: none; + background: var(--color-light); + } + + + } + + &.circular .menu { + + border-radius: 100%; + width:var(--size); + height:var(--size); + margin-left: calc(var(--x) - var(--size) / 2); + margin-top: calc(var(--y) - var(--size) / 2); + + &:after { + content:""; + position: absolute; + width: calc(var(--size) / 3); + height: calc(var(--size) / 3); + top:50%; + left: 50%; + margin-left: calc(-1 * var(--size) / 6); + margin-top: calc(-1 * var(--size) / 6); + background: var(--color-raised); + box-shadow: 0 0 2rem 0 var(--color-bg), 0 0 0 2rem var(--color-light) inset; + border-radius: 100%; + z-index: 10; + } + + .item { + top: calc(-1 * var(--size) / 2); + left: calc(-1 * var(--size) / 2); + width: 100%; + height: 100%; + transform-origin: 100% 100%; + position: absolute; + box-shadow: 0 0 0 2.5rem var(--color-light) inset, 0 0 0 1.5rem var(--color-bg) inset; + + &.on div:before { + content:""; + position: absolute; + width: calc(var(--size) / 3); + height: calc(var(--size) / 3); + left: calc(-1 * var(--size) / 6); + top: calc(-1 * var(--size) / 6); + border-radius: 100%; + pointer-events: none; + box-shadow: 0 0 0 4rem var(--color-custom); + } + + div { + position: absolute; + bottom: 0; + right: 0; + } + + span { + position: absolute; + top: calc(-1 * var(--size) / 3); + width: calc(var(--size) / 2); + margin-left: calc(-1 * var(--size) / 4); + } + + } + + + } + + &.box .menu { + + width:var(--size-box-w); + height:var(--size-box-h); + margin-left: calc(var(--x) - var(--size-box-w) / 2); + margin-top: calc(var(--y) - var(--size-box-h) / 2); + background: var(--color-bg); + + &.show { + display: flex; + } + + flex-direction: row; + + .item { + position: relative; + margin:.5rem; + background: var(--color-fg); + box-shadow: 0 0 0 1rem var(--color-light) inset; + + &.on div:before { + content:""; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + pointer-events: none; + box-shadow: 0 0 0 1rem var(--color-custom) inset; + opacity: 0.3; + } + + div { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + } + } + + } + + &.grid .menu { + + &.show { + display: grid; + grid-template-columns: repeat(var(--grid-columns), 1fr); + } + + } + + &.vertical .menu { + + flex-direction: column; + + } + +} + +.widget.menu-container > .label:after { + content:"\f58d"; + transform: none; + font-size: 12rem; + top:3rem; + right:6rem; +} diff --git a/src/scss/widgets/pads.scss b/src/scss/widgets/pads.scss index edc88ea2..eac97a76 100644 --- a/src/scss/widgets/pads.scss +++ b/src/scss/widgets/pads.scss @@ -1,157 +1,194 @@ -.xy-container, -.multixy-container, -.rgb-container, -.canvas-container { - width: 200rem; - height: 200rem; -} +.xy-container, .rgb-container, .multixy-container { + width:200rem; + height:230rem; + padding:2rem; -.xy-container, .multixy-container { + --background: var(--color-track); + --pips-opacity: 0.2; + --point-opacity: 0.3; - --alpha-fill-off: 0.05; - --alpha-fill: var(--alpha-fill-off); - --widget-padding: 20rem; - - inner { - position: relative; - flex: 1; - display: flex; - - @include pseudo-fill($z: -1); - @include pseudo-stroke(); + .label { + flex-shrink: 0; + z-index: 1; } - canvas { - width: 100%; - text-align: center; - } - -} - -.multixy-container { - - --point-size: 20rem; - - canvas { + > .pad > .wrapper:after { + content:""; position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; pointer-events: none; + top:var(--pointSize); + left:var(--pointSize); + height:calc(100% - 2 * var(--pointSize)); + width:calc(100% - 2 * var(--pointSize)); + background: var(--background); + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-bg) inset; + } + .pad { + height:100%; + width: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + > .input { + margin-top: 2rem; + height: 25rem; + flex:initial!important; + flex-shrink: 0!important; + background: transparent!important; + border: 0!important; + } + > .wrapper { + position: relative; + flex:1; + touch-action: none; + + > canvas { + width:100%; + height:100%; + position: absolute; + pointer-events: none; + z-index: 1; + } + > .fader { + pointer-events: none; + position: absolute; + width:100%; + height:100%; + z-index: 0; + --color-knob:transparent; + --color-gauge:transparent; + box-shadow: none; + border: 0; + * { + background: transparent!important; + + } + .wrapper { + border:none; + } + .input { + display: none; + } + } + } + } + + } .rgb-container { - --widget-padding: 4rem; + --point-opacity: .7; - > inner { + > .pad { - display: grid; + > .wrapper { - @include pseudo-stroke($z: 1); + display: flex; + flex-direction: column; - --widget-spacing: calc(var(--widget-padding) / 2); + image-rendering:pixelated; + > .pad { + --color-custom:var(--color-white); + position: absolute; + .wrapper { + border:0; + background: transparent; + } + canvas { + border:0; + left:0; + background: transparent; + } + .input { + display: none; + } + } + > canvas { + top:var(--pointSize); + left:var(--pointSize); + flex:0; + height:calc(100% - 2 * var(--pointSize)); + width:calc(100% - 2 * var(--pointSize)); + background-color: red; + background-clip: content-box; + background-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%), linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); + border: 1rem solid var(--color-bg); + } - padding: calc(var(--line-width) + var(--widget-spacing)); + background: transparent; + border: none; + box-shadow: none; - grid-template: - "a a b" auto / 1fr; + } + .alpha-wrapper, .hue-wrapper { + flex-shrink: 0; + padding: calc(var(--pointSize) / 2) var(--pointSize); + .fader { + box-shadow: 0 0 0 1rem var(--color-light); + height: calc(2 * var(--pointSize)); + } + } + .hue-wrapper { + --color-gauge:transparent; + --color-knob:var(--color-white); + .wrapper { + &:after { + content:""; + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: linear-gradient(to left, #F00, #FF0080, #F0F, #8000FF, #00F, #0080FF, #0FF, #00FF80, #0F0, #80FF00, #FF0, #FF8000, #F00) repeat scroll 0% 0%; + box-shadow: 0 0 0 4rem var(--color-track); + // z-index: 1; + opacity: 0.7; + } + canvas { + background: transparent; + -webkit-background-blend-mode: color-burn; + + } + } + } } +} - &.contains-alpha > inner { - grid-template: - "a a b" auto - "c c c" calc(20rem + var(--widget-spacing) * 2) / 1fr; - } - .widget { - height: auto; - width: auto; - margin: var(--widget-spacing); - --widget-padding: 2rem; - --line-width: 0; - } +.multixy-container { + > .pad { + text-align: center; + font-size: 109%; - .pad { - grid-area: a; + > .wrapper { - background-color: red; - background-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%), linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); - --color-fill: black; - --color-stroke: white; - --alpha-fill-off: 1; - --alpha-fill-on: 1; - --alpha-stroke: 1; - inner { - &:after, &:before { - content: none; + > canvas { + top:0; + left:0; + z-index: 2; + } + + > .pad { + pointer-events: none; + position: absolute; + .wrapper { + border:0; + background: transparent; + } + canvas { + border:0; + left:0; + } + .input { + display: none; + } } } } - - .hue { - grid-area: b; - width: 20rem; - - --color-fill: white; - // --color-stroke: white; - --alpha-fill-off: 0.5; - --alpha-fill-on: 0; - --alpha-stroke: 0; - --widget-padding: 0rem; - - &:after { - content:""; - position: absolute; - top: 0; - left: 2rem; - right: 2rem; - bottom: 0; - background: linear-gradient(to bottom, #F00, #FF0080, #F0F, #8000FF, #00F, #0080FF, #0FF, #00FF80, #0F0, #80FF00, #FF0, #FF8000, #F00) repeat scroll 0% 0%; - opacity: 0.75; - z-index: -1; - } - } - - .alpha { - grid-area: c; - height: auto!important; - width: auto!important; - --alpha-stroke: 0; - --alpha-fill-off: 0.1; - --alpha-fill-on: 0.25; - --widget-padding: 0rem; - } - -} - - -.canvas-container { - - --alpha-fill-off: 0.05; - --alpha-fill-on: 0.75; - --alpha-fill: var(--alpha-fill-off); - --widget-padding: 0rem; - .html { - pointer-events: auto; - } - - inner { - position: relative; - flex: 1; - display: flex; - - @include pseudo-fill($z: -1); - @include pseudo-stroke(); - } - - canvas { - width: 100%; - text-align: center; - } - } diff --git a/src/scss/widgets/panel.scss b/src/scss/widgets/panel.scss new file mode 100644 index 00000000..f06c7ea7 --- /dev/null +++ b/src/scss/widgets/panel.scss @@ -0,0 +1,348 @@ +.panel-container-base { + --color-border:var(--color-bg); + z-index: 1; + + box-shadow: 1rem 0 0 0 var(--color-border), + 0 1rem 0 0 var(--color-border), + 1rem 1rem 0 0 var(--color-border); + + > .label { + border-bottom:1rem solid var(--color-border); + z-index: 20; + box-shadow: 0 0 0 1rem var(--color-light) inset; + background: var(--color-fg); + } + + .panel { + overflow: auto; + position: absolute; + top:29rem; + left:-1rem; + right:0; + bottom:0; + background: var(--color-fg); + --color-border: var(--color-fg); + + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 0 0 1rem var(--color-fg) inset, + 1rem 1rem 0 1rem var(--color-light) inset; + + &.tab, &.root, &.has-tabs { + background: var(--color-bg); + --color-border: var(--color-bg); + box-shadow: none; + + } + &:not(.tab) { + > .widget { + box-shadow: 1rem 0 0 0 var(--color-border), + 0 1rem 0 0 var(--color-border), + 1rem 1rem 0 0 var(--color-border); + --default-bg: transparent; + } + } + &.has-tabs { + top:30rem; + display: flex; + flex-direction: column; + background: var(--color-bg); + + > .tabs-wrapper { + background: var(--color-fg); + display: flex; + flex-direction: column; + left:-1rem; + > .widget { + background: none; + border-top:none; + // border-right:1rem solid transparent; + } + } + } + + &.noscroll { + overflow: hidden; + > .widget { + max-width: 100%; + max-height: 100%; + } + } + + > .tabs-wrapper { + flex: 1 1 100%; + min-height:0; + > .tab-container { + // width: 100%; + > .label { + display: none; + } + + } + } + + } + &.nolabel { + > .panel { + top:-1rem; + } + > .panel.has-tabs { + top:0; + } + + } + + &.noborder { + + --color-border: var(--color-fg); + > .panel { + box-shadow: none; + } + + } + +} + + +.panel-container { + @extend .panel-container-base; + + width: 200rem; + height: 200rem; + + background: var(--color-fg); + +} + +.strip-container { + @extend .panel-container-base; + + width: 100rem; + height: 300rem; + + background: var(--color-fg)!important; + + &.horizontal { + width: 300rem; + height: 100rem; + } + + > .panel { + --spacing: 0; + > .widget { + top:auto!important; + left:auto!important; + position: relative!important; + } + } + + &.vertical { + > .panel { + + display: flex; + flex-direction: column; + align-items: stretch; + padding: calc(var(--spacing) / 2); + > .widget { + width: auto!important; + min-width: auto!important; + max-width: 100%; + margin: calc(var(--spacing) / 2); + } + } + } + &.horizontal { + > .panel { + display: flex; + flex-direction: row; + align-items: stretch; + padding: calc(var(--spacing) / 2); + > .widget { + height: auto!important; + min-height: auto!important; + max-height: 100%; + margin: calc(var(--spacing) / 2); + } + } + + } + &.stretch > .panel > .widget { + flex:1 1 100%; + } + +} +.editor-enabled .strip-container { + &.horizontal > .panel > .widget > .ui-resizable-s, + &.vertical > .panel > .widget > .ui-resizable-e, + > .panel > .widget > .ui-resizable-se { + display: none!important; + } +} + +.modal-container { + @extend .toggle-container; + + > .label:after { + content:"\f0da"; + font-family: FontAwesome; + transform: rotateZ(-45deg); + font-size: 20rem; + display: block; + width:8rem; + height:6rem; + right:2rem; + top:1rem; + line-height: 10rem; + text-align: center; + float:right; + position: absolute; + box-shadow: none; + background: none!important; + color: inherit; + opacity: 0.7; + } + + > .panel { + display: none; + } + > .popup { + padding:0; + + > .popup-wrapper { + max-width: 100%; + max-height: 100%; + width: var(--width, 100%); + height: var(--height, 100%); + .popup-content { + padding:0; + background: transparent; + > .panel { + background-color: var(--color-fg); + position: absolute; + width: auto; + height: auto; + top:-1rem; + left:-1rem; + right:0rem; + bottom:0rem; + } + } + .popup-title { + z-index: 1; + color: var(--color-text); + } + } + + &.x-positionned { + justify-content: flex-start; + > .popup-wrapper { + left: var(--left); + } + } + &.y-positionned { + align-items:flex-start; + > .popup-wrapper { + top: var(--top); + } + } + + } + &.editing .popup-wrapper:after { + content:""; + z-index: 999; + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + border:1rem solid var(--color-accent); + + --opa1: rgba(0,0,0, 1); + --opa2: rgba(0,0,0, 0.2); + --opa3: rgba(0,0,0, 0.8); + -webkit-mask: linear-gradient(to right, var(--opa1) 10rem, var(--opa1) 10rem, var(--opa2) 10rem, var(--opa2) calc(100% - 10rem), var(--opa1) calc(100% - 10rem), var(--opa1)), + linear-gradient(to bottom, var(--opa2) 10rem, var(--opa2) 10rem, var(--opa3) 10rem, var(--opa3) calc(100% - 10rem), var(--opa2) calc(100% - 10rem), var(--opa2)) ; + -webkit-mask-composite: xor; + + pointer-events: none; + box-shadow: none!important; + opacity: 1!important; + } + &.on { + z-index: initial; + > .toggle:after { + color:var(--color-custom); + } + border-radius: 0!important; // border radius breaks it somehow + } + +} + +.root-container { + @extend .panel-container-base; + height: 100%; + border:none; + > .label { + display: none; + } + +} + + +.tab-container, .root-container { + height: 100%; + flex:1; + box-shadow: none; + background: var(--color-bg)!important; + + > .panel { + transform: rotateZ(0); + top:0rem; + left:-1rem; + right:0rem; + &.has-tabs { + top:1rem; + } + } +} + +.tab-container { + display: none; + &.show { + display: flex; + } +} + +.clone-container { + + &.empty { + width: 100rem; + height: 100rem; + } + + > .label { + display: none; + } + + .clone { + position: absolute; + height: 100%; + width: 100%; + > .widget { + border:0!important; + box-shadow: none!important; + background: transparent!important; + position: relative!important; + left:auto!important; + bottom:auto!important; + right:auto!important; + top: auto!important; + width: 100%!important; + height: 100%!important; + min-height: initial!important; + max-height: initial!important; + min-width: initial!important; + max-width: initial!important; + padding: 0!important; + } + } +} diff --git a/src/scss/widgets/patchbay.scss b/src/scss/widgets/patchbay.scss new file mode 100644 index 00000000..6979f9c1 --- /dev/null +++ b/src/scss/widgets/patchbay.scss @@ -0,0 +1,38 @@ +.patchbay-container { + width: 200rem; + height: 200rem; + + .patchbay { + display: flex; + flex-direction: row; + padding:1rem 2rem 1rem 1rem; + // @extend .glass-effect; + height: 100%; + canvas { + flex: 1; + width: 0; + background: var(--color-track); + border-top:1rem solid var(--color-bg); + border-bottom:1rem solid var(--color-bg) + } + .nodes { + display: flex; + flex-direction: column; + align-items:stretch; + margin-bottom: 1rem; + width: 25%; + + > div { + width: 100%!important; + height: 100%; + flex:1; + flex-shrink: 0; + @extend .toggle-container; + div { + pointer-events: none; + } + } + } + } + +} diff --git a/src/scss/widgets/plots.scss b/src/scss/widgets/plots.scss new file mode 100644 index 00000000..a0ec1fb1 --- /dev/null +++ b/src/scss/widgets/plots.scss @@ -0,0 +1,265 @@ +.led-container, .rgbled-container { + width:100rem; + height:100rem; + padding:1rem; + .led { + --opacity: 0; + --color-led: var(--color-custom); + display: flex; + flex-direction: row; + flex: 1 1 100%; + background: var(--color-track); + border:1rem solid var(--color-bg); + &:before { + content:""; + width:100%; + height: 100%; + background: var(--color-led); + border-radius: inherit; + opacity: var(--opacity); + box-shadow: inset 0 0 10rem var(--color-track); + } + @extend .glass-effect; + + } +} + +.rgbled-container .led { + --opacity: 1; +} + +.plot-container, .visualizer-container, .eq-container { + height: 200rem; + width: 200rem; + padding:1rem; + .plot { + display: flex; + flex-direction: row; + flex: 1 1 100%; + background: var(--color-track); + border:1rem solid var(--color-bg); + @extend .glass-effect; + } + canvas { + flex:1; + image-rendering:pixelated; + width: 100%; + } +} + + +.meter-container { + @extend .fader-container; + --color-knob: transparent; + .wrapper { + pointer-events: none; + @extend .glass-effect; + } +} + +.text-container { + width: 100rem; + height:60rem; + flex-shrink: 0; + padding:1rem; + .text { + flex: 1 1 100%; + height:35rem; + padding: 0 10rem; + justify-content: center; + display: flex; + align-items: center; + white-space: pre; + background: var(--color-track); + color:var(--color-custom); + border: 1rem solid var(--color-bg); + line-height: 100%; + overflow: hidden; + text-align: center; + &.right { + text-align: right; + justify-content: flex-end; + } + &.left { + text-align: left; + justify-content: flex-start; + } + &.wrap { + white-space: pre-wrap; + } + &.vertical { + transform: rotate(180deg); + text-overflow: ellipsis; + -webkit-writing-mode:vertical-rl; + writing-mode:vertical-rl; + padding: 10rem 0; + &:after { + transform: rotate(-180deg); + } + } + @extend .glass-effect; + } +} + +.image-container { + width:100rem; + height:100rem; + padding:1rem; + .image { + display: flex; + flex-direction: row; + flex: 1 1 100%; + background-size:cover; + border:1rem solid var(--color-bg); + background-repeat: no-repeat; + } + &.noborder { + --color-border:transparent; + --color-light:transparent; + --color-light:transparent; + background: transparent; + padding: 0!important; + .image { + outline:transparent!important; + border:0!important; + box-shadow:none!important; + margin: 0!important; + } + } +} + +.svg-container { + width:100rem; + height:100rem; + padding:1rem; + .svg { + display: flex; + flex-direction: row; + flex: 1 1 100%; + background: var(--color-track); + border:1rem solid var(--color-bg); + svg { + flex: 1 1 100%; + } + } + &.noborder { + --color-border:transparent; + --color-light:transparent; + --color-light:transparent; + background: transparent; + padding: 0!important; + .svg { + background: transparent; + outline:transparent!important; + border:0!important; + box-shadow:none!important; + margin: 0!important; + } + } + &:not(.noborder) .svg { + @extend .glass-effect; + } +} + +.html-container { + width:100rem; + height:100rem; + padding:1rem; + .html { + display: flex; + flex-direction: row; + flex: 1 1 100%; + background: var(--color-track); + border:1rem solid var(--color-bg); + } + &.noborder { + --color-border:transparent; + --color-light:transparent; + --color-light:transparent; + background: transparent; + padding: 0!important; + .html { + background: transparent; + outline:transparent!important; + border:0!important; + box-shadow:none!important; + margin: 0!important; + } + } + &:not(.noborder) .html { + @extend .glass-effect; + } +} + +.frame-container { + width:100rem; + height:100rem; + padding:1rem; + .frame { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex: 1 1 100%; + background-size:cover; + border:1rem solid var(--color-bg); + background-repeat: no-repeat; + iframe { + flex: 1 1 100%; + height: 100%; + width: 100%; + border: 0; + display: block; + } + iframe[src=""] { + pointer-events: none; + } + &.error { + iframe { + display: none; + } + } + } + &.noborder { + --color-border:transparent; + --color-light:transparent; + --color-light:transparent; + background: transparent; + padding: 0!important; + .frame { + outline:transparent!important; + border:0!important; + box-shadow:none!important; + margin: 0!important; + } + } +} +.editor-enabled .frame-container.nolabel iframe { + pointer-events: none; +} + +.panel:not(.tab) > .led-container, +.panel:not(.tab) > .rgbled-container, +.panel:not(.tab) > .text-container, +.panel:not(.tab) > .visualizer-container, +.panel:not(.tab) > .eq-container, +.panel:not(.tab) > .plot-container, +.panel:not(.tab) > .image-container, +.panel:not(.tab) > .frame-container, +.panel:not(.tab) > .svg-container, +.panel:not(.tab) > .html-container { + --color-border:transparent; + padding: 0rem; + .plot, .text, .led, .image, .svg, .html, .frame { + margin: 1rem; + box-shadow: 0 0 0 1rem var(--color-light), + 0 0 0 1rem var(--color-fg); + border: 1rem solid var(--color-bg); + } +} + +.panel:not(.tab) > .image-container { + .image { + background-clip: content-box; + } +} diff --git a/src/scss/widgets/push.scss b/src/scss/widgets/push.scss new file mode 100644 index 00000000..94fc8bda --- /dev/null +++ b/src/scss/widgets/push.scss @@ -0,0 +1,25 @@ +.push-container { + @extend .toggle-container; + .toggle { + &.active { + // background-color: var(--color-fg); + &:after { + content: ""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.4; + background: radial-gradient( ellipse at center, var(--color-raised), var(--color-bg)); + z-index: 2; + } + } + &.on:not(.active) { + &:after { + opacity: 0; + } + } + } + +} diff --git a/src/scss/widgets/sliders.scss b/src/scss/widgets/sliders.scss deleted file mode 100644 index a5f4b6fe..00000000 --- a/src/scss/widgets/sliders.scss +++ /dev/null @@ -1,77 +0,0 @@ -.fader-container, -.scrollbar-container, -.knob-container, -.encoder-container, -.range-container { - - --color-knob: var(--color-fill); - - canvas { - image-rendering: pixelated; - width: 100%; - height: auto; - } - -} - -.scrollbar-container, -.fader-container, -.range-container { - - width: 50rem; - height: 200rem; - - --widget-padding: 1rem; - --knob-size: 1rem; - --line-width: 1rem; - - canvas { - text-align: left; - } - - &.horizontal { - width: 200rem; - height: 50rem; - } - - &.design-default { - --knob-size: 20rem; - --widget-padding: 10rem; - --alpha-stroke: 0.5; - --alpha-fill-off: 0.25; - --alpha-fill-on: 1; - --line-width: 2rem - } - - &.design-round { - --knob-size: 20rem; - --widget-padding: 10rem; - --alpha-stroke: 0.25; - --alpha-fill-off: 0.25; - --alpha-fill-on: 1; - --line-width: 2rem - } - -} - -.knob-container, -.encoder-container { - - width: 100rem; - height: 100rem; - - --widget-padding: 1rem; - --alpha-stroke: 0.75; - - &.design-solid, &.design-line { - --alpha-fill-off: 0.25; - --alpha-fill-on: 1; - --line-width: 2rem; - } - -} - -.scrollbar-container { - --alpha-fill-off: 0; - --alpha-fill-on: var(--alpha-scrollbar); -} diff --git a/src/scss/widgets/switch.scss b/src/scss/widgets/switch.scss new file mode 100644 index 00000000..87a37867 --- /dev/null +++ b/src/scss/widgets/switch.scss @@ -0,0 +1,226 @@ +.state-container, .switch-container, .switcher-container, .crossfader-container { + z-index: 1; + width:100rem; + height:100rem; + padding:1rem; + + &.nolabel { + --color-border:var(--color-bg); + padding: 0; + .switch, .switcher { + border: 0; + } + } + .switch { + cursor: pointer; + display: flex; + flex-direction:column; + align-items: stretch; + flex: 1; + z-index: 1; + background:var(--color-bg); + border: 1rem solid var(--color-bg); + + &.horizontal { + flex-direction:row; + .value { + border-top:0; + border-right:1rem solid var(--color-bg); + height:auto; + margin-bottom:0; + &:last-child { + border-right:0; + } + + } + } + .value { + background:var(--color-raised); + padding:6rem; + color:var(--color-text); + width:100%; + flex: 1 1 100%; + position: relative; + // border-top: 1rem solid var(--color-bg); + margin-bottom:1rem; + white-space: normal; + text-align: center; + word-break: break-all; + overflow: hidden; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 1rem 0 0 var(--color-light) inset; + + &:before { + content:""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0; + box-shadow: 0 0 0 1rem var(--color-custom) inset; + border-radius: inherit; + } + + &.on { + // background: var(--color-fg); + color: var(--color-custom); + &:after { + content: ""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.4; + background: radial-gradient( ellipse at center, transparent, var(--color-bg)); + } + &:before { + opacity: 0.3; + } + } + &:first-child { + // border-top:0; + } + + &:last-child { + margin-bottom:0; + } + + i { + width: auto; + } + + } + } +} + +.switcher-container { + .switcher { + flex:1; + display:flex; + } +} + +.crossfader-container { + .switcher { + flex: 1 1 100%; + width:auto; + display:flex; + border: 1rem solid var(--color-bg); + padding: 2rem; + .switch { + flex:2; + border: 1rem solid var(--color-bg) !important; + } + .fader { + flex: 3; + --color-pips: var(--color-custom); + --color-gauge: var(--color-custom); + --color-knob: var(--color-custom); + } + &.vertical { + flex-direction: row; + .fader, .fader canvas { + height:auto; + } + } + &.horizontal { + flex-direction: column; + } + } +} +.panel:not(.tab) > .crossfader-container { + --color-border:var(--color-fg); + .switcher { + border:0!important; + } +} + +.dropdown-container { + + z-index: 1; + width:100rem; + height: 60rem; + padding:1rem; + &.nolabel { + --color-border:var(--color-bg); + padding: 0; + .select { + border: 0; + } + } + .select { + flex: 1 1 100%; + position: relative; + overflow: hidden; + cursor: pointer; + border: 1rem solid var(--color-bg); + display: flex; + border-radius: inherit; + + select { + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 1rem 0 0 var(--color-light) inset; + flex:1; + display: flex; + vertical-align: middle; + background:transparent; + padding: 0 30rem 0 10rem; + max-width: 100%; + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + background: var(--color-raised); + color:inherit; + font-size: 109%!important; + line-height: 120%!important; + text-transform: none; + border-radius: inherit; + + &:focus { + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 1rem 0 0 var(--color-light) inset, + 0 0 1rem 0 var(--color-custom) inset; + + } + } + &:after{ + content:"\f107"; + font-family: FontAwesome; + position: absolute; + padding:0 10rem; + right:0; + top:50%; + margin-top:-10rem; + font-size: 180%; + height: 20rem; + line-height: 20rem; + pointer-events: none; + } + + } + +} + +.state-container { + .push-container { + border:0; + } + .toggle { + height: 100%; + z-index: 1; + &:before { + box-shadow: none; + } + } + .disabled { + opacity: 0.65; + pointer-events: none; + cursor: default; + } +} diff --git a/src/scss/widgets/toggle.scss b/src/scss/widgets/toggle.scss new file mode 100644 index 00000000..8bd060c3 --- /dev/null +++ b/src/scss/widgets/toggle.scss @@ -0,0 +1,100 @@ +.toggle-container { + width:100rem; + height: 60rem; + padding:0!important; + --color-border:var(--color-bg); + --default-bg: var(--color-raised)#{!important}; + z-index: 1; + + .toggle { + + cursor: pointer; + flex: 1 1 100%; + display: flex; + border-radius: inherit!important; + touch-action: none; + + &:before { + content:""; + flex: 1 1 100%; + opacity: 1; + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 1rem 0 0 var(--color-light) inset; + border-radius: inherit; + } + + &.on { + &:after { + content: ""; + position: absolute; + top:0; + left: 0; + right: 0; + bottom: 0; + opacity: 0.4; + background: radial-gradient( ellipse at center, transparent, var(--color-bg)); + } + + &:before { + opacity: 0.3; + box-shadow: 0 0 0 1rem var(--color-custom) inset; + } + + } + + } + + > .label { + position: absolute; + top:2rem; + left:2rem; + right:2rem; + bottom:2rem; + height:auto; + width: auto; + max-height: initial; + border:0!important; + background: none!important; + text-align: center; + pointer-events:none; + display: flex; + justify-content: center; + align-items: center; + z-index: 2; + } + + &.on > .label{ + color: var(--color-custom); + } + + &.led { + .toggle:after { + content:""; + opacity: 1; + position: absolute; + display: block; + top:3rem; + left:3rem; + right:3rem; + height: 4rem; + background: var(--color-track); + box-shadow: 0 0 0 1rem var(--color-light), 0 0 0 1rem var(--color-bg) inset; + z-index: 1; + border-radius: inherit; + opacity: 0.9; + } + .toggle.on:after { + opacity: 0.7; + background: var(--color-custom); + } + .toggle:before { + opacity: 1; + box-shadow: 0 0 0 1rem var(--color-light) inset, + 0 1rem 0 0 var(--color-light) inset; + } + > .label { + top:7rem; + } + } + +} diff --git a/src/server/callbacks.js b/src/server/callbacks.js new file mode 100644 index 00000000..8a3b2ed0 --- /dev/null +++ b/src/server/callbacks.js @@ -0,0 +1,462 @@ +var path = require('path'), + fs = require('fs'), + settings = require('./settings'), + osc = require('./osc'), + {ipc} = require('./server'), + {deepCopy} = require('./utils'), + theme = require('./theme') + +var widgetHashTable = {}, + sessionBackups = {} + +module.exports = { + + ready: function(data,clientId) { + ipc.send('connected') + + if (settings.read('readOnly')) { + ipc.send('readOnly') + } + + if (data.backupId && sessionBackups[data.backupId]) { + ipc.send('loadBackup', sessionBackups[data.backupId]) + return + } + + if (settings.read('newSession')) { + ipc.send('sessionNew') + return + } + + if (settings.read('sessionFile')) return this.sessionOpen({path:settings.read('sessionFile')},clientId) + + var recentSessions = settings.read('recentSessions') + + if (settings.read('examples')) { + var dir = path.resolve(__dirname + '/../examples') + recentSessions = fs.readdirSync(dir) + recentSessions = recentSessions.map(function(file){return dir + '/' + file}) + } + + ipc.send('sessionList', recentSessions, clientId) + ipc.send('serverTargets', settings.read('targets'), clientId) + + }, + + sessionAddToHistory: function(data) { + var sessionlist = settings.read('recentSessions') + + fs.lstat(data,(err, stats)=>{ + + if (err || !stats.isFile()) return + + // add session to history + sessionlist.unshift(path.resolve(data)) + // remove doubles from history + sessionlist = sessionlist.filter(function(elem, index, self) { + return index == self.indexOf(elem) + }) + // save history + settings.write('recentSessions',sessionlist) + + }) + }, + + sessionRemoveFromHistory: function(data) { + var sessionlist = settings.read('recentSessions') + if (sessionlist.indexOf(data) > -1) { + sessionlist.splice(sessionlist.indexOf(data),1) + settings.write('recentSessions',sessionlist) + } + }, + + sessionSetPath: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + if (!settings.read('readOnly')) { + module.exports.sessionAddToHistory(data.path) + } + + ipc.clients[clientId].sessionPath = data.path + + ipc.send('setTitle', path.basename(data.path), clientId) + + }, + + sessionOpen: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + module.exports.fileRead(data, clientId, true, (result)=>{ + + ipc.clients[clientId].sessionPath = data.path // for resolving local file requests + ipc.send('sessionOpen', {path: data.path, session: result}, clientId) + + }) + + }, + + sessionOpened: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + if (settings.read('stateFile')) { + var send = true + for (var id in ipc.clients) { + // only make the client send its osc state if there are no other active clients + if (id !== clientId && ipc.clients[id].connected()) { + send = false + } + } + var state = { + state: settings.read('stateFile'), + send: send + } + ipc.send('stateLoad', state, clientId) + } + + ipc.send('stateSend', null, null, clientId) + + module.exports.sessionSetPath({path: data.path}, clientId) + + }, + + fileRead: function(data, clientId, ok, callback) { + + if (!ok) return + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + fs.readFile(data.path, 'utf8', (err, result)=>{ + + var error + + if (err) { + error = err + } else { + try { + result = JSON.parse(result) + callback(result) + } catch(err) { + error = err + } + } + + if (error) ipc.send('error', `Could not open file (${error})`) + + }) + + }, + + fileSave: function(data, clientId, ok, callback) { + + if (!ok) return + + if (!data.path || settings.read('remoteSaving') && !settings.read('remoteSaving').test(ipc.clients[clientId].address)) { + + return ipc.send('notify', { + icon: 'save', + locale: 'remotesave_forbidden', + class: 'error' + }, clientId) + + } + + if (data.path) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + var root = settings.read('remoteRoot') + if (root && !data.path.includes(root)) { + console.error('Could not save: path outside of remote-root') + return ipc.send('notify', { + class: 'error', + locale: 'remotesave_fail', + message: ' (Could not save: path outside of remote-root)' + }, clientId) + } + + try { + JSON.parse(data.session) + } catch(e) { + return console.error('Could not save: invalid file') + } + + fs.writeFile(data.path, data.session, function(err, fdata) { + + if (err) return ipc.send('notify', { + class: 'error', + locale: 'remotesave_fail', + message: err + }, clientId) + + + ipc.send('notify', { + icon: 'save', + locale: 'remotesave_success', + message: ' ('+ path.basename(data.path) +')' + }, clientId) + + callback() + + }) + + } + + }, + + stateOpen: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + module.exports.fileRead(data, clientId, true, (result)=>{ + + ipc.send('stateLoad', {state: result, path: data.path, send: true}, clientId) + + }) + + }, + + sessionSave: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + if (!path.basename(data.path).match(/.*\.json$/)) return console.error('Sessions must be saved as .json files') + + module.exports.fileSave(data, clientId, true, ()=>{ + + console.log('Session file saved in '+ data.path) + + ipc.send('sessionSaved', clientId) + + // reload session in other clients + for (var id in ipc.clients) { + if (id !== clientId && ipc.clients[id].sessionPath === data.path) { + module.exports.sessionOpen({path: data.path}, id) + } + } + + module.exports.sessionSetPath({path: data.path}, clientId) + + }) + + }, + + stateSave: function(data, clientId) { + + if (Array.isArray(data.path)) data.path = path.resolve(...data.path) + + if (!path.basename(data.path).match(/.*\.state/)) return console.error('Statesaves must be saved as .state files') + + module.exports.fileSave(data, clientId, true, ()=>{ + + console.log('State file saved in '+ data.path) + + }) + + }, + + syncOsc: function(shortdata, clientId) { + + if (!(widgetHashTable[clientId] && widgetHashTable[clientId][shortdata.h])) return + + var value = shortdata.v, + data = widgetHashTable[clientId][shortdata.h] + + data = deepCopy(data) + for (var k in shortdata) { + data[k] = shortdata[k] + } + + // only rawTarget will be used + delete data.target + + data.args = data.preArgs ? data.preArgs.concat(value) : [value] + + if (!data.noSync) ipc.send('receiveOsc', data, null, clientId) + + + }, + + sendOsc: function(shortdata, clientId) { + + if (!(widgetHashTable[clientId] && widgetHashTable[clientId][shortdata.h])) return + + var value = shortdata.v, + data = widgetHashTable[clientId][shortdata.h] + + data = deepCopy(data) + for (var k in shortdata) { + data[k] = shortdata[k] + } + + if (data.target) { + + var targets = [] + + if (data.target.indexOf(null) === -1 && settings.read('targets') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('targets')) + if (data.target) Array.prototype.push.apply(targets, data.target) + + data.args = data.preArgs ? data.preArgs.concat(value) : [value] + + for (var i in targets) { + + if (targets[i] === 'self') { + ipc.send('receiveOsc',data,clientId) + continue + } else if (targets[i] === null) { + continue + } + + var host = targets[i].split(':')[0], + port = targets[i].split(':')[1] + + if (port) { + + if (data.split) { + + for (var j in data.split) { + osc.send(host, port, data.split[j], data.preArgs ? data.preArgs.concat(value[j]) : [value[j]], data.precision) + } + + } else { + + osc.send(host, port, data.address, data.args, data.precision) + + } + + } + + } + + } + + if (!data.noSync) ipc.send('receiveOsc', data, null, clientId) + + }, + + addWidget(data, clientId) { + + if (!widgetHashTable[clientId]) { + widgetHashTable[clientId] = {} + } + + if (!widgetHashTable[clientId][data.hash]) { + widgetHashTable[clientId][data.hash] = {} + } + + var cache = widgetHashTable[clientId][data.hash], + widgetData = data.data + + for (var k in widgetData) { + if ((k === 'target' || k === 'preArgs')) { + if (widgetData[k] !== '') { + cache[k] = Array.isArray(widgetData[k]) ? widgetData[k] : [widgetData[k]] + } else { + cache[k] = [] + } + } else { + cache[k] = widgetData[k] + } + } + + // store raw target for client sync widget matching + cache._rawTarget = widgetData.target + + }, + + removeWidget(data, clientId) { + + delete widgetHashTable[clientId][data.hash] + + }, + + removeClientWidgets(clientId) { + + if (widgetHashTable[clientId]) { + delete widgetHashTable[clientId] + } + + }, + + fullscreen: function(data) { + window.setFullScreen(!window.isFullScreen()) + }, + + reload: function(data) { + + ipc.send('reload') + + }, + + storeBackup: function(data, clientId) { + + sessionBackups[data.backupId] = data + + }, + + deleteBackup: function(data) { + + delete sessionBackups[data] + + }, + + reloadCss:function(){ + theme.load() + ipc.send('reloadCss') + }, + + log: function(data) { + console.log(data) + }, + + error: function(data) { + console.error(data) + }, + + errorLog: function(data) { + console.error(data) + }, + + errorPopup: function(data) { + ipc.send('error', data) + }, + + listDir: function(data, clientId) { + + var p = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] + + if (data.path) p = path.resolve(...data.path) + + var root = settings.read('remoteRoot') + if (root && !p.includes(root)) p = root + + fs.readdir(p, (err, files)=>{ + if (err) { + ipc.send('notify', {class: 'error', message: err.message}, clientId) + throw err + } else { + var extRe = data.extension ? new RegExp('.*\\.' + data.extension + '$') : /.*/ + var list = files.filter(x=>x[0] !== '.').map((x)=>{ + var folder = false + try { + folder = fs.statSync(path.resolve(p, x)).isDirectory() + } catch(e) {} + return { + name: x, + folder + } + }) + list = list.filter(x=>x.folder || x.name.match(extRe)) + ipc.send('listDir', { + path: p, + files: list + }, clientId) + } + }) + + + } + +} diff --git a/src/server/electron/electron-app.mjs b/src/server/electron-app.js similarity index 56% rename from src/server/electron/electron-app.mjs rename to src/server/electron-app.js index eac5e9b0..f64b9203 100644 --- a/src/server/electron/electron-app.mjs +++ b/src/server/electron-app.js @@ -1,35 +1,22 @@ -import {app, Menu, shell, BrowserWindow} from 'electron' -import semver from 'semver' -import * as settings from '../node/settings.mjs' - -app.setPath('userData', settings.configPath) - -app.commandLine.appendSwitch('--ignore-certificate-errors') +var {app, Menu, shell} = require('electron'), + settings = require('./settings'), + infos = require('../package.json') app.commandLine.appendSwitch('--touch-events') -if (settings.read('disable-vsync')) { +if (settings.read('noVsync') || (!settings.cli && settings.read('argv')['disable-vsync'])) { app.commandLine.appendSwitch('--disable-gpu-vsync') } -if (settings.read('disable-gpu')) { +if (settings.read('noGpu') || (!settings.cli && settings.read('argv')['disable-gpu'])) { app.disableHardwareAcceleration() app._noGpu = true } -if (settings.read('force-gpu')) { +if (settings.read('forceGpu') || (!settings.cli && settings.read('argv')['force-gpu'])) { app.commandLine.appendSwitch('--ignore-gpu-blacklist') } -// Workaround bug in electron 36 + gnome: https://github.com/electron/electron/issues/46538 -if (process.platform === 'linux') { - app.commandLine.appendSwitch('gtk-version', '3') -} - -if (semver.gt(settings.infos.version, settings.read('version') || '0.0.0')) { - // set temporary flag to clean electron browser cache in case of update - settings.write('clearCache', true, true) -} var template = [{ @@ -40,18 +27,17 @@ var template = [{ {type: 'separator'}, {role: 'cut', accelerator: 'CmdOrCtrl+X'}, {role: 'copy', accelerator: 'CmdOrCtrl+C'}, - {role: 'paste', accelerator: 'CmdOrCtrl+V'}, - {role: 'selectall', accelerator: 'CmdOrCtrl+A'} + {role: 'paste', accelerator: 'CmdOrCtrl+V'} ] }] if (process.platform === 'darwin') { - // Add app menu (macOs) + // Add app menu (OS X) template.unshift({ - label: settings.infos.productName, + label: settings.read('appName'), submenu: [ { - label: 'Hide ' + settings.infos.productName, + label: 'Hide ' + infos.productName, accelerator: 'Command+H', role: 'hide' }, @@ -69,7 +55,7 @@ if (process.platform === 'darwin') { }, { label: 'Quit', - accelerator: 'CmdOrCtrl+Q', + accelerator: 'Command+Q', click: ()=>app.quit() } ] @@ -87,21 +73,10 @@ if (process.platform === 'darwin') { { type: 'separator' }, - { - label: 'Close', - accelerator: 'CmdOrCtrl+W', - click: ()=>{ - var win = BrowserWindow.getFocusedWindow() - if (win) win.close() - } - }, - { - type: 'separator' - }, { label: 'Bring All to Front', role: 'front' - }, + } ] }, { @@ -110,20 +85,23 @@ if (process.platform === 'darwin') { submenu: [ { label: 'Documentation', - click: ()=>shell.openExternal(settings.infos.homepage) + click: ()=>shell.openExternal(infos.homepage) }, { type: 'separator' }, { label: 'Report an Issue', - click: ()=>shell.openExternal(settings.infos.repository.url + '/issues') + click: ()=>shell.openExternal(infos.repository.url + '/issues') } ] } ) } +app.on('before-quit',()=>{ + process.exit() +}) app.on('ready',()=>{ var menu = Menu.buildFromTemplate(template) @@ -131,7 +109,9 @@ app.on('ready',()=>{ }) app.on('window-all-closed', function() { - app.quit() + if (process.platform !== 'darwin') { + app.quit() + } }) -export default app +module.exports = app diff --git a/src/server/electron-window.js b/src/server/electron-window.js new file mode 100644 index 00000000..a17a3439 --- /dev/null +++ b/src/server/electron-window.js @@ -0,0 +1,103 @@ +var path = require('path'), + {BrowserWindow, dialog, shell} = require('electron'), + app = require('./electron-app'), + shortcut = require('electron-localshortcut'), + settings = require('./settings'), + theme = require('./theme') + + +module.exports = function(options={}) { + + var window + + window = new BrowserWindow({ + width: options.width || 800, + height: options.height || 600, + title: options.title || settings.read('appName'), + icon: path.resolve(__dirname + '/../assets/logo.png'), + backgroundColor: options.color || theme.backgroundColor, + type: options.type, + useContentSize: true, + autoHideMenuBar: true, + webPreferences: { + nodeIntegration: !!options.node + }, + show: false, + }) + + window.once('ready-to-show', ()=>{ + if (options.fullscreen) { + window.setFullScreen(true) + } + window.show() + }) + + window.webContents.on('will-prevent-unload', (event)=>{ + var choice = dialog.showMessageBoxSync(window, { + type: 'question', + buttons: ['Yes', 'No'], + title: 'Are you sure ?', + message: 'Unsaved data will be lost. Are you sure you want to quit?', + defaultId: 0, + cancelId: 1 + }) + if (choice === 0) { + event.preventDefault() + } + }) + + // window.webContents.on('will-navigate', (event)=>event.preventDefault()) + window.webContents.on('new-window', (event, url)=>{ + event.preventDefault() + shell.openExternal(url) + }) + + window.webContents.on('dom-ready', ()=>{ + if (options.fullscreen) { + window.webContents.executeJavaScript(` + window.ELECTRON_FULLSCREEN = true + `) + } + if (app._noGpu) { + window.webContents.executeJavaScript(` + window.ELECTRON_NOGPU = true + `) + } + }) + + if (options.zoom === false) { + window.webContents.setVisualZoomLevelLimits(1, 1) + } + + + window.on('closed', function() { + window = null + }) + + window.setMenu(null) + + window.loadURL(options.address) + + if (options.shortcuts) { + + shortcut.register(window,'CmdOrCtrl+R',function(){ + window.reload() + }) + + shortcut.register(window,'F11',function(){ + window.setFullScreen(!window.isFullScreen()) + }) + + shortcut.register(window,'F12',function(){ + window.toggleDevTools() + }) + + } else { + shortcut.register(window,'CmdOrCtrl+R',function(e){ + return false + }) + } + + return window + +} diff --git a/src/server/electron/electron-window.mjs b/src/server/electron/electron-window.mjs deleted file mode 100644 index 5dc78b27..00000000 --- a/src/server/electron/electron-window.mjs +++ /dev/null @@ -1,217 +0,0 @@ -import path from 'path' -import {BrowserWindow, dialog, shell, screen, Menu, MenuItem} from 'electron' -import shortcut from 'electron-localshortcut' -import app from './electron-app.mjs' -import * as settings from '../node/settings.mjs' - -export default function(options={}) { - - var window - - window = new BrowserWindow({ - title: options.title || settings.infos.productName, - icon: path.resolve(__dirname + '/../../assets/logo.png'), - backgroundColor: '#21252B', - type: options.type, - useContentSize: true, - darkTheme: true, - autoHideMenuBar: true, - webPreferences: { - nodeIntegration: !!options.node, - contextIsolation: !options.node, - enableRemoteModule: !!options.node - }, - show: false, - }) - - - - // default geometry - var currentScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()), - screenSize = currentScreen.size, - width = options.width || screenSize.width, - height = options.height || screenSize.height, - bounds = currentScreen.bounds, - x = Math.ceil(bounds.x + ((bounds.width - width) / 2)), - y = Math.ceil(bounds.y + ((bounds.height - height) / 2)), - geometry = {x, y, width, height} - - // retrieve last geometry - if (settings.read('geometry') && settings.read('geometry')[options.id]) { - var last_geometry = settings.read('geometry')[options.id], - mScreen = screen.getDisplayMatching(geometry) - if (intersectionArea(geometry, mScreen.bounds) > 20000) { - // don't load geometry if the window is not visible enough - Object.assign(geometry, last_geometry) - } - } - - if (options.id === 'client') { - if (settings.read('client-position')) { - [x, y] = settings.read('client-position').split(',').map(x=>parseInt(x)) - Object.assign(geometry, {x, y}) - } - - if (settings.read('client-size')) { - [width, height] = settings.read('client-size').split(',').map(x=>parseInt(x)) - Object.assign(geometry, {width, height}) - } - } - - window.setBounds(geometry) - - window.once('ready-to-show', ()=>{ - if (options.id === 'launcher' && settings.read('startMinimized')) { - if (settings.read('useTray') || process.platform === 'darwin') { - window.hide() - } else { - window.show() - window.minimize() - } - } else { - window.show() - } - }) - - if (options.id === 'launcher' && process.platform === 'darwin' && settings.read('startMinimized')) { - app.on('activate', ()=>{ - if (!window.isDestroyed()) window.show() - }) - } - - window.webContents.once('page-title-updated', ()=>{ - if (options.fullscreen) { - window.webContents.executeJavaScript('window.ELECTRON_FULLSCREEN()', true) - } - if (app._noGpu) { - window.webContents.executeJavaScript(` - window.ELECTRON_NOGPU = true - `) - } - }) - - - window.webContents.on('will-prevent-unload', (event)=>{ - var choice = dialog.showMessageBoxSync(window, { - type: 'question', - buttons: ['Yes', 'No'], - title: 'Are you sure ?', - message: 'Unsaved data will be lost. Are you sure you want to quit?', - defaultId: 0, - cancelId: 1 - }) - if (choice === 0) { - event.preventDefault() - } - }) - - - window.webContents.on('certificate-error', function(event, url, error, certificate, callback) { - if (error === 'net::ERR_CERT_AUTHORITY_INVALID') { - // self signed certificate is ok - event.preventDefault() - callback(true) - } - }) - - window.webContents.on('login', function(event, request, authInfo, callback) { - event.preventDefault() - var [name, pwd] = settings.read('authentication').split(':') - callback(name, pwd) - }) - - // window.webContents.on('will-navigate', (event)=>event.preventDefault()) - window.webContents.on('new-window', (event, url)=>{ - event.preventDefault() - shell.openExternal(url) - }) - - - window.webContents.on('console-message', (event)=>{ - - if (event.level === 0 && event.message === 'ELECTRON.BLUR()') window.blur() - if (event.level === 0 && event.message === 'ELECTRON.FOCUS()') window.focus() - if (event.level === 0 && event.message === 'ELECTRON.SETFOCUSABLE(1)') { - window.setFocusable(true) - window.focus() - } - if (event.level === 0 && event.message === 'ELECTRON.SETFOCUSABLE(0)') { - window.setFocusable(false) - window.blur() - } - - }) - - window.webContents.setVisualZoomLevelLimits(1, 1) - - window.on('closed', function() { - window = null - }) - - window.setMenu(null) - - window.loadURL(options.address) - - if (process.platform === 'linux') { - // already registered in app menu on macOs - // already bound to alt+f4 on windows - window.webContents.on('before-input-event', (e, input)=>{ - // using before-input-event because electron-localshortcut - // gets azerty keyboards wrong (ctrl + z would also be caught) - if ((input.key === 'w' || input.key === 'W') && input.control && input.type === 'keyDown') { - window.close() - } - }) - } - - window.on('close', function() { - // save geometry - var geometry = settings.read('geometry') || {} - geometry[options.id] = window.getBounds() - settings.write('geometry', geometry, false, true) - }) - - var menu = new Menu() - menu.append(new MenuItem({role: 'cut'})) - menu.append(new MenuItem({role: 'copy'})) - menu.append(new MenuItem({role: 'paste'})) - window.webContents.on('context-menu', (e, data) => { - menu.items[0].enabled = data.editFlags.canPaste - menu.items[1].enabled = data.editFlags.canCopy - menu.items[2].enabled = data.editFlags.canPaste - menu.popup({window: window, x: e.x, y: e.y }) - }, false) - - if (options.shortcuts && !settings.read('read-only')) { - - shortcut.register(window,'CmdOrCtrl+R',function(){ - window.reload() - }) - - shortcut.register(window,'F12',function(){ - window.toggleDevTools() - }) - - } else { - shortcut.register(window,'CmdOrCtrl+R',function(e){ - return false - }) - } - - window.setFocusable(!options.noFocus) - - - return window - -} - - -function intersectionArea(a, b) { - // intersectionArea between two rectangles - - var width = Math.min(a.x + a.width, b.x + b.width) - Math.max(a.x, b.x), - height = Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y) - - return width * height - -} diff --git a/src/server/electron/index.mjs b/src/server/electron/index.mjs deleted file mode 100644 index 1f9179a4..00000000 --- a/src/server/electron/index.mjs +++ /dev/null @@ -1,319 +0,0 @@ -import sourceMap from 'source-map-support' -import {fork} from 'child_process' -import path from 'path' -import {ipcMain} from 'electron' -import electronRemote from '@electron/remote/main' -import * as settings from '../node/settings.mjs' -import DocsServer from '../node/docs-server' -import app from './electron-app.mjs' -import window from './electron-window' -import createTray from './tray.mjs' -import midi from '../node/midi.mjs' -import qrcode from '../node/qrcode.mjs' - -var dev = process.argv[0].includes('node_modules'), - docsServer, - launcher = null, - tray = null, - clientWindows = [], - serverProcess = null - -sourceMap.install({handleUncaughtExceptions: false}) - -function openDocs() { - - if (!docsServer) docsServer = new DocsServer() - - docsServer.open() - -} - - -function openClient() { - - var address = settings.appAddresses()[0] - - function launch() { - var win = window({ - address:address, - shortcuts:true, - fullscreen: settings.read('fullscreen'), - noFocus: settings.read('client-options') && settings.read('client-options').some(x=>x.match(/nofocus=1/i)), - id: 'client' - }) - win.on('error', ()=>{ - console.log('ERR') - }) - if (settings.read('clearCache')) { - // clear browser cache and reload - win.webContents.session.clearCache().then(()=>{ - settings.write('version', settings.infos.version) - win.webContents.reload() - }) - } - clientWindows.push(win) - } - - - if (app.isReady()) { - launch() - } else { - app.on('ready',function(){ - launch() - }) - } - -} - -function startServerProcess() { - - var args = [ '--no-gui'] - - for (var k in settings.read('options')) { - args.push('--' + k) - var val = settings.read(k) - if (typeof val === 'object') { - args = args.concat(val) - } else if (typeof val !== 'boolean') { - args.push(val) - } - } - - serverProcess = fork(app.getAppPath(), args, {stdio: 'pipe', env: {...process.env, OSC_SERVER_PROCESS: 1, ELECTRON_RUN_AS_NODE: 1}}) - - var cb = (data)=>{ - if (data.indexOf('(INFO) Server started') > -1) { - if (!settings.read('no-gui')) openClient() - if (!settings.read('no-qrcode')) setTimeout(()=>{ - qrcode(launcher ? 'svg' : 'terminal', (qrstring)=>{ - if (launcher) { - launcher.webContents.send('stdout', qrstring) - } else { - console.log(qrstring) - } - }) - }) - serverProcess.stdout.off('data', cb) - } - } - serverProcess.stdout.on('data', cb) - - serverProcess.stdout.on('data', (data) => { - console.log(String(data).trim()) - }) - - serverProcess.stderr.on('data', (data) => { - var str = String(data).trim() - if (str.includes('--debug')) return - console.error(str) - }) - - - - serverProcess.on('message', (data) => { - var [command, args] = data - if (command === 'settings.write') { - settings.write(args[0], args[1], false) - } - }) - - serverProcess.on('close', (code) => { - console.log('(INFO) Server stopped') - serverProcess = null - if (global.defaultClient) global.defaultClient.close() - }) - - if (launcher) { - serverProcess.on('close', (code) => { - if (!launcher.isDestroyed()) launcher.webContents.send('server-stopped') - }) - launcher.webContents.send('server-starting') - } - -} - -function stopServerProcess() { - - if (settings.read('no-gui')) { - if (serverProcess) serverProcess.kill('SIGINT') - serverProcess = null - return - } - - var toClose = clientWindows.filter(w=>w && !w.isDestroyed()), - closed = 0 - - if (toClose.length === 0 && serverProcess) { - serverProcess.kill('SIGINT') - serverProcess = null - } - - for (var w of toClose) { - w.on('closed', ()=>{ - closed++ - if (closed === toClose.length) { - clientWindows = [] - if (serverProcess) { - serverProcess.kill('SIGINT') - serverProcess = null - } - } - }) - w.close() - } - -} - -function startLauncher() { - - global.launcherSharedGlobals = { - settings: settings, - openDocs: openDocs, - midiList: midi.list, - midiRestart: ()=>{ - if (serverProcess) { - serverProcess.send('midiRestart') - } - } - } - var address = 'file://' + path.resolve(__dirname + '/../../launcher/' + 'index.html') - - // @electron/remote won't work without this hack - process.mainModule = {require} - electronRemote.initialize() - - app.on('ready', function(){ - - launcher = window({address:address, shortcuts:dev, width:680, height:(40 + 200 + 20 + 24 * Object.keys(settings.options).filter(x=>settings.options[x].launcher !== false).length / 2), node:true, id: 'launcher'}) - - electronRemote.enable(launcher.webContents) - - if (settings.read('useTray')) { - - tray = createTray({ - window: launcher, - openClient: openClient, - app: app, - startServer: startServerProcess, - stopServer: stopServerProcess - }) - - launcher.on('will-close', (e)=>{ - if (clientWindows.some(w=>w && !w.isDestroyed()) || serverProcess) { - launcher.hide() - e.preventDefault() - } - }) - - } - - - launcher.on('close', (e)=>{ - if (tray && (clientWindows.some(w=>w && !w.isDestroyed()) || serverProcess)) { - launcher.hide() - e.preventDefault() - return - } - process.stdout.write = stdoutWrite - process.stderr.write = stderrWrite - if (process.log) process.log = processLog - if (tray) tray.destroy() - }) - - }) - - let processLog = process.log, - stdoutWrite = process.stdout.write, - stderrWrite = process.stderr.write - - if (process.log) { - process.log = function(string, encoding, fd) { - processLog.apply(process, arguments) - launcher.webContents.send('stdout', string) - } - } - - process.stdout.write = function(string, encoding, fd) { - stdoutWrite.apply(process.stdout, arguments) - launcher.webContents.send('stdout', string) - } - - process.stderr.write = function(string, encoding, fd) { - stderrWrite.apply(process.stderr, arguments) - launcher.webContents.send('stderr', string) - } - - ipcMain.on('start',function(e, options){ - - startServerProcess() - - }) - - ipcMain.on('stop',function(e, options){ - - stopServerProcess() - - }) - - ipcMain.on('openClient',function(e, options){ - - openClient() - - }) - - ipcMain.on('showQRCode',function(e, options){ - - qrcode('svg', (qrstring)=>{ - launcher.webContents.send('stdout', qrstring) - }) - - }) - - - ipcMain.on('hide',function(e, options){ - - launcher.hide() - - }) -} - - -if (settings.read('docs')) { - - openDocs() - -} else { - - // normal mode: - // - electron process: launcher and/or built-in client(s) - // - node process: server (node mode in a forked process) - - app.on('ready', ()=>{ - process.on('SIGINT', function() { - if (serverProcess) { - serverProcess.kill('SIGINT') - serverProcess = null - } - process.exit(0) - }) - }) - - app.on('before-quit',()=>{ - if (serverProcess) { - serverProcess.kill('SIGINT') - serverProcess = null - } - }) - - - if (settings.cli) { - - startServerProcess() - - } else { - - startLauncher() - - } - -} diff --git a/src/server/electron/tray.mjs b/src/server/electron/tray.mjs deleted file mode 100644 index 3e17cedb..00000000 --- a/src/server/electron/tray.mjs +++ /dev/null @@ -1,92 +0,0 @@ -import {Menu, Tray, ipcMain} from 'electron' -import * as settings from '../node/settings.mjs' - -var tray = null, - contextMenu = null, - isServerRunning = false - -export default function(options = {}) { - - var icon = __dirname + '/../../assets/logo.png' - if (process.platform === 'darwin') { - icon = __dirname + '/../../assets/logo_tray.png' - } - - tray = new Tray(icon) - contextMenu = Menu.buildFromTemplate([ - { - label: 'Show launcher', - id: 'show', - click: ()=>{ - options.window.show() - } - }, - { - label: 'Hide launcher', - id: 'hide', - click: ()=>{ - options.window.hide() - } - }, - { - label: 'Start server', - id: 'start', - click: ()=>{ - ipcMain.emit('start') - } - }, - { - label: 'Stop server', - id: 'stop', - click: ()=>{ - ipcMain.emit('stop') - } - }, - { - label: 'New client window', - id: 'new', - click: ()=> { - if (isServerRunning) { - options.openClient() - } - } - }, - { - type: 'separator' - }, - { - label: 'Quit', - click: ()=>{ - options.app.quit() - } - }, - ]) - - tray.setContextMenu(contextMenu) - tray.setToolTip(settings.infos.productName) - - function updateMenu(){ - contextMenu.getMenuItemById('start').visible = !isServerRunning - contextMenu.getMenuItemById('stop').visible = isServerRunning - contextMenu.getMenuItemById('show').visible = !options.window.isVisible() - contextMenu.getMenuItemById('hide').visible = options.window.isVisible() - contextMenu.getMenuItemById('new').visible = isServerRunning - tray.setContextMenu(contextMenu) - } - - ipcMain.on('start', function(e, options) { - isServerRunning = true - updateMenu() - }) - - ipcMain.on('stop', function(e, options) { - isServerRunning = false - updateMenu() - }) - - options.window.on('show', updateMenu) - options.window.on('hide', updateMenu) - - return tray - -} diff --git a/src/server/index.js b/src/server/index.js index e8f3279d..97feb840 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -1,15 +1,148 @@ -var runtime = 'node' +require('source-map-support').install({handleUncaughtExceptions: false}) + +var dev = process.argv[0].includes('node_modules'), + settings = require('./settings') + +var serverStarted + +function nodeMode() { + + console.warn('Running with node') + + if (!settings.read('noGui')) { + settings.cli = true + settings.write('noGui', true, true) + console.warn('Headless mode (--no-gui) enabled automatically') + } + + process.on('uncaughtException', (err)=>{ + console.error('A JavaScript error occurred in the main process:') + console.error(err.stack) + }) -if (!process.argv.includes('-n') && !process.argv.includes('--no-gui') - && process.versions.electron && !process.env.ELECTRON_RUN_AS_NODE) -{ - try { - var electron = require('electron') - electron.dialog.showErrorBox = (title, err)=>{ - console.error(title + ': ' + err) - } - runtime = 'electron' - } catch {} } -require(`./${runtime}/`) +if (process.title === 'node' || process.title === 'node.exe') { + + nodeMode() + +} else { + + try { + + require('electron').dialog.showErrorBox = (title, err)=>{ + console.error(title + ': ' + err) + } + + } catch(e) { + + nodeMode() + + } + +} + +var start = function(readyApp) { + + if (!settings.read('guiOnly') && !serverStarted) { + + var server = require('./server'), + osc = require('./osc'), + callbacks = require('./callbacks'), + zeroconf = require('./zeroconf') + + server.bindCallbacks(callbacks) + + serverStarted = true + process.on('exit',()=>{ + if (osc.midi) osc.midi.stop() + zeroconf.unpublishAll() + }) + + } + + if (!settings.read('noGui')) { + + var app = require('./electron-app') + var address = typeof settings.read('guiOnly')=='string'? 'http://' + settings.read('guiOnly') : settings.read('appAddresses')[0] + address += settings.read('urlOptions') + + var launch = ()=>{ + var win = require('./electron-window')({address:address, shortcuts:true, zoom:false, fullscreen: settings.read('fullScreen')}) + return win + } + if (app.isReady()) { + return launch() + } else { + app.on('ready',function(){ + launch() + }) + } + } + +} + + + +if (settings.cli) { + + start() + +} else { + + var app = require('./electron-app'), + path = require('path'), + address = 'file://' + path.resolve(__dirname + '/../launcher/' + 'index.html'), + {ipcMain} = require('electron'), + launcher + + app.on('ready',function(){ + global.settings = settings + global.midilist = require('./midi').list + launcher = require('./electron-window')({address:address, shortcuts:dev, width:680, height:(100 + 8*3 + 29 * Object.keys(settings.options).filter(x=>settings.options[x].launcher !== false).length), node:true, color:'#253040'}) + launcher.on('close', ()=>{ + process.stdout.write = stdoutWrite + process.stderr.write = stderrWrite + if (process.log) process.log = processLog + }) + }) + + let processLog = process.log, + stdoutWrite = process.stdout.write, + stderrWrite = process.stderr.write + + if (process.log) { + process.log = function(string, encoding, fd) { + processLog.apply(process, arguments) + launcher.webContents.send('stdout', string) + } + } + + process.stdout.write = function(string, encoding, fd) { + stdoutWrite.apply(process.stdout, arguments) + launcher.webContents.send('stdout', string) + } + + process.stderr.write = function(string, encoding, fd) { + stderrWrite.apply(process.stderr, arguments) + launcher.webContents.send('stderr', string) + } + + ipcMain.on('start',function(e, options){ + + var gui = start() + + if (settings.read('guiOnly')) { + launcher.hide() + gui.on('close',()=>{ + launcher.close() + }) + } else { + launcher.webContents.send('started') + } + + + }) + + +} diff --git a/src/server/node/ipc/client.mjs b/src/server/ipc/client.js similarity index 87% rename from src/server/node/ipc/client.mjs rename to src/server/ipc/client.js index 5e17545e..50805df2 100644 --- a/src/server/node/ipc/client.mjs +++ b/src/server/ipc/client.js @@ -1,10 +1,10 @@ -import {EventEmitter} from 'events' +var EventEmitter = require('events').EventEmitter var hearbeatInterval = 25000, hearbeatTimeout = 5000, dieTimeout = 60000 -class Client extends EventEmitter { +class Socket extends EventEmitter { constructor(ws, id, address) { @@ -12,7 +12,7 @@ class Client extends EventEmitter { this.id = id - this.address = address.replace('::ffff:', '') + this.address = address.indexOf('::ffff:') === 0 ? address.replace('::ffff:', '') : address this.socket = null @@ -57,8 +57,6 @@ class Client extends EventEmitter { }, hearbeatTimeout) }, hearbeatInterval) - this.emit('created') - } close() { @@ -69,7 +67,7 @@ class Client extends EventEmitter { this.dieTimeout = setTimeout(()=>{ - this.emit('destroyed') + this.emit('close') }, dieTimeout) @@ -97,9 +95,9 @@ class Client extends EventEmitter { } - send(packet) { + send(event, data) { - // see IpcServer.send + var packet = JSON.stringify([event, data]) if (this.connected()) { this.socket.send(packet) @@ -123,4 +121,4 @@ class Client extends EventEmitter { } -export default Client +module.exports = Socket diff --git a/src/server/ipc/server.js b/src/server/ipc/server.js new file mode 100644 index 00000000..9e088409 --- /dev/null +++ b/src/server/ipc/server.js @@ -0,0 +1,59 @@ +var EventEmitter = require('events').EventEmitter, + WebSocketServer = require('ws').Server, + Client = require('./client') + +class Ipc extends EventEmitter { + + constructor(server) { + + super() + + this.clients = {} + this.server = null + + this.server = new WebSocketServer({server: server}) + + this.server.on('connection', (socket, req)=>{ + + var id = req.url.split('/').pop() + + if (!id) return + + if (!this.clients[id]) { + + var client = new Client(socket, id, req.connection.remoteAddress) + this.clients[id] = client + + this.emit('connection', client) + + client.on('close', ()=>{ + delete this.clients[id] + }) + + } else { + + this.clients[id].open(socket) + this.clients[id].flush() + + } + + }) + + } + + send(event, data, id, except) { + + var clients = id ? [this.clients[id]] : this.clients + + for (var k in clients) { + if (!except || this.clients[k] != this.clients[except]) { + if (clients[k]) clients[k].send(event, data) + } + } + + } + + +} + +module.exports = Ipc diff --git a/src/server/midi.js b/src/server/midi.js new file mode 100644 index 00000000..147416d7 --- /dev/null +++ b/src/server/midi.js @@ -0,0 +1,88 @@ +var {PythonShell} = require('python-shell'), + settings = require('./settings') + +var pythonOptions = { + scriptPath:__dirname, + mode:'text', +} + +class MidiConverter { + + constructor() { + + var pythonPath = settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0] + + this.py = new PythonShell('python/midi.py', Object.assign({ + args: [ + settings.read('debug') ? 'debug' : '', + ...settings.read('midi') + ], + pythonPath + }, pythonOptions)) + + } + + send(data) { + + var args = [] + for (i in data.args) { + args.push(data.args[i].value) + } + + this.py.send(JSON.stringify([data.port, data.address, ...args])) + + } + + stop() { + + this.py.childProcess.kill() + + } + + init(receiveOsc) { + + this.receiveOsc = receiveOsc + this.py.on('message', (message)=>{ + MidiConverter.parseIpc(message, this) + }) + + } + + static parseIpc(message, instance) { + + // console.log(message) + var name, data + try { + [name, data] = JSON.parse(message) + } catch (err) { + // console.log(err) + } + if (name == 'log') { + if (data.indexOf('ERROR') === 0) { + console.error(data) + } else { + console.log(data) + } + } else if (name == 'osc') { + instance.receiveOsc(data) + } else if (name == 'error') { + console.error('ERROR: MIDI: ' + data) + if (instance) instance.stop() + } + + } + + static list() { + + var pythonPath = settings.read('midi') ? settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0] : undefined + + PythonShell.run('python/list.py', Object.assign({pythonPath}, pythonOptions), function(err, results) { + if (err) console.error(err) + MidiConverter.parseIpc(results) + }) + + } + +} + +module.exports = MidiConverter diff --git a/src/server/node/address.mjs b/src/server/node/address.mjs deleted file mode 100644 index 013c8ac0..00000000 --- a/src/server/node/address.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import {networkInterfaces} from 'os' - -export default (proto, port)=>{ - var address = Object.values(networkInterfaces()) - .reduce((a,b)=>a.concat(b), []) - .filter(i=>i.family === 'IPv4') - .map(i=>i.address + ':') - - return address.map(x=>proto + x + port) -} diff --git a/src/server/node/auth.mjs b/src/server/node/auth.mjs deleted file mode 100644 index b1fcad0d..00000000 --- a/src/server/node/auth.mjs +++ /dev/null @@ -1,23 +0,0 @@ -import httpAuth from 'http-auth' -import * as settings from './settings.mjs' - -var auth = null - -if (settings.read('authentication')) { - - var [name, pwd] = settings.read('authentication').split(':') - - auth = httpAuth.basic( - { - realm: 'Open Stage Control' - }, - (username, password, callback) => { - // Custom authentication method. - callback(username === name && password === pwd) - } - ) - -} - - -export default auth diff --git a/src/server/node/custom-module.mjs b/src/server/node/custom-module.mjs deleted file mode 100644 index 5169cd61..00000000 --- a/src/server/node/custom-module.mjs +++ /dev/null @@ -1,267 +0,0 @@ -import fs from 'fs' -import vm from 'vm' -import chokidar from 'chokidar' -import path from 'path' -import {Module} from 'module' -import * as settings from './settings.mjs' - -var modulePathExtended = false, - loadedModules = {}, - globalObject = {} - -class CustomModule { - - constructor(file, context, parent=null, mainModule=null) { - - this.module = {exports: null} - this.init = null - this.oscInFilter = null - this.oscOutFilter = null - - this.mainModule = mainModule - - this.parent = parent - this.submodule = !!parent - - this.filename = this.submodule ? file : path.resolve(file) - - this.timeouts = [] - this.intervals = [] - this.submodules = {} - - - this.context = this.submodule ? { - ...context, - require: this.require.bind(this), - } : { - ...context, - loadJSON: (url, errorCallback)=>{ - try { - url = path.resolve(path.dirname(this.filename), url) - var content = fs.readFileSync(url, 'utf8') - if (content[0] === '\ufeff') content = content.slice(1) // remove BOM - return JSON.parse(content) - } catch(e) { - if (typeof(errorCallback) === 'function') { - errorCallback(e) - } else { - console.error('(ERROR, CUSTOM MODULE) could not load json file from ' + url) - console.error(e.message) - } - } - }, - saveJSON: (url, data, errorCallback)=>{ - url = path.resolve(path.dirname(this.filename), url) - try { - return fs.writeFileSync(url, JSON.stringify(data, null, ' ')) - } catch(e) { - if (typeof(errorCallback) === 'function') { - errorCallback(e) - } else { - console.error('(ERROR, CUSTOM MODULE) could not save json file to ' + url) - console.error(e.message) - } - } - }, - console: console, - settings: { - read: settings.read, - appAddresses: settings.appAddresses, - }, - setTimeout: this.setTimeout.bind(this), - clearTimeout: this.clearTimeout.bind(this), - setInterval: this.setInterval.bind(this), - clearInterval: this.clearInterval.bind(this), - require: this.require.bind(this), - nativeRequire: require, - process: process, - global: globalObject - } - - if (!this.submodule && !modulePathExtended) { - process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename)) - process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename), 'node_modules') - Module._initPaths() - modulePathExtended = true - } - - this.load() - - this.watcher = chokidar.watch(this.filename, {awaitWriteFinish: {stabilityThreshold: 200}}).on('change', ()=>{ - if (this.submodule) { - console.log('(INFO) Submodule changed: ' + this.filename) - this.mainModule.reload() - } else { - console.log('(INFO) Custom module changed: ' + this.filename) - this.reload() - } - }) - - } - - load() { - - if (loadedModules[this.filename]) { - this.module.exports = loadedModules[this.filename].module.exports - return true - } - - var code - - try { - code = fs.readFileSync(this.filename, {encoding: 'utf8', flag: 'rs'}) // flag 'rs' to avoid cache issue on windows - } catch(err) { - console.error(`(ERROR, CUSTOM MODULE) Module not found: ${this.filename}`) - return false - } - - var context = vm.createContext({ - ...this.context, - __dirname: path.resolve(path.dirname(this.filename)), - __filename: path.resolve(this.filename), - module: this.module - }) - - - try { - loadedModules[this.filename] = this - vm.runInContext(code, context, { - filename: this.filename - }) - } catch(err) { - loadedModules[this.filename] = null - console.error('(ERROR, CUSTOM MODULE) Error while loading module') - console.log(err) - return false - } - - if (typeof this.module.exports === 'object' && this.module.exports !== null) { - this.init = this.module.exports.init || null - this.oscInFilter = this.module.exports.oscInFilter || null - this.oscOutFilter = this.module.exports.oscOutFilter || null - } - - return true - - } - - unload() { - - if (!loadedModules[this.filename]) return - loadedModules[this.filename] = null - - if (this.module.exports && this.module.exports.unload) { - try { - this.module.exports.unload() - } catch(e) { - console.error('(ERROR, CUSTOM MODULE) Error while calling unload()') - console.error(e) - } - } - - this.module = {exports: null} - this.init = null - this.oscInFilter = null - this.oscOutFilter = null - - for (let timeout of this.timeouts) { - clearTimeout(timeout) - } - - for (let interval of this.intervals) { - clearInterval(interval) - } - - this.timeouts = [] - this.intervals = [] - - for (let name of this.context.app.eventNames()) { - this.context.app.removeAllListeners(name) - } - - for (let name in this.submodules) { - this.submodules[name].unload() - } - this.submodules = {} - - if (this.submodule) { - this.watcher.close() - } - - } - - reload() { - - this.unload() - console.log('(INFO) Reloading custom module...') - if (this.load()) { - console.log('(INFO) Custom module reloaded successfully') - - if (this.module.exports && this.module.exports.reload) { - try { - this.module.exports.reload() - } catch(e) { - console.error('(ERROR, CUSTOM MODULE) Error while calling custom module reload function') - console.error(e) - } - } - } else { - console.error('(ERROR, CUSTOM MODULE) Failed to reload custom module') - this.unload() - } - } - - stop() { - - if (this.module.exports && this.module.exports.stop) { - try { - this.module.exports.stop() - } catch(e) { - console.error('(ERROR, CUSTOM MODULE) Error while calling custom module stop function') - console.error(e) - } - } - } - - setTimeout(fn, t) { - var timeout = setTimeout(fn, t) - this.timeouts.push(timeout) - return timeout - } - - setInterval(fn, t) { - var interval = setInterval(fn, t) - this.intervals.push(interval) - return interval - } - - clearTimeout(timeout) { - clearTimeout(timeout) - if (this.timeouts.includes(timeout)) { - this.timeouts.splice(this.timeouts.indexOf(timeout), 1) - } - } - - clearInterval(interval) { - clearInterval(interval) - if (this.intervals.includes(interval)) { - this.intervals.splice(this.intervals.indexOf(interval), 1) - } - } - - require(filename) { - - if (!path.isAbsolute(filename)) { - filename = path.resolve(path.dirname(this.filename), filename) - } - - this.submodules[filename] = loadedModules[filename] || new CustomModule(filename, this.context, this, this.mainModule || this) - - return this.submodules[filename].module.exports - - } - -} - - -export default CustomModule diff --git a/src/server/node/docs-server.mjs b/src/server/node/docs-server.mjs deleted file mode 100644 index 4de0c842..00000000 --- a/src/server/node/docs-server.mjs +++ /dev/null @@ -1,90 +0,0 @@ -import {EventEmitter} from 'events' -import http from 'http' -import send from 'send' -import path from 'path' -import fs from 'fs' -import open from 'open' -import address from './address.mjs' - -class DocsServer extends EventEmitter { - - constructor() { - - super(...arguments) - - this.baseUrl = path.resolve(__dirname + '/../docs') - this.home = '/docs/getting-started/introduction/' - this.server = null - this.started = false - this.port = 0 - - this.available = true - if (!fs.existsSync(path.join(this.baseUrl, 'index.html'))) { - console.error('(ERROR, DOCS) Documentation assets not found in the app\'s directory.') - this.available = false - } - - - - } - - start() { - - if (this.started || !this.available) return - - this.server = http.createServer(this.route.bind(this)) - this.server.on('error', (e)=>{ - console.error(`(ERROR, DOCS) ${e.message}`) - }) - this.server.listen(0).on('listening', ()=>{ - this.port = this.server.address().port - console.log('(INFO) Documentation server started, docs available at \n ' + address('http://', this.port).join('\n ')) - this.emit('ready') - - }) - this.started = true - - } - - open() { - - if (!this.started || !this.port) { - this.start() - this.on('ready', ()=>{ - open(address('http://', this.port)[0] + this.home) - console.log('(INFO) Opening documentation with default browser...') - }) - } else { - open(address('http://', this.port)[0] + this.home) - console.log('(INFO) Opening documentation with default browser...') - } - - } - - route(req, res) { - - var url = req.url.replace(this.baseUrl, '').split('?')[0] - - if (url[url.length-1] === '/') url += 'index.html' - - if (url.indexOf('/fonts') === 0) url = '../assets' + url - - url = path.join(this.baseUrl, url) - - - if (!fs.existsSync(url)) { - if (url.indexOf('index.html') !== -1) { - return send(req, path.join(this.baseUrl, '/404.html')).pipe(res) - } else { - res.writeHead(403) - res.end() - } - } else { - return send(req, url).pipe(res) - } - - } - -} - -export default DocsServer diff --git a/src/server/node/fragment-manager.mjs b/src/server/node/fragment-manager.mjs deleted file mode 100644 index d1c5e03d..00000000 --- a/src/server/node/fragment-manager.mjs +++ /dev/null @@ -1,81 +0,0 @@ -import chokidar from 'chokidar' - -class FragmentManager { - - constructor(callbacks, ipcServer, webServer) { - - this.ipcServer = ipcServer - this.webServer = webServer - this.callbacks = callbacks - - this.fragments = {} // fragment files contents - this.watchers = {} // fragment files watchers - this.clients = {} // client ids for each watched fragment file - - } - - read(path, raw, clientId, then) { - - this.callbacks.fileRead({path: path, raw: raw}, clientId, true, (result)=>{ - this.fragments[path] = result - then(result) - }, (error)=>{ - this.ipcServer.send('errorLog', `Could not open fragment file:\n ${error}`, clientId) - this.ipcServer.send('fragmentLoad', {path: path, notFound: true}) - this.deleteFragment(path) - }) - - } - - loadFragment(data, clientId) { - - var path = data.path - var resolvedPath = this.webServer.resolvePath(path, clientId) - - if (!resolvedPath) { - this.ipcServer.send('fragmentLoad', {path: path, notFound: true}) - return - } - - if (!this.clients[resolvedPath]) this.clients[resolvedPath] = [] - if (!this.clients[resolvedPath].includes(clientId)) this.clients[resolvedPath].push(clientId) - - if (!this.fragments[resolvedPath]) { - - this.fragments[resolvedPath] = 'LOADING' - - this.read(resolvedPath, data.raw, clientId, (result)=>{ - this.ipcServer.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath], raw: data.raw}, clientId) - }) - - this.watchers[resolvedPath] = chokidar.watch(resolvedPath, {awaitWriteFinish: {stabilityThreshold: 200}}).on('change', ()=>{ - this.read(resolvedPath, data.raw, clientId, (result)=>{ - for (let id of this.clients[resolvedPath]) { - this.ipcServer.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath], raw: data.raw}, id) - } - }) - }).on('unlink', ()=>{ - this.deleteFragment(resolvedPath) - }) - - } else if (this.fragments[resolvedPath] !== 'LOADING') { - - this.ipcServer.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath], raw: data.raw}, clientId) - - } - - } - - deleteFragment(path) { - - this.watchers[path].close() - delete this.clients[path] - delete this.fragments[path] - delete this.fragments[path] - - } - -} - - -export default FragmentManager diff --git a/src/server/node/index.mjs b/src/server/node/index.mjs deleted file mode 100644 index 01c83bd5..00000000 --- a/src/server/node/index.mjs +++ /dev/null @@ -1,46 +0,0 @@ -import sourceMap from 'source-map-support' -import * as settings from './settings.mjs' -import qrcode from './qrcode.mjs' -import zeroconf from './zeroconf.mjs' -import DocsServer from './docs-server.mjs' -import OscServer from './osc/index.mjs' -import WebServer from './server.mjs' -import IpcServer from './ipc/server.mjs' - - -sourceMap.install({handleUncaughtExceptions: false}) - -process.on('uncaughtException', (err)=>{ - console.error('(ERROR) A JavaScript error occurred in the main process:') - console.error(err.stack) -}) - - -if (settings.read('docs')) { - - var docsServer = new DocsServer() - docsServer.open() - -} else { - - var webServer = new WebServer(), - oscServer = new OscServer(), - ipcServer = new IpcServer(webServer, oscServer) - - webServer.start(ipcServer) - oscServer.start(ipcServer) - - process.on('SIGINT', function() { - webServer.stop() - oscServer.stop() - zeroconf.unpublishAll() - process.exit(0) - }) - - if (!process.env.OSC_SERVER_PROCESS) webServer.on('serverStarted', ()=>{ - if (!settings.read('no-qrcode')) { - qrcode('terminal', (qr)=>console.log(qr)) - } - }) - -} diff --git a/src/server/node/ipc/callbacks.mjs b/src/server/node/ipc/callbacks.mjs deleted file mode 100644 index 0d887fbc..00000000 --- a/src/server/node/ipc/callbacks.mjs +++ /dev/null @@ -1,579 +0,0 @@ -import path from 'path' -import fs from 'fs' -import child_process from 'child_process' -import * as settings from '../settings.mjs' -import {deepCopy, resolveHomeDir} from '../utils.mjs' -import FragmentManager from '../fragment-manager.mjs' - -export default class Callbacks { - - constructor(ipcServer, webServer, oscServer) { - - this.oscServer = oscServer - this.ipcServer = ipcServer - this.webServer = webServer - - this.fragmentManager = new FragmentManager(this, ipcServer, webServer) - - this.clipboardContent = {clipboard: null, idClipboard: null} - this.widgetHashTable = {} - } - - getEvents() { - - return Object.getOwnPropertyNames(this.__proto__) - .filter(x=>!['constructor', 'getEvents'].includes(x)) - .filter(x=>typeof this[x] == 'function') - - } - - open(data, clientId) { - // client connected - - this.ipcServer.send('connected', null, clientId) - - var recentSessions = settings.read('recentSessions') - - this.ipcServer.send('sessionList', recentSessions, clientId) - this.ipcServer.send('clipboard', this.clipboardContent, clientId) - this.ipcServer.send('serverTargets', settings.read('send'), clientId) - - if (settings.read('load') && !data.hotReload) return this.sessionOpen({path: settings.read('load')}, clientId) - - } - - close(data, clientId) { - // client disconnected - - } - - created(data, clientId) { - // client created or reconnected - - if (!this.widgetHashTable[clientId]) { - this.widgetHashTable[clientId] = {CONSOLE: {typeTags: ''}} - } - - } - - destroyed(data, clientId) { - // client removed (timeout) - - // clear osc data cache - if (this.widgetHashTable[clientId]) delete this.widgetHashTable[clientId] - - } - - clipboard(data, clientId) { - // shared clipboard - - this.clipboardContent = data - this.ipcServer.send('clipboard', data, null, clientId) - - } - - sessionAddToHistory(data) { - - var recentSessions = settings.read('recentSessions') - - fs.lstat(data, (err, stats)=>{ - - if (err || !stats.isFile()) return - - // add session to history - recentSessions.unshift(path.resolve(data)) - // remove doubles from history - recentSessions = recentSessions.filter(function(elem, index, self) { - return index == self.indexOf(elem) - }) - - // history size limit - if (recentSessions.length > 10) recentSessions = recentSessions.slice(0, 10) - - // save history - settings.write('recentSessions', recentSessions) - - this.ipcServer.send('sessionList', recentSessions) - - }) - } - - sessionRemoveFromHistory(data) { - - var recentSessions = settings.read('recentSessions') - if (recentSessions.indexOf(data) > -1) { - recentSessions.splice(recentSessions.indexOf(data),1) - settings.write('recentSessions',recentSessions) - this.ipcServer.send('sessionList', recentSessions) - } - - } - - sessionSetPath(data, clientId) { - // store client's current session file path - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - if (!settings.read('read-only')) { - this.sessionAddToHistory(data.path) - } - - this.ipcServer.clients[clientId].sessionPath = data.path - - this.ipcServer.send('setTitle', path.basename(data.path), clientId) - - } - - sessionOpen(data, clientId) { - // attempt to read session file - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - this.fileRead(data, clientId, true, (result)=>{ - - this.ipcServer.clients[clientId].sessionPath = data.path // for resolving local file requests - this.ipcServer.send('sessionOpen', {path: data.path, fileContent: result}, clientId) - - }, (error)=>{ - - this.ipcServer.send('error', `Could not open session file:\n ${error}`, clientId) - - }) - - } - - fragmentLoad(data, clientId) { - // attempt to read session file - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - this.fragmentManager.loadFragment(data, clientId) - - } - - sessionOpened(data, clientId) { - // session file opened successfully - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - if (settings.read('state')) { - var send = true - for (var id in this.ipcServer.clients) { - // only make the client send its osc state if there are no other active clients - if (id !== clientId && this.ipcServer.clients[id].connected()) { - send = false - } - } - - var stateContent = fs.readFileSync(settings.read('state'), 'utf8') - if (stateContent[0] === '\ufeff') stateContent = stateContent.slice(1) // remove BOM - var state = { - state: JSON.parse(stateContent), - send: send - } - this.ipcServer.send('stateLoad', state, clientId) - } - - if (data.sync) this.ipcServer.send('stateSend', null, null, clientId) - - this.sessionSetPath({path: data.path}, clientId) - - } - - fileRead(data, clientId, ok, callback, errorCallback) { - // private function - - if (!ok) return - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - data.path = resolveHomeDir(data.path) - - if (!path.isAbsolute(data.path) && settings.read('remote-root')) data.path = path.resolve(resolveHomeDir(settings.read('remote-root')), data.path) - - fs.readFile(data.path, 'utf8', (err, result)=>{ - - var error - - if (err) { - error = err - } else { - try { - if (result[0] === '\ufeff') result = result.slice(1) // remove BOM - result = data.raw ? result : JSON.parse(result) - callback(result) - } catch(err) { - error = err - } - } - - if (error && errorCallback) errorCallback(error) - - }) - - } - - fileSave(data, clientId, ok, callback) { - // private function - - if (!ok) return - - if (!data.path || settings.read('remote-saving') && !RegExp(settings.read('remote-saving')).test(this.ipcServer.clients[clientId].address)) { - - return this.ipcServer.send('notify', { - icon: 'save', - locale: 'remotesave_forbidden', - class: 'error' - }, clientId) - - } - - if (data.path) { - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - data.path = resolveHomeDir(data.path) - - if (!path.isAbsolute(data.path) && settings.read('remote-root')) data.path = path.resolve(settings.read('remote-root'), data.path) - - var root = resolveHomeDir(settings.read('remote-root')) - if (root && !path.normalize(data.path).includes(path.normalize(root))) { - console.error('(ERROR) Could not save: path outside of remote-root') - return this.ipcServer.send('notify', { - class: 'error', - locale: 'remotesave_fail', - message: ' (Could not save: path outside of remote-root)' - }, clientId) - } - - try { - JSON.parse(data.session) - } catch(e) { - return console.error('(ERROR) Could not save: invalid file') - } - - fs.writeFile(data.path, data.session, (err, fdata)=>{ - - if (err) return this.ipcServer.send('notify', { - class: 'error', - locale: 'remotesave_fail', - message: ' (' + err.message + ')' - }, clientId) - - - this.ipcServer.send('notify', { - icon: 'save', - locale: 'remotesave_success', - class: 'session-save', - message: ' ('+ path.basename(data.path) +')' - }, clientId) - - callback() - - }) - - } - - } - - stateOpen(data, clientId) { - // attempt to open state file - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - this.fileRead(data, clientId, true, (result)=>{ - - this.ipcServer.send('stateLoad', {state: result, path: data.path, send: true}, clientId) - - }, (error)=>{ - - this.ipcServer.send('error', `Could not open state file:\n ${error}`, clientId) - - }) - - } - - sessionSave(data, clientId) { - // save session file (.json) - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - if (!path.basename(data.path).match(/.*\.json$/)) return console.error('(ERROR) Sessions must be saved as .json files') - - if (data.backup) { - var newpath, i = 0 - for (;;) { - newpath = data.path.replace(/\.json$/, '-backup' + String(i).padStart(3, 0) + '.json') - if (fs.existsSync(newpath)) i++ - else { - data.path = newpath - break - } - } - } - - - this.fileSave(data, clientId, true, ()=>{ - - console.log('(INFO) Session file saved in '+ data.path) - - if (!data.backup) this.ipcServer.send('sessionSaved', clientId) - - // reload session in other clients - for (var id in this.ipcServer.clients) { - if (id !== clientId && this.ipcServer.clients[id].sessionPath === data.path) { - this.sessionOpen({path: data.path}, id) - } - } - - if (!data.backup) this.sessionSetPath({path: data.path}, clientId) - - }) - - } - - stateSave(data, clientId) { - // save state file (.json) - - if (Array.isArray(data.path)) data.path = path.resolve(...data.path) - - if (!path.basename(data.path).match(/.*\.state/)) return console.error('(ERROR) Statesaves must be saved as .state files') - - this.fileSave(data, clientId, true, ()=>{ - - console.log('(INFO) State file saved in '+ data.path) - - }) - - } - - syncOsc(shortdata, clientId) { - // sync osc (or midi) message with other clients - - // if widget hash is provided, look for cached data - if (!(this.widgetHashTable[clientId] && this.widgetHashTable[clientId][shortdata.h])) return - - var value = shortdata.v, - data = shortdata.h ? this.widgetHashTable[clientId][shortdata.h] : {} - - data = deepCopy(data) - for (var k in shortdata) { - data[k] = shortdata[k] - } - - // only rawTarget will be used - delete data.target - - data.args = data.preArgs ? data.preArgs.concat(value) : [value] - - if (!data.noSync) this.ipcServer.send('receiveOsc', data, null, clientId) - - - } - - sendOsc(shortdata, clientId) { - // send osc (or midi) message and sync with other clients - // shortdata - // { - // h: 'widget_uuid', - // v: widget_value, - // ... // target, preArgs, address, typeTags - // // override cached data - // // required if data.h is not provided - // } - - - // if widget hash is provided, look for cached data - if (shortdata.h && !(this.widgetHashTable[clientId] && this.widgetHashTable[clientId][shortdata.h])) return - - var value = shortdata.v, - data = shortdata.h ? this.widgetHashTable[clientId][shortdata.h] : {} - - data = deepCopy(data) - for (var k in shortdata) { - data[k] = shortdata[k] - } - - if (data.target) { - - var targets = [] - - if (!shortdata.i && settings.read('send') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('send')) - if (data.target) Array.prototype.push.apply(targets, data.target) - - data.args = data.preArgs ? data.preArgs.concat(value) : [value] - - for (var i in targets) { - - if (targets[i] === 'self') { - this.ipcServer.send('receiveOsc',data,clientId) - continue - } else if (targets[i] === null) { - continue - } - - var host = targets[i].split(':')[0], - port = targets[i].split(':')[1] - - if (port) { - - this.oscServer.send(host, port, data.address, data.args, data.typeTags, clientId) - - } - - } - - } - - if (!data.noSync) this.ipcServer.send('receiveOsc', data, null, clientId) - - } - - addWidget(data, clientId) { - // cache widget osc data to reduce bandwidth usage - // data - // { - // hash: 'widget_uuid', - // data: { - // target: ['host:port', ...], - // preArgs: [arg1, ...], - // address: '/address', - // typeTags: 'iif' // one letter per arg typetag - // } - // } - // preArgs, target and typeTags can be empty strings - - if (!this.widgetHashTable[clientId][data.hash]) { - this.widgetHashTable[clientId][data.hash] = {} - } - - var cache = this.widgetHashTable[clientId][data.hash], - widgetData = data.data - - for (var k in widgetData) { - if ((k === 'target' || k === 'preArgs')) { - if (widgetData[k] !== '') { - cache[k] = Array.isArray(widgetData[k]) ? widgetData[k] : [widgetData[k]] - } else { - cache[k] = [] - } - } else { - cache[k] = widgetData[k] - } - } - - // store raw target for client sync widget matching - cache._rawTarget = widgetData.target - - } - - removeWidget(data, clientId) { - // clear widget osc data - - delete this.widgetHashTable[clientId][data.hash] - - } - - reload(data) { - // (dev) hot reload - this.ipcServer.send('reload') - - } - - reloadCss() { - // (dev) hot css reload - this.ipcServer.send('reloadCss') - } - - log(data) { - console.log(data) - } - - error(data) { - console.error(data) - } - - errorLog(data) { - console.error(data) - } - - errorPopup(data) { - this.ipcServer.send('error', data) - } - - listDir(data, clientId) { - // remote file browser backend - - if (data.path) { - // path is requested - data.path[0] = resolveHomeDir(data.path[0]) - } else if (settings.read('last-dir') && fs.existsSync(settings.read('last-dir'))) { - // attempt to use last visited directory - data.path = [settings.read('last-dir')] - } else { - // default directory fallback - data.path = [resolveHomeDir('~/')] - } - - var p = path.resolve(...data.path), - root = resolveHomeDir(settings.read('remote-root')) - - if (root && !path.normalize(p).includes(path.normalize(root))) p = root - - - if (process.platform === 'win32' && !root) { - // Drive list hack on windows - if (data.path.length === 2 && data.path[1] === '..' && (data.path[0].match(/^[A-Z]:\\$/) || data.path[0] === '\\')) { - - child_process.exec('(get-wmiobject win32_volume | ? { $_.DriveType -eq 3 } | % { get-psdrive $_.DriveLetter[0] }).Root -join " "', {shell: 'powershell.exe'}, (error, stdout) => { - - if (error) { - - this.ipcServer.send('notify', {class: 'error', message: 'Failed to list available drives (see server console).'}, clientId) - console.error('(ERROR) Failed to list available drives.') - console.error(error.stack) - - } else { - - this.ipcServer.send('listDir', { - path: '\\', - files: stdout.split(' ') - .filter(value => /[A-Za-z]:/.test(value)) - .map(value => {return {name: value.trim(), folder: true}}) - }, clientId) - - } - }) - return - } - } - - fs.readdir(p, (err, files)=>{ - if (err) { - this.ipcServer.send('notify', {class: 'error', message: err.message}, clientId) - throw err - } else { - var extRe = data.extension ? new RegExp('.*\\.' + data.extension + '$') : /.*/ - var list = files.filter(x=>x[0] !== '.').map((x)=>{ - var folder = false - try { - folder = fs.statSync(path.resolve(p, x)).isDirectory() - } catch(e) {} - return { - name: x, - folder - } - }) - list = list.filter(x=>x.folder || x.name.match(extRe)) - this.ipcServer.send('listDir', { - path: p, - files: list, - root: root - }, clientId) - settings.write('last-dir', p, false, false) - } - }) - - } - -} diff --git a/src/server/node/ipc/server.mjs b/src/server/node/ipc/server.mjs deleted file mode 100644 index b3d707fb..00000000 --- a/src/server/node/ipc/server.mjs +++ /dev/null @@ -1,92 +0,0 @@ -import {WebSocketServer} from 'ws' -import Client from './client.mjs' -import * as settings from '../settings.mjs' -import Callbacks from './callbacks.mjs' - -class IpcServer { - - constructor(webServer, oscServer) { - - this.clients = {} - this.webServer = webServer - this.oscServer = oscServer - this.server = new WebSocketServer({server: webServer.server}) - this.callbacks = new Callbacks(this, webServer, oscServer) - - - this.server.on('connection', (socket, req)=>{ - var url = req.url.split('/'), - auth = url.pop().replace('_', '/'), - id = url.pop() - - if (settings.read('authentication')) { - if (settings.read('authentication') !== Buffer.from(auth, 'base64').toString()) { - console.log(`(WARNING) Client connexion refused for ${req.connection.remoteAddress} (authentication failed)`) - socket.close() - return - } - } - - - if (!id) return - - id = decodeURI(id) - - if (!this.clients[id]) { - - var client = new Client(socket, id, req.connection.remoteAddress) - this.clients[id] = client - - var customModule = settings.read('custom-module') - for (let name of this.callbacks.getEvents()) { - client.on(name, (data)=>{ - if (customModule) { - oscServer.customModuleEventEmitter.emit(name, data, {address: client.address, id: client.id}) - } - this.callbacks[name](data, client.id) - }) - } - - client.on('destroyed', ()=>{ - delete this.clients[id] - }) - - } else { - - this.clients[id].open(socket) - this.clients[id].flush() - - } - - this.clients[id].emit('created') - - }) - - } - - send(event, data, id, except) { - - var packet = JSON.stringify([event, data]) - - if (id) { - // send to a single client - if (this.clients[id]){ - this.clients[id].send(packet) - } - - } else { - // send to all clients except one if specified - for (let id in this.clients) { - if (id != except) { - this.clients[id].send(packet) - } - } - - } - - } - - -} - -export default IpcServer diff --git a/src/server/node/midi.mjs b/src/server/node/midi.mjs deleted file mode 100644 index 9cb7ee17..00000000 --- a/src/server/node/midi.mjs +++ /dev/null @@ -1,203 +0,0 @@ -import {PythonShell} from 'python-shell' -import fs from 'fs' -import path from 'path' -import {EventEmitter} from 'events' -import * as settings from './settings.mjs' - - -var scriptPath = __dirname.includes('server/node') ? - path.resolve(__dirname, '../python') : // src folder structure - path.resolve(__dirname, './python') // app folder structure with rollup chunking - -var midiBinaries = { - x64: { - linux: 'osc-midi-linux', - darwin: 'osc-midi-osx', - win32: 'osc-midi-windows.exe' - }, - arm64:{ - darwin: 'osc-midi-osx', - } -} - -var expectMidiBinaries = fs.existsSync(path.resolve(scriptPath, './.expect-midi-bin')), - expectMidiBinariesError = false - -var pythonPathOverride -if (midiBinaries[process.arch] && midiBinaries[process.arch][process.platform]) { - var p = path.resolve(scriptPath, midiBinaries[process.arch][process.platform]) - if (fs.existsSync(p)) { - pythonPathOverride = p - } else if (expectMidiBinaries) { - expectMidiBinariesError = true - } -} - -class MidiConverter extends EventEmitter{ - - constructor() { - - super() - - if (expectMidiBinariesError) MidiConverter.midiBinariesError() - - this.running = false - this.restarting = false - this.py = {} - - this.start() - - - process.on('message', (m) => { - if (m == 'midiRestart') { - this.restart() - } - }) - - } - - start() { - - if (this.running) return - - this.py = new PythonShell('midi.py', Object.assign({ - args: [ - '--params', - settings.read('debug') ? 'debug' : '', - ...settings.read('midi') - ], - pythonPath: MidiConverter.getPythonPath() - }, {scriptPath, mode:'text'})) - - this.py.childProcess.on('error', (e)=>{ - if (e.code === 'ENOENT') { - console.error(`(ERROR, MIDI) Could not find python binary: ${e.message.replace(/spawn (.*) ENOENT/, '$1')}`) - } else { - console.error(`(ERROR, MIDI) ${e.message}`) - } - }) - - this.py.childProcess.on('exit', (code)=>{ - if (code === null && !this.restarting) console.error('(ERROR, MIDI) Midi bridge process crashed') - this.running = false - this.emit('stopped') - }) - - this.running = true - - } - - stop() { - - if (this.running) this.py.childProcess.kill() - - } - - restart() { - - if (this.running) { - this.restarting = true - this.once('stopped', ()=>{ - this.start() - this.restarting = false - }) - this.stop() - } - } - - send(data) { - - if (!this.running) return - - var args = [] - for (let i in data.args) { - args.push(data.args[i].value) - } - - this.py.send(JSON.stringify([data.port, data.address, ...args])) - - } - - - - init(receiveOsc) { - - this.receiveOsc = receiveOsc - this.py.on('message', (message)=>{ - MidiConverter.parseIpc(message, this) - }) - - } - - static parseIpc(message, instance) { - - // console.log(message) - var name, data - try { - [name, data] = JSON.parse(message) - } catch (err) { - if (settings.read('debug')) console.error(`(ERROR, MIDI) Unparsed python log:\n ${message}`) - } - if (name == 'log') { - if (data.indexOf('ERROR') > -1) { - console.error(data) - } else { - console.log(data) - } - } else if (name == 'debug') { - if (data.indexOf('in:') === 0) { - console.log('\x1b[36m(DEBUG, MIDI)', data, '\x1b[0m') - } else if (data.indexOf('out:') === 0) { - console.log('\x1b[35m(DEBUG, MIDI)', data, '\x1b[0m') - } else { - console.log('(DEBUG, MIDI) ' + data) - } - } else if (name == 'osc') { - instance.receiveOsc(data) - } else if (name == 'error') { - console.error('(ERROR, MIDI) ' + data) - } - - } - - static list() { - - if (expectMidiBinariesError) MidiConverter.midiBinariesError() - - PythonShell.run('midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, {scriptPath, mode:'text'}), function(e, results) { - if (e) { - if (e.code === 'ENOENT') { - console.error(`(ERROR, MIDI) Could not find python binary: ${e.message.replace(/spawn (.*) ENOENT/, '$1')}`) - } else { - console.error(`(ERROR, MIDI) ${e.message}`) - } - } - - for (let r of results) { - MidiConverter.parseIpc(r) - } - }) - - } - - static getPythonPath() { - - var pythonPath = settings.read('midi') ? settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0] : undefined - - if (!pythonPath && pythonPathOverride) pythonPath = pythonPathOverride - - return pythonPath - - } - - static midiBinariesError() { - - console.error(`(ERROR, MIDI) Could not find midi binary file ${p}\nIt may have been deleted by your antivirus.`) - console.log('(INFO, MIDI) Falling back to python implementation (see https://openstagecontrol.ammd.net/docs/midi/midi-configuration/).') - expectMidiBinariesError = false - - } - -} - -export default MidiConverter diff --git a/src/server/node/options.mjs b/src/server/node/options.mjs deleted file mode 100644 index 37358895..00000000 --- a/src/server/node/options.mjs +++ /dev/null @@ -1,110 +0,0 @@ -import fs from 'fs' - -export default { - 's': {alias: 'send', type: 'array', describe: 'default targets for all widgets (ip: port / domain: port / midi: port_name pairs)', - check: (s)=>{ - return s.some(item=>!item.match(/^[^:]*:[0-9]{4,5}$/) && !item.match(/^midi:.*$/)) ? - 'Targets must be ip:port or hostname:port pairs (port must be >= 1024) or midi:port_name pairs' : true - } - }, - 'l': {alias: 'load', type: 'string', file: {name: 'OSC Session (.json)', extensions: ['json']}, describe: 'session file to load (.json)', - check: (arg)=>{ - return fs.existsSync(arg) ? true : 'Session file not found: ' + arg - } - }, - 'state': {type: 'string', file: {name: 'OSC State (.state)', extensions: ['state']}, describe: 'state file to load (.state)', - check: (arg)=>{ - return fs.existsSync(arg) ? true : 'State file not found: ' + arg - } - }, - 'c': {alias: 'custom-module', type: 'string', file: {name: 'OSC Custom module (.js)', extensions: ['js']}, describe: 'custom module file to load (.js)\n WARNING: custom module can access the file system, use at your own risk.', - check: (arg)=>{ - return fs.existsSync(arg) ? true : 'Custom module file not found: ' + arg - }, - }, - 'p': {alias: 'port', type: 'number', describe: 'http port of the server (default to 8080)', - check: (p)=>{ - return (!isNaN(p) && p > 1023 && parseInt(p)===p) ? - true : 'Port must be an integer >= 1024' - } - }, - 'o': {alias: 'osc-port', type: 'number', describe: 'osc input port (default to --port)', - check: (o)=>{ - return (!isNaN(o) && o > 1023 && parseInt(o)===o) ? - true : 'Port must be an integer >= 1024' - } - }, - 'tcp-port': {type: 'number', describe: 'tcp server input port', - check: (t, argv)=>{ - var h = argv['port'] - if (t === h) return 'Tcp input port must different from --port' - return (!isNaN(t) && t > 1023 && parseInt(t)===t) ? - true : 'Port must be an integer >= 1024' - } - }, - 'tcp-targets': {type: 'array', describe: 'tcp servers to connect to (ip: port pairs), does not substitute for --send', - check: (s, argv)=>{ - if (!argv['tcp-port']) return '--tcp-port must be set' - return s.some(item=>!item.match(/^[^:]*:[0-9]{4,5}$/)) ? - 'Targets must be ip:port or hostname:port pairs (port must be >= 1024)' : true - } - }, - 'm': {alias: 'midi', type: 'array', describe: 'midi router settings', - check: (o)=>{ - var err = o.filter(item=>!item.match(/^(list|debug|jack|sysex|mtc|rpn|nrpn|active_sensing|note_off_velocity|no_auto_note_off|pc_offset|path=(.*)|[^:]+:(virtual|[^,]+,[^,]+))$/)) - return err.length ? `Invalid option${err.length > 1 ? 's' : ''}: ${err.join(', ')}` : true - } - }, - 'd': {alias: 'debug', type: 'boolean', describe: 'log received osc messages in the console'}, - 'n': {alias: 'no-gui', type: 'boolean', describe: 'disable default gui'}, - 'fullscreen': {type: 'boolean', describe: 'launch in fullscreen mode (only affects the default client gui)'}, - 't': {alias: 'theme', type: 'array', file: {name: 'css file (.css)', extensions: ['css']}, describe: 'theme name or path (multiple values allowed)'}, - 'client-options': {type: 'array', describe: 'client options (opt=value pairs)', - check: (o)=>{ - return o.some(item=>!item.match(/^[^=]*=[^=]*$/)) ? - 'Options must be key=value pairs' : true - } - }, - 'disable-vsync': {type: 'boolean', describe: 'disable gui\'s vertical synchronization', restart: true}, - 'force-gpu': {type: 'boolean', describe: 'ignore chrome\'s gpu blacklist', restart: true}, - 'read-only': {type: 'boolean', describe: 'disable session editing and session history changes'}, - 'remote-saving': {type: 'string', describe: 'disable remote session saving for hosts that don\'t match the regular expression', - check: (r, argv)=>{ - var msg = true - try { - RegExp(r) - } catch (e) { - msg = e - } - return msg - } - }, - 'remote-root': {type: 'string', describe: 'set remote file browsing root folder', file: {folder: true}}, - 'authentication': {type: 'string', describe: 'restrict access to "user:password" (remote clients will be prompted for these credentials)', - check: (a, argv)=>{ - return a.match(/[^:]*:[^:]+/) ? true : 'Auth must be a user:password pair.' - } - }, - 'instance-name': {type: 'string', describe: 'used to differentiate multiple instances in a zeroconf network'}, - 'use-ssl': {type: 'boolean', describe: 'set to true to use HTTPS protocol instead of HTTP (a self-signed certificate will be created)'}, - - // cli only - 'disable-gpu': {type: 'boolean', describe: 'disable hardware acceleration', launcher: false}, - 'inspect': {type: 'boolean', describe: 'enable node/electron inspector', launcher: false}, - 'cache-dir': {type: 'string', describe: 'override default cache directory', launcher: false}, - 'config-file': {type: 'string', describe: 'override default config file (defaults to cache-dir/config.json)', launcher: false}, - 'docs': {type: 'boolean', describe: 'serve documentation website locally and open it with the system\'s default browser', launcher: false}, - 'client-position': {type: 'string', describe: 'position of the client window ("x,y" pair of integers)', launcher: false, - check: (s)=>{ - return !s.match(/^[0-9]+,[0-9]+$/) ? - 'Position must a x,y pair of integers' : true - } - }, - 'client-size': {type: 'string', describe: 'size of the client window ("width,height" pair of integers)', launcher: false, - check: (s)=>{ - return !s.match(/^[0-9]+,[0-9]+$/) ? - 'Size must a x,y pair of integers' : true - } - }, - 'no-qrcode': {type: 'boolean', describe: 'disable qrcode when the server starts', launcher: false} -} diff --git a/src/server/node/osc/index.mjs b/src/server/node/osc/index.mjs deleted file mode 100644 index 4b0444c0..00000000 --- a/src/server/node/osc/index.mjs +++ /dev/null @@ -1,281 +0,0 @@ -import {EventEmitter} from 'events' -import * as settings from '../settings.mjs' -import OscUDPServer from './udp.mjs' -import OscTCPServer from './tcp.mjs' -import CustomModule from '../custom-module.mjs' -import MidiServer from '../midi.mjs' - -export default class OscServer { - - constructor(){ - - this.oscUDPServer = new OscUDPServer() - this.oscTCPServer = new OscTCPServer() - this.tcpInPort = settings.read('tcp-port') - this.midiServer = settings.read('midi') ? new MidiServer() : null - - this.debug = settings.read('debug') - - this.customModuleEventEmitter = new EventEmitter() - this.customModule = settings.read('custom-module') ? new CustomModule(settings.read('custom-module'), { - app: this.customModuleEventEmitter, - restartMidiBackend: ()=>{if (this.midiServer) this.midiServer.restart()}, - tcpServer: this.oscTCPServer, - sendOsc: this.sendOsc.bind(this), - receiveOsc: this.receiveOsc.bind(this), - send: (host, port, address, ...args)=>{ - if (host.indexOf(':') > -1) { - args.unshift(address) - address = port - var split = host.split(':') - host = split[0] - port = parseInt(split[1]) - } - - this.sendOsc({host, port, address, args:args.map(x=>this.parseArg(x))}) - }, - receive: (host, port, address, ...args)=>{ - if (host[0] === '/') { - // host and port can be skipped - if (address !== undefined) args.unshift(address) - if (port !== undefined) args.unshift(port) - address = host - host = port = undefined - } else if (host.indexOf(':') > -1) { - args.unshift(address) - address = port - var split = host.split(':') - host = split[0] - port = parseInt(split[1]) - } - var lastArg = args[args.length - 1], - options = {} - if (typeof lastArg === 'object' && lastArg !== null && lastArg.clientId !== undefined) { - options = args.pop() - } - this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x, null, true)), cm: 1}, options.clientId) - }, - }) : {} - - } - - parseArg(arg, type, allowObjects = false){ - - if (arg === null) return null - - if (typeof arg === 'object' && arg.type && arg.type.length === 1) return arg - - if (type && type[0].match(/[bhtdscrmifTFNI]/)) { - - type = type[0] - - switch (type) { - case 'i': - return {type: type, value: parseInt(arg)} - case 'd': - case 'f': - return {type: type, value: parseFloat(arg)} - case 'T': - case 'F': - case 'N': - return {type: type} - default: - return {type: type, value: arg} - - - } - - } - - switch (typeof arg) { - case 'number': - return {type: 'f', value: arg} - case 'boolean': - return {type: arg ? 'T' : 'F', value: arg} - case 'string': - return {type: 's', value: arg} - default: - if (allowObjects) { - // Allow js objects in args when receiving from a custom module - // they will eventually be serialized (as json) with the rest of - // the ws message but the client will de-serialize it automatically - // note: type "o" is off-spec, but we don't use typetag in this case anyway - return {type: 'o', value: arg} - } else { - return {type: 's', value: JSON.stringify(arg)} - } - } - } - - sendOsc(data){ - - if (!data) return - - if (data.host == 'midi') { - - if (this.midiServer) this.midiServer.send(data) - - } else { - - if (typeof data.address !== 'string' || data.address[0] !== '/') { - console.error('(ERROR, OSC) Malformed address: ' + data.address) - return - } - - if (isNaN(parseInt(data.port))) { - console.error('(ERROR, OSC) Invalid port: ' + data.port) - return - } - - if (this.tcpInPort && this.oscTCPServer.clients[data.host] && this.oscTCPServer.clients[data.host][data.port]) { - - this.oscTCPServer.clients[data.host][data.port].send({ - address: data.address, - args: data.args - }) - - } else { - - this.oscUDPServer.send({ - address: data.address, - args: data.args - }, data.host, data.port) - - } - - if (this.debug) { - console.log('\x1b[35m(DEBUG, OSC) Out: ', `{ address: '${data.address}', args: `, data.args, '} To: ' + data.host + ':' + data.port, '\x1b[0m') - } - - } - - - } - - receiveOsc(data, clientId){ - - if (!data) return - - for (var i in data.args) { - data.args[i] = data.args[i].value - } - - if (data.args.length==1) data.args = data.args[0] - - this.ipcServer.send('receiveOsc', data, clientId) - - if (this.debug) console.log('\x1b[36m(DEBUG, OSC) In: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port, '\x1b[0m') - - } - - - oscInFilter(data){ - if (this.customModule.oscInFilter) { - try { - return this.customModule.oscInFilter(data) - } catch(e) { - console.error('(ERROR, CUSTOM MODULE)', e) - return data - } - } else { - return data - } - } - oscOutFilter(data){ - if (this.customModule.oscOutFilter) { - try { - return this.customModule.oscOutFilter(data) - } catch(e) { - console.error('(ERROR, CUSTOM MODULE)', e) - return data - } - } else { - return data - } - } - - oscInHandler(msg, timetag, info){ - var data = this.oscInFilter({address: msg.address, args: msg.args, host: info.address, port: info.port}) - if (!data) return - this.receiveOsc(data) - } - - oscInHandlerWrapper(msg, timetag, info) { - var delay = timetag? Math.max(0,timetag.native - Date.now()) : 0 - if (delay) { - setTimeout(()=>{ - this.oscInHandler(msg, timetag, info) - }, delay) - } else { - this.oscInHandler(msg, timetag, info) - } - } - - start(ipcServer){ - - this.ipcServer = ipcServer - - if (this.midiServer) this.midiServer.init((data)=>{ - - data = this.oscInFilter({address: data.address, args: data.args, host: data.host, port: data.port}) - - if (!data) return - - this.receiveOsc(data) - - }) - - this.oscUDPServer.on('message', this.oscInHandlerWrapper.bind(this)) - this.oscUDPServer.start() - - if (settings.read('tcp-port')) { - this.oscTCPServer.on('message', this.oscInHandlerWrapper.bind(this)) - this.oscTCPServer.start() - } - - if (this.customModule.init) { - try { - this.customModule.init() - } catch(e) { - console.error('(ERROR, CUSTOM MODULE)', e) - } - } - - } - - stop() { - - if (this.customModule.stop) this.customModule.stop() - if (this.midiServer) this.midiServer.stop() - - } - - send(host, port, address, args, typeTags, clientId) { - // public send function - - var message = [] - - if (!Array.isArray(args)) args = [args] - - if (typeof args === 'object' && args !== null) { - - var typeTag, - arg - - for (var i = 0; i < args.length; i++) { - - if (typeTags && typeTags[i]) typeTag = typeTags[i] - arg = this.parseArg(args[i], typeTag) - - if (arg !== null) message.push(arg) - - } - } - - var data = this.oscOutFilter({address:address, args: message, host: host, port: port, clientId: clientId}) - - this.sendOsc(data) - - } - -} diff --git a/src/server/node/osc/osc.mjs b/src/server/node/osc/osc.mjs deleted file mode 100644 index 4dc68d46..00000000 --- a/src/server/node/osc/osc.mjs +++ /dev/null @@ -1,7 +0,0 @@ -import osc from 'osc/src/osc.js' -import transports from 'osc/src/platforms/osc-node.js' - -osc.UDPPort = transports.UDPPort -osc.TCPSocketPort = transports.TCPSocketPort - -export default osc diff --git a/src/server/node/osc/udp.mjs b/src/server/node/osc/udp.mjs deleted file mode 100644 index cf056f4e..00000000 --- a/src/server/node/osc/udp.mjs +++ /dev/null @@ -1,48 +0,0 @@ -import osc from './osc.mjs' -import * as settings from '../settings.mjs' -import zeroconf from '../zeroconf.mjs' - -export default class OscUDPServer { - - constructor() { - - this.port = settings.read('osc-port') || settings.read('port') || 8080 - - this.server = new osc.UDPPort({ - localAddress: '0.0.0.0', - localPort: this.port, - metadata: true, - broadcast: true - }) - - this.server.on('error', function(e) { - if (e.code === 'EADDRINUSE') { - console.error(`(ERROR, UDP) could not open port ${this.port} (already in use) `) - } else { - console.error('(ERROR, UDP)', e) - } - }) - - this.on = this.server.on.bind(this.server) - this.send = this.server.send.bind(this.server) - } - - start() { - - this.server.open() - - zeroconf.publish({ - name: settings.infos.productName + (settings.read('instance-name') ? ' (' + settings.read('instance-name') + ')' : ''), - protocol: 'udp', - type: 'osc', - port: this.port - }) - - } - - stop() { - - this.server.close() - - } -} diff --git a/src/server/node/qrcode.mjs b/src/server/node/qrcode.mjs deleted file mode 100644 index b9565315..00000000 --- a/src/server/node/qrcode.mjs +++ /dev/null @@ -1,39 +0,0 @@ -import QRCode from 'qrcode' -import * as settings from './settings.mjs' - -export default function qrcode(mode, callback){ - - var qrstring = '', - promises = [] - - if (mode == 'file') { - promises.push(QRCode.toString(settings.appAddresses().pop(), {type:'svg', small: true, margin: 1})) - } else { - for (var add of settings.appAddresses().filter(a=>!a.includes('127.0.0.1') && !a.includes('localhost'))) { - if (mode == 'svg') { - promises.push(QRCode.toString(add,{type:'svg', small: true, margin: 1})) - } else if (mode == 'terminal') { - promises.push(QRCode.toString(add,{type:'terminal', small: true})) - } - } - } - - Promise.all(promises).then(values=>{ - for (var qr of values) { - if (mode === 'svg') { - qrstring += '
          ' + qr + '
          ' - if (values.length > 1) { - qrstring += '(' + add + ')' - } - } else { - qrstring += '\n' + qr.replace(/^/gm, ' ' + '') - if (values.length > 1) { - qrstring += ' (' + add + ')' - } - } - } - callback(qrstring) - }) - - -} diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs deleted file mode 100644 index 3f7684fc..00000000 --- a/src/server/node/server.mjs +++ /dev/null @@ -1,311 +0,0 @@ -import http from 'http' -import https from 'https' -import {EventEmitter} from 'events' -import path from 'path' -import fs from 'fs' -import send from 'send' -import replaceStream from 'replacestream' -import * as settings from './settings.mjs' -import './ssl.mjs' -import auth from './auth.mjs' -import theme from './theme.mjs' -import zeroconf from './zeroconf.mjs' -import qrcode from './qrcode.mjs' -import {resolveHomeDir} from './utils.mjs' - -class WebServer extends EventEmitter { - - constructor() { - - super() - - this.ipcServer = null - - this.qrcode = '' - this.prod = !process.argv[0].includes('node_modules'), - this.debug = settings.read('debug'), - this.remoteRoot = settings.read('remote-root') - - var route = auth ? auth.check(this.httpRoute.bind(this)) : this.httpRoute.bind(this) - if (settings.read('use-ssl')) { - this.server = https.createServer(settings.read('ssl-certificate'), route) - } else { - this.server = http.createServer(route) - } - - // file request resolution directories - // add theme dirs - this.resolveDirs = theme.files.map(x=>path.dirname(x)), - // dedupe - this.resolveDirs = this.resolveDirs.filter((x, index)=>{return this.resolveDirs.indexOf(x) === index}) - // add remote root or absolute - this.resolveDirs.push(this.remoteRoot || '') - - if (!this.prod) { - // add src root folder for debugging - this.resolveDirs.push(path.resolve(__dirname + '/../../../')) - } - - this.ignoredNotFound = [ - '/apple-touch-icon-precomposed.png', - '/favicon.ico', - '/apple-touch-icon.png' - ] - - - } - - start(ipcServer) { - - this.ipcServer = ipcServer - - - theme.on('update', ()=>{ - ipcServer.send('reloadCss') - }) - - this.server.listen(settings.read('port') || 8080) - - var proto = settings.read('use-ssl') ? https : http - proto.get(settings.appAddresses()[0] + '/osc-ping', { - auth: settings.read('authentication'), - rejectUnauthorized: false - },()=>{}).on('error', ()=>{this.httpCheck(false)}) - - this.httpCheckTimeout = setTimeout(()=>{this.httpCheck(false)}, 5000) - - zeroconf.publish({ - name: settings.infos.productName + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''), - type: 'http', - port: settings.read('port') || 8080 - }).on('error', (e)=>{ - console.error(`(ERROR, ZEROCONF) ${e.message}`) - }) - - this.server.on('error', (e)=>{ - if (e.code === 'EADDRINUSE') { - console.error(`(ERROR, HTTP) Could not open port ${this.port} (already in use) `) - } else { - console.error(`(ERROR, HTTP) ${e.message}`) - } - }) - - } - - stop() { - - this.server.close() - - } - - resolvePath(url, clientId) { - - var sessionPath - - if (this.ipcServer.clients[clientId]) { - sessionPath = path.dirname(this.ipcServer.clients[clientId].sessionPath) - } - - url = resolveHomeDir(url) - url = url.split('?')[0] - - for (var i = sessionPath ? -1 : 0; i < this.resolveDirs.length; i++) { - var p = i === -1 ? sessionPath : this.resolveDirs[i] - - if (i == this.resolveDirs.length - 1 && this.remoteRoot) { - // strip out remote-root path from request url when resolving against it - url = url.replace(settings.read('remote-root'), '') - } - - p = path.resolve(path.join(p, url)) - - if (fs.existsSync(p)) return p - } - - if (this.debug && !this.ipcServer.clients[clientId]) { - // safari seems to be picky with cookies - if (clientId === undefined) console.log(`(DEBUG, HTTP) Could not resolve requested url ${url} (client id not found in http cookies)`) - // this should never happen, but just in case... - // it happens when importing css file from theme - else console.log(`(DEBUG, HTTP) Requested url ${url} not resolved against session path (unregistered client id ${clientId})`) - } - - return false - - } - - sendFile(req, res, path) { - - var fpath = path.split('?')[0] - var stats = fs.statSync(fpath) - if (!stats || !stats.isFile()) { - throw `File "${fpath}" not found.` - } - var lastModified = new Date(stats.mtime) - lastModified.setMilliseconds(0) - res.setHeader('Cache-Control', 'no-cache') - res.setHeader('Last-Modified', lastModified.toUTCString()) - if ( - req.headers['if-modified-since'] && new Date(req.headers['if-modified-since']).getTime() >= lastModified.getTime() - ) { - res.statusCode = 304 - res.end() - return - } - return send(req, fpath).pipe(res) - } - - httpRoute(req, res) { - - var url = req.url - - if (url === '/qrcode'){ - - // qrcode image - - res.setHeader('Content-Type', 'image/svg+xml') - let str = this.qrcode, - buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) - res.write(buf) - res.end() - - } else if (url === '/' || url.indexOf('/?') === 0) { - - // index.html - - var ip = req.connection.remoteAddress.replace('::ffff:', '') - - var clientOptions = {} - if (settings.read('client-options')) { - for (var o of settings.read('client-options')) { - if (!o.includes('=')) continue - var [k, v] = o.split('=') - clientOptions[k] = v - } - } - res.setHeader('Cache-Control', 'no-store') - fs.createReadStream(path.resolve(__dirname + '/../../client/index.html')) - .pipe(replaceStream('', ` - `)) - .pipe(res) - - } else if (url.indexOf('__APP_THEME__.css') != -1) { - - // user theme(s) - - res.setHeader('Content-Type', 'text/css') - - var etag = settings.read('theme') ? theme.hash : 'empty-theme' - res.setHeader('Cache-Control', 'no-cache') - res.setHeader('ETag', etag) - if (req.headers['if-none-match'] && req.headers['if-none-match'] === etag) { - res.statusCode = 304 - res.end() - return - } - - if (settings.read('theme')) { - let str = theme.get(), - buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) - res.write(buf) - } else { - res.write('') - } - res.end() - - } else if (url.match(/^\/+__APP_DIR__\//)) { - - // osc asset files - - try { - this.sendFile(req, res, path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) - return true - } catch(e) {} - - - console.error(`(ERROR, HTTP) File not found: ${url}`) - - if (url.match(/\/client\/index.*\.js/)) { - console.warn('(WARNING) It seems a client attempted to load an older version of the app,', - 'this may occur when using a homescreen bookmark on mobile devices.', - 'If that\'s the case, please delete it and browse to the app\'s url again.') - } - - res.writeHead(404) - res.end() - - - } else { - - // user files - - // windows absolute path fix - url = url.replace('_:_', ':') // escaped drive colon - url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash - - if (url.match(/\.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i) || - url.match(/\.mjs$/) && !this.prod) { - - // Resolution order: session path, theme path, absolute path - var id - if (req.headers.cookie) { - id = (req.headers.cookie.match(/client_id=([^;]+)/) || [])[1] - } - - var resolvedPath = this.resolvePath(decodeURI(url), id) - - if (resolvedPath) { - try { - this.sendFile(req, res, resolvedPath) - return true - } catch(e) {} - } - - if (!this.ignoredNotFound.includes(url)) { - console.error(`(ERROR, HTTP) File not found: ${url}`) - } - - res.writeHead(404) - res.end() - - } else if (url.includes('/osc-ping')) { - this.httpCheck(true) - } else { - res.writeHead(403) - res.end() - } - - } - - } - - httpCheck(ok, error) { - - if (!this.httpCheckTimeout) return - - clearTimeout(this.httpCheckTimeout) - this.httpCheckTimeout = null - - if (ok) { - console.log('(INFO) Server started, app available at \n ' + settings.appAddresses().join('\n ')) - this.emit('serverStarted') - qrcode('file', (qr)=>{ - this.qrcode = qr - }) - } else { - if (error) { - console.error('(ERROR, HTTP) Server setup error: ' + error.message) - } - console.error('(ERROR, HTTP) Could not setup http server, maybe try a different port ?') - } - - } -} - -export default WebServer diff --git a/src/server/node/settings.mjs b/src/server/node/settings.mjs deleted file mode 100644 index 804c81e0..00000000 --- a/src/server/node/settings.mjs +++ /dev/null @@ -1,220 +0,0 @@ -import path from 'path' -import fs from 'fs' -import yargs from 'yargs' -import envPaths from 'env-paths' -import infos from '../../../package.json' -import options from './options.mjs' -import address from './address.mjs' - -var argv = process.argv.slice() - -// Note : on windows, electron stops parsing after the first argument containing a colon -// https://github.com/electron/electron/pull/13039 -// windows cli users need to add a double dash (--) before their options to avoid that -// it must be stripped to let yargs work normally - -// rmeove all args before the first actual cli arg -while (argv.length) { - if (argv[0][0] != '-' || argv[0] == '--') { - argv.splice(0, 1) - } else if (argv[0][0] == '-' ) { - break - } -} - -argv = yargs(argv) - .parserConfiguration({'boolean-negation': false}) - .help('help').usage('\nUsage:\n $0 [options]').alias('h', 'help') - .options(options) - .check((argv)=>{ - var err = [] - for (let key in options) { - if (options[key].check && argv[key] != undefined) { - var c = options[key].check(argv[key],argv) - if (c!==true) { - err.push(`-${key}: ${c}`) - } - } - } - return err.length ? err.join('\n') : true - }) - .strict() - .version(infos.version).alias('v','version') - -argv = argv.argv -delete argv._ -delete argv.$0 - -// clean argv -var optNames = [], - cliOnly = [] - -for (let k in options) { - var name = options[k].alias || k - optNames.push(name) - if (options[k].launcher === false) { - cliOnly.push(name) - } -} - -for (var i in argv) { - if (argv[i] === false || !optNames.includes(i)) { - delete argv[i] - } -} -delete argv._ -delete argv.$0 - -// are we in a terminal ? -var cli = false -for (let i in argv) { - if (!cliOnly.includes(i)) cli = true -} -if (!process.versions.electron || process.env.ELECTRON_RUN_AS_NODE) { - cli = true -} - - -var settings = { - options: argv, - recentSessions: [], - checkForUpdates: true -} - -// store cli-only options (read-only) -for (let k in argv) { - if (options[k] && options[k].launcher === false) { - settings[k] = argv[k] - } -} - - - -///////////////// config paths - -var baseDir, configPath, configPathExists = true, config = {} - -if (argv['cache-dir']) { - baseDir = path.isAbsolute(argv['cache-dir']) ? argv['cache-dir'] : path.resolve(process.cwd(), argv['cache-dir']) -} else { - baseDir = envPaths(infos.name, { - suffix: '' - }).config -} - -if (!fs.existsSync(baseDir)) { - try { - fs.mkdirSync(baseDir) - } catch(e) { - configPathExists = false - console.error('(ERROR) Could not create config folder:' + baseDir) - console.error(e) - } -} - -if (configPathExists) { - if (argv['config-file']) { - configPath = path.isAbsolute(argv['config-file']) ? argv['config-file'] : path.resolve(process.cwd(), argv['config-file']) - } else { - configPath = path.join(baseDir, 'config.json') - } - if (fs.existsSync(configPath)) { - try { - config = JSON.parse(fs.readFileSync(configPath,'utf-8')) - } catch(e) { - console.error('(ERROR) Could not read config from file:' + configPath) - console.error(e) - } - } else { - try { - fs.writeFileSync(configPath, '{}') - } catch(e) { - console.error('(ERROR) Could not create config file:' + configPath) - console.error(e) - } - } - if (cli) { - for (let k in config) { - if (k === 'options') continue - settings[k] = config[k] - } - } else { - for (let k in config) { - if (k === 'options') { - Object.assign(config.options, settings.options) - } - settings[k] = config[k] - } - } -} - -if (!configPath) { - console.warn('(WARNING) Config directory not found, settings and session history will not be saved.') -} - -///////////////// - - -export { - options, - cli, - infos, - baseDir as configPath -} - -export function read(key){ - return settings.options[key] !== undefined ? settings.options[key] : settings[key] -} -export function write(key, value, tmp, sync) { - - settings[key] = value - - if (!tmp && configPathExists) { - - if (process.send) { - // server running as child process of launcher - // -> just pass the modification to the launcher process - process.send(['settings.write', [key, value]]) - } else { - config[key] = value - if (config.options) { - // don't save cli-only options - for (var k in config.options) { - if (options[k] && options[k].launcher === false) { - delete config.options[k] - } - } - } - if (sync) { - fs.writeFileSync(configPath, JSON.stringify(config, null, 4)) - } else { - fs.writeFile(configPath, JSON.stringify(config, null, 4), function(err, data) { - if (err) throw err - }) - } - - } - - } - - // we are in launcher process -> update server process' config - if (global.serverProcess) { - global.serverProcess.send(['settings.write', [key, value]]) - } - -} - -export function appAddresses() { - return address(read('use-ssl') ? 'https://' : 'http://', settings.options.port || 8080) -} - -if (process.send) { - // server running as child process of launcher - // update local config when the main config is modified - process.on('message', function(data) { - var [command, args] = data - if (command === 'settings.write') { - write(args[0], args[1], true) - } - }) -} diff --git a/src/server/node/ssl.mjs b/src/server/node/ssl.mjs deleted file mode 100644 index 468129d5..00000000 --- a/src/server/node/ssl.mjs +++ /dev/null @@ -1,74 +0,0 @@ -import forge from 'node-forge' -import * as settings from './settings.mjs' - -var pki = forge.pki, - certificate = settings.read('ssl-certificate') - -forge.options.usePureJavaScript = true - -// Generate a random Serial number for the certificate -// matth-c3 @ https://github.com/digitalbazaar/forge/issues/673#issuecomment-500900852 -function randomSerialNumber() { - var hexString = forge.util.bytesToHex(forge.random.getBytesSync(16)) - - var mostSiginficativeHexAsInt = parseInt(hexString[0], 16) - if (mostSiginficativeHexAsInt < 8) { - return hexString - } - - mostSiginficativeHexAsInt -= 8 - return mostSiginficativeHexAsInt.toString() + hexString.substring(1) -} - -function createCertificate() { - - console.log('(INFO) Creating self signed ssl certificate...') - - var keys = pki.rsa.generateKeyPair(2048), - cert = pki.createCertificate() - - cert.publicKey = keys.publicKey - cert.validity.notBefore = new Date() - cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1) - cert.serialNumber = randomSerialNumber() - - var attrs = [ - {name:'commonName',value: settings.infos.name}, - {name:'subjectAltName',value: settings.infos.productName} - ] - - cert.setSubject(attrs) - cert.setIssuer(attrs) - cert.sign(keys.privateKey) - - settings.write('ssl-certificate', { - key: pki.privateKeyToPem(keys.privateKey), - cert: pki.certificateToPem(cert) - }) - -} - -if (settings.read('use-ssl')){ - - if (!certificate) { - - createCertificate() - - } else { - - var cert = pki.certificateFromPem(certificate.cert) - - if ( - cert.serialNumber === '00' || - new Date() > new Date(cert.validity.notAfter) || - cert.subject.attributes[1].value !== settings.infos.productName - ) { - console.log('(INFO) Self-signed ssl certificate in cache has expired or is invalid') - createCertificate() - } else { - console.log('(INFO) Using self-signed ssl certificate in cache') - } - - } - -} diff --git a/src/server/node/theme.mjs b/src/server/node/theme.mjs deleted file mode 100644 index ec029c1e..00000000 --- a/src/server/node/theme.mjs +++ /dev/null @@ -1,85 +0,0 @@ -import fs from 'fs' -import path from 'path' -import chokidar from 'chokidar' -import {EventEmitter} from 'events' -import crypto from 'crypto' -import * as settings from './settings.mjs' - -class Theme extends EventEmitter { - - constructor() { - - super() - - this.defaultColor = '#151a24' - this.backgroundColor = this.defaultColor - - this.css = [] - this.watcher = null - this.themes = settings.read('theme') || [] - this.files = [] - this.hash = '' - - if (!this.themes.length) return this - - if (this.themes.length > 1 && fs.existsSync(this.themes.join(' '))) { - - this.files.push(this.themes.join(' ')) - - } else { - - for (let theme of this.themes) { - - if (theme.includes('.css') && fs.existsSync(theme)) { - this.files.push(theme) - } else if (!theme.includes('.css') && fs.existsSync(path.resolve(__dirname + '/../../assets/themes/' + theme + '.css'))) { - this.files.push(path.resolve(__dirname + '/../../assets/themes/' + theme + '.css')) - } else { - console.error('(ERROR) Theme not found: "' + theme) - } - } - - } - - if (this.files.length) { - - this.watcher = chokidar.watch(this.files, {awaitWriteFinish: {stabilityThreshold: 200}}).on('change', ()=>{ - this.load() - this.emit('update') - }) - - } - - this.load() - - } - - load() { - - this.css = [] - - for (let i in this.files) { - - try { - this.css.push(fs.readFileSync(this.files[i],'utf-8')) - } catch(err) { - console.error('(ERROR) Could not load theme "' + this.files[i]) - } - - } - - this.hash = crypto.createHash('sha1').update(this.get()).digest('base64') - - } - - get() { - - return this.css.join('\n') - - } - -} - -var theme = new Theme() - -export default theme diff --git a/src/server/node/utils.mjs b/src/server/node/utils.mjs deleted file mode 100644 index c73a4c30..00000000 --- a/src/server/node/utils.mjs +++ /dev/null @@ -1,24 +0,0 @@ -export function deepCopy(obj) { - - var copy = obj - - if (obj === null) { - return obj - } - - if (typeof obj === 'object') { - copy = Array.isArray(obj) ? [] : {} - for (let key in obj) { - copy[key] = deepCopy(obj[key]) - } - } - - return copy - -} - -export function resolveHomeDir(p) { - // Resolve '~' to user's home directory - if (!p) return '' - return String(p).replace(/^(~|\/~)/, process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']) -} diff --git a/src/server/node/zeroconf.mjs b/src/server/node/zeroconf.mjs deleted file mode 100644 index 8404aaaf..00000000 --- a/src/server/node/zeroconf.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import zeroconf from 'bonjour' - -export default zeroconf() diff --git a/src/server/options.js b/src/server/options.js new file mode 100644 index 00000000..2e67fa43 --- /dev/null +++ b/src/server/options.js @@ -0,0 +1,90 @@ +module.exports = { + 's':{alias:'send',type:'array',describe:'default targets for all widgets (ip:port / domain:port / midi:port_name pairs)', + check: (s)=>{ + return s.some(item=>!item.match(/^[^:]*:[0-9]{4,5}$/) && !item.match(/^midi:.*$/)) ? + 'Targets must be ip:port or domain:port pairs (udp / tcp port must be >= 1024) or midi:port_name pairs' : true + } + }, + 'l':{alias:'load',type:'string',file:{name:'OSC Session (.json)', extensions: ['json', 'js']},describe:'session file to load'}, + 'state':{type:'string',file:{name:'OSC State (.state)', extensions: ['state']},describe:'state file to load'}, + 'b':{alias:'blank',type:'boolean',describe:'load a blank session and start the editor'}, + 'c':{alias:'custom-module',type:'array',file:{name:'OSC Custom module (.js)', extensions: ['js']},describe:'custom module file to load (custom options can be passed after the filename)'}, + 'p':{alias:'port',type:'number',describe:'http port of the server (default to 8080)', + check: (p)=>{ + return (!isNaN(p) && p > 1023 && parseInt(p)===p) ? + true : 'Port must be an integer >= 1024' + } + }, + 'o':{alias:'osc-port',type:'number',describe:'osc input port (default to --port)', + check: (o)=>{ + return (!isNaN(o) && o > 1023 && parseInt(o)===o) ? + true : 'Port must be an integer >= 1024' + } + }, + 'tcp-port':{type:'number', describe:'TCP server input port', + check: (t, argv)=>{ + var h = argv['port'] || 8080 + if (t===h) return 'TCP input port must different from --port' + return (!isNaN(t) && t > 1023 && parseInt(t)===t) ? + true : 'Port must be an integer >= 1024' + } + }, + 'tcp-targets':{type:'array',describe:'TCP servers to connect to (ip:port pairs), does not susbtitute for --send', + check: (s, argv)=>{ + if (!argv['tcp-port']) return '--tcp-port must be set' + return s.some(item=>!item.match('^[^:\s\"\']*:[0-9]{4,5}[\s\"\']*$')) ? + 'Targets must be ip:port pairs & port must be >= 1024' : true + } + }, + 'm':{alias:'midi',type:'array',describe:'midi router settings'}, + 'd':{alias:'debug',type:'boolean',describe:'log received osc messages in the console'}, + 'n':{alias:'no-gui',type:'boolean',describe:'disable default gui', + check: (n,argv)=>{ + return (!n || !argv.g) ? + true : 'no-gui and gui-only can\'s be enabled simultaneously' + } + }, + 'g':{alias:'gui-only',type:'string',describe:'app server\'s url. If true, local port (--port) is used', + check: (g,argv)=>{ + return (!g || !argv.n) ? + true : 'no-gui and gui-only can\'s be enabled simultaneously' + } + }, + 't':{alias:'theme',type:'array',describe:'theme name or path (mutliple values allowed)'}, + 'e':{alias:'examples',type:'boolean',describe:'list examples instead of recent sessions', + check: (e,argv)=>{ + return (!e || !argv.l) ? + true : 'examples can\'t be listed if --load is set' + } + }, + 'url-options':{type:'array',describe:'url options (opt=value pairs)', + check: (u, argv)=>{ + return (!u || !argv.n) ? + true : 'url options can\'t be passed in no-gui mode' + } + }, + 'disable-vsync':{type:'boolean',describe:'disable gui\'s vertical synchronization', restart: true}, + 'disable-gpu':{type:'boolean',describe:'disable hardware acceleration', restart: true}, + 'force-gpu':{type:'boolean',describe:'ignore chrome\'s gpu blacklist', restart: true}, + 'read-only':{type:'boolean',describe:'disable session editing and session history changes', + check: (r, argv)=>{ + return (!r || !argv.b) ? + true : 'blank session can\'t be started in read-only mode' + } + }, + 'remote-saving':{type:'string',describe:'disable remote session saving for hosts that don\'t match the regular expresion', + check: (r, argv)=>{ + var msg = true + try { + RegExp(r) + } catch (e) { + msg = e + } + return msg + } + }, + 'remote-root':{type:'string', describe:'set remote file browsing root folder', file:{folder: true}}, + 'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'}, + 'fullscreen':{type:'boolean', describe:'launch in fullscreen mode (only affects the default gui, F11 to exit)'}, + 'inspect':{type:'boolean', describe:'enable node/electron inspector', launcher: false} +} diff --git a/src/server/osc/index.js b/src/server/osc/index.js new file mode 100644 index 00000000..f8e68043 --- /dev/null +++ b/src/server/osc/index.js @@ -0,0 +1,293 @@ +var path = require('path'), + ipc = require('../server').ipc, + settings = require('../settings'), + tcpInPort = settings.read('tcpInPort'), + debug = settings.read('debug'), + vm = require('vm'), + fs = require('fs'), + midi = settings.read('midi') ? require('../midi') : false, + oscUDPServer = require('./udp'), + oscTCPServer = require('./tcp'), + EventEmitter = require('events').EventEmitter + + +if (midi) midi = new midi() + +class OscServer { + + constructor(){ + + this.customModuleEventEmitter = new EventEmitter() + this.customModule = (()=>{ + + var customModule = settings.read('customModule') + if (!customModule) return false + + // consolidate path containing whitespaces + if (!customModule[0].includes('.js')) { + var index = customModule.findIndex(x => typeof x === 'string' && x.includes('.js')) + if (index !== undefined) { + var _path = customModule.slice(0, index + 1).join(' ') + customModule.splice(0, index + 1, _path) + } + } + + var file = (()=>{ + try { + return fs.readFileSync(customModule[0], 'utf8') + } catch(err) { + console.log('CustomModule Error: File not found: ' + customModule[0]) + return false + } + })(), + mod, + context = vm.createContext({ + console, + sendOsc: this.sendOsc.bind(this), + receiveOsc: this.receiveOsc.bind(this), + send: (host, port, address, ...args)=>{ + this.sendOsc({host, port, address, args:args.map(x=>this.parseArg(x))}) + }, + receive: (host, port, address, ...args)=>{ + if (host[0] === '/') { + // host and port can be skipped + if (address !== undefined) args.unshift(address) + if (port !== undefined) args.unshift(port) + address = host + host = port = undefined + } + this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x))}) + }, + loadJSON: (url)=>{ + if (url.split('.').pop() === 'json') { + try { + url = path.resolve(path.dirname(customModule[0]), url) + return JSON.parse(fs.readFileSync(url, 'utf8')) + } catch(e) { + console.error('ERROR: could not load json file from ' + url) + console.error(e.message) + } + } else { + console.error('ERROR: unauthorized file type for loadJSON') + } + }, + saveJSON: (url, data)=>{ + if (url.split('.').pop() === 'json') { + url = path.resolve(path.dirname(customModule[0]), url) + try { + return fs.writeFileSync(url, JSON.stringify(data, null, ' ')) + } catch(e) { + console.error('ERROR: could not save json file to ' + url) + console.error(e.message) + } + } else { + console.error('ERROR: unauthorized file type for saveJSON') + } + }, + app: this.customModuleEventEmitter, + setTimeout, clearTimeout, + setInterval, clearInterval, + settings, + options: customModule.slice(1, customModule.length), + module: {}, + }) + + try { + // remove require function (not needed at runtime) + // wrong: this.constructor.constructor("return process")().mainModule.require + process.mainModule.require = process.dlopen = null + // run + mod = vm.runInContext(file, context, { + filename: customModule[0] + }) + if (context.module.exports) mod = context.module.exports + } catch(err) { + console.error(err) + return false + } + + return mod + + })() + + + } + + parseType(type){ + var t = type[0].match(/[bhtdscrmifTFNI]/) + + if (t!==null) { + return t[0] + } else { + return 's' + } + + } + + parseArg(arg, precision){ + if (arg==null) return null + switch (typeof arg) { + case 'number': + var typeTagMatch = typeof precision == 'string' ? precision.match(/[0-9]+([a-zA-Z]{1})/) : null, + typeTag = typeTagMatch === null ? precision === 0 ? 'i' : 'f' : typeTagMatch[1], + precisionValue = parseFloat(precision) || 0 + + return {type: typeTag, value: precision === undefined ? arg : parseFloat(arg.toFixed(precisionValue))} + case 'boolean': + return {type: arg ? 'T' : 'F', value: arg} + case 'object': + if (arg.type) { + return {type: this.parseType(arg.type), value: arg.value} + } else { + return {type: 's', value:JSON.stringify(arg)} + } + case 'string': + return {type: 's', value:arg} + default: + return {type: 's', value:JSON.stringify(arg)} + } + } + + sendOsc(data){ + + if (!data) return + + if (data.host == 'midi') { + + if (midi) midi.send(data) + + } else { + + if (typeof data.address !== 'string' || data.address[0] !== '/') { + console.error('OSC error: malformed address: "' + data.address + '') + return + } + + if (tcpInPort && oscTCPServer.clients[data.host] && oscTCPServer.clients[data.host][data.port]) { + + oscTCPServer.clients[data.host][data.port].send({ + address: data.address, + args: data.args + }) + + } else { + + oscUDPServer.send({ + address: data.address, + args: data.args + }, data.host, data.port) + + } + + if (debug) console.log('OSC sent: ',{address:data.address, args: data.args}, 'To: ' + data.host + ':' + data.port) + + } + + + } + + receiveOsc(data, info){ + + if (!data) return + + for (i in data.args) { + data.args[i] = data.args[i].value + } + + if (data.args.length==1) data.args = data.args[0] + + ipc.send('receiveOsc',data) + + if (debug) console.log('OSC received: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port) + + } + + + oscInFilter(data){ + if (this.customModule.oscInFilter) { + return this.customModule.oscInFilter(data) + } else { + return data + } + } + oscOutFilter(data){ + if (this.customModule.oscOutFilter) { + return this.customModule.oscOutFilter(data) + } else { + return data + } + } + + oscInHandler(msg, timetag, info){ + var data = this.oscInFilter({address: msg.address, args: msg.args, host: info.address, port: info.port}) + if (!data) return + this.receiveOsc(data) + } + + oscInHandlerWrapper(msg, timetag, info) { + var delay = timetag? Math.max(0,timetag.native - Date.now()) : 0 + if (delay) { + setTimeout(()=>{ + this.oscInHandler(msg, timetag, info) + }, delay) + } else { + this.oscInHandler(msg, timetag, info) + } + } + + + + init(){ + + if (midi) midi.init((data)=>{ + + data = this.oscInFilter({address: data.address, args: data.args, host: data.host, port: data.port}) + + if (!data) return + + this.receiveOsc(data) + + }) + + oscUDPServer.on('message', this.oscInHandlerWrapper.bind(this)) + oscUDPServer.open() + + if (settings.read('tcpInPort')) { + oscTCPServer.on('message', this.oscInHandlerWrapper.bind(this)) + oscTCPServer.open() + } + + if (this.customModule.init) { + this.customModule.init() + } + + } + + +} + + +var oscServer = new OscServer() +oscServer.init() + +module.exports = { + server: oscServer, + send: function(host,port,address,args,precision) { + + var message = [] + + if (!Array.isArray(args)) args = [args] + if (typeof args=='object' && args!==null) { + for (var i in args) { + var arg = oscServer.parseArg(args[i],precision) + if (arg!=null) message.push(arg) + } + } + + var data = oscServer.oscOutFilter({address:address, args: message, host: host, port: port}) + + oscServer.sendOsc(data) + + }, + midi:midi +} diff --git a/src/server/osc/osc.js b/src/server/osc/osc.js new file mode 100644 index 00000000..4da82ea9 --- /dev/null +++ b/src/server/osc/osc.js @@ -0,0 +1,7 @@ +var osc = require('osc/src/osc.js'), + transports = require('osc/src/platforms/osc-node.js') + +osc.UDPPort = transports.UDPPort +osc.TCPSocketPort = transports.TCPSocketPort + +module.exports = osc diff --git a/src/server/node/osc/tcp.mjs b/src/server/osc/tcp.js similarity index 63% rename from src/server/node/osc/tcp.mjs rename to src/server/osc/tcp.js index b1096257..cd6c9217 100644 --- a/src/server/node/osc/tcp.mjs +++ b/src/server/osc/tcp.js @@ -1,8 +1,10 @@ -import {EventEmitter} from 'events' -import net from 'net' -import * as settings from '../settings.mjs' -import osc from './osc.mjs' -import zeroconf from '../zeroconf' +var osc = require('./osc'), + EventEmitter = require('events').EventEmitter, + settings = require('../settings'), + zeroconf = require('../zeroconf'), + tcpInPort = settings.read('tcpInPort'), + tcpTargets = settings.read('tcpTargets'), + net = require('net') class OscTCPClient extends EventEmitter { @@ -23,13 +25,13 @@ class OscTCPClient extends EventEmitter { this.port = new osc.TCPSocketPort(this.options) this.port.on('error', (err)=>{ - console.error('(ERROR, TCP)', err) + console.error(`TCP: Error: ${err.message}`) }) this.port.on('close', (hadErr)=>{ - console.log(`(TCP) Connection closed (${this.remoteAddress}:${this.remotePort})`) + console.log(`TCP: connection closed (${this.remoteAddress}:${this.remotePort})`) if (!this.options.socket) { - console.log(`(TCP) Attempting reconnection in 5s (${this.remoteAddress}:${this.remotePort})`) + console.log(`TCP: attempting reconnection in 5s (${this.remoteAddress}:${this.remotePort})`) this.reconnect() } else { this.emit('die') @@ -41,7 +43,7 @@ class OscTCPClient extends EventEmitter { }) this.port.on('ready', ()=>{ - console.log(`(TCP) Connection established (${this.remoteAddress}:${this.remotePort})`) + console.log(`TCP: connection established (${this.remoteAddress}:${this.remotePort})`) }) if (!this.options.socket) { @@ -74,18 +76,14 @@ class OscTCPClient extends EventEmitter { } -export default class OscTCPServer extends EventEmitter { +class OscTCPServer extends EventEmitter { constructor() { super() - this.port = settings.read('tcp-port') - this.targets = settings.read('tcp-targets') - this.clients = {} - this.server = net.createServer(this.bindSocket.bind(this)) } bindSocket(socket) { @@ -93,7 +91,7 @@ export default class OscTCPServer extends EventEmitter { this.addClient(new OscTCPClient({ metadata: true, socket: socket, - address: socket.remoteAddress.replace('::ffff:', ''), + address: socket.remoteAddress.indexOf('::ffff:') === 0 ? socket.remoteAddress.replace('::ffff:', '') : socket.remoteAddress, port: socket.remotePort })) @@ -115,36 +113,34 @@ export default class OscTCPServer extends EventEmitter { } - start() { + open() { + this.server = net.createServer(this.bindSocket.bind(this)) + this.server.listen({port: tcpInPort}) - this.server.listen({port: this.port}) - - for (var i in this.targets) { + for (var i in tcpTargets) { this.addClient(new OscTCPClient({ metadata: true, - address: this.targets[i].split(':')[0], - port: this.targets[i].split(':')[1] + address: tcpTargets[i].split(':')[0], + port: tcpTargets[i].split(':')[1] })) } zeroconf.publish({ - name: settings.infos.productName + (settings.read('instance-name') ? ' (' + settings.read('instance-name') + ')' : ''), + name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''), protocol: 'tcp', type: 'osc', - port: this.port + port: tcpInPort }).on('error', (e)=>{ console.error(`Error: Zeroconf: ${e.message}`) }) - } - - stop() { - - this.server.close() } - } + +var oscTCPServer = new OscTCPServer() + +module.exports = oscTCPServer diff --git a/src/server/osc/udp.js b/src/server/osc/udp.js new file mode 100644 index 00000000..023683e7 --- /dev/null +++ b/src/server/osc/udp.js @@ -0,0 +1,26 @@ +var osc = require('./osc'), + settings = require('../settings'), + zeroconf = require('../zeroconf'), + oscInPort = settings.read('oscInPort') || settings.read('httpPort') + +var oscUDPServer = new osc.UDPPort({ + localAddress: '0.0.0.0', + localPort: oscInPort, + metadata: true, + broadcast: true +}) + +oscUDPServer.on('error', function(error) { + console.error(error) +}) + +zeroconf.publish({ + name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''), + protocol: 'udp', + type: 'osc', + port: oscInPort +}).on('error', (e)=>{ + console.error(`Error: Zeroconf: ${e.message}`) +}) + +module.exports = oscUDPServer diff --git a/src/server/python/head.py b/src/server/python/head.py deleted file mode 100644 index 5f62ccf2..00000000 --- a/src/server/python/head.py +++ /dev/null @@ -1,55 +0,0 @@ -from sys import argv, stdin, stdout, version_info, version, exit, platform -from binascii import hexlify, unhexlify -import traceback -import json as JSON -import re - -def ipc_send(name, data): - print(JSON.dumps([name, data])) - stdout.flush() - -prebuilt_bin = 'osc-midi' in argv[0] - -try: - import rtmidi - from rtmidi.midiconstants import * - - API = rtmidi.API_UNIX_JACK if 'jack' in argv else rtmidi.API_UNSPECIFIED - if API == rtmidi.API_UNIX_JACK and rtmidi.API_UNIX_JACK not in rtmidi.get_compiled_api(): - API = rtmidi.API_UNSPECIFIED - ipc_send('log', '(ERROR, MIDI) python-rtmidi was not compiled with jack midi support, falling back to default API') - - JACK = API == rtmidi.API_UNIX_JACK - - in_dev = rtmidi.MidiIn(API, 'MIDI->OSC probe') - out_dev = rtmidi.MidiOut(API, 'OSC->MIDI probe') - -except Exception as e: - if prebuilt_bin: - ipc_send('log', '(ERROR, MIDI) error while loading MIDI bridge program:\n %s' % (e.message if hasattr(e, 'message') else e)) - else: - ipc_send('log', '(ERROR, MIDI) error while loading python-rtmidi library (running with python %s):\n %s' % (".".join(map(str, version_info[:3])), e.message if hasattr(e, 'message') else e)) - exit() - -if version_info.major == 3: - raw_input = input - -# option: print debug messages -debug = 'debug' in argv -# option: act as if displayed program is between 1-128 instead of 0-127 -program_change_offset = 'pc_offset' in argv -# option: parse sysex -ignore_sysex = 'sysex' not in argv -# option: parse mtc -ignore_mtc = 'mtc' not in argv -# option: parse (n)rpn -ignore_rpn = 'rpn' not in argv and 'nrpn' not in argv -# option: parse active sensing -ignore_active_sensing = 'active_sensing' not in argv -# option: note off velocity (/note_on and /note_off instead of only /note and velocity 0 for note off) -note_off_velocity = 'note_off_velocity' in argv -# option: no auto note off (do not translate received note_on with velocity 0 to note off) -no_auto_note_off = 'no_auto_note_off' in argv -# option: list midi ports -list_midi = 'list' in argv -list_midi_exit = 'list-only' in argv diff --git a/src/server/python/list.py b/src/server/python/list.py deleted file mode 100644 index 627d44bf..00000000 --- a/src/server/python/list.py +++ /dev/null @@ -1,24 +0,0 @@ -from head import * - -def list(): - - message = [] - - message.append('(INFO, MIDI) Inputs') - message.append(' -1: Void (bypass)') - - for i in range(in_dev.get_port_count()): - message.append(' %i: %s' % (i, in_dev.get_port_name(i))) - - message.append('(INFO, MIDI) Outputs') - message.append(' -1: Void (bypass)') - - for i in range(out_dev.get_port_count()): - message.append(' %i: %s' % (i, out_dev.get_port_name(i))) - - ipc_send('log', '\n'.join(message)) - - -if __name__ == '__main__': - - list() diff --git a/src/server/python/main.py b/src/server/python/main.py deleted file mode 100644 index 76137c0a..00000000 --- a/src/server/python/main.py +++ /dev/null @@ -1,297 +0,0 @@ -from head import * -from list import * -from utils import * -from mtc import * -from rpn import * - -argv = argv[argv.index('--params') + 1:] - -if list_midi or list_midi_exit: - list() - if list_midi_exit: - exit() - -inputs = {} -outputs = {} - -for arg in argv: - - if type(arg) == str and ':' in arg: - - name, *ports = arg.split(':') - ports = ':'.join(ports) # port names may contain colons - - inputs[name] = rtmidi.MidiIn(API, name if not JACK else name + '_in') - outputs[name] = rtmidi.MidiOut(API, name if not JACK else name + '_out') - - if debug: - ipc_send('debug','device "%s" created' % name) - - - if ports == 'virtual': - - try: - - if platform == 'darwin': - inputs[name].open_virtual_port('%s-in' % name) - outputs[name].open_virtual_port('%s-out' % name) - else: - inputs[name].open_virtual_port('midi_in') - outputs[name].open_virtual_port('midi_out') - - if debug: - ipc_send('debug','virtual ports opened for device "%s"' % name) - except: - ipc_send('error', 'failed to open virtual ports for device "%s"' % name) - ipc_send('error', traceback.format_exc()) - inputs[name] = None - outputs[name] = None - - elif ',' in ports: - - in_port, out_port = ports.split(',') - - if in_port.isdigit() or in_port == '-1': - in_port = int(in_port) - else: - for i in range(in_dev.get_port_count()): - if in_port.lower() in in_dev.get_port_name(i).lower(): - in_port = i - break - - if out_port.isdigit() or out_port == '-1': - out_port = int(out_port) - else: - for i in range(out_dev.get_port_count()): - if out_port.lower() in out_dev.get_port_name(i).lower(): - out_port = i - break - - if in_port != -1: - - try: - inputs[name].open_port(in_port, 'midi_in') - if debug: - ipc_send('debug','device "%s" connected to input port %s (%s)' % (name, in_port, in_dev.get_port_name(in_port))) - except: - if type(in_port) != int or in_port >= in_dev.get_port_count(): - ipc_send('error', 'can\'t connect "%s" to input port "%s" (port not in list)' % (name, in_port)) - else: - ipc_send('error', 'failed to connect "%s" to input port %s' % (name, in_port)) - ipc_send('error', traceback.format_exc()) - inputs[name] = None - - if out_port != -1: - - try: - outputs[name].open_port(out_port, 'midi_out') - if debug: - ipc_send('debug','device "%s" connected to output port %s (%s)' % (name, out_port, out_dev.get_port_name(out_port))) - except: - if type(out_port) != int or out_port >= out_dev.get_port_count(): - ipc_send('error', 'can\'t connect "%s" to output port "%s" (port not in list)' % (name, out_port)) - else: - ipc_send('error', 'failed to connect "%s" to output port %s' % (name, out_port)) - ipc_send('error', traceback.format_exc()) - outputs[name] = None - - -def create_callback(name): - - def receive_midi(event, data): - - osc = {} - osc['args'] = [] - osc['host'] = 'midi' - osc['port'] = name - - message, deltatime = event - mtype = message[0] & 0xF0 - - if mtype in MIDI_TO_OSC: - - osc['address'] = MIDI_TO_OSC[mtype] - - if not ignore_mtc and is_mtc(message): - - mtc = mtc_decode(message, name) - if mtc == None: - return - else: - osc['address'] = MIDI_TO_OSC[MIDI_TIME_CODE] - osc['args'].append({'type': 'string', 'value': mtc}) - - elif mtype == SYSTEM_EXCLUSIVE: - # Parse the provided data into a hex MIDI data string of the form 'f0 7e 7f 06 01 f7'. - v = ' '.join([hex(x).replace('0x', '').zfill(2) for x in message]) - osc['args'].append({'type': 'string', 'value': v}) - - - elif mtype == CONTROL_CHANGE and not ignore_rpn and is_rpn(message): - rpn = rpn_decode(message, name) - if rpn is not None: - osc['address'] = MIDI_TO_OSC[rpn[0]] - osc['args'].append({'type': 'i', 'value': rpn[1]}) - osc['args'].append({'type': 'i', 'value': rpn[2]}) - osc['args'].append({'type': 'i', 'value': rpn[3]}) - ipc_send('osc', osc) - if debug: - t = 'NRPN' if rpn[0] == NRPN else 'RPN' - s = '%s: channel=%i, parameter=%i, value=%i'% (t, rpn[1], rpn[2], rpn[3]) - ipc_send('debug','in: %s From: midi:%s' % (s, name)) - # bypass (n)rpn CCs - return - - else: - - status = message[0] - channel = (status & 0x0F) + 1 - - osc['args'].append({'type': 'i', 'value': channel}) - - if mtype == NOTE_OFF: - if not note_off_velocity: - message[2] = 0 - - elif mtype == PITCH_BEND: - message = message[:1] + [message[1] + message[2] * 128] # convert 0-127 pair -> 0-16384 -> - - elif mtype == PROGRAM_CHANGE and program_change_offset: - message[-1] = message[-1] + 1 - - for data in message[1:]: - osc['args'].append({'type': 'i', 'value': data}) - - - if debug: - ipc_send('debug','in: %s From: midi:%s' % (midi_str(message, name), name)) - - ipc_send('osc', osc) - - - - def callback_error_wrapper(event, data): - - try: - receive_midi(event, data) - except: - ipc_send('error', traceback.format_exc()) - - return callback_error_wrapper - -for name in inputs: - - if inputs[name] != None: - - inputs[name].set_callback(create_callback(name)) - - # sysex / mtc / active sensing support - inputs[name].ignore_types(ignore_sysex, ignore_mtc, ignore_active_sensing) - - -def midi_message(status, channel, data1=None, data2=None): - - msg = [(status & 0xF0) | (channel - 1 & 0x0F)] - - if data1 != None: - msg.append(data1 & 0x7F) - - if data2 != None: - msg.append(data2 & 0x7F) - - return msg - - -sysexRegex = re.compile(r'([^0-9A-Fa-f])\1(\1\1)*') - -def send_midi(name, event, *args): - - if name not in outputs: - ipc_send('error','unknown device "%s"' % name) - return - - if outputs[name] == None: - ipc_send('error','device "%s" has no opened output port' % name) - return - - if event not in OSC_TO_MIDI: - ipc_send('error','invalid address (%s)' % event) - return - - m = None - - mtype = OSC_TO_MIDI[event] - - if mtype == SYSTEM_EXCLUSIVE or mtype == MIDI_TIME_CODE: - - if mtype == MIDI_TIME_CODE: - - m = mtc_encode(args) - - else: - try: - m = [] - for arg in args: - if type(arg) is str: - arg = arg.replace(' ', '') # remove spaces - arg = [arg[i:i+2] for i in range(0, len(arg), 2)] # split in 2 chars bytes - arg = [int(x, 16) for x in arg] # parse hex bytes - for x in arg: - m.append(x) - else: - m.append(int(arg) & 0x7F) - - except: - pass - - elif mtype == NRPN or mtype == RPN: - m = rpn_encode(mtype, args) - if m is not None: - for x in m: - outputs[name].send_message(x) - if debug: - t = 'NRPN' if mtype == NRPN else 'RPN' - s = '%s: channel=%i, parameter=%i, value=%i'% (t, args[0], args[1], args[2]) - ipc_send('debug','out: %s To: midi:%s' % (s, name)) - return - else: - - args = [int(round(x)) for x in args] - m = [mtype, args[0]] - - if mtype == NOTE_ON: - if args[2] == 0 and not no_auto_note_off: - mtype = NOTE_OFF - - elif mtype == PITCH_BEND: - args = args[:1] + [args[1] & 0x7F, (args[1] >> 7) & 0x7F] # convert 0-16383 -> 0-127 pair - - elif mtype == PROGRAM_CHANGE and program_change_offset: - args[-1] = args[-1] - 1 - - m = midi_message(mtype, *args) - - if m == None: - - ipc_send('error','could not convert osc to midi (%s %s)' % (event, " ".join([str(x) for x in args]))) - - else: - - outputs[name].send_message(m) - if debug: - ipc_send('debug','out: %s To: midi:%s' % (midi_str(m, name), name)) - - -while True: - - try: - msg = raw_input() - except: - break - - try: - msg = JSON.loads(msg) - msg[1] = msg[1].lower() - send_midi(*msg) - except: - ipc_send('error', traceback.format_exc()) diff --git a/src/server/python/midi.py b/src/server/python/midi.py deleted file mode 100644 index 6152a218..00000000 --- a/src/server/python/midi.py +++ /dev/null @@ -1,17 +0,0 @@ -# python script for freezing dependencies but not the runtime code -import os -import importlib -import sys - -# import all libs used at runtime -# pyinstaller will freeze it -import head - -if getattr(sys, 'frozen', False): - VAR_CWD = os.path.dirname(sys.executable) - sys.path.insert(1, VAR_CWD) - -sys.path.insert(1, os.getcwd()) - -# dynamically import runtime code -importlib.import_module('main') diff --git a/src/server/python/mtc.py b/src/server/python/mtc.py deleted file mode 100644 index b7ebe00f..00000000 --- a/src/server/python/mtc.py +++ /dev/null @@ -1,59 +0,0 @@ -from head import * - - -def is_mtc(message): - - return message[0] == MIDI_TIME_CODE or (message[0] == SYSTEM_EXCLUSIVE and len(message) == 10 and message[1:5] == [0x7F, 0x7F, 0x01, 0x01]) - - -# quarter frame accumulator -mtc = {} - -def mtc_decode(message, port): - # with bits ©jeffmikels @ https://github.com/jeffmikels/timecode_tools/blob/master/tools.py (MIT) - # TODO: backward playback ? - if message[0] == MIDI_TIME_CODE: - - if port not in mtc: - mtc[port] = [0, 0, 0, 0, 0, 0 ,0 ,0] - - piece = (message[1] >> 4) & 0xF - data = message[1] & 0xF - mtc[port][piece] = data - - if piece == 7: - mtc_bytes = [0, 0, 0, 0] - for i in range(8): - - mtc_index = 3 - i // 2 - if i % 2 == 0: - # 'even' pieces came from the low nibble - mtc_bytes[mtc_index] += mtc[port][i] - else: - # 'odd' pieces came from the high nibble - mtc_bytes[mtc_index] += mtc[port][i] * 16 - - else: - return None - - else: - - mtc_bytes = message[5:-1] - - - mtc_bytes[0] = mtc_bytes[0] & 31 - - return ":".join([str(x).zfill(2) for x in mtc_bytes]) - -def mtc_encode(args): - - if len(args) != 1: - return None - - timecode = args[0] - data = str(timecode).split(':') - - if len(data) != 4: - return None - else: - return [0xF0, 0x7F, 0x7F, 0x01, 0x01] + [int(x) & 0x7F for x in data] + [0xF7] diff --git a/src/server/python/requirements.txt b/src/server/python/requirements.txt deleted file mode 100644 index a63392d8..00000000 --- a/src/server/python/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -python-rtmidi == 1.5.8 -pyinstaller diff --git a/src/server/python/rpn.py b/src/server/python/rpn.py deleted file mode 100644 index 8e918ddb..00000000 --- a/src/server/python/rpn.py +++ /dev/null @@ -1,109 +0,0 @@ -from head import * - -NRPN = 256 -RPN = 257 -RPN_REGISTER = {} - - -def is_rpn(message): - - return ( - message[1] == DATA_ENTRY_MSB or - message[1] == DATA_ENTRY_LSB or - message[1] == RPN_MSB or - message[1] == RPN_LSB or - message[1] == NRPN_MSB or - message[1] == NRPN_LSB - ) - -def rpn_decode(message, port): - if port not in RPN_REGISTER: - RPN_REGISTER[port] = [] - for i in range(16): - RPN_REGISTER[port].append({ - 'type': '', - 'control_msb': -1, - 'control_lsb': -1, - 'value_msb': 0, - 'value_lsb': 0 - }) - - status = message[0] - channel = (status & 0x0F)# + 1 - send = False - check_reset = False - - if message[1] == NRPN_MSB: - RPN_REGISTER[port][channel]['type'] = NRPN - RPN_REGISTER[port][channel]['control_msb'] = message[2] - - elif message[1] == NRPN_LSB: - RPN_REGISTER[port][channel]['type'] = NRPN - RPN_REGISTER[port][channel]['control_lsb'] = message[2] - check_reset = True - - elif message[1] == RPN_MSB: - RPN_REGISTER[port][channel]['type'] = RPN - RPN_REGISTER[port][channel]['control_msb'] = message[2] - - elif message[1] == RPN_LSB: - RPN_REGISTER[port][channel]['type'] = RPN - RPN_REGISTER[port][channel]['control_lsb'] = message[2] - check_reset = True - - elif message[1] == DATA_ENTRY_MSB: - RPN_REGISTER[port][channel]['value_msb'] = message[2] - RPN_REGISTER[port][channel]['value_lsb'] = 0 - send = True - - elif message[1] == DATA_ENTRY_LSB: - RPN_REGISTER[port][channel]['value_lsb'] = message[2] - send = True - - if check_reset: - # (n)rpn null value - if ( - RPN_REGISTER[port][channel]['control_msb'] == 127 and - RPN_REGISTER[port][channel]['control_lsb'] == 127 - ): - RPN_REGISTER[port][channel]['control_msb'] = -1 - - - if send and RPN_REGISTER[port][channel]['control_msb'] != -1: - return [ - RPN_REGISTER[port][channel]['type'], - channel + 1, - RPN_REGISTER[port][channel]['control_msb'] * 128 + RPN_REGISTER[port][channel]['control_lsb'], - RPN_REGISTER[port][channel]['value_msb'] * 128 + RPN_REGISTER[port][channel]['value_lsb'] - ] - - return None - - -def rpn_encode(mtype, args): - - if len(args) != 3: - return None - - channel, control, value = args - status = CONTROL_CHANGE | (channel - 1 & 0x0F) - return ( - [status, 99 if mtype == NRPN else 101, control >> 7], - [status, 98 if mtype == NRPN else 100, control & 0x7F], - [status, 6, value >> 7], - [status, 38, value & 0x7F] - ) - - # rtmidi doesn't support running status - # return [ - # 0xF0,0xF7, - # CONTROL_CHANGE | (channel - 1 & 0x0F), - # 99 if mtype == NRPN else 101, - # control >> 7, - # 98 if mtype == NRPN else 100, - # control & 0x7F, - # 6, - # value >> 7, - # 38, - # value & 0x7F - # ] diff --git a/src/server/python/utils.py b/src/server/python/utils.py deleted file mode 100644 index 951f7d4c..00000000 --- a/src/server/python/utils.py +++ /dev/null @@ -1,79 +0,0 @@ -from head import * -from mtc import * -from rpn import * - -MIDI_TO_OSC = { - NOTE_ON: '/note', - NOTE_OFF: '/note', - CONTROL_CHANGE: '/control', - PROGRAM_CHANGE: '/program', - PITCH_BEND: '/pitch', - SYSTEM_EXCLUSIVE: '/sysex', - MIDI_TIME_CODE: '/mtc', - CHANNEL_PRESSURE: '/channel_pressure', - POLY_PRESSURE: '/key_pressure' -} - -OSC_TO_MIDI = { - '/note': NOTE_ON, - '/note_off': NOTE_OFF, - '/control': CONTROL_CHANGE, - '/program': PROGRAM_CHANGE, - '/pitch': PITCH_BEND, - '/sysex': SYSTEM_EXCLUSIVE, - '/mtc': MIDI_TIME_CODE, - '/channel_pressure': CHANNEL_PRESSURE, - '/key_pressure': POLY_PRESSURE -} - -if note_off_velocity: - MIDI_TO_OSC[NOTE_OFF] = '/note_off' - -if not ignore_rpn: - MIDI_TO_OSC[NRPN] = '/nrpn' - MIDI_TO_OSC[RPN] = '/rpn' - OSC_TO_MIDI['/nrpn'] = NRPN - OSC_TO_MIDI['/rpn'] = RPN - - -def midi_str(message, port): - - mtype = message[0] & 0xF0 - s = 'UNKNOWN' - - - if is_mtc(message): - - s = 'MTC: timecode=%s' % mtc_decode(message, None) - - elif mtype == SYSTEM_EXCLUSIVE: - - s = 'SYSTEM_EXCLUSIVE: sysex=%s' % ' '.join([hex(x).replace('0x', '').zfill(2) for x in message]) - - else: - - status = message[0] - channel = (status & 0x0F) + 1 - - try: - - if mtype == NOTE_ON: - s = 'NOTE_ON: channel=%i, note=%i, velocity=%i' % (channel, message[1], message[2]) - elif mtype == NOTE_OFF: - s = 'NOTE_OFF: channel=%i, note=%i, velocity=%i' % (channel, message[1], message[2]) - elif mtype == CONTROL_CHANGE: - s = 'CONTROL_CHANGE: channel=%i, cc=%i, value=%i'% (channel, message[1], message[2]) - elif mtype == PROGRAM_CHANGE: - s = 'PROGRAM_CHANGE: channel=%i, program=%i' % (channel, message[1]) - elif mtype == PITCH_BEND: - s = 'PITCH_BEND: channel=%i, pitch=%i' % (channel, message[1] + message[2] * 128 if len(message) == 3 else message[1]) - elif mtype == CHANNEL_PRESSURE: - s = 'CHANNEL_PRESSURE: channel=%i, pressure=%i' % (channel, message[1]) - elif mtype == POLY_PRESSURE: - s = 'KEY_PRESSURE: channel=%i, note=%i, pressure=%i' % (channel, message[1], message[2]) - - except IndexError: - - s = 'NONE (ERROR: wrong number of argument for %s)' % MIDI_TO_OSC[mtype] - - return s diff --git a/src/server/server.js b/src/server/server.js new file mode 100644 index 00000000..d1208974 --- /dev/null +++ b/src/server/server.js @@ -0,0 +1,132 @@ +var urlparser = require('url'), + path = require('path'), + fs = require('fs'), + send = require('send'), + http = require('http'), + server = http.createServer(httpRoute), + Ipc = require('./ipc/server'), + ipc = new Ipc(server), + settings = require('./settings'), + theme = require('./theme').init(), + zeroconf = require('./zeroconf'), + appAddresses = settings.read('appAddresses'), + osc = {}, + clients = {}, + httpCheckTimeout + +function httpRoute(req, res) { + + res.sendFile = (path)=>{ + var fpath = path.split('?')[0] + if (!fs.existsSync(fpath)) throw `File "${fpath}" not found.` + send(req, fpath).pipe(res) + } + + var url = req.url + + if (url === '/' || url.indexOf('/?') === 0) { + + res.sendFile(path.resolve(__dirname + '/../client/index.html')) + + } else { + + if (url.indexOf('theme.css') != -1) { + + res.setHeader('Content-Type', 'text/css') + if (settings.read('theme')) { + var str = theme.get(), + buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) + res.write(buf) + } else { + res.write('') + } + res.end() + + } else if (/^\/(assets|client)\//.test(url)){ + + res.sendFile(path.resolve(__dirname + '/..' + url)) + + } else { + + // windows absolute path fix + url = url.replace('_:_', ':') // escaped drive colon + url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash + + if (url.match(/.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) { + try { + // relative resolution (to session path) + var id = urlparser.parse('?' + req.headers.cookie, true).query.client_id, + sessionPath = path.dirname(ipc.clients[id].sessionPath) + + res.sendFile(path.resolve(sessionPath + url)) + } catch(e) { + // absolute resolution + res.sendFile(path.resolve(url)) + } + } else if (url.includes('/osc-ping')) { + httpCheck(true) + } else { + res.writeHead(403) + res.end() + } + + } + + } +} + +server.listen(settings.read('httpPort')) + +http.get(settings.read('appAddresses')[0] + '/osc-ping', ()=>{}).on('error', ()=>{httpCheck(false)}) +httpCheckTimeout = setTimeout(()=>{httpCheck(false)}, 5000) +function httpCheck(ok){ + if (!httpCheckTimeout) return + clearTimeout(httpCheckTimeout) + httpCheckTimeout = null + if (ok) { + console.log('App available at ' + appAddresses.join(' & ')) + } else { + console.error('Error: could not setup http server, maybe try a different port ?') + } +} + +zeroconf.publish({ + name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''), + type: 'http', + port: settings.read('httpPort') +}).on('error', (e)=>{ + console.error(`Error: Zeroconf: ${e.message}`) +}) + +var bindCallbacks = function(callbacks) { + + ipc.on('connection', function(client) { + + var clientInfos = {address: client.address, id: client.id} + + for (let name in callbacks) { + client.on(name, (data)=>{ + if (osc.customModule) { + osc.customModuleEventEmitter.emit(name, data, clientInfos) + } + callbacks[name](data, client.id) + }) + } + + client.on('close', function() { + + callbacks.removeClientWidgets(client.id) + + }) + + }) + +} + +module.exports = { + ipc:ipc, + bindCallbacks:bindCallbacks, + clients:clients +} + +osc = require('./osc').server diff --git a/src/server/settings.js b/src/server/settings.js new file mode 100644 index 00000000..f2774e06 --- /dev/null +++ b/src/server/settings.js @@ -0,0 +1,127 @@ +// This prevents argv parsing to be breaked when the app is packaged (executed without 'electron' prefix) +if (process.argv[1] && process.argv[1].indexOf('-') == 0) process.argv.unshift('') + +// on windows, electron stops parsing after the first argument containing a colon +// https://github.com/electron/electron/pull/13039 +// windows cli users need to add a double dash (--) before their options to avoid that +// it must be stripped to let yargs work normally +if (process.argv[2] == '--') process.argv.splice(2, 1) + + +var infos = require('../package.json') + +var options = require('./options'), + argv = require('yargs') + .parserConfiguration({'boolean-negation': false}) + .help('help').usage('\nUsage:\n $0 [options]').alias('h', 'help') + .options(options) + .check((argv)=>{ + var err = [] + for (key in options) { + if (options[key].check && argv[key] != undefined) { + var c = options[key].check(argv[key],argv) + if (c!==true) { + err.push(`-${key}: ${c}`) + } + } + } + return err.length ? err.join('\n') : true + }) + .strict() + .version(infos.version).alias('v','version') + +// litle hack to align long-only-options correctly +var h = argv.getUsageInstance().help +argv.getUsageInstance().help = ()=>{ + return h().replace(/^\s{2}--([^\s]*)\s{4}(\s*)/gm, ' --$1$2') +} + +argv = argv.argv + +// are we in a terminal ? +var cli = false, + ignored = ['_', '$0', 'no-sandbox', 'noSandbox', 'disable-gpu', 'disableGpu'] + +for (i in argv) { + if (!ignored.includes(i) && (argv[i]!=undefined && argv[i]!==false)) cli = true +} + +var fs = require('fs'), + ifaces = require('os').networkInterfaces() + + +var baseDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], + configPath = baseDir ? require('path').join(baseDir, '.open-stage-control') : '', + configFile = configPath ? function(){try {return JSON.parse(fs.readFileSync(configPath,'utf-8'))} catch(err) {return {}}}() : {}, + config = JSON.parse(JSON.stringify(configFile)), + defaultConfig + +if (!configPath) { + console.warn('Home directory not found, settings and session history will not be saved.') +} + + +var makeDefaultConfig = function(argv){ + defaultConfig = { + argv:argv, + recentSessions: [], + appName: infos.productName, + instanceName: argv['instance-name'] || false, + targets: argv['send'] || false, + oscInPort: argv['osc-port'] || 0, + httpPort: argv['port'] || 8080, + tcpInPort: argv['tcp-port'] || false, + tcpTargets: argv['tcp-targets'] || [], + debug: argv['debug'] || false, + sessionFile: argv['load'] || false, + newSession: argv['blank'] || false, + customModule: argv['custom-module'] || false, + fullScreen: argv['fullscreen'] || false, + noGui: argv['no-gui'] || false, + guiOnly: typeof argv['gui-only'] == 'string' ? argv['gui-only'].length ? argv['gui-only'] : true : false, + urlOptions: argv['url-options'] ? '?' + argv['url-options'].join('&') : '', + noVsync: argv['disable-vsync'] || false, + noGpu: argv['disable-gpu'] || false, + forceGpu: argv['force-gpu'] || false, + readOnly: argv['read-only'] || false, + remoteSaving: argv['remote-saving'] ? RegExp(argv['remote-saving']) : false, + remoteRoot: argv['remote-root'] || false, + midi: argv['midi'], + stateFile: (function(){ + if (!argv['state']) return false + try { + return JSON.parse(fs.readFileSync(argv['state'], 'utf8')) + } catch(err) { + console.error(err) + return false + } + })(), + appAddresses: Object.values(ifaces) + .reduce((a,b)=>a.concat(b), []) + .filter(i=>i.family === 'IPv4') + .map(i=>'http://' + i.address + ':' + (argv['port'] || 8080)), + examples: argv['examples'], + theme: argv['theme'] || [] + } +} + +makeDefaultConfig(argv) + +module.exports = { + argv:argv, + options:options, + makeDefaultConfig:makeDefaultConfig, + read:function(key){ + var x = config[key] || defaultConfig[key] + return x + }, + write:function(key,value,tmp) { + config[key] = value + if (tmp || !configPath) return + configFile[key] = value + fs.writeFile(configPath,JSON.stringify(configFile,null,4), function(err, data) { + if (err) throw err + }) + }, + cli: cli +} diff --git a/src/server/theme.js b/src/server/theme.js new file mode 100644 index 00000000..e325b052 --- /dev/null +++ b/src/server/theme.js @@ -0,0 +1,76 @@ +var fs = require('fs'), + path = require('path'), + settings = require('./settings') + +class Theme { + + constructor() { + + this.themes = [] + this.files = [] + this.css = [] + + this.defaultColor = '#191f2a' + this.backgroundColor = this.defaultColor + + } + + init() { + + this.themes = settings.read('theme') + this.files = [] + + for (let theme of this.themes) { + + if (theme.includes('.css') && fs.existsSync(theme)) { + this.files.push(theme) + } else if (!theme.includes('.css') && fs.existsSync(path.resolve(__dirname + '/../assets/themes/' + theme + '.css'))) { + this.files.push(path.resolve(__dirname + '/../assets/themes/' + theme + '.css')) + } else { + console.error('Theme error: "' + theme + '" not found.') + } + } + + this.load() + + return this + + } + + load() { + + this.css = [] + + for (let i in this.files) { + + try { + this.css.push(fs.readFileSync(this.files[i],'utf-8')) + } catch(err) { + console.error('Theme error: could not load "' + this.files[i] + '".') + } + + } + + var css = this.get() + + if (css.includes('--color-bg:')) { + this.backgroundColor = css.match(/--color-bg:([^;]*);/)[1].trim() + } else { + this.backgroundColor = this.defaultColor + } + + return this + + } + + get() { + + return this.css.join('\n') + + } + +} + +var theme = new Theme() + +module.exports = theme diff --git a/src/server/utils.js b/src/server/utils.js new file mode 100644 index 00000000..865302fb --- /dev/null +++ b/src/server/utils.js @@ -0,0 +1,24 @@ +module.exports = { + + deepCopy: function(obj, precision) { + + var copy = obj + + if (obj === null) { + return obj + } + + if (typeof obj === 'object') { + copy = Array.isArray(obj) ? [] : {} + for (let key in obj) { + copy[key] = module.exports.deepCopy(obj[key], precision) + } + } else if (typeof obj == 'number') { + return precision === undefined ? copy : parseFloat(copy.toFixed(precision)) + } + + return copy + + } + +} diff --git a/src/server/zeroconf.js b/src/server/zeroconf.js new file mode 100644 index 00000000..74aa0a99 --- /dev/null +++ b/src/server/zeroconf.js @@ -0,0 +1,3 @@ +var zeroconf = require('bonjour')() + +module.exports = zeroconf diff --git a/tests/test.js b/tests/test.js new file mode 100644 index 00000000..968e6855 --- /dev/null +++ b/tests/test.js @@ -0,0 +1,53 @@ +// Very simple test: load a session with 1 widget of each type +var fs = require('fs') + +// create tmp session file + +var session = {type: 'root', tabs:[{widgets:[]}]}, + sessionPath = 'test-session.json' + +require('../scripts/client-shim') + +var {widgets} = require('../src/client/app/widgets') +for (let type in widgets) { + if (type !== 'tab' && type !== 'root' && type !== 'patchbaynode') { + console.log(type) + session.tabs[0].widgets.push({type: type}) + } +} + +fs.writeFileSync(sessionPath, JSON.stringify(session)) + + +// spawn o-s-c in headless mode and load tmp session + +var {spawn} = require('child_process') + +var proc = spawn('xvfb-run', `npm start -- -l ${sessionPath}`.split(' '), {detached: true}) + +proc.stdout.on('data', std) +proc.stderr.on('data', std) + + +function std(data){ + + if (data.includes('process error')) { + console.error(data.toString()) + console.log('\033[31m\n=> Test errored ✘\n\033[0m') + + end() + } + +} + +// timeout after 5s -> no error +setTimeout(()=>{ + console.log('\033[36m\n=> Test timeout without error ✔\n\033[0m') + end() +}, 5000) + +function end(fail){ + proc.kill() + fs.unlinkSync(sessionPath) + process.exit(fail ? 1 : 0) +}