@astrojs/starlight 0.42.2 → 0.42.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.
|
@@ -27,19 +27,16 @@ var StarlightTOC = class extends HTMLElement {
|
|
|
27
27
|
const isHeading = (el) => el.matches(this.tocHeadingSelector);
|
|
28
28
|
/** Walk up the DOM to find the nearest heading. */
|
|
29
29
|
const getElementHeading = (el) => {
|
|
30
|
-
if (!el) return null;
|
|
31
|
-
const origin = el;
|
|
32
30
|
while (el) {
|
|
33
31
|
if (el.matches(".sl-markdown-content, main > *")) return document.getElementById(PAGE_TITLE_ID);
|
|
34
32
|
if (isHeading(el)) return el;
|
|
35
33
|
const childHeading = el.querySelector(this.tocHeadingSelector);
|
|
36
34
|
if (childHeading) return childHeading;
|
|
37
|
-
|
|
38
|
-
while (
|
|
39
|
-
|
|
40
|
-
if (h) return h;
|
|
35
|
+
let prev = el.previousElementSibling;
|
|
36
|
+
while (prev?.lastElementChild) prev = prev.lastElementChild;
|
|
37
|
+
el = prev ?? el.parentElement;
|
|
41
38
|
}
|
|
42
|
-
return
|
|
39
|
+
return null;
|
|
43
40
|
};
|
|
44
41
|
/** Handle intersections and set the current link to the heading for the current intersection. */
|
|
45
42
|
const setCurrent = (entries) => {
|
package/dist/package.js
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ declare const StarlightFrontmatterSchema: (context: SchemaContext) => z.ZodObjec
|
|
|
11
11
|
editUrl: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodBoolean]>>>;
|
|
12
12
|
head: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
13
13
|
tag: z.ZodEnum<{
|
|
14
|
-
title: "title";
|
|
15
14
|
base: "base";
|
|
16
15
|
link: "link";
|
|
17
|
-
style: "style";
|
|
18
16
|
meta: "meta";
|
|
19
|
-
script: "script";
|
|
20
17
|
noscript: "noscript";
|
|
18
|
+
script: "script";
|
|
19
|
+
style: "style";
|
|
21
20
|
template: "template";
|
|
21
|
+
title: "title";
|
|
22
22
|
}>;
|
|
23
23
|
attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
|
|
24
24
|
content: z.ZodOptional<z.ZodString>;
|
package/dist/schemas/head.d.ts
CHANGED
|
@@ -16,14 +16,14 @@ declare const HeadConfigSchema: ({ source }: {
|
|
|
16
16
|
source: "config" | "content";
|
|
17
17
|
}) => z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
18
18
|
tag: z.ZodEnum<{
|
|
19
|
-
title: "title";
|
|
20
19
|
base: "base";
|
|
21
20
|
link: "link";
|
|
22
|
-
style: "style";
|
|
23
21
|
meta: "meta";
|
|
24
|
-
script: "script";
|
|
25
22
|
noscript: "noscript";
|
|
23
|
+
script: "script";
|
|
24
|
+
style: "style";
|
|
26
25
|
template: "template";
|
|
26
|
+
title: "title";
|
|
27
27
|
}>;
|
|
28
28
|
attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
|
|
29
29
|
content: z.ZodOptional<z.ZodString>;
|
package/dist/utils/plugins.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ declare function runPlugins(starlightUserConfig: StarlightUserConfig, pluginsUse
|
|
|
75
75
|
baseUrl?: string | undefined;
|
|
76
76
|
};
|
|
77
77
|
readonly head: {
|
|
78
|
-
tag: "
|
|
78
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
79
79
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
80
80
|
content?: string | undefined;
|
|
81
81
|
}[];
|
|
@@ -292,7 +292,7 @@ declare function runPlugins(starlightUserConfig: StarlightUserConfig, pluginsUse
|
|
|
292
292
|
baseUrl?: string | undefined;
|
|
293
293
|
};
|
|
294
294
|
readonly head: {
|
|
295
|
-
tag: "
|
|
295
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
296
296
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
297
297
|
content?: string | undefined;
|
|
298
298
|
}[];
|
|
@@ -667,8 +667,8 @@ declare const StarlightPluginsConfigSchema: z.ZodDefault<z.ZodArray<z.ZodObject<
|
|
|
667
667
|
addRouteMiddleware: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
668
668
|
entrypoint: z.ZodString;
|
|
669
669
|
order: z.ZodDefault<z.ZodEnum<{
|
|
670
|
-
default: "default";
|
|
671
670
|
pre: "pre";
|
|
671
|
+
default: "default";
|
|
672
672
|
post: "post";
|
|
673
673
|
}>>;
|
|
674
674
|
}, z.core.$strip>], null>, z.ZodVoid>;
|
|
@@ -686,8 +686,8 @@ declare const StarlightPluginsConfigSchema: z.ZodDefault<z.ZodArray<z.ZodObject<
|
|
|
686
686
|
addRouteMiddleware: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
687
687
|
entrypoint: z.ZodString;
|
|
688
688
|
order: z.ZodDefault<z.ZodEnum<{
|
|
689
|
-
default: "default";
|
|
690
689
|
pre: "pre";
|
|
690
|
+
default: "default";
|
|
691
691
|
post: "post";
|
|
692
692
|
}>>;
|
|
693
693
|
}, z.core.$strip>], null>, z.ZodVoid>;
|
|
@@ -825,14 +825,14 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
825
825
|
}, string>>]>>>;
|
|
826
826
|
head: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
827
827
|
tag: z.ZodEnum<{
|
|
828
|
-
title: "title";
|
|
829
828
|
base: "base";
|
|
830
829
|
link: "link";
|
|
831
|
-
style: "style";
|
|
832
830
|
meta: "meta";
|
|
833
|
-
script: "script";
|
|
834
831
|
noscript: "noscript";
|
|
832
|
+
script: "script";
|
|
833
|
+
style: "style";
|
|
835
834
|
template: "template";
|
|
835
|
+
title: "title";
|
|
836
836
|
}>;
|
|
837
837
|
attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
|
|
838
838
|
content: z.ZodOptional<z.ZodString>;
|
|
@@ -977,7 +977,7 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
977
977
|
baseUrl?: string | undefined;
|
|
978
978
|
};
|
|
979
979
|
head: {
|
|
980
|
-
tag: "
|
|
980
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
981
981
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
982
982
|
content?: string | undefined;
|
|
983
983
|
}[];
|
|
@@ -1171,7 +1171,7 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
1171
1171
|
baseUrl?: string | undefined;
|
|
1172
1172
|
};
|
|
1173
1173
|
head: {
|
|
1174
|
-
tag: "
|
|
1174
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
1175
1175
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
1176
1176
|
content?: string | undefined;
|
|
1177
1177
|
}[];
|
|
@@ -1442,7 +1442,7 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
1442
1442
|
baseUrl?: string | undefined;
|
|
1443
1443
|
};
|
|
1444
1444
|
readonly head: {
|
|
1445
|
-
tag: "
|
|
1445
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
1446
1446
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
1447
1447
|
content?: string | undefined;
|
|
1448
1448
|
}[];
|
|
@@ -1661,7 +1661,7 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
1661
1661
|
baseUrl?: string | undefined;
|
|
1662
1662
|
};
|
|
1663
1663
|
readonly head: {
|
|
1664
|
-
tag: "
|
|
1664
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
1665
1665
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
1666
1666
|
content?: string | undefined;
|
|
1667
1667
|
}[];
|
|
@@ -1869,7 +1869,7 @@ declare const StarlightConfigSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
1869
1869
|
baseUrl?: string | undefined;
|
|
1870
1870
|
};
|
|
1871
1871
|
head: {
|
|
1872
|
-
tag: "
|
|
1872
|
+
tag: "base" | "link" | "meta" | "noscript" | "script" | "style" | "template" | "title";
|
|
1873
1873
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
1874
1874
|
content?: string | undefined;
|
|
1875
1875
|
}[];
|