fulldev-ui 0.5.0-beta.3 → 0.5.0-beta.5

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/Contact.astro +7 -30
  3. package/src/blocks/Excerpt.astro +14 -0
  4. package/src/blocks/Intro.astro +3 -1
  5. package/src/blocks/Product.astro +42 -3
  6. package/src/components/Card.astro +10 -4
  7. package/src/components/Drawer.astro +97 -54
  8. package/src/components/Footer.astro +6 -2
  9. package/src/components/Header.astro +20 -12
  10. package/src/components/Menu.astro +56 -0
  11. package/src/components/Section.astro +2 -0
  12. package/src/components/Sidebar.astro +61 -111
  13. package/src/components/Social.astro +7 -0
  14. package/src/components/ThemeSelect.astro +3 -0
  15. package/src/components/Toc.astro +36 -94
  16. package/src/components/experimental/Form.astro +2 -0
  17. package/src/components/experimental/Gallery.astro +50 -126
  18. package/src/components/experimental/Prose.astro +32 -0
  19. package/src/content/config.ts +1 -2
  20. package/src/content/pages/blocks/_product.mdx +73 -2
  21. package/src/content/pages/index.mdx +0 -2
  22. package/src/content/pages/layouts/_layout.mdx +8 -15
  23. package/src/content/pages/layouts/docslayout.mdx +10 -1
  24. package/src/content/pages/overview/components.mdx +5 -0
  25. package/src/content/pages/overview/content-collections.mdx +139 -0
  26. package/src/content/pages/overview/installation.mdx +25 -26
  27. package/src/content/pages/overview/introduction.mdx +16 -10
  28. package/src/content/pages/overview/theming.mdx +69 -0
  29. package/src/content/pages/schemas/page.mdx +6 -0
  30. package/src/content/presets/base.yml +57 -43
  31. package/src/content/presets/blocks.yml +0 -3
  32. package/src/content/presets/docs.yml +2 -60
  33. package/src/layouts/Layout.astro +26 -9
  34. package/src/layouts/OverviewLayout.astro +2 -0
  35. package/src/layouts/PostLayout.astro +24 -0
  36. package/src/layouts/ProductLayout.astro +5 -2
  37. package/src/schemas/components/footer.ts +1 -0
  38. package/src/schemas/components/header.ts +1 -0
  39. package/src/schemas/components/menu.ts +13 -0
  40. package/src/schemas/components/sidebar.ts +15 -0
  41. package/src/schemas/components/toc.ts +3 -0
  42. package/src/schemas/pageSchema.ts +8 -6
  43. package/src/schemas/utils/navigation.ts +3 -52
  44. package/src/utils/getReferenceChildren.ts +4 -1
  45. package/src/components/experimental/GalleryVertical.astro +0 -161
  46. package/src/content/pages/overview/content-layer.mdx +0 -128
  47. package/src/content/pages/overview/customization.mdx +0 -83
  48. package/src/schemas/presetSchema.ts +0 -29
@@ -1,151 +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
- company?: string | undefined
16
- buttons?: any[] | undefined
17
- 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
18
19
  }
19
20
 
20
21
  const {
21
22
  size = 'sm',
22
- open = false,
23
23
  logo,
24
24
  company,
25
- buttons,
26
- search,
25
+ render,
26
+ themeselect,
27
+ menu,
28
+ toc,
29
+ heading,
30
+ ...rest
27
31
  } = Astro.props
28
32
  ---
29
33
 
30
- <input
31
- id="sidebar"
32
- class="sidebar-checkbox"
33
- type="checkbox"
34
- />
35
-
36
34
  <Element
37
35
  class:list="sidebar"
38
36
  as="aside"
39
37
  {size}
40
- {open}
38
+ {...rest}
41
39
  >
