@element-editor/react 0.2.0 → 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.
- package/AGENTS.md +4 -4
- package/README.md +1 -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 +126 -114
- package/dist/maplibre/MapLibreMapView.d.cts +2 -1
- package/dist/maplibre/MapLibreMapView.d.ts +2 -1
- package/dist/maplibre/workerUrl.d.cts +21 -0
- package/dist/maplibre/workerUrl.d.ts +21 -0
- package/package.json +12 -8
package/AGENTS.md
CHANGED
|
@@ -30,7 +30,7 @@ React and React DOM `^19.2` are required everywhere (React 18 is not supported).
|
|
|
30
30
|
| Peer | Range |
|
|
31
31
|
|---|---|
|
|
32
32
|
| `react`, `react-dom` | `^19.2.0` |
|
|
33
|
-
| `maplibre-gl` |
|
|
33
|
+
| `maplibre-gl` | 5.5 or 6 (default entry, MapLibre adapter) |
|
|
34
34
|
| `leaflet` | `^1.9.0` (`/leaflet` entry, Leaflet adapter) |
|
|
35
35
|
| `react-leaflet` | `^5.0.0` (`/leaflet` entry, Leaflet adapter) |
|
|
36
36
|
|
|
@@ -125,7 +125,7 @@ Needs `ElementEditorUIProvider` (throws without it), one `GeoStoreProvider` per
|
|
|
125
125
|
|
|
126
126
|
```tsx
|
|
127
127
|
import { useEffect, useRef, useState } from 'react'
|
|
128
|
-
import maplibregl from 'maplibre-gl'
|
|
128
|
+
import * as maplibregl from 'maplibre-gl'
|
|
129
129
|
import 'maplibre-gl/dist/maplibre-gl.css'
|
|
130
130
|
import { ElementEditorUIProvider, GeoStoreProvider, ElementEditorControls } from '@element-editor/adapter-maplibre'
|
|
131
131
|
import '@element-editor/adapter-maplibre/style.css'
|
|
@@ -377,7 +377,7 @@ MapLibre entry only: `basemap?: BasemapInput` (controlled; pair with `onBasemapC
|
|
|
377
377
|
|
|
378
378
|
Leaflet entry only: `tileLayer?: React.ReactNode` (any react-leaflet tile layer; disables the picker), `basemaps?: LeafletBasemap[]`, `basemap?`, `defaultBasemap?`, `onBasemapChange?` (`LeafletBasemap = RasterBasemap | 'osm'`), `renderer?: 'canvas' | 'svg'` (default `'canvas'`), `getFeatureStyle?`, `mapOptions?` (`L.MapOptions` minus owned ones), `onMapReady?: (map: L.Map) => void`.
|
|
379
379
|
|
|
380
|
-
`ElementEditorConfig` keys: `mode` (`'light' | 'dark' | 'system'`), `accentColor`, `featureColor`, `tools`, `persistKey` (namespace for localStorage; give each editor on an origin its own), `persist` (`false` = no localStorage), `network` (every third-party server: `vectorTiles`, `dem`, `osmRaster`, `glyphs`, `sprite`, `overpass`, `routing`, `nominatim`, `fetch`; `false` on a service hides what needs it), `ui` (visibility flags `hints`, `dataTable`, `layerList`, `schemaEditor`, `geojsonEditor`, `geojsonEditorOpen`, `settings`, `zoomToAll`, `zoomIndicator`, `locateButton`, plus `layout` and `keyboardShortcuts`), `toolbar.direction`, `units`. Move controls with `withLayout` (exported here): `config={{ ui: { layout: withLayout({ move: { table: 'topRight' }, hide: ['keyboard'] }) } }}`.
|
|
380
|
+
`ElementEditorConfig` keys: `mode` (`'light' | 'dark' | 'system'`), `accentColor`, `featureColor`, `tools`, `persistKey` (namespace for localStorage; give each editor on an origin its own), `persist` (`false` = no localStorage), `network` (every third-party server: `vectorTiles`, `dem`, `osmRaster`, `glyphs`, `sprite`, `maplibreWorker`, `overpass`, `routing`, `nominatim`, `fetch`; `false` on a service hides what needs it), `ui` (visibility flags `hints`, `dataTable`, `layerList`, `schemaEditor`, `geojsonEditor`, `geojsonEditorOpen`, `settings`, `zoomToAll`, `zoomIndicator`, `locateButton`, plus `layout` and `keyboardShortcuts`), `toolbar.direction`, `units`. Move controls with `withLayout` (exported here): `config={{ ui: { layout: withLayout({ move: { table: 'topRight' }, hide: ['keyboard'] }) } }}`.
|
|
381
381
|
|
|
382
382
|
Removed or renamed in 0.2 (https://elementeditor.dev/docs/guides/migrating-to-0.2):
|
|
383
383
|
|
|
@@ -395,7 +395,7 @@ Removed or renamed in 0.2 (https://elementeditor.dev/docs/guides/migrating-to-0.
|
|
|
395
395
|
- **No stylesheet, or the wrong one.** Unstyled panels, missing controls, broken tiles. One stylesheet per entry (table above); MapLibre adapter also needs `maplibre-gl.css`.
|
|
396
396
|
- **Zero-height parent.** The root is 100% of its parent. Give the parent a height (`height: 600`, `100vh`, or `flex: 1; min-height: 0` in a flex column).
|
|
397
397
|
- **Coordinate order.** Element's API (data, `initialView.center`, `bounds`, `flyTo({ center })`, `fitBounds`) is GeoJSON `[lng, lat]`. Leaflet and react-leaflet (`MapContainer center`, `L.latLng`) are `[lat, lng]`. Convert at the boundary.
|
|
398
|
-
- **Missing or wrong peers.** `maplibre-gl` must be installed for the default entry (
|
|
398
|
+
- **Missing or wrong peers.** `maplibre-gl` must be installed for the default entry (5.5 or 6); `@element-editor/adapter-leaflet`, `leaflet ^1.9` and `react-leaflet ^5` for `/leaflet`. React 18 and react-leaflet 4 do not work.
|
|
399
399
|
- **SSR.** Render client-only (`next/dynamic` with `ssr: false`); `'use client'` alone is not enough.
|
|
400
400
|
- **Expecting `initialData` to be reactive.** Use the ref or a `key` remount (see Loading and saving data).
|
|
401
401
|
- **Adapters without providers.** `ElementEditorControls` throws outside `ElementEditorUIProvider`; it also needs a `GeoStoreProvider` (one per editor) and a `data-elm-theme="light" | "dark"` ancestor containing the map and all editor UI. Portaled UI of your own needs a `data-elm-portal` attribute.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A complete map editor in one React component: drawing tools, vertex editing, sna
|
|
|
8
8
|
npm install @element-editor/react maplibre-gl
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Peer dependencies: `react` and `react-dom` `^19.2` (React 18 is not supported), `maplibre-gl`
|
|
11
|
+
Peer dependencies: `react` and `react-dom` `^19.2` (React 18 is not supported), `maplibre-gl` 5.5 or 6. If your app pins an older React (Next.js 15's `create-next-app` installs 19.1), upgrade it: `npm install react@^19.2 react-dom@^19.2`.
|
|
12
12
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|