fulldev-ui 0.1.64

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 (82) hide show
  1. package/.astro/types.d.ts +156 -0
  2. package/README.md +29 -0
  3. package/astro.config.mjs +7 -0
  4. package/package.json +45 -0
  5. package/src/blocks/todo.md +12 -0
  6. package/src/components/_Block.astro +20 -0
  7. package/src/components/_Blocks.astro +26 -0
  8. package/src/components/_Children.astro +38 -0
  9. package/src/components/_Plural.astro +27 -0
  10. package/src/components/_Tag.astro +53 -0
  11. package/src/components/base/Badge.astro +53 -0
  12. package/src/components/base/Button.astro +85 -0
  13. package/src/components/base/Buttons.astro +15 -0
  14. package/src/components/base/Checkbox.astro +39 -0
  15. package/src/components/base/Icon.astro +46 -0
  16. package/src/components/base/Image.astro +123 -0
  17. package/src/components/base/Images.astro +15 -0
  18. package/src/components/base/Input.astro +52 -0
  19. package/src/components/base/Logo.astro +33 -0
  20. package/src/components/base/Radio.astro +38 -0
  21. package/src/components/base/Rating.astro +45 -0
  22. package/src/components/base/Select.astro +65 -0
  23. package/src/components/base/SelectOption.astro +27 -0
  24. package/src/components/base/Switch.astro +82 -0
  25. package/src/components/base/Textarea.astro +31 -0
  26. package/src/components/base/Video.astro +32 -0
  27. package/src/components/base/todo.md +8 -0
  28. package/src/components/typography/Heading.astro +41 -0
  29. package/src/components/typography/Label.astro +36 -0
  30. package/src/components/typography/Link.astro +38 -0
  31. package/src/components/typography/Links.astro +15 -0
  32. package/src/components/typography/List.astro +42 -0
  33. package/src/components/typography/ListItem.astro +30 -0
  34. package/src/components/typography/Paragraph.astro +38 -0
  35. package/src/components/typography/Tagline.astro +39 -0
  36. package/src/components/typography/_Typography.astro +28 -0
  37. package/src/components/typography/todo.md +15 -0
  38. package/src/components/utility/DecorativeBox.astro +22 -0
  39. package/src/components/utility/Head.astro +81 -0
  40. package/src/components/wrapper/Body.astro +32 -0
  41. package/src/components/wrapper/Card.astro +144 -0
  42. package/src/components/wrapper/Cards.astro +15 -0
  43. package/src/components/wrapper/Deck.astro +133 -0
  44. package/src/components/wrapper/Footer.astro +14 -0
  45. package/src/components/wrapper/Form.astro +26 -0
  46. package/src/components/wrapper/Group.astro +26 -0
  47. package/src/components/wrapper/Header.astro +76 -0
  48. package/src/components/wrapper/Main.astro +25 -0
  49. package/src/components/wrapper/Nav.astro +32 -0
  50. package/src/components/wrapper/Prose.astro +108 -0
  51. package/src/components/wrapper/Section.astro +110 -0
  52. package/src/components/wrapper/Sections.astro +15 -0
  53. package/src/components/wrapper/Writeup.astro +23 -0
  54. package/src/components/wrapper/_Wrapper.astro +333 -0
  55. package/src/components/wrapper/todo.md +20 -0
  56. package/src/content/pages/index.md +2 -0
  57. package/src/css/border.css +23 -0
  58. package/src/css/colors.css +328 -0
  59. package/src/css/font.css +15 -0
  60. package/src/css/main.css +4 -0
  61. package/src/css/reset.css +388 -0
  62. package/src/css/sizes.css +273 -0
  63. package/src/env.d.ts +2 -0
  64. package/src/index.ts +63 -0
  65. package/src/integration/integration.ts +61 -0
  66. package/src/layouts/Layout.astro +39 -0
  67. package/src/layouts/todo.md +2 -0
  68. package/src/schemas/attributesSchema.ts +125 -0
  69. package/src/schemas/htmlAttributesSchema.ts +126 -0
  70. package/src/schemas/pageSchema.ts +185 -0
  71. package/src/schemas/staticPageSchema.ts +124 -0
  72. package/src/types/Childmorphic.ts +8 -0
  73. package/src/types/Pluralmorphic.ts +7 -0
  74. package/src/utils/getAllCollections.ts +10 -0
  75. package/src/utils/getCollectionCascade.ts +33 -0
  76. package/src/utils/getPathname.ts +18 -0
  77. package/src/utils/transform/transform.ts +25 -0
  78. package/src/utils/transform/transformCasing.ts +24 -0
  79. package/src/utils/transform/transformReferences.ts +54 -0
  80. package/src/utils/transform/transformSelfs.ts +20 -0
  81. package/src/utils/transform/transformUnderscores.ts +19 -0
  82. package/tsconfig.json +6 -0
@@ -0,0 +1,33 @@
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
+ }
@@ -0,0 +1,18 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,54 @@
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
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,19 @@
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
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "compilerOptions": {
4
+ "jsx": "preserve",
5
+ }
6
+ }