@tileflow/static 0.1.0-alpha.20 → 0.1.0-alpha.21

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/manifest.js CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  staticRenderManifestSchema,
6
6
  staticRendererSchemaVersion,
7
7
  validateStaticRenderManifest
8
- } from "./chunk-HKYA7ZIU.js";
9
- import "./chunk-ROBEGDDY.js";
10
- import "./chunk-YUG3PBK2.js";
8
+ } from "./chunk-S3WXE5P4.js";
9
+ import "./chunk-NHQK5UZ2.js";
10
+ import "./chunk-MGQCHCU3.js";
11
11
  export {
12
12
  createRenderManifest,
13
13
  hashRenderManifest,
@@ -1,12 +1,14 @@
1
1
  import { z } from 'zod';
2
- import { h as circleOverlaySchema, a as StaticOverlay, l as lineOverlaySchema, m as markerOverlaySchema, p as polygonOverlaySchema } from './scene-contract-DzsUeJ_V.js';
3
- export { b as StaticOverlayInput, s as staticOverlaySchema } from './scene-contract-DzsUeJ_V.js';
2
+ import { i as circleOverlaySchema, a as StaticOverlay, l as lineOverlaySchema, m as markerOverlaySchema, p as polygonOverlaySchema } from './scene-contract-DZMhLDnf.js';
3
+ export { b as StaticOverlayInput, s as staticOverlaySchema } from './scene-contract-DZMhLDnf.js';
4
4
 
5
5
  declare function line(input: Omit<z.input<typeof lineOverlaySchema>, 'type'>): StaticOverlay;
6
6
  declare function circle(input: Omit<z.input<typeof circleOverlaySchema>, 'type'>): StaticOverlay;
7
7
  declare function marker(input: Omit<z.input<typeof markerOverlaySchema>, 'type'>): StaticOverlay;
8
8
  declare function polygon(input: Omit<z.input<typeof polygonOverlaySchema>, 'type'>): StaticOverlay;
9
- declare function compileStaticOverlays(overlays: StaticOverlay[]): {
9
+ declare function compileStaticOverlays(overlays: StaticOverlay[], options?: {
10
+ longitudeOffsets?: readonly number[];
11
+ }): {
10
12
  layers: Record<string, unknown>[];
11
13
  sources: Record<string, Record<string, unknown>>;
12
14
  };
package/dist/overlays.js CHANGED
@@ -4,10 +4,10 @@ import {
4
4
  line,
5
5
  marker,
6
6
  polygon
7
- } from "./chunk-LGEYA6FQ.js";
7
+ } from "./chunk-KPT7PASB.js";
8
8
  import {
9
9
  staticOverlaySchema
10
- } from "./chunk-YUG3PBK2.js";
10
+ } from "./chunk-MGQCHCU3.js";
11
11
  export {
12
12
  circle,
13
13
  compileStaticOverlays,
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  declare const staticSceneSchemaVersion = 1;
4
+ declare const MAX_OVERLAY_LATITUDE = 85.051129;
4
5
  declare const staticSceneLimits: {
5
6
  readonly maxDimension: 1280;
6
7
  readonly maxGeoJsonBytes: 96000;
@@ -10,6 +11,12 @@ declare const staticSceneLimits: {
10
11
  readonly minDimension: 64;
11
12
  };
12
13
  declare const coordinateSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
14
+ declare const staticPaddingSchema: z.ZodObject<{
15
+ bottom: z.ZodNumber;
16
+ left: z.ZodNumber;
17
+ right: z.ZodNumber;
18
+ top: z.ZodNumber;
19
+ }, z.core.$strict>;
13
20
  declare const lineOverlaySchema: z.ZodObject<{
14
21
  color: z.ZodDefault<z.ZodString>;
15
22
  coordinates: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
@@ -90,6 +97,16 @@ declare const staticSceneSchema: z.ZodObject<{
90
97
  bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
91
98
  padding: z.ZodOptional<z.ZodNumber>;
92
99
  type: z.ZodLiteral<"bounds">;
100
+ }, z.core.$strip>, z.ZodObject<{
101
+ bearing: z.ZodOptional<z.ZodNumber>;
102
+ maxZoom: z.ZodOptional<z.ZodNumber>;
103
+ padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
104
+ bottom: z.ZodOptional<z.ZodNumber>;
105
+ left: z.ZodOptional<z.ZodNumber>;
106
+ right: z.ZodOptional<z.ZodNumber>;
107
+ top: z.ZodOptional<z.ZodNumber>;
108
+ }, z.core.$strict>]>>;
109
+ type: z.ZodLiteral<"auto">;
93
110
  }, z.core.$strip>], "type">;
