@neatico/visual-core 0.14.3 → 0.14.64

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.
Files changed (68) hide show
  1. package/dist/candidateRanking.d.ts +31 -0
  2. package/dist/candidateRanking.js +55 -0
  3. package/dist/cjs/candidateRanking.js +61 -0
  4. package/dist/cjs/composition.js +62 -36
  5. package/dist/cjs/compositionNumbers.js +111 -0
  6. package/dist/cjs/compositionScenes.js +91 -38
  7. package/dist/cjs/compositionUseCases.js +145 -0
  8. package/dist/cjs/content.js +574 -120
  9. package/dist/cjs/contentBrief.js +82 -0
  10. package/dist/cjs/designBlueprint.js +94 -19
  11. package/dist/cjs/designSystem.js +536 -77
  12. package/dist/cjs/editorial.js +76 -20
  13. package/dist/cjs/fontCatalog.js +81 -23
  14. package/dist/cjs/formalCompositions.js +120 -0
  15. package/dist/cjs/index.js +13 -0
  16. package/dist/cjs/layoutContracts.js +57 -11
  17. package/dist/cjs/layouts.js +5 -92
  18. package/dist/cjs/nativeSocialParameters.js +145 -0
  19. package/dist/cjs/pagination.js +27 -7
  20. package/dist/cjs/parameterDefaults.js +20 -0
  21. package/dist/cjs/recipeParameters.js +304 -0
  22. package/dist/cjs/socialLayouts.js +127 -387
  23. package/dist/cjs/styleManifest.js +107 -0
  24. package/dist/cjs/text.js +12 -2
  25. package/dist/cjs/textPresentation.js +68 -0
  26. package/dist/composition.d.ts +4 -4
  27. package/dist/composition.js +62 -36
  28. package/dist/compositionNumbers.d.ts +4 -0
  29. package/dist/compositionNumbers.js +108 -0
  30. package/dist/compositionScenes.d.ts +2 -2
  31. package/dist/compositionScenes.js +91 -38
  32. package/dist/compositionUseCases.d.ts +1 -0
  33. package/dist/compositionUseCases.js +142 -0
  34. package/dist/content.d.ts +65 -20
  35. package/dist/content.js +575 -121
  36. package/dist/contentBrief.d.ts +16 -0
  37. package/dist/contentBrief.js +78 -0
  38. package/dist/designBlueprint.d.ts +4 -4
  39. package/dist/designBlueprint.js +95 -20
  40. package/dist/designSystem.d.ts +11 -7
  41. package/dist/designSystem.js +537 -79
  42. package/dist/editorial.d.ts +1 -1
  43. package/dist/editorial.js +77 -21
  44. package/dist/fontCatalog.d.ts +1 -1
  45. package/dist/fontCatalog.js +81 -23
  46. package/dist/formalCompositions.d.ts +26 -0
  47. package/dist/formalCompositions.js +116 -0
  48. package/dist/index.d.ts +10 -0
  49. package/dist/index.js +10 -0
  50. package/dist/layoutContracts.d.ts +3 -3
  51. package/dist/layoutContracts.js +58 -12
  52. package/dist/layouts.d.ts +2 -2
  53. package/dist/layouts.js +5 -92
  54. package/dist/nativeSocialParameters.d.ts +38 -0
  55. package/dist/nativeSocialParameters.js +139 -0
  56. package/dist/pagination.js +27 -7
  57. package/dist/parameterDefaults.d.ts +2 -0
  58. package/dist/parameterDefaults.js +17 -0
  59. package/dist/recipeParameters.d.ts +34 -0
  60. package/dist/recipeParameters.js +300 -0
  61. package/dist/socialLayouts.d.ts +40 -232
  62. package/dist/socialLayouts.js +127 -387
  63. package/dist/styleManifest.d.ts +20 -0
  64. package/dist/styleManifest.js +103 -0
  65. package/dist/text.js +12 -2
  66. package/dist/textPresentation.d.ts +29 -0
  67. package/dist/textPresentation.js +64 -0
  68. package/package.json +1 -1
@@ -5,37 +5,93 @@ exports.needsEditorialPagination = needsEditorialPagination;
5
5
  exports.ensurePresentationBookends = ensurePresentationBookends;
6
6
  const content_js_1 = require("./content.js");
7
7
  /** Reading density, not just geometric fit. CJK occupies roughly twice Latin's width. */
8
- const readingUnits = (text) => Array.from(text).reduce((n, c) => n + (/\s/.test(c) ? 0.2 : /[\u2e80-\u9fff\uac00-\ud7af\u3040-\u30ff]/u.test(c) ? 1 : 0.52), 0);
8
+ const readingUnits = (text) => Array.from(text).reduce((n, c) => n +
9
+ (/\s/.test(c)
10
+ ? 0.2
11
+ : /[\u2e80-\u9fff\uac00-\ud7af\u3040-\u30ff]/u.test(c)
12
+ ? 1
13
+ : 0.52), 0);
9
14
  exports.readingUnits = readingUnits;
