@accelint/map-toolkit 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/catalog-info.yaml +6 -3
- package/dist/camera/index.d.ts +2 -2
- package/dist/camera/index.js +2 -2
- package/dist/camera/store.d.ts +120 -0
- package/dist/camera/store.js +279 -0
- package/dist/camera/store.js.map +1 -0
- package/dist/deckgl/base-map/constants.d.ts +9 -7
- package/dist/deckgl/base-map/constants.js +9 -7
- package/dist/deckgl/base-map/constants.js.map +1 -1
- package/dist/deckgl/base-map/controls.js +2 -0
- package/dist/deckgl/base-map/controls.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +2 -0
- package/dist/deckgl/base-map/index.js +14 -16
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/provider.js +1 -1
- package/dist/deckgl/base-map/types.d.ts +6 -1
- package/dist/deckgl/index.d.ts +8 -2
- package/dist/deckgl/index.js +6 -2
- package/dist/deckgl/saved-viewports/index.d.ts +1 -1
- package/dist/deckgl/saved-viewports/index.js +1 -2
- package/dist/deckgl/saved-viewports/index.js.map +1 -1
- package/dist/deckgl/saved-viewports/storage.js +10 -2
- package/dist/deckgl/saved-viewports/storage.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/constants.js +58 -0
- package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js → deckgl/shapes/display-shape-layer/fiber.d.ts} +11 -7
- package/dist/{packages/hotkey-manager/dist/lib/is-client/index.js → deckgl/shapes/display-shape-layer/fiber.js} +6 -7
- package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/index.d.ts +210 -0
- package/dist/deckgl/shapes/display-shape-layer/index.js +449 -0
- package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +102 -0
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/store.js +102 -0
- package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/types.d.ts +126 -0
- package/dist/{node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/layer.js → deckgl/shapes/display-shape-layer/types.js} +0 -3
- package/dist/deckgl/shapes/display-shape-layer/use-select-shape.d.ts +89 -0
- package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js +88 -0
- package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +50 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +133 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +250 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/constants.js +46 -0
- package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +92 -0
- package/dist/deckgl/shapes/draw-shape-layer/events.js +56 -0
- package/dist/deckgl/shapes/draw-shape-layer/events.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/fiber.d.ts +11 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js → deckgl/shapes/draw-shape-layer/fiber.js} +5 -4
- package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +53 -0
- package/dist/deckgl/shapes/draw-shape-layer/index.js +95 -0
- package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +51 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +73 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +87 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +88 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +77 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +64 -0
- package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/store.js +175 -0
- package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +86 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fly-to-viewport.js → deckgl/shapes/draw-shape-layer/types.js} +1 -1
- package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +82 -0
- package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +112 -0
- package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js.map +1 -0
- package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +147 -0
- package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/constants.js +41 -0
- package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +92 -0
- package/dist/deckgl/shapes/edit-shape-layer/events.js +56 -0
- package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +13 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-viewport.js → deckgl/shapes/edit-shape-layer/fiber.js} +1 -3
- package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +63 -0
- package/dist/deckgl/shapes/edit-shape-layer/index.js +162 -0
- package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +154 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +147 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +87 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +61 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +109 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +289 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +121 -0
- package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/store.js +194 -0
- package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -0
- package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +93 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/normalize-viewport-props.js → deckgl/shapes/edit-shape-layer/types.js} +1 -1
- package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +82 -0
- package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +114 -0
- package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -0
- package/dist/deckgl/shapes/index.d.ts +29 -0
- package/dist/deckgl/shapes/index.js +27 -0
- package/dist/deckgl/shapes/shared/constants.d.ts +73 -0
- package/dist/deckgl/shapes/shared/constants.js +273 -0
- package/dist/deckgl/shapes/shared/constants.js.map +1 -0
- package/dist/deckgl/shapes/shared/events.d.ts +54 -0
- package/dist/{packages/hotkey-manager/dist/lib/is-mac/index.js → deckgl/shapes/shared/events.js} +10 -6
- package/dist/deckgl/shapes/shared/events.js.map +1 -0
- package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +84 -0
- package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -0
- package/dist/deckgl/shapes/shared/types.d.ts +317 -0
- package/dist/deckgl/shapes/shared/types.js +83 -0
- package/dist/deckgl/shapes/shared/types.js.map +1 -0
- package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +128 -0
- package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -0
- package/dist/deckgl/shapes/shared/utils/layer-config.js +50 -0
- package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -0
- package/dist/deckgl/shapes/shared/utils/mode-utils.js +113 -0
- package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -0
- package/dist/deckgl/shapes/shared/utils/pick-filtering.js +57 -0
- package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -0
- package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +64 -0
- package/dist/deckgl/shapes/shared/utils/style-utils.js +101 -0
- package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -0
- package/dist/deckgl/symbol-layer/index.d.ts +1 -1
- package/dist/deckgl/text-layer/default-settings.js +4 -24
- package/dist/deckgl/text-layer/default-settings.js.map +1 -1
- package/dist/deckgl/text-settings.d.ts +77 -0
- package/dist/deckgl/text-settings.js +83 -0
- package/dist/deckgl/text-settings.js.map +1 -0
- package/dist/map-cursor/index.d.ts +2 -2
- package/dist/map-cursor/index.js +2 -2
- package/dist/map-cursor/store.d.ts +32 -61
- package/dist/map-cursor/store.js +165 -294
- package/dist/map-cursor/store.js.map +1 -1
- package/dist/map-cursor/use-map-cursor.d.ts +5 -2
- package/dist/map-cursor/use-map-cursor.js +33 -15
- package/dist/map-cursor/use-map-cursor.js.map +1 -1
- package/dist/map-mode/index.d.ts +2 -2
- package/dist/map-mode/index.js +2 -2
- package/dist/map-mode/store.d.ts +36 -37
- package/dist/map-mode/store.js +131 -237
- package/dist/map-mode/store.js.map +1 -1
- package/dist/map-mode/use-map-mode.js +6 -5
- package/dist/map-mode/use-map-mode.js.map +1 -1
- package/dist/maplibre/index.d.ts +2 -2
- package/dist/maplibre/index.js +2 -2
- package/dist/shared/constants.d.ts +19 -0
- package/dist/{maplibre → shared}/constants.js +9 -3
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/create-map-store.d.ts +202 -0
- package/dist/shared/create-map-store.js +223 -0
- package/dist/shared/create-map-store.js.map +1 -0
- package/dist/shared/units.d.ts +39 -0
- package/dist/shared/units.js +49 -0
- package/dist/shared/units.js.map +1 -0
- package/dist/viewport/index.d.ts +3 -3
- package/dist/viewport/index.js +3 -3
- package/dist/viewport/store.d.ts +69 -0
- package/dist/viewport/store.js +125 -0
- package/dist/viewport/store.js.map +1 -0
- package/dist/viewport/types.d.ts +2 -2
- package/dist/viewport/utils.js +2 -2
- package/dist/viewport/utils.js.map +1 -1
- package/dist/viewport/viewport-size.js +2 -2
- package/dist/viewport/viewport-size.js.map +1 -1
- package/package.json +60 -26
- package/dist/_virtual/rolldown_runtime.js +0 -22
- package/dist/camera/use-camera-state.d.ts +0 -153
- package/dist/camera/use-camera-state.js +0 -419
- package/dist/camera/use-camera-state.js.map +0 -1
- package/dist/decorators/deckgl.d.ts +0 -19
- package/dist/decorators/deckgl.js +0 -32
- package/dist/decorators/deckgl.js.map +0 -1
- package/dist/maplibre/constants.d.ts +0 -13
- package/dist/maplibre/constants.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js +0 -63
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/index.js +0 -19
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js +0 -25
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js +0 -59
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +0 -54
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js +0 -91
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +0 -88
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +0 -69
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +0 -35
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/source.js +0 -15
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +0 -40
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +0 -23
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/index.js +0 -27
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +0 -57
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +0 -343
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +0 -28
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +0 -31
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +0 -57
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +0 -30
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +0 -53
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +0 -52
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +0 -22
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js +0 -812
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js.map +0 -1
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js +0 -35
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js +0 -195
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js +0 -76
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js +0 -39
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js.map +0 -1
- package/dist/node_modules/.pnpm/react-map-gl@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-map-gl/dist/maplibre.js +0 -16
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js +0 -27
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js.map +0 -1
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +0 -45
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js +0 -78
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/constants.js +0 -47
- package/dist/packages/hotkey-manager/dist/constants.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/enums/keycode.js +0 -130
- package/dist/packages/hotkey-manager/dist/enums/keycode.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/is-client/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js +0 -39
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js +0 -27
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js +0 -95
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js.map +0 -1
- package/dist/viewport/constants.d.ts +0 -11
- package/dist/viewport/constants.js +0 -25
- package/dist/viewport/constants.js.map +0 -1
- package/dist/viewport/use-viewport-state.d.ts +0 -100
- package/dist/viewport/use-viewport-state.js +0 -222
- package/dist/viewport/use-viewport-state.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["DEFAULT_CURSOR: CSSCursorType"],"sources":["../../src/map-cursor/store.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Broadcast } from '@accelint/bus';\nimport { MapModeEvents } from '../map-mode/events';\nimport { getCurrentModeOwner } from '../map-mode/store';\nimport { MapCursorEvents } from './events';\nimport type { UniqueId } from '@accelint/core';\nimport type { ModeChangedEvent } from '../map-mode/types';\nimport type { CSSCursorType, MapCursorEventType } from './types';\n\n/**\n * Default cursor value\n */\nconst DEFAULT_CURSOR: CSSCursorType = 'default';\n\n/**\n * Typed event bus instance for map cursor events.\n * Provides type-safe event emission and listening for all map cursor state changes.\n */\nconst mapCursorBus = Broadcast.getInstance<MapCursorEventType>();\n\n/**\n * Type representing the state for a single map cursor instance\n */\ntype MapCursorState = {\n /** Map of owner-to-cursor mappings */\n cursorOwners: Map<string, CSSCursorType>;\n /** Current active cursor */\n currentCursor: CSSCursorType | null;\n /** Current cursor owner */\n currentOwner: string | null;\n};\n\n/**\n * Store for map cursor state keyed by instanceId\n */\nconst cursorStore = new Map<UniqueId, MapCursorState>();\n\n/**\n * Track React component subscribers per instanceId (for fan-out notifications).\n * Each Set contains onStoreChange callbacks from useSyncExternalStore.\n */\nconst componentSubscribers = new Map<UniqueId, Set<() => void>>();\n\n/**\n * Cache of bus unsubscribe functions (1 per instanceId).\n * This ensures we only have one bus listener per map cursor instance, regardless of\n * how many React components subscribe to it.\n */\nconst busUnsubscribers = new Map<UniqueId, () => void>();\n\ntype Subscription = (onStoreChange: () => void) => () => void;\n/**\n * Cache of subscription functions per instanceId to avoid recreating on every render\n */\nconst subscriptionCache = new Map<UniqueId, Subscription>();\n\n/**\n * Cache of snapshot functions per instanceId to maintain referential stability\n */\nconst snapshotCache = new Map<UniqueId, () => CSSCursorType>();\n\n/**\n * Cache of server snapshot functions per instanceId to maintain referential stability.\n * Server snapshots always return default cursor since cursor state is client-only.\n */\nconst serverSnapshotCache = new Map<UniqueId, () => CSSCursorType>();\n\n/**\n * Cache of requestCursorChange functions per instanceId to maintain referential stability\n */\nconst requestCursorChangeCache = new Map<\n UniqueId,\n (cursor: CSSCursorType, owner: string) => void\n>();\n\n/**\n * Cache of clearCursor functions per instanceId to maintain referential stability\n */\nconst clearCursorCache = new Map<UniqueId, (owner: string) => void>();\n\n/**\n * All state caches that need cleanup when an instance is removed\n */\nconst stateCaches = [\n cursorStore,\n componentSubscribers,\n subscriptionCache,\n snapshotCache,\n serverSnapshotCache,\n requestCursorChangeCache,\n clearCursorCache,\n] as const;\n\n/**\n * Clear all cached state for a given instanceId\n */\nfunction clearAllCaches(instanceId: UniqueId): void {\n stateCaches.map((cache) => cache.delete(instanceId));\n}\n\n/**\n * Get or create cursor state for a given instanceId\n */\nfunction getOrCreateState(instanceId: UniqueId): MapCursorState {\n if (!cursorStore.has(instanceId)) {\n cursorStore.set(instanceId, {\n cursorOwners: new Map(),\n currentCursor: null,\n currentOwner: null,\n });\n }\n // biome-ignore lint/style/noNonNullAssertion: State guaranteed to exist after has() check above\n return cursorStore.get(instanceId)!;\n}\n\n/**\n * Get current cursor snapshot for a given instance (for useSyncExternalStore)\n *\n * Priority order:\n * 1. Mode owner's cursor (if exists and mode is owned)\n * 2. Most recent cursor (only if currentOwner still has an entry in storage)\n * 3. Default cursor\n */\nfunction getSnapshot(instanceId: UniqueId): CSSCursorType {\n const state = cursorStore.get(instanceId);\n if (!state) {\n return DEFAULT_CURSOR;\n }\n\n // Priority 1: Mode owner's cursor\n const modeOwner = getCurrentModeOwner(instanceId);\n if (modeOwner) {\n const modeOwnerCursor = state.cursorOwners.get(modeOwner);\n if (modeOwnerCursor) {\n return modeOwnerCursor;\n }\n }\n\n // Priority 2: Most recent cursor (only if owner entry still exists)\n if (state.currentCursor && state.currentOwner) {\n if (state.cursorOwners.has(state.currentOwner)) {\n return state.currentCursor;\n }\n }\n\n // Priority 3: Default cursor\n return DEFAULT_CURSOR;\n}\n\n/**\n * Notify all React subscribers for a given instanceId\n */\nfunction notifySubscribers(instanceId: UniqueId): void {\n const subscribers = componentSubscribers.get(instanceId);\n if (subscribers) {\n for (const onStoreChange of subscribers) {\n onStoreChange();\n }\n }\n}\n\n/**\n * Handle cursor change request for a given instance\n */\nfunction handleCursorChangeRequest(\n instanceId: UniqueId,\n state: MapCursorState,\n cursor: CSSCursorType,\n requestOwner: string,\n): void {\n const previousCursor = getSnapshot(instanceId);\n\n // Skip if same cursor is already stored for this owner\n if (state.cursorOwners.get(requestOwner) === cursor) {\n return;\n }\n\n // Store cursor for this owner\n state.cursorOwners.set(requestOwner, cursor);\n\n // Check if requester is the mode owner or if mode is ownerless\n const modeOwner = getCurrentModeOwner(instanceId);\n const isOwnerlessMode = !modeOwner;\n const isRequestOwnerModeOwner = requestOwner === modeOwner;\n\n // Grant or reject based on ownership\n if (isOwnerlessMode || isRequestOwnerModeOwner) {\n // Accept: store and apply cursor\n state.currentCursor = cursor;\n state.currentOwner = requestOwner;\n\n const newCursor = getSnapshot(instanceId);\n\n // Emit changed event only if cursor actually changed\n if (previousCursor !== newCursor) {\n mapCursorBus.emit(MapCursorEvents.changed, {\n previousCursor,\n currentCursor: newCursor,\n owner: requestOwner,\n id: instanceId,\n });\n notifySubscribers(instanceId);\n }\n } else {\n // Reject: stored for future auto-apply, but emit rejection event\n mapCursorBus.emit(MapCursorEvents.rejected, {\n rejectedCursor: cursor,\n rejectedOwner: requestOwner,\n currentOwner: state.currentOwner || modeOwner || 'unknown',\n reason: 'not-owner',\n id: instanceId,\n });\n }\n}\n\n/**\n * Ensures a single bus listener exists for the given instanceId.\n * All React subscribers will be notified via fan-out when the bus events fire.\n * This prevents creating N bus listeners for N React components.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n */\nfunction ensureBusListener(instanceId: UniqueId): void {\n if (busUnsubscribers.has(instanceId)) {\n return; // Already listening\n }\n\n const state = getOrCreateState(instanceId);\n\n // Listen for cursor change requests\n const unsubRequest = mapCursorBus.on(\n MapCursorEvents.changeRequest,\n (event) => {\n const { cursor, owner: requestOwner, id } = event.payload;\n if (id !== instanceId) {\n return;\n }\n handleCursorChangeRequest(instanceId, state, cursor, requestOwner);\n },\n );\n\n // Listen for mode changes\n const modeBus = Broadcast.getInstance<ModeChangedEvent>();\n const unsubModeChange = modeBus.on(MapModeEvents.changed, (event) => {\n if (event.payload.id !== instanceId) {\n return;\n }\n\n const previousCursor = getSnapshot(instanceId);\n\n // When mode changes, clear current cursor tracking (but keep owner's cursor in storage)\n // This allows the cursor to fall back to state-based default until a new owner sets it\n if (\n event.payload.currentMode === 'default' ||\n event.payload.previousMode !== event.payload.currentMode\n ) {\n state.currentCursor = null;\n state.currentOwner = null;\n notifySubscribers(instanceId);\n }\n\n // Defer cursor change check until after new mode owner is registered\n queueMicrotask(() => {\n const newCursor = getSnapshot(instanceId);\n if (previousCursor !== newCursor) {\n const newModeOwner = getCurrentModeOwner(instanceId) || 'system';\n mapCursorBus.emit(MapCursorEvents.changed, {\n previousCursor,\n currentCursor: newCursor,\n owner: newModeOwner,\n id: instanceId,\n });\n notifySubscribers(instanceId);\n }\n });\n });\n\n // Store composite cleanup function\n busUnsubscribers.set(instanceId, () => {\n unsubRequest();\n unsubModeChange();\n });\n}\n\n/**\n * Cleans up the bus listener if no React subscribers remain.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n */\nfunction cleanupBusListenerIfNeeded(instanceId: UniqueId): void {\n const subscribers = componentSubscribers.get(instanceId);\n\n if (!subscribers || subscribers.size === 0) {\n // No more React subscribers - clean up bus listener\n const unsub = busUnsubscribers.get(instanceId);\n if (unsub) {\n unsub();\n busUnsubscribers.delete(instanceId);\n }\n\n // Clean up all state\n clearAllCaches(instanceId);\n }\n}\n\n/**\n * Creates or retrieves a cached subscription function for a given instanceId.\n * Uses a fan-out pattern: 1 bus listener -> N React subscribers.\n * Automatically cleans up cursor state when the last subscriber unsubscribes.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n * @returns A subscription function for useSyncExternalStore\n */\nexport function getOrCreateSubscription(\n instanceId: UniqueId,\n): (onStoreChange: () => void) => () => void {\n const subscription =\n subscriptionCache.get(instanceId) ??\n ((onStoreChange: () => void) => {\n // Ensure state exists\n getOrCreateState(instanceId);\n\n // Ensure single bus listener exists for this instanceId\n ensureBusListener(instanceId);\n\n // Get or create the subscriber set for this map instance, then add this component's callback\n let subscriberSet = componentSubscribers.get(instanceId);\n if (!subscriberSet) {\n subscriberSet = new Set();\n componentSubscribers.set(instanceId, subscriberSet);\n }\n subscriberSet.add(onStoreChange);\n\n // Return cleanup function to remove this component's subscription\n return () => {\n const currentSubscriberSet = componentSubscribers.get(instanceId);\n if (currentSubscriberSet) {\n currentSubscriberSet.delete(onStoreChange);\n }\n\n // Clean up bus listener if this was the last React subscriber\n cleanupBusListenerIfNeeded(instanceId);\n };\n });\n\n subscriptionCache.set(instanceId, subscription);\n\n return subscription;\n}\n\n/**\n * Creates or retrieves a cached snapshot function for a given instanceId.\n * The cursor returned gets equality checked, so it needs to be stable or React re-renders unnecessarily.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n * @returns A snapshot function for useSyncExternalStore\n */\nexport function getOrCreateSnapshot(instanceId: UniqueId): () => CSSCursorType {\n const snapshot =\n snapshotCache.get(instanceId) ?? (() => getSnapshot(instanceId));\n\n snapshotCache.set(instanceId, snapshot);\n\n return snapshot;\n}\n\n/**\n * Creates or retrieves a cached server snapshot function for a given instanceId.\n * Server snapshots always return the default cursor since cursor state is client-only.\n * Required for SSR/RSC compatibility with useSyncExternalStore.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n * @returns A server snapshot function for useSyncExternalStore\n */\nexport function getOrCreateServerSnapshot(\n instanceId: UniqueId,\n): () => CSSCursorType {\n const serverSnapshot =\n serverSnapshotCache.get(instanceId) ?? (() => DEFAULT_CURSOR);\n\n serverSnapshotCache.set(instanceId, serverSnapshot);\n\n return serverSnapshot;\n}\n\n/**\n * Creates or retrieves a cached requestCursorChange function for a given instanceId.\n * This maintains referential stability for the function reference.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n * @returns A requestCursorChange function for this instance\n */\nexport function getOrCreateRequestCursorChange(\n instanceId: UniqueId,\n): (cursor: CSSCursorType, owner: string) => void {\n const requestCursorChange =\n requestCursorChangeCache.get(instanceId) ??\n ((cursor: CSSCursorType, owner: string) => {\n const trimmedCursor = cursor.trim();\n const trimmedOwner = owner.trim();\n\n if (!trimmedCursor) {\n throw new Error('requestCursorChange requires non-empty cursor');\n }\n if (!trimmedOwner) {\n throw new Error('requestCursorChange requires non-empty owner');\n }\n\n mapCursorBus.emit(MapCursorEvents.changeRequest, {\n cursor: trimmedCursor as CSSCursorType,\n owner: trimmedOwner,\n id: instanceId,\n });\n });\n\n requestCursorChangeCache.set(instanceId, requestCursorChange);\n\n return requestCursorChange;\n}\n\n/**\n * Creates or retrieves a cached clearCursor function for a given instanceId.\n * This maintains referential stability for the function reference.\n *\n * @param instanceId - The unique identifier for the map cursor instance\n * @returns A clearCursor function for this instance\n */\nexport function getOrCreateClearCursor(\n instanceId: UniqueId,\n): (owner: string) => void {\n const clearCursor =\n clearCursorCache.get(instanceId) ??\n ((owner: string) => {\n const state = cursorStore.get(instanceId);\n if (!state) {\n return;\n }\n\n const hadCursor = state.cursorOwners.has(owner);\n state.cursorOwners.delete(owner);\n\n // If this was the current owner, clear current tracking\n if (state.currentOwner === owner) {\n state.currentCursor = null;\n state.currentOwner = null;\n }\n\n // Only notify if cursor changed\n if (hadCursor) {\n notifySubscribers(instanceId);\n }\n });\n\n clearCursorCache.set(instanceId, clearCursor);\n\n return clearCursor;\n}\n\n/**\n * Get the current cursor for a given instance (direct access, not reactive).\n * @internal - For internal map-toolkit use only\n *\n * @param instanceId - The unique identifier for the map instance\n * @returns The current cursor\n */\nexport function getCursor(instanceId: UniqueId): CSSCursorType {\n return getSnapshot(instanceId);\n}\n\n/**\n * Manually clear all cursor state for a specific instanceId.\n * This is typically not needed as cleanup happens automatically when all subscribers unmount.\n * Use this only in advanced scenarios where manual cleanup is required.\n *\n * @param instanceId - The unique identifier for the map cursor instance to clear\n *\n * @example\n * ```tsx\n * // Manual cleanup (rarely needed)\n * clearCursorState('my-map-instance');\n * ```\n */\nexport function clearCursorState(instanceId: UniqueId): void {\n // Unsubscribe from bus if listening\n const unsub = busUnsubscribers.get(instanceId);\n if (unsub) {\n unsub();\n busUnsubscribers.delete(instanceId);\n }\n\n // Clear all state\n clearAllCaches(instanceId);\n}\n\n// Legacy API compatibility (for tests and existing code)\n/** @deprecated Use module functions directly */\nexport function getOrCreateStore(id: UniqueId): {\n getSnapshot: () => CSSCursorType;\n} {\n return {\n getSnapshot: () => getSnapshot(id),\n };\n}\n\n/** @deprecated Use clearCursorState instead */\nexport function destroyStore(id: UniqueId): void {\n clearCursorState(id);\n}\n\n/** @deprecated Use direct function calls instead */\nexport function getStore(\n id: UniqueId,\n): { getSnapshot: () => CSSCursorType } | undefined {\n // Always return a store object since we don't track \"existence\" anymore\n return {\n getSnapshot: () => getSnapshot(id),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,iBAAgC;;;;;AAMtC,MAAM,eAAe,UAAU,aAAiC;;;;AAiBhE,MAAM,8BAAc,IAAI,KAA+B;;;;;AAMvD,MAAM,uCAAuB,IAAI,KAAgC;;;;;;AAOjE,MAAM,mCAAmB,IAAI,KAA2B;;;;AAMxD,MAAM,oCAAoB,IAAI,KAA6B;;;;AAK3D,MAAM,gCAAgB,IAAI,KAAoC;;;;;AAM9D,MAAM,sCAAsB,IAAI,KAAoC;;;;AAKpE,MAAM,2CAA2B,IAAI,KAGlC;;;;AAKH,MAAM,mCAAmB,IAAI,KAAwC;;;;AAKrE,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AAKD,SAAS,eAAe,YAA4B;AAClD,aAAY,KAAK,UAAU,MAAM,OAAO,WAAW,CAAC;;;;;AAMtD,SAAS,iBAAiB,YAAsC;AAC9D,KAAI,CAAC,YAAY,IAAI,WAAW,CAC9B,aAAY,IAAI,YAAY;EAC1B,8BAAc,IAAI,KAAK;EACvB,eAAe;EACf,cAAc;EACf,CAAC;AAGJ,QAAO,YAAY,IAAI,WAAW;;;;;;;;;;AAWpC,SAAS,YAAY,YAA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KAAI,OAAO;AACT,SAAO;AACP,mBAAiB,OAAO,WAAW;;AAIrC,gBAAe,WAAW;;;AAK5B,SAAgB,iBAAiB,IAE/B;AACA,QAAO,EACL,mBAAmB,YAAY,GAAG,EACnC;;;AAIH,SAAgB,aAAa,IAAoB;AAC/C,kBAAiB,GAAG;;;AAItB,SAAgB,SACd,IACkD;AAElD,QAAO,EACL,mBAAmB,YAAY,GAAG,EACnC"}
|
|
1
|
+
{"version":3,"file":"store.js","names":["DEFAULT_CURSOR: CSSCursorType","getModeOwnerFn: ((mapId: UniqueId) => string | undefined) | null","isRegisteredModeOwnerFn:\n | ((mapId: UniqueId, owner: string) => boolean)\n | null","importPromise: Promise<void> | null","updates: Partial<CursorState>","newState: CursorState"],"sources":["../../src/map-cursor/store.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Map Cursor Store\n *\n * Manages cursor state with ownership-based priority.\n *\n * Priority order:\n * 1. Mode owner's cursor (if mode is owned)\n * 2. Most recent cursor request\n * 3. Default cursor\n *\n * @example\n * ```tsx\n * import { cursorStore } from '@accelint/map-toolkit/map-cursor';\n *\n * function MapContainer({ mapId }) {\n * const cursor = cursorStore.useSelector(mapId, (s) => getEffectiveCursor(mapId, s));\n * return <div style={{ cursor }}>...</div>;\n * }\n *\n * // Request cursor change from a layer:\n * cursorStore.actions(mapId).requestCursorChange('crosshair', 'draw-layer');\n * ```\n */\n\nimport { Broadcast } from '@accelint/bus';\nimport { MapModeEvents } from '../map-mode/events';\nimport { createMapStore, mapDelete, mapSet } from '../shared/create-map-store';\nimport { MapCursorEvents } from './events';\nimport type { UniqueId } from '@accelint/core';\nimport type { ModeChangedEvent } from '../map-mode/types';\nimport type { CSSCursorType, MapCursorEventType } from './types';\n\nconst DEFAULT_CURSOR: CSSCursorType = 'default';\n\n/**\n * State shape for map cursor\n */\ntype CursorState = {\n /** Map of owner -> cursor */\n cursorOwners: Map<string, CSSCursorType>;\n /** Current active cursor (for priority tracking) */\n currentCursor: CSSCursorType | null;\n /** Current cursor owner (for priority tracking) */\n currentOwner: string | null;\n};\n\n/**\n * Actions for cursor management\n */\ntype CursorActions = {\n /** Request a cursor change */\n requestCursorChange: (cursor: CSSCursorType, owner: string) => void;\n /** Clear cursor for an owner */\n clearCursor: (owner: string) => void;\n};\n\nconst cursorBus = Broadcast.getInstance<MapCursorEventType>();\nconst modeBus = Broadcast.getInstance<ModeChangedEvent>();\n\n/**\n * Lazy import to avoid circular dependency between cursor and mode stores.\n * The mode store doesn't depend on cursor store, but importing it synchronously\n * at module load time can cause initialization order issues.\n *\n * This pattern ensures the import is resolved before first use (bus listeners\n * are set up on first subscriber, not at module load time).\n */\nlet getModeOwnerFn: ((mapId: UniqueId) => string | undefined) | null = null;\nlet isRegisteredModeOwnerFn:\n | ((mapId: UniqueId, owner: string) => boolean)\n | null = null;\nlet importPromise: Promise<void> | null = null;\nlet importFailed = false;\n\nfunction ensureModeStoreImported(): void {\n if (getModeOwnerFn !== null || importFailed) {\n return;\n }\n if (importPromise === null) {\n importPromise = import('../map-mode/store')\n .then((mod) => {\n getModeOwnerFn = mod.getCurrentModeOwner;\n isRegisteredModeOwnerFn = mod.isRegisteredModeOwner;\n })\n .catch((error) => {\n importFailed = true;\n // Log error in development only - in production this is a silent fallback\n if (process.env.NODE_ENV !== 'production') {\n console.error('[MapCursor] Failed to import mode store:', error);\n }\n });\n }\n}\n\n// Start the import immediately so it's likely resolved by first use\nensureModeStoreImported();\n\nfunction getModeOwner(mapId: UniqueId): string | undefined {\n // getModeOwnerFn will be available by the time bus listeners are set up\n // (which happens on first React subscriber, not at module load)\n return getModeOwnerFn?.(mapId);\n}\n\nfunction isRegisteredOwner(mapId: UniqueId, owner: string): boolean {\n return isRegisteredModeOwnerFn?.(mapId, owner) ?? false;\n}\n\n/**\n * Calculate effective cursor based on priority\n */\nfunction getEffectiveCursor(\n mapId: UniqueId,\n state: CursorState,\n): CSSCursorType {\n // Priority 1: Mode owner's cursor\n const modeOwner = getModeOwner?.(mapId);\n if (modeOwner) {\n const modeOwnerCursor = state.cursorOwners.get(modeOwner);\n if (modeOwnerCursor) {\n return modeOwnerCursor;\n }\n }\n\n // Priority 2: Current cursor (if owner still has entry)\n if (state.currentCursor && state.currentOwner) {\n if (state.cursorOwners.has(state.currentOwner)) {\n return state.currentCursor;\n }\n }\n\n // Priority 3: Default\n return DEFAULT_CURSOR;\n}\n\n/**\n * Cursor store\n */\nexport const cursorStore = createMapStore<CursorState, CursorActions>({\n defaultState: {\n cursorOwners: new Map(),\n currentCursor: null,\n currentOwner: null,\n },\n\n actions: (mapId, { get, set }) => ({\n requestCursorChange: (cursor: CSSCursorType, owner: string) => {\n const trimmedCursor = cursor.trim() as CSSCursorType;\n const trimmedOwner = owner.trim();\n\n if (!trimmedCursor) {\n throw new Error('requestCursorChange requires non-empty cursor');\n }\n if (!trimmedOwner) {\n throw new Error('requestCursorChange requires non-empty owner');\n }\n\n cursorBus.emit(MapCursorEvents.changeRequest, {\n cursor: trimmedCursor,\n owner: trimmedOwner,\n id: mapId,\n });\n },\n\n clearCursor: (owner: string) => {\n const state = get();\n const hadCursor = state.cursorOwners.has(owner);\n\n if (hadCursor) {\n // Clear current tracking if this was the owner\n const updates: Partial<CursorState> = {\n cursorOwners: mapDelete(state.cursorOwners, owner),\n };\n if (state.currentOwner === owner) {\n updates.currentCursor = null;\n updates.currentOwner = null;\n }\n\n set(updates);\n }\n },\n }),\n\n bus: (mapId, { get, set }) => {\n // Handle cursor change requests\n const unsubRequest = cursorBus.on(\n MapCursorEvents.changeRequest,\n (event) => {\n const { cursor, owner: requestOwner, id } = event.payload;\n if (id !== mapId) {\n return;\n }\n\n const state = get();\n const previousCursor = getEffectiveCursor(mapId, state);\n\n // Skip if same cursor already stored for this owner\n if (state.cursorOwners.get(requestOwner) === cursor) {\n return;\n }\n\n // Create new Map for immutable update\n const newCursorOwners = mapSet(\n state.cursorOwners,\n requestOwner,\n cursor,\n );\n\n // Check ownership\n const currentModeOwner = getModeOwner?.(mapId);\n const isOwnerless = !currentModeOwner;\n const isCurrentModeOwner = requestOwner === currentModeOwner;\n const isAnyModeOwner = isRegisteredOwner(mapId, requestOwner);\n\n if (isOwnerless || isCurrentModeOwner) {\n // Accept: apply cursor with immutable update\n const newState: CursorState = {\n cursorOwners: newCursorOwners,\n currentCursor: cursor,\n currentOwner: requestOwner,\n };\n\n // Calculate new cursor with updated state\n const newCursor = getEffectiveCursor(mapId, newState);\n\n if (previousCursor !== newCursor) {\n set(newState);\n cursorBus.emit(MapCursorEvents.changed, {\n previousCursor,\n currentCursor: newCursor,\n owner: requestOwner,\n id: mapId,\n });\n } else {\n // Still need to update state even if cursor didn't change visually\n set(newState);\n }\n } else if (isAnyModeOwner) {\n // Store but don't apply: requester owns a different mode (pending or not current).\n // When their mode becomes active, getEffectiveCursor will find their cursor.\n set({ cursorOwners: newCursorOwners });\n\n cursorBus.emit(MapCursorEvents.rejected, {\n rejectedCursor: cursor,\n rejectedOwner: requestOwner,\n currentOwner: state.currentOwner || currentModeOwner || 'unknown',\n reason: 'not-current-owner',\n id: mapId,\n });\n } else {\n // Reject: don't store. Non-owners should only set cursor in default mode.\n cursorBus.emit(MapCursorEvents.rejected, {\n rejectedCursor: cursor,\n rejectedOwner: requestOwner,\n currentOwner: state.currentOwner || currentModeOwner || 'unknown',\n reason: 'not-owner',\n id: mapId,\n });\n }\n },\n );\n\n // Handle mode changes\n const unsubMode = modeBus.on(MapModeEvents.changed, (event) => {\n if (event.payload.id !== mapId) {\n return;\n }\n\n const state = get();\n const previousCursor = getEffectiveCursor(mapId, state);\n\n // Clear current tracking on mode change with immutable update\n if (\n event.payload.currentMode === 'default' ||\n event.payload.previousMode !== event.payload.currentMode\n ) {\n set({\n currentCursor: null,\n currentOwner: null,\n });\n }\n\n // Defer check until new mode owner is registered\n queueMicrotask(() => {\n // Re-get state after microtask since it may have changed\n const currentState = get();\n const newCursor = getEffectiveCursor(mapId, currentState);\n if (previousCursor !== newCursor) {\n const newModeOwner = getModeOwner?.(mapId) || 'system';\n cursorBus.emit(MapCursorEvents.changed, {\n previousCursor,\n currentCursor: newCursor,\n owner: newModeOwner,\n id: mapId,\n });\n }\n });\n });\n\n return () => {\n unsubRequest();\n unsubMode();\n };\n },\n});\n\n// =============================================================================\n// Convenience exports\n// =============================================================================\n\n/**\n * Get effective cursor (computed from state)\n */\nexport function getCursor(mapId: UniqueId): CSSCursorType {\n return getEffectiveCursor(mapId, cursorStore.get(mapId));\n}\n\n/**\n * Hook for effective cursor value.\n *\n * **Internal use only** - not exported from the public API.\n * Use `useMapCursor` instead, which provides:\n * - MapContext integration (auto-resolves mapId inside MapProvider)\n * - Actions (requestCursorChange, clearCursor)\n * - Better ergonomics for consumers\n *\n * This hook exists for internal composition (used by useMapCursor).\n */\nexport function useCursor(mapId: UniqueId): CSSCursorType {\n return cursorStore.useSelector(mapId, (state) =>\n getEffectiveCursor(mapId, state),\n );\n}\n\n/**\n * Clear cursor state\n */\nexport function clearCursorState(mapId: UniqueId): void {\n cursorStore.clear(mapId);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAMA,iBAAgC;AAwBtC,MAAM,YAAY,UAAU,aAAiC;AAC7D,MAAM,UAAU,UAAU,aAA+B;;;;;;;;;AAUzD,IAAIC,iBAAmE;AACvE,IAAIC,0BAEO;AACX,IAAIC,gBAAsC;AAC1C,IAAI,eAAe;AAEnB,SAAS,0BAAgC;AACvC,KAAI,mBAAmB,QAAQ,aAC7B;AAEF,KAAI,kBAA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AgB,aAC9B,MAAM,QAAQ,iBAAiB,MAAM,QAAQ,YAE7C,KAAI;IACF,eAAe;IACf,cAAc;IACf,CAAC;AAIJ,wBAAqB;IAGnB,MAAM,YAAY,mBAAmB,OADhB,KAAK,CAC+B;AACzD,QAAI,mBAAmB,WAAW;KAChC,MAAM,eAAe,eAAe,MAAM,IAAI;AAC9C,eAAU,KAAK,gBAAgB,SAAS;MACtC;MACA,eAAe;MACf,OAAO;MACP,IAAI;MACL,CAAC;;KAEJ;IACF;AAEF,eAAa;AACX,iBAAc;AACd,cAAW;;;CAGhB,CAAC;;;;AASF,SAAgB,UAAU,OAAgC;AACxD,QAAO,mBAAmB,OAAO,YAAY,IAAI,MAAM,CAAC;;;;;;;;;;;;;AAc1D,SAAgB,UAAU,OAAgC;AACxD,QAAO,YAAY,YAAY,QAAQ,UACrC,mBAAmB,OAAO,MAAM,CACjC;;;;;AAMH,SAAgB,iBAAiB,OAAuB;AACtD,aAAY,MAAM,MAAM"}
|
|
@@ -80,7 +80,10 @@ declare function useMapCursor(id?: UniqueId): UseMapCursorReturn;
|
|
|
80
80
|
* This hook automatically requests a cursor when mounted and clears it when unmounted.
|
|
81
81
|
* Useful for components that need to consistently show a specific cursor.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
83
|
+
* NOTE: This hook does NOT re-render when cursor state changes. If you need to read
|
|
84
|
+
* the current cursor value, use `useMapCursor` instead.
|
|
85
|
+
*
|
|
86
|
+
* @param cursorType - The cursor to request
|
|
84
87
|
* @param owner - The owner identifier
|
|
85
88
|
* @param id - Optional map instance ID
|
|
86
89
|
*
|
|
@@ -93,7 +96,7 @@ declare function useMapCursor(id?: UniqueId): UseMapCursorReturn;
|
|
|
93
96
|
* }
|
|
94
97
|
* ```
|
|
95
98
|
*/
|
|
96
|
-
declare function useMapCursorEffect(
|
|
99
|
+
declare function useMapCursorEffect(cursorType: CSSCursorType, owner: string, id?: UniqueId): void;
|
|
97
100
|
//#endregion
|
|
98
101
|
export { UseMapCursorReturn, useMapCursor, useMapCursorEffect };
|
|
99
102
|
//# sourceMappingURL=use-map-cursor.d.ts.map
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
'use client';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { cursorStore, useCursor } from "./store.js";
|
|
17
17
|
import { MapContext } from "../deckgl/base-map/provider.js";
|
|
18
|
-
import { useContext, useEffect, useMemo,
|
|
18
|
+
import { useContext, useEffect, useMemo, useRef } from "react";
|
|
19
19
|
|
|
20
20
|
//#region src/map-cursor/use-map-cursor.ts
|
|
21
21
|
/**
|
|
@@ -70,12 +70,13 @@ function useMapCursor(id) {
|
|
|
70
70
|
const contextId = useContext(MapContext);
|
|
71
71
|
const actualId = id ?? contextId;
|
|
72
72
|
if (!actualId) throw new Error("useMapCursor requires either an id parameter or to be used within a MapProvider");
|
|
73
|
-
const cursor =
|
|
73
|
+
const cursor = useCursor(actualId);
|
|
74
|
+
const actions = useMemo(() => cursorStore.actions(actualId), [actualId]);
|
|
74
75
|
return useMemo(() => ({
|
|
75
76
|
cursor,
|
|
76
|
-
requestCursorChange:
|
|
77
|
-
clearCursor:
|
|
78
|
-
}), [cursor,
|
|
77
|
+
requestCursorChange: actions.requestCursorChange,
|
|
78
|
+
clearCursor: actions.clearCursor
|
|
79
|
+
}), [cursor, actions]);
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* Hook to automatically manage cursor for a component's lifecycle.
|
|
@@ -83,7 +84,10 @@ function useMapCursor(id) {
|
|
|
83
84
|
* This hook automatically requests a cursor when mounted and clears it when unmounted.
|
|
84
85
|
* Useful for components that need to consistently show a specific cursor.
|
|
85
86
|
*
|
|
86
|
-
*
|
|
87
|
+
* NOTE: This hook does NOT re-render when cursor state changes. If you need to read
|
|
88
|
+
* the current cursor value, use `useMapCursor` instead.
|
|
89
|
+
*
|
|
90
|
+
* @param cursorType - The cursor to request
|
|
87
91
|
* @param owner - The owner identifier
|
|
88
92
|
* @param id - Optional map instance ID
|
|
89
93
|
*
|
|
@@ -96,18 +100,32 @@ function useMapCursor(id) {
|
|
|
96
100
|
* }
|
|
97
101
|
* ```
|
|
98
102
|
*/
|
|
99
|
-
function useMapCursorEffect(
|
|
100
|
-
const
|
|
103
|
+
function useMapCursorEffect(cursorType, owner, id) {
|
|
104
|
+
const contextId = useContext(MapContext);
|
|
105
|
+
const actualId = id ?? contextId;
|
|
106
|
+
if (!actualId) throw new Error("useMapCursorEffect requires either an id parameter or to be used within a MapProvider");
|
|
107
|
+
const cursorRef = useRef(cursorType);
|
|
108
|
+
const ownerRef = useRef(owner);
|
|
109
|
+
const idRef = useRef(actualId);
|
|
110
|
+
cursorRef.current = cursorType;
|
|
111
|
+
ownerRef.current = owner;
|
|
112
|
+
idRef.current = actualId;
|
|
101
113
|
useEffect(() => {
|
|
102
|
-
|
|
114
|
+
const mapId = idRef.current;
|
|
115
|
+
const unsubscribe = cursorStore.subscribe(mapId)(() => {});
|
|
103
116
|
return () => {
|
|
104
|
-
|
|
117
|
+
unsubscribe();
|
|
118
|
+
queueMicrotask(() => {
|
|
119
|
+
cursorStore.actions(idRef.current).clearCursor(ownerRef.current);
|
|
120
|
+
});
|
|
105
121
|
};
|
|
122
|
+
}, []);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
cursorStore.actions(actualId).requestCursorChange(cursorType, owner);
|
|
106
125
|
}, [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
clearCursor
|
|
126
|
+
actualId,
|
|
127
|
+
cursorType,
|
|
128
|
+
owner
|
|
111
129
|
]);
|
|
112
130
|
}
|
|
113
131
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-map-cursor.js","names":[],"sources":["../../src/map-cursor/use-map-cursor.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { useContext, useEffect, useMemo,
|
|
1
|
+
{"version":3,"file":"use-map-cursor.js","names":[],"sources":["../../src/map-cursor/use-map-cursor.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { useContext, useEffect, useMemo, useRef } from 'react';\nimport { MapContext } from '../deckgl/base-map/provider';\nimport { cursorStore, useCursor } from './store';\nimport type { UniqueId } from '@accelint/core';\nimport type { CSSCursorType } from './types';\n\n/**\n * Return value for the useMapCursor hook\n */\nexport type UseMapCursorReturn = {\n /** The current active cursor */\n cursor: CSSCursorType;\n /** Function to request a cursor change with ownership */\n requestCursorChange: (cursor: CSSCursorType, requestOwner: string) => void;\n /** Function to clear cursor for an owner */\n clearCursor: (owner: string) => void;\n};\n\n/**\n * Hook to access the map cursor state and actions.\n *\n * This hook uses `useSyncExternalStore` to subscribe to map cursor state changes,\n * providing concurrent-safe cursor state updates. Uses a fan-out pattern where\n * a single bus listener per map instance notifies N React component subscribers.\n *\n * **Owner-based Priority System:**\n * - Mode owners (from MapModeStore) have highest priority\n * - Non-owners can set cursors only in default/ownerless modes\n * - Rejected requests emit events with rejection reasons\n *\n * @param id - Optional map instance ID. If not provided, will use the ID from `MapContext`.\n * @returns The current cursor, requestCursorChange function, and clearCursor function\n * @throws Error if no `id` is provided and hook is used outside of `MapProvider`\n *\n * @example\n * ```tsx\n * // Inside MapProvider (within BaseMap children)\n * function CustomDeckLayer() {\n * const { cursor, requestCursorChange, clearCursor } = useMapCursor();\n *\n * const handleHover = (info: PickingInfo) => {\n * if (info.object) {\n * requestCursorChange('pointer', 'custom-layer-id');\n * } else {\n * clearCursor('custom-layer-id');\n * }\n * };\n *\n * return <ScatterplotLayer onHover={handleHover} />;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Outside MapProvider - pass id directly\n * function ExternalControl({ mapId }: { mapId: UniqueId }) {\n * const { cursor, requestCursorChange } = useMapCursor(mapId);\n *\n * return (\n * <button onClick={() => requestCursorChange('crosshair', 'external-control')}>\n * Set Crosshair (current: {cursor})\n * </button>\n * );\n * }\n * ```\n */\nexport function useMapCursor(id?: UniqueId): UseMapCursorReturn {\n const contextId = useContext(MapContext);\n const actualId = id ?? contextId;\n\n if (!actualId) {\n throw new Error(\n 'useMapCursor requires either an id parameter or to be used within a MapProvider',\n );\n }\n\n // Use the useCursor hook which computes effective cursor with priority\n const cursor = useCursor(actualId);\n\n // Get actions from the store - cursorStore.actions returns stable references\n // (cached per mapId), so we can memoize on actualId only\n const actions = useMemo(() => cursorStore.actions(actualId), [actualId]);\n\n // Memoize the return value to prevent unnecessary re-renders\n return useMemo(\n () => ({\n cursor,\n requestCursorChange: actions.requestCursorChange,\n clearCursor: actions.clearCursor,\n }),\n [cursor, actions],\n );\n}\n\n/**\n * Hook to automatically manage cursor for a component's lifecycle.\n *\n * This hook automatically requests a cursor when mounted and clears it when unmounted.\n * Useful for components that need to consistently show a specific cursor.\n *\n * NOTE: This hook does NOT re-render when cursor state changes. If you need to read\n * the current cursor value, use `useMapCursor` instead.\n *\n * @param cursorType - The cursor to request\n * @param owner - The owner identifier\n * @param id - Optional map instance ID\n *\n * @example\n * ```tsx\n * function DrawingMode() {\n * useMapCursorEffect('crosshair', 'drawing-mode');\n *\n * return <div>Drawing mode active with crosshair cursor</div>;\n * }\n * ```\n */\nexport function useMapCursorEffect(\n cursorType: CSSCursorType,\n owner: string,\n id?: UniqueId,\n): void {\n const contextId = useContext(MapContext);\n const actualId = id ?? contextId;\n\n if (!actualId) {\n throw new Error(\n 'useMapCursorEffect requires either an id parameter or to be used within a MapProvider',\n );\n }\n\n // Store values in refs for stable cleanup function access\n const cursorRef = useRef(cursorType);\n const ownerRef = useRef(owner);\n const idRef = useRef(actualId);\n\n // Update refs on each render\n cursorRef.current = cursorType;\n ownerRef.current = owner;\n idRef.current = actualId;\n\n // Subscribe to store (to ensure bus listeners are set up) on mount only\n useEffect(() => {\n const mapId = idRef.current;\n\n // Subscribe to store to ensure bus listeners are set up\n // The subscription callback is a no-op since we don't want to re-render\n const unsubscribe = cursorStore.subscribe(mapId)(() => {\n // No-op: we don't want cursor state changes to trigger re-renders\n });\n\n return () => {\n // Unsubscribe first to prevent re-render loops\n unsubscribe();\n\n // IMPORTANT: Defer cursor clear using queueMicrotask to avoid the React error:\n // \"Cannot update a component while rendering a different component\"\n //\n // Effect cleanup runs during React's commit phase. If clearCursor() triggers\n // a state update synchronously (via store.set() -> notify subscribers), it can\n // cause React to attempt re-rendering while still committing the current tree.\n //\n // queueMicrotask schedules the cleanup to run after the current commit phase\n // completes, allowing React to finish its work before the state update occurs.\n queueMicrotask(() => {\n const cleanupActions = cursorStore.actions(idRef.current);\n cleanupActions.clearCursor(ownerRef.current);\n });\n };\n }, []);\n\n // Request cursor when cursorType or owner changes\n useEffect(() => {\n const actions = cursorStore.actions(actualId);\n actions.requestCursorChange(cursorType, owner);\n }, [actualId, cursorType, owner]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,SAAgB,aAAa,IAAmC;CAC9D,MAAM,YAAY,WAAW,WAAW;CACxC,MAAM,WAAW,MAAM;AAEvB,KAAI,CAAC,SACH,OAAM,IAAI,MACR,kFACD;CAIH,MAAM,SAAS,UAAU,SAAS;CAIlC,MAAM,UAAU,cAAc,YAAY,QAAQ,SAAS,EAAE,CAAC,SAAS,CAAC;AAGxE,QAAO,eACE;EACL;EACA,qBAAqB,QAAQ;EAC7B,aAAa,QAAQ;EACtB,GACD,CAAC,QAAQ,QAAQ,CAClB;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,mBACd,YACA,OACA,IACM;CACN,MAAM,YAAY,WAAW,WAAW;CACxC,MAAM,WAAW,MAAM;AAEvB,KAAI,CAAC,SACH,OAAM,IAAI,MACR,wFACD;CAIH,MAAM,YAAY,OAAO,WAAW;CACpC,MAAM,WAAW,OAAO,MAAM;CAC9B,MAAM,QAAQ,OAAO,SAAS;AAG9B,WAAU,UAAU;AACpB,UAAS,UAAU;AACnB,OAAM,UAAU;AAGhB,iBAAgB;EACd,MAAM,QAAQ,MAAM;EAIpB,MAAM,cAAc,YAAY,UAAU,MAAM,OAAO,GAErD;AAEF,eAAa;AAEX,gBAAa;AAWb,wBAAqB;AAEnB,IADuB,YAAY,QAAQ,MAAM,QAAQ,CAC1C,YAAY,SAAS,QAAQ;KAC5C;;IAEH,EAAE,CAAC;AAGN,iBAAgB;AAEd,EADgB,YAAY,QAAQ,SAAS,CACrC,oBAAoB,YAAY,MAAM;IAC7C;EAAC;EAAU;EAAY;EAAM,CAAC"}
|
package/dist/map-mode/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { MapModeEvents, MapModeEventsNamespace } from "./events.js";
|
|
14
|
-
import { clearMapModeState, getCurrentModeOwner } from "./store.js";
|
|
14
|
+
import { clearMapModeState, getCurrentModeOwner, getMode, modeStore } from "./store.js";
|
|
15
15
|
import { UseMapModeReturn, useMapMode } from "./use-map-mode.js";
|
|
16
16
|
import { MapModeEventType, ModeChangeAuthorizationEvent, ModeChangeAuthorizationPayload, ModeChangeDecisionEvent, ModeChangeDecisionPayload, ModeChangeRequestEvent, ModeChangeRequestPayload, ModeChangedEvent, ModeChangedPayload } from "./types.js";
|
|
17
|
-
export { type MapModeEventType, MapModeEvents, MapModeEventsNamespace, type ModeChangeAuthorizationEvent, type ModeChangeAuthorizationPayload, type ModeChangeDecisionEvent, type ModeChangeDecisionPayload, type ModeChangeRequestEvent, type ModeChangeRequestPayload, type ModeChangedEvent, type ModeChangedPayload, type UseMapModeReturn, clearMapModeState, getCurrentModeOwner, useMapMode };
|
|
17
|
+
export { type MapModeEventType, MapModeEvents, MapModeEventsNamespace, type ModeChangeAuthorizationEvent, type ModeChangeAuthorizationPayload, type ModeChangeDecisionEvent, type ModeChangeDecisionPayload, type ModeChangeRequestEvent, type ModeChangeRequestPayload, type ModeChangedEvent, type ModeChangedPayload, type UseMapModeReturn, clearMapModeState, getCurrentModeOwner, getMode, modeStore, useMapMode };
|
package/dist/map-mode/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
import { MapModeEvents, MapModeEventsNamespace } from "./events.js";
|
|
15
|
-
import { clearMapModeState, getCurrentModeOwner } from "./store.js";
|
|
15
|
+
import { clearMapModeState, getCurrentModeOwner, getMode, modeStore } from "./store.js";
|
|
16
16
|
import { useMapMode } from "./use-map-mode.js";
|
|
17
17
|
|
|
18
|
-
export { MapModeEvents, MapModeEventsNamespace, clearMapModeState, getCurrentModeOwner, useMapMode };
|
|
18
|
+
export { MapModeEvents, MapModeEventsNamespace, clearMapModeState, getCurrentModeOwner, getMode, modeStore, useMapMode };
|
package/dist/map-mode/store.d.ts
CHANGED
|
@@ -10,62 +10,61 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { MapStore } from "../shared/create-map-store.js";
|
|
13
14
|
import { UniqueId } from "@accelint/core";
|
|
14
15
|
|
|
15
16
|
//#region src/map-mode/store.d.ts
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
* Uses a fan-out pattern: 1 bus listener -> N React subscribers.
|
|
19
|
-
* Automatically cleans up map mode state when the last subscriber unsubscribes.
|
|
20
|
-
*
|
|
21
|
-
* @param instanceId - The unique identifier for the map mode instance
|
|
22
|
-
* @returns A subscription function for useSyncExternalStore
|
|
18
|
+
* Internal type for tracking pending authorization requests.
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
type PendingRequest = {
|
|
21
|
+
authId: string;
|
|
22
|
+
desiredMode: string;
|
|
23
|
+
currentMode: string;
|
|
24
|
+
requestOwner: string;
|
|
25
|
+
};
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
* The string returned gets equality checked, so it needs to be stable or React re-renders unnecessarily.
|
|
28
|
-
*
|
|
29
|
-
* @param instanceId - The unique identifier for the map mode instance
|
|
30
|
-
* @returns A snapshot function for useSyncExternalStore
|
|
27
|
+
* State shape for map mode
|
|
31
28
|
*/
|
|
32
|
-
|
|
29
|
+
type MapModeState = {
|
|
30
|
+
mode: string;
|
|
31
|
+
modeOwners: Map<string, string>;
|
|
32
|
+
pendingRequests: Map<string, PendingRequest>;
|
|
33
|
+
};
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Server snapshots always return the default mode since mode state is client-only.
|
|
36
|
-
* Required for SSR/RSC compatibility with useSyncExternalStore.
|
|
37
|
-
*
|
|
38
|
-
* @param instanceId - The unique identifier for the map mode instance
|
|
39
|
-
* @returns A server snapshot function for useSyncExternalStore
|
|
35
|
+
* Actions for map mode
|
|
40
36
|
*/
|
|
41
|
-
|
|
37
|
+
type MapModeActions = {
|
|
38
|
+
/** Request a mode change */
|
|
39
|
+
requestModeChange: (desiredMode: string, requestOwner: string) => void;
|
|
40
|
+
};
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
44
|
-
* This maintains referential stability for the function reference.
|
|
45
|
-
*
|
|
46
|
-
* @param instanceId - The unique identifier for the map mode instance
|
|
47
|
-
* @returns A requestModeChange function for this instance
|
|
42
|
+
* Map mode store
|
|
48
43
|
*/
|
|
49
|
-
declare
|
|
44
|
+
declare const modeStore: MapStore<MapModeState, MapModeActions>;
|
|
45
|
+
/**
|
|
46
|
+
* Get the current mode for a map instance
|
|
47
|
+
*/
|
|
48
|
+
declare function getMode(mapId: UniqueId): string;
|
|
49
|
+
/**
|
|
50
|
+
* Hook for current mode value
|
|
51
|
+
*/
|
|
52
|
+
declare function useMode(mapId: UniqueId): string;
|
|
50
53
|
/**
|
|
51
54
|
* Get the owner of the current mode for a given map instance
|
|
52
55
|
* @internal - For internal map-toolkit use only
|
|
53
56
|
*/
|
|
54
57
|
declare function getCurrentModeOwner(instanceId: UniqueId): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a given owner is registered as the owner of any mode.
|
|
60
|
+
* This includes both active mode owners and pending mode requests.
|
|
61
|
+
* @internal - For internal map-toolkit use only
|
|
62
|
+
*/
|
|
63
|
+
declare function isRegisteredModeOwner(instanceId: UniqueId, owner: string): boolean;
|
|
55
64
|
/**
|
|
56
65
|
* Manually clear map mode state for a specific instanceId.
|
|
57
|
-
* This is typically not needed as cleanup happens automatically when all subscribers unmount.
|
|
58
|
-
* Use this only in advanced scenarios where manual cleanup is required.
|
|
59
|
-
*
|
|
60
|
-
* @param instanceId - The unique identifier for the map mode instance to clear
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```tsx
|
|
64
|
-
* // Manual cleanup (rarely needed)
|
|
65
|
-
* clearMapModeState('my-map-instance');
|
|
66
|
-
* ```
|
|
67
66
|
*/
|
|
68
67
|
declare function clearMapModeState(instanceId: UniqueId): void;
|
|
69
68
|
//#endregion
|
|
70
|
-
export { clearMapModeState, getCurrentModeOwner,
|
|
69
|
+
export { clearMapModeState, getCurrentModeOwner, getMode, isRegisteredModeOwner, modeStore, useMode };
|
|
71
70
|
//# sourceMappingURL=store.d.ts.map
|