brand-intent 0.29.0 → 0.31.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.
@@ -7,6 +7,7 @@ id: 4:5
7
7
  label: 4:5
8
8
  sublabel: Feed Portrait
9
9
  category: instagram
10
+ post: feed
10
11
 
11
12
  size: 1080 1350
12
13
  grid: 5 4 # 5 rows × 4 columns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brand-intent",
3
- "version": "0.29.0",
3
+ "version": "0.31.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",
@@ -20,6 +20,8 @@ export interface ParsedFormat {
20
20
  label: string;
21
21
  sublabel: string;
22
22
  category: 'instagram' | 'facebook' | 'linkedin' | 'print' | 'signage';
23
+ /** How the page is posted (from `post:`). Absent = the format is not posted. */
24
+ post?: 'feed' | 'story';
23
25
  // Pixel dimensions (always present — computed from mm+dpi for print/signage)
24
26
  widthPx: number;
25
27
  heightPx: number;
@@ -97,6 +99,7 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
97
99
  let label: string | undefined;
98
100
  let sublabel: string | undefined;
99
101
  let category: ParsedFormat['category'] | undefined;
102
+ let post: ParsedFormat['post'];
100
103
  let widthPx: number | undefined;
101
104
  let heightPx: number | undefined;
102
105
  let widthMm: number | undefined;
@@ -146,6 +149,12 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
146
149
  category = value;
147
150
  break;
148
151
 
152
+ case 'post':
153
+ if (value !== 'feed' && value !== 'story')
154
+ throw new Error(`${fileName}:${lineNum}: post must be feed or story, got "${value}"`);
155
+ post = value;
156
+ break;
157
+
149
158
  case 'size': {
150
159
  // "1080 1350" (px) or "594mm 297mm" (mm)
151
160
  const parts = value.split(/\s+/);
@@ -261,7 +270,7 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
261
270
  }
262
271
 
263
272
  return {
264
- id, name, label, sublabel, category,
273
+ id, name, label, sublabel, category, post,
265
274
  widthPx, heightPx,
266
275
  widthMm, heightMm,
267
276
  dpi: dpi ?? (category === 'print' || category === 'signage' ? effectiveDpi : undefined),
@@ -40,8 +40,9 @@ 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
+ /** Photo ids; override the purpose's `photo:` default for this page. Implementations pick one per
44
+ * story date, the same one every time for that date. */
45
+ photos?: string[];
45
46
  /** Page topic: what this page adds to the story. */
46
47
  topic?: string;
47
48
  /** Fixed slot texts, may contain `{variable}`s. A slot the page doesn't name is open. */
@@ -198,7 +199,7 @@ export function parseStoryFile(content: string, fileName: string): ParsedStory {
198
199
  if (read && 'multi' in read) { multiKey = read.multi; multiIndent = 4; }
199
200
  else if (read?.key === 'purpose') currentPage.purpose = read.value;
200
201
  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;
202
+ else if (read?.key === 'photo') currentPage.photos = read.value.split(',').map(id => id.trim()).filter(Boolean);
202
203
  else if (read) currentPage.composition = read.value;
203
204
  continue;
204
205
  }
@@ -317,7 +318,9 @@ export function checkStory(
317
318
  for (const id of page.illustrations ?? []) {
318
319
  if (brand.illustrations && !brand.illustrations.includes(id)) say(`${where}: illustration "${id}" does not exist`);
319
320
  }
320
- if (page.photo && brand.photos && !brand.photos.includes(page.photo)) say(`${where}: photo "${page.photo}" does not exist`);
321
+ for (const id of page.photos ?? []) {
322
+ if (brand.photos && !brand.photos.includes(id)) say(`${where}: photo "${id}" does not exist`);
323
+ }
321
324
  checkTexts(where, purpose, page.texts);
322
325
  });
323
326
  story.examples.forEach((ex, i) => {
@@ -6,6 +6,7 @@
6
6
  { "include": "#id-field" },
7
7
  { "include": "#name-field" },
8
8
  { "include": "#category" },
9
+ { "include": "#post" },
9
10
  { "include": "#purposes" },
10
11
  { "include": "#size" },
11
12
  { "include": "#grid" },
@@ -40,6 +41,13 @@
40
41
  "2": { "name": "entity.name.tag.brand-intent-format" }
41
42
  }
42
43
  },
44
+ "post": {
45
+ "match": "^(post:)\\s+(feed|story)",
46
+ "captures": {
47
+ "1": { "name": "keyword.control.brand-intent-format" },
48
+ "2": { "name": "entity.name.tag.brand-intent-format" }
49
+ }
50
+ },
43
51
  "purposes": {
44
52
  "match": "^(purposes:)\\s+(.*)",
45
53
  "captures": {
@@ -86,7 +94,7 @@
86
94
  },
87
95
  "keyword-partial": {
88
96
  "comment": "Fallback: color the keyword token on incomplete lines (while typing)",
89
- "match": "^(id:|name:|category:|purposes:|size:|grid:|dpi:|bleed:|comfort:|danger:|crop:|label:|sublabel:)(?=\\s|$)",
97
+ "match": "^(id:|name:|category:|post:|purposes:|size:|grid:|dpi:|bleed:|comfort:|danger:|crop:|label:|sublabel:)(?=\\s|$)",
90
98
  "captures": {
91
99
  "1": { "name": "keyword.control.brand-intent-format" }
92
100
  }