@valbuild/tanstack 0.153.5 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @valbuild/tanstack
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
+
3
19
  ## 0.153.5
4
20
 
5
21
  ### Patch Changes
@@ -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-fb089780.cjs.dev.js');
9
+ var version = require('./version-bee0c459.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');
@@ -425,7 +425,7 @@ function ValCanvasBridge(_ref) {
425
425
 
426
426
  // Announce the frame, and say whether it is actually showing draft content.
427
427
  React__default["default"].useEffect(function () {
428
- post(_typeof._objectSpread2(_typeof._objectSpread2({
428
+ post(_typeof._objectSpread2(_typeof._objectSpread2(_typeof._objectSpread2({
429
429
  val: client.VAL_CANVAS_MESSAGE,
430
430
  type: "ready",
431
431
  draftMode: draftMode,
@@ -434,7 +434,15 @@ function ValCanvasBridge(_ref) {
434
434
  holds: _toConsumableArray(holds)
435
435
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
436
436
  holdsVersions: holdsVersions
437
- } : {}));
437
+ } : {}), {}, {
438
+ // What this bridge answers, so the Studio never waits on a request
439
+ // it would not: see `capabilities` in the protocol.
440
+ capabilities: _toConsumableArray(client.BRIDGE_CAPABILITIES),
441
+ bridge: {
442
+ "package": "@valbuild/tanstack",
443
+ version: version.VERSION
444
+ }
445
+ }));
438
446
  }, [post, draftMode, holds, holdsVersions]);
439
447
 
440
448
  /**
@@ -579,15 +587,25 @@ function ValCanvasBridge(_ref) {
579
587
  window.parent.postMessage(readPageReply(message), asker);
580
588
  return;
581
589
  }
590
+ if (message.type === "readPageLog") {
591
+ // The assistant's `read_page_log`: what the page logged as going
592
+ // wrong. As `readPage`: only for the frame's parent, when that is
593
+ // the Studio here, and answered to it alone.
594
+ if (event.source !== window.parent) return;
595
+ var _asker = event.origin;
596
+ if (_asker !== window.location.origin) return;
597
+ window.parent.postMessage(readPageLogReply(message), _asker);
598
+ return;
599
+ }
582
600
  if (message.type === "screenshotPage") {
583
601
  // The assistant's `screenshot_page`: a picture of the page, drawn
584
602
  // here. As `readPage`: only for the frame's parent, when that is the
585
603
  // Studio here, and answered to it alone.
586
604
  if (event.source !== window.parent) return;
587
- var _asker = event.origin;
588
- if (_asker !== window.location.origin) return;
605
+ var _asker2 = event.origin;
606
+ if (_asker2 !== window.location.origin) return;
589
607
  void screenshotReply(message).then(function (reply) {
590
- return window.parent.postMessage(reply, _asker);
608
+ return window.parent.postMessage(reply, _asker2);
591
609
  });
592
610
  return;
593
611
  }
@@ -726,10 +744,17 @@ function ValCanvasBridge(_ref) {
726
744
  };
727
745
  }, [codeChanged, post]);
728
746
 
729
- // Where the page is, as it moves: a new build is opened there.
747
+ // The page's log, if the provider's module did not start it already.
748
+ React__default["default"].useEffect(function () {
749
+ pageLog();
750
+ }, []);
751
+
752
+ // Where the page is, as it moves: a new build is opened there. The log
753
+ // hears of it too, so a client-side navigation starts a new page in it.
730
754
  React__default["default"].useEffect(function () {
731
755
  return client.watchPageLocation(window, function (location) {
732
- return post(_typeof._objectSpread2({
756
+ pageLog().noteLocation();
757
+ post(_typeof._objectSpread2({
733
758
  val: client.VAL_CANVAS_MESSAGE,
734
759
  type: "location"
735
760
  }, location));
@@ -1095,7 +1120,12 @@ function findByPath(path) {
1095
1120
  function screenshotReply(_x) {
1096
1121
  return _screenshotReply.apply(this, arguments);
1097
1122
  }
1098
- /** What `readPage` answers: the page read, or why it could not be. */
1123
+ /**
1124
+ * The page's log (`pageLog.ts`). Started when the provider's module was
1125
+ * evaluated in the canvas, before hydration; started here, as late as the
1126
+ * bridge mounts, only if that did not happen -- a document that was not the
1127
+ * canvas when the provider loaded (see `isValCanvasFrame`).
1128
+ */
1099
1129
  function _screenshotReply() {
1100
1130
  _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
1101
1131
  var _t2, _t3, _t4, _t5;
@@ -1137,17 +1167,49 @@ function _screenshotReply() {
1137
1167
  }));
1138
1168
  return _screenshotReply.apply(this, arguments);
1139
1169
  }
1170
+ function pageLog() {
1171
+ return client.installPageLog(window);
1172
+ }
1173
+
1174
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
1175
+ function readPageLogReply(message) {
1176
+ try {
1177
+ return {
1178
+ val: client.VAL_CANVAS_MESSAGE,
1179
+ type: "pageLogRead",
1180
+ requestId: message.requestId,
1181
+ log: pageLog().read(_typeof._objectSpread2(_typeof._objectSpread2({}, message.sinceNavigation !== undefined ? {
1182
+ sinceNavigation: message.sinceNavigation
1183
+ } : {}), message.levels !== undefined ? {
1184
+ levels: message.levels
1185
+ } : {}))
1186
+ };
1187
+ } catch (error) {
1188
+ return {
1189
+ val: client.VAL_CANVAS_MESSAGE,
1190
+ type: "pageLogRead",
1191
+ requestId: message.requestId,
1192
+ log: null,
1193
+ error: error instanceof Error ? error.message : String(error)
1194
+ };
1195
+ }
1196
+ }
1197
+
1198
+ /** What `readPage` answers: the page read, or why it could not be. */
1140
1199
  function readPageReply(message) {
1141
1200
  try {
1142
1201
  return {
1143
1202
  val: client.VAL_CANVAS_MESSAGE,
1144
1203
  type: "pageRead",
1145
1204
  requestId: message.requestId,
1146
- snapshot: client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
1205
+ snapshot: _typeof._objectSpread2(_typeof._objectSpread2({}, client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
1147
1206
  selector: message.selector
1148
1207
  } : {}), message.maxItems !== undefined ? {
1149
1208
  maxItems: message.maxItems
1150
- } : {}))
1209
+ } : {}))), {}, {
1210
+ // So the assistant notices the page threw without asking.
1211
+ log: pageLog().counts()
1212
+ })
1151
1213
  };
