@nxavis/pdf 0.1.0 → 0.2.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.
@@ -214,13 +214,78 @@ var minimalTheme = {
214
214
  }
215
215
  };
216
216
 
217
+ // src/themes/korean.ts
218
+ var koreanTheme = {
219
+ name: "korean",
220
+ primitives: defaultPrimitives,
221
+ colors: {
222
+ foreground: "#18181b",
223
+ background: "#ffffff",
224
+ muted: "#f4f4f5",
225
+ mutedForeground: "#71717a",
226
+ primary: "#18181b",
227
+ primaryForeground: "#ffffff",
228
+ border: "#e4e4e7",
229
+ accent: "#2563eb",
230
+ destructive: "#dc2626",
231
+ success: "#16a34a",
232
+ warning: "#d97706",
233
+ info: "#0ea5e9"
234
+ },
235
+ typography: {
236
+ body: {
237
+ fontFamily: "NotoSansKR",
238
+ fontSize: 10,
239
+ lineHeight: 1.7
240
+ },
241
+ heading: {
242
+ fontFamily: "NotoSansKR",
243
+ fontWeight: 700,
244
+ lineHeight: 1.3,
245
+ fontSize: {
246
+ h1: 28,
247
+ h2: 22,
248
+ h3: 18,
249
+ h4: 14,
250
+ h5: 12,
251
+ h6: 10
252
+ }
253
+ }
254
+ },
255
+ spacing: {
256
+ page: {
257
+ marginTop: 48,
258
+ marginRight: 48,
259
+ marginBottom: 48,
260
+ marginLeft: 48
261
+ },
262
+ sectionGap: 24,
263
+ paragraphGap: 8,
264
+ componentGap: 12
265
+ },
266
+ page: {
267
+ size: "A4",
268
+ orientation: "portrait"
269
+ }
270
+ };
271
+ var koreanPretendardTheme = {
272
+ ...koreanTheme,
273
+ name: "korean-pretendard",
274
+ typography: {
275
+ body: { ...koreanTheme.typography.body, fontFamily: "Pretendard" },
276
+ heading: { ...koreanTheme.typography.heading, fontFamily: "Pretendard" }
277
+ }
278
+ };
279
+
217
280
  // src/themes/index.ts
218
281
  var themePresets = {
219
282
  professional: professionalTheme,
220
283
  modern: modernTheme,
221
- minimal: minimalTheme
284
+ minimal: minimalTheme,
285
+ korean: koreanTheme,
286
+ "korean-pretendard": koreanPretendardTheme
222
287
  };
223
288
 
