@barodoc/core 2.0.0 → 5.0.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/dist/{chunk-TOOKPXGT.js → chunk-PHWSKL62.js} +32 -8
- package/dist/config/index.d.ts +3 -279
- package/dist/config/index.js +3 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/index-gZocHQXv.d.ts +326 -0
- package/dist/index.d.ts +22 -4
- package/dist/index.js +183 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/{types-EzD7o05V.d.ts → types-BSnQ5EUW.d.ts} +8 -7
- package/package.json +1 -1
|
@@ -9,14 +9,25 @@ var i18nConfigSchema = z.object({
|
|
|
9
9
|
locales: z.array(z.string()),
|
|
10
10
|
labels: z.record(z.string()).optional()
|
|
11
11
|
}).optional();
|
|
12
|
+
var grayPresets = [
|
|
13
|
+
"zinc",
|
|
14
|
+
"slate",
|
|
15
|
+
"neutral",
|
|
16
|
+
"stone",
|
|
17
|
+
"gray"
|
|
18
|
+
];
|
|
12
19
|
var themeColorsSchema = z.object({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
accent: z.string().optional(),
|
|
21
|
+
gray: z.union([
|
|
22
|
+
z.enum(grayPresets),
|
|
23
|
+
z.string()
|
|
24
|
+
]).optional(),
|
|
25
|
+
light: z.object({
|
|
26
|
+
accent: z.string().optional()
|
|
27
|
+
}).optional(),
|
|
28
|
+
dark: z.object({
|
|
29
|
+
accent: z.string().optional()
|
|
30
|
+
}).optional()
|
|
20
31
|
}).optional();
|
|
21
32
|
var themeConfigSchema = z.object({
|
|
22
33
|
colors: themeColorsSchema,
|
|
@@ -48,6 +59,16 @@ var feedbackSchema = z.object({
|
|
|
48
59
|
enabled: z.boolean(),
|
|
49
60
|
endpoint: z.string().optional()
|
|
50
61
|
}).optional();
|
|
62
|
+
var docsFrontmatterSchema = z.object({
|
|
63
|
+
title: z.string().optional(),
|
|
64
|
+
description: z.string().optional(),
|
|
65
|
+
tags: z.array(z.string()).optional(),
|
|
66
|
+
related: z.array(z.string()).optional(),
|
|
67
|
+
category: z.string().optional(),
|
|
68
|
+
api_reference: z.boolean().optional(),
|
|
69
|
+
difficulty: z.enum(["beginner", "intermediate", "advanced"]).optional(),
|
|
70
|
+
lastUpdated: z.date().optional()
|
|
71
|
+
});
|
|
51
72
|
var pluginConfigSchema = z.union([
|
|
52
73
|
z.string(),
|
|
53
74
|
z.tuple([z.string(), z.record(z.unknown())])
|
|
@@ -115,13 +136,16 @@ function getConfigDefaults() {
|
|
|
115
136
|
},
|
|
116
137
|
theme: {
|
|
117
138
|
colors: {
|
|
118
|
-
|
|
139
|
+
accent: "#2563eb",
|
|
140
|
+
gray: "zinc"
|
|
119
141
|
}
|
|
120
142
|
}
|
|
121
143
|
};
|
|
122
144
|
}
|
|
123
145
|
|
|
124
146
|
export {
|
|
147
|
+
grayPresets,
|
|
148
|
+
docsFrontmatterSchema,
|
|
125
149
|
barodocConfigSchema,
|
|
126
150
|
loadConfig,
|
|
127
151
|
getConfigDefaults
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,280 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
export { B as BarodocConfigInput, a as BarodocConfigOutput, D as DocsFrontmatter, b as barodocConfigSchema, d as docsFrontmatterSchema, c as getConfigDefaults, l as loadConfig } from '../index-gZocHQXv.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../types-BSnQ5EUW.js';
|
|
3
4
|
import 'astro';
|
|
4
|
-
|
|
5
|
-
declare const barodocConfigSchema: z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
logo: z.ZodOptional<z.ZodString>;
|
|
8
|
-
favicon: z.ZodOptional<z.ZodString>;
|
|
9
|
-
site: z.ZodOptional<z.ZodString>;
|
|
10
|
-
base: z.ZodOptional<z.ZodString>;
|
|
11
|
-
theme: z.ZodOptional<z.ZodObject<{
|
|
12
|
-
colors: z.ZodOptional<z.ZodObject<{
|
|
13
|
-
primary: z.ZodOptional<z.ZodString>;
|
|
14
|
-
background: z.ZodOptional<z.ZodString>;
|
|
15
|
-
backgroundDark: z.ZodOptional<z.ZodString>;
|
|
16
|
-
text: z.ZodOptional<z.ZodString>;
|
|
17
|
-
textDark: z.ZodOptional<z.ZodString>;
|
|
18
|
-
border: z.ZodOptional<z.ZodString>;
|
|
19
|
-
borderDark: z.ZodOptional<z.ZodString>;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
primary?: string | undefined;
|
|
22
|
-
background?: string | undefined;
|
|
23
|
-
backgroundDark?: string | undefined;
|
|
24
|
-
text?: string | undefined;
|
|
25
|
-
textDark?: string | undefined;
|
|
26
|
-
border?: string | undefined;
|
|
27
|
-
borderDark?: string | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
primary?: string | undefined;
|
|
30
|
-
background?: string | undefined;
|
|
31
|
-
backgroundDark?: string | undefined;
|
|
32
|
-
text?: string | undefined;
|
|
33
|
-
textDark?: string | undefined;
|
|
34
|
-
border?: string | undefined;
|
|
35
|
-
borderDark?: string | undefined;
|
|
36
|
-
}>>;
|
|
37
|
-
fonts: z.ZodOptional<z.ZodObject<{
|
|
38
|
-
heading: z.ZodOptional<z.ZodString>;
|
|
39
|
-
body: z.ZodOptional<z.ZodString>;
|
|
40
|
-
code: z.ZodOptional<z.ZodString>;
|
|
41
|
-
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
code?: string | undefined;
|
|
43
|
-
heading?: string | undefined;
|
|
44
|
-
body?: string | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
code?: string | undefined;
|
|
47
|
-
heading?: string | undefined;
|
|
48
|
-
body?: string | undefined;
|
|
49
|
-
}>>;
|
|
50
|
-
radius: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
colors?: {
|
|
53
|
-
primary?: string | undefined;
|
|
54
|
-
background?: string | undefined;
|
|
55
|
-
backgroundDark?: string | undefined;
|
|
56
|
-
text?: string | undefined;
|
|
57
|
-
textDark?: string | undefined;
|
|
58
|
-
border?: string | undefined;
|
|
59
|
-
borderDark?: string | undefined;
|
|
60
|
-
} | undefined;
|
|
61
|
-
fonts?: {
|
|
62
|
-
code?: string | undefined;
|
|
63
|
-
heading?: string | undefined;
|
|
64
|
-
body?: string | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
radius?: string | undefined;
|
|
67
|
-
}, {
|
|
68
|
-
colors?: {
|
|
69
|
-
primary?: string | undefined;
|
|
70
|
-
background?: string | undefined;
|
|
71
|
-
backgroundDark?: string | undefined;
|
|
72
|
-
text?: string | undefined;
|
|
73
|
-
textDark?: string | undefined;
|
|
74
|
-
border?: string | undefined;
|
|
75
|
-
borderDark?: string | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
fonts?: {
|
|
78
|
-
code?: string | undefined;
|
|
79
|
-
heading?: string | undefined;
|
|
80
|
-
body?: string | undefined;
|
|
81
|
-
} | undefined;
|
|
82
|
-
radius?: string | undefined;
|
|
83
|
-
}>>;
|
|
84
|
-
i18n: z.ZodOptional<z.ZodObject<{
|
|
85
|
-
defaultLocale: z.ZodString;
|
|
86
|
-
locales: z.ZodArray<z.ZodString, "many">;
|
|
87
|
-
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
88
|
-
}, "strip", z.ZodTypeAny, {
|
|
89
|
-
defaultLocale: string;
|
|
90
|
-
locales: string[];
|
|
91
|
-
labels?: Record<string, string> | undefined;
|
|
92
|
-
}, {
|
|
93
|
-
defaultLocale: string;
|
|
94
|
-
locales: string[];
|
|
95
|
-
labels?: Record<string, string> | undefined;
|
|
96
|
-
}>>;
|
|
97
|
-
navigation: z.ZodArray<z.ZodObject<{
|
|
98
|
-
group: z.ZodString;
|
|
99
|
-
pages: z.ZodArray<z.ZodString, "many">;
|
|
100
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
101
|
-
group: z.ZodString;
|
|
102
|
-
pages: z.ZodArray<z.ZodString, "many">;
|
|
103
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
104
|
-
group: z.ZodString;
|
|
105
|
-
pages: z.ZodArray<z.ZodString, "many">;
|
|
106
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
107
|
-
topbar: z.ZodOptional<z.ZodObject<{
|
|
108
|
-
github: z.ZodOptional<z.ZodString>;
|
|
109
|
-
discord: z.ZodOptional<z.ZodString>;
|
|
110
|
-
twitter: z.ZodOptional<z.ZodString>;
|
|
111
|
-
}, "strip", z.ZodTypeAny, {
|
|
112
|
-
github?: string | undefined;
|
|
113
|
-
discord?: string | undefined;
|
|
114
|
-
twitter?: string | undefined;
|
|
115
|
-
}, {
|
|
116
|
-
github?: string | undefined;
|
|
117
|
-
discord?: string | undefined;
|
|
118
|
-
twitter?: string | undefined;
|
|
119
|
-
}>>;
|
|
120
|
-
search: z.ZodOptional<z.ZodObject<{
|
|
121
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
-
}, "strip", z.ZodTypeAny, {
|
|
123
|
-
enabled?: boolean | undefined;
|
|
124
|
-
}, {
|
|
125
|
-
enabled?: boolean | undefined;
|
|
126
|
-
}>>;
|
|
127
|
-
lineNumbers: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
-
editLink: z.ZodOptional<z.ZodObject<{
|
|
129
|
-
baseUrl: z.ZodString;
|
|
130
|
-
}, "strip", z.ZodTypeAny, {
|
|
131
|
-
baseUrl: string;
|
|
132
|
-
}, {
|
|
133
|
-
baseUrl: string;
|
|
134
|
-
}>>;
|
|
135
|
-
lastUpdated: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
-
announcement: z.ZodOptional<z.ZodObject<{
|
|
137
|
-
text: z.ZodString;
|
|
138
|
-
link: z.ZodOptional<z.ZodString>;
|
|
139
|
-
dismissible: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
-
}, "strip", z.ZodTypeAny, {
|
|
141
|
-
text: string;
|
|
142
|
-
link?: string | undefined;
|
|
143
|
-
dismissible?: boolean | undefined;
|
|
144
|
-
}, {
|
|
145
|
-
text: string;
|
|
146
|
-
link?: string | undefined;
|
|
147
|
-
dismissible?: boolean | undefined;
|
|
148
|
-
}>>;
|
|
149
|
-
feedback: z.ZodOptional<z.ZodObject<{
|
|
150
|
-
enabled: z.ZodBoolean;
|
|
151
|
-
endpoint: z.ZodOptional<z.ZodString>;
|
|
152
|
-
}, "strip", z.ZodTypeAny, {
|
|
153
|
-
enabled: boolean;
|
|
154
|
-
endpoint?: string | undefined;
|
|
155
|
-
}, {
|
|
156
|
-
enabled: boolean;
|
|
157
|
-
endpoint?: string | undefined;
|
|
158
|
-
}>>;
|
|
159
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>, "many">>;
|
|
160
|
-
customCss: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
161
|
-
}, "strip", z.ZodTypeAny, {
|
|
162
|
-
name: string;
|
|
163
|
-
navigation: z.objectOutputType<{
|
|
164
|
-
group: z.ZodString;
|
|
165
|
-
pages: z.ZodArray<z.ZodString, "many">;
|
|
166
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
167
|
-
logo?: string | undefined;
|
|
168
|
-
favicon?: string | undefined;
|
|
169
|
-
site?: string | undefined;
|
|
170
|
-
base?: string | undefined;
|
|
171
|
-
theme?: {
|
|
172
|
-
colors?: {
|
|
173
|
-
primary?: string | undefined;
|
|
174
|
-
background?: string | undefined;
|
|
175
|
-
backgroundDark?: string | undefined;
|
|
176
|
-
text?: string | undefined;
|
|
177
|
-
textDark?: string | undefined;
|
|
178
|
-
border?: string | undefined;
|
|
179
|
-
borderDark?: string | undefined;
|
|
180
|
-
} | undefined;
|
|
181
|
-
fonts?: {
|
|
182
|
-
code?: string | undefined;
|
|
183
|
-
heading?: string | undefined;
|
|
184
|
-
body?: string | undefined;
|
|
185
|
-
} | undefined;
|
|
186
|
-
radius?: string | undefined;
|
|
187
|
-
} | undefined;
|
|
188
|
-
i18n?: {
|
|
189
|
-
defaultLocale: string;
|
|
190
|
-
locales: string[];
|
|
191
|
-
labels?: Record<string, string> | undefined;
|
|
192
|
-
} | undefined;
|
|
193
|
-
topbar?: {
|
|
194
|
-
github?: string | undefined;
|
|
195
|
-
discord?: string | undefined;
|
|
196
|
-
twitter?: string | undefined;
|
|
197
|
-
} | undefined;
|
|
198
|
-
search?: {
|
|
199
|
-
enabled?: boolean | undefined;
|
|
200
|
-
} | undefined;
|
|
201
|
-
lineNumbers?: boolean | undefined;
|
|
202
|
-
editLink?: {
|
|
203
|
-
baseUrl: string;
|
|
204
|
-
} | undefined;
|
|
205
|
-
lastUpdated?: boolean | undefined;
|
|
206
|
-
announcement?: {
|
|
207
|
-
text: string;
|
|
208
|
-
link?: string | undefined;
|
|
209
|
-
dismissible?: boolean | undefined;
|
|
210
|
-
} | undefined;
|
|
211
|
-
feedback?: {
|
|
212
|
-
enabled: boolean;
|
|
213
|
-
endpoint?: string | undefined;
|
|
214
|
-
} | undefined;
|
|
215
|
-
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
216
|
-
customCss?: string[] | undefined;
|
|
217
|
-
}, {
|
|
218
|
-
name: string;
|
|
219
|
-
navigation: z.objectInputType<{
|
|
220
|
-
group: z.ZodString;
|
|
221
|
-
pages: z.ZodArray<z.ZodString, "many">;
|
|
222
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
223
|
-
logo?: string | undefined;
|
|
224
|
-
favicon?: string | undefined;
|
|
225
|
-
site?: string | undefined;
|
|
226
|
-
base?: string | undefined;
|
|
227
|
-
theme?: {
|
|
228
|
-
colors?: {
|
|
229
|
-
primary?: string | undefined;
|
|
230
|
-
background?: string | undefined;
|
|
231
|
-
backgroundDark?: string | undefined;
|
|
232
|
-
text?: string | undefined;
|
|
233
|
-
textDark?: string | undefined;
|
|
234
|
-
border?: string | undefined;
|
|
235
|
-
borderDark?: string | undefined;
|
|
236
|
-
} | undefined;
|
|
237
|
-
fonts?: {
|
|
238
|
-
code?: string | undefined;
|
|
239
|
-
heading?: string | undefined;
|
|
240
|
-
body?: string | undefined;
|
|
241
|
-
} | undefined;
|
|
242
|
-
radius?: string | undefined;
|
|
243
|
-
} | undefined;
|
|
244
|
-
i18n?: {
|
|
245
|
-
defaultLocale: string;
|
|
246
|
-
locales: string[];
|
|
247
|
-
labels?: Record<string, string> | undefined;
|
|
248
|
-
} | undefined;
|
|
249
|
-
topbar?: {
|
|
250
|
-
github?: string | undefined;
|
|
251
|
-
discord?: string | undefined;
|
|
252
|
-
twitter?: string | undefined;
|
|
253
|
-
} | undefined;
|
|
254
|
-
search?: {
|
|
255
|
-
enabled?: boolean | undefined;
|
|
256
|
-
} | undefined;
|
|
257
|
-
lineNumbers?: boolean | undefined;
|
|
258
|
-
editLink?: {
|
|
259
|
-
baseUrl: string;
|
|
260
|
-
} | undefined;
|
|
261
|
-
lastUpdated?: boolean | undefined;
|
|
262
|
-
announcement?: {
|
|
263
|
-
text: string;
|
|
264
|
-
link?: string | undefined;
|
|
265
|
-
dismissible?: boolean | undefined;
|
|
266
|
-
} | undefined;
|
|
267
|
-
feedback?: {
|
|
268
|
-
enabled: boolean;
|
|
269
|
-
endpoint?: string | undefined;
|
|
270
|
-
} | undefined;
|
|
271
|
-
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
272
|
-
customCss?: string[] | undefined;
|
|
273
|
-
}>;
|
|
274
|
-
type BarodocConfigInput = z.input<typeof barodocConfigSchema>;
|
|
275
|
-
type BarodocConfigOutput = z.output<typeof barodocConfigSchema>;
|
|
276
|
-
|
|
277
|
-
declare function loadConfig(configPath: string, root: string): Promise<ResolvedBarodocConfig>;
|
|
278
|
-
declare function getConfigDefaults(): Partial<BarodocConfig>;
|
|
279
|
-
|
|
280
|
-
export { type BarodocConfigInput, type BarodocConfigOutput, barodocConfigSchema, getConfigDefaults, loadConfig };
|
package/dist/config/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
barodocConfigSchema,
|
|
3
|
+
docsFrontmatterSchema,
|
|
3
4
|
getConfigDefaults,
|
|
4
5
|
loadConfig
|
|
5
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-PHWSKL62.js";
|
|
6
7
|
export {
|
|
7
8
|
barodocConfigSchema,
|
|
9
|
+
docsFrontmatterSchema,
|
|
8
10
|
getConfigDefaults,
|
|
9
11
|
loadConfig
|
|
10
12
|
};
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-
|
|
1
|
+
import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-BSnQ5EUW.js';
|
|
2
2
|
import 'astro';
|
|
3
3
|
|
|
4
4
|
declare function getLocaleFromPath(path: string, i18n: BarodocI18nConfig): string;
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { R as ResolvedBarodocConfig, a as BarodocConfig } from './types-BSnQ5EUW.js';
|
|
3
|
+
|
|
4
|
+
declare const grayPresets: readonly ["zinc", "slate", "neutral", "stone", "gray"];
|
|
5
|
+
type GrayPreset = (typeof grayPresets)[number];
|
|
6
|
+
/** Frontmatter schema for MDX/MD content files. Reusable across custom and quick mode. */
|
|
7
|
+
declare const docsFrontmatterSchema: z.ZodObject<{
|
|
8
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
related: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
category: z.ZodOptional<z.ZodString>;
|
|
13
|
+
api_reference: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
difficulty: z.ZodOptional<z.ZodEnum<["beginner", "intermediate", "advanced"]>>;
|
|
15
|
+
lastUpdated: z.ZodOptional<z.ZodDate>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
description?: string | undefined;
|
|
19
|
+
tags?: string[] | undefined;
|
|
20
|
+
related?: string[] | undefined;
|
|
21
|
+
category?: string | undefined;
|
|
22
|
+
api_reference?: boolean | undefined;
|
|
23
|
+
difficulty?: "beginner" | "intermediate" | "advanced" | undefined;
|
|
24
|
+
lastUpdated?: Date | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
title?: string | undefined;
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
tags?: string[] | undefined;
|
|
29
|
+
related?: string[] | undefined;
|
|
30
|
+
category?: string | undefined;
|
|
31
|
+
api_reference?: boolean | undefined;
|
|
32
|
+
difficulty?: "beginner" | "intermediate" | "advanced" | undefined;
|
|
33
|
+
lastUpdated?: Date | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
type DocsFrontmatter = z.infer<typeof docsFrontmatterSchema>;
|
|
36
|
+
declare const barodocConfigSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
logo: z.ZodOptional<z.ZodString>;
|
|
39
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
40
|
+
site: z.ZodOptional<z.ZodString>;
|
|
41
|
+
base: z.ZodOptional<z.ZodString>;
|
|
42
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
45
|
+
gray: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["zinc", "slate", "neutral", "stone", "gray"]>, z.ZodString]>>;
|
|
46
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
accent?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
accent?: string | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
accent?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
accent?: string | undefined;
|
|
59
|
+
}>>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
gray?: string | undefined;
|
|
62
|
+
accent?: string | undefined;
|
|
63
|
+
light?: {
|
|
64
|
+
accent?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
dark?: {
|
|
67
|
+
accent?: string | undefined;
|
|
68
|
+
} | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
gray?: string | undefined;
|
|
71
|
+
accent?: string | undefined;
|
|
72
|
+
light?: {
|
|
73
|
+
accent?: string | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
dark?: {
|
|
76
|
+
accent?: string | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
}>>;
|
|
79
|
+
fonts: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
heading: z.ZodOptional<z.ZodString>;
|
|
81
|
+
body: z.ZodOptional<z.ZodString>;
|
|
82
|
+
code: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
code?: string | undefined;
|
|
85
|
+
heading?: string | undefined;
|
|
86
|
+
body?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
code?: string | undefined;
|
|
89
|
+
heading?: string | undefined;
|
|
90
|
+
body?: string | undefined;
|
|
91
|
+
}>>;
|
|
92
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
colors?: {
|
|
95
|
+
gray?: string | undefined;
|
|
96
|
+
accent?: string | undefined;
|
|
97
|
+
light?: {
|
|
98
|
+
accent?: string | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
dark?: {
|
|
101
|
+
accent?: string | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
fonts?: {
|
|
105
|
+
code?: string | undefined;
|
|
106
|
+
heading?: string | undefined;
|
|
107
|
+
body?: string | undefined;
|
|
108
|
+
} | undefined;
|
|
109
|
+
radius?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
colors?: {
|
|
112
|
+
gray?: string | undefined;
|
|
113
|
+
accent?: string | undefined;
|
|
114
|
+
light?: {
|
|
115
|
+
accent?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
dark?: {
|
|
118
|
+
accent?: string | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
fonts?: {
|
|
122
|
+
code?: string | undefined;
|
|
123
|
+
heading?: string | undefined;
|
|
124
|
+
body?: string | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
radius?: string | undefined;
|
|
127
|
+
}>>;
|
|
128
|
+
i18n: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
defaultLocale: z.ZodString;
|
|
130
|
+
locales: z.ZodArray<z.ZodString, "many">;
|
|
131
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
defaultLocale: string;
|
|
134
|
+
locales: string[];
|
|
135
|
+
labels?: Record<string, string> | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
defaultLocale: string;
|
|
138
|
+
locales: string[];
|
|
139
|
+
labels?: Record<string, string> | undefined;
|
|
140
|
+
}>>;
|
|
141
|
+
navigation: z.ZodArray<z.ZodObject<{
|
|
142
|
+
group: z.ZodString;
|
|
143
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
144
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
145
|
+
group: z.ZodString;
|
|
146
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
147
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
148
|
+
group: z.ZodString;
|
|
149
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
150
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
151
|
+
topbar: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
github: z.ZodOptional<z.ZodString>;
|
|
153
|
+
discord: z.ZodOptional<z.ZodString>;
|
|
154
|
+
twitter: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
github?: string | undefined;
|
|
157
|
+
discord?: string | undefined;
|
|
158
|
+
twitter?: string | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
github?: string | undefined;
|
|
161
|
+
discord?: string | undefined;
|
|
162
|
+
twitter?: string | undefined;
|
|
163
|
+
}>>;
|
|
164
|
+
search: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
enabled?: boolean | undefined;
|
|
168
|
+
}, {
|
|
169
|
+
enabled?: boolean | undefined;
|
|
170
|
+
}>>;
|
|
171
|
+
lineNumbers: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
+
editLink: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
baseUrl: z.ZodString;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
baseUrl: string;
|
|
176
|
+
}, {
|
|
177
|
+
baseUrl: string;
|
|
178
|
+
}>>;
|
|
179
|
+
lastUpdated: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
announcement: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
text: z.ZodString;
|
|
182
|
+
link: z.ZodOptional<z.ZodString>;
|
|
183
|
+
dismissible: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
}, "strip", z.ZodTypeAny, {
|
|
185
|
+
text: string;
|
|
186
|
+
link?: string | undefined;
|
|
187
|
+
dismissible?: boolean | undefined;
|
|
188
|
+
}, {
|
|
189
|
+
text: string;
|
|
190
|
+
link?: string | undefined;
|
|
191
|
+
dismissible?: boolean | undefined;
|
|
192
|
+
}>>;
|
|
193
|
+
feedback: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
enabled: z.ZodBoolean;
|
|
195
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
endpoint?: string | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
enabled: boolean;
|
|
201
|
+
endpoint?: string | undefined;
|
|
202
|
+
}>>;
|
|
203
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>, "many">>;
|
|
204
|
+
customCss: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
name: string;
|
|
207
|
+
navigation: z.objectOutputType<{
|
|
208
|
+
group: z.ZodString;
|
|
209
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
210
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
211
|
+
lastUpdated?: boolean | undefined;
|
|
212
|
+
logo?: string | undefined;
|
|
213
|
+
favicon?: string | undefined;
|
|
214
|
+
site?: string | undefined;
|
|
215
|
+
base?: string | undefined;
|
|
216
|
+
theme?: {
|
|
217
|
+
colors?: {
|
|
218
|
+
gray?: string | undefined;
|
|
219
|
+
accent?: string | undefined;
|
|
220
|
+
light?: {
|
|
221
|
+
accent?: string | undefined;
|
|
222
|
+
} | undefined;
|
|
223
|
+
dark?: {
|
|
224
|
+
accent?: string | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
} | undefined;
|
|
227
|
+
fonts?: {
|
|
228
|
+
code?: string | undefined;
|
|
229
|
+
heading?: string | undefined;
|
|
230
|
+
body?: string | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
radius?: string | undefined;
|
|
233
|
+
} | undefined;
|
|
234
|
+
i18n?: {
|
|
235
|
+
defaultLocale: string;
|
|
236
|
+
locales: string[];
|
|
237
|
+
labels?: Record<string, string> | undefined;
|
|
238
|
+
} | undefined;
|
|
239
|
+
topbar?: {
|
|
240
|
+
github?: string | undefined;
|
|
241
|
+
discord?: string | undefined;
|
|
242
|
+
twitter?: string | undefined;
|
|
243
|
+
} | undefined;
|
|
244
|
+
search?: {
|
|
245
|
+
enabled?: boolean | undefined;
|
|
246
|
+
} | undefined;
|
|
247
|
+
lineNumbers?: boolean | undefined;
|
|
248
|
+
editLink?: {
|
|
249
|
+
baseUrl: string;
|
|
250
|
+
} | undefined;
|
|
251
|
+
announcement?: {
|
|
252
|
+
text: string;
|
|
253
|
+
link?: string | undefined;
|
|
254
|
+
dismissible?: boolean | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
feedback?: {
|
|
257
|
+
enabled: boolean;
|
|
258
|
+
endpoint?: string | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
261
|
+
customCss?: string[] | undefined;
|
|
262
|
+
}, {
|
|
263
|
+
name: string;
|
|
264
|
+
navigation: z.objectInputType<{
|
|
265
|
+
group: z.ZodString;
|
|
266
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
267
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
268
|
+
lastUpdated?: boolean | undefined;
|
|
269
|
+
logo?: string | undefined;
|
|
270
|
+
favicon?: string | undefined;
|
|
271
|
+
site?: string | undefined;
|
|
272
|
+
base?: string | undefined;
|
|
273
|
+
theme?: {
|
|
274
|
+
colors?: {
|
|
275
|
+
gray?: string | undefined;
|
|
276
|
+
accent?: string | undefined;
|
|
277
|
+
light?: {
|
|
278
|
+
accent?: string | undefined;
|
|
279
|
+
} | undefined;
|
|
280
|
+
dark?: {
|
|
281
|
+
accent?: string | undefined;
|
|
282
|
+
} | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
fonts?: {
|
|
285
|
+
code?: string | undefined;
|
|
286
|
+
heading?: string | undefined;
|
|
287
|
+
body?: string | undefined;
|
|
288
|
+
} | undefined;
|
|
289
|
+
radius?: string | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
i18n?: {
|
|
292
|
+
defaultLocale: string;
|
|
293
|
+
locales: string[];
|
|
294
|
+
labels?: Record<string, string> | undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
topbar?: {
|
|
297
|
+
github?: string | undefined;
|
|
298
|
+
discord?: string | undefined;
|
|
299
|
+
twitter?: string | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
search?: {
|
|
302
|
+
enabled?: boolean | undefined;
|
|
303
|
+
} | undefined;
|
|
304
|
+
lineNumbers?: boolean | undefined;
|
|
305
|
+
editLink?: {
|
|
306
|
+
baseUrl: string;
|
|
307
|
+
} | undefined;
|
|
308
|
+
announcement?: {
|
|
309
|
+
text: string;
|
|
310
|
+
link?: string | undefined;
|
|
311
|
+
dismissible?: boolean | undefined;
|
|
312
|
+
} | undefined;
|
|
313
|
+
feedback?: {
|
|
314
|
+
enabled: boolean;
|
|
315
|
+
endpoint?: string | undefined;
|
|
316
|
+
} | undefined;
|
|
317
|
+
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
318
|
+
customCss?: string[] | undefined;
|
|
319
|
+
}>;
|
|
320
|
+
type BarodocConfigInput = z.input<typeof barodocConfigSchema>;
|
|
321
|
+
type BarodocConfigOutput = z.output<typeof barodocConfigSchema>;
|
|
322
|
+
|
|
323
|
+
declare function loadConfig(configPath: string, root: string): Promise<ResolvedBarodocConfig>;
|
|
324
|
+
declare function getConfigDefaults(): Partial<BarodocConfig>;
|
|
325
|
+
|
|
326
|
+
export { type BarodocConfigInput as B, type DocsFrontmatter as D, type GrayPreset as G, type BarodocConfigOutput as a, barodocConfigSchema as b, getConfigDefaults as c, docsFrontmatterSchema as d, grayPresets as g, loadConfig as l };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import { AstroIntegration } from 'astro';
|
|
2
|
-
import { B as BarodocOptions } from './types-
|
|
3
|
-
export { a as BarodocConfig, b as BarodocI18nConfig, c as BarodocNavItem, d as BarodocPlugin, e as BarodocPluginFactory, f as BarodocPluginHooks, g as BarodocThemeColors, h as BarodocThemeConfig, i as BuildContext, C as ContentContext, P as PluginConfig, j as PluginContext, R as ResolvedBarodocConfig, k as ResolvedPlugin, T as ThemeExport } from './types-
|
|
4
|
-
export { barodocConfigSchema, loadConfig } from './
|
|
2
|
+
import { B as BarodocOptions } from './types-BSnQ5EUW.js';
|
|
3
|
+
export { a as BarodocConfig, b as BarodocI18nConfig, c as BarodocNavItem, d as BarodocPlugin, e as BarodocPluginFactory, f as BarodocPluginHooks, g as BarodocThemeColors, h as BarodocThemeConfig, i as BuildContext, C as ContentContext, P as PluginConfig, j as PluginContext, R as ResolvedBarodocConfig, k as ResolvedPlugin, T as ThemeExport } from './types-BSnQ5EUW.js';
|
|
4
|
+
export { D as DocsFrontmatter, G as GrayPreset, b as barodocConfigSchema, d as docsFrontmatterSchema, g as grayPresets, l as loadConfig } from './index-gZocHQXv.js';
|
|
5
5
|
export { getLocaleFromPath, getLocaleLabel, getLocalizedNavGroup, getLocalizedPath, removeLocaleFromPath } from './i18n/index.js';
|
|
6
6
|
export { definePlugin, getPluginIntegrations, loadPlugins, runConfigHook, runHook } from './plugins/index.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
9
|
declare function barodoc(options: BarodocOptions): AstroIntegration;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
declare function generateAccentScale(hex: string): Record<string, string>;
|
|
12
|
+
declare function getGrayScale(preset: string): Record<string, string> | null;
|
|
13
|
+
/**
|
|
14
|
+
* Generate CSS overrides from theme.colors config.
|
|
15
|
+
* Outputs gray scale variables (--bd-gray-*) and/or accent overrides (--color-primary-*).
|
|
16
|
+
* Semantic tokens don't need to change — they already reference --bd-gray-* via var().
|
|
17
|
+
*/
|
|
18
|
+
declare function generateThemeCSS(themeColors: {
|
|
19
|
+
accent?: string;
|
|
20
|
+
gray?: string;
|
|
21
|
+
light?: {
|
|
22
|
+
accent?: string;
|
|
23
|
+
};
|
|
24
|
+
dark?: {
|
|
25
|
+
accent?: string;
|
|
26
|
+
};
|
|
27
|
+
}): string;
|
|
28
|
+
|
|
29
|
+
export { BarodocOptions, barodoc as default, generateAccentScale, generateThemeCSS, getGrayScale };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
barodocConfigSchema,
|
|
3
|
+
docsFrontmatterSchema,
|
|
4
|
+
grayPresets,
|
|
3
5
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PHWSKL62.js";
|
|
5
7
|
import {
|
|
6
8
|
getLocaleFromPath,
|
|
7
9
|
getLocaleLabel,
|
|
@@ -18,6 +20,8 @@ import {
|
|
|
18
20
|
} from "./chunk-UICDSNBG.js";
|
|
19
21
|
|
|
20
22
|
// src/integration.ts
|
|
23
|
+
import { existsSync } from "fs";
|
|
24
|
+
import { join } from "path";
|
|
21
25
|
var VIRTUAL_CONFIG_ID = "virtual:barodoc/config";
|
|
22
26
|
var VIRTUAL_I18N_ID = "virtual:barodoc/i18n";
|
|
23
27
|
function resolveVirtualId(id) {
|
|
@@ -86,9 +90,20 @@ function barodoc(options) {
|
|
|
86
90
|
};
|
|
87
91
|
const themeIntegration = options.theme.integration(resolvedConfig);
|
|
88
92
|
const pluginIntegrations = getPluginIntegrations(plugins, pluginContext);
|
|
93
|
+
const overridesDir = join(rootPath, "overrides");
|
|
94
|
+
const overridesAlias = {};
|
|
95
|
+
if (existsSync(join(overridesDir, "components"))) {
|
|
96
|
+
overridesAlias["@overrides/components"] = join(overridesDir, "components");
|
|
97
|
+
logger.info("Overrides: components/ detected");
|
|
98
|
+
}
|
|
99
|
+
if (existsSync(join(overridesDir, "layouts"))) {
|
|
100
|
+
overridesAlias["@overrides/layouts"] = join(overridesDir, "layouts");
|
|
101
|
+
logger.info("Overrides: layouts/ detected");
|
|
102
|
+
}
|
|
89
103
|
updateConfig({
|
|
90
104
|
vite: {
|
|
91
|
-
plugins: [createVirtualModulesPlugin(resolvedConfig)]
|
|
105
|
+
plugins: [createVirtualModulesPlugin(resolvedConfig)],
|
|
106
|
+
resolve: Object.keys(overridesAlias).length > 0 ? { alias: overridesAlias } : void 0
|
|
92
107
|
},
|
|
93
108
|
integrations: [themeIntegration, ...pluginIntegrations]
|
|
94
109
|
});
|
|
@@ -102,15 +117,181 @@ function barodoc(options) {
|
|
|
102
117
|
}
|
|
103
118
|
};
|
|
104
119
|
}
|
|
120
|
+
|
|
121
|
+
// src/theme/colors.ts
|
|
122
|
+
var GRAY_PRESETS = {
|
|
123
|
+
zinc: {
|
|
124
|
+
"50": "#fafafa",
|
|
125
|
+
"100": "#f4f4f5",
|
|
126
|
+
"200": "#e4e4e7",
|
|
127
|
+
"300": "#d4d4d8",
|
|
128
|
+
"400": "#a1a1aa",
|
|
129
|
+
"500": "#71717a",
|
|
130
|
+
"600": "#52525b",
|
|
131
|
+
"700": "#3f3f46",
|
|
132
|
+
"800": "#27272a",
|
|
133
|
+
"900": "#18181b",
|
|
134
|
+
"950": "#09090b"
|
|
135
|
+
},
|
|
136
|
+
slate: {
|
|
137
|
+
"50": "#f8fafc",
|
|
138
|
+
"100": "#f1f5f9",
|
|
139
|
+
"200": "#e2e8f0",
|
|
140
|
+
"300": "#cbd5e1",
|
|
141
|
+
"400": "#94a3b8",
|
|
142
|
+
"500": "#64748b",
|
|
143
|
+
"600": "#475569",
|
|
144
|
+
"700": "#334155",
|
|
145
|
+
"800": "#1e293b",
|
|
146
|
+
"900": "#0f172a",
|
|
147
|
+
"950": "#020617"
|
|
148
|
+
},
|
|
149
|
+
neutral: {
|
|
150
|
+
"50": "#fafafa",
|
|
151
|
+
"100": "#f5f5f5",
|
|
152
|
+
"200": "#e5e5e5",
|
|
153
|
+
"300": "#d4d4d4",
|
|
154
|
+
"400": "#a3a3a3",
|
|
155
|
+
"500": "#737373",
|
|
156
|
+
"600": "#525252",
|
|
157
|
+
"700": "#404040",
|
|
158
|
+
"800": "#262626",
|
|
159
|
+
"900": "#171717",
|
|
160
|
+
"950": "#0a0a0a"
|
|
161
|
+
},
|
|
162
|
+
stone: {
|
|
163
|
+
"50": "#fafaf9",
|
|
164
|
+
"100": "#f5f5f4",
|
|
165
|
+
"200": "#e7e5e4",
|
|
166
|
+
"300": "#d6d3d1",
|
|
167
|
+
"400": "#a8a29e",
|
|
168
|
+
"500": "#78716c",
|
|
169
|
+
"600": "#57534e",
|
|
170
|
+
"700": "#44403c",
|
|
171
|
+
"800": "#292524",
|
|
172
|
+
"900": "#1c1917",
|
|
173
|
+
"950": "#0c0a09"
|
|
174
|
+
},
|
|
175
|
+
gray: {
|
|
176
|
+
"50": "#f9fafb",
|
|
177
|
+
"100": "#f3f4f6",
|
|
178
|
+
"200": "#e5e7eb",
|
|
179
|
+
"300": "#d1d5db",
|
|
180
|
+
"400": "#9ca3af",
|
|
181
|
+
"500": "#6b7280",
|
|
182
|
+
"600": "#4b5563",
|
|
183
|
+
"700": "#374151",
|
|
184
|
+
"800": "#1f2937",
|
|
185
|
+
"900": "#111827",
|
|
186
|
+
"950": "#030712"
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var SCALE_STEPS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
190
|
+
function hexToLinear(c) {
|
|
191
|
+
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
192
|
+
}
|
|
193
|
+
function hexToOklchHue(hex) {
|
|
194
|
+
const h = hex.replace("#", "");
|
|
195
|
+
const [r, g, b] = [
|
|
196
|
+
parseInt(h.slice(0, 2), 16) / 255,
|
|
197
|
+
parseInt(h.slice(2, 4), 16) / 255,
|
|
198
|
+
parseInt(h.slice(4, 6), 16) / 255
|
|
199
|
+
].map(hexToLinear);
|
|
200
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
201
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
202
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
203
|
+
const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
|
|
204
|
+
const bVal = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
|
|
205
|
+
let hue = Math.atan2(bVal, a) * 180 / Math.PI;
|
|
206
|
+
if (hue < 0) hue += 360;
|
|
207
|
+
return Math.round(hue * 10) / 10;
|
|
208
|
+
}
|
|
209
|
+
var ACCENT_L = {
|
|
210
|
+
"50": 0.97,
|
|
211
|
+
"100": 0.94,
|
|
212
|
+
"200": 0.88,
|
|
213
|
+
"300": 0.78,
|
|
214
|
+
"400": 0.68,
|
|
215
|
+
"500": 0.58,
|
|
216
|
+
"600": 0.5,
|
|
217
|
+
"700": 0.42,
|
|
218
|
+
"800": 0.35,
|
|
219
|
+
"900": 0.28,
|
|
220
|
+
"950": 0.2
|
|
221
|
+
};
|
|
222
|
+
var ACCENT_C = {
|
|
223
|
+
"50": 0.02,
|
|
224
|
+
"100": 0.04,
|
|
225
|
+
"200": 0.08,
|
|
226
|
+
"300": 0.12,
|
|
227
|
+
"400": 0.16,
|
|
228
|
+
"500": 0.18,
|
|
229
|
+
"600": 0.18,
|
|
230
|
+
"700": 0.16,
|
|
231
|
+
"800": 0.12,
|
|
232
|
+
"900": 0.08,
|
|
233
|
+
"950": 0.04
|
|
234
|
+
};
|
|
235
|
+
function generateAccentScale(hex) {
|
|
236
|
+
const h = hexToOklchHue(hex);
|
|
237
|
+
const scale = {};
|
|
238
|
+
for (const step of SCALE_STEPS) {
|
|
239
|
+
scale[step] = `oklch(${ACCENT_L[step]} ${ACCENT_C[step]} ${h})`;
|
|
240
|
+
}
|
|
241
|
+
return scale;
|
|
242
|
+
}
|
|
243
|
+
function getGrayScale(preset) {
|
|
244
|
+
return GRAY_PRESETS[preset] ?? null;
|
|
245
|
+
}
|
|
246
|
+
function generateThemeCSS(themeColors) {
|
|
247
|
+
const rootLines = [];
|
|
248
|
+
const darkLines = [];
|
|
249
|
+
if (themeColors.gray) {
|
|
250
|
+
const grayScale = getGrayScale(themeColors.gray);
|
|
251
|
+
if (grayScale) {
|
|
252
|
+
for (const step of SCALE_STEPS) {
|
|
253
|
+
rootLines.push(` --bd-gray-${step}: ${grayScale[step]};`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (themeColors.accent) {
|
|
258
|
+
const scale = generateAccentScale(themeColors.accent);
|
|
259
|
+
for (const step of SCALE_STEPS) {
|
|
260
|
+
rootLines.push(` --color-primary-${step}: ${scale[step]};`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (themeColors.dark?.accent) {
|
|
264
|
+
const darkScale = generateAccentScale(themeColors.dark.accent);
|
|
265
|
+
for (const step of SCALE_STEPS) {
|
|
266
|
+
darkLines.push(` --color-primary-${step}: ${darkScale[step]};`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (rootLines.length === 0 && darkLines.length === 0) return "";
|
|
270
|
+
let css = "";
|
|
271
|
+
if (rootLines.length > 0) css += `:root {
|
|
272
|
+
${rootLines.join("\n")}
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
275
|
+
if (darkLines.length > 0) css += `.dark {
|
|
276
|
+
${darkLines.join("\n")}
|
|
277
|
+
}
|
|
278
|
+
`;
|
|
279
|
+
return css;
|
|
280
|
+
}
|
|
105
281
|
export {
|
|
106
282
|
barodocConfigSchema,
|
|
107
283
|
barodoc as default,
|
|
108
284
|
definePlugin,
|
|
285
|
+
docsFrontmatterSchema,
|
|
286
|
+
generateAccentScale,
|
|
287
|
+
generateThemeCSS,
|
|
288
|
+
getGrayScale,
|
|
109
289
|
getLocaleFromPath,
|
|
110
290
|
getLocaleLabel,
|
|
111
291
|
getLocalizedNavGroup,
|
|
112
292
|
getLocalizedPath,
|
|
113
293
|
getPluginIntegrations,
|
|
294
|
+
grayPresets,
|
|
114
295
|
loadConfig,
|
|
115
296
|
loadPlugins,
|
|
116
297
|
removeLocaleFromPath,
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as ResolvedPlugin, j as PluginContext, P as PluginConfig, R as ResolvedBarodocConfig, f as BarodocPluginHooks, d as BarodocPlugin } from '../types-
|
|
2
|
-
export { e as BarodocPluginFactory, i as BuildContext, C as ContentContext } from '../types-
|
|
1
|
+
import { k as ResolvedPlugin, j as PluginContext, P as PluginConfig, R as ResolvedBarodocConfig, f as BarodocPluginHooks, d as BarodocPlugin } from '../types-BSnQ5EUW.js';
|
|
2
|
+
export { e as BarodocPluginFactory, i as BuildContext, C as ContentContext } from '../types-BSnQ5EUW.js';
|
|
3
3
|
import * as astro from 'astro';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -96,13 +96,14 @@ interface BarodocI18nConfig {
|
|
|
96
96
|
labels?: Record<string, string>;
|
|
97
97
|
}
|
|
98
98
|
interface BarodocThemeColors {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
accent?: string;
|
|
100
|
+
gray?: string;
|
|
101
|
+
light?: {
|
|
102
|
+
accent?: string;
|
|
103
|
+
};
|
|
104
|
+
dark?: {
|
|
105
|
+
accent?: string;
|
|
106
|
+
};
|
|
106
107
|
}
|
|
107
108
|
interface BarodocThemeConfig {
|
|
108
109
|
colors?: BarodocThemeColors;
|