1152
1214
  } catch (error) {
1153
1215
  return {
@@ -1316,6 +1378,19 @@ function PlatformAnalytics(_ref) {
1316
1378
  });
1317
1379
  }
1318
1380
 
1381
+ client.installPageLogInCanvasFrame(function () {
1382
+ return hasValEnableCookie(document.cookie);
1383
+ });
1384
+
1385
+ /**
1386
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
1387
+ */
1388
+ /**
1389
+ * How often `/draft/stat` is asked when nothing is in progress.
1390
+ *
1391
+ * Draft mode changes when someone toggles it, which the handshake below already
1392
+ * covers — so this is only there to notice it being changed somewhere else.
1393
+ */
1319
1394
  var DRAFT_IDLE_POLL_MS = 20000;
1320
1395
 
1321
1396
  /**
@@ -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-cc68a2d8.cjs.prod.js');
9
+ var version = require('./version-c72b9e12.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');
@@ -425,7 +425,7 @@ function ValCanvasBridge(_ref) {
425
425
 
426
426
  // Announce the frame, and say whether it is actually showing draft content.
427
427
  React__default["default"].useEffect(function () {
428
- post(_typeof._objectSpread2(_typeof._objectSpread2({
428
+ post(_typeof._objectSpread2(_typeof._objectSpread2(_typeof._objectSpread2({
429
429
  val: client.VAL_CANVAS_MESSAGE,
430
430
  type: "ready",
431
431
  draftMode: draftMode,
@@ -434,7 +434,15 @@ function ValCanvasBridge(_ref) {
434
434
  holds: _toConsumableArray(holds)
435
435
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
436
436
  holdsVersions: holdsVersions
437
- } : {}));
437
+ } : {}), {}, {
438
+ // What this bridge answers, so the Studio never waits on a request
439
+ // it would not: see `capabilities` in the protocol.
440
+ capabilities: _toConsumableArray(client.BRIDGE_CAPABILITIES),
441
+ bridge: {
442
+ "package": "@valbuild/tanstack",
443
+ version: version.VERSION
444
+ }
445
+ }));
438
446
  }, [post, draftMode, holds, holdsVersions]);
439
447
 
440
448
  /**
@@ -579,15 +587,25 @@ function ValCanvasBridge(_ref) {
579
587
  window.parent.postMessage(readPageReply(message), asker);
580
588
  return;
581
589
  }
590
+ if (message.type === "readPageLog") {
591
+ // The assistant's `read_page_log`: what the page logged as going
592
+ // wrong. As `readPage`: only for the frame's parent, when that is
593
+ // the Studio here, and answered to it alone.
594
+ if (event.source !== window.parent) return;
595
+ var _asker = event.origin;
596
+ if (_asker !== window.location.origin) return;
597
+ window.parent.postMessage(readPageLogReply(message), _asker);
598
+ return;
599
+ }
582
600
  if (message.type === "screenshotPage") {
583
601
  // The assistant's `screenshot_page`: a picture of the page, drawn
584
602
  // here. As `readPage`: only for the frame's parent, when that is the
585
603
  // Studio here, and answered to it alone.
586
604
  if (event.source !== window.parent) return;
587
- var _asker = event.origin;
588
- if (_asker !== window.location.origin) return;
605
+ var _asker2 = event.origin;
606
+ if (_asker2 !== window.location.origin) return;
589
607
  void screenshotReply(message).then(function (reply) {
590
- return window.parent.postMessage(reply, _asker);
608
+ return window.parent.postMessage(reply, _asker2);
591
609
  });
592
610
  return;
593
611
  }
@@ -726,10 +744,17 @@ function ValCanvasBridge(_ref) {
726
744
  };
727
745
  }, [codeChanged, post]);
728
746
 
729
- // Where the page is, as it moves: a new build is opened there.
747
+ // The page's log, if the provider's module did not start it already.
748
+ React__default["default"].useEffect(function () {
749
+ pageLog();
750
+ }, []);
751
+
752
+ // Where the page is, as it moves: a new build is opened there. The log
753
+ // hears of it too, so a client-side navigation starts a new page in it.
730
754
  React__default["default"].useEffect(function () {
731
755
  return client.watchPageLocation(window, function (location) {
732
- return post(_typeof._objectSpread2({
756
+ pageLog().noteLocation();
757
+ post(_typeof._objectSpread2({
733
758
  val: client.VAL_CANVAS_MESSAGE,
734
759
  type: "location"
735
760
  }, location));
@@ -1095,7 +1120,12 @@ function findByPath(path) {
1095
1120
  function screenshotReply(_x) {
1096
1121
  return _screenshotReply.apply(this, arguments);
1097
1122
  }
1098
- /** What `readPage` answers: the page read, or why it could not be. */
1123
+ /**
1124
+ * The page's log (`pageLog.ts`). Started when the provider's module was
1125
+ * evaluated in the canvas, before hydration; started here, as late as the
1126
+ * bridge mounts, only if that did not happen -- a document that was not the
1127
+ * canvas when the provider loaded (see `isValCanvasFrame`).
1128
+ */
1099
1129
  function _screenshotReply() {
1100
1130
  _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
1101
1131
  var _t2, _t3, _t4, _t5;
@@ -1137,17 +1167,49 @@ function _screenshotReply() {
1137
1167
  }));
