fulldev-ui 0.6.0-beta.0 → 0.6.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.
Files changed (175) hide show
  1. package/astro.config.ts +10 -2
  2. package/example.svelte +0 -0
  3. package/package.json +12 -7
  4. package/parent.svelte +0 -0
  5. package/pnpm-lock.yaml +301 -35
  6. package/src/App.svelte +0 -0
  7. package/src/blocks/Products.astro +53 -72
  8. package/src/components/Card.astro +2 -2
  9. package/src/components/Cart.astro +12 -3
  10. package/src/components/CartAdd.svelte +76 -0
  11. package/src/components/CartCheckout.svelte +58 -0
  12. package/src/components/CartForm.astro +87 -88
  13. package/src/components/CartForm.svelte +130 -0
  14. package/src/components/CartList.astro +84 -79
  15. package/src/components/CartList.svelte +88 -0
  16. package/src/components/CartQuantity.svelte +81 -0
  17. package/src/components/CartSummary.astro +8 -94
  18. package/src/components/CartTotal.svelte +15 -0
  19. package/src/components/Dialog.astro +1 -0
  20. package/src/components/Drawer.astro +1 -0
  21. package/src/components/Gallery.astro +3 -1
  22. package/src/components/Header.astro +2 -0
  23. package/src/components/Image.astro +2 -2
  24. package/src/components/Input.astro +17 -9
  25. package/src/components/ProductCard.astro +52 -0
  26. package/src/components/Prose.astro +1 -1
  27. package/src/components/Search.astro +106 -43
  28. package/src/components/Section.astro +11 -269
  29. package/src/components/Select.astro +1 -0
  30. package/src/components/_CartList backup.astro +125 -0
  31. package/src/components/_CartList copy.astro +213 -0
  32. package/src/components/_CartListSimple.astro +148 -0
  33. package/src/content/categories/mugs.md +7 -0
  34. package/src/content/config.ts +24 -4
  35. package/src/content/{pages/docs → docs}/_internationalization.mdx +0 -1
  36. package/src/content/{pages/docs → docs}/_using-blocks.mdx +0 -1
  37. package/src/content/{pages/docs → docs}/_using-presets.mdx +0 -1
  38. package/src/content/{pages/docs → docs}/blocks.mdx +0 -1
  39. package/src/content/{pages/docs → docs}/collections/images.mdx +3 -2
  40. package/src/content/{pages/docs → docs}/collections/pages.mdx +0 -1
  41. package/src/content/{pages/docs → docs}/collections/presets.mdx +0 -1
  42. package/src/content/{pages/docs → docs}/collections.mdx +0 -1
  43. package/src/content/{pages/docs → docs}/components/_card.mdx +0 -2
  44. package/src/content/{pages/docs → docs}/components/_dialog.mdx +0 -2
  45. package/src/content/{pages/docs → docs}/components/_drawer.mdx +0 -2
  46. package/src/content/{pages/docs → docs}/components/_localeswitcher.mdx +0 -2
  47. package/src/content/{pages/docs → docs}/components/_switch.mdx +0 -2
  48. package/src/content/{pages/docs → docs}/components/_tagline.mdx +0 -2
  49. package/src/content/{pages/docs → docs}/components/_toggle.mdx +0 -2
  50. package/src/content/{pages/docs → docs}/components/avatar.mdx +0 -2
  51. package/src/content/{pages/docs → docs}/components/badge.mdx +0 -2
  52. package/src/content/{pages/docs → docs}/components/badges.mdx +0 -2
  53. package/src/content/{pages/docs → docs}/components/button.mdx +0 -2
  54. package/src/content/{pages/docs → docs}/components/buttons.mdx +0 -2
  55. package/src/content/{pages/docs → docs}/components/channel.mdx +0 -2
  56. package/src/content/{pages/docs → docs}/components/channels.mdx +0 -2
  57. package/src/content/{pages/docs → docs}/components/checkbox.mdx +0 -2
  58. package/src/content/{pages/docs → docs}/components/code.mdx +0 -2
  59. package/src/content/{pages/docs → docs}/components/heading.mdx +0 -2
  60. package/src/content/{pages/docs → docs}/components/icon.mdx +0 -2
  61. package/src/content/{pages/docs → docs}/components/image.mdx +0 -2
  62. package/src/content/{pages/docs → docs}/components/input.mdx +0 -2
  63. package/src/content/{pages/docs → docs}/components/label.mdx +0 -2
  64. package/src/content/{pages/docs → docs}/components/lead.mdx +0 -2
  65. package/src/content/{pages/docs → docs}/components/link.mdx +0 -2
  66. package/src/content/{pages/docs → docs}/components/links.mdx +0 -2
  67. package/src/content/{pages/docs → docs}/components/list.mdx +0 -2
  68. package/src/content/{pages/docs → docs}/components/logo.mdx +0 -2
  69. package/src/content/{pages/docs → docs}/components/menu.mdx +0 -2
  70. package/src/content/{pages/docs → docs}/components/paragraph.mdx +0 -2
  71. package/src/content/{pages/docs → docs}/components/prose.mdx +0 -2
  72. package/src/content/{pages/docs → docs}/components/rating.mdx +0 -2
  73. package/src/content/{pages/docs → docs}/components/section.mdx +0 -2
  74. package/src/content/{pages/docs → docs}/components/select.mdx +0 -2
  75. package/src/content/{pages/docs → docs}/components/social.mdx +0 -2
  76. package/src/content/{pages/docs → docs}/components/socials.mdx +0 -2
  77. package/src/content/{pages/docs → docs}/components/switch.mdx +0 -2
  78. package/src/content/{pages/docs → docs}/components/table.mdx +0 -2
  79. package/src/content/{pages/docs → docs}/components/tagline.mdx +0 -2
  80. package/src/content/{pages/docs → docs}/components/textarea.mdx +0 -2
  81. package/src/content/{pages/docs → docs}/components/themer.mdx +0 -2
  82. package/src/content/{pages/docs → docs}/components.mdx +0 -1
  83. package/src/content/{pages/docs → docs}/customization.mdx +0 -1
  84. package/src/content/{pages/docs → docs}/frameworks.mdx +0 -1
  85. package/src/content/{pages/docs → docs}/generating-pages.mdx +0 -1
  86. package/src/content/{pages/docs → docs}/index.mdx +0 -1
  87. package/src/content/{pages/docs → docs}/installation.mdx +0 -1
  88. package/src/content/{pages/docs → docs}/layouts.mdx +0 -1
  89. package/src/content/layouts/base.yml +101 -0
  90. package/src/content/layouts/docs.yml +70 -0
  91. package/src/content/pages/blocks/_categories.mdx +0 -2
  92. package/src/content/pages/blocks/_footer.mdx +0 -2
  93. package/src/content/pages/blocks/_header.mdx +0 -2
  94. package/src/content/pages/blocks/_jobs.mdx +0 -2
  95. package/src/content/pages/blocks/_prices.mdx +0 -2
  96. package/src/content/pages/blocks/_product.mdx +0 -2
  97. package/src/content/pages/blocks/_products.mdx +0 -2
  98. package/src/content/pages/blocks/_stats.mdx +0 -2
  99. package/src/content/pages/blocks/banner.mdx +0 -2
  100. package/src/content/pages/blocks/colleagues.mdx +0 -2
  101. package/src/content/pages/blocks/contact.mdx +0 -2
  102. package/src/content/pages/blocks/content.mdx +0 -2
  103. package/src/content/pages/blocks/cta.mdx +0 -2
  104. package/src/content/pages/blocks/features.mdx +0 -2
  105. package/src/content/pages/blocks/hero.mdx +0 -2
  106. package/src/content/pages/blocks/intro.mdx +0 -2
  107. package/src/content/pages/blocks/posts.mdx +0 -2
  108. package/src/content/pages/blocks/reviews.mdx +0 -2
  109. package/src/content/pages/index.mdx +0 -2
  110. package/src/content/pages/showcase/anti-slip-profiles.md +2 -2
  111. package/src/content/pages/showcase/fulldev-ui.md +1 -1
  112. package/src/content/pages/showcase/lavis-detailing.md +1 -1
  113. package/src/content/pages/showcase/leren-trainingsacteren.md +1 -1
  114. package/src/content/pages/showcase/miele-witgoedcenter-amsterdam.md +1 -1
  115. package/src/content/pages/showcase/sloepverhuur-bolsward.md +1 -1
  116. package/src/content/pages/showcase/stark-vulcanising-products.md +1 -1
  117. package/src/content/pages/showcase/the-gym-haren.md +1 -1
  118. package/src/content/pages/showcase/van-dillen-antieke-bouwmaterialen.md +1 -1
  119. package/src/content/pages/showcase.mdx +0 -1
  120. package/src/content/products/product.md +20 -0
  121. package/src/env.d.ts +1 -0
  122. package/src/integration/index.ts +20 -8
  123. package/src/layouts/CategoryLayout.astro +12 -17
  124. package/src/layouts/DocLayout.astro +17 -0
  125. package/src/layouts/Layout.astro +11 -40
  126. package/src/layouts/PageLayout.astro +6 -12
  127. package/src/layouts/PostLayout.astro +6 -12
  128. package/src/layouts/ProductLayout.astro +28 -33
  129. package/src/pages/[...category].astro +17 -0
  130. package/src/pages/[...doc].astro +17 -0
  131. package/src/pages/[...page].astro +6 -25
  132. package/src/pages/[...post].astro +17 -0
  133. package/src/pages/[...product].astro +17 -0
  134. package/src/pages/test.astro +1 -16
  135. package/src/schemas/archive/_pageSchema.ts +94 -0
  136. package/src/schemas/categorySchema.ts +16 -0
  137. package/src/schemas/components/banner.ts +3 -0
  138. package/src/schemas/components/card.ts +1 -1
  139. package/src/schemas/components/footer.ts +1 -0
  140. package/src/schemas/components/header.ts +1 -0
  141. package/src/schemas/components/link.ts +21 -14
  142. package/src/schemas/components/section.ts +2 -0
  143. package/src/schemas/components/sections.ts +1 -1
  144. package/src/schemas/components/sidebar.ts +1 -0
  145. package/src/schemas/components/subheader.ts +1 -0
  146. package/src/schemas/components/writeup.ts +1 -1
  147. package/src/schemas/docSchema.ts +10 -0
  148. package/src/schemas/fields/categories.ts +3 -0
  149. package/src/schemas/fields/description.ts +3 -0
  150. package/src/schemas/fields/href.ts +3 -0
  151. package/src/schemas/fields/image.ts +24 -0
  152. package/src/schemas/fields/images.ts +4 -0
  153. package/src/schemas/fields/order.ts +3 -0
  154. package/src/schemas/fields/price.ts +3 -0
  155. package/src/schemas/fields/products.ts +5 -0
  156. package/src/schemas/fields/seo.ts +12 -0
  157. package/src/schemas/fields/soldout.ts +3 -0
  158. package/src/schemas/{components/price.ts → fields/title.ts} +1 -1
  159. package/src/schemas/fields/variants.ts +3 -0
  160. package/src/schemas/layoutSchema.ts +28 -0
  161. package/src/schemas/pageSchema.ts +12 -86
  162. package/src/schemas/postSchema.ts +16 -0
  163. package/src/schemas/productSchema.ts +22 -0
  164. package/src/stores/cart.svelte.ts +79 -0
  165. package/src/stores/cart.ts +59 -6
  166. package/src/utils/formatEntries.ts +8 -0
  167. package/src/utils/formatEntry.ts +29 -0
  168. package/src/utils/getHref.ts +22 -0
  169. package/svelte.config.js +5 -0
  170. package/src/content/presets/base.yml +0 -100
  171. package/src/content/presets/docs.yml +0 -6
  172. package/src/schemas/components/images.ts +0 -4
  173. package/src/schemas/presetSchema.ts +0 -3
  174. package/src/schemas/utils/categories.ts +0 -3
  175. package/src/schemas/utils/navigation.ts +0 -8
