brand-intent 0.4.3 → 0.4.5
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/purposeParser.ts +14 -1
package/package.json
CHANGED
package/parser/purposeParser.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface ParsedPurpose {
|
|
|
39
39
|
defaultIcon?: string;
|
|
40
40
|
/** Default icon weight. */
|
|
41
41
|
defaultIconWeight?: string;
|
|
42
|
+
/** Optional prompt text shown in the empty background placeholder. Default: "Select a background". */
|
|
43
|
+
bgPrompt?: string;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export interface ParsedPurposeSlot {
|
|
@@ -61,6 +63,8 @@ export interface ParsedPurposeSlot {
|
|
|
61
63
|
itemGap?: number;
|
|
62
64
|
/** List layout direction: 'vertical' (default) or 'horizontal'. */
|
|
63
65
|
listDirection?: 'vertical' | 'horizontal';
|
|
66
|
+
/** When true, this slot is editable by the user in consume mode. Default: false. */
|
|
67
|
+
editable?: boolean;
|
|
64
68
|
typography: {
|
|
65
69
|
fontFamily: string;
|
|
66
70
|
fontWeight: number;
|
|
@@ -122,6 +126,7 @@ export function parsePurposeFile(content: string, fileName: string): ParsedPurpo
|
|
|
122
126
|
let camera: boolean | undefined;
|
|
123
127
|
let defaultIcon: string | undefined;
|
|
124
128
|
let defaultIconWeight: string | undefined;
|
|
129
|
+
let bgPrompt: string | undefined;
|
|
125
130
|
const slots: ParsedPurposeSlot[] = [];
|
|
126
131
|
// For backward compat: track first # line text for fallback id
|
|
127
132
|
let firstHashText = '';
|
|
@@ -293,6 +298,12 @@ export function parsePurposeFile(content: string, fileName: string): ParsedPurpo
|
|
|
293
298
|
continue;
|
|
294
299
|
}
|
|
295
300
|
|
|
301
|
+
// Background placeholder prompt: "bg-prompt: Mach dein Selfie"
|
|
302
|
+
if (line.startsWith('bg-prompt:')) {
|
|
303
|
+
bgPrompt = line.slice(10).trim().replace(/^["']|["']$/g, '');
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
|
|
296
307
|
// Default icon: "defaultIcon: warning-circle" or "defaultIcon: warning-circle duotone"
|
|
297
308
|
// Accepts kebab-case (natural for file format) and converts to PascalCase for Phosphor lookup.
|
|
298
309
|
if (line.startsWith('defaultIcon:')) {
|
|
@@ -517,6 +528,8 @@ export function parsePurposeFile(content: string, fileName: string): ParsedPurpo
|
|
|
517
528
|
currentSlot.colorRef = prop.slice(6).trim();
|
|
518
529
|
continue;
|
|
519
530
|
}
|
|
531
|
+
if (prop === 'editable' || prop === 'editable: true' || prop === 'editable:true') { currentSlot.editable = true; continue; }
|
|
532
|
+
if (prop === 'editable: false' || prop === 'editable:false') { currentSlot.editable = false; continue; }
|
|
520
533
|
if (prop.startsWith('font:')) {
|
|
521
534
|
// "Die Grotesk 800" → family="Die Grotesk", weight=800 (legacy direct path)
|
|
522
535
|
const value = prop.slice(5).trim();
|
|
@@ -592,5 +605,5 @@ export function parsePurposeFile(content: string, fileName: string): ParsedPurpo
|
|
|
592
605
|
context = contextLines.join('\n').trim();
|
|
593
606
|
}
|
|
594
607
|
|
|
595
|
-
return { id, name, description, preferredCompositions: compositions, slots, density, palette, scope, context, voice, defaultLogo, defaultPhoto, defaultVideo, camera, defaultIcon, defaultIconWeight };
|
|
608
|
+
return { id, name, description, preferredCompositions: compositions, slots, density, palette, scope, context, voice, defaultLogo, defaultPhoto, defaultVideo, camera, defaultIcon, defaultIconWeight, bgPrompt };
|
|
596
609
|
}
|