maplibre-gl-geo-editor 0.1.0 → 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.
@@ -103,6 +103,25 @@
103
103
  flex-direction: row;
104
104
  }
105
105
 
106
+ /* Multi-column layout for button groups (vertical orientation only) */
107
+ .geo-editor-toolbar--vertical.geo-editor-toolbar--columns-2 .geo-editor-tool-buttons {
108
+ display: grid;
109
+ grid-template-columns: repeat(2, 1fr);
110
+ gap: 2px;
111
+ }
112
+
113
+ .geo-editor-toolbar--vertical.geo-editor-toolbar--columns-3 .geo-editor-tool-buttons {
114
+ display: grid;
115
+ grid-template-columns: repeat(3, 1fr);
116
+ gap: 2px;
117
+ }
118
+
119
+ .geo-editor-toolbar--vertical.geo-editor-toolbar--columns-4 .geo-editor-tool-buttons {
120
+ display: grid;
121
+ grid-template-columns: repeat(4, 1fr);
122
+ gap: 2px;
123
+ }
124
+
106
125
  /* Tool button */
107
126
  .geo-editor-tool-button {
108
127
  display: flex;
@@ -477,6 +496,50 @@
477
496
  }
478
497
  }
479
498
 
499
+ /* ============================================================================
500
+ Feature Properties Popup
501
+ ============================================================================ */
502
+
503
+ .geo-editor-properties-popup .maplibregl-popup-content {
504
+ padding: 10px;
505
+ max-height: 300px;
506
+ overflow-y: auto;
507
+ }
508
+
509
+ .geo-editor-popup-table {
510
+ border-collapse: collapse;
511
+ width: 100%;
512
+ font-size: 12px;
513
+ }
514
+
515
+ .geo-editor-popup-table td {
516
+ padding: 4px 8px;
517
+ border-bottom: 1px solid #e0e0e0;
518
+ }
519
+
520
+ .geo-editor-popup-table tr:last-child td {
521
+ border-bottom: none;
522
+ }
523
+
524
+ .geo-editor-popup-key {
525
+ font-weight: 600;
526
+ color: #333;
527
+ white-space: nowrap;
528
+ vertical-align: top;
529
+ }
530
+
531
+ .geo-editor-popup-value {
532
+ color: #666;
533
+ word-break: break-word;
534
+ }
535
+
536
+ .geo-editor-popup-empty {
537
+ color: #999;
538
+ font-style: italic;
539
+ padding: 8px;
540
+ text-align: center;
541
+ }
542
+
480
543
  /* ============================================================================
481
544
  Responsive Adjustments
482
545
  ============================================================================ */