42
- <Logo
43
- src={logo}
44
- company={company}
45
- />
46
- {search && <Search />}
47
- <Element class:list="buttons">
48
- {
49
- buttons?.map(({ heading, slug, href, text, buttons }) => (
50
- <>
51
- <Heading
52
- level={6}
53
- text={heading}
54
- />
55
- <Button
56
- variant="link"
57
- {slug}
58
- {href}
59
- {text}
60
- />
61
- {buttons?.map((button: any) => (
62
- <Button
63
- variant="link"
64
- {...button}
65
- />
66
- ))}
67
- </>
68
- ))
69
- }
70
- <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 />
71
58
  </Element>
72
59
  </Element>
73
60
 
74
61
  <style lang="scss" is:global>
75
62
  @layer fulldev {
76
- .sidebar-checkbox {
77
- display: none;
78
- }
79
-
80
- @media (max-width: 1023.999px) {
81
- body:has(.sidebar-checkbox:checked) {
82
- overflow: hidden;
83
- }
84
- }
85
-
86
63
  .sidebar {
87
- --sidebar-width: 240px;
88
-
89
64
  display: none;
90
- position: fixed;
91
- top: var(--header-height, 0px);
92
- bottom: 0;
93
- left: 0;
94
- flex-shrink: 0;
95
- flex-direction: column;
96
- justify-content: flex-start;
97
- z-index: 10;
98
- border-style: solid;
99
- border-color: var(--color-a6);
100
- background-color: var(--base-2);
101
- padding: var(--space-md-5) var(--gutter);
102
- width: 100%;
103
- height: calc(100vh - var(--header-height, 0px));
104
- overflow-y: auto;
105
-
106
- &:is(.sidebar-checkbox:checked + &) {
107
- display: flex;
108
- }
109
65
 
110
66
  @media (min-width: 1024px) {
111
- border-right-width: 1px;
112
- padding: var(--space-md-6) var(--gutter);
113
- width: var(--sidebar-width);
114
-
115
- &.open {
116
- display: flex;
117
- position: sticky;
118
- }
119
- }
120
-
121
- .buttons {
122
67
  display: flex;
68
+ position: sticky;
69
+ top: var(--header-height, 0px);
70
+ bottom: 0;
71
+ flex-shrink: 0;
123
72
  flex-direction: column;
124
- 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));
125
78
 
126
- .theme-select {
127
- 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;
128
87
  }
129
88
 
130
- .button + .heading {
131
- 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-6) var(--gutter);
95
+ width: 100%;
96
+ overflow-y: auto;
132
97
  }
133
98
  }
134
-
135
- .logo {
136
- display: none;
137
- position: absolute;
138
- top: 0;
139
- left: var(--gutter);
140
- align-items: center;
141
- height: 56px;
142
- }
143
- }
144
-
145
- @media (min-width: 1024px) {
146
- .header:not(.open) ~ .core .sidebar .logo {
147
- display: flex;
148
- }
149
99
  }
150
100
  }
151
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,55 @@ 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 > 0}
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: var(--header-height, 0px);
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
+ padding: var(--space-md-6) var(--gutter);
60
+ width: calc(var(--space-7) * 4);
61
+ height: calc(100vh - var(--header-height, 0px));
62
+ overflow-y: auto;
63
+
64
+ .depth-3 {
65
+ padding-left: var(--space-4);
66
+ }
67
+
68
+ .depth-4 {
69
+ padding-left: var(--space-5);
70
+ }
129
71
  }
130
72
  }
131
73
  }
@@ -21,6 +21,8 @@ const { structure = 'column', ...rest } = Astro.props
21
21
  <style is:global lang="scss">
22
22
  .form {
23
23
  display: flex;
24
+ flex-direction: column;
25
+ gap: var(--space-4);
24
26
  width: 100%;
25
27
  max-width: calc(var(--space-4) * 44);
26
28
  }
@@ -1,180 +1,104 @@
1
1
  ---
2
- import Icon from 'fulldev-ui/components/Icon.astro'
2
+ import Element from 'fulldev-ui/components/Element.astro'
3
3
  import Image from 'fulldev-ui/components/Image.astro'
