@neatico/visual-core 0.14.3 → 0.14.26

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/dist/editorial.js CHANGED
@@ -1,35 +1,91 @@
1
- import { contentBlockText } from './content.js';
1
+ import { contentBlockText, } from "./content.js";
2
2
  /** Reading density, not just geometric fit. CJK occupies roughly twice Latin's width. */
3
- export 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);
3
+ export const readingUnits = (text) => Array.from(text).reduce((n, c) => n +
4
+ (/\s/.test(c)
5
+ ? 0.2
6
+ : /[\u2e80-\u9fff\uac00-\ud7af\u3040-\u30ff]/u.test(c)
7
+ ? 1
8
+ : 0.52), 0);
4
9
  export function needsEditorialPagination(page) {
5
- if (page.scene === 'brand-collection')
10
+ if (page.scene === "brand-collection")
6
11
  return false;
7
- const entries = page.blocks.flatMap(b => b.kind === 'features' || b.kind === 'steps' ? b.entries : []);
8
- if (entries.length >= 3 && entries.some(e => readingUnits(e.description) > 65))
12
+ const entries = page.blocks.flatMap((b) => b.kind === "features" || b.kind === "steps" ? b.entries : []);
13
+ if (entries.length >= 3 &&
14
+ entries.some((e) => readingUnits(e.description) > 65))
9
15
  return true;
10
16
  const total = page.blocks.reduce((n, b) => n + contentBlockText(b).reduce((m, s) => m + readingUnits(s), 0), 0);
11
- return total > 250 || page.blocks.some(b => b.kind === 'paragraph' ? readingUnits(b.text) > 165 : (b.kind === 'features' || b.kind === 'steps') && (b.entries.some(e => readingUnits(e.description) > 135) || (b.entries.length >= 3 && b.entries.some(e => readingUnits(e.description) > 65))));
17
+ return (total > 250 ||
18
+ page.blocks.some((b) => b.kind === "paragraph"
19
+ ? readingUnits(b.text) > 165
20
+ : (b.kind === "features" || b.kind === "steps") &&
21
+ (b.entries.some((e) => readingUnits(e.description) > 135) ||
22
+ (b.entries.length >= 3 &&
23
+ b.entries.some((e) => readingUnits(e.description) > 65)))));
12
24
  }
13
- const endings = { zh: '感谢聆听', en: 'Thank you', de: 'Vielen Dank', es: 'Gracias', fr: 'Merci', ja: 'ご清聴ありがとうございました', pt: 'Obrigado' };
25
+ const endings = {
26
+ zh: "感谢聆听",
27
+ en: "Thank you",
28
+ de: "Vielen Dank",
29
+ es: "Gracias",
30
+ fr: "Merci",
31
+ ja: "ご清聴ありがとうございました",
32
+ pt: "Obrigado",
33
+ };
14
34
  /** Structural bookends contain no invented customer claims or calls to action. */
