@tileflow/static 0.1.0-alpha.26 → 0.1.0-alpha.28
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/README.md +22 -22
- package/dist/{chunk-TBI5AED6.js → chunk-ALFVZ3PC.js} +3 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.js +361 -15
- package/dist/{errors-B9rwehK0.d.ts → errors-CSz1xaDx.d.ts} +2 -0
- package/dist/manifest.d.ts +33 -5
- package/dist/manifest.js +322 -17
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +164 -8
- package/dist/{scene-contract-Cr6BNLz0.d.ts → scene-contract-NFnIcQtt.d.ts} +13 -13
- package/dist/scene.d.ts +15 -15
- package/dist/scene.js +1 -1
- package/package.json +2 -9
- package/dist/chunk-HVVIAOBE.js +0 -175
- package/dist/chunk-RGXE4HDY.js +0 -380
- package/dist/chunk-XMT7VJL5.js +0 -297
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -116
package/dist/scene.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StaticMapError } from './errors-
|
|
3
|
-
import {
|
|
4
|
-
export { M as MAX_OVERLAY_LATITUDE,
|
|
2
|
+
import { S as StaticMapError } from './errors-CSz1xaDx.js';
|
|
3
|
+
import { a as StaticSceneInput, f as StaticScene } from './scene-contract-NFnIcQtt.js';
|
|
4
|
+
export { M as MAX_OVERLAY_LATITUDE, g as StaticAttributionMode, S as StaticAttributionPosition, h as StaticAttributionRequest, i as StaticCoordinate, j as StaticMapFormat, k as StaticOverlayPlacement, n as StaticPadding, o as StaticSymbolAnchor, q as StaticSymbolCollision, r as StaticSymbolLabelAppearance, t as StaticSymbolLabelPosition, u as StaticSymbolLanguage, v as isSupportedStaticSymbolCodePoint, w as staticAttributionPositionSchema, x as staticAttributionRequestSchema, y as staticOverlayPlacements, z as staticSceneLimits, A as staticSceneSchema, B as staticSceneSchemaVersion, C as staticSymbolAnchors, D as staticSymbolCollisions, E as staticSymbolLabelAppearances, F as staticSymbolLabelPositions, G as staticSymbolLanguages } from './scene-contract-NFnIcQtt.js';
|
|
5
5
|
|
|
6
6
|
declare const autoFitDetailsSchema: z.ZodObject<{
|
|
7
7
|
overlay: z.ZodOptional<z.ZodObject<{
|
|
@@ -82,11 +82,13 @@ declare const staticSymbolTooLargeDetailsSchema: z.ZodObject<{
|
|
|
82
82
|
}, z.core.$strict>;
|
|
83
83
|
type StaticMapRequestErrorDetails = StaticAutoFitDetails | z.infer<typeof staticIconUnavailableDetailsSchema> | z.infer<typeof staticOverlayInvalidDetailsSchema> | z.infer<typeof staticLabelUnsupportedDetailsSchema> | z.infer<typeof staticSymbolTooLargeDetailsSchema>;
|
|
84
84
|
declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
error: z.ZodString;
|
|
86
|
+
retryable: z.ZodLiteral<false>;
|
|
85
87
|
code: z.ZodLiteral<"AUTO_FIT_EMPTY">;
|
|
86
88
|
reason: z.ZodLiteral<"NO_FITTABLE_OVERLAYS">;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
87
90
|
error: z.ZodString;
|
|
88
91
|
retryable: z.ZodLiteral<false>;
|
|
89
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
90
92
|
code: z.ZodLiteral<"AUTO_FIT_AMBIGUOUS">;
|
|
91
93
|
details: z.ZodObject<{
|
|
92
94
|
overlay: z.ZodOptional<z.ZodObject<{
|
|
@@ -124,9 +126,9 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
124
126
|
}, z.core.$strict>>;
|
|
125
127
|
}, z.core.$strict>;
|
|
126
128
|
reason: z.ZodLiteral<"ANTIMERIDIAN_WRAP_REQUIRED">;
|
|
129
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
130
|
error: z.ZodString;
|
|
128
131
|
retryable: z.ZodLiteral<false>;
|
|
129
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
130
132
|
code: z.ZodLiteral<"AUTO_FIT_IMPOSSIBLE">;
|
|
131
133
|
details: z.ZodOptional<z.ZodObject<{
|
|
132
134
|
overlay: z.ZodOptional<z.ZodObject<{
|
|
@@ -169,9 +171,9 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
169
171
|
INSUFFICIENT_VIEWPORT: "INSUFFICIENT_VIEWPORT";
|
|
170
172
|
PROJECTED_FOOTPRINT_OUTSIDE_VIEWPORT: "PROJECTED_FOOTPRINT_OUTSIDE_VIEWPORT";
|
|
171
173
|
}>;
|
|
174
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
175
|
error: z.ZodString;
|
|
173
176
|
retryable: z.ZodLiteral<false>;
|
|
174
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
175
177
|
code: z.ZodLiteral<"STATIC_OVERLAY_INVALID">;
|
|
176
178
|
details: z.ZodObject<{
|
|
177
179
|
latitude: z.ZodNumber;
|
|
@@ -189,9 +191,9 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
189
191
|
}, z.core.$strict>;
|
|
190
192
|
}, z.core.$strict>;
|
|
191
193
|
reason: z.ZodLiteral<"OVERLAY_LATITUDE_OUT_OF_RANGE">;
|
|
194
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
192
195
|
error: z.ZodString;
|
|
193
196
|
retryable: z.ZodLiteral<false>;
|
|
194
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
195
197
|
code: z.ZodLiteral<"STATIC_MAP_LABEL_UNSUPPORTED">;
|
|
196
198
|
details: z.ZodObject<{
|
|
197
199
|
codePoint: z.ZodNumber;
|
|
@@ -202,9 +204,9 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
202
204
|
}, z.core.$strict>;
|
|
203
205
|
}, z.core.$strict>;
|
|
204
206
|
reason: z.ZodLiteral<"UNSUPPORTED_GLYPH">;
|
|
207
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
208
|
error: z.ZodString;
|
|
206
209
|
retryable: z.ZodLiteral<false>;
|
|
207
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
208
210
|
code: z.ZodLiteral<"STATIC_MAP_ICON_UNAVAILABLE">;
|
|
209
211
|
details: z.ZodObject<{
|
|
210
212
|
icon: z.ZodString;
|
|
@@ -218,14 +220,14 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
218
220
|
ICON_NOT_FOUND: "ICON_NOT_FOUND";
|
|
219
221
|
MANAGED_SPRITE_REQUIRED: "MANAGED_SPRITE_REQUIRED";
|
|
220
222
|
}>;
|
|
223
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
221
224
|
error: z.ZodString;
|
|
222
225
|
retryable: z.ZodLiteral<false>;
|
|
223
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
224
226
|
code: z.ZodLiteral<"STATIC_MAP_PLACEMENT_UNAVAILABLE">;
|
|
225
227
|
reason: z.ZodLiteral<"MAP_REDEPLOY_REQUIRED">;
|
|
228
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
226
229
|
error: z.ZodString;
|
|
227
230
|
retryable: z.ZodLiteral<false>;
|
|
228
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
229
231
|
code: z.ZodLiteral<"STATIC_MAP_SYMBOL_TOO_LARGE">;
|
|
230
232
|
details: z.ZodObject<{
|
|
231
233
|
height: z.ZodNumber;
|
|
@@ -238,26 +240,24 @@ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
238
240
|
width: z.ZodNumber;
|
|
239
241
|
}, z.core.$strict>;
|
|
240
242
|
reason: z.ZodLiteral<"COMPOSED_IMAGE_TOO_LARGE">;
|
|
243
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
241
244
|
error: z.ZodString;
|
|
242
245
|
retryable: z.ZodLiteral<false>;
|
|
243
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
244
246
|
code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_UNSUPPORTED">;
|
|
245
247
|
reason: z.ZodEnum<{
|
|
246
248
|
UNSUPPORTED_DECLARATION: "UNSUPPORTED_DECLARATION";
|
|
247
249
|
UNSUPPORTED_GLYPH: "UNSUPPORTED_GLYPH";
|
|
248
250
|
}>;
|
|
251
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
249
252
|
error: z.ZodString;
|
|
250
253
|
retryable: z.ZodLiteral<false>;
|
|
251
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
252
254
|
code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_TOO_LARGE">;
|
|
253
255
|
reason: z.ZodLiteral<"CONTENT_LIMIT_EXCEEDED">;
|
|
256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
254
257
|
error: z.ZodString;
|
|
255
258
|
retryable: z.ZodLiteral<false>;
|
|
256
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
257
259
|
code: z.ZodLiteral<"STATIC_MAP_ATTRIBUTION_DOES_NOT_FIT">;
|
|
258
260
|
reason: z.ZodLiteral<"BLOCK_DOES_NOT_FIT">;
|
|
259
|
-
error: z.ZodString;
|
|
260
|
-
retryable: z.ZodLiteral<false>;
|
|
261
261
|
}, z.core.$strict>], "code">;
|
|
262
262
|
type StaticMapRequestErrorResponse = z.infer<typeof staticMapRequestErrorResponseSchema>;
|
|
263
263
|
type StaticAutoFitErrorResponse = Extract<StaticMapRequestErrorResponse, {
|
package/dist/scene.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/static",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.28",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Static map request schemas and helpers for Tileflow.",
|
|
6
6
|
"type": "module",
|
|
@@ -21,18 +21,11 @@
|
|
|
21
21
|
"maplibre",
|
|
22
22
|
"tiles"
|
|
23
23
|
],
|
|
24
|
-
"main": "./dist/index.js",
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
24
|
"files": [
|
|
27
25
|
"dist",
|
|
28
26
|
"LICENSE"
|
|
29
27
|
],
|
|
30
28
|
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"types": "./dist/index.d.ts",
|
|
33
|
-
"import": "./dist/index.js",
|
|
34
|
-
"default": "./dist/index.js"
|
|
35
|
-
},
|
|
36
29
|
"./client": {
|
|
37
30
|
"types": "./dist/client.d.ts",
|
|
38
31
|
"import": "./dist/client.js",
|
|
@@ -61,7 +54,7 @@
|
|
|
61
54
|
"zod": "^4.4.3"
|
|
62
55
|
},
|
|
63
56
|
"scripts": {
|
|
64
|
-
"build": "tsup src/
|
|
57
|
+
"build": "tsup src/scene.ts src/overlays.ts src/manifest.ts src/client.ts --format esm --dts --clean --splitting && node ../../scripts/canonicalize-zod-enums.mjs dist",
|
|
65
58
|
"verify": "pnpm --silent --dir ../.. static-text:check && tsx --test test/*.test.ts",
|
|
66
59
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
67
60
|
"lint": "tsc -p tsconfig.json --noEmit"
|
package/dist/chunk-HVVIAOBE.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeStaticOverlay,
|
|
3
|
-
roundNumber
|
|
4
|
-
} from "./chunk-6DWVCK64.js";
|
|
5
|
-
|
|
6
|
-
// src/overlays.ts
|
|
7
|
-
function line(input) {
|
|
8
|
-
return normalizeStaticOverlay({ ...input, type: "line" });
|
|
9
|
-
}
|
|
10
|
-
function circle(input) {
|
|
11
|
-
return normalizeStaticOverlay({ ...input, type: "circle" });
|
|
12
|
-
}
|
|
13
|
-
function marker(input) {
|
|
14
|
-
return normalizeStaticOverlay({ ...input, type: "marker" });
|
|
15
|
-
}
|
|
16
|
-
function polygon(input) {
|
|
17
|
-
return normalizeStaticOverlay({ ...input, type: "polygon" });
|
|
18
|
-
}
|
|
19
|
-
function symbol(input) {
|
|
20
|
-
return normalizeStaticOverlay({ ...input, type: "symbol" });
|
|
21
|
-
}
|
|
22
|
-
function compileStaticOverlays(overlays, options = {}) {
|
|
23
|
-
if (options.longitudeOffsets !== void 0 && (options.longitudeOffsets.length !== overlays.length || options.longitudeOffsets.some(
|
|
24
|
-
(offset) => !Number.isInteger(offset) || Math.abs(offset) > 360 || offset % 360 !== 0
|
|
25
|
-
))) {
|
|
26
|
-
throw new Error(
|
|
27
|
-
"Static overlay longitude offsets must contain one -360, 0, or 360 per overlay"
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
const sources = {};
|
|
31
|
-
const layers = [];
|
|
32
|
-
const placements = {};
|
|
33
|
-
const symbols = [];
|
|
34
|
-
const pushLayer = (layer, overlay) => {
|
|
35
|
-
const layerId = String(layer.id);
|
|
36
|
-
layers.push(layer);
|
|
37
|
-
placements[layerId] = overlay.placement ?? "above-labels";
|
|
38
|
-
};
|
|
39
|
-
for (const [index, overlay] of overlays.entries()) {
|
|
40
|
-
const longitudeOffset = options.longitudeOffsets?.[index] ?? 0;
|
|
41
|
-
const id = safeLayerId(`tileflow-static-overlay-${index + 1}-${overlay.id ?? overlay.type}`);
|
|
42
|
-
const sourceId = `${id}-source`;
|
|
43
|
-
if (overlay.type === "line") {
|
|
44
|
-
sources[sourceId] = {
|
|
45
|
-
data: feature("LineString", shiftLongitudes(overlay.coordinates, longitudeOffset)),
|
|
46
|
-
type: "geojson"
|
|
47
|
-
};
|
|
48
|
-
pushLayer(
|
|
49
|
-
{
|
|
50
|
-
id,
|
|
51
|
-
layout: { "line-cap": "round", "line-join": "round" },
|
|
52
|
-
paint: {
|
|
53
|
-
"line-color": overlay.color,
|
|
54
|
-
"line-opacity": overlay.opacity,
|
|
55
|
-
"line-width": overlay.width
|
|
56
|
-
},
|
|
57
|
-
source: sourceId,
|
|
58
|
-
type: "line"
|
|
59
|
-
},
|
|
60
|
-
overlay
|
|
61
|
-
);
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (overlay.type === "polygon") {
|
|
65
|
-
sources[sourceId] = {
|
|
66
|
-
data: feature("Polygon", shiftLongitudes(overlay.coordinates, longitudeOffset)),
|
|
67
|
-
type: "geojson"
|
|
68
|
-
};
|
|
69
|
-
pushLayer(
|
|
70
|
-
{
|
|
71
|
-
id,
|
|
72
|
-
paint: {
|
|
73
|
-
"fill-color": overlay.fill,
|
|
74
|
-
"fill-opacity": overlay.opacity
|
|
75
|
-
},
|
|
76
|
-
source: sourceId,
|
|
77
|
-
type: "fill"
|
|
78
|
-
},
|
|
79
|
-
overlay
|
|
80
|
-
);
|
|
81
|
-
if (overlay.stroke && overlay.strokeWidth > 0) {
|
|
82
|
-
pushLayer(
|
|
83
|
-
{
|
|
84
|
-
id: `${id}-stroke`,
|
|
85
|
-
layout: { "line-cap": "round", "line-join": "round" },
|
|
86
|
-
paint: {
|
|
87
|
-
"line-color": overlay.stroke,
|
|
88
|
-
"line-width": overlay.strokeWidth
|
|
89
|
-
},
|
|
90
|
-
source: sourceId,
|
|
91
|
-
type: "line"
|
|
92
|
-
},
|
|
93
|
-
overlay
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
sources[sourceId] = {
|
|
99
|
-
data: feature("Point", shiftLongitudes(overlay.coordinate, longitudeOffset)),
|
|
100
|
-
type: "geojson"
|
|
101
|
-
};
|
|
102
|
-
if (overlay.type === "symbol") {
|
|
103
|
-
const composed = overlay.label !== void 0;
|
|
104
|
-
const imageId = composed ? safeLayerId(`__tileflow-static-symbol-${index + 1}-${overlay.id}`) : overlay.icon;
|
|
105
|
-
const alwaysVisible = overlay.collision === "always-visible";
|
|
106
|
-
const iconSize = composed ? 1 : overlay.scale;
|
|
107
|
-
const iconOffset = composed ? overlay.offset : overlay.offset.map((value) => roundNumber(value / overlay.scale));
|
|
108
|
-
pushLayer(
|
|
109
|
-
{
|
|
110
|
-
id,
|
|
111
|
-
layout: {
|
|
112
|
-
"icon-allow-overlap": alwaysVisible,
|
|
113
|
-
"icon-anchor": overlay.anchor,
|
|
114
|
-
"icon-ignore-placement": alwaysVisible,
|
|
115
|
-
"icon-image": imageId,
|
|
116
|
-
"icon-offset": iconOffset,
|
|
117
|
-
"icon-pitch-alignment": "viewport",
|
|
118
|
-
"icon-rotation-alignment": "viewport",
|
|
119
|
-
"icon-size": iconSize,
|
|
120
|
-
"symbol-placement": "point",
|
|
121
|
-
"symbol-z-order": "source"
|
|
122
|
-
},
|
|
123
|
-
paint: { "icon-opacity": overlay.opacity },
|
|
124
|
-
source: sourceId,
|
|
125
|
-
type: "symbol"
|
|
126
|
-
},
|
|
127
|
-
overlay
|
|
128
|
-
);
|
|
129
|
-
symbols.push({ imageId, overlayIndex: index });
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
pushLayer(
|
|
133
|
-
{
|
|
134
|
-
id,
|
|
135
|
-
paint: {
|
|
136
|
-
"circle-color": overlay.color,
|
|
137
|
-
"circle-opacity": overlay.type === "circle" ? overlay.opacity : 1,
|
|
138
|
-
"circle-radius": overlay.radius,
|
|
139
|
-
"circle-stroke-color": overlay.strokeColor ?? overlay.color,
|
|
140
|
-
"circle-stroke-width": overlay.strokeWidth
|
|
141
|
-
},
|
|
142
|
-
source: sourceId,
|
|
143
|
-
type: "circle"
|
|
144
|
-
},
|
|
145
|
-
overlay
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
return { layers, placements, sources, symbols };
|
|
149
|
-
}
|
|
150
|
-
function shiftLongitudes(value, offset) {
|
|
151
|
-
if (!Array.isArray(value)) return value;
|
|
152
|
-
if (value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number") {
|
|
153
|
-
return [roundNumber(value[0] + offset), value[1]];
|
|
154
|
-
}
|
|
155
|
-
return value.map((entry) => shiftLongitudes(entry, offset));
|
|
156
|
-
}
|
|
157
|
-
function feature(type, coordinates) {
|
|
158
|
-
return {
|
|
159
|
-
geometry: { coordinates, type },
|
|
160
|
-
properties: {},
|
|
161
|
-
type: "Feature"
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function safeLayerId(value) {
|
|
165
|
-
return value.replace(/[^a-zA-Z0-9_-]/g, "-").slice(0, 80);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export {
|
|
169
|
-
line,
|
|
170
|
-
circle,
|
|
171
|
-
marker,
|
|
172
|
-
polygon,
|
|
173
|
-
symbol,
|
|
174
|
-
compileStaticOverlays
|
|
175
|
-
};
|