@sveltia/ui 0.25.7 → 0.25.9
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/dist/components/alert/alert.svelte +7 -3
- package/dist/components/alert/alert.svelte.d.ts +11 -10
- package/dist/components/alert/infobar.svelte +9 -5
- package/dist/components/alert/infobar.svelte.d.ts +15 -14
- package/dist/components/button/button-group.svelte +6 -2
- package/dist/components/button/button-group.svelte.d.ts +7 -6
- package/dist/components/button/button.svelte +5 -2
- package/dist/components/button/button.svelte.d.ts +2 -1
- package/dist/components/button/select-button-group.svelte +12 -8
- package/dist/components/button/select-button-group.svelte.d.ts +19 -18
- package/dist/components/button/select-button.svelte +6 -3
- package/dist/components/button/select-button.svelte.d.ts +4 -3
- package/dist/components/button/split-button.svelte +10 -7
- package/dist/components/button/split-button.svelte.d.ts +18 -17
- package/dist/components/calendar/calendar.svelte +1 -1
- package/dist/components/calendar/calendar.svelte.d.ts +2 -2
- package/dist/components/checkbox/checkbox-group.svelte +9 -5
- package/dist/components/checkbox/checkbox-group.svelte.d.ts +13 -12
- package/dist/components/checkbox/checkbox.svelte +13 -9
- package/dist/components/checkbox/checkbox.svelte.d.ts +19 -17
- package/dist/components/dialog/alert-dialog.svelte +5 -2
- package/dist/components/dialog/alert-dialog.svelte.d.ts +3 -1
- package/dist/components/dialog/confirmation-dialog.svelte +5 -2
- package/dist/components/dialog/confirmation-dialog.svelte.d.ts +3 -1
- package/dist/components/dialog/dialog.svelte +5 -2
- package/dist/components/dialog/dialog.svelte.d.ts +3 -1
- package/dist/components/dialog/prompt-dialog.svelte +16 -7
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +17 -13
- package/dist/components/disclosure/disclosure.svelte +12 -8
- package/dist/components/disclosure/disclosure.svelte.d.ts +21 -20
- package/dist/components/divider/divider.svelte +3 -3
- package/dist/components/divider/divider.svelte.d.ts +6 -6
- package/dist/components/divider/spacer.svelte +2 -2
- package/dist/components/divider/spacer.svelte.d.ts +4 -4
- package/dist/components/drawer/drawer.svelte +18 -13
- package/dist/components/drawer/drawer.svelte.d.ts +39 -37
- package/dist/components/grid/grid-body.svelte +7 -3
- package/dist/components/grid/grid-body.svelte.d.ts +9 -8
- package/dist/components/grid/grid-cell.svelte +6 -2
- package/dist/components/grid/grid-cell.svelte.d.ts +7 -6
- package/dist/components/grid/grid-col-header.svelte +6 -2
- package/dist/components/grid/grid-col-header.svelte.d.ts +7 -6
- package/dist/components/grid/grid-foot.svelte +6 -2
- package/dist/components/grid/grid-foot.svelte.d.ts +7 -6
- package/dist/components/grid/grid-head.svelte +6 -2
- package/dist/components/grid/grid-head.svelte.d.ts +7 -6
- package/dist/components/grid/grid-row-header.svelte +6 -2
- package/dist/components/grid/grid-row-header.svelte.d.ts +7 -6
- package/dist/components/grid/grid-row.svelte +9 -5
- package/dist/components/grid/grid-row.svelte.d.ts +13 -12
- package/dist/components/grid/grid.svelte +10 -6
- package/dist/components/grid/grid.svelte.d.ts +15 -14
- package/dist/components/icon/icon.svelte +2 -2
- package/dist/components/icon/icon.svelte.d.ts +4 -4
- package/dist/components/listbox/listbox.svelte +18 -13
- package/dist/components/listbox/listbox.svelte.d.ts +27 -26
- package/dist/components/listbox/option-group.svelte +9 -5
- package/dist/components/listbox/option-group.svelte.d.ts +13 -12
- package/dist/components/listbox/option.svelte +12 -8
- package/dist/components/listbox/option.svelte.d.ts +17 -15
- package/dist/components/menu/menu-button.svelte +7 -4
- package/dist/components/menu/menu-button.svelte.d.ts +6 -5
- package/dist/components/menu/menu-item-checkbox.svelte +5 -2
- package/dist/components/menu/menu-item-checkbox.svelte.d.ts +3 -1
- package/dist/components/menu/menu-item-group.svelte +9 -5
- package/dist/components/menu/menu-item-group.svelte.d.ts +8 -8
- package/dist/components/menu/menu-item-radio.svelte +5 -2
- package/dist/components/menu/menu-item-radio.svelte.d.ts +3 -1
- package/dist/components/menu/menu-item.svelte +5 -2
- package/dist/components/menu/menu-item.svelte.d.ts +3 -1
- package/dist/components/menu/menu.svelte +9 -5
- package/dist/components/menu/menu.svelte.d.ts +13 -12
- package/dist/components/progressbar/progressbar.svelte +5 -5
- package/dist/components/progressbar/progressbar.svelte.d.ts +10 -10
- package/dist/components/radio/radio-group.svelte +13 -9
- package/dist/components/radio/radio-group.svelte.d.ts +21 -20
- package/dist/components/radio/radio.svelte +15 -11
- package/dist/components/radio/radio.svelte.d.ts +27 -26
- package/dist/components/select/combobox.svelte +6 -3
- package/dist/components/select/combobox.svelte.d.ts +3 -1
- package/dist/components/select/select-tags.svelte +16 -13
- package/dist/components/select/select-tags.svelte.d.ts +27 -28
- package/dist/components/select/select.svelte +5 -1
- package/dist/components/select/select.svelte.d.ts +2 -1
- package/dist/components/slider/slider.svelte +27 -25
- package/dist/components/slider/slider.svelte.d.ts +35 -34
- package/dist/components/switch/switch.svelte +13 -9
- package/dist/components/switch/switch.svelte.d.ts +21 -20
- package/dist/components/table/table-body.svelte +7 -3
- package/dist/components/table/table-body.svelte.d.ts +9 -8
- package/dist/components/table/table-cell.svelte +6 -2
- package/dist/components/table/table-cell.svelte.d.ts +7 -6
- package/dist/components/table/table-col-header.svelte +6 -2
- package/dist/components/table/table-col-header.svelte.d.ts +7 -6
- package/dist/components/table/table-foot.svelte +6 -2
- package/dist/components/table/table-foot.svelte.d.ts +7 -6
- package/dist/components/table/table-head.svelte +6 -2
- package/dist/components/table/table-head.svelte.d.ts +7 -6
- package/dist/components/table/table-row-header.svelte +6 -2
- package/dist/components/table/table-row-header.svelte.d.ts +7 -6
- package/dist/components/table/table-row.svelte +6 -2
- package/dist/components/table/table-row.svelte.d.ts +7 -6
- package/dist/components/table/table.svelte +6 -2
- package/dist/components/table/table.svelte.d.ts +7 -6
- package/dist/components/tabs/tab-box.svelte +7 -3
- package/dist/components/tabs/tab-box.svelte.d.ts +9 -8
- package/dist/components/tabs/tab-list.svelte +12 -8
- package/dist/components/tabs/tab-list.svelte.d.ts +19 -18
- package/dist/components/tabs/tab-panel.svelte +6 -2
- package/dist/components/tabs/tab-panel.svelte.d.ts +7 -6
- package/dist/components/tabs/tab-panels.svelte +6 -2
- package/dist/components/tabs/tab-panels.svelte.d.ts +7 -6
- package/dist/components/tabs/tab.svelte +6 -3
- package/dist/components/tabs/tab.svelte.d.ts +4 -3
- package/dist/components/text-editor/code-editor.svelte +16 -18
- package/dist/components/text-editor/code-editor.svelte.d.ts +25 -24
- package/dist/components/text-editor/core.d.ts +5 -3
- package/dist/components/text-editor/core.js +26 -15
- package/dist/components/text-editor/index.d.ts +12 -6
- package/dist/components/text-editor/index.js +7 -3
- package/dist/components/text-editor/lexical-root.svelte +27 -30
- package/dist/components/text-editor/lexical-root.svelte.d.ts +17 -16
- package/dist/components/text-editor/store.svelte.d.ts +2 -1
- package/dist/components/text-editor/store.svelte.js +10 -5
- package/dist/components/text-editor/text-editor.svelte +22 -13
- package/dist/components/text-editor/text-editor.svelte.d.ts +37 -32
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +3 -3
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte.d.ts +6 -6
- package/dist/components/text-editor/toolbar/code-language-switcher.svelte +6 -2
- package/dist/components/text-editor/toolbar/code-language-switcher.svelte.d.ts +2 -2
- package/dist/components/text-editor/toolbar/format-text-button.svelte +6 -2
- package/dist/components/text-editor/toolbar/format-text-button.svelte.d.ts +5 -4
- package/dist/components/text-editor/toolbar/insert-image-button.svelte +6 -2
- package/dist/components/text-editor/toolbar/insert-image-button.svelte.d.ts +5 -4
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +9 -4
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +6 -2
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte.d.ts +5 -4
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +10 -6
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte.d.ts +6 -6
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +8 -5
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +5 -4
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +7 -3
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte.d.ts +9 -8
- package/dist/components/text-editor/transformers/table.d.ts +3 -2
- package/dist/components/text-editor/transformers/table.js +5 -1
- package/dist/components/text-field/number-input.svelte +12 -8
- package/dist/components/text-field/number-input.svelte.d.ts +20 -17
- package/dist/components/text-field/password-input.svelte +8 -4
- package/dist/components/text-field/password-input.svelte.d.ts +10 -7
- package/dist/components/text-field/search-bar.svelte +9 -5
- package/dist/components/text-field/search-bar.svelte.d.ts +14 -11
- package/dist/components/text-field/text-area.svelte +18 -14
- package/dist/components/text-field/text-area.svelte.d.ts +29 -27
- package/dist/components/text-field/text-input.svelte +7 -3
- package/dist/components/text-field/text-input.svelte.d.ts +5 -3
- package/dist/components/toast/toast.svelte +10 -5
- package/dist/components/toast/toast.svelte.d.ts +16 -14
- package/dist/components/toolbar/toolbar.svelte +11 -7
- package/dist/components/toolbar/toolbar.svelte.d.ts +17 -16
- package/dist/components/util/app-shell.svelte +6 -3
- package/dist/components/util/app-shell.svelte.d.ts +7 -8
- package/dist/components/util/group.svelte +8 -4
- package/dist/components/util/group.svelte.d.ts +11 -10
- package/dist/components/util/modal.svelte +7 -3
- package/dist/components/util/modal.svelte.d.ts +2 -1
- package/dist/components/util/placeholder.svelte +5 -1
- package/dist/components/util/placeholder.svelte.d.ts +5 -4
- package/dist/components/util/popup.svelte +23 -17
- package/dist/components/util/popup.svelte.d.ts +36 -33
- package/dist/index.js +3 -3
- package/dist/services/events.svelte.d.ts +2 -1
- package/dist/services/events.svelte.js +12 -8
- package/dist/services/group.svelte.d.ts +2 -1
- package/dist/services/group.svelte.js +16 -12
- package/dist/services/popup.svelte.d.ts +16 -10
- package/dist/services/popup.svelte.js +14 -13
- package/dist/typedefs.d.ts +191 -189
- package/dist/typedefs.js +168 -164
- package/package.json +18 -18
|
@@ -6,109 +6,114 @@ type TextEditor = {
|
|
|
6
6
|
/** A rich text editor based on Lexical. */
|
|
7
7
|
declare const TextEditor: import("svelte").Component<{
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Input value.
|
|
10
10
|
*/
|
|
11
11
|
value?: string | undefined;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Make the text input container flexible.
|
|
14
14
|
*/
|
|
15
15
|
flex?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Enabled modes.
|
|
18
18
|
*/
|
|
19
|
-
modes?:
|
|
19
|
+
modes?: TextEditorMode[] | undefined;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Enabled buttons.
|
|
22
22
|
*/
|
|
23
|
-
buttons?: (
|
|
23
|
+
buttons?: (TextEditorBlockType | TextEditorInlineType)[] | undefined;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Editor components.
|
|
26
26
|
*/
|
|
27
|
-
components?:
|
|
27
|
+
components?: TextEditorComponent[] | undefined;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* The `class` attribute on the wrapper element.
|
|
30
30
|
*/
|
|
31
31
|
class?: string | undefined;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Whether to hide the widget.
|
|
34
34
|
*/
|
|
35
35
|
hidden?: boolean | undefined;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
38
38
|
* attribute.
|
|
39
39
|
*/
|
|
40
40
|
disabled?: boolean | undefined;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Whether to make the widget read-only. An alias of the
|
|
43
43
|
* `aria-readonly` attribute.
|
|
44
44
|
*/
|
|
45
45
|
readonly?: boolean | undefined;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Whether to mark the widget required. An alias of the
|
|
48
48
|
* `aria-required` attribute.
|
|
49
49
|
*/
|
|
50
50
|
required?: boolean | undefined;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Whether to mark the widget invalid. An alias of the
|
|
53
53
|
* `aria-invalid` attribute.
|
|
54
54
|
*/
|
|
55
55
|
invalid?: boolean | undefined;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Primary slot content.
|
|
58
58
|
*/
|
|
59
|
-
children?:
|
|
59
|
+
children?: Snippet<[]> | undefined;
|
|
60
60
|
} & Record<string, any>, {}, "value">;
|
|
61
61
|
type Props = {
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Input value.
|
|
64
64
|
*/
|
|
65
65
|
value?: string | undefined;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Make the text input container flexible.
|
|
68
68
|
*/
|
|
69
69
|
flex?: boolean | undefined;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Enabled modes.
|
|
72
72
|
*/
|
|
73
|
-
modes?:
|
|
73
|
+
modes?: TextEditorMode[] | undefined;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Enabled buttons.
|
|
76
76
|
*/
|
|
77
|
-
buttons?: (
|
|
77
|
+
buttons?: (TextEditorBlockType | TextEditorInlineType)[] | undefined;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Editor components.
|
|
80
80
|
*/
|
|
81
|
-
components?:
|
|
81
|
+
components?: TextEditorComponent[] | undefined;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* The `class` attribute on the wrapper element.
|
|
84
84
|
*/
|
|
85
85
|
class?: string | undefined;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Whether to hide the widget.
|
|
88
88
|
*/
|
|
89
89
|
hidden?: boolean | undefined;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
92
92
|
* attribute.
|
|
93
93
|
*/
|
|
94
94
|
disabled?: boolean | undefined;
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* Whether to make the widget read-only. An alias of the
|
|
97
97
|
* `aria-readonly` attribute.
|
|
98
98
|
*/
|
|
99
99
|
readonly?: boolean | undefined;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Whether to mark the widget required. An alias of the
|
|
102
102
|
* `aria-required` attribute.
|
|
103
103
|
*/
|
|
104
104
|
required?: boolean | undefined;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* Whether to mark the widget invalid. An alias of the
|
|
107
107
|
* `aria-invalid` attribute.
|
|
108
108
|
*/
|
|
109
109
|
invalid?: boolean | undefined;
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Primary slot content.
|
|
112
112
|
*/
|
|
113
|
-
children?:
|
|
113
|
+
children?: Snippet<[]> | undefined;
|
|
114
114
|
};
|
|
115
|
+
import type { TextEditorMode } from '../../typedefs';
|
|
116
|
+
import type { TextEditorBlockType } from '../../typedefs';
|
|
117
|
+
import type { TextEditorInlineType } from '../../typedefs';
|
|
118
|
+
import type { TextEditorComponent } from '../../typedefs';
|
|
119
|
+
import type { Snippet } from 'svelte';
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {object} Props
|
|
8
|
-
* @property {boolean} [hidden]
|
|
9
|
-
* @property {boolean} [disabled]
|
|
8
|
+
* @property {boolean} [hidden] Whether to hide the widget.
|
|
9
|
+
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
10
10
|
* attribute.
|
|
11
|
-
* @property {boolean} [readonly]
|
|
11
|
+
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
12
12
|
* `aria-readonly` attribute.
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -5,32 +5,32 @@ type CodeEditorToolbar = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const CodeEditorToolbar: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Whether to hide the widget.
|
|
9
9
|
*/
|
|
10
10
|
hidden?: boolean | undefined;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
13
13
|
* attribute.
|
|
14
14
|
*/
|
|
15
15
|
disabled?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Whether to make the widget read-only. An alias of the
|
|
18
18
|
* `aria-readonly` attribute.
|
|
19
19
|
*/
|
|
20
20
|
readonly?: boolean | undefined;
|
|
21
21
|
} & Record<string, any>, {}, "">;
|
|
22
22
|
type Props = {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Whether to hide the widget.
|
|
25
25
|
*/
|
|
26
26
|
hidden?: boolean | undefined;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
29
29
|
* attribute.
|
|
30
30
|
*/
|
|
31
31
|
disabled?: boolean | undefined;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Whether to make the widget read-only. An alias of the
|
|
34
34
|
* `aria-readonly` attribute.
|
|
35
35
|
*/
|
|
36
36
|
readonly?: boolean | undefined;
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
import Select from '../../select/select.svelte';
|
|
9
9
|
import { focusEditor, loadCodeHighlighter } from '../core';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @import { TextEditorStore } from '../../../typedefs';
|
|
13
|
+
*/
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* @typedef {object} Props
|
|
13
|
-
* @property {boolean} [disabled]
|
|
17
|
+
* @property {boolean} [disabled] Whether to disable the switcher.
|
|
14
18
|
*/
|
|
15
19
|
|
|
16
20
|
/** @type {Props} */
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
.flat(1)
|
|
40
44
|
.sort((a, b) => a.label.localeCompare(b.label));
|
|
41
45
|
|
|
42
|
-
/** @type {
|
|
46
|
+
/** @type {TextEditorStore} */
|
|
43
47
|
const editorStore = getContext('editorStore');
|
|
44
48
|
|
|
45
49
|
let selectedLanguage = $state('');
|
|
@@ -5,13 +5,13 @@ type CodeLanguageSwitcher = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const CodeLanguageSwitcher: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Whether to disable the switcher.
|
|
9
9
|
*/
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
11
|
}, {}, "">;
|
|
12
12
|
type Props = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Whether to disable the switcher.
|
|
15
15
|
*/
|
|
16
16
|
disabled?: boolean | undefined;
|
|
17
17
|
};
|
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
import Icon from '../../icon/icon.svelte';
|
|
8
8
|
import { focusEditor } from '../core';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import { TextEditorFormatType, TextEditorStore } from '../../../typedefs';
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @typedef {object} Props
|
|
12
|
-
* @property {
|
|
16
|
+
* @property {TextEditorFormatType} type Button type.
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
/**
|
|
@@ -21,7 +25,7 @@
|
|
|
21
25
|
/* eslint-enable prefer-const */
|
|
22
26
|
} = $props();
|
|
23
27
|
|
|
24
|
-
/** @type {
|
|
28
|
+
/** @type {TextEditorStore} */
|
|
25
29
|
const editorStore = getContext('editorStore');
|
|
26
30
|
const selectionTypeMatches = $derived(editorStore.selection.inlineTypes.includes(type));
|
|
27
31
|
</script>
|
|
@@ -5,13 +5,14 @@ type FormatTextButton = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const FormatTextButton: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Button type.
|
|
9
9
|
*/
|
|
10
|
-
type:
|
|
10
|
+
type: TextEditorFormatType;
|
|
11
11
|
} & Record<string, any>, {}, "">;
|
|
12
12
|
type Props = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Button type.
|
|
15
15
|
*/
|
|
16
|
-
type:
|
|
16
|
+
type: TextEditorFormatType;
|
|
17
17
|
};
|
|
18
|
+
import type { TextEditorFormatType } from '../../../typedefs';
|
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
import Button from '../../button/button.svelte';
|
|
8
8
|
import Icon from '../../icon/icon.svelte';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import { TextEditorComponent, TextEditorStore } from '../../../typedefs';
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @typedef {object} Props
|
|
12
|
-
* @property {
|
|
16
|
+
* @property {TextEditorComponent} component Image editor component.
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
/** @type {Props} */
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
/* eslint-enable prefer-const */
|
|
20
24
|
} = $props();
|
|
21
25
|
|
|
22
|
-
/** @type {
|
|
26
|
+
/** @type {TextEditorStore} */
|
|
23
27
|
const editorStore = getContext('editorStore');
|
|
24
28
|
</script>
|
|
25
29
|
|
|
@@ -5,13 +5,14 @@ type InsertImageButton = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const InsertImageButton: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Image editor component.
|
|
9
9
|
*/
|
|
10
|
-
component:
|
|
10
|
+
component: TextEditorComponent;
|
|
11
11
|
}, {}, "">;
|
|
12
12
|
type Props = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Image editor component.
|
|
15
15
|
*/
|
|
16
|
-
component:
|
|
16
|
+
component: TextEditorComponent;
|
|
17
17
|
};
|
|
18
|
+
import type { TextEditorComponent } from '../../../typedefs';
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
import TextInput from '../../text-field/text-input.svelte';
|
|
24
24
|
import { focusEditor } from '../core';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @import { TextEditorStore } from '../../../typedefs';
|
|
28
|
+
* @import { RangeSelection } from 'lexical';
|
|
29
|
+
*/
|
|
30
|
+
|
|
26
31
|
const id = $props.id();
|
|
27
32
|
|
|
28
33
|
/**
|
|
@@ -30,7 +35,7 @@
|
|
|
30
35
|
*/
|
|
31
36
|
const type = 'link';
|
|
32
37
|
|
|
33
|
-
/** @type {
|
|
38
|
+
/** @type {TextEditorStore} */
|
|
34
39
|
const editorStore = getContext('editorStore');
|
|
35
40
|
const selectionTypeMatches = $derived(editorStore.selection.inlineTypes.includes(type));
|
|
36
41
|
|
|
@@ -103,7 +108,7 @@
|
|
|
103
108
|
|
|
104
109
|
/**
|
|
105
110
|
* Handle `keydown` event fired on the input fields on the dialog.
|
|
106
|
-
* @param {KeyboardEvent} event
|
|
111
|
+
* @param {KeyboardEvent} event `keydown` event.
|
|
107
112
|
*/
|
|
108
113
|
const onInputKeyDown = (event) => {
|
|
109
114
|
if (matchShortcuts(event, 'Enter') && anchorURL) {
|
|
@@ -113,7 +118,7 @@
|
|
|
113
118
|
|
|
114
119
|
/**
|
|
115
120
|
* Handle `close` event fired on the dialog. Insert a link with the given URL and optionally text.
|
|
116
|
-
* @param {CustomEvent} event
|
|
121
|
+
* @param {CustomEvent} event `close` event.
|
|
117
122
|
* @see https://github.com/facebook/lexical/discussions/3013
|
|
118
123
|
*/
|
|
119
124
|
const onDialogClose = async (event) => {
|
|
@@ -134,7 +139,7 @@
|
|
|
134
139
|
anchorText = anchorText.trim();
|
|
135
140
|
anchorText ||= anchorURL;
|
|
136
141
|
|
|
137
|
-
const { anchor, focus } = /** @type {
|
|
142
|
+
const { anchor, focus } = /** @type {RangeSelection} */ (_selection);
|
|
138
143
|
const node = createTextNode(anchorText);
|
|
139
144
|
const key = node.getKey();
|
|
140
145
|
|
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
import MenuItem from '../../menu/menu-item.svelte';
|
|
8
8
|
import Menu from '../../menu/menu.svelte';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import { TextEditorComponent, TextEditorStore } from '../../../typedefs';
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @typedef {object} Props
|
|
12
|
-
* @property {
|
|
16
|
+
* @property {TextEditorComponent[]} components Editor components.
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
/** @type {Props} */
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
/* eslint-enable prefer-const */
|
|
20
24
|
} = $props();
|
|
21
25
|
|
|
22
|
-
/** @type {
|
|
26
|
+
/** @type {TextEditorStore} */
|
|
23
27
|
const editorStore = getContext('editorStore');
|
|
24
28
|
</script>
|
|
25
29
|
|
|
@@ -5,13 +5,14 @@ type InsertMenuButton = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const InsertMenuButton: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Editor components.
|
|
9
9
|
*/
|
|
10
|
-
components:
|
|
10
|
+
components: TextEditorComponent[];
|
|
11
11
|
}, {}, "">;
|
|
12
12
|
type Props = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Editor components.
|
|
15
15
|
*/
|
|
16
|
-
components:
|
|
16
|
+
components: TextEditorComponent[];
|
|
17
17
|
};
|
|
18
|
+
import type { TextEditorComponent } from '../../../typedefs';
|
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
import ToggleBlockMenuItem from './toggle-block-menu-item.svelte';
|
|
19
19
|
import ToolbarWrapper from './toolbar-wrapper.svelte';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @import { TextEditorBlockType, TextEditorInlineType, TextEditorStore } from '../../../typedefs';
|
|
23
|
+
*/
|
|
24
|
+
|
|
21
25
|
/**
|
|
22
26
|
* @typedef {object} Props
|
|
23
|
-
* @property {boolean} [hidden]
|
|
24
|
-
* @property {boolean} [disabled]
|
|
27
|
+
* @property {boolean} [hidden] Whether to hide the widget.
|
|
28
|
+
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
25
29
|
* attribute.
|
|
26
|
-
* @property {boolean} [readonly]
|
|
30
|
+
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
27
31
|
* `aria-readonly` attribute.
|
|
28
32
|
*/
|
|
29
33
|
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
/* eslint-enable prefer-const */
|
|
38
42
|
} = $props();
|
|
39
43
|
|
|
40
|
-
/** @type {
|
|
44
|
+
/** @type {TextEditorStore} */
|
|
41
45
|
const editorStore = getContext('editorStore');
|
|
42
46
|
const imageComponent = $derived(editorStore.config.components.find(({ id }) => id === 'image'));
|
|
43
47
|
const otherComponents = $derived(
|
|
@@ -46,7 +50,7 @@
|
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Enabled block level buttons.
|
|
49
|
-
* @type {
|
|
53
|
+
* @type {TextEditorBlockType[]}
|
|
50
54
|
*/
|
|
51
55
|
const blockLevelButtons = $derived(
|
|
52
56
|
unique([
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
65
|
* Enabled inline level buttons.
|
|
62
|
-
* @type {
|
|
66
|
+
* @type {TextEditorInlineType[]}
|
|
63
67
|
*/
|
|
64
68
|
const inlineLevelButtons = $derived(
|
|
65
69
|
unique([
|
|
@@ -5,32 +5,32 @@ type TextEditorToolbar = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const TextEditorToolbar: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Whether to hide the widget.
|
|
9
9
|
*/
|
|
10
10
|
hidden?: boolean | undefined;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
13
13
|
* attribute.
|
|
14
14
|
*/
|
|
15
15
|
disabled?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Whether to make the widget read-only. An alias of the
|
|
18
18
|
* `aria-readonly` attribute.
|
|
19
19
|
*/
|
|
20
20
|
readonly?: boolean | undefined;
|
|
21
21
|
} & Record<string, any>, {}, "">;
|
|
22
22
|
type Props = {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Whether to hide the widget.
|
|
25
25
|
*/
|
|
26
26
|
hidden?: boolean | undefined;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
29
29
|
* attribute.
|
|
30
30
|
*/
|
|
31
31
|
disabled?: boolean | undefined;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Whether to make the widget read-only. An alias of the
|
|
34
34
|
* `aria-readonly` attribute.
|
|
35
35
|
*/
|
|
36
36
|
readonly?: boolean | undefined;
|
|
@@ -17,9 +17,14 @@
|
|
|
17
17
|
import MenuItemCheckbox from '../../menu/menu-item-checkbox.svelte';
|
|
18
18
|
import { focusEditor } from '../core';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @import { TextEditorBlockType, TextEditorStore } from '../../../typedefs';
|
|
22
|
+
* @import { HeadingTagType } from '@lexical/rich-text';
|
|
23
|
+
*/
|
|
24
|
+
|
|
20
25
|
/**
|
|
21
26
|
* @typedef {object} Props
|
|
22
|
-
* @property {
|
|
27
|
+
* @property {TextEditorBlockType} type Button type.
|
|
23
28
|
*/
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -31,7 +36,7 @@
|
|
|
31
36
|
/* eslint-enable prefer-const */
|
|
32
37
|
} = $props();
|
|
33
38
|
|
|
34
|
-
/** @type {
|
|
39
|
+
/** @type {TextEditorStore} */
|
|
35
40
|
const editorStore = getContext('editorStore');
|
|
36
41
|
const selectionTypeMatches = $derived(editorStore.selection.blockType === type);
|
|
37
42
|
|
|
@@ -50,9 +55,7 @@
|
|
|
50
55
|
if (headingLevel) {
|
|
51
56
|
editorStore.editor.update(() => {
|
|
52
57
|
setBlocksType(getSelection(), () =>
|
|
53
|
-
createHeadingNode(
|
|
54
|
-
/** @type {import('@lexical/rich-text').HeadingTagType} */ (`h${headingLevel}`),
|
|
55
|
-
),
|
|
58
|
+
createHeadingNode(/** @type {HeadingTagType} */ (`h${headingLevel}`)),
|
|
56
59
|
);
|
|
57
60
|
});
|
|
58
61
|
}
|
|
@@ -5,13 +5,14 @@ type ToggleBlockMenuItem = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const ToggleBlockMenuItem: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Button type.
|
|
9
9
|
*/
|
|
10
|
-
type:
|
|
10
|
+
type: TextEditorBlockType;
|
|
11
11
|
} & Record<string, any>, {}, "">;
|
|
12
12
|
type Props = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Button type.
|
|
15
15
|
*/
|
|
16
|
-
type:
|
|
16
|
+
type: TextEditorBlockType;
|
|
17
17
|
};
|
|
18
|
+
import type { TextEditorBlockType } from '../../../typedefs';
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Toolbar from '../../toolbar/toolbar.svelte';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import { Snippet } from 'svelte';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* @typedef {object} Props
|
|
6
|
-
* @property {boolean} [disabled]
|
|
10
|
+
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
7
11
|
* attribute.
|
|
8
|
-
* @property {boolean} [readonly]
|
|
12
|
+
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
9
13
|
* `aria-readonly` attribute.
|
|
10
|
-
* @property {
|
|
14
|
+
* @property {Snippet} [children] Primary slot content.
|
|
11
15
|
*/
|
|
12
16
|
|
|
13
17
|
/**
|
|
@@ -5,33 +5,34 @@ type ToolbarWrapper = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const ToolbarWrapper: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
9
9
|
* attribute.
|
|
10
10
|
*/
|
|
11
11
|
disabled?: boolean | undefined;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Whether to make the widget read-only. An alias of the
|
|
14
14
|
* `aria-readonly` attribute.
|
|
15
15
|
*/
|
|
16
16
|
readonly?: boolean | undefined;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Primary slot content.
|
|
19
19
|
*/
|
|
20
|
-
children?:
|
|
20
|
+
children?: Snippet<[]> | undefined;
|
|
21
21
|
} & Record<string, any>, {}, "code" | "lang">;
|
|
22
22
|
type Props = {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
25
25
|
* attribute.
|
|
26
26
|
*/
|
|
27
27
|
disabled?: boolean | undefined;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Whether to make the widget read-only. An alias of the
|
|
30
30
|
* `aria-readonly` attribute.
|
|
31
31
|
*/
|
|
32
32
|
readonly?: boolean | undefined;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Primary slot content.
|
|
35
35
|
*/
|
|
36
|
-
children?:
|
|
36
|
+
children?: Snippet<[]> | undefined;
|
|
37
37
|
};
|
|
38
|
+
import type { Snippet } from 'svelte';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @type {
|
|
2
|
+
* @type {ElementTransformer}
|
|
3
3
|
*/
|
|
4
|
-
export const TABLE:
|
|
4
|
+
export const TABLE: ElementTransformer;
|
|
5
|
+
import type { ElementTransformer } from '@lexical/markdown';
|
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
} from '@lexical/table';
|
|
24
24
|
import { $isParagraphNode as isParagraphNode, $isTextNode as isTextNode } from 'lexical';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @import { ElementTransformer } from '@lexical/markdown';
|
|
28
|
+
*/
|
|
29
|
+
|
|
26
30
|
const TABLE_ROW_REG_EXP = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
27
31
|
const TABLE_ROW_DIVIDER_REG_EXP = /^(\| ?:?-*:? ?)+\|\s?$/;
|
|
28
32
|
|
|
@@ -68,7 +72,7 @@ const mapToTableCells = (textContent) => {
|
|
|
68
72
|
};
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
|
-
* @type {
|
|
75
|
+
* @type {ElementTransformer}
|
|
72
76
|
*/
|
|
73
77
|
export const TABLE = {
|
|
74
78
|
dependencies: [TableNode, TableRowNode, TableCellNode],
|