@tileflow/core 0.1.0-alpha.20 → 0.1.0-alpha.22
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/GENERATED_OUTPUT_LICENSE.md +21 -0
- package/LICENSE +201 -0
- package/NOTICE +9 -0
- package/README.md +1097 -145
- package/THIRD_PARTY_NOTICES.md +243 -0
- package/TRADEMARKS.md +10 -0
- package/dist/browser.d.ts +182 -13
- package/dist/browser.js +4207 -116
- package/dist/build.d.ts +158 -0
- package/dist/build.js +14836 -0
- package/dist/capture-scene-BK_0J2oR.d.ts +161 -0
- package/dist/capture.d.ts +9 -0
- package/dist/capture.js +206 -0
- package/dist/config-reference.json +31882 -0
- package/dist/index.d.ts +643 -182
- package/dist/index.js +15943 -4352
- package/dist/manifest-B5GKVMFE.d.ts +757 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.js +245 -0
- package/dist/map-BHL_0Mkx.d.ts +1145 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +1172 -0
- package/package.json +37 -5
- package/dist/runtime-DroKDIuB.d.ts +0 -1069
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const tileflowCaptureSceneSchemaVersion: 1;
|
|
4
|
+
declare const tileflowCaptureSceneLimits: Readonly<{
|
|
5
|
+
applicationPathLength: 2048;
|
|
6
|
+
boundsPadding: {
|
|
7
|
+
maximum: number;
|
|
8
|
+
minimum: number;
|
|
9
|
+
};
|
|
10
|
+
captureIdLength: 64;
|
|
11
|
+
maximumPhysicalPixels: 16777216;
|
|
12
|
+
pitch: {
|
|
13
|
+
maximum: number;
|
|
14
|
+
minimum: number;
|
|
15
|
+
};
|
|
16
|
+
selectorLength: 256;
|
|
17
|
+
viewport: {
|
|
18
|
+
maximum: number;
|
|
19
|
+
minimum: number;
|
|
20
|
+
};
|
|
21
|
+
zoom: {
|
|
22
|
+
maximum: number;
|
|
23
|
+
minimum: number;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
declare const tileflowCaptureCenterCameraSchema: z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"center">;
|
|
28
|
+
center: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
29
|
+
zoom: z.ZodNumber;
|
|
30
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
declare const tileflowCaptureBoundsCameraSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"bounds">;
|
|
35
|
+
bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
36
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
declare const tileflowCaptureCameraSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"center">;
|
|
42
|
+
center: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
43
|
+
zoom: z.ZodNumber;
|
|
44
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"bounds">;
|
|
48
|
+
bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
49
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
}, z.core.$strict>], "type">;
|
|
53
|
+
declare const tileflowCaptureViewportSchema: z.ZodObject<{
|
|
54
|
+
width: z.ZodNumber;
|
|
55
|
+
height: z.ZodNumber;
|
|
56
|
+
dpr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
declare const tileflowCaptureIdSchema: z.ZodString;
|
|
59
|
+
declare const tileflowCaptureSceneNameSchema: z.ZodString;
|
|
60
|
+
declare const tileflowCaptureMapTargetSchema: z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"map">;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
declare const tileflowCaptureApplicationTargetSchema: z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"application">;
|
|
65
|
+
path: z.ZodString;
|
|
66
|
+
captureId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
68
|
+
frame: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
map: "map";
|
|
70
|
+
viewport: "viewport";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
declare const tileflowCaptureTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"map">;
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"application">;
|
|
77
|
+
path: z.ZodString;
|
|
78
|
+
captureId: z.ZodOptional<z.ZodString>;
|
|
79
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
80
|
+
frame: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
map: "map";
|
|
82
|
+
viewport: "viewport";
|
|
83
|
+
}>>;
|
|
84
|
+
}, z.core.$strict>], "kind">;
|
|
85
|
+
declare const tileflowCaptureSceneSchema: z.ZodObject<{
|
|
86
|
+
map: z.ZodString;
|
|
87
|
+
theme: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
88
|
+
camera: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"center">;
|
|
90
|
+
center: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
91
|
+
zoom: z.ZodNumber;
|
|
92
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"bounds">;
|
|
96
|
+
bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
97
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
bearing: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
pitch: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
}, z.core.$strict>], "type">;
|
|
101
|
+
viewport: z.ZodObject<{
|
|
102
|
+
width: z.ZodNumber;
|
|
103
|
+
height: z.ZodNumber;
|
|
104
|
+
dpr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
107
|
+
kind: z.ZodLiteral<"map">;
|
|
108
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"application">;
|
|
110
|
+
path: z.ZodString;
|
|
111
|
+
captureId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
113
|
+
frame: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
map: "map";
|
|
115
|
+
viewport: "viewport";
|
|
116
|
+
}>>;
|
|
117
|
+
}, z.core.$strict>], "kind">>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
type TileflowCaptureCenterCamera = z.infer<typeof tileflowCaptureCenterCameraSchema>;
|
|
120
|
+
type TileflowCaptureBoundsCamera = z.infer<typeof tileflowCaptureBoundsCameraSchema>;
|
|
121
|
+
type TileflowCaptureCamera = z.infer<typeof tileflowCaptureCameraSchema>;
|
|
122
|
+
type TileflowCaptureViewport = z.infer<typeof tileflowCaptureViewportSchema>;
|
|
123
|
+
type TileflowCaptureMapTarget = z.infer<typeof tileflowCaptureMapTargetSchema>;
|
|
124
|
+
type TileflowCaptureApplicationTarget = z.infer<typeof tileflowCaptureApplicationTargetSchema>;
|
|
125
|
+
type TileflowCaptureTarget = z.infer<typeof tileflowCaptureTargetSchema>;
|
|
126
|
+
type TileflowCaptureScene = z.infer<typeof tileflowCaptureSceneSchema>;
|
|
127
|
+
type NormalizedTileflowCaptureScene = {
|
|
128
|
+
map: string;
|
|
129
|
+
theme: string;
|
|
130
|
+
camera: {
|
|
131
|
+
type: 'center';
|
|
132
|
+
center: [number, number];
|
|
133
|
+
zoom: number;
|
|
134
|
+
bearing: number;
|
|
135
|
+
pitch: number;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'bounds';
|
|
138
|
+
bounds: [number, number, number, number];
|
|
139
|
+
padding: number;
|
|
140
|
+
bearing: number;
|
|
141
|
+
pitch: number;
|
|
142
|
+
};
|
|
143
|
+
viewport: {
|
|
144
|
+
width: number;
|
|
145
|
+
height: number;
|
|
146
|
+
dpr: 1 | 2;
|
|
147
|
+
};
|
|
148
|
+
target: {
|
|
149
|
+
kind: 'map';
|
|
150
|
+
} | {
|
|
151
|
+
kind: 'application';
|
|
152
|
+
path: string;
|
|
153
|
+
captureId?: string;
|
|
154
|
+
selector?: string;
|
|
155
|
+
frame: 'map' | 'viewport';
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
declare function normalizeTileflowCaptureScene(input: TileflowCaptureScene): NormalizedTileflowCaptureScene;
|
|
159
|
+
declare function normalizeTileflowCaptureId(value: string | undefined): string | undefined;
|
|
160
|
+
|
|
161
|
+
export { type NormalizedTileflowCaptureScene as N, type TileflowCaptureScene as T, type TileflowCaptureApplicationTarget as a, type TileflowCaptureBoundsCamera as b, type TileflowCaptureCamera as c, type TileflowCaptureCenterCamera as d, type TileflowCaptureMapTarget as e, type TileflowCaptureTarget as f, type TileflowCaptureViewport as g, normalizeTileflowCaptureScene as h, tileflowCaptureBoundsCameraSchema as i, tileflowCaptureCameraSchema as j, tileflowCaptureCenterCameraSchema as k, tileflowCaptureIdSchema as l, tileflowCaptureMapTargetSchema as m, normalizeTileflowCaptureId as n, tileflowCaptureSceneLimits as o, tileflowCaptureSceneNameSchema as p, tileflowCaptureSceneSchema as q, tileflowCaptureSceneSchemaVersion as r, tileflowCaptureTargetSchema as s, tileflowCaptureApplicationTargetSchema as t, tileflowCaptureViewportSchema as u };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { N as NormalizedTileflowCaptureScene, a as TileflowCaptureApplicationTarget, b as TileflowCaptureBoundsCamera, c as TileflowCaptureCamera, d as TileflowCaptureCenterCamera, e as TileflowCaptureMapTarget, T as TileflowCaptureScene, f as TileflowCaptureTarget, g as TileflowCaptureViewport, n as normalizeTileflowCaptureId, h as normalizeTileflowCaptureScene, t as tileflowCaptureApplicationTargetSchema, i as tileflowCaptureBoundsCameraSchema, j as tileflowCaptureCameraSchema, k as tileflowCaptureCenterCameraSchema, l as tileflowCaptureIdSchema, m as tileflowCaptureMapTargetSchema, o as tileflowCaptureSceneLimits, p as tileflowCaptureSceneNameSchema, q as tileflowCaptureSceneSchema, r as tileflowCaptureSceneSchemaVersion, s as tileflowCaptureTargetSchema, u as tileflowCaptureViewportSchema } from './capture-scene-BK_0J2oR.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Canonical, filesystem-safe identity shared by authored and emitted Tileflow resources. */
|
|
5
|
+
declare const tileflowPortableIdSchema: z.ZodString;
|
|
6
|
+
/** A concrete compiled theme identity. `system` exists only as a browser-side selector. */
|
|
7
|
+
declare const tileflowThemeNameSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
8
|
+
|
|
9
|
+
export { tileflowPortableIdSchema, tileflowThemeNameSchema };
|
package/dist/capture.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// src/capture-scene.ts
|
|
2
|
+
import { z as z2 } from "zod";
|
|
3
|
+
|
|
4
|
+
// src/portable-identity.ts
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
// src/portable-identity-rules.ts
|
|
8
|
+
var tileflowPortableIdMaximumLength = 64;
|
|
9
|
+
var tileflowPortableIdPattern = /^[a-z][a-z0-9-]{0,63}$/u;
|
|
10
|
+
function isTileflowPortableId(value) {
|
|
11
|
+
return typeof value === "string" && value.length <= tileflowPortableIdMaximumLength && tileflowPortableIdPattern.test(value) && !["constructor", "prototype"].includes(value) && !/^(?:AUX|CON|NUL|PRN|COM[1-9]|LPT[1-9])$/i.test(value);
|
|
12
|
+
}
|
|
13
|
+
function isTileflowThemeName(value) {
|
|
14
|
+
return isTileflowPortableId(value) && value !== "system";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/portable-identity.ts
|
|
18
|
+
var tileflowPortableIdSchema = z.string().min(1).max(tileflowPortableIdMaximumLength).regex(tileflowPortableIdPattern, {
|
|
19
|
+
message: "Expected lowercase kebab-case beginning with a letter"
|
|
20
|
+
}).refine(
|
|
21
|
+
(name) => !["constructor", "prototype"].includes(name) && !/^(?:AUX|CON|NUL|PRN|COM[1-9]|LPT[1-9])$/i.test(name),
|
|
22
|
+
"Expected a portable identifier that is not a reserved filename or prototype key"
|
|
23
|
+
);
|
|
24
|
+
var tileflowThemeNameSchema = tileflowPortableIdSchema.refine(
|
|
25
|
+
isTileflowThemeName,
|
|
26
|
+
"Expected a concrete theme name; system is browser-only"
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// src/capture-scene.ts
|
|
30
|
+
var tileflowCaptureSceneSchemaVersion = 1;
|
|
31
|
+
var tileflowCaptureSceneLimits = Object.freeze({
|
|
32
|
+
applicationPathLength: 2048,
|
|
33
|
+
boundsPadding: { maximum: 1024, minimum: 0 },
|
|
34
|
+
captureIdLength: tileflowPortableIdMaximumLength,
|
|
35
|
+
maximumPhysicalPixels: 16777216,
|
|
36
|
+
pitch: { maximum: 85, minimum: 0 },
|
|
37
|
+
selectorLength: 256,
|
|
38
|
+
viewport: { maximum: 4096, minimum: 64 },
|
|
39
|
+
zoom: { maximum: 24, minimum: 0 }
|
|
40
|
+
});
|
|
41
|
+
var finiteLongitudeSchema = z2.number().finite().min(-180).max(180);
|
|
42
|
+
var finiteLatitudeSchema = z2.number().finite().min(-90).max(90);
|
|
43
|
+
var bearingSchema = z2.number().finite().min(-180).max(180).optional();
|
|
44
|
+
var pitchSchema = z2.number().finite().min(tileflowCaptureSceneLimits.pitch.minimum).max(tileflowCaptureSceneLimits.pitch.maximum).optional();
|
|
45
|
+
var tileflowCaptureCenterCameraSchema = z2.object({
|
|
46
|
+
type: z2.literal("center"),
|
|
47
|
+
center: z2.tuple([finiteLongitudeSchema, finiteLatitudeSchema]),
|
|
48
|
+
zoom: z2.number().finite().min(tileflowCaptureSceneLimits.zoom.minimum).max(tileflowCaptureSceneLimits.zoom.maximum),
|
|
49
|
+
bearing: bearingSchema,
|
|
50
|
+
pitch: pitchSchema
|
|
51
|
+
}).strict();
|
|
52
|
+
var tileflowCaptureBoundsCameraSchema = z2.object({
|
|
53
|
+
type: z2.literal("bounds"),
|
|
54
|
+
bounds: z2.tuple([
|
|
55
|
+
finiteLongitudeSchema,
|
|
56
|
+
finiteLatitudeSchema,
|
|
57
|
+
finiteLongitudeSchema,
|
|
58
|
+
finiteLatitudeSchema
|
|
59
|
+
]),
|
|
60
|
+
padding: z2.number().finite().min(tileflowCaptureSceneLimits.boundsPadding.minimum).max(tileflowCaptureSceneLimits.boundsPadding.maximum).optional(),
|
|
61
|
+
bearing: bearingSchema,
|
|
62
|
+
pitch: pitchSchema
|
|
63
|
+
}).strict().superRefine((camera, context) => {
|
|
64
|
+
const [west, south, east, north] = camera.bounds;
|
|
65
|
+
if (south >= north) {
|
|
66
|
+
context.addIssue({
|
|
67
|
+
code: "custom",
|
|
68
|
+
message: "Expected south latitude to be less than north latitude",
|
|
69
|
+
path: ["bounds"]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (west === east) {
|
|
73
|
+
context.addIssue({
|
|
74
|
+
code: "custom",
|
|
75
|
+
message: "Expected west and east longitude to define a non-empty span",
|
|
76
|
+
path: ["bounds"]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var tileflowCaptureCameraSchema = z2.discriminatedUnion("type", [
|
|
81
|
+
tileflowCaptureCenterCameraSchema,
|
|
82
|
+
tileflowCaptureBoundsCameraSchema
|
|
83
|
+
]);
|
|
84
|
+
var tileflowCaptureViewportSchema = z2.object({
|
|
85
|
+
width: z2.number().int().min(tileflowCaptureSceneLimits.viewport.minimum).max(tileflowCaptureSceneLimits.viewport.maximum),
|
|
86
|
+
height: z2.number().int().min(tileflowCaptureSceneLimits.viewport.minimum).max(tileflowCaptureSceneLimits.viewport.maximum),
|
|
87
|
+
dpr: z2.union([z2.literal(1), z2.literal(2)]).optional()
|
|
88
|
+
}).strict().superRefine((viewport, context) => {
|
|
89
|
+
const dpr = viewport.dpr ?? 1;
|
|
90
|
+
const physicalWidth = viewport.width * dpr;
|
|
91
|
+
const physicalHeight = viewport.height * dpr;
|
|
92
|
+
const physicalPixels = viewport.width * viewport.height * dpr * dpr;
|
|
93
|
+
if (physicalWidth > tileflowCaptureSceneLimits.viewport.maximum || physicalHeight > tileflowCaptureSceneLimits.viewport.maximum || physicalPixels > tileflowCaptureSceneLimits.maximumPhysicalPixels) {
|
|
94
|
+
context.addIssue({
|
|
95
|
+
code: "custom",
|
|
96
|
+
message: `Expected physical width and height at most ${tileflowCaptureSceneLimits.viewport.maximum} pixels`,
|
|
97
|
+
path: ["dpr"]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
var tileflowCaptureIdSchema = z2.string().min(1).max(tileflowCaptureSceneLimits.captureIdLength).regex(/^[A-Za-z0-9_-]+$/, {
|
|
102
|
+
message: "Expected letters, numbers, underscores, or hyphens"
|
|
103
|
+
}).refine((name) => name !== "__proto__", {
|
|
104
|
+
message: "Expected an identifier that cannot mutate an object prototype"
|
|
105
|
+
});
|
|
106
|
+
var tileflowCaptureSceneNameSchema = tileflowPortableIdSchema;
|
|
107
|
+
var applicationPathSchema = z2.string().min(1).max(tileflowCaptureSceneLimits.applicationPathLength).refine(isPortableApplicationPath, {
|
|
108
|
+
message: "Expected a root-relative application path without an origin, credentials, fragment, backslash, or control character"
|
|
109
|
+
});
|
|
110
|
+
var tileflowCaptureMapTargetSchema = z2.object({ kind: z2.literal("map") }).strict();
|
|
111
|
+
var tileflowCaptureApplicationTargetSchema = z2.object({
|
|
112
|
+
kind: z2.literal("application"),
|
|
113
|
+
path: applicationPathSchema,
|
|
114
|
+
captureId: tileflowCaptureIdSchema.optional(),
|
|
115
|
+
selector: z2.string().trim().min(1).max(tileflowCaptureSceneLimits.selectorLength).optional(),
|
|
116
|
+
frame: z2.enum(["map", "viewport"]).optional()
|
|
117
|
+
}).strict().superRefine((target, context) => {
|
|
118
|
+
if (target.captureId && target.selector) {
|
|
119
|
+
context.addIssue({
|
|
120
|
+
code: "custom",
|
|
121
|
+
message: "Expected either captureId or selector, not both",
|
|
122
|
+
path: ["selector"]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var tileflowCaptureTargetSchema = z2.discriminatedUnion("kind", [
|
|
127
|
+
tileflowCaptureMapTargetSchema,
|
|
128
|
+
tileflowCaptureApplicationTargetSchema
|
|
129
|
+
]);
|
|
130
|
+
var tileflowCaptureSceneSchema = z2.object({
|
|
131
|
+
map: tileflowPortableIdSchema,
|
|
132
|
+
theme: tileflowThemeNameSchema,
|
|
133
|
+
camera: tileflowCaptureCameraSchema,
|
|
134
|
+
viewport: tileflowCaptureViewportSchema,
|
|
135
|
+
target: tileflowCaptureTargetSchema.optional()
|
|
136
|
+
}).strict();
|
|
137
|
+
function normalizeTileflowCaptureScene(input) {
|
|
138
|
+
const scene = tileflowCaptureSceneSchema.parse(input);
|
|
139
|
+
const camera = scene.camera.type === "center" ? {
|
|
140
|
+
type: scene.camera.type,
|
|
141
|
+
center: scene.camera.center,
|
|
142
|
+
zoom: scene.camera.zoom,
|
|
143
|
+
bearing: scene.camera.bearing ?? 0,
|
|
144
|
+
pitch: scene.camera.pitch ?? 0
|
|
145
|
+
} : {
|
|
146
|
+
type: scene.camera.type,
|
|
147
|
+
bounds: scene.camera.bounds,
|
|
148
|
+
padding: scene.camera.padding ?? 0,
|
|
149
|
+
bearing: scene.camera.bearing ?? 0,
|
|
150
|
+
pitch: scene.camera.pitch ?? 0
|
|
151
|
+
};
|
|
152
|
+
const target = scene.target ?? { kind: "map" };
|
|
153
|
+
return {
|
|
154
|
+
map: scene.map,
|
|
155
|
+
theme: scene.theme,
|
|
156
|
+
camera,
|
|
157
|
+
viewport: { ...scene.viewport, dpr: scene.viewport.dpr ?? 1 },
|
|
158
|
+
target: target.kind === "map" ? target : {
|
|
159
|
+
kind: target.kind,
|
|
160
|
+
path: target.path,
|
|
161
|
+
...target.captureId ? { captureId: target.captureId } : {},
|
|
162
|
+
...target.selector ? { selector: target.selector } : {},
|
|
163
|
+
frame: target.frame ?? "map"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function normalizeTileflowCaptureId(value) {
|
|
168
|
+
return value === void 0 ? void 0 : tileflowCaptureIdSchema.parse(value);
|
|
169
|
+
}
|
|
170
|
+
function isPortableApplicationPath(value) {
|
|
171
|
+
if (value !== value.trim() || !value.startsWith("/") || value.startsWith("//") || value.includes("#") || value.includes("\\") || hasControlCharacter(value)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const base = new URL("http://tileflow.local");
|
|
176
|
+
const resolved = new URL(value, base);
|
|
177
|
+
return resolved.origin === base.origin && resolved.username === "" && resolved.password === "" && resolved.pathname.startsWith("/");
|
|
178
|
+
} catch {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function hasControlCharacter(value) {
|
|
183
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
184
|
+
const code = value.charCodeAt(index);
|
|
185
|
+
if (code <= 31 || code === 127) return true;
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
export {
|
|
190
|
+
normalizeTileflowCaptureId,
|
|
191
|
+
normalizeTileflowCaptureScene,
|
|
192
|
+
tileflowCaptureApplicationTargetSchema,
|
|
193
|
+
tileflowCaptureBoundsCameraSchema,
|
|
194
|
+
tileflowCaptureCameraSchema,
|
|
195
|
+
tileflowCaptureCenterCameraSchema,
|
|
196
|
+
tileflowCaptureIdSchema,
|
|
197
|
+
tileflowCaptureMapTargetSchema,
|
|
198
|
+
tileflowCaptureSceneLimits,
|
|
199
|
+
tileflowCaptureSceneNameSchema,
|
|
200
|
+
tileflowCaptureSceneSchema,
|
|
201
|
+
tileflowCaptureSceneSchemaVersion,
|
|
202
|
+
tileflowCaptureTargetSchema,
|
|
203
|
+
tileflowCaptureViewportSchema,
|
|
204
|
+
tileflowPortableIdSchema,
|
|
205
|
+
tileflowThemeNameSchema
|
|
206
|
+
};
|