mount-observer 0.0.39 → 0.0.40

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.
Files changed (42) hide show
  1. package/MountObserver.js +9 -2
  2. package/MountObserver.ts +11 -5
  3. package/README.md +82 -13
  4. package/package.json +2 -2
  5. package/ts-refs/be-a-beacon/types.d.ts +3 -2
  6. package/ts-refs/be-alit/types.d.ts +1 -0
  7. package/ts-refs/be-based/types.d.ts +32 -0
  8. package/ts-refs/be-bound/types.d.ts +0 -3
  9. package/ts-refs/be-buttoned-up/types.d.ts +21 -0
  10. package/ts-refs/be-calculating/types.d.ts +4 -0
  11. package/ts-refs/be-clonable/types.d.ts +28 -0
  12. package/ts-refs/be-delible/types.d.ts +26 -0
  13. package/ts-refs/be-elevating/types.d.ts +55 -0
  14. package/ts-refs/be-eventing/types.d.ts +27 -0
  15. package/ts-refs/be-formalizing/types.d.ts +29 -0
  16. package/ts-refs/be-formidable/types.d.ts +64 -0
  17. package/ts-refs/be-kvetching/types.d.ts +24 -0
  18. package/ts-refs/be-literate/types.d.ts +10 -2
  19. package/ts-refs/be-mediating/types.d.ts +34 -0
  20. package/ts-refs/be-methodical/types.d.ts +20 -0
  21. package/ts-refs/be-modding/types.d.ts +18 -0
  22. package/ts-refs/{be-observant → be-observing}/types.d.ts +7 -4
  23. package/ts-refs/be-parsed/types.d.ts +19 -0
  24. package/ts-refs/be-persistent/types.d.ts +66 -0
  25. package/ts-refs/be-reformable/types.d.ts +48 -0
  26. package/ts-refs/be-render-neutral/types.d.ts +29 -0
  27. package/ts-refs/be-switched/types.d.ts +12 -13
  28. package/ts-refs/be-typed/types.d.ts +36 -0
  29. package/ts-refs/be-written/types.d.ts +37 -0
  30. package/ts-refs/for-fetch/types.d.ts +175 -0
  31. package/ts-refs/mount-observer/types.d.ts +6 -1
  32. package/ts-refs/trans-render/XV/types.d.ts +69 -0
  33. package/ts-refs/trans-render/asmr/types.d.ts +130 -0
  34. package/ts-refs/trans-render/be/types.d.ts +188 -0
  35. package/ts-refs/trans-render/dss/types.d.ts +159 -0
  36. package/ts-refs/trans-render/froop/types.d.ts +452 -0
  37. package/ts-refs/trans-render/funions/types.d.ts +12 -0
  38. package/ts-refs/trans-render/lib/mixins/types.d.ts +42 -0
  39. package/ts-refs/trans-render/lib/prs/types.d.ts +39 -0
  40. package/ts-refs/trans-render/lib/types.d.ts +489 -0
  41. package/ts-refs/trans-render/types.d.ts +3 -0
  42. package/ts-refs/xtal-element/types.d.ts +42 -0
@@ -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
+ }
@@ -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
+ }