4
4
 
5
- const { images, direction } = Astro.props
5
+ const { images } = Astro.props
6
6
  ---
7
7
 
8
8
  <script>
9
- const carousel = document.querySelector('.gallery .large-carousel')
10
- const icon = document.querySelector('.gallery .icon')
11
- const smallImages = document.querySelectorAll('.gallery .small-image')
12
-
13
- carousel &&
14
- icon?.addEventListener('click', () => {
15
- const carouselWidth = (carousel as HTMLElement).offsetWidth
16
- const currentScroll = carousel.scrollLeft
17
- const maxScroll = carousel.scrollWidth - carouselWidth
18
-
19
- let scrollAmount = currentScroll + carouselWidth
20
- if (scrollAmount > maxScroll) {
21
- scrollAmount = 0 // Reset to beginning if we're at the end
22
- }
23
-
24
- carousel.scrollTo({
25
- left: scrollAmount,
26
- behavior: 'smooth',
27
- })
28
- })
29
-
30
- carousel &&
31
- smallImages?.forEach((image, i) => {
32
- image.addEventListener('click', () => {
33
- const imageWidth = (carousel as HTMLElement).offsetWidth
34
- carousel.scrollTo({
35
- left: i * imageWidth,
36
- behavior: 'smooth',
9
+ const setupGallery = (document: Document) => {
10
+ const galleries = document.querySelectorAll('.gallery')
11
+
12
+ galleries.forEach((gallery) => {
13
+ const carousel = gallery.querySelector('.large-carousel')
14
+ const smallImages = gallery.querySelectorAll('.small-image')
15
+
16
+ carousel &&
17
+ smallImages?.forEach((image, i) => {
18
+ image.addEventListener('click', () => {
19
+ const largeImages = carousel.querySelectorAll('.large-image')
20
+ if (largeImages[i]) {
21
+ largeImages[i].scrollIntoView({
22
+ behavior: 'smooth',
23
+ block: 'nearest',
24
+ inline: 'start',
25
+ })
26
+ }
27
+ })
37
28
  })
38
- })
39
29
  })
30
+ }
31
+
32
+ setupGallery(document)
33
+
34
+ document.addEventListener('astro:before-swap', (event) => {
35
+ setupGallery(event.newDocument)
36
+ })
40
37
  </script>
41
38
 
42
- <div
43
- class:list={[
44
- 'full',
45
- 'gallery',
46
- {
47
- [`direction-${direction}`]: direction,
48
- },
49
- ]}
50
- >
51
- <div class="large-container">
52
- <div class="large-carousel">
53
- {
54
- images?.map((image: any) => (
55
- <Image
56
- class="large-image"
57
- src={image}
58
- />
59
- ))
60
- }
61
- </div>
39
+ <Element class:list={['gallery']}>
40
+ <Element class="large-carousel">
62
41
  {
63
- images?.length > 1 && (
64
- <Icon
65
- class="icon"
66
- name="swipe-left"
42
+ images?.map((image: any) => (
43
+ <Image
44
+ class="large-image"
45
+ {...(typeof image === 'string' ? { src: image } : image)}
67
46
  />
68
- )
47
+ ))
69
48
  }
70
- </div>
71
- <div class="small-carousel">
49
+ </Element>
50
+ <Element class="small-carousel">
72
51
  {
73
52
  images?.length > 1 &&
74
53
  images.map((image: any) => (
75
54
  <Image
76
55
  class="small-image"
77
- src={image}
56
+ {...(typeof image === 'string' ? { src: image } : image)}
78
57
  />
79
58
  ))
80
59
  }
81
- </div>
82
- </div>
60
+ </Element>
61
+ </Element>
83
62
 
84
63
  <style is:global lang="scss">
85
64
  .gallery {
86
65
  display: flex;
87
66
  position: relative;
88
- column-gap: var(--space-4);
89
- row-gap: var(--space-1);
90
67
  flex-direction: column;
91
-
92
- @media (min-width: 1024px) {
93
- flex-direction: row-reverse;
94
- }
95
-
96
- .large-container {
97
- display: flex;
98
- justify-content: space-between;
99
- align-items: center;
100
-
101
- &:hover .icon {
102
- opacity: 1;
103
- }
104
-
105
- .icon {
106
- position: absolute;
107
- right: var(--space-3);
108
- opacity: 0.5;
109
- animation: swipe-icon 1.6s ease-in-out infinite;
110
- transition: opacity 0.2s ease-in-out;
111
- font-size: calc(var(--text-2) * 1.7);
112
-
113
- @media (min-width: 1024px) {
114
- display: none;
115
- }
116
- }
117
-
118
- @keyframes swipe-icon {
119
- 0%,
120
- 100% {
121
- right: var(--space-3);
122
- }
123
- 50% {
124
- right: calc(var(--space-3) * 2);
125
- }
126
- }
127
- }
68
+ gap: var(--space-1) var(--space-4);
128
69
 
129
70
  .small-carousel,
130
71
  .large-carousel {
131
- --column-width: 100%;
132
72
  display: flex;
133
73
  position: relative;
134
- align-items: flex-start;
74
+ align-items: center;
135
75
  gap: var(--space-4);
136
-
137
76
  box-sizing: border-box;
138
77
  padding-bottom: var(--space-4);
139
78
  width: 100%;
140
- overflow-x: auto;
79
+ overflow: auto;
141
80
  scroll-behavior: smooth;
142
81
  scroll-snap-type: x mandatory;
143
82
 
144
- > .root {
83
+ > .image {
145
84
  flex-grow: 0;
146
85
  flex-shrink: 0;
147
86
  width: var(--column-width);
148
87
  scroll-snap-align: center;
149
88
  }
89
+ }
150
90
 
151
- &.position-inset {
152
- margin-right: calc(var(--inner-x) * -1);
153
- margin-left: calc(var(--inner-x) * -1);
154
- padding-right: var(--inner-x);
155
- padding-left: var(--inner-x);
156
- width: calc(100% + var(--inner-x) * 2);
157
- }
91
+ .large-carousel {
92
+ --column-width: 100%;
158
93
  }
159
94
 
160
95
  .small-carousel {
161
96
  --column-width: var(--space-7);
162
97
 
163
- @media (min-width: 1024px) {
164
- --column-width: 100%;
165
-
166
- flex-direction: column;
167
- width: 40%;
98
+ .image:hover {
99
+ opacity: 0.8;
100
+ cursor: pointer;
168
101
  }
169
102
  }
170
-
171
- .small-image,
172
- .large-image {
173
- }
174
-
175
- .small-image:hover {
176
- opacity: 0.8;
177
- cursor: pointer;
178
- }
179
103
  }
180
104
  </style>
@@ -151,6 +151,38 @@ const { as = 'div', ...rest } = Astro.props
151
151
  }
152
152
  }
153
153
 
154
+ ul,
155
+ ol {
156
+ display: flex;
157
+ flex-direction: column;
158
+ margin: var(--space-4) 0;
159
+ padding-left: var(--space-5);
160
+ color: var(--color-11);
161
+ font-size: var(--text-2);
162
+ line-height: 1.625;
163
+ }
164
+
165
+ ul {
166
+ list-style-type: disc;
167
+ }
168
+
169
+ ol {
170
+ list-style-type: decimal;
171
+ }
172
+
173
+ li {
174
+ align-items: center;
175
+ margin-bottom: var(--space-2);
176
+ max-width: calc(var(--space-4) * 44);
177
+ color: var(--color-11);
178
+ font-size: var(--text-2);
179
+ line-height: 1.625;
180
+ }
181
+
182
+ li:last-child {
183
+ margin-bottom: 0;
184
+ }
185
+
154
186
  p code {
155
187
  background-color: var(--base-12);
156
188
  padding: 0 var(--space-1);