@sveltia/ui 0.30.2 → 0.31.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/dist/components/checkbox/checkbox.svelte +15 -11
- package/dist/components/radio/radio.svelte +12 -7
- package/dist/components/slider/slider.svelte +3 -2
- package/dist/components/text-editor/constants.js +6 -1
- package/dist/components/text-editor/core.js +2 -1
- package/dist/components/text-editor/lexical-root.svelte +3 -0
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +3 -3
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/ja.d.ts +1 -0
- package/dist/locales/ja.js +1 -0
- package/dist/typedefs.d.ts +1 -1
- package/dist/typedefs.js +1 -1
- package/package.json +5 -3
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
invalid = false,
|
|
48
48
|
label = undefined,
|
|
49
49
|
'aria-label': ariaLabel,
|
|
50
|
-
group = $bindable(
|
|
50
|
+
group = $bindable(),
|
|
51
51
|
onChange,
|
|
52
52
|
children,
|
|
53
53
|
checkIcon,
|
|
@@ -67,12 +67,14 @@
|
|
|
67
67
|
|
|
68
68
|
// Sync `checked` with `group` and `value`
|
|
69
69
|
$effect(() => {
|
|
70
|
-
if (
|
|
71
|
-
if (
|
|
72
|
-
checked
|
|
70
|
+
if (Array.isArray(group)) {
|
|
71
|
+
if (group.includes(value)) {
|
|
72
|
+
if (checked !== true) {
|
|
73
|
+
checked = true;
|
|
74
|
+
}
|
|
75
|
+
} else if (checked !== false) {
|
|
76
|
+
checked = false;
|
|
73
77
|
}
|
|
74
|
-
} else if (checked !== false) {
|
|
75
|
-
checked = false;
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
</script>
|
|
@@ -120,12 +122,14 @@
|
|
|
120
122
|
|
|
121
123
|
checked = indeterminate ? true : !checked;
|
|
122
124
|
|
|
123
|
-
if (
|
|
124
|
-
if (
|
|
125
|
-
|
|
125
|
+
if (Array.isArray(group)) {
|
|
126
|
+
if (checked) {
|
|
127
|
+
if (!group.includes(value)) {
|
|
128
|
+
group = [...group, value];
|
|
129
|
+
}
|
|
130
|
+
} else if (group.includes(value)) {
|
|
131
|
+
group = group.filter((v) => v !== value);
|
|
126
132
|
}
|
|
127
|
-
} else if (group.includes(value)) {
|
|
128
|
-
group = group.filter((v) => v !== value);
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
onChange?.(new CustomEvent('Change', { detail: { checked } }));
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
value = undefined,
|
|
48
48
|
valueType = undefined,
|
|
49
49
|
label = undefined,
|
|
50
|
-
group = $bindable(
|
|
50
|
+
group = $bindable(),
|
|
51
51
|
children,
|
|
52
52
|
onChange,
|
|
53
53
|
onSelect,
|
|
@@ -65,12 +65,14 @@
|
|
|
65
65
|
|
|
66
66
|
// Sync `checked` with `group` and `value`
|
|
67
67
|
$effect(() => {
|
|
68
|
-
if (group ===
|
|
69
|
-
if (
|
|
70
|
-
checked
|
|
68
|
+
if (typeof group === 'string') {
|
|
69
|
+
if (group === value) {
|
|
70
|
+
if (!checked) {
|
|
71
|
+
checked = true;
|
|
72
|
+
}
|
|
73
|
+
} else if (checked) {
|
|
74
|
+
checked = false;
|
|
71
75
|
}
|
|
72
|
-
} else if (checked) {
|
|
73
|
-
checked = false;
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
</script>
|
|
@@ -106,7 +108,10 @@
|
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
checked = true;
|
|
109
|
-
|
|
111
|
+
|
|
112
|
+
if (typeof group === 'string') {
|
|
113
|
+
group = value;
|
|
114
|
+
}
|
|
110
115
|
}}
|
|
111
116
|
{onChange}
|
|
112
117
|
{onSelect}
|
|
@@ -266,9 +266,10 @@
|
|
|
266
266
|
|
|
267
267
|
const stepCount = (max - min) / step + 1;
|
|
268
268
|
const stepWidth = barWidth / (stepCount - 1);
|
|
269
|
+
const emptyArray = Array.from({ length: stepCount });
|
|
269
270
|
|
|
270
|
-
valueList =
|
|
271
|
-
positionList =
|
|
271
|
+
valueList = emptyArray.map((_, index) => index * step + min, 10);
|
|
272
|
+
positionList = emptyArray.map((_, index) => index * stepWidth);
|
|
272
273
|
|
|
273
274
|
onValueChange();
|
|
274
275
|
};
|
|
@@ -17,6 +17,11 @@ export const AVAILABLE_BUTTONS = {
|
|
|
17
17
|
icon: 'format_italic',
|
|
18
18
|
inline: true,
|
|
19
19
|
},
|
|
20
|
+
strikethrough: {
|
|
21
|
+
labelKey: 'strikethrough',
|
|
22
|
+
icon: 'strikethrough_s',
|
|
23
|
+
inline: true,
|
|
24
|
+
},
|
|
20
25
|
code: {
|
|
21
26
|
labelKey: 'code',
|
|
22
27
|
icon: 'code',
|
|
@@ -87,7 +92,7 @@ export const AVAILABLE_BUTTONS = {
|
|
|
87
92
|
/**
|
|
88
93
|
* @type {TextEditorFormatType[]}
|
|
89
94
|
*/
|
|
90
|
-
export const TEXT_FORMAT_BUTTON_TYPES = ['bold', 'italic', 'code'];
|
|
95
|
+
export const TEXT_FORMAT_BUTTON_TYPES = ['bold', 'italic', 'strikethrough', 'code'];
|
|
91
96
|
|
|
92
97
|
/**
|
|
93
98
|
* @type {TextEditorInlineType[]}
|
|
@@ -89,10 +89,11 @@ const editorConfig = {
|
|
|
89
89
|
theme: {
|
|
90
90
|
text: {
|
|
91
91
|
/**
|
|
92
|
-
* Enable bold+italic styling.
|
|
92
|
+
* Enable bold+italic and strikethrough styling.
|
|
93
93
|
* @see https://github.com/facebook/lexical/discussions/4381
|
|
94
94
|
*/
|
|
95
95
|
italic: 'italic',
|
|
96
|
+
strikethrough: 'strikethrough',
|
|
96
97
|
},
|
|
97
98
|
list: {
|
|
98
99
|
nested: {
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
* @type {TextEditorInlineType[]}
|
|
74
74
|
*/
|
|
75
75
|
const inlineLevelButtons = $derived(
|
|
76
|
-
unique(
|
|
77
|
-
|
|
76
|
+
unique(
|
|
77
|
+
editorStore.config.enabledButtons.filter((type) =>
|
|
78
78
|
INLINE_BUTTON_TYPES.includes(/** @type {any} */ (type)),
|
|
79
79
|
),
|
|
80
|
-
|
|
80
|
+
),
|
|
81
81
|
);
|
|
82
82
|
</script>
|
|
83
83
|
|
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/en.js
CHANGED
package/dist/locales/ja.d.ts
CHANGED
package/dist/locales/ja.js
CHANGED
package/dist/typedefs.d.ts
CHANGED
|
@@ -587,7 +587,7 @@ export type InputEventHandlers = {
|
|
|
587
587
|
export type PopupPosition = ("top-left" | "top-right" | "right-top" | "right-bottom" | "bottom-left" | "bottom-right" | "left-top" | "left-bottom");
|
|
588
588
|
export type ToastPosition = "auto" | "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
589
589
|
export type TextEditorBlockType = "paragraph" | "heading-1" | "heading-2" | "heading-3" | "heading-4" | "heading-5" | "heading-6" | "bulleted-list" | "numbered-list" | "blockquote" | "code-block";
|
|
590
|
-
export type TextEditorFormatType = "bold" | "italic" | "code";
|
|
590
|
+
export type TextEditorFormatType = "bold" | "italic" | "strikethrough" | "code";
|
|
591
591
|
export type TextEditorInlineType = TextEditorFormatType | "link";
|
|
592
592
|
export type TextEditorMode = "rich-text" | "plain-text";
|
|
593
593
|
export type TextEditorComponent = {
|
package/dist/typedefs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@sveltejs/adapter-auto": "^6.1.1",
|
|
31
|
-
"@sveltejs/kit": "^2.
|
|
31
|
+
"@sveltejs/kit": "^2.46.2",
|
|
32
32
|
"@sveltejs/package": "^2.5.4",
|
|
33
33
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
34
34
|
"cspell": "^9.2.1",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"eslint-plugin-import": "^2.32.0",
|
|
39
39
|
"eslint-plugin-jsdoc": "^57.2.1",
|
|
40
40
|
"eslint-plugin-svelte": "^2.46.1",
|
|
41
|
+
"oxlint": "^1.20.0",
|
|
41
42
|
"postcss": "^8.5.6",
|
|
42
43
|
"postcss-html": "^1.8.0",
|
|
43
44
|
"prettier": "^3.6.2",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"stylelint": "^16.25.0",
|
|
47
48
|
"stylelint-config-recommended-scss": "^16.0.2",
|
|
48
49
|
"stylelint-scss": "^6.12.1",
|
|
49
|
-
"svelte": "^5.39.
|
|
50
|
+
"svelte": "^5.39.10",
|
|
50
51
|
"svelte-check": "^4.3.2",
|
|
51
52
|
"svelte-preprocess": "^6.0.3",
|
|
52
53
|
"tslib": "^2.8.1",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"check:svelte": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
|
88
89
|
"check:prettier": "prettier --check .",
|
|
89
90
|
"check:eslint": "eslint .",
|
|
91
|
+
"check:oxlint": "oxlint .",
|
|
90
92
|
"check:stylelint": "stylelint '**/*.{css,scss,svelte}'",
|
|
91
93
|
"test": "vitest run",
|
|
92
94
|
"test:coverage": "vitest --coverage",
|