94
111
  map: z.ZodString;
95
112
  overlays: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -133,9 +150,10 @@ declare const staticSceneSchema: z.ZodObject<{
133
150
  theme: z.ZodString;
134
151
  }, z.core.$strip>;
135
152
  type StaticCoordinate = z.infer<typeof coordinateSchema>;
153
+ type StaticPadding = z.infer<typeof staticPaddingSchema>;
136
154
  type StaticSceneInput = z.input<typeof staticSceneSchema>;
137
155
  type StaticScene = z.infer<typeof staticSceneSchema>;
138
156
  type StaticOverlayInput = z.input<typeof staticOverlaySchema>;
139
157
  type StaticOverlay = z.infer<typeof staticOverlaySchema>;
140
158
 
141
- export { type StaticCoordinate as S, type StaticOverlay as a, type StaticOverlayInput as b, type StaticScene as c, type StaticSceneInput as d, staticSceneLimits as e, staticSceneSchema as f, staticSceneSchemaVersion as g, circleOverlaySchema as h, lineOverlaySchema as l, markerOverlaySchema as m, polygonOverlaySchema as p, staticOverlaySchema as s };
159
+ export { MAX_OVERLAY_LATITUDE as M, type StaticCoordinate as S, type StaticOverlay as a, type StaticOverlayInput as b, type StaticPadding as c, type StaticScene as d, type StaticSceneInput as e, staticSceneLimits as f, staticSceneSchema as g, staticSceneSchemaVersion as h, circleOverlaySchema as i, lineOverlaySchema as l, markerOverlaySchema as m, polygonOverlaySchema as p, staticOverlaySchema as s };
package/dist/scene.d.ts CHANGED
@@ -1,6 +1,183 @@
1
- import { d as StaticSceneInput, c as StaticScene } from './scene-contract-DzsUeJ_V.js';
2
- export { S as StaticCoordinate, e as staticSceneLimits, f as staticSceneSchema, g as staticSceneSchemaVersion } from './scene-contract-DzsUeJ_V.js';
3
- import 'zod';
1
+ import { z } from 'zod';
2
+ import { e as StaticSceneInput, d as StaticScene } from './scene-contract-DZMhLDnf.js';
3
+ export { M as MAX_OVERLAY_LATITUDE, S as StaticCoordinate, c as StaticPadding, f as staticSceneLimits, g as staticSceneSchema, h as staticSceneSchemaVersion } from './scene-contract-DZMhLDnf.js';
4
+
5
+ declare const autoFitDetailsSchema: z.ZodObject<{
6
+ overlay: z.ZodOptional<z.ZodObject<{
7
+ id: z.ZodString;
8
+ index: z.ZodNumber;
9
+ type: z.ZodEnum<{
10
+ line: "line";
11
+ circle: "circle";
12
+ marker: "marker";
13
+ polygon: "polygon";
14
+ }>;
15
+ }, z.core.$strict>>;
16
+ padding: z.ZodOptional<z.ZodObject<{
17
+ bottom: z.ZodNumber;
18
+ left: z.ZodNumber;
19
+ right: z.ZodNumber;
20
+ top: z.ZodNumber;
21
+ }, z.core.$strict>>;
22
+ projection: z.ZodOptional<z.ZodEnum<{
23
+ globe: "globe";
24
+ mercator: "mercator";
25
+ }>>;
26
+ requiredInsets: z.ZodOptional<z.ZodObject<{
27
+ bottom: z.ZodNumber;
28
+ left: z.ZodNumber;
29
+ right: z.ZodNumber;
30
+ top: z.ZodNumber;
31
+ }, z.core.$strict>>;
32
+ ringIndex: z.ZodOptional<z.ZodNumber>;
33
+ segmentIndex: z.ZodOptional<z.ZodNumber>;
34
+ viewport: z.ZodOptional<z.ZodObject<{
35
+ height: z.ZodNumber;
36
+ width: z.ZodNumber;
37
+ }, z.core.$strict>>;
38
+ }, z.core.$strict>;
39
+ type StaticAutoFitDetails = z.infer<typeof autoFitDetailsSchema>;
40
+ declare const staticOverlayInvalidDetailsSchema: z.ZodObject<{
41
+ latitude: z.ZodNumber;
42
+ limit: z.ZodLiteral<85.051129>;
43
+ overlay: z.ZodObject<{
44
+ id: z.ZodString;
45
+ index: z.ZodNumber;
46
+ type: z.ZodEnum<{
47
+ line: "line";
48
+ circle: "circle";
49
+ marker: "marker";
50
+ polygon: "polygon";
51
+ }>;
52
+ }, z.core.$strict>;
53
+ }, z.core.$strict>;
54
+ type StaticMapRequestErrorDetails = StaticAutoFitDetails | z.infer<typeof staticOverlayInvalidDetailsSchema>;
55
+ declare const staticMapRequestErrorResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ code: z.ZodLiteral<"AUTO_FIT_EMPTY">;
57
+ reason: z.ZodLiteral<"NO_FITTABLE_OVERLAYS">;
58
+ error: z.ZodString;
59
+ retryable: z.ZodLiteral<false>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ code: z.ZodLiteral<"AUTO_FIT_AMBIGUOUS">;
62
+ details: z.ZodObject<{
63
+ overlay: z.ZodOptional<z.ZodObject<{
64
+ id: z.ZodString;
65
+ index: z.ZodNumber;
66
+ type: z.ZodEnum<{
67
+ line: "line";
68
+ circle: "circle";
69
+ marker: "marker";
70
+ polygon: "polygon";
71
+ }>;
72
+ }, z.core.$strict>>;
73
+ padding: z.ZodOptional<z.ZodObject<{
74
+ bottom: z.ZodNumber;
75
+ left: z.ZodNumber;
76
+ right: z.ZodNumber;
77
+ top: z.ZodNumber;
78
+ }, z.core.$strict>>;
79
+ projection: z.ZodOptional<z.ZodEnum<{
80
+ globe: "globe";
81
+ mercator: "mercator";
82
+ }>>;
83
+ requiredInsets: z.ZodOptional<z.ZodObject<{
84
+ bottom: z.ZodNumber;
85
+ left: z.ZodNumber;
86
+ right: z.ZodNumber;
87
+ top: z.ZodNumber;
88
+ }, z.core.$strict>>;
89
+ ringIndex: z.ZodOptional<z.ZodNumber>;
90
+ segmentIndex: z.ZodOptional<z.ZodNumber>;
91
+ viewport: z.ZodOptional<z.ZodObject<{
92
+ height: z.ZodNumber;
93
+ width: z.ZodNumber;
94
+ }, z.core.$strict>>;
95
+ }, z.core.$strict>;
96
+ reason: z.ZodLiteral<"ANTIMERIDIAN_WRAP_REQUIRED">;
97
+ error: z.ZodString;
98
+ retryable: z.ZodLiteral<false>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ code: z.ZodLiteral<"AUTO_FIT_IMPOSSIBLE">;
101
+ details: z.ZodOptional<z.ZodObject<{
102
+ overlay: z.ZodOptional<z.ZodObject<{
103
+ id: z.ZodString;
104
+ index: z.ZodNumber;
105
+ type: z.ZodEnum<{
106
+ line: "line";
107
+ circle: "circle";
108
+ marker: "marker";
109
+ polygon: "polygon";
110
+ }>;
111
+ }, z.core.$strict>>;
112
+ padding: z.ZodOptional<z.ZodObject<{
113
+ bottom: z.ZodNumber;
114
+ left: z.ZodNumber;
115
+ right: z.ZodNumber;
116
+ top: z.ZodNumber;
117
+ }, z.core.$strict>>;
118
+ projection: z.ZodOptional<z.ZodEnum<{
119
+ globe: "globe";
120
+ mercator: "mercator";
121
+ }>>;
122
+ requiredInsets: z.ZodOptional<z.ZodObject<{
123
+ bottom: z.ZodNumber;
124
+ left: z.ZodNumber;
125
+ right: z.ZodNumber;
126
+ top: z.ZodNumber;
127
+ }, z.core.$strict>>;
128
+ ringIndex: z.ZodOptional<z.ZodNumber>;
129
+ segmentIndex: z.ZodOptional<z.ZodNumber>;
130
+ viewport: z.ZodOptional<z.ZodObject<{
131
+ height: z.ZodNumber;
132
+ width: z.ZodNumber;
133
+ }, z.core.$strict>>;
134
+ }, z.core.$strict>>;
135
+ reason: z.ZodEnum<{
136
+ GLOBE_NOT_SIMULTANEOUSLY_VISIBLE: "GLOBE_NOT_SIMULTANEOUSLY_VISIBLE";
137
+ INSUFFICIENT_VIEWPORT: "INSUFFICIENT_VIEWPORT";
138
+ CAMERA_UNRESOLVABLE: "CAMERA_UNRESOLVABLE";
139
+ PROJECTED_FOOTPRINT_OUTSIDE_VIEWPORT: "PROJECTED_FOOTPRINT_OUTSIDE_VIEWPORT";
140
+ }>;
141
+ error: z.ZodString;
142
+ retryable: z.ZodLiteral<false>;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ code: z.ZodLiteral<"STATIC_OVERLAY_INVALID">;
145
+ details: z.ZodObject<{
146
+ latitude: z.ZodNumber;
147
+ limit: z.ZodLiteral<85.051129>;
148
+ overlay: z.ZodObject<{
149
+ id: z.ZodString;
150
+ index: z.ZodNumber;
151
+ type: z.ZodEnum<{
152
+ line: "line";
153
+ circle: "circle";
154
+ marker: "marker";
155
+ polygon: "polygon";
156
+ }>;
157
+ }, z.core.$strict>;
158
+ }, z.core.$strict>;
159
+ reason: z.ZodLiteral<"OVERLAY_LATITUDE_OUT_OF_RANGE">;
160
+ error: z.ZodString;
161
+ retryable: z.ZodLiteral<false>;
162
+ }, z.core.$strict>], "code">;
163
+ type StaticMapRequestErrorResponse = z.infer<typeof staticMapRequestErrorResponseSchema>;
164
+ type StaticAutoFitErrorResponse = Extract<StaticMapRequestErrorResponse, {
165
+ code: `AUTO_FIT_${string}`;
166
+ }>;
167
+ declare class StaticMapRequestError extends Error {
168
+ readonly code: StaticMapRequestErrorResponse['code'];
169
+ readonly details?: StaticMapRequestErrorDetails;
170
+ readonly reason: StaticMapRequestErrorResponse['reason'];
171
+ readonly retryable = false;
172
+ readonly status: number;
173
+ constructor(response: StaticMapRequestErrorResponse, status?: number);
174
+ }
175
+ type StaticAutoFitFailure = StaticAutoFitErrorResponse & {
176
+ ok: false;
177
+ };
178
+ type StaticMapRequestFailure = StaticMapRequestErrorResponse & {
179
+ ok: false;
180
+ };
4
181
 
