@valbuild/tanstack 0.141.0 → 0.142.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 +24 -0
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +16 -4
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +16 -4
- package/client/dist/valbuild-tanstack-client.esm.js +16 -4
- package/dist/{ValOverlayContext-2739cc60.cjs.prod.js → ValOverlayContext-3e2c48a6.cjs.prod.js} +3 -1
- package/dist/{ValOverlayContext-bafe3de9.cjs.dev.js → ValOverlayContext-3f080cce.cjs.dev.js} +3 -1
- package/dist/{ValOverlayContext-28101df3.esm.js → ValOverlayContext-59a0b19f.esm.js} +3 -1
- package/dist/declarations/src/ValDraft.d.ts +13 -0
- package/dist/declarations/src/server/initValContent.d.ts +15 -5
- package/dist/declarations/src/server/initValServer.d.ts +9 -1
- package/dist/valbuild-tanstack.cjs.dev.js +15 -7
- package/dist/valbuild-tanstack.cjs.prod.js +15 -7
- package/dist/valbuild-tanstack.esm.js +15 -7
- package/dist/{version-af4e7357.esm.js → version-0588f50c.esm.js} +1 -1
- package/dist/{version-e0e05f48.cjs.dev.js → version-4ba1e52e.cjs.dev.js} +1 -1
- package/dist/{version-5157edce.cjs.prod.js → version-b550a2c2.cjs.prod.js} +1 -1
- package/package.json +7 -7
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +74 -53
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +74 -53
- package/server/dist/valbuild-tanstack-server.esm.js +75 -54
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.142.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#805](https://github.com/valbuild/val/pull/805) [`fa03698`](https://github.com/valbuild/val/commit/fa03698ef0f2c7a6df334b4ba0e41843bde60029) Thanks [@freekh](https://github.com/freekh)! - Groundwork for proposals on the Val platform: a server can be told it is running at a proposal's address (`proposal` in the http options, `proposalFromEnv` to read it from the platform). There, the content the proposal has saved replaces the bundled content for those modules on every read, edits go to the proposal's branch, and Save commits to the proposal instead of the site. Nothing changes for a site that is not given a proposal.
|
|
8
|
+
- Updated dependencies [[`1ec4ff4`](https://github.com/valbuild/val/commit/1ec4ff4165a33f2248b52608ff58e626523e4212), [`1671bce`](https://github.com/valbuild/val/commit/1671bce6f0b65dac77e51655f24ef825f4671ebb), [`bb63738`](https://github.com/valbuild/val/commit/bb63738aabed1cf1287611ecaab7c35fc4b08a12), [`fa03698`](https://github.com/valbuild/val/commit/fa03698ef0f2c7a6df334b4ba0e41843bde60029), [`3d2b9e8`](https://github.com/valbuild/val/commit/3d2b9e8c11aa6a4449527e2a1bbb363566797a14), [`a3236a5`](https://github.com/valbuild/val/commit/a3236a5f2c41b92422b40340dba060b53218c6ab), [`f14e0aa`](https://github.com/valbuild/val/commit/f14e0aabedba07b832b1453d49635af5d2fbc019), [`521fe94`](https://github.com/valbuild/val/commit/521fe9400c0b660aa5b3642942cd0cc26622f193)]:
|
|
9
|
+
- @valbuild/server@0.142.0
|
|
10
|
+
- @valbuild/ui@0.142.0
|
|
11
|
+
- @valbuild/shared@0.142.0
|
|
12
|
+
- @valbuild/language-server@0.142.0
|
|
13
|
+
- @valbuild/mcp@0.142.0
|
|
14
|
+
- @valbuild/react@0.142.0
|
|
15
|
+
|
|
16
|
+
## 0.141.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`6faacda`](https://github.com/valbuild/val/commit/6faacda398fc92bec187b7afe07a53228a6f2a3b), [`14b18d7`](https://github.com/valbuild/val/commit/14b18d7cb145cec1bc1cd832b9ca857ff4b45adc)]:
|
|
21
|
+
- @valbuild/ui@0.141.1
|
|
22
|
+
- @valbuild/server@0.141.1
|
|
23
|
+
- @valbuild/react@0.141.1
|
|
24
|
+
- @valbuild/language-server@0.141.1
|
|
25
|
+
- @valbuild/mcp@0.141.1
|
|
26
|
+
|
|
3
27
|
## 0.141.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -6,7 +6,7 @@ var routeFromVal = require('../../dist/routeFromVal-97111bfd.cjs.dev.js');
|
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var stega = require('@valbuild/react/stega');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
9
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-3f080cce.cjs.dev.js');
|
|
10
10
|
require('../../dist/createForOfIteratorHelper-4497beef.cjs.dev.js');
|
|
11
11
|
require('@valbuild/shared/client');
|
|
12
12
|
require('@valbuild/core/patch');
|
|
@@ -119,9 +119,15 @@ function useValStega(selector) {
|
|
|
119
119
|
return stega.stegaEncode(selector, {
|
|
120
120
|
disabled: !encodes,
|
|
121
121
|
getModule: function getModule(moduleId) {
|
|
122
|
+
var _valOverlayContext$sn;
|
|
122
123
|
if (moduleMap && valOverlayContext.draftMode) {
|
|
123
|
-
|
|
124
|
+
var draft = moduleMap[moduleId];
|
|
125
|
+
if (draft !== undefined) {
|
|
126
|
+
return draft;
|
|
127
|
+
}
|
|
124
128
|
}
|
|
129
|
+
// At a proposal's address: its saved Source, not the bundle's.
|
|
130
|
+
return (_valOverlayContext$sn = valOverlayContext.snapshot) === null || _valOverlayContext$sn === void 0 ? void 0 : _valOverlayContext$sn[moduleId];
|
|
125
131
|
}
|
|
126
132
|
});
|
|
127
133
|
}
|
|
@@ -136,6 +142,7 @@ function useValStega(selector) {
|
|
|
136
142
|
* correct in production, and stale the moment anyone edits in the Studio.
|
|
137
143
|
*/
|
|
138
144
|
function useDraftModuleSource(moduleFilePath) {
|
|
145
|
+
var _valOverlayContext$sn2, _moduleMap$moduleFile;
|
|
139
146
|
var valOverlayContext = ValOverlayContext.useValOverlayContext();
|
|
140
147
|
var store = valOverlayContext.store;
|
|
141
148
|
var moduleIds = React__default["default"].useMemo(function () {
|
|
@@ -148,10 +155,15 @@ function useDraftModuleSource(moduleFilePath) {
|
|
|
148
155
|
}, store ? store.getServerSnapshot(moduleIds) : function () {
|
|
149
156
|
return undefined;
|
|
150
157
|
});
|
|
151
|
-
if (!
|
|
158
|
+
if (!moduleFilePath) {
|
|
152
159
|
return undefined;
|
|
153
160
|
}
|
|
154
|
-
|
|
161
|
+
// A proposal's saved Source stands in for the bundle's, draft or not.
|
|
162
|
+
var snapshot = (_valOverlayContext$sn2 = valOverlayContext.snapshot) === null || _valOverlayContext$sn2 === void 0 ? void 0 : _valOverlayContext$sn2[moduleFilePath];
|
|
163
|
+
if (!valOverlayContext.draftMode) {
|
|
164
|
+
return snapshot;
|
|
165
|
+
}
|
|
166
|
+
return (_moduleMap$moduleFile = moduleMap === null || moduleMap === void 0 ? void 0 : moduleMap[moduleFilePath]) !== null && _moduleMap$moduleFile !== void 0 ? _moduleMap$moduleFile : snapshot;
|
|
155
167
|
}
|
|
156
168
|
|
|
157
169
|
/**
|
|
@@ -6,7 +6,7 @@ var routeFromVal = require('../../dist/routeFromVal-0b39e8e3.cjs.prod.js');
|
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var stega = require('@valbuild/react/stega');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
9
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-3e2c48a6.cjs.prod.js');
|
|
10
10
|
require('../../dist/createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
|
|
11
11
|
require('@valbuild/shared/client');
|
|
12
12
|
require('@valbuild/core/patch');
|
|
@@ -119,9 +119,15 @@ function useValStega(selector) {
|
|
|
119
119
|
return stega.stegaEncode(selector, {
|
|
120
120
|
disabled: !encodes,
|
|
121
121
|
getModule: function getModule(moduleId) {
|
|
122
|
+
var _valOverlayContext$sn;
|
|
122
123
|
if (moduleMap && valOverlayContext.draftMode) {
|
|
123
|
-
|
|
124
|
+
var draft = moduleMap[moduleId];
|
|
125
|
+
if (draft !== undefined) {
|
|
126
|
+
return draft;
|
|
127
|
+
}
|
|
124
128
|
}
|
|
129
|
+
// At a proposal's address: its saved Source, not the bundle's.
|
|
130
|
+
return (_valOverlayContext$sn = valOverlayContext.snapshot) === null || _valOverlayContext$sn === void 0 ? void 0 : _valOverlayContext$sn[moduleId];
|
|
125
131
|
}
|
|
126
132
|
});
|
|
127
133
|
}
|
|
@@ -136,6 +142,7 @@ function useValStega(selector) {
|
|
|
136
142
|
* correct in production, and stale the moment anyone edits in the Studio.
|
|
137
143
|
*/
|
|
138
144
|
function useDraftModuleSource(moduleFilePath) {
|
|
145
|
+
var _valOverlayContext$sn2, _moduleMap$moduleFile;
|
|
139
146
|
var valOverlayContext = ValOverlayContext.useValOverlayContext();
|
|
140
147
|
var store = valOverlayContext.store;
|
|
141
148
|
var moduleIds = React__default["default"].useMemo(function () {
|
|
@@ -148,10 +155,15 @@ function useDraftModuleSource(moduleFilePath) {
|
|
|
148
155
|
}, store ? store.getServerSnapshot(moduleIds) : function () {
|
|
149
156
|
return undefined;
|
|
150
157
|
});
|
|
151
|
-
if (!
|
|
158
|
+
if (!moduleFilePath) {
|
|
152
159
|
return undefined;
|
|
153
160
|
}
|
|
154
|
-
|
|
161
|
+
// A proposal's saved Source stands in for the bundle's, draft or not.
|
|
162
|
+
var snapshot = (_valOverlayContext$sn2 = valOverlayContext.snapshot) === null || _valOverlayContext$sn2 === void 0 ? void 0 : _valOverlayContext$sn2[moduleFilePath];
|
|
163
|
+
if (!valOverlayContext.draftMode) {
|
|
164
|
+
return snapshot;
|
|
165
|
+
}
|
|
166
|
+
return (_moduleMap$moduleFile = moduleMap === null || moduleMap === void 0 ? void 0 : moduleMap[moduleFilePath]) !== null && _moduleMap$moduleFile !== void 0 ? _moduleMap$moduleFile : snapshot;
|
|
155
167
|
}
|
|
156
168
|
|
|
157
169
|
/**
|
|
@@ -2,7 +2,7 @@ import { g as getJsonEntryStegaRoot, _ as _typeof, i as isJsonValuesRecordSchema
|
|
|
2
2
|
import { Internal } from '@valbuild/core';
|
|
3
3
|
import { getModuleIds, stegaEncode } from '@valbuild/react/stega';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { u as useValOverlayContext } from '../../dist/ValOverlayContext-
|
|
5
|
+
import { u as useValOverlayContext } from '../../dist/ValOverlayContext-59a0b19f.esm.js';
|
|
6
6
|
import '../../dist/createForOfIteratorHelper-93a62170.esm.js';
|
|
7
7
|
import '@valbuild/shared/client';
|
|
8
8
|
import '@valbuild/core/patch';
|
|
@@ -111,9 +111,15 @@ function useValStega(selector) {
|
|
|
111
111
|
return stegaEncode(selector, {
|
|
112
112
|
disabled: !encodes,
|
|
113
113
|
getModule: function getModule(moduleId) {
|
|
114
|
+
var _valOverlayContext$sn;
|
|
114
115
|
if (moduleMap && valOverlayContext.draftMode) {
|
|
115
|
-
|
|
116
|
+
var draft = moduleMap[moduleId];
|
|
117
|
+
if (draft !== undefined) {
|
|
118
|
+
return draft;
|
|
119
|
+
}
|
|
116
120
|
}
|
|
121
|
+
// At a proposal's address: its saved Source, not the bundle's.
|
|
122
|
+
return (_valOverlayContext$sn = valOverlayContext.snapshot) === null || _valOverlayContext$sn === void 0 ? void 0 : _valOverlayContext$sn[moduleId];
|
|
117
123
|
}
|
|
118
124
|
});
|
|
119
125
|
}
|
|
@@ -128,6 +134,7 @@ function useValStega(selector) {
|
|
|
128
134
|
* correct in production, and stale the moment anyone edits in the Studio.
|
|
129
135
|
*/
|
|
130
136
|
function useDraftModuleSource(moduleFilePath) {
|
|
137
|
+
var _valOverlayContext$sn2, _moduleMap$moduleFile;
|
|
131
138
|
var valOverlayContext = useValOverlayContext();
|
|
132
139
|
var store = valOverlayContext.store;
|
|
133
140
|
var moduleIds = React.useMemo(function () {
|
|
@@ -140,10 +147,15 @@ function useDraftModuleSource(moduleFilePath) {
|
|
|
140
147
|
}, store ? store.getServerSnapshot(moduleIds) : function () {
|
|
141
148
|
return undefined;
|
|
142
149
|
});
|
|
143
|
-
if (!
|
|
150
|
+
if (!moduleFilePath) {
|
|
144
151
|
return undefined;
|
|
145
152
|
}
|
|
146
|
-
|
|
153
|
+
// A proposal's saved Source stands in for the bundle's, draft or not.
|
|
154
|
+
var snapshot = (_valOverlayContext$sn2 = valOverlayContext.snapshot) === null || _valOverlayContext$sn2 === void 0 ? void 0 : _valOverlayContext$sn2[moduleFilePath];
|
|
155
|
+
if (!valOverlayContext.draftMode) {
|
|
156
|
+
return snapshot;
|
|
157
|
+
}
|
|
158
|
+
return (_moduleMap$moduleFile = moduleMap === null || moduleMap === void 0 ? void 0 : moduleMap[moduleFilePath]) !== null && _moduleMap$moduleFile !== void 0 ? _moduleMap$moduleFile : snapshot;
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
/**
|
package/dist/{ValOverlayContext-2739cc60.cjs.prod.js → ValOverlayContext-3e2c48a6.cjs.prod.js}
RENAMED
|
@@ -274,6 +274,7 @@ function ValOverlayProvider(_ref) {
|
|
|
274
274
|
draftModeReady = _ref.draftModeReady,
|
|
275
275
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
276
276
|
serverDraft = _ref.serverDraft,
|
|
277
|
+
snapshot = _ref.snapshot,
|
|
277
278
|
children = _ref.children;
|
|
278
279
|
return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
|
|
279
280
|
value: {
|
|
@@ -282,7 +283,8 @@ function ValOverlayProvider(_ref) {
|
|
|
282
283
|
suspend: suspend,
|
|
283
284
|
draftModeReady: draftModeReady,
|
|
284
285
|
draftSourcesSynced: draftSourcesSynced,
|
|
285
|
-
serverDraft: serverDraft
|
|
286
|
+
serverDraft: serverDraft,
|
|
287
|
+
snapshot: snapshot
|
|
286
288
|
},
|
|
287
289
|
children: children
|
|
288
290
|
});
|
package/dist/{ValOverlayContext-bafe3de9.cjs.dev.js → ValOverlayContext-3f080cce.cjs.dev.js}
RENAMED
|
@@ -274,6 +274,7 @@ function ValOverlayProvider(_ref) {
|
|
|
274
274
|
draftModeReady = _ref.draftModeReady,
|
|
275
275
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
276
276
|
serverDraft = _ref.serverDraft,
|
|
277
|
+
snapshot = _ref.snapshot,
|
|
277
278
|
children = _ref.children;
|
|
278
279
|
return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
|
|
279
280
|
value: {
|
|
@@ -282,7 +283,8 @@ function ValOverlayProvider(_ref) {
|
|
|
282
283
|
suspend: suspend,
|
|
283
284
|
draftModeReady: draftModeReady,
|
|
284
285
|
draftSourcesSynced: draftSourcesSynced,
|
|
285
|
-
serverDraft: serverDraft
|
|
286
|
+
serverDraft: serverDraft,
|
|
287
|
+
snapshot: snapshot
|
|
286
288
|
},
|
|
287
289
|
children: children
|
|
288
290
|
});
|
|
@@ -268,6 +268,7 @@ function ValOverlayProvider(_ref) {
|
|
|
268
268
|
draftModeReady = _ref.draftModeReady,
|
|
269
269
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
270
270
|
serverDraft = _ref.serverDraft,
|
|
271
|
+
snapshot = _ref.snapshot,
|
|
271
272
|
children = _ref.children;
|
|
272
273
|
return /*#__PURE__*/jsx(ValOverlayContext.Provider, {
|
|
273
274
|
value: {
|
|
@@ -276,7 +277,8 @@ function ValOverlayProvider(_ref) {
|
|
|
276
277
|
suspend: suspend,
|
|
277
278
|
draftModeReady: draftModeReady,
|
|
278
279
|
draftSourcesSynced: draftSourcesSynced,
|
|
279
|
-
serverDraft: serverDraft
|
|
280
|
+
serverDraft: serverDraft,
|
|
281
|
+
snapshot: snapshot
|
|
280
282
|
},
|
|
281
283
|
children: children
|
|
282
284
|
});
|
|
@@ -18,4 +18,17 @@ import type { Json, ModuleFilePath } from "@valbuild/core";
|
|
|
18
18
|
*/
|
|
19
19
|
export type ValDraft = {
|
|
20
20
|
sources: Record<ModuleFilePath, Json>;
|
|
21
|
+
/**
|
|
22
|
+
* At a proposal's address: the Source the proposal has saved, which
|
|
23
|
+
* replaces the bundle's for those modules on EVERY render, draft or not --
|
|
24
|
+
* the third source provider (`ValProposal` in `@valbuild/server`). Sent
|
|
25
|
+
* whether or not draft mode is on, because a reviewer who is not editing is
|
|
26
|
+
* looking at the proposal too. A draft, when there is one, applies on top.
|
|
27
|
+
*/
|
|
28
|
+
snapshot?: Record<ModuleFilePath, Json>;
|
|
29
|
+
/**
|
|
30
|
+
* `false` when no draft was read -- draft mode is off -- and this carries
|
|
31
|
+
* only the {@link snapshot}. Absent: a draft, as it always was.
|
|
32
|
+
*/
|
|
33
|
+
draftMode?: false;
|
|
21
34
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JsonEntryContentOf, type Resolvable, type ResolvedVal, type RouteValueOf } from "@valbuild/react/stega";
|
|
2
|
-
import { ValConfig, ValModules, type ResolvableModule } from "@valbuild/core";
|
|
2
|
+
import { ModuleFilePath, ValConfig, ValModules, type Json, type ResolvableModule } from "@valbuild/core";
|
|
3
3
|
import { type RequestScopedMemo } from "@valbuild/shared/internal";
|
|
4
4
|
import { ValServer, type ValPatchStore } from "@valbuild/server";
|
|
5
5
|
import { type ValDraftMode } from "./valDraftMode.js";
|
|
@@ -58,7 +58,11 @@ export declare const initFetchValStega: (config: ValConfig, valApiEndpoints: str
|
|
|
58
58
|
name: string;
|
|
59
59
|
value: string;
|
|
60
60
|
} | undefined;
|
|
61
|
-
}>, getDraftSourcesScope: GetDraftSourcesScope
|
|
61
|
+
}>, getDraftSourcesScope: GetDraftSourcesScope,
|
|
62
|
+
/** A proposal's saved Source; see `ValDraft.snapshot`. */
|
|
63
|
+
snapshot?: Snapshot) => <T extends Resolvable>(selector: T) => Promise<ResolvedVal<T>>;
|
|
64
|
+
/** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
|
|
65
|
+
type Snapshot = Record<ModuleFilePath, Json>;
|
|
62
66
|
/** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
|
|
63
67
|
export type DraftValServer = {
|
|
64
68
|
"/sources/~": ValServer["/sources/~"];
|
|
@@ -82,7 +86,9 @@ export declare const initFetchValDraft: (valServerPromise: Promise<DraftValServe
|
|
|
82
86
|
name: string;
|
|
83
87
|
value: string;
|
|
84
88
|
} | undefined;
|
|
85
|
-
}>, getDraftSourcesScope: GetDraftSourcesScope
|
|
89
|
+
}>, getDraftSourcesScope: GetDraftSourcesScope,
|
|
90
|
+
/** A proposal's saved Source; see `ValDraft.snapshot`. */
|
|
91
|
+
snapshot?: Snapshot) => () => Promise<ValDraft | null>;
|
|
86
92
|
declare const initFetchValRouteStega: (config: ValConfig, valApiEndpoints: string, valServerPromise: Promise<RouteReaderValServer>, isEnabled: () => Promise<boolean>, getHeaders: () => Promise<{
|
|
87
93
|
get(name: string): string | null;
|
|
88
94
|
}>, getCookies: () => Promise<{
|
|
@@ -90,7 +96,9 @@ declare const initFetchValRouteStega: (config: ValConfig, valApiEndpoints: strin
|
|
|
90
96
|
name: string;
|
|
91
97
|
value: string;
|
|
92
98
|
} | undefined;
|
|
93
|
-
}>, getDraftSourcesScope: GetDraftSourcesScope
|
|
99
|
+
}>, getDraftSourcesScope: GetDraftSourcesScope,
|
|
100
|
+
/** A proposal's saved Source; see `ValDraft.snapshot`. */
|
|
101
|
+
snapshot?: Snapshot) => <T extends ResolvableModule>(selector: T, params: Promise<Record<string, string | string[]>> | Record<string, string | string[]> | unknown) => Promise<RouteValueOf<T>>;
|
|
94
102
|
/**
|
|
95
103
|
* Loads a single `.jsonValues()` entry's DRAFT content via the in-process
|
|
96
104
|
* `/json` endpoint (which replays pending patches). Returns `undefined` when the
|
|
@@ -155,7 +163,9 @@ declare const initFetchValRouteUrl: (config: ValConfig, valApiEndpoints: string,
|
|
|
155
163
|
name: string;
|
|
156
164
|
value: string;
|
|
157
165
|
} | undefined;
|
|
158
|
-
}>, getDraftSourcesScope: GetDraftSourcesScope
|
|
166
|
+
}>, getDraftSourcesScope: GetDraftSourcesScope,
|
|
167
|
+
/** A proposal's saved Source; see `ValDraft.snapshot`. */
|
|
168
|
+
snapshot?: Snapshot) => <T extends ResolvableModule>(selector: T, params?: Promise<Record<string, string | string[]>> | Record<string, string | string[]> | unknown) => Promise<string | null>;
|
|
159
169
|
/**
|
|
160
170
|
* Val's content readers for the server side of a TanStack Start app.
|
|
161
171
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ValConfig, ValModules } from "@valbuild/core";
|
|
2
|
-
import { type CommitContext, type CommitResult, type ValPatchStore } from "@valbuild/server";
|
|
2
|
+
import { type CommitContext, type CommitResult, type ValPatchStore, type ValProposal } from "@valbuild/server";
|
|
3
3
|
import { type ValDraftMode } from "./valDraftMode.js";
|
|
4
4
|
/**
|
|
5
5
|
* What `http` mode needs, as one object.
|
|
@@ -72,6 +72,14 @@ export type ValHttpMode = {
|
|
|
72
72
|
* else should set it.
|
|
73
73
|
*/
|
|
74
74
|
publishBuild?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The proposal this build is serving the address of, when the platform
|
|
77
|
+
* says so (`VAL_PROPOSAL`, `VAL_BRANCH`, `VAL_OVERLAY`; read them with
|
|
78
|
+
* `proposalFromEnv`). Its saved content replaces the bundle's for what it
|
|
79
|
+
* saved, on every read, and a save commits to the proposal. Nothing else
|
|
80
|
+
* should set it.
|
|
81
|
+
*/
|
|
82
|
+
proposal?: ValProposal;
|
|
75
83
|
};
|
|
76
84
|
export declare function initValServer(valModules: ValModules, config: ValConfig & {
|
|
77
85
|
disableCache?: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = require('./version-
|
|
5
|
+
var version = require('./version-4ba1e52e.cjs.dev.js');
|
|
6
6
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-4497beef.cjs.dev.js');
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
@@ -10,7 +10,7 @@ var internal = require('@valbuild/react/internal');
|
|
|
10
10
|
var ui = require('@valbuild/ui');
|
|
11
11
|
var reactRouter = require('@tanstack/react-router');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var ValOverlayContext = require('./ValOverlayContext-
|
|
13
|
+
var ValOverlayContext = require('./ValOverlayContext-3f080cce.cjs.dev.js');
|
|
14
14
|
var client = require('@valbuild/shared/client');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
16
|
require('@valbuild/core/patch');
|
|
@@ -998,10 +998,17 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
998
998
|
* overlay has been updating since.
|
|
999
999
|
*/
|
|
1000
1000
|
var initialDraft = React__default["default"].useRef((_props$draft = props.draft) !== null && _props$draft !== void 0 ? _props$draft : null).current;
|
|
1001
|
+
/*
|
|
1002
|
+
* At a proposal's address the server sends its snapshot whether or not
|
|
1003
|
+
* draft mode is on, and one that is ONLY a snapshot (`draftMode: false`) is
|
|
1004
|
+
* not a draft: it must not turn draft mode on or say the draft is synced.
|
|
1005
|
+
*/
|
|
1006
|
+
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
1007
|
+
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
1001
1008
|
// TODO: move below into react package
|
|
1002
1009
|
var valStore = React__default["default"].useMemo(function () {
|
|
1003
1010
|
var store = new ValOverlayContext.ValExternalStore();
|
|
1004
|
-
if (
|
|
1011
|
+
if (hasDraft) {
|
|
1005
1012
|
for (var _i = 0, _Object$entries = Object.entries(initialDraft.sources); _i < _Object$entries.length; _i++) {
|
|
1006
1013
|
var _Object$entries$_i = createForOfIteratorHelper._slicedToArray(_Object$entries[_i], 2),
|
|
1007
1014
|
path = _Object$entries$_i[0],
|
|
@@ -1010,7 +1017,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1010
1017
|
}
|
|
1011
1018
|
}
|
|
1012
1019
|
return store;
|
|
1013
|
-
}, [initialDraft]);
|
|
1020
|
+
}, [initialDraft, hasDraft]);
|
|
1014
1021
|
// Whether useValStega should actually suspend. False during SSR and the
|
|
1015
1022
|
// hydration render. Two paths: without `draft` the server store is empty
|
|
1016
1023
|
// (draft data arrives via browser CustomEvents only), so suspending there
|
|
@@ -1036,7 +1043,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1036
1043
|
*/
|
|
1037
1044
|
// A server-read draft is everything there is: a module missing from it has
|
|
1038
1045
|
// no changes, so there is nothing more to wait for.
|
|
1039
|
-
var _React$useState3 = React__default["default"].useState(
|
|
1046
|
+
var _React$useState3 = React__default["default"].useState(hasDraft),
|
|
1040
1047
|
_React$useState4 = createForOfIteratorHelper._slicedToArray(_React$useState3, 2),
|
|
1041
1048
|
draftSourcesSynced = _React$useState4[0],
|
|
1042
1049
|
setDraftSourcesSynced = _React$useState4[1];
|
|
@@ -1063,7 +1070,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1063
1070
|
setIsCanvas = _React$useState8[1];
|
|
1064
1071
|
// Known on the server when it read a draft: `fetchValDraft` only reads one
|
|
1065
1072
|
// in draft mode. Otherwise unknown until `/draft/stat` answers.
|
|
1066
|
-
var _React$useState9 = React__default["default"].useState(
|
|
1073
|
+
var _React$useState9 = React__default["default"].useState(hasDraft ? true : null),
|
|
1067
1074
|
_React$useState0 = createForOfIteratorHelper._slicedToArray(_React$useState9, 2),
|
|
1068
1075
|
draftMode = _React$useState0[0],
|
|
1069
1076
|
setDraftMode = _React$useState0[1];
|
|
@@ -1562,7 +1569,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1562
1569
|
draftMode: draftMode,
|
|
1563
1570
|
draftModeReady: (_draftModeReady$curre2 = draftModeReady.current) === null || _draftModeReady$curre2 === void 0 ? void 0 : _draftModeReady$curre2.promise,
|
|
1564
1571
|
draftSourcesSynced: draftSourcesSynced,
|
|
1565
|
-
serverDraft:
|
|
1572
|
+
serverDraft: hasDraft,
|
|
1573
|
+
snapshot: snapshot,
|
|
1566
1574
|
suspend: suspendActive,
|
|
1567
1575
|
store: valStore,
|
|
1568
1576
|
children: [props.children, dropZone !== null && !spaLoaded && mountOverlay &&
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = require('./version-
|
|
5
|
+
var version = require('./version-b550a2c2.cjs.prod.js');
|
|
6
6
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
@@ -10,7 +10,7 @@ var internal = require('@valbuild/react/internal');
|
|
|
10
10
|
var ui = require('@valbuild/ui');
|
|
11
11
|
var reactRouter = require('@tanstack/react-router');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var ValOverlayContext = require('./ValOverlayContext-
|
|
13
|
+
var ValOverlayContext = require('./ValOverlayContext-3e2c48a6.cjs.prod.js');
|
|
14
14
|
var client = require('@valbuild/shared/client');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
16
|
require('@valbuild/core/patch');
|
|
@@ -998,10 +998,17 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
998
998
|
* overlay has been updating since.
|
|
999
999
|
*/
|
|
1000
1000
|
var initialDraft = React__default["default"].useRef((_props$draft = props.draft) !== null && _props$draft !== void 0 ? _props$draft : null).current;
|
|
1001
|
+
/*
|
|
1002
|
+
* At a proposal's address the server sends its snapshot whether or not
|
|
1003
|
+
* draft mode is on, and one that is ONLY a snapshot (`draftMode: false`) is
|
|
1004
|
+
* not a draft: it must not turn draft mode on or say the draft is synced.
|
|
1005
|
+
*/
|
|
1006
|
+
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
1007
|
+
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
1001
1008
|
// TODO: move below into react package
|
|
1002
1009
|
var valStore = React__default["default"].useMemo(function () {
|
|
1003
1010
|
var store = new ValOverlayContext.ValExternalStore();
|
|
1004
|
-
if (
|
|
1011
|
+
if (hasDraft) {
|
|
1005
1012
|
for (var _i = 0, _Object$entries = Object.entries(initialDraft.sources); _i < _Object$entries.length; _i++) {
|
|
1006
1013
|
var _Object$entries$_i = createForOfIteratorHelper._slicedToArray(_Object$entries[_i], 2),
|
|
1007
1014
|
path = _Object$entries$_i[0],
|
|
@@ -1010,7 +1017,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1010
1017
|
}
|
|
1011
1018
|
}
|
|
1012
1019
|
return store;
|
|
1013
|
-
}, [initialDraft]);
|
|
1020
|
+
}, [initialDraft, hasDraft]);
|
|
1014
1021
|
// Whether useValStega should actually suspend. False during SSR and the
|
|
1015
1022
|
// hydration render. Two paths: without `draft` the server store is empty
|
|
1016
1023
|
// (draft data arrives via browser CustomEvents only), so suspending there
|
|
@@ -1036,7 +1043,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1036
1043
|
*/
|
|
1037
1044
|
// A server-read draft is everything there is: a module missing from it has
|
|
1038
1045
|
// no changes, so there is nothing more to wait for.
|
|
1039
|
-
var _React$useState3 = React__default["default"].useState(
|
|
1046
|
+
var _React$useState3 = React__default["default"].useState(hasDraft),
|
|
1040
1047
|
_React$useState4 = createForOfIteratorHelper._slicedToArray(_React$useState3, 2),
|
|
1041
1048
|
draftSourcesSynced = _React$useState4[0],
|
|
1042
1049
|
setDraftSourcesSynced = _React$useState4[1];
|
|
@@ -1063,7 +1070,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1063
1070
|
setIsCanvas = _React$useState8[1];
|
|
1064
1071
|
// Known on the server when it read a draft: `fetchValDraft` only reads one
|
|
1065
1072
|
// in draft mode. Otherwise unknown until `/draft/stat` answers.
|
|
1066
|
-
var _React$useState9 = React__default["default"].useState(
|
|
1073
|
+
var _React$useState9 = React__default["default"].useState(hasDraft ? true : null),
|
|
1067
1074
|
_React$useState0 = createForOfIteratorHelper._slicedToArray(_React$useState9, 2),
|
|
1068
1075
|
draftMode = _React$useState0[0],
|
|
1069
1076
|
setDraftMode = _React$useState0[1];
|
|
@@ -1562,7 +1569,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1562
1569
|
draftMode: draftMode,
|
|
1563
1570
|
draftModeReady: (_draftModeReady$curre2 = draftModeReady.current) === null || _draftModeReady$curre2 === void 0 ? void 0 : _draftModeReady$curre2.promise,
|
|
1564
1571
|
draftSourcesSynced: draftSourcesSynced,
|
|
1565
|
-
serverDraft:
|
|
1572
|
+
serverDraft: hasDraft,
|
|
1573
|
+
snapshot: snapshot,
|
|
1566
1574
|
suspend: suspendActive,
|
|
1567
1575
|
store: valStore,
|
|
1568
1576
|
children: [props.children, dropZone !== null && !spaLoaded && mountOverlay &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _asyncToGenerator, a as _regenerator, r as readValEnableCookie, V as VERSION$1 } from './version-
|
|
1
|
+
import { _ as _asyncToGenerator, a as _regenerator, r as readValEnableCookie, V as VERSION$1 } from './version-0588f50c.esm.js';
|
|
2
2
|
import { _ as _objectSpread2, a as _slicedToArray, b as _createForOfIteratorHelper } from './createForOfIteratorHelper-93a62170.esm.js';
|
|
3
3
|
import { Internal as Internal$1, initVal as initVal$1, DEFAULT_CONTENT_HOST } from '@valbuild/core';
|
|
4
4
|
import * as core from '@valbuild/core';
|
|
@@ -9,7 +9,7 @@ export { ValRichText } from '@valbuild/react/internal';
|
|
|
9
9
|
import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
|
|
10
10
|
import { useRouter, useRouterState } from '@tanstack/react-router';
|
|
11
11
|
import React, { useEffect, useRef, useState } from 'react';
|
|
12
|
-
import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-
|
|
12
|
+
import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-59a0b19f.esm.js';
|
|
13
13
|
import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, isValCanvasFrame } from '@valbuild/shared/client';
|
|
14
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
15
|
import '@valbuild/core/patch';
|
|
@@ -974,10 +974,17 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
974
974
|
* overlay has been updating since.
|
|
975
975
|
*/
|
|
976
976
|
var initialDraft = React.useRef((_props$draft = props.draft) !== null && _props$draft !== void 0 ? _props$draft : null).current;
|
|
977
|
+
/*
|
|
978
|
+
* At a proposal's address the server sends its snapshot whether or not
|
|
979
|
+
* draft mode is on, and one that is ONLY a snapshot (`draftMode: false`) is
|
|
980
|
+
* not a draft: it must not turn draft mode on or say the draft is synced.
|
|
981
|
+
*/
|
|
982
|
+
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
983
|
+
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
977
984
|
// TODO: move below into react package
|
|
978
985
|
var valStore = React.useMemo(function () {
|
|
979
986
|
var store = new ValExternalStore();
|
|
980
|
-
if (
|
|
987
|
+
if (hasDraft) {
|
|
981
988
|
for (var _i = 0, _Object$entries = Object.entries(initialDraft.sources); _i < _Object$entries.length; _i++) {
|
|
982
989
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
983
990
|
path = _Object$entries$_i[0],
|
|
@@ -986,7 +993,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
986
993
|
}
|
|
987
994
|
}
|
|
988
995
|
return store;
|
|
989
|
-
}, [initialDraft]);
|
|
996
|
+
}, [initialDraft, hasDraft]);
|
|
990
997
|
// Whether useValStega should actually suspend. False during SSR and the
|
|
991
998
|
// hydration render. Two paths: without `draft` the server store is empty
|
|
992
999
|
// (draft data arrives via browser CustomEvents only), so suspending there
|
|
@@ -1012,7 +1019,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1012
1019
|
*/
|
|
1013
1020
|
// A server-read draft is everything there is: a module missing from it has
|
|
1014
1021
|
// no changes, so there is nothing more to wait for.
|
|
1015
|
-
var _React$useState3 = React.useState(
|
|
1022
|
+
var _React$useState3 = React.useState(hasDraft),
|
|
1016
1023
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
1017
1024
|
draftSourcesSynced = _React$useState4[0],
|
|
1018
1025
|
setDraftSourcesSynced = _React$useState4[1];
|
|
@@ -1039,7 +1046,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1039
1046
|
setIsCanvas = _React$useState8[1];
|
|
1040
1047
|
// Known on the server when it read a draft: `fetchValDraft` only reads one
|
|
1041
1048
|
// in draft mode. Otherwise unknown until `/draft/stat` answers.
|
|
1042
|
-
var _React$useState9 = React.useState(
|
|
1049
|
+
var _React$useState9 = React.useState(hasDraft ? true : null),
|
|
1043
1050
|
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
1044
1051
|
draftMode = _React$useState0[0],
|
|
1045
1052
|
setDraftMode = _React$useState0[1];
|
|
@@ -1538,7 +1545,8 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1538
1545
|
draftMode: draftMode,
|
|
1539
1546
|
draftModeReady: (_draftModeReady$curre2 = draftModeReady.current) === null || _draftModeReady$curre2 === void 0 ? void 0 : _draftModeReady$curre2.promise,
|
|
1540
1547
|
draftSourcesSynced: draftSourcesSynced,
|
|
1541
|
-
serverDraft:
|
|
1548
|
+
serverDraft: hasDraft,
|
|
1549
|
+
snapshot: snapshot,
|
|
1542
1550
|
suspend: suspendActive,
|
|
1543
1551
|
store: valStore,
|
|
1544
1552
|
children: [props.children, dropZone !== null && !spaLoaded && mountOverlay &&
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"tanstack-router",
|
|
15
15
|
"react"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.142.0",
|
|
18
18
|
"main": "dist/valbuild-tanstack.cjs.js",
|
|
19
19
|
"module": "dist/valbuild-tanstack.esm.js",
|
|
20
20
|
"exports": {
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@valbuild/core": "0.141.0",
|
|
46
|
-
"@valbuild/language-server": "0.
|
|
47
|
-
"@valbuild/
|
|
48
|
-
"@valbuild/
|
|
49
|
-
"@valbuild/server": "0.
|
|
50
|
-
"@valbuild/shared": "0.
|
|
51
|
-
"@valbuild/ui": "0.
|
|
46
|
+
"@valbuild/language-server": "0.142.0",
|
|
47
|
+
"@valbuild/mcp": "0.142.0",
|
|
48
|
+
"@valbuild/react": "0.142.0",
|
|
49
|
+
"@valbuild/server": "0.142.0",
|
|
50
|
+
"@valbuild/shared": "0.142.0",
|
|
51
|
+
"@valbuild/ui": "0.142.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@tanstack/react-router": "^1.170.41",
|