@getvitops/generator 0.8.0 → 1.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/CHANGELOG.md +459 -0
- package/README.md +16 -4
- package/assets/bricks/load.php +46 -1
- package/assets/css/animation.css +12 -2
- package/assets/css/patterns/carousel.css +3 -3
- package/assets/css/patterns/code.css +2 -2
- package/assets/css/patterns/combobox.css +3 -3
- package/assets/css/patterns/comment.css +1 -1
- package/assets/css/patterns/copy.css +3 -3
- package/assets/css/patterns/details.css +27 -8
- package/assets/css/patterns/dialog.css +2 -2
- package/assets/css/patterns/drawer.css +17 -2
- package/assets/css/patterns/forms.css +11 -11
- package/assets/css/patterns/grouped.css +1 -1
- package/assets/css/patterns/icon.css +2 -2
- package/assets/css/patterns/list.css +5 -5
- package/assets/css/patterns/media.css +1 -1
- package/assets/css/patterns/nav.css +5 -5
- package/assets/css/patterns/notification.css +3 -3
- package/assets/css/patterns/scroll-based.css +1 -1
- package/assets/css/patterns/scroll-target.css +3 -3
- package/assets/css/patterns/sitenav.css +14 -14
- package/assets/css/patterns/split-link.css +4 -4
- package/assets/css/patterns/subgrid.css +62 -16
- package/assets/css/patterns/tag.css +1 -1
- package/assets/css/patterns/text-effects.css +1 -1
- package/assets/css/patterns/theme-editor.css +14 -6
- package/assets/css/patterns/tooltip.css +2 -2
- package/assets/css/patterns/tree.css +3 -3
- package/assets/css/utilities.css +5 -3
- package/assets/js/editor.js +2 -2
- package/dist/index.d.mts +565 -50
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3337 -1301
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/schema.json +51 -9
- package/site.schema.json +149 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
|
+
import { ContentNode } from "@getvitops/utils";
|
|
2
3
|
|
|
3
4
|
//#region src/schema.d.ts
|
|
4
5
|
declare const DesignSystemSchema: z.ZodMiniObject<{
|
|
5
6
|
$schema: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
7
|
+
meta: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
8
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
9
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
|
+
}, z.z.core.$strip>>;
|
|
6
11
|
colors: z.ZodMiniObject<{
|
|
7
12
|
palette: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
8
13
|
seed: z.ZodMiniString<string>;
|
|
@@ -10,11 +15,18 @@ declare const DesignSystemSchema: z.ZodMiniObject<{
|
|
|
10
15
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
11
16
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
12
17
|
}, z.z.core.$strip>]>>;
|
|
13
|
-
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string
|
|
18
|
+
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
19
|
+
hue: z.ZodMiniString<string>;
|
|
20
|
+
kind: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
21
|
+
surface: "surface";
|
|
22
|
+
chromatic: "chromatic";
|
|
23
|
+
}>>;
|
|
24
|
+
}, z.z.core.$strip>]>>;
|
|
14
25
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
15
26
|
fill: "fill";
|
|
16
27
|
bg: "bg";
|
|
17
28
|
text: "text";
|
|
29
|
+
icon: "icon";
|
|
18
30
|
border: "border";
|
|
19
31
|
outline: "outline";
|
|
20
32
|
stroke: "stroke";
|
|
@@ -93,6 +105,10 @@ declare const SCHEMA_URL = "https://unpkg.com/@getvitops/generator/schema.json";
|
|
|
93
105
|
declare const jsonSchema: {
|
|
94
106
|
"~standard": z.z.core.ZodStandardSchemaWithJSON<z.ZodMiniObject<{
|
|
95
107
|
$schema: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
108
|
+
meta: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
109
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
110
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
111
|
+
}, z.z.core.$strip>>;
|
|
96
112
|
colors: z.ZodMiniObject<{
|
|
97
113
|
palette: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
98
114
|
seed: z.ZodMiniString<string>;
|
|
@@ -100,11 +116,18 @@ declare const jsonSchema: {
|
|
|
100
116
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
101
117
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
102
118
|
}, z.z.core.$strip>]>>;
|
|
103
|
-
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string
|
|
119
|
+
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
120
|
+
hue: z.ZodMiniString<string>;
|
|
121
|
+
kind: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
122
|
+
surface: "surface";
|
|
123
|
+
chromatic: "chromatic";
|
|
124
|
+
}>>;
|
|
125
|
+
}, z.z.core.$strip>]>>;
|
|
104
126
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
105
127
|
fill: "fill";
|
|
106
128
|
bg: "bg";
|
|
107
129
|
text: "text";
|
|
130
|
+
icon: "icon";
|
|
108
131
|
border: "border";
|
|
109
132
|
outline: "outline";
|
|
110
133
|
stroke: "stroke";
|
|
@@ -254,53 +277,37 @@ type ValidationResult = {
|
|
|
254
277
|
*/
|
|
255
278
|
declare function validate(input: unknown): ValidationResult;
|
|
256
279
|
//#endregion
|
|
257
|
-
//#region src/
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
* the caller writes it wherever the bundle should live (e.g. `<outDir>/docs`).
|
|
280
|
-
*/
|
|
281
|
-
declare function generateDocs(ds: DesignSystem, assetsDir: string): Record<string, string>;
|
|
282
|
-
//#endregion
|
|
283
|
-
//#region src/shared.d.ts
|
|
284
|
-
/**
|
|
285
|
-
* Data shared between the generator (`generate.ts`) and the docs bundle
|
|
286
|
-
* (`docs.ts`). Lives in its own module because `generate.ts` imports `docs.ts` —
|
|
287
|
-
* importing back the other way would be a cycle.
|
|
288
|
-
*/
|
|
289
|
-
/**
|
|
290
|
-
* Pattern base geometry props → per-pattern override-hook shorthand. Each hook
|
|
291
|
-
* wraps the authored value (`padding: var(--p-btn, 0.4em 0.8em)`) so a
|
|
292
|
-
* consumer restyles one pattern by setting one variable. The hook is named after
|
|
293
|
-
* the pattern's key, not its class.
|
|
294
|
-
*/
|
|
295
|
-
declare const BASE_HOOK: Record<string, string>;
|
|
280
|
+
//#region src/site.d.ts
|
|
281
|
+
declare const PostalAddressSchema: z.ZodMiniObject<{
|
|
282
|
+
streetAddress: z.ZodMiniString<string>;
|
|
283
|
+
addressLocality: z.ZodMiniString<string>;
|
|
284
|
+
addressRegion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
285
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
286
|
+
addressCountry: z.ZodMiniString<string>;
|
|
287
|
+
}, z.z.core.$strip>;
|
|
288
|
+
declare const ContactObjectSchema: z.ZodMiniObject<{
|
|
289
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
290
|
+
email: z.ZodMiniOptional<z.ZodMiniEmail>;
|
|
291
|
+
phone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
292
|
+
address: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
293
|
+
streetAddress: z.ZodMiniString<string>;
|
|
294
|
+
addressLocality: z.ZodMiniString<string>;
|
|
295
|
+
addressRegion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
296
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
297
|
+
addressCountry: z.ZodMiniString<string>;
|
|
298
|
+
}, z.z.core.$strip>>;
|
|
299
|
+
}, z.z.core.$strip>;
|
|
300
|
+
type PostalAddress = z.infer<typeof PostalAddressSchema>;
|
|
301
|
+
type ContactObject = z.infer<typeof ContactObjectSchema>;
|
|
296
302
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
303
|
+
* Which template set the generated legal documents are written against. This is
|
|
304
|
+
* a closed enum rather than a free string because an unrecognised value would
|
|
305
|
+
* otherwise silently fall back to the wrong body of law; `validateSite` rejects
|
|
306
|
+
* anything without a registered template. Add a member here and a matching entry
|
|
307
|
+
* in `legal/templates/index.ts` — the two are checked against each other.
|
|
300
308
|
*/
|
|
301
|
-
declare const
|
|
302
|
-
|
|
303
|
-
//#region src/site.d.ts
|
|
309
|
+
declare const JURISDICTIONS: readonly ["ca"];
|
|
310
|
+
type Jurisdiction = (typeof JURISDICTIONS)[number];
|
|
304
311
|
declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
305
312
|
defaultLocale: z.ZodMiniString<string>;
|
|
306
313
|
locales: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
@@ -470,6 +477,10 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
470
477
|
}, z.z.core.$strip>>;
|
|
471
478
|
designSystem: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
472
479
|
$schema: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniString<string>>>;
|
|
480
|
+
meta: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
481
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
482
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
483
|
+
}, z.z.core.$strip>>>;
|
|
473
484
|
shadows: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
474
485
|
fonts: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
475
486
|
typeScale: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
@@ -538,11 +549,18 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
538
549
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
539
550
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
540
551
|
}, z.z.core.$strip>]>>>;
|
|
541
|
-
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string
|
|
552
|
+
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
553
|
+
hue: z.ZodMiniString<string>;
|
|
554
|
+
kind: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
555
|
+
surface: "surface";
|
|
556
|
+
chromatic: "chromatic";
|
|
557
|
+
}>>;
|
|
558
|
+
}, z.z.core.$strip>]>>>;
|
|
542
559
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
543
560
|
fill: "fill";
|
|
544
561
|
bg: "bg";
|
|
545
562
|
text: "text";
|
|
563
|
+
icon: "icon";
|
|
546
564
|
border: "border";
|
|
547
565
|
outline: "outline";
|
|
548
566
|
stroke: "stroke";
|
|
@@ -741,15 +759,38 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
741
759
|
}, z.z.core.$strip>>;
|
|
742
760
|
}, z.z.core.$strip>>;
|
|
743
761
|
legal: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
762
|
+
jurisdiction: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
763
|
+
ca: "ca";
|
|
764
|
+
}>>;
|
|
744
765
|
privacyPolicy: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
745
766
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
746
767
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
747
768
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
769
|
+
privacyOfficer: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
770
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
771
|
+
email: z.ZodMiniOptional<z.ZodMiniEmail>;
|
|
772
|
+
phone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
773
|
+
address: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
774
|
+
streetAddress: z.ZodMiniString<string>;
|
|
775
|
+
addressLocality: z.ZodMiniString<string>;
|
|
776
|
+
addressRegion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
777
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
778
|
+
addressCountry: z.ZodMiniString<string>;
|
|
779
|
+
}, z.z.core.$strip>>;
|
|
780
|
+
}, z.z.core.$strip>]>>;
|
|
781
|
+
retention: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
782
|
+
processors: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
783
|
+
name: z.ZodMiniString<string>;
|
|
784
|
+
purpose: z.ZodMiniString<string>;
|
|
785
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
786
|
+
privacyUrl: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
787
|
+
}, z.z.core.$strip>>>;
|
|
748
788
|
}, z.z.core.$strip>>;
|
|
749
789
|
termsOfService: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
750
790
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
751
791
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
752
792
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
793
|
+
governingLaw: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
753
794
|
}, z.z.core.$strip>>;
|
|
754
795
|
cookieConsent: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
755
796
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
@@ -966,6 +1007,10 @@ declare const siteJsonSchema: {
|
|
|
966
1007
|
}, z.z.core.$strip>>;
|
|
967
1008
|
designSystem: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
968
1009
|
$schema: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniString<string>>>;
|
|
1010
|
+
meta: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1011
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1012
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1013
|
+
}, z.z.core.$strip>>>;
|
|
969
1014
|
shadows: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
970
1015
|
fonts: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
971
1016
|
typeScale: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
@@ -1034,11 +1079,18 @@ declare const siteJsonSchema: {
|
|
|
1034
1079
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
1035
1080
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
1036
1081
|
}, z.z.core.$strip>]>>>;
|
|
1037
|
-
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string
|
|
1082
|
+
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
1083
|
+
hue: z.ZodMiniString<string>;
|
|
1084
|
+
kind: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
1085
|
+
surface: "surface";
|
|
1086
|
+
chromatic: "chromatic";
|
|
1087
|
+
}>>;
|
|
1088
|
+
}, z.z.core.$strip>]>>>;
|
|
1038
1089
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
1039
1090
|
fill: "fill";
|
|
1040
1091
|
bg: "bg";
|
|
1041
1092
|
text: "text";
|
|
1093
|
+
icon: "icon";
|
|
1042
1094
|
border: "border";
|
|
1043
1095
|
outline: "outline";
|
|
1044
1096
|
stroke: "stroke";
|
|
@@ -1237,15 +1289,38 @@ declare const siteJsonSchema: {
|
|
|
1237
1289
|
}, z.z.core.$strip>>;
|
|
1238
1290
|
}, z.z.core.$strip>>;
|
|
1239
1291
|
legal: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1292
|
+
jurisdiction: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
1293
|
+
ca: "ca";
|
|
1294
|
+
}>>;
|
|
1240
1295
|
privacyPolicy: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1241
1296
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
1242
1297
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
1243
1298
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1299
|
+
privacyOfficer: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
1300
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1301
|
+
email: z.ZodMiniOptional<z.ZodMiniEmail>;
|
|
1302
|
+
phone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1303
|
+
address: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1304
|
+
streetAddress: z.ZodMiniString<string>;
|
|
1305
|
+
addressLocality: z.ZodMiniString<string>;
|
|
1306
|
+
addressRegion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1307
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1308
|
+
addressCountry: z.ZodMiniString<string>;
|
|
1309
|
+
}, z.z.core.$strip>>;
|
|
1310
|
+
}, z.z.core.$strip>]>>;
|
|
1311
|
+
retention: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1312
|
+
processors: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
1313
|
+
name: z.ZodMiniString<string>;
|
|
1314
|
+
purpose: z.ZodMiniString<string>;
|
|
1315
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1316
|
+
privacyUrl: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
1317
|
+
}, z.z.core.$strip>>>;
|
|
1244
1318
|
}, z.z.core.$strip>>;
|
|
1245
1319
|
termsOfService: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1246
1320
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
1247
1321
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
1248
1322
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
1323
|
+
governingLaw: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1249
1324
|
}, z.z.core.$strip>>;
|
|
1250
1325
|
cookieConsent: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1251
1326
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
@@ -1366,6 +1441,15 @@ type SiteValidationResult = {
|
|
|
1366
1441
|
* These live only here — the published JSON Schema enforces shape, not integrity.
|
|
1367
1442
|
*/
|
|
1368
1443
|
declare function validateSite(input: unknown): SiteValidationResult;
|
|
1444
|
+
/**
|
|
1445
|
+
* Resolve who privacy requests go to: the explicit privacy officer, else the
|
|
1446
|
+
* site contact, else the primary location, else the organization itself.
|
|
1447
|
+
*
|
|
1448
|
+
* Exported because `validateSite` and the legal-document derivation must agree
|
|
1449
|
+
* on it exactly — a config that validates must be one the policy can render, and
|
|
1450
|
+
* two copies of this precedence would drift into a policy with a blank address.
|
|
1451
|
+
*/
|
|
1452
|
+
declare function resolvePrivacyContact(cfg: SiteConfig): ContactObject | undefined;
|
|
1369
1453
|
type DesignSystemEntryT = Partial<DesignSystem> & {
|
|
1370
1454
|
displayName?: unknown;
|
|
1371
1455
|
extends?: string;
|
|
@@ -1391,6 +1475,437 @@ declare function stripNulls(obj: unknown): unknown;
|
|
|
1391
1475
|
/** Deep-merge `source` into `target` (in place). Arrays replace wholesale. */
|
|
1392
1476
|
declare function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): void;
|
|
1393
1477
|
//#endregion
|
|
1478
|
+
//#region src/tokens.d.ts
|
|
1479
|
+
declare const NUMERIC_STEPS: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
1480
|
+
type NumStep = (typeof NUMERIC_STEPS)[number];
|
|
1481
|
+
interface ExpandedHue {
|
|
1482
|
+
/** Numeric steps (sparse for fixed-tone kits). */
|
|
1483
|
+
numeric: Partial<Record<NumStep, string>>;
|
|
1484
|
+
/** True when only authored tones + endpoints exist (no interpolation). */
|
|
1485
|
+
sparse?: boolean;
|
|
1486
|
+
/**
|
|
1487
|
+
* Steps the author pinned, and how far each sits from the ladder's lightness.
|
|
1488
|
+
* A pinned colour is reproduced exactly, so a large value here is legal — but
|
|
1489
|
+
* it means this hue reads heavier or lighter than its siblings at that step,
|
|
1490
|
+
* which the generator surfaces as a warning.
|
|
1491
|
+
*/
|
|
1492
|
+
deviations?: Partial<Record<NumStep, number>>;
|
|
1493
|
+
}
|
|
1494
|
+
/** Expand every palette hue into its numeric scale. */
|
|
1495
|
+
declare function expandPalette(raw: Record<string, unknown>): Record<string, ExpandedHue>;
|
|
1496
|
+
/** Which shape of token set a role gets. */
|
|
1497
|
+
type RoleKind = 'surface' | 'chromatic';
|
|
1498
|
+
/**
|
|
1499
|
+
* Map a token key to its CSS custom property for a given role.
|
|
1500
|
+
*
|
|
1501
|
+
* `on` is the one irregular case: the foreground for a filled surface reads
|
|
1502
|
+
* `--color-text-on-<role>`, with the role *after* `on`, because it names what it
|
|
1503
|
+
* sits on rather than what it is.
|
|
1504
|
+
*
|
|
1505
|
+
* The utility class name is this minus the `--color-` prefix, which is why the
|
|
1506
|
+
* emitter and the linter can both derive their vocabulary from one function.
|
|
1507
|
+
*/
|
|
1508
|
+
declare function tokenVar(role: string, key: string): string;
|
|
1509
|
+
/** The class name a token key produces for a role (`bg-danger-solid`, …). */
|
|
1510
|
+
declare const tokenClass: (role: string, key: string) => string;
|
|
1511
|
+
interface FunctionalRole {
|
|
1512
|
+
role: string;
|
|
1513
|
+
hue: string;
|
|
1514
|
+
kind: RoleKind;
|
|
1515
|
+
/** token key → CSS value, per appearance. */
|
|
1516
|
+
light: Record<string, string>;
|
|
1517
|
+
dark: Record<string, string>;
|
|
1518
|
+
}
|
|
1519
|
+
/** Resolve the token set for one role over its hue. */
|
|
1520
|
+
declare function functionalRole(role: string, hueName: string, hue: ExpandedHue, kind?: RoleKind): FunctionalRole;
|
|
1521
|
+
/**
|
|
1522
|
+
* APCA targets. `TEXT` is the body-text bar; `SECONDARY` covers text on a
|
|
1523
|
+
* non-primary surface and de-emphasised text. `NON_TEXT` is the icon/boundary
|
|
1524
|
+
* tier — the APCA analogue of WCAG's 3:1, where a glyph may run more vivid than
|
|
1525
|
+
* text because shape carries meaning alongside contrast.
|
|
1526
|
+
*/
|
|
1527
|
+
declare const CONTRAST: {
|
|
1528
|
+
readonly TEXT: 75;
|
|
1529
|
+
readonly SECONDARY: 60;
|
|
1530
|
+
readonly NON_TEXT: 45;
|
|
1531
|
+
};
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region src/generate.d.ts
|
|
1534
|
+
type Format = 'bricks' | 'css' | 'tailwind' | 'design';
|
|
1535
|
+
/**
|
|
1536
|
+
* Formats that emit a stylesheet. `design` is the odd one out — it emits a
|
|
1537
|
+
* single `DESIGN.md` brief and no CSS at all — so anything that expects to
|
|
1538
|
+
* import the generator's output (the Vite plugin's injected stylesheet, the
|
|
1539
|
+
* Astro integration) types against this narrower set.
|
|
1540
|
+
*/
|
|
1541
|
+
type StylesheetFormat = Exclude<Format, 'design'>;
|
|
1542
|
+
interface GenerateOptions {
|
|
1543
|
+
/** Path to a design-system.json, OR an already-parsed config object. */
|
|
1544
|
+
input: string | DesignSystem;
|
|
1545
|
+
/** Output target. Default: 'bricks'. */
|
|
1546
|
+
format?: Format;
|
|
1547
|
+
/** Directory to write outputs into. Default: 'dist'. */
|
|
1548
|
+
outDir?: string;
|
|
1549
|
+
/** Override the framework asset root (advanced/testing). */
|
|
1550
|
+
assetsDir?: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* Optional site config (path, or already-parsed) enabling legal-document
|
|
1553
|
+
* output into `<outDir>/legal/*.html`.
|
|
1554
|
+
*
|
|
1555
|
+
* Separate from `input` because it is a different config kind: `input` is a
|
|
1556
|
+
* `design-system.json`, this is a `SiteConfig`. Nothing else in `generate`
|
|
1557
|
+
* reads it, and omitting it emits no legal files.
|
|
1558
|
+
*/
|
|
1559
|
+
site?: string | SiteConfig;
|
|
1560
|
+
}
|
|
1561
|
+
interface GenerateResult {
|
|
1562
|
+
format: Format;
|
|
1563
|
+
outDir: string;
|
|
1564
|
+
written: string[];
|
|
1565
|
+
}
|
|
1566
|
+
interface ColorUtility {
|
|
1567
|
+
/** Class name, without the leading dot. */
|
|
1568
|
+
cls: string;
|
|
1569
|
+
/** CSS property the class sets. */
|
|
1570
|
+
prop: string;
|
|
1571
|
+
/** `var(--…)` reference the class resolves to. */
|
|
1572
|
+
value: string;
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Every role colour utility, each class name emitted EXACTLY once.
|
|
1576
|
+
*
|
|
1577
|
+
* There is now a single axis. The target lives *inside* the token name, so
|
|
1578
|
+
* `bg-danger-muted` and `text-danger-muted` are different tokens and the
|
|
1579
|
+
* collision the old plane/stop precedence rule existed to arbitrate cannot
|
|
1580
|
+
* arise. Both the css/bricks and tailwind paths render from this one list, which
|
|
1581
|
+
* is what keeps the three formats in step; `format-parity.test.ts` holds them
|
|
1582
|
+
* there.
|
|
1583
|
+
*
|
|
1584
|
+
* The class name IS the token name minus `--color-`, so there is no separate
|
|
1585
|
+
* naming rule to drift — see `tokenClass` in tokens.ts.
|
|
1586
|
+
*/
|
|
1587
|
+
declare function roleColorUtilities(roles: readonly FunctionalRole[], utilities: readonly string[]): ColorUtility[];
|
|
1588
|
+
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region src/docs.d.ts
|
|
1591
|
+
/**
|
|
1592
|
+
* Build the OKF docs bundle for a config. Returns a `{ relPath: content }` map;
|
|
1593
|
+
* the caller writes it wherever the bundle should live (e.g. `<outDir>/docs`).
|
|
1594
|
+
*/
|
|
1595
|
+
declare function generateDocs(ds: DesignSystem, assetsDir: string): Record<string, string>;
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/shared.d.ts
|
|
1598
|
+
/**
|
|
1599
|
+
* Data shared between the generator (`generate.ts`) and the docs bundle
|
|
1600
|
+
* (`docs.ts`). Lives in its own module because `generate.ts` imports `docs.ts` —
|
|
1601
|
+
* importing back the other way would be a cycle.
|
|
1602
|
+
*/
|
|
1603
|
+
/**
|
|
1604
|
+
* Selector the dark functional-token flip hangs off.
|
|
1605
|
+
*
|
|
1606
|
+
* `data-brx-theme` is Bricks' own attribute — Bricks sets it, so it's what the
|
|
1607
|
+
* WordPress target needs. Nothing sets it anywhere else, which meant the dark
|
|
1608
|
+
* flip was unreachable outside Bricks: the shipped `<color-scheme-toggle>` web
|
|
1609
|
+
* component writes `documentElement.dataset.theme` (i.e. `data-theme`), so
|
|
1610
|
+
* clicking "Dark" changed an attribute no rule matched. Matching both makes the
|
|
1611
|
+
* component work on every target without changing what Bricks already does.
|
|
1612
|
+
*
|
|
1613
|
+
* Note this covers the explicit choice only — there is deliberately no
|
|
1614
|
+
* `prefers-color-scheme` block, so the toggle's "System" position currently
|
|
1615
|
+
* resolves to light. Adding one would flip every existing consumer site dark for
|
|
1616
|
+
* dark-OS users, which is a product decision, not a bug fix.
|
|
1617
|
+
*
|
|
1618
|
+
* Shared so the docs quote the selector the generator actually emits.
|
|
1619
|
+
*/
|
|
1620
|
+
declare const DARK_SEL = ":root[data-brx-theme=\"dark\"], :root[data-theme=\"dark\"]";
|
|
1621
|
+
/**
|
|
1622
|
+
* Roles the shipped CSS partials reference with NO fallback, so a config that
|
|
1623
|
+
* omits one leaves those rules resolving to nothing — an invalid declaration,
|
|
1624
|
+
* not a graceful degrade.
|
|
1625
|
+
*
|
|
1626
|
+
* `colors.roles` is an open record: any name works and generates a full token
|
|
1627
|
+
* set, utilities and dark flip. But the framework's own component CSS is
|
|
1628
|
+
* written against these six, so "roles are arbitrary" is only half true — they
|
|
1629
|
+
* are *extensible*, over a required core. `validate()` warns when one is
|
|
1630
|
+
* missing; `required-roles.test.ts` re-derives this list from the partials so
|
|
1631
|
+
* it cannot drift as components are added.
|
|
1632
|
+
*
|
|
1633
|
+
* Kept as a constant rather than scanned at call time because `validate()` is
|
|
1634
|
+
* a pure function — the CLI, the Vite plugin and `toJSONSchema` all import it,
|
|
1635
|
+
* and none of them should touch the filesystem to answer "is this config ok?".
|
|
1636
|
+
*/
|
|
1637
|
+
declare const REQUIRED_ROLES: readonly string[];
|
|
1638
|
+
/**
|
|
1639
|
+
* Every token key a role can resolve to, across both role kinds. Shared so the
|
|
1640
|
+
* required-roles drift test greps for exactly what the generator emits.
|
|
1641
|
+
*
|
|
1642
|
+
* These are *keys*, not var names: the role sits in the middle of the property
|
|
1643
|
+
* (`--color-bg-danger-muted`), so compose them with `tokenVar()` from `tokens.ts`
|
|
1644
|
+
* rather than concatenating by hand.
|
|
1645
|
+
*/
|
|
1646
|
+
declare const ROLE_TOKEN_KEYS: readonly string[];
|
|
1647
|
+
/** How a role is authored in `colors.roles`: a bare hue, or a hue plus its kind. */
|
|
1648
|
+
type RoleSpec = string | {
|
|
1649
|
+
hue: string;
|
|
1650
|
+
kind?: 'surface' | 'chromatic' | undefined;
|
|
1651
|
+
};
|
|
1652
|
+
/** The palette hue a role points at, through either authoring form. */
|
|
1653
|
+
declare const roleHue: (spec: RoleSpec) => string;
|
|
1654
|
+
/**
|
|
1655
|
+
* A role's kind. The bare-string shorthand means `chromatic`, because signal
|
|
1656
|
+
* colours are the common case and surfaces are the two or three you name once.
|
|
1657
|
+
*/
|
|
1658
|
+
declare const roleKind: (spec: RoleSpec) => "surface" | "chromatic";
|
|
1659
|
+
/**
|
|
1660
|
+
* Pattern base geometry props → per-pattern override-hook shorthand. Each hook
|
|
1661
|
+
* wraps the authored value (`padding: var(--p-btn, 0.4em 0.8em)`) so a
|
|
1662
|
+
* consumer restyles one pattern by setting one variable. The hook is named after
|
|
1663
|
+
* the pattern's key, not its class.
|
|
1664
|
+
*/
|
|
1665
|
+
declare const BASE_HOOK: Record<string, string>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Framework utility classes whose names collide with Tailwind's own defaults.
|
|
1668
|
+
* The `tailwind` format strips any rule targeting these — Tailwind provides
|
|
1669
|
+
* them, so consumers use Tailwind's utilities for these names instead.
|
|
1670
|
+
*/
|
|
1671
|
+
declare const TW_CLASH: ReadonlySet<string>;
|
|
1672
|
+
//#endregion
|
|
1673
|
+
//#region src/legal/providers.d.ts
|
|
1674
|
+
interface Processor {
|
|
1675
|
+
/** The provider as a reader would recognise it. */
|
|
1676
|
+
name: string;
|
|
1677
|
+
/** Reads after "for": "…to Stripe for payment processing". */
|
|
1678
|
+
purpose: string;
|
|
1679
|
+
/** Reads inside a sentence: "…including the United States". */
|
|
1680
|
+
country?: string | undefined;
|
|
1681
|
+
privacyUrl?: string | undefined;
|
|
1682
|
+
/**
|
|
1683
|
+
* Cookies this provider sets. An empty array is meaningful and not the same as
|
|
1684
|
+
* `undefined`: it asserts the provider is cookieless (Plausible), which the
|
|
1685
|
+
* cookie notice states positively rather than omitting.
|
|
1686
|
+
*/
|
|
1687
|
+
cookies?: string[] | undefined;
|
|
1688
|
+
/** A user-facing opt-out, when the provider offers one. */
|
|
1689
|
+
optOut?: string | undefined;
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* The providers the config can imply. Keyed for testability — a test can assert
|
|
1693
|
+
* a given config resolves to a given key without matching on prose.
|
|
1694
|
+
*/
|
|
1695
|
+
declare const KNOWN_PROCESSORS: {
|
|
1696
|
+
googleAnalytics: {
|
|
1697
|
+
name: string;
|
|
1698
|
+
purpose: string;
|
|
1699
|
+
country: string;
|
|
1700
|
+
privacyUrl: string;
|
|
1701
|
+
cookies: string[];
|
|
1702
|
+
optOut: string;
|
|
1703
|
+
};
|
|
1704
|
+
googleTagManager: {
|
|
1705
|
+
name: string;
|
|
1706
|
+
purpose: string;
|
|
1707
|
+
country: string;
|
|
1708
|
+
privacyUrl: string;
|
|
1709
|
+
cookies: never[];
|
|
1710
|
+
};
|
|
1711
|
+
plausible: {
|
|
1712
|
+
name: string;
|
|
1713
|
+
purpose: string;
|
|
1714
|
+
country: string;
|
|
1715
|
+
privacyUrl: string;
|
|
1716
|
+
cookies: never[];
|
|
1717
|
+
};
|
|
1718
|
+
turnstile: {
|
|
1719
|
+
name: string;
|
|
1720
|
+
purpose: string;
|
|
1721
|
+
country: string;
|
|
1722
|
+
privacyUrl: string;
|
|
1723
|
+
cookies: string[];
|
|
1724
|
+
};
|
|
1725
|
+
cloudflare: {
|
|
1726
|
+
name: string;
|
|
1727
|
+
purpose: string;
|
|
1728
|
+
country: string;
|
|
1729
|
+
privacyUrl: string;
|
|
1730
|
+
cookies: never[];
|
|
1731
|
+
};
|
|
1732
|
+
vercel: {
|
|
1733
|
+
name: string;
|
|
1734
|
+
purpose: string;
|
|
1735
|
+
country: string;
|
|
1736
|
+
privacyUrl: string;
|
|
1737
|
+
cookies: never[];
|
|
1738
|
+
};
|
|
1739
|
+
netlify: {
|
|
1740
|
+
name: string;
|
|
1741
|
+
purpose: string;
|
|
1742
|
+
country: string;
|
|
1743
|
+
privacyUrl: string;
|
|
1744
|
+
cookies: never[];
|
|
1745
|
+
};
|
|
1746
|
+
};
|
|
1747
|
+
type KnownProcessorKey = keyof typeof KNOWN_PROCESSORS;
|
|
1748
|
+
/**
|
|
1749
|
+
* Which known providers this config implies, in a stable order (analytics →
|
|
1750
|
+
* security → hosting) so the rendered sentence doesn't churn between builds.
|
|
1751
|
+
*
|
|
1752
|
+
* Returns keys rather than processors so a caller can test the detection
|
|
1753
|
+
* independently of the prose attached to it.
|
|
1754
|
+
*/
|
|
1755
|
+
declare function detectProcessorKeys(site: SiteConfig): KnownProcessorKey[];
|
|
1756
|
+
/**
|
|
1757
|
+
* Every processor this policy must disclose: the ones implied by the config,
|
|
1758
|
+
* then the ones the consumer declared.
|
|
1759
|
+
*
|
|
1760
|
+
* Consumer entries come last and are never deduplicated against the built-ins —
|
|
1761
|
+
* an explicit declaration is a statement of fact we have no grounds to drop.
|
|
1762
|
+
*/
|
|
1763
|
+
declare function resolveProcessors(site: SiteConfig): Processor[];
|
|
1764
|
+
//#endregion
|
|
1765
|
+
//#region src/legal/derive.d.ts
|
|
1766
|
+
/**
|
|
1767
|
+
* The facts every legal template renders from.
|
|
1768
|
+
*
|
|
1769
|
+
* List-shaped fields are `string[]`, not pre-joined strings, because they land
|
|
1770
|
+
* in bullet positions: a template that splices an empty string into a list emits
|
|
1771
|
+
* a stray `-` bullet, and that is exactly the kind of silent breakage a
|
|
1772
|
+
* published policy must not have.
|
|
1773
|
+
*/
|
|
1774
|
+
interface PolicyVars {
|
|
1775
|
+
businessName: string;
|
|
1776
|
+
url: string;
|
|
1777
|
+
/** Reads after "at": "…contact our Privacy Officer at <this>." */
|
|
1778
|
+
mailingAddress: string;
|
|
1779
|
+
lastUpdated: string | undefined;
|
|
1780
|
+
/** Extra retention sentence, when the consumer stated one. */
|
|
1781
|
+
retention: string | undefined;
|
|
1782
|
+
/** A consumer-supplied governing-law phrase, which wins over the two below. */
|
|
1783
|
+
governingLaw: string | undefined;
|
|
1784
|
+
/** Province/territory, spelled out — "Ontario", never "ON". */
|
|
1785
|
+
governingProvince: string | undefined;
|
|
1786
|
+
governingCountry: string;
|
|
1787
|
+
/** Circumstances in which personal information is collected. */
|
|
1788
|
+
collectionReasons: string[];
|
|
1789
|
+
/** Categories of personal information collected. */
|
|
1790
|
+
piiCollected: string[];
|
|
1791
|
+
/** What the browser sends automatically. */
|
|
1792
|
+
techInfo: string[];
|
|
1793
|
+
/** Why that technical information is used. */
|
|
1794
|
+
techInfoPurposes: string[];
|
|
1795
|
+
/** What cookies track. */
|
|
1796
|
+
cookieTracked: string[];
|
|
1797
|
+
/** Why cookies are used. */
|
|
1798
|
+
cookiePurposes: string[];
|
|
1799
|
+
/** A sentence about the consent tool, or `undefined` when there is none. */
|
|
1800
|
+
cookieTool: string | undefined;
|
|
1801
|
+
/** How collected information is used. */
|
|
1802
|
+
usePurposes: string[];
|
|
1803
|
+
/** Choices a visitor has. */
|
|
1804
|
+
optOutOptions: string[];
|
|
1805
|
+
/** The subset of `optOutOptions` about cookies — an e-mail unsubscribe link is
|
|
1806
|
+
* not a cookie choice, and listing it in a cookie notice reads as padding. */
|
|
1807
|
+
cookieOptOutOptions: string[];
|
|
1808
|
+
processors: Processor[];
|
|
1809
|
+
/** Reads after "including": "…the United States and the European Union". */
|
|
1810
|
+
countries: string | undefined;
|
|
1811
|
+
consentModel: 'opt-in' | 'opt-out' | 'none';
|
|
1812
|
+
cookieCategories: string[];
|
|
1813
|
+
}
|
|
1814
|
+
declare function derivePolicyVars(site: SiteConfig): PolicyVars;
|
|
1815
|
+
//#endregion
|
|
1816
|
+
//#region src/legal/templates/cookies.ca.d.ts
|
|
1817
|
+
declare function cookiesCa(v: PolicyVars): string;
|
|
1818
|
+
//#endregion
|
|
1819
|
+
//#region src/legal/templates/privacy.ca.d.ts
|
|
1820
|
+
declare function privacyCa(v: PolicyVars): string;
|
|
1821
|
+
//#endregion
|
|
1822
|
+
//#region src/legal/templates/terms.ca.d.ts
|
|
1823
|
+
declare function termsCa(v: PolicyVars): string;
|
|
1824
|
+
//#endregion
|
|
1825
|
+
//#region src/legal/templates/index.d.ts
|
|
1826
|
+
type LegalDoc = 'privacy' | 'terms' | 'cookies';
|
|
1827
|
+
type DocSet = Record<LegalDoc, (v: PolicyVars) => string>;
|
|
1828
|
+
declare const TEMPLATES: {
|
|
1829
|
+
ca: {
|
|
1830
|
+
privacy: typeof privacyCa;
|
|
1831
|
+
terms: typeof termsCa;
|
|
1832
|
+
cookies: typeof cookiesCa;
|
|
1833
|
+
};
|
|
1834
|
+
};
|
|
1835
|
+
/** Stable output order, independent of which docs a given config enables. */
|
|
1836
|
+
declare const DOC_ORDER: LegalDoc[];
|
|
1837
|
+
/** Output filename stem per document — also the Bricks shortcode's allowlist. */
|
|
1838
|
+
declare const DOC_SLUGS: Record<LegalDoc, string>;
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region src/legal/render.d.ts
|
|
1841
|
+
interface Span {
|
|
1842
|
+
text: string;
|
|
1843
|
+
strong?: boolean;
|
|
1844
|
+
code?: boolean;
|
|
1845
|
+
}
|
|
1846
|
+
type Block = {
|
|
1847
|
+
kind: 'heading';
|
|
1848
|
+
level: 1 | 2 | 3;
|
|
1849
|
+
spans: Span[];
|
|
1850
|
+
} | {
|
|
1851
|
+
kind: 'paragraph';
|
|
1852
|
+
spans: Span[];
|
|
1853
|
+
} | {
|
|
1854
|
+
kind: 'list';
|
|
1855
|
+
items: Span[][];
|
|
1856
|
+
} | {
|
|
1857
|
+
kind: 'quote';
|
|
1858
|
+
spans: Span[];
|
|
1859
|
+
};
|
|
1860
|
+
/** Markdown (our subset) → blocks. Throws on anything it does not model. */
|
|
1861
|
+
declare function parseMarkdown(md: string): Block[];
|
|
1862
|
+
/**
|
|
1863
|
+
* Blocks → `ContentNode[]`, the framework-agnostic tree the site config already
|
|
1864
|
+
* uses for `templates` of type `nodes` and `NodeRenderer.astro` already renders.
|
|
1865
|
+
*/
|
|
1866
|
+
declare function toContentNodes(blocks: Block[]): ContentNode[];
|
|
1867
|
+
declare function toHtmlFragment(blocks: Block[]): string;
|
|
1868
|
+
/**
|
|
1869
|
+
* Blocks → EmDash Portable Text, matching the shape already seeded in
|
|
1870
|
+
* `packages/create/templates/emdash/seed/seed.json`.
|
|
1871
|
+
*
|
|
1872
|
+
* Two deliberate mappings:
|
|
1873
|
+
* - the `# ` heading is **dropped** — in EmDash the page title is a field
|
|
1874
|
+
* (`data.title`), and repeating it as the first content block renders twice;
|
|
1875
|
+
* - the review blockquote becomes a `vitops.banner` with `tone: "warning"`,
|
|
1876
|
+
* which is exactly the block the hand-written placeholder pages used.
|
|
1877
|
+
*
|
|
1878
|
+
* `_key`s are derived from position rather than randomness, so regenerating an
|
|
1879
|
+
* unchanged config produces an identical seed and a clean diff.
|
|
1880
|
+
*/
|
|
1881
|
+
declare function toPortableText(blocks: Block[], prefix: string): unknown[];
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/legal/index.d.ts
|
|
1884
|
+
type LegalOutput = 'md' | 'html' | 'portable-text';
|
|
1885
|
+
interface GenerateLegalOptions {
|
|
1886
|
+
/** Which documents to render. Defaults to those enabled in the config. */
|
|
1887
|
+
docs?: LegalDoc[];
|
|
1888
|
+
/** Output format. Default `md`. */
|
|
1889
|
+
output?: LegalOutput;
|
|
1890
|
+
}
|
|
1891
|
+
/** Which documents the config asks for, in a stable order. */
|
|
1892
|
+
declare function enabledDocs(site: SiteConfig): LegalDoc[];
|
|
1893
|
+
/** Render one document to markdown. The other outputs derive from this. */
|
|
1894
|
+
declare function renderMarkdown(site: SiteConfig, doc: LegalDoc, vars?: PolicyVars): string;
|
|
1895
|
+
/**
|
|
1896
|
+
* Render one document as a `ContentNode` tree — the framework-agnostic shape the
|
|
1897
|
+
* site config already uses for `templates` of type `nodes`, so an Astro consumer
|
|
1898
|
+
* can hand it to `NodeRenderer` instead of injecting a string of HTML.
|
|
1899
|
+
*/
|
|
1900
|
+
declare function renderNodes(site: SiteConfig, doc: LegalDoc): ContentNode[];
|
|
1901
|
+
/**
|
|
1902
|
+
* Every enabled legal document, keyed by output path.
|
|
1903
|
+
*
|
|
1904
|
+
* Documents are keyed by filename (`privacy-policy.md`) rather than by document
|
|
1905
|
+
* id so a caller can write the map verbatim.
|
|
1906
|
+
*/
|
|
1907
|
+
declare function generateLegal(site: SiteConfig, opts?: GenerateLegalOptions): Record<string, string>;
|
|
1908
|
+
//#endregion
|
|
1394
1909
|
//#region src/index.d.ts
|
|
1395
1910
|
/**
|
|
1396
1911
|
* A minimal but complete starter design system, used by `vitops init`. It
|
|
@@ -1399,5 +1914,5 @@ declare function deepMerge(target: Record<string, unknown>, source: Record<strin
|
|
|
1399
1914
|
*/
|
|
1400
1915
|
declare function defaultConfig(): DesignSystem;
|
|
1401
1916
|
//#endregion
|
|
1402
|
-
export { BASE_HOOK, type DesignSystem, DesignSystemSchema, type Format, type GenerateOptions, type GenerateResult, SCHEMA_URL, SITE_SCHEMA_URL, type SiteConfig, SiteConfigSchema, type SiteValidationResult, TW_CLASH, type ValidationResult, deepMerge, defaultConfig, generate, generateDocs, jsonSchema, resolveSiteConfig, resolveTheme, siteJsonSchema, stripNulls, validate, validateSite };
|
|
1917
|
+
export { BASE_HOOK, type Block, CONTRAST, type ColorUtility, type ContactObject, DARK_SEL, DOC_ORDER, DOC_SLUGS, type DesignSystem, DesignSystemSchema, type DocSet, type ExpandedHue, type Format, type FunctionalRole, type GenerateLegalOptions, type GenerateOptions, type GenerateResult, JURISDICTIONS, type Jurisdiction, KNOWN_PROCESSORS, type KnownProcessorKey, type LegalDoc, type LegalOutput, NUMERIC_STEPS, type PolicyVars, type PostalAddress, type Processor, REQUIRED_ROLES, ROLE_TOKEN_KEYS, type RoleKind, type RoleSpec, SCHEMA_URL, SITE_SCHEMA_URL, type SiteConfig, SiteConfigSchema, type SiteValidationResult, type Span, type StylesheetFormat, TEMPLATES, TW_CLASH, type ValidationResult, deepMerge, defaultConfig, derivePolicyVars, detectProcessorKeys, enabledDocs, expandPalette, functionalRole, generate, generateDocs, generateLegal, jsonSchema, parseMarkdown, renderMarkdown, renderNodes, resolvePrivacyContact, resolveProcessors, resolveSiteConfig, resolveTheme, roleColorUtilities, roleHue, roleKind, siteJsonSchema, stripNulls, toContentNodes, toHtmlFragment, toPortableText, tokenClass, tokenVar, validate, validateSite };
|
|
1403
1918
|
//# sourceMappingURL=index.d.mts.map
|