1138
1168
  return _screenshotReply.apply(this, arguments);
1139
1169
  }
1170
+ function pageLog() {
1171
+ return client.installPageLog(window);
1172
+ }
1173
+
1174
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
1175
+ function readPageLogReply(message) {
1176
+ try {
1177
+ return {
1178
+ val: client.VAL_CANVAS_MESSAGE,
1179
+ type: "pageLogRead",
1180
+ requestId: message.requestId,
1181
+ log: pageLog().read(_typeof._objectSpread2(_typeof._objectSpread2({}, message.sinceNavigation !== undefined ? {
1182
+ sinceNavigation: message.sinceNavigation
1183
+ } : {}), message.levels !== undefined ? {
1184
+ levels: message.levels
1185
+ } : {}))
1186
+ };
1187
+ } catch (error) {
1188
+ return {
1189
+ val: client.VAL_CANVAS_MESSAGE,
1190
+ type: "pageLogRead",
1191
+ requestId: message.requestId,
1192
+ log: null,
1193
+ error: error instanceof Error ? error.message : String(error)
1194
+ };
1195
+ }
1196
+ }
1197
+
1198
+ /** What `readPage` answers: the page read, or why it could not be. */
1140
1199
  function readPageReply(message) {
1141
1200
  try {
1142
1201
  return {
1143
1202
  val: client.VAL_CANVAS_MESSAGE,
1144
1203
  type: "pageRead",
1145
1204
  requestId: message.requestId,
1146
- snapshot: client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
1205
+ snapshot: _typeof._objectSpread2(_typeof._objectSpread2({}, client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
1147
1206
  selector: message.selector
1148
1207
  } : {}), message.maxItems !== undefined ? {
1149
1208
  maxItems: message.maxItems
1150
- } : {}))
1209
+ } : {}))), {}, {
1210
+ // So the assistant notices the page threw without asking.
1211
+ log: pageLog().counts()
1212
+ })
1151
1213
  };
