@ngis/plugin-sdk 0.4.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.
Files changed (70) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +31 -0
  3. package/dist/index.cjs +76 -0
  4. package/dist/index.d.ts +77 -0
  5. package/dist/index.mjs +102 -0
  6. package/dist/src/api/analysis.d.ts +140 -0
  7. package/dist/src/api/resources.d.ts +530 -0
  8. package/dist/src/api/scenes.d.ts +251 -0
  9. package/dist/src/api/users.d.ts +22 -0
  10. package/dist/src/domain/algorithms/deck-layer-style.d.ts +34 -0
  11. package/dist/src/domain/algorithms/maplibre-style.d.ts +63 -0
  12. package/dist/src/domain/algorithms/raster-color-ramps.d.ts +37 -0
  13. package/dist/src/domain/algorithms/scene-layer-type.d.ts +25 -0
  14. package/dist/src/domain/algorithms/symbol-compile.d.ts +100 -0
  15. package/dist/src/domain/algorithms/symbol-params.d.ts +90 -0
  16. package/dist/src/domain/map/bounds.d.ts +8 -0
  17. package/dist/src/domain/map/constants.d.ts +40 -0
  18. package/dist/src/domain/map/layer-builders.d.ts +32 -0
  19. package/dist/src/domain/map/rendered-layers.d.ts +30 -0
  20. package/dist/src/domain/map/style-ready.d.ts +24 -0
  21. package/dist/src/domain/map/tile-url.d.ts +20 -0
  22. package/dist/src/domain/map/types.d.ts +128 -0
  23. package/dist/src/domain/models/deck-layer-style.d.ts +211 -0
  24. package/dist/src/domain/models/scene-layer-type.d.ts +23 -0
  25. package/dist/src/domain/models/symbol.d.ts +424 -0
  26. package/dist/src/lib/api.d.ts +82 -0
  27. package/dist/src/lib/auth-session.d.ts +22 -0
  28. package/dist/src/lib/raster-color-layer/RasterColorLayer.d.ts +48 -0
  29. package/dist/src/lib/raster-color-layer/TileGrid.d.ts +31 -0
  30. package/dist/src/lib/raster-color-layer/colorRamp.d.ts +18 -0
  31. package/dist/src/lib/raster-color-layer/shaders/raster-color.frag.d.ts +2 -0
  32. package/dist/src/lib/raster-color-layer/shaders/raster-color.vert.d.ts +2 -0
  33. package/dist/src/lib/raster-color-layer/zoomInterpolate.d.ts +2 -0
  34. package/dist/src/sdk/commands.d.ts +113 -0
  35. package/dist/src/sdk/context/keys.d.ts +148 -0
  36. package/dist/src/sdk/context/publishers.d.ts +198 -0
  37. package/dist/src/sdk/context/store.d.ts +78 -0
  38. package/dist/src/sdk/context/when.d.ts +69 -0
  39. package/dist/src/sdk/contributions/dispatch.d.ts +78 -0
  40. package/dist/src/sdk/contributions/panel-id.d.ts +25 -0
  41. package/dist/src/sdk/contributions/registry.d.ts +199 -0
  42. package/dist/src/sdk/contributions/symbol-renderers.d.ts +107 -0
  43. package/dist/src/sdk/contributions/types.d.ts +288 -0
  44. package/dist/src/sdk/contributions/views-bridge.d.ts +92 -0
  45. package/dist/src/sdk/define-plugin.d.ts +17 -0
  46. package/dist/src/sdk/facets/storage.d.ts +152 -0
  47. package/dist/src/sdk/facets/types.d.ts +370 -0
  48. package/dist/src/sdk/host-api.d.ts +256 -0
  49. package/dist/src/sdk/map-api.d.ts +288 -0
  50. package/dist/src/sdk/panels.d.ts +130 -0
  51. package/dist/src/sdk/plugin.d.ts +145 -0
  52. package/dist/src/sdk/rail-tools.d.ts +58 -0
  53. package/dist/src/sdk/scopes.d.ts +158 -0
  54. package/dist/src/systems/renderer/DeckSceneRenderer.d.ts +26 -0
  55. package/dist/src/systems/renderer/FlowFieldLayer.d.ts +68 -0
  56. package/dist/src/systems/renderer/LayerRendererRegistry.d.ts +132 -0
  57. package/dist/src/systems/renderer/authenticated-deck-load.d.ts +4 -0
  58. package/dist/src/systems/renderer/deck/deck-layer-builders.d.ts +29 -0
  59. package/dist/src/systems/renderer/deck/deck-layer-helpers.d.ts +21 -0
  60. package/dist/src/systems/renderer/deck/mvt-point-aggregation-layer.d.ts +107 -0
  61. package/dist/src/systems/renderer/flow-field/flow-field-resources.d.ts +84 -0
  62. package/dist/src/systems/renderer/flow-field/flow-field-shaders.d.ts +4 -0
  63. package/dist/src/systems/renderer/symbol/SpriteRegistry.d.ts +34 -0
  64. package/dist/src/systems/renderer/symbol/entries.d.ts +67 -0
  65. package/dist/src/types/analysis.d.ts +205 -0
  66. package/dist/src/types/common.d.ts +17 -0
  67. package/dist/src/types/extensions.d.ts +560 -0
  68. package/dist/src/types/gis.d.ts +242 -0
  69. package/dist/src/types/market-social.d.ts +378 -0
  70. package/package.json +47 -0
