@pulse-js/tools 0.2.0 → 0.3.0

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/dist/index.d.cts CHANGED
@@ -1,41 +1,103 @@
1
+ /**
2
+ * Pulse Agent
3
+ *
4
+ * Responsible for observing the Pulse Registry and communicating with the UI.
5
+ * It serializes reactive state and handles remote actions.
6
+ */
7
+ declare class PulseAgent {
8
+ private static instance;
9
+ private listeners;
10
+ private registryUnsubscribe;
11
+ private unsubs;
12
+ private broadcastTimer;
13
+ private constructor();
14
+ static getInstance(): PulseAgent;
15
+ private setupRegistryObserver;
16
+ /**
17
+ * Synchronizes subscriptions with the registry.
18
+ */
19
+ private syncSubscriptions;
20
+ /**
21
+ * Debounced broadcast to avoid rapid-fire messages.
22
+ */
23
+ private broadcastStateDebounced;
24
+ /**
25
+ * Broadcasts the current state of all registered units.
26
+ */
27
+ broadcastState(): void;
28
+ /**
29
+ * Recursively strips non-cloneable values (functions) from an object.
30
+ */
31
+ private serialize;
32
+ /**
33
+ * Emits an event to any connected clients.
34
+ */
35
+ private emit;
36
+ /**
37
+ * Connect a local listener (useful for the same-page UI).
38
+ */
39
+ onEvent(listener: (event: any) => void): () => boolean;
40
+ /**
41
+ * Handles an action from the DevTools UI.
42
+ */
43
+ handleAction(action: {
44
+ type: string;
45
+ uid?: string;
46
+ payload?: any;
47
+ }): void;
48
+ dispose(): void;
49
+ }
50
+
51
+ /**
52
+ * Pulse Inspector Web Component (Client) 2.0
53
+ */
1
54
  declare class PulseInspector extends HTMLElement {
2
55
  private shadow;
3
56
  private units;
4
57
  private state;
5
58
  private isDragging;
6
59
  private offset;
7
- private editingUnit;
8
- private editValue;
9
- private unsubscribeRegistry?;
10
- private unitSubscriptions;
11
- private shortcut;
60
+ private totalDragDistance;
12
61
  constructor();
13
62
  connectedCallback(): void;
14
63
  disconnectedCallback(): void;
15
64
  private loadState;
16
65
  private saveState;
17
- private refreshUnits;
18
- private updateUnitSubscriptions;
19
- private setupListeners;
20
- private handleKeyDown;
66
+ private setupAgentConnection;
67
+ private setupGlobalListeners;
21
68
  private handleResize;
22
- private toggle;
23
- private totalDragDistance;
24
69
  private handleMouseDown;
25
70
  private handleClick;
26
- private handleEditSubmit;
27
- private handleEditKeydown;
71
+ private sendAction;
28
72
  private render;
29
- private renderInspector;
30
73
  private renderUnitCard;
31
- private renderTree;
32
- private renderTreeNode;
33
- private renderReason;
34
- private formatReasonText;
35
74
  private formatValue;
36
- private safeStringify;
37
75
  private getStatusColor;
38
76
  private getStyles;
39
77
  }
40
78
 
