mount-observer 0.0.89 → 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 +8 -0
- package/MountObserver.ts +9 -0
- package/README.md +24 -3
- package/package.json +1 -1
- package/refid/arr.js +4 -0
- package/refid/arr.ts +4 -0
- package/refid/genIds.js +130 -0
- package/refid/genIds.ts +126 -0
- package/refid/getCount.js +8 -0
- package/refid/getCount.ts +8 -0
- package/refid/nudge.js +23 -0
- package/refid/nudge.ts +23 -0
- package/ts-refs/be-a-beacon/types.d.ts +4 -2
- package/ts-refs/be-enhancing/types.d.ts +2 -2
- package/ts-refs/be-giddy/types.d.ts +26 -0
- package/ts-refs/be-switched/types.d.ts +5 -8
- package/ts-refs/per-each/types.d.ts +22 -6
- package/ts-refs/trans-render/dss/types.d.ts +12 -1
- package/ts-refs/trans-render/lib/prs/types.d.ts +5 -1
- package/ts-refs/trans-render/types.d.ts +8 -4
- package/waitForIsh.ts +2 -2
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
|
|
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
|
|
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
|
|
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
package/refid/arr.js
ADDED
package/refid/arr.ts
ADDED
package/refid/genIds.js
ADDED
|
@@ -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
|
+
}
|
package/refid/genIds.ts
ADDED
|
@@ -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
|
+
}
|
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
|
+
}
|
|
@@ -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<
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
|
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
|
-
|
|
14
|
-
itemProp: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
itemTemplate: HTMLTemplateElement;
|
|
17
|
+
listScope: string;
|
|
18
|
+
//itemProp: string;
|
|
19
|
+
itemScopes: Array<string>;
|
|
20
|
+
itemTemplates: Array<HTMLTemplateElement>;
|
|
18
21
|
emc: any;
|
|
19
|
-
//
|
|
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
|
|
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;
|
|
@@ -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
|
-
|
|
573
|
+
itemScopes: Array<string>,
|
|
570
574
|
mapIdxTo?: string,
|
|
571
|
-
|
|
575
|
+
itemTemplates: Array<HTMLTemplateElement>;
|
|
572
576
|
baseCrumb: string,
|
|
573
577
|
idleTimeout: number,
|
|
574
578
|
//model?: any,
|
|
575
|
-
|
|
579
|
+
//listScope: string
|
|
576
580
|
}
|
package/waitForIsh.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function waitForIsh(el: Element) : Promise<
|
|
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']
|
|
10
|
+
const ish = (<any>el)['ish'];
|
|
11
11
|
if (ish) {
|
|
12
12
|
resolve(ish);
|
|
13
13
|
} else {
|