nuvra 0.4.1 → 0.6.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 (62) hide show
  1. package/README.md +241 -19
  2. package/dist/compare.vue.d.ts +19 -0
  3. package/dist/components/document-editor.vue.d.ts +59 -3
  4. package/dist/components/editor-canvas.vue.d.ts +9 -7
  5. package/dist/components/editor-changes.vue.d.ts +18 -0
  6. package/dist/components/editor-collaborators.vue.d.ts +17 -0
  7. package/dist/components/editor-comments.vue.d.ts +32 -0
  8. package/dist/components/editor-footnote-form.vue.d.ts +19 -0
  9. package/dist/components/editor-outline.vue.d.ts +36 -0
  10. package/dist/components/editor-slash-menu.vue.d.ts +13 -0
  11. package/dist/components/editor-toolbar.vue.d.ts +24 -1
  12. package/dist/core/collaboration.d.ts +25 -0
  13. package/dist/core/comments.d.ts +26 -0
  14. package/dist/core/dates.d.ts +8 -0
  15. package/dist/core/diff.d.ts +11 -0
  16. package/dist/core/document-templates.d.ts +22 -0
  17. package/dist/core/docx/export.d.ts +19 -0
  18. package/dist/core/docx/import.d.ts +19 -0
  19. package/dist/core/docx/zip.d.ts +23 -0
  20. package/dist/core/engine/dom.d.ts +40 -3
  21. package/dist/core/engine/editing.d.ts +11 -0
  22. package/dist/core/engine/engine.d.ts +161 -3
  23. package/dist/core/engine/input-rules.d.ts +3 -1
  24. package/dist/core/engine/marks.d.ts +50 -1
  25. package/dist/core/engine/schema.d.ts +9 -2
  26. package/dist/core/export.d.ts +13 -5
  27. package/dist/core/footnotes.d.ts +15 -0
  28. package/dist/core/icons.d.ts +1 -1
  29. package/dist/core/labels.d.ts +6 -2
  30. package/dist/core/locales/uz-cyrl.d.ts +3 -0
  31. package/dist/core/locales/uz.d.ts +72 -1
  32. package/dist/core/numbers.d.ts +19 -0
  33. package/dist/core/outline.d.ts +44 -0
  34. package/dist/core/page.d.ts +12 -2
  35. package/dist/core/pagination.d.ts +25 -3
  36. package/dist/core/pdf.d.ts +43 -0
  37. package/dist/core/signature.d.ts +15 -0
  38. package/dist/core/slash-commands.d.ts +19 -0
  39. package/dist/core/templates.d.ts +32 -0
  40. package/dist/core/transliterate.d.ts +13 -0
  41. package/dist/core/types.d.ts +1 -1
  42. package/dist/core/ui-state.d.ts +8 -0
  43. package/dist/editor.vue.d.ts +6 -2
  44. package/dist/export-B06RXLqn.js +96 -0
  45. package/dist/export-B06RXLqn.js.map +1 -0
  46. package/dist/footnotes-DBShImw7.js +11 -0
  47. package/dist/footnotes-DBShImw7.js.map +1 -0
  48. package/dist/form.vue.d.ts +39 -0
  49. package/dist/index.d.ts +28 -1
  50. package/dist/index.js +8391 -4198
  51. package/dist/index.js.map +1 -1
  52. package/dist/{page-DL7Oj2o8.js → page-DY5fdgcT.js} +10 -10
  53. package/dist/page-DY5fdgcT.js.map +1 -0
  54. package/dist/pdf-mIRjnoOP.js +70 -0
  55. package/dist/pdf-mIRjnoOP.js.map +1 -0
  56. package/dist/style.css +1 -1
  57. package/dist/zip-CpbwZtot.js +46 -0
  58. package/dist/zip-CpbwZtot.js.map +1 -0
  59. package/package.json +5 -2
  60. package/dist/export-VeTfgCEp.js +0 -117
  61. package/dist/export-VeTfgCEp.js.map +0 -1
  62. package/dist/page-DL7Oj2o8.js.map +0 -1
