@valbuild/shared 0.152.1 → 0.153.1
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/CHANGELOG.md +50 -0
- package/client/dist/valbuild-shared-client.cjs.dev.js +4 -1
- package/client/dist/valbuild-shared-client.cjs.prod.js +4 -1
- package/client/dist/valbuild-shared-client.esm.js +1 -1
- package/dist/declarations/src/client/index.d.ts +1 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +123 -100
- package/dist/declarations/src/internal/codeChangedEvent.d.ts +15 -0
- package/dist/declarations/src/internal/content/version.d.ts +10 -1
- package/dist/declarations/src/internal/elementPicker.d.ts +8 -0
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/sketchpad/sketchFormat.d.ts +1 -16
- package/dist/declarations/src/internal/valCanvasProtocol.d.ts +34 -13
- package/dist/declarations/src/publish/builder.d.ts +7 -2
- package/dist/{getSitemapTree-dc61b8b6.cjs.dev.js → getSitemapTree-09399379.cjs.dev.js} +36 -6
- package/dist/{getSitemapTree-2b22cf1b.esm.js → getSitemapTree-6d875612.esm.js} +34 -7
- package/dist/{getSitemapTree-d0942fca.cjs.prod.js → getSitemapTree-7ed70b4a.cjs.prod.js} +36 -6
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +145 -217
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +145 -217
- package/internal/dist/valbuild-shared-internal.esm.js +140 -217
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ import { a as _createClass, c as _classCallCheck } from '../../dist/wrapNativeSu
|
|
|
7
7
|
import { fromError } from 'zod-validation-error';
|
|
8
8
|
import { result, array } from '@valbuild/core/fp';
|
|
9
9
|
import { PatchError, deepEqual, parseAndValidateArrayIndex } from '@valbuild/core/patch';
|
|
10
|
-
export { D as DEFAULT_CANVAS_SELECTION, e as DEFAULT_CANVAS_SELECTION_SOFT, Q as QUICK_PREVIEW_PARAM,
|
|
10
|
+
export { C as CODE_CHANGED_EVENT, D as DEFAULT_CANVAS_SELECTION, e as DEFAULT_CANVAS_SELECTION_SOFT, Q as QUICK_PREVIEW_PARAM, y as QUICK_PREVIEW_RENDER_SCRIPT, x as QUICK_PREVIEW_SERVICE_WORKER_PATH, B as QUICK_PREVIEW_SERVICE_WORKER_SOURCE, z as QUICK_PREVIEW_STORE_MESSAGE, b as VAL_AI_SESSION_STORAGE_KEY, d as VAL_CANVAS_MESSAGE, c as VAL_CANVAS_PARAM, V as VAL_CONFIG_SESSION_STORAGE_KEY, a as VAL_THEME_SESSION_STORAGE_KEY, l as attachElementPicker, n as createPickerOverlay, k as describeElement, o as elementLabel, u as findBySelector, H as formatRoutePattern, I as getNextAppRouterSourceFolder, M as getPageRouterSitemapTree, K as getPageRouterSourceFolder, N as getPatternFromModuleFilePath, J as getTanStackRouterSourceFolder, f as isCanvasSelectionColor, j as isCodeChangedDetail, A as isQuickPreviewFiles, L as isTanStackRoutesFolder, h as isValCanvasFrame, i as isValCanvasPageMessage, g as isValCanvasStudioMessage, m as modifierLabel, p as pageLocationOf, G as parseRoutePattern, t as readPageSnapshot, r as restoreScroll, v as screenshotPage, s as startElementPicking, E as storeQuickPreview, q as watchPageLocation, F as withQuickPreviewParam, w as withValCanvasParam } from '../../dist/getSitemapTree-6d875612.esm.js';
|
|
11
11
|
import FlexSearch from 'flexsearch';
|
|
12
12
|
import { b as base64DataUrlToUint8Array } from '../../dist/utils-00f3e1df.esm.js';
|
|
13
13
|
|
|
@@ -1344,6 +1344,24 @@ function chainOf(ids) {
|
|
|
1344
1344
|
function schemaVersionOf(serializedSchema) {
|
|
1345
1345
|
return sha256Hex("".concat(ENGINE, "\n").concat(JSON.stringify(serializedSchema)));
|
|
1346
1346
|
}
|
|
1347
|
+
var readerSchemaVersions = new WeakMap();
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* The version of the schema a reader's own code has for a module: what the
|
|
1351
|
+
* readers hold relayed or drafted content's version against (`layered`'s
|
|
1352
|
+
* schema rule), so content is never read with a schema it was not made for.
|
|
1353
|
+
* The server readers (`fetchVal`) and the page's hooks (`useVal`) alike.
|
|
1354
|
+
* Hashed once per module object, which a build makes once: a load cost, not
|
|
1355
|
+
* a read cost.
|
|
1356
|
+
*/
|
|
1357
|
+
function readerSchemaVersion(module) {
|
|
1358
|
+
var cached = readerSchemaVersions.get(module);
|
|
1359
|
+
if (cached !== undefined) return cached;
|
|
1360
|
+
var schema = Internal.getSchema(module);
|
|
1361
|
+
var version = schema === undefined ? null : schemaVersionOf(schema["executeSerialize"]());
|
|
1362
|
+
readerSchemaVersions.set(module, version);
|
|
1363
|
+
return version;
|
|
1364
|
+
}
|
|
1347
1365
|
|
|
1348
1366
|
/**
|
|
1349
1367
|
* A module's base version, from its base source: what the module evaluates
|
|
@@ -1872,6 +1890,70 @@ var SketchErrorZ = z.object({
|
|
|
1872
1890
|
});
|
|
1873
1891
|
/** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */
|
|
1874
1892
|
var SKETCHPAD_MAX_TEXT_LENGTH = 256 * 1024;
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* A manifest as the server answers it: what each module IS on the server
|
|
1896
|
+
* (`GET /manifest`, and the same answer on `/stat` when the Studio asks for it
|
|
1897
|
+
* there -- one function on the server answers both, `manifestAnswer`).
|
|
1898
|
+
*/
|
|
1899
|
+
var ManifestJson = z.object({
|
|
1900
|
+
project: ProjectVersionSchema,
|
|
1901
|
+
modules: z.record(ModuleFilePath, ModuleVersionSchema),
|
|
1902
|
+
/** This answer's ETag, as the header has it. */
|
|
1903
|
+
tag: z.string().optional(),
|
|
1904
|
+
/**
|
|
1905
|
+
* Present on a delta only: the `seq` of the manifest it is
|
|
1906
|
+
* relative to, whose modules that are not named here did not
|
|
1907
|
+
* move. Absent: every module is named.
|
|
1908
|
+
*/
|
|
1909
|
+
since: z.number().optional(),
|
|
1910
|
+
/**
|
|
1911
|
+
* The build that answered is a previous build still answering
|
|
1912
|
+
* (http mode: the content service counted a newer one live).
|
|
1913
|
+
* Its versions are right for its own bases, which the site does
|
|
1914
|
+
* not serve any more: a Studio does not move to them, and asks
|
|
1915
|
+
* again. Optional: absent from a live build and a server of the
|
|
1916
|
+
* release before.
|
|
1917
|
+
*/
|
|
1918
|
+
superseded: z["boolean"]().optional(),
|
|
1919
|
+
/**
|
|
1920
|
+
* The answering build's `val.modules` registry, as an entry a
|
|
1921
|
+
* Studio can import (`valModulesEntryPath`), and the Val it
|
|
1922
|
+
* runs: where a Studio opened on another build takes this
|
|
1923
|
+
* build's code in without reloading the page. Only a build the
|
|
1924
|
+
* platform made and names (`publishBuild`) has one. Optional
|
|
1925
|
+
* both ways: absent from any other server (local development,
|
|
1926
|
+
* where HMR brings the code; a self-hosted deploy) and from a
|
|
1927
|
+
* server of the release before, and ignored by a Studio of the
|
|
1928
|
+
* release before.
|
|
1929
|
+
*/
|
|
1930
|
+
registry: z.object({
|
|
1931
|
+
entry: z.string(),
|
|
1932
|
+
core: z.string()
|
|
1933
|
+
}).optional()
|
|
1934
|
+
});
|
|
1935
|
+
/**
|
|
1936
|
+
* The manifest a `/stat` answer carries, when the request said which one the
|
|
1937
|
+
* Studio holds (`manifest` on the request): what `GET /manifest` would have
|
|
1938
|
+
* answered for it, so another editor's keystroke costs no manifest request.
|
|
1939
|
+
*
|
|
1940
|
+
* - A manifest, whole or a delta. A delta names the ETag it is relative to
|
|
1941
|
+
* (`sinceTag`): a Studio uses it only while it holds exactly that one.
|
|
1942
|
+
* - `unchanged`: the manifest the request named, at `seq`, is still the
|
|
1943
|
+
* one for this answer's `seq`. Decided by `seq` alone, and not read: a
|
|
1944
|
+
* Studio reads a manifest only for a stat whose `seq` moved. It keeps the
|
|
1945
|
+
* next request naming the same manifest.
|
|
1946
|
+
*
|
|
1947
|
+
* Optional: absent from a server of the release before, and from an answer
|
|
1948
|
+
* to a request that did not ask, and then the Studio reads `GET /manifest`.
|
|
1949
|
+
*/
|
|
1950
|
+
var StatManifest = z.union([ManifestJson.extend({
|
|
1951
|
+
sinceTag: z.string().optional()
|
|
1952
|
+
}), z.object({
|
|
1953
|
+
unchanged: z.literal(true),
|
|
1954
|
+
tag: z.string(),
|
|
1955
|
+
seq: z.number()
|
|
1956
|
+
})]);
|
|
1875
1957
|
var Api = {
|
|
1876
1958
|
"/draft/enable": {
|
|
1877
1959
|
GET: {
|
|
@@ -2258,42 +2340,7 @@ var Api = {
|
|
|
2258
2340
|
json: GenericError
|
|
2259
2341
|
}), z.object({
|
|
2260
2342
|
status: z.literal(200),
|
|
2261
|
-
json:
|
|
2262
|
-
project: ProjectVersionSchema,
|
|
2263
|
-
modules: z.record(ModuleFilePath, ModuleVersionSchema),
|
|
2264
|
-
/** This answer's ETag, as the header has it. */
|
|
2265
|
-
tag: z.string().optional(),
|
|
2266
|
-
/**
|
|
2267
|
-
* Present on a delta only: the `seq` of the manifest it is
|
|
2268
|
-
* relative to, whose modules that are not named here did not
|
|
2269
|
-
* move. Absent: every module is named.
|
|
2270
|
-
*/
|
|
2271
|
-
since: z.number().optional(),
|
|
2272
|
-
/**
|
|
2273
|
-
* The build that answered is a previous build still answering
|
|
2274
|
-
* (http mode: the content service counted a newer one live).
|
|
2275
|
-
* Its versions are right for its own bases, which the site does
|
|
2276
|
-
* not serve any more: a Studio does not move to them, and asks
|
|
2277
|
-
* again. Optional: absent from a live build and a server of the
|
|
2278
|
-
* release before.
|
|
2279
|
-
*/
|
|
2280
|
-
superseded: z["boolean"]().optional(),
|
|
2281
|
-
/**
|
|
2282
|
-
* The answering build's `val.modules` registry, as an entry a
|
|
2283
|
-
* Studio can import (`valModulesEntryPath`), and the Val it
|
|
2284
|
-
* runs: where a Studio opened on another build takes this
|
|
2285
|
-
* build's code in without reloading the page. Only a build the
|
|
2286
|
-
* platform made and names (`publishBuild`) has one. Optional
|
|
2287
|
-
* both ways: absent from any other server (local development,
|
|
2288
|
-
* where HMR brings the code; a self-hosted deploy) and from a
|
|
2289
|
-
* server of the release before, and ignored by a Studio of the
|
|
2290
|
-
* release before.
|
|
2291
|
-
*/
|
|
2292
|
-
registry: z.object({
|
|
2293
|
-
entry: z.string(),
|
|
2294
|
-
core: z.string()
|
|
2295
|
-
}).optional()
|
|
2296
|
-
})
|
|
2343
|
+
json: ManifestJson
|
|
2297
2344
|
}),
|
|
2298
2345
|
/*
|
|
2299
2346
|
* Nothing moved since the ETag the client sent. No body on the wire;
|
|
@@ -2310,23 +2357,24 @@ var Api = {
|
|
|
2310
2357
|
req: {
|
|
2311
2358
|
body: z.object({
|
|
2312
2359
|
/**
|
|
2313
|
-
* @deprecated Echoed by
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2360
|
+
* @deprecated Echoed by a Studio of the release that shipped the
|
|
2361
|
+
* one content model, whose fs and memory long poll compared it to
|
|
2362
|
+
* see another build; a Studio of the release after echoes
|
|
2363
|
+
* {@link version} instead, and this only when it was sent. The
|
|
2364
|
+
* request field goes once no Studio sends it (see
|
|
2365
|
+
* "Release-delayed deletions" in
|
|
2318
2366
|
* `docs/plans/one-content-model.md`).
|
|
2319
2367
|
*/
|
|
2320
|
-
sourcesSha: z.string(),
|
|
2368
|
+
sourcesSha: z.string().optional(),
|
|
2369
|
+
/** @deprecated As `sourcesSha`. */
|
|
2370
|
+
schemaSha: z.string().optional(),
|
|
2321
2371
|
/**
|
|
2322
|
-
*
|
|
2323
|
-
*
|
|
2324
|
-
*
|
|
2325
|
-
*
|
|
2326
|
-
* version instead (see "Release-delayed deletions" in
|
|
2327
|
-
* `docs/plans/one-content-model.md`).
|
|
2372
|
+
* The `version` the last answer carried: what the fs and memory
|
|
2373
|
+
* long poll compare to see another build (the build the chain is
|
|
2374
|
+
* relative to, `ValOps.chainBuild`). Optional: a Studio of the
|
|
2375
|
+
* release before echoes the shas.
|
|
2328
2376
|
*/
|
|
2329
|
-
|
|
2377
|
+
version: ProjectVersionSchema.optional(),
|
|
2330
2378
|
baseSha: z.string(),
|
|
2331
2379
|
patches: z.array(z.string()).optional(),
|
|
2332
2380
|
/**
|
|
@@ -2335,7 +2383,17 @@ var Api = {
|
|
|
2335
2383
|
* jsonValues module's source is markers and the content sits behind a
|
|
2336
2384
|
* thunk that `JSON.stringify` drops.
|
|
2337
2385
|
*/
|
|
2338
|
-
jsonEntriesSha: z.string().optional()
|
|
2386
|
+
jsonEntriesSha: z.string().optional(),
|
|
2387
|
+
/**
|
|
2388
|
+
* The manifest the Studio holds, by its ETag and `seq`, so the
|
|
2389
|
+
* answer can carry what moved since (`manifest` on the answer):
|
|
2390
|
+
* `null` when it holds none and can take one. Absent from a
|
|
2391
|
+
* Studio of the release before, which reads `GET /manifest`.
|
|
2392
|
+
*/
|
|
2393
|
+
manifest: z.object({
|
|
2394
|
+
tag: z.string(),
|
|
2395
|
+
seq: z.number()
|
|
2396
|
+
}).nullable().optional()
|
|
2339
2397
|
}).nullable(),
|
|
2340
2398
|
cookies: {
|
|
2341
2399
|
val_session: z.string().optional()
|
|
@@ -2356,21 +2414,16 @@ var Api = {
|
|
|
2356
2414
|
type: z.union([z.literal("request-again"), z.literal("no-change"), z.literal("did-change")]),
|
|
2357
2415
|
baseSha: z.string(),
|
|
2358
2416
|
/**
|
|
2359
|
-
* @deprecated
|
|
2360
|
-
*
|
|
2361
|
-
*
|
|
2362
|
-
*
|
|
2363
|
-
* deletions" in
|
|
2364
|
-
|
|
2365
|
-
schemaSha: z.string(),
|
|
2366
|
-
/**
|
|
2367
|
-
* @deprecated Read by a Studio of the release before
|
|
2368
|
-
* (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
|
|
2369
|
-
* only echoes it, and reads each module's version from
|
|
2370
|
-
* `GET /manifest`. Goes in two steps (see "Release-delayed
|
|
2371
|
-
* deletions" in `docs/plans/one-content-model.md`).
|
|
2417
|
+
* @deprecated Still sent, for a Studio of the release that
|
|
2418
|
+
* shipped the one content model, which echoes it; a Studio of
|
|
2419
|
+
* the release after reads it as optional and echoes `version`.
|
|
2420
|
+
* The server stops sending it in the release after that (see
|
|
2421
|
+
* "Release-delayed deletions" in
|
|
2422
|
+
* `docs/plans/one-content-model.md`).
|
|
2372
2423
|
*/
|
|
2373
|
-
|
|
2424
|
+
schemaSha: z.string().optional(),
|
|
2425
|
+
/** @deprecated As `schemaSha`. */
|
|
2426
|
+
sourcesSha: z.string().optional(),
|
|
2374
2427
|
patches: z.array(PatchId),
|
|
2375
2428
|
/**
|
|
2376
2429
|
* Of `patches`, the ones that have already SHIPPED.
|
|
@@ -2474,28 +2527,25 @@ var Api = {
|
|
|
2474
2527
|
* answers, the higher `seq` is the newer. Optional: a server
|
|
2475
2528
|
* that predates versions sends none.
|
|
2476
2529
|
*/
|
|
2477
|
-
version: ProjectVersionSchema.optional()
|
|
2530
|
+
version: ProjectVersionSchema.optional(),
|
|
2531
|
+
/** See {@link StatManifest}. */
|
|
2532
|
+
manifest: StatManifest.optional()
|
|
2478
2533
|
}), z.object({
|
|
2479
2534
|
type: z.literal("use-websocket"),
|
|
2480
2535
|
url: z.string(),
|
|
2481
2536
|
nonce: z.string(),
|
|
2482
2537
|
baseSha: z.string(),
|
|
2483
2538
|
/**
|
|
2484
|
-
* @deprecated
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2487
|
-
*
|
|
2488
|
-
* deletions" in
|
|
2489
|
-
|
|
2490
|
-
schemaSha: z.string(),
|
|
2491
|
-
/**
|
|
2492
|
-
* @deprecated Read by a Studio of the release before
|
|
2493
|
-
* (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
|
|
2494
|
-
* only echoes it, and reads each module's version from
|
|
2495
|
-
* `GET /manifest`. Goes in two steps (see "Release-delayed
|
|
2496
|
-
* deletions" in `docs/plans/one-content-model.md`).
|
|
2539
|
+
* @deprecated Still sent, for a Studio of the release that
|
|
2540
|
+
* shipped the one content model, which echoes it; a Studio of
|
|
2541
|
+
* the release after reads it as optional and echoes `version`.
|
|
2542
|
+
* The server stops sending it in the release after that (see
|
|
2543
|
+
* "Release-delayed deletions" in
|
|
2544
|
+
* `docs/plans/one-content-model.md`).
|
|
2497
2545
|
*/
|
|
2498
|
-
|
|
2546
|
+
schemaSha: z.string().optional(),
|
|
2547
|
+
/** @deprecated As `schemaSha`. */
|
|
2548
|
+
sourcesSha: z.string().optional(),
|
|
2499
2549
|
/**
|
|
2500
2550
|
* The commit this deployment was built from.
|
|
2501
2551
|
*
|
|
@@ -2623,7 +2673,9 @@ var Api = {
|
|
|
2623
2673
|
* answers, the higher `seq` is the newer. Optional: a server
|
|
2624
2674
|
* that predates versions sends none.
|
|
2625
2675
|
*/
|
|
2626
|
-
version: ProjectVersionSchema.optional()
|
|
2676
|
+
version: ProjectVersionSchema.optional(),
|
|
2677
|
+
/** See {@link StatManifest}. */
|
|
2678
|
+
manifest: StatManifest.optional()
|
|
2627
2679
|
})])
|
|
2628
2680
|
})])
|
|
2629
2681
|
}
|
|
@@ -3188,81 +3240,6 @@ var Api = {
|
|
|
3188
3240
|
})])
|
|
3189
3241
|
}
|
|
3190
3242
|
},
|
|
3191
|
-
/**
|
|
3192
|
-
* @deprecated The whole tree. Nothing of this release asks it: the Studio
|
|
3193
|
-
* reads modules by version (`GET /manifest`, `GET /modules/~`), the draft
|
|
3194
|
-
* readers and MCP read the head in-process. Kept, with `exclude_patches`
|
|
3195
|
-
* (`BaseAlignment`'s fetch) and the ignored `validate_sources` and
|
|
3196
|
-
* `validate_binary_files`, for a Studio of the release before; goes in the
|
|
3197
|
-
* release after the one that ships this (see "Release-delayed deletions"
|
|
3198
|
-
* in `docs/plans/one-content-model.md`).
|
|
3199
|
-
*/
|
|
3200
|
-
"/sources/~": {
|
|
3201
|
-
PUT: {
|
|
3202
|
-
req: {
|
|
3203
|
-
path: z.string().optional(),
|
|
3204
|
-
query: {
|
|
3205
|
-
validate_sources: onlyOneBooleanQueryParam.optional(),
|
|
3206
|
-
validate_binary_files: onlyOneBooleanQueryParam.optional(),
|
|
3207
|
-
exclude_patches: onlyOneBooleanQueryParam.optional(),
|
|
3208
|
-
apply_patches: onlyOneBooleanQueryParam.optional()
|
|
3209
|
-
},
|
|
3210
|
-
cookies: {
|
|
3211
|
-
val_session: z.string().optional()
|
|
3212
|
-
}
|
|
3213
|
-
},
|
|
3214
|
-
res: z.union([unauthorizedResponse, z.object({
|
|
3215
|
-
status: z.literal(401),
|
|
3216
|
-
json: GenericError
|
|
3217
|
-
}), z.object({
|
|
3218
|
-
status: z.literal(500),
|
|
3219
|
-
json: z.object({
|
|
3220
|
-
message: z.string(),
|
|
3221
|
-
details: z.union([z.array(ModulesError), GenericError])
|
|
3222
|
-
})
|
|
3223
|
-
}), z.object({
|
|
3224
|
-
status: z.literal(409),
|
|
3225
|
-
json: z.object({
|
|
3226
|
-
message: z.string()
|
|
3227
|
-
})
|
|
3228
|
-
}), z.object({
|
|
3229
|
-
status: z.literal(400),
|
|
3230
|
-
json: z.object({
|
|
3231
|
-
message: z.string(),
|
|
3232
|
-
details: z.array(ModulesError)
|
|
3233
|
-
})
|
|
3234
|
-
}), z.object({
|
|
3235
|
-
status: z.literal(200),
|
|
3236
|
-
json: z.object({
|
|
3237
|
-
schemaSha: z.string(),
|
|
3238
|
-
sourcesSha: z.string(),
|
|
3239
|
-
modules: z.record(ModuleFilePath, z.object({
|
|
3240
|
-
preview: z.any().optional(),
|
|
3241
|
-
// TODO: improve this type
|
|
3242
|
-
source: z.any().optional(),
|
|
3243
|
-
//.optional(), // TODO: Json zod type
|
|
3244
|
-
baseSource: z.any().optional(),
|
|
3245
|
-
// pre-patch source for compare view; only set when the server applies patches (apply_patches=true) and the module has pending patches
|
|
3246
|
-
patches: z.object({
|
|
3247
|
-
applied: z.array(PatchId),
|
|
3248
|
-
skipped: z.array(PatchId).optional(),
|
|
3249
|
-
errors: z.record(PatchId, GenericError).optional()
|
|
3250
|
-
}).optional(),
|
|
3251
|
-
validationErrors: z.record(z.string(), z.array(ValidationError)).optional(),
|
|
3252
|
-
/**
|
|
3253
|
-
* The version of `source` as answered: with the chain the
|
|
3254
|
-
* server applied, or the empty chain when it applied none
|
|
3255
|
-
* (`apply_patches=false`). Optional: an older server sends
|
|
3256
|
-
* none.
|
|
3257
|
-
*/
|
|
3258
|
-
version: ModuleVersionSchema.optional()
|
|
3259
|
-
})),
|
|
3260
|
-
/** The project version this tree was read at. See `/stat`. */
|
|
3261
|
-
project: ProjectVersionSchema.optional()
|
|
3262
|
-
})
|
|
3263
|
-
})])
|
|
3264
|
-
}
|
|
3265
|
-
},
|
|
3266
3243
|
/**
|
|
3267
3244
|
* One module by version: phase 6 of `docs/plans/one-content-model.md`
|
|
3268
3245
|
* ("The Studio loads everything from one place"). `GET /modules/~<path>`,
|
|
@@ -8263,8 +8240,6 @@ var toolNames = ["get_all_schema", "get_source", "search_content", "validate_con
|
|
|
8263
8240
|
* --- /about a route: what follows is the page at /about
|
|
8264
8241
|
* # Our people text (a heading: #, ## or ###)
|
|
8265
8242
|
* We are 40 people in Oslo. text (a paragraph)
|
|
8266
|
-
* ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
|
|
8267
|
-
* in it writes the field
|
|
8268
8243
|
* [image: Team photo] placeholder: [kind] or [kind: label]
|
|
8269
8244
|
* [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
|
|
8270
8245
|
* icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
|
|
@@ -8420,27 +8395,7 @@ function parseSketch(source) {
|
|
|
8420
8395
|
errors: errors
|
|
8421
8396
|
};
|
|
8422
8397
|
}
|
|
8423
|
-
|
|
8424
|
-
/** The link to a content field at the end of a text line. */
|
|
8425
|
-
var FIELD = / \{field: (\/[^{}]*)\}$/;
|
|
8426
|
-
function parseContent(whole, line, errors) {
|
|
8427
|
-
var link = FIELD.exec(whole);
|
|
8428
|
-
if (link) {
|
|
8429
|
-
var node = parseLine(whole.slice(0, link.index), line, errors);
|
|
8430
|
-
if (node.type !== "text") {
|
|
8431
|
-
errors.push({
|
|
8432
|
-
line: line,
|
|
8433
|
-
message: "Only a heading or a paragraph is linked to a field: put {field: ...} at the end of one."
|
|
8434
|
-
});
|
|
8435
|
-
return node;
|
|
8436
|
-
}
|
|
8437
|
-
return _objectSpread2(_objectSpread2({}, node), {}, {
|
|
8438
|
-
field: link[1].trim()
|
|
8439
|
-
});
|
|
8440
|
-
}
|
|
8441
|
-
return parseLine(whole, line, errors);
|
|
8442
|
-
}
|
|
8443
|
-
function parseLine(content, line, errors) {
|
|
8398
|
+
function parseContent(content, line, errors) {
|
|
8444
8399
|
// A leading backslash keeps a line that looks like a keyword as text.
|
|
8445
8400
|
if (content.startsWith("\\")) {
|
|
8446
8401
|
return {
|
|
@@ -8547,19 +8502,13 @@ function parseLine(content, line, errors) {
|
|
|
8547
8502
|
* The line a text block is written as. Line breaks become spaces, and a
|
|
8548
8503
|
* paragraph that would read as something else is kept as text with `\`.
|
|
8549
8504
|
*/
|
|
8550
|
-
function formatSketchText(level, text
|
|
8505
|
+
function formatSketchText(level, text) {
|
|
8551
8506
|
var flat = text.replace(/\s+/g, " ").trim();
|
|
8552
|
-
var path = field === null || field === void 0 ? void 0 : field.replace(/\s+/g, " ").trim();
|
|
8553
|
-
// A source path, and one the line can be read back with: no braces.
|
|
8554
|
-
var link = path && /^\/[^{}]*$/.test(path) ? " {field: ".concat(path, "}") : "";
|
|
8555
8507
|
if (level > 0) {
|
|
8556
|
-
return "#".repeat(level) + " " + flat
|
|
8508
|
+
return "#".repeat(level) + " " + flat;
|
|
8557
8509
|
}
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
var whole = flat + link;
|
|
8561
|
-
var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(whole) || ROUTE.test(whole) || HEADING.test(whole) || ICON.test(whole);
|
|
8562
|
-
return (ambiguous ? "\\" + flat : flat) + link;
|
|
8510
|
+
var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(flat) || ROUTE.test(flat) || HEADING.test(flat) || ICON.test(flat);
|
|
8511
|
+
return ambiguous ? "\\" + flat : flat;
|
|
8563
8512
|
}
|
|
8564
8513
|
|
|
8565
8514
|
/** The line a placeholder is written as. */
|
|
@@ -8584,18 +8533,12 @@ function formatSketchBox(placeholder) {
|
|
|
8584
8533
|
*/
|
|
8585
8534
|
function formatSketch(blocks, icons) {
|
|
8586
8535
|
var lines = [];
|
|
8587
|
-
// One block per field: the first keeps the link.
|
|
8588
|
-
var linked = new Set();
|
|
8589
8536
|
var _walk = function walk(node, depth, inRow) {
|
|
8590
8537
|
var indent = " ".repeat(depth);
|
|
8591
8538
|
switch (node.type) {
|
|
8592
8539
|
case "text":
|
|
8593
8540
|
if (node.text) {
|
|
8594
|
-
|
|
8595
|
-
if (field) {
|
|
8596
|
-
linked.add(field);
|
|
8597
|
-
}
|
|
8598
|
-
lines.push(indent + formatSketchText(node.level, node.text, field));
|
|
8541
|
+
lines.push(indent + formatSketchText(node.level, node.text));
|
|
8599
8542
|
}
|
|
8600
8543
|
return;
|
|
8601
8544
|
case "placeholder":
|
|
@@ -8640,26 +8583,6 @@ function formatSketch(blocks, icons) {
|
|
|
8640
8583
|
return all.length > 0 ? all.join("\n") + "\n" : "";
|
|
8641
8584
|
}
|
|
8642
8585
|
|
|
8643
|
-
/**
|
|
8644
|
-
* The text of every block linked to a field, by field: what the Studio
|
|
8645
|
-
* writes to the content when a linked block changes. The first block wins,
|
|
8646
|
-
* as `formatSketch` keeps only its link.
|
|
8647
|
-
*/
|
|
8648
|
-
function sketchFieldTexts(blocks) {
|
|
8649
|
-
var texts = new Map();
|
|
8650
|
-
var _walk2 = function walk(node) {
|
|
8651
|
-
if (node.type === "text") {
|
|
8652
|
-
if (node.field && node.text && !texts.has(node.field)) {
|
|
8653
|
-
texts.set(node.field, node.text.replace(/\s+/g, " ").trim());
|
|
8654
|
-
}
|
|
8655
|
-
} else if (node.type === "row" || node.type === "col") {
|
|
8656
|
-
node.children.forEach(_walk2);
|
|
8657
|
-
}
|
|
8658
|
-
};
|
|
8659
|
-
blocks.forEach(_walk2);
|
|
8660
|
-
return texts;
|
|
8661
|
-
}
|
|
8662
|
-
|
|
8663
8586
|
/** The pages a sketch is about, in the order it gives them. */
|
|
8664
8587
|
function sketchRoutes(blocks) {
|
|
8665
8588
|
return blocks.flatMap(function (block) {
|
|
@@ -11835,4 +11758,4 @@ var messageOf = function messageOf(error) {
|
|
|
11835
11758
|
return error instanceof Error ? error.message : String(error);
|
|
11836
11759
|
};
|
|
11837
11760
|
|
|
11838
|
-
export { AA_LARGE, AA_TEXT, AIToolCallSummaries, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, ChainFold, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, EMPTY_CHAIN, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, ENGINE, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, ModuleVersionSchema, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, ProjectVersionSchema, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, SESSION_MEDIA_PREFIX, SKETCHPAD_MAX_TEXT_LENGTH, STAGED_SCHEMA_PREFIX, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, Sketchpad, SketchpadSummary, VAL_CLIENT_HEADER, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, applyChain, applyPatchRecord, baseModuleContent, baseVersionOf, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, bundleTier, chainHeadOf, chainOf, checkCompatibility, checkSketch, childSource, chooseEncoded, classifyJsonValuesOp, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, engineWork, entryAddress, entryState, enumLocaleTag, expandJsonValuesRootOp, expandJsonValuesRootOpForKey, explainIncompatible, extendChain, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, formatSketch, formatSketchBox, formatSketchText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, hasLocaleRouteParam, indexModule, isInsidePatchSetPath, isJsonObject, isJsonValuesRootOp, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, localeOfModuleRoot, localeOfRouteKey, localeParamOfRouteKey, localeScopeAt, memoryTier, moduleKey, newestCommitSha, parseModuleKey, parseSketch, partitionValidationErrors, pathOfModuleKey, performSearch, proposalCustomProperties, rebaseContentOp, relativeLuminance, relocateForLocale, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolveEntry, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, sameEntryVersion, sameModuleVersion, schemaErrorsOf, schemaTypesOfPath, schemaVersionOf, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource,
|
|
11761
|
+
export { AA_LARGE, AA_TEXT, AIToolCallSummaries, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, ChainFold, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, EMPTY_CHAIN, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, ENGINE, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ManifestJson, ModuleComparison, ModuleVersionSchema, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, ProjectVersionSchema, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, SESSION_MEDIA_PREFIX, SKETCHPAD_MAX_TEXT_LENGTH, STAGED_SCHEMA_PREFIX, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, Sketchpad, SketchpadSummary, StatManifest, VAL_CLIENT_HEADER, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, applyChain, applyPatchRecord, baseModuleContent, baseVersionOf, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, bundleTier, chainHeadOf, chainOf, checkCompatibility, checkSketch, childSource, chooseEncoded, classifyJsonValuesOp, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, engineWork, entryAddress, entryState, enumLocaleTag, expandJsonValuesRootOp, expandJsonValuesRootOpForKey, explainIncompatible, extendChain, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, formatSketch, formatSketchBox, formatSketchText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, hasLocaleRouteParam, indexModule, isInsidePatchSetPath, isJsonObject, isJsonValuesRootOp, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, localeOfModuleRoot, localeOfRouteKey, localeParamOfRouteKey, localeScopeAt, memoryTier, moduleKey, newestCommitSha, parseModuleKey, parseSketch, partitionValidationErrors, pathOfModuleKey, performSearch, proposalCustomProperties, readerSchemaVersion, rebaseContentOp, relativeLuminance, relocateForLocale, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolveEntry, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, sameEntryVersion, sameModuleVersion, schemaErrorsOf, schemaTypesOfPath, schemaVersionOf, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sketchRoutes, sketchTitle, sourcePathOfChild, storeWork, themeCustomProperties, tiered, toolNames, traverseSchemaSource, urlOf, valClientHeaders, valModulesEntryFile, valModulesEntryPath, validateRoutePatterns, versionHashCount, wholeEntryKey, withExtension };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.153.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"yaml": "^2.9.0",
|
|
55
55
|
"zod": "^4.4.3",
|
|
56
56
|
"zod-validation-error": "^5.0.0",
|
|
57
|
-
"@valbuild/core": "0.
|
|
57
|
+
"@valbuild/core": "0.153.0"
|
|
58
58
|
},
|
|
59
59
|
"files": [
|
|
60
60
|
"CHANGELOG.md",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
],
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"typescript": "^6.0.3",
|
|
75
|
-
"@valbuild/tanstack-build": "0.
|
|
75
|
+
"@valbuild/tanstack-build": "0.153.0"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
78
|
"scripts": {
|