@webqit/oohtml 3.1.12 → 3.1.13
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.map +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 +7 -6
- package/dist/main.lite.js.map +2 -2
- package/package.json +2 -2
- package/src/bindings-api/index.js +1 -1
- package/src/html-imports/HTMLImportsContext.js +3 -3
- package/src/html-imports/HTMLModule.js +5 -5
- package/src/html-imports/index.js +4 -4
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"wicg-proposal"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://webqit.io/tooling/oohtml",
|
|
17
|
-
"version": "3.1.
|
|
17
|
+
"version": "3.1.13",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"postpublish": "git push && git push --tags"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@webqit/quantum-js": "^4.2.
|
|
38
|
+
"@webqit/quantum-js": "^4.2.11",
|
|
39
39
|
"@webqit/realdom": "^2.1.22",
|
|
40
40
|
"@webqit/util": "^0.8.11"
|
|
41
41
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
5
|
import DOMContext from '../context-api/DOMContext.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getDefs } from './index.js';
|
|
7
7
|
import { _, env } from '../util.js';
|
|
8
8
|
|
|
9
9
|
export default class HTMLImportsContext extends DOMContext {
|
|
@@ -32,7 +32,7 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
32
32
|
/**
|
|
33
33
|
* @localModules
|
|
34
34
|
*/
|
|
35
|
-
get localModules() { return
|
|
35
|
+
get localModules() { return getDefs( this.host ); }
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @handle()
|
|
@@ -102,7 +102,7 @@ export default class HTMLImportsContext extends DOMContext {
|
|
|
102
102
|
// This superModules contextrequest is automatically aborted by the injected signal below
|
|
103
103
|
const request = { ...this.constructor.createRequest( record.value.trim() ), live: true, signal };
|
|
104
104
|
this.host.parentNode[ this.configs.CONTEXT_API.api.contexts ].request( request, response => {
|
|
105
|
-
this.contextModules = !( response && Object.getPrototypeOf( response ) ) ? response :
|
|
105
|
+
this.contextModules = !( response && Object.getPrototypeOf( response ) ) ? response : getDefs( response );
|
|
106
106
|
update();
|
|
107
107
|
} );
|
|
108
108
|
}, { live: true, timing: 'sync', lifecycleSignals: true } );
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
5
|
import { _isNumeric } from '@webqit/util/js/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getDefs } from './index.js';
|
|
7
7
|
import { _, env } from '../util.js';
|
|
8
8
|
|
|
9
9
|
export default class HTMLModule {
|
|
@@ -26,7 +26,7 @@ export default class HTMLModule {
|
|
|
26
26
|
this.config = configs.HTML_IMPORTS;
|
|
27
27
|
this.parent = parent;
|
|
28
28
|
this.level = level;
|
|
29
|
-
this.defs =
|
|
29
|
+
this.defs = getDefs( this.host );
|
|
30
30
|
this.defId = ( this.host.getAttribute( this.config.attr.def ) || '' ).trim();
|
|
31
31
|
this.validateDefId( this.defId );
|
|
32
32
|
// ----------
|
|
@@ -175,12 +175,12 @@ export default class HTMLModule {
|
|
|
175
175
|
} );
|
|
176
176
|
};
|
|
177
177
|
const realtimes = [];
|
|
178
|
-
const
|
|
178
|
+
const parentDefsObj = getDefs( this.parent );
|
|
179
179
|
if ( extendedId ) {
|
|
180
|
-
realtimes.push( Observer.reduce(
|
|
180
|
+
realtimes.push( Observer.reduce( parentDefsObj, [ extendedId, this.config.api.defs, Infinity ], Observer.get, handleInherited, { live: true } ) );
|
|
181
181
|
}
|
|
182
182
|
if ( ( inheritedIds = inheritedIds.split( ' ' ).map( id => id.trim() ).filter( x => x ) ).length ) {
|
|
183
|
-
realtimes.push( Observer.get(
|
|
183
|
+
realtimes.push( Observer.get( parentDefsObj, inheritedIds, handleInherited, { live: true } ) );
|
|
184
184
|
}
|
|
185
185
|
return realtimes;
|
|
186
186
|
}
|
|
@@ -44,7 +44,7 @@ export default function init( $config = {} ) {
|
|
|
44
44
|
*
|
|
45
45
|
* @return Object
|
|
46
46
|
*/
|
|
47
|
-
export function
|
|
47
|
+
export function getDefs( node, autoCreate = true ) {
|
|
48
48
|
if ( !_( node ).has( 'defs' ) && autoCreate ) {
|
|
49
49
|
const defs = Object.create( null );
|
|
50
50
|
_( node ).set( 'defs', defs );
|
|
@@ -68,7 +68,7 @@ function exposeAPIs( config ) {
|
|
|
68
68
|
if ( config.api.import in window.HTMLElement.prototype ) { throw new Error( `The "HTMLElement" class already has a "${ config.api.import }" property!` ); }
|
|
69
69
|
// Definitions
|
|
70
70
|
Object.defineProperty( window.HTMLTemplateElement.prototype, config.api.defs, { get: function() {
|
|
71
|
-
return
|
|
71
|
+
return getDefs( this );
|
|
72
72
|
} } );
|
|
73
73
|
Object.defineProperty( window.HTMLTemplateElement.prototype, config.api.def, { get: function() {
|
|
74
74
|
return this.getAttribute( config.attr.def );
|
|
@@ -127,7 +127,7 @@ function realtime( config ) {
|
|
|
127
127
|
Object.defineProperty( entry, 'scoped', { value: entry.hasAttribute( 'scoped' ) } );
|
|
128
128
|
const htmlModule = HTMLModule.instance( entry );
|
|
129
129
|
htmlModule.ownerContext = entry.scoped ? record.target : window.document;
|
|
130
|
-
const ownerContextModulesObj =
|
|
130
|
+
const ownerContextModulesObj = getDefs( htmlModule.ownerContext );
|
|
131
131
|
if ( htmlModule.defId ) { Observer.set( ownerContextModulesObj, htmlModule.defId, entry ); }
|
|
132
132
|
// The ownerContext's defs - ownerContextModulesObj - has to be populated
|
|
133
133
|
// Before attaching a context instance to it, to give the just created context something to use for
|
|
@@ -140,7 +140,7 @@ function realtime( config ) {
|
|
|
140
140
|
record.exits.forEach( entry => {
|
|
141
141
|
if ( entry.matches( config.templateSelector ) ) {
|
|
142
142
|
const htmlModule = HTMLModule.instance( entry );
|
|
143
|
-
const ownerContextModulesObj =
|
|
143
|
+
const ownerContextModulesObj = getDefs( htmlModule.ownerContext );
|
|
144
144
|
if ( htmlModule.defId ) { Observer.deleteProperty( ownerContextModulesObj, htmlModule.defId ); }
|
|
145
145
|
detachImportsContext( htmlModule.ownerContext );
|
|
146
146
|
} else {
|