@webqit/oohtml 4.3.9 → 4.3.10
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/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +2 -2
- package/dist/context-api.js +1 -1
- package/dist/context-api.js.map +2 -2
- package/dist/data-binding.js +1 -1
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +10 -10
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +6 -6
- package/dist/main.lite.js.map +2 -2
- package/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.map +2 -2
- package/dist/scoped-css.js +3 -3
- package/dist/scoped-css.js.map +2 -2
- package/dist/scoped-js.js +1 -1
- package/dist/scoped-js.js.map +2 -2
- package/package.json +2 -2
- package/src/html-imports/HTMLImportsContext.js +3 -66
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"wicg-proposal"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://webqit.io/tooling/oohtml",
|
|
17
|
-
"version": "4.3.
|
|
17
|
+
"version": "4.3.10",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@webqit/quantum-js": "^4.5.26",
|
|
43
|
-
"@webqit/realdom": "^2.1.
|
|
43
|
+
"@webqit/realdom": "^2.1.33",
|
|
44
44
|
"@webqit/util": "^0.8.11"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -36,69 +36,6 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
36
36
|
get inheritedModules() { return this.#inheritedModules; }
|
|
37
37
|
#inheritedModules = {};
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @handle()
|
|
42
|
-
*/
|
|
43
|
-
handle__( event ) {
|
|
44
|
-
const { window: { webqit: { Observer } } } = env;
|
|
45
|
-
// Any existing event.meta.controller? Abort!
|
|
46
|
-
event.meta.controller?.abort();
|
|
47
|
-
|
|
48
|
-
// Parse and translate detail
|
|
49
|
-
if ( ( event.detail || '' ).trim() === '/' ) return event.respondWith( this.localModules );
|
|
50
|
-
let path = ( event.detail || '' ).split( /\/|(?<=\w)(?=#)/g ).map( x => x.trim() ).filter( x => x );
|
|
51
|
-
if ( !path.length ) return event.respondWith();
|
|
52
|
-
path = path.join( `/${ this.configs.HTML_IMPORTS.api.defs }/` )?.split( '/' ) || [];
|
|
53
|
-
|
|
54
|
-
// We'll now fulfill request
|
|
55
|
-
const options = { live: event.live, signal: event.signal, descripted: true };
|
|
56
|
-
// Find a way to resolve request against two sources
|
|
57
|
-
event.meta.controller = Observer.reduce( this.localModules, path, Observer.get, ( result, { signal } = {} ) => {
|
|
58
|
-
const _result = Array.isArray( result ) ? result : result.value;
|
|
59
|
-
const _isValidLocalResult = Array.isArray( result ) ? result.length : result.value;
|
|
60
|
-
if ( !_isValidLocalResult && this.host.isConnected === false ) return; // Subtree is being disposed
|
|
61
|
-
if ( _isValidLocalResult || !this.#inheritedModules ) {
|
|
62
|
-
event._isValidLocalResult = _isValidLocalResult;
|
|
63
|
-
return event.respondWith( _result );
|
|
64
|
-
}
|
|
65
|
-
// This superModules binding is automatically aborted by the injected control.signal; see below
|
|
66
|
-
return Observer.reduce( this.#inheritedModules, path, Observer.get, result => {
|
|
67
|
-
event._currentSource = 'context';
|
|
68
|
-
return event.respondWith( Array.isArray( result ) ? result : result.value );
|
|
69
|
-
}, { ...options, signal } );
|
|
70
|
-
}, { lifecycleSignals: true, ...options } );
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @startRealtime()
|
|
75
|
-
*/
|
|
76
|
-
realtimeSources__( host ) {
|
|
77
|
-
this.host = host;
|
|
78
|
-
// ----------------
|
|
79
|
-
const update = () => {
|
|
80
|
-
for ( const subscriptionEvent of this.subscriptions ) {
|
|
81
|
-
if ( subscriptionEvent._isValidLocalResult ) continue;
|
|
82
|
-
this.handle( subscriptionEvent );
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
// ----------------
|
|
86
|
-
const $config = this.configs.HTML_IMPORTS;
|
|
87
|
-
if ( !this.host.matches || !$config.attr.importscontext ) return;
|
|
88
|
-
const realdom = this.host.ownerDocument.defaultView.webqit.realdom;
|
|
89
|
-
let prevRef;
|
|
90
|
-
this.controller3 = realdom.realtime( this.host ).attr( $config.attr.importscontext, ( record, { signal } ) => {
|
|
91
|
-
if (record.value === prevRef) return;
|
|
92
|
-
prevRef = record.value;
|
|
93
|
-
// This superModules contextrequest is automatically aborted by the injected signal below
|
|
94
|
-
const request = { ...this.constructor.createRequest( record.value?.trim() ), live: true, signal, diff: true };
|
|
95
|
-
this.host.parentNode[ this.configs.CONTEXT_API.api.contexts ].request( request, response => {
|
|
96
|
-
this.#inheritedModules = !( response && Object.getPrototypeOf( response ) ) ? response : getDefs( response );
|
|
97
|
-
update();
|
|
98
|
-
} );
|
|
99
|
-
}, { live: true, timing: 'sync', lifecycleSignals: true } );
|
|
100
|
-
}
|
|
101
|
-
|
|
102
39
|
/**
|
|
103
40
|
* @handle()
|
|
104
41
|
*/
|
|
@@ -139,7 +76,7 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
139
76
|
const { window: { webqit: { Observer } } } = env;
|
|
140
77
|
// ----------------
|
|
141
78
|
// Observe local
|
|
142
|
-
this.#modules =
|
|
79
|
+
this.#modules = { ...this.localModules };
|
|
143
80
|
this.#controller1?.abort();
|
|
144
81
|
this.#controller1 = Observer.observe( this.localModules, ( mutations ) => {
|
|
145
82
|
for ( const m of mutations ) {
|
|
@@ -157,7 +94,7 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
157
94
|
const realdom = this.host.ownerDocument.defaultView.webqit.realdom;
|
|
158
95
|
let prevRef;
|
|
159
96
|
this.#controller2?.disconnect();
|
|
160
|
-
this.#controller2 = realdom.realtime( this.host ).attr( $config.attr.importscontext, ( record, { signal } ) => {
|
|
97
|
+
this.#controller2 = realdom.realtime( this.host ).attr( $config.attr.importscontext, ( record, { signal } ) => {
|
|
161
98
|
const moduleRef = ( record.value || '' ).trim();
|
|
162
99
|
if ( moduleRef === prevRef ) return;
|
|
163
100
|
prevRef = moduleRef;
|
|
@@ -176,7 +113,7 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
176
113
|
}
|
|
177
114
|
}
|
|
178
115
|
} );
|
|
179
|
-
}, { live: true, timing: 'sync', lifecycleSignals: true } );
|
|
116
|
+
}, { live: true, timing: 'sync', oldValue: true, lifecycleSignals: true } );
|
|
180
117
|
}
|
|
181
118
|
// ----------------
|
|
182
119
|
return super.initialize( host );
|