@webqit/oohtml 1.8.35 → 1.9.2

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.
Binary file
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "wicg-proposal"
15
15
  ],
16
16
  "homepage": "https://webqit.io/tooling/oohtml",
17
- "version": "1.8.35",
17
+ "version": "1.9.2",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
@@ -40,16 +40,18 @@
40
40
  "dependencies": {
41
41
  "@webqit/browser-pie": "^0.0.17",
42
42
  "@webqit/observer": "^1.7.5",
43
- "@webqit/subscript": "^1.1.11",
44
- "@webqit/util": "^0.8.7"
43
+ "@webqit/subscript": "^2.0.8",
44
+ "@webqit/util": "^0.8.7",
45
+ "acorn": "^8.7.0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "chai": "^4.3.4",
49
+ "compression-webpack-plugin": "^9.2.0",
48
50
  "coveralls": "^3.1.1",
49
51
  "mocha": "^9.0.2",
50
52
  "mocha-lcov-reporter": "^1.3.0",
51
- "webpack": "^4.44.2",
52
- "webpack-cli": "^3.3.12"
53
+ "webpack": "^5.69.0",
54
+ "webpack-cli": "^4.9.2"
53
55
  },
54
56
  "author": "Oxford Harrison <oxharris.dev@gmail.com>",
55
57
  "maintainers": [
@@ -0,0 +1,115 @@
1
+
2
+ /**
3
+ * @imports
4
+ */
5
+ import { _internals, _isNumeric, _isFunction } from '@webqit/util/js/index.js';
6
+ import Subscript from '@webqit/subscript';
7
+
8
+ /**
9
+ * ---------------------------
10
+ * Subscript Element
11
+ * ---------------------------
12
+ */
13
+
14
+ export const Element = BaseElement => class extends BaseElement {
15
+
16
+ /**
17
+ * @subscript Element
18
+ */
19
+
20
+ static get subscriptMethods() {
21
+ return [ 'render' ];
22
+ }
23
+
24
+ static get subscriptParams() {
25
+ return { globalsAutoObserve: [ 'document' ] };
26
+ }
27
+
28
+ static implement( element, subscriptFunction ) {
29
+ let subscriptConsole = _internals( element, 'oohtml', 'subscript', 'console' );
30
+ let id = subscriptFunction.name;
31
+ if ( !id ) {
32
+ id = [ ...subscriptConsole.keys() ].filter( k => _isNumeric( k ) ).length;
33
+ }
34
+ subscriptConsole.set( id, subscriptFunction );
35
+ return subscriptFunction;
36
+ }
37
+
38
+ static implementScript( element, script ) {
39
+ let source = ( script.textContent || '' ).trim();
40
+ return this.implement( element, Subscript.call( element, source ) );
41
+ }
42
+
43
+ static implementMethod( element, method ) {
44
+ if ( method.name === 'constructor' ) {
45
+ throw new Error(`Constructors cannot be subscript methods.`);
46
+ }
47
+ return this.implement( element, Subscript.clone( method, element ) );
48
+ }
49
+
50
+ /**
51
+ * @constructor()
52
+ */
53
+ constructor() {
54
+ super();
55
+ const subscriptConstructor = this.constructor;
56
+ subscriptConstructor.subscriptMethods.forEach( methodName => {
57
+ if ( !this[ methodName ] ) return;
58
+ let proxy = subscriptConstructor.implementMethod( this, this[ methodName ] );
59
+ this[ methodName ] = proxy;
60
+ } );
61
+ if ( ( typeof WebQit === 'undefined' ) || !WebQit.Observer ) return;
62
+ ( subscriptConstructor.subscriptParams.globalsAutoObserve || [] ).forEach( identifier => {
63
+ WebQit.Observer.link( globalThis, identifier, globalThis[ identifier ] );
64
+ } );
65
+ }
66
+
67
+ /**
68
+ * @connectedCallback()
69
+ */
70
+ connectedCallback() {
71
+ if ( ( typeof WebQit === 'undefined' ) || !WebQit.Observer ) return;
72
+ const signals = ( mutations, evt, namespace = [] ) => {
73
+ let subscriptConsole = _internals( this, 'oohtml', 'subscript', 'console' );
74
+ subscriptConsole.forEach( api => api.signal( ...mutations.map( mu => ( { ...mu, path: namespace.concat( mu.path ) } ) ) ) );
75
+ };
76
+ WebQit.Observer.observe( globalThis, signals, {
77
+ subtree: true, tags: [ this, 'subscript-element', 'globals' ], unique: true
78
+ } );
79
+ WebQit.Observer.observe( this, mutations => signals( mutations, null, [ 'this' ] ), {
80
+ subtree: true, tags: [ this, 'subscript-element', 'this' ], unique: true
81
+ } );
82
+ if ( super.connectedCallback ) {
83
+ super.connectedCallback();
84
+ }
85
+ }
86
+
87
+ /**
88
+ * @disconnectedCallback()
89
+ */
90
+ disconnectedCallback() {
91
+ let subscriptConsole = _internals( this, 'oohtml', 'subscript', 'console' );
92
+ subscriptConsole.forEach( api => api.dispose() );
93
+ if ( ( typeof WebQit === 'undefined' ) || !WebQit.Observer ) return;
94
+ WebQit.Observer.unobserve( globalThis, null, null, {
95
+ subtree: true, tags: [ this, 'subscript-element', 'globals' ]
96
+ } );
97
+ WebQit.Observer.unobserve( this, null, null, {
98
+ subtree: true, tags: [ this, 'subscript-element', 'this' ]
99
+ } );
100
+ if ( super.disconnectedCallback ) {
101
+ super.disconnectedCallback();
102
+ }
103
+ }
104
+
105
+ get subscriptConsole() {
106
+ return _internals( this, 'oohtml', 'subscript', 'console' );
107
+ }
108
+
109
+ /**
110
+ * @render()
111
+ */
112
+
113
+ render() {}
114
+
115
+ }
@@ -7,4 +7,4 @@ import init from './index.js';
7
7
  /**
8
8
  * @init
9
9
  */
10
- init.call(window);
10
+ init.call( window );