mount-observer 0.0.101 → 0.0.103
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 +12 -4
- package/refid/README.md +259 -0
- package/refid/itemprops.js +30 -0
- package/refid/itemprops.ts +27 -0
- package/ts-refs/be-dispatching/types.d.ts +41 -0
- package/ts-refs/be-render-neutral/types.d.ts +3 -1
- package/ts-refs/be-valued/types.d.ts +22 -0
- package/ts-refs/be-written/types.d.ts +33 -11
- package/ts-refs/data-props/types.d.ts +27 -0
- package/ts-refs/trans-render/froop/types.d.ts +12 -92
- package/ts-refs/trans-render/types.d.ts +2 -0
- package/ts-refs/xtal-element/types.d.ts +3 -2
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mount-observer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "Observe and act on css matches.",
|
|
5
5
|
"main": "MountObserver.js",
|
|
6
6
|
"module": "MountObserver.js",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@playwright/test": "1.55.
|
|
9
|
-
"ssi
|
|
8
|
+
"@playwright/test": "1.55.1",
|
|
9
|
+
"spa-ssi": "0.0.23"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
"default": "./refid/camelToKebab.js",
|
|
54
54
|
"types": "./refid/camelToKebab.ts"
|
|
55
55
|
},
|
|
56
|
+
"./refid/refid/genIds.js": {
|
|
57
|
+
"default": "./refid/refid/genIds.js",
|
|
58
|
+
"types": "./refid/refid/genIds.ts"
|
|
59
|
+
},
|
|
56
60
|
"./refid/getAdjRefs.js": {
|
|
57
61
|
"default": "./refid/getAdjRefs.js",
|
|
58
62
|
"types": "./refid/getAdjRefs.ts"
|
|
@@ -65,6 +69,10 @@
|
|
|
65
69
|
"default": "./refid/getCount.js",
|
|
66
70
|
"types": "./refid/getCount.ts"
|
|
67
71
|
},
|
|
72
|
+
"./refid/itemprops.js": {
|
|
73
|
+
"default": "./refid/itemprops.js",
|
|
74
|
+
"types": "./refid/itemprops.ts"
|
|
75
|
+
},
|
|
68
76
|
"./refid/joinMatching.js": {
|
|
69
77
|
"default": "./refid/joinMatching.js",
|
|
70
78
|
"types": "./refid/joinMatching.ts"
|
|
@@ -115,7 +123,7 @@
|
|
|
115
123
|
],
|
|
116
124
|
"types": "./ts-refs/mount-observer/types.d.ts",
|
|
117
125
|
"scripts": {
|
|
118
|
-
"serve": "
|
|
126
|
+
"serve": "node ./node_modules/spa-ssi/serve.js",
|
|
119
127
|
"test": "playwright test",
|
|
120
128
|
"safari": "npx playwright wk http://localhost:8000",
|
|
121
129
|
"update": "ncu -u && npm install"
|
package/refid/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Auto generated id polyfill
|
|
2
|
+
|
|
3
|
+
*mount-observer* has a polyfill for [this proposal](https://github.com/whatwg/html/issues/11585), but with some differences due to the limited ability a polyfill can provide compared to the platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Any DOM fragment that gets observed by the MountObserver class instance will automatically apply the rules discussed below.
|
|
8
|
+
|
|
9
|
+
In the absence of such observing, call:
|
|
10
|
+
|
|
11
|
+
```JavaScript
|
|
12
|
+
import {genIds} from 'mount-observer/refid/genIds.js';
|
|
13
|
+
genIds(oElementContainer);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Activation
|
|
17
|
+
|
|
18
|
+
To activate a scoped id generation, add attribute -id to the last streamed element inside either the fieldset element, or an element adorned by the itemscope attribute, or the (Shadow) root.
|
|
19
|
+
|
|
20
|
+
If the -id attribute is not added to the last streamed element, but elsewhere, then the functionality will likely work the same, but may possibly miss some elements after the attribute, in the unlikely event that the auto generated id's are created prior to some additional elements streaming in.
|
|
21
|
+
|
|
22
|
+
## Example 1
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<fieldset disabled>
|
|
26
|
+
<label>
|
|
27
|
+
LHS: <input data-id={{lhs}}>
|
|
28
|
+
</label>
|
|
29
|
+
|
|
30
|
+
<label for=rhs>
|
|
31
|
+
RHS: <input data-id={{rhs}}>
|
|
32
|
+
</label>
|
|
33
|
+
|
|
34
|
+
<template -id defer-🎚️ 🎚️='on if isEqual, based on #{{lhs}} and #{{rhs}}.'>
|
|
35
|
+
<div>LHS === RHS</div>
|
|
36
|
+
</template>
|
|
37
|
+
</fieldset>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
adjusts the DOM so as to become:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<fieldset>
|
|
44
|
+
<label>
|
|
45
|
+
LHS: <input id=gid-0 data-id=lhs>
|
|
46
|
+
</label>
|
|
47
|
+
|
|
48
|
+
<label for=rhs>
|
|
49
|
+
RHS: <input id=gid-1 data-id=rhs>
|
|
50
|
+
</label>
|
|
51
|
+
|
|
52
|
+
<template 🎚️='on if isEqual, based on #gid-0 and #gid-1.'>
|
|
53
|
+
<div>LHS === RHS</div>
|
|
54
|
+
</template>
|
|
55
|
+
</fieldset>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Note that the numbers after gid- will vary depending on previous DOM elements that may have been processed by the ID generator.
|
|
59
|
+
|
|
60
|
+
Note the use of the "disabled" attribute on the fieldset element, and the defer-🎚️ attributes, both of which get removed after the id auto generation completes. The idea is that while the live DOM tree has these attributes, allowing user interactivity could be problematic before the id's are generated, so at a minimum, we should disable input elements, and prevent [enhancements from loading](https://github.com/WICG/webcomponents/issues/1000) until the id connection is established, scoped preferably by fieldset elements, or itemscope attributes, or the root document as a last resort.
|
|
61
|
+
|
|
62
|
+
The reason why we keep the names lhs, rhs in the data-id attribute after stripping away curly braces and other side-effect inducing symbols, is that some libraries will want to refer to the name that was used to generate the id's.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Creating id references with global or built in attributes
|
|
66
|
+
|
|
67
|
+
Again, because 1. unlike the platform, we can't manipulate the server-streamed DOM before the browser sees it, and 2. we don't want to "confuse" the browser by creating nonsensical id reference connections that aren't valid, even temporarily, this polyfill opts to use data-* attributes as a way of staging the dynamic attribute adjustments. So for example:
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<fieldset disabled>
|
|
71
|
+
<scratch-box>
|
|
72
|
+
<label slot=label data-for={{createDemo}}>Create demo</label>
|
|
73
|
+
<input data-id="{{@ createDemo}}" type=checkbox>
|
|
74
|
+
</scratch-box>
|
|
75
|
+
<scratch-box>
|
|
76
|
+
<label slot=label data-for={{writeArticle}}>Write article</label>
|
|
77
|
+
<input data-id="{{@ writeArticle}}" type=checkbox>
|
|
78
|
+
</scratch-box>
|
|
79
|
+
<scratch-box>
|
|
80
|
+
<label slot=label data-for={{exercise}}>Exercise</label>
|
|
81
|
+
<input -id data-id="{{@ exercise}}" type=checkbox>
|
|
82
|
+
</scratch-box>
|
|
83
|
+
</fieldset>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
becomes
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<fieldset disabled>
|
|
90
|
+
<scratch-box enh-be-importing=scratch-box/root.mjs>
|
|
91
|
+
<label slot=label for=gid-0>Create demo</label>
|
|
92
|
+
<input id=gid-0 name=createDemo data-id=createDemo type=checkbox>
|
|
93
|
+
</scratch-box>
|
|
94
|
+
<scratch-box>
|
|
95
|
+
<label slot=label for=gid-1>Write article</label>
|
|
96
|
+
<input id=gid-1 name=writeArticle data-id=writeArticle type=checkbox>
|
|
97
|
+
</scratch-box>
|
|
98
|
+
<scratch-box>
|
|
99
|
+
<label slot=label for=gid-2>Exercise</label>
|
|
100
|
+
<input id=gid-2 name=exercise data-id=exercise type=checkbox>
|
|
101
|
+
</scratch-box>
|
|
102
|
+
</fieldset>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
It is often the case that the name we want to use to auto generate the unique id's will match the "name" attribute we want to assign the element, and/or the itemprop and/or the class and/or the part. This can be done in a few ways.
|
|
106
|
+
|
|
107
|
+
## Side Effects from dynamic data-id attribute
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<form>
|
|
111
|
+
<fieldset disabled>
|
|
112
|
+
<label>
|
|
113
|
+
LHS: <input class=my-class data-id="{{@. lhs}}">
|
|
114
|
+
</label>
|
|
115
|
+
|
|
116
|
+
<label for=rhs>
|
|
117
|
+
RHS: <span contenteditable part=my-part data-id="{{|% rhs}}">
|
|
118
|
+
</label>
|
|
119
|
+
|
|
120
|
+
<template -id defer-🎚️ 🎚️='on if isEqual, based on #{{lhs}} and #{{rhs}}.'>
|
|
121
|
+
<div>LHS === RHS</div>
|
|
122
|
+
</template>
|
|
123
|
+
</fieldset>
|
|
124
|
+
</form>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
results in
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<form>
|
|
131
|
+
<fieldset>
|
|
132
|
+
<label>
|
|
133
|
+
LHS: <input name=lhs class="my-part lhs" id=gid-0 data-id=lhs>
|
|
134
|
+
</label>
|
|
135
|
+
|
|
136
|
+
<label for=rhs>
|
|
137
|
+
RHS: <span itemprop=rhs part="my-part rhs" id=gid-1 data-id=rhs>
|
|
138
|
+
</label>
|
|
139
|
+
|
|
140
|
+
<template 🎚️='on if isEqual, based on #gid-0 and #gid-1.'>
|
|
141
|
+
<div>LHS === RHS</div>
|
|
142
|
+
</template>
|
|
143
|
+
</fieldset>
|
|
144
|
+
</form>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
So we are using some special symbols to correspond with key attributes:
|
|
148
|
+
|
|
149
|
+
Symbol | Translates to | Connection / meaning |
|
|
150
|
+
|--------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
151
|
+
| # | id | # used by css for id, also bookmarks in urls that points to id's |
|
|
152
|
+
| \| | itemprop | "Pipe" is kind of close to itemprop, and is half of a dollar sign, and it kind of looks like an I |
|
|
153
|
+
| @ | name | Second letter of name. Also, common in social media sites/github to type this letter in order to select someone's name. |
|
|
154
|
+
| $ | itemscope + itemprop | Combination of S for Scope and Pipe which resembles itemprop a bit |
|
|
155
|
+
| % | part | Starts with p, percent is used for indicating what proportion something is. |
|
|
156
|
+
| . | class | css selector |
|
|
157
|
+
|
|
158
|
+
These match the symbols used in the [template instantiation productivity proposal](https://github.com/WICG/webcomponents/issues/1013#issuecomment-2257557589).
|
|
159
|
+
|
|
160
|
+
The examples that follow go in the opposite direction -- we "infer" the id generating name based on either the name of the element, or one of the key attributes
|
|
161
|
+
|
|
162
|
+
## By tag name
|
|
163
|
+
|
|
164
|
+
Id's based on the element name
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<ways-of-science itemscope>
|
|
168
|
+
<carrot-nosed-woman #></carrot-nosed-woman>
|
|
169
|
+
<a-duck #></a-duck>
|
|
170
|
+
<template -id defer-🎚️
|
|
171
|
+
🎚️="on based on #{{carrot-nosed-woman}}::weight-change and #{{a-duck}}::molting."
|
|
172
|
+
onchange="event.r = Math.abs(event.args[0] - event.args[1]) < 10"
|
|
173
|
+
>
|
|
174
|
+
<div>A witch!</div>
|
|
175
|
+
<div>Burn her!</div>
|
|
176
|
+
</template>
|
|
177
|
+
</ways-of-science>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
results in:
|
|
181
|
+
|
|
182
|
+
```html
|
|
183
|
+
<ways-of-science itemscope>
|
|
184
|
+
<carrot-nosed-woman id=gid-0 data-id=carrot-nosed-woman></carrot-nosed-woman>
|
|
185
|
+
<a-duck id=gid-1 data-id=a-duck></a-duck>
|
|
186
|
+
<template
|
|
187
|
+
🎚️="on based on #gid-0::weight-change and #gid-1::molting."
|
|
188
|
+
onchange="event.r = Math.abs(event.args[0] - event.args[1]) < 10"
|
|
189
|
+
>
|
|
190
|
+
<div>A witch!</div>
|
|
191
|
+
<div>Burn her!</div>
|
|
192
|
+
</template>
|
|
193
|
+
</ways-of-science>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## By N@me
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<form>
|
|
200
|
+
<fieldset disabled>
|
|
201
|
+
<input name=isHappy type="checkbox" @>
|
|
202
|
+
<template -id defer-🎚️ 🎚️='on when #{{isHappy}}.'>
|
|
203
|
+
<my-content></my-content>
|
|
204
|
+
</template>
|
|
205
|
+
</fieldset>
|
|
206
|
+
</form>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
results in:
|
|
210
|
+
|
|
211
|
+
```html
|
|
212
|
+
<form>
|
|
213
|
+
<fieldset>
|
|
214
|
+
<input name=isHappy id=gid-0 data-id=isHappy type="checkbox">
|
|
215
|
+
<template 🎚️='on when #gid-0.'>
|
|
216
|
+
<my-content></my-content>
|
|
217
|
+
</template>
|
|
218
|
+
</fieldset>
|
|
219
|
+
</form>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## By |temprop
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<form>
|
|
226
|
+
<fieldset disabled>
|
|
227
|
+
<data value=true itemprop=isHappy hidden |></data>
|
|
228
|
+
<template -id defer-🎚️ 🎚️='on when #{{isHappy}}.'>
|
|
229
|
+
<my-content></my-content>
|
|
230
|
+
</template>
|
|
231
|
+
</fieldset>
|
|
232
|
+
</form>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
results in:
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<form>
|
|
239
|
+
<fieldset>
|
|
240
|
+
<data value=true data-id=isHappy id=gid-0 itemprop=isHappy hidden></data>
|
|
241
|
+
<template 🎚️='on when #gid-0.'>
|
|
242
|
+
<my-content></my-content>
|
|
243
|
+
</template>
|
|
244
|
+
</fieldset>
|
|
245
|
+
</form>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
<!--
|
|
249
|
+
## By Itemscope
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<table>
|
|
253
|
+
<tbody>
|
|
254
|
+
<tr itemscope=myRowHandler #>
|
|
255
|
+
</tr>
|
|
256
|
+
</tbody>
|
|
257
|
+
</table>
|
|
258
|
+
```
|
|
259
|
+
-->
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function getScopedChildren(element, lookup) {
|
|
3
|
+
if (lookup === undefined)
|
|
4
|
+
lookup = {};
|
|
5
|
+
for (const child of element.children) {
|
|
6
|
+
const itemprop = child.getAttribute('itemprop');
|
|
7
|
+
if (itemprop !== null) {
|
|
8
|
+
const lookupItemProp = lookup[itemprop];
|
|
9
|
+
if (lookupItemProp) {
|
|
10
|
+
if (!Array.isArray(lookupItemProp)) {
|
|
11
|
+
lookup[itemprop] = [lookupItemProp];
|
|
12
|
+
}
|
|
13
|
+
lookup[itemprop].push(child);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
lookup[itemprop] = child;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!child.hasAttribute('itemscope')) {
|
|
20
|
+
getScopedChildren(child, lookup);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(Element.prototype, 'itemprops', {
|
|
25
|
+
get() {
|
|
26
|
+
if (!this.hasAttribute('itemscope'))
|
|
27
|
+
return undefined;
|
|
28
|
+
return getScopedChildren(this);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function getScopedChildren(element: Element, lookup?: {[key: string]: Element | Element[]}){
|
|
2
|
+
if(lookup === undefined) lookup = {};
|
|
3
|
+
for(const child of element.children){
|
|
4
|
+
const itemprop = child.getAttribute('itemprop');
|
|
5
|
+
if(itemprop !== null){
|
|
6
|
+
const lookupItemProp = lookup[itemprop]
|
|
7
|
+
if(lookupItemProp){
|
|
8
|
+
if(!Array.isArray(lookupItemProp)){
|
|
9
|
+
lookup[itemprop] = [lookupItemProp];
|
|
10
|
+
}
|
|
11
|
+
(lookup[itemprop] as Element[]).push(child);
|
|
12
|
+
}else{
|
|
13
|
+
lookup[itemprop] = child;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if(!child.hasAttribute('itemscope')){
|
|
17
|
+
getScopedChildren(child, lookup);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(Element.prototype, 'itemprops', {
|
|
22
|
+
get(){
|
|
23
|
+
if(!this.hasAttribute('itemscope')) return undefined;
|
|
24
|
+
return getScopedChildren(this);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AllProps extends EndUserProps{
|
|
8
|
+
crudeDispatchRules: Array<CrudeDispatchRule>,
|
|
9
|
+
dispatchRules: Array<DispatchRule>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type DispatchStatement = string;
|
|
13
|
+
|
|
14
|
+
export interface CrudeDispatchRule{
|
|
15
|
+
dispatchOn?: string,
|
|
16
|
+
dispatchOnPropChange?: string,
|
|
17
|
+
qualifiers: string,
|
|
18
|
+
dispatch: string,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DispatchRule extends CrudeDispatchRule{
|
|
22
|
+
|
|
23
|
+
bubbles?: boolean,
|
|
24
|
+
cancelable?: boolean,
|
|
25
|
+
composed?: boolean,
|
|
26
|
+
replace?: boolean,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type AP = AllProps;
|
|
30
|
+
|
|
31
|
+
export type PAP = Partial<AP>;
|
|
32
|
+
|
|
33
|
+
export type ProPAP = Promise<PAP>;
|
|
34
|
+
|
|
35
|
+
export type BAP = AP & BEAllProps;
|
|
36
|
+
|
|
37
|
+
export interface Actions{
|
|
38
|
+
//onCamelized(self: this): ProPAP;
|
|
39
|
+
finishParsing(self: BAP): PAP;
|
|
40
|
+
hydrate(self: BAP): ProPAP;
|
|
41
|
+
}
|
|
@@ -10,8 +10,10 @@ export interface EndUserProps extends IEnhancement<RenderingHTMLScriptElement>{
|
|
|
10
10
|
with: Array<string>,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export type Renderer = (vm: any, html: any) => any;
|
|
14
|
+
|
|
13
15
|
export interface AP extends EndUserProps{
|
|
14
|
-
renderer:
|
|
16
|
+
renderer: Renderer,
|
|
15
17
|
absorbingObject: AbsorbingObject
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
on: string[],
|
|
5
|
+
props: string[],
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AllProps extends EndUserProps {}
|
|
9
|
+
|
|
10
|
+
export type AP = AllProps;
|
|
11
|
+
|
|
12
|
+
export type PAP = Partial<AP>;
|
|
13
|
+
|
|
14
|
+
export type ProPAP = Promise<PAP>;
|
|
15
|
+
|
|
16
|
+
export type BAP = AP & BEAllProps;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export interface Actions{
|
|
20
|
+
hydrate(self: BAP): void;
|
|
21
|
+
//finale(proxy: Proxy, target: Element, beDecorProps: BeDecoratedProps): void;
|
|
22
|
+
}
|
|
@@ -4,18 +4,39 @@ import {Inserts} from '../../node_modules/stream-orator/types';
|
|
|
4
4
|
|
|
5
5
|
export interface EndUserProps extends IEnhancement{
|
|
6
6
|
from?: string,
|
|
7
|
-
to
|
|
7
|
+
to: string,
|
|
8
8
|
shadowRootMode?: 'open' | 'closed',
|
|
9
|
-
encoding
|
|
10
|
-
reqInit
|
|
11
|
-
wrapper
|
|
12
|
-
beBased
|
|
13
|
-
beOosoom
|
|
14
|
-
defer
|
|
15
|
-
inProgressCss
|
|
16
|
-
inserts
|
|
17
|
-
between
|
|
18
|
-
once
|
|
9
|
+
encoding: 'UTF-8' | 'UTF-16'
|
|
10
|
+
reqInit: RequestInit,
|
|
11
|
+
wrapper: string,
|
|
12
|
+
beBased: boolean | BeBasedEndUserProps,
|
|
13
|
+
beOosoom: string,
|
|
14
|
+
defer: boolean,
|
|
15
|
+
inProgressCss: string,
|
|
16
|
+
inserts:Inserts,
|
|
17
|
+
between: [lhs: string, rhs: string],
|
|
18
|
+
once: boolean,
|
|
19
|
+
onNavigate: OnNavigationProps
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//https://www.npmjs.com/package/urlpattern-polyfill
|
|
23
|
+
interface URLPatternInit {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
username?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
protocol?: string;
|
|
28
|
+
hostname?: string;
|
|
29
|
+
port?: string;
|
|
30
|
+
pathname?: string;
|
|
31
|
+
search?: string;
|
|
32
|
+
hash?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface OnNavigationProps {
|
|
36
|
+
whereSrcElementMatches: string,
|
|
37
|
+
whereDestMatchesURLPattern: URLPatternInit,
|
|
38
|
+
map: {[key: string]: string},
|
|
39
|
+
minMem: boolean,
|
|
19
40
|
}
|
|
20
41
|
|
|
21
42
|
export interface AllProps extends EndUserProps{
|
|
@@ -33,5 +54,6 @@ export type ProPAP = Promise<PAP>;
|
|
|
33
54
|
|
|
34
55
|
|
|
35
56
|
export interface Actions{
|
|
57
|
+
hydrate(self: AP & BEAllProps): ProPAP;
|
|
36
58
|
write(self: AP & BEAllProps): ProPAP;
|
|
37
59
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {BEAllProps, IEnhancement} from '../trans-render/be/types';
|
|
2
|
+
import { Specifier } from "../trans-render/dss/types";
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps extends IEnhancement<HTMLElement>{
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AllProps extends EndUserProps{
|
|
9
|
+
parsedStatements: Array<DataPropParameters>,
|
|
10
|
+
rawStatements?: Array<string>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DataPropParameters{
|
|
14
|
+
remoteSpecifiers: Array<Specifier>,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type AP = AllProps;
|
|
18
|
+
|
|
19
|
+
export type PAP = Partial<AP>;
|
|
20
|
+
|
|
21
|
+
export type ProPAP = Promise<PAP>;
|
|
22
|
+
|
|
23
|
+
export type BAP = AP & BEAllProps<HTMLElement>;
|
|
24
|
+
|
|
25
|
+
export interface Actions{
|
|
26
|
+
hydrate(self: BAP) : ProPAP;
|
|
27
|
+
}
|
|
@@ -21,66 +21,7 @@ export interface IEventConfig<MCProps = any, MCActions = MCProps, TAction = Acti
|
|
|
21
21
|
//Is anything using this anymore?
|
|
22
22
|
export type ActionOnEventConfigs<MCProps = any, MCActions = MCProps, TAction = Action> = Partial<{[key in keyof MCActions]: IEventConfig<MCProps, MCActions, TAction>}>
|
|
23
23
|
|
|
24
|
-
export interface IPropagator extends EventTarget{
|
|
25
|
-
get(key: string): any;
|
|
26
|
-
set(key: string, val: any): void;
|
|
27
|
-
/**
|
|
28
|
-
* Delta Keys
|
|
29
|
-
*/
|
|
30
|
-
dk: Set<string>;
|
|
31
24
|
|
|
32
|
-
/**
|
|
33
|
-
* Mature keys
|
|
34
|
-
*/
|
|
35
|
-
mk: Set<string>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* timeout handles - key is name of prop
|
|
39
|
-
* used for simple debouncing of echo notifications in XtalElement
|
|
40
|
-
*/
|
|
41
|
-
eth: Map<string, string | number | NodeJS.Timeout> | undefined;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* timeout handles - key is name of prop
|
|
45
|
-
* used for simple debouncing of toggle echo notifications in XtalElement
|
|
46
|
-
*/
|
|
47
|
-
tth: Map<string, string | number | NodeJS.Timeout> | undefined;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface IResolvableService extends EventTarget{
|
|
51
|
-
resolved: boolean;
|
|
52
|
-
resolve(): Promise<void>;
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface IInstanceResolvableService<T extends object = object> extends IResolvableService{
|
|
57
|
-
instanceResolve(instance: T): Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface IMix extends IResolvableService{
|
|
61
|
-
ext: {new(): HTMLElement}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface IPropRegistrar extends IResolvableService{
|
|
65
|
-
propInfos: {[key: string]: PropInfo},
|
|
66
|
-
allPropNames: string[],
|
|
67
|
-
getAttrNames(ext: any): Promise<string[]>,
|
|
68
|
-
getPropsFromAction(action: string | Action): Set<string>,
|
|
69
|
-
nonDryProps: Set<string>,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// export interface IDefine extends IResolvableService{
|
|
73
|
-
// custElClass: {new(): HTMLElement};
|
|
74
|
-
// resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
|
|
75
|
-
// }
|
|
76
|
-
|
|
77
|
-
export interface IPropSvc extends IResolvableService{
|
|
78
|
-
createPropBag(instance: Element): void;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface IHookup extends IInstanceResolvableService{
|
|
82
|
-
|
|
83
|
-
}
|
|
84
25
|
|
|
85
26
|
export interface IAttrChgCB{
|
|
86
27
|
instance: HTMLElement,
|
|
@@ -91,9 +32,7 @@ export interface IAttrChgCB{
|
|
|
91
32
|
filteredAttrs: {[key: string]: string}
|
|
92
33
|
}
|
|
93
34
|
|
|
94
|
-
|
|
95
|
-
instance: HTMLElement,
|
|
96
|
-
}
|
|
35
|
+
|
|
97
36
|
|
|
98
37
|
export interface IPropChg{
|
|
99
38
|
key: string,
|
|
@@ -102,39 +41,11 @@ export interface IPropChg{
|
|
|
102
41
|
|
|
103
42
|
}
|
|
104
43
|
|
|
105
|
-
export interface IDisconnectedCB {
|
|
106
|
-
instance: HTMLElement
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface INewPropagator {
|
|
110
|
-
instance: HTMLElement,
|
|
111
|
-
propagator: IPropagator,
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// export interface CEArgs<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction extends Action<TProps> = Action<TProps>> extends DefineArgs<TProps, TActions, TPropInfo, TAction>{
|
|
119
|
-
// definer?: IDefine,
|
|
120
|
-
// servers?: CEServiceClasses
|
|
121
|
-
// services?: CEServices,
|
|
122
|
-
// asides?: any
|
|
123
|
-
// }
|
|
124
|
-
|
|
125
44
|
export interface DynamicTransform {
|
|
126
45
|
scope?: Scope,
|
|
127
46
|
noCache?: boolean,
|
|
128
47
|
}
|
|
129
48
|
|
|
130
|
-
export interface IPE {
|
|
131
|
-
do(instance: EventTarget, originMethodName: string, vals: [any, ActionOnEventConfigs] ): Promise<void>,
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface IPET extends IPE{
|
|
135
|
-
re(instance: EventTarget, originMethodName: string, vals: [any, ActionOnEventConfigs, DynamicTransform] ): Promise<void>,
|
|
136
|
-
}
|
|
137
|
-
|
|
138
49
|
export interface DefineArgs<MixinCompositeProps = any, MixinCompositeActions = MixinCompositeProps, TPropInfo = PropInfo, TAction extends Action = Action<MixinCompositeProps>>{
|
|
139
50
|
superclass?: {new(): HTMLElement} | string,
|
|
140
51
|
mixins?: any[],
|
|
@@ -185,6 +96,7 @@ export interface IshConfig<TProps = any, TActions = TProps, ETProps = TProps>{
|
|
|
185
96
|
compacts?: Compacts<TProps, TActions>;
|
|
186
97
|
hitch?: Hitches<TProps, TActions>;
|
|
187
98
|
handlers?: Handlers<ETProps, TActions>;
|
|
99
|
+
extHandlers?: ExtHandlers<TProps>;
|
|
188
100
|
positractions?: Positractions<TProps, TActions>;
|
|
189
101
|
|
|
190
102
|
isSleepless?: boolean;
|
|
@@ -228,8 +140,16 @@ export type Compacts<TProps = any, TActions = TProps> =
|
|
|
228
140
|
;
|
|
229
141
|
|
|
230
142
|
export type Hitches<TProps = any, TActions = TProps> =
|
|
231
|
-
| Partial<{[key in `when_${keyof TProps & string}_emits_${keyof TProps & string}_inc_${keyof TProps & string}_by`]: number}>
|
|
232
|
-
|
|
143
|
+
| Partial<{[key in `when_${keyof TProps & string}_emits_${keyof TProps & string}_inc_${keyof TProps & string}_by`]: number}>
|
|
144
|
+
;
|
|
145
|
+
|
|
146
|
+
export interface ExtHandlerOptions {
|
|
147
|
+
on: string,
|
|
148
|
+
stopPropagation?: boolean,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type ExtHandlers<ETProps = any> =
|
|
152
|
+
| Partial<{[key in `inc_${keyof TProps & string}` & string]: ExtHandlerOptions}>
|
|
233
153
|
;
|
|
234
154
|
|
|
235
155
|
export type Handlers<ETProps = any, TActions = ETProps> =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { XForm } from "trans-render/types";
|
|
2
2
|
import { PropInfo, Actions } from 'trans-render/froop/types';
|
|
3
3
|
import {Scope} from 'trans-render/lib/types';
|
|
4
|
+
import { Compacts, WCConfig } from "../trans-render/froop/types";
|
|
4
5
|
|
|
5
6
|
export interface PropInferenceCriteria{
|
|
6
7
|
cssSelector: string,
|
|
@@ -8,7 +9,7 @@ export interface PropInferenceCriteria{
|
|
|
8
9
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export interface EndUserProps<TProps = any, TActions = TProps> {
|
|
12
|
+
export interface EndUserProps<TProps = any, TActions = TProps> extends WCConfig<TProps, TActions>{
|
|
12
13
|
aka?: string,
|
|
13
14
|
inferProps?: boolean,
|
|
14
15
|
xform?: XForm<TProps, TActions>,
|
|
@@ -16,7 +17,7 @@ export interface EndUserProps<TProps = any, TActions = TProps> {
|
|
|
16
17
|
shadowRootMode?: ShadowRootMode,
|
|
17
18
|
propDefaults?: Partial<TProps>,
|
|
18
19
|
propInfo: Partial<{[key in keyof TProps]: PropInfo}>,
|
|
19
|
-
compacts
|
|
20
|
+
compacts?: Compacts<TProps, TActions>,
|
|
20
21
|
targetScope?: Scope,
|
|
21
22
|
assumeCSR?: boolean,
|
|
22
23
|
propInferenceCriteria?: Array<PropInferenceCriteria>,
|