@buoy-gg/shared-ui 2.1.1 → 2.1.3

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.
Files changed (92) hide show
  1. package/lib/commonjs/clipboard/clipboard-impl.js +1 -1
  2. package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +20 -23
  3. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  4. package/lib/commonjs/index.js +98 -65
  5. package/lib/commonjs/license/DeviceLimitModal.js +479 -0
  6. package/lib/commonjs/license/FeatureGate.js +4 -9
  7. package/lib/commonjs/license/LicenseEntryModal.js +205 -770
  8. package/lib/commonjs/license/index.js +0 -7
  9. package/lib/commonjs/storage/devToolsStorageKeys.js +2 -0
  10. package/lib/commonjs/stores/BaseEventStore.js +257 -0
  11. package/lib/commonjs/stores/index.js +12 -0
  12. package/lib/commonjs/ui/components/PowerToggleButton.js +73 -0
  13. package/lib/commonjs/ui/components/index.js +7 -0
  14. package/lib/commonjs/utils/index.js +27 -1
  15. package/lib/commonjs/utils/subscribable.js +113 -0
  16. package/lib/commonjs/utils/subscriberCountNotifier.js +72 -0
  17. package/lib/module/JsModal.js +1 -1
  18. package/lib/module/clipboard/clipboard-impl.js +1 -1
  19. package/lib/module/dataViewer/VirtualizedDataExplorer.js +20 -23
  20. package/lib/module/hooks/safe-area-impl.js +1 -1
  21. package/lib/module/index.js +9 -2
  22. package/lib/module/license/DeviceLimitModal.js +473 -0
  23. package/lib/module/license/FeatureGate.js +4 -9
  24. package/lib/module/license/LicenseEntryModal.js +209 -773
  25. package/lib/module/license/index.js +0 -1
  26. package/lib/module/storage/devToolsStorageKeys.js +2 -0
  27. package/lib/module/stores/BaseEventStore.js +253 -0
  28. package/lib/module/stores/index.js +7 -0
  29. package/lib/module/ui/components/PowerToggleButton.js +69 -0
  30. package/lib/module/ui/components/index.js +1 -0
  31. package/lib/module/utils/index.js +3 -1
  32. package/lib/module/utils/subscribable.js +108 -0
  33. package/lib/module/utils/subscriberCountNotifier.js +66 -0
  34. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/clipboard/clipboard-impl.d.ts +1 -1
  36. package/lib/typescript/commonjs/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  38. package/lib/typescript/commonjs/index.d.ts +4 -3
  39. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/license/DeviceLimitModal.d.ts +23 -0
  41. package/lib/typescript/commonjs/license/DeviceLimitModal.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/license/FeatureGate.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/license/LicenseEntryModal.d.ts +10 -62
  44. package/lib/typescript/commonjs/license/LicenseEntryModal.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/license/index.d.ts +0 -2
  46. package/lib/typescript/commonjs/license/index.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +2 -0
  48. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/stores/BaseEventStore.d.ts +145 -0
  50. package/lib/typescript/commonjs/stores/BaseEventStore.d.ts.map +1 -0
  51. package/lib/typescript/commonjs/stores/index.d.ts +5 -0
  52. package/lib/typescript/commonjs/stores/index.d.ts.map +1 -0
  53. package/lib/typescript/commonjs/ui/components/PowerToggleButton.d.ts +32 -0
  54. package/lib/typescript/commonjs/ui/components/PowerToggleButton.d.ts.map +1 -0
  55. package/lib/typescript/commonjs/ui/components/index.d.ts +2 -0
  56. package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/utils/index.d.ts +2 -0
  58. package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/utils/subscribable.d.ts +78 -0
  60. package/lib/typescript/commonjs/utils/subscribable.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/utils/subscriberCountNotifier.d.ts +47 -0
  62. package/lib/typescript/commonjs/utils/subscriberCountNotifier.d.ts.map +1 -0
  63. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  64. package/lib/typescript/module/clipboard/clipboard-impl.d.ts +1 -1
  65. package/lib/typescript/module/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
  66. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  67. package/lib/typescript/module/index.d.ts +4 -3
  68. package/lib/typescript/module/index.d.ts.map +1 -1
  69. package/lib/typescript/module/license/DeviceLimitModal.d.ts +23 -0
  70. package/lib/typescript/module/license/DeviceLimitModal.d.ts.map +1 -0
  71. package/lib/typescript/module/license/FeatureGate.d.ts.map +1 -1
  72. package/lib/typescript/module/license/LicenseEntryModal.d.ts +10 -62
  73. package/lib/typescript/module/license/LicenseEntryModal.d.ts.map +1 -1
  74. package/lib/typescript/module/license/index.d.ts +0 -2
  75. package/lib/typescript/module/license/index.d.ts.map +1 -1
  76. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +2 -0
  77. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
  78. package/lib/typescript/module/stores/BaseEventStore.d.ts +145 -0
  79. package/lib/typescript/module/stores/BaseEventStore.d.ts.map +1 -0
  80. package/lib/typescript/module/stores/index.d.ts +5 -0
  81. package/lib/typescript/module/stores/index.d.ts.map +1 -0
  82. package/lib/typescript/module/ui/components/PowerToggleButton.d.ts +32 -0
  83. package/lib/typescript/module/ui/components/PowerToggleButton.d.ts.map +1 -0
  84. package/lib/typescript/module/ui/components/index.d.ts +2 -0
  85. package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
  86. package/lib/typescript/module/utils/index.d.ts +2 -0
  87. package/lib/typescript/module/utils/index.d.ts.map +1 -1
  88. package/lib/typescript/module/utils/subscribable.d.ts +78 -0
  89. package/lib/typescript/module/utils/subscribable.d.ts.map +1 -0
  90. package/lib/typescript/module/utils/subscriberCountNotifier.d.ts +47 -0
  91. package/lib/typescript/module/utils/subscriberCountNotifier.d.ts.map +1 -0
  92. package/package.json +3 -3
