@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
|
@@ -10,7 +10,7 @@ var wrapNativeSuper = require('../../dist/wrapNativeSuper-8673414f.cjs.prod.js')
|
|
|
10
10
|
var zodValidationError = require('zod-validation-error');
|
|
11
11
|
var fp = require('@valbuild/core/fp');
|
|
12
12
|
var patch = require('@valbuild/core/patch');
|
|
13
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
13
|
+
var getSitemapTree = require('../../dist/getSitemapTree-7ed70b4a.cjs.prod.js');
|
|
14
14
|
var FlexSearch = require('flexsearch');
|
|
15
15
|
var utils = require('../../dist/utils-32bcaca2.cjs.prod.js');
|
|
16
16
|
|
|
@@ -1351,6 +1351,24 @@ function chainOf(ids) {
|
|
|
1351
1351
|
function schemaVersionOf(serializedSchema) {
|
|
1352
1352
|
return sha256Hex("".concat(ENGINE, "\n").concat(JSON.stringify(serializedSchema)));
|
|
1353
1353
|
}
|
|
1354
|
+
var readerSchemaVersions = new WeakMap();
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* The version of the schema a reader's own code has for a module: what the
|
|
1358
|
+
* readers hold relayed or drafted content's version against (`layered`'s
|
|
1359
|
+
* schema rule), so content is never read with a schema it was not made for.
|
|
1360
|
+
* The server readers (`fetchVal`) and the page's hooks (`useVal`) alike.
|
|
1361
|
+
* Hashed once per module object, which a build makes once: a load cost, not
|
|
1362
|
+
* a read cost.
|
|
1363
|
+
*/
|
|
1364
|
+
function readerSchemaVersion(module) {
|
|
1365
|
+
var cached = readerSchemaVersions.get(module);
|
|
1366
|
+
if (cached !== undefined) return cached;
|
|
1367
|
+
var schema = core.Internal.getSchema(module);
|
|
1368
|
+
var version = schema === undefined ? null : schemaVersionOf(schema["executeSerialize"]());
|
|
1369
|
+
readerSchemaVersions.set(module, version);
|
|
1370
|
+
return version;
|
|
1371
|
+
}
|
|
1354
1372
|
|
|
1355
1373
|
/**
|
|
1356
1374
|
* A module's base version, from its base source: what the module evaluates
|
|
@@ -1879,6 +1897,70 @@ var SketchErrorZ = zod.z.object({
|
|
|
1879
1897
|
});
|
|
1880
1898
|
/** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */
|
|
1881
1899
|
var SKETCHPAD_MAX_TEXT_LENGTH = 256 * 1024;
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* A manifest as the server answers it: what each module IS on the server
|
|
1903
|
+
* (`GET /manifest`, and the same answer on `/stat` when the Studio asks for it
|
|
1904
|
+
* there -- one function on the server answers both, `manifestAnswer`).
|
|
1905
|
+
*/
|
|
1906
|
+
var ManifestJson = zod.z.object({
|
|
1907
|
+
project: ProjectVersionSchema,
|
|
1908
|
+
modules: zod.z.record(ModuleFilePath, ModuleVersionSchema),
|
|
1909
|
+
/** This answer's ETag, as the header has it. */
|
|
1910
|
+
tag: zod.z.string().optional(),
|
|
1911
|
+
/**
|
|
1912
|
+
* Present on a delta only: the `seq` of the manifest it is
|
|
1913
|
+
* relative to, whose modules that are not named here did not
|
|
1914
|
+
* move. Absent: every module is named.
|
|
1915
|
+
*/
|
|
1916
|
+
since: zod.z.number().optional(),
|
|
1917
|
+
/**
|
|
1918
|
+
* The build that answered is a previous build still answering
|
|
1919
|
+
* (http mode: the content service counted a newer one live).
|
|
1920
|
+
* Its versions are right for its own bases, which the site does
|
|
1921
|
+
* not serve any more: a Studio does not move to them, and asks
|
|
1922
|
+
* again. Optional: absent from a live build and a server of the
|
|
1923
|
+
* release before.
|
|
1924
|
+
*/
|
|
1925
|
+
superseded: zod.z["boolean"]().optional(),
|
|
1926
|
+
/**
|
|
1927
|
+
* The answering build's `val.modules` registry, as an entry a
|
|
1928
|
+
* Studio can import (`valModulesEntryPath`), and the Val it
|
|
1929
|
+
* runs: where a Studio opened on another build takes this
|
|
1930
|
+
* build's code in without reloading the page. Only a build the
|
|
1931
|
+
* platform made and names (`publishBuild`) has one. Optional
|
|
1932
|
+
* both ways: absent from any other server (local development,
|
|
1933
|
+
* where HMR brings the code; a self-hosted deploy) and from a
|
|
1934
|
+
* server of the release before, and ignored by a Studio of the
|
|
1935
|
+
* release before.
|
|
1936
|
+
*/
|
|
1937
|
+
registry: zod.z.object({
|
|
1938
|
+
entry: zod.z.string(),
|
|
1939
|
+
core: zod.z.string()
|
|
1940
|
+
}).optional()
|
|
1941
|
+
});
|
|
1942
|
+
/**
|
|
1943
|
+
* The manifest a `/stat` answer carries, when the request said which one the
|
|
1944
|
+
* Studio holds (`manifest` on the request): what `GET /manifest` would have
|
|
1945
|
+
* answered for it, so another editor's keystroke costs no manifest request.
|
|
1946
|
+
*
|
|
1947
|
+
* - A manifest, whole or a delta. A delta names the ETag it is relative to
|
|
1948
|
+
* (`sinceTag`): a Studio uses it only while it holds exactly that one.
|
|
1949
|
+
* - `unchanged`: the manifest the request named, at `seq`, is still the
|
|
1950
|
+
* one for this answer's `seq`. Decided by `seq` alone, and not read: a
|
|
1951
|
+
* Studio reads a manifest only for a stat whose `seq` moved. It keeps the
|
|
1952
|
+
* next request naming the same manifest.
|
|
1953
|
+
*
|
|
1954
|
+
* Optional: absent from a server of the release before, and from an answer
|
|
1955
|
+
* to a request that did not ask, and then the Studio reads `GET /manifest`.
|
|
1956
|
+
*/
|
|
1957
|
+
var StatManifest = zod.z.union([ManifestJson.extend({
|
|
1958
|
+
sinceTag: zod.z.string().optional()
|
|
1959
|
+
}), zod.z.object({
|
|
1960
|
+
unchanged: zod.z.literal(true),
|
|
1961
|
+
tag: zod.z.string(),
|
|
1962
|
+
seq: zod.z.number()
|
|
1963
|
+
})]);
|
|
1882
1964
|
var Api = {
|
|
1883
1965
|
"/draft/enable": {
|
|
1884
1966
|
GET: {
|
|
@@ -2265,42 +2347,7 @@ var Api = {
|
|
|
2265
2347
|
json: GenericError
|
|
2266
2348
|
}), zod.z.object({
|
|
2267
2349
|
status: zod.z.literal(200),
|
|
2268
|
-
json:
|
|
2269
|
-
project: ProjectVersionSchema,
|
|
2270
|
-
modules: zod.z.record(ModuleFilePath, ModuleVersionSchema),
|
|
2271
|
-
/** This answer's ETag, as the header has it. */
|
|
2272
|
-
tag: zod.z.string().optional(),
|
|
2273
|
-
/**
|
|
2274
|
-
* Present on a delta only: the `seq` of the manifest it is
|
|
2275
|
-
* relative to, whose modules that are not named here did not
|
|
2276
|
-
* move. Absent: every module is named.
|
|
2277
|
-
*/
|
|
2278
|
-
since: zod.z.number().optional(),
|
|
2279
|
-
/**
|
|
2280
|
-
* The build that answered is a previous build still answering
|
|
2281
|
-
* (http mode: the content service counted a newer one live).
|
|
2282
|
-
* Its versions are right for its own bases, which the site does
|
|
2283
|
-
* not serve any more: a Studio does not move to them, and asks
|
|
2284
|
-
* again. Optional: absent from a live build and a server of the
|
|
2285
|
-
* release before.
|
|
2286
|
-
*/
|
|
2287
|
-
superseded: zod.z["boolean"]().optional(),
|
|
2288
|
-
/**
|
|
2289
|
-
* The answering build's `val.modules` registry, as an entry a
|
|
2290
|
-
* Studio can import (`valModulesEntryPath`), and the Val it
|
|
2291
|
-
* runs: where a Studio opened on another build takes this
|
|
2292
|
-
* build's code in without reloading the page. Only a build the
|
|
2293
|
-
* platform made and names (`publishBuild`) has one. Optional
|
|
2294
|
-
* both ways: absent from any other server (local development,
|
|
2295
|
-
* where HMR brings the code; a self-hosted deploy) and from a
|
|
2296
|
-
* server of the release before, and ignored by a Studio of the
|
|
2297
|
-
* release before.
|
|
2298
|
-
*/
|
|
2299
|
-
registry: zod.z.object({
|
|
2300
|
-
entry: zod.z.string(),
|
|
2301
|
-
core: zod.z.string()
|
|
2302
|
-
}).optional()
|
|
2303
|
-
})
|
|
2350
|
+
json: ManifestJson
|
|
2304
2351
|
}),
|
|
2305
2352
|
/*
|
|
2306
2353
|
* Nothing moved since the ETag the client sent. No body on the wire;
|
|
@@ -2317,23 +2364,24 @@ var Api = {
|
|
|
2317
2364
|
req: {
|
|
2318
2365
|
body: zod.z.object({
|
|
2319
2366
|
/**
|
|
2320
|
-
* @deprecated Echoed by
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2323
|
-
*
|
|
2324
|
-
*
|
|
2367
|
+
* @deprecated Echoed by a Studio of the release that shipped the
|
|
2368
|
+
* one content model, whose fs and memory long poll compared it to
|
|
2369
|
+
* see another build; a Studio of the release after echoes
|
|
2370
|
+
* {@link version} instead, and this only when it was sent. The
|
|
2371
|
+
* request field goes once no Studio sends it (see
|
|
2372
|
+
* "Release-delayed deletions" in
|
|
2325
2373
|
* `docs/plans/one-content-model.md`).
|
|
2326
2374
|
*/
|
|
2327
|
-
sourcesSha: zod.z.string(),
|
|
2375
|
+
sourcesSha: zod.z.string().optional(),
|
|
2376
|
+
/** @deprecated As `sourcesSha`. */
|
|
2377
|
+
schemaSha: zod.z.string().optional(),
|
|
2328
2378
|
/**
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
2332
|
-
*
|
|
2333
|
-
* version instead (see "Release-delayed deletions" in
|
|
2334
|
-
* `docs/plans/one-content-model.md`).
|
|
2379
|
+
* The `version` the last answer carried: what the fs and memory
|
|
2380
|
+
* long poll compare to see another build (the build the chain is
|
|
2381
|
+
* relative to, `ValOps.chainBuild`). Optional: a Studio of the
|
|
2382
|
+
* release before echoes the shas.
|
|
2335
2383
|
*/
|
|
2336
|
-
|
|
2384
|
+
version: ProjectVersionSchema.optional(),
|
|
2337
2385
|
baseSha: zod.z.string(),
|
|
2338
2386
|
patches: zod.z.array(zod.z.string()).optional(),
|
|
2339
2387
|
/**
|
|
@@ -2342,7 +2390,17 @@ var Api = {
|
|
|
2342
2390
|
* jsonValues module's source is markers and the content sits behind a
|
|
2343
2391
|
* thunk that `JSON.stringify` drops.
|
|
2344
2392
|
*/
|
|
2345
|
-
jsonEntriesSha: zod.z.string().optional()
|
|
2393
|
+
jsonEntriesSha: zod.z.string().optional(),
|
|
2394
|
+
/**
|
|
2395
|
+
* The manifest the Studio holds, by its ETag and `seq`, so the
|
|
2396
|
+
* answer can carry what moved since (`manifest` on the answer):
|
|
2397
|
+
* `null` when it holds none and can take one. Absent from a
|
|
2398
|
+
* Studio of the release before, which reads `GET /manifest`.
|
|
2399
|
+
*/
|
|
2400
|
+
manifest: zod.z.object({
|
|
2401
|
+
tag: zod.z.string(),
|
|
2402
|
+
seq: zod.z.number()
|
|
2403
|
+
}).nullable().optional()
|
|
2346
2404
|
}).nullable(),
|
|
2347
2405
|
cookies: {
|
|
2348
2406
|
val_session: zod.z.string().optional()
|
|
@@ -2363,21 +2421,16 @@ var Api = {
|
|
|
2363
2421
|
type: zod.z.union([zod.z.literal("request-again"), zod.z.literal("no-change"), zod.z.literal("did-change")]),
|
|
2364
2422
|
baseSha: zod.z.string(),
|
|
2365
2423
|
/**
|
|
2366
|
-
* @deprecated
|
|
2367
|
-
*
|
|
2368
|
-
*
|
|
2369
|
-
*
|
|
2370
|
-
* deletions" in
|
|
2371
|
-
|
|
2372
|
-
schemaSha: zod.z.string(),
|
|
2373
|
-
/**
|
|
2374
|
-
* @deprecated Read by a Studio of the release before
|
|
2375
|
-
* (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
|
|
2376
|
-
* only echoes it, and reads each module's version from
|
|
2377
|
-
* `GET /manifest`. Goes in two steps (see "Release-delayed
|
|
2378
|
-
* deletions" in `docs/plans/one-content-model.md`).
|
|
2424
|
+
* @deprecated Still sent, for a Studio of the release that
|
|
2425
|
+
* shipped the one content model, which echoes it; a Studio of
|
|
2426
|
+
* the release after reads it as optional and echoes `version`.
|
|
2427
|
+
* The server stops sending it in the release after that (see
|
|
2428
|
+
* "Release-delayed deletions" in
|
|
2429
|
+
* `docs/plans/one-content-model.md`).
|
|
2379
2430
|
*/
|
|
2380
|
-
|
|
2431
|
+
schemaSha: zod.z.string().optional(),
|
|
2432
|
+
/** @deprecated As `schemaSha`. */
|
|
2433
|
+
sourcesSha: zod.z.string().optional(),
|
|
2381
2434
|
patches: zod.z.array(PatchId),
|
|
2382
2435
|
/**
|
|
2383
2436
|
* Of `patches`, the ones that have already SHIPPED.
|
|
@@ -2481,28 +2534,25 @@ var Api = {
|
|
|
2481
2534
|
* answers, the higher `seq` is the newer. Optional: a server
|
|
2482
2535
|
* that predates versions sends none.
|
|
2483
2536
|
*/
|
|
2484
|
-
version: ProjectVersionSchema.optional()
|
|
2537
|
+
version: ProjectVersionSchema.optional(),
|
|
2538
|
+
/** See {@link StatManifest}. */
|
|
2539
|
+
manifest: StatManifest.optional()
|
|
2485
2540
|
}), zod.z.object({
|
|
2486
2541
|
type: zod.z.literal("use-websocket"),
|
|
2487
2542
|
url: zod.z.string(),
|
|
2488
2543
|
nonce: zod.z.string(),
|
|
2489
2544
|
baseSha: zod.z.string(),
|
|
2490
2545
|
/**
|
|
2491
|
-
* @deprecated
|
|
2492
|
-
*
|
|
2493
|
-
*
|
|
2494
|
-
*
|
|
2495
|
-
* deletions" in
|
|
2496
|
-
|
|
2497
|
-
schemaSha: zod.z.string(),
|
|
2498
|
-
/**
|
|
2499
|
-
* @deprecated Read by a Studio of the release before
|
|
2500
|
-
* (`BaseAlignment`, `SchemaFreshnessWatch`); this release's
|
|
2501
|
-
* only echoes it, and reads each module's version from
|
|
2502
|
-
* `GET /manifest`. Goes in two steps (see "Release-delayed
|
|
2503
|
-
* deletions" in `docs/plans/one-content-model.md`).
|
|
2546
|
+
* @deprecated Still sent, for a Studio of the release that
|
|
2547
|
+
* shipped the one content model, which echoes it; a Studio of
|
|
2548
|
+
* the release after reads it as optional and echoes `version`.
|
|
2549
|
+
* The server stops sending it in the release after that (see
|
|
2550
|
+
* "Release-delayed deletions" in
|
|
2551
|
+
* `docs/plans/one-content-model.md`).
|
|
2504
2552
|
*/
|
|
2505
|
-
|
|
2553
|
+
schemaSha: zod.z.string().optional(),
|
|
2554
|
+
/** @deprecated As `schemaSha`. */
|
|
2555
|
+
sourcesSha: zod.z.string().optional(),
|
|
2506
2556
|
/**
|
|
2507
2557
|
* The commit this deployment was built from.
|
|
2508
2558
|
*
|
|
@@ -2630,7 +2680,9 @@ var Api = {
|
|
|
2630
2680
|
* answers, the higher `seq` is the newer. Optional: a server
|
|
2631
2681
|
* that predates versions sends none.
|
|
2632
2682
|
*/
|
|
2633
|
-
version: ProjectVersionSchema.optional()
|
|
2683
|
+
version: ProjectVersionSchema.optional(),
|
|
2684
|
+
/** See {@link StatManifest}. */
|
|
2685
|
+
manifest: StatManifest.optional()
|
|
2634
2686
|
})])
|
|
2635
2687
|
})])
|
|
2636
2688
|
}
|
|
@@ -3195,81 +3247,6 @@ var Api = {
|
|
|
3195
3247
|
})])
|
|
3196
3248
|
}
|
|
3197
3249
|
},
|
|
3198
|
-
/**
|
|
3199
|
-
* @deprecated The whole tree. Nothing of this release asks it: the Studio
|
|
3200
|
-
* reads modules by version (`GET /manifest`, `GET /modules/~`), the draft
|
|
3201
|
-
* readers and MCP read the head in-process. Kept, with `exclude_patches`
|
|
3202
|
-
* (`BaseAlignment`'s fetch) and the ignored `validate_sources` and
|
|
3203
|
-
* `validate_binary_files`, for a Studio of the release before; goes in the
|
|
3204
|
-
* release after the one that ships this (see "Release-delayed deletions"
|
|
3205
|
-
* in `docs/plans/one-content-model.md`).
|
|
3206
|
-
*/
|
|
3207
|
-
"/sources/~": {
|
|
3208
|
-
PUT: {
|
|
3209
|
-
req: {
|
|
3210
|
-
path: zod.z.string().optional(),
|
|
3211
|
-
query: {
|
|
3212
|
-
validate_sources: onlyOneBooleanQueryParam.optional(),
|
|
3213
|
-
validate_binary_files: onlyOneBooleanQueryParam.optional(),
|
|
3214
|
-
exclude_patches: onlyOneBooleanQueryParam.optional(),
|
|
3215
|
-
apply_patches: onlyOneBooleanQueryParam.optional()
|
|
3216
|
-
},
|
|
3217
|
-
cookies: {
|
|
3218
|
-
val_session: zod.z.string().optional()
|
|
3219
|
-
}
|
|
3220
|
-
},
|
|
3221
|
-
res: zod.z.union([unauthorizedResponse, zod.z.object({
|
|
3222
|
-
status: zod.z.literal(401),
|
|
3223
|
-
json: GenericError
|
|
3224
|
-
}), zod.z.object({
|
|
3225
|
-
status: zod.z.literal(500),
|
|
3226
|
-
json: zod.z.object({
|
|
3227
|
-
message: zod.z.string(),
|
|
3228
|
-
details: zod.z.union([zod.z.array(ModulesError), GenericError])
|
|
3229
|
-
})
|
|
3230
|
-
}), zod.z.object({
|
|
3231
|
-
status: zod.z.literal(409),
|
|
3232
|
-
json: zod.z.object({
|
|
3233
|
-
message: zod.z.string()
|
|
3234
|
-
})
|
|
3235
|
-
}), zod.z.object({
|
|
3236
|
-
status: zod.z.literal(400),
|
|
3237
|
-
json: zod.z.object({
|
|
3238
|
-
message: zod.z.string(),
|
|
3239
|
-
details: zod.z.array(ModulesError)
|
|
3240
|
-
})
|
|
3241
|
-
}), zod.z.object({
|
|
3242
|
-
status: zod.z.literal(200),
|
|
3243
|
-
json: zod.z.object({
|
|
3244
|
-
schemaSha: zod.z.string(),
|
|
3245
|
-
sourcesSha: zod.z.string(),
|
|
3246
|
-
modules: zod.z.record(ModuleFilePath, zod.z.object({
|
|
3247
|
-
preview: zod.z.any().optional(),
|
|
3248
|
-
// TODO: improve this type
|
|
3249
|
-
source: zod.z.any().optional(),
|
|
3250
|
-
//.optional(), // TODO: Json zod type
|
|
3251
|
-
baseSource: zod.z.any().optional(),
|
|
3252
|
-
// pre-patch source for compare view; only set when the server applies patches (apply_patches=true) and the module has pending patches
|
|
3253
|
-
patches: zod.z.object({
|
|
3254
|
-
applied: zod.z.array(PatchId),
|
|
3255
|
-
skipped: zod.z.array(PatchId).optional(),
|
|
3256
|
-
errors: zod.z.record(PatchId, GenericError).optional()
|
|
3257
|
-
}).optional(),
|
|
3258
|
-
validationErrors: zod.z.record(zod.z.string(), zod.z.array(ValidationError)).optional(),
|
|
3259
|
-
/**
|
|
3260
|
-
* The version of `source` as answered: with the chain the
|
|
3261
|
-
* server applied, or the empty chain when it applied none
|
|
3262
|
-
* (`apply_patches=false`). Optional: an older server sends
|
|
3263
|
-
* none.
|
|
3264
|
-
*/
|
|
3265
|
-
version: ModuleVersionSchema.optional()
|
|
3266
|
-
})),
|
|
3267
|
-
/** The project version this tree was read at. See `/stat`. */
|
|
3268
|
-
project: ProjectVersionSchema.optional()
|
|
3269
|
-
})
|
|
3270
|
-
})])
|
|
3271
|
-
}
|
|
3272
|
-
},
|
|
3273
3250
|
/**
|
|
3274
3251
|
* One module by version: phase 6 of `docs/plans/one-content-model.md`
|
|
3275
3252
|
* ("The Studio loads everything from one place"). `GET /modules/~<path>`,
|
|
@@ -8270,8 +8247,6 @@ var toolNames = ["get_all_schema", "get_source", "search_content", "validate_con
|
|
|
8270
8247
|
* --- /about a route: what follows is the page at /about
|
|
8271
8248
|
* # Our people text (a heading: #, ## or ###)
|
|
8272
8249
|
* We are 40 people in Oslo. text (a paragraph)
|
|
8273
|
-
* ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
|
|
8274
|
-
* in it writes the field
|
|
8275
8250
|
* [image: Team photo] placeholder: [kind] or [kind: label]
|
|
8276
8251
|
* [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
|
|
8277
8252
|
* icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
|
|
@@ -8427,27 +8402,7 @@ function parseSketch(source) {
|
|
|
8427
8402
|
errors: errors
|
|
8428
8403
|
};
|
|
8429
8404
|
}
|
|
8430
|
-
|
|
8431
|
-
/** The link to a content field at the end of a text line. */
|
|
8432
|
-
var FIELD = / \{field: (\/[^{}]*)\}$/;
|
|
8433
|
-
function parseContent(whole, line, errors) {
|
|
8434
|
-
var link = FIELD.exec(whole);
|
|
8435
|
-
if (link) {
|
|
8436
|
-
var node = parseLine(whole.slice(0, link.index), line, errors);
|
|
8437
|
-
if (node.type !== "text") {
|
|
8438
|
-
errors.push({
|
|
8439
|
-
line: line,
|
|
8440
|
-
message: "Only a heading or a paragraph is linked to a field: put {field: ...} at the end of one."
|
|
8441
|
-
});
|
|
8442
|
-
return node;
|
|
8443
|
-
}
|
|
8444
|
-
return createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({}, node), {}, {
|
|
8445
|
-
field: link[1].trim()
|
|
8446
|
-
});
|
|
8447
|
-
}
|
|
8448
|
-
return parseLine(whole, line, errors);
|
|
8449
|
-
}
|
|
8450
|
-
function parseLine(content, line, errors) {
|
|
8405
|
+
function parseContent(content, line, errors) {
|
|
8451
8406
|
// A leading backslash keeps a line that looks like a keyword as text.
|
|
8452
8407
|
if (content.startsWith("\\")) {
|
|
8453
8408
|
return {
|
|
@@ -8554,19 +8509,13 @@ function parseLine(content, line, errors) {
|
|
|
8554
8509
|
* The line a text block is written as. Line breaks become spaces, and a
|
|
8555
8510
|
* paragraph that would read as something else is kept as text with `\`.
|
|
8556
8511
|
*/
|
|
8557
|
-
function formatSketchText(level, text
|
|
8512
|
+
function formatSketchText(level, text) {
|
|
8558
8513
|
var flat = text.replace(/\s+/g, " ").trim();
|
|
8559
|
-
var path = field === null || field === void 0 ? void 0 : field.replace(/\s+/g, " ").trim();
|
|
8560
|
-
// A source path, and one the line can be read back with: no braces.
|
|
8561
|
-
var link = path && /^\/[^{}]*$/.test(path) ? " {field: ".concat(path, "}") : "";
|
|
8562
8514
|
if (level > 0) {
|
|
8563
|
-
return "#".repeat(level) + " " + flat
|
|
8515
|
+
return "#".repeat(level) + " " + flat;
|
|
8564
8516
|
}
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
var whole = flat + link;
|
|
8568
|
-
var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(whole) || ROUTE.test(whole) || HEADING.test(whole) || ICON.test(whole);
|
|
8569
|
-
return (ambiguous ? "\\" + flat : flat) + link;
|
|
8517
|
+
var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(flat) || ROUTE.test(flat) || HEADING.test(flat) || ICON.test(flat);
|
|
8518
|
+
return ambiguous ? "\\" + flat : flat;
|
|
8570
8519
|
}
|
|
8571
8520
|
|
|
8572
8521
|
/** The line a placeholder is written as. */
|
|
@@ -8591,18 +8540,12 @@ function formatSketchBox(placeholder) {
|
|
|
8591
8540
|
*/
|
|
8592
8541
|
function formatSketch(blocks, icons) {
|
|
8593
8542
|
var lines = [];
|
|
8594
|
-
// One block per field: the first keeps the link.
|
|
8595
|
-
var linked = new Set();
|
|
8596
8543
|
var _walk = function walk(node, depth, inRow) {
|
|
8597
8544
|
var indent = " ".repeat(depth);
|
|
8598
8545
|
switch (node.type) {
|
|
8599
8546
|
case "text":
|
|
8600
8547
|
if (node.text) {
|
|
8601
|
-
|
|
8602
|
-
if (field) {
|
|
8603
|
-
linked.add(field);
|
|
8604
|
-
}
|
|
8605
|
-
lines.push(indent + formatSketchText(node.level, node.text, field));
|
|
8548
|
+
lines.push(indent + formatSketchText(node.level, node.text));
|
|
8606
8549
|
}
|
|
8607
8550
|
return;
|
|
8608
8551
|
case "placeholder":
|
|
@@ -8647,26 +8590,6 @@ function formatSketch(blocks, icons) {
|
|
|
8647
8590
|
return all.length > 0 ? all.join("\n") + "\n" : "";
|
|
8648
8591
|
}
|
|
8649
8592
|
|
|
8650
|
-
/**
|
|
8651
|
-
* The text of every block linked to a field, by field: what the Studio
|
|
8652
|
-
* writes to the content when a linked block changes. The first block wins,
|
|
8653
|
-
* as `formatSketch` keeps only its link.
|
|
8654
|
-
*/
|
|
8655
|
-
function sketchFieldTexts(blocks) {
|
|
8656
|
-
var texts = new Map();
|
|
8657
|
-
var _walk2 = function walk(node) {
|
|
8658
|
-
if (node.type === "text") {
|
|
8659
|
-
if (node.field && node.text && !texts.has(node.field)) {
|
|
8660
|
-
texts.set(node.field, node.text.replace(/\s+/g, " ").trim());
|
|
8661
|
-
}
|
|
8662
|
-
} else if (node.type === "row" || node.type === "col") {
|
|
8663
|
-
node.children.forEach(_walk2);
|
|
8664
|
-
}
|
|
8665
|
-
};
|
|
8666
|
-
blocks.forEach(_walk2);
|
|
8667
|
-
return texts;
|
|
8668
|
-
}
|
|
8669
|
-
|
|
8670
8593
|
/** The pages a sketch is about, in the order it gives them. */
|
|
8671
8594
|
function sketchRoutes(blocks) {
|
|
8672
8595
|
return blocks.flatMap(function (block) {
|
|
@@ -11862,6 +11785,7 @@ exports.parseStatus = projectSource.parseStatus;
|
|
|
11862
11785
|
exports.parseUpdateTarget = projectSource.parseUpdateTarget;
|
|
11863
11786
|
exports.parseVerify = projectSource.parseVerify;
|
|
11864
11787
|
exports.publishApiOf = projectSource.publishApiOf;
|
|
11788
|
+
exports.CODE_CHANGED_EVENT = getSitemapTree.CODE_CHANGED_EVENT;
|
|
11865
11789
|
exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
|
|
11866
11790
|
exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
|
|
11867
11791
|
exports.QUICK_PREVIEW_PARAM = getSitemapTree.QUICK_PREVIEW_PARAM;
|
|
@@ -11885,6 +11809,8 @@ exports.getPageRouterSitemapTree = getSitemapTree.getPageRouterSitemapTree;
|
|
|
11885
11809
|
exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
|
|
11886
11810
|
exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
|
|
11887
11811
|
exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
|
|
11812
|
+
exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
|
|
11813
|
+
exports.isCodeChangedDetail = getSitemapTree.isCodeChangedDetail;
|
|
11888
11814
|
exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
|
|
11889
11815
|
exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
|
|
11890
11816
|
exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
|
|
@@ -11928,6 +11854,7 @@ exports.JSONValue = JSONValue;
|
|
|
11928
11854
|
exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
|
|
11929
11855
|
exports.LOCAL_FILE_IN_REMOTE_PROJECT_HINT = LOCAL_FILE_IN_REMOTE_PROJECT_HINT;
|
|
11930
11856
|
exports.LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = LOCAL_FILE_IN_REMOTE_PROJECT_WARNING;
|
|
11857
|
+
exports.ManifestJson = ManifestJson;
|
|
11931
11858
|
exports.ModuleComparison = ModuleComparison;
|
|
11932
11859
|
exports.ModuleVersionSchema = ModuleVersionSchema;
|
|
11933
11860
|
exports.NEVER_ENCODED = NEVER_ENCODED;
|
|
@@ -11985,6 +11912,7 @@ exports.SerializedVideoSchema = SerializedVideoSchema;
|
|
|
11985
11912
|
exports.SharedValConfig = SharedValConfig;
|
|
11986
11913
|
exports.Sketchpad = Sketchpad;
|
|
11987
11914
|
exports.SketchpadSummary = SketchpadSummary;
|
|
11915
|
+
exports.StatManifest = StatManifest;
|
|
11988
11916
|
exports.VAL_CLIENT_HEADER = VAL_CLIENT_HEADER;
|
|
11989
11917
|
exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
|
|
11990
11918
|
exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
|
|
@@ -12083,6 +12011,7 @@ exports.partitionValidationErrors = partitionValidationErrors;
|
|
|
12083
12011
|
exports.pathOfModuleKey = pathOfModuleKey;
|
|
12084
12012
|
exports.performSearch = performSearch;
|
|
12085
12013
|
exports.proposalCustomProperties = proposalCustomProperties;
|
|
12014
|
+
exports.readerSchemaVersion = readerSchemaVersion;
|
|
12086
12015
|
exports.rebaseContentOp = rebaseContentOp;
|
|
12087
12016
|
exports.relativeLuminance = relativeLuminance;
|
|
12088
12017
|
exports.relocateForLocale = relocateForLocale;
|
|
@@ -12107,7 +12036,6 @@ exports.selfCheck = selfCheck;
|
|
|
12107
12036
|
exports.shouldEncodeWithWasm = shouldEncodeWithWasm;
|
|
12108
12037
|
exports.sideFiles = sideFiles;
|
|
12109
12038
|
exports.sideSource = sideSource;
|
|
12110
|
-
exports.sketchFieldTexts = sketchFieldTexts;
|
|
12111
12039
|
exports.sketchRoutes = sketchRoutes;
|
|
12112
12040
|
exports.sketchTitle = sketchTitle;
|
|
12113
12041
|
exports.sourcePathOfChild = sourcePathOfChild;
|