starlight-theme-apple 0.7.0 → 0.9.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 +37 -0
- package/README.md +47 -5
- package/components/Footer.astro +19 -0
- package/components/Header.astro +55 -0
- package/components/NavLink.astro +24 -0
- package/components/PageFrame.astro +11 -0
- package/components/PageTitle.astro +24 -40
- package/components/Pagination.astro +22 -29
- package/components/Sidebar.astro +27 -0
- package/components/SiteFooter.astro +61 -0
- package/components/SocialIcons.astro +22 -0
- package/components.ts +10 -0
- package/index.ts +81 -120
- package/libs/breadcrumbs.ts +80 -0
- package/libs/config.ts +54 -0
- package/libs/expressive-code.ts +246 -0
- package/libs/links.ts +38 -0
- package/package.json +11 -5
- package/styles/base.css +35 -53
- package/styles/code.css +7 -83
- package/styles/components.css +599 -0
- package/styles/content.css +224 -425
- package/styles/header.css +217 -62
- package/styles/reference.css +332 -0
- package/styles/search.css +87 -73
- package/styles/sidebar.css +77 -56
- package/styles/toc.css +51 -44
- package/styles/tokens.css +130 -93
- package/styles.css +4 -4
- package/translations.ts +31 -0
- package/user-components/Availability.astro +21 -0
- package/user-components/Declaration.astro +16 -0
- package/user-components/Figure.astro +58 -0
- package/user-components/Parameter.astro +14 -0
- package/user-components/ParameterList.astro +11 -0
- package/user-components/ReferenceEntry.astro +12 -0
- package/user-components/ReferenceMeta.astro +30 -0
- package/user-components/TopicLink.astro +17 -0
- package/user-components/TopicList.astro +5 -0
- package/user-components/ValueList.astro +20 -0
- package/virtual.d.ts +10 -0
- package/styles/controls.css +0 -190
- package/styles/responsive.css +0 -157
package/styles/tokens.css
CHANGED
|
@@ -1,117 +1,154 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Design tokens.
|
|
3
|
+
*
|
|
4
|
+
* `--apple-*` tokens are the theme's public customization surface. Starlight's own `--sl-*`
|
|
5
|
+
* variables are derived from them, so Starlight components and other plugins pick up the
|
|
6
|
+
* same palette, type scale, and layout dimensions. Override either set in unlayered CSS.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
:root,
|
|
10
|
+
::backdrop {
|
|
2
11
|
color-scheme: dark;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
--apple-
|
|
6
|
-
--apple-
|
|
7
|
-
--apple-
|
|
8
|
-
--apple-
|
|
9
|
-
--apple-
|
|
12
|
+
|
|
13
|
+
/* Palette (dark appearance) */
|
|
14
|
+
--apple-background: #000;
|
|
15
|
+
--apple-secondary-background: #1d1d1f;
|
|
16
|
+
--apple-code-background: #1d1d1f;
|
|
17
|
+
--apple-fill: #333336;
|
|
18
|
+
--apple-fill-secondary: #1d1d1f;
|
|
10
19
|
--apple-foreground: #f5f5f7;
|
|
11
|
-
--apple-secondary-foreground: #
|
|
12
|
-
--apple-tertiary-foreground: #
|
|
13
|
-
--apple-hairline:
|
|
14
|
-
--apple-
|
|
15
|
-
--apple-
|
|
16
|
-
--apple-
|
|
17
|
-
--apple-
|
|
18
|
-
--apple-button-
|
|
19
|
-
--apple-
|
|
20
|
-
--apple-
|
|
21
|
-
--apple-
|
|
22
|
-
--apple-button-secondary-hover: #2a2a2a;
|
|
23
|
-
--apple-control-primary-text: #fff;
|
|
24
|
-
--apple-disabled-opacity: 0.42;
|
|
25
|
-
--apple-header-background: rgba(22, 22, 23, 0.88);
|
|
26
|
-
--apple-code-background: #1c1c1e;
|
|
27
|
-
--apple-aside-background: #1c1c1e;
|
|
28
|
-
--apple-note: #8e8e93;
|
|
29
|
-
--apple-warning: #ff9f0a;
|
|
20
|
+
--apple-secondary-foreground: #a1a1a6;
|
|
21
|
+
--apple-tertiary-foreground: #86868b;
|
|
22
|
+
--apple-hairline: #424245;
|
|
23
|
+
--apple-link: #2997ff;
|
|
24
|
+
--apple-focus: rgb(0 125 250 / 0.6);
|
|
25
|
+
--apple-button-background: #0071e3;
|
|
26
|
+
--apple-button-background-hover: #0077ed;
|
|
27
|
+
--apple-button-foreground: #fff;
|
|
28
|
+
--apple-note: #a1a1a6;
|
|
29
|
+
--apple-tip: #30d158;
|
|
30
|
+
--apple-caution: #ffb340;
|
|
30
31
|
--apple-danger: #ff6961;
|
|
31
32
|
--apple-success: #30d158;
|
|
33
|
+
|
|
34
|
+
/* Type */
|
|
32
35
|
--apple-font-sans:
|
|
33
|
-
-apple-system, BlinkMacSystemFont,
|
|
34
|
-
Arial, sans-serif;
|
|
36
|
+
-apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Helvetica Neue",
|
|
37
|
+
Helvetica, Arial, sans-serif;
|
|
35
38
|
--apple-font-mono:
|
|
36
|
-
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
37
|
-
monospace;
|
|
38
|
-
--apple-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
--apple-content-width: 48rem;
|
|
42
|
-
--apple-row-height: 2rem;
|
|
39
|
+
ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas,
|
|
40
|
+
"Liberation Mono", monospace;
|
|
41
|
+
--apple-text-lead: 1.3125rem;
|
|
42
|
+
|
|
43
|
+
/* Shape */
|
|
43
44
|
--apple-radius-sm: 0.375rem;
|
|
44
|
-
--apple-radius-panel: 0.
|
|
45
|
-
--apple-
|
|
46
|
-
--apple-
|
|
47
|
-
--
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
--sl-sidebar-width: var(--apple-sidebar-width);
|
|
51
|
-
--sl-content-width: var(--apple-content-width);
|
|
52
|
-
--sl-content-pad-x: clamp(1.25rem, 3vw, 2.5rem);
|
|
53
|
-
--sl-color-accent-low: #132f4d;
|
|
54
|
-
--sl-color-accent: var(--apple-link);
|
|
55
|
-
--sl-color-accent-high: #a8d1ff;
|
|
45
|
+
--apple-radius-panel: 0.9375rem;
|
|
46
|
+
--apple-radius-card: 1.125rem;
|
|
47
|
+
--apple-transition-easing: cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
48
|
+
--apple-transition: 160ms var(--apple-transition-easing);
|
|
49
|
+
|
|
50
|
+
/* Starlight: palette */
|
|
56
51
|
--sl-color-white: var(--apple-foreground);
|
|
57
|
-
--sl-color-gray-1: #
|
|
58
|
-
--sl-color-gray-2: #
|
|
52
|
+
--sl-color-gray-1: #e8e8ed;
|
|
53
|
+
--sl-color-gray-2: #d2d2d7;
|
|
59
54
|
--sl-color-gray-3: var(--apple-secondary-foreground);
|
|
60
55
|
--sl-color-gray-4: var(--apple-tertiary-foreground);
|
|
61
|
-
--sl-color-gray-5: var(--apple-
|
|
62
|
-
--sl-color-gray-6: var(--apple-
|
|
63
|
-
--sl-color-gray-7: #
|
|
56
|
+
--sl-color-gray-5: var(--apple-hairline);
|
|
57
|
+
--sl-color-gray-6: var(--apple-secondary-background);
|
|
58
|
+
--sl-color-gray-7: #111112;
|
|
64
59
|
--sl-color-black: var(--apple-background);
|
|
60
|
+
--sl-color-accent-low: #0b2a4a;
|
|
61
|
+
--sl-color-accent: var(--apple-link);
|
|
62
|
+
--sl-color-accent-high: #a9d3ff;
|
|
63
|
+
--sl-color-text: var(--apple-foreground);
|
|
64
|
+
--sl-color-text-accent: var(--apple-link);
|
|
65
|
+
--sl-color-text-invert: #fff;
|
|
65
66
|
--sl-color-bg: var(--apple-background);
|
|
66
|
-
--sl-color-bg-nav: var(--apple-
|
|
67
|
-
--sl-color-bg-sidebar: var(--apple-
|
|
68
|
-
--sl-color-
|
|
67
|
+
--sl-color-bg-nav: var(--apple-background);
|
|
68
|
+
--sl-color-bg-sidebar: var(--apple-background);
|
|
69
|
+
--sl-color-bg-inline-code: transparent;
|
|
70
|
+
--sl-color-bg-accent: var(--apple-button-background);
|
|
71
|
+
--sl-color-hairline: var(--apple-hairline);
|
|
69
72
|
--sl-color-hairline-light: var(--apple-hairline);
|
|
73
|
+
--sl-color-hairline-shade: var(--apple-hairline);
|
|
74
|
+
--sl-color-backdrop-overlay: rgb(0 0 0 / 0.5);
|
|
75
|
+
--sl-shadow-md: 0 4px 12px rgb(0 0 0 / 0.24);
|
|
76
|
+
--sl-shadow-lg: 0 16px 48px rgb(0 0 0 / 0.4);
|
|
77
|
+
|
|
78
|
+
/* Starlight: type. Sizes follow Apple's documentation scale (17px body). */
|
|
79
|
+
--sl-font: var(--apple-font-sans);
|
|
80
|
+
--sl-font-mono: var(--apple-font-mono);
|
|
70
81
|
--sl-text-body: 1.0625rem;
|
|
71
|
-
--sl-text-
|
|
72
|
-
--sl-text-
|
|
73
|
-
--sl-
|
|
74
|
-
--sl-
|
|
75
|
-
--sl-
|
|
82
|
+
--sl-text-code: 0.875rem;
|
|
83
|
+
--sl-text-code-sm: 0.94em;
|
|
84
|
+
--sl-line-height: 1.4706;
|
|
85
|
+
--sl-line-height-headings: 1.125;
|
|
86
|
+
--sl-text-h1: 2rem;
|
|
87
|
+
--sl-text-h2: 1.6875rem;
|
|
88
|
+
--sl-text-h3: 1.3125rem;
|
|
89
|
+
--sl-text-h4: 1.1875rem;
|
|
90
|
+
--sl-text-h5: 1.0625rem;
|
|
91
|
+
--sl-text-h6: 1.0625rem;
|
|
92
|
+
|
|
93
|
+
/* Starlight: layout */
|
|
94
|
+
--sl-nav-height: 3.25rem;
|
|
95
|
+
--sl-nav-pad-x: 1.25rem;
|
|
96
|
+
--sl-nav-pad-y: 0.5rem;
|
|
97
|
+
--sl-nav-gap: 1rem;
|
|
98
|
+
--sl-menu-button-size: 2.25rem;
|
|
99
|
+
--sl-sidebar-width: 17.5rem;
|
|
100
|
+
--sl-sidebar-pad-x: 0.75rem;
|
|
101
|
+
--sl-content-width: 51.25rem;
|
|
102
|
+
--sl-content-pad-x: 1.25rem;
|
|
76
103
|
--sl-content-gap-y: 1rem;
|
|
104
|
+
--sl-mobile-toc-height: 3rem;
|
|
77
105
|
}
|
|
78
106
|
|
|
79
|
-
:root[data-theme="light"]
|
|
107
|
+
:root[data-theme="light"],
|
|
108
|
+
[data-theme="light"] ::backdrop {
|
|
80
109
|
color-scheme: light;
|
|
110
|
+
|
|
81
111
|
--apple-background: #fff;
|
|
82
|
-
--apple-
|
|
83
|
-
--apple-
|
|
84
|
-
--apple-
|
|
85
|
-
--apple-
|
|
86
|
-
--apple-hover-surface: rgba(51, 102, 255, 0.05);
|
|
87
|
-
--apple-active-surface: rgba(0, 102, 204, 0.08);
|
|
112
|
+
--apple-secondary-background: #f5f5f7;
|
|
113
|
+
--apple-code-background: #f5f5f7;
|
|
114
|
+
--apple-fill: #e8e8ed;
|
|
115
|
+
--apple-fill-secondary: #f5f5f7;
|
|
88
116
|
--apple-foreground: #1d1d1f;
|
|
89
117
|
--apple-secondary-foreground: #6e6e73;
|
|
90
|
-
--apple-tertiary-foreground: #
|
|
91
|
-
--apple-hairline:
|
|
92
|
-
--apple-border: #ccc;
|
|
118
|
+
--apple-tertiary-foreground: #6e6e73;
|
|
119
|
+
--apple-hairline: #d2d2d7;
|
|
93
120
|
--apple-link: #0066cc;
|
|
94
|
-
--apple-
|
|
95
|
-
--apple-
|
|
96
|
-
--apple-
|
|
97
|
-
--apple-
|
|
98
|
-
--apple-
|
|
99
|
-
--apple-
|
|
100
|
-
|
|
101
|
-
--
|
|
102
|
-
--
|
|
103
|
-
--
|
|
104
|
-
--
|
|
105
|
-
--apple-warning: #9a5700;
|
|
106
|
-
--apple-danger: #c7362c;
|
|
107
|
-
--apple-success: #21783b;
|
|
108
|
-
--sl-color-accent-low: #e8f2ff;
|
|
121
|
+
--apple-focus: rgb(0 125 250 / 0.6);
|
|
122
|
+
--apple-note: #6e6e73;
|
|
123
|
+
--apple-tip: #1d7a32;
|
|
124
|
+
--apple-caution: #a35200;
|
|
125
|
+
--apple-danger: #d70015;
|
|
126
|
+
--apple-success: #1d7a32;
|
|
127
|
+
|
|
128
|
+
--sl-color-gray-1: #1d1d1f;
|
|
129
|
+
--sl-color-gray-2: #424245;
|
|
130
|
+
--sl-color-gray-7: #fbfbfd;
|
|
131
|
+
--sl-color-accent-low: #e8f2fc;
|
|
109
132
|
--sl-color-accent-high: #004b99;
|
|
110
|
-
--sl-color-
|
|
111
|
-
--sl-
|
|
112
|
-
--sl-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
--sl-color-backdrop-overlay: rgb(0 0 0 / 0.24);
|
|
134
|
+
--sl-shadow-md: 0 4px 12px rgb(0 0 0 / 0.08);
|
|
135
|
+
--sl-shadow-lg: 0 16px 48px rgb(0 0 0 / 0.16);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@media (min-width: 50rem) {
|
|
139
|
+
:root {
|
|
140
|
+
--sl-nav-pad-x: 1.375rem;
|
|
141
|
+
--sl-content-pad-x: 2rem;
|
|
142
|
+
--sl-text-h1: 2.5rem;
|
|
143
|
+
--sl-text-h2: 2rem;
|
|
144
|
+
--sl-text-h3: 1.5rem;
|
|
145
|
+
--sl-text-h4: 1.3125rem;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (min-width: 72rem) {
|
|
150
|
+
:root {
|
|
151
|
+
--sl-content-pad-x: 3rem;
|
|
152
|
+
--sl-mobile-toc-height: 0rem;
|
|
153
|
+
}
|
|
117
154
|
}
|
package/styles.css
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
@import "./styles/base.css" layer(apple-docs);
|
|
5
5
|
@import "./styles/header.css" layer(apple-docs);
|
|
6
6
|
@import "./styles/sidebar.css" layer(apple-docs);
|
|
7
|
-
@import "./styles/content.css" layer(apple-docs);
|
|
8
7
|
@import "./styles/toc.css" layer(apple-docs);
|
|
9
|
-
@import "./styles/code.css" layer(apple-docs);
|
|
10
|
-
@import "./styles/controls.css" layer(apple-docs);
|
|
11
8
|
@import "./styles/search.css" layer(apple-docs);
|
|
12
|
-
@import "./styles/
|
|
9
|
+
@import "./styles/content.css" layer(apple-docs);
|
|
10
|
+
@import "./styles/code.css" layer(apple-docs);
|
|
11
|
+
@import "./styles/components.css" layer(apple-docs);
|
|
12
|
+
@import "./styles/reference.css" layer(apple-docs);
|
package/translations.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** UI strings rendered by theme components. Other languages fall back to English. */
|
|
2
|
+
export const translations = {
|
|
3
|
+
en: {
|
|
4
|
+
"starlightThemeApple.documentation": "Documentation",
|
|
5
|
+
"starlightThemeApple.community": "Community",
|
|
6
|
+
"starlightThemeApple.primaryNav": "Primary",
|
|
7
|
+
"starlightThemeApple.footerNav": "Footer",
|
|
8
|
+
"starlightThemeApple.breadcrumbs": "Breadcrumbs",
|
|
9
|
+
},
|
|
10
|
+
fr: {
|
|
11
|
+
"starlightThemeApple.documentation": "Documentation",
|
|
12
|
+
"starlightThemeApple.community": "Communauté",
|
|
13
|
+
"starlightThemeApple.primaryNav": "Principale",
|
|
14
|
+
"starlightThemeApple.footerNav": "Pied de page",
|
|
15
|
+
"starlightThemeApple.breadcrumbs": "Fil d’Ariane",
|
|
16
|
+
},
|
|
17
|
+
de: {
|
|
18
|
+
"starlightThemeApple.documentation": "Dokumentation",
|
|
19
|
+
"starlightThemeApple.community": "Community",
|
|
20
|
+
"starlightThemeApple.primaryNav": "Hauptnavigation",
|
|
21
|
+
"starlightThemeApple.footerNav": "Fußzeile",
|
|
22
|
+
"starlightThemeApple.breadcrumbs": "Brotkrumen",
|
|
23
|
+
},
|
|
24
|
+
es: {
|
|
25
|
+
"starlightThemeApple.documentation": "Documentación",
|
|
26
|
+
"starlightThemeApple.community": "Comunidad",
|
|
27
|
+
"starlightThemeApple.primaryNav": "Principal",
|
|
28
|
+
"starlightThemeApple.footerNav": "Pie de página",
|
|
29
|
+
"starlightThemeApple.breadcrumbs": "Ruta de navegación",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Variant = "note" | "tip" | "caution" | "danger";
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Platforms or versions, e.g. `["macOS 14+", "SDK 2.0+"]`, and optional status items. */
|
|
5
|
+
items: Array<string | { label: string; variant?: Variant }>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { items } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<ul class="apple-availability">
|
|
12
|
+
{
|
|
13
|
+
items.map((item) =>
|
|
14
|
+
typeof item === "string" ? (
|
|
15
|
+
<li>{item}</li>
|
|
16
|
+
) : (
|
|
17
|
+
<li data-variant={item.variant}>{item.label}</li>
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
</ul>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Declaration source. Omit to use the slot, which may contain links. */
|
|
4
|
+
code?: string;
|
|
5
|
+
/** Optional caption, such as “Usage”. */
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { code, label } = Astro.props;
|
|
10
|
+
const html =
|
|
11
|
+
code === undefined ? (await Astro.slots.render("default")).trim() : undefined;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
{label && <p class="apple-label">{label}</p>}
|
|
15
|
+
<pre
|
|
16
|
+
class="apple-declaration">{html === undefined ? <code>{code}</code> : <code set:html={html} />}</pre>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Image } from "astro:assets";
|
|
3
|
+
|
|
4
|
+
type Source = ImageMetadata | string;
|
|
5
|
+
interface Props {
|
|
6
|
+
src: Source;
|
|
7
|
+
/** Alternate image shown in the dark appearance. */
|
|
8
|
+
darkSrc?: Source;
|
|
9
|
+
alt: string;
|
|
10
|
+
caption?: string;
|
|
11
|
+
/** Frame screenshots with a hairline, rounded corners, and a soft shadow. */
|
|
12
|
+
framed?: boolean;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
src,
|
|
19
|
+
darkSrc,
|
|
20
|
+
alt,
|
|
21
|
+
caption,
|
|
22
|
+
framed = false,
|
|
23
|
+
width,
|
|
24
|
+
height,
|
|
25
|
+
} = Astro.props;
|
|
26
|
+
const size = { ...(width ? { width } : {}), ...(height ? { height } : {}) };
|
|
27
|
+
const sources = darkSrc
|
|
28
|
+
? [
|
|
29
|
+
{ src, class: "dark:sl-hidden" },
|
|
30
|
+
{ src: darkSrc, class: "light:sl-hidden" },
|
|
31
|
+
]
|
|
32
|
+
: [{ src, class: undefined }];
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<figure class="apple-figure" data-frame={framed ? "" : undefined}>
|
|
36
|
+
{
|
|
37
|
+
sources.map((source) =>
|
|
38
|
+
typeof source.src === "string" ? (
|
|
39
|
+
<img
|
|
40
|
+
src={source.src}
|
|
41
|
+
alt={alt}
|
|
42
|
+
class={source.class}
|
|
43
|
+
loading="lazy"
|
|
44
|
+
decoding="async"
|
|
45
|
+
{...size}
|
|
46
|
+
/>
|
|
47
|
+
) : (
|
|
48
|
+
<Image
|
|
49
|
+
src={source.src}
|
|
50
|
+
alt={alt}
|
|
51
|
+
{...(source.class ? { class: source.class } : {})}
|
|
52
|
+
{...size}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
{caption && <figcaption>{caption}</figcaption>}
|
|
58
|
+
</figure>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
|
|
4
|
+
interface Props extends HTMLAttributes<"section"> {
|
|
5
|
+
/** Element to render. Use `article` for self-contained entries such as releases. */
|
|
6
|
+
as?: "section" | "article" | "div";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { as: Tag = "section", class: className, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<Tag class:list={["apple-entry", className]} {...attrs}><slot /></Tag>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Value = string | number | boolean;
|
|
3
|
+
interface Item {
|
|
4
|
+
label: string;
|
|
5
|
+
value: Value;
|
|
6
|
+
/** Render the value as code. */
|
|
7
|
+
code?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
/** Metadata in display order, e.g. `{ Type: "boolean", Default: "false" }` or a list of items. */
|
|
12
|
+
items: Record<string, Value> | Item[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { items } = Astro.props;
|
|
16
|
+
const rows: Item[] = Array.isArray(items)
|
|
17
|
+
? items
|
|
18
|
+
: Object.entries(items).map(([label, value]) => ({ label, value }));
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<dl class="apple-meta">
|
|
22
|
+
{
|
|
23
|
+
rows.map(({ label, value, code }) => (
|
|
24
|
+
<div>
|
|
25
|
+
<dt>{label}</dt>
|
|
26
|
+
<dd>{code ? <code>{String(value)}</code> : String(value)}</dd>
|
|
27
|
+
</div>
|
|
28
|
+
))
|
|
29
|
+
}
|
|
30
|
+
</dl>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
href: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** Render the title in code voice, for symbols, commands, and settings. */
|
|
6
|
+
code?: boolean;
|
|
7
|
+
/** Short abstract. The slot can be used instead for rich content. */
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { href, title, code, description } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<li>
|
|
15
|
+
<a href={href}>{code ? <code>{title}</code> : title}</a>
|
|
16
|
+
{description ? <p>{description}</p> : <slot />}
|
|
17
|
+
</li>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
values: string[];
|
|
4
|
+
/** Optional caption, such as “Possible values”. */
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { values, label } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
{label && <p class="apple-label">{label}</p>}
|
|
12
|
+
<ul class="apple-values">
|
|
13
|
+
{
|
|
14
|
+
values.map((value) => (
|
|
15
|
+
<li>
|
|
16
|
+
<code>{value}</code>
|
|
17
|
+
</li>
|
|
18
|
+
))
|
|
19
|
+
}
|
|
20
|
+
</ul>
|
package/virtual.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "virtual:starlight-theme-apple/config" {
|
|
2
|
+
const config: import("./libs/config").StarlightThemeAppleConfig;
|
|
3
|
+
export default config;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare namespace StarlightApp {
|
|
7
|
+
type ThemeAppleTranslations =
|
|
8
|
+
(typeof import("./translations").translations)["en"];
|
|
9
|
+
interface I18n extends ThemeAppleTranslations {}
|
|
10
|
+
}
|