@@ -1,30 +1,28 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
2
+ import type { CollectionEntry } from 'astro:content'
3
3
  import { getCollection } from 'astro:content'
4
4
  import Intro from 'fulldev-ui/blocks/Intro.astro'
5
5
  import Products from 'fulldev-ui/blocks/Products.astro'
6
6
  import Carousel from 'fulldev-ui/components/Carousel.astro'
7
7
  import Element from 'fulldev-ui/components/Element.astro'
8
8
  import Prose from 'fulldev-ui/components/Prose.astro'
9
- import Sections from 'fulldev-ui/components/sections.astro'
10
9
  import Select from 'fulldev-ui/components/Select.astro'
11
10
  import Layout from 'fulldev-ui/layouts/Layout.astro'
11
+ import { getHref } from 'fulldev-ui/utils/getHref'
12
12
 
13
- type Props = ComponentProps<typeof Layout>
13
+ type Props = CollectionEntry<'categories'>
14
14
 
15
- const { slug, sections, title, image, images, description, render } =
16
- Astro.props
15
+ const { render, slug } = Astro.props
16
+ const { title, description } = Astro.props.data
17
17
 
18
- const children = await getCollection('pages', (page) =>
19
- page.data.categories?.some((c: any) => c.slug.includes(slug))
18
+ const categories = await getCollection('categories', ({ data }) =>
19
+ data.categories?.some((c) => c.slug.includes(slug))
20
20
  )
21
21
 
22
- const categories = children?.filter(
23
- (c) => c.data.component === 'CategoryLayout'
22
+ const products = await getCollection('products', ({ data }) =>
23
+ data.categories?.some((c) => c.slug.includes(slug))
24
24
  )
25
25
 
26
- const products = children?.filter((c) => c.data.component === 'ProductLayout')
27
-
28
26
  const sorts = [
29
27
  {
30
28
  option: 'Aanbevolen',
@@ -76,7 +74,6 @@ const sorts = [
76
74
  <Intro
77
75
  heading={title}
78
76
  paragraph={description}
79
- image={image || images?.[0]}
80
77
  />
81
78
  <Carousel>
82
79
  {
@@ -84,7 +81,7 @@ const sorts = [
84
81
  <Element
85
82
  as="a"
86
83
  class:list="item"
87
- href={`/${category.slug}/`}
84
+ href={getHref('categories', category.slug)}
88
85
  >
89
86
  {category.data.title}
90
87
  </Element>
@@ -101,16 +98,14 @@ const sorts = [
101
98
  />
102
99
  </Element>
103
100
  {
104
- sorts.map((sort) => (
101
+ sorts.map((sort: any) => (
105
102
  <Products
106
103
  class:list={sort.option !== 'Aanbevolen' ? 'hide' : ''}
107
- id={sort.option}
108
- cards={sort.products}
104
+ products={sort.products}
109
105
  />
110
106
  ))
111
107
  }
112
108
  <Prose {render} />
113
- <Sections {sections} />
114
109
  <slot />
115
110
  </Layout>
116
111
 
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { CollectionEntry } from 'astro:content'
3
+ import Prose from 'fulldev-ui/components/Prose.astro'
4
+ import Layout from 'fulldev-ui/layouts/Layout.astro'
5
+
6
+ type Props = CollectionEntry<'docs'>
7
+
8
+ const { render } = Astro.props
9
+ ---
10
+
11
+ <Layout>
12
+ <Prose
13
+ {render}
14
+ toc={true}
15
+ />
16
+ <slot />
17
+ </Layout>
@@ -1,5 +1,6 @@
1
1
  ---
2
- import type { ComponentProps, HTMLAttributes } from 'astro/types'
2
+ import type { CollectionEntry, ContentCollectionKey } from 'astro:content'
3
+ import { getEntry } from 'astro:content'
3
4
  import Banner from 'fulldev-ui/blocks/Banner.astro'
4
5
  import Footer from 'fulldev-ui/blocks/Footer.astro'
5
6
  import Element from 'fulldev-ui/components/Element.astro'
@@ -8,49 +9,19 @@ import Header from 'fulldev-ui/components/Header.astro'
8
9
  import Sidebar from 'fulldev-ui/components/Sidebar.astro'
9
10
  import Subheader from 'fulldev-ui/components/Subheader.astro'
10
11
 
11
- type Props = HTMLAttributes<'html'> & {
12
- banner?: ComponentProps<typeof Banner>['text'] | undefined
13
- header?: ComponentProps<typeof Header> | undefined
14
- subheader?: ComponentProps<typeof Subheader> | undefined
15
- sidebar?: ComponentProps<typeof Sidebar> | undefined
16
- footer?: ComponentProps<typeof Footer> | undefined
17
- theme?: 'light' | 'dark' | 'system' | undefined
18
- title?: string
19
- code?: {
20
- head?: string
21
- body?: string
22
- }
23
- description?: string
24
- image?: any
25
- seo?: {
26
- title?: string
27
- description?: string
28
- image?: string
29
- }
30
- next?: string
31
- prev?: string
32
- }
12
+ type Props = CollectionEntry<ContentCollectionKey>
33
13
 
34
- const {
35
- banner,
36
- header,
37
- subheader,
38
- sidebar,
39
- footer,
40
- theme,
41
- code,
42
- next,
43
- prev,
44
- ...rest
45
- } = Astro.props
14
+ const layout = await getEntry('layouts', 'base')
15
+
16
+ const { banner, header, subheader, sidebar, footer, theme, code } = layout.data
46
17
  ---
47
18
 
48
19
  <!doctype html>
49
- <html
50
- class="layout"
51
- {...rest}
52
- >
53
- <Head {...Astro.props} />
20
+ <html class="layout">
21
+ <Head
22
+ {...layout.data}
23
+ {...Astro.props.data}
24
+ />
54
25
  <Element
55
26
  class:list="layout-body"
56
27
  as="body"
@@ -1,25 +1,19 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Hero from 'fulldev-ui/blocks/Hero.astro'
2
+ import type { CollectionEntry } from 'astro:content'
4
3
  import Prose from 'fulldev-ui/components/Prose.astro'
5
4
  import Sections from 'fulldev-ui/components/sections.astro'
6
5
  import Layout from 'fulldev-ui/layouts/Layout.astro'
7
6
 
8
- interface Props
9
- extends ComponentProps<typeof Layout>,
10
- ComponentProps<typeof Prose> {
11
- hero?: ComponentProps<typeof Hero>
12
- sections?: ComponentProps<typeof Sections>['sections']
13
- }
7
+ type Props = CollectionEntry<'pages'>
14
8
 
15
- const { hero, render, toc, sections, ...rest } = Astro.props
9
+ const { render } = Astro.props
10
+ const { sections } = Astro.props.data
16
11
  ---
17
12
 
18
- <Layout {...rest}>
19
- <Hero {...hero} />
13
+ <Layout {...Astro.props}>
20
14
  <Prose
21
15
  {render}
22
- {toc}
16
+ toc={false}
23
17
  />
24
18
  <Sections {sections} />
25
19
  <slot />
@@ -1,25 +1,19 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Hero from 'fulldev-ui/blocks/Hero.astro'
2
+ import type { CollectionEntry } from 'astro:content'
4
3
  import Prose from 'fulldev-ui/components/Prose.astro'
5
4
  import Sections from 'fulldev-ui/components/sections.astro'
6
5
  import Layout from 'fulldev-ui/layouts/Layout.astro'
7
6
 
8
- interface Props
9
- extends ComponentProps<typeof Layout>,
10
- ComponentProps<typeof Prose> {
11
- hero?: ComponentProps<typeof Hero>
12
- sections?: ComponentProps<typeof Sections>['sections']
13
- }
7
+ type Props = CollectionEntry<'posts'>
14
8
 
15
- const { hero, render, toc, sections, ...rest } = Astro.props
9
+ const { render } = Astro.props
10
+ const { sections } = Astro.props.data
16
11
  ---
17
12
 
18
- <Layout {...rest}>
19
- <Hero {...hero} />
13
+ <Layout {...Astro.props}>
20
14
  <Prose
21
15
  {render}
22
- {toc}
16
+ toc={true}
23
17
  />
24
18
  <Sections {sections} />
25
19
  <slot />
@@ -1,35 +1,22 @@
1
1
  ---
2
2
  import { getImage } from 'astro:assets'
3
- import CartForm from 'fulldev-ui/components/CartForm.astro'
3
+ import type { CollectionEntry } from 'astro:content'
4
+ import { getCollection, getEntry } from 'astro:content'
5
+ import Products from 'fulldev-ui/blocks/Products.astro'
6
+ import CartForm from 'fulldev-ui/components/CartForm.svelte'
4
7
  import Element from 'fulldev-ui/components/Element.astro'
5
8
  import Gallery from 'fulldev-ui/components/Gallery.astro'
6
9
  import Heading from 'fulldev-ui/components/Heading.astro'
7
10
  import List from 'fulldev-ui/components/List.astro'
8
11
  import Paragraph from 'fulldev-ui/components/Paragraph.astro'
9
12
  import Prose from 'fulldev-ui/components/Prose.astro'
10
- import Sections from 'fulldev-ui/components/sections.astro'
11
13
  import Layout from 'fulldev-ui/layouts/Layout.astro'
12
14
 
13
- const {
14
- variant = 1,
15
- level = 1,
16
- heading,
17
- paragraph,
18
- title,
19
- list,
20
- price,
21
- images,
22
- text,
23
- subheading,
24
- variants,
25
- button,
26
- description,
27
- form,
28
- uitverkocht,
29
- render,
30
- sections,
31
- banner,
32
- } = Astro.props
15
+ type Props = CollectionEntry<'products'>
16
+
17
+ const { render } = Astro.props
18
+ const { title, price, images, description, soldout, categories, variants } =
19
+ Astro.props.data
33
20
 
34
21
  const slug = Astro.url.pathname.replace(/^\/|\/$/g, '') || 'index'
35
22
  const imageId = images?.[0]?.id
@@ -38,6 +25,14 @@ const allImages = import.meta.glob<{ default: ImageMetadata }>('/src/images/*')
38
25
  const foundImage = allImages[src]
39
26
  const gotImage =
40
27
  imageId && (await getImage({ src: foundImage ? foundImage() : src }))
28
+
29
+ const relatedProducts = await getCollection('products', (product) =>
30
+ product.data.categories?.some((category) =>
31
+ categories?.map((c) => c.slug).includes(category.slug)
32
+ )
33
+ )
34
+
35
+ const baseLayout = await getEntry('layouts', 'base')
41
36
  ---
42
37
 
43
38
  <Layout {...Astro.props}>
@@ -53,27 +48,27 @@ const gotImage =
53
48
  <Element class:list="product-segment">
54
49
  <Element class:list="product-content">
55
50
  <Heading
56
- {level}
57
- text={heading || title}
51
+ as="h1"
52
+ level={2}
53
+ text={title}
58
54
  />
59
- <Paragraph text={paragraph || description} />
55
+ <Paragraph text={description} />
60
56
  </Element>
61
57
  <CartForm
62
- soldout={uitverkocht}
63
- image={gotImage?.src}
64
- {title}
65
- {price}
66
- {slug}
67
- {variants}
58
+ product={Astro.props}
59
+ client:load
68
60
  />
69
61
  <List
70
62
  size="sm"
71
- items={banner.split('|')}
63
+ items={baseLayout.data.banner?.split('|')}
72
64
  />
73
65
  </Element>
74
66
  </Element>
75
67
  </Element>
76
- <Sections {sections} />
68
+ <Products
69
+ heading="Gerelateerde producten"
70
+ products={[...relatedProducts].sort(() => Math.random() - 0.5).slice(0, 6)}
71
+ />
77
72
  <slot />
78
73
  </Layout>
79
74
 
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { getCollection } from 'astro:content'
3
+ import CategoryLayout from 'fulldev-ui/layouts/CategoryLayout.astro'
4
+ import { getHref } from 'fulldev-ui/utils/getHref.ts'
5
+
6
+ export async function getStaticPaths() {
7
+ const collection = await getCollection('categories')
8
+ return collection.map((entry) => ({
9
+ params: {
10
+ category: getHref(entry.collection, entry.slug),
11
+ },
12
+ props: entry,
13
+ }))
14
+ }
15
+ ---
16
+
17
+ <CategoryLayout {...Astro.props} />
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { getCollection } from 'astro:content'
3
+ import DocLayout from 'fulldev-ui/layouts/DocLayout.astro'
4
+ import { getHref } from 'fulldev-ui/utils/getHref.ts'
5
+
6
+ export async function getStaticPaths() {
7
+ const collection = await getCollection('docs')
8
+ return collection.map((entry) => ({
9
+ params: {
10
+ doc: getHref(entry.collection, entry.slug),
11
+ },
12
+ props: entry,
13
+ }))
14
+ }
15
+ ---
16
+
17
+ <DocLayout {...Astro.props} />
@@ -1,36 +1,17 @@
1
1
  ---
2
2
  import { getCollection } from 'astro:content'
3
3
  import PageLayout from 'fulldev-ui/layouts/PageLayout.astro'
4
+ import { getHref } from 'fulldev-ui/utils/getHref.ts'
4
5
 
5
6
  export async function getStaticPaths() {
6
- const pages = await getCollection('pages')
7
- return pages.map((page) => ({
7
+ const collection = await getCollection('pages')
8
+ return collection.map((entry) => ({
8
9
  params: {
9
- page: page.slug === 'index' ? undefined : page.slug,
10
+ page: getHref(entry.collection, entry.slug),
10
11
  },
11
- props: page,
12
+ props: entry,
12
13
  }))
13
14
  }
14
-
15
- const { data, ...rest } = Astro.props
16
- const { component, ...restData } = data
17
-
18
- const layouts = {
19
- ...import.meta.glob('/src/layouts/**/*.astro'),
20
- ...import.meta.glob('../layouts/**/*.astro'),
21
- }
22
-
23
- const componentPath = Object.keys(layouts).find((path) => {
24
- const strip = (str?: string) => str?.split('/').pop()?.split('.')[0]
25
- return strip(path) === strip(component)
26
- })
27
-
28
- const Component =
29
- (componentPath && (await (layouts[componentPath] as any)()).default) ??
30
- PageLayout
31
15
  ---
32
16
 
33
- <Component
34
- {...restData}
35
- {...rest}
36
- />
17
+ <PageLayout {...Astro.props} />
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { getCollection } from 'astro:content'
3
+ import PostLayout from 'fulldev-ui/layouts/PostLayout.astro'
4
+ import { getHref } from 'fulldev-ui/utils/getHref.ts'
5
+
6
+ export async function getStaticPaths() {
7
+ const collection = await getCollection('posts')
8
+ return collection.map((entry) => ({
9
+ params: {
10
+ post: getHref(entry.collection, entry.slug),
11
+ },
12
+ props: entry,
13
+ }))
14
+ }
15
+ ---
16
+
17
+ <PostLayout {...Astro.props} />
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { getCollection } from 'astro:content'
3
+ import ProductLayout from 'fulldev-ui/layouts/ProductLayout.astro'
4
+ import { getHref } from 'fulldev-ui/utils/getHref.ts'
5
+
6
+ export async function getStaticPaths() {
7
+ const collection = await getCollection('products')
8
+ return collection.map((entry) => ({
9
+ params: {
10
+ product: getHref(entry.collection, entry.slug),
11
+ },
12
+ props: entry,
13
+ }))
14
+ }
15
+ ---
16
+
17
+ <ProductLayout {...Astro.props} />
@@ -1,20 +1,5 @@
1
1
  ---
2
- import Product from 'fulldev-ui/blocks/Product.astro'
3
2
  import Layout from 'fulldev-ui/layouts/Layout.astro'
4
-
5
- const product = {
6
- images: [
7
- '/src/images/placeholder-right.webp',
8
- '/src/images/placeholder-right.webp',
9
- '/src/images/placeholder-right.webp',
10
- '/src/images/placeholder-right.webp',
11
- '/src/images/placeholder-right.webp',
12
- ],
13
- title: 'Hello world',
14
- description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
15
- }
16
3
  ---
17
4
 
18
- <Layout>
19
- <Product {...product} />
20
- </Layout>
5
+ <Layout />
@@ -0,0 +1,94 @@
1
+ // import { getEntries, getEntry, z } from 'astro:content'
2
+ // import { assign } from 'radash'
3
+ // import footer from '../components/footer'
4
+ // import header from '../components/header'
5
+ // import image from '../components/image'
6
+ // import section from '../components/section'
7
+ // import sections from '../components/sections'
8
+ // import sidebar from '../components/sidebar'
9
+ // import subheader from '../components/subheader'
10
+ // import toc from '../components/toc'
11
+ // import images from '../fields/images'
12
+ // import price from '../fields/price'
13
+ // import component from '../utils/component'
14
+ // import navigation from '../utils/navigation'
15
+ // import pathSchema from '../utils/pathSchema'
16
+ // import categories from './utils/categories'
17
+
18
+ // export const i18n = z
19
+ // .object({
20
+ // i18n: pathSchema('pages').optional(),
21
+ // })
22
+ // .passthrough()
23
+ // .transform(async ({ i18n, ...rest }) => {
24
+ // if (!i18n) return rest
25
+ // const entry = await getEntry(i18n)
26
+ // const merged = assign(entry.data, rest) as typeof rest
27
+ // return merged as typeof rest
28
+ // })
29
+
30
+ // export const presets = z
31
+ // .object({
32
+ // presets: z.array(pathSchema('presets')).optional(),
33
+ // })
34
+ // .passthrough()
35
+ // .transform(async ({ presets, ...rest }) => {
36
+ // let mergedData = {}
37
+
38
+ // const baseEntry = await getEntry('presets', 'base')
39
+ // mergedData = assign(mergedData, baseEntry?.data || {})
40
+
41
+ // if (presets) {
42
+ // const entries = await getEntries(presets)
43
+ // entries.forEach(
44
+ // (preset: any) => (mergedData = assign(mergedData, preset.data))
45
+ // )
46
+ // }
47
+
48
+ // mergedData = assign(mergedData, rest)
49
+ // return mergedData as typeof rest
50
+ // })
51
+
52
+ // export const page = z
53
+ // .object({
54
+ // component,
55
+ // categories,
56
+ // order: z.number().optional(),
57
+ // theme: z.enum(['light', 'dark', 'system']),
58
+ // lang: z.string(),
59
+ // seo: z
60
+ // .object({
61
+ // title: z.string().optional(),
62
+ // description: z.string().optional(),
63
+ // })
64
+ // .optional(),
65
+ // title: z.string(),
66
+ // description: z.string().optional(),
67
+ // paragraph: z.string().optional(),
68
+ // image,
69
+ // images,
70
+ // section,
71
+ // sections,
72
+ // footer,
73
+ // header,
74
+ // sidebar,
75
+ // subheader,
76
+ // navigation,
77
+ // toc,
78
+ // price,
79
+ // code: z.any(),
80
+ // sizes: z.any(),
81
+ // banner: z.any(),
82
+ // _schema: z.any(),
83
+ // uitverkocht: z.any(),
84
+ // rating: z.any(),
85
+ // variants: z.any(),
86
+ // heading: z.any(),
87
+ // href: z.any(),
88
+ // next: z.any(),
89
+ // prev: z.any(),
90
+ // })
91
+ // .partial()
92
+ // .strict()
93
+
94
+ // export default i18n.pipe(presets).pipe(page)
@@ -0,0 +1,16 @@
1
+ import { z } from 'astro:content'
2
+ import categories from 'fulldev-ui/schemas/fields/categories'
3
+ import description from 'fulldev-ui/schemas/fields/description'
4
+ import image from 'fulldev-ui/schemas/fields/image'
5
+ import title from 'fulldev-ui/schemas/fields/title'
6
+
7
+ export const categorySchema = z
8
+ .object({
9
+ title,
10
+ description,
11
+ image,
12
+ categories,
13
+ })
14
+ .strict()
15
+
16
+ export type CategorySchema = z.infer<typeof categorySchema>
@@ -0,0 +1,3 @@
1
+ import { z } from 'astro:content'
2
+
3
+ export default z.string().optional()
@@ -1,11 +1,11 @@
1
1
  import { z } from 'astro:content'
2
+ import images from '../fields/images'
2
3
  import pathSchema from '../utils/pathSchema'
3
4
  import button from './button'
4
5
  import buttons from './buttons'
5
6
  import globalSchema from './global'
6
7
  import icon from './icon'
7
8
  import image from './image'
8
- import images from './images'
9
9
 
10
10
  export const cardSchema = z
11
11
  .union([pathSchema('pages'), z.object({}).passthrough()])
@@ -15,3 +15,4 @@ export default z
15
15
  })
16
16
  .partial()
17
17
  .passthrough()
18
+ .optional()
@@ -17,3 +17,4 @@ export default z
17
17
  })
18
18
  .partial()
19
19
  .passthrough()
20
+ .optional()
@@ -1,16 +1,23 @@
1
1
  import { z } from 'astro:content'
2
- import pathSchema from '../utils/pathSchema'
3
2
 
4
- export default z.union([pathSchema('pages'), z.object({}).passthrough()]).pipe(
5
- z
6
- .object({
7
- slug: z
8
- .string()
9
- .refine(async (data) => await pathSchema('pages').parseAsync(data)),
10
- text: z.string(),
11
- href: z.string(),
12
- icon: z.string(),
13
- })
14
- .partial()
15
- .passthrough()
16
- )
3
+ // export default z.union([pathSchema('pages'), z.object({}).passthrough()]).pipe(
4
+ // z
5
+ // .object({
6
+ // slug: z
7
+ // .string()
8
+ // .refine(async (data) => await pathSchema('pages').parseAsync(data)),
9
+ // text: z.string(),
10
+ // href: z.string(),
11
+ // icon: z.string(),
12
+ // })
13
+ // .partial()
14
+ // .passthrough()
15
+ // )
16
+
17
+ export default z
18
+ .object({
19
+ text: z.string().optional(),
20
+ href: z.string().optional(),
21
+ })
22
+ .strict()
23
+ .optional()
@@ -1,3 +1,4 @@
1
+ import { reference } from 'astro:content'
1
2
  import component from '../utils/component'
2
3
  import buttons from './buttons'
3
4
  import cards from './cards'
@@ -10,6 +11,7 @@ export default writeup
10
11
  image,
11
12
  buttons,
12
13
  cards,
14
+ products: reference('products').array().optional(),
13
15
  })
14
16
  .partial()
15
17
  .passthrough()
@@ -1,3 +1,3 @@
1
1
  import section from './section'
2
2
 
3
- export default section.array()
3
+ export default section.array().optional()
@@ -13,3 +13,4 @@ export default z
13
13
  })
14
14
  .partial()
15
15
  .passthrough()
16
+ .optional()