documents.js 1.97.9 → 1.97.11
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/dist/convert/capability.cjs +5 -272
- package/dist/convert/capability.d.cts +1 -1
- package/dist/convert/capability.d.ts +1 -1
- package/dist/convert/capability.js +1 -268
- package/dist/convert/codec.cjs +29 -29
- package/dist/convert/codec.js +1 -1
- package/dist/convert/composition.cjs +5 -0
- package/dist/convert/composition.d.cts +60 -0
- package/dist/convert/composition.d.ts +60 -0
- package/dist/convert/composition.js +2 -0
- package/dist/convert/convert.cjs +42 -797
- package/dist/convert/convert.d.cts +1 -105
- package/dist/convert/convert.d.ts +1 -105
- package/dist/convert/convert.js +1 -756
- package/dist/convert/local.cjs +16 -31
- package/dist/convert/local.js +15 -30
- package/dist/convert-B1izrvnQ.d.cts +106 -0
- package/dist/convert-BO_4tCwz.cjs +1262 -0
- package/dist/convert-HYsWA-LI.d.ts +106 -0
- package/dist/convert-ULGgwmSb.js +975 -0
- package/dist/index.cjs +42 -42
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/metadata/read.cjs +2 -2
- package/dist/metadata/read.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as ClockPort } from "../clock-C7SUuYN0.cjs";
|
|
2
|
+
import { DocumentFormat } from "./port.cjs";
|
|
3
|
+
import { t as OmmlDiagnostic } from "../shared-DLZ3IQUl.cjs";
|
|
4
|
+
import { ContentVariant } from "./capability.cjs";
|
|
5
|
+
import { ContentDocument, DocumentPackage, FontSubstitution, ProvidedFont } from "document-schema.js";
|
|
6
|
+
import { MarkdownImageResolver } from "markdown-codec";
|
|
7
|
+
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
8
|
+
import { Package } from "ooxml.js";
|
|
9
|
+
//#region src/convert/composition.d.ts
|
|
10
|
+
type SourcePackage = Package;
|
|
11
|
+
interface UnifiedConversionOptions {
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
14
|
+
readonly fonts?: readonly ProvidedFont[];
|
|
15
|
+
readonly onFontSubstitution?: (substitution: FontSubstitution) => void;
|
|
16
|
+
readonly onSubstitution?: (substitution: WinAnsiSubstitution, context: {
|
|
17
|
+
readonly pageIndex: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
readonly sink?: PdfDiagnosticSink;
|
|
20
|
+
readonly onMathDiagnostic?: (diagnostic: OmmlDiagnostic, context: {
|
|
21
|
+
readonly sourcePath?: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
readonly images?: MarkdownImageResolver;
|
|
24
|
+
readonly clock?: ClockPort;
|
|
25
|
+
}
|
|
26
|
+
type ContentFormat = 'docx' | 'pptx' | 'xlsx' | 'odt' | 'odp' | 'ods' | 'odg' | 'markdown';
|
|
27
|
+
type LayoutVariant = Exclude<ContentVariant, 'formula'>;
|
|
28
|
+
interface PackageFormatNode {
|
|
29
|
+
readonly variant: LayoutVariant;
|
|
30
|
+
readonly family: 'ooxml' | 'odf';
|
|
31
|
+
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => SourcePackage;
|
|
32
|
+
readonly read: (pkg: SourcePackage, options?: UnifiedConversionOptions) => ContentDocument;
|
|
33
|
+
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => SourcePackage;
|
|
34
|
+
readonly encode: (pkg: SourcePackage) => Uint8Array<ArrayBuffer>;
|
|
35
|
+
readonly hasSourcePackage: true;
|
|
36
|
+
}
|
|
37
|
+
interface MarkdownFormatNode {
|
|
38
|
+
readonly variant: LayoutVariant;
|
|
39
|
+
readonly family: 'markdown';
|
|
40
|
+
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => string;
|
|
41
|
+
readonly read: (text: string, options?: UnifiedConversionOptions) => ContentDocument;
|
|
42
|
+
readonly build: (content: ContentDocument) => string;
|
|
43
|
+
readonly encode: (text: string) => Uint8Array<ArrayBuffer>;
|
|
44
|
+
readonly hasSourcePackage: false;
|
|
45
|
+
}
|
|
46
|
+
type FormatNode = PackageFormatNode | MarkdownFormatNode;
|
|
47
|
+
declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
|
|
48
|
+
type HopExecutor = 'bridge' | 'toPdf' | 'fromPdf';
|
|
49
|
+
interface CompositionHop {
|
|
50
|
+
readonly executor: HopExecutor;
|
|
51
|
+
readonly from: DocumentFormat;
|
|
52
|
+
readonly to: DocumentFormat;
|
|
53
|
+
}
|
|
54
|
+
interface ConversionPlan {
|
|
55
|
+
readonly hops: readonly CompositionHop[];
|
|
56
|
+
}
|
|
57
|
+
declare function resolveCompositionPlan(source: DocumentFormat, target: DocumentFormat): ConversionPlan | undefined;
|
|
58
|
+
declare function convertDocument(source: DocumentFormat, target: DocumentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { CompositionHop, ContentFormat, ConversionPlan, FORMAT_NODES, FormatNode, HopExecutor, UnifiedConversionOptions, convertDocument, resolveCompositionPlan };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as ClockPort } from "../clock-C7SUuYN0.js";
|
|
2
|
+
import { DocumentFormat } from "./port.js";
|
|
3
|
+
import { t as OmmlDiagnostic } from "../shared-DUOzjwcL.js";
|
|
4
|
+
import { ContentVariant } from "./capability.js";
|
|
5
|
+
import { Package } from "ooxml.js";
|
|
6
|
+
import { ContentDocument, DocumentPackage, FontSubstitution, ProvidedFont } from "document-schema.js";
|
|
7
|
+
import { MarkdownImageResolver } from "markdown-codec";
|
|
8
|
+
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
9
|
+
//#region src/convert/composition.d.ts
|
|
10
|
+
type SourcePackage = Package;
|
|
11
|
+
interface UnifiedConversionOptions {
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
readonly onDocument?: (pkg: DocumentPackage) => void;
|
|
14
|
+
readonly fonts?: readonly ProvidedFont[];
|
|
15
|
+
readonly onFontSubstitution?: (substitution: FontSubstitution) => void;
|
|
16
|
+
readonly onSubstitution?: (substitution: WinAnsiSubstitution, context: {
|
|
17
|
+
readonly pageIndex: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
readonly sink?: PdfDiagnosticSink;
|
|
20
|
+
readonly onMathDiagnostic?: (diagnostic: OmmlDiagnostic, context: {
|
|
21
|
+
readonly sourcePath?: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
readonly images?: MarkdownImageResolver;
|
|
24
|
+
readonly clock?: ClockPort;
|
|
25
|
+
}
|
|
26
|
+
type ContentFormat = 'docx' | 'pptx' | 'xlsx' | 'odt' | 'odp' | 'ods' | 'odg' | 'markdown';
|
|
27
|
+
type LayoutVariant = Exclude<ContentVariant, 'formula'>;
|
|
28
|
+
interface PackageFormatNode {
|
|
29
|
+
readonly variant: LayoutVariant;
|
|
30
|
+
readonly family: 'ooxml' | 'odf';
|
|
31
|
+
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => SourcePackage;
|
|
32
|
+
readonly read: (pkg: SourcePackage, options?: UnifiedConversionOptions) => ContentDocument;
|
|
33
|
+
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => SourcePackage;
|
|
34
|
+
readonly encode: (pkg: SourcePackage) => Uint8Array<ArrayBuffer>;
|
|
35
|
+
readonly hasSourcePackage: true;
|
|
36
|
+
}
|
|
37
|
+
interface MarkdownFormatNode {
|
|
38
|
+
readonly variant: LayoutVariant;
|
|
39
|
+
readonly family: 'markdown';
|
|
40
|
+
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => string;
|
|
41
|
+
readonly read: (text: string, options?: UnifiedConversionOptions) => ContentDocument;
|
|
42
|
+
readonly build: (content: ContentDocument) => string;
|
|
43
|
+
readonly encode: (text: string) => Uint8Array<ArrayBuffer>;
|
|
44
|
+
readonly hasSourcePackage: false;
|
|
45
|
+
}
|
|
46
|
+
type FormatNode = PackageFormatNode | MarkdownFormatNode;
|
|
47
|
+
declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
|
|
48
|
+
type HopExecutor = 'bridge' | 'toPdf' | 'fromPdf';
|
|
49
|
+
interface CompositionHop {
|
|
50
|
+
readonly executor: HopExecutor;
|
|
51
|
+
readonly from: DocumentFormat;
|
|
52
|
+
readonly to: DocumentFormat;
|
|
53
|
+
}
|
|
54
|
+
interface ConversionPlan {
|
|
55
|
+
readonly hops: readonly CompositionHop[];
|
|
56
|
+
}
|
|
57
|
+
declare function resolveCompositionPlan(source: DocumentFormat, target: DocumentFormat): ConversionPlan | undefined;
|
|
58
|
+
declare function convertDocument(source: DocumentFormat, target: DocumentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { CompositionHop, ContentFormat, ConversionPlan, FORMAT_NODES, FormatNode, HopExecutor, UnifiedConversionOptions, convertDocument, resolveCompositionPlan };
|