@webqit/oohtml 1.9.16 → 1.9.19
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/dist/html-imports.js +1 -1
- package/dist/html-imports.js.gz +0 -0
- package/dist/html-imports.js.map +1 -1
- package/dist/html-imports.js.map.gz +0 -0
- package/dist/html-modules.js +1 -1
- package/dist/html-modules.js.gz +0 -0
- package/dist/html-modules.js.map +1 -1
- package/dist/html-modules.js.map.gz +0 -0
- package/dist/main.js +1 -1
- package/dist/main.js.gz +0 -0
- package/dist/main.js.map +1 -1
- package/dist/main.js.map.gz +0 -0
- package/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.gz +0 -0
- package/dist/namespaced-html.js.map +1 -1
- package/dist/namespaced-html.js.map.gz +0 -0
- package/dist/state-api.js +1 -1
- package/dist/state-api.js.gz +0 -0
- package/dist/state-api.js.map +1 -1
- package/dist/state-api.js.map.gz +0 -0
- package/dist/subscript.js +1 -1
- package/dist/subscript.js.gz +0 -0
- package/dist/subscript.js.map +1 -1
- package/dist/subscript.js.map.gz +0 -0
- package/package.json +2 -2
- package/src/html-imports/browser-entry.js +1 -1
- package/src/html-imports/index.js +7 -7
- package/src/html-modules/browser-entry.js +1 -1
- package/src/html-modules/index.js +7 -7
- package/src/index.js +6 -6
- package/src/namespaced-html/browser-entry.js +1 -1
- package/src/namespaced-html/index.js +7 -7
- package/src/state-api/browser-entry.js +1 -1
- package/src/state-api/index.js +7 -7
- package/src/subscript/Element.js +8 -12
- package/src/subscript/index.js +25 -16
package/dist/subscript.js.map.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"wicg-proposal"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://webqit.io/tooling/oohtml",
|
|
17
|
-
"version": "1.9.
|
|
17
|
+
"version": "1.9.19",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@webqit/browser-pie": "^0.0.17",
|
|
42
42
|
"@webqit/observer": "^1.7.5",
|
|
43
|
-
"@webqit/subscript": "^2.
|
|
43
|
+
"@webqit/subscript": "^2.1.4",
|
|
44
44
|
"@webqit/util": "^0.8.7",
|
|
45
45
|
"acorn": "^8.7.0"
|
|
46
46
|
},
|
|
@@ -21,13 +21,13 @@ import { config, scopeQuery,
|
|
|
21
21
|
*
|
|
22
22
|
* @param Object config
|
|
23
23
|
*/
|
|
24
|
-
export default function init(_config =
|
|
24
|
+
export default function init( _config = {} ) {
|
|
25
25
|
|
|
26
|
-
const WebQit = domInit.call(this);
|
|
27
|
-
if (onDomReady) {
|
|
28
|
-
WebQit.DOM.ready(() => {
|
|
29
|
-
init.call(this, _config, false);
|
|
30
|
-
});
|
|
26
|
+
const WebQit = domInit.call( this );
|
|
27
|
+
if ( _config.onDomReady ) {
|
|
28
|
+
WebQit.DOM.ready( () => {
|
|
29
|
+
init.call( this, { ..._config, onDomReady: false } );
|
|
30
|
+
} );
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -44,7 +44,7 @@ export default function init(_config = null, onDomReady = false) {
|
|
|
44
44
|
importid: 'name',
|
|
45
45
|
exportsearch: 'exportsearch',
|
|
46
46
|
},
|
|
47
|
-
}, _config);
|
|
47
|
+
}, _config.params );
|
|
48
48
|
|
|
49
49
|
_defaultNoInherits.push(_meta.get('attr.importid'), _meta.get('attr.moduleref'));
|
|
50
50
|
const modulerefSelector = '[' + window.CSS.escape(_meta.get('attr.moduleref')) + ']';
|
|
@@ -19,13 +19,13 @@ import { config, scopeQuery } from '../util.js';
|
|
|
19
19
|
*
|
|
20
20
|
* @param Object config
|
|
21
21
|
*/
|
|
22
|
-
export default function init(_config =
|
|
22
|
+
export default function init( _config = {} ) {
|
|
23
23
|
|
|
24
|
-
const WebQit = domInit.call(this);
|
|
25
|
-
if (onDomReady) {
|
|
26
|
-
WebQit.DOM.ready(() => {
|
|
27
|
-
init.call(this, _config, false);
|
|
28
|
-
});
|
|
24
|
+
const WebQit = domInit.call( this );
|
|
25
|
+
if ( _config.onDomReady ) {
|
|
26
|
+
WebQit.DOM.ready( () => {
|
|
27
|
+
init.call( this, { ..._config, onDomReady: false } );
|
|
28
|
+
} );
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -51,7 +51,7 @@ export default function init(_config = null, onDomReady = false) {
|
|
|
51
51
|
exports: 'exports',
|
|
52
52
|
moduleref: 'template',
|
|
53
53
|
},
|
|
54
|
-
}, _config);
|
|
54
|
+
}, _config.params );
|
|
55
55
|
|
|
56
56
|
const templateSelector = 'template' + (_meta.get('element.template') ? '[is="' + _meta.get('element.template') + '"]' : '') + '[' + window.CSS.escape(_meta.get('attr.moduleid')) + ']';
|
|
57
57
|
var TemplateElementClass = window.HTMLTemplateElement;
|
package/src/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import Subscript from './subscript/index.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* @init
|
|
15
15
|
*/
|
|
16
|
-
export default function init(
|
|
16
|
+
export default function init(configs = {}) {
|
|
17
17
|
|
|
18
18
|
const WebQit = domInit.call(this);
|
|
19
19
|
if (WebQit.OOHTML) {
|
|
@@ -21,11 +21,11 @@ export default function init(config = null, onDomReady = false) {
|
|
|
21
21
|
}
|
|
22
22
|
WebQit.OOHTML = {};
|
|
23
23
|
// --------------
|
|
24
|
-
HTMLModules.call(this,
|
|
25
|
-
HTMLImports.call(this,
|
|
26
|
-
NamespacedHTML.call(this,
|
|
27
|
-
StateAPI.call(this,
|
|
28
|
-
Subscript.call(this,
|
|
24
|
+
HTMLModules.call(this, (configs.HTMLModules || {}));
|
|
25
|
+
HTMLImports.call(this, (configs.HTMLImports || {}));
|
|
26
|
+
NamespacedHTML.call(this, (configs.NamespacedHTML || {}));
|
|
27
|
+
StateAPI.call(this, (configs.StateAPI || {}));
|
|
28
|
+
Subscript.call(this, (configs.Subscript || {}));
|
|
29
29
|
// --------------
|
|
30
30
|
WebQit.Observer = Observer;
|
|
31
31
|
|
|
@@ -19,13 +19,13 @@ import { config } from '../util.js';
|
|
|
19
19
|
*
|
|
20
20
|
* @param Object config
|
|
21
21
|
*/
|
|
22
|
-
export default function init(_config =
|
|
22
|
+
export default function init( _config = {} ) {
|
|
23
23
|
|
|
24
|
-
const WebQit = domInit.call(this);
|
|
25
|
-
if (onDomReady) {
|
|
26
|
-
WebQit.DOM.ready(() => {
|
|
27
|
-
init.call(this, _config, false);
|
|
28
|
-
});
|
|
24
|
+
const WebQit = domInit.call( this );
|
|
25
|
+
if ( _config.onDomReady ) {
|
|
26
|
+
WebQit.DOM.ready( () => {
|
|
27
|
+
init.call( this, { ..._config, onDomReady: false } );
|
|
28
|
+
} );
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -43,7 +43,7 @@ export default function init(_config = null, onDomReady = false) {
|
|
|
43
43
|
namespace: 'namespace',
|
|
44
44
|
},
|
|
45
45
|
eagermode: true,
|
|
46
|
-
}, _config);
|
|
46
|
+
}, _config.params );
|
|
47
47
|
|
|
48
48
|
const getNamespaceObject = function(subject) {
|
|
49
49
|
if (!_internals(subject, 'oohtml').has('namespace')) {
|
package/src/state-api/index.js
CHANGED
|
@@ -19,13 +19,13 @@ import { config } from '../util.js';
|
|
|
19
19
|
*
|
|
20
20
|
* @param Object config
|
|
21
21
|
*/
|
|
22
|
-
export default function init(_config =
|
|
22
|
+
export default function init( _config = {} ) {
|
|
23
23
|
|
|
24
|
-
const WebQit = domInit.call(this);
|
|
25
|
-
if (onDomReady) {
|
|
26
|
-
WebQit.DOM.ready(() => {
|
|
27
|
-
init.call(this, _config, false);
|
|
28
|
-
});
|
|
24
|
+
const WebQit = domInit.call( this );
|
|
25
|
+
if ( _config.onDomReady ) {
|
|
26
|
+
WebQit.DOM.ready( () => {
|
|
27
|
+
init.call( this, { ..._config, onDomReady: false } );
|
|
28
|
+
} );
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ export default function init(_config = null, onDomReady = false) {
|
|
|
34
34
|
|
|
35
35
|
const _meta = config.call(this, {
|
|
36
36
|
api: {state: 'state', setState: 'setState', clearState: 'clearState',},
|
|
37
|
-
}, _config);
|
|
37
|
+
}, _config.params );
|
|
38
38
|
|
|
39
39
|
const getOrCreateState = function(subject, newStateObject = null) {
|
|
40
40
|
if (!_internals(subject, 'oohtml').has('state') || newStateObject) {
|
package/src/subscript/Element.js
CHANGED
|
@@ -21,17 +21,13 @@ export const Element = BaseElement => class extends SubscriptClass( BaseElement
|
|
|
21
21
|
return { globalsAutoObserve: [ 'document' ] };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
static get subscriptMethods() {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
static expose( element, subscriptFunction ) {
|
|
29
|
-
let
|
|
25
|
+
let subscriptInstances = _internals( element, 'oohtml', 'subscript', 'instances' );
|
|
30
26
|
let id = subscriptFunction.name;
|
|
31
27
|
if ( !id ) {
|
|
32
|
-
id = [ ...
|
|
28
|
+
id = [ ...subscriptInstances.keys() ].filter( k => _isNumeric( k ) ).length;
|
|
33
29
|
}
|
|
34
|
-
|
|
30
|
+
subscriptInstances.set( id, subscriptFunction );
|
|
35
31
|
return subscriptFunction;
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -43,7 +39,7 @@ export const Element = BaseElement => class extends SubscriptClass( BaseElement
|
|
|
43
39
|
|
|
44
40
|
static implementScript( script, element ) {
|
|
45
41
|
let source = ( script.textContent || '' ).trim();
|
|
46
|
-
return this.expose( element, SubscriptFunction.call( element, source ) );
|
|
42
|
+
return this.expose( element, SubscriptFunction.call( element, source, { compilerParams: this.compilerParams, runtimeParams: this.runtimeParams } ) );
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
/**
|
|
@@ -51,9 +47,9 @@ export const Element = BaseElement => class extends SubscriptClass( BaseElement
|
|
|
51
47
|
*/
|
|
52
48
|
static doConnectedCallback( instance ) {
|
|
53
49
|
if ( ( typeof WebQit === 'undefined' ) || !WebQit.Observer ) return;
|
|
54
|
-
const
|
|
50
|
+
const subscriptInstances = _internals( instance, 'oohtml', 'subscript', 'instances' );
|
|
55
51
|
const signals = ( mutations, evt, namespace = [] ) => {
|
|
56
|
-
|
|
52
|
+
subscriptInstances.forEach( api => api.thread( ...mutations.map( mu => namespace.concat( mu.path ) ) ) );
|
|
57
53
|
};
|
|
58
54
|
( this.subscriptParams.globalsAutoObserve || [] ).forEach( identifier => {
|
|
59
55
|
WebQit.Observer.observe( globalThis[ identifier ], mutations => signals( mutations, null, [ identifier ] ), {
|
|
@@ -100,8 +96,8 @@ export const Element = BaseElement => class extends SubscriptClass( BaseElement
|
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
get
|
|
104
|
-
return _internals( this, 'oohtml', '
|
|
99
|
+
get subscript() {
|
|
100
|
+
return _internals( this, 'oohtml', 'subscript', 'instances' );
|
|
105
101
|
}
|
|
106
102
|
|
|
107
103
|
}
|
package/src/subscript/index.js
CHANGED
|
@@ -12,12 +12,12 @@ import { config } from '../util.js';
|
|
|
12
12
|
*
|
|
13
13
|
* @param Object config
|
|
14
14
|
*/
|
|
15
|
-
export default function init( _config =
|
|
15
|
+
export default function init( _config = {} ) {
|
|
16
16
|
|
|
17
17
|
const WebQit = domInit.call( this );
|
|
18
|
-
if ( onDomReady ) {
|
|
18
|
+
if ( _config.onDomReady ) {
|
|
19
19
|
WebQit.DOM.ready( () => {
|
|
20
|
-
init.call( this, _config, false );
|
|
20
|
+
init.call( this, { ..._config, onDomReady: false } );
|
|
21
21
|
} );
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -27,27 +27,36 @@ export default function init( _config = null, onDomReady = false ) {
|
|
|
27
27
|
selectors: { script: 'script[type="subscript"]', },
|
|
28
28
|
api: { bind: 'bind', unbind: 'unbind', },
|
|
29
29
|
script: {},
|
|
30
|
-
}, _config );
|
|
30
|
+
}, _config.params );
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const ContextifiableElement = BaseElement => class extends Element( BaseElement ) {
|
|
33
|
+
static get compilerParams() {
|
|
34
|
+
return _config.compilerParams || {};
|
|
35
|
+
}
|
|
36
|
+
static get runtimeParams() {
|
|
37
|
+
return _config.runtimeParams || {};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const SubscriptElement = ContextifiableElement();
|
|
33
42
|
mutations.onPresent( _meta.get('selectors.script'), scriptElement => {
|
|
34
43
|
|
|
35
44
|
let ownerNode = scriptElement.parentNode;
|
|
36
45
|
if ( !ownerNode ) return;
|
|
37
|
-
let
|
|
38
|
-
if ( !
|
|
39
|
-
|
|
40
|
-
_internals( ownerNode, 'oohtml', 'subscript' ).set( '
|
|
46
|
+
let scriptTags = _internals( ownerNode, 'oohtml', 'subscript' ).get( 'script-tags' );
|
|
47
|
+
if ( !scriptTags ) {
|
|
48
|
+
scriptTags = new WeakSet;
|
|
49
|
+
_internals( ownerNode, 'oohtml', 'subscript' ).set( 'script-tags', scriptTags );
|
|
41
50
|
}
|
|
42
|
-
if (
|
|
51
|
+
if ( scriptTags.has( scriptElement ) ) return;
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
SubscriptElement.implementScript( scriptElement, ownerNode )();
|
|
54
|
+
SubscriptElement.doConnectedCallback( ownerNode );
|
|
55
|
+
scriptTags.add( scriptElement );
|
|
47
56
|
|
|
48
57
|
let mo = mutations.onRemoved( ownerNode, () => {
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
SubscriptElement.doDisconnectedCallback( ownerNode );
|
|
59
|
+
scriptTags.delete( scriptElement );
|
|
51
60
|
mo.disconnect();
|
|
52
61
|
}, { ignoreTransients: true });
|
|
53
62
|
|
|
@@ -56,6 +65,6 @@ export default function init( _config = null, onDomReady = false ) {
|
|
|
56
65
|
if (!WebQit.OOHTML) {
|
|
57
66
|
WebQit.OOHTML = {};
|
|
58
67
|
}
|
|
59
|
-
WebQit.OOHTML.SubscriptElement =
|
|
68
|
+
WebQit.OOHTML.SubscriptElement = ContextifiableElement;
|
|
60
69
|
|
|
61
70
|
}
|