@agilehub/docx-converter 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CONTRIBUTING.md +47 -0
  2. package/LICENSE +201 -0
  3. package/README.md +594 -3
  4. package/dist/adapters/browser/metafile-preview.d.ts +5 -0
  5. package/dist/adapters/browser/node-pdf-unavailable.d.ts +1 -0
  6. package/dist/adapters/browser/pdf-renderer.d.ts +3 -0
  7. package/dist/adapters/node/convert-file.d.ts +6 -0
  8. package/dist/adapters/node/imagemagick-preview.d.ts +3 -0
  9. package/dist/adapters/node/pdf-renderer.d.ts +2 -0
  10. package/dist/application/conversion-session.d.ts +12 -0
  11. package/dist/application/convert-docx.d.ts +18 -0
  12. package/dist/application/convert-pdf.d.ts +2 -0
  13. package/dist/application/limits.d.ts +3 -0
  14. package/dist/application/read-input.d.ts +2 -0
  15. package/dist/browser-7rsR6MAK.js +32188 -0
  16. package/dist/browser-metafile.cjs +1 -0
  17. package/dist/browser-metafile.d.ts +1 -0
  18. package/dist/browser-metafile.js +9 -0
  19. package/dist/contracts/conversion.d.ts +92 -0
  20. package/dist/contracts/errors.d.ts +4 -0
  21. package/dist/contracts/ports.d.ts +16 -0
  22. package/dist/docx-converter.browser.js +61157 -0
  23. package/dist/docx-converter.umd.cjs +109 -0
  24. package/dist/domain/document.d.ts +93 -0
  25. package/dist/errors-MXQpFjKY.js +8 -0
  26. package/dist/html2canvas-BdBs_TOY.js +4005 -0
  27. package/dist/html2pdf-CoDoV4ti.js +28943 -0
  28. package/dist/index.cjs +1 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.js +1 -0
  31. package/dist/infrastructure/archive/zip-reader.d.ts +3 -0
  32. package/dist/infrastructure/opc/docx-package.d.ts +20 -0
  33. package/dist/infrastructure/opc/part-reader.d.ts +15 -0
  34. package/dist/infrastructure/xml/dom.d.ts +11 -0
  35. package/dist/infrastructure/xml/namespaces.d.ts +10 -0
  36. package/dist/infrastructure/xml/safe-xml.d.ts +2 -0
  37. package/dist/metafile-rasterizer-B07sBlcp.js +43 -0
  38. package/dist/metafile-rasterizer-C9QNCFz9.cjs +1 -0
  39. package/dist/modules/document/block-reader.d.ts +3 -0
  40. package/dist/modules/document/chart-parser.d.ts +6 -0
  41. package/dist/modules/document/document-parser.d.ts +13 -0
  42. package/dist/modules/document/drawing-parser.d.ts +9 -0
  43. package/dist/modules/document/group-drawing-parser.d.ts +5 -0
  44. package/dist/modules/document/inline-parser.d.ts +11 -0
  45. package/dist/modules/document/paragraph-parser.d.ts +4 -0
  46. package/dist/modules/document/parse-context.d.ts +20 -0
  47. package/dist/modules/document/table-parser.d.ts +9 -0
  48. package/dist/modules/images/drawing-rasterizer.d.ts +4 -0
  49. package/dist/modules/images/image-resolver.d.ts +11 -0
  50. package/dist/modules/images/metafile-rasterizer.d.ts +3 -0
  51. package/dist/modules/images/node-canvas-unavailable.d.ts +2 -0
  52. package/dist/modules/images/raster-codec.d.ts +2 -0
  53. package/dist/modules/math/mtef-latex.d.ts +2 -0
  54. package/dist/modules/math/ole-equation.d.ts +2 -0
  55. package/dist/modules/math/ole-native-stream.d.ts +2 -0
  56. package/dist/modules/math/omml-converter.d.ts +4 -0
  57. package/dist/modules/math/preview-consistency.d.ts +2 -0
  58. package/dist/modules/numbering/numbering-reader.d.ts +11 -0
  59. package/dist/modules/styles/ooxml-values.d.ts +2 -0
  60. package/dist/modules/styles/style-resolver.d.ts +34 -0
  61. package/dist/node-canvas-unavailable-CvBCngan.js +5 -0
  62. package/dist/node-pdf-unavailable-C8y2PrZN.js +6 -0
  63. package/dist/node.cjs +1 -0
  64. package/dist/node.d.ts +4 -0
  65. package/dist/node.js +52 -0
  66. package/dist/pdf-renderer-BXTmJHRv.js +69 -0
  67. package/dist/pdf-renderer-C7Ls8Wll.cjs +1 -0
  68. package/dist/pdf-renderer-D5aBQswF.js +68 -0
  69. package/dist/pdf-renderer-DG-eDzRb.js +40 -0
  70. package/dist/pdf-renderer-D_uNzxa8.cjs +1 -0
  71. package/dist/rendering/html/caption-policy.d.ts +13 -0
  72. package/dist/rendering/html/document-shell.d.ts +2 -0
  73. package/dist/rendering/html/html-renderer.d.ts +16 -0
  74. package/dist/rendering/html/image-renderer.d.ts +8 -0
  75. package/dist/rendering/html/math-image-renderer.d.ts +4 -0
  76. package/dist/rendering/html/styles.d.ts +4 -0
  77. package/dist/rendering/json/json-renderer.d.ts +13 -0
  78. package/dist/rendering/math-image-source.d.ts +24 -0
  79. package/dist/rolldown-runtime-DfEuXgQw.js +15 -0
  80. package/dist/shared/markup.d.ts +3 -0
  81. package/dist/shared/units.d.ts +2 -0
  82. package/dist/src-CGXH7X67.cjs +15 -0
  83. package/dist/src-DypdJEH8.js +56775 -0
  84. package/docs/architecture.md +159 -0
  85. package/package.json +82 -6
