@adaptive-sm/astro-ui 0.2.1 → 0.3.0

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 (92) hide show
  1. package/README.md +7 -7
  2. package/lib/badge/Badge.astro +27 -0
  3. package/lib/badge/classesBadge.ts +67 -0
  4. package/lib/button/Button.astro +17 -27
  5. package/lib/button/buttonCva.ts +2 -2
  6. package/lib/button/buttonIconCva.ts +2 -2
  7. package/lib/button/classesButtonClickAnimation.ts +1 -1
  8. package/lib/button/classesButtonClickAnimationPush.ts +1 -1
  9. package/lib/button/classesButtonClickAnimationSquish.ts +1 -1
  10. package/lib/card/CardWrapper.astro +6 -5
  11. package/lib/card/classesBorderWrapper.ts +1 -0
  12. package/lib/card/classesCardWrapper.ts +21 -9
  13. package/lib/card/classesShadow.ts +5 -0
  14. package/lib/details/Details.astro +13 -8
  15. package/lib/dev/TailwindIndicator.astro +2 -2
  16. package/lib/form/Fieldset.astro +8 -5
  17. package/lib/generate_demo_list/DemoList.astro +3 -3
  18. package/lib/generate_demo_list/generateDemoList.ts +2 -2
  19. package/lib/generate_image_list/generateImageList.ts +3 -3
  20. package/lib/grid/FeatureGridSection.astro +28 -35
  21. package/lib/grid/classesGridCols.ts +27 -2
  22. package/lib/header/PageHeader.astro +25 -0
  23. package/lib/header/SectionHeader.astro +37 -0
  24. package/lib/icon/Icon.astro +26 -0
  25. package/lib/icons/iconGithub.ts +4 -0
  26. package/lib/icons/iconGoogle.ts +4 -0
  27. package/lib/icons/iconLinkedin.ts +2 -0
  28. package/lib/icons/iconNpm.ts +2 -0
  29. package/lib/icons/iconTelegram.ts +2 -0
  30. package/lib/icons/iconTrello.ts +2 -0
  31. package/lib/icons/iconXcom.ts +1 -0
  32. package/lib/img/Img.astro +8 -5
  33. package/lib/img/TypedImg.astro +9 -10
  34. package/lib/img/TypedImgB2.astro +23 -0
  35. package/lib/layouts/MarkdownPageWrapper.astro +19 -0
  36. package/lib/layouts/MinimalLayout.astro +23 -16
  37. package/lib/layouts/parts/ThemeToggle.astro +9 -9
  38. package/lib/link/LinkButton.astro +18 -19
  39. package/lib/link/LinkText.astro +10 -7
  40. package/lib/link/classesTextLink.ts +1 -1
  41. package/lib/list/BlackBulletPoint.astro +1 -1
  42. package/lib/list/BlackBulletPoints.astro +7 -7
  43. package/lib/list/CheckPoint.astro +3 -3
  44. package/lib/list/CheckPoints.astro +3 -3
  45. package/lib/list/NumberedList.astro +1 -1
  46. package/lib/list/Ps.astro +8 -5
  47. package/lib/list/TextOrLink.astro +3 -9
  48. package/lib/md/MarkdownDiv.astro +18 -0
  49. package/lib/modal/Modal.astro +4 -4
  50. package/lib/modal/ModalButton.astro +24 -11
  51. package/lib/page/PageCentered.astro +5 -3
  52. package/lib/page/PageCenteredCard.astro +7 -5
  53. package/lib/page/classesPageCentered.ts +1 -1
  54. package/lib/popover/Popover1.astro +4 -4
  55. package/lib/select/Select.astro +14 -10
  56. package/lib/table/Table.astro +2 -2
  57. package/lib/table/TableD.astro +2 -2
  58. package/lib/table/TableM.astro +2 -2
  59. package/lib/table/TableMEntry.astro +2 -2
  60. package/lib/table/tableVisibilityClasses.ts +3 -3
  61. package/lib/utils/HasId.ts +3 -0
  62. package/lib/utils/HasSubtitle.ts +4 -0
  63. package/lib/utils/HasTitle.ts +4 -0
  64. package/lib/utils/MayHaveButtonVariant.ts +5 -0
  65. package/lib/utils/MayHaveClass.ts +3 -0
  66. package/lib/utils/MayHaveIcon.ts +4 -0
  67. package/lib/utils/MayHaveId.ts +3 -0
  68. package/lib/utils/MayHaveInnerClass.ts +3 -0
  69. package/lib/utils/MayHaveSubtitle.ts +4 -0
  70. package/lib/utils/MayHaveTitle.ts +4 -0
  71. package/package.json +13 -12
  72. package/lib/icon/Icon1.astro +0 -21
  73. package/lib/layouts/MarkdownWrapper.astro +0 -17
  74. package/lib/utils/bun/BunCmd.ts +0 -7
  75. package/lib/utils/bun/cryAndTryAgainLater.ts +0 -6
  76. package/lib/utils/bun/logBunCmd.ts +0 -1
  77. package/lib/utils/bun/runCmdAsync.ts +0 -44
  78. package/lib/utils/bun/runCmdLocally.ts +0 -13
  79. package/lib/utils/obj/objectKeys.ts +0 -21
  80. package/lib/utils/ran/generateId12.ts +0 -7
  81. package/lib/utils/ran/generateId3.ts +0 -7
  82. package/lib/utils/ran/generateId4.ts +0 -7
  83. package/lib/utils/ran/generateId5.ts +0 -7
  84. package/lib/utils/ran/generateId6.ts +0 -7
  85. package/lib/utils/ran/generateId7.ts +0 -7
  86. package/lib/utils/ran/generateReadableId.ts +0 -35
  87. package/lib/utils/ran/urlAlphabet32.ts +0 -8
  88. /package/lib/{layouts/parts → md}/markdown.css +0 -0
  89. /package/lib/utils/{ui/classArr.ts → classArr.ts} +0 -0
  90. /package/lib/utils/{ui/classMerge.ts → classMerge.ts} +0 -0
  91. /package/lib/utils/{ui/isDevEnv.ts → isDevEnv.ts} +0 -0
  92. /package/lib/utils/{ui/tailwindBreakpoint.ts → tailwindBreakpoint.ts} +0 -0
