@nika-js/onlymap 0.1.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/.vscode/onlymap.code-snippets +173 -0
- package/LICENSE.md +133 -0
- package/README.md +188 -0
- package/bin/onlymapjs.mjs +182 -0
- package/dist/Arrow.dom-7AXne1TU.js +5233 -0
- package/dist/actions.d.ts +30 -0
- package/dist/attribute-resolution.d.ts +73 -0
- package/dist/basemap-D95W0IIA.js +25203 -0
- package/dist/basemap.d.ts +72 -0
- package/dist/convert-arrow-schema-CvZ3cT5m.js +94 -0
- package/dist/csp-sandbox.d.ts +20 -0
- package/dist/ctx.d.ts +49 -0
- package/dist/d3-bundle.d.ts +218 -0
- package/dist/data-emit.d.ts +10 -0
- package/dist/data-layer.d.ts +150 -0
- package/dist/declarative-filter.d.ts +12 -0
- package/dist/dev-error-panel.d.ts +15 -0
- package/dist/draw-controller.d.ts +51 -0
- package/dist/draw.d.ts +102 -0
- package/dist/effects.d.ts +39 -0
- package/dist/elements/om-behavior.d.ts +13 -0
- package/dist/elements/om-layer.d.ts +11 -0
- package/dist/elements/om-map.d.ts +168 -0
- package/dist/elements/om-overlay.d.ts +82 -0
- package/dist/elements/om-step.d.ts +12 -0
- package/dist/elements/om-story.d.ts +67 -0
- package/dist/elements/om-widget.d.ts +29 -0
- package/dist/env.d.ts +41 -0
- package/dist/expr/cache.d.ts +28 -0
- package/dist/expr/compile.d.ts +27 -0
- package/dist/expr/errors.d.ts +10 -0
- package/dist/expr/full-js-block.d.ts +17 -0
- package/dist/expr/index.d.ts +12 -0
- package/dist/expr/output-type.d.ts +12 -0
- package/dist/expr/scale.d.ts +13 -0
- package/dist/expr/script-block.d.ts +16 -0
- package/dist/expr/whitelist.d.ts +28 -0
- package/dist/field-access.d.ts +24 -0
- package/dist/html-data.d.ts +25 -0
- package/dist/index-2v2NXF_n.js +435 -0
- package/dist/index-BFjXVHly.js +605 -0
- package/dist/index-C9w78NS9.js +4883 -0
- package/dist/index-CU-iOTdr.js +75292 -0
- package/dist/index-D74olQ9w.js +3907 -0
- package/dist/index-Do7hmHwi.js +1457 -0
- package/dist/index.d.ts +76 -0
- package/dist/ir-snapshot.d.ts +54 -0
- package/dist/ir.d.ts +66 -0
- package/dist/layer-registry.d.ts +27 -0
- package/dist/layers/popup-layer.d.ts +65 -0
- package/dist/onlymapjs.css +1 -0
- package/dist/onlymapjs.js +30 -0
- package/dist/onlymapjs.umd.cjs +8618 -0
- package/dist/parse-manifest.d.ts +19 -0
- package/dist/recordbatch-HRu0SMKp.js +4742 -0
- package/dist/runtime-core.d.ts +170 -0
- package/dist/selection.d.ts +31 -0
- package/dist/stats.d.ts +29 -0
- package/dist/table-accessors-DBjWgN0C.js +204 -0
- package/dist/template-interpolation.d.ts +6 -0
- package/dist/testing.d.ts +90 -0
- package/dist/timeline.d.ts +37 -0
- package/dist/validation.d.ts +22 -0
- package/dist/vega-loader.d.ts +22 -0
- package/dist/viewport-filter.d.ts +25 -0
- package/dist/widget-registry.d.ts +23 -0
- package/dist/widget-script.d.ts +1 -0
- package/dist/widgets/built-in.d.ts +1 -0
- package/dist/widgets/dom-utils.d.ts +4 -0
- package/llms.txt +43 -0
- package/onlymapjs.html-data.json +1688 -0
- package/package.json +111 -0
- package/skills/onlymapjs/SKILL.md +61 -0
- package/skills/onlymapjs/agents/openai.yaml +4 -0
- package/skills/onlymapjs/references/patterns.md +213 -0
- package/skills/onlymapjs/references/syntax.md +342 -0
- package/skills/onlymapjs/references/testing.md +126 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
2
|
+
import type { DeckProps, Viewport } from "@deck.gl/core";
|
|
3
|
+
export interface ViewportLike {
|
|
4
|
+
project(xyz: number[]): number[];
|
|
5
|
+
getBounds(): [number, number, number, number];
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/** What `RuntimeCore.getViewport()` returns in either mode — deck.gl's own `Viewport` (standalone) or this adapter's narrower shape (with a basemap). */
|
|
10
|
+
export type MapViewport = Viewport | ViewportLike;
|
|
11
|
+
export interface BasemapViewState {
|
|
12
|
+
longitude: number;
|
|
13
|
+
latitude: number;
|
|
14
|
+
zoom: number;
|
|
15
|
+
pitch: number;
|
|
16
|
+
bearing: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class MapLibreBasemapAdapter {
|
|
19
|
+
private map;
|
|
20
|
+
private overlay;
|
|
21
|
+
/**
|
|
22
|
+
* One-time "has the map initialized at least once" flag, set by the first
|
|
23
|
+
* `load` event. Deliberately NOT `this.map.loaded()` — that method means
|
|
24
|
+
* something different (and narrower): "is everything currently settled —
|
|
25
|
+
* no in-flight camera transition, no tiles still loading for the current
|
|
26
|
+
* viewport." It goes false for the ENTIRE DURATION of a pan/zoom (while
|
|
27
|
+
* new tiles fetch), which made `getViewport()` return `undefined` for the
|
|
28
|
+
* whole gesture — the CPU-side viewport-filter fallback ("no viewport
|
|
29
|
+
* resolved yet — include everything") kicked in for every intermediate
|
|
30
|
+
* frame, and since MapLibre's `move` event stops firing once the camera
|
|
31
|
+
* actually settles, the LAST widget render before settling was often
|
|
32
|
+
* still mid-gesture and never got superseded — visibly "stuck" showing
|
|
33
|
+
* unfiltered data after a pan, exactly the bug this fixes.
|
|
34
|
+
*/
|
|
35
|
+
private initialized;
|
|
36
|
+
private loadCallbacks;
|
|
37
|
+
constructor(container: HTMLElement, basemapAttr: string, initialView: {
|
|
38
|
+
longitude: number;
|
|
39
|
+
latitude: number;
|
|
40
|
+
zoom: number;
|
|
41
|
+
pitch?: number;
|
|
42
|
+
bearing?: number;
|
|
43
|
+
}, deckProps: DeckProps);
|
|
44
|
+
private markInitialized;
|
|
45
|
+
onLoad(cb: () => void): void;
|
|
46
|
+
/** Fires continuously during pan/zoom/rotate — MapLibre's own camera-change event, standing in for deck's onViewStateChange (which doesn't apply — deck isn't driving the camera). */
|
|
47
|
+
onMove(cb: () => void): void;
|
|
48
|
+
setLayers(layers: DeckProps["layers"]): void;
|
|
49
|
+
/** Toggle map interactions (spec: "Manual Drawing", D4) — used to suspend double-click-zoom while a draw tool is active. */
|
|
50
|
+
setInteractive(opts: {
|
|
51
|
+
doubleClickZoom?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
isLoaded(): boolean;
|
|
54
|
+
getViewport(): ViewportLike;
|
|
55
|
+
getViewState(): BasemapViewState;
|
|
56
|
+
/** Instant recenter/rezoom — the basemap's own camera jump, no deck viewState involved. */
|
|
57
|
+
jumpTo(center: [number, number], zoom?: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Animated camera (spec: "Map Stories / Animation primitives") — MapLibre's
|
|
60
|
+
* own easing. `curve` uses `flyTo` (the arcing zoom-out-and-in) instead of
|
|
61
|
+
* the direct `easeTo` interpolation. duration 0 degrades to an instant
|
|
62
|
+
* move, so this is also the one method that reaches pitch/bearing.
|
|
63
|
+
*/
|
|
64
|
+
easeTo(view: {
|
|
65
|
+
center?: [number, number];
|
|
66
|
+
zoom?: number;
|
|
67
|
+
pitch?: number;
|
|
68
|
+
bearing?: number;
|
|
69
|
+
}, durationMs: number, curve?: boolean): void;
|
|
70
|
+
fitBounds(bounds: [[number, number], [number, number]], padding: number, durationMs?: number): void;
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { S as c, F as o, h as u, o as l, L as w, n as m, x as d, b7 as b, b3 as p, bx as f, bt as h, bv as M, bz as S, bo as z, bk as F, bm as I, bq as v, ay as y, aw as x, k as A, aT as D, aR as U, aP as N, bG as k, bE as B, bC as E, bI as L, aZ as j, f as W, aW as q, a$ as C, B as G, m as O, N as P } from "./recordbatch-HRu0SMKp.js";
|
|
2
|
+
function Z(e) {
|
|
3
|
+
return R(e);
|
|
4
|
+
}
|
|
5
|
+
function R(e) {
|
|
6
|
+
return new c(e.fields.map((n) => r(n)), a(e.metadata));
|
|
7
|
+
}
|
|
8
|
+
function a(e) {
|
|
9
|
+
return e ? new Map(Object.entries(e)) : /* @__PURE__ */ new Map();
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
return new o(e.name, T(e.type), e.nullable, a(e.metadata));
|
|
13
|
+
}
|
|
14
|
+
function T(e) {
|
|
15
|
+
if (typeof e == "object")
|
|
16
|
+
switch (e.type) {
|
|
17
|
+
case "decimal":
|
|
18
|
+
return new d(e.precision, e.scale, e.bitWidth);
|
|
19
|
+
case "map":
|
|
20
|
+
let n = e.children.map((t) => r(t));
|
|
21
|
+
return new m(n, e.keysSorted);
|
|
22
|
+
case "list":
|
|
23
|
+
const s = r(e.children[0]);
|
|
24
|
+
return new w(s);
|
|
25
|
+
case "fixed-size-list":
|
|
26
|
+
const i = r(e.children[0]);
|
|
27
|
+
return new l(e.listSize, i);
|
|
28
|
+
case "struct":
|
|
29
|
+
return n = e.children.map((t) => r(t)), new u(n);
|
|
30
|
+
default:
|
|
31
|
+
throw new Error("array type not supported");
|
|
32
|
+
}
|
|
33
|
+
switch (e) {
|
|
34
|
+
case "null":
|
|
35
|
+
return new P();
|
|
36
|
+
case "binary":
|
|
37
|
+
return new O();
|
|
38
|
+
case "bool":
|
|
39
|
+
return new G();
|
|
40
|
+
case "int8":
|
|
41
|
+
return new C();
|
|
42
|
+
case "int16":
|
|
43
|
+
return new q();
|
|
44
|
+
case "int32":
|
|
45
|
+
return new W();
|
|
46
|
+
case "int64":
|
|
47
|
+
return new j();
|
|
48
|
+
case "uint8":
|
|
49
|
+
return new L();
|
|
50
|
+
case "uint16":
|
|
51
|
+
return new E();
|
|
52
|
+
case "uint32":
|
|
53
|
+
return new B();
|
|
54
|
+
case "uint64":
|
|
55
|
+
return new k();
|
|
56
|
+
case "float16":
|
|
57
|
+
return new N();
|
|
58
|
+
case "float32":
|
|
59
|
+
return new U();
|
|
60
|
+
case "float64":
|
|
61
|
+
return new D();
|
|
62
|
+
case "utf8":
|
|
63
|
+
return new A();
|
|
64
|
+
case "date-day":
|
|
65
|
+
return new x();
|
|
66
|
+
case "date-millisecond":
|
|
67
|
+
return new y();
|
|
68
|
+
case "time-second":
|
|
69
|
+
return new v();
|
|
70
|
+
case "time-millisecond":
|
|
71
|
+
return new I();
|
|
72
|
+
case "time-microsecond":
|
|
73
|
+
return new F();
|
|
74
|
+
case "time-nanosecond":
|
|
75
|
+
return new z();
|
|
76
|
+
case "timestamp-second":
|
|
77
|
+
return new S();
|
|
78
|
+
case "timestamp-millisecond":
|
|
79
|
+
return new M();
|
|
80
|
+
case "timestamp-microsecond":
|
|
81
|
+
return new h();
|
|
82
|
+
case "timestamp-nanosecond":
|
|
83
|
+
return new f();
|
|
84
|
+
case "interval-daytime":
|
|
85
|
+
return new p();
|
|
86
|
+
case "interval-yearmonth":
|
|
87
|
+
return new b();
|
|
88
|
+
default:
|
|
89
|
+
throw new Error("array type not supported");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
Z as c
|
|
94
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The static page a caller should host (with a `script-src 'unsafe-eval'` CSP scoped to that path) for genuine strict-CSP compatibility — see this module's doc comment. */
|
|
2
|
+
export declare function sandboxHtml(): string;
|
|
3
|
+
/**
|
|
4
|
+
* Evaluates `source` (a `new Function(source)` body, no params) inside the
|
|
5
|
+
* sandbox iframe and returns its result. Pass `sandboxUrl` for genuine
|
|
6
|
+
* strict-CSP compatibility (see this module's doc comment) — without it,
|
|
7
|
+
* this still isolates the code's execution context but does not itself
|
|
8
|
+
* regain `unsafe-eval` under a CSP that already forbids it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function evaluateInSandbox(source: string, sandboxUrl?: string): Promise<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* The sandboxed counterpart to `compileFullJsAccessorBlock` — same
|
|
13
|
+
* strip-export/collect-names transform, but the actual `new Function`
|
|
14
|
+
* evaluation happens in the iframe rather than the main page. Async,
|
|
15
|
+
* unlike its synchronous counterpart, for the reasons in this module's doc
|
|
16
|
+
* comment.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compileFullJsAccessorBlockInSandbox(blockText: string, sandboxUrl?: string): Promise<Record<string, unknown>>;
|
|
19
|
+
/** Tears down the sandbox iframe — mainly for tests/dev cleanup, not needed in normal page-lifetime usage. */
|
|
20
|
+
export declare function destroySandbox(): void;
|
package/dist/ctx.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Runtime Context object (spec: "Runtime Context API") — injected into
|
|
3
|
+
* every widget render. A stable contract that deliberately never exposes
|
|
4
|
+
* deck.gl internals (no layerManager, no raw Deck instance) — only the
|
|
5
|
+
* viewport (for projection) crosses that boundary, per the spec's own
|
|
6
|
+
* rationale.
|
|
7
|
+
*/
|
|
8
|
+
import type { LayerIR, LayerFilter } from "./ir";
|
|
9
|
+
import type { RuntimeCore } from "./runtime-core";
|
|
10
|
+
import type { Selection } from "./selection";
|
|
11
|
+
import { type Stats } from "./stats";
|
|
12
|
+
export interface LayerMetaSnapshot {
|
|
13
|
+
id: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
color?: string;
|
|
16
|
+
visible: boolean;
|
|
17
|
+
type: string;
|
|
18
|
+
dataUrl?: string;
|
|
19
|
+
/** The layer's active declarative filter, if any (spec: "Filtering") — read by the built-in `filter` widget. */
|
|
20
|
+
filter?: LayerFilter;
|
|
21
|
+
}
|
|
22
|
+
export interface DataOpts {
|
|
23
|
+
/** Set `false` to bypass the layer's active declarative filter (spec: "Filter-aware stats & data (the coherence rule)"). Default `true`. */
|
|
24
|
+
filtered?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface RuntimeContext {
|
|
27
|
+
layers: LayerMetaSnapshot[];
|
|
28
|
+
viewport: {
|
|
29
|
+
bounds: [[number, number], [number, number]];
|
|
30
|
+
zoom: number;
|
|
31
|
+
center: [number, number];
|
|
32
|
+
project(lngLat: [number, number]): [number, number];
|
|
33
|
+
};
|
|
34
|
+
selection: Selection | null;
|
|
35
|
+
emit(event: string, payload?: Record<string, unknown>): void;
|
|
36
|
+
data(layerId: string, opts?: DataOpts): Promise<unknown[]>;
|
|
37
|
+
dataInViewport(layerId: string, opts?: DataOpts): Promise<unknown[]>;
|
|
38
|
+
stats(layerId: string, field: string, opts?: {
|
|
39
|
+
scope?: "all" | "viewport";
|
|
40
|
+
} & DataOpts): Stats;
|
|
41
|
+
}
|
|
42
|
+
export interface BuildCtxDeps {
|
|
43
|
+
layerIRs: ReadonlyMap<string, LayerIR>;
|
|
44
|
+
core: RuntimeCore;
|
|
45
|
+
mapEl: Element;
|
|
46
|
+
selection: Selection | null;
|
|
47
|
+
}
|
|
48
|
+
/** Built fresh on every widget-render invocation — never mutated, never reused. */
|
|
49
|
+
export declare function buildCtx({ layerIRs, core, mapEl, selection }: BuildCtxDeps): RuntimeContext;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `d3` global exposed to widget script blocks (spec: "Available globals" —
|
|
3
|
+
* "D3 (bundled, tree-shaken to core + scale + array)"). Bundled directly
|
|
4
|
+
* (unlike Vega) since d3-scale is already a hard dependency of the accessor
|
|
5
|
+
* expression language (scale()).
|
|
6
|
+
*/
|
|
7
|
+
import * as d3Scale from "d3-scale";
|
|
8
|
+
import * as d3Array from "d3-array";
|
|
9
|
+
export declare const d3: {
|
|
10
|
+
min(iterable: Iterable<string>): string | undefined;
|
|
11
|
+
min<T extends d3Array.Numeric>(iterable: Iterable<T>): T | undefined;
|
|
12
|
+
min<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => string | undefined | null): string | undefined;
|
|
13
|
+
min<T, U extends d3Array.Numeric>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => U | undefined | null): U | undefined;
|
|
14
|
+
minIndex(iterable: Iterable<unknown>): number;
|
|
15
|
+
minIndex<TDatum>(iterable: Iterable<TDatum>, accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => unknown): number;
|
|
16
|
+
minIndex(iterable: Iterable<unknown>): number;
|
|
17
|
+
max(iterable: Iterable<string>): string | undefined;
|
|
18
|
+
max<T extends d3Array.Numeric>(iterable: Iterable<T>): T | undefined;
|
|
19
|
+
max<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => string | undefined | null): string | undefined;
|
|
20
|
+
max<T, U extends d3Array.Numeric>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => U | undefined | null): U | undefined;
|
|
21
|
+
maxIndex(iterable: Iterable<unknown>): number;
|
|
22
|
+
maxIndex<TDatum>(iterable: Iterable<TDatum>, accessor: (datum: TDatum, index: number, array: Iterable<TDatum>) => unknown): number;
|
|
23
|
+
extent(iterable: Iterable<string>): [string, string] | [undefined, undefined];
|
|
24
|
+
extent<T extends d3Array.Numeric>(iterable: Iterable<T>): [T, T] | [undefined, undefined];
|
|
25
|
+
extent<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => string | undefined | null): [string, string] | [undefined, undefined];
|
|
26
|
+
extent<T, U extends d3Array.Numeric>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => U | undefined | null): [U, U] | [undefined, undefined];
|
|
27
|
+
mode(iterable: Iterable<d3Array.Numeric | undefined | null>): number;
|
|
28
|
+
mode<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number;
|
|
29
|
+
sum(iterable: Iterable<d3Array.Numeric | undefined | null>): number;
|
|
30
|
+
sum<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number;
|
|
31
|
+
mean(iterable: Iterable<d3Array.Numeric | undefined | null>): number | undefined;
|
|
32
|
+
mean<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number | undefined;
|
|
33
|
+
median(iterable: Iterable<d3Array.Numeric | undefined | null>): number | undefined;
|
|
34
|
+
median<T>(iterable: Iterable<T>, accessor: (element: T, i: number, array: Iterable<T>) => number | undefined | null): number | undefined;
|
|
35
|
+
medianIndex(iterable: Iterable<d3Array.Numeric | undefined | null>): number;
|
|
36
|
+
medianIndex<T>(iterable: Iterable<T>, accessor: (element: T, i: number, array: Iterable<T>) => number | undefined | null): number;
|
|
37
|
+
cumsum(iterable: Iterable<d3Array.Numeric | undefined | null>): Float64Array;
|
|
38
|
+
cumsum<T>(iterable: Iterable<T>, accessor: (element: T, i: number, array: Iterable<T>) => number | undefined | null): Float64Array;
|
|
39
|
+
quantile(iterable: Iterable<d3Array.Numeric | undefined | null>, p: number): number | undefined;
|
|
40
|
+
quantile<T>(iterable: Iterable<T>, p: number, accessor: (element: T, i: number, array: Iterable<T>) => number | undefined | null): number | undefined;
|
|
41
|
+
quantileIndex(iterable: Iterable<d3Array.Numeric | undefined | null>, p: number): number;
|
|
42
|
+
quantileIndex<T>(iterable: Iterable<T>, p: number, accessor: (element: T, i: number, array: Iterable<T>) => number | undefined | null): number;
|
|
43
|
+
quantileSorted(array: Array<d3Array.Numeric | undefined | null>, p: number): number | undefined;
|
|
44
|
+
quantileSorted<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
|
|
45
|
+
rank(iterable: Iterable<d3Array.Numeric | undefined | null>): Float64Array;
|
|
46
|
+
rank<T>(iterable: Iterable<T>, accessorOrComparator: ((datum: T, index: number, array: Iterable<T>) => number | undefined | null) | ((a: T, b: T) => number | undefined | null)): Float64Array;
|
|
47
|
+
variance(iterable: Iterable<d3Array.Numeric | undefined | null>): number | undefined;
|
|
48
|
+
variance<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number | undefined;
|
|
49
|
+
deviation(iterable: Iterable<d3Array.Numeric | undefined | null>): number | undefined;
|
|
50
|
+
deviation<T>(iterable: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number | undefined;
|
|
51
|
+
fsum(values: Iterable<d3Array.Numeric | undefined | null>): number;
|
|
52
|
+
fsum<T>(values: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): number;
|
|
53
|
+
fcumsum(values: Iterable<d3Array.Numeric | undefined | null>): Float64Array;
|
|
54
|
+
fcumsum<T>(values: Iterable<T>, accessor: (datum: T, index: number, array: Iterable<T>) => number | undefined | null): Float64Array;
|
|
55
|
+
least<T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T | undefined;
|
|
56
|
+
least<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): T | undefined;
|
|
57
|
+
leastIndex(iterable: Iterable<unknown>): number | undefined;
|
|
58
|
+
leastIndex<T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): number | undefined;
|
|
59
|
+
leastIndex<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): number | undefined;
|
|
60
|
+
greatest<T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T | undefined;
|
|
61
|
+
greatest<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): T | undefined;
|
|
62
|
+
greatestIndex(iterable: Iterable<unknown>): number | undefined;
|
|
63
|
+
greatestIndex<T>(iterable: Iterable<T>, comparator: (a: T, b: T) => number): number | undefined;
|
|
64
|
+
greatestIndex<T>(iterable: Iterable<T>, accessor: (a: T) => unknown): number | undefined;
|
|
65
|
+
bisectLeft(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
|
|
66
|
+
bisectLeft(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
|
|
67
|
+
bisectLeft(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
|
|
68
|
+
bisectRight(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
|
|
69
|
+
bisectRight(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
|
|
70
|
+
bisectRight(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
|
|
71
|
+
bisectCenter(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
|
|
72
|
+
bisectCenter(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
|
|
73
|
+
bisectCenter(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
|
|
74
|
+
bisector<T, U>(comparator: (a: T, b: U) => number): d3Array.Bisector<T, U>;
|
|
75
|
+
bisector<T, U>(accessor: (x: T) => U): d3Array.Bisector<T, U>;
|
|
76
|
+
quickselect<T>(array: ArrayLike<T>, k: number, left?: number, right?: number, compare?: (a: d3Array.Primitive | undefined, b: d3Array.Primitive | undefined) => number): T[];
|
|
77
|
+
ascending(a: d3Array.Primitive | undefined, b: d3Array.Primitive | undefined): number;
|
|
78
|
+
descending(a: d3Array.Primitive | undefined, b: d3Array.Primitive | undefined): number;
|
|
79
|
+
group<TObject, TKeys extends unknown[]>(iterable: Iterable<TObject>, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedInternMap<TObject, TObject[], TKeys>;
|
|
80
|
+
groups<TObject, TKeys extends unknown[]>(iterable: Iterable<TObject>, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedArray<TObject, TObject[], TKeys>;
|
|
81
|
+
flatGroup<TObject, TKeys extends unknown[]>(iterable: Iterable<TObject>, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): Array<[...TKeys, TObject[]]>;
|
|
82
|
+
index<TObject, TKeys extends unknown[]>(iterable: Iterable<TObject>, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedInternMap<TObject, TObject, TKeys>;
|
|
83
|
+
indexes<TObject, TKeys extends unknown[]>(iterable: Iterable<TObject>, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedArray<TObject, TObject, TKeys>;
|
|
84
|
+
rollup<TObject, TReduce, TKeys extends unknown[]>(iterable: Iterable<TObject>, reduce: (values: TObject[]) => TReduce, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedInternMap<TObject, TReduce, TKeys>;
|
|
85
|
+
rollups<TObject, TReduce, TKeys extends unknown[]>(iterable: Iterable<TObject>, reduce: (values: TObject[]) => TReduce, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): d3Array.NestedArray<TObject, TReduce, TKeys>;
|
|
86
|
+
flatRollup<TObject, TReduce, TKeys extends unknown[]>(iterable: Iterable<TObject>, reduce: (values: TObject[]) => TReduce, ...keys: { [Index in keyof TKeys]: (value: TObject, index: number, values: TObject[]) => TKeys[Index]; }): Array<[...TKeys, TReduce]>;
|
|
87
|
+
groupSort<TObject, TKey>(iterable: Iterable<TObject>, comparator: (a: TObject[], b: TObject[]) => number, key: (value: TObject) => TKey): TKey[];
|
|
88
|
+
groupSort<TObject, TKey>(iterable: Iterable<TObject>, accessor: (value: TObject[]) => unknown, key: (value: TObject) => TKey): TKey[];
|
|
89
|
+
count(iterable: Iterable<unknown>): number;
|
|
90
|
+
count<TObject>(iterable: Iterable<TObject>, accessor: (a: TObject, b: TObject) => number | null | undefined): number;
|
|
91
|
+
cross<T extends unknown[]>(...iterables: { [K in keyof T]: Iterable<T[K]>; }): T[];
|
|
92
|
+
cross<T extends unknown[], U>(...args: [...iterables: { [K in keyof T]: Iterable<T[K]>; }, reducer: (...values: T) => U]): U[];
|
|
93
|
+
merge<T>(iterables: Iterable<Iterable<T>>): T[];
|
|
94
|
+
pairs<T>(iterable: Iterable<T>): Array<[T, T]>;
|
|
95
|
+
pairs<T, U>(iterable: Iterable<T>, reducer: (a: T, b: T) => U): U[];
|
|
96
|
+
permute<T>(source: {
|
|
97
|
+
[key: number]: T;
|
|
98
|
+
}, keys: Iterable<number>): T[];
|
|
99
|
+
permute<T, K extends keyof T>(source: T, keys: Iterable<K>): Array<T[K]>;
|
|
100
|
+
shuffle<T>(array: T[], lo?: number, hi?: number): T[];
|
|
101
|
+
shuffle(array: Int8Array, lo?: number, hi?: number): Int8Array;
|
|
102
|
+
shuffle(array: Uint8Array, lo?: number, hi?: number): Uint8Array;
|
|
103
|
+
shuffle(array: Uint8ClampedArray, lo?: number, hi?: number): Uint8ClampedArray;
|
|
104
|
+
shuffle(array: Int16Array, lo?: number, hi?: number): Int16Array;
|
|
105
|
+
shuffle(array: Uint16Array, lo?: number, hi?: number): Uint16Array;
|
|
106
|
+
shuffle(array: Int32Array, lo?: number, hi?: number): Int32Array;
|
|
107
|
+
shuffle(array: Uint32Array, lo?: number, hi?: number): Uint32Array;
|
|
108
|
+
shuffle(array: Float32Array, lo?: number, hi?: number): Float32Array;
|
|
109
|
+
shuffle(array: Float64Array, lo?: number, hi?: number): Float64Array;
|
|
110
|
+
shuffler(random: () => number): typeof d3Array.shuffle;
|
|
111
|
+
ticks(start: number, stop: number, count: number): number[];
|
|
112
|
+
tickIncrement(start: number, stop: number, count: number): number;
|
|
113
|
+
tickStep(start: number, stop: number, count: number): number;
|
|
114
|
+
nice(start: number, stop: number, count: number): [number, number];
|
|
115
|
+
range(stop: number): number[];
|
|
116
|
+
range(start: number, stop: number, step?: number): number[];
|
|
117
|
+
transpose<T>(matrix: ArrayLike<ArrayLike<T>>): T[][];
|
|
118
|
+
zip<T>(...arrays: Array<ArrayLike<T>>): T[][];
|
|
119
|
+
blur(data: ArrayLike<number>, radius: number): ArrayLike<number>;
|
|
120
|
+
blur2(data: d3Array.Matrix, rx: number, ry?: number): d3Array.Matrix;
|
|
121
|
+
blurImage(imageData: ImageData, rx: number, ry?: number): ImageData;
|
|
122
|
+
every<T>(iterable: Iterable<T>, test: (value: T, index: number, iterable: Iterable<T>) => unknown): boolean;
|
|
123
|
+
some<T>(iterable: Iterable<T>, test: (value: T, index: number, iterable: Iterable<T>) => unknown): boolean;
|
|
124
|
+
filter<T>(iterable: Iterable<T>, test: (value: T, index: number, iterable: Iterable<T>) => unknown): T[];
|
|
125
|
+
map<T, U>(iterable: Iterable<T>, mapper: (value: T, index: number, iterable: Iterable<T>) => U): U[];
|
|
126
|
+
reduce<T>(iterable: Iterable<T>, reducer: (previousValue: T, currentValue: T, currentIndex: number, iterable: Iterable<T>) => T, initialValue?: T): T;
|
|
127
|
+
reduce<T, U>(iterable: Iterable<T>, reducer: (previousValue: U, currentValue: T, currentIndex: number, iterable: Iterable<T>) => U, initialValue: U): U;
|
|
128
|
+
reverse<T>(iterable: Iterable<T>): T[];
|
|
129
|
+
sort<T>(iterable: Iterable<T>, comparator?: (a: T, b: T) => number): T[];
|
|
130
|
+
sort<T>(iterable: Iterable<T>, ...accessors: Array<(a: T) => unknown>): T[];
|
|
131
|
+
difference<T>(iterable: Iterable<T>, ...others: Array<Iterable<T>>): d3Array.InternSet<T>;
|
|
132
|
+
union<T>(...iterables: Array<Iterable<T>>): d3Array.InternSet<T>;
|
|
133
|
+
intersection<T>(...iterables: Array<Iterable<T>>): d3Array.InternSet<T>;
|
|
134
|
+
superset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
|
|
135
|
+
subset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
|
|
136
|
+
disjoint<T>(a: Iterable<T>, b: Iterable<T>): boolean;
|
|
137
|
+
histogram(): d3Array.HistogramGeneratorNumber<number, number>;
|
|
138
|
+
histogram<Datum, Value extends number | undefined>(): d3Array.HistogramGeneratorNumber<Datum, Value>;
|
|
139
|
+
histogram<Datum, Value extends Date | undefined>(): d3Array.HistogramGeneratorDate<Datum, Value>;
|
|
140
|
+
bin(): d3Array.HistogramGeneratorNumber<number, number>;
|
|
141
|
+
bin<Datum, Value extends number | undefined>(): d3Array.HistogramGeneratorNumber<Datum, Value>;
|
|
142
|
+
bin<Datum, Value extends Date | undefined>(): d3Array.HistogramGeneratorDate<Datum, Value>;
|
|
143
|
+
thresholdFreedmanDiaconis(values: ArrayLike<number | undefined>, min: number, max: number): number;
|
|
144
|
+
thresholdScott(values: ArrayLike<number | undefined>, min: number, max: number): number;
|
|
145
|
+
thresholdSturges(values: ArrayLike<number | undefined>): number;
|
|
146
|
+
Adder: typeof d3Array.Adder;
|
|
147
|
+
bisect: typeof d3Array.bisectRight;
|
|
148
|
+
InternMap: typeof d3Array.InternMap;
|
|
149
|
+
InternSet: typeof d3Array.InternSet;
|
|
150
|
+
tickFormat(start: number, stop: number, count: number, specifier?: string): (d: d3Scale.NumberValue) => string;
|
|
151
|
+
scaleLinear<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleLinear<Range, Output, Unknown>;
|
|
152
|
+
scaleLinear<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleLinear<Range, Output, Unknown>;
|
|
153
|
+
scalePow<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScalePower<Range, Output, Unknown>;
|
|
154
|
+
scalePow<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScalePower<Range, Output, Unknown>;
|
|
155
|
+
scaleSqrt<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScalePower<Range, Output, Unknown>;
|
|
156
|
+
scaleSqrt<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScalePower<Range, Output, Unknown>;
|
|
157
|
+
scaleLog<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleLogarithmic<Range, Output, Unknown>;
|
|
158
|
+
scaleLog<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleLogarithmic<Range, Output, Unknown>;
|
|
159
|
+
scaleSymlog<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleSymLog<Range, Output, Unknown>;
|
|
160
|
+
scaleSymlog<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleSymLog<Range, Output, Unknown>;
|
|
161
|
+
scaleIdentity<Unknown = never>(range?: Iterable<d3Scale.NumberValue>): d3Scale.ScaleIdentity<Unknown>;
|
|
162
|
+
scaleRadial<Range = number, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleRadial<Range, Range, Unknown>;
|
|
163
|
+
scaleRadial<Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleRadial<Range, Range, Unknown>;
|
|
164
|
+
scaleTime<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleTime<Range, Output, Unknown>;
|
|
165
|
+
scaleTime<Range, Output = Range, Unknown = never>(domain: Iterable<Date | d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleTime<Range, Output, Unknown>;
|
|
166
|
+
scaleUtc<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleTime<Range, Output, Unknown>;
|
|
167
|
+
scaleUtc<Range, Output = Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleTime<Range, Output, Unknown>;
|
|
168
|
+
scaleSequential<Output = number, Unknown = never>(interpolator?: ((t: number) => Output) | Iterable<Output>): d3Scale.ScaleSequential<Output, Unknown>;
|
|
169
|
+
scaleSequential<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: ((t: number) => Output) | Iterable<Output>): d3Scale.ScaleSequential<Output, Unknown>;
|
|
170
|
+
scaleSequentialLog<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
171
|
+
scaleSequentialLog<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
172
|
+
scaleSequentialPow<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
173
|
+
scaleSequentialPow<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
174
|
+
scaleSequentialSqrt<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
175
|
+
scaleSequentialSqrt<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
176
|
+
scaleSequentialSymlog<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
177
|
+
scaleSequentialSymlog<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleSequential<Output, Unknown>;
|
|
178
|
+
scaleSequentialQuantile<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleSequentialQuantile<Output, Unknown>;
|
|
179
|
+
scaleSequentialQuantile<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleSequentialQuantile<Output, Unknown>;
|
|
180
|
+
scaleDiverging<Output = number, Unknown = never>(interpolator?: ((t: number) => Output) | Iterable<Output>): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
181
|
+
scaleDiverging<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: ((t: number) => Output) | Iterable<Output>): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
182
|
+
scaleDivergingLog<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
183
|
+
scaleDivergingLog<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
184
|
+
scaleDivergingPow<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
185
|
+
scaleDivergingPow<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
186
|
+
scaleDivergingSqrt<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
187
|
+
scaleDivergingSqrt<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
188
|
+
scaleDivergingSymlog<Output = number, Unknown = never>(interpolator?: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
189
|
+
scaleDivergingSymlog<Output, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, interpolator: (t: number) => Output): d3Scale.ScaleDiverging<Output, Unknown>;
|
|
190
|
+
scaleQuantize<Range = number, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleQuantize<Range, Unknown>;
|
|
191
|
+
scaleQuantize<Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue>, range: Iterable<Range>): d3Scale.ScaleQuantize<Range, Unknown>;
|
|
192
|
+
scaleQuantile<Range = number, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleQuantile<Range, Unknown>;
|
|
193
|
+
scaleQuantile<Range, Unknown = never>(domain: Iterable<d3Scale.NumberValue | null | undefined>, range: Iterable<Range>): d3Scale.ScaleQuantile<Range, Unknown>;
|
|
194
|
+
scaleThreshold<Domain extends number | string | Date = number, Range = number, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleThreshold<Domain, Range, Unknown>;
|
|
195
|
+
scaleThreshold<Domain extends number | string | Date, Range, Unknown = never>(domain: Iterable<Domain>, range: Iterable<Range>): d3Scale.ScaleThreshold<Domain, Range, Unknown>;
|
|
196
|
+
scaleOrdinal<Range>(range?: Iterable<Range>): d3Scale.ScaleOrdinal<string, Range>;
|
|
197
|
+
scaleOrdinal<Domain extends {
|
|
198
|
+
toString(): string;
|
|
199
|
+
}, Range, Unknown = never>(range?: Iterable<Range>): d3Scale.ScaleOrdinal<Domain, Range, Unknown>;
|
|
200
|
+
scaleOrdinal<Domain extends {
|
|
201
|
+
toString(): string;
|
|
202
|
+
}, Range, Unknown = never>(domain: Iterable<Domain>, range: Iterable<Range>): d3Scale.ScaleOrdinal<Domain, Range, Unknown>;
|
|
203
|
+
scaleBand<Domain extends {
|
|
204
|
+
toString(): string;
|
|
205
|
+
} = string>(range?: Iterable<d3Scale.NumberValue>): d3Scale.ScaleBand<Domain>;
|
|
206
|
+
scaleBand<Domain extends {
|
|
207
|
+
toString(): string;
|
|
208
|
+
}>(domain: Iterable<Domain>, range: Iterable<d3Scale.NumberValue>): d3Scale.ScaleBand<Domain>;
|
|
209
|
+
scalePoint<Domain extends {
|
|
210
|
+
toString(): string;
|
|
211
|
+
} = string>(range?: Iterable<d3Scale.NumberValue>): d3Scale.ScalePoint<Domain>;
|
|
212
|
+
scalePoint<Domain extends {
|
|
213
|
+
toString(): string;
|
|
214
|
+
}>(domain: Iterable<Domain>, range: Iterable<d3Scale.NumberValue>): d3Scale.ScalePoint<Domain>;
|
|
215
|
+
scaleImplicit: {
|
|
216
|
+
name: "implicit";
|
|
217
|
+
};
|
|
218
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `data-emit` delegation (spec: "Wiring DOM events to emits — two layers",
|
|
3
|
+
* Level 1). Shared between <om-widget> and <om-overlay> — both are
|
|
4
|
+
* shadow-DOM content hosts where an author's zero-script markup can declare
|
|
5
|
+
* `data-emit="event"` + `data-*` payload keys (DOM camel-casing, e.g.
|
|
6
|
+
* `data-feature-id` -> `featureId`) instead of writing a script block.
|
|
7
|
+
* Fires on click for non-form elements, change for form elements (which also
|
|
8
|
+
* get their own `.value` merged in).
|
|
9
|
+
*/
|
|
10
|
+
export declare function attachDataEmitDelegation(root: ShadowRoot, emit: (event: string, payload: Record<string, unknown>) => void): void;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Layer (spec: "Module Breakdown / Data Layer").
|
|
3
|
+
* Fetches the `data` attribute URL and caches the parsed response by URL, or
|
|
4
|
+
* (Phase 3) reads inline JSON from a child `<script type="application/json">`
|
|
5
|
+
* synchronously with no fetch/cache involved. Full request-generation/
|
|
6
|
+
* AbortController handling (Q6: "Async data loading & the reconcile race") is
|
|
7
|
+
* still a minimal, safe subset here — a per-URL fetch generation so a
|
|
8
|
+
* superseded request can't clobber a newer one — not the full machinery.
|
|
9
|
+
*
|
|
10
|
+
* Columnar (spec: "Columnar / GeoArrow Ingestion"): the Data Layer is where
|
|
11
|
+
* columnar sources become `ColumnarData` — Arrow IPC files (`.arrow`,
|
|
12
|
+
* lazy-importing apache-arrow so it never weighs on the eager bundle) and
|
|
13
|
+
* column-oriented JSON (`{ columns: { field: [...] } }`, inline or fetched).
|
|
14
|
+
* Columnar data is handed to deck.gl as-is (zero row materialization on the
|
|
15
|
+
* render path); row objects are materialized lazily and memoized only when
|
|
16
|
+
* a row-consuming surface (ctx.data, picking, highlight-by-id) asks.
|
|
17
|
+
*/
|
|
18
|
+
import type { Shape, ColumnarData, LayerData } from "./ir";
|
|
19
|
+
export declare function isColumnar(data: LayerData): data is ColumnarData;
|
|
20
|
+
/** `Array` as-is, or a FeatureCollection's `.features`, or a lone object wrapped in an array. */
|
|
21
|
+
export declare function normalizeFeatures(json: unknown): unknown[];
|
|
22
|
+
/** Parsed-JSON → LayerData: columnar `{ columns }` form, or the usual feature-array normalization. */
|
|
23
|
+
export declare function normalizeData(json: unknown): LayerData;
|
|
24
|
+
/**
|
|
25
|
+
* The one place the runtime reads a column value out of the ColumnarData
|
|
26
|
+
* layout (compiled accessors emit the equivalent access as codegen — see
|
|
27
|
+
* expr/compile.ts `columnAccess`, the documented contract this mirrors). A
|
|
28
|
+
* missing column reads as an empty column, matching getField's
|
|
29
|
+
* undefined-not-throw semantics.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getColumn(data: ColumnarData, field: string): ArrayLike<unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Row view over any LayerData. Arrays pass through untouched (zero cost);
|
|
34
|
+
* columnar data materializes plain flat row objects ONCE per data object and
|
|
35
|
+
* memoizes — the spec's Tier-2 rule ("bulk raw features is inherently O(N)
|
|
36
|
+
* when requested") made concrete. Render/stats hot paths never call this;
|
|
37
|
+
* ctx.data()/dataInViewport(), picking, and highlight-by-id do.
|
|
38
|
+
*/
|
|
39
|
+
export declare function asRows(data: LayerData): readonly unknown[];
|
|
40
|
+
/** A single row by index — shares the asRows memo so a picked row's identity is stable across picks. */
|
|
41
|
+
export declare function rowAt(data: LayerData, index: number): unknown;
|
|
42
|
+
/** Structural slice of an apache-arrow Table — keeps apache-arrow out of the static import graph. */
|
|
43
|
+
export interface ArrowTableLike {
|
|
44
|
+
numRows: number;
|
|
45
|
+
schema: {
|
|
46
|
+
fields: {
|
|
47
|
+
name: string;
|
|
48
|
+
type: unknown;
|
|
49
|
+
metadata?: Map<string, string>;
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
52
|
+
getChild(name: string): {
|
|
53
|
+
get(i: number): unknown;
|
|
54
|
+
toArray(): ArrayLike<unknown>;
|
|
55
|
+
} | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Arrow Table → ColumnarData. Primitive columns come out as `toArray()`
|
|
59
|
+
* views (typed arrays for numerics — no per-value copying; Int64 coerces to
|
|
60
|
+
* Float64 because $field expressions reject BigInt — see expr/compile.ts).
|
|
61
|
+
* Geometry columns — FixedSizeList (interleaved), or `coordField` for the
|
|
62
|
+
* separated Struct{x, y} encoding — materialize to per-row [x, y(, z)]
|
|
63
|
+
* arrays once at load, so `get-position="$geometry"` works like any $field.
|
|
64
|
+
*/
|
|
65
|
+
export declare function arrowTableToColumnar(table: ArrowTableLike, coordField?: string): ColumnarData;
|
|
66
|
+
/** Arrow table → LayerData: line/polygon GeoArrow becomes GeoJSON feature rows; everything else takes the columnar path. */
|
|
67
|
+
export declare function arrowTableToLayerData(table: ArrowTableLike): LayerData;
|
|
68
|
+
export interface DataFormat {
|
|
69
|
+
/** Claim a URL (extension test) and/or a response (Content-Type test — undefined during URL-only checks). */
|
|
70
|
+
match(url: string, contentType?: string): boolean;
|
|
71
|
+
/** Parse the claimed response. The parser module should be lazy-imported here (HU1 — the apache-arrow precedent). `url` is the requested URL (res.url is empty on constructed Responses — test fetches, service workers). */
|
|
72
|
+
parse(res: Response, url: string): Promise<LayerData>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Row objects → ColumnarData (the memory-efficient shape: one array per
|
|
76
|
+
* column instead of N objects; all-numeric columns become Float64Array).
|
|
77
|
+
* Returns undefined for empty input — an empty flat array round-trips
|
|
78
|
+
* better than a zero-length columnar table.
|
|
79
|
+
*/
|
|
80
|
+
export declare function rowsToColumnar(rows: Record<string, unknown>[]): ColumnarData | undefined;
|
|
81
|
+
/** `OmMap.registerFormat(format)` — plug in a parser for a format the library doesn't ship (spec: "v0.2 / Tier 1"). */
|
|
82
|
+
export declare function registerFormat(format: DataFormat): void;
|
|
83
|
+
/**
|
|
84
|
+
* A source plugin supplies domain decoding (and optionally a subscription
|
|
85
|
+
* handshake); the transport (WebSocket, reconnect, flush) is generic.
|
|
86
|
+
* Registered via `OmMap.registerSource(name, plugin)` and selected by the
|
|
87
|
+
* layer's `source` attribute.
|
|
88
|
+
*/
|
|
89
|
+
export interface SourcePlugin {
|
|
90
|
+
/** Called on every (re)connect — e.g. send a subscription message (aisstream.io-style APIs). */
|
|
91
|
+
onOpen?(send: (message: string) => void): void;
|
|
92
|
+
/** Raw (JSON-parsed, when parseable) socket message → entity object(s) to upsert, or null to ignore. */
|
|
93
|
+
decode(raw: unknown): Record<string, unknown> | Record<string, unknown>[] | null;
|
|
94
|
+
}
|
|
95
|
+
export declare function registerSource(name: string, plugin: SourcePlugin): void;
|
|
96
|
+
/** Options carried by the layer's reserved live-source attributes (`source`, `key`, `flush` for streams; `refresh` for polling). */
|
|
97
|
+
export interface StreamOptions {
|
|
98
|
+
source?: string;
|
|
99
|
+
key?: string;
|
|
100
|
+
flush?: string;
|
|
101
|
+
refresh?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Request configuration for every `data` URL the Data Layer fetches
|
|
105
|
+
* (including polling refreshes and Arrow files). Deliberately a
|
|
106
|
+
* PROGRAMMATIC surface, not manifest attributes: credentials in markup
|
|
107
|
+
* would put secrets into the DOM — and into agent-generated manifests.
|
|
108
|
+
*
|
|
109
|
+
* OmMap.configureData({ headers: { Authorization: `Bearer ${token}` } });
|
|
110
|
+
* OmMap.configureData({ headers: (url) => url.startsWith("/api/") ? auth : undefined });
|
|
111
|
+
*/
|
|
112
|
+
export interface DataRequestConfig {
|
|
113
|
+
/** Static headers, or a per-URL function (return undefined to send none for that URL). */
|
|
114
|
+
headers?: HeadersInit | ((url: string) => HeadersInit | undefined);
|
|
115
|
+
credentials?: RequestCredentials;
|
|
116
|
+
/** Full fetch replacement (custom retry/signing/proxy logic). Receives the resolved RequestInit. */
|
|
117
|
+
fetch?: typeof fetch;
|
|
118
|
+
}
|
|
119
|
+
export declare function configureData(config: DataRequestConfig): void;
|
|
120
|
+
/** `data="draw:sketch"` — the reserved scheme for a widget-fed sketch layer (never collides with http/ws/inline). */
|
|
121
|
+
export declare function isDrawUrl(url: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Push a new sketch snapshot into a `draw:<name>` store (the draw widget's
|
|
124
|
+
* DrawSession.onChange calls this). A FRESH array reference is stored so
|
|
125
|
+
* deck.gl's shallow `data` diff re-renders, then the bound layer's notify
|
|
126
|
+
* fires the reconcile — the exact path a stream flush takes. Safe to call
|
|
127
|
+
* before any layer has bound (the snapshot waits in the store).
|
|
128
|
+
*/
|
|
129
|
+
export declare function setDrawData(url: string, features: readonly unknown[]): void;
|
|
130
|
+
/** Current snapshot for a draw store (autosave / save-to-file read the source of truth here). */
|
|
131
|
+
export declare function getDrawData(url: string): LayerData;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the currently-known data for `url` (synchronously) — an empty
|
|
134
|
+
* array if not yet loaded (the Q6 "empty placeholder" pattern). Kicks off a
|
|
135
|
+
* fetch — or, for `ws:`/`wss:` URLs, a live stream (spec: "Live & Streaming
|
|
136
|
+
* Data"), or binds a `draw:` sketch store (spec: "Manual Drawing") — on first
|
|
137
|
+
* call for a given URL, and invokes `onLoaded` on every resolution/flush (the
|
|
138
|
+
* caller re-reconciles from there).
|
|
139
|
+
*/
|
|
140
|
+
export declare function getData(url: string, onLoaded: () => void, opts?: StreamOptions): LayerData;
|
|
141
|
+
/** Is a fetch for this URL still in flight? Feeds the `om-map-ready` signal — errored fetches count as settled (readiness must not hang on a bad URL). */
|
|
142
|
+
export declare function isPendingData(url: string): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Minimal feature-shape detection (spec: "Feature Field Resolution & Data
|
|
145
|
+
* Shape" — full per-layer caching/registry treatment is a later phase; this
|
|
146
|
+
* is just enough to drive $field resolution for the accessor compiler).
|
|
147
|
+
* Columnar data self-identifies by construction; a GeoJSON feature has
|
|
148
|
+
* `{ type: "Feature", properties, geometry }`; any other shape is flat.
|
|
149
|
+
*/
|
|
150
|
+
export declare function detectShape(data: LayerData): Shape;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CPU-side mirror of the GPU `DataFilterExtension` test (spec: "Filter-aware
|
|
3
|
+
* stats & data (the coherence rule)") — `ctx.stats`/`ctx.dataInViewport`
|
|
4
|
+
* apply the SAME field+range test by default, so a chart/stat reflects what
|
|
5
|
+
* the map visibly shows. A row whose field isn't a finite number is treated
|
|
6
|
+
* as filtered-out, matching the GPU path (a non-numeric `getFilterValue`
|
|
7
|
+
* result can't land inside any finite `filterRange`).
|
|
8
|
+
*/
|
|
9
|
+
import type { Shape, LayerFilter } from "./ir";
|
|
10
|
+
export declare function applyDeclarativeFilter(rows: readonly unknown[], shape: Shape, filter: LayerFilter): unknown[];
|
|
11
|
+
/** The same test as a reusable predicate — the columnar viewport filter runs it inside its index-aligned loop. */
|
|
12
|
+
export declare function declarativeFilterPredicate(shape: Shape, filter: LayerFilter): (row: unknown) => boolean;
|