nuvra 0.1.0 → 0.2.1
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/LICENSE +48 -0
- package/README.md +100 -38
- package/dist/components/document-editor.vue.d.ts +4 -4
- package/dist/components/dropdown-context.d.ts +5 -0
- package/dist/components/editor-dropdown-item.vue.d.ts +22 -0
- package/dist/components/editor-dropdown.vue.d.ts +35 -0
- package/dist/components/editor-icon.vue.d.ts +12 -0
- package/dist/components/editor-popover.vue.d.ts +50 -0
- package/dist/core/icons.d.ts +10 -0
- package/dist/core/popover.d.ts +6 -0
- package/dist/editor.vue.d.ts +4 -4
- package/dist/index.js +2740 -1940
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -8
package/LICENSE
CHANGED
|
@@ -19,3 +19,51 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Third-party notices
|
|
26
|
+
|
|
27
|
+
The icon shapes in src/core/icons.ts come from Lucide (https://lucide.dev).
|
|
28
|
+
|
|
29
|
+
ISC License
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
32
|
+
|
|
33
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
35
|
+
copyright notice and this permission notice appear in all copies.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
38
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
39
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
40
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
41
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
42
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
43
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
|
|
45
|
+
Some Lucide icons (among those used here: chevron-down, chevron-right,
|
|
46
|
+
chevron-up, code, external-link, italic, link, minimize-2, minus, plus, search,
|
|
47
|
+
trash, upload, x) are derived from the Feather project:
|
|
48
|
+
|
|
49
|
+
The MIT License (MIT)
|
|
50
|
+
|
|
51
|
+
Copyright (c) 2013-present Cole Bemis
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
in the Software without restriction, including without limitation the rights
|
|
56
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
furnished to do so, subject to the following conditions:
|
|
59
|
+
|
|
60
|
+
The above copyright notice and this permission notice shall be included in all
|
|
61
|
+
copies or substantial portions of the Software.
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -3,26 +3,28 @@
|
|
|
3
3
|
Word-style document editor for Vue 3. A real page view with paper sizes and margins, a lighter web view for
|
|
4
4
|
forms, tables, images, lists, find & replace, HTML source mode, printing and export to HTML or Word (`.doc`).
|
|
5
5
|
|
|
6
|
+
**[Documentation and live demo →](https://nuvra-docs.vercel.app)**
|
|
7
|
+
|
|
6
8
|
- No editor framework underneath: its own small editing engine with a sanitizing schema.
|
|
9
|
+
- No UI framework either: native HTML controls, built-in SVG icons and plain CSS variables. Vue is the only
|
|
10
|
+
dependency.
|
|
7
11
|
- Pagination in the page view (A4, A5, Letter, …, portrait or landscape).
|
|
8
12
|
- Tables with merge / split, images with resize and alignment, task lists, links, colors, fonts.
|
|
9
13
|
- Undo / redo, keyboard shortcuts that work with non-Latin keyboard layouts, Markdown-like input rules.
|
|
10
|
-
- Built on [Element Plus](https://element-plus.org) controls and [Lucide](https://lucide.dev) icons.
|
|
11
14
|
|
|
12
15
|
## Installation
|
|
13
16
|
|
|
14
17
|
```sh
|
|
15
|
-
pnpm add nuvra
|
|
18
|
+
pnpm add nuvra
|
|
16
19
|
# or
|
|
17
|
-
npm install nuvra
|
|
20
|
+
npm install nuvra
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
`vue` (3.5+)
|
|
23
|
+
`vue` (3.5+) is the only peer dependency.
|
|
21
24
|
|
|
22
|
-
Import the styles once,
|
|
25
|
+
Import the styles once, for example in `main.ts`:
|
|
23
26
|
|
|
24
27
|
```ts
|
|
25
|
-
import 'element-plus/dist/index.css';
|
|
26
28
|
import 'nuvra/style.css';
|
|
27
29
|
```
|
|
28
30
|
|
|
@@ -80,22 +82,22 @@ const uploadImage: DocumentImageUploadHandler = async file => {
|
|
|
80
82
|
|
|
81
83
|
### `DocumentEditor` props
|
|
82
84
|
|
|
83
|
-
| Prop | Type
|
|
84
|
-
| ----------------- |
|
|
85
|
-
| `v-model` | `string`
|
|
86
|
-
| `v-model:page` | `PageSettings`
|
|
87
|
-
| `autofocus` | `boolean`
|
|
88
|
-
| `canvasPadding` | `number \| string`
|
|
89
|
-
| `defaultViewMode` | `'page' \| 'web'`
|
|
90
|
-
| `disabled` | `boolean`
|
|
91
|
-
| `height` | `number \| string`
|
|
92
|
-
| `minHeight` | `number \| string`
|
|
93
|
-
| `maxHeight` | `number \| string`
|
|
94
|
-
| `maxImageSizeMb` | `number`
|
|
95
|
-
| `maxLength` | `number`
|
|
96
|
-
| `placeholder` | `string`
|
|
97
|
-
| `title` | `string`
|
|
98
|
-
| `uploadImage` | `(file: File) => Promise<string>`
|
|
85
|
+
| Prop | Type | Default | Description |
|
|
86
|
+
| ----------------- | --------------------------------- | -------- | -------------------------------------------------------------------------- |
|
|
87
|
+
| `v-model` | `string` | `''` | Document HTML; an empty document is an empty string. |
|
|
88
|
+
| `v-model:page` | `PageSettings` | A4 | Paper size, orientation and margins. |
|
|
89
|
+
| `autofocus` | `boolean` | `false` | Places the caret at the end of the document once ready. |
|
|
90
|
+
| `canvasPadding` | `number \| string` | `50` | Gray space around the page or web sheet. |
|
|
91
|
+
| `defaultViewMode` | `'page' \| 'web'` | `'page'` | View shown first. |
|
|
92
|
+
| `disabled` | `boolean` | `false` | Read-only document, disabled controls. |
|
|
93
|
+
| `height` | `number \| string` | `760` | Height of the editor, or `'auto'` to grow between `minHeight`/`maxHeight`. |
|
|
94
|
+
| `minHeight` | `number \| string` | `240` | Smallest height of an auto-height editor. |
|
|
95
|
+
| `maxHeight` | `number \| string` | `600` | Largest height of an auto-height editor. |
|
|
96
|
+
| `maxImageSizeMb` | `number` | `10` | Largest accepted image file. |
|
|
97
|
+
| `maxLength` | `number` | `0` | Character limit; `0` means unlimited. |
|
|
98
|
+
| `placeholder` | `string` | `''` | Text shown while the document is empty. |
|
|
99
|
+
| `title` | `string` | `''` | Print title and exported file name. |
|
|
100
|
+
| `uploadImage` | `(file: File) => Promise<string>` | — | Uploads an image and resolves with its URL. |
|
|
99
101
|
|
|
100
102
|
`Editor` accepts the same props except `v-model:page`, `defaultViewMode`, `height` and `title`.
|
|
101
103
|
|
|
@@ -103,27 +105,30 @@ Numbers are pixels; strings are used as CSS lengths (`'100%'`, `'50vh'`).
|
|
|
103
105
|
|
|
104
106
|
### Events
|
|
105
107
|
|
|
106
|
-
| Event | Payload | Description
|
|
107
|
-
| ------------- | ---------------- |
|
|
108
|
-
| `focus` | — | The document received focus.
|
|
108
|
+
| Event | Payload | Description |
|
|
109
|
+
| ------------- | ---------------- | ------------------------------------------------- |
|
|
110
|
+
| `focus` | — | The document received focus. |
|
|
109
111
|
| `blur` | — | The document lost focus; the model is up to date. |
|
|
110
|
-
| `uploadError` | `error: unknown` | An image was rejected or its upload failed.
|
|
112
|
+
| `uploadError` | `error: unknown` | An image was rejected or its upload failed. |
|
|
111
113
|
|
|
112
114
|
### Exposed methods (`DocumentEditor` ref)
|
|
113
115
|
|
|
114
|
-
| Method | Description
|
|
115
|
-
| -------------- |
|
|
116
|
-
| `focus()` | Moves keyboard focus into the document.
|
|
116
|
+
| Method | Description |
|
|
117
|
+
| -------------- | ---------------------------------------------------------------- |
|
|
118
|
+
| `focus()` | Moves keyboard focus into the document. |
|
|
117
119
|
| `getHTML()` | Returns the document HTML, including edits not yet in the model. |
|
|
118
|
-
| `print()` | Opens the browser print dialog.
|
|
119
|
-
| `exportHtml()` | Downloads the document as an HTML page.
|
|
120
|
-
| `exportWord()` | Downloads the document as a Word-compatible `.doc` file.
|
|
121
|
-
| `engine` | The editing engine, for advanced integrations.
|
|
120
|
+
| `print()` | Opens the browser print dialog. |
|
|
121
|
+
| `exportHtml()` | Downloads the document as an HTML page. |
|
|
122
|
+
| `exportWord()` | Downloads the document as a Word-compatible `.doc` file. |
|
|
123
|
+
| `engine` | The editing engine, for advanced integrations. |
|
|
122
124
|
|
|
123
125
|
### Keyboard shortcuts
|
|
124
126
|
|
|
125
|
-
`Ctrl/⌘+B`, `I`, `U` — bold, italic, underline · `Ctrl/⌘+Z`, `Ctrl/⌘+Shift+Z` — undo,
|
|
126
|
-
`Ctrl/⌘+F` — find · `Ctrl/⌘+H` — replace · `Ctrl/⌘+K` — link · `Ctrl/⌘+P` — print.
|
|
127
|
+
`Ctrl/⌘+B`, `I`, `U` — bold, italic, underline · `Ctrl/⌘+Shift+H` — highlight · `Ctrl/⌘+Z`, `Ctrl/⌘+Shift+Z` — undo,
|
|
128
|
+
redo · `Ctrl/⌘+F` — find · `Ctrl/⌘+H` — replace · `Ctrl/⌘+K` — link · `Ctrl/⌘+P` — print.
|
|
129
|
+
|
|
130
|
+
The full list, with Markdown-like input rules, is in the
|
|
131
|
+
[keyboard shortcuts guide](https://nuvra-docs.vercel.app/docs/keyboard-shortcuts).
|
|
127
132
|
|
|
128
133
|
## Translations
|
|
129
134
|
|
|
@@ -155,9 +160,66 @@ setEditorTranslator((key, named) => (i18n.global.te(key) ? i18n.global.t(key, na
|
|
|
155
160
|
|
|
156
161
|
## Theming
|
|
157
162
|
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
Colors come from CSS variables declared on `.document-editor` with zero specificity, so any rule that targets
|
|
164
|
+
`.document-editor` overrides them, whatever order the stylesheets load in. Set them on the editor element itself:
|
|
165
|
+
values on an ancestor such as `body` do not apply, because the editor declares its own.
|
|
166
|
+
|
|
167
|
+
```css
|
|
168
|
+
.document-editor {
|
|
169
|
+
--nuvra-color-primary: #7c3aed;
|
|
170
|
+
--nuvra-color-primary-hover: #8b5cf6;
|
|
171
|
+
--nuvra-color-primary-border: #c4b5fd;
|
|
172
|
+
--nuvra-color-primary-muted: #ddd6fe;
|
|
173
|
+
--nuvra-color-primary-soft: #f5f3ff;
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Variable | Used for |
|
|
178
|
+
| ------------------------------- | ---------------------------------------------------- |
|
|
179
|
+
| `--nuvra-color-primary` | Active buttons, focus, primary buttons, selection |
|
|
180
|
+
| `--nuvra-color-primary-hover` | Hovered primary buttons |
|
|
181
|
+
| `--nuvra-color-primary-border` | Focused editor frame, disabled primary buttons |
|
|
182
|
+
| `--nuvra-color-primary-muted` | Table size preview, hovered button borders |
|
|
183
|
+
| `--nuvra-color-primary-soft` | Active button and menu item backgrounds |
|
|
184
|
+
| `--nuvra-color-on-primary` | Text on primary buttons |
|
|
185
|
+
| `--nuvra-color-danger` | Destructive actions, character limit reached |
|
|
186
|
+
| `--nuvra-color-danger-soft` | Hovered destructive actions |
|
|
187
|
+
| `--nuvra-text-strong` | Headings in forms |
|
|
188
|
+
| `--nuvra-text` | Regular text and icons |
|
|
189
|
+
| `--nuvra-text-muted` | Labels, captions, status bar |
|
|
190
|
+
| `--nuvra-text-placeholder` | Placeholders, shortcut hints |
|
|
191
|
+
| `--nuvra-text-disabled` | Disabled buttons |
|
|
192
|
+
| `--nuvra-border` | Editor frame, inputs |
|
|
193
|
+
| `--nuvra-border-hover` | Hovered inputs |
|
|
194
|
+
| `--nuvra-border-light` | Popovers and floating panels |
|
|
195
|
+
| `--nuvra-border-lighter` | Dividers |
|
|
196
|
+
| `--nuvra-fill` | Hovered buttons, segmented controls |
|
|
197
|
+
| `--nuvra-bg` | Toolbar, status bar, inputs |
|
|
198
|
+
| `--nuvra-bg-overlay` | Popovers, menus, find bar |
|
|
199
|
+
| `--nuvra-shadow` | Popovers and floating panels |
|
|
200
|
+
| `--nuvra-fullscreen-z-index` | Stacking order of the fullscreen editor (`2000`) |
|
|
201
|
+
|
|
202
|
+
A dark palette is applied when an ancestor (usually `<html>`) has the `dark` class or `data-theme="dark"`. To change
|
|
203
|
+
dark values separately, target `.dark .document-editor`.
|
|
204
|
+
|
|
205
|
+
To follow an Element Plus theme, map the variables to its own:
|
|
206
|
+
|
|
207
|
+
```css
|
|
208
|
+
.document-editor {
|
|
209
|
+
--nuvra-color-primary: var(--el-color-primary);
|
|
210
|
+
--nuvra-color-primary-soft: var(--el-color-primary-light-9);
|
|
211
|
+
--nuvra-text: var(--el-text-color-regular);
|
|
212
|
+
--nuvra-border: var(--el-border-color);
|
|
213
|
+
--nuvra-bg: var(--el-bg-color);
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Browser support
|
|
218
|
+
|
|
219
|
+
Popovers, menus and bubble toolbars use the [Popover API](https://developer.mozilla.org/docs/Web/API/Popover_API)
|
|
220
|
+
(Chrome/Edge 114+, Safari 17+, Firefox 125+), which keeps them above dialogs and the fullscreen editor. Older browsers
|
|
221
|
+
show them as fixed elements instead. Search highlighting uses the CSS Custom Highlight API.
|
|
160
222
|
|
|
161
223
|
## License
|
|
162
224
|
|
|
163
|
-
[MIT](./LICENSE)
|
|
225
|
+
[MIT](./LICENSE). Icon shapes come from [Lucide](https://lucide.dev) (ISC).
|
|
@@ -55,24 +55,24 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
55
55
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
56
56
|
focus: () => any;
|
|
57
57
|
blur: () => any;
|
|
58
|
-
"update:modelValue": (value: string) => any;
|
|
59
58
|
"update:page": (value: PageSettings) => any;
|
|
60
59
|
uploadError: (error: unknown) => any;
|
|
60
|
+
"update:modelValue": (value: string) => any;
|
|
61
61
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
62
62
|
onFocus?: (() => any) | undefined;
|
|
63
63
|
onBlur?: (() => any) | undefined;
|
|
64
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
65
64
|
"onUpdate:page"?: ((value: PageSettings) => any) | undefined;
|
|
66
65
|
onUploadError?: ((error: unknown) => any) | undefined;
|
|
66
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
67
67
|
}>, {
|
|
68
68
|
title: string;
|
|
69
69
|
height: CssSize;
|
|
70
|
-
disabled: boolean;
|
|
71
70
|
placeholder: string;
|
|
72
|
-
|
|
71
|
+
disabled: boolean;
|
|
73
72
|
minHeight: CssSize;
|
|
74
73
|
maxLength: number;
|
|
75
74
|
maxHeight: CssSize;
|
|
75
|
+
autofocus: boolean;
|
|
76
76
|
canvasPadding: CssSize;
|
|
77
77
|
defaultViewMode: DocumentViewMode;
|
|
78
78
|
maxImageSizeMb: number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
/** Value an `EditorDropdownItem` reports when it is chosen. */
|
|
3
|
+
export type DropdownCommand = string | number;
|
|
4
|
+
/** Provided by `EditorDropdown`: chooses a command and closes the menu. */
|
|
5
|
+
export declare const DROPDOWN_SELECT: InjectionKey<(command: DropdownCommand) => void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type DropdownCommand } from './dropdown-context';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Value reported to the dropdown when the item is chosen. */
|
|
4
|
+
command: DropdownCommand;
|
|
5
|
+
/** Draws a separator above the item. */
|
|
6
|
+
divided?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare var __VLS_1: {};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_1) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
13
|
+
divided: boolean;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type DropdownCommand } from './dropdown-context';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Prevents opening the menu. */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** Largest height of the menu in pixels; longer menus scroll. */
|
|
6
|
+
maxHeight?: number;
|
|
7
|
+
/** Extra class of the element that holds the items. */
|
|
8
|
+
menuClass?: string;
|
|
9
|
+
/** Edge of the trigger the menu is aligned with. */
|
|
10
|
+
placement?: 'bottom-start' | 'bottom-end';
|
|
11
|
+
}
|
|
12
|
+
declare var __VLS_12: {}, __VLS_14: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
default?: (props: typeof __VLS_12) => any;
|
|
15
|
+
} & {
|
|
16
|
+
menu?: (props: typeof __VLS_14) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
command: (command: DropdownCommand) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
21
|
+
onCommand?: ((command: DropdownCommand) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
placement: "bottom-start" | "bottom-end";
|
|
25
|
+
maxHeight: number;
|
|
26
|
+
menuClass: string;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IconName } from '../core/icons';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Icon to draw. */
|
|
4
|
+
name: IconName;
|
|
5
|
+
/** Width and height in pixels. */
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
|
+
size: number;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** Prevents opening and closes an open panel. */
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
/** Largest height of the panel in pixels; taller content scrolls. */
|
|
5
|
+
maxHeight?: number;
|
|
6
|
+
/** Extra class of the panel element. */
|
|
7
|
+
panelClass?: string;
|
|
8
|
+
/** Edge of the reference the panel is aligned with. */
|
|
9
|
+
placement?: 'bottom-start' | 'bottom-end';
|
|
10
|
+
/** ARIA role of the panel. */
|
|
11
|
+
role?: 'dialog' | 'menu';
|
|
12
|
+
/** Width of the panel in pixels; the content decides when omitted. */
|
|
13
|
+
width?: number;
|
|
14
|
+
}
|
|
15
|
+
type __VLS_Props = Props;
|
|
16
|
+
type __VLS_ModelProps = {
|
|
17
|
+
/** Whether the panel is open. */
|
|
18
|
+
'open'?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
21
|
+
declare var __VLS_1: {}, __VLS_3: {};
|
|
22
|
+
type __VLS_Slots = {} & {
|
|
23
|
+
reference?: (props: typeof __VLS_1) => any;
|
|
24
|
+
} & {
|
|
25
|
+
default?: (props: typeof __VLS_3) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
+
show: () => any;
|
|
29
|
+
shown: () => any;
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
32
|
+
onShow?: (() => any) | undefined;
|
|
33
|
+
onShown?: (() => any) | undefined;
|
|
34
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
width: number;
|
|
37
|
+
role: "dialog" | "menu";
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
placement: "bottom-start" | "bottom-end";
|
|
40
|
+
maxHeight: number;
|
|
41
|
+
panelClass: string;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
44
|
+
declare const _default: typeof __VLS_export;
|
|
45
|
+
export default _default;
|
|
46
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
47
|
+
new (): {
|
|
48
|
+
$slots: S;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG icons of the editor on a 24×24 grid, drawn with a 2px round stroke in the current text colour. The shapes come
|
|
3
|
+
* from Lucide 1.44.0 (https://lucide.dev, ISC license, see LICENSE); the data is generated, not edited by hand.
|
|
4
|
+
*/
|
|
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';
|
|
7
|
+
/** One SVG element of an icon: its tag and attributes. */
|
|
8
|
+
export type IconElement = readonly [tag: string, attributes: Readonly<Record<string, string | number>>];
|
|
9
|
+
/** Elements of every icon, by name. */
|
|
10
|
+
export declare const ICONS: Readonly<Record<IconName, readonly IconElement[]>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Whether the Popover API can show floating panels in the top layer; without it they are fixed elements. */
|
|
2
|
+
export declare const SUPPORTS_POPOVER: boolean;
|
|
3
|
+
/** Records a popover that has just opened and closes the one that was open before it. */
|
|
4
|
+
export declare const setOpenPopover: (close: () => void) => void;
|
|
5
|
+
/** Forgets a popover that has closed. */
|
|
6
|
+
export declare const clearOpenPopover: (close: () => void) => void;
|
package/dist/editor.vue.d.ts
CHANGED
|
@@ -28,20 +28,20 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
28
28
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
29
|
focus: () => any;
|
|
30
30
|
blur: () => any;
|
|
31
|
-
"update:modelValue": (value: string) => any;
|
|
32
31
|
uploadError: (error: unknown) => any;
|
|
32
|
+
"update:modelValue": (value: string) => any;
|
|
33
33
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
34
34
|
onFocus?: (() => any) | undefined;
|
|
35
35
|
onBlur?: (() => any) | undefined;
|
|
36
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
37
36
|
onUploadError?: ((error: unknown) => any) | undefined;
|
|
37
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
38
38
|
}>, {
|
|
39
|
-
disabled: boolean;
|
|
40
39
|
placeholder: string;
|
|
41
|
-
|
|
40
|
+
disabled: boolean;
|
|
42
41
|
minHeight: number | string;
|
|
43
42
|
maxLength: number;
|
|
44
43
|
maxHeight: number | string;
|
|
44
|
+
autofocus: boolean;
|
|
45
45
|
canvasPadding: number | string;
|
|
46
46
|
maxImageSizeMb: number;
|
|
47
47
|
uploadImage: DocumentImageUploadHandler;
|