@valbuild/next 0.152.2 → 0.153.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/client/dist/valbuild-next-client.cjs.dev.js +19 -8
- package/client/dist/valbuild-next-client.cjs.prod.js +19 -8
- package/client/dist/valbuild-next-client.esm.js +19 -8
- package/dist/ValCanvasBridge-50bf5366.cjs.js +7 -0
- package/dist/{ValCanvasBridge-4166883a.cjs.prod.js → ValCanvasBridge-50bf5366.cjs.prod.js} +64 -11
- package/dist/{ValCanvasBridge-ce35f123.esm.js → ValCanvasBridge-cf8d7967.esm.js} +65 -12
- package/dist/{ValCanvasBridge-847e3386.cjs.dev.js → ValCanvasBridge-fc46ab88.cjs.dev.js} +64 -11
- package/dist/ValNextProvider-06854ec0.cjs.js +7 -0
- package/dist/{ValNextProvider-41d622a7.cjs.prod.js → ValNextProvider-06854ec0.cjs.prod.js} +61 -46
- package/dist/{ValNextProvider-4b9bcfc0.cjs.dev.js → ValNextProvider-5e29689e.cjs.dev.js} +61 -46
- package/dist/{ValNextProvider-745ed99e.esm.js → ValNextProvider-b4eae85e.esm.js} +62 -47
- package/dist/{ValOverlayContext-0c29b6a7.cjs.dev.js → ValOverlayContext-14456a44.cjs.dev.js} +2 -0
- package/dist/{ValOverlayContext-178db68e.esm.js → ValOverlayContext-51716662.esm.js} +2 -0
- package/dist/ValOverlayContext-eb6ccc22.cjs.js +7 -0
- package/dist/{ValOverlayContext-0f51d111.cjs.prod.js → ValOverlayContext-eb6ccc22.cjs.prod.js} +2 -0
- package/dist/declarations/src/client/initValClient.d.ts +6 -1
- package/dist/valbuild-next.cjs.dev.js +2 -2
- package/dist/valbuild-next.cjs.prod.js +2 -2
- package/dist/valbuild-next.esm.js +2 -2
- package/dist/{version-3b636b47.cjs.dev.js → version-06b3915f.cjs.prod.js} +1 -1
- package/dist/{version-d15c3a29.esm.js → version-385973cb.esm.js} +1 -1
- package/dist/{version-0628bae1.cjs.prod.js → version-e4111887.cjs.dev.js} +1 -1
- package/package.json +8 -8
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +3 -2
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +3 -2
- package/rsc/dist/valbuild-next-rsc.esm.js +3 -2
- package/server/dist/valbuild-next-server.cjs.dev.js +1 -1
- package/server/dist/valbuild-next-server.cjs.prod.js +1 -1
- package/server/dist/valbuild-next-server.esm.js +1 -1
- package/dist/ValCanvasBridge-4166883a.cjs.js +0 -7
- package/dist/ValNextProvider-41d622a7.cjs.js +0 -7
- package/dist/ValOverlayContext-0f51d111.cjs.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @valbuild/next
|
|
2
2
|
|
|
3
|
+
## 0.153.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1031](https://github.com/valbuild/val/pull/1031) [`6ec1a5d`](https://github.com/valbuild/val/commit/6ec1a5d244f0d6e064eca4135f167dfa79744f9a) Thanks [@freekh](https://github.com/freekh)! - A page no longer shows content made for code it does not have yet. When the Studio is ahead of the page (it picked up a code change first, or the browser is still running the previous build), the page keeps showing its own content for the modules whose schema changed, and says "The code changed" with a **Reload** button — in the overlay on your site, and above the page in the Studio. In local development the page usually catches up a moment later by itself, and the notice goes away without a reload.
|
|
8
|
+
- Updated dependencies [[`6ec1a5d`](https://github.com/valbuild/val/commit/6ec1a5d244f0d6e064eca4135f167dfa79744f9a), [`f1048d9`](https://github.com/valbuild/val/commit/f1048d93a76138d031b30d059c444a8f754b484d), [`b14870b`](https://github.com/valbuild/val/commit/b14870bebdc128234bb16e4ea06a0151d18c4771)]:
|
|
9
|
+
- @valbuild/react@0.153.1
|
|
10
|
+
- @valbuild/shared@0.153.1
|
|
11
|
+
- @valbuild/ui@0.153.1
|
|
12
|
+
- @valbuild/server@0.153.1
|
|
13
|
+
- @valbuild/language-server@0.153.1
|
|
14
|
+
- @valbuild/mcp@0.153.1
|
|
15
|
+
|
|
16
|
+
## 0.153.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [#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:
|
|
21
|
+
|
|
22
|
+
- **`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.
|
|
23
|
+
- **`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.
|
|
24
|
+
- **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.
|
|
25
|
+
- **`/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.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - `/api/val/enable`, `/api/val/disable` and Val's other routes that take `redirect_to` now accept a path on your site, such as `?redirect_to=/blog`, and redirect to it on the same origin. In a Next.js app a path used to answer 500. A value that is neither a path starting with `/` nor an absolute URL is refused with a 400 that says what is accepted.
|
|
30
|
+
|
|
31
|
+
- [#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.
|
|
32
|
+
|
|
33
|
+
- 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.
|
|
34
|
+
- On a desktop the assistant now sits beside the preview instead of over it, so it never covers what you point it at.
|
|
35
|
+
- The assistant can read the page in the preview, and take a picture of it, to see what you see.
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`56ab7d5`](https://github.com/valbuild/val/commit/56ab7d5818772a9e310a561ebdb798b27ee704c9)]:
|
|
38
|
+
- @valbuild/ui@0.153.0
|
|
39
|
+
- @valbuild/core@0.153.0
|
|
40
|
+
- @valbuild/server@0.153.0
|
|
41
|
+
- @valbuild/shared@0.153.0
|
|
42
|
+
- @valbuild/react@0.153.0
|
|
43
|
+
- @valbuild/language-server@0.153.0
|
|
44
|
+
- @valbuild/mcp@0.153.0
|
|
45
|
+
|
|
3
46
|
## 0.152.2
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('client-only');
|
|
6
|
+
var objectSpread2 = require('../../dist/objectSpread2-58726b14.cjs.dev.js');
|
|
6
7
|
var core = require('@valbuild/core');
|
|
7
8
|
var internal = require('@valbuild/react/internal');
|
|
9
|
+
var internal$1 = require('@valbuild/shared/internal');
|
|
8
10
|
var React = require('react');
|
|
9
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
11
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-14456a44.cjs.dev.js');
|
|
10
12
|
var useHydrated = require('../../dist/useHydrated-ff733777.cjs.dev.js');
|
|
11
13
|
var routeFromVal = require('../../dist/routeFromVal-a1e0a8be.cjs.dev.js');
|
|
12
14
|
require('../../dist/createForOfIteratorHelper-9c6aa3c7.cjs.dev.js');
|
|
13
15
|
require('../../dist/unsupportedIterableToArray-20a9209f.cjs.dev.js');
|
|
14
|
-
require('../../dist/objectSpread2-58726b14.cjs.dev.js');
|
|
15
16
|
require('../../dist/slicedToArray-ed812733.cjs.dev.js');
|
|
16
17
|
require('@valbuild/shared/client');
|
|
17
18
|
|
|
@@ -51,15 +52,23 @@ function useEncodesEditTags(context) {
|
|
|
51
52
|
function pageReadEnv(state) {
|
|
52
53
|
var _state$draftSourcesSy;
|
|
53
54
|
var encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !!state.draftMode;
|
|
54
|
-
return {
|
|
55
|
+
return objectSpread2._objectSpread2({
|
|
55
56
|
sources: [internal.overlaySource(state.store, {
|
|
56
57
|
draftMode: state.draftMode,
|
|
57
58
|
suspend: state.suspend,
|
|
58
59
|
draftModeReady: state.draftModeReady,
|
|
59
60
|
synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
|
|
60
61
|
})],
|
|
61
|
-
encode: encode
|
|
62
|
-
|
|
62
|
+
encode: encode,
|
|
63
|
+
// The rule the server readers apply: a module the Studio relays made with
|
|
64
|
+
// another schema than this page's code has is not read with it. A Studio
|
|
65
|
+
// ahead of this build (hot reload first, or staged code it evaluated)
|
|
66
|
+
// sends content for code this page does not run; the page keeps its
|
|
67
|
+
// bundle's, and says the code changed (`schemaChecked`).
|
|
68
|
+
schemaVersionOf: internal$1.readerSchemaVersion
|
|
69
|
+
}, state.schemaChecked !== undefined ? {
|
|
70
|
+
schemaChecked: state.schemaChecked
|
|
71
|
+
} : {});
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
/**
|
|
@@ -73,16 +82,18 @@ function useReadEnv() {
|
|
|
73
82
|
draftMode = context.draftMode,
|
|
74
83
|
suspend = context.suspend,
|
|
75
84
|
draftModeReady = context.draftModeReady,
|
|
76
|
-
draftSourcesSynced = context.draftSourcesSynced
|
|
85
|
+
draftSourcesSynced = context.draftSourcesSynced,
|
|
86
|
+
schemaChecked = context.schemaChecked;
|
|
77
87
|
return React__default["default"].useMemo(function () {
|
|
78
88
|
return pageReadEnv({
|
|
79
89
|
store: store,
|
|
80
90
|
draftMode: draftMode,
|
|
81
91
|
suspend: suspend,
|
|
82
92
|
draftModeReady: draftModeReady,
|
|
83
|
-
draftSourcesSynced: draftSourcesSynced
|
|
93
|
+
draftSourcesSynced: draftSourcesSynced,
|
|
94
|
+
schemaChecked: schemaChecked
|
|
84
95
|
}, encode);
|
|
85
|
-
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, encode]);
|
|
96
|
+
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, encode]);
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('client-only');
|
|
6
|
+
var objectSpread2 = require('../../dist/objectSpread2-469273e9.cjs.prod.js');
|
|
6
7
|
var core = require('@valbuild/core');
|
|
7
8
|
var internal = require('@valbuild/react/internal');
|
|
9
|
+
var internal$1 = require('@valbuild/shared/internal');
|
|
8
10
|
var React = require('react');
|
|
9
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
11
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-eb6ccc22.cjs.prod.js');
|
|
10
12
|
var useHydrated = require('../../dist/useHydrated-8e90c7fa.cjs.prod.js');
|
|
11
13
|
var routeFromVal = require('../../dist/routeFromVal-c4dace91.cjs.prod.js');
|
|
12
14
|
require('../../dist/createForOfIteratorHelper-8459fbc7.cjs.prod.js');
|
|
13
15
|
require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
|
|
14
|
-
require('../../dist/objectSpread2-469273e9.cjs.prod.js');
|
|
15
16
|
require('../../dist/slicedToArray-0fc63719.cjs.prod.js');
|
|
16
17
|
require('@valbuild/shared/client');
|
|
17
18
|
|
|
@@ -51,15 +52,23 @@ function useEncodesEditTags(context) {
|
|
|
51
52
|
function pageReadEnv(state) {
|
|
52
53
|
var _state$draftSourcesSy;
|
|
53
54
|
var encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !!state.draftMode;
|
|
54
|
-
return {
|
|
55
|
+
return objectSpread2._objectSpread2({
|
|
55
56
|
sources: [internal.overlaySource(state.store, {
|
|
56
57
|
draftMode: state.draftMode,
|
|
57
58
|
suspend: state.suspend,
|
|
58
59
|
draftModeReady: state.draftModeReady,
|
|
59
60
|
synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
|
|
60
61
|
})],
|
|
61
|
-
encode: encode
|
|
62
|
-
|
|
62
|
+
encode: encode,
|
|
63
|
+
// The rule the server readers apply: a module the Studio relays made with
|
|
64
|
+
// another schema than this page's code has is not read with it. A Studio
|
|
65
|
+
// ahead of this build (hot reload first, or staged code it evaluated)
|
|
66
|
+
// sends content for code this page does not run; the page keeps its
|
|
67
|
+
// bundle's, and says the code changed (`schemaChecked`).
|
|
68
|
+
schemaVersionOf: internal$1.readerSchemaVersion
|
|
69
|
+
}, state.schemaChecked !== undefined ? {
|
|
70
|
+
schemaChecked: state.schemaChecked
|
|
71
|
+
} : {});
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
/**
|
|
@@ -73,16 +82,18 @@ function useReadEnv() {
|
|
|
73
82
|
draftMode = context.draftMode,
|
|
74
83
|
suspend = context.suspend,
|
|
75
84
|
draftModeReady = context.draftModeReady,
|
|
76
|
-
draftSourcesSynced = context.draftSourcesSynced
|
|
85
|
+
draftSourcesSynced = context.draftSourcesSynced,
|
|
86
|
+
schemaChecked = context.schemaChecked;
|
|
77
87
|
return React__default["default"].useMemo(function () {
|
|
78
88
|
return pageReadEnv({
|
|
79
89
|
store: store,
|
|
80
90
|
draftMode: draftMode,
|
|
81
91
|
suspend: suspend,
|
|
82
92
|
draftModeReady: draftModeReady,
|
|
83
|
-
draftSourcesSynced: draftSourcesSynced
|
|
93
|
+
draftSourcesSynced: draftSourcesSynced,
|
|
94
|
+
schemaChecked: schemaChecked
|
|
84
95
|
}, encode);
|
|
85
|
-
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, encode]);
|
|
96
|
+
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, encode]);
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import 'client-only';
|
|
2
|
+
import { _ as _objectSpread2 } from '../../dist/objectSpread2-f1f0d77a.esm.js';
|
|
2
3
|
import { Internal } from '@valbuild/core';
|
|
3
4
|
import { useResolvedVal, useResolvedEntry, useResolved, isJsonValuesRecordSchema, mapResolution, resolveModuleEntry, resolveVal, overlaySource } from '@valbuild/react/internal';
|
|
5
|
+
import { readerSchemaVersion } from '@valbuild/shared/internal';
|
|
4
6
|
import React from 'react';
|
|
5
|
-
import { useValOverlayContext } from '../../dist/ValOverlayContext-
|
|
7
|
+
import { useValOverlayContext } from '../../dist/ValOverlayContext-51716662.esm.js';
|
|
6
8
|
import { useHydrated } from '../../dist/useHydrated-afcdbb66.esm.js';
|
|
7
9
|
import { g as getValRouteUrlFromVal, i as initValRouteFromVal } from '../../dist/routeFromVal-80976677.esm.js';
|
|
8
10
|
import '../../dist/createForOfIteratorHelper-9209e9dd.esm.js';
|
|
9
11
|
import '../../dist/unsupportedIterableToArray-f57eb659.esm.js';
|
|
10
|
-
import '../../dist/objectSpread2-f1f0d77a.esm.js';
|
|
11
12
|
import '../../dist/slicedToArray-5ff32315.esm.js';
|
|
12
13
|
import '@valbuild/shared/client';
|
|
13
14
|
|
|
@@ -43,15 +44,23 @@ function useEncodesEditTags(context) {
|
|
|
43
44
|
function pageReadEnv(state) {
|
|
44
45
|
var _state$draftSourcesSy;
|
|
45
46
|
var encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !!state.draftMode;
|
|
46
|
-
return {
|
|
47
|
+
return _objectSpread2({
|
|
47
48
|
sources: [overlaySource(state.store, {
|
|
48
49
|
draftMode: state.draftMode,
|
|
49
50
|
suspend: state.suspend,
|
|
50
51
|
draftModeReady: state.draftModeReady,
|
|
51
52
|
synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
|
|
52
53
|
})],
|
|
53
|
-
encode: encode
|
|
54
|
-
|
|
54
|
+
encode: encode,
|
|
55
|
+
// The rule the server readers apply: a module the Studio relays made with
|
|
56
|
+
// another schema than this page's code has is not read with it. A Studio
|
|
57
|
+
// ahead of this build (hot reload first, or staged code it evaluated)
|
|
58
|
+
// sends content for code this page does not run; the page keeps its
|
|
59
|
+
// bundle's, and says the code changed (`schemaChecked`).
|
|
60
|
+
schemaVersionOf: readerSchemaVersion
|
|
61
|
+
}, state.schemaChecked !== undefined ? {
|
|
62
|
+
schemaChecked: state.schemaChecked
|
|
63
|
+
} : {});
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
/**
|
|
@@ -65,16 +74,18 @@ function useReadEnv() {
|
|
|
65
74
|
draftMode = context.draftMode,
|
|
66
75
|
suspend = context.suspend,
|
|
67
76
|
draftModeReady = context.draftModeReady,
|
|
68
|
-
draftSourcesSynced = context.draftSourcesSynced
|
|
77
|
+
draftSourcesSynced = context.draftSourcesSynced,
|
|
78
|
+
schemaChecked = context.schemaChecked;
|
|
69
79
|
return React.useMemo(function () {
|
|
70
80
|
return pageReadEnv({
|
|
71
81
|
store: store,
|
|
72
82
|
draftMode: draftMode,
|
|
73
83
|
suspend: suspend,
|
|
74
84
|
draftModeReady: draftModeReady,
|
|
75
|
-
draftSourcesSynced: draftSourcesSynced
|
|
85
|
+
draftSourcesSynced: draftSourcesSynced,
|
|
86
|
+
schemaChecked: schemaChecked
|
|
76
87
|
}, encode);
|
|
77
|
-
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, encode]);
|
|
88
|
+
}, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, encode]);
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -58,11 +58,12 @@ var RESCAN_INTERVAL_MS = 5000;
|
|
|
58
58
|
* mounted there at all.
|
|
59
59
|
*/
|
|
60
60
|
function ValCanvasBridge(_ref) {
|
|
61
|
-
var _elementPicking$modif;
|
|
61
|
+
var _elementPicking$color, _elementPicking$modif;
|
|
62
62
|
var draftMode = _ref.draftMode,
|
|
63
63
|
isRefreshing = _ref.isRefreshing,
|
|
64
64
|
holds = _ref.holds,
|
|
65
|
-
holdsVersions = _ref.holdsVersions
|
|
65
|
+
holdsVersions = _ref.holdsVersions,
|
|
66
|
+
codeChanged = _ref.codeChanged;
|
|
66
67
|
var _React$useState = React__default["default"].useState(false),
|
|
67
68
|
_React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
|
|
68
69
|
picking = _React$useState2[0],
|
|
@@ -98,6 +99,8 @@ function ValCanvasBridge(_ref) {
|
|
|
98
99
|
setElementPicking = _React$useState8[1];
|
|
99
100
|
var elementPickingActive = React__default["default"].useRef(false);
|
|
100
101
|
elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
|
|
102
|
+
var elementPickingFieldsOnly = React__default["default"].useRef(false);
|
|
103
|
+
elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
|
|
101
104
|
var elementPicker = React__default["default"].useRef(null);
|
|
102
105
|
/** A scroll back to where the last build was, still trying. */
|
|
103
106
|
var stopRestoring = React__default["default"].useRef(null);
|
|
@@ -328,11 +331,14 @@ function ValCanvasBridge(_ref) {
|
|
|
328
331
|
return;
|
|
329
332
|
}
|
|
330
333
|
if (message.type === "pickElements") {
|
|
334
|
+
var _message$color;
|
|
331
335
|
setElementPicking({
|
|
332
336
|
enabled: message.enabled,
|
|
333
337
|
active: message.active,
|
|
334
338
|
modifier: message.modifier,
|
|
335
|
-
keepPicked: message.keepPicked
|
|
339
|
+
keepPicked: message.keepPicked,
|
|
340
|
+
fieldsOnly: message.fieldsOnly === true,
|
|
341
|
+
color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
|
|
336
342
|
});
|
|
337
343
|
return;
|
|
338
344
|
}
|
|
@@ -433,13 +439,11 @@ function ValCanvasBridge(_ref) {
|
|
|
433
439
|
* re-reads the server's own content is `confirmed`, below.)
|
|
434
440
|
*/
|
|
435
441
|
window.dispatchEvent(new CustomEvent("val-event", {
|
|
436
|
-
detail:
|
|
442
|
+
detail: {
|
|
437
443
|
type: "source-update",
|
|
438
444
|
moduleFilePath: message.moduleFilePath,
|
|
439
|
-
source: message.source
|
|
440
|
-
}, message.read !== undefined ? {
|
|
441
445
|
read: message.read
|
|
442
|
-
}
|
|
446
|
+
}
|
|
443
447
|
}));
|
|
444
448
|
return;
|
|
445
449
|
}
|
|
@@ -477,6 +481,34 @@ function ValCanvasBridge(_ref) {
|
|
|
477
481
|
};
|
|
478
482
|
}, [scan, post]);
|
|
479
483
|
|
|
484
|
+
// What the hooks could not read for its schema: the Studio says the code
|
|
485
|
+
// changed, with a reload. What was refused before the bridge mounted, then
|
|
486
|
+
// each change the page announces (`val-overlay-spa`, `codeChanged`).
|
|
487
|
+
React__default["default"].useEffect(function () {
|
|
488
|
+
var _codeChanged;
|
|
489
|
+
var already = (_codeChanged = codeChanged === null || codeChanged === void 0 ? void 0 : codeChanged()) !== null && _codeChanged !== void 0 ? _codeChanged : [];
|
|
490
|
+
if (already.length > 0) {
|
|
491
|
+
post({
|
|
492
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
493
|
+
type: "codeChanged",
|
|
494
|
+
modules: already
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
var listener = function listener(event) {
|
|
498
|
+
if (!(event instanceof CustomEvent)) return;
|
|
499
|
+
if (!client.isCodeChangedDetail(event.detail)) return;
|
|
500
|
+
post({
|
|
501
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
502
|
+
type: "codeChanged",
|
|
503
|
+
modules: event.detail.modules
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
window.addEventListener("val-overlay-spa", listener);
|
|
507
|
+
return function () {
|
|
508
|
+
return window.removeEventListener("val-overlay-spa", listener);
|
|
509
|
+
};
|
|
510
|
+
}, [codeChanged, post]);
|
|
511
|
+
|
|
480
512
|
// Where the page is, as it moves: a new build is opened there.
|
|
481
513
|
React__default["default"].useEffect(function () {
|
|
482
514
|
return client.watchPageLocation(window, function (location) {
|
|
@@ -521,14 +553,32 @@ function ValCanvasBridge(_ref) {
|
|
|
521
553
|
};
|
|
522
554
|
}, [post]);
|
|
523
555
|
|
|
556
|
+
// Esc while picking fields: the key goes to the page, which has the focus
|
|
557
|
+
// once it has been clicked, so the studio hears of it only from here.
|
|
558
|
+
React__default["default"].useEffect(function () {
|
|
559
|
+
var onKey = function onKey(event) {
|
|
560
|
+
if (event.key === "Escape" && pickingRef.current) {
|
|
561
|
+
post({
|
|
562
|
+
val: client.VAL_CANVAS_MESSAGE,
|
|
563
|
+
type: "pickingStopped"
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
window.addEventListener("keydown", onKey);
|
|
568
|
+
return function () {
|
|
569
|
+
return window.removeEventListener("keydown", onKey);
|
|
570
|
+
};
|
|
571
|
+
}, [post]);
|
|
572
|
+
|
|
524
573
|
/**
|
|
525
574
|
* Picking any element: the page's own elements, which
|
|
526
575
|
* only this side of the frame can reach. The listeners and the outlines are
|
|
527
576
|
* `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
|
|
528
577
|
* same picker; what crosses back is the element described.
|
|
529
578
|
*/
|
|
530
|
-
var
|
|
531
|
-
selectionColorRef
|
|
579
|
+
var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
|
|
580
|
+
var selectionColorRef = React__default["default"].useRef(pickColor);
|
|
581
|
+
selectionColorRef.current = pickColor;
|
|
532
582
|
var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
|
|
533
583
|
var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
|
|
534
584
|
React__default["default"].useEffect(function () {
|
|
@@ -538,6 +588,9 @@ function ValCanvasBridge(_ref) {
|
|
|
538
588
|
active: function active() {
|
|
539
589
|
return elementPickingActive.current;
|
|
540
590
|
},
|
|
591
|
+
fieldsOnly: function fieldsOnly() {
|
|
592
|
+
return elementPickingFieldsOnly.current;
|
|
593
|
+
},
|
|
541
594
|
color: selectionColorRef.current,
|
|
542
595
|
onPick: function onPick(element) {
|
|
543
596
|
return post({
|
|
@@ -566,8 +619,8 @@ function ValCanvasBridge(_ref) {
|
|
|
566
619
|
}, [keepPicked]);
|
|
567
620
|
React__default["default"].useEffect(function () {
|
|
568
621
|
var _elementPicker$curren2;
|
|
569
|
-
(_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(
|
|
570
|
-
}, [
|
|
622
|
+
(_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
|
|
623
|
+
}, [pickColor]);
|
|
571
624
|
|
|
572
625
|
/**
|
|
573
626
|
* Two-finger gestures, handed to the studio.
|
|
@@ -5,7 +5,7 @@ import { _ as _objectSpread2 } from './objectSpread2-f1f0d77a.esm.js';
|
|
|
5
5
|
import { _ as _slicedToArray } from './slicedToArray-5ff32315.esm.js';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { Internal } from '@valbuild/core';
|
|
8
|
-
import { VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, screenshotPage, readPageSnapshot } from '@valbuild/shared/client';
|
|
8
|
+
import { VAL_CANVAS_MESSAGE, watchPageLocation, startElementPicking, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, restoreScroll, storeQuickPreview, QUICK_PREVIEW_SERVICE_WORKER_PATH, isCodeChangedDetail, screenshotPage, readPageSnapshot } from '@valbuild/shared/client';
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
function _arrayWithoutHoles(r) {
|
|
@@ -50,11 +50,12 @@ var RESCAN_INTERVAL_MS = 5000;
|
|
|
50
50
|
* mounted there at all.
|
|
51
51
|
*/
|
|
52
52
|
function ValCanvasBridge(_ref) {
|
|
53
|
-
var _elementPicking$modif;
|
|
53
|
+
var _elementPicking$color, _elementPicking$modif;
|
|
54
54
|
var draftMode = _ref.draftMode,
|
|
55
55
|
isRefreshing = _ref.isRefreshing,
|
|
56
56
|
holds = _ref.holds,
|
|
57
|
-
holdsVersions = _ref.holdsVersions
|
|
57
|
+
holdsVersions = _ref.holdsVersions,
|
|
58
|
+
codeChanged = _ref.codeChanged;
|
|
58
59
|
var _React$useState = React.useState(false),
|
|
59
60
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
60
61
|
picking = _React$useState2[0],
|
|
@@ -90,6 +91,8 @@ function ValCanvasBridge(_ref) {
|
|
|
90
91
|
setElementPicking = _React$useState8[1];
|
|
91
92
|
var elementPickingActive = React.useRef(false);
|
|
92
93
|
elementPickingActive.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.active) === true;
|
|
94
|
+
var elementPickingFieldsOnly = React.useRef(false);
|
|
95
|
+
elementPickingFieldsOnly.current = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.fieldsOnly) === true;
|
|
93
96
|
var elementPicker = React.useRef(null);
|
|
94
97
|
/** A scroll back to where the last build was, still trying. */
|
|
95
98
|
var stopRestoring = React.useRef(null);
|
|
@@ -320,11 +323,14 @@ function ValCanvasBridge(_ref) {
|
|
|
320
323
|
return;
|
|
321
324
|
}
|
|
322
325
|
if (message.type === "pickElements") {
|
|
326
|
+
var _message$color;
|
|
323
327
|
setElementPicking({
|
|
324
328
|
enabled: message.enabled,
|
|
325
329
|
active: message.active,
|
|
326
330
|
modifier: message.modifier,
|
|
327
|
-
keepPicked: message.keepPicked
|
|
331
|
+
keepPicked: message.keepPicked,
|
|
332
|
+
fieldsOnly: message.fieldsOnly === true,
|
|
333
|
+
color: (_message$color = message.color) !== null && _message$color !== void 0 ? _message$color : null
|
|
328
334
|
});
|
|
329
335
|
return;
|
|
330
336
|
}
|
|
@@ -425,13 +431,11 @@ function ValCanvasBridge(_ref) {
|
|
|
425
431
|
* re-reads the server's own content is `confirmed`, below.)
|
|
426
432
|
*/
|
|
427
433
|
window.dispatchEvent(new CustomEvent("val-event", {
|
|
428
|
-
detail:
|
|
434
|
+
detail: {
|
|
429
435
|
type: "source-update",
|
|
430
436
|
moduleFilePath: message.moduleFilePath,
|
|
431
|
-
source: message.source
|
|
432
|
-
}, message.read !== undefined ? {
|
|
433
437
|
read: message.read
|
|
434
|
-
}
|
|
438
|
+
}
|
|
435
439
|
}));
|
|
436
440
|
return;
|
|
437
441
|
}
|
|
@@ -469,6 +473,34 @@ function ValCanvasBridge(_ref) {
|
|
|
469
473
|
};
|
|
470
474
|
}, [scan, post]);
|
|
471
475
|
|
|
476
|
+
// What the hooks could not read for its schema: the Studio says the code
|
|
477
|
+
// changed, with a reload. What was refused before the bridge mounted, then
|
|
478
|
+
// each change the page announces (`val-overlay-spa`, `codeChanged`).
|
|
479
|
+
React.useEffect(function () {
|
|
480
|
+
var _codeChanged;
|
|
481
|
+
var already = (_codeChanged = codeChanged === null || codeChanged === void 0 ? void 0 : codeChanged()) !== null && _codeChanged !== void 0 ? _codeChanged : [];
|
|
482
|
+
if (already.length > 0) {
|
|
483
|
+
post({
|
|
484
|
+
val: VAL_CANVAS_MESSAGE,
|
|
485
|
+
type: "codeChanged",
|
|
486
|
+
modules: already
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
var listener = function listener(event) {
|
|
490
|
+
if (!(event instanceof CustomEvent)) return;
|
|
491
|
+
if (!isCodeChangedDetail(event.detail)) return;
|
|
492
|
+
post({
|
|
493
|
+
val: VAL_CANVAS_MESSAGE,
|
|
494
|
+
type: "codeChanged",
|
|
495
|
+
modules: event.detail.modules
|
|
496
|
+
});
|
|
497
|
+
};
|
|
498
|
+
window.addEventListener("val-overlay-spa", listener);
|
|
499
|
+
return function () {
|
|
500
|
+
return window.removeEventListener("val-overlay-spa", listener);
|
|
501
|
+
};
|
|
502
|
+
}, [codeChanged, post]);
|
|
503
|
+
|
|
472
504
|
// Where the page is, as it moves: a new build is opened there.
|
|
473
505
|
React.useEffect(function () {
|
|
474
506
|
return watchPageLocation(window, function (location) {
|
|
@@ -513,14 +545,32 @@ function ValCanvasBridge(_ref) {
|
|
|
513
545
|
};
|
|
514
546
|
}, [post]);
|
|
515
547
|
|
|
548
|
+
// Esc while picking fields: the key goes to the page, which has the focus
|
|
549
|
+
// once it has been clicked, so the studio hears of it only from here.
|
|
550
|
+
React.useEffect(function () {
|
|
551
|
+
var onKey = function onKey(event) {
|
|
552
|
+
if (event.key === "Escape" && pickingRef.current) {
|
|
553
|
+
post({
|
|
554
|
+
val: VAL_CANVAS_MESSAGE,
|
|
555
|
+
type: "pickingStopped"
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
window.addEventListener("keydown", onKey);
|
|
560
|
+
return function () {
|
|
561
|
+
return window.removeEventListener("keydown", onKey);
|
|
562
|
+
};
|
|
563
|
+
}, [post]);
|
|
564
|
+
|
|
516
565
|
/**
|
|
517
566
|
* Picking any element: the page's own elements, which
|
|
518
567
|
* only this side of the frame can reach. The listeners and the outlines are
|
|
519
568
|
* `startElementPicking`'s (`@valbuild/shared`), so both bindings run the
|
|
520
569
|
* same picker; what crosses back is the element described.
|
|
521
570
|
*/
|
|
522
|
-
var
|
|
523
|
-
selectionColorRef
|
|
571
|
+
var pickColor = (_elementPicking$color = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.color) !== null && _elementPicking$color !== void 0 ? _elementPicking$color : selectionColors.selection;
|
|
572
|
+
var selectionColorRef = React.useRef(pickColor);
|
|
573
|
+
selectionColorRef.current = pickColor;
|
|
524
574
|
var pickingEnabled = (elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.enabled) === true;
|
|
525
575
|
var pickModifier = (_elementPicking$modif = elementPicking === null || elementPicking === void 0 ? void 0 : elementPicking.modifier) !== null && _elementPicking$modif !== void 0 ? _elementPicking$modif : "alt";
|
|
526
576
|
React.useEffect(function () {
|
|
@@ -530,6 +580,9 @@ function ValCanvasBridge(_ref) {
|
|
|
530
580
|
active: function active() {
|
|
531
581
|
return elementPickingActive.current;
|
|
532
582
|
},
|
|
583
|
+
fieldsOnly: function fieldsOnly() {
|
|
584
|
+
return elementPickingFieldsOnly.current;
|
|
585
|
+
},
|
|
533
586
|
color: selectionColorRef.current,
|
|
534
587
|
onPick: function onPick(element) {
|
|
535
588
|
return post({
|
|
@@ -558,8 +611,8 @@ function ValCanvasBridge(_ref) {
|
|
|
558
611
|
}, [keepPicked]);
|
|
559
612
|
React.useEffect(function () {
|
|
560
613
|
var _elementPicker$curren2;
|
|
561
|
-
(_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(
|
|
562
|
-
}, [
|
|
614
|
+
(_elementPicker$curren2 = elementPicker.current) === null || _elementPicker$curren2 === void 0 || _elementPicker$curren2.setColor(pickColor);
|
|
615
|
+
}, [pickColor]);
|
|
563
616
|
|
|
564
617
|
/**
|
|
565
618
|
* Two-finger gestures, handed to the studio.
|