@getvitops/generator 0.9.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 +288 -0
- package/README.md +16 -4
- package/assets/bricks/load.php +46 -1
- package/assets/css/animation.css +2 -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/dialog.css +2 -2
- package/assets/css/patterns/drawer.css +2 -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/tag.css +1 -1
- package/assets/css/patterns/text-effects.css +1 -1
- package/assets/css/patterns/theme-editor.css +6 -6
- package/assets/css/patterns/tooltip.css +2 -2
- package/assets/css/patterns/tree.css +3 -3
- package/assets/js/editor.js +2 -2
- package/dist/index.d.mts +571 -145
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3520 -1743
- 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,13 +15,20 @@ 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<{
|
|
26
|
+
fill: "fill";
|
|
15
27
|
bg: "bg";
|
|
16
28
|
text: "text";
|
|
29
|
+
icon: "icon";
|
|
17
30
|
border: "border";
|
|
18
31
|
outline: "outline";
|
|
19
|
-
fill: "fill";
|
|
20
32
|
stroke: "stroke";
|
|
21
33
|
}>>>;
|
|
22
34
|
}, z.z.core.$strip>;
|
|
@@ -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,13 +116,20 @@ 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<{
|
|
127
|
+
fill: "fill";
|
|
105
128
|
bg: "bg";
|
|
106
129
|
text: "text";
|
|
130
|
+
icon: "icon";
|
|
107
131
|
border: "border";
|
|
108
132
|
outline: "outline";
|
|
109
|
-
fill: "fill";
|
|
110
133
|
stroke: "stroke";
|
|
111
134
|
}>>>;
|
|
112
135
|
}, z.z.core.$strip>;
|
|
@@ -254,142 +277,37 @@ type ValidationResult = {
|
|
|
254
277
|
*/
|
|
255
278
|
declare function validate(input: unknown): ValidationResult;
|
|
256
279
|
//#endregion
|
|
257
|
-
//#region src/
|
|
258
|
-
declare const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
type Format = 'bricks' | 'css' | 'tailwind';
|
|
280
|
-
interface GenerateOptions {
|
|
281
|
-
/** Path to a design-system.json, OR an already-parsed config object. */
|
|
282
|
-
input: string | DesignSystem;
|
|
283
|
-
/** Output target. Default: 'bricks'. */
|
|
284
|
-
format?: Format;
|
|
285
|
-
/** Directory to write outputs into. Default: 'dist'. */
|
|
286
|
-
outDir?: string;
|
|
287
|
-
/** Override the framework asset root (advanced/testing). */
|
|
288
|
-
assetsDir?: string;
|
|
289
|
-
}
|
|
290
|
-
interface GenerateResult {
|
|
291
|
-
format: Format;
|
|
292
|
-
outDir: string;
|
|
293
|
-
written: string[];
|
|
294
|
-
}
|
|
295
|
-
interface ColorUtility {
|
|
296
|
-
/** Class name, without the leading dot. */
|
|
297
|
-
cls: string;
|
|
298
|
-
/** CSS property the class sets. */
|
|
299
|
-
prop: string;
|
|
300
|
-
/** `var(--…)` reference the class resolves to. */
|
|
301
|
-
value: string;
|
|
302
|
-
/** Which of the two axes below produced it. */
|
|
303
|
-
axis: 'plane' | 'stop';
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Every role colour utility, each class name emitted EXACTLY once.
|
|
307
|
-
*
|
|
308
|
-
* Two axes share the `<family>-<role>-<modifier>` namespace: the functional
|
|
309
|
-
* background/text/border **planes** (`--<role>-bg-muted`) and the
|
|
310
|
-
* appearance-relative emphasis **stops** (`--color-<role>-muted`). Where both
|
|
311
|
-
* would produce the same class the plane wins.
|
|
312
|
-
*
|
|
313
|
-
* That precedence used to be implicit — the css path emitted the stop matrix,
|
|
314
|
-
* then the planes, and relied on the CSS minifier dropping the shadowed
|
|
315
|
-
* earlier rule. The tailwind path never ran the stop half at all, so the two
|
|
316
|
-
* formats shipped different vocabularies (87 role classes existed in css and
|
|
317
|
-
* not in tailwind) with nothing to catch it. Deciding it here, once, is what
|
|
318
|
-
* keeps all three formats in step; `format-parity.test.ts` holds them there.
|
|
319
|
-
*
|
|
320
|
-
* Order is stops-then-planes to match the css bundle's historical rule order.
|
|
321
|
-
*/
|
|
322
|
-
declare function roleColorUtilities(roles: readonly FunctionalRole[], utilities: readonly string[]): ColorUtility[];
|
|
323
|
-
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
324
|
-
//#endregion
|
|
325
|
-
//#region src/docs.d.ts
|
|
326
|
-
/**
|
|
327
|
-
* Build the OKF docs bundle for a config. Returns a `{ relPath: content }` map;
|
|
328
|
-
* the caller writes it wherever the bundle should live (e.g. `<outDir>/docs`).
|
|
329
|
-
*/
|
|
330
|
-
declare function generateDocs(ds: DesignSystem, assetsDir: string): Record<string, string>;
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/shared.d.ts
|
|
333
|
-
/**
|
|
334
|
-
* Data shared between the generator (`generate.ts`) and the docs bundle
|
|
335
|
-
* (`docs.ts`). Lives in its own module because `generate.ts` imports `docs.ts` —
|
|
336
|
-
* importing back the other way would be a cycle.
|
|
337
|
-
*/
|
|
338
|
-
/**
|
|
339
|
-
* Selector the dark functional-token flip hangs off.
|
|
340
|
-
*
|
|
341
|
-
* `data-brx-theme` is Bricks' own attribute — Bricks sets it, so it's what the
|
|
342
|
-
* WordPress target needs. Nothing sets it anywhere else, which meant the dark
|
|
343
|
-
* flip was unreachable outside Bricks: the shipped `<color-scheme-toggle>` web
|
|
344
|
-
* component writes `documentElement.dataset.theme` (i.e. `data-theme`), so
|
|
345
|
-
* clicking "Dark" changed an attribute no rule matched. Matching both makes the
|
|
346
|
-
* component work on every target without changing what Bricks already does.
|
|
347
|
-
*
|
|
348
|
-
* Note this covers the explicit choice only — there is deliberately no
|
|
349
|
-
* `prefers-color-scheme` block, so the toggle's "System" position currently
|
|
350
|
-
* resolves to light. Adding one would flip every existing consumer site dark for
|
|
351
|
-
* dark-OS users, which is a product decision, not a bug fix.
|
|
352
|
-
*
|
|
353
|
-
* Shared so the docs quote the selector the generator actually emits.
|
|
354
|
-
*/
|
|
355
|
-
declare const DARK_SEL = ":root[data-brx-theme=\"dark\"], :root[data-theme=\"dark\"]";
|
|
356
|
-
/**
|
|
357
|
-
* Roles the shipped CSS partials reference with NO fallback, so a config that
|
|
358
|
-
* omits one leaves those rules resolving to nothing — an invalid declaration,
|
|
359
|
-
* not a graceful degrade.
|
|
360
|
-
*
|
|
361
|
-
* `colors.roles` is an open record: any name works and generates a full token
|
|
362
|
-
* set, utilities and dark flip. But the framework's own component CSS is
|
|
363
|
-
* written against these six, so "roles are arbitrary" is only half true — they
|
|
364
|
-
* are *extensible*, over a required core. `validate()` warns when one is
|
|
365
|
-
* missing; `required-roles.test.ts` re-derives this list from the partials so
|
|
366
|
-
* it cannot drift as components are added.
|
|
367
|
-
*
|
|
368
|
-
* Kept as a constant rather than scanned at call time because `validate()` is
|
|
369
|
-
* a pure function — the CLI, the Vite plugin and `toJSONSchema` all import it,
|
|
370
|
-
* and none of them should touch the filesystem to answer "is this config ok?".
|
|
371
|
-
*/
|
|
372
|
-
declare const REQUIRED_ROLES: readonly string[];
|
|
373
|
-
/**
|
|
374
|
-
* The functional-token and emphasis-stop suffixes a role resolves to. Shared so
|
|
375
|
-
* the required-roles drift test greps for exactly what the generator emits.
|
|
376
|
-
*/
|
|
377
|
-
declare const ROLE_TOKEN_SUFFIXES: readonly string[];
|
|
378
|
-
/**
|
|
379
|
-
* Pattern base geometry props → per-pattern override-hook shorthand. Each hook
|
|
380
|
-
* wraps the authored value (`padding: var(--p-btn, 0.4em 0.8em)`) so a
|
|
381
|
-
* consumer restyles one pattern by setting one variable. The hook is named after
|
|
382
|
-
* the pattern's key, not its class.
|
|
383
|
-
*/
|
|
384
|
-
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>;
|
|
385
302
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
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.
|
|
389
308
|
*/
|
|
390
|
-
declare const
|
|
391
|
-
|
|
392
|
-
//#region src/site.d.ts
|
|
309
|
+
declare const JURISDICTIONS: readonly ["ca"];
|
|
310
|
+
type Jurisdiction = (typeof JURISDICTIONS)[number];
|
|
393
311
|
declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
394
312
|
defaultLocale: z.ZodMiniString<string>;
|
|
395
313
|
locales: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
@@ -559,6 +477,10 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
559
477
|
}, z.z.core.$strip>>;
|
|
560
478
|
designSystem: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
561
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>>>;
|
|
562
484
|
shadows: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
563
485
|
fonts: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
564
486
|
typeScale: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
@@ -627,13 +549,20 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
627
549
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
628
550
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
629
551
|
}, z.z.core.$strip>]>>>;
|
|
630
|
-
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>]>>>;
|
|
631
559
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
560
|
+
fill: "fill";
|
|
632
561
|
bg: "bg";
|
|
633
562
|
text: "text";
|
|
563
|
+
icon: "icon";
|
|
634
564
|
border: "border";
|
|
635
565
|
outline: "outline";
|
|
636
|
-
fill: "fill";
|
|
637
566
|
stroke: "stroke";
|
|
638
567
|
}>>>;
|
|
639
568
|
}, z.z.core.$strip>>;
|
|
@@ -741,9 +670,9 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
741
670
|
number: "number";
|
|
742
671
|
date: "date";
|
|
743
672
|
file: "file";
|
|
744
|
-
text: "text";
|
|
745
673
|
email: "email";
|
|
746
674
|
url: "url";
|
|
675
|
+
text: "text";
|
|
747
676
|
tel: "tel";
|
|
748
677
|
password: "password";
|
|
749
678
|
textarea: "textarea";
|
|
@@ -830,15 +759,38 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
830
759
|
}, z.z.core.$strip>>;
|
|
831
760
|
}, z.z.core.$strip>>;
|
|
832
761
|
legal: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
762
|
+
jurisdiction: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
763
|
+
ca: "ca";
|
|
764
|
+
}>>;
|
|
833
765
|
privacyPolicy: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
834
766
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
835
767
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
836
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>>>;
|
|
837
788
|
}, z.z.core.$strip>>;
|
|
838
789
|
termsOfService: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
839
790
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
840
791
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
841
792
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
793
|
+
governingLaw: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
842
794
|
}, z.z.core.$strip>>;
|
|
843
795
|
cookieConsent: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
844
796
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
@@ -1055,6 +1007,10 @@ declare const siteJsonSchema: {
|
|
|
1055
1007
|
}, z.z.core.$strip>>;
|
|
1056
1008
|
designSystem: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
1057
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>>>;
|
|
1058
1014
|
shadows: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
1059
1015
|
fonts: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>>;
|
|
1060
1016
|
typeScale: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniObject<{
|
|
@@ -1123,13 +1079,20 @@ declare const siteJsonSchema: {
|
|
|
1123
1079
|
}, z.z.core.$strip>, z.ZodMiniObject<{
|
|
1124
1080
|
tones: z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>]>;
|
|
1125
1081
|
}, z.z.core.$strip>]>>>;
|
|
1126
|
-
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>]>>>;
|
|
1127
1089
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
1090
|
+
fill: "fill";
|
|
1128
1091
|
bg: "bg";
|
|
1129
1092
|
text: "text";
|
|
1093
|
+
icon: "icon";
|
|
1130
1094
|
border: "border";
|
|
1131
1095
|
outline: "outline";
|
|
1132
|
-
fill: "fill";
|
|
1133
1096
|
stroke: "stroke";
|
|
1134
1097
|
}>>>;
|
|
1135
1098
|
}, z.z.core.$strip>>;
|
|
@@ -1237,9 +1200,9 @@ declare const siteJsonSchema: {
|
|
|
1237
1200
|
number: "number";
|
|
1238
1201
|
date: "date";
|
|
1239
1202
|
file: "file";
|
|
1240
|
-
text: "text";
|
|
1241
1203
|
email: "email";
|
|
1242
1204
|
url: "url";
|
|
1205
|
+
text: "text";
|
|
1243
1206
|
tel: "tel";
|
|
1244
1207
|
password: "password";
|
|
1245
1208
|
textarea: "textarea";
|
|
@@ -1326,15 +1289,38 @@ declare const siteJsonSchema: {
|
|
|
1326
1289
|
}, z.z.core.$strip>>;
|
|
1327
1290
|
}, z.z.core.$strip>>;
|
|
1328
1291
|
legal: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1292
|
+
jurisdiction: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
1293
|
+
ca: "ca";
|
|
1294
|
+
}>>;
|
|
1329
1295
|
privacyPolicy: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1330
1296
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
1331
1297
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
1332
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>>>;
|
|
1333
1318
|
}, z.z.core.$strip>>;
|
|
1334
1319
|
termsOfService: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1335
1320
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
1336
1321
|
url: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
1337
1322
|
lastUpdated: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
1323
|
+
governingLaw: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1338
1324
|
}, z.z.core.$strip>>;
|
|
1339
1325
|
cookieConsent: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1340
1326
|
enabled: z.ZodMiniBoolean<boolean>;
|
|
@@ -1455,6 +1441,15 @@ type SiteValidationResult = {
|
|
|
1455
1441
|
* These live only here — the published JSON Schema enforces shape, not integrity.
|
|
1456
1442
|
*/
|
|
1457
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;
|
|
1458
1453
|
type DesignSystemEntryT = Partial<DesignSystem> & {
|
|
1459
1454
|
displayName?: unknown;
|
|
1460
1455
|
extends?: string;
|
|
@@ -1480,6 +1475,437 @@ declare function stripNulls(obj: unknown): unknown;
|
|
|
1480
1475
|
/** Deep-merge `source` into `target` (in place). Arrays replace wholesale. */
|
|
1481
1476
|
declare function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): void;
|
|
1482
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
|
|
1483
1909
|
//#region src/index.d.ts
|
|
1484
1910
|
/**
|
|
1485
1911
|
* A minimal but complete starter design system, used by `vitops init`. It
|
|
@@ -1488,5 +1914,5 @@ declare function deepMerge(target: Record<string, unknown>, source: Record<strin
|
|
|
1488
1914
|
*/
|
|
1489
1915
|
declare function defaultConfig(): DesignSystem;
|
|
1490
1916
|
//#endregion
|
|
1491
|
-
export { BASE_HOOK, type ColorUtility, DARK_SEL, type DesignSystem, DesignSystemSchema, type ExpandedHue, type Format, type FunctionalRole, type GenerateOptions, type GenerateResult, REQUIRED_ROLES,
|
|
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 };
|
|
1492
1918
|
//# sourceMappingURL=index.d.mts.map
|