15
35
  export function ensurePresentationBookends(plan) {
16
- if (plan.kind !== 'presentation' || !plan.pages.length)
36
+ if (plan.kind !== "presentation" || !plan.pages.length)
17
37
  return plan;
18
- const text = [plan.title, ...plan.pages.map(p => p.title)].join(' ');
19
- 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';
20
- const pages = plan.pages.map(p => ({ ...p, blocks: [...p.blocks] }));
21
- const used = new Set(pages.flatMap(p => [p.id, ...p.blocks.map(b => b.id)]));
22
- const id = (prefix) => { let s = prefix, i = 0; while (used.has(s))
23
- s = `${prefix}-${++i}`; used.add(s); return s; };
24
- 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 }] });
25
- if (pages[0].purpose !== 'cover')
26
- pages.unshift(bookend('cover'));
38
+ const text = [plan.title, ...plan.pages.map((p) => p.title)].join(" ");
39
+ const language = /[\u3040-\u30ff]/.test(text)
40
+ ? "ja"
41
+ : /[\u3400-\u9fff]/.test(text)
42
+ ? "zh"
43
+ : /\b(und|für|Einführung)\b/i.test(text)
44
+ ? "de"
45
+ : /\b(pour|présentation|avec)\b/i.test(text)
46
+ ? "fr"
47
+ : /\b(para|apresentação|com)\b/i.test(text)
48
+ ? "pt"
49
+ : /\b(presentación|con|gracias)\b/i.test(text)
50
+ ? "es"
51
+ : "en";
52
+ const pages = plan.pages.map((p) => ({ ...p, blocks: [...p.blocks] }));
53
+ const used = new Set(pages.flatMap((p) => [p.id, ...p.blocks.map((b) => b.id)]));
54
+ const id = (prefix) => {
55
+ let s = prefix, i = 0;
56
+ while (used.has(s))
57
+ s = `${prefix}-${++i}`;
58
+ used.add(s);
59
+ return s;
60
+ };
61
+ const bookend = (purpose) => ({
62
+ id: id(`deck-${purpose}`),
63
+ title: purpose === "cover" ? plan.title : endings[language],
64
+ purpose,
65
+ scene: purpose === "cover" ? "hero" : "closing",
66
+ evidence: pages[0].evidence,
67
+ blocks: [
68
+ {
69
+ id: id(`deck-${purpose}-caption`),
70
+ kind: "paragraph",
71
+ text: plan.title,
72
+ evidence: pages[0].evidence,
73
+ },
74
+ ],
75
+ });
76
+ if (pages[0].purpose !== "cover")
77
+ pages.unshift(bookend("cover"));
27
78
  const last = pages[pages.length - 1];
28
79
  // Evidence and long explanations remain content slides, never masquerade as a closing.
29
- if (last.purpose !== 'conclude' || last.scene === 'brand-collection' || last.blocks.some(b => b.kind !== 'paragraph') || last.blocks.reduce((n, b) => n + contentBlockText(b).join('').length, 0) > 120 || /行业认可|客户|customers|trusted by/i.test(last.title)) {
30
- if (last.purpose === 'conclude')
31
- last.purpose = 'evidence';
32
- pages.push(bookend('conclude'));
80
+ if (last.purpose !== "conclude" ||
81
+ last.scene === "brand-collection" ||
82
+ last.blocks.some((b) => b.kind !== "paragraph") ||
83
+ last.blocks.reduce((n, b) => n + contentBlockText(b).join("").length, 0) >
84
+ 120 ||
85
+ /行业认可|客户|customers|trusted by/i.test(last.title)) {
86
+ if (last.purpose === "conclude")
87
+ last.purpose = "evidence";
88
+ pages.push(bookend("conclude"));
33
89
  }
34
90
  return { ...plan, pages };
35
91
  }
@@ -1,6 +1,6 @@
1
1
  export interface FontFamily {
2
2
  family: string;
3
- category: 'sans' | 'serif' | 'display' | 'mono';
3
+ category: "sans" | "serif" | "display" | "mono";
4
4
  scripts: readonly string[];
5
5
  weights: readonly number[];
6
6
  }
@@ -1,36 +1,88 @@
1
- const entry = (family, category, scripts = ['latin'], weights = [400, 700]) => ({ family, category, scripts, weights });
1
+ const entry = (family, category, scripts = ["latin"], weights = [400, 700]) => ({ family, category, scripts, weights });
2
2
  /** Curated Google Fonts families; request only their declared, supported weights. */
