brand-intent 0.10.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 CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "brand-intent",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "An open file format specification for making brand intent machine-readable.",
5
5
  "author": "Christophe Stoll <christophe@stoll.studio>",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/studiostoll/brand-intent.git"
9
+ "url": "git+https://github.com/studiostoll/brand-intent.git"
10
10
  },
11
11
  "homepage": "https://intent.stoll.studio",
12
12
  "bin": {
13
- "brand-intent": "./cli/index.mjs"
13
+ "brand-intent": "cli/index.mjs"
14
14
  },
15
15
  "exports": {
16
16
  ".": {
@@ -126,6 +126,8 @@ export interface ParsedAssetDef {
126
126
  /** Logos only: artwork per horizontal placement, declared via `align-left` / `align-center` / `align-right`
127
127
  * sub-blocks. Consumers render the variant matching where the logo sits, else the base `src`. */
128
128
  alignVariants?: Partial<Record<LogoAlign, { src: string; aspectRatio?: number }>>;
129
+ /** Library group (e.g. "experimental"). Consumers list each group as its own section after the ungrouped assets. */
130
+ group?: string;
129
131
  }
130
132
 
131
133
  export type LogoAlign = 'left' | 'center' | 'right';
@@ -200,7 +202,7 @@ export interface ParsedDividerDef {
200
202
  const GROUP_KEYWORDS = new Set<string>(['primary', 'secondary', 'accent', 'neutral']);
201
203
  const NEUTRAL_ROLES = new Set<NeutralRole>(['light', 'subtle', 'mid', 'muted', 'dark']);
202
204
  const STATE_KEYS = new Set<string>(['problem', 'warning', 'success', 'info', 'inactive']);
203
- const VALID_COLOR_MODES = new Set<ColorMode>(['static', 'dynamic', 'guided']);
205
+ const VALID_COLOR_MODES = new Set<ColorMode>(['static', 'dynamic', 'guided', 'brand']);
204
206
  const VALID_STRATEGIES = new Set<PaletteStrategy>(['monochrome', 'duotone', 'tricolor', 'spectrum']);
205
207
  const VALID_ADHERENCES = new Set<Adherence>(['strict', 'on-brand', 'flexible']);
206
208
  const TONE_CLASSES = new Set<ToneClass>(['light', 'mid', 'dark']);
@@ -845,7 +847,7 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
845
847
  break;
846
848
  case 'color-mode':
847
849
  if (!VALID_COLOR_MODES.has(value as ColorMode)) {
848
- throw new Error(`${fileName}:${lineNum}: color-mode must be "static", "dynamic", or "guided", got "${value}"`);
850
+ throw new Error(`${fileName}:${lineNum}: color-mode must be "static", "dynamic", "guided", or "brand", got "${value}"`);
849
851
  }
850
852
  result.colorMode = value as ColorMode;
851
853
  break;
@@ -1196,6 +1198,11 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
1196
1198
  }
1197
1199
  }
1198
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
+
1199
1206
  if (Object.keys(themes).length > 0) {
1200
1207
  result.themes = themes;
1201
1208
  result.themeDescriptions = themeDescriptions;
@@ -1292,6 +1299,7 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
1292
1299
  if (raw.props['loop'] === 'true') def.loop = true;
1293
1300
  if (raw.props['gltf']) def.gltfSrc = raw.props['gltf'];
1294
1301
  if (raw.props['generator']) def.generator = raw.props['generator'];
1302
+ if (raw.props['group']) def.group = raw.props['group'];
1295
1303
  // generator-params are stored as "generator-params.KEY" by the sub-block parser.
1296
1304
  const paramEntries: [string, number][] = [];
1297
1305
  for (const [k, v] of Object.entries(raw.props)) {
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';