224
- export { defaultPrimitives, minimalTheme, modernTheme, professionalTheme, themePresets };
225
- //# sourceMappingURL=chunk-Z743L6FY.js.map
226
- //# sourceMappingURL=chunk-Z743L6FY.js.map
289
+ export { defaultPrimitives, koreanPretendardTheme, koreanTheme, minimalTheme, modernTheme, professionalTheme, themePresets };
290
+ //# sourceMappingURL=chunk-6QQHSSMJ.js.map
291
+ //# sourceMappingURL=chunk-6QQHSSMJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/themes/primitives.ts","../src/themes/professional.ts","../src/themes/modern.ts","../src/themes/minimal.ts","../src/themes/korean.ts","../src/themes/index.ts"],"names":[],"mappings":";AAeO,IAAM,iBAAA,GAAqC;AAAA,EAChD,UAAA,EAAY;AAAA,IACV,EAAA,EAAI,EAAA;AAAA,IACJ,EAAA,EAAI,EAAA;AAAA,IACJ,IAAA,EAAM,EAAA;AAAA,IACN,EAAA,EAAI,EAAA;AAAA,IACJ,EAAA,EAAI,EAAA;AAAA,IACJ,KAAA,EAAO,EAAA;AAAA,IACP,KAAA,EAAO;AAAA,GACT;AAAA,EACA,OAAA,EAAS;AAAA,IACP,CAAA,EAAG,CAAA;AAAA,IACH,GAAA,EAAK,CAAA;AAAA,IACL,CAAA,EAAG,CAAA;AAAA,IACH,CAAA,EAAG,CAAA;AAAA,IACH,CAAA,EAAG,EAAA;AAAA,IACH,CAAA,EAAG,EAAA;AAAA,IACH,CAAA,EAAG,EAAA;AAAA,IACH,CAAA,EAAG,EAAA;AAAA,IACH,CAAA,EAAG,EAAA;AAAA,IACH,EAAA,EAAI,EAAA;AAAA,IACJ,EAAA,EAAI,EAAA;AAAA,IACJ,EAAA,EAAI;AAAA,GACN;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,GAAA;AAAA,IACT,MAAA,EAAQ,GAAA;AAAA,IACR,QAAA,EAAU,GAAA;AAA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n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n typography: {\n xs: 10,\n sm: 12,\n base: 15,\n lg: 18,\n xl: 22,\n '2xl': 28,\n '3xl': 36,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n 10: 40,\n 12: 48,\n 16: 64,\n },\n fontWeights: {\n regular: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.4,\n relaxed: 1.6,\n },\n borderRadius: {\n none: 0,\n sm: 2,\n md: 4,\n lg: 8,\n full: 9999,\n },\n letterSpacing: {\n tight: -0.025,\n normal: 0,\n wide: 0.025,\n wider: 0.05,\n },\n};\n","import type { PdfxTheme } from '../theme';\nimport { defaultPrimitives } from './primitives';\n\n/**\n * Professional theme preset.\n *\n * Character: Serif headings (Times-Roman), refined zinc/slate palette,\n * generous margins, formal document feel. shadcn-inspired minimal aesthetic.\n * Ideal for business documents, reports, and official correspondence.\n */\nexport const professionalTheme: PdfxTheme = {\n name: 'professional',\n primitives: defaultPrimitives,\n colors: {\n foreground: '#18181b',\n background: '#ffffff',\n muted: '#f4f4f5',\n mutedForeground: '#71717a',\n primary: '#18181b',\n primaryForeground: '#ffffff',\n border: '#e4e4e7',\n accent: '#3b82f6',\n destructive: '#dc2626',\n success: '#16a34a',\n warning: '#d97706',\n info: '#0ea5e9',\n },\n typography: {\n body: {\n fontFamily: 'Helvetica',\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: 'Times-Roman',\n fontWeight: 700,\n lineHeight: 1.25,\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n },\n },\n spacing: {\n page: {\n marginTop: 56,\n marginRight: 48,\n marginBottom: 56,\n marginLeft: 48,\n },\n sectionGap: 28,\n paragraphGap: 10,\n componentGap: 14,\n },\n page: {\n size: 'A4',\n orientation: 'portrait',\n },\n};\n","import type { PdfxTheme } from '../theme';\nimport { defaultPrimitives } from './primitives';\n\n/**\n * Modern theme preset.\n *\n * Character: All-Helvetica, slate-cool neutrals with subtle violet accent,\n * clean spacing. shadcn-inspired contemporary feel.\n * Ideal for startups, tech companies, and design-forward documents.\n */\nexport const modernTheme: PdfxTheme = {\n name: 'modern',\n primitives: defaultPrimitives,\n colors: {\n foreground: '#0f172a',\n background: '#ffffff',\n muted: '#f1f5f9',\n mutedForeground: '#64748b',\n primary: '#334155',\n primaryForeground: '#ffffff',\n border: '#e2e8f0',\n accent: '#6366f1',\n destructive: '#ef4444',\n success: '#22c55e',\n warning: '#f59e0b',\n info: '#3b82f6',\n },\n typography: {\n body: {\n fontFamily: 'Helvetica',\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: 'Helvetica',\n fontWeight: 600,\n lineHeight: 1.25,\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n },\n },\n spacing: {\n page: {\n marginTop: 40,\n marginRight: 40,\n marginBottom: 40,\n marginLeft: 40,\n },\n sectionGap: 24,\n paragraphGap: 10,\n componentGap: 12,\n },\n page: {\n size: 'A4',\n orientation: 'portrait',\n },\n};\n","import type { PdfxTheme } from '../theme';\nimport { defaultPrimitives } from './primitives';\n\n/**\n * Minimal theme preset.\n *\n * Character: Courier headings, zinc neutrals, maximum whitespace.\n * shadcn-inspired restrained palette. Ideal for clean documentation,\n * technical specs, and literary manuscripts.\n */\nexport const minimalTheme: PdfxTheme = {\n name: 'minimal',\n primitives: defaultPrimitives,\n colors: {\n foreground: '#18181b',\n background: '#ffffff',\n muted: '#fafafa',\n mutedForeground: '#a1a1aa',\n primary: '#18181b',\n primaryForeground: '#ffffff',\n border: '#e4e4e7',\n accent: '#71717a',\n destructive: '#b91c1c',\n success: '#15803d',\n warning: '#a16207',\n info: '#0369a1',\n },\n typography: {\n body: {\n fontFamily: 'Helvetica',\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: 'Courier',\n fontWeight: 600,\n lineHeight: 1.25,\n fontSize: {\n h1: 24,\n h2: 20,\n h3: 16,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n },\n },\n spacing: {\n page: {\n marginTop: 72,\n marginRight: 56,\n marginBottom: 72,\n marginLeft: 56,\n },\n sectionGap: 36,\n paragraphGap: 14,\n componentGap: 18,\n },\n page: {\n size: 'A4',\n orientation: 'portrait',\n },\n};\n","import type { PdfxTheme } from '../theme';\nimport { defaultPrimitives } from './primitives';\n\n/**\n * Korean theme preset — Noto Sans KR.\n *\n * 한국어 문서에 최적화된 테마입니다.\n * 본문과 헤딩 모두 'NotoSansKR' 폰트를 사용합니다.\n * 사용 전 반드시 registerNotoSansKR() 또는 setupKorean()을 호출하세요.\n *\n * @example\n * ```tsx\n * import { setupKorean, koreanTheme, PdfxThemeProvider } from '@nxavis/pdf';\n *\n * setupKorean();\n *\n * <PdfxThemeProvider theme={koreanTheme}>\n * <Heading level={1}>클라우드 비용 리포트</Heading>\n * </PdfxThemeProvider>\n * ```\n */\nexport const koreanTheme: PdfxTheme = {\n name: 'korean',\n primitives: defaultPrimitives,\n colors: {\n foreground: '#18181b',\n background: '#ffffff',\n muted: '#f4f4f5',\n mutedForeground: '#71717a',\n primary: '#18181b',\n primaryForeground: '#ffffff',\n border: '#e4e4e7',\n accent: '#2563eb',\n destructive: '#dc2626',\n success: '#16a34a',\n warning: '#d97706',\n info: '#0ea5e9',\n },\n typography: {\n body: {\n fontFamily: 'NotoSansKR',\n fontSize: 10,\n lineHeight: 1.7,\n },\n heading: {\n fontFamily: 'NotoSansKR',\n fontWeight: 700,\n lineHeight: 1.3,\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n },\n },\n spacing: {\n page: {\n marginTop: 48,\n marginRight: 48,\n marginBottom: 48,\n marginLeft: 48,\n },\n sectionGap: 24,\n paragraphGap: 8,\n componentGap: 12,\n },\n page: {\n size: 'A4',\n orientation: 'portrait',\n },\n};\n\n/**\n * Korean Pretendard theme preset.\n *\n * Pretendard 폰트를 사용하는 한국어 테마입니다.\n * 사용 전 반드시 registerPretendard() 또는 setupKorean('Pretendard')를 호출하세요.\n */\nexport const koreanPretendardTheme: PdfxTheme = {\n ...koreanTheme,\n name: 'korean-pretendard',\n typography: {\n body: { ...koreanTheme.typography.body, fontFamily: 'Pretendard' },\n heading: { ...koreanTheme.typography.heading, fontFamily: 'Pretendard' },\n },\n};\n","export { defaultPrimitives } from './primitives';\nexport { professionalTheme } from './professional';\nexport { modernTheme } from './modern';\nexport { minimalTheme } from './minimal';\nexport { koreanTheme, koreanPretendardTheme } from './korean';\n\nimport { minimalTheme } from './minimal';\nimport { modernTheme } from './modern';\nimport { professionalTheme } from './professional';\nimport { koreanTheme, koreanPretendardTheme } from './korean';\n\n/** Map of all built-in theme presets */\nexport const themePresets = {\n professional: professionalTheme,\n modern: modernTheme,\n minimal: minimalTheme,\n korean: koreanTheme,\n 'korean-pretendard': koreanPretendardTheme,\n} as const;\n\n/** Valid theme preset names */\nexport type ThemePresetName = keyof typeof themePresets;\n"]}
@@ -285,13 +285,42 @@ declare const modernTheme: PdfxTheme;
285
285
  */
