@valbuild/tanstack 0.150.12 → 0.150.13
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 +19 -0
- package/dist/valbuild-tanstack.cjs.dev.js +99 -16
- package/dist/valbuild-tanstack.cjs.prod.js +99 -16
- package/dist/valbuild-tanstack.esm.js +100 -17
- package/dist/{version-f59a0392.cjs.dev.js → version-085fcaa5.cjs.dev.js} +1 -1
- package/dist/{version-ff23235a.cjs.prod.js → version-54e53541.cjs.prod.js} +1 -1
- package/dist/{version-f9ded4cd.esm.js → version-93fe0dbf.esm.js} +1 -1
- package/package.json +7 -7
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +1 -1
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +1 -1
- package/server/dist/valbuild-tanstack-server.esm.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.150.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#985](https://github.com/valbuild/val/pull/985) [`0cd38eb`](https://github.com/valbuild/val/commit/0cd38eb62c80e2b3989aa45a6c9c75b02fc27cd1) Thanks [@freekh](https://github.com/freekh)! - The design tab's assistant can check its work two more ways.
|
|
8
|
+
|
|
9
|
+
- **`lint`** runs Val's own eslint rules -- the ones `@valbuild/eslint-plugin` runs in an editor -- over the proposal's files: a `c.define` path that is not the file's own, a module missing from `val.modules.ts`, `c.define` content that is a variable (which validates, then fails at publish), an import a `.val` file may not make. With `fix: true` it stages the fixes the rules can make themselves.
|
|
10
|
+
- **`screenshot_page`** shows the assistant a picture of the page in the preview, at desktop, tablet or phone width, on screen or the whole page. The page draws itself, through the canvas bridge in `@valbuild/next` and `@valbuild/tanstack`, so a site needs those packages at this version for it. The picture is drawn from the page's HTML and CSS: images from other sites, videos, canvases and embeds may come out blank.
|
|
11
|
+
|
|
12
|
+
`@valbuild/eslint-plugin` has a new entry, `@valbuild/eslint-plugin/rules`, with the same rules over a project that is not on a disk (`createRules(host)`). The plugin itself behaves as before.
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`295a925`](https://github.com/valbuild/val/commit/295a92513fe0356fafc78978bd0a6d32866f1dbe), [`0cd38eb`](https://github.com/valbuild/val/commit/0cd38eb62c80e2b3989aa45a6c9c75b02fc27cd1), [`0e490a9`](https://github.com/valbuild/val/commit/0e490a9b6e44b1e3d70e914d2b16009335124c4b)]:
|
|
15
|
+
- @valbuild/ui@0.150.13
|
|
16
|
+
- @valbuild/shared@0.150.13
|
|
17
|
+
- @valbuild/react@0.150.13
|
|
18
|
+
- @valbuild/server@0.150.13
|
|
19
|
+
- @valbuild/language-server@0.150.13
|
|
20
|
+
- @valbuild/mcp@0.150.13
|
|
21
|
+
|
|
3
22
|
## 0.150.12
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-c3823d62.cjs.dev.js');
|
|
|
6
6
|
var _typeof = require('./typeof-dd0246a1.cjs.dev.js');
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
|
-
var version = require('./version-
|
|
9
|
+
var version = require('./version-085fcaa5.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');
|
|
@@ -556,6 +556,44 @@ function ValCanvasBridge(_ref) {
|
|
|
556
556
|
});
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
|
+
if (message.type === "screenshotPage") {
|
|
560
|
+
// The assistant's `screenshot_page`: a picture of the page, drawn
|
|
561
|
+
// here because the tab is another origin and cannot. As `readPage`:
|
|
562
|
+
// only for the frame's parent, when that is the design tab or the
|
|
563
|
+
// Studio here, and answered to it alone.
|
|
564
|
+
if (event.source !== window.parent) return;
|
|
565
|
+
var _asker = event.origin;
|
|
566
|
+
void client.isDesignTabOrigin(_asker, {
|
|
567
|
+
api: "/api/val",
|
|
568
|
+
own: window.location.origin
|
|
569
|
+
}).then(/*#__PURE__*/function () {
|
|
570
|
+
var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(trusted) {
|
|
571
|
+
var _t;
|
|
572
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
573
|
+
while (1) switch (_context.n) {
|
|
574
|
+
case 0:
|
|
575
|
+
if (trusted) {
|
|
576
|
+
_context.n = 1;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
return _context.a(2);
|
|
580
|
+
case 1:
|
|
581
|
+
_t = window.parent;
|
|
582
|
+
_context.n = 2;
|
|
583
|
+
return screenshotReply(message);
|
|
584
|
+
case 2:
|
|
585
|
+
_t.postMessage.call(_t, _context.v, _asker);
|
|
586
|
+
case 3:
|
|
587
|
+
return _context.a(2);
|
|
588
|
+
}
|
|
589
|
+
}, _callee);
|
|
590
|
+
}));
|
|
591
|
+
return function (_x) {
|
|
592
|
+
return _ref2.apply(this, arguments);
|
|
593
|
+
};
|
|
594
|
+
}());
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
559
597
|
if (message.type === "quickPreview") {
|
|
560
598
|
// Code that will run on this address: only from the frame's parent,
|
|
561
599
|
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
@@ -563,23 +601,23 @@ function ValCanvasBridge(_ref) {
|
|
|
563
601
|
var id = message.id,
|
|
564
602
|
files = message.files;
|
|
565
603
|
var origin = event.origin;
|
|
566
|
-
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
567
|
-
var site,
|
|
568
|
-
return asyncToGenerator._regenerator().w(function (
|
|
569
|
-
while (1) switch (
|
|
604
|
+
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
|
|
605
|
+
var site, _t2;
|
|
606
|
+
return asyncToGenerator._regenerator().w(function (_context2) {
|
|
607
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
570
608
|
case 0:
|
|
571
|
-
|
|
572
|
-
|
|
609
|
+
_context2.p = 0;
|
|
610
|
+
_context2.n = 1;
|
|
573
611
|
return client.quickPreviewSiteOrigin("/api/val");
|
|
574
612
|
case 1:
|
|
575
|
-
site =
|
|
613
|
+
site = _context2.v;
|
|
576
614
|
if (!(site === null || site !== origin)) {
|
|
577
|
-
|
|
615
|
+
_context2.n = 2;
|
|
578
616
|
break;
|
|
579
617
|
}
|
|
580
618
|
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
581
619
|
case 2:
|
|
582
|
-
|
|
620
|
+
_context2.n = 3;
|
|
583
621
|
return client.storeQuickPreview(id, files, {
|
|
584
622
|
swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
585
623
|
});
|
|
@@ -589,21 +627,21 @@ function ValCanvasBridge(_ref) {
|
|
|
589
627
|
type: "quickPreviewStored",
|
|
590
628
|
id: id
|
|
591
629
|
});
|
|
592
|
-
|
|
630
|
+
_context2.n = 5;
|
|
593
631
|
break;
|
|
594
632
|
case 4:
|
|
595
|
-
|
|
596
|
-
|
|
633
|
+
_context2.p = 4;
|
|
634
|
+
_t2 = _context2.v;
|
|
597
635
|
post({
|
|
598
636
|
val: client.VAL_CANVAS_MESSAGE,
|
|
599
637
|
type: "quickPreviewStored",
|
|
600
638
|
id: id,
|
|
601
|
-
error:
|
|
639
|
+
error: _t2 instanceof Error ? _t2.message : String(_t2)
|
|
602
640
|
});
|
|
603
641
|
case 5:
|
|
604
|
-
return
|
|
642
|
+
return _context2.a(2);
|
|
605
643
|
}
|
|
606
|
-
},
|
|
644
|
+
}, _callee2, null, [[0, 4]]);
|
|
607
645
|
}))();
|
|
608
646
|
return;
|
|
609
647
|
}
|
|
@@ -1001,7 +1039,52 @@ function findByPath(path) {
|
|
|
1001
1039
|
return null;
|
|
1002
1040
|
}
|
|
1003
1041
|
|
|
1042
|
+
/** What `screenshotPage` answers: the picture, or why it could not be taken. */
|
|
1043
|
+
function screenshotReply(_x2) {
|
|
1044
|
+
return _screenshotReply.apply(this, arguments);
|
|
1045
|
+
}
|
|
1004
1046
|
/** What `readPage` answers: the page read, or why it could not be. */
|
|
1047
|
+
function _screenshotReply() {
|
|
1048
|
+
_screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(message) {
|
|
1049
|
+
var _t3, _t4, _t5, _t6;
|
|
1050
|
+
return asyncToGenerator._regenerator().w(function (_context3) {
|
|
1051
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
1052
|
+
case 0:
|
|
1053
|
+
_context3.p = 0;
|
|
1054
|
+
_t3 = client.VAL_CANVAS_MESSAGE;
|
|
1055
|
+
_t4 = message.requestId;
|
|
1056
|
+
_context3.n = 1;
|
|
1057
|
+
return client.screenshotPage(window, _typeof._objectSpread2(_typeof._objectSpread2({}, message.fullPage !== undefined ? {
|
|
1058
|
+
fullPage: message.fullPage
|
|
1059
|
+
} : {}), {}, {
|
|
1060
|
+
// The picker's highlight is the Studio's, not the page's.
|
|
1061
|
+
exclude: function exclude(element) {
|
|
1062
|
+
return element.hasAttribute("data-val-picker");
|
|
1063
|
+
}
|
|
1064
|
+
}));
|
|
1065
|
+
case 1:
|
|
1066
|
+
_t5 = _context3.v;
|
|
1067
|
+
return _context3.a(2, {
|
|
1068
|
+
val: _t3,
|
|
1069
|
+
type: "pageScreenshot",
|
|
1070
|
+
requestId: _t4,
|
|
1071
|
+
screenshot: _t5
|
|
1072
|
+
});
|
|
1073
|
+
case 2:
|
|
1074
|
+
_context3.p = 2;
|
|
1075
|
+
_t6 = _context3.v;
|
|
1076
|
+
return _context3.a(2, {
|
|
1077
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1078
|
+
type: "pageScreenshot",
|
|
1079
|
+
requestId: message.requestId,
|
|
1080
|
+
screenshot: null,
|
|
1081
|
+
error: _t6 instanceof Error ? _t6.message : String(_t6)
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
}, _callee3, null, [[0, 2]]);
|
|
1085
|
+
}));
|
|
1086
|
+
return _screenshotReply.apply(this, arguments);
|
|
1087
|
+
}
|
|
1005
1088
|
function readPageReply(message) {
|
|
1006
1089
|
try {
|
|
1007
1090
|
return {
|
|
@@ -6,7 +6,7 @@ var asyncToGenerator = require('./asyncToGenerator-8e5c36c8.cjs.prod.js');
|
|
|
6
6
|
var _typeof = require('./typeof-8998e126.cjs.prod.js');
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
|
-
var version = require('./version-
|
|
9
|
+
var version = require('./version-54e53541.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');
|
|
@@ -556,6 +556,44 @@ function ValCanvasBridge(_ref) {
|
|
|
556
556
|
});
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
|
+
if (message.type === "screenshotPage") {
|
|
560
|
+
// The assistant's `screenshot_page`: a picture of the page, drawn
|
|
561
|
+
// here because the tab is another origin and cannot. As `readPage`:
|
|
562
|
+
// only for the frame's parent, when that is the design tab or the
|
|
563
|
+
// Studio here, and answered to it alone.
|
|
564
|
+
if (event.source !== window.parent) return;
|
|
565
|
+
var _asker = event.origin;
|
|
566
|
+
void client.isDesignTabOrigin(_asker, {
|
|
567
|
+
api: "/api/val",
|
|
568
|
+
own: window.location.origin
|
|
569
|
+
}).then(/*#__PURE__*/function () {
|
|
570
|
+
var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(trusted) {
|
|
571
|
+
var _t;
|
|
572
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
573
|
+
while (1) switch (_context.n) {
|
|
574
|
+
case 0:
|
|
575
|
+
if (trusted) {
|
|
576
|
+
_context.n = 1;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
return _context.a(2);
|
|
580
|
+
case 1:
|
|
581
|
+
_t = window.parent;
|
|
582
|
+
_context.n = 2;
|
|
583
|
+
return screenshotReply(message);
|
|
584
|
+
case 2:
|
|
585
|
+
_t.postMessage.call(_t, _context.v, _asker);
|
|
586
|
+
case 3:
|
|
587
|
+
return _context.a(2);
|
|
588
|
+
}
|
|
589
|
+
}, _callee);
|
|
590
|
+
}));
|
|
591
|
+
return function (_x) {
|
|
592
|
+
return _ref2.apply(this, arguments);
|
|
593
|
+
};
|
|
594
|
+
}());
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
559
597
|
if (message.type === "quickPreview") {
|
|
560
598
|
// Code that will run on this address: only from the frame's parent,
|
|
561
599
|
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
@@ -563,23 +601,23 @@ function ValCanvasBridge(_ref) {
|
|
|
563
601
|
var id = message.id,
|
|
564
602
|
files = message.files;
|
|
565
603
|
var origin = event.origin;
|
|
566
|
-
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
567
|
-
var site,
|
|
568
|
-
return asyncToGenerator._regenerator().w(function (
|
|
569
|
-
while (1) switch (
|
|
604
|
+
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
|
|
605
|
+
var site, _t2;
|
|
606
|
+
return asyncToGenerator._regenerator().w(function (_context2) {
|
|
607
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
570
608
|
case 0:
|
|
571
|
-
|
|
572
|
-
|
|
609
|
+
_context2.p = 0;
|
|
610
|
+
_context2.n = 1;
|
|
573
611
|
return client.quickPreviewSiteOrigin("/api/val");
|
|
574
612
|
case 1:
|
|
575
|
-
site =
|
|
613
|
+
site = _context2.v;
|
|
576
614
|
if (!(site === null || site !== origin)) {
|
|
577
|
-
|
|
615
|
+
_context2.n = 2;
|
|
578
616
|
break;
|
|
579
617
|
}
|
|
580
618
|
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
581
619
|
case 2:
|
|
582
|
-
|
|
620
|
+
_context2.n = 3;
|
|
583
621
|
return client.storeQuickPreview(id, files, {
|
|
584
622
|
swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
585
623
|
});
|
|
@@ -589,21 +627,21 @@ function ValCanvasBridge(_ref) {
|
|
|
589
627
|
type: "quickPreviewStored",
|
|
590
628
|
id: id
|
|
591
629
|
});
|
|
592
|
-
|
|
630
|
+
_context2.n = 5;
|
|
593
631
|
break;
|
|
594
632
|
case 4:
|
|
595
|
-
|
|
596
|
-
|
|
633
|
+
_context2.p = 4;
|
|
634
|
+
_t2 = _context2.v;
|
|
597
635
|
post({
|
|
598
636
|
val: client.VAL_CANVAS_MESSAGE,
|
|
599
637
|
type: "quickPreviewStored",
|
|
600
638
|
id: id,
|
|
601
|
-
error:
|
|
639
|
+
error: _t2 instanceof Error ? _t2.message : String(_t2)
|
|
602
640
|
});
|
|
603
641
|
case 5:
|
|
604
|
-
return
|
|
642
|
+
return _context2.a(2);
|
|
605
643
|
}
|
|
606
|
-
},
|
|
644
|
+
}, _callee2, null, [[0, 4]]);
|
|
607
645
|
}))();
|
|
608
646
|
return;
|
|
609
647
|
}
|
|
@@ -1001,7 +1039,52 @@ function findByPath(path) {
|
|
|
1001
1039
|
return null;
|
|
1002
1040
|
}
|
|
1003
1041
|
|
|
1042
|
+
/** What `screenshotPage` answers: the picture, or why it could not be taken. */
|
|
1043
|
+
function screenshotReply(_x2) {
|
|
1044
|
+
return _screenshotReply.apply(this, arguments);
|
|
1045
|
+
}
|
|
1004
1046
|
/** What `readPage` answers: the page read, or why it could not be. */
|
|
1047
|
+
function _screenshotReply() {
|
|
1048
|
+
_screenshotReply = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(message) {
|
|
1049
|
+
var _t3, _t4, _t5, _t6;
|
|
1050
|
+
return asyncToGenerator._regenerator().w(function (_context3) {
|
|
1051
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
1052
|
+
case 0:
|
|
1053
|
+
_context3.p = 0;
|
|
1054
|
+
_t3 = client.VAL_CANVAS_MESSAGE;
|
|
1055
|
+
_t4 = message.requestId;
|
|
1056
|
+
_context3.n = 1;
|
|
1057
|
+
return client.screenshotPage(window, _typeof._objectSpread2(_typeof._objectSpread2({}, message.fullPage !== undefined ? {
|
|
1058
|
+
fullPage: message.fullPage
|
|
1059
|
+
} : {}), {}, {
|
|
1060
|
+
// The picker's highlight is the Studio's, not the page's.
|
|
1061
|
+
exclude: function exclude(element) {
|
|
1062
|
+
return element.hasAttribute("data-val-picker");
|
|
1063
|
+
}
|
|
1064
|
+
}));
|
|
1065
|
+
case 1:
|
|
1066
|
+
_t5 = _context3.v;
|
|
1067
|
+
return _context3.a(2, {
|
|
1068
|
+
val: _t3,
|
|
1069
|
+
type: "pageScreenshot",
|
|
1070
|
+
requestId: _t4,
|
|
1071
|
+
screenshot: _t5
|
|
1072
|
+
});
|
|
1073
|
+
case 2:
|
|
1074
|
+
_context3.p = 2;
|
|
1075
|
+
_t6 = _context3.v;
|
|
1076
|
+
return _context3.a(2, {
|
|
1077
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1078
|
+
type: "pageScreenshot",
|
|
1079
|
+
requestId: message.requestId,
|
|
1080
|
+
screenshot: null,
|
|
1081
|
+
error: _t6 instanceof Error ? _t6.message : String(_t6)
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
}, _callee3, null, [[0, 2]]);
|
|
1085
|
+
}));
|
|
1086
|
+
return _screenshotReply.apply(this, arguments);
|
|
1087
|
+
}
|
|
1005
1088
|
function readPageReply(message) {
|
|
1006
1089
|
try {
|
|
1007
1090
|
return {
|
|
@@ -5,13 +5,13 @@ 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, _ as _toConsumableArray, V as VERSION$1 } from './version-
|
|
8
|
+
import { r as readValEnableCookie, _ as _toConsumableArray, V as VERSION$1 } from './version-93fe0dbf.esm.js';
|
|
9
9
|
export { ValRichText } from '@valbuild/react/internal';
|
|
10
10
|
import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
|
|
11
11
|
import { useRouter, useRouterState } from '@tanstack/react-router';
|
|
12
12
|
import React, { useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-6411bbe3.esm.js';
|
|
14
|
-
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, isDesignTabOrigin, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, quickPreviewSiteOrigin, readPageSnapshot, isValCanvasFrame } from '@valbuild/shared/client';
|
|
14
|
+
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, isDesignTabOrigin, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, quickPreviewSiteOrigin, readPageSnapshot, screenshotPage, isValCanvasFrame } from '@valbuild/shared/client';
|
|
15
15
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
16
|
import { D as DEMO_CLAIM_MESSAGE, a as DEMO_SERVICE_WORKER_PATH, b as DEMO_RELAY_MESSAGE } from './demoServiceWorker-56fd96cf.esm.js';
|
|
17
17
|
import '@valbuild/core/patch';
|
|
@@ -532,6 +532,44 @@ function ValCanvasBridge(_ref) {
|
|
|
532
532
|
});
|
|
533
533
|
return;
|
|
534
534
|
}
|
|
535
|
+
if (message.type === "screenshotPage") {
|
|
536
|
+
// The assistant's `screenshot_page`: a picture of the page, drawn
|
|
537
|
+
// here because the tab is another origin and cannot. As `readPage`:
|
|
538
|
+
// only for the frame's parent, when that is the design tab or the
|
|
539
|
+
// Studio here, and answered to it alone.
|
|
540
|
+
if (event.source !== window.parent) return;
|
|
541
|
+
var _asker = event.origin;
|
|
542
|
+
void isDesignTabOrigin(_asker, {
|
|
543
|
+
api: "/api/val",
|
|
544
|
+
own: window.location.origin
|
|
545
|
+
}).then(/*#__PURE__*/function () {
|
|
546
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(trusted) {
|
|
547
|
+
var _t;
|
|
548
|
+
return _regenerator().w(function (_context) {
|
|
549
|
+
while (1) switch (_context.n) {
|
|
550
|
+
case 0:
|
|
551
|
+
if (trusted) {
|
|
552
|
+
_context.n = 1;
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
return _context.a(2);
|
|
556
|
+
case 1:
|
|
557
|
+
_t = window.parent;
|
|
558
|
+
_context.n = 2;
|
|
559
|
+
return screenshotReply(message);
|
|
560
|
+
case 2:
|
|
561
|
+
_t.postMessage.call(_t, _context.v, _asker);
|
|
562
|
+
case 3:
|
|
563
|
+
return _context.a(2);
|
|
564
|
+
}
|
|
565
|
+
}, _callee);
|
|
566
|
+
}));
|
|
567
|
+
return function (_x) {
|
|
568
|
+
return _ref2.apply(this, arguments);
|
|
569
|
+
};
|
|
570
|
+
}());
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
535
573
|
if (message.type === "quickPreview") {
|
|
536
574
|
// Code that will run on this address: only from the frame's parent,
|
|
537
575
|
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
@@ -539,23 +577,23 @@ function ValCanvasBridge(_ref) {
|
|
|
539
577
|
var id = message.id,
|
|
540
578
|
files = message.files;
|
|
541
579
|
var origin = event.origin;
|
|
542
|
-
void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
543
|
-
var site,
|
|
544
|
-
return _regenerator().w(function (
|
|
545
|
-
while (1) switch (
|
|
580
|
+
void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
581
|
+
var site, _t2;
|
|
582
|
+
return _regenerator().w(function (_context2) {
|
|
583
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
546
584
|
case 0:
|
|
547
|
-
|
|
548
|
-
|
|
585
|
+
_context2.p = 0;
|
|
586
|
+
_context2.n = 1;
|
|
549
587
|
return quickPreviewSiteOrigin("/api/val");
|
|
550
588
|
case 1:
|
|
551
|
-
site =
|
|
589
|
+
site = _context2.v;
|
|
552
590
|
if (!(site === null || site !== origin)) {
|
|
553
|
-
|
|
591
|
+
_context2.n = 2;
|
|
554
592
|
break;
|
|
555
593
|
}
|
|
556
594
|
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
557
595
|
case 2:
|
|
558
|
-
|
|
596
|
+
_context2.n = 3;
|
|
559
597
|
return storeQuickPreview(id, files, {
|
|
560
598
|
swUrl: "/api/val".concat(QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
561
599
|
});
|
|
@@ -565,21 +603,21 @@ function ValCanvasBridge(_ref) {
|
|
|
565
603
|
type: "quickPreviewStored",
|
|
566
604
|
id: id
|
|
567
605
|
});
|
|
568
|
-
|
|
606
|
+
_context2.n = 5;
|
|
569
607
|
break;
|
|
570
608
|
case 4:
|
|
571
|
-
|
|
572
|
-
|
|
609
|
+
_context2.p = 4;
|
|
610
|
+
_t2 = _context2.v;
|
|
573
611
|
post({
|
|
574
612
|
val: VAL_CANVAS_MESSAGE,
|
|
575
613
|
type: "quickPreviewStored",
|
|
576
614
|
id: id,
|
|
577
|
-
error:
|
|
615
|
+
error: _t2 instanceof Error ? _t2.message : String(_t2)
|
|
578
616
|
});
|
|
579
617
|
case 5:
|
|
580
|
-
return
|
|
618
|
+
return _context2.a(2);
|
|
581
619
|
}
|
|
582
|
-
},
|
|
620
|
+
}, _callee2, null, [[0, 4]]);
|
|
583
621
|
}))();
|
|
584
622
|
return;
|
|
585
623
|
}
|
|
@@ -977,7 +1015,52 @@ function findByPath(path) {
|
|
|
977
1015
|
return null;
|
|
978
1016
|
}
|
|
979
1017
|
|
|
1018
|
+
/** What `screenshotPage` answers: the picture, or why it could not be taken. */
|
|
1019
|
+
function screenshotReply(_x2) {
|
|
1020
|
+
return _screenshotReply.apply(this, arguments);
|
|
1021
|
+
}
|
|
980
1022
|
/** What `readPage` answers: the page read, or why it could not be. */
|
|
1023
|
+
function _screenshotReply() {
|
|
1024
|
+
_screenshotReply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(message) {
|
|
1025
|
+
var _t3, _t4, _t5, _t6;
|
|
1026
|
+
return _regenerator().w(function (_context3) {
|
|
1027
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
1028
|
+
case 0:
|
|
1029
|
+
_context3.p = 0;
|
|
1030
|
+
_t3 = VAL_CANVAS_MESSAGE;
|
|
1031
|
+
_t4 = message.requestId;
|
|
1032
|
+
_context3.n = 1;
|
|
1033
|
+
return screenshotPage(window, _objectSpread2(_objectSpread2({}, message.fullPage !== undefined ? {
|
|
1034
|
+
fullPage: message.fullPage
|
|
1035
|
+
} : {}), {}, {
|
|
1036
|
+
// The picker's highlight is the Studio's, not the page's.
|
|
1037
|
+
exclude: function exclude(element) {
|
|
1038
|
+
return element.hasAttribute("data-val-picker");
|
|
1039
|
+
}
|
|
1040
|
+
}));
|
|
1041
|
+
case 1:
|
|
1042
|
+
_t5 = _context3.v;
|
|
1043
|
+
return _context3.a(2, {
|
|
1044
|
+
val: _t3,
|
|
1045
|
+
type: "pageScreenshot",
|
|
1046
|
+
requestId: _t4,
|
|
1047
|
+
screenshot: _t5
|
|
1048
|
+
});
|
|
1049
|
+
case 2:
|
|
1050
|
+
_context3.p = 2;
|
|
1051
|
+
_t6 = _context3.v;
|
|
1052
|
+
return _context3.a(2, {
|
|
1053
|
+
val: VAL_CANVAS_MESSAGE,
|
|
1054
|
+
type: "pageScreenshot",
|
|
1055
|
+
requestId: message.requestId,
|
|
1056
|
+
screenshot: null,
|
|
1057
|
+
error: _t6 instanceof Error ? _t6.message : String(_t6)
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
}, _callee3, null, [[0, 2]]);
|
|
1061
|
+
}));
|
|
1062
|
+
return _screenshotReply.apply(this, arguments);
|
|
1063
|
+
}
|
|
981
1064
|
function readPageReply(message) {
|
|
982
1065
|
try {
|
|
983
1066
|
return {
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"tanstack-router",
|
|
15
15
|
"react"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.150.
|
|
17
|
+
"version": "0.150.13",
|
|
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.150.3",
|
|
56
|
-
"@valbuild/language-server": "0.150.
|
|
57
|
-
"@valbuild/mcp": "0.150.
|
|
58
|
-
"@valbuild/react": "0.150.
|
|
59
|
-
"@valbuild/server": "0.150.
|
|
60
|
-
"@valbuild/shared": "0.150.
|
|
61
|
-
"@valbuild/ui": "0.150.
|
|
56
|
+
"@valbuild/language-server": "0.150.13",
|
|
57
|
+
"@valbuild/mcp": "0.150.13",
|
|
58
|
+
"@valbuild/react": "0.150.13",
|
|
59
|
+
"@valbuild/server": "0.150.13",
|
|
60
|
+
"@valbuild/shared": "0.150.13",
|
|
61
|
+
"@valbuild/ui": "0.150.13"
|
|
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-
|
|
5
|
+
var version = require('../../dist/version-085fcaa5.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-dd0246a1.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-
|
|
5
|
+
var version = require('../../dist/version-54e53541.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-8998e126.cjs.prod.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VERSION, _ as _toConsumableArray, s as setValEnableCookieReader } from '../../dist/version-
|
|
1
|
+
import { V as VERSION, _ as _toConsumableArray, s as setValEnableCookieReader } from '../../dist/version-93fe0dbf.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, b as _createForOfIteratorHelper, g as _defineProperty, c as _typeof } from '../../dist/typeof-66e2d869.esm.js';
|