@valbuild/next 0.153.4 → 0.153.6

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/{ValCanvasBridge-fc46ab88.cjs.dev.js → ValCanvasBridge-1f98937c.cjs.dev.js} +73 -10
  3. package/dist/{ValCanvasBridge-cf8d7967.esm.js → ValCanvasBridge-4f025b11.esm.js} +74 -11
  4. package/dist/ValCanvasBridge-d0230cd2.cjs.js +7 -0
  5. package/dist/{ValCanvasBridge-50bf5366.cjs.prod.js → ValCanvasBridge-d0230cd2.cjs.prod.js} +73 -10
  6. package/dist/{ValNextProvider-b4eae85e.esm.js → ValNextProvider-27242758.esm.js} +15 -2
  7. package/dist/{ValNextProvider-5e29689e.cjs.dev.js → ValNextProvider-4838fed0.cjs.dev.js} +14 -1
  8. package/dist/ValNextProvider-9343dc1e.cjs.js +7 -0
  9. package/dist/{ValNextProvider-06854ec0.cjs.prod.js → ValNextProvider-9343dc1e.cjs.prod.js} +14 -1
  10. package/dist/valbuild-next.cjs.dev.js +2 -2
  11. package/dist/valbuild-next.cjs.prod.js +2 -2
  12. package/dist/valbuild-next.esm.js +2 -2
  13. package/dist/{version-3e1ee6cb.cjs.dev.js → version-6bcddc39.cjs.dev.js} +1 -1
  14. package/dist/{version-9c2209f2.cjs.prod.js → version-6df1633a.cjs.prod.js} +1 -1
  15. package/dist/{version-a035d22e.esm.js → version-73b4e0ba.esm.js} +1 -1
  16. package/package.json +8 -8
  17. package/rsc/dist/valbuild-next-rsc.cjs.dev.js +1 -1
  18. package/rsc/dist/valbuild-next-rsc.cjs.prod.js +1 -1
  19. package/rsc/dist/valbuild-next-rsc.esm.js +1 -1
  20. package/server/dist/valbuild-next-server.cjs.dev.js +1 -1
  21. package/server/dist/valbuild-next-server.cjs.prod.js +1 -1
  22. package/server/dist/valbuild-next-server.esm.js +1 -1
  23. package/dist/ValCanvasBridge-50bf5366.cjs.js +0 -7
  24. package/dist/ValNextProvider-06854ec0.cjs.js +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @valbuild/next
2
2
 