286
286
  declare const minimalTheme: PdfxTheme;
287
287
 
288
+ /**
289
+ * Korean theme preset — Noto Sans KR.
290
+ *
291
+ * 한국어 문서에 최적화된 테마입니다.
292
+ * 본문과 헤딩 모두 'NotoSansKR' 폰트를 사용합니다.
293
+ * 사용 전 반드시 registerNotoSansKR() 또는 setupKorean()을 호출하세요.
294
+ *
295
+ * @example
296
+ * ```tsx
297
+ * import { setupKorean, koreanTheme, PdfxThemeProvider } from '@nxavis/pdf';
298
+ *
299
+ * setupKorean();
300
+ *
301
+ * <PdfxThemeProvider theme={koreanTheme}>
302
+ * <Heading level={1}>클라우드 비용 리포트</Heading>
303
+ * </PdfxThemeProvider>
304
+ * ```
305
+ */
306
+ declare const koreanTheme: PdfxTheme;
307
+ /**
308
+ * Korean Pretendard theme preset.
309
+ *
310
+ * Pretendard 폰트를 사용하는 한국어 테마입니다.
311
+ * 사용 전 반드시 registerPretendard() 또는 setupKorean('Pretendard')를 호출하세요.
312
+ */
313
+ declare const koreanPretendardTheme: PdfxTheme;
314
+
288
315
  /** Map of all built-in theme presets */
