@valbuild/tanstack 0.152.2 → 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.
@@ -5,14 +5,14 @@ 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';
9
- import { isDraft, createDraftStore, draftHolds, draftHoldsVersions, startRefreshLoop, applyValEvent } from '@valbuild/react/internal';
8
+ import { r as readValEnableCookie, V as VERSION$1 } from './version-65630089.esm.js';
9
+ import { isDraft, windowCodeChangedReporter, createDraftStore, draftHolds, draftHoldsVersions, startRefreshLoop, dispatchCodeChanged, 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';
12
12
  import { useRouter, useRouterState } from '@tanstack/react-router';
13
13
  import React, { useEffect, useRef, useState } from 'react';
14
- import { V as ValOverlayProvider } from './ValOverlayContext-6826b4d9.esm.js';
15
- import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, screenshotPage, readPageSnapshot, isValCanvasFrame } from '@valbuild/shared/client';
14
+ import { V as ValOverlayProvider } from './ValOverlayContext-bd2f453c.esm.js';
15
+ import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, isCodeChangedDetail, screenshotPage, readPageSnapshot, isValCanvasFrame } from '@valbuild/shared/client';
16
16
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
17
17
  import { D as DEMO_CLAIM_MESSAGE, a as DEMO_SERVICE_WORKER_PATH, b as DEMO_RELAY_MESSAGE } from './demoServiceWorker-56fd96cf.esm.js';
18
18
 
@@ -252,11 +252,12 @@ 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,
259
- holdsVersions = _ref.holdsVersions;
259
+ holdsVersions = _ref.holdsVersions,
260
+ codeChanged = _ref.codeChanged;
260
261
  var _React$useState = React.useState(false),
261
262
  _React$useState2 = _slicedToArray(_React$useState, 2),
262
263
  picking = _React$useState2[0],
@@ -292,6 +293,8 @@ function ValCanvasBridge(_ref) {
292
293
  setElementPicking = _React$useState8[1];
293
294
  var elementPickingActive = React.useRef(false);
294
295
  elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
296
+ var elementPickingFieldsOnly = React.useRef(false);
297
+ elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
295
298
  var elementPicker = React.useRef(null);
296
299
  /** A scroll back to where the last build was, still trying. */
297
300
  var stopRestoring = React.useRef(null);
@@ -522,11 +525,14 @@ function ValCanvasBridge(_ref) {
522
525
  return;
523
526
  }
524
527
  if (message.type === "pickElements") {
528
+ var _message$color;
525
529
  setElementPicking({
526
530
  enabled: message.enabled,
527
531
  active: message.active,
528
532
  modifier: message.modifier,
529
- keepPicked: message.keepPicked
533
+ keepPicked: message.keepPicked,
534
+ fieldsOnly: message.fieldsOnly === true,
535
+ color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
530
536
  });
531
537
  return;
532
538
  }
@@ -627,13 +633,11 @@ function ValCanvasBridge(_ref) {
627
633
  * re-reads the server's own content is `confirmed`, below.)
628
634
  */
629
635
  window.dispatchEvent(new CustomEvent("val-event", {
630
- detail: _objectSpread2({
636
+ detail: {
631
637
  type: "source-update",
632
638
  moduleFilePath: message.moduleFilePath,
633
- source: message.source
634
- }, message.read !== undefined ? {
635
639
  read: message.read
636
- } : {})
640
+ }
637
641
  }));
638
642
  return;
639
643
  }
@@ -671,6 +675,34 @@ function ValCanvasBridge(_ref) {
671
675
  };
672
676
  }, [scan, post]);
673
677
 
678
+ // What the hooks could not read for its schema: the Studio says the code
679
+ // changed, with a reload. What was refused before the bridge mounted, then
680
+ // each change the page announces (`val-overlay-spa`, `codeChanged`).
681
+ React.useEffect(function () {
682
+ var _codeChanged;
683
+ var already = (_codeChanged = codeChanged === null || codeChanged === void 0 ? void 0 : codeChanged()) !== null && _codeChanged !== void 0 ? _codeChanged : [];
684
+ if (already.length > 0) {
685
+ post({
686
+ val: VAL_CANVAS_MESSAGE,
687
+ type: "codeChanged",
688
+ modules: already
689
+ });
690
+ }
691
+ var listener = function listener(event) {
692
+ if (!(event instanceof CustomEvent)) return;
693
+ if (!isCodeChangedDetail(event.detail)) return;
694
+ post({
695
+ val: VAL_CANVAS_MESSAGE,
696
+ type: "codeChanged",
697
+ modules: event.detail.modules
698
+ });
699
+ };
700
+ window.addEventListener("val-overlay-spa", listener);
701
+ return function () {
702
+ return window.removeEventListener("val-overlay-spa", listener);
703
+ };
704
+ }, [codeChanged, post]);
705
+
674
706
  // Where the page is, as it moves: a new build is opened there.
