@maestro-js/components 1.0.0-alpha.19 → 1.0.0-alpha.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/commands/add.ts +1 -16
- package/dist/components.json +1 -1
- package/dist/index.js +1 -14
- package/package.json +5 -5
- package/registry.json +790 -598
- package/scripts/build.ts +4 -11
- package/src/components/alert-dialog.tsx +3 -3
- package/src/components/avatar.tsx +1 -1
- package/src/components/button-link.tsx +0 -3
- package/src/components/button.tsx +0 -4
- package/src/components/checkbox.tsx +7 -7
- package/src/components/chip.tsx +7 -7
- package/src/components/container.tsx +3 -3
- package/src/components/dialog.tsx +7 -21
- package/src/components/disclosure.tsx +1 -1
- package/src/components/drawer.tsx +5 -19
- package/src/components/form.tsx +5 -27
- package/src/components/helpers/form-field.tsx +8 -7
- package/src/components/helpers/get-button-classes.ts +23 -23
- package/src/components/helpers/headless-button.tsx +1 -1
- package/src/components/inline-alert.tsx +3 -3
- package/src/components/labeled-value.tsx +2 -2
- package/src/components/menu.tsx +26 -60
- package/src/components/month-day-input.tsx +1 -2
- package/src/components/multiselect.tsx +70 -74
- package/src/components/radio.tsx +8 -8
- package/src/components/select.tsx +8 -9
- package/src/components/stepper.tsx +6 -6
- package/src/components/switch.tsx +7 -7
- package/src/components/tabs.tsx +1 -1
- package/src/components/tag-field.tsx +3 -3
- package/src/components/text-area.tsx +1 -1
- package/src/components/text-field.tsx +1 -4
- package/src/components/toast.tsx +6 -6
- package/src/components/toggle-button-group.tsx +2 -2
- package/src/utils/icons.d.ts +1 -2
- package/src/utils/use-tab-indicator.ts +9 -9
- package/src/components/date-range.tsx +0 -138
- package/src/components/optional-link.tsx +0 -15
- package/src/components/table/headless-templated-row-table.ts +0 -550
- package/src/components/table/index.tsx +0 -41
- package/src/components/table/server-table.ts +0 -143
- package/src/components/table/table-actions.tsx +0 -76
- package/src/components/table/table-container.tsx +0 -173
- package/src/components/table/table-container.type-test.ts +0 -155
- package/src/components/table/table-filters/date-range-filter.tsx +0 -227
- package/src/components/table/table-filters/select-filter.tsx +0 -211
- package/src/components/table/table-filters/sort.tsx +0 -85
- package/src/components/table/table-primitives.tsx +0 -226
- package/src/components/table/table-toolbar.tsx +0 -300
- package/src/components/table/table-types.ts +0 -61
- package/src/components/table/use-client-table.ts +0 -157
- package/src/components/table/use-client-table.type-test.ts +0 -217
- package/src/components/table/use-server-table.ts +0 -192
- package/src/components/table/use-server-table.type-test.ts +0 -174
- package/src/utils/use-query-state.ts +0 -626
package/commands/add.ts
CHANGED
|
@@ -4,31 +4,16 @@ import { fileURLToPath } from 'node:url'
|
|
|
4
4
|
|
|
5
5
|
type RegistryComponent = {
|
|
6
6
|
name: string
|
|
7
|
-
dependencies?: string[]
|
|
8
7
|
files: { name: string; content: string }[]
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
function resolveDependencies(names: string[], registry: RegistryComponent[]) {
|
|
12
|
-
const resolved = new Set<string>()
|
|
13
|
-
const queue = [...names]
|
|
14
|
-
while (queue.length) {
|
|
15
|
-
const name = queue.pop()!
|
|
16
|
-
if (resolved.has(name)) continue
|
|
17
|
-
resolved.add(name)
|
|
18
|
-
const entry = registry.find((c) => c.name === name)
|
|
19
|
-
if (entry?.dependencies) queue.push(...entry.dependencies)
|
|
20
|
-
}
|
|
21
|
-
return resolved
|
|
22
|
-
}
|
|
23
|
-
|
|
24
10
|
export async function add(options: { components: string[]; directory: string; overwrite?: boolean }) {
|
|
25
11
|
const registryPath = resolve(dirname(fileURLToPath(import.meta.url)), './components.json')
|
|
26
12
|
const registry: RegistryComponent[] = JSON.parse(await readFile(registryPath, 'utf-8'))
|
|
27
13
|
|
|
28
|
-
const all = resolveDependencies(options.components, registry)
|
|
29
14
|
const written: string[] = []
|
|
30
15
|
|
|
31
|
-
for (const componentName of
|
|
16
|
+
for (const componentName of options.components) {
|
|
32
17
|
const component = registry.find((c) => c.name === componentName)
|
|
33
18
|
if (!component) {
|
|
34
19
|
throw new Error(`Component "${componentName}" not found in registry`)
|