Compare commits

...

212 Commits
fork ... master

Author SHA1 Message Date
88ddfa79be build(deps): bump @types/node from 22.15.3 to 22.15.27 (#3127)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.15.3 to 22.15.27.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.15.27
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-31 14:32:01 +01:00
f6ee55a947 build(deps-dev): bump typescript-eslint from 8.30.1 to 8.33.0 (#3122)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.30.1 to 8.33.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.33.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-version: 8.33.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-31 14:31:38 +01:00
b8cc44a31b build(deps-dev): bump @vitest/coverage-v8 from 3.1.2 to 3.1.4 (#3116)
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 3.1.2 to 3.1.4.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v3.1.4/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 3.1.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-31 14:31:31 +01:00
e1a478cd72 build(deps-dev): bump eslint-plugin-unicorn from 59.0.0 to 59.0.1 (#3095)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 59.0.0 to 59.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v59.0.0...v59.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 59.0.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-31 14:31:24 +01:00
e39bed6032 build(deps-dev): bump @types/inquirer from 9.0.7 to 9.0.8 (#3094)
Bumps [@types/inquirer](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/inquirer) from 9.0.7 to 9.0.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/inquirer)

---
updated-dependencies:
- dependency-name: "@types/inquirer"
  dependency-version: 9.0.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-31 14:31:16 +01:00
495f2e4888 Version bump 2025-05-05 23:44:24 +01:00
ba292d07f7 build(deps-dev): bump eslint-plugin-unicorn from 58.0.0 to 59.0.0 (#3089)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 58.0.0 to 59.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v58.0.0...v59.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 59.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:43:37 +01:00
db8a5be998 build(deps-dev): bump cspell from 8.19.2 to 9.0.0 (#3093)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.19.2 to 9.0.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v9.0.0/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-version: 9.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:42:36 +01:00
a7a6b69004 build(deps-dev): bump vite from 6.3.4 to 6.3.5 (#3092)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.4 to 6.3.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:39:00 +01:00
b60f940994 build(deps-dev): bump tsx from 4.19.3 to 4.19.4 (#3091)
Bumps [tsx](https://github.com/privatenumber/tsx) from 4.19.3 to 4.19.4.
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.19.3...v4.19.4)

---
updated-dependencies:
- dependency-name: tsx
  dependency-version: 4.19.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:38:52 +01:00
afa3374376 build(deps-dev): bump typedoc from 0.28.3 to 0.28.4 (#3090)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.28.3 to 0.28.4.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.28.3...v0.28.4)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-version: 0.28.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:38:31 +01:00
45795bf43d build(deps-dev): bump eslint from 9.25.1 to 9.26.0 (#3088)
Bumps [eslint](https://github.com/eslint/eslint) from 9.25.1 to 9.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.25.1...v9.26.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.26.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:38:07 +01:00
bd7321d221 build(deps-dev): bump @typescript-eslint/eslint-plugin (#3084)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.30.1 to 8.31.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.31.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 23:37:52 +01:00
aa2d72507c build(deps-dev): bump vite from 6.3.2 to 6.3.4 (#3086)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.2 to 6.3.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-03 23:56:03 +01:00
a2755f57f4 build(deps-dev): bump @typescript-eslint/parser from 8.30.1 to 8.31.1 (#3083)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.30.1 to 8.31.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.31.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.31.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-03 23:55:37 +01:00
a604677a37 build(deps): bump @types/node from 22.14.1 to 22.15.3 (#3082)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.14.1 to 22.15.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.15.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-03 23:55:29 +01:00
e3436de693 build(deps-dev): bump eslint-plugin-jsdoc from 50.6.9 to 50.6.11 (#3081)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.9 to 50.6.11.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.9...v50.6.11)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 50.6.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-03 23:55:17 +01:00
e2f4556ac3 build(deps-dev): bump glob from 11.0.1 to 11.0.2 (#3077)
Bumps [glob](https://github.com/isaacs/node-glob) from 11.0.1 to 11.0.2.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v11.0.1...v11.0.2)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 11.0.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 20:08:16 +01:00
42151c1534 build(deps-dev): bump inquirer from 12.5.2 to 12.6.0 (#3075)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.5.2 to 12.6.0.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.5.2...inquirer@12.6.0)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-version: 12.6.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 20:08:08 +01:00
7d1129900f Fix: separate vertical alignment enums for ITableCellOptions and ISectionPropertiesOptions (#3079)
* fix: separate vertical alignment enums for table and section properties

- Introduced `VerticalAlignTable` for table-cell vertical alignment with valid values: `top`, `center`, and `bottom`.
- Added `VerticalAlignSection` for section properties, extending `VerticalAlignTable` with an additional value `both`.
- Marked the original `VerticalAlign` as deprecated for backward compatibility, directing users to the new enums.
- Updated type definitions for better clarity on valid vertical alignments.

* refactor: update vertical alignment imports and types for section and table properties

- Renamed `VerticalAlign` to `VerticalAlignSection` in section properties and `VerticalAlignTable` in table-cell properties for clarity.
- Updated type definitions to reflect the new enum names, ensuring better organization and understanding of vertical alignment options.
- Adjusted related test cases to utilize the new imports and types.

* refactor: update demos to use new enums for table and section properties for vertical alignment
2025-05-02 19:58:10 +01:00
1e6c9e1772 fix: omit empty descr/title in <wp:docPr> for Word 2007 compatibility (#3073) 2025-05-02 19:55:22 +01:00
c38d0a253e build(deps-dev): bump eslint from 9.24.0 to 9.25.1 (#3068)
Bumps [eslint](https://github.com/eslint/eslint) from 9.24.0 to 9.25.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.24.0...v9.25.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.25.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:18:00 +01:00
89464ea7fc build(deps-dev): bump eslint-import-resolver-typescript (#3067)
Bumps [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) from 4.3.2 to 4.3.4.
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v4.3.2...v4.3.4)

---
updated-dependencies:
- dependency-name: eslint-import-resolver-typescript
  dependency-version: 4.3.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:17:52 +01:00
61ed317f24 build(deps-dev): bump typedoc from 0.28.2 to 0.28.3 (#3065)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.28.2 to 0.28.3.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.28.2...v0.28.3)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-version: 0.28.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:17:40 +01:00
b1bb95df79 build(deps-dev): bump cspell from 8.19.0 to 8.19.2 (#3064)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.19.0 to 8.19.2.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.19.2/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-version: 8.19.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:17:31 +01:00
2b73c243f3 build(deps-dev): bump @vitest/coverage-v8 from 3.1.1 to 3.1.2 (#3059)
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v3.1.2/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 3.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:17:17 +01:00
f29c2687dd build(deps-dev): bump vite from 6.3.1 to 6.3.2 (#3058)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.1 to 6.3.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 22:17:09 +01:00
44ed2d6943 Fix: Use browser compatable Buffer (#3057)
* Fix: Use browser compatable Buffer

* Update src/patcher/from-docx.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-18 00:02:21 +01:00
fe7a75b754 build(deps-dev): bump cspell from 8.18.1 to 8.19.0 (#3055)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.18.1 to 8.19.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.19.0/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-version: 8.19.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-17 23:53:40 +01:00
d30cd546ab build(deps-dev): bump vite from 6.3.0 to 6.3.1 (#3054)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.3.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-17 23:53:30 +01:00
03d47658d6 Fix guidelines 2025-04-17 00:41:04 +01:00
1403ac664b Update contribution guidelines (#3053) 2025-04-16 23:51:30 +01:00
ba0a502d27 build(deps-dev): bump eslint-plugin-jsdoc from 50.6.6 to 50.6.9 (#3049)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.6 to 50.6.9.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.6...v50.6.9)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 50.6.9
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2025-04-16 23:23:53 +01:00
44d4b93d06 feat: Added TableCellSpacing (#3052)
* feat: Added TableCellSpacingElement

* feat: Added cellSpacing (Table-constructor, TableProperties-constructor and ITableOptions)

* feat: Added cellSpacing (ITablePropertiesOptions and constructor implementation)

* feat: Added cellSpacing (ITableRowPropertiesOptions and constructor implementation)

* feat: Added cellSpacing (Implementation Test)

---------

Co-authored-by: Philip <1760073-philip.asx@users.noreply.gitlab.com>
2025-04-16 22:38:28 +01:00
72abd4b7ac build(deps-dev): bump jsdom from 26.0.0 to 26.1.0 (#3050)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 26.0.0 to 26.1.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/26.0.0...26.1.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-version: 26.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:54 +01:00
a473a98f17 build(deps-dev): bump typescript-eslint from 8.19.1 to 8.30.1 (#3051)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.19.1 to 8.30.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.30.1/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-version: 8.30.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:46 +01:00
f649dac62c build(deps-dev): bump @vitest/coverage-v8 from 3.0.8 to 3.1.1 (#3048)
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 3.0.8 to 3.1.1.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v3.1.1/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 3.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:31 +01:00
ba7f937a7a build(deps-dev): bump cspell from 8.17.5 to 8.18.1 (#3047)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.17.5 to 8.18.1.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.18.1/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-version: 8.18.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:20 +01:00
1c8e6ae1db build(deps-dev): bump eslint from 9.22.0 to 9.24.0 (#3046)
Bumps [eslint](https://github.com/eslint/eslint) from 9.22.0 to 9.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.22.0...v9.24.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.24.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:12 +01:00
e09e201c45 build(deps-dev): bump eslint-import-resolver-typescript (#3044)
Bumps [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) from 3.7.0 to 4.3.2.
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.7.0...v4.3.2)

---
updated-dependencies:
- dependency-name: eslint-import-resolver-typescript
  dependency-version: 4.3.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 22:35:05 +01:00
409ea028cb Version bump 2025-04-16 10:15:02 +01:00
fc86e1842d fix: patchDocument, looks for namspaces more carefully over whole doc… (#2943)
* fix: patchDocument, looks for namspaces more carefully over whole document

added support of different placeholder brackets, default `{{`: `}}`

extended inputDataType to accept JSZip

* fix: Attribute value string not converted to HTML esc char by js2xml

original: https://github.com/nashwaan/xml-js/issues/142

* fix: skip processing utf-16 encoded files

* fix: patching goes on the second circle over patched document

added parameter `recursive`(= true by default) to be able to disable
this behavior

* Fix linting

* Simplify code

* write tests to skip UTF-16 types

---------

Co-authored-by: Vladimir Bulyga <vladimir.bulyga@legatics.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2025-04-16 10:03:49 +01:00
b614b74a2a build(deps): bump @types/node from 22.10.1 to 22.14.1 (#3039)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.10.1 to 22.14.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.14.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2025-04-16 09:57:24 +01:00
e7eb415376 build(deps-dev): bump vite from 6.2.3 to 6.3.0 in the npm_and_yarn group (#3043)
Bumps the npm_and_yarn group with 1 update: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 6.2.3 to 6.3.0
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.3.0/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.0
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 09:08:19 +01:00
77c5a736dd build(deps-dev): bump vite from 6.2.2 to 6.2.6 (#3034)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.2 to 6.2.6.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v6.2.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.2.6/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.2.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 09:08:04 +01:00
a241a51cfd build(deps-dev): bump @typescript-eslint/parser from 8.19.1 to 8.30.1 (#3040)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.19.1 to 8.30.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.30.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.30.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:56:06 +01:00
4e0468d978 build(deps-dev): bump typedoc from 0.27.6 to 0.28.2 (#3029)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.27.6 to 0.28.2.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.27.6...v0.28.2)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-version: 0.28.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:47 +01:00
cfe5970e54 build(deps-dev): bump inquirer from 12.4.3 to 12.5.2 (#3027)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.4.3 to 12.5.2.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.4.3...inquirer@12.5.2)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-version: 12.5.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:40 +01:00
27977edf82 build(deps-dev): bump vite from 6.2.2 to 6.2.3 in the npm_and_yarn group (#3014)
Bumps the npm_and_yarn group with 1 update: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 6.2.2 to 6.2.3
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v6.2.3/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.2.3/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:33 +01:00
7405a19ae8 build(deps-dev): bump eslint-plugin-unicorn from 56.0.1 to 58.0.0 (#3012)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 56.0.1 to 58.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v56.0.1...v58.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:26 +01:00
ce32375d47 build(deps): bump nanoid from 5.1.3 to 5.1.5 (#3003)
Bumps [nanoid](https://github.com/ai/nanoid) from 5.1.3 to 5.1.5.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/5.1.3...5.1.5)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:18 +01:00
b33b7d2ebd build(deps-dev): bump @types/unzipper from 0.10.10 to 0.10.11 (#3001)
Bumps [@types/unzipper](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/unzipper) from 0.10.10 to 0.10.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/unzipper)

---
updated-dependencies:
- dependency-name: "@types/unzipper"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:11 +01:00
b2b23bdc1c build(deps-dev): bump prettier from 3.4.2 to 3.5.3 (#2999)
Bumps [prettier](https://github.com/prettier/prettier) from 3.4.2 to 3.5.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.4.2...3.5.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-16 08:55:03 +01:00
7f26badbc9 feat: Added NumberedItemReference (#3042)
* feat: Added NumberedItemReference

* Fix linting

* ts-ignore until TypeScript upgrade

---------

Co-authored-by: Alexander Nortung <alexander.nortung@oakdigital.dk>
2025-04-16 08:54:50 +01:00
b19025881b feat(comments): Support comment pictures (#3032)
* feat(comments): Support comment pictures

* fix(demo): Fix the image path to load the image correctly

* fix(test): Update the number of files asserted in the compiler test case

* feat(comments): Support comment pictures

* fix(demo): Fix the image path to load the image correctly

* fix(test): Update the number of files asserted in the compiler test case

* style(src): Format the code and remove extra blank lines

---------

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2025-04-16 08:45:36 +01:00
5af1045a59 feat: add support for custom patch delimiters in PatchDocumentOptions (#3036)
* feat: add support for custom patch delimiters in PatchDocumentOptions

* chore: add validation for placeholder delimiters
2025-04-16 08:18:55 +01:00
4d1a351649 Documentation and Refactoring (#3028)
* Documentation and Refactoring

* Documentation and Refactoring

* Fix lint issues

* Convert components to Builder style

---------

Co-authored-by: Dolan Miu <dmiu@bloomberg.net>
2025-04-14 16:43:15 +05:30
8ba9a448d3 Version bump 2025-03-15 03:19:53 +00:00
a708475539 export IPropertiesOptions for use by other libraries or code using docx library (#2979)
* export IPropertiesOptions for use by other libraries or code using docx library

* fixes #2978: export OutputTypes

* Export file in main index file

* Move type export to inside

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2025-03-15 03:18:43 +00:00
9c60cfcbc7 build(deps): bump the npm_and_yarn group with 12 updates (#2992)
Bumps the npm_and_yarn group with 15 updates:

| Package | From | To |
| --- | --- | --- |
| [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `2.1.8` | `2.1.9` |
| [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `2.1.8` | `2.1.9` |
| [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) | `2.1.8` | `2.1.9` |
| [dompurify](https://github.com/cure53/DOMPurify) | `2.5.7` | `removed` |
| [docsify](https://github.com/docsifyjs/docsify) | `4.12.2` | `4.13.1` |
| [docsify-server-renderer](https://github.com/docsifyjs/docsify) | `4.12.2` | `4.13.1` |
| [elliptic](https://github.com/indutny/elliptic) | `6.6.0` | `6.6.1` |
| [esbuild](https://github.com/evanw/esbuild) | `0.21.5` | `0.25.1` |
| [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `2.1.9` | `3.0.8` |
| [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) | `2.1.9` | `3.0.8` |
| [tsx](https://github.com/privatenumber/tsx) | `4.19.2` | `4.19.3` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `6.0.9` | `6.2.2` |
| [vite-plugin-node-polyfills](https://github.com/davidmyersdev/vite-plugin-node-polyfills) | `0.22.0` | `0.23.0` |
| [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `2.1.9` | `3.0.8` |
| [prismjs](https://github.com/PrismJS/prism) | `1.27.0` | `1.30.0` |


Updates `vitest` from 2.1.8 to 2.1.9
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/vitest)

Updates `@vitest/coverage-v8` from 2.1.8 to 2.1.9
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/coverage-v8)

Updates `@vitest/ui` from 2.1.8 to 2.1.9
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/ui)

Removes `dompurify`

Updates `docsify` from 4.12.2 to 4.13.1
- [Release notes](https://github.com/docsifyjs/docsify/releases)
- [Changelog](https://github.com/docsifyjs/docsify/blob/v4.13.1/CHANGELOG.md)
- [Commits](https://github.com/docsifyjs/docsify/compare/v4.12.2...v4.13.1)

Updates `docsify-server-renderer` from 4.12.2 to 4.13.1
- [Release notes](https://github.com/docsifyjs/docsify/releases)
- [Changelog](https://github.com/docsifyjs/docsify/blob/v4.13.1/CHANGELOG.md)
- [Commits](https://github.com/docsifyjs/docsify/compare/v4.12.2...v4.13.1)

Updates `elliptic` from 6.6.0 to 6.6.1
- [Commits](https://github.com/indutny/elliptic/compare/v6.6.0...v6.6.1)

Updates `esbuild` from 0.21.5 to 0.25.1
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.5...v0.25.1)

Updates `@vitest/coverage-v8` from 2.1.9 to 3.0.8
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/coverage-v8)

Updates `@vitest/ui` from 2.1.9 to 3.0.8
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/ui)

Updates `tsx` from 4.19.2 to 4.19.3
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.19.2...v4.19.3)

Updates `vite` from 6.0.9 to 6.2.2
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.2.2/packages/vite)

Updates `vite-plugin-node-polyfills` from 0.22.0 to 0.23.0
- [Release notes](https://github.com/davidmyersdev/vite-plugin-node-polyfills/releases)
- [Commits](https://github.com/davidmyersdev/vite-plugin-node-polyfills/compare/v0.22.0...v0.23.0)

Updates `vitest` from 2.1.9 to 3.0.8
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/vitest)

Updates `prismjs` from 1.27.0 to 1.30.0
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.27.0...v1.30.0)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: "@vitest/coverage-v8"
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: dompurify
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: docsify
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: docsify-server-renderer
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: elliptic
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: esbuild
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: "@vitest/coverage-v8"
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: tsx
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: vite
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: vite-plugin-node-polyfills
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: vitest
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: prismjs
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-15 03:05:07 +00:00
a5454edc61 Feature/math improve (#2976)
* add new feature

* add test file

* update test file

* update test file

* Fix linting

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2025-03-15 03:04:01 +00:00
7152abfe48 build(deps-dev): bump eslint-plugin-jsdoc from 50.6.0 to 50.6.6 (#2987)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.0 to 50.6.6.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.0...v50.6.6)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:44:41 +00:00
075eeb7e3c build(deps-dev): bump eslint from 9.16.0 to 9.22.0 (#2983)
Bumps [eslint](https://github.com/eslint/eslint) from 9.16.0 to 9.22.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.16.0...v9.22.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:44:33 +00:00
f0acb3f3fb build(deps-dev): bump inquirer from 12.3.0 to 12.4.3 (#2982)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.3.0 to 12.4.3.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.3.0...inquirer@12.4.3)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:44:26 +00:00
ae048833a1 build(deps-dev): bump vite-plugin-dts from 4.3.0 to 4.5.3 (#2973)
Bumps [vite-plugin-dts](https://github.com/qmhc/vite-plugin-dts) from 4.3.0 to 4.5.3.
- [Release notes](https://github.com/qmhc/vite-plugin-dts/releases)
- [Changelog](https://github.com/qmhc/vite-plugin-dts/blob/main/CHANGELOG.md)
- [Commits](https://github.com/qmhc/vite-plugin-dts/compare/v4.3.0...v4.5.3)

---
updated-dependencies:
- dependency-name: vite-plugin-dts
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:44:17 +00:00
ebae72004c Fix support for after auto-spacing. (#2975) 2025-03-14 23:44:09 +00:00
13744abff5 build(deps-dev): bump cspell from 8.16.1 to 8.17.5 (#2969)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.16.1 to 8.17.5.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.17.5/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:43:46 +00:00
492ef29d7f build(deps-dev): bump vite from 6.0.7 to 6.0.9 in the npm_and_yarn group (#2940)
Bumps the npm_and_yarn group with 1 update: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 6.0.7 to 6.0.9
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.9/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:43:39 +00:00
a6e6463a36 build(deps-dev): bump jiti from 2.4.1 to 2.4.2 (#2932)
Bumps [jiti](https://github.com/unjs/jiti) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/unjs/jiti/releases)
- [Changelog](https://github.com/unjs/jiti/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unjs/jiti/compare/v2.4.1...v2.4.2)

---
updated-dependencies:
- dependency-name: jiti
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:43:32 +00:00
2ef596543b build(deps-dev): bump glob from 11.0.0 to 11.0.1 (#2930)
Bumps [glob](https://github.com/isaacs/node-glob) from 11.0.0 to 11.0.1.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v11.0.0...v11.0.1)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:43:25 +00:00
85005c3c07 build(deps-dev): bump jsdom from 25.0.1 to 26.0.0 (#2928)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 25.0.1 to 26.0.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/25.0.1...26.0.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 23:43:17 +00:00
0d2b433446 Chore: bump nanoid to fix security issue (#2991) 2025-03-14 23:43:08 +00:00
b1f67652e9 docs: add Playground (Docx.js Editor) url to README.md (#2965) 2025-02-23 20:36:33 +01:00
4e2befb7ef Update docs for new Packer methods (#2961)
To cover #2920
2025-02-17 21:22:07 +00:00
a887927968 Version bump 2025-02-16 18:35:16 +00:00
ee6db1429a Add shading and border settings to paragraph style options. (#2955)
* Add shading and border settings to paragraph style options.

* Fix prettier

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2025-02-16 18:33:21 +00:00
170309a7ed Add Packer.pack and Packer.toArrayBuffer (#2959)
* Add Packer.pack and Packer.toArrayBuffer

To mirror patchDocument's outputType parameter.

See https://github.com/dolanmiu/docx/discussions/2920

* Ignore coverage

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2025-02-16 18:24:15 +00:00
05fcf6edd4 Feat: subfile overrides (#2941)
* Adds overrides parameter to Packer methods and compiler

* Adds tests for overrides parameter

* Update Packer usage examples
2025-01-27 10:39:23 +00:00
eb2174e566 Version bump 2025-01-10 12:31:16 +00:00
2a56360875 build(deps-dev): bump typescript-eslint from 8.16.0 to 8.19.1 (#2921)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.16.0 to 8.19.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.19.1/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:22:37 +00:00
ba862766a6 build(deps-dev): bump vite from 6.0.1 to 6.0.7 (#2919)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.1 to 6.0.7.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.7/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:22:29 +00:00
71291dab8f build(deps-dev): bump typedoc from 0.27.3 to 0.27.6 (#2913)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.27.3 to 0.27.6.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.27.3...v0.27.6)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:22:21 +00:00
974ba7b450 build(deps-dev): bump inquirer from 12.1.0 to 12.3.0 (#2908)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.1.0 to 12.3.0.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.1.0...inquirer@12.3.0)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:22:13 +00:00
8f7df39c07 build(deps-dev): bump execa from 9.5.1 to 9.5.2 (#2892)
Bumps [execa](https://github.com/sindresorhus/execa) from 9.5.1 to 9.5.2.
- [Release notes](https://github.com/sindresorhus/execa/releases)
- [Commits](https://github.com/sindresorhus/execa/compare/v9.5.1...v9.5.2)

---
updated-dependencies:
- dependency-name: execa
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:22:03 +00:00
ca3d8f0121 build(deps-dev): bump vite-tsconfig-paths from 5.1.3 to 5.1.4 (#2890)
Bumps [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) from 5.1.3 to 5.1.4.
- [Release notes](https://github.com/aleclarson/vite-tsconfig-paths/releases)
- [Commits](https://github.com/aleclarson/vite-tsconfig-paths/compare/v5.1.3...v5.1.4)

---
updated-dependencies:
- dependency-name: vite-tsconfig-paths
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:21:55 +00:00
46c517d195 build(deps-dev): bump eslint-import-resolver-typescript (#2887)
Bumps [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) from 3.6.3 to 3.7.0.
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.6.3...v3.7.0)

---
updated-dependencies:
- dependency-name: eslint-import-resolver-typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 11:21:43 +00:00
ff37f3b460 fix: Ensure necessary namespaces are in patched doc (#2698)
* refactor: Extract timestamp properties

In preparation for reworking DocumentAttributes.

* refactor: Consolidate namespaces

* fix: Ensure necessary namespaces are in patched doc

Fixes #2697

* Fix tsc and ESLint errors

* Fix CSpell

* Add a test to fix code coverage failure
2025-01-06 22:19:00 +00:00
7b9b474484 Fix: custom fonts support on the Browser (#2898) 2024-12-19 02:08:52 +00:00
e80a50d36c #2846 Type error when importing docx in CJS file with TypeScript modu… (#2883)
* #2846 Type error when importing docx in CJS file with TypeScript moduleResolution set to node16

* Adhere to publint
2024-12-06 13:44:42 +00:00
df99f96469 Chore: Update vitest (#2882)
* Chore: Update vitest

* Fix test
2024-12-05 15:43:30 +00:00
f87ad6a43c build(deps-dev): bump typedoc from 0.26.11 to 0.27.3 (#2879)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.26.11 to 0.27.3.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.26.11...v0.27.3)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:04:43 +00:00
8bf5220e31 build(deps-dev): bump prettier from 3.3.3 to 3.4.2 (#2878)
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.3 to 3.4.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.3...3.4.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:04:24 +00:00
da8148251a build(deps-dev): bump eslint from 9.14.0 to 9.16.0 (#2874)
Bumps [eslint](https://github.com/eslint/eslint) from 9.14.0 to 9.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.14.0...v9.16.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:04:06 +00:00
01183ac34d build(deps-dev): bump jiti from 2.4.0 to 2.4.1 (#2871)
Bumps [jiti](https://github.com/unjs/jiti) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/unjs/jiti/releases)
- [Changelog](https://github.com/unjs/jiti/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unjs/jiti/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: jiti
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:03:46 +00:00
d553e4763a build(deps): bump @types/node from 22.9.0 to 22.10.1 (#2868)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.9.0 to 22.10.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:03:36 +00:00
213c3d29f3 build(deps-dev): bump eslint-plugin-unicorn from 56.0.0 to 56.0.1 (#2867)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 56.0.0 to 56.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v56.0.0...v56.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:03:28 +00:00
697c1d91c6 build(deps): bump nanoid from 5.0.8 to 5.0.9 (#2866)
Bumps [nanoid](https://github.com/ai/nanoid) from 5.0.8 to 5.0.9.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/5.0.8...5.0.9)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:03:07 +00:00
b22de4ac4f build(deps-dev): bump cspell from 8.16.0 to 8.16.1 (#2865)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.16.0 to 8.16.1.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.16.1/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 14:02:53 +00:00
0af9d27dcc Chore: Remove @eslint/compat (#2881) 2024-12-05 13:54:43 +00:00
b89b571c4e Fix replacer error on patches with empty Runs (#2875)
* Add test to demonstrate empty strings not creating runs

* Fix Run not creating Text child for empty strings

* Simplify TextRun constructor

Since `Run` already has a option for instantiating a `Text` element, we don't need to push children here.

* Add replacer test for empty runs

* Add replacer test for empty runs

* replacer: handle patches with empty runs

* Fix incorrect test name
2024-12-03 11:25:22 +00:00
64505a295f build(deps-dev): bump eslint-plugin-jsdoc from 50.4.3 to 50.6.0 (#2863)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.4.3 to 50.6.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.4.3...v50.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:47:45 +00:00
c247bbf409 build(deps-dev): bump @vitest/ui from 2.1.4 to 2.1.6 (#2862)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 2.1.4 to 2.1.6.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.6/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:47:22 +00:00
4c60e6a0c0 build(deps-dev): bump vite from 5.4.10 to 6.0.1 (#2861)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.10 to 6.0.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.0.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:47:13 +00:00
086e5ef184 build(deps-dev): bump typescript-eslint from 8.13.0 to 8.16.0 (#2857)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.13.0 to 8.16.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.16.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:46:36 +00:00
7e81f7b368 build(deps-dev): bump vite-tsconfig-paths from 5.1.0 to 5.1.3 (#2850)
Bumps [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) from 5.1.0 to 5.1.3.
- [Release notes](https://github.com/aleclarson/vite-tsconfig-paths/releases)
- [Commits](https://github.com/aleclarson/vite-tsconfig-paths/compare/v5.1.0...v5.1.3)

---
updated-dependencies:
- dependency-name: vite-tsconfig-paths
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:46:26 +00:00
defa431aa9 build(deps-dev): bump inquirer from 12.0.1 to 12.1.0 (#2838)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.0.1 to 12.1.0.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.0.1...inquirer@12.1.0)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 10:44:33 +00:00
17eb4fe8c4 Version bump 2024-11-28 10:38:29 +00:00
3997ce538d fix(replacer): errors suppressed by catch statement (#2856) 2024-11-28 10:35:11 +00:00
3654eb0800 New Textbox Component (#2718)
* Adding textbox with no props

* Fixing namings and adding shape style

* simplify usage

* Fix linting issues

* Re-name demo

* Use new shape authoring style

* Add tests

Simplify API

* Add better types for styles

* Add more options to TextBox and add documentation

---------

Co-authored-by: zohar11 <zohar@sumit-ai.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-11-28 10:33:19 +00:00
c6bb255641 Add hyphenation support (#2678)
* Add hyphenation support

* Remove unneeded linebreaks

* Add documentation and fix eslint

* Add tests

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-11-21 10:41:31 +00:00
05a3cf5b43 fix: add rel to fontTable (#2800)
* fix: add rel to fontTable

* Fix prettier

---------

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-11-20 11:19:43 +00:00
dece0f58e1 Fix duplicated br tags (#2717)
* Adjust test to demo duplicated br tags

* Fix patchDocument duplicating br tags

* Only include w:Pr

* Fix tag condition

---------

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-11-20 11:19:25 +00:00
7f3c5615c9 Version bump 2024-11-07 23:46:27 +00:00
56d23176b7 build(deps-dev): bump cspell from 8.15.7 to 8.16.0 (#2834)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.15.7 to 8.16.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.16.0/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 20:56:09 +00:00
958538c96a build(deps): bump @types/node from 22.8.6 to 22.9.0 (#2833)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.8.6 to 22.9.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 02:50:49 +00:00
9fa6d5392b build(deps-dev): bump typescript-eslint from 8.12.2 to 8.13.0 (#2832)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.12.2 to 8.13.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.13.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 02:50:41 +00:00
d7fdbf9736 build(deps-dev): bump @typescript-eslint/parser from 8.12.2 to 8.13.0 (#2831)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.12.2 to 8.13.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.13.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 02:40:01 +00:00
0af1279b1d build(deps-dev): bump vite-tsconfig-paths from 5.0.1 to 5.1.0 (#2830)
Bumps [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) from 5.0.1 to 5.1.0.
- [Release notes](https://github.com/aleclarson/vite-tsconfig-paths/releases)
- [Commits](https://github.com/aleclarson/vite-tsconfig-paths/compare/v5.0.1...v5.1.0)

---
updated-dependencies:
- dependency-name: vite-tsconfig-paths
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-06 00:54:50 +00:00
2bb2333cb9 build(deps-dev): bump @typescript-eslint/eslint-plugin (#2829)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.12.2 to 8.13.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.13.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-06 00:54:42 +00:00
78c511cab9 build(deps-dev): bump tsx from 4.19.1 to 4.19.2 (#2827)
Bumps [tsx](https://github.com/privatenumber/tsx) from 4.19.1 to 4.19.2.
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.19.1...v4.19.2)

---
updated-dependencies:
- dependency-name: tsx
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:55 +00:00
4016e961a9 build(deps-dev): bump typedoc from 0.26.10 to 0.26.11 (#2826)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.26.10 to 0.26.11.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.26.10...v0.26.11)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:48 +00:00
9f3888d94f build(deps-dev): bump @eslint/compat from 1.2.1 to 1.2.2 (#2825)
Bumps [@eslint/compat](https://github.com/eslint/rewrite) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/eslint/rewrite/releases)
- [Changelog](https://github.com/eslint/rewrite/blob/main/release-please-config.json)
- [Commits](https://github.com/eslint/rewrite/compare/compat-v1.2.1...compat-v1.2.2)

---
updated-dependencies:
- dependency-name: "@eslint/compat"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:41 +00:00
316891a1f2 build(deps-dev): bump @vitest/ui from 2.1.3 to 2.1.4 (#2824)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.4/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:33 +00:00
0a9d844dcc build(deps-dev): bump jiti from 2.3.3 to 2.4.0 (#2823)
Bumps [jiti](https://github.com/unjs/jiti) from 2.3.3 to 2.4.0.
- [Release notes](https://github.com/unjs/jiti/releases)
- [Changelog](https://github.com/unjs/jiti/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unjs/jiti/compare/v2.3.3...v2.4.0)

---
updated-dependencies:
- dependency-name: jiti
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:24 +00:00
15b8d85562 build(deps-dev): bump cspell from 8.15.4 to 8.15.7 (#2822)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.15.4 to 8.15.7.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.15.7/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:17 +00:00
d1f3df5600 build(deps): bump nanoid from 5.0.7 to 5.0.8 (#2821)
Bumps [nanoid](https://github.com/ai/nanoid) from 5.0.7 to 5.0.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/5.0.7...5.0.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:08 +00:00
0fc0921aa9 build(deps-dev): bump eslint from 9.13.0 to 9.14.0 (#2820)
Bumps [eslint](https://github.com/eslint/eslint) from 9.13.0 to 9.14.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.13.0...v9.14.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:02:02 +00:00
7ad4c5409c build(deps-dev): bump typescript-eslint from 8.10.0 to 8.12.2 (#2816)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.10.0 to 8.12.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.12.2/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 01:01:53 +00:00
a645accf5d build(deps-dev): bump @typescript-eslint/eslint-plugin (#2815)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.10.0 to 8.12.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.12.2/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 23:17:44 +00:00
b64cb2d448 build(deps): bump @types/node from 22.7.6 to 22.8.6 (#2819)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.7.6 to 22.8.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:59:26 +00:00
cfcea6c863 build(deps-dev): bump elliptic in the npm_and_yarn group (#2817)
Bumps the npm_and_yarn group with 1 update: [elliptic](https://github.com/indutny/elliptic).


Updates `elliptic` from 6.5.7 to 6.6.0
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.7...v6.6.0)

---
updated-dependencies:
- dependency-name: elliptic
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:59:13 +00:00
d1cd17ff6e build(deps-dev): bump @typescript-eslint/parser from 8.10.0 to 8.12.2 (#2814)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.10.0 to 8.12.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.12.2/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:54 +00:00
408869fa96 build(deps-dev): bump execa from 9.4.1 to 9.5.1 (#2808)
Bumps [execa](https://github.com/sindresorhus/execa) from 9.4.1 to 9.5.1.
- [Release notes](https://github.com/sindresorhus/execa/releases)
- [Commits](https://github.com/sindresorhus/execa/compare/v9.4.1...v9.5.1)

---
updated-dependencies:
- dependency-name: execa
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:46 +00:00
ed146fbffd build(deps-dev): bump inquirer from 12.0.0 to 12.0.1 (#2805)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 12.0.0 to 12.0.1.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@12.0.0...inquirer@12.0.1)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:37 +00:00
e49e1cc7b9 build(deps-dev): bump vite-plugin-dts from 4.2.4 to 4.3.0 (#2803)
Bumps [vite-plugin-dts](https://github.com/qmhc/vite-plugin-dts) from 4.2.4 to 4.3.0.
- [Release notes](https://github.com/qmhc/vite-plugin-dts/releases)
- [Changelog](https://github.com/qmhc/vite-plugin-dts/blob/main/CHANGELOG.md)
- [Commits](https://github.com/qmhc/vite-plugin-dts/compare/v4.2.4...v4.3.0)

---
updated-dependencies:
- dependency-name: vite-plugin-dts
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:29 +00:00
2c9233c021 build(deps-dev): bump vite from 5.4.9 to 5.4.10 (#2801)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.9 to 5.4.10.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.10/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.10/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:22 +00:00
b2ad04e4e7 build(deps-dev): bump eslint-plugin-functional from 7.0.2 to 7.1.0 (#2794)
Bumps [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) from 7.0.2 to 7.1.0.
- [Release notes](https://github.com/eslint-functional/eslint-plugin-functional/releases)
- [Changelog](https://github.com/eslint-functional/eslint-plugin-functional/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-functional/eslint-plugin-functional/compare/v7.0.2...v7.1.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-functional
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-02 22:58:14 +00:00
2381ba8a05 build(deps-dev): bump eslint from 8.57.1 to 9.13.0 (#2792)
* build(deps-dev): bump eslint from 8.57.1 to 9.13.0

Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade EsLint

* Fix all new lint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-21 03:57:15 +01:00
9cff0b2a57 docs!: Add ProtonMail as user (#2793) 2024-10-19 18:26:01 +01:00
a4754ebcfe build(deps-dev): bump @typescript-eslint/parser from 8.9.0 to 8.10.0 (#2791)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.9.0 to 8.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.10.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 04:18:36 +01:00
8988f471c3 build(deps-dev): bump cspell from 8.15.2 to 8.15.4 (#2790)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.15.2 to 8.15.4.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.15.4/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 04:18:22 +01:00
5f4ff94e26 build(deps-dev): bump @typescript-eslint/eslint-plugin (#2789)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.9.0 to 8.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.10.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 04:18:02 +01:00
6f531c5abc build(deps-dev): bump eslint-plugin-jsdoc from 50.4.1 to 50.4.3 (#2788)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.4.1 to 50.4.3.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.4.1...v50.4.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 03:45:07 +01:00
c761a362d1 build(deps): bump @types/node from 22.7.5 to 22.7.6 (#2787)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.7.5 to 22.7.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 03:44:58 +01:00
2e155ddebc build(deps-dev): bump execa from 9.4.0 to 9.4.1 (#2785)
Bumps [execa](https://github.com/sindresorhus/execa) from 9.4.0 to 9.4.1.
- [Release notes](https://github.com/sindresorhus/execa/releases)
- [Commits](https://github.com/sindresorhus/execa/compare/v9.4.0...v9.4.1)

---
updated-dependencies:
- dependency-name: execa
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-19 03:44:49 +01:00
9c8a07eadc build(deps-dev): bump typedoc from 0.26.9 to 0.26.10 (#2784)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.26.9 to 0.26.10.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.26.9...v0.26.10)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-16 22:00:14 +01:00
9cb9c8c462 build(deps-dev): bump execa from 8.0.1 to 9.4.0 (#2782)
Bumps [execa](https://github.com/sindresorhus/execa) from 8.0.1 to 9.4.0.
- [Release notes](https://github.com/sindresorhus/execa/releases)
- [Commits](https://github.com/sindresorhus/execa/compare/v8.0.1...v9.4.0)

---
updated-dependencies:
- dependency-name: execa
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 22:49:44 +01:00
4268c9d466 build(deps-dev): bump eslint-plugin-jsdoc from 50.4.0 to 50.4.1 (#2783)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.4.0 to 50.4.1.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.4.0...v50.4.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:16:13 +01:00
26f77eb45f build(deps-dev): bump @typescript-eslint/eslint-plugin (#2781)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.8.1 to 8.9.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.9.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:15:47 +01:00
dea23e4349 build(deps-dev): bump inquirer from 9.2.12 to 12.0.0 (#2780)
Bumps [inquirer](https://github.com/SBoudrias/Inquirer.js) from 9.2.12 to 12.0.0.
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/inquirer@9.2.12...inquirer@12.0.0)

---
updated-dependencies:
- dependency-name: inquirer
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:15:38 +01:00
0ade4b1557 build(deps-dev): bump @typescript-eslint/parser from 8.8.1 to 8.9.0 (#2779)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.8.1 to 8.9.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.9.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:15:30 +01:00
165d48323b build(deps-dev): bump vite-plugin-node-polyfills from 0.19.0 to 0.22.0 (#2778)
Bumps [vite-plugin-node-polyfills](https://github.com/davidmyersdev/vite-plugin-node-polyfills) from 0.19.0 to 0.22.0.
- [Release notes](https://github.com/davidmyersdev/vite-plugin-node-polyfills/releases)
- [Commits](https://github.com/davidmyersdev/vite-plugin-node-polyfills/compare/v0.19.0...v0.22.0)

---
updated-dependencies:
- dependency-name: vite-plugin-node-polyfills
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:15:21 +01:00
179598cc07 build(deps-dev): bump vite from 5.4.8 to 5.4.9 (#2776)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.8 to 5.4.9.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.9/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.9/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 14:15:13 +01:00
a8656ca3fe build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.0.0 to 8.8.1 (#2769)
* build(deps-dev): bump @typescript-eslint/eslint-plugin

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.0.0 to 8.8.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.8.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: Deprecate @typescript-eslint/ban-types

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-15 02:39:29 +01:00
020e0eb669 build(deps-dev): bump typedoc from 0.25.12 to 0.26.9 (#2775)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.25.12 to 0.26.9.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.25.12...v0.26.9)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:40:25 +01:00
e5dfce523a build(deps-dev): bump eslint-plugin-jsdoc from 50.3.1 to 50.4.0 (#2774)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.3.1 to 50.4.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.3.1...v50.4.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:40:17 +01:00
b53b4a77b4 build(deps): bump nanoid from 5.0.4 to 5.0.7 (#2773)
Bumps [nanoid](https://github.com/ai/nanoid) from 5.0.4 to 5.0.7.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/5.0.4...5.0.7)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:40:08 +01:00
dd86cf3d27 build(deps-dev): bump @vitest/ui from 2.1.2 to 2.1.3 (#2772)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.3/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:40:02 +01:00
32953b3696 build(deps-dev): bump eslint-plugin-import from 2.29.1 to 2.31.0 (#2771)
Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.29.1 to 2.31.0.
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.1...v2.31.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:39:53 +01:00
cfec058c9d build(deps-dev): bump @types/unzipper from 0.10.9 to 0.10.10 (#2770)
Bumps [@types/unzipper](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/unzipper) from 0.10.9 to 0.10.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/unzipper)

---
updated-dependencies:
- dependency-name: "@types/unzipper"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:39:44 +01:00
a1c07d5a8e build(deps-dev): bump prettier from 3.2.5 to 3.3.3 (#2768)
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.5 to 3.3.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.5...3.3.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:39:30 +01:00
5be745b081 build(deps-dev): bump cspell from 8.15.1 to 8.15.2 (#2766)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.15.1 to 8.15.2.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.15.2/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 00:38:30 +01:00
b4fcfd6386 Version bump 2024-10-14 01:51:16 +01:00
6e371d42a7 fix: npm publish install 2024-10-14 01:47:59 +01:00
e8564d58c6 Create SECURITY.md (#2765) 2024-10-14 00:09:03 +01:00
368aa431a0 build(deps-dev): bump vite-tsconfig-paths from 4.2.3 to 5.0.1 (#2758)
Bumps [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) from 4.2.3 to 5.0.1.
- [Release notes](https://github.com/aleclarson/vite-tsconfig-paths/releases)
- [Commits](https://github.com/aleclarson/vite-tsconfig-paths/compare/v4.2.3...v5.0.1)

---
updated-dependencies:
- dependency-name: vite-tsconfig-paths
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-13 23:02:22 +01:00
afcd1ae060 build(deps-dev): bump @vitest/ui from 1.4.0 to 2.1.2 (#2757)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 1.4.0 to 2.1.2.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.2/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-13 23:02:12 +01:00
244d2b8904 build(deps-dev): bump cspell from 8.3.2 to 8.15.1 (#2763)
Bumps [cspell](https://github.com/streetsidesoftware/cspell/tree/HEAD/packages/cspell) from 8.3.2 to 8.15.1.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/packages/cspell/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/commits/v8.15.1/packages/cspell)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 20:27:03 +01:00
6dae62e1ab build(deps-dev): bump vite-plugin-dts from 3.7.0 to 4.2.4 (#2761)
Bumps [vite-plugin-dts](https://github.com/qmhc/vite-plugin-dts) from 3.7.0 to 4.2.4.
- [Release notes](https://github.com/qmhc/vite-plugin-dts/releases)
- [Changelog](https://github.com/qmhc/vite-plugin-dts/blob/main/CHANGELOG.md)
- [Commits](https://github.com/qmhc/vite-plugin-dts/compare/v3.7.0...v4.2.4)

---
updated-dependencies:
- dependency-name: vite-plugin-dts
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 20:26:54 +01:00
5810cb5f02 build(deps-dev): bump ws from 7.5.7 to 7.5.10 (#2764)
Bumps [ws](https://github.com/websockets/ws) from 7.5.7 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.7...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 20:26:41 +01:00
11c26af3a9 build(deps-dev): bump eslint-plugin-unicorn from 50.0.1 to 56.0.0 (#2756)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 50.0.1 to 56.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v50.0.1...v56.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 20:26:19 +01:00
1b9b815214 build(deps-dev): bump eslint-plugin-functional from 6.0.0 to 6.6.3 (#2755)
Bumps [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) from 6.0.0 to 6.6.3.
- [Release notes](https://github.com/eslint-functional/eslint-plugin-functional/releases)
- [Changelog](https://github.com/eslint-functional/eslint-plugin-functional/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-functional/eslint-plugin-functional/compare/v6.0.0...v6.6.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-functional
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-13 20:26:05 +01:00
c342137c6f build(deps-dev): bump jsdom from 24.0.0 to 25.0.1 (#2754)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 24.0.0 to 25.0.1.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/24.0.0...25.0.1)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 02:55:07 +01:00
eefc8bd8a5 build(deps-dev): bump unzipper from 0.10.14 to 0.12.3 (#2753)
Bumps [unzipper](https://github.com/ZJONSSON/node-unzipper) from 0.10.14 to 0.12.3.
- [Release notes](https://github.com/ZJONSSON/node-unzipper/releases)
- [Commits](https://github.com/ZJONSSON/node-unzipper/commits/v0.12.3)

---
updated-dependencies:
- dependency-name: unzipper
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-13 02:54:58 +01:00
9873861210 build(deps-dev): bump glob from 10.3.10 to 11.0.0 (#2752)
Bumps [glob](https://github.com/isaacs/node-glob) from 10.3.10 to 11.0.0.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.3.10...v11.0.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-13 02:34:04 +01:00
cf7a05e05d build(deps-dev): bump tsx from 4.7.0 to 4.19.1 (#2750)
Bumps [tsx](https://github.com/privatenumber/tsx) from 4.7.0 to 4.19.1.
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.7.0...v4.19.1)

---
updated-dependencies:
- dependency-name: tsx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 02:14:45 +01:00
6eb11d8842 Revert github action version change 2024-10-13 02:06:22 +01:00
3ad68337e7 Version bump 2024-10-13 01:58:44 +01:00
07f363fcb7 feat: Add npm publish GitHub Action workflow (#2762)
* feat: Add npm publish GitHub Action workflow

* Fix typo
2024-10-13 01:48:04 +01:00
2d2e4cdab2 fix: Missing text property for patchDocument (#2760)
* fix: Missing text property

Ignore <br /> for patched files

* Fix spelling issues
2024-10-13 01:29:32 +01:00
0cadec7f58 build(deps-dev): bump @typescript-eslint/parser from 6.17.0 to 8.8.1 (#2742)
* build(deps-dev): bump @typescript-eslint/parser from 6.17.0 to 8.8.1

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.17.0 to 8.8.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.8.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix type definitions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-11 04:47:51 +01:00
e86dbd3398 Change ImageRun keys to be based on image data content (#2681)
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:13:51 +01:00
021f1b0c4d Update bullet-points.md (#2684)
Excluding ; from example

Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:13:26 +01:00
5aa2027252 build(deps): bump send and serve-static (#2736)
Bumps [send](https://github.com/pillarjs/send) and [serve-static](https://github.com/expressjs/serve-static). These dependencies needed to be updated together.

Updates `send` from 0.17.2 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](https://github.com/pillarjs/send/compare/0.17.2...0.19.0)

Updates `serve-static` from 1.14.2 to 1.16.2
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](https://github.com/expressjs/serve-static/compare/v1.14.2...v1.16.2)

---
updated-dependencies:
- dependency-name: send
  dependency-type: indirect
- dependency-name: serve-static
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:13:14 +01:00
2fc297ef3c build(deps-dev): bump braces from 3.0.2 to 3.0.3 (#2749)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:12:50 +01:00
3fe216846c build(deps-dev): bump dompurify from 2.3.6 to 2.5.7 (#2737)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.3.6 to 2.5.7.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.3.6...2.5.7)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:05:41 +01:00
649a50f7c5 build(deps-dev): bump serve-static from 1.14.2 to 1.16.2 (#2739)
Bumps [serve-static](https://github.com/expressjs/serve-static) from 1.14.2 to 1.16.2.
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](https://github.com/expressjs/serve-static/compare/v1.14.2...v1.16.2)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:05:35 +01:00
dc14123a5a build(deps-dev): bump rollup from 3.29.4 to 4.24.0 (#2740)
Bumps [rollup](https://github.com/rollup/rollup) from 3.29.4 to 4.24.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v3.29.4...v4.24.0)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 01:05:25 +01:00
048a035a5d build(deps-dev): bump elliptic from 6.5.4 to 6.5.7 (#2738)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.4 to 6.5.7.
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.4...v6.5.7)

---
updated-dependencies:
- dependency-name: elliptic
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:58:47 +01:00
f212cf0251 Update styling-with-js.md (#2734)
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:57:11 +01:00
1f2f5988e1 build(deps-dev): bump vite from 5.0.10 to 5.4.8 (#2741)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.10 to 5.4.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.8/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:56:49 +01:00
f1359a4750 build(deps-dev): bump @types/prompt from 1.1.8 to 1.1.9 (#2746)
Bumps [@types/prompt](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prompt) from 1.1.8 to 1.1.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prompt)

---
updated-dependencies:
- dependency-name: "@types/prompt"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:33:21 +01:00
f2775ed13c build(deps): bump @types/node from 20.12.4 to 22.7.5 (#2747)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.12.4 to 22.7.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:33:12 +01:00
3ae749278e build(deps-dev): bump eslint-plugin-jsdoc from 48.0.2 to 50.3.1 (#2745)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 48.0.2 to 50.3.1.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v48.0.2...v50.3.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-10-11 00:30:35 +01:00
0bcc6910f4 Use codecov token (#2748)
* Use codecov token

* Using env to pass token
2024-10-11 00:22:43 +01:00
c15951550c Version bump 2024-10-10 01:30:32 +01:00
8308b6413e Add documentation 2024-10-10 00:38:25 +01:00
5b75875684 Enable rollupTypes in the vite build configuration. (#2714)
This resolves issues with in dependent TypeScipt packages that are using moduleResolution: NodeNext
Modern ES modules cannot use extensionless relative paths in imports.
2024-10-10 00:15:04 +01:00
28029f4c1c chore[tables.md]: replace semicolon to commas (#2708) 2024-10-10 00:14:09 +01:00
824d7f9893 build(deps-dev): bump vite from 5.0.10 to 5.2.8 (#2668)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.10 to 5.2.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 00:13:52 +01:00
b3aea4b9a0 build(deps-dev): bump @vitest/coverage-v8 from 1.1.1 to 1.4.0 (#2645)
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 1.1.1 to 1.4.0.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.4.0/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 00:10:13 +01:00
32377d187d build(deps-dev): bump @vitest/ui from 1.1.1 to 1.4.0 (#2644)
Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 1.1.1 to 1.4.0.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.4.0/packages/ui)

---
updated-dependencies:
- dependency-name: "@vitest/ui"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:26:07 +01:00
a80815822d build(deps-dev): bump vitest from 1.1.1 to 1.4.0 (#2642)
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.1.1 to 1.4.0.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v1.4.0/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:26:01 +01:00
c198154fdc build(deps-dev): bump typedoc from 0.25.6 to 0.25.12 (#2634)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.25.6 to 0.25.12.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.25.6...v0.25.12)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:25:52 +01:00
618c7a8578 build(deps-dev): bump @typescript-eslint/eslint-plugin (#2595)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.17.0 to 7.0.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:25:44 +01:00
ef7b930d4d build(deps-dev): bump prettier from 3.1.1 to 3.2.5 (#2579)
Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.5)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:25:29 +01:00
8296895cc6 build(deps-dev): bump jsdom from 23.0.1 to 24.0.0 (#2557)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 23.0.1 to 24.0.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/23.0.1...24.0.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:25:12 +01:00
1dce6fee15 build(deps): bump @types/node from 20.10.6 to 20.12.4 (#2669)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.10.6 to 20.12.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-09 21:25:03 +01:00
444e7771b4 Version bump 2024-10-09 21:21:08 +01:00
962795743c feat: Add ability to detect patches which are present in a file (#2633)
* feat: Add ability to detect patches which are present in a file

* chore: export patchDetector function

* fix: Make sure we don't attempt to call toJson on binary content

---------

Co-authored-by: Christopher Fox <cfox@homebound.com>
2024-05-22 03:05:48 +01:00
f98f852a55 Allow disabling numbering inherited from a paragraph style (#2531) 2024-05-20 03:15:11 +01:00
e379a7fe04 Document the 'keepOriginalStyles' options (#2549)
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-05-20 03:13:05 +01:00
331 changed files with 15171 additions and 9478 deletions

View File

@ -8,11 +8,14 @@
// words - list of words to be always considered correct
"words": [
"Abjad",
"aink",
"aiueo",
"ATLEAST",
"chosung",
"clippy",
"datas",
"dcmitype",
"dcterms",
"docsify",
"dolan",
"execa",
@ -32,6 +35,7 @@
"panose",
"rels",
"rsid",
"sdtdh",
"twip",
"twips",
"Xmlable",

View File

@ -1,238 +0,0 @@
extends: eslint:recommended
env:
browser: true
es6: true
node: true
parser: "@typescript-eslint/parser"
parserOptions:
project:
- tsconfig.json
sourceType: module
plugins:
- eslint-plugin-import
- eslint-plugin-no-null
- eslint-plugin-unicorn
- eslint-plugin-jsdoc
- eslint-plugin-prefer-arrow
- "@typescript-eslint"
- eslint-plugin-functional
root: true
rules:
no-undef: "off"
no-extra-boolean-cast: "off"
no-alert: error
no-self-compare: error
no-unreachable-loop: error
no-template-curly-in-string: error
no-unused-private-class-members: error
no-extend-native: error
no-floating-decimal: error
no-implied-eval: error
no-iterator: error
no-lone-blocks: error
no-loop-func: error
no-new-object: error
no-proto: error
no-useless-catch: error
one-var-declaration-per-line: error
prefer-arrow-callback: error
prefer-destructuring: error
prefer-exponentiation-operator: error
prefer-promise-reject-errors: error
prefer-regex-literals: error
prefer-spread: error
prefer-template: error
require-await: error
"@typescript-eslint/adjacent-overload-signatures": error
"@typescript-eslint/array-type":
- error
- default: array
"@typescript-eslint/ban-types":
- error
- types:
Object:
message: Avoid using the `Object` type. Did you mean `object`?
Function:
message: >-
Avoid using the `Function` type. Prefer a specific function type,
like `() => void`.
Boolean:
message: Avoid using the `Boolean` type. Did you mean `boolean`?
Number:
message: Avoid using the `Number` type. Did you mean `number`?
String:
message: Avoid using the `String` type. Did you mean `string`?
Symbol:
message: Avoid using the `Symbol` type. Did you mean `symbol`?
"@typescript-eslint/consistent-type-assertions": error
"@typescript-eslint/dot-notation": error
"@typescript-eslint/explicit-function-return-type":
- error
- allowExpressions: true
allowTypedFunctionExpressions: true
allowHigherOrderFunctions: false
allowDirectConstAssertionInArrowFunctions: true
allowConciseArrowFunctionExpressionsStartingWithVoid: true
"@typescript-eslint/explicit-member-accessibility":
- error
- accessibility: explicit
overrides:
accessors: explicit
"@typescript-eslint/explicit-module-boundary-types":
- error
- allowArgumentsExplicitlyTypedAsAny: true
allowDirectConstAssertionInArrowFunctions: true
allowHigherOrderFunctions: false
allowTypedFunctionExpressions: false
"@typescript-eslint/naming-convention":
- error
- selector:
- objectLiteralProperty
leadingUnderscore: allow
format:
- camelCase
- PascalCase
- UPPER_CASE # for constants
filter:
regex: (^[a-z]+:.+)|_attr|[0-9]
match: false
"@typescript-eslint/no-empty-function": error
"@typescript-eslint/no-empty-interface": error
"@typescript-eslint/no-explicit-any": error
"@typescript-eslint/no-misused-new": error
"@typescript-eslint/no-namespace": error
"@typescript-eslint/no-parameter-properties": "off"
"@typescript-eslint/no-require-imports": error
"@typescript-eslint/no-shadow":
- error
- hoist: all
"@typescript-eslint/no-this-alias": error
"@typescript-eslint/no-unused-expressions": error
"@typescript-eslint/no-use-before-define": "off"
"@typescript-eslint/no-var-requires": error
"@typescript-eslint/prefer-for-of": error
"@typescript-eslint/prefer-function-type": error
"@typescript-eslint/prefer-namespace-keyword": error
"@typescript-eslint/prefer-readonly": error
"@typescript-eslint/triple-slash-reference":
- error
- path: always
types: prefer-import
lib: always
"@typescript-eslint/typedef":
- error
- parameter: true
propertyDeclaration: true
"@typescript-eslint/unified-signatures": error
arrow-body-style: error
complexity: "off"
consistent-return: error
constructor-super: error
curly: error
dot-notation: "off"
eqeqeq:
- error
- smart
guard-for-in: error
id-denylist:
- error
- any
- Number
- number
- String
- string
- Boolean
- boolean
- Undefined
- undefined
id-match: error
import/no-default-export: error
import/no-extraneous-dependencies: "off"
import/no-internal-modules: "off"
import/order: error
indent: "off"
jsdoc/check-alignment: error
jsdoc/check-indentation: "off"
max-classes-per-file: "off"
max-len: "off"
new-parens: error
no-bitwise: error
no-caller: error
no-cond-assign: error
no-console: error
no-debugger: error
no-duplicate-case: error
no-duplicate-imports: error
no-empty: error
no-empty-function: "off"
no-eval: error
no-extra-bind: error
no-fallthrough: "off"
no-invalid-this: "off"
no-multiple-empty-lines: error
no-new-func: error
no-new-wrappers: error
no-null/no-null: error
no-param-reassign: error
no-redeclare: error
no-return-await: error
no-sequences: error
no-shadow: "off"
no-sparse-arrays: error
no-throw-literal: error
no-trailing-spaces: error
no-undef-init: error
no-underscore-dangle:
- error
- allow:
- _attr
no-unsafe-finally: error
no-unused-expressions: "off"
no-unused-labels: error
no-use-before-define: "off"
no-useless-constructor: error
no-var: error
object-shorthand: "off"
one-var:
- error
- never
prefer-arrow/prefer-arrow-functions: error
prefer-const: error
prefer-object-spread: error
radix: error
space-in-parens:
- error
- never
spaced-comment:
- error
- always
- markers:
- /
unicorn/filename-case: error
unicorn/prefer-ternary: error
use-isnan: error
valid-typeof: "off"
functional/immutable-data:
- error
- ignoreImmediateMutation: true
ignoreAccessorPattern:
- "**.root*"
- "**.numberingReferences*"
- "**.sections*"
- "**.properties*"
functional/prefer-property-signatures: error
functional/no-mixed-types: error
functional/prefer-readonly-type: error
no-unused-vars:
- error
- argsIgnorePattern: ^[_]+$
ignorePatterns:
- vite.config.ts
overrides:
- files:
- "*.spec.ts"
rules:
"@typescript-eslint/no-unused-expressions": "off"
"@typescript-eslint/dot-notation": "off"
prefer-destructuring: "off"
"@typescript-eslint/explicit-function-return-type": "off"

View File

@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- uses: "./.github/actions/install-and-build"
- name: Archive Production Artifact
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: build
path: build
@ -25,22 +25,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Test
run: npm run test:ci
- name: Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Lint
@ -50,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Prettier
@ -60,8 +62,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Prettier
- name: CSpell
run: npm run cspell

View File

@ -12,7 +12,7 @@ jobs:
name: Demos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: "./.github/actions/install-and-build"
- name: Run Demos
run: npm run run-ts -- ./demo/1-basic.ts

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Build 🔧
@ -19,7 +19,7 @@ jobs:
echo "docx.js.org" > docs/.nojekyll
echo "docx.js.org" > docs/CNAME
- name: Archive Production Artifact
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: docs
path: docs
@ -28,11 +28,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo 🛎️
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci --force
- name: Download Artifact
uses: actions/download-artifact@master
uses: actions/download-artifact@v4
with:
name: docs
path: docs

46
.github/workflows/npm-publish.yml vendored Normal file
View File

@ -0,0 +1,46 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
on:
release:
types: [created]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm ci --force
- run: npm run cspell
- run: npm run prettier
- run: npm run lint
- run: npm run test:ci
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm ci --force
- run: npm run build
publish-npm:
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: https://registry.npmjs.org/
- run: npm ci --force
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

3
.gitignore vendored
View File

@ -33,8 +33,7 @@ node_modules
.node_repl_history
# build
build
build-tests
dist
# Documentation
docs/api/

View File

@ -5,5 +5,6 @@
"editor.formatOnSave": false,
"prettier.tabWidth": 4,
"prettier.arrowParens": "always",
"prettier.bracketSpacing": true
"prettier.bracketSpacing": true,
"eslint.useFlatConfig": true
}

View File

@ -14,6 +14,7 @@
[![Known Vulnerabilities][snky-image]][snky-url]
[![PRs Welcome][pr-image]][pr-url]
[![codecov][codecov-image]][codecov-url]
[![Docx.js Editor][docxjs-editor-image]][docxjs-editor-url]
<p align="center">
<img src="https://i.imgur.com/QeL1HuU.png" alt="drawing"/>
@ -64,6 +65,10 @@ More [here](https://github.com/dolanmiu/docx/tree/master/demo)
Please refer to the [documentation at https://docx.js.org/](https://docx.js.org/) for details on how to use this library, examples and much more!
# Playground
Experience `docx` in action through [Docx.js Editor][docxjs-editor-url], an interactive playground where you can code and preview the results in real-time.
# Examples
Check the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples.
@ -88,6 +93,7 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
[<img src="https://i.imgur.com/9tqJaHw.png" alt="drawing" height="50"/>](https://novelpad.co/)
[<img src="https://i.imgur.com/5bLKFeP.png" alt="drawing" height="50"/>](https://proton.me/)
...and many more!
@ -114,3 +120,5 @@ Made with 💖
[patreon-url]: https://www.patreon.com/dolanmiu
[browserstack-image]: https://user-images.githubusercontent.com/2917613/54233552-128e9d00-4505-11e9-88fb-025a4e04007c.png
[browserstack-url]: https://www.browserstack.com
[docxjs-editor-image]: https://img.shields.io/badge/Docx.js%20Editor-2b579a.svg?style=flat&amp;logo=javascript&amp;logoColor=white
[docxjs-editor-url]: https://docxjs-editor.vercel.app/

24
SECURITY.md Normal file
View File

@ -0,0 +1,24 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 9.0.x | :white_check_mark: |
## Reporting a Vulnerability
We encourage responsible disclosure of security vulnerabilities. If you believe you have found a security vulnerability in this project, please report it via the [Security Tab](https://github.com/dolanmiu/docx/security/advisories)
Please include the following information in your report:
* A description of the vulnerability
* Steps to reproduce the vulnerability
* Impact of the vulnerability
We will investigate all reported vulnerabilities and take appropriate action.
We appreciate your help in keeping this project secure.

View File

@ -1,7 +1,7 @@
// Example of how you would create a table and add data to it
import * as fs from "fs";
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "docx";
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlignTable, TextDirection } from "docx";
const doc = new Document({
sections: [
@ -13,11 +13,11 @@ const doc = new Document({
children: [
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})],
@ -45,7 +45,7 @@ const doc = new Document({
text: "This text should be in the middle of the cell",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -53,7 +53,7 @@ const doc = new Document({
text: "Text above should be vertical from bottom to top",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -61,7 +61,7 @@ const doc = new Document({
text: "Text above should be vertical from top to bottom",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
],
}),

View File

@ -1,13 +1,13 @@
// Example of making content of section vertically aligned
import * as fs from "fs";
import { Document, Packer, Paragraph, VerticalAlign, TextRun, Tab } from "docx";
import { Document, Packer, Paragraph, VerticalAlignSection, TextRun, Tab } from "docx";
const doc = new Document({
sections: [
{
properties: {
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignSection.CENTER,
},
children: [
new Paragraph({

View File

@ -12,7 +12,7 @@ import {
TableCell,
TableRow,
TextDirection,
VerticalAlign,
VerticalAlignTable,
} from "docx";
const table = new Table({
@ -102,11 +102,11 @@ const noBorderTable = new Table({
children: [
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})],
@ -134,7 +134,7 @@ const noBorderTable = new Table({
text: "This text should be in the middle of the cell",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -142,7 +142,7 @@ const noBorderTable = new Table({
text: "Text above should be vertical from bottom to top",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -150,7 +150,7 @@ const noBorderTable = new Table({
text: "Text above should be vertical from top to bottom",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
],
}),

View File

@ -1,7 +1,7 @@
// The demo on the README.md
import * as fs from "fs";
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "docx";
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlignTable } from "docx";
const table = new Table({
rows: [
@ -13,6 +13,7 @@ const table = new Table({
children: [
new ImageRun({
data: fs.readFileSync("./demo/images/image1.jpeg"),
type: "jpg",
transformation: {
width: 100,
height: 100,
@ -21,7 +22,7 @@ const table = new Table({
],
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -30,7 +31,7 @@ const table = new Table({
heading: HeadingLevel.HEADING_1,
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
],
}),
@ -50,6 +51,7 @@ const table = new Table({
children: [
new ImageRun({
data: fs.readFileSync("./demo/images/image1.jpeg"),
type: "jpg",
transformation: {
width: 100,
height: 100,
@ -77,6 +79,7 @@ const doc = new Document({
children: [
new ImageRun({
data: fs.readFileSync("./demo/images/pizza.gif"),
type: "gif",
transformation: {
width: 100,
height: 100,

View File

@ -1,7 +1,7 @@
// Example demonstrating page borders with style, colors and size
import { BorderStyle, Document, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, Paragraph, TextRun } from "docx";
import * as fs from "fs";
import { Document, Packer, TextRun, Paragraph, BorderStyle, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder } from "docx";
const doc = new Document({
sections: [

View File

@ -1,7 +1,7 @@
// Simple example to add comments to a document
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun, CommentRangeStart, CommentRangeEnd, CommentReference } from "docx";
import { Document, Packer, Paragraph, TextRun, CommentRangeStart, CommentRangeEnd, CommentReference, ImageRun } from "docx";
const doc = new Document({
comments: {
@ -20,6 +20,14 @@ const doc = new Document({
}),
new Paragraph({
children: [
new ImageRun({
type: "jpg",
data: fs.readFileSync("./demo/images/cat.jpg"),
transformation: {
width: 100,
height: 100,
},
}),
new TextRun({
text: "comment text content",
}),

View File

@ -9,7 +9,7 @@ import {
Table,
TableCell,
TableRow,
VerticalAlign,
VerticalAlignTable,
TextDirection,
TextRun,
WidthType,
@ -101,17 +101,17 @@ const generateRows = (prices: StockPrice[]): TableRow[] =>
children: [
new TableCell({
children: [new Paragraph(date.toString())],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [new Paragraph(ticker)],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [new Paragraph(price.toString())],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
}),
],
@ -143,7 +143,7 @@ const doc = new Document({
],
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
@ -159,7 +159,7 @@ const doc = new Document({
],
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
@ -175,7 +175,7 @@ const doc = new Document({
],
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
}),
],

View File

@ -13,7 +13,7 @@ import {
TableRow,
TextDirection,
TextRun,
VerticalAlign,
VerticalAlignTable,
} from "docx";
patchDocument({
@ -105,11 +105,11 @@ patchDocument({
children: [
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})],
@ -137,7 +137,7 @@ patchDocument({
text: "This text should be in the middle of the cell",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -145,7 +145,7 @@ patchDocument({
text: "Text above should be vertical from bottom to top",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
@ -153,7 +153,7 @@ patchDocument({
text: "Text above should be vertical from top to bottom",
}),
],
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
}),
],
}),

View File

@ -0,0 +1,72 @@
// Patch a document with patches
import * as fs from "fs";
import { patchDocument, PatchType, TextRun } from "docx";
patchDocument({
outputType: "nodebuffer",
data: fs.readFileSync("demo/assets/field-trip.docx"),
patches: {
todays_date: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: new Date().toLocaleDateString() })],
},
school_name: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
address: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "blah blah" })],
},
city: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
state: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
zip: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
phone: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
first_name: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
last_name: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
email_address: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
ft_dates: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
grade: {
type: PatchType.PARAGRAPH,
children: [new TextRun({ text: "test" })],
},
},
}).then((doc) => {
fs.writeFileSync("My Document.docx", doc);
});

43
demo/94-texbox.ts Normal file
View File

@ -0,0 +1,43 @@
// Simple example to add textbox to a document
import { Document, Packer, Paragraph, Textbox, TextRun } from "docx";
import * as fs from "fs";
const doc = new Document({
sections: [
{
properties: {},
children: [
new Textbox({
alignment: "center",
children: [
new Paragraph({
children: [new TextRun("Hi i'm a textbox!")],
}),
],
style: {
width: "200pt",
height: "auto",
},
}),
new Textbox({
alignment: "center",
children: [
new Paragraph({
children: [new TextRun("Hi i'm a textbox with a hidden box!")],
}),
],
style: {
width: "300pt",
height: 400,
visibility: "hidden",
zIndex: "auto",
},
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -0,0 +1,60 @@
import * as fs from "fs";
import { BorderStyle, Document, Packer, Paragraph, TextRun } from "docx";
const doc = new Document({
styles: {
paragraphStyles: [
{
id: "withSingleBlackBordersAndYellowShading",
name: "Paragraph Style with Black Borders and Yellow Shading",
basedOn: "Normal",
paragraph: {
shading: {
color: "#fff000",
type: "solid",
},
border: {
top: {
style: BorderStyle.SINGLE,
color: "#000000",
size: 4,
},
bottom: {
style: BorderStyle.SINGLE,
color: "#000000",
size: 4,
},
left: {
style: BorderStyle.SINGLE,
color: "#000000",
size: 4,
},
right: {
style: BorderStyle.SINGLE,
color: "#000000",
size: 4,
},
},
},
},
],
},
sections: [
{
children: [
new Paragraph({
style: "withSingleBlackBordersAndYellowShading",
children: [
new TextRun({
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
}),
],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -0,0 +1,168 @@
// Patch a document with patches
import * as fs from "fs";
import {
ExternalHyperlink,
HeadingLevel,
ImageRun,
Paragraph,
patchDocument,
PatchType,
Table,
TableCell,
TableRow,
TextDirection,
TextRun,
VerticalAlignTable,
} from "docx";
patchDocument({
outputType: "nodebuffer",
data: fs.readFileSync("demo/assets/simple-template-4.docx"),
patches: {
name: {
type: PatchType.PARAGRAPH,
children: [new TextRun("Sir. "), new TextRun("John Doe"), new TextRun("(The Conqueror)")],
},
table_heading_1: {
type: PatchType.PARAGRAPH,
children: [new TextRun("Heading wow!")],
},
item_1: {
type: PatchType.PARAGRAPH,
children: [
new TextRun("#657"),
new ExternalHyperlink({
children: [
new TextRun({
text: "BBC News Link",
}),
],
link: "https://www.bbc.co.uk/news",
}),
],
},
paragraph_replace: {
type: PatchType.DOCUMENT,
children: [
new Paragraph("Lorem ipsum paragraph"),
new Paragraph("Another paragraph"),
new Paragraph({
children: [
new TextRun("This is a "),
new ExternalHyperlink({
children: [
new TextRun({
text: "Google Link",
}),
],
link: "https://www.google.co.uk",
}),
new ImageRun({
type: "png",
data: fs.readFileSync("./demo/images/dog.png"),
transformation: { width: 100, height: 100 },
}),
],
}),
],
},
header_adjective: {
type: PatchType.PARAGRAPH,
children: [new TextRun("Delightful Header")],
},
footer_text: {
type: PatchType.PARAGRAPH,
children: [
new TextRun("replaced just as"),
new TextRun(" well"),
new ExternalHyperlink({
children: [
new TextRun({
text: "BBC News Link",
}),
],
link: "https://www.bbc.co.uk/news",
}),
],
},
image_test: {
type: PatchType.PARAGRAPH,
children: [
new ImageRun({
type: "jpg",
data: fs.readFileSync("./demo/images/image1.jpeg"),
transformation: { width: 100, height: 100 },
}),
],
},
table: {
type: PatchType.DOCUMENT,
children: [
new Table({
rows: [
new TableRow({
children: [
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})],
textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT,
}),
new TableCell({
children: [new Paragraph({ text: "top to bottom" }), new Paragraph({})],
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
}),
],
}),
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({
text: "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
heading: HeadingLevel.HEADING_1,
}),
],
}),
new TableCell({
children: [
new Paragraph({
text: "This text should be in the middle of the cell",
}),
],
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
new Paragraph({
text: "Text above should be vertical from bottom to top",
}),
],
verticalAlign: VerticalAlignTable.CENTER,
}),
new TableCell({
children: [
new Paragraph({
text: "Text above should be vertical from top to bottom",
}),
],
verticalAlign: VerticalAlignTable.CENTER,
}),
],
}),
],
}),
],
},
},
placeholderDelimiters: { start: "<<", end: ">>" },
}).then((doc) => {
fs.writeFileSync("My Document.docx", doc);
});

BIN
demo/assets/field-trip.docx Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,24 +1,25 @@
# Contribution Guidelines
- Include documentation reference(s) at the top of each file as a comment. For example:
- Include documentation reference(s) at the top of each file as a comment. For example:
```ts
// http://officeopenxml.com/WPdocument.php
```
<!-- cSpell:ignore datypic -->
It can be a link to `officeopenxml.com` or `datypic.com` etc.
It could also be a reference to the official ECMA-376 standard: https://www.ecma-international.org/publications-and-standards/standards/ecma-376/
- Include a portion of the schema as a comment for cross reference. For example:
- Include a portion of the schema as a comment for cross reference. For example:
```ts
// <xsd:element name="tbl" type="CT_Tbl" minOccurs="0" maxOccurs="1"/>
```
- Follow Prettier standards, and consider using the [Prettier VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugin.
- Follow Prettier standards, and consider using the [Prettier VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugin.
- Follow the `ESLint` rules
- Follow the `ESLint` rules
## Always think about the user
@ -37,6 +38,7 @@ Please write good commit messages when making a commit: https://chris.beams.io/p
**Do not:**
<!-- cspell:disable -->
```
c // What?
rtl // Adding acronyms without explaining anything else is not helpful
@ -44,6 +46,7 @@ works! // Glad its working, but the message is not helpful
demo updated // Getting better, but capitalize the first letter
Unesesary coment removed // Make sure to use correct spelling
```
<!-- cspell:enable -->
**Do**
@ -104,25 +107,28 @@ private get _level: string;
private get level: string;
```
## Interfaces over type alias
## Types over interfaces
Do not use `type`, but rather use `Interfaces`. `type` cannot be extended, and a class cannot implement it.
Using `type` aliases in TypeScript offers several advantages over `interfaces`:
> "In general, use what you want ( type alias / interface ) just be consistent"
> "always use interface for public API's definition when authoring a library or 3rd party ambient type definitions"
>
> - https://medium.com/@martin_hotell/interface-vs-type-alias-in-typescript-2-7-2a8f1777af4c
- **Flexibility with Complex Types**: `type` supports defining unions, intersections, and other complex type constructs that `interfaces` cannot handle. For example:
`Interface` is generally preferred over `type`: https://stackoverflow.com/questions/37233735/typescript-interfaces-vs-types
```typescript
type StringOrNumber = string | number;
type Combined = TypeA & TypeB;
```
- **Support for Primitive Types**: `type` can alias primitive types (e.g., `type ID = string`), while `interfaces` are limited to object shapes.
- **Tuple and Array Types**: `type` allows defining tuples and specific array types easily (e.g., `type Point = [number, number]`), which `interfaces` cannot represent.
- **Utility Types Compatibility**: `type` works seamlessly with TypeScript's utility types (e.g., `Partial<T>`, `Pick<T, K>`), enabling more expressive type transformations.
- **Functional Programming**: `type` is ideal for functional programming patterns, such as defining function signatures or mapped types, due to its versatility.
- **No Declaration Merging**: Unlike `interfaces`, type does not support declaration merging, which can prevent accidental type extensions and ensure predictable type definitions.
- **Consistent Pattern**: This project uses `type` for all type definitions, so using `type` for all type definitions maintains consistency and readability across the codebase.
Detailed discussion: https://stackoverflow.com/questions/37233735/typescript-interfaces-vs-types
**Do not:**
```ts
type RelationshipFileInfo = { id: number; target: string };
```
**Do:**
```ts
interface IRelationshipFileInfo {
id: number;
@ -130,6 +136,12 @@ interface IRelationshipFileInfo {
}
```
**Do:**
```ts
type RelationshipFileInfo = { id: number; target: string };
```
## String enums vs type
To take full advantage of TypeScript's typing system, its best to use `string enums`:

View File

@ -22,7 +22,7 @@ const doc = new Document({
}
})
],
}];
}]
});
```

View File

@ -22,19 +22,30 @@ const doc = new docx.Document({
### Full list of options:
- creator
- description
- title
- subject
- keywords
- lastModifiedBy
- revision
- externalStyles
- styles
- numbering
- footnotes
- hyperlinks
- background
| Property | Type | Notes |
| -------------------------- | -------------------------------------------------------- | -------- |
| sections | `ISectionOptions[]` | Optional |
| title | `string` | Optional |
| subject | `string` | Optional |
| creator | `string` | Optional |
| keywords | `string` | Optional |
| description | `string` | Optional |
| lastModifiedBy | `string` | Optional |
| revision | `number` | Optional |
| externalStyles | `string` | Optional |
| styles | `IStylesOptions` | Optional |
| numbering | `INumberingOptions` | Optional |
| comments | `ICommentsOptions` | Optional |
| footnotes | `Record<string, { children: Paragraph[] }>` | Optional |
| background | `IDocumentBackgroundOptions` | Optional |
| features | `{ trackRevisions?: boolean; updateFields?: boolean; }` | Optional |
| compatabilityModeVersion | `number` | Optional |
| compatibility | `ICompatibilityOptions` | Optional |
| customProperties | ` ICustomPropertyOptions`[] | Optional |
| evenAndOddHeaderAndFooters | `boolean` | Optional |
| defaultTabStop | `number` | Optional |
| fonts | ` FontOptions[]` | Optional |
| hyphenation | `IHyphenationOptions` | Optional |
### Change background color of Document

View File

@ -16,12 +16,10 @@ const chapter1 = new Paragraph({
children: [
new Bookmark({
id: "anchorForChapter1",
children: [
new TextRun("Chapter 1"),
],
children: [new TextRun("Chapter 1")],
}),
],
})
});
```
Then you can create an hyperlink pointing to that bookmark with an `InternalHyperLink`:
@ -35,20 +33,32 @@ const link = new InternalHyperlink({
}),
],
anchor: "anchorForChapter1",
})
});
```
### Page reference
You can also get the page number of the bookmark by creating a page reference to it:
```ts
const paragraph = new Paragraph({
children: [
new TextRun("Chapter 1 can be seen on page "),
new PageReference("anchorForChapter1"),
],
children: [new TextRun("Chapter 1 can be seen on page "), new PageReference("anchorForChapter1")],
});
```
### Numbered item reference
You can also create cross references for numbered items with `NumberedItemReference`.
```ts
const paragraph = new Paragraph({
children: [new TextRun("See Paragraph "), new NumberedItemReference("anchorForParagraph1", "1.1")],
});
```
> [!NOTE]
> The `NumberedItemReference` currently needs a cached value (in this case `1.1`)
## External
To create an external hyperlink you just need to specify the url and the text of the link, then add it to a paragraph:
@ -69,7 +79,6 @@ const paragraph = new Paragraph({
});
```
## Styling hyperlinks
It is possible to set the style of the text of both internal and external hyperlinks. This can be done applying run formatting on any of the `TextRun` children of the hyperlink. Use the `style: "Hyperlink"` property to show the default link styles, which can be combined with any other style.

View File

@ -130,6 +130,62 @@ new Paragraph({
}),
```
## Disabling numbering inherited from paragraph style
If the numbering is set on a paragraph style, you may wish to disable it for a specific paragraph:
```ts
const doc = new Document({
...
numbering: {
config: [
{
reference: "my-bullet-points",
levels: [
{
level: 0,
format: LevelFormat.BULLET,
text: "\u1F60",
alignment: AlignmentType.LEFT,
style: {
paragraph: {
indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) },
},
},
},
],
},
],
},
styles: {
paragraphStyles: [
{
id: 'bullet',
name: 'Bullet',
basedOn: 'Normal',
next: 'Normal',
run: {},
paragraph: {
numbering: {
reference: 'my-bullet-points',
level: 0,
},
},
},
],
},
...
});
```
```ts
new Paragraph({
text: "No bullet points!",
style: "Bullet",
numbering: false,
}),
```
## Full Example
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/3-numbering-and-bullet-points.ts ":include")

View File

@ -2,7 +2,7 @@
> Packers are the way in which `docx` turns your code into `.docx` format. It is completely decoupled from the `docx.Document`.
Packers works in both a node and browser environment (Angular etc). Now, the packer returns a `Buffer`, `Blob` or `base64 string`. It is up to you to take that and persist it with node's `fs`, send it down as a downloadable file, or anything else you wish. As of `version 4+`, this library will not have options to export to PDF.
Packers works in both a node and browser environment (Angular etc). Now, the packer returns a `Buffer`, `Blob`, `string`, `base64 string`, `ArrayBuffer`, or `Stream`. It is up to you to take that and persist it with node's `fs`, send it down as a downloadable file, or anything else you wish. As of `version 4+`, this library will not have options to export to PDF.
### Export as Buffer
@ -14,6 +14,14 @@ Packer.toBuffer(doc).then((buffer) => {
});
```
### Export as string
```ts
Packer.toString(doc).then((string) => {
console.log(string);
});
```
### Export as a `base64` string
```ts
@ -32,3 +40,46 @@ Packer.toBlob(doc).then((blob) => {
saveAs(blob, "example.docx");
});
```
### Export as ArrayBuffer
This may be useful when working in a Node.js worker.
```ts
Packer.toArrayBuffer(doc).then((arrayBuffer) => {
port.postMessage(arrayBuffer, [arrayBuffer]);
});
```
### Export as a Stream
```ts
Packer.toStream(doc).then((stream) => {
// read from stream
});
```
### Export using optional arguments
The `Packer` methods support 2 optional arguments.
The first is for controlling the indentation of the xml and should be a `boolean` or `keyof typeof PrettifyType`.
The second is an array of subfile overrides (`{path: string, data: string}[]`). These overrides can be used to write additional subfiles to the result or even override default subfiles in the case that the default handling of these subfiles does not meet your needs.
```ts
const overrides = [{ path: "word/commentsExtended.xml", data: "string_data" }];
Packer.toString(doc, true, overrides).then((string) => {
console.log(string);
});
```
### Export to arbitrary formats
You can also use the lower-level `Packer.pack` method to export to any specified type.
```ts
Packer.pack(doc, 'string').then((string) => {
console.log(string);
});
```

View File

@ -35,6 +35,9 @@ interface Patch {
| type | `PatchType` | Required | `DOCUMENT`, `PARAGRAPH` |
| children | `FileChild[] or ParagraphChild[]` | Required | The contents to replace with. A `FileChild` is a `Paragraph` or `Table`, whereas a `ParagraphChild` is typical `Paragraph` children. |
The patcher also takes in a `keepOriginalStyles` boolean, which will preserve the styles of the patched text when set to true.
### How to patch existing document
1. Open your existing word document in your favorite Word Processor

View File

@ -126,10 +126,10 @@ const doc = new Document({
next: "Normal",
quickFormat: true,
run: {
size: 26
size: 26,
bold: true,
color: "999999",
{
underline: {
type: UnderlineType.DOUBLE,
color: "FF0000",
},

View File

@ -22,7 +22,7 @@ Then add the table in the `section`
const doc = new Document({
sections: [{
children: [table],
}];
}],
});
```
@ -159,7 +159,7 @@ const tableRow = new TableRow({
| children | `Array<Paragraph or Table>` | Required. You can nest tables by adding a table into a cell |
| shading | `IShadingAttributesProperties` | Optional |
| margins | `ITableCellMarginOptions` | Optional |
| verticalAlign | `VerticalAlign` | Optional |
| verticalAlign | `VerticalAlignTable` | Optional |
| columnSpan | `number` | Optional |
| rowSpan | `number` | Optional |
| borders | `BorderOptions` | Optional |
@ -266,7 +266,7 @@ Sets the vertical alignment of the contents of the cell
```ts
const cell = new TableCell({
...,
verticalAlign: VerticalAlign,
verticalAlign: VerticalAlignTable,
});
```
@ -282,7 +282,7 @@ For example, to center align a cell:
```ts
const cell = new TableCell({
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
});
```

26
docs/usage/text-box.md Normal file
View File

@ -0,0 +1,26 @@
# Text Box
Similar `Text Frames`, but the difference being that it is `VML` `Shape` based.
!> `Text Boxes` requires an understanding of [Paragraphs](usage/paragraph.md).
> `Text boxes` are paragraphs of text in a document which are positioned in a separate region or frame in the document, and can be positioned with a specific size and position relative to non-frame paragraphs in the current document.
## Intro
To make a `Text Box`, simply create a `Textbox` object inside the `Document`:
```ts
new Textbox({
alignment: "center",
children: [
new Paragraph({
children: [new TextRun("Hi i'm a textbox!")],
}),
],
style: {
width: "200pt",
height: "auto",
},
});
```

View File

@ -1,6 +1,6 @@
# Text Frames
Also known as `Text Boxes`
> Similar to `Text Boxes`!
!> Text Frames requires an understanding of [Paragraphs](usage/paragraph.md).

370
eslint.config.ts Normal file
View File

@ -0,0 +1,370 @@
import eslint from "@eslint/js";
import type { Linter } from "eslint";
import importPlugin from "eslint-plugin-import";
import unicorn from "eslint-plugin-unicorn";
import jsdoc from "eslint-plugin-jsdoc";
import preferArrow from "eslint-plugin-prefer-arrow";
import functional from "eslint-plugin-functional";
import globals from "globals";
import tsEslint from "typescript-eslint";
const config: Linter.Config<Linter.RulesRecord>[] = [
{
ignores: ["**/vite.config.ts", "**/dist/**", "**/coverage/**", "**/*.js", "eslint.config.ts", "**/demo/**", "**/scripts/**"],
},
eslint.configs.recommended,
importPlugin.flatConfigs.recommended,
...tsEslint.configs.recommended,
...tsEslint.configs.stylistic,
{
files: ["**/src/**/*.ts"],
plugins: {
unicorn,
jsdoc,
"prefer-arrow": preferArrow,
functional,
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
rules: {
"no-undef": "off",
"no-extra-boolean-cast": "off",
"no-alert": "error",
"no-self-compare": "error",
"no-unreachable-loop": "error",
"no-template-curly-in-string": "error",
"no-unused-private-class-members": "error",
"no-extend-native": "error",
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-new-object": "error",
"no-proto": "error",
"no-useless-catch": "error",
"one-var-declaration-per-line": "error",
"prefer-arrow-callback": "error",
"prefer-destructuring": "error",
"prefer-exponentiation-operator": "error",
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": "error",
"prefer-spread": "error",
"prefer-template": "error",
"require-await": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
default: "array",
},
],
"@typescript-eslint/no-restricted-types": [
"error",
{
types: {
Object: {
message: "Avoid using the `Object` type. Did you mean `object`?",
fixWith: "object",
},
Function: {
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
},
Boolean: {
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
fixWith: "boolean",
},
Number: {
message: "Avoid using the `Number` type. Did you mean `number`?",
fixWith: "number",
},
String: {
message: "Avoid using the `String` type. Did you mean `string`?",
fixWith: "string",
},
Symbol: {
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
fixWith: "symbol",
},
},
},
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: false,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "explicit",
overrides: {
accessors: "explicit",
},
},
],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
allowArgumentsExplicitlyTypedAsAny: true,
allowDirectConstAssertionInArrowFunctions: true,
allowHigherOrderFunctions: false,
allowTypedFunctionExpressions: false,
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["objectLiteralProperty"],
leadingUnderscore: "allow",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
filter: {
regex: "(^[a-z]+:.+)|_attr|[0-9]",
match: false,
},
},
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": [
"error",
{
hoist: "all",
},
],
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/triple-slash-reference": [
"error",
{
path: "always",
types: "prefer-import",
lib: "always",
},
],
"@typescript-eslint/typedef": [
"error",
{
parameter: true,
propertyDeclaration: true,
},
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error",
complexity: "off",
"consistent-return": "error",
"constructor-super": "error",
curly: "error",
"dot-notation": "off",
eqeqeq: ["error", "smart"],
"guard-for-in": "error",
"id-denylist": ["error", "any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"],
"id-match": "error",
"import/no-default-export": "error",
"import/no-extraneous-dependencies": "off",
"import/no-internal-modules": "off",
"sort-imports": [
"error",
{
allowSeparatedGroups: true,
ignoreDeclarationSort: true,
},
],
"import/order": [
"error",
{
groups: [["external", "builtin"], "internal", ["sibling", "parent", "index"]],
"newlines-between": "always",
pathGroups: [
{ pattern: "@file/**/*", group: "internal" },
{ pattern: "@file/**", group: "internal" },
{ pattern: "@export/**", group: "internal" },
],
pathGroupsExcludedImportTypes: ["internal"],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
indent: "off",
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "off",
"max-classes-per-file": "off",
"max-len": "off",
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-empty-function": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-multiple-empty-lines": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-param-reassign": "error",
"no-redeclare": "error",
"no-return-await": "error",
"no-sequences": "error",
"no-shadow": "off",
"no-sparse-arrays": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": [
"error",
{
allow: ["_attr"],
},
],
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-use-before-define": "off",
"no-useless-constructor": "error",
"no-var": "error",
"object-shorthand": "off",
"one-var": ["error", "never"],
"prefer-arrow/prefer-arrow-functions": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
radix: "error",
"space-in-parens": ["error", "never"],
"spaced-comment": [
"error",
"always",
{
markers: ["/"],
},
],
"unicorn/filename-case": "error",
"unicorn/prefer-ternary": "error",
"use-isnan": "error",
"valid-typeof": "off",
"functional/immutable-data": [
"error",
{
ignoreImmediateMutation: true,
ignoreAccessorPattern: ["**.root*", "**.numberingReferences*", "**.sections*", "**.properties*"],
},
],
"functional/prefer-property-signatures": "error",
"functional/no-mixed-types": "error",
"functional/prefer-readonly-type": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^[_]+$",
},
],
},
},
{
files: ["**/*.spec.ts"],
plugins: {
unicorn,
jsdoc,
"prefer-arrow": preferArrow,
functional,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
sourceType: "module",
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
project: ["tsconfig.json"],
},
},
rules: {
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/dot-notation": "off",
"prefer-destructuring": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^[_]+$",
},
],
},
},
];
export default config;

17384
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,32 @@
{
"name": "docx",
"version": "8.5.0",
"version": "9.5.0",
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
"type": "module",
"main": "build/index.umd.js",
"module": "./build/index.mjs",
"types": "./build/index.d.ts",
"main": "dist/index.umd.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./build/index.cjs",
"types": "./build/index.d.ts",
"import": "./build/index.mjs",
"default": "./build/index.mjs"
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"files": [
"build"
"dist"
],
"scripts": {
"build": "tsc && vite build",
"test": "vitest --ui --coverage",
"test:ci": "vitest run --coverage",
"prepublishOnly": "npm run build --omit=dev",
"lint": "eslint --ext .ts src",
"lint": "eslint --flag unstable_ts_config --config eslint.config.ts",
"predemo": "npm run build",
"demo": "tsx ./demo/index.ts",
"typedoc": "typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
@ -54,9 +58,10 @@
"clippy"
],
"dependencies": {
"@types/node": "^20.3.1",
"@types/node": "^22.7.5",
"hash.js": "^1.1.7",
"jszip": "^3.10.1",
"nanoid": "^5.0.4",
"nanoid": "^5.1.3",
"xml": "^1.0.1",
"xml-js": "^1.6.8"
},
@ -67,39 +72,43 @@
},
"homepage": "https://docx.js.org",
"devDependencies": {
"@types/eslint__js": "^8.42.3",
"@types/inquirer": "^9.0.3",
"@types/prompt": "^1.1.1",
"@types/unzipper": "^0.10.4",
"@types/xml": "^1.0.8",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@vitest/coverage-v8": "^1.1.0",
"@vitest/ui": "^1.1.0",
"cspell": "^8.2.3",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@vitest/coverage-v8": "^3.0.8",
"@vitest/ui": "^3.0.8",
"cspell": "^9.0.0",
"docsify-cli": "^4.3.0",
"eslint": "^8.23.0",
"eslint-plugin-functional": "^6.0.0",
"eslint": "^9.13.0",
"eslint-import-resolver-typescript": "^4.3.2",
"eslint-plugin-functional": "^7.0.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^48.0.2",
"eslint-plugin-jsdoc": "^50.3.1",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-unicorn": "^50.0.1",
"execa": "^8.0.1",
"glob": "^10.2.7",
"inquirer": "^9.2.7",
"jsdom": "^23.0.1",
"eslint-plugin-unicorn": "^59.0.0",
"execa": "^9.4.0",
"glob": "^11.0.0",
"inquirer": "^12.0.0",
"jiti": "^2.3.3",
"jsdom": "^26.0.0",
"pre-commit": "^1.2.2",
"prettier": "^3.1.1",
"tsconfig-paths": "^4.0.0",
"tsx": "^4.7.0",
"typedoc": "^0.25.4",
"typedoc": "^0.28.2",
"typescript": "5.3.3",
"unzipper": "^0.10.11",
"vite": "^5.0.10",
"vite-plugin-dts": "^3.3.1",
"vite-plugin-node-polyfills": "^0.19.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^1.1.0"
"typescript-eslint": "^8.10.0",
"unzipper": "^0.12.3",
"vite": "^6.0.1",
"vite-plugin-dts": "^4.2.4",
"vite-plugin-node-polyfills": "^0.23.0",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^3.0.8"
},
"engines": {
"node": ">=10"

View File

@ -1,7 +1,6 @@
import { BaseXmlComponent, IContext, IXmlableObject } from "@file/xml-components";
export class Formatter {
// tslint:disable-next-line: no-object-literal-type-assertion
public format(input: BaseXmlComponent, context: IContext = { stack: [] } as unknown as IContext): IXmlableObject {
const output = input.prepForXml(context);

View File

@ -36,7 +36,7 @@ describe("Compiler", () => {
const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name);
expect(fileNames).is.an.instanceof(Array);
expect(fileNames).has.length(19);
expect(fileNames).has.length(20);
expect(fileNames).to.include("word/document.xml");
expect(fileNames).to.include("word/styles.xml");
expect(fileNames).to.include("docProps/core.xml");
@ -96,7 +96,7 @@ describe("Compiler", () => {
const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name);
expect(fileNames).is.an.instanceof(Array);
expect(fileNames).has.length(27);
expect(fileNames).has.length(28);
expect(fileNames).to.include("word/header1.xml");
expect(fileNames).to.include("word/_rels/header1.xml.rels");
@ -112,6 +112,41 @@ describe("Compiler", () => {
},
);
it(
"should pack subfile overrides",
async () => {
const file = new File({
sections: [],
comments: {
children: [],
},
});
const subfileData1 = "comments";
const subfileData2 = "commentsExtended";
const overrides = [
{ path: "word/comments.xml", data: subfileData1 },
{ path: "word/commentsExtended.xml", data: subfileData2 },
];
const zipFile = compiler.compile(file, "", overrides);
const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name);
expect(fileNames).is.an.instanceof(Array);
expect(fileNames).has.length(21);
expect(fileNames).to.include("word/comments.xml");
expect(fileNames).to.include("word/commentsExtended.xml");
const commentsText = await zipFile.file("word/comments.xml")?.async("text");
const commentsExtendedText = await zipFile.file("word/commentsExtended.xml")?.async("text");
expect(commentsText).toBe(subfileData1);
expect(commentsExtendedText).toBe(subfileData2);
},
{
timeout: 99999999,
},
);
it("should call the format method X times equalling X files to be formatted", () => {
// This test is required because before, there was a case where Document was formatted twice, which was inefficient
// This also caused issues such as running prepForXml multiple times as format() was ran multiple times.
@ -125,11 +160,10 @@ describe("Compiler", () => {
],
});
// tslint:disable-next-line: no-string-literal
const spy = vi.spyOn(compiler["formatter"], "format");
compiler.compile(file);
expect(spy).toBeCalledTimes(15);
expect(spy).toBeCalledTimes(16);
});
it("should work with media datas", () => {

View File

@ -9,12 +9,12 @@ import { ImageReplacer } from "./image-replacer";
import { NumberingReplacer } from "./numbering-replacer";
import { PrettifyType } from "./packer";
interface IXmlifyedFile {
export type IXmlifyedFile = {
readonly data: string;
readonly path: string;
}
};
interface IXmlifyedFileMapping {
type IXmlifyedFileMapping = {
readonly Document: IXmlifyedFile;
readonly Styles: IXmlifyedFile;
readonly Properties: IXmlifyedFile;
@ -32,9 +32,10 @@ interface IXmlifyedFileMapping {
readonly FootNotesRelationships: IXmlifyedFile;
readonly Settings: IXmlifyedFile;
readonly Comments?: IXmlifyedFile;
readonly CommentsRelationships?: IXmlifyedFile;
readonly FontTable?: IXmlifyedFile;
readonly FontTableRelationships?: IXmlifyedFile;
}
};
export class Compiler {
private readonly formatter: Formatter;
@ -47,7 +48,11 @@ export class Compiler {
this.numberingReplacer = new NumberingReplacer();
}
public compile(file: File, prettifyXml?: (typeof PrettifyType)[keyof typeof PrettifyType]): JSZip {
public compile(
file: File,
prettifyXml?: (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): JSZip {
const zip = new JSZip();
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
const map = new Map<string, IXmlifyedFile | readonly IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
@ -62,6 +67,10 @@ export class Compiler {
}
}
for (const subFile of overrides) {
zip.file(subFile.path, subFile.data);
}
for (const data of file.Media.Array) {
if (data.type !== "svg") {
zip.file(`word/media/${data.fileName}`, data.data);
@ -96,7 +105,28 @@ export class Compiler {
},
},
);
const commentRelationshipCount = file.Comments.Relationships.RelationshipCount + 1;
const commentXmlData = xml(
this.formatter.format(file.Comments, {
viewWrapper: {
View: file.Comments,
Relationships: file.Comments.Relationships,
},
file,
stack: [],
}),
{
indent: prettify,
declaration: {
standalone: "yes",
encoding: "UTF-8",
},
},
);
const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media);
const commentMediaDatas = this.imageReplacer.getMediaData(commentXmlData, file.Media);
return {
Relationships: {
@ -109,6 +139,12 @@ export class Compiler {
);
});
file.Document.Relationships.createRelationship(
file.Document.Relationships.RelationshipCount + 1,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",
"fontTable.xml",
);
return xml(
this.formatter.format(file.Document.Relationships, {
viewWrapper: file.Document,
@ -436,22 +472,41 @@ export class Compiler {
path: "word/settings.xml",
},
Comments: {
data: xml(
this.formatter.format(file.Comments, {
viewWrapper: file.Document,
file,
stack: [],
}),
{
indent: prettify,
declaration: {
standalone: "yes",
encoding: "UTF-8",
},
},
),
data: (() => {
const xmlData = this.imageReplacer.replace(commentXmlData, commentMediaDatas, commentRelationshipCount);
const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering);
return referenedXmlData;
})(),
path: "word/comments.xml",
},
CommentsRelationships: {
data: (() => {
commentMediaDatas.forEach((mediaData, i) => {
file.Comments.Relationships.createRelationship(
commentRelationshipCount + i,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
`media/${mediaData.fileName}`,
);
});
return xml(
this.formatter.format(file.Comments.Relationships, {
viewWrapper: {
View: file.Comments,
Relationships: file.Comments.Relationships,
},
file,
stack: [],
}),
{
indent: prettify,
declaration: {
encoding: "UTF-8",
},
},
);
})(),
path: "word/_rels/comments.xml.rels",
},
FontTable: {
data: xml(
this.formatter.format(file.FontTable.View, {

View File

@ -46,7 +46,7 @@ describe("Packer", () => {
await Packer.toString(file, true);
expect(spy).toBeCalledWith(expect.anything(), PrettifyType.WITH_2_BLANKS);
expect(spy).toBeCalledWith(expect.anything(), PrettifyType.WITH_2_BLANKS, expect.anything());
});
it("should use a prettify value", async () => {
@ -55,7 +55,7 @@ describe("Packer", () => {
await Packer.toString(file, PrettifyType.WITH_4_BLANKS);
expect(spy).toBeCalledWith(expect.anything(), PrettifyType.WITH_4_BLANKS);
expect(spy).toBeCalledWith(expect.anything(), PrettifyType.WITH_4_BLANKS, expect.anything());
});
it("should use an undefined prettify value", async () => {
@ -64,7 +64,32 @@ describe("Packer", () => {
await Packer.toString(file, false);
expect(spy).toBeCalledWith(expect.anything(), undefined);
expect(spy).toBeCalledWith(expect.anything(), undefined, expect.anything());
});
});
describe("overrides", () => {
afterEach(() => {
vi.restoreAllMocks();
});
it("should use an overrides value", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const spy = vi.spyOn((Packer as any).compiler, "compile");
const overrides = [{ path: "word/comments.xml", data: "comments" }];
await Packer.toString(file, true, overrides);
expect(spy).toBeCalledWith(expect.anything(), expect.anything(), overrides);
});
it("should use a default overrides value", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const spy = vi.spyOn((Packer as any).compiler, "compile");
await Packer.toString(file);
expect(spy).toBeCalledWith(expect.anything(), undefined, []);
});
});
@ -139,7 +164,6 @@ describe("Packer", () => {
it("should create a standard docx file", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.spyOn((Packer as any).compiler, "compile").mockReturnValue({
// tslint:disable-next-line: no-empty
generateAsync: () => vi.fn(),
});
const str = await Packer.toBlob(file);
@ -163,11 +187,37 @@ describe("Packer", () => {
});
});
describe("#toArrayBuffer()", () => {
it("should create a standard docx file", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.spyOn((Packer as any).compiler, "compile").mockReturnValue({
generateAsync: () => vi.fn(),
});
const str = await Packer.toArrayBuffer(file);
assert.isDefined(str);
});
it("should handle exception if it throws any", () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.spyOn((Packer as any).compiler, "compile").mockImplementation(() => {
throw new Error();
});
return Packer.toArrayBuffer(file).catch((error) => {
assert.isDefined(error);
});
});
afterEach(() => {
vi.resetAllMocks();
});
});
describe("#toStream()", () => {
it("should create a standard docx file", async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.spyOn((Packer as any).compiler, "compile").mockReturnValue({
// tslint:disable-next-line: no-empty
generateAsync: () => Promise.resolve(vi.fn()),
});
const stream = Packer.toStream(file);

View File

@ -1,7 +1,9 @@
import { Stream } from "stream";
import { File } from "@file/file";
import { Compiler } from "./next-compiler";
import { File } from "@file/file";
import { OutputByType, OutputType } from "@util/output-type";
import { Compiler, IXmlifyedFile } from "./next-compiler";
/**
* Use blanks to prettify
@ -10,7 +12,7 @@ export const PrettifyType = {
NONE: "",
WITH_2_BLANKS: " ",
WITH_4_BLANKS: " ",
// eslint-disable-next-line @typescript-eslint/naming-convention
WITH_TAB: "\t",
} as const;
@ -20,53 +22,68 @@ const convertPrettifyType = (
prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? undefined : prettify;
export class Packer {
public static async toString(file: File, prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]): Promise<string> {
const zip = this.compiler.compile(file, convertPrettifyType(prettify));
const zipData = await zip.generateAsync({
type: "string",
// eslint-disable-next-line require-await
public static async pack<T extends OutputType>(
file: File,
type: T,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<OutputByType[T]> {
const zip = this.compiler.compile(file, convertPrettifyType(prettify), overrides);
return zip.generateAsync({
type,
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
compression: "DEFLATE",
});
return zipData;
}
public static async toBuffer(file: File, prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]): Promise<Buffer> {
const zip = this.compiler.compile(file, convertPrettifyType(prettify));
const zipData = await zip.generateAsync({
type: "nodebuffer",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
compression: "DEFLATE",
});
return zipData;
public static toString(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<string> {
return Packer.pack(file, "string", prettify, overrides);
}
public static async toBase64String(file: File, prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]): Promise<string> {
const zip = this.compiler.compile(file, convertPrettifyType(prettify));
const zipData = await zip.generateAsync({
type: "base64",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
compression: "DEFLATE",
});
return zipData;
public static toBuffer(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<Buffer> {
return Packer.pack(file, "nodebuffer", prettify, overrides);
}
public static async toBlob(file: File, prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]): Promise<Blob> {
const zip = this.compiler.compile(file, convertPrettifyType(prettify));
const zipData = await zip.generateAsync({
type: "blob",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
compression: "DEFLATE",
});
return zipData;
public static toBase64String(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<string> {
return Packer.pack(file, "base64", prettify, overrides);
}
public static toStream(file: File, prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]): Stream {
public static toBlob(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<Blob> {
return Packer.pack(file, "blob", prettify, overrides);
}
public static toArrayBuffer(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Promise<ArrayBuffer> {
return Packer.pack(file, "arraybuffer", prettify, overrides);
}
public static toStream(
file: File,
prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType],
overrides: readonly IXmlifyedFile[] = [],
): Stream {
const stream = new Stream();
const zip = this.compiler.compile(file, convertPrettifyType(prettify));
const zip = this.compiler.compile(file, convertPrettifyType(prettify), overrides);
zip.generateAsync({
type: "nodebuffer",

View File

@ -1,4 +1,5 @@
import { XmlComponent } from "@file/xml-components";
import { AppPropertiesAttributes } from "./app-properties-attributes";
export class AppProperties extends XmlComponent {

View File

@ -22,7 +22,7 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { eighthPointMeasureValue, hexColorValue, pointMeasureValue } from "@util/values";
export interface IBorderOptions {
export type IBorderOptions = {
readonly style: (typeof BorderStyle)[keyof typeof BorderStyle];
/** Border color, in hex (eg 'FF00AA') */
readonly color?: string;
@ -30,7 +30,7 @@ export interface IBorderOptions {
readonly size?: number;
/** Spacing offset. Values are specified in pt */
readonly space?: number;
}
};
export class BorderElement extends XmlComponent {
public constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
@ -55,34 +55,101 @@ class BordersAttributes extends XmlAttributeComponent<IBorderOptions> {
};
}
/* eslint-disable @typescript-eslint/naming-convention */
/**
* Table borders are defined with the <w:tblBorders> element. Child elements of this element specify the kinds of `border`:
*
* `bottom`, `end` (`right` in the previous version of the standard), `insideH`, `insideV`, `start` (`left` in the previous version of the standard), and `top`.
*
* Reference: http://officeopenxml.com/WPtableBorders.php
*
* ## XSD Schema
* ```xml
* <xsd:simpleType name="ST_Border">
* <xsd:restriction base="xsd:string">
* <xsd:enumeration value="single"/>
* <xsd:enumeration value="dashDotStroked"/>
* <xsd:enumeration value="dashed"/>
* <xsd:enumeration value="dashSmallGap"/>
* <xsd:enumeration value="dotDash"/>
* <xsd:enumeration value="dotDotDash"/>
* <xsd:enumeration value="dotted"/>
* <xsd:enumeration value="double"/>
* <xsd:enumeration value="doubleWave"/>
* <xsd:enumeration value="inset"/>
* <xsd:enumeration value="nil"/>
* <xsd:enumeration value="none"/>
* <xsd:enumeration value="outset"/>
* <xsd:enumeration value="thick"/>
* <xsd:enumeration value="thickThinLargeGap"/>
* <xsd:enumeration value="thickThinMediumGap"/>
* <xsd:enumeration value="thickThinSmallGap"/>
* <xsd:enumeration value="thinThickLargeGap"/>
* <xsd:enumeration value="thinThickMediumGap"/>
* <xsd:enumeration value="thinThickSmallGap"/>
* <xsd:enumeration value="thinThickThinLargeGap"/>
* <xsd:enumeration value="thinThickThinMediumGap"/>
* <xsd:enumeration value="thinThickThinSmallGap"/>
* <xsd:enumeration value="threeDEmboss"/>
* <xsd:enumeration value="threeDEngrave"/>
* <xsd:enumeration value="triple"/>
* <xsd:enumeration value="wave"/>
* </xsd:restriction>
* </xsd:simpleType>
* ```
*/
export const BorderStyle = {
/** a single line */
SINGLE: "single",
/** a line with a series of alternating thin and thick strokes */
DASH_DOT_STROKED: "dashDotStroked",
/** a dashed line */
DASHED: "dashed",
/** a dashed line with small gaps */
DASH_SMALL_GAP: "dashSmallGap",
/** a line with alternating dots and dashes */
DOT_DASH: "dotDash",
/** a line with a repeating dot - dot - dash sequence */
DOT_DOT_DASH: "dotDotDash",
/** a dotted line */
DOTTED: "dotted",
/** a double line */
DOUBLE: "double",
/** a double wavy line */
DOUBLE_WAVE: "doubleWave",
/** an inset set of lines */
INSET: "inset",
/** no border */
NIL: "nil",
/** no border */
NONE: "none",
/** an outset set of lines */
OUTSET: "outset",
/** a single line */
THICK: "thick",
/** a thick line contained within a thin line with a large-sized intermediate gap */
THICK_THIN_LARGE_GAP: "thickThinLargeGap",
/** a thick line contained within a thin line with a medium-sized intermediate gap */
THICK_THIN_MEDIUM_GAP: "thickThinMediumGap",
/** a thick line contained within a thin line with a small intermediate gap */
THICK_THIN_SMALL_GAP: "thickThinSmallGap",
/** a thin line contained within a thick line with a large-sized intermediate gap */
THIN_THICK_LARGE_GAP: "thinThickLargeGap",
/** a thick line contained within a thin line with a medium-sized intermediate gap */
THIN_THICK_MEDIUM_GAP: "thinThickMediumGap",
/** a thick line contained within a thin line with a small intermediate gap */
THIN_THICK_SMALL_GAP: "thinThickSmallGap",
/** a thin-thick-thin line with a large gap */
THIN_THICK_THIN_LARGE_GAP: "thinThickThinLargeGap",
/** a thin-thick-thin line with a medium gap */
THIN_THICK_THIN_MEDIUM_GAP: "thinThickThinMediumGap",
/** a thin-thick-thin line with a small gap */
THIN_THICK_THIN_SMALL_GAP: "thinThickThinSmallGap",
/** a three-staged gradient line, getting darker towards the paragraph */
THREE_D_EMBOSS: "threeDEmboss",
/** a three-staged gradient like, getting darker away from the paragraph */
THREE_D_ENGRAVE: "threeDEngrave",
/** a triple line */
TRIPLE: "triple",
/** a wavy line */
WAVE: "wave",
} as const;
/* eslint-enable */

View File

@ -1,5 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { CheckBoxUtil } from ".";
describe("CheckBoxUtil", () => {

View File

@ -7,20 +7,20 @@
// </xsd:complexType>
// <xsd:element name="checkbox" type="CT_SdtCheckbox"/>
import { XmlComponent } from "@file/xml-components";
import { CheckBoxSymbolElement } from "@file/checkbox/checkbox-symbol";
import { XmlComponent } from "@file/xml-components";
export interface ICheckboxSymbolProperties {
export type ICheckboxSymbolProperties = {
readonly value?: string;
readonly font?: string;
}
};
export interface ICheckboxSymbolOptions {
export type ICheckboxSymbolOptions = {
readonly alias?: string;
readonly checked?: boolean;
readonly checkedState?: ICheckboxSymbolProperties;
readonly uncheckedState?: ICheckboxSymbolProperties;
}
};
export class CheckBoxUtil extends XmlComponent {
private readonly DEFAULT_UNCHECKED_SYMBOL: string = "2610";

View File

@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { CheckBox } from "./checkbox";

View File

@ -1,7 +1,8 @@
import { SymbolRun } from "@file/paragraph/run/symbol-run";
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
import { StructuredDocumentTagContent } from "@file/table-of-contents/sdt-content";
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
import { XmlComponent } from "@file/xml-components";
import { CheckBoxUtil, ICheckboxSymbolOptions } from "./checkbox-util";
export class CheckBox extends XmlComponent {

View File

@ -1,5 +1,3 @@
// tslint:disable:no-string-literal
import { beforeEach, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,5 @@
import { XmlComponent } from "@file/xml-components";
import { ContentTypeAttributes } from "./content-types-attributes";
import { Default } from "./default/default";
import { Override } from "./override/override";

View File

@ -1,4 +1,5 @@
import { XmlComponent } from "@file/xml-components";
import { DefaultAttributes } from "./default-attributes";
export class Default extends XmlComponent {

View File

@ -1,4 +1,5 @@
import { XmlComponent } from "@file/xml-components";
import { OverrideAttributes } from "./override-attributes";
export class Override extends XmlComponent {

View File

@ -45,7 +45,7 @@ describe("Properties", () => {
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const key = (obj: { readonly [key: string]: any }) => Object.keys(obj)[0];
const key = (obj: Readonly<Record<string, any>>) => Object.keys(obj)[0];
expect(tree["cp:coreProperties"].map(key)).to.include.members([
"_attr",
"cp:keywords",

View File

@ -1,19 +1,19 @@
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
import { ICompatibilityOptions } from "@file/settings/compatibility";
import { FontOptions } from "@file/fonts/font-table";
import { StringContainer, XmlComponent } from "@file/xml-components";
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
import { IHyphenationOptions } from "@file/settings";
import { ICompatibilityOptions } from "@file/settings/compatibility";
import { StringContainer, XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { dateTimeValue } from "@util/values";
import { ICustomPropertyOptions } from "../custom-properties";
import { IDocumentBackgroundOptions } from "../document";
import { DocumentAttributes } from "../document/document-attributes";
import { ISectionOptions } from "../file";
import { INumberingOptions } from "../numbering";
import { Paragraph } from "../paragraph";
import { IStylesOptions } from "../styles";
export interface IPropertiesOptions {
export type IPropertiesOptions = {
readonly sections: readonly ISectionOptions[];
readonly title?: string;
readonly subject?: string;
@ -26,11 +26,14 @@ export interface IPropertiesOptions {
readonly styles?: IStylesOptions;
readonly numbering?: INumberingOptions;
readonly comments?: ICommentsOptions;
readonly footnotes?: {
readonly [key: string]: {
readonly children: readonly Paragraph[];
};
};
readonly footnotes?: Readonly<
Record<
string,
{
readonly children: readonly Paragraph[];
}
>
>;
readonly background?: IDocumentBackgroundOptions;
readonly features?: {
readonly trackRevisions?: boolean;
@ -42,7 +45,8 @@ export interface IPropertiesOptions {
readonly evenAndOddHeaderAndFooters?: boolean;
readonly defaultTabStop?: number;
readonly fonts?: readonly FontOptions[];
}
readonly hyphenation?: IHyphenationOptions;
};
// <xs:element name="coreProperties" type="CT_CoreProperties"/>
@ -71,15 +75,7 @@ export interface IPropertiesOptions {
export class CoreProperties extends XmlComponent {
public constructor(options: Omit<IPropertiesOptions, "sections">) {
super("cp:coreProperties");
this.root.push(
new DocumentAttributes({
cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
dc: "http://purl.org/dc/elements/1.1/",
dcterms: "http://purl.org/dc/terms/",
dcmitype: "http://purl.org/dc/dcmitype/",
xsi: "http://www.w3.org/2001/XMLSchema-instance",
}),
);
this.root.push(new DocumentAttributes(["cp", "dc", "dcterms", "dcmitype", "xsi"]));
if (options.title) {
this.root.push(new StringContainer("dc:title", options.title));
}
@ -106,11 +102,15 @@ export class CoreProperties extends XmlComponent {
}
}
class TimestampElementProperties extends XmlAttributeComponent<{ readonly type: string }> {
protected readonly xmlKeys = { type: "xsi:type" };
}
class TimestampElement extends XmlComponent {
public constructor(name: string) {
super(name);
this.root.push(
new DocumentAttributes({
new TimestampElementProperties({
type: "dcterms:W3CDTF",
}),
);

View File

@ -1,4 +1,5 @@
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
import { CustomPropertiesAttributes } from "./custom-properties-attributes";
import { CustomProperty, ICustomPropertyOptions } from "./custom-property";

View File

@ -1,10 +1,11 @@
import { XmlComponent } from "@file/xml-components";
import { CustomPropertyAttributes } from "./custom-property-attributes";
export interface ICustomPropertyOptions {
export type ICustomPropertyOptions = {
readonly name: string;
readonly value: string;
}
};
export class CustomProperty extends XmlComponent {
public constructor(id: number, properties: ICustomPropertyOptions) {

View File

@ -1,14 +1,14 @@
import { XmlComponent } from "./xml-components";
import { Document, IDocumentOptions } from "./document";
import { Footer } from "./footer/footer";
import { FootNotes } from "./footnotes";
import { Header } from "./header/header";
import { Relationships } from "./relationships";
import { XmlComponent } from "./xml-components";
export interface IViewWrapper {
export type IViewWrapper = {
readonly View: Document | Footer | Header | FootNotes | XmlComponent;
readonly Relationships: Relationships;
}
};
export class DocumentWrapper implements IViewWrapper {
private readonly document: Document;

View File

@ -1,5 +1,5 @@
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
import { Column } from "./column";

View File

@ -2,26 +2,26 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { DocumentGrid, DocumentGridType } from ".";
import { DocumentGridType, createDocumentGrid } from ".";
describe("DocumentGrid", () => {
describe("createDocumentGrid", () => {
describe("#constructor()", () => {
it("should create documentGrid with specified linePitch", () => {
const docGrid = new DocumentGrid(360);
const docGrid = createDocumentGrid({ linePitch: 360 });
const tree = new Formatter().format(docGrid);
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 360 } });
});
it("should create documentGrid with specified linePitch and type", () => {
const docGrid = new DocumentGrid(360, undefined, DocumentGridType.LINES);
const docGrid = createDocumentGrid({ linePitch: 360, type: DocumentGridType.LINES });
const tree = new Formatter().format(docGrid);
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 360, "w:type": "lines" } });
});
it("should create documentGrid with specified linePitch,charSpace and type", () => {
const docGrid = new DocumentGrid(346, -1541, DocumentGridType.LINES_AND_CHARS);
const docGrid = createDocumentGrid({ linePitch: 346, charSpace: -1541, type: DocumentGridType.LINES_AND_CHARS });
const tree = new Formatter().format(docGrid);
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 346, "w:charSpace": -1541, "w:type": "linesAndChars" } });

View File

@ -1,55 +1,113 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { decimalNumber } from "@util/values";
// not implemented
// <xsd:simpleType name="ST_DocGrid">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="default"/>
// <xsd:enumeration value="lines"/>
// <xsd:enumeration value="linesAndChars"/>
// <xsd:enumeration value="snapToChars"/>
// </xsd:restriction>
// </xsd:simpleType>
// <xsd:complexType name="CT_DocGrid">
// <xsd:attribute name="type" type="ST_DocGrid"/>
// <xsd:attribute name="linePitch" type="ST_DecimalNumber"/>
// <xsd:attribute name="charSpace" type="ST_DecimalNumber"/>
// </xsd:complexType>
/* eslint-disable @typescript-eslint/naming-convention */
/**
* Specifies the type of the current document grid, which defines the grid behavior.
*
* The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to all characters on each row; or a grid which affects only the line pitch for the current section.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_DocGrid_topic_ID0ELYP2.html
*
* ## XSD Schema
* ```xml
* <xsd:simpleType name="ST_DocGrid">
* <xsd:restriction base="xsd:string">
* <xsd:enumeration value="default"/>
* <xsd:enumeration value="lines"/>
* <xsd:enumeration value="linesAndChars"/>
* <xsd:enumeration value="snapToChars"/>
* </xsd:restriction>
* </xsd:simpleType>
* ```
*/
export const DocumentGridType = {
/**
* Specifies that no document grid shall be applied to the contents of the current section in the document.
*/
DEFAULT: "default",
/**
* Specifies that the parent section shall have additional line pitch added to each line within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain the specified number of lines per page.
*/
LINES: "lines",
/**
* Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.
*
* When this value is set, the input specified via the user interface may be allowed in exact number of line/character pitch units. */
LINES_AND_CHARS: "linesAndChars",
/**
* Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.
*
* When this value is set, the input specified via the user interface may be restricted to the number of lines per page and characters per line, with the consumer or producer translating this information based on the current font data to get the resulting line and character pitch values
*/
SNAP_TO_CHARS: "snapToChars",
} as const;
/* eslint-enable */
export interface IDocGridAttributesProperties {
export type IDocGridAttributesProperties = {
/**
* Specifies the type of the current document grid, which defines the grid behavior.
*
* The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to each character on each row; or a grid which affects only the line pitch for the current section.
*/
readonly type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];
readonly linePitch?: number;
/**
* Specifies the number of lines to be allowed on the document grid for the current page assuming all lines have equal line pitch applied to them. This line pitch shall not be added to any line which appears within a table cell unless the <adjustLineHeightInTable> element (§2.15.3.1) is present in the document's compatibility settings.
*
* This attribute is specified in twentieths of a point, and defines the pitch for each line of text on this page such that the desired number of single spaced lines of text fits on the current page.
*
* ```xml
* <w:docGrid w:linePitch="684" …/>
* ```
*
* The `linePitch` attribute specifies that 34.2 points is to the amount of pitch allowed for each line on this page in order to maintain the specific document grid. ]
*
* Individual paragraphs can override the line pitch information specified for the document grid by either:
*
* Specifying an exact line spacing value using the `lineRule` attribute of value exact on the <spacing> element (§2.3.1.33).
*
* Specifying that the paragraph text shall not snap to the document grid via the <snapToGrid> element (§2.3.1.32).
*
* The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).
*/
readonly linePitch: number;
/**
* Specifies the number of characters to be allowed on the document grid for each line in this section.
*
* This attribute's value shall be specified by multiplying the difference between the desired character pitch and the character pitch for that character in the font size of the Normal font by 4096.
*
* This value shall then be used to add the character pitch for the specified point size to each character in the section [: This results in text in the Normal style having a specific number of characters per line. ]
*
* ```xml
* <w:docGrid w:charSize="40960" …/>
* ```
* The `charSpace` attribute specifies a value of 40960, which means that the delta between the character pitch of each character in the grid and the Normal font is 10 points, resulting in a character pitch of 11+10 = 21 points for all characters in this section. ]
*
* Individual runs of text can override the line pitch information specified for the document grid by specifying that the run text shall not snap to the document grid via the <snapToGrid> element (§2.3.2.32).
*
* The possible values for this attribute are defined by the `ST_DecimalNumber` simple type (§2.18.16).
*/
readonly charSpace?: number;
}
};
export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesProperties> {
protected readonly xmlKeys = {
type: "w:type",
linePitch: "w:linePitch",
charSpace: "w:charSpace",
};
}
export class DocumentGrid extends XmlComponent {
public constructor(linePitch: number, charSpace?: number, type?: (typeof DocumentGridType)[keyof typeof DocumentGridType]) {
super("w:docGrid");
this.root.push(
new DocGridAttributes({
type: type,
linePitch: decimalNumber(linePitch),
charSpace: charSpace ? decimalNumber(charSpace) : undefined,
}),
);
}
}
/**
* This element specifies the settings for the document grid, which enables precise layout of full-width East Asian language characters within a document by specifying the desired number of characters per line and lines per page for all East Asian text content in this section.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docGrid_topic_ID0EHU5S.html
*
* ```xml
* <xsd:complexType name="CT_DocGrid">
* <xsd:attribute name="type" type="ST_DocGrid"/>
* <xsd:attribute name="linePitch" type="ST_DecimalNumber"/>
* <xsd:attribute name="charSpace" type="ST_DecimalNumber"/>
* </xsd:complexType>
* ```
* @returns
*/
export const createDocumentGrid = ({ type, linePitch, charSpace }: IDocGridAttributesProperties): XmlComponent =>
new BuilderElement<IDocGridAttributesProperties>({
name: "w:docGrid",
attributes: {
type: { key: "w:type", value: type },
linePitch: { key: "w:linePitch", value: decimalNumber(linePitch) },
charSpace: { key: "w:charSpace", value: charSpace ? decimalNumber(charSpace) : undefined },
},
});

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./header-footer-reference";
describe("HeaderFooterReference", () => {

View File

@ -1,19 +1,30 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:simpleType name="ST_HdrFtr">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="even"/>
// <xsd:enumeration value="default"/>
// <xsd:enumeration value="first"/>
// </xsd:restriction>
// </xsd:simpleType>
/**
* This simple type specifies the possible types of headers and footers which may be specified for a given header or footer reference in a document. This value determines the page(s) on which the current header or footer shall be displayed.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_HdrFtr_topic_ID0E2UW2.html
*
* ## XSD Schema
* ```xml
* <xsd:simpleType name="ST_HdrFtr">
* <xsd:restriction base="xsd:string">
* <xsd:enumeration value="even"/>
* <xsd:enumeration value="default"/>
* <xsd:enumeration value="first"/>
* </xsd:restriction>
* </xsd:simpleType>
* ```
*/
export const HeaderFooterReferenceType = {
/** Specifies that this header or footer shall appear on every page in this section which is not overridden with a specific `even` or `first` page header/footer. In a section with all three types specified, this type shall be used on all odd numbered pages (counting from the `first` page in the section, not the section numbering). */
DEFAULT: "default",
/** Specifies that this header or footer shall appear on the first page in this section. The appearance of this header or footer is contingent on the setting of the `titlePg` element (§2.10.6). */
FIRST: "first",
/** Specifies that this header or footer shall appear on all even numbered pages in this section (counting from the first page in the section, not the section numbering). The appearance of this header or footer is contingent on the setting of the `evenAndOddHeaders` element (§2.10.1). */
EVEN: "even",
} as const;
// </xsd:complexType>
// <xsd:group name="EG_HdrFtrReferences">
// <xsd:choice>
// <xsd:element name="headerReference" type="CT_HdrFtrRef" minOccurs="0"/>
@ -32,10 +43,10 @@ export const HeaderFooterReferenceType = {
// <xsd:attribute ref="r:id" use="required"/>
// </xsd:complexType>
export interface IHeaderFooterOptions {
export type IHeaderFooterOptions = {
readonly type?: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
readonly id?: number;
}
};
class FooterReferenceAttributes extends XmlAttributeComponent<{
readonly type: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];

View File

@ -0,0 +1,34 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { createLineNumberType } from "./line-number";
describe("createLineNumberType", () => {
it("should work", () => {
const textDirection = createLineNumberType({ countBy: 0, start: 0, restart: "newPage", distance: 10 });
const tree = new Formatter().format(textDirection);
expect(tree).to.deep.equal({
"w:lnNumType": { _attr: { "w:countBy": 0, "w:start": 0, "w:restart": "newPage", "w:distance": 10 } },
});
});
it("should work with string measures for distance", () => {
const textDirection = createLineNumberType({ countBy: 0, start: 0, restart: "newPage", distance: "10mm" });
const tree = new Formatter().format(textDirection);
expect(tree).to.deep.equal({
"w:lnNumType": { _attr: { "w:countBy": 0, "w:start": 0, "w:restart": "newPage", "w:distance": "10mm" } },
});
});
it("should work with blank entries", () => {
const textDirection = createLineNumberType({});
const tree = new Formatter().format(textDirection);
expect(tree).to.deep.equal({
"w:lnNumType": { _attr: {} },
});
});
});

View File

@ -1,37 +1,128 @@
// http://officeopenxml.com/WPsectionLineNumbering.php
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
// <xsd:simpleType name="ST_LineNumberRestart">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="newPage"/>
// <xsd:enumeration value="newSection"/>
// <xsd:enumeration value="continuous"/>
// </xsd:restriction>
// </xsd:simpleType>
/* eslint-disable @typescript-eslint/naming-convention */
/**
* This simple type specifies when the line numbering in the parent section shall be reset to its restart value. The line numbering increments for each line (even if the line number itself is not displayed) until it reaches the restart point specified by this element.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_LineNumberRestart_topic_ID0EUS42.html
*
* ## XSD Schema
*
* ```xml
* <xsd:simpleType name="ST_LineNumberRestart">
* <xsd:restriction base="xsd:string">
* <xsd:enumeration value="newPage"/>
* <xsd:enumeration value="newSection"/>
* <xsd:enumeration value="continuous"/>
* </xsd:restriction>
* </xsd:simpleType>
* ```
*/
export const LineNumberRestartFormat = {
/**
* ## Restart Line Numbering on Each Page
*
* Specifies that line numbering for the parent section shall restart to the starting value whenever a new page is displayed.
*/
NEW_PAGE: "newPage",
/**
* ## Restart Line Numbering for Each Section
*
* Specifies that line numbering for the parent section shall restart to the starting value whenever the parent begins.
*/
NEW_SECTION: "newSection",
/**
* ## Continue Line Numbering From Previous Section
*
* Specifies that line numbering for the parent section shall continue from the line numbering from the end of the previous section, if any.
*/
CONTINUOUS: "continuous",
} as const;
/* eslint-enable */
// <xsd:complexType name="CT_LineNumber">
// <xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
// <xsd:attribute name="start" type="ST_DecimalNumber" use="optional" default="1"/>
// <xsd:attribute name="distance" type="s:ST_TwipsMeasure" use="optional"/>
// <xsd:attribute name="restart" type="ST_LineNumberRestart" use="optional" default="newPage"/>
// </xsd:complexType>
export type ILineNumberAttributes = {
/**
* Specifies the line number increments to be displayed in the current document.
*
* Although each line has an associated line number, only lines which are an even multiple of this value shall be displayed.
*
* ### Example
*
* ```xml
* <w:lnNumType … w:countBy="5"/>
* ```
*
* This setting ensures that only lines whose number is a multiple of (e.g. 5, 10, and 15) will have a line number displayed. ]
*
* The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).
*/
readonly countBy?: number;
/**
* ## Line Numbering Starting Value
*
* Specifies the starting value used for the first line whenever the line numbering is restarted by use of the `restart` attribute.
*
* ### Example
*
* ```xml
* <w:lnNumType w:start="3" w:countBy="5"/>
* ```
*
* The `start` attribute specifies that line numbers shall be counted starting from the number 3.
*
* The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).
*/
readonly start?: number;
/**
* ## Line Numbering Restart Setting
*
* Specifies when the line numbering in this section shall be reset to the line number specified by the `start` attribute's value.
*
* The line numbering increments for each line (even if it is not displayed) until it reaches the restart point specified by this element.
*
* ### Example
*
* ```xml
* <w:sectPr>
* ...
* <w:lnNumType w:restart="newPage" ... />
* </w:sectPr>
* ```
*
* The value of `newPage` specifies that the line numbers shall restart at the top of each page to the value specified by the `start` attribute. In this case, `newPage` is the default, so this value could have been omitted entirely.
*
* The possible values for this attribute are defined by the ST_LineNumberRestart simple type (§2.18.54).
*/
readonly restart?: (typeof LineNumberRestartFormat)[keyof typeof LineNumberRestartFormat];
/**
* Specifies the distance between the text margin and the edge of any line numbers appearing in that section.
*
* ```.xml
* <w:lnNumType ... w:distance="720"/>
* ```
*
* The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§2.18.105).
*/
readonly distance?: number | PositiveUniversalMeasure;
};
/**
* This element specifies the settings for line numbering to be displayed before each column of text in this section in the document.
*
* References:
* - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_lnNumType_topic_ID0EVRAT.html
* - http://officeopenxml.com/WPsectionLineNumbering.php
*
* ## XSD Schema
*
* ```xml
* <xsd:complexType name="CT_LineNumber">
* <xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
* <xsd:attribute name="start" type="ST_DecimalNumber" use="optional" default="1"/>
* <xsd:attribute name="distance" type="s:ST_TwipsMeasure" use="optional"/>
* <xsd:attribute name="restart" type="ST_LineNumberRestart" use="optional" default="newPage"/>
* </xsd:complexType>
* ```
*/
export const createLineNumberType = ({ countBy, start, restart, distance }: ILineNumberAttributes): XmlComponent =>
new BuilderElement<ILineNumberAttributes>({
name: "w:lnNumType",

View File

@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
import { PageBorderDisplay, PageBorderZOrder, PageBorders } from "./page-borders";
describe("PageBorders", () => {
describe("#constructor()", () => {

View File

@ -10,13 +10,11 @@ import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent } from "@file/xml-comp
// </xsd:restriction>
// </xsd:simpleType>
/* eslint-disable @typescript-eslint/naming-convention */
export const PageBorderDisplay = {
ALL_PAGES: "allPages",
FIRST_PAGE: "firstPage",
NOT_FIRST_PAGE: "notFirstPage",
} as const;
/* eslint-enable */
// <xsd:simpleType name="ST_PageBorderOffset">
// <xsd:restriction base="xsd:string">
@ -40,19 +38,19 @@ export const PageBorderZOrder = {
FRONT: "front",
} as const;
export interface IPageBorderAttributes {
export type IPageBorderAttributes = {
readonly display?: (typeof PageBorderDisplay)[keyof typeof PageBorderDisplay];
readonly offsetFrom?: (typeof PageBorderOffsetFrom)[keyof typeof PageBorderOffsetFrom];
readonly zOrder?: (typeof PageBorderZOrder)[keyof typeof PageBorderZOrder];
}
};
export interface IPageBordersOptions {
export type IPageBordersOptions = {
readonly pageBorders?: IPageBorderAttributes;
readonly pageBorderTop?: IBorderOptions;
readonly pageBorderRight?: IBorderOptions;
readonly pageBorderBottom?: IBorderOptions;
readonly pageBorderLeft?: IBorderOptions;
}
};
class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes> {
protected readonly xmlKeys = {

View File

@ -1,5 +1,5 @@
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { PositiveUniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue, UniversalMeasure } from "@util/values";
import { PositiveUniversalMeasure, UniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
// <xsd:complexType name="CT_PageMar">
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>

View File

@ -13,7 +13,6 @@ import { decimalNumber } from "@util/values";
// </xsd:restriction>
// </xsd:simpleType>
/* eslint-disable @typescript-eslint/naming-convention */
export const PageNumberSeparator = {
HYPHEN: "hyphen",
PERIOD: "period",
@ -22,13 +21,11 @@ export const PageNumberSeparator = {
EN_DASH: "endash",
} as const;
/* eslint-enable */
export interface IPageNumberTypeAttributes {
export type IPageNumberTypeAttributes = {
readonly start?: number;
readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat];
readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator];
}
};
// <xsd:complexType name="CT_PageNumber">
// <xsd:attribute name="fmt" type="ST_NumberFormat" use="optional" default="decimal"/>

View File

@ -2,12 +2,12 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PageOrientation, PageSize } from "./page-size";
import { PageOrientation, createPageSize } from "./page-size";
describe("PageSize", () => {
describe("#constructor()", () => {
it("should create page size with portrait", () => {
const properties = new PageSize(100, 200, PageOrientation.PORTRAIT);
const properties = createPageSize({ width: 100, height: 200, orientation: PageOrientation.PORTRAIT });
const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:pgSz"]);
@ -15,7 +15,7 @@ describe("PageSize", () => {
});
it("should create page size with horizontal and invert the lengths", () => {
const properties = new PageSize(100, 200, PageOrientation.LANDSCAPE);
const properties = createPageSize({ width: 100, height: 200, orientation: PageOrientation.LANDSCAPE });
const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:pgSz"]);

View File

@ -1,48 +1,132 @@
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
// <xsd:simpleType name="ST_PageOrientation">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="portrait"/>
// <xsd:enumeration value="landscape"/>
// </xsd:restriction>
// </xsd:simpleType>
/**
* This simple type specifies the orientation of all pages in the parent section. This information is used to determine the actual paper size to use when printing the file.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_PageOrientation_topic_ID0EKBK3.html
*
* ## XSD Schema
*
* ```xml
* <xsd:simpleType name="ST_PageOrientation">
* <xsd:restriction base="xsd:string">
* <xsd:enumeration value="portrait"/>
* <xsd:enumeration value="landscape"/>
* </xsd:restriction>
* </xsd:simpleType>
* ```
*/
export const PageOrientation = {
/**
* ## Portrait Mode
*
* Specifies that pages in this section shall be printed in portrait mode.
*/
PORTRAIT: "portrait",
/**
* ## Landscape Mode
*
* Specifies that pages in this section shall be printed in landscape mode, which prints the page contents with a 90 degree rotation with respect to the normal page orientation.
*/
LANDSCAPE: "landscape",
} as const;
// <xsd:complexType name="CT_PageSz">
// <xsd:attribute name="w" type="s:ST_TwipsMeasure"/>
// <xsd:attribute name="h" type="s:ST_TwipsMeasure"/>
// <xsd:attribute name="orient" type="ST_PageOrientation" use="optional"/>
// <xsd:attribute name="code" type="ST_DecimalNumber" use="optional"/>
// </xsd:complexType>
export type IPageSizeAttributes = {
readonly width?: number | PositiveUniversalMeasure;
readonly height?: number | PositiveUniversalMeasure;
/**
* ## Page Width
*
* This attribute indicates the width (in twentieths of a point) for all pages in the current section.
*
* ### Example
*
* ```xml
* <w:pgSz w:w="15840" w:h="12240" />
* ```
*
* All pages in this section are displayed on a page that is 15840 twentieths of a point (11") wide.
*
* The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§2.18.105).
*/
readonly width: number | PositiveUniversalMeasure;
/**
* ## Page Height
*
* Specifies the height (in twentieths of a point) for all pages in the current section.
*
* ### Example
*
* ```xml
* <w:pgSz w:w="15840" w:h="12240" />
* ```
*
* All pages in this section are displayed on a page that is `12240` twentieths of a point (`8.5"`) tall.
*
* The possible values for this attribute are defined by the `ST_TwipsMeasure` simple type (§2.18.105).
*/
readonly height: number | PositiveUniversalMeasure;
/**
* ## Page Orientation
*
* Specifies the orientation of all pages in this section.
*
* This information is used to determine the actual paper size to use on the printer.
*
* This implies that the actual paper size width and height are reversed for pages in this section. If this attribute is omitted, then portrait shall be implied.
*
* ### Example
*
* ```xml
* <w:pgSz w:w="15840" w:h="12240" w:orient="landscape" />
* ```
*
* Although the page width is 11", and page height is 8.5", according to the `w` and `h` attributes, because the `orient` attribute is set to landscape, pages in this section are printed on 8.5x11" paper in landscape mode.
*
* The possible values for this attribute are defined by the `ST_PageOrientation` simple type (§2.18.71).
*/
readonly orientation?: (typeof PageOrientation)[keyof typeof PageOrientation];
/**
* ## Printer Paper Code
*
* Specifies a printer-specific paper code for the paper type, which shall be used by the printer for pages in this section.
*
* This code is stored to ensure the proper paper type is chosen if the specified paper size matches the sizes of multiple paper types supported by the current printer.
*
* It will be sent to the printer and used by the printer to determine the appropriate paper type to use when printing.
*
* This value is not interpreted or modified other than storing it as specified by the printer.
*
* The possible values for this attribute are defined by the `ST_DecimalNumber` simple type (§2.18.16).
*/
readonly code?: number;
};
export class PageSize extends XmlComponent {
public constructor(
width: number | PositiveUniversalMeasure,
height: number | PositiveUniversalMeasure,
orientation: (typeof PageOrientation)[keyof typeof PageOrientation],
) {
super("w:pgSz");
const flip = orientation === PageOrientation.LANDSCAPE;
const widthTwips = twipsMeasureValue(width);
const heightTwips = twipsMeasureValue(height);
this.root.push(
new NextAttributeComponent<IPageSizeAttributes>({
width: { key: "w:w", value: flip ? heightTwips : widthTwips },
height: { key: "w:h", value: flip ? widthTwips : heightTwips },
orientation: { key: "w:orient", value: orientation },
}),
);
}
}
/**
* This element specifies the properties (size and orientation) for all pages in the current section.
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_pgSz_topic_ID0ENEDT.html?hl=pgsz%2Cpage%2Csize
*
* ## XSD Schema
*
* ```xml
* <xsd:complexType name="CT_PageSz">
* <xsd:attribute name="w" type="s:ST_TwipsMeasure"/>
* <xsd:attribute name="h" type="s:ST_TwipsMeasure"/>
* <xsd:attribute name="orient" type="ST_PageOrientation" use="optional"/>
* <xsd:attribute name="code" type="ST_DecimalNumber" use="optional"/>
* </xsd:complexType>
* ```
*/
export const createPageSize = ({ width, height, orientation, code }: IPageSizeAttributes): XmlComponent => {
const widthTwips = twipsMeasureValue(width);
const heightTwips = twipsMeasureValue(height);
return new BuilderElement<IPageSizeAttributes>({
name: "w:pgSz",
attributes: {
width: { key: "w:w", value: orientation === PageOrientation.LANDSCAPE ? heightTwips : widthTwips },
height: { key: "w:h", value: orientation === PageOrientation.LANDSCAPE ? widthTwips : heightTwips },
orientation: { key: "w:orient", value: orientation },
code: { key: "w:code", value: code },
},
});
};

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PageTextDirection, PageTextDirectionType } from "./page-text-direction";
describe("PageTextDirection", () => {

View File

@ -1,13 +1,10 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
/* eslint-disable @typescript-eslint/naming-convention */
export const PageTextDirectionType = {
LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl",
} as const;
/* eslint-enable */
class PageTextDirectionAttributes extends XmlAttributeComponent<{
readonly val: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType];
}> {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { SectionType, Type } from "./section-type";
describe("Type", () => {

View File

@ -11,7 +11,6 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// </xsd:restriction>
// </xsd:simpleType>
/* eslint-disable @typescript-eslint/naming-convention */
export const SectionType = {
NEXT_PAGE: "nextPage",
NEXT_COLUMN: "nextColumn",
@ -19,7 +18,6 @@ export const SectionType = {
EVEN_PAGE: "evenPage",
ODD_PAGE: "oddPage",
} as const;
/* eslint-enable */
// <xsd:complexType name="CT_SectType">
// <xsd:attribute name="val" type="ST_SectionMark"/>

View File

@ -6,7 +6,7 @@ import { FooterWrapper } from "@file/footer-wrapper";
import { HeaderWrapper } from "@file/header-wrapper";
import { Media } from "@file/media";
import { NumberFormat } from "@file/shared/number-format";
import { VerticalAlign } from "@file/vertical-align";
import { VerticalAlignSection } from "@file/vertical-align";
import { convertInchesToTwip } from "@util/convenience-functions";
import { PageOrientation } from "./properties";
@ -15,7 +15,7 @@ import { LineNumberRestartFormat } from "./properties/line-number";
import { PageBorderOffsetFrom } from "./properties/page-borders";
import { PageTextDirectionType } from "./properties/page-text-direction";
import { SectionType } from "./properties/section-type";
import { sectionMarginDefaults, sectionPageSizeDefaults, SectionProperties } from "./section-properties";
import { SectionProperties, sectionMarginDefaults, sectionPageSizeDefaults } from "./section-properties";
const DEFAULT_MARGINS = {
"w:bottom": sectionMarginDefaults.BOTTOM,
@ -75,7 +75,7 @@ describe("SectionProperties", () => {
even: new FooterWrapper(media, 200),
},
titlePage: true,
verticalAlign: VerticalAlign.TOP,
verticalAlign: VerticalAlignSection.TOP,
});
const tree = new Formatter().format(properties);

View File

@ -1,45 +1,44 @@
// http://officeopenxml.com/WPsection.php
// tslint:disable: no-unnecessary-initializer
import { FooterWrapper } from "@file/footer-wrapper";
import { HeaderWrapper } from "@file/header-wrapper";
import { VerticalAlign, VerticalAlignElement } from "@file/vertical-align";
import { SectionVerticalAlign, VerticalAlignElement } from "@file/vertical-align";
import { OnOffElement, XmlComponent } from "@file/xml-components";
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
import { Columns, IColumnsAttributes } from "./properties/columns";
import { DocumentGrid, IDocGridAttributesProperties } from "./properties/doc-grid";
import { IDocGridAttributesProperties, createDocumentGrid } from "./properties/doc-grid";
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
import { ILineNumberAttributes, createLineNumberType } from "./properties/line-number";
import { IPageBordersOptions, PageBorders } from "./properties/page-borders";
import { IPageMarginAttributes, PageMargin } from "./properties/page-margin";
import { IPageNumberTypeAttributes, PageNumberType } from "./properties/page-number";
import { IPageSizeAttributes, PageOrientation, PageSize } from "./properties/page-size";
import { IPageSizeAttributes, PageOrientation, createPageSize } from "./properties/page-size";
import { PageTextDirection, PageTextDirectionType } from "./properties/page-text-direction";
import { SectionType, Type } from "./properties/section-type";
export interface IHeaderFooterGroup<T> {
export type IHeaderFooterGroup<T> = {
readonly default?: T;
readonly first?: T;
readonly even?: T;
}
};
export interface ISectionPropertiesOptions {
export type ISectionPropertiesOptions = {
readonly page?: {
readonly size?: IPageSizeAttributes;
readonly size?: Partial<IPageSizeAttributes>;
readonly margin?: IPageMarginAttributes;
readonly pageNumbers?: IPageNumberTypeAttributes;
readonly borders?: IPageBordersOptions;
readonly textDirection?: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType];
};
readonly grid?: IDocGridAttributesProperties;
readonly grid?: Partial<IDocGridAttributesProperties>;
readonly headerWrapperGroup?: IHeaderFooterGroup<HeaderWrapper>;
readonly footerWrapperGroup?: IHeaderFooterGroup<FooterWrapper>;
readonly lineNumbers?: ILineNumberAttributes;
readonly titlePage?: boolean;
readonly verticalAlign?: (typeof VerticalAlign)[keyof typeof VerticalAlign];
readonly verticalAlign?: SectionVerticalAlign;
readonly column?: IColumnsAttributes;
readonly type?: (typeof SectionType)[keyof typeof SectionType];
}
};
// <xsd:complexType name="CT_SectPr">
// <xsd:sequence>
@ -129,7 +128,7 @@ export class SectionProperties extends XmlComponent {
this.root.push(new Type(type));
}
this.root.push(new PageSize(width, height, orientation));
this.root.push(createPageSize({ width, height, orientation }));
this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter));
if (borders) {
@ -158,7 +157,7 @@ export class SectionProperties extends XmlComponent {
this.root.push(new PageTextDirection(textDirection));
}
this.root.push(new DocumentGrid(linePitch, charSpace, gridType));
this.root.push(createDocumentGrid({ linePitch, charSpace, type: gridType }));
}
private addHeaderFooterGroup(

View File

@ -1,89 +1,60 @@
import { XmlAttributeComponent } from "@file/xml-components";
import { AttributeMap, XmlAttributeComponent } from "@file/xml-components";
/* cSpell:disable */
export interface IDocumentAttributesProperties {
readonly wpc?: string;
readonly mc?: string;
readonly o?: string;
readonly r?: string;
readonly m?: string;
readonly v?: string;
readonly wp14?: string;
readonly wp?: string;
readonly w10?: string;
readonly w?: string;
readonly w14?: string;
readonly w15?: string;
readonly wpg?: string;
readonly wpi?: string;
readonly wne?: string;
readonly wps?: string;
readonly Ignorable?: string;
readonly cp?: string;
readonly dc?: string;
readonly dcterms?: string;
readonly dcmitype?: string;
readonly xsi?: string;
readonly type?: string;
readonly cx?: string;
readonly cx1?: string;
readonly cx2?: string;
readonly cx3?: string;
readonly cx4?: string;
readonly cx5?: string;
readonly cx6?: string;
readonly cx7?: string;
readonly cx8?: string;
readonly aink?: string;
readonly am3d?: string;
readonly w16cex?: string;
readonly w16cid?: string;
readonly w16?: string;
readonly w16sdtdh?: string;
readonly w16se?: string;
}
export const DocumentAttributeNamespaces = {
wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
o: "urn:schemas-microsoft-com:office:office",
r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
v: "urn:schemas-microsoft-com:vml",
wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
w10: "urn:schemas-microsoft-com:office:word",
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
w14: "http://schemas.microsoft.com/office/word/2010/wordml",
w15: "http://schemas.microsoft.com/office/word/2012/wordml",
wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
wne: "http://schemas.microsoft.com/office/word/2006/wordml",
wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
dc: "http://purl.org/dc/elements/1.1/",
dcterms: "http://purl.org/dc/terms/",
dcmitype: "http://purl.org/dc/dcmitype/",
xsi: "http://www.w3.org/2001/XMLSchema-instance",
cx: "http://schemas.microsoft.com/office/drawing/2014/chartex",
cx1: "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
cx2: "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
cx3: "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
cx4: "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
cx5: "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
cx6: "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
cx7: "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
cx8: "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
aink: "http://schemas.microsoft.com/office/drawing/2016/ink",
am3d: "http://schemas.microsoft.com/office/drawing/2017/model3d",
w16cex: "http://schemas.microsoft.com/office/word/2018/wordml/cex",
w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid",
w16: "http://schemas.microsoft.com/office/word/2018/wordml",
w16sdtdh: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",
w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex",
};
/* cSpell:enable */
export type DocumentAttributeNamespace = keyof typeof DocumentAttributeNamespaces;
export type IDocumentAttributesProperties = Partial<Record<DocumentAttributeNamespace, string>> & {
readonly Ignorable?: string;
};
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
protected readonly xmlKeys = {
wpc: "xmlns:wpc",
mc: "xmlns:mc",
o: "xmlns:o",
r: "xmlns:r",
m: "xmlns:m",
v: "xmlns:v",
wp14: "xmlns:wp14",
wp: "xmlns:wp",
w10: "xmlns:w10",
w: "xmlns:w",
w14: "xmlns:w14",
w15: "xmlns:w15",
wpg: "xmlns:wpg",
wpi: "xmlns:wpi",
wne: "xmlns:wne",
wps: "xmlns:wps",
Ignorable: "mc:Ignorable",
cp: "xmlns:cp",
dc: "xmlns:dc",
dcterms: "xmlns:dcterms",
dcmitype: "xmlns:dcmitype",
xsi: "xmlns:xsi",
type: "xsi:type",
cx: "xmlns:cx",
cx1: "xmlns:cx1",
cx2: "xmlns:cx2",
cx3: "xmlns:cx3",
cx4: "xmlns:cx4",
cx5: "xmlns:cx5",
cx6: "xmlns:cx6",
cx7: "xmlns:cx7",
cx8: "xmlns:cx8",
aink: "xmlns:aink",
am3d: "xmlns:am3d",
w16cex: "xmlns:w16cex",
w16cid: "xmlns:w16cid",
w16: "xmlns:w16",
w16sdtdh: "xmlns:w16sdtdh",
w16se: "xmlns:w16se",
};
...Object.fromEntries(Object.keys(DocumentAttributeNamespaces).map((key) => [key, `xmlns:${key}`])),
} as AttributeMap<IDocumentAttributesProperties>;
public constructor(ns: readonly DocumentAttributeNamespace[], Ignorable?: string) {
super({ Ignorable, ...Object.fromEntries(ns.map((n) => [n, DocumentAttributeNamespaces[n]])) });
}
}

View File

@ -39,12 +39,12 @@ export class DocumentBackgroundAttributes extends XmlAttributeComponent<{
};
}
export interface IDocumentBackgroundOptions {
export type IDocumentBackgroundOptions = {
readonly color?: string;
readonly themeColor?: string;
readonly themeShade?: string;
readonly themeTint?: string;
}
};
// <xsd:complexType name="CT_Background">
// <xsd:sequence>

View File

@ -1,5 +1,6 @@
// http://officeopenxml.com/WPdocument.php
import { XmlComponent } from "@file/xml-components";
import { ConcreteHyperlink, Paragraph } from "../paragraph";
import { Table } from "../table";
import { TableOfContents } from "../table-of-contents";
@ -7,9 +8,9 @@ import { Body } from "./body";
import { DocumentAttributes } from "./document-attributes";
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
export interface IDocumentOptions {
export type IDocumentOptions = {
readonly background?: IDocumentBackgroundOptions;
}
};
// <xsd:element name="document" type="CT_Document"/>
//
@ -36,41 +37,43 @@ export class Document extends XmlComponent {
public constructor(options: IDocumentOptions) {
super("w:document");
this.root.push(
new DocumentAttributes({
wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
o: "urn:schemas-microsoft-com:office:office",
r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
v: "urn:schemas-microsoft-com:vml",
wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
w10: "urn:schemas-microsoft-com:office:word",
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
w14: "http://schemas.microsoft.com/office/word/2010/wordml",
w15: "http://schemas.microsoft.com/office/word/2012/wordml",
wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
wne: "http://schemas.microsoft.com/office/word/2006/wordml",
wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
cx: "http://schemas.microsoft.com/office/drawing/2014/chartex",
cx1: "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
cx2: "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
cx3: "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
cx4: "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
cx5: "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
cx6: "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
cx7: "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
cx8: "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
aink: "http://schemas.microsoft.com/office/drawing/2016/ink",
am3d: "http://schemas.microsoft.com/office/drawing/2017/model3d",
w16cex: "http://schemas.microsoft.com/office/word/2018/wordml/cex",
w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid",
w16: "http://schemas.microsoft.com/office/word/2018/wordml",
w16sdtdh: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",
w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex",
Ignorable: "w14 w15 wp14",
}),
new DocumentAttributes(
[
"wpc",
"mc",
"o",
"r",
"m",
"v",
"wp14",
"wp",
"w10",
"w",
"w14",
"w15",
"wpg",
"wpi",
"wne",
"wps",
"cx",
"cx1",
"cx2",
"cx3",
"cx4",
"cx5",
"cx6",
"cx7",
"cx8",
"aink",
"am3d",
"w16cex",
"w16cid",
"w16",
"w16sdtdh",
"w16se",
],
"w14 w15 wp14",
),
);
this.body = new Body();
if (options.background) {
@ -80,7 +83,6 @@ export class Document extends XmlComponent {
}
public add(item: Paragraph | Table | TableOfContents | ConcreteHyperlink): Document {
// eslint-disable-next-line functional/immutable-data
this.body.push(item);
return this;
}

View File

@ -1,14 +1,15 @@
import { XmlAttributeComponent } from "@file/xml-components";
import { IDistance } from "../drawing";
export interface IAnchorAttributes extends IDistance {
export type IAnchorAttributes = {
readonly allowOverlap?: "0" | "1";
readonly behindDoc?: "0" | "1";
readonly layoutInCell?: "0" | "1";
readonly locked?: "0" | "1";
readonly relativeHeight?: number;
readonly simplePos?: "0" | "1";
}
} & IDistance;
export class AnchorAttributes extends XmlAttributeComponent<IAnchorAttributes> {
protected readonly xmlKeys = {

View File

@ -1,7 +1,6 @@
import { assert, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { Utility } from "tests/utility";
import { IDrawingOptions } from "../drawing";
@ -92,28 +91,20 @@ describe("Anchor", () => {
// 2: horizontal position
const horizontalPosition = newJson.root[2];
assert.equal(horizontalPosition.rootKey, "wp:positionH");
assert.include(horizontalPosition.root[0].root, {
relativeFrom: "page",
});
assert.equal(horizontalPosition.root[1].rootKey, "wp:posOffset");
assert.include(horizontalPosition.root[1].root[0], 0);
// 3: vertical position
const verticalPosition = newJson.root[3];
assert.equal(verticalPosition.rootKey, "wp:positionV");
assert.include(verticalPosition.root[0].root, {
relativeFrom: "page",
});
assert.equal(verticalPosition.root[1].rootKey, "wp:posOffset");
assert.include(verticalPosition.root[1].root[0], 0);
// 4: extent
const extent = newJson.root[4];
assert.equal(extent.rootKey, "wp:extent");
assert.include(extent.root[0].root, {
cx: 952500,
cy: 952500,
});
// 5: effect extent
const effectExtent = newJson.root[5];

View File

@ -1,14 +1,15 @@
// http://officeopenxml.com/drwPicFloating.php
import { IMediaData, IMediaDataTransformation } from "@file/media";
import { XmlComponent } from "@file/xml-components";
import { IDrawingOptions } from "../drawing";
import { HorizontalPosition, IFloating, SimplePos, VerticalPosition } from "../floating";
import { IFloating, createHorizontalPosition, createSimplePos, createVerticalPosition } from "../floating";
import { Graphic } from "../inline/graphic";
import { TextWrappingType, WrapNone, WrapSquare, WrapTight, WrapTopAndBottom } from "../text-wrap";
import { DocProperties } from "./../doc-properties/doc-properties";
import { createEffectExtent } from "./../effect-extent/effect-extent";
import { Extent } from "./../extent/extent";
import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
import { createExtent } from "./../extent/extent";
import { createGraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
import { AnchorAttributes } from "./anchor-attributes";
// <xsd:complexType name="CT_Anchor">
@ -73,10 +74,10 @@ export class Anchor extends XmlComponent {
}),
);
this.root.push(new SimplePos());
this.root.push(new HorizontalPosition(floating.horizontalPosition));
this.root.push(new VerticalPosition(floating.verticalPosition));
this.root.push(new Extent(transform.emus.x, transform.emus.y));
this.root.push(createSimplePos());
this.root.push(createHorizontalPosition(floating.horizontalPosition));
this.root.push(createVerticalPosition(floating.verticalPosition));
this.root.push(createExtent({ x: transform.emus.x, y: transform.emus.y }));
this.root.push(createEffectExtent({ top: 0, right: 0, bottom: 0, left: 0 }));
if (drawingOptions.floating !== undefined && drawingOptions.floating.wrap !== undefined) {
@ -99,7 +100,7 @@ export class Anchor extends XmlComponent {
}
this.root.push(new DocProperties(drawingOptions.docProperties));
this.root.push(new GraphicFrameProperties());
this.root.push(createGraphicFrameProperties());
this.root.push(new Graphic({ mediaData, transform, outline: drawingOptions.outline }));
}
}

View File

@ -1,7 +1,6 @@
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docPr_topic_ID0ES32OB.html
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { ConcreteHyperlink } from "@file/paragraph";
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { docPropertiesUniqueNumericIdGen } from "@util/convenience-functions";
import { createHyperlinkClick } from "./doc-properties-children";
@ -18,11 +17,11 @@ import { createHyperlinkClick } from "./doc-properties-children";
// <attribute name="hidden" type="xsd:boolean" use="optional" default="false" />
// </complexType>
export interface DocPropertiesOptions {
export type DocPropertiesOptions = {
readonly name: string;
readonly description: string;
readonly title: string;
}
readonly description?: string;
readonly title?: string;
};
export class DocProperties extends XmlComponent {
private readonly docPropertiesUniqueNumericId = docPropertiesUniqueNumericIdGen();
@ -30,26 +29,32 @@ export class DocProperties extends XmlComponent {
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
super("wp:docPr");
this.root.push(
new NextAttributeComponent({
id: {
key: "id",
value: this.docPropertiesUniqueNumericId(),
},
name: {
key: "name",
value: name,
},
description: {
key: "descr",
value: description,
},
title: {
key: "title",
value: title,
},
}),
);
const attributes: Record<string, { readonly key: string; readonly value: string | number }> = {
id: {
key: "id",
value: this.docPropertiesUniqueNumericId(),
},
name: {
key: "name",
value: name,
},
};
if (description !== null && description !== undefined) {
attributes.description = {
key: "descr",
value: description,
};
}
if (title !== null && title !== undefined) {
attributes.title = {
key: "title",
value: title,
};
}
this.root.push(new NextAttributeComponent(attributes));
}
public prepForXml(context: IContext): IXmlableObject | undefined {
@ -60,7 +65,6 @@ export class DocProperties extends XmlComponent {
}
this.root.push(createHyperlinkClick(element.linkId, true));
break;
}

View File

@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { IContext } from "@file/xml-components";
import { Formatter } from "@export/formatter";
import { IContext } from "@file/xml-components";
import { ConcreteHyperlink, TextRun } from "../";
import { Drawing, IDrawingOptions } from "./drawing";
@ -80,7 +80,6 @@ describe("Drawing", () => {
{
"a:graphicFrameLocks": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
noChangeAspect: 1,
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
},
@ -139,7 +138,6 @@ describe("Drawing", () => {
{
"a:blip": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
cstate: "none",
"r:embed": "rId{test.jpg}",
},
@ -311,7 +309,6 @@ describe("Drawing", () => {
{
"a:graphicFrameLocks": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
noChangeAspect: 1,
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
},
@ -370,7 +367,6 @@ describe("Drawing", () => {
{
"a:blip": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
cstate: "none",
"r:embed": "rId{test.jpg}",
},
@ -554,7 +550,6 @@ describe("Drawing", () => {
{
"a:graphicFrameLocks": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
noChangeAspect: 1,
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
},
@ -622,7 +617,6 @@ describe("Drawing", () => {
{
"a:blip": {
_attr: {
// tslint:disable-next-line:object-literal-key-quotes
cstate: "none",
"r:embed": "rId{test.jpg}",
},

View File

@ -14,11 +14,11 @@ export type IDistance = {
readonly distR?: number;
};
export interface IDrawingOptions {
export type IDrawingOptions = {
readonly floating?: IFloating;
readonly docProperties?: DocPropertiesOptions;
readonly outline?: OutlineOptions;
}
};
// <xsd:complexType name="CT_Drawing">
// <xsd:choice minOccurs="1" maxOccurs="unbounded">

View File

@ -1,12 +1,50 @@
import { BuilderElement, XmlComponent } from "@file/xml-components";
export type EffectExtentAttributes = {
/**
* ## Additional Extent on Top Edge
*
* Specifies the additional length, in EMUs, which shall be added to the top edge of the DrawingML object to determine its actual top edge including effects.
*/
readonly top: number;
/**
* ## Additional Extent on Right Edge
*
* Specifies the additional length, in EMUs, which shall be added to the right edge of the DrawingML object to determine its actual right edge including effects.
*/
readonly right: number;
/**
* ## Additional Extent on Bottom Edge
*
* Specifies the additional length, in EMUs, which shall be added to the bottom edge of the DrawingML object to determine its actual bottom edge including effects.
*/
readonly bottom: number;
/**
* ## Additional Extent on Left Edge
*
* Specifies the additional length, in EMUs, which shall be added to the left edge of the DrawingML object to determine its actual left edge including effects.
*/
readonly left: number;
};
/**
* This element specifies the additional extent which shall be added to each edge of the image (top, bottom, left, right) in order to compensate for any drawing effects applied to the DrawingML object.
*
* The `<extent>` element (§5.5.2.7) specifies the size of the actual DrawingML object; however, an object may have effects applied which change its overall size
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_effectExtent_topic_ID0E5O3OB.html
*
* ## XSD Schema
*
* ```xml
* <xsd:complexType name="CT_EffectExtent">
* <xsd:attribute name="l" type="a:ST_Coordinate" use="required"/>
* <xsd:attribute name="t" type="a:ST_Coordinate" use="required"/>
* <xsd:attribute name="r" type="a:ST_Coordinate" use="required"/>
* <xsd:attribute name="b" type="a:ST_Coordinate" use="required"/>
* </xsd:complexType>
* ```
*/
export const createEffectExtent = ({ top, right, bottom, left }: EffectExtentAttributes): XmlComponent =>
new BuilderElement<EffectExtentAttributes>({
name: "wp:effectExtent",

View File

@ -1,11 +0,0 @@
import { XmlAttributeComponent } from "@file/xml-components";
export class ExtentAttributes extends XmlAttributeComponent<{
readonly cx?: number;
readonly cy?: number;
}> {
protected readonly xmlKeys = {
cx: "cx",
cy: "cy",
};
}

View File

@ -1,18 +1,60 @@
import { XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { ExtentAttributes } from "./extent-attributes";
type ExtentAttributes = {
/**
* ## Extent Length
*
* Specifies the length of the extents rectangle in EMUs. This rectangle shall dictate the size of the object as displayed (the result of any scaling to the original object).
*
*
* ### Example
*
* ```xml
* <... cx="1828800" cy="200000"/>
* ```
*
* The `cx` attributes specifies that this object has a height of `1828800` EMUs (English Metric Units).
*
* The possible values for this attribute are defined by the `ST_PositiveCoordinate` simple type (§5.1.12.42).
*/
readonly x?: number;
/**
* ## Extent Width
*
* Specifies the width of the extents rectangle in EMUs. This rectangle shall dictate the size of the object as displayed (the result of any scaling to the original object).
*
* ### Example
*
* ```xml
* <... cx="1828800" cy="200000"/>
* ```
*
* The `cy` attribute specifies that this object has a width of `200000` EMUs (English Metric Units).
*
* The possible values for this attribute are defined by the `ST_PositiveCoordinate` simple type (§5.1.12.42).
*/
readonly y?: number;
};
export class Extent extends XmlComponent {
private readonly attributes: ExtentAttributes;
public constructor(x: number, y: number) {
super("wp:extent");
this.attributes = new ExtentAttributes({
cx: x,
cy: y,
});
this.root.push(this.attributes);
}
}
/**
* This element specifies the extents of the parent `DrawingML` object within the document (i.e. its final height and width).
*
* Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_extent_topic_ID0EQB4OB.html
*
* ## XSD Schema
*
* ```xml
* <complexType name="CT_PositiveSize2D">
* <attribute name="cx" type="ST_PositiveCoordinate" use="required"/>
* <attribute name="cy" type="ST_PositiveCoordinate" use="required"/>
* </complexType>
* ```
*/
export const createExtent = ({ x, y }: ExtentAttributes): XmlComponent =>
new BuilderElement<ExtentAttributes>({
name: "wp:extent",
attributes: {
x: { key: "cx", value: x },
y: { key: "cy", value: y },
},
});

View File

@ -3,12 +3,12 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { VerticalPositionAlign } from "@file/shared/alignment";
import { Align } from "./align";
import { createAlign } from "./align";
describe("Align", () => {
describe("#constructor()", () => {
it("should create a element with correct root key", () => {
const tree = new Formatter().format(new Align(VerticalPositionAlign.CENTER));
const tree = new Formatter().format(createAlign(VerticalPositionAlign.CENTER));
expect(tree).to.deep.equal({
"wp:align": ["center"],
});

View File

@ -1,14 +1,23 @@
// http://officeopenxml.com/drwPicFloating-position.php
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/alignment";
import { XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
export class Align extends XmlComponent {
public constructor(
value:
| (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign]
| (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign],
) {
super("wp:align");
this.root.push(value);
}
}
/**
* # Relative Horizontal/Vertical Alignment
*
* This element specifies how a DrawingML object shall be horizontally/vertically aligned relative to the horizontal/vertical alignment base defined by the parent element. Once an alignment base is defined, this element shall determine how the DrawingML object shall be aligned relative to that location.
*
* References:
* - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_align_topic_ID0EYZZOB.html
* - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_align_topic_ID0ET4ZOB.html
* - http://officeopenxml.com/drwPicFloating-position.php
*/
export const createAlign = (
value:
| (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign]
| (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign],
): XmlComponent =>
new BuilderElement({
name: "wp:align",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: [value as any],
});

View File

@ -4,50 +4,138 @@ import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/ali
import { ITextWrapping } from "../text-wrap";
/* eslint-disable @typescript-eslint/naming-convention */
/**
* Horizontal Relative Positioning
*
* Reference: https://www.datypic.com/sc/ooxml/t-wp_ST_RelFromH.html
*/
export const HorizontalPositionRelativeFrom = {
/**
* ## Character
*
* Specifies that the horizontal positioning shall be relative to the position of the anchor within its run content.
*/
CHARACTER: "character",
/**
* ## Column
*
* Specifies that the horizontal positioning shall be relative to the extents of the column which contains its anchor.
*/
COLUMN: "column",
/**
* ## Inside Margin
*
* Specifies that the horizontal positioning shall be relative to the inside margin of the current page (the left margin on odd pages, right on even pages).
*/
INSIDE_MARGIN: "insideMargin",
/**
* ## Left Margin
*
* Specifies that the horizontal positioning shall be relative to the left margin of the page.
*/
LEFT_MARGIN: "leftMargin",
/**
* ## Page Margin
*
* Specifies that the horizontal positioning shall be relative to the page margins.
*/
MARGIN: "margin",
/**
* ## Outside Margin
*
* Specifies that the horizontal positioning shall be relative to the outside margin of the current page (the right margin on odd pages, left on even pages).
*/
OUTSIDE_MARGIN: "outsideMargin",
/**
* ## Page Edge
*
* Specifies that the horizontal positioning shall be relative to the edge of the page.
*/
PAGE: "page",
/**
* ## Right Margin
*
* Specifies that the horizontal positioning shall be relative to the right margin of the page.
*/
RIGHT_MARGIN: "rightMargin",
} as const;
/**
* Vertical Relative Positioning
*
* Reference: https://www.datypic.com/sc/ooxml/t-wp_ST_RelFromV.html
*/
export const VerticalPositionRelativeFrom = {
/**
* ## Bottom Margin
*
* Specifies that the vertical positioning shall be relative to the bottom margin of the current page.
*/
BOTTOM_MARGIN: "bottomMargin",
/**
* ## Inside Margin
*
* Specifies that the vertical positioning shall be relative to the inside margin of the current page.
*/
INSIDE_MARGIN: "insideMargin",
/**
* ## Line
*
* Specifies that the vertical positioning shall be relative to the line containing the anchor character.
*/
LINE: "line",
/**
* ## Page Margin
*
* Specifies that the vertical positioning shall be relative to the page margins.
*/
MARGIN: "margin",
/**
* ## Outside Margin
*
* Specifies that the vertical positioning shall be relative to the outside margin of the current page.
*/
OUTSIDE_MARGIN: "outsideMargin",
/**
* ## Page Edge
*
* Specifies that the vertical positioning shall be relative to the edge of the page.
*/
PAGE: "page",
/**
* ## Paragraph
*
* Specifies that the vertical positioning shall be relative to the paragraph which contains the drawing anchor.
*/
PARAGRAPH: "paragraph",
/**
* ## Top Margin
*
* Specifies that the vertical positioning shall be relative to the top margin of the current page.
*/
TOP_MARGIN: "topMargin",
} as const;
/* eslint-enable */
export interface IHorizontalPositionOptions {
export type IHorizontalPositionOptions = {
readonly relative?: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
readonly align?: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];
readonly offset?: number;
}
};
export interface IVerticalPositionOptions {
export type IVerticalPositionOptions = {
readonly relative?: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
readonly align?: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];
readonly offset?: number;
}
};
export interface IMargins {
export type IMargins = {
readonly left?: number;
readonly bottom?: number;
readonly top?: number;
readonly right?: number;
}
};
export interface IFloating {
export type IFloating = {
readonly horizontalPosition: IHorizontalPositionOptions;
readonly verticalPosition: IVerticalPositionOptions;
readonly allowOverlap?: boolean;
@ -57,4 +145,4 @@ export interface IFloating {
readonly margins?: IMargins;
readonly wrap?: ITextWrapping;
readonly zIndex?: number;
}
};

View File

@ -4,13 +4,13 @@ import { Formatter } from "@export/formatter";
import { HorizontalPositionAlign } from "@file/shared/alignment";
import { HorizontalPositionRelativeFrom } from "./floating-position";
import { HorizontalPosition } from "./horizontal-position";
import { createHorizontalPosition } from "./horizontal-position";
describe("HorizontalPosition", () => {
describe("#constructor()", () => {
it("should create a element with position align", () => {
const tree = new Formatter().format(
new HorizontalPosition({
createHorizontalPosition({
relative: HorizontalPositionRelativeFrom.MARGIN,
align: HorizontalPositionAlign.CENTER,
}),
@ -31,7 +31,7 @@ describe("HorizontalPosition", () => {
it("should create a element with offset", () => {
const tree = new Formatter().format(
new HorizontalPosition({
createHorizontalPosition({
relative: HorizontalPositionRelativeFrom.MARGIN,
offset: 40,
}),
@ -51,7 +51,7 @@ describe("HorizontalPosition", () => {
});
it("should require one of align or offset", () => {
expect(() => new HorizontalPosition({})).to.throw();
expect(() => createHorizontalPosition({})).to.throw();
});
});
});

View File

@ -1,33 +1,33 @@
// http://officeopenxml.com/drwPicFloating-position.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { Align } from "./align";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { createAlign } from "./align";
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
import { PositionOffset } from "./position-offset";
import { createPositionOffset } from "./position-offset";
class HorizontalPositionAttributes extends XmlAttributeComponent<{
readonly relativeFrom: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
}> {
protected readonly xmlKeys = {
relativeFrom: "relativeFrom",
};
}
export class HorizontalPosition extends XmlComponent {
public constructor(horizontalPosition: IHorizontalPositionOptions) {
super("wp:positionH");
this.root.push(
new HorizontalPositionAttributes({
relativeFrom: horizontalPosition.relative || HorizontalPositionRelativeFrom.PAGE,
}),
);
if (horizontalPosition.align) {
this.root.push(new Align(horizontalPosition.align));
} else if (horizontalPosition.offset !== undefined) {
this.root.push(new PositionOffset(horizontalPosition.offset));
} else {
throw new Error("There is no configuration provided for floating position (Align or offset)");
}
}
}
/**
* Horizontal Positioning
*
* Reference: https://www.datypic.com/sc/ooxml/e-wp_positionH-1.html
*/
export const createHorizontalPosition = ({ relative, align, offset }: IHorizontalPositionOptions): XmlComponent =>
new BuilderElement<{
/** Horizontal Position Relative Base */
readonly relativeFrom: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
}>({
name: "wp:positionH",
attributes: {
relativeFrom: { key: "relativeFrom", value: relative ?? HorizontalPositionRelativeFrom.PAGE },
},
children: [
(() => {
if (align) {
return createAlign(align);
} else if (offset !== undefined) {
return createPositionOffset(offset);
} else {
throw new Error("There is no configuration provided for floating position (Align or offset)");
}
})(),
],
});

View File

@ -2,12 +2,12 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PositionOffset } from "./position-offset";
import { createPositionOffset } from "./position-offset";
describe("PositionOffset", () => {
describe("createPositionOffset", () => {
describe("#constructor()", () => {
it("should create a element with correct root key", () => {
const tree = new Formatter().format(new PositionOffset(50));
const tree = new Formatter().format(createPositionOffset(50));
expect(tree).to.deep.equal({
"wp:posOffset": ["50"],
});

View File

@ -1,9 +1,17 @@
// http://officeopenxml.com/drwPicFloating-position.php
import { XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
export class PositionOffset extends XmlComponent {
public constructor(offsetValue: number) {
super("wp:posOffset");
this.root.push(offsetValue.toString());
}
}
/**
* # Absolute Position Offset
*
* This element specifies an absolute measurement for the positioning of a floating DrawingML object within a WordprocessingML document. This measurement shall be calculated relative to the top left edge of the positioning base specified by the parent element's `relativeFrom` attribute.
*
* References:
* - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_posOffset_topic_ID0EMG6OB.html
* - http://officeopenxml.com/drwPicFloating-position.php
*/
export const createPositionOffset = (offsetValue: number): XmlComponent =>
new BuilderElement({
name: "wp:posOffset",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: [offsetValue.toString() as any],
});

View File

@ -2,12 +2,12 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { SimplePos } from "./simple-pos";
import { createSimplePos } from "./simple-pos";
describe("SimplePos", () => {
describe("createSimplePos", () => {
describe("#constructor()", () => {
it("should create a element with correct root key", () => {
const tree = new Formatter().format(new SimplePos());
const tree = new Formatter().format(createSimplePos());
expect(tree).to.deep.equal({
"wp:simplePos": {
_attr: {

View File

@ -1,26 +1,62 @@
// http://officeopenxml.com/drwPicFloating-position.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
class SimplePosAttributes extends XmlAttributeComponent<{
readonly x: number;
readonly y: number;
}> {
protected readonly xmlKeys = {
x: "x",
y: "y",
};
}
export class SimplePos extends XmlComponent {
public constructor() {
super("wp:simplePos");
import { BuilderElement, XmlComponent } from "@file/xml-components";
/**
* # Simple Positioning Coordinates
*
* This element specifies the coordinates at which a DrawingML object shall be positioned relative to the top-left edge of its page, when the `simplePos` attribute is specified on the <anchor> element (§5.5.2.3).
*
* References:
* - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_simplePos_topic_ID0E5K6OB.html
* - http://officeopenxml.com/drwPicFloating-position.php
*
* ## XSD Schema
*
* ```xml
* <xsd:complexType name="CT_Point2D">
* <xsd:attribute name="x" type="ST_Coordinate" use="required"/>
* <xsd:attribute name="y" type="ST_Coordinate" use="required"/>
* </xsd:complexType>
* ```
*/
export const createSimplePos = (): XmlComponent =>
new BuilderElement<{
/**
* ## X-Axis Coordinate
*
* Specifies a coordinate on the x-axis. The origin point for this coordinate shall be specified by the parent XML element.
*
* ### Example
*
* ```xml
* <wp:... x="0" y="100" />
* ```
*
* The `x` attribute defines an x-coordinate of 0.
*
* The possible values for this attribute are defined by the `ST_Coordinate` simple type (§5.1.12.16).
*/
readonly x: number;
/**
* ## Y-Axis Coordinate
*
* Specifies a coordinate on the x-axis. The origin point for this coordinate shall be specified by the parent XML element.
*
* ### Example
* ```xml
* <wp:... x="0" y="100" />
* ```
*
* The `y` attribute defines a y-coordinate of 100.
*
* The possible values for this attribute are defined by the `ST_Coordinate` simple type (§5.1.12.16).
*/
readonly y: number;
}>({
name: "wp:simplePos",
// NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway
this.root.push(
new SimplePosAttributes({
x: 0,
y: 0,
}),
);
}
}
attributes: {
x: { key: "x", value: 0 },
y: { key: "y", value: 0 },
},
});

View File

@ -4,13 +4,13 @@ import { Formatter } from "@export/formatter";
import { VerticalPositionAlign } from "@file/shared/alignment";
import { VerticalPositionRelativeFrom } from "./floating-position";
import { VerticalPosition } from "./vertical-position";
import { createVerticalPosition } from "./vertical-position";
describe("VerticalPosition", () => {
describe("#constructor()", () => {
it("should create a element with position align", () => {
const tree = new Formatter().format(
new VerticalPosition({
createVerticalPosition({
relative: VerticalPositionRelativeFrom.MARGIN,
align: VerticalPositionAlign.INSIDE,
}),
@ -31,7 +31,7 @@ describe("VerticalPosition", () => {
it("should create a element with offset", () => {
const tree = new Formatter().format(
new VerticalPosition({
createVerticalPosition({
relative: VerticalPositionRelativeFrom.MARGIN,
offset: 40,
}),
@ -51,7 +51,7 @@ describe("VerticalPosition", () => {
});
it("should require one of align or offset", () => {
expect(() => new VerticalPosition({})).to.throw();
expect(() => createVerticalPosition({})).to.throw();
});
});
});

View File

@ -1,33 +1,35 @@
// http://officeopenxml.com/drwPicFloating-position.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { Align } from "./align";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { createAlign } from "./align";
import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position";
import { PositionOffset } from "./position-offset";
import { createPositionOffset } from "./position-offset";
class VerticalPositionAttributes extends XmlAttributeComponent<{
readonly relativeFrom: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
}> {
protected readonly xmlKeys = {
relativeFrom: "relativeFrom",
};
}
export class VerticalPosition extends XmlComponent {
public constructor(verticalPosition: IVerticalPositionOptions) {
super("wp:positionV");
this.root.push(
new VerticalPositionAttributes({
relativeFrom: verticalPosition.relative || VerticalPositionRelativeFrom.PAGE,
}),
);
if (verticalPosition.align) {
this.root.push(new Align(verticalPosition.align));
} else if (verticalPosition.offset !== undefined) {
this.root.push(new PositionOffset(verticalPosition.offset));
} else {
throw new Error("There is no configuration provided for floating position (Align or offset)");
}
}
}
/**
* Vertical Positioning
*
* This simple type specifies the possible values for the base from which the relative vertical positioning of an object shall be calculated.
*
* Reference: https://www.datypic.com/sc/ooxml/e-wp_positionV-1.html
*/
export const createVerticalPosition = ({ relative, align, offset }: IVerticalPositionOptions): XmlComponent =>
new BuilderElement<{
/** Vertical Position Relative Base */
readonly relativeFrom: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
}>({
name: "wp:positionV",
attributes: {
relativeFrom: { key: "relativeFrom", value: relative ?? VerticalPositionRelativeFrom.PAGE },
},
children: [
(() => {
if (align) {
return createAlign(align);
} else if (offset !== undefined) {
return createPositionOffset(offset);
} else {
throw new Error("There is no configuration provided for floating position (Align or offset)");
}
})(),
],
});

Some files were not shown because too many files have changed in this diff Show More