fulldev-ui 0.5.0-beta.0 → 0.5.0-beta.10
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/CONTRIBUTING.md +10 -4
- package/astro.config.ts +4 -11
- package/package.json +5 -3
- package/pnpm-lock.yaml +6400 -0
- package/src/blocks/Article.astro +31 -12
- package/src/blocks/Banner.astro +2 -1
- package/src/blocks/Contact.astro +7 -30
- package/src/blocks/Excerpt.astro +14 -0
- package/src/blocks/Intro.astro +3 -1
- package/src/blocks/Product.astro +55 -22
- package/src/components/Card.astro +11 -5
- package/src/components/Cart.astro +38 -0
- package/src/components/CartForm.astro +121 -0
- package/src/components/CartList.astro +134 -0
- package/src/components/CartSummary.astro +147 -0
- package/src/components/Drawer.astro +128 -52
- package/src/components/Footer.astro +6 -3
- package/src/components/Form.astro +49 -0
- package/src/components/Header.astro +19 -14
- package/src/components/Image.astro +0 -1
- package/src/components/Input.astro +6 -0
- package/src/components/Menu.astro +56 -0
- package/src/components/Price.astro +7 -11
- package/src/components/Search.astro +1 -4
- package/src/components/Section.astro +2 -1
- package/src/components/Sidebar.astro +66 -105
- package/src/components/Social.astro +7 -0
- package/src/components/ThemeSelect.astro +3 -0
- package/src/components/Toc.astro +33 -94
- package/src/components/docs/PropsTable.astro +2 -2
- package/src/components/experimental/Form.astro +31 -5
- package/src/components/experimental/Gallery.astro +50 -126
- package/src/components/experimental/Prose.astro +32 -0
- package/src/content/pages/base/select.mdx +0 -8
- package/src/content/pages/base/textarea.mdx +0 -5
- package/src/content/pages/blocks/_product.mdx +73 -2
- package/src/content/pages/index.mdx +0 -3
- package/src/content/pages/layouts/_layout.mdx +14 -0
- package/src/content/pages/layouts/docslayout.mdx +10 -1
- package/src/content/pages/overview/components.mdx +5 -0
- package/src/content/pages/overview/content-collections.mdx +139 -0
- package/src/content/pages/overview/installation.mdx +25 -26
- package/src/content/pages/overview/introduction.mdx +16 -10
- package/src/content/pages/overview/theming.mdx +69 -0
- package/src/content/pages/schemas/page.mdx +6 -0
- package/src/content/presets/base.yml +57 -44
- package/src/content/presets/blocks.yml +0 -3
- package/src/content/presets/docs.yml +3 -62
- package/src/env.d.ts +1 -1
- package/src/integration/index.ts +49 -33
- package/src/layouts/DocsLayout.astro +23 -35
- package/src/layouts/Layout.astro +37 -21
- package/src/layouts/OverviewLayout.astro +17 -10
- package/src/layouts/PostLayout.astro +7 -7
- package/src/layouts/ProductLayout.astro +5 -2
- package/src/schemas/components/footer.ts +1 -0
- package/src/schemas/components/header.ts +1 -0
- package/src/schemas/components/menu.ts +13 -0
- package/src/schemas/components/sidebar.ts +15 -0
- package/src/schemas/components/toc.ts +3 -0
- package/src/schemas/pageSchema.ts +72 -34
- package/src/schemas/presetSchema.ts +2 -28
- package/src/schemas/utils/navigation.ts +6 -51
- package/src/stores/cart.ts +23 -0
- package/src/utils/cart.ts +36 -0
- package/src/utils/{getChildPages.ts → getFolderChildren.ts} +3 -1
- package/src/utils/{getCategoryPages.ts → getReferenceChildren.ts} +6 -3
- package/tsconfig.json +1 -3
- package/.astro/assets.mjs +0 -1
- package/.astro/astro/content.d.ts +0 -547
- package/.astro/collections/blocks.schema.json +0 -851
- package/.astro/collections/collections.json +0 -63
- package/.astro/collections/images.schema.json +0 -22
- package/.astro/collections/layouts.schema.json +0 -826
- package/.astro/collections/pages.schema.json +0 -568
- package/.astro/collections/presets.schema.json +0 -489
- package/.astro/collections/records.schema.json +0 -822
- package/.astro/collections/settings.schema.json +0 -822
- package/.astro/data-store.json +0 -1
- package/.astro/modules.mjs +0 -1
- package/.astro/settings.json +0 -5
- package/.astro/types.d.ts +0 -2
- package/src/components/experimental/GalleryVertical.astro +0 -161
- package/src/content/pages/layouts/layout.mdx +0 -21
- package/src/content/pages/layouts/pagelayout.mdx +0 -21
- package/src/content/pages/overview/content-layer.mdx +0 -128
- package/src/content/pages/overview/customization.mdx +0 -83
- package/src/layouts/ContentLayout.astro +0 -16
- package/src/layouts/PageLayout.astro +0 -15
- /package/src/schemas/utils/{categories.ts → parents.ts} +0 -0
- /package/src/types/{global-props.d.ts → global-props.ts} +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ComponentProps } from 'astro/types'
|
|
3
3
|
import Article from 'fulldev-ui/blocks/Article.astro'
|
|
4
|
-
import Intro from 'fulldev-ui/blocks/Intro.astro'
|
|
5
4
|
import Sections from 'fulldev-ui/components/sections.astro'
|
|
6
5
|
import Layout from 'fulldev-ui/layouts/Layout.astro'
|
|
7
6
|
|
|
8
7
|
type Props = ComponentProps<typeof Layout>
|
|
9
8
|
|
|
10
|
-
const {
|
|
9
|
+
const { sections, render, toc } = Astro.props
|
|
11
10
|
---
|
|
12
11
|
|
|
13
12
|
<Layout {...Astro.props}>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<Article
|
|
14
|
+
{render}
|
|
15
|
+
{toc}
|
|
16
|
+
>
|
|
17
|
+
<slot name="prose" />
|
|
18
|
+
</Article>
|
|
19
19
|
<Sections {sections} />
|
|
20
20
|
<slot />
|
|
21
21
|
</Layout>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ComponentProps } from 'astro/types'
|
|
3
3
|
import Article from 'fulldev-ui/blocks/Article.astro'
|
|
4
|
-
import
|
|
4
|
+
import Section from 'fulldev-ui/components/Section.astro'
|
|
5
5
|
import Sections from 'fulldev-ui/components/sections.astro'
|
|
6
6
|
import Layout from 'fulldev-ui/layouts/Layout.astro'
|
|
7
7
|
|
|
@@ -11,7 +11,10 @@ const { render, sections, ...rest } = Astro.props
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<Layout {...Astro.props}>
|
|
14
|
-
<
|
|
14
|
+
<Section
|
|
15
|
+
component="Product"
|
|
16
|
+
{...rest as any}
|
|
17
|
+
/>
|
|
15
18
|
<Article />
|
|
16
19
|
<Sections {sections} />
|
|
17
20
|
<slot />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'astro:content'
|
|
2
|
+
import logo from '../components/logo'
|
|
3
|
+
import menu from '../components/menu'
|
|
4
|
+
import heading from './heading'
|
|
5
|
+
import toc from './toc'
|
|
6
|
+
|
|
7
|
+
export default z
|
|
8
|
+
.object({
|
|
9
|
+
logo,
|
|
10
|
+
heading,
|
|
11
|
+
menu,
|
|
12
|
+
toc,
|
|
13
|
+
})
|
|
14
|
+
.partial()
|
|
15
|
+
.passthrough()
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { getEntries, getEntry, z } from 'astro:content'
|
|
2
2
|
import { assign } from 'radash'
|
|
3
|
+
import fulldevConfig from 'virtual:fulldev-ui/config'
|
|
4
|
+
import footer from './components/footer'
|
|
5
|
+
import header from './components/header'
|
|
3
6
|
import image from './components/image'
|
|
7
|
+
import images from './components/images'
|
|
8
|
+
import price from './components/price'
|
|
9
|
+
import section from './components/section'
|
|
4
10
|
import sections from './components/sections'
|
|
5
|
-
import
|
|
11
|
+
import sidebar from './components/sidebar'
|
|
12
|
+
import toc from './components/toc'
|
|
6
13
|
import component from './utils/component'
|
|
7
14
|
import navigation from './utils/navigation'
|
|
15
|
+
import parents from './utils/parents'
|
|
8
16
|
import pathSchema from './utils/pathSchema'
|
|
9
17
|
|
|
10
|
-
const i18n = z
|
|
18
|
+
export const i18n = z
|
|
11
19
|
.object({
|
|
12
20
|
i18n: pathSchema('pages').optional(),
|
|
13
21
|
})
|
|
@@ -19,45 +27,75 @@ const i18n = z
|
|
|
19
27
|
return merged as typeof rest
|
|
20
28
|
})
|
|
21
29
|
|
|
22
|
-
const presets = z
|
|
30
|
+
export const presets = z
|
|
23
31
|
.object({
|
|
24
32
|
presets: z.array(pathSchema('presets')).optional(),
|
|
25
33
|
})
|
|
26
34
|
.passthrough()
|
|
27
35
|
.transform(async ({ presets, ...rest }) => {
|
|
28
|
-
if (!presets) return rest
|
|
29
|
-
const entries = await getEntries(presets)
|
|
30
36
|
let mergedData = {}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
|
|
38
|
+
if (fulldevConfig.basePreset) {
|
|
39
|
+
const baseEntry = await getEntry('presets', fulldevConfig.basePreset)
|
|
40
|
+
mergedData = assign(mergedData, baseEntry?.data || {})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (presets) {
|
|
44
|
+
const entries = await getEntries(presets)
|
|
45
|
+
entries.forEach(
|
|
46
|
+
(preset: any) => (mergedData = assign(mergedData, preset.data))
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
34
50
|
mergedData = assign(mergedData, rest)
|
|
35
51
|
return mergedData as typeof rest
|
|
36
52
|
})
|
|
37
53
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
export const basePreset = z
|
|
55
|
+
.object({})
|
|
56
|
+
.passthrough()
|
|
57
|
+
.transform(async (data) => {
|
|
58
|
+
if (!fulldevConfig.basePreset) return data
|
|
59
|
+
const baseEntry = await getEntry('presets', fulldevConfig.basePreset)
|
|
60
|
+
const mergedData = assign(baseEntry?.data ?? {}, data)
|
|
61
|
+
return mergedData as typeof data
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export const page = z
|
|
65
|
+
.object({
|
|
66
|
+
component,
|
|
67
|
+
parents,
|
|
68
|
+
theme: z.enum(['light', 'dark']),
|
|
69
|
+
lang: z.string(),
|
|
70
|
+
seo: z
|
|
71
|
+
.object({
|
|
72
|
+
title: z.string().optional(),
|
|
73
|
+
description: z.string().optional(),
|
|
74
|
+
})
|
|
75
|
+
.optional(),
|
|
76
|
+
title: z.string(),
|
|
77
|
+
description: z.string().optional(),
|
|
78
|
+
image,
|
|
79
|
+
images,
|
|
80
|
+
section,
|
|
81
|
+
sections,
|
|
82
|
+
footer,
|
|
83
|
+
header: header,
|
|
84
|
+
sidebar: sidebar,
|
|
85
|
+
navigation,
|
|
86
|
+
toc,
|
|
87
|
+
price,
|
|
88
|
+
code: z.any(),
|
|
89
|
+
sizes: z.any(),
|
|
90
|
+
banner: z.any(),
|
|
91
|
+
_schema: z.any(),
|
|
92
|
+
uitverkocht: z.any(),
|
|
93
|
+
rating: z.any(),
|
|
94
|
+
variants: z.any(),
|
|
95
|
+
heading: z.any(),
|
|
96
|
+
href: z.any(),
|
|
97
|
+
})
|
|
98
|
+
.partial()
|
|
99
|
+
.strict()
|
|
100
|
+
|
|
101
|
+
export default i18n.pipe(basePreset).pipe(presets).pipe(page)
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import image from './components/image'
|
|
3
|
-
import sections from './components/sections'
|
|
4
|
-
import categories from './utils/categories'
|
|
5
|
-
import component from './utils/component'
|
|
1
|
+
import { page } from './pageSchema'
|
|
6
2
|
|
|
7
|
-
export default
|
|
8
|
-
.object({
|
|
9
|
-
component,
|
|
10
|
-
categories,
|
|
11
|
-
theme: z.enum(['light', 'dark']),
|
|
12
|
-
lang: z.string(),
|
|
13
|
-
seo: z
|
|
14
|
-
.object({
|
|
15
|
-
title: z.string().optional(),
|
|
16
|
-
description: z.string().optional(),
|
|
17
|
-
})
|
|
18
|
-
.optional(),
|
|
19
|
-
title: z.string(),
|
|
20
|
-
description: z.string().optional(),
|
|
21
|
-
image,
|
|
22
|
-
sections,
|
|
23
|
-
header: z.any(),
|
|
24
|
-
footer: z.any(),
|
|
25
|
-
navigation: z.any(),
|
|
26
|
-
toc: z.any(),
|
|
27
|
-
sidebar: z.any(),
|
|
28
|
-
})
|
|
29
|
-
.partial()
|
|
3
|
+
export default page
|
|
@@ -1,53 +1,8 @@
|
|
|
1
|
-
// import { z } from 'astro:content'
|
|
2
|
-
// import button from '../components/button'
|
|
3
|
-
// import buttons from '../components/buttons'
|
|
4
|
-
// import heading from '../components/heading'
|
|
5
|
-
// import logo from '../components/logo'
|
|
6
|
-
|
|
7
|
-
// export default z.object({
|
|
8
|
-
// logo,
|
|
9
|
-
// buttons: z.array(
|
|
10
|
-
// button.or(
|
|
11
|
-
// z.object({
|
|
12
|
-
// heading,
|
|
13
|
-
// buttons,
|
|
14
|
-
// })
|
|
15
|
-
// )
|
|
16
|
-
// ),
|
|
17
|
-
// })
|
|
18
|
-
|
|
19
1
|
import { z } from 'astro:content'
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
const button = pathSchema('pages').or(
|
|
23
|
-
z
|
|
24
|
-
.object({
|
|
25
|
-
text: z.string(),
|
|
26
|
-
href: z.string(),
|
|
27
|
-
heading: z.never(),
|
|
28
|
-
buttons: z.never(),
|
|
29
|
-
})
|
|
30
|
-
.partial()
|
|
31
|
-
.passthrough()
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const group = z
|
|
35
|
-
.object({
|
|
36
|
-
heading: z.string(),
|
|
37
|
-
buttons: z.array(button),
|
|
38
|
-
text: z.never(),
|
|
39
|
-
href: z.never(),
|
|
40
|
-
})
|
|
41
|
-
.partial()
|
|
42
|
-
.passthrough()
|
|
2
|
+
import header from '../components/header'
|
|
3
|
+
import sidebar from '../components/sidebar'
|
|
43
4
|
|
|
44
|
-
export default
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
sidebar: z.boolean(),
|
|
49
|
-
toc: z.boolean(),
|
|
50
|
-
buttons: z.array(button.or(group)),
|
|
51
|
-
})
|
|
52
|
-
.partial()
|
|
53
|
-
.passthrough()
|
|
5
|
+
export default sidebar.merge(header).extend({
|
|
6
|
+
header: z.boolean().optional(),
|
|
7
|
+
sidebar: z.boolean().optional(),
|
|
8
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { persistentAtom } from '@nanostores/persistent'
|
|
2
|
+
import { computed } from 'nanostores'
|
|
3
|
+
|
|
4
|
+
// type Item = CollectionEntry<'products'>['data'] & {
|
|
5
|
+
// quantity: number
|
|
6
|
+
// }
|
|
7
|
+
|
|
8
|
+
type Item = any
|
|
9
|
+
|
|
10
|
+
export const $cart = persistentAtom<Item[] | []>('cart', [], {
|
|
11
|
+
encode: JSON.stringify,
|
|
12
|
+
decode: JSON.parse,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
// export const cartIsOpen = atom(false)
|
|
16
|
+
|
|
17
|
+
export const $totalPrice = computed($cart, ($cart) =>
|
|
18
|
+
$cart.reduce((a, b) => +a + b.price * b.quantity, 0)
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
// export const totalQuantity = computed(cart, ($cart) =>
|
|
22
|
+
// $cart.reduce((a, b) => +a + b.quantity, 0)
|
|
23
|
+
// )
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// import Stripe from 'stripe'
|
|
2
|
+
|
|
3
|
+
// const stripe = new Stripe(import.meta.env.STRIPE_SECRET_KEY)
|
|
4
|
+
|
|
5
|
+
const slugify = (input: string): string => {
|
|
6
|
+
return input
|
|
7
|
+
.toLowerCase()
|
|
8
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
9
|
+
.replace(/^-+|-+$/g, '')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const generateProductId = (
|
|
13
|
+
slug: string,
|
|
14
|
+
variants?: string[] | undefined
|
|
15
|
+
): string => {
|
|
16
|
+
const slugified = slugify(slug)
|
|
17
|
+
|
|
18
|
+
if (variants && variants.length > 0)
|
|
19
|
+
return `${slugified}--${variants.map((variant) => slugify(variant)).join('--')}`
|
|
20
|
+
|
|
21
|
+
return slugified
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const generateProductName = (
|
|
25
|
+
title: string,
|
|
26
|
+
variants?: string[] | undefined
|
|
27
|
+
): string => {
|
|
28
|
+
if (variants && variants.length > 0)
|
|
29
|
+
return `${title} / ${variants.join(' / ')}`
|
|
30
|
+
|
|
31
|
+
return title
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const formatPrice = (price: number): string => {
|
|
35
|
+
return `€${price?.toFixed(2).replace('.', ',')}`
|
|
36
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getCollection, type CollectionEntry } from 'astro:content'
|
|
2
2
|
|
|
3
3
|
// Records that are in a folder with the current page's slug
|
|
4
|
-
export const
|
|
4
|
+
export const getFolderChildren = async (
|
|
5
|
+
slug: CollectionEntry<'pages'>['slug']
|
|
6
|
+
) =>
|
|
5
7
|
(
|
|
6
8
|
await getCollection(
|
|
7
9
|
'pages',
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { getCollection, type CollectionEntry } from 'astro:content'
|
|
2
2
|
|
|
3
3
|
// Pages that reference the current page
|
|
4
|
-
export const
|
|
4
|
+
export const getReferenceChildren = async (
|
|
5
5
|
slug: CollectionEntry<'pages'>['slug']
|
|
6
6
|
) =>
|
|
7
7
|
(
|
|
8
8
|
await getCollection('pages', (page) =>
|
|
9
|
-
page.data?.
|
|
9
|
+
page.data?.parents?.some((p: any) => p.slug === slug)
|
|
10
10
|
)
|
|
11
|
-
)?.map((
|
|
11
|
+
)?.map(({ slug, data }) => ({
|
|
12
|
+
...data,
|
|
13
|
+
href: `/${slug}/`,
|
|
14
|
+
}))
|
package/tsconfig.json
CHANGED
package/.astro/assets.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default new Map();
|