hwpkit-dev 0.0.1 → 0.0.3

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 (40) hide show
  1. package/ .npmignore +4 -1
  2. package/README.md +39 -2
  3. package/dist/index.d.mts +74 -16
  4. package/dist/index.d.ts +70 -16
  5. package/dist/index.js +4985 -698
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +4981 -698
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +4 -1
  10. package/playground/index.html +346 -0
  11. package/playground/main.ts +302 -0
  12. package/playground/vite.config.ts +16 -0
  13. package/src/contract/decoder.ts +1 -0
  14. package/src/contract/encoder.ts +6 -1
  15. package/src/core/BaseDecoder.ts +118 -0
  16. package/src/core/BaseEncoder.ts +146 -0
  17. package/src/decoders/docx/DocxDecoder.ts +867 -150
  18. package/src/decoders/html/HtmlDecoder.ts +366 -0
  19. package/src/decoders/hwp/HwpScanner.ts +477 -88
  20. package/src/decoders/hwpx/HwpxDecoder.ts +789 -293
  21. package/src/decoders/md/MdDecoder.ts +4 -4
  22. package/src/encoders/docx/DocxEncoder.ts +600 -295
  23. package/src/encoders/html/HtmlEncoder.ts +203 -0
  24. package/src/encoders/hwp/HwpEncoder.ts +1647 -398
  25. package/src/encoders/hwpx/HwpxEncoder.ts +1512 -444
  26. package/src/encoders/hwpx/constants.ts +148 -0
  27. package/src/encoders/hwpx/utils.ts +198 -0
  28. package/src/encoders/md/MdEncoder.ts +117 -30
  29. package/src/index.ts +1 -0
  30. package/src/model/builders.ts +8 -6
  31. package/src/model/doc-props.ts +19 -5
  32. package/src/model/doc-tree.ts +13 -5
  33. package/src/pipeline/Pipeline.ts +21 -4
  34. package/src/pipeline/registry.ts +13 -2
  35. package/src/safety/StyleBridge.ts +52 -7
  36. package/src/toolkit/ArchiveKit.ts +56 -0
  37. package/src/toolkit/StyleMapper.ts +221 -0
  38. package/src/toolkit/UnitConverter.ts +138 -0
  39. package/src/toolkit/XmlKit.ts +0 -5
  40. package/test-styling.ts +210 -0
package/ .npmignore CHANGED
@@ -1,5 +1,4 @@
1
1
  node_modules
2
- dist
3
2
  *.hml
4
3
  *.hml.md
5
4
  *.hwpx
@@ -9,3 +8,7 @@ dist
9
8
  tests
10
9
  data
11
10
  playground
11
+ CLAUDE.*
12
+ .c
13
+ Tester.so.c
14
+ *.hwp
package/README.md CHANGED
@@ -26,10 +26,11 @@
26
26
  | 입력 \ 출력 | HWPX | DOCX | Markdown |
27
27
  |------------|:----:|:----:|:--------:|
28
28
  | **HWPX** | - | O | O |
29
- | **HWP** | O | O | O |
29
+ | **HWP** | | O | O |
30
30
  | **DOCX** | O | - | O |
31
- | **Markdown** | O | O | - |
31
+ | **Markdown** | | | - |
32
32
 
33
+ > 한글 소프트웨어서는 작동이 안됨 (수정중)
33
34
  ---
34
35
 
35
36
  ## 설치
@@ -113,6 +114,42 @@ const doc = buildRoot({ title: '제목' }, [
113
114
  ]);
