mount-observer 0.1.7 → 0.1.8

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.
@@ -1,5 +1,5 @@
1
1
  import { EvtRt } from './EvtRt.js';
2
- import { MountConfig, MountContext } from './types.js';
2
+ import { MountConfig, MountContext } from './types/mount-observer/types.js';
3
3
 
4
4
  export class DefineCustomElementHandler extends EvtRt {
5
5
  mount(mountedElement: Element, MountConfig: MountConfig, context: MountContext): void {
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { MountObserver } from './MountObserver.js';
7
7
  import { getRootRegistryContainer } from './getRootRegistryContainer.js';
8
- import type { MountConfig, MountObserverOptions } from './types.js';
9
- import type { EnhancementConfig } from 'assign-gingerly/types.js';
8
+ import type { MountConfig, MountObserverOptions } from './types/mount-observer/types.js';
9
+ import type { EnhancementConfig } from './types/assign-gingerly/types.js';
10
10
 
11
11
  declare global {
12
12
  interface Element {
package/Events.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Event classes for MountObserver
2
- import type { IMountEvent, IDismountEvent, MountConfig, DismountReason, MountContext } from './types.js';
2
+ import type { IMountEvent, IDismountEvent, MountConfig, DismountReason, MountContext } from './types/mount-observer/types.js';
3
3
 
4
4
  // Event name constants
5
5
  export const loadEventName = 'load';
package/EvtRt.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {MountContext, MountConfig} from './types.js';
1
+ import {MountContext, MountConfig} from './types/mount-observer/types.js';
2
2
 
3
3
  import {
4
4
  DismountEvent, MountEvent, DisconnectEvent,
package/MountObserver.ts CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  EventConfig,
8
8
  EventConstructor,
9
9
  Constructor
10
- } from './types.js';
10
+ } from './types/mount-observer/types.js';
11
11
  import { arr } from './arr.js';
12
12
  import {
13
13
  MountEvent,
@@ -22,7 +22,7 @@ import {
22
22
  } from './SharedMutationObserver.js';
23
23
  import { withScopePerimeter } from './withScopePerimeter.js';
24
24
  import type { assignTentatively as AssignTentativelyType } from 'assign-gingerly/assignTentatively.js';
25
- import type { BaseRegistry, EnhancementConfig } from 'assign-gingerly/types.js';
25
+ import type { BaseRegistry, EnhancementConfig } from './types/assign-gingerly/types.js';
26
26
 
27
27
  export class MountObserver extends EventTarget implements IMountObserver {
28
28
  // Static registry for registered handlers
package/emitEvents.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { EventConfig, EventConstructor, MountConfig } from './types.d.ts';
1
+ import type { EventConfig, EventConstructor, MountConfig } from './types/mount-observer/types.d.ts';
2
2
 
3
3
  /**
4
4
  * Emits events from a mounted element based on the mountedElemEmits configuration.
package/index.ts CHANGED
@@ -14,7 +14,7 @@ export type {
14
14
  ImportSpec,
15
15
  IMountEvent,
16
16
  IDismountEvent
17
- } from './types.js';
17
+ } from './types/mount-observer/types.js';
18
18
  export {
19
19
  mountEventName,
20
20
  dismountEventName,
package/loadImports.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Dynamic import loading utilities
2
2
  // Only loaded when MountConfig.import is specified
3
3
 
4
- import { ImportSpec } from './types.js';
4
+ import { ImportSpec } from './types/mount-observer/types.js';
5
5
  import { arr } from './arr.js';
6
6
 
7
7
  export async function loadImports(
package/mediaQuery.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Media query handling for MountObserver
2
- import type { MountConfig, MountContext, WeakDual } from './types.js';
2
+ import type { MountConfig, MountContext, WeakDual } from './types/mount-observer/types.js';
3
3
  import { MediaMatchEvent, MediaUnmatchEvent, DismountEvent } from './Events.js';
4
4
 
5
5
  export function setupMediaQuery(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -45,7 +45,7 @@
45
45
  "*.js",
46
46
  "*.ts"
47
47
  ],
48
- "types": "./types.d.ts",
48
+ "types": "./types/mount-observer/types.d.ts",
49
49
  "scripts": {
50
50
  "serve": "node ./node_modules/spa-ssi/serve.js",
51
51
  "test": "playwright test",
package/types.d.ts DELETED
@@ -1,103 +0,0 @@
1
- // Core types for MountObserver v2 - Polyfill Supported Scenario I
2
-
3
- import {EnhancementConfig} from 'assign-gingerly/types.d.ts';
4
-
5
- export type Constructor = new (...args: any[]) => any;
6
-
7
- export type EventConstructor = {new(...args: any[]): Event};
8
-
9
- export interface EventConfig {
10
- event: string | EventConstructor;
11
- args?: any | any[];
12
- eventProps?: Record<string, any>;
13
- oncePerMountedElement?: boolean;
14
- }
15
-
16
- export type DismountReason =
17
- | 'media-query-failed'
18
- | 'with-matching-failed';
19
-
20
- export interface MountConfig {
21
- matching?: string;
22
- withInstance?: Constructor | Constructor[];
23
- withMediaMatching?: string | MediaQueryList;
24
- withScopePerimeter?: string;
25
- import?: string | ImportSpec | Array<string | ImportSpec>;
26
- do?: string | DoCallback | (string | DoCallback)[];
27
- loadingEagerness?: 'eager' | 'lazy';
28
- assignOnMount?: Record<string, any>;
29
- assignOnDismount?: Record<string, any>;
30
- stageOnMount?: Record<string, any>;
31
- getPlayByPlay?: boolean;
32
- mountedElemEmits?: EventConfig | EventConfig[];
33
- reference?: number | number[];
34
- //allow handler classes or functions
35
- //to be passed some custom information
36
- customData?: unknown;
37
- enhancementConfig?: EnhancementConfig | EnhancementConfig[];
38
- }
39
-
40
-
41
-
42
- export interface ImportSpec {
43
- url: string;
44
- type?: 'js' | 'css' | 'json' | 'html';
45
- }
46
-
47
- export interface MountContext {
48
- modules: any[];
49
- observer: IMountObserver;
50
- rootNode: Node;
51
- MountConfig: MountConfig
52
- }
53
-
54
-
55
-
56
- export type DoCallback = (mountedElement: Element, context: MountContext) => void;
57
-
58
- // export interface DoCallbacks {
59
- // mount?: (mountedElement: Element, context: MountContext) => void;
60
- // dismount?: (mountedElement: Element, context: MountContext) => void;
61
- // disconnect?: (mountedElement: Element, context: MountContext) => void;
62
- // reconnect?: (mountedElement: Element, context: MountContext) => void;
63
- // }
64
-
65
- export type MountScope =
66
- | 'registry' // getRootRegistryContainer (default)
67
- | 'self' // this element
68
- | 'root' // getRootNode()
69
- | 'shadow' // shadowRoot (throws if none)
70
- | Element; // custom element to observe
71
-
72
- export interface MountObserverOptions {
73
- disconnectedSignal?: AbortSignal;
74
- scope?: MountScope;
75
- }
76
-
77
- export interface WeakDual<T extends Object>{
78
- weakSet: WeakSet<T>,
79
- setWeak: Set<WeakRef<T>>
80
- }
81
-
82
- export interface IMountObserver extends EventTarget {
83
- observe(rootNode: Node): Promise<void>;
84
- disconnect(): void;
85
- disconnectedSignal: AbortSignal;
86
- assignGingerly(config: Record<string, any> | undefined): Promise<void>;
87
- getNotifier(element: Element): EventTarget;
88
- }
89
-
90
- export interface IMountEvent extends Event {
91
- mountedElement: Element;
92
- modules: any[];
93
- MountConfig: MountConfig;
94
- mountContext: MountContext;
95
- }
96
-
97
- export interface IDismountEvent extends Event {
98
- mountedElement: Element;
99
- reason: DismountReason;
100
- MountConfig: MountConfig;
101
- }
102
-
103
-