@@ -1,74 +1,22 @@
1
1
  /**
2
- * LicenseEntryModal - Modal for entering and activating a license key
2
+ * LicenseEntryModal - Modal showing how to activate a license
3
3
  *
4
- * Flow:
5
- * 1. Enter license key
6
- * 2. Validate key - check if device registration needed
7
- * 3a. If existing devices, show selection (claim or register new)
8
- * 3b. If no devices, prompt for device name
9
- * 4. Register device with user-provided name
10
- * 5. Success!
4
+ * Shows two options:
5
+ * 1. Get a license (link to pricing)
6
+ * 2. Already have one? Add Buoy.init() to your code
11
7
  */
12
8
  import React from "react";
13
- /**
14
- * Registered device interface
15
- */
16
- export interface RegisteredDevice {
17
- id: string;
18
- fingerprint: string;
19
- name: string;
20
- platform: string;
21
- model: string | null;
22
- osVersion: string | null;
23
- appVersion: string | null;
24
- registeredAt: Date;
25
- lastSeenAt: Date;
26
- isCurrentDevice: boolean;
27
- }
28
- /**
29
- * License validation result from the license package
30
- */
31
- export interface LicenseValidationResult {
32
- valid: boolean;
33
- needsDeviceRegistration: boolean;
34
- existingDevices: RegisteredDevice[];
35
- error?: string;
36
- maxDevices?: number;
37
- currentDeviceCount?: number;
38
- }
39
- /**
40
- * Result of device registration
41
- */
42
- export interface DeviceRegistrationResult {
43
- success: boolean;
44
- error?: string;
9
+ export interface LicenseEntryModalProps {
10
+ visible: boolean;
11
+ onClose: () => void;
12
+ onSuccess?: () => void;
13
+ purchaseUrl?: string;
45
14
  }
46
- /**
47
- * License state interface for prop injection
48
- */
49
15
  export interface LicenseState {
50
16
  setLicenseKey: (key: string) => Promise<boolean>;
51
- validateLicenseKey?: (key: string) => Promise<LicenseValidationResult>;
52
- registerDevice?: (deviceName: string) => Promise<DeviceRegistrationResult>;
53
- claimDevice?: (machineId: string, devices: RegisteredDevice[]) => Promise<boolean>;
54
17
  isPro: boolean;
55
18
  isValidating: boolean;
56
19
  error: string | null;
57
20
  }
58
- export interface LicenseEntryModalProps {
59
- visible: boolean;
60
- onClose: () => void;
61
- onSuccess?: () => void;
62
- purchaseUrl?: string;
63
- license?: LicenseState;
64
- /** Start directly at device registration (skip license key entry) */
65
- startAtDeviceRegistration?: boolean;
66
- /** Pre-populate with existing devices for selection */
67
- initialExistingDevices?: RegisteredDevice[];
68
- /** Initial max devices when starting at device registration */
69
- initialMaxDevices?: number;
70
- /** Initial current device count when starting at device registration */
71
- initialCurrentDeviceCount?: number;
72
- }
73
- export declare const LicenseEntryModal: ({ visible, onClose, onSuccess, purchaseUrl, license: injectedLicense, startAtDeviceRegistration, initialExistingDevices, initialMaxDevices, initialCurrentDeviceCount, }: LicenseEntryModalProps) => React.JSX.Element;
21
+ export declare const LicenseEntryModal: ({ visible, onClose, purchaseUrl, }: LicenseEntryModalProps) => React.JSX.Element;
74
22
  //# sourceMappingURL=LicenseEntryModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LicenseEntryModal.d.ts","sourceRoot":"","sources":["../../../../src/license/LicenseEntryModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AA0BjF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,IAAI,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,uBAAuB,EAAE,OAAO,CAAC;IACjC,eAAe,EAAE,gBAAgB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B,sBAAsB,sBAyexB,CAAC"}
1
+ {"version":3,"file":"LicenseEntryModal.d.ts","sourceRoot":"","sources":["../../../../src/license/LicenseEntryModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAsB,MAAM,OAAO,CAAC;AA2B3C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAQD,eAAO,MAAM,iBAAiB,GAAI,oCAI/B,sBAAsB,sBA0GxB,CAAC"}
@@ -3,8 +3,6 @@ export type { FeatureGateProps, ProFeatureBannerProps, UpgradeModalProps, ProUpg
3
3
  export { LicenseEntryModal } from "./LicenseEntryModal";
4
4
  export type { LicenseEntryModalProps, LicenseState } from "./LicenseEntryModal";
5
5
  import type { LicenseState as LicenseStateType } from "./LicenseEntryModal";
6
- export { ManageDevicesModal } from "./ManageDevicesModal";
7
- export type { ManageDevicesModalProps } from "./ManageDevicesModal";
8
6
  /**
9
7
  * Get the useIsPro hook from @buoy-gg/license
10
8
  * Falls back to () => false if license package is not available
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/license/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtI,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAuBpE;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,MAAM,OAAO,CAG3C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,CAAC,MAAM,gBAAgB,CAAC,GAAG,IAAI,CAG/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/license/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtI,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAuB5E;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,MAAM,OAAO,CAG3C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,CAAC,MAAM,gBAAgB,CAAC,GAAG,IAAI,CAG/D"}
@@ -160,6 +160,8 @@ export declare const devToolsStorageKeys: {
160
160
  readonly modal: () => "@react_buoy_events_modal";
161
161
  /** Selected badge/source filters */
162
162
  readonly enabledSources: () => "@react_buoy_events_enabled_sources";
163
+ /** Whether event capturing is active */
164
+ readonly isCapturing: () => "@react_buoy_events_is_capturing";
163
165
  /** Copy/export settings */
164
166
  readonly copySettings: () => "@react_buoy_events_copy_settings";
165
167
  };
@@ -1 +1 @@
1
- {"version":3,"file":"devToolsStorageKeys.d.ts","sourceRoot":"","sources":["../../../../src/storage/devToolsStorageKeys.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;OAEG;;IAGH;;OAEG;;;;;;;IASH;;OAEG;;;;;;;;IAUH;;OAEG;;;;;;QAQD,kDAAkD;;QAElD,gCAAgC;;QAGhC,gCAAgC;;;IAKlC;;OAEG;;;QAGD,mCAAmC;;;IAIrC;;OAEG;;;;;IAOH;;OAEG;;;;;;;IAQH;;OAEG;;;;;;;IASH;;OAEG;;;;;;;;;;;;;;IAuBH;;OAEG;;;;;;;;;;;IAiBH;;OAEG;;;;;;;;;;;IAgBH;;OAEG;;;;;;;;;;IAgBH;;OAEG;;;;;;;;IAYH;;OAEG;;;;;;;;;IAcH;;OAEG;;;;QAID,oCAAoC;;QAGpC,2BAA2B;;;CAIrB,CAAC;AAwBX;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAgBzD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE9D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,EAAE,CAsBpD"}
1
+ {"version":3,"file":"devToolsStorageKeys.d.ts","sourceRoot":"","sources":["../../../../src/storage/devToolsStorageKeys.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;OAEG;;IAGH;;OAEG;;;;;;;IASH;;OAEG;;;;;;;;IAUH;;OAEG;;;;;;QAQD,kDAAkD;;QAElD,gCAAgC;;QAGhC,gCAAgC;;;IAKlC;;OAEG;;;QAGD,mCAAmC;;;IAIrC;;OAEG;;;;;IAOH;;OAEG;;;;;;;IAQH;;OAEG;;;;;;;IASH;;OAEG;;;;;;;;;;;;;;IAuBH;;OAEG;;;;;;;;;;;IAiBH;;OAEG;;;;;;;;;;;IAgBH;;OAEG;;;;;;;;;;IAgBH;;OAEG;;;;;;;;IAYH;;OAEG;;;;;;;;;IAcH;;OAEG;;;;QAID,oCAAoC;;QAGpC,wCAAwC;;QAGxC,2BAA2B;;;CAIrB,CAAC;AAwBX;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAgBzD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE9D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,EAAE,CAsBpD"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * BaseEventStore - Abstract base class for event aggregation stores
3
+ *
4
+ * Handles dual subscription patterns (array listeners + individual event callbacks)
5
+ * and automatically manages start/stop lifecycle based on subscriber count.
6
+ *
7
+ * Follows TanStack Query's Subscribable pattern with extensions for:
8
+ * - Array subscriptions (get full event list on each update)
9
+ * - Individual event subscriptions (get each event as it occurs)
10
+ * - Auto-start capturing when first subscriber joins
11
+ * - Auto-stop capturing when last subscriber leaves
12
+ * - Subscriber count notifications for debugging UI
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * class StorageEventStore extends BaseEventStore<StorageEvent> {
17
+ * protected storeName = 'storage';
18
+ *
19
+ * protected startCapturing(): void {
20
+ * // Start listening to storage changes
21
+ * }
22
+ *
23
+ * protected stopCapturing(): void {
24
+ * // Stop listening to storage changes
25
+ * }
26
+ *
27
+ * isCapturing(): boolean {
28
+ * return this.unsubscribe !== null;
29
+ * }
30
+ * }
31
+ * ```
32
+ */
33
+ import { Subscribable } from "../utils/subscribable";
34
+ /**
35
+ * Callback type for receiving full events array
36
+ */
37
+ export type ArrayListener<TEvent> = (events: TEvent[]) => void;
38
+ /**
39
+ * Callback type for receiving individual events
40
+ */
41
+ export type EventCallback<TEvent> = (event: TEvent) => void;
42
+ /**
43
+ * Configuration options for BaseEventStore
44
+ */
45
+ export interface BaseEventStoreOptions {
46
+ /** Maximum number of events to keep in memory (default: 500) */
47
+ maxEvents?: number;
48
+ /** Store name for subscriber count notifications */
49
+ storeName: string;
50
+ }
51
+ /**
52
+ * Abstract base class for event stores.
53
+ *
54
+ * Subclasses must implement:
55
+ * - `startCapturing()` - Begin listening to the underlying event source
56
+ * - `stopCapturing()` - Stop listening to the underlying event source
57
+ * - `isCapturing()` - Check if currently capturing events
58
+ */
59
+ export declare abstract class BaseEventStore<TEvent> extends Subscribable<EventCallback<TEvent>> {
60
+ protected events: TEvent[];
61
+ protected arrayListeners: Set<ArrayListener<TEvent>>;
62
+ protected maxEvents: number;
63
+ protected storeName: string;
64
+ constructor(options: BaseEventStoreOptions);
65
+ /**
66
+ * Start capturing events from the underlying source.
67
+ * Called automatically when first subscriber joins.
68
+ */
69
+ protected abstract startCapturing(): void | Promise<void>;
70
+ /**
71
+ * Stop capturing events from the underlying source.
72
+ * Called automatically when last subscriber leaves.
73
+ */
74
+ protected abstract stopCapturing(): void;
75
+ /**
76
+ * Check if the store is actively capturing events.
77
+ */
78
+ abstract isCapturing(): boolean;
79
+ /**
80
+ * Called when first subscriber joins (via onEvent).
81
+ * Starts capturing if no one was subscribed.
82
+ */
83
+ protected onSubscribe(): void;
84
+ /**
85
+ * Called when a subscriber leaves (via onEvent unsubscribe).
86
+ * Stops capturing if no one is subscribed anymore.
87
+ */
88
+ protected onUnsubscribe(): void;
89
+ /**
90
+ * Get total count of all subscribers (both individual and array listeners)
91
+ */
92
+ protected getTotalSubscriberCount(): number;
93
+ /**
94
+ * Subscribe to the full events array.
95
+ * Automatically starts capturing when first subscriber joins.
96
+ *
97
+ * @param listener - Callback that receives the full events array on each update
98
+ * @returns Unsubscribe function
99
+ */
100
+ subscribeToEvents(listener: ArrayListener<TEvent>): () => void;
101
+ /**
102
+ * Subscribe to individual events as they occur.
103
+ * Automatically starts capturing when first subscriber joins.
104
+ *
105
+ * @param callback - Callback that receives each event as it occurs
106
+ * @returns Unsubscribe function
107
+ */
108
+ onEvent(callback: EventCallback<TEvent>): () => void;
109
+ /**
110
+ * Add an event to the store.
111
+ * Call this from subclasses when a new event is received.
112
+ *
113
+ * @param event - The event to add
114
+ */
115
+ protected addEvent(event: TEvent): void;
116
+ /**
117
+ * Notify all array listeners of changes
118
+ */
119
+ protected notifyArrayListeners(): void;
120
+ /**
121
+ * Get all events (newest first)
122
+ */
123
+ getEvents(): TEvent[];
124
+ /**
125
+ * Get event count
126
+ */
127
+ getEventCount(): number;
128
+ /**
129
+ * Clear all events
130
+ */
131
+ clearEvents(): void;
132
+ /**
133
+ * Set maximum number of events to keep
134
+ */
135
+ setMaxEvents(max: number): void;
136
+ /**
137
+ * Get current subscriber counts for debugging
138
+ */
139
+ getSubscriberCounts(): {
140
+ eventCallbacks: number;
141
+ arrayListeners: number;
142
+ total: number;
143
+ };
144
+ }
145
+ //# sourceMappingURL=BaseEventStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseEventStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/BaseEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;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MAAM,GAAG,IAAI;IAY/B;;OAEG;IACH,mBAAmB,IAAI;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf;CAOF"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared store utilities and base classes
3
+ */
4
+ export { BaseEventStore, type ArrayListener, type EventCallback, type BaseEventStoreOptions, } from "./BaseEventStore";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * PowerToggleButton Component
3
+ *
4
+ * A reusable power button for toggling capture/recording state across dev tools.
5
+ * Displays green when enabled, red when disabled.
6
+ */
7
+ export interface PowerToggleButtonProps {
8
+ /** Whether the feature is currently enabled/active */
9
+ isEnabled: boolean;
10
+ /** Called when button is pressed */
11
+ onToggle: () => void;
12
+ /** Button size variant */
13
+ size?: "small" | "medium";
14
+ /** Optional accessibility label */
15
+ accessibilityLabel?: string;
16
+ /** Whether the button is disabled */
17
+ disabled?: boolean;
18
+ }
19
+ /**
20
+ * Power toggle button used across dev tools for start/stop functionality.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <PowerToggleButton
25
+ * isEnabled={isRecording}
26
+ * onToggle={() => setIsRecording(!isRecording)}
27
+ * accessibilityLabel="Toggle network recording"
28
+ * />
29
+ * ```
30
+ */
31
+ export declare function PowerToggleButton({ isEnabled, onToggle, size, accessibilityLabel, disabled, }: PowerToggleButtonProps): import("react").JSX.Element;
32
+ //# sourceMappingURL=PowerToggleButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PowerToggleButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/PowerToggleButton.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,mCAAmC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,IAAe,EACf,kBAAkB,EAClB,QAAgB,GACjB,EAAE,sBAAsB,+BA4BxB"}
@@ -33,6 +33,8 @@ export { EventStepperFooter } from "./EventStepperFooter";
33
33
  export type { EventStepperFooterProps } from "./EventStepperFooter";
34
34
  export { ExpandablePopover } from "./ExpandablePopover";
35
35
  export type { ExpandablePopoverProps } from "./ExpandablePopover";
36
+ export { PowerToggleButton } from "./PowerToggleButton";
37
+ export type { PowerToggleButtonProps } from "./PowerToggleButton";
36
38
  export { EventHistoryViewer, ViewToggleCards, DiffModeTabs, CompareBar, EventPickerModal, } from "./EventHistoryViewer";
37
39
  export type { ViewMode, DiffModeTab, EventDisplayInfo, IconComponent, ViewToggleCardsProps, CompareBarProps, DiffModeTabsProps, EventPickerItem, EventPickerModalProps, EventHistoryViewerProps, } from "./EventHistoryViewer";
38
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,C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BAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
@@ -5,4 +5,6 @@ export { safeStringify } from "./safeStringify";
5
5
  export { getValueType, isPrimitive, isJsonSerializable, isValidJson, getConstructorName, isEmpty, getValueSize, } from "./typeHelpers";
6
6
  export { parseValue, formatValue, getTypeColor, truncateText, flattenObject, formatPath, } from "./valueFormatting";
7
7
  export { loadOptionalModule, getCachedOptionalModule } from "./loadOptionalModule";
8
+ export { Subscribable, type SubscribableListener } from "./subscribable";
9
+ export { subscriberCountNotifier, subscribeToSubscriberCountChanges, notifySubscriberCountChange, } from "./subscriberCountNotifier";
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Subscribable - Base class for pub/sub pattern with lifecycle hooks
3
+ *
4
+ * Ported from TanStack Query's subscription architecture.
5
+ * Provides a foundation for self-managing listeners that automatically
6
+ * start when the first subscriber joins and stop when the last leaves.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * class NetworkEventStore extends Subscribable<NetworkEventListener> {
11
+ * protected onSubscribe(): void {
12
+ * if (this.listeners.size === 1) {
13
+ * // First subscriber - start listening
14
+ * this.startNetworkListener();
15
+ * }
16
+ * }
17
+ *
18
+ * protected onUnsubscribe(): void {
19
+ * if (this.listeners.size === 0) {
20
+ * // Last subscriber left - stop listening
21
+ * this.stopNetworkListener();
22
+ * }
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ export type SubscribableListener = (...args: any[]) => void;
28
+ export declare class Subscribable<TListener extends SubscribableListener = SubscribableListener> {
29
+ protected listeners: Set<TListener>;
30
+ constructor();
31
+ /**
32
+ * Subscribe to updates.
33
+ * @param listener - Callback function to receive updates
34
+ * @returns Unsubscribe function
35
+ */
36
+ subscribe(listener: TListener): () => void;
37
+ /**
38
+ * Check if there are any active listeners.
39
+ */
40
+ hasListeners(): boolean;
41
+ /**
42
+ * Get the current number of listeners.
43
+ */
44
+ getListenerCount(): number;
45
+ /**
46
+ * Notify all listeners with given arguments.
47
+ */
48
+ protected notify(...args: Parameters<TListener>): void;
49
+ /**
50
+ * Called when a listener is added.
51
+ * Override to start resources when first subscriber joins.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * protected onSubscribe(): void {
56
+ * if (this.listeners.size === 1) {
57
+ * this.startCapturing();
58
+ * }
59
+ * }
60
+ * ```
61
+ */
62
+ protected onSubscribe(): void;
63
+ /**
64
+ * Called when a listener is removed.
65
+ * Override to stop resources when last subscriber leaves.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * protected onUnsubscribe(): void {
70
+ * if (this.listeners.size === 0) {
71
+ * this.stopCapturing();
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ protected onUnsubscribe(): void;
77
+ }
78
+ //# sourceMappingURL=subscribable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribable.d.ts","sourceRoot":"","sources":["../../../../src/utils/subscribable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAE5D,qBAAa,YAAY,CAAC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IACrF,SAAS,CAAC,SAAS,iBAAwB;;IAM3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,SAAS,GAAG,MAAM,IAAI;IAW1C;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI;IAMtD;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAI7B;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;CAGhC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Subscriber Count Notifier
3
+ *
4
+ * Global notification system for subscriber count changes across all event stores.
5
+ * Follows TanStack Query's pattern where stores notify when observers are added/removed,
6
+ * allowing UI to update instantly instead of polling.
7
+ *
8
+ * This is in shared-ui to avoid circular dependencies between packages.
9
+ *
10
+ * Usage in event stores:
11
+ * ```typescript
12
+ * import { notifySubscriberCountChange } from '@buoy-gg/shared-ui';
13
+ *
14
+ * protected onSubscribe(): void {
15
+ * // ... existing logic
16
+ * notifySubscriberCountChange('storage');
17
+ * }
18
+ * ```
19
+ *
20
+ * Usage in UI:
21
+ * ```typescript
22
+ * useEffect(() => {
23
+ * return subscribeToSubscriberCountChanges(() => {
24
+ * // Refresh subscriber counts
25
+ * });
26
+ * }, []);
27
+ * ```
28
+ */
29
+ type SubscriberCountListener = (sourceId: string) => void;
30
+ declare class SubscriberCountNotifier {
31
+ private listeners;
32
+ /**
33
+ * Subscribe to subscriber count changes.
34
+ * Called whenever any event store's subscriber count changes.
35
+ */
36
+ subscribe(listener: SubscriberCountListener): () => void;
37
+ /**
38
+ * Notify all listeners that a store's subscriber count changed.
39
+ * Called by event stores in their onSubscribe/onUnsubscribe hooks.
40
+ */
41
+ notify(sourceId: string): void;
42
+ }
43
+ export declare const subscriberCountNotifier: SubscriberCountNotifier;
44
+ export declare const subscribeToSubscriberCountChanges: (listener: SubscriberCountListener) => () => void;
45
+ export declare const notifySubscriberCountChange: (sourceId: string) => void;
46
+ export {};
47
+ //# sourceMappingURL=subscriberCountNotifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriberCountNotifier.d.ts","sourceRoot":"","sources":["../../../../src/utils/subscriberCountNotifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,KAAK,uBAAuB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1D,cAAM,uBAAuB;IAC3B,OAAO,CAAC,SAAS,CAAsC;IAEvD;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAOxD;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAS/B;AAGD,eAAO,MAAM,uBAAuB,yBAAgC,CAAC;AAGrE,eAAO,MAAM,iCAAiC,GAAI,UAAU,uBAAuB,WA1B7B,IA2BT,CAAC;AAE9C,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,SAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/shared-ui",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Shared UI components, hooks, and utilities",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -115,7 +115,7 @@
115
115
  ],
116
116
  "sideEffects": false,
117
117
  "dependencies": {
118
- "@buoy-gg/floating-tools-core": "2.1.1"
118
+ "@buoy-gg/floating-tools-core": "2.1.3"
119
119
  },
120
120
  "peerDependencies": {
121
121
  "@buoy-gg/license": "*",
@@ -149,7 +149,7 @@
149
149
  "expo-clipboard": "~7.1.5",
150
150
  "react-native-safe-area-context": "^5.6.2",
151
151
  "typescript": "~5.8.3",
152
- "@buoy-gg/license": "2.1.1"
152
+ "@buoy-gg/license": "2.1.3"
153
153
  },
154
154
  "react-native-builder-bob": {
155
155
  "source": "src",