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.
Files changed (91) hide show
  1. package/CONTRIBUTING.md +10 -4
  2. package/astro.config.ts +4 -11
  3. package/package.json +5 -3
  4. package/pnpm-lock.yaml +6400 -0
  5. package/src/blocks/Article.astro +31 -12
  6. package/src/blocks/Banner.astro +2 -1
  7. package/src/blocks/Contact.astro +7 -30
  8. package/src/blocks/Excerpt.astro +14 -0
  9. package/src/blocks/Intro.astro +3 -1
  10. package/src/blocks/Product.astro +55 -22
  11. package/src/components/Card.astro +11 -5
  12. package/src/components/Cart.astro +38 -0
  13. package/src/components/CartForm.astro +121 -0
  14. package/src/components/CartList.astro +134 -0
  15. package/src/components/CartSummary.astro +147 -0
  16. package/src/components/Drawer.astro +128 -52
  17. package/src/components/Footer.astro +6 -3
  18. package/src/components/Form.astro +49 -0
  19. package/src/components/Header.astro +19 -14
  20. package/src/components/Image.astro +0 -1
  21. package/src/components/Input.astro +6 -0
  22. package/src/components/Menu.astro +56 -0
  23. package/src/components/Price.astro +7 -11
  24. package/src/components/Search.astro +1 -4
  25. package/src/components/Section.astro +2 -1
  26. package/src/components/Sidebar.astro +66 -105
  27. package/src/components/Social.astro +7 -0
  28. package/src/components/ThemeSelect.astro +3 -0
  29. package/src/components/Toc.astro +33 -94
  30. package/src/components/docs/PropsTable.astro +2 -2
  31. package/src/components/experimental/Form.astro +31 -5
  32. package/src/components/experimental/Gallery.astro +50 -126
  33. package/src/components/experimental/Prose.astro +32 -0
  34. package/src/content/pages/base/select.mdx +0 -8
  35. package/src/content/pages/base/textarea.mdx +0 -5
  36. package/src/content/pages/blocks/_product.mdx +73 -2
  37. package/src/content/pages/index.mdx +0 -3
  38. package/src/content/pages/layouts/_layout.mdx +14 -0
  39. package/src/content/pages/layouts/docslayout.mdx +10 -1
  40. package/src/content/pages/overview/components.mdx +5 -0
  41. package/src/content/pages/overview/content-collections.mdx +139 -0
  42. package/src/content/pages/overview/installation.mdx +25 -26
  43. package/src/content/pages/overview/introduction.mdx +16 -10
  44. package/src/content/pages/overview/theming.mdx +69 -0
  45. package/src/content/pages/schemas/page.mdx +6 -0
  46. package/src/content/presets/base.yml +57 -44
  47. package/src/content/presets/blocks.yml +0 -3
  48. package/src/content/presets/docs.yml +3 -62
  49. package/src/env.d.ts +1 -1
  50. package/src/integration/index.ts +49 -33
  51. package/src/layouts/DocsLayout.astro +23 -35
  52. package/src/layouts/Layout.astro +37 -21
  53. package/src/layouts/OverviewLayout.astro +17 -10
  54. package/src/layouts/PostLayout.astro +7 -7
  55. package/src/layouts/ProductLayout.astro +5 -2
  56. package/src/schemas/components/footer.ts +1 -0
  57. package/src/schemas/components/header.ts +1 -0
  58. package/src/schemas/components/menu.ts +13 -0
  59. package/src/schemas/components/sidebar.ts +15 -0
  60. package/src/schemas/components/toc.ts +3 -0
  61. package/src/schemas/pageSchema.ts +72 -34
  62. package/src/schemas/presetSchema.ts +2 -28
  63. package/src/schemas/utils/navigation.ts +6 -51
  64. package/src/stores/cart.ts +23 -0
  65. package/src/utils/cart.ts +36 -0
  66. package/src/utils/{getChildPages.ts → getFolderChildren.ts} +3 -1
  67. package/src/utils/{getCategoryPages.ts → getReferenceChildren.ts} +6 -3
  68. package/tsconfig.json +1 -3
  69. package/.astro/assets.mjs +0 -1
  70. package/.astro/astro/content.d.ts +0 -547
  71. package/.astro/collections/blocks.schema.json +0 -851
  72. package/.astro/collections/collections.json +0 -63
  73. package/.astro/collections/images.schema.json +0 -22
  74. package/.astro/collections/layouts.schema.json +0 -826
  75. package/.astro/collections/pages.schema.json +0 -568
  76. package/.astro/collections/presets.schema.json +0 -489
  77. package/.astro/collections/records.schema.json +0 -822
  78. package/.astro/collections/settings.schema.json +0 -822
  79. package/.astro/data-store.json +0 -1
  80. package/.astro/modules.mjs +0 -1
  81. package/.astro/settings.json +0 -5
  82. package/.astro/types.d.ts +0 -2
  83. package/src/components/experimental/GalleryVertical.astro +0 -161
  84. package/src/content/pages/layouts/layout.mdx +0 -21
  85. package/src/content/pages/layouts/pagelayout.mdx +0 -21
  86. package/src/content/pages/overview/content-layer.mdx +0 -128
  87. package/src/content/pages/overview/customization.mdx +0 -83
  88. package/src/layouts/ContentLayout.astro +0 -16
  89. package/src/layouts/PageLayout.astro +0 -15
  90. /package/src/schemas/utils/{categories.ts → parents.ts} +0 -0
  91. /package/src/types/{global-props.d.ts → global-props.ts} +0 -0
