lithesome 0.20.1 → 0.20.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.
- package/dist/components/accordion/Accordion.svelte +1 -1
- package/dist/components/accordion/AccordionButton.svelte +1 -1
- package/dist/components/accordion/AccordionContent.svelte +1 -1
- package/dist/components/accordion/AccordionHeading.svelte +1 -1
- package/dist/components/accordion/AccordionItem.svelte +1 -1
- package/dist/components/accordion/state.svelte.d.ts +5 -9
- package/dist/components/accordion/state.svelte.js +36 -43
- package/dist/components/checkbox/CheckboxButton.svelte +1 -1
- package/dist/components/checkbox/CheckboxGroup.svelte +1 -1
- package/dist/components/checkbox/CheckboxLabel.svelte +1 -1
- package/dist/components/checkbox/state.svelte.d.ts +3 -9
- package/dist/components/checkbox/state.svelte.js +21 -33
- package/dist/components/dropzone/state.svelte.d.ts +21 -0
- package/dist/components/dropzone/state.svelte.js +37 -0
- package/dist/components/hovercard/HovercardArrow.svelte +1 -1
- package/dist/components/hovercard/HovercardContent.svelte +2 -2
- package/dist/components/hovercard/HovercardTrigger.svelte +1 -1
- package/dist/components/hovercard/state.svelte.d.ts +6 -10
- package/dist/components/hovercard/state.svelte.js +25 -33
- package/dist/components/menu/MenuArrow.svelte +1 -1
- package/dist/components/menu/MenuContent.svelte +2 -2
- package/dist/components/menu/MenuItem.svelte +1 -1
- package/dist/components/menu/MenuSub.svelte +2 -1
- package/dist/components/menu/MenuSubContent.svelte +2 -2
- package/dist/components/menu/MenuSubTrigger.svelte +1 -1
- package/dist/components/menu/MenuTrigger.svelte +1 -1
- package/dist/components/menu/state.svelte.d.ts +8 -14
- package/dist/components/menu/state.svelte.js +70 -82
- package/dist/components/modal/Modal.svelte +1 -1
- package/dist/components/modal/ModalBackdrop.svelte +2 -2
- package/dist/components/modal/ModalContent.svelte +2 -2
- package/dist/components/modal/ModalDescription.svelte +2 -2
- package/dist/components/modal/ModalTitle.svelte +2 -2
- package/dist/components/modal/ModalTrigger.svelte +1 -1
- package/dist/components/modal/state.svelte.d.ts +8 -12
- package/dist/components/modal/state.svelte.js +39 -47
- package/dist/components/pin/Pin.svelte +2 -2
- package/dist/components/pin/PinInput.svelte +1 -1
- package/dist/components/pin/state.svelte.d.ts +2 -6
- package/dist/components/pin/state.svelte.js +21 -29
- package/dist/components/radiogroup/RadioGroup.svelte +1 -1
- package/dist/components/radiogroup/RadioGroupItem.svelte +1 -1
- package/dist/components/radiogroup/state.svelte.d.ts +2 -6
- package/dist/components/radiogroup/state.svelte.js +18 -26
- package/dist/components/select/Select.svelte +1 -1
- package/dist/components/select/SelectArrow.svelte +1 -1
- package/dist/components/select/SelectContent.svelte +1 -1
- package/dist/components/select/SelectOption.svelte +1 -1
- package/dist/components/select/SelectTrigger.svelte +1 -1
- package/dist/components/select/SelectValue.svelte +1 -1
- package/dist/components/select/state.svelte.d.ts +6 -20
- package/dist/components/select/state.svelte.js +59 -83
- package/dist/components/slider/Slider.svelte +1 -1
- package/dist/components/slider/SliderRange.svelte +1 -1
- package/dist/components/slider/SliderThumb.svelte +1 -1
- package/dist/components/slider/SliderValue.svelte +1 -1
- package/dist/components/slider/state.svelte.d.ts +4 -11
- package/dist/components/slider/state.svelte.js +50 -58
- package/dist/components/tabs/Tabs.svelte +1 -1
- package/dist/components/tabs/TabsButton.svelte +1 -1
- package/dist/components/tabs/TabsContent.svelte +1 -1
- package/dist/components/tabs/TabsList.svelte +1 -1
- package/dist/components/tabs/state.svelte.d.ts +4 -9
- package/dist/components/tabs/state.svelte.js +30 -40
- package/dist/components/tags/Tags.svelte +1 -1
- package/dist/components/tags/TagsDelete.svelte +1 -1
- package/dist/components/tags/TagsInput.svelte +1 -1
- package/dist/components/tags/TagsItem.svelte +1 -1
- package/dist/components/tags/state.svelte.d.ts +4 -11
- package/dist/components/tags/state.svelte.js +30 -44
- package/dist/components/tooltip/Tooltip.svelte +1 -1
- package/dist/components/tooltip/TooltipArrow.svelte +1 -1
- package/dist/components/tooltip/TooltipContent.svelte +1 -1
- package/dist/components/tooltip/TooltipTrigger.svelte +1 -1
- package/dist/components/tooltip/state.svelte.d.ts +4 -9
- package/dist/components/tooltip/state.svelte.js +22 -31
- package/dist/internals/types.d.ts +2 -3
- package/dist/types/components/dropzone.d.ts +10 -0
- package/dist/types/components/dropzone.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
...props
|
|
15
15
|
}: AccordionButtonProps<typeof ctx.props, typeof ctx.state> = $props();
|
|
16
16
|
|
|
17
|
-
let ctx = useAccordionButton({ id, ref: stateValue(() => ref!) });
|
|
17
|
+
let ctx = useAccordionButton({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<Element bind:ref {children} {custom} {ctx} as="button" {...props} />
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
...props
|
|
15
15
|
}: AccordionContentProps<typeof ctx.props, typeof ctx.state> = $props();
|
|
16
16
|
|
|
17
|
-
let ctx = useAccordionContent({ id, ref: stateValue(() => ref!) });
|
|
17
|
+
let ctx = useAccordionContent({ id: stateValue(() => id), ref: stateValue(() => ref!) });
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<Element bind:ref {children} {custom} {ctx} visible={ctx._item.Active} {...props} />
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}: AccordionItemProps<typeof ctx.props, typeof ctx.state> = $props();
|
|
19
19
|
|
|
20
20
|
let ctx = createAccordionItemContext({
|
|
21
|
-
id,
|
|
21
|
+
id: stateValue(() => id),
|
|
22
22
|
ref: stateValue(() => ref!),
|
|
23
23
|
value: stateValue(() => value),
|
|
24
24
|
disabled: stateValue(() => disabled)
|
|
@@ -3,8 +3,7 @@ import type { GetInternalProps } from '../../internals/types.js';
|
|
|
3
3
|
import type { AccordionButtonProps, AccordionContentProps, AccordionHeadingProps, AccordionItemProps, AccordionProps } from '../../types/index.js';
|
|
4
4
|
type RootProps = GetInternalProps<AccordionProps>;
|
|
5
5
|
export declare class AccordionRoot {
|
|
6
|
-
|
|
7
|
-
$value: RootProps['value'];
|
|
6
|
+
$$: RootProps;
|
|
8
7
|
items: string[];
|
|
9
8
|
constructor(props: RootProps);
|
|
10
9
|
toggleActiveItem: (itemId: string) => void;
|
|
@@ -19,9 +18,7 @@ export declare class AccordionRoot {
|
|
|
19
18
|
}
|
|
20
19
|
type ItemProps = GetInternalProps<AccordionItemProps>;
|
|
21
20
|
declare class AccordionItem {
|
|
22
|
-
|
|
23
|
-
$value: ItemProps['value'];
|
|
24
|
-
$disabled: ItemProps['disabled'];
|
|
21
|
+
$$: ItemProps;
|
|
25
22
|
_root: AccordionRoot;
|
|
26
23
|
sharedIds: SvelteMap<"content" | "item" | "button", string>;
|
|
27
24
|
Active: boolean;
|
|
@@ -38,8 +35,7 @@ declare class AccordionItem {
|
|
|
38
35
|
}
|
|
39
36
|
type HeadingProps = GetInternalProps<AccordionHeadingProps>;
|
|
40
37
|
declare class AccordionHeading {
|
|
41
|
-
|
|
42
|
-
$level: HeadingProps['level'];
|
|
38
|
+
$$: HeadingProps;
|
|
43
39
|
_root: AccordionRoot;
|
|
44
40
|
_item: AccordionItem;
|
|
45
41
|
constructor(root: AccordionRoot, item: AccordionItem, props: HeadingProps);
|
|
@@ -55,7 +51,7 @@ declare class AccordionHeading {
|
|
|
55
51
|
}
|
|
56
52
|
type ButtonProps = GetInternalProps<AccordionButtonProps>;
|
|
57
53
|
declare class AccordionButton {
|
|
58
|
-
|
|
54
|
+
$$: ButtonProps;
|
|
59
55
|
_item: AccordionItem;
|
|
60
56
|
_root: AccordionRoot;
|
|
61
57
|
constructor(item: AccordionItem, root: AccordionRoot, props: ButtonProps);
|
|
@@ -74,7 +70,7 @@ declare class AccordionButton {
|
|
|
74
70
|
}
|
|
75
71
|
type ContentProps = GetInternalProps<AccordionContentProps>;
|
|
76
72
|
declare class AccordionContent {
|
|
77
|
-
|
|
73
|
+
$$: ContentProps;
|
|
78
74
|
_item: AccordionItem;
|
|
79
75
|
_root: AccordionRoot;
|
|
80
76
|
constructor(item: AccordionItem, root: AccordionRoot, props: ContentProps);
|
|
@@ -4,125 +4,118 @@ import { buildContext } from '../../internals/context.svelte.js';
|
|
|
4
4
|
import { addEvents, createAttributes } from '../../internals/utils.svelte.js';
|
|
5
5
|
const { attrs } = createAttributes('accordion', ['root', 'item', 'heading', 'button', 'content']);
|
|
6
6
|
export class AccordionRoot {
|
|
7
|
-
|
|
8
|
-
$value;
|
|
7
|
+
$$;
|
|
9
8
|
items = $state([]);
|
|
10
9
|
constructor(props) {
|
|
11
|
-
this
|
|
12
|
-
this.$id = props.id;
|
|
10
|
+
this.$$ = props;
|
|
13
11
|
}
|
|
14
12
|
toggleActiveItem = (itemId) => {
|
|
15
|
-
if (Array.isArray(this
|
|
16
|
-
if (this
|
|
17
|
-
this
|
|
13
|
+
if (Array.isArray(this.$$.value.val)) {
|
|
14
|
+
if (this.$$.value.val.includes(itemId))
|
|
15
|
+
this.$$.value.val = this.$$.value.val.filter((el) => el != itemId);
|
|
18
16
|
else
|
|
19
|
-
this
|
|
17
|
+
this.$$.value.val.push(itemId);
|
|
18
|
+
console.log(this.$$.value.val);
|
|
20
19
|
}
|
|
21
20
|
else {
|
|
22
|
-
if (this
|
|
23
|
-
this
|
|
21
|
+
if (this.$$.value.val === itemId)
|
|
22
|
+
this.$$.value.val = '';
|
|
24
23
|
else
|
|
25
|
-
this
|
|
24
|
+
this.$$.value.val = itemId;
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
isActive = (value) => {
|
|
29
|
-
return typeof this
|
|
28
|
+
return typeof this.$$.value.val === 'string' ? this.$$.value.val === value : this.$$.value.val.includes(value);
|
|
30
29
|
};
|
|
31
30
|
props = $derived.by(() => ({
|
|
32
|
-
id: this
|
|
31
|
+
id: this.$$.id.val,
|
|
33
32
|
[attrs.root]: ''
|
|
34
33
|
}));
|
|
35
34
|
state = $derived.by(() => ({
|
|
36
|
-
value: this
|
|
35
|
+
value: this.$$.value.val
|
|
37
36
|
}));
|
|
38
37
|
}
|
|
39
38
|
class AccordionItem {
|
|
40
|
-
|
|
41
|
-
$value;
|
|
42
|
-
$disabled;
|
|
39
|
+
$$;
|
|
43
40
|
_root;
|
|
44
41
|
sharedIds = new SvelteMap();
|
|
45
|
-
Active = $derived.by(() => this._root.isActive(this
|
|
42
|
+
Active = $derived.by(() => this._root.isActive(this.$$.value.val));
|
|
46
43
|
constructor(root, props) {
|
|
44
|
+
this.$$ = props;
|
|
47
45
|
this._root = root;
|
|
48
|
-
this
|
|
49
|
-
this.$disabled = props.disabled;
|
|
50
|
-
this.$id = props.id;
|
|
51
|
-
this.sharedIds.set('item', this.$id);
|
|
46
|
+
this.sharedIds.set('item', this.$$.id.val);
|
|
52
47
|
}
|
|
53
48
|
props = $derived.by(() => ({
|
|
54
|
-
id: this
|
|
49
|
+
id: this.$$.id.val,
|
|
55
50
|
[attrs.item]: '',
|
|
56
|
-
'data-value': this
|
|
51
|
+
'data-value': this.$$.value.val
|
|
57
52
|
}));
|
|
58
53
|
state = $derived.by(() => ({
|
|
59
54
|
active: this.Active,
|
|
60
|
-
disabled: this
|
|
55
|
+
disabled: this.$$.disabled.val
|
|
61
56
|
}));
|
|
62
57
|
}
|
|
63
58
|
class AccordionHeading {
|
|
64
|
-
|
|
65
|
-
$level;
|
|
59
|
+
$$;
|
|
66
60
|
_root;
|
|
67
61
|
_item;
|
|
68
62
|
constructor(root, item, props) {
|
|
63
|
+
this.$$ = props;
|
|
69
64
|
this._root = root;
|
|
70
65
|
this._item = item;
|
|
71
|
-
this.$level = props.level;
|
|
72
|
-
this.$id = props.id;
|
|
73
66
|
}
|
|
74
67
|
props = $derived.by(() => ({
|
|
75
|
-
id: this
|
|
68
|
+
id: this.$$.id.val,
|
|
76
69
|
[attrs.heading]: '',
|
|
77
70
|
role: 'heading',
|
|
78
|
-
'aria-level': this
|
|
71
|
+
'aria-level': this.$$.level.val
|
|
79
72
|
}));
|
|
80
73
|
state = $derived.by(() => ({
|
|
81
74
|
active: this._item.Active
|
|
82
75
|
}));
|
|
83
76
|
}
|
|
84
77
|
class AccordionButton {
|
|
85
|
-
|
|
78
|
+
$$;
|
|
86
79
|
_item;
|
|
87
80
|
_root;
|
|
88
81
|
constructor(item, root, props) {
|
|
82
|
+
this.$$ = props;
|
|
89
83
|
this._item = item;
|
|
90
84
|
this._root = root;
|
|
91
|
-
this
|
|
92
|
-
this._item.sharedIds.set('button', this.$id);
|
|
85
|
+
this._item.sharedIds.set('button', this.$$.id.val);
|
|
93
86
|
}
|
|
94
87
|
props = $derived.by(() => ({
|
|
95
|
-
id: this
|
|
88
|
+
id: this.$$.id.val,
|
|
96
89
|
[attrs.button]: '',
|
|
97
90
|
type: 'button',
|
|
98
91
|
'aria-expanded': this._item.Active,
|
|
99
92
|
'aria-controls': this._item.Active ? this._item.sharedIds.get('content') : undefined,
|
|
100
|
-
tabindex: this._item
|
|
93
|
+
tabindex: this._item.$$.disabled.val ? -1 : 0,
|
|
101
94
|
...attach((node) => addEvents(node, {
|
|
102
95
|
click: () => {
|
|
103
|
-
if (this._item
|
|
96
|
+
if (this._item.$$.disabled.val)
|
|
104
97
|
return;
|
|
105
|
-
this._root.toggleActiveItem(this._item
|
|
98
|
+
this._root.toggleActiveItem(this._item.$$.value.val);
|
|
106
99
|
}
|
|
107
100
|
}))
|
|
108
101
|
}));
|
|
109
102
|
state = $derived.by(() => ({
|
|
110
103
|
active: this._item.Active,
|
|
111
|
-
disabled: this._item
|
|
104
|
+
disabled: this._item.$$.disabled.val
|
|
112
105
|
}));
|
|
113
106
|
}
|
|
114
107
|
class AccordionContent {
|
|
115
|
-
|
|
108
|
+
$$;
|
|
116
109
|
_item;
|
|
117
110
|
_root;
|
|
118
111
|
constructor(item, root, props) {
|
|
112
|
+
this.$$ = props;
|
|
119
113
|
this._item = item;
|
|
120
114
|
this._root = root;
|
|
121
|
-
this
|
|
122
|
-
this._item.sharedIds.set('content', this.$id);
|
|
115
|
+
this._item.sharedIds.set('content', this.$$.id.val);
|
|
123
116
|
}
|
|
124
117
|
props = $derived.by(() => ({
|
|
125
|
-
id: this
|
|
118
|
+
id: this.$$.id.val,
|
|
126
119
|
[attrs.content]: ''
|
|
127
120
|
}));
|
|
128
121
|
state = $derived.by(() => ({
|
|
@@ -3,9 +3,7 @@ import type { GetInternalProps } from '../../internals/types.js';
|
|
|
3
3
|
import type { CheckboxButtonProps, CheckboxGroupProps, CheckboxLabelProps } from '../../types/index.js';
|
|
4
4
|
type GroupProps = GetInternalProps<CheckboxGroupProps>;
|
|
5
5
|
declare class CheckboxGroup {
|
|
6
|
-
|
|
7
|
-
$checked: GroupProps['checked'];
|
|
8
|
-
$disabled: GroupProps['disabled'];
|
|
6
|
+
$$: GroupProps;
|
|
9
7
|
sharedIds: SvelteMap<"button" | "label", string>;
|
|
10
8
|
constructor(props: GroupProps);
|
|
11
9
|
props: {
|
|
@@ -19,11 +17,7 @@ declare class CheckboxGroup {
|
|
|
19
17
|
}
|
|
20
18
|
type ButtonProps = GetInternalProps<CheckboxButtonProps>;
|
|
21
19
|
declare class CheckboxButton {
|
|
22
|
-
|
|
23
|
-
$checked: ButtonProps['checked'];
|
|
24
|
-
$disabled: ButtonProps['disabled'];
|
|
25
|
-
$name: ButtonProps['name'];
|
|
26
|
-
$required: ButtonProps['required'];
|
|
20
|
+
$$: ButtonProps;
|
|
27
21
|
_group?: CheckboxGroup;
|
|
28
22
|
Checked: import("../../types/index.js").CheckboxChecked;
|
|
29
23
|
Disabled: boolean;
|
|
@@ -46,7 +40,7 @@ declare class CheckboxButton {
|
|
|
46
40
|
}
|
|
47
41
|
type LabelProps = GetInternalProps<CheckboxLabelProps>;
|
|
48
42
|
declare class CheckboxLabel {
|
|
49
|
-
|
|
43
|
+
$$: LabelProps;
|
|
50
44
|
_group: CheckboxGroup;
|
|
51
45
|
constructor(group: CheckboxGroup, props: LabelProps);
|
|
52
46
|
props: {
|
|
@@ -2,52 +2,40 @@ import { SvelteMap } from 'svelte/reactivity';
|
|
|
2
2
|
import { addEvents, attach, buildContext, createAttributes } from '../../internals/index.js';
|
|
3
3
|
const { attrs } = createAttributes('checkbox', ['group', 'button', 'group', 'label']);
|
|
4
4
|
class CheckboxGroup {
|
|
5
|
-
|
|
6
|
-
$checked;
|
|
7
|
-
$disabled;
|
|
5
|
+
$$;
|
|
8
6
|
sharedIds = new SvelteMap();
|
|
9
7
|
constructor(props) {
|
|
10
|
-
this
|
|
11
|
-
this.$checked = props.checked;
|
|
12
|
-
this.$disabled = props.disabled;
|
|
8
|
+
this.$$ = props;
|
|
13
9
|
}
|
|
14
10
|
props = $derived.by(() => ({
|
|
15
|
-
id: this
|
|
11
|
+
id: this.$$.id.val,
|
|
16
12
|
[attrs.group]: ''
|
|
17
13
|
}));
|
|
18
14
|
state = $derived.by(() => ({
|
|
19
|
-
checked: this
|
|
20
|
-
disabled: this
|
|
15
|
+
checked: this.$$.checked.val,
|
|
16
|
+
disabled: this.$$.disabled.val
|
|
21
17
|
}));
|
|
22
18
|
}
|
|
23
19
|
class CheckboxButton {
|
|
24
|
-
|
|
25
|
-
$checked;
|
|
26
|
-
$disabled;
|
|
27
|
-
$name;
|
|
28
|
-
$required;
|
|
20
|
+
$$;
|
|
29
21
|
_group;
|
|
30
|
-
Checked = $derived.by(() => this._group
|
|
31
|
-
Disabled = $derived.by(() => this._group
|
|
22
|
+
Checked = $derived.by(() => this._group?.$$.checked.val || this.$$.checked.val);
|
|
23
|
+
Disabled = $derived.by(() => this._group?.$$.disabled.val || this.$$.disabled.val);
|
|
32
24
|
CheckedBool = $derived.by(() => !!this.Checked);
|
|
33
25
|
constructor(props, group) {
|
|
34
|
-
this
|
|
35
|
-
this.$checked = props.checked;
|
|
36
|
-
this.$disabled = props.disabled;
|
|
37
|
-
this.$name = props.name;
|
|
38
|
-
this.$required = props.required;
|
|
26
|
+
this.$$ = props;
|
|
39
27
|
if (group) {
|
|
40
28
|
this._group = group;
|
|
41
|
-
this._group.sharedIds.set('button', this
|
|
29
|
+
this._group.sharedIds.set('button', this.$$.id.val);
|
|
42
30
|
}
|
|
43
31
|
}
|
|
44
32
|
props = $derived.by(() => ({
|
|
45
|
-
id: this
|
|
33
|
+
id: this.$$.id.val,
|
|
46
34
|
[attrs.button]: '',
|
|
47
35
|
role: 'checkbox',
|
|
48
36
|
type: 'button',
|
|
49
37
|
'aria-checked': this.Checked,
|
|
50
|
-
'aria-required': this
|
|
38
|
+
'aria-required': this.$$.required.val || undefined,
|
|
51
39
|
'aria-labelledby': this._group?.sharedIds.get('label'),
|
|
52
40
|
disabled: this.Disabled || undefined,
|
|
53
41
|
...attach((node) => addEvents(node, {
|
|
@@ -55,11 +43,11 @@ class CheckboxButton {
|
|
|
55
43
|
if (this.Disabled)
|
|
56
44
|
return;
|
|
57
45
|
if (this._group) {
|
|
58
|
-
this._group
|
|
59
|
-
this
|
|
46
|
+
this._group.$$.checked.val = !this._group.$$.checked.val;
|
|
47
|
+
this.$$.checked.val = this._group.$$.checked.val;
|
|
60
48
|
}
|
|
61
49
|
else
|
|
62
|
-
this
|
|
50
|
+
this.$$.checked.val = !this.$$.checked.val;
|
|
63
51
|
}
|
|
64
52
|
}))
|
|
65
53
|
}));
|
|
@@ -69,21 +57,21 @@ class CheckboxButton {
|
|
|
69
57
|
}));
|
|
70
58
|
}
|
|
71
59
|
class CheckboxLabel {
|
|
72
|
-
|
|
60
|
+
$$;
|
|
73
61
|
_group;
|
|
74
62
|
constructor(group, props) {
|
|
63
|
+
this.$$ = props;
|
|
75
64
|
this._group = group;
|
|
76
|
-
this
|
|
77
|
-
this._group.sharedIds.set('label', this.$id);
|
|
65
|
+
this._group.sharedIds.set('label', this.$$.id.val);
|
|
78
66
|
}
|
|
79
67
|
props = $derived.by(() => ({
|
|
80
|
-
id: this
|
|
68
|
+
id: this.$$.id.val,
|
|
81
69
|
[attrs.label]: '',
|
|
82
70
|
for: this._group.sharedIds.get('button')
|
|
83
71
|
}));
|
|
84
72
|
state = $derived.by(() => ({
|
|
85
|
-
checked: this._group
|
|
86
|
-
disabled: this._group
|
|
73
|
+
checked: this._group.$$.checked.val,
|
|
74
|
+
disabled: this._group.$$.disabled.val
|
|
87
75
|
}));
|
|
88
76
|
}
|
|
89
77
|
//
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GetInternalProps } from '../../internals/types.js';
|
|
2
|
+
import type { DropzoneProps } from '../../types/index.js';
|
|
3
|
+
type RootProps = GetInternalProps<DropzoneProps>;
|
|
4
|
+
declare class DropzoneRoot {
|
|
5
|
+
$id: RootProps['id'];
|
|
6
|
+
$files: RootProps['files'];
|
|
7
|
+
$multiple: RootProps['multiple'];
|
|
8
|
+
$maxSize: RootProps['maxSize'];
|
|
9
|
+
$accept: RootProps['accept'];
|
|
10
|
+
$disabled: RootProps['disabled'];
|
|
11
|
+
constructor(props: RootProps);
|
|
12
|
+
props: {
|
|
13
|
+
id: {
|
|
14
|
+
val: string;
|
|
15
|
+
};
|
|
16
|
+
"data-dropzone-root": string;
|
|
17
|
+
};
|
|
18
|
+
state: {};
|
|
19
|
+
}
|
|
20
|
+
export declare const createDropzoneRootContext: (props: RootProps) => DropzoneRoot;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { buildContext, createAttributes } from '../../internals/index.js';
|
|
2
|
+
const { attrs, selectors } = createAttributes('dropzone', ['root', 'input']);
|
|
3
|
+
class DropzoneRoot {
|
|
4
|
+
$id;
|
|
5
|
+
$files;
|
|
6
|
+
$multiple;
|
|
7
|
+
$maxSize;
|
|
8
|
+
$accept;
|
|
9
|
+
$disabled;
|
|
10
|
+
constructor(props) {
|
|
11
|
+
this.$id = props.id;
|
|
12
|
+
this.$files = props.files;
|
|
13
|
+
this.$multiple = props.multiple;
|
|
14
|
+
this.$maxSize = props.maxSize;
|
|
15
|
+
this.$accept = props.accept;
|
|
16
|
+
this.$disabled = props.disabled;
|
|
17
|
+
}
|
|
18
|
+
props = $derived.by(() => ({
|
|
19
|
+
id: this.$id,
|
|
20
|
+
[attrs.root]: ''
|
|
21
|
+
}));
|
|
22
|
+
state = $derived.by(() => ({}));
|
|
23
|
+
}
|
|
24
|
+
// type InputProps = GetInternalProps<DropzoneInputProps>;
|
|
25
|
+
// class DropzoneInput {
|
|
26
|
+
// $id: InputProps['id'];
|
|
27
|
+
// _root: DropzoneRoot;
|
|
28
|
+
// constructor(root:DropzoneRoot, props: InputProps) {
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
//
|
|
32
|
+
// ~BUILDERS
|
|
33
|
+
//
|
|
34
|
+
const rootCtx = buildContext(DropzoneRoot);
|
|
35
|
+
export const createDropzoneRootContext = (props) => {
|
|
36
|
+
return rootCtx.create(props);
|
|
37
|
+
};
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
}: HovercardContentProps<typeof ctx.props, typeof ctx.state> = $props();
|
|
16
16
|
|
|
17
17
|
let ctx = useHovercardContent({
|
|
18
|
-
id,
|
|
18
|
+
id: stateValue(() => id),
|
|
19
19
|
ref: stateValue(() => ref!)
|
|
20
20
|
});
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
|
-
<Element bind:ref {children} {custom} visible={ctx._root
|
|
23
|
+
<Element bind:ref {children} {custom} visible={ctx._root.$$.visible.val} {ctx} {...props} />
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { SvelteMap } from 'svelte/reactivity';
|
|
2
2
|
import { Floating } from '../../internals/index.js';
|
|
3
|
-
import type { GetInternalProps
|
|
3
|
+
import type { GetInternalProps } from '../../internals/index.js';
|
|
4
4
|
import type { HovercardArrowProps, HovercardContentProps, HovercardProps, HovercardTriggerProps } from '../../types/index.js';
|
|
5
|
-
type RootProps =
|
|
5
|
+
type RootProps = GetInternalProps<HovercardProps>;
|
|
6
6
|
declare class HovercardRoot extends Floating {
|
|
7
|
-
|
|
8
|
-
$disabled: RootProps['disabled'];
|
|
9
|
-
$delay: RootProps['delay'];
|
|
10
|
-
$portalTarget: RootProps['portalTarget'];
|
|
11
|
-
$floatingConfig: RootProps['floatingConfig'];
|
|
7
|
+
$$: RootProps;
|
|
12
8
|
sharedIds: SvelteMap<"content" | "trigger", string>;
|
|
13
9
|
timeout: {
|
|
14
10
|
set(fn: () => void, delay: number): void;
|
|
@@ -28,7 +24,7 @@ declare class HovercardRoot extends Floating {
|
|
|
28
24
|
}
|
|
29
25
|
type TriggerProps = GetInternalProps<HovercardTriggerProps>;
|
|
30
26
|
declare class HovercardTrigger {
|
|
31
|
-
|
|
27
|
+
$$: TriggerProps;
|
|
32
28
|
_root: HovercardRoot;
|
|
33
29
|
constructor(root: HovercardRoot, props: TriggerProps);
|
|
34
30
|
props: {
|
|
@@ -42,7 +38,7 @@ declare class HovercardTrigger {
|
|
|
42
38
|
}
|
|
43
39
|
type ContentProps = GetInternalProps<HovercardContentProps>;
|
|
44
40
|
declare class HovercardContent {
|
|
45
|
-
|
|
41
|
+
$$: ContentProps;
|
|
46
42
|
_root: HovercardRoot;
|
|
47
43
|
constructor(root: HovercardRoot, props: ContentProps);
|
|
48
44
|
props: {
|
|
@@ -55,7 +51,7 @@ declare class HovercardContent {
|
|
|
55
51
|
}
|
|
56
52
|
type ArrowProps = GetInternalProps<HovercardArrowProps>;
|
|
57
53
|
declare class HovercardArrow {
|
|
58
|
-
|
|
54
|
+
$$: ArrowProps;
|
|
59
55
|
_root: HovercardRoot;
|
|
60
56
|
constructor(root: HovercardRoot, props: ArrowProps);
|
|
61
57
|
props: {
|