fulldev-ui 0.2.12 → 0.3.0-beta.1

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 (102) hide show
  1. package/.astro/settings.json +5 -0
  2. package/.astro/types.d.ts +3 -12
  3. package/.env +1 -0
  4. package/astro.config.mjs +1 -2
  5. package/package.json +4 -7
  6. package/src/_archive/Childmorphic.ts +8 -0
  7. package/src/_archive/getAllCollections.ts +10 -0
  8. package/src/_archive/getCollectionCascade.ts +33 -0
  9. package/src/_archive/getPathname.ts +18 -0
  10. package/src/_archive/staticPageSchema.ts +124 -0
  11. package/src/_archive/transform/transform.ts +25 -0
  12. package/src/_archive/transform/transformCasing.ts +24 -0
  13. package/src/_archive/transform/transformReferences.ts +54 -0
  14. package/src/_archive/transform/transformSelfs.ts +20 -0
  15. package/src/_archive/transform/transformUnderscores.ts +19 -0
  16. package/src/components/_Block.astro +2 -0
  17. package/src/components/{_Tag.astro → _Component.astro} +18 -9
  18. package/src/components/{segment → _archive}/Body.astro +7 -5
  19. package/src/components/{segment → _archive}/Main.astro +4 -4
  20. package/src/components/{segment → _archive}/Nav.astro +5 -5
  21. package/src/components/{structure → _archive}/Row.astro +4 -4
  22. package/src/components/_todo/Footer.astro +66 -0
  23. package/src/components/{segment → _todo}/Form.astro +6 -6
  24. package/src/components/{segment → _todo}/Prose.astro +20 -20
  25. package/src/components/{segment → _todo}/Writeup.astro +4 -4
  26. package/src/components/{segment → _todo}/todo.md +3 -1
  27. package/src/components/base/Badge.astro +6 -6
  28. package/src/components/base/Button.astro +37 -28
  29. package/src/components/base/Checkbox.astro +3 -4
  30. package/src/components/base/Icon.astro +5 -5
  31. package/src/components/base/Image.astro +19 -52
  32. package/src/components/base/Input.astro +12 -7
  33. package/src/components/base/Logo.astro +4 -4
  34. package/src/components/base/Radio.astro +3 -4
  35. package/src/components/base/Rating.astro +5 -5
  36. package/src/components/base/Select.astro +6 -6
  37. package/src/components/base/SelectOption.astro +1 -1
  38. package/src/components/base/Switch.astro +8 -7
  39. package/src/components/base/Textarea.astro +4 -3
  40. package/src/components/segment/Box.astro +41 -0
  41. package/src/components/segment/Card.astro +21 -35
  42. package/src/components/segment/Deck.astro +20 -16
  43. package/src/components/{structure → segment}/Group.astro +8 -7
  44. package/src/components/segment/Header.astro +18 -7
  45. package/src/components/segment/Section.astro +39 -37
  46. package/src/components/typography/Heading.astro +24 -26
  47. package/src/components/typography/Label.astro +17 -11
  48. package/src/components/typography/Link.astro +5 -5
  49. package/src/components/typography/List.astro +9 -6
  50. package/src/components/typography/ListItem.astro +5 -5
  51. package/src/components/typography/Paragraph.astro +17 -11
  52. package/src/components/typography/Tagline.astro +6 -5
  53. package/src/components/typography/Text.astro +40 -0
  54. package/src/{layouts → components/utility}/Layout.astro +6 -6
  55. package/src/content/config.ts +14 -0
  56. package/src/content/pages/index.md +1 -0
  57. package/src/css/color.css +88 -0
  58. package/src/css/props/align.scss +20 -0
  59. package/src/css/props/frame.scss +153 -0
  60. package/src/css/props/mask +1 -0
  61. package/src/css/props/position.scss +33 -0
  62. package/src/css/props/ratio +1 -0
  63. package/src/css/props/structure.scss +228 -0
  64. package/src/css/props/variant.scss +130 -0
  65. package/src/css/radix.css +281 -0
  66. package/src/css/size.css +334 -0
  67. package/src/css/styles.css +2 -2
  68. package/src/index.ts +13 -34
  69. package/src/integration/integration.ts +45 -0
  70. package/src/schemas/collection.ts +87 -0
  71. package/src/blocks/todo.md +0 -12
  72. package/src/components/_Plural.astro +0 -27
  73. package/src/components/base/Buttons.astro +0 -15
  74. package/src/components/base/Images.astro +0 -15
  75. package/src/components/segment/Footer.astro +0 -14
  76. package/src/components/structure/Bento.astro +0 -35
  77. package/src/components/structure/Carousel.astro +0 -43
  78. package/src/components/structure/Grid.astro +0 -30
  79. package/src/components/structure/Masonry.astro +0 -39
  80. package/src/components/structure/Split.astro +0 -41
  81. package/src/components/structure/Spread.astro +0 -48
  82. package/src/components/structure/Stack.astro +0 -90
  83. package/src/components/structure/todo.md +0 -5
  84. package/src/css/colors.css +0 -197
  85. package/src/css/main.css +0 -3
  86. package/src/css/sizes.css +0 -217
  87. package/src/layouts/todo.md +0 -2
  88. package/src/schemas/attributesSchema.ts +0 -125
  89. package/src/schemas/htmlAttributesSchema.ts +0 -126
  90. package/src/schemas/pageSchema.ts +0 -185
  91. package/src/schemas/staticPageSchema.ts +0 -124
  92. package/src/types/Childmorphic.ts +0 -8
  93. package/src/types/Pluralmorphic.ts +0 -7
  94. package/src/types/Structuremorphic.ts +0 -18
  95. package/src/utils/getAllCollections.ts +0 -10
  96. package/src/utils/getCollectionCascade.ts +0 -33
  97. package/src/utils/getPathname.ts +0 -18
  98. package/src/utils/transform/transform.ts +0 -25
  99. package/src/utils/transform/transformCasing.ts +0 -24
  100. package/src/utils/transform/transformReferences.ts +0 -54
  101. package/src/utils/transform/transformSelfs.ts +0 -20
  102. package/src/utils/transform/transformUnderscores.ts +0 -19
