@sveltia/ui 0.15.16 → 0.17.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.
- package/package/components/alert/alert.svelte +22 -7
- package/package/components/alert/alert.svelte.d.ts +47 -31
- package/package/components/button/button-group.svelte +16 -6
- package/package/components/button/button-group.svelte.d.ts +38 -28
- package/package/components/button/button.svelte +41 -136
- package/package/components/button/button.svelte.d.ts +20 -162
- package/package/components/button/select-button-group.svelte +31 -37
- package/package/components/button/select-button-group.svelte.d.ts +91 -39
- package/package/components/button/select-button.svelte +19 -62
- package/package/components/button/select-button.svelte.d.ts +31 -65
- package/package/components/button/split-button.svelte +37 -47
- package/package/components/button/split-button.svelte.d.ts +54 -60
- package/package/components/calendar/calendar.svelte +80 -55
- package/package/components/calendar/calendar.svelte.d.ts +30 -26
- package/package/components/checkbox/checkbox-group.svelte +23 -20
- package/package/components/checkbox/checkbox-group.svelte.d.ts +64 -32
- package/package/components/checkbox/checkbox.svelte +57 -67
- package/package/components/checkbox/checkbox.svelte.d.ts +81 -53
- package/package/components/dialog/alert-dialog.svelte +9 -36
- package/package/components/dialog/alert-dialog.svelte.d.ts +20 -49
- package/package/components/dialog/confirmation-dialog.svelte +9 -41
- package/package/components/dialog/confirmation-dialog.svelte.d.ts +20 -51
- package/package/components/dialog/dialog.svelte +60 -105
- package/package/components/dialog/dialog.svelte.d.ts +19 -86
- package/package/components/dialog/prompt-dialog.svelte +32 -61
- package/package/components/dialog/prompt-dialog.svelte.d.ts +53 -65
- package/package/components/disclosure/disclosure.svelte +39 -34
- package/package/components/disclosure/disclosure.svelte.d.ts +88 -57
- package/package/components/divider/divider.svelte +18 -14
- package/package/components/divider/divider.svelte.d.ts +48 -26
- package/package/components/divider/spacer.svelte +13 -8
- package/package/components/divider/spacer.svelte.d.ts +37 -25
- package/package/components/drawer/drawer.svelte +63 -76
- package/package/components/drawer/drawer.svelte.d.ts +116 -70
- package/package/components/grid/grid-body.svelte +15 -10
- package/package/components/grid/grid-body.svelte.d.ts +45 -29
- package/package/components/grid/grid-cell.svelte +16 -6
- package/package/components/grid/grid-cell.svelte.d.ts +38 -28
- package/package/components/grid/grid-col-header.svelte +16 -6
- package/package/components/grid/grid-col-header.svelte.d.ts +38 -28
- package/package/components/grid/grid-foot.svelte +16 -6
- package/package/components/grid/grid-foot.svelte.d.ts +38 -28
- package/package/components/grid/grid-head.svelte +16 -6
- package/package/components/grid/grid-head.svelte.d.ts +38 -28
- package/package/components/grid/grid-row-header.svelte +16 -6
- package/package/components/grid/grid-row-header.svelte.d.ts +38 -28
- package/package/components/grid/grid-row.svelte +19 -23
- package/package/components/grid/grid-row.svelte.d.ts +63 -43
- package/package/components/grid/grid.svelte +26 -25
- package/package/components/grid/grid.svelte.d.ts +71 -37
- package/package/components/icon/icon.svelte +14 -9
- package/package/components/icon/icon.svelte.d.ts +37 -25
- package/package/components/listbox/listbox.svelte +46 -52
- package/package/components/listbox/listbox.svelte.d.ts +117 -45
- package/package/components/listbox/option-group.svelte +23 -19
- package/package/components/listbox/option-group.svelte.d.ts +64 -32
- package/package/components/listbox/option.svelte +44 -57
- package/package/components/listbox/option.svelte.d.ts +68 -74
- package/package/components/menu/menu-button.svelte +42 -63
- package/package/components/menu/menu-button.svelte.d.ts +35 -62
- package/package/components/menu/menu-item-checkbox.svelte +29 -41
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +20 -49
- package/package/components/menu/menu-item-group.svelte +22 -19
- package/package/components/menu/menu-item-group.svelte.d.ts +56 -32
- package/package/components/menu/menu-item-radio.svelte +29 -41
- package/package/components/menu/menu-item-radio.svelte.d.ts +20 -49
- package/package/components/menu/menu-item.svelte +66 -75
- package/package/components/menu/menu-item.svelte.d.ts +19 -68
- package/package/components/menu/menu.svelte +25 -22
- package/package/components/menu/menu.svelte.d.ts +65 -35
- package/package/components/radio/radio-group.svelte +36 -42
- package/package/components/radio/radio-group.svelte.d.ts +100 -40
- package/package/components/radio/radio.svelte +45 -48
- package/package/components/radio/radio.svelte.d.ts +111 -47
- package/package/components/select/combobox.svelte +76 -101
- package/package/components/select/combobox.svelte.d.ts +19 -54
- package/package/components/select/select-tags.svelte +48 -59
- package/package/components/select/select-tags.svelte.d.ts +127 -45
- package/package/components/select/select.svelte +18 -37
- package/package/components/select/select.svelte.d.ts +20 -45
- package/package/components/slider/slider.svelte +71 -68
- package/package/components/slider/slider.svelte.d.ts +159 -47
- package/package/components/switch/switch.svelte +36 -46
- package/package/components/switch/switch.svelte.d.ts +98 -42
- package/package/components/table/table-body.svelte +15 -11
- package/package/components/table/table-body.svelte.d.ts +45 -29
- package/package/components/table/table-cell.svelte +16 -6
- package/package/components/table/table-cell.svelte.d.ts +38 -28
- package/package/components/table/table-col-header.svelte +16 -6
- package/package/components/table/table-col-header.svelte.d.ts +38 -28
- package/package/components/table/table-foot.svelte +16 -6
- package/package/components/table/table-foot.svelte.d.ts +38 -28
- package/package/components/table/table-head.svelte +16 -6
- package/package/components/table/table-head.svelte.d.ts +38 -28
- package/package/components/table/table-row-header.svelte +16 -6
- package/package/components/table/table-row-header.svelte.d.ts +38 -28
- package/package/components/table/table-row.svelte +16 -6
- package/package/components/table/table-row.svelte.d.ts +38 -28
- package/package/components/table/table.svelte +16 -6
- package/package/components/table/table.svelte.d.ts +38 -28
- package/package/components/tabs/tab-box.svelte +16 -9
- package/package/components/tabs/tab-box.svelte.d.ts +47 -27
- package/package/components/tabs/tab-list.svelte +36 -35
- package/package/components/tabs/tab-list.svelte.d.ts +80 -38
- package/package/components/tabs/tab-panel.svelte +16 -6
- package/package/components/tabs/tab-panel.svelte.d.ts +38 -28
- package/package/components/tabs/tab-panels.svelte +16 -6
- package/package/components/tabs/tab-panels.svelte.d.ts +38 -26
- package/package/components/tabs/tab.svelte +28 -25
- package/package/components/tabs/tab.svelte.d.ts +31 -55
- package/package/components/text-editor/lexical-root.svelte +38 -32
- package/package/components/text-editor/lexical-root.svelte.d.ts +91 -29
- package/package/components/text-editor/text-editor.svelte +63 -79
- package/package/components/text-editor/text-editor.svelte.d.ts +114 -36
- package/package/components/text-editor/toolbar/editor-toolbar.svelte +41 -24
- package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +49 -23
- package/package/components/text-editor/toolbar/format-text-button.svelte +15 -5
- package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +30 -22
- package/package/components/text-editor/toolbar/insert-link-button.svelte +18 -16
- package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +20 -23
- package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +19 -7
- package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +30 -22
- package/package/components/text-field/number-input.svelte +63 -81
- package/package/components/text-field/number-input.svelte.d.ts +62 -68
- package/package/components/text-field/password-input.svelte +38 -57
- package/package/components/text-field/password-input.svelte.d.ts +30 -58
- package/package/components/text-field/search-bar.svelte +45 -62
- package/package/components/text-field/search-bar.svelte.d.ts +42 -87
- package/package/components/text-field/text-area.svelte +38 -54
- package/package/components/text-field/text-area.svelte.d.ts +116 -50
- package/package/components/text-field/text-input.svelte +30 -86
- package/package/components/text-field/text-input.svelte.d.ts +20 -105
- package/package/components/toast/toast.svelte +36 -30
- package/package/components/toast/toast.svelte.d.ts +65 -33
- package/package/components/toolbar/toolbar.svelte +25 -25
- package/package/components/toolbar/toolbar.svelte.d.ts +72 -34
- package/package/components/util/app-shell.svelte +22 -10
- package/package/components/util/app-shell.svelte.d.ts +40 -34
- package/package/components/util/group.svelte +20 -15
- package/package/components/util/group.svelte.d.ts +55 -31
- package/package/components/util/modal.svelte +89 -105
- package/package/components/util/modal.svelte.d.ts +24 -82
- package/package/components/util/placeholder.svelte +21 -0
- package/package/components/util/placeholder.svelte.d.ts +34 -0
- package/package/components/util/popup.svelte +65 -62
- package/package/components/util/popup.svelte.d.ts +104 -82
- package/package/services/{group.js → group.svelte.js} +11 -12
- package/package/services/{popup.js → popup.svelte.js} +6 -5
- package/package/typedefs.d.ts +545 -0
- package/package/typedefs.js +202 -0
- package/package.json +16 -23
- package/package/components/util/portal.svelte +0 -36
- package/package/components/util/portal.svelte.d.ts +0 -32
- /package/package/services/{events.d.ts → events.svelte.d.ts} +0 -0
- /package/package/services/{events.js → events.svelte.js} +0 -0
- /package/package/services/{group.d.ts → group.svelte.d.ts} +0 -0
- /package/package/services/{popup.d.ts → popup.svelte.d.ts} +0 -0
|
@@ -1,44 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default TextEditor;
|
|
2
|
+
type TextEditor = SvelteComponent<Props & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "value" | undefined;
|
|
6
|
+
};
|
|
4
7
|
/** A rich text editor based on Lexical. */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
required?: boolean | undefined;
|
|
8
|
+
declare const TextEditor: $$__sveltets_2_IsomorphicComponent<{
|
|
9
|
+
/**
|
|
10
|
+
* - Input value.
|
|
11
|
+
*/
|
|
10
12
|
value?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* - Make the text input container flexible.
|
|
15
|
+
*/
|
|
16
|
+
flex?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* - Enabled modes.
|
|
19
|
+
*/
|
|
20
|
+
modes?: import("../../typedefs").TextEditorMode[] | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* - Enabled buttons.
|
|
23
|
+
*/
|
|
24
|
+
buttons?: (import("../../typedefs").TextEditorBlockType | import("../../typedefs").TextEditorInlineType)[] | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* - The `class` attribute on the wrapper element.
|
|
27
|
+
*/
|
|
28
|
+
class?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* - Whether to hide the widget.
|
|
31
|
+
*/
|
|
11
32
|
hidden?: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
35
|
+
* attribute.
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* - Whether to make the widget read-only. An alias of the
|
|
40
|
+
* `aria-readonly` attribute.
|
|
41
|
+
*/
|
|
12
42
|
readonly?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* - Whether to mark the widget required. An alias of the
|
|
45
|
+
* `aria-required` attribute.
|
|
46
|
+
*/
|
|
47
|
+
required?: boolean | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* - Whether to mark the widget invalid. An alias of the
|
|
50
|
+
* `aria-invalid` attribute.
|
|
51
|
+
*/
|
|
52
|
+
invalid?: boolean | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* - Primary slot content.
|
|
55
|
+
*/
|
|
56
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
57
|
+
} & Record<string, any>, {
|
|
58
|
+
[evt: string]: CustomEvent<any>;
|
|
59
|
+
}, {}, {}, "value">;
|
|
60
|
+
type Props = {
|
|
61
|
+
/**
|
|
62
|
+
* - Input value.
|
|
63
|
+
*/
|
|
64
|
+
value?: string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* - Make the text input container flexible.
|
|
67
|
+
*/
|
|
13
68
|
flex?: boolean | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* - Enabled modes.
|
|
71
|
+
*/
|
|
14
72
|
modes?: import("../../typedefs").TextEditorMode[] | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* - Enabled buttons.
|
|
75
|
+
*/
|
|
15
76
|
buttons?: (import("../../typedefs").TextEditorBlockType | import("../../typedefs").TextEditorInlineType)[] | undefined;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
77
|
+
/**
|
|
78
|
+
* - The `class` attribute on the wrapper element.
|
|
79
|
+
*/
|
|
80
|
+
class?: string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* - Whether to hide the widget.
|
|
83
|
+
*/
|
|
84
|
+
hidden?: boolean | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
87
|
+
* attribute.
|
|
88
|
+
*/
|
|
89
|
+
disabled?: boolean | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* - Whether to make the widget read-only. An alias of the
|
|
92
|
+
* `aria-readonly` attribute.
|
|
93
|
+
*/
|
|
94
|
+
readonly?: boolean | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* - Whether to mark the widget required. An alias of the
|
|
97
|
+
* `aria-required` attribute.
|
|
98
|
+
*/
|
|
99
|
+
required?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* - Whether to mark the widget invalid. An alias of the
|
|
102
|
+
* `aria-invalid` attribute.
|
|
103
|
+
*/
|
|
104
|
+
invalid?: boolean | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* - Primary slot content.
|
|
107
|
+
*/
|
|
108
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
43
109
|
};
|
|
44
|
-
|
|
110
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
111
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
112
|
+
$$bindings?: Bindings;
|
|
113
|
+
} & Exports;
|
|
114
|
+
(internal: unknown, props: Props & {
|
|
115
|
+
$$events?: Events;
|
|
116
|
+
$$slots?: Slots;
|
|
117
|
+
}): Exports & {
|
|
118
|
+
$set?: any;
|
|
119
|
+
$on?: any;
|
|
120
|
+
};
|
|
121
|
+
z_$$bindings?: Bindings;
|
|
122
|
+
}
|
|
@@ -16,15 +16,23 @@
|
|
|
16
16
|
import ToggleBlockMenuItem from './toggle-block-menu-item.svelte';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
19
|
+
* @typedef {object} Props
|
|
20
|
+
* @property {boolean} [hidden] - Whether to hide the widget.
|
|
21
|
+
* @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
|
|
22
|
+
* attribute.
|
|
23
|
+
* @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
|
|
24
|
+
* `aria-readonly` attribute.
|
|
21
25
|
*/
|
|
22
|
-
|
|
26
|
+
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @type {boolean}
|
|
28
|
+
* @type {Props & Record<string, any>}
|
|
26
29
|
*/
|
|
27
|
-
|
|
30
|
+
let {
|
|
31
|
+
/* eslint-disable prefer-const */
|
|
32
|
+
disabled = false,
|
|
33
|
+
readonly = false,
|
|
34
|
+
/* eslint-enable prefer-const */
|
|
35
|
+
} = $props();
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
38
|
* Text editor state.
|
|
@@ -44,17 +52,21 @@
|
|
|
44
52
|
* Enabled block level buttons.
|
|
45
53
|
* @type {import('../../../typedefs').TextEditorBlockType[]}
|
|
46
54
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
const blockLevelButtons = $derived(
|
|
56
|
+
unique([
|
|
57
|
+
'paragraph', // Always needed
|
|
58
|
+
...enabledButtons.filter((type) => blockButtonTypes.includes(/** @type {any} */ (type))),
|
|
59
|
+
]),
|
|
60
|
+
);
|
|
51
61
|
|
|
52
62
|
/**
|
|
53
63
|
* Enabled inline level buttons.
|
|
54
64
|
* @type {import('../../../typedefs').TextEditorInlineType[]}
|
|
55
65
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
const inlineLevelButtons = $derived(
|
|
67
|
+
unique([
|
|
68
|
+
...enabledButtons.filter((type) => inlineButtonTypes.includes(/** @type {any} */ (type))),
|
|
69
|
+
]),
|
|
58
70
|
);
|
|
59
71
|
</script>
|
|
60
72
|
|
|
@@ -65,16 +77,19 @@
|
|
|
65
77
|
aria-label={$_('_sui.text_editor.show_text_style_options')}
|
|
66
78
|
aria-controls="{$editorId}-lexical-root"
|
|
67
79
|
>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
{#snippet startIcon()}
|
|
81
|
+
<Icon name={availableButtons[$selectionBlockType]?.icon ?? 'format_paragraph'} />
|
|
82
|
+
{/snippet}
|
|
83
|
+
{#snippet endIcon()}
|
|
84
|
+
<Icon name="arrow_drop_down" class="small-arrow" />
|
|
85
|
+
{/snippet}
|
|
86
|
+
{#snippet popup()}
|
|
87
|
+
<Menu aria-label={$_('_sui.text_editor.text_style_options')}>
|
|
88
|
+
{#each blockLevelButtons as type (type)}
|
|
89
|
+
<ToggleBlockMenuItem {type} />
|
|
90
|
+
{/each}
|
|
91
|
+
</Menu>
|
|
92
|
+
{/snippet}
|
|
78
93
|
</MenuButton>
|
|
79
94
|
{#if inlineLevelButtons.length}
|
|
80
95
|
<Divider orientation="vertical" />
|
|
@@ -95,7 +110,7 @@
|
|
|
95
110
|
disabled={$hasConverterError}
|
|
96
111
|
pressed={!$useRichText}
|
|
97
112
|
aria-label={$_('_sui.text_editor.edit_in_markdown')}
|
|
98
|
-
|
|
113
|
+
onclick={() => {
|
|
99
114
|
$useRichText = !$useRichText;
|
|
100
115
|
|
|
101
116
|
if ($useRichText) {
|
|
@@ -103,7 +118,9 @@
|
|
|
103
118
|
}
|
|
104
119
|
}}
|
|
105
120
|
>
|
|
106
|
-
|
|
121
|
+
{#snippet startIcon()}
|
|
122
|
+
<Icon name="markdown" />
|
|
123
|
+
{/snippet}
|
|
107
124
|
</Button>
|
|
108
125
|
{/if}
|
|
109
126
|
</Toolbar>
|
|
@@ -1,27 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default EditorToolbar;
|
|
2
|
+
type EditorToolbar = SvelteComponent<Props & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
6
|
+
};
|
|
7
|
+
declare const EditorToolbar: $$__sveltets_2_IsomorphicComponent<{
|
|
8
|
+
/**
|
|
9
|
+
* - Whether to hide the widget.
|
|
10
|
+
*/
|
|
11
|
+
hidden?: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
14
|
+
* attribute.
|
|
15
|
+
*/
|
|
5
16
|
disabled?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* - Whether to make the widget read-only. An alias of the
|
|
19
|
+
* `aria-readonly` attribute.
|
|
20
|
+
*/
|
|
6
21
|
readonly?: boolean | undefined;
|
|
7
|
-
}, {
|
|
22
|
+
} & Record<string, any>, {
|
|
8
23
|
[evt: string]: CustomEvent<any>;
|
|
9
|
-
}, {}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
bindings?: undefined;
|
|
24
|
+
}, {}, {}, "">;
|
|
25
|
+
type Props = {
|
|
26
|
+
/**
|
|
27
|
+
* - Whether to hide the widget.
|
|
28
|
+
*/
|
|
29
|
+
hidden?: boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
32
|
+
* attribute.
|
|
33
|
+
*/
|
|
34
|
+
disabled?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* - Whether to make the widget read-only. An alias of the
|
|
37
|
+
* `aria-readonly` attribute.
|
|
38
|
+
*/
|
|
39
|
+
readonly?: boolean | undefined;
|
|
26
40
|
};
|
|
27
|
-
|
|
41
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
42
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
43
|
+
$$bindings?: Bindings;
|
|
44
|
+
} & Exports;
|
|
45
|
+
(internal: unknown, props: Props & {
|
|
46
|
+
$$events?: Events;
|
|
47
|
+
$$slots?: Slots;
|
|
48
|
+
}): Exports & {
|
|
49
|
+
$set?: any;
|
|
50
|
+
$on?: any;
|
|
51
|
+
};
|
|
52
|
+
z_$$bindings?: Bindings;
|
|
53
|
+
}
|
|
@@ -7,10 +7,18 @@
|
|
|
7
7
|
import Icon from '../../icon/icon.svelte';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
10
|
+
* @typedef {object} Props
|
|
11
|
+
* @property {import('../../../typedefs').TextEditorFormatType} type - Button type.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {Props & Record<string, any>}
|
|
16
|
+
*/
|
|
17
|
+
let {
|
|
18
|
+
/* eslint-disable prefer-const */
|
|
19
|
+
type,
|
|
20
|
+
/* eslint-enable prefer-const */
|
|
21
|
+
} = $props();
|
|
14
22
|
|
|
15
23
|
/**
|
|
16
24
|
* Text editor state.
|
|
@@ -25,9 +33,11 @@
|
|
|
25
33
|
aria-controls="{$editorId}-lexical-root"
|
|
26
34
|
disabled={!$useRichText}
|
|
27
35
|
pressed={$selectionInlineTypes.includes(type)}
|
|
28
|
-
|
|
36
|
+
onclick={() => {
|
|
29
37
|
$editor.dispatchCommand(FORMAT_TEXT_COMMAND, type);
|
|
30
38
|
}}
|
|
31
39
|
>
|
|
32
|
-
|
|
40
|
+
{#snippet startIcon()}
|
|
41
|
+
<Icon name={availableButtons[type].icon} />
|
|
42
|
+
{/snippet}
|
|
33
43
|
</Button>
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default FormatTextButton;
|
|
2
|
+
type FormatTextButton = SvelteComponent<Props & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
6
|
+
};
|
|
7
|
+
declare const FormatTextButton: $$__sveltets_2_IsomorphicComponent<{
|
|
8
|
+
/**
|
|
9
|
+
* - Button type.
|
|
10
|
+
*/
|
|
5
11
|
type: import("../../../typedefs").TextEditorFormatType;
|
|
6
|
-
}, {
|
|
12
|
+
} & Record<string, any>, {
|
|
7
13
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
type: import("../../../typedefs").TextEditorFormatType;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
exports?: undefined;
|
|
23
|
-
bindings?: undefined;
|
|
14
|
+
}, {}, {}, "">;
|
|
15
|
+
type Props = {
|
|
16
|
+
/**
|
|
17
|
+
* - Button type.
|
|
18
|
+
*/
|
|
19
|
+
type: import("../../../typedefs").TextEditorFormatType;
|
|
24
20
|
};
|
|
25
|
-
|
|
21
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
22
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
23
|
+
$$bindings?: Bindings;
|
|
24
|
+
} & Exports;
|
|
25
|
+
(internal: unknown, props: Props & {
|
|
26
|
+
$$events?: Events;
|
|
27
|
+
$$slots?: Slots;
|
|
28
|
+
}): Exports & {
|
|
29
|
+
$set?: any;
|
|
30
|
+
$on?: any;
|
|
31
|
+
};
|
|
32
|
+
z_$$bindings?: Bindings;
|
|
33
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { getContext } from 'svelte';
|
|
15
15
|
import { _ } from 'svelte-i18n';
|
|
16
16
|
import { availableButtons } from '..';
|
|
17
|
-
import { isMac, matchShortcuts } from '../../../services/events';
|
|
17
|
+
import { isMac, matchShortcuts } from '../../../services/events.svelte';
|
|
18
18
|
import Button from '../../button/button.svelte';
|
|
19
19
|
import Dialog from '../../dialog/dialog.svelte';
|
|
20
20
|
import Icon from '../../icon/icon.svelte';
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
*/
|
|
34
34
|
const { editor, editorId, selectionInlineTypes, useRichText } = getContext('state');
|
|
35
35
|
|
|
36
|
-
let openDialog = false;
|
|
36
|
+
let openDialog = $state(false);
|
|
37
37
|
/** @type {'create' | 'update' | 'remove'} */
|
|
38
|
-
let dialogMode = 'create';
|
|
39
|
-
let hasAnchor = false;
|
|
40
|
-
let anchorURL = '';
|
|
41
|
-
let anchorText = '';
|
|
38
|
+
let dialogMode = $state('create');
|
|
39
|
+
let hasAnchor = $state(false);
|
|
40
|
+
let anchorURL = $state('');
|
|
41
|
+
let anchorText = $state('');
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Create a new link by showing a dialog to accept a URL and optionally text.
|
|
@@ -163,11 +163,11 @@
|
|
|
163
163
|
);
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
$effect(() => {
|
|
167
167
|
if ($editor) {
|
|
168
168
|
_registerCommand();
|
|
169
169
|
}
|
|
170
|
-
}
|
|
170
|
+
});
|
|
171
171
|
</script>
|
|
172
172
|
|
|
173
173
|
<Button
|
|
@@ -176,11 +176,13 @@
|
|
|
176
176
|
aria-controls="{$editorId}-lexical-root"
|
|
177
177
|
disabled={!$useRichText}
|
|
178
178
|
pressed={$selectionInlineTypes.includes(type)}
|
|
179
|
-
|
|
179
|
+
onclick={() => {
|
|
180
180
|
onButtonClick();
|
|
181
181
|
}}
|
|
182
182
|
>
|
|
183
|
-
|
|
183
|
+
{#snippet startIcon()}
|
|
184
|
+
<Icon name={availableButtons[type].icon} />
|
|
185
|
+
{/snippet}
|
|
184
186
|
</Button>
|
|
185
187
|
|
|
186
188
|
<Dialog
|
|
@@ -191,7 +193,7 @@
|
|
|
191
193
|
bind:value={anchorURL}
|
|
192
194
|
okDisabled={!isURL(anchorURL)}
|
|
193
195
|
okLabel={dialogMode === 'create' ? $_('_sui.insert') : $_('_sui.update')}
|
|
194
|
-
|
|
196
|
+
onClose={(event) => {
|
|
195
197
|
onDialogClose(event);
|
|
196
198
|
}}
|
|
197
199
|
>
|
|
@@ -203,7 +205,7 @@
|
|
|
203
205
|
autofocus
|
|
204
206
|
bind:value={anchorText}
|
|
205
207
|
flex
|
|
206
|
-
|
|
208
|
+
onkeydown={(event) => {
|
|
207
209
|
onInputKeyDown(event);
|
|
208
210
|
}}
|
|
209
211
|
/>
|
|
@@ -217,22 +219,22 @@
|
|
|
217
219
|
bind:value={anchorURL}
|
|
218
220
|
flex
|
|
219
221
|
aria-label="URL"
|
|
220
|
-
|
|
222
|
+
onkeydown={(event) => {
|
|
221
223
|
onInputKeyDown(event);
|
|
222
224
|
}}
|
|
223
225
|
/>
|
|
224
226
|
</div>
|
|
225
|
-
|
|
227
|
+
{#snippet footerExtra()}
|
|
226
228
|
{#if dialogMode !== 'create'}
|
|
227
229
|
<Button
|
|
228
230
|
variant="secondary"
|
|
229
231
|
label={$_('_sui.remove')}
|
|
230
|
-
|
|
232
|
+
onclick={() => {
|
|
231
233
|
removeLink();
|
|
232
234
|
dialogMode = 'remove';
|
|
233
235
|
openDialog = false;
|
|
234
236
|
}}
|
|
235
237
|
/>
|
|
236
238
|
{/if}
|
|
237
|
-
|
|
239
|
+
{/snippet}
|
|
238
240
|
</Dialog>
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof __propDef.slots} InsertLinkButtonSlots */
|
|
4
|
-
export default class InsertLinkButton extends SvelteComponent<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
1
|
+
export default InsertLinkButton;
|
|
2
|
+
type InsertLinkButton = SvelteComponent<Record<string, never>, {
|
|
7
3
|
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
|
|
10
|
-
export type InsertLinkButtonProps = typeof __propDef.props;
|
|
11
|
-
export type InsertLinkButtonEvents = typeof __propDef.events;
|
|
12
|
-
export type InsertLinkButtonSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponent } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
exports?: undefined;
|
|
23
|
-
bindings?: undefined;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
24
6
|
};
|
|
25
|
-
|
|
7
|
+
declare const InsertLinkButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
}, {}, {}, "">;
|
|
10
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
11
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
12
|
+
$$bindings?: Bindings;
|
|
13
|
+
} & Exports;
|
|
14
|
+
(internal: unknown, props: {
|
|
15
|
+
$$events?: Events;
|
|
16
|
+
$$slots?: Slots;
|
|
17
|
+
}): Exports & {
|
|
18
|
+
$set?: any;
|
|
19
|
+
$on?: any;
|
|
20
|
+
};
|
|
21
|
+
z_$$bindings?: Bindings;
|
|
22
|
+
}
|
|
@@ -12,13 +12,22 @@
|
|
|
12
12
|
import { getContext } from 'svelte';
|
|
13
13
|
import { _ } from 'svelte-i18n';
|
|
14
14
|
import { availableButtons } from '..';
|
|
15
|
+
import Icon from '../../icon/icon.svelte';
|
|
15
16
|
import MenuItemCheckbox from '../../menu/menu-item-checkbox.svelte';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
19
|
+
* @typedef {object} Props
|
|
20
|
+
* @property {import('../../../typedefs').TextEditorBlockType} type - Button type.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {Props & Record<string, any>}
|
|
25
|
+
*/
|
|
26
|
+
let {
|
|
27
|
+
/* eslint-disable prefer-const */
|
|
28
|
+
type,
|
|
29
|
+
/* eslint-enable prefer-const */
|
|
30
|
+
} = $props();
|
|
22
31
|
|
|
23
32
|
/**
|
|
24
33
|
* Text editor state.
|
|
@@ -29,7 +38,7 @@
|
|
|
29
38
|
/**
|
|
30
39
|
* Whether the current selection matches the button {@link type}.
|
|
31
40
|
*/
|
|
32
|
-
|
|
41
|
+
const selectionTypeMatches = $derived($selectionBlockType === type);
|
|
33
42
|
|
|
34
43
|
/**
|
|
35
44
|
* Change the current selection’s type to {@link type}.
|
|
@@ -76,13 +85,16 @@
|
|
|
76
85
|
|
|
77
86
|
{#key selectionTypeMatches}
|
|
78
87
|
<MenuItemCheckbox
|
|
79
|
-
iconName={availableButtons[type].icon}
|
|
80
88
|
label={$_(`_sui.text_editor.${availableButtons[type].labelKey}`)}
|
|
81
89
|
checked={selectionTypeMatches}
|
|
82
|
-
|
|
90
|
+
onclick={() => {
|
|
83
91
|
if (!selectionTypeMatches) {
|
|
84
92
|
changeBlockType();
|
|
85
93
|
}
|
|
86
94
|
}}
|
|
87
|
-
|
|
95
|
+
>
|
|
96
|
+
{#snippet startIcon()}
|
|
97
|
+
<Icon name={availableButtons[type].icon} />
|
|
98
|
+
{/snippet}
|
|
99
|
+
</MenuItemCheckbox>
|
|
88
100
|
{/key}
|