@valbuild/shared 0.153.0 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.153.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1031](https://github.com/valbuild/val/pull/1031) [`6ec1a5d`](https://github.com/valbuild/val/commit/6ec1a5d244f0d6e064eca4135f167dfa79744f9a) Thanks [@freekh](https://github.com/freekh)! - A page no longer shows content made for code it does not have yet. When the Studio is ahead of the page (it picked up a code change first, or the browser is still running the previous build), the page keeps showing its own content for the modules whose schema changed, and says "The code changed" with a **Reload** button — in the overlay on your site, and above the page in the Studio. In local development the page usually catches up a moment later by itself, and the notice goes away without a reload.
8
+
9
+ - [#1027](https://github.com/valbuild/val/pull/1027) [`b14870b`](https://github.com/valbuild/val/commit/b14870bebdc128234bb16e4ea06a0151d18c4771) Thanks [@freekh](https://github.com/freekh)! - The Sketchpad's linked text is gone, and so are its "needs code" badges.
10
+
11
+ - **Linked text is removed.** A heading or paragraph can no longer be linked to a content field (`{field: …}`), and typing in a sketchpad never changes the site's content: the sketch is a plan, and **Build** is what changes the pages. A sketch that still has a `{field: …}` from 0.152.0 shows it as plain text, and can be deleted.
12
+ - **No "needs code" badges.** A box of a kind the site does not have, and a new route the site has no page type for, are no longer marked. A box's kind still suggests the site's own kinds.
13
+ - **Narrow columns keep their shape.** In a row of several columns, a box's header stays on one line (a long kind is cut short, and shown in full on hover), and a box naming an image the project does not have says so in a few lines, with the file's name on one, instead of breaking the path over many.
14
+
3
15
  ## 0.153.0
4
16
 
5
17
  ### Minor Changes
@@ -2,12 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var getSitemapTree = require('../../dist/getSitemapTree-32643b50.cjs.dev.js');
5
+ var getSitemapTree = require('../../dist/getSitemapTree-09399379.cjs.dev.js');
6
6
  require('../../dist/createForOfIteratorHelper-f2d7ac6d.cjs.dev.js');
7
7
  require('@valbuild/core');
8
8
 
9
9
 
10
10
 
11
+ exports.CODE_CHANGED_EVENT = getSitemapTree.CODE_CHANGED_EVENT;
11
12
  exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
12
13
  exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
13
14
  exports.QUICK_PREVIEW_PARAM = getSitemapTree.QUICK_PREVIEW_PARAM;
@@ -32,6 +33,7 @@ exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
32
33
  exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
33
34
  exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
34
35
  exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
36
+ exports.isCodeChangedDetail = getSitemapTree.isCodeChangedDetail;
35
37
  exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
36
38
  exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
37
39
  exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
@@ -2,12 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var getSitemapTree = require('../../dist/getSitemapTree-a4738117.cjs.prod.js');
5
+ var getSitemapTree = require('../../dist/getSitemapTree-7ed70b4a.cjs.prod.js');
6
6
  require('../../dist/createForOfIteratorHelper-9ca2078d.cjs.prod.js');
7
7
  require('@valbuild/core');
8
8
 
9
9
 
10
10
 
11
+ exports.CODE_CHANGED_EVENT = getSitemapTree.CODE_CHANGED_EVENT;
11
12
  exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
12
13
  exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
13
14
  exports.QUICK_PREVIEW_PARAM = getSitemapTree.QUICK_PREVIEW_PARAM;
@@ -32,6 +33,7 @@ exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
32
33
  exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
33
34
  exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
34
35
  exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
36
+ exports.isCodeChangedDetail = getSitemapTree.isCodeChangedDetail;
35
37
  exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
36
38
  exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
37
39
  exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
@@ -1,3 +1,3 @@
1
- export { D as DEFAULT_CANVAS_SELECTION, e as DEFAULT_CANVAS_SELECTION_SOFT, Q as QUICK_PREVIEW_PARAM, x as QUICK_PREVIEW_RENDER_SCRIPT, v as QUICK_PREVIEW_SERVICE_WORKER_PATH, A as QUICK_PREVIEW_SERVICE_WORKER_SOURCE, y 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, k as attachElementPicker, l as createPickerOverlay, j as describeElement, n as elementLabel, t as findBySelector, F as formatRoutePattern, G as getNextAppRouterSourceFolder, K as getPageRouterSitemapTree, I as getPageRouterSourceFolder, L as getPatternFromModuleFilePath, H as getTanStackRouterSourceFolder, f as isCanvasSelectionColor, z as isQuickPreviewFiles, J as isTanStackRoutesFolder, h as isValCanvasFrame, i as isValCanvasPageMessage, g as isValCanvasStudioMessage, m as modifierLabel, p as pageLocationOf, E as parseRoutePattern, q as readPageSnapshot, r as restoreScroll, u as screenshotPage, s as startElementPicking, B as storeQuickPreview, o as watchPageLocation, C as withQuickPreviewParam, w as withValCanvasParam } from '../../dist/getSitemapTree-a887fed4.esm.js';
1
+ 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';
2
2
  import '../../dist/createForOfIteratorHelper-9b80f1a2.esm.js';
3
3
  import '@valbuild/core';
@@ -16,6 +16,7 @@
16
16
  */
17
17
  export * from "../internal/sessionStorage.js";
18
18
  export * from "../internal/valCanvasProtocol.js";
19
+ export * from "../internal/codeChangedEvent.js";
19
20
  export * from "../internal/elementPicker.js";
20
21
  export * from "../internal/pageInspection.js";
21
22
  export * from "../internal/pageScreenshot.js";
@@ -0,0 +1,15 @@
1
+ import type { ModuleFilePath } from "@valbuild/core";
2
+ /**
3
+ * The `val-overlay-spa` event a page sends when what it renders and what the
4
+ * Studio relays have stopped agreeing about the code: these modules came
5
+ * made with another schema than this page's build has. The on-site overlay
6
+ * shows it with a reload; in the Studio's canvas the bridge passes it on
7
+ * (`codeChanged` in `valCanvasProtocol.ts`). An empty list takes it back.
8
+ */
9
+ export declare const CODE_CHANGED_EVENT = "codeChanged";
10
+ export type CodeChangedDetail = {
11
+ type: typeof CODE_CHANGED_EVENT;
12
+ modules: ModuleFilePath[];
13
+ };
14
+ /** Whether a `val-overlay-spa` event's detail is a {@link CodeChangedDetail}. */
15
+ export declare function isCodeChangedDetail(detail: unknown): detail is CodeChangedDetail;
@@ -1,4 +1,4 @@
1
- import { type ModuleFilePath, type PatchId } from "@valbuild/core";
1
+ import { type ModuleFilePath, type PatchId, type SelectorSource, type ValModule } from "@valbuild/core";
2
2
  import { z } from "zod";
3
3
  /**
4
4
  * What a module's content IS: the schema it is read and patched with, the
@@ -81,6 +81,15 @@ export declare function chainOf(ids: readonly PatchId[]): string;
81
81
  * (from what it holds in `SchemaStore`), so the two compare.
82
82
  */
83
83
  export declare function schemaVersionOf(serializedSchema: unknown): string;
84
+ /**
85
+ * The version of the schema a reader's own code has for a module: what the
86
+ * readers hold relayed or drafted content's version against (`layered`'s
87
+ * schema rule), so content is never read with a schema it was not made for.
88
+ * The server readers (`fetchVal`) and the page's hooks (`useVal`) alike.
89
+ * Hashed once per module object, which a build makes once: a load cost, not
90
+ * a read cost.
91
+ */
92
+ export declare function readerSchemaVersion(module: ValModule<SelectorSource>): string | null;
84
93
  /**
85
94
  * A module's base version, from its base source: what the module evaluates
86
95
  * to, or what a content version or a publish put in its place. `.jsonValues()`
@@ -58,3 +58,4 @@ export * from "./patchSets/selectionClosure.js";
58
58
  export * from "./patchSets/schemaTypesOfPath.js";
59
59
  export * from "./proposalMerge/trees.js";
60
60
  export * from "./selfCheck.js";
61
+ export * from "./codeChangedEvent.js";
@@ -5,8 +5,6 @@
5
5
  * --- /about a route: what follows is the page at /about
6
6
  * # Our people text (a heading: #, ## or ###)
7
7
  * We are 40 people in Oslo. text (a paragraph)
8
- * ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
9
- * in it writes the field
10
8
  * [image: Team photo] placeholder: [kind] or [kind: label]
11
9
  * [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
12
10
  * icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
@@ -62,13 +60,6 @@ export type SketchText = {
62
60
  /** 0 is a paragraph; 1-3 are headings. */
63
61
  level: 0 | 1 | 2 | 3;
64
62
  text: string;
65
- /**
66
- * The content field this text is linked to, as a source path
67
- * (`/content/home.val.ts?p="hero"."title"`): typing in the block writes
68
- * the field. Written `{field: <source path>}` at the end of the line. One
69
- * block per field: a second link to the same field is not one.
70
- */
71
- field?: string;
72
63
  };
73
64
  export type SketchPlaceholder = {
74
65
  type: "placeholder";
@@ -109,7 +100,7 @@ export declare function parseSketch(source: string): ParsedSketch;
109
100
  * The line a text block is written as. Line breaks become spaces, and a
110
101
  * paragraph that would read as something else is kept as text with `\`.
111
102
  */
112
- export declare function formatSketchText(level: SketchText["level"], text: string, field?: string): string;
103
+ export declare function formatSketchText(level: SketchText["level"], text: string): string;
113
104
  /** The line a placeholder is written as. */
114
105
  export declare function formatSketchBox(placeholder: Pick<SketchPlaceholder, "kind" | "label" | "media">): string;
115
106
  /**
@@ -122,12 +113,6 @@ export declare function formatSketchBox(placeholder: Pick<SketchPlaceholder, "ki
122
113
  * it is not on the page.
123
114
  */
124
115
  export declare function formatSketch(blocks: SketchNode[], icons: Record<string, string>): string;
125
- /**
126
- * The text of every block linked to a field, by field: what the Studio
127
- * writes to the content when a linked block changes. The first block wins,
128
- * as `formatSketch` keeps only its link.
129
- */
130
- export declare function sketchFieldTexts(blocks: SketchNode[]): Map<string, string>;
131
116
  /** The pages a sketch is about, in the order it gives them. */
132
117
  export declare function sketchRoutes(blocks: SketchNode[]): string[];
133
118
  /**
@@ -252,6 +252,16 @@ export type ValCanvasPageMessage = {
252
252
  type: "quickPreviewStored";
253
253
  id: string;
254
254
  error?: string;
255
+ } | {
256
+ /**
257
+ * Modules the Studio sent made with another schema than this page's
258
+ * build has: the page shows its bundle's content for them instead, and
259
+ * the Studio says the code changed, with a reload. An empty list: the
260
+ * page's code caught up (`CodeChangedDetail`).
261
+ */
262
+ val: typeof VAL_CANVAS_MESSAGE;
263
+ type: "codeChanged";
264
+ modules: ModuleFilePath[];
255
265
  };
256
266
  /** What the studio tells the page. */
257
267
  export type ValCanvasStudioMessage = {
@@ -250,7 +250,7 @@ function isValCanvasPageMessage(data) {
250
250
  if (createForOfIteratorHelper._typeof(data) !== "object" || data === null) return false;
251
251
  var message = data;
252
252
  if (message.val !== VAL_CANVAS_MESSAGE) return false;
253
- return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
253
+ return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string" || message.type === "codeChanged" && Array.isArray(data.modules) && isModulePathList(data.modules);
254
254
  }
255
255
 
256
256
  /** `holdsVersions` on `ready`: absent, or a version per module path. */
@@ -373,6 +373,24 @@ function withValCanvasParam(url) {
373
373
  return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
374
374
  }
375
375
 
376
+ /**
377
+ * The `val-overlay-spa` event a page sends when what it renders and what the
378
+ * Studio relays have stopped agreeing about the code: these modules came
379
+ * made with another schema than this page's build has. The on-site overlay
380
+ * shows it with a reload; in the Studio's canvas the bridge passes it on
381
+ * (`codeChanged` in `valCanvasProtocol.ts`). An empty list takes it back.
382
+ */
383
+ var CODE_CHANGED_EVENT = "codeChanged";
384
+ /** Whether a `val-overlay-spa` event's detail is a {@link CodeChangedDetail}. */
385
+ function isCodeChangedDetail(detail) {
386
+ if (createForOfIteratorHelper._typeof(detail) !== "object" || detail === null) return false;
387
+ if (!("type" in detail) || detail.type !== CODE_CHANGED_EVENT) return false;
388
+ if (!("modules" in detail) || !Array.isArray(detail.modules)) return false;
389
+ return detail.modules.every(function (module) {
390
+ return typeof module === "string" && module.startsWith("/");
391
+ });
392
+ }
393
+
376
394
  /**
377
395
  * Pointing at anything on a page, as Lovable's picker does: hover outlines
378
396
  * the element under the pointer, a click picks it, and the assistant is told
@@ -1464,6 +1482,7 @@ function getPatternFromModuleFilePath(moduleFilePath, srcFolder) {
1464
1482
  .replace("/page.val.ts", "").replace("/page.val.js", "");
1465
1483
  }
1466
1484
 
1485
+ exports.CODE_CHANGED_EVENT = CODE_CHANGED_EVENT;
1467
1486
  exports.DEFAULT_CANVAS_SELECTION = DEFAULT_CANVAS_SELECTION;
1468
1487
  exports.DEFAULT_CANVAS_SELECTION_SOFT = DEFAULT_CANVAS_SELECTION_SOFT;
1469
1488
  exports.QUICK_PREVIEW_PARAM = QUICK_PREVIEW_PARAM;
@@ -1488,6 +1507,7 @@ exports.getPageRouterSourceFolder = getPageRouterSourceFolder;
1488
1507
  exports.getPatternFromModuleFilePath = getPatternFromModuleFilePath;
1489
1508
  exports.getTanStackRouterSourceFolder = getTanStackRouterSourceFolder;
1490
1509
  exports.isCanvasSelectionColor = isCanvasSelectionColor;
1510
+ exports.isCodeChangedDetail = isCodeChangedDetail;
1491
1511
  exports.isQuickPreviewFiles = isQuickPreviewFiles;
1492
1512
  exports.isTanStackRoutesFolder = isTanStackRoutesFolder;
1493
1513
  exports.isValCanvasFrame = isValCanvasFrame;
@@ -230,7 +230,7 @@ function isValCanvasPageMessage(data) {
230
230
  if (_typeof(data) !== "object" || data === null) return false;
231
231
  var message = data;
232
232
  if (message.val !== VAL_CANVAS_MESSAGE) return false;
233
- return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
233
+ return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string" || message.type === "codeChanged" && Array.isArray(data.modules) && isModulePathList(data.modules);
234
234
  }
235
235
 
236
236
  /** `holdsVersions` on `ready`: absent, or a version per module path. */
@@ -353,6 +353,24 @@ function withValCanvasParam(url) {
353
353
  return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
354
354
  }
355
355
 
356
+ /**
357
+ * The `val-overlay-spa` event a page sends when what it renders and what the
358
+ * Studio relays have stopped agreeing about the code: these modules came
359
+ * made with another schema than this page's build has. The on-site overlay
360
+ * shows it with a reload; in the Studio's canvas the bridge passes it on
361
+ * (`codeChanged` in `valCanvasProtocol.ts`). An empty list takes it back.
362
+ */
363
+ var CODE_CHANGED_EVENT = "codeChanged";
364
+ /** Whether a `val-overlay-spa` event's detail is a {@link CodeChangedDetail}. */
365
+ function isCodeChangedDetail(detail) {
366
+ if (_typeof(detail) !== "object" || detail === null) return false;
367
+ if (!("type" in detail) || detail.type !== CODE_CHANGED_EVENT) return false;
368
+ if (!("modules" in detail) || !Array.isArray(detail.modules)) return false;
369
+ return detail.modules.every(function (module) {
370
+ return typeof module === "string" && module.startsWith("/");
371
+ });
372
+ }
373
+
356
374
  /**
357
375
  * Pointing at anything on a page, as Lovable's picker does: hover outlines
358
376
  * the element under the pointer, a click picks it, and the assistant is told
@@ -1444,4 +1462,4 @@ function getPatternFromModuleFilePath(moduleFilePath, srcFolder) {
1444
1462
  .replace("/page.val.ts", "").replace("/page.val.js", "");
1445
1463
  }
1446
1464
 
1447
- export { QUICK_PREVIEW_SERVICE_WORKER_SOURCE as A, storeQuickPreview as B, withQuickPreviewParam as C, DEFAULT_CANVAS_SELECTION as D, parseRoutePattern as E, formatRoutePattern as F, getNextAppRouterSourceFolder as G, getTanStackRouterSourceFolder as H, getPageRouterSourceFolder as I, isTanStackRoutesFolder as J, getPageRouterSitemapTree as K, getPatternFromModuleFilePath as L, QUICK_PREVIEW_PARAM as Q, VAL_CONFIG_SESSION_STORAGE_KEY as V, VAL_THEME_SESSION_STORAGE_KEY as a, VAL_AI_SESSION_STORAGE_KEY as b, VAL_CANVAS_PARAM as c, VAL_CANVAS_MESSAGE as d, DEFAULT_CANVAS_SELECTION_SOFT as e, isCanvasSelectionColor as f, isValCanvasStudioMessage as g, isValCanvasFrame as h, isValCanvasPageMessage as i, describeElement as j, attachElementPicker as k, createPickerOverlay as l, modifierLabel as m, elementLabel as n, watchPageLocation as o, pageLocationOf as p, readPageSnapshot as q, restoreScroll as r, startElementPicking as s, findBySelector as t, screenshotPage as u, QUICK_PREVIEW_SERVICE_WORKER_PATH as v, withValCanvasParam as w, QUICK_PREVIEW_RENDER_SCRIPT as x, QUICK_PREVIEW_STORE_MESSAGE as y, isQuickPreviewFiles as z };
1465
+ export { isQuickPreviewFiles as A, QUICK_PREVIEW_SERVICE_WORKER_SOURCE as B, CODE_CHANGED_EVENT as C, DEFAULT_CANVAS_SELECTION as D, storeQuickPreview as E, withQuickPreviewParam as F, parseRoutePattern as G, formatRoutePattern as H, getNextAppRouterSourceFolder as I, getTanStackRouterSourceFolder as J, getPageRouterSourceFolder as K, isTanStackRoutesFolder as L, getPageRouterSitemapTree as M, getPatternFromModuleFilePath as N, QUICK_PREVIEW_PARAM as Q, VAL_CONFIG_SESSION_STORAGE_KEY as V, VAL_THEME_SESSION_STORAGE_KEY as a, VAL_AI_SESSION_STORAGE_KEY as b, VAL_CANVAS_PARAM as c, VAL_CANVAS_MESSAGE as d, DEFAULT_CANVAS_SELECTION_SOFT as e, isCanvasSelectionColor as f, isValCanvasStudioMessage as g, isValCanvasFrame as h, isValCanvasPageMessage as i, isCodeChangedDetail as j, describeElement as k, attachElementPicker as l, modifierLabel as m, createPickerOverlay as n, elementLabel as o, pageLocationOf as p, watchPageLocation as q, restoreScroll as r, startElementPicking as s, readPageSnapshot as t, findBySelector as u, screenshotPage as v, withValCanvasParam as w, QUICK_PREVIEW_SERVICE_WORKER_PATH as x, QUICK_PREVIEW_RENDER_SCRIPT as y, QUICK_PREVIEW_STORE_MESSAGE as z };
@@ -250,7 +250,7 @@ function isValCanvasPageMessage(data) {
250
250
  if (createForOfIteratorHelper._typeof(data) !== "object" || data === null) return false;
251
251
  var message = data;
252
252
  if (message.val !== VAL_CANVAS_MESSAGE) return false;
253
- return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
253
+ return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string" || message.type === "codeChanged" && Array.isArray(data.modules) && isModulePathList(data.modules);
254
254
  }
255
255
 
256
256
  /** `holdsVersions` on `ready`: absent, or a version per module path. */
@@ -373,6 +373,24 @@ function withValCanvasParam(url) {
373
373
  return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
374
374
  }
375
375
 
376
+ /**
377
+ * The `val-overlay-spa` event a page sends when what it renders and what the
378
+ * Studio relays have stopped agreeing about the code: these modules came
379
+ * made with another schema than this page's build has. The on-site overlay
380
+ * shows it with a reload; in the Studio's canvas the bridge passes it on
381
+ * (`codeChanged` in `valCanvasProtocol.ts`). An empty list takes it back.
382
+ */
383
+ var CODE_CHANGED_EVENT = "codeChanged";
384
+ /** Whether a `val-overlay-spa` event's detail is a {@link CodeChangedDetail}. */
385
+ function isCodeChangedDetail(detail) {
386
+ if (createForOfIteratorHelper._typeof(detail) !== "object" || detail === null) return false;
387
+ if (!("type" in detail) || detail.type !== CODE_CHANGED_EVENT) return false;
388
+ if (!("modules" in detail) || !Array.isArray(detail.modules)) return false;
389
+ return detail.modules.every(function (module) {
390
+ return typeof module === "string" && module.startsWith("/");
391
+ });
392
+ }
393
+
376
394
  /**
377
395
  * Pointing at anything on a page, as Lovable's picker does: hover outlines
378
396
  * the element under the pointer, a click picks it, and the assistant is told
@@ -1464,6 +1482,7 @@ function getPatternFromModuleFilePath(moduleFilePath, srcFolder) {
1464
1482
  .replace("/page.val.ts", "").replace("/page.val.js", "");
1465
1483
  }
1466
1484
 
1485
+ exports.CODE_CHANGED_EVENT = CODE_CHANGED_EVENT;
1467
1486
  exports.DEFAULT_CANVAS_SELECTION = DEFAULT_CANVAS_SELECTION;
1468
1487
  exports.DEFAULT_CANVAS_SELECTION_SOFT = DEFAULT_CANVAS_SELECTION_SOFT;
1469
1488
  exports.QUICK_PREVIEW_PARAM = QUICK_PREVIEW_PARAM;
@@ -1488,6 +1507,7 @@ exports.getPageRouterSourceFolder = getPageRouterSourceFolder;
1488
1507
  exports.getPatternFromModuleFilePath = getPatternFromModuleFilePath;
1489
1508
  exports.getTanStackRouterSourceFolder = getTanStackRouterSourceFolder;
1490
1509
  exports.isCanvasSelectionColor = isCanvasSelectionColor;
1510
+ exports.isCodeChangedDetail = isCodeChangedDetail;
1491
1511
  exports.isQuickPreviewFiles = isQuickPreviewFiles;
1492
1512
  exports.isTanStackRoutesFolder = isTanStackRoutesFolder;
1493
1513
  exports.isValCanvasFrame = isValCanvasFrame;
@@ -10,7 +10,7 @@ var wrapNativeSuper = require('../../dist/wrapNativeSuper-933f991e.cjs.dev.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-32643b50.cjs.dev.js');
13
+ var getSitemapTree = require('../../dist/getSitemapTree-09399379.cjs.dev.js');
14
14
  var FlexSearch = require('flexsearch');
15
15
  var utils = require('../../dist/utils-d3d8b4b5.cjs.dev.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
@@ -8229,8 +8247,6 @@ var toolNames = ["get_all_schema", "get_source", "search_content", "validate_con
8229
8247
  * --- /about a route: what follows is the page at /about
8230
8248
  * # Our people text (a heading: #, ## or ###)
8231
8249
  * We are 40 people in Oslo. text (a paragraph)
8232
- * ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
8233
- * in it writes the field
8234
8250
  * [image: Team photo] placeholder: [kind] or [kind: label]
8235
8251
  * [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
8236
8252
  * icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
@@ -8386,27 +8402,7 @@ function parseSketch(source) {
8386
8402
  errors: errors
8387
8403
  };
8388
8404
  }
8389
-
8390
- /** The link to a content field at the end of a text line. */
8391
- var FIELD = / \{field: (\/[^{}]*)\}$/;
8392
- function parseContent(whole, line, errors) {
8393
- var link = FIELD.exec(whole);
8394
- if (link) {
8395
- var node = parseLine(whole.slice(0, link.index), line, errors);
8396
- if (node.type !== "text") {
8397
- errors.push({
8398
- line: line,
8399
- message: "Only a heading or a paragraph is linked to a field: put {field: ...} at the end of one."
8400
- });
8401
- return node;
8402
- }
8403
- return createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({}, node), {}, {
8404
- field: link[1].trim()
8405
- });
8406
- }
8407
- return parseLine(whole, line, errors);
8408
- }
8409
- function parseLine(content, line, errors) {
8405
+ function parseContent(content, line, errors) {
8410
8406
  // A leading backslash keeps a line that looks like a keyword as text.
8411
8407
  if (content.startsWith("\\")) {
8412
8408
  return {
@@ -8513,19 +8509,13 @@ function parseLine(content, line, errors) {
8513
8509
  * The line a text block is written as. Line breaks become spaces, and a
8514
8510
  * paragraph that would read as something else is kept as text with `\`.
8515
8511
  */
8516
- function formatSketchText(level, text, field) {
8512
+ function formatSketchText(level, text) {
8517
8513
  var flat = text.replace(/\s+/g, " ").trim();
8518
- var path = field === null || field === void 0 ? void 0 : field.replace(/\s+/g, " ").trim();
8519
- // A source path, and one the line can be read back with: no braces.
8520
- var link = path && /^\/[^{}]*$/.test(path) ? " {field: ".concat(path, "}") : "";
8521
8514
  if (level > 0) {
8522
- return "#".repeat(level) + " " + flat + link;
8515
+ return "#".repeat(level) + " " + flat;
8523
8516
  }
8524
- // Read as the whole line will be, link and all: `icon x M` is text, and
8525
- // `icon x M {field: ...}` would be an icon.
8526
- var whole = flat + link;
8527
- var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(whole) || ROUTE.test(whole) || HEADING.test(whole) || ICON.test(whole);
8528
- 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;
8529
8519
  }
8530
8520
 
8531
8521
  /** The line a placeholder is written as. */
@@ -8550,18 +8540,12 @@ function formatSketchBox(placeholder) {
8550
8540
  */
8551
8541
  function formatSketch(blocks, icons) {
8552
8542
  var lines = [];
8553
- // One block per field: the first keeps the link.
8554
- var linked = new Set();
8555
8543
  var _walk = function walk(node, depth, inRow) {
8556
8544
  var indent = " ".repeat(depth);
8557
8545
  switch (node.type) {
8558
8546
  case "text":
8559
8547
  if (node.text) {
8560
- var field = node.field && !linked.has(node.field) ? node.field : undefined;
8561
- if (field) {
8562
- linked.add(field);
8563
- }
8564
- lines.push(indent + formatSketchText(node.level, node.text, field));
8548
+ lines.push(indent + formatSketchText(node.level, node.text));
8565
8549
  }
8566
8550
  return;
8567
8551
  case "placeholder":
@@ -8606,26 +8590,6 @@ function formatSketch(blocks, icons) {
8606
8590
  return all.length > 0 ? all.join("\n") + "\n" : "";
8607
8591
  }
8608
8592
 
8609
- /**
8610
- * The text of every block linked to a field, by field: what the Studio
8611
- * writes to the content when a linked block changes. The first block wins,
8612
- * as `formatSketch` keeps only its link.
8613
- */
8614
- function sketchFieldTexts(blocks) {
8615
- var texts = new Map();
8616
- var _walk2 = function walk(node) {
8617
- if (node.type === "text") {
8618
- if (node.field && node.text && !texts.has(node.field)) {
8619
- texts.set(node.field, node.text.replace(/\s+/g, " ").trim());
8620
- }
8621
- } else if (node.type === "row" || node.type === "col") {
8622
- node.children.forEach(_walk2);
8623
- }
8624
- };
8625
- blocks.forEach(_walk2);
8626
- return texts;
8627
- }
8628
-
8629
8593
  /** The pages a sketch is about, in the order it gives them. */
8630
8594
  function sketchRoutes(blocks) {
8631
8595
  return blocks.flatMap(function (block) {
@@ -11821,6 +11785,7 @@ exports.parseStatus = projectSource.parseStatus;
11821
11785
  exports.parseUpdateTarget = projectSource.parseUpdateTarget;
11822
11786
  exports.parseVerify = projectSource.parseVerify;
11823
11787
  exports.publishApiOf = projectSource.publishApiOf;
11788
+ exports.CODE_CHANGED_EVENT = getSitemapTree.CODE_CHANGED_EVENT;
11824
11789
  exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
11825
11790
  exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
11826
11791
  exports.QUICK_PREVIEW_PARAM = getSitemapTree.QUICK_PREVIEW_PARAM;
@@ -11845,6 +11810,7 @@ exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
11845
11810
  exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
11846
11811
  exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
11847
11812
  exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
11813
+ exports.isCodeChangedDetail = getSitemapTree.isCodeChangedDetail;
11848
11814
  exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
11849
11815
  exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
11850
11816
  exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
@@ -12045,6 +12011,7 @@ exports.partitionValidationErrors = partitionValidationErrors;
12045
12011
  exports.pathOfModuleKey = pathOfModuleKey;
12046
12012
  exports.performSearch = performSearch;
12047
12013
  exports.proposalCustomProperties = proposalCustomProperties;
12014
+ exports.readerSchemaVersion = readerSchemaVersion;
12048
12015
  exports.rebaseContentOp = rebaseContentOp;
12049
12016
  exports.relativeLuminance = relativeLuminance;
12050
12017
  exports.relocateForLocale = relocateForLocale;
@@ -12069,7 +12036,6 @@ exports.selfCheck = selfCheck;
12069
12036
  exports.shouldEncodeWithWasm = shouldEncodeWithWasm;
12070
12037
  exports.sideFiles = sideFiles;
12071
12038
  exports.sideSource = sideSource;
12072
- exports.sketchFieldTexts = sketchFieldTexts;
12073
12039
  exports.sketchRoutes = sketchRoutes;
12074
12040
  exports.sketchTitle = sketchTitle;
12075
12041
  exports.sourcePathOfChild = sourcePathOfChild;
@@ -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-a4738117.cjs.prod.js');
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
@@ -8229,8 +8247,6 @@ var toolNames = ["get_all_schema", "get_source", "search_content", "validate_con
8229
8247
  * --- /about a route: what follows is the page at /about
8230
8248
  * # Our people text (a heading: #, ## or ###)
8231
8249
  * We are 40 people in Oslo. text (a paragraph)
8232
- * ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
8233
- * in it writes the field
8234
8250
  * [image: Team photo] placeholder: [kind] or [kind: label]
8235
8251
  * [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
8236
8252
  * icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
@@ -8386,27 +8402,7 @@ function parseSketch(source) {
8386
8402
  errors: errors
8387
8403
  };
8388
8404
  }
8389
-
8390
- /** The link to a content field at the end of a text line. */
8391
- var FIELD = / \{field: (\/[^{}]*)\}$/;
8392
- function parseContent(whole, line, errors) {
8393
- var link = FIELD.exec(whole);
8394
- if (link) {
8395
- var node = parseLine(whole.slice(0, link.index), line, errors);
8396
- if (node.type !== "text") {
8397
- errors.push({
8398
- line: line,
8399
- message: "Only a heading or a paragraph is linked to a field: put {field: ...} at the end of one."
8400
- });
8401
- return node;
8402
- }
8403
- return createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({}, node), {}, {
8404
- field: link[1].trim()
8405
- });
8406
- }
8407
- return parseLine(whole, line, errors);
8408
- }
8409
- function parseLine(content, line, errors) {
8405
+ function parseContent(content, line, errors) {
8410
8406
  // A leading backslash keeps a line that looks like a keyword as text.
8411
8407
  if (content.startsWith("\\")) {
8412
8408
  return {
@@ -8513,19 +8509,13 @@ function parseLine(content, line, errors) {
8513
8509
  * The line a text block is written as. Line breaks become spaces, and a
8514
8510
  * paragraph that would read as something else is kept as text with `\`.
8515
8511
  */
8516
- function formatSketchText(level, text, field) {
8512
+ function formatSketchText(level, text) {
8517
8513
  var flat = text.replace(/\s+/g, " ").trim();
8518
- var path = field === null || field === void 0 ? void 0 : field.replace(/\s+/g, " ").trim();
8519
- // A source path, and one the line can be read back with: no braces.
8520
- var link = path && /^\/[^{}]*$/.test(path) ? " {field: ".concat(path, "}") : "";
8521
8514
  if (level > 0) {
8522
- return "#".repeat(level) + " " + flat + link;
8515
+ return "#".repeat(level) + " " + flat;
8523
8516
  }
8524
- // Read as the whole line will be, link and all: `icon x M` is text, and
8525
- // `icon x M {field: ...}` would be an icon.
8526
- var whole = flat + link;
8527
- var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(whole) || ROUTE.test(whole) || HEADING.test(whole) || ICON.test(whole);
8528
- 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;
8529
8519
  }
8530
8520
 
8531
8521
  /** The line a placeholder is written as. */
@@ -8550,18 +8540,12 @@ function formatSketchBox(placeholder) {
8550
8540
  */
8551
8541
  function formatSketch(blocks, icons) {
8552
8542
  var lines = [];
8553
- // One block per field: the first keeps the link.
8554
- var linked = new Set();
8555
8543
  var _walk = function walk(node, depth, inRow) {
8556
8544
  var indent = " ".repeat(depth);
8557
8545
  switch (node.type) {
8558
8546
  case "text":
8559
8547
  if (node.text) {
8560
- var field = node.field && !linked.has(node.field) ? node.field : undefined;
8561
- if (field) {
8562
- linked.add(field);
8563
- }
8564
- lines.push(indent + formatSketchText(node.level, node.text, field));
8548
+ lines.push(indent + formatSketchText(node.level, node.text));
8565
8549
  }
8566
8550
  return;
8567
8551
  case "placeholder":
@@ -8606,26 +8590,6 @@ function formatSketch(blocks, icons) {
8606
8590
  return all.length > 0 ? all.join("\n") + "\n" : "";
8607
8591
  }
8608
8592
 
8609
- /**
8610
- * The text of every block linked to a field, by field: what the Studio
8611
- * writes to the content when a linked block changes. The first block wins,
8612
- * as `formatSketch` keeps only its link.
8613
- */
8614
- function sketchFieldTexts(blocks) {
8615
- var texts = new Map();
8616
- var _walk2 = function walk(node) {
8617
- if (node.type === "text") {
8618
- if (node.field && node.text && !texts.has(node.field)) {
8619
- texts.set(node.field, node.text.replace(/\s+/g, " ").trim());
8620
- }
8621
- } else if (node.type === "row" || node.type === "col") {
8622
- node.children.forEach(_walk2);
8623
- }
8624
- };
8625
- blocks.forEach(_walk2);
8626
- return texts;
8627
- }
8628
-
8629
8593
  /** The pages a sketch is about, in the order it gives them. */
8630
8594
  function sketchRoutes(blocks) {
8631
8595
  return blocks.flatMap(function (block) {
@@ -11821,6 +11785,7 @@ exports.parseStatus = projectSource.parseStatus;
11821
11785
  exports.parseUpdateTarget = projectSource.parseUpdateTarget;
11822
11786
  exports.parseVerify = projectSource.parseVerify;
11823
11787
  exports.publishApiOf = projectSource.publishApiOf;
11788
+ exports.CODE_CHANGED_EVENT = getSitemapTree.CODE_CHANGED_EVENT;
11824
11789
  exports.DEFAULT_CANVAS_SELECTION = getSitemapTree.DEFAULT_CANVAS_SELECTION;
11825
11790
  exports.DEFAULT_CANVAS_SELECTION_SOFT = getSitemapTree.DEFAULT_CANVAS_SELECTION_SOFT;
11826
11791
  exports.QUICK_PREVIEW_PARAM = getSitemapTree.QUICK_PREVIEW_PARAM;
@@ -11845,6 +11810,7 @@ exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
11845
11810
  exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
11846
11811
  exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
11847
11812
  exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
11813
+ exports.isCodeChangedDetail = getSitemapTree.isCodeChangedDetail;
11848
11814
  exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
11849
11815
  exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
11850
11816
  exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
@@ -12045,6 +12011,7 @@ exports.partitionValidationErrors = partitionValidationErrors;
12045
12011
  exports.pathOfModuleKey = pathOfModuleKey;
12046
12012
  exports.performSearch = performSearch;
12047
12013
  exports.proposalCustomProperties = proposalCustomProperties;
12014
+ exports.readerSchemaVersion = readerSchemaVersion;
12048
12015
  exports.rebaseContentOp = rebaseContentOp;
12049
12016
  exports.relativeLuminance = relativeLuminance;
12050
12017
  exports.relocateForLocale = relocateForLocale;
@@ -12069,7 +12036,6 @@ exports.selfCheck = selfCheck;
12069
12036
  exports.shouldEncodeWithWasm = shouldEncodeWithWasm;
12070
12037
  exports.sideFiles = sideFiles;
12071
12038
  exports.sideSource = sideSource;
12072
- exports.sketchFieldTexts = sketchFieldTexts;
12073
12039
  exports.sketchRoutes = sketchRoutes;
12074
12040
  exports.sketchTitle = sketchTitle;
12075
12041
  exports.sourcePathOfChild = sourcePathOfChild;
@@ -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, x as QUICK_PREVIEW_RENDER_SCRIPT, v as QUICK_PREVIEW_SERVICE_WORKER_PATH, A as QUICK_PREVIEW_SERVICE_WORKER_SOURCE, y 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, k as attachElementPicker, l as createPickerOverlay, j as describeElement, n as elementLabel, t as findBySelector, F as formatRoutePattern, G as getNextAppRouterSourceFolder, K as getPageRouterSitemapTree, I as getPageRouterSourceFolder, L as getPatternFromModuleFilePath, H as getTanStackRouterSourceFolder, f as isCanvasSelectionColor, z as isQuickPreviewFiles, J as isTanStackRoutesFolder, h as isValCanvasFrame, i as isValCanvasPageMessage, g as isValCanvasStudioMessage, m as modifierLabel, p as pageLocationOf, E as parseRoutePattern, q as readPageSnapshot, r as restoreScroll, u as screenshotPage, s as startElementPicking, B as storeQuickPreview, o as watchPageLocation, C as withQuickPreviewParam, w as withValCanvasParam } from '../../dist/getSitemapTree-a887fed4.esm.js';
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
@@ -8222,8 +8240,6 @@ var toolNames = ["get_all_schema", "get_source", "search_content", "validate_con
8222
8240
  * --- /about a route: what follows is the page at /about
8223
8241
  * # Our people text (a heading: #, ## or ###)
8224
8242
  * We are 40 people in Oslo. text (a paragraph)
8225
- * ## Hi {field: /x.val.ts?p="t"} text linked to a content field: typing
8226
- * in it writes the field
8227
8243
  * [image: Team photo] placeholder: [kind] or [kind: label]
8228
8244
  * [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
8229
8245
  * icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
@@ -8379,27 +8395,7 @@ function parseSketch(source) {
8379
8395
  errors: errors
8380
8396
  };
8381
8397
  }
8382
-
8383
- /** The link to a content field at the end of a text line. */
8384
- var FIELD = / \{field: (\/[^{}]*)\}$/;
8385
- function parseContent(whole, line, errors) {
8386
- var link = FIELD.exec(whole);
8387
- if (link) {
8388
- var node = parseLine(whole.slice(0, link.index), line, errors);
8389
- if (node.type !== "text") {
8390
- errors.push({
8391
- line: line,
8392
- message: "Only a heading or a paragraph is linked to a field: put {field: ...} at the end of one."
8393
- });
8394
- return node;
8395
- }
8396
- return _objectSpread2(_objectSpread2({}, node), {}, {
8397
- field: link[1].trim()
8398
- });
8399
- }
8400
- return parseLine(whole, line, errors);
8401
- }
8402
- function parseLine(content, line, errors) {
8398
+ function parseContent(content, line, errors) {
8403
8399
  // A leading backslash keeps a line that looks like a keyword as text.
8404
8400
  if (content.startsWith("\\")) {
8405
8401
  return {
@@ -8506,19 +8502,13 @@ function parseLine(content, line, errors) {
8506
8502
  * The line a text block is written as. Line breaks become spaces, and a
8507
8503
  * paragraph that would read as something else is kept as text with `\`.
8508
8504
  */
8509
- function formatSketchText(level, text, field) {
8505
+ function formatSketchText(level, text) {
8510
8506
  var flat = text.replace(/\s+/g, " ").trim();
8511
- var path = field === null || field === void 0 ? void 0 : field.replace(/\s+/g, " ").trim();
8512
- // A source path, and one the line can be read back with: no braces.
8513
- var link = path && /^\/[^{}]*$/.test(path) ? " {field: ".concat(path, "}") : "";
8514
8507
  if (level > 0) {
8515
- return "#".repeat(level) + " " + flat + link;
8508
+ return "#".repeat(level) + " " + flat;
8516
8509
  }
8517
- // Read as the whole line will be, link and all: `icon x M` is text, and
8518
- // `icon x M {field: ...}` would be an icon.
8519
- var whole = flat + link;
8520
- var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(whole) || ROUTE.test(whole) || HEADING.test(whole) || ICON.test(whole);
8521
- 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;
8522
8512
  }
8523
8513
 
8524
8514
  /** The line a placeholder is written as. */
@@ -8543,18 +8533,12 @@ function formatSketchBox(placeholder) {
8543
8533
  */
8544
8534
  function formatSketch(blocks, icons) {
8545
8535
  var lines = [];
8546
- // One block per field: the first keeps the link.
8547
- var linked = new Set();
8548
8536
  var _walk = function walk(node, depth, inRow) {
8549
8537
  var indent = " ".repeat(depth);
8550
8538
  switch (node.type) {
8551
8539
  case "text":
8552
8540
  if (node.text) {
8553
- var field = node.field && !linked.has(node.field) ? node.field : undefined;
8554
- if (field) {
8555
- linked.add(field);
8556
- }
8557
- lines.push(indent + formatSketchText(node.level, node.text, field));
8541
+ lines.push(indent + formatSketchText(node.level, node.text));
8558
8542
  }
8559
8543
  return;
8560
8544
  case "placeholder":
@@ -8599,26 +8583,6 @@ function formatSketch(blocks, icons) {
8599
8583
  return all.length > 0 ? all.join("\n") + "\n" : "";
8600
8584
  }
8601
8585
 
8602
- /**
8603
- * The text of every block linked to a field, by field: what the Studio
8604
- * writes to the content when a linked block changes. The first block wins,
8605
- * as `formatSketch` keeps only its link.
8606
- */
8607
- function sketchFieldTexts(blocks) {
8608
- var texts = new Map();
8609
- var _walk2 = function walk(node) {
8610
- if (node.type === "text") {
8611
- if (node.field && node.text && !texts.has(node.field)) {
8612
- texts.set(node.field, node.text.replace(/\s+/g, " ").trim());
8613
- }
8614
- } else if (node.type === "row" || node.type === "col") {
8615
- node.children.forEach(_walk2);
8616
- }
8617
- };
8618
- blocks.forEach(_walk2);
8619
- return texts;
8620
- }
8621
-
8622
8586
  /** The pages a sketch is about, in the order it gives them. */
8623
8587
  function sketchRoutes(blocks) {
8624
8588
  return blocks.flatMap(function (block) {
@@ -11794,4 +11758,4 @@ var messageOf = function messageOf(error) {
11794
11758
  return error instanceof Error ? error.message : String(error);
11795
11759
  };
11796
11760
 
11797
- 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, rebaseContentOp, relativeLuminance, relocateForLocale, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolveEntry, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, sameEntryVersion, sameModuleVersion, schemaErrorsOf, schemaTypesOfPath, schemaVersionOf, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sketchFieldTexts, sketchRoutes, sketchTitle, sourcePathOfChild, storeWork, themeCustomProperties, tiered, toolNames, traverseSchemaSource, urlOf, valClientHeaders, valModulesEntryFile, valModulesEntryPath, validateRoutePatterns, versionHashCount, wholeEntryKey, withExtension };
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.153.0",
3
+ "version": "0.153.1",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {