mount-observer 0.0.104 → 0.0.106
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/Events.js +42 -0
- package/Events.ts +45 -0
- package/MountObserver.js +62 -94
- package/MountObserver.ts +63 -87
- package/package.json +5 -1
- package/readAttrs.ts +60 -0
- package/refid/ism.js +80 -0
- package/refid/ism.ts +82 -0
- package/refid/itemprops.js +1 -1
- package/refid/itemprops.ts +1 -1
- package/refid/stdVal.js +15 -0
- package/refid/stdVal.ts +15 -0
- package/ts-refs/be-consoling/types.d.ts +25 -0
- package/ts-refs/be-evanescent/types.d.ts +20 -0
- package/ts-refs/be-fetching/types.d.ts +73 -0
- package/ts-refs/be-gone/types.d.ts +24 -0
- package/ts-refs/be-intersectional/types.d.ts +37 -0
- package/ts-refs/be-lazy/types.d.ts +29 -0
- package/ts-refs/be-parsing/types.d.ts +37 -0
- package/ts-refs/do-invoke/types.d.ts +3 -3
- package/ts-refs/fetch-for/types.d.ts +37 -0
- package/ts-refs/for-fetch/doc.d.ts +98 -0
- package/ts-refs/for-fetch/types.d.ts +4 -96
- package/ts-refs/soak-up/types.d.ts +36 -0
- package/ts-refs/trans-render/froop/types.d.ts +14 -5
- package/ts-refs/trans-render/types.d.ts +4 -3
- package/ts-refs/wc-info/SimpleWCInfo.d.ts +15 -0
package/refid/ism.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { upShadowSearch } from '../upShadowSearch.js';
|
|
2
|
+
import { stdVal } from './stdVal.js';
|
|
3
|
+
Object.defineProperty(HTMLElement.prototype, 'ishm', {
|
|
4
|
+
get() {
|
|
5
|
+
const el = this;
|
|
6
|
+
return parse(el);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const parsedItempropmaps = new WeakMap();
|
|
10
|
+
export function parse(el, obj = {}) {
|
|
11
|
+
const itemprop = el.getAttribute('itemprop');
|
|
12
|
+
if (itemprop) {
|
|
13
|
+
obj[itemprop] = stdVal(el); //TODO full logic
|
|
14
|
+
}
|
|
15
|
+
const itempropmap = el.getAttribute('itempropmap');
|
|
16
|
+
if (itempropmap) {
|
|
17
|
+
//const el = document.getElementById(itempropmap);
|
|
18
|
+
const jsonEl = upShadowSearch(el, itempropmap);
|
|
19
|
+
if (!jsonEl)
|
|
20
|
+
throw 500;
|
|
21
|
+
if (!parsedItempropmaps.has(jsonEl)) {
|
|
22
|
+
parsedItempropmaps.set(jsonEl, JSON.parse(jsonEl.innerHTML));
|
|
23
|
+
}
|
|
24
|
+
const parsed = /** @type {ItemPropMap} */ (parsedItempropmaps.get(jsonEl));
|
|
25
|
+
for (const key in parsed) {
|
|
26
|
+
const attr = el.getAttribute(key);
|
|
27
|
+
if (attr === null)
|
|
28
|
+
continue;
|
|
29
|
+
const rhs = parsed[key];
|
|
30
|
+
switch (typeof rhs) {
|
|
31
|
+
case 'string':
|
|
32
|
+
obj[rhs] = attr;
|
|
33
|
+
break;
|
|
34
|
+
case 'object':
|
|
35
|
+
const { instanceOf, mapsTo } = rhs;
|
|
36
|
+
switch (instanceOf) {
|
|
37
|
+
case 'Number':
|
|
38
|
+
case Number:
|
|
39
|
+
obj[mapsTo] = Number(attr);
|
|
40
|
+
break;
|
|
41
|
+
case 'Object':
|
|
42
|
+
case Object:
|
|
43
|
+
case 'Boolean':
|
|
44
|
+
case Boolean:
|
|
45
|
+
obj[mapsTo] = JSON.parse(attr);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//el.ish = obj;
|
|
52
|
+
const children = Array.from(el.children);
|
|
53
|
+
const isItemScoped = el.hasAttribute('itemscope');
|
|
54
|
+
let itemscopeMap;
|
|
55
|
+
if (isItemScoped) {
|
|
56
|
+
itemscopeMap = {};
|
|
57
|
+
}
|
|
58
|
+
for (const child of children) {
|
|
59
|
+
if (!(child instanceof HTMLElement))
|
|
60
|
+
continue;
|
|
61
|
+
const objToPass = child.hasAttribute('itemscope') ? {} : obj;
|
|
62
|
+
parse(child, objToPass);
|
|
63
|
+
const isItemScopeAndChildHasBothItempropAndItemscope = itemscopeMap && child.hasAttribute('itemprop') && child.hasAttribute('itemscope');
|
|
64
|
+
if (isItemScopeAndChildHasBothItempropAndItemscope) {
|
|
65
|
+
const itemprops = child.getAttribute('itemprop').split(" ").filter(x => x);
|
|
66
|
+
for (const itemprop of itemprops) {
|
|
67
|
+
if (!itemscopeMap[itemprop])
|
|
68
|
+
itemscopeMap[itemprop] = [];
|
|
69
|
+
itemscopeMap[itemprop].push(objToPass);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// if(itemscopeMap){
|
|
74
|
+
// el.ism = itemscopeMap;
|
|
75
|
+
// }
|
|
76
|
+
return {
|
|
77
|
+
obj,
|
|
78
|
+
itemscopeMap
|
|
79
|
+
};
|
|
80
|
+
}
|
package/refid/ism.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {upShadowSearch} from '../upShadowSearch.js';
|
|
2
|
+
import {stdVal} from './stdVal.js';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(HTMLElement.prototype, 'ishm', {
|
|
5
|
+
get(){
|
|
6
|
+
const el = this as HTMLElement;
|
|
7
|
+
return parse(el);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const parsedItempropmaps = new WeakMap<HTMLScriptElement, any>();
|
|
12
|
+
|
|
13
|
+
export function parse(el: HTMLElement, obj: any = {}){
|
|
14
|
+
const itemprop = el.getAttribute('itemprop');
|
|
15
|
+
if(itemprop){
|
|
16
|
+
obj[itemprop] = stdVal(el); //TODO full logic
|
|
17
|
+
}
|
|
18
|
+
const itempropmap = el.getAttribute('itempropmap');
|
|
19
|
+
if(itempropmap){
|
|
20
|
+
//const el = document.getElementById(itempropmap);
|
|
21
|
+
const jsonEl = upShadowSearch(el, itempropmap)
|
|
22
|
+
if(!jsonEl) throw 500;
|
|
23
|
+
if(!parsedItempropmaps.has(jsonEl)){
|
|
24
|
+
parsedItempropmaps.set(jsonEl, JSON.parse(jsonEl.innerHTML));
|
|
25
|
+
}
|
|
26
|
+
const parsed =/** @type {ItemPropMap} */ (parsedItempropmaps.get(jsonEl));
|
|
27
|
+
for(const key in parsed){
|
|
28
|
+
const attr = el.getAttribute(key);
|
|
29
|
+
if(attr === null) continue;
|
|
30
|
+
const rhs = parsed[key];
|
|
31
|
+
switch(typeof rhs){
|
|
32
|
+
case 'string':
|
|
33
|
+
obj[rhs] = attr;
|
|
34
|
+
break;
|
|
35
|
+
case 'object':
|
|
36
|
+
const {instanceOf, mapsTo} = rhs;
|
|
37
|
+
switch(instanceOf){
|
|
38
|
+
case 'Number':
|
|
39
|
+
case Number:
|
|
40
|
+
obj[mapsTo] = Number(attr);
|
|
41
|
+
break;
|
|
42
|
+
case 'Object':
|
|
43
|
+
case Object:
|
|
44
|
+
case 'Boolean':
|
|
45
|
+
case Boolean:
|
|
46
|
+
obj[mapsTo] = JSON.parse(attr);
|
|
47
|
+
break;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
//el.ish = obj;
|
|
56
|
+
const children = Array.from(el.children);
|
|
57
|
+
const isItemScoped = el.hasAttribute('itemscope');
|
|
58
|
+
let itemscopeMap: {[key: string] : any[]} | undefined;
|
|
59
|
+
if(isItemScoped){
|
|
60
|
+
itemscopeMap = {};
|
|
61
|
+
}
|
|
62
|
+
for(const child of children){
|
|
63
|
+
if(!(child instanceof HTMLElement)) continue;
|
|
64
|
+
const objToPass = child.hasAttribute('itemscope') ? {} : obj;
|
|
65
|
+
parse(child, objToPass);
|
|
66
|
+
const isItemScopeAndChildHasBothItempropAndItemscope = itemscopeMap && child.hasAttribute('itemprop') && child.hasAttribute('itemscope');
|
|
67
|
+
if(isItemScopeAndChildHasBothItempropAndItemscope){
|
|
68
|
+
const itemprops = child.getAttribute('itemprop')!.split(" ").filter(x => x);
|
|
69
|
+
for(const itemprop of itemprops){
|
|
70
|
+
if(!itemscopeMap![itemprop]) itemscopeMap![itemprop] = [];
|
|
71
|
+
itemscopeMap![itemprop].push(objToPass);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// if(itemscopeMap){
|
|
76
|
+
// el.ism = itemscopeMap;
|
|
77
|
+
// }
|
|
78
|
+
return {
|
|
79
|
+
obj,
|
|
80
|
+
itemscopeMap
|
|
81
|
+
};
|
|
82
|
+
}
|
package/refid/itemprops.js
CHANGED
package/refid/itemprops.ts
CHANGED
package/refid/stdVal.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function stdVal(el) {
|
|
2
|
+
const { localName } = el;
|
|
3
|
+
switch (localName) {
|
|
4
|
+
case 'form':
|
|
5
|
+
throw 'NI';
|
|
6
|
+
case 'input':
|
|
7
|
+
throw 'NI';
|
|
8
|
+
case 'a':
|
|
9
|
+
return el.href;
|
|
10
|
+
case 'data':
|
|
11
|
+
return JSON.parse(el.value);
|
|
12
|
+
default:
|
|
13
|
+
return el.textContent;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/refid/stdVal.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function stdVal(el: Element){
|
|
2
|
+
const {localName} = el;
|
|
3
|
+
switch(localName){
|
|
4
|
+
case 'form':
|
|
5
|
+
throw 'NI';
|
|
6
|
+
case 'input':
|
|
7
|
+
throw 'NI';
|
|
8
|
+
case 'a':
|
|
9
|
+
return (el as HTMLAnchorElement).href;
|
|
10
|
+
case 'data':
|
|
11
|
+
return JSON.parse((el as HTMLDataElement).value);
|
|
12
|
+
default:
|
|
13
|
+
return el.textContent;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
level:
|
|
5
|
+
| 'log'
|
|
6
|
+
| 'warn'
|
|
7
|
+
| 'error',
|
|
8
|
+
ignore: string[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AllProps extends EndUserProps{}
|
|
12
|
+
|
|
13
|
+
export type AP = AllProps;
|
|
14
|
+
|
|
15
|
+
export type PAP = Partial<AP>;
|
|
16
|
+
|
|
17
|
+
export type ProPAP = Promise<PAP>;
|
|
18
|
+
|
|
19
|
+
export type BAP = AP & BEAllProps;
|
|
20
|
+
|
|
21
|
+
export interface Actions {
|
|
22
|
+
hydrate(self: BAP): PAP;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type dispatch = (event: Event) => boolean ;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
whenDefined: string[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AllProps extends EndUserProps{
|
|
8
|
+
}
|
|
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
|
+
export interface Actions{
|
|
19
|
+
//onWhenDefined(self: BAP): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
pre?: string,
|
|
5
|
+
post?: string,
|
|
6
|
+
on?: string,
|
|
7
|
+
eventName?: string,
|
|
8
|
+
eventCount?: number,
|
|
9
|
+
debounceDuration?: number,
|
|
10
|
+
options?: FetchOptions,
|
|
11
|
+
urlProp: string,
|
|
12
|
+
baseLink?: string,
|
|
13
|
+
}
|
|
14
|
+
export interface AllProps extends EndUserProps {
|
|
15
|
+
value: any;
|
|
16
|
+
interpolating: boolean;
|
|
17
|
+
full: boolean;
|
|
18
|
+
url: string;
|
|
19
|
+
urlEcho: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FetchOptions {
|
|
23
|
+
|
|
24
|
+
init?: RequestInit,
|
|
25
|
+
authorization?:{
|
|
26
|
+
winObj?: 'sessionStorage' | 'localStorage',
|
|
27
|
+
key?: string
|
|
28
|
+
val?: string,
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
//headers?: {[key: string]: string},
|
|
32
|
+
//headerFormSelector?: string,
|
|
33
|
+
//headerFormSubmitOn?: string | string[],
|
|
34
|
+
//valObservePairs: ValObservePairs;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// export interface ValObservePairs{
|
|
38
|
+
// authorization?: IObserve,
|
|
39
|
+
// authorizationVal?: string,
|
|
40
|
+
// body?: IObserve,
|
|
41
|
+
// bodyVal?: any,
|
|
42
|
+
// cache?: IObserve<'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'>,
|
|
43
|
+
// cacheVal?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached',
|
|
44
|
+
// contentType?: IObserve,
|
|
45
|
+
// contentTypeVal?: string,
|
|
46
|
+
// credentials?: IObserve<'omit' | 'same-origin' | 'include'>,
|
|
47
|
+
// credentialsVal?: 'omit' | 'same-origin' | 'include',
|
|
48
|
+
// method?: IObserve<'GET' | 'POST' | 'PUT' | 'DELETE'>,
|
|
49
|
+
// methodVal?: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
|
50
|
+
// mode?: IObserve<'cors' | 'no-cors' | 'same-origin' | 'navigate'>,
|
|
51
|
+
// modeVal?: 'cors' | 'no-cors' | 'same-origin' | 'navigate',
|
|
52
|
+
// redirect?: IObserve<'follow' | 'error' | 'manual'>,
|
|
53
|
+
// redirectVal?: 'follow' | 'error' | 'manual',
|
|
54
|
+
// referrerPolicy?: IObserve<'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'>,
|
|
55
|
+
// referrerPolicyVal?: 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url',
|
|
56
|
+
// }
|
|
57
|
+
|
|
58
|
+
export interface AllProps extends EndUserProps {}
|
|
59
|
+
|
|
60
|
+
export type AP = AllProps;
|
|
61
|
+
|
|
62
|
+
export type PAP = Partial<AP>;
|
|
63
|
+
|
|
64
|
+
export type ProPAP = Promise<PAP>;
|
|
65
|
+
|
|
66
|
+
export type BAP = AP & BEAllProps;
|
|
67
|
+
|
|
68
|
+
export interface Actions{
|
|
69
|
+
setUp(self: BAP): PAP;
|
|
70
|
+
interpolateIfValid(self: BAP): PAP | void;
|
|
71
|
+
setFullUrlIfValid(self: BAP): PAP | void;
|
|
72
|
+
fetchWhenSettled(self: BAP): Promise<PAP | void>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
whenMissing: string
|
|
5
|
+
onDefined: Array<string>
|
|
6
|
+
whenDef: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AllProps extends EndUserProps{
|
|
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
|
+
onOnDefined(self: BAP): ProPAP
|
|
22
|
+
hydrateOnMissing(self: BAP): ProPAP
|
|
23
|
+
parseWhenDef(self: BAP): PAP
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
options: IntersectionObserverInit;
|
|
5
|
+
rootClosest?: string;
|
|
6
|
+
observeClosest?: string;
|
|
7
|
+
enterDelay?: number;
|
|
8
|
+
exitDelay?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AP extends EndUserProps{
|
|
12
|
+
isIntersecting: boolean;
|
|
13
|
+
isIntersectingEcho: boolean;
|
|
14
|
+
isNotIntersecting: boolean;
|
|
15
|
+
isNotIntersectingEcho: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type PAP = Partial<AP>;
|
|
18
|
+
export type ProPAP = Promise<PAP>;
|
|
19
|
+
export type BAP = AP & BEAllProps;
|
|
20
|
+
|
|
21
|
+
export interface IntersectionalActions {
|
|
22
|
+
onOptions(self: AP & BEAllProps): PAP;
|
|
23
|
+
// onIntersectingChange(self: AP & BEAllProps): void;
|
|
24
|
+
// onNonIntersectingEcho(self: AP & BEAllProps)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Actions extends IntersectionalActions{
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
onIntersecting(self: this): void;
|
|
31
|
+
|
|
32
|
+
onNotIntersecting(self: this): void;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
//onNotIntersectingEcho(self: this): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EndUserProps as BeIntersectiontalEndUserProps,
|
|
3
|
+
AP as BeIntersectionalAllProps,
|
|
4
|
+
BeIntersectionalActions,
|
|
5
|
+
} from '../../node_modules/be-intersectional/types';
|
|
6
|
+
import { BEAllProps } from '../be-enhanced/types';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface EndUserProps extends BeIntersectiontalEndUserProps{
|
|
10
|
+
//transform?: {[key: string]: MatchRHS};
|
|
11
|
+
//host: any;
|
|
12
|
+
//ctx: RenderContext;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface AllProps extends BeIntersectionalAllProps, EndUserProps{}
|
|
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;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export interface BeLazyActions extends BeIntersectionalActions{
|
|
27
|
+
onIntersecting(self: AP & BEAllProps): void
|
|
28
|
+
onOptions(self: AP & BEAllProps): PAP;
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
|
|
3
|
+
export interface EndUserProps extends IEnhancement{
|
|
4
|
+
nudges: boolean
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AllProps extends EndUserProps{
|
|
8
|
+
}
|
|
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
|
+
export interface Actions{
|
|
19
|
+
do(self: BAP): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AttrInfo {
|
|
23
|
+
instanceOf:
|
|
24
|
+
| String
|
|
25
|
+
| 'String'
|
|
26
|
+
| Object
|
|
27
|
+
| 'Object'
|
|
28
|
+
| Number
|
|
29
|
+
| 'Number'
|
|
30
|
+
| Boolean
|
|
31
|
+
| 'Boolean'
|
|
32
|
+
mapsTo: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type RHS = string | AttrInfo;
|
|
36
|
+
|
|
37
|
+
export type ItemPropMap = {[key: string]: RHS}
|
|
@@ -2,11 +2,11 @@ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
|
2
2
|
import { Specifier } from '../trans-render/dss/types';
|
|
3
3
|
|
|
4
4
|
export interface EndUserProps extends IEnhancement{
|
|
5
|
-
|
|
5
|
+
invokeParamSets: Array<InvokingParameters>,
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface AP extends EndUserProps{
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
rawStatements: Array<string>,
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ export type ProPAP = Promise<PAP>
|
|
|
19
19
|
export type BAP = AP & BEAllProps;
|
|
20
20
|
|
|
21
21
|
export interface Actions{
|
|
22
|
-
hydrate(self:
|
|
22
|
+
hydrate(self: BAP): ProPAP;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface InvokingParameters {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps, EMC} from '../trans-render/be/types';
|
|
2
|
+
import { Specifier } from '../trans-render/dss/types';
|
|
3
|
+
|
|
4
|
+
interface FetchReadyEvent {
|
|
5
|
+
url: string
|
|
6
|
+
options: RequestInit
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface EndUserProps extends IEnhancement{
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AllProps extends EndUserProps{
|
|
15
|
+
//evtCount: number,
|
|
16
|
+
fetchReadyEvent: FetchReadyEvent
|
|
17
|
+
rawStatements: Array<string>
|
|
18
|
+
fetchForParams: Array<FetchForParameters>
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type AP = AllProps;
|
|
23
|
+
|
|
24
|
+
export type PAP = Partial<AP>;
|
|
25
|
+
|
|
26
|
+
export type ProPAP = Promise<PAP>;
|
|
27
|
+
|
|
28
|
+
export type BAP = AP & BEAllProps;
|
|
29
|
+
|
|
30
|
+
export interface Actions{
|
|
31
|
+
hydrate(self: BAP): PAP;
|
|
32
|
+
doFetch(self: BAP): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface FetchForParameters {
|
|
36
|
+
remoteSpecifier: Specifier
|
|
37
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
import {SimpleWCInfo} from '../wc-info/SimpleWCInfo';
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps {
|
|
5
|
+
|
|
6
|
+
accept?: string,
|
|
7
|
+
/**
|
|
8
|
+
* Url to invoke
|
|
9
|
+
* @readonly true
|
|
10
|
+
*/
|
|
11
|
+
src?: string,
|
|
12
|
+
|
|
13
|
+
':src': string,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Specifier for list of form associated or contentEditable peer elements that
|
|
17
|
+
* should partake in forming the URL.
|
|
18
|
+
*/
|
|
19
|
+
for?: string,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Indicates whether to treat the response as HTML or JSON or Text
|
|
23
|
+
*/
|
|
24
|
+
as?: 'html' | 'json' | 'text',
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The http verb to be used for the request
|
|
28
|
+
*/
|
|
29
|
+
method?:
|
|
30
|
+
| 'GET'
|
|
31
|
+
| 'HEAD'
|
|
32
|
+
| 'POST'
|
|
33
|
+
| 'PUT'
|
|
34
|
+
| 'DELETE'
|
|
35
|
+
| 'OPTIONS'
|
|
36
|
+
| 'TRACE'
|
|
37
|
+
| 'PATCH',
|
|
38
|
+
/**
|
|
39
|
+
* Either the JSON stringified or the parsed JSON object
|
|
40
|
+
* If parsed, the web component will stringify it.
|
|
41
|
+
*/
|
|
42
|
+
body?: any,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Request credentials
|
|
46
|
+
*/
|
|
47
|
+
credentials?: RequestCredentials,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Directed Scoped Specifier to the
|
|
51
|
+
* DOM element where the retrieved content should be applied.
|
|
52
|
+
*/
|
|
53
|
+
target?: string,
|
|
54
|
+
/**
|
|
55
|
+
* If as=html, specify whether to (stream) the contents into an attached shadow DOM or not.
|
|
56
|
+
*/
|
|
57
|
+
shadow?: ShadowRootMode,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Do not cache results even if the url has been invoked before.
|
|
61
|
+
*/
|
|
62
|
+
noCache?: boolean,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Stream the contents into the target element
|
|
66
|
+
*/
|
|
67
|
+
stream?: boolean,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Directed Scoped Specifier to a
|
|
71
|
+
* (button) element, to delay submitting the fetch request until that button is clicked.
|
|
72
|
+
*/
|
|
73
|
+
when?: string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Directed Scoped Specifier to a form element
|
|
77
|
+
* that we should use to form the url and body from.
|
|
78
|
+
*/
|
|
79
|
+
form?: string,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* fetch-for web component
|
|
84
|
+
*/
|
|
85
|
+
export abstract class ForFetchInfo implements SimpleWCInfo {
|
|
86
|
+
src: './for-fetch.js';
|
|
87
|
+
tagName: 'for-fetch';
|
|
88
|
+
props: EndUserProps;
|
|
89
|
+
name: 'for-fetch';
|
|
90
|
+
homepage: 'https://github.com/bahrus/for-fetch';
|
|
91
|
+
license: 'MIT';
|
|
92
|
+
description: 'Base web component for fetch'
|
|
93
|
+
cssParts: {
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type Package = [ForFetchInfo];
|