@webqit/oohtml 4.3.6 → 4.3.8

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/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.6",
17
+ "version": "4.3.8",
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.25",
42
+ "@webqit/quantum-js": "^4.5.26",
43
43
  "@webqit/realdom": "^2.1.32",
44
44
  "@webqit/util": "^0.8.11"
45
45
  },
@@ -31,7 +31,7 @@ export default class DOMContexts {
31
31
  /**
32
32
  * @Symbol.iterator
33
33
  */
34
- get [ Symbol.iterator ] () { return this[ '#' ].contexts[ Symbol.iterator ]; }
34
+ [ Symbol.iterator ] () { return this[ '#' ].contexts[ Symbol.iterator ](); }
35
35
 
36
36
  /**
37
37
  * @length
@@ -1,7 +1,4 @@
1
-
2
- /**
3
- * @imports
4
- */
1
+ import { resolveParams } from '@webqit/quantum-js/params';
5
2
  import { xpathQuery } from '@webqit/realdom/src/realtime/Util.js';
6
3
  import { _, _init, _splitOuter } from '../util.js';
7
4
 
@@ -16,6 +13,7 @@ export default function init( $config = {} ) {
16
13
  const { config, window } = _init.call( this, 'data-binding', $config, {
17
14
  attr: { render: 'render', itemIndex: 'data-key' },
18
15
  tokens: { nodeType: 'processing-instruction', tagStart: '?{', tagEnd: '}?', stateStart: '; [=', stateEnd: ']' },
16
+ advanced: resolveParams({ runtimeParams: { spec: { handler: e => {} } } }),
19
17
  } );
20
18
  ( { CONTEXT_API: config.CONTEXT_API, BINDINGS_API: config.BINDINGS_API, HTML_IMPORTS: config.HTML_IMPORTS } = window.webqit.oohtml.configs );
21
19
  config.attrSelector = `[${ window.CSS.escape( config.attr.render ) }]`;
@@ -46,11 +44,15 @@ function realtime( config ) {
46
44
  */
47
45
  realdom.realtime( window.document ).query( config.attrSelector, record => {
48
46
  cleanup.call( this, ...record.exits );
49
- mountInlineBindings.call( window, config, ...record.entrants );
47
+ setTimeout(() => {
48
+ mountInlineBindings.call( window, config, ...record.entrants );
49
+ }, 0);
50
50
  }, { id: 'data-binding:attr', live: true, subtree: 'cross-roots', timing: 'sync', eventDetails: true, staticSensitivity: true } );
51
51
  realdom.realtime( window.document ).query( `(${ config.discreteBindingsSelector })`, record => {
52
- cleanup.call( this, ...record.exits );
53
- mountDiscreteBindings.call( window, config, ...record.entrants );
52
+ setTimeout(() => {
53
+ cleanup.call( this, ...record.exits );
54
+ mountDiscreteBindings.call( window, config, ...record.entrants );
55
+ }, 0);
54
56
  }, { id: 'data-binding:descrete', live: true, subtree: 'cross-roots', timing: 'sync' } );
55
57
  }
56
58
 
@@ -61,14 +63,14 @@ function createDynamicScope( config, root ) {
61
63
  scope[ '$exec__' ] = ( target, prop, ...args ) => {
62
64
  const exec = () => {
63
65
  try { target[ prop ]( ...args ); }
64
- catch( e ) { console.error( `Error executing "${ prop }": ${ e.message } at ${ e.cause }` ); }
66
+ catch( e ) { throw new Error( `Error executing "${ prop }()": ${ e.message } at ${ e.cause }` ); }
65
67
  };
66
68
  exec();
67
69
  };
68
70
  scope[ '$assign__' ] = ( target, prop, val ) => {
69
71
  const exec = () => {
70
72
  try { target[ prop ] = val; }
71
- catch( e ) { console.error( `${ e.message } at ${ e.cause }` ); }
73
+ catch( e ) { throw new Error( `Error executing "${ prop } = ${ val }": ${ e.message } at ${ e.cause }` ); }
72
74
  };
73
75
  exec();
74
76
  };
@@ -156,7 +158,8 @@ function compileDiscreteBindings( config, str ) {
156
158
  source += `$assign__(this, 'nodeValue', content);`;
157
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 }"); }`;
158
160
  const { webqit: { QuantumModule } } = this;
159
- const compiled = new QuantumModule( source );
161
+ const { parserParams, compilerParams, runtimeParams } = config.advanced;
162
+ const compiled = new QuantumModule( source, { parserParams, compilerParams, runtimeParams } );
160
163
  discreteParseCache.set( str, compiled );
161
164
  return compiled;
162
165
  }
@@ -264,7 +267,8 @@ function compileInlineBindings( config, str ) {
264
267
  if ( str.trim() ) throw new Error( `Invalid binding: ${ str }.` );
265
268
  } ).join( `\n` );
266
269
  const { webqit: { QuantumModule } } = this;
267
- const compiled = new QuantumModule( source );
270
+ const { parserParams, compilerParams, runtimeParams } = config.advanced;
271
+ const compiled = new QuantumModule( source, { parserParams, compilerParams, runtimeParams } );
268
272
  inlineParseCache.set( str, compiled );
269
273
  return compiled;
270
274
  }
@@ -17,7 +17,7 @@ export default function init({ advanced = {}, ...$config }) {
17
17
  advanced: resolveParams(advanced),
18
18
  } );
19
19
  const customTypes = Array.isArray( config.script.mimeTypes ) ? config.script.mimeTypes : config.script.mimeTypes.split( '|' ).filter( t => t );
20
- config.scriptSelector = customTypes.map( t => `script[type="${ window.CSS.escape( t ) }"]`).concat(`script:not([type])`).join( ',' );
20
+ config.scriptSelector = customTypes.map( t => `script[type="${ window.CSS.escape( t ) }"]:not([oohtmlignore])` ).concat(`script:not([type])`).join( ',' );
21
21
  window.webqit.oohtml.Script = {
22
22
  compileCache: [ new Map, new Map, ],
23
23
  execute: execute.bind( window, config ),
@@ -126,7 +126,7 @@ function compileScript( config, script ) {
126
126
  compiledScript = new ( script.type === 'module' ? QuantumModule : ( QuantumScript || AsyncQuantumScript ) )( textContent, {
127
127
  exportNamespace: `#${ script.id }`,
128
128
  fileName: `${ window.document.url?.split( '#' )?.[ 0 ] || '' }#${ script.id }`,
129
- parserParams: { ...parserParams, quantumMode: script.quantum },
129
+ parserParams: { ...parserParams, executionMode: script.quantum && 'QuantumProgram' || 'RegularProgram' },
130
130
  compilerParams,
131
131
  runtimeParams,
132
132
  } );