lithesome 0.23.3 → 0.23.5
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/accordion/Accordion.svelte +2 -2
- package/dist/components/dropzone/Dropzone.svelte +3 -6
- package/dist/components/dropzone/state.svelte.js +4 -1
- package/dist/components/pin/Pin.svelte +4 -6
- package/dist/components/pin/state.svelte.js +3 -0
- package/dist/components/radiogroup/RadioGroupItem.svelte +1 -1
- package/dist/components/radiogroup/state.svelte.js +0 -1
- package/dist/components/slider/Slider.svelte +5 -1
- package/dist/components/slider/state.svelte.js +3 -1
- package/dist/components/tabs/Tabs.svelte +5 -1
- package/dist/components/tags/Tags.svelte +5 -1
- package/dist/types/components/accordion.d.ts +1 -1
- package/dist/types/components/dropzone.d.ts +1 -1
- package/dist/types/components/pin.d.ts +1 -1
- package/dist/types/components/slider.d.ts +5 -0
- package/dist/types/components/tabs.d.ts +5 -0
- package/dist/types/components/tags.d.ts +5 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
value = $bindable(''),
|
|
14
14
|
children,
|
|
15
15
|
custom,
|
|
16
|
-
|
|
16
|
+
onValueChanged,
|
|
17
17
|
...props
|
|
18
18
|
}: AccordionProps<typeof ctx.props> = $props();
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
() => value,
|
|
25
25
|
(v) => {
|
|
26
26
|
value = v;
|
|
27
|
-
|
|
27
|
+
onValueChanged?.(v);
|
|
28
28
|
}
|
|
29
29
|
)
|
|
30
30
|
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
accept = '',
|
|
18
18
|
onError,
|
|
19
19
|
onSuccess,
|
|
20
|
-
|
|
20
|
+
onFilesChanged,
|
|
21
21
|
children,
|
|
22
22
|
validate,
|
|
23
23
|
custom,
|
|
@@ -27,10 +27,7 @@
|
|
|
27
27
|
let ctx = createDropzoneRootContext({
|
|
28
28
|
id: stateValue(() => id),
|
|
29
29
|
ref: stateValue(() => ref!),
|
|
30
|
-
files: stateValue(
|
|
31
|
-
() => files,
|
|
32
|
-
(v) => (files = v)
|
|
33
|
-
),
|
|
30
|
+
files: stateValue(() => files),
|
|
34
31
|
disabled: stateValue(
|
|
35
32
|
() => disabled,
|
|
36
33
|
(v) => (disabled = v)
|
|
@@ -41,7 +38,7 @@
|
|
|
41
38
|
onError,
|
|
42
39
|
onSuccess,
|
|
43
40
|
validate,
|
|
44
|
-
|
|
41
|
+
onFilesChanged
|
|
45
42
|
});
|
|
46
43
|
</script>
|
|
47
44
|
|
|
@@ -10,6 +10,10 @@ class DropzoneRoot {
|
|
|
10
10
|
sharedIds = new SvelteMap();
|
|
11
11
|
constructor(props) {
|
|
12
12
|
this.$$ = props;
|
|
13
|
+
$effect(() => {
|
|
14
|
+
this.$$.onFilesChanged?.($state.snapshot(this.$$.files.val));
|
|
15
|
+
this.errorsFound = false;
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
checkFileType = (file) => {
|
|
15
19
|
const fileExtension = file.name.split('.').pop()?.toLowerCase();
|
|
@@ -30,7 +34,6 @@ class DropzoneRoot {
|
|
|
30
34
|
handleFiles = (filelist) => {
|
|
31
35
|
const files = Array.from(filelist);
|
|
32
36
|
const length = this.$$.multiple.val ? files.length : 1;
|
|
33
|
-
this.$$.onChange?.(this.$$.files.val);
|
|
34
37
|
for (let i = 0; i < length; i++) {
|
|
35
38
|
const file = files[i];
|
|
36
39
|
if (this.$$.maxSize.val > 0 && file.size > this.$$.maxSize.val) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
disabled = $bindable(false),
|
|
16
16
|
placeholder = '○',
|
|
17
17
|
type = $bindable('text'),
|
|
18
|
-
|
|
18
|
+
onValueChanged,
|
|
19
19
|
onFilled,
|
|
20
20
|
ref = $bindable(),
|
|
21
21
|
...props
|
|
@@ -26,15 +26,13 @@
|
|
|
26
26
|
ref: stateValue(() => ref!),
|
|
27
27
|
value: stateValue(
|
|
28
28
|
() => value,
|
|
29
|
-
(v) =>
|
|
30
|
-
value = v;
|
|
31
|
-
onChanged?.(v);
|
|
32
|
-
}
|
|
29
|
+
(v) => (value = v)
|
|
33
30
|
),
|
|
34
31
|
disabled: stateValue(() => disabled),
|
|
35
32
|
placeholder: stateValue(() => placeholder),
|
|
36
33
|
type: stateValue(() => type),
|
|
37
|
-
onFilled
|
|
34
|
+
onFilled,
|
|
35
|
+
onValueChanged
|
|
38
36
|
});
|
|
39
37
|
</script>
|
|
40
38
|
|
|
@@ -16,7 +16,10 @@ class PinRoot {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
setValue = (index, value) => {
|
|
19
|
+
const oldValue = this.$$.value.val[index];
|
|
19
20
|
this.$$.value.val[index] = value;
|
|
21
|
+
if (this.$$.value.val[index] !== oldValue)
|
|
22
|
+
this.$$.onValueChanged?.($state.snapshot(this.$$.value.val));
|
|
20
23
|
};
|
|
21
24
|
registerInput = (id) => {
|
|
22
25
|
if (!this.inputs.includes(id))
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
reverse = $bindable(false),
|
|
21
21
|
disabled = $bindable(false),
|
|
22
22
|
ref = $bindable(),
|
|
23
|
+
onValueChanged,
|
|
23
24
|
...props
|
|
24
25
|
}: SliderProps<typeof ctx.state> = $props();
|
|
25
26
|
|
|
@@ -28,7 +29,10 @@
|
|
|
28
29
|
ref: stateValue(() => ref!),
|
|
29
30
|
value: stateValue(
|
|
30
31
|
() => value,
|
|
31
|
-
(v) =>
|
|
32
|
+
(v) => {
|
|
33
|
+
value = v;
|
|
34
|
+
onValueChanged?.(v);
|
|
35
|
+
}
|
|
32
36
|
),
|
|
33
37
|
min: stateValue(() => min),
|
|
34
38
|
max: stateValue(() => max),
|
|
@@ -41,11 +41,13 @@ class SliderRoot {
|
|
|
41
41
|
: this.$$.reverse.val
|
|
42
42
|
? top
|
|
43
43
|
: bottom;
|
|
44
|
-
|
|
44
|
+
const value = clamp(this.$$.min.val, Math.round(((this.$$.max.val - this.$$.min.val) *
|
|
45
45
|
((position - start) / length) *
|
|
46
46
|
(this.$$.reverse.val ? -1 : 1) *
|
|
47
47
|
(this.$$.orientation.val === 'vertical' ? -1 : 1)) /
|
|
48
48
|
this.$$.step.val) * this.$$.step.val, this.$$.max.val);
|
|
49
|
+
if (this.$$.value.val !== value)
|
|
50
|
+
this.$$.value.val = value;
|
|
49
51
|
};
|
|
50
52
|
stepUp = () => {
|
|
51
53
|
this.$$.value.val = clamp(this.$$.min.val, (this.$$.value.val += this.$$.step.val), this.$$.max.val);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
value = $bindable(''),
|
|
15
15
|
orientation = $bindable('horizontal'),
|
|
16
16
|
ref = $bindable(),
|
|
17
|
+
onValueChanged,
|
|
17
18
|
...props
|
|
18
19
|
}: TabsProps<typeof ctx.props> = $props();
|
|
19
20
|
|
|
@@ -22,7 +23,10 @@
|
|
|
22
23
|
ref: stateValue(() => ref!),
|
|
23
24
|
value: stateValue(
|
|
24
25
|
() => value,
|
|
25
|
-
(v) =>
|
|
26
|
+
(v) => {
|
|
27
|
+
value = v;
|
|
28
|
+
onValueChanged?.(v);
|
|
29
|
+
}
|
|
26
30
|
),
|
|
27
31
|
orientation: stateValue(() => orientation)
|
|
28
32
|
});
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
whitelist = [],
|
|
18
18
|
disabled = $bindable(false),
|
|
19
19
|
max = 0,
|
|
20
|
+
onValueChanged,
|
|
20
21
|
...props
|
|
21
22
|
}: TagsProps<typeof ctx.props> = $props();
|
|
22
23
|
|
|
@@ -25,7 +26,10 @@
|
|
|
25
26
|
ref: stateValue(() => ref!),
|
|
26
27
|
value: stateValue(
|
|
27
28
|
() => value,
|
|
28
|
-
(v) =>
|
|
29
|
+
(v) => {
|
|
30
|
+
value = v;
|
|
31
|
+
onValueChanged?.(v);
|
|
32
|
+
}
|
|
29
33
|
),
|
|
30
34
|
blacklist: stateValue(() => blacklist),
|
|
31
35
|
whitelist: stateValue(() => whitelist),
|
|
@@ -10,7 +10,7 @@ export interface AccordionProps<P = any> extends Props<HTMLElement, P, Accordion
|
|
|
10
10
|
* Fires whenever the `value` prop is changed.
|
|
11
11
|
* @param val The new value
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
onValueChanged?: (val: string | string[]) => void;
|
|
14
14
|
}
|
|
15
15
|
export interface AccordionState {
|
|
16
16
|
/**
|
|
@@ -76,7 +76,7 @@ export interface DropzoneProps<P = any> extends Props<HTMLElement, P, DropzoneSt
|
|
|
76
76
|
* When files are successfully added or removed to the `files` prop, this event will be fired.
|
|
77
77
|
* @param files The new value of `files`.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
onFilesChanged?: (files: File[]) => void;
|
|
80
80
|
}
|
|
81
81
|
export interface DropzoneState {
|
|
82
82
|
/**
|
|
@@ -24,7 +24,7 @@ export interface PinProps<P = any> extends Props<HTMLElement, P, PinState> {
|
|
|
24
24
|
* Fires when the `value` prop is changed.
|
|
25
25
|
* @param value The new value
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
onValueChanged?: (value: string[]) => void;
|
|
28
28
|
/**
|
|
29
29
|
* Fires when all inputs have been filled in.
|
|
30
30
|
* @param value The filled out value.
|
|
@@ -32,6 +32,11 @@ export interface SliderProps<P = any> extends Props<HTMLElement, P, SliderState>
|
|
|
32
32
|
* ### `$bindable`
|
|
33
33
|
*/
|
|
34
34
|
disabled?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Fires whenever the `value` prop changes.
|
|
37
|
+
* @param value The new value of the slider.
|
|
38
|
+
*/
|
|
39
|
+
onValueChanged?: (value: number) => void;
|
|
35
40
|
}
|
|
36
41
|
export interface SliderState {
|
|
37
42
|
/**
|
|
@@ -10,6 +10,11 @@ export interface TabsProps<P = any> extends Props<HTMLElement, P, TabsState> {
|
|
|
10
10
|
* The direction of the tabs.
|
|
11
11
|
*/
|
|
12
12
|
orientation?: Orientation;
|
|
13
|
+
/**
|
|
14
|
+
* Fires whenever the `value` prop changes.
|
|
15
|
+
* @param value The new value of tabs.
|
|
16
|
+
*/
|
|
17
|
+
onValueChanged?: (value: string) => void;
|
|
13
18
|
}
|
|
14
19
|
export interface TabsState {
|
|
15
20
|
/**
|
|
@@ -24,6 +24,11 @@ export interface TagsProps<P = any> extends Props<HTMLElement, P, TagsState> {
|
|
|
24
24
|
* Don't allow these string to be addeed to the `value` prop.
|
|
25
25
|
*/
|
|
26
26
|
blacklist?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Fires whenever the `value` prop changes.
|
|
29
|
+
* @param value The new value of the tags.
|
|
30
|
+
*/
|
|
31
|
+
onValueChanged?: (value: string[]) => void;
|
|
27
32
|
}
|
|
28
33
|
export interface TagsState {
|
|
29
34
|
/**
|