@buoy-gg/floating-tools-core 2.1.11 → 2.1.13

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 (108) hide show
  1. package/LICENSE +58 -0
  2. package/lib/commonjs/FloatingToolsStore.js +1 -501
  3. package/lib/commonjs/colors.js +1 -54
  4. package/lib/commonjs/constants.js +1 -31
  5. package/lib/commonjs/devToolsState.js +1 -325
  6. package/lib/commonjs/dial.js +1 -617
  7. package/lib/commonjs/easing.js +1 -69
  8. package/lib/commonjs/icons/benchmark-icon.js +1 -24
  9. package/lib/commonjs/icons/env-icon.js +1 -24
  10. package/lib/commonjs/icons/events-icon.js +1 -24
  11. package/lib/commonjs/icons/highlight-icon.js +1 -24
  12. package/lib/commonjs/icons/icon-data.js +1 -2268
  13. package/lib/commonjs/icons/icon-factories.js +1 -173
  14. package/lib/commonjs/icons/icon-primitives.js +1 -559
  15. package/lib/commonjs/icons/icon-primitives.native.js +1 -779
  16. package/lib/commonjs/icons/icon-renderer.js +1 -260
  17. package/lib/commonjs/icons/network-icon.js +1 -24
  18. package/lib/commonjs/icons/query-icon.js +1 -24
  19. package/lib/commonjs/icons/redux-icon.js +1 -85
  20. package/lib/commonjs/icons/renders-icon.js +1 -33
  21. package/lib/commonjs/icons/routes-icon.js +1 -49
  22. package/lib/commonjs/icons/sentry-icon.js +1 -24
  23. package/lib/commonjs/icons/storage-icon.js +1 -24
  24. package/lib/commonjs/icons/wifi-icon.js +1 -24
  25. package/lib/commonjs/index.js +1 -723
  26. package/lib/commonjs/settings.js +1 -599
  27. package/lib/commonjs/utils.js +1 -72
  28. package/lib/module/FloatingToolsStore.js +1 -496
  29. package/lib/module/colors.js +1 -49
  30. package/lib/module/constants.js +1 -27
  31. package/lib/module/devToolsState.js +1 -318
  32. package/lib/module/dial.js +1 -603
  33. package/lib/module/easing.js +1 -62
  34. package/lib/module/icons/benchmark-icon.js +1 -15
  35. package/lib/module/icons/env-icon.js +1 -15
  36. package/lib/module/icons/events-icon.js +1 -15
  37. package/lib/module/icons/highlight-icon.js +1 -15
  38. package/lib/module/icons/icon-data.js +1 -2264
  39. package/lib/module/icons/icon-factories.js +1 -163
  40. package/lib/module/icons/icon-primitives.js +1 -547
  41. package/lib/module/icons/icon-primitives.native.js +1 -767
  42. package/lib/module/icons/icon-renderer.js +1 -255
  43. package/lib/module/icons/network-icon.js +1 -15
  44. package/lib/module/icons/query-icon.js +1 -15
  45. package/lib/module/icons/redux-icon.js +1 -81
  46. package/lib/module/icons/renders-icon.js +1 -17
  47. package/lib/module/icons/routes-icon.js +1 -41
  48. package/lib/module/icons/sentry-icon.js +1 -15
  49. package/lib/module/icons/storage-icon.js +1 -15
  50. package/lib/module/icons/wifi-icon.js +1 -15
  51. package/lib/module/index.js +1 -103
  52. package/lib/module/settings.js +1 -587
  53. package/lib/module/utils.js +1 -66
  54. package/package.json +8 -8
  55. package/lib/typescript/commonjs/FloatingToolsStore.d.ts.map +0 -1
  56. package/lib/typescript/commonjs/colors.d.ts.map +0 -1
  57. package/lib/typescript/commonjs/constants.d.ts.map +0 -1
  58. package/lib/typescript/commonjs/devToolsState.d.ts.map +0 -1
  59. package/lib/typescript/commonjs/dial.d.ts.map +0 -1
  60. package/lib/typescript/commonjs/easing.d.ts.map +0 -1
  61. package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +0 -1
  62. package/lib/typescript/commonjs/icons/env-icon.d.ts.map +0 -1
  63. package/lib/typescript/commonjs/icons/events-icon.d.ts.map +0 -1
  64. package/lib/typescript/commonjs/icons/highlight-icon.d.ts.map +0 -1
  65. package/lib/typescript/commonjs/icons/icon-data.d.ts.map +0 -1
  66. package/lib/typescript/commonjs/icons/icon-factories.d.ts.map +0 -1
  67. package/lib/typescript/commonjs/icons/icon-primitives.d.ts.map +0 -1
  68. package/lib/typescript/commonjs/icons/icon-primitives.native.d.ts.map +0 -1
  69. package/lib/typescript/commonjs/icons/icon-renderer.d.ts.map +0 -1
  70. package/lib/typescript/commonjs/icons/network-icon.d.ts.map +0 -1
  71. package/lib/typescript/commonjs/icons/query-icon.d.ts.map +0 -1
  72. package/lib/typescript/commonjs/icons/redux-icon.d.ts.map +0 -1
  73. package/lib/typescript/commonjs/icons/renders-icon.d.ts.map +0 -1
  74. package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +0 -1
  75. package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +0 -1
  76. package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +0 -1
  77. package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +0 -1
  78. package/lib/typescript/commonjs/index.d.ts.map +0 -1
  79. package/lib/typescript/commonjs/settings.d.ts.map +0 -1
  80. package/lib/typescript/commonjs/types.d.ts.map +0 -1
  81. package/lib/typescript/commonjs/utils.d.ts.map +0 -1
  82. package/lib/typescript/module/FloatingToolsStore.d.ts.map +0 -1
  83. package/lib/typescript/module/colors.d.ts.map +0 -1
  84. package/lib/typescript/module/constants.d.ts.map +0 -1
  85. package/lib/typescript/module/devToolsState.d.ts.map +0 -1
  86. package/lib/typescript/module/dial.d.ts.map +0 -1
  87. package/lib/typescript/module/easing.d.ts.map +0 -1
  88. package/lib/typescript/module/icons/benchmark-icon.d.ts.map +0 -1
  89. package/lib/typescript/module/icons/env-icon.d.ts.map +0 -1
  90. package/lib/typescript/module/icons/events-icon.d.ts.map +0 -1
  91. package/lib/typescript/module/icons/highlight-icon.d.ts.map +0 -1
  92. package/lib/typescript/module/icons/icon-data.d.ts.map +0 -1
  93. package/lib/typescript/module/icons/icon-factories.d.ts.map +0 -1
  94. package/lib/typescript/module/icons/icon-primitives.d.ts.map +0 -1
  95. package/lib/typescript/module/icons/icon-primitives.native.d.ts.map +0 -1
  96. package/lib/typescript/module/icons/icon-renderer.d.ts.map +0 -1
  97. package/lib/typescript/module/icons/network-icon.d.ts.map +0 -1
  98. package/lib/typescript/module/icons/query-icon.d.ts.map +0 -1
  99. package/lib/typescript/module/icons/redux-icon.d.ts.map +0 -1
  100. package/lib/typescript/module/icons/renders-icon.d.ts.map +0 -1
  101. package/lib/typescript/module/icons/routes-icon.d.ts.map +0 -1
  102. package/lib/typescript/module/icons/sentry-icon.d.ts.map +0 -1
  103. package/lib/typescript/module/icons/storage-icon.d.ts.map +0 -1
  104. package/lib/typescript/module/icons/wifi-icon.d.ts.map +0 -1
  105. package/lib/typescript/module/index.d.ts.map +0 -1
  106. package/lib/typescript/module/settings.d.ts.map +0 -1
  107. package/lib/typescript/module/types.d.ts.map +0 -1
  108. package/lib/typescript/module/utils.d.ts.map +0 -1
