brand-intent 0.27.0 → 0.29.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,6 +1,6 @@
1
1
  {
2
2
  "name": "brand-intent",
3
- "version": "0.27.0",
3
+ "version": "0.29.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",
@@ -36,7 +36,7 @@
36
36
  "scripts": {
37
37
  "release": "./scripts/release.sh",
38
38
  "typecheck": "tsc -p .",
39
- "test": "tsx tests/brandParser.test.ts && tsx tests/identityParser.test.ts && tsx tests/colorSystem.test.ts && tsx tests/icons.test.ts && tsx tests/purposeParser.test.ts && tsx tests/storyParser.test.ts && tsx tests/realBrands.test.ts"
39
+ "test": "tsx tests/brandParser.test.ts && tsx tests/identityParser.test.ts && tsx tests/colorSystem.test.ts && tsx tests/icons.test.ts && tsx tests/purposeParser.test.ts && tsx tests/storyParser.test.ts && tsx tests/formatParser.test.ts && tsx tests/realBrands.test.ts"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^26.6.5",
@@ -19,7 +19,7 @@ export interface ParsedFormat {
19
19
  name?: string;
20
20
  label: string;
21
21
  sublabel: string;
22
- category: 'instagram' | 'linkedin' | 'print' | 'signage';
22
+ category: 'instagram' | 'facebook' | 'linkedin' | 'print' | 'signage';
23
23
  // Pixel dimensions (always present — computed from mm+dpi for print/signage)
24
24
  widthPx: number;
25
25
  heightPx: number;
@@ -141,8 +141,8 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
141
141
  break;
142
142
 
143
143
  case 'category':
144
- if (value !== 'instagram' && value !== 'linkedin' && value !== 'print' && value !== 'signage')
145
- throw new Error(`${fileName}:${lineNum}: category must be instagram, linkedin, print, or signage, got "${value}"`);
144
+ if (value !== 'instagram' && value !== 'facebook' && value !== 'linkedin' && value !== 'print' && value !== 'signage')
145
+ throw new Error(`${fileName}:${lineNum}: category must be instagram, facebook, linkedin, print, or signage, got "${value}"`);
146
146
  category = value;
147
147
  break;
148
148
 
@@ -40,6 +40,8 @@ export interface ParsedStoryPage {
40
40
  composition?: string;
41
41
  /** Illustration ids; implementations pick one per story date, the same one every time for that date. */
42
42
  illustrations?: string[];
43
+ /** Photo id; overrides the purpose's `photo:` default for this page. */
44
+ photo?: string;
43
45
  /** Page topic: what this page adds to the story. */
44
46
  topic?: string;
45
47
  /** Fixed slot texts, may contain `{variable}`s. A slot the page doesn't name is open. */
@@ -192,10 +194,11 @@ export function parseStoryFile(content: string, fileName: string): ParsedStory {
192
194
  // Page lines (2-space)
193
195
  if (currentPage) {
194
196
  if (indent !== 2) throw new Error(`${fileName}:${lineNum}: unexpected indent in page (page keys use 2 spaces)`);
195
- const read = readKey(line, lineNum, currentPage, ['purpose', 'composition', 'illustration'], true);
197
+ const read = readKey(line, lineNum, currentPage, ['purpose', 'composition', 'illustration', 'photo'], true);
196
198
  if (read && 'multi' in read) { multiKey = read.multi; multiIndent = 4; }
197
199
  else if (read?.key === 'purpose') currentPage.purpose = read.value;
198
200
  else if (read?.key === 'illustration') currentPage.illustrations = read.value.split(',').map(id => id.trim()).filter(Boolean);
201
+ else if (read?.key === 'photo') currentPage.photo = read.value;
199
202
  else if (read) currentPage.composition = read.value;
200
203
  continue;
201
204
  }
@@ -281,7 +284,7 @@ export function parseStoryFile(content: string, fileName: string): ParsedStory {
281
284
  * empty when the story fits. Variables count at their longest form for `maxLength`. */
282
285
  export function checkStory(
283
286
  story: ParsedStory,
284
- brand: { purposes: ParsedPurpose[]; compositions: string[]; formats: string[]; illustrations?: string[] },
287
+ brand: { purposes: ParsedPurpose[]; compositions: string[]; formats: string[]; illustrations?: string[]; photos?: string[] },
285
288
  fileName: string,
286
289
  ): string[] {
287
290
  const problems: string[] = [];
@@ -314,6 +317,7 @@ export function checkStory(
314
317
  for (const id of page.illustrations ?? []) {
315
318
  if (brand.illustrations && !brand.illustrations.includes(id)) say(`${where}: illustration "${id}" does not exist`);
316
319
  }
320
+ if (page.photo && brand.photos && !brand.photos.includes(page.photo)) say(`${where}: photo "${page.photo}" does not exist`);
317
321
  checkTexts(where, purpose, page.texts);
318
322
  });
319
323
  story.examples.forEach((ex, i) => {
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "category": {
37
- "match": "^(category:)\\s+(instagram|linkedin|print|signage)",
37
+ "match": "^(category:)\\s+(instagram|facebook|linkedin|print|signage)",
38
38
  "captures": {
39
39
  "1": { "name": "keyword.control.brand-intent-format" },
40
40
  "2": { "name": "entity.name.tag.brand-intent-format" }
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  "reference": {
40
- "match": "^\\s+(purpose|composition|illustration)(:)\\s+([\\w:, -]+)",
40
+ "match": "^\\s+(purpose|composition|illustration|photo)(:)\\s+([\\w:, -]+)",
41
41
  "captures": {
42
42
  "1": { "name": "support.type.property-name.brand-intent-story" },
43
43
  "2": { "name": "punctuation.separator.brand-intent-story" },
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  {
69
- "match": "^\\s+(purpose|composition|illustration|topic|primary|secondary|detail|meta|cta|label)(?=:|\\s|$)",
69
+ "match": "^\\s+(purpose|composition|illustration|photo|topic|primary|secondary|detail|meta|cta|label)(?=:|\\s|$)",
70
70
  "captures": {
71
71
  "1": { "name": "support.type.property-name.brand-intent-story" }
72
72
  }