114
115
  ```
115
116
 
117
+ ### 스타일 적용
118
+
119
+ ```typescript
120
+ // 텍스트 스타일
121
+ buildSpan('스타일 적용 텍스트', {
122
+ font: 'Malgun Gothic', // 글꼴
123
+ pt: 14, // 글자 크기 (pt)
124
+ b: true, // 볼드
125
+ i: true, // 이탤릭
126
+ u: true, // 밑줄
127
+ s: true, // 취소선
128
+ color: 'FF0000', // 글색 (hex, BGR)
129
+ bg: 'FFFF00' // 형광펜 (hex, BGR)
130
+ });
131
+
132
+ // 표 정렬 및 선 스타일
133
+ buildGrid(rows, {
134
+ align: 'center', // 표 정렬: 'left' | 'center' | 'right'
135
+ defaultStroke: { // 기본 선 스타일
136
+ kind: 'solid', // 선 종류: 'solid' | 'double' | 'dash' | 'dot'
137
+ pt: 1, // 선 굵기 (pt)
138
+ color: '000000' // 선 색상 (hex, BGR)
139
+ },
140
+ colWidths: [100, 100] // 열 너비 (pt)
141
+ });
142
+
143
+ // 개별 셀의 선 스타일
144
+ buildCell(content, {
145
+ top: { kind: 'double', pt: 2, color: '0000FF' }, // 상단 선
146
+ bot: { kind: 'dash', pt: 1.5, color: 'FF0000' }, // 하단 선
147
+ left: { kind: 'dot', pt: 1, color: '00FF00' }, // 좌측 선
148
+ right: { kind: 'solid', pt: 3, color: 'FFFF00' }, // 우측 선
149
+ bg: 'FFFFFF' // 셀 배경색
150
+ });
151
+ ```
152
+
116
153
  ### 트리 순회
117
154
 
118
155
  ```typescript
package/dist/index.d.mts CHANGED
@@ -1,7 +1,27 @@
1
1
  type Align = 'left' | 'center' | 'right' | 'justify';
2
+ type ImgWrap = 'inline' | 'square' | 'tight' | 'through' | 'none' | 'behind' | 'front' | 'topAndBottom';
3
+ type ImgHorzAlign = 'left' | 'center' | 'right';
4
+ type ImgVertAlign = 'top' | 'center' | 'bottom';
5
+ type ImgHorzRelTo = 'margin' | 'column' | 'page' | 'para';
6
+ type ImgVertRelTo = 'margin' | 'line' | 'page' | 'para';
7
+ interface ImgLayout {
8
+ wrap: ImgWrap;
9
+ horzAlign?: ImgHorzAlign;
10
+ vertAlign?: ImgVertAlign;
11
+ horzRelTo?: ImgHorzRelTo;
12
+ vertRelTo?: ImgVertRelTo;
13
+ xPt?: number;
14
+ yPt?: number;
15
+ distT?: number;
16
+ distB?: number;
17
+ distL?: number;
18
+ distR?: number;
19
+ behindDoc?: boolean;
20
+ zOrder?: number;
21
+ }
2
22
  type VAlign = 'top' | 'mid' | 'bot';
3
23
  type Heading = 1 | 2 | 3 | 4 | 5 | 6;
