@webqit/oohtml 1.9.10 → 1.9.13

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.9.10",
17
+ "version": "1.9.13",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@webqit/browser-pie": "^0.0.17",
42
42
  "@webqit/observer": "^1.7.5",
43
- "@webqit/subscript": "^2.0.18",
43
+ "@webqit/subscript": "^2.0.19",
44
44
  "@webqit/util": "^0.8.7",
45
45
  "acorn": "^8.7.0"
46
46
  },
package/src/index.js CHANGED
@@ -3,13 +3,12 @@
3
3
  * @imports
4
4
  */
5
5
  import Observer from '@webqit/observer';
6
- import * as Subscript from '@webqit/subscript';
7
6
  import domInit from '@webqit/browser-pie/src/dom/index.js';
8
7
  import HTMLModules from './html-modules/index.js';
9
8
  import HTMLImports from './html-imports/index.js';
10
9
  import NamespacedHTML from './namespaced-html/index.js';
11
10
  import StateAPI from './state-api/index.js';
12
- import HTMLSubscript from './subscript/index.js';
11
+ import Subscript from './subscript/index.js';
13
12
 
14
13
  /**
15
14
  * @init
@@ -26,10 +25,9 @@ export default function init(config = null, onDomReady = false) {
26
25
  HTMLImports.call(this, config, onDomReady);
27
26
  NamespacedHTML.call(this, config, onDomReady);
28
27
  StateAPI.call(this, config, onDomReady);
29
- HTMLSubscript.call(this, config, onDomReady);
28
+ Subscript.call(this, config, onDomReady);
30
29
  // --------------
31
30
  WebQit.Observer = Observer;
32
- WebQit.Subscript = Subscript;
33
31
 
34
32
  }
35
33
 
@@ -38,5 +36,4 @@ export default function init(config = null, onDomReady = false) {
38
36
  */
39
37
  export {
40
38
  Observer,
41
- Subscript,
42
39
  }
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
+ import { SubscriptFunction, SubscriptClass } from '@webqit/subscript';
5
6
  import { _internals, _isNumeric, _isFunction } from '@webqit/util/js/index.js';
6
- import Subscript from '@webqit/subscript';
7
7
 
8
8
  /**
9
9
  * ---------------------------
@@ -11,7 +11,7 @@ import Subscript from '@webqit/subscript';
11
11
  * ---------------------------
12
12
  */
13
13
 
14
- export const Element = BaseElement => class extends BaseElement {
14
+ export const Element = BaseElement => class extends SubscriptClass( BaseElement ) {
15
15
 
16
16
  /**
17
17
  * @subscript Element
@@ -22,10 +22,10 @@ export const Element = BaseElement => class extends BaseElement {
22
22
  }
23
23
 
24
24
  static get subscriptMethods() {
25
- return [ 'render' ];
25
+ return [];
26
26
  }
27
27
 
28
- static implement( element, subscriptFunction ) {
28
+ static expose( element, subscriptFunction ) {
29
29
  let subscripts = _internals( element, 'oohtml', 'subscripts' );
30
30
  let id = subscriptFunction.name;
31
31
  if ( !id ) {
@@ -35,16 +35,15 @@ export const Element = BaseElement => class extends BaseElement {
35
35
  return subscriptFunction;
36
36
  }
37
37
 
38
- static implementScript( element, script ) {
39
- let source = ( script.textContent || '' ).trim();
40
- return this.implement( element, Subscript.call( element, source ) );
38
+
39
+ static implementMethod( method, element ) {
40
+ let subscriptFunction = super.implementMethod( method, element );
41
+ return this.expose( element, subscriptFunction );
41
42
  }
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 ) );
43
+
44
+ static implementScript( script, element ) {
45
+ let source = ( script.textContent || '' ).trim();
46
+ return this.expose( element, SubscriptFunction.call( element, source ) );
48
47
  }
49
48
 
50
49
  /**
@@ -81,19 +80,6 @@ export const Element = BaseElement => class extends BaseElement {
81
80
  } );
82
81
  }
83
82
 
84
- /**
85
- * @constructor()
86
- */
87
- constructor() {
88
- super();
89
- const subscriptConstructor = this.constructor;
90
- subscriptConstructor.subscriptMethods.forEach( methodName => {
91
- if ( !this[ methodName ] ) return;
92
- let proxy = subscriptConstructor.implementMethod( this, this[ methodName ] );
93
- this[ methodName ] = proxy;
94
- } );
95
- }
96
-
97
83
  /**
98
84
  * @connectedCallback()
99
85
  */
@@ -118,10 +104,4 @@ export const Element = BaseElement => class extends BaseElement {
118
104
  return _internals( this, 'oohtml', 'subscripts' );
119
105
  }
120
106
 
121
- /**
122
- * @render()
123
- */
124
-
125
- render() {}
126
-
127
107
  }
@@ -53,6 +53,9 @@ export default function init( _config = null, onDomReady = false ) {
53
53
 
54
54
  } );
55
55
 
56
- WebQit.SubscriptElement = Element;
56
+ if (!WebQit.OOHTML) {
57
+ WebQit.OOHTML = {};
58
+ }
59
+ WebQit.OOHTML.SubscriptElement = Element;
57
60
 
58
61
  }