@element-editor/ui 0.0.0-stage → 0.2.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.
Files changed (244) hide show
  1. package/AGENTS.md +65 -0
  2. package/LICENSE +21 -0
  3. package/README.md +46 -2
  4. package/dist/BooleanOperations-BRO7NHUY.js +111 -0
  5. package/dist/BooleanOperations-C2uOHRu3.cjs +1 -0
  6. package/dist/DataTable-B-2VjBEz.cjs +2 -0
  7. package/dist/DataTable-CS-3dIqY.js +510 -0
  8. package/dist/DataTablePanel-58LwzXQR.cjs +1 -0
  9. package/dist/DataTablePanel-DDFUmMaM.js +208 -0
  10. package/dist/EditToolbarBtn-Ch9HCLHq.cjs +3 -0
  11. package/dist/EditToolbarBtn-SR4xHd8G.js +378 -0
  12. package/dist/FeatureEditModal-Cc8N6vei.cjs +1 -0
  13. package/dist/FeatureEditModal-Dr10p3nE.js +77 -0
  14. package/dist/FeatureList-Bo9w9nre.js +520 -0
  15. package/dist/FeatureList-VRYesXCq.cjs +1 -0
  16. package/dist/FeatureRowContextMenu-CtBqdC1j.cjs +1 -0
  17. package/dist/FeatureRowContextMenu-DCUIiDwc.js +130 -0
  18. package/dist/GeoJSONModal-BV9Tamf4.js +886 -0
  19. package/dist/GeoJSONModal-Dd-nBufy.cjs +9 -0
  20. package/dist/SchemaEditor-B4L17K1e.cjs +1 -0
  21. package/dist/SchemaEditor-ryoTgaLb.js +293 -0
  22. package/dist/SchemaModal-DvMbWskS.js +95 -0
  23. package/dist/SchemaModal-gAuDkd-L.cjs +1 -0
  24. package/dist/SettingsModal-BScVTjpn.js +237 -0
  25. package/dist/SettingsModal-CqaSFxxR.cjs +1 -0
  26. package/dist/ShortcutsModal-D1Y2bGT8.cjs +1 -0
  27. package/dist/ShortcutsModal-ozuS2Ysb.js +299 -0
  28. package/dist/components/ActiveDrawingToolbar.d.cts +1 -0
  29. package/dist/components/ActiveDrawingToolbar.d.ts +1 -0
  30. package/dist/components/BasemapPicker.d.cts +26 -0
  31. package/dist/components/BasemapPicker.d.ts +26 -0
  32. package/dist/components/BooleanOperations.d.cts +1 -0
  33. package/dist/components/BooleanOperations.d.ts +1 -0
  34. package/dist/components/BufferPanel.d.cts +1 -0
  35. package/dist/components/BufferPanel.d.ts +1 -0
  36. package/dist/components/DataTable.d.cts +9 -0
  37. package/dist/components/DataTable.d.ts +9 -0
  38. package/dist/components/DataTablePanel.d.cts +10 -0
  39. package/dist/components/DataTablePanel.d.ts +10 -0
  40. package/dist/components/EditingToolbar.d.cts +1 -0
  41. package/dist/components/EditingToolbar.d.ts +1 -0
  42. package/dist/components/ElementEditorErrorBoundary.d.cts +28 -0
  43. package/dist/components/ElementEditorErrorBoundary.d.ts +28 -0
  44. package/dist/components/ElementEditorUIProvider.d.cts +50 -0
  45. package/dist/components/ElementEditorUIProvider.d.ts +50 -0
  46. package/dist/components/FeatureMapContextMenu.d.cts +23 -0
  47. package/dist/components/FeatureMapContextMenu.d.ts +23 -0
  48. package/dist/components/FitBoundsButton.d.cts +6 -0
  49. package/dist/components/FitBoundsButton.d.ts +6 -0
  50. package/dist/components/FloatingToolbar.d.cts +3 -0
  51. package/dist/components/FloatingToolbar.d.ts +3 -0
  52. package/dist/components/LocateButton.d.cts +11 -0
  53. package/dist/components/LocateButton.d.ts +11 -0
  54. package/dist/components/ReadonlyBanner.d.cts +1 -0
  55. package/dist/components/ReadonlyBanner.d.ts +1 -0
  56. package/dist/components/ShortcutsModal.d.cts +1 -0
  57. package/dist/components/ShortcutsModal.d.ts +1 -0
  58. package/dist/components/SimplifyPanel.d.cts +1 -0
  59. package/dist/components/SimplifyPanel.d.ts +1 -0
  60. package/dist/components/SmoothPanel.d.cts +1 -0
  61. package/dist/components/SmoothPanel.d.ts +1 -0
  62. package/dist/components/UndoRedoToolbar.d.cts +20 -0
  63. package/dist/components/UndoRedoToolbar.d.ts +20 -0
  64. package/dist/components/VertexSelectionBar.d.cts +12 -0
  65. package/dist/components/VertexSelectionBar.d.ts +12 -0
  66. package/dist/components/ZoomIndicator.d.cts +15 -0
  67. package/dist/components/ZoomIndicator.d.ts +15 -0
  68. package/dist/components/dialogs/DynamicFieldRenderer.d.cts +11 -0
  69. package/dist/components/dialogs/DynamicFieldRenderer.d.ts +11 -0
  70. package/dist/components/dialogs/SettingsModal.d.cts +1 -0
  71. package/dist/components/dialogs/SettingsModal.d.ts +1 -0
  72. package/dist/components/lazyParts.d.cts +12 -0
  73. package/dist/components/lazyParts.d.ts +12 -0
  74. package/dist/components/sidebar/FeatureEditModal.d.cts +6 -0
  75. package/dist/components/sidebar/FeatureEditModal.d.ts +6 -0
  76. package/dist/components/sidebar/FeatureList.d.cts +4 -0
  77. package/dist/components/sidebar/FeatureList.d.ts +4 -0
  78. package/dist/components/sidebar/FeatureRow.d.cts +38 -0
  79. package/dist/components/sidebar/FeatureRow.d.ts +38 -0
  80. package/dist/components/sidebar/FeatureRowContextMenu.d.cts +12 -0
  81. package/dist/components/sidebar/FeatureRowContextMenu.d.ts +12 -0
  82. package/dist/components/sidebar/FeatureSidePanel.d.cts +8 -0
  83. package/dist/components/sidebar/FeatureSidePanel.d.ts +8 -0
  84. package/dist/components/sidebar/GeoJSONModal.d.cts +5 -0
  85. package/dist/components/sidebar/GeoJSONModal.d.ts +5 -0
  86. package/dist/components/sidebar/GroupRow.d.cts +21 -0
  87. package/dist/components/sidebar/GroupRow.d.ts +21 -0
  88. package/dist/components/sidebar/HideLayersToggle.d.cts +2 -0
  89. package/dist/components/sidebar/HideLayersToggle.d.ts +2 -0
  90. package/dist/components/sidebar/LayersPanel.d.cts +5 -0
  91. package/dist/components/sidebar/LayersPanel.d.ts +5 -0
  92. package/dist/components/sidebar/PartSubRow.d.cts +9 -0
  93. package/dist/components/sidebar/PartSubRow.d.ts +9 -0
  94. package/dist/components/sidebar/SchemaEditor.d.cts +4 -0
  95. package/dist/components/sidebar/SchemaEditor.d.ts +4 -0
  96. package/dist/components/sidebar/SchemaModal.d.cts +5 -0
  97. package/dist/components/sidebar/SchemaModal.d.ts +5 -0
  98. package/dist/components/sidebar/codeDock.d.cts +21 -0
  99. package/dist/components/sidebar/codeDock.d.ts +21 -0
  100. package/dist/components/ui/Button.d.cts +9 -0
  101. package/dist/components/ui/Button.d.ts +9 -0
  102. package/dist/components/ui/CloseButton.d.cts +6 -0
  103. package/dist/components/ui/CloseButton.d.ts +6 -0
  104. package/dist/components/ui/ContextMenu.d.cts +28 -0
  105. package/dist/components/ui/ContextMenu.d.ts +28 -0
  106. package/dist/components/ui/EditToolbarBtn.d.cts +13 -0
  107. package/dist/components/ui/EditToolbarBtn.d.ts +13 -0
  108. package/dist/components/ui/ElementToaster.d.cts +3 -0
  109. package/dist/components/ui/ElementToaster.d.ts +3 -0
  110. package/dist/components/ui/GeometryTypeIcon.d.cts +7 -0
  111. package/dist/components/ui/GeometryTypeIcon.d.ts +7 -0
  112. package/dist/components/ui/IconButton.d.cts +28 -0
  113. package/dist/components/ui/IconButton.d.ts +28 -0
  114. package/dist/components/ui/Input.d.cts +14 -0
  115. package/dist/components/ui/Input.d.ts +14 -0
  116. package/dist/components/ui/JsonCode.d.cts +4 -0
  117. package/dist/components/ui/JsonCode.d.ts +4 -0
  118. package/dist/components/ui/Kbd.d.cts +16 -0
  119. package/dist/components/ui/Kbd.d.ts +16 -0
  120. package/dist/components/ui/NoFeaturesEmptyState.d.cts +1 -0
  121. package/dist/components/ui/NoFeaturesEmptyState.d.ts +1 -0
  122. package/dist/components/ui/SearchDropdown.d.cts +28 -0
  123. package/dist/components/ui/SearchDropdown.d.ts +28 -0
  124. package/dist/components/ui/ToolButton.d.cts +19 -0
  125. package/dist/components/ui/ToolButton.d.ts +19 -0
  126. package/dist/components/ui/Tooltip.d.cts +12 -0
  127. package/dist/components/ui/Tooltip.d.ts +12 -0
  128. package/dist/components/ui/panelHeader.d.cts +2 -0
  129. package/dist/components/ui/panelHeader.d.ts +2 -0
  130. package/dist/components/ui/resizeEdge.d.cts +4 -0
  131. package/dist/components/ui/resizeEdge.d.ts +4 -0
  132. package/dist/contexts/ElementEditorConfigContext.d.cts +351 -0
  133. package/dist/contexts/ElementEditorConfigContext.d.ts +351 -0
  134. package/dist/contexts/EventContext.d.cts +69 -0
  135. package/dist/contexts/EventContext.d.ts +69 -0
  136. package/dist/contexts/MapControllerContext.d.cts +24 -0
  137. package/dist/contexts/MapControllerContext.d.ts +24 -0
  138. package/dist/contexts/ShortcutConfigContext.d.cts +16 -0
  139. package/dist/contexts/ShortcutConfigContext.d.ts +16 -0
  140. package/dist/contexts/ThemeContext.d.cts +12 -0
  141. package/dist/contexts/ThemeContext.d.ts +12 -0
  142. package/dist/element-editor-ui.cjs +1 -0
  143. package/dist/element-editor-ui.es.js +102 -0
  144. package/dist/geometryWorker-CCwg4tNC.cjs +1 -0
  145. package/dist/geometryWorker-DgQCFSmD.js +25 -0
  146. package/dist/hooks/dragShield.d.cts +7 -0
  147. package/dist/hooks/dragShield.d.ts +7 -0
  148. package/dist/hooks/themeInputs.d.cts +14 -0
  149. package/dist/hooks/themeInputs.d.ts +14 -0
  150. package/dist/hooks/useAccentPalette.d.cts +15 -0
  151. package/dist/hooks/useAccentPalette.d.ts +15 -0
  152. package/dist/hooks/useAccentStyle.d.cts +39 -0
  153. package/dist/hooks/useAccentStyle.d.ts +39 -0
  154. package/dist/hooks/useAdapterControls.d.cts +280 -0
  155. package/dist/hooks/useAdapterControls.d.ts +280 -0
  156. package/dist/hooks/useBalancedWrap.d.cts +8 -0
  157. package/dist/hooks/useBalancedWrap.d.ts +8 -0
  158. package/dist/hooks/useContextMenu.d.cts +11 -0
  159. package/dist/hooks/useContextMenu.d.ts +11 -0
  160. package/dist/hooks/useDataChangeSubscription.d.cts +9 -0
  161. package/dist/hooks/useDataChangeSubscription.d.ts +9 -0
  162. package/dist/hooks/useDragWindow.d.cts +9 -0
  163. package/dist/hooks/useDragWindow.d.ts +9 -0
  164. package/dist/hooks/useFocusTrap.d.cts +7 -0
  165. package/dist/hooks/useFocusTrap.d.ts +7 -0
  166. package/dist/hooks/useGeoJSONDrop.d.cts +40 -0
  167. package/dist/hooks/useGeoJSONDrop.d.ts +40 -0
  168. package/dist/hooks/useGeoJSONExport.d.cts +69 -0
  169. package/dist/hooks/useGeoJSONExport.d.ts +69 -0
  170. package/dist/hooks/useGeoJSONFileImport.d.cts +24 -0
  171. package/dist/hooks/useGeoJSONFileImport.d.ts +24 -0
  172. package/dist/hooks/useInlineRename.d.cts +26 -0
  173. package/dist/hooks/useInlineRename.d.ts +26 -0
  174. package/dist/hooks/useJumpToFeature.d.cts +3 -0
  175. package/dist/hooks/useJumpToFeature.d.ts +3 -0
  176. package/dist/hooks/useKeyboardShortcuts.d.cts +9 -0
  177. package/dist/hooks/useKeyboardShortcuts.d.ts +9 -0
  178. package/dist/hooks/useNominatim.d.cts +24 -0
  179. package/dist/hooks/useNominatim.d.ts +24 -0
  180. package/dist/hooks/usePanelOffset.d.cts +14 -0
  181. package/dist/hooks/usePanelOffset.d.ts +14 -0
  182. package/dist/hooks/useResizablePanel.d.cts +4 -0
  183. package/dist/hooks/useResizablePanel.d.ts +4 -0
  184. package/dist/hooks/useRootTokens.d.cts +27 -0
  185. package/dist/hooks/useRootTokens.d.ts +27 -0
  186. package/dist/hooks/useSearchState.d.cts +23 -0
  187. package/dist/hooks/useSearchState.d.ts +23 -0
  188. package/dist/hooks/useServiceAttribution.d.cts +13 -0
  189. package/dist/hooks/useServiceAttribution.d.ts +13 -0
  190. package/dist/hooks/useWindowEscape.d.cts +25 -0
  191. package/dist/hooks/useWindowEscape.d.ts +25 -0
  192. package/dist/hooks/useWindowFocus.d.cts +4 -0
  193. package/dist/hooks/useWindowFocus.d.ts +4 -0
  194. package/dist/hooks/useWorkerGeometryPreview.d.cts +22 -0
  195. package/dist/hooks/useWorkerGeometryPreview.d.ts +22 -0
  196. package/dist/index-CILw1Du5.js +3165 -0
  197. package/dist/index-DG4wEjGj.cjs +1 -0
  198. package/dist/index.d.cts +89 -0
  199. package/dist/index.d.ts +89 -0
  200. package/dist/internal.cjs +1 -0
  201. package/dist/internal.d.cts +16 -0
  202. package/dist/internal.d.ts +16 -0
  203. package/dist/internal.es.js +42 -0
  204. package/dist/primitives.cjs +1 -0
  205. package/dist/primitives.d.cts +19 -0
  206. package/dist/primitives.d.ts +19 -0
  207. package/dist/primitives.es.js +17 -0
  208. package/dist/store/StoreContext.d.cts +17 -0
  209. package/dist/store/StoreContext.d.ts +17 -0
  210. package/dist/types/events.d.cts +95 -0
  211. package/dist/types/events.d.ts +95 -0
  212. package/dist/useAccentStyle-CPo2XqAn.js +412 -0
  213. package/dist/useAccentStyle-hsGvyHZc.cjs +1 -0
  214. package/dist/useAdapterControls-BBObhzVX.cjs +1 -0
  215. package/dist/useAdapterControls-DVjkwRZ_.js +691 -0
  216. package/dist/useContextMenu-DJ2Cti85.js +10 -0
  217. package/dist/useContextMenu-DbxMvb1s.cjs +1 -0
  218. package/dist/useFocusTrap-BBjPCfDR.cjs +1 -0
  219. package/dist/useFocusTrap-CKxKT8De.js +25 -0
  220. package/dist/useJumpToFeature-Bdz2hqOC.js +16 -0
  221. package/dist/useJumpToFeature-LwjxGzfy.cjs +1 -0
  222. package/dist/useWindowFocus-DuQVjnHE.js +80 -0
  223. package/dist/useWindowFocus-EemgNOuz.cjs +1 -0
  224. package/dist/utils/booleanValue.d.cts +4 -0
  225. package/dist/utils/booleanValue.d.ts +4 -0
  226. package/dist/utils/clipboardError.d.cts +3 -0
  227. package/dist/utils/clipboardError.d.ts +3 -0
  228. package/dist/utils/download.d.cts +42 -0
  229. package/dist/utils/download.d.ts +42 -0
  230. package/dist/utils/geojsonDocument.d.cts +168 -0
  231. package/dist/utils/geojsonDocument.d.ts +168 -0
  232. package/dist/utils/geometryWorkerClient.d.cts +6 -0
  233. package/dist/utils/geometryWorkerClient.d.ts +6 -0
  234. package/dist/utils/layerOrder.d.cts +9 -0
  235. package/dist/utils/layerOrder.d.ts +9 -0
  236. package/dist/utils/lazyWithPreload.d.cts +24 -0
  237. package/dist/utils/lazyWithPreload.d.ts +24 -0
  238. package/dist/utils/lineSmooth.d.cts +7 -0
  239. package/dist/utils/lineSmooth.d.ts +7 -0
  240. package/dist/utils/platform.d.cts +2 -0
  241. package/dist/utils/platform.d.ts +2 -0
  242. package/dist/workers/geometryWorker.d.cts +1 -0
  243. package/dist/workers/geometryWorker.d.ts +1 -0
  244. package/package.json +133 -3
