@nika-js/onlymap 0.4.0 → 0.4.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/README.md +2 -2
- package/dist/{LercDecode.es-CWLcQT4F.js → LercDecode.es-B35eeLUh.js} +1 -1
- package/dist/{basemap-CZupn0P2.js → basemap--znNIrJq.js} +1 -1
- package/dist/elements/om-map.d.ts +30 -0
- package/dist/elements/om-widget.d.ts +15 -0
- package/dist/{index-BoxZ3Mec.js → index-BKiyX-jQ.js} +9453 -9266
- package/dist/{index-SWWESFOk.js → index-C8twrrDP.js} +2 -2
- package/dist/{index-Vw-Top85.js → index-CHmCCmPV.js} +1 -1
- package/dist/{index-CC4aVelb.js → index-ClqgDar6.js} +1 -1
- package/dist/{index-C8uDiJN4.js → index-_K3U-Ww1.js} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/{lerc-CSc9BX_F.js → lerc-filCwJiM.js} +2 -2
- package/dist/onlymap.standalone.js +14204 -14017
- package/dist/onlymapjs.js +57 -49
- package/dist/{raster-DDi9gXqf.js → raster-xUPg8Z-C.js} +2 -2
- package/dist/react/context.d.ts +5 -3
- package/dist/react/om-map.d.ts +2 -0
- package/dist/react/om-widget.d.ts +4 -1
- package/dist/react.js +194 -199
- package/dist/version.d.ts +1 -1
- package/dist/widget-layout.d.ts +62 -0
- package/llms.txt +1 -1
- package/onlymapjs.html-data.json +36 -1
- package/package.json +2 -1
- package/skills/onlymapjs/SKILL.md +1 -1
- package/skills/onlymapjs/references/react.md +2 -2
- package/skills/onlymapjs/references/syntax.md +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ Or with no build step at all, straight from a CDN:
|
|
|
69
69
|
|
|
70
70
|
The bare package URL serves `dist/onlymap.standalone.js`, a single-file bundle built for exactly this (jsDelivr too). Use a CDN that serves the package's raw files — **not** a rebundling CDN like esm.sh, which re-splits the bundle into duplicate copies of the deck.gl/luma.gl runtime and breaks every layer's shader compilation.
|
|
71
71
|
|
|
72
|
-
Then `npx @nika-js/onlymap init` wires up VS Code IntelliSense and `!`-prefixed manifest snippets for your project. The library ships with
|
|
72
|
+
Then `npx @nika-js/onlymap init` wires up VS Code IntelliSense and `!`-prefixed manifest snippets for your project. The library ships with 518 unit/behavioral tests and 41 Playwright GPU tests.
|
|
73
73
|
|
|
74
74
|
The [examples](https://github.com/NikaGeospatial/onlymapjs/tree/main/examples) are the best tour: widgets, behaviors & overlays, basemaps, columnar/Arrow data, manual drawing, 3D models, scene lighting (with the native lighting widget), DEM terrain, a live WebSocket ship feed, and a polled driver fleet.
|
|
75
75
|
|
|
@@ -81,7 +81,7 @@ A handful of elements, one rule: **attributes are kebab-case versions of deck.gl
|
|
|
81
81
|
|---|---|
|
|
82
82
|
| `<om-map>` | The map. `center`, `zoom`, `pitch`, `bearing`; `basemap` takes a free preset (`positron`, `liberty`, `dark-matter`, `osm`, …), a style URL, or `"none"` (standalone canvas) — and switches **live**; `validate` for a live on-page error panel. |
|
|
83
83
|
| `<om-layer>` | Any of **34 layer types** by name — all of deck.gl's core, geo, aggregation, and mesh layers (Scatterplot, GeoJson, Arc, Path, Heatmap, Hexagon, Trips, Tile, Tile3D, Scenegraph, …) plus the built-in `PopupLayer` for WebGL badges/labels at scale and the native `COGLayer` for GeoTIFF rasters. `id` required; `label`/`color` feed the legend. |
|
|
84
|
-
| `<om-widget>` | UI panels. Built-ins: `legend` (symbology-aware: color scales render as gradient ramps or class ranges, categorical ternaries as discrete palettes), `layer-switcher`, `basemap-switcher`, `lighting`, `zoom-controls`, `undo-redo`, `scale-bar`, `attribution`, `filter`, `draw`, `vega-lite` (live charts). Or write your own inline with HTML + a `<script type="om/widget">`. Themeable from plain page CSS via custom properties: `om-map { --om-widget-bg: #111827; --om-widget-fg: #f9fafb; }` (also `-muted`, `-border`, `-hover-bg`, `-accent`). |
|
|
84
|
+
| `<om-widget>` | UI panels. Built-ins: `legend` (symbology-aware: color scales render as gradient ramps or class ranges, categorical ternaries as discrete palettes), `layer-switcher`, `basemap-switcher`, `lighting`, `zoom-controls`, `undo-redo`, `scale-bar`, `attribution`, `filter`, `draw`, `vega-lite` (live charts). Or write your own inline with HTML + a `<script type="om/widget">`. **Placement is managed**: `position` takes one of 8 logical, RTL-aware slots (`top-start`, `top-center`, `top-end`, `center-start`, `center-end`, `bottom-start`, `bottom-center`, `bottom-end`; legacy corner names alias) — same-slot widgets stack with flush edges and a shared gap, `order` sets in-slot ordering, and `position="manual"` opts out entirely (a plain block you style yourself, even outside the map). Themeable from plain page CSS via custom properties: `om-map { --om-widget-bg: #111827; --om-widget-fg: #f9fafb; }` (also `-muted`, `-border`, `-hover-bg`, `-accent`), plus layout tokens (`--om-widget-inset-x/-y`, `--om-widget-gap-x/-y`, `--om-widget-opacity`, `--om-widget-radius`) or the no-CSS sugar `<om-map widget-style="gap:10 opacity:0.9">`. |
|
|
85
85
|
| `<om-overlay>` | Rich HTML anchored to a map location — a static `anchor="[lng, lat]"`, the current selection, or a feature's own geometry via `anchor-layer`/`anchor-feature-id`. `{{field}}` interpolates the picked feature, HTML-escaped by default. |
|
|
86
86
|
| `<om-behavior>` | Declarative interactions: `on="click|hover|drag|load|data-loaded"` → a named action. |
|
|
87
87
|
| `<om-story>` | A storyboard: `<om-step>` children fire actions on a timeline. Controlled by the `player` widget, behaviors, or `storyEl.play()/pause()/seek()`. |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-
|
|
1
|
+
import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-BKiyX-jQ.js";
|
|
2
2
|
const Cd = Math.PI / 180, gy = 180 / Math.PI;
|
|
3
3
|
function em(Pe, Q = 0) {
|
|
4
4
|
const ge = Math.min(180, Pe) * Cd;
|
|
@@ -21,6 +21,7 @@ import { HTMLElementBase } from "../env";
|
|
|
21
21
|
import { type RuntimeContext } from "../ctx";
|
|
22
22
|
import { type LightingIR } from "../scene-lighting";
|
|
23
23
|
import { type TerrainIR } from "../terrain";
|
|
24
|
+
import { type WidgetSlot } from "../widget-layout";
|
|
24
25
|
import { type SnapshotOptions } from "../snapshot";
|
|
25
26
|
import type { LayerIR } from "../ir";
|
|
26
27
|
import type { Selection } from "../selection";
|
|
@@ -53,6 +54,35 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
53
54
|
private loadDispatched;
|
|
54
55
|
connectedCallback(): void;
|
|
55
56
|
disconnectedCallback(): void;
|
|
57
|
+
/** Library-owned stacking layer: one absolutely-positioned flex container per managed slot, created lazily. Rendering plumbing, never authored state. */
|
|
58
|
+
private widgetLayer;
|
|
59
|
+
private readonly slotContainers;
|
|
60
|
+
/** Is this node the widget layer or one of its slot containers? (Their childList churn is plumbing, not manifest edits.) */
|
|
61
|
+
private isWidgetLayoutPlumbing;
|
|
62
|
+
/**
|
|
63
|
+
* Places an <om-widget> into its managed slot container (creating layer/
|
|
64
|
+
* container on demand), or back into the light DOM for the manual tier.
|
|
65
|
+
* The reparent is RENDERING PLUMBING: history-suppressed (undo must never
|
|
66
|
+
* replay it) and filtered out of manifest-change detection. The widget's
|
|
67
|
+
* authored state — its `position` attribute — never changes here.
|
|
68
|
+
*/
|
|
69
|
+
/** Per-widget comment anchors marking the AUTHORED light-DOM position — a managed→manual flip restores the widget where the author wrote it, not at the end. */
|
|
70
|
+
private readonly slotAnchors;
|
|
71
|
+
/** The widget layer div — lazy, shared by slot containers AND the layout tokens (both lanes put tokens on the layer, never on an authored element). */
|
|
72
|
+
private ensureWidgetLayer;
|
|
73
|
+
slotWidgetInternal(el: HTMLElement, slot: WidgetSlot): void;
|
|
74
|
+
/** Custom properties applied from widget-style — tracked so an edit reverts removed pairs to their defaults (CSSStyleDeclaration iteration of custom props is not portable). */
|
|
75
|
+
private appliedWidgetStyleProps;
|
|
76
|
+
/**
|
|
77
|
+
* `widget-style` sugar → custom properties on the WIDGET LAYER, never the
|
|
78
|
+
* authored <om-map> element (matching the React lane): inline style on an
|
|
79
|
+
* authored element would collide with author styles and leak into any
|
|
80
|
+
* outerHTML serialization. Unparseable/out-of-range pairs are skipped
|
|
81
|
+
* live; validation carries the loud version. Author page-CSS tokens on
|
|
82
|
+
* `om-map { --om-widget-*: … }` still cascade INTO the layer; the sugar
|
|
83
|
+
* (being inline on the layer) wins over page CSS, matching attr > CSS.
|
|
84
|
+
*/
|
|
85
|
+
private applyWidgetStyle;
|
|
56
86
|
registerWidgetInternal(el: Element, watch: string[], notify: (ctx: RuntimeContext) => void): void;
|
|
57
87
|
unregisterWidgetInternal(el: Element): void;
|
|
58
88
|
registerOverlayInternal(overlay: OverlayHost): void;
|
|
@@ -21,8 +21,23 @@ export declare class OmWidgetElement extends HTMLElementBase implements WidgetHo
|
|
|
21
21
|
private mapEl;
|
|
22
22
|
private renderFn?;
|
|
23
23
|
private watchTokens;
|
|
24
|
+
private hostStyle;
|
|
25
|
+
/** Live placement attributes (spec: "Widget Layout Manager") — position/order edits (incl. undo replays) re-slot without a remount. */
|
|
26
|
+
static readonly observedAttributes: string[];
|
|
24
27
|
connectedCallback(): void;
|
|
25
28
|
disconnectedCallback(): void;
|
|
29
|
+
attributeChangedCallback(name: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Slot placement (spec: "Widget Layout Manager"). Managed slots: the host
|
|
32
|
+
* is a plain flex item inside the map-owned slot container (flush edges,
|
|
33
|
+
* gap, stacking come from the container — never from the widget). Manual:
|
|
34
|
+
* a plain block the author styles and places, including outside the map.
|
|
35
|
+
* `order` (managed tier) is deterministic in-slot ordering via flex
|
|
36
|
+
* `order`; default is DOM order.
|
|
37
|
+
*/
|
|
38
|
+
/** Last-applied tier — hostStyle only rewrites (CSSOM reparse) on an actual manual↔managed flip, not on every replayed identical write. */
|
|
39
|
+
private appliedTier;
|
|
40
|
+
private applyPlacement;
|
|
26
41
|
private setUpRenderer;
|
|
27
42
|
$(selector: string): Element | null;
|
|
28
43
|
$$(selector: string): NodeListOf<Element>;
|