@accelint/map-toolkit 0.2.0 → 0.3.1
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 +6 -3
- package/dist/cursor-coordinates/index.d.ts +3 -0
- package/dist/cursor-coordinates/index.js +3 -0
- package/dist/cursor-coordinates/index.js.map +1 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +76 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.js +161 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -0
- package/dist/deckgl/base-map/events.d.ts +1 -0
- package/dist/deckgl/base-map/events.js +2 -1
- package/dist/deckgl/base-map/events.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +1 -1
- package/dist/deckgl/base-map/index.js +69 -15
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/provider.d.ts +12 -16
- package/dist/deckgl/base-map/provider.js +2 -6
- package/dist/deckgl/base-map/provider.js.map +1 -1
- package/dist/deckgl/base-map/types.d.ts +29 -8
- package/dist/deckgl/text-layer/character-sets.d.ts +7 -0
- package/dist/deckgl/text-layer/character-sets.js.map +1 -1
- package/dist/deckgl/text-layer/default-settings.js.map +1 -1
- package/dist/decorators/deckgl.d.ts +1 -1
- package/dist/decorators/deckgl.js.map +1 -1
- package/dist/map-mode/index.d.ts +1 -1
- package/dist/map-mode/index.js +1 -1
- package/dist/map-mode/store.d.ts +35 -109
- package/dist/map-mode/store.js +268 -289
- package/dist/map-mode/store.js.map +1 -1
- package/dist/map-mode/use-map-mode.d.ts +3 -5
- package/dist/map-mode/use-map-mode.js +8 -10
- package/dist/map-mode/use-map-mode.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/viewport/constants.d.ts +9 -0
- package/dist/viewport/constants.js +11 -0
- package/dist/viewport/constants.js.map +1 -0
- package/dist/viewport/index.d.ts +13 -0
- package/dist/viewport/index.js +6 -0
- package/dist/viewport/index.js.map +1 -0
- package/dist/viewport/types.d.ts +22 -0
- package/dist/viewport/types.js +3 -0
- package/dist/viewport/types.js.map +1 -0
- package/dist/viewport/use-viewport-state.d.ts +85 -0
- package/dist/viewport/use-viewport-state.js +109 -0
- package/dist/viewport/use-viewport-state.js.map +1 -0
- package/dist/viewport/utils.d.ts +37 -0
- package/dist/viewport/utils.js +46 -0
- package/dist/viewport/utils.js.map +1 -0
- package/dist/viewport/viewport-size.d.ts +42 -0
- package/dist/viewport/viewport-size.js +16 -0
- package/dist/viewport/viewport-size.js.map +1 -0
- package/package.json +16 -21
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { UniqueId } from '@accelint/core';
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ import { UniqueId } from '@accelint/core';
|
|
|
6
7
|
* React context for map ID.
|
|
7
8
|
* Use the `useMapMode` hook to access the map mode state.
|
|
8
9
|
*/
|
|
9
|
-
declare const MapContext:
|
|
10
|
+
declare const MapContext: react.Context<UniqueId | null>;
|
|
10
11
|
/**
|
|
11
12
|
* Props for the MapProvider component.
|
|
12
13
|
*/
|
|
@@ -43,14 +44,14 @@ type MapProviderProps = {
|
|
|
43
44
|
* Consumers should pass the `id` prop to `BaseMap`, which will create this provider automatically.
|
|
44
45
|
*
|
|
45
46
|
* This component uses a hybrid architecture combining React Context (for map instance identity)
|
|
46
|
-
* with
|
|
47
|
+
* with module-level state management (for map mode state). The provider:
|
|
47
48
|
* - Provides a unique `id` via Context
|
|
48
|
-
* -
|
|
49
|
+
* - Cleans up map mode state when unmounted
|
|
49
50
|
* - Allows components to subscribe to mode changes via `useMapMode` hook (which uses `useSyncExternalStore`)
|
|
50
51
|
*
|
|
51
|
-
* The
|
|
52
|
-
* mode changes with ownership. When a mode is owned by a component,
|
|
53
|
-
* must request authorization to change to a different mode. The
|
|
52
|
+
* The module-level state management system implements a state machine for map modes where
|
|
53
|
+
* components can request mode changes with ownership. When a mode is owned by a component,
|
|
54
|
+
* other components must request authorization to change to a different mode. The system handles:
|
|
54
55
|
*
|
|
55
56
|
* - Automatic mode changes when no ownership conflicts exist
|
|
56
57
|
* - Authorization flow when switching between owned modes
|
|
@@ -86,14 +87,13 @@ type MapProviderProps = {
|
|
|
86
87
|
*
|
|
87
88
|
* ## Instance ID Stability and Lifecycle
|
|
88
89
|
*
|
|
89
|
-
* The provider
|
|
90
|
-
*
|
|
91
|
-
* -
|
|
92
|
-
* -
|
|
93
|
-
* - All child components remount with the new context
|
|
90
|
+
* The provider's cleanup mechanism (via `useEffect`) ensures proper state management:
|
|
91
|
+
* - Map mode state is cleaned up when the provider unmounts
|
|
92
|
+
* - Changing the `id` prop will trigger cleanup of the old state via the effect dependency
|
|
93
|
+
* - State is lazily initialized on first subscription (no manual creation needed)
|
|
94
94
|
*
|
|
95
95
|
* While the `id` prop should typically remain stable (created as a module-level constant
|
|
96
|
-
* or with `useState`), changing it will work correctly due to the
|
|
96
|
+
* or with `useState`), changing it will work correctly due to the cleanup mechanism.
|
|
97
97
|
*
|
|
98
98
|
* @param props - Provider props including children and required id
|
|
99
99
|
* @returns Provider component that wraps children with map instance identity context
|
|
@@ -124,10 +124,6 @@ type MapProviderProps = {
|
|
|
124
124
|
* });
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
|
-
/**
|
|
128
|
-
* Public wrapper that forces remount when id changes.
|
|
129
|
-
* This ensures clean lifecycle management and prevents memory leaks.
|
|
130
|
-
*/
|
|
131
127
|
declare function MapProvider({ children, id }: MapProviderProps): react_jsx_runtime.JSX.Element;
|
|
132
128
|
|
|
133
129
|
export { MapContext, MapProvider, type MapProviderProps };
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import 'client-only';
|
|
3
3
|
import { createContext, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { clearMapModeState } from '../../map-mode/store.js';
|
|
5
5
|
|
|
6
6
|
const MapContext = createContext(null);
|
|
7
7
|
function MapProvider({ children, id }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(MapProviderInternal, { id, children }, id);
|
|
9
|
-
}
|
|
10
|
-
function MapProviderInternal({ children, id }) {
|
|
11
|
-
getOrCreateStore(id);
|
|
12
8
|
useEffect(() => {
|
|
13
9
|
return () => {
|
|
14
|
-
|
|
10
|
+
clearMapModeState(id);
|
|
15
11
|
};
|
|
16
12
|
}, [id]);
|
|
17
13
|
return /* @__PURE__ */ jsx(MapContext.Provider, { value: id, children });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/deckgl/base-map/provider.tsx"],"names":[],"mappings":";;;;;AAuBO,MAAM,UAAA,GAAa,cAA+B,IAAI;
|
|
1
|
+
{"version":3,"sources":["../../../src/deckgl/base-map/provider.tsx"],"names":[],"mappings":";;;;;AAuBO,MAAM,UAAA,GAAa,cAA+B,IAAI;AAuHtD,SAAS,WAAA,CAAY,EAAE,QAAA,EAAU,EAAA,EAAG,EAAqB;AAG9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,OAAO,MAAM;AACX,MAAA,iBAAA,CAAkB,EAAE,CAAA;AAAA,IACtB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,EAAE,CAAC,CAAA;AAEP,EAAA,2BAAQ,UAAA,CAAW,QAAA,EAAX,EAAoB,KAAA,EAAO,IAAK,QAAA,EAAS,CAAA;AACnD","file":"provider.js","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'use client';\n\nimport 'client-only';\nimport { createContext, type ReactNode, useEffect } from 'react';\nimport { clearMapModeState } from '../../map-mode/store';\nimport type { UniqueId } from '@accelint/core';\n\n/**\n * React context for map ID.\n * Use the `useMapMode` hook to access the map mode state.\n */\nexport const MapContext = createContext<UniqueId | null>(null);\n\n/**\n * Props for the MapProvider component.\n */\nexport type MapProviderProps = {\n /** Child components that will have access to map mode context */\n children: ReactNode;\n /**\n * Unique identifier for this map instance.\n *\n * Used to isolate mode changes between different map instances (e.g., main map vs minimap).\n * This is required and should be provided by the parent component (typically BaseMap).\n *\n * @example\n * ```tsx\n * // Multiple independent map instances\n * const mainMapId = uuid();\n * const minimapId = uuid();\n *\n * <MapProvider id={mainMapId}>\n * // Map layers and components\n * </MapProvider>\n *\n * <MapProvider id={minimapId}>\n * // Minimap layers and components\n * </MapProvider>\n * ```\n */\n id: UniqueId;\n};\n\n/**\n * Provider component for managing map modes with ownership and authorization.\n *\n * **Note**: This provider is used internally by `BaseMap` and should not be used directly.\n * Consumers should pass the `id` prop to `BaseMap`, which will create this provider automatically.\n *\n * This component uses a hybrid architecture combining React Context (for map instance identity)\n * with module-level state management (for map mode state). The provider:\n * - Provides a unique `id` via Context\n * - Cleans up map mode state when unmounted\n * - Allows components to subscribe to mode changes via `useMapMode` hook (which uses `useSyncExternalStore`)\n *\n * The module-level state management system implements a state machine for map modes where\n * components can request mode changes with ownership. When a mode is owned by a component,\n * other components must request authorization to change to a different mode. The system handles:\n *\n * - Automatic mode changes when no ownership conflicts exist\n * - Authorization flow when switching between owned modes\n * - Per-mode ownership tracking that persists throughout the session\n * - Pending request management (one pending request per requester)\n * - Auto-acceptance of first pending request when mode owner returns to default\n * - Auto-rejection of other pending requests when one is approved\n * - Event emission through a centralized event bus\n * - Instance isolation for multiple map scenarios (main map + minimap)\n * - Always initializes in 'default' mode\n *\n * ## Instance Isolation\n *\n * Each MapProvider instance operates independently. Mode changes in one instance\n * do not affect other instances, even when multiple maps are rendered on the same page.\n * This enables scenarios like:\n * - Main map in \"drawing\" mode while minimap stays in \"view\" mode\n * - Multiple independent map views with different interaction modes\n *\n * Events are scoped to specific instances using the `id` prop. The event bus\n * filters events to ensure each provider only responds to events for its own instance.\n *\n * ## Pending Request Behavior\n *\n * - Pending requests are stored by requester ID (not mode owner)\n * - Each requester can have only one pending request at a time\n * - New requests from the same requester auto-replace previous requests\n * - Pending requests persist when mode owner switches between their own modes\n * - When any request is approved, all other pending requests are auto-rejected\n * - When mode owner returns to default mode:\n * - If first pending request is for default mode, all pending requests are rejected (already in requested mode)\n * - If first pending request is for a different mode, that request is auto-approved and others are rejected\n *\n * ## Instance ID Stability and Lifecycle\n *\n * The provider's cleanup mechanism (via `useEffect`) ensures proper state management:\n * - Map mode state is cleaned up when the provider unmounts\n * - Changing the `id` prop will trigger cleanup of the old state via the effect dependency\n * - State is lazily initialized on first subscription (no manual creation needed)\n *\n * While the `id` prop should typically remain stable (created as a module-level constant\n * or with `useState`), changing it will work correctly due to the cleanup mechanism.\n *\n * @param props - Provider props including children and required id\n * @returns Provider component that wraps children with map instance identity context\n *\n * @example\n * Internal usage within BaseMap:\n * ```tsx\n * // BaseMap automatically creates the provider\n * function BaseMap({ id, children, ...props }: BaseMapProps) {\n * return (\n * <div>\n * <MapProvider id={id}>\n * <Deckgl {...props}>\n * {children}\n * </Deckgl>\n * </MapProvider>\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * With authorization handling - use id in event payloads:\n * ```tsx\n * useOn(MapModeEvents.changeAuthorization, (event) => {\n * const { authId, id } = event.payload;\n * emitDecision({ authId, approved: true, owner: 'tool', id });\n * });\n * ```\n */\nexport function MapProvider({ children, id }: MapProviderProps) {\n // Cleanup when component unmounts\n // State is created automatically on first subscription in useMapMode\n useEffect(() => {\n return () => {\n clearMapModeState(id);\n };\n }, [id]);\n\n return <MapContext.Provider value={id}>{children}</MapContext.Provider>;\n}\n"]}
|
|
@@ -5,10 +5,16 @@ import { MjolnirGestureEvent, MjolnirPointerEvent } from 'mjolnir.js';
|
|
|
5
5
|
import { MapEvents } from './events.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* PickingInfo
|
|
9
|
-
*
|
|
8
|
+
* PickingInfo modified for serialization through the event bus.
|
|
9
|
+
* Omits viewport, layer, and sourceLayer (which contain non-serializable functions),
|
|
10
|
+
* and adds layerId and sourceLayerId extracted from the original layer objects.
|
|
10
11
|
*/
|
|
11
|
-
type NonFuncPickingInfo = Omit<PickingInfo, 'viewport'
|
|
12
|
+
type NonFuncPickingInfo = Omit<PickingInfo, 'viewport' | 'layer' | 'sourceLayer'> & {
|
|
13
|
+
/** ID of the picked layer (extracted from layer.id before omission) */
|
|
14
|
+
layerId?: NonNullable<PickingInfo['layer']>['id'];
|
|
15
|
+
/** ID of the source layer if applicable (extracted from sourceLayer.id before omission) */
|
|
16
|
+
sourceLayerId?: NonNullable<PickingInfo['sourceLayer']>['id'];
|
|
17
|
+
};
|
|
12
18
|
/**
|
|
13
19
|
* MjolnirGestureEvent without function properties and non-serializable objects.
|
|
14
20
|
* These properties are omitted to allow the event to be serialized through the event bus.
|
|
@@ -43,6 +49,23 @@ type MapHoverPayload = {
|
|
|
43
49
|
/** The map instance the event occurred within */
|
|
44
50
|
id: UniqueId;
|
|
45
51
|
};
|
|
52
|
+
type Bounds = [
|
|
53
|
+
minLon: number,
|
|
54
|
+
minLat: number,
|
|
55
|
+
maxLon: number,
|
|
56
|
+
maxLat: number
|
|
57
|
+
];
|
|
58
|
+
type MapViewportPayload = {
|
|
59
|
+
bounds: Bounds;
|
|
60
|
+
latitude: number;
|
|
61
|
+
longitude: number;
|
|
62
|
+
zoom: number;
|
|
63
|
+
/** Viewport width in pixels */
|
|
64
|
+
width: number;
|
|
65
|
+
/** Viewport height in pixels */
|
|
66
|
+
height: number;
|
|
67
|
+
id: UniqueId;
|
|
68
|
+
};
|
|
46
69
|
/**
|
|
47
70
|
* Type for map click events in the event bus.
|
|
48
71
|
* Combines the event name with the click payload.
|
|
@@ -53,9 +76,7 @@ type MapClickEvent = Payload<typeof MapEvents.click, MapClickPayload>;
|
|
|
53
76
|
* Combines the event name with the hover payload.
|
|
54
77
|
*/
|
|
55
78
|
type MapHoverEvent = Payload<typeof MapEvents.hover, MapHoverPayload>;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
type MapEventType = MapClickEvent | MapHoverEvent;
|
|
79
|
+
type MapViewportEvent = Payload<typeof MapEvents.viewport, MapViewportPayload>;
|
|
80
|
+
type MapEventType = MapClickEvent | MapHoverEvent | MapViewportEvent;
|
|
60
81
|
|
|
61
|
-
export type { MapClickEvent, MapClickPayload, MapEventType, MapHoverEvent, MapHoverPayload };
|
|
82
|
+
export type { Bounds, MapClickEvent, MapClickPayload, MapEventType, MapHoverEvent, MapHoverPayload, MapViewportEvent, MapViewportPayload };
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
type CharacterSetsKeys = keyof typeof CHARACTER_SETS;
|
|
2
|
+
/**
|
|
3
|
+
* Predefined character sets for TextLayer.
|
|
4
|
+
*
|
|
5
|
+
* Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,
|
|
6
|
+
* or use AUTO for dynamic optimization based on content.
|
|
7
|
+
* EXPANDED includes ASCII and Latin characters with diacritics for international text.
|
|
8
|
+
*/
|
|
2
9
|
declare const CHARACTER_SETS: Readonly<{
|
|
3
10
|
readonly ALL_NUMBERS: "1234567890";
|
|
4
11
|
readonly ASCII_ALL: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !\"#$%&'()*+,-./:;<=>?@[]^_`{|}~";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/deckgl/text-layer/character-sets.ts"],"names":[],"mappings":"AAYA,MAAM,WAAA,GAAc,YAAA;AAEpB,MAAM,uBAAA,GAA0B,4BAAA;AAChC,MAAM,uBAAA,GAA0B,4BAAA;AAChC,MAAM,aAAA,GAAgB,mCAAA;AAEtB,MAAM,aAAA,GAAgB,CAAA,EAAG,uBAAuB,CAAA,EAAG,uBAAuB,CAAA,CAAA;AAC1E,MAAM,mBAAA,GAAsB,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,CAAA,CAAA;AAC1D,MAAM,YAAY,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,GAAG,aAAa,CAAA,CAAA;AAEhE,MAAM,IAAA,GAAO,MAAA;AAEb,MAAM,uBAAA,GAA0B,kIAAA;AAChC,MAAM,uBAAA,GAA0B,0HAAA;AAChC,MAAM,aAAA,GAAgB,2IAAA;AAEtB,MAAM,aAAA,GAAgB,CAAA,EAAG,uBAAuB,CAAA,EAAG,uBAAuB,CAAA,CAAA;AAC1E,MAAM,mBAAA,GAAsB,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,CAAA,CAAA;AAC1D,MAAM,YAAY,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,GAAG,aAAa,CAAA,CAAA;AAEhE,MAAM,QAAA,GAAW,CAAA,EAAG,SAAS,CAAA,EAAG,SAAS,CAAA,CAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/deckgl/text-layer/character-sets.ts"],"names":[],"mappings":"AAYA,MAAM,WAAA,GAAc,YAAA;AAEpB,MAAM,uBAAA,GAA0B,4BAAA;AAChC,MAAM,uBAAA,GAA0B,4BAAA;AAChC,MAAM,aAAA,GAAgB,mCAAA;AAEtB,MAAM,aAAA,GAAgB,CAAA,EAAG,uBAAuB,CAAA,EAAG,uBAAuB,CAAA,CAAA;AAC1E,MAAM,mBAAA,GAAsB,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,CAAA,CAAA;AAC1D,MAAM,YAAY,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,GAAG,aAAa,CAAA,CAAA;AAEhE,MAAM,IAAA,GAAO,MAAA;AAEb,MAAM,uBAAA,GAA0B,kIAAA;AAChC,MAAM,uBAAA,GAA0B,0HAAA;AAChC,MAAM,aAAA,GAAgB,2IAAA;AAEtB,MAAM,aAAA,GAAgB,CAAA,EAAG,uBAAuB,CAAA,EAAG,uBAAuB,CAAA,CAAA;AAC1E,MAAM,mBAAA,GAAsB,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,CAAA,CAAA;AAC1D,MAAM,YAAY,CAAA,EAAG,aAAa,CAAA,EAAG,WAAW,GAAG,aAAa,CAAA,CAAA;AAEhE,MAAM,QAAA,GAAW,CAAA,EAAG,SAAS,CAAA,EAAG,SAAS,CAAA,CAAA;AAWlC,MAAM,cAAA,GAAiB,OAAO,MAAA,CAAO;AAAA,EAC1C,WAAA;AAAA,EAEA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,aAAA;AAAA,EACA,uBAAA;AAAA,EACA,uBAAA;AAAA,EACA,aAAA;AAAA,EAEA,IAAA;AAAA,EACA,QAAA;AAAA,EAEA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,aAAA;AAAA,EACA,uBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF,CAAU","file":"character-sets.js","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\nconst ALL_NUMBERS = '1234567890';\n\nconst ASCII_LETTERS_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';\nconst ASCII_LETTERS_UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst ASCII_SYMBOLS = ' !\"#$%&\\'()*+,-./:;<=>?@[]^_`{|}~';\n\nconst ASCII_LETTERS = `${ASCII_LETTERS_LOWERCASE}${ASCII_LETTERS_UPPERCASE}`;\nconst ASCII_ALPHA_NUMERIC = `${ASCII_LETTERS}${ALL_NUMBERS}`;\nconst ASCII_ALL = `${ASCII_LETTERS}${ALL_NUMBERS}${ASCII_SYMBOLS}`;\n\nconst AUTO = 'auto';\n\nconst LATIN_LETTERS_LOWERCASE = 'àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿß';\nconst LATIN_LETTERS_UPPERCASE = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';\nconst LATIN_SYMBOLS = ' ¡¿¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿×÷';\n\nconst LATIN_LETTERS = `${LATIN_LETTERS_LOWERCASE}${LATIN_LETTERS_UPPERCASE}`;\nconst LATIN_ALPHA_NUMERIC = `${LATIN_LETTERS}${ALL_NUMBERS}`;\nconst LATIN_ALL = `${LATIN_LETTERS}${ALL_NUMBERS}${LATIN_SYMBOLS}`;\n\nconst EXPANDED = `${ASCII_ALL}${LATIN_ALL}`;\n\nexport type CharacterSetsKeys = keyof typeof CHARACTER_SETS;\n\n/**\n * Predefined character sets for TextLayer.\n *\n * Use smaller character sets (ASCII_ALL, ASCII_ALPHA_NUMERIC) for better performance,\n * or use AUTO for dynamic optimization based on content.\n * EXPANDED includes ASCII and Latin characters with diacritics for international text.\n */\nexport const CHARACTER_SETS = Object.freeze({\n ALL_NUMBERS,\n\n ASCII_ALL,\n ASCII_ALPHA_NUMERIC,\n ASCII_LETTERS,\n ASCII_LETTERS_LOWERCASE,\n ASCII_LETTERS_UPPERCASE,\n ASCII_SYMBOLS,\n\n AUTO,\n EXPANDED,\n\n LATIN_ALL,\n LATIN_ALPHA_NUMERIC,\n LATIN_LETTERS,\n LATIN_LETTERS_LOWERCASE,\n LATIN_LETTERS_UPPERCASE,\n LATIN_SYMBOLS,\n} as const);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/deckgl/text-layer/default-settings.ts"],"names":[],"mappings":"AAeO,MAAM,eAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/deckgl/text-layer/default-settings.ts"],"names":[],"mappings":"AAeO,MAAM,eAAA,GAA8C;AAAA,EACzD,UAAA,EAAY,uBAAA;AAAA,EACZ,YAAA,EAAc;AAAA,IACZ,QAAA,EAAU,EAAA;AAAA,IACV,GAAA,EAAK,IAAA;AAAA,IACL,MAAA,EAAQ,EAAA;AAAA,IACR,MAAA,EAAQ,IAAA;AAAA,IACR,MAAA,EAAQ,EAAA;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,UAAA,EAAY,GAAA;AAAA,EACZ,oBAAA,EAAsB,QAAA;AAAA,EACtB,QAAA,EAAU,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAAA,EAC7B,OAAA,EAAS,EAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,UAAA,EAAY,CAAA;AAAA,EACZ,YAAA,EAAc,CAAC,CAAA,EAAG,CAAA,EAAG,GAAG,GAAG,CAAA;AAAA,EAC3B,YAAA,EAAc;AAChB","file":"default-settings.js","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 type { Color } from '@deck.gl/core';\nimport type { TextLayerProps as DglTextLayerProps } from '@deck.gl/layers';\n\nexport const defaultSettings: Partial<DglTextLayerProps> = {\n fontFamily: 'system-ui, sans-serif',\n fontSettings: {\n fontSize: 22,\n sdf: true,\n buffer: 10,\n cutoff: 0.19,\n radius: 10,\n smoothing: 0.1,\n },\n fontWeight: 500,\n getAlignmentBaseline: 'center',\n getColor: [255, 255, 255, 255] as Color,\n getSize: 12,\n getTextAnchor: 'middle',\n lineHeight: 1,\n outlineColor: [0, 0, 0, 255] as Color,\n outlineWidth: 2,\n} as const;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/decorators/deckgl.tsx"],"names":[],"mappings":";;;;AAmBA,MAAM,mBAAmB,IAAA,EAAK;AAEvB,MAAM,aAAa,MAAiB;AACzC,EAAA,OAAO,CAAC,KAAA,KAAU;AAChB,IAAA,uBACE,GAAA,CAAC,WAAQ,SAAA,EAAU,aAAA,EAAc,IAAI,gBAAA,EACnC,QAAA,kBAAA,GAAA,CAAC,SAAM,CAAA,EACT,CAAA;AAAA,EAEJ,CAAA;AACF","file":"deckgl.js","sourcesContent":["// __private-exports\n\n/*\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 { uuid } from '@accelint/core';\nimport { BaseMap } from '../deckgl/base-map';\nimport type { Decorator } from '@storybook/react';\n\n// Module-level constant - stable across all Storybook renders\nconst STORYBOOK_MAP_ID = uuid();\n\nexport const withDeckGL = (): Decorator => {\n return (Story) => {\n return (\n <BaseMap className='h-dvh w-dvw' id={STORYBOOK_MAP_ID}>\n <Story />\n </BaseMap>\n );\n };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/deckgl.tsx"],"names":[],"mappings":";;;;AAmBA,MAAM,mBAAmB,IAAA,EAAK;AAEvB,MAAM,aAAa,MAAiB;AACzC,EAAA,OAAO,CAAC,KAAA,KAAU;AAChB,IAAA,uBACE,GAAA,CAAC,WAAQ,SAAA,EAAU,aAAA,EAAc,IAAI,gBAAA,EACnC,QAAA,kBAAA,GAAA,CAAC,SAAM,CAAA,EACT,CAAA;AAAA,EAEJ,CAAA;AACF","file":"deckgl.js","sourcesContent":["// __private-exports\n\n/*\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 { uuid } from '@accelint/core';\nimport { BaseMap } from '../deckgl/base-map';\nimport type { Decorator } from '@storybook/react-vite';\n\n// Module-level constant - stable across all Storybook renders\nconst STORYBOOK_MAP_ID = uuid();\n\nexport const withDeckGL = (): Decorator => {\n return (Story) => {\n return (\n <BaseMap className='h-dvh w-dvw' id={STORYBOOK_MAP_ID}>\n <Story />\n </BaseMap>\n );\n };\n};\n"]}
|
package/dist/map-mode/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MapModeEvents, MapModeEventsNamespace } from './events.js';
|
|
2
|
-
export {
|
|
2
|
+
export { clearMapModeState, getCurrentModeOwner } from './store.js';
|
|
3
3
|
export { UseMapModeReturn, useMapMode } from './use-map-mode.js';
|
|
4
4
|
export { MapModeEventType, ModeChangeAuthorizationEvent, ModeChangeAuthorizationPayload, ModeChangeDecisionEvent, ModeChangeDecisionPayload, ModeChangeRequestEvent, ModeChangeRequestPayload, ModeChangedEvent, ModeChangedPayload } from './types.js';
|
|
5
5
|
import '@accelint/core';
|
package/dist/map-mode/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MapModeEvents, MapModeEventsNamespace } from './events.js';
|
|
2
|
-
export {
|
|
2
|
+
export { clearMapModeState, getCurrentModeOwner } from './store.js';
|
|
3
3
|
export { useMapMode } from './use-map-mode.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/map-mode/store.d.ts
CHANGED
|
@@ -1,122 +1,48 @@
|
|
|
1
1
|
import { UniqueId } from '@accelint/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Creates or retrieves a cached subscription function for a given instanceId.
|
|
5
|
+
* Uses a fan-out pattern: 1 bus listener -> N React subscribers.
|
|
6
|
+
* Automatically cleans up map mode state when the last subscriber unsubscribes.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* The store always initializes in 'default' mode and does not accept a custom default mode.
|
|
8
|
+
* @param instanceId - The unique identifier for the map mode instance
|
|
9
|
+
* @returns A subscription function for useSyncExternalStore
|
|
10
|
+
*/
|
|
11
|
+
declare function getOrCreateSubscription(instanceId: UniqueId): (onStoreChange: () => void) => () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Creates or retrieves a cached snapshot function for a given instanceId.
|
|
14
|
+
* The string returned gets equality checked, so it needs to be stable or React re-renders unnecessarily.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
16
|
+
* @param instanceId - The unique identifier for the map mode instance
|
|
17
|
+
* @returns A snapshot function for useSyncExternalStore
|
|
18
18
|
*/
|
|
19
|
-
declare
|
|
20
|
-
private readonly id;
|
|
21
|
-
private mode;
|
|
22
|
-
private readonly defaultMode;
|
|
23
|
-
private readonly modeOwners;
|
|
24
|
-
private readonly pendingRequests;
|
|
25
|
-
private readonly listeners;
|
|
26
|
-
private readonly bus;
|
|
27
|
-
private readonly unsubscribers;
|
|
28
|
-
constructor(id: UniqueId);
|
|
29
|
-
/**
|
|
30
|
-
* Get current mode snapshot (for useSyncExternalStore)
|
|
31
|
-
*/
|
|
32
|
-
getSnapshot: () => string;
|
|
33
|
-
/**
|
|
34
|
-
* Subscribe to mode changes (for useSyncExternalStore)
|
|
35
|
-
*/
|
|
36
|
-
subscribe: (listener: () => void) => (() => void);
|
|
37
|
-
/**
|
|
38
|
-
* Request a mode change
|
|
39
|
-
*
|
|
40
|
-
* If the mode change can be auto-accepted (no ownership conflicts), the mode changes immediately.
|
|
41
|
-
* Otherwise, an authorization request is emitted and stored as a pending request.
|
|
42
|
-
*
|
|
43
|
-
* **Important**: If the requester already has a pending authorization request, it will be replaced
|
|
44
|
-
* with this new request. Only one pending request per requester is maintained at a time.
|
|
45
|
-
*
|
|
46
|
-
* @param desiredMode - The mode to switch to (automatically trimmed of whitespace)
|
|
47
|
-
* @param requestOwner - Unique identifier of the component requesting the change (automatically trimmed of whitespace)
|
|
48
|
-
* @throws Error if either parameter is empty or whitespace-only
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts
|
|
52
|
-
* // First request from 'drawing-tool'
|
|
53
|
-
* store.requestModeChange('drawing', 'drawing-tool');
|
|
54
|
-
* // → Creates pending request with authId 'abc-123'
|
|
55
|
-
*
|
|
56
|
-
* // Second request from same 'drawing-tool' before first is resolved
|
|
57
|
-
* store.requestModeChange('measuring', 'drawing-tool');
|
|
58
|
-
* // → Replaces pending request, new authId 'def-456', old 'abc-123' is discarded
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
requestModeChange: (desiredMode: string, requestOwner: string) => void;
|
|
62
|
-
/**
|
|
63
|
-
* Notify all subscribers of state change
|
|
64
|
-
*/
|
|
65
|
-
private notify;
|
|
66
|
-
/**
|
|
67
|
-
* Setup event listeners for bus events
|
|
68
|
-
*
|
|
69
|
-
* Note: Event listeners remain active even after early returns in handlers.
|
|
70
|
-
* This is by design - cleanup happens in destroy() which is called automatically
|
|
71
|
-
* by MapProvider on unmount. Consumers don't need to manually manage cleanup.
|
|
72
|
-
*/
|
|
73
|
-
private setupEventListeners;
|
|
74
|
-
/**
|
|
75
|
-
* Determine if a mode change request should be auto-accepted without authorization
|
|
76
|
-
*/
|
|
77
|
-
private shouldAutoAcceptRequest;
|
|
78
|
-
/**
|
|
79
|
-
* Handle mode change request logic
|
|
80
|
-
*/
|
|
81
|
-
private handleModeChangeRequest;
|
|
82
|
-
/**
|
|
83
|
-
* Handle authorization decision
|
|
84
|
-
*
|
|
85
|
-
* Processes approval/rejection decisions from mode owners. Only the current mode's owner
|
|
86
|
-
* can make authorization decisions. If a decision comes from a non-owner, a warning is
|
|
87
|
-
* logged and the decision is ignored to prevent unauthorized mode changes.
|
|
88
|
-
*
|
|
89
|
-
* @param payload - The authorization decision containing authId, approved status, and owner
|
|
90
|
-
*/
|
|
91
|
-
private handleAuthorizationDecision;
|
|
92
|
-
/**
|
|
93
|
-
* Approve a request and reject all others
|
|
94
|
-
*/
|
|
95
|
-
private approveRequestAndRejectOthers;
|
|
96
|
-
/**
|
|
97
|
-
* Handle pending requests when returning to default mode
|
|
98
|
-
*/
|
|
99
|
-
private handlePendingRequestsOnDefaultMode;
|
|
100
|
-
/**
|
|
101
|
-
* Set mode and notify listeners
|
|
102
|
-
*/
|
|
103
|
-
private setMode;
|
|
104
|
-
/**
|
|
105
|
-
* Clean up store resources
|
|
106
|
-
*/
|
|
107
|
-
destroy(): void;
|
|
108
|
-
}
|
|
19
|
+
declare function getOrCreateSnapshot(instanceId: UniqueId): () => string;
|
|
109
20
|
/**
|
|
110
|
-
*
|
|
21
|
+
* Creates or retrieves a cached requestModeChange function for a given instanceId.
|
|
22
|
+
* This maintains referential stability for the function reference.
|
|
23
|
+
*
|
|
24
|
+
* @param instanceId - The unique identifier for the map mode instance
|
|
25
|
+
* @returns A requestModeChange function for this instance
|
|
111
26
|
*/
|
|
112
|
-
declare function
|
|
27
|
+
declare function getOrCreateRequestModeChange(instanceId: UniqueId): (desiredMode: string, requestOwner: string) => void;
|
|
113
28
|
/**
|
|
114
|
-
*
|
|
29
|
+
* Get the owner of the current mode for a given map instance
|
|
30
|
+
* @internal - For internal map-toolkit use only
|
|
115
31
|
*/
|
|
116
|
-
declare function
|
|
32
|
+
declare function getCurrentModeOwner(instanceId: UniqueId): string | undefined;
|
|
117
33
|
/**
|
|
118
|
-
*
|
|
34
|
+
* Manually clear map mode state for a specific instanceId.
|
|
35
|
+
* This is typically not needed as cleanup happens automatically when all subscribers unmount.
|
|
36
|
+
* Use this only in advanced scenarios where manual cleanup is required.
|
|
37
|
+
*
|
|
38
|
+
* @param instanceId - The unique identifier for the map mode instance to clear
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Manual cleanup (rarely needed)
|
|
43
|
+
* clearMapModeState('my-map-instance');
|
|
44
|
+
* ```
|
|
119
45
|
*/
|
|
120
|
-
declare function
|
|
46
|
+
declare function clearMapModeState(instanceId: UniqueId): void;
|
|
121
47
|
|
|
122
|
-
export {
|
|
48
|
+
export { clearMapModeState, getCurrentModeOwner, getOrCreateRequestModeChange, getOrCreateSnapshot, getOrCreateSubscription };
|