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