@@ -1,140 +1,101 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
3
- import Button from 'fulldev-ui/components/Button.astro'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
4
3
  import Element from 'fulldev-ui/components/Element.astro'
5
4
  import Logo from 'fulldev-ui/components/experimental/Logo.astro'
6
- import Heading from 'fulldev-ui/components/Heading.astro'
7
- import Search from 'fulldev-ui/components/Search.astro'
5
+ import Menu from 'fulldev-ui/components/Menu.astro'
8
6
  import ThemeSelect from 'fulldev-ui/components/ThemeSelect.astro'
9
7
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
8
+ import Heading from './Heading.astro'
9
+ import Toc from './Toc.astro'
10
10
 
11
11
  interface Props extends GlobalProps, HTMLAttributes<'aside'> {
12
- size?: 'sm' | 'md' | 'lg' | undefined
13
- search?: boolean | undefined
14
- logo?: string | undefined
15
- buttons?: any[] | undefined
16
- open?: boolean | undefined
12
+ menu?: ComponentProps<typeof Menu>['groups']
13
+ heading?: ComponentProps<typeof Heading>['text']
14
+ render?: ComponentProps<typeof Toc>['render']
15
+ logo?: ComponentProps<typeof Logo>
16
+ toc?: ComponentProps<typeof Toc>['heading']
17
+ company?: ComponentProps<typeof Logo>['company']
18
+ themeselect?: boolean | undefined
17
19
  }
18
20
 
19
- const { size = 'sm', open = false, logo, buttons, search } = Astro.props
21
+ const {
22
+ size = 'sm',
23
+ logo,
24
+ company,
25
+ render,
26
+ themeselect,
27
+ menu,
28
+ toc,
29
+ heading,
30
+ ...rest
31
+ } = Astro.props
20
32
  ---
21
33
 
22
- <input
23
- id="sidebar"
24
- class="sidebar-checkbox"
25
- type="checkbox"
26
- />
27
-
28
34
  <Element
29
35
  class:list="sidebar"
30
36
  as="aside"
31
37
  {size}
32
- {open}
38
+ {...rest}
33
39
  >
