@valbuild/tanstack 0.144.2 → 0.144.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +18 -3
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +18 -3
- package/client/dist/valbuild-tanstack-client.esm.js +18 -3
- package/dist/declarations/src/ValDraft.d.ts +10 -0
- package/dist/declarations/src/ValModulesClient.d.ts +3 -1
- package/dist/declarations/src/server/initValContent.d.ts +10 -1
- package/dist/valbuild-tanstack.cjs.dev.js +11 -1
- package/dist/valbuild-tanstack.cjs.prod.js +11 -1
- package/dist/valbuild-tanstack.esm.js +11 -1
- package/dist/{version-277910e9.cjs.prod.js → version-c5862191.cjs.dev.js} +1 -1
- package/dist/{version-f6399796.esm.js → version-e43bf6e6.esm.js} +1 -1
- package/dist/{version-c4d88129.cjs.dev.js → version-efacbb53.cjs.prod.js} +1 -1
- package/package.json +6 -6
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +18 -4
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +18 -4
- package/server/dist/valbuild-tanstack-server.esm.js +19 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.144.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#833](https://github.com/valbuild/val/pull/833) [`99fcac5`](https://github.com/valbuild/val/commit/99fcac527f2d5ba37c4b132ef08189b955d69e51) Thanks [@freekh](https://github.com/freekh)! - A draft page no longer flips back to the text from before a content-only publish.
|
|
8
|
+
|
|
9
|
+
After content was published without a build, the Studio's overlay on a draft page started from the text compiled into the build, which still held the old content, and handed it to the page. Depending on which arrived first, an editor reloading the page saw the new text, then the old, then the new again, in a freshly opened tab and long after the publish. Visitors were not affected.
|
|
10
|
+
|
|
11
|
+
The page now hands the overlay the content it serves (`ValDraft.base`, from the content version and any proposal's saves), and the overlay starts from that instead of the build's text, so the two never disagree.
|
|
12
|
+
|
|
13
|
+
The same holds for `.jsonValues()` entries: where the overlay has not loaded an entry, `useValKey` and `useValRoute` now fall back to the content version's entry, as the server did, before the build's.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`99fcac5`](https://github.com/valbuild/val/commit/99fcac527f2d5ba37c4b132ef08189b955d69e51), [`0e09e9c`](https://github.com/valbuild/val/commit/0e09e9cdac4918bdfa1c01a92a8968a516f8c0c6)]:
|
|
16
|
+
- @valbuild/ui@0.144.3
|
|
17
|
+
- @valbuild/react@0.144.3
|
|
18
|
+
- @valbuild/server@0.144.3
|
|
19
|
+
- @valbuild/language-server@0.144.3
|
|
20
|
+
- @valbuild/mcp@0.144.3
|
|
21
|
+
|
|
3
22
|
## 0.144.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -207,6 +207,18 @@ function draftJsonEntry(draftSource, key) {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The draft view's answer for one entry, or -- where it has none, a marker for
|
|
212
|
+
* an entry the Studio has not loaded -- the snapshot's: a proposal's saves over
|
|
213
|
+
* the content version the site serves, with entries filled in. The order the
|
|
214
|
+
* server renders in (`snapshotJsonEntry` in initValContent), so a draft page
|
|
215
|
+
* hydrates to what it was served rather than to the build's older entry.
|
|
216
|
+
*/
|
|
217
|
+
function draftOrSnapshotJsonEntry(draftSource, snapshotSource, key) {
|
|
218
|
+
var draft = draftJsonEntry(draftSource, key);
|
|
219
|
+
return draft.status === "unavailable" ? draftJsonEntry(snapshotSource, key) : draft;
|
|
220
|
+
}
|
|
221
|
+
|
|
210
222
|
// Module-level cache of in-flight/resolved entry loads, so `React.use` gets a
|
|
211
223
|
// stable promise across renders (keyed by module path + entry key).
|
|
212
224
|
var jsonEntryPromiseCache = new Map();
|
|
@@ -222,6 +234,7 @@ var jsonEntryPromiseCache = new Map();
|
|
|
222
234
|
* entry's lazy import thunk from the local module.
|
|
223
235
|
*/
|
|
224
236
|
function useValKeyStega(selector, key) {
|
|
237
|
+
var _valOverlayContext$sn3;
|
|
225
238
|
var valOverlayContext = ValOverlayContext.useValOverlayContext();
|
|
226
239
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
227
240
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
@@ -229,7 +242,7 @@ function useValKeyStega(selector, key) {
|
|
|
229
242
|
var valModule = core.Internal.resolveViewedModule(selector);
|
|
230
243
|
var moduleFilePath = valModule && core.Internal.getValPath(valModule);
|
|
231
244
|
var draftSource = useDraftModuleSource(moduleFilePath || undefined);
|
|
232
|
-
var draft =
|
|
245
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn3 = valOverlayContext.snapshot) === null || _valOverlayContext$sn3 === void 0 ? void 0 : _valOverlayContext$sn3[moduleFilePath]), key);
|
|
233
246
|
if (draft.status === "absent") {
|
|
234
247
|
// Deleted in the draft state. Falling back to the bundled entry here would
|
|
235
248
|
// render content the editor has just removed.
|
|
@@ -300,7 +313,8 @@ function useValRouteStega(selector, params) {
|
|
|
300
313
|
// other router `draftSource` is.
|
|
301
314
|
var val = useValStega(valModule);
|
|
302
315
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
303
|
-
var
|
|
316
|
+
var moduleFilePath = valModule && core.Internal.getValPath(valModule) || undefined;
|
|
317
|
+
var draftSource = useDraftModuleSource(moduleFilePath);
|
|
304
318
|
var resolvedParams = resolveParams(params);
|
|
305
319
|
// Careful: null means there was an error - undefined means no params
|
|
306
320
|
if (resolvedParams === null) {
|
|
@@ -311,12 +325,13 @@ function useValRouteStega(selector, params) {
|
|
|
311
325
|
// `.jsonValues()` router: map params → the entry key and load ONLY that
|
|
312
326
|
// entry's backing `*.val.json` (one dynamic import), like `useValKey`.
|
|
313
327
|
if (routeFromVal.isJsonValuesRecordSchema(schema)) {
|
|
328
|
+
var _valOverlayContext$sn4;
|
|
314
329
|
var source = valModule && core.Internal.getSource(valModule);
|
|
315
330
|
var url = routeFromVal.getValRouteUrlFromVal(resolvedParams || {}, "useValRoute", path, schema, source);
|
|
316
331
|
if (!url) {
|
|
317
332
|
return null;
|
|
318
333
|
}
|
|
319
|
-
var draft =
|
|
334
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn4 = valOverlayContext.snapshot) === null || _valOverlayContext$sn4 === void 0 ? void 0 : _valOverlayContext$sn4[moduleFilePath]), url);
|
|
320
335
|
if (draft.status === "absent") {
|
|
321
336
|
// The draft state says this route is gone — see useValKeyStega.
|
|
322
337
|
return null;
|
|
@@ -207,6 +207,18 @@ function draftJsonEntry(draftSource, key) {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The draft view's answer for one entry, or -- where it has none, a marker for
|
|
212
|
+
* an entry the Studio has not loaded -- the snapshot's: a proposal's saves over
|
|
213
|
+
* the content version the site serves, with entries filled in. The order the
|
|
214
|
+
* server renders in (`snapshotJsonEntry` in initValContent), so a draft page
|
|
215
|
+
* hydrates to what it was served rather than to the build's older entry.
|
|
216
|
+
*/
|
|
217
|
+
function draftOrSnapshotJsonEntry(draftSource, snapshotSource, key) {
|
|
218
|
+
var draft = draftJsonEntry(draftSource, key);
|
|
219
|
+
return draft.status === "unavailable" ? draftJsonEntry(snapshotSource, key) : draft;
|
|
220
|
+
}
|
|
221
|
+
|
|
210
222
|
// Module-level cache of in-flight/resolved entry loads, so `React.use` gets a
|
|
211
223
|
// stable promise across renders (keyed by module path + entry key).
|
|
212
224
|
var jsonEntryPromiseCache = new Map();
|
|
@@ -222,6 +234,7 @@ var jsonEntryPromiseCache = new Map();
|
|
|
222
234
|
* entry's lazy import thunk from the local module.
|
|
223
235
|
*/
|
|
224
236
|
function useValKeyStega(selector, key) {
|
|
237
|
+
var _valOverlayContext$sn3;
|
|
225
238
|
var valOverlayContext = ValOverlayContext.useValOverlayContext();
|
|
226
239
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
227
240
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
@@ -229,7 +242,7 @@ function useValKeyStega(selector, key) {
|
|
|
229
242
|
var valModule = core.Internal.resolveViewedModule(selector);
|
|
230
243
|
var moduleFilePath = valModule && core.Internal.getValPath(valModule);
|
|
231
244
|
var draftSource = useDraftModuleSource(moduleFilePath || undefined);
|
|
232
|
-
var draft =
|
|
245
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn3 = valOverlayContext.snapshot) === null || _valOverlayContext$sn3 === void 0 ? void 0 : _valOverlayContext$sn3[moduleFilePath]), key);
|
|
233
246
|
if (draft.status === "absent") {
|
|
234
247
|
// Deleted in the draft state. Falling back to the bundled entry here would
|
|
235
248
|
// render content the editor has just removed.
|
|
@@ -300,7 +313,8 @@ function useValRouteStega(selector, params) {
|
|
|
300
313
|
// other router `draftSource` is.
|
|
301
314
|
var val = useValStega(valModule);
|
|
302
315
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
303
|
-
var
|
|
316
|
+
var moduleFilePath = valModule && core.Internal.getValPath(valModule) || undefined;
|
|
317
|
+
var draftSource = useDraftModuleSource(moduleFilePath);
|
|
304
318
|
var resolvedParams = resolveParams(params);
|
|
305
319
|
// Careful: null means there was an error - undefined means no params
|
|
306
320
|
if (resolvedParams === null) {
|
|
@@ -311,12 +325,13 @@ function useValRouteStega(selector, params) {
|
|
|
311
325
|
// `.jsonValues()` router: map params → the entry key and load ONLY that
|
|
312
326
|
// entry's backing `*.val.json` (one dynamic import), like `useValKey`.
|
|
313
327
|
if (routeFromVal.isJsonValuesRecordSchema(schema)) {
|
|
328
|
+
var _valOverlayContext$sn4;
|
|
314
329
|
var source = valModule && core.Internal.getSource(valModule);
|
|
315
330
|
var url = routeFromVal.getValRouteUrlFromVal(resolvedParams || {}, "useValRoute", path, schema, source);
|
|
316
331
|
if (!url) {
|
|
317
332
|
return null;
|
|
318
333
|
}
|
|
319
|
-
var draft =
|
|
334
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn4 = valOverlayContext.snapshot) === null || _valOverlayContext$sn4 === void 0 ? void 0 : _valOverlayContext$sn4[moduleFilePath]), url);
|
|
320
335
|
if (draft.status === "absent") {
|
|
321
336
|
// The draft state says this route is gone — see useValKeyStega.
|
|
322
337
|
return null;
|
|
@@ -199,6 +199,18 @@ function draftJsonEntry(draftSource, key) {
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* The draft view's answer for one entry, or -- where it has none, a marker for
|
|
204
|
+
* an entry the Studio has not loaded -- the snapshot's: a proposal's saves over
|
|
205
|
+
* the content version the site serves, with entries filled in. The order the
|
|
206
|
+
* server renders in (`snapshotJsonEntry` in initValContent), so a draft page
|
|
207
|
+
* hydrates to what it was served rather than to the build's older entry.
|
|
208
|
+
*/
|
|
209
|
+
function draftOrSnapshotJsonEntry(draftSource, snapshotSource, key) {
|
|
210
|
+
var draft = draftJsonEntry(draftSource, key);
|
|
211
|
+
return draft.status === "unavailable" ? draftJsonEntry(snapshotSource, key) : draft;
|
|
212
|
+
}
|
|
213
|
+
|
|
202
214
|
// Module-level cache of in-flight/resolved entry loads, so `React.use` gets a
|
|
203
215
|
// stable promise across renders (keyed by module path + entry key).
|
|
204
216
|
var jsonEntryPromiseCache = new Map();
|
|
@@ -214,6 +226,7 @@ var jsonEntryPromiseCache = new Map();
|
|
|
214
226
|
* entry's lazy import thunk from the local module.
|
|
215
227
|
*/
|
|
216
228
|
function useValKeyStega(selector, key) {
|
|
229
|
+
var _valOverlayContext$sn3;
|
|
217
230
|
var valOverlayContext = useValOverlayContext();
|
|
218
231
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
219
232
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
@@ -221,7 +234,7 @@ function useValKeyStega(selector, key) {
|
|
|
221
234
|
var valModule = Internal.resolveViewedModule(selector);
|
|
222
235
|
var moduleFilePath = valModule && Internal.getValPath(valModule);
|
|
223
236
|
var draftSource = useDraftModuleSource(moduleFilePath || undefined);
|
|
224
|
-
var draft =
|
|
237
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn3 = valOverlayContext.snapshot) === null || _valOverlayContext$sn3 === void 0 ? void 0 : _valOverlayContext$sn3[moduleFilePath]), key);
|
|
225
238
|
if (draft.status === "absent") {
|
|
226
239
|
// Deleted in the draft state. Falling back to the bundled entry here would
|
|
227
240
|
// render content the editor has just removed.
|
|
@@ -292,7 +305,8 @@ function useValRouteStega(selector, params) {
|
|
|
292
305
|
// other router `draftSource` is.
|
|
293
306
|
var val = useValStega(valModule);
|
|
294
307
|
var encodes = useEncodesEditTags(valOverlayContext);
|
|
295
|
-
var
|
|
308
|
+
var moduleFilePath = valModule && Internal.getValPath(valModule) || undefined;
|
|
309
|
+
var draftSource = useDraftModuleSource(moduleFilePath);
|
|
296
310
|
var resolvedParams = resolveParams(params);
|
|
297
311
|
// Careful: null means there was an error - undefined means no params
|
|
298
312
|
if (resolvedParams === null) {
|
|
@@ -303,12 +317,13 @@ function useValRouteStega(selector, params) {
|
|
|
303
317
|
// `.jsonValues()` router: map params → the entry key and load ONLY that
|
|
304
318
|
// entry's backing `*.val.json` (one dynamic import), like `useValKey`.
|
|
305
319
|
if (isJsonValuesRecordSchema(schema)) {
|
|
320
|
+
var _valOverlayContext$sn4;
|
|
306
321
|
var source = valModule && Internal.getSource(valModule);
|
|
307
322
|
var url = getValRouteUrlFromVal(resolvedParams || {}, "useValRoute", path, schema, source);
|
|
308
323
|
if (!url) {
|
|
309
324
|
return null;
|
|
310
325
|
}
|
|
311
|
-
var draft =
|
|
326
|
+
var draft = draftOrSnapshotJsonEntry(draftSource, moduleFilePath && ((_valOverlayContext$sn4 = valOverlayContext.snapshot) === null || _valOverlayContext$sn4 === void 0 ? void 0 : _valOverlayContext$sn4[moduleFilePath]), url);
|
|
312
327
|
if (draft.status === "absent") {
|
|
313
328
|
// The draft state says this route is gone — see useValKeyStega.
|
|
314
329
|
return null;
|
|
@@ -26,6 +26,16 @@ export type ValDraft = {
|
|
|
26
26
|
* looking at the proposal too. A draft, when there is one, applies on top.
|
|
27
27
|
*/
|
|
28
28
|
snapshot?: Record<ModuleFilePath, Json>;
|
|
29
|
+
/**
|
|
30
|
+
* The Source the server's draft starts from where it is not the bundle's: a
|
|
31
|
+
* content version -- content published without a build -- with a
|
|
32
|
+
* proposal's saves over it, as stored (`.jsonValues()` markers and all).
|
|
33
|
+
* The Studio's overlay starts from it, by `window.__VAL_BASE__`: after a
|
|
34
|
+
* content-only publish the bundle still holds the text from before it, and
|
|
35
|
+
* a draft page took that text back whenever the overlay's bundle reached
|
|
36
|
+
* it first. Sent with a draft only -- the overlay runs in draft mode alone.
|
|
37
|
+
*/
|
|
38
|
+
base?: Record<ModuleFilePath, Json>;
|
|
29
39
|
/**
|
|
30
40
|
* `false` when no draft was read -- draft mode is off -- and this carries
|
|
31
41
|
* only the {@link snapshot}. Absent: a draft, as it always was.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ValModules } from "@valbuild/core";
|
|
1
|
+
import type { Json, ModuleFilePath, ValModules } from "@valbuild/core";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
__VAL_MODULES__?: ValModules;
|
|
5
|
+
/** The Studio overlay's base where it is not the bundle's: `ValDraft.base`. */
|
|
6
|
+
__VAL_BASE__?: Record<ModuleFilePath, Json>;
|
|
5
7
|
}
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
@@ -69,6 +69,13 @@ type Snapshot = Record<ModuleFilePath, Json>;
|
|
|
69
69
|
* either alone, or nothing.
|
|
70
70
|
*/
|
|
71
71
|
export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource"> | undefined): Snapshot | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* What the server's own draft starts from, where it is not the bundle's: the
|
|
74
|
+
* layers `ValOpsHttp` puts over it (`siteSnapshotSources`, then
|
|
75
|
+
* `snapshotSources`), in the same form, so the Studio that starts from it
|
|
76
|
+
* holds the base the server reports. See `ValDraft.base`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function draftBase(http: Pick<ValHttpMode, "proposal" | "contentVersion"> | undefined): Snapshot | undefined;
|
|
72
79
|
/**
|
|
73
80
|
* Where an isolate says which content version it applied, for the platform
|
|
74
81
|
* serving it to read back after a render (valbuild/home: the loader answers it
|
|
@@ -107,7 +114,9 @@ export declare const initFetchValDraft: (valServerPromise: Promise<DraftValServe
|
|
|
107
114
|
} | undefined;
|
|
108
115
|
}>, getDraftSourcesScope: GetDraftSourcesScope,
|
|
109
116
|
/** A proposal's saved Source; see `ValDraft.snapshot`. */
|
|
110
|
-
snapshot?: Snapshot
|
|
117
|
+
snapshot?: Snapshot,
|
|
118
|
+
/** What the server's draft starts from; see `ValDraft.base`. */
|
|
119
|
+
base?: Snapshot) => () => Promise<ValDraft | null>;
|
|
111
120
|
declare const initFetchValRouteStega: (config: ValConfig, valApiEndpoints: string, valServerPromise: Promise<RouteReaderValServer>, isEnabled: () => Promise<boolean>, getHeaders: () => Promise<{
|
|
112
121
|
get(name: string): string | null;
|
|
113
122
|
}>, getCookies: () => Promise<{
|
|
@@ -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-c5862191.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');
|
|
@@ -1005,6 +1005,16 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1005
1005
|
*/
|
|
1006
1006
|
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
1007
1007
|
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
1008
|
+
/*
|
|
1009
|
+
* The base the Studio's overlay must start from, where it is not the
|
|
1010
|
+
* bundle's (`ValDraft.base`): set while rendering, not in an effect, so it
|
|
1011
|
+
* is in place before the overlay -- loaded after this page hydrates -- takes
|
|
1012
|
+
* its modules in. The same value every render, from a ref, so writing it
|
|
1013
|
+
* again is harmless.
|
|
1014
|
+
*/
|
|
1015
|
+
if (typeof window !== "undefined") {
|
|
1016
|
+
window.__VAL_BASE__ = hasDraft ? initialDraft.base : undefined;
|
|
1017
|
+
}
|
|
1008
1018
|
// TODO: move below into react package
|
|
1009
1019
|
var valStore = React__default["default"].useMemo(function () {
|
|
1010
1020
|
var store = new ValOverlayContext.ValExternalStore();
|
|
@@ -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-efacbb53.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');
|
|
@@ -1005,6 +1005,16 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
1005
1005
|
*/
|
|
1006
1006
|
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
1007
1007
|
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
1008
|
+
/*
|
|
1009
|
+
* The base the Studio's overlay must start from, where it is not the
|
|
1010
|
+
* bundle's (`ValDraft.base`): set while rendering, not in an effect, so it
|
|
1011
|
+
* is in place before the overlay -- loaded after this page hydrates -- takes
|
|
1012
|
+
* its modules in. The same value every render, from a ref, so writing it
|
|
1013
|
+
* again is harmless.
|
|
1014
|
+
*/
|
|
1015
|
+
if (typeof window !== "undefined") {
|
|
1016
|
+
window.__VAL_BASE__ = hasDraft ? initialDraft.base : undefined;
|
|
1017
|
+
}
|
|
1008
1018
|
// TODO: move below into react package
|
|
1009
1019
|
var valStore = React__default["default"].useMemo(function () {
|
|
1010
1020
|
var store = new ValOverlayContext.ValExternalStore();
|
|
@@ -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-e43bf6e6.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';
|
|
@@ -981,6 +981,16 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
|
|
|
981
981
|
*/
|
|
982
982
|
var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
|
|
983
983
|
var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
|
|
984
|
+
/*
|
|
985
|
+
* The base the Studio's overlay must start from, where it is not the
|
|
986
|
+
* bundle's (`ValDraft.base`): set while rendering, not in an effect, so it
|
|
987
|
+
* is in place before the overlay -- loaded after this page hydrates -- takes
|
|
988
|
+
* its modules in. The same value every render, from a ref, so writing it
|
|
989
|
+
* again is harmless.
|
|
990
|
+
*/
|
|
991
|
+
if (typeof window !== "undefined") {
|
|
992
|
+
window.__VAL_BASE__ = hasDraft ? initialDraft.base : undefined;
|
|
993
|
+
}
|
|
984
994
|
// TODO: move below into react package
|
|
985
995
|
var valStore = React.useMemo(function () {
|
|
986
996
|
var store = new ValExternalStore();
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"tanstack-router",
|
|
15
15
|
"react"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.144.
|
|
17
|
+
"version": "0.144.3",
|
|
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.144.0",
|
|
46
|
-
"@valbuild/language-server": "0.144.
|
|
47
|
-
"@valbuild/mcp": "0.144.
|
|
48
|
-
"@valbuild/react": "0.144.
|
|
49
|
-
"@valbuild/server": "0.144.
|
|
46
|
+
"@valbuild/language-server": "0.144.3",
|
|
47
|
+
"@valbuild/mcp": "0.144.3",
|
|
48
|
+
"@valbuild/react": "0.144.3",
|
|
49
|
+
"@valbuild/server": "0.144.3",
|
|
50
50
|
"@valbuild/shared": "0.144.2",
|
|
51
|
-
"@valbuild/ui": "0.144.
|
|
51
|
+
"@valbuild/ui": "0.144.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@tanstack/react-router": "^1.170.41",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = require('../../dist/version-
|
|
5
|
+
var version = require('../../dist/version-c5862191.cjs.dev.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-4497beef.cjs.dev.js');
|
|
8
8
|
var server = require('@valbuild/server');
|
|
@@ -642,6 +642,17 @@ function snapshotForReaders(http) {
|
|
|
642
642
|
return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
/**
|
|
646
|
+
* What the server's own draft starts from, where it is not the bundle's: the
|
|
647
|
+
* layers `ValOpsHttp` puts over it (`siteSnapshotSources`, then
|
|
648
|
+
* `snapshotSources`), in the same form, so the Studio that starts from it
|
|
649
|
+
* holds the base the server reports. See `ValDraft.base`.
|
|
650
|
+
*/
|
|
651
|
+
function draftBase(http) {
|
|
652
|
+
var layered = server.layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
|
|
653
|
+
return layered !== undefined ? server.proposalSnapshot(layered) : undefined;
|
|
654
|
+
}
|
|
655
|
+
|
|
645
656
|
/**
|
|
646
657
|
* Where an isolate says which content version it applied, for the platform
|
|
647
658
|
* serving it to read back after a render (valbuild/home: the loader answers it
|
|
@@ -676,7 +687,7 @@ function markContentApplied(http) {
|
|
|
676
687
|
* a draft page was rendered as the published site and only then replaced, in
|
|
677
688
|
* the browser, by what the editor holds -- old text first on every load.
|
|
678
689
|
*/
|
|
679
|
-
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot) {
|
|
690
|
+
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot, base) {
|
|
680
691
|
return /*#__PURE__*/version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee3() {
|
|
681
692
|
var onlySnapshot, _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source, _t6, _t7, _t8, _t9, _t0;
|
|
682
693
|
return version._regenerator().w(function (_context3) {
|
|
@@ -763,10 +774,12 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
763
774
|
_context3.n = 11;
|
|
764
775
|
break;
|
|
765
776
|
case 15:
|
|
766
|
-
return _context3.a(2, createForOfIteratorHelper._objectSpread2({
|
|
777
|
+
return _context3.a(2, createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({
|
|
767
778
|
sources: sources
|
|
768
779
|
}, snapshot !== undefined ? {
|
|
769
780
|
snapshot: snapshot
|
|
781
|
+
} : {}), base !== undefined ? {
|
|
782
|
+
base: base
|
|
770
783
|
} : {}));
|
|
771
784
|
case 16:
|
|
772
785
|
_context3.p = 16;
|
|
@@ -1556,6 +1569,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1556
1569
|
}
|
|
1557
1570
|
var draftSourcesScope = createTanStackRequestScope();
|
|
1558
1571
|
var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1572
|
+
var base = draftBase(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1559
1573
|
markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1560
1574
|
var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
|
|
1561
1575
|
var isEnabled = function isEnabled() {
|
|
@@ -1589,7 +1603,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1589
1603
|
fetchValKeyStega: initFetchValKeyStega(valServerPromise, isEnabled, requestCookies, snapshot),
|
|
1590
1604
|
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1591
1605
|
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1592
|
-
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot)
|
|
1606
|
+
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot, base)
|
|
1593
1607
|
};
|
|
1594
1608
|
}
|
|
1595
1609
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = require('../../dist/version-
|
|
5
|
+
var version = require('../../dist/version-efacbb53.cjs.prod.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
|
|
8
8
|
var server = require('@valbuild/server');
|
|
@@ -642,6 +642,17 @@ function snapshotForReaders(http) {
|
|
|
642
642
|
return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
/**
|
|
646
|
+
* What the server's own draft starts from, where it is not the bundle's: the
|
|
647
|
+
* layers `ValOpsHttp` puts over it (`siteSnapshotSources`, then
|
|
648
|
+
* `snapshotSources`), in the same form, so the Studio that starts from it
|
|
649
|
+
* holds the base the server reports. See `ValDraft.base`.
|
|
650
|
+
*/
|
|
651
|
+
function draftBase(http) {
|
|
652
|
+
var layered = server.layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
|
|
653
|
+
return layered !== undefined ? server.proposalSnapshot(layered) : undefined;
|
|
654
|
+
}
|
|
655
|
+
|
|
645
656
|
/**
|
|
646
657
|
* Where an isolate says which content version it applied, for the platform
|
|
647
658
|
* serving it to read back after a render (valbuild/home: the loader answers it
|
|
@@ -676,7 +687,7 @@ function markContentApplied(http) {
|
|
|
676
687
|
* a draft page was rendered as the published site and only then replaced, in
|
|
677
688
|
* the browser, by what the editor holds -- old text first on every load.
|
|
678
689
|
*/
|
|
679
|
-
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot) {
|
|
690
|
+
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot, base) {
|
|
680
691
|
return /*#__PURE__*/version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee3() {
|
|
681
692
|
var onlySnapshot, _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source, _t6, _t7, _t8, _t9, _t0;
|
|
682
693
|
return version._regenerator().w(function (_context3) {
|
|
@@ -763,10 +774,12 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
763
774
|
_context3.n = 11;
|
|
764
775
|
break;
|
|
765
776
|
case 15:
|
|
766
|
-
return _context3.a(2, createForOfIteratorHelper._objectSpread2({
|
|
777
|
+
return _context3.a(2, createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({
|
|
767
778
|
sources: sources
|
|
768
779
|
}, snapshot !== undefined ? {
|
|
769
780
|
snapshot: snapshot
|
|
781
|
+
} : {}), base !== undefined ? {
|
|
782
|
+
base: base
|
|
770
783
|
} : {}));
|
|
771
784
|
case 16:
|
|
772
785
|
_context3.p = 16;
|
|
@@ -1556,6 +1569,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1556
1569
|
}
|
|
1557
1570
|
var draftSourcesScope = createTanStackRequestScope();
|
|
1558
1571
|
var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1572
|
+
var base = draftBase(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1559
1573
|
markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1560
1574
|
var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
|
|
1561
1575
|
var isEnabled = function isEnabled() {
|
|
@@ -1589,7 +1603,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1589
1603
|
fetchValKeyStega: initFetchValKeyStega(valServerPromise, isEnabled, requestCookies, snapshot),
|
|
1590
1604
|
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1591
1605
|
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1592
|
-
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot)
|
|
1606
|
+
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot, base)
|
|
1593
1607
|
};
|
|
1594
1608
|
}
|
|
1595
1609
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as _asyncToGenerator, a as _regenerator, V as VERSION, s as setValEnableCookieReader } from '../../dist/version-
|
|
1
|
+
import { _ as _asyncToGenerator, a as _regenerator, V as VERSION, s as setValEnableCookieReader } from '../../dist/version-e43bf6e6.esm.js';
|
|
2
2
|
import { Internal } from '@valbuild/core';
|
|
3
3
|
import { _ as _objectSpread2, a as _slicedToArray, e as _arrayLikeToArray, f as _unsupportedIterableToArray, b as _createForOfIteratorHelper, d as _defineProperty } from '../../dist/createForOfIteratorHelper-93a62170.esm.js';
|
|
4
|
-
import { createValApiRouter, createValServer, layeredSnapshot, proposalSnapshotForReaders } from '@valbuild/server';
|
|
4
|
+
import { createValApiRouter, createValServer, layeredSnapshot, proposalSnapshotForReaders, proposalSnapshot } from '@valbuild/server';
|
|
5
5
|
export { InMemoryPatchStore, createPrettierFormatter } from '@valbuild/server';
|
|
6
6
|
import { _ as _typeof, b as initValRouteFromVal, g as getJsonEntryStegaRoot, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal } from '../../dist/routeFromVal-1221e70d.esm.js';
|
|
7
7
|
import { stegaEncode, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
@@ -621,6 +621,17 @@ function snapshotForReaders(http) {
|
|
|
621
621
|
return source !== undefined ? proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
|
|
622
622
|
}
|
|
623
623
|
|
|
624
|
+
/**
|
|
625
|
+
* What the server's own draft starts from, where it is not the bundle's: the
|
|
626
|
+
* layers `ValOpsHttp` puts over it (`siteSnapshotSources`, then
|
|
627
|
+
* `snapshotSources`), in the same form, so the Studio that starts from it
|
|
628
|
+
* holds the base the server reports. See `ValDraft.base`.
|
|
629
|
+
*/
|
|
630
|
+
function draftBase(http) {
|
|
631
|
+
var layered = layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
|
|
632
|
+
return layered !== undefined ? proposalSnapshot(layered) : undefined;
|
|
633
|
+
}
|
|
634
|
+
|
|
624
635
|
/**
|
|
625
636
|
* Where an isolate says which content version it applied, for the platform
|
|
626
637
|
* serving it to read back after a render (valbuild/home: the loader answers it
|
|
@@ -655,7 +666,7 @@ function markContentApplied(http) {
|
|
|
655
666
|
* a draft page was rendered as the published site and only then replaced, in
|
|
656
667
|
* the browser, by what the editor holds -- old text first on every load.
|
|
657
668
|
*/
|
|
658
|
-
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot) {
|
|
669
|
+
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot, base) {
|
|
659
670
|
return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
660
671
|
var onlySnapshot, _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source, _t6, _t7, _t8, _t9, _t0;
|
|
661
672
|
return _regenerator().w(function (_context3) {
|
|
@@ -742,10 +753,12 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
742
753
|
_context3.n = 11;
|
|
743
754
|
break;
|
|
744
755
|
case 15:
|
|
745
|
-
return _context3.a(2, _objectSpread2({
|
|
756
|
+
return _context3.a(2, _objectSpread2(_objectSpread2({
|
|
746
757
|
sources: sources
|
|
747
758
|
}, snapshot !== undefined ? {
|
|
748
759
|
snapshot: snapshot
|
|
760
|
+
} : {}), base !== undefined ? {
|
|
761
|
+
base: base
|
|
749
762
|
} : {}));
|
|
750
763
|
case 16:
|
|
751
764
|
_context3.p = 16;
|
|
@@ -1535,6 +1548,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1535
1548
|
}
|
|
1536
1549
|
var draftSourcesScope = createTanStackRequestScope();
|
|
1537
1550
|
var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1551
|
+
var base = draftBase(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1538
1552
|
markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
|
|
1539
1553
|
var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
|
|
1540
1554
|
var isEnabled = function isEnabled() {
|
|
@@ -1568,7 +1582,7 @@ function initValContent(config, valModules, opts) {
|
|
|
1568
1582
|
fetchValKeyStega: initFetchValKeyStega(valServerPromise, isEnabled, requestCookies, snapshot),
|
|
1569
1583
|
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1570
1584
|
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope, snapshot),
|
|
1571
|
-
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot)
|
|
1585
|
+
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope, snapshot, base)
|
|
1572
1586
|
};
|
|
1573
1587
|
}
|
|
1574
1588
|
|