@nika-js/onlymap 0.4.2 → 0.4.4

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.
Files changed (36) hide show
  1. package/README.md +39 -8
  2. package/bin/onlymapjs.mjs +147 -11
  3. package/dist/{LercDecode.es-CtFZNCJy.js → LercDecode.es-CgN9Gb9e.js} +1 -1
  4. package/dist/{basemap-DfeKYdar.js → basemap-Bfn5Z__c.js} +168 -163
  5. package/dist/basemap.d.ts +3 -1
  6. package/dist/elements/om-map.d.ts +48 -0
  7. package/dist/elements/om-overlay.d.ts +8 -0
  8. package/dist/{index-CeAQFyJG.js → index-C4cWRigY.js} +1 -1
  9. package/dist/{index-CU-Ft1NI.js → index-CnitG1VX.js} +2 -2
  10. package/dist/{index-ULsb51al.js → index-KgO0MBqA.js} +12959 -12470
  11. package/dist/{index-BcbVw4b7.js → index-M8KfTTol.js} +1 -1
  12. package/dist/{index-PfwJVVKI.js → index-lXrP3rPo.js} +1 -1
  13. package/dist/index.d.ts +4 -2
  14. package/dist/layout-audit.d.ts +53 -0
  15. package/dist/{lerc-DsrKzmOh.js → lerc-l-QFh62d.js} +2 -2
  16. package/dist/onlymap.standalone.js +21464 -20970
  17. package/dist/onlymapjs.js +73 -62
  18. package/dist/programmatic.d.ts +3 -1
  19. package/dist/{raster-CXnE4ZJp.js → raster-BBA_oI-d.js} +2 -2
  20. package/dist/react/context.d.ts +9 -1
  21. package/dist/react/om-map.d.ts +3 -1
  22. package/dist/react/om-widget.d.ts +3 -1
  23. package/dist/react.js +333 -202
  24. package/dist/runtime-core.d.ts +12 -1
  25. package/dist/version.d.ts +1 -1
  26. package/dist/widget-layout.d.ts +16 -0
  27. package/docs/basemaps.md +1 -1
  28. package/docs/react.md +2 -1
  29. package/docs/testing.md +10 -0
  30. package/llms.txt +2 -2
  31. package/onlymapjs.html-data.json +27 -0
  32. package/package.json +1 -1
  33. package/skills/onlymapjs/SKILL.md +2 -1
  34. package/skills/onlymapjs/references/react.md +2 -2
  35. package/skills/onlymapjs/references/syntax.md +5 -4
  36. package/skills/onlymapjs/references/testing.md +15 -0
