mount-observer 0.0.112 → 0.1.1

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 (181) hide show
  1. package/Events.js +62 -26
  2. package/Events.ts +52 -30
  3. package/MountObserver.js +285 -514
  4. package/MountObserver.ts +362 -538
  5. package/README.md +149 -56
  6. package/SharedMutationObserver.js +70 -0
  7. package/SharedMutationObserver.ts +96 -0
  8. package/attrCoordinates.js +93 -0
  9. package/attrCoordinates.ts +122 -0
  10. package/index.js +3 -0
  11. package/index.ts +22 -0
  12. package/loadImports.js +47 -0
  13. package/loadImports.ts +56 -0
  14. package/mediaQuery.js +86 -0
  15. package/mediaQuery.ts +113 -0
  16. package/package.json +11 -119
  17. package/playwright.config.ts +0 -1
  18. package/types.d.ts +104 -0
  19. package/whereAttr.js +174 -0
  20. package/whereAttr.ts +221 -0
  21. package/LICENSE +0 -21
  22. package/Newish.js +0 -145
  23. package/Newish.ts +0 -169
  24. package/ObsAttr.js +0 -18
  25. package/ObsAttr.ts +0 -18
  26. package/RootMutObs.js +0 -49
  27. package/RootMutObs.ts +0 -58
  28. package/Synthesizer.js +0 -125
  29. package/Synthesizer.ts +0 -130
  30. package/bindish.js +0 -15
  31. package/bindish.ts +0 -22
  32. package/compose.js +0 -148
  33. package/compose.ts +0 -164
  34. package/doCleanup.js +0 -31
  35. package/doCleanup.ts +0 -34
  36. package/getWhereAttrSelector.js +0 -83
  37. package/getWhereAttrSelector.ts +0 -92
  38. package/preloadContent.js +0 -44
  39. package/preloadContent.ts +0 -47
  40. package/readAttrs.ts +0 -60
  41. package/refid/README.md +0 -259
  42. package/refid/arr.js +0 -4
  43. package/refid/arr.ts +0 -4
  44. package/refid/camelToKebab.js +0 -4
  45. package/refid/camelToKebab.ts +0 -4
  46. package/refid/genIds.js +0 -190
  47. package/refid/genIds.ts +0 -177
  48. package/refid/getAdjRefs.js +0 -38
  49. package/refid/getAdjRefs.ts +0 -38
  50. package/refid/getContext.js +0 -13
  51. package/refid/getContext.ts +0 -14
  52. package/refid/getCount.js +0 -8
  53. package/refid/getCount.ts +0 -8
  54. package/refid/getIsh.js +0 -35
  55. package/refid/getIsh.ts +0 -37
  56. package/refid/hostish.js +0 -18
  57. package/refid/hostish.ts +0 -20
  58. package/refid/ism.js +0 -78
  59. package/refid/ism.ts +0 -81
  60. package/refid/itemprops.js +0 -60
  61. package/refid/itemprops.ts +0 -67
  62. package/refid/joinMatching.js +0 -56
  63. package/refid/joinMatching.ts +0 -54
  64. package/refid/nudge.js +0 -23
  65. package/refid/nudge.ts +0 -23
  66. package/refid/regIsh.js +0 -27
  67. package/refid/regIsh.ts +0 -31
  68. package/refid/secretKeys.js +0 -5
  69. package/refid/secretKeys.ts +0 -5
  70. package/refid/splitRefs.js +0 -6
  71. package/refid/splitRefs.ts +0 -6
  72. package/refid/stdVal.js +0 -15
  73. package/refid/stdVal.ts +0 -15
  74. package/refid/via.js +0 -114
  75. package/refid/via.ts +0 -113
  76. package/slotkin/affine.js +0 -39
  77. package/slotkin/affine.ts +0 -46
  78. package/slotkin/beKindred.js +0 -45
  79. package/slotkin/beKindred.ts +0 -55
  80. package/slotkin/getBreadth.js +0 -19
  81. package/slotkin/getBreadth.ts +0 -21
  82. package/slotkin/getFrag.js +0 -22
  83. package/slotkin/getFrag.ts +0 -21
  84. package/slotkin/toQuery.js +0 -12
  85. package/slotkin/toQuery.ts +0 -13
  86. package/slotkin/wrap.js +0 -13
  87. package/slotkin/wrap.ts +0 -18
  88. package/ts-refs/LICENSE +0 -21
  89. package/ts-refs/README.md +0 -18
  90. package/ts-refs/be-a-beacon/types.d.ts +0 -22
  91. package/ts-refs/be-alit/types.d.ts +0 -1
  92. package/ts-refs/be-based/types.d.ts +0 -32
  93. package/ts-refs/be-bound/types.d.ts +0 -65
  94. package/ts-refs/be-buttoned-up/types.d.ts +0 -21
  95. package/ts-refs/be-calculating/types.d.ts +0 -57
  96. package/ts-refs/be-clonable/types.d.ts +0 -28
  97. package/ts-refs/be-committed/types.d.ts +0 -26
  98. package/ts-refs/be-consoling/types.d.ts +0 -25
  99. package/ts-refs/be-counted/types.d.ts +0 -88
  100. package/ts-refs/be-delible/types.d.ts +0 -26
  101. package/ts-refs/be-directive/types.d.ts +0 -43
  102. package/ts-refs/be-dispatching/types.d.ts +0 -41
  103. package/ts-refs/be-elevating/types.d.ts +0 -55
  104. package/ts-refs/be-enhanced/types.d.ts +0 -32
  105. package/ts-refs/be-enhancing/types.d.ts +0 -31
  106. package/ts-refs/be-evanescent/types.d.ts +0 -20
  107. package/ts-refs/be-eventing/types.d.ts +0 -27
  108. package/ts-refs/be-exportable/types.d.ts +0 -26
  109. package/ts-refs/be-fetching/types.d.ts +0 -73
  110. package/ts-refs/be-flashy/types.d.ts +0 -27
  111. package/ts-refs/be-formalizing/types.d.ts +0 -29
  112. package/ts-refs/be-formidable/types.d.ts +0 -64
  113. package/ts-refs/be-giddy/types.d.ts +0 -26
  114. package/ts-refs/be-gingerly/types.d.ts +0 -19
  115. package/ts-refs/be-gone/types.d.ts +0 -24
  116. package/ts-refs/be-hashing-out/types.d.ts +0 -22
  117. package/ts-refs/be-hive/types.d.ts +0 -18
  118. package/ts-refs/be-imbued/types.d.ts +0 -30
  119. package/ts-refs/be-included/types.d.ts +0 -20
  120. package/ts-refs/be-inclusive/types.d.ts +0 -30
  121. package/ts-refs/be-intersectional/types.d.ts +0 -37
  122. package/ts-refs/be-intl/types.d.ts +0 -28
  123. package/ts-refs/be-invoking/types.d.ts +0 -28
  124. package/ts-refs/be-joining/types.d.ts +0 -26
  125. package/ts-refs/be-kvetching/types.d.ts +0 -24
  126. package/ts-refs/be-lazy/types.d.ts +0 -29
  127. package/ts-refs/be-literate/types.d.ts +0 -29
  128. package/ts-refs/be-mediating/types.d.ts +0 -34
  129. package/ts-refs/be-methodical/types.d.ts +0 -20
  130. package/ts-refs/be-modding/types.d.ts +0 -18
  131. package/ts-refs/be-observant/types.d.ts +0 -27
  132. package/ts-refs/be-observing/types.d.ts +0 -84
  133. package/ts-refs/be-parsed/types.d.ts +0 -19
  134. package/ts-refs/be-parsing/types.d.ts +0 -37
  135. package/ts-refs/be-persistent/types.d.ts +0 -66
  136. package/ts-refs/be-propagating/types.d.ts +0 -26
  137. package/ts-refs/be-reformable/types.d.ts +0 -48
  138. package/ts-refs/be-render-neutral/types.d.ts +0 -31
  139. package/ts-refs/be-scoped/types.d.ts +0 -24
  140. package/ts-refs/be-sharing/types.d.ts +0 -17
  141. package/ts-refs/be-switched/types.d.ts +0 -155
  142. package/ts-refs/be-typed/types.d.ts +0 -36
  143. package/ts-refs/be-value-added/types.d.ts +0 -34
  144. package/ts-refs/be-valued/types.d.ts +0 -22
  145. package/ts-refs/be-written/types.d.ts +0 -59
  146. package/ts-refs/css-charts/types.d.ts +0 -38
  147. package/ts-refs/css-echarts/types.d.ts +0 -13
  148. package/ts-refs/data-props/types.d.ts +0 -27
  149. package/ts-refs/do-inc/types.d.ts +0 -28
  150. package/ts-refs/do-invoke/types.d.ts +0 -28
  151. package/ts-refs/do-toggle/types.d.ts +0 -27
  152. package/ts-refs/em-bower/types.d.ts +0 -24
  153. package/ts-refs/fetch-for/types.d.ts +0 -37
  154. package/ts-refs/folder-picker/types.d.ts +0 -43
  155. package/ts-refs/for-fetch/doc.d.ts +0 -98
  156. package/ts-refs/for-fetch/types.d.ts +0 -83
  157. package/ts-refs/mount-observer/types.d.ts +0 -248
  158. package/ts-refs/mt-si/types.d.ts +0 -21
  159. package/ts-refs/per-each/types.d.ts +0 -51
  160. package/ts-refs/soak-up/types.d.ts +0 -36
  161. package/ts-refs/trans-render/XV/types.d.ts +0 -69
  162. package/ts-refs/trans-render/asmr/types.d.ts +0 -138
  163. package/ts-refs/trans-render/be/types.d.ts +0 -198
  164. package/ts-refs/trans-render/dss/types.d.ts +0 -57
  165. package/ts-refs/trans-render/froop/types.d.ts +0 -416
  166. package/ts-refs/trans-render/funions/types.d.ts +0 -12
  167. package/ts-refs/trans-render/lib/mixins/types.d.ts +0 -42
  168. package/ts-refs/trans-render/lib/prs/types.d.ts +0 -40
  169. package/ts-refs/trans-render/lib/types.d.ts +0 -489
  170. package/ts-refs/trans-render/types.d.ts +0 -583
  171. package/ts-refs/wc-info/SimpleWCInfo.d.ts +0 -15
  172. package/ts-refs/when-resolved/types.d.ts +0 -30
  173. package/ts-refs/xp-as/types.d.ts +0 -20
  174. package/ts-refs/xtal-element/types.d.ts +0 -43
  175. package/ts-refs/xtal-frappe-chart/types.d.ts +0 -193
  176. package/upShadowSearch.js +0 -25
  177. package/upShadowSearch.ts +0 -23
  178. package/waitForEvent.js +0 -12
  179. package/waitForEvent.ts +0 -13
  180. package/waitForIsh.js +0 -21
  181. package/waitForIsh.ts +0 -20
