netjes 0.0.2 → 0.0.4
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/README.md +13 -11
- package/cli/agents.mjs +25 -2
- package/cli/commands.mjs +56 -6
- package/cli/help.mjs +7 -2
- package/cli/info.mjs +275 -33
- package/cli/routes.mjs +35 -8
- package/cli/scaffold.mjs +31 -4
- package/dist/actions.d.ts +7 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +9 -3
- package/dist/actions.js.map +1 -1
- package/dist/client-entry.d.ts +1 -0
- package/dist/client-entry.d.ts.map +1 -1
- package/dist/client-entry.js +19 -2
- package/dist/client-entry.js.map +1 -1
- package/dist/deferred.d.ts +11 -0
- package/dist/deferred.d.ts.map +1 -1
- package/dist/deferred.js +15 -1
- package/dist/deferred.js.map +1 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +10 -1
- package/dist/document.js.map +1 -1
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/form.d.ts +5 -5
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +5 -2
- package/dist/form.js.map +1 -1
- package/dist/href.d.ts +31 -3
- package/dist/href.d.ts.map +1 -1
- package/dist/href.js +131 -10
- package/dist/href.js.map +1 -1
- package/dist/image.d.ts +3 -3
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +15 -7
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +38 -7
- package/dist/link.js.map +1 -1
- package/dist/metadata.d.ts +8 -2
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +14 -5
- package/dist/metadata.js.map +1 -1
- package/dist/modules.d.ts +15 -1
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js.map +1 -1
- package/dist/mounted.d.ts +55 -0
- package/dist/mounted.d.ts.map +1 -0
- package/dist/mounted.js +110 -0
- package/dist/mounted.js.map +1 -0
- package/dist/navigation-focus.d.ts +38 -0
- package/dist/navigation-focus.d.ts.map +1 -0
- package/dist/navigation-focus.js +71 -0
- package/dist/navigation-focus.js.map +1 -0
- package/dist/payload.d.ts +8 -0
- package/dist/payload.d.ts.map +1 -1
- package/dist/payload.js +28 -0
- package/dist/payload.js.map +1 -1
- package/dist/query.d.ts +5 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +11 -8
- package/dist/query.js.map +1 -1
- package/dist/render-document.d.ts +74 -0
- package/dist/render-document.d.ts.map +1 -0
- package/dist/render-document.js +393 -0
- package/dist/render-document.js.map +1 -0
- package/dist/route-announcer.d.ts +18 -0
- package/dist/route-announcer.d.ts.map +1 -0
- package/dist/route-announcer.js +58 -0
- package/dist/route-announcer.js.map +1 -0
- package/dist/route-tree.d.ts +6 -2
- package/dist/route-tree.d.ts.map +1 -1
- package/dist/route-tree.js +17 -7
- package/dist/route-tree.js.map +1 -1
- package/dist/router.d.ts +28 -5
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +71 -26
- package/dist/router.js.map +1 -1
- package/dist/script.d.ts +28 -5
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +192 -21
- package/dist/script.js.map +1 -1
- package/dist/server-render.d.ts.map +1 -1
- package/dist/server-render.js +4 -1
- package/dist/server-render.js.map +1 -1
- package/dist/testing-vitest.d.ts +8 -0
- package/dist/testing-vitest.d.ts.map +1 -0
- package/dist/testing-vitest.js +26 -0
- package/dist/testing-vitest.js.map +1 -0
- package/dist/testing.d.ts +17 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +18 -3
- package/dist/testing.js.map +1 -1
- package/dist/zod-jitless.d.ts +2 -0
- package/dist/zod-jitless.d.ts.map +1 -0
- package/dist/zod-jitless.js +4 -0
- package/dist/zod-jitless.js.map +1 -0
- package/package.json +1 -1
- package/sidecar/server.mjs +109 -15
- package/skills/netjes/SKILL.md +15 -7
- package/skills/netjes/references/caching-and-streaming.md +37 -4
- package/skills/netjes/references/data-and-actions.md +15 -7
- package/skills/netjes/references/deployment.md +7 -3
- package/skills/netjes/references/routing.md +32 -9
- package/skills/netjes/references/testing.md +23 -7
- package/src/actions.tsx +9 -3
- package/src/client-entry.tsx +20 -2
- package/src/deferred.ts +14 -1
- package/src/document.tsx +22 -3
- package/src/errors.ts +12 -0
- package/src/form.tsx +10 -7
- package/src/href.ts +137 -11
- package/src/image.tsx +3 -3
- package/src/index.ts +19 -1
- package/src/link.tsx +47 -13
- package/src/metadata.tsx +19 -6
- package/src/modules.ts +15 -2
- package/src/mounted.tsx +160 -0
- package/src/navigation-focus.ts +75 -0
- package/src/payload.ts +32 -0
- package/src/query.tsx +14 -8
- package/src/render-document.tsx +483 -0
- package/src/route-announcer.tsx +69 -0
- package/src/route-tree.tsx +17 -6
- package/src/router.tsx +116 -31
- package/src/script.tsx +214 -23
- package/src/server-render.tsx +4 -1
- package/src/testing-vitest.ts +37 -0
- package/src/testing.tsx +38 -5
- package/src/virtual.d.ts +8 -1
- package/src/zod-jitless.ts +15 -0
- package/template/.dockerignore +3 -0
- package/template/Dockerfile +11 -1
- package/template/README.md +11 -7
- package/template/_AGENTS.md +38 -9
- package/template/__NAME__.csproj +2 -0
- package/template/app/document.test.ts +29 -0
- package/template/app/error.tsx +3 -2
- package/template/app/layout.tsx +10 -1
- package/template/docker-compose.override.yml +4 -3
- package/template/docker-compose.prod.yml +2 -1
- package/template/e2e/home.spec.ts +32 -0
- package/template/generated/netjes.ts +43 -14
- package/template/package.json +4 -1
- package/template/playwright.config.ts +36 -0
- package/template/tests/__NAME__.Tests/AppFactory.cs +31 -0
- package/template/tests/__NAME__.Tests/HomePageTests.cs +55 -0
- package/template/tests/__NAME__.Tests/__NAME__.Tests.csproj +30 -0
- package/template/tsconfig.app.json +20 -0
- package/template/tsconfig.json +2 -17
- package/template/tsconfig.node.json +8 -0
- package/vite/packages.mjs +345 -0
- package/vite/plugin.d.ts +16 -1
- package/vite/plugin.mjs +224 -34
package/dist/href.d.ts
CHANGED
|
@@ -12,14 +12,42 @@ export type Href = Register extends {
|
|
|
12
12
|
export type SearchValue = string | number | boolean | null | undefined;
|
|
13
13
|
/** A query string as an object: a value per key, or a list of values for a key that repeats. */
|
|
14
14
|
export type SearchParamsInput = Record<string, SearchValue | readonly SearchValue[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a URL has the shape of a link, as a C# `Href` checks it: root-relative (`/…`, but not `//…` or `/\…`, which
|
|
17
|
+
* browsers read as another host), a link within the page (`?…`, `#…`), or an `http:`, `https:`, `mailto:` or `tel:`
|
|
18
|
+
* URL, with no ASCII control character and no space at either end. It does not ask which page a path names: a page
|
|
19
|
+
* package's generated file, which cannot know the app's pages, checks its `Href` with this.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isHrefShape(value: string): boolean;
|
|
15
22
|
/**
|
|
16
23
|
* Whether a URL is one of the app's pages (by route pattern), a link within the page (`?…`, `#…`), or another
|
|
17
|
-
* site. The generated `isHref()` and `Href` schema call this to check URLs that come from data.
|
|
24
|
+
* site. The generated `isHref()` and `Href` schema call this to check URLs that come from data. A URL with an ASCII
|
|
25
|
+
* control character, or with a space at either end, is none of these.
|
|
18
26
|
*/
|
|
19
27
|
export declare function isRouteHref(value: string, patterns: readonly string[]): boolean;
|
|
20
28
|
/**
|
|
21
29
|
* Builds the URL for a route pattern written in file-name syntax (`/blog/[slug]`, `/docs/[...path]`,
|
|
22
|
-
* `/shop/[[...filters]]`), encoding every segment value.
|
|
30
|
+
* `/shop/[[...filters]]`), encoding every segment value. A value, or a catch-all entry, that is `.`, `..` or empty
|
|
31
|
+
* throws, since it would change the path the URL names. `options.hash` adds a fragment after the query: the id of an
|
|
32
|
+
* element in the page, with one leading `#` dropped and the rest encoded; with nothing left, no fragment is added. The
|
|
33
|
+
* generated `route()` helper calls this with typed params.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildHref(pattern: string, params: Record<string, unknown>, search?: SearchParamsInput, options?: {
|
|
36
|
+
hash?: string | undefined;
|
|
37
|
+
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* Builds the URL of one of the app's endpoints from its route template, as the generated file writes it: the
|
|
40
|
+
* literals as they are (with `%`, `{`, `}`, `#` and `\` encoded), `{name}`, `{name?}`, `{name=default}` (the default
|
|
41
|
+
* encoded), `{*name}` and `{**name}`, without constraints. Each route value is encoded; a `{**name}` value keeps its
|
|
42
|
+
* slashes, and a `{*name}` value has them encoded. A value that would make a segment `.` or `..`, or a `{**name}` value
|
|
43
|
+
* with such a piece or with an empty one before its end (`/x`, `a//b`), throws `netjes: endpoint '<endpoint>' cannot
|
|
44
|
+
* take '<value>' for the route value '<name>'`, since it would change the path the URL names. A missing, `null` or
|
|
45
|
+
* empty optional value drops its segment, or its
|
|
46
|
+
* part of a segment with the `.` before it (`{name}.{ext?}`); a missing value with a default is filled in, unless it
|
|
47
|
+
* is a whole segment at the end, which is dropped; a missing, `null` or empty required value, or an optional one whose
|
|
48
|
+
* segment is followed by one that stays, throws `netjes: endpoint '<endpoint>' needs the route value '<name>'`. The
|
|
49
|
+
* values the template does not name are the query string, followed by `search`. The result is root-relative and has no base path: pass it through
|
|
50
|
+
* `useHref` for a `fetch` or an `<a href>`. The generated `endpointUrl()` calls this with typed values.
|
|
23
51
|
*/
|
|
24
|
-
export declare function
|
|
52
|
+
export declare function buildEndpointUrl(template: string, values: Readonly<Record<string, unknown>>, search?: SearchParamsInput, endpoint?: string): string;
|
|
25
53
|
//# sourceMappingURL=href.d.ts.map
|
package/dist/href.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,QAAQ;CAAG;AAE5B,sGAAsG;AACtG,MAAM,MAAM,IAAI,GA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,MAAM,CAwCR;AAgBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAsDR"}
|
package/dist/href.js
CHANGED
|
@@ -13,26 +13,60 @@ function matches(pattern, path) {
|
|
|
13
13
|
return pattern.length === path.length;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Whether a URL
|
|
17
|
-
*
|
|
16
|
+
* Whether a URL has the shape of a link, as a C# `Href` checks it: root-relative (`/…`, but not `//…` or `/\…`, which
|
|
17
|
+
* browsers read as another host), a link within the page (`?…`, `#…`), or an `http:`, `https:`, `mailto:` or `tel:`
|
|
18
|
+
* URL, with no ASCII control character and no space at either end. It does not ask which page a path names: a page
|
|
19
|
+
* package's generated file, which cannot know the app's pages, checks its `Href` with this.
|
|
18
20
|
*/
|
|
19
|
-
export function
|
|
21
|
+
export function isHrefShape(value) {
|
|
22
|
+
// Browsers drop tabs and newlines anywhere in a URL, and control characters and spaces at either end: `/\t/host`
|
|
23
|
+
// would be `//host`. A C# Href refuses the same.
|
|
24
|
+
if (/[\u0000-\u001F\u007F]/.test(value) || value.startsWith(' ') || value.endsWith(' '))
|
|
25
|
+
return false;
|
|
20
26
|
if (/^(https?:|mailto:|tel:)/i.test(value) || value.startsWith('?') || value.startsWith('#'))
|
|
21
27
|
return true;
|
|
22
28
|
// "//host" and "/\host" are other hosts as far as browsers are concerned.
|
|
23
|
-
|
|
29
|
+
return value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether a URL is one of the app's pages (by route pattern), a link within the page (`?…`, `#…`), or another
|
|
33
|
+
* site. The generated `isHref()` and `Href` schema call this to check URLs that come from data. A URL with an ASCII
|
|
34
|
+
* control character, or with a space at either end, is none of these.
|
|
35
|
+
*/
|
|
36
|
+
export function isRouteHref(value, patterns) {
|
|
37
|
+
if (!isHrefShape(value))
|
|
24
38
|
return false;
|
|
39
|
+
if (!value.startsWith('/'))
|
|
40
|
+
return true;
|
|
25
41
|
const path = (value.split(/[?#]/, 1)[0] ?? '').split('/').filter(Boolean);
|
|
26
42
|
return patterns.some((pattern) => matches(pattern.split('/').filter(Boolean), path));
|
|
27
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A segment that would change the URL's path when a browser or `fetch` resolves it: `.` and `..` are dot segments,
|
|
46
|
+
* which move up the path, and an empty one doubles a slash, which right after the leading one names another host.
|
|
47
|
+
*/
|
|
48
|
+
function changesThePath(segment) {
|
|
49
|
+
return segment === '' || segment === '.' || segment === '..';
|
|
50
|
+
}
|
|
51
|
+
const changesThePathMessage = "a '.', '..' or empty segment would change the URL's path";
|
|
28
52
|
/**
|
|
29
53
|
* Builds the URL for a route pattern written in file-name syntax (`/blog/[slug]`, `/docs/[...path]`,
|
|
30
|
-
* `/shop/[[...filters]]`), encoding every segment value.
|
|
54
|
+
* `/shop/[[...filters]]`), encoding every segment value. A value, or a catch-all entry, that is `.`, `..` or empty
|
|
55
|
+
* throws, since it would change the path the URL names. `options.hash` adds a fragment after the query: the id of an
|
|
56
|
+
* element in the page, with one leading `#` dropped and the rest encoded; with nothing left, no fragment is added. The
|
|
57
|
+
* generated `route()` helper calls this with typed params.
|
|
31
58
|
*/
|
|
32
|
-
export function buildHref(pattern, params, search) {
|
|
59
|
+
export function buildHref(pattern, params, search, options) {
|
|
33
60
|
const missing = (name) => {
|
|
34
61
|
throw new Error(`netjes: route '${pattern}' needs the parameter '${name}'`);
|
|
35
62
|
};
|
|
63
|
+
const encode = (name, value) => {
|
|
64
|
+
const text = String(value);
|
|
65
|
+
if (changesThePath(text)) {
|
|
66
|
+
throw new Error(`netjes: route '${pattern}' cannot take '${text}' for the parameter '${name}': ${changesThePathMessage}`);
|
|
67
|
+
}
|
|
68
|
+
return encodeURIComponent(text);
|
|
69
|
+
};
|
|
36
70
|
const segments = pattern
|
|
37
71
|
.split('/')
|
|
38
72
|
.filter(Boolean)
|
|
@@ -40,32 +74,119 @@ export function buildHref(pattern, params, search) {
|
|
|
40
74
|
const optional = /^\[\[\.\.\.(\w+)\]\]$/.exec(segment)?.[1];
|
|
41
75
|
if (optional) {
|
|
42
76
|
const values = params[optional];
|
|
43
|
-
return Array.isArray(values) ? values.map((v) =>
|
|
77
|
+
return Array.isArray(values) ? values.map((v) => encode(optional, v)) : [];
|
|
44
78
|
}
|
|
45
79
|
const catchAll = /^\[\.\.\.(\w+)\]$/.exec(segment)?.[1];
|
|
46
80
|
if (catchAll) {
|
|
47
81
|
const values = params[catchAll];
|
|
48
82
|
if (!Array.isArray(values) || values.length === 0)
|
|
49
83
|
return missing(catchAll);
|
|
50
|
-
return values.map((v) =>
|
|
84
|
+
return values.map((v) => encode(catchAll, v));
|
|
51
85
|
}
|
|
52
86
|
const single = /^\[(\w+)\]$/.exec(segment)?.[1];
|
|
53
87
|
if (single) {
|
|
54
88
|
const value = params[single];
|
|
55
89
|
if (value === undefined || value === null || value === '')
|
|
56
90
|
return missing(single);
|
|
57
|
-
return [
|
|
91
|
+
return [encode(single, value)];
|
|
58
92
|
}
|
|
59
93
|
return [segment];
|
|
60
94
|
});
|
|
61
95
|
const query = new URLSearchParams();
|
|
96
|
+
appendSearch(query, search);
|
|
97
|
+
const queryString = query.toString();
|
|
98
|
+
const fragment = (options?.hash ?? '').replace(/^#/, '');
|
|
99
|
+
return `/${segments.join('/')}${queryString ? `?${queryString}` : ''}${fragment ? `#${encodeURIComponent(fragment)}` : ''}`;
|
|
100
|
+
}
|
|
101
|
+
/** Appends each value of `search`, a list repeating its key; `null` and `undefined` leave the key out. */
|
|
102
|
+
function appendSearch(query, search) {
|
|
62
103
|
for (const [key, value] of Object.entries(search ?? {})) {
|
|
63
104
|
for (const item of Array.isArray(value) ? value : [value]) {
|
|
64
105
|
if (item !== undefined && item !== null)
|
|
65
106
|
query.append(key, String(item));
|
|
66
107
|
}
|
|
67
108
|
}
|
|
109
|
+
}
|
|
110
|
+
/** A missing route value: `undefined`, `null` or `''`. */
|
|
111
|
+
function absent(value) {
|
|
112
|
+
return value === undefined || value === null || value === '';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Builds the URL of one of the app's endpoints from its route template, as the generated file writes it: the
|
|
116
|
+
* literals as they are (with `%`, `{`, `}`, `#` and `\` encoded), `{name}`, `{name?}`, `{name=default}` (the default
|
|
117
|
+
* encoded), `{*name}` and `{**name}`, without constraints. Each route value is encoded; a `{**name}` value keeps its
|
|
118
|
+
* slashes, and a `{*name}` value has them encoded. A value that would make a segment `.` or `..`, or a `{**name}` value
|
|
119
|
+
* with such a piece or with an empty one before its end (`/x`, `a//b`), throws `netjes: endpoint '<endpoint>' cannot
|
|
120
|
+
* take '<value>' for the route value '<name>'`, since it would change the path the URL names. A missing, `null` or
|
|
121
|
+
* empty optional value drops its segment, or its
|
|
122
|
+
* part of a segment with the `.` before it (`{name}.{ext?}`); a missing value with a default is filled in, unless it
|
|
123
|
+
* is a whole segment at the end, which is dropped; a missing, `null` or empty required value, or an optional one whose
|
|
124
|
+
* segment is followed by one that stays, throws `netjes: endpoint '<endpoint>' needs the route value '<name>'`. The
|
|
125
|
+
* values the template does not name are the query string, followed by `search`. The result is root-relative and has no base path: pass it through
|
|
126
|
+
* `useHref` for a `fetch` or an `<a href>`. The generated `endpointUrl()` calls this with typed values.
|
|
127
|
+
*/
|
|
128
|
+
export function buildEndpointUrl(template, values, search, endpoint) {
|
|
129
|
+
const needs = (name) => new Error(`netjes: endpoint '${endpoint ?? template}' needs the route value '${name}'`);
|
|
130
|
+
const cannotTake = (name, value) => new Error(`netjes: endpoint '${endpoint ?? template}' cannot take '${String(value)}' for the route value '${name}': ${changesThePathMessage}`);
|
|
131
|
+
const named = new Set();
|
|
132
|
+
// Each segment's text, and the name of the value it is missing, when the segment can go for want of it.
|
|
133
|
+
const segments = [];
|
|
134
|
+
for (const segment of template.split('/').filter(Boolean)) {
|
|
135
|
+
let text = '';
|
|
136
|
+
let missing;
|
|
137
|
+
// The value that made the segment's text, which must not leave it a dot segment.
|
|
138
|
+
let filled;
|
|
139
|
+
for (const part of segment.split(/(\{[^}]*\})/).filter(Boolean)) {
|
|
140
|
+
const parameter = /^\{(\*\*?)?([^=?]+?)(\?|=([^]*))?\}$/.exec(part);
|
|
141
|
+
if (!parameter) {
|
|
142
|
+
text += part;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const [, star, name = '', marker, fallback] = parameter;
|
|
146
|
+
named.add(name);
|
|
147
|
+
const value = values[name];
|
|
148
|
+
if (!absent(value) && star === '**') {
|
|
149
|
+
// Each piece is a segment of its own; an empty last one is a trailing slash.
|
|
150
|
+
const pieces = String(value).split('/');
|
|
151
|
+
if (pieces.some((piece, i) => (piece === '' ? i < pieces.length - 1 : changesThePath(piece))))
|
|
152
|
+
throw cannotTake(name, value);
|
|
153
|
+
text += pieces.map((piece) => encodeURIComponent(piece)).join('/');
|
|
154
|
+
}
|
|
155
|
+
else if (!absent(value)) {
|
|
156
|
+
text += encodeURIComponent(String(value));
|
|
157
|
+
filled = name;
|
|
158
|
+
}
|
|
159
|
+
else if (fallback !== undefined) {
|
|
160
|
+
text += fallback;
|
|
161
|
+
if (part === segment)
|
|
162
|
+
missing = name;
|
|
163
|
+
}
|
|
164
|
+
else if (marker === '?' || star) {
|
|
165
|
+
// An optional value after a literal `.` takes the dot with it.
|
|
166
|
+
if (text.endsWith('.'))
|
|
167
|
+
text = text.slice(0, -1);
|
|
168
|
+
if (!text)
|
|
169
|
+
missing = name;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
throw needs(name);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (filled && changesThePath(text))
|
|
176
|
+
throw cannotTake(filled, values[filled]);
|
|
177
|
+
if (text || missing)
|
|
178
|
+
segments.push({ text, missing });
|
|
179
|
+
}
|
|
180
|
+
while (segments.at(-1)?.missing)
|
|
181
|
+
segments.pop();
|
|
182
|
+
// A segment left out before one that stays: routing would not match, or would read the next value as this one.
|
|
183
|
+
const leftOut = segments.find((segment) => !segment.text)?.missing;
|
|
184
|
+
if (leftOut)
|
|
185
|
+
throw needs(leftOut);
|
|
186
|
+
const query = new URLSearchParams();
|
|
187
|
+
appendSearch(query, Object.fromEntries(Object.entries(values).filter(([key]) => !named.has(key))));
|
|
188
|
+
appendSearch(query, search);
|
|
68
189
|
const queryString = query.toString();
|
|
69
|
-
return `/${segments.join('/')}${queryString ? `?${queryString}` : ''}`;
|
|
190
|
+
return `/${segments.map((s) => s.text).join('/')}${queryString ? `?${queryString}` : ''}`;
|
|
70
191
|
}
|
|
71
192
|
//# sourceMappingURL=href.js.map
|
package/dist/href.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href.js","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAeA,SAAS,OAAO,CAAC,OAA0B,EAAE,IAAuB;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QAC5B,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7C,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACnC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IACpE,CAAC;IACD,OA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Q,EAAE,CAAC;IACrC,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5F,CAAC"}
|
package/dist/image.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Where the optimizer lives, and the widths and qualities it serves: Netjes:Images on the server, sent with the first
|
|
4
4
|
* document. Without `qualities`, any quality is requested as given.
|
|
@@ -10,8 +10,8 @@ export type ImageConfig = {
|
|
|
10
10
|
basePath?: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const ImageConfigProvider: import("react").Provider<ImageConfig>;
|
|
13
|
-
/** The props of `<Image>`: an `<img>`'s own, with a required size and `alt`, and the optimizer's options. */
|
|
14
|
-
export type ImageProps = Omit<
|
|
13
|
+
/** The props of `<Image>`: an `<img>`'s own and its ref, with a required size and `alt`, and the optimizer's options. */
|
|
14
|
+
export type ImageProps = Omit<ComponentPropsWithRef<'img'>, 'src' | 'srcSet' | 'width' | 'height' | 'loading' | 'alt'> & {
|
|
15
15
|
/** A path in `public/` (`/img/hero.png`) or a URL on a host in Netjes:Images:RemoteHosts. */
|
|
16
16
|
src: string;
|
|
17
17
|
/** Required, as for any image; `""` for decorative ones. */
|
package/dist/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAA6B,MAAM,OAAO,CAAC;AAG9E;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAUxH,eAAO,MAAM,mBAAmB,uCAA8B,CAAC;AAE/D,yHAAyH;AACzH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG;IACvH,6FAA6F;IAC7F,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,8GAA8G;IAC9G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAyBF;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAY,EAAE,QAAgB,EAAE,WAAmB,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,+BAyBjI"}
|
package/dist/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA8B,aAAa,EAAE,UAAU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,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtI,OAAO,iBAAS,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAI,CAAC;AAC1E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export { type ActionState, type PageActionFailure, type ServerAction, ServerActionError, type UseActionOptions, serverAction, useAction, usePageActionState, } from './actions.tsx';
|
|
2
2
|
export { defineLayout, definePage } from './define-page.tsx';
|
|
3
|
+
export { CSP_SCRIPT_HASHES } from './deferred.ts';
|
|
3
4
|
export { useDraftMode } from './draft-mode.ts';
|
|
4
5
|
export { type DynamicOptions, clientOnly, dynamic } from './dynamic.tsx';
|
|
5
6
|
export { Form, type FormAction, type FormProps, SubmitButton, type SubmitButtonProps } from './form.tsx';
|
|
6
|
-
export { type Href, type Register, type SearchParamsInput, type SearchValue, buildHref, isRouteHref } from './href.ts';
|
|
7
|
+
export { type Href, type Register, type SearchParamsInput, type SearchValue, buildEndpointUrl, buildHref, isHrefShape, isRouteHref, } from './href.ts';
|
|
7
8
|
export { Image, type ImageProps } from './image.tsx';
|
|
8
9
|
export { Link, type LinkProps } from './link.tsx';
|
|
9
10
|
export { useLocale } from './locale.ts';
|
|
10
11
|
export type { ErrorPageProps, LayoutProps } from './modules.ts';
|
|
12
|
+
export { type Mounted, type MountedFormProps, type MountedLinkProps, type MountedRouter, type MountedSubmitButtonProps, mounted, } from './mounted.tsx';
|
|
11
13
|
export { useNonce } from './nonce.tsx';
|
|
12
14
|
export type { PageKind, Params, SeededQuery, SegmentRef } from './payload.ts';
|
|
13
15
|
export { usePublicConfig } from './public-config.tsx';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { ServerActionError, serverAction, useAction, usePageActionState, } from './actions.js';
|
|
2
2
|
export { defineLayout, definePage } from './define-page.js';
|
|
3
|
+
export { CSP_SCRIPT_HASHES } from './deferred.js';
|
|
3
4
|
export { useDraftMode } from './draft-mode.js';
|
|
4
5
|
export { clientOnly, dynamic } from './dynamic.js';
|
|
5
6
|
export { Form, SubmitButton } from './form.js';
|
|
6
|
-
export { buildHref, isRouteHref } from './href.js';
|
|
7
|
+
export { buildEndpointUrl, buildHref, isHrefShape, isRouteHref, } from './href.js';
|
|
7
8
|
export { Image } from './image.js';
|
|
8
9
|
export { Link } from './link.js';
|
|
9
10
|
export { useLocale } from './locale.js';
|
|
11
|
+
export { mounted, } from './mounted.js';
|
|
10
12
|
export { useNonce } from './nonce.js';
|
|
11
13
|
export { usePublicConfig } from './public-config.js';
|
|
12
14
|
export { Script } from './script.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAuB,UAAU,EAAE,OAAO,EAAE,MAAM,cAAe,CAAC;AACzE,OAAO,EAAE,IAAI,EAAmC,YAAY,EAA0B,MAAM,WAAY,CAAC;AACzG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAuB,UAAU,EAAE,OAAO,EAAE,MAAM,cAAe,CAAC;AACzE,OAAO,EAAE,IAAI,EAAmC,YAAY,EAA0B,MAAM,WAAY,CAAC;AACzG,OAAO,EAKL,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAML,OAAO,GACR,MAAM,cAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAa,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAyC,MAAM,aAAc,CAAC;AAC7E,OAAO,EAIL,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,GACf,MAAM,aAAc,CAAC"}
|
package/dist/link.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
import type { Href } from './href.ts';
|
|
3
|
-
/** The props of `<Link>`: an anchor's own, with a typed `href` and the client navigation options. */
|
|
4
|
-
export type LinkProps = Omit<
|
|
3
|
+
/** The props of `<Link>`: an anchor's own and its ref, with a typed `href` and the client navigation options. */
|
|
4
|
+
export type LinkProps = Omit<ComponentPropsWithRef<'a'>, 'href'> & {
|
|
5
5
|
/** Typed by the app's routes once `netjes generate` has registered them. */
|
|
6
6
|
href: Href;
|
|
7
7
|
replace?: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Scroll to the top after navigating, or to the #fragment's element, which then takes the focus. Default true. `false`
|
|
10
|
+
* keeps the scroll position, and the focus on the link while the link has it.
|
|
11
|
+
*/
|
|
9
12
|
scroll?: boolean;
|
|
10
|
-
/** `intent` (default) fetches the next page on hover or
|
|
13
|
+
/** `intent` (default) fetches the next page on hover, focus or touch. */
|
|
11
14
|
prefetch?: 'intent' | 'none';
|
|
12
|
-
/** Let the browser follow it with a full page load
|
|
15
|
+
/** Let the browser follow it with a full page load: for a page of the app that must load in full, or a page on another site. */
|
|
13
16
|
reloadDocument?: boolean;
|
|
14
17
|
};
|
|
15
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* An `<a>` that navigates on the client. Ctrl/cmd-click, new tabs and external URLs behave like a normal link. It sets
|
|
20
|
+
* `aria-current="page"` on a link to the page on screen: the same path, one trailing slash aside, and the page's values
|
|
21
|
+
* for each query parameter the link names. A link with a `#` is never marked, and an `aria-current` prop wins. After a
|
|
22
|
+
* navigation to another page, the router announces the page and starts the focus over at the top of the document.
|
|
23
|
+
*/
|
|
16
24
|
export declare function Link({ href, replace, scroll, prefetch, reloadDocument, onClick, onMouseEnter, onFocus, onTouchStart, ...rest }: LinkProps): import("react").JSX.Element;
|
|
17
25
|
//# sourceMappingURL=link.d.ts.map
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAc,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,iHAAiH;AACjH,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG;IACjE,4EAA4E;IAC5E,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,gIAAgI;IAChI,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AA4CF;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,OAAe,EAAE,MAAa,EAAE,QAAmB,EAAE,cAAsB,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,+BAsC3K"}
|
package/dist/link.js
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useBasePath, useInternalRouter, usePathname, withBasePath } from './router.js';
|
|
2
|
+
import { useBasePath, useInternalRouter, usePathname, useSearchParams, withBasePath } from './router.js';
|
|
3
3
|
const BASE = 'http://netjes.invalid';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return
|
|
4
|
+
/** One trailing slash makes no other page: `/docs/` is `/docs`, and `/` stays `/`. */
|
|
5
|
+
function withoutTrailingSlash(path) {
|
|
6
|
+
return path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path;
|
|
7
|
+
}
|
|
8
|
+
/** The same values, in any order, as often each. */
|
|
9
|
+
function sameValues(a, b) {
|
|
10
|
+
const sorted = [...b].sort();
|
|
11
|
+
return a.length === b.length && [...a].sort().every((value, i) => value === sorted[i]);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether the link goes to the page on screen. An href with a `#` points to a place in a page, so it never does.
|
|
15
|
+
* Otherwise its URL under the base path has the page's path, give or take one trailing slash, and the page's
|
|
16
|
+
* values for each query parameter it names; parameters it leaves out do not count. Only the path and the query
|
|
17
|
+
* enter, against a fixed origin, so the server and the browser agree.
|
|
18
|
+
*/
|
|
19
|
+
function isCurrentPage(href, pathname, search, basePath) {
|
|
20
|
+
if (href.includes('#'))
|
|
21
|
+
return false;
|
|
22
|
+
const query = search.toString();
|
|
23
|
+
// The page's URL as the browser has it: the base path, then the page's path, even one that starts like the base path.
|
|
24
|
+
const page = new URL(BASE + basePath + pathname + (query ? `?${query}` : ''));
|
|
25
|
+
const target = new URL(withBasePath(href, basePath), page);
|
|
26
|
+
if (target.origin !== BASE || withoutTrailingSlash(target.pathname) !== withoutTrailingSlash(page.pathname))
|
|
27
|
+
return false;
|
|
28
|
+
return [...new Set(target.searchParams.keys())].every((key) => sameValues(target.searchParams.getAll(key), search.getAll(key)));
|
|
7
29
|
}
|
|
8
30
|
function isPlainLeftClick(event) {
|
|
9
31
|
const anchor = event.currentTarget;
|
|
@@ -15,23 +37,32 @@ function isPlainLeftClick(event) {
|
|
|
15
37
|
(!anchor.target || anchor.target === '_self') &&
|
|
16
38
|
!anchor.hasAttribute('download'));
|
|
17
39
|
}
|
|
18
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* An `<a>` that navigates on the client. Ctrl/cmd-click, new tabs and external URLs behave like a normal link. It sets
|
|
42
|
+
* `aria-current="page"` on a link to the page on screen: the same path, one trailing slash aside, and the page's values
|
|
43
|
+
* for each query parameter the link names. A link with a `#` is never marked, and an `aria-current` prop wins. After a
|
|
44
|
+
* navigation to another page, the router announces the page and starts the focus over at the top of the document.
|
|
45
|
+
*/
|
|
19
46
|
export function Link({ href, replace = false, scroll = true, prefetch = 'intent', reloadDocument = false, onClick, onMouseEnter, onFocus, onTouchStart, ...rest }) {
|
|
20
47
|
const router = useInternalRouter();
|
|
21
48
|
const pathname = usePathname();
|
|
49
|
+
const search = useSearchParams();
|
|
22
50
|
const basePath = useBasePath();
|
|
23
51
|
const warm = () => {
|
|
24
52
|
if (prefetch === 'intent' && !reloadDocument)
|
|
25
53
|
router.prefetch(href);
|
|
26
54
|
};
|
|
27
|
-
return (_jsx("a", { href: withBasePath(href, basePath), "aria-current":
|
|
55
|
+
return (_jsx("a", { href: withBasePath(href, basePath), "aria-current": isCurrentPage(href, pathname, search, basePath) ? 'page' : undefined, ...rest, onClick: (event) => {
|
|
56
|
+
// Read before the app's own onClick, which runs as the link is followed: where it moves the focus, such as
|
|
57
|
+
// back to the button of a menu that closes, the router leaves it.
|
|
58
|
+
const focusedAtStart = document.activeElement;
|
|
28
59
|
onClick?.(event);
|
|
29
60
|
if (event.defaultPrevented || reloadDocument || !isPlainLeftClick(event))
|
|
30
61
|
return;
|
|
31
62
|
if (new URL(href, window.location.href).origin !== window.location.origin)
|
|
32
63
|
return;
|
|
33
64
|
event.preventDefault();
|
|
34
|
-
void (replace ? router.replace(href, { scroll }) : router.push(href, { scroll }));
|
|
65
|
+
void (replace ? router.replace(href, { scroll, focusedAtStart }) : router.push(href, { scroll, focusedAtStart }));
|
|
35
66
|
}, onMouseEnter: (event) => {
|
|
36
67
|
onMouseEnter?.(event);
|
|
37
68
|
warm();
|
package/dist/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAc,CAAC;AAkB1G,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAErC,sFAAsF;AACtF,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC;AAED,oDAAoD;AACpD,SAAS,UAAU,CAAC,CAAW,EAAE,CAAW;IAC1C,MAAM,MAAM,GAAG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Q,CAAC,aAAa,CAAC;YAC9C,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,KAAK,CAAC,gBAAgB,IAAI,cAAc,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;gBAAE,OAAO;YACjF,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM;gBAAE,OAAO;YAClF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QACpH,CAAC,EACD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC;YACtB,IAAI,EAAE,CAAC;QACT,CAAC,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,EAAE,CAAC;QACT,CAAC,EACD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC;YACtB,IAAI,EAAE,CAAC;QACT,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
|
package/dist/metadata.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A title, a layout's `template` (`'%s · Site'`) and `default`, or an `absolute` title that skips templates. A
|
|
3
|
+
* `default`, on a layout or a page, goes through the nearest `template` of the layouts above it like a string title,
|
|
4
|
+
* never through the one beside it; a layout's `default` is also the title of the pages below it that set none.
|
|
5
|
+
*/
|
|
2
6
|
export type MetadataTitle = string | {
|
|
3
7
|
default?: string;
|
|
4
8
|
template?: string;
|
|
@@ -72,7 +76,9 @@ export type ResolvedMetadata = Omit<Metadata, 'title' | 'openGraph' | 'twitter'>
|
|
|
72
76
|
};
|
|
73
77
|
/**
|
|
74
78
|
* Merges the layouts' metadata (outermost first), the page's, and the server's. A layout's `title.template` applies
|
|
75
|
-
* to titles below it
|
|
79
|
+
* to the titles below it. `title.default`, on a layout or a page, goes through the templates above it like a string
|
|
80
|
+
* title and never through its own; on a layout it is the title when nothing below sets one. `title.absolute` skips
|
|
81
|
+
* templates.
|
|
76
82
|
*/
|
|
77
83
|
export declare function resolveMetadata(layouts: readonly (Metadata | undefined)[], page: Metadata | undefined, server?: Metadata): ResolvedMetadata;
|
|
78
84
|
/** The tags for resolved metadata; rendered anywhere, React puts them in <head>. */
|
package/dist/metadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.tsx"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.tsx"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG,mKAAmK;AACnK,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,0GAA0G;AAC1G,KAAK,cAAc,GAAG,MAAM,GAAG,GAAG,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,GAAG,GAAG,aAAa,CAAC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from pages and layouts, plus metadata sent by the C# loader
|
|
3
3
|
// (`.WithMetadata(...)`, the counterpart of generateMetadata). React 19 hoists the tags into <head>.
|
|
4
4
|
import { Fragment } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* The title that `title` stands for, given the template from the layouts above it. A string and a `default` go
|
|
7
|
+
* through the template, an `absolute` title does not, and an object with no `default` and no `absolute` (a layout
|
|
8
|
+
* that only sets a template) has no title of its own.
|
|
9
|
+
*/
|
|
5
10
|
function titleOf(title, template) {
|
|
6
11
|
if (title === undefined)
|
|
7
12
|
return undefined;
|
|
8
13
|
// A function replacer: a title such as "Save $& now" must not be read as a replacement pattern.
|
|
14
|
+
const inTemplate = (text) => (template ? template.replace('%s', () => text) : text);
|
|
9
15
|
if (typeof title === 'string')
|
|
10
|
-
return
|
|
16
|
+
return inTemplate(title);
|
|
11
17
|
if (title.absolute !== undefined)
|
|
12
18
|
return title.absolute;
|
|
13
|
-
return title.default;
|
|
19
|
+
return title.default === undefined ? undefined : inTemplate(title.default);
|
|
14
20
|
}
|
|
15
21
|
/** The images as a list of descriptors with string URLs; like Next.js, a null image or one without a URL is left out. */
|
|
16
22
|
function imagesOf(images) {
|
|
@@ -26,7 +32,9 @@ function withImages(group) {
|
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* Merges the layouts' metadata (outermost first), the page's, and the server's. A layout's `title.template` applies
|
|
29
|
-
* to titles below it
|
|
35
|
+
* to the titles below it. `title.default`, on a layout or a page, goes through the templates above it like a string
|
|
36
|
+
* title and never through its own; on a layout it is the title when nothing below sets one. `title.absolute` skips
|
|
37
|
+
* templates.
|
|
30
38
|
*/
|
|
31
39
|
export function resolveMetadata(layouts, page, server) {
|
|
32
40
|
let resolved = {};
|
|
@@ -37,8 +45,9 @@ export function resolveMetadata(layouts, page, server) {
|
|
|
37
45
|
const { title, openGraph, twitter, alternates, icons, other, ...rest } = metadata;
|
|
38
46
|
resolved = { ...resolved, ...rest };
|
|
39
47
|
if (title !== undefined) {
|
|
40
|
-
//
|
|
41
|
-
|
|
48
|
+
// The template from above applies to every title but an absolute one, a default included. This title's own
|
|
49
|
+
// template is stored after its title is written, so it applies only to the titles below.
|
|
50
|
+
const own = titleOf(title, template);
|
|
42
51
|
if (own !== undefined)
|
|
43
52
|
resolved.title = own;
|
|
44
53
|
if (typeof title === 'object' && title.template)
|