package/dist/react.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const react = require("react");
4
- const index = require("./index.cjs");
4
+ const geoEditor = require("./geo-editor-BuiaF8-T.cjs");
5
5
  function GeoEditorReact({
6
6
  map,
7
7
  geoman,
@@ -11,7 +11,7 @@ function GeoEditorReact({
11
11
  const controlRef = react.useRef(null);
12
12
  react.useEffect(() => {
13
13
  if (!map) return;
14
- const control = new index.GeoEditor({ ...options, position });
14
+ const control = new geoEditor.GeoEditor({ ...options, position });
15
15
  controlRef.current = control;
16
16
  map.addControl(control, position);
17
17
  if (geoman) {
@@ -35,7 +35,7 @@ function useGeoEditor(map, options = {}) {
35
35
  const controlRef = react.useRef(null);
36
36
  react.useEffect(() => {
37
37
  if (!map) return;
38
- const control = new index.GeoEditor(options);
38
+ const control = new geoEditor.GeoEditor(options);
39
39
  controlRef.current = control;
40
40
  map.addControl(control, options.position || "top-left");
41
41
  return () => {
@@ -73,6 +73,18 @@ function useGeoEditor(map, options = {}) {
73
73
  var _a;
74
74
  (_a = controlRef.current) == null ? void 0 : _a.clearSelection();
75
75
  }, []);
76
+ const openFileDialog = react.useCallback(() => {
77
+ var _a;
78
+ (_a = controlRef.current) == null ? void 0 : _a.openFileDialog();
79
+ }, []);
80
+ const loadGeoJson = react.useCallback((geoJson, filename) => {
81
+ var _a;
82
+ return (_a = controlRef.current) == null ? void 0 : _a.loadGeoJson(geoJson, filename);
83
+ }, []);
84
+ const saveGeoJson = react.useCallback((filename) => {
85
+ var _a;
86
+ return (_a = controlRef.current) == null ? void 0 : _a.saveGeoJson(filename);
87
+ }, []);
76
88
  return {
77
89
  control: controlRef.current,
78
90
  enableDrawMode,
@@ -81,77 +93,81 @@ function useGeoEditor(map, options = {}) {
81
93
  copySelected,
82
94
  pasteFeatures,
83
95
  deleteSelected,
84
- clearSelection
96
+ clearSelection,
97
+ openFileDialog,
98
+ loadGeoJson,
99
+ saveGeoJson
85
100
  };
86
101
  }
87
- exports.ADVANCED_EDIT_MODES = index.ADVANCED_EDIT_MODES;
88
- exports.CSS_PREFIX = index.CSS_PREFIX;
89
- exports.CopyFeature = index.CopyFeature;
90
- exports.DEFAULT_DRAW_MODES = index.DEFAULT_DRAW_MODES;
91
- exports.DEFAULT_EDIT_MODES = index.DEFAULT_EDIT_MODES;
92
- exports.DEFAULT_OPTIONS = index.DEFAULT_OPTIONS;
93
- exports.DifferenceFeature = index.DifferenceFeature;
94
- exports.GeoEditor = index.GeoEditor;
95
- exports.LassoFeature = index.LassoFeature;
96
- exports.ScaleFeature = index.ScaleFeature;
97
- exports.SimplifyFeature = index.SimplifyFeature;
98
- exports.SplitFeature = index.SplitFeature;
99
- exports.UnionFeature = index.UnionFeature;
100
- exports.addToSelection = index.addToSelection;
101
- exports.bearingBetweenPoints = index.bearingBetweenPoints;
102
- exports.calculateArea = index.calculateArea;
103
- exports.calculateLength = index.calculateLength;
104
- exports.calculateScaleFactor = index.calculateScaleFactor;
105
- exports.canMergeFeatures = index.canMergeFeatures;
106
- exports.canSubtractFeatures = index.canSubtractFeatures;
107
- exports.clamp = index.clamp;
108
- exports.cloneFeature = index.cloneFeature;
109
- exports.contains = index.contains;
110
- exports.createFeatureCollection = index.createFeatureCollection;
111
- exports.createLine = index.createLine;
112
- exports.createPoint = index.createPoint;
113
- exports.createPolygon = index.createPolygon;
114
- exports.degreesToRadians = index.degreesToRadians;
115
- exports.distanceBetweenPoints = index.distanceBetweenPoints;
116
- exports.ensureFeatureId = index.ensureFeatureId;
117
- exports.filterByGeometryType = index.filterByGeometryType;
118
- exports.fromSelectedFeatures = index.fromSelectedFeatures;
119
- exports.generateFeatureId = index.generateFeatureId;
120
- exports.getBBox = index.getBBox;
121
- exports.getBBoxCenter = index.getBBoxCenter;
122
- exports.getBBoxCorners = index.getBBoxCorners;
123
- exports.getBBoxMidpoints = index.getBBoxMidpoints;
124
- exports.getCenter = index.getCenter;
125
- exports.getCoordAll = index.getCoordAll;
126
- exports.getFeatureId = index.getFeatureId;
127
- exports.getPolygonFeatures = index.getPolygonFeatures;
128
- exports.getVertexCount = index.getVertexCount;
129
- exports.intersects = index.intersects;
130
- exports.isFeatureSelected = index.isFeatureSelected;
131
- exports.isLine = index.isLine;
132
- exports.isPoint = index.isPoint;
133
- exports.isPolygon = index.isPolygon;
134
- exports.isPolygonOnlySelection = index.isPolygonOnlySelection;
135
- exports.isValidGeometry = index.isValidGeometry;
136
- exports.isWithin = index.isWithin;
137
- exports.overlaps = index.overlaps;
138
- exports.polygonToLine = index.polygonToLine;
139
- exports.positionsEqual = index.positionsEqual;
140
- exports.radiansToDegrees = index.radiansToDegrees;
141
- exports.removeFromSelection = index.removeFromSelection;
142
- exports.roundCoordinates = index.roundCoordinates;
143
- exports.safeCentroid = index.safeCentroid;
144
- exports.safeClone = index.safeClone;
145
- exports.safeDifference = index.safeDifference;
146
- exports.safeLineIntersect = index.safeLineIntersect;
147
- exports.safeLineSplit = index.safeLineSplit;
148
- exports.safeScale = index.safeScale;
149
- exports.safeSimplify = index.safeSimplify;
150
- exports.safeTranslate = index.safeTranslate;
151
- exports.safeUnion = index.safeUnion;
152
- exports.selectFeaturesWithinLasso = index.selectFeaturesWithinLasso;
153
- exports.toSelectedFeatures = index.toSelectedFeatures;
154
- exports.toggleInSelection = index.toggleInSelection;
102
+ exports.ADVANCED_EDIT_MODES = geoEditor.ADVANCED_EDIT_MODES;
103
+ exports.CSS_PREFIX = geoEditor.CSS_PREFIX;
104
+ exports.CopyFeature = geoEditor.CopyFeature;
105
+ exports.DEFAULT_DRAW_MODES = geoEditor.DEFAULT_DRAW_MODES;
106
+ exports.DEFAULT_EDIT_MODES = geoEditor.DEFAULT_EDIT_MODES;
107
+ exports.DEFAULT_FILE_MODES = geoEditor.DEFAULT_FILE_MODES;
108
+ exports.DEFAULT_OPTIONS = geoEditor.DEFAULT_OPTIONS;
109
+ exports.DifferenceFeature = geoEditor.DifferenceFeature;
110
+ exports.GeoEditor = geoEditor.GeoEditor;
111
+ exports.LassoFeature = geoEditor.LassoFeature;
112
+ exports.ScaleFeature = geoEditor.ScaleFeature;
113
+ exports.SimplifyFeature = geoEditor.SimplifyFeature;
114
+ exports.SplitFeature = geoEditor.SplitFeature;
115
+ exports.UnionFeature = geoEditor.UnionFeature;
116
+ exports.addToSelection = geoEditor.addToSelection;
117
+ exports.bearingBetweenPoints = geoEditor.bearingBetweenPoints;
118
+ exports.calculateArea = geoEditor.calculateArea;
119
+ exports.calculateLength = geoEditor.calculateLength;
120
+ exports.calculateScaleFactor = geoEditor.calculateScaleFactor;
121
+ exports.canMergeFeatures = geoEditor.canMergeFeatures;
122
+ exports.canSubtractFeatures = geoEditor.canSubtractFeatures;
123
+ exports.clamp = geoEditor.clamp;
124
+ exports.cloneFeature = geoEditor.cloneFeature;
125
+ exports.contains = geoEditor.contains;
126
+ exports.createFeatureCollection = geoEditor.createFeatureCollection;
127
+ exports.createLine = geoEditor.createLine;
128
+ exports.createPoint = geoEditor.createPoint;
129
+ exports.createPolygon = geoEditor.createPolygon;
130
+ exports.degreesToRadians = geoEditor.degreesToRadians;
131
+ exports.distanceBetweenPoints = geoEditor.distanceBetweenPoints;
132
+ exports.ensureFeatureId = geoEditor.ensureFeatureId;
133
+ exports.filterByGeometryType = geoEditor.filterByGeometryType;
134
+ exports.fromSelectedFeatures = geoEditor.fromSelectedFeatures;
135
+ exports.generateFeatureId = geoEditor.generateFeatureId;
136
+ exports.getBBox = geoEditor.getBBox;
137
+ exports.getBBoxCenter = geoEditor.getBBoxCenter;
138
+ exports.getBBoxCorners = geoEditor.getBBoxCorners;
139
+ exports.getBBoxMidpoints = geoEditor.getBBoxMidpoints;
140
+ exports.getCenter = geoEditor.getCenter;
141
+ exports.getCoordAll = geoEditor.getCoordAll;
142
+ exports.getFeatureId = geoEditor.getFeatureId;
143
+ exports.getPolygonFeatures = geoEditor.getPolygonFeatures;
144
+ exports.getVertexCount = geoEditor.getVertexCount;
145
+ exports.intersects = geoEditor.intersects;
146
+ exports.isFeatureSelected = geoEditor.isFeatureSelected;
147
+ exports.isLine = geoEditor.isLine;
148
+ exports.isPoint = geoEditor.isPoint;
149
+ exports.isPolygon = geoEditor.isPolygon;
150
+ exports.isPolygonOnlySelection = geoEditor.isPolygonOnlySelection;
151
+ exports.isValidGeometry = geoEditor.isValidGeometry;
152
+ exports.isWithin = geoEditor.isWithin;
153
+ exports.overlaps = geoEditor.overlaps;
154
+ exports.polygonToLine = geoEditor.polygonToLine;
155
+ exports.positionsEqual = geoEditor.positionsEqual;
156
+ exports.radiansToDegrees = geoEditor.radiansToDegrees;
157
+ exports.removeFromSelection = geoEditor.removeFromSelection;
158
+ exports.roundCoordinates = geoEditor.roundCoordinates;
159
+ exports.safeCentroid = geoEditor.safeCentroid;
160
+ exports.safeClone = geoEditor.safeClone;
161
+ exports.safeDifference = geoEditor.safeDifference;
162
+ exports.safeLineIntersect = geoEditor.safeLineIntersect;
163
+ exports.safeLineSplit = geoEditor.safeLineSplit;
164
+ exports.safeScale = geoEditor.safeScale;
165
+ exports.safeSimplify = geoEditor.safeSimplify;
166
+ exports.safeTranslate = geoEditor.safeTranslate;
167
+ exports.safeUnion = geoEditor.safeUnion;
168
+ exports.selectFeaturesWithinLasso = geoEditor.selectFeaturesWithinLasso;
169
+ exports.toSelectedFeatures = geoEditor.toSelectedFeatures;
170
+ exports.toggleInSelection = geoEditor.toggleInSelection;
155
171
  exports.GeoEditorReact = GeoEditorReact;
156
172
  exports.useGeoEditor = useGeoEditor;
157
173
  //# sourceMappingURL=react.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.cjs","sources":["../src/lib/core/GeoEditorReact.tsx"],"sourcesContent":["import { useEffect, useRef, useCallback } from 'react';\nimport type { Map as MapLibreMap } from 'maplibre-gl';\nimport { GeoEditor } from './GeoEditor';\nimport type { GeoEditorOptions, GeomanInstance, DrawMode, EditMode } from './types';\n\nexport interface GeoEditorReactProps extends GeoEditorOptions {\n /** MapLibre map instance */\n map: MapLibreMap;\n /** Geoman instance for integration */\n geoman?: GeomanInstance;\n}\n\n/**\n * React wrapper component for GeoEditor\n * This component renders nothing but manages the GeoEditor lifecycle\n */\nexport function GeoEditorReact({\n map,\n geoman,\n position = 'top-left',\n ...options\n}: GeoEditorReactProps) {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create and add the control\n const control = new GeoEditor({ ...options, position });\n controlRef.current = control;\n\n map.addControl(control, position);\n\n // Set geoman instance if provided\n if (geoman) {\n control.setGeoman(geoman);\n }\n\n // Cleanup on unmount\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map, position]);\n\n // Update geoman instance when it changes\n useEffect(() => {\n if (controlRef.current && geoman) {\n controlRef.current.setGeoman(geoman);\n }\n }, [geoman]);\n\n // This component doesn't render anything\n return null;\n}\n\n/**\n * Hook for using GeoEditor imperatively\n */\nexport function useGeoEditor(\n map: MapLibreMap | null,\n options: GeoEditorOptions = {}\n): {\n control: GeoEditor | null;\n enableDrawMode: (mode: DrawMode) => void;\n enableEditMode: (mode: EditMode) => void;\n disableAllModes: () => void;\n copySelected: () => void;\n pasteFeatures: () => void;\n deleteSelected: () => void;\n clearSelection: () => void;\n} {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n const control = new GeoEditor(options);\n controlRef.current = control;\n map.addControl(control, options.position || 'top-left');\n\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map]);\n\n const enableDrawMode = useCallback((mode: DrawMode) => {\n controlRef.current?.enableDrawMode(mode);\n }, []);\n\n const enableEditMode = useCallback((mode: EditMode) => {\n controlRef.current?.enableEditMode(mode);\n }, []);\n\n const disableAllModes = useCallback(() => {\n controlRef.current?.disableAllModes();\n }, []);\n\n const copySelected = useCallback(() => {\n controlRef.current?.copySelectedFeatures();\n }, []);\n\n const pasteFeatures = useCallback(() => {\n controlRef.current?.pasteFeatures();\n }, []);\n\n const deleteSelected = useCallback(() => {\n controlRef.current?.deleteSelectedFeatures();\n }, []);\n\n const clearSelection = useCallback(() => {\n controlRef.current?.clearSelection();\n }, []);\n\n return {\n control: controlRef.current,\n enableDrawMode,\n enableEditMode,\n disableAllModes,\n copySelected,\n pasteFeatures,\n deleteSelected,\n clearSelection,\n };\n}\n\nexport default GeoEditorReact;\n"],"names":["useRef","useEffect","GeoEditor","useCallback"],"mappings":";;;;AAgBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAwB;AACtB,QAAM,aAAaA,MAAAA,OAAyB,IAAI;AAEhDC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAGV,UAAM,UAAU,IAAIC,MAAAA,UAAU,EAAE,GAAG,SAAS,UAAU;AACtD,eAAW,UAAU;AAErB,QAAI,WAAW,SAAS,QAAQ;AAGhC,QAAI,QAAQ;AACV,cAAQ,UAAU,MAAM;AAAA,IAC1B;AAGA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,YAAI,cAAc,WAAW,OAAO;AACpC,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,QAAQ,CAAC;AAGlBD,QAAAA,UAAU,MAAM;AACd,QAAI,WAAW,WAAW,QAAQ;AAChC,iBAAW,QAAQ,UAAU,MAAM;AAAA,IACrC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAGX,SAAO;AACT;AAKO,SAAS,aACd,KACA,UAA4B,IAU5B;AACA,QAAM,aAAaD,MAAAA,OAAyB,IAAI;AAEhDC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAEV,UAAM,UAAU,IAAIC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ect, useRef, useCallback } from 'react';\nimport type { Map as MapLibreMap } from 'maplibre-gl';\nimport { GeoEditor } from './GeoEditor';\nimport type { Feature, FeatureCollection } from 'geojson';\nimport type { GeoEditorOptions, GeomanInstance, DrawMode, EditMode, GeoJsonLoadResult, GeoJsonSaveResult } from './types';\n\nexport interface GeoEditorReactProps extends GeoEditorOptions {\n /** MapLibre map instance */\n map: MapLibreMap;\n /** Geoman instance for integration */\n geoman?: GeomanInstance;\n}\n\n/**\n * React wrapper component for GeoEditor\n * This component renders nothing but manages the GeoEditor lifecycle\n */\nexport function GeoEditorReact({\n map,\n geoman,\n position = 'top-left',\n ...options\n}: GeoEditorReactProps) {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create and add the control\n const control = new GeoEditor({ ...options, position });\n controlRef.current = control;\n\n map.addControl(control, position);\n\n // Set geoman instance if provided\n if (geoman) {\n control.setGeoman(geoman);\n }\n\n // Cleanup on unmount\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map, position]);\n\n // Update geoman instance when it changes\n useEffect(() => {\n if (controlRef.current && geoman) {\n controlRef.current.setGeoman(geoman);\n }\n }, [geoman]);\n\n // This component doesn't render anything\n return null;\n}\n\n/**\n * Hook for using GeoEditor imperatively\n */\nexport function useGeoEditor(\n map: MapLibreMap | null,\n options: GeoEditorOptions = {}\n): {\n control: GeoEditor | null;\n enableDrawMode: (mode: DrawMode) => void;\n enableEditMode: (mode: EditMode) => void;\n disableAllModes: () => void;\n copySelected: () => void;\n pasteFeatures: () => void;\n deleteSelected: () => void;\n clearSelection: () => void;\n openFileDialog: () => void;\n loadGeoJson: (geoJson: FeatureCollection | Feature, filename?: string) => GeoJsonLoadResult | undefined;\n saveGeoJson: (filename?: string) => GeoJsonSaveResult | undefined;\n} {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n const control = new GeoEditor(options);\n controlRef.current = control;\n map.addControl(control, options.position || 'top-left');\n\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map]);\n\n const enableDrawMode = useCallback((mode: DrawMode) => {\n controlRef.current?.enableDrawMode(mode);\n }, []);\n\n const enableEditMode = useCallback((mode: EditMode) => {\n controlRef.current?.enableEditMode(mode);\n }, []);\n\n const disableAllModes = useCallback(() => {\n controlRef.current?.disableAllModes();\n }, []);\n\n const copySelected = useCallback(() => {\n controlRef.current?.copySelectedFeatures();\n }, []);\n\n const pasteFeatures = useCallback(() => {\n controlRef.current?.pasteFeatures();\n }, []);\n\n const deleteSelected = useCallback(() => {\n controlRef.current?.deleteSelectedFeatures();\n }, []);\n\n const clearSelection = useCallback(() => {\n controlRef.current?.clearSelection();\n }, []);\n\n const openFileDialog = useCallback(() => {\n controlRef.current?.openFileDialog();\n }, []);\n\n const loadGeoJson = useCallback((geoJson: FeatureCollection | Feature, filename?: string) => {\n return controlRef.current?.loadGeoJson(geoJson, filename);\n }, []);\n\n const saveGeoJson = useCallback((filename?: string) => {\n return controlRef.current?.saveGeoJson(filename);\n }, []);\n\n return {\n control: controlRef.current,\n enableDrawMode,\n enableEditMode,\n disableAllModes,\n copySelected,\n pasteFeatures,\n deleteSelected,\n clearSelection,\n openFileDialog,\n loadGeoJson,\n saveGeoJson,\n };\n}\n\nexport default GeoEditorReact;\n"],"names":["useRef","useEffect","GeoEditor","useCallback"],"mappings":";;;;AAiBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAwB;AACtB,QAAM,aAAaA,MAAAA,OAAyB,IAAI;AAEhDC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAGV,UAAM,UAAU,IAAIC,UAAAA,UAAU,EAAE,GAAG,SAAS,UAAU;AACtD,eAAW,UAAU;AAErB,QAAI,WAAW,SAAS,QAAQ;AAGhC,QAAI,QAAQ;AACV,cAAQ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QAAM,iBAAiBA,MAAAA,YAAY,MAAM;;AACvC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,iBAAiBA,MAAAA,YAAY,MAAM;;AACvC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,iBAAiBA,MAAAA,YAAY,MAAM;;AACvC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,cAAcA,MAAAA,YAAY,CAAC,SAAsC,aAAsB;;AAC3F,YAAO,gBAAW,YAAX,mBAAoB,YAAY,SAAS;AAAA,EAClD,GAAG,CAAA,CAAE;AAEL,QAAM,cAAcA,kBAAY,CAAC,aAAsB;;AACrD,YAAO,gBAAW,YAAX,mBAAoB,YAAY;AAAA,EACzC,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/react.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useRef, useEffect, useCallback } from "react";
2
- import { GeoEditor } from "./index.mjs";
3
- import { ADVANCED_EDIT_MODES, CSS_PREFIX, CopyFeature, DEFAULT_DRAW_MODES, DEFAULT_EDIT_MODES, DEFAULT_OPTIONS, DifferenceFeature, LassoFeature, ScaleFeature, SimplifyFeature, SplitFeature, UnionFeature, addToSelection, bearingBetweenPoints, calculateArea, calculateLength, calculateScaleFactor, canMergeFeatures, canSubtractFeatures, clamp, cloneFeature, contains, createFeatureCollection, createLine, createPoint, createPolygon, degreesToRadians, distanceBetweenPoints, ensureFeatureId, filterByGeometryType, fromSelectedFeatures, generateFeatureId, getBBox, getBBoxCenter, getBBoxCorners, getBBoxMidpoints, getCenter, getCoordAll, getFeatureId, getPolygonFeatures, getVertexCount, intersects, isFeatureSelected, isLine, isPoint, isPolygon, isPolygonOnlySelection, isValidGeometry, isWithin, overlaps, polygonToLine, positionsEqual, radiansToDegrees, removeFromSelection, roundCoordinates, safeCentroid, safeClone, safeDifference, safeLineIntersect, safeLineSplit, safeScale, safeSimplify, safeTranslate, safeUnion, selectFeaturesWithinLasso, toSelectedFeatures, toggleInSelection } from "./index.mjs";
2
+ import { G as GeoEditor } from "./geo-editor-CYjgQaA9.js";
3
+ import { A, g, C, c, d, e, f, D, L, a, S, b, U, ac, T, E, F, X, a7, a8, Y, a2, t, B, y, z, x, Z, R, Q, a4, aa, J, u, W, H, I, V, v, P, a5, a1, q, ab, N, O, M, a6, K, p, r, w, a0, _, ad, $, k, l, h, o, n, j, i, m, s, a3, a9, ae } from "./geo-editor-CYjgQaA9.js";
4
4
  function GeoEditorReact({
5
5
  map,
6
6
  geoman,
@@ -72,6 +72,18 @@ function useGeoEditor(map, options = {}) {
72
72
  var _a;
73
73
  (_a = controlRef.current) == null ? void 0 : _a.clearSelection();
74
74
  }, []);
75
+ const openFileDialog = useCallback(() => {
76
+ var _a;
77
+ (_a = controlRef.current) == null ? void 0 : _a.openFileDialog();
78
+ }, []);
79
+ const loadGeoJson = useCallback((geoJson, filename) => {
80
+ var _a;
81
+ return (_a = controlRef.current) == null ? void 0 : _a.loadGeoJson(geoJson, filename);
82
+ }, []);
83
+ const saveGeoJson = useCallback((filename) => {
84
+ var _a;
85
+ return (_a = controlRef.current) == null ? void 0 : _a.saveGeoJson(filename);
86
+ }, []);
75
87
  return {
76
88
  control: controlRef.current,
77
89
  enableDrawMode,
@@ -80,79 +92,83 @@ function useGeoEditor(map, options = {}) {
80
92
  copySelected,
81
93
  pasteFeatures,
82
94
  deleteSelected,
83
- clearSelection
95
+ clearSelection,
96
+ openFileDialog,
97
+ loadGeoJson,
98
+ saveGeoJson
84
99
  };
85
100
  }
86
101
  export {
87
- ADVANCED_EDIT_MODES,
88
- CSS_PREFIX,
89
- CopyFeature,
90
- DEFAULT_DRAW_MODES,
91
- DEFAULT_EDIT_MODES,
92
- DEFAULT_OPTIONS,
93
- DifferenceFeature,
102
+ A as ADVANCED_EDIT_MODES,
103
+ g as CSS_PREFIX,
104
+ C as CopyFeature,
105
+ c as DEFAULT_DRAW_MODES,
106
+ d as DEFAULT_EDIT_MODES,
107
+ e as DEFAULT_FILE_MODES,
108
+ f as DEFAULT_OPTIONS,
109
+ D as DifferenceFeature,
94
110
  GeoEditor,
95
111
  GeoEditorReact,
96
- LassoFeature,
97
- ScaleFeature,
98
- SimplifyFeature,
99
- SplitFeature,
100
- UnionFeature,
101
- addToSelection,
102
- bearingBetweenPoints,
103
- calculateArea,
104
- calculateLength,
105
- calculateScaleFactor,
106
- canMergeFeatures,
107
- canSubtractFeatures,
108
- clamp,
109
- cloneFeature,
110
- contains,
111
- createFeatureCollection,
112
- createLine,
113
- createPoint,
114
- createPolygon,
115
- degreesToRadians,
116
- distanceBetweenPoints,
117
- ensureFeatureId,
118
- filterByGeometryType,
119
- fromSelectedFeatures,
120
- generateFeatureId,
121
- getBBox,
122
- getBBoxCenter,
123
- getBBoxCorners,
124
- getBBoxMidpoints,
125
- getCenter,
126
- getCoordAll,
127
- getFeatureId,
128
- getPolygonFeatures,
129
- getVertexCount,
130
- intersects,
131
- isFeatureSelected,
132
- isLine,
133
- isPoint,
134
- isPolygon,
135
- isPolygonOnlySelection,
136
- isValidGeometry,
137
- isWithin,
138
- overlaps,
139
- polygonToLine,
140
- positionsEqual,
141
- radiansToDegrees,
142
- removeFromSelection,
143
- roundCoordinates,
144
- safeCentroid,
145
- safeClone,
146
- safeDifference,
147
- safeLineIntersect,
148
- safeLineSplit,
149
- safeScale,
150
- safeSimplify,
151
- safeTranslate,
152
- safeUnion,
153
- selectFeaturesWithinLasso,
154
- toSelectedFeatures,
155
- toggleInSelection,
112
+ L as LassoFeature,
113
+ a as ScaleFeature,
114
+ S as SimplifyFeature,
115
+ b as SplitFeature,
116
+ U as UnionFeature,
117
+ ac as addToSelection,
118
+ T as bearingBetweenPoints,
119
+ E as calculateArea,
120
+ F as calculateLength,
121
+ X as calculateScaleFactor,
122
+ a7 as canMergeFeatures,
123
+ a8 as canSubtractFeatures,
124
+ Y as clamp,
125
+ a2 as cloneFeature,
126
+ t as contains,
127
+ B as createFeatureCollection,
128
+ y as createLine,
129
+ z as createPoint,
130
+ x as createPolygon,
131
+ Z as degreesToRadians,
132
+ R as distanceBetweenPoints,
133
+ Q as ensureFeatureId,
134
+ a4 as filterByGeometryType,
135
+ aa as fromSelectedFeatures,
136
+ J as generateFeatureId,
137
+ u as getBBox,
138
+ W as getBBoxCenter,
139
+ H as getBBoxCorners,
140
+ I as getBBoxMidpoints,
141
+ V as getCenter,
142
+ v as getCoordAll,
143
+ P as getFeatureId,
144
+ a5 as getPolygonFeatures,
145
+ a1 as getVertexCount,
146
+ q as intersects,
147
+ ab as isFeatureSelected,
148
+ N as isLine,
149
+ O as isPoint,
150
+ M as isPolygon,
151
+ a6 as isPolygonOnlySelection,
152
+ K as isValidGeometry,
153
+ p as isWithin,
154
+ r as overlaps,
155
+ w as polygonToLine,
156
+ a0 as positionsEqual,
157
+ _ as radiansToDegrees,
158
+ ad as removeFromSelection,
159
+ $ as roundCoordinates,
160
+ k as safeCentroid,
161
+ l as safeClone,
162
+ h as safeDifference,
163
+ o as safeLineIntersect,
164
+ n as safeLineSplit,
165
+ j as safeScale,
166
+ i as safeSimplify,
167
+ m as safeTranslate,
168
+ s as safeUnion,
169
+ a3 as selectFeaturesWithinLasso,
170
+ a9 as toSelectedFeatures,
171
+ ae as toggleInSelection,
156
172
  useGeoEditor
157
173
  };
158
174
  //# sourceMappingURL=react.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.mjs","sources":["../src/lib/core/GeoEditorReact.tsx"],"sourcesContent":["import { useEffect, useRef, useCallback } from 'react';\nimport type { Map as MapLibreMap } from 'maplibre-gl';\nimport { GeoEditor } from './GeoEditor';\nimport type { GeoEditorOptions, GeomanInstance, DrawMode, EditMode } from './types';\n\nexport interface GeoEditorReactProps extends GeoEditorOptions {\n /** MapLibre map instance */\n map: MapLibreMap;\n /** Geoman instance for integration */\n geoman?: GeomanInstance;\n}\n\n/**\n * React wrapper component for GeoEditor\n * This component renders nothing but manages the GeoEditor lifecycle\n */\nexport function GeoEditorReact({\n map,\n geoman,\n position = 'top-left',\n ...options\n}: GeoEditorReactProps) {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create and add the control\n const control = new GeoEditor({ ...options, position });\n controlRef.current = control;\n\n map.addControl(control, position);\n\n // Set geoman instance if provided\n if (geoman) {\n control.setGeoman(geoman);\n }\n\n // Cleanup on unmount\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map, position]);\n\n // Update geoman instance when it changes\n useEffect(() => {\n if (controlRef.current && geoman) {\n controlRef.current.setGeoman(geoman);\n }\n }, [geoman]);\n\n // This component doesn't render anything\n return null;\n}\n\n/**\n * Hook for using GeoEditor imperatively\n */\nexport function useGeoEditor(\n map: MapLibreMap | null,\n options: GeoEditorOptions = {}\n): {\n control: GeoEditor | null;\n enableDrawMode: (mode: DrawMode) => void;\n enableEditMode: (mode: EditMode) => void;\n disableAllModes: () => void;\n copySelected: () => void;\n pasteFeatures: () => void;\n deleteSelected: () => void;\n clearSelection: () => void;\n} {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n const control = new GeoEditor(options);\n controlRef.current = control;\n map.addControl(control, options.position || 'top-left');\n\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map]);\n\n const enableDrawMode = useCallback((mode: DrawMode) => {\n controlRef.current?.enableDrawMode(mode);\n }, []);\n\n const enableEditMode = useCallback((mode: EditMode) => {\n controlRef.current?.enableEditMode(mode);\n }, []);\n\n const disableAllModes = useCallback(() => {\n controlRef.current?.disableAllModes();\n }, []);\n\n const copySelected = useCallback(() => {\n controlRef.current?.copySelectedFeatures();\n }, []);\n\n const pasteFeatures = useCallback(() => {\n controlRef.current?.pasteFeatures();\n }, []);\n\n const deleteSelected = useCallback(() => {\n controlRef.current?.deleteSelectedFeatures();\n }, []);\n\n const clearSelection = useCallback(() => {\n controlRef.current?.clearSelection();\n }, []);\n\n return {\n control: controlRef.current,\n enableDrawMode,\n enableEditMode,\n disableAllModes,\n copySelected,\n pasteFeatures,\n deleteSelected,\n clearSelection,\n };\n}\n\nexport default GeoEditorReact;\n"],"names":[],"mappings":";;;AAgBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAwB;AACtB,QAAM,aAAa,OAAyB,IAAI;AAEhD,YAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAGV,UAAM,UAAU,IAAI,UAAU,EAAE,GAAG,SAAS,UAAU;AACtD,eAAW,UAAU;AAErB,QAAI,WAAW,SAAS,QAAQ;AAGhC,QAAI,QAAQ;AACV,cAAQ,UAAU,MAAM;AAAA,IAC1B;AAGA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,YAAI,cAAc,WAAW,OAAO;AACpC,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,QAAQ,CAAC;AAGlB,YAAU,MAAM;AACd,QAAI,WAAW,WAAW,QAAQ;AAChC,iBAAW,QAAQ,UAAU,MAAM;AAAA,IACrC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAGX,SAAO;AACT;AAKO,SAAS,aACd,KACA,UAA4B,IAU5B;AACA,QAAM,aAAa,OAAyB,IAAI;AAEhD,YAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAEV,UAAM,UAAU,IAAI,UAAU,OAAO;AACrC,eAAW,UAAU;AACrB,QAAI,WAAW,SAAS,QAAQ,YAAY,UAAU;AAEtD,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,YAAI,cAAc,WAAW,OAAO;AACpC,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,iBAAiB,YAAY,CAAC,SAAmB;;AACrD,qBAAW,YAAX,mBAAoB,eAAe;AAAA,EACrC,GAAG,CAAA,CAAE;AAEL,QAAM,iBAAiB,YAAY,CAAC,SAAmB;;AACrD,qBAAW,YAAX,mBAAoB,eAAe;AAAA,EACrC,GAAG,CAAA,CAAE;AAEL,QAAM,kBAAkB,YAAY,MAAM;;AACxC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,eAAe,YAAY,MAAM;;AACrC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,gBAAgB,YAAY,MAAM;;AACtC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,iBAAiB,YAAY,MAAM;;AACvC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,QAAM,iBAAiB,YAAY,MAAM;;AACvC,qBAAW,YAAX,mBAAoB;AAAA,EACtB,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"react.mjs","sources":["../src/lib/core/GeoEditorReact.tsx"],"sourcesContent":["import { useEffect, useRef, useCallback } from 'react';\nimport type { Map as MapLibreMap } from 'maplibre-gl';\nimport { GeoEditor } from './GeoEditor';\nimport type { Feature, FeatureCollection } from 'geojson';\nimport type { GeoEditorOptions, GeomanInstance, DrawMode, EditMode, GeoJsonLoadResult, GeoJsonSaveResult } from './types';\n\nexport interface GeoEditorReactProps extends GeoEditorOptions {\n /** MapLibre map instance */\n map: MapLibreMap;\n /** Geoman instance for integration */\n geoman?: GeomanInstance;\n}\n\n/**\n * React wrapper component for GeoEditor\n * This component renders nothing but manages the GeoEditor lifecycle\n */\nexport function GeoEditorReact({\n map,\n geoman,\n position = 'top-left',\n ...options\n}: GeoEditorReactProps) {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n // Create and add the control\n const control = new GeoEditor({ ...options, position });\n controlRef.current = control;\n\n map.addControl(control, position);\n\n // Set geoman instance if provided\n if (geoman) {\n control.setGeoman(geoman);\n }\n\n // Cleanup on unmount\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map, position]);\n\n // Update geoman instance when it changes\n useEffect(() => {\n if (controlRef.current && geoman) {\n controlRef.current.setGeoman(geoman);\n }\n }, [geoman]);\n\n // This component doesn't render anything\n return null;\n}\n\n/**\n * Hook for using GeoEditor imperatively\n */\nexport function useGeoEditor(\n map: MapLibreMap | null,\n options: GeoEditorOptions = {}\n): {\n control: GeoEditor | null;\n enableDrawMode: (mode: DrawMode) => void;\n enableEditMode: (mode: EditMode) => void;\n disableAllModes: () => void;\n copySelected: () => void;\n pasteFeatures: () => void;\n deleteSelected: () => void;\n clearSelection: () => void;\n openFileDialog: () => void;\n loadGeoJson: (geoJson: FeatureCollection | Feature, filename?: string) => GeoJsonLoadResult | undefined;\n saveGeoJson: (filename?: string) => GeoJsonSaveResult | undefined;\n} {\n const controlRef = useRef<GeoEditor | null>(null);\n\n useEffect(() => {\n if (!map) return;\n\n const control = new GeoEditor(options);\n controlRef.current = control;\n map.addControl(control, options.position || 'top-left');\n\n return () => {\n if (controlRef.current) {\n map.removeControl(controlRef.current);\n controlRef.current = null;\n }\n };\n }, [map]);\n\n const enableDrawMode = useCallback((mode: DrawMode) => {\n controlRef.current?.enableDrawMode(mode);\n }, []);\n\n const enableEditMode = useCallback((mode: EditMode) => {\n controlRef.current?.enableEditMode(mode);\n }, []);\n\n const disableAllModes = useCallback(() => {\n controlRef.current?.disableAllModes();\n }, []);\n\n const copySelected = useCallback(() => {\n controlRef.current?.copySelectedFeatures();\n }, []);\n\n const pasteFeatures = useCallback(() => {\n controlRef.current?.pasteFeatures();\n }, []);\n\n const deleteSelected = useCallback(() => {\n controlRef.current?.deleteSelectedFeatures();\n }, []);\n\n const clearSelection = useCallback(() => {\n controlRef.current?.clearSelection();\n }, []);\n\n const openFileDialog = useCallback(() => {\n controlRef.current?.openFileDialog();\n }, []);\n\n const loadGeoJson = useCallback((geoJson: FeatureCollection | Feature, filename?: string) => {\n return controlRef.current?.loadGeoJson(geoJson, filename);\n }, []);\n\n const saveGeoJson = useCallback((filename?: string) => {\n return controlRef.current?.saveGeoJson(filename);\n }, []);\n\n return {\n control: controlRef.current,\n enableDrawMode,\n enableEditMode,\n disableAllModes,\n copySelected,\n pasteFeatures,\n deleteSelected,\n clearSelection,\n openFileDialog,\n loadGeoJson,\n saveGeoJson,\n };\n}\n\nexport default GeoEditorReact;\n"],"names":[],"mappings":";;;AAiBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAwB;AACtB,QAAM,aAAa,OAAyB,IAAI;AAEhD,YAAU,MAAM;AACd,QAAI,CAAC,IAAK;AAGV,UAAM,UAAU,IAAI,UAAU,EAAE,GAAG,SAAS,UAAU;AACtD,eAAW,UAAU;AAErB,QAAI,WAAW,SAAS,QAAQ;AAGhC,QAAI,QAAQ;AACV,cAAQ,UAAU,MAAM;AAAA,IAC1B;AAGA,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,YAAI,cAAc,WAAW,OAAO;AACpC,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,QAAQ,CAAC;AAGlB,YAAU,MAAM;AACd,QAAI,WAAW,WAAW,QAAQ;AAChC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AAsC,aAAsB;;AAC3F,YAAO,gBAAW,YAAX,mBAAoB,YAAY,SAAS;AAAA,EAClD,GAAG,CAAA,CAAE;AAEL,QAAM,cAAc,YAAY,CAAC,aAAsB;;AACrD,YAAO,gBAAW,YAAX,mBAAoB,YAAY;AAAA,EACzC,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maplibre-gl-geo-editor",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Advanced geometry editing plugin for MapLibre GL with Geoman integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",