soluid 0.1.1
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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/commands/add.js +31 -0
- package/dist/commands/init.js +56 -0
- package/dist/commands/install.js +110 -0
- package/dist/commands/list.js +54 -0
- package/dist/commands/remove.js +25 -0
- package/dist/components/data/Card.d.ts +22 -0
- package/dist/components/data/DescriptionList.d.ts +11 -0
- package/dist/components/data/EmptyState.d.ts +10 -0
- package/dist/components/data/Skeleton.d.ts +8 -0
- package/dist/components/data/Table.d.ts +23 -0
- package/dist/components/data/index.d.ts +10 -0
- package/dist/components/feedback/Alert.d.ts +9 -0
- package/dist/components/feedback/Dialog.d.ts +25 -0
- package/dist/components/feedback/Drawer.d.ts +11 -0
- package/dist/components/feedback/Progress.d.ts +8 -0
- package/dist/components/feedback/Spinner.d.ts +7 -0
- package/dist/components/feedback/Toast.d.ts +10 -0
- package/dist/components/feedback/index.d.ts +12 -0
- package/dist/components/form/Checkbox.d.ts +14 -0
- package/dist/components/form/CheckboxGroup.d.ts +10 -0
- package/dist/components/form/CheckboxGroupContext.d.ts +6 -0
- package/dist/components/form/FormField.d.ts +11 -0
- package/dist/components/form/FormFieldContext.d.ts +8 -0
- package/dist/components/form/NumberInput.d.ts +15 -0
- package/dist/components/form/RadioButton.d.ts +10 -0
- package/dist/components/form/RadioGroup.d.ts +11 -0
- package/dist/components/form/RadioGroupContext.d.ts +7 -0
- package/dist/components/form/Select.d.ts +19 -0
- package/dist/components/form/Switch.d.ts +12 -0
- package/dist/components/form/TextArea.d.ts +15 -0
- package/dist/components/form/TextField.d.ts +14 -0
- package/dist/components/form/index.d.ts +26 -0
- package/dist/components/general/Badge.d.ts +9 -0
- package/dist/components/general/Button.d.ts +10 -0
- package/dist/components/general/IconButton.d.ts +8 -0
- package/dist/components/general/Tag.d.ts +10 -0
- package/dist/components/general/Tooltip.d.ts +6 -0
- package/dist/components/general/index.d.ts +10 -0
- package/dist/components/layout/Divider.d.ts +7 -0
- package/dist/components/layout/HStack.d.ts +10 -0
- package/dist/components/layout/Spacer.d.ts +3 -0
- package/dist/components/layout/Stack.d.ts +9 -0
- package/dist/components/layout/index.d.ts +7 -0
- package/dist/components/navigation/Breadcrumb.d.ts +14 -0
- package/dist/components/navigation/Menu.d.ts +7 -0
- package/dist/components/navigation/Pagination.d.ts +9 -0
- package/dist/components/navigation/Tabs.d.ts +27 -0
- package/dist/components/navigation/index.d.ts +8 -0
- package/dist/components/utility/Popover.d.ts +7 -0
- package/dist/components/utility/VisuallyHidden.d.ts +6 -0
- package/dist/components/utility/index.d.ts +4 -0
- package/dist/config.js +26 -0
- package/dist/core/SouiProvider.d.ts +7 -0
- package/dist/core/context.d.ts +6 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/theme.d.ts +7 -0
- package/dist/core/types.d.ts +35 -0
- package/dist/core/utils.d.ts +2 -0
- package/dist/dev/App.d.ts +3 -0
- package/dist/dev/index.d.ts +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +53 -0
- package/dist/primitives/createDisclosure.d.ts +27 -0
- package/dist/primitives/createFocusTrap.d.ts +10 -0
- package/dist/primitives/createPagination.d.ts +23 -0
- package/dist/primitives/createToast.d.ts +23 -0
- package/dist/primitives/createToggle.d.ts +19 -0
- package/dist/primitives/index.d.ts +10 -0
- package/dist/registry.js +410 -0
- package/dist/rewrite-imports.js +42 -0
- package/package.json +36 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FeedbackVariant } from "../core/types";
|
|
2
|
+
export interface Toast {
|
|
3
|
+
id: string;
|
|
4
|
+
message: string;
|
|
5
|
+
variant?: FeedbackVariant;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastOptions {
|
|
9
|
+
/** Default auto-dismiss duration in ms (default: 5000) */
|
|
10
|
+
defaultDuration?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastInput {
|
|
13
|
+
message: string;
|
|
14
|
+
variant?: FeedbackVariant;
|
|
15
|
+
/** Duration in ms. Set to 0 to disable auto-dismiss. */
|
|
16
|
+
duration?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ToastReturn {
|
|
19
|
+
toasts: Toast[];
|
|
20
|
+
add: (input: ToastInput) => string;
|
|
21
|
+
dismiss: (id: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function createToast(options?: ToastOptions): ToastReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
2
|
+
export interface ToggleOptions {
|
|
3
|
+
/** Initial pressed state (uncontrolled) */
|
|
4
|
+
defaultPressed?: boolean;
|
|
5
|
+
/** Controlled pressed state */
|
|
6
|
+
pressed?: Accessor<boolean>;
|
|
7
|
+
/** Called when pressed state changes */
|
|
8
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ToggleReturn {
|
|
11
|
+
pressed: Accessor<boolean>;
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
setPressed: (value: boolean) => void;
|
|
14
|
+
props: {
|
|
15
|
+
"aria-pressed": Accessor<boolean>;
|
|
16
|
+
onClick: () => void;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function createToggle(options?: ToggleOptions): ToggleReturn;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createDisclosure } from "./createDisclosure";
|
|
2
|
+
export type { DisclosureOptions, DisclosureReturn } from "./createDisclosure";
|
|
3
|
+
export { createFocusTrap } from "./createFocusTrap";
|
|
4
|
+
export type { FocusTrapOptions } from "./createFocusTrap";
|
|
5
|
+
export { createToggle } from "./createToggle";
|
|
6
|
+
export type { ToggleOptions, ToggleReturn } from "./createToggle";
|
|
7
|
+
export { createToast } from "./createToast";
|
|
8
|
+
export type { Toast, ToastOptions, ToastInput, ToastReturn, } from "./createToast";
|
|
9
|
+
export { createPagination } from "./createPagination";
|
|
10
|
+
export type { PaginationOptions, PaginationReturn } from "./createPagination";
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core is always installed. It provides types, utils, CSS tokens, and theme.
|
|
3
|
+
*/
|
|
4
|
+
export const registry = {
|
|
5
|
+
// --- Core (always installed) ---
|
|
6
|
+
core: {
|
|
7
|
+
name: "core",
|
|
8
|
+
category: "core",
|
|
9
|
+
files: [
|
|
10
|
+
"core/types.ts",
|
|
11
|
+
"core/utils.ts",
|
|
12
|
+
"core/soluid.css",
|
|
13
|
+
"core/theme.ts",
|
|
14
|
+
],
|
|
15
|
+
dependencies: [],
|
|
16
|
+
description: "Type definitions, CSS tokens, theme utilities",
|
|
17
|
+
},
|
|
18
|
+
// --- Primitives ---
|
|
19
|
+
"createDisclosure": {
|
|
20
|
+
name: "createDisclosure",
|
|
21
|
+
category: "primitives",
|
|
22
|
+
files: ["primitives/createDisclosure.ts"],
|
|
23
|
+
dependencies: ["core"],
|
|
24
|
+
description: "Open/close state management with a11y",
|
|
25
|
+
},
|
|
26
|
+
"createFocusTrap": {
|
|
27
|
+
name: "createFocusTrap",
|
|
28
|
+
category: "primitives",
|
|
29
|
+
files: ["primitives/createFocusTrap.ts"],
|
|
30
|
+
dependencies: ["core"],
|
|
31
|
+
npmDependencies: [
|
|
32
|
+
"@solid-primitives/active-element",
|
|
33
|
+
"@solid-primitives/event-listener",
|
|
34
|
+
],
|
|
35
|
+
description: "Trap focus within a container element",
|
|
36
|
+
},
|
|
37
|
+
"createToggle": {
|
|
38
|
+
name: "createToggle",
|
|
39
|
+
category: "primitives",
|
|
40
|
+
files: ["primitives/createToggle.ts"],
|
|
41
|
+
dependencies: ["core"],
|
|
42
|
+
description: "On/off toggle state with a11y",
|
|
43
|
+
},
|
|
44
|
+
"createToast": {
|
|
45
|
+
name: "createToast",
|
|
46
|
+
category: "primitives",
|
|
47
|
+
files: ["primitives/createToast.ts"],
|
|
48
|
+
dependencies: ["core"],
|
|
49
|
+
npmDependencies: ["@solid-primitives/scheduled"],
|
|
50
|
+
description: "Toast notification queue management",
|
|
51
|
+
},
|
|
52
|
+
"createPagination": {
|
|
53
|
+
name: "createPagination",
|
|
54
|
+
category: "primitives",
|
|
55
|
+
files: ["primitives/createPagination.ts"],
|
|
56
|
+
dependencies: ["core"],
|
|
57
|
+
description: "Page state management",
|
|
58
|
+
},
|
|
59
|
+
// --- Layout ---
|
|
60
|
+
Stack: {
|
|
61
|
+
name: "Stack",
|
|
62
|
+
category: "components",
|
|
63
|
+
files: ["components/layout/Stack.tsx", "components/layout/Stack.css"],
|
|
64
|
+
dependencies: ["core"],
|
|
65
|
+
description: "Vertical flex layout with gap",
|
|
66
|
+
},
|
|
67
|
+
HStack: {
|
|
68
|
+
name: "HStack",
|
|
69
|
+
category: "components",
|
|
70
|
+
files: ["components/layout/HStack.tsx", "components/layout/HStack.css"],
|
|
71
|
+
dependencies: ["core"],
|
|
72
|
+
description: "Horizontal flex layout with gap",
|
|
73
|
+
},
|
|
74
|
+
Divider: {
|
|
75
|
+
name: "Divider",
|
|
76
|
+
category: "components",
|
|
77
|
+
files: ["components/layout/Divider.tsx", "components/layout/Divider.css"],
|
|
78
|
+
dependencies: ["core"],
|
|
79
|
+
description: "Horizontal/vertical separator",
|
|
80
|
+
},
|
|
81
|
+
Spacer: {
|
|
82
|
+
name: "Spacer",
|
|
83
|
+
category: "components",
|
|
84
|
+
files: ["components/layout/Spacer.tsx", "components/layout/Spacer.css"],
|
|
85
|
+
dependencies: ["core"],
|
|
86
|
+
description: "Flex spacer",
|
|
87
|
+
},
|
|
88
|
+
// --- General ---
|
|
89
|
+
Button: {
|
|
90
|
+
name: "Button",
|
|
91
|
+
category: "components",
|
|
92
|
+
files: ["components/general/Button.tsx", "components/general/Button.css"],
|
|
93
|
+
dependencies: ["core"],
|
|
94
|
+
description: "Primary, neutral, danger button with icon and loading",
|
|
95
|
+
},
|
|
96
|
+
IconButton: {
|
|
97
|
+
name: "IconButton",
|
|
98
|
+
category: "components",
|
|
99
|
+
files: [
|
|
100
|
+
"components/general/IconButton.tsx",
|
|
101
|
+
"components/general/IconButton.css",
|
|
102
|
+
],
|
|
103
|
+
dependencies: ["core"],
|
|
104
|
+
description: "Icon-only button with aria-label",
|
|
105
|
+
},
|
|
106
|
+
Badge: {
|
|
107
|
+
name: "Badge",
|
|
108
|
+
category: "components",
|
|
109
|
+
files: ["components/general/Badge.tsx", "components/general/Badge.css"],
|
|
110
|
+
dependencies: ["core"],
|
|
111
|
+
description: "Status label",
|
|
112
|
+
},
|
|
113
|
+
Tag: {
|
|
114
|
+
name: "Tag",
|
|
115
|
+
category: "components",
|
|
116
|
+
files: ["components/general/Tag.tsx", "components/general/Tag.css"],
|
|
117
|
+
dependencies: ["core"],
|
|
118
|
+
description: "Removable label for filters",
|
|
119
|
+
},
|
|
120
|
+
Tooltip: {
|
|
121
|
+
name: "Tooltip",
|
|
122
|
+
category: "components",
|
|
123
|
+
files: ["components/general/Tooltip.tsx"],
|
|
124
|
+
dependencies: ["core"],
|
|
125
|
+
description: "Tooltip (placeholder)",
|
|
126
|
+
},
|
|
127
|
+
// --- Form ---
|
|
128
|
+
FormField: {
|
|
129
|
+
name: "FormField",
|
|
130
|
+
category: "components",
|
|
131
|
+
files: [
|
|
132
|
+
"components/form/FormField.tsx",
|
|
133
|
+
"components/form/FormField.css",
|
|
134
|
+
"components/form/FormFieldContext.ts",
|
|
135
|
+
],
|
|
136
|
+
dependencies: ["core"],
|
|
137
|
+
description: "Label + error/hint wrapper for form inputs",
|
|
138
|
+
},
|
|
139
|
+
TextField: {
|
|
140
|
+
name: "TextField",
|
|
141
|
+
category: "components",
|
|
142
|
+
files: [
|
|
143
|
+
"components/form/TextField.tsx",
|
|
144
|
+
"components/form/TextField.css",
|
|
145
|
+
],
|
|
146
|
+
dependencies: ["core", "FormField"],
|
|
147
|
+
description: "Text input with label/error/hint",
|
|
148
|
+
},
|
|
149
|
+
TextArea: {
|
|
150
|
+
name: "TextArea",
|
|
151
|
+
category: "components",
|
|
152
|
+
files: [
|
|
153
|
+
"components/form/TextArea.tsx",
|
|
154
|
+
"components/form/TextArea.css",
|
|
155
|
+
],
|
|
156
|
+
dependencies: ["core", "FormField"],
|
|
157
|
+
description: "Multiline text input",
|
|
158
|
+
},
|
|
159
|
+
NumberInput: {
|
|
160
|
+
name: "NumberInput",
|
|
161
|
+
category: "components",
|
|
162
|
+
files: [
|
|
163
|
+
"components/form/NumberInput.tsx",
|
|
164
|
+
"components/form/NumberInput.css",
|
|
165
|
+
],
|
|
166
|
+
dependencies: ["core", "FormField"],
|
|
167
|
+
description: "Number input with stepper buttons",
|
|
168
|
+
},
|
|
169
|
+
Select: {
|
|
170
|
+
name: "Select",
|
|
171
|
+
category: "components",
|
|
172
|
+
files: [
|
|
173
|
+
"components/form/Select.tsx",
|
|
174
|
+
"components/form/Select.css",
|
|
175
|
+
],
|
|
176
|
+
dependencies: ["core", "FormField"],
|
|
177
|
+
description: "Native select dropdown",
|
|
178
|
+
},
|
|
179
|
+
Checkbox: {
|
|
180
|
+
name: "Checkbox",
|
|
181
|
+
category: "components",
|
|
182
|
+
files: [
|
|
183
|
+
"components/form/Checkbox.tsx",
|
|
184
|
+
"components/form/Checkbox.css",
|
|
185
|
+
"components/form/CheckboxGroupContext.ts",
|
|
186
|
+
],
|
|
187
|
+
dependencies: ["core"],
|
|
188
|
+
description: "Checkbox with indeterminate support",
|
|
189
|
+
},
|
|
190
|
+
CheckboxGroup: {
|
|
191
|
+
name: "CheckboxGroup",
|
|
192
|
+
category: "components",
|
|
193
|
+
files: [
|
|
194
|
+
"components/form/CheckboxGroup.tsx",
|
|
195
|
+
"components/form/CheckboxGroup.css",
|
|
196
|
+
],
|
|
197
|
+
dependencies: ["core", "Checkbox"],
|
|
198
|
+
description: "Checkbox group with shared state",
|
|
199
|
+
},
|
|
200
|
+
RadioGroup: {
|
|
201
|
+
name: "RadioGroup",
|
|
202
|
+
category: "components",
|
|
203
|
+
files: [
|
|
204
|
+
"components/form/RadioGroup.tsx",
|
|
205
|
+
"components/form/RadioGroup.css",
|
|
206
|
+
"components/form/RadioGroupContext.ts",
|
|
207
|
+
"components/form/RadioButton.tsx",
|
|
208
|
+
"components/form/RadioButton.css",
|
|
209
|
+
],
|
|
210
|
+
dependencies: ["core"],
|
|
211
|
+
description: "Radio button group",
|
|
212
|
+
},
|
|
213
|
+
Switch: {
|
|
214
|
+
name: "Switch",
|
|
215
|
+
category: "components",
|
|
216
|
+
files: [
|
|
217
|
+
"components/form/Switch.tsx",
|
|
218
|
+
"components/form/Switch.css",
|
|
219
|
+
],
|
|
220
|
+
dependencies: ["core", "createToggle"],
|
|
221
|
+
description: "Toggle switch",
|
|
222
|
+
},
|
|
223
|
+
// --- Data Display ---
|
|
224
|
+
Table: {
|
|
225
|
+
name: "Table",
|
|
226
|
+
category: "components",
|
|
227
|
+
files: ["components/data/Table.tsx", "components/data/Table.css"],
|
|
228
|
+
dependencies: ["core"],
|
|
229
|
+
description: "Data table with sort, pagination, row selection",
|
|
230
|
+
},
|
|
231
|
+
Card: {
|
|
232
|
+
name: "Card",
|
|
233
|
+
category: "components",
|
|
234
|
+
files: ["components/data/Card.tsx", "components/data/Card.css"],
|
|
235
|
+
dependencies: ["core"],
|
|
236
|
+
description: "Content card with header/body/footer",
|
|
237
|
+
},
|
|
238
|
+
DescriptionList: {
|
|
239
|
+
name: "DescriptionList",
|
|
240
|
+
category: "components",
|
|
241
|
+
files: [
|
|
242
|
+
"components/data/DescriptionList.tsx",
|
|
243
|
+
"components/data/DescriptionList.css",
|
|
244
|
+
],
|
|
245
|
+
dependencies: ["core"],
|
|
246
|
+
description: "Key-value display",
|
|
247
|
+
},
|
|
248
|
+
Skeleton: {
|
|
249
|
+
name: "Skeleton",
|
|
250
|
+
category: "components",
|
|
251
|
+
files: ["components/data/Skeleton.tsx", "components/data/Skeleton.css"],
|
|
252
|
+
dependencies: ["core"],
|
|
253
|
+
description: "Loading placeholder",
|
|
254
|
+
},
|
|
255
|
+
EmptyState: {
|
|
256
|
+
name: "EmptyState",
|
|
257
|
+
category: "components",
|
|
258
|
+
files: [
|
|
259
|
+
"components/data/EmptyState.tsx",
|
|
260
|
+
"components/data/EmptyState.css",
|
|
261
|
+
],
|
|
262
|
+
dependencies: ["core"],
|
|
263
|
+
description: "Empty data display with action",
|
|
264
|
+
},
|
|
265
|
+
// --- Feedback ---
|
|
266
|
+
Dialog: {
|
|
267
|
+
name: "Dialog",
|
|
268
|
+
category: "components",
|
|
269
|
+
files: ["components/feedback/Dialog.tsx", "components/feedback/Dialog.css"],
|
|
270
|
+
dependencies: ["core", "createFocusTrap"],
|
|
271
|
+
description: "Modal dialog with focus trap",
|
|
272
|
+
},
|
|
273
|
+
Drawer: {
|
|
274
|
+
name: "Drawer",
|
|
275
|
+
category: "components",
|
|
276
|
+
files: ["components/feedback/Drawer.tsx", "components/feedback/Drawer.css"],
|
|
277
|
+
dependencies: ["core", "createFocusTrap"],
|
|
278
|
+
description: "Side panel with focus trap",
|
|
279
|
+
},
|
|
280
|
+
Alert: {
|
|
281
|
+
name: "Alert",
|
|
282
|
+
category: "components",
|
|
283
|
+
files: ["components/feedback/Alert.tsx", "components/feedback/Alert.css"],
|
|
284
|
+
dependencies: ["core"],
|
|
285
|
+
description: "Inline notification",
|
|
286
|
+
},
|
|
287
|
+
Toast: {
|
|
288
|
+
name: "Toast",
|
|
289
|
+
category: "components",
|
|
290
|
+
files: ["components/feedback/Toast.tsx", "components/feedback/Toast.css"],
|
|
291
|
+
dependencies: ["core", "createToast"],
|
|
292
|
+
description: "Toast notification with queue",
|
|
293
|
+
},
|
|
294
|
+
Progress: {
|
|
295
|
+
name: "Progress",
|
|
296
|
+
category: "components",
|
|
297
|
+
files: [
|
|
298
|
+
"components/feedback/Progress.tsx",
|
|
299
|
+
"components/feedback/Progress.css",
|
|
300
|
+
],
|
|
301
|
+
dependencies: ["core"],
|
|
302
|
+
description: "Progress bar",
|
|
303
|
+
},
|
|
304
|
+
Spinner: {
|
|
305
|
+
name: "Spinner",
|
|
306
|
+
category: "components",
|
|
307
|
+
files: [
|
|
308
|
+
"components/feedback/Spinner.tsx",
|
|
309
|
+
"components/feedback/Spinner.css",
|
|
310
|
+
],
|
|
311
|
+
dependencies: ["core"],
|
|
312
|
+
description: "Loading spinner",
|
|
313
|
+
},
|
|
314
|
+
// --- Navigation ---
|
|
315
|
+
Tabs: {
|
|
316
|
+
name: "Tabs",
|
|
317
|
+
category: "components",
|
|
318
|
+
files: ["components/navigation/Tabs.tsx", "components/navigation/Tabs.css"],
|
|
319
|
+
dependencies: ["core"],
|
|
320
|
+
description: "Tab navigation",
|
|
321
|
+
},
|
|
322
|
+
Breadcrumb: {
|
|
323
|
+
name: "Breadcrumb",
|
|
324
|
+
category: "components",
|
|
325
|
+
files: [
|
|
326
|
+
"components/navigation/Breadcrumb.tsx",
|
|
327
|
+
"components/navigation/Breadcrumb.css",
|
|
328
|
+
],
|
|
329
|
+
dependencies: ["core"],
|
|
330
|
+
description: "Breadcrumb navigation",
|
|
331
|
+
},
|
|
332
|
+
Pagination: {
|
|
333
|
+
name: "Pagination",
|
|
334
|
+
category: "components",
|
|
335
|
+
files: [
|
|
336
|
+
"components/navigation/Pagination.tsx",
|
|
337
|
+
"components/navigation/Pagination.css",
|
|
338
|
+
],
|
|
339
|
+
dependencies: ["core"],
|
|
340
|
+
description: "Page navigation",
|
|
341
|
+
},
|
|
342
|
+
Menu: {
|
|
343
|
+
name: "Menu",
|
|
344
|
+
category: "components",
|
|
345
|
+
files: ["components/navigation/Menu.tsx"],
|
|
346
|
+
dependencies: ["core"],
|
|
347
|
+
description: "Dropdown menu (placeholder)",
|
|
348
|
+
},
|
|
349
|
+
// --- Utility ---
|
|
350
|
+
VisuallyHidden: {
|
|
351
|
+
name: "VisuallyHidden",
|
|
352
|
+
category: "components",
|
|
353
|
+
files: [
|
|
354
|
+
"components/utility/VisuallyHidden.tsx",
|
|
355
|
+
"components/utility/VisuallyHidden.css",
|
|
356
|
+
],
|
|
357
|
+
dependencies: [],
|
|
358
|
+
description: "Screen reader only content",
|
|
359
|
+
},
|
|
360
|
+
Popover: {
|
|
361
|
+
name: "Popover",
|
|
362
|
+
category: "components",
|
|
363
|
+
files: ["components/utility/Popover.tsx"],
|
|
364
|
+
dependencies: ["core"],
|
|
365
|
+
description: "Floating element (placeholder)",
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
/** Resolve all dependencies recursively for a list of component names. */
|
|
369
|
+
export function resolveDependencies(names) {
|
|
370
|
+
const resolved = new Set();
|
|
371
|
+
function walk(name) {
|
|
372
|
+
if (resolved.has(name))
|
|
373
|
+
return;
|
|
374
|
+
const entry = registry[name];
|
|
375
|
+
if (!entry)
|
|
376
|
+
return;
|
|
377
|
+
for (const dep of entry.dependencies) {
|
|
378
|
+
walk(dep);
|
|
379
|
+
}
|
|
380
|
+
resolved.add(name);
|
|
381
|
+
}
|
|
382
|
+
for (const n of names) {
|
|
383
|
+
walk(n);
|
|
384
|
+
}
|
|
385
|
+
// core always first
|
|
386
|
+
const result = Array.from(resolved);
|
|
387
|
+
const coreIdx = result.indexOf("core");
|
|
388
|
+
if (coreIdx > 0) {
|
|
389
|
+
result.splice(coreIdx, 1);
|
|
390
|
+
result.unshift("core");
|
|
391
|
+
}
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
/** Collect all npm dependencies for resolved entries. */
|
|
395
|
+
export function collectNpmDeps(names) {
|
|
396
|
+
const deps = new Set();
|
|
397
|
+
for (const name of names) {
|
|
398
|
+
const entry = registry[name];
|
|
399
|
+
if (entry?.npmDependencies) {
|
|
400
|
+
for (const d of entry.npmDependencies) {
|
|
401
|
+
deps.add(d);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return Array.from(deps).sort();
|
|
406
|
+
}
|
|
407
|
+
/** Get all component names (excluding core). */
|
|
408
|
+
export function allComponentNames() {
|
|
409
|
+
return Object.keys(registry).filter((k) => k !== "core");
|
|
410
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
/**
|
|
3
|
+
* Rewrite internal soluid imports in a template file.
|
|
4
|
+
*
|
|
5
|
+
* Template files use relative imports like:
|
|
6
|
+
* import { cls } from "../../core/utils"
|
|
7
|
+
* import { FormField } from "./FormField"
|
|
8
|
+
* import { createFocusTrap } from "../../primitives/createFocusTrap"
|
|
9
|
+
*
|
|
10
|
+
* These need to be rewritten to point to the correct location
|
|
11
|
+
* in the user's project, using either an alias or relative paths.
|
|
12
|
+
*/
|
|
13
|
+
export function rewriteImports(content, filePath, // path of this file relative to componentDir (e.g. "components/form/TextField.tsx")
|
|
14
|
+
config) {
|
|
15
|
+
// Match import statements with relative paths (starting with . or ..)
|
|
16
|
+
const importRegex = /((?:import|export)\s+(?:type\s+)?(?:\{[^}]*\}|[\w*]+(?:\s*,\s*\{[^}]*\})?)\s+from\s+["'])(\.[^"']+)(["'])/g;
|
|
17
|
+
return content.replace(importRegex, (_match, prefix, importPath, suffix) => {
|
|
18
|
+
// Resolve the import path relative to the file's location within the template tree
|
|
19
|
+
const fileDir = path.dirname(filePath);
|
|
20
|
+
const resolvedInTemplate = path.normalize(path.join(fileDir, importPath));
|
|
21
|
+
// Now create the correct import path for the user's project
|
|
22
|
+
const newImportPath = buildImportPath(resolvedInTemplate, fileDir, config);
|
|
23
|
+
return `${prefix}${newImportPath}${suffix}`;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function buildImportPath(targetPathInTemplate, // e.g. "core/utils" or "components/form/FormField"
|
|
27
|
+
sourceDir, // e.g. "components/form"
|
|
28
|
+
config) {
|
|
29
|
+
if (config.alias) {
|
|
30
|
+
// Use alias: @/components/ui/core/utils
|
|
31
|
+
const aliasRoot = config.aliasBase
|
|
32
|
+
? `${config.alias}/${config.componentDir.replace(new RegExp(`^${config.aliasBase}/`), "")}`
|
|
33
|
+
: `${config.alias}/${config.componentDir}`;
|
|
34
|
+
return `${aliasRoot}/${targetPathInTemplate}`;
|
|
35
|
+
}
|
|
36
|
+
// Use relative path from source file to target
|
|
37
|
+
let rel = path.relative(sourceDir, targetPathInTemplate);
|
|
38
|
+
if (!rel.startsWith(".")) {
|
|
39
|
+
rel = "./" + rel;
|
|
40
|
+
}
|
|
41
|
+
return rel;
|
|
42
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "soluid",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"componentsVersion": "0.1.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "SolidJS Opinionated UI - copy-paste component toolkit",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"soluid": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "vite",
|
|
16
|
+
"build:cli": "tsc -p cli/tsconfig.json",
|
|
17
|
+
"prepare": "npm run build:cli",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"fmt": "dprint fmt",
|
|
20
|
+
"fmt:check": "dprint check",
|
|
21
|
+
"lint": "oxlint src/ cli/",
|
|
22
|
+
"lint:fix": "oxlint --fix src/ cli/"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.19.34",
|
|
26
|
+
"dprint": "^0.52.0",
|
|
27
|
+
"oxlint": "^1.50.0",
|
|
28
|
+
"solid-js": "^1.9.0",
|
|
29
|
+
"typescript": "^5.7.0",
|
|
30
|
+
"vite": "^6.0.0",
|
|
31
|
+
"vite-plugin-solid": "^2.11.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"tar": "^7.5.9"
|
|
35
|
+
}
|
|
36
|
+
}
|