@kirana-ui/solid 0.1.1 → 0.2.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/dom/accordion.js +9 -6
- package/dom/agent.js +3 -0
- package/dom/autosize.js +1 -1
- package/dom/avatar.js +3 -3
- package/dom/button.js +1 -1
- package/dom/calendar.js +12 -8
- package/dom/carousel.js +6 -6
- package/dom/checkbox.js +3 -3
- package/dom/collapsible.js +3 -3
- package/dom/combobox.js +19 -11
- package/dom/command.js +8 -8
- package/dom/date-field.js +7 -3
- package/dom/date-picker.js +2 -2
- package/dom/dialog.js +5 -2
- package/dom/field.js +3 -3
- package/dom/fieldset.js +2 -2
- package/dom/form.js +1 -1
- package/dom/hover-popup.js +3 -3
- package/dom/input.js +1 -1
- package/dom/label.js +1 -1
- package/dom/listbox.js +5 -5
- package/dom/menu.js +11 -11
- package/dom/menubar.js +1 -1
- package/dom/message-scroller.js +4 -4
- package/dom/navigation-menu.js +18 -21
- package/dom/number-field.js +3 -3
- package/dom/otp.js +4 -4
- package/dom/pagination.js +3 -3
- package/dom/popover.js +20 -7
- package/dom/qr-code.js +3 -3
- package/dom/radio-group.js +4 -4
- package/dom/resizable.js +3 -3
- package/dom/runtime.js +23 -7
- package/dom/scroll-area.js +5 -5
- package/dom/select.js +25 -13
- package/dom/separator.js +1 -1
- package/dom/slider.js +10 -7
- package/dom/switch.js +3 -3
- package/dom/tabs.js +5 -5
- package/dom/testing.js +3 -0
- package/dom/toast.js +57 -20
- package/dom/toggle-group.js +1 -1
- package/dom/toggle.js +1 -1
- package/dom/toolbar.js +4 -4
- package/dom/value-bar.js +3 -3
- package/llms.txt +1588 -224
- package/package.json +18 -2
- package/server/accordion.js +9 -6
- package/server/agent.js +3 -0
- package/server/autosize.js +1 -1
- package/server/avatar.js +3 -3
- package/server/button.js +1 -1
- package/server/calendar.js +12 -8
- package/server/carousel.js +6 -6
- package/server/checkbox.js +3 -3
- package/server/collapsible.js +3 -3
- package/server/combobox.js +19 -11
- package/server/command.js +8 -8
- package/server/date-field.js +7 -3
- package/server/date-picker.js +2 -2
- package/server/dialog.js +5 -2
- package/server/field.js +3 -3
- package/server/fieldset.js +2 -2
- package/server/form.js +1 -1
- package/server/hover-popup.js +3 -3
- package/server/input.js +1 -1
- package/server/label.js +1 -1
- package/server/listbox.js +5 -5
- package/server/menu.js +11 -11
- package/server/menubar.js +1 -1
- package/server/message-scroller.js +4 -4
- package/server/navigation-menu.js +18 -15
- package/server/number-field.js +3 -3
- package/server/otp.js +4 -4
- package/server/pagination.js +3 -3
- package/server/popover.js +20 -7
- package/server/qr-code.js +3 -3
- package/server/radio-group.js +4 -4
- package/server/resizable.js +3 -3
- package/server/runtime.js +23 -7
- package/server/scroll-area.js +5 -5
- package/server/select.js +25 -13
- package/server/separator.js +1 -1
- package/server/slider.js +10 -7
- package/server/switch.js +3 -3
- package/server/tabs.js +5 -5
- package/server/testing.js +3 -0
- package/server/toast.js +57 -20
- package/server/toggle-group.js +1 -1
- package/server/toggle.js +1 -1
- package/server/toolbar.js +4 -4
- package/server/value-bar.js +3 -3
- package/skills/kirana-ui-primitives/SKILL.md +142 -0
- package/src/accordion.jsx +10 -7
- package/src/agent.js +3 -0
- package/src/autosize.jsx +1 -1
- package/src/avatar.jsx +3 -3
- package/src/button.jsx +1 -1
- package/src/calendar.jsx +12 -8
- package/src/carousel.jsx +6 -6
- package/src/checkbox.jsx +3 -3
- package/src/collapsible.jsx +3 -3
- package/src/combobox.jsx +20 -12
- package/src/command.jsx +8 -8
- package/src/date-field.jsx +7 -3
- package/src/date-picker.jsx +2 -2
- package/src/dialog.jsx +8 -2
- package/src/field.jsx +3 -3
- package/src/fieldset.jsx +2 -2
- package/src/form.jsx +1 -1
- package/src/hover-popup.jsx +3 -3
- package/src/input.jsx +1 -1
- package/src/label.jsx +1 -1
- package/src/listbox.jsx +6 -6
- package/src/menu.jsx +11 -11
- package/src/menubar.jsx +1 -1
- package/src/message-scroller.jsx +4 -4
- package/src/navigation-menu.jsx +14 -13
- package/src/number-field.jsx +3 -3
- package/src/otp.jsx +4 -4
- package/src/pagination.jsx +3 -3
- package/src/popover.jsx +20 -4
- package/src/qr-code.jsx +3 -3
- package/src/radio-group.jsx +5 -5
- package/src/resizable.jsx +3 -3
- package/src/runtime.jsx +21 -7
- package/src/scroll-area.jsx +5 -5
- package/src/select.jsx +28 -14
- package/src/separator.jsx +1 -1
- package/src/slider.jsx +11 -8
- package/src/switch.jsx +3 -3
- package/src/tabs.jsx +6 -6
- package/src/testing.js +3 -0
- package/src/toast.jsx +38 -10
- package/src/toggle-group.jsx +2 -2
- package/src/toggle.jsx +1 -1
- package/src/toolbar.jsx +4 -4
- package/src/value-bar.jsx +3 -3
- package/types/accordion.d.ts +21 -19
- package/types/agent.d.ts +1 -0
- package/types/alert-dialog.d.ts +1 -0
- package/types/autocomplete.d.ts +1 -0
- package/types/autosize.d.ts +4 -1
- package/types/avatar.d.ts +12 -5
- package/types/button.d.ts +4 -2
- package/types/calendar.d.ts +35 -18
- package/types/carousel.d.ts +18 -10
- package/types/checkbox.d.ts +9 -6
- package/types/collapsible.d.ts +11 -7
- package/types/combobox.d.ts +61 -62
- package/types/command.d.ts +27 -17
- package/types/context-menu.d.ts +1 -0
- package/types/date-field.d.ts +20 -9
- package/types/date-picker.d.ts +25 -34
- package/types/dialog.d.ts +42 -31
- package/types/direction.d.ts +1 -0
- package/types/drawer.d.ts +1 -0
- package/types/field.d.ts +19 -11
- package/types/fieldset.d.ts +8 -3
- package/types/form.d.ts +5 -2
- package/types/hover-card.d.ts +16 -10
- package/types/hover-popup.d.ts +23 -13
- package/types/index.d.ts +12 -1
- package/types/input.d.ts +4 -3
- package/types/label.d.ts +4 -1
- package/types/listbox.d.ts +18 -20
- package/types/menu.d.ts +56 -42
- package/types/menubar.d.ts +6 -4
- package/types/message-scroller.d.ts +12 -6
- package/types/meter.d.ts +16 -7
- package/types/navigation-menu.d.ts +35 -29
- package/types/number-field.d.ts +13 -6
- package/types/otp.d.ts +17 -10
- package/types/pagination.d.ts +18 -10
- package/types/popover.d.ts +37 -12
- package/types/progress.d.ts +16 -7
- package/types/qr-code.d.ts +10 -4
- package/types/radio-group.d.ts +15 -17
- package/types/resizable.d.ts +12 -7
- package/types/runtime.d.ts +36 -12
- package/types/scroll-area.d.ts +17 -9
- package/types/select.d.ts +55 -46
- package/types/separator.d.ts +5 -3
- package/types/slider.d.ts +25 -13
- package/types/switch.d.ts +7 -4
- package/types/tabs.d.ts +20 -16
- package/types/testing.d.ts +1 -0
- package/types/toast.d.ts +40 -16
- package/types/toggle-group.d.ts +6 -11
- package/types/toggle.d.ts +4 -3
- package/types/toolbar.d.ts +19 -14
- package/types/tooltip.d.ts +16 -10
- package/types/value-bar.d.ts +21 -10
package/dom/listbox.js
CHANGED
|
@@ -32,7 +32,7 @@ function Root(props) {
|
|
|
32
32
|
value: made,
|
|
33
33
|
get children() {
|
|
34
34
|
return _$createComponent(Part, _$mergeProps({
|
|
35
|
-
get
|
|
35
|
+
get of() {
|
|
36
36
|
return made.root;
|
|
37
37
|
},
|
|
38
38
|
tag: "div"
|
|
@@ -54,7 +54,7 @@ function Item(props) {
|
|
|
54
54
|
value: value,
|
|
55
55
|
get children() {
|
|
56
56
|
return _$createComponent(Part, _$mergeProps({
|
|
57
|
-
|
|
57
|
+
of: part,
|
|
58
58
|
tag: "div"
|
|
59
59
|
}, rest));
|
|
60
60
|
}
|
|
@@ -71,7 +71,7 @@ function ItemIndicator(props) {
|
|
|
71
71
|
},
|
|
72
72
|
get children() {
|
|
73
73
|
return _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
74
|
+
get of() {
|
|
75
75
|
return made.indicator(value);
|
|
76
76
|
},
|
|
77
77
|
tag: "span"
|
|
@@ -87,7 +87,7 @@ function Group(props) {
|
|
|
87
87
|
value: group,
|
|
88
88
|
get children() {
|
|
89
89
|
return _$createComponent(Part, _$mergeProps({
|
|
90
|
-
get
|
|
90
|
+
get of() {
|
|
91
91
|
return group.root;
|
|
92
92
|
},
|
|
93
93
|
tag: "div"
|
|
@@ -99,7 +99,7 @@ function GroupLabel(props) {
|
|
|
99
99
|
const group = useContext(GroupContext);
|
|
100
100
|
if (!group) throw new Error("A Listbox.GroupLabel must be inside <Listbox.Group>");
|
|
101
101
|
return _$createComponent(Part, _$mergeProps({
|
|
102
|
-
get
|
|
102
|
+
get of() {
|
|
103
103
|
return group.label;
|
|
104
104
|
},
|
|
105
105
|
tag: "div"
|
package/dom/menu.js
CHANGED
|
@@ -75,7 +75,7 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
75
75
|
function Positioner(props) {
|
|
76
76
|
const made = useMenu();
|
|
77
77
|
return _$createComponent(Part, _$mergeProps({
|
|
78
|
-
get
|
|
78
|
+
get of() {
|
|
79
79
|
return made.positioner;
|
|
80
80
|
},
|
|
81
81
|
tag: "div"
|
|
@@ -89,7 +89,7 @@ function Item(props) {
|
|
|
89
89
|
}));
|
|
90
90
|
const part = useMenu().item(() => defined(options.get()));
|
|
91
91
|
return _$createComponent(Part, _$mergeProps({
|
|
92
|
-
|
|
92
|
+
of: part,
|
|
93
93
|
tag: "div"
|
|
94
94
|
}, rest));
|
|
95
95
|
}
|
|
@@ -101,7 +101,7 @@ function LinkItem(props) {
|
|
|
101
101
|
}));
|
|
102
102
|
const part = useMenu().item(() => defined(options.get()));
|
|
103
103
|
return _$createComponent(Part, _$mergeProps({
|
|
104
|
-
|
|
104
|
+
of: part,
|
|
105
105
|
tag: "a"
|
|
106
106
|
}, rest));
|
|
107
107
|
}
|
|
@@ -113,7 +113,7 @@ function Group(props) {
|
|
|
113
113
|
value: group,
|
|
114
114
|
get children() {
|
|
115
115
|
return _$createComponent(Part, _$mergeProps({
|
|
116
|
-
get
|
|
116
|
+
get of() {
|
|
117
117
|
return group.root;
|
|
118
118
|
},
|
|
119
119
|
tag: "div"
|
|
@@ -123,7 +123,7 @@ function Group(props) {
|
|
|
123
123
|
}
|
|
124
124
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
125
125
|
const GroupLabel = props => _$createComponent(Part, _$mergeProps({
|
|
126
|
-
get
|
|
126
|
+
get of() {
|
|
127
127
|
return useContext(GroupContext)?.label ?? useMenu().label;
|
|
128
128
|
},
|
|
129
129
|
tag: "div"
|
|
@@ -142,7 +142,7 @@ function CheckboxItem(props) {
|
|
|
142
142
|
value: item,
|
|
143
143
|
get children() {
|
|
144
144
|
return _$createComponent(Part, _$mergeProps({
|
|
145
|
-
get
|
|
145
|
+
get of() {
|
|
146
146
|
return item.part;
|
|
147
147
|
},
|
|
148
148
|
tag: "div"
|
|
@@ -160,7 +160,7 @@ function CheckboxItemIndicator(props) {
|
|
|
160
160
|
},
|
|
161
161
|
get children() {
|
|
162
162
|
return _$createComponent(Part, _$mergeProps({
|
|
163
|
-
get
|
|
163
|
+
get of() {
|
|
164
164
|
return item.indicator;
|
|
165
165
|
},
|
|
166
166
|
tag: "span"
|
|
@@ -180,7 +180,7 @@ function RadioGroup(props) {
|
|
|
180
180
|
value: group,
|
|
181
181
|
get children() {
|
|
182
182
|
return _$createComponent(Part, _$mergeProps({
|
|
183
|
-
get
|
|
183
|
+
get of() {
|
|
184
184
|
return group.root;
|
|
185
185
|
},
|
|
186
186
|
tag: "div"
|
|
@@ -202,7 +202,7 @@ function RadioItem(props) {
|
|
|
202
202
|
value: value,
|
|
203
203
|
get children() {
|
|
204
204
|
return _$createComponent(Part, _$mergeProps({
|
|
205
|
-
|
|
205
|
+
of: part,
|
|
206
206
|
tag: "div"
|
|
207
207
|
}, rest));
|
|
208
208
|
}
|
|
@@ -219,7 +219,7 @@ function RadioItemIndicator(props) {
|
|
|
219
219
|
},
|
|
220
220
|
get children() {
|
|
221
221
|
return _$createComponent(Part, _$mergeProps({
|
|
222
|
-
get
|
|
222
|
+
get of() {
|
|
223
223
|
return group.indicator(value);
|
|
224
224
|
},
|
|
225
225
|
tag: "span"
|
|
@@ -228,7 +228,7 @@ function RadioItemIndicator(props) {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
231
|
-
get
|
|
231
|
+
get of() {
|
|
232
232
|
return useMenu()[name];
|
|
233
233
|
},
|
|
234
234
|
tag: tag
|
package/dom/menubar.js
CHANGED
package/dom/message-scroller.js
CHANGED
|
@@ -22,7 +22,7 @@ function Root(props) {
|
|
|
22
22
|
value: made,
|
|
23
23
|
get children() {
|
|
24
24
|
return _$createComponent(Part, _$mergeProps({
|
|
25
|
-
get
|
|
25
|
+
get of() {
|
|
26
26
|
return made.root;
|
|
27
27
|
},
|
|
28
28
|
tag: "div"
|
|
@@ -31,19 +31,19 @@ function Root(props) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
const Viewport = props => _$createComponent(Part, _$mergeProps({
|
|
34
|
-
get
|
|
34
|
+
get of() {
|
|
35
35
|
return useScroller().viewport;
|
|
36
36
|
},
|
|
37
37
|
tag: "div"
|
|
38
38
|
}, props));
|
|
39
39
|
const Content = props => _$createComponent(Part, _$mergeProps({
|
|
40
|
-
get
|
|
40
|
+
get of() {
|
|
41
41
|
return useScroller().content;
|
|
42
42
|
},
|
|
43
43
|
tag: "div"
|
|
44
44
|
}, props));
|
|
45
45
|
const Button = props => _$createComponent(Part, _$mergeProps({
|
|
46
|
-
get
|
|
46
|
+
get of() {
|
|
47
47
|
return useScroller().button;
|
|
48
48
|
},
|
|
49
49
|
tag: "button"
|
package/dom/navigation-menu.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
1
|
import { memo as _$memo } from "solid-js/web";
|
|
3
|
-
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
4
|
-
import { insert as _$insert } from "solid-js/web";
|
|
5
2
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
6
3
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/_$template(`<li>`);
|
|
8
4
|
import { defined, within } from "@kirana-ui/core";
|
|
9
5
|
import { createNavigationMenu } from "@kirana-ui/core/navigation-menu";
|
|
10
6
|
import { Show, createContext, createUniqueId, onCleanup, onMount, splitProps, untrack, useContext } from "solid-js";
|
|
@@ -42,7 +38,7 @@ function Root(props) {
|
|
|
42
38
|
value: made,
|
|
43
39
|
get children() {
|
|
44
40
|
return _$createComponent(Part, _$mergeProps({
|
|
45
|
-
get
|
|
41
|
+
get of() {
|
|
46
42
|
return made.root;
|
|
47
43
|
},
|
|
48
44
|
tag: "nav"
|
|
@@ -50,22 +46,23 @@ function Root(props) {
|
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
48
|
}
|
|
53
|
-
/** `value` tells this item from the others; an item that is
|
|
49
|
+
/** `value` tells this item from the others; an item that is given none makes its own. */
|
|
54
50
|
function Item(props) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})();
|
|
61
|
-
const item = useNavigation().item(value);
|
|
51
|
+
const [local, rest] = splitProps(props, ["value"]);
|
|
52
|
+
const made = useNavigation();
|
|
53
|
+
const generated = createUniqueId();
|
|
54
|
+
const value = untrack(() => local.value);
|
|
55
|
+
const item = made.item(value === undefined ? generated : value);
|
|
62
56
|
onMount(() => onCleanup(item.mount()));
|
|
63
57
|
return _$createComponent(ItemContext.Provider, {
|
|
64
58
|
value: item,
|
|
65
59
|
get children() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
return _$createComponent(Part, _$mergeProps({
|
|
61
|
+
get of() {
|
|
62
|
+
return made.itemPart;
|
|
63
|
+
},
|
|
64
|
+
tag: "li"
|
|
65
|
+
}, rest));
|
|
69
66
|
}
|
|
70
67
|
});
|
|
71
68
|
}
|
|
@@ -84,7 +81,7 @@ function Content(props) {
|
|
|
84
81
|
},
|
|
85
82
|
get children() {
|
|
86
83
|
return _$createComponent(Part, _$mergeProps({
|
|
87
|
-
get
|
|
84
|
+
get of() {
|
|
88
85
|
return item.content;
|
|
89
86
|
},
|
|
90
87
|
tag: "div"
|
|
@@ -100,7 +97,7 @@ function Link(props) {
|
|
|
100
97
|
}));
|
|
101
98
|
const part = useNavigation().link(() => defined(options.get()));
|
|
102
99
|
return _$createComponent(Part, _$mergeProps({
|
|
103
|
-
|
|
100
|
+
of: part,
|
|
104
101
|
tag: "a"
|
|
105
102
|
}, rest));
|
|
106
103
|
}
|
|
@@ -115,20 +112,20 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
115
112
|
function Positioner(props) {
|
|
116
113
|
const made = useNavigation();
|
|
117
114
|
return _$createComponent(Part, _$mergeProps({
|
|
118
|
-
get
|
|
115
|
+
get of() {
|
|
119
116
|
return made.positioner;
|
|
120
117
|
},
|
|
121
118
|
tag: "div"
|
|
122
119
|
}, () => positioned(props, made.positioning)));
|
|
123
120
|
}
|
|
124
121
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
125
|
-
get
|
|
122
|
+
get of() {
|
|
126
123
|
return useNavigation()[name];
|
|
127
124
|
},
|
|
128
125
|
tag: tag
|
|
129
126
|
}, props));
|
|
130
127
|
const itemPart = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
131
|
-
get
|
|
128
|
+
get of() {
|
|
132
129
|
return useItem()[name];
|
|
133
130
|
},
|
|
134
131
|
tag: tag
|
package/dom/number-field.js
CHANGED
|
@@ -43,7 +43,7 @@ function Root(props) {
|
|
|
43
43
|
value: made,
|
|
44
44
|
get children() {
|
|
45
45
|
return _$createComponent(Part, _$mergeProps({
|
|
46
|
-
get
|
|
46
|
+
get of() {
|
|
47
47
|
return made.root;
|
|
48
48
|
},
|
|
49
49
|
tag: "div"
|
|
@@ -55,7 +55,7 @@ function Root(props) {
|
|
|
55
55
|
},
|
|
56
56
|
get children() {
|
|
57
57
|
return _$createComponent(Part, {
|
|
58
|
-
get
|
|
58
|
+
get of() {
|
|
59
59
|
return made.hidden;
|
|
60
60
|
},
|
|
61
61
|
tag: "input"
|
|
@@ -68,7 +68,7 @@ function Root(props) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
71
|
-
get
|
|
71
|
+
get of() {
|
|
72
72
|
return useNumberField()[name];
|
|
73
73
|
},
|
|
74
74
|
tag: tag
|
package/dom/otp.js
CHANGED
|
@@ -30,7 +30,7 @@ function Root(props) {
|
|
|
30
30
|
value: made,
|
|
31
31
|
get children() {
|
|
32
32
|
return _$createComponent(Part, _$mergeProps({
|
|
33
|
-
get
|
|
33
|
+
get of() {
|
|
34
34
|
return made.root;
|
|
35
35
|
},
|
|
36
36
|
tag: "div"
|
|
@@ -47,7 +47,7 @@ function Slot(props) {
|
|
|
47
47
|
value: slot,
|
|
48
48
|
get children() {
|
|
49
49
|
return _$createComponent(Part, _$mergeProps({
|
|
50
|
-
get
|
|
50
|
+
get of() {
|
|
51
51
|
return slot.part;
|
|
52
52
|
},
|
|
53
53
|
tag: "div"
|
|
@@ -71,7 +71,7 @@ function Caret(props) {
|
|
|
71
71
|
},
|
|
72
72
|
get children() {
|
|
73
73
|
return _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
74
|
+
get of() {
|
|
75
75
|
return made.caretPart;
|
|
76
76
|
},
|
|
77
77
|
tag: "div"
|
|
@@ -80,7 +80,7 @@ function Caret(props) {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
83
|
-
get
|
|
83
|
+
get of() {
|
|
84
84
|
return useOtp()[name];
|
|
85
85
|
},
|
|
86
86
|
tag: tag
|
package/dom/pagination.js
CHANGED
|
@@ -27,7 +27,7 @@ function Root(props) {
|
|
|
27
27
|
value: made,
|
|
28
28
|
get children() {
|
|
29
29
|
return _$createComponent(Part, _$mergeProps({
|
|
30
|
-
get
|
|
30
|
+
get of() {
|
|
31
31
|
return made.root;
|
|
32
32
|
},
|
|
33
33
|
tag: "nav"
|
|
@@ -52,14 +52,14 @@ function Item(props) {
|
|
|
52
52
|
const [local, rest] = splitProps(props, ["page"]);
|
|
53
53
|
const made = usePagination();
|
|
54
54
|
return _$createComponent(Part, _$mergeProps({
|
|
55
|
-
get
|
|
55
|
+
get of() {
|
|
56
56
|
return made.item(local.page);
|
|
57
57
|
},
|
|
58
58
|
tag: "button"
|
|
59
59
|
}, rest));
|
|
60
60
|
}
|
|
61
61
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
62
|
-
get
|
|
62
|
+
get of() {
|
|
63
63
|
return usePagination()[name];
|
|
64
64
|
},
|
|
65
65
|
tag: tag
|
package/dom/popover.js
CHANGED
|
@@ -4,6 +4,10 @@ import { defined } from "@kirana-ui/core";
|
|
|
4
4
|
import { createPopover } from "@kirana-ui/core/popover";
|
|
5
5
|
import { createComputed, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
6
6
|
import { Part, Portal as BodyPortal, controller } from "./runtime.js";
|
|
7
|
+
/**
|
|
8
|
+
* The popover its parts are inside. Exported for a component that is made of one (a date picker
|
|
9
|
+
* provides its own to the popover's parts).
|
|
10
|
+
*/
|
|
7
11
|
const Context = createContext();
|
|
8
12
|
/** For a component made of this one's parts: a date picker. */
|
|
9
13
|
export { Context as PopoverContext };
|
|
@@ -35,25 +39,34 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
35
39
|
return props.children;
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* A positioner's own props, written where its placement reads them, before its element
|
|
44
|
+
* attaches: the one place they are named. Gives back what is left, for the part's element.
|
|
45
|
+
*/
|
|
39
46
|
export function positioned(props, positioning) {
|
|
40
|
-
const [local, rest] = splitProps(props, ["side", "align", "sideOffset", "alignOffset", "collisionPadding"]);
|
|
41
|
-
createComputed(() =>
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
const [local, rest] = splitProps(props, ["side", "align", "sideOffset", "alignOffset", "collisionPadding", "anchor"]);
|
|
48
|
+
createComputed(() => {
|
|
49
|
+
const anchor = local.anchor;
|
|
50
|
+
positioning.set(defined({
|
|
51
|
+
...local,
|
|
52
|
+
// A function is asked here, so a change of the signal it reads is followed; and given
|
|
53
|
+
// whole while it has nothing, to be asked again as the popup is placed.
|
|
54
|
+
anchor: typeof anchor === "function" ? anchor() ?? anchor : anchor
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
44
57
|
return rest;
|
|
45
58
|
}
|
|
46
59
|
function Positioner(props) {
|
|
47
60
|
const made = usePopover();
|
|
48
61
|
return _$createComponent(Part, _$mergeProps({
|
|
49
|
-
get
|
|
62
|
+
get of() {
|
|
50
63
|
return made.positioner;
|
|
51
64
|
},
|
|
52
65
|
tag: "div"
|
|
53
66
|
}, () => positioned(props, made.positioning)));
|
|
54
67
|
}
|
|
55
68
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
56
|
-
get
|
|
69
|
+
get of() {
|
|
57
70
|
return usePopover()[name];
|
|
58
71
|
},
|
|
59
72
|
tag: tag
|
package/dom/qr-code.js
CHANGED
|
@@ -21,7 +21,7 @@ function Root(props) {
|
|
|
21
21
|
value: made,
|
|
22
22
|
get children() {
|
|
23
23
|
return _$createComponent(Part, _$mergeProps({
|
|
24
|
-
get
|
|
24
|
+
get of() {
|
|
25
25
|
return made.root;
|
|
26
26
|
},
|
|
27
27
|
tag: "div"
|
|
@@ -30,13 +30,13 @@ function Root(props) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
const Frame = props => _$createComponent(Part, _$mergeProps({
|
|
33
|
-
get
|
|
33
|
+
get of() {
|
|
34
34
|
return useQrCode().frame;
|
|
35
35
|
},
|
|
36
36
|
tag: "svg"
|
|
37
37
|
}, props));
|
|
38
38
|
const Pattern = props => _$createComponent(Part, _$mergeProps({
|
|
39
|
-
get
|
|
39
|
+
get of() {
|
|
40
40
|
return useQrCode().pattern;
|
|
41
41
|
},
|
|
42
42
|
tag: "path"
|
package/dom/radio-group.js
CHANGED
|
@@ -36,7 +36,7 @@ function Root(props) {
|
|
|
36
36
|
value: made,
|
|
37
37
|
get children() {
|
|
38
38
|
return _$createComponent(Part, _$mergeProps({
|
|
39
|
-
get
|
|
39
|
+
get of() {
|
|
40
40
|
return made.root;
|
|
41
41
|
},
|
|
42
42
|
tag: "div"
|
|
@@ -57,14 +57,14 @@ function Item(props) {
|
|
|
57
57
|
value: value,
|
|
58
58
|
get children() {
|
|
59
59
|
return _$createComponent(Part, _$mergeProps({
|
|
60
|
-
get
|
|
60
|
+
get of() {
|
|
61
61
|
return group.item(value, read);
|
|
62
62
|
},
|
|
63
63
|
tag: "span"
|
|
64
64
|
}, rest, {
|
|
65
65
|
get children() {
|
|
66
66
|
return [_$memo(() => local.children), _$createComponent(Part, {
|
|
67
|
-
get
|
|
67
|
+
get of() {
|
|
68
68
|
return group.itemInput(value, read);
|
|
69
69
|
},
|
|
70
70
|
tag: "input"
|
|
@@ -86,7 +86,7 @@ function Indicator(props) {
|
|
|
86
86
|
},
|
|
87
87
|
get children() {
|
|
88
88
|
return _$createComponent(Part, _$mergeProps({
|
|
89
|
-
get
|
|
89
|
+
get of() {
|
|
90
90
|
return indicator.part;
|
|
91
91
|
},
|
|
92
92
|
tag: "span"
|
package/dom/resizable.js
CHANGED
|
@@ -28,7 +28,7 @@ function Group(props) {
|
|
|
28
28
|
value: made,
|
|
29
29
|
get children() {
|
|
30
30
|
return _$createComponent(Part, _$mergeProps({
|
|
31
|
-
get
|
|
31
|
+
get of() {
|
|
32
32
|
return made.group;
|
|
33
33
|
},
|
|
34
34
|
tag: "div"
|
|
@@ -43,7 +43,7 @@ function Panel(props) {
|
|
|
43
43
|
}));
|
|
44
44
|
const part = useResizable().panel(() => defined(options.get()));
|
|
45
45
|
return _$createComponent(Part, _$mergeProps({
|
|
46
|
-
|
|
46
|
+
of: part,
|
|
47
47
|
tag: "div"
|
|
48
48
|
}, rest));
|
|
49
49
|
}
|
|
@@ -54,7 +54,7 @@ function Handle(props) {
|
|
|
54
54
|
}));
|
|
55
55
|
const part = useResizable().handle(() => defined(options.get()));
|
|
56
56
|
return _$createComponent(Part, _$mergeProps({
|
|
57
|
-
|
|
57
|
+
of: part,
|
|
58
58
|
tag: "div"
|
|
59
59
|
}, rest));
|
|
60
60
|
}
|
package/dom/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
2
2
|
import { memo as _$memo } from "solid-js/web";
|
|
3
3
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
4
|
-
import { mergeProps, sameProps, signal } from "@kirana-ui/core";
|
|
4
|
+
import { mergeProps, sameProps, signal, stateOf } from "@kirana-ui/core";
|
|
5
5
|
import { Show, children, createComputed, createContext, createRenderEffect, createMemo, createSignal, getOwner, onCleanup, onMount, runWithOwner, splitProps, untrack, useContext } from "solid-js";
|
|
6
6
|
import { Dynamic, Portal as SolidPortal, isServer } from "solid-js/web";
|
|
7
7
|
/** A core signal as a Solid accessor: tracked by whatever calls it. */
|
|
@@ -36,12 +36,15 @@ function toSolid(props) {
|
|
|
36
36
|
return out;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
* part's and the part's DOM work attached once the element is in the page.
|
|
39
|
+
* The element of a part (`of`), or the caller's through `render`, with the caller's props merged under the
|
|
40
|
+
* part's and the part's DOM work attached once the element is in the page. What the part holds
|
|
41
|
+
* is its children here: with `as` they are the element's, and with `render` they are handed to
|
|
42
|
+
* the caller's function as the `children` of its props, so a control drawn as another element
|
|
43
|
+
* keeps the native input a form and a label reach.
|
|
41
44
|
*/
|
|
42
45
|
export function Part(props) {
|
|
43
|
-
const [local, caller] = splitProps(props, ["
|
|
44
|
-
const own = fromSignal(untrack(() => local.
|
|
46
|
+
const [local, caller] = splitProps(props, ["of", "tag", "as", "render", "children"]);
|
|
47
|
+
const own = fromSignal(untrack(() => local.of).props);
|
|
45
48
|
// Solid hands over an element before it is in the page: the part's DOM work (focus, measures,
|
|
46
49
|
// the starting style) waits for the mount that follows. It belongs to this component, not to
|
|
47
50
|
// the effect that spreads the props (which hands the ref over again, and is torn down, each time
|
|
@@ -51,8 +54,11 @@ export function Part(props) {
|
|
|
51
54
|
const attach = element => {
|
|
52
55
|
if (element === attached) return;
|
|
53
56
|
attached = element;
|
|
54
|
-
const part = untrack(() => local.
|
|
57
|
+
const part = untrack(() => local.of);
|
|
55
58
|
runWithOwner(owner, () => onMount(() => onCleanup(part.attach(element))));
|
|
59
|
+
// The caller's own `ref` (Solid hands a component a function, whatever was written).
|
|
60
|
+
const theirs = untrack(() => caller.ref);
|
|
61
|
+
if (typeof theirs === "function") theirs(element);
|
|
56
62
|
};
|
|
57
63
|
const merged = createMemo(() => {
|
|
58
64
|
const theirs = {};
|
|
@@ -62,6 +68,7 @@ export function Part(props) {
|
|
|
62
68
|
ref: attach
|
|
63
69
|
};
|
|
64
70
|
});
|
|
71
|
+
const state = () => stateOf(own());
|
|
65
72
|
return _$createComponent(Show, {
|
|
66
73
|
get when() {
|
|
67
74
|
return local.render;
|
|
@@ -77,7 +84,16 @@ export function Part(props) {
|
|
|
77
84
|
}
|
|
78
85
|
}));
|
|
79
86
|
},
|
|
80
|
-
children: render =>
|
|
87
|
+
children: render => {
|
|
88
|
+
// Resolved once: a change of the part's props hands the same nodes over again, and
|
|
89
|
+
// the element keeps them.
|
|
90
|
+
const held = children(() => local.children);
|
|
91
|
+
const handed = createMemo(() => ({
|
|
92
|
+
...merged(),
|
|
93
|
+
children: held()
|
|
94
|
+
}));
|
|
95
|
+
return render()(handed, state);
|
|
96
|
+
}
|
|
81
97
|
});
|
|
82
98
|
}
|
|
83
99
|
/**
|
package/dom/scroll-area.js
CHANGED
|
@@ -22,7 +22,7 @@ function Root(props) {
|
|
|
22
22
|
value: made,
|
|
23
23
|
get children() {
|
|
24
24
|
return _$createComponent(Part, _$mergeProps({
|
|
25
|
-
get
|
|
25
|
+
get of() {
|
|
26
26
|
return made.root;
|
|
27
27
|
},
|
|
28
28
|
tag: "div"
|
|
@@ -44,7 +44,7 @@ function Scrollbar(props) {
|
|
|
44
44
|
},
|
|
45
45
|
get children() {
|
|
46
46
|
return _$createComponent(Part, _$mergeProps({
|
|
47
|
-
get
|
|
47
|
+
get of() {
|
|
48
48
|
return bar.part;
|
|
49
49
|
},
|
|
50
50
|
tag: "div"
|
|
@@ -58,7 +58,7 @@ function Thumb(props) {
|
|
|
58
58
|
const bar = useContext(ScrollbarContext);
|
|
59
59
|
if (!bar) throw new Error("A ScrollArea.Thumb must be inside <ScrollArea.Scrollbar>");
|
|
60
60
|
return _$createComponent(Part, _$mergeProps({
|
|
61
|
-
get
|
|
61
|
+
get of() {
|
|
62
62
|
return bar.thumb;
|
|
63
63
|
},
|
|
64
64
|
tag: "div"
|
|
@@ -75,7 +75,7 @@ function Corner(props) {
|
|
|
75
75
|
},
|
|
76
76
|
get children() {
|
|
77
77
|
return _$createComponent(Part, _$mergeProps({
|
|
78
|
-
get
|
|
78
|
+
get of() {
|
|
79
79
|
return corner.part;
|
|
80
80
|
},
|
|
81
81
|
tag: "div"
|
|
@@ -84,7 +84,7 @@ function Corner(props) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const part = name => props => _$createComponent(Part, _$mergeProps({
|
|
87
|
-
get
|
|
87
|
+
get of() {
|
|
88
88
|
return useScrollArea()[name];
|
|
89
89
|
},
|
|
90
90
|
tag: "div"
|