mount-observer 0.1.31 → 0.1.32

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,6 +1,7 @@
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';
4
5
  import 'mount-observer/handlers/MountObserverScript.js';
5
6
  import { mos } from 'mount-observer/handlers/MountObserverScript.js';
6
7
  import 'mount-observer/handlers/ScriptExport.js';
@@ -62,6 +63,11 @@ export class Synthesizer extends HTMLElement {
62
63
  connectedCallback() {
63
64
  // Synthesizer elements are infrastructure, not UI
64
65
  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
+ }
65
71
  // Identify the root node
66
72
  const rootNode = this.getRootNode();
67
73
  // Determine if this is a syndicator or subscriber
package/Synthesizer.ts CHANGED
@@ -1,6 +1,7 @@
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';
4
5
 
5
6
  import 'mount-observer/handlers/MountObserverScript.js';
6
7
  import {mos} from 'mount-observer/handlers/MountObserverScript.js';
@@ -68,6 +69,12 @@ export abstract class Synthesizer extends HTMLElement {
68
69
  // Synthesizer elements are infrastructure, not UI
69
70
  this.hidden = true;
70
71
 
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
+
71
78
  // Identify the root node
72
79
  const rootNode = this.getRootNode();
73
80
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
7
7
  "dependencies": {
8
- "assign-gingerly": "0.0.28",
8
+ "assign-gingerly": "0.0.30",
9
9
  "id-generation": "0.0.4"
10
10
  },
11
11
  "devDependencies": {
@@ -0,0 +1,55 @@
1
+ import { StatementsResult } from "../nested-regex-groups/types";
2
+
3
+ export interface EndUserProps{
4
+ parsedStatements: StatementsResult<IncParameters>,
5
+ }
6
+
7
+ export interface AllProps extends EndUserProps{
8
+ enhancedElement: Element;
9
+ resolved: boolean;
10
+ }
11
+
12
+ export type AP = AllProps;
13
+
14
+ export type PAP = Partial<AP>;
15
+
16
+ export type ProPAP = Promise<PAP>
17
+
18
+ export interface Actions{
19
+ hydrate(self: AP & Actions): ProPAP;
20
+ handleEvent(self: AP, event: Event, incParameters: IncParameters): void;
21
+ init(self: AP, enhancedElement: Element, initVals: PAP): Promise<void>
22
+ }
23
+
24
+ export type asOptions =
25
+ | 'number'
26
+ | 'boolean'
27
+ | 'string'
28
+ | 'object'
29
+ | 'regexp'
30
+ | 'urlpattern'
31
+ | 'boolean|number'
32
+ ;
33
+
34
+ export type SubPropPath = string;
35
+ export type EventName = string;
36
+
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
+ }
48
+
49
+ export interface IncParameters {
50
+ prop: string,
51
+ byAmtS?: string,
52
+ byAmtN?: number,
53
+ targetElementId?: string,
54
+ localEventType?: string,
55
+ }
@@ -1,15 +1,17 @@
1
+ import { StatementsResult } from "../nested-regex-groups/types";
2
+
1
3
  export interface Specifier {
2
4
  selector?: string;
3
5
  prop?: string;
4
6
  }
5
7
 
6
8
  export interface EndUserProps{
7
- invokeParamSets: Array<InvokingParameters>,
9
+ invokeParamSet: StatementsResult<InvokingParameters>,
8
10
  }
9
11
 
10
12
  export interface AllProps extends EndUserProps{
11
13
  enhancedElement: Element;
12
- rawStatements: Array<string>,
14
+ resolved: boolean;
13
15
  }
14
16
 
15
17
  export type AP = AllProps;
@@ -20,9 +22,16 @@ export type ProPAP = Promise<PAP>
20
22
 
21
23
  export interface Actions{
22
24
  hydrate(self: AP): ProPAP;
25
+ init(self: AP, enhancedElement: Element, initVals: PAP): Promise<void>
23
26
  }
24
27
 
28
+
29
+
25
30
  export interface InvokingParameters {
26
- remoteSpecifier: Specifier,
27
- localEventType?: string,
31
+ targetSpecifier: {
32
+ hostOrPeerMethodName: string,
33
+ targetElementId?: string,
34
+ },
35
+ //defaults to "click" if not specified
36
+ localEventType: string,
28
37
  }
@@ -0,0 +1,26 @@
1
+ import { StatementsResult } from "../nested-regex-groups/types";
2
+
3
+ export interface EndUserProps{}
4
+
5
+ export interface AllProps extends EndUserProps{
6
+ enhancedElement: Element;
7
+ parsedStatements: StatementsResult<TogglingParameters>;
8
+ resolved?: boolean;
9
+ }
10
+
11
+ export type AP = AllProps;
12
+
13
+ export type PAP = Partial<AP>;
14
+
15
+ export type ProPAP = Promise<PAP>
16
+
17
+ export interface Actions{
18
+ init(self: AllProps, enhancedElement: Element, initVals: PAP): void;
19
+ hydrate(self: AP): ProPAP;
20
+ handleEvent(self: AP, e: Event, parsedStatement: TogglingParameters): void;
21
+ }
22
+
23
+ export interface TogglingParameters {
24
+ prop: string;
25
+ localEventType?: string;
26
+ }
@@ -54,6 +54,12 @@ export interface PatternConfig {
54
54
  name: string;
55
55
  pattern: string;
56
56
  description?: string;
57
+ /**
58
+ * Default values to merge into the parsed result
59
+ * Keys can use dot notation for nested values
60
+ * Example: { trigger: 'on', 'lhs.id': '#lhs' }
61
+ */
62
+ defaultVals?: Record<string, string>;
57
63
  }
58
64
 
59
65
  /**