@@ -0,0 +1,16 @@
1
+ import type { DocumentModel } from '../../domain/document.js';
2
+ import type { ConversionOptions } from '../../contracts/conversion.js';
3
+ import type { RenderContext, ResourceReader } from '../../contracts/ports.js';
4
+ export declare class HtmlRenderer {
5
+ private readonly context;
6
+ private readonly options;
7
+ private counters;
8
+ private readonly images;
9
+ constructor(resources: ResourceReader, context: RenderContext, options: ConversionOptions);
10
+ render(model: DocumentModel): Promise<string>;
11
+ private blocks;
12
+ private list;
13
+ private paragraph;
14
+ private table;
15
+ private inlines;
16
+ }
@@ -0,0 +1,8 @@
1
+ import type { ImageNode } from '../../domain/document.js';
2
+ import type { ConversionOptions } from '../../contracts/conversion.js';
3
+ import type { RenderContext, ResourceReader } from '../../contracts/ports.js';
4
+ export declare class ImageRenderer {
5
+ private readonly resolver;
6
+ constructor(resources: ResourceReader, context: RenderContext, options: ConversionOptions);
7
+ render(n: ImageNode, inline: boolean): Promise<string>;
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { MathNode } from '../../domain/document.js';
2
+ import type { RenderContext } from '../../contracts/ports.js';
3
+ import type { MathImageFormat } from '../math-image-source.js';
4
+ export declare function renderMathImage(node: MathNode, context: RenderContext, format: MathImageFormat): Promise<string>;
@@ -0,0 +1,4 @@
1
+ import type { Css, RunStyle } from '../../domain/document.js';
2
+ export declare const styleAttr: (css: Css) => string;
3
+ export declare const cjk: (s: string) => boolean;
4
+ export declare function textCss(style: RunStyle, east: boolean): Css;
@@ -0,0 +1,13 @@
1
+ import type { DocumentModel } from '../../domain/document.js';
2
+ import type { ConversionOptions } from '../../contracts/conversion.js';
3
+ import type { RenderContext, ResourceReader } from '../../contracts/ports.js';
4
+ /** Projects the parsed document model into a JSON-safe tree with resolved display URLs. */
5
+ export declare class JsonRenderer {
6
+ private readonly context;
7
+ private readonly options;
8
+ private readonly images;
9
+ constructor(resources: ResourceReader, context: RenderContext, options: ConversionOptions);
10
+ render(model: DocumentModel): Promise<DocumentModel>;
11
+ private blocks;
12
+ private inlines;
13
+ }
@@ -0,0 +1,24 @@
1
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/accents.js';
2
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/accents-other.js';
3
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/arrows.js';
4
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/double-struck.js';
5
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/greek.js';
6
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/math.js';
7
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/shapes.js';
8
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/stretchy.js';
9
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/symbols.js';
10
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/symbols-other.js';
11
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/upright.js';
12
+ import '@mathjax/mathjax-stix2-font/js/svg/dynamic/variants.js';
13
+ import type { MathNode } from '../domain/document.js';
14
+ import type { RenderContext } from '../contracts/ports.js';
15
+ export type MathImageFormat = 'png' | 'svg';
16
+ export interface MathImageOutput {
17
+ src: string;
18
+ format: MathImageFormat;
19
+ widthEx: number;
20
+ heightEx: number;
21
+ verticalAlignEx?: number;
22
+ }
23
+ /** Resolve a formula to PNG or SVG while preserving its Word-relative display size. */
24
+ export declare function resolveMathImageOutput(node: MathNode, context: RenderContext, format: MathImageFormat): Promise<MathImageOutput | undefined>;
@@ -0,0 +1,15 @@
1
+ // \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
3
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
+ get: ((e) => i[e]).bind(null, d),
5
+ enumerable: !(s = n(i, d)) || s.enumerable
6
+ });
7
+ return e;
8
+ }, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
9
+ value: n,
10
+ enumerable: !0
11
+ }) : o, n)), l = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
12
+ if (typeof require < "u") return require.apply(this, arguments);
13
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
14
+ });
15
+ export { l as n, c as r, o as t };
@@ -0,0 +1,3 @@
1
+ export declare function esc(text: string): string;
2
+ /** Restrict URL schemes, control characters and protocol-relative URLs. Never fetch package relationships. */
3
+ export declare function safeUrl(url: string, image?: boolean): string | undefined;
@@ -0,0 +1,2 @@
1
+ export declare const pt: (n: number) => string;
2
+ export declare function color(s?: string): string | undefined;