5
182
  declare function validateStaticScene(input: unknown): {
6
183
  ok: true;
@@ -8,7 +185,7 @@ declare function validateStaticScene(input: unknown): {
8
185
  } | {
9
186
  error: string;
10
187
  ok: false;
11
- };
188
+ } | StaticMapRequestFailure;
12
189
  declare function normalizeStaticScene(scene: StaticSceneInput): StaticScene;
13
190
 
14
- export { StaticScene, StaticSceneInput, normalizeStaticScene, validateStaticScene };
191
+ export { type StaticAutoFitErrorResponse, type StaticAutoFitFailure, StaticMapRequestError, type StaticMapRequestErrorResponse, type StaticMapRequestFailure, StaticScene, StaticSceneInput, normalizeStaticScene, staticMapRequestErrorResponseSchema, validateStaticScene };
package/dist/scene.js CHANGED
@@ -1,14 +1,20 @@
1
1
  import {
2
+ StaticMapRequestError,
2
3
  normalizeStaticScene,
4
+ staticMapRequestErrorResponseSchema,
3
5
  validateStaticScene
4
- } from "./chunk-ROBEGDDY.js";
6
+ } from "./chunk-NHQK5UZ2.js";
5
7
  import {
8
+ MAX_OVERLAY_LATITUDE,
6
9
  staticSceneLimits,
7
10
  staticSceneSchema,
8
11
  staticSceneSchemaVersion
9
- } from "./chunk-YUG3PBK2.js";
12
+ } from "./chunk-MGQCHCU3.js";
10
13
  export {
14
+ MAX_OVERLAY_LATITUDE,
15
+ StaticMapRequestError,
11
16
  normalizeStaticScene,
17
+ staticMapRequestErrorResponseSchema,
12
18
  staticSceneLimits,
13
19
  staticSceneSchema,
14
20
  staticSceneSchemaVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/static",
3
- "version": "0.1.0-alpha.20",
3
+ "version": "0.1.0-alpha.21",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Static map request schemas and helpers for Tileflow.",
6
6
  "type": "module",
@@ -1,63 +0,0 @@
1
- import {
2
- jsonByteLength,
3
- normalizeStaticCoordinate,
4
- normalizeStaticOverlay,
5
- roundNumber,
6
- staticSceneLimits,
7
- staticSceneSchema,
8
- stripUndefined
9
- } from "./chunk-YUG3PBK2.js";
10
-
11
- // src/scene.ts
12
- function validateStaticScene(input) {
13
- const parsed = staticSceneSchema.safeParse(input);
14
- if (!parsed.success) {
15
- return {
16
- error: parsed.error.issues.map((issue) => `${issue.path.join(".") || "scene"}: ${issue.message}`).join("; "),
17
- ok: false
18
- };
19
- }
20
- if (jsonByteLength(parsed.data.overlays) > staticSceneLimits.maxGeoJsonBytes) {
21
- return {
22
- error: `overlays exceed ${staticSceneLimits.maxGeoJsonBytes} bytes`,
23
- ok: false
24
- };
25
- }
26
- return { ok: true, scene: normalizeParsedStaticScene(parsed.data) };
27
- }
28
- function normalizeStaticScene(scene) {
29
- return normalizeParsedStaticScene(staticSceneSchema.parse(scene));
30
- }
31
- function normalizeParsedStaticScene(parsed) {
32
- return stripUndefined({
33
- camera: parsed.camera.type === "center" ? {
34
- bearing: roundNumber(parsed.camera.bearing ?? 0),
35
- center: normalizeStaticCoordinate(parsed.camera.center),
36
- type: "center",
37
- zoom: roundNumber(parsed.camera.zoom)
38
- } : {
39
- bearing: roundNumber(parsed.camera.bearing ?? 0),
40
- bounds: parsed.camera.bounds.map(roundNumber),
41
- padding: parsed.camera.padding ?? 32,
42
- type: "bounds"
43
- },
44
- map: parsed.map,
45
- overlays: parsed.overlays.map(
46
- (overlay, index) => normalizeStaticOverlay({
47
- ...overlay,
48
- id: overlay.id ?? `overlay-${index + 1}`
49
- })
50
- ),
51
- size: {
52
- dpr: parsed.size.dpr ?? 1,
53
- height: parsed.size.height,
54
- width: parsed.size.width
55
- },
56
- theme: parsed.theme
57
- });
58
- }
59
-
60
- export {
61
- validateStaticScene,
62
- normalizeStaticScene
63
- };