fulldev-ui 0.3.0-beta.1 → 0.3.0-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.3.0-beta.3",
4
4
  "description": "A component library built for Astro",
5
5
  "homepage": "https://ui.full.dev",
6
6
  "bugs": "https://github.com/fulldotdev/ui/issues",
@@ -1,8 +1,6 @@
1
1
  ---
2
- import Component from '../_Component.astro'
3
-
4
2
  interface Props {
5
- block?: string
3
+ _block?: string
6
4
  [key: string | number | symbol]: any
7
5
  }
8
6
 
@@ -10,13 +8,18 @@ const libraryComponents = await Astro.glob('../**/*.astro')
10
8
  const userComponents = await Astro.glob('/src/**/*.astro')
11
9
  const components = [...userComponents, ...libraryComponents]
12
10
 
13
- const { block, ...rest } = Astro.props
11
+ const { _block, ...rest } = Astro.props
14
12
 
15
13
  const Component = components.find((component) => {
16
14
  const fileName = component.default.moduleId?.split('/').pop()
17
15
  const componentName = fileName?.split('.')[0]
18
- return componentName === block
16
+ return componentName === _block
19
17
  })?.default
18
+
19
+ console.log({
20
+ _block,
21
+ Component,
22
+ })
20
23
  ---
21
24
 
22
25
  {Component && <Component {...rest} />}
@@ -1,26 +1,11 @@
1
1
  ---
2
- import { pascal } from 'radash'
3
2
  import Block from './_Block.astro'
4
3
 
5
4
  interface Props {
6
- [key: string | number | symbol]: {
7
- block?: string
8
- [key: string | number | symbol]: any
9
- }
5
+ blocks?: any
10
6
  }
11
- ---
12
7
 
13
- {
14
- Object.entries(Astro.props).map(([key, value]) => {
15
- const { block, ...rest } = value
16
- const keyPart = key.split(/(?=[A-Z])/).pop()
17
- const keyBlock = keyPart ? pascal(keyPart) : ''
8
+ const { blocks } = Astro.props
9
+ ---
18
10
 
19
- return (
20
- <Block
21
- block={block ?? keyBlock}
22
- {...rest}
23
- />
24
- )
25
- })
26
- }
11
+ {blocks?.map((block: any) => <Block {...block} />)}
@@ -60,7 +60,10 @@ export const pageSchema = <R extends ZodRawShape>(references: R) =>
60
60
  title: z.string(),
61
61
  description: z.string(),
62
62
  block: blockSchema(references),
63
- blocks: z.object({}).catchall(blockSchema(references)).partial(),
63
+ hero: blockSchema(references),
64
+ cta: blockSchema(references),
65
+ blocks: blockSchema(references).array(),
66
+ main: z.object({}).catchall(blockSchema(references)).partial(),
64
67
  head: z
65
68
  .object({
66
69
  title: z.string(),