@valbuild/tanstack 0.150.10 → 0.150.12
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 +43 -0
- package/dist/valbuild-tanstack.cjs.dev.js +126 -4
- package/dist/valbuild-tanstack.cjs.prod.js +126 -4
- package/dist/valbuild-tanstack.esm.js +127 -5
- package/dist/{version-be9f137f.cjs.dev.js → version-f59a0392.cjs.dev.js} +1 -1
- package/dist/{version-dd9d61dc.esm.js → version-f9ded4cd.esm.js} +1 -1
- package/dist/{version-662ab951.cjs.prod.js → version-ff23235a.cjs.prod.js} +1 -1
- package/package.json +7 -7
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +5 -3
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +5 -3
- package/server/dist/valbuild-tanstack-server.esm.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.150.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#977](https://github.com/valbuild/val/pull/977) [`55f565e`](https://github.com/valbuild/val/commit/55f565eefe470d1a7cda436d628aec2f7ad61969) Thanks [@freekh](https://github.com/freekh)! - The Studio now shows which versions of Val it runs. Open the Account panel (the button at the foot of the left rail) and click the grey line at the bottom, for example `TanStack · Val 0.150.8`, to see:
|
|
8
|
+
|
|
9
|
+
- what your app's server runs: `@valbuild/next` or `@valbuild/tanstack`, `@valbuild/core` and `@valbuild/server`
|
|
10
|
+
- what the Studio in your browser loaded: `@valbuild/ui`, and the `@valbuild/core` bundled into it
|
|
11
|
+
|
|
12
|
+
**Copy all** puts the list on the clipboard, ready to paste into a bug report. The server's half comes from a new `GET /api/val/versions` route, which needs the same sign-in as the rest of the Studio. If your server's Val is older than the Studio, the list says so and still shows the Studio's half.
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`e39a373`](https://github.com/valbuild/val/commit/e39a3730624cbf3a5434d4fb0d13be26f44280db), [`d47537a`](https://github.com/valbuild/val/commit/d47537a40ca7ca0c6a5e7b80f1dfb18791fc5bc1), [`55f565e`](https://github.com/valbuild/val/commit/55f565eefe470d1a7cda436d628aec2f7ad61969)]:
|
|
15
|
+
- @valbuild/ui@0.150.12
|
|
16
|
+
- @valbuild/server@0.150.12
|
|
17
|
+
- @valbuild/shared@0.150.12
|
|
18
|
+
- @valbuild/react@0.150.12
|
|
19
|
+
- @valbuild/language-server@0.150.12
|
|
20
|
+
- @valbuild/mcp@0.150.12
|
|
21
|
+
|
|
22
|
+
## 0.150.11
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#974](https://github.com/valbuild/val/pull/974) [`9c6bc8d`](https://github.com/valbuild/val/commit/9c6bc8d25f40427a6fb9eec6ff5506996b718a78) Thanks [@freekh](https://github.com/freekh)! - The design tab no longer makes you wait.
|
|
27
|
+
|
|
28
|
+
- **Quick preview.** A change to components, layout or styles is shown in seconds, without a build: the proposal's browser code is bundled in the tab and the page in the preview runs it. What runs on the server (loaders, server functions, the page's first render) stays the last build's, and the tab says so, with a button to build. The assistant has it too (`quick_preview`).
|
|
29
|
+
- **Cancel and Try again.** A build can be cancelled from the tab, and a build that stops making progress for three minutes is stopped, saying at which step, so it never spins until a reload. The assistant waits for a build with `wait` instead of holding its turn, and has `build_status` and `cancel_build`.
|
|
30
|
+
- **Each step of a build is timed**, and the Build check lists where the time went.
|
|
31
|
+
- **A new build fades in where you were**, at the same page and scroll, instead of the preview going blank and starting over at the top.
|
|
32
|
+
- **`read_page`** lets the assistant check its change on the page: the headings, text, links, images and inputs in order, and one element's computed styles and how many lines it wraps to, at desktop, tablet or phone width.
|
|
33
|
+
- **On a phone**, the design tab shows the preview, the assistant and the changes one at a time, as tabs. Picking is Select, then a tap, and a pick takes you to the assistant with it. On Safari and on an iPhone, where the tab cannot bundle code itself, the quick preview is prepared in a builder tab, as a build already is.
|
|
34
|
+
- **Queue messages in the assistant's chat.** Write while it answers: what you write waits and is sent when the answer is done, one at a time. A queued message can be taken back to edit, moved up or removed, and Stop or a failed answer holds the queue until you go on.
|
|
35
|
+
|
|
36
|
+
The quick preview and `read_page` run in the proposal's own page, through the canvas bridge in `@valbuild/next` and `@valbuild/tanstack`, so a site needs those packages at this version for them. The quick preview is served by a service worker on the proposal's address (`/api/val/quick-preview-sw.js`), which takes code only from the site's own design tab.
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`9abd5ef`](https://github.com/valbuild/val/commit/9abd5efea0c1adc7e7ff2d05b2ea38b76af73b38), [`9c6bc8d`](https://github.com/valbuild/val/commit/9c6bc8d25f40427a6fb9eec6ff5506996b718a78)]:
|
|
39
|
+
- @valbuild/ui@0.150.11
|
|
40
|
+
- @valbuild/shared@0.150.11
|
|
41
|
+
- @valbuild/server@0.150.11
|
|
42
|
+
- @valbuild/react@0.150.11
|
|
43
|
+
- @valbuild/language-server@0.150.11
|
|
44
|
+
- @valbuild/mcp@0.150.11
|
|
45
|
+
|
|
3
46
|
## 0.150.10
|
|
4
47
|
|
|
5
48
|
### 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-f59a0392.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');
|
|
@@ -299,6 +299,14 @@ function ValCanvasBridge(_ref) {
|
|
|
299
299
|
var elementPickingActive = React__default["default"].useRef(false);
|
|
300
300
|
elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
|
|
301
301
|
var elementPicker = React__default["default"].useRef(null);
|
|
302
|
+
/** A scroll back to where the last build was, still trying. */
|
|
303
|
+
var stopRestoring = React__default["default"].useRef(null);
|
|
304
|
+
React__default["default"].useEffect(function () {
|
|
305
|
+
return function () {
|
|
306
|
+
var _stopRestoring$curren;
|
|
307
|
+
return (_stopRestoring$curren = stopRestoring.current) === null || _stopRestoring$curren === void 0 ? void 0 : _stopRestoring$curren.call(stopRestoring);
|
|
308
|
+
};
|
|
309
|
+
}, []);
|
|
302
310
|
var post = React__default["default"].useCallback(function (message) {
|
|
303
311
|
// `*` as the target origin: the studio and the page share an origin today,
|
|
304
312
|
// but the frame does not know the parent's origin for certain and naming
|
|
@@ -524,6 +532,81 @@ function ValCanvasBridge(_ref) {
|
|
|
524
532
|
});
|
|
525
533
|
return;
|
|
526
534
|
}
|
|
535
|
+
if (message.type === "scrollTo") {
|
|
536
|
+
var _stopRestoring$curren2;
|
|
537
|
+
// Where the build before this one was: the design tab swaps a new
|
|
538
|
+
// build in at the same place.
|
|
539
|
+
(_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
|
|
540
|
+
stopRestoring.current = client.restoreScroll(window, message.x, message.y);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (message.type === "readPage") {
|
|
544
|
+
// The assistant's `read_page`: what is on the page, read here because
|
|
545
|
+
// the tab is another origin and cannot. The page's words, unpublished
|
|
546
|
+
// ones included, so only for the frame's parent, and only when that
|
|
547
|
+
// is the site's design tab or the Studio here -- and answered to it
|
|
548
|
+
// alone, not to `*`.
|
|
549
|
+
if (event.source !== window.parent) return;
|
|
550
|
+
var asker = event.origin;
|
|
551
|
+
void client.isDesignTabOrigin(asker, {
|
|
552
|
+
api: "/api/val",
|
|
553
|
+
own: window.location.origin
|
|
554
|
+
}).then(function (trusted) {
|
|
555
|
+
if (trusted) window.parent.postMessage(readPageReply(message), asker);
|
|
556
|
+
});
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (message.type === "quickPreview") {
|
|
560
|
+
// Code that will run on this address: only from the frame's parent,
|
|
561
|
+
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
562
|
+
if (event.source !== window.parent) return;
|
|
563
|
+
var id = message.id,
|
|
564
|
+
files = message.files;
|
|
565
|
+
var origin = event.origin;
|
|
566
|
+
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
|
|
567
|
+
var site, _t;
|
|
568
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
569
|
+
while (1) switch (_context.p = _context.n) {
|
|
570
|
+
case 0:
|
|
571
|
+
_context.p = 0;
|
|
572
|
+
_context.n = 1;
|
|
573
|
+
return client.quickPreviewSiteOrigin("/api/val");
|
|
574
|
+
case 1:
|
|
575
|
+
site = _context.v;
|
|
576
|
+
if (!(site === null || site !== origin)) {
|
|
577
|
+
_context.n = 2;
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
581
|
+
case 2:
|
|
582
|
+
_context.n = 3;
|
|
583
|
+
return client.storeQuickPreview(id, files, {
|
|
584
|
+
swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
585
|
+
});
|
|
586
|
+
case 3:
|
|
587
|
+
post({
|
|
588
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
589
|
+
type: "quickPreviewStored",
|
|
590
|
+
id: id
|
|
591
|
+
});
|
|
592
|
+
_context.n = 5;
|
|
593
|
+
break;
|
|
594
|
+
case 4:
|
|
595
|
+
_context.p = 4;
|
|
596
|
+
_t = _context.v;
|
|
597
|
+
post({
|
|
598
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
599
|
+
type: "quickPreviewStored",
|
|
600
|
+
id: id,
|
|
601
|
+
error: _t instanceof Error ? _t.message : String(_t)
|
|
602
|
+
});
|
|
603
|
+
case 5:
|
|
604
|
+
return _context.a(2);
|
|
605
|
+
}
|
|
606
|
+
}, _callee, null, [[0, 4]]);
|
|
607
|
+
}))();
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
527
610
|
if (message.type === "theme") {
|
|
528
611
|
setSelectionColors({
|
|
529
612
|
selection: message.selection,
|
|
@@ -572,7 +655,17 @@ function ValCanvasBridge(_ref) {
|
|
|
572
655
|
return function () {
|
|
573
656
|
return window.removeEventListener("message", listener);
|
|
574
657
|
};
|
|
575
|
-
}, [scan]);
|
|
658
|
+
}, [scan, post]);
|
|
659
|
+
|
|
660
|
+
// Where the page is, as it moves: the design tab opens a new build there.
|
|
661
|
+
React__default["default"].useEffect(function () {
|
|
662
|
+
return client.watchPageLocation(window, function (location) {
|
|
663
|
+
return post(_typeof._objectSpread2({
|
|
664
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
665
|
+
type: "location"
|
|
666
|
+
}, location));
|
|
667
|
+
});
|
|
668
|
+
}, [post]);
|
|
576
669
|
|
|
577
670
|
/**
|
|
578
671
|
* Picking.
|
|
@@ -908,6 +1001,30 @@ function findByPath(path) {
|
|
|
908
1001
|
return null;
|
|
909
1002
|
}
|
|
910
1003
|
|
|
1004
|
+
/** What `readPage` answers: the page read, or why it could not be. */
|
|
1005
|
+
function readPageReply(message) {
|
|
1006
|
+
try {
|
|
1007
|
+
return {
|
|
1008
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1009
|
+
type: "pageRead",
|
|
1010
|
+
requestId: message.requestId,
|
|
1011
|
+
snapshot: client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
|
|
1012
|
+
selector: message.selector
|
|
1013
|
+
} : {}), message.maxItems !== undefined ? {
|
|
1014
|
+
maxItems: message.maxItems
|
|
1015
|
+
} : {}))
|
|
1016
|
+
};
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
return {
|
|
1019
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1020
|
+
type: "pageRead",
|
|
1021
|
+
requestId: message.requestId,
|
|
1022
|
+
snapshot: null,
|
|
1023
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
911
1028
|
/**
|
|
912
1029
|
* Whether the page should re-read the server on its own, right now.
|
|
913
1030
|
*
|
|
@@ -2751,9 +2868,14 @@ function useDemoServer(demo, config, options) {
|
|
|
2751
2868
|
retryable: false
|
|
2752
2869
|
});
|
|
2753
2870
|
case 2:
|
|
2754
|
-
fetch = createInTabValFetch(modules, {
|
|
2871
|
+
fetch = createInTabValFetch(modules, _typeof._objectSpread2({
|
|
2755
2872
|
config: config
|
|
2756
|
-
}
|
|
2873
|
+
}, version.VERSION !== null ? {
|
|
2874
|
+
framework: {
|
|
2875
|
+
name: "tanstack",
|
|
2876
|
+
version: version.VERSION
|
|
2877
|
+
}
|
|
2878
|
+
} : {}));
|
|
2757
2879
|
_context.n = 3;
|
|
2758
2880
|
return startDemoRelay(fetch);
|
|
2759
2881
|
case 3:
|
|
@@ -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-ff23235a.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');
|
|
@@ -299,6 +299,14 @@ function ValCanvasBridge(_ref) {
|
|
|
299
299
|
var elementPickingActive = React__default["default"].useRef(false);
|
|
300
300
|
elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
|
|
301
301
|
var elementPicker = React__default["default"].useRef(null);
|
|
302
|
+
/** A scroll back to where the last build was, still trying. */
|
|
303
|
+
var stopRestoring = React__default["default"].useRef(null);
|
|
304
|
+
React__default["default"].useEffect(function () {
|
|
305
|
+
return function () {
|
|
306
|
+
var _stopRestoring$curren;
|
|
307
|
+
return (_stopRestoring$curren = stopRestoring.current) === null || _stopRestoring$curren === void 0 ? void 0 : _stopRestoring$curren.call(stopRestoring);
|
|
308
|
+
};
|
|
309
|
+
}, []);
|
|
302
310
|
var post = React__default["default"].useCallback(function (message) {
|
|
303
311
|
// `*` as the target origin: the studio and the page share an origin today,
|
|
304
312
|
// but the frame does not know the parent's origin for certain and naming
|
|
@@ -524,6 +532,81 @@ function ValCanvasBridge(_ref) {
|
|
|
524
532
|
});
|
|
525
533
|
return;
|
|
526
534
|
}
|
|
535
|
+
if (message.type === "scrollTo") {
|
|
536
|
+
var _stopRestoring$curren2;
|
|
537
|
+
// Where the build before this one was: the design tab swaps a new
|
|
538
|
+
// build in at the same place.
|
|
539
|
+
(_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
|
|
540
|
+
stopRestoring.current = client.restoreScroll(window, message.x, message.y);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
if (message.type === "readPage") {
|
|
544
|
+
// The assistant's `read_page`: what is on the page, read here because
|
|
545
|
+
// the tab is another origin and cannot. The page's words, unpublished
|
|
546
|
+
// ones included, so only for the frame's parent, and only when that
|
|
547
|
+
// is the site's design tab or the Studio here -- and answered to it
|
|
548
|
+
// alone, not to `*`.
|
|
549
|
+
if (event.source !== window.parent) return;
|
|
550
|
+
var asker = event.origin;
|
|
551
|
+
void client.isDesignTabOrigin(asker, {
|
|
552
|
+
api: "/api/val",
|
|
553
|
+
own: window.location.origin
|
|
554
|
+
}).then(function (trusted) {
|
|
555
|
+
if (trusted) window.parent.postMessage(readPageReply(message), asker);
|
|
556
|
+
});
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (message.type === "quickPreview") {
|
|
560
|
+
// Code that will run on this address: only from the frame's parent,
|
|
561
|
+
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
562
|
+
if (event.source !== window.parent) return;
|
|
563
|
+
var id = message.id,
|
|
564
|
+
files = message.files;
|
|
565
|
+
var origin = event.origin;
|
|
566
|
+
void asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
|
|
567
|
+
var site, _t;
|
|
568
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
569
|
+
while (1) switch (_context.p = _context.n) {
|
|
570
|
+
case 0:
|
|
571
|
+
_context.p = 0;
|
|
572
|
+
_context.n = 1;
|
|
573
|
+
return client.quickPreviewSiteOrigin("/api/val");
|
|
574
|
+
case 1:
|
|
575
|
+
site = _context.v;
|
|
576
|
+
if (!(site === null || site !== origin)) {
|
|
577
|
+
_context.n = 2;
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
581
|
+
case 2:
|
|
582
|
+
_context.n = 3;
|
|
583
|
+
return client.storeQuickPreview(id, files, {
|
|
584
|
+
swUrl: "/api/val".concat(client.QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
585
|
+
});
|
|
586
|
+
case 3:
|
|
587
|
+
post({
|
|
588
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
589
|
+
type: "quickPreviewStored",
|
|
590
|
+
id: id
|
|
591
|
+
});
|
|
592
|
+
_context.n = 5;
|
|
593
|
+
break;
|
|
594
|
+
case 4:
|
|
595
|
+
_context.p = 4;
|
|
596
|
+
_t = _context.v;
|
|
597
|
+
post({
|
|
598
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
599
|
+
type: "quickPreviewStored",
|
|
600
|
+
id: id,
|
|
601
|
+
error: _t instanceof Error ? _t.message : String(_t)
|
|
602
|
+
});
|
|
603
|
+
case 5:
|
|
604
|
+
return _context.a(2);
|
|
605
|
+
}
|
|
606
|
+
}, _callee, null, [[0, 4]]);
|
|
607
|
+
}))();
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
527
610
|
if (message.type === "theme") {
|
|
528
611
|
setSelectionColors({
|
|
529
612
|
selection: message.selection,
|
|
@@ -572,7 +655,17 @@ function ValCanvasBridge(_ref) {
|
|
|
572
655
|
return function () {
|
|
573
656
|
return window.removeEventListener("message", listener);
|
|
574
657
|
};
|
|
575
|
-
}, [scan]);
|
|
658
|
+
}, [scan, post]);
|
|
659
|
+
|
|
660
|
+
// Where the page is, as it moves: the design tab opens a new build there.
|
|
661
|
+
React__default["default"].useEffect(function () {
|
|
662
|
+
return client.watchPageLocation(window, function (location) {
|
|
663
|
+
return post(_typeof._objectSpread2({
|
|
664
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
665
|
+
type: "location"
|
|
666
|
+
}, location));
|
|
667
|
+
});
|
|
668
|
+
}, [post]);
|
|
576
669
|
|
|
577
670
|
/**
|
|
578
671
|
* Picking.
|
|
@@ -908,6 +1001,30 @@ function findByPath(path) {
|
|
|
908
1001
|
return null;
|
|
909
1002
|
}
|
|
910
1003
|
|
|
1004
|
+
/** What `readPage` answers: the page read, or why it could not be. */
|
|
1005
|
+
function readPageReply(message) {
|
|
1006
|
+
try {
|
|
1007
|
+
return {
|
|
1008
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1009
|
+
type: "pageRead",
|
|
1010
|
+
requestId: message.requestId,
|
|
1011
|
+
snapshot: client.readPageSnapshot(document, _typeof._objectSpread2(_typeof._objectSpread2({}, message.selector !== undefined ? {
|
|
1012
|
+
selector: message.selector
|
|
1013
|
+
} : {}), message.maxItems !== undefined ? {
|
|
1014
|
+
maxItems: message.maxItems
|
|
1015
|
+
} : {}))
|
|
1016
|
+
};
|
|
1017
|
+
} catch (error) {
|
|
1018
|
+
return {
|
|
1019
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
1020
|
+
type: "pageRead",
|
|
1021
|
+
requestId: message.requestId,
|
|
1022
|
+
snapshot: null,
|
|
1023
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
911
1028
|
/**
|
|
912
1029
|
* Whether the page should re-read the server on its own, right now.
|
|
913
1030
|
*
|
|
@@ -2751,9 +2868,14 @@ function useDemoServer(demo, config, options) {
|
|
|
2751
2868
|
retryable: false
|
|
2752
2869
|
});
|
|
2753
2870
|
case 2:
|
|
2754
|
-
fetch = createInTabValFetch(modules, {
|
|
2871
|
+
fetch = createInTabValFetch(modules, _typeof._objectSpread2({
|
|
2755
2872
|
config: config
|
|
2756
|
-
}
|
|
2873
|
+
}, version.VERSION !== null ? {
|
|
2874
|
+
framework: {
|
|
2875
|
+
name: "tanstack",
|
|
2876
|
+
version: version.VERSION
|
|
2877
|
+
}
|
|
2878
|
+
} : {}));
|
|
2757
2879
|
_context.n = 3;
|
|
2758
2880
|
return startDemoRelay(fetch);
|
|
2759
2881
|
case 3:
|
|
@@ -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-f9ded4cd.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, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, 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, 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';
|
|
@@ -275,6 +275,14 @@ function ValCanvasBridge(_ref) {
|
|
|
275
275
|
var elementPickingActive = React.useRef(false);
|
|
276
276
|
elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
|
|
277
277
|
var elementPicker = React.useRef(null);
|
|
278
|
+
/** A scroll back to where the last build was, still trying. */
|
|
279
|
+
var stopRestoring = React.useRef(null);
|
|
280
|
+
React.useEffect(function () {
|
|
281
|
+
return function () {
|
|
282
|
+
var _stopRestoring$curren;
|
|
283
|
+
return (_stopRestoring$curren = stopRestoring.current) === null || _stopRestoring$curren === void 0 ? void 0 : _stopRestoring$curren.call(stopRestoring);
|
|
284
|
+
};
|
|
285
|
+
}, []);
|
|
278
286
|
var post = React.useCallback(function (message) {
|
|
279
287
|
// `*` as the target origin: the studio and the page share an origin today,
|
|
280
288
|
// but the frame does not know the parent's origin for certain and naming
|
|
@@ -500,6 +508,81 @@ function ValCanvasBridge(_ref) {
|
|
|
500
508
|
});
|
|
501
509
|
return;
|
|
502
510
|
}
|
|
511
|
+
if (message.type === "scrollTo") {
|
|
512
|
+
var _stopRestoring$curren2;
|
|
513
|
+
// Where the build before this one was: the design tab swaps a new
|
|
514
|
+
// build in at the same place.
|
|
515
|
+
(_stopRestoring$curren2 = stopRestoring.current) === null || _stopRestoring$curren2 === void 0 || _stopRestoring$curren2.call(stopRestoring);
|
|
516
|
+
stopRestoring.current = restoreScroll(window, message.x, message.y);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (message.type === "readPage") {
|
|
520
|
+
// The assistant's `read_page`: what is on the page, read here because
|
|
521
|
+
// the tab is another origin and cannot. The page's words, unpublished
|
|
522
|
+
// ones included, so only for the frame's parent, and only when that
|
|
523
|
+
// is the site's design tab or the Studio here -- and answered to it
|
|
524
|
+
// alone, not to `*`.
|
|
525
|
+
if (event.source !== window.parent) return;
|
|
526
|
+
var asker = event.origin;
|
|
527
|
+
void isDesignTabOrigin(asker, {
|
|
528
|
+
api: "/api/val",
|
|
529
|
+
own: window.location.origin
|
|
530
|
+
}).then(function (trusted) {
|
|
531
|
+
if (trusted) window.parent.postMessage(readPageReply(message), asker);
|
|
532
|
+
});
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (message.type === "quickPreview") {
|
|
536
|
+
// Code that will run on this address: only from the frame's parent,
|
|
537
|
+
// and only when that is the site's design tab. See `quickPreview.ts`.
|
|
538
|
+
if (event.source !== window.parent) return;
|
|
539
|
+
var id = message.id,
|
|
540
|
+
files = message.files;
|
|
541
|
+
var origin = event.origin;
|
|
542
|
+
void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
543
|
+
var site, _t;
|
|
544
|
+
return _regenerator().w(function (_context) {
|
|
545
|
+
while (1) switch (_context.p = _context.n) {
|
|
546
|
+
case 0:
|
|
547
|
+
_context.p = 0;
|
|
548
|
+
_context.n = 1;
|
|
549
|
+
return quickPreviewSiteOrigin("/api/val");
|
|
550
|
+
case 1:
|
|
551
|
+
site = _context.v;
|
|
552
|
+
if (!(site === null || site !== origin)) {
|
|
553
|
+
_context.n = 2;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
throw new Error("Only the site's design tab can show a quick preview of this proposal.");
|
|
557
|
+
case 2:
|
|
558
|
+
_context.n = 3;
|
|
559
|
+
return storeQuickPreview(id, files, {
|
|
560
|
+
swUrl: "/api/val".concat(QUICK_PREVIEW_SERVICE_WORKER_PATH)
|
|
561
|
+
});
|
|
562
|
+
case 3:
|
|
563
|
+
post({
|
|
564
|
+
val: VAL_CANVAS_MESSAGE,
|
|
565
|
+
type: "quickPreviewStored",
|
|
566
|
+
id: id
|
|
567
|
+
});
|
|
568
|
+
_context.n = 5;
|
|
569
|
+
break;
|
|
570
|
+
case 4:
|
|
571
|
+
_context.p = 4;
|
|
572
|
+
_t = _context.v;
|
|
573
|
+
post({
|
|
574
|
+
val: VAL_CANVAS_MESSAGE,
|
|
575
|
+
type: "quickPreviewStored",
|
|
576
|
+
id: id,
|
|
577
|
+
error: _t instanceof Error ? _t.message : String(_t)
|
|
578
|
+
});
|
|
579
|
+
case 5:
|
|
580
|
+
return _context.a(2);
|
|
581
|
+
}
|
|
582
|
+
}, _callee, null, [[0, 4]]);
|
|
583
|
+
}))();
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
503
586
|
if (message.type === "theme") {
|
|
504
587
|
setSelectionColors({
|
|
505
588
|
selection: message.selection,
|
|
@@ -548,7 +631,17 @@ function ValCanvasBridge(_ref) {
|
|
|
548
631
|
return function () {
|
|
549
632
|
return window.removeEventListener("message", listener);
|
|
550
633
|
};
|
|
551
|
-
}, [scan]);
|
|
634
|
+
}, [scan, post]);
|
|
635
|
+
|
|
636
|
+
// Where the page is, as it moves: the design tab opens a new build there.
|
|
637
|
+
React.useEffect(function () {
|
|
638
|
+
return watchPageLocation(window, function (location) {
|
|
639
|
+
return post(_objectSpread2({
|
|
640
|
+
val: VAL_CANVAS_MESSAGE,
|
|
641
|
+
type: "location"
|
|
642
|
+
}, location));
|
|
643
|
+
});
|
|
644
|
+
}, [post]);
|
|
552
645
|
|
|
553
646
|
/**
|
|
554
647
|
* Picking.
|
|
@@ -884,6 +977,30 @@ function findByPath(path) {
|
|
|
884
977
|
return null;
|
|
885
978
|
}
|
|
886
979
|
|
|
980
|
+
/** What `readPage` answers: the page read, or why it could not be. */
|
|
981
|
+
function readPageReply(message) {
|
|
982
|
+
try {
|
|
983
|
+
return {
|
|
984
|
+
val: VAL_CANVAS_MESSAGE,
|
|
985
|
+
type: "pageRead",
|
|
986
|
+
requestId: message.requestId,
|
|
987
|
+
snapshot: readPageSnapshot(document, _objectSpread2(_objectSpread2({}, message.selector !== undefined ? {
|
|
988
|
+
selector: message.selector
|
|
989
|
+
} : {}), message.maxItems !== undefined ? {
|
|
990
|
+
maxItems: message.maxItems
|
|
991
|
+
} : {}))
|
|
992
|
+
};
|
|
993
|
+
} catch (error) {
|
|
994
|
+
return {
|
|
995
|
+
val: VAL_CANVAS_MESSAGE,
|
|
996
|
+
type: "pageRead",
|
|
997
|
+
requestId: message.requestId,
|
|
998
|
+
snapshot: null,
|
|
999
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
887
1004
|
/**
|
|
888
1005
|
* Whether the page should re-read the server on its own, right now.
|
|
889
1006
|
*
|
|
@@ -2727,9 +2844,14 @@ function useDemoServer(demo, config, options) {
|
|
|
2727
2844
|
retryable: false
|
|
2728
2845
|
});
|
|
2729
2846
|
case 2:
|
|
2730
|
-
fetch = createInTabValFetch(modules, {
|
|
2847
|
+
fetch = createInTabValFetch(modules, _objectSpread2({
|
|
2731
2848
|
config: config
|
|
2732
|
-
}
|
|
2849
|
+
}, VERSION$1 !== null ? {
|
|
2850
|
+
framework: {
|
|
2851
|
+
name: "tanstack",
|
|
2852
|
+
version: VERSION$1
|
|
2853
|
+
}
|
|
2854
|
+
} : {}));
|
|
2733
2855
|
_context.n = 3;
|
|
2734
2856
|
return startDemoRelay(fetch);
|
|
2735
2857
|
case 3:
|
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.12",
|
|
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.12",
|
|
57
|
+
"@valbuild/mcp": "0.150.12",
|
|
58
|
+
"@valbuild/react": "0.150.12",
|
|
59
|
+
"@valbuild/server": "0.150.12",
|
|
60
|
+
"@valbuild/shared": "0.150.12",
|
|
61
|
+
"@valbuild/ui": "0.150.12"
|
|
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-f59a0392.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');
|
|
@@ -217,7 +217,8 @@ var initValApiHandler = function initValApiHandler(valModules, config, draftMode
|
|
|
217
217
|
* nothing reads.
|
|
218
218
|
*/
|
|
219
219
|
next: tanstackVersion,
|
|
220
|
-
core: coreVersion
|
|
220
|
+
core: coreVersion,
|
|
221
|
+
framework: "tanstack"
|
|
221
222
|
}
|
|
222
223
|
}, config), sourceFiles !== undefined ? {
|
|
223
224
|
sourceFiles: sourceFiles
|
|
@@ -1641,7 +1642,8 @@ function initValContent(config, valModules, opts) {
|
|
|
1641
1642
|
versions: {
|
|
1642
1643
|
// `next` is the field name in the wire contract; see initValServer.
|
|
1643
1644
|
next: tanstackVersion,
|
|
1644
|
-
core: coreVersion
|
|
1645
|
+
core: coreVersion,
|
|
1646
|
+
framework: "tanstack"
|
|
1645
1647
|
}
|
|
1646
1648
|
}, config), (opts === null || opts === void 0 ? void 0 : opts.sourceFiles) !== undefined ? {
|
|
1647
1649
|
sourceFiles: opts.sourceFiles
|
|
@@ -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-ff23235a.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');
|
|
@@ -217,7 +217,8 @@ var initValApiHandler = function initValApiHandler(valModules, config, draftMode
|
|
|
217
217
|
* nothing reads.
|
|
218
218
|
*/
|
|
219
219
|
next: tanstackVersion,
|
|
220
|
-
core: coreVersion
|
|
220
|
+
core: coreVersion,
|
|
221
|
+
framework: "tanstack"
|
|
221
222
|
}
|
|
222
223
|
}, config), sourceFiles !== undefined ? {
|
|
223
224
|
sourceFiles: sourceFiles
|
|
@@ -1641,7 +1642,8 @@ function initValContent(config, valModules, opts) {
|
|
|
1641
1642
|
versions: {
|
|
1642
1643
|
// `next` is the field name in the wire contract; see initValServer.
|
|
1643
1644
|
next: tanstackVersion,
|
|
1644
|
-
core: coreVersion
|
|
1645
|
+
core: coreVersion,
|
|
1646
|
+
framework: "tanstack"
|
|
1645
1647
|
}
|
|
1646
1648
|
}, config), (opts === null || opts === void 0 ? void 0 : opts.sourceFiles) !== undefined ? {
|
|
1647
1649
|
sourceFiles: opts.sourceFiles
|
|
@@ -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-f9ded4cd.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';
|
|
@@ -196,7 +196,8 @@ var initValApiHandler = function initValApiHandler(valModules, config, draftMode
|
|
|
196
196
|
* nothing reads.
|
|
197
197
|
*/
|
|
198
198
|
next: tanstackVersion,
|
|
199
|
-
core: coreVersion
|
|
199
|
+
core: coreVersion,
|
|
200
|
+
framework: "tanstack"
|
|
200
201
|
}
|
|
201
202
|
}, config), sourceFiles !== undefined ? {
|
|
202
203
|
sourceFiles: sourceFiles
|
|
@@ -1620,7 +1621,8 @@ function initValContent(config, valModules, opts) {
|
|
|
1620
1621
|
versions: {
|
|
1621
1622
|
// `next` is the field name in the wire contract; see initValServer.
|
|
1622
1623
|
next: tanstackVersion,
|
|
1623
|
-
core: coreVersion
|
|
1624
|
+
core: coreVersion,
|
|
1625
|
+
framework: "tanstack"
|
|
1624
1626
|
}
|
|
1625
1627
|
}, config), (opts === null || opts === void 0 ? void 0 : opts.sourceFiles) !== undefined ? {
|
|
1626
1628
|
sourceFiles: opts.sourceFiles
|