@sveltia/ui 0.20.2 → 0.22.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 → dist}/components/button/button.svelte +1 -1
- package/{package → dist}/components/button/select-button-group.svelte +3 -0
- package/{package → dist}/components/calendar/calendar.svelte +1 -1
- package/{package → dist}/components/checkbox/checkbox.svelte +9 -2
- package/{package → dist}/components/grid/grid.svelte +1 -1
- package/{package → dist}/components/listbox/listbox.svelte +3 -0
- package/{package → dist}/components/menu/menu-button.svelte +1 -1
- package/{package → dist}/components/progressbar/progressbar.svelte +4 -1
- package/{package → dist}/components/radio/radio-group.svelte +9 -0
- package/{package → dist}/components/radio/radio.svelte +3 -3
- package/{package → dist}/components/select/combobox.svelte +6 -2
- package/{package → dist}/components/select/select-tags.svelte +1 -1
- package/{package → dist}/components/slider/slider.svelte +14 -7
- package/{package → dist}/components/switch/switch.svelte +4 -1
- package/{package → dist}/components/tabs/tab-list.svelte +1 -1
- package/{package → dist}/components/text-editor/core.d.ts +3 -1
- package/{package → dist}/components/text-editor/core.js +113 -19
- package/{package → dist}/components/text-editor/index.js +6 -0
- package/dist/components/text-editor/lexical-root.svelte +288 -0
- package/{package → dist}/components/text-editor/text-editor.svelte +18 -9
- package/{package → dist}/components/text-editor/text-editor.svelte.d.ts +8 -0
- package/{package → dist}/components/text-editor/toolbar/editor-toolbar.svelte +15 -0
- package/dist/components/text-editor/toolbar/insert-image-button.svelte +43 -0
- package/dist/components/text-editor/toolbar/insert-image-button.svelte.d.ts +17 -0
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +53 -0
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte.d.ts +17 -0
- package/{package → dist}/components/text-editor/toolbar/toggle-block-menu-item.svelte +7 -0
- package/{package → dist}/components/text-field/number-input.svelte +31 -16
- package/{package → dist}/components/text-field/number-input.svelte.d.ts +8 -0
- package/{package → dist}/components/text-field/password-input.svelte +1 -0
- package/{package → dist}/components/text-field/password-input.svelte.d.ts +8 -0
- package/{package → dist}/components/text-field/search-bar.svelte +1 -0
- package/{package → dist}/components/text-field/search-bar.svelte.d.ts +8 -0
- package/{package → dist}/components/text-field/text-area.svelte +4 -4
- package/{package → dist}/components/text-field/text-input.svelte +7 -2
- package/{package → dist}/components/text-field/text-input.svelte.d.ts +13 -2
- package/{package → dist}/components/toast/toast.svelte +1 -1
- package/{package → dist}/components/toolbar/toolbar.svelte +2 -2
- package/{package → dist}/components/util/app-shell.svelte +6 -6
- package/{package → dist}/components/util/app-shell.svelte.d.ts +2 -2
- package/{package → dist}/components/util/popup.svelte +2 -2
- package/{package → dist}/locales/en.d.ts +1 -0
- package/{package → dist}/locales/en.js +1 -0
- package/{package → dist}/locales/ja.d.ts +1 -0
- package/{package → dist}/locales/ja.js +1 -0
- package/{package → dist}/styles/variables.scss +2 -2
- package/{package → dist}/typedefs.d.ts +32 -5
- package/{package → dist}/typedefs.js +26 -14
- package/package.json +20 -19
- package/package/components/text-editor/lexical-root.svelte +0 -156
- /package/{package → dist}/components/alert/alert.svelte +0 -0
- /package/{package → dist}/components/alert/alert.svelte.d.ts +0 -0
- /package/{package → dist}/components/button/button-group.svelte +0 -0
- /package/{package → dist}/components/button/button-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/button/button.svelte.d.ts +0 -0
- /package/{package → dist}/components/button/select-button-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/button/select-button.svelte +0 -0
- /package/{package → dist}/components/button/select-button.svelte.d.ts +0 -0
- /package/{package → dist}/components/button/split-button.svelte +0 -0
- /package/{package → dist}/components/button/split-button.svelte.d.ts +0 -0
- /package/{package → dist}/components/calendar/calendar.svelte.d.ts +0 -0
- /package/{package → dist}/components/checkbox/checkbox-group.svelte +0 -0
- /package/{package → dist}/components/checkbox/checkbox-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/checkbox/checkbox.svelte.d.ts +0 -0
- /package/{package → dist}/components/dialog/alert-dialog.svelte +0 -0
- /package/{package → dist}/components/dialog/alert-dialog.svelte.d.ts +0 -0
- /package/{package → dist}/components/dialog/confirmation-dialog.svelte +0 -0
- /package/{package → dist}/components/dialog/confirmation-dialog.svelte.d.ts +0 -0
- /package/{package → dist}/components/dialog/dialog.svelte +0 -0
- /package/{package → dist}/components/dialog/dialog.svelte.d.ts +0 -0
- /package/{package → dist}/components/dialog/prompt-dialog.svelte +0 -0
- /package/{package → dist}/components/dialog/prompt-dialog.svelte.d.ts +0 -0
- /package/{package → dist}/components/disclosure/disclosure.svelte +0 -0
- /package/{package → dist}/components/disclosure/disclosure.svelte.d.ts +0 -0
- /package/{package → dist}/components/divider/divider.svelte +0 -0
- /package/{package → dist}/components/divider/divider.svelte.d.ts +0 -0
- /package/{package → dist}/components/divider/spacer.svelte +0 -0
- /package/{package → dist}/components/divider/spacer.svelte.d.ts +0 -0
- /package/{package → dist}/components/drawer/drawer.svelte +0 -0
- /package/{package → dist}/components/drawer/drawer.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-body.svelte +0 -0
- /package/{package → dist}/components/grid/grid-body.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-cell.svelte +0 -0
- /package/{package → dist}/components/grid/grid-cell.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-col-header.svelte +0 -0
- /package/{package → dist}/components/grid/grid-col-header.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-foot.svelte +0 -0
- /package/{package → dist}/components/grid/grid-foot.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-head.svelte +0 -0
- /package/{package → dist}/components/grid/grid-head.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-row-header.svelte +0 -0
- /package/{package → dist}/components/grid/grid-row-header.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid-row.svelte +0 -0
- /package/{package → dist}/components/grid/grid-row.svelte.d.ts +0 -0
- /package/{package → dist}/components/grid/grid.svelte.d.ts +0 -0
- /package/{package → dist}/components/icon/icon.svelte +0 -0
- /package/{package → dist}/components/icon/icon.svelte.d.ts +0 -0
- /package/{package → dist}/components/listbox/listbox.svelte.d.ts +0 -0
- /package/{package → dist}/components/listbox/option-group.svelte +0 -0
- /package/{package → dist}/components/listbox/option-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/listbox/option.svelte +0 -0
- /package/{package → dist}/components/listbox/option.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu-button.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu-item-checkbox.svelte +0 -0
- /package/{package → dist}/components/menu/menu-item-checkbox.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu-item-group.svelte +0 -0
- /package/{package → dist}/components/menu/menu-item-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu-item-radio.svelte +0 -0
- /package/{package → dist}/components/menu/menu-item-radio.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu-item.svelte +0 -0
- /package/{package → dist}/components/menu/menu-item.svelte.d.ts +0 -0
- /package/{package → dist}/components/menu/menu.svelte +0 -0
- /package/{package → dist}/components/menu/menu.svelte.d.ts +0 -0
- /package/{package → dist}/components/progressbar/progressbar.svelte.d.ts +0 -0
- /package/{package → dist}/components/radio/radio-group.svelte.d.ts +0 -0
- /package/{package → dist}/components/radio/radio.svelte.d.ts +0 -0
- /package/{package → dist}/components/select/combobox.svelte.d.ts +0 -0
- /package/{package → dist}/components/select/select-tags.svelte.d.ts +0 -0
- /package/{package → dist}/components/select/select.svelte +0 -0
- /package/{package → dist}/components/select/select.svelte.d.ts +0 -0
- /package/{package → dist}/components/slider/slider.svelte.d.ts +0 -0
- /package/{package → dist}/components/switch/switch.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-body.svelte +0 -0
- /package/{package → dist}/components/table/table-body.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-cell.svelte +0 -0
- /package/{package → dist}/components/table/table-cell.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-col-header.svelte +0 -0
- /package/{package → dist}/components/table/table-col-header.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-foot.svelte +0 -0
- /package/{package → dist}/components/table/table-foot.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-head.svelte +0 -0
- /package/{package → dist}/components/table/table-head.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-row-header.svelte +0 -0
- /package/{package → dist}/components/table/table-row-header.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table-row.svelte +0 -0
- /package/{package → dist}/components/table/table-row.svelte.d.ts +0 -0
- /package/{package → dist}/components/table/table.svelte +0 -0
- /package/{package → dist}/components/table/table.svelte.d.ts +0 -0
- /package/{package → dist}/components/tabs/tab-box.svelte +0 -0
- /package/{package → dist}/components/tabs/tab-box.svelte.d.ts +0 -0
- /package/{package → dist}/components/tabs/tab-list.svelte.d.ts +0 -0
- /package/{package → dist}/components/tabs/tab-panel.svelte +0 -0
- /package/{package → dist}/components/tabs/tab-panel.svelte.d.ts +0 -0
- /package/{package → dist}/components/tabs/tab-panels.svelte +0 -0
- /package/{package → dist}/components/tabs/tab-panels.svelte.d.ts +0 -0
- /package/{package → dist}/components/tabs/tab.svelte +0 -0
- /package/{package → dist}/components/tabs/tab.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-editor/index.d.ts +0 -0
- /package/{package → dist}/components/text-editor/lexical-root.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-editor/toolbar/format-text-button.svelte +0 -0
- /package/{package → dist}/components/text-editor/toolbar/format-text-button.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-editor/toolbar/insert-link-button.svelte +0 -0
- /package/{package → dist}/components/text-editor/toolbar/insert-link-button.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +0 -0
- /package/{package → dist}/components/text-field/text-area.svelte.d.ts +0 -0
- /package/{package → dist}/components/toast/toast.svelte.d.ts +0 -0
- /package/{package → dist}/components/toolbar/toolbar.svelte.d.ts +0 -0
- /package/{package → dist}/components/util/group.svelte +0 -0
- /package/{package → dist}/components/util/group.svelte.d.ts +0 -0
- /package/{package → dist}/components/util/modal.svelte +0 -0
- /package/{package → dist}/components/util/modal.svelte.d.ts +0 -0
- /package/{package → dist}/components/util/placeholder.svelte +0 -0
- /package/{package → dist}/components/util/placeholder.svelte.d.ts +0 -0
- /package/{package → dist}/components/util/popup.svelte.d.ts +0 -0
- /package/{package → dist}/index.d.ts +0 -0
- /package/{package → dist}/index.js +0 -0
- /package/{package → dist}/services/events.svelte.d.ts +0 -0
- /package/{package → dist}/services/events.svelte.js +0 -0
- /package/{package → dist}/services/group.svelte.d.ts +0 -0
- /package/{package → dist}/services/group.svelte.js +0 -0
- /package/{package → dist}/services/popup.svelte.d.ts +0 -0
- /package/{package → dist}/services/popup.svelte.js +0 -0
- /package/{package → dist}/styles/core.scss +0 -0
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { $createParagraphNode as createParagraphNode, $getRoot as getRoot } from 'lexical';
|
|
3
|
-
import { getContext, onMount } from 'svelte';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {object} Props
|
|
7
|
-
* @property {string | undefined} [value] - Input value.
|
|
8
|
-
* @property {string} [class] - The `class` attribute on the wrapper element.
|
|
9
|
-
* @property {boolean} [hidden] - Whether to hide the widget.
|
|
10
|
-
* @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
|
|
11
|
-
* attribute.
|
|
12
|
-
* @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
|
|
13
|
-
* `aria-readonly` attribute.
|
|
14
|
-
* @property {boolean} [required] - Whether to mark the widget required. An alias of the
|
|
15
|
-
* `aria-required` attribute.
|
|
16
|
-
* @property {boolean} [invalid] - Whether to mark the widget invalid. An alias of the
|
|
17
|
-
* `aria-invalid` attribute.
|
|
18
|
-
* @property {import('svelte').Snippet} [children] - Primary slot content.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @type {Props & Record<string, any>}
|
|
23
|
-
*/
|
|
24
|
-
let {
|
|
25
|
-
/* eslint-disable prefer-const */
|
|
26
|
-
value = $bindable(),
|
|
27
|
-
class: className,
|
|
28
|
-
hidden = false,
|
|
29
|
-
disabled = false,
|
|
30
|
-
readonly = false,
|
|
31
|
-
required = false,
|
|
32
|
-
invalid = false,
|
|
33
|
-
children,
|
|
34
|
-
...restProps
|
|
35
|
-
/* eslint-enable prefer-const */
|
|
36
|
-
} = $props();
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Text editor state.
|
|
40
|
-
* @type {import('../../typedefs').TextEditorState}
|
|
41
|
-
*/
|
|
42
|
-
const { editor, editorId, selectionBlockType, selectionInlineTypes, hasConverterError } =
|
|
43
|
-
getContext('state');
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Reference to the Lexical editor root element.
|
|
47
|
-
* @type {HTMLElement | undefined}
|
|
48
|
-
*/
|
|
49
|
-
let lexicalRoot = $state();
|
|
50
|
-
|
|
51
|
-
const editable = $derived(!(disabled || readonly));
|
|
52
|
-
|
|
53
|
-
$effect(() => {
|
|
54
|
-
$editor?.setEditable(editable);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Update {@link value} and other state variables whenever the editor content is updated.
|
|
59
|
-
* @param {Event} event - `Update` custom event.
|
|
60
|
-
*/
|
|
61
|
-
const onUpdate = (event) => {
|
|
62
|
-
if ($hasConverterError) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const { detail } = /** @type {CustomEvent} */ (event);
|
|
67
|
-
const newValue = detail.value;
|
|
68
|
-
|
|
69
|
-
if (value !== newValue) {
|
|
70
|
-
value = newValue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
$selectionBlockType = detail.selectionBlockType;
|
|
74
|
-
$selectionInlineTypes = detail.selectionInlineTypes;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Listen to `click` events on the editor. Ignore a click on a link.
|
|
79
|
-
* @param {MouseEvent} event - `click` event.
|
|
80
|
-
*/
|
|
81
|
-
const onClick = (event) => {
|
|
82
|
-
if (/** @type {HTMLElement} */ (event.target)?.matches('a')) {
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
onMount(() => {
|
|
88
|
-
lexicalRoot?.addEventListener('Update', onUpdate);
|
|
89
|
-
lexicalRoot?.addEventListener('click', onClick);
|
|
90
|
-
|
|
91
|
-
return () => {
|
|
92
|
-
lexicalRoot?.removeEventListener('Update', onUpdate);
|
|
93
|
-
lexicalRoot?.removeEventListener('click', onClick);
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
$effect(() => {
|
|
98
|
-
if ($editor && lexicalRoot) {
|
|
99
|
-
$editor.setRootElement(lexicalRoot);
|
|
100
|
-
// We should avoid an empty editor; there should be at least one `<p>`
|
|
101
|
-
// @see https://github.com/facebook/lexical/issues/2308
|
|
102
|
-
$editor.update(() => {
|
|
103
|
-
getRoot().append(createParagraphNode());
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
</script>
|
|
108
|
-
|
|
109
|
-
<div
|
|
110
|
-
bind:this={lexicalRoot}
|
|
111
|
-
{...restProps}
|
|
112
|
-
role="textbox"
|
|
113
|
-
aria-multiline="true"
|
|
114
|
-
aria-hidden={hidden}
|
|
115
|
-
aria-disabled={disabled}
|
|
116
|
-
aria-readonly={readonly}
|
|
117
|
-
aria-required={required}
|
|
118
|
-
aria-invalid={invalid}
|
|
119
|
-
class="lexical-root"
|
|
120
|
-
id="{$editorId}-lexical-root"
|
|
121
|
-
contenteditable={editable}
|
|
122
|
-
{hidden}
|
|
123
|
-
></div>
|
|
124
|
-
|
|
125
|
-
<style>.lexical-root {
|
|
126
|
-
border: 1px solid var(--sui-textbox-border-color);
|
|
127
|
-
border-radius: 0 0 var(--sui-textbox-border-radius) var(--sui-textbox-border-radius) !important;
|
|
128
|
-
padding: var(--sui-textbox-multiline-padding);
|
|
129
|
-
min-height: 8em;
|
|
130
|
-
color: var(--sui-textbox-foreground-color);
|
|
131
|
-
background-color: var(--sui-textbox-background-color);
|
|
132
|
-
font-family: var(--sui-textbox-font-family);
|
|
133
|
-
font-size: var(--sui-textbox-font-size);
|
|
134
|
-
line-height: var(--sui-textbox-multiline-line-height);
|
|
135
|
-
}
|
|
136
|
-
.lexical-root:focus-visible {
|
|
137
|
-
outline: 0;
|
|
138
|
-
}
|
|
139
|
-
.lexical-root[aria-invalid=true] {
|
|
140
|
-
border-color: var(--sui-error-foreground-color);
|
|
141
|
-
}
|
|
142
|
-
.lexical-root > :global(:first-child) {
|
|
143
|
-
margin-top: 0;
|
|
144
|
-
}
|
|
145
|
-
.lexical-root > :global(:last-child) {
|
|
146
|
-
margin-bottom: 0;
|
|
147
|
-
}
|
|
148
|
-
.lexical-root :global(strong.italic) {
|
|
149
|
-
font-style: italic;
|
|
150
|
-
}
|
|
151
|
-
.lexical-root :global(li.nested) {
|
|
152
|
-
list-style-type: none;
|
|
153
|
-
}
|
|
154
|
-
.lexical-root :global([data-lexical-text="true"]) {
|
|
155
|
-
cursor: text;
|
|
156
|
-
}</style>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|