@octostar/map-component 0.2.22 → 0.3.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/dist/index.cjs +656 -382
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +656 -382
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/drawing-toolbar.d.ts +4 -6
- package/dist/types/components/drawing-toolbar.d.ts.map +1 -1
- package/dist/types/components/layers-panel.d.ts +1 -1
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/basemap-list.d.ts +15 -6
- package/dist/types/lib/basemap-list.d.ts.map +1 -1
- package/dist/types/lib/custom-layer-stack.d.ts +20 -7
- package/dist/types/lib/custom-layer-stack.d.ts.map +1 -1
- package/dist/types/lib/label-pinning.d.ts +10 -2
- package/dist/types/lib/label-pinning.d.ts.map +1 -1
- package/dist/types/lib/map-editor-api.d.ts +80 -47
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/map-endpoints.d.ts +71 -0
- package/dist/types/lib/map-endpoints.d.ts.map +1 -0
- package/dist/types/lib/paint-feature.d.ts +11 -11
- package/dist/types/lib/paint-feature.d.ts.map +1 -1
- package/dist/types/lib/selection-diff.d.ts +9 -34
- package/dist/types/lib/selection-diff.d.ts.map +1 -1
- package/dist/types/lib/selection-overlay.d.ts +53 -0
- package/dist/types/lib/selection-overlay.d.ts.map +1 -0
- package/dist/types/lib/selection-paint.d.ts +23 -0
- package/dist/types/lib/selection-paint.d.ts.map +1 -0
- package/dist/types/lib/selection-state.d.ts +60 -0
- package/dist/types/lib/selection-state.d.ts.map +1 -0
- package/dist/types/lib/shard-fingerprint.d.ts +6 -7
- package/dist/types/lib/shard-fingerprint.d.ts.map +1 -1
- package/dist/types/lib/shard-locator.d.ts +53 -0
- package/dist/types/lib/shard-locator.d.ts.map +1 -0
- package/dist/types/lib/shard-pipeline.d.ts.map +1 -1
- package/dist/types/lib/shard-registry.d.ts +5 -4
- package/dist/types/lib/shard-registry.d.ts.map +1 -1
- package/dist/types/lib/trace-timeline.d.ts +3 -6
- package/dist/types/lib/trace-timeline.d.ts.map +1 -1
- package/package.json +1 -1
- package/vite-plugin.d.mts +2 -0
- package/vite-plugin.mjs +42 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paint-feature.d.ts","sourceRoot":"","sources":["../../../client/src/lib/paint-feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"paint-feature.d.ts","sourceRoot":"","sources":["../../../client/src/lib/paint-feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAG5F,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC/C,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrD,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EA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GAC7E,gBAAgB,CAiClB"}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import type { GeoJSONSourceDiff } from 'maplibre-gl';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The paint cache behind the timeline fast path (timeline-diff.ts,
|
|
4
|
+
* trace-timeline.ts): what the full sync painted, so a scrub or playback
|
|
5
|
+
* tick can flip stroke-opacity / fill-opacity / isTimelineHidden on the
|
|
6
|
+
* toggled features through `updateData` instead of rebuilding the source.
|
|
4
7
|
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
* O(total-features) rebuild + setData re-upload. The full sync records what
|
|
9
|
-
* the painted collection contains (`SelectionPaintCache`); this builder
|
|
10
|
-
* turns "painted selection → next selection" into a `updateData` diff.
|
|
11
|
-
*
|
|
12
|
-
* The same cache also serves the timeline fast path (timeline-diff.ts),
|
|
13
|
-
* which flips the disjoint property set stroke-opacity / fill-opacity /
|
|
14
|
-
* isTimelineHidden.
|
|
8
|
+
* Timeline-only since TEAM-7582: selection is feature state
|
|
9
|
+
* (`selection-state.ts`) and no longer diffs the source. TEAM-7583 replaces
|
|
10
|
+
* this cache with global timeline state and removes it, type name included.
|
|
15
11
|
*/
|
|
16
12
|
export interface SelectionPaintCache {
|
|
17
|
-
/** Feature ids present in the
|
|
13
|
+
/** Feature ids present in the source as of the last paint. */
|
|
18
14
|
presentIds: Set<string>;
|
|
19
|
-
/** Ids currently painted `isSelected: 1` (updated by the fast path after each diff). */
|
|
20
|
-
appliedSelectedIds: Set<string>;
|
|
21
|
-
/** Per-feature `_labelPriority` computed as if unselected. */
|
|
22
|
-
basePriorityById: Map<string, number>;
|
|
23
15
|
/** Ids currently painted `isTimelineHidden: 1` (advanced by the timeline fast path). */
|
|
24
16
|
appliedHiddenIds: Set<string>;
|
|
25
17
|
/**
|
|
@@ -39,8 +31,6 @@ export interface SelectionPaintCache {
|
|
|
39
31
|
*/
|
|
40
32
|
updatable: boolean;
|
|
41
33
|
}
|
|
42
|
-
/** Matches the paint-side `['coalesce', ['get', '_labelPriority'], 100]` default. */
|
|
43
|
-
export declare const DEFAULT_LABEL_PRIORITY = 100;
|
|
44
34
|
/**
|
|
45
35
|
* The full sync's as-if-visible opacity defaults (feature has no explicit
|
|
46
36
|
* `stroke-opacity` / `fill-opacity` property and is not 3D-only-hidden).
|
|
@@ -54,19 +44,11 @@ export declare function createSelectionPaintCache(): SelectionPaintCache;
|
|
|
54
44
|
* Record one painted feature during a full sync. A duplicate id makes the
|
|
55
45
|
* cache non-updatable — see `SelectionPaintCache.updatable`.
|
|
56
46
|
*/
|
|
57
|
-
export declare function recordPaintedFeature(cache: SelectionPaintCache, featureId: string,
|
|
47
|
+
export declare function recordPaintedFeature(cache: SelectionPaintCache, featureId: string, visibleStrokeOpacity: number, visibleFillOpacity: number, isTimelineHidden: boolean): void;
|
|
58
48
|
/** Minimal surface of maplibre's GeoJSONSource the fast path needs. */
|
|
59
49
|
export interface UpdatableGeoJSONSource {
|
|
60
50
|
updateData(diff: GeoJSONSourceDiff): unknown;
|
|
61
51
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Apply a selection-only change to the source as an updateData diff.
|
|
64
|
-
* Returns false when the caller must fall back to a full sync — no cache,
|
|
65
|
-
* non-updatable cache, missing source, or a synchronous updateData throw
|
|
66
|
-
* (the cache is then left untouched; the full sync rebuilds it). On
|
|
67
|
-
* success the cache's applied set is advanced to the painted state.
|
|
68
|
-
*/
|
|
69
|
-
export declare function applySelectionFastPath(cache: SelectionPaintCache | null, nextSelectedIds: ReadonlySet<string>, source: UpdatableGeoJSONSource | null | undefined): boolean;
|
|
70
52
|
/**
|
|
71
53
|
* Whether applySelectionState still needs its draw.changeMode call. The
|
|
72
54
|
* call is skipped only when it would be a pure no-op — nothing to select,
|
|
@@ -81,11 +63,4 @@ export declare function needsDrawSelectionUpdate(input: {
|
|
|
81
63
|
currentMode: string;
|
|
82
64
|
targetMode: string;
|
|
83
65
|
}): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Diff between the painted selection and `nextSelectedIds`, restricted to
|
|
86
|
-
* ids present in the source. Returns null when no painted feature toggles.
|
|
87
|
-
* Only ever populates `update` — the fast path must never add or remove
|
|
88
|
-
* features.
|
|
89
|
-
*/
|
|
90
|
-
export declare function buildSelectionDiff(cache: Pick<SelectionPaintCache, 'presentIds' | 'appliedSelectedIds' | 'basePriorityById'>, nextSelectedIds: ReadonlySet<string>): GeoJSONSourceDiff | null;
|
|
91
66
|
//# sourceMappingURL=selection-diff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"selection-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;GASG;AAEH,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,wFAAwF;IACxF,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,kGAAkG;IAClG,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,wBAAgB,yBAAyB,IAAI,mBAAmB,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,OAAO,GACxB,IAAI,CAaN;AAED,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAMV"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { LayerSpecification } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* The selection overlay: one small GeoJSON source holding only the selected
|
|
4
|
+
* features, styled for paint, under four style layers that feature state
|
|
5
|
+
* cannot drive.
|
|
6
|
+
*
|
|
7
|
+
* Filters cannot read feature state, and neither can layout properties or
|
|
8
|
+
* `line-dasharray`. So the icon ring (a filter on `icon`), the dashed line and
|
|
9
|
+
* polygon halos (`line-dasharray`), and the selected label (a symbol whose
|
|
10
|
+
* collision priority is layout) render from here. The base `point` layer's
|
|
11
|
+
* ring is paint-only and reads feature state directly.
|
|
12
|
+
*
|
|
13
|
+
* The label layer takes over the priority-0 boost the base labels used to
|
|
14
|
+
* carry. MapLibre places symbols from the top layer of the style down, so the
|
|
15
|
+
* topmost symbol layer is placed first and wins every collision: the overlay
|
|
16
|
+
* label stays the last layer in the style, with full collision on. A selected
|
|
17
|
+
* label then competes only with other selected labels — a dense selection
|
|
18
|
+
* thins itself the way any label layer does — and every base label, the
|
|
19
|
+
* selected feature's own hidden copy and its neighbours included, yields to
|
|
20
|
+
* it. (Measured on the demo: 121 selected points in a tight grid render 17
|
|
21
|
+
* labels whether or not the base labels are showing; placed below
|
|
22
|
+
* `custom-labels` instead, they render none once base labels are visible.)
|
|
23
|
+
*
|
|
24
|
+
* The overlay is `setData`'d with O(selected) features per selection change,
|
|
25
|
+
* never with the layer. It is not interactive: a click on the ring must hit
|
|
26
|
+
* the underlying feature, not this copy.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SELECTION_OVERLAY_SOURCE_ID = "selection-overlay";
|
|
29
|
+
export declare const SELECTION_OVERLAY_LAYER_IDS: {
|
|
30
|
+
readonly iconRing: "selection-overlay-icon-ring";
|
|
31
|
+
readonly line: "selection-overlay-line";
|
|
32
|
+
readonly polygon: "selection-overlay-polygon";
|
|
33
|
+
readonly label: "selection-overlay-label";
|
|
34
|
+
};
|
|
35
|
+
/** In paint order, lowest first: the halos, then the label as the topmost layer of the style. */
|
|
36
|
+
export declare function buildSelectionOverlayStack(): LayerSpecification[];
|
|
37
|
+
/** What a timeline tick can change in the overlay: the selected ids it was painted from, and which of them the timeline hid. */
|
|
38
|
+
export interface OverlayTimelineInputs {
|
|
39
|
+
ids: ReadonlySet<string>;
|
|
40
|
+
hidden: ReadonlySet<string>;
|
|
41
|
+
}
|
|
42
|
+
export declare function overlayTimelineInputs(ids: ReadonlySet<string>, visible: ReadonlySet<string> | null): OverlayTimelineInputs;
|
|
43
|
+
/** A tick that shows or hides no selected feature leaves the overlay as painted, so it need not be restyled. */
|
|
44
|
+
export declare function sameOverlayTimelineInputs(a: OverlayTimelineInputs, b: OverlayTimelineInputs): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The overlay payload: the selected features styled exactly as their base
|
|
47
|
+
* layer painted them (`styleFor` runs `styleFeatureForPaint` against the last
|
|
48
|
+
* full sync's context), so the halo width, icon size and label text cannot
|
|
49
|
+
* disagree with the base paint. `styleFor` returns every painted copy of an
|
|
50
|
+
* id — a duplicated id highlights each — and none for an id it cannot resolve.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildSelectionOverlayData(ids: ReadonlySet<string>, styleFor: (id: string) => readonly GeoJSON.Feature[]): GeoJSON.FeatureCollection;
|
|
53
|
+
//# sourceMappingURL=selection-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-overlay.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D,eAAO,MAAM,2BAA2B;;;;;CAK9B,CAAC;AAEX,iGAAiG;AACjG,wBAAgB,0BAA0B,IAAI,kBAAkB,EAAE,CA2DjE;AAED,gIAAgI;AAChI,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,qBAAqB,CAI1H;AAMD,gHAAgH;AAChH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAErG;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,OAAO,CAAC,OAAO,EAAE,GACnD,OAAO,CAAC,iBAAiB,CAM3B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CircleLayerSpecification } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* Selection is MapLibre feature state, not a source property.
|
|
4
|
+
*
|
|
5
|
+
* `map.setFeatureState({ source, id }, { selected: true })` records the
|
|
6
|
+
* change beside the source and, once per frame, rewrites the paint-buffer
|
|
7
|
+
* slots of the changed ids only — no worker round, no re-index, no tile
|
|
8
|
+
* reload — and it survives every `setData`. A paint expression reads it
|
|
9
|
+
* through `SELECTED`; filters and layout properties cannot, which is what the
|
|
10
|
+
* selection overlay source (`selection-overlay.ts`) is for.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The style spec's `ExpressionSpecification`. maplibre-gl does not re-export
|
|
14
|
+
* it, so it is the tuple member of a paint property that accepts one.
|
|
15
|
+
*/
|
|
16
|
+
export type PaintExpression = Extract<NonNullable<NonNullable<CircleLayerSpecification['paint']>['circle-stroke-color']>, unknown[]>;
|
|
17
|
+
export declare const SELECTED_STATE_KEY = "selected";
|
|
18
|
+
/** Paint-expression read of the selection. Boolean-coerced: absent state is unselected. */
|
|
19
|
+
export declare const SELECTED: PaintExpression;
|
|
20
|
+
/** The state written for a selected feature; `removeFeatureState` clears it whole. */
|
|
21
|
+
export declare const SELECTED_STATE: Readonly<Record<string, unknown>>;
|
|
22
|
+
export declare const SELECTION_COLOR = "#06b6d4";
|
|
23
|
+
//# sourceMappingURL=selection-paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-paint.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-paint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,WAAW,CAAC,WAAW,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,EAClF,OAAO,EAAE,CACV,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C,2FAA2F;AAC3F,eAAO,MAAM,QAAQ,EAAE,eAA2E,CAAC;AAEnG,sFAAsF;AACtF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAiD,CAAC;AAE/G,eAAO,MAAM,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The selection as painted: which sources each selected id has feature state
|
|
3
|
+
* on, and the two operations that keep it right.
|
|
4
|
+
*
|
|
5
|
+
* An id can be painted by more than one source — two layers sharing an id,
|
|
6
|
+
* one sharded and one small — and every copy must highlight, so the state
|
|
7
|
+
* goes on each of them. `applySelectionState` diffs the painted selection
|
|
8
|
+
* against the next one and touches only the toggled ids.
|
|
9
|
+
* `reconcileSelectionSources` runs after a source is (re)painted — the full
|
|
10
|
+
* sync's `setData`, a shard landing, a layer re-sharding — and follows ids to
|
|
11
|
+
* the sources they moved to. Feature state already persists across `setData`
|
|
12
|
+
* on the same source, so that only pays for ids that moved.
|
|
13
|
+
*
|
|
14
|
+
* A source missing between frames is a source that was torn down, not an
|
|
15
|
+
* error: its entry is simply dropped.
|
|
16
|
+
*/
|
|
17
|
+
export interface FeatureStateHost {
|
|
18
|
+
setFeatureState(sourceId: string, id: string, state: Readonly<Record<string, unknown>>): void;
|
|
19
|
+
/** Whole-feature removal (no key), so nothing lingers on a deselected id. */
|
|
20
|
+
removeFeatureState(sourceId: string, id: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* The live source object, or undefined once torn down. A source removed and
|
|
23
|
+
* re-added under the same id is a new object, and has lost its feature state.
|
|
24
|
+
*/
|
|
25
|
+
source(sourceId: string): object | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** A source an id's state was set on, and the source object it went on. */
|
|
28
|
+
export interface AppliedSource {
|
|
29
|
+
readonly sourceId: string;
|
|
30
|
+
readonly handle: object;
|
|
31
|
+
}
|
|
32
|
+
/** Selected id → the sources its state was set on. */
|
|
33
|
+
export type AppliedSelection = Map<string, readonly AppliedSource[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Paint `next` as the selection. `gate` false means nothing is selected
|
|
36
|
+
* (`enableSelection` and `enableDrawing` both off), so every highlight goes.
|
|
37
|
+
* `locate` returns every source that paints an id, or nothing for an id in
|
|
38
|
+
* no store.
|
|
39
|
+
*/
|
|
40
|
+
export declare function applySelectionState(applied: AppliedSelection, next: ReadonlySet<string>, gate: boolean, locate: (id: string) => readonly string[], host: FeatureStateHost): {
|
|
41
|
+
set: number;
|
|
42
|
+
removed: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* After a paint: for each applied id, set the state on the sources `locate`
|
|
46
|
+
* names that it is not on yet, or whose source was recreated since (a new
|
|
47
|
+
* source object starts with no feature state). The sources it left keep their
|
|
48
|
+
* state while it stays selected: `locate` names where a feature is headed, and
|
|
49
|
+
* the old source may paint it until its own repaint lands, so removing it there
|
|
50
|
+
* would drop the highlight in between. A source that no longer holds the id
|
|
51
|
+
* paints nothing with it, and deselection clears every recorded source.
|
|
52
|
+
* Torn-down sources are forgotten; an id `locate` no longer finds anywhere (the
|
|
53
|
+
* feature left every store) is pruned. Unchanged ids cost one lookup and no
|
|
54
|
+
* host call.
|
|
55
|
+
*/
|
|
56
|
+
export declare function reconcileSelectionSources(applied: AppliedSelection, locate: (id: string) => readonly string[], host: FeatureStateHost): {
|
|
57
|
+
moved: number;
|
|
58
|
+
pruned: number;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=selection-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-state.d.ts","sourceRoot":"","sources":["../../../client/src/lib/selection-state.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAC9F,6EAA6E;IAC7E,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC,CAAC;AA4CrE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,EACzC,IAAI,EAAE,gBAAgB,GACrB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAsBlC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,EACzC,IAAI,EAAE,gBAAgB,GACrB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA0BnC"}
|
|
@@ -7,11 +7,12 @@ import type { Layer } from '@/components/layers-panel';
|
|
|
7
7
|
* `setLayers` → full sync → new pass → completion loops forever, and every
|
|
8
8
|
* unrelated panel action would repaint the whole layer. So a pass records the
|
|
9
9
|
* inputs it painted from, and the next sync compares: equal means the shards
|
|
10
|
-
* on screen are already correct and only
|
|
11
|
-
*
|
|
10
|
+
* on screen are already correct and only the timeline needs reconciling
|
|
11
|
+
* through its fast path.
|
|
12
12
|
*
|
|
13
|
-
* Selection and timeline are deliberately absent:
|
|
14
|
-
* shard by
|
|
13
|
+
* Selection and timeline are deliberately absent: the timeline is reconciled
|
|
14
|
+
* per shard by its diff, and selection is feature state that a pass never
|
|
15
|
+
* paints.
|
|
15
16
|
*/
|
|
16
17
|
export interface ShardFingerprint {
|
|
17
18
|
/** By identity — `readOnlyFeatures` arrays are copy-on-write, so a new array means new content. */
|
|
@@ -21,11 +22,9 @@ export interface ShardFingerprint {
|
|
|
21
22
|
clusterConfig: Layer['clusterConfig'];
|
|
22
23
|
altitudeDisplayMode: Layer['altitudeDisplayMode'];
|
|
23
24
|
hasAltitudeData: Layer['hasAltitudeData'];
|
|
24
|
-
/** `enableSelection || enableDrawing`: selection styling is inert without one. */
|
|
25
|
-
selectionEnabled: boolean;
|
|
26
25
|
shardSize: number;
|
|
27
26
|
}
|
|
28
|
-
export declare function buildShardFingerprint(layer: Layer, features: readonly GeoJSON.Feature[],
|
|
27
|
+
export declare function buildShardFingerprint(layer: Layer, features: readonly GeoJSON.Feature[], shardSize: number): ShardFingerprint;
|
|
29
28
|
/**
|
|
30
29
|
* Field-wise `Object.is`. The config objects are compared by reference: the
|
|
31
30
|
* panel handlers replace them rather than mutating, so a reference change is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-fingerprint.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"shard-fingerprint.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mGAAmG;IACnG,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACpC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACtC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACtC,mBAAmB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAClD,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,EACpC,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAUlB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EACtC,CAAC,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAWT"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which GeoJSON source paints a feature, so feature state can be set on it.
|
|
3
|
+
*
|
|
4
|
+
* A sharded layer's feature lives in `custom-shard:<layer>:<k>` where `k` is
|
|
5
|
+
* its index in the layer's array divided by the shard size — the same
|
|
6
|
+
* arithmetic `shardRanges` slices with. Everything else (draw features, small
|
|
7
|
+
* read-only layers) paints through the shared source.
|
|
8
|
+
*
|
|
9
|
+
* The id → index map is built once per array identity and cached in a
|
|
10
|
+
* WeakMap: `readOnlyFeatures` arrays are copy-on-write, so a replaced array is
|
|
11
|
+
* a new key and the stale map is simply never looked up again (the pattern of
|
|
12
|
+
* `read-only-feature-index.ts`). Keep mutations copy-on-write.
|
|
13
|
+
*/
|
|
14
|
+
export interface LocatorInputs {
|
|
15
|
+
/** The `readOnlyFeatures` store; arrays are copy-on-write identity keys. */
|
|
16
|
+
readOnly: ReadonlyMap<string, readonly GeoJSON.Feature[]>;
|
|
17
|
+
/** Layer ids painted through shards, in layer order (the sync's `shardedLayerIds`). */
|
|
18
|
+
shardedLayerIds: ReadonlySet<string>;
|
|
19
|
+
shardSize: number;
|
|
20
|
+
}
|
|
21
|
+
/** Id → its first index; `repeats` holds the later indices of an id the array holds more than once. */
|
|
22
|
+
interface IdIndex {
|
|
23
|
+
first: Map<string, number>;
|
|
24
|
+
repeats: Map<string, number[]>;
|
|
25
|
+
}
|
|
26
|
+
export type LocatorCache = WeakMap<readonly GeoJSON.Feature[], IdIndex>;
|
|
27
|
+
export declare function createLocatorCache(): LocatorCache;
|
|
28
|
+
export interface FeatureHolder {
|
|
29
|
+
layerId: string;
|
|
30
|
+
/** That layer's own record for the id — two layers sharing an id may hold different features. */
|
|
31
|
+
feature: GeoJSON.Feature;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every copy of `id` in the read-only layers, in store order and then array
|
|
35
|
+
* order (the first is the one `buildReadOnlyFeatureIndex` resolves), each with
|
|
36
|
+
* its layer; empty for an id in no read-only layer (a draw feature, or a
|
|
37
|
+
* removed one). Same per-array index as the source locator, so a layer-record change
|
|
38
|
+
* (visibility, a restyle, an `importing` flip) costs nothing here: only a data
|
|
39
|
+
* mutation replaces an array.
|
|
40
|
+
*/
|
|
41
|
+
export declare function locateFeatureHolders(id: string, readOnly: ReadonlyMap<string, readonly GeoJSON.Feature[]>, cache: LocatorCache): FeatureHolder[];
|
|
42
|
+
/**
|
|
43
|
+
* Every source that paints `id`, in store order without repeats: the shard
|
|
44
|
+
* whose slice holds each copy for each sharded layer that holds it, the shared
|
|
45
|
+
* source for each small read-only layer that does, and the shared source alone
|
|
46
|
+
* for an id in no read-only layer (a draw feature). Two layers, or two slices
|
|
47
|
+
* of one layer, may hold an id, so feature state goes on every copy's source. Hidden layers are located like
|
|
48
|
+
* visible ones — feature state persists per source, so a hidden-then-shown
|
|
49
|
+
* layer's selection comes back on its own.
|
|
50
|
+
*/
|
|
51
|
+
export declare function locateFeatureSources(id: string, inputs: LocatorInputs, cache: LocatorCache): string[];
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=shard-locator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard-locator.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-locator.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1D,uFAAuF;IACvF,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uGAAuG;AACvG,UAAU,OAAO;IACf,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAExE,wBAAgB,kBAAkB,IAAI,YAAY,CAEjD;AA6BD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC,EACzD,KAAK,EAAE,YAAY,GAClB,aAAa,EAAE,CAMjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAarG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-pipeline.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-pipeline.ts"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,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAsClF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LayerSpecification, SourceSpecification } from 'maplibre-gl';
|
|
2
2
|
import { type CustomLayerRole } from './custom-layer-stack';
|
|
3
|
-
import {
|
|
3
|
+
import type { SelectionPaintCache, UpdatableGeoJSONSource } from './selection-diff';
|
|
4
4
|
import type { ShardHost } from './shard-pipeline';
|
|
5
5
|
/** The slice of the MapLibre style the registry drives, so it tests in node. */
|
|
6
6
|
export interface StyleHost {
|
|
@@ -85,15 +85,16 @@ export interface ShardRegistry {
|
|
|
85
85
|
}
|
|
86
86
|
export declare function createShardRegistry(host: StyleHost, hooks: ShardRegistryHooks): ShardRegistry;
|
|
87
87
|
/**
|
|
88
|
-
* Bring one layer's painted shards up to date with the current
|
|
89
|
-
*
|
|
88
|
+
* Bring one layer's painted shards up to date with the current timeline
|
|
89
|
+
* state without repainting them, for a pass the fingerprint skipped.
|
|
90
|
+
* Selection is feature state and needs no reconciling here.
|
|
90
91
|
*
|
|
91
92
|
* Returns false when any shard cannot be diffed (no cache yet, duplicate ids,
|
|
92
93
|
* missing source), so the caller repaints instead. Shards a pass has not
|
|
93
94
|
* reached yet have no cache and are skipped: they paint with the current state
|
|
94
95
|
* when their turn comes.
|
|
95
96
|
*/
|
|
96
|
-
export declare function reconcileShardCaches(registry: ShardRegistry, layerId: string, expectedShards: number,
|
|
97
|
+
export declare function reconcileShardCaches(registry: ShardRegistry, layerId: string, expectedShards: number, visibleIds: ReadonlySet<string> | null): boolean;
|
|
97
98
|
/**
|
|
98
99
|
* Run a fast-path diff over every painted shard of every layer.
|
|
99
100
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-registry.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAGL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"shard-registry.d.ts","sourceRoot":"","sources":["../../../client/src/lib/shard-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAGL,KAAK,eAAe,EAKrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC3C,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5D,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAClE,OAAO,CAAC,Q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C,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,sBAAsB,KAAK,OAAO,GAC7E,OAAO,CAOT"}
|
|
@@ -46,10 +46,8 @@ export interface TraceTimelineDiff {
|
|
|
46
46
|
pointUpdates: NonNullable<GeoJSONSourceDiff['update']>;
|
|
47
47
|
segmentAdd: GeoJSON.Feature[];
|
|
48
48
|
segmentRemove: string[];
|
|
49
|
-
/** `basePriorityById` entries to commit once the updates are applied. */
|
|
50
|
-
basePriorities: [string, number][];
|
|
51
49
|
}
|
|
52
|
-
type PaintState = Pick<SelectionPaintCache, 'appliedHiddenIds'
|
|
50
|
+
type PaintState = Pick<SelectionPaintCache, 'appliedHiddenIds'>;
|
|
53
51
|
/**
|
|
54
52
|
* Pure diff from the painted visibility (`paint.appliedHiddenIds`) to
|
|
55
53
|
* `nextVisibleSet`. Build it BEFORE the generic timeline path advances that
|
|
@@ -67,9 +65,8 @@ export declare function diffConsecutivePairs(prev: readonly number[], next: read
|
|
|
67
65
|
* between the diff being built and applied, or a diff maplibre rejects up
|
|
68
66
|
* front) is logged and reported as false so the caller falls back to the
|
|
69
67
|
* full sync, which repaints everything, cache included; the diff itself is
|
|
70
|
-
* cheap to lose.
|
|
71
|
-
* paint cache so the selection fast path restores them correctly on deselect.
|
|
68
|
+
* cheap to lose.
|
|
72
69
|
*/
|
|
73
|
-
export declare function applyTraceTimelineDiff(diff: TraceTimelineDiff,
|
|
70
|
+
export declare function applyTraceTimelineDiff(diff: TraceTimelineDiff, pointSource: UpdatableGeoJSONSource, segmentSource: UpdatableGeoJSONSource): boolean;
|
|
74
71
|
export {};
|
|
75
72
|
//# sourceMappingURL=trace-timeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-timeline.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,mB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.existsSync(fontsDir)
|
|
|
9
9
|
? fs.readdirSync(fontsDir).filter(f => fs.statSync(join(fontsDir, f)).isDirectory())
|
|
10
10
|
: [];
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Font stacks the component's own label layers request. Static hosting can't
|
|
14
|
+
* resolve composite stacks the way the dev middleware does, so the build
|
|
15
|
+
* emits each of these as a copy of its resolved Noto Sans variant.
|
|
16
|
+
*/
|
|
17
|
+
export const COMPONENT_FONT_STACKS = [
|
|
18
|
+
'Montserrat Regular,Noto Sans Regular',
|
|
19
|
+
'Montserrat Medium,Noto Sans Regular',
|
|
20
|
+
'Montserrat SemiBold,Noto Sans Regular',
|
|
21
|
+
'Open Sans Bold,Arial Unicode MS Bold',
|
|
22
|
+
];
|
|
23
|
+
|
|
12
24
|
/**
|
|
13
25
|
* Map a composite font stack (e.g. "Montserrat Regular,Open Sans Regular,Noto Sans Regular")
|
|
14
26
|
* to the best locally available Noto Sans variant by inspecting keywords in the stack.
|
|
@@ -50,12 +62,35 @@ function fontsMiddleware(req, res, next) {
|
|
|
50
62
|
}
|
|
51
63
|
}
|
|
52
64
|
|
|
65
|
+
/** Every glyph file the build emits, keyed by its path under `fonts/`. */
|
|
66
|
+
export function fontAssets() {
|
|
67
|
+
const assets = [];
|
|
68
|
+
const addStack = (stack, variant) => {
|
|
69
|
+
for (const rangeFile of fs.readdirSync(join(fontsDir, variant))) {
|
|
70
|
+
if (!rangeFile.endsWith('.pbf')) continue;
|
|
71
|
+
assets.push({ fileName: `fonts/${stack}/${rangeFile}`, source: fs.readFileSync(join(fontsDir, variant, rangeFile)) });
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
for (const variant of FONT_VARIANTS) addStack(variant, variant);
|
|
75
|
+
for (const stack of COMPONENT_FONT_STACKS) addStack(stack, resolveFontStack(stack));
|
|
76
|
+
return assets;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function mountFonts(server) {
|
|
80
|
+
server.middlewares.use('/fonts', fontsMiddleware);
|
|
81
|
+
const base = server.config.base;
|
|
82
|
+
if (base && base !== '/') server.middlewares.use(`${base.replace(/\/$/, '')}/fonts`, fontsMiddleware);
|
|
83
|
+
}
|
|
84
|
+
|
|
53
85
|
/**
|
|
54
|
-
* Vite plugin that
|
|
55
|
-
*
|
|
86
|
+
* Vite plugin that makes the map component's bundled glyph fonts available
|
|
87
|
+
* to the host app: served at `/fonts/` and `<base>fonts/` in dev and preview,
|
|
88
|
+
* and emitted into the build output as `<outDir>/fonts/`, so production
|
|
89
|
+
* serves them from `<base>fonts/` alongside the rest of the bundle.
|
|
56
90
|
*
|
|
57
91
|
* Composite font stacks from tile styles (e.g. "Montserrat Regular,Open Sans Regular")
|
|
58
|
-
* are
|
|
92
|
+
* are mapped to the bundled Noto Sans variants by the dev middleware; the
|
|
93
|
+
* build emits the stacks the component itself uses (COMPONENT_FONT_STACKS).
|
|
59
94
|
*
|
|
60
95
|
* Usage:
|
|
61
96
|
* import { mapFontsPlugin } from '@octostar/map-component/vite';
|
|
@@ -64,11 +99,10 @@ function fontsMiddleware(req, res, next) {
|
|
|
64
99
|
export function mapFontsPlugin() {
|
|
65
100
|
return {
|
|
66
101
|
name: 'octostar-map-fonts',
|
|
67
|
-
configureServer
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
server.middlewares.use('/fonts', fontsMiddleware);
|
|
102
|
+
configureServer: mountFonts,
|
|
103
|
+
configurePreviewServer: mountFonts,
|
|
104
|
+
generateBundle() {
|
|
105
|
+
for (const { fileName, source } of fontAssets()) this.emitFile({ type: 'asset', fileName, source });
|
|
72
106
|
},
|
|
73
107
|
};
|
|
74
108
|
}
|