@@ -0,0 +1,26 @@
1
+ interface UseInlineRenameOptions {
2
+ initialLabel: string;
3
+ onCommit: (name: string) => void;
4
+ autoFocus?: boolean;
5
+ /** When this becomes true, activates rename mode (parent-driven, e.g. via Tab navigation). */
6
+ activate?: boolean;
7
+ /** Called after commit or cancel, so parent can clear its activation id. */
8
+ onEnd?: () => void;
9
+ /** Called when Tab / Shift+Tab is pressed inside the input. Parent should commit-and-advance. */
10
+ onTab?: (direction: 'next' | 'prev') => void;
11
+ /** No renaming (readonly editor): `startRenaming` and `activate` do nothing. */
12
+ disabled?: boolean;
13
+ }
14
+ export declare function useInlineRename({ initialLabel, onCommit, autoFocus, activate, onEnd, onTab, disabled }: UseInlineRenameOptions): {
15
+ isRenaming: boolean;
16
+ startRenaming: (label: string) => void;
17
+ inputProps: {
18
+ ref: import('react').RefObject<HTMLInputElement | null>;
19
+ value: string;
20
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
21
+ onBlur: () => void;
22
+ onKeyDown: (e: React.KeyboardEvent) => void;
23
+ onClick: (e: React.MouseEvent) => void;
24
+ };
25
+ };
26
+ export {};
@@ -0,0 +1,26 @@
1
+ interface UseInlineRenameOptions {
2
+ initialLabel: string;
3
+ onCommit: (name: string) => void;
4
+ autoFocus?: boolean;
5
+ /** When this becomes true, activates rename mode (parent-driven, e.g. via Tab navigation). */
6
+ activate?: boolean;
7
+ /** Called after commit or cancel, so parent can clear its activation id. */
8
+ onEnd?: () => void;
9
+ /** Called when Tab / Shift+Tab is pressed inside the input. Parent should commit-and-advance. */
10
+ onTab?: (direction: 'next' | 'prev') => void;
11
+ /** No renaming (readonly editor): `startRenaming` and `activate` do nothing. */
12
+ disabled?: boolean;
13
+ }
14
+ export declare function useInlineRename({ initialLabel, onCommit, autoFocus, activate, onEnd, onTab, disabled }: UseInlineRenameOptions): {
15
+ isRenaming: boolean;
16
+ startRenaming: (label: string) => void;
17
+ inputProps: {
18
+ ref: import('react').RefObject<HTMLInputElement | null>;
19
+ value: string;
20
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
21
+ onBlur: () => void;
22
+ onKeyDown: (e: React.KeyboardEvent) => void;
23
+ onClick: (e: React.MouseEvent) => void;
24
+ };
25
+ };
26
+ export {};
@@ -0,0 +1,3 @@
1
+ import { GeoJSONFeature } from '@element-editor/core';
2
+ /** Moves the map to a feature: pans to a point, fits anything else. */
3
+ export declare function useJumpToFeature(): (f: GeoJSONFeature) => void;
@@ -0,0 +1,3 @@
1
+ import { GeoJSONFeature } from '@element-editor/core';
2
+ /** Moves the map to a feature: pans to a point, fits anything else. */
3
+ export declare function useJumpToFeature(): (f: GeoJSONFeature) => void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Predicate for window/document key listeners: true when the event belongs to
3
+ * the editor of the surrounding GeoStore (same rules as the global shortcuts).
4
+ * Use it in every window-level keydown/keyup that acts on editor state, so a
5
+ * key pressed in the host page or in a second editor is ignored. Stable
6
+ * identity; reads the scope at call time.
7
+ */
8
+ export declare function useIsEventForEditor(): (e: Event) => boolean;
9
+ export declare function useKeyboardShortcuts(container?: HTMLElement | null): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Predicate for window/document key listeners: true when the event belongs to
3
+ * the editor of the surrounding GeoStore (same rules as the global shortcuts).
4
+ * Use it in every window-level keydown/keyup that acts on editor state, so a
5
+ * key pressed in the host page or in a second editor is ignored. Stable
6
+ * identity; reads the scope at call time.
7
+ */
8
+ export declare function useIsEventForEditor(): (e: Event) => boolean;
9
+ export declare function useKeyboardShortcuts(container?: HTMLElement | null): void;
@@ -0,0 +1,24 @@
1
+ export interface NominatimGeometry {
2
+ type: 'Point' | 'LineString' | 'Polygon' | 'MultiPolygon';
3
+ coordinates: unknown;
4
+ }
5
+ export interface NominatimResult {
6
+ place_id: number;
7
+ display_name: string;
8
+ lat: string;
9
+ lon: string;
10
+ type: string;
11
+ addresstype: string;
12
+ geojson?: NominatimGeometry;
13
+ }
14
+ interface UseNominatimReturn {
15
+ results: NominatimResult[];
16
+ loading: boolean;
17
+ error: string | null;
18
+ /** Run the pending (debounced) search now, e.g. on Enter. No-op when none is waiting. */
19
+ flush: () => void;
20
+ }
21
+ export declare const NOMINATIM_URL = "https://nominatim.openstreetmap.org/search";
22
+ export declare const NOMINATIM_ATTRIBUTION = "Geocoding by <a href=\"https://nominatim.org/\" target=\"_blank\" rel=\"noopener\">Nominatim</a>";
23
+ export declare function useNominatim(query: string): UseNominatimReturn;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface NominatimGeometry {
2
+ type: 'Point' | 'LineString' | 'Polygon' | 'MultiPolygon';
3
+ coordinates: unknown;
4
+ }
5
+ export interface NominatimResult {
6
+ place_id: number;
7
+ display_name: string;
8
+ lat: string;
9
+ lon: string;
10
+ type: string;
11
+ addresstype: string;
12
+ geojson?: NominatimGeometry;
13
+ }
14
+ interface UseNominatimReturn {
15
+ results: NominatimResult[];
16
+ loading: boolean;
17
+ error: string | null;
18
+ /** Run the pending (debounced) search now, e.g. on Enter. No-op when none is waiting. */
19
+ flush: () => void;
20
+ }
21
+ export declare const NOMINATIM_URL = "https://nominatim.openstreetmap.org/search";
22
+ export declare const NOMINATIM_ATTRIBUTION = "Geocoding by <a href=\"https://nominatim.org/\" target=\"_blank\" rel=\"noopener\">Nominatim</a>";
23
+ export declare function useNominatim(query: string): UseNominatimReturn;
24
+ export {};
@@ -0,0 +1,14 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Publish the right-hand panels' width (open layers panel + docked GeoJSON
4
+ * inspector; 0 while the table is fullscreen) as --elm-panel-offset on the
5
+ * nearest Element root, so map controls under them (attribution) can clear
6
+ * them in every host. Called by both panels; both write the same value from
7
+ * the same store state, so whichever is mounted keeps it right. Layout effect:
8
+ * lands in the same frame as the panels' own `right` transition starts.
9
+ *
10
+ * Also keeps uiStore `narrow` in step with the root's width (the editor's,
11
+ * not the viewport's). A narrow editor's panels overlay the map, so they add
12
+ * nothing to the offset.
13
+ */
14
+ export declare function usePanelOffset(ref: RefObject<HTMLElement | null>, enabled?: boolean): void;
@@ -0,0 +1,14 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Publish the right-hand panels' width (open layers panel + docked GeoJSON
4
+ * inspector; 0 while the table is fullscreen) as --elm-panel-offset on the
5
+ * nearest Element root, so map controls under them (attribution) can clear
6
+ * them in every host. Called by both panels; both write the same value from
7
+ * the same store state, so whichever is mounted keeps it right. Layout effect:
8
+ * lands in the same frame as the panels' own `right` transition starts.
9
+ *
10
+ * Also keeps uiStore `narrow` in step with the root's width (the editor's,
11
+ * not the viewport's). A narrow editor's panels overlay the map, so they add
12
+ * nothing to the offset.
13
+ */
14
+ export declare function usePanelOffset(ref: RefObject<HTMLElement | null>, enabled?: boolean): void;
@@ -0,0 +1,4 @@
1
+ export declare function useResizablePanel(storageKey: string, defaultWidth: number, min: number, max: number): {
2
+ width: number;
3
+ onHandleMouseDown: (e: React.MouseEvent) => void;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare function useResizablePanel(storageKey: string, defaultWidth: number, min: number, max: number): {
2
+ width: number;
3
+ onHandleMouseDown: (e: React.MouseEvent) => void;
4
+ };
@@ -0,0 +1,27 @@
1
+ import { CSSProperties } from 'react';
2
+ /**
3
+ * The public design tokens. Element never declares them itself (its
4
+ * defaults live in private `--_elm-*` variables, see ui/src/styles/shared.css),
5
+ * so a token with a non-empty computed value on the editor root is one the
6
+ * integrator set: through a stylesheet rule (`.my-editor[data-elm-theme="dark"]`,
7
+ * `[data-elm-theme]`, `:root`, an ancestor class), through `style`, or through
8
+ * `accentColor`. Keep in sync with shared.css and docs/guides/theming.md.
9
+ */
10
+ export declare const THEME_TOKENS: readonly ["--elm-font", "--elm-font-mono", "--elm-radius", "--elm-radius-control", "--elm-shadow", "--elm-shadow-raised", "--elm-shadow-control", "--elm-surface", "--elm-surface-raised", "--elm-surface-sunken", "--elm-surface-hover", "--elm-control-hover", "--elm-text", "--elm-text-secondary", "--elm-text-muted", "--elm-text-subtle", "--elm-text-disabled", "--elm-border", "--elm-border-subtle", "--elm-border-strong", "--elm-focus-ring", "--elm-tooltip", "--elm-tooltip-text"];
11
+ /**
12
+ * The root's custom tokens as resolved by the browser (`{ '--elm-surface': '#fdf8f0', … }`),
13
+ * or undefined when none is set. Reads computed style: call it on theme changes, not per frame.
14
+ */
15
+ export declare function readRootTokens(root: Element | null | undefined): Record<string, string> | undefined;
16
+ /**
17
+ * The editor root's custom tokens, kept current: re-read (once per frame at most)
18
+ * when the root's style/class/mode, `<html>`'s style/class or the page's
19
+ * stylesheets change. Same object while nothing changed. Body-level portals
20
+ * spread it (through `useAccentStyle()`), because they sit outside the root and
21
+ * a rule like `.my-editor[data-elm-theme="dark"] { --elm-surface: … }` never
22
+ * matches them.
23
+ */
24
+ export declare function useRootTokens(root: HTMLElement | null | undefined): Record<string, string> | undefined;
25
+ /** The editor root's custom tokens for portals; provided by `<ElementEditor>` and `ElementEditorUIProvider`. */
26
+ export declare const RootTokensContext: import('react').Context<CSSProperties | undefined>;
27
+ export declare function applyRootTokens(el: HTMLElement, root: Element | null | undefined): void;
@@ -0,0 +1,27 @@
1
+ import { CSSProperties } from 'react';
2
+ /**
3
+ * The public design tokens. Element never declares them itself (its
4
+ * defaults live in private `--_elm-*` variables, see ui/src/styles/shared.css),
5
+ * so a token with a non-empty computed value on the editor root is one the
6
+ * integrator set: through a stylesheet rule (`.my-editor[data-elm-theme="dark"]`,
7
+ * `[data-elm-theme]`, `:root`, an ancestor class), through `style`, or through
8
+ * `accentColor`. Keep in sync with shared.css and docs/guides/theming.md.
9
+ */
10
+ export declare const THEME_TOKENS: readonly ["--elm-font", "--elm-font-mono", "--elm-radius", "--elm-radius-control", "--elm-shadow", "--elm-shadow-raised", "--elm-shadow-control", "--elm-surface", "--elm-surface-raised", "--elm-surface-sunken", "--elm-surface-hover", "--elm-control-hover", "--elm-text", "--elm-text-secondary", "--elm-text-muted", "--elm-text-subtle", "--elm-text-disabled", "--elm-border", "--elm-border-subtle", "--elm-border-strong", "--elm-focus-ring", "--elm-tooltip", "--elm-tooltip-text"];
11
+ /**
12
+ * The root's custom tokens as resolved by the browser (`{ '--elm-surface': '#fdf8f0', … }`),
13
+ * or undefined when none is set. Reads computed style: call it on theme changes, not per frame.
14
+ */
15
+ export declare function readRootTokens(root: Element | null | undefined): Record<string, string> | undefined;
16
+ /**
17
+ * The editor root's custom tokens, kept current: re-read (once per frame at most)
18
+ * when the root's style/class/mode, `<html>`'s style/class or the page's
19
+ * stylesheets change. Same object while nothing changed. Body-level portals
20
+ * spread it (through `useAccentStyle()`), because they sit outside the root and
21
+ * a rule like `.my-editor[data-elm-theme="dark"] { --elm-surface: … }` never
22
+ * matches them.
23
+ */
24
+ export declare function useRootTokens(root: HTMLElement | null | undefined): Record<string, string> | undefined;
25
+ /** The editor root's custom tokens for portals; provided by `<ElementEditor>` and `ElementEditorUIProvider`. */
26
+ export declare const RootTokensContext: import('react').Context<CSSProperties | undefined>;
27
+ export declare function applyRootTokens(el: HTMLElement, root: Element | null | undefined): void;
@@ -0,0 +1,23 @@
1
+ import { NominatimResult } from './useNominatim.cjs';
2
+ export declare function useSearchState(): {
3
+ query: string;
4
+ setQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
5
+ setOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
6
+ showDropdown: boolean;
7
+ containerRef: import('react').RefObject<HTMLDivElement | null>;
8
+ inputRef: import('react').RefObject<HTMLInputElement | null>;
9
+ focused: boolean;
10
+ setFocused: import('react').Dispatch<import('react').SetStateAction<boolean>>;
11
+ results: NominatimResult[];
12
+ loading: boolean;
13
+ error: string | null;
14
+ flyToResult: (r: NominatimResult) => void;
15
+ handleAdd: (r: NominatimResult) => void;
16
+ handleAddShape: (r: NominatimResult) => void;
17
+ clear: () => void;
18
+ activeIndex: number;
19
+ setActiveIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
20
+ handleInputKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
21
+ };
22
+ /** The key was pressed in a CodeMirror editor (the GeoJSON inspector), which has its own Cmd+F. */
23
+ export declare function inCodeEditor(e: KeyboardEvent): boolean;
@@ -0,0 +1,23 @@
1
+ import { NominatimResult } from './useNominatim.js';
2
+ export declare function useSearchState(): {
3
+ query: string;
4
+ setQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
5
+ setOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
6
+ showDropdown: boolean;
7
+ containerRef: import('react').RefObject<HTMLDivElement | null>;
8
+ inputRef: import('react').RefObject<HTMLInputElement | null>;
9
+ focused: boolean;
10
+ setFocused: import('react').Dispatch<import('react').SetStateAction<boolean>>;
11
+ results: NominatimResult[];
12
+ loading: boolean;
13
+ error: string | null;
14
+ flyToResult: (r: NominatimResult) => void;
15
+ handleAdd: (r: NominatimResult) => void;
16
+ handleAddShape: (r: NominatimResult) => void;
17
+ clear: () => void;
18
+ activeIndex: number;
19
+ setActiveIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
20
+ handleInputKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
21
+ };
22
+ /** The key was pressed in a CodeMirror editor (the GeoJSON inspector), which has its own Cmd+F. */
23
+ export declare function inCodeEditor(e: KeyboardEvent): boolean;
@@ -0,0 +1,13 @@
1
+ import { NetworkConfig, RoutingConfig } from '@element-editor/core';
2
+ /** Credits for the services in use: the geocoder while search is offered, the router while the Route tool is. */
3
+ export declare function serviceAttribution(network: NetworkConfig, on: {
4
+ search: boolean;
5
+ route: boolean;
6
+ }): string[];
7
+ /**
8
+ * This editor's routing: `config.network.routing`, with the deprecated `routingApiKey` prop as the
9
+ * key when the config gives none (`network.routing.apiKey` wins).
10
+ */
11
+ export declare function useRouting(routingApiKey?: string): RoutingConfig | false;
12
+ /** `serviceAttribution` for this editor, joined with " | " (a string, so it's stable while nothing changes). */
13
+ export declare function useServiceAttribution(routingApiKey?: string): string;
@@ -0,0 +1,13 @@
1
+ import { NetworkConfig, RoutingConfig } from '@element-editor/core';
2
+ /** Credits for the services in use: the geocoder while search is offered, the router while the Route tool is. */
3
+ export declare function serviceAttribution(network: NetworkConfig, on: {
4
+ search: boolean;
5
+ route: boolean;
6
+ }): string[];
7
+ /**
8
+ * This editor's routing: `config.network.routing`, with the deprecated `routingApiKey` prop as the
9
+ * key when the config gives none (`network.routing.apiKey` wins).
10
+ */
11
+ export declare function useRouting(routingApiKey?: string): RoutingConfig | false;
12
+ /** `serviceAttribution` for this editor, joined with " | " (a string, so it's stable while nothing changes). */
13
+ export declare function useServiceAttribution(routingApiKey?: string): string;
@@ -0,0 +1,25 @@
1
+ import { RefObject } from 'react';
2
+ /** Marks a floating window's root: the editor's global Escape handler leaves keys pressed inside it to the window. */
3
+ export declare const WINDOW_ATTR = "data-elm-window";
4
+ /**
5
+ * Close the editor's topmost open floating window (keyboard shortcuts,
6
+ * settings, schema). Called by the global Escape handler once there is
7
+ * nothing else to cancel (no dialog, tool, edit or selection), so Escape
8
+ * closes a window opened by its shortcut (K) without first clicking into it.
9
+ * Returns whether one was closed.
10
+ */
11
+ export declare function closeTopWindow(uiStore: object): boolean;
12
+ /**
13
+ * Escape + focus return for a floating window:
14
+ * - Escape pressed inside the window closes it (unless something inside
15
+ * handled it first, e.g. a key-capture field or a rename input).
16
+ * - While open it's registered for `closeTopWindow` (Escape from the map).
17
+ * - On close, focus goes back to what had it when the window opened (the
18
+ * button or the map), if it was inside the window or nowhere.
19
+ * Put `{...{ [WINDOW_ATTR]: '' }}` on the window root and pass its ref.
20
+ * `topWindow: false` (a docked panel): Escape inside still closes it, but
21
+ * Escape from the map doesn't.
22
+ */
23
+ export declare function useWindowEscape(ref: RefObject<HTMLElement | null>, open: boolean, onClose: () => void, zIndex: number, { topWindow }?: {
24
+ topWindow?: boolean;
25
+ }): void;
@@ -0,0 +1,25 @@
1
+ import { RefObject } from 'react';
2
+ /** Marks a floating window's root: the editor's global Escape handler leaves keys pressed inside it to the window. */
3
+ export declare const WINDOW_ATTR = "data-elm-window";
4
+ /**
5
+ * Close the editor's topmost open floating window (keyboard shortcuts,
6
+ * settings, schema). Called by the global Escape handler once there is
7
+ * nothing else to cancel (no dialog, tool, edit or selection), so Escape
8
+ * closes a window opened by its shortcut (K) without first clicking into it.
9
+ * Returns whether one was closed.
10
+ */
11
+ export declare function closeTopWindow(uiStore: object): boolean;
12
+ /**
13
+ * Escape + focus return for a floating window:
14
+ * - Escape pressed inside the window closes it (unless something inside
15
+ * handled it first, e.g. a key-capture field or a rename input).
16
+ * - While open it's registered for `closeTopWindow` (Escape from the map).
17
+ * - On close, focus goes back to what had it when the window opened (the
18
+ * button or the map), if it was inside the window or nowhere.
19
+ * Put `{...{ [WINDOW_ATTR]: '' }}` on the window root and pass its ref.
20
+ * `topWindow: false` (a docked panel): Escape inside still closes it, but
21
+ * Escape from the map doesn't.
22
+ */
23
+ export declare function useWindowEscape(ref: RefObject<HTMLElement | null>, open: boolean, onClose: () => void, zIndex: number, { topWindow }?: {
24
+ topWindow?: boolean;
25
+ }): void;
@@ -0,0 +1,4 @@
1
+ export declare function useWindowFocus(isOpen?: boolean): {
2
+ zIndex: number;
3
+ focus: () => void;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare function useWindowFocus(isOpen?: boolean): {
2
+ zIndex: number;
3
+ focus: () => void;
4
+ };
@@ -0,0 +1,22 @@
1
+ import { Geometry } from '@element-editor/core';
2
+ import { GeometryWorkerRequest } from '@element-editor/core/internal';
3
+ export type PreviewPayload = Extract<GeometryWorkerRequest['payload'], {
4
+ type: 'buffer' | 'simplify' | 'smooth';
5
+ }>;
6
+ /**
7
+ * Computes a live geometry preview (buffer / simplify / smooth) in the geometry
8
+ * worker so slider ticks never block the main thread.
9
+ *
10
+ * - At most one request is in flight. Ticks that arrive meanwhile collapse into a
11
+ * single queued payload (latest wins), sent when the current one settles.
12
+ * - Every request gets a sequence number. A finished result is applied only if it
13
+ * is the latest request, or a newer one is queued for the SAME source geometry
14
+ * (an intermediate frame of the same drag). Results for a replaced source, a
15
+ * cleared payload or an unmounted panel are dropped.
16
+ * - While computing, the previous preview stays on screen (no flash to empty).
17
+ * - `whenSettled(fn)` runs fn once the preview matches the latest payload, so
18
+ * Apply / Enter never commits a stale preview.
19
+ *
20
+ * `payload` must be memoised by the caller; `null` means "no preview".
21
+ */
22
+ export declare function useWorkerGeometryPreview(payload: PreviewPayload | null, setPreview: (geom: Geometry | null) => void): (fn: () => void) => void;
@@ -0,0 +1,22 @@
1
+ import { Geometry } from '@element-editor/core';
2
+ import { GeometryWorkerRequest } from '@element-editor/core/internal';
3
+ export type PreviewPayload = Extract<GeometryWorkerRequest['payload'], {
4
+ type: 'buffer' | 'simplify' | 'smooth';
5
+ }>;
6
+ /**
7
+ * Computes a live geometry preview (buffer / simplify / smooth) in the geometry
8
+ * worker so slider ticks never block the main thread.
9
+ *
10
+ * - At most one request is in flight. Ticks that arrive meanwhile collapse into a
11
+ * single queued payload (latest wins), sent when the current one settles.
12
+ * - Every request gets a sequence number. A finished result is applied only if it
13
+ * is the latest request, or a newer one is queued for the SAME source geometry
14
+ * (an intermediate frame of the same drag). Results for a replaced source, a
15
+ * cleared payload or an unmounted panel are dropped.
16
+ * - While computing, the previous preview stays on screen (no flash to empty).
17
+ * - `whenSettled(fn)` runs fn once the preview matches the latest payload, so
18
+ * Apply / Enter never commits a stale preview.
19
+ *
20
+ * `payload` must be memoised by the caller; `null` means "no preview".
21
+ */
22
+ export declare function useWorkerGeometryPreview(payload: PreviewPayload | null, setPreview: (geom: Geometry | null) => void): (fn: () => void) => void;