@webqit/oohtml 4.3.5 → 4.3.7

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.5",
17
+ "version": "4.3.7",
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.11",
42
+ "@webqit/quantum-js": "^4.5.26",
43
43
  "@webqit/realdom": "^2.1.32",
44
44
  "@webqit/util": "^0.8.11"
45
45
  },
@@ -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 ) }]`;
@@ -61,14 +59,14 @@ function createDynamicScope( config, root ) {
61
59
  scope[ '$exec__' ] = ( target, prop, ...args ) => {
62
60
  const exec = () => {
63
61
  try { target[ prop ]( ...args ); }
64
- catch( e ) { console.error( `Error executing "${ prop }": ${ e.message } at ${ e.cause }` ); }
62
+ catch( e ) { throw new Error( `Error executing "${ prop }()": ${ e.message } at ${ e.cause }` ); }
65
63
  };
66
64
  exec();
67
65
  };
68
66
  scope[ '$assign__' ] = ( target, prop, val ) => {
69
67
  const exec = () => {
70
68
  try { target[ prop ] = val; }
71
- catch( e ) { console.error( `${ e.message } at ${ e.cause }` ); }
69
+ catch( e ) { throw new Error( `Error executing "${ prop } = ${ val }": ${ e.message } at ${ e.cause }` ); }
72
70
  };
73
71
  exec();
74
72
  };
@@ -156,7 +154,8 @@ function compileDiscreteBindings( config, str ) {
156
154
  source += `$assign__(this, 'nodeValue', content);`;
157
155
  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
156
  const { webqit: { QuantumModule } } = this;
159
- const compiled = new QuantumModule( source );
157
+ const { parserParams, compilerParams, runtimeParams } = config.advanced;
158
+ const compiled = new QuantumModule( source, { parserParams, compilerParams, runtimeParams } );
160
159
  discreteParseCache.set( str, compiled );
161
160
  return compiled;
162
161
  }
@@ -264,7 +263,8 @@ function compileInlineBindings( config, str ) {
264
263
  if ( str.trim() ) throw new Error( `Invalid binding: ${ str }.` );
265
264
  } ).join( `\n` );
266
265
  const { webqit: { QuantumModule } } = this;
267
- const compiled = new QuantumModule( source );
266
+ const { parserParams, compilerParams, runtimeParams } = config.advanced;
267
+ const compiled = new QuantumModule( source, { parserParams, compilerParams, runtimeParams } );
268
268
  inlineParseCache.set( str, compiled );
269
269
  return compiled;
270
270
  }
@@ -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
  } );