@@ -1,198 +0,0 @@
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
- mapEmcTo?: keyof TProps,
120
-
121
- allowedMutations?: {[key: CSSQuery]: []}
122
-
123
- top?: EnhancementMountConfig<TBranches, TProps>,
124
-
125
- ws?: Array<IW>,
126
-
127
- /**
128
- * map the where clause to this
129
- */
130
- mapWSTo?: keyof TProps,
131
-
132
- primaryProp?: keyof TProps
133
- }
134
-
135
- export type AttrMapPoint<TProps = any> = keyof TProps & string | AttrMapConfig<TProps>
136
-
137
-
138
- export interface AttrMapConfig<TProps = any, TMethods = TProps> {
139
- instanceOf?:
140
- | 'Object'
141
- | 'String'
142
- | 'StringOrStrings'
143
- | 'Object$tring'
144
- | 'Object$entences'
145
- | 'DSSArray'
146
- | 'Boolean'
147
- | 'Number',
148
- mapsTo?: '.' | keyof TProps,
149
- valIfFalsy?: any,
150
- strValMapsTo?: keyof TProps,
151
- objValMapsTo?: '.' | keyof TProps,
152
- arrValMapsTo?: keyof TProps,
153
- strArrMapsTo?: keyof TProps,
154
- regExpExts?: Partial<{[key in keyof TProps]: RegExpExt<any>[]}>;
155
- parsedRegExps?: boolean;
156
- }
157
-
158
-
159
- export type Branchitude = number;
160
- export type Leafitude = number;
161
- export type AttrCoordinates = `${Branchitude}.${Leafitude}`;
162
-
163
-
164
-
165
- export type MountBeHive<TBranches = any> = Partial<EMC<TBranches>>;
166
-
167
- export interface EnhancementInfo {
168
- initialPropValues?: any,
169
- initialAttrInfo?: Array<AttrChangeInfo>,
170
- mountCnfg: EMC,
171
- synConfig: EMC,
172
- observedAttrs: Array<string> | undefined,
173
- ws?: Array<IW>
174
- }
175
-
176
- export interface BEAllProps<TElement = Element> {
177
- resolved: boolean;
178
- rejected: boolean;
179
- enhancedElement: TElement;
180
- }
181
-
182
- export interface IEnhancement<TElement = Element> extends BEAllProps<TElement>{
183
- attach(el: TElement, enhancement: EnhancementInfo): Promise<void>;
184
- detach(el: TElement): Promise<void>;
185
- resolved: boolean;
186
- rejected: boolean;
187
- readonly enhancedElement: TElement;
188
- whenResolved(): Promise<boolean>;
189
- de(src: EventTarget, name: string) : Event,
190
- attrChgCB(attrChangeInfos: Array<AttrChangeInfo>) : void,
191
- channelEvent(e: Event): void;
192
- //parsedFrom: string;
193
- //autoImport?: boolean | string;
194
- }
195
-
196
- export interface OnOptions extends EventListenerOptions{
197
- initOn?: 'resolved'
198
- }
@@ -1,57 +0,0 @@
1
- export type ID = `#${string}`;
2
- export type Host = `:host()`;
3
- export type Hostish = ``;
4
- export type Target = ID | Host | Hostish;
5
-
6
- export type MindReadProp = ``;
7
- export type PropPath = `?.${string}`;
8
-
9
- export type Prop = string;
10
- export type ConstVal = `\`${string}\``;
11
-
12
- export type asOptions =
13
- | 'number'
14
- | 'boolean'
15
- | 'string'
16
- | 'object'
17
- | 'regexp'
18
- | 'urlpattern'
19
- | 'boolean|number'
20
- ;
21
- export type MindReadType = ``;
22
- export type TypeQualifier = `-as-${asOptions}`;
23
-
24
- export type ValExpression = `${Prop | PropPath | ConstVal | MindReadProp}${TypeQualifier | MindReadType}`;
25
-
26
- export type MindReadEvent = ``;
27
-
28
- export type EventSpecifier = `::${string}`;
29
-
30
- export type EventPart = MindReadEvent | EventSpecifier;
31
-
32
- export type DSS = `${Target}${ValExpression}${EventPart}`;
33
-
34
-
35
- export interface Specifier {
36
- id?: string,
37
- prop?: string,
38
- path?: SubPropPath,
39
- evtName?: EventName,
40
- as?: asOptions,
41
- constVal?: any;
42
- enhKey?: string;
43
- ish?: boolean;
44
- //element to observe must be a shadowed custom element host.
45
- host?: boolean;
46
- self?: boolean;
47
- }
48
-
49
-
50
-
51
- /**
52
- * can contain dot (.) for sub property access and pipes (|) for method invocations
53
- */
54
- export type SubPropPath = string;
55
-
56
- export type EventName = string;
57
-
@@ -1,416 +0,0 @@
1
- import { IMountObserver } from '../../mount-observer/types';
2
- import { Scope} from '../lib/types';
3
- import { WrapperConfig } from '../XV/types';
4
- import {CSSQuery, XForm} from '../types';
5
-
6
- export interface IEventConfig<MCProps = any, MCActions = MCProps, TAction = Action>{
7
- on?: string,
8
- of?: 'tbd' | EventTarget,
9
- doInit?: boolean,
10
- options?: AddEventListenerOptions,
11
- abort?: {
12
- origMethName: string & keyof MCActions,
13
- //destMethName: string & keyof MCActions,
14
- of: 'tbd' | EventTarget,
15
- on: string,
16
-
17
- },
18
- composedPathMatches?: string,
19
- }
20
-
21
- //Is anything using this anymore?
22
- export type ActionOnEventConfigs<MCProps = any, MCActions = MCProps, TAction = Action> = Partial<{[key in keyof MCActions]: IEventConfig<MCProps, MCActions, TAction>}>
23
-
24
-
25
-
26
- export interface IAttrChgCB{
27
- instance: HTMLElement,
28
- // name: string,
29
- // oldVal: string,
30
- // newVal: string,
31
- newAttrs: {[key: string]: {oldVal: string | null, newVal: string | null}},
32
- filteredAttrs: {[key: string]: string}
33
- }
34
-
35
-
36
-
37
- export interface IPropChg{
38
- key: string,
39
- oldVal: any,
40
- newVal: any,
41
-
42
- }
43
-
44
- export interface DynamicTransform {
45
- scope?: Scope,
46
- noCache?: boolean,
47
- }
48
-
49
- export interface DefineArgs<MixinCompositeProps = any, MixinCompositeActions = MixinCompositeProps, TPropInfo = PropInfo, TAction extends Action = Action<MixinCompositeProps>>{
50
- superclass?: {new(): HTMLElement} | string,
51
- mixins?: any[],
52
- mainTemplate?: HTMLTemplateElement;
53
- /** use this only for defaults that can't be JSON serialized in config */
54
- complexPropDefaults?: Partial<MixinCompositeProps>;
55
- /** Config should be 100% JSON serializable, or a JSON import, or an id of an be-exportable script tag */
56
- config: WCConfig<MixinCompositeProps, MixinCompositeActions, TPropInfo, TAction> | (() => Promise<{default: WCConfig<MixinCompositeProps, MixinCompositeActions, TPropInfo, TAction>}>) | string;
57
- // /**
58
- // * Side effects tied to actions, mostly used to load enhancement dependencies tied to
59
- // * enhancements
60
- // */
61
- // asides?: Partial<{[key in keyof MixinCompositeActions & string]: (instance: EventTarget, methodName: string, key: string) => Promise<void> }>
62
- }
63
-
64
- export interface WCConfig<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction = Action>{
65
- tagName?: string;
66
- isEnh?: boolean;
67
- propDefaults?: Partial<{[key in keyof TProps]: TProps[key]}>;
68
- propInfo?: Partial<{[key in keyof TProps]: TPropInfo}>;
69
- wrappers?: Partial<{[key in keyof TProps]: WrapperConfig<TProps>}>;
70
- derivedProps?: (keyof TProps & string)[];
71
- // actions?:
72
- // Partial<{[key in keyof MCActions & string]: TAction | keyof MCProps}>
73
- actions?: Actions<TProps, TActions>;
74
- propChangeMethod?: keyof TActions;
75
- style?: Partial<CSSStyleDeclaration>;
76
- /**
77
- * Used for providing hints to server side processing what css queries should be observed if using HTMLRewriter.
78
- */
79
- keyQueries?: string[];
80
- formAss?: boolean;
81
- compacts?: Compacts<TProps>;
82
-
83
- }
84
-
85
- export type PropLookup<TProps = any, TActions = any> = Partial<{[key in keyof TProps]: PropInfo<TProps, TActions>}>;
86
- export type IshPropLookup<TProps = any, TActions = any> = Partial<{[key in keyof TProps]: IshPropInfo<TProps, TActions>}>;
87
- export interface IshConfig<TProps = any, TActions = TProps, ETProps = TProps>{
88
- propDefaults?: Partial<{[key in keyof TProps]: TProps[key]}>;
89
- propInfo?: Partial<{[key in keyof TProps]: PropInfo}>;
90
- wrappers?: Partial<{[key in keyof TProps]: WrapperConfig<TProps>}>;
91
- actions?: Actions<TProps, TActions>;
92
- /**
93
- * inferred actions
94
- */
95
- infractions?: Infractions<TProps>,
96
- compacts?: Compacts<TProps, TActions>;
97
- hitch?: Hitches<TProps, TActions>;
98
- handlers?: Handlers<ETProps, TActions>;
99
- extHandlers?: ExtHandlers<TProps>;
100
- positractions?: Positractions<TProps, TActions>;
101
-
102
- isSleepless?: boolean;
103
- xform?: XForm<TProps, TActions>;
104
- inScopeXForms?: {[key: CSSQuery]: XForm<TProps, TActions>};
105
- ishListCountProp?: keyof TProps & string;
106
- defaultIshList?: any[];
107
- mapParentScopeRefTo?: keyof TProps & string;
108
- mapElTo?: keyof TProps & string;
109
- ignoreItemProp?: boolean;
110
- }
111
- export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps> extends IshConfig<TProps, TActions, ETProps>{
112
- mainTemplate?: string | HTMLTemplateElement;
113
- }
114
-
115
- export type Positractions<TProps = any, TActions = TProps> =
116
- | Array<Positraction<TProps, TActions>>;
117
-
118
- export interface Positraction<TProps = any, TActions = TProps> extends LogicOp<TProps, TActions> {
119
- do:
120
- | Function
121
- | (keyof TActions & string)
122
- | PropsToProps<TProps>
123
- ifKeyIn?: Array<keyof TProps & string>,
124
- ifAllOf?: Array<keyof TProps & string>,
125
- //ifNoneOf: Array<keyof TProps & string>,
126
-
127
- pass?: Array<(keyof TProps & string) | number | boolean | '$0' | '$0+' | `\`${string}\``>,
128
- assignTo?: Array<null | (keyof TProps & string)>
129
- }
130
-
131
-
132
-
133
- export type Compacts<TProps = any, TActions = TProps> =
134
- //| Partial<{[key in `${keyof TProps & string}_to_${keyof TProps & string}` & string]: Operation<TProps> }>
135
- | Partial<{[key in `negate_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
136
- | Partial<{[key in `pass_length_of_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
137
- | Partial<{[key in `echo_${keyof TProps & string}_to_${keyof TProps & string}`]: number}>
138
- | Partial<{[key in `echo_${keyof TProps & string}_to_${keyof TProps & string}_after`]: keyof TProps}>
139
- | Partial<{[key in `when_${keyof TProps & string}_changes_call_${keyof TActions & string}`]: number}>
140
- | Partial<{[key in `when_${keyof TProps & string}_changes_toggle_${keyof TProps & string}`]: number}>
141
- | Partial<{[key in `when_${keyof TProps & string}_changes_inc_${keyof TProps & string}_by`]: number}>
142
- | Partial<{[key in `when_${keyof TProps & string}_changes_dispatch`]: string}> //TODO
143
- ;
144
-
145
- export type Hitches<TProps = any, TActions = TProps> =
146
- | Partial<{[key in `when_${keyof TProps & string}_emits_${keyof TProps & string}_inc_${keyof TProps & string}_by`]: number}>
147
- ;
148
-
149
- export interface ExtHandlerOptions {
150
- on: string,
151
- stopPropagation?: boolean,
152
- }
153
-
154
- export type ExtHandlers<ETProps = any> =
155
- | Partial<{[key in `inc_${keyof ETProps & string}` & string]: ExtHandlerOptions}>
156
- ;
157
-
158
- export type Handlers<ETProps = any, TActions = ETProps> =
159
- | Partial<{[key in `${keyof ETProps & string}_to_${keyof TActions & string}_on` & string]: string }>;
160
-
161
-
162
-
163
- export type ListOfLogicalExpressions<MCProps = any> = (keyof MCProps | LogicOp<MCProps>)[];
164
-
165
- export type LogicOpProp<MCProps = any> =
166
- |LogicOp<MCProps> | (keyof MCProps & string)[];
167
-
168
- type PropsToProps<Props> = (x: Props) => (Promise<Partial<Props>> | Partial<Props>)
169
-
170
- export interface LogicOp<Props = any, TActions = Props>{
171
- /**
172
- * Supported by trans-render
173
- */
174
- ifAllOf?: Keysh<Props>,
175
-
176
- ifKeyIn?: Keysh<Props>,
177
-
178
- ifNoneOf?: Keysh<Props>,
179
-
180
- ifEquals?: Array<Key<Props>>,
181
-
182
- ifAtLeastOneOf?: Keysh<Props>,
183
-
184
- ifNotAllOf?: Keysh<Props>,
185
-
186
- debug?: boolean,
187
-
188
- delay?: number,
189
-
190
- do?:
191
- | Function
192
- | (keyof TActions & string)
193
- | PropsToProps<Props>
194
-
195
- }
196
-
197
- export interface SetLogicOps<Props = any>{
198
-
199
- a?: boolean,
200
-
201
- ifAllOf?: Set<Key<Props>>,
202
-
203
- ifKeyIn?: Set<Key<Props>>,
204
-
205
- ifNoneOf?: Set<Key<Props>>,
206
-
207
- ifEquals?: Set<Key<Props>>,
208
-
209
- ifAtLeastOneOf?: Set<Key<Props>>,
210
-
211
- ifNotAllOf?: Set<Key<Props>>,
212
-
213
- debug?: boolean,
214
-
215
- delay?: number,
216
-
217
- do?: (x: Props) => (Promise<Partial<Props>> | Partial<Props>),
218
- }
219
-
220
- export interface Action<MCProps = any, MCActions = MCProps> extends LogicOp<MCProps>{
221
- target?: keyof MCProps;
222
- debug?: boolean;
223
- secondArg?: any;
224
- //setFree?: (keyof MCProps & string)[],
225
- }
226
-
227
- export interface IActionProcessor{
228
- doActions(self: IActionProcessor, actions: {[methodName: string]: Action}, target: any, proxy?: any): void;
229
- postHoc(self: this, action: Action, target: any, returnVal: any, proxy?: any): void;
230
- }
231
-
232
- type PropInfoTypes = "String" | "Number" | "Boolean" | "Object" | "RegExp";
233
-
234
- export interface IshPropInfo<TProps = any, TActions = any>{
235
- type?: PropInfoTypes;
236
- dry?: boolean;
237
- ro?: boolean;
238
- propName?: string;
239
- /**
240
- * Allow for discarding what is passed in favor of a modified value such as a formatted value
241
- * or filtered list
242
- */
243
- adjuster?:
244
- |keyof TActions & string
245
- |((nv: any) => any)
246
- }
247
-
248
- export interface PropInfo<TProps=any, TActions=any> extends IshPropInfo<TProps, TActions>{
249
-
250
- parse?: boolean;
251
- def?: any;
252
- attrName?: string;
253
- reflect?: boolean;
254
- /**
255
- * form associated read only property
256
- * 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.
257
- * examples: form, validity, validityMessage, willValidate
258
- */
259
- farop?: boolean;
260
- /**
261
- * form associated read only method
262
- * examples: checkValidity, reportValidity
263
- */
264
- farom?: 'checkValidity' | 'reportValidity';
265
-
266
- /**
267
- * form associated write method
268
- */
269
- fawm?: 'setValidity' | 'setFormValue'
270
-
271
- /**
272
- * internals pass through property
273
- * examples: role, ariaRole
274
- */
275
- ip?: boolean;
276
-
277
-
278
- }
279
-
280
- export type ConstString = string;
281
-
282
- export type NameOfProp = string;
283
-
284
- export type StringOrProp = ConstString | [NameOfProp, PropInfo];
285
-
286
- export type Parts = Array<StringOrProp>;
287
-
288
- export interface PropChangeInfo<TPropInfo = PropInfo> {
289
- key: string,
290
- ov: any,
291
- nv: any,
292
- prop: TPropInfo,
293
- pcm: PropChangeMethod | undefined;
294
- }
295
-
296
- //are these still really used?
297
- export type PropChangeMoment = 'v' | '-a' | '+a' | '+qr' | '+qm';
298
-
299
- export type PropChangeMethod = (self: EventTarget, pci: PropChangeInfo, moment: PropChangeMoment) => boolean;
300
-
301
- export type Actions<TProps = any, TActions = TProps> =
302
- Partial<{[key in keyof TActions & string]: LogicOp<TProps>}>
303
- //& Partial<{[key in `do_${keyof TActions & string}_on`]: Key<TActions> | Array<Key<TActions>> }>
304
- ;
305
-
306
- export type Checks<TProps = any, TActions = TProps> =
307
- Partial<{[key in keyof TActions & string]: SetLogicOps<TProps>}>
308
-
309
- export type roundaboutOptions<TProps = any, TActions = TProps, ETProps = TProps> = {
310
- vm?: TProps & TActions & RoundaboutReady,
311
- //for enhanced elements, pass in the container, referenced via $0.
312
- container?: EventTarget,
313
- propagate?: keyof TProps & string | Array<keyof TProps & string>,
314
- actions?: Actions<TProps,TActions>,
315
- compacts?: Compacts<TProps, TActions>,
316
- //onsets?: Onsets<TProps, TActions>,
317
- handlers?: Handlers<ETProps, TActions>,
318
- hitch?: Hitches<TProps, TActions>,
319
- positractions?: Positractions<TProps>,
320
- mountObservers?: Set<IMountObserver>
321
- }
322
-
323
- export type PropsToPartialProps<TProps = any> =
324
- | ((self: TProps, a: any, b: any) => Promise<Partial<TProps>>)
325
- | ((self: TProps) => Partial<TProps>);
326
-
327
- export type Infractions<TProps = any> =
328
- //| PropsToPartialProps<TProps>
329
- | Array<PropsToPartialProps<TProps>>
330
-
331
-
332
-
333
- export type Busses = {[key: string]: Set<string>};
334
-
335
- export type Routers = {[key: string]: Array<{
336
- on: string,
337
- do: string,
338
- full: string,
339
- }>}
340
-
341
- export type Key<T = any> = keyof T & string;
342
-
343
- export type Keysh<T = any> = Key<T> | Array<Key<T>>;
344
-
345
- export interface RoundaboutReady{
346
- /**
347
- * Allow for assigning to read only props via the "backdoor"
348
- * Bypasses getters / setters, sets directly to (private) memory slots
349
- * Doesn't do any notification
350
- * Allows for nested property setting
351
- */
352
- covertAssignment(obj: any): Promise<void>;
353
-
354
- /**
355
- * fires event with name matching the name of the property when the value changes (but not via covertAssignment)
356
- * when property is set via public interface, not (immediately) via an action method's return object
357
- */
358
- readonly propagator : EventTarget | undefined;
359
-
360
- /**
361
- *
362
- * https://github.com/whatwg/dom/issues/1296
363
- */
364
- //readonly disconnectedSignal: AbortSignal
365
-
366
- RAController: AbortController;
367
-
368
- /**
369
- * During this time, queues/buses continue to perform "bookkeeping"
370
- * but doesn't process the queue until sleep property becomes falsy.
371
- * If truthy, can call await awake() before processing should resume
372
- * [TODO]
373
- */
374
- readonly sleep?: number | undefined;
375
-
376
- awake(): Promise<void>;
377
-
378
- nudge(): void;
379
-
380
- rock(): void;
381
- }
382
-
383
-
384
-
385
- export interface BaseProps{
386
- proppedUp: boolean,
387
- sleep?: number;
388
- }
389
-
390
- export interface ICompact{
391
- compacts: Compacts,
392
- }
393
-
394
- interface CompactStatement {
395
- srcKey: string,
396
- destKey: string,
397
- op: 'toggle' | 'negate' | 'call' | 'pass_length' | 'echo' | 'inc' | 'dispatch',
398
- rhsIsDynamic: boolean
399
- }
400
-
401
- interface HitchStatement {
402
- leftKey: string,
403
- middleKey: string,
404
- rightKey: string,
405
- lOp: 'when'
406
- lmOp: 'emits',
407
- mrOp: 'inc',
408
- rOp: 'by'
409
- }
410
-
411
- export type CommandMethod<T extends EventTarget = EventTarget> = (self: T, evt: Event) => Partial<T> | Promise<Partial<T>>
412
-
413
- export type HookupConfig<T extends EventTarget = EventTarget> = {[key: string]: CommandMethod | [string, CommandMethod]};
414
-
415
-
416
-
@@ -1,12 +0,0 @@
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 }