@element-editor/react 0.2.2 → 0.3.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 +6 -1
- package/dist/element-editor-leaflet.css +1 -1
- package/dist/element-editor.cjs +1 -1
- package/dist/element-editor.css +1 -1
- package/dist/element-editor.es.js +1 -1
- package/dist/leaflet.cjs +1 -1
- package/dist/leaflet.es.js +1 -1
- package/dist/shared.d.cts +2 -2
- package/dist/shared.d.ts +2 -2
- package/dist/shell/types.d.cts +44 -1
- package/dist/shell/types.d.ts +44 -1
- package/dist/useBasemapState-8kWJmLD9.cjs +1 -0
- package/dist/useBasemapState-EEM8j7r8.js +690 -0
- package/package.json +8 -8
- package/dist/useBasemapState-8bWJK84f.cjs +0 -1
- package/dist/useBasemapState-DChxz3lv.js +0 -682
package/AGENTS.md
CHANGED
|
@@ -270,6 +270,8 @@ interface ElementEditorRef {
|
|
|
270
270
|
select: (ids: string[], options?: { fit?: boolean }) => void
|
|
271
271
|
setTool: (tool: DrawTool | null) => boolean // false if unavailable / readonly
|
|
272
272
|
getTool: () => DrawTool | null // also: onToolChange prop
|
|
273
|
+
setVertexEdit: (id: string | null) => boolean // line / area point editing; null leaves; false: point, hidden, readonly
|
|
274
|
+
getVertexEdit: () => string | null // also: onVertexEditChange prop
|
|
273
275
|
getMap: () => TMap | null // null until mounted
|
|
274
276
|
flyTo: {
|
|
275
277
|
(options: FlyToOptions): void // { center: [lng, lat], zoom? }, zoom default 15
|
|
@@ -294,7 +296,7 @@ type FeaturePatch = Partial<Pick<GeoJSONFeature, 'properties' | 'geometry' | 'sc
|
|
|
294
296
|
interface MutationOptions { undoable?: boolean } // default true; false = no undo step, applied to history too (server sync)
|
|
295
297
|
interface SetFeatureCollectionOptions { silent?: boolean; undoable?: boolean } // silent default false; undoable default true (false clears history)
|
|
296
298
|
interface ValidationReport { valid: boolean; errors: Record<string, string[]> } // errors keyed by feature id
|
|
297
|
-
interface ImportResult { skipped: number; duplicates: number; truncated: boolean }
|
|
299
|
+
interface ImportResult { skipped: number; duplicates: number; truncated: boolean; refused: number } // refused: type not in geometryTypes
|
|
298
300
|
```
|
|
299
301
|
|
|
300
302
|
`FeaturePatch` is exported from `@element-editor/core`, not from `@element-editor/react`. `ImportResult`, `MutationOptions`, `SetFeatureCollectionOptions`, `ValidationReport`, `FeatureCollection`, `FeatureCollectionInput`, `GeoJSONFeature`, `GeoJSONFeatureInput`, `GeometryInput`, `Schema`, `DrawTool`, `FlyToOptions`, `BBox` and `BasemapInput` are.
|
|
@@ -317,6 +319,7 @@ interface ImportResult { skipped: number; duplicates: number; truncated: boolean
|
|
|
317
319
|
| `onBasemapChange` | `(basemap) => void` | user picked a basemap or `ref.setBasemap()` |
|
|
318
320
|
| `onMapReady` | `(map) => void` | once per map, after Element's layers are on it |
|
|
319
321
|
| `onToolChange` | `(tool: DrawTool \| null) => void` | a drawing tool turned on (`null`: off), as `ref.getTool()` reports it |
|
|
322
|
+
| `onVertexEditChange` | `(id: string \| null) => void` | a feature entered point editing (`null`: it ended), as `ref.getVertexEdit()` reports it |
|
|
320
323
|
|
|
321
324
|
`ElementEditorEvent['type']`: `'feature:deleted' | 'features:deleted' | 'feature:duplicated' | 'features:duplicated' | 'feature:broken' | 'selection:copied' | 'selection:pasted' | 'undo' | 'redo' | 'error' | 'warning' | 'success'`.
|
|
322
325
|
|
|
@@ -332,6 +335,7 @@ interface ImportResult { skipped: number; duplicates: number; truncated: boolean
|
|
|
332
335
|
| `invalid-data` | unreadable input/response (bad JSON, not a FeatureCollection, broken style) |
|
|
333
336
|
| `too-large` | import file over the size cap |
|
|
334
337
|
| `limit-reached` | `maxFeatures` refused or truncated an add |
|
|
338
|
+
| `geometry-type-not-allowed` | `geometryTypes` refused a geometry type, or skipped features of that type in an import |
|
|
335
339
|
| `geometry` | geometry operation failed or produced an empty shape |
|
|
336
340
|
| `permission-denied` | browser refused geolocation / clipboard / file save |
|
|
337
341
|
| `unsupported` | missing browser or map capability |
|
|
@@ -365,6 +369,7 @@ Shared by both drop-ins (`ElementEditorBaseProps`):
|
|
|
365
369
|
| `schema` | `Schema` | `{ id, name, fields: SchemaField[] }` |
|
|
366
370
|
| `tools` | `DrawTool[]` | omit for all: `'polygon' (Area tool) \| 'rectangle' \| 'circle' \| 'line' \| 'point' \| 'freehand' \| 'route' \| 'picker' \| 'measure' \| 'search'` |
|
|
367
371
|
| `maxFeatures` | `number` | enforced for every way of adding |
|
|
372
|
+
| `geometryTypes` | `GeometryType[]` | omit for all; GeoJSON type names; enforced for every way a geometry gets in (tools that can't draw one are left out) |
|
|
368
373
|
| `bounds` | `BoundsInput` | restricts panning; bbox `[west, south, east, north]`; reactive |
|
|
369
374
|
| `theme` | `'light' \| 'dark' \| 'auto'` | mode only; colours via `accentColor` or CSS variables in `style` (an object is ignored with a dev warning) |
|
|
370
375
|
| `accentColor` | `string` | any CSS colour; derives the primary scale |
|