@sveltia/ui 0.12.1 → 0.12.3
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/button/split-button.svelte +2 -2
- package/package/components/divider/divider.svelte +1 -1
- package/package/components/divider/spacer.svelte +1 -1
- package/package/components/grid/grid-body.svelte +13 -5
- package/package/components/slider/slider.svelte +4 -4
- package/package/components/switch/switch.svelte +1 -1
- package/package/components/table/table-body.svelte +13 -5
- package/package/components/tabs/tab-list.svelte +1 -1
- package/package/components/text-editor/lexical-root.svelte +1 -1
- package/package/components/text-editor/text-editor.svelte +1 -1
- package/package/components/text-editor/toolbar/editor-toolbar.svelte +18 -23
- package/package/components/text-editor/toolbar/insert-link-button.svelte +26 -27
- package/package/components/text-field/text-area.svelte +1 -1
- package/package/components/toast/toast.svelte +1 -1
- package/package/locales/en.d.ts +1 -3
- package/package/locales/en.js +1 -3
- package/package/locales/ja.d.ts +1 -3
- package/package/locales/ja.js +1 -3
- package/package.json +6 -6
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
.split-button :global(button) {
|
|
97
97
|
margin: 0;
|
|
98
98
|
}
|
|
99
|
-
.split-button :global(button
|
|
99
|
+
.split-button :global(button:not(.menu-button)) {
|
|
100
100
|
border-top-right-radius: 0;
|
|
101
101
|
border-bottom-right-radius: 0;
|
|
102
102
|
}
|
|
103
|
-
.split-button :global(button
|
|
103
|
+
.split-button :global(button.menu-button) {
|
|
104
104
|
border-left-width: 0;
|
|
105
105
|
border-top-left-radius: 0;
|
|
106
106
|
border-bottom-left-radius: 0;
|
|
@@ -31,18 +31,26 @@
|
|
|
31
31
|
{...$$restProps}
|
|
32
32
|
>
|
|
33
33
|
{#if label}
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
<div role="row" class="row-group-caption">
|
|
35
|
+
<!-- We need `colspan` here but cannot place `<th>` under `<div>`, so use a hack -->
|
|
36
|
+
<svelte:element this="th" role="rowheader" id="{id}-label" colspan="9999">
|
|
37
|
+
{label}
|
|
38
|
+
</svelte:element>
|
|
39
|
+
</div>
|
|
37
40
|
{/if}
|
|
38
41
|
<slot />
|
|
39
42
|
</div>
|
|
40
43
|
|
|
41
|
-
<style
|
|
44
|
+
<style>[role=rowgroup] {
|
|
42
45
|
display: table-row-group;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
[role=row] {
|
|
49
|
+
display: table-row;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[role=rowheader] {
|
|
53
|
+
display: table-cell;
|
|
46
54
|
padding: 8px;
|
|
47
55
|
color: var(--sui-secondary-foreground-color);
|
|
48
56
|
background-color: var(--sui-secondary-background-color);
|
|
@@ -304,12 +304,12 @@
|
|
|
304
304
|
{...$$restProps}
|
|
305
305
|
>
|
|
306
306
|
<div role="none" class="base" bind:this={base} on:pointerdown={(event) => onPointerDown(event)}>
|
|
307
|
-
<div role="none" class="base-bar"
|
|
307
|
+
<div role="none" class="base-bar"></div>
|
|
308
308
|
<div
|
|
309
309
|
class="slider-bar"
|
|
310
310
|
style:left="{multiThumb ? sliderPositions[0] : 0}px"
|
|
311
311
|
style:width="{multiThumb ? sliderPositions[1] - sliderPositions[0] : sliderPositions[0]}px"
|
|
312
|
-
|
|
312
|
+
></div>
|
|
313
313
|
<div
|
|
314
314
|
role="slider"
|
|
315
315
|
tabindex={disabled ? -1 : 0}
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
style:left="{sliderPositions[0]}px"
|
|
325
325
|
on:pointerdown={(event) => onPointerDown(event, 0)}
|
|
326
326
|
on:keydown={(event) => onKeyDown(event, 0)}
|
|
327
|
-
|
|
327
|
+
></div>
|
|
328
328
|
{#if multiThumb}
|
|
329
329
|
<div
|
|
330
330
|
role="slider"
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
style:left="{sliderPositions[1]}px"
|
|
341
341
|
on:pointerdown={(event) => onPointerDown(event, 1)}
|
|
342
342
|
on:keydown={(event) => onKeyDown(event, 1)}
|
|
343
|
-
|
|
343
|
+
></div>
|
|
344
344
|
{/if}
|
|
345
345
|
{#if optionLabels.length}
|
|
346
346
|
{#each optionLabels as label, index}
|
|
@@ -31,18 +31,26 @@
|
|
|
31
31
|
{...$$restProps}
|
|
32
32
|
>
|
|
33
33
|
{#if label}
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
<div role="row" class="row-group-caption">
|
|
35
|
+
<!-- We need `colspan` here but cannot place `<th>` under `<div>`, so use a hack -->
|
|
36
|
+
<svelte:element this="th" role="rowheader" id="{id}-label" colspan="9999">
|
|
37
|
+
{label}
|
|
38
|
+
</svelte:element>
|
|
39
|
+
</div>
|
|
37
40
|
{/if}
|
|
38
41
|
<slot />
|
|
39
42
|
</div>
|
|
40
43
|
|
|
41
|
-
<style
|
|
44
|
+
<style>[role=rowgroup] {
|
|
42
45
|
display: table-row-group;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
[role=row] {
|
|
49
|
+
display: table-row;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[role=rowheader] {
|
|
53
|
+
display: table-cell;
|
|
46
54
|
padding: 8px;
|
|
47
55
|
color: var(--sui-secondary-foreground-color);
|
|
48
56
|
background-color: var(--sui-secondary-background-color);
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
const selectionBlockType = writable('paragraph');
|
|
69
69
|
const selectionInlineTypes = writable([]);
|
|
70
70
|
const editorId = writable(generateElementId('editor'));
|
|
71
|
-
const useRichText = writable(modes
|
|
71
|
+
const useRichText = writable(modes[0] === 'rich-text');
|
|
72
72
|
const hasConverterError = writable(false);
|
|
73
73
|
let showConverterError = false;
|
|
74
74
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { getContext
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
3
|
import { _ } from 'svelte-i18n';
|
|
4
4
|
import ButtonGroup from '../../button/button-group.svelte';
|
|
5
|
+
import Button from '../../button/button.svelte';
|
|
5
6
|
import Divider from '../../divider/divider.svelte';
|
|
6
7
|
import Spacer from '../../divider/spacer.svelte';
|
|
7
8
|
import Icon from '../../icon/icon.svelte';
|
|
8
9
|
import MenuButton from '../../menu/menu-button.svelte';
|
|
9
|
-
import MenuItemCheckbox from '../../menu/menu-item-checkbox.svelte';
|
|
10
10
|
import Menu from '../../menu/menu.svelte';
|
|
11
11
|
import {
|
|
12
12
|
availableButtons,
|
|
@@ -99,29 +99,21 @@
|
|
|
99
99
|
{/if}
|
|
100
100
|
<Spacer flex />
|
|
101
101
|
{#if modes.length > 1}
|
|
102
|
-
<
|
|
103
|
-
variant="ghost"
|
|
102
|
+
<Button
|
|
104
103
|
iconic
|
|
105
104
|
disabled={$hasConverterError}
|
|
106
|
-
|
|
107
|
-
aria-label={$_('_sui.text_editor.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<Menu slot="popup" aria-label={$_('_sui.text_editor.edit_options')}>
|
|
111
|
-
<MenuItemCheckbox
|
|
112
|
-
label={$_('_sui.text_editor.use_rich_text')}
|
|
113
|
-
bind:checked={$useRichText}
|
|
114
|
-
on:change={async () => {
|
|
115
|
-
// Wait for `$useRichText` to be updated
|
|
116
|
-
await tick();
|
|
105
|
+
pressed={!$useRichText}
|
|
106
|
+
aria-label={$_('_sui.text_editor.edit_in_markdown')}
|
|
107
|
+
on:click={() => {
|
|
108
|
+
$useRichText = !$useRichText;
|
|
117
109
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</
|
|
110
|
+
if ($useRichText) {
|
|
111
|
+
convertMarkdown();
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<Icon slot="start-icon" name="markdown" />
|
|
116
|
+
</Button>
|
|
125
117
|
{/if}
|
|
126
118
|
</Toolbar>
|
|
127
119
|
</div>
|
|
@@ -141,7 +133,10 @@
|
|
|
141
133
|
padding: 8px;
|
|
142
134
|
background-color: var(--sui-tertiary-background-color);
|
|
143
135
|
}
|
|
144
|
-
.wrapper :global(button) {
|
|
136
|
+
.wrapper :global(.sui.menu-button) {
|
|
137
|
+
padding: 0 4px;
|
|
138
|
+
}
|
|
139
|
+
.wrapper :global(.sui.button) {
|
|
145
140
|
flex: none;
|
|
146
141
|
margin: 0 !important;
|
|
147
142
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { LinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
|
|
3
3
|
import { $getNearestNodeOfType as getNearestNodeOfType } from '@lexical/utils';
|
|
4
|
+
import { generateElementId } from '@sveltia/utils/element';
|
|
4
5
|
import { isURL } from '@sveltia/utils/string';
|
|
5
6
|
import {
|
|
6
7
|
COMMAND_PRIORITY_NORMAL,
|
|
@@ -12,12 +13,14 @@
|
|
|
12
13
|
} from 'lexical';
|
|
13
14
|
import { getContext, onMount } from 'svelte';
|
|
14
15
|
import { _ } from 'svelte-i18n';
|
|
15
|
-
import Button from '../../button/button.svelte';
|
|
16
|
-
import Dialog from '../../dialog/dialog.svelte';
|
|
17
|
-
import Icon from '../../icon/icon.svelte';
|
|
18
|
-
import { availableButtons } from '..';
|
|
19
|
-
import TextInput from '../../text-field/text-input.svelte';
|
|
20
16
|
import { isMac, matchShortcuts } from '../../../services/events';
|
|
17
|
+
import TextInput from '../../text-field/text-input.svelte';
|
|
18
|
+
import { availableButtons } from '..';
|
|
19
|
+
import Icon from '../../icon/icon.svelte';
|
|
20
|
+
import Dialog from '../../dialog/dialog.svelte';
|
|
21
|
+
import Button from '../../button/button.svelte';
|
|
22
|
+
|
|
23
|
+
const id = generateElementId('insert-link');
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Button type.
|
|
@@ -186,34 +189,30 @@
|
|
|
186
189
|
>
|
|
187
190
|
{#if !hasAnchor}
|
|
188
191
|
<div role="none">
|
|
189
|
-
|
|
190
|
-
<label>
|
|
191
|
-
{$_('_sui.text_editor.text')}<br />
|
|
192
|
-
<TextInput
|
|
193
|
-
autofocus
|
|
194
|
-
bind:value={anchorText}
|
|
195
|
-
flex
|
|
196
|
-
on:keydown={(event) => {
|
|
197
|
-
onInputKeyDown(event);
|
|
198
|
-
}}
|
|
199
|
-
/>
|
|
200
|
-
</label>
|
|
201
|
-
</div>
|
|
202
|
-
{/if}
|
|
203
|
-
<div role="none">
|
|
204
|
-
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
205
|
-
<label>
|
|
206
|
-
{$_('_sui.text_editor.url')}<br />
|
|
192
|
+
<label for="{id}-text">{$_('_sui.text_editor.text')}</label>
|
|
207
193
|
<TextInput
|
|
208
|
-
|
|
209
|
-
|
|
194
|
+
id="{id}-text"
|
|
195
|
+
autofocus
|
|
196
|
+
bind:value={anchorText}
|
|
210
197
|
flex
|
|
211
|
-
aria-label="URL"
|
|
212
198
|
on:keydown={(event) => {
|
|
213
199
|
onInputKeyDown(event);
|
|
214
200
|
}}
|
|
215
201
|
/>
|
|
216
|
-
</
|
|
202
|
+
</div>
|
|
203
|
+
{/if}
|
|
204
|
+
<div role="none">
|
|
205
|
+
<label for="{id}-url">{$_('_sui.text_editor.url')}</label>
|
|
206
|
+
<TextInput
|
|
207
|
+
id="{id}-url"
|
|
208
|
+
autofocus={hasAnchor || undefined}
|
|
209
|
+
bind:value={anchorURL}
|
|
210
|
+
flex
|
|
211
|
+
aria-label="URL"
|
|
212
|
+
on:keydown={(event) => {
|
|
213
|
+
onInputKeyDown(event);
|
|
214
|
+
}}
|
|
215
|
+
/>
|
|
217
216
|
</div>
|
|
218
217
|
<svelte:fragment slot="footer-extra">
|
|
219
218
|
{#if dialogMode !== 'create'}
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
}
|
|
93
93
|
</script>
|
|
94
94
|
|
|
95
|
-
<div role="none" class="sui toast-base" bind:this={popoverBase}
|
|
95
|
+
<div role="none" class="sui toast-base" bind:this={popoverBase}></div>
|
|
96
96
|
|
|
97
97
|
<div class="sui toast {position}" aria-hidden={!show} bind:this={toast} {...$$restProps}>
|
|
98
98
|
<slot />
|
package/package/locales/en.d.ts
CHANGED
|
@@ -57,9 +57,7 @@ export namespace strings {
|
|
|
57
57
|
export const update_link: string;
|
|
58
58
|
export const text: string;
|
|
59
59
|
export const url: string;
|
|
60
|
-
export const
|
|
61
|
-
export const show_edit_options: string;
|
|
62
|
-
export const use_rich_text: string;
|
|
60
|
+
export const edit_in_markdown: string;
|
|
63
61
|
export const converter_error: string;
|
|
64
62
|
}
|
|
65
63
|
}
|
package/package/locales/en.js
CHANGED
|
@@ -56,9 +56,7 @@ export const strings = {
|
|
|
56
56
|
update_link: 'Update Link',
|
|
57
57
|
text: 'Text',
|
|
58
58
|
url: 'URL',
|
|
59
|
-
|
|
60
|
-
show_edit_options: 'Show Edit Options',
|
|
61
|
-
use_rich_text: 'Use Rich Text',
|
|
59
|
+
edit_in_markdown: 'Edit in Markdown',
|
|
62
60
|
converter_error:
|
|
63
61
|
'There was an error while enabling rich text mode. Please use the plain text editor instead.',
|
|
64
62
|
},
|
package/package/locales/ja.d.ts
CHANGED
|
@@ -57,9 +57,7 @@ export namespace strings {
|
|
|
57
57
|
export const update_link: string;
|
|
58
58
|
export const text: string;
|
|
59
59
|
export const url: string;
|
|
60
|
-
export const
|
|
61
|
-
export const show_edit_options: string;
|
|
62
|
-
export const use_rich_text: string;
|
|
60
|
+
export const edit_in_markdown: string;
|
|
63
61
|
export const converter_error: string;
|
|
64
62
|
}
|
|
65
63
|
}
|
package/package/locales/ja.js
CHANGED
|
@@ -56,9 +56,7 @@ export const strings = {
|
|
|
56
56
|
update_link: 'リンクを更新',
|
|
57
57
|
text: 'テキスト',
|
|
58
58
|
url: 'URL',
|
|
59
|
-
|
|
60
|
-
show_edit_options: '編集オプションを表示',
|
|
61
|
-
use_rich_text: 'リッチテキストを使用',
|
|
59
|
+
edit_in_markdown: 'マークダウンで編集',
|
|
62
60
|
converter_error:
|
|
63
61
|
'リッチテキストモードを有効化中に問題が発生しました。代わりにプレーンテキストエディターを使用してください。',
|
|
64
62
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@lexical/selection": "^0.14.5",
|
|
33
33
|
"@lexical/table": "^0.14.5",
|
|
34
34
|
"@lexical/utils": "^0.14.5",
|
|
35
|
-
"@sveltia/utils": "^0.1.
|
|
35
|
+
"@sveltia/utils": "^0.1.1",
|
|
36
36
|
"lexical": "^0.14.5",
|
|
37
37
|
"svelte": "^4.2.15"
|
|
38
38
|
},
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"eslint-config-prettier": "^9.1.0",
|
|
49
49
|
"eslint-plugin-import": "^2.29.1",
|
|
50
50
|
"eslint-plugin-jsdoc": "^48.2.3",
|
|
51
|
-
"eslint-plugin-svelte": "^2.
|
|
51
|
+
"eslint-plugin-svelte": "^2.38.0",
|
|
52
52
|
"npm-run-all": "^4.1.5",
|
|
53
53
|
"postcss": "^8.4.38",
|
|
54
54
|
"postcss-html": "^1.6.0",
|
|
55
55
|
"prettier": "^3.2.5",
|
|
56
56
|
"prettier-plugin-svelte": "^3.2.3",
|
|
57
57
|
"sass": "^1.75.0",
|
|
58
|
-
"stylelint": "^16.
|
|
58
|
+
"stylelint": "^16.4.0",
|
|
59
59
|
"stylelint-config-recommended-scss": "^14.0.0",
|
|
60
60
|
"stylelint-scss": "^6.2.1",
|
|
61
|
-
"svelte-check": "^3.
|
|
61
|
+
"svelte-check": "^3.7.0",
|
|
62
62
|
"svelte-i18n": "^4.0.0",
|
|
63
63
|
"svelte-preprocess": "^5.1.4",
|
|
64
64
|
"tslib": "^2.6.2",
|
|
65
65
|
"vite": "^5.2.10",
|
|
66
|
-
"vitest": "^1.5.
|
|
66
|
+
"vitest": "^1.5.2"
|
|
67
67
|
},
|
|
68
68
|
"exports": {
|
|
69
69
|
"./package.json": "./package.json",
|