package/dist/basemap.d.ts CHANGED
@@ -22,8 +22,10 @@ export declare class MapLibreBasemapAdapter {
22
22
  private overlay;
23
23
  /** Our own compact attribution control (spec: "attribution becomes correct, not optional") — undefined when the author opted out. */
24
24
  private attribution?;
25
+ private attributionElement?;
25
26
  private attributionText?;
26
27
  private showAttribution;
28
+ private attributionHost?;
27
29
  /**
28
30
  * One-time "has the map initialized at least once" flag, set by the first
29
31
  * `load` event. Deliberately NOT `this.map.loaded()` — that method means
@@ -46,7 +48,7 @@ export declare class MapLibreBasemapAdapter {
46
48
  zoom: number;
47
49
  pitch?: number;
48
50
  bearing?: number;
49
- }, deckProps: DeckProps, showAttribution?: boolean);
51
+ }, deckProps: DeckProps, showAttribution?: boolean, attributionHost?: HTMLElement);
50
52
  /** Snapshot capture queue for the overlay's deck canvas — see captureComposite. */
51
53
  private deckCaptures;
52
54
  /** In-flight captureComposite rejects — destroy() settles them so a caller never hangs on a torn-down renderer. */
@@ -28,6 +28,15 @@ import type { Selection } from "../selection";
28
28
  import type { MapViewport } from "../basemap";
29
29
  interface OverlayHost {
30
30
  updatePosition(viewport: MapViewport | undefined, selection: Selection | null): void;
31
+ /**
32
+ * Screen rect for collision-dim (spec: "Overlap avoidance") — non-null
33
+ * only when the overlay is VISIBLE and participates in dimming. Returns
34
+ * null when hidden OR when it's transient runtime chrome (the internal
35
+ * hover tooltip / trace / draw preview): those glide constantly and must
36
+ * not flicker widgets. The map reads this off its registered host set
37
+ * rather than re-querying the DOM.
38
+ */
39
+ getVisibleRect(): DOMRect | null;
31
40
  }
32
41
  export declare class OmMapElement extends HTMLElementBase {
33
42
  private core;
@@ -57,6 +66,14 @@ export declare class OmMapElement extends HTMLElementBase {
57
66
  /** Library-owned stacking layer: one absolutely-positioned flex container per managed slot, created lazily. Rendering plumbing, never authored state. */
58
67
  private widgetLayer;
59
68
  private readonly slotContainers;
69
+ private readonly mandatedChromeHosts;
70
+ private widgetResizeObserver;
71
+ private widgetsFolded;
72
+ private foldPassPending;
73
+ private inFoldPass;
74
+ private readonly foldMapId;
75
+ private readonly foldedWidgetSlots;
76
+ private readonly foldDrawers;
60
77
  /**
61
78
  * Is this node layout plumbing (the widget layer, slot containers, or
62
79
  * cluster wrappers)? Their childList churn is rendering, not manifest
@@ -75,7 +92,27 @@ export declare class OmMapElement extends HTMLElementBase {
75
92
  private readonly slotAnchors;
76
93
  /** 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). */
77
94
  private ensureWidgetLayer;
95
+ private ensureSlotContainer;
96
+ /**
97
+ * Provider attribution and the free-license badge are immutable members of
98
+ * managed slots. Their stable wrappers stay front-end-owned while renderer
99
+ * adapters mount/unmount the actual controls inside.
100
+ */
101
+ private ensureMandatedChromeHost;
78
102
  slotWidgetInternal(el: HTMLElement, slot: WidgetSlot): void;
103
+ /** Called by <om-widget> when its live `fold` attribute changes. */
104
+ refreshWidgetFoldInternal(): void;
105
+ private startWidgetFoldObserver;
106
+ private foldBreakpointPx;
107
+ private measureWidgetFold;
108
+ private updateWidgetFoldForWidth;
109
+ private scheduleFoldPass;
110
+ private shouldFoldWidget;
111
+ private ensureFoldDrawer;
112
+ private setFoldDrawerOpen;
113
+ private focusFirstIn;
114
+ private restoreFoldedWidget;
115
+ private runFoldPass;
79
116
  private clusterPassPending;
80
117
  /** Re-entry guard: the pass's own reparenting fires connect callbacks that call back into scheduleClusterPass — self-inflicted, never re-schedule. */
81
118
  private inClusterPass;
@@ -125,6 +162,17 @@ export declare class OmMapElement extends HTMLElementBase {
125
162
  * multiple viewport/selection changes per frame into one DOM pass).
126
163
  */
127
164
  private scheduleOverlayFlush;
165
+ /**
166
+ * Dynamic overlap avoidance (spec: "Widget Layout Manager / Overlap
167
+ * avoidance") — a slot container whose rect intersects an OPEN
168
+ * `<om-overlay>` popup is dimmed (`--om-widget-opacity-dimmed`, default
169
+ * 0.35) rather than repositioned. Own overlays only (issue Q1: foreign
170
+ * absolutely-positioned DOM is unknowable). `widgets-dim="off"` opts out.
171
+ * Real-geometry only — verified behaviorally in the layout audit, never
172
+ * modeled (headless has no rects; this no-ops there).
173
+ */
174
+ private dimSlotsAgainstOverlays;
175
+ private slotHasNeverHidesWidget;
128
176
  emit(event: string, payload?: Record<string, unknown>): void;
129
177
  /** Recenters (and optionally rezooms) the map — instant, not an animated fly. */
130
178
  flyTo(coords: [number, number], zoom?: number, opts?: {
@@ -78,5 +78,13 @@ export declare class OmOverlayElement extends HTMLElementBase {
78
78
  * static `anchor="[lng,lat]"`), culls off-screen/behind-camera anchors,
79
79
  * and re-interpolates `{{field}}` tokens against the current selection.
80
80
  */
81
+ /**
82
+ * Screen rect for collision-dim (spec: "Overlap avoidance") — null when
83
+ * hidden (via COMPUTED visibility, so author CSS/class hiding counts too,
84
+ * not just our inline write) or when this is transient runtime chrome
85
+ * (`__onlymapjs-` tooltip/trace/draw preview, which glides on hover and
86
+ * must not flicker widgets). Only stable author popups drive dimming.
87
+ */
88
+ getVisibleRect(): DOMRect | null;
81
89
  updatePosition(viewport: MapViewport | undefined, selection: Selection | null): void;
82
90
  }
@@ -1,4 +1,4 @@
1
- import { ai as Bt, ak as Xt, al as Yt, am as Us } from "./index-ULsb51al.js";
1
+ import { ai as Bt, ak as Xt, al as Yt, am as Us } from "./index-KgO0MBqA.js";
2
2
  import { w as gs, t as Hs, f as Ws, m as Qs } from "./mgrs-BY9bIvp4.js";
3
3
  import { c as Xs } from "./convert-arrow-schema-DrAihRf9.js";
4
4
  import { y as Ys, A as bt, a as Ks, z as Vs, R as Zs } from "./recordbatch-Bpc0uxFn.js";
@@ -1,5 +1,5 @@
1
- import { i as E, j as S, k as R, n as N, o as h, p as w, q as O, s as W, r as x, t as I, v as B, w as _, x as P, y as k, A as $, B as z, E as v, F, H as C, I as U, J as p, K as M } from "./index-ULsb51al.js";
2
- import { N as $e, R as ze, _ as ve, O as Ce, P as Ue, Q as Me, S as je, T as De, U as Je, X as qe, Y as He, Z as Ve, $ as Ge, a0 as Ke, a1 as Qe, a2 as Xe, a3 as Ye, a4 as Ze, a5 as et, a6 as tt, a7 as nt, a8 as rt, a9 as at, aa as st, ab as ot } from "./index-ULsb51al.js";
1
+ import { i as E, j as S, k as R, n as N, o as h, p as w, q as O, s as W, r as x, t as I, v as B, w as _, x as P, y as k, A as $, B as z, E as v, F, H as C, I as U, J as p, K as M } from "./index-KgO0MBqA.js";
2
+ import { N as $e, R as ze, _ as ve, O as Ce, P as Ue, Q as Me, S as je, T as De, U as Je, X as qe, Y as He, Z as Ve, $ as Ge, a0 as Ke, a1 as Qe, a2 as Xe, a3 as Ye, a4 as Ze, a5 as et, a6 as tt, a7 as nt, a8 as rt, a9 as at, aa as st, ab as ot } from "./index-KgO0MBqA.js";
3
3
  import { g as j, i as D } from "./table-accessors-CYWTzpQI.js";
4
4
  async function J(t, e, n = {}, r = {}) {
5
5
  const a = E(t), s = S.getWorkerFarm(n), { source: o } = n, c = { name: a, source: o };