fulldev-ui 0.3.0-beta.1 → 0.3.0-beta.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/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import Component from '../_Component.astro'
|
|
3
|
-
|
|
4
2
|
interface Props {
|
|
5
|
-
|
|
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 {
|
|
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 ===
|
|
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
|
-
|
|
7
|
-
block?: string
|
|
8
|
-
[key: string | number | symbol]: any
|
|
9
|
-
}
|
|
5
|
+
blocks?: any
|
|
10
6
|
}
|
|
11
|
-
---
|
|
12
7
|
|
|
13
|
-
{
|
|
14
|
-
|
|
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
|
-
|
|
20
|
-
<Block
|
|
21
|
-
block={block ?? keyBlock}
|
|
22
|
-
{...rest}
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
})
|
|
26
|
-
}
|
|
11
|
+
{blocks?.map((block: any) => <Block {...block} />)}
|
|
@@ -60,7 +60,8 @@ 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:
|
|
63
|
+
blocks: blockSchema(references).array(),
|
|
64
|
+
main: z.object({}).catchall(blockSchema(references)).partial(),
|
|
64
65
|
head: z
|
|
65
66
|
.object({
|
|
66
67
|
title: z.string(),
|