nuvra 0.7.1 → 0.7.3
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 +17 -6
- package/dist/components/document-editor.vue.d.ts +7 -2
- package/dist/components/editor-outline.vue.d.ts +12 -3
- package/dist/components/editor-toolbar.vue.d.ts +6 -4
- package/dist/core/dates.d.ts +1 -4
- package/dist/core/engine/engine.d.ts +15 -4
- package/dist/core/labels.d.ts +3 -5
- package/dist/core/locales/uz.d.ts +6 -0
- package/dist/core/numbers.d.ts +1 -1
- package/dist/core/pdf-import/content.d.ts +59 -0
- package/dist/core/pdf-import/document.d.ts +61 -0
- package/dist/core/pdf-import/encodings.d.ts +17 -0
- package/dist/core/pdf-import/errors.d.ts +11 -0
- package/dist/core/pdf-import/filters.d.ts +18 -0
- package/dist/core/pdf-import/fonts.d.ts +66 -0
- package/dist/core/pdf-import/images.d.ts +9 -0
- package/dist/core/pdf-import/index.d.ts +22 -0
- package/dist/core/pdf-import/inflate.d.ts +11 -0
- package/dist/core/pdf-import/layout.d.ts +16 -0
- package/dist/core/pdf-import/load.d.ts +12 -0
- package/dist/core/pdf-import/objects.d.ts +89 -0
- package/dist/core/types.d.ts +6 -1
- package/dist/errors-tHVeiwWt.js +15 -0
- package/dist/errors-tHVeiwWt.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2908 -2752
- package/dist/index.js.map +1 -1
- package/dist/pdf-import-Cu3c_cO5.js +2348 -0
- package/dist/pdf-import-Cu3c_cO5.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/core/locales/uz-cyrl.d.ts +0 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PDF object model and its parser. Strings stay bytes, because their meaning depends on the font that shows them;
|
|
3
|
+
* names are interned, so they compare by identity. The same lexer reads file objects and content streams, where it
|
|
4
|
+
* also yields operators.
|
|
5
|
+
*/
|
|
6
|
+
/** A PDF name such as `/Type`; one instance per spelling. */
|
|
7
|
+
export declare class PdfName {
|
|
8
|
+
readonly value: string;
|
|
9
|
+
private static readonly cache;
|
|
10
|
+
private constructor();
|
|
11
|
+
static of(value: string): PdfName;
|
|
12
|
+
}
|
|
13
|
+
/** An indirect reference `num gen R`. */
|
|
14
|
+
export declare class PdfRef {
|
|
15
|
+
readonly num: number;
|
|
16
|
+
readonly gen: number;
|
|
17
|
+
constructor(num: number, gen: number);
|
|
18
|
+
}
|
|
19
|
+
/** A content stream operator such as `Tj`. */
|
|
20
|
+
export declare class PdfOperator {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
constructor(name: string);
|
|
23
|
+
}
|
|
24
|
+
/** A dictionary; keys are name values without the slash. */
|
|
25
|
+
export declare class PdfDict {
|
|
26
|
+
readonly entries: Map<string, PdfObject>;
|
|
27
|
+
get(key: string): PdfObject | undefined;
|
|
28
|
+
has(key: string): boolean;
|
|
29
|
+
}
|
|
30
|
+
/** A stream: its dictionary and the still encoded bytes. */
|
|
31
|
+
export declare class PdfStream {
|
|
32
|
+
readonly dict: PdfDict;
|
|
33
|
+
readonly raw: Uint8Array;
|
|
34
|
+
constructor(dict: PdfDict, raw: Uint8Array);
|
|
35
|
+
}
|
|
36
|
+
export type PdfObject = null | boolean | number | PdfName | Uint8Array | PdfObject[] | PdfDict | PdfRef | PdfStream;
|
|
37
|
+
/** Reads the value of a `/Length` entry, which may be an indirect reference in file objects. */
|
|
38
|
+
export type LengthResolver = (value: PdfObject | undefined) => number | undefined;
|
|
39
|
+
/** Structural tokens that are not values. */
|
|
40
|
+
type Token = PdfObject | PdfOperator | typeof ARRAY_END | typeof DICT_END | typeof DICT_START | typeof ARRAY_START;
|
|
41
|
+
declare const ARRAY_START: unique symbol;
|
|
42
|
+
declare const ARRAY_END: unique symbol;
|
|
43
|
+
declare const DICT_START: unique symbol;
|
|
44
|
+
declare const DICT_END: unique symbol;
|
|
45
|
+
/** Returned at the end of the data. */
|
|
46
|
+
export declare const EOF: unique symbol;
|
|
47
|
+
/** Tokenises PDF syntax. */
|
|
48
|
+
export declare class Lexer {
|
|
49
|
+
readonly data: Uint8Array;
|
|
50
|
+
position: number;
|
|
51
|
+
constructor(data: Uint8Array, position?: number);
|
|
52
|
+
private skipWhitespace;
|
|
53
|
+
/** Next token, or {@link EOF}. */
|
|
54
|
+
next(): Token | typeof EOF;
|
|
55
|
+
private word;
|
|
56
|
+
private name;
|
|
57
|
+
private literalString;
|
|
58
|
+
private hexString;
|
|
59
|
+
/** Moves past the end of line that follows the `stream` keyword. */
|
|
60
|
+
skipStreamEol(): void;
|
|
61
|
+
/** Whether `needle` is found at `position`. */
|
|
62
|
+
matchesAt(position: number, needle: string): boolean;
|
|
63
|
+
/** Position of the next occurrence of `needle` at or after `from`, or -1. */
|
|
64
|
+
indexOf(needle: string, from?: number): number;
|
|
65
|
+
}
|
|
66
|
+
/** Whether a token is a given operator or keyword. */
|
|
67
|
+
export declare const isOperator: (token: unknown, name?: string) => token is PdfOperator;
|
|
68
|
+
/** Builds objects from tokens; resolves `num gen R` with a two-token look-ahead. */
|
|
69
|
+
export declare class Parser {
|
|
70
|
+
readonly lexer: Lexer;
|
|
71
|
+
private readonly resolveLength;
|
|
72
|
+
private readonly buffer;
|
|
73
|
+
constructor(lexer: Lexer, resolveLength?: LengthResolver);
|
|
74
|
+
private shift;
|
|
75
|
+
private peek;
|
|
76
|
+
/** Next object or operator, or {@link EOF}. Streams are recognised only in file objects. */
|
|
77
|
+
next(): PdfObject | PdfOperator | typeof EOF;
|
|
78
|
+
/** Next value; operators and the end of data read as `null`. */
|
|
79
|
+
value(): PdfObject;
|
|
80
|
+
private array;
|
|
81
|
+
private dictOrStream;
|
|
82
|
+
private isStreamAhead;
|
|
83
|
+
private stream;
|
|
84
|
+
/** Whether `endstream` follows `end`, allowing for the end-of-line markers in between. */
|
|
85
|
+
private endsStreamAt;
|
|
86
|
+
}
|
|
87
|
+
/** Latin-1 text of a byte range, for keywords and header scans. */
|
|
88
|
+
export declare const bytesToLatin1: (data: Uint8Array, start?: number, end?: number) => string;
|
|
89
|
+
export {};
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Uploads an image and resolves with its public URL. Without a handler, images are embedded as data URLs. */
|
|
2
2
|
export type DocumentImageUploadHandler = (file: File) => Promise<string>;
|
|
3
|
-
export type DocumentMenuAction = 'source' | 'print' | 'exportHtml' | 'exportWord' | 'exportPdf' | 'importWord' | 'formattingMarks' | 'ruler' | 'outline' | 'tableOfContents' | 'comments' | 'addComment' | 'footnote' | 'trackChanges' | 'changes' | 'fullscreen';
|
|
3
|
+
export type DocumentMenuAction = 'source' | 'print' | 'exportHtml' | 'exportWord' | 'exportPdf' | 'importWord' | 'importPdf' | 'formattingMarks' | 'ruler' | 'outline' | 'tableOfContents' | 'comments' | 'addComment' | 'footnote' | 'trackChanges' | 'changes' | 'fullscreen';
|
|
4
4
|
/**
|
|
5
5
|
* Tools of the editor toolbar, in the order they appear. Pass a list of them as the `tools` prop to show only those;
|
|
6
6
|
* keyboard shortcuts, the `/` menu and the right-click menu keep working either way.
|
|
@@ -8,3 +8,8 @@ export type DocumentMenuAction = 'source' | 'print' | 'exportHtml' | 'exportWord
|
|
|
8
8
|
export declare const TOOLBAR_TOOLS: readonly ["history", "formatPainter", "blockStyle", "fontFamily", "fontSize", "marks", "textCase", "color", "highlight", "align", "lineHeight", "direction", "lists", "indent", "link", "image", "table", "specialCharacters", "variables", "signature", "insert", "review", "search", "templates", "headerFooter", "pageSetup", "more"];
|
|
9
9
|
/** A tool of the editor toolbar; see {@link TOOLBAR_TOOLS}. */
|
|
10
10
|
export type ToolbarTool = (typeof TOOLBAR_TOOLS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Arrangement of the toolbar: `row` puts every tool in one row, `tabs` splits them into Home, Insert, Layout and
|
|
13
|
+
* Review tabs and shows the tools of one tab at a time.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolbarLayout = 'row' | 'tabs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/core/pdf-import/errors.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
reason;
|
|
4
|
+
constructor(e) {
|
|
5
|
+
super({
|
|
6
|
+
invalid: "The file is not a readable PDF document",
|
|
7
|
+
encrypted: "The PDF document is encrypted",
|
|
8
|
+
empty: "The PDF document has no readable content"
|
|
9
|
+
}[e]), this.reason = e, this.name = "PdfImportError";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=errors-tHVeiwWt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-tHVeiwWt.js","names":[],"sources":["../src/core/pdf-import/errors.ts"],"sourcesContent":["/**\n * The error of the PDF reader, kept apart from the reader so it can be exported and checked with `instanceof`\n * without loading the reader itself.\n */\n\n/** Why a PDF file could not be opened. */\nexport type PdfImportErrorReason = 'invalid' | 'encrypted' | 'empty';\n\n/** Thrown for PDF files this reader cannot open; the message names the reason. */\nexport class PdfImportError extends Error {\n constructor(readonly reason: PdfImportErrorReason) {\n super(\n {\n invalid: 'The file is not a readable PDF document',\n encrypted: 'The PDF document is encrypted',\n empty: 'The PDF document has no readable content'\n }[reason]\n );\n this.name = 'PdfImportError';\n }\n}\n"],"mappings":";AASA,IAAa,IAAb,cAAoC,MAAM;CACnB;CAArB,YAAY,GAAuC;EAQjD,AAPA,MACE;GACE,SAAS;GACT,WAAW;GACX,OAAO;EACT,EAAE,EACJ,GAPmB,KAAA,SAAA,GAQnB,KAAK,OAAO;CACd;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,19 +20,22 @@ export { readDocx } from './core/docx/import';
|
|
|
20
20
|
export type { DocumentEngine, TrackedChange } from './core/engine/engine';
|
|
21
21
|
export type { IconName } from './core/icons';
|
|
22
22
|
export type { EditorLocale, EditorLocaleCode, EditorLocaleInput } from './core/labels';
|
|
23
|
-
export { editorLocales, enLocale as en, ruLocale as ru, setEditorLocale,
|
|
23
|
+
export { editorLocales, enLocale as en, ruLocale as ru, setEditorLocale, uzLocale as uz } from './core/labels';
|
|
24
24
|
export type { NumberWordsLocale } from './core/numbers';
|
|
25
25
|
export { formatAmountInWords, numberToWords, parseAmount } from './core/numbers';
|
|
26
26
|
export type { OutlineHeading, TableOfContentsEntry, TableOfContentsOptions } from './core/outline';
|
|
27
27
|
export { buildTableOfContents, readOutline } from './core/outline';
|
|
28
28
|
export type { DocumentViewMode, PageHeaderFooter, PageMargins, PageOrientation, PageSettings, PageSizeKey, PageWatermark } from './core/page';
|
|
29
29
|
export { createHeaderFooter, createPageSettings, createWatermark } from './core/page';
|
|
30
|
+
export type { PdfImport, PdfImportErrorReason } from './core/pdf-import';
|
|
31
|
+
export { PdfImportError } from './core/pdf-import/errors';
|
|
32
|
+
export { readPdf } from './core/pdf-import/load';
|
|
30
33
|
export type { SlashCommand } from './core/slash-commands';
|
|
31
34
|
export type { FillTemplateOptions, TemplateValues, TemplateVariable } from './core/templates';
|
|
32
35
|
export { fillTemplate, getTemplateVariables } from './core/templates';
|
|
33
36
|
export type { TransliterationDirection } from './core/transliterate';
|
|
34
37
|
export { transliterate } from './core/transliterate';
|
|
35
|
-
export type { DocumentImageUploadHandler, ToolbarTool } from './core/types';
|
|
38
|
+
export type { DocumentImageUploadHandler, ToolbarLayout, ToolbarTool } from './core/types';
|
|
36
39
|
export { TOOLBAR_TOOLS } from './core/types';
|
|
37
40
|
export type { EditorUiState } from './core/ui-state';
|
|
38
41
|
export { default as Editor } from './editor.vue';
|