nuvra 0.6.0 → 0.7.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.
@@ -5,7 +5,7 @@ import { type EditorLocaleInput } from '../core/labels';
5
5
  import { type DocumentViewMode, type PageSettings } from '../core/page';
6
6
  import type { SlashCommand } from '../core/slash-commands';
7
7
  import type { TemplateVariable } from '../core/templates';
8
- import type { DocumentImageUploadHandler } from '../core/types';
8
+ import type { DocumentImageUploadHandler, ToolbarTool } from '../core/types';
9
9
  import { type EditorUiState } from '../core/ui-state';
10
10
  import '../styles/document-content.css';
11
11
  import '../styles/editor-ui.css';
@@ -44,6 +44,11 @@ interface Props {
44
44
  ruler?: boolean;
45
45
  /** Used as the print title and the exported file name. */
46
46
  title?: string;
47
+ /**
48
+ * Toolbar tools to show, such as `['history', 'marks', 'lists', 'link']`; every tool without a list. Keyboard
49
+ * shortcuts, the `/` menu and the right-click menu are not affected.
50
+ */
51
+ tools?: readonly ToolbarTool[];
47
52
  /** Uploads an inserted image and resolves with its URL; without it images are embedded as data URLs. */
48
53
  uploadImage?: DocumentImageUploadHandler;
49
54
  /** Template variables the user can insert; typing `{{name}}` of one of them inserts it as well. */
@@ -120,13 +125,14 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
120
125
  height: CssSize;
121
126
  locale: EditorLocaleInput;
122
127
  ruler: boolean;
128
+ variables: readonly TemplateVariable[];
123
129
  placeholder: string;
124
130
  disabled: boolean;
125
131
  minHeight: CssSize;
126
132
  collaborators: readonly Collaborator[];
127
133
  maxHeight: CssSize;
128
134
  maxLength: number;
129
- variables: readonly TemplateVariable[];
135
+ tools: readonly ToolbarTool[];
130
136
  author: string;
131
137
  autofocus: boolean;
132
138
  canvasPadding: CssSize;
@@ -1,7 +1,7 @@
1
1
  import type { DocumentEngine } from '../core/engine/engine';
2
2
  import { type PageSettings } from '../core/page';
3
3
  import type { TemplateVariable } from '../core/templates';
4
- import type { DocumentMenuAction } from '../core/types';
4
+ import { type DocumentMenuAction, type ToolbarTool } from '../core/types';
5
5
  import { type EditorUiState } from '../core/ui-state';
6
6
  interface Props {
7
7
  /** Read-only document: every editing control is disabled. */
@@ -36,6 +36,8 @@ interface Props {
36
36
  uploading: boolean;
37
37
  /** Template variables offered by the variable menu; the menu is hidden without any. */
38
38
  variables: ReadonlyArray<TemplateVariable>;
39
+ /** Tools to show; every tool without a list. */
40
+ tools: readonly ToolbarTool[] | undefined;
39
41
  }
40
42
  declare var __VLS_626: {};
41
43
  type __VLS_Slots = {} & {
@@ -10,16 +10,16 @@ export interface SelectionOffsets {
10
10
  /** Where the caret is. */
11
11
  focus: number;
12
12
  }
13
- /** Someone else editing the same document. */
13
+ /** Someone else edits the same document. */
14
14
  export interface Collaborator {
15
15
  /** Stable id of the person or connection. */
16
16
  id: string;
17
17
  /** Name shown next to the caret. */
18
18
  name: string;
19
- /** CSS colour of the caret and the selection; one is picked from the id when it is left out. */
19
+ /** CSS color of the caret and the selection; one is picked from the id when it is left out. */
20
20
  color?: string;
21
21
  /** Where the person's caret or selection is, or `null` while they are not in the document. */
22
22
  selection: SelectionOffsets | null;
23
23
  }
24
- /** The colour of a collaborator: their own, or a stable one derived from the id. */
24
+ /** The color of a collaborator: their own, or a stable one derived from the id. */
25
25
  export declare const collaboratorColor: (collaborator: Pick<Collaborator, "id" | "color">) => string;
@@ -8,7 +8,7 @@ import { type PageSettings } from '../page';
8
8
  export interface DocxImport {
9
9
  /** Document content as HTML. */
10
10
  html: string;
11
- /** Page setup of the document's last section. */
11
+ /** Page setup of the document's first section; later sections are section breaks in the HTML. */
12
12
  page: PageSettings;
13
13
  }
14
14
  /**
@@ -15,7 +15,7 @@ export declare const imageFiles: (content: TransferContent) => File[];
15
15
  export declare const singleUrl: (content: TransferContent) => string | null;
16
16
  /** Converts plain text into paragraphs, one per line; a final line break does not add an empty paragraph. */
17
17
  export declare const textToFragment: (text: string) => DocumentFragment;
18
- /** Converts a payload into editor blocks, preferring sanitised HTML over plain text; `null` when it has neither. */
18
+ /** Converts a payload into editor blocks, preferring sanitized HTML over plain text; `null` when it has neither. */
19
19
  export declare const transferToFragment: (content: TransferContent) => DocumentFragment | null;
20
20
  /** Clean HTML and plain text of a selection, as put on the clipboard by copy, cut and drag. */
21
21
  export declare const selectionClipboardData: (root: HTMLElement, range: Range) => {
@@ -6,6 +6,12 @@ export declare const VARIABLE_LABEL_ATTRIBUTE = "data-label";
6
6
  export declare const ROTATED_ATTRIBUTE = "data-doc-rotated";
7
7
  /** Attribute pagination writes on blocks it moved to the next sheet; editor-only. */
8
8
  export declare const GAP_ATTRIBUTE = "data-doc-gap";
9
+ /** Attribute pagination writes on table rows it moved down to the next sheet, with the shift in pixels; editor-only. */
10
+ export declare const ROW_SHIFT_ATTRIBUTE = "data-doc-row-shift";
11
+ /** Attribute pagination writes on tables split over sheets, with the space their moved rows add; editor-only. */
12
+ export declare const TABLE_SHIFT_ATTRIBUTE = "data-doc-table-shift";
13
+ /** Attribute pagination sets on the editable root while the document is laid out on sheets; editor-only. */
14
+ export declare const PAGED_ATTRIBUTE = "data-doc-paged";
9
15
  /** Class marking table cells in a drag selection; editor-only. */
10
16
  export declare const SELECTED_CELL_CLASS = "doc-cell-selected";
11
17
  /** Attribute holding the space a paragraph keeps before it, in points. */
@@ -1,3 +1,10 @@
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
3
  export type DocumentMenuAction = 'source' | 'print' | 'exportHtml' | 'exportWord' | 'exportPdf' | 'importWord' | 'formattingMarks' | 'ruler' | 'outline' | 'tableOfContents' | 'comments' | 'addComment' | 'footnote' | 'trackChanges' | 'changes' | 'fullscreen';
4
+ /**
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
+ * keyboard shortcuts, the `/` menu and the right-click menu keep working either way.
7
+ */
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
+ /** A tool of the editor toolbar; see {@link TOOLBAR_TOOLS}. */
10
+ export type ToolbarTool = (typeof TOOLBAR_TOOLS)[number];
@@ -1,6 +1,6 @@
1
1
  import type { EditorLocaleInput } from './core/labels';
2
2
  import type { TemplateVariable } from './core/templates';
3
- import type { DocumentImageUploadHandler } from './core/types';
3
+ import type { DocumentImageUploadHandler, ToolbarTool } from './core/types';
4
4
  interface Props {
5
5
  /** Places the caret at the end of the content once the editor is ready. */
6
6
  autofocus?: boolean;
@@ -20,6 +20,8 @@ interface Props {
20
20
  minHeight?: number | string;
21
21
  /** Text shown while the field is empty. */
22
22
  placeholder?: string;
23
+ /** Toolbar tools to show; every tool without a list. */
24
+ tools?: readonly ToolbarTool[];
23
25
  /** Uploads an image and resolves with its URL; without it images are embedded as data URLs. */
24
26
  uploadImage?: DocumentImageUploadHandler;
25
27
  /** Template variables the user can insert; typing `{{name}}` of one of them inserts it as well. */
@@ -43,12 +45,13 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
43
45
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
44
46
  }>, {
45
47
  locale: EditorLocaleInput;
48
+ variables: readonly TemplateVariable[];
46
49
  placeholder: string;
47
50
  disabled: boolean;
48
51
  minHeight: number | string;
49
52
  maxHeight: number | string;
50
53
  maxLength: number;
51
- variables: readonly TemplateVariable[];
54
+ tools: readonly ToolbarTool[];
52
55
  autofocus: boolean;
53
56
  canvasPadding: number | string;
54
57
  maxImageSizeMb: number;
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
32
32
  "onUpdate:modelValue"?: ((value: Record<string, string>) => any) | undefined;
33
33
  }>, {
34
34
  locale: EditorLocaleInput;
35
- readonly: boolean;
36
35
  variables: readonly TemplateVariable[];
36
+ readonly: boolean;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
38
  declare const _default: typeof __VLS_export;
39
39
  export default _default;
package/dist/index.d.ts CHANGED
@@ -32,7 +32,8 @@ export type { FillTemplateOptions, TemplateValues, TemplateVariable } from './co
32
32
  export { fillTemplate, getTemplateVariables } from './core/templates';
33
33
  export type { TransliterationDirection } from './core/transliterate';
34
34
  export { transliterate } from './core/transliterate';
35
- export type { DocumentImageUploadHandler } from './core/types';
35
+ export type { DocumentImageUploadHandler, ToolbarTool } from './core/types';
36
+ export { TOOLBAR_TOOLS } from './core/types';
36
37
  export type { EditorUiState } from './core/ui-state';
37
38
  export { default as Editor } from './editor.vue';
38
39
  export { default as DocumentForm } from './form.vue';