10
15
  function needsEditorialPagination(page) {
11
- if (page.scene === 'brand-collection')
16
+ if (page.scene === "brand-collection")
12
17
  return false;
13
- const entries = page.blocks.flatMap(b => b.kind === 'features' || b.kind === 'steps' ? b.entries : []);
14
- if (entries.length >= 3 && entries.some(e => (0, exports.readingUnits)(e.description) > 65))
18
+ const entries = page.blocks.flatMap((b) => b.kind === "features" || b.kind === "steps" ? b.entries : []);
19
+ if (entries.length >= 3 &&
20
+ entries.some((e) => (0, exports.readingUnits)(e.description) > 65))
15
21
  return true;
16
22
  const total = page.blocks.reduce((n, b) => n + (0, content_js_1.contentBlockText)(b).reduce((m, s) => m + (0, exports.readingUnits)(s), 0), 0);
17
- return total > 250 || page.blocks.some(b => b.kind === 'paragraph' ? (0, exports.readingUnits)(b.text) > 165 : (b.kind === 'features' || b.kind === 'steps') && (b.entries.some(e => (0, exports.readingUnits)(e.description) > 135) || (b.entries.length >= 3 && b.entries.some(e => (0, exports.readingUnits)(e.description) > 65))));
23
+ return (total > 250 ||
24
+ page.blocks.some((b) => b.kind === "paragraph"
25
+ ? (0, exports.readingUnits)(b.text) > 165
26
+ : (b.kind === "features" || b.kind === "steps") &&
27
+ (b.entries.some((e) => (0, exports.readingUnits)(e.description) > 135) ||
28
+ (b.entries.length >= 3 &&
29
+ b.entries.some((e) => (0, exports.readingUnits)(e.description) > 65)))));
18
30
  }
19
- const endings = { zh: '感谢聆听', en: 'Thank you', de: 'Vielen Dank', es: 'Gracias', fr: 'Merci', ja: 'ご清聴ありがとうございました', pt: 'Obrigado' };
31
+ const endings = {
32
+ zh: "感谢聆听",
33
+ en: "Thank you",
34
+ de: "Vielen Dank",
35
+ es: "Gracias",
36
+ fr: "Merci",
37
+ ja: "ご清聴ありがとうございました",
38
+ pt: "Obrigado",
39
+ };
20
40
  /** Structural bookends contain no invented customer claims or calls to action. */
