@valbuild/next 0.151.0 → 0.152.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @valbuild/next
2
2
 
3
+ ## 0.152.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1019](https://github.com/valbuild/val/pull/1019) [`b9089c8`](https://github.com/valbuild/val/commit/b9089c8787da8075722cc4ef3672beb61b288af4) Thanks [@freekh](https://github.com/freekh)! - **What the design tab needed is removed with it.** The page's canvas bridge
8
+ now answers `read_page`, `screenshot_page` and a quick preview only to the
9
+ Studio at the page's own origin, and no longer asks the server whether another
10
+ origin is the site's design tab. The site's server no longer writes a
11
+ proposal's files or offers the `patch-file` route: code and content are
12
+ changed in the proposal's own Studio. The assistant's `build_proposal` no
13
+ longer takes a `reason`.
14
+ - Updated dependencies [[`b9089c8`](https://github.com/valbuild/val/commit/b9089c8787da8075722cc4ef3672beb61b288af4), [`b9089c8`](https://github.com/valbuild/val/commit/b9089c8787da8075722cc4ef3672beb61b288af4), [`b9089c8`](https://github.com/valbuild/val/commit/b9089c8787da8075722cc4ef3672beb61b288af4), [`b9089c8`](https://github.com/valbuild/val/commit/b9089c8787da8075722cc4ef3672beb61b288af4)]:
15
+ - @valbuild/ui@0.152.1
16
+ - @valbuild/server@0.152.1
17
+ - @valbuild/shared@0.152.1
18
+ - @valbuild/react@0.152.1
19
+ - @valbuild/language-server@0.152.1
20
+ - @valbuild/mcp@0.152.1
21
+
22
+ ## 0.152.0
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`f4e0660`](https://github.com/valbuild/val/commit/f4e06601495dbee680a4b9000344f84cd3af717f), [`3bb76d7`](https://github.com/valbuild/val/commit/3bb76d74d82b499aa15023838d63018a70fd7ce7), [`08a3977`](https://github.com/valbuild/val/commit/08a39779dbe43702a72ae57cbf8cf29b14e64672)]:
27
+ - @valbuild/ui@0.152.0
28
+ - @valbuild/server@0.152.0
29
+ - @valbuild/shared@0.152.0
30
+ - @valbuild/mcp@0.152.0
31
+ - @valbuild/react@0.152.0
32
+ - @valbuild/language-server@0.152.0
33
+
3
34
  ## 0.151.0
4
35
 
5
36
  ### Minor Changes
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValCanvasBridge-4166883a.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValCanvasBridge-4166883a.cjs.dev.js");
7
+ }
@@ -89,8 +89,8 @@ function ValCanvasBridge(_ref) {
89
89
  var pickingRef = React__default["default"].useRef(false);
90
90
  pickingRef.current = picking;
91
91
  /**
92
- * Picking ANY element (the design tab's `pickElements`), as the studio last
93
- * said. `null` until it says, which is every studio but the design tab.
92
+ * Picking ANY element (`pickElements`), as the studio last said. `null`
93
+ * until it says.
94
94
  */
95
95
  var _React$useState7 = React__default["default"].useState(null),
96
96
  _React$useState8 = slicedToArray._slicedToArray(_React$useState7, 2),
@@ -338,114 +338,80 @@ function ValCanvasBridge(_ref) {
338
338
  }
339
339
  if (message.type === "scrollTo") {
340
340
  var _stopRestoring$curren2;
341
- // Where the build before this one was: the design tab swaps a new
342
- // build in at the same place.
341
+ // Where the build before this one was: a new build swapped in at the
342
+ // same place.
343
343
  (_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
344
344
  stopRestoring.current = client.restoreScroll(window, message.x, message.y);
345
345
  return;
346
346
  }
347
347
  if (message.type === "readPage") {
348
- // The assistant's `read_page`: what is on the page, read here because
349
- // the tab is another origin and cannot. The page's words, unpublished
350
- // ones included, so only for the frame's parent, and only when that
351
- // is the site's design tab or the Studio here -- and answered to it
352
- // alone, not to `*`.
348
+ // The assistant's `read_page`: what is on the page, read here, where
349
+ // the page's elements are. The page's words, unpublished ones
350
+ // included, so only for the frame's parent, and only when that is the
351
+ // Studio here, at this page's own origin -- and answered to it alone,
352
+ // not to `*`.
353
353
  if (event.source !== window.parent) return;
354
354
  var asker = event.origin;
355
- void client.isDesignTabOrigin(asker, {
356
- api: "/api/val",
357
- own: window.location.origin
358
- }).then(function (trusted) {
359
- if (trusted) window.parent.postMessage(readPageReply(message), asker);
360
- });
355
+ if (asker !== window.location.origin) return;
356
+ window.parent.postMessage(readPageReply(message), asker);
361
357
  return;
362
358
  }
363
359
  if (message.type === "screenshotPage") {
364
360
  // The assistant's `screenshot_page`: a picture of the page, drawn
365
- // here because the tab is another origin and cannot. As `readPage`:
366
- // only for the frame's parent, when that is the design tab or the
361
+ // here. As `readPage`: only for the frame's parent, when that is the
367
362
  // Studio here, and answered to it alone.
368
363
  if (event.source !== window.parent) return;
369
364
  var _asker = event.origin;
370
- void client.isDesignTabOrigin(_asker, {
371
- api: "/api/val",
372
- own: window.location.origin
373
- }).then(/*#__PURE__*/function () {
374
- var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(trusted) {
375
- var _t;
376
- return asyncToGenerator._regenerator().w(function (_context) {
377
- while (1) switch (_context.n) {
378
- case 0:
379
- if (trusted) {
380
- _context.n = 1;
381
- break;
382
- }
383
- return _context.a(2);
384
- case 1:
385
- _t = window.parent;
386
- _context.n = 2;
387
- return screenshotReply(message);
388
- case 2:
389
- _t.postMessage.call(_t, _context.v, _asker);
390
- case 3:
391
- return _context.a(2);
392
- }
393
- }, _callee);
394
- }));
395
- return function (_x) {
396
- return _ref2.apply(this, arguments);
397
- };
398
- }());
365
+ if (_asker !== window.location.origin) return;
366
+ void screenshotReply(message).then(function (reply) {
367
+ return window.parent.postMessage(reply, _asker);
368
+ });
399
369
  return;
400
370
  }
401
371
  if (message.type === "quickPreview") {
402
372
  // Code that will run on this address: only from the frame's parent,
403
- // and only when that is the site's design tab. See `quickPreview.ts`.
373
+ // and only when that is the Studio here. See `quickPreview.ts`.
404
374
  if (event.source !== window.parent) return;
405
375
  var id = message.id,
406
376
  files = message.files;
407
377
  var origin = event.origin;
408
- void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
409
- var site, _t2;
410
- return asyncToGenerator._regenerator().w(function (_context2) {
411
- while (1) switch (_context2.p = _context2.n) {
378
+ void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
379
+ var _t;
380
+ return asyncToGenerator._regenerator().w(function (_context) {
381
+ while (1) switch (_context.p = _context.n) {
412
382
  case 0:
413
- _context2.p = 0;
414
- _context2.n = 1;
415
- return client.quickPreviewSiteOrigin("/api/val");
416
- case 1:
417
- site = _context2.v;
418
- if (!(site === null || site !== origin)) {
419
- _context2.n = 2;
383
+ _context.p = 0;
384
+ if (!(origin !== window.location.origin)) {
385
+ _context.n = 1;
420
386
  break;
421
387
  }
422
- throw new Error("Only the site's design tab can show a quick preview of this proposal.");
423
- case 2:
424
- _context2.n = 3;
388
+ throw new Error("Only this proposal's own Studio can show a quick preview of it.");
389
+ case 1:
390
+ _context.n = 2;
425
391
  return client.storeQuickPreview(id, files, {
426
392
  swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
427
393
  });
428
- case 3:
394
+ case 2:
429
395
  post({
430
396
  val: client.VAL_CANVAS_MESSAGE,
431
397
  type: "quickPreviewStored",
432
398
  id: id
433
399
  });
434
- _context2.n = 5;
400
+ _context.n = 4;
435
401
  break;
436
- case 4:
437
- _context2.p = 4;
438
- _t2 = _context2.v;
402
+ case 3:
403
+ _context.p = 3;
404
+ _t = _context.v;
439
405
  post({
440
406
  val: client.VAL_CANVAS_MESSAGE,
441
407
  type: "quickPreviewStored",
442
408
  id: id,
443
- error: _t2 instanceof Error ? _t2.message : String(_t2)
409
+ error: _t instanceof Error ? _t.message : String(_t)
444
410
  });
445
- case 5:
446
- return _context2.a(2);
411
+ case 4:
412
+ return _context.a(2);
447
413
  }
448
- }, _callee2, null, [[0, 4]]);
414
+ }, _callee, null, [[0, 3]]);
449
415
  }))();
450
416
  return;
451
417
  }