289
316
  declare const themePresets: {
290
317
  readonly professional: PdfxTheme;
291
318
  readonly modern: PdfxTheme;
292
319
  readonly minimal: PdfxTheme;
320
+ readonly korean: PdfxTheme;
321
+ readonly 'korean-pretendard': PdfxTheme;
293
322
  };
294
323
  /** Valid theme preset names */
295
324
  type ThemePresetName = keyof typeof themePresets;
296
325
 
297
- export { type BorderRadiusScale as B, type ColorTokens as C, type FontWeights as F, type LetterSpacingScale as L, type PdfxTheme as P, type SpacingScale as S, type ThemePresetName as T, type LineHeights as a, type PageTokens as b, type PrimitiveTokens as c, type SpacingTokens as d, type TypographyScale as e, type TypographyTokens as f, defaultPrimitives as g, modernTheme as h, minimalTheme as m, professionalTheme as p, themePresets as t };
326
+ export { type BorderRadiusScale as B, type ColorTokens as C, type FontWeights as F, type LetterSpacingScale as L, type PdfxTheme as P, type SpacingScale as S, type ThemePresetName as T, type LineHeights as a, type PageTokens as b, type PrimitiveTokens as c, type SpacingTokens as d, type TypographyScale as e, type TypographyTokens as f, defaultPrimitives as g, koreanTheme as h, modernTheme as i, koreanPretendardTheme as k, minimalTheme as m, professionalTheme as p, themePresets as t };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as _react_pdf_types from '@react-pdf/types';
2
2
  import { Style } from '@react-pdf/types';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ReactNode } from 'react';
5
- import { P as PdfxTheme } from './index-CvGTF-AE.js';
6
- export { B as BorderRadiusScale, C as ColorTokens, F as FontWeights, L as LetterSpacingScale, a as LineHeights, b as PageTokens, c as PrimitiveTokens, S as SpacingScale, d as SpacingTokens, T as ThemePresetName, e as TypographyScale, f as TypographyTokens, g as defaultPrimitives, m as minimalTheme, h as modernTheme, p as professionalTheme, t as themePresets } from './index-CvGTF-AE.js';
5
+ import { P as PdfxTheme } from './index-BeYrzvRi.js';
6
+ export { B as BorderRadiusScale, C as ColorTokens, F as FontWeights, L as LetterSpacingScale, a as LineHeights, b as PageTokens, c as PrimitiveTokens, S as SpacingScale, d as SpacingTokens, T as ThemePresetName, e as TypographyScale, f as TypographyTokens, g as defaultPrimitives, k as koreanPretendardTheme, h as koreanTheme, m as minimalTheme, i as modernTheme, p as professionalTheme, t as themePresets } from './index-BeYrzvRi.js';
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
  import { Style as Style$1 } from '@react-pdf/types/style';
9
9
 
