mount-observer 0.1.32 → 0.1.35

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/Synthesizer.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import './ElementMountExtension.js';
2
2
  import { waitForEvent } from 'assign-gingerly/waitForEvent.js';
3
3
  import { AddedScriptElementEvent } from './Events.js';
4
- import { registryItem as inferRegistryItem } from 'assign-gingerly/Infer.js';
5
4
  import 'mount-observer/handlers/MountObserverScript.js';
6
5
  import { mos } from 'mount-observer/handlers/MountObserverScript.js';
7
6
  import 'mount-observer/handlers/ScriptExport.js';
@@ -63,11 +62,6 @@ export class Synthesizer extends HTMLElement {
63
62
  connectedCallback() {
64
63
  // Synthesizer elements are infrastructure, not UI
65
64
  this.hidden = true;
66
- // Register the Infer enhancement in the appropriate registry
67
- const registry = this.customElementRegistry || customElements;
68
- if (registry.enhancementRegistry) {
69
- registry.enhancementRegistry.push(inferRegistryItem);
70
- }
71
65
  // Identify the root node
72
66
  const rootNode = this.getRootNode();
73
67
  // Determine if this is a syndicator or subscriber
@@ -221,16 +215,25 @@ export class Synthesizer extends HTMLElement {
221
215
  // Check if export property exists
222
216
  let exportValue = scriptElement.export;
223
217
  if (!exportValue) {
224
- // Wait for resolved event with timeout
225
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout waiting for resolved event')), 5000));
226
- const eventPromise = waitForEvent(scriptElement, 'resolved');
218
+ // Determine which event to wait for based on script type
219
+ const scriptType = scriptElement.getAttribute('type');
220
+ const eventName = scriptType === 'emc-parser' ? 'parser-registered' : 'resolved';
221
+ // Wait for appropriate event with timeout
222
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout waiting for ${eventName} event`)), 5000));
223
+ const eventPromise = waitForEvent(scriptElement, eventName);
227
224
  const event = await Promise.race([eventPromise, timeoutPromise]);
228
- exportValue = event.export;
225
+ // For parser scripts, we don't need an export value
226
+ // For other scripts, get the export from the event
227
+ if (scriptType !== 'emc-parser') {
228
+ exportValue = event.export;
229
+ }
229
230
  }
230
231
  // Clone the script element
231
232
  const clonedScript = scriptElement.cloneNode(true);
232
- // Copy the export property
233
- clonedScript.export = exportValue;
233
+ // Copy the export property if it exists
234
+ if (exportValue !== undefined) {
235
+ clonedScript.export = exportValue;
236
+ }
234
237
  // Append to this element's children
235
238
  this.appendChild(clonedScript);
236
239
  }
package/Synthesizer.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import './ElementMountExtension.js';
2
2
  import { waitForEvent } from 'assign-gingerly/waitForEvent.js';
3
3
  import { AddedScriptElementEvent } from './Events.js';
4
- import { registryItem as inferRegistryItem } from 'assign-gingerly/Infer.js';
5
4
 
6
5
  import 'mount-observer/handlers/MountObserverScript.js';
7
6
  import {mos} from 'mount-observer/handlers/MountObserverScript.js';
@@ -69,12 +68,6 @@ export abstract class Synthesizer extends HTMLElement {
69
68
  // Synthesizer elements are infrastructure, not UI
70
69
  this.hidden = true;
71
70
 
72
- // Register the Infer enhancement in the appropriate registry
73
- const registry = (this as any).customElementRegistry || customElements;
74
- if (registry.enhancementRegistry) {
75
- registry.enhancementRegistry.push(inferRegistryItem);
76
- }
77
-
78
71
  // Identify the root node
79
72
  const rootNode = this.getRootNode();
80
73
 
@@ -250,22 +243,33 @@ export abstract class Synthesizer extends HTMLElement {
250
243
  let exportValue = (scriptElement as any).export;
251
244
 
252
245
  if (!exportValue) {
253
- // Wait for resolved event with timeout
246
+ // Determine which event to wait for based on script type
247
+ const scriptType = scriptElement.getAttribute('type');
248
+ const eventName = scriptType === 'emc-parser' ? 'parser-registered' : 'resolved';
249
+
250
+ // Wait for appropriate event with timeout
254
251
  const timeoutPromise = new Promise((_, reject) =>
255
- setTimeout(() => reject(new Error('Timeout waiting for resolved event')), 5000)
252
+ setTimeout(() => reject(new Error(`Timeout waiting for ${eventName} event`)), 5000)
256
253
  );
257
254
 
258
- const eventPromise = waitForEvent(scriptElement, 'resolved');
255
+ const eventPromise = waitForEvent(scriptElement, eventName);
259
256
 
260
257
  const event = await Promise.race([eventPromise, timeoutPromise]);
261
- exportValue = (event as any).export;
258
+
259
+ // For parser scripts, we don't need an export value
260
+ // For other scripts, get the export from the event
261
+ if (scriptType !== 'emc-parser') {
262
+ exportValue = (event as any).export;
263
+ }
262
264
  }
263
265
 
264
266
  // Clone the script element
265
267
  const clonedScript = scriptElement.cloneNode(true) as HTMLScriptElement;
266
268
 
267
- // Copy the export property
268
- (clonedScript as any).export = exportValue;
269
+ // Copy the export property if it exists
270
+ if (exportValue !== undefined) {
271
+ (clonedScript as any).export = exportValue;
272
+ }
269
273
 
270
274
  // Append to this element's children
271
275
  this.appendChild(clonedScript);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.1.32",
3
+ "version": "0.1.35",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -1,5 +1,6 @@
1
1
  // playwright.config.ts
2
2
  import { PlaywrightTestConfig, devices } from '@playwright/test';
3
+
3
4
  const config: PlaywrightTestConfig = {
4
5
  testIgnore: '**/experimentalCrossScopeRegistering/**',
5
6
  webServer: {
@@ -16,14 +17,35 @@ const config: PlaywrightTestConfig = {
16
17
  name: 'chromium',
17
18
  use: { ...devices['Desktop Chrome'] },
18
19
  },
19
- // {
20
- // name: 'firefox',
21
- // use: { ...devices['Desktop Firefox'] },
22
- // },
23
- // {
24
- // name: 'webkit',
25
- // use: { ...devices['Desktop Safari'] },
26
- // },
20
+ {
21
+ name: 'firefox',
22
+ use: { ...devices['Desktop Firefox'] },
23
+ // Tests to skip in Firefox (known failures)
24
+ // Note: experimentalCrossScopeRegistering is already ignored globally
25
+ testIgnore: [
26
+ '**/experimentalCrossScopeRegistering/**',
27
+ '**/id-generation-integration.spec.mjs',
28
+ '**/test-element-mount.spec.mjs',
29
+ '**/test-emc-script.spec.mjs',
30
+ '**/test-enhance-mounted-element.spec.mjs',
31
+ '**/test-mount-globally.spec.mjs',
32
+ ],
33
+ },
34
+ {
35
+ name: 'webkit',
36
+ use: { ...devices['Desktop Safari'] },
37
+ // Tests to skip in WebKit (known failures)
38
+ // Note: experimentalCrossScopeRegistering is already ignored globally
39
+ testIgnore: [
40
+ '**/experimentalCrossScopeRegistering/**',
41
+ '**/test-builtins.spec.mjs',
42
+ '**/test-element-mount.spec.mjs',
43
+ '**/test-emc-script.spec.mjs',
44
+ '**/test-enhance-mounted-element.spec.mjs',
45
+ '**/test-mount-globally.spec.mjs',
46
+ ],
47
+ },
27
48
  ],
28
49
  };
50
+
29
51
  export default config;
@@ -298,9 +298,15 @@ export declare function assignGingerly(
298
298
  export default assignGingerly;
299
299
 
300
300
  export declare class ElementEnhancementGateway{
301
+ //TODO: this isn't right
301
302
  enh: ElementEnhancement;
302
303
  }
303
304
 
304
305
  export interface ElementEnhancement{
305
306
  dispose(regItem: EnhancementConfig): void;
306
307
  }
308
+
309
+ export interface ElementInfer{
310
+ value: any;
311
+ eventType: string
312
+ }
@@ -0,0 +1,60 @@
1
+ import { Specifier } from "../trans-render/dss/types";
2
+ import {AbsorbingObject, SharingObject} from '../trans-render/asmr/types';
3
+ import { StatementsResult } from "../nested-regex-groups/types";
4
+
5
+ export interface EndUserProps{
6
+ bindingRules?: StatementsResult<BindingRule>;
7
+ }
8
+
9
+ export interface AllProps extends EndUserProps{
10
+ enhancedElement: Element;
11
+ bindings: Array<Binding>,
12
+ isParsed?: boolean,
13
+ rawStatements?: Array<string>
14
+ }
15
+
16
+ export type SignalEnhancement = 'be-value-added' | 'be-propagating' | undefined;
17
+
18
+ export interface BindingRule {
19
+
20
+ localProp?: string,
21
+ localEvent?: string,
22
+ remoteSpecifierString?: string,
23
+ remoteSpecifier?: Specifier,
24
+
25
+
26
+ }
27
+
28
+ export interface Binding {
29
+ //new and improved
30
+ localAbsObj: AbsorbingObject;
31
+ localShareObj: SharingObject;
32
+ remoteAbsObj: AbsorbingObject;
33
+ remoteShareObj: SharingObject;
34
+ //remoteRef: WeakRef<Element>;
35
+ }
36
+
37
+ export type AP = AllProps;
38
+
39
+ export type PAP = Partial<AP>;
40
+
41
+ export type ProPAP = Promise<PAP>;
42
+
43
+
44
+ export interface Actions{
45
+ noAttrs(self: AP): ProPAP;
46
+ getBindings(self: AP): ProPAP;
47
+ hydrate(self: AP): ProPAP;
48
+ onRawStatements(self: AP): void;
49
+ }
50
+
51
+ export type WithStatement = string;
52
+
53
+ export type BetweenStatement = string;
54
+
55
+ export type TriggerSource = 'local' | 'remote' | 'tie';
56
+
57
+ export interface SpecificityResult {
58
+ val?: any,
59
+ winner?: TriggerSource;
60
+ }
@@ -1,3 +1,4 @@
1
+ import { ElementEnhancementGateway } from "../assign-gingerly/types";
1
2
  import { StatementsResult } from "../nested-regex-groups/types";
2
3
 
3
4
  export interface EndUserProps{
@@ -5,7 +6,7 @@ export interface EndUserProps{
5
6
  }
6
7
 
7
8
  export interface AllProps extends EndUserProps{
8
- enhancedElement: Element;
9
+ enhancedElement: Element & ElementEnhancementGateway;
9
10
  resolved: boolean;
10
11
  }
11
12
 
@@ -34,20 +35,20 @@ export type asOptions =
34
35
  export type SubPropPath = string;
35
36
  export type EventName = string;
36
37
 
37
- export interface Specifier {
38
- id?: string,
39
- prop?: string,
40
- path?: SubPropPath,
41
- evtName?: EventName,
42
- as?: asOptions,
43
- constVal?: any;
44
- enhKey?: string;
45
- ish?: boolean;
46
- host?: boolean;
47
- }
38
+ // export interface Specifier {
39
+ // id?: string,
40
+ // prop?: string,
41
+ // path?: SubPropPath,
42
+ // evtName?: EventName,
43
+ // as?: asOptions,
44
+ // constVal?: any;
45
+ // enhKey?: string;
46
+ // ish?: boolean;
47
+ // host?: boolean;
48
+ // }
48
49
 
49
50
  export interface IncParameters {
50
- prop: string,
51
+ prop?: string | null,
51
52
  byAmtS?: string,
52
53
  byAmtN?: number,
53
54
  targetElementId?: string,
@@ -1,3 +1,4 @@
1
+ import { ElementEnhancementGateway } from "../assign-gingerly/types";
1
2
  import { StatementsResult } from "../nested-regex-groups/types";
2
3
 
3
4
  export interface Specifier {
@@ -10,7 +11,7 @@ export interface EndUserProps{
10
11
  }
11
12
 
12
13
  export interface AllProps extends EndUserProps{
13
- enhancedElement: Element;
14
+ enhancedElement: Element & ElementEnhancementGateway;
14
15
  resolved: boolean;
15
16
  }
16
17
 
@@ -1,9 +1,10 @@
1
+ import { ElementEnhancementGateway, ElementInfer } from "../assign-gingerly/types";
1
2
  import { StatementsResult } from "../nested-regex-groups/types";
2
3
 
3
4
  export interface EndUserProps{}
4
5
 
5
6
  export interface AllProps extends EndUserProps{
6
- enhancedElement: Element;
7
+ enhancedElement: Element & ElementEnhancementGateway;
7
8
  parsedStatements: StatementsResult<TogglingParameters>;
8
9
  resolved?: boolean;
9
10
  }
@@ -21,6 +22,6 @@ export interface Actions{
21
22
  }
22
23
 
23
24
  export interface TogglingParameters {
24
- prop: string;
25
+ prop?: string | null;
25
26
  localEventType?: string;
26
27
  }