@@ -511,7 +477,7 @@ function ValCanvasBridge(_ref) {
511
477
  };
512
478
  }, [scan, post]);
513
479
 
514
- // Where the page is, as it moves: the design tab opens a new build there.
480
+ // Where the page is, as it moves: a new build is opened there.
515
481
  React__default["default"].useEffect(function () {
516
482
  return client.watchPageLocation(window, function (location) {
517
483
  return post(objectSpread2._objectSpread2({
@@ -556,7 +522,7 @@ function ValCanvasBridge(_ref) {
556
522
  }, [post]);
557
523
 
558
524
  /**
559
- * Picking any element, for the design tab: the page's own elements, which
525
+ * Picking any element: the page's own elements, which
560
526
  * only this side of the frame can reach. The listeners and the outlines are
561
527
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
562
528
  * same picker; what crosses back is the element described.
@@ -856,20 +822,20 @@ function findByPath(path) {
856
822
  }
857
823
 
858
824
  /** What `screenshotPage` answers: the picture, or why it could not be taken. */
859
- function screenshotReply(_x2) {
825
+ function screenshotReply(_x) {
860
826
  return _screenshotReply.apply(this, arguments);
861
827
  }
862
828
  /** What `readPage` answers: the page read, or why it could not be. */
863
829
  function _screenshotReply() {
864
- _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(message) {
865
- var _t3, _t4, _t5, _t6;
866
- return asyncToGenerator._regenerator().w(function (_context3) {
867
- while (1) switch (_context3.p = _context3.n) {
830
+ _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
831
+ var _t2, _t3, _t4, _t5;
832
+ return asyncToGenerator._regenerator().w(function (_context2) {
833
+ while (1) switch (_context2.p = _context2.n) {
868
834
  case 0:
869
- _context3.p = 0;
870
- _t3 = client.VAL_CANVAS_MESSAGE;
871
- _t4 = message.requestId;
872
- _context3.n = 1;
835
+ _context2.p = 0;
836
+ _t2 = client.VAL_CANVAS_MESSAGE;
837
+ _t3 = message.requestId;
838
+ _context2.n = 1;
873
839
  return client.screenshotPage(window, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.fullPage !== undefined ? {
874
840
  fullPage: message.fullPage
875
841
  } : {}), {}, {
@@ -879,25 +845,25 @@ function _screenshotReply() {
879
845
  }
880
846
  }));
881
847
  case 1:
882
- _t5 = _context3.v;
883
- return _context3.a(2, {
884
- val: _t3,
848
+ _t4 = _context2.v;
849
+ return _context2.a(2, {
850
+ val: _t2,
885
851
  type: "pageScreenshot",
886
- requestId: _t4,
887
- screenshot: _t5
852
+ requestId: _t3,
853
+ screenshot: _t4
888
854
  });
889
855
  case 2:
890
- _context3.p = 2;
891
- _t6 = _context3.v;
892
- return _context3.a(2, {
856
+ _context2.p = 2;
857
+ _t5 = _context2.v;
858
+ return _context2.a(2, {
893
859
  val: client.VAL_CANVAS_MESSAGE,
894
860
  type: "pageScreenshot",
895
861
  requestId: message.requestId,
896
862
  screenshot: null,
897
- error: _t6 instanceof Error ? _t6.message : String(_t6)
863
+ error: _t5 instanceof Error ? _t5.message : String(_t5)
898
864
  });
899
865
  }
900
- }, _callee3, null, [[0, 2]]);
866
+ }, _callee2, null, [[0, 2]]);
901
867
  }));
902
868
  return _screenshotReply.apply(this, arguments);
903
869
  }
@@ -89,8 +89,8 @@ function ValCanvasBridge(_ref) {
89
89
  var pickingRef = React__default["default"].useRef(false);
90
90
  pickingRef.current = picking;
91
91
  /**
92
- * Picking ANY element (the design tab's `pickElements`), as the studio last
93
- * said. `null` until it says, which is every studio but the design tab.
92
+ * Picking ANY element (`pickElements`), as the studio last said. `null`
93
+ * until it says.
94
94
  */
95
95
  var _React$useState7 = React__default["default"].useState(null),
96
96
  _React$useState8 = slicedToArray._slicedToArray(_React$useState7, 2),
@@ -338,114 +338,80 @@ function ValCanvasBridge(_ref) {
338
338
  }
339
339
  if (message.type === "scrollTo") {
340
340
  var _stopRestoring$curren2;
341
- // Where the build before this one was: the design tab swaps a new
342
- // build in at the same place.
341
+ // Where the build before this one was: a new build swapped in at the
342
+ // same place.
343
343
  (_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
344
344
  stopRestoring.current = client.restoreScroll(window, message.x, message.y);
345
345
  return;
346
346
  }
347
347
  if (message.type === "readPage") {
348
- // The assistant's `read_page`: what is on the page, read here because
349
- // the tab is another origin and cannot. The page's words, unpublished
350
- // ones included, so only for the frame's parent, and only when that
351
- // is the site's design tab or the Studio here -- and answered to it
352
- // alone, not to `*`.
348
+ // The assistant's `read_page`: what is on the page, read here, where
349
+ // the page's elements are. The page's words, unpublished ones
350
+ // included, so only for the frame's parent, and only when that is the
351
+ // Studio here, at this page's own origin -- and answered to it alone,
352
+ // not to `*`.
353
353
  if (event.source !== window.parent) return;
354
354
  var asker = event.origin;
355
- void client.isDesignTabOrigin(asker, {
356
- api: "/api/val",
357
- own: window.location.origin
358
- }).then(function (trusted) {
359
- if (trusted) window.parent.postMessage(readPageReply(message), asker);
360
- });
355
+ if (asker !== window.location.origin) return;
356
+ window.parent.postMessage(readPageReply(message), asker);
361
357
  return;
362
358
  }
363
359
  if (message.type === "screenshotPage") {
364
360
  // The assistant's `screenshot_page`: a picture of the page, drawn
365
- // here because the tab is another origin and cannot. As `readPage`:
366
- // only for the frame's parent, when that is the design tab or the
361
+ // here. As `readPage`: only for the frame's parent, when that is the
367
362
  // Studio here, and answered to it alone.
368
363
  if (event.source !== window.parent) return;
369
364
  var _asker = event.origin;
370
- void client.isDesignTabOrigin(_asker, {
371
- api: "/api/val",
372
- own: window.location.origin
373
- }).then(/*#__PURE__*/function () {
374
- var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(trusted) {
375
- var _t;
376
- return asyncToGenerator._regenerator().w(function (_context) {
377
- while (1) switch (_context.n) {
378
- case 0:
379
- if (trusted) {
380
- _context.n = 1;
381
- break;
382
- }
383
- return _context.a(2);
384
- case 1:
385
- _t = window.parent;
386
- _context.n = 2;
387
- return screenshotReply(message);
388
- case 2:
389
- _t.postMessage.call(_t, _context.v, _asker);
390
- case 3:
391
- return _context.a(2);
392
- }
393
- }, _callee);
394
- }));
395
- return function (_x) {
396
- return _ref2.apply(this, arguments);
397
- };
398
- }());
365
+ if (_asker !== window.location.origin) return;
366
+ void screenshotReply(message).then(function (reply) {
367
+ return window.parent.postMessage(reply, _asker);
368
+ });
399
369
  return;
400
370
  }
401
371
  if (message.type === "quickPreview") {
402
372
  // Code that will run on this address: only from the frame's parent,
403
- // and only when that is the site's design tab. See `quickPreview.ts`.
373
+ // and only when that is the Studio here. See `quickPreview.ts`.
404
374
  if (event.source !== window.parent) return;
405
375
  var id = message.id,
406
376
  files = message.files;
407
377
  var origin = event.origin;
408
- void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
409
- var site, _t2;
410
- return asyncToGenerator._regenerator().w(function (_context2) {
411
- while (1) switch (_context2.p = _context2.n) {
378
+ void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
379
+ var _t;
380
+ return asyncToGenerator._regenerator().w(function (_context) {
381
+ while (1) switch (_context.p = _context.n) {
412
382
  case 0:
413
- _context2.p = 0;
414
- _context2.n = 1;
415
- return client.quickPreviewSiteOrigin("/api/val");
416
- case 1:
417
- site = _context2.v;
418
- if (!(site === null || site !== origin)) {
419
- _context2.n = 2;
383
+ _context.p = 0;
384
+ if (!(origin !== window.location.origin)) {
385
+ _context.n = 1;
420
386
  break;
421
387
  }
422
- throw new Error("Only the site's design tab can show a quick preview of this proposal.");
423
- case 2:
424
- _context2.n = 3;
388
+ throw new Error("Only this proposal's own Studio can show a quick preview of it.");
389
+ case 1:
390
+ _context.n = 2;
425
391
  return client.storeQuickPreview(id, files, {
426
392
  swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
427
393
  });
428
- case 3:
394
+ case 2:
429
395
  post({
430
396
  val: client.VAL_CANVAS_MESSAGE,
431
397
  type: "quickPreviewStored",
432
398
  id: id
433
399
  });
434
- _context2.n = 5;
400
+ _context.n = 4;
435
401
  break;
436
- case 4:
437
- _context2.p = 4;
438
- _t2 = _context2.v;
402
+ case 3:
403
+ _context.p = 3;
404
+ _t = _context.v;
439
405
  post({
440
406
  val: client.VAL_CANVAS_MESSAGE,
441
407
  type: "quickPreviewStored",
442
408
  id: id,
443
- error: _t2 instanceof Error ? _t2.message : String(_t2)
409
+ error: _t instanceof Error ? _t.message : String(_t)
444
410
  });
445
- case 5:
446
- return _context2.a(2);
411
+ case 4:
412
+ return _context.a(2);
447
413
  }
448
- }, _callee2, null, [[0, 4]]);
414
+ }, _callee, null, [[0, 3]]);
449
415
  }))();
450
416
  return;
451
417
  }
@@ -511,7 +477,7 @@ function ValCanvasBridge(_ref) {
511
477
  };
512
478
  }, [scan, post]);
513
479
 
514
- // Where the page is, as it moves: the design tab opens a new build there.
480
+ // Where the page is, as it moves: a new build is opened there.
515
481
  React__default["default"].useEffect(function () {
516
482
  return client.watchPageLocation(window, function (location) {
517
483
  return post(objectSpread2._objectSpread2({
@@ -556,7 +522,7 @@ function ValCanvasBridge(_ref) {
556
522
  }, [post]);
557
523
 
558
524
  /**
559
- * Picking any element, for the design tab: the page's own elements, which
525
+ * Picking any element: the page's own elements, which
560
526
  * only this side of the frame can reach. The listeners and the outlines are
561
527
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
562
528
  * same picker; what crosses back is the element described.
@@ -856,20 +822,20 @@ function findByPath(path) {
856
822
  }
857
823
 
858
824
  /** What `screenshotPage` answers: the picture, or why it could not be taken. */
859
- function screenshotReply(_x2) {
825
+ function screenshotReply(_x) {
860
826
  return _screenshotReply.apply(this, arguments);
861
827
  }
862
828
  /** What `readPage` answers: the page read, or why it could not be. */
863
829
  function _screenshotReply() {
864
- _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(message) {
865
- var _t3, _t4, _t5, _t6;
866
- return asyncToGenerator._regenerator().w(function (_context3) {
867
- while (1) switch (_context3.p = _context3.n) {
830
+ _screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(message) {
831
+ var _t2, _t3, _t4, _t5;
832
+ return asyncToGenerator._regenerator().w(function (_context2) {
833
+ while (1) switch (_context2.p = _context2.n) {
868
834
  case 0:
869
- _context3.p = 0;
870
- _t3 = client.VAL_CANVAS_MESSAGE;
871
- _t4 = message.requestId;
872
- _context3.n = 1;
835
+ _context2.p = 0;
836
+ _t2 = client.VAL_CANVAS_MESSAGE;
837
+ _t3 = message.requestId;
838
+ _context2.n = 1;
873
839
  return client.screenshotPage(window, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, message.fullPage !== undefined ? {
874
840
  fullPage: message.fullPage
875
841
  } : {}), {}, {
@@ -879,25 +845,25 @@ function _screenshotReply() {
879
845
  }
880
846
  }));
881
847
  case 1:
882
- _t5 = _context3.v;
883
- return _context3.a(2, {
884
- val: _t3,
848
+ _t4 = _context2.v;
849
+ return _context2.a(2, {
850
+ val: _t2,
885
851
  type: "pageScreenshot",
886
- requestId: _t4,
887
- screenshot: _t5
852
+ requestId: _t3,
853
+ screenshot: _t4
888
854
  });
889
855
  case 2:
890
- _context3.p = 2;
891
- _t6 = _context3.v;
892
- return _context3.a(2, {
856
+ _context2.p = 2;
857
+ _t5 = _context2.v;
858
+ return _context2.a(2, {
893
859
  val: client.VAL_CANVAS_MESSAGE,
894
860
  type: "pageScreenshot",
895
861
  requestId: message.requestId,
896
862
  screenshot: null,
897
- error: _t6 instanceof Error ? _t6.message : String(_t6)
863
+ error: _t5 instanceof Error ? _t5.message : String(_t5)
898
864
  });
899
865
  }
900
- }, _callee3, null, [[0, 2]]);
866
+ }, _callee2, null, [[0, 2]]);
901
867
  }));
902
868
  return _screenshotReply.apply(this, arguments);
903
869
  }
@@ -5,7 +5,7 @@ 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, isDesignTabOrigin, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, quickPreviewSiteOrigin, readPageSnapshot, screenshotPage } from '@valbuild/shared/client';
8
+ import { VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, screenshotPage, readPageSnapshot } from '@valbuild/shared/client';
9
9
  import { jsx } from 'react/jsx-runtime';
10
10
 
11
11
  function _arrayWithoutHoles(r) {
@@ -81,8 +81,8 @@ function ValCanvasBridge(_ref) {
81
81
  var pickingRef = React.useRef(false);
82
82
  pickingRef.current = picking;
83
83
  /**
84
- * Picking ANY element (the design tab's `pickElements`), as the studio last
85
- * said. `null` until it says, which is every studio but the design tab.
84
+ * Picking ANY element (`pickElements`), as the studio last said. `null`
85
+ * until it says.
86
86
  */
87
87
  var _React$useState7 = React.useState(null),
88
88
  _React$useState8 = _slicedToArray(_React$useState7, 2),
@@ -330,114 +330,80 @@ function ValCanvasBridge(_ref) {
330
330
  }
331
331
  if (message.type === "scrollTo") {
332
332
  var _stopRestoring$curren2;
333
- // Where the build before this one was: the design tab swaps a new
334
- // build in at the same place.
333
+ // Where the build before this one was: a new build swapped in at the
334
+ // same place.
335
335
  (_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
336
336
  stopRestoring.current = restoreScroll(window, message.x, message.y);
337
337
  return;
338
338
  }
339
339
  if (message.type === "readPage") {
340
- // The assistant's `read_page`: what is on the page, read here because
341
- // the tab is another origin and cannot. The page's words, unpublished
342
- // ones included, so only for the frame's parent, and only when that
343
- // is the site's design tab or the Studio here -- and answered to it
344
- // alone, not to `*`.
340
+ // The assistant's `read_page`: what is on the page, read here, where
341
+ // the page's elements are. The page's words, unpublished ones
342
+ // included, so only for the frame's parent, and only when that is the
343
+ // Studio here, at this page's own origin -- and answered to it alone,
344
+ // not to `*`.
345
345
  if (event.source !== window.parent) return;
346
346
  var asker = event.origin;
347
- void isDesignTabOrigin(asker, {
348
- api: "/api/val",
349
- own: window.location.origin
350
- }).then(function (trusted) {
351
- if (trusted) window.parent.postMessage(readPageReply(message), asker);
352
- });
347
+ if (asker !== window.location.origin) return;
348
+ window.parent.postMessage(readPageReply(message), asker);
353
349
  return;
354
350
  }
355
351
  if (message.type === "screenshotPage") {
356
352
  // The assistant's `screenshot_page`: a picture of the page, drawn
357
- // here because the tab is another origin and cannot. As `readPage`:
358
- // only for the frame's parent, when that is the design tab or the
353
+ // here. As `readPage`: only for the frame's parent, when that is the
359
354
  // Studio here, and answered to it alone.
360
355
  if (event.source !== window.parent) return;
361
356
  var _asker = event.origin;
362
- void isDesignTabOrigin(_asker, {
363
- api: "/api/val",
364
- own: window.location.origin
365
- }).then(/*#__PURE__*/function () {
366
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(trusted) {
367
- var _t;
368
- return _regenerator().w(function (_context) {
369
- while (1) switch (_context.n) {
370
- case 0:
371
- if (trusted) {
372
- _context.n = 1;
373
- break;
374
- }
375
- return _context.a(2);
376
- case 1:
377
- _t = window.parent;
378
- _context.n = 2;
379
- return screenshotReply(message);
380
- case 2:
381
- _t.postMessage.call(_t, _context.v, _asker);
382
- case 3:
383
- return _context.a(2);
384
- }
385
- }, _callee);
386
- }));
387
- return function (_x) {
388
- return _ref2.apply(this, arguments);
389
- };
390
- }());
357
+ if (_asker !== window.location.origin) return;
358
+ void screenshotReply(message).then(function (reply) {
359
+ return window.parent.postMessage(reply, _asker);
360
+ });
391
361
  return;
392
362
  }
393
363
  if (message.type === "quickPreview") {
394
364
  // Code that will run on this address: only from the frame's parent,
395
- // and only when that is the site's design tab. See `quickPreview.ts`.
365
+ // and only when that is the Studio here. See `quickPreview.ts`.
396
366
  if (event.source !== window.parent) return;
397
367
  var id = message.id,
398
368
  files = message.files;
399
369
  var origin = event.origin;
400
- void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
401
- var site, _t2;
402
- return _regenerator().w(function (_context2) {
403
- while (1) switch (_context2.p = _context2.n) {
370
+ void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
371
+ var _t;
372
+ return _regenerator().w(function (_context) {
373
+ while (1) switch (_context.p = _context.n) {
404
374
  case 0:
405
- _context2.p = 0;
406
- _context2.n = 1;
407
- return quickPreviewSiteOrigin("/api/val");
408
- case 1:
409
- site = _context2.v;
410
- if (!(site === null || site !== origin)) {
411
- _context2.n = 2;
375
+ _context.p = 0;
376
+ if (!(origin !== window.location.origin)) {
377
+ _context.n = 1;
412
378
  break;
413
379
  }
414
- throw new Error("Only the site's design tab can show a quick preview of this proposal.");
415
- case 2:
416
- _context2.n = 3;
380
+ throw new Error("Only this proposal's own Studio can show a quick preview of it.");
381
+ case 1:
382
+ _context.n = 2;
417
383
  return storeQuickPreview(id, files, {
418
384
  swUrl: "/api/val".concat(QUICK_PREVIEW_SERVICE_WORKER_PATH)
419
385
  });
420
- case 3:
386
+ case 2:
421
387
  post({
422
388
  val: VAL_CANVAS_MESSAGE,
423
389
  type: "quickPreviewStored",
424
390
  id: id
425
391
  });
426
- _context2.n = 5;
392
+ _context.n = 4;
427
393
  break;
428
- case 4:
429
- _context2.p = 4;
430
- _t2 = _context2.v;
394
+ case 3:
395
+ _context.p = 3;
396
+ _t = _context.v;
431
397
  post({
432
398
  val: VAL_CANVAS_MESSAGE,
433
399
  type: "quickPreviewStored",
434
400
  id: id,
435
- error: _t2 instanceof Error ? _t2.message : String(_t2)
401
+ error: _t instanceof Error ? _t.message : String(_t)
436
402
  });
437
- case 5:
438
- return _context2.a(2);
403
+ case 4:
404
+ return _context.a(2);
439
405
  }
440
- }, _callee2, null, [[0, 4]]);
406
+ }, _callee, null, [[0, 3]]);
441
407
  }))();
442
408
  return;
443
409
  }
@@ -503,7 +469,7 @@ function ValCanvasBridge(_ref) {
503
469
  };
504
470
  }, [scan, post]);
505
471
 
506
- // Where the page is, as it moves: the design tab opens a new build there.
472
+ // Where the page is, as it moves: a new build is opened there.
507
473
  React.useEffect(function () {
508
474
  return watchPageLocation(window, function (location) {
509
475
  return post(_objectSpread2({
@@ -548,7 +514,7 @@ function ValCanvasBridge(_ref) {
548
514
  }, [post]);
549
515
 
550
516
  /**
551
- * Picking any element, for the design tab: the page's own elements, which
517
+ * Picking any element: the page's own elements, which
552
518
  * only this side of the frame can reach. The listeners and the outlines are
553
519
  * `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
554
520
  * same picker; what crosses back is the element described.
@@ -848,20 +814,20 @@ function findByPath(path) {
848
814
  }
849
815
 
850
816
  /** What `screenshotPage` answers: the picture, or why it could not be taken. */
851
- function screenshotReply(_x2) {
817
+ function screenshotReply(_x) {
852
818
  return _screenshotReply.apply(this, arguments);
853
819
  }
854
820
  /** What `readPage` answers: the page read, or why it could not be. */
855
821
  function _screenshotReply() {
856
- _screenshotReply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(message) {
857
- var _t3, _t4, _t5, _t6;
858
- return _regenerator().w(function (_context3) {
859
- while (1) switch (_context3.p = _context3.n) {
822
+ _screenshotReply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(message) {
823
+ var _t2, _t3, _t4, _t5;
824
+ return _regenerator().w(function (_context2) {
825
+ while (1) switch (_context2.p = _context2.n) {
860
826
  case 0:
861
- _context3.p = 0;
862
- _t3 = VAL_CANVAS_MESSAGE;
863
- _t4 = message.requestId;
864
- _context3.n = 1;
827
+ _context2.p = 0;
828
+ _t2 = VAL_CANVAS_MESSAGE;
829
+ _t3 = message.requestId;
830
+ _context2.n = 1;
865
831
  return screenshotPage(window, _objectSpread2(_objectSpread2({}, message.fullPage !== undefined ? {
866
832
  fullPage: message.fullPage
867
833
  } : {}), {}, {
@@ -871,25 +837,25 @@ function _screenshotReply() {
871
837
  }
872
838
  }));
873
839
  case 1:
874
- _t5 = _context3.v;
875
- return _context3.a(2, {
876
- val: _t3,
840
+ _t4 = _context2.v;
841
+ return _context2.a(2, {
842
+ val: _t2,
877
843
  type: "pageScreenshot",
878
- requestId: _t4,
879
- screenshot: _t5
844
+ requestId: _t3,
845
+ screenshot: _t4
880
846
  });
881
847
  case 2:
882
- _context3.p = 2;
883
- _t6 = _context3.v;
884
- return _context3.a(2, {
848
+ _context2.p = 2;
849
+ _t5 = _context2.v;
850
+ return _context2.a(2, {
885
851
  val: VAL_CANVAS_MESSAGE,
886
852
  type: "pageScreenshot",
887
853
  requestId: message.requestId,
888
854
  screenshot: null,
889
- error: _t6 instanceof Error ? _t6.message : String(_t6)
855
+ error: _t5 instanceof Error ? _t5.message : String(_t5)
890
856
  });
891
857
  }
892
- }, _callee3, null, [[0, 2]]);
858
+ }, _callee2, null, [[0, 2]]);
893
859
  }));
894
860
  return _screenshotReply.apply(this, arguments);
895
861
  }
@@ -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-6f568f1d.cjs.prod.js');
20
+ var ValCanvasBridge = require('./ValCanvasBridge-4166883a.cjs.prod.js');
21
21
  var jsxRuntime = require('react/jsx-runtime');
22
22
  require('./unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
23
23
 
@@ -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-4b81f653.cjs.dev.js');
20
+ var ValCanvasBridge = require('./ValCanvasBridge-847e3386.cjs.dev.js');
21
21
  var jsxRuntime = require('react/jsx-runtime');
22
22
  require('./unsupportedIterableToArray-20a9209f.cjs.dev.js');
23
23
 
@@ -13,7 +13,7 @@ import { isDraft, createDraftStore, draftHolds, draftHoldsVersions, startRefresh
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
14
  import { VAL_THEME_SESSION_STORAGE_KEY, isValCanvasFrame } from '@valbuild/shared/client';
15
15
  import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-9209e9dd.esm.js';
16
- import { ValCanvasBridge } from './ValCanvasBridge-badc186b.esm.js';
16
+ import { ValCanvasBridge } from './ValCanvasBridge-ce35f123.esm.js';
17
17
  import { jsxs, jsx } from 'react/jsx-runtime';
18
18
  import './unsupportedIterableToArray-f57eb659.esm.js';
19
19
 
@@ -14,7 +14,7 @@ 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-cc1bc4e5.cjs.dev.js');
17
+ var version = require('./version-e7b90092.cjs.dev.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
19
19
  require('./unsupportedIterableToArray-20a9209f.cjs.dev.js');
20
20
 
@@ -14,7 +14,7 @@ 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-114c45b6.cjs.prod.js');
17
+ var version = require('./version-c929144a.cjs.prod.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-8459fbc7.cjs.prod.js');
19
19
  require('./unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
20
20
 
@@ -13,7 +13,7 @@ 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-d8f64e54.esm.js';
16
+ import { V as VERSION } from './version-46523743.esm.js';
17
17
  import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-9209e9dd.esm.js';
18
18
  import './unsupportedIterableToArray-f57eb659.esm.js';
19
19
 
@@ -12,7 +12,7 @@ var packageJson = {
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- version: "0.151.0",
15
+ version: "0.152.1",
16
16
  scripts: {
17
17
  typecheck: "tsc --noEmit",
18
18
  test: "jest"
@@ -14,7 +14,7 @@ var packageJson = {
14
14
  "next",
15
15
  "react"
16
16
  ],
17
- version: "0.151.0",
17
+ version: "0.152.1",
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.151.0",
17
+ version: "0.152.1",
18
18
  scripts: {
19
19
  typecheck: "tsc --noEmit",
20
20
  test: "jest"
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- "version": "0.151.0",
15
+ "version": "0.152.1",
16
16
  "main": "dist/valbuild-next.cjs.js",
17
17
  "module": "dist/valbuild-next.esm.js",
18
18
  "exports": {
@@ -48,12 +48,12 @@
48
48
  "client-only": "^0.0.1",
49
49
  "server-only": "^0.0.1",
50
50
  "@valbuild/core": "0.151.0",
51
- "@valbuild/language-server": "0.151.0",
52
- "@valbuild/react": "0.151.0",
53
- "@valbuild/mcp": "0.151.0",
54
- "@valbuild/server": "0.151.0",
55
- "@valbuild/shared": "0.151.0",
56
- "@valbuild/ui": "0.151.0"
51
+ "@valbuild/language-server": "0.152.1",
52
+ "@valbuild/mcp": "0.152.1",
53
+ "@valbuild/react": "0.152.1",
54
+ "@valbuild/server": "0.152.1",
55
+ "@valbuild/shared": "0.152.1",
56
+ "@valbuild/ui": "0.152.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@testing-library/react": "^16.3.3",
@@ -9,7 +9,7 @@ var stega = require('@valbuild/react/stega');
9
9
  var internal$1 = require('@valbuild/react/internal');
10
10
  var core = require('@valbuild/core');
11
11
  var internal = require('@valbuild/server/internal');
12
- var version = require('../../dist/version-cc1bc4e5.cjs.dev.js');
12
+ var version = require('../../dist/version-e7b90092.cjs.dev.js');
13
13
  var routeFromVal = require('../../dist/routeFromVal-a1e0a8be.cjs.dev.js');
14
14
  require('../../dist/createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
15
15
  require('../../dist/unsupportedIterableToArray-20a9209f.cjs.dev.js');
@@ -9,7 +9,7 @@ var stega = require('@valbuild/react/stega');
9
9
  var internal$1 = require('@valbuild/react/internal');
10
10
  var core = require('@valbuild/core');
11
11
  var internal = require('@valbuild/server/internal');
12
- var version = require('../../dist/version-114c45b6.cjs.prod.js');
12
+ var version = require('../../dist/version-c929144a.cjs.prod.js');
13
13
  var routeFromVal = require('../../dist/routeFromVal-c4dace91.cjs.prod.js');
14
14
  require('../../dist/createForOfIteratorHelper-8459fbc7.cjs.prod.js');
15
15
  require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
@@ -5,7 +5,7 @@ import { SET_RSC, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
5
5
  import { fetchValFrom, isJsonValuesRecordSchema, awaitResolved, resolveValEntry, resolveVal } from '@valbuild/react/internal';
6
6
  import { Internal } from '@valbuild/core';
7
7
  import { createValRuntime, readDraftChanges, draftForRequest, readerSchemaVersion } from '@valbuild/server/internal';
8
- import { V as VERSION } from '../../dist/version-d8f64e54.esm.js';
8
+ import { V as VERSION } from '../../dist/version-46523743.esm.js';
9
9
  import { i as initValRouteFromVal, g as getValRouteUrlFromVal } from '../../dist/routeFromVal-80976677.esm.js';
10
10
  import '../../dist/createForOfIteratorHelper-9209e9dd.esm.js';
11
11
  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-cc1bc4e5.cjs.dev.js');
12
+ var version = require('../../dist/version-e7b90092.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-114c45b6.cjs.prod.js');
12
+ var version = require('../../dist/version-c929144a.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-d8f64e54.esm.js';
9
+ import { V as VERSION } from '../../dist/version-46523743.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-6f568f1d.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValCanvasBridge-6f568f1d.cjs.dev.js");
7
- }