ported all templates to json
This commit is contained in:
132
src/types.ts
132
src/types.ts
@@ -29,10 +29,96 @@ export interface DocxStyleConfig {
|
||||
shading?: {
|
||||
fill: string; // Hex color
|
||||
color: string; // usually 'auto'
|
||||
style: string; // usually 'clear'
|
||||
type: string; // usually 'clear' - maps to ShadingType
|
||||
};
|
||||
}
|
||||
|
||||
// New unified element styling (spacing values in points)
|
||||
export interface ElementStyle {
|
||||
font?: string;
|
||||
size?: number;
|
||||
color?: string;
|
||||
background?: string;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
underline?: boolean;
|
||||
allCaps?: boolean;
|
||||
align?: 'left' | 'center' | 'right' | 'both';
|
||||
spacing?: { before: number; after: number; line: number };
|
||||
indent?: number;
|
||||
padding?: number;
|
||||
border?: { color: string; width: number; style: string };
|
||||
borderTop?: { color: string; width: number; style: string };
|
||||
borderBottom?: { color: string; width: number; style: string };
|
||||
borderLeft?: { color: string; width: number; style: string };
|
||||
borderRight?: { color: string; width: number; style: string };
|
||||
bullet?: string;
|
||||
numbering?: string;
|
||||
bulletSize?: number;
|
||||
}
|
||||
|
||||
// Extended element style for DOCX export
|
||||
export type TemplateElementStyle = ElementStyle;
|
||||
|
||||
// Font definitions
|
||||
export interface FontConfig {
|
||||
heading?: string;
|
||||
body?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
// Color palette
|
||||
export interface ColorPalette {
|
||||
text?: string;
|
||||
textSecondary?: string;
|
||||
background?: string;
|
||||
accent?: string;
|
||||
border?: string;
|
||||
codeBg?: string;
|
||||
blockquoteBorder?: string;
|
||||
}
|
||||
|
||||
// Page configuration
|
||||
export interface PageConfig {
|
||||
margins?: { top: number; bottom: number; left: number; right: number };
|
||||
columns?: number;
|
||||
gutter?: number;
|
||||
header?: boolean;
|
||||
footer?: boolean;
|
||||
}
|
||||
|
||||
// Unified template structure (all Markdown elements)
|
||||
export interface UnifiedTemplate {
|
||||
typography?: {
|
||||
fonts?: FontConfig;
|
||||
colors?: ColorPalette;
|
||||
};
|
||||
elements?: {
|
||||
h1?: ElementStyle;
|
||||
h2?: ElementStyle;
|
||||
h3?: ElementStyle;
|
||||
h4?: ElementStyle;
|
||||
h5?: ElementStyle;
|
||||
h6?: ElementStyle;
|
||||
p?: ElementStyle;
|
||||
blockquote?: ElementStyle;
|
||||
code?: ElementStyle;
|
||||
pre?: ElementStyle;
|
||||
ul?: ElementStyle;
|
||||
ol?: ElementStyle;
|
||||
li?: ElementStyle;
|
||||
strong?: ElementStyle;
|
||||
em?: ElementStyle;
|
||||
a?: ElementStyle;
|
||||
table?: ElementStyle;
|
||||
th?: ElementStyle;
|
||||
td?: ElementStyle;
|
||||
hr?: ElementStyle;
|
||||
img?: ElementStyle;
|
||||
};
|
||||
page?: PageConfig;
|
||||
}
|
||||
|
||||
export interface StyleOption {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -40,17 +126,47 @@ export interface StyleOption {
|
||||
description: string;
|
||||
vibe: string;
|
||||
googleFontsImport: string;
|
||||
|
||||
// Word Export Configuration
|
||||
wordConfig: {
|
||||
|
||||
// New unified template structure (optional, for new templates)
|
||||
typography?: {
|
||||
fonts?: FontConfig;
|
||||
colors?: ColorPalette;
|
||||
};
|
||||
elements?: {
|
||||
h1?: ElementStyle;
|
||||
h2?: ElementStyle;
|
||||
h3?: ElementStyle;
|
||||
h4?: ElementStyle;
|
||||
h5?: ElementStyle;
|
||||
h6?: ElementStyle;
|
||||
p?: ElementStyle;
|
||||
blockquote?: ElementStyle;
|
||||
code?: ElementStyle;
|
||||
pre?: ElementStyle;
|
||||
ul?: ElementStyle;
|
||||
ol?: ElementStyle;
|
||||
li?: ElementStyle;
|
||||
strong?: ElementStyle;
|
||||
em?: ElementStyle;
|
||||
a?: ElementStyle;
|
||||
table?: ElementStyle;
|
||||
th?: ElementStyle;
|
||||
td?: ElementStyle;
|
||||
hr?: ElementStyle;
|
||||
img?: ElementStyle;
|
||||
};
|
||||
page?: PageConfig;
|
||||
|
||||
// Legacy Word Export Configuration (auto-generated if unified structure provided)
|
||||
wordConfig?: {
|
||||
heading1: DocxStyleConfig;
|
||||
heading2: DocxStyleConfig;
|
||||
body: DocxStyleConfig;
|
||||
accentColor: string; // Used for graphical elements
|
||||
accentColor: string;
|
||||
};
|
||||
|
||||
// CSS for Web Preview (Must match wordConfig manually for fidelity)
|
||||
previewCss: string;
|
||||
|
||||
// Legacy CSS for Web Preview (auto-generated if unified structure provided)
|
||||
previewCss?: string;
|
||||
}
|
||||
|
||||
export interface GenerationConfig {
|
||||
|
||||
Reference in New Issue
Block a user