@sliiu/present-themes 0.0.0-stage → 0.1.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.
@@ -0,0 +1,3 @@
1
+ /** 内置主题 id — 须与 `THEMES` keys 保持一致。 */
2
+ export declare const BUILTIN_THEME_IDS: readonly ["business", "academic", "creative", "minimal", "dark", "tech", "nature", "warm", "editorial", "terminal", "pastel", "luxe", "ink"];
3
+ export type BuiltinThemeId = (typeof BUILTIN_THEME_IDS)[number];
@@ -0,0 +1,18 @@
1
+ import type { Shape, SlideSize } from "@sliiu/present-core";
2
+ import type { ThemeDecoration, ThemePalette } from "./themes.js";
3
+ export interface DecorationContext {
4
+ palette: ThemePalette;
5
+ size: SlideSize;
6
+ locked: boolean;
7
+ /** id 唯一性前缀(调用方传 stamp / 前缀字串)。 */
8
+ idPrefix: string;
9
+ /**
10
+ * 页面角色(缺省 "feature" = 完整装饰,向后兼容):
11
+ * - feature:封面/章节/结尾/hero/stat/quote 等全出血戏剧页 → 完整装饰;
12
+ * - content:要点/表格/卡片等信息密度高的页 → 静默版。大面积氛围元素
13
+ * (aurora 的光幕、organic-blobs 的山脊等)会被滤掉,只保留细线、角标、
14
+ * 散点等结构性小元素 —— 否则同一组氛围块每页重复,呆板且抢内容。
15
+ */
16
+ role?: "feature" | "content";
17
+ }
18
+ export declare function buildDecorationShapesShared(dec: ThemeDecoration, ctx: DecorationContext): Shape[];
@@ -0,0 +1,27 @@
1
+ export declare function isFontInjected(family: string): boolean;
2
+ /**
3
+ * 注入一份 Google Fonts CSS(或任意公开 CSS)到当前 document。
4
+ *
5
+ * @param cssUrl Google Fonts CSS v2 url(如 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap')
6
+ * 也可以是任何指向 @font-face 规则的 CSS url。
7
+ * @param family CSS font-family 名(用于 dedup 缓存 + DOM 标记)。
8
+ */
9
+ export declare function injectFontCss(cssUrl: string, family: string): void;
10
+ /**
11
+ * 一组手工策划的 Google Fonts,AI 生成主题时从这里挑(保证可商用 + 浏览器可加载)。
12
+ * 与 stock-fonts MCP 的 FONT_PRESETS 共用一套词汇,避免风格漂移。
13
+ *
14
+ * 每条都带 cssUrl,theme generator 调用 injectFontCss 立即生效。
15
+ */
16
+ export interface ThemeFontPreset {
17
+ family: string;
18
+ /** CSS font stack:family + 系统 fallback,给 SVG/HTML 用。 */
19
+ stack: string;
20
+ category: "sans-serif" | "serif" | "display" | "handwriting" | "monospace";
21
+ language: "latin" | "cjk" | "both";
22
+ cssUrl: string;
23
+ tags: string[];
24
+ }
25
+ export declare const THEME_FONT_POOL: ThemeFontPreset[];
26
+ /** 按 family 找 preset;找不到返回 null,调用方应回退到默认栈。 */
27
+ export declare function findFontPreset(family: string): ThemeFontPreset | null;
@@ -0,0 +1,3 @@
1
+ /** Design / Console 主题画廊展示顺序(与 template-store 内置模板顺序一致)。 */
2
+ export declare const THEME_GALLERY_ORDER: readonly ["dark", "tech", "terminal", "creative", "luxe", "business", "editorial", "warm", "pastel", "academic", "ink", "nature", "minimal"];
3
+ export type ThemeGalleryId = (typeof THEME_GALLERY_ORDER)[number];
@@ -0,0 +1,7 @@
1
+ export { BUILTIN_THEME_IDS, type BuiltinThemeId } from "./builtin-ids.js";
2
+ export { THEME_GALLERY_ORDER, type ThemeGalleryId } from "./gallery-order.js";
3
+ export { THEMES, THEME_IDS, THEME_OUTLINE_HINTS, THEME_STYLE_SEEDS, THEME_FONT_FAMILIES, GeneratedThemeSpecSchema, getTheme, injectThemeFonts, realizeGeneratedTheme, type ThemeDef, type ThemePalette, type ThemeFonts, type ThemeFontSizes, type ThemeMetrics, type ThemeDecoration, type ThemeWordArt, type GeneratedThemeSpec, type TemplateLayoutId, } from "./themes.js";
4
+ export { buildDecorationShapesShared, type DecorationContext } from "./decorations.js";
5
+ export { THEME_FONT_POOL, findFontPreset, injectFontCss, type ThemeFontPreset } from "./fonts/inject.js";
6
+ export { buildCoreThemeFromSpec, buildMastersFromThemeDef, findLayoutRefByType, resolveLayoutTypeForSlide, stripSlideThemeDecorations, themeSpecFromThemeDef, } from "./template-masters.js";
7
+ export { ApplyCustomThemeCmd, ApplyThemeCmd, type ApplyCustomThemeOpts, type ApplyThemeOpts, } from "./theme-commands.js";
@@ -0,0 +1,27 @@
1
+ export interface Rgb {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ }
6
+ /** 解析 #rgb / #rrggbb(大小写均可)。无法解析返回 null。 */
7
+ export declare function parseHex(input: string | undefined): Rgb | null;
8
+ /** Rgb → #rrggbb(小写)。 */
9
+ export declare function toHex(rgb: Rgb): string;
10
+ /** WCAG 相对亮度 0..1。 */
11
+ export declare function relativeLuminance(rgb: Rgb): number;
12
+ /** WCAG 对比度 1..21。 */
13
+ export declare function contrastRatio(a: Rgb, b: Rgb): number;
14
+ export declare const SAFE_TEXT_DARK = "#0f172a";
15
+ export declare const SAFE_TEXT_LIGHT = "#f8fafc";
16
+ export declare const WCAG_LARGE_TEXT_CONTRAST = 3;
17
+ export declare const WCAG_BODY_TEXT_CONTRAST = 4.5;
18
+ /** 根据底色亮度选一个高对比度的兜底文字色。 */
19
+ export declare function readableTextColor(bg: Rgb): string;
20
+ /** 线性插值两色,t=0 → a,t=1 → b。 */
21
+ export declare function mixRgb(a: Rgb, b: Rgb, t: number): Rgb;
22
+ /**
23
+ * 把 `color` 朝 `target` 方向逐步靠拢,直到相对 `bg` 的对比度 ≥ `min`。
24
+ * 用于把「对底色太浅」的次要文字色拉到达标,同时尽量保留原色调(小步逼近)。
25
+ * 若走到 target 仍不达标(几乎不可能,target 应是高对比色),返回 target。
26
+ */
27
+ export declare function ensureContrast(color: Rgb, bg: Rgb, target: Rgb, min: number): Rgb;
@@ -0,0 +1,18 @@
1
+ import { type Slide, type SlideMaster, type SlideSize, type Theme } from "@sliiu/present-core";
2
+ import type { GeneratedThemeSpec, ThemeDef } from "./themes.js";
3
+ /** ThemeDef → GeneratedThemeSpec(无 LLM,供母版构建与模板合成共用)。 */
4
+ export declare function themeSpecFromThemeDef(theme: ThemeDef, spec?: GeneratedThemeSpec): GeneratedThemeSpec;
5
+ export declare function buildCoreThemeFromSpec(spec: GeneratedThemeSpec, theme: ThemeDef, themeId: string): Theme;
6
+ /** 从 ThemeDef 构建完整母版 + 版式(与 template picker / 新建 deck 同源)。 */
7
+ export declare function buildMastersFromThemeDef(theme: ThemeDef, size: SlideSize, baseId: string, spec?: GeneratedThemeSpec): {
8
+ masters: SlideMaster[];
9
+ coreTheme: Theme;
10
+ };
11
+ /** 套用主题后按版式 type 为 slide 重绑 layoutRef。 */
12
+ export declare function resolveLayoutTypeForSlide(slide: Slide, index: number, prevMasters?: SlideMaster[]): string;
13
+ export declare function findLayoutRefByType(masters: SlideMaster[], layoutType: string): {
14
+ masterId: string;
15
+ layoutId: string;
16
+ } | undefined;
17
+ /** 清除 slide 层遗留的 dec_*(母版路径下装饰改由 compose 合成)。 */
18
+ export declare function stripSlideThemeDecorations(slide: Slide): void;
@@ -0,0 +1,41 @@
1
+ import { type EditCommand, type Presentation } from "@sliiu/present-core";
2
+ import { type ThemeDef } from "./themes.js";
3
+ /** 示例封面文案(由调用方注入,themes 包不持有 i18n)。 */
4
+ export interface SampleCoverText {
5
+ title: string;
6
+ subtitle: string;
7
+ }
8
+ export interface ApplyCustomThemeOpts {
9
+ preserveImageBackgrounds?: boolean;
10
+ /**
11
+ * 首页无内容时铺一组示例主副标题,让用户立刻看到该主题的排印。
12
+ * 不传则完全不介入(AI 生成等已有内容的路径不需要)。
13
+ */
14
+ sampleCover?: SampleCoverText;
15
+ }
16
+ export declare class ApplyCustomThemeCmd implements EditCommand {
17
+ private theme;
18
+ private opts;
19
+ readonly label = "Apply custom theme";
20
+ private prev?;
21
+ private prevMasters?;
22
+ private prevThemeMeta?;
23
+ private prevTextColors?;
24
+ constructor(theme: ThemeDef, opts?: ApplyCustomThemeOpts);
25
+ apply(pres: Presentation): void;
26
+ revert(pres: Presentation): void;
27
+ }
28
+ export interface ApplyThemeOpts {
29
+ preserveImageBackgrounds?: boolean;
30
+ }
31
+ export declare class ApplyThemeCmd implements EditCommand {
32
+ private themeId;
33
+ private opts;
34
+ readonly label = "Apply theme";
35
+ private prev?;
36
+ private prevThemeMeta?;
37
+ private prevTextColors?;
38
+ constructor(themeId: string, opts?: ApplyThemeOpts);
39
+ apply(pres: Presentation): void;
40
+ revert(pres: Presentation): void;
41
+ }
@@ -0,0 +1,276 @@
1
+ import { type BuiltinThemeId } from "./builtin-ids.js";
2
+ export interface ThemePalette {
3
+ bg: string;
4
+ bgAlt: string;
5
+ text: string;
6
+ textMuted: string;
7
+ accent1: string;
8
+ accent2: string;
9
+ accent3: string;
10
+ accent4: string;
11
+ divider: string;
12
+ }
13
+ export interface ThemeFonts {
14
+ title: string;
15
+ body: string;
16
+ mono: string;
17
+ }
18
+ export interface ThemeFontSizes {
19
+ coverTitle: number;
20
+ coverSubtitle: number;
21
+ sectionTitle: number;
22
+ pageTitle: number;
23
+ body: number;
24
+ small: number;
25
+ quote: number;
26
+ }
27
+ export interface ThemeMetrics {
28
+ marginX: number;
29
+ marginY: number;
30
+ titleBodyGap: number;
31
+ bulletLineHeight: number;
32
+ }
33
+ /**
34
+ * 装饰层定义(AI 生成主题 / 自定义主题用):在 slide 背景上方、内容下方插入的
35
+ * 装饰图形。renderLayout 在 compile 时把它们追加成 shape,置于普通内容之前。
36
+ *
37
+ * 内置 8 套具体风格(每套产出多个 shape,形成独立视觉语言):
38
+ * - `aurora`:极光光幕(深色系 / 发布会)—— 两道左右出血的横向光幕 + 底部细线
39
+ * - `tech-bracket`:科技L形 bracket(科技 / 工程)—— 左侧竖条 + 右下 L 角标
40
+ * - `neon-burst`:霓虹灯管(创意 / 夜场)—— 顶栏 + 贴边亮管柔光 + 散点
41
+ * - `authority`:权威双条(商务 / 严肃)—— 左侧纵条 + 底栏双色段
42
+ * - `manuscript`:手稿双线(学术 / 出版)—— 顶底横线 + 居中装饰点
43
+ * - `ink-thread`:墨线单划(极简 / 日式)—— 单条精准横线
44
+ * - `organic-blobs`:层叠远山(自然 / 生态)—— 两道出血扁平山脊 + 地平线
45
+ * - `sunrise-arc`:朝阳弧(暖色 / 活力)—— 底部半圆弧光 + 底栏
46
+ * - `masthead`:杂志报头(编辑 / 出版)—— 顶部粗实色报头条 + 细分隔线 + 左侧页边线 + 底部页码块
47
+ * - `terminal`:终端扫描线(极客 / 开发)—— 角落 L 形括号 + 左上光标块 + 横向扫描线 + 命令提示符
48
+ * - `confetti`:彩纸礼花(活泼 / 教育)—— 多彩散点圆 + 底部柔和色带
49
+ * - `gilded`:鎏金细框(高奢 / 品牌)—— 四边内嵌金色细线框 + 四角节点
50
+ * - `ink-wash`:水墨留白(国风 / 文艺)—— 下半部远山淡墨 + 朱红印章方块 + 竖向墨线
51
+ * - `corner-gradient-shape`:legacy 别名,渲染等同 `aurora`(AI 生成主题兼容)
52
+ * - `geometric-lines`:通用几何线(AI 生成主题兼容)
53
+ * - `bottom-accent-bar`:通用底栏(AI 生成主题兼容)
54
+ * - `dotted-grid`:通用点阵(AI 生成主题兼容)
55
+ * - `none`:无装饰
56
+ */
57
+ export type ThemeDecoration = "none" | "aurora" | "tech-bracket" | "neon-burst" | "authority" | "manuscript" | "ink-thread" | "organic-blobs" | "sunrise-arc" | "masthead" | "terminal" | "confetti" | "gilded" | "ink-wash" | "corner-gradient-shape" | "geometric-lines" | "bottom-accent-bar" | "dotted-grid";
58
+ /**
59
+ * 标题"艺术字"处理(WordArt)。
60
+ *
61
+ * ⚠ 渲染能力边界(见 packages/renderer/src/svg-backend.ts / canvas-backend.ts):
62
+ * - 已支持:纯色填充(run.color)、文字描边(run.textOutline)、字距(letterSpacing)、
63
+ * 字重/大小、全大写(caps)、形状级阴影(shape.shadow)、形状 transform 旋转/斜切。
64
+ * - **不支持**:渐变文字填充(run.fill gradient 未被任何 backend 消费)、prstTxWarp 路径排字。
65
+ * 因此这里的"艺术字"是用 **色彩 + 描边 + 字距 + 阴影 + 轻微变形(旋转)** 组合出的标题
66
+ * 视觉强化,而不是真正的渐变 / 弯曲文字。模板层 (template.ts) 把这些字段烘焙进
67
+ * 标题占位符的 run / shape,用户输入标题即继承该风格。
68
+ */
69
+ export interface ThemeWordArt {
70
+ /** 标题色(默认 palette.text)。 */
71
+ color?: string;
72
+ /** 文字描边色。 */
73
+ outlineColor?: string;
74
+ /** 描边宽度(px)。 */
75
+ outlineWidth?: number;
76
+ /** 字距(px,正=展开)。 */
77
+ letterSpacing?: number;
78
+ /** 字重(默认 800)。 */
79
+ weight?: number;
80
+ /** 是否全大写(仅影响拉丁字母;CJK 无视)。一般只用于 eyebrow/kicker。 */
81
+ caps?: boolean;
82
+ /** 标题阴影(形状级 drop shadow)。 */
83
+ shadow?: {
84
+ color: string;
85
+ alpha: number;
86
+ blur: number;
87
+ dx: number;
88
+ dy: number;
89
+ };
90
+ /** 封面标题/点缀的轻微变形角度(度,正=顺时针)。 */
91
+ rotation?: number;
92
+ }
93
+ /**
94
+ * 模板版式家族:决定 template.ts 生成 layout 时的几何骨架(标题对齐 / 封面锚点 /
95
+ * 分隔线 / 双栏比例 / 内容缩进 / 终端提示符等),让不同模板**结构**也不同,
96
+ * 而不只是换色换字。缺省 `classic` = 历史的左对齐版式。
97
+ *
98
+ * - `classic`:左对齐 kicker + 左标题 + 细分隔线(商务/学术/极简/科技…)
99
+ * - `centered`:居中 kicker + 居中标题,对称留白(创意/粉彩)
100
+ * - `editorial`:封面标题下沉 + 粗顶线 + 不对称宽左栏(杂志/高奢/国风)
101
+ * - `terminal`:标题前缀命令提示符 + 左侧 gutter,等宽气质(终端)
102
+ */
103
+ export type TemplateLayoutId = "classic" | "centered" | "editorial" | "terminal";
104
+ /**
105
+ * 封面主视觉母题:决定 title 版式上"标题周围那组装饰"的形状语言,以及标题块的
106
+ * 纵向偏移 / 左缩进 / 页脚处理。
107
+ *
108
+ * 为什么要和 TemplateLayoutId 分开:版式家族只有 4 个,13 套内置主题里 7 套都落在
109
+ * `classic`,封面因此长得一模一样(同一条斜杠 + 同一根短条 + 同样的标题位置),
110
+ * 只有配色不同。母题是**正交**维度,缺省从 `decoration` 推导 —— 主题的装饰语言本来
111
+ * 就各不相同,让封面呼应它,新主题(含 AI 生成)不用额外配置就自带差异。
112
+ * 见 template-masters.ts 的 `coverMotifFor` / `coverMotifShapes`。
113
+ */
114
+ export type CoverMotifId = "slash" | "stack" | "rule-box" | "spine" | "bracket" | "halo" | "blob" | "arc" | "frame" | "burst" | "dots" | "wash" | "masthead" | "terminal-bar";
115
+ export interface ThemeDef {
116
+ id: string;
117
+ name: string;
118
+ description: string;
119
+ palette: ThemePalette;
120
+ fonts: ThemeFonts;
121
+ fontSizes: ThemeFontSizes;
122
+ metrics: ThemeMetrics;
123
+ /** 版式骨架家族;缺省 classic(见 TemplateLayoutId)。 */
124
+ layout?: TemplateLayoutId;
125
+ /**
126
+ * 封面主视觉母题;缺省由 `decoration` 推导(见 CoverMotifId)。
127
+ * 只在"想让封面刻意偏离装饰语言"时才显式写,否则留空即可。
128
+ */
129
+ coverMotif?: CoverMotifId;
130
+ /**
131
+ * 封面是否显示 terminal 版式的命令提示符(默认 `~ $`)。
132
+ * 仅影响 title 版式;内容页仍走 layout 的 `prompt` 前缀。设为 `false` 可关掉。
133
+ */
134
+ coverPrompt?: boolean;
135
+ /**
136
+ * 可选:内容页正文区铺一层"内容卡片"底板(不依赖 terminal 版式)。
137
+ * 深色主题(tech/dark)开启后正文区多一层 bgAlt 卡片 → 在深底上更有层次/聚焦。
138
+ * 与 terminal 版式的代码块底板共用渲染,但只有 terminal 才画"红黄绿"窗口圆点。
139
+ */
140
+ contentPanel?: boolean;
141
+ /** 标题艺术字处理(可选)。 */
142
+ titleWordArt?: ThemeWordArt;
143
+ /**
144
+ * 可选:覆盖 slide.background。内置 5 套主题不设此字段,走 solid bg;
145
+ * AI 生成主题(generateTheme)通常会写 linear/radial gradient,让发布会风
146
+ * / 暗色主题立刻有"层次感"。
147
+ */
148
+ backgroundPaint?: import("@sliiu/present-core").Paint;
149
+ /** 装饰层:compile.ts 在 render 后追加到 layer.shapes 顶部(z 最低)。 */
150
+ decoration?: ThemeDecoration;
151
+ /**
152
+ * 字体 Google Fonts CSS link(注入 <head>,让 SVG 渲染时能解析到真正的字形)。
153
+ * 内置主题用系统 fallback 栈,无需 link。AI 生成主题会指定 1-3 条 link。
154
+ */
155
+ fontCssLinks?: Array<{
156
+ family: string;
157
+ cssUrl: string;
158
+ }>;
159
+ }
160
+ export declare const THEMES: Record<string, ThemeDef>;
161
+ /**
162
+ * 把一份主题用到的 Google Fonts 注入当前 document(idempotent)。
163
+ * 内置模板在 playground 启动时调用,保证"用内置模板新建"时标题/正文字体真的加载,
164
+ * 而不是落到系统默认字形(这是之前"字体不随主题"的根因之一)。
165
+ * 非浏览器环境(SSR / 子进程)自动跳过。
166
+ */
167
+ export declare function injectThemeFonts(theme: ThemeDef): void;
168
+ export declare const THEME_IDS: string[];
169
+ /**
170
+ * 每套主题的「适用场景」一句话(英文,喂给 outline 的 themeId 选择器)。
171
+ * 这是 outline prompt 里主题映射的**单一事实源** —— 新增主题时在这里补一行即可,
172
+ * prompt 会自动带上。
173
+ *
174
+ * 类型 `Record<BuiltinThemeId, string>` 强制覆盖 schema 里全部 builtin id:漏一个就编译报错。
175
+ * 加新主题的完整流程:THEMES 加条目 → BUILTIN_THEME_IDS 加 id → 这里加一行 hint。
176
+ */
177
+ export declare const THEME_OUTLINE_HINTS: Record<BuiltinThemeId, string>;
178
+ /**
179
+ * 每套内置主题的「AI 生成种子」—— 一句 **英文 styleHint**,喂给 `generateTheme` 让 AI 现场设计
180
+ * 一套贴合该风格系统、比静态 preset 更精致的主题。
181
+ *
182
+ * 设计要点(对应 `.cursor/skills/ppt-style-systems/SKILL.md` +
183
+ * `packages/ai/src/skills/builtin/ppt-style-systems.md`):
184
+ * - 每条种子把该风格系统的 **精确色锚 + 字体配对 + 版式纪律 + 装饰气质** 写死,
185
+ * 防止模型「自由发挥」乱配色(skill 明确要求 "pick one family, do not invent random hex")。
186
+ * - 色锚 / 字体沿用对应 preset 的 palette / fonts,让 AI 主题落在**用户认得出的 vibe** 附近,
187
+ * 但由模型重新做渐变 / 层次 / 对比,产出更耐看的成品。
188
+ * - 这是外观步骤「按风格系统 AI 生成」的**单一事实源**:改风格语言只改这里。
189
+ *
190
+ * 类型 `Record<BuiltinThemeId, string>` 强制覆盖全部 builtin id(漏一个编译报错),与
191
+ * `THEME_OUTLINE_HINTS` 同源守护。
192
+ */
193
+ export declare const THEME_STYLE_SEEDS: Record<BuiltinThemeId, string>;
194
+ export declare function getTheme(id: string | undefined): ThemeDef;
195
+ import { z } from "zod";
196
+ /** AI 输出的"主题 spec"。compile 之前用 `realizeGeneratedTheme` 把它具象化为 ThemeDef。 */
197
+ export declare const GeneratedThemeSpecSchema: z.ZodObject<{
198
+ name: z.ZodString;
199
+ description: z.ZodString;
200
+ mode: z.ZodEnum<{
201
+ dark: "dark";
202
+ light: "light";
203
+ }>;
204
+ palette: z.ZodObject<{
205
+ bg: z.ZodString;
206
+ bgAlt: z.ZodString;
207
+ text: z.ZodString;
208
+ textMuted: z.ZodString;
209
+ accent1: z.ZodString;
210
+ accent2: z.ZodString;
211
+ accent3: z.ZodString;
212
+ accent4: z.ZodString;
213
+ divider: z.ZodString;
214
+ }, z.core.$strip>;
215
+ background: z.ZodUnion<readonly [z.ZodObject<{
216
+ kind: z.ZodLiteral<"solid">;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ kind: z.ZodLiteral<"linear">;
219
+ angle: z.ZodNumber;
220
+ stops: z.ZodArray<z.ZodObject<{
221
+ offset: z.ZodNumber;
222
+ color: z.ZodString;
223
+ alpha: z.ZodOptional<z.ZodNumber>;
224
+ }, z.core.$strip>>;
225
+ }, z.core.$strip>, z.ZodObject<{
226
+ kind: z.ZodLiteral<"radial">;
227
+ stops: z.ZodArray<z.ZodObject<{
228
+ offset: z.ZodNumber;
229
+ color: z.ZodString;
230
+ alpha: z.ZodOptional<z.ZodNumber>;
231
+ }, z.core.$strip>>;
232
+ }, z.core.$strip>]>;
233
+ fonts: z.ZodObject<{
234
+ title: z.ZodString;
235
+ body: z.ZodString;
236
+ mono: z.ZodOptional<z.ZodString>;
237
+ }, z.core.$strip>;
238
+ decoration: z.ZodEnum<{
239
+ aurora: "aurora";
240
+ authority: "authority";
241
+ confetti: "confetti";
242
+ gilded: "gilded";
243
+ "ink-thread": "ink-thread";
244
+ "ink-wash": "ink-wash";
245
+ manuscript: "manuscript";
246
+ masthead: "masthead";
247
+ "neon-burst": "neon-burst";
248
+ none: "none";
249
+ "organic-blobs": "organic-blobs";
250
+ "sunrise-arc": "sunrise-arc";
251
+ "tech-bracket": "tech-bracket";
252
+ terminal: "terminal";
253
+ }>;
254
+ layout: z.ZodOptional<z.ZodEnum<{
255
+ centered: "centered";
256
+ classic: "classic";
257
+ editorial: "editorial";
258
+ terminal: "terminal";
259
+ }>>;
260
+ }, z.core.$strip>;
261
+ export type GeneratedThemeSpec = z.infer<typeof GeneratedThemeSpecSchema>;
262
+ /**
263
+ * 把 AI 输出的 spec 具象化为 ThemeDef:
264
+ * - 字体:family → 查 THEME_FONT_POOL 拿 stack & cssUrl;找不到回退到默认栈。
265
+ * - 背景:solid 时 backgroundPaint 留 undefined(compile 走 palette.bg);
266
+ * gradient 时构造 LinearGradientPaint / RadialGradientPaint。
267
+ * - palette:源头对比度兜底(sanitizePaletteContrast),保证 text/textMuted 相对底色达 WCAG。
268
+ * - 装饰:原样保留,compile 时翻译为 Shape。
269
+ * - 浏览器内自动注入 Google Fonts CSS(subprocess / server-side 无 document 时跳过)。
270
+ */
271
+ export declare function realizeGeneratedTheme(spec: GeneratedThemeSpec, opts?: {
272
+ autoInject?: boolean;
273
+ debug?: boolean;
274
+ }): ThemeDef;
275
+ /** 给 prompt / UI 用的字体 family 白名单(与 THEME_FONT_POOL 同步)。 */
276
+ export declare const THEME_FONT_FAMILIES: string[];
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@sliiu/present-themes",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "AGPL-3.0-or-later",
5
+ "type": "module",
6
+ "main": "./dist/cjs/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/index.d.ts",
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "typecheck": "tsc --noEmit"
17
+ },
18
+ "dependencies": {
19
+ "zod": "^4.6.5",
20
+ "@sliiu/present-core": "0.1.0"
21
+ },
22
+ "module": "./dist/esm/index.js",
23
+ "files": [
24
+ "dist",
25
+ "LICENSE",
26
+ "COPYRIGHT",
27
+ "THIRD-PARTY-NOTICES.md"
28
+ ]
29
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.