3
3
  export const GOOGLE_FONT_CATALOG = [
4
- ...['Inter', 'Roboto', 'Montserrat', 'Manrope', 'DM Sans', 'Lato', 'Open Sans', 'Source Sans 3', 'Work Sans', 'Nunito Sans', 'IBM Plex Sans'].map(f => entry(f, 'sans')),
5
- ...['Lora', 'Merriweather', 'Libre Baskerville', 'Source Serif 4', 'Playfair Display', 'PT Serif'].map(f => entry(f, 'serif')),
6
- ...['Space Grotesk', 'Oswald', 'Bebas Neue'].map(f => entry(f, 'display', ['latin'], f === 'Bebas Neue' ? [400] : [400, 700])),
7
- ...['JetBrains Mono', 'IBM Plex Mono', 'Fira Code', 'Source Code Pro'].map(f => entry(f, 'mono')),
8
- 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]),
9
- entry('Noto Sans TC', 'sans', ['zh-Hant']), entry('Noto Serif TC', 'serif', ['zh-Hant']),
10
- entry('Noto Sans JP', 'sans', ['ja']), entry('Noto Serif JP', 'serif', ['ja']), entry('M PLUS Rounded 1c', 'sans', ['ja']),
11
- entry('Noto Sans KR', 'sans', ['ko']), entry('Noto Serif KR', 'serif', ['ko']),
12
- entry('Noto Sans Arabic', 'sans', ['ar']), entry('Noto Sans Devanagari', 'sans', ['hi']),
4
+ ...[
5
+ "Inter",
6
+ "Roboto",
7
+ "Montserrat",
8
+ "Manrope",
9
+ "DM Sans",
10
+ "Lato",
11
+ "Open Sans",
12
+ "Source Sans 3",
13
+ "Work Sans",
14
+ "Nunito Sans",
15
+ "IBM Plex Sans",
16
+ ].map((f) => entry(f, "sans")),
17
+ ...[
18
+ "Lora",
19
+ "Merriweather",
20
+ "Libre Baskerville",
21
+ "Source Serif 4",
22
+ "Playfair Display",
23
+ "PT Serif",
24
+ ].map((f) => entry(f, "serif")),
25
+ ...["Space Grotesk", "Oswald", "Bebas Neue"].map((f) => entry(f, "display", ["latin"], f === "Bebas Neue" ? [400] : [400, 700])),
26
+ ...["JetBrains Mono", "IBM Plex Mono", "Fira Code", "Source Code Pro"].map((f) => entry(f, "mono")),
27
+ entry("Noto Sans SC", "sans", ["zh"]),
28
+ entry("Noto Serif SC", "serif", ["zh"]),
29
+ entry("ZCOOL XiaoWei", "display", ["zh"], [400]),
30
+ entry("Ma Shan Zheng", "display", ["zh"], [400]),
31
+ entry("Noto Sans TC", "sans", ["zh-Hant"]),
32
+ entry("Noto Serif TC", "serif", ["zh-Hant"]),
33
+ entry("Noto Sans JP", "sans", ["ja"]),
34
+ entry("Noto Serif JP", "serif", ["ja"]),
35
+ entry("M PLUS Rounded 1c", "sans", ["ja"]),
36
+ entry("Noto Sans KR", "sans", ["ko"]),
37
+ entry("Noto Serif KR", "serif", ["ko"]),
38
+ entry("Noto Sans Arabic", "sans", ["ar"]),
39
+ entry("Noto Sans Devanagari", "sans", ["hi"]),
13
40
  ];