41
- export { PulseInspector };
79
+ interface Snapshot {
80
+ timestamp: number;
81
+ data: Record<string, any>;
82
+ }
83
+ /**
84
+ * Pulse TimeTravel
85
+ *
86
+ * Captures snapshots of the Pulse Registry and allows "rewinding" to previous states.
87
+ */
88
+ declare class TimeTravel {
89
+ private snapshots;
90
+ private maxSnapshots;
91
+ /**
92
+ * Captures a point-in-time snapshot of all registered sources.
93
+ */
94
+ capture(): void;
95
+ /**
96
+ * Reverts the registry state to a specific snapshot index.
97
+ */
98
+ travel(index: number): void;
99
+ getHistory(): Snapshot[];
100
+ clear(): void;
101
+ }
102
+
103
+ export { PulseAgent, PulseInspector, TimeTravel };
package/dist/index.d.ts CHANGED
@@ -1,41 +1,103 @@
1
+ /**
2
+ * Pulse Agent
3
+ *
4
+ * Responsible for observing the Pulse Registry and communicating with the UI.
5
+ * It serializes reactive state and handles remote actions.
6
+ */
7
+ declare class PulseAgent {
8
+ private static instance;
9
+ private listeners;
10
+ private registryUnsubscribe;
11
+ private unsubs;
12
+ private broadcastTimer;
13
+ private constructor();
14
+ static getInstance(): PulseAgent;
15
+ private setupRegistryObserver;
16
+ /**
17
+ * Synchronizes subscriptions with the registry.
18
+ */
19
+ private syncSubscriptions;
20
+ /**
21
+ * Debounced broadcast to avoid rapid-fire messages.
22
+ */
23
+ private broadcastStateDebounced;
24
+ /**
25
+ * Broadcasts the current state of all registered units.
26
+ */
27
+ broadcastState(): void;
28
+ /**
29
+ * Recursively strips non-cloneable values (functions) from an object.
30
+ */
31
+ private serialize;
32
+ /**
33
+ * Emits an event to any connected clients.
34
+ */
35
+ private emit;
36
+ /**
37
+ * Connect a local listener (useful for the same-page UI).
38
+ */
39
+ onEvent(listener: (event: any) => void): () => boolean;
40
+ /**
41
+ * Handles an action from the DevTools UI.
42
+ */
43
+ handleAction(action: {
44
+ type: string;
45
+ uid?: string;
46
+ payload?: any;
47
+ }): void;
48
+ dispose(): void;
49
+ }
50
+
51
+ /**
52
+ * Pulse Inspector Web Component (Client) 2.0
53
+ */
1
54
  declare class PulseInspector extends HTMLElement {
2
55
  private shadow;
3
56
  private units;
4
57
  private state;
5
58
  private isDragging;
6
59
  private offset;
7
- private editingUnit;
8
- private editValue;
9
- private unsubscribeRegistry?;
10
- private unitSubscriptions;
11
- private shortcut;
60
+ private totalDragDistance;
12
61
  constructor();
13
62
  connectedCallback(): void;
14
63
  disconnectedCallback(): void;
15
64
  private loadState;
16
65
  private saveState;
17
- private refreshUnits;
18
- private updateUnitSubscriptions;
19
- private setupListeners;
20
- private handleKeyDown;
66
+ private setupAgentConnection;
67
+ private setupGlobalListeners;
21
68
  private handleResize;
22
- private toggle;
23
- private totalDragDistance;
24
69
  private handleMouseDown;
25
70
  private handleClick;
26
- private handleEditSubmit;
27
- private handleEditKeydown;
71
+ private sendAction;
28
72
  private render;
29
- private renderInspector;
30
73
  private renderUnitCard;
31
- private renderTree;
32
- private renderTreeNode;
33
- private renderReason;
34
- private formatReasonText;
35
74
  private formatValue;
36
- private safeStringify;
37
75
  private getStatusColor;
38
76
  private getStyles;
39
77
  }
40
78
 
41
- export { PulseInspector };
79
+ interface Snapshot {
80
+ timestamp: number;
81
+ data: Record<string, any>;
82
+ }
83
+ /**
84
+ * Pulse TimeTravel
85
+ *
86
+ * Captures snapshots of the Pulse Registry and allows "rewinding" to previous states.
87
+ */
88
+ declare class TimeTravel {
89
+ private snapshots;
90
+ private maxSnapshots;
91
+ /**
92
+ * Captures a point-in-time snapshot of all registered sources.
93
+ */
94
+ capture(): void;
95
+ /**
96
+ * Reverts the registry state to a specific snapshot index.
97
+ */
98
+ travel(index: number): void;
99
+ getHistory(): Snapshot[];
100
+ clear(): void;
101
+ }
102
+
103
+ export { PulseAgent, PulseInspector, TimeTravel };