Skip to content

Commit 353f295

Browse files
committed
revise component registry
1 parent 79ad7d4 commit 353f295

16 files changed

Lines changed: 14 additions & 16 deletions

File tree

packages/cli/src/client.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ const Index = z.array(
4343
)
4444

4545
export const schema = createSchema({
46-
'/:framework/recipes/index': {
46+
'/recipes/index': {
4747
output: Index,
4848
},
49-
'/:framework/recipes/:id': {
49+
'/recipes/:id': {
5050
output: Recipe,
5151
},
52-
'/:framework/components/index': {
52+
'/components/:framework/index': {
5353
output: Index,
5454
},
55-
'/:framework/components/:id': {
55+
'/components/:framework/:id': {
5656
output: Component,
5757
},
5858
})
@@ -79,10 +79,9 @@ interface Params {
7979
id: string
8080
}
8181

82-
export const getComponent = (params: Params) => $fetch('/:framework/components/:id', { params })
83-
export const getRecipe = (params: Params) => $fetch('/:framework/recipes/:id', { params })
82+
export const getComponent = (params: Params) => $fetch('/components/:framework/:id', { params })
83+
export const getRecipe = (id: string) => $fetch('/recipes/:id', { params: { id } })
8484

85-
export const listRecipes = (framework: Framework) =>
86-
$fetch('/:framework/recipes/index', { params: { framework } })
85+
export const listRecipes = () => $fetch('/recipes/index')
8786
export const listComponents = (framework: Framework) =>
88-
$fetch('/:framework/components/index', { params: { framework } })
87+
$fetch('/components/:framework/index', { params: { framework } })

packages/cli/src/effects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export const installComponent =
3636
)
3737

3838
export const installRecipe =
39-
({ framework, dest }: Args) =>
39+
({ dest }: Args) =>
4040
(id: string) =>
4141
pipe(
4242
Effect.tryPromise({
43-
try: () => getRecipe({ framework, id }),
43+
try: () => getRecipe(id),
4444
catch: () => HttpError,
4545
}),
4646
Effect.filterOrFail(

packages/preset/src/theme/recipes/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { RecipeConfig, RecipeVariantRecord, SlotRecipeConfig } from '@pandacss/dev'
21
import { accordion } from './accordion'
32
import { alert } from './alert'
43
import { avatar } from './avatar'
@@ -53,7 +52,7 @@ import { toggleGroup } from './toggle-group'
5352
import { tooltip } from './tooltip'
5453
import { treeView } from './tree-view'
5554

56-
export const recipes: Record<string, Partial<RecipeConfig<RecipeVariantRecord>>> = {
55+
export const recipes = {
5756
badge,
5857
button,
5958
code,
@@ -68,7 +67,7 @@ export const recipes: Record<string, Partial<RecipeConfig<RecipeVariantRecord>>>
6867
text,
6968
}
7069

71-
export const slotRecipes: Record<string, Partial<SlotRecipeConfig>> = {
70+
export const slotRecipes = {
7271
accordion,
7372
alert,
7473
avatar,

registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ for (const exp of source.getExportDeclarations()) {
6565
})
6666

6767
Bun.write(
68-
`./website/public/registry/latest/react/components/${id}.json`,
68+
`./website/public/registry/latest/components/react/${id}.json`,
6969
JSON.stringify(
7070
{
7171
id,
@@ -81,6 +81,6 @@ for (const exp of source.getExportDeclarations()) {
8181
}
8282

8383
Bun.write(
84-
`./website/public/registry/latest/react/components/index.json`,
84+
`./website/public/registry/latest/components/react/index.json`,
8585
JSON.stringify(index, null, 2),
8686
)

website/public/registry/latest/react/components/avatar.json renamed to website/public/registry/latest/components/react/avatar.json

File renamed without changes.

website/public/registry/latest/react/components/badge.json renamed to website/public/registry/latest/components/react/badge.json

File renamed without changes.

website/public/registry/latest/react/components/button.json renamed to website/public/registry/latest/components/react/button.json

File renamed without changes.

website/public/registry/latest/react/components/card.json renamed to website/public/registry/latest/components/react/card.json

File renamed without changes.

website/public/registry/latest/react/components/field.json renamed to website/public/registry/latest/components/react/field.json

File renamed without changes.

website/public/registry/latest/react/components/heading.json renamed to website/public/registry/latest/components/react/heading.json

File renamed without changes.

0 commit comments

Comments
 (0)