675
707
  React.useEffect(function () {
676
708
  return watchPageLocation(window, function (location) {
@@ -715,14 +747,32 @@ function ValCanvasBridge(_ref) {
715
747
  };
716
748
  }, [post]);
717
749
 
750
+ // Esc while picking fields: the key goes to the page, which has the focus
751
+ // once it has been clicked, so the studio hears of it only from here.
752
+ React.useEffect(function () {
753
+ var onKey = function onKey(event) {
754
+ if (event.key === "Escape" && pickingRef.current) {
755
+ post({
756
+ val: VAL_CANVAS_MESSAGE,
757
+ type: "pickingStopped"
758
+ });
759
+ }
760
+ };
761
+ window.addEventListener("keydown", onKey);
762
+ return function () {
763
+ return window.removeEventListener("keydown", onKey);
764
+ };
765
+ }, [post]);
766
+
718
767
  /**
719
768
  * Picking any element: the page's own elements, which
720
769
  * only this side of the frame can reach. The listeners and the outlines are
721
770
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
722
771
  * same picker; what crosses back is the element described.
723
772
  */
724
- var selectionColorRef = React.useRef(selectionColors.selection);
725
- selectionColorRef.current = selectionColors.selection;
773
+ var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
774
+ var selectionColorRef = React.useRef(pickColor);
775
+ selectionColorRef.current = pickColor;
726
776
  var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
727
777
  var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
728
778
  React.useEffect(function () {
@@ -732,6 +782,9 @@ function ValCanvasBridge(_ref) {
732
782
  active: function active() {
733
783
  return elementPickingActive.current;
734
784
  },
785
+ fieldsOnly: function fieldsOnly() {
786
+ return elementPickingFieldsOnly.current;
787
+ },
735
788
  color: selectionColorRef.current,
736
789
  onPick: function onPick(element) {
737
790
  return post({
@@ -760,8 +813,8 @@ function ValCanvasBridge(_ref) {
760
813
  }, [keepPicked]);
761
814
  React.useEffect(function () {
762
815
  var _elementPicker$curren2;
763
- (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(selectionColors.selection);
764
- }, [selectionColors.selection]);
816
+ (_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
817
+ }, [pickColor]);
765
818
 
766
819
  /**
767
820
  * Two-finger gestures, handed to the studio.
@@ -1349,6 +1402,17 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1349
1402
  var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
1350
1403
  var liveSitePage = isLiveSitePage(initialDraft);
1351
1404
  // TODO: move below into react package
1405
+ /*
1406
+ * Told by the hooks whether each relayed module was made with this page's
1407
+ * schema, and says so to the overlay (`codeChangedReporter`). One for the
1408
+ * life of the provider, so the hooks' env is not made again every render.
1409
+ * None on the server: nothing there is relayed.
1410
+ */
1411
+ var _React$useState5 = React.useState(function () {
1412
+ return typeof window === "undefined" ? undefined : windowCodeChangedReporter();
1413
+ }),
1414
+ _React$useState6 = _slicedToArray(_React$useState5, 1),
1415
+ codeChanged = _React$useState6[0];
1352
1416
  var valStore = React.useMemo(function () {
1353
1417
  return createDraftStore(initialDraft);
1354
1418
  }, [initialDraft]);
@@ -1377,10 +1441,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1377
1441
  // transition: React keeps the static content visible while hooks suspend
1378
1442
  // and then swaps to draft data as a normal update — no Suspense fallback
1379
1443
  // flash and no hydration mismatch.
1380
- var _React$useState5 = React.useState(false),
1381
- _React$useState6 = _slicedToArray(_React$useState5, 2),
1382
- suspendActive = _React$useState6[0],
1383
- setSuspendActive = _React$useState6[1];
1444
+ var _React$useState7 = React.useState(false),
1445
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
1446
+ suspendActive = _React$useState8[0],
1447
+ setSuspendActive = _React$useState8[1];
1384
1448
  /**
1385
1449
  * Whether the studio has said it sent everything it holds.
1386
1450
  *
@@ -1391,14 +1455,14 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1391
1455
  */
1392
1456
  // A server-read draft is everything there is: a module missing from it has
1393
1457
  // no changes, so there is nothing more to wait for.
1394
- var _React$useState7 = React.useState(hasDraft),
1395
- _React$useState8 = _slicedToArray(_React$useState7, 2),
1396
- draftSourcesSynced = _React$useState8[0],
1397
- setDraftSourcesSynced = _React$useState8[1];
1398
- var _React$useState9 = React.useState(),
1458
+ var _React$useState9 = React.useState(hasDraft),
1399
1459
  _React$useState0 = _slicedToArray(_React$useState9, 2),
1400
- mountOverlay = _React$useState0[0],
1401
- setMountOverlay = _React$useState0[1];
1460
+ draftSourcesSynced = _React$useState0[0],
1461
+ setDraftSourcesSynced = _React$useState0[1];
1462
+ var _React$useState1 = React.useState(),
1463
+ _React$useState10 = _slicedToArray(_React$useState1, 2),
1464
+ mountOverlay = _React$useState10[0],
1465
+ setMountOverlay = _React$useState10[1];
1402
1466
  /**
1403
1467
  * Whether this document is the studio's canvas frame.
1404
1468
  *
@@ -1412,16 +1476,16 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1412
1476
  * Read once, in the same effect as `mountOverlay`: it is a property of how
1413
1477
  * the document was loaded, and it cannot change without a navigation.
1414
1478
  */
1415
- var _React$useState1 = React.useState(false),
1416
- _React$useState10 = _slicedToArray(_React$useState1, 2),
1417
- isCanvas = _React$useState10[0],
1418
- setIsCanvas = _React$useState10[1];
1479
+ var _React$useState11 = React.useState(false),
1480
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
1481
+ isCanvas = _React$useState12[0],
1482
+ setIsCanvas = _React$useState12[1];
1419
1483
  // Known on the server when it read a draft: `fetchValDraft` only reads one
1420
1484
  // in draft mode. Otherwise unknown until `/draft/stat` answers.
1421
- var _React$useState11 = React.useState(hasDraft ? true : null),
1422
- _React$useState12 = _slicedToArray(_React$useState11, 2),
1423
- draftMode = _React$useState12[0],
1424
- setDraftModeState = _React$useState12[1];
1485
+ var _React$useState13 = React.useState(hasDraft ? true : null),
1486
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
1487
+ draftMode = _React$useState14[0],
1488
+ setDraftModeState = _React$useState14[1];
1425
1489
  /**
1426
1490
  * `draftMode` as last set: what an answer from `/draft/stat` is compared
1427
1491
  * with, to know whether it MOVED draft mode and so whether to refresh.
@@ -1474,10 +1538,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1474
1538
  (_draftModeReady$curre = draftModeReady.current) === null || _draftModeReady$curre === void 0 || _draftModeReady$curre.resolve();
1475
1539
  }
1476
1540
  }, [draftMode]);
1477
- var _React$useState13 = React.useState(false),
1478
- _React$useState14 = _slicedToArray(_React$useState13, 2),
1479
- spaReady = _React$useState14[0],
1480
- setSpaReady = _React$useState14[1]; // TODO: consider removing spaReady - it is not used? If we remove, clean up the custom events that send the message too...
1541
+ var _React$useState15 = React.useState(false),
1542
+ _React$useState16 = _slicedToArray(_React$useState15, 2),
1543
+ spaReady = _React$useState16[0],
1544
+ setSpaReady = _React$useState16[1]; // TODO: consider removing spaReady - it is not used? If we remove, clean up the custom events that send the message too...
1481
1545
  var router = useRouter();
1482
1546
  var _React$useTransition = React.useTransition(),
1483
1547
  _React$useTransition2 = _slicedToArray(_React$useTransition, 2),
@@ -1489,10 +1553,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1489
1553
  * is not rebuilt with it.
1490
1554
  */
1491
1555
  var refreshLoopRef = React.useRef(null);
1492
- var _React$useState15 = React.useState(null),
1493
- _React$useState16 = _slicedToArray(_React$useState15, 2),
1494
- iframeSrc = _React$useState16[0],
1495
- setIframeSrc = _React$useState16[1];
1556
+ var _React$useState17 = React.useState(null),
1557
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
1558
+ iframeSrc = _React$useState18[0],
1559
+ setIframeSrc = _React$useState18[1];
1496
1560
  var pathname = useRouterState({
1497
1561
  select: function select(state) {
1498
1562
  return state.location.pathname;
@@ -1806,6 +1870,14 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1806
1870
  }
1807
1871
  }));
1808
1872
  }, [mountOverlay, draftMode, spaReady, holds, holdsVersions]);
1873
+
1874
+ // What the hooks could not read for its schema, said again once the
1875
+ // overlay listens: an announcement made before it loaded reached no one.
1876
+ React.useEffect(function () {
1877
+ if (!mountOverlay || !spaReady || codeChanged === undefined) return;
1878
+ var modules = codeChanged.modules();
1879
+ if (modules.length > 0) dispatchCodeChanged(modules);
1880
+ }, [mountOverlay, spaReady, codeChanged]);
1809
1881
  React.useEffect(function () {
1810
1882
  if (!mountOverlay) {
1811
1883
  // A visitor: only analytics tags content, and only after hydration
@@ -1847,14 +1919,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1847
1919
  * the page already shows does not count.
1848
1920
  */
1849
1921
  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
- }
1922
+ var _refreshLoopRef$curre3;
1923
+ (_refreshLoopRef$curre3 = refreshLoopRef.current) === null || _refreshLoopRef$curre3 === void 0 || _refreshLoopRef$curre3.changed();
1858
1924
  }
1859
1925
  };
1860
1926
  window.addEventListener("val-event", reactServerComponentRefreshListener);
@@ -1885,10 +1951,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1885
1951
  window.dispatchEvent(new CustomEvent("val-append-overlay"));
1886
1952
  }
1887
1953
  });
1888
- var _React$useState17 = React.useState(null),
1889
- _React$useState18 = _slicedToArray(_React$useState17, 2),
1890
- dropZone = _React$useState18[0],
1891
- setDropZone = _React$useState18[1];
1954
+ var _React$useState19 = React.useState(null),
1955
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
1956
+ dropZone = _React$useState20[0],
1957
+ setDropZone = _React$useState20[1];
1892
1958
  React.useEffect(function () {
1893
1959
  var storedDropZone = localStorage.getItem("val-menu-drop-zone-default");
1894
1960
  if (storedDropZone) {
@@ -1901,10 +1967,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1901
1967
  var initTheme = React.useMemo(function () {
1902
1968
  return initSessionTheme(props.config);
1903
1969
  }, [props.config]);
1904
- var _React$useState19 = React.useState(false),
1905
- _React$useState20 = _slicedToArray(_React$useState19, 2),
1906
- spaLoaded = _React$useState20[0],
1907
- setSpaLoaded = _React$useState20[1];
1970
+ var _React$useState21 = React.useState(false),
1971
+ _React$useState22 = _slicedToArray(_React$useState21, 2),
1972
+ spaLoaded = _React$useState22[0],
1973
+ setSpaLoaded = _React$useState22[1];
1908
1974
  React.useEffect(function () {
1909
1975
  var listener = function listener() {
1910
1976
  setSpaLoaded(true);
@@ -1944,6 +2010,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1944
2010
  };
1945
2011
  }, [valPrefixedClass]);
1946
2012
  return /*#__PURE__*/jsxs(ValOverlayProvider, {
2013
+ schemaChecked: codeChanged === null || codeChanged === void 0 ? void 0 : codeChanged.schemaChecked,
1947
2014
  draftMode: draftMode,
1948
2015
  draftModeReady: (_draftModeReady$curre2 = draftModeReady.current) === null || _draftModeReady$curre2 === void 0 ? void 0 : _draftModeReady$curre2.promise,
1949
2016
  draftSourcesSynced: draftSourcesSynced,
@@ -2010,7 +2077,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
2010
2077
  draftMode: draftMode === true,
2011
2078
  isRefreshing: isRefreshing,
2012
2079
  holds: holds,
2013
- holdsVersions: holdsVersions
2080
+ holdsVersions: holdsVersions,
2081
+ codeChanged: codeChanged === null || codeChanged === void 0 ? void 0 : codeChanged.modules
2014
2082
  }), mountOverlay && iframeSrc && /*#__PURE__*/jsx("iframe", {
2015
2083
  loading: "eager",
2016
2084
  style: {
@@ -78,7 +78,7 @@ var packageJson = {
78
78
  "tanstack-router",
79
79
  "react"
80
80
  ],
81
- version: "0.152.2",
81
+ version: "0.153.1",
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.1",
80
80
  scripts: {
81
81
  typecheck: "tsc --noEmit",
82
82
  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.1",
82
82
  scripts: {
83
83
  typecheck: "tsc --noEmit",
84
84
  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.1",
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.1",
57
+ "@valbuild/mcp": "0.153.1",
58
+ "@valbuild/react": "0.153.1",
59
+ "@valbuild/server": "0.153.1",
60
+ "@valbuild/shared": "0.153.1",
61
+ "@valbuild/ui": "0.153.1"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@tanstack/react-router": "^1.170.41",
@@ -2,13 +2,14 @@
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-ca7e184f.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');
9
9
  var server = require('@valbuild/server');
10
10
  var stega = require('@valbuild/react/stega');
11
11
  var internal$1 = require('@valbuild/react/internal');
12
+ var internal$2 = require('@valbuild/shared/internal');
12
13
  var internal = require('@valbuild/server/internal');
13
14
  var routeFromVal = require('../../dist/routeFromVal-3d4d7c30.cjs.dev.js');
14
15
  var mcp = require('@valbuild/mcp');
@@ -359,7 +360,7 @@ function requestEnv(enabled, draft, snapshot) {
359
360
  return {
360
361
  sources: draft === null ? [internal$1.snapshotSource(snapshot)] : [draft, internal$1.snapshotSource(snapshot)],
361
362
  encode: enabled,
362
- schemaVersionOf: internal.readerSchemaVersion
363
+ schemaVersionOf: internal$2.readerSchemaVersion
363
364
  };
364
365
  }
365
366
 
@@ -414,9 +415,10 @@ var initFetchValStega = function initFetchValStega(deps) {
414
415
  */
415
416
  function snapshotForReaders(http) {
416
417
  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);
418
+ // Not a module staged after the build serving the address -- its own
419
+ // file, or a file it imports: its Source fits code these readers have
420
+ // not got. See `proposalAsBuilt`.
421
+ (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
422
  return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
421
423
  }
422
424
 
@@ -2,13 +2,14 @@
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-0e3d1c9d.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');
9
9
  var server = require('@valbuild/server');
10
10
  var stega = require('@valbuild/react/stega');
11
11
  var internal$1 = require('@valbuild/react/internal');
12
+ var internal$2 = require('@valbuild/shared/internal');
12
13
  var internal = require('@valbuild/server/internal');
13
14
  var routeFromVal = require('../../dist/routeFromVal-2e834397.cjs.prod.js');
14
15
  var mcp = require('@valbuild/mcp');
@@ -359,7 +360,7 @@ function requestEnv(enabled, draft, snapshot) {
359
360
  return {
360
361
  sources: draft === null ? [internal$1.snapshotSource(snapshot)] : [draft, internal$1.snapshotSource(snapshot)],
361
362
  encode: enabled,
362
- schemaVersionOf: internal.readerSchemaVersion
363
+ schemaVersionOf: internal$2.readerSchemaVersion
363
364
  };
364
365
  }
365
366
 
@@ -414,9 +415,10 @@ var initFetchValStega = function initFetchValStega(deps) {
414
415
  */
415
416
  function snapshotForReaders(http) {
416
417
  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);
418
+ // Not a module staged after the build serving the address -- its own
419
+ // file, or a file it imports: its Source fits code these readers have
420
+ // not got. See `proposalAsBuilt`.
421
+ (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
422
  return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
421
423
  }
422
424
 
@@ -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-65630089.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,8 @@ 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 { readerSchemaVersion } from '@valbuild/shared/internal';
10
+ import { createValRuntime, proposalAsBuilt, servingBuildOf, draftForRequest, readDraftChanges } from '@valbuild/server/internal';
10
11
  import { i as initValRouteFromVal, g as getValRouteUrlFromVal } from '../../dist/routeFromVal-124235a5.esm.js';
11
12
  import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
12
13
  import '@valbuild/shared/client';
@@ -393,9 +394,10 @@ var initFetchValStega = function initFetchValStega(deps) {
393
394
  */
394
395
  function snapshotForReaders(http) {
395
396
  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);
397
+ // Not a module staged after the build serving the address -- its own
398
+ // file, or a file it imports: its Source fits code these readers have
399
+ // not got. See `proposalAsBuilt`.
400
+ (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
401
  return source !== undefined ? proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
400
402
  }
401
403