3
+ ## 0.153.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1047](https://github.com/valbuild/val/pull/1047) [`00b13fe`](https://github.com/valbuild/val/commit/00b13fe0ed9adc2ce22b3e9827e9fa5b10d5bfdf) Thanks [@freekh](https://github.com/freekh)! - The assistant can now see what went wrong on the page in the preview. A new `read_page_log` tool reads the page's console errors and warnings, uncaught exceptions, unhandled promise rejections, images, scripts and stylesheets that did not load, and `fetch` requests that failed or answered 400 or more, so a section that is blank because its component threw no longer looks like a section with nothing in it. Every `read_page` answer also counts them, and names the Val modules the page read. The log is kept only in the Studio's preview, never on a visitor's page, and leaves Val's own requests and log lines out.
8
+
9
+ The preview now says which requests it answers. When the site runs an older `@valbuild/next` or `@valbuild/tanstack` than the Studio, a page tool it cannot answer fails at once with which package to update, and to which version, instead of waiting for an answer that never comes. Update `@valbuild/next` or `@valbuild/tanstack` together with the Studio to get `read_page_log`.
10
+
11
+ - Updated dependencies [[`a561665`](https://github.com/valbuild/val/commit/a5616659c202eaa5ad61e1a035c9b9ca2a007e9a), [`00b13fe`](https://github.com/valbuild/val/commit/00b13fe0ed9adc2ce22b3e9827e9fa5b10d5bfdf), [`79b4452`](https://github.com/valbuild/val/commit/79b4452441ae2a9442f1217cca372f2d7cebd5a4), [`3944e3e`](https://github.com/valbuild/val/commit/3944e3e3c33678bca2a0aa46fcc0f4adbf8c2ba5), [`a8a1056`](https://github.com/valbuild/val/commit/a8a105620849ff73b91aff1492c39548926a7a7f), [`2c98fcc`](https://github.com/valbuild/val/commit/2c98fcc776f15c979dae74a1a86ca91cad70e7de), [`0dd664f`](https://github.com/valbuild/val/commit/0dd664f7bde9bfb552ecd643b2345998c69d5914)]:
12
+ - @valbuild/ui@0.153.6
13
+ - @valbuild/shared@0.153.6
14
+ - @valbuild/server@0.153.6
15
+ - @valbuild/mcp@0.153.6
16
+ - @valbuild/react@0.153.6
17
+ - @valbuild/language-server@0.153.6
18
+
19
+ ## 0.153.5
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`0176db3`](https://github.com/valbuild/val/commit/0176db30d8d621002cf72025b063b6f62b79b00d), [`aa26301`](https://github.com/valbuild/val/commit/aa26301afae68d31f37341b84ee3fd23ee532b45), [`6b3f4c5`](https://github.com/valbuild/val/commit/6b3f4c53ad51a86027654f64da5fb332f40df37f), [`f488c90`](https://github.com/valbuild/val/commit/f488c907fc3f22a33d64ea7ac36f513c405389a2)]:
24
+ - @valbuild/ui@0.153.5
25
+ - @valbuild/server@0.153.5
26
+ - @valbuild/shared@0.153.5
27
+ - @valbuild/core@0.153.5
28
+ - @valbuild/react@0.153.5
29
+ - @valbuild/language-server@0.153.5
30
+ - @valbuild/mcp@0.153.5
31
+
3
32
  ## 0.153.4
4
33
 
5
34
  ### Patch Changes
@@ -10,6 +10,7 @@ var slicedToArray = require('./slicedToArray-ed812733.cjs.dev.js');
10
10
  var React = require('react');
11
11
  var core = require('@valbuild/core');
12
12
  var client = require('@valbuild/shared/client');
13
+ var version = require('./version-6bcddc39.cjs.dev.js');
13
14
  var jsxRuntime = require('react/jsx-runtime');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -208,7 +209,7 @@ function ValCanvasBridge(_ref) {
208
209
 
209
210
  // Announce the frame, and say whether it is actually showing draft content.
210
211
  React__default["default"].useEffect(function () {
211
- post(objectSpread2._objectSpread2(objectSpread2._objectSpread2({
212
+ post(objectSpread2._objectSpread2(objectSpread2._objectSpread2(objectSpread2._objectSpread2({
212
213
  val: client.VAL_CANVAS_MESSAGE,
213
214
  type: "ready",
214
215
  draftMode: draftMode,
@@ -217,7 +218,15 @@ function ValCanvasBridge(_ref) {
217
218
  holds: _toConsumableArray(holds)
218
219
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
219
220
  holdsVersions: holdsVersions
220
- } : {}));
221
+ } : {}), {}, {
222
+ // What this bridge answers, so the Studio never waits on a request
223
+ // it would not: see `capabilities` in the protocol.
224
+ capabilities: _toConsumableArray(client.BRIDGE_CAPABILITIES),
225
+ bridge: {
226
+ "package": "@valbuild/next",
227
+ version: version.VERSION
228
+ }
229
+ }));
221
230
  }, [post, draftMode, holds, holdsVersions]);
222
231
 
223
232
  /**
@@ -362,15 +371,25 @@ function ValCanvasBridge(_ref) {
362
371
  window.parent.postMessage(readPageReply(message), asker);
363
372
  return;
364
373
  }
374
+ if (message.type === "readPageLog") {
375
+ // The assistant's `read_page_log`: what the page logged as going
376
+ // wrong. As `readPage`: only for the frame's parent, when that is
377
+ // the Studio here, and answered to it alone.
378
+ if (event.source !== window.parent) return;
379
+ var _asker = event.origin;
380
+ if (_asker !== window.location.origin) return;
381
+ window.parent.postMessage(readPageLogReply(message), _asker);
382
+ return;
383
+ }
365
384
  if (message.type === "screenshotPage") {
366
385
  // The assistant's `screenshot_page`: a picture of the page, drawn
367
386
  // here. As `readPage`: only for the frame's parent, when that is the
368
387
  // Studio here, and answered to it alone.
369
388
  if (event.source !== window.parent) return;
370
- var _asker = event.origin;
371
- if (_asker !== window.location.origin) return;
389
+ var _asker2 = event.origin;
390
+ if (_asker2 !== window.location.origin) return;
372
391
  void screenshotReply(message).then(function (reply) {
373
- return window.parent.postMessage(reply, _asker);
392
+ return window.parent.postMessage(reply, _asker2);
374
393
  });
375
394
  return;
376
395
  }
@@ -509,10 +528,17 @@ function ValCanvasBridge(_ref) {
509
528
  };
510
529
  }, [codeChanged, post]);
511
530
 
512
- // Where the page is, as it moves: a new build is opened there.
531
+ // The page's log, if the provider's module did not start it already.
532
+ React__default["default"].useEffect(function () {
533
+ pageLog();
534
+ }, []);
535
+
536
+ // Where the page is, as it moves: a new build is opened there. The log
537
+ // hears of it too, so a client-side navigation starts a new page in it.
513
538
  React__default["default"].useEffect(function () {
514
539
  return client.watchPageLocation(window, function (location) {
515
- return post(objectSpread2._objectSpread2({
540
+ pageLog().noteLocation();
541
+ post(objectSpread2._objectSpread2({
516
542
  val: client.VAL_CANVAS_MESSAGE,
517
543
  type: "location"
518
544
  }, location));
@@ -878,7 +904,12 @@ function findByPath(path) {
878
904
  function screenshotReply(_x) {
879
905
  return _screenshotReply.apply(this, arguments);
880
906
  }
881
- /** What `readPage` answers: the page read, or why it could not be. */
907
+ /**
908
+ * The page's log (`pageLog.ts`). Started when the provider's module was
909
+ * evaluated in the canvas, before hydration; started here, as late as the
910
+ * bridge mounts, only if that did not happen -- a document that was not the
911
+ * canvas when the provider loaded (see `isValCanvasFrame`).
912
+ */
882
913
  function _screenshotReply() {
883
914
  _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
884
915
  var _t2, _t3, _t4, _t5;
@@ -920,17 +951,49 @@ function _screenshotReply() {
920
951
  }));
921
952
  return _screenshotReply.apply(this, arguments);
922
953
  }
954
+ function pageLog() {
955
+ return client.installPageLog(window);
956
+ }
957
+
958
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
959
+ function readPageLogReply(message) {
960
+ try {
961
+ return {
962
+ val: client.VAL_CANVAS_MESSAGE,
963
+ type: "pageLogRead",
964
+ requestId: message.requestId,
965
+ log: pageLog().read(objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.sinceNavigation !== undefined ? {
966
+ sinceNavigation: message.sinceNavigation
967
+ } : {}), message.levels !== undefined ? {
968
+ levels: message.levels
969
+ } : {}))
970
+ };
971
+ } catch (error) {
972
+ return {
973
+ val: client.VAL_CANVAS_MESSAGE,
974
+ type: "pageLogRead",
975
+ requestId: message.requestId,
976
+ log: null,
977
+ error: error instanceof Error ? error.message : String(error)
978
+ };
979
+ }
980
+ }
981
+
982
+ /** What `readPage` answers: the page read, or why it could not be. */
923
983
  function readPageReply(message) {
924
984
  try {
925
985
  return {
926
986
  val: client.VAL_CANVAS_MESSAGE,
927
987
  type: "pageRead",
928
988
  requestId: message.requestId,
929
- snapshot: client.readPageSnapshot(document, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.selector !== undefined ? {
989
+ snapshot: objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, client.readPageSnapshot(document, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.selector !== undefined ? {
930
990
  selector: message.selector
931
991
  } : {}), message.maxItems !== undefined ? {
932
992
  maxItems: message.maxItems
933
- } : {}))
993
+ } : {}))), {}, {
994
+ // So the assistant notices the page threw without asking.
995
+ log: pageLog().counts()
996
+ })
934
997
  };
