brand-intent 0.11.0 → 0.12.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/package.json +1 -1
- package/parser/brandParser.ts +7 -2
- package/parser/types.ts +1 -1
package/package.json
CHANGED
package/parser/brandParser.ts
CHANGED
|
@@ -202,7 +202,7 @@ export interface ParsedDividerDef {
|
|
|
202
202
|
const GROUP_KEYWORDS = new Set<string>(['primary', 'secondary', 'accent', 'neutral']);
|
|
203
203
|
const NEUTRAL_ROLES = new Set<NeutralRole>(['light', 'subtle', 'mid', 'muted', 'dark']);
|
|
204
204
|
const STATE_KEYS = new Set<string>(['problem', 'warning', 'success', 'info', 'inactive']);
|
|
205
|
-
const VALID_COLOR_MODES = new Set<ColorMode>(['static', 'dynamic', 'guided']);
|
|
205
|
+
const VALID_COLOR_MODES = new Set<ColorMode>(['static', 'dynamic', 'guided', 'brand']);
|
|
206
206
|
const VALID_STRATEGIES = new Set<PaletteStrategy>(['monochrome', 'duotone', 'tricolor', 'spectrum']);
|
|
207
207
|
const VALID_ADHERENCES = new Set<Adherence>(['strict', 'on-brand', 'flexible']);
|
|
208
208
|
const TONE_CLASSES = new Set<ToneClass>(['light', 'mid', 'dark']);
|
|
@@ -847,7 +847,7 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
|
|
|
847
847
|
break;
|
|
848
848
|
case 'color-mode':
|
|
849
849
|
if (!VALID_COLOR_MODES.has(value as ColorMode)) {
|
|
850
|
-
throw new Error(`${fileName}:${lineNum}: color-mode must be "static", "dynamic", or "
|
|
850
|
+
throw new Error(`${fileName}:${lineNum}: color-mode must be "static", "dynamic", "guided", or "brand", got "${value}"`);
|
|
851
851
|
}
|
|
852
852
|
result.colorMode = value as ColorMode;
|
|
853
853
|
break;
|
|
@@ -1198,6 +1198,11 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
|
|
1201
|
+
// color-mode: brand starts pages from a declared theme, so it needs at least one.
|
|
1202
|
+
if (result.colorMode === 'brand' && Object.keys(themes).length === 0) {
|
|
1203
|
+
throw new Error(`${fileName}: color-mode: brand requires at least one theme (a theme block or a valid color-families pair)`);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1201
1206
|
if (Object.keys(themes).length > 0) {
|
|
1202
1207
|
result.themes = themes;
|
|
1203
1208
|
result.themeDescriptions = themeDescriptions;
|
package/parser/types.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
|
19
19
|
// ── Guided colors (v0.8.0) ────────────────────────────────────────────────────
|
|
20
20
|
|
|
21
21
|
/** Color resolution mode declared at the brand level. */
|
|
22
|
-
export type ColorMode = 'static' | 'dynamic' | 'guided';
|
|
22
|
+
export type ColorMode = 'static' | 'dynamic' | 'guided' | 'brand';
|
|
23
23
|
|
|
24
24
|
/** Palette construction strategy for guided shuffle (Path A only). */
|
|
25
25
|
export type PaletteStrategy = 'monochrome' | 'duotone' | 'tricolor' | 'spectrum';
|