@@ -1,318 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * DevToolsState - Pure state management for floating dev tools.
5
- *
6
- * Platform-agnostic state machine for managing:
7
- * - Dial menu open/closed state
8
- * - Settings modal open/closed state
9
- * - Active settings tab
10
- *
11
- * This is a headless state manager with no React or platform dependencies.
12
- * Use with useSyncExternalStore or similar subscription patterns.
13
- */
14
-
15
- // =============================
16
- // State Types
17
- // =============================
18
-
19
- /**
20
- * Complete state of the floating dev tools system.
21
- */
22
-
23
- /**
24
- * Actions that can be dispatched to modify state.
25
- */
26
-
27
- // =============================
28
- // Initial State
29
- // =============================
30
-
31
- const initialState = {
32
- isDialOpen: false,
33
- isSettingsOpen: false,
34
- activeSettingsTab: 'dial',
35
- isInitialized: false
36
- };
37
-
38
- // =============================
39
- // Reducer
40
- // =============================
41
-
42
- /**
43
- * Pure reducer function for DevTools state.
44
- * Can be used standalone or with any state management library.
45
- */
46
- export function devToolsReducer(state, action) {
47
- switch (action.type) {
48
- case 'OPEN_DIAL':
49
- return {
50
- ...state,
51
- isDialOpen: true
52
- };
53
- case 'CLOSE_DIAL':
54
- return {
55
- ...state,
56
- isDialOpen: false
57
- };
58
- case 'TOGGLE_DIAL':
59
- return {
60
- ...state,
61
- isDialOpen: !state.isDialOpen
62
- };
63
- case 'OPEN_SETTINGS':
64
- // Close dial when opening settings
65
- return {
66
- ...state,
67
- isSettingsOpen: true,
68
- isDialOpen: false
69
- };
70
- case 'CLOSE_SETTINGS':
71
- return {
72
- ...state,
73
- isSettingsOpen: false
74
- };
75
- case 'SET_SETTINGS_TAB':
76
- return {
77
- ...state,
78
- activeSettingsTab: action.tab
79
- };
80
- case 'INITIALIZE':
81
- return {
82
- ...state,
83
- isInitialized: true
84
- };
85
- default:
86
- return state;
87
- }
88
- }
89
-
90
- // =============================
91
- // State Manager Class
92
- // =============================
93
-
94
- /**
95
- * DevToolsStateManager - Subscribable state container.
96
- *
97
- * Follows the external store pattern for compatibility with
98
- * React's useSyncExternalStore and similar patterns.
99
- *
100
- * @example
101
- * ```ts
102
- * const manager = new DevToolsStateManager();
103
- *
104
- * // Subscribe to changes
105
- * const unsubscribe = manager.subscribe(() => {
106
- * console.log('State changed:', manager.getState());
107
- * });
108
- *
109
- * // Dispatch actions
110
- * manager.openDial();
111
- * manager.openSettings();
112
- *
113
- * // Clean up
114
- * unsubscribe();
115
- * ```
116
- */
117
- export class DevToolsStateManager {
118
- listeners = new Set();
119
- constructor(initialStateOverride) {
120
- this.state = {
121
- ...initialState,
122
- ...initialStateOverride
123
- };
124
- }
125
-
126
- // =============================
127
- // Query Methods
128
- // =============================
129
-
130
- /**
131
- * Get the current state snapshot.
132
- * Safe to call at any time.
133
- */
134
- getState = () => {
135
- return this.state;
136
- };
137
-
138
- /**
139
- * Get server snapshot for SSR.
140
- * Returns initial state for hydration consistency.
141
- */
142
- getServerState = () => {
143
- return initialState;
144
- };
145
-
146
- /**
147
- * Check if dial menu is open.
148
- */
149
- isDialOpen() {
150
- return this.state.isDialOpen;
151
- }
152
-
153
- /**
154
- * Check if settings modal is open.
155
- */
156
- isSettingsOpen() {
157
- return this.state.isSettingsOpen;
158
- }
159
-
160
- /**
161
- * Check if state has been initialized.
162
- */
163
- isInitialized() {
164
- return this.state.isInitialized;
165
- }
166
-
167
- /**
168
- * Get active settings tab.
169
- */
170
- getActiveSettingsTab() {
171
- return this.state.activeSettingsTab;
172
- }
173
-
174
- // =============================
175
- // Command Methods
176
- // =============================
177
-
178
- /**
179
- * Dispatch an action to update state.
180
- */
181
- dispatch(action) {
182
- const newState = devToolsReducer(this.state, action);
183
-
184
- // Only notify if state actually changed
185
- if (newState !== this.state) {
186
- this.state = newState;
187
- this.notifyListeners();
188
- }
189
- }
190
-
191
- /**
192
- * Open the dial menu.
193
- */
194
- openDial() {
195
- this.dispatch({
196
- type: 'OPEN_DIAL'
197
- });
198
- }
199
-
200
- /**
201
- * Close the dial menu.
202
- */
203
- closeDial() {
204
- this.dispatch({
205
- type: 'CLOSE_DIAL'
206
- });
207
- }
208
-
209
- /**
210
- * Toggle the dial menu open/closed.
211
- */
212
- toggleDial() {
213
- this.dispatch({
214
- type: 'TOGGLE_DIAL'
215
- });
216
- }
217
-
218
- /**
219
- * Open the settings modal.
220
- * Also closes the dial menu if open.
221
- */
222
- openSettings() {
223
- this.dispatch({
224
- type: 'OPEN_SETTINGS'
225
- });
226
- }
227
-
228
- /**
229
- * Close the settings modal.
230
- */
231
- closeSettings() {
232
- this.dispatch({
233
- type: 'CLOSE_SETTINGS'
234
- });
235
- }
236
-
237
- /**
238
- * Set the active settings tab.
239
- */
240
- setSettingsTab(tab) {
241
- this.dispatch({
242
- type: 'SET_SETTINGS_TAB',
243
- tab
244
- });
245
- }
246
-
247
- /**
248
- * Mark state as initialized.
249
- * Call after loading persisted state.
250
- */
251
- initialize() {
252
- this.dispatch({
253
- type: 'INITIALIZE'
254
- });
255
- }
256
-
257
- // =============================
258
- // Subscription
259
- // =============================
260
-
261
- /**
262
- * Subscribe to state changes.
263
- * Returns an unsubscribe function.
264
- *
265
- * Compatible with React's useSyncExternalStore.
266
- */
267
- subscribe = listener => {
268
- this.listeners.add(listener);
269
- return () => {
270
- this.listeners.delete(listener);
271
- };
272
- };
273
-
274
- /**
275
- * Notify all listeners of state change.
276
- */
277
- notifyListeners() {
278
- this.listeners.forEach(listener => {
279
- try {
280
- listener();
281
- } catch (error) {
282
- console.error('Error in DevToolsStateManager listener:', error);
283
- }
284
- });
285
- }
286
-
287
- /**
288
- * Get the number of active listeners.
289
- * Useful for debugging.
290
- */
291
- get listenerCount() {
292
- return this.listeners.size;
293
- }
294
-
295
- /**
296
- * Reset state to initial values.
297
- * Useful for testing.
298
- */
299
- reset() {
300
- this.state = {
301
- ...initialState
302
- };
303
- this.notifyListeners();
304
- }
305
- }
306
-
307
- // =============================
308
- // Default Instance
309
- // =============================
310
-
311
- /**
312
- * Default global DevToolsStateManager instance.
313
- * Use this for app-wide state management.
314
- *
315
- * For isolated testing or multiple instances,
316
- * create a new DevToolsStateManager instead.
317
- */
318
- export const devToolsStateManager = new DevToolsStateManager();
1
+ "use strict";const initialState={isDialOpen:!1,isSettingsOpen:!1,activeSettingsTab:"dial",isInitialized:!1};export function devToolsReducer(t,e){switch(e.type){case"OPEN_DIAL":return{...t,isDialOpen:!0};case"CLOSE_DIAL":return{...t,isDialOpen:!1};case"TOGGLE_DIAL":return{...t,isDialOpen:!t.isDialOpen};case"OPEN_SETTINGS":return{...t,isSettingsOpen:!0,isDialOpen:!1};case"CLOSE_SETTINGS":return{...t,isSettingsOpen:!1};case"SET_SETTINGS_TAB":return{...t,activeSettingsTab:e.tab};case"INITIALIZE":return{...t,isInitialized:!0};default:return t}}export class DevToolsStateManager{listeners=new Set;constructor(t){this.state={...initialState,...t}}getState=()=>this.state;getServerState=()=>initialState;isDialOpen(){return this.state.isDialOpen}isSettingsOpen(){return this.state.isSettingsOpen}isInitialized(){return this.state.isInitialized}getActiveSettingsTab(){return this.state.activeSettingsTab}dispatch(t){const e=devToolsReducer(this.state,t);e!==this.state&&(this.state=e,this.notifyListeners())}openDial(){this.dispatch({type:"OPEN_DIAL"})}closeDial(){this.dispatch({type:"CLOSE_DIAL"})}toggleDial(){this.dispatch({type:"TOGGLE_DIAL"})}openSettings(){this.dispatch({type:"OPEN_SETTINGS"})}closeSettings(){this.dispatch({type:"CLOSE_SETTINGS"})}setSettingsTab(t){this.dispatch({type:"SET_SETTINGS_TAB",tab:t})}initialize(){this.dispatch({type:"INITIALIZE"})}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});notifyListeners(){this.listeners.forEach(t=>{try{t()}catch(t){console.error("Error in DevToolsStateManager listener:",t)}})}get listenerCount(){return this.listeners.size}reset(){this.state={...initialState},this.notifyListeners()}}export const devToolsStateManager=new DevToolsStateManager;