@@ -61,6 +61,82 @@ declare function createThemeTw(theme: PdfxTheme, options?: {
61
61
  * ```
62
62
  */
63
63
  declare const tw: (input: string) => _react_pdf_types.Style;
64
+ /**
65
+ * Korean tw() using the korean theme (NotoSansKR).
66
+ * setupKorean() 호출 후 사용하세요.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * import { setupKorean, koTw } from '@nxavis/pdf';
71
+ *
72
+ * setupKorean();
73
+ * <Text style={koTw("text-lg font-bold font-body")}>한국어 텍스트</Text>
74
+ * ```
75
+ */
76
+ declare const koTw: (input: string) => _react_pdf_types.Style;
77
+
78
+ interface FontSource {
79
+ src: string;
80
+ fontWeight?: number;
81
+ fontStyle?: 'normal' | 'italic';
82
+ }
83
+ type FontFamily = 'NotoSansKR' | 'Pretendard' | (string & {});
84
+ /**
85
+ * 커스텀 폰트를 등록합니다.
86
+ * 이미 등록된 폰트는 중복 등록하지 않습니다.
87
+ */
88
+ declare function registerFont(family: string, sources: FontSource[]): void;
89
+ /**
90
+ * Noto Sans KR 한글 폰트를 등록합니다.
91
+ * react-pdf에서 한국어 텍스트를 렌더링하려면 반드시 호출해야 합니다.
92
+ *
93
+ * @param weights - 등록할 font-weight 목록 (기본: [400, 700])
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * import { registerNotoSansKR } from '@nxavis/pdf';
98
+ *
99
+ * registerNotoSansKR(); // 400, 700
100
+ * registerNotoSansKR([400, 500, 700]); // 400, 500, 700
101
+ * ```
102
+ */
103
+ declare function registerNotoSansKR(weights?: (400 | 500 | 700)[]): void;
104
+ /**
105
+ * Pretendard 한글 폰트를 등록합니다.
106
+ *
107
+ * @param weights - 등록할 font-weight 목록 (기본: [400, 700])
108
+ *
109
+ * @example
110
+ * ```tsx
111
+ * import { registerPretendard } from '@nxavis/pdf';
112
+ *
113
+ * registerPretendard(); // 400, 700
114
+ * registerPretendard([400, 500, 600, 700]); // 전체
115
+ * ```
116
+ */
117
+ declare function registerPretendard(weights?: (400 | 500 | 600 | 700)[]): void;
118
+ /**
119
+ * 한국어 하이픈 비활성화.
120
+ * 한글은 단어 중간에 하이픈으로 줄바꿈하면 안 되므로 반드시 호출합니다.
121
+ * registerNotoSansKR() / registerPretendard() 내부에서 자동 호출되지 않으므로
122
+ * 직접 호출하거나, setupKorean()을 사용하세요.
123
+ */
124
+ declare function disableHyphenation(): void;
125
+ /**
126
+ * 한국어 PDF 생성을 위한 원스텝 셋업.
127
+ * 폰트 등록 + 하이픈 비활성화를 한 번에 수행합니다.
128
+ *
129
+ * @param font - 'NotoSansKR' (기본) 또는 'Pretendard'
130
+ *
131
+ * @example
132
+ * ```tsx
133
+ * import { setupKorean } from '@nxavis/pdf';
134
+ *
135
+ * setupKorean(); // Noto Sans KR 400/700
136
+ * setupKorean('Pretendard'); // Pretendard 400/700
137
+ * ```
138
+ */
139
+ declare function setupKorean(font?: 'NotoSansKR' | 'Pretendard'): void;
64
140
 
65
141
  /** Heading font weight override. */
66
142
  type HeadingWeight = 'normal' | 'medium' | 'semibold' | 'bold';
@@ -1605,4 +1681,4 @@ interface ResumeTemplateProps {
1605
1681
  */
1606
1682
  declare function ResumeTemplate(props: ResumeTemplateProps): react_jsx_runtime.JSX.Element;
1607
1683
 
1608
- export { A4_WIDTH, type AlertVariant, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, type CardVariant, DataTable, type DataTableColumn, type DataTableProps, type DataTableSize, Divider, type DividerProps, type DividerSpacing, type DividerThickness, type DividerVariant, type FormLabelPosition, type FormLayout, GRAPH_SAFE_WIDTHS, type GraphDataPoint, type GraphLegendPosition, type GraphProps, type GraphSeries, type GraphVariant, type GraphWidthOptions, Heading, type HeadingProps, type HeadingTracking, type HeadingWeight, type InvoiceClient, type InvoiceCompany, type InvoiceCurrency, type InvoiceLineItem, type InvoicePayment, type InvoiceSummary, InvoiceTemplate, type InvoiceTemplateProps, type InvoiceVariant, KeepTogether, type KeepTogetherProps, KeyValue, type KeyValueDirection, type KeyValueEntry, type KeyValueProps, type KeyValueSize, Link, type LinkProps, type LinkUnderline, type LinkVariant, type ListItem, type ListVariant, type PDFComponentProps, PageBreak, type PageBreakProps, PageFooter, type PageFooterProps, type PageFooterVariant, PageHeader, type PageHeaderProps, type PageHeaderVariant, type PageNumberAlign, type PageNumberSize, PdfAlert, type PdfAlertProps, PdfCard, type PdfCardProps, PdfForm, type PdfFormField, type PdfFormGroup, type PdfFormProps, type PdfFormVariant, PdfGraph, PdfImage, type PdfImageFit, type PdfImageProps, type PdfImageSrc, type PdfImageVariant, PdfList, type PdfListProps, PdfPageNumber, type PdfPageNumberProps, PdfQRCode, type PdfQRCodeProps, PdfSignatureBlock, type PdfSignatureBlockProps, PdfWatermark, type PdfWatermarkProps, PdfxError, PdfxTheme, PdfxThemeContext, PdfxThemeProvider, type QRCodeErrorLevel, type ResumeCertification, type ResumeEducation, type ResumeExperience, type ResumeLanguage, type ResumePersonal, type ResumeProject, type ResumeSkillCategory, type ResumeSummary, ResumeTemplate, type ResumeTemplateProps, type ResumeVariant, Section, type SectionPadding, type SectionProps, type SectionSpacing, type SectionVariant, type SignatureSigner, type SignatureVariant, Stack, type StackAlign, type StackDirection, type StackGap, type StackJustify, type StackProps, Table, TableBody, TableCell, type TableCellProps, TableFooter, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, type TableVariant, Text, type TextDecoration, type TextProps, type TextVariant, type TextWeight, ValidationError, type WatermarkPosition, createThemeTw, getGraphWidth, tw, usePdfxTheme };
1684
+ export { A4_WIDTH, type AlertVariant, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, type CardVariant, DataTable, type DataTableColumn, type DataTableProps, type DataTableSize, Divider, type DividerProps, type DividerSpacing, type DividerThickness, type DividerVariant, type FontFamily, type FontSource, type FormLabelPosition, type FormLayout, GRAPH_SAFE_WIDTHS, type GraphDataPoint, type GraphLegendPosition, type GraphProps, type GraphSeries, type GraphVariant, type GraphWidthOptions, Heading, type HeadingProps, type HeadingTracking, type HeadingWeight, type InvoiceClient, type InvoiceCompany, type InvoiceCurrency, type InvoiceLineItem, type InvoicePayment, type InvoiceSummary, InvoiceTemplate, type InvoiceTemplateProps, type InvoiceVariant, KeepTogether, type KeepTogetherProps, KeyValue, type KeyValueDirection, type KeyValueEntry, type KeyValueProps, type KeyValueSize, Link, type LinkProps, type LinkUnderline, type LinkVariant, type ListItem, type ListVariant, type PDFComponentProps, PageBreak, type PageBreakProps, PageFooter, type PageFooterProps, type PageFooterVariant, PageHeader, type PageHeaderProps, type PageHeaderVariant, type PageNumberAlign, type PageNumberSize, PdfAlert, type PdfAlertProps, PdfCard, type PdfCardProps, PdfForm, type PdfFormField, type PdfFormGroup, type PdfFormProps, type PdfFormVariant, PdfGraph, PdfImage, type PdfImageFit, type PdfImageProps, type PdfImageSrc, type PdfImageVariant, PdfList, type PdfListProps, PdfPageNumber, type PdfPageNumberProps, PdfQRCode, type PdfQRCodeProps, PdfSignatureBlock, type PdfSignatureBlockProps, PdfWatermark, type PdfWatermarkProps, PdfxError, PdfxTheme, PdfxThemeContext, PdfxThemeProvider, type QRCodeErrorLevel, type ResumeCertification, type ResumeEducation, type ResumeExperience, type ResumeLanguage, type ResumePersonal, type ResumeProject, type ResumeSkillCategory, type ResumeSummary, ResumeTemplate, type ResumeTemplateProps, type ResumeVariant, Section, type SectionPadding, type SectionProps, type SectionSpacing, type SectionVariant, type SignatureSigner, type SignatureVariant, Stack, type StackAlign, type StackDirection, type StackGap, type StackJustify, type StackProps, Table, TableBody, TableCell, type TableCellProps, TableFooter, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, type TableVariant, Text, type TextDecoration, type TextProps, type TextVariant, type TextWeight, ValidationError, type WatermarkPosition, createThemeTw, disableHyphenation, getGraphWidth, koTw, registerFont, registerNotoSansKR, registerPretendard, setupKorean, tw, usePdfxTheme };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { professionalTheme } from './chunk-Z743L6FY.js';
2
- export { defaultPrimitives, minimalTheme, modernTheme, professionalTheme, themePresets } from './chunk-Z743L6FY.js';
1
+ import { professionalTheme, koreanTheme } from './chunk-6QQHSSMJ.js';
2
+ export { defaultPrimitives, koreanPretendardTheme, koreanTheme, minimalTheme, modernTheme, professionalTheme, themePresets } from './chunk-6QQHSSMJ.js';
3
3
  import * as React2 from 'react';
4
4
  import React2__default, { createContext, useMemo, useContext, Fragment } from 'react';
5
5
  import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
6
6
  import { createTw } from 'react-pdf-tailwind';
7
- import { Text, Link as Link$1, View, Svg, Rect, Image, Defs, LinearGradient, Stop, Document, Page, G, Path, Circle, Line, StyleSheet } from '@react-pdf/renderer';
7
+ import { Font, Text, Link as Link$1, View, Svg, Rect, Image, Defs, LinearGradient, Stop, Document, Page, G, Path, Circle, Line, StyleSheet } from '@react-pdf/renderer';
8
8
  import QRCode from 'qrcode';
9
9
 
10
10
  // src/errors.ts
@@ -91,6 +91,57 @@ function createThemeTw(theme2, options) {
91
91
  );
92
92
  }
93
93
  var tw = createThemeTw(professionalTheme);
94
+ var koTw = createThemeTw(koreanTheme);
95
+ var FONTSOURCE_CDN = "https://cdn.jsdelivr.net/fontsource/fonts";
96
+ var FONT_URLS = {
97
+ NotoSansKR: {
98
+ 400: `${FONTSOURCE_CDN}/noto-sans-kr@latest/korean-400-normal.ttf`,
99
+ 500: `${FONTSOURCE_CDN}/noto-sans-kr@latest/korean-500-normal.ttf`,
100
+ 700: `${FONTSOURCE_CDN}/noto-sans-kr@latest/korean-700-normal.ttf`
101
+ },
102
+ Pretendard: {
103
+ 400: `${FONTSOURCE_CDN}/pretendard@latest/korean-400-normal.ttf`,
104
+ 500: `${FONTSOURCE_CDN}/pretendard@latest/korean-500-normal.ttf`,
105
+ 600: `${FONTSOURCE_CDN}/pretendard@latest/korean-600-normal.ttf`,
106
+ 700: `${FONTSOURCE_CDN}/pretendard@latest/korean-700-normal.ttf`
107
+ }
108
+ };
109
+ var registeredFonts = /* @__PURE__ */ new Set();
110
+ function registerFont(family, sources) {
111
+ if (registeredFonts.has(family)) return;
112
+ Font.register({
113
+ family,
114
+ fonts: sources.map((s) => ({
115
+ src: s.src,
116
+ fontWeight: s.fontWeight ?? 400,
117
+ fontStyle: s.fontStyle ?? "normal"
118
+ }))
119
+ });
120
+ registeredFonts.add(family);
121
+ }
122
+ function registerNotoSansKR(weights = [400, 700]) {
123
+ registerFont(
124
+ "NotoSansKR",
125
+ weights.map((w) => ({ src: FONT_URLS.NotoSansKR[w], fontWeight: w }))
126
+ );
127
+ }
128
+ function registerPretendard(weights = [400, 700]) {
129
+ registerFont(
130
+ "Pretendard",
131
+ weights.map((w) => ({ src: FONT_URLS.Pretendard[w], fontWeight: w }))
132
+ );
133
+ }
134
+ function disableHyphenation() {
135
+ Font.registerHyphenationCallback((word) => [word]);
136
+ }
137
+ function setupKorean(font = "NotoSansKR") {
138
+ if (font === "Pretendard") {
139
+ registerPretendard();
140
+ } else {
141
+ registerNotoSansKR();
142
+ }
143
+ disableHyphenation();
144
+ }
94
145
 
95
146
  // src/lib/resolve-color.ts
96
147
  var THEME_COLOR_KEYS = [
@@ -1424,6 +1475,7 @@ function KeyValue({
1424
1475
  const containerStyles = [styles.container];
1425
1476
  if (style) containerStyles.push(style);
1426
1477
  return /* @__PURE__ */ jsx(View, { wrap: !noWrap, style: containerStyles, children: items.map((item, index) => {
1478
+ const itemKey = `${item.key}-${index}`;
1427
1479
  const isLast = index === items.length - 1;
1428
1480
  const keyStyles = [keyStyleMap[size]];
1429
1481
  if (labelColor) {
@@ -1454,14 +1506,14 @@ function KeyValue({
1454
1506
  return /* @__PURE__ */ jsxs(View, { style: rowStyles2, children: [
1455
1507
  /* @__PURE__ */ jsx(Text, { style: [...keyStyles, { flex: labelFlex }], children: item.key }),
1456
1508
  /* @__PURE__ */ jsx(Text, { style: [...valStyles, { flex: 1, textAlign: "right" }], children: item.value })
1457
- ] }, item.key);
1509
+ ] }, itemKey);
1458
1510
  }
1459
1511
  const rowStyles = [styles.rowVertical];
1460
1512
  if (divided && !isLast) rowStyles.push(styles.divider);
1461
1513
  return /* @__PURE__ */ jsxs(View, { style: rowStyles, children: [
1462
1514
  /* @__PURE__ */ jsx(Text, { style: keyStyles, children: item.key }),
1463
1515
  /* @__PURE__ */ jsx(Text, { style: valStyles, children: item.value })
1464
- ] }, item.key);
1516
+ ] }, itemKey);
1465
1517
  }) });
1466
1518
  }
