@accelint/map-toolkit 0.6.0 → 1.1.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 +81 -0
- package/catalog-info.yaml +7 -6
- package/dist/camera/events.js.map +1 -1
- 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/cursor-coordinates/index.d.ts +4 -2
- package/dist/cursor-coordinates/index.js +3 -2
- package/dist/cursor-coordinates/store.d.ts +48 -0
- package/dist/cursor-coordinates/store.js +92 -0
- package/dist/cursor-coordinates/store.js.map +1 -0
- package/dist/cursor-coordinates/types.d.ts +87 -0
- package/dist/cursor-coordinates/types.js +12 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +41 -37
- package/dist/cursor-coordinates/use-cursor-coordinates.js +131 -202
- package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
- package/dist/deckgl/base-map/constants.d.ts +1 -6
- package/dist/deckgl/base-map/constants.js +1 -6
- 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/events.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +2 -2
- package/dist/deckgl/base-map/index.js +10 -11
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/provider.d.ts +2 -2
- package/dist/deckgl/base-map/provider.js +1 -1
- package/dist/deckgl/base-map/provider.js.map +1 -1
- package/dist/deckgl/index.d.ts +4 -4
- package/dist/deckgl/index.js +4 -4
- 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 +5 -8
- package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/index.d.ts +18 -14
- package/dist/deckgl/shapes/display-shape-layer/index.js +63 -30
- package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +2 -16
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/store.js +58 -272
- package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/types.d.ts +22 -11
- package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.d.ts → use-select-shape.d.ts} +9 -9
- package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.js → use-select-shape.js} +12 -12
- 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 +5 -66
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +2 -65
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +3 -121
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
- 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/{maplibre/constants.js → deckgl/shapes/draw-shape-layer/fiber.js} +6 -12
- 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/{viewport/constants.js → deckgl/shapes/draw-shape-layer/types.js} +1 -12
- 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/deckgl/shapes/edit-shape-layer/fiber.js +14 -0
- 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/deckgl/shapes/edit-shape-layer/types.js +14 -0
- 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 +15 -6
- package/dist/deckgl/shapes/index.js +12 -5
- package/dist/deckgl/shapes/shared/constants.d.ts +27 -32
- package/dist/deckgl/shapes/shared/constants.js +189 -25
- package/dist/deckgl/shapes/shared/constants.js.map +1 -1
- package/dist/deckgl/shapes/shared/events.d.ts +1 -20
- package/dist/deckgl/shapes/shared/events.js +1 -31
- package/dist/deckgl/shapes/shared/events.js.map +1 -1
- 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 +187 -28
- package/dist/deckgl/shapes/shared/types.js +55 -1
- package/dist/deckgl/shapes/shared/types.js.map +1 -1
- 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/fiber.js.map +1 -1
- package/dist/deckgl/symbol-layer/index.js.map +1 -1
- package/dist/deckgl/text-layer/character-sets.js.map +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-layer/fiber.js.map +1 -1
- package/dist/deckgl/text-layer/index.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/events.js.map +1 -1
- 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/events.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/hooks/use-maplibre.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/shared/constants.js +33 -0
- 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.d.ts +2 -2
- package/dist/viewport/viewport-size.js +2 -2
- package/dist/viewport/viewport-size.js.map +1 -1
- package/package.json +39 -19
- package/dist/camera/use-camera-state.d.ts +0 -153
- package/dist/camera/use-camera-state.js +0 -418
- package/dist/camera/use-camera-state.js.map +0 -1
- package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +0 -44
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +0 -66
- package/dist/deckgl/shapes/display-shape-layer/store.d.ts +0 -87
- package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +0 -1
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +0 -61
- package/dist/maplibre/constants.d.ts +0 -13
- package/dist/maplibre/constants.js.map +0 -1
- package/dist/viewport/constants.d.ts +0 -11
- 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
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
//#region src/deckgl/text-settings.ts
|
|
15
|
+
/**
|
|
16
|
+
* Shared font settings for SDF (Signed Distance Field) text rendering.
|
|
17
|
+
*
|
|
18
|
+
* These settings are optimized for cross-platform legibility, particularly
|
|
19
|
+
* on Windows machines where text can appear thin/hard to read without
|
|
20
|
+
* proper SDF configuration.
|
|
21
|
+
*
|
|
22
|
+
* Used by:
|
|
23
|
+
* - TextLayer component
|
|
24
|
+
* - Shape label layers
|
|
25
|
+
* - Draw/edit mode tooltips
|
|
26
|
+
*/
|
|
27
|
+
const SDF_FONT_SETTINGS = {
|
|
28
|
+
fontSize: 22,
|
|
29
|
+
sdf: true,
|
|
30
|
+
buffer: 10,
|
|
31
|
+
cutoff: .19,
|
|
32
|
+
radius: 10,
|
|
33
|
+
smoothing: .1
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Default text size in pixels for deck.gl TextLayer.
|
|
37
|
+
* Works in conjunction with SDF_FONT_SETTINGS for proper rendering.
|
|
38
|
+
*/
|
|
39
|
+
const DEFAULT_TEXT_SIZE = 12;
|
|
40
|
+
/**
|
|
41
|
+
* Default text color (white) for deck.gl TextLayer.
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_TEXT_COLOR = [
|
|
44
|
+
255,
|
|
45
|
+
255,
|
|
46
|
+
255,
|
|
47
|
+
255
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Default text outline color (black) for deck.gl TextLayer.
|
|
51
|
+
*/
|
|
52
|
+
const DEFAULT_TEXT_OUTLINE_COLOR = [
|
|
53
|
+
0,
|
|
54
|
+
0,
|
|
55
|
+
0,
|
|
56
|
+
255
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Default text outline width in pixels for deck.gl TextLayer.
|
|
60
|
+
*/
|
|
61
|
+
const DEFAULT_TEXT_OUTLINE_WIDTH = 2;
|
|
62
|
+
/**
|
|
63
|
+
* Default font weight for deck.gl TextLayer.
|
|
64
|
+
*/
|
|
65
|
+
const DEFAULT_FONT_WEIGHT = 500;
|
|
66
|
+
/**
|
|
67
|
+
* Combined default text style settings for deck.gl TextLayer.
|
|
68
|
+
* Spread this object into TextLayer props for consistent cross-platform rendering.
|
|
69
|
+
*
|
|
70
|
+
* Includes: fontSettings, fontWeight, getSize, getColor, outlineWidth, outlineColor
|
|
71
|
+
*/
|
|
72
|
+
const DEFAULT_TEXT_STYLE = {
|
|
73
|
+
fontSettings: { ...SDF_FONT_SETTINGS },
|
|
74
|
+
fontWeight: DEFAULT_FONT_WEIGHT,
|
|
75
|
+
getSize: DEFAULT_TEXT_SIZE,
|
|
76
|
+
getColor: DEFAULT_TEXT_COLOR,
|
|
77
|
+
outlineWidth: DEFAULT_TEXT_OUTLINE_WIDTH,
|
|
78
|
+
outlineColor: DEFAULT_TEXT_OUTLINE_COLOR
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { DEFAULT_FONT_WEIGHT, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_OUTLINE_COLOR, DEFAULT_TEXT_OUTLINE_WIDTH, DEFAULT_TEXT_SIZE, DEFAULT_TEXT_STYLE, SDF_FONT_SETTINGS };
|
|
83
|
+
//# sourceMappingURL=text-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-settings.js","names":["SDF_FONT_SETTINGS: NonNullable<TextLayerProps['fontSettings']>","DEFAULT_TEXT_COLOR: Color","DEFAULT_TEXT_OUTLINE_COLOR: Color"],"sources":["../../src/deckgl/text-settings.ts"],"sourcesContent":["/*\n * Copyright 2026 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 type { Color } from '@deck.gl/core';\nimport type { TextLayerProps } from '@deck.gl/layers';\n\n/**\n * Shared font settings for SDF (Signed Distance Field) text rendering.\n *\n * These settings are optimized for cross-platform legibility, particularly\n * on Windows machines where text can appear thin/hard to read without\n * proper SDF configuration.\n *\n * Used by:\n * - TextLayer component\n * - Shape label layers\n * - Draw/edit mode tooltips\n */\nexport const SDF_FONT_SETTINGS: NonNullable<TextLayerProps['fontSettings']> = {\n fontSize: 22,\n sdf: true,\n buffer: 10,\n cutoff: 0.19,\n radius: 10,\n smoothing: 0.1,\n};\n\n/**\n * Default text size in pixels for deck.gl TextLayer.\n * Works in conjunction with SDF_FONT_SETTINGS for proper rendering.\n */\nexport const DEFAULT_TEXT_SIZE = 12;\n\n/**\n * Default text color (white) for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_COLOR: Color = [255, 255, 255, 255];\n\n/**\n * Default text outline color (black) for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_OUTLINE_COLOR: Color = [0, 0, 0, 255];\n\n/**\n * Default text outline width in pixels for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_OUTLINE_WIDTH = 2;\n\n/**\n * Default font weight for deck.gl TextLayer.\n */\nexport const DEFAULT_FONT_WEIGHT = 500;\n\n/**\n * Combined default text style settings for deck.gl TextLayer.\n * Spread this object into TextLayer props for consistent cross-platform rendering.\n *\n * Includes: fontSettings, fontWeight, getSize, getColor, outlineWidth, outlineColor\n */\nexport const DEFAULT_TEXT_STYLE = {\n fontSettings: { ...SDF_FONT_SETTINGS },\n fontWeight: DEFAULT_FONT_WEIGHT,\n getSize: DEFAULT_TEXT_SIZE,\n getColor: DEFAULT_TEXT_COLOR,\n outlineWidth: DEFAULT_TEXT_OUTLINE_WIDTH,\n outlineColor: DEFAULT_TEXT_OUTLINE_COLOR,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAaA,oBAAiE;CAC5E,UAAU;CACV,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACZ;;;;;AAMD,MAAa,oBAAoB;;;;AAKjC,MAAaC,qBAA4B;CAAC;CAAK;CAAK;CAAK;CAAI;;;;AAK7D,MAAaC,6BAAoC;CAAC;CAAG;CAAG;CAAG;CAAI;;;;AAK/D,MAAa,6BAA6B;;;;AAK1C,MAAa,sBAAsB;;;;;;;AAQnC,MAAa,qBAAqB;CAChC,cAAc,EAAE,GAAG,mBAAmB;CACtC,YAAY;CACZ,SAAS;CACT,UAAU;CACV,cAAc;CACd,cAAc;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../src/map-cursor/events.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../src/map-cursor/events.ts"],"sourcesContent":["/*\n * Copyright 2026 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 * Event keys for map cursor state changes.\n * These events are used for communication between cursor stores and consumers.\n */\nexport const MapCursorEvents = {\n /** Emitted when a component requests a cursor change */\n changeRequest: 'cursor:change-request',\n /** Emitted when the cursor has been changed */\n changed: 'cursor:changed',\n /** Emitted when a cursor change request is rejected */\n rejected: 'cursor:rejected',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;CAE7B,eAAe;CAEf,SAAS;CAET,UAAU;CACX"}
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
import { MapCursorEvents } from "./events.js";
|
|
14
14
|
import { CSSCursorType, CursorChangeRequestEvent, CursorChangedEvent, CursorRejectedEvent, MapCursorEventType } from "./types.js";
|
|
15
|
-
import {
|
|
15
|
+
import { clearCursorState, cursorStore, getCursor } from "./store.js";
|
|
16
16
|
import { UseMapCursorReturn, useMapCursor, useMapCursorEffect } from "./use-map-cursor.js";
|
|
17
|
-
export { type CSSCursorType, type CursorChangeRequestEvent, type CursorChangedEvent, type CursorRejectedEvent, type MapCursorEventType, MapCursorEvents, type UseMapCursorReturn,
|
|
17
|
+
export { type CSSCursorType, type CursorChangeRequestEvent, type CursorChangedEvent, type CursorRejectedEvent, type MapCursorEventType, MapCursorEvents, type UseMapCursorReturn, clearCursorState, cursorStore, getCursor, useMapCursor, useMapCursorEffect };
|
package/dist/map-cursor/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
import { MapCursorEvents } from "./events.js";
|
|
15
|
-
import {
|
|
15
|
+
import { clearCursorState, cursorStore, getCursor } from "./store.js";
|
|
16
16
|
import { useMapCursor, useMapCursorEffect } from "./use-map-cursor.js";
|
|
17
17
|
|
|
18
|
-
export { MapCursorEvents,
|
|
18
|
+
export { MapCursorEvents, clearCursorState, cursorStore, getCursor, useMapCursor, useMapCursorEffect };
|
|
@@ -10,84 +10,55 @@
|
|
|
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 { CSSCursorType } from "./types.js";
|
|
14
15
|
import { UniqueId } from "@accelint/core";
|
|
15
16
|
|
|
16
17
|
//#region src/map-cursor/store.d.ts
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Uses a fan-out pattern: 1 bus listener -> N React subscribers.
|
|
20
|
-
* Automatically cleans up cursor state when the last subscriber unsubscribes.
|
|
21
|
-
*
|
|
22
|
-
* @param instanceId - The unique identifier for the map cursor instance
|
|
23
|
-
* @returns A subscription function for useSyncExternalStore
|
|
19
|
+
* State shape for map cursor
|
|
24
20
|
*/
|
|
25
|
-
|
|
21
|
+
type CursorState = {
|
|
22
|
+
/** Map of owner -> cursor */
|
|
23
|
+
cursorOwners: Map<string, CSSCursorType>;
|
|
24
|
+
/** Current active cursor (for priority tracking) */
|
|
25
|
+
currentCursor: CSSCursorType | null;
|
|
26
|
+
/** Current cursor owner (for priority tracking) */
|
|
27
|
+
currentOwner: string | null;
|
|
28
|
+
};
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
28
|
-
* The cursor returned gets equality checked, so it needs to be stable or React re-renders unnecessarily.
|
|
29
|
-
*
|
|
30
|
-
* @param instanceId - The unique identifier for the map cursor instance
|
|
31
|
-
* @returns A snapshot function for useSyncExternalStore
|
|
30
|
+
* Actions for cursor management
|
|
32
31
|
*/
|
|
33
|
-
|
|
32
|
+
type CursorActions = {
|
|
33
|
+
/** Request a cursor change */
|
|
34
|
+
requestCursorChange: (cursor: CSSCursorType, owner: string) => void;
|
|
35
|
+
/** Clear cursor for an owner */
|
|
36
|
+
clearCursor: (owner: string) => void;
|
|
37
|
+
};
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
36
|
-
* Server snapshots always return the default cursor since cursor state is client-only.
|
|
37
|
-
* Required for SSR/RSC compatibility with useSyncExternalStore.
|
|
38
|
-
*
|
|
39
|
-
* @param instanceId - The unique identifier for the map cursor instance
|
|
40
|
-
* @returns A server snapshot function for useSyncExternalStore
|
|
39
|
+
* Cursor store
|
|
41
40
|
*/
|
|
42
|
-
declare
|
|
41
|
+
declare const cursorStore: MapStore<CursorState, CursorActions>;
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
45
|
-
* This maintains referential stability for the function reference.
|
|
46
|
-
*
|
|
47
|
-
* @param instanceId - The unique identifier for the map cursor instance
|
|
48
|
-
* @returns A requestCursorChange function for this instance
|
|
43
|
+
* Get effective cursor (computed from state)
|
|
49
44
|
*/
|
|
50
|
-
declare function
|
|
45
|
+
declare function getCursor(mapId: UniqueId): CSSCursorType;
|
|
51
46
|
/**
|
|
52
|
-
*
|
|
53
|
-
* This maintains referential stability for the function reference.
|
|
47
|
+
* Hook for effective cursor value.
|
|
54
48
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* Get the current cursor for a given instance (direct access, not reactive).
|
|
61
|
-
* @internal - For internal map-toolkit use only
|
|
49
|
+
* **Internal use only** - not exported from the public API.
|
|
50
|
+
* Use `useMapCursor` instead, which provides:
|
|
51
|
+
* - MapContext integration (auto-resolves mapId inside MapProvider)
|
|
52
|
+
* - Actions (requestCursorChange, clearCursor)
|
|
53
|
+
* - Better ergonomics for consumers
|
|
62
54
|
*
|
|
63
|
-
*
|
|
64
|
-
* @returns The current cursor
|
|
55
|
+
* This hook exists for internal composition (used by useMapCursor).
|
|
65
56
|
*/
|
|
66
|
-
declare function
|
|
57
|
+
declare function useCursor(mapId: UniqueId): CSSCursorType;
|
|
67
58
|
/**
|
|
68
|
-
*
|
|
69
|
-
* This is typically not needed as cleanup happens automatically when all subscribers unmount.
|
|
70
|
-
* Use this only in advanced scenarios where manual cleanup is required.
|
|
71
|
-
*
|
|
72
|
-
* @param instanceId - The unique identifier for the map cursor instance to clear
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```tsx
|
|
76
|
-
* // Manual cleanup (rarely needed)
|
|
77
|
-
* clearCursorState('my-map-instance');
|
|
78
|
-
* ```
|
|
59
|
+
* Clear cursor state
|
|
79
60
|
*/
|
|
80
|
-
declare function clearCursorState(
|
|
81
|
-
/** @deprecated Use module functions directly */
|
|
82
|
-
declare function getOrCreateStore(id: UniqueId): {
|
|
83
|
-
getSnapshot: () => CSSCursorType;
|
|
84
|
-
};
|
|
85
|
-
/** @deprecated Use clearCursorState instead */
|
|
86
|
-
declare function destroyStore(id: UniqueId): void;
|
|
87
|
-
/** @deprecated Use direct function calls instead */
|
|
88
|
-
declare function getStore(id: UniqueId): {
|
|
89
|
-
getSnapshot: () => CSSCursorType;
|
|
90
|
-
} | undefined;
|
|
61
|
+
declare function clearCursorState(mapId: UniqueId): void;
|
|
91
62
|
//#endregion
|
|
92
|
-
export { clearCursorState,
|
|
63
|
+
export { clearCursorState, cursorStore, getCursor, useCursor };
|
|
93
64
|
//# sourceMappingURL=store.d.ts.map
|