21
41
  function ensurePresentationBookends(plan) {
22
- if (plan.kind !== 'presentation' || !plan.pages.length)
42
+ if (plan.kind !== "presentation" || !plan.pages.length)
23
43
  return plan;
24
- const text = [plan.title, ...plan.pages.map(p => p.title)].join(' ');
25
- const language = /[\u3040-\u30ff]/.test(text) ? 'ja' : /[\u3400-\u9fff]/.test(text) ? 'zh' : /\b(und|für|Einführung)\b/i.test(text) ? 'de' : /\b(pour|présentation|avec)\b/i.test(text) ? 'fr' : /\b(para|apresentação|com)\b/i.test(text) ? 'pt' : /\b(presentación|con|gracias)\b/i.test(text) ? 'es' : 'en';
26
- const pages = plan.pages.map(p => ({ ...p, blocks: [...p.blocks] }));
27
- const used = new Set(pages.flatMap(p => [p.id, ...p.blocks.map(b => b.id)]));
28
- const id = (prefix) => { let s = prefix, i = 0; while (used.has(s))
29
- s = `${prefix}-${++i}`; used.add(s); return s; };
30
- const bookend = (purpose) => ({ id: id(`deck-${purpose}`), title: purpose === 'cover' ? plan.title : endings[language], purpose, scene: purpose === 'cover' ? 'hero' : 'closing', evidence: pages[0].evidence, blocks: [{ id: id(`deck-${purpose}-caption`), kind: 'paragraph', text: plan.title, evidence: pages[0].evidence }] });
31
- if (pages[0].purpose !== 'cover')
32
- pages.unshift(bookend('cover'));
44
+ const text = [plan.title, ...plan.pages.map((p) => p.title)].join(" ");
45
+ const language = /[\u3040-\u30ff]/.test(text)
46
+ ? "ja"
47
+ : /[\u3400-\u9fff]/.test(text)
48
+ ? "zh"
49
+ : /\b(und|für|Einführung)\b/i.test(text)
50
+ ? "de"
51
+ : /\b(pour|présentation|avec)\b/i.test(text)
52
+ ? "fr"
53
+ : /\b(para|apresentação|com)\b/i.test(text)
54
+ ? "pt"
55
+ : /\b(presentación|con|gracias)\b/i.test(text)
56
+ ? "es"
57
+ : "en";
58
+ const pages = plan.pages.map((p) => ({ ...p, blocks: [...p.blocks] }));
59
+ const used = new Set(pages.flatMap((p) => [p.id, ...p.blocks.map((b) => b.id)]));
60
+ const id = (prefix) => {
61
+ let s = prefix, i = 0;
62
+ while (used.has(s))
63
+ s = `${prefix}-${++i}`;
64
+ used.add(s);
65
+ return s;
66
+ };
67
+ const bookend = (purpose) => ({
68
+ id: id(`deck-${purpose}`),
69
+ title: purpose === "cover" ? plan.title : endings[language],
70
+ purpose,
71
+ scene: purpose === "cover" ? "hero" : "closing",
72
+ evidence: pages[0].evidence,
73
+ blocks: [
74
+ {
75
+ id: id(`deck-${purpose}-caption`),
76
+ kind: "paragraph",
77
+ text: plan.title,
78
+ evidence: pages[0].evidence,
79
+ },
80
+ ],
81
+ });
82
+ if (pages[0].purpose !== "cover")
83
+ pages.unshift(bookend("cover"));
33
84
  const last = pages[pages.length - 1];
34
85
  // Evidence and long explanations remain content slides, never masquerade as a closing.
35
- if (last.purpose !== 'conclude' || last.scene === 'brand-collection' || last.blocks.some(b => b.kind !== 'paragraph') || last.blocks.reduce((n, b) => n + (0, content_js_1.contentBlockText)(b).join('').length, 0) > 120 || /行业认可|客户|customers|trusted by/i.test(last.title)) {
36
- if (last.purpose === 'conclude')
37
- last.purpose = 'evidence';
38
- pages.push(bookend('conclude'));
86
+ if (last.purpose !== "conclude" ||
87
+ last.scene === "brand-collection" ||
88
+ last.blocks.some((b) => b.kind !== "paragraph") ||
89
+ last.blocks.reduce((n, b) => n + (0, content_js_1.contentBlockText)(b).join("").length, 0) >
90
+ 120 ||
91
+ /行业认可|客户|customers|trusted by/i.test(last.title)) {
92
+ if (last.purpose === "conclude")
93
+ last.purpose = "evidence";
94
+ pages.push(bookend("conclude"));
39
95
  }
40
96
  return { ...plan, pages };
41
97
  }
@@ -4,39 +4,97 @@ exports.GOOGLE_FONT_CATALOG = void 0;
4
4
  exports.contentScript = contentScript;
5
5
  exports.recommendedFonts = recommendedFonts;
6
6
  exports.languageFont = languageFont;
7
- const entry = (family, category, scripts = ['latin'], weights = [400, 700]) => ({ family, category, scripts, weights });
7
+ const entry = (family, category, scripts = ["latin"], weights = [400, 700]) => ({ family, category, scripts, weights });
8
8
  /** Curated Google Fonts families; request only their declared, supported weights. */
9
9
  exports.GOOGLE_FONT_CATALOG = [
10
- ...['Inter', 'Roboto', 'Montserrat', 'Manrope', 'DM Sans', 'Lato', 'Open Sans', 'Source Sans 3', 'Work Sans', 'Nunito Sans', 'IBM Plex Sans'].map(f => entry(f, 'sans')),
11
- ...['Lora', 'Merriweather', 'Libre Baskerville', 'Source Serif 4', 'Playfair Display', 'PT Serif'].map(f => entry(f, 'serif')),
12
- ...['Space Grotesk', 'Oswald', 'Bebas Neue'].map(f => entry(f, 'display', ['latin'], f === 'Bebas Neue' ? [400] : [400, 700])),
13
- ...['JetBrains Mono', 'IBM Plex Mono', 'Fira Code', 'Source Code Pro'].map(f => entry(f, 'mono')),
14
- entry('Noto Sans SC', 'sans', ['zh']), entry('Noto Serif SC', 'serif', ['zh']), entry('ZCOOL XiaoWei', 'display', ['zh'], [400]), entry('Ma Shan Zheng', 'display', ['zh'], [400]),
15
- entry('Noto Sans TC', 'sans', ['zh-Hant']), entry('Noto Serif TC', 'serif', ['zh-Hant']),
16
- entry('Noto Sans JP', 'sans', ['ja']), entry('Noto Serif JP', 'serif', ['ja']), entry('M PLUS Rounded 1c', 'sans', ['ja']),
17
- entry('Noto Sans KR', 'sans', ['ko']), entry('Noto Serif KR', 'serif', ['ko']),
18
- entry('Noto Sans Arabic', 'sans', ['ar']), entry('Noto Sans Devanagari', 'sans', ['hi']),
10
+ ...[
11
+ "Inter",
12
+ "Roboto",
13
+ "Montserrat",
14
+ "Manrope",
15
+ "DM Sans",
16
+ "Lato",
17
+ "Open Sans",
18
+ "Source Sans 3",
19
+ "Work Sans",
20
+ "Nunito Sans",
21
+ "IBM Plex Sans",
22
+ ].map((f) => entry(f, "sans")),
23
+ ...[
24
+ "Lora",
25
+ "Merriweather",
26
+ "Libre Baskerville",
27
+ "Source Serif 4",
28
+ "Playfair Display",
29
+ "PT Serif",
30
+ ].map((f) => entry(f, "serif")),
31
+ entry("Instrument Serif", "serif", ["latin"], [400]),
32
+ ...["Space Grotesk", "Oswald", "Bebas Neue"].map((f) => entry(f, "display", ["latin"], f === "Bebas Neue" ? [400] : [400, 700])),
33
+ ...["JetBrains Mono", "IBM Plex Mono", "Fira Code", "Source Code Pro"].map((f) => entry(f, "mono")),
34
+ entry("Noto Sans SC", "sans", ["zh"]),
35
+ entry("Noto Serif SC", "serif", ["zh"]),
36
+ entry("ZCOOL XiaoWei", "display", ["zh"], [400]),
37
+ entry("Ma Shan Zheng", "display", ["zh"], [400]),
38
+ entry("Noto Sans TC", "sans", ["zh-Hant"]),
39
+ entry("Noto Serif TC", "serif", ["zh-Hant"]),
40
+ entry("Noto Sans JP", "sans", ["ja"]),
41
+ entry("Noto Serif JP", "serif", ["ja"]),
42
+ entry("M PLUS Rounded 1c", "sans", ["ja"]),
43
+ entry("Noto Sans KR", "sans", ["ko"]),
44
+ entry("Noto Serif KR", "serif", ["ko"]),
45
+ entry("Noto Sans Arabic", "sans", ["ar"]),
46
+ entry("Noto Sans Devanagari", "sans", ["hi"]),
47
+ entry("Noto Serif Devanagari", "serif", ["hi"]),
48
+ entry("Noto Sans Thai", "sans", ["th"]),
49
+ entry("Noto Serif Thai", "serif", ["th"]),
19
50
  ];
20
- function contentScript(text, locale = 'en') {
51
+ function contentScript(text, locale = "en") {
21
52
  if (/[\u3040-\u30ff]/u.test(text))
22
- return 'ja';
53
+ return "ja";
23
54
  if (/[\uac00-\ud7af]/u.test(text))
24
- return 'ko';
55
+ return "ko";
25
56
  if (/[\u0600-\u06ff]/u.test(text))
26
- return 'ar';
57
+ return "ar";
27
58
  if (/[\u0900-\u097f]/u.test(text))
28
- return 'hi';
59
+ return "hi";
60
+ if (/[\u0e00-\u0e7f]/u.test(text))
61
+ return "th";
29
62
  if (/[\u3400-\u9fff]/u.test(text))
30
- return /TW|HK|Hant/i.test(locale) ? 'zh-Hant' : 'zh';
63
+ return /^ja/i.test(locale)
64
+ ? "ja"
65
+ : /^ko/i.test(locale)
66
+ ? "ko"
67
+ : /TW|HK|Hant/i.test(locale)
68
+ ? "zh-Hant"
69
+ : "zh";
31
70
  if (/^zh/i.test(locale))
32
- return /TW|HK|Hant/i.test(locale) ? 'zh-Hant' : 'zh';
33
- return /^(ja|ko|ar|hi)/.exec(locale)?.[1] || 'latin';
71
+ return /TW|HK|Hant/i.test(locale) ? "zh-Hant" : "zh";
72
+ return /^(ja|ko|ar|hi|th)/.exec(locale)?.[1] || "latin";
34
73
  }
35
- function recommendedFonts(locale, text = '') { const script = contentScript(text, locale); return [...exports.GOOGLE_FONT_CATALOG].sort((a, b) => Number(b.scripts.includes(script)) - Number(a.scripts.includes(script))); }
36
- function languageFont(text, preferred, locale = 'en') {
74
+ function recommendedFonts(locale, text = "") {
37
75
  const script = contentScript(text, locale);
38
- if (script === 'latin')
76
+ return [...exports.GOOGLE_FONT_CATALOG].sort((a, b) => Number(b.scripts.includes(script)) - Number(a.scripts.includes(script)));
77
+ }
78
+ function languageFont(text, preferred, locale = "en") {
79
+ const script = contentScript(text, locale);
80
+ if (script === "latin")
81
+ return preferred;
82
+ const selected = exports.GOOGLE_FONT_CATALOG.find((font) => font.family === preferred);
83
+ if (selected?.scripts.includes(script))
84
+ return preferred;
85
+ if (!selected &&
86
+ ![
87
+ "Arial",
88
+ "Helvetica",
89
+ "Georgia",
90
+ "Times New Roman",
91
+ "Courier New",
92
+ "sans-serif",
93
+ "serif",
94
+ "monospace",
95
+ ].includes(preferred))
39
96
  return preferred;
40
- const serif = /serif|Georgia|Lora|Baskerville|Merriweather|Playfair/i.test(preferred) && !/sans/i.test(preferred);
41
- return exports.GOOGLE_FONT_CATALOG.find(f => f.scripts.includes(script) && f.category === (serif ? 'serif' : 'sans'))?.family || preferred;
97
+ const serif = /serif|Georgia|Lora|Baskerville|Merriweather|Playfair/i.test(preferred) &&
98
+ !/sans/i.test(preferred);
99
+ return (exports.GOOGLE_FONT_CATALOG.find((f) => f.scripts.includes(script) && f.category === (serif ? "serif" : "sans"))?.family || preferred);
42
100
  }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FORMAL_COMPOSITIONS = exports.FORMAL_REFERENCE_COMPOSITIONS = void 0;
4
+ exports.applicableCompositions = applicableCompositions;
5
+ const compositionUseCases_js_1 = require("./compositionUseCases.js");
6
+ const nativeSocialParameters_js_1 = require("./nativeSocialParameters.js");
7
+ const designSystem_js_1 = require("./designSystem.js");
8
+ const socialLayouts_js_1 = require("./socialLayouts.js");
9
+ const recipeParameters_js_1 = require("./recipeParameters.js");
10
+ const compositionNumbers_js_1 = require("./compositionNumbers.js");
11
+ const both = ['presentation', 'social'];
12
+ const semantic = (id, accepts, minEntries = 0, maxEntries = 12, requiresImage = false) => ({ id, renderer: 'semantic', kind: 'social', family: id, accepts, minEntries, maxEntries, requiresImage });
13
+ function define(recipe, kinds, id, displayNumber, min = .25, max = 4) {
14
+ return { ...(0, recipeParameters_js_1.recipeParameterContract)(recipe, kinds), semanticDescription: (0, compositionUseCases_js_1.compositionUseCase)(recipe.id), id, displayNumber, aspectRatios: { min, max }, recipe };
15
+ }
16
+ /** Structural reference contracts shared with the product's existing renderers.
17
+ * Colorways and historical aliases remain outside active discovery.
18
+ */
19
+ exports.FORMAL_REFERENCE_COMPOSITIONS = [
20
+ { id: 'authored-reference-photo', reference: 1, layout: 'authored-photo-editorial', accepts: ['image', 'paragraph'] },
21
+ { id: 'authored-reference-manifesto', reference: 2, layout: 'authored-type-manifesto', accepts: ['paragraph'] },
22
+ { id: 'authored-reference-journey', reference: 3, layout: 'authored-editorial-flow', accepts: ['steps'] },
23
+ { id: 'authored-reference-vision', reference: 4, layout: 'authored-editorial-features', accepts: ['features'] },
24
+ { id: 'authored-reference-matrix', reference: 5, layout: 'authored-editorial-matrix', accepts: ['comparison', 'paragraph'] },
25
+ { id: 'authored-reference-diagonal', reference: 6, layout: 'authored-diagonal-cover', accepts: ['paragraph'] },
26
+ { id: 'authored-reference-list', reference: 8, layout: 'authored-editorial-index', accepts: ['features'] },
27
+ { id: 'authored-reference-story', reference: 11, layout: 'authored-visual-poster', accepts: ['image', 'paragraph', 'features'] },
28
+ { id: 'authored-reference-sustainable', reference: 13, layout: 'authored-editorial-metrics', accepts: ['parameters'] },
29
+ { id: 'authored-reference-code', reference: 14, layout: 'authored-code-panel', accepts: ['code'] },
30
+ { id: 'authored-reference-bars', reference: 18, layout: 'authored-editorial-bars', accepts: ['chart'] },
31
+ { id: 'authored-reference-share', reference: 19, layout: 'authored-editorial-donut', accepts: ['chart'] },
32
+ { id: 'authored-reference-opinion', reference: 20, layout: 'authored-editorial-quote', accepts: ['quote'] },
33
+ { id: 'authored-reference-comparison', reference: 22, layout: 'authored-editorial-comparison', accepts: ['comparison'] },
34
+ { id: 'authored-reference-faq', reference: 23, layout: 'authored-editorial-faq', accepts: ['features'] },
35
+ { id: 'authored-reference-trend', reference: 25, layout: 'authored-editorial-trend', accepts: ['chart'] },
36
+ ];
37
+ const semanticRecipes = designSystem_js_1.DESIGN_RECIPES.filter(recipe => recipe.renderer === 'semantic');
38
+ const uniqueSemantic = semanticRecipes.filter((recipe, index) => semanticRecipes.findIndex(other => other.id === recipe.id) === index);
39
+ const campaignDefinitions = [
40
+ ['ledger-chart', ['parameters', 'chart'], 2, 6, false, true],
41
+ ['detail-sidebar', ['paragraph', 'parameters'], 1, 3, false, true],
42
+ ['technical-log', ['code', 'paragraph'], 0, 12, false, false],
43
+ ['architecture-stack', ['steps', 'paragraph'], 2, 4, false, false],
44
+ ['speaker-spotlight', ['quote', 'parameters'], 1, 6, true, false],
45
+ ['speaker-lineup', ['quote', 'parameters'], 1, 6, true, false],
46
+ ];
47
+ const founderDefinitions = [
48
+ ['authored-mechanism-flow', ['features', 'steps', 'paragraph'], 2, 4],
49
+ ['authored-reference-capability-map', ['features', 'paragraph'], 2, 4],
50
+ ['authored-founder-timeline', ['steps', 'paragraph'], 2, 4],
51
+ ['authored-founder-comparison', ['comparison', 'paragraph'], 2, 2],
52
+ ];
53
+ const articleKinds = ['features', 'process', 'comparison', 'summary', 'checklist', 'faq', 'chart'];
54
+ const articleAccepts = { features: ['features', 'paragraph'], process: ['steps', 'paragraph'], comparison: ['comparison', 'paragraph'], summary: ['paragraph', 'features'], checklist: ['features', 'paragraph'], faq: ['features', 'paragraph'], chart: ['chart', 'paragraph'] };
55
+ function article(id, kind, variant) {
56
+ const cover = kind === 'cover';
57
+ const recipe = semantic(id, cover ? ['paragraph', 'features', 'image'] : articleAccepts[kind], 0, kind === 'chart' ? 12 : 3);
58
+ const number = cover ? variant + 1 : kind === 'features' && variant >= 3 ? 22 + variant : kind === 'process' && variant === 3 ? 33 : 4 + articleKinds.indexOf(kind) * 3 + variant;
59
+ const definition = define(recipe, [cover ? 'article-cover' : 'article-illustration'], id, `A${String(number).padStart(3, '0')}`, .5, 2.4);
60
+ // A cover is a headline, a short deck and its authored hero. It is not a
61
+ // miniature article: the original source remains in the candidate pool.
62
+ const coverSchema = { type: 'object', additionalProperties: false, required: ['title', 'blocks'], properties: {
63
+ title: { type: 'string', minLength: 1, maxLength: 72, description: 'A concise editorial headline, preferably four to eight words.' },
64
+ blocks: { type: 'array', minItems: 1, maxItems: 1, items: { type: 'object', additionalProperties: false, required: ['id', 'kind', 'text', 'evidence'], properties: {
65
+ id: { type: 'string', minLength: 1, maxLength: 80 }, kind: { const: 'paragraph' }, text: { type: 'string', minLength: 1, maxLength: 140, description: 'One concise supporting sentence. Summarize the topic; do not repeat the full article or enumerate every feature.' },
66
+ evidence: { type: 'array', minItems: 1, maxItems: 32, items: { type: 'object', additionalProperties: false, required: ['sourceId'], properties: { sourceId: { type: 'string', maxLength: 160 }, quote: { type: 'string', maxLength: 2000 } } } },
67
+ } } },
68
+ } };
69
+ // The optional hero preserves compatibility with saved paragraph-only pools.
70
+ // New requests can reference a real asset; missing assets retain native artwork.
71
+ const coverWithHero = { ...coverSchema, properties: { ...coverSchema.properties, blocks: { ...coverSchema.properties.blocks, maxItems: 2,
72
+ description: 'One supporting paragraph and, when imagery helps explain the topic, one image hero. Use an available asset ID or a missing image request; never invent a photo URL.',
73
+ items: [coverSchema.properties.blocks.items, { type: 'object', additionalProperties: false, required: ['id', 'kind', 'sourceId', 'alt', 'treatment', 'status', 'evidence'], properties: {
74
+ id: { type: 'string', minLength: 1, maxLength: 80 }, kind: { const: 'image' }, sourceId: { type: 'string', maxLength: 160 },
75
+ alt: { type: 'string', minLength: 1, maxLength: 300, description: 'A concise description of the image subject, grounded in the article topic.' },
76
+ treatment: { enum: ['photograph', 'diagram', 'screenshot'] }, status: { enum: ['available', 'missing'] }, assetId: { type: 'string', maxLength: 200 },
77
+ evidence: coverSchema.properties.blocks.items.properties.evidence,
78
+ } }],
79
+ } } };
80
+ const illustrationSchema = JSON.parse(JSON.stringify(definition.parameterSchema));
81
+ if (!cover) {
82
+ const primaryKind = kind === 'summary' ? 'features' : articleAccepts[kind][0];
83
+ const blocks = illustrationSchema.properties.blocks;
84
+ const primary = blocks.items.find((block) => block.properties.kind.const === primaryKind);
85
+ blocks.items = [primary];
86
+ blocks.minItems = 1;
87
+ blocks.maxItems = 1;
88
+ if (kind === 'faq')
89
+ primary.properties.entries.items.properties.title.pattern = '^.+[??]$';
90
+ }
91
+ const coverDirections = ['An editorial document sculpture with layered planes and a strong headline.', 'A connected constellation with a single focal object and an editorial headline.', 'An architectural archive silhouette balanced against expressive editorial typography.'];
92
+ return { ...definition, ...(cover ? { parameterSchema: coverWithHero, capacity: { minEntries: 0, maxEntries: 0, requiresImage: false }, semanticDescription: coverDirections[variant] } : { parameterSchema: illustrationSchema }), recipe: undefined, rendererKey: `article-${kind}:${variant}`,
93
+ semanticDescription: (0, compositionUseCases_js_1.compositionUseCase)(id) + (cover ? ' ' + coverDirections[variant] : '') };
94
+ }
95
+ /** Matches /dev/compositions/all: 161 default previews plus two landscape-only
96
+ * reference entries. Output capabilities overlap and must never be summed.
97
+ */
98
+ exports.FORMAL_COMPOSITIONS = [
99
+ ...campaignDefinitions.map(([id, accepts, min, max, image, landscape], index) => define(semantic(`authored-reference-${id}`, accepts, min, max, image), landscape ? ['presentation'] : both, `new-reference:${id}`, `N${index + 1}`, landscape ? 1.4 : .25)),
100
+ define(semantic('authored-event-poster', ['parameters', 'paragraph'], 1, 6), ['social'], 'event:provider', 'E1'),
101
+ define(semantic('authored-image-triptych', ['paragraph', 'features', 'image'], 3, 3, true), ['social'], 'campaign:triptych', 'C1', .5, 2),
102
+ ...exports.FORMAL_REFERENCE_COMPOSITIONS.map(spec => define(semantic(spec.id, spec.accepts, 0, 12, spec.accepts.includes('image')), both, `reference:${spec.id}`, `R${String(spec.reference).padStart(2, '0')}`)),
103
+ ...socialLayouts_js_1.SOCIAL_LAYOUT_CATALOG.map(preset => {
104
+ const recipe = designSystem_js_1.DESIGN_RECIPES.find(item => item.id === preset.id && item.kind === 'social');
105
+ return { ...define({ ...recipe, renderer: 'catalog' }, ['social'], `social:${preset.id}`, compositionNumbers_js_1.SOCIAL_DISPLAY_NUMBERS[preset.id], .5, 2.4), ...(0, nativeSocialParameters_js_1.nativeSocialParameterContract)(preset.id) };
106
+ }),
107
+ ...uniqueSemantic.map(recipe => define(recipe, semanticRecipes.filter(other => other.id === recipe.id).map(other => other.kind), `semantic:${recipe.kind}:${recipe.id}`, compositionNumbers_js_1.SEMANTIC_DISPLAY_NUMBERS[`semantic:${recipe.kind}:${recipe.id}`])),
108
+ ...founderDefinitions.map(([id, accepts, min, max], index) => define(semantic(id, accepts, min, max), ['social'], `semantic:social:${id}`, `F${index + 1}`, 1.3)),
109
+ ...[0, 1, 2].flatMap(variant => [article(`article-cover-${variant}`, 'cover', variant), ...articleKinds.map(kind => article(`article-${kind}-${variant}`, kind, variant))]),
110
+ ...[3, 4, 5, 6, 7, 8, 9, 10].map(variant => article(`article-features-${variant}`, 'features', variant)),
111
+ article('article-process-3', 'process', 3),
112
+ ];
113
+ /** Only output, ratio, and explicit IDs are hard gates; semantic fit is scored. */
114
+ function applicableCompositions(kind, ratio, id) {
115
+ if (!Number.isFinite(ratio) || ratio <= 0)
116
+ throw new Error('COMPOSITION_INVALID_RATIO');
117
+ if (id && !exports.FORMAL_COMPOSITIONS.some(item => item.id === id))
118
+ throw new Error('COMPOSITION_UNKNOWN_ID');
119
+ return exports.FORMAL_COMPOSITIONS.filter(item => item.supportedKinds.includes(kind) && ratio >= item.aspectRatios.min && ratio <= item.aspectRatios.max && (!id || item.id === id));
120
+ }
package/dist/cjs/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SOCIAL_DISPLAY_NUMBERS = exports.compositionParameterDefaults = void 0;
17
18
  __exportStar(require("./geometry.js"), exports);
18
19
  __exportStar(require("./text.js"), exports);
19
20
  __exportStar(require("./scenes.js"), exports);
@@ -29,3 +30,15 @@ __exportStar(require("./designBlueprint.js"), exports);
29
30
  __exportStar(require("./compositionScenes.js"), exports);
30
31
  __exportStar(require("./editorial.js"), exports);
31
32
  __exportStar(require("./fontCatalog.js"), exports);
33
+ __exportStar(require("./candidateRanking.js"), exports);
34
+ __exportStar(require("./styleManifest.js"), exports);
35
+ __exportStar(require("./recipeParameters.js"), exports);
36
+ __exportStar(require("./formalCompositions.js"), exports);
37
+ __exportStar(require("./contentBrief.js"), exports);
38
+ __exportStar(require("./nativeSocialParameters.js"), exports);
39
+ __exportStar(require("./compositionUseCases.js"), exports);
40
+ var parameterDefaults_js_1 = require("./parameterDefaults.js");
41
+ Object.defineProperty(exports, "compositionParameterDefaults", { enumerable: true, get: function () { return parameterDefaults_js_1.compositionParameterDefaults; } });
42
+ var compositionNumbers_js_1 = require("./compositionNumbers.js");
43
+ Object.defineProperty(exports, "SOCIAL_DISPLAY_NUMBERS", { enumerable: true, get: function () { return compositionNumbers_js_1.SOCIAL_DISPLAY_NUMBERS; } });
44
+ __exportStar(require("./textPresentation.js"), exports);
@@ -3,25 +3,71 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LAYOUT_CONTRACTS = void 0;
4
4
  exports.eligibleLayouts = eligibleLayouts;
5
5
  exports.layoutCandidates = layoutCandidates;
6
- const layouts_js_1 = require("./layouts.js");
7
6
  const socialLayouts_js_1 = require("./socialLayouts.js");
8
- const textOnly = new Set(['cover', 'section', 'statement', 'quote', 'closing', 'image-full', 'og-cover', 'gradient-cover', 'bold-diagonal-cover', 'split-cover', 'block-banner', 'video-cover', 'magazine-pull-quote']);
9
- const pair = new Set(['comparison', 'two-column', 'myth', 'problem-solution', 'before-after', 'split-bar-compare']);
7
+ const textOnly = new Set([
8
+ "cover",
9
+ "section",
10
+ "statement",
11
+ "quote",
12
+ "closing",
13
+ "image-full",
14
+ "og-cover",
15
+ "gradient-cover",
16
+ "bold-diagonal-cover",
17
+ "split-cover",
18
+ "block-banner",
19
+ "video-cover",
20
+ "magazine-pull-quote",
21
+ ]);
22
+ const pair = new Set([
23
+ "comparison",
24
+ "two-column",
25
+ "myth",
26
+ "problem-solution",
27
+ "before-after",
28
+ "split-bar-compare",
29
+ ]);
10
30
  /** Eligibility is a first filter, never a substitute for measured fit. */
11
31
  exports.LAYOUT_CONTRACTS = [
12
- ...layouts_js_1.PRESENTATION_LAYOUT_IDS.map(id => ({ id, kind: 'presentation', semantic: pair.has(id) ? 'comparison' : textOnly.has(id) ? 'editorial' : id, minItems: pair.has(id) ? 2 : 0, maxItems: textOnly.has(id) ? 0 : pair.has(id) ? 2 : 4, minRatio: 16 / 9, maxRatio: 16 / 9, required: ['title'] })),
13
- ...socialLayouts_js_1.SOCIAL_LAYOUT_CATALOG.map(({ id, scene }) => ({ id, kind: 'social', semantic: scene, minItems: pair.has(id) ? 2 : 0, maxItems: textOnly.has(id) ? 0 : pair.has(id) ? 2 : id === 'course-syllabus' ? 15 : 6, minRatio: .25, maxRatio: 4, required: ['headline', ...(['pricing', 'metric'].includes(scene) ? ['value'] : [])] })),
32
+ ...socialLayouts_js_1.SOCIAL_LAYOUT_CATALOG.map(({ id, scene }) => ({
33
+ id,
34
+ kind: "social",
35
+ semantic: scene,
36
+ minItems: pair.has(id) ? 2 : 0,
37
+ maxItems: textOnly.has(id) ? 0 : pair.has(id) ? 2 : 6,
38
+ minRatio: 0.25,
39
+ maxRatio: 4,
40
+ required: [
41
+ "headline",
42
+ ...(["pricing", "metric"].includes(scene) ? ["value"] : []),
43
+ ],
44
+ })),
14
45
  ];
15
46
  function eligibleLayouts(kind, content, ratio) {
16
47
  const count = Array.isArray(content.items) ? content.items.length : 0;
17
- return exports.LAYOUT_CONTRACTS.filter(layout => layout.kind === kind && ratio >= layout.minRatio - 1e-6 && ratio <= layout.maxRatio + 1e-6 && count >= layout.minItems && count <= layout.maxItems && layout.required.every(key => typeof content[key] === 'string' && String(content[key]).trim()));
48
+ return exports.LAYOUT_CONTRACTS.filter((layout) => layout.kind === kind &&
49
+ ratio >= layout.minRatio - 1e-6 &&
50
+ ratio <= layout.maxRatio + 1e-6 &&
51
+ count >= layout.minItems &&
52
+ count <= layout.maxItems &&
53
+ layout.required.every((key) => typeof content[key] === "string" && String(content[key]).trim()));
18
54
  }
19
55
  /** Requested intent, same semantic scene, then general-purpose structures. */
20
56
  function layoutCandidates(kind, requested, content, ratio, limit = 8) {
21
57
  const eligible = eligibleLayouts(kind, content, ratio);
22
- const selected = exports.LAYOUT_CONTRACTS.find(layout => layout.kind === kind && layout.id === requested);
23
- const fallback = kind === 'presentation' ? ['cards', 'two-column', 'bullets', 'table', 'agenda', 'statement'] : ['report', 'checklist', 'steps', 'bento', 'editorial', 'story'];
24
- const order = [requested, ...eligible.filter(layout => layout.semantic === (content.scene || selected?.semantic)).map(layout => layout.id), ...fallback];
25
- const allowed = new Set(eligible.map(layout => layout.id));
26
- return [...new Set(order)].filter(id => allowed.has(id)).slice(0, Math.max(1, Math.min(16, limit)));
58
+ const selected = exports.LAYOUT_CONTRACTS.find((layout) => layout.kind === kind && layout.id === requested);
59
+ const fallback = kind === "presentation"
60
+ ? ["cards", "two-column", "bullets", "table", "agenda", "statement"]
61
+ : ["report", "checklist", "steps", "bento", "editorial", "story"];
62
+ const order = [
63
+ requested,
64
+ ...eligible
65
+ .filter((layout) => layout.semantic === (content.scene || selected?.semantic))
66
+ .map((layout) => layout.id),
67
+ ...fallback,
68
+ ];
69
+ const allowed = new Set(eligible.map((layout) => layout.id));
70
+ return [...new Set(order)]
71
+ .filter((id) => allowed.has(id))
72
+ .slice(0, Math.max(1, Math.min(16, limit)));
27
73
  }
@@ -1,103 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PRESENTATION_LAYOUT_IDS = void 0;
4
- /** Shared stable IDs for authored presentation renderers. */
4
+ /** Content intents for structured presentations; not a separate renderer catalog. */
5
5
  exports.PRESENTATION_LAYOUT_IDS = [
6
6
  "cover",
7
- "agenda",
8
7
  "section",
9
8
  "statement",
10
- "bullets",
11
- "two-column",
12
- "comparison",
13
- "three-column",
14
- "process",
15
- "timeline",
16
- "metrics",
17
- "quote",
18
- "image-left",
19
- "image-right",
20
- "image-full",
21
- "closing",
22
9
  "cards",
23
- "checklist",
24
- "roadmap",
25
- "team",
26
- "pricing",
27
- "faq",
28
- "swot",
29
- "scorecard",
10
+ "process",
11
+ "comparison",
30
12
  "bar-chart",
31
- "funnel",
13
+ "quote",
32
14
  "table",
33
- "problem-solution",
34
- "case-study",
35
- "architecture",
36
- "risk",
37
- "action-plan",
38
- "usage-breakdown",
39
- "organization",
40
- "editorial-quote",
41
- "research-highlight",
42
- "product-showcase",
43
- "split-bar-compare",
44
- "benchmark-bars",
45
- "block-banner",
46
- "progress-roadmap",
47
- "fan-deck",
48
- "contents-index",
49
- "contents-chapters",
50
- "contents-grid",
51
- "definition-card",
52
- "topic-branches",
53
- "radial-mindmap",
54
- "tips-card",
55
- "code-snippet",
56
- "series-carousel",
57
- "reflection-card",
58
- "video-cover",
59
- "digest-card",
60
- "chat-preview",
61
- "recommendation-feed",
62
- "before-after",
63
- "course-syllabus",
64
- "concept-explainer",
65
- "persona-question",
66
- "nutrient-symptom-grid",
67
- "milestone-history",
68
- "release-notes",
69
- "product-listing",
70
- "flash-sale",
71
- "event-banner",
72
- "startup-journey",
73
- "vision-goals",
74
- "tips-grid",
75
- "experiment-report",
76
- "leaderboard",
77
- "win-journey",
78
- "device-price-promo",
79
- "mega-sale-typographic",
80
- "illustration-process",
81
- "glass-neon-sale",
82
- "free-trial-hero",
83
- "feature-chip-hero",
84
- "event-speaker-card",
85
- "corporate-hero",
86
- "release-version-hero",
87
- "og-cover",
88
- "gradient-cover",
89
- "bold-diagonal-cover",
90
- "split-cover",
91
- "article-feed-card",
92
- "article-summary-card",
93
- "paragraph-summary-card",
94
- "summary-card-stack",
95
- "article-repost-card",
96
- "article-core-digest",
97
- "product-thread-mockup",
98
- "agent-notification",
99
- "angled-ui-launch",
100
- "repo-card",
101
- "magazine-pull-quote",
102
- "question-answer-quote"
15
+ "closing",
103
16
  ];