@valbuild/shared 0.152.1 → 0.153.0
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 +38 -0
- package/client/dist/valbuild-shared-client.cjs.dev.js +2 -1
- package/client/dist/valbuild-shared-client.cjs.prod.js +2 -1
- package/client/dist/valbuild-shared-client.esm.js +1 -1
- package/dist/declarations/src/internal/ApiRoutes.d.ts +123 -100
- package/dist/declarations/src/internal/elementPicker.d.ts +8 -0
- package/dist/declarations/src/internal/valCanvasProtocol.d.ts +24 -13
- package/dist/declarations/src/publish/builder.d.ts +7 -2
- package/dist/{getSitemapTree-dc61b8b6.cjs.dev.js → getSitemapTree-32643b50.cjs.dev.js} +16 -6
- package/dist/{getSitemapTree-d0942fca.cjs.prod.js → getSitemapTree-a4738117.cjs.prod.js} +16 -6
- package/dist/{getSitemapTree-2b22cf1b.esm.js → getSitemapTree-a887fed4.esm.js} +16 -7
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +118 -156
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +118 -156
- package/internal/dist/valbuild-shared-internal.esm.js +116 -157
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.153.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Editing content in a proposal whose code changed, before the proposal is built again:
|
|
8
|
+
|
|
9
|
+
- **A module the proposal adds** can be edited and saved right away. Its content is read from the new file and saved. Before, those edits were dropped. If the module's content is made by code (not written out in the file), the save waits and says to build the proposal first.
|
|
10
|
+
- **A module whose schema moved because a file it imports changed** (for example a shared `src/schemas/*.ts`) is no longer read with the old schema. Pages keep showing the content as built until the proposal is built again.
|
|
11
|
+
- **Edits that no longer fit the schema** can be handed to the assistant. The banner that lists them has a **Have the assistant move it** button for each one. You still discard the held edit yourself afterwards.
|
|
12
|
+
|
|
13
|
+
For this, `@valbuild/tanstack-build` records which files each Val module imports, and the `val.server.ts` it generates passes that to Val as the new optional `moduleDependencies` option of `initValServer` and `initValContent`. You do not need to set it yourself. A site built before this has no `moduleDependencies` and works as before.
|
|
14
|
+
|
|
15
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Removed what 0.151.0 kept only so that a Studio, a page and a server from the release before could still talk to each other during a deploy:
|
|
16
|
+
|
|
17
|
+
- **`PUT /api/val/sources/~`** is gone. Nothing in 0.151.0 asked it: the Studio reads modules through `GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and `fetchVal`, `useVal` and the MCP tools read the server's content in-process. If a script or test of yours read content through it, read one module with `GET /api/val/modules/~<path>` instead. Its answer has the module's `source` and `version`, and an `entries` map holding the `.jsonValues()` entries pending changes touched.
|
|
18
|
+
- **`ValDraft.base`** is gone from the type. It has not been sent or read since 0.151.0, so a `draft` you pass to `ValProvider` is not affected.
|
|
19
|
+
- **A page no longer accepts edits relayed by a Studio from before 0.151.0.** Such a Studio sent each module as a bare `source`. After the upgrade, the Studio and your pages come from the same deploy, so this only matters while an older Studio is still open in a tab during a rollout. Reloading that tab fixes it.
|
|
20
|
+
- **`/api/val/stat`** no longer needs `sourcesSha` and `schemaSha`. The Studio now tells your local server which version it last saw, and the server still sends both fields for a Studio of 0.151.0. They stop being sent in the next release.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#1028](https://github.com/valbuild/val/pull/1028) [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21) Thanks [@freekh](https://github.com/freekh)! - Another editor's keystroke costs the Studio less. Locally (`pnpm dev`, and
|
|
25
|
+
anywhere `/stat` long-polls), the Studio no longer asks for the manifest or
|
|
26
|
+
the changed module after someone else types: `/stat` now carries what
|
|
27
|
+
`GET /manifest` would have answered, and the module's new version is computed
|
|
28
|
+
from the patch the Studio already fetched. Where neither can be used (an
|
|
29
|
+
older server, a version that does not match), the Studio asks for them as
|
|
30
|
+
before.
|
|
31
|
+
|
|
32
|
+
- [#1030](https://github.com/valbuild/val/pull/1030) [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c) Thanks [@freekh](https://github.com/freekh)! - **Point the assistant at something on the page.** With the preview open, the assistant has a **Select** in its header: press it, click a field on the page, and what you picked shows above the message box and goes with your next message, so "make this shorter" means that field. In code mode it can pick any element, outlined in the proposal's colour. Press the × on it to take it off.
|
|
33
|
+
|
|
34
|
+
- Selecting a field to edit has moved from the preview's toolbar to the top of the editor column, beside **Structure | On page**. Esc turns it off, from the Studio or from the page.
|
|
35
|
+
- On a desktop the assistant now sits beside the preview instead of over it, so it never covers what you point it at.
|
|
36
|
+
- The assistant can read the page in the preview, and take a picture of it, to see what you see.
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41)]:
|
|
39
|
+
- @valbuild/core@0.153.0
|
|
40
|
+
|
|
3
41
|
## 0.152.1
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
5
|
+
var getSitemapTree = require('../../dist/getSitemapTree-32643b50.cjs.dev.js');
|
|
6
6
|
require('../../dist/createForOfIteratorHelper-f2d7ac6d.cjs.dev.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
8
|
|
|
@@ -31,6 +31,7 @@ exports.getPageRouterSitemapTree = getSitemapTree.getPageRouterSitemapTree;
|
|
|
31
31
|
exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
|
|
32
32
|
exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
|
|
33
33
|
exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
|
|
34
|
+
exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
|
|
34
35
|
exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
|
|
35
36
|
exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
|
|
36
37
|
exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
5
|
+
var getSitemapTree = require('../../dist/getSitemapTree-a4738117.cjs.prod.js');
|
|
6
6
|
require('../../dist/createForOfIteratorHelper-9ca2078d.cjs.prod.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
8
|
|
|
@@ -31,6 +31,7 @@ exports.getPageRouterSitemapTree = getSitemapTree.getPageRouterSitemapTree;
|
|
|
31
31
|
exports.getPageRouterSourceFolder = getSitemapTree.getPageRouterSourceFolder;
|
|
32
32
|
exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
|
|
33
33
|
exports.getTanStackRouterSourceFolder = getSitemapTree.getTanStackRouterSourceFolder;
|
|
34
|
+
exports.isCanvasSelectionColor = getSitemapTree.isCanvasSelectionColor;
|
|
34
35
|
exports.isQuickPreviewFiles = getSitemapTree.isQuickPreviewFiles;
|
|
35
36
|
exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
|
|
36
37
|
exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_CANVAS_SELECTION, e as DEFAULT_CANVAS_SELECTION_SOFT, Q as QUICK_PREVIEW_PARAM,
|
|
1
|
+
export { D as DEFAULT_CANVAS_SELECTION, e as DEFAULT_CANVAS_SELECTION_SOFT, Q as QUICK_PREVIEW_PARAM, x as QUICK_PREVIEW_RENDER_SCRIPT, v as QUICK_PREVIEW_SERVICE_WORKER_PATH, A as QUICK_PREVIEW_SERVICE_WORKER_SOURCE, y as QUICK_PREVIEW_STORE_MESSAGE, b as VAL_AI_SESSION_STORAGE_KEY, d as VAL_CANVAS_MESSAGE, c as VAL_CANVAS_PARAM, V as VAL_CONFIG_SESSION_STORAGE_KEY, a as VAL_THEME_SESSION_STORAGE_KEY, k as attachElementPicker, l as createPickerOverlay, j as describeElement, n as elementLabel, t as findBySelector, F as formatRoutePattern, G as getNextAppRouterSourceFolder, K as getPageRouterSitemapTree, I as getPageRouterSourceFolder, L as getPatternFromModuleFilePath, H as getTanStackRouterSourceFolder, f as isCanvasSelectionColor, z as isQuickPreviewFiles, J as isTanStackRoutesFolder, h as isValCanvasFrame, i as isValCanvasPageMessage, g as isValCanvasStudioMessage, m as modifierLabel, p as pageLocationOf, E as parseRoutePattern, q as readPageSnapshot, r as restoreScroll, u as screenshotPage, s as startElementPicking, B as storeQuickPreview, o as watchPageLocation, C as withQuickPreviewParam, w as withValCanvasParam } from '../../dist/getSitemapTree-a887fed4.esm.js';
|
|
2
2
|
import '../../dist/createForOfIteratorHelper-9b80f1a2.esm.js';
|
|
3
3
|
import '@valbuild/core';
|
|
@@ -119,6 +119,69 @@ export declare const SketchpadSummary: z.ZodObject<{
|
|
|
119
119
|
export type SketchpadSummaryT = z.infer<typeof SketchpadSummary>;
|
|
120
120
|
/** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */
|
|
121
121
|
export declare const SKETCHPAD_MAX_TEXT_LENGTH: number;
|
|
122
|
+
/**
|
|
123
|
+
* A manifest as the server answers it: what each module IS on the server
|
|
124
|
+
* (`GET /manifest`, and the same answer on `/stat` when the Studio asks for it
|
|
125
|
+
* there -- one function on the server answers both, `manifestAnswer`).
|
|
126
|
+
*/
|
|
127
|
+
export declare const ManifestJson: z.ZodObject<{
|
|
128
|
+
project: z.ZodObject<{
|
|
129
|
+
build: z.ZodString;
|
|
130
|
+
seq: z.ZodNumber;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
133
|
+
schema: z.ZodString;
|
|
134
|
+
base: z.ZodString;
|
|
135
|
+
chain: z.ZodString;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
138
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
superseded: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
entry: z.ZodString;
|
|
142
|
+
core: z.ZodString;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type ManifestJsonT = z.infer<typeof ManifestJson>;
|
|
146
|
+
/**
|
|
147
|
+
* The manifest a `/stat` answer carries, when the request said which one the
|
|
148
|
+
* Studio holds (`manifest` on the request): what `GET /manifest` would have
|
|
149
|
+
* answered for it, so another editor's keystroke costs no manifest request.
|
|
150
|
+
*
|
|
151
|
+
* - A manifest, whole or a delta. A delta names the ETag it is relative to
|
|
152
|
+
* (`sinceTag`): a Studio uses it only while it holds exactly that one.
|
|
153
|
+
* - `unchanged`: the manifest the request named, at `seq`, is still the
|
|
154
|
+
* one for this answer's `seq`. Decided by `seq` alone, and not read: a
|
|
155
|
+
* Studio reads a manifest only for a stat whose `seq` moved. It keeps the
|
|
156
|
+
* next request naming the same manifest.
|
|
157
|
+
*
|
|
158
|
+
* Optional: absent from a server of the release before, and from an answer
|
|
159
|
+
* to a request that did not ask, and then the Studio reads `GET /manifest`.
|
|
160
|
+
*/
|
|
161
|
+
export declare const StatManifest: z.ZodUnion<readonly [z.ZodObject<{
|
|
162
|
+
project: z.ZodObject<{
|
|
163
|
+
build: z.ZodString;
|
|
164
|
+
seq: z.ZodNumber;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
167
|
+
schema: z.ZodString;
|
|
168
|
+
base: z.ZodString;
|
|
169
|
+
chain: z.ZodString;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
172
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
superseded: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
175
|
+
entry: z.ZodString;
|
|
176
|
+
core: z.ZodString;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
sinceTag: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
unchanged: z.ZodLiteral<true>;
|
|
181
|
+
tag: z.ZodString;
|
|
182
|
+
seq: z.ZodNumber;
|
|
183
|
+
}, z.core.$strip>]>;
|
|
184
|
+
export type StatManifestT = z.infer<typeof StatManifest>;
|
|
122
185
|
export declare const Api: {
|
|
123
186
|
"/draft/enable": {
|
|
124
187
|
GET: {
|
|
@@ -585,11 +648,19 @@ export declare const Api: {
|
|
|
585
648
|
POST: {
|
|
586
649
|
req: {
|
|
587
650
|
body: z.ZodNullable<z.ZodObject<{
|
|
588
|
-
sourcesSha: z.ZodString
|
|
589
|
-
schemaSha: z.ZodString
|
|
651
|
+
sourcesSha: z.ZodOptional<z.ZodString>;
|
|
652
|
+
schemaSha: z.ZodOptional<z.ZodString>;
|
|
653
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
654
|
+
build: z.ZodString;
|
|
655
|
+
seq: z.ZodNumber;
|
|
656
|
+
}, z.core.$strip>>;
|
|
590
657
|
baseSha: z.ZodString;
|
|
591
658
|
patches: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
592
659
|
jsonEntriesSha: z.ZodOptional<z.ZodString>;
|
|
660
|
+
manifest: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
661
|
+
tag: z.ZodString;
|
|
662
|
+
seq: z.ZodNumber;
|
|
663
|
+
}, z.core.$strip>>>;
|
|
593
664
|
}, z.core.$strip>>;
|
|
594
665
|
cookies: {
|
|
595
666
|
val_session: z.ZodOptional<z.ZodString>;
|
|
@@ -615,8 +686,8 @@ export declare const Api: {
|
|
|
615
686
|
json: z.ZodUnion<readonly [z.ZodObject<{
|
|
616
687
|
type: z.ZodUnion<readonly [z.ZodLiteral<"request-again">, z.ZodLiteral<"no-change">, z.ZodLiteral<"did-change">]>;
|
|
617
688
|
baseSha: z.ZodString;
|
|
618
|
-
schemaSha: z.ZodString
|
|
619
|
-
sourcesSha: z.ZodString
|
|
689
|
+
schemaSha: z.ZodOptional<z.ZodString>;
|
|
690
|
+
sourcesSha: z.ZodOptional<z.ZodString>;
|
|
620
691
|
patches: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
621
692
|
appliedPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
|
|
622
693
|
publishingPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
|
|
@@ -653,13 +724,36 @@ export declare const Api: {
|
|
|
653
724
|
build: z.ZodString;
|
|
654
725
|
seq: z.ZodNumber;
|
|
655
726
|
}, z.core.$strip>>;
|
|
727
|
+
manifest: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
728
|
+
project: z.ZodObject<{
|
|
729
|
+
build: z.ZodString;
|
|
730
|
+
seq: z.ZodNumber;
|
|
731
|
+
}, z.core.$strip>;
|
|
732
|
+
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
733
|
+
schema: z.ZodString;
|
|
734
|
+
base: z.ZodString;
|
|
735
|
+
chain: z.ZodString;
|
|
736
|
+
}, z.core.$strip>>;
|
|
737
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
738
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
739
|
+
superseded: z.ZodOptional<z.ZodBoolean>;
|
|
740
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
741
|
+
entry: z.ZodString;
|
|
742
|
+
core: z.ZodString;
|
|
743
|
+
}, z.core.$strip>>;
|
|
744
|
+
sinceTag: z.ZodOptional<z.ZodString>;
|
|
745
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
746
|
+
unchanged: z.ZodLiteral<true>;
|
|
747
|
+
tag: z.ZodString;
|
|
748
|
+
seq: z.ZodNumber;
|
|
749
|
+
}, z.core.$strip>]>>;
|
|
656
750
|
}, z.core.$strip>, z.ZodObject<{
|
|
657
751
|
type: z.ZodLiteral<"use-websocket">;
|
|
658
752
|
url: z.ZodString;
|
|
659
753
|
nonce: z.ZodString;
|
|
660
754
|
baseSha: z.ZodString;
|
|
661
|
-
schemaSha: z.ZodString
|
|
662
|
-
sourcesSha: z.ZodString
|
|
755
|
+
schemaSha: z.ZodOptional<z.ZodString>;
|
|
756
|
+
sourcesSha: z.ZodOptional<z.ZodString>;
|
|
663
757
|
commitSha: z.ZodOptional<z.ZodString>;
|
|
664
758
|
patches: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
665
759
|
appliedPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
|
|
@@ -711,6 +805,29 @@ export declare const Api: {
|
|
|
711
805
|
build: z.ZodString;
|
|
712
806
|
seq: z.ZodNumber;
|
|
713
807
|
}, z.core.$strip>>;
|
|
808
|
+
manifest: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
809
|
+
project: z.ZodObject<{
|
|
810
|
+
build: z.ZodString;
|
|
811
|
+
seq: z.ZodNumber;
|
|
812
|
+
}, z.core.$strip>;
|
|
813
|
+
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
814
|
+
schema: z.ZodString;
|
|
815
|
+
base: z.ZodString;
|
|
816
|
+
chain: z.ZodString;
|
|
817
|
+
}, z.core.$strip>>;
|
|
818
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
819
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
820
|
+
superseded: z.ZodOptional<z.ZodBoolean>;
|
|
821
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
822
|
+
entry: z.ZodString;
|
|
823
|
+
core: z.ZodString;
|
|
824
|
+
}, z.core.$strip>>;
|
|
825
|
+
sinceTag: z.ZodOptional<z.ZodString>;
|
|
826
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
827
|
+
unchanged: z.ZodLiteral<true>;
|
|
828
|
+
tag: z.ZodString;
|
|
829
|
+
seq: z.ZodNumber;
|
|
830
|
+
}, z.core.$strip>]>>;
|
|
714
831
|
}, z.core.$strip>]>;
|
|
715
832
|
}, z.core.$strip>]>;
|
|
716
833
|
};
|
|
@@ -1430,100 +1547,6 @@ export declare const Api: {
|
|
|
1430
1547
|
}, z.core.$strip>]>;
|
|
1431
1548
|
};
|
|
1432
1549
|
};
|
|
1433
|
-
/**
|
|
1434
|
-
* @deprecated The whole tree. Nothing of this release asks it: the Studio
|
|
1435
|
-
* reads modules by version (`GET /manifest`, `GET /modules/~`), the draft
|
|
1436
|
-
* readers and MCP read the head in-process. Kept, with `exclude_patches`
|
|
1437
|
-
* (`BaseAlignment`'s fetch) and the ignored `validate_sources` and
|
|
1438
|
-
* `validate_binary_files`, for a Studio of the release before; goes in the
|
|
1439
|
-
* release after the one that ships this (see "Release-delayed deletions"
|
|
1440
|
-
* in `docs/plans/one-content-model.md`).
|
|
1441
|
-
*/
|
|
1442
|
-
"/sources/~": {
|
|
1443
|
-
PUT: {
|
|
1444
|
-
req: {
|
|
1445
|
-
path: z.ZodOptional<z.ZodString>;
|
|
1446
|
-
query: {
|
|
1447
|
-
validate_sources: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>> & z.ZodType<"true" | "false", string[], z.core.$ZodTypeInternals<"true" | "false", string[]>>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
1448
|
-
validate_binary_files: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>> & z.ZodType<"true" | "false", string[], z.core.$ZodTypeInternals<"true" | "false", string[]>>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
1449
|
-
exclude_patches: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>> & z.ZodType<"true" | "false", string[], z.core.$ZodTypeInternals<"true" | "false", string[]>>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
1450
|
-
apply_patches: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>> & z.ZodType<"true" | "false", string[], z.core.$ZodTypeInternals<"true" | "false", string[]>>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
1451
|
-
};
|
|
1452
|
-
cookies: {
|
|
1453
|
-
val_session: z.ZodOptional<z.ZodString>;
|
|
1454
|
-
};
|
|
1455
|
-
};
|
|
1456
|
-
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1457
|
-
status: z.ZodLiteral<401>;
|
|
1458
|
-
json: z.ZodObject<{
|
|
1459
|
-
message: z.ZodString;
|
|
1460
|
-
}, z.core.$strip>;
|
|
1461
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1462
|
-
status: z.ZodLiteral<401>;
|
|
1463
|
-
json: z.ZodObject<{
|
|
1464
|
-
message: z.ZodString;
|
|
1465
|
-
}, z.core.$strip>;
|
|
1466
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1467
|
-
status: z.ZodLiteral<500>;
|
|
1468
|
-
json: z.ZodObject<{
|
|
1469
|
-
message: z.ZodString;
|
|
1470
|
-
details: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
1471
|
-
message: z.ZodString;
|
|
1472
|
-
path: z.ZodOptional<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>>;
|
|
1473
|
-
}, z.core.$strip>>, z.ZodObject<{
|
|
1474
|
-
message: z.ZodString;
|
|
1475
|
-
}, z.core.$strip>]>;
|
|
1476
|
-
}, z.core.$strip>;
|
|
1477
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1478
|
-
status: z.ZodLiteral<409>;
|
|
1479
|
-
json: z.ZodObject<{
|
|
1480
|
-
message: z.ZodString;
|
|
1481
|
-
}, z.core.$strip>;
|
|
1482
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1483
|
-
status: z.ZodLiteral<400>;
|
|
1484
|
-
json: z.ZodObject<{
|
|
1485
|
-
message: z.ZodString;
|
|
1486
|
-
details: z.ZodArray<z.ZodObject<{
|
|
1487
|
-
message: z.ZodString;
|
|
1488
|
-
path: z.ZodOptional<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>>;
|
|
1489
|
-
}, z.core.$strip>>;
|
|
1490
|
-
}, z.core.$strip>;
|
|
1491
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1492
|
-
status: z.ZodLiteral<200>;
|
|
1493
|
-
json: z.ZodObject<{
|
|
1494
|
-
schemaSha: z.ZodString;
|
|
1495
|
-
sourcesSha: z.ZodString;
|
|
1496
|
-
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
1497
|
-
preview: z.ZodOptional<z.ZodAny>;
|
|
1498
|
-
source: z.ZodOptional<z.ZodAny>;
|
|
1499
|
-
baseSource: z.ZodOptional<z.ZodAny>;
|
|
1500
|
-
patches: z.ZodOptional<z.ZodObject<{
|
|
1501
|
-
applied: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1502
|
-
skipped: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
|
|
1503
|
-
errors: z.ZodOptional<z.ZodRecord<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>, z.ZodObject<{
|
|
1504
|
-
message: z.ZodString;
|
|
1505
|
-
}, z.core.$strip>>>;
|
|
1506
|
-
}, z.core.$strip>>;
|
|
1507
|
-
validationErrors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1508
|
-
message: z.ZodString;
|
|
1509
|
-
value: z.ZodOptional<z.ZodUnknown>;
|
|
1510
|
-
fatal: z.ZodOptional<z.ZodBoolean>;
|
|
1511
|
-
fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown>>>>;
|
|
1512
|
-
}, z.core.$strip>>>>;
|
|
1513
|
-
version: z.ZodOptional<z.ZodObject<{
|
|
1514
|
-
schema: z.ZodString;
|
|
1515
|
-
base: z.ZodString;
|
|
1516
|
-
chain: z.ZodString;
|
|
1517
|
-
}, z.core.$strip>>;
|
|
1518
|
-
}, z.core.$strip>>;
|
|
1519
|
-
project: z.ZodOptional<z.ZodObject<{
|
|
1520
|
-
build: z.ZodString;
|
|
1521
|
-
seq: z.ZodNumber;
|
|
1522
|
-
}, z.core.$strip>>;
|
|
1523
|
-
}, z.core.$strip>;
|
|
1524
|
-
}, z.core.$strip>]>;
|
|
1525
|
-
};
|
|
1526
|
-
};
|
|
1527
1550
|
/**
|
|
1528
1551
|
* One module by version: phase 6 of `docs/plans/one-content-model.md`
|
|
1529
1552
|
* ("The Studio loads everything from one place"). `GET /modules/~<path>`,
|
|
@@ -42,6 +42,12 @@ export type ElementPickerOptions = {
|
|
|
42
42
|
modifier: PickModifier;
|
|
43
43
|
/** On without the modifier: a Select button, or a touch screen. */
|
|
44
44
|
active: () => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Only what shows a Val field can be picked: the field's element is taken
|
|
47
|
+
* for anything inside it, and nothing outside one is. The Studio's
|
|
48
|
+
* assistant outside code mode, where what can be changed is content.
|
|
49
|
+
*/
|
|
50
|
+
fieldsOnly?: () => boolean;
|
|
45
51
|
/** The element under the pointer while picking; `null` when not picking. */
|
|
46
52
|
onHover: (element: Element | null) => void;
|
|
47
53
|
onPick: (element: Element) => void;
|
|
@@ -88,6 +94,8 @@ export type ElementPicking = {
|
|
|
88
94
|
export declare function startElementPicking(root: HTMLElement, options: {
|
|
89
95
|
modifier: PickModifier;
|
|
90
96
|
active: () => boolean;
|
|
97
|
+
/** See `ElementPickerOptions.fieldsOnly`. */
|
|
98
|
+
fieldsOnly?: () => boolean;
|
|
91
99
|
color: string;
|
|
92
100
|
onPick: (picked: PickedElement) => void;
|
|
93
101
|
/** Esc while `active`: the Studio turns Select off. */
|
|
@@ -211,6 +211,13 @@ export type ValCanvasPageMessage = {
|
|
|
211
211
|
*/
|
|
212
212
|
val: typeof VAL_CANVAS_MESSAGE;
|
|
213
213
|
type: "elementPickingStopped";
|
|
214
|
+
} | {
|
|
215
|
+
/**
|
|
216
|
+
* Esc on the page while picking FIELDS (`setPicking`): Content's Select
|
|
217
|
+
* turns off. Its twin for any element is `elementPickingStopped`.
|
|
218
|
+
*/
|
|
219
|
+
val: typeof VAL_CANVAS_MESSAGE;
|
|
220
|
+
type: "pickingStopped";
|
|
214
221
|
} | ({
|
|
215
222
|
/**
|
|
216
223
|
* Where the page is: its path and scroll, as it moves. A new build
|
|
@@ -275,20 +282,12 @@ export type ValCanvasStudioMessage = {
|
|
|
275
282
|
type: "sourceUpdate";
|
|
276
283
|
moduleFilePath: ModuleFilePath;
|
|
277
284
|
/**
|
|
278
|
-
* The
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* of the release before. Goes in the release after the one that ships
|
|
283
|
-
* `read`, with the bridges' fallback that reads it: see
|
|
284
|
-
* "Release-delayed deletions" in `docs/plans/one-content-model.md`.
|
|
285
|
+
* The module as a read (`ModuleRead`: its source and version), which
|
|
286
|
+
* the page keeps as it is. `unknown` because the page's own types are
|
|
287
|
+
* the ones that give it meaning; nothing in between should be
|
|
288
|
+
* interpreting it.
|
|
285
289
|
*/
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The same module as a read (`ModuleRead`), which the page keeps as it
|
|
289
|
-
* is. Optional: a Studio from the release before sends `source` alone.
|
|
290
|
-
*/
|
|
291
|
-
read?: unknown;
|
|
290
|
+
read: unknown;
|
|
292
291
|
} | {
|
|
293
292
|
/**
|
|
294
293
|
* Everything the studio holds has been sent.
|
|
@@ -374,6 +373,17 @@ export type ValCanvasStudioMessage = {
|
|
|
374
373
|
modifier: PickModifier;
|
|
375
374
|
/** Whether the studio still holds the last pick: false takes its outline down. */
|
|
376
375
|
keepPicked: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* Only Val's fields can be picked (`fieldsOnly` in `elementPicker.ts`):
|
|
378
|
+
* the Studio's assistant outside code mode. Absent is any element, so
|
|
379
|
+
* a studio that predates it is answered as before.
|
|
380
|
+
*/
|
|
381
|
+
fieldsOnly?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* What to outline in, instead of the `theme`'s selection colour: code
|
|
384
|
+
* mode's proposal colour. A bridge that predates it uses the theme's.
|
|
385
|
+
*/
|
|
386
|
+
color?: string;
|
|
377
387
|
} | {
|
|
378
388
|
/** Scroll to where the page before this one was (`location`). */
|
|
379
389
|
val: typeof VAL_CANVAS_MESSAGE;
|
|
@@ -414,6 +424,7 @@ export type ValCanvasStudioMessage = {
|
|
|
414
424
|
};
|
|
415
425
|
/** Narrow an unknown `event.data` to a message from the page. */
|
|
416
426
|
export declare function isValCanvasPageMessage(data: unknown): data is ValCanvasPageMessage;
|
|
427
|
+
export declare function isCanvasSelectionColor(value: unknown): value is string;
|
|
417
428
|
/** Narrow an unknown `event.data` to a message from the studio. */
|
|
418
429
|
export declare function isValCanvasStudioMessage(data: unknown): data is ValCanvasStudioMessage;
|
|
419
430
|
/**
|
|
@@ -16,7 +16,12 @@ export type StudioBuilder = {
|
|
|
16
16
|
publishArtifacts: Builder["publishArtifacts"];
|
|
17
17
|
/** A build's name, before building it: see `buildInputId`. */
|
|
18
18
|
buildInputId: Builder["buildInputId"];
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A tree's Val modules, as one module to evaluate: see `bundleValModules`.
|
|
21
|
+
* The Studio evaluates the code and nothing else; what each module depends
|
|
22
|
+
* on is for the server build (`moduleDependencies`), so it is not asked of
|
|
23
|
+
* the builder here.
|
|
24
|
+
*/
|
|
25
|
+
bundleValModules: (...args: Parameters<Builder["bundleValModules"]>) => Promise<Pick<Awaited<ReturnType<Builder["bundleValModules"]>>, "code">>;
|
|
21
26
|
};
|
|
22
27
|
export {};
|
|
@@ -250,7 +250,7 @@ function isValCanvasPageMessage(data) {
|
|
|
250
250
|
if (createForOfIteratorHelper._typeof(data) !== "object" || data === null) return false;
|
|
251
251
|
var message = data;
|
|
252
252
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
253
|
-
return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
|
|
253
|
+
return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/** `holdsVersions` on `ready`: absent, or a version per module path. */
|
|
@@ -313,7 +313,7 @@ function isValCanvasStudioMessage(data) {
|
|
|
313
313
|
}
|
|
314
314
|
if (message.type === "pickElements") {
|
|
315
315
|
var pick = data;
|
|
316
|
-
return typeof pick.enabled === "boolean" && typeof pick.active === "boolean" && typeof pick.keepPicked === "boolean" && PICK_MODIFIERS.includes(pick.modifier);
|
|
316
|
+
return typeof pick.enabled === "boolean" && typeof pick.active === "boolean" && typeof pick.keepPicked === "boolean" && PICK_MODIFIERS.includes(pick.modifier) && (pick.fieldsOnly === undefined || typeof pick.fieldsOnly === "boolean") && (pick.color === undefined || isCanvasSelectionColor(pick.color));
|
|
317
317
|
}
|
|
318
318
|
if (message.type === "scrollTo") {
|
|
319
319
|
var scroll = data;
|
|
@@ -471,8 +471,15 @@ function attachElementPicker(root, options) {
|
|
|
471
471
|
var picking = function picking(event) {
|
|
472
472
|
return options.active() || held(event, options.modifier);
|
|
473
473
|
};
|
|
474
|
+
var pickable = function pickable(element) {
|
|
475
|
+
var _options$fieldsOnly;
|
|
476
|
+
if (element === null || !root.contains(element)) return null;
|
|
477
|
+
if (((_options$fieldsOnly = options.fieldsOnly) === null || _options$fieldsOnly === void 0 ? void 0 : _options$fieldsOnly.call(options)) !== true) return element;
|
|
478
|
+
var field = element.closest("[data-val-path]");
|
|
479
|
+
return field !== null && root.contains(field) ? field : null;
|
|
480
|
+
};
|
|
474
481
|
var target = function target(event) {
|
|
475
|
-
return event.target instanceof Element
|
|
482
|
+
return pickable(event.target instanceof Element ? event.target : null);
|
|
476
483
|
};
|
|
477
484
|
var onMove = function onMove(event) {
|
|
478
485
|
last = {
|
|
@@ -533,8 +540,7 @@ function attachElementPicker(root, options) {
|
|
|
533
540
|
return;
|
|
534
541
|
}
|
|
535
542
|
if (last === null) return;
|
|
536
|
-
|
|
537
|
-
options.onHover(under !== null && root.contains(under) ? under : null);
|
|
543
|
+
options.onHover(pickable(root.ownerDocument.elementFromPoint(last.x, last.y)));
|
|
538
544
|
};
|
|
539
545
|
var onLeave = function onLeave() {
|
|
540
546
|
last = null;
|
|
@@ -636,7 +642,9 @@ function createPickerOverlay(doc, initialColor) {
|
|
|
636
642
|
left: "".concat(rect.left - 2, "px"),
|
|
637
643
|
width: "".concat(rect.width + 4, "px"),
|
|
638
644
|
height: "".concat(rect.height + 4, "px"),
|
|
639
|
-
|
|
645
|
+
// Dashed, both: it is what the assistant is pointed at, and the
|
|
646
|
+
// canvas's own field outlines -- Content's Select -- are solid.
|
|
647
|
+
border: "2px dashed ".concat(color)
|
|
640
648
|
});
|
|
641
649
|
if (kind === "hover") {
|
|
642
650
|
label.textContent = elementLabel(element);
|
|
@@ -707,6 +715,7 @@ function startElementPicking(root, options) {
|
|
|
707
715
|
var detach = attachElementPicker(root, {
|
|
708
716
|
modifier: options.modifier,
|
|
709
717
|
active: options.active,
|
|
718
|
+
fieldsOnly: options.fieldsOnly,
|
|
710
719
|
onHover: function onHover(element) {
|
|
711
720
|
return overlay.show("hover", element);
|
|
712
721
|
},
|
|
@@ -1478,6 +1487,7 @@ exports.getPageRouterSitemapTree = getPageRouterSitemapTree;
|
|
|
1478
1487
|
exports.getPageRouterSourceFolder = getPageRouterSourceFolder;
|
|
1479
1488
|
exports.getPatternFromModuleFilePath = getPatternFromModuleFilePath;
|
|
1480
1489
|
exports.getTanStackRouterSourceFolder = getTanStackRouterSourceFolder;
|
|
1490
|
+
exports.isCanvasSelectionColor = isCanvasSelectionColor;
|
|
1481
1491
|
exports.isQuickPreviewFiles = isQuickPreviewFiles;
|
|
1482
1492
|
exports.isTanStackRoutesFolder = isTanStackRoutesFolder;
|
|
1483
1493
|
exports.isValCanvasFrame = isValCanvasFrame;
|
|
@@ -250,7 +250,7 @@ function isValCanvasPageMessage(data) {
|
|
|
250
250
|
if (createForOfIteratorHelper._typeof(data) !== "object" || data === null) return false;
|
|
251
251
|
var message = data;
|
|
252
252
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
253
|
-
return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
|
|
253
|
+
return message.type === "ready" && isModulePathList(data.holds) && isHeldVersions(data.holdsVersions) || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "pickingStopped" || message.type === "elementPicked" && isPickedElement(data.element) || message.type === "location" && isPageLocation(data) || message.type === "pageRead" && typeof data.requestId === "string" || message.type === "pageScreenshot" && typeof data.requestId === "string" || message.type === "quickPreviewStored" && typeof data.id === "string";
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/** `holdsVersions` on `ready`: absent, or a version per module path. */
|
|
@@ -313,7 +313,7 @@ function isValCanvasStudioMessage(data) {
|
|
|
313
313
|
}
|
|
314
314
|
if (message.type === "pickElements") {
|
|
315
315
|
var pick = data;
|
|
316
|
-
return typeof pick.enabled === "boolean" && typeof pick.active === "boolean" && typeof pick.keepPicked === "boolean" && PICK_MODIFIERS.includes(pick.modifier);
|
|
316
|
+
return typeof pick.enabled === "boolean" && typeof pick.active === "boolean" && typeof pick.keepPicked === "boolean" && PICK_MODIFIERS.includes(pick.modifier) && (pick.fieldsOnly === undefined || typeof pick.fieldsOnly === "boolean") && (pick.color === undefined || isCanvasSelectionColor(pick.color));
|
|
317
317
|
}
|
|
318
318
|
if (message.type === "scrollTo") {
|
|
319
319
|
var scroll = data;
|
|
@@ -471,8 +471,15 @@ function attachElementPicker(root, options) {
|
|
|
471
471
|
var picking = function picking(event) {
|
|
472
472
|
return options.active() || held(event, options.modifier);
|
|
473
473
|
};
|
|
474
|
+
var pickable = function pickable(element) {
|
|
475
|
+
var _options$fieldsOnly;
|
|
476
|
+
if (element === null || !root.contains(element)) return null;
|
|
477
|
+
if (((_options$fieldsOnly = options.fieldsOnly) === null || _options$fieldsOnly === void 0 ? void 0 : _options$fieldsOnly.call(options)) !== true) return element;
|
|
478
|
+
var field = element.closest("[data-val-path]");
|
|
479
|
+
return field !== null && root.contains(field) ? field : null;
|
|
480
|
+
};
|
|
474
481
|
var target = function target(event) {
|
|
475
|
-
return event.target instanceof Element
|
|
482
|
+
return pickable(event.target instanceof Element ? event.target : null);
|
|
476
483
|
};
|
|
477
484
|
var onMove = function onMove(event) {
|
|
478
485
|
last = {
|
|
@@ -533,8 +540,7 @@ function attachElementPicker(root, options) {
|
|
|
533
540
|
return;
|
|
534
541
|
}
|
|
535
542
|
if (last === null) return;
|
|
536
|
-
|
|
537
|
-
options.onHover(under !== null && root.contains(under) ? under : null);
|
|
543
|
+
options.onHover(pickable(root.ownerDocument.elementFromPoint(last.x, last.y)));
|
|
538
544
|
};
|
|
539
545
|
var onLeave = function onLeave() {
|
|
540
546
|
last = null;
|
|
@@ -636,7 +642,9 @@ function createPickerOverlay(doc, initialColor) {
|
|
|
636
642
|
left: "".concat(rect.left - 2, "px"),
|
|
637
643
|
width: "".concat(rect.width + 4, "px"),
|
|
638
644
|
height: "".concat(rect.height + 4, "px"),
|
|
639
|
-
|
|
645
|
+
// Dashed, both: it is what the assistant is pointed at, and the
|
|
646
|
+
// canvas's own field outlines -- Content's Select -- are solid.
|
|
647
|
+
border: "2px dashed ".concat(color)
|
|
640
648
|
});
|
|
641
649
|
if (kind === "hover") {
|
|
642
650
|
label.textContent = elementLabel(element);
|
|
@@ -707,6 +715,7 @@ function startElementPicking(root, options) {
|
|
|
707
715
|
var detach = attachElementPicker(root, {
|
|
708
716
|
modifier: options.modifier,
|
|
709
717
|
active: options.active,
|
|
718
|
+
fieldsOnly: options.fieldsOnly,
|
|
710
719
|
onHover: function onHover(element) {
|
|
711
720
|
return overlay.show("hover", element);
|
|
712
721
|
},
|
|
@@ -1478,6 +1487,7 @@ exports.getPageRouterSitemapTree = getPageRouterSitemapTree;
|
|
|
1478
1487
|
exports.getPageRouterSourceFolder = getPageRouterSourceFolder;
|
|
1479
1488
|
exports.getPatternFromModuleFilePath = getPatternFromModuleFilePath;
|
|
1480
1489
|
exports.getTanStackRouterSourceFolder = getTanStackRouterSourceFolder;
|
|
1490
|
+
exports.isCanvasSelectionColor = isCanvasSelectionColor;
|
|
1481
1491
|
exports.isQuickPreviewFiles = isQuickPreviewFiles;
|
|
1482
1492
|
exports.isTanStackRoutesFolder = isTanStackRoutesFolder;
|
|
1483
1493
|
exports.isValCanvasFrame = isValCanvasFrame;
|