@docxkit/plugin-changelog 0.3.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.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/index.d.ts +721 -0
- package/dist/index.js +110 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-PRESENT ntnyq <https://github.com/ntnyq>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @docxkit/plugin-changelog
|
|
2
|
+
|
|
3
|
+
Version changelog table plugin for docx-kit.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { changelogPlugin } from '@docxkit/plugin-changelog'
|
|
9
|
+
|
|
10
|
+
builder.use(changelogPlugin())
|
|
11
|
+
builder.plugin('changelog', {
|
|
12
|
+
entries: [
|
|
13
|
+
{ version: '1.0.0', date: '2026-06', changes: 'Initial release', type: 'added' },
|
|
14
|
+
],
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
|
|
20
|
+
- Renders a title paragraph followed by a 4-column changelog table
|
|
21
|
+
- Supported entry types: `added`, `changed`, `fixed`, `removed`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
//#region ../../packages/types/dist/utility.d.ts
|
|
2
|
+
/** Hexadecimal CSS color string, e.g. `"#ff0000"`. */
|
|
3
|
+
type HexColor = `#${string}`;
|
|
4
|
+
/**
|
|
5
|
+
* A literal union type that still allows arbitrary string values.
|
|
6
|
+
* Useful for autocomplete-friendly APIs with extensible values.
|
|
7
|
+
*
|
|
8
|
+
* @template T — The literal subtype (e.g. `'Arial' | 'Calibri'`)
|
|
9
|
+
* @template U — The base type, defaults to `string`
|
|
10
|
+
*/
|
|
11
|
+
type LiteralUnion<T extends U, U = string> = T | (U & {});
|
|
12
|
+
/**
|
|
13
|
+
* A value that might be synchronous or wrapped in a Promise.
|
|
14
|
+
*
|
|
15
|
+
* @template T — The inner value type
|
|
16
|
+
*/
|
|
17
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
18
|
+
/**
|
|
19
|
+
* Augments a base value type with theme token references.
|
|
20
|
+
*
|
|
21
|
+
* Lets users write `$colors.primary` in any style field that accepts the
|
|
22
|
+
* base type — the token is resolved at compile time against the document
|
|
23
|
+
* theme.
|
|
24
|
+
*/
|
|
25
|
+
type StyleToken<T extends number | string> = T | ThemeToken;
|
|
26
|
+
/** Supported theme token categories (must match {@link resolveSingleToken}). */
|
|
27
|
+
type StyleTokenCategory = '$colors' | '$fonts' | '$fontSize' | '$spacing';
|
|
28
|
+
/**
|
|
29
|
+
* A `$category.key` reference to a theme token, e.g. `"$colors.primary"`,
|
|
30
|
+
* `"$fontSize.lg"`, `"$spacing.xl"`. Resolved at compile time by
|
|
31
|
+
* {@link resolveThemeTokens}.
|
|
32
|
+
*/
|
|
33
|
+
type ThemeToken = `${StyleTokenCategory}.${string}`;
|
|
34
|
+
/**
|
|
35
|
+
* CSS-like length value.
|
|
36
|
+
*
|
|
37
|
+
* Supports bare numbers, explicit unit strings
|
|
38
|
+
* (`%`, `cm`, `in`, `mm`, `pt`, `px`), and theme token references
|
|
39
|
+
* (e.g. `"$spacing.lg"`, `"$fontSize.base"`).
|
|
40
|
+
*
|
|
41
|
+
* Bare-number conventions vary by context:
|
|
42
|
+
* - `fontSize` → interpreted as `pt`
|
|
43
|
+
* - spacing / indent → interpreted as `pt`
|
|
44
|
+
* - image size → interpreted as `px`
|
|
45
|
+
*/
|
|
46
|
+
type UnitValue = `${number}%` | `${number}cm` | `${number}in` | `${number}mm` | `${number}pt` | `${number}px` | number | ThemeToken;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../packages/types/dist/style.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* A single border side descriptor.
|
|
51
|
+
*
|
|
52
|
+
* Follows the CSS `border` shorthand convention (style, width, color).
|
|
53
|
+
*/
|
|
54
|
+
interface BorderRule {
|
|
55
|
+
/** Border color (e.g. `"#333"`, named color, or theme token like `"$colors.primary"`). */
|
|
56
|
+
color?: HexColor | StyleToken<string>;
|
|
57
|
+
/** Line style. */
|
|
58
|
+
style?: BorderStyle;
|
|
59
|
+
/** Line width (bare number treated as pt). */
|
|
60
|
+
width?: UnitValue;
|
|
61
|
+
}
|
|
62
|
+
/** Available border line styles. */
|
|
63
|
+
type BorderStyle = 'dashed' | 'dotted' | 'double' | 'none' | 'single';
|
|
64
|
+
/**
|
|
65
|
+
* Table-cell level style properties.
|
|
66
|
+
*
|
|
67
|
+
* Used by {@link compileCellStyle} for `TableCell` construction.
|
|
68
|
+
*/
|
|
69
|
+
interface CellStyleRule {
|
|
70
|
+
/** Background / shading color (hex, named, or theme token like `"$colors.info"`). */
|
|
71
|
+
backgroundColor?: HexColor | StyleToken<string>;
|
|
72
|
+
/** Shorthand border for all four sides. */
|
|
73
|
+
border?: BorderRule;
|
|
74
|
+
/** Bottom border override. */
|
|
75
|
+
borderBottom?: BorderRule;
|
|
76
|
+
/** Left border override. */
|
|
77
|
+
borderLeft?: BorderRule;
|
|
78
|
+
/** Right border override. */
|
|
79
|
+
borderRight?: BorderRule;
|
|
80
|
+
/** Top border override. */
|
|
81
|
+
borderTop?: BorderRule;
|
|
82
|
+
/** Element height. */
|
|
83
|
+
height?: UnitValue;
|
|
84
|
+
/** Bottom margin (cell padding). */
|
|
85
|
+
marginBottom?: UnitValue;
|
|
86
|
+
/** Left margin (cell padding). */
|
|
87
|
+
marginLeft?: UnitValue;
|
|
88
|
+
/** Right margin (cell padding). */
|
|
89
|
+
marginRight?: UnitValue;
|
|
90
|
+
/** Top margin (cell padding). */
|
|
91
|
+
marginTop?: UnitValue;
|
|
92
|
+
/** Vertical alignment (mostly for table cells). */
|
|
93
|
+
verticalAlign?: VerticalAlign;
|
|
94
|
+
/** Element width. */
|
|
95
|
+
width?: UnitValue;
|
|
96
|
+
/**
|
|
97
|
+
* CSS-like margin shorthand (used as cell padding).
|
|
98
|
+
*/
|
|
99
|
+
margin?: `${string} ${string}` | `${string} ${string} ${string} ${string}` | UnitValue;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* CSS-like style descriptor for a run, paragraph, cell, or table.
|
|
103
|
+
*
|
|
104
|
+
* Combines text, paragraph, and cell-level properties.
|
|
105
|
+
* This is the user-facing style type — individual compiler functions
|
|
106
|
+
* narrow to {@link TextStyleRule}, {@link ParagraphStyleRule}, or
|
|
107
|
+
* {@link CellStyleRule} as appropriate.
|
|
108
|
+
*/
|
|
109
|
+
interface DocxStyleRule extends CellStyleRule, ParagraphStyleRule, TextStyleRule {}
|
|
110
|
+
/**
|
|
111
|
+
* Font weight: keyword `"bold"` / `"normal"`, or numeric 100–900
|
|
112
|
+
* following the CSS `font-weight` spec.
|
|
113
|
+
*/
|
|
114
|
+
type FontWeight = 'bold' | 'normal' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
115
|
+
/** Text highlight / marker colors (matches Word highlight palette). */
|
|
116
|
+
type HighlightColor = 'black' | 'blue' | 'cyan' | 'darkBlue' | 'darkCyan' | 'darkGray' | 'darkGreen' | 'darkMagenta' | 'darkRed' | 'darkYellow' | 'green' | 'lightGray' | 'magenta' | 'none' | 'red' | 'white' | 'yellow';
|
|
117
|
+
/**
|
|
118
|
+
* Paragraph-level style properties.
|
|
119
|
+
*
|
|
120
|
+
* Used by {@link compileParagraphStyle} for `Paragraph` construction.
|
|
121
|
+
*/
|
|
122
|
+
interface ParagraphStyleRule {
|
|
123
|
+
/** Shorthand border for all four sides. */
|
|
124
|
+
border?: BorderRule;
|
|
125
|
+
/** Bottom border override. */
|
|
126
|
+
borderBottom?: BorderRule;
|
|
127
|
+
/** Left border override. */
|
|
128
|
+
borderLeft?: BorderRule;
|
|
129
|
+
/** Right border override. */
|
|
130
|
+
borderRight?: BorderRule;
|
|
131
|
+
/** Top border override. */
|
|
132
|
+
borderTop?: BorderRule;
|
|
133
|
+
/** Keep lines together on same page. */
|
|
134
|
+
keepLines?: boolean;
|
|
135
|
+
/** Keep this paragraph with the next one. */
|
|
136
|
+
keepNext?: boolean;
|
|
137
|
+
/** Line height multiplier or explicit unit value. */
|
|
138
|
+
lineHeight?: number | UnitValue;
|
|
139
|
+
/** Bottom margin. */
|
|
140
|
+
marginBottom?: UnitValue;
|
|
141
|
+
/** Left margin. */
|
|
142
|
+
marginLeft?: UnitValue;
|
|
143
|
+
/** Right margin. */
|
|
144
|
+
marginRight?: UnitValue;
|
|
145
|
+
/** Top margin. */
|
|
146
|
+
marginTop?: UnitValue;
|
|
147
|
+
/** Force page break before this paragraph. */
|
|
148
|
+
pageBreakBefore?: boolean;
|
|
149
|
+
/** Horizontal text alignment. */
|
|
150
|
+
textAlign?: TextAlign;
|
|
151
|
+
/** First-line indent. */
|
|
152
|
+
textIndent?: UnitValue;
|
|
153
|
+
/**
|
|
154
|
+
* CSS-like margin shorthand.
|
|
155
|
+
*
|
|
156
|
+
* Supports 1-value, 2-value, and 4-value string syntax
|
|
157
|
+
* (e.g. `"10pt"`, `"10pt 20pt"`, `"10pt 20pt 30pt 40pt"`).
|
|
158
|
+
*/
|
|
159
|
+
margin?: `${string} ${string}` | `${string} ${string} ${string} ${string}` | UnitValue;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A map of class name → style rule.
|
|
163
|
+
*
|
|
164
|
+
* Used to define reusable named styles referenced via `className` on nodes.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const styles = defineStyles({
|
|
169
|
+
* red: { color: '#ff0000' },
|
|
170
|
+
* big: { fontSize: 20 },
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
type StyleSheet = Record<string, StyleSheetEntry>;
|
|
175
|
+
/**
|
|
176
|
+
* A single entry in the stylesheet.
|
|
177
|
+
*
|
|
178
|
+
* Extends {@link DocxStyleRule} with an optional `extends` property
|
|
179
|
+
* that allows style classes to inherit from other classes.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* defineStyles({
|
|
184
|
+
* baseText: { fontFamily: 'Arial', fontSize: 12, color: '#333' },
|
|
185
|
+
* heading: { extends: 'baseText', fontSize: 20, fontWeight: 'bold' },
|
|
186
|
+
* muted: { extends: 'baseText', color: '#888' },
|
|
187
|
+
* })
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
interface StyleSheetEntry extends DocxStyleRule {
|
|
191
|
+
/** Inherit style properties from one or more other style classes. */
|
|
192
|
+
extends?: string | string[];
|
|
193
|
+
}
|
|
194
|
+
/** Horizontal text alignment. */
|
|
195
|
+
type TextAlign = 'center' | 'justify' | 'left' | 'right';
|
|
196
|
+
/**
|
|
197
|
+
* Text-level style properties (font, color, size, weight, etc.).
|
|
198
|
+
*
|
|
199
|
+
* Used by {@link compileTextStyle} for `TextRun` construction.
|
|
200
|
+
*
|
|
201
|
+
* @remarks
|
|
202
|
+
* Convenience boolean shortcuts `bold` and `italic` are provided
|
|
203
|
+
* alongside the canonical `fontWeight` / `fontStyle` properties.
|
|
204
|
+
* When `bold: true` is set, it is equivalent to `fontWeight: 'bold'`.
|
|
205
|
+
* When `italic: true` is set, it is equivalent to `fontStyle: 'italic'`.
|
|
206
|
+
*/
|
|
207
|
+
interface TextStyleRule {
|
|
208
|
+
/** Force text to uppercase (small caps-like). */
|
|
209
|
+
allCaps?: boolean;
|
|
210
|
+
/** Background / shading color (hex, named, or theme token like `"$colors.info"`). */
|
|
211
|
+
backgroundColor?: HexColor | StyleToken<string>;
|
|
212
|
+
/**
|
|
213
|
+
* Convenience boolean: `true` maps to `fontWeight: 'bold'`.
|
|
214
|
+
* Takes precedence over `fontWeight` when both are set.
|
|
215
|
+
*/
|
|
216
|
+
bold?: boolean;
|
|
217
|
+
/** Character spacing (letter-spacing). */
|
|
218
|
+
characterSpacing?: number;
|
|
219
|
+
/** Text / foreground color (hex, named, or theme token like `"$colors.primary"`). */
|
|
220
|
+
color?: HexColor | StyleToken<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Direct passthrough to the underlying `docx` library constructor options.
|
|
223
|
+
* Use for properties not yet covered by the CSS-like mapping.
|
|
224
|
+
*/
|
|
225
|
+
docx?: Record<string, unknown>;
|
|
226
|
+
/**
|
|
227
|
+
* Font family name (e.g. `"Arial"`, or theme token like `"$fonts.heading"`).
|
|
228
|
+
*/
|
|
229
|
+
fontFamily?: StyleToken<LiteralUnion<'Arial' | 'Calibri' | 'Times New Roman'>>;
|
|
230
|
+
/** Font size (bare number = pt). */
|
|
231
|
+
fontSize?: UnitValue;
|
|
232
|
+
/** Italic toggle (canonical form). Use `italic?: boolean` for convenience. */
|
|
233
|
+
fontStyle?: 'italic' | 'normal';
|
|
234
|
+
/** Font weight: keyword `"bold"` / `"normal"` or numeric 100–900. */
|
|
235
|
+
fontWeight?: FontWeight;
|
|
236
|
+
/** Text highlight color (background marker). */
|
|
237
|
+
highlight?: HighlightColor;
|
|
238
|
+
/**
|
|
239
|
+
* Convenience boolean: `true` maps to `fontStyle: 'italic'`.
|
|
240
|
+
* Takes precedence over `fontStyle` when both are set.
|
|
241
|
+
*/
|
|
242
|
+
italic?: boolean;
|
|
243
|
+
/** Character spacing. */
|
|
244
|
+
letterSpacing?: UnitValue;
|
|
245
|
+
/** Small caps text variant. */
|
|
246
|
+
smallCaps?: boolean;
|
|
247
|
+
/** Strikethrough toggle. */
|
|
248
|
+
strike?: boolean;
|
|
249
|
+
/** Sub-script text. */
|
|
250
|
+
subScript?: boolean;
|
|
251
|
+
/** Super-script text. */
|
|
252
|
+
superScript?: boolean;
|
|
253
|
+
/** Underline style. */
|
|
254
|
+
underline?: 'double' | 'single' | boolean;
|
|
255
|
+
}
|
|
256
|
+
/** Vertical alignment (for table cells). */
|
|
257
|
+
type VerticalAlign = 'bottom' | 'middle' | 'top';
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region ../../packages/types/dist/dsl/nodes.d.ts
|
|
260
|
+
/**
|
|
261
|
+
* Common properties shared by all nodes.
|
|
262
|
+
*
|
|
263
|
+
* @template TStyles — The user's stylesheet type
|
|
264
|
+
*/
|
|
265
|
+
interface BaseNode<TStyles extends StyleSheet = StyleSheet> {
|
|
266
|
+
/**
|
|
267
|
+
* CSS-like class name(s) referencing stylesheet entries.
|
|
268
|
+
*
|
|
269
|
+
* Can be a single string, an array, or a space-separated string.
|
|
270
|
+
*/
|
|
271
|
+
className?: string | ClassName<TStyles> | ClassName<TStyles>[];
|
|
272
|
+
/** Optional unique identifier (for templating / references). */
|
|
273
|
+
id?: string;
|
|
274
|
+
/** Inline style override for this specific node. */
|
|
275
|
+
style?: DocxStyleRule;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Union of all top-level content node types.
|
|
279
|
+
*
|
|
280
|
+
* @template TStyles — The user's stylesheet type
|
|
281
|
+
*/
|
|
282
|
+
type BlockNode<TStyles extends StyleSheet = StyleSheet> = BulletListNode<TStyles> | HeadingNode<TStyles> | HyperlinkNode<TStyles> | ImageNode<TStyles> | NumberedListNode<TStyles> | PageBreakNode | ParagraphNode<TStyles> | PluginNode<string, unknown, TStyles> | SectionBreakNode | TableNode<Record<string, unknown>, TStyles>;
|
|
283
|
+
/**
|
|
284
|
+
* A structured list item (for rich bullet/numbered items).
|
|
285
|
+
*
|
|
286
|
+
* @template TStyles — The user's stylesheet type
|
|
287
|
+
*/
|
|
288
|
+
interface BulletItem<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
289
|
+
/** Item text content. */
|
|
290
|
+
text: string;
|
|
291
|
+
/** Optional inline children override (instead of text). */
|
|
292
|
+
children?: InlineNode<TStyles>[];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A bullet list node.
|
|
296
|
+
*
|
|
297
|
+
* Supports plain string items or structured items with children.
|
|
298
|
+
*
|
|
299
|
+
* @template TStyles — The user's stylesheet type
|
|
300
|
+
*/
|
|
301
|
+
interface BulletListNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
302
|
+
/** List items — strings or structured items. */
|
|
303
|
+
items: (string | BulletItem<TStyles>)[];
|
|
304
|
+
type: 'bulletList';
|
|
305
|
+
/** Bullet character / style. Default: `'•'`. */
|
|
306
|
+
bullet?: string;
|
|
307
|
+
/** Nested list level (0 = top-level). */
|
|
308
|
+
level?: number;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Extract valid class name keys from a stylesheet type.
|
|
312
|
+
*
|
|
313
|
+
* @template TStyles — The user's stylesheet type
|
|
314
|
+
*/
|
|
315
|
+
type ClassName<TStyles extends StyleSheet> = Extract<keyof TStyles, string>;
|
|
316
|
+
/**
|
|
317
|
+
* A heading node (h1–h6).
|
|
318
|
+
*
|
|
319
|
+
* @template TStyles — The user's stylesheet type
|
|
320
|
+
*/
|
|
321
|
+
interface HeadingNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
322
|
+
/** Heading level (1 = largest, 6 = smallest). */
|
|
323
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
324
|
+
/** Heading text content. */
|
|
325
|
+
text: string;
|
|
326
|
+
type: 'heading';
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* A hyperlink node (inline content that creates a clickable link).
|
|
330
|
+
*
|
|
331
|
+
* @template TStyles — The user's stylesheet type
|
|
332
|
+
*/
|
|
333
|
+
interface HyperlinkNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
334
|
+
/** Display text or inline children. */
|
|
335
|
+
children: (string | TextNode<TStyles>)[];
|
|
336
|
+
type: 'hyperlink';
|
|
337
|
+
/** Link target URL. */
|
|
338
|
+
url: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* An image node.
|
|
342
|
+
*
|
|
343
|
+
* Supports raw bytes (`Uint8Array`, `ArrayBuffer`, `Blob`) or a file path string.
|
|
344
|
+
*
|
|
345
|
+
* @template TStyles — The user's stylesheet type
|
|
346
|
+
*/
|
|
347
|
+
interface ImageNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
348
|
+
/** Image data as bytes, blob, or file path. */
|
|
349
|
+
data: string | ArrayBuffer | Blob | Uint8Array;
|
|
350
|
+
type: 'image';
|
|
351
|
+
/** Alt text for accessibility. */
|
|
352
|
+
alt?: string;
|
|
353
|
+
/** Display height. */
|
|
354
|
+
height?: UnitValue;
|
|
355
|
+
/** Image format hint. Auto-detected if omitted. */
|
|
356
|
+
imageType?: 'bmp' | 'gif' | 'jpeg' | 'jpg' | 'png';
|
|
357
|
+
/** Display width. */
|
|
358
|
+
width?: UnitValue;
|
|
359
|
+
/**
|
|
360
|
+
* Floating layout configuration.
|
|
361
|
+
*
|
|
362
|
+
* - `true` enables default floating
|
|
363
|
+
* - Object allows wrap mode and position offsets
|
|
364
|
+
*/
|
|
365
|
+
floating?: boolean | {
|
|
366
|
+
/** Text wrap mode. */wrap?: 'square' | 'tight' | 'topAndBottom'; /** Horizontal offset. */
|
|
367
|
+
x?: UnitValue; /** Vertical offset. */
|
|
368
|
+
y?: UnitValue;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Union of inline content node types (appear inside paragraphs).
|
|
373
|
+
*
|
|
374
|
+
* @template TStyles — The user's stylesheet type
|
|
375
|
+
*/
|
|
376
|
+
type InlineNode<TStyles extends StyleSheet = StyleSheet> = HyperlinkNode<TStyles> | ImageNode<TStyles> | TextNode<TStyles>;
|
|
377
|
+
/**
|
|
378
|
+
* A numbered / ordered list node.
|
|
379
|
+
*
|
|
380
|
+
* @template TStyles — The user's stylesheet type
|
|
381
|
+
*/
|
|
382
|
+
interface NumberedListNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
383
|
+
/** List items. */
|
|
384
|
+
items: (string | BulletItem<TStyles>)[];
|
|
385
|
+
type: 'numberedList';
|
|
386
|
+
/** Nested list level (0 = top-level). */
|
|
387
|
+
level?: number;
|
|
388
|
+
/** Starting number (default: 1). */
|
|
389
|
+
start?: number;
|
|
390
|
+
/**
|
|
391
|
+
* Numbering format.
|
|
392
|
+
*
|
|
393
|
+
* {@link `LevelFormat.DECIMAL`} by default.
|
|
394
|
+
* e.g. `'decimal'`, `'upperRoman'`, `'lowerLetter'`
|
|
395
|
+
*/
|
|
396
|
+
numberingFormat?: 'decimal' | 'lowerLetter' | 'lowerRoman' | 'upperLetter' | 'upperRoman';
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* A forced page break.
|
|
400
|
+
*/
|
|
401
|
+
interface PageBreakNode {
|
|
402
|
+
type: 'pageBreak';
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* A paragraph containing text and/or inline children.
|
|
406
|
+
*
|
|
407
|
+
* @template TStyles — The user's stylesheet type
|
|
408
|
+
*/
|
|
409
|
+
interface ParagraphNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
410
|
+
type: 'paragraph';
|
|
411
|
+
/** Inline children (text runs, inline images, etc.). */
|
|
412
|
+
children?: InlineNode<TStyles>[];
|
|
413
|
+
/** Plain-text content (used when `children` is not provided). */
|
|
414
|
+
text?: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* A plugin-invocation node.
|
|
418
|
+
*
|
|
419
|
+
* Plugins extend the DSL with arbitrary content types.
|
|
420
|
+
*
|
|
421
|
+
* @template TName — Plugin name (string literal)
|
|
422
|
+
* @template TOptions — Plugin-specific options shape
|
|
423
|
+
* @template TStyles — The user's stylesheet type
|
|
424
|
+
*/
|
|
425
|
+
interface PluginNode<TName extends string = string, TOptions = unknown, TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
426
|
+
/** Registered plugin name. */
|
|
427
|
+
name: TName;
|
|
428
|
+
/** Plugin-specific options. */
|
|
429
|
+
options: TOptions;
|
|
430
|
+
type: 'plugin';
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Internal marker node that represents a section boundary.
|
|
434
|
+
*
|
|
435
|
+
* Created automatically by {@link DocxBuilder.section} — users should
|
|
436
|
+
* not create this node directly.
|
|
437
|
+
*
|
|
438
|
+
* When the compiler encounters this marker, it starts a new section
|
|
439
|
+
* with the provided configuration.
|
|
440
|
+
*/
|
|
441
|
+
interface SectionBreakNode {
|
|
442
|
+
type: 'sectionBreak';
|
|
443
|
+
/** Optional per-section page/header/footer overrides. */
|
|
444
|
+
config?: SectionConfig;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* A column definition for a table.
|
|
448
|
+
*
|
|
449
|
+
* @template TData — The row data type
|
|
450
|
+
*/
|
|
451
|
+
interface TableColumn<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
452
|
+
/** Key in the data object this column maps to. */
|
|
453
|
+
key: Extract<keyof TData, string>;
|
|
454
|
+
/** Column header text. */
|
|
455
|
+
title: string;
|
|
456
|
+
/** Cell text alignment. */
|
|
457
|
+
align?: 'center' | 'left' | 'right';
|
|
458
|
+
/**
|
|
459
|
+
* Span multiple columns horizontally.
|
|
460
|
+
*
|
|
461
|
+
* Applied to all cells in this column.
|
|
462
|
+
*/
|
|
463
|
+
colSpan?: number;
|
|
464
|
+
/**
|
|
465
|
+
* Span multiple rows vertically (per-cell via data hints).
|
|
466
|
+
*
|
|
467
|
+
* Set `rowSpan` on individual data objects using `_rowSpan: N` or keep it
|
|
468
|
+
* as a static column default.
|
|
469
|
+
*/
|
|
470
|
+
rowSpan?: number;
|
|
471
|
+
/** Column width. Supports percentage strings (e.g. `"30%"`). */
|
|
472
|
+
width?: UnitValue;
|
|
473
|
+
/**
|
|
474
|
+
* Custom cell renderer.
|
|
475
|
+
*
|
|
476
|
+
* Receives the raw value, full row data, and row index.
|
|
477
|
+
* Returns a string or inline nodes.
|
|
478
|
+
*/
|
|
479
|
+
render?: (value: TData[keyof TData], row: TData, index: number) => string | InlineNode[];
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* A table node with column definitions and data rows.
|
|
483
|
+
*
|
|
484
|
+
* @template TData — The row data type
|
|
485
|
+
* @template TStyles — The user's stylesheet type
|
|
486
|
+
*/
|
|
487
|
+
interface TableNode<TData extends Record<string, unknown> = Record<string, unknown>, TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
488
|
+
/** Column definitions. */
|
|
489
|
+
columns: TableColumn<TData>[];
|
|
490
|
+
/** Row data objects. */
|
|
491
|
+
data: TData[];
|
|
492
|
+
type: 'table';
|
|
493
|
+
/** Show table borders. */
|
|
494
|
+
bordered?: boolean;
|
|
495
|
+
/** Default cell style for data rows. */
|
|
496
|
+
cellStyle?: DocxStyleRule;
|
|
497
|
+
/** Show header row (default: `true`). */
|
|
498
|
+
header?: boolean;
|
|
499
|
+
/** Style for header cells. */
|
|
500
|
+
headerCellStyle?: DocxStyleRule;
|
|
501
|
+
/** Alternate row shading. */
|
|
502
|
+
striped?: boolean;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A text run node (inline content).
|
|
506
|
+
*
|
|
507
|
+
* @template TStyles — The user's stylesheet type
|
|
508
|
+
*/
|
|
509
|
+
interface TextNode<TStyles extends StyleSheet = StyleSheet> extends BaseNode<TStyles> {
|
|
510
|
+
/** Text content. */
|
|
511
|
+
text: string;
|
|
512
|
+
type: 'text';
|
|
513
|
+
}
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region ../../packages/types/dist/document.d.ts
|
|
516
|
+
/**
|
|
517
|
+
* Top-level configuration passed to `createDocx()`.
|
|
518
|
+
*
|
|
519
|
+
* Covers page setup, stylesheet, theme tokens, element defaults,
|
|
520
|
+
* and document metadata.
|
|
521
|
+
*
|
|
522
|
+
* @template TStyles — The user's stylesheet type (inferred from `styles`).
|
|
523
|
+
*/
|
|
524
|
+
interface DocxKitConfig<TStyles extends StyleSheet = StyleSheet> {
|
|
525
|
+
/** Page dimensions and margins. */
|
|
526
|
+
page?: PageConfig;
|
|
527
|
+
/** Named style classes (class → style rule map). */
|
|
528
|
+
styles?: TStyles;
|
|
529
|
+
/** Semantic design tokens for theming. */
|
|
530
|
+
theme?: DocxTheme;
|
|
531
|
+
/** Default styles applied as base for each element type. */
|
|
532
|
+
defaults?: {
|
|
533
|
+
/** Default table cell style. */cell?: DocxStyleRule; /** Default image style (applied to the paragraph wrapping the image). */
|
|
534
|
+
image?: DocxStyleRule; /** Default paragraph style. */
|
|
535
|
+
paragraph?: DocxStyleRule; /** Default table style. */
|
|
536
|
+
table?: DocxStyleRule; /** Default text run style. */
|
|
537
|
+
text?: DocxStyleRule;
|
|
538
|
+
};
|
|
539
|
+
/** OOXML core properties (appear in File → Info). */
|
|
540
|
+
metadata?: {
|
|
541
|
+
/** Document author. */creator?: string; /** Document description / summary. */
|
|
542
|
+
description?: string; /** Keywords / tags. */
|
|
543
|
+
keywords?: string[]; /** Last editor. */
|
|
544
|
+
lastModifiedBy?: string; /** Document subject. */
|
|
545
|
+
subject?: string; /** Document title. */
|
|
546
|
+
title?: string;
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Theme tokens that can be referenced in styles via `$category.key` syntax.
|
|
551
|
+
*
|
|
552
|
+
* Allows defining a single source of truth for colors, fonts,
|
|
553
|
+
* font sizes, and spacing values. Token references are resolved
|
|
554
|
+
* at compile time by {@link resolveThemeTokens}.
|
|
555
|
+
*/
|
|
556
|
+
interface DocxTheme {
|
|
557
|
+
/** Color palette tokens (name → hex). */
|
|
558
|
+
colors?: ThemeColors;
|
|
559
|
+
/** Font family tokens (name → font family string). */
|
|
560
|
+
fonts?: ThemeFonts;
|
|
561
|
+
/** Font size tokens (name → value). */
|
|
562
|
+
fontSize?: Record<string, UnitValue>;
|
|
563
|
+
/** Spacing tokens (name → value). */
|
|
564
|
+
spacing?: ThemeSpacing;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Header/footer configuration for a section.
|
|
568
|
+
*
|
|
569
|
+
* Supports standard, first-page, and even-page variants.
|
|
570
|
+
*/
|
|
571
|
+
interface HeaderFooterConfig {
|
|
572
|
+
/** Default header/footer (appears on all pages). */
|
|
573
|
+
default?: HeaderFooterContent;
|
|
574
|
+
/** Even-page header/footer (overrides default on even pages). */
|
|
575
|
+
even?: HeaderFooterContent;
|
|
576
|
+
/** First-page-only header/footer (overrides default on page 1). */
|
|
577
|
+
first?: HeaderFooterContent;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Content for a header or footer.
|
|
581
|
+
*
|
|
582
|
+
* Supports both simple text strings (backward compatible, each maps to a `Paragraph`)
|
|
583
|
+
* and full {@link BlockNode} elements (paragraphs, images, tables, etc.).
|
|
584
|
+
*/
|
|
585
|
+
interface HeaderFooterContent {
|
|
586
|
+
/** Content items — strings (simple) or BlockNode objects (rich). */
|
|
587
|
+
children: (string | BlockNode)[];
|
|
588
|
+
}
|
|
589
|
+
/** Page orientation. */
|
|
590
|
+
type Orientation = 'landscape' | 'portrait';
|
|
591
|
+
/**
|
|
592
|
+
* Page configuration (size, orientation, margin).
|
|
593
|
+
*/
|
|
594
|
+
interface PageConfig {
|
|
595
|
+
/** Page orientation (`"portrait"` default). */
|
|
596
|
+
orientation?: Orientation;
|
|
597
|
+
/** Page size: preset name or explicit dimensions. */
|
|
598
|
+
size?: PageSize | {
|
|
599
|
+
height: UnitValue;
|
|
600
|
+
width: UnitValue;
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Page margin.
|
|
604
|
+
*
|
|
605
|
+
* Supports 1-value, 2-value, and 4-value shorthand
|
|
606
|
+
* (e.g. `"20mm"`, `"20mm 15mm"`, `"20mm 15mm 25mm 15mm"`).
|
|
607
|
+
*/
|
|
608
|
+
margin?: `${string} ${string}` | `${string} ${string} ${string} ${string}` | UnitValue;
|
|
609
|
+
}
|
|
610
|
+
/** Available page size presets. */
|
|
611
|
+
type PageSize = 'A3' | 'A4' | 'Legal' | 'Letter';
|
|
612
|
+
/**
|
|
613
|
+
* Per-section configuration.
|
|
614
|
+
*
|
|
615
|
+
* Each call to `.section(config)` starts a new document section, which
|
|
616
|
+
* can have its own page setup, headers, and footers independent of other
|
|
617
|
+
* sections.
|
|
618
|
+
*/
|
|
619
|
+
interface SectionConfig {
|
|
620
|
+
/** Section footer(s). */
|
|
621
|
+
footer?: HeaderFooterConfig;
|
|
622
|
+
/** Section header(s). */
|
|
623
|
+
header?: HeaderFooterConfig;
|
|
624
|
+
/** Section-specific page dimensions (overrides document-level `page`). */
|
|
625
|
+
page?: PageConfig;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Theme color palette — semantic color tokens referenced by name.
|
|
629
|
+
*/
|
|
630
|
+
interface ThemeColors {
|
|
631
|
+
[name: string]: string;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Theme font tokens — semantic font family names.
|
|
635
|
+
*/
|
|
636
|
+
interface ThemeFonts {
|
|
637
|
+
[name: string]: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Theme spacing tokens — named spacing values.
|
|
641
|
+
*/
|
|
642
|
+
interface ThemeSpacing {
|
|
643
|
+
[name: string]: UnitValue;
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region ../../packages/types/dist/plugin.d.ts
|
|
647
|
+
/**
|
|
648
|
+
* A docx-kit plugin.
|
|
649
|
+
*
|
|
650
|
+
* Plugins have a unique `name`, an optional `setup` hook,
|
|
651
|
+
* and a required `render` function that receives user options
|
|
652
|
+
* and a rendering context.
|
|
653
|
+
*
|
|
654
|
+
* @template TName — The plugin name (string literal type)
|
|
655
|
+
* @template TOptions — The shape of the user-provided options
|
|
656
|
+
* @template TRender — The render output type produced by the plugin
|
|
657
|
+
*/
|
|
658
|
+
interface DocxPlugin<TName extends string = string, TOptions = unknown, TRender = unknown> {
|
|
659
|
+
/** Unique plugin name, used as the node discriminator. */
|
|
660
|
+
name: TName;
|
|
661
|
+
/** One-time setup called when the plugin is registered. */
|
|
662
|
+
setup?: () => MaybePromise<void>;
|
|
663
|
+
/**
|
|
664
|
+
* Render plugin content into one or more `docx` objects
|
|
665
|
+
* (Paragraph, Table, etc.).
|
|
666
|
+
*
|
|
667
|
+
* @param options - — User-provided plugin options
|
|
668
|
+
* @param context - — Rendering context with helper utilities
|
|
669
|
+
*/
|
|
670
|
+
render: (options: TOptions, context: PluginRenderContext) => MaybePromise<TRender>;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Rendering context passed to a plugin's `render()` function.
|
|
674
|
+
*
|
|
675
|
+
* Provides access to the document config, image utilities,
|
|
676
|
+
* and the ability to compile child nodes.
|
|
677
|
+
*/
|
|
678
|
+
interface PluginRenderContext {
|
|
679
|
+
/** The full document config. */
|
|
680
|
+
config: DocxKitConfig;
|
|
681
|
+
/** Compile a child node (useful for nesting). */
|
|
682
|
+
compileNode: (node: BlockNode) => Promise<unknown>;
|
|
683
|
+
/** Utility helpers. */
|
|
684
|
+
utils: {
|
|
685
|
+
image: {
|
|
686
|
+
/**
|
|
687
|
+
* Convert a Blob to raw image bytes.
|
|
688
|
+
*
|
|
689
|
+
* @param blob - The image data as a Blob
|
|
690
|
+
* @returns A promise that resolves to a Uint8Array of the image bytes
|
|
691
|
+
*/
|
|
692
|
+
fromBlob: (blob: Blob) => Promise<Uint8Array>;
|
|
693
|
+
/**
|
|
694
|
+
* Decode a base64 data-URL to raw image bytes.
|
|
695
|
+
* Works in both browser and Node.js environments.
|
|
696
|
+
*/
|
|
697
|
+
fromDataUrl: (dataUrl: string) => MaybePromise<Uint8Array>;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/index.d.ts
|
|
703
|
+
declare const TYPE_COLORS: {
|
|
704
|
+
readonly added: "E7F6EA";
|
|
705
|
+
readonly changed: "FFF4D6";
|
|
706
|
+
readonly fixed: "E8F1FB";
|
|
707
|
+
readonly removed: "FDE7E9";
|
|
708
|
+
};
|
|
709
|
+
interface ChangelogEntry {
|
|
710
|
+
changes: string;
|
|
711
|
+
date: string;
|
|
712
|
+
type: keyof typeof TYPE_COLORS;
|
|
713
|
+
version: string;
|
|
714
|
+
}
|
|
715
|
+
interface ChangelogOptions {
|
|
716
|
+
entries: ChangelogEntry[];
|
|
717
|
+
title?: string;
|
|
718
|
+
}
|
|
719
|
+
declare function changelogPlugin(): DocxPlugin<"changelog", ChangelogOptions, unknown>;
|
|
720
|
+
//#endregion
|
|
721
|
+
export { ChangelogEntry, ChangelogOptions, changelogPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { definePlugin } from "@docxkit/core";
|
|
2
|
+
import { AlignmentType, BorderStyle, Paragraph, ShadingType, Table, TableCell, TableRow, TextRun, WidthType } from "docx";
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const TYPE_COLORS = {
|
|
5
|
+
added: "E7F6EA",
|
|
6
|
+
changed: "FFF4D6",
|
|
7
|
+
fixed: "E8F1FB",
|
|
8
|
+
removed: "FDE7E9"
|
|
9
|
+
};
|
|
10
|
+
function changelogPlugin() {
|
|
11
|
+
return definePlugin({
|
|
12
|
+
name: "changelog",
|
|
13
|
+
render(options) {
|
|
14
|
+
const title = new Paragraph({
|
|
15
|
+
spacing: { after: 180 },
|
|
16
|
+
children: [new TextRun({
|
|
17
|
+
bold: true,
|
|
18
|
+
size: 28,
|
|
19
|
+
text: options.title ?? "Changelog"
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
if (options.entries.length === 0) return [title, new Paragraph({
|
|
23
|
+
alignment: AlignmentType.CENTER,
|
|
24
|
+
children: [new TextRun({
|
|
25
|
+
color: "999999",
|
|
26
|
+
text: "(no entries)"
|
|
27
|
+
})]
|
|
28
|
+
})];
|
|
29
|
+
return [title, new Table({
|
|
30
|
+
rows: [new TableRow({ children: [
|
|
31
|
+
"Version",
|
|
32
|
+
"Date",
|
|
33
|
+
"Type",
|
|
34
|
+
"Changes"
|
|
35
|
+
].map((label) => new TableCell({
|
|
36
|
+
shading: {
|
|
37
|
+
fill: "4472C4",
|
|
38
|
+
type: ShadingType.CLEAR
|
|
39
|
+
},
|
|
40
|
+
borders: {
|
|
41
|
+
bottom: {
|
|
42
|
+
color: "D9D9D9",
|
|
43
|
+
size: 1,
|
|
44
|
+
style: BorderStyle.SINGLE
|
|
45
|
+
},
|
|
46
|
+
left: {
|
|
47
|
+
color: "D9D9D9",
|
|
48
|
+
size: 1,
|
|
49
|
+
style: BorderStyle.SINGLE
|
|
50
|
+
},
|
|
51
|
+
right: {
|
|
52
|
+
color: "D9D9D9",
|
|
53
|
+
size: 1,
|
|
54
|
+
style: BorderStyle.SINGLE
|
|
55
|
+
},
|
|
56
|
+
top: {
|
|
57
|
+
color: "D9D9D9",
|
|
58
|
+
size: 1,
|
|
59
|
+
style: BorderStyle.SINGLE
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
children: [new Paragraph({ children: [new TextRun({
|
|
63
|
+
bold: true,
|
|
64
|
+
color: "FFFFFF",
|
|
65
|
+
text: label
|
|
66
|
+
})] })]
|
|
67
|
+
})) }), ...options.entries.map((entry) => new TableRow({ children: [
|
|
68
|
+
entry.version,
|
|
69
|
+
entry.date,
|
|
70
|
+
entry.type,
|
|
71
|
+
entry.changes
|
|
72
|
+
].map((value, index) => new TableCell({
|
|
73
|
+
borders: {
|
|
74
|
+
bottom: {
|
|
75
|
+
color: "D9D9D9",
|
|
76
|
+
size: 1,
|
|
77
|
+
style: BorderStyle.SINGLE
|
|
78
|
+
},
|
|
79
|
+
left: {
|
|
80
|
+
color: "D9D9D9",
|
|
81
|
+
size: 1,
|
|
82
|
+
style: BorderStyle.SINGLE
|
|
83
|
+
},
|
|
84
|
+
right: {
|
|
85
|
+
color: "D9D9D9",
|
|
86
|
+
size: 1,
|
|
87
|
+
style: BorderStyle.SINGLE
|
|
88
|
+
},
|
|
89
|
+
top: {
|
|
90
|
+
color: "D9D9D9",
|
|
91
|
+
size: 1,
|
|
92
|
+
style: BorderStyle.SINGLE
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
children: [new Paragraph({ children: [new TextRun({ text: value })] })],
|
|
96
|
+
shading: index === 2 ? {
|
|
97
|
+
fill: TYPE_COLORS[entry.type],
|
|
98
|
+
type: ShadingType.CLEAR
|
|
99
|
+
} : void 0
|
|
100
|
+
})) }))],
|
|
101
|
+
width: {
|
|
102
|
+
size: 100,
|
|
103
|
+
type: WidthType.PERCENTAGE
|
|
104
|
+
}
|
|
105
|
+
})];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { changelogPlugin };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@docxkit/plugin-changelog",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"description": "Version changelog table for release notes — docx-kit plugin",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"docx",
|
|
8
|
+
"docx-kit",
|
|
9
|
+
"docx-kit-plugin"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "ntnyq",
|
|
14
|
+
"email": "ntnyq13@gmail.com"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ntnyq/docx-kit",
|
|
19
|
+
"directory": "packages-plugins/changelog"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"docx": "^9.7.1",
|
|
38
|
+
"@docxkit/core": "0.3.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@docxkit/pdk": "0.3.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"dev": "tsdown --watch"
|
|
46
|
+
}
|
|
47
|
+
}
|