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,159 @@
|
|
|
1
|
+
import { Scope } from '../lib/types'
|
|
2
|
+
import { CSSQuery } from '../types';
|
|
3
|
+
|
|
4
|
+
export type DSS = string;
|
|
5
|
+
|
|
6
|
+
export type DirectionalScopeSigils =
|
|
7
|
+
/**
|
|
8
|
+
* upward direction, non recursive
|
|
9
|
+
*/
|
|
10
|
+
|'^'
|
|
11
|
+
/**
|
|
12
|
+
* downward direction, next element siblings only
|
|
13
|
+
*/
|
|
14
|
+
|'Y'
|
|
15
|
+
/**
|
|
16
|
+
* IdRef query
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|'?'
|
|
20
|
+
/**
|
|
21
|
+
* self
|
|
22
|
+
*/
|
|
23
|
+
|'.'
|
|
24
|
+
/**
|
|
25
|
+
* modulo
|
|
26
|
+
*/
|
|
27
|
+
|'%'
|
|
28
|
+
;
|
|
29
|
+
|
|
30
|
+
export type AttrSigils =
|
|
31
|
+
/**
|
|
32
|
+
* Reference to self / local element
|
|
33
|
+
*/
|
|
34
|
+
'$0' |
|
|
35
|
+
/**
|
|
36
|
+
* Reference by ID
|
|
37
|
+
*/
|
|
38
|
+
'#' | '@' | '-' | '|' | '%';
|
|
39
|
+
|
|
40
|
+
export type ElementSigils = '/' | '~';
|
|
41
|
+
|
|
42
|
+
export type Sigils = AttrSigils | ElementSigils;
|
|
43
|
+
|
|
44
|
+
export type asOptions =
|
|
45
|
+
| 'number'
|
|
46
|
+
| 'boolean'
|
|
47
|
+
| 'string'
|
|
48
|
+
| 'object'
|
|
49
|
+
| 'regexp'
|
|
50
|
+
| 'urlpattern'
|
|
51
|
+
| 'boolean|number'
|
|
52
|
+
;
|
|
53
|
+
|
|
54
|
+
export interface Specifier {
|
|
55
|
+
/** Directional Scope Sigil */
|
|
56
|
+
dss?: DirectionalScopeSigils,
|
|
57
|
+
/**
|
|
58
|
+
* recursive
|
|
59
|
+
*/
|
|
60
|
+
rec?: boolean,
|
|
61
|
+
/**
|
|
62
|
+
* root node fallback
|
|
63
|
+
*/
|
|
64
|
+
rnf?: boolean,
|
|
65
|
+
/**
|
|
66
|
+
* include siblings in scope search
|
|
67
|
+
*/
|
|
68
|
+
isiss?: boolean,
|
|
69
|
+
scopeS?: CSSSelector,
|
|
70
|
+
elS?: CSSSelector,
|
|
71
|
+
el?: string,
|
|
72
|
+
idRefS?: string,
|
|
73
|
+
s?: Sigils,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Inferred prop name
|
|
77
|
+
* This should be the last token word of the DSS expression
|
|
78
|
+
*/
|
|
79
|
+
prop?: InferredPropName,
|
|
80
|
+
path?: SubPropPath;
|
|
81
|
+
/**
|
|
82
|
+
* Event Name
|
|
83
|
+
*/
|
|
84
|
+
evt?: EventName;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* RoundAbout Prop events to listen for
|
|
88
|
+
*/
|
|
89
|
+
raps?: Array<string>;
|
|
90
|
+
|
|
91
|
+
ms?: MarkerString;
|
|
92
|
+
self?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* must have a dash in the localName
|
|
95
|
+
* wait for whenDefined in find
|
|
96
|
+
*/
|
|
97
|
+
host?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* host prop
|
|
100
|
+
*/
|
|
101
|
+
hp?: string;
|
|
102
|
+
/**
|
|
103
|
+
* host prop fallback
|
|
104
|
+
*/
|
|
105
|
+
hpf?: string;
|
|
106
|
+
|
|
107
|
+
as?: asOptions
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
isModulo?: boolean;
|
|
111
|
+
modulo?: Modulo;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type Modulo = 'aria-rowindex' | 'aria-colindex' | 'aria-rowindextext'
|
|
115
|
+
|
|
116
|
+
export type InferredPropName = string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* can contain dot (.) for sub property access and pipes (|) for method invocations
|
|
120
|
+
*/
|
|
121
|
+
export type SubPropPath = string;
|
|
122
|
+
|
|
123
|
+
export type EventName = string;
|
|
124
|
+
|
|
125
|
+
export type CSSSelector = string;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* starts with a dash, typically all kebab case
|
|
129
|
+
* inferrered prop name will be camel cased based on this.
|
|
130
|
+
*/
|
|
131
|
+
export type MarkerString = string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* PIP stands for Partner in Prop (for now) -- supports bi-directional data flow to property
|
|
135
|
+
* IP stands for In Prop (for now) -- Data only Flow only goes in
|
|
136
|
+
* OP s
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
export interface GetPIPOptions{
|
|
140
|
+
//name of event to listen for for when the prop being monitored for changes
|
|
141
|
+
evtName?: string,
|
|
142
|
+
isRoundAboutReady?: boolean;
|
|
143
|
+
prop?: string,
|
|
144
|
+
sota?: string,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Partner In Prop
|
|
149
|
+
*/
|
|
150
|
+
export interface PIP<TProp = any, TElement = Element> extends EventListenerObject{
|
|
151
|
+
readonly propagator: EventTarget;
|
|
152
|
+
async getValue(el: TElement): Promise<TProp | undefined>;
|
|
153
|
+
async setValue(el: TElement, val: TProp);
|
|
154
|
+
async hydrate(el: TElement);
|
|
155
|
+
syncVal(el: TElement);
|
|
156
|
+
disconnect();
|
|
157
|
+
toString(nv: TProp): string;
|
|
158
|
+
readonly outEvtName: string;
|
|
159
|
+
}
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { Scope} from '../lib/types';
|
|
2
|
+
import { WrapperConfig } from '../XV/types';
|
|
3
|
+
|
|
4
|
+
export interface IEventConfig<MCProps = any, MCActions = MCProps, TAction = Action>{
|
|
5
|
+
on?: string,
|
|
6
|
+
of?: 'tbd' | EventTarget,
|
|
7
|
+
doInit?: boolean,
|
|
8
|
+
options?: AddEventListenerOptions,
|
|
9
|
+
abort?: {
|
|
10
|
+
origMethName: string & keyof MCActions,
|
|
11
|
+
//destMethName: string & keyof MCActions,
|
|
12
|
+
of: 'tbd' | EventTarget,
|
|
13
|
+
on: string,
|
|
14
|
+
|
|
15
|
+
},
|
|
16
|
+
composedPathMatches?: string,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//Is anything using this anymore?
|
|
20
|
+
export type ActionOnEventConfigs<MCProps = any, MCActions = MCProps, TAction = Action> = Partial<{[key in keyof MCActions]: IEventConfig<MCProps, MCActions, TAction>}>
|
|
21
|
+
|
|
22
|
+
export interface IPropagator extends EventTarget{
|
|
23
|
+
get(key: string): any;
|
|
24
|
+
set(key: string, val: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Delta Keys
|
|
27
|
+
*/
|
|
28
|
+
dk: Set<string>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Mature keys
|
|
32
|
+
*/
|
|
33
|
+
mk: Set<string>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* timeout handles - key is name of prop
|
|
37
|
+
* used for simple debouncing of echo notifications in XtalElement
|
|
38
|
+
*/
|
|
39
|
+
eth: Map<string, string | number | NodeJS.Timeout> | undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* timeout handles - key is name of prop
|
|
43
|
+
* used for simple debouncing of toggle echo notifications in XtalElement
|
|
44
|
+
*/
|
|
45
|
+
tth: Map<string, string | number | NodeJS.Timeout> | undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IResolvableService extends EventTarget{
|
|
49
|
+
resolved: boolean;
|
|
50
|
+
resolve(): Promise<void>;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface IInstanceResolvableService<T extends object = object> extends IResolvableService{
|
|
55
|
+
instanceResolve(instance: T): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface IMix extends IResolvableService{
|
|
59
|
+
ext: {new(): HTMLElement}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IPropRegistrar extends IResolvableService{
|
|
63
|
+
propInfos: {[key: string]: PropInfo},
|
|
64
|
+
allPropNames: string[],
|
|
65
|
+
getAttrNames(ext: any): Promise<string[]>,
|
|
66
|
+
getPropsFromAction(action: string | Action): Set<string>,
|
|
67
|
+
nonDryProps: Set<string>,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IDefine extends IResolvableService{
|
|
71
|
+
custElClass: {new(): HTMLElement};
|
|
72
|
+
resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface IPropSvc extends IResolvableService{
|
|
76
|
+
createPropBag(instance: Element): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface IHookup extends IInstanceResolvableService{
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface IAttrChgCB{
|
|
84
|
+
instance: HTMLElement,
|
|
85
|
+
// name: string,
|
|
86
|
+
// oldVal: string,
|
|
87
|
+
// newVal: string,
|
|
88
|
+
newAttrs: {[key: string]: {oldVal: string | null, newVal: string | null}},
|
|
89
|
+
filteredAttrs: {[key: string]: string}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface IConnectedCB{
|
|
93
|
+
instance: HTMLElement,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface IPropChg{
|
|
97
|
+
key: string,
|
|
98
|
+
oldVal: any,
|
|
99
|
+
newVal: any,
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface IDisconnectedCB {
|
|
104
|
+
instance: HTMLElement
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface INewPropagator {
|
|
108
|
+
instance: HTMLElement,
|
|
109
|
+
propagator: IPropagator,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
export interface CEArgs<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction extends Action<TProps> = Action<TProps>> extends DefineArgs<TProps, TActions, TPropInfo, TAction>{
|
|
117
|
+
definer?: IDefine,
|
|
118
|
+
servers?: CEServiceClasses
|
|
119
|
+
services?: CEServices,
|
|
120
|
+
asides?: any
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface DynamicTransform {
|
|
124
|
+
scope?: Scope,
|
|
125
|
+
noCache?: boolean,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface IPE {
|
|
129
|
+
do(instance: EventTarget, originMethodName: string, vals: [any, ActionOnEventConfigs] ): Promise<void>,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface IPET extends IPE{
|
|
133
|
+
re(instance: EventTarget, originMethodName: string, vals: [any, ActionOnEventConfigs, DynamicTransform] ): Promise<void>,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface DefineArgs<MixinCompositeProps = any, MixinCompositeActions = MixinCompositeProps, TPropInfo = PropInfo, TAction extends Action = Action<MixinCompositeProps>>{
|
|
137
|
+
superclass?: {new(): HTMLElement} | string,
|
|
138
|
+
mixins?: any[],
|
|
139
|
+
mainTemplate?: HTMLTemplateElement;
|
|
140
|
+
/** use this only for defaults that can't be JSON serialized in config */
|
|
141
|
+
complexPropDefaults?: Partial<MixinCompositeProps>;
|
|
142
|
+
/** Config should be 100% JSON serializable, or a JSON import, or an id of an be-exportable script tag */
|
|
143
|
+
config: WCConfig<MixinCompositeProps, MixinCompositeActions, TPropInfo, TAction> | (() => Promise<{default: WCConfig<MixinCompositeProps, MixinCompositeActions, TPropInfo, TAction>}>) | string;
|
|
144
|
+
// /**
|
|
145
|
+
// * Side effects tied to actions, mostly used to load enhancement dependencies tied to
|
|
146
|
+
// * enhancements
|
|
147
|
+
// */
|
|
148
|
+
// asides?: Partial<{[key in keyof MixinCompositeActions & string]: (instance: EventTarget, methodName: string, key: string) => Promise<void> }>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface WCConfig<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction = Action>{
|
|
152
|
+
tagName?: string;
|
|
153
|
+
isEnh?: boolean;
|
|
154
|
+
propDefaults?: Partial<{[key in keyof TProps]: TProps[key]}>;
|
|
155
|
+
propInfo?: Partial<{[key in keyof TProps]: TPropInfo}>;
|
|
156
|
+
wrappers?: Partial<{[key in keyof TProps]: WrapperConfig<TProps>}>;
|
|
157
|
+
derivedProps?: (keyof TProps & string)[];
|
|
158
|
+
// actions?:
|
|
159
|
+
// Partial<{[key in keyof MCActions & string]: TAction | keyof MCProps}>
|
|
160
|
+
actions?: Actions<TProps, TActions>;
|
|
161
|
+
propChangeMethod?: keyof TActions;
|
|
162
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
163
|
+
/**
|
|
164
|
+
* Used for providing hints to server side processing what css queries should be observed if using HTMLRewriter.
|
|
165
|
+
*/
|
|
166
|
+
keyQueries?: string[];
|
|
167
|
+
formAss?: boolean;
|
|
168
|
+
compacts?: Compacts<TProps>;
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type PropLookup<TProps = any> = Partial<{[key in keyof TProps]: PropInfo}>;
|
|
173
|
+
|
|
174
|
+
export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps>{
|
|
175
|
+
|
|
176
|
+
propDefaults?: Partial<{[key in keyof TProps]: TProps[key]}>;
|
|
177
|
+
propInfo?: Partial<{[key in keyof TProps]: PropInfo}>;
|
|
178
|
+
wrappers?: Partial<{[key in keyof TProps]: WrapperConfig<TProps>}>;
|
|
179
|
+
actions?: Actions<TProps, TActions>;
|
|
180
|
+
/**
|
|
181
|
+
* inferred actions
|
|
182
|
+
*/
|
|
183
|
+
infractions?: Infractions<TProps>,
|
|
184
|
+
compacts?: Compacts<TProps, TActions>;
|
|
185
|
+
hitch?: Hitches<TProps, TActions>;
|
|
186
|
+
handlers?: Handlers<ETProps, TActions>;
|
|
187
|
+
positractions?: Positractions<TProps, TActions>;
|
|
188
|
+
mainTemplate?: string | HTMLTemplateElement;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export type Positractions<TProps = any, TActions = TProps> =
|
|
192
|
+
| Array<Positraction<TProps, TActions>>;
|
|
193
|
+
|
|
194
|
+
export interface Positraction<TProps = any, TActions = TProps> extends LogicOp<TProps> {
|
|
195
|
+
do: Function | (keyof TActions & string),
|
|
196
|
+
ifKeyIn?: Array<keyof TProps & string>,
|
|
197
|
+
ifAllOf?: Array<keyof TProps & string>,
|
|
198
|
+
//ifNoneOf: Array<keyof TProps & string>,
|
|
199
|
+
|
|
200
|
+
pass?: Array<(keyof TProps & string) | number | boolean | '$0' | '$0+' | `\`${string}\``>,
|
|
201
|
+
assignTo?: Array<null | (keyof TProps & string)>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
export type Compacts<TProps = any, TActions = TProps> =
|
|
207
|
+
//| Partial<{[key in `${keyof TProps & string}_to_${keyof TProps & string}` & string]: Operation<TProps> }>
|
|
208
|
+
| Partial<{[key in `negate_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
|
|
209
|
+
| Partial<{[key in `pass_length_of_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
|
|
210
|
+
| Partial<{[key in `echo_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
|
|
211
|
+
| Partial<{[key in `echo_${keyof TProps & string}_to_${keyof TProps & string}_after`]: keyof TProps}>
|
|
212
|
+
| Partial<{[key in `when_${keyof TProps & string}_changes_invoke_${keyof TActions & string}`]: number}>
|
|
213
|
+
| Partial<{[key in `when_${keyof TProps & string}_changes_toggle_${keyof TProps & string}`]: number}>
|
|
214
|
+
| Partial<{[key in `when_${keyof TProps & string}_changes_inc_${keyof TProps & string}_by`]: number}>
|
|
215
|
+
;
|
|
216
|
+
|
|
217
|
+
export type Hitches<TProps = any, TActions = TProps> =
|
|
218
|
+
| Partial<{[key in `when_${keyof TProps & string}_emits_${keyof TProps & string}_inc_${keyof TProps & string}_by`]: number}>
|
|
219
|
+
|
|
220
|
+
;
|
|
221
|
+
|
|
222
|
+
export type Handlers<ETProps = any, TActions = ETProps> =
|
|
223
|
+
| Partial<{[key in `${keyof ETProps & string}_to_${keyof TActions & string}_on` & string]: string }>;
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
export type ListOfLogicalExpressions<MCProps = any> = (keyof MCProps | LogicOp<MCProps>)[];
|
|
228
|
+
|
|
229
|
+
export type LogicOpProp<MCProps = any> =
|
|
230
|
+
|LogicOp<MCProps> | (keyof MCProps & string)[];
|
|
231
|
+
|
|
232
|
+
export interface LogicOp<Props = any>{
|
|
233
|
+
/**
|
|
234
|
+
* Supported by trans-render
|
|
235
|
+
*/
|
|
236
|
+
ifAllOf?: Keysh<Props>,
|
|
237
|
+
|
|
238
|
+
ifKeyIn?: Keysh<Props>,
|
|
239
|
+
|
|
240
|
+
ifNoneOf?: Keysh<Props>,
|
|
241
|
+
|
|
242
|
+
ifEquals?: Array<Key<Props>>,
|
|
243
|
+
|
|
244
|
+
ifAtLeastOneOf?: Keysh<Props>,
|
|
245
|
+
|
|
246
|
+
ifNotAllOf?: Keysh<Props>,
|
|
247
|
+
|
|
248
|
+
debug?: boolean,
|
|
249
|
+
|
|
250
|
+
delay?: number,
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface SetLogicOps<Props = any>{
|
|
255
|
+
|
|
256
|
+
a?: boolean,
|
|
257
|
+
|
|
258
|
+
ifAllOf?: Set<Key<Props>>,
|
|
259
|
+
|
|
260
|
+
ifKeyIn?: Set<Key<Props>>,
|
|
261
|
+
|
|
262
|
+
ifNoneOf?: Set<Key<Props>>,
|
|
263
|
+
|
|
264
|
+
ifEquals?: Set<Key<Props>>,
|
|
265
|
+
|
|
266
|
+
ifAtLeastOneOf?: Set<Key<Props>>,
|
|
267
|
+
|
|
268
|
+
ifNotAllOf?: Set<Key<Props>>,
|
|
269
|
+
|
|
270
|
+
debug?: boolean,
|
|
271
|
+
|
|
272
|
+
delay?: number,
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface Action<MCProps = any, MCActions = MCProps> extends LogicOp<MCProps>{
|
|
276
|
+
target?: keyof MCProps;
|
|
277
|
+
debug?: boolean;
|
|
278
|
+
secondArg?: any;
|
|
279
|
+
//setFree?: (keyof MCProps & string)[],
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface IActionProcessor{
|
|
283
|
+
doActions(self: IActionProcessor, actions: {[methodName: string]: Action}, target: any, proxy?: any): void;
|
|
284
|
+
postHoc(self: this, action: Action, target: any, returnVal: any, proxy?: any): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
type PropInfoTypes = "String" | "Number" | "Boolean" | "Object" | "RegExp";
|
|
288
|
+
export interface PropInfo{
|
|
289
|
+
type?: PropInfoTypes;
|
|
290
|
+
dry?: boolean;
|
|
291
|
+
parse?: boolean;
|
|
292
|
+
ro?: boolean;
|
|
293
|
+
def?: any;
|
|
294
|
+
attrName?: string;
|
|
295
|
+
propName?: string;
|
|
296
|
+
/**
|
|
297
|
+
* form associated read only property
|
|
298
|
+
* 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.
|
|
299
|
+
* examples: form, validity, validityMessage, willValidate
|
|
300
|
+
*/
|
|
301
|
+
farop?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* form associated read only method
|
|
304
|
+
* examples: checkValidity, reportValidity
|
|
305
|
+
*/
|
|
306
|
+
farom?: 'checkValidity' | 'reportValidity';
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* form associated write method
|
|
310
|
+
*/
|
|
311
|
+
fawm?: 'setValidity' | 'setFormValue'
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* internals pass through property
|
|
315
|
+
* examples: role, ariaRole
|
|
316
|
+
*/
|
|
317
|
+
ip?: boolean;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export type ConstString = String;
|
|
321
|
+
|
|
322
|
+
export type NameOfProp = string;
|
|
323
|
+
|
|
324
|
+
export type StringOrProp = ConstString | [NameOfProp, PropInfo];
|
|
325
|
+
|
|
326
|
+
export type Parts = Array<StringOrProp>;
|
|
327
|
+
|
|
328
|
+
export interface PropChangeInfo<TPropInfo = PropInfo> {
|
|
329
|
+
key: string,
|
|
330
|
+
ov: any,
|
|
331
|
+
nv: any,
|
|
332
|
+
prop: TPropInfo,
|
|
333
|
+
pcm: PropChangeMethod | undefined;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
//are these still really used?
|
|
337
|
+
export type PropChangeMoment = 'v' | '-a' | '+a' | '+qr' | '+qm';
|
|
338
|
+
|
|
339
|
+
export type PropChangeMethod = (self: EventTarget, pci: PropChangeInfo, moment: PropChangeMoment) => boolean;
|
|
340
|
+
|
|
341
|
+
export type Actions<TProps = any, TActions = TProps> =
|
|
342
|
+
Partial<{[key in keyof TActions & string]: LogicOp<TProps>}>
|
|
343
|
+
//& Partial<{[key in `do_${keyof TActions & string}_on`]: Key<TActions> | Array<Key<TActions>> }>
|
|
344
|
+
;
|
|
345
|
+
|
|
346
|
+
export type Checks<TProps = any, TActions = TProps> =
|
|
347
|
+
Partial<{[key in keyof TActions & string]: SetLogicOps<TProps>}>
|
|
348
|
+
|
|
349
|
+
export type roundaboutOptions<TProps = any, TActions = TProps, ETProps = TProps> = {
|
|
350
|
+
vm?: TProps & TActions & RoundaboutReady,
|
|
351
|
+
//for enhanced elements, pass in the container, referenced via $0.
|
|
352
|
+
container?: EventTarget,
|
|
353
|
+
propagate?: keyof TProps & string | Array<keyof TProps & string>,
|
|
354
|
+
actions?: Actions<TProps,TActions>,
|
|
355
|
+
compacts?: Compacts<TProps, TActions>,
|
|
356
|
+
//onsets?: Onsets<TProps, TActions>,
|
|
357
|
+
handlers?: Handlers<ETProps, TActions>,
|
|
358
|
+
hitch?: Hitches<TProps, TActions>,
|
|
359
|
+
positractions?: Positractions<TProps>,
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type PropsToPartialProps<TProps = any> =
|
|
363
|
+
| ((self: TProps, a: any, b: any) => Promise<Partial<TProps>>)
|
|
364
|
+
| ((self: TProps) => Partial<TProps>);
|
|
365
|
+
|
|
366
|
+
export type Infractions<TProps = any> =
|
|
367
|
+
//| PropsToPartialProps<TProps>
|
|
368
|
+
| Array<PropsToPartialProps<TProps>>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
export type Busses = {[key: string]: Set<string>};
|
|
373
|
+
|
|
374
|
+
export type Routers = {[key: string]: Array<{
|
|
375
|
+
on: string,
|
|
376
|
+
do: string,
|
|
377
|
+
full: string,
|
|
378
|
+
}>}
|
|
379
|
+
|
|
380
|
+
export type Key<T = any> = keyof T & string;
|
|
381
|
+
|
|
382
|
+
export type Keysh<T = any> = Key<T> | Array<Key<T>>;
|
|
383
|
+
|
|
384
|
+
export interface RoundaboutReady{
|
|
385
|
+
/**
|
|
386
|
+
* Allow for assigning to read only props via the "backdoor"
|
|
387
|
+
* Bypasses getters / setters, sets directly to (private) memory slots
|
|
388
|
+
* Doesn't do any notification
|
|
389
|
+
* Allows for nested property setting
|
|
390
|
+
*/
|
|
391
|
+
covertAssignment(obj: any): Promise<void>;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* fires event with name matching the name of the property when the value changes (but not via covertAssignment)
|
|
395
|
+
* when property is set via public interface, not (immediately) via an action method's return object
|
|
396
|
+
*/
|
|
397
|
+
readonly propagator : EventTarget | undefined;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
*
|
|
401
|
+
* https://github.com/whatwg/dom/issues/1296
|
|
402
|
+
*/
|
|
403
|
+
readonly disconnectedSignal: AbortSignal
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* During this time, queues/buses continue to perform "bookkeeping"
|
|
407
|
+
* but doesn't process the queue until sleep property becomes falsy.
|
|
408
|
+
* If truthy, can call await awake() before processing should resume
|
|
409
|
+
* [TODO]
|
|
410
|
+
*/
|
|
411
|
+
readonly sleep?: number,
|
|
412
|
+
|
|
413
|
+
async awake(): void;
|
|
414
|
+
|
|
415
|
+
async nudge(): void;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
export interface BaseProps{
|
|
421
|
+
proppedUp: boolean,
|
|
422
|
+
sleep?: number;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface ICompact{
|
|
426
|
+
compacts: Compacts,
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
interface CompactStatement {
|
|
430
|
+
srcKey: string,
|
|
431
|
+
destKey: string,
|
|
432
|
+
op: 'toggle' | 'negate' | 'invoke' | 'pass_length' | 'echo' | 'inc',
|
|
433
|
+
rhsIsDynamic: boolean
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
interface HitchStatement {
|
|
437
|
+
leftKey: string,
|
|
438
|
+
middleKey: string,
|
|
439
|
+
rightKey: string,
|
|
440
|
+
lOp: 'when'
|
|
441
|
+
lmOp: 'emits',
|
|
442
|
+
mrOp: 'inc',
|
|
443
|
+
rOp: 'by'
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export type CommandMethod<T extends EventTarget = EventTarget> = (self: T, evt: Event) => Partial<T> | Promise<Partial<T>>
|
|
447
|
+
|
|
448
|
+
export type HookupConfig<T extends EventTarget = EventTarget> = {[key: string]: CommandMethod | [string, CommandMethod]};
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {ITransformer, UnitOfWork} from '../types.js';
|
|
2
|
+
import {Mount} from '../../../Mount.js';
|
|
3
|
+
export interface LocalizerProps {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizerMethods{
|
|
7
|
+
localize(model: any, transformer: ITransformer<any, any>, uow: UnitOfWork<any, any>, matchingElement: Element): string | Partial<HTMLDataElement> | Partial<HTMLTimeElement> | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Localizer extends HTMLElement, LocalizerProps, LocalizerMethods {}
|
|
11
|
+
|
|
12
|
+
export type LocalizerType = {new(): Localizer & Mount }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {UnitOfWork, ITransformer, RHS, ToTransformer, XForm} from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface TemplMgmtProps<MCProps extends Partial<HTMLElement> = HTMLElement, MCMethods = MCProps>{
|
|
4
|
+
mainTemplate?: HTMLTemplateElement | string;
|
|
5
|
+
unsafeTCount: number;
|
|
6
|
+
styles?: CSSStyleSheet[] | string;
|
|
7
|
+
clonedTemplate?: Node | undefined;
|
|
8
|
+
shadowRootMode?: 'open' | 'closed' | undefined | false;
|
|
9
|
+
//xform: Partial<{[key: string]: RHS<any, any>}>,
|
|
10
|
+
/**
|
|
11
|
+
* transform within ShadowRoot if applicable
|
|
12
|
+
*/
|
|
13
|
+
xform: XForm<any, any, any>,
|
|
14
|
+
/**
|
|
15
|
+
* transform applied to light children, if applicable
|
|
16
|
+
* Use ":root" to match on the root element
|
|
17
|
+
*/
|
|
18
|
+
lcXform: XForm<any, any>,
|
|
19
|
+
xformImpl?: () => Promise<ToTransformer<MCProps, MCMethods>>,
|
|
20
|
+
skipTemplateClone?: boolean;
|
|
21
|
+
//homeInOn?: Partial<{[key in keyof MCProps]: Partial<{[key: string]: RHS<MCProps, MCMethods>}>}>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export interface TemplMgmtActions{
|
|
26
|
+
doTransforms(self: this): void;
|
|
27
|
+
cloneTemplate(self: this): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TemplMgmtBase extends HTMLElement, TemplMgmtProps, TemplMgmtActions{}
|
|
31
|
+
|
|
32
|
+
// export interface LocalizerProps {
|
|
33
|
+
|
|
34
|
+
// }
|
|
35
|
+
// export interface LocalizerMethods{
|
|
36
|
+
// localize(model: any, transformer: ITransformer<any, any>, uow: UnitOfWork<any, any>, matchingElement: Element): string | Partial<HTMLDataElement> | Partial<HTMLTimeElement> | undefined;
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
// export interface Localizer extends HTMLElement, LocalizerProps, LocalizerMethods {}
|
|
40
|
+
|
|
41
|
+
// export type LocalizerType = {new(): Localizer }
|
|
42
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Scope } from "../types";
|
|
2
|
+
|
|
3
|
+
export type ElTypes = '$' | '#' | '@' | '/' | '-' | '|' | '%' | '~';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface ElO {
|
|
7
|
+
/**
|
|
8
|
+
* User of the name "prop" is a bit loose. It is really a kind of identifier that
|
|
9
|
+
* **may** map to a prop, but it will typically not will map to an actual prop of the
|
|
10
|
+
* observed element, but rather to some property of a view model of the hosting element
|
|
11
|
+
* or of a peer, non-visual "web component as a service" sitting somewhere inside the Shadow
|
|
12
|
+
* DOM scope.
|
|
13
|
+
*/
|
|
14
|
+
prop?: string,
|
|
15
|
+
subProp?: string,
|
|
16
|
+
elType?: ElTypes,
|
|
17
|
+
perimeter?: string,
|
|
18
|
+
event?: string,
|
|
19
|
+
//TODO
|
|
20
|
+
floor?: string,
|
|
21
|
+
marker?: string,
|
|
22
|
+
scope?: Scope,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface RegExpExt<TStatementGroup = any>{
|
|
26
|
+
regExp: RegExp | string,
|
|
27
|
+
defaultVals: Partial<TStatementGroup>,
|
|
28
|
+
dssKeys?: [string, string][],
|
|
29
|
+
dssArrayKeys?: [string, string][],
|
|
30
|
+
statementPartParser?: StatementPartParser
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StatementPartParser {
|
|
34
|
+
splitWord: string,
|
|
35
|
+
propMap: {[key: string]: Array<RegExpExt>},
|
|
36
|
+
parsedRegExps?: boolean,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type RegExpOrRegExpExt<TStatementGroup = any> = RegExp | RegExpExt<TStatementGroup>;
|