34
- <Logo {logo} />
35
- {search && <Search />}
36
- <Element class:list="buttons">
37
- {
38
- buttons?.map(({ heading, slug, href, text, buttons }) => (
39
- <>
40
- <Heading
41
- level={6}
42
- text={heading}
43
- />
44
- <Button
45
- variant="link"
46
- {slug}
47
- {href}
48
- {text}
49
- />
50
- {buttons?.map((button: any) => (
51
- <Button
52
- variant="link"
53
- {...button}
54
- />
55
- ))}
56
- </>
57
- ))
58
- }
59
- <ThemeSelect />
40
+ <Element
41
+ class:list="sidebar-header"
42
+ as="header"
43
+ >
44
+ <Logo
45
+ {company}
46
+ {...logo}
47
+ />
48
+ <Heading
49
+ level={4}
50
+ text={heading}
51
+ />
52
+ <slot name="header" />
53
+ </Element>
54
+ <Element class:list="sidebar-content">
55
+ <Menu groups={menu} />
56
+ <ThemeSelect if={themeselect} />
57
+ <slot />
60
58
  </Element>
61
59
  </Element>
62
60
 
63
61
  <style lang="scss" is:global>
64
62
  @layer fulldev {
65
- .sidebar-checkbox {
66
- display: none;
67
- }
68
-
69
- @media (max-width: 1023.999px) {
70
- body:has(.sidebar-checkbox:checked) {
71
- overflow: hidden;
72
- }
73
- }
74
-
75
63
  .sidebar {
76
- --sidebar-width: 240px;
77
-
78
64
  display: none;
79
- position: fixed;
80
- top: var(--header-height, 0px);
81
- bottom: 0;
82
- left: 0;
83
- flex-shrink: 0;
84
- flex-direction: column;
85
- justify-content: flex-start;
86
- z-index: 10;
87
- border-style: solid;
88
- border-color: var(--color-a6);
89
- background-color: var(--base-2);
90
- padding: var(--space-md-5) var(--gutter);
91
- width: 100%;
92
- height: calc(100vh - var(--header-height, 0px));
93
- overflow-y: auto;
94
-
95
- &:is(.sidebar-checkbox:checked + &) {
96
- display: flex;
97
- }
98
65
 
99
66
  @media (min-width: 1024px) {
100
- border-right-width: 1px;
101
- padding: var(--space-md-6) var(--gutter);
102
- width: var(--sidebar-width);
103
-
104
- &.open {
105
- display: flex;
106
- position: sticky;
107
- }
108
- }
109
-
110
- .buttons {
111
67
  display: flex;
68
+ position: sticky;
69
+ top: var(--header-height, 0px);
70
+ bottom: 0;
71
+ flex-shrink: 0;
112
72
  flex-direction: column;
113
- gap: calc(var(--space-4) + var(--space-1));
73
+ justify-content: flex-start;
74
+ z-index: 10;
75
+ border-right: 1px solid var(--color-a6);
76
+ width: calc(var(--space-7) * 4);
77
+ height: calc(100vh - var(--header-height, 0px));
114
78
 
115
- .theme-select {
116
- margin-top: var(--space-5);
79
+ .sidebar-header {
80
+ display: flex;
81
+ position: sticky;
82
+ align-items: center;
83
+ border-bottom: 1px solid var(--color-a6);
84
+ padding: 0 var(--gutter);
85
+ width: 100%;
86
+ height: 56px;
117
87
  }
118
88
 
119
- .button + .heading {
120
- margin-top: var(--space-5);
89
+ .sidebar-content {
90
+ display: flex;
91
+ top: 0;
92
+ flex: 1;
93
+ flex-direction: column;
94
+ padding: var(--space-md-6) var(--gutter);
95
+ width: 100%;
96
+ overflow-y: auto;
121
97
  }
122
98
  }
123
-
124
- .logo {
125
- display: none;
126
- position: absolute;
127
- top: 0;
128
- left: var(--gutter);
129
- align-items: center;
130
- height: 56px;
131
- }
132
- }
133
-
134
- @media (min-width: 1024px) {
135
- .header:not(.open) ~ .core .sidebar .logo {
136
- display: flex;
137
- }
138
99
  }
139
100
  }
140
101
  </style>
@@ -26,3 +26,10 @@ const platform = () => {
26
26
  {variant}
27
27
  {href}
28
28
  />
29
+
30
+ <style is:global lang="scss">
31
+ .social {
32
+ padding: 0 var(--space-3);
33
+ height: calc(var(--text-2) + 2 * var(--space-3));
34
+ }
35
+ </style>
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  import Select from 'fulldev-ui/components/Select.astro'
3
3
  // const defaultTheme = fulldevConfig.colors.theme || 'light'
4
+
5
+ const { ...rest } = Astro.props
4
6
  ---
5
7
 
6
8
  <Select
@@ -9,6 +11,7 @@ import Select from 'fulldev-ui/components/Select.astro'
9
11
  options={['light', 'dark']}
10
12
  value="light"
11
13
  onchange="localStorage.setItem('theme', this.value); window.location.reload();"
14
+ {...rest}
12
15
  />
13
16
 
14
17
  <script>
@@ -1,16 +1,17 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
3
  import type { CollectionEntry } from 'astro:content'
4
4
  import Button from 'fulldev-ui/components/Button.astro'
5
5
  import Element from 'fulldev-ui/components/Element.astro'
6
6
  import Heading from 'fulldev-ui/components/Heading.astro'
7
7
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
8
8
 
9
- interface Props extends GlobalProps, HTMLAttributes<'aside'> {
9
+ interface Props extends GlobalProps, HTMLAttributes<'div'> {
10
+ heading?: ComponentProps<typeof Heading>['text']
10
11
  render?: CollectionEntry<'pages'>['render'] | undefined
11
12
  }
12
13
 
13
- const { size = 'sm', render } = Astro.props
14
+ const { size = 'sm', heading, render, ...rest } = Astro.props
14
15
 
15
16
  const headings = render ? (await render())?.headings : []
16
17
  const filteredHeadings = headings?.filter(
@@ -18,114 +19,52 @@ const filteredHeadings = headings?.filter(
18
19
  )
19
20
  ---
20
21
 
21
- <input
22
- id="toc"
23
- class="toc-checkbox"
24
- type="checkbox"
25
- />
26
-
27
22
  <Element
23
+ if={filteredHeadings?.length > 1}
28
24
  class:list="toc"
29
- as="aside"
30
25
  {size}
26
+ {...rest}
31
27
  >
28
+ <Heading
29
+ level={6}
30
+ text={heading}
31
+ />
32
32
  {
33
- filteredHeadings?.length > 0 && (
34
- <>
35
- <Heading
36
- text="On this page"
37
- level={6}
38
- />
39
- <nav class="toc-nav">
40
- <Button
41
- variant="link"
42
- href={`#${filteredHeadings[0]?.slug}`}
43
- text="Overview"
44
- class="toc-link toc-link-h2"
45
- />
46
- {filteredHeadings.map((heading: any) => (
47
- <Button
48
- variant="link"
49
- href={`#${heading.slug}`}
50
- text={heading.text}
51
- class={`toc-link toc-link-h${heading.depth}`}
52
- />
53
- ))}
54
- </nav>
55
- </>
56
- )
33
+ filteredHeadings?.map((button: any) => (
34
+ <Button
35
+ class:list={`depth-${button.depth}`}
36
+ href={`#${button.slug}`}
37
+ variant="link"
38
+ text={button.text}
39
+ />
40
+ ))
57
41
  }
58
42
  </Element>
59
43
 
60
44
  <style lang="scss" is:global>
61
45
  @layer fulldev {
62
- .toc-checkbox {
63
- display: none;
64
- }
65
-
66
- @media (max-width: 1023.999px) {
67
- body:has(.toc-checkbox:checked) {
68
- overflow: hidden;
69
- }
70
- }
71
-
72
46
  .toc {
73
- --toc-width: 240px;
74
-
75
47
  display: none;
76
- position: fixed;
77
- top: var(--header-height, 0px);
78
- right: 0;
79
- flex-shrink: 0;
80
- flex-direction: column;
81
- justify-content: flex-start;
82
- gap: calc(var(--space-4) + var(--space-1));
83
- z-index: 10;
84
- border-left-width: 1px;
85
- border-style: solid;
86
- border-color: var(--color-a6);
87
- background-color: var(--color-background);
88
- padding: var(--space-md-6) var(--gutter);
89
- width: 100%;
90
- max-height: calc(100vh - var(--header-height, 0px));
91
- overflow-y: auto;
92
-
93
- &:is(.toc-checkbox:checked + &) {
94
- display: flex;
95
- }
96
48
 
97
49
  @media (min-width: 1024px) {
98
50
  display: flex;
99
51
  position: sticky;
100
- border-left-width: 1px;
101
- width: var(--toc-width);
102
- }
103
-
104
- .button + .heading {
105
- margin-top: var(--space-5);
106
- }
107
-
108
- .toc-nav {
109
- display: flex;
52
+ top: calc(var(--header-height, 0px) + var(--space-6));
53
+ bottom: 0;
54
+ flex-shrink: 0;
110
55
  flex-direction: column;
111
- }
112
-
113
- .toc-link {
114
- text-align: left;
115
- }
116
-
117
- .toc-link-h2 {
118
- margin-top: var(--space-3);
119
- }
120
-
121
- .toc-link-h3 {
122
- margin-top: var(--space-3);
123
- margin-left: var(--space-4);
124
- }
125
-
126
- .toc-link-h4 {
127
- margin-top: var(--space-2);
128
- margin-left: var(--space-5);
56
+ justify-content: flex-start;
57
+ gap: var(--space-4);
58
+ z-index: 10;
59
+ min-width: calc(var(--space-7) * 3);
60
+
61
+ .depth-3 {
62
+ padding-left: var(--space-4);
63
+ }
64
+
65
+ .depth-4 {
66
+ padding-left: var(--space-5);
67
+ }
129
68
  }
130
69
  }
131
70
  }
@@ -3,10 +3,10 @@ import Table from 'fulldev-ui/components/Table.astro'
3
3
  import { readFileSync } from 'node:fs'
4
4
  import { pascal } from 'radash'
5
5
 
6
- const slug = Astro.url.pathname.replace(/\/$/, '').split('/').pop() || ''
6
+ const slug = Astro.params.page || 'index'
7
7
  const componentName = pascal(slug)
8
8
 
9
- const allComponents = import.meta.glob('src/**/*.astro', { eager: true })
9
+ const allComponents = import.meta.glob('/src/**/*.astro', { eager: true })
10
10
  const foundComponent = Object.entries(allComponents).find(
11
11
  ([key]) => key.split('/').pop() === `${componentName}.astro`
12
12
  )?.[1] as any
@@ -1,26 +1,52 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
3
  import Element from 'fulldev-ui/components/Element.astro'
4
4
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
5
+ import Button from '../Button.astro'
6
+ import Input from '../Input.astro'
7
+ import Select from '../Select.astro'
8
+ import Textarea from '../Textarea.astro'
5
9
 
6
10
  interface Props extends GlobalProps, HTMLAttributes<'form'> {
7
- structure?: 'column' | 'row' | 'group' | undefined
11
+ submit?: ComponentProps<typeof Button>['text']
12
+ fields?:
13
+ | (
14
+ | ComponentProps<typeof Input>
15
+ | ComponentProps<typeof Select>
16
+ | (ComponentProps<typeof Textarea> & { type?: 'textarea' | undefined })
17
+ )[]
18
+ | undefined
8
19
  }
9
20
 
10
- const { structure = 'column', ...rest } = Astro.props
21
+ const { fields, submit, ...rest } = Astro.props
11
22
  ---
12
23
 
13
24
  <Element
14
- class:list={`form ${structure}`}
25
+ class:list="form"
15
26
  as="form"
16
27
  {...rest}
17
28
  >
18
- <slot />
29
+ <slot>
30
+ {
31
+ fields?.map((field) => {
32
+ if ('options' in field) return <Select {...field} />
33
+ if ('type' in field && field.type === 'textarea')
34
+ return <Textarea {...field} />
35
+ return <Input {...(field as any)} />
36
+ })
37
+ }
38
+ <Button
39
+ type="submit"
40
+ text={submit}
41
+ />
42
+ </slot>
19
43
  </Element>
20
44
 
21
45
  <style is:global lang="scss">
22
46
  .form {
23
47
  display: flex;
48
+ flex-direction: column;
49
+ gap: var(--space-4);
24
50
  width: 100%;
25
51
  max-width: calc(var(--space-4) * 44);
26
52
  }