@webqit/oohtml 2.1.26 → 2.1.28

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": "2.1.26",
17
+ "version": "2.1.28",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
@@ -34,17 +34,17 @@
34
34
  "test:coverage": "c8 --reporter=text-lcov npm run test | coveralls",
35
35
  "build": "esbuild main=src/targets.browser.js bindings-api=src/bindings-api/targets.browser.js context-api=src/context-api/targets.browser.js namespace-api=src/namespace-api/targets.browser.js html-modules=src/html-modules/targets.browser.js html-imports=src/html-imports/targets.browser.js scoped-js=src/scoped-js/targets.browser.js --bundle --minify --sourcemap --outdir=dist",
36
36
  "preversion": "npm run test && npm run build && git add -A dist",
37
- "postversion": "npm publish",
37
+ "postversion": "npm publish --tag next",
38
38
  "postpublish": "git push && git push --tags"
39
39
  },
40
40
  "dependencies": {
41
- "@webqit/dom": "^2.0.8",
42
41
  "@webqit/observer": "^2.0.7",
42
+ "@webqit/realdom": "^2.1.3",
43
43
  "@webqit/subscript": "^2.1.40",
44
44
  "@webqit/util": "^0.8.11"
45
45
  },
46
46
  "devDependencies": {
47
- "@webqit/oohtml-ssr": "^1.2.7",
47
+ "@webqit/oohtml-ssr": "^1.2.8",
48
48
  "chai": "^4.3.4",
49
49
  "coveralls": "^3.1.1",
50
50
  "esbuild": "^0.14.43",
@@ -14,7 +14,7 @@ import { _ } from '../util.js';
14
14
  * @return HTMLImportElement
15
15
  */
16
16
  export default function( config ) {
17
- const window = this, { dom } = window.webqit;
17
+ const window = this, { realdom } = window.webqit;
18
18
  const BaseElement = config.import.tagName.includes( '-' ) ? window.HTMLElement : class {};
19
19
  return class HTMLImportElement extends BaseElement {
20
20
 
@@ -89,7 +89,7 @@ export default function( config ) {
89
89
  priv.anchorNode.replaceWith( this.el );
90
90
  return;
91
91
  }
92
- const autoRestoreRealtime = dom.realtime( window.document ).observe( [ ...priv.slottedElements ], record => {
92
+ const autoRestoreRealtime = realdom.realtime( window.document ).observe( [ ...priv.slottedElements ], record => {
93
93
  record.exits.forEach( outgoingNode => {
94
94
  _( outgoingNode ).delete( 'slot@imports' );
95
95
  priv.slottedElements.delete( outgoingNode );
@@ -110,7 +110,7 @@ export default function( config ) {
110
110
  // Totally initialize this instance?
111
111
  if ( !priv.anchorNode ) { priv.setAnchorNode( this.createAnchorNode() ); }
112
112
  if ( priv.moduleRefRealtime ) return;
113
- priv.moduleRefRealtime = dom.realtime( this.el ).attr( config.import.attr.moduleref, ( record, { signal } ) => {
113
+ priv.moduleRefRealtime = realdom.realtime( this.el ).attr( config.import.attr.moduleref, ( record, { signal } ) => {
114
114
  priv.moduleRef = record.value;
115
115
  ;
116
116
  // Below, we ignore first restore from hydration
@@ -13,14 +13,14 @@ import { _, _init } from '../util.js';
13
13
  * @return Void
14
14
  */
15
15
  export default function init( $config = {} ) {
16
- const { config, dom, window } = _init.call( this, 'html-imports', $config, {
16
+ const { config, realdom, window } = _init.call( this, 'html-imports', $config, {
17
17
  import: { tagName: 'import', attr: { moduleref: 'module' }, },
18
18
  export: { attr: { exportid: 'exportid' }, },
19
19
  isomorphic: true,
20
20
  } );
21
21
  config.slottedElementsSelector = `[${ window.CSS.escape( config.export.attr.exportid ) }]`;
22
22
  window.webqit.HTMLImportElement = _HTMLImportElement.call( window, config );
23
- dom.ready( () => hydration.call( window, config ) );
23
+ realdom.ready( () => hydration.call( window, config ) );
24
24
  realtime.call( window, config );
25
25
  }
26
26
 
@@ -33,8 +33,8 @@ export default function init( $config = {} ) {
33
33
  * @return Void
34
34
  */
35
35
  function realtime( config ) {
36
- const window = this, { dom, HTMLImportElement } = window.webqit;
37
- dom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.import.tagName, record => {
36
+ const window = this, { realdom, HTMLImportElement } = window.webqit;
37
+ realdom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.import.tagName, record => {
38
38
  record.entrants.forEach( node => handleRealtime( node, true, record ) );
39
39
  record.exits.forEach( node => handleRealtime( node, false, record ) );
40
40
  }, { live: true, timing: 'sync' } );
@@ -29,14 +29,14 @@ export default class HTMLExportsManager {
29
29
  this.modules = getModulesObject( this.host );
30
30
  this.exportId = ( this.host.getAttribute( this.config.template?.attr.exportid ) || '' ).trim();
31
31
  this.validateExportId( this.exportId );
32
- const dom = this.window.webqit.dom;
32
+ const realdom = this.window.webqit.realdom;
33
33
  // ----------
34
- this.realtimeA = dom.realtime( this.host.content ).children( record => {
34
+ this.realtimeA = realdom.realtime( this.host.content ).children( record => {
35
35
  this.export( record.entrants, true );
36
36
  this.export( record.exits, false );
37
37
  }, { live: true, timing: 'sync' } );
38
38
  // ----------
39
- this.realtimeB = dom.realtime( this.host ).attr( [ 'src', 'loading' ], ( ...args ) => this.evaluateLoading( ...args ), {
39
+ this.realtimeB = realdom.realtime( this.host ).attr( [ 'src', 'loading' ], ( ...args ) => this.evaluateLoading( ...args ), {
40
40
  live: true,
41
41
  atomic: true,
42
42
  timing: 'sync',
@@ -74,8 +74,8 @@ export default class _HTMLImportsContext extends HTMLContext {
74
74
  if ( !this.host.matches || !$config.context.attr.importscontext ) return;
75
75
  // Any existing this.refdSourceController? Abort!
76
76
  this.refdSourceController?.disconnect();
77
- const dom = this.host.ownerDocument.defaultView.webqit.dom;
78
- this.refdSourceController = dom.realtime( this.host ).attr( $config.context.attr.importscontext, ( record, { signal } ) => {
77
+ const realdom = this.host.ownerDocument.defaultView.webqit.realdom;
78
+ this.refdSourceController = realdom.realtime( this.host ).attr( $config.context.attr.importscontext, ( record, { signal } ) => {
79
79
  // No importscontext attr set. But we're still watching
80
80
  if ( !record.value ) {
81
81
  this.altModules = undefined;
@@ -88,7 +88,7 @@ function exposeModulesObjects( config ) {
88
88
  * @return Void
89
89
  */
90
90
  function realtime( config ) {
91
- const window = this, { dom, HTMLImportsContext } = window.webqit;
91
+ const window = this, { realdom, HTMLImportsContext } = window.webqit;
92
92
  // ------------
93
93
  const attachImportsContext = host => {
94
94
  const contextId = HTMLImportsContext.createId( host );
@@ -101,7 +101,7 @@ function realtime( config ) {
101
101
  } );
102
102
  };
103
103
  // ------------
104
- dom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( [ config.templateSelector, config.ownerContextSelector ], record => {
104
+ realdom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( [ config.templateSelector, config.ownerContextSelector ], record => {
105
105
  record.entrants.forEach( entry => {
106
106
  if ( entry.matches( config.templateSelector ) ) {
107
107
  Object.defineProperty( entry, 'scoped', { value: entry.hasAttribute( 'scoped' ) } );
@@ -85,7 +85,7 @@ function getNamespaceObject( node, config ) {
85
85
  * @return Void
86
86
  */
87
87
  function realtime( config ) {
88
- const window = this, { dom } = window.webqit;
88
+ const window = this, { realdom } = window.webqit;
89
89
  // ----------------
90
90
  const handle = ( target, entry, incoming ) => {
91
91
  const identifier = entry.getAttribute( config.attr.id );
@@ -101,13 +101,13 @@ function realtime( config ) {
101
101
  Observer.deleteProperty( namespaceObj, identifier );
102
102
  }
103
103
  };
104
- dom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.idSelector, record => {
104
+ realdom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.idSelector, record => {
105
105
  record.entrants.forEach( entry => handle( record.target, entry, true ) );
106
106
  record.exits.forEach( entry => handle( record.target, entry, false ) );
107
107
  }, { live: true, timing: 'sync', staticSensitivity: config.staticsensitivity } );
108
108
  // ----------------
109
109
  if ( config.staticsensitivity ) {
110
- dom.realtime( window.document, 'attr' ).observe( config.namespaceSelector, record => {
110
+ realdom.realtime( window.document, 'attr' ).observe( config.namespaceSelector, record => {
111
111
  const ownerRoot = record.target.parentNode?.closest( config.namespaceSelector ) || _( record.target ).get( 'ownerNamespace' ) || window.document;
112
112
  const ownerRootNamespaceObj = getNamespaceObject.call( window, ownerRoot, config );
113
113
  const namespaceObj = getNamespaceObject.call( window, record.target, config );
@@ -67,8 +67,8 @@ export function execute( compiledScript, thisContext, script ) {
67
67
  } );
68
68
  } );
69
69
  }
70
- const window = this, { dom } = window.webqit;
71
- dom.realtime( window.document ).observe( thisContext, () => {
70
+ const window = this, { realdom } = window.webqit;
71
+ realdom.realtime( window.document ).observe( thisContext, () => {
72
72
  if ( script.contract ) {
73
73
  // Rerending processes,,,
74
74
  _await( script.properties, properties => {
@@ -89,11 +89,11 @@ export function execute( compiledScript, thisContext, script ) {
89
89
  * @return Void
90
90
  */
91
91
  function realtime( config ) {
92
- const window = this, { dom } = window.webqit;
92
+ const window = this, { realdom } = window.webqit;
93
93
  if ( !window.HTMLScriptElement.supports ) { window.HTMLScriptElement.supports = () => false; }
94
94
  const potentialManualTypes = [ 'module' ].concat( config.script.mimeType || [] );
95
95
  const compiler = new Compiler( window, config, execute ), handled = () => {};
96
- dom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.scriptSelector, record => {
96
+ realdom.realtime( window.document ).subtree/*instead of observe(); reason: jsdom timing*/( config.scriptSelector, record => {
97
97
  record.entrants.forEach( script => {
98
98
  if ( 'contract' in script ) return handled( script );
99
99
  Object.defineProperty( script, 'contract', { value: script.hasAttribute( 'contract' ) } );
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import init, { Observer } from './index.js';
5
+ import init from './index.js';
6
6
 
7
7
  /**
8
8
  * @init
package/src/util.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import webqitDom from '@webqit/dom';
5
+ import realdomInit from '@webqit/realdom';
6
6
  import { _internals } from '@webqit/util/js/index.js';
7
7
  import { _merge } from '@webqit/util/obj/index.js';
8
8
 
@@ -10,15 +10,15 @@ export const _ = ( ...args ) => _internals( 'oohtml', ...args );
10
10
 
11
11
  export function _init( name, $config, $defaults ) {
12
12
  const _name = name.toUpperCase().replace( '-', '_' );
13
- const window = this, dom = webqitDom.call( window );
13
+ const window = this, realdom = realdomInit.call( window );
14
14
  window.webqit || ( window.webqit = {} );
15
15
  window.webqit.oohtml || ( window.webqit.oohtml = {} );
16
16
  window.webqit.oohtml.configs || ( window.webqit.oohtml.configs = {} );
17
17
  window.webqit.oohtml.configs[ _name ] || ( window.webqit.oohtml.configs[ _name ] = {} );
18
18
  // ---------------------
19
- _merge( 2, window.webqit.oohtml.configs[ _name ], $defaults, $config, dom.meta( name ).json() );
19
+ _merge( 2, window.webqit.oohtml.configs[ _name ], $defaults, $config, realdom.meta( name ).json() );
20
20
  // ---------------------
21
- return { config: window.webqit.oohtml.configs[ _name ], dom, window };
21
+ return { config: window.webqit.oohtml.configs[ _name ], realdom, window };
22
22
  }
23
23
 
24
24
  export function _compare( a, b, depth = 1, objectSizing = false ) {