@@ -1,124 +0,0 @@
1
- import {
2
- getCollection,
3
- getEntry,
4
- z,
5
- type CollectionEntry,
6
- type CollectionKey,
7
- } from 'astro:content'
8
- import { flatten, unflatten } from 'flat'
9
- import { all, camel, construct, get, isString, mapValues } from 'radash'
10
- import { mapKeys, merge } from 'remeda'
11
-
12
- interface Options {
13
- casing: boolean
14
- layouts: boolean
15
- references: boolean
16
- selfs: boolean
17
- }
18
-
19
- const defaults: Options = {
20
- casing: true,
21
- layouts: true,
22
- references: true,
23
- selfs: true,
24
- }
25
-
26
- const transformReferences = async (data: object) =>
27
- await all(
28
- mapValues(flatten(data) as any, async (value) => {
29
- if (!isString(value)) return value
30
- const parts = (value as string).split(' ')
31
- const results = await all(
32
- parts.map(async (valuePart) => {
33
- if (!valuePart.startsWith('$')) return valuePart
34
- if (valuePart.startsWith('$self')) return valuePart
35
-
36
- const reference = valuePart.split('.')[0].replace('$', '')
37
- const collection = reference.split('/')[0]
38
- const slug = reference.split('/').slice(1).join('/')
39
- const path = valuePart.split('.').slice(1).join('.')
40
-
41
- if (collection && slug) {
42
- let response = await getEntry(collection as CollectionKey, slug)
43
- const result = get(response?.data, path)
44
- return result
45
- } else if (collection) {
46
- const response = await getCollection(collection as CollectionKey)
47
- const result = response?.map((entry: any) => get(entry?.data, path))
48
- return result
49
- }
50
-
51
- return valuePart
52
- })
53
- )
54
- if (results.length == 1) return results[0]
55
- return results.join(' ')
56
- })
57
- )
58
-
59
- const transformLayouts = (data: object) => {
60
- const flat: any = flatten(data)
61
- let store: any = {}
62
- let i: number = 0
63
-
64
- const merged = mapKeys(flat, (key) => {
65
- if (!isString(key)) return key
66
- const parts = key.split('.')
67
- const result = parts.map((part) => {
68
- return part.replace(/^_+/, '')
69
- })
70
- const filtered = result.filter(Boolean)
71
- const joined = filtered.join('.')
72
- return joined
73
- })
74
- const nested = construct(merged)
75
- return nested
76
- }
77
-
78
- const transformSelfs = (data: object) => {
79
- const flat = flatten(data) as any
80
- const mapped = mapValues(flat, (value) => {
81
- if (!isString(value)) return value
82
- const parts = (value as string).split(' ')
83
- const result = parts.map((part) => {
84
- if (!part.startsWith('$self')) return part
85
- const pathParts = part.split('.').slice(1)
86
- const camelCased = pathParts.map((part) => camel(part))
87
- const path = camelCased.join('.')
88
- const result = get(data, path)
89
- return result ? result : part
90
- })
91
- return result.join(' ')
92
- })
93
- return unflatten(mapped)
94
- }
95
-
96
- const transformCasing = (object: object) => {
97
- const flat = flatten(object)
98
- const mapped = mapKeys(flat, (key) => {
99
- if (!isString(key)) return key
100
- const parts = (key as string).split('.')
101
- const result = parts.map((part) => camel(part))
102
- return result.join('.')
103
- })
104
- return unflatten(mapped)
105
- }
106
-
107
- export const pageSchema = (options: Partial<Options> = {}) =>
108
- z.any().transform(async (data: CollectionEntry<CollectionKey>['data']) => {
109
- const { layouts, casing, references, selfs } = merge(defaults, options)
110
-
111
- if (references) data = await transformReferences(data)
112
- // console.log('references', JSON.stringify(data, null, 2))
113
-
114
- if (layouts) data = transformLayouts(data)
115
- // console.log('layouts', data)
116
-
117
- if (casing) data = transformCasing(data)
118
- // console.log('casing', data)
119
-
120
- if (selfs) data = transformSelfs(data)
121
- // console.log('selfs', data)
122
-
123
- return data
124
- })
@@ -1,8 +0,0 @@
1
- import type { AstroGlobal } from 'astro'
2
-
3
- export type Childmorphic<C extends AstroGlobal['props']> = {
4
- [Key in keyof C & string as
5
- | Lowercase<Key>
6
- | Capitalize<Key>
7
- | `${string}${Capitalize<Key>}`]?: C[Key]
8
- }
@@ -1,7 +0,0 @@
1
- import type { AstroGlobal } from 'astro'
2
-
3
- export type Pluralmorphic<P extends AstroGlobal['props']> =
4
- | (P & {
5
- [key: number]: P | string
6
- })
7
- | (P | string)[]
@@ -1,18 +0,0 @@
1
- import type { ComponentProps } from 'astro/types'
2
- import type Carousel from '../components/structure/Carousel.astro'
3
- import type Stack from '../components/structure/Column.astro'
4
-
5
- export type Structuremorphic<
6
- S extends
7
- | 'bento'
8
- | 'carousel'
9
- | 'grid'
10
- | 'masonry'
11
- | 'split'
12
- | 'spread'
13
- | 'stack',
14
- > = S extends 'stack'
15
- ? ComponentProps<typeof Stack>
16
- : S extends 'carousel'
17
- ? ComponentProps<typeof Carousel>
18
- : undefined
@@ -1,10 +0,0 @@
1
- import type { CollectionKey } from 'astro:content'
2
- import { getCollection } from 'astro:content'
3
-
4
- export const getAllCollections = async (names: CollectionKey[]) => {
5
- const promises = names.map((name) => getCollection(name))
6
- const resolved = await Promise.all(promises)
7
- const flattened = resolved.flat()
8
- const filtered = flattened.filter(Boolean)
9
- return filtered
10
- }
@@ -1,33 +0,0 @@
1
- import {
2
- getCollection,
3
- type CollectionEntry,
4
- type CollectionKey,
5
- type ContentCollectionKey,
6
- type DataCollectionKey,
7
- } from 'astro:content'
8
- import { unflatten } from 'flat'
9
- import { objectify } from 'radash'
10
- import { mapValues } from 'remeda'
11
-
12
- export type CollectionCascade = {
13
- [Key in ContentCollectionKey]: {
14
- [Key in CollectionEntry<ContentCollectionKey>['slug']]: any
15
- }
16
- } & {
17
- [Key in DataCollectionKey]: {
18
- [Key in CollectionEntry<DataCollectionKey>['id']]: any
19
- }
20
- }
21
-
22
- export const getCollectionCascade = async (collectionKeys: CollectionKey[]) => {
23
- const promises = collectionKeys.map((key) => getCollection(key))
24
- const resolved = await Promise.all(promises)
25
- const flattened = resolved.flat()
26
- const object = objectify(
27
- flattened,
28
- ({ collection, slug, id }) => `${collection}.${slug || id}`
29
- )
30
- const mapped = mapValues(object, (value) => value.data)
31
- const unflattened = unflatten(mapped)
32
- return unflattened as CollectionCascade
33
- }
@@ -1,18 +0,0 @@
1
- import type { AstroGlobal } from 'astro'
2
- import type { CollectionEntry, ContentCollectionKey } from 'astro:content'
3
-
4
- export const getPathname = ({
5
- slug,
6
- collection,
7
- data,
8
- }: CollectionEntry<ContentCollectionKey>):
9
- | AstroGlobal['url']['pathname']
10
- | undefined => {
11
- if (!slug) return
12
- if (data.draft) return
13
- if (data.output === false) return
14
- if (collection === 'pages' && slug === 'index') return '/'
15
- if (collection === 'pages') return `/${slug}`
16
- if (slug === 'index') return `/${collection}`
17
- return `/${collection}/${slug}`
18
- }
@@ -1,25 +0,0 @@
1
- import type { CollectionEntry, CollectionKey } from 'astro:content'
2
- import { transformCasing } from './transformCasing'
3
- import { transformReferences } from './transformReferences'
4
- import { transformSelfs } from './transformSelfs'
5
- import { transformUnderscores } from './transformUnderscores'
6
-
7
- export const transform = async (
8
- entry: CollectionEntry<CollectionKey>
9
- ): Promise<any> => {
10
- // console.log('entry', entry.data)
11
-
12
- entry = await transformReferences(entry)
13
- // console.log('references', entry)
14
-
15
- entry = transformUnderscores(entry)
16
- // console.log('underscores', entry)
17
-
18
- entry = transformCasing(entry)
19
- // console.log('casing', entry)
20
-
21
- entry = transformSelfs(entry)
22
- // console.log('selfs', entry)
23
-
24
- return entry
25
- }
@@ -1,24 +0,0 @@
1
- import { flatten, unflatten } from 'flat'
2
- import { camel, isObject } from 'radash'
3
- import { isArray, isString, mapKeys } from 'remeda'
4
-
5
- export const transformCasing = (data: any) => {
6
- if (!isObject(data) && !isArray(data)) return data
7
-
8
- const flat: any = flatten(data)
9
- const transformedData = mapKeys(flat, (key) => {
10
- if (!isString(key)) return key
11
- const parts = (key as string).split('.')
12
- const result = parts.map((part) => {
13
- const leadingUnderscores = part.match(/^_+/) || ['']
14
- const withoutLeadingUnderscores = part.replace(/^_+/, '')
15
- const camelCased = camel(withoutLeadingUnderscores)
16
- const result = leadingUnderscores + camelCased
17
- return result
18
- })
19
- return result.join('.')
20
- })
21
-
22
- const nested = unflatten(transformedData)
23
- return nested
24
- }
@@ -1,54 +0,0 @@
1
- import { getCollection, getEntry, type CollectionKey } from 'astro:content'
2
- import { flatten, unflatten } from 'flat'
3
- import { all, get, isString, mapValues } from 'radash'
4
- import { getPathname } from '../getPathname'
5
- import { transform } from './transform'
6
-
7
- export const transformReferences = async (data: object): Promise<any> => {
8
- const flat = flatten(data)
9
- const mappedValues = await all(
10
- mapValues(flat as any, async (value) => {
11
- if (!isString(value)) return value
12
- const parts = (value as string).split(' ')
13
- const mappedParts = await all(
14
- parts.map(async (valuePart) => {
15
- if (!valuePart.startsWith('$/')) return valuePart
16
-
17
- const reference = valuePart.split('.')[0].replace('$/', '')
18
- const collection = reference.split('/')[0]
19
- const slug = reference.split('/').slice(1).join('/')
20
- const path = valuePart.split('.').slice(1).join('.')
21
-
22
- if (collection && slug) {
23
- let response = await getEntry(collection as CollectionKey, slug)
24
- if (!response)
25
- throw new Error(`Entry not found: ${collection}/${slug}`)
26
- const transformed = await transform(response as any)
27
- const result = get(transformed?.data, path)
28
- if (!path)
29
- return {
30
- ...transformed?.data,
31
- pathname: getPathname(transformed),
32
- }
33
- return result ? result : valuePart
34
- } else if (collection) {
35
- const response = await getCollection(collection as CollectionKey)
36
- if (!response)
37
- throw new Error(`Entry not found: ${collection}/${slug}`)
38
- const mapped = response?.map(async (entry: any) => {
39
- const transformed = await transform(entry?.data)
40
- return get(transformed, path)
41
- })
42
- const result = await all(mapped)
43
- return result ? result : valuePart
44
- }
45
-
46
- return valuePart
47
- })
48
- )
49
- if (mappedParts.length == 1) return mappedParts[0]
50
- else return mappedParts.join(' ')
51
- })
52
- )
53
- return unflatten(mappedValues)
54
- }
@@ -1,20 +0,0 @@
1
- import { flatten, unflatten } from 'flat'
2
- import { camel, get, isString, mapValues } from 'radash'
3
-
4
- export const transformSelfs = (data: any): any => {
5
- const flat = flatten(data) as any
6
- const mapped = mapValues(flat, (value) => {
7
- if (!isString(value)) return value
8
- const parts = (value as string).split(' ')
9
- const result = parts.map((part) => {
10
- if (!part.startsWith('$.')) return part
11
- const pathParts = part.replace('$.', '').split('.')
12
- const camelCased = pathParts.map((part) => camel(part))
13
- const path = 'data.' + camelCased.join('.')
14
- const result = get(data, path)
15
- return result ? result : part
16
- })
17
- return result.join(' ')
18
- })
19
- return unflatten(mapped)
20
- }
@@ -1,19 +0,0 @@
1
- import { flatten, unflatten } from 'flat'
2
- import { isString } from 'radash'
3
- import { mapKeys } from 'remeda'
4
-
5
- export const transformUnderscores = (data: any): any => {
6
- const flat: any = flatten(data)
7
- const merged = mapKeys(flat, (key) => {
8
- if (!isString(key)) return key
9
- const parts = key.split('.')
10
- const result = parts.map((part) => {
11
- return part.replace(/^_+/, '')
12
- })
13
- const filtered = result.filter(Boolean)
14
- const joined = filtered.join('.')
15
- return joined
16
- })
17
- const nested = unflatten(merged)
18
- return nested
19
- }