1152
1214
  } catch (error) {
1153
1215
  return {
@@ -1316,6 +1378,19 @@ function PlatformAnalytics(_ref) {
1316
1378
  });
1317
1379
  }
1318
1380
 
1381
+ client.installPageLogInCanvasFrame(function () {
1382
+ return hasValEnableCookie(document.cookie);
1383
+ });
1384
+
1385
+ /**
1386
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
1387
+ */
1388
+ /**
1389
+ * How often `/draft/stat` is asked when nothing is in progress.
1390
+ *
1391
+ * Draft mode changes when someone toggles it, which the handshake below already
1392
+ * covers — so this is only there to notice it being changed somewhere else.
1393
+ */
1319
1394
  var DRAFT_IDLE_POLL_MS = 20000;
1320
1395
 
1321
1396
  /**
@@ -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-05a3822d.esm.js';
8
+ import { r as readValEnableCookie, V as VERSION$1 } from './version-83ae9dc3.esm.js';
9
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
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';
15
+ import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, installPageLog, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, BRIDGE_CAPABILITIES, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, isCodeChangedDetail, screenshotPage, readPageSnapshot, installPageLogInCanvasFrame, 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
 
@@ -402,7 +402,7 @@ function ValCanvasBridge(_ref) {
402
402
 
403
403
  // Announce the frame, and say whether it is actually showing draft content.
404
404
  React.useEffect(function () {
405
- post(_objectSpread2(_objectSpread2({
405
+ post(_objectSpread2(_objectSpread2(_objectSpread2({
406
406
  val: VAL_CANVAS_MESSAGE,
407
407
  type: "ready",
408
408
  draftMode: draftMode,
@@ -411,7 +411,15 @@ function ValCanvasBridge(_ref) {
411
411
  holds: _toConsumableArray(holds)
412
412
  } : {}), holdsVersions !== undefined && Object.keys(holdsVersions).length > 0 ? {
413
413
  holdsVersions: holdsVersions
414
- } : {}));
414
+ } : {}), {}, {
415
+ // What this bridge answers, so the Studio never waits on a request
416
+ // it would not: see `capabilities` in the protocol.
417
+ capabilities: _toConsumableArray(BRIDGE_CAPABILITIES),
418
+ bridge: {
419
+ "package": "@valbuild/tanstack",
420
+ version: VERSION$1
421
+ }
422
+ }));
415
423
  }, [post, draftMode, holds, holdsVersions]);
416
424
 
417
425
  /**
@@ -556,15 +564,25 @@ function ValCanvasBridge(_ref) {
556
564
  window.parent.postMessage(readPageReply(message), asker);
557
565
  return;
558
566
  }
567
+ if (message.type === "readPageLog") {
568
+ // The assistant's `read_page_log`: what the page logged as going
569
+ // wrong. As `readPage`: only for the frame's parent, when that is
570
+ // the Studio here, and answered to it alone.
571
+ if (event.source !== window.parent) return;
572
+ var _asker = event.origin;
573
+ if (_asker !== window.location.origin) return;
574
+ window.parent.postMessage(readPageLogReply(message), _asker);
575
+ return;
576
+ }
559
577
  if (message.type === "screenshotPage") {
560
578
  // The assistant's `screenshot_page`: a picture of the page, drawn
561
579
  // here. As `readPage`: only for the frame's parent, when that is the
562
580
  // Studio here, and answered to it alone.
563
581
  if (event.source !== window.parent) return;
564
- var _asker = event.origin;
565
- if (_asker !== window.location.origin) return;
582
+ var _asker2 = event.origin;
583
+ if (_asker2 !== window.location.origin) return;
566
584
  void screenshotReply(message).then(function (reply) {
567
- return window.parent.postMessage(reply, _asker);
585
+ return window.parent.postMessage(reply, _asker2);
568
586
  });
569
587
  return;
570
588
  }
@@ -703,10 +721,17 @@ function ValCanvasBridge(_ref) {
703
721
  };
704
722
  }, [codeChanged, post]);
705
723
 
706
- // Where the page is, as it moves: a new build is opened there.
724
+ // The page's log, if the provider's module did not start it already.
725
+ React.useEffect(function () {
726
+ pageLog();
727
+ }, []);
728
+
729
+ // Where the page is, as it moves: a new build is opened there. The log
730
+ // hears of it too, so a client-side navigation starts a new page in it.
707
731
  React.useEffect(function () {
708
732
  return watchPageLocation(window, function (location) {
709
- return post(_objectSpread2({
733
+ pageLog().noteLocation();
734
+ post(_objectSpread2({
710
735
  val: VAL_CANVAS_MESSAGE,
711
736
  type: "location"
712
737
  }, location));
@@ -1072,7 +1097,12 @@ function findByPath(path) {
1072
1097
  function screenshotReply(_x) {
1073
1098
  return _screenshotReply.apply(this, arguments);
1074
1099
  }
1075
- /** What `readPage` answers: the page read, or why it could not be. */
1100
+ /**
1101
+ * The page's log (`pageLog.ts`). Started when the provider's module was
1102
+ * evaluated in the canvas, before hydration; started here, as late as the
1103
+ * bridge mounts, only if that did not happen -- a document that was not the
1104
+ * canvas when the provider loaded (see `isValCanvasFrame`).
1105
+ */
1076
1106
  function _screenshotReply() {
1077
1107
  _screenshotReply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(message) {
1078
1108
  var _t2, _t3, _t4, _t5;
@@ -1114,17 +1144,49 @@ function _screenshotReply() {
1114
1144
  }));
