mount-observer 0.1.14 → 0.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -48,11 +48,21 @@
48
48
  "./upShadowSearch.js": {
49
49
  "default": "./upShadowSearch.js",
50
50
  "types": "./upShadowSearch.ts"
51
+ },
52
+ "./handlers/*": {
53
+ "default": "./handlers/*"
51
54
  }
52
55
  },
53
56
  "files": [
54
57
  "*.js",
55
- "*.ts"
58
+ "*.ts",
59
+ "handlers/**/*.js",
60
+ "handlers/**/*.ts",
61
+ "types/**/*.d.ts",
62
+ "refid/**/*.js",
63
+ "refid/**/*.ts",
64
+ "slotkin/**/*.js",
65
+ "slotkin/**/*.ts"
56
66
  ],
57
67
  "types": "./types/mount-observer/types.d.ts",
58
68
  "scripts": {
@@ -0,0 +1,244 @@
1
+ export type EnhKey = string | symbol;
2
+
3
+ // type NoUnderscore<T extends string> = T extends `_${string}` ? never : T;
4
+
5
+ // type YesUnderscore = `_${string}`;
6
+
7
+ // export type StringWithAutocompleteOptions<TOptions> =
8
+ // | (string & {})
9
+ // | TOptions;
10
+
11
+ // export type StringNotStartWithUnderscoreAutocompleteOptions<TOptions> =
12
+ // | (NoUnderscore<string> & {})
13
+ // | TOptions;
14
+
15
+ // export type StringStartWithUnderscoreAutocompleteOptions<TOptions> =
16
+ // | (YesUnderscore & {})
17
+ // | TOptions;
18
+
19
+ //used by mount-observer, not by assign-gingerly
20
+ type DisposeEvent =
21
+ | 'disconnect'
22
+ | 'dismount'
23
+ // cannot polyfill
24
+ | 'exit' // element moved outside customElementRegistry
25
+ //reference count outside any enhancements goes to zero
26
+ | 'dispose'
27
+
28
+ export type Spawner<T = any, Obj = Element> = {
29
+ new (obj?: Obj, ctx?: SpawnContext<T>, initVals?: Partial<T>): T;
30
+ canSpawn?: (obj: any, ctx?: SpawnContext<T>) => boolean;
31
+ }
32
+
33
+ /**
34
+ * Configuration for enhancing elements with class instances
35
+ * Defines how to spawn and initialize enhancement classes
36
+ */
37
+ export interface EnhancementConfig<T = any, Obj = Element> {
38
+
39
+ spawn: Spawner<T, Obj>;
40
+
41
+ //Applicable to passing in the initVals during the spawn lifecycle event
42
+ withAttrs?: AttrPatterns<T>;
43
+
44
+ //Allow unprefixed attributes for custom elements and SVG when element tag name matches pattern
45
+ allowUnprefixed?: string | RegExp;
46
+
47
+ //keys of type symbol are used for dependency injection
48
+ //and are used by assign-gingerly
49
+ symlinks?: { [key: symbol]: keyof T };
50
+ //only applicable when spawning from a DOM Element reference
51
+ enhKey?: EnhKey;
52
+ lifecycleKeys?:
53
+ | true // Use standard names: "dispose" method, "resolved" property/event
54
+ | {
55
+ dispose?: string | symbol,
56
+ resolved?: string | symbol
57
+ }
58
+ //used by mount-observer, not by assign-gingerly
59
+ //impossible to polyfill, but will always be disposed
60
+ //when oElement's reference count goes to zero
61
+ disposeOn?: DisposeEvent | DisposeEvent[]
62
+
63
+ }
64
+
65
+ export type Constructor = new (...args: any[]) => any;
66
+
67
+ export type pathString = `?.${string}`;
68
+
69
+ export type CustomElementName = string;
70
+ export type CustomElementConstructorStaticMethodName = string;
71
+
72
+ export interface AttrConfig<T = any> {
73
+ /**
74
+ * Type of the property value (JSON-serializable string format)
75
+ */
76
+ instanceOf?: 'Object' | 'String' | 'Number' | 'Boolean' | 'Array'
77
+ | typeof Object | typeof String | typeof Number | typeof Boolean | typeof Array;
78
+
79
+
80
+ /**
81
+ * Property name on the spawned class instance to map to
82
+ * Use '.' to map to the root object using assignGingerly
83
+ * Is optional.
84
+ * If not specified, we assume it is the key without the underscore first
85
+ * character, unless the key is _base in which case it assume mapsTo = "."
86
+ */
87
+ mapsTo?:
88
+ | '.'
89
+ | keyof T
90
+ | pathString
91
+ | `${pathString} +=`
92
+ | `${pathString} =!`
93
+ | `${pathString} -=`
94
+
95
+ /**
96
+ * Parser to transform attribute string value
97
+ * - Function: Inline parser function (not JSON serializable)
98
+ * - String: Named parser reference (JSON serializable) - looks up in global parser registry (e.g., 'timestamp', 'csv')
99
+ * - Tuple: [CustomElementName, StaticMethodName] - looks up static method on custom element constructor (e.g., ['my-widget', 'parseSpecial'])
100
+ */
101
+ parser?:
102
+ | ((attrValue: string | null) => any)
103
+ | string
104
+ | [CustomElementName, CustomElementConstructorStaticMethodName]
105
+ ;
106
+
107
+ /**
108
+ * Default value to use when attribute is missing
109
+ * If defined, bypasses parser when attribute is not present
110
+ * If undefined, property is not added to initVals when attribute is missing
111
+ */
112
+ valIfNull?: any;
113
+
114
+ /**
115
+ * Enable caching of parsed attribute values
116
+ * - 'shared': Cache and reuse the same parsed object (fast, but enhancements must not mutate)
117
+ * - 'cloned': Cache and return a structural clone (safer, but slower)
118
+ * Note: Parsers should be pure functions when using caching
119
+ */
120
+ parseCache?: 'shared' | 'cloned';
121
+
122
+ // /**
123
+ // * Whether to only read the initial value (true) or continue observing changes (false)
124
+ // * Defaults to true (initial read only)
125
+ // */
126
+ // initialOnly?: boolean;
127
+ }
128
+
129
+ export type AttrPatterns<T = any> = {
130
+ /**
131
+ * Base prefix for attribute names
132
+ */
133
+ base: string;
134
+
135
+ /**
136
+ * Configuration for the base pattern
137
+ */
138
+ _base?: AttrConfig<T>;
139
+ } & {
140
+ // Provide autocomplete for all properties of T (optional)
141
+ [K in keyof T]?: string | AttrConfig<T>;
142
+ } & {
143
+ // Provide autocomplete for underscore-prefixed config keys
144
+ [K in keyof T as `_${string & K}`]?: AttrConfig<T>;
145
+ } & {
146
+ // Allow any other string keys for custom patterns
147
+ [key: string]: string | AttrConfig<T>;
148
+ };
149
+
150
+
151
+ export interface SpawnContext<T = any, TMountContext = any> {
152
+ config: EnhancementConfig<T>;
153
+ mountCtx?: TMountContext;
154
+ }
155
+
156
+ /**
157
+ * @deprecated Use EnhancementConfig instead
158
+ */
159
+ export type IEnhancementRegistryItem<T = any> = EnhancementConfig<T>;
160
+
161
+ /**
162
+ * Interface for the options passed to assignGingerly
163
+ */
164
+ export interface IAssignGingerlyOptions {
165
+ registry?: typeof EnhancementRegistry | EnhancementRegistry;
166
+ bypassChecks?: boolean;
167
+ }
168
+
169
+ /**
170
+ * Event dispatched when enhancement configs are registered
171
+ */
172
+ export declare class EnhancementRegisteredEvent extends Event {
173
+ static eventName: string;
174
+ config: EnhancementConfig | EnhancementConfig[];
175
+ constructor(config: EnhancementConfig | EnhancementConfig[]);
176
+ }
177
+
178
+ /**
179
+ * Base registry class for managing enhancement configurations
180
+ * Extends EventTarget to dispatch events when configs are registered
181
+ */
182
+ export declare class EnhancementRegistry extends EventTarget {
183
+ private items;
184
+ push(items: EnhancementConfig | EnhancementConfig[]): void;
185
+ getItems(): EnhancementConfig[];
186
+ findBySymbol(symbol: symbol | string): EnhancementConfig | undefined;
187
+ findByEnhKey(enhKey: string | symbol): EnhancementConfig | undefined;
188
+ }
189
+
190
+ /**
191
+ * Constructor signature for ItemScope Manager classes
192
+ */
193
+ export type ItemscopeManager<T = any> = {
194
+ new (element: HTMLElement, initVals?: Partial<T>): T;
195
+ }
196
+
197
+ /**
198
+ * Configuration for ItemScope Manager registration
199
+ */
200
+ export interface ItemscopeManagerConfig<T = any> {
201
+ /**
202
+ * Manager class constructor
203
+ */
204
+ manager: ItemscopeManager<T>;
205
+
206
+ /**
207
+ * Optional lifecycle method keys
208
+ * - dispose: Method name to call when manager is disposed
209
+ * - resolved: Property/event name indicating manager is ready
210
+ */
211
+ lifecycleKeys?: {
212
+ dispose?: string | symbol;
213
+ resolved?: string | symbol;
214
+ };
215
+ }
216
+
217
+ /**
218
+ * Registry for ItemScope Manager configurations
219
+ * Extends EventTarget to support lazy registration via events
220
+ */
221
+ export declare class ItemscopeRegistry extends EventTarget {
222
+ define(name: string, config: ItemscopeManagerConfig): void;
223
+ get(name: string): ItemscopeManagerConfig | undefined;
224
+ whenDefined(name: string): Promise<void>;
225
+ }
226
+
227
+ /**
228
+ * Main assignGingerly function
229
+ */
230
+ export declare function assignGingerly(
231
+ target: any,
232
+ source: Record<string | symbol, any>,
233
+ options?: IAssignGingerlyOptions
234
+ ): any;
235
+
236
+ export default assignGingerly;
237
+
238
+ export declare class ElementEnhancementGateway{
239
+ enh: ElementEnhancement;
240
+ }
241
+
242
+ export interface ElementEnhancement{
243
+ dispose(regItem: EnhancementConfig): void;
244
+ }
@@ -0,0 +1,3 @@
1
+ export interface BeABeaconProps {
2
+ eventName: string;
3
+ }
@@ -0,0 +1,29 @@
1
+ // Type declarations for Map.prototype.getOrInsertComputed and WeakMap.prototype.getOrInsertComputed
2
+ // Feature is now supported in all modern browsers (Chrome 146+, Firefox 134+, Safari 18.2+)
3
+ // See: https://web-platform-dx.github.io/web-features-explorer/features/getorinsert/
4
+
5
+ interface Map<K, V> {
6
+ /**
7
+ * Returns the value associated with the key if it exists, otherwise inserts
8
+ * the value returned by the insert callback and returns it.
9
+ * @param key The key to look up
10
+ * @param insert A callback that returns the value to insert if the key doesn't exist
11
+ * @returns The existing or newly inserted value
12
+ */
13
+ getOrInsertComputed(key: K, insert: () => V): V;
14
+ }
15
+
16
+ interface WeakMap<K extends object, V> {
17
+ /**
18
+ * Returns the value associated with the key if it exists, otherwise inserts
19
+ * the value returned by the insert callback and returns it.
20
+ * @param key The key to look up
21
+ * @param insert A callback that returns the value to insert if the key doesn't exist
22
+ * @returns The existing or newly inserted value
23
+ */
24
+ getOrInsertComputed(key: K, insert: () => V): V;
25
+ }
26
+
27
+ interface HTMLTemplateElement {
28
+ remoteContent?: Node;
29
+ }
@@ -0,0 +1,26 @@
1
+ // Type definitions for id-generation
2
+
3
+ export interface GenIdsOptions {
4
+ //startCounter?: number;
5
+ }
6
+
7
+ export interface ParsedDataId {
8
+ name: string;
9
+ setName: boolean;
10
+ setItemprop: boolean;
11
+ setClass: boolean;
12
+ setPart: boolean;
13
+ setItemscope: boolean;
14
+ }
15
+
16
+ export interface ScopeInfo {
17
+ scopeElement: Element;
18
+ elementsToProcess: Element[];
19
+ }
20
+
21
+ export interface AttributeReplacement {
22
+ element: Element;
23
+ attributeName: string;
24
+ oldValue: string;
25
+ newValue: string;
26
+ }
@@ -0,0 +1,330 @@
1
+ // Core types for MountObserver v2 - Polyfill Supported Scenario I
2
+
3
+ export type Constructor = new (...args: any[]) => any;
4
+
5
+ export type EventConstructor = {new(...args: any[]): Event};
6
+
7
+ export interface EventConfig {
8
+ event: string | EventConstructor;
9
+ args?: any | any[];
10
+ eventProps?: Record<string, any>;
11
+ oncePerMountedElement?: boolean;
12
+ }
13
+
14
+ export type DismountReason =
15
+ | 'media-query-failed'
16
+ | 'root-size-failed'
17
+ | 'intersection-failed'
18
+ | 'connection-failed'
19
+ | 'with-matching-failed';
20
+
21
+ export interface ConnectionCondition {
22
+ effectiveTypeIn?: string[];
23
+ downlinkMin?: number;
24
+ downlinkMax?: number;
25
+ rttMax?: number;
26
+ }
27
+
28
+ /**
29
+ * Configuration object for MountObserver that defines what elements to observe and how to handle them.
30
+ * All `where*` properties form an AND condition - elements must satisfy ALL specified conditions to mount.
31
+ *
32
+ * @template TKeys - String literal type for sub-observer keys when using the `with` property
33
+ */
34
+ export interface MountConfig<TKeys extends string = string> {
35
+ /**
36
+ * CSS selector string to match elements.
37
+ * Only elements matching this selector will be considered for mounting.
38
+ * @example 'button.fancy' or 'div > p.highlight'
39
+ */
40
+ matching?: string;
41
+
42
+ /**
43
+ * Custom element tag name(s) that must be defined before mounting occurs.
44
+ * Waits for customElements.whenDefined() to resolve for each specified tag.
45
+ * Uses the customElementRegistry of the observed root node.
46
+ * This check happens first, before any other where* conditions.
47
+ * @example 'my-button' or ['my-button', 'my-input']
48
+ */
49
+ whenDefined?: string | string[];
50
+
51
+ /**
52
+ * Constructor or array of constructors to filter elements by instance type.
53
+ * Elements must be instances of at least one of the specified constructors (OR logic for arrays).
54
+ * @example HTMLButtonElement or [HTMLInputElement, HTMLTextAreaElement]
55
+ */
56
+ whereInstanceOf?: Constructor | Constructor[];
57
+
58
+ /**
59
+ * Media query string or MediaQueryList for conditional mounting based on viewport/media conditions.
60
+ * Elements only mount when the media query matches.
61
+ * @example '(min-width: 768px)' or '(prefers-color-scheme: dark)'
62
+ */
63
+ withMediaMatching?: string | MediaQueryList;
64
+
65
+ /**
66
+ * CSS selector defining a "donut hole" scope perimeter.
67
+ * Excludes elements that are descendants of elements matching this selector.
68
+ * Useful for preventing observation of nested scopes.
69
+ * @example '.no-observe' to exclude elements inside .no-observe containers
70
+ */
71
+ withScopePerimeter?: string;
72
+
73
+ /**
74
+ * Container query string for conditional mounting based on observed root element size.
75
+ * Elements only mount when the root node matches this size condition.
76
+ * @example '(min-width: 500px)' to only mount when root is at least 500px wide
77
+ */
78
+ whereObservedRootSizeMatches?: string;
79
+
80
+ /**
81
+ * IntersectionObserver configuration for conditional mounting based on element visibility.
82
+ * Elements only mount when they intersect with the viewport according to these options.
83
+ * @example { rootMargin: '50px', threshold: 0.5 }
84
+ */
85
+ whereElementIntersectsWith?: IntersectionObserverInit;
86
+
87
+ /**
88
+ * Network connection conditions for conditional mounting.
89
+ * Elements only mount when network conditions match the specified criteria.
90
+ * Useful for adaptive loading based on connection quality.
91
+ */
92
+ whereConnectionHas?: ConnectionCondition;
93
+
94
+ /**
95
+ * When true, inverts the default registry matching behavior.
96
+ * Default (false): Only mount elements with the SAME customElementRegistry as the root node.
97
+ * When true: Only mount elements with a DIFFERENT customElementRegistry than the root node.
98
+ * Useful for cross-registry observation scenarios.
99
+ * @example true to observe elements from other shadow DOM scopes
100
+ */
101
+ whereDifferentCustomElementRegistry?: boolean;
102
+
103
+ /**
104
+ * Regular expression or string pattern to match against element's localName.
105
+ * Only elements whose localName matches this pattern will mount.
106
+ * String values are converted to RegExp.
107
+ * @example /^my-/ to match elements starting with 'my-'
108
+ * @example 'button|input' to match button or input elements
109
+ */
110
+ whereLocalNameMatches?: string | RegExp;
111
+
112
+ /**
113
+ * Module(s) to import before mounting elements.
114
+ * Can be a URL string, ImportSpec object, or array of either.
115
+ * Modules are loaded based on loadingEagerness setting.
116
+ * @example './my-component.js' or [{ url: './styles.css', type: 'css' }]
117
+ */
118
+ import?: string | ImportSpec | Array<string | ImportSpec>;
119
+
120
+ /**
121
+ * Handler(s) to execute when elements mount.
122
+ * Can be:
123
+ * - String: Name of a registered handler (e.g., 'builtIns.defineCustomElement')
124
+ * - Function: Inline callback function
125
+ * - Array: Multiple handlers to execute in order
126
+ * @example 'builtIns.defineCustomElement' or (el, ctx) => { el.classList.add('mounted') }
127
+ */
128
+ do?: string | DoCallback | (string | DoCallback)[];
129
+
130
+ /**
131
+ * Custom JavaScript check that runs after all declarative where* conditions pass.
132
+ * This is the final gate before mounting occurs.
133
+ *
134
+ * If shouldMount returns false, the element is not mounted (no do callback, no mount event).
135
+ * If shouldMount throws an error, it is treated as returning false and the error is logged.
136
+ *
137
+ * @example (el) => currentUser.hasRole('admin')
138
+ * @example (el) => el.dataset.apiKey && el.dataset.apiEndpoint
139
+ */
140
+ shouldMount?: ShouldMountCallback;
141
+
142
+ /**
143
+ * Controls when imports are loaded.
144
+ * - 'eager': Load imports immediately when MountObserver is created
145
+ * - 'lazy': Load imports only when first matching element is found (default)
146
+ */
147
+ loadingEagerness?: 'eager' | 'lazy';
148
+
149
+ /**
150
+ * Properties to assign to elements when they mount.
151
+ * Uses assign-gingerly for safe property assignment.
152
+ * @example { disabled: false, tabIndex: 0 }
153
+ */
154
+ assignOnMount?: Record<string, any>;
155
+
156
+ /**
157
+ * Properties to assign to elements when they dismount.
158
+ * Uses assign-gingerly for safe property assignment.
159
+ * @example { disabled: true }
160
+ */
161
+ assignOnDismount?: Record<string, any>;
162
+
163
+ /**
164
+ * Properties to tentatively assign on mount with automatic reversal on dismount.
165
+ * Original values are saved and restored when element dismounts.
166
+ * @example { hidden: false } - will restore original hidden value on dismount
167
+ */
168
+ stageOnMount?: Record<string, any>;
169
+
170
+ /**
171
+ * When true, enables detailed event dispatching for debugging and monitoring.
172
+ * Provides granular lifecycle events for observation.
173
+ */
174
+ getPlayByPlay?: boolean;
175
+
176
+ /**
177
+ * Event(s) to emit from mounted elements.
178
+ * Can be a single EventConfig or array of EventConfigs.
179
+ * Allows elements to dispatch custom events when mounted.
180
+ * @example { event: 'ready', args: { detail: 'mounted' } }
181
+ */
182
+ mountedElemEmits?: EventConfig | EventConfig[];
183
+
184
+ /**
185
+ * External module(s) to import MountConfig from.
186
+ * Allows separating JSON-serializable config from non-serializable handlers.
187
+ * Loaded configs are merged left-to-right, with inline config taking final precedence.
188
+ * @example './config.js' or ['./base-config.js', './override-config.js']
189
+ */
190
+ configFrom?: string | string[];
191
+
192
+ /**
193
+ * Custom data to pass to handler classes or functions.
194
+ * Allows handlers to receive additional context-specific information.
195
+ * Not used by MountObserver itself, but available in MountContext.
196
+ */
197
+ customData?: unknown;
198
+
199
+ /**
200
+ * Sub-observer configurations for hierarchical composition.
201
+ * Each key-value pair defines a sub-observer that will observe the same root node as the parent.
202
+ * Sub-observers are created when the parent's observe() method is called and automatically
203
+ * disconnected when the parent disconnects.
204
+ *
205
+ * Sub-observers operate independently with their own configurations and do not inherit
206
+ * properties from the parent observer. Each sub-observer can have its own `with` property
207
+ * for unlimited nesting depth.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * const observer = new MountObserver({
212
+ * matching: '.parent',
213
+ * with: {
214
+ * registry: { matching: 'my-element', do: 'builtIns.defineCustomElement' },
215
+ * styles: { import: './styles.css' }
216
+ * }
217
+ * });
218
+ * ```
219
+ */
220
+ with?: {[K in TKeys]: MountConfig};
221
+ }
222
+
223
+
224
+
225
+ export interface ImportSpec {
226
+ url: string;
227
+ type?: 'js' | 'css' | 'json' | 'html';
228
+ }
229
+
230
+ /**
231
+ * Context object passed to mount handlers containing information about the mounted element and observer state.
232
+ *
233
+ * @template TKeys - String literal type for sub-observer keys when using the `with` property
234
+ */
235
+ export interface MountContext<TKeys extends string = string> {
236
+ modules: any[];
237
+ observer: IMountObserver;
238
+ rootNode: Node;
239
+
240
+ /**
241
+ * The configuration object for this observer.
242
+ * Contains all the settings that define what elements to observe and how to handle them.
243
+ */
244
+ mountConfig: MountConfig<TKeys>;
245
+
246
+ /**
247
+ * Map of sub-observers created from the `with` property in mountConfig.
248
+ * Only present when the parent observer has sub-observers defined.
249
+ * Keys match the keys from the `with` property, providing type-safe access to sub-observers.
250
+ *
251
+ * @example
252
+ * ```typescript
253
+ * do: (el, ctx) => {
254
+ * // Access sub-observers with type safety
255
+ * const registryObserver = ctx.withObservers?.registry;
256
+ * if (registryObserver) {
257
+ * console.log('Registry observer:', registryObserver);
258
+ * }
259
+ * }
260
+ * ```
261
+ */
262
+ withObservers?: {[K in TKeys]: IMountObserver};
263
+ }
264
+
265
+
266
+
267
+ export type DoCallback<TKeys extends string = string> = (mountedElement: Element, context: MountContext<TKeys>) => void;
268
+
269
+ /**
270
+ * Callback function that performs a final check before mounting an element.
271
+ * Called after all declarative where* conditions have passed.
272
+ *
273
+ * @param mountedElement - The element being considered for mounting
274
+ * @param context - The mount context containing modules, observer, config, etc.
275
+ * @returns true to allow mounting, false to prevent it
276
+ */
277
+ export type ShouldMountCallback<TKeys extends string = string> = (mountedElement: Element, context: MountContext<TKeys>) => boolean;
278
+
279
+ // export interface DoCallbacks {
280
+ // mount?: (mountedElement: Element, context: MountContext) => void;
281
+ // dismount?: (mountedElement: Element, context: MountContext) => void;
282
+ // disconnect?: (mountedElement: Element, context: MountContext) => void;
283
+ // reconnect?: (mountedElement: Element, context: MountContext) => void;
284
+ // }
285
+
286
+ export type MountScope =
287
+ | 'registry' // Observe all scopes with matching registry (new default)
288
+ | 'registryRoot' // getRegistryRoot - finds highest node with matching customElementRegistry
289
+ | 'self' // this element
290
+ | 'root' // getRootNode()
291
+ | 'shadow' // shadowRoot (throws if none)
292
+ | Element; // custom element to observe
293
+
294
+ export interface MountObserverOptions {
295
+ disconnectedSignal?: AbortSignal;
296
+ scope?: MountScope;
297
+ }
298
+
299
+ export interface WeakDual<T extends Object>{
300
+ weakSet: WeakSet<T>,
301
+ setWeak: Set<WeakRef<T>>
302
+ }
303
+
304
+ export interface WeakMapDual<T extends Object, R extends Object>{
305
+ weakMap: WeakMap<T, R>,
306
+ setWeak: Set<WeakRef<T>>
307
+ }
308
+
309
+ export interface IMountObserver extends EventTarget {
310
+ observe(observedNode: Node): Promise<void>;
311
+ disconnect(): void;
312
+ disconnectedSignal: AbortSignal;
313
+ assignGingerly(config: Record<string, any> | undefined): Promise<void>;
314
+ getNotifier(element: Element): EventTarget;
315
+ }
316
+
317
+ export interface IMountEvent extends Event {
318
+ mountedElement: Element;
319
+ modules: any[];
320
+ mountConfig: MountConfig;
321
+ mountContext: MountContext;
322
+ }
323
+
324
+ export interface IDismountEvent extends Event {
325
+ mountedElement: Element;
326
+ reason: DismountReason;
327
+ mountConfig: MountConfig;
328
+ }
329
+
330
+