@element-editor/ui 0.0.0-stage → 0.2.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/AGENTS.md +65 -0
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/dist/BooleanOperations-WXcmW9Vy.cjs +1 -0
- package/dist/BooleanOperations-oF0WybQP.js +111 -0
- package/dist/DataTable-CNfB01y2.cjs +2 -0
- package/dist/DataTable-DNmjUwka.js +510 -0
- package/dist/DataTablePanel-BknCxC1K.cjs +1 -0
- package/dist/DataTablePanel-rWdaQubk.js +208 -0
- package/dist/EditToolbarBtn-SZIsnIn3.js +378 -0
- package/dist/EditToolbarBtn-dpCmKnzk.cjs +3 -0
- package/dist/FeatureEditModal-BF-fGhVD.js +77 -0
- package/dist/FeatureEditModal-CM6BObUO.cjs +1 -0
- package/dist/FeatureList-CQb2kTrV.js +520 -0
- package/dist/FeatureList-Csr-anLA.cjs +1 -0
- package/dist/FeatureRowContextMenu-BLt7VlUU.js +130 -0
- package/dist/FeatureRowContextMenu-Gwq3OMEA.cjs +1 -0
- package/dist/GeoJSONModal-BPFWeaLZ.js +886 -0
- package/dist/GeoJSONModal-iwUcvrg7.cjs +9 -0
- package/dist/SchemaEditor-BEsKUe2p.js +293 -0
- package/dist/SchemaEditor-qkoYMg0C.cjs +1 -0
- package/dist/SchemaModal-9nNrgorr.js +95 -0
- package/dist/SchemaModal-GrtgA7cH.cjs +1 -0
- package/dist/SettingsModal-6_qmRyCi.cjs +1 -0
- package/dist/SettingsModal-DTP0Xx_Z.js +237 -0
- package/dist/ShortcutsModal-CdyQlrqK.cjs +1 -0
- package/dist/ShortcutsModal-DwxZu71W.js +299 -0
- package/dist/components/ActiveDrawingToolbar.d.cts +1 -0
- package/dist/components/ActiveDrawingToolbar.d.ts +1 -0
- package/dist/components/BasemapPicker.d.cts +26 -0
- package/dist/components/BasemapPicker.d.ts +26 -0
- package/dist/components/BooleanOperations.d.cts +1 -0
- package/dist/components/BooleanOperations.d.ts +1 -0
- package/dist/components/BufferPanel.d.cts +1 -0
- package/dist/components/BufferPanel.d.ts +1 -0
- package/dist/components/DataTable.d.cts +9 -0
- package/dist/components/DataTable.d.ts +9 -0
- package/dist/components/DataTablePanel.d.cts +10 -0
- package/dist/components/DataTablePanel.d.ts +10 -0
- package/dist/components/EditingToolbar.d.cts +1 -0
- package/dist/components/EditingToolbar.d.ts +1 -0
- package/dist/components/ElementEditorErrorBoundary.d.cts +28 -0
- package/dist/components/ElementEditorErrorBoundary.d.ts +28 -0
- package/dist/components/ElementEditorUIProvider.d.cts +50 -0
- package/dist/components/ElementEditorUIProvider.d.ts +50 -0
- package/dist/components/FeatureMapContextMenu.d.cts +23 -0
- package/dist/components/FeatureMapContextMenu.d.ts +23 -0
- package/dist/components/FitBoundsButton.d.cts +6 -0
- package/dist/components/FitBoundsButton.d.ts +6 -0
- package/dist/components/FloatingToolbar.d.cts +3 -0
- package/dist/components/FloatingToolbar.d.ts +3 -0
- package/dist/components/LocateButton.d.cts +11 -0
- package/dist/components/LocateButton.d.ts +11 -0
- package/dist/components/ReadonlyBanner.d.cts +1 -0
- package/dist/components/ReadonlyBanner.d.ts +1 -0
- package/dist/components/ShortcutsModal.d.cts +1 -0
- package/dist/components/ShortcutsModal.d.ts +1 -0
- package/dist/components/SimplifyPanel.d.cts +1 -0
- package/dist/components/SimplifyPanel.d.ts +1 -0
- package/dist/components/SmoothPanel.d.cts +1 -0
- package/dist/components/SmoothPanel.d.ts +1 -0
- package/dist/components/UndoRedoToolbar.d.cts +20 -0
- package/dist/components/UndoRedoToolbar.d.ts +20 -0
- package/dist/components/VertexSelectionBar.d.cts +12 -0
- package/dist/components/VertexSelectionBar.d.ts +12 -0
- package/dist/components/ZoomIndicator.d.cts +15 -0
- package/dist/components/ZoomIndicator.d.ts +15 -0
- package/dist/components/dialogs/DynamicFieldRenderer.d.cts +11 -0
- package/dist/components/dialogs/DynamicFieldRenderer.d.ts +11 -0
- package/dist/components/dialogs/SettingsModal.d.cts +1 -0
- package/dist/components/dialogs/SettingsModal.d.ts +1 -0
- package/dist/components/lazyParts.d.cts +12 -0
- package/dist/components/lazyParts.d.ts +12 -0
- package/dist/components/sidebar/FeatureEditModal.d.cts +6 -0
- package/dist/components/sidebar/FeatureEditModal.d.ts +6 -0
- package/dist/components/sidebar/FeatureList.d.cts +4 -0
- package/dist/components/sidebar/FeatureList.d.ts +4 -0
- package/dist/components/sidebar/FeatureRow.d.cts +38 -0
- package/dist/components/sidebar/FeatureRow.d.ts +38 -0
- package/dist/components/sidebar/FeatureRowContextMenu.d.cts +12 -0
- package/dist/components/sidebar/FeatureRowContextMenu.d.ts +12 -0
- package/dist/components/sidebar/FeatureSidePanel.d.cts +8 -0
- package/dist/components/sidebar/FeatureSidePanel.d.ts +8 -0
- package/dist/components/sidebar/GeoJSONModal.d.cts +5 -0
- package/dist/components/sidebar/GeoJSONModal.d.ts +5 -0
- package/dist/components/sidebar/GroupRow.d.cts +21 -0
- package/dist/components/sidebar/GroupRow.d.ts +21 -0
- package/dist/components/sidebar/HideLayersToggle.d.cts +2 -0
- package/dist/components/sidebar/HideLayersToggle.d.ts +2 -0
- package/dist/components/sidebar/LayersPanel.d.cts +5 -0
- package/dist/components/sidebar/LayersPanel.d.ts +5 -0
- package/dist/components/sidebar/PartSubRow.d.cts +9 -0
- package/dist/components/sidebar/PartSubRow.d.ts +9 -0
- package/dist/components/sidebar/SchemaEditor.d.cts +4 -0
- package/dist/components/sidebar/SchemaEditor.d.ts +4 -0
- package/dist/components/sidebar/SchemaModal.d.cts +5 -0
- package/dist/components/sidebar/SchemaModal.d.ts +5 -0
- package/dist/components/sidebar/codeDock.d.cts +21 -0
- package/dist/components/sidebar/codeDock.d.ts +21 -0
- package/dist/components/ui/Button.d.cts +9 -0
- package/dist/components/ui/Button.d.ts +9 -0
- package/dist/components/ui/CloseButton.d.cts +6 -0
- package/dist/components/ui/CloseButton.d.ts +6 -0
- package/dist/components/ui/ContextMenu.d.cts +28 -0
- package/dist/components/ui/ContextMenu.d.ts +28 -0
- package/dist/components/ui/EditToolbarBtn.d.cts +13 -0
- package/dist/components/ui/EditToolbarBtn.d.ts +13 -0
- package/dist/components/ui/ElementToaster.d.cts +3 -0
- package/dist/components/ui/ElementToaster.d.ts +3 -0
- package/dist/components/ui/GeometryTypeIcon.d.cts +7 -0
- package/dist/components/ui/GeometryTypeIcon.d.ts +7 -0
- package/dist/components/ui/IconButton.d.cts +28 -0
- package/dist/components/ui/IconButton.d.ts +28 -0
- package/dist/components/ui/Input.d.cts +14 -0
- package/dist/components/ui/Input.d.ts +14 -0
- package/dist/components/ui/JsonCode.d.cts +4 -0
- package/dist/components/ui/JsonCode.d.ts +4 -0
- package/dist/components/ui/Kbd.d.cts +16 -0
- package/dist/components/ui/Kbd.d.ts +16 -0
- package/dist/components/ui/NoFeaturesEmptyState.d.cts +1 -0
- package/dist/components/ui/NoFeaturesEmptyState.d.ts +1 -0
- package/dist/components/ui/SearchDropdown.d.cts +28 -0
- package/dist/components/ui/SearchDropdown.d.ts +28 -0
- package/dist/components/ui/ToolButton.d.cts +19 -0
- package/dist/components/ui/ToolButton.d.ts +19 -0
- package/dist/components/ui/Tooltip.d.cts +12 -0
- package/dist/components/ui/Tooltip.d.ts +12 -0
- package/dist/components/ui/panelHeader.d.cts +2 -0
- package/dist/components/ui/panelHeader.d.ts +2 -0
- package/dist/components/ui/resizeEdge.d.cts +4 -0
- package/dist/components/ui/resizeEdge.d.ts +4 -0
- package/dist/contexts/ElementEditorConfigContext.d.cts +351 -0
- package/dist/contexts/ElementEditorConfigContext.d.ts +351 -0
- package/dist/contexts/EventContext.d.cts +69 -0
- package/dist/contexts/EventContext.d.ts +69 -0
- package/dist/contexts/MapControllerContext.d.cts +24 -0
- package/dist/contexts/MapControllerContext.d.ts +24 -0
- package/dist/contexts/ShortcutConfigContext.d.cts +16 -0
- package/dist/contexts/ShortcutConfigContext.d.ts +16 -0
- package/dist/contexts/ThemeContext.d.cts +12 -0
- package/dist/contexts/ThemeContext.d.ts +12 -0
- package/dist/element-editor-ui.cjs +1 -0
- package/dist/element-editor-ui.es.js +102 -0
- package/dist/geometryWorker-CCwg4tNC.cjs +1 -0
- package/dist/geometryWorker-DgQCFSmD.js +25 -0
- package/dist/hooks/dragShield.d.cts +7 -0
- package/dist/hooks/dragShield.d.ts +7 -0
- package/dist/hooks/themeInputs.d.cts +14 -0
- package/dist/hooks/themeInputs.d.ts +14 -0
- package/dist/hooks/useAccentPalette.d.cts +15 -0
- package/dist/hooks/useAccentPalette.d.ts +15 -0
- package/dist/hooks/useAccentStyle.d.cts +39 -0
- package/dist/hooks/useAccentStyle.d.ts +39 -0
- package/dist/hooks/useAdapterControls.d.cts +280 -0
- package/dist/hooks/useAdapterControls.d.ts +280 -0
- package/dist/hooks/useBalancedWrap.d.cts +8 -0
- package/dist/hooks/useBalancedWrap.d.ts +8 -0
- package/dist/hooks/useContextMenu.d.cts +11 -0
- package/dist/hooks/useContextMenu.d.ts +11 -0
- package/dist/hooks/useDataChangeSubscription.d.cts +9 -0
- package/dist/hooks/useDataChangeSubscription.d.ts +9 -0
- package/dist/hooks/useDragWindow.d.cts +9 -0
- package/dist/hooks/useDragWindow.d.ts +9 -0
- package/dist/hooks/useFocusTrap.d.cts +7 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -0
- package/dist/hooks/useGeoJSONDrop.d.cts +40 -0
- package/dist/hooks/useGeoJSONDrop.d.ts +40 -0
- package/dist/hooks/useGeoJSONExport.d.cts +69 -0
- package/dist/hooks/useGeoJSONExport.d.ts +69 -0
- package/dist/hooks/useGeoJSONFileImport.d.cts +24 -0
- package/dist/hooks/useGeoJSONFileImport.d.ts +24 -0
- package/dist/hooks/useInlineRename.d.cts +26 -0
- package/dist/hooks/useInlineRename.d.ts +26 -0
- package/dist/hooks/useJumpToFeature.d.cts +3 -0
- package/dist/hooks/useJumpToFeature.d.ts +3 -0
- package/dist/hooks/useKeyboardShortcuts.d.cts +9 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +9 -0
- package/dist/hooks/useNominatim.d.cts +24 -0
- package/dist/hooks/useNominatim.d.ts +24 -0
- package/dist/hooks/usePanelOffset.d.cts +14 -0
- package/dist/hooks/usePanelOffset.d.ts +14 -0
- package/dist/hooks/useResizablePanel.d.cts +4 -0
- package/dist/hooks/useResizablePanel.d.ts +4 -0
- package/dist/hooks/useRootTokens.d.cts +27 -0
- package/dist/hooks/useRootTokens.d.ts +27 -0
- package/dist/hooks/useSearchState.d.cts +23 -0
- package/dist/hooks/useSearchState.d.ts +23 -0
- package/dist/hooks/useServiceAttribution.d.cts +13 -0
- package/dist/hooks/useServiceAttribution.d.ts +13 -0
- package/dist/hooks/useWindowEscape.d.cts +25 -0
- package/dist/hooks/useWindowEscape.d.ts +25 -0
- package/dist/hooks/useWindowFocus.d.cts +4 -0
- package/dist/hooks/useWindowFocus.d.ts +4 -0
- package/dist/hooks/useWorkerGeometryPreview.d.cts +22 -0
- package/dist/hooks/useWorkerGeometryPreview.d.ts +22 -0
- package/dist/index-BKdDZ4Y9.cjs +1 -0
- package/dist/index-CtZterPc.js +3165 -0
- package/dist/index.d.cts +89 -0
- package/dist/index.d.ts +89 -0
- package/dist/internal.cjs +1 -0
- package/dist/internal.d.cts +16 -0
- package/dist/internal.d.ts +16 -0
- package/dist/internal.es.js +42 -0
- package/dist/primitives.cjs +1 -0
- package/dist/primitives.d.cts +19 -0
- package/dist/primitives.d.ts +19 -0
- package/dist/primitives.es.js +17 -0
- package/dist/store/StoreContext.d.cts +17 -0
- package/dist/store/StoreContext.d.ts +17 -0
- package/dist/types/events.d.cts +95 -0
- package/dist/types/events.d.ts +95 -0
- package/dist/useAccentStyle-CPo2XqAn.js +412 -0
- package/dist/useAccentStyle-hsGvyHZc.cjs +1 -0
- package/dist/useAdapterControls-BBObhzVX.cjs +1 -0
- package/dist/useAdapterControls-DVjkwRZ_.js +691 -0
- package/dist/useContextMenu-DJ2Cti85.js +10 -0
- package/dist/useContextMenu-DbxMvb1s.cjs +1 -0
- package/dist/useFocusTrap-BBjPCfDR.cjs +1 -0
- package/dist/useFocusTrap-CKxKT8De.js +25 -0
- package/dist/useJumpToFeature-Bdz2hqOC.js +16 -0
- package/dist/useJumpToFeature-LwjxGzfy.cjs +1 -0
- package/dist/useWindowFocus-D-_yEm_V.cjs +1 -0
- package/dist/useWindowFocus-DGAWA1au.js +80 -0
- package/dist/utils/booleanValue.d.cts +4 -0
- package/dist/utils/booleanValue.d.ts +4 -0
- package/dist/utils/clipboardError.d.cts +3 -0
- package/dist/utils/clipboardError.d.ts +3 -0
- package/dist/utils/download.d.cts +42 -0
- package/dist/utils/download.d.ts +42 -0
- package/dist/utils/geojsonDocument.d.cts +168 -0
- package/dist/utils/geojsonDocument.d.ts +168 -0
- package/dist/utils/geometryWorkerClient.d.cts +6 -0
- package/dist/utils/geometryWorkerClient.d.ts +6 -0
- package/dist/utils/layerOrder.d.cts +9 -0
- package/dist/utils/layerOrder.d.ts +9 -0
- package/dist/utils/lazyWithPreload.d.cts +24 -0
- package/dist/utils/lazyWithPreload.d.ts +24 -0
- package/dist/utils/lineSmooth.d.cts +7 -0
- package/dist/utils/lineSmooth.d.ts +7 -0
- package/dist/utils/platform.d.cts +2 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/workers/geometryWorker.d.cts +1 -0
- package/dist/workers/geometryWorker.d.ts +1 -0
- package/package.json +133 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as o, jsxs as s, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as B } from "react";
|
|
3
|
+
import { MagnifyingGlassPlus as y, PencilSimple as z, Eye as M, EyeSlash as F, CopySimple as Z, FolderMinus as j, FolderPlus as A, StackPlus as U, Shapes as $, Trash as K } from "@phosphor-icons/react";
|
|
4
|
+
import { getGeometryBBox as L } from "@element-editor/core";
|
|
5
|
+
import { isMultiGeometry as R, getPartCount as T } from "@element-editor/core/internal";
|
|
6
|
+
import { e as q, h as v, g as J, f as c, u as G } from "./useAdapterControls-DVjkwRZ_.js";
|
|
7
|
+
import { C as N, a as i } from "./EditToolbarBtn-SZIsnIn3.js";
|
|
8
|
+
import { l as O } from "./index-CtZterPc.js";
|
|
9
|
+
function te({ x, y: D, feature: e, onClose: I, showGrouping: E = !0 }) {
|
|
10
|
+
const { dataStore: n, uiStore: P } = q(), a = v(), { fitBounds: d, flyTo: u } = J(), l = c((t) => t.selectedIds), m = B(() => new Set(l), [l]), w = c((t) => t.deleteFeature), H = c((t) => t.duplicateFeature), g = c((t) => t.toggleFeatureHidden), p = G((t) => t.openEditDialog), f = G((t) => t.readonly), h = l.length >= 2 && m.has(e.id), S = R(e.geometry);
|
|
11
|
+
function b() {
|
|
12
|
+
if (e.geometry.type === "Point") {
|
|
13
|
+
const [t, C] = e.geometry.coordinates;
|
|
14
|
+
u == null || u([C, t], Math.max(n.getState().currentZoom, 16));
|
|
15
|
+
} else
|
|
16
|
+
d == null || d(e.bbox || L(e.geometry));
|
|
17
|
+
}
|
|
18
|
+
function k() {
|
|
19
|
+
const t = n.getState();
|
|
20
|
+
return m.has(e.id) && l.length > 1 || t.setSelection([e.id]), t;
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ o(
|
|
23
|
+
N,
|
|
24
|
+
{
|
|
25
|
+
x,
|
|
26
|
+
y: D,
|
|
27
|
+
onClose: I,
|
|
28
|
+
items: f ? [
|
|
29
|
+
{
|
|
30
|
+
label: "Zoom to feature",
|
|
31
|
+
icon: /* @__PURE__ */ o(y, { size: 16 }),
|
|
32
|
+
onClick: b
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Details",
|
|
36
|
+
icon: /* @__PURE__ */ o(z, { size: 16 }),
|
|
37
|
+
onClick: () => p(e.id)
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: e.hidden ? "Show on map" : "Hide from map",
|
|
41
|
+
icon: e.hidden ? /* @__PURE__ */ o(M, { size: 16 }) : /* @__PURE__ */ o(F, { size: 16 }),
|
|
42
|
+
onClick: () => g(e.id)
|
|
43
|
+
}
|
|
44
|
+
] : [
|
|
45
|
+
{
|
|
46
|
+
label: "Zoom to feature",
|
|
47
|
+
icon: /* @__PURE__ */ o(y, { size: 16 }),
|
|
48
|
+
onClick: b
|
|
49
|
+
},
|
|
50
|
+
{ separator: !0 },
|
|
51
|
+
{
|
|
52
|
+
label: "Edit",
|
|
53
|
+
icon: /* @__PURE__ */ o(z, { size: 16 }),
|
|
54
|
+
shortcut: /* @__PURE__ */ s(r, { children: [
|
|
55
|
+
/* @__PURE__ */ o(i, { children: "⌘" }),
|
|
56
|
+
/* @__PURE__ */ o(i, { children: "E" })
|
|
57
|
+
] }),
|
|
58
|
+
onClick: () => p(e.id)
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Duplicate",
|
|
62
|
+
icon: /* @__PURE__ */ o(Z, { size: 16 }),
|
|
63
|
+
shortcut: /* @__PURE__ */ s(r, { children: [
|
|
64
|
+
/* @__PURE__ */ o(i, { children: "⌘" }),
|
|
65
|
+
/* @__PURE__ */ o(i, { children: "D" })
|
|
66
|
+
] }),
|
|
67
|
+
onClick: () => H(e.id)
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: e.hidden ? "Show on map" : "Hide from map",
|
|
71
|
+
icon: e.hidden ? /* @__PURE__ */ o(M, { size: 16 }) : /* @__PURE__ */ o(F, { size: 16 }),
|
|
72
|
+
onClick: () => g(e.id)
|
|
73
|
+
},
|
|
74
|
+
...E ? [
|
|
75
|
+
{ separator: !0 },
|
|
76
|
+
e.groupId ? {
|
|
77
|
+
label: "Ungroup",
|
|
78
|
+
icon: /* @__PURE__ */ o(j, { size: 16 }),
|
|
79
|
+
shortcut: /* @__PURE__ */ s(r, { children: [
|
|
80
|
+
/* @__PURE__ */ o(i, { children: "⌘" }),
|
|
81
|
+
/* @__PURE__ */ o(i, { children: "⇧" }),
|
|
82
|
+
/* @__PURE__ */ o(i, { children: "G" })
|
|
83
|
+
] }),
|
|
84
|
+
onClick: () => k().ungroupSelection()
|
|
85
|
+
} : {
|
|
86
|
+
label: "Group",
|
|
87
|
+
icon: /* @__PURE__ */ o(A, { size: 16 }),
|
|
88
|
+
shortcut: /* @__PURE__ */ s(r, { children: [
|
|
89
|
+
/* @__PURE__ */ o(i, { children: "⌘" }),
|
|
90
|
+
/* @__PURE__ */ o(i, { children: "G" })
|
|
91
|
+
] }),
|
|
92
|
+
onClick: () => {
|
|
93
|
+
const t = k().groupSelection();
|
|
94
|
+
t && P.getState().setAutoFocusGroupId(t);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
] : [],
|
|
98
|
+
...h || S ? [
|
|
99
|
+
{ separator: !0 },
|
|
100
|
+
...h ? [{
|
|
101
|
+
label: `Merge ${l.length} features`,
|
|
102
|
+
icon: /* @__PURE__ */ o(U, { size: 16 }),
|
|
103
|
+
onClick: () => {
|
|
104
|
+
n.getState().mergeFeatures(), a({ type: "success", message: `Merged ${l.length} features` });
|
|
105
|
+
}
|
|
106
|
+
}] : [],
|
|
107
|
+
...S ? [{
|
|
108
|
+
label: "Break apart",
|
|
109
|
+
icon: /* @__PURE__ */ o($, { size: 16 }),
|
|
110
|
+
onClick: () => {
|
|
111
|
+
const t = T(e.geometry);
|
|
112
|
+
n.getState().breakMultiGeometry(e.id) && a({ type: "feature:broken", featureId: e.id, count: t, undo: () => n.getState().undo() });
|
|
113
|
+
}
|
|
114
|
+
}] : []
|
|
115
|
+
] : [],
|
|
116
|
+
{ separator: !0 },
|
|
117
|
+
{
|
|
118
|
+
label: "Delete",
|
|
119
|
+
icon: /* @__PURE__ */ o(K, { size: 16 }),
|
|
120
|
+
onClick: () => {
|
|
121
|
+
w(e.id), a({ type: "feature:deleted", featureId: e.id, label: O(e), undo: () => n.getState().undo() });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
te as F
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),G=require("react"),n=require("@phosphor-icons/react"),I=require("@element-editor/core"),b=require("@element-editor/core/internal"),i=require("./useAdapterControls-BBObhzVX.cjs"),s=require("./EditToolbarBtn-dpCmKnzk.cjs"),K=require("./index-BKdDZ4Y9.cjs");function q({x:k,y,feature:t,onClose:C,showGrouping:D=!0}){const{dataStore:r,uiStore:F}=i.useGeoStore(),c=i.useEmit(),{fitBounds:a,flyTo:d}=i.useMapController(),l=i.useDataStore(o=>o.selectedIds),u=G.useMemo(()=>new Set(l),[l]),M=i.useDataStore(o=>o.deleteFeature),z=i.useDataStore(o=>o.duplicateFeature),g=i.useDataStore(o=>o.toggleFeatureHidden),x=i.useUIStore(o=>o.openEditDialog),E=i.useUIStore(o=>o.readonly),h=l.length>=2&&u.has(t.id),m=b.isMultiGeometry(t.geometry);function p(){if(t.geometry.type==="Point"){const[o,j]=t.geometry.coordinates;d==null||d([j,o],Math.max(r.getState().currentZoom,16))}else a==null||a(t.bbox||I.getGeometryBBox(t.geometry))}function S(){const o=r.getState();return u.has(t.id)&&l.length>1||o.setSelection([t.id]),o}return e.jsx(s.ContextMenu,{x:k,y,onClose:C,items:E?[{label:"Zoom to feature",icon:e.jsx(n.MagnifyingGlassPlus,{size:16}),onClick:p},{label:"Details",icon:e.jsx(n.PencilSimple,{size:16}),onClick:()=>x(t.id)},{label:t.hidden?"Show on map":"Hide from map",icon:t.hidden?e.jsx(n.Eye,{size:16}):e.jsx(n.EyeSlash,{size:16}),onClick:()=>g(t.id)}]:[{label:"Zoom to feature",icon:e.jsx(n.MagnifyingGlassPlus,{size:16}),onClick:p},{separator:!0},{label:"Edit",icon:e.jsx(n.PencilSimple,{size:16}),shortcut:e.jsxs(e.Fragment,{children:[e.jsx(s.KbdDark,{children:"⌘"}),e.jsx(s.KbdDark,{children:"E"})]}),onClick:()=>x(t.id)},{label:"Duplicate",icon:e.jsx(n.CopySimple,{size:16}),shortcut:e.jsxs(e.Fragment,{children:[e.jsx(s.KbdDark,{children:"⌘"}),e.jsx(s.KbdDark,{children:"D"})]}),onClick:()=>z(t.id)},{label:t.hidden?"Show on map":"Hide from map",icon:t.hidden?e.jsx(n.Eye,{size:16}):e.jsx(n.EyeSlash,{size:16}),onClick:()=>g(t.id)},...D?[{separator:!0},t.groupId?{label:"Ungroup",icon:e.jsx(n.FolderMinus,{size:16}),shortcut:e.jsxs(e.Fragment,{children:[e.jsx(s.KbdDark,{children:"⌘"}),e.jsx(s.KbdDark,{children:"⇧"}),e.jsx(s.KbdDark,{children:"G"})]}),onClick:()=>S().ungroupSelection()}:{label:"Group",icon:e.jsx(n.FolderPlus,{size:16}),shortcut:e.jsxs(e.Fragment,{children:[e.jsx(s.KbdDark,{children:"⌘"}),e.jsx(s.KbdDark,{children:"G"})]}),onClick:()=>{const o=S().groupSelection();o&&F.getState().setAutoFocusGroupId(o)}}]:[],...h||m?[{separator:!0},...h?[{label:`Merge ${l.length} features`,icon:e.jsx(n.StackPlus,{size:16}),onClick:()=>{r.getState().mergeFeatures(),c({type:"success",message:`Merged ${l.length} features`})}}]:[],...m?[{label:"Break apart",icon:e.jsx(n.Shapes,{size:16}),onClick:()=>{const o=b.getPartCount(t.geometry);r.getState().breakMultiGeometry(t.id)&&c({type:"feature:broken",featureId:t.id,count:o,undo:()=>r.getState().undo()})}}]:[]]:[],{separator:!0},{label:"Delete",icon:e.jsx(n.Trash,{size:16}),onClick:()=>{M(t.id),c({type:"feature:deleted",featureId:t.id,label:K.featureLabel(t),undo:()=>r.getState().undo()})}}]})}exports.FeatureRowContextMenu=q;
|