@getvitops/generator 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +171 -0
- package/assets/css/animation.css +12 -2
- package/assets/css/patterns/details.css +27 -8
- package/assets/css/patterns/drawer.css +15 -0
- package/assets/css/patterns/grouped.css +1 -1
- package/assets/css/patterns/subgrid.css +62 -16
- package/assets/css/patterns/theme-editor.css +8 -0
- package/assets/css/utilities.css +5 -3
- package/assets/js/editor.js +1 -1
- package/dist/index.d.mts +96 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +424 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/schema.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -12,11 +12,11 @@ declare const DesignSystemSchema: z.ZodMiniObject<{
|
|
|
12
12
|
}, z.z.core.$strip>]>>;
|
|
13
13
|
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
14
14
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
15
|
-
fill: "fill";
|
|
16
15
|
bg: "bg";
|
|
17
16
|
text: "text";
|
|
18
17
|
border: "border";
|
|
19
18
|
outline: "outline";
|
|
19
|
+
fill: "fill";
|
|
20
20
|
stroke: "stroke";
|
|
21
21
|
}>>>;
|
|
22
22
|
}, z.z.core.$strip>;
|
|
@@ -102,11 +102,11 @@ declare const jsonSchema: {
|
|
|
102
102
|
}, z.z.core.$strip>]>>;
|
|
103
103
|
roles: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
104
104
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
105
|
-
fill: "fill";
|
|
106
105
|
bg: "bg";
|
|
107
106
|
text: "text";
|
|
108
107
|
border: "border";
|
|
109
108
|
outline: "outline";
|
|
109
|
+
fill: "fill";
|
|
110
110
|
stroke: "stroke";
|
|
111
111
|
}>>>;
|
|
112
112
|
}, z.z.core.$strip>;
|
|
@@ -254,6 +254,27 @@ type ValidationResult = {
|
|
|
254
254
|
*/
|
|
255
255
|
declare function validate(input: unknown): ValidationResult;
|
|
256
256
|
//#endregion
|
|
257
|
+
//#region src/tokens.d.ts
|
|
258
|
+
declare const NUMERIC_STEPS: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
259
|
+
type NumStep = (typeof NUMERIC_STEPS)[number];
|
|
260
|
+
interface ExpandedHue {
|
|
261
|
+
/** Numeric steps (sparse for fixed-tone kits). */
|
|
262
|
+
numeric: Partial<Record<NumStep, string>>;
|
|
263
|
+
/** True when only authored tones + endpoints exist (no interpolation). */
|
|
264
|
+
sparse?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/** Expand every palette hue into its numeric scale. */
|
|
267
|
+
declare function expandPalette(raw: Record<string, unknown>): Record<string, ExpandedHue>;
|
|
268
|
+
interface FunctionalRole {
|
|
269
|
+
role: string;
|
|
270
|
+
hue: string;
|
|
271
|
+
/** token → CSS value, per appearance. */
|
|
272
|
+
light: Record<string, string>;
|
|
273
|
+
dark: Record<string, string>;
|
|
274
|
+
}
|
|
275
|
+
/** Resolve the functional token set for one role over its hue. */
|
|
276
|
+
declare function functionalRole(role: string, hueName: string, hue: ExpandedHue): FunctionalRole;
|
|
277
|
+
//#endregion
|
|
257
278
|
//#region src/generate.d.ts
|
|
258
279
|
type Format = 'bricks' | 'css' | 'tailwind';
|
|
259
280
|
interface GenerateOptions {
|
|
@@ -271,6 +292,34 @@ interface GenerateResult {
|
|
|
271
292
|
outDir: string;
|
|
272
293
|
written: string[];
|
|
273
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[];
|
|
274
323
|
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
275
324
|
//#endregion
|
|
276
325
|
//#region src/docs.d.ts
|
|
@@ -286,6 +335,46 @@ declare function generateDocs(ds: DesignSystem, assetsDir: string): Record<strin
|
|
|
286
335
|
* (`docs.ts`). Lives in its own module because `generate.ts` imports `docs.ts` —
|
|
287
336
|
* importing back the other way would be a cycle.
|
|
288
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[];
|
|
289
378
|
/**
|
|
290
379
|
* Pattern base geometry props → per-pattern override-hook shorthand. Each hook
|
|
291
380
|
* wraps the authored value (`padding: var(--p-btn, 0.4em 0.8em)`) so a
|
|
@@ -540,11 +629,11 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
540
629
|
}, z.z.core.$strip>]>>>;
|
|
541
630
|
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
542
631
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
543
|
-
fill: "fill";
|
|
544
632
|
bg: "bg";
|
|
545
633
|
text: "text";
|
|
546
634
|
border: "border";
|
|
547
635
|
outline: "outline";
|
|
636
|
+
fill: "fill";
|
|
548
637
|
stroke: "stroke";
|
|
549
638
|
}>>>;
|
|
550
639
|
}, z.z.core.$strip>>;
|
|
@@ -652,9 +741,9 @@ declare const SiteConfigSchema: z.ZodMiniObject<{
|
|
|
652
741
|
number: "number";
|
|
653
742
|
date: "date";
|
|
654
743
|
file: "file";
|
|
744
|
+
text: "text";
|
|
655
745
|
email: "email";
|
|
656
746
|
url: "url";
|
|
657
|
-
text: "text";
|
|
658
747
|
tel: "tel";
|
|
659
748
|
password: "password";
|
|
660
749
|
textarea: "textarea";
|
|
@@ -1036,11 +1125,11 @@ declare const siteJsonSchema: {
|
|
|
1036
1125
|
}, z.z.core.$strip>]>>>;
|
|
1037
1126
|
roles: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
1038
1127
|
utilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
1039
|
-
fill: "fill";
|
|
1040
1128
|
bg: "bg";
|
|
1041
1129
|
text: "text";
|
|
1042
1130
|
border: "border";
|
|
1043
1131
|
outline: "outline";
|
|
1132
|
+
fill: "fill";
|
|
1044
1133
|
stroke: "stroke";
|
|
1045
1134
|
}>>>;
|
|
1046
1135
|
}, z.z.core.$strip>>;
|
|
@@ -1148,9 +1237,9 @@ declare const siteJsonSchema: {
|
|
|
1148
1237
|
number: "number";
|
|
1149
1238
|
date: "date";
|
|
1150
1239
|
file: "file";
|
|
1240
|
+
text: "text";
|
|
1151
1241
|
email: "email";
|
|
1152
1242
|
url: "url";
|
|
1153
|
-
text: "text";
|
|
1154
1243
|
tel: "tel";
|
|
1155
1244
|
password: "password";
|
|
1156
1245
|
textarea: "textarea";
|
|
@@ -1399,5 +1488,5 @@ declare function deepMerge(target: Record<string, unknown>, source: Record<strin
|
|
|
1399
1488
|
*/
|
|
1400
1489
|
declare function defaultConfig(): DesignSystem;
|
|
1401
1490
|
//#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 };
|
|
1491
|
+
export { BASE_HOOK, type ColorUtility, DARK_SEL, type DesignSystem, DesignSystemSchema, type ExpandedHue, type Format, type FunctionalRole, type GenerateOptions, type GenerateResult, REQUIRED_ROLES, ROLE_TOKEN_SUFFIXES, SCHEMA_URL, SITE_SCHEMA_URL, type SiteConfig, SiteConfigSchema, type SiteValidationResult, TW_CLASH, type ValidationResult, deepMerge, defaultConfig, expandPalette, functionalRole, generate, generateDocs, jsonSchema, resolveSiteConfig, resolveTheme, roleColorUtilities, siteJsonSchema, stripNulls, validate, validateSite };
|
|
1403
1492
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/schema.ts","../src/generate.ts","../src/docs.ts","../src/shared.ts","../src/site.ts","../src/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/schema.ts","../src/tokens.ts","../src/generate.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