1115
1145
  return _screenshotReply.apply(this, arguments);
1116
1146
  }
1147
+ function pageLog() {
1148
+ return installPageLog(window);
1149
+ }
1150
+
1151
+ /** What `readPageLog` answers: the page's log, or why it could not be read. */
1152
+ function readPageLogReply(message) {
1153
+ try {
1154
+ return {
1155
+ val: VAL_CANVAS_MESSAGE,
1156
+ type: "pageLogRead",
1157
+ requestId: message.requestId,
1158
+ log: pageLog().read(_objectSpread2(_objectSpread2({}, message.sinceNavigation !== undefined ? {
1159
+ sinceNavigation: message.sinceNavigation
1160
+ } : {}), message.levels !== undefined ? {
1161
+ levels: message.levels
1162
+ } : {}))
1163
+ };
1164
+ } catch (error) {
1165
+ return {
1166
+ val: VAL_CANVAS_MESSAGE,
1167
+ type: "pageLogRead",
1168
+ requestId: message.requestId,
1169
+ log: null,
1170
+ error: error instanceof Error ? error.message : String(error)
1171
+ };
1172
+ }
1173
+ }
1174
+
1175
+ /** What `readPage` answers: the page read, or why it could not be. */
1117
1176
  function readPageReply(message) {
1118
1177
  try {
1119
1178
  return {
1120
1179
  val: VAL_CANVAS_MESSAGE,
1121
1180
  type: "pageRead",
1122
1181
  requestId: message.requestId,
1123
- snapshot: readPageSnapshot(document, _objectSpread2(_objectSpread2({}, message.selector !== undefined ? {
1182
+ snapshot: _objectSpread2(_objectSpread2({}, readPageSnapshot(document, _objectSpread2(_objectSpread2({}, message.selector !== undefined ? {
1124
1183
  selector: message.selector
1125
1184
  } : {}), message.maxItems !== undefined ? {
1126
1185
  maxItems: message.maxItems
1127
- } : {}))
1186
+ } : {}))), {}, {
1187
+ // So the assistant notices the page threw without asking.
1188
+ log: pageLog().counts()
1189
+ })
1128
1190
  };
1129
1191
  } catch (error) {
1130
1192
  return {
@@ -1293,6 +1355,19 @@ function PlatformAnalytics(_ref) {
1293
1355
  });
1294
1356
  }
1295
1357
 
1358
+ installPageLogInCanvasFrame(function () {
1359
+ return hasValEnableCookie(document.cookie);
1360
+ });
1361
+
1362
+ /**
1363
+ * Shows the Overlay menu and updates the store which the client side useVal hook uses to display data.
1364
+ */
1365
+ /**
1366
+ * How often `/draft/stat` is asked when nothing is in progress.
1367
+ *
1368
+ * Draft mode changes when someone toggles it, which the handshake below already
1369
+ * covers — so this is only there to notice it being changed somewhere else.
1370
+ */
1296
1371
  var DRAFT_IDLE_POLL_MS = 20000;
1297
1372
 
1298
1373
  /**
@@ -76,7 +76,7 @@ var packageJson = {
76
76
  "tanstack-router",
77
77
  "react"
78
78
  ],
79
- version: "0.153.5",
79
+ version: "0.153.6",
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.153.5",
81
+ version: "0.153.6",
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.153.5",
81
+ version: "0.153.6",
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.153.5",
17
+ "version": "0.153.6",
18
18
  "main": "dist/valbuild-tanstack.cjs.js",
19
19
  "module": "dist/valbuild-tanstack.esm.js",
20
20
  "exports": {
@@ -53,12 +53,12 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@valbuild/core": "0.153.5",
56
- "@valbuild/language-server": "0.153.5",
57
- "@valbuild/mcp": "0.153.5",
58
- "@valbuild/react": "0.153.5",
59
- "@valbuild/server": "0.153.5",
60
- "@valbuild/shared": "0.153.5",
61
- "@valbuild/ui": "0.153.5"
56
+ "@valbuild/language-server": "0.153.6",
57
+ "@valbuild/mcp": "0.153.6",
58
+ "@valbuild/react": "0.153.6",
59
+ "@valbuild/server": "0.153.6",
60
+ "@valbuild/shared": "0.153.6",
61
+ "@valbuild/ui": "0.153.6"
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-fb089780.cjs.dev.js');
5
+ var version = require('../../dist/version-bee0c459.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');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-cc68a2d8.cjs.prod.js');
5
+ var version = require('../../dist/version-c72b9e12.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');
@@ -1,4 +1,4 @@
1
- import { V as VERSION, s as setValEnableCookieReader } from '../../dist/version-05a3822d.esm.js';
1
+ import { V as VERSION, s as setValEnableCookieReader } from '../../dist/version-83ae9dc3.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';