@buoy-gg/floating-tools-core 7.0.36 → 7.0.38
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/README.md +36 -0
- package/floating.d.ts +1 -0
- package/floating.js +1 -0
- 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 -633
- package/lib/commonjs/dialUsage.js +1 -130
- package/lib/commonjs/easing.js +1 -69
- package/lib/commonjs/floating.js +1 -0
- package/lib/commonjs/fonts.js +1 -31
- package/lib/commonjs/fonts.web.js +1 -0
- package/lib/commonjs/icons/ICONS.md +7 -0
- package/lib/commonjs/icons/ask-buoy-icon.js +1 -27
- package/lib/commonjs/icons/ask-buoy-icon.native.js +1 -0
- package/lib/commonjs/icons/assets/askBuoy.png +0 -0
- package/lib/commonjs/icons/assets/askBuoy@2x.png +0 -0
- package/lib/commonjs/icons/assets/askBuoy@3x.png +0 -0
- package/lib/commonjs/icons/assets/assets.png +0 -0
- package/lib/commonjs/icons/assets/assets@2x.png +0 -0
- package/lib/commonjs/icons/assets/assets@3x.png +0 -0
- package/lib/commonjs/icons/assets/benchmark.png +0 -0
- package/lib/commonjs/icons/assets/benchmark@2x.png +0 -0
- package/lib/commonjs/icons/assets/benchmark@3x.png +0 -0
- package/lib/commonjs/icons/assets/camera.png +0 -0
- package/lib/commonjs/icons/assets/camera@2x.png +0 -0
- package/lib/commonjs/icons/assets/camera@3x.png +0 -0
- package/lib/commonjs/icons/assets/console.png +0 -0
- package/lib/commonjs/icons/assets/console@2x.png +0 -0
- package/lib/commonjs/icons/assets/console@3x.png +0 -0
- package/lib/commonjs/icons/assets/env.png +0 -0
- package/lib/commonjs/icons/assets/env@2x.png +0 -0
- package/lib/commonjs/icons/assets/env@3x.png +0 -0
- package/lib/commonjs/icons/assets/events.png +0 -0
- package/lib/commonjs/icons/assets/events@2x.png +0 -0
- package/lib/commonjs/icons/assets/events@3x.png +0 -0
- package/lib/commonjs/icons/assets/highlight.png +0 -0
- package/lib/commonjs/icons/assets/highlight@2x.png +0 -0
- package/lib/commonjs/icons/assets/highlight@3x.png +0 -0
- package/lib/commonjs/icons/assets/highlighter.png +0 -0
- package/lib/commonjs/icons/assets/highlighter@2x.png +0 -0
- package/lib/commonjs/icons/assets/highlighter@3x.png +0 -0
- package/lib/commonjs/icons/assets/image-overlay.png +0 -0
- package/lib/commonjs/icons/assets/image-overlay@2x.png +0 -0
- package/lib/commonjs/icons/assets/image-overlay@3x.png +0 -0
- package/lib/commonjs/icons/assets/images.png +0 -0
- package/lib/commonjs/icons/assets/images@2x.png +0 -0
- package/lib/commonjs/icons/assets/images@3x.png +0 -0
- package/lib/commonjs/icons/assets/impersonate.png +0 -0
- package/lib/commonjs/icons/assets/impersonate@2x.png +0 -0
- package/lib/commonjs/icons/assets/impersonate@3x.png +0 -0
- package/lib/commonjs/icons/assets/jotai.png +0 -0
- package/lib/commonjs/icons/assets/jotai@2x.png +0 -0
- package/lib/commonjs/icons/assets/jotai@3x.png +0 -0
- package/lib/commonjs/icons/assets/network.png +0 -0
- package/lib/commonjs/icons/assets/network@2x.png +0 -0
- package/lib/commonjs/icons/assets/network@3x.png +0 -0
- package/lib/commonjs/icons/assets/query.png +0 -0
- package/lib/commonjs/icons/assets/query@2x.png +0 -0
- package/lib/commonjs/icons/assets/query@3x.png +0 -0
- package/lib/commonjs/icons/assets/redux.png +0 -0
- package/lib/commonjs/icons/assets/redux@2x.png +0 -0
- package/lib/commonjs/icons/assets/redux@3x.png +0 -0
- package/lib/commonjs/icons/assets/riverpod.png +0 -0
- package/lib/commonjs/icons/assets/riverpod@2x.png +0 -0
- package/lib/commonjs/icons/assets/riverpod@3x.png +0 -0
- package/lib/commonjs/icons/assets/routes.png +0 -0
- package/lib/commonjs/icons/assets/routes@2x.png +0 -0
- package/lib/commonjs/icons/assets/routes@3x.png +0 -0
- package/lib/commonjs/icons/assets/scenarios.png +0 -0
- package/lib/commonjs/icons/assets/scenarios@2x.png +0 -0
- package/lib/commonjs/icons/assets/scenarios@3x.png +0 -0
- package/lib/commonjs/icons/assets/sentry.png +0 -0
- package/lib/commonjs/icons/assets/sentry@2x.png +0 -0
- package/lib/commonjs/icons/assets/sentry@3x.png +0 -0
- package/lib/commonjs/icons/assets/settings.png +0 -0
- package/lib/commonjs/icons/assets/settings@2x.png +0 -0
- package/lib/commonjs/icons/assets/settings@3x.png +0 -0
- package/lib/commonjs/icons/assets/storage.png +0 -0
- package/lib/commonjs/icons/assets/storage@2x.png +0 -0
- package/lib/commonjs/icons/assets/storage@3x.png +0 -0
- package/lib/commonjs/icons/assets/time-machine.png +0 -0
- package/lib/commonjs/icons/assets/time-machine@2x.png +0 -0
- package/lib/commonjs/icons/assets/time-machine@3x.png +0 -0
- package/lib/commonjs/icons/assets/wifi.png +0 -0
- package/lib/commonjs/icons/assets/wifi@2x.png +0 -0
- package/lib/commonjs/icons/assets/wifi@3x.png +0 -0
- package/lib/commonjs/icons/assets/zustand.png +0 -0
- package/lib/commonjs/icons/assets/zustand@2x.png +0 -0
- package/lib/commonjs/icons/assets/zustand@3x.png +0 -0
- package/lib/commonjs/icons/assets-icon.js +1 -26
- package/lib/commonjs/icons/assets-icon.native.js +1 -0
- package/lib/commonjs/icons/benchmark-icon.js +1 -24
- package/lib/commonjs/icons/benchmark-icon.native.js +1 -0
- package/lib/commonjs/icons/bif-raster-icon.js +1 -0
- package/lib/commonjs/icons/bif-raster-icon.native.js +1 -0
- package/lib/commonjs/icons/camera-icon.js +1 -27
- package/lib/commonjs/icons/camera-icon.native.js +1 -0
- package/lib/commonjs/icons/console-icon.js +1 -26
- package/lib/commonjs/icons/console-icon.native.js +1 -0
- package/lib/commonjs/icons/env-icon.js +1 -24
- package/lib/commonjs/icons/env-icon.native.js +1 -0
- package/lib/commonjs/icons/events-icon.js +1 -24
- package/lib/commonjs/icons/events-icon.native.js +1 -0
- package/lib/commonjs/icons/generated/assets-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/benchmark-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/camera-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/env-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/events-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/glyph-icons.g.js +1 -299
- package/lib/commonjs/icons/generated/highlight-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/highlighter-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/icon-data.g.js +1 -7267
- package/lib/commonjs/icons/generated/image-overlay-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/images-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/network-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/raster-icons.g.js +1 -0
- package/lib/commonjs/icons/generated/riverpod-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/routes-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/settings-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/storage-raster.g.js +1 -0
- package/lib/commonjs/icons/generated/wifi-raster.g.js +1 -0
- package/lib/commonjs/icons/highlight-icon.js +1 -24
- package/lib/commonjs/icons/highlight-icon.native.js +1 -0
- package/lib/commonjs/icons/highlighter-icon.js +1 -0
- package/lib/commonjs/icons/highlighter-icon.native.js +1 -0
- package/lib/commonjs/icons/icon-factories.js +1 -173
- package/lib/commonjs/icons/icon-primitives.js +1 -676
- package/lib/commonjs/icons/icon-primitives.native.js +1 -904
- package/lib/commonjs/icons/icon-renderer.js +1 -307
- package/lib/commonjs/icons/iconGlow.js +1 -32
- package/lib/commonjs/icons/image-overlay-icon.js +1 -26
- package/lib/commonjs/icons/image-overlay-icon.native.js +1 -0
- package/lib/commonjs/icons/images-icon.js +1 -26
- package/lib/commonjs/icons/images-icon.native.js +1 -0
- package/lib/commonjs/icons/impersonate-icon.js +1 -26
- package/lib/commonjs/icons/impersonate-icon.native.js +1 -0
- package/lib/commonjs/icons/jotai-icon.js +1 -26
- package/lib/commonjs/icons/jotai-icon.native.js +1 -0
- package/lib/commonjs/icons/network-icon.js +1 -24
- package/lib/commonjs/icons/network-icon.native.js +1 -0
- package/lib/commonjs/icons/query-icon.js +1 -24
- package/lib/commonjs/icons/query-icon.native.js +1 -0
- package/lib/commonjs/icons/raster-icon.js +1 -0
- package/lib/commonjs/icons/redux-icon.js +1 -24
- package/lib/commonjs/icons/redux-icon.native.js +1 -0
- package/lib/commonjs/icons/renders-icon.js +1 -33
- package/lib/commonjs/icons/renders-icon.native.js +1 -0
- package/lib/commonjs/icons/riverpod-icon.js +1 -26
- package/lib/commonjs/icons/riverpod-icon.native.js +1 -0
- package/lib/commonjs/icons/routes-icon.js +1 -49
- package/lib/commonjs/icons/routes-icon.native.js +1 -0
- package/lib/commonjs/icons/routes-parts.js +1 -0
- package/lib/commonjs/icons/scenarios-icon.js +1 -26
- package/lib/commonjs/icons/scenarios-icon.native.js +1 -0
- package/lib/commonjs/icons/sentry-icon.js +1 -24
- package/lib/commonjs/icons/sentry-icon.native.js +1 -0
- package/lib/commonjs/icons/settings-icon.js +1 -23
- package/lib/commonjs/icons/settings-icon.native.js +1 -0
- package/lib/commonjs/icons/storage-icon.js +1 -24
- package/lib/commonjs/icons/storage-icon.native.js +1 -0
- package/lib/commonjs/icons/time-machine-icon.js +1 -26
- package/lib/commonjs/icons/time-machine-icon.native.js +1 -0
- package/lib/commonjs/icons/wifi-icon.js +1 -24
- package/lib/commonjs/icons/wifi-icon.native.js +1 -0
- package/lib/commonjs/icons/zustand-icon.js +1 -26
- package/lib/commonjs/icons/zustand-icon.native.js +1 -0
- package/lib/commonjs/index.js +1 -1099
- package/lib/commonjs/settings.js +1 -601
- 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 -618
- package/lib/module/dialUsage.js +1 -122
- package/lib/module/easing.js +1 -62
- package/lib/module/floating.js +1 -0
- package/lib/module/fonts.js +1 -28
- package/lib/module/fonts.web.js +1 -0
- package/lib/module/icons/ICONS.md +7 -0
- package/lib/module/icons/ask-buoy-icon.js +1 -18
- package/lib/module/icons/ask-buoy-icon.native.js +1 -0
- package/lib/module/icons/assets/askBuoy.png +0 -0
- package/lib/module/icons/assets/askBuoy@2x.png +0 -0
- package/lib/module/icons/assets/askBuoy@3x.png +0 -0
- package/lib/module/icons/assets/assets.png +0 -0
- package/lib/module/icons/assets/assets@2x.png +0 -0
- package/lib/module/icons/assets/assets@3x.png +0 -0
- package/lib/module/icons/assets/benchmark.png +0 -0
- package/lib/module/icons/assets/benchmark@2x.png +0 -0
- package/lib/module/icons/assets/benchmark@3x.png +0 -0
- package/lib/module/icons/assets/camera.png +0 -0
- package/lib/module/icons/assets/camera@2x.png +0 -0
- package/lib/module/icons/assets/camera@3x.png +0 -0
- package/lib/module/icons/assets/console.png +0 -0
- package/lib/module/icons/assets/console@2x.png +0 -0
- package/lib/module/icons/assets/console@3x.png +0 -0
- package/lib/module/icons/assets/env.png +0 -0
- package/lib/module/icons/assets/env@2x.png +0 -0
- package/lib/module/icons/assets/env@3x.png +0 -0
- package/lib/module/icons/assets/events.png +0 -0
- package/lib/module/icons/assets/events@2x.png +0 -0
- package/lib/module/icons/assets/events@3x.png +0 -0
- package/lib/module/icons/assets/highlight.png +0 -0
- package/lib/module/icons/assets/highlight@2x.png +0 -0
- package/lib/module/icons/assets/highlight@3x.png +0 -0
- package/lib/module/icons/assets/highlighter.png +0 -0
- package/lib/module/icons/assets/highlighter@2x.png +0 -0
- package/lib/module/icons/assets/highlighter@3x.png +0 -0
- package/lib/module/icons/assets/image-overlay.png +0 -0
- package/lib/module/icons/assets/image-overlay@2x.png +0 -0
- package/lib/module/icons/assets/image-overlay@3x.png +0 -0
- package/lib/module/icons/assets/images.png +0 -0
- package/lib/module/icons/assets/images@2x.png +0 -0
- package/lib/module/icons/assets/images@3x.png +0 -0
- package/lib/module/icons/assets/impersonate.png +0 -0
- package/lib/module/icons/assets/impersonate@2x.png +0 -0
- package/lib/module/icons/assets/impersonate@3x.png +0 -0
- package/lib/module/icons/assets/jotai.png +0 -0
- package/lib/module/icons/assets/jotai@2x.png +0 -0
- package/lib/module/icons/assets/jotai@3x.png +0 -0
- package/lib/module/icons/assets/network.png +0 -0
- package/lib/module/icons/assets/network@2x.png +0 -0
- package/lib/module/icons/assets/network@3x.png +0 -0
- package/lib/module/icons/assets/query.png +0 -0
- package/lib/module/icons/assets/query@2x.png +0 -0
- package/lib/module/icons/assets/query@3x.png +0 -0
- package/lib/module/icons/assets/redux.png +0 -0
- package/lib/module/icons/assets/redux@2x.png +0 -0
- package/lib/module/icons/assets/redux@3x.png +0 -0
- package/lib/module/icons/assets/riverpod.png +0 -0
- package/lib/module/icons/assets/riverpod@2x.png +0 -0
- package/lib/module/icons/assets/riverpod@3x.png +0 -0
- package/lib/module/icons/assets/routes.png +0 -0
- package/lib/module/icons/assets/routes@2x.png +0 -0
- package/lib/module/icons/assets/routes@3x.png +0 -0
- package/lib/module/icons/assets/scenarios.png +0 -0
- package/lib/module/icons/assets/scenarios@2x.png +0 -0
- package/lib/module/icons/assets/scenarios@3x.png +0 -0
- package/lib/module/icons/assets/sentry.png +0 -0
- package/lib/module/icons/assets/sentry@2x.png +0 -0
- package/lib/module/icons/assets/sentry@3x.png +0 -0
- package/lib/module/icons/assets/settings.png +0 -0
- package/lib/module/icons/assets/settings@2x.png +0 -0
- package/lib/module/icons/assets/settings@3x.png +0 -0
- package/lib/module/icons/assets/storage.png +0 -0
- package/lib/module/icons/assets/storage@2x.png +0 -0
- package/lib/module/icons/assets/storage@3x.png +0 -0
- package/lib/module/icons/assets/time-machine.png +0 -0
- package/lib/module/icons/assets/time-machine@2x.png +0 -0
- package/lib/module/icons/assets/time-machine@3x.png +0 -0
- package/lib/module/icons/assets/wifi.png +0 -0
- package/lib/module/icons/assets/wifi@2x.png +0 -0
- package/lib/module/icons/assets/wifi@3x.png +0 -0
- package/lib/module/icons/assets/zustand.png +0 -0
- package/lib/module/icons/assets/zustand@2x.png +0 -0
- package/lib/module/icons/assets/zustand@3x.png +0 -0
- package/lib/module/icons/assets-icon.js +1 -17
- package/lib/module/icons/assets-icon.native.js +1 -0
- package/lib/module/icons/benchmark-icon.js +1 -15
- package/lib/module/icons/benchmark-icon.native.js +1 -0
- package/lib/module/icons/bif-raster-icon.js +1 -0
- package/lib/module/icons/bif-raster-icon.native.js +1 -0
- package/lib/module/icons/camera-icon.js +1 -18
- package/lib/module/icons/camera-icon.native.js +1 -0
- package/lib/module/icons/console-icon.js +1 -17
- package/lib/module/icons/console-icon.native.js +1 -0
- package/lib/module/icons/env-icon.js +1 -15
- package/lib/module/icons/env-icon.native.js +1 -0
- package/lib/module/icons/events-icon.js +1 -15
- package/lib/module/icons/events-icon.native.js +1 -0
- package/lib/module/icons/generated/assets-raster.g.js +1 -0
- package/lib/module/icons/generated/benchmark-raster.g.js +1 -0
- package/lib/module/icons/generated/camera-raster.g.js +1 -0
- package/lib/module/icons/generated/env-raster.g.js +1 -0
- package/lib/module/icons/generated/events-raster.g.js +1 -0
- package/lib/module/icons/generated/glyph-icons.g.js +1 -296
- package/lib/module/icons/generated/highlight-raster.g.js +1 -0
- package/lib/module/icons/generated/highlighter-raster.g.js +1 -0
- package/lib/module/icons/generated/icon-data.g.js +1 -7262
- package/lib/module/icons/generated/image-overlay-raster.g.js +1 -0
- package/lib/module/icons/generated/images-raster.g.js +1 -0
- package/lib/module/icons/generated/network-raster.g.js +1 -0
- package/lib/module/icons/generated/raster-icons.g.js +1 -0
- package/lib/module/icons/generated/riverpod-raster.g.js +1 -0
- package/lib/module/icons/generated/routes-raster.g.js +1 -0
- package/lib/module/icons/generated/settings-raster.g.js +1 -0
- package/lib/module/icons/generated/storage-raster.g.js +1 -0
- package/lib/module/icons/generated/wifi-raster.g.js +1 -0
- package/lib/module/icons/highlight-icon.js +1 -15
- package/lib/module/icons/highlight-icon.native.js +1 -0
- package/lib/module/icons/highlighter-icon.js +1 -0
- package/lib/module/icons/highlighter-icon.native.js +1 -0
- package/lib/module/icons/icon-factories.js +1 -163
- package/lib/module/icons/icon-primitives.js +1 -673
- package/lib/module/icons/icon-primitives.native.js +1 -899
- package/lib/module/icons/icon-renderer.js +1 -302
- package/lib/module/icons/iconGlow.js +1 -28
- package/lib/module/icons/image-overlay-icon.js +1 -17
- package/lib/module/icons/image-overlay-icon.native.js +1 -0
- package/lib/module/icons/images-icon.js +1 -17
- package/lib/module/icons/images-icon.native.js +1 -0
- package/lib/module/icons/impersonate-icon.js +1 -17
- package/lib/module/icons/impersonate-icon.native.js +1 -0
- package/lib/module/icons/jotai-icon.js +1 -17
- package/lib/module/icons/jotai-icon.native.js +1 -0
- package/lib/module/icons/network-icon.js +1 -15
- package/lib/module/icons/network-icon.native.js +1 -0
- package/lib/module/icons/query-icon.js +1 -15
- package/lib/module/icons/query-icon.native.js +1 -0
- package/lib/module/icons/raster-icon.js +1 -0
- package/lib/module/icons/redux-icon.js +1 -15
- package/lib/module/icons/redux-icon.native.js +1 -0
- package/lib/module/icons/renders-icon.js +1 -17
- package/lib/module/icons/renders-icon.native.js +1 -0
- package/lib/module/icons/riverpod-icon.js +1 -17
- package/lib/module/icons/riverpod-icon.native.js +1 -0
- package/lib/module/icons/routes-icon.js +1 -41
- package/lib/module/icons/routes-icon.native.js +1 -0
- package/lib/module/icons/routes-parts.js +1 -0
- package/lib/module/icons/scenarios-icon.js +1 -17
- package/lib/module/icons/scenarios-icon.native.js +1 -0
- package/lib/module/icons/sentry-icon.js +1 -15
- package/lib/module/icons/sentry-icon.native.js +1 -0
- package/lib/module/icons/settings-icon.js +1 -19
- package/lib/module/icons/settings-icon.native.js +1 -0
- package/lib/module/icons/storage-icon.js +1 -15
- package/lib/module/icons/storage-icon.native.js +1 -0
- package/lib/module/icons/time-machine-icon.js +1 -17
- package/lib/module/icons/time-machine-icon.native.js +1 -0
- package/lib/module/icons/wifi-icon.js +1 -15
- package/lib/module/icons/wifi-icon.native.js +1 -0
- package/lib/module/icons/zustand-icon.js +1 -17
- package/lib/module/icons/zustand-icon.native.js +1 -0
- package/lib/module/index.js +1 -128
- package/lib/module/settings.js +1 -589
- package/lib/module/utils.js +1 -66
- package/lib/typescript/commonjs/FloatingToolsStore.d.ts +2 -0
- package/lib/typescript/commonjs/dial.d.ts +6 -0
- package/lib/typescript/commonjs/floating.d.ts +8 -0
- package/lib/typescript/commonjs/fonts.web.d.ts +3 -0
- package/lib/typescript/commonjs/icons/ask-buoy-icon.d.ts +1 -13
- package/lib/typescript/commonjs/icons/ask-buoy-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/assets-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/assets-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/benchmark-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/benchmark-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/bif-raster-icon.d.ts +4 -0
- package/lib/typescript/commonjs/icons/bif-raster-icon.native.d.ts +5 -0
- package/lib/typescript/commonjs/icons/camera-icon.d.ts +1 -13
- package/lib/typescript/commonjs/icons/camera-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/console-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/console-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/env-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/env-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/events-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/events-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/assets-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/benchmark-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/camera-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/env-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/events-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/highlight-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/highlighter-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts +26 -1
- package/lib/typescript/commonjs/icons/generated/image-overlay-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/images-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/network-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/raster-icons.g.d.ts +13 -0
- package/lib/typescript/commonjs/icons/generated/riverpod-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/routes-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/settings-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/storage-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/generated/wifi-raster.g.d.ts +3 -0
- package/lib/typescript/commonjs/icons/highlight-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/highlight-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/highlighter-icon.d.ts +5 -0
- package/lib/typescript/commonjs/icons/highlighter-icon.native.d.ts +5 -0
- package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/image-overlay-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/images-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/images-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/impersonate-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/impersonate-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/jotai-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/jotai-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/network-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/network-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/query-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/query-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/raster-icon.d.ts +5 -0
- package/lib/typescript/commonjs/icons/redux-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/redux-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/renders-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/renders-icon.native.d.ts +2 -0
- package/lib/typescript/commonjs/icons/riverpod-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/riverpod-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/routes-icon.d.ts +2 -30
- package/lib/typescript/commonjs/icons/routes-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/routes-parts.d.ts +31 -0
- package/lib/typescript/commonjs/icons/scenarios-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/scenarios-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/sentry-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/sentry-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/settings-icon.d.ts +0 -13
- package/lib/typescript/commonjs/icons/settings-icon.native.d.ts +2 -0
- package/lib/typescript/commonjs/icons/storage-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/storage-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/time-machine-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/time-machine-icon.native.d.ts +4 -0
- package/lib/typescript/commonjs/icons/wifi-icon.d.ts +1 -10
- package/lib/typescript/commonjs/icons/wifi-icon.native.d.ts +3 -0
- package/lib/typescript/commonjs/icons/zustand-icon.d.ts +1 -12
- package/lib/typescript/commonjs/icons/zustand-icon.native.d.ts +4 -0
- package/lib/typescript/module/FloatingToolsStore.d.ts +2 -0
- package/lib/typescript/module/dial.d.ts +6 -0
- package/lib/typescript/module/floating.d.ts +8 -0
- package/lib/typescript/module/fonts.web.d.ts +3 -0
- package/lib/typescript/module/icons/ask-buoy-icon.d.ts +1 -13
- package/lib/typescript/module/icons/ask-buoy-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/assets-icon.d.ts +1 -12
- package/lib/typescript/module/icons/assets-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/benchmark-icon.d.ts +1 -10
- package/lib/typescript/module/icons/benchmark-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/bif-raster-icon.d.ts +4 -0
- package/lib/typescript/module/icons/bif-raster-icon.native.d.ts +5 -0
- package/lib/typescript/module/icons/camera-icon.d.ts +1 -13
- package/lib/typescript/module/icons/camera-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/console-icon.d.ts +1 -12
- package/lib/typescript/module/icons/console-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/env-icon.d.ts +1 -10
- package/lib/typescript/module/icons/env-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/events-icon.d.ts +1 -10
- package/lib/typescript/module/icons/events-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/generated/assets-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/benchmark-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/camera-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/env-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/events-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/highlight-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/highlighter-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/icon-data.g.d.ts +26 -1
- package/lib/typescript/module/icons/generated/image-overlay-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/images-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/network-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/raster-icons.g.d.ts +13 -0
- package/lib/typescript/module/icons/generated/riverpod-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/routes-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/settings-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/storage-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/generated/wifi-raster.g.d.ts +3 -0
- package/lib/typescript/module/icons/highlight-icon.d.ts +1 -10
- package/lib/typescript/module/icons/highlight-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/highlighter-icon.d.ts +5 -0
- package/lib/typescript/module/icons/highlighter-icon.native.d.ts +5 -0
- package/lib/typescript/module/icons/image-overlay-icon.d.ts +1 -12
- package/lib/typescript/module/icons/image-overlay-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/images-icon.d.ts +1 -12
- package/lib/typescript/module/icons/images-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/impersonate-icon.d.ts +1 -12
- package/lib/typescript/module/icons/impersonate-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/jotai-icon.d.ts +1 -12
- package/lib/typescript/module/icons/jotai-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/network-icon.d.ts +1 -10
- package/lib/typescript/module/icons/network-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/query-icon.d.ts +1 -10
- package/lib/typescript/module/icons/query-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/raster-icon.d.ts +5 -0
- package/lib/typescript/module/icons/redux-icon.d.ts +1 -10
- package/lib/typescript/module/icons/redux-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/renders-icon.d.ts +1 -12
- package/lib/typescript/module/icons/renders-icon.native.d.ts +2 -0
- package/lib/typescript/module/icons/riverpod-icon.d.ts +1 -12
- package/lib/typescript/module/icons/riverpod-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/routes-icon.d.ts +2 -30
- package/lib/typescript/module/icons/routes-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/routes-parts.d.ts +31 -0
- package/lib/typescript/module/icons/scenarios-icon.d.ts +1 -12
- package/lib/typescript/module/icons/scenarios-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/sentry-icon.d.ts +1 -10
- package/lib/typescript/module/icons/sentry-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/settings-icon.d.ts +0 -13
- package/lib/typescript/module/icons/settings-icon.native.d.ts +2 -0
- package/lib/typescript/module/icons/storage-icon.d.ts +1 -10
- package/lib/typescript/module/icons/storage-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/time-machine-icon.d.ts +1 -12
- package/lib/typescript/module/icons/time-machine-icon.native.d.ts +4 -0
- package/lib/typescript/module/icons/wifi-icon.d.ts +1 -10
- package/lib/typescript/module/icons/wifi-icon.native.d.ts +3 -0
- package/lib/typescript/module/icons/zustand-icon.d.ts +1 -12
- package/lib/typescript/module/icons/zustand-icon.native.d.ts +4 -0
- package/package.json +23 -3
- 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/dialUsage.d.ts.map +0 -1
- package/lib/typescript/commonjs/easing.d.ts.map +0 -1
- package/lib/typescript/commonjs/fonts.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/ask-buoy-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/assets-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/camera-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/console-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/generated/glyph-icons.g.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/highlight-icon.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/iconGlow.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/images-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/impersonate-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/jotai-icon.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/riverpod-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/scenarios-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/settings-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/time-machine-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/zustand-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/dialUsage.d.ts.map +0 -1
- package/lib/typescript/module/easing.d.ts.map +0 -1
- package/lib/typescript/module/fonts.d.ts.map +0 -1
- package/lib/typescript/module/icons/ask-buoy-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/assets-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/benchmark-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/camera-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/console-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/generated/glyph-icons.g.d.ts.map +0 -1
- package/lib/typescript/module/icons/generated/icon-data.g.d.ts.map +0 -1
- package/lib/typescript/module/icons/highlight-icon.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/iconGlow.d.ts.map +0 -1
- package/lib/typescript/module/icons/image-overlay-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/images-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/impersonate-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/jotai-icon.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/riverpod-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/routes-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/scenarios-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/sentry-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/settings-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/storage-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/time-machine-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/wifi-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/zustand-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
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @buoy-gg/floating-tools-core
|
|
2
|
+
|
|
3
|
+
State and layout primitives used to build Buoy's floating tools. `FloatingToolsStore` manages position, drag state, hide/show behavior, and optional persistence. Your platform integration supplies input events, rendering, and animations.
|
|
4
|
+
|
|
5
|
+
To add the existing Buoy menu to an app, use [@buoy-gg/core](https://www.npmjs.com/package/@buoy-gg/core). Use this lower-level package when building a custom shell.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @buoy-gg/floating-tools-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Check the package's peer dependencies for your target platform. The package also exports visual assets and icons; a headless store does not imply that every root export is free of UI dependencies.
|
|
14
|
+
|
|
15
|
+
## Store lifecycle
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { FloatingToolsStore } from "@buoy-gg/floating-tools-core";
|
|
19
|
+
|
|
20
|
+
async function inspectInitialPosition() {
|
|
21
|
+
const store = new FloatingToolsStore({
|
|
22
|
+
screenWidth: 390,
|
|
23
|
+
screenHeight: 844,
|
|
24
|
+
enablePositionPersistence: false,
|
|
25
|
+
});
|
|
26
|
+
await store.initialize();
|
|
27
|
+
console.log(store.getSnapshot().position);
|
|
28
|
+
store.destroy();
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Call this function to inspect an initial position without persistence. For an interactive shell, keep the store alive, subscribe to changes, update screen dimensions on resize, and destroy it when its owner unmounts. Supply a `StorageAdapter` to persist position.
|
|
33
|
+
|
|
34
|
+
The public types describe position, size, drag events, options, and drag results. Other exports include dial layout, settings state, easing, colors, usage ranking, and icons. Use the types for the installed version rather than importing private source paths.
|
|
35
|
+
|
|
36
|
+
Check dragging, hide/show, resizing, and persisted position using representative screen sizes. This package does not register inspection tools, establish account admission, or connect a broker by itself.
|
package/floating.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/typescript/module/floating";
|
package/floating.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./lib/module/floating.js");
|
|
@@ -1,501 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FloatingToolsStore = void 0;
|
|
7
|
-
var _constants = require("./constants.js");
|
|
8
|
-
/**
|
|
9
|
-
* FloatingToolsStore - Headless state management for floating tools.
|
|
10
|
-
*
|
|
11
|
-
* This class manages all the business logic for the floating tools bubble:
|
|
12
|
-
* - Position state and validation
|
|
13
|
-
* - Drag detection (tap vs drag)
|
|
14
|
-
* - Hide/show toggle
|
|
15
|
-
* - Auto-hide when dragged past edge
|
|
16
|
-
* - Position persistence
|
|
17
|
-
*
|
|
18
|
-
* Platform-specific code (animation, event handling) is NOT included here.
|
|
19
|
-
* Use this with platform-specific hooks/bindings.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
class FloatingToolsStore {
|
|
23
|
-
// State
|
|
24
|
-
|
|
25
|
-
isDragging = false;
|
|
26
|
-
isHidden = false;
|
|
27
|
-
|
|
28
|
-
// Configuration
|
|
29
|
-
|
|
30
|
-
// Callbacks
|
|
31
|
-
|
|
32
|
-
// Drag tracking
|
|
33
|
-
dragStartPos = {
|
|
34
|
-
x: 0,
|
|
35
|
-
y: 0
|
|
36
|
-
};
|
|
37
|
-
dragStartMouse = {
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0
|
|
40
|
-
};
|
|
41
|
-
hasMoved = false;
|
|
42
|
-
savedPosition = null;
|
|
43
|
-
|
|
44
|
-
// Persistence
|
|
45
|
-
saveTimeout = null;
|
|
46
|
-
isInitialized = false;
|
|
47
|
-
|
|
48
|
-
// Subscribers (for useSyncExternalStore)
|
|
49
|
-
listeners = new Set();
|
|
50
|
-
constructor(options) {
|
|
51
|
-
this.screenWidth = options.screenWidth;
|
|
52
|
-
this.screenHeight = options.screenHeight;
|
|
53
|
-
this.bubbleSize = options.initialBubbleSize ?? {
|
|
54
|
-
width: 100,
|
|
55
|
-
height: 32
|
|
56
|
-
};
|
|
57
|
-
this.minPosition = options.minPosition ?? {
|
|
58
|
-
x: _constants.EDGE_PADDING,
|
|
59
|
-
y: _constants.EDGE_PADDING
|
|
60
|
-
};
|
|
61
|
-
this.visibleHandleWidth = options.visibleHandleWidth ?? _constants.VISIBLE_HANDLE_WIDTH;
|
|
62
|
-
this.dragThreshold = options.dragThreshold ?? _constants.DRAG_THRESHOLD;
|
|
63
|
-
this.edgePadding = options.edgePadding ?? _constants.EDGE_PADDING;
|
|
64
|
-
this.enablePositionPersistence = options.enablePositionPersistence ?? true;
|
|
65
|
-
this.storage = options.storage;
|
|
66
|
-
this.onPositionChange = options.onPositionChange;
|
|
67
|
-
this.onHiddenChange = options.onHiddenChange;
|
|
68
|
-
this.onDraggingChange = options.onDraggingChange;
|
|
69
|
-
|
|
70
|
-
// Default position
|
|
71
|
-
this.position = options.initialPosition ?? {
|
|
72
|
-
x: this.screenWidth - this.bubbleSize.width - 20,
|
|
73
|
-
y: Math.max(this.minPosition.y, Math.min(100, this.screenHeight - this.bubbleSize.height - this.edgePadding))
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// Initialize snapshot
|
|
77
|
-
this.stateSnapshot = this.createSnapshot();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// =============================
|
|
81
|
-
// Subscription (for React hooks)
|
|
82
|
-
// =============================
|
|
83
|
-
|
|
84
|
-
subscribe = listener => {
|
|
85
|
-
this.listeners.add(listener);
|
|
86
|
-
return () => this.listeners.delete(listener);
|
|
87
|
-
};
|
|
88
|
-
getSnapshot = () => {
|
|
89
|
-
return this.stateSnapshot;
|
|
90
|
-
};
|
|
91
|
-
createSnapshot() {
|
|
92
|
-
return {
|
|
93
|
-
position: {
|
|
94
|
-
...this.position
|
|
95
|
-
},
|
|
96
|
-
isDragging: this.isDragging,
|
|
97
|
-
isHidden: this.isHidden,
|
|
98
|
-
bubbleSize: {
|
|
99
|
-
...this.bubbleSize
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
notify() {
|
|
104
|
-
this.stateSnapshot = this.createSnapshot();
|
|
105
|
-
this.listeners.forEach(listener => listener());
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// =============================
|
|
109
|
-
// Initialization
|
|
110
|
-
// =============================
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Initialize the store by loading persisted position.
|
|
114
|
-
* Call this after setting up storage adapter.
|
|
115
|
-
*/
|
|
116
|
-
async initialize() {
|
|
117
|
-
if (this.isInitialized || !this.enablePositionPersistence || !this.storage) {
|
|
118
|
-
this.isInitialized = true;
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
const [xStr, yStr] = await Promise.all([this.storage.getItem(_constants.STORAGE_KEYS.POSITION_X), this.storage.getItem(_constants.STORAGE_KEYS.POSITION_Y)]);
|
|
123
|
-
if (xStr !== null && yStr !== null) {
|
|
124
|
-
const x = parseFloat(xStr);
|
|
125
|
-
const y = parseFloat(yStr);
|
|
126
|
-
if (!Number.isNaN(x) && !Number.isNaN(y)) {
|
|
127
|
-
const saved = {
|
|
128
|
-
x,
|
|
129
|
-
y
|
|
130
|
-
};
|
|
131
|
-
const validated = this.validatePosition(saved);
|
|
132
|
-
|
|
133
|
-
// Save corrected position if out of bounds
|
|
134
|
-
if (Math.abs(saved.x - validated.x) > 5 || Math.abs(saved.y - validated.y) > 5) {
|
|
135
|
-
this.savePosition(validated.x, validated.y);
|
|
136
|
-
}
|
|
137
|
-
this.position = validated;
|
|
138
|
-
|
|
139
|
-
// Check if loaded in hidden state
|
|
140
|
-
if (validated.x >= this.screenWidth - this.visibleHandleWidth - 5) {
|
|
141
|
-
this.isHidden = true;
|
|
142
|
-
}
|
|
143
|
-
this.notify();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch {
|
|
147
|
-
// Failed to load - use default position
|
|
148
|
-
}
|
|
149
|
-
this.isInitialized = true;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// =============================
|
|
153
|
-
// Position Management
|
|
154
|
-
// =============================
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Get current bounds for position validation.
|
|
158
|
-
*/
|
|
159
|
-
getBounds() {
|
|
160
|
-
return {
|
|
161
|
-
minX: this.minPosition.x,
|
|
162
|
-
maxX: this.screenWidth - this.visibleHandleWidth,
|
|
163
|
-
minY: this.minPosition.y,
|
|
164
|
-
maxY: this.screenHeight - this.bubbleSize.height - this.edgePadding
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Validate and clamp a position to screen boundaries.
|
|
170
|
-
*/
|
|
171
|
-
validatePosition(pos) {
|
|
172
|
-
const bounds = this.getBounds();
|
|
173
|
-
return {
|
|
174
|
-
x: Math.max(bounds.minX, Math.min(pos.x, bounds.maxX)),
|
|
175
|
-
y: Math.max(bounds.minY, Math.min(pos.y, bounds.maxY))
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Set position directly (for animation callbacks).
|
|
181
|
-
*/
|
|
182
|
-
setPosition(pos) {
|
|
183
|
-
this.position = pos;
|
|
184
|
-
this.onPositionChange?.(pos);
|
|
185
|
-
this.notify();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Update bubble size (call on layout).
|
|
190
|
-
* Only notifies if size actually changed.
|
|
191
|
-
*/
|
|
192
|
-
setBubbleSize(size) {
|
|
193
|
-
if (this.bubbleSize.width === size.width && this.bubbleSize.height === size.height) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
this.bubbleSize = size;
|
|
197
|
-
this.notify();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Update screen dimensions (call on resize).
|
|
202
|
-
*/
|
|
203
|
-
setScreenSize(width, height) {
|
|
204
|
-
this.screenWidth = width;
|
|
205
|
-
this.screenHeight = height;
|
|
206
|
-
// Re-validate position
|
|
207
|
-
const validated = this.validatePosition(this.position);
|
|
208
|
-
if (validated.x !== this.position.x || validated.y !== this.position.y) {
|
|
209
|
-
this.position = validated;
|
|
210
|
-
this.notify();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Update min position (e.g., for safe area insets).
|
|
216
|
-
*/
|
|
217
|
-
setMinPosition(minPos) {
|
|
218
|
-
this.minPosition = minPos;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// =============================
|
|
222
|
-
// Persistence
|
|
223
|
-
// =============================
|
|
224
|
-
|
|
225
|
-
async savePosition(x, y) {
|
|
226
|
-
if (!this.enablePositionPersistence || !this.storage) return;
|
|
227
|
-
try {
|
|
228
|
-
await Promise.all([this.storage.setItem(_constants.STORAGE_KEYS.POSITION_X, x.toString()), this.storage.setItem(_constants.STORAGE_KEYS.POSITION_Y, y.toString())]);
|
|
229
|
-
} catch {
|
|
230
|
-
// Failed to save - continue without persistence
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
debouncedSavePosition(x, y) {
|
|
234
|
-
if (this.saveTimeout) clearTimeout(this.saveTimeout);
|
|
235
|
-
this.saveTimeout = setTimeout(() => this.savePosition(x, y), _constants.SAVE_DEBOUNCE_MS);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// =============================
|
|
239
|
-
// Hide/Show Toggle
|
|
240
|
-
// =============================
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Toggle between hidden and visible states.
|
|
244
|
-
* Returns the target position for animation.
|
|
245
|
-
*/
|
|
246
|
-
toggleHideShow() {
|
|
247
|
-
const isVisuallyOffScreen = this.position.x > this.screenWidth - this.bubbleSize.width / 2;
|
|
248
|
-
if (this.isHidden || isVisuallyOffScreen) {
|
|
249
|
-
// Show the bubble
|
|
250
|
-
let targetX;
|
|
251
|
-
let targetY;
|
|
252
|
-
if (this.savedPosition && this.savedPosition.x < this.screenWidth - this.bubbleSize.width / 2) {
|
|
253
|
-
targetX = this.savedPosition.x;
|
|
254
|
-
targetY = this.savedPosition.y;
|
|
255
|
-
} else {
|
|
256
|
-
targetX = this.screenWidth - this.bubbleSize.width - 20;
|
|
257
|
-
targetY = this.position.y;
|
|
258
|
-
}
|
|
259
|
-
this.isHidden = false;
|
|
260
|
-
this.onHiddenChange?.(false);
|
|
261
|
-
this.notify();
|
|
262
|
-
return {
|
|
263
|
-
targetPosition: {
|
|
264
|
-
x: targetX,
|
|
265
|
-
y: targetY
|
|
266
|
-
},
|
|
267
|
-
isHiding: false
|
|
268
|
-
};
|
|
269
|
-
} else {
|
|
270
|
-
// Hide the bubble
|
|
271
|
-
this.savedPosition = {
|
|
272
|
-
...this.position
|
|
273
|
-
};
|
|
274
|
-
const hiddenX = this.screenWidth - this.visibleHandleWidth;
|
|
275
|
-
this.isHidden = true;
|
|
276
|
-
this.onHiddenChange?.(true);
|
|
277
|
-
this.notify();
|
|
278
|
-
return {
|
|
279
|
-
targetPosition: {
|
|
280
|
-
x: hiddenX,
|
|
281
|
-
y: this.position.y
|
|
282
|
-
},
|
|
283
|
-
isHiding: true
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Force hide (for pushToSide behavior).
|
|
290
|
-
*/
|
|
291
|
-
forceHide() {
|
|
292
|
-
if (this.isHidden) {
|
|
293
|
-
return {
|
|
294
|
-
targetPosition: this.position
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
this.savedPosition = {
|
|
298
|
-
...this.position
|
|
299
|
-
};
|
|
300
|
-
const hiddenX = this.screenWidth - this.visibleHandleWidth;
|
|
301
|
-
this.isHidden = true;
|
|
302
|
-
this.onHiddenChange?.(true);
|
|
303
|
-
this.notify();
|
|
304
|
-
return {
|
|
305
|
-
targetPosition: {
|
|
306
|
-
x: hiddenX,
|
|
307
|
-
y: this.position.y
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Force show (restore from pushToSide).
|
|
314
|
-
*/
|
|
315
|
-
forceShow() {
|
|
316
|
-
if (!this.isHidden) {
|
|
317
|
-
return {
|
|
318
|
-
targetPosition: this.position
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
let targetX;
|
|
322
|
-
let targetY;
|
|
323
|
-
if (this.savedPosition) {
|
|
324
|
-
targetX = this.savedPosition.x;
|
|
325
|
-
targetY = this.savedPosition.y;
|
|
326
|
-
} else {
|
|
327
|
-
targetX = this.screenWidth - this.bubbleSize.width - 20;
|
|
328
|
-
targetY = this.position.y;
|
|
329
|
-
}
|
|
330
|
-
this.isHidden = false;
|
|
331
|
-
this.onHiddenChange?.(false);
|
|
332
|
-
this.notify();
|
|
333
|
-
return {
|
|
334
|
-
targetPosition: {
|
|
335
|
-
x: targetX,
|
|
336
|
-
y: targetY
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// =============================
|
|
342
|
-
// Drag Handling
|
|
343
|
-
// =============================
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Start a drag operation.
|
|
347
|
-
*/
|
|
348
|
-
handleDragStart(event) {
|
|
349
|
-
this.hasMoved = false;
|
|
350
|
-
this.dragStartPos = {
|
|
351
|
-
...this.position
|
|
352
|
-
};
|
|
353
|
-
this.dragStartMouse = {
|
|
354
|
-
x: event.clientX,
|
|
355
|
-
y: event.clientY
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Process drag movement.
|
|
361
|
-
* Returns the new position (for animation) and whether drag threshold was exceeded.
|
|
362
|
-
*/
|
|
363
|
-
handleDragMove(event) {
|
|
364
|
-
const dx = event.clientX - this.dragStartMouse.x;
|
|
365
|
-
const dy = event.clientY - this.dragStartMouse.y;
|
|
366
|
-
const totalDistance = Math.abs(dx) + Math.abs(dy);
|
|
367
|
-
|
|
368
|
-
// Check if moved enough to be considered a drag
|
|
369
|
-
if (!this.hasMoved && totalDistance > this.dragThreshold) {
|
|
370
|
-
this.hasMoved = true;
|
|
371
|
-
this.isDragging = true;
|
|
372
|
-
this.onDraggingChange?.(true);
|
|
373
|
-
this.notify();
|
|
374
|
-
}
|
|
375
|
-
if (this.hasMoved) {
|
|
376
|
-
const newX = this.dragStartPos.x + dx;
|
|
377
|
-
const newY = this.dragStartPos.y + dy;
|
|
378
|
-
|
|
379
|
-
// Allow overflow to right for hide detection, but clamp Y
|
|
380
|
-
const bounds = this.getBounds();
|
|
381
|
-
const clampedX = Math.max(bounds.minX, Math.min(newX, this.screenWidth - this.visibleHandleWidth + this.bubbleSize.width));
|
|
382
|
-
const clampedY = Math.max(bounds.minY, Math.min(newY, bounds.maxY));
|
|
383
|
-
this.position = {
|
|
384
|
-
x: clampedX,
|
|
385
|
-
y: clampedY
|
|
386
|
-
};
|
|
387
|
-
this.onPositionChange?.(this.position);
|
|
388
|
-
this.notify();
|
|
389
|
-
return {
|
|
390
|
-
position: this.position,
|
|
391
|
-
isDragging: true
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
return {
|
|
395
|
-
position: this.position,
|
|
396
|
-
isDragging: false
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* End a drag operation.
|
|
402
|
-
* Returns the result including whether to animate to hidden state.
|
|
403
|
-
*/
|
|
404
|
-
handleDragEnd(event) {
|
|
405
|
-
const wasTap = !this.hasMoved;
|
|
406
|
-
if (wasTap) {
|
|
407
|
-
this.isDragging = false;
|
|
408
|
-
this.onDraggingChange?.(false);
|
|
409
|
-
this.notify();
|
|
410
|
-
return {
|
|
411
|
-
position: this.position,
|
|
412
|
-
shouldHide: false,
|
|
413
|
-
wasTap: true
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Calculate final position
|
|
418
|
-
const dx = event.clientX - this.dragStartMouse.x;
|
|
419
|
-
const dy = event.clientY - this.dragStartMouse.y;
|
|
420
|
-
const currentX = this.dragStartPos.x + dx;
|
|
421
|
-
const currentY = this.dragStartPos.y + dy;
|
|
422
|
-
|
|
423
|
-
// Check if should auto-hide (bubble midpoint past right edge)
|
|
424
|
-
const bubbleMidpoint = currentX + this.bubbleSize.width / 2;
|
|
425
|
-
const shouldHide = bubbleMidpoint > this.screenWidth;
|
|
426
|
-
const bounds = this.getBounds();
|
|
427
|
-
if (shouldHide) {
|
|
428
|
-
const hiddenX = this.screenWidth - this.visibleHandleWidth;
|
|
429
|
-
const clampedY = Math.max(bounds.minY, Math.min(currentY, bounds.maxY));
|
|
430
|
-
this.isHidden = true;
|
|
431
|
-
this.onHiddenChange?.(true);
|
|
432
|
-
this.isDragging = false;
|
|
433
|
-
this.onDraggingChange?.(false);
|
|
434
|
-
this.notify();
|
|
435
|
-
return {
|
|
436
|
-
position: {
|
|
437
|
-
x: hiddenX,
|
|
438
|
-
y: clampedY
|
|
439
|
-
},
|
|
440
|
-
shouldHide: true,
|
|
441
|
-
wasTap: false
|
|
442
|
-
};
|
|
443
|
-
} else {
|
|
444
|
-
// Check if pulling back from hidden
|
|
445
|
-
if (this.isHidden && currentX < this.screenWidth - this.visibleHandleWidth - 10) {
|
|
446
|
-
this.isHidden = false;
|
|
447
|
-
this.onHiddenChange?.(false);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// Clamp to visible area
|
|
451
|
-
const clampedX = Math.max(bounds.minX, Math.min(currentX, this.screenWidth - this.bubbleSize.width - this.edgePadding));
|
|
452
|
-
const clampedY = Math.max(bounds.minY, Math.min(currentY, bounds.maxY));
|
|
453
|
-
|
|
454
|
-
// Save position if visible
|
|
455
|
-
if (clampedX < this.screenWidth - this.bubbleSize.width / 2) {
|
|
456
|
-
this.savedPosition = {
|
|
457
|
-
x: clampedX,
|
|
458
|
-
y: clampedY
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
this.position = {
|
|
462
|
-
x: clampedX,
|
|
463
|
-
y: clampedY
|
|
464
|
-
};
|
|
465
|
-
this.isDragging = false;
|
|
466
|
-
this.onDraggingChange?.(false);
|
|
467
|
-
this.debouncedSavePosition(clampedX, clampedY);
|
|
468
|
-
this.notify();
|
|
469
|
-
return {
|
|
470
|
-
position: {
|
|
471
|
-
x: clampedX,
|
|
472
|
-
y: clampedY
|
|
473
|
-
},
|
|
474
|
-
shouldHide: false,
|
|
475
|
-
wasTap: false
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Commit position after animation completes.
|
|
482
|
-
*/
|
|
483
|
-
commitPosition(pos) {
|
|
484
|
-
this.position = pos;
|
|
485
|
-
this.savePosition(pos.x, pos.y);
|
|
486
|
-
this.notify();
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
// =============================
|
|
490
|
-
// Cleanup
|
|
491
|
-
// =============================
|
|
492
|
-
|
|
493
|
-
destroy() {
|
|
494
|
-
if (this.saveTimeout) {
|
|
495
|
-
clearTimeout(this.saveTimeout);
|
|
496
|
-
this.saveTimeout = null;
|
|
497
|
-
}
|
|
498
|
-
this.listeners.clear();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
exports.FloatingToolsStore = FloatingToolsStore;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FloatingToolsStore=void 0;var _constants=require("./constants.js");class FloatingToolsStore{isDragging=!1;isHidden=!1;dragStartPos={x:0,y:0};dragStartMouse={x:0,y:0};hasMoved=!1;savedPosition=null;saveTimeout=null;isInitialized=!1;listeners=new Set;constructor(i){this.screenWidth=i.screenWidth,this.screenHeight=i.screenHeight,this.bubbleSize=i.initialBubbleSize??{width:100,height:32},this.minPosition=i.minPosition??{x:_constants.EDGE_PADDING,y:_constants.EDGE_PADDING},this.visibleHandleWidth=i.visibleHandleWidth??_constants.VISIBLE_HANDLE_WIDTH,this.dragThreshold=i.dragThreshold??_constants.DRAG_THRESHOLD,this.edgePadding=i.edgePadding??_constants.EDGE_PADDING,this.enablePositionPersistence=i.enablePositionPersistence??!0,this.storage=i.storage,this.onPositionChange=i.onPositionChange,this.onHiddenChange=i.onHiddenChange,this.onDraggingChange=i.onDraggingChange,this.position=i.initialPosition??{x:this.screenWidth-this.bubbleSize.width-20,y:Math.max(this.minPosition.y,Math.min(100,this.screenHeight-this.bubbleSize.height-this.edgePadding))},this.stateSnapshot=this.createSnapshot()}subscribe=i=>(this.listeners.add(i),()=>this.listeners.delete(i));getSnapshot=()=>this.stateSnapshot;createSnapshot(){return{position:{...this.position},isDragging:this.isDragging,isHidden:this.isHidden,bubbleSize:{...this.bubbleSize}}}notify(){this.stateSnapshot=this.createSnapshot(),this.listeners.forEach(i=>i())}async initialize(){if(!this.isInitialized&&this.enablePositionPersistence&&this.storage){try{const[i,t]=await Promise.all([this.storage.getItem(_constants.STORAGE_KEYS.POSITION_X),this.storage.getItem(_constants.STORAGE_KEYS.POSITION_Y)]);if(null!==i&&null!==t){const s=parseFloat(i),e=parseFloat(t);if(!Number.isNaN(s)&&!Number.isNaN(e)){const i={x:s,y:e},t=this.validatePosition(i);(Math.abs(i.x-t.x)>5||Math.abs(i.y-t.y)>5)&&this.savePosition(t.x,t.y),this.position=t,t.x>=this.screenWidth-this.visibleHandleWidth-5&&(this.isHidden=!0),this.notify()}}}catch{}this.isInitialized=!0}else this.isInitialized=!0}getBounds(){return{minX:this.minPosition.x,maxX:this.screenWidth-this.visibleHandleWidth,minY:this.minPosition.y,maxY:this.screenHeight-this.bubbleSize.height-this.edgePadding}}validatePosition(i){const t=this.getBounds();return{x:Math.max(t.minX,Math.min(i.x,t.maxX)),y:Math.max(t.minY,Math.min(i.y,t.maxY))}}setPosition(i){this.position=i,this.onPositionChange?.(i),this.notify()}setBubbleSize(i){this.bubbleSize.width===i.width&&this.bubbleSize.height===i.height||(this.bubbleSize=i,this.isDragging||this.reconcileBounds(),this.notify())}setScreenSize(i,t){this.screenWidth=i,this.screenHeight=t,this.reconcileBounds(),this.notify()}reconcileBounds(){const i=i=>({x:Math.max(this.minPosition.x,Math.min(i.x,this.screenWidth-this.bubbleSize.width-this.edgePadding)),y:Math.max(this.minPosition.y,Math.min(i.y,this.screenHeight-this.bubbleSize.height-this.edgePadding))}),t=i(this.position);this.position=this.isHidden?{...t,x:this.screenWidth-this.visibleHandleWidth}:t,this.savedPosition&&(this.savedPosition=i(this.savedPosition))}setMinPosition(i){this.minPosition=i}async savePosition(i,t){if(this.enablePositionPersistence&&this.storage)try{await Promise.all([this.storage.setItem(_constants.STORAGE_KEYS.POSITION_X,i.toString()),this.storage.setItem(_constants.STORAGE_KEYS.POSITION_Y,t.toString())])}catch{}}debouncedSavePosition(i,t){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.savePosition(i,t),_constants.SAVE_DEBOUNCE_MS)}toggleHideShow(){const i=this.position.x>this.screenWidth-this.bubbleSize.width/2;if(this.isHidden||i){let i,t;return this.savedPosition&&this.savedPosition.x<this.screenWidth-this.bubbleSize.width/2?(i=this.savedPosition.x,t=this.savedPosition.y):(i=this.screenWidth-this.bubbleSize.width-20,t=this.position.y),this.isHidden=!1,this.onHiddenChange?.(!1),this.notify(),{targetPosition:{x:i,y:t},isHiding:!1}}{this.savedPosition={...this.position};const i=this.screenWidth-this.visibleHandleWidth;return this.isHidden=!0,this.onHiddenChange?.(!0),this.notify(),{targetPosition:{x:i,y:this.position.y},isHiding:!0}}}forceHide(){if(this.isHidden)return{targetPosition:this.position};this.savedPosition={...this.position};const i=this.screenWidth-this.visibleHandleWidth;return this.isHidden=!0,this.onHiddenChange?.(!0),this.notify(),{targetPosition:{x:i,y:this.position.y}}}forceShow(){if(!this.isHidden)return{targetPosition:this.position};let i,t;return this.savedPosition?(i=this.savedPosition.x,t=this.savedPosition.y):(i=this.screenWidth-this.bubbleSize.width-20,t=this.position.y),this.isHidden=!1,this.onHiddenChange?.(!1),this.notify(),{targetPosition:{x:i,y:t}}}handleDragStart(i){this.hasMoved=!1,this.dragStartPos={...this.position},this.dragStartMouse={x:i.clientX,y:i.clientY}}handleDragMove(i){const t=i.clientX-this.dragStartMouse.x,s=i.clientY-this.dragStartMouse.y,e=Math.abs(t)+Math.abs(s);if(!this.hasMoved&&e>this.dragThreshold&&(this.hasMoved=!0,this.isDragging=!0,this.onDraggingChange?.(!0),this.notify()),this.hasMoved){const i=this.dragStartPos.x+t,e=this.dragStartPos.y+s,n=this.getBounds(),h=Math.max(n.minX,Math.min(i,this.screenWidth-this.visibleHandleWidth+this.bubbleSize.width)),o=Math.max(n.minY,Math.min(e,n.maxY));return this.position={x:h,y:o},this.onPositionChange?.(this.position),this.notify(),{position:this.position,isDragging:!0}}return{position:this.position,isDragging:!1}}handleDragEnd(i){if(!this.hasMoved)return this.isDragging=!1,this.onDraggingChange?.(!1),this.notify(),{position:this.position,shouldHide:!1,wasTap:!0};const t=i.clientX-this.dragStartMouse.x,s=i.clientY-this.dragStartMouse.y,e=this.dragStartPos.x+t,n=this.dragStartPos.y+s,h=e+this.bubbleSize.width/2>this.screenWidth,o=this.getBounds();if(h){const i=this.screenWidth-this.visibleHandleWidth,t=Math.max(o.minY,Math.min(n,o.maxY));return this.isHidden=!0,this.onHiddenChange?.(!0),this.isDragging=!1,this.onDraggingChange?.(!1),this.notify(),{position:{x:i,y:t},shouldHide:!0,wasTap:!1}}{this.isHidden&&e<this.screenWidth-this.visibleHandleWidth-10&&(this.isHidden=!1,this.onHiddenChange?.(!1));const i=Math.max(o.minX,Math.min(e,this.screenWidth-this.bubbleSize.width-this.edgePadding)),t=Math.max(o.minY,Math.min(n,o.maxY));return i<this.screenWidth-this.bubbleSize.width/2&&(this.savedPosition={x:i,y:t}),this.position={x:i,y:t},this.isDragging=!1,this.onDraggingChange?.(!1),this.debouncedSavePosition(i,t),this.notify(),{position:{x:i,y:t},shouldHide:!1,wasTap:!1}}}commitPosition(i){this.position=i,this.savePosition(i.x,i.y),this.notify()}destroy(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=null),this.listeners.clear()}}exports.FloatingToolsStore=FloatingToolsStore;
|
package/lib/commonjs/colors.js
CHANGED
|
@@ -1,54 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.floatingToolsColors = void 0;
|
|
7
|
-
exports.withAlpha = withAlpha;
|
|
8
|
-
/**
|
|
9
|
-
* Shared color palette for floating tools.
|
|
10
|
-
* Matches the gameUIColors from @buoy-gg/shared-ui.
|
|
11
|
-
*
|
|
12
|
-
* These are duplicated here to avoid requiring @buoy-gg/shared-ui
|
|
13
|
-
* as a dependency (which has React Native dependencies).
|
|
14
|
-
*
|
|
15
|
-
* TODO: Consider extracting colors to a truly platform-agnostic package
|
|
16
|
-
* that both shared-ui and floating-tools-core can depend on.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Buoy brand colors - EXACT values from web docs site dark theme
|
|
21
|
-
*/
|
|
22
|
-
const floatingToolsColors = exports.floatingToolsColors = {
|
|
23
|
-
/** Dark panel background */
|
|
24
|
-
panel: '#1A1A1A',
|
|
25
|
-
/** Muted gray for secondary elements */
|
|
26
|
-
muted: '#888888',
|
|
27
|
-
/** Primary text color */
|
|
28
|
-
secondary: '#E0E0E0',
|
|
29
|
-
/** Info/active state color (Buoy teal) */
|
|
30
|
-
info: '#20C997',
|
|
31
|
-
/** Success/admin color (Buoy teal) */
|
|
32
|
-
success: '#20C997',
|
|
33
|
-
/** Warning/optional color (Buoy orange) */
|
|
34
|
-
optional: '#FFA94D',
|
|
35
|
-
/** Error color (Buoy red) */
|
|
36
|
-
error: '#EF4444',
|
|
37
|
-
/** Primary accent color (Buoy teal) */
|
|
38
|
-
primary: '#20C997',
|
|
39
|
-
/** Color used when dragging the floating tools (Buoy teal) */
|
|
40
|
-
dragActive: '#20C997'
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Get a color with optional alpha.
|
|
44
|
-
* @param color - The base color (hex)
|
|
45
|
-
* @param alpha - Alpha value as hex string (00-FF) or number (0-1)
|
|
46
|
-
*/
|
|
47
|
-
function withAlpha(color, alpha) {
|
|
48
|
-
if (typeof alpha === 'number') {
|
|
49
|
-
// Convert 0-1 to hex
|
|
50
|
-
const hex = Math.round(alpha * 255).toString(16).padStart(2, '0');
|
|
51
|
-
return `${color}${hex}`;
|
|
52
|
-
}
|
|
53
|
-
return `${color}${alpha}`;
|
|
54
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.floatingToolsColors=void 0,exports.withAlpha=withAlpha;const floatingToolsColors=exports.floatingToolsColors={panel:"#1A1A1A",muted:"#888888",secondary:"#E0E0E0",info:"#20C997",success:"#20C997",optional:"#FFA94D",error:"#EF4444",primary:"#20C997",dragActive:"#20C997"};function withAlpha(o,t){return"number"==typeof t?`${o}${Math.round(255*t).toString(16).padStart(2,"0")}`:`${o}${t}`}
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VISIBLE_HANDLE_WIDTH = exports.STORAGE_KEYS = exports.SAVE_DEBOUNCE_MS = exports.EDGE_PADDING = exports.DRAG_THRESHOLD = exports.ANIMATION_DURATION = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Shared constants for floating tools behavior.
|
|
9
|
-
* These values ensure consistent behavior across platforms.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/** Width of the visible grip handle when bubble is hidden (pixels) */
|
|
13
|
-
const VISIBLE_HANDLE_WIDTH = exports.VISIBLE_HANDLE_WIDTH = 32;
|
|
14
|
-
|
|
15
|
-
/** Minimum movement to distinguish drag from tap (pixels) */
|
|
16
|
-
const DRAG_THRESHOLD = exports.DRAG_THRESHOLD = 5;
|
|
17
|
-
|
|
18
|
-
/** Animation duration for hide/show transitions (milliseconds) */
|
|
19
|
-
const ANIMATION_DURATION = exports.ANIMATION_DURATION = 200;
|
|
20
|
-
|
|
21
|
-
/** Padding from screen edges (pixels) */
|
|
22
|
-
const EDGE_PADDING = exports.EDGE_PADDING = 10;
|
|
23
|
-
|
|
24
|
-
/** Debounce delay for position persistence (milliseconds) */
|
|
25
|
-
const SAVE_DEBOUNCE_MS = exports.SAVE_DEBOUNCE_MS = 500;
|
|
26
|
-
|
|
27
|
-
/** Storage keys for position persistence */
|
|
28
|
-
const STORAGE_KEYS = exports.STORAGE_KEYS = {
|
|
29
|
-
POSITION_X: '@react_buoy_bubble_position_x',
|
|
30
|
-
POSITION_Y: '@react_buoy_bubble_position_y'
|
|
31
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VISIBLE_HANDLE_WIDTH=exports.STORAGE_KEYS=exports.SAVE_DEBOUNCE_MS=exports.EDGE_PADDING=exports.DRAG_THRESHOLD=exports.ANIMATION_DURATION=void 0;const VISIBLE_HANDLE_WIDTH=exports.VISIBLE_HANDLE_WIDTH=32,DRAG_THRESHOLD=exports.DRAG_THRESHOLD=5,ANIMATION_DURATION=exports.ANIMATION_DURATION=200,EDGE_PADDING=exports.EDGE_PADDING=10,SAVE_DEBOUNCE_MS=exports.SAVE_DEBOUNCE_MS=500,STORAGE_KEYS=exports.STORAGE_KEYS={POSITION_X:"@react_buoy_bubble_position_x",POSITION_Y:"@react_buoy_bubble_position_y"};
|