14
- export function contentScript(text, locale = 'en') {
41
+ export function contentScript(text, locale = "en") {
15
42
  if (/[\u3040-\u30ff]/u.test(text))
16
- return 'ja';
43
+ return "ja";
17
44
  if (/[\uac00-\ud7af]/u.test(text))
18
- return 'ko';
45
+ return "ko";
19
46
  if (/[\u0600-\u06ff]/u.test(text))
20
- return 'ar';
47
+ return "ar";
21
48
  if (/[\u0900-\u097f]/u.test(text))
22
- return 'hi';
49
+ return "hi";
23
50
  if (/[\u3400-\u9fff]/u.test(text))
24
- return /TW|HK|Hant/i.test(locale) ? 'zh-Hant' : 'zh';
51
+ return /^ja/i.test(locale)
52
+ ? "ja"
53
+ : /^ko/i.test(locale)
54
+ ? "ko"
55
+ : /TW|HK|Hant/i.test(locale)
56
+ ? "zh-Hant"
57
+ : "zh";
25
58
  if (/^zh/i.test(locale))
26
- return /TW|HK|Hant/i.test(locale) ? 'zh-Hant' : 'zh';
27
- return /^(ja|ko|ar|hi)/.exec(locale)?.[1] || 'latin';
59
+ return /TW|HK|Hant/i.test(locale) ? "zh-Hant" : "zh";
60
+ return /^(ja|ko|ar|hi)/.exec(locale)?.[1] || "latin";
28
61
  }
29
- export function recommendedFonts(locale, text = '') { const script = contentScript(text, locale); return [...GOOGLE_FONT_CATALOG].sort((a, b) => Number(b.scripts.includes(script)) - Number(a.scripts.includes(script))); }
30
- export function languageFont(text, preferred, locale = 'en') {
62
+ export function recommendedFonts(locale, text = "") {
31
63
  const script = contentScript(text, locale);
32
- if (script === 'latin')
64
+ return [...GOOGLE_FONT_CATALOG].sort((a, b) => Number(b.scripts.includes(script)) - Number(a.scripts.includes(script)));
65
+ }
66
+ export function languageFont(text, preferred, locale = "en") {
67
+ const script = contentScript(text, locale);
68
+ if (script === "latin")
69
+ return preferred;
70
+ const selected = GOOGLE_FONT_CATALOG.find((font) => font.family === preferred);
71
+ if (selected?.scripts.includes(script))
72
+ return preferred;
73
+ if (!selected &&
74
+ ![
75
+ "Arial",
76
+ "Helvetica",
77
+ "Georgia",
78
+ "Times New Roman",
79
+ "Courier New",
80
+ "sans-serif",
81
+ "serif",
82
+ "monospace",
83
+ ].includes(preferred))
33
84
  return preferred;
34
- const serif = /serif|Georgia|Lora|Baskerville|Merriweather|Playfair/i.test(preferred) && !/sans/i.test(preferred);
35
- return GOOGLE_FONT_CATALOG.find(f => f.scripts.includes(script) && f.category === (serif ? 'serif' : 'sans'))?.family || preferred;
85
+ const serif = /serif|Georgia|Lora|Baskerville|Merriweather|Playfair/i.test(preferred) &&
86
+ !/sans/i.test(preferred);
87
+ return (GOOGLE_FONT_CATALOG.find((f) => f.scripts.includes(script) && f.category === (serif ? "serif" : "sans"))?.family || preferred);
36
88
  }
@@ -1,6 +1,6 @@
1
1
  export interface LayoutContract {
2
2
  id: string;
3
- kind: 'presentation' | 'social';
3
+ kind: "presentation" | "social";
4
4
  semantic: string;
5
5
  minItems: number;
6
6
  maxItems: number;
@@ -10,6 +10,6 @@ export interface LayoutContract {
10
10
  }
11
11
  /** Eligibility is a first filter, never a substitute for measured fit. */
12
12
  export declare const LAYOUT_CONTRACTS: readonly LayoutContract[];
13
- export declare function eligibleLayouts(kind: LayoutContract['kind'], content: Record<string, unknown>, ratio: number): LayoutContract[];
13
+ export declare function eligibleLayouts(kind: LayoutContract["kind"], content: Record<string, unknown>, ratio: number): LayoutContract[];
14
14
  /** Requested intent, same semantic scene, then general-purpose structures. */
15
- export declare function layoutCandidates(kind: LayoutContract['kind'], requested: string, content: Record<string, unknown>, ratio: number, limit?: number): string[];
15
+ export declare function layoutCandidates(kind: LayoutContract["kind"], requested: string, content: Record<string, unknown>, ratio: number, limit?: number): string[];
@@ -1,22 +1,68 @@
1
- import { PRESENTATION_LAYOUT_IDS } from './layouts.js';
2
- import { SOCIAL_LAYOUT_CATALOG } from './socialLayouts.js';
3
- 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']);
4
- const pair = new Set(['comparison', 'two-column', 'myth', 'problem-solution', 'before-after', 'split-bar-compare']);
1
+ import { SOCIAL_LAYOUT_CATALOG } from "./socialLayouts.js";
2
+ const textOnly = new Set([
3
+ "cover",
4
+ "section",
5
+ "statement",
6
+ "quote",
7
+ "closing",
8
+ "image-full",
9
+ "og-cover",
10
+ "gradient-cover",
11
+ "bold-diagonal-cover",
12
+ "split-cover",
13
+ "block-banner",
14
+ "video-cover",
15
+ "magazine-pull-quote",
16
+ ]);
17
+ const pair = new Set([
18
+ "comparison",
19
+ "two-column",
20
+ "myth",
21
+ "problem-solution",
22
+ "before-after",
23
+ "split-bar-compare",
24
+ ]);
5
25
  /** Eligibility is a first filter, never a substitute for measured fit. */
6
26
  export const LAYOUT_CONTRACTS = [
7
- ...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'] })),
8
- ...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'] : [])] })),
27
+ ...SOCIAL_LAYOUT_CATALOG.map(({ id, scene }) => ({
28
+ id,
29
+ kind: "social",
30
+ semantic: scene,
31
+ minItems: pair.has(id) ? 2 : 0,
32
+ maxItems: textOnly.has(id) ? 0 : pair.has(id) ? 2 : 6,
33
+ minRatio: 0.25,
34
+ maxRatio: 4,
35
+ required: [
36
+ "headline",
37
+ ...(["pricing", "metric"].includes(scene) ? ["value"] : []),
38
+ ],
39
+ })),
9
40
  ];
10
41
  export function eligibleLayouts(kind, content, ratio) {
11
42
  const count = Array.isArray(content.items) ? content.items.length : 0;
12
- return 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()));
43
+ return LAYOUT_CONTRACTS.filter((layout) => layout.kind === kind &&
44
+ ratio >= layout.minRatio - 1e-6 &&
45
+ ratio <= layout.maxRatio + 1e-6 &&
46
+ count >= layout.minItems &&
47
+ count <= layout.maxItems &&
48
+ layout.required.every((key) => typeof content[key] === "string" && String(content[key]).trim()));
13
49
  }
14
50
  /** Requested intent, same semantic scene, then general-purpose structures. */
15
51
  export function layoutCandidates(kind, requested, content, ratio, limit = 8) {
16
52
  const eligible = eligibleLayouts(kind, content, ratio);
17
- const selected = LAYOUT_CONTRACTS.find(layout => layout.kind === kind && layout.id === requested);
18
- const fallback = kind === 'presentation' ? ['cards', 'two-column', 'bullets', 'table', 'agenda', 'statement'] : ['report', 'checklist', 'steps', 'bento', 'editorial', 'story'];
19
- const order = [requested, ...eligible.filter(layout => layout.semantic === (content.scene || selected?.semantic)).map(layout => layout.id), ...fallback];
20
- const allowed = new Set(eligible.map(layout => layout.id));
21
- return [...new Set(order)].filter(id => allowed.has(id)).slice(0, Math.max(1, Math.min(16, limit)));
53
+ const selected = LAYOUT_CONTRACTS.find((layout) => layout.kind === kind && layout.id === requested);
54
+ const fallback = kind === "presentation"
55
+ ? ["cards", "two-column", "bullets", "table", "agenda", "statement"]
56
+ : ["report", "checklist", "steps", "bento", "editorial", "story"];
57
+ const order = [
58
+ requested,
59
+ ...eligible
60
+ .filter((layout) => layout.semantic === (content.scene || selected?.semantic))
61
+ .map((layout) => layout.id),
62
+ ...fallback,
63
+ ];
64
+ const allowed = new Set(eligible.map((layout) => layout.id));
65
+ return [...new Set(order)]
66
+ .filter((id) => allowed.has(id))
67
+ .slice(0, Math.max(1, Math.min(16, limit)));
22
68
  }
package/dist/layouts.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- /** Shared stable IDs for authored presentation renderers. */
2
- export declare const PRESENTATION_LAYOUT_IDS: readonly ["cover", "agenda", "section", "statement", "bullets", "two-column", "comparison", "three-column", "process", "timeline", "metrics", "quote", "image-left", "image-right", "image-full", "closing", "cards", "checklist", "roadmap", "team", "pricing", "faq", "swot", "scorecard", "bar-chart", "funnel", "table", "problem-solution", "case-study", "architecture", "risk", "action-plan", "usage-breakdown", "organization", "editorial-quote", "research-highlight", "product-showcase", "split-bar-compare", "benchmark-bars", "block-banner", "progress-roadmap", "fan-deck", "contents-index", "contents-chapters", "contents-grid", "definition-card", "topic-branches", "radial-mindmap", "tips-card", "code-snippet", "series-carousel", "reflection-card", "video-cover", "digest-card", "chat-preview", "recommendation-feed", "before-after", "course-syllabus", "concept-explainer", "persona-question", "nutrient-symptom-grid", "milestone-history", "release-notes", "product-listing", "flash-sale", "event-banner", "startup-journey", "vision-goals", "tips-grid", "experiment-report", "leaderboard", "win-journey", "device-price-promo", "mega-sale-typographic", "illustration-process", "glass-neon-sale", "free-trial-hero", "feature-chip-hero", "event-speaker-card", "corporate-hero", "release-version-hero", "og-cover", "gradient-cover", "bold-diagonal-cover", "split-cover", "article-feed-card", "article-summary-card", "paragraph-summary-card", "summary-card-stack", "article-repost-card", "article-core-digest", "product-thread-mockup", "agent-notification", "angled-ui-launch", "repo-card", "magazine-pull-quote", "question-answer-quote"];
1
+ /** Content intents for structured presentations; not a separate renderer catalog. */
2
+ export declare const PRESENTATION_LAYOUT_IDS: readonly ["cover", "section", "statement", "cards", "process", "comparison", "bar-chart", "quote", "table", "closing"];
package/dist/layouts.js CHANGED
@@ -1,100 +1,13 @@
1
- /** Shared stable IDs for authored presentation renderers. */
1
+ /** Content intents for structured presentations; not a separate renderer catalog. */
2
2
  export const PRESENTATION_LAYOUT_IDS = [
3
3
  "cover",
4
- "agenda",
5
4
  "section",
6
5
  "statement",
7
- "bullets",
8
- "two-column",
9
- "comparison",
10
- "three-column",
11
- "process",
12
- "timeline",
13
- "metrics",
14
- "quote",
15
- "image-left",
16
- "image-right",
17
- "image-full",
18
- "closing",
19
6
  "cards",
20
- "checklist",
21
- "roadmap",
22
- "team",
23
- "pricing",
24
- "faq",
25
- "swot",
26
- "scorecard",
7
+ "process",
8
+ "comparison",
27
9
  "bar-chart",
28
- "funnel",
10
+ "quote",
29
11
  "table",
30
- "problem-solution",
31
- "case-study",
32
- "architecture",
33
- "risk",
34
- "action-plan",
35
- "usage-breakdown",
36
- "organization",
37
- "editorial-quote",
38
- "research-highlight",
39
- "product-showcase",
40
- "split-bar-compare",
41
- "benchmark-bars",
42
- "block-banner",
43
- "progress-roadmap",
44
- "fan-deck",
45
- "contents-index",
46
- "contents-chapters",
47
- "contents-grid",
48
- "definition-card",
49
- "topic-branches",
50
- "radial-mindmap",
51
- "tips-card",
52
- "code-snippet",
53
- "series-carousel",
54
- "reflection-card",
55
- "video-cover",
56
- "digest-card",
57
- "chat-preview",
58
- "recommendation-feed",
59
- "before-after",
60
- "course-syllabus",
61
- "concept-explainer",
62
- "persona-question",
63
- "nutrient-symptom-grid",
64
- "milestone-history",
65
- "release-notes",
66
- "product-listing",
67
- "flash-sale",
68
- "event-banner",
69
- "startup-journey",
70
- "vision-goals",
71
- "tips-grid",
72
- "experiment-report",
73
- "leaderboard",
74
- "win-journey",
75
- "device-price-promo",
76
- "mega-sale-typographic",
77
- "illustration-process",
78
- "glass-neon-sale",
79
- "free-trial-hero",
80
- "feature-chip-hero",
81
- "event-speaker-card",
82
- "corporate-hero",
83
- "release-version-hero",
84
- "og-cover",
85
- "gradient-cover",
86
- "bold-diagonal-cover",
87
- "split-cover",
88
- "article-feed-card",
89
- "article-summary-card",
90
- "paragraph-summary-card",
91
- "summary-card-stack",
92
- "article-repost-card",
93
- "article-core-digest",
94
- "product-thread-mockup",
95
- "agent-notification",
96
- "angled-ui-launch",
97
- "repo-card",
98
- "magazine-pull-quote",
99
- "question-answer-quote"
12
+ "closing",
100
13
  ];
@@ -1,7 +1,9 @@
1
1
  /** Split only at explicit word/sentence boundaries. Never cut identifiers,
2
2
  * decimal values, or unbroken URLs to force them onto a smaller canvas. */
3
3
  export function splitCopy(copy) {
4
- const breaks = [...copy.matchAll(/\s+|[。!?;]|[.!?;](?=\s|$)/gu)].map(match => match.index + match[0].length).filter(index => index > 0 && index < copy.length);
4
+ const breaks = [...copy.matchAll(/\s+|[。!?;]|[.!?;](?=\s|$)/gu)]
5
+ .map((match) => match.index + match[0].length)
6
+ .filter((index) => index > 0 && index < copy.length);
5
7
  if (!breaks.length)
6
8
  return;
7
9
  const at = breaks.sort((a, b) => Math.abs(a - copy.length / 2) - Math.abs(b - copy.length / 2))[0];
@@ -15,18 +17,27 @@ export function splitContent(source) {
15
17
  const items = source.items || [];
16
18
  if (items.length > 1) {
17
19
  const middle = Math.ceil(items.length / 2);
18
- return [{ ...base, items: items.slice(0, middle) }, { ...base, body: '', items: items.slice(middle) }];
20
+ return [
21
+ { ...base, items: items.slice(0, middle) },
22
+ { ...base, body: "", items: items.slice(middle) },
23
+ ];
19
24
  }
20
25
  if (items.length && source.body?.trim())
21
- return [{ ...base, items: [] }, { ...base, body: '', items }];
26
+ return [
27
+ { ...base, items: [] },
28
+ { ...base, body: "", items },
29
+ ];
22
30
  if (source.body) {
23
31
  const parts = splitCopy(source.body);
24
32
  if (parts)
25
- return parts.map(body => ({ ...base, body }));
33
+ return parts.map((body) => ({ ...base, body }));
26
34
  }
27
35
  if (items.length === 1) {
28
36
  const parts = splitCopy(items[0].description);
29
37
  if (parts)
30
- return parts.map(description => ({ ...base, items: [{ ...items[0], description }] }));
38
+ return parts.map((description) => ({
39
+ ...base,
40
+ items: [{ ...items[0], description }],
41
+ }));
31
42
  }
32
43
  }