mount-observer 0.0.47 → 0.0.48
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 +1 -0
- package/MountObserver.ts +1 -0
- package/Newish.js +19 -0
- package/Newish.ts +18 -1
- package/package.json +1 -1
- package/ts-refs/per-each/types.d.ts +24 -0
- package/ts-refs/trans-render/froop/types.d.ts +26 -8
- package/waitForIsh.js +2 -1
- package/waitForIsh.ts +2 -1
package/MountObserver.js
CHANGED
|
@@ -57,6 +57,7 @@ export class MountObserver extends EventTarget {
|
|
|
57
57
|
this.#calculatedSelector = calculatedSelector;
|
|
58
58
|
return this.#calculatedSelector;
|
|
59
59
|
}
|
|
60
|
+
//This method is called publicly from outside mount-observer -- keep it public
|
|
60
61
|
async composeFragment(fragment, level) {
|
|
61
62
|
const bis = fragment.querySelectorAll(`${inclTemplQry},${itemscopeQry}`);
|
|
62
63
|
for (const bi of bis) {
|
package/MountObserver.ts
CHANGED
|
@@ -68,6 +68,7 @@ export class MountObserver extends EventTarget implements IMountObserver{
|
|
|
68
68
|
return this.#calculatedSelector;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
//This method is called publicly from outside mount-observer -- keep it public
|
|
71
72
|
async composeFragment(fragment: DocumentFragment, level: number){
|
|
72
73
|
const bis = fragment.querySelectorAll(`${inclTemplQry},${itemscopeQry}`) as NodeListOf<HTMLTemplateElement>;
|
|
73
74
|
for(const bi of bis){
|
package/Newish.js
CHANGED
|
@@ -41,6 +41,25 @@ export class Newish {
|
|
|
41
41
|
});
|
|
42
42
|
this.#assignGingerly();
|
|
43
43
|
}
|
|
44
|
+
//attach any itemref references
|
|
45
|
+
if (enhancedElement.hasAttribute('itemref')) {
|
|
46
|
+
const itemref = enhancedElement.getAttribute('itemref');
|
|
47
|
+
const itemrefList = itemref.split(' ');
|
|
48
|
+
let nextSibling = enhancedElement.nextElementSibling;
|
|
49
|
+
while (nextSibling) {
|
|
50
|
+
if (itemrefList.includes(nextSibling.id)) {
|
|
51
|
+
this.#ce.inScopeCallback(nextSibling);
|
|
52
|
+
itemrefList.splice(itemrefList.indexOf(nextSibling.id), 1);
|
|
53
|
+
}
|
|
54
|
+
if (itemrefList.length === 0)
|
|
55
|
+
break;
|
|
56
|
+
nextSibling = nextSibling.nextElementSibling;
|
|
57
|
+
}
|
|
58
|
+
if (itemrefList.length > 0) {
|
|
59
|
+
//TODO add an observer queue for the id found elsewhere
|
|
60
|
+
throw 'NI';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
44
63
|
this.isResolved = true;
|
|
45
64
|
enhancedElement.dispatchEvent(new Event('ishAttached'));
|
|
46
65
|
}
|
package/Newish.ts
CHANGED
|
@@ -43,7 +43,24 @@ export class Newish{
|
|
|
43
43
|
});
|
|
44
44
|
this.#assignGingerly();
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
//attach any itemref references
|
|
47
|
+
if(enhancedElement.hasAttribute('itemref')){
|
|
48
|
+
const itemref = enhancedElement.getAttribute('itemref')!;
|
|
49
|
+
const itemrefList = itemref.split(' ');
|
|
50
|
+
let nextSibling = enhancedElement.nextElementSibling;
|
|
51
|
+
while(nextSibling){
|
|
52
|
+
if(itemrefList.includes(nextSibling.id)){
|
|
53
|
+
(<any>this.#ce).inScopeCallback(nextSibling);
|
|
54
|
+
itemrefList.splice(itemrefList.indexOf(nextSibling.id), 1);
|
|
55
|
+
}
|
|
56
|
+
if(itemrefList.length === 0) break;
|
|
57
|
+
nextSibling = nextSibling.nextElementSibling;
|
|
58
|
+
}
|
|
59
|
+
if(itemrefList.length > 0){
|
|
60
|
+
//TODO add an observer queue for the id found elsewhere
|
|
61
|
+
throw 'NI';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
47
64
|
this.isResolved = true;
|
|
48
65
|
enhancedElement.dispatchEvent(new Event('ishAttached'));
|
|
49
66
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
statement: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AllProps extends EndUserProps{
|
|
8
|
+
listProp: string;
|
|
9
|
+
itemProp: string;
|
|
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
|
+
parse(self: BAP): PAP;
|
|
22
|
+
hydrate(self: BAP): ProPAP;
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -170,10 +170,9 @@ export interface WCConfig<TProps = any, TActions = TProps, TPropInfo = PropInfo,
|
|
|
170
170
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export type PropLookup<TProps = any> = Partial<{[key in keyof TProps]: PropInfo}>;
|
|
174
|
-
|
|
175
|
-
export interface
|
|
176
|
-
|
|
173
|
+
export type PropLookup<TProps = any, TActions = any> = Partial<{[key in keyof TProps]: PropInfo<TProps, TActions>}>;
|
|
174
|
+
export type IshPropLookup<TProps = any, TActions = any> = Partial<{[key in keyof TProps]: IshPropInfo<TProps, TActions>}>;
|
|
175
|
+
export interface IshConfig<TProps = any, TActions = TProps, ETProps = TProps>{
|
|
177
176
|
propDefaults?: Partial<{[key in keyof TProps]: TProps[key]}>;
|
|
178
177
|
propInfo?: Partial<{[key in keyof TProps]: PropInfo}>;
|
|
179
178
|
wrappers?: Partial<{[key in keyof TProps]: WrapperConfig<TProps>}>;
|
|
@@ -186,8 +185,13 @@ export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps>{
|
|
|
186
185
|
hitch?: Hitches<TProps, TActions>;
|
|
187
186
|
handlers?: Handlers<ETProps, TActions>;
|
|
188
187
|
positractions?: Positractions<TProps, TActions>;
|
|
189
|
-
|
|
188
|
+
|
|
190
189
|
isSleepless?: boolean;
|
|
190
|
+
xform?: XForm<TProps, TActions>;
|
|
191
|
+
inScopeXForms?: Array<XForm<TProps, TActions>>;
|
|
192
|
+
}
|
|
193
|
+
export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps> extends IshConfig<TProps, TActions, ETProps>{
|
|
194
|
+
mainTemplate?: string | HTMLTemplateElement;
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
export type Positractions<TProps = any, TActions = TProps> =
|
|
@@ -287,14 +291,26 @@ export interface IActionProcessor{
|
|
|
287
291
|
}
|
|
288
292
|
|
|
289
293
|
type PropInfoTypes = "String" | "Number" | "Boolean" | "Object" | "RegExp";
|
|
290
|
-
|
|
294
|
+
|
|
295
|
+
export interface IshPropInfo<TProps = any, TActions = any>{
|
|
291
296
|
type?: PropInfoTypes;
|
|
292
297
|
dry?: boolean;
|
|
293
|
-
parse?: boolean;
|
|
294
298
|
ro?: boolean;
|
|
299
|
+
propName?: string;
|
|
300
|
+
/**
|
|
301
|
+
* Allow for discarding what is passed in favor of a modified value such as a formatted value
|
|
302
|
+
* or filtered list
|
|
303
|
+
*/
|
|
304
|
+
adjuster?:
|
|
305
|
+
|keyof TActions & string
|
|
306
|
+
|((nv: any) => any)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export interface PropInfo<TProps=any, TActions=any> extends IshPropInfo<TProps, TActions>{
|
|
310
|
+
|
|
311
|
+
parse?: boolean;
|
|
295
312
|
def?: any;
|
|
296
313
|
attrName?: string;
|
|
297
|
-
propName?: string;
|
|
298
314
|
/**
|
|
299
315
|
* form associated read only property
|
|
300
316
|
* https://web.dev/articles/more-capable-form-controls#:~:text=Form-associated%20custom%20elements%20aim%20to%20bridge%20the%20gap,associated%20with%20the%20form%2C%20like%20a%20browser-provided%20control.
|
|
@@ -317,6 +333,8 @@ export interface PropInfo{
|
|
|
317
333
|
* examples: role, ariaRole
|
|
318
334
|
*/
|
|
319
335
|
ip?: boolean;
|
|
336
|
+
|
|
337
|
+
|
|
320
338
|
}
|
|
321
339
|
|
|
322
340
|
export type ConstString = string;
|
package/waitForIsh.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function waitForIsh(el) {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
|
-
const ish = el['ish'];
|
|
3
|
+
const ish = el['ish']; // [TODO] should we make this something that can
|
|
4
|
+
// be passed in, more generic function -- waitForProperty?
|
|
4
5
|
if (ish) {
|
|
5
6
|
resolve(ish);
|
|
6
7
|
}
|
package/waitForIsh.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function waitForIsh(el: Element){
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
|
-
const ish = (<any>el)['ish'];
|
|
3
|
+
const ish = (<any>el)['ish']; // [TODO] should we make this something that can
|
|
4
|
+
// be passed in, more generic function -- waitForProperty?
|
|
4
5
|
if (ish) {
|
|
5
6
|
resolve(ish);
|
|
6
7
|
} else {
|