@valbuild/tanstack 0.148.1 → 0.148.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 +86 -0
- package/README.md +53 -0
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +12 -4
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +12 -4
- package/client/dist/valbuild-tanstack-client.esm.js +12 -4
- package/dist/{ValOverlayContext-510328ec.cjs.dev.js → ValOverlayContext-198b4bd1.cjs.dev.js} +4 -1
- package/dist/{ValOverlayContext-6278320b.esm.js → ValOverlayContext-6411bbe3.esm.js} +4 -1
- package/dist/{ValOverlayContext-d3acd157.cjs.prod.js → ValOverlayContext-d9b22d1a.cjs.prod.js} +4 -1
- package/dist/declarations/src/ValAnalytics.d.ts +23 -0
- package/dist/declarations/src/ValApp.d.ts +6 -1
- package/dist/declarations/src/ValProvider.d.ts +1 -0
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +3 -0
- package/dist/declarations/src/server/index.d.ts +1 -0
- package/dist/{routeFromVal-0ea4586f.cjs.dev.js → routeFromVal-2f65a4fc.cjs.dev.js} +11 -11
- package/dist/{routeFromVal-9f1f8725.esm.js → routeFromVal-40cd8a5b.esm.js} +11 -11
- package/dist/{routeFromVal-97a52f43.cjs.prod.js → routeFromVal-a13ac8a3.cjs.prod.js} +11 -11
- package/dist/valbuild-tanstack.cjs.dev.js +115 -28
- package/dist/valbuild-tanstack.cjs.prod.js +115 -28
- package/dist/valbuild-tanstack.esm.js +115 -28
- package/dist/{version-684beca4.cjs.prod.js → version-4353b65f.cjs.prod.js} +1 -1
- package/dist/{version-a77659ce.esm.js → version-79ab0f75.esm.js} +1 -1
- package/dist/{version-fd860c4b.cjs.dev.js → version-f0497731.cjs.dev.js} +1 -1
- package/package.json +8 -8
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +10 -10
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +10 -10
- package/server/dist/valbuild-tanstack-server.esm.js +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.148.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#881](https://github.com/valbuild/val/pull/881) [`0139436`](https://github.com/valbuild/val/commit/0139436426142d91cbb29ec6c696dfb86f34ab9d) Thanks [@freekh](https://github.com/freekh)! - The content analytics script. With analytics on (it is off by default, and turned on in a hosted project's settings), a TanStack site counts which content each visitor's page **rendered** and which they actually **viewed** (at least half on screen for a second), and sends it to `/api/val/analytics`.
|
|
8
|
+
|
|
9
|
+
- No cookies, no storage, no visitor IDs. Each page view also says where it came from (the referring site's host and any `utm_source` / `utm_medium` / `utm_campaign`) and whether it was a phone, tablet or desktop.
|
|
10
|
+
- A page is sent as its route's pattern (`/posts/$postId`), never its address, so a path that holds something about one visitor (an order number, a token) is never stored. `startValAnalytics` takes this as `routeFor`; `ValProvider` passes TanStack's matched route.
|
|
11
|
+
- Editors are never counted: nothing is sent in draft mode, in the Studio, with Val enabled, or at a proposal's address, and nothing from automated browsers. A page the browser prerenders counts nothing until it is shown.
|
|
12
|
+
- The script is the new `@valbuild/react/analytics` entry, loaded only for visitors of a site with analytics on, after the page has hydrated. It imports nothing else from Val.
|
|
13
|
+
- Storing the counts and showing them is part of Val's hosting, which takes these beacons before they reach the site. Anywhere else, `/api/val/analytics` checks each beacon and stores nothing; in local development, with `VAL_DEBUG=1`, it logs a line per beacon, so you can see it working.
|
|
14
|
+
- `ValProvider`'s Studio check now matches `/val` and what is below it only, not every route starting with those letters (`/values`). The same fix is in `@valbuild/next`.
|
|
15
|
+
|
|
16
|
+
- [#887](https://github.com/valbuild/val/pull/887) [`eaa77e0`](https://github.com/valbuild/val/commit/eaa77e0e5028b113037e76722e25e342a8301032) Thanks [@freekh](https://github.com/freekh)! - Content analytics records the content version each page was rendered from. `<ValProvider analytics>` takes a `ValAnalytics` -- `{ enabled, contentVersion? }` -- and the `val.server.ts` Val's hosting writes returns one from `fetchValAnalytics()`, with the id of the content version the platform is serving. Every beacon carries it as `cv`, so counts can be compared across a publish. The site layout passes `fetchValAnalytics()` to the provider exactly as before.
|
|
17
|
+
|
|
18
|
+
- [#878](https://github.com/valbuild/val/pull/878) [`4d862ce`](https://github.com/valbuild/val/commit/4d862cec40288ecbc415c3c3b8d792ddd6bc1ca3) Thanks [@freekh](https://github.com/freekh)! - TanStack Start: a new analytics mode, the first step towards content analytics. It is off by default. With `<ValProvider analytics>`, content read with the hooks (`useVal`, `useValRoute`, `useValKey`) is tagged for every visitor, not only in draft mode, so each element showing content carries a `data-val-path`. The tags are added in the browser after hydration, so the HTML the server sends is unchanged and a crawler that does not run the page never sees them.
|
|
19
|
+
|
|
20
|
+
On a site hosted by Val, analytics is a project setting: the owner turns it on in the project's settings, and the `val.server.ts` the platform writes now exports `fetchValAnalytics()` to read it. Pass it to the provider from the site layout's loader, beside `fetchValDraft()`; see the README.
|
|
21
|
+
|
|
22
|
+
- [#896](https://github.com/valbuild/val/pull/896) [`5eff8a0`](https://github.com/valbuild/val/commit/5eff8a055a4ef50d476797c28f9c3e50deb73c89) Thanks [@freekh](https://github.com/freekh)! - A demo's tour can now be written by the site: `<ValApp demo={{ tour }}>`, with each step as data (`ValDemoTourStep`), so what it says changes with the site rather than with a Val release.
|
|
23
|
+
|
|
24
|
+
It is drawn as a ring around what a step is about, with nothing dimmed and the Studio usable underneath, and a step can move on by itself once the visitor has done what it asks:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const tour: ValDemoTourStep[] = [
|
|
28
|
+
{
|
|
29
|
+
id: "click",
|
|
30
|
+
title: "This is Val",
|
|
31
|
+
body: "Click the heading on the page.",
|
|
32
|
+
target: "canvas",
|
|
33
|
+
page: HEADING, // outlined on the page
|
|
34
|
+
moveOn: { open: HEADING },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "type",
|
|
38
|
+
title: "Change a word",
|
|
39
|
+
body: "The page changes as you type.",
|
|
40
|
+
field: HEADING, // ringed wherever the field is shown
|
|
41
|
+
moveOn: {
|
|
42
|
+
edit: true,
|
|
43
|
+
path: HEADING,
|
|
44
|
+
value: "Coffee, roasted this weekend",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A step that moves on has **Do it for me**, which does it the way the Studio would, and **Skip**. On a phone the card is a sheet along the bottom. The Studio's own tour is unchanged.
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [[`0139436`](https://github.com/valbuild/val/commit/0139436426142d91cbb29ec6c696dfb86f34ab9d), [`5eff8a0`](https://github.com/valbuild/val/commit/5eff8a055a4ef50d476797c28f9c3e50deb73c89)]:
|
|
53
|
+
- @valbuild/react@0.148.3
|
|
54
|
+
- @valbuild/shared@0.148.3
|
|
55
|
+
- @valbuild/server@0.148.3
|
|
56
|
+
- @valbuild/ui@0.148.3
|
|
57
|
+
- @valbuild/language-server@0.148.3
|
|
58
|
+
- @valbuild/mcp@0.148.3
|
|
59
|
+
|
|
60
|
+
## 0.148.2
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- [#892](https://github.com/valbuild/val/pull/892) [`6f1eca1`](https://github.com/valbuild/val/commit/6f1eca14cd924bc7aa9cc573c690f8386b1d91bb) Thanks [@freekh](https://github.com/freekh)! - `<ValApp demo>` no longer says "This demo was built without its content" now and again, on a build that has its content. The demo started Val's server before `<ValModulesClient>` had registered the modules, and on a page that had the server's code already it read them before they were there. It now starts once `ValApp`'s children are rendered.
|
|
65
|
+
|
|
66
|
+
- [#889](https://github.com/valbuild/val/pull/889) [`dc7c8cc`](https://github.com/valbuild/val/commit/dc7c8ccd82f643e662d00225fabec411b5d39e3a) Thanks [@freekh](https://github.com/freekh)! - Val is quieter in your app's console. Errors and warnings you can act on still
|
|
67
|
+
print, now prefixed with `[val]` so you can filter them. Val's own debug
|
|
68
|
+
output, which used to reach your terminal and browser console, is now off by
|
|
69
|
+
default. That includes the `Invalid JWT` line that printed on every request
|
|
70
|
+
with an expired session cookie, the "verifying draft mode" and polling notices,
|
|
71
|
+
and the Studio's sync and WebSocket chatter.
|
|
72
|
+
|
|
73
|
+
To turn the debug output back on, for example when reporting a bug:
|
|
74
|
+
|
|
75
|
+
- on the server, set `VAL_DEBUG=1`
|
|
76
|
+
- in the browser, run `localStorage.setItem("val:debug", "1")` in the console.
|
|
77
|
+
It takes effect immediately, with no reload. Remove the key to turn it off
|
|
78
|
+
again.
|
|
79
|
+
|
|
80
|
+
- Updated dependencies [[`dc7c8cc`](https://github.com/valbuild/val/commit/dc7c8ccd82f643e662d00225fabec411b5d39e3a)]:
|
|
81
|
+
- @valbuild/core@0.148.2
|
|
82
|
+
- @valbuild/shared@0.148.2
|
|
83
|
+
- @valbuild/server@0.148.2
|
|
84
|
+
- @valbuild/react@0.148.2
|
|
85
|
+
- @valbuild/ui@0.148.2
|
|
86
|
+
- @valbuild/language-server@0.148.2
|
|
87
|
+
- @valbuild/mcp@0.148.2
|
|
88
|
+
|
|
3
89
|
## 0.148.1
|
|
4
90
|
|
|
5
91
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -381,6 +381,58 @@ nothing for it. It needs React 19 and a `<Suspense>` boundary (see above). With
|
|
|
381
381
|
`draft` given, the server already has that page's content, so its first render
|
|
382
382
|
does not 404 either.
|
|
383
383
|
|
|
384
|
+
## Content analytics
|
|
385
|
+
|
|
386
|
+
Val can count which content your visitors see, on a site Val hosts. It is
|
|
387
|
+
**off by default**, and a setting of the hosted project rather than of the
|
|
388
|
+
code: the owner turns it on in the project's settings, and Val's hosting hands
|
|
389
|
+
it to the site as the `VAL_ANALYTICS` variable, along with the id of the
|
|
390
|
+
content version each page is rendered from. The `val.server.ts` the platform
|
|
391
|
+
writes for a hosted project exports `fetchValAnalytics()`, which reads both
|
|
392
|
+
into a `ValAnalytics`; pass that to the provider from the same loader as the
|
|
393
|
+
draft:
|
|
394
|
+
|
|
395
|
+
```tsx
|
|
396
|
+
// src/routes/_site.tsx
|
|
397
|
+
const getValPage = createServerFn().handler(async () => {
|
|
398
|
+
const [draft, analytics] = await Promise.all([
|
|
399
|
+
fetchValDraft(),
|
|
400
|
+
fetchValAnalytics(),
|
|
401
|
+
]);
|
|
402
|
+
return { draft, analytics };
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
function SiteLayout() {
|
|
406
|
+
const page = Route.useLoaderData();
|
|
407
|
+
return (
|
|
408
|
+
<ValProvider
|
|
409
|
+
config={config}
|
|
410
|
+
suspend
|
|
411
|
+
draft={page?.draft}
|
|
412
|
+
analytics={page?.analytics}
|
|
413
|
+
>
|
|
414
|
+
{/* ... */}
|
|
415
|
+
</ValProvider>
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
With it on, content read with the hooks is tagged for every visitor after
|
|
421
|
+
hydration, so each element showing content carries a `data-val-path` to count.
|
|
422
|
+
The HTML the server sends is the same with it on or off. A small script,
|
|
423
|
+
loaded after hydration, then counts what each page rendered and what was on
|
|
424
|
+
screen, and sends it to `/api/val/analytics` with the content version, so a
|
|
425
|
+
page can be compared before and after a publish. No cookies, no storage and no
|
|
426
|
+
visitor IDs, and nothing is sent in draft mode, in the Studio or from an
|
|
427
|
+
automated browser.
|
|
428
|
+
|
|
429
|
+
`fetchValAnalytics` is not part of `initValContent`: it exists in the file the
|
|
430
|
+
platform writes, and nowhere else. A site Val does not host has nowhere to send
|
|
431
|
+
counts yet, so it leaves `analytics` out. To see the mode working in local
|
|
432
|
+
development, write your own -- `examples/tanstack/src/val/server.ts` reads
|
|
433
|
+
`VAL_ANALYTICS` from `process.env`, which TanStack Start fills from
|
|
434
|
+
`.env.development`.
|
|
435
|
+
|
|
384
436
|
## Images
|
|
385
437
|
|
|
386
438
|
`ValImage` is a plain `<img>` that keeps the edit tags where the Studio can see
|
|
@@ -417,6 +469,7 @@ SDK of your choice. See [`@valbuild/mcp`](https://www.npmjs.com/package/@valbuil
|
|
|
417
469
|
| `ValImage` wraps `next/image` | `ValImage` is an `<img>` |
|
|
418
470
|
| `fetchVal` in a Server Component | hooks in components; `createServerFn` for loaders |
|
|
419
471
|
| client hooks render published SSR | `ValProvider draft` renders the draft during SSR |
|
|
472
|
+
| no content analytics yet | `ValProvider analytics` (hosted projects only) |
|
|
420
473
|
|
|
421
474
|
## Schema reference
|
|
422
475
|
|
|
@@ -6,8 +6,8 @@ var _typeof = require('../../dist/typeof-dd0246a1.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-
|
|
10
|
-
var routeFromVal = require('../../dist/routeFromVal-
|
|
9
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-198b4bd1.cjs.dev.js');
|
|
10
|
+
var routeFromVal = require('../../dist/routeFromVal-2f65a4fc.cjs.dev.js');
|
|
11
11
|
require('@valbuild/core/patch');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
13
|
require('@valbuild/shared/client');
|
|
@@ -46,6 +46,11 @@ function useHydrated() {
|
|
|
46
46
|
* the draft text goes out without them, and the render React does right after
|
|
47
47
|
* hydrating the component puts them in.
|
|
48
48
|
*
|
|
49
|
+
* With analytics on and draft mode off, the same rule for every visitor: no
|
|
50
|
+
* tags on the server or while hydrating, tags from the render after. So the
|
|
51
|
+
* HTML a visitor is sent, prerendered or not, is the same with analytics on or
|
|
52
|
+
* off, and no edit tag ever reaches a crawler that does not run the page.
|
|
53
|
+
*
|
|
49
54
|
* Because JSX auto-tagging turns a tagged string into a `data-val-path`
|
|
50
55
|
* attribute as the element is created, and the switch for it is process-wide.
|
|
51
56
|
* The server cannot be relied on to tag (whether the patched JSX runtime is
|
|
@@ -57,7 +62,10 @@ function useHydrated() {
|
|
|
57
62
|
*/
|
|
58
63
|
function useEncodesEditTags(context) {
|
|
59
64
|
var hydrated = useHydrated();
|
|
60
|
-
|
|
65
|
+
if (context.draftMode) {
|
|
66
|
+
return !context.serverDraft || hydrated;
|
|
67
|
+
}
|
|
68
|
+
return !!context.analytics && hydrated;
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -336,7 +344,7 @@ function resolveParams(params) {
|
|
|
336
344
|
// diagnosable error instead of a cryptic `TypeError: React.use is not a
|
|
337
345
|
// function`. Callers treat null as the error sentinel.
|
|
338
346
|
if (!("use" in React__default["default"])) {
|
|
339
|
-
|
|
347
|
+
core.Internal.log.error("useValRoute received a Promise params argument but React.use is unavailable. Upgrade to React 19+ or pre-resolve the promise before passing it.");
|
|
340
348
|
return null;
|
|
341
349
|
}
|
|
342
350
|
return React__default["default"].use(params);
|
|
@@ -6,8 +6,8 @@ var _typeof = require('../../dist/typeof-8998e126.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-
|
|
10
|
-
var routeFromVal = require('../../dist/routeFromVal-
|
|
9
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-d9b22d1a.cjs.prod.js');
|
|
10
|
+
var routeFromVal = require('../../dist/routeFromVal-a13ac8a3.cjs.prod.js');
|
|
11
11
|
require('@valbuild/core/patch');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
13
|
require('@valbuild/shared/client');
|
|
@@ -46,6 +46,11 @@ function useHydrated() {
|
|
|
46
46
|
* the draft text goes out without them, and the render React does right after
|
|
47
47
|
* hydrating the component puts them in.
|
|
48
48
|
*
|
|
49
|
+
* With analytics on and draft mode off, the same rule for every visitor: no
|
|
50
|
+
* tags on the server or while hydrating, tags from the render after. So the
|
|
51
|
+
* HTML a visitor is sent, prerendered or not, is the same with analytics on or
|
|
52
|
+
* off, and no edit tag ever reaches a crawler that does not run the page.
|
|
53
|
+
*
|
|
49
54
|
* Because JSX auto-tagging turns a tagged string into a `data-val-path`
|
|
50
55
|
* attribute as the element is created, and the switch for it is process-wide.
|
|
51
56
|
* The server cannot be relied on to tag (whether the patched JSX runtime is
|
|
@@ -57,7 +62,10 @@ function useHydrated() {
|
|
|
57
62
|
*/
|
|
58
63
|
function useEncodesEditTags(context) {
|
|
59
64
|
var hydrated = useHydrated();
|
|
60
|
-
|
|
65
|
+
if (context.draftMode) {
|
|
66
|
+
return !context.serverDraft || hydrated;
|
|
67
|
+
}
|
|
68
|
+
return !!context.analytics && hydrated;
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -336,7 +344,7 @@ function resolveParams(params) {
|
|
|
336
344
|
// diagnosable error instead of a cryptic `TypeError: React.use is not a
|
|
337
345
|
// function`. Callers treat null as the error sentinel.
|
|
338
346
|
if (!("use" in React__default["default"])) {
|
|
339
|
-
|
|
347
|
+
core.Internal.log.error("useValRoute received a Promise params argument but React.use is unavailable. Upgrade to React 19+ or pre-resolve the promise before passing it.");
|
|
340
348
|
return null;
|
|
341
349
|
}
|
|
342
350
|
return React__default["default"].use(params);
|
|
@@ -2,8 +2,8 @@ import { c as _typeof } from '../../dist/typeof-66e2d869.esm.js';
|
|
|
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-
|
|
6
|
-
import { j as jsonValuesRecordToFill, f as fillJsonValuesRecord, g as getJsonEntryStegaRoot, b as bundledJsonEntryImport, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal, c as initValRouteFromVal } from '../../dist/routeFromVal-
|
|
5
|
+
import { u as useValOverlayContext } from '../../dist/ValOverlayContext-6411bbe3.esm.js';
|
|
6
|
+
import { j as jsonValuesRecordToFill, f as fillJsonValuesRecord, g as getJsonEntryStegaRoot, b as bundledJsonEntryImport, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal, c as initValRouteFromVal } from '../../dist/routeFromVal-40cd8a5b.esm.js';
|
|
7
7
|
import '@valbuild/core/patch';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
9
|
import '@valbuild/shared/client';
|
|
@@ -38,6 +38,11 @@ function useHydrated() {
|
|
|
38
38
|
* the draft text goes out without them, and the render React does right after
|
|
39
39
|
* hydrating the component puts them in.
|
|
40
40
|
*
|
|
41
|
+
* With analytics on and draft mode off, the same rule for every visitor: no
|
|
42
|
+
* tags on the server or while hydrating, tags from the render after. So the
|
|
43
|
+
* HTML a visitor is sent, prerendered or not, is the same with analytics on or
|
|
44
|
+
* off, and no edit tag ever reaches a crawler that does not run the page.
|
|
45
|
+
*
|
|
41
46
|
* Because JSX auto-tagging turns a tagged string into a `data-val-path`
|
|
42
47
|
* attribute as the element is created, and the switch for it is process-wide.
|
|
43
48
|
* The server cannot be relied on to tag (whether the patched JSX runtime is
|
|
@@ -49,7 +54,10 @@ function useHydrated() {
|
|
|
49
54
|
*/
|
|
50
55
|
function useEncodesEditTags(context) {
|
|
51
56
|
var hydrated = useHydrated();
|
|
52
|
-
|
|
57
|
+
if (context.draftMode) {
|
|
58
|
+
return !context.serverDraft || hydrated;
|
|
59
|
+
}
|
|
60
|
+
return !!context.analytics && hydrated;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
/** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
|
|
@@ -328,7 +336,7 @@ function resolveParams(params) {
|
|
|
328
336
|
// diagnosable error instead of a cryptic `TypeError: React.use is not a
|
|
329
337
|
// function`. Callers treat null as the error sentinel.
|
|
330
338
|
if (!("use" in React)) {
|
|
331
|
-
|
|
339
|
+
Internal.log.error("useValRoute received a Promise params argument but React.use is unavailable. Upgrade to React 19+ or pre-resolve the promise before passing it.");
|
|
332
340
|
return null;
|
|
333
341
|
}
|
|
334
342
|
return React.use(params);
|
package/dist/{ValOverlayContext-510328ec.cjs.dev.js → ValOverlayContext-198b4bd1.cjs.dev.js}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _typeof = require('./typeof-dd0246a1.cjs.dev.js');
|
|
4
|
+
var core = require('@valbuild/core');
|
|
4
5
|
var patch = require('@valbuild/core/patch');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -156,7 +157,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
156
157
|
var missing = paths.filter(function (p) {
|
|
157
158
|
return !_this.loadedSources.has(p);
|
|
158
159
|
});
|
|
159
|
-
|
|
160
|
+
core.Internal.log.error("draft module(s) did not load within ".concat(LOAD_TIMEOUT_MS, "ms; rendering with partial data. Missing: ").concat(missing.join(", ")));
|
|
160
161
|
cleanup();
|
|
161
162
|
resolve();
|
|
162
163
|
}, LOAD_TIMEOUT_MS);
|
|
@@ -274,6 +275,7 @@ function ValOverlayProvider(_ref) {
|
|
|
274
275
|
draftModeReady = _ref.draftModeReady,
|
|
275
276
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
276
277
|
serverDraft = _ref.serverDraft,
|
|
278
|
+
analytics = _ref.analytics,
|
|
277
279
|
snapshot = _ref.snapshot,
|
|
278
280
|
children = _ref.children;
|
|
279
281
|
return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
|
|
@@ -284,6 +286,7 @@ function ValOverlayProvider(_ref) {
|
|
|
284
286
|
draftModeReady: draftModeReady,
|
|
285
287
|
draftSourcesSynced: draftSourcesSynced,
|
|
286
288
|
serverDraft: serverDraft,
|
|
289
|
+
analytics: analytics,
|
|
287
290
|
snapshot: snapshot
|
|
288
291
|
},
|
|
289
292
|
children: children
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { f as _toPropertyKey, b as _createForOfIteratorHelper, g as _defineProperty } from './typeof-66e2d869.esm.js';
|
|
2
|
+
import { Internal } from '@valbuild/core';
|
|
2
3
|
import { deepEqual } from '@valbuild/core/patch';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -150,7 +151,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
150
151
|
var missing = paths.filter(function (p) {
|
|
151
152
|
return !_this.loadedSources.has(p);
|
|
152
153
|
});
|
|
153
|
-
|
|
154
|
+
Internal.log.error("draft module(s) did not load within ".concat(LOAD_TIMEOUT_MS, "ms; rendering with partial data. Missing: ").concat(missing.join(", ")));
|
|
154
155
|
cleanup();
|
|
155
156
|
resolve();
|
|
156
157
|
}, LOAD_TIMEOUT_MS);
|
|
@@ -268,6 +269,7 @@ function ValOverlayProvider(_ref) {
|
|
|
268
269
|
draftModeReady = _ref.draftModeReady,
|
|
269
270
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
270
271
|
serverDraft = _ref.serverDraft,
|
|
272
|
+
analytics = _ref.analytics,
|
|
271
273
|
snapshot = _ref.snapshot,
|
|
272
274
|
children = _ref.children;
|
|
273
275
|
return /*#__PURE__*/jsx(ValOverlayContext.Provider, {
|
|
@@ -278,6 +280,7 @@ function ValOverlayProvider(_ref) {
|
|
|
278
280
|
draftModeReady: draftModeReady,
|
|
279
281
|
draftSourcesSynced: draftSourcesSynced,
|
|
280
282
|
serverDraft: serverDraft,
|
|
283
|
+
analytics: analytics,
|
|
281
284
|
snapshot: snapshot
|
|
282
285
|
},
|
|
283
286
|
children: children
|
package/dist/{ValOverlayContext-d3acd157.cjs.prod.js → ValOverlayContext-d9b22d1a.cjs.prod.js}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _typeof = require('./typeof-8998e126.cjs.prod.js');
|
|
4
|
+
var core = require('@valbuild/core');
|
|
4
5
|
var patch = require('@valbuild/core/patch');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -156,7 +157,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
156
157
|
var missing = paths.filter(function (p) {
|
|
157
158
|
return !_this.loadedSources.has(p);
|
|
158
159
|
});
|
|
159
|
-
|
|
160
|
+
core.Internal.log.error("draft module(s) did not load within ".concat(LOAD_TIMEOUT_MS, "ms; rendering with partial data. Missing: ").concat(missing.join(", ")));
|
|
160
161
|
cleanup();
|
|
161
162
|
resolve();
|
|
162
163
|
}, LOAD_TIMEOUT_MS);
|
|
@@ -274,6 +275,7 @@ function ValOverlayProvider(_ref) {
|
|
|
274
275
|
draftModeReady = _ref.draftModeReady,
|
|
275
276
|
draftSourcesSynced = _ref.draftSourcesSynced,
|
|
276
277
|
serverDraft = _ref.serverDraft,
|
|
278
|
+
analytics = _ref.analytics,
|
|
277
279
|
snapshot = _ref.snapshot,
|
|
278
280
|
children = _ref.children;
|
|
279
281
|
return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
|
|
@@ -284,6 +286,7 @@ function ValOverlayProvider(_ref) {
|
|
|
284
286
|
draftModeReady: draftModeReady,
|
|
285
287
|
draftSourcesSynced: draftSourcesSynced,
|
|
286
288
|
serverDraft: serverDraft,
|
|
289
|
+
analytics: analytics,
|
|
287
290
|
snapshot: snapshot
|
|
288
291
|
},
|
|
289
292
|
children: children
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `<ValProvider analytics>` is handed: whether content analytics is on
|
|
3
|
+
* for this site, and the content version the page is rendered from.
|
|
4
|
+
*
|
|
5
|
+
* Both come from the server, read in the site layout's loader. On a site Val
|
|
6
|
+
* hosts, `fetchValAnalytics()` in the `val.server.ts` the platform writes
|
|
7
|
+
* reads them from what the platform hands each render: the project's
|
|
8
|
+
* `VAL_ANALYTICS` setting, and `VAL_CONTENT_VERSION`, the id of the content
|
|
9
|
+
* version being served.
|
|
10
|
+
*/
|
|
11
|
+
export type ValAnalytics = {
|
|
12
|
+
/** Off unless this says so. */
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The id of the content version this page is rendered from. Every count is
|
|
16
|
+
* stored with it, which is what lets a dashboard compare a page before and
|
|
17
|
+
* after a publish, and name what was at an array position on a given day.
|
|
18
|
+
*
|
|
19
|
+
* Left out where there is no such id -- outside Val's hosting -- and the
|
|
20
|
+
* counts then carry none.
|
|
21
|
+
*/
|
|
22
|
+
contentVersion?: string;
|
|
23
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ValConfig } from "@valbuild/core";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
+
import type { ValDemoOptions } from "@valbuild/shared/internal";
|
|
3
4
|
export declare const ValApp: ({ config, children, demo, }: {
|
|
4
5
|
config: ValConfig;
|
|
5
6
|
children?: ReactNode;
|
|
@@ -15,6 +16,10 @@ export declare const ValApp: ({ config, children, demo, }: {
|
|
|
15
16
|
*
|
|
16
17
|
* Set it from the build -- `demo={import.meta.env.VITE_VAL_DEMO === "true"}`
|
|
17
18
|
* -- never from anything a visitor controls.
|
|
19
|
+
*
|
|
20
|
+
* Options instead of `true` give the demo a tour of the site's own:
|
|
21
|
+
* `demo={{ tour }}`, steps written as data (`ValDemoTourStep`), so what it
|
|
22
|
+
* says changes with the site rather than with a Val release.
|
|
18
23
|
*/
|
|
19
|
-
demo?: boolean;
|
|
24
|
+
demo?: boolean | ValDemoOptions;
|
|
20
25
|
}) => import("react").JSX.Element;
|
|
@@ -16,9 +16,12 @@ export { ValRichText } from "@valbuild/react/internal";
|
|
|
16
16
|
export { type ValEncodedString, type File, type Image, type Video, type RichText, } from "@valbuild/react/stega";
|
|
17
17
|
export { ValProvider } from "./ValProvider.js";
|
|
18
18
|
export type { ValDraft } from "./ValDraft.js";
|
|
19
|
+
export type { ValAnalytics } from "./ValAnalytics.js";
|
|
19
20
|
export { ValImage, type ValImageProps } from "./ValImage.js";
|
|
20
21
|
export { ValVideo, type ValVideoProps } from "./ValVideo.js";
|
|
21
22
|
export { ValApp } from "./ValApp.js";
|
|
23
|
+
/** What `<ValApp demo={{ tour }}>` takes. See `ValDemoTourStep`. */
|
|
24
|
+
export type { ValDemoOptions, ValDemoTourStep, ValDemoTourMoveOn, ValDemoTourTarget, ValDemoTourPanel, } from "@valbuild/shared/internal";
|
|
22
25
|
export { ValModulesClient, useRegisterValModules } from "./ValModulesClient.js";
|
|
23
26
|
import { Internal as InternalCore } from "@valbuild/core";
|
|
24
27
|
import { VERSION } from "./version.js";
|
|
@@ -3,6 +3,7 @@ export { InMemoryPatchStore, type ValPatchStore } from "@valbuild/server";
|
|
|
3
3
|
export type { ValHttpMode } from "./initValServer.js";
|
|
4
4
|
export { initValContent } from "./initValContent.js";
|
|
5
5
|
export type { ValDraft } from "../ValDraft.js";
|
|
6
|
+
export type { ValAnalytics } from "../ValAnalytics.js";
|
|
6
7
|
export { valDraftMode, hasValEnableCookieOnServer, VAL_DRAFT_MODE_COOKIE, type ValDraftMode, } from "./valDraftMode.js";
|
|
7
8
|
export { initValMcp } from "./initValMcp.js";
|
|
8
9
|
export { createPrettierFormatter, type PrettierLike, type ValFormatter, } from "@valbuild/server";
|
|
@@ -162,34 +162,34 @@ schema,
|
|
|
162
162
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
163
|
val) {
|
|
164
164
|
if (!path) {
|
|
165
|
-
|
|
165
|
+
core.Internal.log.error("".concat(methodName, " can only be used with a Val module (details: no Val path found)."));
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
168
|
if (val === null) {
|
|
169
169
|
return null;
|
|
170
170
|
}
|
|
171
171
|
if (_typeof._typeof(val) !== "object") {
|
|
172
|
-
|
|
172
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: expected type object, found ").concat(_typeof._typeof(val), " instead)."));
|
|
173
173
|
return null;
|
|
174
174
|
}
|
|
175
175
|
if (Array.isArray(val)) {
|
|
176
|
-
|
|
176
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: expected type object, found array instead)."));
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
179
179
|
if (!schema) {
|
|
180
|
-
|
|
180
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: no schema found)."));
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
183
|
if (!(schema instanceof core.RecordSchema)) {
|
|
184
|
-
|
|
184
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: schema is not a record)."));
|
|
185
185
|
} else if (!schema["currentRouter"]) {
|
|
186
|
-
|
|
186
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: router is not set)."));
|
|
187
187
|
} else if (schema["currentRouter"].getRouterId() !== core.Internal.tanstackRouter.getRouterId() && schema["currentRouter"].getRouterId() !== core.Internal.externalPageRouter.getRouterId()) {
|
|
188
|
-
|
|
188
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: router is not the TanStack Router or External URL Page Router)."));
|
|
189
189
|
return null;
|
|
190
190
|
}
|
|
191
191
|
if (_typeof._typeof(resolvedParams) !== "object") {
|
|
192
|
-
|
|
192
|
+
core.Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: params is not an object)."));
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
195
|
var _Internal$splitModule = core.Internal.splitModuleFilePathAndModulePath(path),
|
|
@@ -206,7 +206,7 @@ val) {
|
|
|
206
206
|
*/
|
|
207
207
|
var srcFolder = client.getTanStackRouterSourceFolder(moduleFilePath);
|
|
208
208
|
if (!srcFolder) {
|
|
209
|
-
|
|
209
|
+
core.Internal.log.error("".concat(methodName, " was used with a Val module that is not in the /routes or /src/routes folder. Name the module after the route file it belongs to, e.g. /src/routes/posts.$postId.val.ts next to /src/routes/posts.$postId.tsx."));
|
|
210
210
|
return null;
|
|
211
211
|
}
|
|
212
212
|
var pattern = client.getPatternFromModuleFilePath(moduleFilePath, srcFolder);
|
|
@@ -286,11 +286,11 @@ val) {
|
|
|
286
286
|
return "[...".concat(part.paramName, "]");
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
|
-
|
|
289
|
+
core.Internal.log.error("".concat(methodName, " could not find route since parameters: ").concat(errorMessageParams.join(", "), " where not provided. Make sure the Val module is named after the route file it belongs to, e.g. /src/routes/posts.$postId.val.ts next to /src/routes/posts.$postId.tsx."));
|
|
290
290
|
return null;
|
|
291
291
|
}
|
|
292
292
|
if (Object.keys(missingParamKeys).length > 0) {
|
|
293
|
-
|
|
293
|
+
core.Internal.log.error("".concat(methodName, " could not find route since parameters: ").concat(Object.keys(missingParamKeys).join(", "), " where not found in the path of: ").concat(moduleFilePath, ". Make sure ").concat(moduleFilePath, " is named after the route file it belongs to."));
|
|
294
294
|
// We do not return null here since we found a route that matches the path
|
|
295
295
|
// though chances are that there's something wrong in the way ${methodName} is used
|
|
296
296
|
}
|
|
@@ -160,34 +160,34 @@ schema,
|
|
|
160
160
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
161
|
val) {
|
|
162
162
|
if (!path) {
|
|
163
|
-
|
|
163
|
+
Internal.log.error("".concat(methodName, " can only be used with a Val module (details: no Val path found)."));
|
|
164
164
|
return null;
|
|
165
165
|
}
|
|
166
166
|
if (val === null) {
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
169
|
if (_typeof(val) !== "object") {
|
|
170
|
-
|
|
170
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: expected type object, found ").concat(_typeof(val), " instead)."));
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
if (Array.isArray(val)) {
|
|
174
|
-
|
|
174
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: expected type object, found array instead)."));
|
|
175
175
|
return null;
|
|
176
176
|
}
|
|
177
177
|
if (!schema) {
|
|
178
|
-
|
|
178
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: no schema found)."));
|
|
179
179
|
return null;
|
|
180
180
|
}
|
|
181
181
|
if (!(schema instanceof RecordSchema)) {
|
|
182
|
-
|
|
182
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: schema is not a record)."));
|
|
183
183
|
} else if (!schema["currentRouter"]) {
|
|
184
|
-
|
|
184
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: router is not set)."));
|
|
185
185
|
} else if (schema["currentRouter"].getRouterId() !== Internal.tanstackRouter.getRouterId() && schema["currentRouter"].getRouterId() !== Internal.externalPageRouter.getRouterId()) {
|
|
186
|
-
|
|
186
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: router is not the TanStack Router or External URL Page Router)."));
|
|
187
187
|
return null;
|
|
188
188
|
}
|
|
189
189
|
if (_typeof(resolvedParams) !== "object") {
|
|
190
|
-
|
|
190
|
+
Internal.log.error("".concat(methodName, " must be used with a Val Module that is a s.record().router(...) (details: params is not an object)."));
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
193
193
|
var _Internal$splitModule = Internal.splitModuleFilePathAndModulePath(path),
|
|
@@ -204,7 +204,7 @@ val) {
|
|
|
204
204
|
*/
|
|
205
205
|
var srcFolder = getTanStackRouterSourceFolder(moduleFilePath);
|
|
206
206
|
if (!srcFolder) {
|
|
207
|
-
|
|
207
|
+
Internal.log.error("".concat(methodName, " was used with a Val module that is not in the /routes or /src/routes folder. Name the module after the route file it belongs to, e.g. /src/routes/posts.$postId.val.ts next to /src/routes/posts.$postId.tsx."));
|
|
208
208
|
return null;
|
|
209
209
|
}
|
|
210
210
|
var pattern = getPatternFromModuleFilePath(moduleFilePath, srcFolder);
|
|
@@ -284,11 +284,11 @@ val) {
|
|
|
284
284
|
return "[...".concat(part.paramName, "]");
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
|
-
|
|
287
|
+
Internal.log.error("".concat(methodName, " could not find route since parameters: ").concat(errorMessageParams.join(", "), " where not provided. Make sure the Val module is named after the route file it belongs to, e.g. /src/routes/posts.$postId.val.ts next to /src/routes/posts.$postId.tsx."));
|
|
288
288
|
return null;
|
|
289
289
|
}
|
|
290
290
|
if (Object.keys(missingParamKeys).length > 0) {
|
|
291
|
-
|
|
291
|
+
Internal.log.error("".concat(methodName, " could not find route since parameters: ").concat(Object.keys(missingParamKeys).join(", "), " where not found in the path of: ").concat(moduleFilePath, ". Make sure ").concat(moduleFilePath, " is named after the route file it belongs to."));
|
|
292
292
|
// We do not return null here since we found a route that matches the path
|
|
293
293
|
// though chances are that there's something wrong in the way ${methodName} is used
|
|
294
294
|
}
|