@webqit/oohtml 4.4.0 → 4.5.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/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 +5 -5
- 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 +15 -15
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +10 -10
- 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 +1 -1
- package/dist/scoped-css.js.map +2 -2
- package/package.json +2 -2
- package/src/bindings-api/index.js +1 -1
- package/src/context-api/DOMContexts.js +1 -1
- package/src/data-binding/index.js +13 -13
- package/src/html-imports/HTMLImportsContext.js +1 -1
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.
|
|
17
|
+
"version": "4.5.1",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"postpublish": "git push && git push --tags"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@webqit/quantum-js": "^4.5.
|
|
42
|
+
"@webqit/quantum-js": "^4.5.31",
|
|
43
43
|
"@webqit/realdom": "^2.1.34",
|
|
44
44
|
"@webqit/util": "^0.8.16"
|
|
45
45
|
},
|
|
@@ -99,7 +99,7 @@ function applyBindings( config, target, bindings, { merge, diff, publish, namesp
|
|
|
99
99
|
const window = this, { webqit: { Observer } } = window;
|
|
100
100
|
const bindingsObj = getBindings.call( this, config, target );
|
|
101
101
|
const $params = { diff, namespace, detail: { publish } };
|
|
102
|
-
const exitingKeys = merge ? [] :
|
|
102
|
+
const exitingKeys = merge ? [] : Object.keys( bindingsObj ).filter( key => !( key in bindings ) );
|
|
103
103
|
return Observer.batch( bindingsObj, () => {
|
|
104
104
|
if ( exitingKeys.length ) { Observer.deleteProperties( bindingsObj, exitingKeys, $params ); }
|
|
105
105
|
return Observer.set( bindingsObj, bindings, $params );
|
|
@@ -6,7 +6,7 @@ import _DOMContextRequestEvent from './_DOMContextRequestEvent.js';
|
|
|
6
6
|
import DOMContextResponse from './DOMContextResponse.js';
|
|
7
7
|
import DOMContext from './DOMContext.js';
|
|
8
8
|
import DuplicateContextError from './DuplicateContextError.js';
|
|
9
|
-
import {
|
|
9
|
+
import { _wq } from '../util.js';
|
|
10
10
|
|
|
11
11
|
const waitListMappings = new Map;
|
|
12
12
|
export default class DOMContexts {
|
|
@@ -155,8 +155,8 @@ const discreteParseCache = new Map;
|
|
|
155
155
|
function compileDiscreteBindings( config, str ) {
|
|
156
156
|
if ( discreteParseCache.has( str ) ) return discreteParseCache.get( str );
|
|
157
157
|
let source = `let content = ((${ str }) ?? '') + '';`;
|
|
158
|
-
source += `$
|
|
159
|
-
source += `if ( this.$oohtml_internal_databinding_anchorNode ) { $
|
|
158
|
+
source += `$assign__(this, 'nodeValue', content);`;
|
|
159
|
+
source += `if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${ config.tokens.tagStart }${ escDouble( str ) }${ config.tokens.stateStart }" + content.length + "${ config.tokens.stateEnd } ${ config.tokens.tagEnd }"); }`;
|
|
160
160
|
const { webqit: { QuantumModule } } = this;
|
|
161
161
|
const { parserParams, compilerParams, runtimeParams } = config.advanced;
|
|
162
162
|
const compiled = new QuantumModule( source, { parserParams, compilerParams, runtimeParams } );
|
|
@@ -189,22 +189,22 @@ function compileInlineBindings( config, str ) {
|
|
|
189
189
|
const arg = `(${ right })`, $arg = `(${ arg } ?? '')`;
|
|
190
190
|
// CSS
|
|
191
191
|
if ( directive === '&' ) {
|
|
192
|
-
if ( param.startsWith( '--' ) ) return `$
|
|
193
|
-
return `$
|
|
192
|
+
if ( param.startsWith( '--' ) ) return `$exec__(this.style, 'setProperty', "${ escDouble( param ) }", ${ $arg });`;
|
|
193
|
+
return `$assign__(this.style, "${ escDouble( param ) }", ${ $arg });`;
|
|
194
194
|
}
|
|
195
195
|
// Class list
|
|
196
|
-
if ( directive === '%' ) return `$
|
|
196
|
+
if ( directive === '%' ) return `$exec__(this.classList, 'toggle', "${ escDouble( param ) }", !!${ arg });`;
|
|
197
197
|
// Attribute
|
|
198
198
|
if ( directive === '~' ) {
|
|
199
|
-
if ( param.startsWith( '?' ) ) return `$
|
|
200
|
-
return `$
|
|
199
|
+
if ( param.startsWith( '?' ) ) return `$exec__(this, 'toggleAttribute', "${ escDouble( param.substring( 1 ).trim() ) }", !!${ arg });`;
|
|
200
|
+
return `$exec__(this, 'setAttribute', "${ escDouble( param ) }", ${ $arg });`;
|
|
201
201
|
}
|
|
202
202
|
// Structure
|
|
203
203
|
if ( directive === '#' ) {
|
|
204
204
|
if ( validation[ param ] ) throw new Error( `Duplicate binding: ${ left }.` );
|
|
205
205
|
validation[ param ] = true;
|
|
206
|
-
if ( param === 'text' ) return `$
|
|
207
|
-
if ( param === 'html' ) return `$
|
|
206
|
+
if ( param === 'text' ) return `$assign__(this, 'textContent', ${ $arg });`;
|
|
207
|
+
if ( param === 'html' ) return `$assign__(this, 'innerHTML', ${ $arg });`;
|
|
208
208
|
if ( param === 'items' ) {
|
|
209
209
|
const [ iterationSpec, importSpec ] = _splitOuter( right, '/' );
|
|
210
210
|
if ( !importSpec ) throw new Error( `Invalid ${ directive }items spec: ${ str }; no import specifier.` );
|
|
@@ -235,12 +235,12 @@ function compileInlineBindings( config, str ) {
|
|
|
235
235
|
let $itemNode__ = $existing__.get( $key___ );
|
|
236
236
|
if ( $itemNode__ ) {
|
|
237
237
|
$existing__.delete( $key___ );
|
|
238
|
-
$
|
|
238
|
+
$exec__($itemNode__, '${ config.BINDINGS_API.api.bind }', $itemBinding__ );
|
|
239
239
|
} else {
|
|
240
240
|
$itemNode__ = ( Array.isArray( $import__.value ) ? $import__.value[ 0 ] : ( $import__.value instanceof window.HTMLTemplateElement ? $import__.value.content.firstElementChild : $import__.value ) ).cloneNode( true );
|
|
241
241
|
$itemNode__.setAttribute( "${ config.attr.itemIndex }", $key___ );
|
|
242
|
-
$
|
|
243
|
-
$
|
|
242
|
+
$exec__($itemNode__, '${ config.BINDINGS_API.api.bind }', $itemBinding__ );
|
|
243
|
+
$exec__(this, 'appendChild', $itemNode__ );
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
if ( ${ kind === 'in' ? `!( ${ production[ 0 ] } in $iteratee__ )` : `typeof ${ production[ 0 ] } === 'undefined'` } ) { $itemNode__.remove(); }
|
|
@@ -262,7 +262,7 @@ function compileInlineBindings( config, str ) {
|
|
|
262
262
|
}
|
|
263
263
|
// Functions
|
|
264
264
|
if ( directive === '$' ) {
|
|
265
|
-
return `$
|
|
265
|
+
return `$exec__(this, '${ param }', ${ arg });`;
|
|
266
266
|
}
|
|
267
267
|
if ( str.trim() ) throw new Error( `Invalid binding: ${ str }.` );
|
|
268
268
|
} ).join( `\n` );
|