@@ -0,0 +1,251 @@
1
+ import type { ResourceShareMode } from "./resources";
2
+ import type { ApiRequestOptions } from "../lib/api";
3
+ export type SceneScope = "mine" | "shared" | "public";
4
+ export type SceneType = "MAP" | "ANALYSIS" | "GIS";
5
+ export type SceneMapSubCategory = "FREEFORM" | "TEMPLATE";
6
+ export type SceneAnalysisSubCategory = "LAYER_ANALYSIS" | "WORKFLOW_ANALYSIS" | "CODING_ANALYSIS" | "INSIGHT_ANALYSIS";
7
+ /**
8
+ * Moved to `@/types/common` (F1 / W1.2) — re-exported here so existing
9
+ * `import type { PageResult } from "@/api/scenes"` call sites keep working.
10
+ */
11
+ export type { PageResult } from "../types/common";
12
+ export interface NgisScene {
13
+ id: string;
14
+ ownerId: string;
15
+ name: string;
16
+ type?: SceneType | string | null;
17
+ description?: string | null;
18
+ thumbnailFileId?: string | null;
19
+ configJson?: string | null;
20
+ /** True for an unsaved scratch scene (auto-deleted after the TTL window). */
21
+ ephemeral?: boolean | null;
22
+ purpose?: "STANDARD" | "GIS_WORKSPACE" | "PLUGIN_UI_LAB" | string | null;
23
+ generation?: number | null;
24
+ lastActiveAt?: string | null;
25
+ expiresAt?: string | null;
26
+ mapSubCategories?: SceneMapSubCategory[] | string[] | null;
27
+ analysisSubCategories?: SceneAnalysisSubCategory[] | string[] | null;
28
+ createdAt?: string | null;
29
+ updatedAt?: string | null;
30
+ }
31
+ export interface NgisPublicScene {
32
+ id: string;
33
+ sourceSceneId: string;
34
+ ownerId: string;
35
+ name: string;
36
+ configSnapshot?: string | null;
37
+ layersSnapshot?: string | null;
38
+ publishedAt?: string | null;
39
+ }
40
+ export interface PublicSceneSummary {
41
+ sceneId: string;
42
+ name: string;
43
+ ownerId?: string | null;
44
+ publishedAt?: string | null;
45
+ }
46
+ export interface PublicSceneDetail {
47
+ scene: NgisScene;
48
+ layers: NgisSceneLayer[];
49
+ resources: SceneResourceDto[];
50
+ }
51
+ export interface CreateSceneParams {
52
+ name: string;
53
+ type: SceneType;
54
+ description?: string;
55
+ mapSubCategories?: SceneMapSubCategory[];
56
+ analysisSubCategories?: SceneAnalysisSubCategory[];
57
+ }
58
+ export interface UpdateSceneParams {
59
+ name?: string;
60
+ description?: string;
61
+ }
62
+ export interface UpdateSceneCapabilitiesParams {
63
+ mapSubCategories?: SceneMapSubCategory[];
64
+ analysisSubCategories?: SceneAnalysisSubCategory[];
65
+ }
66
+ export interface SceneResourceDto {
67
+ id: string;
68
+ sceneId: string;
69
+ name: string;
70
+ originalFileId: string;
71
+ workingFileId?: string | null;
72
+ effectiveFileId: string;
73
+ snapshot?: boolean | null;
74
+ snapshotId?: string | null;
75
+ mode?: ResourceShareMode | string | null;
76
+ geometryType?: string | null;
77
+ bboxJson?: string | null;
78
+ addedAt?: string | null;
79
+ layerCount: number;
80
+ rendered: boolean;
81
+ datasetType?: string | null;
82
+ datasetStatus?: string | null;
83
+ /**
84
+ * Selection-safe projection supplied by the scene service: VECTOR | RASTER |
85
+ * FILE. Resource pickers must use this rather than fan out to Dataset APIs.
86
+ */
87
+ selectionType?: string | null;
88
+ /** AVAILABLE | MISSING | UNAVAILABLE | UNKNOWN. */
89
+ metadataState?: string | null;
90
+ ready?: boolean;
91
+ renderable?: boolean;
92
+ }
93
+ export interface ListSceneResourcesOptions {
94
+ /** Ask the scene service to refresh its bounded, persisted dataset summaries. */
95
+ refresh?: boolean;
96
+ signal?: AbortSignal;
97
+ }
98
+ export interface RegisterSceneResourceParams {
99
+ fileId: string;
100
+ name?: string;
101
+ }
102
+ export interface NgisSceneLayer {
103
+ id: string;
104
+ sceneId: string;
105
+ resourceId?: string | null;
106
+ name: string;
107
+ layerType?: string | null;
108
+ styleJson?: string | null;
109
+ visible?: boolean | null;
110
+ sortOrder?: number | null;
111
+ groupId?: string | null;
112
+ }
113
+ export interface AddSceneLayerParams {
114
+ resourceId?: string;
115
+ fileId?: string;
116
+ name: string;
117
+ layerType?: string;
118
+ styleJson?: string;
119
+ }
120
+ export interface UpdateSceneLayerParams {
121
+ name?: string;
122
+ visible?: boolean;
123
+ sortOrder?: number;
124
+ styleJson?: string;
125
+ groupId?: string;
126
+ }
127
+ export interface NgisSceneLayerGroup {
128
+ id: string;
129
+ sceneId: string;
130
+ parentId?: string | null;
131
+ name: string;
132
+ orderIndex?: number | null;
133
+ }
134
+ export interface CreateLayerGroupParams {
135
+ name: string;
136
+ parentId?: string;
137
+ orderIndex?: number;
138
+ }
139
+ export interface UpdateLayerGroupParams {
140
+ name?: string;
141
+ orderIndex?: number;
142
+ }
143
+ export interface SceneListResult {
144
+ items: NgisScene[];
145
+ total: number;
146
+ }
147
+ /** Response of `GET /api/scenes/gis/workspace` — the user's scratch GIS scene. */
148
+ export interface GisWorkspaceResponse {
149
+ scene: NgisScene;
150
+ layerCount: number;
151
+ }
152
+ export interface PluginUiLabResponse {
153
+ scene: NgisScene;
154
+ generation: number;
155
+ resourceCount: number;
156
+ layerCount: number;
157
+ lastActiveAt: string;
158
+ expiresAt: string;
159
+ cleanupState?: string | null;
160
+ cleanupOperationId?: string | null;
161
+ cleanupPhase?: string | null;
162
+ cleanupError?: string | null;
163
+ }
164
+ export interface PluginUiLabSample {
165
+ id: string;
166
+ version: string;
167
+ name: string;
168
+ description?: string | null;
169
+ dataKind: string;
170
+ datasetType: string;
171
+ geometryType?: string | null;
172
+ ready: boolean;
173
+ renderable: boolean;
174
+ available: boolean;
175
+ unavailableReason?: string | null;
176
+ }
177
+ export interface PluginUiLabSampleLoadRequest {
178
+ expectedGeneration: number;
179
+ sampleIds: string[];
180
+ }
181
+ export interface PluginUiLabSampleLoadItem {
182
+ sampleId: string;
183
+ sampleVersion?: string | null;
184
+ status: "LOADED" | "ALREADY_PRESENT" | "FAILED" | string;
185
+ resource?: SceneResourceDto | null;
186
+ layerId?: string | null;
187
+ error?: string | null;
188
+ }
189
+ export interface PluginUiLabSampleLoadResponse {
190
+ generation: number;
191
+ items: PluginUiLabSampleLoadItem[];
192
+ }
193
+ export declare const scenesApi: {
194
+ listMine(page?: number, size?: number): Promise<SceneListResult>;
195
+ listShared(): Promise<SceneListResult>;
196
+ listPublic(page?: number, size?: number): Promise<SceneListResult>;
197
+ getPublic(sceneId: string): Promise<PublicSceneDetail>;
198
+ get(sceneId: string): Promise<NgisScene>;
199
+ /**
200
+ * The caller's first saved scene of a type, in the listing order
201
+ * `/api/scenes` itself returns. Scratch/lab scenes are not saved scenes.
202
+ * Continue through the listing so a matching type beyond the first page is
203
+ * not mistaken for an empty workspace.
204
+ */
205
+ findFirstScene(type: SceneType): Promise<NgisScene | null>;
206
+ /** The caller's first saved GIS scene, or `null` when they have none. */
207
+ findFirstGisScene(): Promise<NgisScene | null>;
208
+ /**
209
+ * Get-or-create the caller's single scratch GIS workspace scene
210
+ * (`type=GIS`, `ephemeral=true`). Also resets its inactivity TTL.
211
+ */
212
+ getGisWorkspace(): Promise<GisWorkspaceResponse>;
213
+ getPluginUiLab(signal?: AbortSignal): Promise<PluginUiLabResponse>;
214
+ resetPluginUiLab(generation: number, signal?: AbortSignal): Promise<PluginUiLabResponse>;
215
+ discardPluginUiLab(signal?: AbortSignal): Promise<void>;
216
+ listPluginUiLabSamples(signal?: AbortSignal): Promise<PluginUiLabSample[]>;
217
+ loadPluginUiLabSamples(request: PluginUiLabSampleLoadRequest, signal?: AbortSignal): Promise<PluginUiLabSampleLoadResponse>;
218
+ /** Clear the scratch GIS workspace in place (same id, layers/config wiped). */
219
+ resetGisWorkspace(): Promise<NgisScene>;
220
+ /**
221
+ * Promote a scratch scene to a permanent one (`ephemeral` → false). Optional
222
+ * `name` renames it. After this, the next `getGisWorkspace()` returns a fresh
223
+ * empty scratch.
224
+ */
225
+ promoteScene(sceneId: string, name?: string): Promise<NgisScene>;
226
+ create(params: CreateSceneParams): Promise<NgisScene>;
227
+ update(sceneId: string, params: UpdateSceneParams): Promise<NgisScene>;
228
+ updateConfig(sceneId: string, config: string | object): Promise<NgisScene>;
229
+ updateCapabilities(sceneId: string, params: UpdateSceneCapabilitiesParams): Promise<NgisScene>;
230
+ delete(sceneId: string): Promise<void>;
231
+ publish(sceneId: string): Promise<void>;
232
+ unpublish(sceneId: string): Promise<void>;
233
+ isPublished(sceneId: string): Promise<boolean>;
234
+ forkPublic(publicSceneId: string, folderId?: string | null): Promise<NgisScene>;
235
+ listResources(sceneId: string, options?: ListSceneResourcesOptions | AbortSignal): Promise<SceneResourceDto[]>;
236
+ registerResource(sceneId: string, params: RegisterSceneResourceParams, options?: ApiRequestOptions): Promise<SceneResourceDto>;
237
+ renameResource(sceneId: string, resourceId: string, name: string): Promise<SceneResourceDto>;
238
+ deleteResource(sceneId: string, resourceId: string, cascade?: boolean): Promise<void>;
239
+ updateResourceWorkingFile(sceneId: string, resourceId: string, fileId: string): Promise<SceneResourceDto>;
240
+ revertResourceWorkingFile(sceneId: string, resourceId: string): Promise<SceneResourceDto>;
241
+ listLayers(sceneId: string, signal?: AbortSignal): Promise<NgisSceneLayer[]>;
242
+ addLayer(sceneId: string, params: AddSceneLayerParams, options?: ApiRequestOptions): Promise<NgisSceneLayer>;
243
+ updateLayer(sceneId: string, layerId: string, params: UpdateSceneLayerParams, options?: ApiRequestOptions): Promise<NgisSceneLayer>;
244
+ renameLayer(sceneId: string, layerId: string, name: string): Promise<NgisSceneLayer>;
245
+ deleteLayer(sceneId: string, layerId: string, options?: ApiRequestOptions): Promise<void>;
246
+ reorderLayers(sceneId: string, layerIds: string[], options?: ApiRequestOptions): Promise<void>;
247
+ listLayerGroups(sceneId: string): Promise<NgisSceneLayerGroup[]>;
248
+ createLayerGroup(sceneId: string, params: CreateLayerGroupParams): Promise<NgisSceneLayerGroup>;
249
+ updateLayerGroup(sceneId: string, groupId: string, params: UpdateLayerGroupParams): Promise<NgisSceneLayerGroup>;
250
+ deleteLayerGroup(sceneId: string, groupId: string): Promise<void>;
251
+ };
@@ -0,0 +1,22 @@
1
+ export interface UserProfile {
2
+ id: string;
3
+ name?: string | null;
4
+ email?: string | null;
5
+ username?: string | null;
6
+ avatar?: string | null;
7
+ role?: string | null;
8
+ }
9
+ declare function fetchUserProfile(userId: string): Promise<UserProfile>;
10
+ export declare function getUserDisplayName(profile: UserProfile | null, fallback: string): string;
11
+ export declare const usersApi: {
12
+ /** The current authenticated user's profile. */
13
+ me(): Promise<UserProfile>;
14
+ /** Update the only editable text field exposed by the user service. */
15
+ updateMe(username: string): Promise<unknown>;
16
+ /** Upload the current user's avatar. The service returns its URL. */
17
+ uploadAvatar(file: File): Promise<string>;
18
+ /** Public profile for any user id (used to resolve owner names). */
19
+ getById: typeof fetchUserProfile;
20
+ getByIdSafe(userId: string): Promise<UserProfile | null>;
21
+ };
22
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { DeckColorMapping, DeckCategoryValue, DeckLayerStyle, DeckElevationStyle, DeckMvtLineStyle } from "../models/deck-layer-style";
2
+ import type { SceneLayerTypeId } from "../models/scene-layer-type";
3
+ export interface DeckStyleFieldDescriptor {
4
+ name: string;
5
+ kind?: string | null;
6
+ type?: string | null;
7
+ }
8
+ export declare function getDefaultDeckColorRampId(layerType: SceneLayerTypeId | DeckLayerStyle["type"]): "blues" | "ylorrd";
9
+ export declare function isNumericDeckStyleField(field: DeckStyleFieldDescriptor): boolean;
10
+ export declare function getNumericDeckStyleFields<T extends DeckStyleFieldDescriptor>(fields: readonly T[]): T[];
11
+ export declare function createDefaultDeckLayerStyle(layerType: SceneLayerTypeId, fields: readonly DeckStyleFieldDescriptor[]): DeckLayerStyle | null;
12
+ export declare function normalizeDeckLayerStyle(value: unknown, expectedType?: SceneLayerTypeId | null): DeckLayerStyle | null;
13
+ export declare function parseDeckLayerStyleJson(styleJson: string | null | undefined, expectedType?: SceneLayerTypeId | null): DeckLayerStyle | null;
14
+ export declare function serializeDeckLayerStyle(style: DeckLayerStyle): string;
15
+ export declare function getDeckColorForValue(value: unknown, color: DeckColorMapping): string;
16
+ export declare function getDeckElevationValue(value: number, elevation: DeckElevationStyle): number;
17
+ export type DeckRangeColorMapping = Extract<DeckColorMapping, {
18
+ mode: "graduated" | "continuous";
19
+ }>;
20
+ export declare function applyDeckColorRamp(color: DeckRangeColorMapping, colors: readonly string[]): DeckRangeColorMapping;
21
+ export declare function reverseDeckColorRamp(color: DeckRangeColorMapping): DeckRangeColorMapping;
22
+ export declare function getDeckLineWidthForValue(value: number, width: DeckMvtLineStyle["width"]): number;
23
+ export declare function buildGraduatedDeckColors(field: string, breaks: readonly number[], colors: readonly string[]): DeckColorMapping | null;
24
+ export declare function buildContinuousDeckColors(field: string, inputs: readonly number[], colors: readonly string[]): DeckColorMapping | null;
25
+ export declare function buildCategoricalDeckColors(field: string, values: readonly DeckCategoryValue[], colors: readonly string[], defaultColor?: string): DeckColorMapping | null;
26
+ export declare function buildEqualIntervalDeckBreaks(min: number, max: number, classCount: number): number[];
27
+ export declare function normalizeDeckClassificationBreaks(breaks: readonly number[], classCount: number): number[];
28
+ export declare function applyDeckSharedFieldMapping(style: DeckLayerStyle, options: {
29
+ field: string;
30
+ min: number;
31
+ max: number;
32
+ colors: readonly string[];
33
+ widthRange?: readonly [number, number];
34
+ }): DeckLayerStyle | null;
@@ -0,0 +1,63 @@
1
+ import { type RasterClassificationMethod, type RasterColorMode } from "../../lib/raster-color-layer/colorRamp";
2
+ export type MapLibreSceneLayerType = "fill" | "line" | "circle" | "raster" | "symbol";
3
+ export type MapLibreStyleRecord = Record<string, unknown>;
4
+ /** The style types the vector/raster style editor can produce and edit. `symbol`
5
+ * is excluded by construction (F24.9): a symbol layer's appearance is compiled
6
+ * from its manifest, and the two functions below can never return it because
7
+ * `symbol` is in neither MAPLIBRE_SCENE_LAYER_TYPES nor
8
+ * `getCanonicalMapLibreStyleType`. Stating that in the type keeps the editor's
9
+ * own unions closed instead of forcing a widening through five files. */
10
+ export type MapLibreEditableLayerType = Exclude<MapLibreSceneLayerType, "symbol">;
11
+ export declare const RASTER_TILE_PARAM_KEYS: Set<string>;
12
+ /** The style types a user may pick for a vector/raster scene layer. `symbol` is
13
+ * NOT a member: a symbol layer's appearance comes from its manifest, not from a
14
+ * hand-edited MapLibre style record (F24.9). */
15
+ export declare const MAPLIBRE_SCENE_LAYER_TYPES: MapLibreEditableLayerType[];
16
+ export declare const MAPLIBRE_PAINT_PROPERTY_KEYS: Record<MapLibreSceneLayerType, Set<string>>;
17
+ export declare const MAPLIBRE_LAYOUT_PROPERTY_KEYS: Record<MapLibreSceneLayerType, Set<string>>;
18
+ /** F24.9 — `icon-image` values are restricted to registry-issued sprite ids.
19
+ * The registry mints them through `symbolSpriteId` (symbol-compile.ts); this is
20
+ * the shape check the style layer applies before an id reaches MapLibre, so a
21
+ * hand-written style cannot name an arbitrary image in the basemap's sprite. */
22
+ export declare const MAPLIBRE_SYMBOL_SPRITE_ID_PATTERN: RegExp;
23
+ export declare function isRegistryIssuedSpriteId(value: unknown): value is string;
24
+ export declare function isMapLibreStyleRecord(value: unknown): value is MapLibreStyleRecord;
25
+ export declare function normalizeMapLibreLayerType(value: unknown): MapLibreEditableLayerType | undefined;
26
+ export declare function getDefaultMapLibreLayerType(params: {
27
+ layerType?: string | null;
28
+ geometryType?: string | null;
29
+ }): MapLibreEditableLayerType;
30
+ export declare function isMapLibreLayerTypeCompatible(type: MapLibreSceneLayerType, params: {
31
+ layerType?: string | null;
32
+ geometryType?: string | null;
33
+ }): boolean;
34
+ export declare function getCompatibleMapLibreLayerType(params: {
35
+ layerType?: string | null;
36
+ geometryType?: string | null;
37
+ styleType?: unknown;
38
+ }): MapLibreEditableLayerType;
39
+ export declare function getDefaultMapLibrePaint(type: MapLibreSceneLayerType): MapLibreStyleRecord;
40
+ export declare function filterMapLibreStyleRecord(value: unknown, type: MapLibreSceneLayerType, category: "paint" | "layout"): MapLibreStyleRecord;
41
+ export declare function parseRasterRescale(value: unknown): [number, number] | null;
42
+ export declare function parseRasterColorMode(value: unknown): RasterColorMode | null;
43
+ export declare function parseRasterClassificationMethod(value: unknown): RasterClassificationMethod | null;
44
+ export declare function parseRasterClassBreaks(value: unknown): number[] | null;
45
+ export declare function filterRasterTileParams(value: unknown): MapLibreStyleRecord;
46
+ export declare function sanitizeMapLibreStyleObjectForLayer(style: unknown, params: {
47
+ layerType?: string | null;
48
+ geometryType?: string | null;
49
+ }): {
50
+ style: null;
51
+ changed: boolean;
52
+ } | {
53
+ style: MapLibreStyleRecord;
54
+ changed: boolean;
55
+ };
56
+ export declare function parseMapLibreStyleJson(styleJson?: string | null): MapLibreStyleRecord | null;
57
+ export declare function sanitizeMapLibreStyleJsonForLayer(styleJson: string | null | undefined, params: {
58
+ layerType?: string | null;
59
+ geometryType?: string | null;
60
+ }): {
61
+ styleJson: string | null | undefined;
62
+ changed: boolean;
63
+ };
@@ -0,0 +1,37 @@
1
+ export type RasterColorRampCategory = "sequential" | "diverging" | "terrain" | "qualitative";
2
+ export type RasterColorRampLabelKey = "presets.gray" | "presets.blues" | "presets.ylgnbu" | "presets.ylorrd" | "presets.greens" | "presets.purples" | "presets.rdbu" | "presets.brbg" | "presets.rdylbu" | "presets.spectral" | "presets.terrain" | "presets.bathymetry" | "presets.landElevation" | "presets.slope" | "presets.precipitation" | "presets.temperature" | "presets.vegetation" | "presets.set2" | "presets.paired" | "presets.set3" | "presets.category10" | "presets.dark2" | "presets.tableau10";
3
+ export interface RasterColorRampPreset {
4
+ id: string;
5
+ labelKey: RasterColorRampLabelKey;
6
+ category: RasterColorRampCategory;
7
+ colors: string[];
8
+ clientOnly?: boolean;
9
+ }
10
+ export declare const RASTER_COLOR_RAMP_PRESETS: RasterColorRampPreset[];
11
+ export declare const DEFAULT_RASTER_COLOR_RAMP: string[];
12
+ export declare function parseRasterColorRamp(value: unknown): string[] | null;
13
+ export declare function getRasterColorRampPreset(id: unknown): RasterColorRampPreset | undefined;
14
+ export declare function getDefaultRasterColorRamp(): string[];
15
+ export declare function sampleRasterColorRamp(colors: string[], count: number): string[];
16
+ export declare function cycleRasterColorRamp(colors: string[], count: number): string[];
17
+ export declare function resolveRasterColorRamp(params: {
18
+ colorRamp?: unknown;
19
+ legacyPreset?: unknown;
20
+ sampleCount?: number;
21
+ sampleMode?: "interpolate" | "cycle";
22
+ }): {
23
+ custom: boolean;
24
+ reversed: boolean;
25
+ id: string;
26
+ labelKey: RasterColorRampLabelKey;
27
+ category: RasterColorRampCategory;
28
+ colors: string[];
29
+ clientOnly?: boolean;
30
+ } | {
31
+ id: string;
32
+ labelKey: null;
33
+ category: null;
34
+ colors: string[];
35
+ custom: boolean;
36
+ reversed: boolean;
37
+ };
@@ -0,0 +1,25 @@
1
+ import { type SceneLayerGeometryFamily, type SceneLayerTypeDefinition, type SceneLayerTypeId } from "../models/scene-layer-type";
2
+ interface SceneLayerResourceFieldDescriptor {
3
+ kind?: string | null;
4
+ type?: string | null;
5
+ }
6
+ export interface SceneLayerResourceDescriptor {
7
+ type?: string | null;
8
+ geometry?: string | null;
9
+ geometryType?: string | null;
10
+ fields?: readonly SceneLayerResourceFieldDescriptor[] | null;
11
+ }
12
+ export interface SceneLayerTypeDescriptor {
13
+ layerType?: string | null;
14
+ }
15
+ export declare function getResourceGeometryFamily(resource: SceneLayerResourceDescriptor): SceneLayerGeometryFamily | null;
16
+ export declare function isResolvedGeometryType(geometryType?: string | null): boolean;
17
+ export declare function getSceneLayerTypeDefinition(layerType: string | null | undefined): SceneLayerTypeDefinition | undefined;
18
+ export declare function getCompatibleSceneLayerTypes(resource: SceneLayerResourceDescriptor): SceneLayerTypeDefinition[];
19
+ export declare function isSceneLayerTypeCompatible(layerType: string | null | undefined, resource: SceneLayerResourceDescriptor): boolean;
20
+ export declare function isMapLibreSceneLayerType(layerType: string | null | undefined): boolean;
21
+ export declare function isDeckSceneLayerType(layerType: string | null | undefined): boolean;
22
+ export declare function isRasterSceneLayerType(layerType: string | null | undefined): boolean;
23
+ export declare function getSceneLayerGeometryFamily(layerType: string | null | undefined): SceneLayerGeometryFamily | null;
24
+ export declare function normalizeLegacySceneLayerType(layer: SceneLayerTypeDescriptor, resource: SceneLayerResourceDescriptor): SceneLayerTypeId | null;
25
+ export {};
@@ -0,0 +1,100 @@
1
+ /**
2
+ * `compileSymbol` — the render-plan compiler (F24.8). Pure: no map, no DOM, no
3
+ * deck.gl import. It picks **one engine per scene layer** — MapLibre when every
4
+ * stack layer is MapLibre-expressible, deck.gl otherwise — and returns the plan
5
+ * the registry entry mounts.
6
+ *
7
+ * Two things it deliberately does not do:
8
+ *
9
+ * - It does not fix the mixed-renderer z-order limitation
10
+ * (`docs/deckgl/mixed-renderer-layer-order-risk.md`). A deck plan carries a
11
+ * typed `deck-z-order-group` hint and the limitation stays inherited.
12
+ * - It does not rewrite `styleJson`. F24.9's fallback semantics are "host
13
+ * default for the geometry family + a typed reason, saved intent untouched",
14
+ * so an unavailable symbol produces a *plan* carrying `fallbackReason` and
15
+ * the stored style is never touched — assert byte equality on reload.
16
+ */
17
+ import { type SymbolCapabilities, type SymbolFallbackReason, type SymbolGeometry, type SymbolManifest, type SymbolRef, type SymbolRenderPlan, type SymbolStyleJson } from "../models/symbol";
18
+ import type { MapLibreEditableLayerType } from "./maplibre-style";
19
+ /**
20
+ * The `builtin:` T0 renderers a MapLibre paint/layout pair can express on its
21
+ * own. Anything else — including every T2 shader and every T3 plugin renderer —
22
+ * forces the whole scene layer onto deck, because F24.8 picks one engine for the
23
+ * layer and not one per stack member.
24
+ */
25
+ export declare const MAPLIBRE_EXPRESSIBLE_BUILTIN_RENDERERS: Set<string>;
26
+ /** The sprite id the registry issues for one stack layer, and the only shape
27
+ * `icon-image` accepts (F24.9, `isRegistryIssuedSpriteId`). */
28
+ export declare function symbolSpriteId(symbolId: string, version: string, layerIndex: number, variant?: string): string;
29
+ /**
30
+ * A `fallback` stack layer's index is offset past the main stack before it is
31
+ * minted into a sprite id.
32
+ *
33
+ * Without it `layers[0]` and `fallback[0]` mint the **same** id for two
34
+ * different assets, and the registry answers the second `ensure` with the first
35
+ * one's pixels — a wrong image, silently, on exactly the path that exists to
36
+ * degrade well. `SYMBOL_MAX_LAYERS` caps either stack, so the two ranges cannot
37
+ * overlap, and the id still matches `MAPLIBRE_SYMBOL_SPRITE_ID_PATTERN` (`\d+`).
38
+ */
39
+ export declare const SYMBOL_FALLBACK_SPRITE_INDEX_OFFSET = 8;
40
+ export declare function symbolFallbackSpriteIndex(index: number): number;
41
+ /** The host default MapLibre layer type for a geometry family — what a fallback
42
+ * plan renders (F24.9). */
43
+ export declare function getSymbolHostDefaultLayerType(geometry: SymbolGeometry): MapLibreEditableLayerType;
44
+ /** A stable key for a symbol reference — the string `resolve` echoes as `ref`. */
45
+ export declare function symbolRefKey(ref: SymbolRef): string;
46
+ /**
47
+ * Parse a scene layer's `styleJson` as a symbol style. Returns `null` for
48
+ * anything that is not one — including a MapLibre style record — so a caller can
49
+ * route without a try/catch. It never mutates or re-serializes: the string it
50
+ * was handed is what stays on the scene layer.
51
+ */
52
+ export declare function parseSymbolStyleJson(styleJson: string | null | undefined): SymbolStyleJson | null;
53
+ /**
54
+ * The plan for an unavailable or unusable symbol: the host default for the
55
+ * geometry family, plus the typed reason. No stack, nothing animated, and the
56
+ * caller's `styleJson` untouched.
57
+ */
58
+ export declare function compileSymbolFallbackPlan(geometry: SymbolGeometry, reason: SymbolFallbackReason): SymbolRenderPlan;
59
+ /** The reasons a manifest's own `fallback` stack can be reached under. */
60
+ export declare const AUTHOR_FALLBACK_REASONS: readonly SymbolFallbackReason[];
61
+ export interface CompileSymbolOptions {
62
+ /**
63
+ * The manifest a T0 preset extends. `compileSymbol` will not go and fetch it —
64
+ * a preset compiled without its target is `missing`, which is the honest
65
+ * answer rather than a silently empty stack.
66
+ */
67
+ presetTarget?: SymbolManifest | null;
68
+ /**
69
+ * A reason the caller already knows (from `resolve`: the symbol is forbidden,
70
+ * yanked, gone, or its T3 extension is not installed). Short-circuits to the
71
+ * fallback plan for the style's geometry.
72
+ */
73
+ unavailableReason?: SymbolFallbackReason | null;
74
+ /** Geometry to use for a fallback plan when there is no manifest to read it from. */
75
+ geometry?: SymbolGeometry;
76
+ }
77
+ /**
78
+ * `compileSymbol(manifest, style, capabilities) → SymbolRenderPlan`.
79
+ *
80
+ * `manifest` is `null` when the reference did not resolve; `options.geometry`
81
+ * then names the family whose host default to fall back to.
82
+ */
83
+ export declare function compileSymbol(manifest: SymbolManifest | null, style: SymbolStyleJson | null, capabilities: SymbolCapabilities, options?: CompileSymbolOptions): SymbolRenderPlan;
84
+ export interface SymbolMapLibreLayerSpec {
85
+ type: MapLibreEditableLayerType | "symbol";
86
+ paint: Record<string, unknown>;
87
+ layout: Record<string, unknown>;
88
+ }
89
+ /**
90
+ * The MapLibre layer shape a `maplibre`-engine plan mounts. Sprite-backed stack
91
+ * layers become the geometry's native MapLibre image layer: `symbol` for a
92
+ * point, `line-pattern` for a line and `fill-pattern` for a polygon. A plan
93
+ * with no usable sprite becomes the host default for the family so the features
94
+ * still appear.
95
+ *
96
+ * `availableSpriteIds` is what the caller's `SpriteRegistry` actually holds —
97
+ * naming a sprite MapLibre has never been given renders nothing and reports no
98
+ * error, which is the same silent-blank failure mode F24.8.1 warns about.
99
+ */
100
+ export declare function buildSymbolMapLibreLayerSpec(plan: SymbolRenderPlan, availableSpriteIds?: ReadonlySet<string>): SymbolMapLibreLayerSpec;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Param and slot normalisation for symbols (F24.5) — pure, no map, no DOM.
3
+ *
4
+ * Three jobs, kept apart because the render-plan compiler needs them at
5
+ * different moments:
6
+ *
7
+ * 1. `normalizeSymbolParams` folds a scene layer's saved `params` onto the
8
+ * manifest's declared defaults, refusing what the declaration does not
9
+ * allow. It never throws and never drops the caller's intent silently — an
10
+ * ignored value comes back as a `SymbolParamIssue`, because F24.9's "saved
11
+ * intent untouched" rule means the wrong-looking value stays in `styleJson`
12
+ * and the *reason* is what the UI has to show.
13
+ * 2. `resolveSymbolLayerParams` turns one stack layer's `params` aliases into
14
+ * concrete values (the `P_<name>` uniforms the harness will carry).
15
+ * 3. `normalizeSymbolSlots` resolves the closed slot list against the scene
16
+ * layer's bindings. The list does not grow this stage: a per-feature total
17
+ * path length is not a slot (F24.5.1) and rides `data0..data3`.
18
+ */
19
+ import { type SymbolManifest, type SymbolParamBindings, type SymbolParamValue, type SymbolParamValues, type SymbolSlot, type SymbolSlotBinding } from "../models/symbol";
20
+ export type SymbolParamIssueCode = "unknown-param" | "wrong-type" | "out-of-range" | "not-in-enum" | "unknown-slot" | "unknown-alias-target" | "capacity-exceeded" | "preset-target-mismatch";
21
+ export interface SymbolParamIssue {
22
+ code: SymbolParamIssueCode;
23
+ /** The param, alias or slot the issue is about. */
24
+ name: string;
25
+ detail: string;
26
+ }
27
+ export interface NormalizedSymbolParams {
28
+ values: SymbolParamValues;
29
+ issues: SymbolParamIssue[];
30
+ }
31
+ /**
32
+ * The manifest's declared defaults with the caller's overrides folded on top.
33
+ * An override naming a param the manifest does not declare is dropped with an
34
+ * `unknown-param` issue — never merged through, because it would then reach a
35
+ * uniform slot nothing allocated.
36
+ */
37
+ export declare function normalizeSymbolParams(manifest: Pick<SymbolManifest, "params">, overrides?: SymbolParamValues | null): NormalizedSymbolParams;
38
+ /**
39
+ * F24.5's fixed uniform block: 16 floats + 8 colours. A manifest declaring more
40
+ * is refused at validation server-side; the client check exists so the studio
41
+ * can say so before a publish round-trip.
42
+ */
43
+ export declare function checkSymbolParamCapacity(manifest: Pick<SymbolManifest, "params">): SymbolParamIssue[];
44
+ export interface ResolvedSymbolLayerParams {
45
+ values: Record<string, SymbolParamValue>;
46
+ issues: SymbolParamIssue[];
47
+ }
48
+ /**
49
+ * One stack layer's `params` map (alias → param reference or literal) resolved
50
+ * against already-normalized symbol params. See `SymbolParamBindings` for why a
51
+ * bare string is a reference when it names a declared param and a literal
52
+ * otherwise.
53
+ */
54
+ export declare function resolveSymbolLayerParams(manifest: Pick<SymbolManifest, "params">, bindings: SymbolParamBindings | undefined, values: SymbolParamValues): ResolvedSymbolLayerParams;
55
+ export type SymbolSlotSource = "binding" | "manifest-default" | "undeclared";
56
+ export interface NormalizedSymbolSlot {
57
+ slot: SymbolSlot;
58
+ source: SymbolSlotSource;
59
+ /** Present when the slot resolves to a fixed value rather than a per-feature read. */
60
+ value?: SymbolParamValue;
61
+ /** Present when the scene layer bound the slot. */
62
+ binding?: SymbolSlotBinding;
63
+ /** A `field`/`host` binding is read per feature; a `const` or default is not. */
64
+ perFeature: boolean;
65
+ }
66
+ export interface NormalizedSymbolSlots {
67
+ slots: NormalizedSymbolSlot[];
68
+ byName: Partial<Record<SymbolSlot, NormalizedSymbolSlot>>;
69
+ issues: SymbolParamIssue[];
70
+ }
71
+ /**
72
+ * The manifest's declared slots resolved against the scene layer's bindings.
73
+ * A binding for a slot the manifest does not declare is dropped with an issue —
74
+ * the closed list is the contract's, but *which* of the nine a symbol reads is
75
+ * the manifest's, and binding one it never reads is silently inert otherwise.
76
+ */
77
+ export declare function normalizeSymbolSlots(manifest: Pick<SymbolManifest, "slots" | "params">, bindings: Partial<Record<SymbolSlot, SymbolSlotBinding>> | undefined, values: SymbolParamValues): NormalizedSymbolSlots;
78
+ export interface ResolvedSymbolPreset {
79
+ manifest: SymbolManifest;
80
+ issues: SymbolParamIssue[];
81
+ }
82
+ /**
83
+ * A T0 preset (`extends`) resolved against the manifest it extends: the target's
84
+ * stack, slots, animation and fallback, with the preset's identity and the
85
+ * target's param defaults overridden by the preset's choices. The preset's
86
+ * params must be a subset of the target's declarations (F24.3) — one that is not
87
+ * comes back as an issue and is dropped, so a stale preset degrades to the
88
+ * target's defaults instead of failing to render.
89
+ */
90
+ export declare function resolveSymbolPreset(preset: SymbolManifest, target: SymbolManifest): ResolvedSymbolPreset;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resource-bounds parsing + bounds-driven camera focus. Extracted mechanically
3
+ * from `SceneMapCanvas.tsx` (session C1) — no behavior change.
4
+ */
5
+ import type { Map as MapLibreMap } from "maplibre-gl";
6
+ import type { ResourceBounds } from "./types";
7
+ export declare function parseResourceBounds(bboxJson?: string | null): ResourceBounds | undefined;
8
+ export declare function focusMapOnBounds(map: MapLibreMap, bounds: ResourceBounds, eventData?: Record<string, unknown>): void;