@docen/docx 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/converters/docx.d.mts +95 -5
- package/dist/converters/docx.mjs +732 -82
- package/dist/converters/html.d.mts +20 -5
- package/dist/converters/html.mjs +94 -8
- package/dist/converters/markdown.d.mts +1 -1
- package/dist/converters/markdown.mjs +1 -1
- package/dist/converters/patch.d.mts +1 -1
- package/dist/converters/patch.mjs +4 -5
- package/dist/converters/prepare.d.mts +15 -3
- package/dist/converters/prepare.mjs +50 -4
- package/dist/converters/styles.d.mts +85 -0
- package/dist/converters/styles.mjs +285 -0
- package/dist/core-C9VunJ8o.d.mts +174 -0
- package/dist/core-DT9IrTzN.mjs +670 -0
- package/dist/core.d.mts +1 -1
- package/dist/core.mjs +1 -1
- package/dist/document-BH1y4qHM.d.mts +6 -0
- package/dist/editor.d.mts +1 -1
- package/dist/editor.mjs +3 -2
- package/dist/extensions/blockquote.d.mts +23 -0
- package/dist/extensions/blockquote.mjs +31 -0
- package/dist/extensions/code-block.d.mts +19 -0
- package/dist/extensions/code-block.mjs +23 -0
- package/dist/extensions/column-break.d.mts +31 -0
- package/dist/extensions/column-break.mjs +2 -0
- package/dist/extensions/details.d.mts +19 -0
- package/dist/extensions/details.mjs +18 -0
- package/dist/extensions/document.d.mts +2 -0
- package/dist/extensions/document.mjs +50 -0
- package/dist/extensions/extensions.d.mts +5 -5
- package/dist/extensions/extensions.mjs +4 -3
- package/dist/extensions/formatting-marks.d.mts +38 -0
- package/dist/extensions/formatting-marks.mjs +2 -0
- package/dist/extensions/heading.mjs +24 -3
- package/dist/extensions/image.d.mts +2 -2
- package/dist/extensions/image.mjs +244 -49
- package/dist/extensions/index.d.mts +4 -2
- package/dist/extensions/index.mjs +4 -2
- package/dist/extensions/mention.d.mts +25 -0
- package/dist/extensions/mention.mjs +44 -0
- package/dist/extensions/ordered-list.d.mts +25 -0
- package/dist/extensions/ordered-list.mjs +41 -0
- package/dist/extensions/page-break.d.mts +2 -0
- package/dist/extensions/page-break.mjs +2 -0
- package/dist/extensions/paragraph.d.mts +1 -1
- package/dist/extensions/paragraph.mjs +39 -4
- package/dist/extensions/passthrough.d.mts +2 -0
- package/dist/extensions/passthrough.mjs +2 -0
- package/dist/extensions/section-break.d.mts +44 -0
- package/dist/extensions/section-break.mjs +2 -0
- package/dist/extensions/table.mjs +29 -3
- package/dist/extensions/task-item.d.mts +27 -0
- package/dist/extensions/task-item.mjs +37 -0
- package/dist/extensions/text-style.mjs +20 -3
- package/dist/extensions/tiptap.d.mts +2 -2
- package/dist/extensions/tiptap.mjs +1 -3
- package/dist/extensions/types.d.mts +7 -5
- package/dist/extensions/utils.d.mts +2 -49
- package/dist/extensions/utils.mjs +222 -12
- package/dist/extensions/wpg-group.d.mts +2 -0
- package/dist/extensions/wpg-group.mjs +2 -0
- package/dist/extensions/wps-shape.d.mts +2 -0
- package/dist/extensions/wps-shape.mjs +2 -0
- package/dist/index.d.mts +127 -18
- package/dist/index.mjs +7 -2
- package/dist/paragraph-D8mpHo_o.d.mts +8 -0
- package/dist/{tiptap-TErPjuNJ.d.mts → tiptap-pZsNPsvV.d.mts} +1 -3
- package/dist/utils-D87vukzp.d.mts +128 -0
- package/package.json +40 -40
- package/dist/core-CFIQVRfx.mjs +0 -88
- package/dist/core-omBKMRtl.d.mts +0 -34
- package/dist/image-Ge1y6uam.d.mts +0 -47
- package/dist/paragraph-fhEXtAN2.d.mts +0 -16
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { JSONContent } from "@tiptap/core";
|
|
2
|
-
|
|
3
|
-
//#region src/extensions/image.d.ts
|
|
4
|
-
type CropRect = {
|
|
5
|
-
left?: number;
|
|
6
|
-
top?: number;
|
|
7
|
-
right?: number;
|
|
8
|
-
bottom?: number;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Custom Image extension with node-level renderHTML + renderDocx/parseDocx.
|
|
12
|
-
*
|
|
13
|
-
* Attrs:
|
|
14
|
-
* - src/alt/title/width/height: Tiptap structural names (kept verbatim so base
|
|
15
|
-
* image commands work).
|
|
16
|
-
* - rotation: editor display only (CSS transform) but also carried through DOCX
|
|
17
|
-
* via transformation.rotation (MediaTransformation.rotation).
|
|
18
|
-
* - floating/outline: nested office-open objects (Floating / OutlineOptions).
|
|
19
|
-
* - crop: nested office-open SourceRectangleOptions (srcRect).
|
|
20
|
-
* - display: editor-only display hint, no OOXML equivalent.
|
|
21
|
-
*
|
|
22
|
-
* DOCX round-trip is near-identity: renderDocx packs attrs into CoreImageOptions;
|
|
23
|
-
* parseDocx unpacks them back. src is a data URL ↔ { type, data } base64.
|
|
24
|
-
* Node-level renderHTML solves the style merge problem (rotation + floating).
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Tiptap JSON image node → CoreImageOptions-shaped object.
|
|
28
|
-
*
|
|
29
|
-
* Returns `{ image: ImageOptions }` (structural wrapper) or null when no
|
|
30
|
-
* embedded image data is available (external URLs need pre-fetching).
|
|
31
|
-
* rotation is carried via transformation.rotation (not dropped).
|
|
32
|
-
*/
|
|
33
|
-
declare function renderDocx(node: JSONContent): Record<string, unknown> | null;
|
|
34
|
-
/**
|
|
35
|
-
* ImageOptions-shaped object → Tiptap attrs.
|
|
36
|
-
*
|
|
37
|
-
* Near-identity unpack: transformation → width/height/rotation, altText → alt/title,
|
|
38
|
-
* floating/srcRect(→crop)/outline passed through verbatim. src is reconstructed by
|
|
39
|
-
* DocxManager from the image data bytes (kept out of parseDocx).
|
|
40
|
-
*/
|
|
41
|
-
declare function parseDocx(imageOpts: Record<string, unknown>): Record<string, unknown>;
|
|
42
|
-
declare function renderCropAttrs(crop: Record<string, unknown> | CropRect): {
|
|
43
|
-
style: string;
|
|
44
|
-
};
|
|
45
|
-
declare const Image: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { renderDocx as i, parseDocx as n, renderCropAttrs as r, Image as t };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { JSONContent } from "@tiptap/core";
|
|
2
|
-
|
|
3
|
-
//#region src/extensions/paragraph.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Paragraph extension with nested office-open attrs.
|
|
6
|
-
*
|
|
7
|
-
* Attrs mirror ParagraphPropertiesOptionsBase (alignment/indent/spacing/border/
|
|
8
|
-
* shading/frame as nested objects + scalar OOXML properties). DOCX round-trip is
|
|
9
|
-
* near-identity: renderDocx/parseDocx pass attrs through; CSS conversion happens
|
|
10
|
-
* only in renderHTML via utils mappers.
|
|
11
|
-
*/
|
|
12
|
-
declare function renderDocx(node: JSONContent): Record<string, unknown>;
|
|
13
|
-
declare function parseDocx(opts: Record<string, unknown>): Record<string, unknown>;
|
|
14
|
-
declare const Paragraph: import("@tiptap/core").Node<import("@tiptap/extension-paragraph").ParagraphOptions, any>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { parseDocx as n, renderDocx as r, Paragraph as t };
|