@@ -0,0 +1,25 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { classMerge } from "~ui/utils/classMerge"
4
+
5
+ interface Props {
6
+ title: string
7
+ subtitle?: string
8
+ titleClass?: string
9
+ subtitleClass?: string
10
+ innerClass?: string
11
+ class?: string
12
+ restProps?: HTMLAttributes<"header">
13
+ }
14
+
15
+ const p = Astro.props
16
+ ---
17
+
18
+ <header class={p.class}>
19
+ <div class={classMerge("flex flex-wrap justify-between items-center gap-4", p.innerClass)} {...p.restProps}>
20
+ <h1 class={classMerge("text-2xl font-semibold", p.titleClass)}>{p.title}</h1>
21
+ <slot />
22
+ </div>
23
+ {p.subtitle && <p class={classMerge("text-lg", p.subtitleClass)}>{p.subtitle}</p>}
24
+ <slot name="subtitle" />
25
+ </header>
@@ -0,0 +1,37 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { buttonVariant } from "~ui/button/buttonCva"
4
+ import LinkButton from "~ui/link/LinkButton.astro"
5
+ import type { MayHaveClass } from "~ui/utils/MayHaveClass"
6
+ import { classMerge } from "~ui/utils/classMerge"
7
+
8
+ interface Props extends MayHaveClass {
9
+ icon: string
10
+ href?: string
11
+ title: string
12
+ titleClass?: string
13
+ subtitle?: string
14
+ subtitleClass?: string
15
+ innerClass?: string
16
+ class?: string
17
+ restProps?: HTMLAttributes<"header">
18
+ }
19
+
20
+ const p = Astro.props
21
+ ---
22
+
23
+ <div class={classMerge("flex flex-wrap items-center justify-between gap-4", p.class)} {...p.restProps}>
24
+ <h2 class={classMerge("text-2xl font-semibold", p.titleClass)}>
25
+ {
26
+ p.href ? (
27
+ <LinkButton href={p.href} icon={p.icon} variant={buttonVariant.link} class="pl-0">
28
+ {p.title}
29
+ </LinkButton>
30
+ ) : (
31
+ p.title
32
+ )
33
+ }
34
+ </h2>
35
+ {p.subtitle && <p class={classMerge("text-lg", p.subtitleClass)}>{p.subtitle}</p>}
36
+ <slot />
37
+ </div>
@@ -0,0 +1,26 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { classMerge } from "~ui/utils/classMerge"
4
+
5
+ interface Props {
6
+ id?: string
7
+ pathId?: string
8
+ path: string
9
+ class?: string
10
+ title?: string
11
+ ariaHidden?: boolean
12
+ restProps?: HTMLAttributes<"svg">
13
+ }
14
+ const p = Astro.props
15
+ const ariaHidden = p.ariaHidden ?? !p.title
16
+ ---
17
+
18
+ <svg
19
+ id={p.id}
20
+ viewBox={"0 0 24 24"}
21
+ aria-hidden={ariaHidden}
22
+ class={classMerge("size-6 flex-shrink-0 align-middle dark:fill-white", p.class)}
23
+ {...p.restProps}
24
+ >
25
+ <path id={p.pathId} d={p.path}></path>
26
+ </svg>
@@ -0,0 +1,4 @@
1
+ /**
2
+ * https://authjs.dev/img/providers/github.svg
3
+ */
4
+ export const iconGithub = "M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"
@@ -0,0 +1,4 @@
1
+ /**
2
+ * https://authjs.dev/img/providers/google.svg
3
+ */
4
+ export const iconGoogle = "M21.35,11.1H12.18V13.83H18.69C18.36,17.64 15.19,19.27 12.19,19.27C8.36,19.27 5,16.25 5,12C5,7.9 8.2,4.73 12.2,4.73C15.29,4.73 17.1,6.7 17.1,6.7L19,4.72C19,4.72 16.56,2 12.1,2C6.42,2 2.03,6.8 2.03,12C2.03,17.05 6.16,22 12.25,22C17.6,22 21.5,18.33 21.5,12.91C21.5,11.76 21.35,11.1 21.35,11.1V11.1Z"
@@ -0,0 +1,2 @@
1
+ export const iconLinkedin =
2
+ "m3 4.29c0-.712.592-1.29 1.32-1.29h15.4c.73 0 1.32.577 1.32 1.29v15.4c0 .712-.592 1.29-1.32 1.29h-15.4c-.73 0-1.32-.577-1.32-1.29zm5.56 13.8v-8.13h-2.7v8.13zm-1.35-9.24c.942 0 1.53-.623 1.53-1.4-.0169-.798-.585-1.4-1.51-1.4-.925 0-1.53.608-1.53 1.4 0 .781.586 1.4 1.49 1.4zm5.52 9.24v-4.54c0-.243.018-.486.09-.659.195-.485.639-.988 1.39-.988.978 0 1.37.745 1.37 1.84v4.35h2.7v-4.66c0-2.5-1.33-3.66-3.11-3.66-1.43 0-2.08.788-2.44 1.34v.0281h-.018l.018-.0281v-1.15h-2.7c.0337.763 0 8.13 0 8.13z"
@@ -0,0 +1,2 @@
1
+ export const iconNpm =
2
+ "M4,10V14H6V11H7V14H8V10H4M9,10V15H11V14H13V10H9M12,11V13H11V11H12M14,10V14H16V11H17V14H18V11H19V14H20V10H14M3,9H21V15H12V16H8V15H3V9Z"
@@ -0,0 +1,2 @@
1
+ export const iconTelegram =
2
+ "M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"
@@ -0,0 +1,2 @@
1
+ export const iconTrello =
2
+ "m18.9 3h-13.7c-1.18.00289-2.14.959-2.14 2.14v13.7c.00289 1.18.959 2.14 2.14 2.14h13.7c1.18-.0029 2.14-.959 2.14-2.14v-13.7c-.0029-1.18-.959-2.14-2.14-2.14zm-8.11 13c0 .19-.0753.371-.209.506-.134.134-.316.209-.505.209h-3c-.395 0-.715-.32-.716-.715v-8.93c0-.19.0754-.372.21-.506s.316-.209.506-.209h3c.395.00041.714.32.715.715zm6.92-4.1c7e-4.189-.0746.371-.209.504s-.316.208-.506.206h-3c-.189.0011-.371-.0732-.505-.206-.134-.133-.21-.315-.21-.504v-4.83c1e-4-.395.32-.715.715-.715h3c.395.00041.714.32.715.715z"
@@ -0,0 +1 @@
1
+ export const iconXcom = "m13.9 10.4 7.45-8.65h-1.76l-6.46 7.51-5.16-7.51h-5.96l7.81 11.4-7.81 9.08h1.76l6.83-7.94 5.45 7.94h5.96zm-2.42 2.81-7.09-10.1h2.71l12.5 17.8h-2.71z"
package/lib/img/Img.astro CHANGED
@@ -1,6 +1,7 @@
1
1
  ---
