@valbuild/tanstack 0.152.2 → 0.153.0

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,41 @@
1
1
  # @valbuild/tanstack
2
2
 
3
+ ## 0.153.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Editing content in a proposal whose code changed, before the proposal is built again:
8
+
9
+ - **A module the proposal adds** can be edited and saved right away. Its content is read from the new file and saved. Before, those edits were dropped. If the module's content is made by code (not written out in the file), the save waits and says to build the proposal first.
10
+ - **A module whose schema moved because a file it imports changed** (for example a shared `src/schemas/*.ts`) is no longer read with the old schema. Pages keep showing the content as built until the proposal is built again.
11
+ - **Edits that no longer fit the schema** can be handed to the assistant. The banner that lists them has a **Have the assistant move it** button for each one. You still discard the held edit yourself afterwards.
12
+
13
+ For this, `@valbuild/tanstack-build` records which files each Val module imports, and the `val.server.ts` it generates passes that to Val as the new optional `moduleDependencies` option of `initValServer` and `initValContent`. You do not need to set it yourself. A site built before this has no `moduleDependencies` and works as before.
14
+
15
+ - [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Removed what 0.151.0 kept only so that a Studio, a page and a server from the release before could still talk to each other during a deploy:
16
+
17
+ - **`PUT /api/val/sources/~`** is gone. Nothing in 0.151.0 asked it: the Studio reads modules through `GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and `fetchVal`, `useVal` and the MCP tools read the server's content in-process. If a script or test of yours read content through it, read one module with `GET /api/val/modules/~<path>` instead. Its answer has the module's `source` and `version`, and an `entries` map holding the `.jsonValues()` entries pending changes touched.
18
+ - **`ValDraft.base`** is gone from the type. It has not been sent or read since 0.151.0, so a `draft` you pass to `ValProvider` is not affected.
19
+ - **A page no longer accepts edits relayed by a Studio from before 0.151.0.** Such a Studio sent each module as a bare `source`. After the upgrade, the Studio and your pages come from the same deploy, so this only matters while an older Studio is still open in a tab during a rollout. Reloading that tab fixes it.
20
+ - **`/api/val/stat`** no longer needs `sourcesSha` and `schemaSha`. The Studio now tells your local server which version it last saw, and the server still sends both fields for a Studio of 0.151.0. They stop being sent in the next release.
21
+
22
+ ### Patch Changes
23
+
24
+ - [#1030](https://github.com/valbuild/val/pull/1030) [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c) Thanks [@freekh](https://github.com/freekh)! - **Point the assistant at something on the page.** With the preview open, the assistant has a **Select** in its header: press it, click a field on the page, and what you picked shows above the message box and goes with your next message, so "make this shorter" means that field. In code mode it can pick any element, outlined in the proposal's colour. Press the × on it to take it off.
25
+
26
+ - Selecting a field to edit has moved from the preview's toolbar to the top of the editor column, beside **Structure | On page**. Esc turns it off, from the Studio or from the page.
27
+ - On a desktop the assistant now sits beside the preview instead of over it, so it never covers what you point it at.
28
+ - The assistant can read the page in the preview, and take a picture of it, to see what you see.
29
+
30
+ - Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`56ab7d5`](https://github.com/valbuild/val/commit/56ab7d5818772a9e310a561ebdb798b27ee704c9)]:
31
+ - @valbuild/ui@0.153.0
32
+ - @valbuild/core@0.153.0
33
+ - @valbuild/server@0.153.0
34
+ - @valbuild/shared@0.153.0
35
+ - @valbuild/react@0.153.0
36
+ - @valbuild/language-server@0.153.0
37
+ - @valbuild/mcp@0.153.0
38
+
3
39
  ## 0.152.2
4
40
 
5
41
  ### Patch Changes
@@ -36,7 +36,7 @@ type Snapshot = Record<ModuleFilePath, Json>;
36
36
  * content version the site serves (`layeredSnapshot` in @valbuild/server),
37
37
  * either alone, or nothing.
38
38
  */
39
- export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource"> | undefined): Snapshot | undefined;
39
+ export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource" | "moduleDependencies"> | undefined): Snapshot | undefined;
40
40
  /**
41
41
  * Where an isolate says which content version it applied, for the platform
42
42
  * serving it to read back after a render (valbuild/home: the loader answers it
@@ -58,6 +58,16 @@ export type ValHttpMode = {
58
58
  * `.val.ts` at all.
59
59
  */
60
60
  projectSource?: Record<string, string>;
61
+ /**
62
+ * For each of this build's module files, every project file it depends on
63
+ * as the build resolved its imports (by path with no leading slash,
64
+ * transitive): what tells a proposal's address that a module whose own
65
+ * file is not staged is of code the build was not made of, through a file
66
+ * it imports. A host that builds the project itself hands it over, beside
67
+ * {@link projectSource}; the build platform does, as
68
+ * `platform:val-module-dependencies`. Nothing else should set it.
69
+ */
70
+ moduleDependencies?: Record<string, string[]>;
61
71
  /**
62
72
  * The publish job this build was made for, when a Studio built it in a
63
73
  * tab: how a build with no commit says where it sits in the content
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-c3823d62.cjs.dev.js');
6
6
  var _typeof = require('./typeof-bd6ec82c.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
- var version = require('./version-9879acd5.cjs.dev.js');
9
+ var version = require('./version-4909c2c7.cjs.dev.js');
10
10
  var internal = require('@valbuild/react/internal');
11
11
  var ui = require('@valbuild/ui');
12
12
  var reactRouter = require('@tanstack/react-router');
@@ -275,7 +275,7 @@ var RESCAN_INTERVAL_MS = 5000;
275
275
  * mounted there at all.
276
276
  */
277
277
  function ValCanvasBridge(_ref) {
278
- var _elementPicking$modif;
278
+ var _elementPicking$color, _elementPicking$modif;
279
279
  var draftMode = _ref.draftMode,
280
280
  isRefreshing = _ref.isRefreshing,
281
281
  holds = _ref.holds,
@@ -315,6 +315,8 @@ function ValCanvasBridge(_ref) {
315
315
  setElementPicking = _React$useState8[1];
316
316
  var elementPickingActive = React__default["default"].useRef(false);
317
317
  elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
318
+ var elementPickingFieldsOnly = React__default["default"].useRef(false);
319
+ elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
318
320
  var elementPicker = React__default["default"].useRef(null);
319
321
  /** A scroll back to where the last build was, still trying. */
320
322
  var stopRestoring = React__default["default"].useRef(null);
@@ -545,11 +547,14 @@ function ValCanvasBridge(_ref) {
545
547
  return;
546
548
  }
547
549
  if (message.type === "pickElements") {
550
+ var _message$color;
548
551
  setElementPicking({
549
552
  enabled: message.enabled,
550
553
  active: message.active,
551
554
  modifier: message.modifier,
552
- keepPicked: message.keepPicked
555
+ keepPicked: message.keepPicked,
556
+ fieldsOnly: message.fieldsOnly === true,
557
+ color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
553
558
  });
554
559
  return;
555
560
  }
@@ -650,13 +655,11 @@ function ValCanvasBridge(_ref) {
650
655
  * re-reads the server's own content is `confirmed`, below.)
651
656
  */
652
657
  window.dispatchEvent(new CustomEvent("val-event", {
653
- detail: _typeof._objectSpread2({
658
+ detail: {
654
659
  type: "source-update",
655
660
  moduleFilePath: message.moduleFilePath,
656
- source: message.source
657
- }, message.read !== undefined ? {
658
661
  read: message.read
659
- } : {})
662
+ }
660
663
  }));
661
664
  return;
662
665
  }
@@ -738,14 +741,32 @@ function ValCanvasBridge(_ref) {
738
741
  };
739
742
  }, [post]);
740
743
 
744
+ // Esc while picking fields: the key goes to the page, which has the focus
745
+ // once it has been clicked, so the studio hears of it only from here.
746
+ React__default["default"].useEffect(function () {
747
+ var onKey = function onKey(event) {
748
+ if (event.key === "Escape" && pickingRef.current) {
749
+ post({
750
+ val: client.VAL_CANVAS_MESSAGE,
751
+ type: "pickingStopped"
752
+ });
753
+ }
754
+ };
755
+ window.addEventListener("keydown", onKey);
756
+ return function () {
757
+ return window.removeEventListener("keydown", onKey);
758
+ };
759
+ }, [post]);
760
+
741
761
  /**
742
762
  * Picking any element: the page's own elements, which
743
763
  * only this side of the frame can reach. The listeners and the outlines are
744
764
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
745
765
  * same picker; what crosses back is the element described.
746
766
  */
747
- var selectionColorRef = React__default["default"].useRef(selectionColors.selection);
748
- selectionColorRef.current = selectionColors.selection;
767
+ var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
768
+ var selectionColorRef = React__default["default"].useRef(pickColor);
769
+ selectionColorRef.current = pickColor;
749
770
  var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
750
771
  var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
751
772
  React__default["default"].useEffect(function () {
@@ -755,6 +776,9 @@ function ValCanvasBridge(_ref) {
755
776
  active: function active() {
756
777
  return elementPickingActive.current;
757
778
  },
779
+ fieldsOnly: function fieldsOnly() {
780
+ return elementPickingFieldsOnly.current;
781
+ },
758
782
  color: selectionColorRef.current,
759
783
  onPick: function onPick(element) {
760
784
  return post({
@@ -783,8 +807,8 @@ function ValCanvasBridge(_ref) {
783
807
  }, [keepPicked]);
784
808
  React__default["default"].useEffect(function () {
785
809
  var _elementPicker$curren2;
786
- (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
787
- }, [selectionColors.selection]);
810
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
811
+ }, [pickColor]);
788
812
 
789
813
  /**
790
814
  * Two-finger gestures, handed to the studio.
@@ -1870,14 +1894,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1870
1894
  * the page already shows does not count.
1871
1895
  */
1872
1896
  if (outcome.changed) {
1873
- if (outcome.fromPreviousStudio === true) {
1874
- var _refreshLoopRef$curre3;
1875
- // A Studio of the release before: it never confirms.
1876
- (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changedByPreviousStudio();
1877
- } else {
1878
- var _refreshLoopRef$curre4;
1879
- (_refreshLoopRef$curre4 = refreshLoopRef.current) === null || _refreshLoopRef$curre4 === void 0 || _refreshLoopRef$curre4.changed();
1880
- }
1897
+ var _refreshLoopRef$curre3;
1898
+ (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changed();
1881
1899
  }
1882
1900
  };
1883
1901
  window.addEventListener("val-event", reactServerComponentRefreshListener);
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-8e5c36c8.cjs.prod.js');
6
6
  var _typeof = require('./typeof-56656438.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
- var version = require('./version-ef9e858f.cjs.prod.js');
9
+ var version = require('./version-4d538d73.cjs.prod.js');
10
10
  var internal = require('@valbuild/react/internal');
11
11
  var ui = require('@valbuild/ui');
12
12
  var reactRouter = require('@tanstack/react-router');
@@ -275,7 +275,7 @@ var RESCAN_INTERVAL_MS = 5000;
275
275
  * mounted there at all.
276
276
  */
277
277
  function ValCanvasBridge(_ref) {
278
- var _elementPicking$modif;
278
+ var _elementPicking$color, _elementPicking$modif;
279
279
  var draftMode = _ref.draftMode,
280
280
  isRefreshing = _ref.isRefreshing,
281
281
  holds = _ref.holds,
@@ -315,6 +315,8 @@ function ValCanvasBridge(_ref) {
315
315
  setElementPicking = _React$useState8[1];
316
316
  var elementPickingActive = React__default["default"].useRef(false);
317
317
  elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
318
+ var elementPickingFieldsOnly = React__default["default"].useRef(false);
319
+ elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
318
320
  var elementPicker = React__default["default"].useRef(null);
319
321
  /** A scroll back to where the last build was, still trying. */
320
322
  var stopRestoring = React__default["default"].useRef(null);
@@ -545,11 +547,14 @@ function ValCanvasBridge(_ref) {
545
547
  return;
546
548
  }
547
549
  if (message.type === "pickElements") {
550
+ var _message$color;
548
551
  setElementPicking({
549
552
  enabled: message.enabled,
550
553
  active: message.active,
551
554
  modifier: message.modifier,
552
- keepPicked: message.keepPicked
555
+ keepPicked: message.keepPicked,
556
+ fieldsOnly: message.fieldsOnly === true,
557
+ color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
553
558
  });
554
559
  return;
555
560
  }
@@ -650,13 +655,11 @@ function ValCanvasBridge(_ref) {
650
655
  * re-reads the server's own content is `confirmed`, below.)
651
656
  */
652
657
  window.dispatchEvent(new CustomEvent("val-event", {
653
- detail: _typeof._objectSpread2({
658
+ detail: {
654
659
  type: "source-update",
655
660
  moduleFilePath: message.moduleFilePath,
656
- source: message.source
657
- }, message.read !== undefined ? {
658
661
  read: message.read
659
- } : {})
662
+ }
660
663
  }));
661
664
  return;
662
665
  }
@@ -738,14 +741,32 @@ function ValCanvasBridge(_ref) {
738
741
  };
739
742
  }, [post]);
740
743
 
744
+ // Esc while picking fields: the key goes to the page, which has the focus
745
+ // once it has been clicked, so the studio hears of it only from here.
746
+ React__default["default"].useEffect(function () {
747
+ var onKey = function onKey(event) {
748
+ if (event.key === "Escape" && pickingRef.current) {
749
+ post({
750
+ val: client.VAL_CANVAS_MESSAGE,
751
+ type: "pickingStopped"
752
+ });
753
+ }
754
+ };
755
+ window.addEventListener("keydown", onKey);
756
+ return function () {
757
+ return window.removeEventListener("keydown", onKey);
758
+ };
759
+ }, [post]);
760
+
741
761
  /**
742
762
  * Picking any element: the page's own elements, which
743
763
  * only this side of the frame can reach. The listeners and the outlines are
744
764
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
745
765
  * same picker; what crosses back is the element described.
746
766
  */
747
- var selectionColorRef = React__default["default"].useRef(selectionColors.selection);
748
- selectionColorRef.current = selectionColors.selection;
767
+ var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
768
+ var selectionColorRef = React__default["default"].useRef(pickColor);
769
+ selectionColorRef.current = pickColor;
749
770
  var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
750
771
  var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
751
772
  React__default["default"].useEffect(function () {
@@ -755,6 +776,9 @@ function ValCanvasBridge(_ref) {
755
776
  active: function active() {
756
777
  return elementPickingActive.current;
757
778
  },
779
+ fieldsOnly: function fieldsOnly() {
780
+ return elementPickingFieldsOnly.current;
781
+ },
758
782
  color: selectionColorRef.current,
759
783
  onPick: function onPick(element) {
760
784
  return post({
@@ -783,8 +807,8 @@ function ValCanvasBridge(_ref) {
783
807
  }, [keepPicked]);
784
808
  React__default["default"].useEffect(function () {
785
809
  var _elementPicker$curren2;
786
- (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
787
- }, [selectionColors.selection]);
810
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
811
+ }, [pickColor]);
788
812
 
789
813
  /**
790
814
  * Two-finger gestures, handed to the studio.
@@ -1870,14 +1894,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1870
1894
  * the page already shows does not count.
1871
1895
  */
1872
1896
  if (outcome.changed) {
1873
- if (outcome.fromPreviousStudio === true) {
1874
- var _refreshLoopRef$curre3;
1875
- // A Studio of the release before: it never confirms.
1876
- (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changedByPreviousStudio();
1877
- } else {
1878
- var _refreshLoopRef$curre4;
1879
- (_refreshLoopRef$curre4 = refreshLoopRef.current) === null || _refreshLoopRef$curre4 === void 0 || _refreshLoopRef$curre4.changed();
1880
- }
1897
+ var _refreshLoopRef$curre3;
1898
+ (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changed();
1881
1899
  }
1882
1900
  };
1883
1901
  window.addEventListener("val-event", reactServerComponentRefreshListener);
@@ -5,7 +5,7 @@ import * as core from '@valbuild/core';
5
5
  export { core as expr };
6
6
  export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
7
7
  import { stegaEncode, stegaDecodeStrings, attrs, raw, isReactDevelopmentBuild, watchStegaLeaks, stegaLeakMessage, SET_AUTO_TAG_JSX_ENABLED, autoTagJSX } from '@valbuild/react/stega';
8
- import { r as readValEnableCookie, V as VERSION$1 } from './version-8892838b.esm.js';
8
+ import { r as readValEnableCookie, V as VERSION$1 } from './version-68f1a577.esm.js';
9
9
  import { isDraft, createDraftStore, draftHolds, draftHoldsVersions, startRefreshLoop, applyValEvent } from '@valbuild/react/internal';
10
10
  export { ValRichText } from '@valbuild/react/internal';
11
11
  import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
@@ -252,7 +252,7 @@ var RESCAN_INTERVAL_MS = 5000;
252
252
  * mounted there at all.
253
253
  */
254
254
  function ValCanvasBridge(_ref) {
255
- var _elementPicking$modif;
255
+ var _elementPicking$color, _elementPicking$modif;
256
256
  var draftMode = _ref.draftMode,
257
257
  isRefreshing = _ref.isRefreshing,
258
258
  holds = _ref.holds,
@@ -292,6 +292,8 @@ function ValCanvasBridge(_ref) {
292
292
  setElementPicking = _React$useState8[1];
293
293
  var elementPickingActive = React.useRef(false);
294
294
  elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
295
+ var elementPickingFieldsOnly = React.useRef(false);
296
+ elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
295
297
  var elementPicker = React.useRef(null);
296
298
  /** A scroll back to where the last build was, still trying. */
297
299
  var stopRestoring = React.useRef(null);
@@ -522,11 +524,14 @@ function ValCanvasBridge(_ref) {
522
524
  return;
523
525
  }
524
526
  if (message.type === "pickElements") {
527
+ var _message$color;
525
528
  setElementPicking({
526
529
  enabled: message.enabled,
527
530
  active: message.active,
528
531
  modifier: message.modifier,
529
- keepPicked: message.keepPicked
532
+ keepPicked: message.keepPicked,
533
+ fieldsOnly: message.fieldsOnly === true,
534
+ color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
530
535
  });
531
536
  return;
532
537
  }
@@ -627,13 +632,11 @@ function ValCanvasBridge(_ref) {
627
632
  * re-reads the server's own content is `confirmed`, below.)
628
633
  */
629
634
  window.dispatchEvent(new CustomEvent("val-event", {
630
- detail: _objectSpread2({
635
+ detail: {
631
636
  type: "source-update",
632
637
  moduleFilePath: message.moduleFilePath,
633
- source: message.source
634
- }, message.read !== undefined ? {
635
638
  read: message.read
636
- } : {})
639
+ }
637
640
  }));
638
641
  return;
639
642
  }
@@ -715,14 +718,32 @@ function ValCanvasBridge(_ref) {
715
718
  };
716
719
  }, [post]);
717
720
 
721
+ // Esc while picking fields: the key goes to the page, which has the focus
722
+ // once it has been clicked, so the studio hears of it only from here.
723
+ React.useEffect(function () {
724
+ var onKey = function onKey(event) {
725
+ if (event.key === "Escape" && pickingRef.current) {
726
+ post({
727
+ val: VAL_CANVAS_MESSAGE,
728
+ type: "pickingStopped"
729
+ });
730
+ }
731
+ };
732
+ window.addEventListener("keydown", onKey);
733
+ return function () {
734
+ return window.removeEventListener("keydown", onKey);
735
+ };
736
+ }, [post]);
737
+
718
738
  /**
719
739
  * Picking any element: the page's own elements, which
720
740
  * only this side of the frame can reach. The listeners and the outlines are
721
741
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
722
742
  * same picker; what crosses back is the element described.
723
743
  */
724
- var selectionColorRef = React.useRef(selectionColors.selection);
725
- selectionColorRef.current = selectionColors.selection;
744
+ var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
745
+ var selectionColorRef = React.useRef(pickColor);
746
+ selectionColorRef.current = pickColor;
726
747
  var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
727
748
  var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
728
749
  React.useEffect(function () {
@@ -732,6 +753,9 @@ function ValCanvasBridge(_ref) {
732
753
  active: function active() {
733
754
  return elementPickingActive.current;
734
755
  },
756
+ fieldsOnly: function fieldsOnly() {
757
+ return elementPickingFieldsOnly.current;
758
+ },
735
759
  color: selectionColorRef.current,
736
760
  onPick: function onPick(element) {
737
761
  return post({
@@ -760,8 +784,8 @@ function ValCanvasBridge(_ref) {
760
784
  }, [keepPicked]);
761
785
  React.useEffect(function () {
762
786
  var _elementPicker$curren2;
763
- (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
764
- }, [selectionColors.selection]);
787
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
788
+ }, [pickColor]);
765
789
 
766
790
  /**
767
791
  * Two-finger gestures, handed to the studio.
@@ -1847,14 +1871,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1847
1871
  * the page already shows does not count.
1848
1872
  */
1849
1873
  if (outcome.changed) {
1850
- if (outcome.fromPreviousStudio === true) {
1851
- var _refreshLoopRef$curre3;
1852
- // A Studio of the release before: it never confirms.
1853
- (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changedByPreviousStudio();
1854
- } else {
1855
- var _refreshLoopRef$curre4;
1856
- (_refreshLoopRef$curre4 = refreshLoopRef.current) === null || _refreshLoopRef$curre4 === void 0 || _refreshLoopRef$curre4.changed();
1857
- }
1874
+ var _refreshLoopRef$curre3;
1875
+ (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changed();
1858
1876
  }
1859
1877
  };
1860
1878
  window.addEventListener("val-event", reactServerComponentRefreshListener);
@@ -78,7 +78,7 @@ var packageJson = {
78
78
  "tanstack-router",
79
79
  "react"
80
80
  ],
81
- version: "0.152.2",
81
+ version: "0.153.0",
82
82
  scripts: {
83
83
  typecheck: "tsc --noEmit",
84
84
  test: "jest"
@@ -78,7 +78,7 @@ var packageJson = {
78
78
  "tanstack-router",
79
79
  "react"
80
80
  ],
81
- version: "0.152.2",
81
+ version: "0.153.0",
82
82
  scripts: {
83
83
  typecheck: "tsc --noEmit",
84
84
  test: "jest"
@@ -76,7 +76,7 @@ var packageJson = {
76
76
  "tanstack-router",
77
77
  "react"
78
78
  ],
79
- version: "0.152.2",
79
+ version: "0.153.0",
80
80
  scripts: {
81
81
  typecheck: "tsc --noEmit",
82
82
  test: "jest"
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "tanstack-router",
15
15
  "react"
16
16
  ],
17
- "version": "0.152.2",
17
+ "version": "0.153.0",
18
18
  "main": "dist/valbuild-tanstack.cjs.js",
19
19
  "module": "dist/valbuild-tanstack.esm.js",
20
20
  "exports": {
@@ -52,13 +52,13 @@
52
52
  "exports": true
53
53
  },
54
54
  "dependencies": {
55
- "@valbuild/language-server": "0.152.2",
56
- "@valbuild/core": "0.151.0",
57
- "@valbuild/mcp": "0.152.2",
58
- "@valbuild/react": "0.152.2",
59
- "@valbuild/server": "0.152.2",
60
- "@valbuild/ui": "0.152.2",
61
- "@valbuild/shared": "0.152.1"
55
+ "@valbuild/core": "0.153.0",
56
+ "@valbuild/language-server": "0.153.0",
57
+ "@valbuild/mcp": "0.153.0",
58
+ "@valbuild/server": "0.153.0",
59
+ "@valbuild/shared": "0.153.0",
60
+ "@valbuild/react": "0.153.0",
61
+ "@valbuild/ui": "0.153.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@tanstack/react-router": "^1.170.41",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-9879acd5.cjs.dev.js');
5
+ var version = require('../../dist/version-4909c2c7.cjs.dev.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-c3823d62.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-bd6ec82c.cjs.dev.js');
@@ -414,9 +414,10 @@ var initFetchValStega = function initFetchValStega(deps) {
414
414
  */
415
415
  function snapshotForReaders(http) {
416
416
  var source = server.layeredSnapshot(
417
- // Not a module staged after the build serving the address: its Source
418
- // fits code these readers have not got. See `proposalAsBuilt`.
419
- (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? internal.proposalAsBuilt(http.proposal) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
417
+ // Not a module staged after the build serving the address -- its own
418
+ // file, or a file it imports: its Source fits code these readers have
419
+ // not got. See `proposalAsBuilt`.
420
+ (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? internal.proposalAsBuilt(http.proposal, internal.servingBuildOf(http)) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
420
421
  return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
421
422
  }
422
423
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-ef9e858f.cjs.prod.js');
5
+ var version = require('../../dist/version-4d538d73.cjs.prod.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-8e5c36c8.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-56656438.cjs.prod.js');
@@ -414,9 +414,10 @@ var initFetchValStega = function initFetchValStega(deps) {
414
414
  */
415
415
  function snapshotForReaders(http) {
416
416
  var source = server.layeredSnapshot(
417
- // Not a module staged after the build serving the address: its Source
418
- // fits code these readers have not got. See `proposalAsBuilt`.
419
- (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? internal.proposalAsBuilt(http.proposal) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
417
+ // Not a module staged after the build serving the address -- its own
418
+ // file, or a file it imports: its Source fits code these readers have
419
+ // not got. See `proposalAsBuilt`.
420
+ (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? internal.proposalAsBuilt(http.proposal, internal.servingBuildOf(http)) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
420
421
  return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
421
422
  }
422
423
 
@@ -1,4 +1,4 @@
1
- import { V as VERSION, s as setValEnableCookieReader } from '../../dist/version-8892838b.esm.js';
1
+ import { V as VERSION, s as setValEnableCookieReader } from '../../dist/version-68f1a577.esm.js';
2
2
  import { _ as _asyncToGenerator, a as _regenerator } from '../../dist/asyncToGenerator-500f022f.esm.js';
3
3
  import { Internal } from '@valbuild/core';
4
4
  import { _ as _objectSpread2, a as _slicedToArray } from '../../dist/typeof-3e1a1d11.esm.js';
@@ -6,7 +6,7 @@ import { createValApiRouter, createValServer, layeredSnapshot, proposalSnapshotF
6
6
  export { InMemoryPatchStore, createPrettierFormatter } from '@valbuild/server';
7
7
  import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
8
8
  import { fetchValFrom, isJsonValuesRecordSchema, awaitResolved, resolveValEntry, snapshotSource, resolveVal } from '@valbuild/react/internal';
9
- import { createValRuntime, proposalAsBuilt, draftForRequest, readerSchemaVersion, readDraftChanges } from '@valbuild/server/internal';
9
+ import { createValRuntime, proposalAsBuilt, servingBuildOf, draftForRequest, readerSchemaVersion, readDraftChanges } from '@valbuild/server/internal';
10
10
  import { i as initValRouteFromVal, g as getValRouteUrlFromVal } from '../../dist/routeFromVal-124235a5.esm.js';
11
11
  import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
12
12
  import '@valbuild/shared/client';
@@ -393,9 +393,10 @@ var initFetchValStega = function initFetchValStega(deps) {
393
393
  */
394
394
  function snapshotForReaders(http) {
395
395
  var source = layeredSnapshot(
396
- // Not a module staged after the build serving the address: its Source
397
- // fits code these readers have not got. See `proposalAsBuilt`.
398
- (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? proposalAsBuilt(http.proposal) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
396
+ // Not a module staged after the build serving the address -- its own
397
+ // file, or a file it imports: its Source fits code these readers have
398
+ // not got. See `proposalAsBuilt`.
399
+ (http === null || http === void 0 ? void 0 : http.proposal) !== undefined ? proposalAsBuilt(http.proposal, servingBuildOf(http)) : undefined, http === null || http === void 0 ? void 0 : http.contentVersion);
399
400
  return source !== undefined ? proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
400
401
  }
401
402