@nika-js/onlymap 0.5.12 → 0.6.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/CHANGELOG.md +19 -0
- package/LICENSE.md +2 -0
- package/README.md +19 -7
- package/THIRD-PARTY-LICENSES.md +27 -0
- package/dist/{LercDecode.es-C97NsRLr.js → LercDecode.es-CJnypw8j.js} +1 -1
- package/dist/{basemap-kc0aQNqr.js → basemap-DrQ0-eyR.js} +1 -1
- package/dist/cityjson-D_V5GY8b.js +332 -0
- package/dist/crs-Ciu7Xs7a.js +108 -0
- package/dist/crs.d.ts +50 -0
- package/dist/ctx.d.ts +8 -1
- package/dist/elements/om-map.d.ts +26 -2
- package/dist/elements/om-overlay.d.ts +1 -1
- package/dist/elements/om-widget.d.ts +4 -0
- package/dist/feature-colors.d.ts +41 -0
- package/dist/{geoparquet-Dn1BypCS.js → geoparquet-Dix4lTNy.js} +1 -1
- package/dist/html-data.d.ts +1 -1
- package/dist/ifc-Dc-TdSJr.js +877 -0
- package/dist/ifc.d.ts +406 -0
- package/dist/{index-aBiHCzy-.js → index-1UgNlfGR.js} +20944 -18922
- package/dist/{index-BoUIm-jd.js → index-BQMjW5w0.js} +1 -1
- package/dist/{index-BcG3m2rF.js → index-B_1PPJgC.js} +1 -1
- package/dist/{index-DA_aop8u.js → index-CAuT5j9Y.js} +2 -2
- package/dist/{index-Dc-ZLLo8.js → index-CXPaeisL.js} +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/layer-registry.d.ts +14 -0
- package/dist/layers/bim-layer.d.ts +104 -0
- package/dist/layers/feature-mesh-layer.d.ts +288 -0
- package/dist/layers/gltf-scene-walk.d.ts +55 -0
- package/dist/{lerc-74-SNPeU.js → lerc-CbTjQ7uI.js} +2 -2
- package/dist/license.d.ts +29 -5
- package/dist/meshopt_simplifier-Co6uRDDA.js +370 -0
- package/dist/onlymap.standalone.js +58057 -54751
- package/dist/onlymapjs.js +69 -67
- package/dist/programmatic.d.ts +22 -2
- package/dist/{raster-VyHCbPXy.js → raster-0b0nSHUh.js} +2 -2
- package/dist/{raster-pipeline-CGQTOUjw.js → raster-pipeline-D8siq7-4.js} +1 -1
- package/dist/react/om-overlay.d.ts +9 -0
- package/dist/react.js +144 -144
- package/dist/runtime-core.d.ts +110 -3
- package/dist/selection.d.ts +33 -0
- package/dist/site-placement.d.ts +85 -0
- package/dist/testing.d.ts +6 -2
- package/dist/tile3d-metadata.d.ts +185 -0
- package/dist/version.d.ts +1 -1
- package/dist/widget-registry.d.ts +11 -0
- package/dist/widgets/ifc-clash.d.ts +18 -0
- package/dist/widgets/ifc.d.ts +41 -0
- package/dist/{zarr-DddHNVim.js → zarr-DCYro_Vs.js} +79 -66
- package/docs/3d-assets.md +3 -3
- package/docs/live-data.md +2 -2
- package/docs/stories.md +1 -1
- package/docs/testing.md +2 -2
- package/llms.txt +3 -3
- package/onlymapjs.html-data.json +152 -0
- package/package.json +7 -2
- package/skills/onlymapjs/SKILL.md +4 -2
- package/skills/onlymapjs/references/react.md +1 -1
- package/skills/onlymapjs/references/syntax.md +299 -12
- package/dist/cityjson-urQeujQv.js +0 -407
package/dist/crs.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled coordinate reference systems, shared by every decoder that has to
|
|
3
|
+
* turn projected coordinates into lon/lat.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from cityjson.ts so the IFC path can reuse it. An IFC file's
|
|
6
|
+
* `IfcMapConversion` states its position in a projected CRS named by
|
|
7
|
+
* `IfcProjectedCRS`, exactly as CityJSON states one in
|
|
8
|
+
* `metadata.referenceSystem`, so both need the same table and the same lazy
|
|
9
|
+
* proj4 import. Duplicating it would have meant a Dutch model georeferencing
|
|
10
|
+
* correctly as CityJSON and 108 m out as IFC.
|
|
11
|
+
*
|
|
12
|
+
* proj4 is imported LAZILY at the point of use, never at module scope: most
|
|
13
|
+
* files need no projection at all, and the ones that do are already paying for
|
|
14
|
+
* a parse.
|
|
15
|
+
*/
|
|
16
|
+
export interface CrsEntry {
|
|
17
|
+
def: string;
|
|
18
|
+
/** Source stores [northing, easting] / [lat, lon] — swap before handing to proj4. */
|
|
19
|
+
swapXY?: boolean;
|
|
20
|
+
/** Already angular: no reprojection, but horizontal metrics need a local metric frame. */
|
|
21
|
+
geographic?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Compound (horizontal + vertical) codes → the horizontal component that actually projects. */
|
|
24
|
+
export declare const COMPOUND_TO_HORIZONTAL: Record<number, number>;
|
|
25
|
+
export declare const CRS_DEFS: Record<number, CrsEntry>;
|
|
26
|
+
/** The EPSG codes this build can convert without help. */
|
|
27
|
+
export declare function bundledCrsCodes(): number[];
|
|
28
|
+
/**
|
|
29
|
+
* Projected (or geographic) coordinates in EPSG:`code` -> `[lon, lat]`.
|
|
30
|
+
*
|
|
31
|
+
* Returns null when the code is not bundled, which callers must treat as "I
|
|
32
|
+
* cannot place this" rather than silently substituting something else — a
|
|
33
|
+
* wrong position looks exactly like a right one.
|
|
34
|
+
*
|
|
35
|
+
* `x`/`y` are given easting-first; entries flagged `swapXY` (Japan's plane
|
|
36
|
+
* systems, RD's formal axis order) are swapped here so callers never have to
|
|
37
|
+
* know which convention a CRS uses.
|
|
38
|
+
*/
|
|
39
|
+
export declare function projectedToLonLat(code: number, x: number, y: number): Promise<[number, number] | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Bearing of the projection's GRID north at a point, in degrees clockwise from
|
|
42
|
+
* true north — the grid convergence.
|
|
43
|
+
*
|
|
44
|
+
* Measured rather than derived: unproject the point and a second one a short
|
|
45
|
+
* step further north IN GRID SPACE, then take the true bearing between them.
|
|
46
|
+
* That works for any projection in the table without per-CRS formulae, and it
|
|
47
|
+
* matters because a model aligned to a national grid is NOT aligned to true
|
|
48
|
+
* north. Dutch RD at Rotterdam is off by -0.735 degrees.
|
|
49
|
+
*/
|
|
50
|
+
export declare function gridConvergence(code: number, x: number, y: number, step?: number): Promise<number | null>;
|
package/dist/ctx.d.ts
CHANGED
|
@@ -35,6 +35,12 @@ export interface RuntimeContext {
|
|
|
35
35
|
project(lngLat: [number, number]): [number, number];
|
|
36
36
|
};
|
|
37
37
|
selection: Selection | null;
|
|
38
|
+
/**
|
|
39
|
+
* The decoded EXT_structural_metadata property table for a `pick-features`
|
|
40
|
+
* layer, indexed BY feature ID, or null before its first tile has loaded.
|
|
41
|
+
* Watch the `features` token to re-render when it arrives.
|
|
42
|
+
*/
|
|
43
|
+
features(layerId: string): Record<string, unknown>[] | null;
|
|
38
44
|
/** Manifest undo/redo state (spec: "Undo / Redo — Manifest History") — drive it via emit("undo"/"redo"). Always false on the programmatic/React path (the app owns state there). */
|
|
39
45
|
history: {
|
|
40
46
|
canUndo: boolean;
|
|
@@ -49,6 +55,7 @@ export interface RuntimeContext {
|
|
|
49
55
|
}
|
|
50
56
|
export interface BuildCtxDeps {
|
|
51
57
|
layerIRs: ReadonlyMap<string, LayerIR>;
|
|
58
|
+
featureTables?: ReadonlyMap<string, Record<string, unknown>[]>;
|
|
52
59
|
core: RuntimeCore;
|
|
53
60
|
mapEl: Element;
|
|
54
61
|
selection: Selection | null;
|
|
@@ -62,4 +69,4 @@ export declare function viewportBounds(viewport: ReturnType<RuntimeCore["getView
|
|
|
62
69
|
/** `ctx.layers` / the `layers` external store — one builder for both (spec: "External-Store Contract"). */
|
|
63
70
|
export declare function buildLayerMetas(layerIRs: ReadonlyMap<string, LayerIR>): LayerMetaSnapshot[];
|
|
64
71
|
/** Built fresh on every widget-render invocation — never mutated, never reused. */
|
|
65
|
-
export declare function buildCtx({ layerIRs, core, mapEl, selection, history }: BuildCtxDeps): RuntimeContext;
|
|
72
|
+
export declare function buildCtx({ layerIRs, core, mapEl, selection, history, featureTables }: BuildCtxDeps): RuntimeContext;
|
|
@@ -23,11 +23,12 @@ import { type LightingIR } from "../scene-lighting";
|
|
|
23
23
|
import { type TerrainIR } from "../terrain";
|
|
24
24
|
import { type WidgetSlot } from "../widget-layout";
|
|
25
25
|
import { type SnapshotOptions } from "../snapshot";
|
|
26
|
+
import { type ValidationEntry } from "../validation";
|
|
26
27
|
import type { LayerIR } from "../ir";
|
|
27
28
|
import type { Selection } from "../selection";
|
|
28
29
|
import type { MapViewport } from "../basemap";
|
|
29
30
|
interface OverlayHost {
|
|
30
|
-
updatePosition(viewport: MapViewport | undefined, selection: Selection | null): void;
|
|
31
|
+
updatePosition(viewport: MapViewport | undefined, selection: Selection | null, pickType?: "hover" | "click"): void;
|
|
31
32
|
/**
|
|
32
33
|
* Screen rect for collision-dim (spec: "Overlap avoidance") — non-null
|
|
33
34
|
* only when the overlay is VISIBLE and participates in dimming. Returns
|
|
@@ -47,13 +48,26 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
47
48
|
private contextmenuHandler?;
|
|
48
49
|
private mount;
|
|
49
50
|
private reconcilePending;
|
|
51
|
+
/** Decoded property tables per pick-features layer — see RuntimeCoreCallbacks.onFeatureTable. */
|
|
52
|
+
private featureTables;
|
|
50
53
|
private layerIRs;
|
|
51
54
|
private selection;
|
|
55
|
+
/**
|
|
56
|
+
* The pointer event behind the most recent pick — kept SEPARATELY from
|
|
57
|
+
* `selection` because empty picks store `selection = null`, losing their
|
|
58
|
+
* type, yet `selection-type`-scoped overlays must tell a click on empty
|
|
59
|
+
* space (dismisses a click popup) from a hover over empty space (inert).
|
|
60
|
+
*/
|
|
61
|
+
private lastPickType;
|
|
52
62
|
private widgets;
|
|
53
63
|
private overlays;
|
|
54
64
|
private overlayFlushPending;
|
|
55
65
|
private errorPanel;
|
|
56
66
|
private runtimeErrors;
|
|
67
|
+
/** Dedup guard for the approximate-BIM-georeferencing warning — same shape as applyLicenseGates' own `warned` set, keyed per layer id. */
|
|
68
|
+
private warnedApproximatePlacement;
|
|
69
|
+
/** Dedup guard for the no-terrain-for-elevation error — same shape as `warnedApproximatePlacement`. */
|
|
70
|
+
private erroredNoTerrainForElevation;
|
|
57
71
|
private readyFired;
|
|
58
72
|
private visibleSizeChecked;
|
|
59
73
|
/** Custom-state holder for the `om-collapsed` height-floor marker — see applyHeightFloor. */
|
|
@@ -231,7 +245,7 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
231
245
|
* by mountForTest's pick()/clearSelection(), not part of the public
|
|
232
246
|
* authoring surface.
|
|
233
247
|
*/
|
|
234
|
-
injectPickInternal(selection: Selection | null): void;
|
|
248
|
+
injectPickInternal(selection: Selection | null, pickType?: "hover" | "click"): void;
|
|
235
249
|
injectDragPickInternal(selection: Selection): void;
|
|
236
250
|
/** Every click/hover map coordinate (spec: "Manual Drawing"): drives the
|
|
237
251
|
* internal draw controller AND fires the public `om-map-point` event, so
|
|
@@ -341,6 +355,16 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
341
355
|
* still runs validation and fires the event, just skips the on-page panel
|
|
342
356
|
* (spec: "for teams building their own error UI").
|
|
343
357
|
*/
|
|
358
|
+
/**
|
|
359
|
+
* Reports a runtime-discovered validation entry — deck.gl crashes and
|
|
360
|
+
* license-limit violations already flow through this (via `onRuntimeError`
|
|
361
|
+
* below); this is also the entry point for facts a WIDGET discovers
|
|
362
|
+
* directly (no round trip through RuntimeCore) since it already holds an
|
|
363
|
+
* `<om-map>` reference — see `ifc-loader`'s approximate-georeferencing
|
|
364
|
+
* warning. Same access-pattern precedent as `registerWidgetInternal`
|
|
365
|
+
* above: real and callable, not part of the documented public API.
|
|
366
|
+
*/
|
|
367
|
+
reportRuntimeErrorInternal(entry: ValidationEntry): void;
|
|
344
368
|
private publishValidation;
|
|
345
369
|
}
|
|
346
370
|
declare global {
|
|
@@ -86,5 +86,5 @@ export declare class OmOverlayElement extends HTMLElementBase {
|
|
|
86
86
|
* must not flicker widgets). Only stable author popups drive dimming.
|
|
87
87
|
*/
|
|
88
88
|
getVisibleRect(): DOMRect | null;
|
|
89
|
-
updatePosition(viewport: MapViewport | undefined, selection: Selection | null): void;
|
|
89
|
+
updatePosition(viewport: MapViewport | undefined, selection: Selection | null, pickType?: "hover" | "click"): void;
|
|
90
90
|
}
|
|
@@ -22,6 +22,10 @@ export declare class OmWidgetElement extends HTMLElementBase implements WidgetHo
|
|
|
22
22
|
private renderFn?;
|
|
23
23
|
private watchTokens;
|
|
24
24
|
private hostStyle;
|
|
25
|
+
/** The registered implementation behind `type="…"` — kept so real removal can call its optional destroy() hook. */
|
|
26
|
+
private impl;
|
|
27
|
+
/** One pending real-removal check at a time — a remove→insert→remove within a single task must not run destroy twice. */
|
|
28
|
+
private destroyCheckPending;
|
|
25
29
|
/** Live placement attributes (spec: "Widget Layout Manager") — position/order edits (incl. undo replays) re-slot without a remount. */
|
|
26
30
|
static readonly observedAttributes: string[];
|
|
27
31
|
connectedCallback(): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Colour-blind-safe categorical default, cycled when a field has more values than entries. */
|
|
2
|
+
export declare const FEATURE_PALETTE: string[];
|
|
3
|
+
export declare const FEATURE_RAMP: string[];
|
|
4
|
+
export declare function resolveFeatureColor(entry: unknown): [number, number, number];
|
|
5
|
+
/**
|
|
6
|
+
* The GLOBAL half of feature colouring — everything derived from the WHOLE
|
|
7
|
+
* accumulated table, none of it indexed by feature ID. Serializable on
|
|
8
|
+
* purpose (`order` is entries, not a Map): its identity is the memo key that
|
|
9
|
+
* keeps per-tile style tables (and their GPU textures) stable across
|
|
10
|
+
* reconciles and animation frames.
|
|
11
|
+
*/
|
|
12
|
+
export interface FeatureColorMapping {
|
|
13
|
+
kind: "categorical" | "graduated";
|
|
14
|
+
field: string;
|
|
15
|
+
/** graduated: the max across every loaded tile (colours stay comparable as tiles stream in). */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** categorical: global value → first-seen order (assigns each value a stable palette slot). */
|
|
18
|
+
order?: [string, number][];
|
|
19
|
+
/** Resolved palette/ramp — author `feature-palette` or the built-in defaults. */
|
|
20
|
+
colors: unknown[];
|
|
21
|
+
strength: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the mapping from the layer's ACCUMULATED rows (all tiles).
|
|
25
|
+
* Returns null when neither colouring attribute is asked for — the model then
|
|
26
|
+
* renders in its own IFC surface colours. Authored `feature-styles` always
|
|
27
|
+
* wins upstream: the declarative attributes are sugar over the same table,
|
|
28
|
+
* never an override of it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildFeatureColorMapping(rows: Record<string, unknown>[], categorical: string | undefined, graduated: string | undefined, palette: unknown[] | undefined, strength: number): FeatureColorMapping | null;
|
|
31
|
+
/**
|
|
32
|
+
* Applies the mapping to ONE tile's own rows — the per-tile style table, index
|
|
33
|
+
* = that tile's local feature ID. A category unseen in the global order (a
|
|
34
|
+
* race while tiles stream; the next accumulate pass rebuilds the mapping)
|
|
35
|
+
* falls back to slot 0 rather than being unstyled, matching the pre-split
|
|
36
|
+
* behavior for unknown values.
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyFeatureColorMapping(rows: Record<string, unknown>[], mapping: FeatureColorMapping): {
|
|
39
|
+
color: [number, number, number];
|
|
40
|
+
strength: number;
|
|
41
|
+
}[];
|
package/dist/html-data.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface TagData {
|
|
|
17
17
|
/** Hand-authored action list — validated against hasAction() in html-data.test.ts. */
|
|
18
18
|
export declare const BUILTIN_ACTIONS: readonly ["toggle-layer", "zoom-in", "zoom-out", "filter-layer", "highlight-feature", "fade", "pulse", "populate", "trace", "story-play", "story-pause", "story-seek", "fly-to", "zoom-to-feature", "show-overlay", "hide-overlay", "show-tooltip", "hide-tooltip", "draw-mode", "draw-commit", "draw-cancel", "draw-delete", "draw-clear", "draw-config", "draw-save", "measure-mode", "measure-clear", "measure-units", "set-basemap", "set-lighting", "set-terrain", "set-widgets-visible", "undo", "redo"];
|
|
19
19
|
/** Hand-authored widget types — validated against the widget registry in html-data.test.ts. */
|
|
20
|
-
export declare const BUILTIN_WIDGETS: readonly ["legend", "layer-switcher", "zoom-controls", "scale-bar", "attribution", "filter", "vega-lite", "player", "draw", "measure", "basemap-switcher", "lighting", "undo-redo", "widgets-toggle"];
|
|
20
|
+
export declare const BUILTIN_WIDGETS: readonly ["legend", "layer-switcher", "zoom-controls", "scale-bar", "attribution", "filter", "vega-lite", "player", "draw", "measure", "basemap-switcher", "lighting", "undo-redo", "widgets-toggle", "ifc-browser", "ifc-legend", "feature-inspector", "ifc-inspector", "ifc-loader", "ifc-clash"];
|
|
21
21
|
export declare function buildHtmlCustomData(): {
|
|
22
22
|
version: number;
|
|
23
23
|
tags: TagData[];
|