2
+ import type { HTMLAttributes } from "astro/types"
2
3
  import { classesImgZoomInOnHover10 } from "./classesImgZoomInOnHover10"
3
- import { classMerge } from "~/utils/ui/classMerge"
4
+ import { classMerge } from "~ui/utils/classMerge"
4
5
 
5
6
  interface Props {
6
7
  alt: string
@@ -10,8 +11,9 @@ interface Props {
10
11
  size?: number
11
12
  width?: number | null | undefined
12
13
  height?: number | null | undefined
13
- loadingLazy?:boolean
14
- decodeAsync?:boolean
14
+ loadingLazy?: boolean
15
+ decodeAsync?: boolean
16
+ restProps?: HTMLAttributes<"img">
15
17
  }
16
18
  const p = Astro.props
17
19
  ---
@@ -20,8 +22,9 @@ const p = Astro.props
20
22
  src={p.src}
21
23
  alt={p.alt}
22
24
  class={classMerge(p.zoomIn && classesImgZoomInOnHover10, p.class)}
23
- loading={p.loadingLazy ?? true ? "lazy" : undefined}
24
- decoding={p.decodeAsync ?? true ? "async" : undefined}
25
+ loading={(p.loadingLazy ?? true) ? "lazy" : undefined}
26
+ decoding={(p.decodeAsync ?? true) ? "async" : undefined}
25
27
  width={p.size ?? p.width}
26
28
  height={p.size ?? p.height}
29
+ {...p.restProps}
27
30
  />
@@ -1,29 +1,28 @@
1
1
  ---
2
- import { classArr } from "~/utils/ui/classArr"
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { classInvertBlack } from "~ui/img/classInvertBlack"
4
+ import { classArr } from "~ui/utils/classArr"
3
5
  import type { ImageType } from "./ImageType"
4
6
  import Img from "./Img.astro"
5
- import { classInvertBlack } from "~/img/classInvertBlack"
6
7
 
7
8
  interface Props {
8
9
  img: ImageType
9
10
  zoomIn?: boolean
10
11
  invertColorsInDarkMode?: boolean
11
12
  class?: string
13
+ srcPrefix?: string
14
+ restProps?: HTMLAttributes<"img">
12
15
  }
13
16
  const p = Astro.props
14
17
  const isSvg = p.img.path.endsWith(".svg")
15
- // const invert = isSvg && p.invertColorsInDarkMode
16
- const invert = p.invertColorsInDarkMode
17
-
18
- function imageUrl(p: string) {
19
- return "/media-b2/" + p
20
- }
18
+ const imageUrl = (p.srcPrefix ? p.srcPrefix : "") + p.img.path
21
19
  ---
22
20
 
23
21
  <Img
24
- src={imageUrl(p.img.path)}
22
+ src={imageUrl}
25
23
  alt={p.img.alt}
26
- class={classArr(invert ? classInvertBlack : "", p.class)}
24
+ class={classArr(p.invertColorsInDarkMode ? classInvertBlack : "", p.class)}
27
25
  width={isSvg ? null : p.img.width}
28
26
  height={isSvg ? null : p.img.height}
27
+ restProps={p.restProps}
29
28
  />
@@ -0,0 +1,23 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import type { ImageType } from "./ImageType"
4
+ import TypedImg from "~ui/img/TypedImg.astro"
5
+
6
+ interface Props {
7
+ img: ImageType
8
+ zoomIn?: boolean
9
+ invertColorsInDarkMode?: boolean
10
+ class?: string
11
+ restProps?: HTMLAttributes<"img">
12
+ }
13
+ const p = Astro.props
14
+ ---
15
+
16
+ <TypedImg
17
+ img={p.img}
18
+ srcPrefix="/media-b2/"
19
+ zoomIn={p.zoomIn}
20
+ invertColorsInDarkMode={p.invertColorsInDarkMode}
21
+ class={p.class}
22
+ restProps={p.restProps}
23
+ />
@@ -0,0 +1,19 @@
1
+ ---
2
+ import { classMerge } from "~ui/utils/classMerge"
3
+ import { classesCardWrapperPage } from "~ui/card/classesCardWrapper"
4
+ import MarkdownDiv from "~ui/md/MarkdownDiv.astro"
5
+ import PageCentered from "~ui/page/PageCentered.astro"
6
+
7
+ interface Props {
8
+ class?: string
9
+ innerClass?: string
10
+ }
11
+
12
+ const p = Astro.props
13
+ ---
14
+
15
+ <PageCentered class={classMerge("max-w-5xl my-12", p.class)}>
16
+ <MarkdownDiv class={classMerge(classesCardWrapperPage, p.innerClass)}>
17
+ <slot />
18
+ </MarkdownDiv>
19
+ </PageCentered>
@@ -1,20 +1,23 @@
1
1
  ---
2
- import { classArr } from "../utils/ui/classArr"
3
- import { objectKeys } from "~/utils/obj/objectKeys"
4
- import TailwindIndicator from "~/dev/TailwindIndicator.astro"
2
+ import TailwindIndicator from "~ui/dev/TailwindIndicator.astro"
3
+
4
+ import { classMerge } from "~ui/utils/classMerge"
5
+ import { classArr } from "../utils/classArr"
5
6
 
6
7
  export interface Props {
8
+ lang?: string
7
9
  title: string
8
10
  description?: string
9
11
  meta?: Record<string, string>
10
12
  class?: string
13
+ bodyClass?: string
11
14
  }
12
15
 
13
- const props = Astro.props
16
+ const p = Astro.props
14
17
  ---
15
18
 
16
19
  <!doctype html>
17
- <html lang="en">
20
+ <html lang={p.lang ?? "en"}>
18
21
  <head>
19
22
  <!-- Base -->
20
23
  <meta charset="UTF-8" />
@@ -22,8 +25,8 @@ const props = Astro.props
22
25
  <meta name="generator" content={Astro.generator} />
23
26
 
24
27
  <!-- Site -->
25
- <title>{props.title}</title>
26
- {props.description && <meta name="description" content={props.description} />}
28
+ <title>{p.title}</title>
29
+ {p.description && <meta name="description" content={p.description} />}
27
30
 
28
31
  <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
29
32
 
@@ -38,25 +41,29 @@ const props = Astro.props
38
41
  <meta name="googlebot" content="index, follow" />
39
42
 
40
43
  {
41
- props.meta && (
44
+ p.meta && (
42
45
  <Fragment>
43
- {objectKeys(props.meta).map((k) => (
44
- <meta property={k} content={props.meta![k]} />
46
+ {Object.entries(p.meta).map(([k, v]) => (
47
+ <meta property={k} content={v} />
45
48
  ))}
46
49
  </Fragment>
47
50
  )
48
51
  }
52
+ <slot name="head" />
49
53
  </head>
50
- <body class="min-h-dvh w-full font-sans antialiased bg-background text-foreground">
54
+ <body
55
+ class={classMerge(
56
+ "min-h-dvh w-full", // full screen
57
+ "font-sans antialiased text-foreground", // text
58
+ p.bodyClass,
59
+ )}
60
+ >
51
61
  <slot name="navbar" />
52
62
  <main
53
63
  id="main"
54
64
  class={classArr(
55
- "relative min-h-dvh",
56
- "w-full",
57
- "flex flex-col items-center",
58
- props.class,
59
- //
65
+ "relative min-h-dvh w-full", // full screen
66
+ p.class,
60
67
  )}
61
68
  >
62
69
  <slot />
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  import { mdiMoonWaxingCrescent, mdiWhiteBalanceSunny } from "@mdi/js"
3
- import { buttonVariant, type ButtonVariant } from "~/button/buttonCva"
4
- import Button from "~/button/Button.astro"
5
- import Icon1 from "~/icon/Icon1.astro"
6
- import { classArr } from "~/utils/ui/classArr"
7
- import { astroElementId } from "~/layouts/parts/astroElementId"
3
+ import { buttonVariant, type ButtonVariant } from "~ui/button/buttonCva"
4
+ import Button from "~ui/button/Button.astro"
5
+ import Icon from "~ui/icon/Icon.astro"
6
+ import { classArr } from "~ui/utils/classArr"
7
+ import { astroElementId } from "~ui/layouts/parts/astroElementId"
8
8
 
9
9
  /*
10
10
  * have to use "is:inline" script to run/apply theme before page render -> white flash on page reload otherwise
@@ -40,10 +40,10 @@ const textDark = p.textDark ?? "Dark"
40
40
  class={classArr(p.class)}
41
41
  contentClass={classArr("flex flex-row gap-1")}
42
42
  >
43
- <Icon1 path={mdiWhiteBalanceSunny} class={classArr("size-6 dark:hidden mr-2", p.iconClass, p.iconLightClass)} />
44
- <Icon1 path={mdiMoonWaxingCrescent} class={classArr("hidden size-6 dark:block mr-2", p.iconClass, p.iconDarkClass)} />
45
- <p id="theme-toggle-text-light" class={classArr("dark:hidden", p.textClass, p.textLightClass)}>{textLight}</p>
46
- <p id="theme-toggle-text-dark" class={classArr("hidden dark:block", p.textClass, p.textDarkClass)}>{textDark}</p>
43
+ <Icon path={mdiWhiteBalanceSunny} class={classArr("size-6 dark:hidden mr-2", p.iconClass, p.iconLightClass)} />
44
+ <Icon path={mdiMoonWaxingCrescent} class={classArr("hidden size-6 dark:block mr-2", p.iconClass, p.iconDarkClass)} />
45
+ <span id="theme-toggle-text-light" class={classArr("dark:hidden", p.textClass, p.textLightClass)}>{textLight}</span>
46
+ <span id="theme-toggle-text-dark" class={classArr("hidden dark:block", p.textClass, p.textDarkClass)}>{textDark}</span>
47
47
  </Button>
48
48
 
49
49
  <script is:inline>
@@ -1,8 +1,9 @@
1
1
  ---
2
- import { buttonCva2, buttonVariant, type ButtonSize, type ButtonVariant } from "~/button/buttonCva"
3
- import { buttonIconCva } from "~/button/buttonIconCva"
4
- import { classesButtonClickAnimation } from "~/button/classesButtonClickAnimation"
5
- import Icon1 from "~/icon/Icon1.astro"
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { buttonCva2, buttonVariant, type ButtonSize, type ButtonVariant } from "~ui/button/buttonCva"
4
+ import { buttonIconCva } from "~ui/button/buttonIconCva"
5
+ import { classesButtonClickAnimation } from "~ui/button/classesButtonClickAnimation"
6
+ import Icon from "~ui/icon/Icon.astro"
6
7
 
7
8
  interface Props {
8
9
  title?: string
@@ -16,32 +17,30 @@ interface Props {
16
17
  class?: string
17
18
  id?: string
18
19
  clickAnimation?: boolean
20
+ restProps?: HTMLAttributes<"a">
19
21
  }
20
- const props = Astro.props
22
+ const p = Astro.props
21
23
  const hasChildren = Astro.slots.has("default")
22
24
  const classes = buttonCva2(
23
- props.variant ?? buttonVariant.link,
24
- props.size,
25
- props.clickAnimation ?? classesButtonClickAnimation,
26
- props.class,
25
+ p.variant ?? buttonVariant.link,
26
+ p.size,
27
+ p.clickAnimation ?? classesButtonClickAnimation,
28
+ p.class,
27
29
  )
28
30
  ---
29
31
 
30
- <a href={props.href} class={classes} target={props.newTab ? "_blank" : undefined} id={props.id} title={props.title}>
32
+ <a href={p.href} class={classes} target={p.newTab ? "_blank" : undefined} id={p.id} title={p.title} {...p.restProps}>
31
33
  {
32
- props.icon && (
33
- <Icon1
34
- path={props.icon}
35
- class={buttonIconCva(props.variant ?? "link", (props.title || hasChildren) && "mr-2", props.iconClass)}
36
- />
34
+ p.icon && (
35
+ <Icon path={p.icon} class={buttonIconCva(p.variant ?? "link", (p.title || hasChildren) && "mr-2", p.iconClass)} />
37
36
  )
38
37
  }
39
38
  <slot />
40
39
  {
41
- props.iconRight && (
42
- <Icon1
43
- path={props.iconRight}
44
- class={buttonIconCva(props.variant ?? "link", (props.title || hasChildren) && "ml-2", props.iconClass)}
40
+ p.iconRight && (
41
+ <Icon
42
+ path={p.iconRight}
43
+ class={buttonIconCva(p.variant ?? "link", (p.title || hasChildren) && "ml-2", p.iconClass)}
45
44
  />
46
45
  )
47
46
  }
@@ -1,23 +1,26 @@
1
1
  ---
2
- import { classMerge } from "~/utils/ui/classMerge"
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import { classMerge } from "~ui/utils/classMerge"
3
4
 
4
5
  interface Props {
5
6
  title?: string
6
7
  href: string
7
8
  newTab?: boolean
8
9
  class?: string
10
+ restProps?: HTMLAttributes<"a">
9
11
  }
10
- const props = Astro.props
11
- const title = props.title
12
- const href = props.href
13
- const newTab = props.newTab
12
+ const p = Astro.props
13
+ const title = p.title
14
+ const href = p.href
15
+ const newTab = p.newTab
14
16
  ---
15
17
 
16
18
  <a
17
19
  href={href}
18
- class={classMerge("text-blue-500 no-underline hover:underline", props.class)}
20
+ class={classMerge("text-blue-500 no-underline hover:underline", p.class)}
19
21
  target={newTab ? "_blank" : undefined}
20
22
  title={title}
23
+ {...p.restProps}
21
24
  >
22
- <slot/>
25
+ <slot />
23
26
  </a>
@@ -1,4 +1,4 @@
1
- import { classArr } from "../utils/ui/classArr"
1
+ import { classArr } from "../utils/classArr"
2
2
 
3
3
  export const classesTextLink = classArr(
4
4
  "text-blue-600 hover:text-black", // light
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { classMerge } from "~/utils/ui/classMerge"
2
+ import { classMerge } from "~ui/utils/classMerge"
3
3
 
4
4
  interface Props {
5
5
  class?: string
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import { mdiCircle } from "@mdi/js"
3
- import { classMerge } from "~/utils/ui/classMerge"
3
+ import Icon from "~ui/icon/Icon.astro"
4
+ import { classMerge } from "~ui/utils/classMerge"
4
5
  import TextOrLink from "./TextOrLink.astro"
5
- import Icon1 from "~/icon/Icon1.astro"
6
6
 
7
7
  interface Props {
8
8
  points: string[] | Readonly<string[]>
@@ -10,14 +10,14 @@ interface Props {
10
10
  classText?: string
11
11
  classBullet?: string
12
12
  }
13
- const props = Astro.props
13
+ const p = Astro.props
14
14
  ---
15
15
 
16
16
  {
17
- props.points.map((p) => (
18
- <div class={classMerge("flex flex-row flex-nowrap", props.class)}>
19
- <Icon1 path={mdiCircle} class={classMerge("w-1.5 h-1.5 mt-3 mx-1.5 shrink-0", props.classBullet)} />
20
- <TextOrLink text={p} class={props.classText} />
17
+ p.points.map((point) => (
18
+ <div class={classMerge("flex gap-1", p.class)}>
19
+ <Icon path={mdiCircle} class={classMerge("size-1.5 mt-2.5 shrink-0", p.classBullet)} />
20
+ <TextOrLink text={point} class={p.classText} />
21
21
  </div>
22
22
  ))
23
23
  }
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import { mdiCheck } from "@mdi/js"
3
- import { classMerge } from "~/utils/ui/classMerge"
3
+ import { classMerge } from "~ui/utils/classMerge"
4
4
  import TextOrLink from "./TextOrLink.astro"
5
- import Icon1 from "~/icon/Icon1.astro"
5
+ import Icon from "~ui/icon/Icon.astro"
6
6
 
7
7
  interface Props {
8
8
  point: string
@@ -14,7 +14,7 @@ const p = Astro.props
14
14
  ---
15
15
 
16
16
  <div class={classMerge("flex flex-row flex-nowrap", p.class)}>
17
- <Icon1 path={mdiCheck} class={classMerge("fill-green-600 dark:fill-green-600 mr-1 flex-none", p.classBullet)} />
17
+ <Icon path={mdiCheck} class={classMerge("fill-green-600 dark:fill-green-600 mr-1 flex-none", p.classBullet)} />
18
18
  <TextOrLink text={p.point} class={p.classText} />
19
19
  <slot />
20
20
  </div>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import { mdiCheck } from "@mdi/js"
3
- import { classMerge } from "~/utils/ui/classMerge"
4
- import Icon1 from "~/icon/Icon1.astro"
3
+ import { classMerge } from "~ui/utils/classMerge"
4
+ import Icon from "~ui/icon/Icon.astro"
5
5
  import TextOrLink from "./TextOrLink.astro"
6
6
 
7
7
  interface Props {
@@ -16,7 +16,7 @@ const props = Astro.props
16
16
  {
17
17
  props.points.map((p) => (
18
18
  <div class={classMerge("flex flex-row flex-nowrap", props.class)}>
19
- <Icon1 path={mdiCheck} class={classMerge("fill-green-600 dark:fill-green-600 mr-1 flex-none", props.classBullet)} />
19
+ <Icon path={mdiCheck} class={classMerge("fill-green-600 dark:fill-green-600 mr-1 flex-none", props.classBullet)} />
20
20
  <TextOrLink text={p} class={props.classText} />
21
21
  </div>
22
22
  ))
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { classMerge } from "~/utils/ui/classMerge"
2
+ import { classMerge } from "~ui/utils/classMerge"
3
3
 
4
4
  interface Props {
5
5
  points: string[] | Readonly<string[]>
package/lib/list/Ps.astro CHANGED
@@ -1,12 +1,15 @@
1
1
  ---
2
- interface Props {
3
- lines: string[] | Readonly<string[]>
2
+ import type { MayHaveClass } from "~ui/utils/MayHaveClass"
3
+
4
+ interface Props extends MayHaveClass {
5
+ text?: string
6
+ lines?: string[]
4
7
  class?: string
5
8
  }
6
- const props = Astro.props
7
- const lines = props.lines
9
+ const p = Astro.props
10
+ const lines = p.lines ?? (p.text ? p.text.split("\n") : [])
8
11
  ---
9
12
 
10
13
  <>
11
- {lines.map((line) => <p class={props.class}>{line}</p>)}
14
+ {lines.map((line) => <p class={p.class}>{line}</p>)}
12
15
  </>
@@ -1,6 +1,6 @@
1
1
  ---
2
- import LinkText from "~/link/LinkText.astro"
3
- import { classMerge } from "~/utils/ui/classMerge"
2
+ import LinkText from "~ui/link/LinkText.astro"
3
+ import { classMerge } from "~ui/utils/classMerge"
4
4
 
5
5
  interface Props {
6
6
  text: string
@@ -10,10 +10,4 @@ const props = Astro.props
10
10
  const text = props.text
11
11
  ---
12
12
 
13
- {
14
- text.startsWith("http") ? (
15
- <LinkText href={text}>{text}</LinkText>
16
- ) : (
17
- <p class={classMerge("leading-relaxed", props.class)}>{text}</p>
18
- )
19
- }
13
+ {text.startsWith("http") ? <LinkText href={text}>{text}</LinkText> : <p class={classMerge(props.class)}>{text}</p>}
@@ -0,0 +1,18 @@
1
+ ---
2
+ import { classArr } from "~ui/utils/classArr"
3
+
4
+ import type { HTMLAttributes } from "astro/types"
5
+ import "./markdown.css"
6
+
7
+ interface Props {
8
+ id?: string
9
+ class?: string
10
+ restProps?: HTMLAttributes<"div">
11
+ }
12
+
13
+ const p = Astro.props
14
+ ---
15
+
16
+ <div id={p.id} class={classArr("markdown-body", p.class)} {...p.restProps}>
17
+ <slot />
18
+ </div>
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  import "./Modal.module.css"
3
- import { classesTextHeader } from "~/text/classesTextHeader"
4
- import { classMerge } from "~/utils/ui/classMerge"
5
- import { buttonVariant } from "~/button/buttonCva"
6
- import Button from "~/button/Button.astro"
3
+ import { classesTextHeader } from "~ui/text/classesTextHeader"
4
+ import { classMerge } from "~ui/utils/classMerge"
5
+ import { buttonVariant } from "~ui/button/buttonCva"
6
+ import Button from "~ui/button/Button.astro"
7
7
 
8
8
  /**
9
9
  * https://github.com/markteekman/accessible-astro-components/blob/main/Modal.astro