935
998
  } catch (error) {
936
999
  return {
@@ -5,7 +5,8 @@ import { _ as _objectSpread2 } from './objectSpread2-f1f0d77a.esm.js';
5
5
  import { _ as _slicedToArray } from './slicedToArray-5ff32315.esm.js';
6
6
  import React from 'react';
7
7
  import { Internal } from '@valbuild/core';
8
- import { VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, isCodeChangedDetail, screenshotPage, readPageSnapshot } from '@valbuild/shared/client';
8
+ import { VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, installPageLog, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, isCodeChangedDetail, screenshotPage, readPageSnapshot, BRIDGE_CAPABILITIES } from '@valbuild/shared/client';
9
+ import { V as VERSION } from './version-73b4e0ba.esm.js';
9
10
  import { jsx } from 'react/jsx-runtime';
10
11
 
11
12
  function _arrayWithoutHoles(r) {
@@ -200,7 +201,7 @@ function ValCanvasBridge(_ref) {
200
201
 
201
202
  // Announce the frame, and say whether it is actually showing draft content.
202
203
  React.useEffect(function () {
203
- post(_objectSpread2(_objectSpread2({
204
+ post(_objectSpread2(_objectSpread2(_objectSpread2({
204
205
  val: VAL_CANVAS_MESSAGE,
205
206
  type: "ready",
206
207
  draftMode: draftMode,
@@ -209,7 +210,15 @@ function ValCanvasBridge(_ref) {
209
210
  holds: _toConsumableArray(holds)
210
211
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
211
212
  holdsVersions: holdsVersions
212
- } : {}));
213
+ } : {}), {}, {
214
+ // What this bridge answers, so the Studio never waits on a request
215
+ // it would not: see `capabilities` in the protocol.
216
+ capabilities: _toConsumableArray(BRIDGE_CAPABILITIES),
217
+ bridge: {
218
+ "package": "@valbuild/next",
219
+ version: VERSION
220
+ }
221
+ }));
213
222
  }, [post, draftMode, holds, holdsVersions]);
214
223
 
215
224
  /**
@@ -354,15 +363,25 @@ function ValCanvasBridge(_ref) {
354
363
  window.parent.postMessage(readPageReply(message), asker);
355
364
  return;
356
365
  }
366
+ if (message.type === "readPageLog") {
367
+ // The assistant's `read_page_log`: what the page logged as going
368
+ // wrong. As `readPage`: only for the frame's parent, when that is
369
+ // the Studio here, and answered to it alone.
370
+ if (event.source !== window.parent) return;
371
+ var _asker = event.origin;
372
+ if (_asker !== window.location.origin) return;
373
+ window.parent.postMessage(readPageLogReply(message), _asker);
374
+ return;
375
+ }
357
376
  if (message.type === "screenshotPage") {
358
377
  // The assistant's `screenshot_page`: a picture of the page, drawn
359
378
  // here. As `readPage`: only for the frame's parent, when that is the
360
379
  // Studio here, and answered to it alone.
361
380
  if (event.source !== window.parent) return;
362
- var _asker = event.origin;
363
- if (_asker !== window.location.origin) return;
381
+ var _asker2 = event.origin;
382
+ if (_asker2 !== window.location.origin) return;
364
383
  void screenshotReply(message).then(function (reply) {
365
- return window.parent.postMessage(reply, _asker);
384
+ return window.parent.postMessage(reply, _asker2);
366
385
  });
367
386
  return;
368
387
  }
@@ -501,10 +520,17 @@ function ValCanvasBridge(_ref) {
501
520
  };
502
521
  }, [codeChanged, post]);
503
522
 
504
- // Where the page is, as it moves: a new build is opened there.
523
+ // The page's log, if the provider's module did not start it already.
524
+ React.useEffect(function () {
525
+ pageLog();
526
+ }, []);
527
+
528
+ // Where the page is, as it moves: a new build is opened there. The log
529
+ // hears of it too, so a client-side navigation starts a new page in it.
505
530
  React.useEffect(function () {
506
531
  return watchPageLocation(window, function (location) {
507
- return post(_objectSpread2({
532
+ pageLog().noteLocation();
533
+ post(_objectSpread2({
508
534
  val: VAL_CANVAS_MESSAGE,
509
535
  type: "location"
510
536
  }, location));
@@ -870,7 +896,12 @@ function findByPath(path) {
870
896
  function screenshotReply(_x) {
871
897
  return _screenshotReply.apply(this, arguments);
872
898
  }
873
- /** What `readPage` answers: the page read, or why it could not be. */
899
+ /**
900
+ * The page's log (`pageLog.ts`). Started when the provider's module was
901
+ * evaluated in the canvas, before hydration; started here, as late as the
902
+ * bridge mounts, only if that did not happen -- a document that was not the
903
+ * canvas when the provider loaded (see `isValCanvasFrame`).
904
+ */
874
905
  function _screenshotReply() {
875
906
  _screenshotReply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(message) {
876
907
  var _t2, _t3, _t4, _t5;
@@ -912,17 +943,49 @@ function _screenshotReply() {
912
943
  }));
913
944
  return _screenshotReply.apply(this, arguments);
914
945
  }
946
+ function pageLog() {
947
+ return installPageLog(window);
948
+ }
949
+
950
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
951
+ function readPageLogReply(message) {
952
+ try {
953
+ return {
954
+ val: VAL_CANVAS_MESSAGE,
955
+ type: "pageLogRead",
956
+ requestId: message.requestId,
957
+ log: pageLog().read(_objectSpread2(_objectSpread2({}, message.sinceNavigation !== undefined ? {
958
+ sinceNavigation: message.sinceNavigation
959
+ } : {}), message.levels !== undefined ? {
960
+ levels: message.levels
961
+ } : {}))
962
+ };
963
+ } catch (error) {
964
+ return {
965
+ val: VAL_CANVAS_MESSAGE,
966
+ type: "pageLogRead",
967
+ requestId: message.requestId,
968
+ log: null,
969
+ error: error instanceof Error ? error.message : String(error)
970
+ };
971
+ }
972
+ }
973
+
974
+ /** What `readPage` answers: the page read, or why it could not be. */
915
975
  function readPageReply(message) {
916
976
  try {
917
977
  return {
918
978
  val: VAL_CANVAS_MESSAGE,
919
979
  type: "pageRead",
920
980
  requestId: message.requestId,
921
- snapshot: readPageSnapshot(document, _objectSpread2(_objectSpread2({}, message.selector !== undefined ? {
981
+ snapshot: _objectSpread2(_objectSpread2({}, readPageSnapshot(document, _objectSpread2(_objectSpread2({}, message.selector !== undefined ? {
922
982
  selector: message.selector
923
983
  } : {}), message.maxItems !== undefined ? {
924
984
  maxItems: message.maxItems
925
- } : {}))
985
+ } : {}))), {}, {
986
+ // So the assistant notices the page threw without asking.
987
+ log: pageLog().counts()
988
+ })
926
989
  };
927
990
  } catch (error) {
928
991
  return {
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValCanvasBridge-d0230cd2.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValCanvasBridge-d0230cd2.cjs.dev.js");
7
+ }
@@ -10,6 +10,7 @@ var slicedToArray = require('./slicedToArray-0fc63719.cjs.prod.js');
10
10
  var React = require('react');
11
11
  var core = require('@valbuild/core');
12
12
  var client = require('@valbuild/shared/client');
13
+ var version = require('./version-6df1633a.cjs.prod.js');
13
14
  var jsxRuntime = require('react/jsx-runtime');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -208,7 +209,7 @@ function ValCanvasBridge(_ref) {
208
209
 
209
210
  // Announce the frame, and say whether it is actually showing draft content.
210
211
  React__default["default"].useEffect(function () {
211
- post(objectSpread2._objectSpread2(objectSpread2._objectSpread2({
212
+ post(objectSpread2._objectSpread2(objectSpread2._objectSpread2(objectSpread2._objectSpread2({
212
213
  val: client.VAL_CANVAS_MESSAGE,
213
214
  type: "ready",
214
215
  draftMode: draftMode,
@@ -217,7 +218,15 @@ function ValCanvasBridge(_ref) {
217
218
  holds: _toConsumableArray(holds)
218
219
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
219
220
  holdsVersions: holdsVersions
220
- } : {}));
221
+ } : {}), {}, {
222
+ // What this bridge answers, so the Studio never waits on a request
223
+ // it would not: see `capabilities` in the protocol.
224
+ capabilities: _toConsumableArray(client.BRIDGE_CAPABILITIES),
225
+ bridge: {
226
+ "package": "@valbuild/next",
227
+ version: version.VERSION
228
+ }
229
+ }));
221
230
  }, [post, draftMode, holds, holdsVersions]);
222
231
 
223
232
  /**
@@ -362,15 +371,25 @@ function ValCanvasBridge(_ref) {
362
371
  window.parent.postMessage(readPageReply(message), asker);
363
372
  return;
364
373
  }
374
+ if (message.type === "readPageLog") {
375
+ // The assistant's `read_page_log`: what the page logged as going
376
+ // wrong. As `readPage`: only for the frame's parent, when that is
377
+ // the Studio here, and answered to it alone.
378
+ if (event.source !== window.parent) return;
379
+ var _asker = event.origin;
380
+ if (_asker !== window.location.origin) return;
381
+ window.parent.postMessage(readPageLogReply(message), _asker);
382
+ return;
383
+ }
365
384
  if (message.type === "screenshotPage") {
366
385
  // The assistant's `screenshot_page`: a picture of the page, drawn
367
386
  // here. As `readPage`: only for the frame's parent, when that is the
368
387
  // Studio here, and answered to it alone.
369
388
  if (event.source !== window.parent) return;
370
- var _asker = event.origin;
371
- if (_asker !== window.location.origin) return;
389
+ var _asker2 = event.origin;
390
+ if (_asker2 !== window.location.origin) return;
372
391
  void screenshotReply(message).then(function (reply) {
373
- return window.parent.postMessage(reply, _asker);
392
+ return window.parent.postMessage(reply, _asker2);
374
393
  });
375
394
  return;
376
395
  }
@@ -509,10 +528,17 @@ function ValCanvasBridge(_ref) {
509
528
  };
510
529
  }, [codeChanged, post]);
511
530
 
512
- // Where the page is, as it moves: a new build is opened there.
531
+ // The page's log, if the provider's module did not start it already.
532
+ React__default["default"].useEffect(function () {
533
+ pageLog();
534
+ }, []);
535
+
536
+ // Where the page is, as it moves: a new build is opened there. The log
537
+ // hears of it too, so a client-side navigation starts a new page in it.
513
538
  React__default["default"].useEffect(function () {
514
539
  return client.watchPageLocation(window, function (location) {
515
- return post(objectSpread2._objectSpread2({
540
+ pageLog().noteLocation();
541
+ post(objectSpread2._objectSpread2({
516
542
  val: client.VAL_CANVAS_MESSAGE,
517
543
  type: "location"
518
544
  }, location));
@@ -878,7 +904,12 @@ function findByPath(path) {
878
904
  function screenshotReply(_x) {
879
905
  return _screenshotReply.apply(this, arguments);
880
906
  }
881
- /** What `readPage` answers: the page read, or why it could not be. */
907
+ /**
908
+ * The page's log (`pageLog.ts`). Started when the provider's module was
909
+ * evaluated in the canvas, before hydration; started here, as late as the
910
+ * bridge mounts, only if that did not happen -- a document that was not the
911
+ * canvas when the provider loaded (see `isValCanvasFrame`).
912
+ */
882
913
  function _screenshotReply() {
883
914
  _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
884
915
  var _t2, _t3, _t4, _t5;
@@ -920,17 +951,49 @@ function _screenshotReply() {
920
951
  }));
921
952
  return _screenshotReply.apply(this, arguments);
922
953
  }
954
+ function pageLog() {
955
+ return client.installPageLog(window);
956
+ }
957
+
958
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
959
+ function readPageLogReply(message) {
960
+ try {
961
+ return {
962
+ val: client.VAL_CANVAS_MESSAGE,
963
+ type: "pageLogRead",
964
+ requestId: message.requestId,
965
+ log: pageLog().read(objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.sinceNavigation !== undefined ? {
966
+ sinceNavigation: message.sinceNavigation
967
+ } : {}), message.levels !== undefined ? {
968
+ levels: message.levels
969
+ } : {}))
970
+ };
971
+ } catch (error) {
972
+ return {
973
+ val: client.VAL_CANVAS_MESSAGE,
974
+ type: "pageLogRead",
975
+ requestId: message.requestId,
976
+ log: null,
977
+ error: error instanceof Error ? error.message : String(error)
978
+ };
979
+ }
980
+ }
981
+
982
+ /** What `readPage` answers: the page read, or why it could not be. */
923
983
  function readPageReply(message) {
924
984
  try {
925
985
  return {
926
986
  val: client.VAL_CANVAS_MESSAGE,
927
987
  type: "pageRead",
928
988
  requestId: message.requestId,
929
- snapshot: client.readPageSnapshot(document, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.selector !== undefined ? {
989
+ snapshot: objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, client.readPageSnapshot(document, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.selector !== undefined ? {
930
990
  selector: message.selector
931
991
  } : {}), message.maxItems !== undefined ? {
932
992
  maxItems: message.maxItems
933
- } : {}))
993
+ } : {}))), {}, {
994
+ // So the assistant notices the page threw without asking.
995
+ log: pageLog().counts()
996
+ })
934
997
  };
935
998
  } catch (error) {
936
999
  return {
@@ -11,9 +11,9 @@ import { ValOverlayProvider } from './ValOverlayContext-51716662.esm.js';
11
11
  import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
12
12
  import { isDraft, windowCodeChangedReporter, createDraftStore, draftHolds, draftHoldsVersions, startRefreshLoop, dispatchCodeChanged, applyValEvent } from '@valbuild/react/internal';
13
13
  import { p as prefixStyles, u as useConfigStorageSave, f as floatDarkBg, d as floatLightBg, v as valPrefixedClass, c as cn } from './fallbackColors-0d915c59.esm.js';
14
- import { VAL_THEME_SESSION_STORAGE_KEY, isValCanvasFrame } from '@valbuild/shared/client';
14
+ import { VAL_THEME_SESSION_STORAGE_KEY, installPageLogInCanvasFrame, isValCanvasFrame } from '@valbuild/shared/client';
15
15
  import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-9209e9dd.esm.js';
16
- import { ValCanvasBridge } from './ValCanvasBridge-cf8d7967.esm.js';
16
+ import { ValCanvasBridge } from './ValCanvasBridge-4f025b11.esm.js';
17
17
  import { jsxs, jsx } from 'react/jsx-runtime';
18
18
  import './unsupportedIterableToArray-f57eb659.esm.js';
19
19
 
@@ -69,6 +69,19 @@ function hasValEnableCookie(cookieString) {
69
69
  return false;
70
70
  }
71
71
 
72
+ installPageLogInCanvasFrame(function () {
73
+ return hasValEnableCookie(document.cookie);
74
+ });
75
+
76
+ /**
77
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
78
+ */
79
+ /**
80
+ * How often `/draft/stat` is asked when nothing is in progress.
81
+ *
82
+ * Draft mode changes when someone toggles it, which the handshake below already
83
+ * covers — so this is only there to notice it being changed somewhere else.
84
+ */
72
85
  var DRAFT_IDLE_POLL_MS = 20000;
73
86
 
74
87
  /**
@@ -17,7 +17,7 @@ var internal = require('@valbuild/react/internal');
17
17
  var fallbackColors = require('./fallbackColors-38f01ad2.cjs.dev.js');
18
18
  var client = require('@valbuild/shared/client');
19
19
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
20
- var ValCanvasBridge = require('./ValCanvasBridge-fc46ab88.cjs.dev.js');
20
+ var ValCanvasBridge = require('./ValCanvasBridge-1f98937c.cjs.dev.js');
21
21
  var jsxRuntime = require('react/jsx-runtime');
22
22
  require('./unsupportedIterableToArray-20a9209f.cjs.dev.js');
23
23
 
@@ -96,6 +96,19 @@ function hasValEnableCookie(cookieString) {
96
96
  return false;
97
97
  }
98
98
 
99
+ client.installPageLogInCanvasFrame(function () {
100
+ return hasValEnableCookie(document.cookie);
101
+ });
102
+
103
+ /**
104
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
105
+ */
106
+ /**
107
+ * How often `/draft/stat` is asked when nothing is in progress.
108
+ *
109
+ * Draft mode changes when someone toggles it, which the handshake below already
110
+ * covers — so this is only there to notice it being changed somewhere else.
111
+ */
99
112
  var DRAFT_IDLE_POLL_MS = 20000;
100
113
 
101
114
  /**
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValNextProvider-9343dc1e.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValNextProvider-9343dc1e.cjs.dev.js");
7
+ }
@@ -17,7 +17,7 @@ var internal = require('@valbuild/react/internal');
17
17
  var fallbackColors = require('./fallbackColors-d9a7b81e.cjs.prod.js');
18
18
  var client = require('@valbuild/shared/client');
19
19
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-8459fbc7.cjs.prod.js');
20
- var ValCanvasBridge = require('./ValCanvasBridge-50bf5366.cjs.prod.js');
20
+ var ValCanvasBridge = require('./ValCanvasBridge-d0230cd2.cjs.prod.js');
21
21
  var jsxRuntime = require('react/jsx-runtime');
22
22
  require('./unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
23
23
 
@@ -96,6 +96,19 @@ function hasValEnableCookie(cookieString) {
96
96
  return false;
97
97
  }
98
98
 
99
+ client.installPageLogInCanvasFrame(function () {
100
+ return hasValEnableCookie(document.cookie);
101
+ });
102
+
103
+ /**
104
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
105
+ */
106
+ /**
107
+ * How often `/draft/stat` is asked when nothing is in progress.
108
+ *
109
+ * Draft mode changes when someone toggles it, which the handshake below already
110
+ * covers — so this is only there to notice it being changed somewhere else.
111
+ */
99
112
  var DRAFT_IDLE_POLL_MS = 20000;
100
113
 
101
114
  /**
@@ -8,13 +8,13 @@ var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var objectWithoutProperties = require('./objectWithoutProperties-8f93848f.cjs.dev.js');
10
10
  var internal = require('@valbuild/react/internal');
11
- var ValNextProvider = require('./ValNextProvider-5e29689e.cjs.dev.js');
11
+ var ValNextProvider = require('./ValNextProvider-4838fed0.cjs.dev.js');
12
12
  var NextImage = require('next/image');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
14
  var ValVideo = require('./ValVideo-15e5c4fa.cjs.dev.js');
15
15
  var ValApp = require('./ValApp-826dca6c.cjs.dev.js');
16
16
  var ValModulesClient = require('./ValModulesClient-4ecabf99.cjs.dev.js');
17
- var version = require('./version-3e1ee6cb.cjs.dev.js');
17
+ var version = require('./version-6bcddc39.cjs.dev.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
19
19
  require('./unsupportedIterableToArray-20a9209f.cjs.dev.js');
20
20
 
@@ -8,13 +8,13 @@ var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var objectWithoutProperties = require('./objectWithoutProperties-107dcb46.cjs.prod.js');
10
10
  var internal = require('@valbuild/react/internal');
11
- var ValNextProvider = require('./ValNextProvider-06854ec0.cjs.prod.js');
11
+ var ValNextProvider = require('./ValNextProvider-9343dc1e.cjs.prod.js');
12
12
  var NextImage = require('next/image');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
14
  var ValVideo = require('./ValVideo-02f43a7c.cjs.prod.js');
15
15
  var ValApp = require('./ValApp-866089f6.cjs.prod.js');
16
16
  var ValModulesClient = require('./ValModulesClient-10c0721c.cjs.prod.js');
17
- var version = require('./version-9c2209f2.cjs.prod.js');
17
+ var version = require('./version-6df1633a.cjs.prod.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-8459fbc7.cjs.prod.js');
19
19
  require('./unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
20
20
 
@@ -7,13 +7,13 @@ export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@va
7
7
  import { stegaEncode, attrs, raw, autoTagJSX } from '@valbuild/react/stega';
8
8
  import { d as decodeValPathsOfString, _ as _objectWithoutProperties } from './objectWithoutProperties-2daec22c.esm.js';
9
9
  export { ValRichText } from '@valbuild/react/internal';
10
- import { ValNextProvider } from './ValNextProvider-b4eae85e.esm.js';
10
+ import { ValNextProvider } from './ValNextProvider-27242758.esm.js';
11
11
  import NextImage from 'next/image';
12
12
  import { jsx } from 'react/jsx-runtime';
13
13
  export { ValVideo } from './ValVideo-8acf31b6.esm.js';
14
14
  export { ValApp } from './ValApp-69cd599c.esm.js';
15
15
  export { ValModulesClient, useRegisterValModules } from './ValModulesClient-0dd601a1.esm.js';
16
- import { V as VERSION } from './version-a035d22e.esm.js';
16
+ import { V as VERSION } from './version-73b4e0ba.esm.js';
17
17
  import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-9209e9dd.esm.js';
18
18
  import './unsupportedIterableToArray-f57eb659.esm.js';
19
19
 
@@ -14,7 +14,7 @@ var packageJson = {
14
14
  "next",
15
15
  "react"
16
16
  ],
17
- version: "0.153.4",
17
+ version: "0.153.6",
18
18
  scripts: {
19
19
  typecheck: "tsc --noEmit",
20
20
  test: "jest"
@@ -14,7 +14,7 @@ var packageJson = {
14
14
  "next",
15
15
  "react"
16
16
  ],
17
- version: "0.153.4",
17
+ version: "0.153.6",
18
18
  scripts: {
19
19
  typecheck: "tsc --noEmit",
20
20
  test: "jest"
@@ -12,7 +12,7 @@ var packageJson = {
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- version: "0.153.4",
15
+ version: "0.153.6",
16
16
  scripts: {
17
17
  typecheck: "tsc --noEmit",
18
18
  test: "jest"
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- "version": "0.153.4",
15
+ "version": "0.153.6",
16
16
  "main": "dist/valbuild-next.cjs.js",
17
17
  "module": "dist/valbuild-next.esm.js",
18
18
  "exports": {
@@ -47,13 +47,13 @@
47
47
  "dependencies": {
48
48
  "client-only": "^0.0.1",
49
49
  "server-only": "^0.0.1",
50
- "@valbuild/core": "0.153.0",
51
- "@valbuild/language-server": "0.153.4",
52
- "@valbuild/mcp": "0.153.4",
53
- "@valbuild/react": "0.153.4",
54
- "@valbuild/server": "0.153.4",
55
- "@valbuild/shared": "0.153.1",
56
- "@valbuild/ui": "0.153.4"
50
+ "@valbuild/core": "0.153.5",
51
+ "@valbuild/language-server": "0.153.6",
52
+ "@valbuild/mcp": "0.153.6",
53
+ "@valbuild/react": "0.153.6",
54
+ "@valbuild/server": "0.153.6",
55
+ "@valbuild/shared": "0.153.6",
56
+ "@valbuild/ui": "0.153.6"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@testing-library/react": "^16.3.3",
@@ -10,7 +10,7 @@ var internal$1 = require('@valbuild/react/internal');
10
10
  var core = require('@valbuild/core');
11
11
  var internal$2 = require('@valbuild/shared/internal');
12
12
  var internal = require('@valbuild/server/internal');
13
- var version = require('../../dist/version-3e1ee6cb.cjs.dev.js');
13
+ var version = require('../../dist/version-6bcddc39.cjs.dev.js');
14
14
  var routeFromVal = require('../../dist/routeFromVal-a1e0a8be.cjs.dev.js');
15
15
  require('../../dist/createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
16
16
  require('../../dist/unsupportedIterableToArray-20a9209f.cjs.dev.js');
@@ -10,7 +10,7 @@ var internal$1 = require('@valbuild/react/internal');
10
10
  var core = require('@valbuild/core');
11
11
  var internal$2 = require('@valbuild/shared/internal');
12
12
  var internal = require('@valbuild/server/internal');
13
- var version = require('../../dist/version-9c2209f2.cjs.prod.js');
13
+ var version = require('../../dist/version-6df1633a.cjs.prod.js');
14
14
  var routeFromVal = require('../../dist/routeFromVal-c4dace91.cjs.prod.js');
15
15
  require('../../dist/createForOfIteratorHelper-8459fbc7.cjs.prod.js');
16
16
  require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
@@ -6,7 +6,7 @@ import { fetchValFrom, isJsonValuesRecordSchema, awaitResolved, resolveValEntry,
6
6
  import { Internal } from '@valbuild/core';
7
7
  import { readerSchemaVersion } from '@valbuild/shared/internal';
8
8
  import { createValRuntime, readDraftChanges, draftForRequest } from '@valbuild/server/internal';
9
- import { V as VERSION } from '../../dist/version-a035d22e.esm.js';
9
+ import { V as VERSION } from '../../dist/version-73b4e0ba.esm.js';
10
10
  import { i as initValRouteFromVal, g as getValRouteUrlFromVal } from '../../dist/routeFromVal-80976677.esm.js';
11
11
  import '../../dist/createForOfIteratorHelper-9209e9dd.esm.js';
12
12
  import '../../dist/unsupportedIterableToArray-f57eb659.esm.js';
@@ -9,7 +9,7 @@ var objectSpread2 = require('../../dist/objectSpread2-58726b14.cjs.dev.js');
9
9
  var core = require('@valbuild/core');
10
10
  var server = require('@valbuild/server');
11
11
  var server$1 = require('next/server');
12
- var version = require('../../dist/version-3e1ee6cb.cjs.dev.js');
12
+ var version = require('../../dist/version-6bcddc39.cjs.dev.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('../../dist/unsupportedIterableToArray-20a9209f.cjs.dev.js');
15
15
 
@@ -9,7 +9,7 @@ var objectSpread2 = require('../../dist/objectSpread2-469273e9.cjs.prod.js');
9
9
  var core = require('@valbuild/core');
10
10
  var server = require('@valbuild/server');
11
11
  var server$1 = require('next/server');
12
- var version = require('../../dist/version-9c2209f2.cjs.prod.js');
12
+ var version = require('../../dist/version-6df1633a.cjs.prod.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
15
15
 
@@ -6,7 +6,7 @@ import { Internal } from '@valbuild/core';
6
6
  import { createValApiRouter, createValServer } from '@valbuild/server';
7
7
  export { createPrettierFormatter } from '@valbuild/server';
8
8
  import { NextResponse } from 'next/server';
9
- import { V as VERSION } from '../../dist/version-a035d22e.esm.js';
9
+ import { V as VERSION } from '../../dist/version-73b4e0ba.esm.js';
10
10
  import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
11
11
  import '../../dist/unsupportedIterableToArray-f57eb659.esm.js';
12
12
 
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValCanvasBridge-50bf5366.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValCanvasBridge-50bf5366.cjs.dev.js");
7
- }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValNextProvider-06854ec0.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValNextProvider-06854ec0.cjs.dev.js");
7
- }