@tileflow/core 0.1.0-alpha.3 → 0.1.0-alpha.31
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/LICENSE +201 -0
- package/README.md +273 -26
- package/THIRD_PARTY_NOTICES.md +327 -0
- package/dist/browser.d.ts +962 -0
- package/dist/browser.js +6237 -0
- package/dist/build.d.ts +574 -0
- package/dist/build.js +25423 -0
- package/dist/capture-scene-D6soWztE.d.ts +161 -0
- package/dist/capture.d.ts +9 -0
- package/dist/capture.js +276 -0
- package/dist/config-reference.json +32261 -0
- package/dist/icon-composition-BiOTwrvD.d.ts +1331 -0
- package/dist/index.d.ts +1114 -162
- package/dist/index.js +18714 -3479
- package/dist/manifest-types-CTT2eLbp.d.ts +790 -0
- package/dist/manifest.d.ts +9 -0
- package/dist/manifest.js +368 -0
- package/dist/native-profile.d.ts +188 -0
- package/dist/native-profile.js +9316 -0
- package/dist/native.d.ts +355 -0
- package/dist/native.js +5552 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1317 -0
- package/docs/authoring-model.md +241 -0
- package/docs/capture-scenes.md +36 -0
- package/docs/compiled-style-performance.md +263 -0
- package/docs/data-is-separate-from-design.md +345 -0
- package/docs/globe-atmosphere.md +83 -0
- package/docs/hosted-session-authorization.md +108 -0
- package/docs/map-and-terrain-examples.md +149 -0
- package/docs/map-emphasis.md +89 -0
- package/docs/native-artifact-profile.md +145 -0
- package/docs/native-resource-urls.md +367 -0
- package/docs/public-api-and-browser-subpath.md +93 -0
- package/docs/shared-visual-primitives.md +81 -0
- package/docs/theme-transitions-and-blends.md +221 -0
- package/docs/themes-and-module-styles.md +83 -0
- package/package.json +58 -8
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { T as TileflowRuntimeManifest } from './manifest-types-CTT2eLbp.js';
|
|
3
|
+
export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, t as tileflowRuntimeManifestLimits, e as tileflowRuntimeManifestVersion } from './manifest-types-CTT2eLbp.js';
|
|
4
|
+
|
|
5
|
+
declare const tileflowRuntimeManifestSchema: z.ZodType<TileflowRuntimeManifest>;
|
|
6
|
+
declare function parseTileflowRuntimeManifest(input: unknown): TileflowRuntimeManifest;
|
|
7
|
+
declare function safeParseTileflowRuntimeManifest(input: unknown): z.ZodSafeParseResult<TileflowRuntimeManifest>;
|
|
8
|
+
|
|
9
|
+
export { TileflowRuntimeManifest, parseTileflowRuntimeManifest, safeParseTileflowRuntimeManifest, tileflowRuntimeManifestSchema };
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
// src/manifest-types.ts
|
|
2
|
+
var tileflowRuntimeManifestVersion = 1;
|
|
3
|
+
var tileflowRuntimeManifestLimits = Object.freeze({ maximumBytes: 1024 * 1024 });
|
|
4
|
+
|
|
5
|
+
// src/portable-identity-rules.ts
|
|
6
|
+
var tileflowPortableIdMaximumLength = 64;
|
|
7
|
+
var tileflowPortableIdPattern = /^[a-z][a-z0-9-]{0,63}$/u;
|
|
8
|
+
function isTileflowPortableId(value) {
|
|
9
|
+
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);
|
|
10
|
+
}
|
|
11
|
+
function isTileflowThemeName(value) {
|
|
12
|
+
return isTileflowPortableId(value) && value !== "system";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/portable-identity-schema.ts
|
|
16
|
+
function createPortableIdentitySchemas(operations) {
|
|
17
|
+
const bounded = operations.maxLength(
|
|
18
|
+
operations.minLength(operations.string(), 1),
|
|
19
|
+
tileflowPortableIdMaximumLength
|
|
20
|
+
);
|
|
21
|
+
const pattern = operations.regex(
|
|
22
|
+
bounded,
|
|
23
|
+
tileflowPortableIdPattern,
|
|
24
|
+
"Expected lowercase kebab-case beginning with a letter"
|
|
25
|
+
);
|
|
26
|
+
const tileflowPortableIdSchema2 = operations.refine(
|
|
27
|
+
pattern,
|
|
28
|
+
(name) => !["constructor", "prototype"].includes(name) && !/^(?:AUX|CON|NUL|PRN|COM[1-9]|LPT[1-9])$/i.test(name),
|
|
29
|
+
"Expected a portable identifier that is not a reserved filename or prototype key"
|
|
30
|
+
);
|
|
31
|
+
const tileflowThemeNameSchema2 = operations.refine(
|
|
32
|
+
tileflowPortableIdSchema2,
|
|
33
|
+
isTileflowThemeName,
|
|
34
|
+
"Expected a concrete theme name; system is browser-only"
|
|
35
|
+
);
|
|
36
|
+
return { tileflowPortableIdSchema: tileflowPortableIdSchema2, tileflowThemeNameSchema: tileflowThemeNameSchema2 };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/runtime-view-schema.ts
|
|
40
|
+
function createTileflowRuntimeViewSchema(operations) {
|
|
41
|
+
return operations.object({
|
|
42
|
+
bearing: operations.optional(operations.number(-180, 180)),
|
|
43
|
+
center: operations.optional(
|
|
44
|
+
operations.tuplePair(operations.number(-180, 180), operations.number(-90, 90))
|
|
45
|
+
),
|
|
46
|
+
pitch: operations.optional(operations.number(0, 85)),
|
|
47
|
+
zoom: operations.optional(operations.number(0, 24))
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/themes/model.ts
|
|
52
|
+
var tileflowThemeLimits = Object.freeze({ maxThemes: 64 });
|
|
53
|
+
var themeTypographyStyleKeys = ["fallbacks", "font", "letterSpacing", "transform"];
|
|
54
|
+
var themeTypographyKeys = [
|
|
55
|
+
...themeTypographyStyleKeys,
|
|
56
|
+
"places",
|
|
57
|
+
"poi",
|
|
58
|
+
"roads",
|
|
59
|
+
"water"
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
// src/manifest-schema.ts
|
|
63
|
+
function createTileflowRuntimeManifestSchema(primitives, operations, identities = createPortableIdentitySchemas(operations)) {
|
|
64
|
+
const { tileflowPortableIdSchema: tileflowPortableIdSchema2, tileflowThemeNameSchema: tileflowThemeNameSchema2 } = identities;
|
|
65
|
+
const safeTextSchema = operations.refine(
|
|
66
|
+
operations.refine(
|
|
67
|
+
operations.maxLength(operations.minLength(operations.string(), 1), 2048),
|
|
68
|
+
(value) => value === value.trim(),
|
|
69
|
+
"Expected text without surrounding whitespace"
|
|
70
|
+
),
|
|
71
|
+
(value) => !/[\p{Cc}\\]/u.test(value),
|
|
72
|
+
"Expected safe text"
|
|
73
|
+
);
|
|
74
|
+
const publicResourceUrlSchema = operations.refine(
|
|
75
|
+
safeTextSchema,
|
|
76
|
+
isPublicResourceUrl,
|
|
77
|
+
"Expected an HTTP(S), root-relative, or path-relative public URL"
|
|
78
|
+
);
|
|
79
|
+
const apiOriginSchema = operations.refine(
|
|
80
|
+
safeTextSchema,
|
|
81
|
+
isApiOrigin,
|
|
82
|
+
"Expected an absolute HTTP(S) origin without path, credentials, query, or fragment"
|
|
83
|
+
);
|
|
84
|
+
const viewSchema = createTileflowRuntimeViewSchema(operations);
|
|
85
|
+
const fontFaceSchema = operations.object({
|
|
86
|
+
family: operations.maxLength(safeTextSchema, 100),
|
|
87
|
+
source: publicResourceUrlSchema,
|
|
88
|
+
style: operations.optional(operations.enum(["italic", "normal", "oblique"])),
|
|
89
|
+
weight: operations.optional(
|
|
90
|
+
operations.enum(["100", "200", "300", "400", "500", "600", "700", "800", "900"])
|
|
91
|
+
)
|
|
92
|
+
});
|
|
93
|
+
const fontFacesSchema = operations.superRefine(
|
|
94
|
+
operations.maxLength(operations.array(fontFaceSchema), 16),
|
|
95
|
+
validateUniqueFontFaces
|
|
96
|
+
);
|
|
97
|
+
const manifestThemeSchema = operations.object({
|
|
98
|
+
colorScheme: operations.enum(["dark", "light"]),
|
|
99
|
+
fontFaces: operations.optional(fontFacesSchema),
|
|
100
|
+
revision: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
101
|
+
styleId: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
102
|
+
styleUrl: publicResourceUrlSchema
|
|
103
|
+
});
|
|
104
|
+
const manifestMapSchema = operations.superRefine(
|
|
105
|
+
operations.object({
|
|
106
|
+
apiUrl: operations.optional(apiOriginSchema),
|
|
107
|
+
defaultTheme: tileflowThemeNameSchema2,
|
|
108
|
+
environment: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
109
|
+
mapId: operations.optional(operations.maxLength(safeTextSchema, 128)),
|
|
110
|
+
systemThemes: operations.optional(
|
|
111
|
+
operations.object({
|
|
112
|
+
dark: tileflowThemeNameSchema2,
|
|
113
|
+
light: tileflowThemeNameSchema2
|
|
114
|
+
})
|
|
115
|
+
),
|
|
116
|
+
themes: operations.record(tileflowThemeNameSchema2, manifestThemeSchema),
|
|
117
|
+
usageMode: operations.optional(operations.literal("session")),
|
|
118
|
+
view: operations.optional(viewSchema),
|
|
119
|
+
worldGeneration: operations.optional(operations.literal("v1"))
|
|
120
|
+
}),
|
|
121
|
+
(entry, context) => {
|
|
122
|
+
const names = Object.keys(entry.themes);
|
|
123
|
+
if (names.length === 0) {
|
|
124
|
+
context.addIssue({
|
|
125
|
+
code: "custom",
|
|
126
|
+
message: "Expected at least one theme",
|
|
127
|
+
path: ["themes"]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (names.length > tileflowThemeLimits.maxThemes) {
|
|
131
|
+
context.addIssue({
|
|
132
|
+
code: "too_big",
|
|
133
|
+
maximum: tileflowThemeLimits.maxThemes,
|
|
134
|
+
origin: "object",
|
|
135
|
+
path: ["themes"]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (!Object.hasOwn(entry.themes, entry.defaultTheme)) {
|
|
139
|
+
context.addIssue({
|
|
140
|
+
code: "custom",
|
|
141
|
+
message: "defaultTheme must name a declared theme",
|
|
142
|
+
path: ["defaultTheme"]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (entry.systemThemes) {
|
|
146
|
+
for (const colorScheme of ["light", "dark"]) {
|
|
147
|
+
const name = entry.systemThemes[colorScheme];
|
|
148
|
+
const theme = entry.themes[name];
|
|
149
|
+
if (!theme) {
|
|
150
|
+
context.addIssue({
|
|
151
|
+
code: "custom",
|
|
152
|
+
message: `systemThemes.${colorScheme} must name a declared theme`,
|
|
153
|
+
path: ["systemThemes", colorScheme]
|
|
154
|
+
});
|
|
155
|
+
} else if (theme.colorScheme !== colorScheme) {
|
|
156
|
+
context.addIssue({
|
|
157
|
+
code: "custom",
|
|
158
|
+
message: `systemThemes.${colorScheme} must reference a ${colorScheme} theme`,
|
|
159
|
+
path: ["systemThemes", colorScheme]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (entry.usageMode === void 0 !== (entry.worldGeneration === void 0)) {
|
|
165
|
+
context.addIssue({
|
|
166
|
+
code: "custom",
|
|
167
|
+
message: "usageMode and worldGeneration must be declared together"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
const canonicalManifestSchema = operations.superRefine(
|
|
173
|
+
operations.object({
|
|
174
|
+
apiUrl: operations.optional(apiOriginSchema),
|
|
175
|
+
maps: operations.record(tileflowPortableIdSchema2, manifestMapSchema),
|
|
176
|
+
version: operations.literal(tileflowRuntimeManifestVersion)
|
|
177
|
+
}),
|
|
178
|
+
(manifest, context) => {
|
|
179
|
+
const mapCount = Object.keys(manifest.maps).length;
|
|
180
|
+
if (mapCount === 0) {
|
|
181
|
+
context.addIssue({ code: "custom", message: "Expected at least one map", path: ["maps"] });
|
|
182
|
+
}
|
|
183
|
+
if (mapCount > 1e3) {
|
|
184
|
+
context.addIssue({ code: "too_big", maximum: 1e3, origin: "object", path: ["maps"] });
|
|
185
|
+
}
|
|
186
|
+
if (primitives.utf8ByteLength(JSON.stringify(manifest)) > tileflowRuntimeManifestLimits.maximumBytes) {
|
|
187
|
+
context.addIssue({
|
|
188
|
+
code: "too_big",
|
|
189
|
+
maximum: tileflowRuntimeManifestLimits.maximumBytes,
|
|
190
|
+
origin: "string",
|
|
191
|
+
message: "Manifest JSON exceeds the 1 MiB limit"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
const safeManifestInputSchema = operations.superRefine(operations.unknown(), (input, context) => {
|
|
197
|
+
const unsafe = findUnsafeManifestStructure(input);
|
|
198
|
+
if (unsafe) {
|
|
199
|
+
context.addIssue({
|
|
200
|
+
code: "custom",
|
|
201
|
+
message: unsafe.reason === "prototype" ? "Expected plain manifest objects" : "Expected no prototype-mutating keys",
|
|
202
|
+
path: unsafe.path
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
function validateUniqueFontFaces(fontFaces, context) {
|
|
207
|
+
const seen = /* @__PURE__ */ new Map();
|
|
208
|
+
for (const [index, fontFace] of fontFaces.entries()) {
|
|
209
|
+
const identity = `${fontFace.family}\0${fontFace.style ?? "normal"}\0${fontFace.weight ?? "400"}`;
|
|
210
|
+
const first = seen.get(identity);
|
|
211
|
+
if (first !== void 0) {
|
|
212
|
+
context.addIssue({
|
|
213
|
+
code: "custom",
|
|
214
|
+
message: `Duplicate font face identity; first declared at index ${first}`,
|
|
215
|
+
path: [index]
|
|
216
|
+
});
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
seen.set(identity, index);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function isPublicResourceUrl(value) {
|
|
223
|
+
if (value.startsWith("//")) return false;
|
|
224
|
+
if (!value.startsWith("/") && !value.startsWith("./") && !value.startsWith("../") && !isAbsolutePublicUrl(value)) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
return isSafeResolvedPublicUrl(value);
|
|
228
|
+
}
|
|
229
|
+
function isAbsolutePublicUrl(value) {
|
|
230
|
+
try {
|
|
231
|
+
const url = primitives.parseUrl(value);
|
|
232
|
+
return (url.protocol === "http:" || url.protocol === "https:") && !url.username && !url.password && !url.hash && !hasEncodedPathSeparator(value);
|
|
233
|
+
} catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function isSafeResolvedPublicUrl(value) {
|
|
238
|
+
try {
|
|
239
|
+
const url = primitives.parseUrl(value, "https://manifest.invalid/owner/manifest.json");
|
|
240
|
+
return (url.protocol === "http:" || url.protocol === "https:") && !url.username && !url.password && !url.hash && !hasEncodedPathSeparator(value);
|
|
241
|
+
} catch {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function hasEncodedPathSeparator(value) {
|
|
246
|
+
return /%(?:2f|5c)/iu.test(value);
|
|
247
|
+
}
|
|
248
|
+
function isApiOrigin(value) {
|
|
249
|
+
try {
|
|
250
|
+
const url = primitives.parseUrl(value);
|
|
251
|
+
return isAbsolutePublicUrl(value) && url.pathname === "/" && !url.search && value.replace(/\/$/u, "") === url.origin;
|
|
252
|
+
} catch {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function findUnsafeManifestStructure(input) {
|
|
257
|
+
if (!input || typeof input !== "object") return void 0;
|
|
258
|
+
const pending = [
|
|
259
|
+
{ path: [], value: input }
|
|
260
|
+
];
|
|
261
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
262
|
+
while (pending.length > 0) {
|
|
263
|
+
const current = pending.pop();
|
|
264
|
+
if (visited.has(current.value)) continue;
|
|
265
|
+
visited.add(current.value);
|
|
266
|
+
if (!Array.isArray(current.value)) {
|
|
267
|
+
const prototype = Object.getPrototypeOf(current.value);
|
|
268
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
269
|
+
return { path: current.path, reason: "prototype" };
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
for (const key of Object.keys(current.value)) {
|
|
273
|
+
const path = [...current.path, Array.isArray(current.value) ? Number(key) : key];
|
|
274
|
+
if (key === "__proto__") return { path, reason: "key" };
|
|
275
|
+
const descriptor = Object.getOwnPropertyDescriptor(current.value, key);
|
|
276
|
+
if (descriptor && "value" in descriptor && descriptor.value && typeof descriptor.value === "object") {
|
|
277
|
+
pending.push({ path, value: descriptor.value });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return void 0;
|
|
282
|
+
}
|
|
283
|
+
return operations.pipe(safeManifestInputSchema, canonicalManifestSchema);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// src/manifest-schema-classic.ts
|
|
287
|
+
import { z as z2 } from "zod";
|
|
288
|
+
|
|
289
|
+
// src/native-zod-object.ts
|
|
290
|
+
import { z } from "zod";
|
|
291
|
+
function strictNativeObject(shape) {
|
|
292
|
+
const object = new z.core.$ZodObject({
|
|
293
|
+
type: "object",
|
|
294
|
+
shape,
|
|
295
|
+
catchall: z.never()
|
|
296
|
+
});
|
|
297
|
+
return z.lazy(() => object);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/manifest-schema-classic.ts
|
|
301
|
+
function classic(schema) {
|
|
302
|
+
return schema;
|
|
303
|
+
}
|
|
304
|
+
var classicManifestStringOperations = {
|
|
305
|
+
string: () => z2.string(),
|
|
306
|
+
minLength(schema, minimum) {
|
|
307
|
+
return schema.min(
|
|
308
|
+
minimum
|
|
309
|
+
);
|
|
310
|
+
},
|
|
311
|
+
maxLength(schema, maximum) {
|
|
312
|
+
return schema.max(
|
|
313
|
+
maximum
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
regex: (schema, pattern, message) => schema.regex(pattern, { message }),
|
|
317
|
+
refine: (schema, check, message) => classic(schema).refine(check, message)
|
|
318
|
+
};
|
|
319
|
+
var classicManifestSchemaOperations = {
|
|
320
|
+
...classicManifestStringOperations,
|
|
321
|
+
number: (minimum, maximum) => z2.number().finite().min(minimum).max(maximum),
|
|
322
|
+
unknown: () => z2.unknown(),
|
|
323
|
+
optional: (schema) => classic(schema).optional(),
|
|
324
|
+
array: (schema) => z2.array(classic(schema)),
|
|
325
|
+
enum(values) {
|
|
326
|
+
return z2.enum(values);
|
|
327
|
+
},
|
|
328
|
+
literal: (value) => z2.literal(value),
|
|
329
|
+
tuplePair(left, right) {
|
|
330
|
+
return z2.tuple([classic(left), classic(right)]);
|
|
331
|
+
},
|
|
332
|
+
object(shape) {
|
|
333
|
+
return strictNativeObject(shape);
|
|
334
|
+
},
|
|
335
|
+
record(key, value) {
|
|
336
|
+
return z2.record(classic(key), classic(value));
|
|
337
|
+
},
|
|
338
|
+
superRefine: (schema, check) => classic(schema).superRefine(check),
|
|
339
|
+
pipe: (input, output) => classic(input).pipe(classic(output))
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// src/portable-identity.ts
|
|
343
|
+
var schemas = createPortableIdentitySchemas(classicManifestStringOperations);
|
|
344
|
+
var tileflowPortableIdSchema = schemas.tileflowPortableIdSchema;
|
|
345
|
+
var tileflowThemeNameSchema = schemas.tileflowThemeNameSchema;
|
|
346
|
+
|
|
347
|
+
// src/manifest.ts
|
|
348
|
+
var tileflowRuntimeManifestSchema = createTileflowRuntimeManifestSchema(
|
|
349
|
+
{
|
|
350
|
+
parseUrl: (value, base) => base === void 0 ? new URL(value) : new URL(value, base),
|
|
351
|
+
utf8ByteLength: (value) => new TextEncoder().encode(value).byteLength
|
|
352
|
+
},
|
|
353
|
+
classicManifestSchemaOperations,
|
|
354
|
+
{ tileflowPortableIdSchema, tileflowThemeNameSchema }
|
|
355
|
+
);
|
|
356
|
+
function parseTileflowRuntimeManifest(input) {
|
|
357
|
+
return tileflowRuntimeManifestSchema.parse(input);
|
|
358
|
+
}
|
|
359
|
+
function safeParseTileflowRuntimeManifest(input) {
|
|
360
|
+
return tileflowRuntimeManifestSchema.safeParse(input);
|
|
361
|
+
}
|
|
362
|
+
export {
|
|
363
|
+
parseTileflowRuntimeManifest,
|
|
364
|
+
safeParseTileflowRuntimeManifest,
|
|
365
|
+
tileflowRuntimeManifestLimits,
|
|
366
|
+
tileflowRuntimeManifestSchema,
|
|
367
|
+
tileflowRuntimeManifestVersion
|
|
368
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Static preparation profile, not evidence that an application ran on a device. */
|
|
4
|
+
declare const tileflowNativeProfileSchema: z.ZodLazy<z.core.$ZodObject<{
|
|
5
|
+
id: z.ZodLiteral<"native-v1">;
|
|
6
|
+
renderer: z.ZodLiteral<"native">;
|
|
7
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
8
|
+
styleVersion: z.ZodLiteral<8>;
|
|
9
|
+
validatorStyleSpec: z.ZodLiteral<"24.8.5">;
|
|
10
|
+
reactNativeStyleSpec: z.ZodLiteral<"26.2.1">;
|
|
11
|
+
maplibreReactNative: z.ZodLiteral<"11.3.10">;
|
|
12
|
+
android: z.ZodLiteral<"13.2.0">;
|
|
13
|
+
ios: z.ZodLiteral<"6.26.0">;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
type TileflowNativeProfile = z.infer<typeof tileflowNativeProfileSchema>;
|
|
16
|
+
declare const tileflowNativeProfile: Readonly<TileflowNativeProfile>;
|
|
17
|
+
declare const tileflowNativeProfileIdSchema: z.ZodLiteral<"native-v1">;
|
|
18
|
+
declare const tileflowRendererSchema: z.ZodEnum<{
|
|
19
|
+
native: "native";
|
|
20
|
+
web: "web";
|
|
21
|
+
}>;
|
|
22
|
+
type TileflowRenderer = z.infer<typeof tileflowRendererSchema>;
|
|
23
|
+
|
|
24
|
+
type TileflowColor = `#${string}`;
|
|
25
|
+
type MapLibreSprite = string | Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
url: string;
|
|
28
|
+
}>;
|
|
29
|
+
type TileflowProjection = 'globe' | 'mercator';
|
|
30
|
+
type TileflowLight = {
|
|
31
|
+
anchor?: 'map' | 'viewport';
|
|
32
|
+
color?: TileflowColor;
|
|
33
|
+
intensity?: number;
|
|
34
|
+
position?: readonly [number, number, number];
|
|
35
|
+
};
|
|
36
|
+
type MapLibreStyle = {
|
|
37
|
+
sky?: Record<string, unknown>;
|
|
38
|
+
version: 8;
|
|
39
|
+
name: string;
|
|
40
|
+
glyphs?: string;
|
|
41
|
+
light?: TileflowLight;
|
|
42
|
+
projection?: {
|
|
43
|
+
type: TileflowProjection;
|
|
44
|
+
};
|
|
45
|
+
sprite?: MapLibreSprite;
|
|
46
|
+
sources: Record<string, Record<string, unknown>>;
|
|
47
|
+
layers: Array<Record<string, unknown>>;
|
|
48
|
+
terrain?: Record<string, unknown>;
|
|
49
|
+
metadata?: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Resource budgets apply to validation work, not downloaded resources or native GPU memory. */
|
|
53
|
+
declare const tileflowNativeProfileLimits: Readonly<{
|
|
54
|
+
maximumStyleBytes: number;
|
|
55
|
+
maximumDepth: 64;
|
|
56
|
+
maximumNodes: 160000;
|
|
57
|
+
maximumSources: 128;
|
|
58
|
+
maximumLayers: 4096;
|
|
59
|
+
maximumIssues: 32;
|
|
60
|
+
maximumFontFaces: 16;
|
|
61
|
+
maximumFontBytes: number;
|
|
62
|
+
}>;
|
|
63
|
+
/** Fixed output budget for a prepared native-v1 style, never a raw input allowance. */
|
|
64
|
+
declare const tileflowNativePreparedStyleLimits: Readonly<{
|
|
65
|
+
maximumNodes: 540000;
|
|
66
|
+
maximumStyleBytes: number;
|
|
67
|
+
maximumDepth: 64;
|
|
68
|
+
maximumSources: 128;
|
|
69
|
+
maximumLayers: 4096;
|
|
70
|
+
maximumIssues: 32;
|
|
71
|
+
maximumFontFaces: 16;
|
|
72
|
+
maximumFontBytes: number;
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
declare const tileflowNativeBuildRecordFileName = "native-build.json";
|
|
76
|
+
declare const tileflowNativeStyleTransformationSchema: z.ZodLazy<z.core.$ZodObject<{
|
|
77
|
+
map: z.ZodString;
|
|
78
|
+
theme: z.ZodString;
|
|
79
|
+
inputStyleSha256: z.ZodString;
|
|
80
|
+
loweredStyleSha256: z.ZodString;
|
|
81
|
+
inputLayers: z.ZodNumber;
|
|
82
|
+
outputLayers: z.ZodNumber;
|
|
83
|
+
projection: z.ZodEnum<{
|
|
84
|
+
none: "none";
|
|
85
|
+
"mercator-to-implicit": "mercator-to-implicit";
|
|
86
|
+
"globe-to-mercator": "globe-to-mercator";
|
|
87
|
+
}>;
|
|
88
|
+
layers: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
|
|
89
|
+
inputLayer: z.ZodNumber;
|
|
90
|
+
outputStart: z.ZodNumber;
|
|
91
|
+
outputCount: z.ZodNumber;
|
|
92
|
+
properties: z.ZodArray<z.ZodEnum<{
|
|
93
|
+
"line-dasharray": "line-dasharray";
|
|
94
|
+
"line-cap": "line-cap";
|
|
95
|
+
}>>;
|
|
96
|
+
}, z.core.$strict>>>;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
type TileflowNativeStyleTransformation = z.infer<typeof tileflowNativeStyleTransformationSchema>;
|
|
99
|
+
/** Version 2 adds explicit preparation evidence. The runtime manifest remains version 1. */
|
|
100
|
+
declare const tileflowNativeBuildRecordSchema: z.ZodLazy<z.core.$ZodObject<{
|
|
101
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
102
|
+
renderer: z.ZodLiteral<"native">;
|
|
103
|
+
profile: z.ZodLiteral<"native-v1">;
|
|
104
|
+
validation: z.ZodLiteral<"static-artifacts">;
|
|
105
|
+
preparationVersion: z.ZodLiteral<"native-lowering-v1">;
|
|
106
|
+
engines: z.ZodLazy<z.core.$ZodObject<{
|
|
107
|
+
android: z.ZodLiteral<"13.2.0">;
|
|
108
|
+
ios: z.ZodLiteral<"6.26.0">;
|
|
109
|
+
}, z.core.$strict>>;
|
|
110
|
+
buildManifestSha256: z.ZodString;
|
|
111
|
+
transformations: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
|
|
112
|
+
map: z.ZodString;
|
|
113
|
+
theme: z.ZodString;
|
|
114
|
+
inputStyleSha256: z.ZodString;
|
|
115
|
+
loweredStyleSha256: z.ZodString;
|
|
116
|
+
inputLayers: z.ZodNumber;
|
|
117
|
+
outputLayers: z.ZodNumber;
|
|
118
|
+
projection: z.ZodEnum<{
|
|
119
|
+
none: "none";
|
|
120
|
+
"mercator-to-implicit": "mercator-to-implicit";
|
|
121
|
+
"globe-to-mercator": "globe-to-mercator";
|
|
122
|
+
}>;
|
|
123
|
+
layers: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
|
|
124
|
+
inputLayer: z.ZodNumber;
|
|
125
|
+
outputStart: z.ZodNumber;
|
|
126
|
+
outputCount: z.ZodNumber;
|
|
127
|
+
properties: z.ZodArray<z.ZodEnum<{
|
|
128
|
+
"line-dasharray": "line-dasharray";
|
|
129
|
+
"line-cap": "line-cap";
|
|
130
|
+
}>>;
|
|
131
|
+
}, z.core.$strict>>>;
|
|
132
|
+
}, z.core.$strict>>>;
|
|
133
|
+
}, z.core.$strict>>;
|
|
134
|
+
type TileflowNativeBuildRecord = z.infer<typeof tileflowNativeBuildRecordSchema>;
|
|
135
|
+
declare function createTileflowNativeBuildRecord(buildManifestSha256: string, transformations?: readonly TileflowNativeStyleTransformation[]): TileflowNativeBuildRecord;
|
|
136
|
+
|
|
137
|
+
declare const tileflowNativeDiagnosticCodeSchema: z.ZodEnum<{
|
|
138
|
+
NATIVE_UNSUPPORTED_STYLE: "NATIVE_UNSUPPORTED_STYLE";
|
|
139
|
+
NATIVE_UNSUPPORTED_SOURCE: "NATIVE_UNSUPPORTED_SOURCE";
|
|
140
|
+
NATIVE_FONT_UNAVAILABLE: "NATIVE_FONT_UNAVAILABLE";
|
|
141
|
+
NATIVE_MANIFEST_REQUIRED: "NATIVE_MANIFEST_REQUIRED";
|
|
142
|
+
NATIVE_RENDERER_UNSUPPORTED: "NATIVE_RENDERER_UNSUPPORTED";
|
|
143
|
+
}>;
|
|
144
|
+
type TileflowNativeDiagnosticCode = z.infer<typeof tileflowNativeDiagnosticCodeSchema>;
|
|
145
|
+
/** Uses the command diagnostic fields; renderer/profile are bounded additional context. */
|
|
146
|
+
declare const tileflowNativeDiagnosticSchema: z.ZodLazy<z.core.$ZodObject<{
|
|
147
|
+
code: z.ZodEnum<{
|
|
148
|
+
NATIVE_UNSUPPORTED_STYLE: "NATIVE_UNSUPPORTED_STYLE";
|
|
149
|
+
NATIVE_UNSUPPORTED_SOURCE: "NATIVE_UNSUPPORTED_SOURCE";
|
|
150
|
+
NATIVE_FONT_UNAVAILABLE: "NATIVE_FONT_UNAVAILABLE";
|
|
151
|
+
NATIVE_MANIFEST_REQUIRED: "NATIVE_MANIFEST_REQUIRED";
|
|
152
|
+
NATIVE_RENDERER_UNSUPPORTED: "NATIVE_RENDERER_UNSUPPORTED";
|
|
153
|
+
}>;
|
|
154
|
+
phase: z.ZodLiteral<"native-compatibility">;
|
|
155
|
+
severity: z.ZodLiteral<"error">;
|
|
156
|
+
path: z.ZodString;
|
|
157
|
+
renderer: z.ZodLiteral<"native">;
|
|
158
|
+
profile: z.ZodLiteral<"native-v1">;
|
|
159
|
+
message: z.ZodString;
|
|
160
|
+
suggestion: z.ZodString;
|
|
161
|
+
}, z.core.$strict>>;
|
|
162
|
+
type TileflowNativeDiagnostic = z.infer<typeof tileflowNativeDiagnosticSchema>;
|
|
163
|
+
declare function createTileflowNativeDiagnostic(code: TileflowNativeDiagnosticCode, path?: string): TileflowNativeDiagnostic;
|
|
164
|
+
declare class TileflowNativeCompatibilityError extends Error {
|
|
165
|
+
readonly phase: "native-compatibility";
|
|
166
|
+
readonly issues: readonly TileflowNativeDiagnostic[];
|
|
167
|
+
readonly code: TileflowNativeDiagnosticCode;
|
|
168
|
+
constructor(issues: readonly TileflowNativeDiagnostic[]);
|
|
169
|
+
}
|
|
170
|
+
declare function resolveTileflowRenderer(value?: unknown): TileflowRenderer;
|
|
171
|
+
type TileflowNativeStyleValidationOptions = {
|
|
172
|
+
profile?: 'native-v1';
|
|
173
|
+
/** Used only for URL syntax resolution; no request or authority is implied. */
|
|
174
|
+
documentUrl?: string;
|
|
175
|
+
developmentOrigin?: string;
|
|
176
|
+
/** Build preflight may defer font closure until the existing font pipeline has run. */
|
|
177
|
+
deferFontClosure?: boolean;
|
|
178
|
+
};
|
|
179
|
+
/** Validate bounded JSON and the common native engine surface without executing a renderer. */
|
|
180
|
+
declare function validateTileflowNativeStyle(input: unknown, options?: TileflowNativeStyleValidationOptions): TileflowNativeDiagnostic[];
|
|
181
|
+
/**
|
|
182
|
+
* Check an already prepared artifact with the fixed native-v1 output allowance.
|
|
183
|
+
* This does not lower a style or prove its origin. Authoring input must use the raw validator.
|
|
184
|
+
*/
|
|
185
|
+
declare function validateTileflowNativePreparedStyle(input: unknown, options?: TileflowNativeStyleValidationOptions): TileflowNativeDiagnostic[];
|
|
186
|
+
declare function assertTileflowNativeStyle(style: unknown, options?: TileflowNativeStyleValidationOptions): asserts style is MapLibreStyle;
|
|
187
|
+
|
|
188
|
+
export { type TileflowNativeBuildRecord, TileflowNativeCompatibilityError, type TileflowNativeDiagnostic, type TileflowNativeDiagnosticCode, type TileflowNativeProfile, type TileflowNativeStyleValidationOptions, type TileflowRenderer, assertTileflowNativeStyle, createTileflowNativeBuildRecord, createTileflowNativeDiagnostic, resolveTileflowRenderer, tileflowNativeBuildRecordFileName, tileflowNativeBuildRecordSchema, tileflowNativeDiagnosticCodeSchema, tileflowNativeDiagnosticSchema, tileflowNativePreparedStyleLimits, tileflowNativeProfile, tileflowNativeProfileIdSchema, tileflowNativeProfileLimits, tileflowNativeProfileSchema, tileflowRendererSchema, validateTileflowNativePreparedStyle, validateTileflowNativeStyle };
|