nuvra 0.2.1 → 0.4.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.
@@ -23,6 +23,31 @@ export declare const setTextAlign: (root: HTMLElement, range: Range, align: Text
23
23
  export declare const setLineHeight: (root: HTMLElement, range: Range, lineHeight: string | null) => void;
24
24
  /** Sets the writing direction of the selected blocks; `auto` lets each paragraph follow its own text. */
25
25
  export declare const setTextDirection: (root: HTMLElement, range: Range, direction: TextDirection) => void;
26
+ /** Side of a paragraph that can keep extra space, as in the paragraph settings of office suites. */
27
+ export type SpacingSide = 'before' | 'after';
28
+ /** Space a block keeps on one side, in points; `0` when it uses the document default. */
29
+ export declare const paragraphSpacing: (block: HTMLElement, side: SpacingSide) => number;
30
+ /**
31
+ * Sets the space before or after the selected paragraphs, in points; `null` restores the document default. The gap
32
+ * pagination may have added is dropped, because it is written into the same margin and is recomputed anyway.
33
+ */
34
+ export declare const setParagraphSpacing: (root: HTMLElement, range: Range, side: SpacingSide, points: number | null) => void;
35
+ /** Paragraph indents in CSS pixels, the exact distances the ruler drags. */
36
+ export interface ParagraphIndents {
37
+ /** Distance the paragraph keeps from the left text edge. */
38
+ left: number;
39
+ /** Distance it keeps from the right text edge. */
40
+ right: number;
41
+ /** Extra distance of its first line; a negative value hangs the first line out to the left. */
42
+ firstLine: number;
43
+ }
44
+ /** Indents of a block; a block without them uses zero. */
45
+ export declare const paragraphIndents: (block: HTMLElement) => ParagraphIndents;
46
+ /**
47
+ * Sets exact indents on the selected paragraphs; a side left out of `patch` keeps its value. Exact indents replace
48
+ * the stepped indentation of the toolbar buttons, so the step attribute is dropped with them.
49
+ */
50
+ export declare const setParagraphIndents: (root: HTMLElement, range: Range, patch: Partial<ParagraphIndents>) => void;
26
51
  /**
27
52
  * Moves the selected paragraphs outside lists by whole indentation steps.
28
53
  * @returns whether any block's indentation changed.
@@ -17,6 +17,11 @@ export declare const singleUrl: (content: TransferContent) => string | null;
17
17
  export declare const textToFragment: (text: string) => DocumentFragment;
18
18
  /** Converts a payload into editor blocks, preferring sanitised HTML over plain text; `null` when it has neither. */
19
19
  export declare const transferToFragment: (content: TransferContent) => DocumentFragment | null;
20
+ /** Clean HTML and plain text of a selection, as put on the clipboard by copy, cut and drag. */
21
+ export declare const selectionClipboardData: (root: HTMLElement, range: Range) => {
22
+ html: string;
23
+ text: string;
24
+ };
20
25
  /** Puts clean HTML and plain text of the selection on a clipboard or drag payload for copy, cut and drag. */
21
26
  export declare const writeTransfer: (data: DataTransfer, root: HTMLElement, range: Range) => void;
22
27
  /** Collapsed range at the text position under the pointer, used to place dropped content and canvas clicks. */
@@ -1,8 +1,8 @@
1
1
  import { type EditorUiState } from '../ui-state';
2
- import { type HeadingTag, type TextAlign, type TextDirection } from './blocks';
2
+ import { type HeadingTag, type ParagraphIndents, type SpacingSide, type TextAlign, type TextDirection } from './blocks';
3
3
  import { EditorHistory } from './history';
4
4
  import { type ListKind } from './lists';
5
- import { type MarkName, type StyleName } from './marks';
5
+ import { type MarkName, type StyleName, type TextCase } from './marks';
6
6
  import { SearchController, type SearchState } from './search';
7
7
  import { type TableCell } from './tables';
8
8
  /** Settings the host component passes when it creates the engine. */
@@ -46,6 +46,23 @@ interface ImageAttributes {
46
46
  /** Rendered height in CSS pixels. */
47
47
  height?: number | null;
48
48
  }
49
+ /** Character and paragraph formatting picked up by the format painter. */
50
+ export interface CopiedFormat {
51
+ /** Marks that were active on the copied text. */
52
+ marks: Partial<Record<MarkName, boolean>>;
53
+ /** Span styles of the copied text; empty values mean the document default. */
54
+ styles: Partial<Record<StyleName, string>>;
55
+ /** Highlight colour of the copied text, empty when it was not highlighted. */
56
+ highlight: string;
57
+ /** Tag of the copied block, so headings are painted as headings. */
58
+ tag: 'P' | HeadingTag;
59
+ /** Alignment of the copied paragraph. */
60
+ align: TextAlign;
61
+ /** Line spacing of the copied paragraph, empty for the default. */
62
+ lineHeight: string;
63
+ /** Indentation steps of the copied paragraph. */
64
+ indent: number;
65
+ }
49
66
  /** Callback registered with {@link DocumentEngine.on}. */
50
67
  type Listener<T> = (payload: T) => void;
51
68
  /**
@@ -81,6 +98,8 @@ export declare class DocumentEngine {
81
98
  private dragRange;
82
99
  /** Image selected by a click, shown with resize handles. */
83
100
  private selectedImageElement;
101
+ /** Formatting the format painter carries until it is painted onto a selection. */
102
+ private painterFormat;
84
103
  /**
85
104
  * Takes over `root` as the editable document, loads the initial content and starts listening to its events.
86
105
  *
@@ -140,6 +159,14 @@ export declare class DocumentEngine {
140
159
  * @param position Place the caret at the start or end; without it the last selection is restored.
141
160
  */
142
161
  focus(position?: 'start' | 'end'): void;
162
+ /** Selects the whole document, as Ctrl/⌘+A does. */
163
+ selectAll(): void;
164
+ /** Copies the selection to the system clipboard as clean HTML and plain text. */
165
+ copySelection(): Promise<void>;
166
+ /** Copies the selection and removes it as one undo step. */
167
+ cutSelection(): Promise<void>;
168
+ /** Inserts the clipboard content at the selection; the browser asks for clipboard permission the first time. */
169
+ pasteFromClipboard(): Promise<void>;
143
170
  /** Marks the next selection changes as caused by the engine, so they keep pending formatting and typing groups. */
144
171
  private expectInternalSelection;
145
172
  /** Live selection inside the document, or a copy of the last one while focus is elsewhere (e.g. in a popover). */
@@ -248,6 +275,19 @@ export declare class DocumentEngine {
248
275
  setHighlight(color: string | null): void;
249
276
  /** Merges a formatting change into the pending format and keeps focus in the document. */
250
277
  private setPending;
278
+ /** Changes the letter case of the selected text. */
279
+ changeTextCase(mode: TextCase): void;
280
+ /** Stores the format the painter carries and shows the painting cursor while it does. */
281
+ private setPainterFormat;
282
+ /**
283
+ * Picks up the character and paragraph formatting at the selection. The next selection made with the mouse, or a
284
+ * click inside a paragraph, receives it; {@link cancelFormatPainter} and Escape drop it again.
285
+ */
286
+ copyFormat(): void;
287
+ /** Drops the copied format without painting it. */
288
+ cancelFormatPainter(): void;
289
+ /** Paints the copied format onto the selection, or onto the whole paragraph at a collapsed caret. */
290
+ paintFormat(): void;
251
291
  /** Removes marks from the selection and turns its blocks into plain paragraphs outside lists and quotes. */
252
292
  clearFormatting(): void;
253
293
  /** Turns the selected blocks into paragraphs or headings. */
@@ -260,6 +300,10 @@ export declare class DocumentEngine {
260
300
  setTextAlign(align: TextAlign): void;
261
301
  /** Sets or removes (`null`) the line spacing of the selected paragraphs. */
262
302
  setLineHeight(lineHeight: string | null): void;
303
+ /** Sets exact indents on the selected paragraphs, in pixels; sides left out keep their value. */
304
+ setParagraphIndents(patch: Partial<ParagraphIndents>): void;
305
+ /** Sets the space before or after the selected paragraphs, in points; `null` restores the document default. */
306
+ setParagraphSpacing(side: SpacingSide, points: number | null): void;
263
307
  /** Sets the writing direction of the selected paragraphs. */
264
308
  setTextDirection(direction: TextDirection): void;
265
309
  /** Turns the selected blocks into a list of the given kind, converts another list kind, or lifts them out. */
@@ -37,6 +37,15 @@ export declare const setLink: (root: HTMLElement, range: Range, href: string, ta
37
37
  export declare const unsetLink: (root: HTMLElement, range: Range) => void;
38
38
  /** Removes every mark, span style, highlight and link from the selected text. */
39
39
  export declare const clearMarks: (root: HTMLElement, range: Range) => void;
40
+ /** Letter case transformations offered by the toolbar. */
41
+ export type TextCase = 'upper' | 'lower' | 'title' | 'sentence' | 'toggle';
42
+ /**
43
+ * Changes the letter case of the selected text. The selection is transformed as one string, so sentence and title
44
+ * case also work across formatting boundaries.
45
+ *
46
+ * @returns whether any text was selected.
47
+ */
48
+ export declare const applyTextCase: (root: HTMLElement, range: Range, mode: TextCase) => boolean;
40
49
  /** Which marks apply to `node`. */
41
50
  export declare const readMarks: (root: HTMLElement, node: Node) => Record<MarkName, boolean>;
42
51
  /** Value of a span style at `node`, or an empty string when none is set. */
@@ -2,6 +2,10 @@
2
2
  export declare const GAP_ATTRIBUTE = "data-doc-gap";
3
3
  /** Class marking table cells in a drag selection; editor-only. */
4
4
  export declare const SELECTED_CELL_CLASS = "doc-cell-selected";
5
+ /** Attribute holding the space a paragraph keeps before it, in points. */
6
+ export declare const SPACE_BEFORE_ATTRIBUTE = "data-space-before";
7
+ /** Attribute holding the space a paragraph keeps after it, in points. */
8
+ export declare const SPACE_AFTER_ATTRIBUTE = "data-space-after";
5
9
  /** Whether the node is a block in the editor model. */
6
10
  export declare const isBlockNode: (node: Node | null | undefined) => node is HTMLElement;
7
11
  /** Sets a paragraph's indentation level as `data-indent` plus the matching left margin, removing both at level 0. */
@@ -1,17 +1,27 @@
1
1
  import { type PageSettings } from './page';
2
2
  /** Everything needed to print or export the document. */
3
3
  interface DocumentSnapshot {
4
- /** Clean document HTML. */
4
+ /** Clean document HTML, used when the document is not laid out in sheets. */
5
5
  html: string;
6
+ /**
7
+ * Clean HTML of every sheet, in document order. The page view passes it so printing repeats the header and footer
8
+ * with real page numbers and breaks the pages exactly where the editor shows them.
9
+ */
10
+ pages?: string[];
6
11
  /** Document title, used for the print title and file names. */
7
12
  title: string;
8
- /** Page size, orientation and margins. */
13
+ /** Page size, orientation, margins and the running texts. */
9
14
  page: PageSettings;
10
15
  }
11
16
  /** Turns a document title into a safe file name without extension. */
12
17
  export declare const toFileName: (title: string) => string;
13
- /** Standalone HTML with the page size and margins encoded as `@page`, used for printing and HTML export. */
14
- export declare const buildPrintableHtml: ({ html, title, page }: DocumentSnapshot) => string;
18
+ /**
19
+ * Standalone HTML with the page size, margins and running texts encoded in CSS, used for printing and HTML export.
20
+ * With the sheets of the page view every page carries its own header and footer, so the page numbers are exact and
21
+ * the pages break where the editor shows them; without them the document flows and the browser repeats one fixed
22
+ * header and footer on every page.
23
+ */
24
+ export declare const buildPrintableHtml: ({ html, pages, title, page }: DocumentSnapshot) => string;
15
25
  /** Word opens HTML saved with the Office namespaces as a regular document in print layout. */
16
26
  export declare const buildWordHtml: ({ html, title, page }: DocumentSnapshot) => string;
17
27
  /** Offers text content as a file download. */
@@ -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 = 'between-horizontal-end' | 'between-horizontal-start' | 'between-vertical-end' | 'between-vertical-start' | 'bold' | 'calendar-days' | 'case-sensitive' | 'chevron-down' | 'chevron-right' | 'chevron-up' | 'code' | 'columns-2' | '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' | 'panel-top' | 'pencil' | 'pilcrow-left' | 'pilcrow-right' | 'plus' | 'printer' | 'quote' | 'rectangle-horizontal' | 'rectangle-vertical' | 'redo-2' | 'remove-formatting' | 'rows-2' | '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' | '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';
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,150 +1,38 @@
1
- /** Built-in Uzbek texts, used for every key the registered translator does not translate. */
2
- declare const MESSAGES: {
3
- readonly 'editor.align': "Tekislash";
4
- readonly 'editor.align.center': "Markazga";
5
- readonly 'editor.align.justify': "Ikki tomonga";
6
- readonly 'editor.align.left': "Chapga";
7
- readonly 'editor.align.right': "O‘ngga";
8
- readonly 'editor.apply': "Qo‘llash";
9
- readonly 'editor.bold': "Qalin";
10
- readonly 'editor.bulletList': "Belgili ro‘yxat";
11
- readonly 'editor.clearFormatting': "Formatni tozalash";
12
- readonly 'editor.close': "Yopish";
13
- readonly 'editor.codeBlock': "Kod bloki";
14
- readonly 'editor.colors.automatic': "Avtomatik";
15
- readonly 'editor.colors.custom': "Boshqa rang…";
16
- readonly 'editor.colors.none': "Rangsiz";
17
- readonly 'editor.defaultFont': "Standart shrift";
18
- readonly 'editor.defaultLineHeight': "Standart";
19
- readonly 'editor.defaultSize': "Standart o‘lcham";
20
- readonly 'editor.delete': "O‘chirish";
21
- readonly 'editor.direction.auto': "Avtomatik yo‘nalish";
22
- readonly 'editor.direction.ltr': "Chapdan o‘ngga";
23
- readonly 'editor.direction.rtl': "O‘ngdan chapga";
24
- readonly 'editor.document': "Hujjat";
25
- readonly 'editor.editLink': "Havolani tahrirlash";
26
- readonly 'editor.enterFullscreen': "To‘liq ekran";
27
- readonly 'editor.exitFullscreen': "To‘liq ekrandan chiqish";
28
- readonly 'editor.exportHtml': "HTML sifatida yuklab olish";
29
- readonly 'editor.exportWord': "Word (.doc) sifatida yuklab olish";
30
- readonly 'editor.fitWidth': "Kenglikka moslash";
31
- readonly 'editor.fontFamily': "Shrift";
32
- readonly 'editor.fontSize': "Shrift o‘lchami";
33
- readonly 'editor.heading': "Sarlavha {level}";
34
- readonly 'editor.highlight': "Belgilash rangi";
35
- readonly 'editor.horizontalRule': "Gorizontal chiziq";
36
- readonly 'editor.image': "Rasm";
37
- readonly 'editor.imageAlt': "Muqobil matn (alt)";
38
- readonly 'editor.imageReadError': "Rasmni o‘qib bo‘lmadi";
39
- readonly 'editor.imageSizeError': "Rasm hajmi {size} MB dan oshmasligi kerak";
40
- readonly 'editor.imageTypeError': "Faqat rasm fayllarini qo‘shish mumkin";
41
- readonly 'editor.imageUploadError': "Rasmni yuklab bo‘lmadi";
42
- readonly 'editor.indent': "Chekinishni oshirish";
43
- readonly 'editor.inlineCode': "Kod";
44
- readonly 'editor.insert': "Qo‘shish";
45
- readonly 'editor.insertDate': "Bugungi sana";
46
- readonly 'editor.insertMore': "Boshqa elementlar";
47
- readonly 'editor.italic': "Kursiv";
48
- readonly 'editor.lineHeight': "Qator oralig‘i";
49
- readonly 'editor.link': "Havola";
50
- readonly 'editor.linkNewTab': "Yangi oynada ochish";
51
- readonly 'editor.linkText': "Matn";
52
- readonly 'editor.linkUrl': "Manzil (URL)";
53
- readonly 'editor.more': "Yana";
54
- readonly 'editor.moreFormatting': "Boshqa formatlar";
55
- readonly 'editor.or': "yoki havola orqali";
56
- readonly 'editor.orderedList': "Raqamli ro‘yxat";
57
- readonly 'editor.outdent': "Chekinishni kamaytirish";
58
- readonly 'editor.page.customMargins': "Aniq qiymatlar (mm)";
59
- readonly 'editor.page.landscape': "Albom";
60
- readonly 'editor.page.marginBottom': "Pastki";
61
- readonly 'editor.page.marginLeft': "Chap";
62
- readonly 'editor.page.marginRight': "O‘ng";
63
- readonly 'editor.page.marginTop': "Yuqori";
64
- readonly 'editor.page.margins': "Hoshiyalar";
65
- readonly 'editor.page.margins.moderate': "O‘rtacha";
66
- readonly 'editor.page.margins.narrow': "Tor";
67
- readonly 'editor.page.margins.normal': "Oddiy";
68
- readonly 'editor.page.margins.official': "Rasmiy hujjat";
69
- readonly 'editor.page.margins.wide': "Keng";
70
- readonly 'editor.page.orientation': "Yo‘nalish";
71
- readonly 'editor.page.portrait': "Kitob";
72
- readonly 'editor.page.setup': "Sahifa sozlamalari";
73
- readonly 'editor.page.size': "Qog‘oz o‘lchami";
74
- readonly 'editor.pageBreak': "Sahifa uzilishi";
75
- readonly 'editor.paragraph': "Oddiy matn";
76
- readonly 'editor.placeholder': "Hujjat matnini kiriting…";
77
- readonly 'editor.print': "Chop etish / PDF";
78
- readonly 'editor.quote': "Iqtibos";
79
- readonly 'editor.redo': "Qaytarish";
80
- readonly 'editor.replace.all': "Barchasini";
81
- readonly 'editor.replace.one': "Almashtirish";
82
- readonly 'editor.replace.placeholder': "Almashtirish";
83
- readonly 'editor.replace.toggle': "Almashtirishni ko‘rsatish";
84
- readonly 'editor.search.caseSensitive': "Katta-kichik harfni farqlash";
85
- readonly 'editor.search.next': "Keyingisi";
86
- readonly 'editor.search.placeholder': "Qidirish";
87
- readonly 'editor.search.previous': "Oldingisi";
88
- readonly 'editor.search.title': "Qidirish va almashtirish";
89
- readonly 'editor.search.wholeWord': "Butun so‘z";
90
- readonly 'editor.source': "HTML kod";
91
- readonly 'editor.specialCharacters': "Maxsus belgilar";
92
- readonly 'editor.status.characters': "{count} belgi";
93
- readonly 'editor.status.page': "Sahifa {current} / {total}";
94
- readonly 'editor.status.words': "{count} so‘z";
95
- readonly 'editor.strike': "Ustidan chizilgan";
96
- readonly 'editor.subscript': "Pastki indeks";
97
- readonly 'editor.superscript': "Yuqori indeks";
98
- readonly 'editor.table.addColumnAfter': "O‘ngga ustun qo‘shish";
99
- readonly 'editor.table.addColumnBefore': "Chapga ustun qo‘shish";
100
- readonly 'editor.table.addRowAfter': "Pastga qator qo‘shish";
101
- readonly 'editor.table.addRowBefore': "Yuqoriga qator qo‘shish";
102
- readonly 'editor.table.delete': "Jadvalni o‘chirish";
103
- readonly 'editor.table.deleteColumn': "Ustunni o‘chirish";
104
- readonly 'editor.table.deleteRow': "Qatorni o‘chirish";
105
- readonly 'editor.table.headerRow': "Sarlavha qatori";
106
- readonly 'editor.table.insert': "Jadval qo‘shish";
107
- readonly 'editor.table.mergeCells': "Kataklarni birlashtirish";
108
- readonly 'editor.table.pickSize': "O‘lchamni tanlang";
109
- readonly 'editor.table.splitCell': "Katakni ajratish";
110
- readonly 'editor.table.title': "Jadval";
111
- readonly 'editor.taskList': "Vazifalar ro‘yxati";
112
- readonly 'editor.textColor': "Matn rangi";
113
- readonly 'editor.textDirection': "Matn yo‘nalishi";
114
- readonly 'editor.textStyle': "Matn uslubi";
115
- readonly 'editor.toolbar': "Muharrir asboblari";
116
- readonly 'editor.underline': "Tagiga chizilgan";
117
- readonly 'editor.undo': "Bekor qilish";
118
- readonly 'editor.unlink': "Havolani olib tashlash";
119
- readonly 'editor.uploadImage': "Kompyuterdan yuklash";
120
- readonly 'editor.uploading': "Rasm yuklanmoqda…";
121
- readonly 'editor.view.page': "Sahifa ko‘rinishi";
122
- readonly 'editor.view.web': "Veb ko‘rinish";
123
- readonly 'editor.zoom': "Masshtab";
124
- readonly 'editor.zoomIn': "Kattalashtirish";
125
- readonly 'editor.zoomOut': "Kichraytirish";
126
- readonly 'editor.zoomReset': "100% ga qaytarish";
127
- };
128
- /** Every label key the editor uses. */
129
- export type EditorLabelKey = keyof typeof MESSAGES;
130
- /** Built-in label texts by key; `{name}` marks a placeholder filled in at translation time. */
131
- export declare const editorMessages: Readonly<Record<EditorLabelKey, string>>;
1
+ import { type EditorLabelKey } from './locales/uz';
2
+ export type { EditorLabelKey };
3
+ /** Languages the editor interface is available in. */
4
+ export type EditorLocaleCode = 'uz' | 'en' | 'ru';
132
5
  /**
133
- * Translates an editor label into the app's language; returning `undefined` keeps the built-in text.
134
- *
135
- * @param named Values for `{name}` placeholders in the message.
6
+ * A built-in interface language. Locales only select one of the translations shipped with the editor; the texts
7
+ * themselves cannot be changed from outside.
136
8
  */
137
- export type EditorTranslator = (key: EditorLabelKey, named?: Record<string, unknown>) => string | undefined;
138
- /** Registers the translator used for every editor label; calling it without arguments restores the built-in texts. */
139
- export declare const setEditorTranslator: (next?: EditorTranslator) => void;
9
+ export interface EditorLocale {
10
+ /** Language code. */
11
+ readonly code: EditorLocaleCode;
12
+ /** Name of the language in that language, for language pickers. */
13
+ readonly name: string;
14
+ }
15
+ /** A locale object, or just its code. */
16
+ export type EditorLocaleInput = EditorLocale | EditorLocaleCode;
17
+ /** Uzbek (Latin) interface. */
18
+ export declare const uzLocale: EditorLocale;
19
+ /** English interface. */
20
+ export declare const enLocale: EditorLocale;
21
+ /** Russian interface. */
22
+ export declare const ruLocale: EditorLocale;
23
+ /** Every built-in locale, in the order they are offered. */
24
+ export declare const editorLocales: ReadonlyArray<EditorLocale>;
25
+ /** Sets the interface language of every editor that does not choose its own with the `locale` prop. */
26
+ export declare const setEditorLocale: (locale: EditorLocaleInput) => void;
27
+ /** Formats a shortcut written as `Mod+Shift+K` for the current platform (`Ctrl+Shift+K` or `⌘⇧K`). */
28
+ export declare const formatShortcut: (shortcut: string) => string;
140
29
  /**
141
- * Translates an editor label, falling back to the built-in Uzbek text while the key has no translation.
30
+ * Label helpers in the editor's language. The root editor passes its `locale` prop and shares the result with its
31
+ * children; child components call it without arguments. Must be called during component setup.
142
32
  *
143
- * @param named Values for `{name}` placeholders in the message.
33
+ * @param locale Getter for the language chosen by this component; `undefined` inherits it.
144
34
  */
145
- export declare const t: (key: EditorLabelKey, named?: Record<string, unknown>) => string;
146
- /** Formats a shortcut written as `Mod+Shift+K` for the current platform (`Ctrl+Shift+K` or `⌘⇧K`). */
147
- export declare const formatShortcut: (shortcut: string) => string;
148
- /** Label followed by its keyboard shortcut in parentheses, for button tooltips. */
149
- export declare const withShortcut: (key: EditorLabelKey, shortcut: string) => string;
150
- export {};
35
+ export declare const useEditorLabels: (locale?: () => EditorLocaleInput | undefined) => {
36
+ t: (key: EditorLabelKey, named?: Record<string, unknown>) => string;
37
+ withShortcut: (key: EditorLabelKey, shortcut: string) => string;
38
+ };
@@ -0,0 +1,3 @@
1
+ import type { EditorLabelKey } from './uz';
2
+ /** English texts of the editor interface. */
3
+ export declare const en: Readonly<Record<EditorLabelKey, string>>;
@@ -0,0 +1,3 @@
1
+ import type { EditorLabelKey } from './uz';
2
+ /** Russian texts of the editor interface. */
3
+ export declare const ru: Readonly<Record<EditorLabelKey, string>>;
@@ -0,0 +1,171 @@
1
+ /** Uzbek (Latin) texts of the editor interface; `{name}` marks a placeholder filled in at translation time. */
2
+ export declare const uz: {
3
+ readonly 'editor.align': "Tekislash";
4
+ readonly 'editor.align.center': "Markazga";
5
+ readonly 'editor.align.justify': "Ikki tomonga";
6
+ readonly 'editor.align.left': "Chapga";
7
+ readonly 'editor.align.right': "O‘ngga";
8
+ readonly 'editor.apply': "Qo‘llash";
9
+ readonly 'editor.bold': "Qalin";
10
+ readonly 'editor.bulletList': "Belgili ro‘yxat";
11
+ readonly 'editor.case.lower': "kichik harflar";
12
+ readonly 'editor.case.sentence': "Gap boshi bosh harf";
13
+ readonly 'editor.case.title': "Har So‘z Bosh Harf";
14
+ readonly 'editor.case.toggle': "rEGISTRNI ALMASHTIRISH";
15
+ readonly 'editor.case.upper': "BOSH HARFLAR";
16
+ readonly 'editor.changeCase': "Harf registri";
17
+ readonly 'editor.clearFormatting': "Formatni tozalash";
18
+ readonly 'editor.close': "Yopish";
19
+ readonly 'editor.codeBlock': "Kod bloki";
20
+ readonly 'editor.colors.automatic': "Avtomatik";
21
+ readonly 'editor.colors.custom': "Boshqa rang…";
22
+ readonly 'editor.colors.none': "Rangsiz";
23
+ readonly 'editor.copy': "Nusxalash";
24
+ readonly 'editor.cut': "Kesish";
25
+ readonly 'editor.defaultFont': "Standart shrift";
26
+ readonly 'editor.defaultLineHeight': "Standart";
27
+ readonly 'editor.decreaseFontSize': "Shriftni kichraytirish";
28
+ readonly 'editor.defaultSize': "Standart o‘lcham";
29
+ readonly 'editor.delete': "O‘chirish";
30
+ readonly 'editor.direction.auto': "Avtomatik yo‘nalish";
31
+ readonly 'editor.direction.ltr': "Chapdan o‘ngga";
32
+ readonly 'editor.direction.rtl': "O‘ngdan chapga";
33
+ readonly 'editor.document': "Hujjat";
34
+ readonly 'editor.editLink': "Havolani tahrirlash";
35
+ readonly 'editor.enterFullscreen': "To‘liq ekran";
36
+ readonly 'editor.exitFullscreen': "To‘liq ekrandan chiqish";
37
+ readonly 'editor.exportHtml': "HTML sifatida yuklab olish";
38
+ readonly 'editor.exportWord': "Word (.doc) sifatida yuklab olish";
39
+ readonly 'editor.fitWidth': "Kenglikka moslash";
40
+ readonly 'editor.fontFamily': "Shrift";
41
+ readonly 'editor.fontSize': "Shrift o‘lchami";
42
+ readonly 'editor.footer': "Pastki kolontitul";
43
+ readonly 'editor.formatPainter': "Format bo‘yoqchasi";
44
+ readonly 'editor.formattingMarks': "Formatlash belgilari";
45
+ readonly 'editor.header': "Yuqori kolontitul";
46
+ readonly 'editor.headerFooter': "Kolontitullar";
47
+ readonly 'editor.headerFooter.center': "Markaz";
48
+ readonly 'editor.headerFooter.clear': "Tozalash";
49
+ readonly 'editor.headerFooter.hint': "Matn har bir sahifada takrorlanadi.";
50
+ readonly 'editor.headerFooter.left': "Chap";
51
+ readonly 'editor.headerFooter.right': "O‘ng";
52
+ readonly 'editor.headerFooter.token.date': "Sana";
53
+ readonly 'editor.headerFooter.token.page': "Sahifa raqami";
54
+ readonly 'editor.headerFooter.token.pages': "Sahifalar soni";
55
+ readonly 'editor.headerFooter.token.title': "Hujjat nomi";
56
+ readonly 'editor.headerFooter.tokens': "Qo‘shish:";
57
+ readonly 'editor.heading': "Sarlavha {level}";
58
+ readonly 'editor.highlight': "Belgilash rangi";
59
+ readonly 'editor.horizontalRule': "Gorizontal chiziq";
60
+ readonly 'editor.image': "Rasm";
61
+ readonly 'editor.imageAlt': "Muqobil matn (alt)";
62
+ readonly 'editor.imageReadError': "Rasmni o‘qib bo‘lmadi";
63
+ readonly 'editor.imageSizeError': "Rasm hajmi {size} MB dan oshmasligi kerak";
64
+ readonly 'editor.imageTypeError': "Faqat rasm fayllarini qo‘shish mumkin";
65
+ readonly 'editor.imageUploadError': "Rasmni yuklab bo‘lmadi";
66
+ readonly 'editor.increaseFontSize': "Shriftni kattalashtirish";
67
+ readonly 'editor.indent': "Chekinishni oshirish";
68
+ readonly 'editor.inlineCode': "Kod";
69
+ readonly 'editor.insert': "Qo‘shish";
70
+ readonly 'editor.insertDate': "Bugungi sana";
71
+ readonly 'editor.insertMore': "Boshqa elementlar";
72
+ readonly 'editor.italic': "Kursiv";
73
+ readonly 'editor.lineHeight': "Qator oralig‘i";
74
+ readonly 'editor.link': "Havola";
75
+ readonly 'editor.linkNewTab': "Yangi oynada ochish";
76
+ readonly 'editor.linkText': "Matn";
77
+ readonly 'editor.linkUrl': "Manzil (URL)";
78
+ readonly 'editor.more': "Yana";
79
+ readonly 'editor.moreFormatting': "Boshqa formatlar";
80
+ readonly 'editor.openLink': "Havolani ochish";
81
+ readonly 'editor.or': "yoki havola orqali";
82
+ readonly 'editor.orderedList': "Raqamli ro‘yxat";
83
+ readonly 'editor.outdent': "Chekinishni kamaytirish";
84
+ readonly 'editor.page.customMargins': "Aniq qiymatlar (mm)";
85
+ readonly 'editor.page.landscape': "Albom";
86
+ readonly 'editor.page.marginBottom': "Pastki";
87
+ readonly 'editor.page.marginLeft': "Chap";
88
+ readonly 'editor.page.marginRight': "O‘ng";
89
+ readonly 'editor.page.marginTop': "Yuqori";
90
+ readonly 'editor.page.margins': "Hoshiyalar";
91
+ readonly 'editor.page.margins.moderate': "O‘rtacha";
92
+ readonly 'editor.page.margins.narrow': "Tor";
93
+ readonly 'editor.page.margins.normal': "Oddiy";
94
+ readonly 'editor.page.margins.official': "Rasmiy hujjat";
95
+ readonly 'editor.page.margins.wide': "Keng";
96
+ readonly 'editor.page.orientation': "Yo‘nalish";
97
+ readonly 'editor.page.portrait': "Kitob";
98
+ readonly 'editor.page.setup': "Sahifa sozlamalari";
99
+ readonly 'editor.page.watermark': "Suv belgisi";
100
+ readonly 'editor.page.watermarkColor': "Rangi";
101
+ readonly 'editor.page.watermarkDiagonal': "Qiya";
102
+ readonly 'editor.page.watermarkText': "Matn, masalan NUSXA";
103
+ readonly 'editor.page.size': "Qog‘oz o‘lchami";
104
+ readonly 'editor.pageBreak': "Sahifa uzilishi";
105
+ readonly 'editor.paragraph': "Oddiy matn";
106
+ readonly 'editor.paste': "Joylashtirish";
107
+ readonly 'editor.placeholder': "Hujjat matnini kiriting…";
108
+ readonly 'editor.print': "Chop etish / PDF";
109
+ readonly 'editor.quote': "Iqtibos";
110
+ readonly 'editor.redo': "Qaytarish";
111
+ readonly 'editor.replace.all': "Barchasini";
112
+ readonly 'editor.replace.one': "Almashtirish";
113
+ readonly 'editor.replace.placeholder': "Almashtirish";
114
+ readonly 'editor.replace.toggle': "Almashtirishni ko‘rsatish";
115
+ readonly 'editor.ruler': "Chizg‘ich";
116
+ readonly 'editor.ruler.firstLine': "Birinchi qator chekinishi";
117
+ readonly 'editor.ruler.indentLeft': "Chap chekinish";
118
+ readonly 'editor.ruler.indentRight': "O‘ng chekinish";
119
+ readonly 'editor.ruler.marginLeft': "Chap hoshiya";
120
+ readonly 'editor.ruler.marginRight': "O‘ng hoshiya";
121
+ readonly 'editor.search.caseSensitive': "Katta-kichik harfni farqlash";
122
+ readonly 'editor.search.next': "Keyingisi";
123
+ readonly 'editor.search.placeholder': "Qidirish";
124
+ readonly 'editor.search.previous': "Oldingisi";
125
+ readonly 'editor.search.title': "Qidirish va almashtirish";
126
+ readonly 'editor.search.wholeWord': "Butun so‘z";
127
+ readonly 'editor.selectAll': "Barchasini tanlash";
128
+ readonly 'editor.source': "HTML kod";
129
+ readonly 'editor.spacing.addAfter': "Keyin bo‘sh joy qo‘shish";
130
+ readonly 'editor.spacing.addBefore': "Oldin bo‘sh joy qo‘shish";
131
+ readonly 'editor.spacing.removeAfter': "Keyingi bo‘sh joyni olib tashlash";
132
+ readonly 'editor.spacing.removeBefore': "Oldingi bo‘sh joyni olib tashlash";
133
+ readonly 'editor.specialCharacters': "Maxsus belgilar";
134
+ readonly 'editor.status.characters': "{count} belgi";
135
+ readonly 'editor.status.page': "Sahifa {current} / {total}";
136
+ readonly 'editor.status.words': "{count} so‘z";
137
+ readonly 'editor.strike': "Ustidan chizilgan";
138
+ readonly 'editor.subscript': "Pastki indeks";
139
+ readonly 'editor.superscript': "Yuqori indeks";
140
+ readonly 'editor.table.addColumnAfter': "O‘ngga ustun qo‘shish";
141
+ readonly 'editor.table.addColumnBefore': "Chapga ustun qo‘shish";
142
+ readonly 'editor.table.addRowAfter': "Pastga qator qo‘shish";
143
+ readonly 'editor.table.addRowBefore': "Yuqoriga qator qo‘shish";
144
+ readonly 'editor.table.delete': "Jadvalni o‘chirish";
145
+ readonly 'editor.table.deleteColumn': "Ustunni o‘chirish";
146
+ readonly 'editor.table.deleteRow': "Qatorni o‘chirish";
147
+ readonly 'editor.table.headerRow': "Sarlavha qatori";
148
+ readonly 'editor.table.insert': "Jadval qo‘shish";
149
+ readonly 'editor.table.mergeCells': "Kataklarni birlashtirish";
150
+ readonly 'editor.table.pickSize': "O‘lchamni tanlang";
151
+ readonly 'editor.table.splitCell': "Katakni ajratish";
152
+ readonly 'editor.table.title': "Jadval";
153
+ readonly 'editor.taskList': "Vazifalar ro‘yxati";
154
+ readonly 'editor.textColor': "Matn rangi";
155
+ readonly 'editor.textDirection': "Matn yo‘nalishi";
156
+ readonly 'editor.textStyle': "Matn uslubi";
157
+ readonly 'editor.toolbar': "Muharrir asboblari";
158
+ readonly 'editor.underline': "Tagiga chizilgan";
159
+ readonly 'editor.undo': "Bekor qilish";
160
+ readonly 'editor.unlink': "Havolani olib tashlash";
161
+ readonly 'editor.uploadImage': "Kompyuterdan yuklash";
162
+ readonly 'editor.uploading': "Rasm yuklanmoqda…";
163
+ readonly 'editor.view.page': "Sahifa ko‘rinishi";
164
+ readonly 'editor.view.web': "Veb ko‘rinish";
165
+ readonly 'editor.zoom': "Masshtab";
166
+ readonly 'editor.zoomIn': "Kattalashtirish";
167
+ readonly 'editor.zoomOut': "Kichraytirish";
168
+ readonly 'editor.zoomReset': "100% ga qaytarish";
169
+ };
170
+ /** Every label key the editor uses; the Uzbek texts are the reference set. */
171
+ export type EditorLabelKey = keyof typeof uz;