@sveltia/ui 0.22.0 → 0.22.2
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.
|
@@ -78,6 +78,9 @@
|
|
|
78
78
|
const originalValue = inputValue;
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
+
// We should avoid an empty editor; there should be at least one `<p>`, so give it an empty
|
|
82
|
+
// string if the `value` is `undefined`
|
|
83
|
+
// @see https://github.com/facebook/lexical/issues/2308
|
|
81
84
|
await convertMarkdownToLexical($editor, inputValue ?? '');
|
|
82
85
|
} catch (ex) {
|
|
83
86
|
$hasConverterError = true;
|
|
@@ -87,15 +90,6 @@
|
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
92
|
|
|
90
|
-
$effect(() => {
|
|
91
|
-
// We should avoid an empty editor; there should be at least one `<p>`, so give it an empty
|
|
92
|
-
// string if the `value` is `undefined`
|
|
93
|
-
// @see https://github.com/facebook/lexical/issues/2308
|
|
94
|
-
if ($editor?.getEditorState().isEmpty()) {
|
|
95
|
-
convertMarkdownToLexical($editor, '');
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
93
|
$effect(() => {
|
|
100
94
|
void $editor;
|
|
101
95
|
|
|
@@ -103,12 +97,14 @@
|
|
|
103
97
|
|
|
104
98
|
// Avoid a cycle dependency & infinite loop
|
|
105
99
|
untrack(() => {
|
|
106
|
-
|
|
100
|
+
const hasChange = inputValue !== newValue;
|
|
101
|
+
|
|
102
|
+
if (hasChange) {
|
|
107
103
|
inputValue = newValue ?? '';
|
|
104
|
+
}
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
106
|
+
if ($useRichText && (hasChange || $editor?.getEditorState().isEmpty())) {
|
|
107
|
+
convertMarkdown();
|
|
112
108
|
}
|
|
113
109
|
});
|
|
114
110
|
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { generateElementId } from '@sveltia/utils/element';
|
|
9
|
+
import { untrack } from 'svelte';
|
|
9
10
|
import { _ } from 'svelte-i18n';
|
|
10
11
|
import Button from '../button/button.svelte';
|
|
11
12
|
import Icon from '../icon/icon.svelte';
|
|
@@ -55,6 +56,16 @@
|
|
|
55
56
|
const isMin = $derived(typeof min === 'number' && Number(inputValue || 0) <= min);
|
|
56
57
|
const isMax = $derived(typeof max === 'number' && Number(inputValue || 0) >= max);
|
|
57
58
|
|
|
59
|
+
$effect(() => {
|
|
60
|
+
const newInputValue = String(value ?? '');
|
|
61
|
+
|
|
62
|
+
untrack(() => {
|
|
63
|
+
if (inputValue !== newInputValue) {
|
|
64
|
+
inputValue = newInputValue;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
58
69
|
$effect(() => {
|
|
59
70
|
const newValue = inputValue.trim() ? Number(inputValue) : NaN;
|
|
60
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"test:unit": "vitest"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lexical/code": "^0.
|
|
32
|
-
"@lexical/dragon": "^0.
|
|
33
|
-
"@lexical/history": "^0.
|
|
34
|
-
"@lexical/link": "^0.
|
|
35
|
-
"@lexical/list": "^0.
|
|
36
|
-
"@lexical/markdown": "^0.
|
|
37
|
-
"@lexical/rich-text": "^0.
|
|
38
|
-
"@lexical/selection": "^0.
|
|
39
|
-
"@lexical/table": "^0.
|
|
40
|
-
"@lexical/utils": "^0.
|
|
31
|
+
"@lexical/code": "^0.22.0",
|
|
32
|
+
"@lexical/dragon": "^0.22.0",
|
|
33
|
+
"@lexical/history": "^0.22.0",
|
|
34
|
+
"@lexical/link": "^0.22.0",
|
|
35
|
+
"@lexical/list": "^0.22.0",
|
|
36
|
+
"@lexical/markdown": "^0.22.0",
|
|
37
|
+
"@lexical/rich-text": "^0.22.0",
|
|
38
|
+
"@lexical/selection": "^0.22.0",
|
|
39
|
+
"@lexical/table": "^0.22.0",
|
|
40
|
+
"@lexical/utils": "^0.22.0",
|
|
41
41
|
"@sveltia/utils": "^0.6.3",
|
|
42
42
|
"prismjs": "^1.29.0",
|
|
43
|
-
"lexical": "^0.
|
|
43
|
+
"lexical": "^0.22.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"svelte": "^5.0.0"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@playwright/test": "^1.49.1",
|
|
50
50
|
"@sveltejs/adapter-auto": "^3.3.1",
|
|
51
|
-
"@sveltejs/kit": "^2.
|
|
51
|
+
"@sveltejs/kit": "^2.15.0",
|
|
52
52
|
"@sveltejs/package": "^2.3.7",
|
|
53
53
|
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
54
54
|
"cspell": "^8.17.1",
|