@astrojs/starlight 0.37.7 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/components/ContentNotice.astro +1 -1
- package/components/MobileTableOfContents.astro +2 -2
- package/components/Page.astro +3 -3
- package/components/Select.astro +2 -2
- package/components/SocialIcons.astro +1 -1
- package/components/TableOfContents.astro +2 -2
- package/global.d.ts +9 -3
- package/index.ts +39 -1
- package/integrations/asides.ts +1 -1
- package/integrations/remark-rehype.ts +2 -11
- package/integrations/virtual-user-config.ts +31 -17
- package/integrations/vite-layer-order.ts +38 -35
- package/package.json +12 -148
- package/schema.ts +3 -9
- package/schemas/badge.ts +9 -8
- package/schemas/components.ts +1 -1
- package/schemas/expressiveCode.ts +0 -3
- package/schemas/favicon.ts +4 -6
- package/schemas/head.ts +3 -2
- package/schemas/hero.ts +1 -1
- package/schemas/i18n.ts +148 -153
- package/schemas/icon.ts +1 -1
- package/schemas/pagefind.ts +5 -4
- package/schemas/prevNextLink.ts +6 -8
- package/schemas/sidebar.ts +33 -27
- package/schemas/site-title.ts +4 -6
- package/schemas/social.ts +3 -2
- package/schemas/tableOfContents.ts +3 -3
- package/style/props.css +7 -2
- package/types.ts +1 -1
- package/user-components/Aside.astro +1 -1
- package/user-components/Card.astro +1 -1
- package/user-components/Icon.astro +1 -1
- package/user-components/LinkButton.astro +1 -1
- package/user-components/TabItem.astro +1 -1
- package/user-components/rehype-file-tree.ts +1 -1
- package/user-components/rehype-tabs.ts +1 -1
- package/utils/createTranslationSystem.ts +1 -1
- package/utils/error-map.ts +98 -57
- package/utils/navigation.ts +11 -10
- package/utils/plugins.ts +75 -40
- package/utils/routing/data.ts +3 -9
- package/utils/routing/index.ts +16 -24
- package/utils/routing/types.ts +5 -17
- package/utils/slugs.ts +11 -12
- package/utils/starlight-page.ts +13 -23
- package/utils/translations.ts +3 -4
- package/utils/user-config.ts +28 -65
- package/virtual.d.ts +6 -3
- /package/{components → components-internals}/Icons.ts +0 -0
- /package/{components → components-internals}/SidebarPersistState.ts +0 -0
- /package/{components → components-internals}/TableOfContents/TableOfContentsList.astro +0 -0
- /package/{components → components-internals}/TableOfContents/starlight-toc.ts +0 -0
package/schema.ts
CHANGED
|
@@ -27,7 +27,7 @@ const StarlightFrontmatterSchema = (context: SchemaContext) =>
|
|
|
27
27
|
*
|
|
28
28
|
* Can also be set to `false` to disable showing an edit link on this page.
|
|
29
29
|
*/
|
|
30
|
-
editUrl: z.union([z.
|
|
30
|
+
editUrl: z.union([z.url(), z.boolean()]).optional().default(true),
|
|
31
31
|
|
|
32
32
|
/** Set custom `<head>` tags just for this page. */
|
|
33
33
|
head: HeadConfigSchema({ source: 'content' }),
|
|
@@ -91,7 +91,7 @@ const StarlightFrontmatterSchema = (context: SchemaContext) =>
|
|
|
91
91
|
/** HTML attributes to add to the sidebar link. */
|
|
92
92
|
attrs: SidebarLinkItemHTMLAttributesSchema(),
|
|
93
93
|
})
|
|
94
|
-
.
|
|
94
|
+
.prefault({}),
|
|
95
95
|
|
|
96
96
|
/** Display an announcement banner at the top of this page. */
|
|
97
97
|
banner: z
|
|
@@ -113,14 +113,8 @@ const StarlightFrontmatterSchema = (context: SchemaContext) =>
|
|
|
113
113
|
/** Type of Starlight’s default frontmatter schema. */
|
|
114
114
|
type DefaultSchema = ReturnType<typeof StarlightFrontmatterSchema>;
|
|
115
115
|
|
|
116
|
-
/** Plain object, union, and intersection Zod types. */
|
|
117
|
-
type BaseSchemaWithoutEffects =
|
|
118
|
-
| z.AnyZodObject
|
|
119
|
-
| z.ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]>
|
|
120
|
-
| z.ZodDiscriminatedUnion<string, z.AnyZodObject[]>
|
|
121
|
-
| z.ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>;
|
|
122
116
|
/** Base subset of Zod types that we support passing to the `extend` option. */
|
|
123
|
-
type BaseSchema =
|
|
117
|
+
type BaseSchema = z.core.$ZodType;
|
|
124
118
|
|
|
125
119
|
/** Type that extends Starlight’s default schema with an optional, user-defined schema. */
|
|
126
120
|
type ExtendedSchema<T extends BaseSchema = never> = [T] extends [never]
|
package/schemas/badge.ts
CHANGED
|
@@ -5,19 +5,20 @@ const badgeBaseSchema = z.object({
|
|
|
5
5
|
class: z.string().optional(),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
const badgeSchema =
|
|
8
|
+
const badgeSchema = z.object({
|
|
9
|
+
...badgeBaseSchema.shape,
|
|
9
10
|
text: z.string(),
|
|
10
11
|
});
|
|
11
12
|
|
|
12
|
-
const i18nBadgeSchema =
|
|
13
|
-
|
|
13
|
+
const i18nBadgeSchema = z.object({
|
|
14
|
+
...badgeBaseSchema.shape,
|
|
15
|
+
text: z.union([z.string(), z.record(z.string(), z.string())]),
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
export const BadgeComponentSchema =
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.passthrough();
|
|
18
|
+
export const BadgeComponentSchema = z.looseObject({
|
|
19
|
+
...badgeSchema.shape,
|
|
20
|
+
size: z.enum(['small', 'medium', 'large']).default('small'),
|
|
21
|
+
});
|
|
21
22
|
|
|
22
23
|
export type BadgeComponentProps = z.input<typeof BadgeComponentSchema>;
|
|
23
24
|
|
package/schemas/components.ts
CHANGED
package/schemas/favicon.ts
CHANGED
|
@@ -20,9 +20,10 @@ export const FaviconSchema = () =>
|
|
|
20
20
|
const ext = extname(pathname).toLowerCase();
|
|
21
21
|
|
|
22
22
|
if (!isFaviconExt(ext)) {
|
|
23
|
-
ctx.
|
|
24
|
-
code:
|
|
23
|
+
ctx.issues.push({
|
|
24
|
+
code: 'custom',
|
|
25
25
|
message: 'favicon must be a .ico, .gif, .jpg, .png, or .svg file',
|
|
26
|
+
input: favicon,
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
return z.NEVER;
|
|
@@ -32,10 +33,7 @@ export const FaviconSchema = () =>
|
|
|
32
33
|
href: favicon,
|
|
33
34
|
type: faviconTypeMap[ext],
|
|
34
35
|
};
|
|
35
|
-
})
|
|
36
|
-
.describe(
|
|
37
|
-
'The default favicon for your site which should be a path to an image in the `public/` directory.'
|
|
38
|
-
);
|
|
36
|
+
});
|
|
39
37
|
|
|
40
38
|
function isFaviconExt(ext: string): ext is keyof typeof faviconTypeMap {
|
|
41
39
|
return ext in faviconTypeMap;
|
package/schemas/head.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const HeadConfigSchema = ({
|
|
|
17
17
|
/** Name of the HTML tag to add to `<head>`, e.g. `'meta'`, `'link'`, or `'script'`. */
|
|
18
18
|
tag: z.enum(['title', 'base', 'link', 'style', 'meta', 'script', 'noscript', 'template']),
|
|
19
19
|
/** Attributes to set on the tag, e.g. `{ rel: 'stylesheet', href: '/custom.css' }`. */
|
|
20
|
-
attrs: z.record(z.union([z.string(), z.boolean(), z.undefined()])).optional(),
|
|
20
|
+
attrs: z.record(z.string(), z.union([z.string(), z.boolean(), z.undefined()])).optional(),
|
|
21
21
|
/** Content to place inside the tag (optional). */
|
|
22
22
|
content: z.string().optional(),
|
|
23
23
|
})
|
|
@@ -30,7 +30,7 @@ export const HeadConfigSchema = ({
|
|
|
30
30
|
};
|
|
31
31
|
const code =
|
|
32
32
|
source === 'config' ? JSON.stringify(correctTag, null, 2) : yaml.dump([correctTag]);
|
|
33
|
-
ctx.
|
|
33
|
+
ctx.issues.push({
|
|
34
34
|
code: 'custom',
|
|
35
35
|
message:
|
|
36
36
|
`The \`head\` configuration includes a \`meta\` tag with \`content\` which is invalid HTML.\n` +
|
|
@@ -40,6 +40,7 @@ export const HeadConfigSchema = ({
|
|
|
40
40
|
: '') +
|
|
41
41
|
`in the \`attrs\` object:\n\n` +
|
|
42
42
|
code,
|
|
43
|
+
input: config,
|
|
43
44
|
});
|
|
44
45
|
})
|
|
45
46
|
)
|
package/schemas/hero.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const HeroSchema = ({ image }: SchemaContext) =>
|
|
|
62
62
|
})
|
|
63
63
|
.optional(),
|
|
64
64
|
/** HTML attributes to add to the link */
|
|
65
|
-
attrs: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
|
|
65
|
+
attrs: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
|
|
66
66
|
})
|
|
67
67
|
.array()
|
|
68
68
|
.default([]),
|
package/schemas/i18n.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
2
|
|
|
3
|
-
interface i18nSchemaOpts<T extends z.
|
|
3
|
+
interface i18nSchemaOpts<T extends z.ZodObject = BaseExtendSchema> {
|
|
4
4
|
/**
|
|
5
5
|
* Extend Starlight’s i18n schema with additional fields.
|
|
6
6
|
*
|
|
@@ -19,147 +19,152 @@ interface i18nSchemaOpts<T extends z.AnyZodObject = z.SomeZodObject> {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const defaultI18nSchema = () =>
|
|
22
|
-
|
|
22
|
+
z.object({
|
|
23
|
+
...starlightI18nSchema().shape,
|
|
24
|
+
...pagefindI18nSchema().shape,
|
|
25
|
+
...expressiveCodeI18nSchema().shape,
|
|
26
|
+
});
|
|
23
27
|
/** Type of Starlight’s default i18n schema, including extensions from Pagefind and Expressive Code. */
|
|
24
28
|
type DefaultI18nSchema = ReturnType<typeof defaultI18nSchema>;
|
|
25
29
|
|
|
26
30
|
/**
|
|
27
|
-
* Based on the the return type of Zod’s `
|
|
28
|
-
*
|
|
29
|
-
*
|
|
31
|
+
* Based on the the return type of Zod’s `extend()` method. Adds fields from one `z.object()` schema
|
|
32
|
+
* to another.
|
|
33
|
+
* Also sets the resulting schema as “loose” as that’s how we use it. In practice whether or not
|
|
34
|
+
* the types are loose or not doesn’t matter too much.
|
|
30
35
|
*
|
|
31
|
-
* @see https://github.com/colinhacks/zod/blob/
|
|
36
|
+
* @see https://github.com/colinhacks/zod/blob/9712a6707f3d4584f222729965f3b78f076f0435/packages/zod/src/v4/classic/schemas.ts#L1187
|
|
32
37
|
*/
|
|
33
|
-
type MergeSchemas<A extends z.
|
|
34
|
-
z.
|
|
35
|
-
|
|
36
|
-
B['_def']['catchall']
|
|
38
|
+
type MergeSchemas<A extends z.ZodObject, B extends z.ZodObject> = z.ZodObject<
|
|
39
|
+
z.util.Extend<A['shape'], B['shape']>,
|
|
40
|
+
z.core.$loose
|
|
37
41
|
>;
|
|
38
42
|
/** Type that extends Starlight’s default i18n schema with an optional, user-defined schema. */
|
|
39
|
-
type ExtendedSchema<T extends z.
|
|
43
|
+
type ExtendedSchema<T extends z.ZodObject> = T extends z.ZodObject
|
|
40
44
|
? MergeSchemas<DefaultI18nSchema, T>
|
|
41
45
|
: DefaultI18nSchema;
|
|
46
|
+
/** Type representing an empty Zod object schema used as the default for the `extend` option. */
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
48
|
+
type BaseExtendSchema = z.ZodObject<{}>;
|
|
42
49
|
|
|
43
50
|
/** Content collection schema for Starlight’s optional `i18n` collection. */
|
|
44
|
-
export function i18nSchema<T extends z.
|
|
51
|
+
export function i18nSchema<T extends z.ZodObject = BaseExtendSchema>({
|
|
45
52
|
extend = z.object({}) as T,
|
|
46
53
|
}: i18nSchemaOpts<T> = {}): ExtendedSchema<T> {
|
|
47
|
-
return
|
|
54
|
+
return z.looseObject({
|
|
55
|
+
...defaultI18nSchema().shape,
|
|
56
|
+
...extend.shape,
|
|
57
|
+
}) as ExtendedSchema<T>;
|
|
48
58
|
}
|
|
49
|
-
export type i18nSchemaOutput = z.output<
|
|
59
|
+
export type i18nSchemaOutput = z.output<ExtendedSchema<BaseExtendSchema>>;
|
|
50
60
|
|
|
51
61
|
export function builtinI18nSchema() {
|
|
52
|
-
return
|
|
53
|
-
.required()
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
return z.object({
|
|
63
|
+
...z.strictObject({ ...starlightI18nSchema().required().shape }).shape,
|
|
64
|
+
...pagefindI18nSchema().shape,
|
|
65
|
+
...expressiveCodeI18nSchema().shape,
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
function starlightI18nSchema() {
|
|
60
70
|
return z
|
|
61
71
|
.object({
|
|
62
|
-
'skipLink.label': z
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
),
|
|
72
|
+
'skipLink.label': z.string().meta({
|
|
73
|
+
description:
|
|
74
|
+
'Text displayed in the accessible “Skip link” when a keyboard user first tabs into a page.',
|
|
75
|
+
}),
|
|
67
76
|
|
|
68
|
-
'search.label': z.string().
|
|
77
|
+
'search.label': z.string().meta({ description: 'Text displayed in the search bar.' }),
|
|
69
78
|
|
|
70
|
-
'search.ctrlKey': z
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
),
|
|
79
|
+
'search.ctrlKey': z.string().meta({
|
|
80
|
+
description:
|
|
81
|
+
'Visible representation of the Control key potentially used in the shortcut key to open the search modal.',
|
|
82
|
+
}),
|
|
75
83
|
|
|
76
84
|
'search.cancelLabel': z
|
|
77
85
|
.string()
|
|
78
|
-
.
|
|
86
|
+
.meta({ description: 'Text for the “Cancel” button that closes the search modal.' }),
|
|
79
87
|
|
|
80
|
-
'search.devWarning': z
|
|
81
|
-
.
|
|
82
|
-
|
|
88
|
+
'search.devWarning': z.string().meta({
|
|
89
|
+
description: 'Warning displayed when opening the Search in a dev environment.',
|
|
90
|
+
}),
|
|
83
91
|
|
|
84
92
|
'themeSelect.accessibleLabel': z
|
|
85
93
|
.string()
|
|
86
|
-
.
|
|
94
|
+
.meta({ description: 'Accessible label for the theme selection dropdown.' }),
|
|
87
95
|
|
|
88
|
-
'themeSelect.dark': z.string().
|
|
96
|
+
'themeSelect.dark': z.string().meta({ description: 'Name of the dark color theme.' }),
|
|
89
97
|
|
|
90
|
-
'themeSelect.light': z.string().
|
|
98
|
+
'themeSelect.light': z.string().meta({ description: 'Name of the light color theme.' }),
|
|
91
99
|
|
|
92
|
-
'themeSelect.auto': z
|
|
93
|
-
.
|
|
94
|
-
|
|
100
|
+
'themeSelect.auto': z.string().meta({
|
|
101
|
+
description: 'Name of the automatic color theme that syncs with system preferences.',
|
|
102
|
+
}),
|
|
95
103
|
|
|
96
104
|
'languageSelect.accessibleLabel': z
|
|
97
105
|
.string()
|
|
98
|
-
.
|
|
106
|
+
.meta({ description: 'Accessible label for the language selection dropdown.' }),
|
|
99
107
|
|
|
100
108
|
'menuButton.accessibleLabel': z
|
|
101
109
|
.string()
|
|
102
|
-
.
|
|
110
|
+
.meta({ description: 'Accessible label for the mobile menu button.' }),
|
|
103
111
|
|
|
104
|
-
'sidebarNav.accessibleLabel': z
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
),
|
|
112
|
+
'sidebarNav.accessibleLabel': z.string().meta({
|
|
113
|
+
description:
|
|
114
|
+
'Accessible label for the main sidebar `<nav>` element to distinguish it from other `<nav>` landmarks on the page.',
|
|
115
|
+
}),
|
|
109
116
|
|
|
110
117
|
'tableOfContents.onThisPage': z
|
|
111
118
|
.string()
|
|
112
|
-
.
|
|
119
|
+
.meta({ description: 'Title for the table of contents component.' }),
|
|
113
120
|
|
|
114
|
-
'tableOfContents.overview': z
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
),
|
|
121
|
+
'tableOfContents.overview': z.string().meta({
|
|
122
|
+
description:
|
|
123
|
+
'Label used for the first link in the table of contents, linking to the page title.',
|
|
124
|
+
}),
|
|
119
125
|
|
|
120
|
-
'i18n.untranslatedContent': z
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
),
|
|
126
|
+
'i18n.untranslatedContent': z.string().meta({
|
|
127
|
+
description:
|
|
128
|
+
'Notice informing users they are on a page that is not yet translated to their language.',
|
|
129
|
+
}),
|
|
125
130
|
|
|
126
|
-
'page.editLink': z.string().
|
|
131
|
+
'page.editLink': z.string().meta({ description: 'Text for the link to edit a page.' }),
|
|
127
132
|
|
|
128
|
-
'page.lastUpdated': z
|
|
129
|
-
.
|
|
130
|
-
|
|
133
|
+
'page.lastUpdated': z.string().meta({
|
|
134
|
+
description: 'Text displayed in front of the last updated date in the page footer.',
|
|
135
|
+
}),
|
|
131
136
|
|
|
132
|
-
'page.previousLink': z
|
|
133
|
-
.
|
|
134
|
-
|
|
137
|
+
'page.previousLink': z.string().meta({
|
|
138
|
+
description: 'Label shown on the “previous page” pagination arrow in the page footer.',
|
|
139
|
+
}),
|
|
135
140
|
|
|
136
|
-
'page.nextLink': z
|
|
137
|
-
.
|
|
138
|
-
|
|
141
|
+
'page.nextLink': z.string().meta({
|
|
142
|
+
description: 'Label shown on the “next page” pagination arrow in the page footer.',
|
|
143
|
+
}),
|
|
139
144
|
|
|
140
|
-
'page.draft': z
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
),
|
|
145
|
+
'page.draft': z.string().meta({
|
|
146
|
+
description:
|
|
147
|
+
'Development-only notice informing users they are on a page that is a draft which will not be included in production builds.',
|
|
148
|
+
}),
|
|
145
149
|
|
|
146
|
-
'404.text': z.string().
|
|
147
|
-
'aside.tip': z.string().
|
|
148
|
-
'aside.note': z.string().
|
|
149
|
-
'aside.caution': z.string().
|
|
150
|
-
'aside.danger': z.string().
|
|
150
|
+
'404.text': z.string().meta({ description: 'Text shown on Starlight’s default 404 page' }),
|
|
151
|
+
'aside.tip': z.string().meta({ description: 'Text shown on the tip aside variant' }),
|
|
152
|
+
'aside.note': z.string().meta({ description: 'Text shown on the note aside variant' }),
|
|
153
|
+
'aside.caution': z.string().meta({ description: 'Text shown on the warning aside variant' }),
|
|
154
|
+
'aside.danger': z.string().meta({ description: 'Text shown on the danger aside variant' }),
|
|
151
155
|
|
|
152
156
|
'fileTree.directory': z
|
|
153
157
|
.string()
|
|
154
|
-
.
|
|
158
|
+
.meta({ description: 'Label for the directory icon in the file tree component.' }),
|
|
155
159
|
|
|
156
|
-
'builtWithStarlight.label': z
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
),
|
|
160
|
+
'builtWithStarlight.label': z.string().meta({
|
|
161
|
+
description:
|
|
162
|
+
'Label for the “Built with Starlight” badge optionally displayed in the site footer.',
|
|
163
|
+
}),
|
|
161
164
|
|
|
162
|
-
'heading.anchorLabel': z
|
|
165
|
+
'heading.anchorLabel': z
|
|
166
|
+
.string()
|
|
167
|
+
.meta({ description: 'Label for anchor links in Markdown content.' }),
|
|
163
168
|
})
|
|
164
169
|
.partial();
|
|
165
170
|
}
|
|
@@ -167,65 +172,55 @@ function starlightI18nSchema() {
|
|
|
167
172
|
function pagefindI18nSchema() {
|
|
168
173
|
return z
|
|
169
174
|
.object({
|
|
170
|
-
'pagefind.clear_search': z
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
'Pagefind UI translation. English default value: `"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
'pagefind.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
.string()
|
|
220
|
-
.describe(
|
|
221
|
-
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]. Try one of the following searches:"`. See https://pagefind.app/docs/ui/#translations'
|
|
222
|
-
),
|
|
223
|
-
|
|
224
|
-
'pagefind.searching': z
|
|
225
|
-
.string()
|
|
226
|
-
.describe(
|
|
227
|
-
'Pagefind UI translation. English default value: `"Searching for [SEARCH_TERM]..."`. See https://pagefind.app/docs/ui/#translations'
|
|
228
|
-
),
|
|
175
|
+
'pagefind.clear_search': z.string().meta({
|
|
176
|
+
description:
|
|
177
|
+
'Pagefind UI translation. English default value: `"Clear"`. See https://pagefind.app/docs/ui/#translations',
|
|
178
|
+
}),
|
|
179
|
+
|
|
180
|
+
'pagefind.load_more': z.string().meta({
|
|
181
|
+
description:
|
|
182
|
+
'Pagefind UI translation. English default value: `"Load more results"`. See https://pagefind.app/docs/ui/#translations',
|
|
183
|
+
}),
|
|
184
|
+
|
|
185
|
+
'pagefind.search_label': z.string().meta({
|
|
186
|
+
description:
|
|
187
|
+
'Pagefind UI translation. English default value: `"Search this site"`. See https://pagefind.app/docs/ui/#translations',
|
|
188
|
+
}),
|
|
189
|
+
|
|
190
|
+
'pagefind.filters_label': z.string().meta({
|
|
191
|
+
description:
|
|
192
|
+
'Pagefind UI translation. English default value: `"Filters"`. See https://pagefind.app/docs/ui/#translations',
|
|
193
|
+
}),
|
|
194
|
+
|
|
195
|
+
'pagefind.zero_results': z.string().meta({
|
|
196
|
+
description:
|
|
197
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations',
|
|
198
|
+
}),
|
|
199
|
+
|
|
200
|
+
'pagefind.many_results': z.string().meta({
|
|
201
|
+
description:
|
|
202
|
+
'Pagefind UI translation. English default value: `"[COUNT] results for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations',
|
|
203
|
+
}),
|
|
204
|
+
|
|
205
|
+
'pagefind.one_result': z.string().meta({
|
|
206
|
+
description:
|
|
207
|
+
'Pagefind UI translation. English default value: `"[COUNT] result for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations',
|
|
208
|
+
}),
|
|
209
|
+
|
|
210
|
+
'pagefind.alt_search': z.string().meta({
|
|
211
|
+
description:
|
|
212
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]. Showing results for [DIFFERENT_TERM] instead"`. See https://pagefind.app/docs/ui/#translations',
|
|
213
|
+
}),
|
|
214
|
+
|
|
215
|
+
'pagefind.search_suggestion': z.string().meta({
|
|
216
|
+
description:
|
|
217
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]. Try one of the following searches:"`. See https://pagefind.app/docs/ui/#translations',
|
|
218
|
+
}),
|
|
219
|
+
|
|
220
|
+
'pagefind.searching': z.string().meta({
|
|
221
|
+
description:
|
|
222
|
+
'Pagefind UI translation. English default value: `"Searching for [SEARCH_TERM]..."`. See https://pagefind.app/docs/ui/#translations',
|
|
223
|
+
}),
|
|
229
224
|
})
|
|
230
225
|
.partial();
|
|
231
226
|
}
|
|
@@ -233,17 +228,17 @@ function pagefindI18nSchema() {
|
|
|
233
228
|
function expressiveCodeI18nSchema() {
|
|
234
229
|
return z
|
|
235
230
|
.object({
|
|
236
|
-
'expressiveCode.copyButtonCopied': z
|
|
237
|
-
.
|
|
238
|
-
|
|
231
|
+
'expressiveCode.copyButtonCopied': z.string().meta({
|
|
232
|
+
description: 'Expressive Code UI translation. English default value: `"Copied!"`',
|
|
233
|
+
}),
|
|
239
234
|
|
|
240
|
-
'expressiveCode.copyButtonTooltip': z
|
|
241
|
-
.
|
|
242
|
-
|
|
235
|
+
'expressiveCode.copyButtonTooltip': z.string().meta({
|
|
236
|
+
description: 'Expressive Code UI translation. English default value: `"Copy to clipboard"`',
|
|
237
|
+
}),
|
|
243
238
|
|
|
244
|
-
'expressiveCode.terminalWindowFallbackTitle': z
|
|
245
|
-
.
|
|
246
|
-
|
|
239
|
+
'expressiveCode.terminalWindowFallbackTitle': z.string().meta({
|
|
240
|
+
description: 'Expressive Code UI translation. English default value: `"Terminal window"`',
|
|
241
|
+
}),
|
|
247
242
|
})
|
|
248
243
|
.partial();
|
|
249
244
|
}
|
package/schemas/icon.ts
CHANGED
package/schemas/pagefind.ts
CHANGED
|
@@ -57,7 +57,7 @@ const pagefindIndexOptionsSchema = z.object({
|
|
|
57
57
|
*
|
|
58
58
|
* @see https://pagefind.app/docs/multisite/#filtering-results-by-index
|
|
59
59
|
*/
|
|
60
|
-
mergeFilter: z.record(z.string(), z.string().or(z.
|
|
60
|
+
mergeFilter: z.record(z.string(), z.string().or(z.tuple([z.string()], z.string()))).optional(),
|
|
61
61
|
/**
|
|
62
62
|
* Language of this index.
|
|
63
63
|
*
|
|
@@ -68,7 +68,7 @@ const pagefindIndexOptionsSchema = z.object({
|
|
|
68
68
|
* Configure how search result rankings are calculated by Pagefind.
|
|
69
69
|
*/
|
|
70
70
|
// We apply a default value to merged indexes in order to share the same ranking for them and the current site when not set explicitly.
|
|
71
|
-
ranking: pagefindRankingWeightsSchema.
|
|
71
|
+
ranking: pagefindRankingWeightsSchema.prefault({}),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const pagefindSchema = z.object({
|
|
@@ -80,7 +80,7 @@ const pagefindSchema = z.object({
|
|
|
80
80
|
*/
|
|
81
81
|
indexWeight: indexWeightSchema,
|
|
82
82
|
/** Configure how search result rankings are calculated by Pagefind. */
|
|
83
|
-
ranking: pagefindRankingWeightsSchema.
|
|
83
|
+
ranking: pagefindRankingWeightsSchema.prefault({}),
|
|
84
84
|
/**
|
|
85
85
|
* Configure how search indexes from different sites are merged by Pagefind.
|
|
86
86
|
*
|
|
@@ -93,7 +93,8 @@ const pagefindSchema = z.object({
|
|
|
93
93
|
*
|
|
94
94
|
* @see https://github.com/CloudCannon/pagefind/blob/v1.3.0/pagefind_web_js/lib/coupled_search.ts#L549
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
z.object({
|
|
97
|
+
...pagefindIndexOptionsSchema.shape,
|
|
97
98
|
/**
|
|
98
99
|
* Set Pagefind’s `bundlePath` mergeIndex option.
|
|
99
100
|
*
|
package/schemas/prevNextLink.ts
CHANGED
|
@@ -5,14 +5,12 @@ export const PrevNextLinkConfigSchema = () =>
|
|
|
5
5
|
.union([
|
|
6
6
|
z.boolean(),
|
|
7
7
|
z.string(),
|
|
8
|
-
z
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
.strict(),
|
|
8
|
+
z.strictObject({
|
|
9
|
+
/** The navigation link URL. */
|
|
10
|
+
link: z.string().optional(),
|
|
11
|
+
/** The navigation link text. */
|
|
12
|
+
label: z.string().optional(),
|
|
13
|
+
}),
|
|
16
14
|
])
|
|
17
15
|
.optional();
|
|
18
16
|
|