4
- type StrokeKind = 'solid' | 'dash' | 'dot' | 'double' | 'none';
24
+ type StrokeKind = 'solid' | 'dash' | 'dot' | 'double' | 'none' | 'dashDot' | 'dashDotDot' | 'wave';
5
25
  interface TextProps {
6
26
  b?: boolean;
7
27
  i?: boolean;
@@ -17,10 +37,15 @@ interface TextProps {
17
37
  interface ParaProps {
18
38
  align?: Align;
19
39
  heading?: Heading;
40
+ styleId?: string;
20
41
  indentPt?: number;
42
+ indentRightPt?: number;
43
+ firstLineIndentPt?: number;
44
+ leftMargin?: number;
21
45
  spaceBefore?: number;
22
46
  spaceAfter?: number;
23
47
  lineHeight?: number;
48
+ lineHeightFixed?: number;
24
49
  listLv?: number;
25
50
  listOrd?: boolean;
26
51
  listMark?: string;
@@ -37,6 +62,10 @@ interface CellProps {
37
62
  right?: Stroke;
38
63
  bg?: string;
39
64
  padPt?: number;
65
+ padT?: number;
66
+ padB?: number;
67
+ padL?: number;
68
+ padR?: number;
40
69
  align?: Align;
41
70
  va?: VAlign;
42
71
  isHeader?: boolean;
@@ -55,6 +84,7 @@ interface GridProps {
55
84
  defaultStroke?: Stroke;
56
85
  look?: TableLook;
57
86
  headerRow?: boolean;
87
+ align?: Align;
58
88
  }
59
89
  interface PageDims {
60
90
  wPt: number;
@@ -64,6 +94,8 @@ interface PageDims {
64
94
  ml: number;
65
95
  mr: number;
66
96
  orient?: 'portrait' | 'landscape';
97
+ headerPt?: number;
98
+ footerPt?: number;
67
99
  }
68
100
  interface DocMeta {
69
101
  title?: string;
@@ -73,8 +105,17 @@ interface DocMeta {
73
105
  keywords?: string;
74
106
  created?: string;
75
107
  modified?: string;
108
+ zoom?: number;
109
+ viewMode?: string;
76
110
  }
77
111
  declare const A4: PageDims;
112
+ declare const A4_LANDSCAPE: PageDims;
113
+ /**
114
+ * orient === 'landscape'일 때 wPt < hPt이면 swap,
115
+ * orient === 'portrait'일 때 wPt > hPt이면 swap하여
116
+ * 방향과 치수가 항상 일치하도록 정규화합니다.
117
+ */
118
+ declare function normalizeDims(dims: PageDims): PageDims;
78
119
  declare const DEFAULT_STROKE: Stroke;
79
120
 
80
121
  type BlockTag = 'root' | 'sheet' | 'para' | 'span' | 'txt' | 'img' | 'link' | 'grid' | 'row' | 'cell' | 'br' | 'pb' | 'pagenum';
@@ -99,6 +140,7 @@ interface ImgNode {
99
140
  w: number;
100
141
  h: number;
101
142
  alt?: string;
143
+ layout?: ImgLayout;
102
144
  }
103
145
  interface SpanNode {
104
146
  tag: 'span';
@@ -113,18 +155,19 @@ interface LinkNode {
113
155
  interface ParaNode {
114
156
  tag: 'para';
115
157
  props: ParaProps;
116
- kids: (SpanNode | ImgNode | LinkNode)[];
158
+ kids: (SpanNode | ImgNode | LinkNode | GridNode)[];
117
159
  }
118
160
  interface CellNode {
119
161
  tag: 'cell';
120
162
  cs: number;
121
163
  rs: number;
122
164
  props: CellProps;
123
- kids: ParaNode[];
165
+ kids: (ParaNode | GridNode)[];
124
166
  }
125
167
  interface RowNode {
126
168
  tag: 'row';
127
169
  kids: CellNode[];
170
+ heightPt?: number;
128
171
  }
129
172
  interface GridNode {
130
173
  tag: 'grid';
@@ -136,8 +179,16 @@ interface SheetNode {
136
179
  tag: 'sheet';
137
180
  dims: PageDims;
138
181
  kids: ContentNode[];
139
- header?: ParaNode[];
140
- footer?: ParaNode[];
182
+ headers?: {
183
+ default?: ParaNode[];
184
+ first?: ParaNode[];
185
+ even?: ParaNode[];
186
+ };
187
+ footers?: {
188
+ default?: ParaNode[];
189
+ first?: ParaNode[];
190
+ even?: ParaNode[];
191
+ };
141
192
  }
142
193
  interface DocRoot {
143
194
  tag: 'root';
@@ -160,14 +211,19 @@ interface Fail {
160
211
  declare function succeed<T>(data: T, warns?: string[]): Ok<T>;
161
212
  declare function fail(error: string, warns?: string[]): Fail;
162
213
 
163
- interface Decoder {
214
+ interface EncoderOptions {
215
+ [key: string]: any;
216
+ }
217
+ interface Encoder {
164
218
  readonly format: string;
165
- decode(data: Uint8Array): Promise<Outcome<DocRoot>>;
219
+ readonly aliases?: string[];
220
+ encode(doc: DocRoot, options?: EncoderOptions): Promise<Outcome<Uint8Array>>;
166
221
  }
167
222
 
168
- interface Encoder {
223
+ interface Decoder {
169
224
  readonly format: string;
170
- encode(doc: DocRoot): Promise<Outcome<Uint8Array>>;
225
+ readonly aliases?: string[];
226
+ decode(data: Uint8Array): Promise<Outcome<DocRoot>>;
171
227
  }
172
228
 
173
229
  declare class Pipeline {
@@ -179,7 +235,7 @@ declare class Pipeline {
179
235
  /** File/Blob 비동기 입력 */
180
236
  static openAsync(input: File | Blob | Uint8Array | string, fmt?: string): Promise<Pipeline>;
181
237
  /** 목표 포맷으로 변환 */
182
- to(targetFmt: string): Promise<Outcome<Uint8Array>>;
238
+ to(targetFmt: string, options?: EncoderOptions): Promise<Outcome<Uint8Array>>;
183
239
  /** DocRoot만 추출 (인코딩 없이) */
184
240
  inspect(): Promise<Outcome<DocRoot>>;
185
241
  }
@@ -198,16 +254,18 @@ declare const registry: FormatRegistry;
198
254
 
199
255
  declare function buildRoot(meta?: DocMeta, kids?: SheetNode[]): DocRoot;
200
256
  declare function buildSheet(kids?: ContentNode[], dims?: PageDims, opts?: {
201
- header?: ParaNode[];
202
- footer?: ParaNode[];
257
+ headers?: SheetNode["headers"];
258
+ footers?: SheetNode["footers"];
203
259
  }): SheetNode;
204
260
  declare function buildPageNum(format?: PageNumNode['format']): PageNumNode;
261
+ declare function buildBr(): BrNode;
262
+ declare function buildPb(): PbNode;
205
263
  declare function buildPara(kids?: ParaNode['kids'], props?: ParaProps): ParaNode;
206
264
  declare function buildSpan(content: string, props?: TextProps): SpanNode;
207
- declare function buildImg(b64: string, mime: ImgNode['mime'], w: number, h: number, alt?: string): ImgNode;
265
+ declare function buildImg(b64: string, mime: ImgNode['mime'], w: number, h: number, alt?: string, layout?: ImgLayout): ImgNode;
208
266
  declare function buildGrid(kids: RowNode[], props?: GridProps): GridNode;
209
- declare function buildRow(kids: CellNode[]): RowNode;
210
- declare function buildCell(kids: ParaNode[], opts?: {
267
+ declare function buildRow(kids: CellNode[], heightPt?: number): RowNode;
268
+ declare function buildCell(kids: (ParaNode | GridNode)[], opts?: {
211
269
  cs?: number;
212
270
  rs?: number;
213
271
  props?: CellProps;
@@ -310,4 +368,4 @@ declare const TextKit: {
310
368
  base64Decode(b64: string): Uint8Array;
311
369
  };
312
370
 
313
- export { A4, type Align, type AnyNode, ArchiveKit, BinaryKit, type BlockTag, type BrNode, type CellNode, type CellProps, type ContentNode, DEFAULT_STROKE, type Decoder, type DocMeta, type DocRoot, type Encoder, type Fail, type GridNode, type GridProps, type Heading, type ImgNode, type LinkNode, Metric, type Ok, type Outcome, type PageDims, type PageNumNode, type ParaNode, type ParaProps, type PbNode, Pipeline, type RowNode, type SheetNode, ShieldedParser, type SpanNode, type Stroke, type StrokeKind, type TableLook, TextKit, type TextProps, TreeWalker, type TxtNode, type VAlign, XmlKit, buildCell, buildGrid, buildImg, buildPageNum, buildPara, buildRoot, buildRow, buildSheet, buildSpan, countNodes, fail, registry, safeAlign, safeFont, safeFontToKr, safeHex, safeStrokeDocx, safeStrokeHwpx, succeed, validateRoot, walkNode };
371
+ export { A4, A4_LANDSCAPE, type Align, type AnyNode, ArchiveKit, BinaryKit, type BlockTag, type BrNode, type CellNode, type CellProps, type ContentNode, DEFAULT_STROKE, type Decoder, type DocMeta, type DocRoot, type Encoder, type Fail, type GridNode, type GridProps, type Heading, type ImgNode, type LinkNode, Metric, type Ok, type Outcome, type PageDims, type PageNumNode, type ParaNode, type ParaProps, type PbNode, Pipeline, type RowNode, type SheetNode, ShieldedParser, type SpanNode, type Stroke, type StrokeKind, type TableLook, TextKit, type TextProps, TreeWalker, type TxtNode, type VAlign, XmlKit, buildBr, buildCell, buildGrid, buildImg, buildPageNum, buildPara, buildPb, buildRoot, buildRow, buildSheet, buildSpan, countNodes, fail, normalizeDims, registry, safeAlign, safeFont, safeFontToKr, safeHex, safeStrokeDocx, safeStrokeHwpx, succeed, validateRoot, walkNode };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,27 @@
1
1
  type Align = 'left' | 'center' | 'right' | 'justify';
2
+ type ImgWrap = 'inline' | 'square' | 'tight' | 'through' | 'none' | 'behind' | 'front' | 'topAndBottom';
3
+ type ImgHorzAlign = 'left' | 'center' | 'right';
4
+ type ImgVertAlign = 'top' | 'center' | 'bottom';
5
+ type ImgHorzRelTo = 'margin' | 'column' | 'page' | 'para';
6
+ type ImgVertRelTo = 'margin' | 'line' | 'page' | 'para';
7
+ interface ImgLayout {
8
+ wrap: ImgWrap;
9
+ horzAlign?: ImgHorzAlign;
10
+ vertAlign?: ImgVertAlign;
11
+ horzRelTo?: ImgHorzRelTo;
12
+ vertRelTo?: ImgVertRelTo;
13
+ xPt?: number;
14
+ yPt?: number;
15
+ distT?: number;
16
+ distB?: number;
17
+ distL?: number;
18
+ distR?: number;
19
+ behindDoc?: boolean;
20
+ zOrder?: number;
21
+ }
2
22
  type VAlign = 'top' | 'mid' | 'bot';
3
23
  type Heading = 1 | 2 | 3 | 4 | 5 | 6;
4
- type StrokeKind = 'solid' | 'dash' | 'dot' | 'double' | 'none';
24
+ type StrokeKind = 'solid' | 'dash' | 'dot' | 'double' | 'none' | 'dashDot' | 'dashDotDot' | 'wave';
5
25
  interface TextProps {
6
26
  b?: boolean;
7
27
  i?: boolean;
@@ -17,10 +37,15 @@ interface TextProps {
17
37
  interface ParaProps {
18
38
  align?: Align;
19
39
  heading?: Heading;
40
+ styleId?: string;
20
41
  indentPt?: number;
42
+ indentRightPt?: number;
43
+ firstLineIndentPt?: number;
44
+ leftMargin?: number;
21
45
  spaceBefore?: number;
22
46
  spaceAfter?: number;
23
47
  lineHeight?: number;
48
+ lineHeightFixed?: number;
24
49
  listLv?: number;
25
50
  listOrd?: boolean;
26
51
  listMark?: string;
@@ -37,6 +62,10 @@ interface CellProps {
37
62
  right?: Stroke;
38
63
  bg?: string;
39
64
  padPt?: number;
65
+ padT?: number;
66
+ padB?: number;
67
+ padL?: number;
68
+ padR?: number;
40
69
  align?: Align;
41
70
  va?: VAlign;
42
71
  isHeader?: boolean;
@@ -55,6 +84,7 @@ interface GridProps {
55
84
  defaultStroke?: Stroke;
56
85
  look?: TableLook;
57
86
  headerRow?: boolean;
87
+ align?: Align;
58
88
  }
59
89
  interface PageDims {
60
90
  wPt: number;
@@ -64,6 +94,8 @@ interface PageDims {
64
94
  ml: number;
65
95
  mr: number;
66
96
  orient?: 'portrait' | 'landscape';
97
+ headerPt?: number;
98
+ footerPt?: number;
67
99
  }
68
100
  interface DocMeta {
69
101
  title?: string;
@@ -73,9 +105,16 @@ interface DocMeta {
73
105
  keywords?: string;
74
106
  created?: string;
75
107
  modified?: string;
108
+ zoom?: number;
109
+ viewMode?: string;
76
110
  }
77
111
  declare const A4: PageDims;
78
112
  declare const A4_LANDSCAPE: PageDims;
113
+ /**
114
+ * orient === 'landscape'일 때 wPt < hPt이면 swap,
115
+ * orient === 'portrait'일 때 wPt > hPt이면 swap하여
116
+ * 방향과 치수가 항상 일치하도록 정규화합니다.
117
+ */
79
118
  declare function normalizeDims(dims: PageDims): PageDims;
80
119
  declare const DEFAULT_STROKE: Stroke;
81
120
 
@@ -101,6 +140,7 @@ interface ImgNode {
101
140
  w: number;
102
141
  h: number;
103
142
  alt?: string;
143
+ layout?: ImgLayout;
104
144
  }
105
145
  interface SpanNode {
106
146
  tag: 'span';
@@ -115,18 +155,19 @@ interface LinkNode {
115
155
  interface ParaNode {
116
156
  tag: 'para';
117
157
  props: ParaProps;
118
- kids: (SpanNode | ImgNode | LinkNode)[];
158
+ kids: (SpanNode | ImgNode | LinkNode | GridNode)[];
119
159
  }
120
160
  interface CellNode {
121
161
  tag: 'cell';
122
162
  cs: number;
123
163
  rs: number;
124
164
  props: CellProps;
125
- kids: ParaNode[];
165
+ kids: (ParaNode | GridNode)[];
126
166
  }
127
167
  interface RowNode {
128
168
  tag: 'row';
129
169
  kids: CellNode[];
170
+ heightPt?: number;
130
171
  }
131
172
  interface GridNode {
132
173
  tag: 'grid';
@@ -138,8 +179,16 @@ interface SheetNode {
138
179
  tag: 'sheet';
139
180
  dims: PageDims;
140
181
  kids: ContentNode[];
141
- header?: ParaNode[];
142
- footer?: ParaNode[];
182
+ headers?: {
183
+ default?: ParaNode[];
184
+ first?: ParaNode[];
185
+ even?: ParaNode[];
186
+ };
187
+ footers?: {
188
+ default?: ParaNode[];
189
+ first?: ParaNode[];
190
+ even?: ParaNode[];
191
+ };
143
192
  }
144
193
  interface DocRoot {
145
194
  tag: 'root';
@@ -162,14 +211,19 @@ interface Fail {
162
211
  declare function succeed<T>(data: T, warns?: string[]): Ok<T>;
163
212
  declare function fail(error: string, warns?: string[]): Fail;
164
213
 
165
- interface Decoder {
214
+ interface EncoderOptions {
215
+ [key: string]: any;
216
+ }
217
+ interface Encoder {
166
218
  readonly format: string;
167
- decode(data: Uint8Array): Promise<Outcome<DocRoot>>;
219
+ readonly aliases?: string[];
220
+ encode(doc: DocRoot, options?: EncoderOptions): Promise<Outcome<Uint8Array>>;
168
221
  }
169
222
 
170
- interface Encoder {
223
+ interface Decoder {
171
224
  readonly format: string;
172
- encode(doc: DocRoot): Promise<Outcome<Uint8Array>>;
225
+ readonly aliases?: string[];
226
+ decode(data: Uint8Array): Promise<Outcome<DocRoot>>;
173
227
  }
174
228
 
175
229
  declare class Pipeline {
@@ -181,7 +235,7 @@ declare class Pipeline {
181
235
  /** File/Blob 비동기 입력 */
182
236
  static openAsync(input: File | Blob | Uint8Array | string, fmt?: string): Promise<Pipeline>;
183
237
  /** 목표 포맷으로 변환 */
184
- to(targetFmt: string): Promise<Outcome<Uint8Array>>;
238
+ to(targetFmt: string, options?: EncoderOptions): Promise<Outcome<Uint8Array>>;
185
239
  /** DocRoot만 추출 (인코딩 없이) */
186
240
  inspect(): Promise<Outcome<DocRoot>>;
187
241
  }
@@ -200,18 +254,18 @@ declare const registry: FormatRegistry;
200
254
 
201
255
  declare function buildRoot(meta?: DocMeta, kids?: SheetNode[]): DocRoot;
202
256
  declare function buildSheet(kids?: ContentNode[], dims?: PageDims, opts?: {
203
- header?: ParaNode[];
204
- footer?: ParaNode[];
257
+ headers?: SheetNode["headers"];
258
+ footers?: SheetNode["footers"];
205
259
  }): SheetNode;
206
260
  declare function buildPageNum(format?: PageNumNode['format']): PageNumNode;
207
261
  declare function buildBr(): BrNode;
208
262
  declare function buildPb(): PbNode;
209
263
  declare function buildPara(kids?: ParaNode['kids'], props?: ParaProps): ParaNode;
210
264
  declare function buildSpan(content: string, props?: TextProps): SpanNode;
211
- declare function buildImg(b64: string, mime: ImgNode['mime'], w: number, h: number, alt?: string): ImgNode;
265
+ declare function buildImg(b64: string, mime: ImgNode['mime'], w: number, h: number, alt?: string, layout?: ImgLayout): ImgNode;
212
266
  declare function buildGrid(kids: RowNode[], props?: GridProps): GridNode;
213
- declare function buildRow(kids: CellNode[]): RowNode;
214
- declare function buildCell(kids: ParaNode[], opts?: {
267
+ declare function buildRow(kids: CellNode[], heightPt?: number): RowNode;
268
+ declare function buildCell(kids: (ParaNode | GridNode)[], opts?: {
215
269
  cs?: number;
216
270
  rs?: number;
217
271
  props?: CellProps;
@@ -314,4 +368,4 @@ declare const TextKit: {
314
368
  base64Decode(b64: string): Uint8Array;
315
369
  };
316
370
 
317
- export { A4, A4_LANDSCAPE, type Align, type AnyNode, ArchiveKit, BinaryKit, type BlockTag, type BrNode, type CellNode, type CellProps, type ContentNode, DEFAULT_STROKE, type Decoder, type DocMeta, type DocRoot, type Encoder, type Fail, type GridNode, type GridProps, type Heading, type ImgNode, type LinkNode, Metric, normalizeDims, type Ok, type Outcome, type PageDims, type PageNumNode, type ParaNode, type ParaProps, type PbNode, Pipeline, type RowNode, type SheetNode, ShieldedParser, type SpanNode, type Stroke, type StrokeKind, type TableLook, TextKit, type TextProps, TreeWalker, type TxtNode, type VAlign, XmlKit, buildBr, buildCell, buildGrid, buildImg, buildPageNum, buildPara, buildPb, buildRoot, buildRow, buildSheet, buildSpan, countNodes, fail, registry, safeAlign, safeFont, safeFontToKr, safeHex, safeStrokeDocx, safeStrokeHwpx, succeed, validateRoot, walkNode };
371
+ export { A4, A4_LANDSCAPE, type Align, type AnyNode, ArchiveKit, BinaryKit, type BlockTag, type BrNode, type CellNode, type CellProps, type ContentNode, DEFAULT_STROKE, type Decoder, type DocMeta, type DocRoot, type Encoder, type Fail, type GridNode, type GridProps, type Heading, type ImgNode, type LinkNode, Metric, type Ok, type Outcome, type PageDims, type PageNumNode, type ParaNode, type ParaProps, type PbNode, Pipeline, type RowNode, type SheetNode, ShieldedParser, type SpanNode, type Stroke, type StrokeKind, type TableLook, TextKit, type TextProps, TreeWalker, type TxtNode, type VAlign, XmlKit, buildBr, buildCell, buildGrid, buildImg, buildPageNum, buildPara, buildPb, buildRoot, buildRow, buildSheet, buildSpan, countNodes, fail, normalizeDims, registry, safeAlign, safeFont, safeFontToKr, safeHex, safeStrokeDocx, safeStrokeHwpx, succeed, validateRoot, walkNode };