mount-observer 0.0.39 → 0.0.41
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 +50 -3
- package/MountObserver.ts +52 -7
- package/README.md +82 -13
- package/package.json +2 -2
- package/ts-refs/be-a-beacon/types.d.ts +3 -2
- package/ts-refs/be-alit/types.d.ts +1 -0
- package/ts-refs/be-based/types.d.ts +32 -0
- package/ts-refs/be-bound/types.d.ts +0 -3
- package/ts-refs/be-buttoned-up/types.d.ts +21 -0
- package/ts-refs/be-calculating/types.d.ts +4 -0
- package/ts-refs/be-clonable/types.d.ts +28 -0
- package/ts-refs/be-delible/types.d.ts +26 -0
- package/ts-refs/be-elevating/types.d.ts +55 -0
- package/ts-refs/be-eventing/types.d.ts +27 -0
- package/ts-refs/be-formalizing/types.d.ts +29 -0
- package/ts-refs/be-formidable/types.d.ts +64 -0
- package/ts-refs/be-kvetching/types.d.ts +24 -0
- package/ts-refs/be-literate/types.d.ts +10 -2
- package/ts-refs/be-mediating/types.d.ts +34 -0
- package/ts-refs/be-methodical/types.d.ts +20 -0
- package/ts-refs/be-modding/types.d.ts +18 -0
- package/ts-refs/{be-observant → be-observing}/types.d.ts +7 -4
- package/ts-refs/be-parsed/types.d.ts +19 -0
- package/ts-refs/be-persistent/types.d.ts +66 -0
- package/ts-refs/be-reformable/types.d.ts +48 -0
- package/ts-refs/be-render-neutral/types.d.ts +29 -0
- package/ts-refs/be-switched/types.d.ts +25 -19
- package/ts-refs/be-typed/types.d.ts +36 -0
- package/ts-refs/be-written/types.d.ts +37 -0
- package/ts-refs/for-fetch/types.d.ts +175 -0
- package/ts-refs/mount-observer/types.d.ts +6 -1
- package/ts-refs/trans-render/XV/types.d.ts +69 -0
- package/ts-refs/trans-render/asmr/types.d.ts +130 -0
- package/ts-refs/trans-render/be/types.d.ts +188 -0
- package/ts-refs/trans-render/dss/types.d.ts +159 -0
- package/ts-refs/trans-render/froop/types.d.ts +451 -0
- package/ts-refs/trans-render/funions/types.d.ts +12 -0
- package/ts-refs/trans-render/lib/mixins/types.d.ts +42 -0
- package/ts-refs/trans-render/lib/prs/types.d.ts +39 -0
- package/ts-refs/trans-render/lib/types.d.ts +489 -0
- package/ts-refs/trans-render/types.d.ts +14 -2
- package/ts-refs/xtal-element/types.d.ts +42 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { JSONObject } from '../trans-render/lib/types';
|
|
2
|
+
import { Specifier } from '../trans-render/dss/types';
|
|
3
|
+
import { URLBuilder } from '../../URLBuilder';
|
|
4
|
+
//import {SimpleWCInfo} from 'may-it-be/SimpleWCInfo';
|
|
5
|
+
|
|
6
|
+
declare class WeakRef<TProps = any>{}
|
|
7
|
+
/**
|
|
8
|
+
* fetch-for props
|
|
9
|
+
*/
|
|
10
|
+
export interface EndUserProps{
|
|
11
|
+
|
|
12
|
+
accept?: string,
|
|
13
|
+
/**
|
|
14
|
+
* Url to invoke
|
|
15
|
+
* @readonly true
|
|
16
|
+
*/
|
|
17
|
+
src?: string,
|
|
18
|
+
|
|
19
|
+
':src': string,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Specifier for list of form associated or contentEditable peer elements that
|
|
23
|
+
* should partake in forming the URL.
|
|
24
|
+
*/
|
|
25
|
+
for?: string,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Indicates whether to treat the response as HTML or JSON or Text
|
|
29
|
+
*/
|
|
30
|
+
as?: 'html' | 'json' | 'text',
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The http verb to be used for the request
|
|
34
|
+
*/
|
|
35
|
+
method?:
|
|
36
|
+
| 'GET'
|
|
37
|
+
| 'HEAD'
|
|
38
|
+
| 'POST'
|
|
39
|
+
| 'PUT'
|
|
40
|
+
| 'DELETE'
|
|
41
|
+
| 'OPTIONS'
|
|
42
|
+
| 'TRACE'
|
|
43
|
+
| 'PATCH',
|
|
44
|
+
/**
|
|
45
|
+
* Either the JSON stringified or the parsed JSON object
|
|
46
|
+
* If parsed, the web component will stringify it.
|
|
47
|
+
*/
|
|
48
|
+
body?: any,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Request credentials
|
|
52
|
+
*/
|
|
53
|
+
credentials?: RequestCredentials,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Directed Scoped Specifier to the
|
|
57
|
+
* DOM element where the retrieved content should be applied.
|
|
58
|
+
*/
|
|
59
|
+
target?: string,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* If as=html, specify whether to (stream) the contents into an attached shadow DOM or not.
|
|
63
|
+
*/
|
|
64
|
+
shadow?: ShadowRootMode,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Do not cache results even if the url has been invoked before.
|
|
68
|
+
*/
|
|
69
|
+
noCache?: boolean,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Stream the contents into the target element
|
|
73
|
+
*/
|
|
74
|
+
stream?: boolean,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Directed Scoped Specifier to a
|
|
78
|
+
* (button) element, to delay submitting the fetch request until that button is clicked.
|
|
79
|
+
*/
|
|
80
|
+
when?: string,
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Directed Scoped Specifier to a form element
|
|
84
|
+
* that we should use to form the url and body from.
|
|
85
|
+
*/
|
|
86
|
+
form?: string,
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface OverridableGetters{
|
|
91
|
+
//request$: RequestInit,
|
|
92
|
+
//accept$?: string,
|
|
93
|
+
value?: any,
|
|
94
|
+
//isAttrParsed?: boolean,
|
|
95
|
+
targetSelf?: boolean
|
|
96
|
+
targetSpecifier?: Specifier
|
|
97
|
+
whenCount?: number,
|
|
98
|
+
nextWhenCount?: number,
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type EventName = string;
|
|
104
|
+
|
|
105
|
+
export interface AllProps extends EndUserProps, OverridableGetters{
|
|
106
|
+
|
|
107
|
+
readonly resolvedTarget?: Element | null,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @readonly
|
|
111
|
+
* Weak references to input elements
|
|
112
|
+
*/
|
|
113
|
+
readonly forRefs: Map<string, [WeakRef<HTMLInputElement>, EventName]>,
|
|
114
|
+
readonly formData?: FormData,
|
|
115
|
+
readonly formRef?: WeakRef<HTMLFormElement>,
|
|
116
|
+
readonly formSpecifier?: Specifier,
|
|
117
|
+
readonly urlBuilder?: URLBuilder,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type PAP = Partial<AllProps>;
|
|
121
|
+
|
|
122
|
+
export type ProPP = Promise<PAP>;
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* methods for fetch-for
|
|
127
|
+
*/
|
|
128
|
+
export interface Methods extends Actions{
|
|
129
|
+
validateResp(resp: Response): boolean,
|
|
130
|
+
validateOn(): boolean,
|
|
131
|
+
setTargetProp(target: Element | null, data: any, shadow?: ShadowRootMode): void,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface Actions{
|
|
135
|
+
do(self: this): Promise<void>;
|
|
136
|
+
bindSrc(self)
|
|
137
|
+
parseFor(self: this): ProPP;
|
|
138
|
+
parseTarget(self: this): ProPP;
|
|
139
|
+
// listenForInput(self: this): ProPP;
|
|
140
|
+
// doInitialLoad(self: this): ProPP;
|
|
141
|
+
initializeWhen(self: this): Promise<PP | undefined>;
|
|
142
|
+
// onForm(self: this): ProPP;
|
|
143
|
+
// onFormSpecifier(self: this): ProPP;
|
|
144
|
+
// onFormRef(self: this): Promise<void>,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// https://github.com/webcomponents-cg/community-protocols/issues/12#issuecomment-872415080
|
|
148
|
+
export type loadEventName = 'load';
|
|
149
|
+
export type inputEventName = 'input';
|
|
150
|
+
export type selectionChangeEventName = 'select';
|
|
151
|
+
|
|
152
|
+
export interface EventForFetch {
|
|
153
|
+
href?: string;
|
|
154
|
+
trigger?: Element,
|
|
155
|
+
forData: ForData,
|
|
156
|
+
formData: FormData,
|
|
157
|
+
body?: string | JSONObject
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type ForData = {[key: string]: HTMLInputElement}
|
|
161
|
+
|
|
162
|
+
// /**
|
|
163
|
+
// * fetch-for web component
|
|
164
|
+
// */
|
|
165
|
+
// export abstract class ForFetchInfo implements SimpleWCInfo {
|
|
166
|
+
// src: './for-fetch.js';
|
|
167
|
+
// tagName: 'for-fetch';
|
|
168
|
+
// props: EndUserProps;
|
|
169
|
+
// cssParts: {
|
|
170
|
+
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
|
|
174
|
+
// export type Package = [ForFetchInfo];
|
|
175
|
+
|
|
@@ -70,6 +70,11 @@ export interface AttribMatch{
|
|
|
70
70
|
// validator?: (v: any) => boolean;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export interface WeakDual<T>{
|
|
74
|
+
weakSet: WeakSet<T>,
|
|
75
|
+
setWeak: Set<WeakRef<T>>
|
|
76
|
+
}
|
|
77
|
+
|
|
73
78
|
export interface IMountObserver {
|
|
74
79
|
// readonly mountInit: MountInit,
|
|
75
80
|
// readonly mountedRefs: WeakRef<Element>[],
|
|
@@ -77,7 +82,7 @@ export interface IMountObserver {
|
|
|
77
82
|
observe(within: Node): void;
|
|
78
83
|
disconnect(within: Node): void;
|
|
79
84
|
module?: any;
|
|
80
|
-
mountedElements:
|
|
85
|
+
mountedElements: WeakDual<Element>;
|
|
81
86
|
readAttrs(match: Element, branchIndexes?: Set<number>) : AttrChangeInfo[];
|
|
82
87
|
observedAttrs(): Promise<Array<string> | undefined>;
|
|
83
88
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PropInfo } from "../froop/types";
|
|
2
|
+
|
|
3
|
+
export type storage = 'sessionStorage' | 'localStorage';
|
|
4
|
+
|
|
5
|
+
export type protocols =
|
|
6
|
+
| storage
|
|
7
|
+
| 'indexedDB'
|
|
8
|
+
| 'globalThis'
|
|
9
|
+
| 'cookie'
|
|
10
|
+
| 'locationHash'
|
|
11
|
+
;
|
|
12
|
+
|
|
13
|
+
export type db = string;
|
|
14
|
+
export type storeName = string;
|
|
15
|
+
export type key = string;
|
|
16
|
+
export type chainedAccessor = string;
|
|
17
|
+
|
|
18
|
+
export type idbUSP = `indexedDB://${db}/${storeName}/${key}`;
|
|
19
|
+
export type idbUSL = `${idbUSP}?.${chainedAccessor}`;
|
|
20
|
+
|
|
21
|
+
export type storageUSP = `${storage}://${key}`;
|
|
22
|
+
export type storageUSL = `${storageUSP}?.${chainedAccessor}`;
|
|
23
|
+
|
|
24
|
+
export type USP =
|
|
25
|
+
| idbUSP
|
|
26
|
+
| storageUSP
|
|
27
|
+
;
|
|
28
|
+
|
|
29
|
+
export type USL =
|
|
30
|
+
| idbUSP
|
|
31
|
+
| idbUSL
|
|
32
|
+
| storageUSP
|
|
33
|
+
| storageUSL
|
|
34
|
+
;
|
|
35
|
+
|
|
36
|
+
export interface ParsedUSL{
|
|
37
|
+
protocol: protocols,
|
|
38
|
+
accessorChain: string,
|
|
39
|
+
usp: USP,
|
|
40
|
+
uspParts: Array<string>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface WrapperConfig<TProps = any> extends PropInfo {
|
|
44
|
+
USPProp: keyof TProps & string,
|
|
45
|
+
accessor: string,
|
|
46
|
+
cache: boolean,
|
|
47
|
+
maxStaleness: number,
|
|
48
|
+
//subscribe to window message
|
|
49
|
+
beVigilant: boolean,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type USLMapping = {[key: string | number | symbol]: USL}
|
|
53
|
+
|
|
54
|
+
export interface StowArgs {
|
|
55
|
+
values: any,
|
|
56
|
+
mapping: USLMapping
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SavingContext {
|
|
60
|
+
USLs: Set<USL>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface CookieOptions {
|
|
64
|
+
secure: boolean | undefined,
|
|
65
|
+
'max-age': number | undefined,
|
|
66
|
+
expires: Date | string | undefined,
|
|
67
|
+
domain: string | undefined,
|
|
68
|
+
path: string | undefined,
|
|
69
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { asOptions } from '../dss/types';
|
|
2
|
+
import {StringWithAutocompleteOptions, ZeroOrMore} from '../types';
|
|
3
|
+
|
|
4
|
+
export type ValueProp = StringWithAutocompleteOptions<
|
|
5
|
+
| 'value'
|
|
6
|
+
| 'checked'
|
|
7
|
+
| 'href'
|
|
8
|
+
| 'ariaValueNow'
|
|
9
|
+
| 'ariaChecked'
|
|
10
|
+
| 'valueAsNumber'
|
|
11
|
+
| 'valueAsDate'
|
|
12
|
+
| 'textContent'
|
|
13
|
+
| 'innerHTML'
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export type DisplayProp = StringWithAutocompleteOptions<
|
|
17
|
+
| 'textContent'
|
|
18
|
+
| 'ariaValueText'
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type ValueType = StringWithAutocompleteOptions<
|
|
22
|
+
| 'Boolean'
|
|
23
|
+
| 'String'
|
|
24
|
+
| 'Number'
|
|
25
|
+
| 'NumericRange'
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export type TrueText = StringWithAutocompleteOptions<
|
|
29
|
+
| 'Yes'
|
|
30
|
+
| 'On'
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export type FalseText = StringWithAutocompleteOptions<
|
|
34
|
+
| 'No'
|
|
35
|
+
| 'Off'
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
export type TrueStringValue = StringWithAutocompleteOptions<
|
|
39
|
+
| 'https://schema.org/True'
|
|
40
|
+
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
export type FalseStringValue = StringWithAutocompleteOptions<
|
|
44
|
+
| 'https://schema.org/False'
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export type StdEventNames = StringWithAutocompleteOptions<
|
|
48
|
+
| 'input'
|
|
49
|
+
| 'change'
|
|
50
|
+
| 'click'
|
|
51
|
+
| 'slotchange'
|
|
52
|
+
>;
|
|
53
|
+
|
|
54
|
+
export type BuiltInEditables = StringWithAutocompleteOptions<
|
|
55
|
+
| 'input'
|
|
56
|
+
| 'select'
|
|
57
|
+
| 'textarea'
|
|
58
|
+
|
|
59
|
+
>;
|
|
60
|
+
|
|
61
|
+
export interface ASMROptions<TProp = any>{
|
|
62
|
+
valueProp?: ValueProp;
|
|
63
|
+
valueType?: ValueType;
|
|
64
|
+
displayProp?: DisplayProp;
|
|
65
|
+
trueText?: TrueText;
|
|
66
|
+
falseText?: FalseText;
|
|
67
|
+
trueValue?: TrueStringValue;
|
|
68
|
+
falseValue?: FalseStringValue;
|
|
69
|
+
path?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface SetOptions<TProp = any> extends ASMROptions<TProp>{
|
|
73
|
+
valToDisplay?: (v: TProp) => string;
|
|
74
|
+
allowUnsafe?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface AbsOptions<TProp = any> {
|
|
78
|
+
/**
|
|
79
|
+
* source of truth attribute
|
|
80
|
+
*/
|
|
81
|
+
sota?: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* name of property corresponding to source of truth attribute
|
|
85
|
+
* if different from source of truth attribute
|
|
86
|
+
*/
|
|
87
|
+
sotaProp?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Is Roundabout ready
|
|
91
|
+
*/
|
|
92
|
+
isRAR?: boolean;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Is Roundabout Emulating
|
|
96
|
+
*/
|
|
97
|
+
isRAE?: boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Is User Editable
|
|
101
|
+
*/
|
|
102
|
+
isUE?: boolean;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* User Edit Event Name
|
|
106
|
+
*/
|
|
107
|
+
evt?: StdEventNames;
|
|
108
|
+
|
|
109
|
+
propToAbsorb?: ValueProp;
|
|
110
|
+
|
|
111
|
+
propToAbsorbValueType?: ValueType;
|
|
112
|
+
|
|
113
|
+
selfIsVal?: boolean;
|
|
114
|
+
|
|
115
|
+
as?: asOptions | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// export interface Setter<TProp = any> {
|
|
119
|
+
// setValue(nv: TProp);
|
|
120
|
+
// }
|
|
121
|
+
|
|
122
|
+
export interface SharingObject<TProp = any>{
|
|
123
|
+
setValue(val: TProp);
|
|
124
|
+
pureValue: TProp;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface AbsorbingObject<TProp = any> extends EventTarget{
|
|
128
|
+
getValue(): Promise<TProp>;
|
|
129
|
+
|
|
130
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { AttrChangeInfo, MountInit, RootCnfg, ObservedSourceOfTruthAttribute, MOSE} from '../../mount-observer/types';
|
|
2
|
+
import { RegExpExt } from '../lib/prs/types';
|
|
3
|
+
import {IObject$tring, CSSQuery, StringWithAutocompleteOptions} from '../types';
|
|
4
|
+
export type stringArray = string | Array<string>;
|
|
5
|
+
|
|
6
|
+
export type stringArrayOrTree = Array<string> | [string, Array<string>];
|
|
7
|
+
// export interface AttrParts {
|
|
8
|
+
// root: string,
|
|
9
|
+
// base: string,
|
|
10
|
+
// branch: string,
|
|
11
|
+
// leaf: string,
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
type prefixDelimiter = '-' | ':' | '--';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Abbrev. for EnhancementMountConfig
|
|
19
|
+
*/
|
|
20
|
+
export type EMC<TBranches = any, TProps = any> = EnhancementMountConfig<TBranches, TProps>
|
|
21
|
+
|
|
22
|
+
export interface AttrCacheConfig {
|
|
23
|
+
enable: 'always' | 'instantiating',
|
|
24
|
+
clone?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type SafeProps = StringWithAutocompleteOptions<
|
|
28
|
+
| 'textContent'
|
|
29
|
+
| 'value'
|
|
30
|
+
| 'object'
|
|
31
|
+
| 'checked'
|
|
32
|
+
| '^aria'
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
export type EventListenerClass = {new(): EventListenerObject}
|
|
36
|
+
|
|
37
|
+
export type EventListenerOrFn = EventListener | ((e: Event) => void) | EventListenerClass;
|
|
38
|
+
|
|
39
|
+
export type HandlerKey = string;
|
|
40
|
+
|
|
41
|
+
export type HandlerName = string;
|
|
42
|
+
|
|
43
|
+
export type EventType = string;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
type CustomHandlers = Map<HandlerName, EventListenerOrFn>;
|
|
47
|
+
type CustomHandlerCluster = Map<HandlerKey, CustomHandlers>;
|
|
48
|
+
// type EventTypeToListenerAndOptions = Map<EventType, ListenerAndOptions>;
|
|
49
|
+
// export interface ListenerAndOptions {
|
|
50
|
+
// listener: EventListenerOrFn,
|
|
51
|
+
// options?: OnOptions
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
export type MappedListeners = {[key: string]: EventListenerOrFn}
|
|
55
|
+
|
|
56
|
+
export interface IW<T = EventTarget> {
|
|
57
|
+
q: CSSQuery,
|
|
58
|
+
/**
|
|
59
|
+
* "addEventListeners or Actions"
|
|
60
|
+
* @param eventsToAdd
|
|
61
|
+
*/
|
|
62
|
+
a(eventsToAdd: MappedListeners): IW,
|
|
63
|
+
/**
|
|
64
|
+
* set properties
|
|
65
|
+
* @param propsToMerge
|
|
66
|
+
*/
|
|
67
|
+
s(propsToMerge: Partial<T>): IW,
|
|
68
|
+
r(refs: {[key: string]: any}): IW,
|
|
69
|
+
listeners: MappedListeners,
|
|
70
|
+
props: Partial<T>,
|
|
71
|
+
refs: {[key: string]: any},
|
|
72
|
+
primaryVal: any;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface EnhancementMountConfig<TBranches = any, TProps = any>{
|
|
76
|
+
id?: string;
|
|
77
|
+
enhancedElementInstanceOf?: Array<{new(): Element}>,
|
|
78
|
+
enhancedElementMatches?: string,
|
|
79
|
+
enhPropKey: HandlerKey,
|
|
80
|
+
/**
|
|
81
|
+
* If not specified, will be defaulted to the enhPropKey
|
|
82
|
+
* This allows for registered event handlers that are tied to a particular
|
|
83
|
+
* enhancement to be scoped within a Shadow DOM realm
|
|
84
|
+
*/
|
|
85
|
+
handlerKey?: string,
|
|
86
|
+
hasRootIn?: Array<RootCnfg>,
|
|
87
|
+
preBaseDelimiter?: prefixDelimiter,
|
|
88
|
+
base?: string,
|
|
89
|
+
preBranchDelimiter?: prefixDelimiter,
|
|
90
|
+
branches?: Array<string>,
|
|
91
|
+
//TODO
|
|
92
|
+
watchedBranches?: Array<string>,
|
|
93
|
+
//TODO
|
|
94
|
+
preLeafDelimiter?: prefixDelimiter,
|
|
95
|
+
//TODO
|
|
96
|
+
leaves?: Partial<{[key in keyof TBranches & string]: stringArray}>,
|
|
97
|
+
//TODO
|
|
98
|
+
hostMatches?: CSSQuery,
|
|
99
|
+
//TODO
|
|
100
|
+
hostInstanceOf?: Array<{new(): HTMLElement}>,
|
|
101
|
+
block?: boolean,
|
|
102
|
+
//TODO
|
|
103
|
+
unblock?: boolean,
|
|
104
|
+
|
|
105
|
+
importEnh?: () => Promise<{new(): IEnhancement}>
|
|
106
|
+
|
|
107
|
+
map?: {[key: AttrCoordinates]: AttrMapPoint<TProps>},
|
|
108
|
+
/**
|
|
109
|
+
* Observed Source of Truth Attributes [TODO, need better name]
|
|
110
|
+
*/
|
|
111
|
+
osotas? : Array<ObservedSourceOfTruthAttribute<TProps>>,
|
|
112
|
+
|
|
113
|
+
cacheConfig?: AttrCacheConfig,
|
|
114
|
+
|
|
115
|
+
mapLocalNameTo?: keyof TProps,
|
|
116
|
+
|
|
117
|
+
mapEnhKeyTo?: keyof TProps,
|
|
118
|
+
|
|
119
|
+
allowedMutations?: {[key: CSSQuery]: []}
|
|
120
|
+
|
|
121
|
+
top?: EnhancementMountConfig<TBranches, TProps>,
|
|
122
|
+
|
|
123
|
+
ws?: Array<IW>,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* map the where clause to this
|
|
127
|
+
*/
|
|
128
|
+
mapWSTo?: keyof TProps,
|
|
129
|
+
|
|
130
|
+
primaryProp?: keyof TProps
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type AttrMapPoint<TProps = any> = keyof TProps & string | AttrMapConfig<TProps>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
export interface AttrMapConfig<TProps = any, TMethods = TProps> {
|
|
137
|
+
instanceOf?: 'Object' | 'String' | 'Object$tring' | 'Object$entences' | 'DSSArray' | 'Boolean' | 'Number',
|
|
138
|
+
mapsTo?: '.' | keyof TProps,
|
|
139
|
+
valIfFalsy?: any,
|
|
140
|
+
strValMapsTo?: keyof TProps,
|
|
141
|
+
objValMapsTo?: '.' | keyof TProps,
|
|
142
|
+
arrValMapsTo?: keyof TProps,
|
|
143
|
+
strArrMapsTo?: keyof TProps,
|
|
144
|
+
regExpExts?: Partial<{[key in keyof TProps]: RegExpExt<any>[]}>;
|
|
145
|
+
parsedRegExps?: boolean;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
export type Branchitude = number;
|
|
150
|
+
export type Leafitude = number;
|
|
151
|
+
export type AttrCoordinates = `${Branchitude}.${Leafitude}`;
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
export type MountBeHive<TBranches = any> = Partial<EMC<TBranches>>;
|
|
156
|
+
|
|
157
|
+
export interface EnhancementInfo {
|
|
158
|
+
initialPropValues?: any,
|
|
159
|
+
initialAttrInfo?: Array<AttrChangeInfo>,
|
|
160
|
+
mountCnfg: EMC,
|
|
161
|
+
synConfig: EMC,
|
|
162
|
+
observedAttrs: Array<string> | undefined,
|
|
163
|
+
ws?: Array<IW>
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface BEAllProps<TElement = Element> {
|
|
167
|
+
resolved: boolean;
|
|
168
|
+
rejected: boolean;
|
|
169
|
+
enhancedElement: TElement;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface IEnhancement<TElement = Element> extends BEAllProps<TElement>{
|
|
173
|
+
attach(el: TElement, enhancement: EnhancementInfo): Promise<void>;
|
|
174
|
+
detach(el: TElement): Promise<void>;
|
|
175
|
+
resolved: boolean;
|
|
176
|
+
rejected: boolean;
|
|
177
|
+
readonly enhancedElement: TElement;
|
|
178
|
+
whenResolved(): Promise<boolean>;
|
|
179
|
+
de(src: EventTarget, name: string) : Event,
|
|
180
|
+
attrChgCB(attrChangeInfos: Array<AttrChangeInfo>) : void,
|
|
181
|
+
channelEvent(e: Event): void;
|
|
182
|
+
//parsedFrom: string;
|
|
183
|
+
//autoImport?: boolean | string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface OnOptions extends EventListenerOptions{
|
|
187
|
+
initOn?: 'resolved'
|
|
188
|
+
}
|