@@ -35,7 +35,49 @@ export declare const setHighlight: (root: HTMLElement, range: Range, color: stri
35
35
  export declare const setLink: (root: HTMLElement, range: Range, href: string, target: string | null) => boolean;
36
36
  /** Removes links from the selected text, keeping the text itself. */
37
37
  export declare const unsetLink: (root: HTMLElement, range: Range) => void;
38
- /** Removes every mark, span style, highlight and link from the selected text. */
38
+ /** Attribute holding the id of the comment a span of text is anchored to. */
39
+ export declare const COMMENT_ATTRIBUTE = "data-comment";
40
+ /** A valid comment id: letters, digits, `_` and `-`. */
41
+ export declare const COMMENT_ID: RegExp;
42
+ /** Selector of every comment anchor. */
43
+ export declare const COMMENT_SELECTOR = "span[data-comment]";
44
+ /**
45
+ * Anchors a comment to the selected text. Text that already belongs to another comment keeps it, so comments may
46
+ * overlap.
47
+ * @returns whether any text was selected.
48
+ */
49
+ export declare const addCommentAnchor: (root: HTMLElement, range: Range, id: string) => boolean;
50
+ /** Attribute holding the id of a tracked change; inserted and deleted text of one edit share it. */
51
+ export declare const CHANGE_ATTRIBUTE = "data-change";
52
+ /** A valid change id. */
53
+ export declare const CHANGE_ID: RegExp;
54
+ /** Selector of every tracked insertion and deletion. */
55
+ export declare const CHANGE_SELECTOR = "ins[data-change], del[data-change]";
56
+ /** Who made a tracked change and when, written on its `<ins>` or `<del>`. */
57
+ export interface ChangeMark {
58
+ /** Id shared by the parts of one edit. */
59
+ id: string;
60
+ /** Name of the author; may be empty. */
61
+ author: string;
62
+ /** When the change was made, as an ISO 8601 string. */
63
+ time: string;
64
+ }
65
+ /** Tracked deletion around `node`, if any. */
66
+ export declare const deletionAncestor: (node: Node, root: HTMLElement) => HTMLElement | null;
67
+ /** Marks the text and inline atoms of a range as inserted, unless they already are. */
68
+ export declare const markInserted: (root: HTMLElement, range: Range, mark: ChangeMark) => void;
69
+ /**
70
+ * Deletes a range the tracked way: text the same author inserted while tracking is removed for real, other text is
71
+ * marked as deleted and stays visible until the deletion is accepted.
72
+ * @returns whether anything was selected.
73
+ */
74
+ export declare const markDeleted: (root: HTMLElement, range: Range, mark: ChangeMark) => boolean;
75
+ /**
76
+ * Accepts or rejects tracked changes: accepting keeps inserted text and drops deleted text, rejecting does the
77
+ * opposite. Blocks left empty by removed text are kept, like Word keeps the paragraph.
78
+ */
79
+ export declare const resolveChanges: (elements: HTMLElement[], accept: boolean) => void;
80
+ /** Removes every mark, span style, highlight and link from the selected text; comment anchors and changes stay. */
39
81
  export declare const clearMarks: (root: HTMLElement, range: Range) => void;
40
82
  /** Letter case transformations offered by the toolbar. */
41
83
  export type TextCase = 'upper' | 'lower' | 'title' | 'sentence' | 'toggle';
@@ -46,6 +88,13 @@ export type TextCase = 'upper' | 'lower' | 'title' | 'sentence' | 'toggle';
46
88
  * @returns whether any text was selected.
47
89
  */
48
90
  export declare const applyTextCase: (root: HTMLElement, range: Range, mode: TextCase) => boolean;
91
+ /**
92
+ * Rewrites the selected text node by node, so every mark around it stays; each call also receives the character
93
+ * before the node in the same block, so rules that depend on word boundaries work across formatting.
94
+ *
95
+ * @returns whether any text was selected.
96
+ */
97
+ export declare const transformSelectedText: (root: HTMLElement, range: Range, transform: (text: string, previous: string) => string) => boolean;
49
98
  /** Which marks apply to `node`. */
50
99
  export declare const readMarks: (root: HTMLElement, node: Node) => Record<MarkName, boolean>;
51
100
  /** Value of a span style at `node`, or an empty string when none is set. */
@@ -1,3 +1,9 @@
1
+ /** A valid template variable name: letters, digits, `_`, `.` and `-`, as used in `{{name}}`. */
2
+ export declare const VARIABLE_NAME: RegExp;
3
+ /** Attribute holding the label a variable chip shows in the editor; editor-only. */
4
+ export declare const VARIABLE_LABEL_ATTRIBUTE = "data-label";
5
+ /** Attribute pagination writes on blocks of a section turned against the document's orientation; editor-only. */
6
+ export declare const ROTATED_ATTRIBUTE = "data-doc-rotated";
1
7
  /** Attribute pagination writes on blocks it moved to the next sheet; editor-only. */
2
8
  export declare const GAP_ATTRIBUTE = "data-doc-gap";
3
9
  /** Class marking table cells in a drag selection; editor-only. */
@@ -32,9 +38,10 @@ export declare const normalizeContainer: (container: ParentNode & Node, isRoot?:
32
38
  export declare const sanitizeHtml: (html: string) => DocumentFragment;
33
39
  /**
34
40
  * Removes editor-only markup (pagination gaps, cell selection). With `forExport` it also drops caret placeholders
35
- * and editing attributes, which history snapshots keep so the restored DOM is immediately editable.
41
+ * and editing attributes, which history snapshots keep so the restored DOM is immediately editable, and numbers the
42
+ * footnote references from `firstFootnote` (a sheet of a longer document continues the numbering).
36
43
  */
37
- export declare const cleanEditorArtifacts: (scope: Element | DocumentFragment, forExport: boolean) => void;
44
+ export declare const cleanEditorArtifacts: (scope: Element | DocumentFragment, forExport: boolean, firstFootnote?: number) => void;
38
45
  /** Clean HTML of the editor content, as stored in the model and exported. */
39
46
  export declare const serialize: (root: HTMLElement) => string;
40
47
  /** Whether the document is a single unformatted, empty paragraph. */
@@ -1,3 +1,4 @@
1
+ import { type SheetFootnote } from './footnotes';
1
2
  import { type PageSettings } from './page';
2
3
  /** Everything needed to print or export the document. */
3
4
  interface DocumentSnapshot {
@@ -8,11 +9,20 @@ interface DocumentSnapshot {
8
9
  * with real page numbers and breaks the pages exactly where the editor shows them.
9
10
  */
10
11
  pages?: string[];
12
+ /** For every sheet of `pages`, whether a section break turned it against the document's orientation. */
13
+ rotated?: boolean[];
14
+ /** Footnotes of every sheet of `pages`; without pages, the notes of all of them are printed after the document. */
15
+ footnotes?: SheetFootnote[][];
11
16
  /** Document title, used for the print title and file names. */
12
17
  title: string;
13
18
  /** Page size, orientation, margins and the running texts. */
14
19
  page: PageSettings;
15
20
  }
21
+ /** Paper width and height in millimetres, in the chosen orientation. */
22
+ export declare const paperSize: ({ size, orientation }: PageSettings) => {
23
+ width: number;
24
+ height: number;
25
+ };
16
26
  /** Turns a document title into a safe file name without extension. */
17
27
  export declare const toFileName: (title: string) => string;
18
28
  /**
@@ -21,11 +31,9 @@ export declare const toFileName: (title: string) => string;
21
31
  * the pages break where the editor shows them; without them the document flows and the browser repeats one fixed
22
32
  * header and footer on every page.
23
33
  */
24
- export declare const buildPrintableHtml: ({ html, pages, title, page }: DocumentSnapshot) => string;
25
- /** Word opens HTML saved with the Office namespaces as a regular document in print layout. */
26
- export declare const buildWordHtml: ({ html, title, page }: DocumentSnapshot) => string;
27
- /** Offers text content as a file download. */
28
- export declare const downloadFile: (content: string, fileName: string, type: string) => void;
34
+ export declare const buildPrintableHtml: ({ html, pages, rotated, footnotes, title, page }: DocumentSnapshot) => string;
35
+ /** Offers text or binary content as a file download. */
36
+ export declare const downloadFile: (content: string | Blob, fileName: string, type: string) => void;
29
37
  /** Prints through a detached iframe so the application chrome never ends up on paper. Waits for images first. */
30
38
  export declare const printHtml: (documentHtml: string) => void;
31
39
  export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The notes of footnotes as they are drawn at the bottom of a sheet. The editor, the layout measurement and printing
3
+ * all render them with this markup, so the space pagination reserves matches what is drawn.
4
+ */
5
+ /** A footnote as it appears at the bottom of a sheet. */
6
+ export interface SheetFootnote {
7
+ /** Number of the footnote in the document, starting at 1. */
8
+ number: number;
9
+ /** Text of the note. */
10
+ text: string;
11
+ }
12
+ /** Class of the notes block; its look is defined in `document-content.css`. */
13
+ export declare const FOOTNOTES_CLASS = "doc-footnotes";
14
+ /** HTML of the notes block of one sheet, or an empty string when the sheet has no footnotes. */
15
+ export declare const footnotesHtml: (notes: readonly SheetFootnote[]) => string;
@@ -3,7 +3,7 @@
3
3
  * from Lucide 1.44.0 (https://lucide.dev, ISC license, see LICENSE); the data is generated, not edited by hand.
4
4
  */
5
5
  /** Name of an icon in the editor's set. */
6
- export type IconName = 'a-arrow-down' | 'a-arrow-up' | 'between-horizontal-end' | 'between-horizontal-start' | 'between-vertical-end' | 'between-vertical-start' | 'bold' | 'calendar-days' | 'case-sensitive' | 'chevron-down' | 'chevron-right' | 'chevron-up' | 'clipboard' | 'code' | 'columns-2' | 'copy' | 'ellipsis' | 'external-link' | 'file-code' | 'file-down' | 'file-sliders' | 'file-text' | 'file-type' | 'grid-2x2-x' | 'grid-3x3' | 'highlighter' | 'image-plus' | 'italic' | 'languages' | 'link' | 'list' | 'list-indent-decrease' | 'list-indent-increase' | 'list-ordered' | 'list-todo' | 'loader-circle' | 'maximize-2' | 'minimize-2' | 'minus' | 'move-horizontal' | 'omega' | 'paintbrush' | 'panel-top' | 'panel-top-dashed' | 'pencil' | 'pilcrow' | 'pilcrow-left' | 'pilcrow-right' | 'plus' | 'printer' | 'quote' | 'rectangle-horizontal' | 'rectangle-vertical' | 'redo-2' | 'remove-formatting' | 'rows-2' | 'ruler' | 'scissors' | 'scroll-text' | 'search' | 'separator-horizontal' | 'square-code' | 'square-split-vertical' | 'strikethrough' | 'subscript' | 'superscript' | 'table-cells-merge' | 'table-cells-split' | 'text-align-center' | 'text-align-end' | 'text-align-justify' | 'text-align-start' | 'text-cursor-input' | 'trash' | 'underline' | 'undo-2' | 'unfold-vertical' | 'unlink' | 'upload' | 'whole-word' | 'x';
6
+ export type IconName = 'a-arrow-down' | 'a-arrow-up' | 'banknote' | 'between-horizontal-end' | 'between-horizontal-start' | 'between-vertical-end' | 'between-vertical-start' | 'bold' | 'braces' | 'calendar-days' | 'case-sensitive' | 'check' | 'chevron-down' | 'chevron-right' | 'chevron-up' | 'clipboard' | 'code' | 'columns-2' | 'copy' | 'ellipsis' | 'external-link' | 'file-code' | 'file-down' | 'file-sliders' | 'file-text' | 'file-type' | 'grid-2x2-x' | 'grid-3x3' | 'highlighter' | 'image-plus' | 'italic' | 'languages' | 'link' | 'list' | 'list-checks' | 'list-indent-decrease' | 'list-indent-increase' | 'list-ordered' | 'list-todo' | 'loader-circle' | 'maximize-2' | 'message-square' | 'message-square-plus' | 'minimize-2' | 'minus' | 'move-horizontal' | 'omega' | 'paintbrush' | 'panel-left' | 'panel-top' | 'panel-top-dashed' | 'pencil' | 'pilcrow' | 'pilcrow-left' | 'pilcrow-right' | 'plus' | 'printer' | 'quote' | 'rectangle-horizontal' | 'rectangle-vertical' | 'redo-2' | 'remove-formatting' | 'reply' | 'rows-2' | 'ruler' | 'scissors' | 'scroll-text' | 'search' | 'separator-horizontal' | 'signature' | 'square-code' | 'square-split-vertical' | 'strikethrough' | 'subscript' | 'superscript' | 'table-cells-merge' | 'table-cells-split' | 'table-of-contents' | 'text-align-center' | 'text-align-end' | 'text-align-justify' | 'text-align-start' | 'text-cursor-input' | 'trash' | 'underline' | 'undo-2' | 'unfold-vertical' | 'unlink' | 'upload' | 'whole-word' | 'x';
7
7
  /** One SVG element of an icon: its tag and attributes. */
8
8
  export type IconElement = readonly [tag: string, attributes: Readonly<Record<string, string | number>>];
9
9
  /** Elements of every icon, by name. */
@@ -1,7 +1,7 @@
1
1
  import { type EditorLabelKey } from './locales/uz';
2
2
  export type { EditorLabelKey };
3
- /** Languages the editor interface is available in. */
4
- export type EditorLocaleCode = 'uz' | 'en' | 'ru';
3
+ /** Languages the editor interface is available in: Uzbek in Latin and Cyrillic script, English and Russian. */
4
+ export type EditorLocaleCode = 'uz' | 'uz-Cyrl' | 'en' | 'ru';
5
5
  /**
6
6
  * A built-in interface language. Locales only select one of the translations shipped with the editor; the texts
7
7
  * themselves cannot be changed from outside.
@@ -16,6 +16,8 @@ export interface EditorLocale {
16
16
  export type EditorLocaleInput = EditorLocale | EditorLocaleCode;
17
17
  /** Uzbek (Latin) interface. */
18
18
  export declare const uzLocale: EditorLocale;
19
+ /** Uzbek (Cyrillic) interface. */
20
+ export declare const uzCyrlLocale: EditorLocale;
19
21
  /** English interface. */
20
22
  export declare const enLocale: EditorLocale;
21
23
  /** Russian interface. */
@@ -35,4 +37,6 @@ export declare const formatShortcut: (shortcut: string) => string;
35
37
  export declare const useEditorLabels: (locale?: () => EditorLocaleInput | undefined) => {
36
38
  t: (key: EditorLabelKey, named?: Record<string, unknown>) => string;
37
39
  withShortcut: (key: EditorLabelKey, shortcut: string) => string;
40
+ /** Code of the editor's language, e.g. for numbers and dates written into the document. */
41
+ locale: import("vue").ComputedRef<EditorLocaleCode>;
38
42
  };
@@ -0,0 +1,3 @@
1
+ import type { EditorLabelKey } from './uz';
2
+ /** Uzbek (Cyrillic) texts of the editor interface, generated by `scripts/generate-uz-cyrl.mjs`. */
3
+ export declare const uzCyrl: Readonly<Record<EditorLabelKey, string>>;
@@ -1,5 +1,6 @@
1
1
  /** Uzbek (Latin) texts of the editor interface; `{name}` marks a placeholder filled in at translation time. */
2
2
  export declare const uz: {
3
+ readonly 'editor.amountInWords': "Summani so‘z bilan yozish";
3
4
  readonly 'editor.align': "Tekislash";
4
5
  readonly 'editor.align.center': "Markazga";
5
6
  readonly 'editor.align.justify': "Ikki tomonga";
@@ -14,9 +15,32 @@ export declare const uz: {
14
15
  readonly 'editor.case.toggle': "rEGISTRNI ALMASHTIRISH";
15
16
  readonly 'editor.case.upper': "BOSH HARFLAR";
16
17
  readonly 'editor.changeCase': "Harf registri";
18
+ readonly 'editor.changes': "O‘zgarishlar";
19
+ readonly 'editor.changes.accept': "Qabul qilish";
20
+ readonly 'editor.changes.acceptAll': "Hammasini qabul qilish";
21
+ readonly 'editor.changes.deleted': "O‘chirildi";
22
+ readonly 'editor.changes.empty': "Kuzatilgan o‘zgarishlar yo‘q. Kuzatishni yoqing — yozilgan va o‘chirilgan matn shu yerda ko‘rinadi.";
23
+ readonly 'editor.changes.inserted': "Qo‘shildi";
24
+ readonly 'editor.changes.reject': "Rad etish";
25
+ readonly 'editor.changes.rejectAll': "Hammasini rad etish";
17
26
  readonly 'editor.clearFormatting': "Formatni tozalash";
18
27
  readonly 'editor.close': "Yopish";
19
28
  readonly 'editor.codeBlock': "Kod bloki";
29
+ readonly 'editor.comment.add': "Izoh qo‘shish";
30
+ readonly 'editor.comment.cancel': "Bekor qilish";
31
+ readonly 'editor.comment.detached': "Izoh qoldirilgan matn o‘chirilgan";
32
+ readonly 'editor.comment.placeholder': "Izoh yozing… (Ctrl+Enter — saqlash)";
33
+ readonly 'editor.comment.reopen': "Qayta ochish";
34
+ readonly 'editor.comment.reply': "Javob";
35
+ readonly 'editor.comment.replyPlaceholder': "Javob yozing…";
36
+ readonly 'editor.comment.resolve': "Hal qilindi";
37
+ readonly 'editor.comment.resolved': "Hal qilingan";
38
+ readonly 'editor.comment.save': "Saqlash";
39
+ readonly 'editor.comments': "Izohlar";
40
+ readonly 'editor.comments.empty': "Hali izohlar yo‘q. Matnni belgilab, izoh qo‘shing.";
41
+ readonly 'editor.compare.deletions': "O‘chirilgan so‘zlar: {count}";
42
+ readonly 'editor.compare.insertions': "Qo‘shilgan so‘zlar: {count}";
43
+ readonly 'editor.compare.same': "Versiyalar bir xil";
20
44
  readonly 'editor.colors.automatic': "Avtomatik";
21
45
  readonly 'editor.colors.custom': "Boshqa rang…";
22
46
  readonly 'editor.colors.none': "Rangsiz";
@@ -35,10 +59,13 @@ export declare const uz: {
35
59
  readonly 'editor.enterFullscreen': "To‘liq ekran";
36
60
  readonly 'editor.exitFullscreen': "To‘liq ekrandan chiqish";
37
61
  readonly 'editor.exportHtml': "HTML sifatida yuklab olish";
38
- readonly 'editor.exportWord': "Word (.doc) sifatida yuklab olish";
62
+ readonly 'editor.exportPdf': "PDF sifatida yuklab olish";
63
+ readonly 'editor.exportWord': "Word (.docx) sifatida yuklab olish";
39
64
  readonly 'editor.fitWidth': "Kenglikka moslash";
40
65
  readonly 'editor.fontFamily': "Shrift";
41
66
  readonly 'editor.fontSize': "Shrift o‘lchami";
67
+ readonly 'editor.footnote': "Snoska (sahifa osti izohi)";
68
+ readonly 'editor.footnote.placeholder': "Snoska matni… (Ctrl+Enter — saqlash)";
42
69
  readonly 'editor.footer': "Pastki kolontitul";
43
70
  readonly 'editor.formatPainter': "Format bo‘yoqchasi";
44
71
  readonly 'editor.formattingMarks': "Formatlash belgilari";
@@ -46,6 +73,8 @@ export declare const uz: {
46
73
  readonly 'editor.headerFooter': "Kolontitullar";
47
74
  readonly 'editor.headerFooter.center': "Markaz";
48
75
  readonly 'editor.headerFooter.clear': "Tozalash";
76
+ readonly 'editor.headerFooter.differentFirst': "Birinchi sahifada ko‘rsatilmasin";
77
+ readonly 'editor.headerFooter.firstNumber': "Raqamlash boshlanishi";
49
78
  readonly 'editor.headerFooter.hint': "Matn har bir sahifada takrorlanadi.";
50
79
  readonly 'editor.headerFooter.left': "Chap";
51
80
  readonly 'editor.headerFooter.right': "O‘ng";
@@ -63,11 +92,13 @@ export declare const uz: {
63
92
  readonly 'editor.imageSizeError': "Rasm hajmi {size} MB dan oshmasligi kerak";
64
93
  readonly 'editor.imageTypeError': "Faqat rasm fayllarini qo‘shish mumkin";
65
94
  readonly 'editor.imageUploadError': "Rasmni yuklab bo‘lmadi";
95
+ readonly 'editor.importWord': "Word faylini ochish (.docx)";
66
96
  readonly 'editor.increaseFontSize': "Shriftni kattalashtirish";
67
97
  readonly 'editor.indent': "Chekinishni oshirish";
68
98
  readonly 'editor.inlineCode': "Kod";
69
99
  readonly 'editor.insert': "Qo‘shish";
70
100
  readonly 'editor.insertDate': "Bugungi sana";
101
+ readonly 'editor.insertDateLong': "Bugungi sana (to‘liq)";
71
102
  readonly 'editor.insertMore': "Boshqa elementlar";
72
103
  readonly 'editor.italic': "Kursiv";
73
104
  readonly 'editor.lineHeight': "Qator oralig‘i";
@@ -77,6 +108,15 @@ export declare const uz: {
77
108
  readonly 'editor.linkUrl': "Manzil (URL)";
78
109
  readonly 'editor.more': "Yana";
79
110
  readonly 'editor.moreFormatting': "Boshqa formatlar";
111
+ readonly 'editor.numbering': "Raqamlash turi";
112
+ readonly 'editor.numbering.default': "Oddiy raqamlash (1, 2, 3)";
113
+ readonly 'editor.numbering.legal': "Ko‘p darajali raqamlash (1.1, 1.2)";
114
+ readonly 'editor.outline': "Navigatsiya paneli";
115
+ readonly 'editor.outline.empty': "Hujjatda sarlavhalar yo‘q. Sarlavha uslubini qo‘llang, ular shu yerda ko‘rinadi.";
116
+ readonly 'editor.outline.headings': "Sarlavhalar";
117
+ readonly 'editor.outline.noPages': "Sahifalar faqat sahifa ko‘rinishida chiqadi.";
118
+ readonly 'editor.outline.page': "{page}-sahifa";
119
+ readonly 'editor.outline.pages': "Sahifalar";
80
120
  readonly 'editor.openLink': "Havolani ochish";
81
121
  readonly 'editor.or': "yoki havola orqali";
82
122
  readonly 'editor.orderedList': "Raqamli ro‘yxat";
@@ -112,6 +152,7 @@ export declare const uz: {
112
152
  readonly 'editor.replace.one': "Almashtirish";
113
153
  readonly 'editor.replace.placeholder': "Almashtirish";
114
154
  readonly 'editor.replace.toggle': "Almashtirishni ko‘rsatish";
155
+ readonly 'editor.review': "Taqriz: izohlar va o‘zgarishlar";
115
156
  readonly 'editor.ruler': "Chizg‘ich";
116
157
  readonly 'editor.ruler.firstLine': "Birinchi qator chekinishi";
117
158
  readonly 'editor.ruler.indentLeft': "Chap chekinish";
@@ -125,6 +166,23 @@ export declare const uz: {
125
166
  readonly 'editor.search.title': "Qidirish va almashtirish";
126
167
  readonly 'editor.search.wholeWord': "Butun so‘z";
127
168
  readonly 'editor.selectAll': "Barchasini tanlash";
169
+ readonly 'editor.sectionBreak.landscape': "Bo‘lim uzilishi: albom sahifalar";
170
+ readonly 'editor.sectionBreak.portrait': "Bo‘lim uzilishi: kitob sahifalar";
171
+ readonly 'editor.signature': "Imzo bloki";
172
+ readonly 'editor.signature.agreed': "KELISHILDI grifi";
173
+ readonly 'editor.signature.approval': "TASDIQLAYMAN grifi";
174
+ readonly 'editor.signature.parties': "Tomonlarning imzolari";
175
+ readonly 'editor.signature.signer': "Imzo qatori";
176
+ readonly 'editor.signature.text.agreed': "KELISHILDI";
177
+ readonly 'editor.signature.text.approved': "TASDIQLAYMAN";
178
+ readonly 'editor.signature.text.contractor': "IJROCHI:";
179
+ readonly 'editor.signature.text.customer': "BUYURTMACHI:";
180
+ readonly 'editor.signature.text.date': "«___» ____________ 20__ y.";
181
+ readonly 'editor.signature.text.name': "F.I.Sh.";
182
+ readonly 'editor.signature.text.organization': "Tashkilot nomi";
183
+ readonly 'editor.signature.text.position': "Lavozim";
184
+ readonly 'editor.signature.text.seal': "M.O‘.";
185
+ readonly 'editor.slash.title': "Buyruqlar";
128
186
  readonly 'editor.source': "HTML kod";
129
187
  readonly 'editor.spacing.addAfter': "Keyin bo‘sh joy qo‘shish";
130
188
  readonly 'editor.spacing.addBefore': "Oldin bo‘sh joy qo‘shish";
@@ -151,15 +209,28 @@ export declare const uz: {
151
209
  readonly 'editor.table.splitCell': "Katakni ajratish";
152
210
  readonly 'editor.table.title': "Jadval";
153
211
  readonly 'editor.taskList': "Vazifalar ro‘yxati";
212
+ readonly 'editor.templates': "Hujjat shablonlari";
213
+ readonly 'editor.templates.act': "Dalolatnoma";
214
+ readonly 'editor.templates.application': "Ariza";
215
+ readonly 'editor.templates.certificate': "Ma’lumotnoma";
216
+ readonly 'editor.templates.letter': "Xizmat xati";
217
+ readonly 'editor.templates.order': "Buyruq";
154
218
  readonly 'editor.textColor': "Matn rangi";
155
219
  readonly 'editor.textDirection': "Matn yo‘nalishi";
156
220
  readonly 'editor.textStyle': "Matn uslubi";
221
+ readonly 'editor.toc': "Mundarija";
222
+ readonly 'editor.toc.empty': "Hujjatda sarlavhalar yo‘q";
223
+ readonly 'editor.toc.update': "Mundarijani yangilash";
157
224
  readonly 'editor.toolbar': "Muharrir asboblari";
225
+ readonly 'editor.track': "O‘zgarishlarni kuzatish";
226
+ readonly 'editor.transliterate.toCyrillic': "Kirill yozuviga o‘girish";
227
+ readonly 'editor.transliterate.toLatin': "Lotin yozuviga o‘girish";
158
228
  readonly 'editor.underline': "Tagiga chizilgan";
159
229
  readonly 'editor.undo': "Bekor qilish";
160
230
  readonly 'editor.unlink': "Havolani olib tashlash";
161
231
  readonly 'editor.uploadImage': "Kompyuterdan yuklash";
162
232
  readonly 'editor.uploading': "Rasm yuklanmoqda…";
233
+ readonly 'editor.variables': "O‘zgaruvchi qo‘shish";
163
234
  readonly 'editor.view.page': "Sahifa ko‘rinishi";
164
235
  readonly 'editor.view.web': "Veb ko‘rinish";
165
236
  readonly 'editor.zoom': "Masshtab";
@@ -0,0 +1,19 @@
1
+ /** Languages numbers can be written out in. */
2
+ export type NumberWordsLocale = 'uz' | 'uz-Cyrl' | 'ru' | 'en';
3
+ /**
4
+ * Writes a whole number out in words, for example `15 000 000` as `o‘n besh million`. Fractions are dropped; negative
5
+ * numbers get a minus word.
6
+ *
7
+ * @throws RangeError for values that are not finite or reach a quadrillion.
8
+ */
9
+ export declare const numberToWords: (value: number, locale?: NumberWordsLocale) => string;
10
+ /**
11
+ * An amount with its digits grouped and the whole part in words, as written in contracts and payment documents:
12
+ * `15 000 000 (o‘n besh million)`. Hundredths stay in digits: `1 250,50 (bir ming ikki yuz ellik)`.
13
+ */
14
+ export declare const formatAmountInWords: (value: number, locale?: NumberWordsLocale) => string;
15
+ /**
16
+ * Reads a typed amount such as `15 000 000`, `15000000`, `1 250,50` or `1,250.50`; `null` when the text is not an
17
+ * amount. A separator followed by exactly three digits groups thousands; one or two digits at the end are decimals.
18
+ */
19
+ export declare const parseAmount: (text: string) => number | null;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The outline of a document: its headings, the navigation panel built from them, and the table of contents. The table
3
+ * of contents is a borderless `<table data-type="toc">` of ordinary content, so it prints and exports to Word like any
4
+ * other table and can be refreshed after the headings or the page breaks change.
5
+ */
6
+ /** A heading of the document. */
7
+ export interface OutlineHeading {
8
+ /** Heading level, 1 to 6. */
9
+ level: number;
10
+ /** Heading text with collapsed whitespace. */
11
+ text: string;
12
+ /** The heading element in the editable document. */
13
+ element: HTMLElement;
14
+ }
15
+ /** What the navigation panel lists: the headings, or thumbnails of the pages. */
16
+ export type OutlineView = 'headings' | 'pages';
17
+ /** A line of the table of contents. */
18
+ export interface TableOfContentsEntry {
19
+ /** Heading level, 1 to 6; deeper levels are indented. */
20
+ level: number;
21
+ /** Heading text. */
22
+ text: string;
23
+ /** Page the heading starts on, or `null` when the document is not laid out in pages. */
24
+ page: number | null;
25
+ }
26
+ /** Options of {@link buildTableOfContents}. */
27
+ export interface TableOfContentsOptions {
28
+ /** Title written above the entries. */
29
+ title: string;
30
+ /** Text shown instead of the entries when the document has no headings. */
31
+ emptyText: string;
32
+ /** Width of the text column in pixels; the table spans it plus the page number column. */
33
+ width?: number;
34
+ }
35
+ /** Marks the table of contents among the tables of a document. */
36
+ export declare const TABLE_OF_CONTENTS_TYPE = "toc";
37
+ /** Selector of the table of contents. */
38
+ export declare const TABLE_OF_CONTENTS_SELECTOR = "table[data-type=\"toc\"]";
39
+ /** Deepest heading level the table of contents lists by default. */
40
+ export declare const TABLE_OF_CONTENTS_DEPTH = 3;
41
+ /** Headings written directly in the document, not inside tables, lists or quotes, in document order. */
42
+ export declare const readOutline: (root: HTMLElement, depth?: number) => OutlineHeading[];
43
+ /** HTML of a table of contents: the title, then one row per heading with its page number on the right. */
44
+ export declare const buildTableOfContents: (entries: TableOfContentsEntry[], options: TableOfContentsOptions) => string;
@@ -47,6 +47,10 @@ export interface PageSettings {
47
47
  footer?: PageHeaderFooter;
48
48
  /** Watermark drawn behind the text of every page; omitted while the document has none. */
49
49
  watermark?: PageWatermark;
50
+ /** Whether the first page shows no header, footer or page number, as on title pages and letterheads. */
51
+ differentFirstPage?: boolean;
52
+ /** Number printed on the first page; the following pages count on from it. Defaults to 1. */
53
+ firstPageNumber?: number;
50
54
  }
51
55
  /** Page geometry in CSS pixels, ready for layout. */
52
56
  export interface PageMetrics {
@@ -130,15 +134,21 @@ export declare const createPageSettings: () => PageSettings;
130
134
  export declare const createHeaderFooter: () => PageHeaderFooter;
131
135
  /** Whether a header or footer holds any text at all. */
132
136
  export declare const hasHeaderFooterText: (value: PageHeaderFooter | undefined) => boolean;
137
+ /** Largest first page number the page setup accepts. */
138
+ export declare const MAX_FIRST_PAGE_NUMBER = 9999;
139
+ /** Number printed on a sheet, counted from 1 for the first sheet. */
140
+ export declare const pageNumberOf: (page: PageSettings, sheet: number) => number;
141
+ /** Whether the header, footer and page number are drawn on a sheet, counted from 1 for the first sheet. */
142
+ export declare const showsRunningTexts: (page: PageSettings, sheet: number) => boolean;
133
143
  /** Tokens a header or footer text may contain, replaced when the text is drawn on a page. */
134
144
  export declare const HEADER_FOOTER_TOKENS: readonly ["page", "pages", "date", "title"];
135
145
  /** One of the tokens a header or footer text may contain. */
136
146
  export type HeaderFooterToken = (typeof HEADER_FOOTER_TOKENS)[number];
137
147
  /** Values the tokens of a header or footer are replaced with. */
138
148
  export interface HeaderFooterContext {
139
- /** Number of the page the text is drawn on. */
149
+ /** Number printed on the page the text is drawn on. */
140
150
  page: number;
141
- /** Number of pages in the document. */
151
+ /** Number of pages in the document, as Word counts them: every sheet, whatever number it prints. */
142
152
  pages: number;
143
153
  /** Document title. */
144
154
  title: string;
@@ -1,4 +1,18 @@
1
- import type { PageMetrics } from './page';
1
+ import { type SheetFootnote } from './footnotes';
2
+ import type { PageMetrics, PageOrientation } from './page';
3
+ /** Where a sheet is drawn and which way it is turned. */
4
+ export interface SheetGeometry {
5
+ /** Distance of the sheet from the top of the first sheet, in pixels. */
6
+ top: number;
7
+ /** Sheet width in pixels. */
8
+ width: number;
9
+ /** Sheet height in pixels. */
10
+ height: number;
11
+ /** Orientation of the sheet. */
12
+ orientation: PageOrientation;
13
+ /** Whether the sheet is turned against the document's own orientation, by a section break. */
14
+ rotated: boolean;
15
+ }
2
16
  /** Handle returned by {@link createPagination}. */
3
17
  export interface PaginationController {
4
18
  /** Sets the page geometry and re-runs the layout; pass `null` to switch pagination off (web view). */
@@ -12,15 +26,23 @@ export interface PaginationController {
12
26
  interface PaginationOptions {
13
27
  /** Receives the number of sheets whenever it changes. */
14
28
  onPageCount: (count: number) => void;
29
+ /** Receives the footnotes of every sheet whenever they change; the web view is one sheet holding all of them. */
30
+ onFootnotes?: (sheets: SheetFootnote[][]) => void;
31
+ /** Receives the position, size and orientation of every sheet whenever they change; empty in the web view. */
32
+ onSheets?: (sheets: SheetGeometry[]) => void;
15
33
  /** Whether an IME composition is in progress, during which blocks must not move. */
16
34
  isComposing: () => boolean;
17
35
  }
36
+ /** Sheets of a document without section breaks, all alike. */
37
+ export declare const uniformSheets: (metrics: PageMetrics, count: number) => SheetGeometry[];
38
+ /** Index of the sheet a vertical position falls on, counted from the top of the first sheet. */
39
+ export declare const sheetIndexAt: (sheets: readonly SheetGeometry[], offset: number) => number;
18
40
  /**
19
41
  * Splits the laid-out document into the clean HTML of every sheet, for printing and export. Pagination has already
20
42
  * moved every block onto its page, so a block belongs to the page its top falls on; blocks taller than a page stay
21
- * whole, exactly as they are shown on screen.
43
+ * whole, exactly as they are shown on screen. Footnote references keep their document-wide numbers.
22
44
  */
23
- export declare const splitIntoPages: (root: HTMLElement, metrics: PageMetrics, pageCount: number) => string[];
45
+ export declare const splitIntoPages: (root: HTMLElement, metrics: PageMetrics, pageCount: number, geometry?: readonly SheetGeometry[]) => string[];
24
46
  /**
25
47
  * Keeps the document laid out on sheets. Layout passes are batched to one per animation frame and re-run when the
26
48
  * document resizes, images or fonts load, or the host schedules one after an edit.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * PDF download without the print dialog and without dependencies. Every sheet of the printable document is drawn into
3
+ * a canvas through an SVG `foreignObject`, and the pictures are written into a PDF, one per page. The PDF looks like
4
+ * the printout, but its text cannot be selected or searched.
5
+ */
6
+ /** A rendered page: a JPEG picture of the sheet and the paper size it is printed on. */
7
+ export interface PdfPage {
8
+ /** JPEG data of the page picture. */
9
+ jpeg: Uint8Array;
10
+ /** Picture width in pixels. */
11
+ width: number;
12
+ /** Picture height in pixels. */
13
+ height: number;
14
+ /** Paper width in PDF points (1/72 inch). */
15
+ widthPt: number;
16
+ /** Paper height in PDF points. */
17
+ heightPt: number;
18
+ }
19
+ /** Options of {@link renderPdf}. */
20
+ export interface PdfOptions {
21
+ /** Pixels per CSS pixel of the page pictures; higher is sharper and larger. Defaults to 2. */
22
+ scale?: number;
23
+ /** JPEG quality between 0 and 1. Defaults to 0.92. */
24
+ quality?: number;
25
+ }
26
+ /** MIME type of PDF files. */
27
+ export declare const PDF_MIME = "application/pdf";
28
+ /**
29
+ * Writes JPEG pictures into a PDF document, one picture filling each page.
30
+ *
31
+ * @returns the PDF file content.
32
+ */
33
+ export declare const buildPdf: (pages: readonly PdfPage[]) => Uint8Array;
34
+ /**
35
+ * Turns the printable HTML of a paginated document (one `section.doc-sheet` per page) into a PDF.
36
+ *
37
+ * @param printableHtml Standalone HTML as built for printing from the page view.
38
+ * @param paper Paper width and height in millimetres, in the chosen orientation.
39
+ */
40
+ export declare const renderPdf: (printableHtml: string, paper: {
41
+ width: number;
42
+ height: number;
43
+ }, options?: PdfOptions) => Promise<Blob>;
@@ -0,0 +1,15 @@
1
+ import type { EditorLabelKey } from './labels';
2
+ /** Signature blocks offered by the toolbar. */
3
+ export type SignaturePreset = 'signer' | 'approval' | 'agreed' | 'parties';
4
+ /** Every preset, in the order the menu lists them. */
5
+ export declare const SIGNATURE_PRESETS: ReadonlyArray<{
6
+ value: SignaturePreset;
7
+ label: EditorLabelKey;
8
+ }>;
9
+ /**
10
+ * HTML of a signature block in the editor's language. Every text in it is ordinary editable content: the user replaces
11
+ * the position and name, or puts template variables there.
12
+ *
13
+ * @param t Translates the placeholder texts into the editor's language.
14
+ */
15
+ export declare const buildSignatureBlock: (preset: SignaturePreset, t: (key: EditorLabelKey) => string) => string;
@@ -0,0 +1,19 @@
1
+ import type { DocumentEngine } from './engine/engine';
2
+ import type { IconName } from './icons';
3
+ /** An entry of the `/` command menu, opened by typing `/` at the start of a line or after a space. */
4
+ export interface SlashCommand {
5
+ /** Unique id; also matched by the typed filter. */
6
+ id: string;
7
+ /** Name shown in the menu. */
8
+ label: string;
9
+ /** Icon from the editor's icon set. */
10
+ icon?: IconName;
11
+ /** More words the typed filter finds the command by, for example in other languages. */
12
+ keywords?: readonly string[];
13
+ /** Runs the command; the typed `/filter` has already been removed and the caret is where it was. */
14
+ run: (engine: DocumentEngine) => void;
15
+ }
16
+ /** The filter typed after `/` before the caret, or `null` when the text does not end with a trigger. */
17
+ export declare const readSlashQuery: (textBeforeCaret: string | null) => string | null;
18
+ /** Commands whose id, label or keywords contain the filter, those starting with it first. */
19
+ export declare const filterSlashCommands: (commands: readonly SlashCommand[], query: string) => SlashCommand[];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Template variables outside the editor. A saved document writes every variable as
3
+ * `<span data-variable="name">{{name}}</span>`, so a template can be filled in the browser, on a Node server or by a
4
+ * plain string replacement in any backend.
5
+ */
6
+ /** A variable the user can insert into a template. */
7
+ export interface TemplateVariable {
8
+ /** Name used in the saved HTML and in `{{name}}`: letters, digits, `_`, `.` and `-`. */
9
+ name: string;
10
+ /** Text the chip shows in the editor and the variable menu lists, for example `Full name`. */
11
+ label: string;
12
+ }
13
+ /** Values for the variables of a template, by name. */
14
+ export type TemplateValues = Readonly<Record<string, string | number | null | undefined>>;
15
+ /** How {@link fillTemplate} treats a variable without a value. */
16
+ export interface FillTemplateOptions {
17
+ /**
18
+ * `keep` (the default) leaves the variable in place, so the result is still a template; `empty` removes it; `name`
19
+ * writes `{{name}}` as plain text.
20
+ */
21
+ missing?: 'keep' | 'empty' | 'name';
22
+ }
23
+ /**
24
+ * Replaces the variables of a document saved by the editor with values. Values are escaped, so user input cannot
25
+ * inject markup; the formatting around a variable (bold, font, colour) applies to its value.
26
+ *
27
+ * @param html Document HTML as saved by the editor.
28
+ * @param values Values by variable name.
29
+ */
30
+ export declare const fillTemplate: (html: string, values: TemplateValues, options?: FillTemplateOptions) => string;
31
+ /** Names of the variables a saved document uses, each once, in document order. */
32
+ export declare const getTemplateVariables: (html: string) => string[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Conversion of Uzbek text between the Latin and the Cyrillic alphabet, following the official correspondence of the
3
+ * two alphabets. Placeholders such as `{count}` and `{{name}}` are left untouched.
4
+ */
5
+ /** Direction of a conversion. */
6
+ export type TransliterationDirection = 'toCyrillic' | 'toLatin';
7
+ /**
8
+ * Converts Uzbek text between the Latin and the Cyrillic alphabet. Letters of the other alphabet, digits, punctuation
9
+ * and placeholders stay as they are.
10
+ *
11
+ * @param previous The character before `text`, when `text` continues earlier text; it decides the spelling of `e`.
12
+ */
13
+ export declare const transliterate: (text: string, direction: TransliterationDirection, previous?: string) => string;
@@ -1,3 +1,3 @@
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' | 'formattingMarks' | 'ruler' | 'fullscreen';
3
+ export type DocumentMenuAction = 'source' | 'print' | 'exportHtml' | 'exportWord' | 'exportPdf' | 'importWord' | 'formattingMarks' | 'ruler' | 'outline' | 'tableOfContents' | 'comments' | 'addComment' | 'footnote' | 'trackChanges' | 'changes' | 'fullscreen';