1467
1519
  function createDividerStyles(t) {
@@ -5009,6 +5061,6 @@ function ResumeTemplate(props) {
5009
5061
  return /* @__PURE__ */ jsx(Document, { title: title || `${personal.name} - Resume`, children: /* @__PURE__ */ jsx(Page, { size: "A4", style: pageStyles, children: variantMap[variant] }) });
5010
5062
  }
5011
5063
 
5012
- export { A4_WIDTH, Badge, DataTable, Divider, GRAPH_SAFE_WIDTHS, Heading, InvoiceTemplate, KeepTogether, KeyValue, Link, PageBreak, PageFooter, PageHeader, PdfAlert, PdfCard, PdfForm, PdfGraph, PdfImage, PdfList, PdfPageNumber, PdfQRCode, PdfSignatureBlock, PdfWatermark, PdfxError, PdfxThemeContext, PdfxThemeProvider, ResumeTemplate, Section, Stack, Table, TableBody, TableCell, TableFooter, TableHeader, TableRow, Text2 as Text, ValidationError, createThemeTw, getGraphWidth, tw, usePdfxTheme };
5064
+ export { A4_WIDTH, Badge, DataTable, Divider, GRAPH_SAFE_WIDTHS, Heading, InvoiceTemplate, KeepTogether, KeyValue, Link, PageBreak, PageFooter, PageHeader, PdfAlert, PdfCard, PdfForm, PdfGraph, PdfImage, PdfList, PdfPageNumber, PdfQRCode, PdfSignatureBlock, PdfWatermark, PdfxError, PdfxThemeContext, PdfxThemeProvider, ResumeTemplate, Section, Stack, Table, TableBody, TableCell, TableFooter, TableHeader, TableRow, Text2 as Text, ValidationError, createThemeTw, disableHyphenation, getGraphWidth, koTw, registerFont, registerNotoSansKR, registerPretendard, setupKorean, tw, usePdfxTheme };
5013
5065
  //# sourceMappingURL=index.js.map
5014
5066
  //# sourceMappingURL=index.js.map