mount-observer 0.0.88 → 0.0.90

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/MountObserver.js CHANGED
@@ -503,6 +503,14 @@ export class MountObserver extends EventTarget {
503
503
  //getting into a catch-22 scenario frequently, blocking the code for resuming.
504
504
  //This was observed with per-each package, demo/ScopeScript.html, clicking refresh a few times
505
505
  //one will see the inconsistent behavior if await is added below.
506
+ const genids = Array.from(within.querySelectorAll('[genids]'));
507
+ if (genids[0]) {
508
+ const { genIds } = await import('./refid/genIds.js');
509
+ for (const el of genids) {
510
+ genIds(el);
511
+ el.removeAttribute('genid');
512
+ }
513
+ }
506
514
  bindish(within, within, { assigner: this.#mountInit.assigner });
507
515
  await this.composeFragment(within, 0);
508
516
  const match = await this.#selector();
package/MountObserver.ts CHANGED
@@ -533,11 +533,20 @@ export class MountObserver extends EventTarget implements IMountObserver{
533
533
  //getting into a catch-22 scenario frequently, blocking the code for resuming.
534
534
  //This was observed with per-each package, demo/ScopeScript.html, clicking refresh a few times
535
535
  //one will see the inconsistent behavior if await is added below.
536
+ const genids = Array.from((within as DocumentFragment).querySelectorAll('[genids]'))
537
+ if(genids[0]){
538
+ const {genIds} = await import('./refid/genIds.js');
539
+ for(const el of genids){
540
+ genIds(el);
541
+ el.removeAttribute('genid');
542
+ }
543
+ }
536
544
  bindish(within as DocumentFragment, within, {assigner: this.#mountInit.assigner});
537
545
  await this.composeFragment(within as DocumentFragment, 0);
538
546
  const match = await this.#selector();
539
547
  const els = Array.from((within as Element).querySelectorAll(match));
540
548
  this.#filterAndMount(els, within, false, initializing);
549
+
541
550
  }
542
551
 
543
552
  }
package/README.md CHANGED
@@ -399,7 +399,7 @@ Callbacks like we saw in our earlier examples above are useful for tight couplin
399
399
 
400
400
  However, since these rules may be of interest to multiple parties, it is useful to also provide the ability for multiple parties to subscribe to these DOM filtering events.
401
401
 
402
- If the performance isn't impacted, I think it would be most convenient for the developer if, at a minimum, the second argument of the callbacks above in fact precisely match the loosely coupled events. The callback would get the first dibs on the event, and have the opportunity to prevent the event from going any further before getting dispatched, using something like preventDefault. I don't yet have any compelling use cases for that scenario, but I think there probably are some.
402
+ If the performance isn't impacted, I think it would be most convenient for the developer if, at a minimum, the second argument of the callbacks above in fact precisely match the loosely coupled events. The callback would get the first dibs on the event, and have the opportunity to prevent the event from going any further before getting dispatched, using something like stopPropagation. I don't yet have any compelling use cases for that scenario, but I think there probably are some.
403
403
 
404
404
  In which case the argument becomes quite strong that the inconsistency of making the callback methods above have a separate parameter where the matching element is passed is unwise. Simply making the matching element be part of the event payload, as is done for the loosely coupled events discussed above, would reduce the learning curve, and make it easier to share logic between the two.
405
405
 
@@ -927,7 +927,7 @@ This proposal (and polyfill) also supports the option to utilize ShadowDOM / slo
927
927
 
928
928
  The discussion there leads to an open question whether a processing instruction would be better. I think the compose tag would make much more sense, vs a processing instruction, as it could then support slotted children (behaving similar to the Beatles' example above). Or maybe another tag should be introduced that is the equivalent of the slot, to avoid confusion. But I strongly suspect supporting intra document HTML imports could significantly reduce the payload size of some documents, if we can reuse blocks of HTML, inserting sections of customized content for each instance.
929
929
 
930
- The [add src attribute to template to load a template from file](https://github.com/whatwg/html/issues/10571) and an interesting proposal that is [coming from](https://github.com/htmlcomponents/declarative-shadow-imports/blob/main/examples/02-explainer-proposal/02-html.html) the Edge team [seem quite compatible](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/ShadowDOM/explainer.md#proposal-inline-declarative-css-module-scripts) with this idea.
930
+ The [add src attribute to template to load a template from file](https://github.com/whatwg/html/issues/10571) and an interesting [declarative shadow imports proposal that is coming from](https://github.com/htmlcomponents/declarative-shadow-imports/blob/main/examples/02-explainer-proposal/02-html.html) the Edge team [seem quite compatible](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/ShadowDOM/explainer.md#proposal-inline-declarative-css-module-scripts) with this idea. Also [declarative partial updates](https://github.com/WICG/declarative-partial-updates). Here's to hoping something actually lands in the browser.
931
931
 
932
932
  ## Applying DRY to templates
933
933
 
@@ -1120,7 +1120,7 @@ And we can give each inheriting ShadowRoot a personality of its own by customizi
1120
1120
  </be-hive>
1121
1121
  ```
1122
1122
 
1123
- ## Creating an Element-To-RefID DOM passageway
1123
+ ## Creating an Element-To-RefID DOM traversal API
1124
1124
 
1125
1125
  The platform provides some nice help with managing forms, including IDREF dependency support:
1126
1126
 
@@ -1217,5 +1217,26 @@ Again, because of the mount-observer being the "first point of contact" with the
1217
1217
  </script>
1218
1218
  ```
1219
1219
 
1220
+ One quirk to consider:
1221
+
1222
+ In the case of multiple elements being linked to a "mother ship" element forming a concept of "children" like we've seen before, the "mother ship" element is the one that points outward to the children.
1223
+
1224
+ The one exception (or are there others?) is the form element, where outside elements can say "hey, I want to be considered part of the form".
1225
+
1226
+ To keep the api uniform, we hide this discrepancy by pretending the form element is like the others [TODO]:
1227
+
1228
+ ```html
1229
+ <input id=field2 name=field2 form=myForm>
1230
+
1231
+ <form id=myForm>
1232
+ <input name="field1">
1233
+ </form>
1234
+ <script>
1235
+ console.log(myForm.via.form.children);
1236
+ // includes both field1 and field2
1237
+
1238
+ </script>
1239
+ ```
1240
+
1220
1241
 
1221
1242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.0.88",
3
+ "version": "0.0.90",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
package/refid/arr.js ADDED
@@ -0,0 +1,4 @@
1
+ export function arr(inp) {
2
+ return inp === undefined ? []
3
+ : Array.isArray(inp) ? inp : [inp];
4
+ }
package/refid/arr.ts ADDED
@@ -0,0 +1,4 @@
1
+ export function arr<T = any>(inp: T | T[] | undefined) : T[] {
2
+ return inp === undefined ? []
3
+ : Array.isArray(inp) ? inp : [inp];
4
+ }
@@ -0,0 +1,130 @@
1
+ import { nudge } from './nudge.js';
2
+ import { getCount } from './getCount.js';
3
+ const attrMap = {
4
+ '@': 'name',
5
+ '|': 'itemprop',
6
+ };
7
+ export function genIds(enhancedElement) {
8
+ const { parentElement } = enhancedElement;
9
+ if (parentElement === null)
10
+ throw 404;
11
+ //first find all elements with attribute #
12
+ const hashIds = Array.from(parentElement.querySelectorAll('[\\#]'));
13
+ const uniqueCheck = new Set();
14
+ for (const hi of hashIds) {
15
+ if (!(hi instanceof HTMLElement))
16
+ continue;
17
+ const { localName } = hi;
18
+ if (uniqueCheck.has(localName))
19
+ throw 500;
20
+ uniqueCheck.add(localName);
21
+ let sideEffects = '';
22
+ const hashValue = hi.getAttribute('#');
23
+ if (hashValue) {
24
+ sideEffects = `${hashValue} `;
25
+ }
26
+ hi.dataset.id = `{{${sideEffects}${localName}}}`;
27
+ hi.removeAttribute('#');
28
+ }
29
+ const dataIds = Array.from(parentElement.querySelectorAll('[data-id^="{{"][data-id$="}}"]'));
30
+ const ids = [];
31
+ for (const di of dataIds) {
32
+ if (!(di instanceof HTMLElement))
33
+ continue;
34
+ const unparsedID = di.dataset.id;
35
+ const inner = unparsedID?.substring(2, unparsedID.length - 2);
36
+ if (!inner)
37
+ continue;
38
+ const split = inner.split(' ');
39
+ const id = split.length === 2 ? split[1] : split[0];
40
+ if (ids.includes(id))
41
+ throw 500;
42
+ ids.push(id);
43
+ }
44
+ const allChildren = Array.from(parentElement.querySelectorAll('*'));
45
+ allChildren.push(parentElement);
46
+ const idLookup = {};
47
+ const base = 'gid';
48
+ for (const child of allChildren) {
49
+ const attrs = child.attributes;
50
+ for (const attr of attrs) {
51
+ const { name, value } = attr;
52
+ if (!name.startsWith('data-'))
53
+ continue;
54
+ if (name === 'data-id') {
55
+ if (!value.startsWith('{{') || !value.endsWith('}}'))
56
+ continue;
57
+ const inner = value.substring(2, value.length - 2);
58
+ const split = inner.split(' ');
59
+ const id = split.length === 2 ? split[1] : split[0];
60
+ if (!(id in idLookup)) {
61
+ idLookup[id] = `${base}-${getCount(base)}`;
62
+ }
63
+ if (split.length === 2) {
64
+ const sideEffects = split[0];
65
+ for (const char of sideEffects) {
66
+ switch (char) {
67
+ case '@':
68
+ case '|':
69
+ child.setAttribute(attrMap[char], id);
70
+ break;
71
+ case '%':
72
+ child.part.add(id);
73
+ break;
74
+ case '.':
75
+ child.classList.add(id);
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ child.id = idLookup[id];
81
+ child.setAttribute('data-id', id);
82
+ }
83
+ else {
84
+ let newValue = value;
85
+ for (const id of ids) {
86
+ const token = `{{${id}}}`;
87
+ if (!newValue.includes(token))
88
+ continue;
89
+ if (!(id in idLookup)) {
90
+ idLookup[id] = `${base}-${getCount(base)}`;
91
+ }
92
+ newValue = newValue.replaceAll(token, idLookup[id]);
93
+ }
94
+ if (newValue === value)
95
+ continue;
96
+ child.setAttribute(name.substring(5), newValue);
97
+ child.removeAttribute(name);
98
+ }
99
+ }
100
+ for (const attr of attrs) {
101
+ const { name, value } = attr;
102
+ if (!name.startsWith('defer-'))
103
+ continue;
104
+ const nameWithoutDefer = name.substring(6);
105
+ const attrWithoutDefer = child.getAttributeNode(nameWithoutDefer);
106
+ if (attrWithoutDefer === null)
107
+ continue;
108
+ const valueWithoutDefer = attrWithoutDefer.value;
109
+ let newValue = valueWithoutDefer;
110
+ let changeMade = false;
111
+ for (const id of ids) {
112
+ const token = `{{${id}}}`;
113
+ if (!newValue.includes(token))
114
+ continue;
115
+ if (!(id in idLookup)) {
116
+ idLookup[id] = `${base}-${getCount(base)}`;
117
+ }
118
+ newValue = newValue.replaceAll(token, idLookup[id]);
119
+ changeMade = true;
120
+ }
121
+ //child.setAttribute(nameWithoutDefer, newValue);
122
+ if (changeMade)
123
+ attrWithoutDefer.value = newValue;
124
+ nudge(child, name);
125
+ }
126
+ }
127
+ if ('disabled' in parentElement) {
128
+ nudge(parentElement);
129
+ }
130
+ }
@@ -0,0 +1,126 @@
1
+ import {nudge} from './nudge.js';
2
+ import {getCount} from './getCount.js';
3
+
4
+ const attrMap = {
5
+ '@': 'name',
6
+ '|': 'itemprop',
7
+ };
8
+
9
+ export function genIds(enhancedElement: Element){
10
+ const {parentElement} = enhancedElement;
11
+ if(parentElement === null) throw 404;
12
+
13
+ //first find all elements with attribute #
14
+ const hashIds = Array.from(parentElement.querySelectorAll('[\\#]'));
15
+ const uniqueCheck = new Set();
16
+ for(const hi of hashIds){
17
+ if(!(hi instanceof HTMLElement)) continue;
18
+ const {localName} = hi;
19
+ if(uniqueCheck.has(localName)) throw 500;
20
+ uniqueCheck.add(localName);
21
+ let sideEffects = '';
22
+ const hashValue = hi.getAttribute('#');
23
+ if(hashValue){
24
+ sideEffects = `${hashValue} `;
25
+ }
26
+ hi.dataset.id = `{{${sideEffects}${localName}}}`;
27
+ hi.removeAttribute('#');
28
+ }
29
+
30
+ const dataIds = Array.from(parentElement.querySelectorAll('[data-id^="{{"][data-id$="}}"]'));
31
+ const ids: Array<string> = [];
32
+ for(const di of dataIds){
33
+ if(!(di instanceof HTMLElement)) continue;
34
+ const unparsedID = di.dataset.id;
35
+ const inner = unparsedID?.substring(2, unparsedID.length - 2);
36
+ if(!inner) continue;
37
+ const split = inner.split(' ');
38
+ const id = split.length === 2 ? split[1] : split[0];
39
+ if(ids.includes(id)) throw 500;
40
+ ids.push(id);
41
+ }
42
+
43
+ const allChildren = Array.from(parentElement.querySelectorAll('*'));
44
+ allChildren.push(parentElement);
45
+
46
+ const idLookup: {[key: string]: string} = {};
47
+ const base = 'gid';
48
+ for(const child of allChildren){
49
+ const attrs = child.attributes;
50
+ for(const attr of attrs){
51
+ const {name, value} = attr;
52
+ if(!name.startsWith('data-')) continue;
53
+ if(name === 'data-id'){
54
+ if(!value.startsWith('{{') || !value.endsWith('}}')) continue;
55
+ const inner = value.substring(2, value.length - 2);
56
+ const split = inner.split(' ');
57
+ const id = split.length === 2 ? split[1] : split[0];
58
+ if(!(id in idLookup)){
59
+ idLookup[id] = `${base}-${getCount(base)}`;
60
+ }
61
+ if(split.length === 2){
62
+ const sideEffects = split[0];
63
+ for(const char of sideEffects){
64
+ switch(char){
65
+ case '@':
66
+ case '|':
67
+ child.setAttribute(attrMap[char], id);
68
+ break;
69
+ case '%':
70
+ child.part.add(id);
71
+ break;
72
+ case '.':
73
+ child.classList.add(id);
74
+ break;
75
+
76
+ }
77
+ }
78
+ }
79
+ child.id = idLookup[id];
80
+ child.setAttribute('data-id', id);
81
+ }else{
82
+ let newValue = value;
83
+ for(const id of ids){
84
+ const token = `{{${id}}}`;
85
+ if(!newValue.includes(token)) continue;
86
+ if(!(id in idLookup)){
87
+ idLookup[id] = `${base}-${getCount(base)}`;
88
+ }
89
+ newValue = newValue.replaceAll(token, idLookup[id]);
90
+
91
+ }
92
+ if(newValue === value) continue;
93
+ child.setAttribute(name.substring(5), newValue);
94
+ child.removeAttribute(name);
95
+ }
96
+
97
+ }
98
+ for(const attr of attrs){
99
+ const {name, value} = attr;
100
+ if(!name.startsWith('defer-')) continue;
101
+ const nameWithoutDefer = name.substring(6);
102
+ const attrWithoutDefer = child.getAttributeNode(nameWithoutDefer);
103
+ if(attrWithoutDefer === null) continue;
104
+ const valueWithoutDefer = attrWithoutDefer.value;
105
+
106
+ let newValue = valueWithoutDefer;
107
+ let changeMade = false;
108
+ for(const id of ids){
109
+ const token = `{{${id}}}`;
110
+ if(!newValue.includes(token)) continue;
111
+ if(!(id in idLookup)){
112
+ idLookup[id] = `${base}-${getCount(base)}`;
113
+ }
114
+ newValue = newValue.replaceAll(token, idLookup[id]);
115
+ changeMade = true;
116
+
117
+ }
118
+ //child.setAttribute(nameWithoutDefer, newValue);
119
+ if(changeMade) attrWithoutDefer.value = newValue;
120
+ nudge(child, name);
121
+ }
122
+ }
123
+ if('disabled' in parentElement){
124
+ nudge(parentElement);
125
+ }
126
+ }
@@ -0,0 +1,8 @@
1
+ const ttGuid = '0j9qIjjR+UWYLrZ3FskVig';
2
+ export function getCount(baseID) {
3
+ const key = Symbol.for(ttGuid + baseID);
4
+ let returnCnt = window[key] || 0;
5
+ const nextCnt = returnCnt + 1;
6
+ window[key] = nextCnt;
7
+ return returnCnt;
8
+ }
@@ -0,0 +1,8 @@
1
+ const ttGuid = '0j9qIjjR+UWYLrZ3FskVig'
2
+ export function getCount(baseID: string){
3
+ const key = Symbol.for(ttGuid + baseID);
4
+ let returnCnt = (<any>window)[key] || 0;
5
+ const nextCnt = returnCnt + 1;
6
+ (<any>window)[key] = nextCnt;
7
+ return returnCnt;
8
+ }
package/refid/nudge.js ADDED
@@ -0,0 +1,23 @@
1
+ import { arr } from './arr.js';
2
+ /**
3
+ * Decrement "disabled" counter, remove when reaches 0
4
+ * @param el
5
+ * Optional select the attribute or attributes to remove or decrement
6
+ * @param attr
7
+ */
8
+ export function nudge(el, attr = 'disabled') {
9
+ const attrs = arr(attr);
10
+ for (const attr of attrs) {
11
+ const da = el.getAttribute(attr);
12
+ if (da !== null) {
13
+ if (da.length === 0 || da === "1") {
14
+ el.removeAttribute(attr);
15
+ if (attr === 'disabled')
16
+ el.disabled = false;
17
+ }
18
+ else {
19
+ el.setAttribute(attr, (parseInt(da) - 1).toString());
20
+ }
21
+ }
22
+ }
23
+ }
package/refid/nudge.ts ADDED
@@ -0,0 +1,23 @@
1
+ import {arr} from './arr.js';
2
+ /**
3
+ * Decrement "disabled" counter, remove when reaches 0
4
+ * @param el
5
+ * Optional select the attribute or attributes to remove or decrement
6
+ * @param attr
7
+ */
8
+ export function nudge(el: Element, attr: string | Array<string> = 'disabled') { //TODO: Share with be-observant
9
+ const attrs = arr(attr);
10
+ for(const attr of attrs){
11
+ const da = el.getAttribute(attr);
12
+ if (da !== null) {
13
+ if (da.length === 0 || da === "1") {
14
+ el.removeAttribute(attr);
15
+ if(attr === 'disabled') (<any>el).disabled = false;
16
+ }
17
+ else {
18
+ el.setAttribute(attr, (parseInt(da) - 1).toString());
19
+ }
20
+ }
21
+ }
22
+
23
+ }
package/refid/via.js CHANGED
@@ -36,6 +36,7 @@ class RefManager extends EventTarget {
36
36
  #el;
37
37
  #children;
38
38
  #attr;
39
+ #lastAttrVal = '';
39
40
  //#parents: Array<WeakRef<Element>> | undefined;
40
41
  constructor(el, prop) {
41
42
  super();
@@ -43,15 +44,16 @@ class RefManager extends EventTarget {
43
44
  this.#el = new WeakRef(el);
44
45
  }
45
46
  get children() {
46
- if (this.#children === undefined) {
47
- const el = this.#el.deref();
48
- if (el === undefined)
49
- return [];
50
- const attr = el.getAttribute(this.#attr);
47
+ const el = this.#el.deref();
48
+ if (el === undefined)
49
+ return [];
50
+ const attr = el.getAttribute(this.#attr);
51
+ if (this.#children === undefined || attr !== this.#lastAttrVal) {
51
52
  if (!attr)
52
53
  return [];
54
+ this.#lastAttrVal = attr;
53
55
  const refIds = splitRefs(attr);
54
- const qry = refIds.map(id => `#${id}`).join(', ');
56
+ const qry = refIds.map(id => `#${id}`).join(',');
55
57
  const rn = el.getRootNode();
56
58
  const refsArr = Array.from(rn.querySelectorAll(qry));
57
59
  const refs = new Map();
package/refid/via.ts CHANGED
@@ -40,6 +40,7 @@ class RefManager extends EventTarget {
40
40
  #el: WeakRef<Element>;
41
41
  #children: Map<string, WeakRef<Element>> | undefined;
42
42
  #attr: string;
43
+ #lastAttrVal: string = '';
43
44
  //#parents: Array<WeakRef<Element>> | undefined;
44
45
  constructor(el: Element, prop: string){
45
46
  super();
@@ -47,13 +48,14 @@ class RefManager extends EventTarget {
47
48
  this.#el = new WeakRef(el);
48
49
  }
49
50
  get children(){
50
- if(this.#children === undefined){
51
- const el = this.#el.deref();
52
- if(el === undefined) return [];
53
- const attr = el.getAttribute(this.#attr);
51
+ const el = this.#el.deref();
52
+ if(el === undefined) return [];
53
+ const attr = el.getAttribute(this.#attr);
54
+ if(this.#children === undefined || attr !== this.#lastAttrVal){
54
55
  if(!attr) return [];
56
+ this.#lastAttrVal = attr;
55
57
  const refIds = splitRefs(attr);
56
- const qry = refIds.map(id => `#${id}`).join(', ');
58
+ const qry = refIds.map(id => `#${id}`).join(',');
57
59
  const rn = el.getRootNode() as DocumentFragment;
58
60
  const refsArr = Array.from(rn.querySelectorAll(qry));
59
61
  const refs = new Map<string, WeakRef<Element>>();
@@ -1,10 +1,12 @@
1
- import {IEnhancement, BEAllProps} from '../trans-render/be/types';
1
+ import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
2
2
 
3
3
  export interface EndUserProps extends IEnhancement{
4
4
  eventName: string, //TODO
5
5
  }
6
6
 
7
- export interface AllProps extends EndUserProps{}
7
+ export interface AllProps extends EndUserProps{
8
+ emc: EMC<any, AllProps>,
9
+ }
8
10
 
9
11
  export type AP = AllProps;
10
12
 
@@ -5,7 +5,7 @@ export interface EndUserProps extends IEnhancement{
5
5
  }
6
6
 
7
7
  export interface AllProps extends EndUserProps{
8
- parsedStatements: Array<ResolvingParameters>,
8
+ parsedStatements: Array<EnhancingParameters>,
9
9
  rawStatements?: Array<string>
10
10
  }
11
11
 
@@ -21,7 +21,7 @@ export interface Actions{
21
21
  hydrate(self: BAP): ProPAP;
22
22
  }
23
23
 
24
- export interface ResolvingParameters{
24
+ export interface EnhancingParameters{
25
25
  remoteSpecifierString: string;
26
26
  remoteSpecifier: Specifier;
27
27
  enhancementBase: string;
@@ -0,0 +1,26 @@
1
+ import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
2
+
3
+ export interface EndUserProps extends IEnhancement{
4
+ idString: string;
5
+ }
6
+
7
+ export interface AllProps extends EndUserProps{
8
+ ids: string[];
9
+ emc: EMC<any, AllProps>,
10
+ }
11
+
12
+ export type AP = AllProps;
13
+
14
+ export type PAP = Partial<AP>;
15
+
16
+ export type ProPAP = Promise<PAP>;
17
+
18
+ export type BAP = AP & BEAllProps;
19
+
20
+ export interface Actions{
21
+ parseIdString(self: AP & BEAllProps): PAP;
22
+
23
+ autoGen(self: AP & BEAllProps): PAP;
24
+
25
+ retire(self: AP & BEAllProps): void;
26
+ }
@@ -4,7 +4,7 @@ import {BEAllProps, EMC, IEnhancement} from '../trans-render/be/types';
4
4
  //import {AP as BPAP, ISignal, Actions as BPActions} from 'be-propagating/types';
5
5
  //import {ElTypes, SignalRefType} from 'be-linked/types';
6
6
  //import { Propagator } from "../trans-render/froop/PropSvc";
7
- import {Specifier} from '../trans-render/dss/types';
7
+ import {IPE, Specifier} from '../trans-render/dss/types';
8
8
 
9
9
  export interface EndUserProps extends IEnhancement<HTMLTemplateElement>{
10
10
  lhs?: any,
@@ -58,8 +58,7 @@ export type SwitchStatement = string;
58
58
 
59
59
  export interface OneValueSwitch{
60
60
  ifPart: string,
61
- specifier: Specifier,
62
- //signal?: WeakRef<SignalRefType>,
61
+ ipe: IPE,
63
62
  req?: boolean,
64
63
  }
65
64
 
@@ -73,12 +72,10 @@ export interface TwoPartOpStatement{
73
72
  }
74
73
 
75
74
  export interface TwoValueSwitch{
76
- lhsSpecifier: Specifier,
77
- rhsSpecifier: Specifier,
78
- withinSpecifier?: Specifier,
75
+ lhsIPE: IPE,
76
+ rhsIPE: IPE,
79
77
  req?: boolean,
80
78
  op?: Op,
81
- //negate?: boolean,
82
79
  lhs?: ISide,
83
80
  rhs?: ISide,
84
81
  onOrOff:
@@ -89,7 +86,7 @@ export interface TwoValueSwitch{
89
86
 
90
87
  }
91
88
 
92
- export interface Dependency extends Specifier{}
89
+ export interface Dependency extends IPE{}
93
90
 
94
91
  export interface CanBeSwitchedOn {
95
92
  switchedOn?: boolean,
@@ -3,20 +3,25 @@ import { HasIshList } from '../trans-render/dss/types';
3
3
 
4
4
  export interface EndUserProps extends IEnhancement{
5
5
  each: string;
6
+
7
+
6
8
  mapIdxTo: string;
7
9
  idxStart: number;
8
10
  idleTimeout: number;
9
11
  options: Partial<EndUserProps>;
12
+ // parsedStatements: Array<LoopingStatement>,
13
+ // rawStatements?: Array<string>,
10
14
  }
11
15
 
12
16
  export interface AllProps extends EndUserProps{
13
- listProp: string;
14
- itemProp: string;
15
- ish: HasIshList;
16
- ishContainer: Element;
17
- itemTemplate: HTMLTemplateElement;
17
+ listScope: string;
18
+ //itemProp: string;
19
+ itemScopes: Array<string>;
20
+ itemTemplates: Array<HTMLTemplateElement>;
18
21
  emc: any;
19
- //updateCnt: number;
22
+ //loopingParameters: Array<LoopingParameters>,
23
+ ish: any;
24
+ ishContainer: Element;
20
25
  }
21
26
 
22
27
  export type AP = AllProps;
@@ -33,3 +38,14 @@ export interface Actions{
33
38
  hydrate(self: BAP)
34
39
  }
35
40
 
41
+ // export interface LoopingStatement {
42
+ // listProp?: string;
43
+ // itemProp: string;
44
+ // }
45
+
46
+ // export interface LoopingParameters extends LoopingStatement {
47
+ // listProp: string;
48
+ // ish: any;
49
+ // ishContainer: Element;
50
+ // }
51
+
@@ -47,7 +47,9 @@ export type AttrSigils =
47
47
 
48
48
  export type ElementSigils = '/' | '~';
49
49
 
50
- export type Sigils = AttrSigils | ElementSigils;
50
+ export type ScopeSigils = '';
51
+
52
+ export type Sigils = AttrSigils | ElementSigils | ScopeSigils;
51
53
 
52
54
  export type asOptions =
53
55
  | 'number'
@@ -69,6 +71,7 @@ export interface $ScopeHierarchy {
69
71
  satellites?: Array<Element>;
70
72
  }
71
73
 
74
+ // deprecated
72
75
  export interface Specifier {
73
76
  /** Directional Scope Sigil */
74
77
  dss?: DirectionalScopeSigils,
@@ -150,6 +153,14 @@ export interface Specifier {
150
153
  enhBase?: string;
151
154
  }
152
155
 
156
+ export interface IPE {
157
+ id?: string,
158
+ path?: SubPropPath,
159
+ evtName?: string,
160
+ as?: asOptions,
161
+ constVal?: any;
162
+ }
163
+
153
164
  export type Modulo = 'aria-rowindex' | 'aria-colindex' | 'aria-rowindextext'
154
165
 
155
166
  export type InferredPropName = string;
@@ -193,7 +193,7 @@ export interface IshConfig<TProps = any, TActions = TProps, ETProps = TProps>{
193
193
  ishListCountProp?: keyof TProps & string;
194
194
  defaultIshList?: any[];
195
195
  mapParentScopeRefTo?: keyof TProps & string;
196
- //mapElTo?: keyof TProps & string; //make sure strong use case before implementing
196
+ mapElTo?: keyof TProps & string;
197
197
  ignoreItemProp?: boolean;
198
198
  }
199
199
  export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps> extends IshConfig<TProps, TActions, ETProps>{
@@ -25,9 +25,13 @@ export interface ElO {
25
25
  export interface RegExpExt<TStatementGroup = any>{
26
26
  regExp: RegExp | string,
27
27
  defaultVals: Partial<TStatementGroup>,
28
+ // deprecated
28
29
  dssKeys?: [string, string][],
30
+ // deprecated
29
31
  dssArrayKeys?: [string, string][],
30
- statementPartParser?: StatementPartParser
32
+ statementPartParser?: StatementPartParser,
33
+ ipeKeys?: [string, string][];
34
+ ipeArrayKeys?: [string, string][];
31
35
  }
32
36
 
33
37
  export interface StatementPartParser {
@@ -65,6 +65,7 @@ export interface TransformOptions{
65
65
  propagatorIsReady?: boolean,
66
66
  skipInit?: boolean,
67
67
  useViewTransition?: boolean,
68
+ outside?: string,
68
69
  }
69
70
 
70
71
  export type Derivative<TProps, TMethods, TElement = {}> =
@@ -354,6 +355,8 @@ export type ValueFromElement<TProps, TMethods, TElement = {}> =
354
355
 
355
356
  export interface ModificationUnitOfWork<TProps, TMethods, TElement = {}>{
356
357
  on: string,
358
+ //Double check that the event is the type expected
359
+ instanceOf?: any,
357
360
  /**
358
361
  * Increment
359
362
  */
@@ -385,6 +388,7 @@ export interface ModificationUnitOfWork<TProps, TMethods, TElement = {}>{
385
388
  to?: any,
386
389
  toValFrom?: string | ValueFromElement<TProps, TMethods, TElement>;
387
390
  toggle?: keyof TProps & string,
391
+ stopPropagation?: boolean,
388
392
  }
389
393
 
390
394
  export interface QuenitOfWork<TProps, TMethods, TElement = {}> extends UnitOfWork<TProps, TMethods, TElement>{
@@ -456,7 +460,7 @@ export interface ITransformer<TProps, TMethods, TElement = {}>{
456
460
  model: TProps & TMethods,
457
461
  xform: XForm<TProps, TMethods, TElement> & Info,
458
462
  options: TransformOptions,
459
- initializedMods: Set<ModificationUnitOfWork<TProps, TMethods, TElement>>
463
+ initializedMods: Set<ModificationUnitOfWork<TProps, TMethods, TElement>>,
460
464
  //propagator?: EventTarget,
461
465
  }
462
466
 
@@ -566,11 +570,11 @@ export interface Clone$Options{
566
570
  ishContainer: Element,
567
571
  seedEl: Element,
568
572
  idxStart: number,
569
- itemProp: string,
573
+ itemScopes: Array<string>,
570
574
  mapIdxTo?: string,
571
- itemTemplate: HTMLTemplateElement;
575
+ itemTemplates: Array<HTMLTemplateElement>;
572
576
  baseCrumb: string,
573
577
  idleTimeout: number,
574
578
  //model?: any,
575
- listProp?: string,
579
+ //listScope: string
576
580
  }
package/waitForIsh.ts CHANGED
@@ -1,4 +1,4 @@
1
- export function waitForIsh(el: Element) : Promise<EventTarget> {
1
+ export function waitForIsh(el: Element) : Promise<any> {
2
2
  return new Promise((resolve, reject) => {
3
3
  const ish = (<any>el)['ish']; // [TODO] should we make this something that can
4
4
  // be passed in, more generic function -- waitForProperty?
@@ -7,7 +7,7 @@ export function waitForIsh(el: Element) : Promise<EventTarget> {
7
7
  } else {
8
8
  // If the element is not yet defined, wait for it to be defined
9
9
  el.addEventListener('ish', () => {
10
- const ish = (<any>el)['ish'] as EventTarget;
10
+ const ish = (<any>el)['ish'];
11
11
  if (ish) {
12
12
  resolve(ish);
13
13
  } else {