@ircam/comote-helpers 0.3.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +5 -0
- package/.github/workflows/main.yml +3 -3
- package/.history/.gitignore_20250415160643 +6 -0
- package/.history/.gitignore_20250415160723 +6 -0
- package/.history/examples/simple-webview/package-lock_20250415130242.json +5109 -0
- package/.history/examples/simple-webview/package-lock_20250416103557.json +5109 -0
- package/.history/examples/simple-webview/package_20250415130704.json +26 -0
- package/.history/examples/simple-webview/package_20250415184837.json +26 -0
- package/.history/examples/simple-webview/package_20250415190300.json +23 -0
- package/.history/examples/simple-webview/src/server_20250415105733.js +20 -0
- package/.history/examples/simple-webview/src/server_20250415184604.js +20 -0
- package/.history/examples/soundworks/package_20250415132431.json +35 -0
- package/.history/examples/soundworks/package_20250416105956.json +35 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415184836.json +26 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415185949.json +23 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415185950.json +23 -0
- package/.history/max/CoMote/package-info_20241018173608.json +41 -0
- package/.history/max/CoMote/package-info_20250416105743.json +27 -0
- package/.history/max/CoMote/package-info_20250416105826.json +27 -0
- package/.history/max/CoMote/source/comote-connect/package_20250415132759.json +19 -0
- package/.history/max/CoMote/source/comote-connect/package_20250416110158.json +19 -0
- package/.history/max/CoMote/source/comote-connect/server_20250414175059.js +193 -0
- package/.history/max/CoMote/source/comote-connect/server_20250415180549.js +193 -0
- package/.history/package_20250415143437.json +26 -0
- package/.history/package_20250416105907.json +26 -0
- package/LICENSE +2 -2
- package/examples/simple-webview/README.md +10 -0
- package/examples/simple-webview/build/comote-simple-webview-server.js +44 -0
- package/examples/simple-webview/package-lock.json +5109 -0
- package/examples/simple-webview/package.json +23 -0
- package/examples/simple-webview/public/favicon.ico +0 -0
- package/examples/simple-webview/public/index.html +13 -0
- package/examples/simple-webview/public/index.mjs +3623 -0
- package/examples/simple-webview/public/styles.css +99 -0
- package/examples/simple-webview/src/client.js +35 -0
- package/examples/simple-webview/src/server.js +20 -0
- package/examples/soundworks/.build/clients/components/sw-audit.js +64 -0
- package/examples/soundworks/.build/clients/components/sw-audit.js.map +1 -0
- package/examples/soundworks/.build/clients/components/sw-credits.js +73 -0
- package/examples/soundworks/.build/clients/components/sw-credits.js.map +1 -0
- package/examples/soundworks/.build/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/examples/soundworks/.build/clients/player/index.js +116 -0
- package/examples/soundworks/.build/clients/player/index.js.map +1 -0
- package/examples/soundworks/.build/clients/styles/app.scss +79 -0
- package/examples/soundworks/.build/clients/styles/normalize.scss +359 -0
- package/examples/soundworks/.build/clients/webview/index.js +72 -0
- package/examples/soundworks/.build/clients/webview/index.js.map +1 -0
- package/examples/soundworks/.build/public/css/app.css +76 -0
- package/examples/soundworks/.build/public/css/app.css.map +1 -0
- package/examples/soundworks/.build/public/css/normalize.css +321 -0
- package/examples/soundworks/.build/public/css/normalize.css.map +1 -0
- package/examples/soundworks/.build/public/player.js +98098 -0
- package/examples/soundworks/.build/public/player.js.map +1 -0
- package/examples/soundworks/.build/public/webview.js +50725 -0
- package/examples/soundworks/.build/public/webview.js.map +1 -0
- package/examples/soundworks/.build/server/index.js +57 -0
- package/examples/soundworks/.build/server/index.js.map +1 -0
- package/examples/soundworks/.build/server/schemas/.gitkeep +1 -0
- package/examples/soundworks/.build/server/schemas/global.js +19 -0
- package/examples/soundworks/.build/server/schemas/global.js.map +1 -0
- package/examples/soundworks/.build/server/tmpl/default.tmpl +27 -0
- package/examples/soundworks/.build/utils/catch-unhandled-errors.js +9 -0
- package/examples/soundworks/.build/utils/catch-unhandled-errors.js.map +1 -0
- package/examples/soundworks/.editorconfig +12 -0
- package/examples/soundworks/.eslintrc +3 -0
- package/examples/soundworks/.soundworks +7 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/CHANGELOG.md +76 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/LICENSE.md +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/README.md +259 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js +63 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js +62 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js +95 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +374 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js +240 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js +196 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/custom-elements-es5-adapter.js +15 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/package.json +51 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +16 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +55 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +17 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_js-index.js +13 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +25 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +18 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/flag-parser.js +69 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/baseuri.js +28 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/after.js +47 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/before.js +40 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/index.js +14 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/remove.js +37 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/replace-with.js +42 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/custom-event.js +79 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/es6-misc.js +38 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/event-listener-options.js +122 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/get-attribute-names.js +27 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/matches.js +21 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/append.js +31 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/index.js +13 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/prepend.js +42 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/replace-children.js +45 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/promise.js +50 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/svg-element-class-list.js +28 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/symbol.js +64 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/toggle-attribute.js +39 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/unresolved.js +32 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.d.ts +175 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js +384 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-loader.js +238 -0
- package/examples/soundworks/LICENSE +28 -0
- package/examples/soundworks/README.md +26 -0
- package/examples/soundworks/config/application.yaml +8 -0
- package/examples/soundworks/config/env-default.yaml +12 -0
- package/examples/soundworks/package.json +35 -0
- package/examples/soundworks/public/favicon.ico +0 -0
- package/examples/soundworks/public/images/loader.gif +0 -0
- package/examples/soundworks/src/clients/components/sw-audit.js +78 -0
- package/examples/soundworks/src/clients/components/sw-credits.js +80 -0
- package/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/examples/soundworks/src/clients/player/index.js +118 -0
- package/examples/soundworks/src/clients/styles/app.scss +79 -0
- package/examples/soundworks/src/clients/styles/normalize.scss +359 -0
- package/examples/soundworks/src/clients/webview/index.js +78 -0
- package/examples/soundworks/src/server/index.js +62 -0
- package/examples/soundworks/src/server/schemas/.gitkeep +1 -0
- package/examples/soundworks/src/server/schemas/global.js +18 -0
- package/examples/soundworks/src/server/tmpl/default.tmpl +27 -0
- package/examples/soundworks/src/utils/catch-unhandled-errors.js +9 -0
- package/index.html +51 -0
- package/max/CoMote/docs/sw.shared-state.maxref.xml +95 -0
- package/max/CoMote/examples/simple-webview/README.md +10 -0
- package/max/CoMote/examples/simple-webview/build/comote-simple-webview-server.js +44 -0
- package/max/CoMote/examples/simple-webview/comote-simple-webview-server.maxpat +186 -0
- package/max/CoMote/examples/simple-webview/package-lock.json +5109 -0
- package/max/CoMote/examples/simple-webview/package.json +23 -0
- package/max/CoMote/examples/simple-webview/public/favicon.ico +0 -0
- package/max/CoMote/examples/simple-webview/public/index.html +13 -0
- package/max/CoMote/examples/simple-webview/public/index.mjs +3623 -0
- package/max/CoMote/examples/simple-webview/public/styles.css +99 -0
- package/max/CoMote/examples/simple-webview/src/client.js +35 -0
- package/max/CoMote/examples/simple-webview/src/server.js +20 -0
- package/max/CoMote/examples/soundworks/.editorconfig +12 -0
- package/max/CoMote/examples/soundworks/.eslintrc +3 -0
- package/max/CoMote/examples/soundworks/.soundworks +7 -0
- package/max/CoMote/examples/soundworks/LICENSE +28 -0
- package/max/CoMote/examples/soundworks/README.md +26 -0
- package/max/CoMote/examples/soundworks/config/application.yaml +8 -0
- package/max/CoMote/examples/soundworks/config/env-default.yaml +12 -0
- package/max/CoMote/examples/soundworks/package.json +35 -0
- package/max/CoMote/examples/soundworks/public/favicon.ico +0 -0
- package/max/CoMote/examples/soundworks/public/images/loader.gif +0 -0
- package/max/CoMote/examples/soundworks/src/clients/components/sw-audit.js +78 -0
- package/max/CoMote/examples/soundworks/src/clients/components/sw-credits.js +80 -0
- package/max/CoMote/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/max/CoMote/examples/soundworks/src/clients/player/index.js +118 -0
- package/max/CoMote/examples/soundworks/src/clients/styles/app.scss +79 -0
- package/max/CoMote/examples/soundworks/src/clients/styles/normalize.scss +359 -0
- package/max/CoMote/examples/soundworks/src/clients/webview/index.js +78 -0
- package/max/CoMote/examples/soundworks/src/server/index.js +62 -0
- package/max/CoMote/examples/soundworks/src/server/schemas/.gitkeep +1 -0
- package/max/CoMote/examples/soundworks/src/server/schemas/global.js +18 -0
- package/max/CoMote/examples/soundworks/src/server/tmpl/default.tmpl +27 -0
- package/max/CoMote/examples/soundworks/src/utils/catch-unhandled-errors.js +9 -0
- package/max/CoMote/extras/CoMote.maxpat +1994 -0
- package/max/CoMote/help/comote_osc_receive.maxhelp +946 -0
- package/max/CoMote/icon.png +0 -0
- package/max/CoMote/init/objectmappings.txt +2 -0
- package/max/CoMote/media/comote-screenshot.png +0 -0
- package/max/CoMote/package-info.json +27 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/comote-connect-client.mjs +2821 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/favicon.ico +0 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/index.html +22 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-server.js +24775 -0
- package/max/CoMote/patchers/comote-connect/comote-connect.maxpat +1048 -0
- package/max/CoMote/patchers/comote-connect/package.json +4 -0
- package/max/CoMote/patchers/comote_format_from_comote_v2.maxpat +613 -0
- package/max/CoMote/patchers/comote_format_from_v3.maxpat +443 -0
- package/max/CoMote/patchers/comote_format_gyro_v2_to_v3.maxpat +240 -0
- package/max/CoMote/patchers/comote_format_gyro_v3_to_v2.maxpat +240 -0
- package/max/CoMote/patchers/comote_format_heading_v2_to_v3.maxpat +171 -0
- package/max/CoMote/patchers/comote_osc_receive.maxpat +440 -0
- package/max/CoMote/patchers/comote_osc_to_list.maxpat +161 -0
- package/max/CoMote/readme.md +22 -0
- package/max/CoMote/source/comote-connect/client.js +104 -0
- package/max/CoMote/source/comote-connect/package-lock.json +591 -0
- package/max/CoMote/source/comote-connect/package.json +19 -0
- package/max/CoMote/source/comote-connect/server.js +193 -0
- package/max-update.bash +44 -0
- package/package.json +10 -29
- package/src/.editorbackup/network-infos.js~ +60 -0
- package/src/.editorbackup/wifi-infos.js~ +33 -0
- package/src/network-infos.js +67 -0
- package/{qrcode.js → src/qrcode.js} +26 -40
- package/{server.js → src/server.js} +45 -69
- package/src/wifi-infos.js +33 -0
- package/README.md +0 -160
- package/wifi-infos.js +0 -41
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
5
|
+
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
6
|
+
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
7
|
+
* Code distributed by Google as part of the polymer project is also
|
|
8
|
+
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
(function () {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Basic flow of the loader process
|
|
16
|
+
*
|
|
17
|
+
* There are 4 flows the loader can take when booting up
|
|
18
|
+
*
|
|
19
|
+
* - Synchronous script, no polyfills needed
|
|
20
|
+
* - wait for `DOMContentLoaded`
|
|
21
|
+
* - fire WCR event, as there could not be any callbacks passed to `waitFor`
|
|
22
|
+
*
|
|
23
|
+
* - Synchronous script, polyfills needed
|
|
24
|
+
* - document.write the polyfill bundle
|
|
25
|
+
* - wait on the `load` event of the bundle to batch Custom Element upgrades
|
|
26
|
+
* - wait for `DOMContentLoaded`
|
|
27
|
+
* - run callbacks passed to `waitFor`
|
|
28
|
+
* - fire WCR event
|
|
29
|
+
*
|
|
30
|
+
* - Asynchronous script, no polyfills needed
|
|
31
|
+
* - wait for `DOMContentLoaded`
|
|
32
|
+
* - run callbacks passed to `waitFor`
|
|
33
|
+
* - fire WCR event
|
|
34
|
+
*
|
|
35
|
+
* - Asynchronous script, polyfills needed
|
|
36
|
+
* - Append the polyfill bundle script
|
|
37
|
+
* - wait for `load` event of the bundle
|
|
38
|
+
* - batch Custom Element Upgrades
|
|
39
|
+
* - run callbacks pass to `waitFor`
|
|
40
|
+
* - fire WCR event
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
var polyfillsLoaded = false;
|
|
44
|
+
var whenLoadedFns = [];
|
|
45
|
+
var allowUpgrades = false;
|
|
46
|
+
var flushFn;
|
|
47
|
+
|
|
48
|
+
function fireEvent() {
|
|
49
|
+
window.WebComponents.ready = true;
|
|
50
|
+
document.dispatchEvent(
|
|
51
|
+
new CustomEvent('WebComponentsReady', {bubbles: true})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function batchCustomElements() {
|
|
56
|
+
if (window.customElements && customElements.polyfillWrapFlushCallback) {
|
|
57
|
+
customElements.polyfillWrapFlushCallback(function (flushCallback) {
|
|
58
|
+
flushFn = flushCallback;
|
|
59
|
+
if (allowUpgrades) {
|
|
60
|
+
flushFn();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function asyncReady() {
|
|
67
|
+
batchCustomElements();
|
|
68
|
+
ready();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function ready() {
|
|
72
|
+
// bootstrap <template> elements before custom elements
|
|
73
|
+
if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
|
|
74
|
+
HTMLTemplateElement.bootstrap(window.document);
|
|
75
|
+
}
|
|
76
|
+
polyfillsLoaded = true;
|
|
77
|
+
runWhenLoadedFns().then(fireEvent);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function runWhenLoadedFns() {
|
|
81
|
+
allowUpgrades = false;
|
|
82
|
+
var fnsMap = whenLoadedFns.map(function (fn) {
|
|
83
|
+
return fn instanceof Function ? fn() : fn;
|
|
84
|
+
});
|
|
85
|
+
whenLoadedFns = [];
|
|
86
|
+
return Promise.all(fnsMap)
|
|
87
|
+
.then(function () {
|
|
88
|
+
allowUpgrades = true;
|
|
89
|
+
flushFn && flushFn();
|
|
90
|
+
})
|
|
91
|
+
.catch(function (err) {
|
|
92
|
+
console.error(err);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
window.WebComponents = window.WebComponents || {};
|
|
97
|
+
window.WebComponents.ready = window.WebComponents.ready || false;
|
|
98
|
+
window.WebComponents.waitFor =
|
|
99
|
+
window.WebComponents.waitFor ||
|
|
100
|
+
function (waitFn) {
|
|
101
|
+
if (!waitFn) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
whenLoadedFns.push(waitFn);
|
|
105
|
+
if (polyfillsLoaded) {
|
|
106
|
+
runWhenLoadedFns();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
window.WebComponents._batchCustomElements = batchCustomElements;
|
|
110
|
+
|
|
111
|
+
var name = 'webcomponents-loader.js';
|
|
112
|
+
// Feature detect which polyfill needs to be imported.
|
|
113
|
+
var polyfills = [];
|
|
114
|
+
if (
|
|
115
|
+
!(
|
|
116
|
+
'attachShadow' in Element.prototype && 'getRootNode' in Element.prototype
|
|
117
|
+
) ||
|
|
118
|
+
(window.ShadyDOM && window.ShadyDOM.force)
|
|
119
|
+
) {
|
|
120
|
+
polyfills.push('sd');
|
|
121
|
+
}
|
|
122
|
+
if (!window.customElements || window.customElements.forcePolyfill) {
|
|
123
|
+
polyfills.push('ce');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var needsTemplate = (function () {
|
|
127
|
+
// no real <template> because no `content` property (IE and older browsers)
|
|
128
|
+
var t = document.createElement('template');
|
|
129
|
+
if (!('content' in t)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
// broken doc fragment (older Edge)
|
|
133
|
+
if (!(t.content.cloneNode() instanceof DocumentFragment)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
// broken <template> cloning (Edge up to at least version 17)
|
|
137
|
+
var t2 = document.createElement('template');
|
|
138
|
+
t2.content.appendChild(document.createElement('div'));
|
|
139
|
+
t.content.appendChild(t2);
|
|
140
|
+
var clone = t.cloneNode(true);
|
|
141
|
+
return (
|
|
142
|
+
clone.content.childNodes.length === 0 ||
|
|
143
|
+
clone.content.firstChild.content.childNodes.length === 0
|
|
144
|
+
);
|
|
145
|
+
})();
|
|
146
|
+
|
|
147
|
+
// NOTE: any browser that does not have template or ES6 features
|
|
148
|
+
// must load the full suite of polyfills.
|
|
149
|
+
if (
|
|
150
|
+
!window.Promise ||
|
|
151
|
+
!Array.from ||
|
|
152
|
+
!window.URL ||
|
|
153
|
+
!window.Symbol ||
|
|
154
|
+
needsTemplate
|
|
155
|
+
) {
|
|
156
|
+
polyfills = ['sd-ce-pf'];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (polyfills.length) {
|
|
160
|
+
// When the Trusted Types API is available, `policy` is a
|
|
161
|
+
// `TrustedTypePolicy` with functions for creating trusted HTML, scripts,
|
|
162
|
+
// and script URLs. This policy is used below to (a) approve the bundle URL
|
|
163
|
+
// string created by the loader that is assigned to a `<script>`'s `src`
|
|
164
|
+
// attribute, (b) approve a constant script string that is assigned to that
|
|
165
|
+
// `<script>'s `onload` attribute, and (c) approve the string of HTML that
|
|
166
|
+
// the loader reads from that `<script>`'s `outerHTML`.
|
|
167
|
+
//
|
|
168
|
+
// If the Trusted Types API is not available, the returned object exposes a
|
|
169
|
+
// similar interface to a `TrustedTypePolicy`, but all of its functions are
|
|
170
|
+
// the identity function.
|
|
171
|
+
var policy = (function () {
|
|
172
|
+
var identity = function (x) {
|
|
173
|
+
return x;
|
|
174
|
+
};
|
|
175
|
+
var policyOptions = {
|
|
176
|
+
createHTML: identity,
|
|
177
|
+
createScript: identity,
|
|
178
|
+
createScriptURL: identity,
|
|
179
|
+
};
|
|
180
|
+
var policy =
|
|
181
|
+
window.trustedTypes &&
|
|
182
|
+
window.trustedTypes.createPolicy('webcomponents-loader', policyOptions);
|
|
183
|
+
return policy || policyOptions;
|
|
184
|
+
})();
|
|
185
|
+
|
|
186
|
+
var url;
|
|
187
|
+
var polyfillFile = 'bundles/webcomponents-' + polyfills.join('-') + '.js';
|
|
188
|
+
|
|
189
|
+
// Load it from the right place.
|
|
190
|
+
if (window.WebComponents.root) {
|
|
191
|
+
url = window.WebComponents.root + polyfillFile;
|
|
192
|
+
if (
|
|
193
|
+
window.trustedTypes &&
|
|
194
|
+
window.trustedTypes.isScriptURL(window.WebComponents.root)
|
|
195
|
+
) {
|
|
196
|
+
url = policy.createScriptURL(url);
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
var script = document.querySelector('script[src*="' + name + '"]');
|
|
200
|
+
// Load it from the right place.
|
|
201
|
+
url = policy.createScriptURL(script.src.replace(name, polyfillFile));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
var newScript = document.createElement('script');
|
|
205
|
+
newScript.src = url;
|
|
206
|
+
// if readyState is 'loading', this script is synchronous
|
|
207
|
+
if (document.readyState === 'loading') {
|
|
208
|
+
// make sure custom elements are batched whenever parser gets to the injected script
|
|
209
|
+
newScript.setAttribute(
|
|
210
|
+
'onload',
|
|
211
|
+
policy.createScript('window.WebComponents._batchCustomElements()')
|
|
212
|
+
);
|
|
213
|
+
document.write(policy.createHTML(newScript.outerHTML));
|
|
214
|
+
document.addEventListener('DOMContentLoaded', ready);
|
|
215
|
+
} else {
|
|
216
|
+
newScript.addEventListener('load', function () {
|
|
217
|
+
asyncReady();
|
|
218
|
+
});
|
|
219
|
+
newScript.addEventListener('error', function () {
|
|
220
|
+
throw new Error('Could not load polyfill bundle' + url);
|
|
221
|
+
});
|
|
222
|
+
document.head.appendChild(newScript);
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
// if readyState is 'complete', script is loaded imperatively on a spec-compliant browser, so just fire WCR
|
|
226
|
+
if (document.readyState === 'complete') {
|
|
227
|
+
polyfillsLoaded = true;
|
|
228
|
+
fireEvent();
|
|
229
|
+
} else {
|
|
230
|
+
// this script may come between DCL and load, so listen for both, and cancel load listener if DCL fires
|
|
231
|
+
window.addEventListener('load', ready);
|
|
232
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
233
|
+
window.removeEventListener('load', ready);
|
|
234
|
+
ready();
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright (c) 2014-present IRCAM – Centre Pompidou (France, Paris)
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
12
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
13
|
+
other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
* Neither the name of the IRCAM nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
20
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
21
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
23
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
24
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
25
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
26
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
28
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# CoMote example app
|
|
2
|
+
|
|
3
|
+
This application showcases the usage of the `comote-helpers` SDK for the CoMote application.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
1. Install Node.js LTS
|
|
8
|
+
2. Install and launch the Web application
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
cd path/to/comote-helpers/example
|
|
12
|
+
npm install
|
|
13
|
+
npm run dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
A web page will be accessible at `http://127.0.0.1:8000` on the computer running the server.
|
|
17
|
+
|
|
18
|
+
3. Connect your mobile phone on the same WiFi as the computer running the server
|
|
19
|
+
4. Launch the CoMote application on your mobile phone
|
|
20
|
+
5. Scan the QRCode on the web page from the CoMote application
|
|
21
|
+
|
|
22
|
+
...and enjoy the sensors and controls streamed to the Web page through WebSockets
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
[BSF-3-Clause](../LICENSE)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ircam/comote-example-soundworks",
|
|
3
|
+
"description": "comote soundworks example application",
|
|
4
|
+
"authors": [],
|
|
5
|
+
"license": "BSD-3-Clause",
|
|
6
|
+
"version": "0.0.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"private": true,
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npm run clean && sass src/clients/styles:.build/public/css && soundworks-build -b",
|
|
11
|
+
"clean": "soundworks-build -D",
|
|
12
|
+
"dev": "npm run build && (concurrently -i -p \"none\" \"npm run watch:inspect server\" \"soundworks-build -b -w\" \"npm run watch:sass\")",
|
|
13
|
+
"start": "node .build/server/index.js",
|
|
14
|
+
"watch": "soundworks-build -p",
|
|
15
|
+
"watch:inspect": "soundworks-build -i -p",
|
|
16
|
+
"watch:sass": "sass --watch src/clients/styles:.build/public/css",
|
|
17
|
+
"lint": "eslint ."
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ircam/comote-helpers": "^1.0.0",
|
|
21
|
+
"@ircam/sc-components": "^3.0.0-alpha.60",
|
|
22
|
+
"@soundworks/core": "^4.0.0-alpha.21",
|
|
23
|
+
"@soundworks/helpers": "^1.0.0-alpha.12",
|
|
24
|
+
"json5": "^2.2.3",
|
|
25
|
+
"lit": "^3.1.3"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@ircam/eslint-config": "^1.2.1",
|
|
29
|
+
"@soundworks/build": "^1.0.0-alpha.6",
|
|
30
|
+
"@soundworks/create": "^1.0.0-alpha.23",
|
|
31
|
+
"concurrently": "^8.2.2",
|
|
32
|
+
"eslint": "^9.6.0",
|
|
33
|
+
"sass": "^1.77.1"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
3
|
+
|
|
4
|
+
function padLeft(value, size) {
|
|
5
|
+
let str = value + ''; // cast to string
|
|
6
|
+
|
|
7
|
+
while (str.length <= size) {
|
|
8
|
+
str = ` ${str}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return str;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Component for the soundworks internal audit state
|
|
16
|
+
*/
|
|
17
|
+
class SwAudit extends LitElement {
|
|
18
|
+
static styles = css`
|
|
19
|
+
:host > div {
|
|
20
|
+
background-color: var(--sw-light-background-color);
|
|
21
|
+
height: 100%;
|
|
22
|
+
padding: 0 20px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
|
|
30
|
+
this.client = null;
|
|
31
|
+
this._auditState = null;
|
|
32
|
+
this._numClientsString = '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async connectedCallback() {
|
|
36
|
+
super.connectedCallback();
|
|
37
|
+
|
|
38
|
+
this._auditState = await this.client.getAuditState();
|
|
39
|
+
this._auditState.onUpdate(updates => {
|
|
40
|
+
if ('numClients' in updates) {
|
|
41
|
+
const numClientsStrings = [];
|
|
42
|
+
const numClients = this._auditState.get('numClients');
|
|
43
|
+
|
|
44
|
+
for (let role in numClients) {
|
|
45
|
+
const str = `${role}: ${padLeft(numClients[role], 2)}`;
|
|
46
|
+
numClientsStrings.push(str);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this._numClientsString = numClientsStrings.join(' - ');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.requestUpdate();
|
|
53
|
+
}, true);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
disconnectedCallback() {
|
|
57
|
+
super.disconnectedCallback();
|
|
58
|
+
|
|
59
|
+
this._auditState.detach();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render() {
|
|
63
|
+
if (this._auditState === null) {
|
|
64
|
+
return nothing;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const avgLatency = this._auditState.get('averageNetworkLatency');
|
|
68
|
+
const avgLatencyString = padLeft((avgLatency * 1e3).toFixed(2), 6);
|
|
69
|
+
|
|
70
|
+
return html`
|
|
71
|
+
<div>
|
|
72
|
+
${unsafeHTML(this._numClientsString)} | avg latency: ${unsafeHTML(avgLatencyString)} ms
|
|
73
|
+
</div>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
customElements.define('sw-audit', SwAudit);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
2
|
+
|
|
3
|
+
import '@ircam/sc-components/sc-icon.js';
|
|
4
|
+
|
|
5
|
+
class SwCredits extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
_show: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
state: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
static styles = css`
|
|
14
|
+
:host {
|
|
15
|
+
width: 100%;
|
|
16
|
+
position: fixed;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
z-index: 1000;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host > footer {
|
|
23
|
+
display: block;
|
|
24
|
+
line-height: 1.6rem;
|
|
25
|
+
padding: 20px;
|
|
26
|
+
background-color: var(--sw-light-background-color);
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
footer span {
|
|
31
|
+
font-style: italic;
|
|
32
|
+
color: var(--sw-light-font-color);
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
footer a {
|
|
37
|
+
color: var(--sw-light-font-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
sc-icon {
|
|
41
|
+
position: absolute;
|
|
42
|
+
bottom: 20px;
|
|
43
|
+
right: 20px;
|
|
44
|
+
z-index: 1001;
|
|
45
|
+
border: none;
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
opacity: 0.6;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
|
|
54
|
+
this._show = false;
|
|
55
|
+
this.infos = {};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
render() {
|
|
59
|
+
const $footer = html`
|
|
60
|
+
<footer>
|
|
61
|
+
<p>
|
|
62
|
+
<span>${this.infos.name}</span>
|
|
63
|
+
${this.infos.author ? html`by <span>${this.infos.author}</span>` : ``}
|
|
64
|
+
has been developped using the <a href="https://soundworks.dev" target="_blank">soundworks</a>
|
|
65
|
+
framework developped by the ISMM team at Ircam.
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
Copyright (c) 2014-present IRCAM – Centre Pompidou (France, Paris)
|
|
69
|
+
</p>
|
|
70
|
+
</footer>
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
return html`
|
|
74
|
+
${this._show ? $footer : nothing}
|
|
75
|
+
<sc-icon type="question" @release=${e => this._show = !this._show}></sc-icon>
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
customElements.define('sw-credits', SwCredits);
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { AbstractExperience } from '@soundworks/core/client';
|
|
2
|
+
import { render, html, nothing } from 'lit/html.js';
|
|
3
|
+
import renderInitializationScreens from '@soundworks/template-helpers/client/render-initialization-screens.js';
|
|
4
|
+
import * as CoMoteQRCode from '@ircam/comote-helpers/qrcode.js';
|
|
5
|
+
|
|
6
|
+
import '@ircam/simple-components/sc-editor.js';
|
|
7
|
+
import '@ircam/simple-components/sc-text.js';
|
|
8
|
+
import '@ircam/simple-components/sc-toggle.js';
|
|
9
|
+
|
|
10
|
+
const SOCKET_PORT = 8901;
|
|
11
|
+
|
|
12
|
+
class PlayerExperience extends AbstractExperience {
|
|
13
|
+
constructor(client, config, $container) {
|
|
14
|
+
super(client);
|
|
15
|
+
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.$container = $container;
|
|
18
|
+
this.rafId = null;
|
|
19
|
+
|
|
20
|
+
renderInitializationScreens(client, config, $container);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async start() {
|
|
24
|
+
super.start();
|
|
25
|
+
|
|
26
|
+
window.addEventListener('resize', () => this.render());
|
|
27
|
+
|
|
28
|
+
this.infos = await this.client.stateManager.attach('infos');
|
|
29
|
+
this.infos.subscribe(() => this.render());
|
|
30
|
+
|
|
31
|
+
this.infos.subscribe(async updates => {
|
|
32
|
+
if (updates.comoteConfig) {
|
|
33
|
+
this.qrCode = await CoMoteQRCode.dataURL(this.infos.get('comoteConfig'));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (updates.buttonA) {
|
|
37
|
+
console.log(updates.buttonA);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.render();
|
|
41
|
+
}, true);
|
|
42
|
+
|
|
43
|
+
this.render();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
// debounce with requestAnimationFrame
|
|
48
|
+
window.cancelAnimationFrame(this.rafId);
|
|
49
|
+
|
|
50
|
+
this.rafId = window.requestAnimationFrame(() => {
|
|
51
|
+
const values =
|
|
52
|
+
|
|
53
|
+
render(html`
|
|
54
|
+
<div style="padding: 20px">
|
|
55
|
+
<h1 style="margin: 20px 0">CoMo.te dashboard</h1>
|
|
56
|
+
|
|
57
|
+
<div style="margin-bottom: 10px;">
|
|
58
|
+
<sc-text
|
|
59
|
+
value="WiFi infos"
|
|
60
|
+
width="310"
|
|
61
|
+
readonly
|
|
62
|
+
></sc-text>
|
|
63
|
+
<sc-text
|
|
64
|
+
value="${JSON.stringify(this.infos.get('wifiInfos'), null, 2)}"
|
|
65
|
+
readonly
|
|
66
|
+
height="80"
|
|
67
|
+
width="300"
|
|
68
|
+
></sc-text>
|
|
69
|
+
</div>
|
|
70
|
+
<div style="margin-bottom: 10px;">
|
|
71
|
+
<sc-text
|
|
72
|
+
value="Settings"
|
|
73
|
+
width="310"
|
|
74
|
+
readonly
|
|
75
|
+
></sc-text>
|
|
76
|
+
<sc-editor
|
|
77
|
+
value="${JSON.stringify(this.infos.get('comoteConfig'), null, 2)}"
|
|
78
|
+
@change="${e => this.infos.set({ comoteConfig: JSON.parse(e.detail.value) })}"
|
|
79
|
+
></sc-editor>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
${this.qrCode ?
|
|
83
|
+
html`
|
|
84
|
+
<div style="display: inline-block; vertical-align: top; margin-right: 12px">
|
|
85
|
+
<sc-text
|
|
86
|
+
style="display: block; margin-bottom: 4px;"
|
|
87
|
+
width="300"
|
|
88
|
+
value="Flash QR to retrieve settings in CoMo.te"
|
|
89
|
+
readonly
|
|
90
|
+
></sc-text>
|
|
91
|
+
<img src="${this.qrCode}" width="300" height="300" />
|
|
92
|
+
</div>
|
|
93
|
+
`
|
|
94
|
+
: nothing}
|
|
95
|
+
|
|
96
|
+
<div style="display: inline-block; vertical-align: top; margin-right: 12px">
|
|
97
|
+
<sc-text
|
|
98
|
+
value="${JSON.stringify(this.infos.get('data'), null, 2)}"
|
|
99
|
+
readonly
|
|
100
|
+
height="334"
|
|
101
|
+
width="300"
|
|
102
|
+
></sc-text>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div style="display: inline-block; vertical-align: top; margin-right: 12px">
|
|
106
|
+
<div style="margin-bottom: 6px">
|
|
107
|
+
<sc-text
|
|
108
|
+
value="buttonA"
|
|
109
|
+
readonly
|
|
110
|
+
></sc-text>
|
|
111
|
+
<sc-toggle
|
|
112
|
+
.active=${this.infos.get('buttonA')}
|
|
113
|
+
></sc-toggle>
|
|
114
|
+
</div>
|
|
115
|
+
<div style="margin-bottom: 6px">
|
|
116
|
+
<sc-text
|
|
117
|
+
value="buttonB"
|
|
118
|
+
readonly
|
|
119
|
+
></sc-text>
|
|
120
|
+
<sc-toggle
|
|
121
|
+
.active=${this.infos.get('buttonB')}
|
|
122
|
+
></sc-toggle>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
`, this.$container);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default PlayerExperience;
|