@webqit/oohtml 2.1.45 → 2.1.46
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/README.md +1 -1
- package/dist/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +6 -6
- package/dist/main.js.map +2 -2
- package/dist/namespace-api.js +1 -1
- package/dist/namespace-api.js.map +2 -2
- package/dist/scoped-js.js +5 -5
- package/dist/scoped-js.js.map +2 -2
- package/package.json +2 -2
- package/src/html-imports/_HTMLExportsManager.js +1 -1
- package/src/html-imports/_HTMLImportsProvider.js +2 -2
- package/src/scoped-js/index.js +2 -2
- package/test/modules.test.js +7 -7
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"wicg-proposal"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://webqit.io/tooling/oohtml",
|
|
17
|
-
"version": "2.1.
|
|
17
|
+
"version": "2.1.46",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"postpublish": "git push && git push --tags"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@webqit/observer": "^2.1.
|
|
41
|
+
"@webqit/observer": "^2.1.5",
|
|
42
42
|
"@webqit/realdom": "^2.1.12",
|
|
43
43
|
"@webqit/subscript": "^2.1.41",
|
|
44
44
|
"@webqit/util": "^0.8.11"
|
|
@@ -175,7 +175,7 @@ export default class _HTMLExportsManager {
|
|
|
175
175
|
const realtimes = [];
|
|
176
176
|
const parentExportsObj = getModulesObject( this.parent );
|
|
177
177
|
if ( extendedId ) {
|
|
178
|
-
realtimes.push( Observer.
|
|
178
|
+
realtimes.push( Observer.reduce( parentExportsObj, [ extendedId, this.config.template.api.modules, Infinity ], Observer.get, handleInherited, { live: true } ) );
|
|
179
179
|
}
|
|
180
180
|
if ( ( inheritedIds = inheritedIds.split( ' ' ).map( id => id.trim() ).filter( x => x ) ).length ) {
|
|
181
181
|
realtimes.push( Observer.get( parentExportsObj, inheritedIds, handleInherited, { live: true } ) );
|
|
@@ -56,13 +56,13 @@ export default class _HTMLImportsProvider extends HTMLContextProvider {
|
|
|
56
56
|
// We'll now fulfill request
|
|
57
57
|
const options = { live: event.request.live, descripted: true };
|
|
58
58
|
// Find a way to resolve request against two sources
|
|
59
|
-
event.request.controller = Observer.
|
|
59
|
+
event.request.controller = Observer.reduce( this.localModules, path, Observer.get, ( result, { signal } = {} ) => {
|
|
60
60
|
const _result = Array.isArray( result ) ? result : result.value;
|
|
61
61
|
const _isValidResult = Array.isArray( result ) ? result.length : result.value;
|
|
62
62
|
if ( !_isValidResult && this.host.isConnected === false ) return; // Subtree is being disposed
|
|
63
63
|
if ( _isValidResult || !this.contextModules ) return event.respondWith( _result );
|
|
64
64
|
// This superModules binding is automatically aborted by the injected control.signal; see below
|
|
65
|
-
return Observer.
|
|
65
|
+
return Observer.reduce( this.contextModules, path, Observer.get, result => {
|
|
66
66
|
return event.respondWith( Array.isArray( result ) ? result : result.value );
|
|
67
67
|
}, { signal, ...options } );
|
|
68
68
|
}, options );
|
package/src/scoped-js/index.js
CHANGED
|
@@ -56,11 +56,11 @@ export function execute( compiledScript, thisContext, script ) {
|
|
|
56
56
|
properties.processes = properties.dependencies.map( path => {
|
|
57
57
|
if ( _isTypeObject( _env[ path[ 0 ] ] ) ) {
|
|
58
58
|
if ( path.length === 1 ) return;
|
|
59
|
-
return Observer.
|
|
59
|
+
return Observer.reduce( _env[ path[ 0 ] ], path.slice( 1 ), Observer.observe, record_s => {
|
|
60
60
|
script.rerender( ...getPaths( [ path[ 0 ] ], record_s ) );
|
|
61
61
|
} );
|
|
62
62
|
}
|
|
63
|
-
return Observer.
|
|
63
|
+
return Observer.reduce( globalThis, path, Observer.observe, record_s => {
|
|
64
64
|
script.rerender( ...getPaths( [], record_s ) );
|
|
65
65
|
} );
|
|
66
66
|
} );
|
package/test/modules.test.js
CHANGED
|
@@ -57,14 +57,14 @@ describe(`HTML Modules`, function() {
|
|
|
57
57
|
document.import( 'temp0', temp0 => {
|
|
58
58
|
expect( temp0 ).to.have.property( 'modules' );
|
|
59
59
|
expect( temp0.modules[ '#' ] ).to.have.length( 2 );
|
|
60
|
-
const temp2 = Observer.
|
|
60
|
+
const temp2 = Observer.reduce( temp0.modules, getQueryPath( 'temp2' ), Observer.get );
|
|
61
61
|
expect( temp2 ).to.have.property( 'modules' );
|
|
62
62
|
// -------
|
|
63
|
-
const temp1Inherited = Observer.
|
|
63
|
+
const temp1Inherited = Observer.reduce( temp0.modules, getQueryPath( 'temp2/temp1' ), Observer.get );
|
|
64
64
|
expect( temp1Inherited ).to.have.property( 'modules' );
|
|
65
65
|
// -------
|
|
66
66
|
const temp3Observed = [];
|
|
67
|
-
Observer.
|
|
67
|
+
Observer.reduce( temp0.modules, getQueryPath( 'temp2/temp3' ), Observer.observe, record => {
|
|
68
68
|
temp3Observed.push( record.value );
|
|
69
69
|
} );
|
|
70
70
|
// -------
|
|
@@ -75,7 +75,7 @@ describe(`HTML Modules`, function() {
|
|
|
75
75
|
expect( temp3Observed ).to.be.an( 'array' ).with.length( 1 );
|
|
76
76
|
expect( temp3Observed[ 0 ] ).to.have.property( 'modules' );
|
|
77
77
|
// -------
|
|
78
|
-
const temp3Inherited = Observer.
|
|
78
|
+
const temp3Inherited = Observer.reduce( temp0.modules, getQueryPath( 'temp2/temp3' ), Observer.get );
|
|
79
79
|
expect( temp3Inherited ).to.have.property( 'modules' );
|
|
80
80
|
// -------
|
|
81
81
|
} );
|
|
@@ -117,15 +117,15 @@ describe(`HTML Modules`, function() {
|
|
|
117
117
|
expect( temp0 ).to.have.property( 'modules' );
|
|
118
118
|
await delay( 2100 );
|
|
119
119
|
// temp1 shouldn't have been automatically loaded still
|
|
120
|
-
const hasTemp1 = Observer.
|
|
120
|
+
const hasTemp1 = Observer.reduce( temp0.modules, getQueryPath( 'temp1' ), Observer.has );
|
|
121
121
|
expect( hasTemp1 ).to.be.false;
|
|
122
122
|
// Try access temp1 to trigger loading and await
|
|
123
|
-
const _temp1 = await Observer.
|
|
123
|
+
const _temp1 = await Observer.reduce( temp0.modules, getQueryPath( 'temp1' ), Observer.get );
|
|
124
124
|
expect( _temp1 ).to.have.property( 'modules' );
|
|
125
125
|
// -------
|
|
126
126
|
// Receive updates
|
|
127
127
|
const temp3Observed = [];
|
|
128
|
-
Observer.
|
|
128
|
+
Observer.reduce( temp0.modules, getQueryPath( 'temp1/temp2/temp3' ), Observer.observe, ( record, lifecycle ) => {
|
|
129
129
|
temp3Observed.push( record.value );
|
|
130
130
|
} );
|
|
131
131
|
await delay( 2100 );
|