@adaptive-sm/astro-ui 0.1.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 (101) hide show
  1. package/README.md +52 -12
  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 +6 -6
  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 +20 -15
  15. package/lib/dev/TailwindIndicator.astro +2 -2
  16. package/lib/form/Fieldset.astro +8 -5
  17. package/lib/generate_demo_list/DemoList.astro +8 -6
  18. package/lib/generate_demo_list/generateDemoList.ts +2 -2
  19. package/lib/generate_image_list/generateImageList.ts +27 -3
  20. package/lib/grid/FeatureGridSection.astro +73 -0
  21. package/lib/grid/GridFeatureType.ts +5 -0
  22. package/lib/grid/classesGridCols.ts +27 -2
  23. package/lib/header/PageHeader.astro +25 -0
  24. package/lib/header/SectionHeader.astro +37 -0
  25. package/lib/icon/Icon.astro +26 -0
  26. package/lib/icons/iconGithub.ts +4 -0
  27. package/lib/icons/iconGoogle.ts +4 -0
  28. package/lib/icons/iconLinkedin.ts +2 -0
  29. package/lib/icons/iconNpm.ts +2 -0
  30. package/lib/icons/iconTelegram.ts +2 -0
  31. package/lib/icons/iconTrello.ts +2 -0
  32. package/lib/icons/iconXcom.ts +1 -0
  33. package/lib/img/ImageType.ts +1 -0
  34. package/lib/img/Img.astro +10 -7
  35. package/lib/img/TypedImg.astro +15 -13
  36. package/lib/img/TypedImgB2.astro +23 -0
  37. package/lib/img/classInvertBlack.ts +1 -0
  38. package/lib/img/classesImgZoomInOnHover10.ts +1 -0
  39. package/lib/img/classesImgZoomInOnHover5.ts +1 -0
  40. package/lib/layouts/MarkdownPageWrapper.astro +19 -0
  41. package/lib/layouts/MinimalLayout.astro +23 -16
  42. package/lib/layouts/parts/ThemeToggle.astro +10 -10
  43. package/lib/link/LinkButton.astro +18 -19
  44. package/lib/link/LinkText.astro +10 -7
  45. package/lib/link/classesTextLink.ts +1 -1
  46. package/lib/list/BlackBulletPoint.astro +1 -1
  47. package/lib/list/BlackBulletPoints.astro +7 -7
  48. package/lib/list/CheckPoint.astro +3 -3
  49. package/lib/list/CheckPoints.astro +3 -3
  50. package/lib/list/NumberedList.astro +1 -1
  51. package/lib/list/Ps.astro +8 -5
  52. package/lib/list/TextOrLink.astro +3 -9
  53. package/lib/md/MarkdownDiv.astro +18 -0
  54. package/lib/modal/Modal.astro +4 -4
  55. package/lib/modal/ModalButton.astro +24 -11
  56. package/lib/page/PageCentered.astro +5 -3
  57. package/lib/page/PageCenteredCard.astro +7 -5
  58. package/lib/page/{classesBg.ts → classesBg100.ts} +2 -2
  59. package/lib/page/classesBg50.ts +27 -0
  60. package/lib/page/classesPageCentered.ts +1 -1
  61. package/lib/popover/Popover1.astro +4 -4
  62. package/lib/select/Select.astro +14 -10
  63. package/lib/table/Table.astro +2 -2
  64. package/lib/table/TableD.astro +2 -2
  65. package/lib/table/TableM.astro +2 -2
  66. package/lib/table/TableMEntry.astro +2 -2
  67. package/lib/table/tableVisibilityClasses.ts +3 -3
  68. package/lib/utils/HasId.ts +3 -0
  69. package/lib/utils/HasSubtitle.ts +4 -0
  70. package/lib/utils/HasTitle.ts +4 -0
  71. package/lib/utils/MayHaveButtonVariant.ts +5 -0
  72. package/lib/utils/MayHaveClass.ts +3 -0
  73. package/lib/utils/MayHaveIcon.ts +4 -0
  74. package/lib/utils/MayHaveId.ts +3 -0
  75. package/lib/utils/MayHaveInnerClass.ts +3 -0
  76. package/lib/utils/MayHaveSubtitle.ts +4 -0
  77. package/lib/utils/MayHaveTitle.ts +4 -0
  78. package/package.json +19 -14
  79. package/lib/icon/Icon1.astro +0 -21
  80. package/lib/img/classInvertDiagram.ts +0 -1
  81. package/lib/img/classesImgZoomInOnHover.ts +0 -1
  82. package/lib/layouts/MarkdownWrapper.astro +0 -17
  83. package/lib/utils/bun/BunCmd.ts +0 -7
  84. package/lib/utils/bun/cryAndTryAgainLater.ts +0 -6
  85. package/lib/utils/bun/logBunCmd.ts +0 -1
  86. package/lib/utils/bun/runCmdAsync.ts +0 -44
  87. package/lib/utils/bun/runCmdLocally.ts +0 -13
  88. package/lib/utils/obj/objectKeys.ts +0 -21
  89. package/lib/utils/ran/generateId12.ts +0 -7
  90. package/lib/utils/ran/generateId3.ts +0 -7
  91. package/lib/utils/ran/generateId4.ts +0 -7
  92. package/lib/utils/ran/generateId5.ts +0 -7
  93. package/lib/utils/ran/generateId6.ts +0 -7
  94. package/lib/utils/ran/generateId7.ts +0 -7
  95. package/lib/utils/ran/generateReadableId.ts +0 -35
  96. package/lib/utils/ran/urlAlphabet32.ts +0 -8
  97. /package/lib/{layouts/parts → md}/markdown.css +0 -0
  98. /package/lib/utils/{ui/classArr.ts → classArr.ts} +0 -0
  99. /package/lib/utils/{ui/classMerge.ts → classMerge.ts} +0 -0
  100. /package/lib/utils/{ui/isDevEnv.ts → isDevEnv.ts} +0 -0
  101. /package/lib/utils/{ui/tailwindBreakpoint.ts → tailwindBreakpoint.ts} +0 -0
@@ -1,17 +0,0 @@
1
- ---
2
- import PageCenteredCard from "~/page/PageCenteredCard.astro"
3
- import { classMerge } from "~/utils/ui/classMerge"
4
- import { classArr } from "~/utils/ui/classArr"
5
-
6
- import "./parts/markdown.css"
7
-
8
- interface Props {
9
- class?: string
10
- }
11
-
12
- const p = Astro.props
13
- ---
14
-
15
- <PageCenteredCard class={classMerge("max-w-5xl my-12", p.class)} classInner={classArr("markdown-body", p.class)}>
16
- <slot />
17
- </PageCenteredCard>
@@ -1,7 +0,0 @@
1
- export type BunCmd = {
2
- cmd: string[]
3
- success: boolean
4
- exitCode: number
5
- lines: string[]
6
- ms: number
7
- }
@@ -1,6 +0,0 @@
1
- import process from "node:process"
2
-
3
- export function cryAndTryAgainLater<T>(t: T): T {
4
- process.exit(1)
5
- return t
6
- }
@@ -1 +0,0 @@
1
- export const logBunCmd = true
@@ -1,44 +0,0 @@
1
- import console from "node:console"
2
- import type { BunCmd } from "./BunCmd"
3
- import { logBunCmd } from "./logBunCmd"
4
-
5
- export async function runCmdAsync(cmd: string[]): Promise<BunCmd> {
6
- const startedAt = performance.now()
7
- if (logBunCmd) {
8
- console.log({ cmd })
9
- }
10
- const process = Bun.spawn(cmd, {
11
- stdout: "pipe",
12
- stderr: "pipe",
13
- })
14
- const exitCode = await process.exited
15
- const output = await Bun.readableStreamToText(process.stdout)
16
- const error = await Bun.readableStreamToText(process.stderr)
17
- const outputLines = output.split("\n").filter((s) => s.length > 0)
18
- const errorLines = error.split("\n").filter((s) => s.length > 0)
19
- const lines = [...outputLines, ...errorLines]
20
- const endedAt = performance.now()
21
- const ms = Math.round(endedAt - startedAt)
22
- const r: BunCmd = {
23
- cmd,
24
- success: exitCode === 0,
25
- exitCode,
26
- lines,
27
- ms,
28
- }
29
- if (logBunCmd) {
30
- if (lines.length < 8) {
31
- console.log(r)
32
- } else {
33
- const l: Omit<BunCmd, "lines"> = {
34
- cmd,
35
- success: exitCode === 0,
36
- exitCode,
37
- ms,
38
- }
39
- console.log(l)
40
- console.log(JSON.stringify(lines, null, 2))
41
- }
42
- }
43
- return r
44
- }
@@ -1,13 +0,0 @@
1
- import type { BunCmd } from "./BunCmd"
2
- import { cryAndTryAgainLater } from "./cryAndTryAgainLater"
3
- import { runCmdAsync } from "./runCmdAsync"
4
-
5
- export async function runCmdLocally(cmd: string | string[]): Promise<BunCmd> {
6
- return runCmdAsync(["sh", "-c", Array.isArray(cmd) ? cmd.join(" ") : cmd])
7
- }
8
-
9
- export async function runCmdLocallyAndExitOnError(cmd: string | string[]): Promise<BunCmd> {
10
- const got = await runCmdLocally(cmd)
11
- if (!got.success) return cryAndTryAgainLater(got)
12
- return got
13
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Like Object.keys, but unsound in exchange for more convenience.
3
- *
4
- * Casts the result of Object.keys to the known keys of an object type,
5
- * even though JavaScript objects may contain additional keys.
6
- *
7
- * Only use this function when you know/control the provenance of the object
8
- * you're iterating, and can verify it contains exactly the keys declared
9
- * to the type system.
10
- *
11
- * Example:
12
- * ```
13
- * const o = {x: "ok", y: 10}
14
- * o["z"] = "UNTRACKED_KEY"
15
- * const safeKeys = Object.keys(o)
16
- * const unsafeKeys = objectKeys(o)
17
- * ```
18
- * => const safeKeys: string[]
19
- * => const unsafeKeys: ("x" | "y")[] // Missing "z"
20
- */
21
- export const objectKeys = Object.keys as <T>(obj: T) => Array<keyof T>
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "~/utils/ran/generateReadableId"
2
-
3
- const gen = generateReadableId(12)
4
-
5
- export function generateId12(): string {
6
- return gen()
7
- }
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "~/utils/ran/generateReadableId"
2
-
3
- const gen = generateReadableId(3)
4
-
5
- export function generateId3(): string {
6
- return gen()
7
- }
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "~/utils/ran/generateReadableId"
2
-
3
- const gen = generateReadableId(4)
4
-
5
- export function generateId4(): string {
6
- return gen()
7
- }
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "./generateReadableId"
2
-
3
- const gen = generateReadableId(5)
4
-
5
- export function generateId5(): string {
6
- return gen()
7
- }
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "~/utils/ran/generateReadableId"
2
-
3
- const gen = generateReadableId(6)
4
-
5
- export function generateId6(): string {
6
- return gen()
7
- }
@@ -1,7 +0,0 @@
1
- import { generateReadableId } from "~/utils/ran/generateReadableId"
2
-
3
- const gen = generateReadableId(7)
4
-
5
- export function generateId7(): string {
6
- return gen()
7
- }
@@ -1,35 +0,0 @@
1
- import { urlAlphabet32 } from "./urlAlphabet32"
2
-
3
- /**
4
- * * works in browser
5
- * * completely random, not sequential as a feature
6
- * * 32 chars: url friendly, readable, not disambiguate
7
- * * variable length
8
- * * uses secure crypto/web-crypto/node:crypto api
9
- * * generates in batches of 4 for better perf
10
- * @param len - character amount
11
- */
12
- export function generateReadableId(len: number = 16): () => string {
13
- const arr = new Uint16Array(Math.ceil(len / 4))
14
- return () => {
15
- crypto.getRandomValues(arr)
16
- let r = ""
17
- for (const a of arr) {
18
- const n1 = (a >> 9) % 32
19
- r += urlAlphabet32[n1]!
20
- if (r.length >= len) return r
21
-
22
- const n2 = (a >> 6) % 32
23
- r += urlAlphabet32[n2]!
24
-
25
- if (r.length >= len) return r
26
- const n3 = (a >> 3) % 32
27
- r += urlAlphabet32[n3]!
28
-
29
- if (r.length >= len) return r
30
- const n4 = a % 32
31
- r += urlAlphabet32[n4]!
32
- }
33
- return r
34
- }
35
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * - calculate strength - https://zelark.github.io/nano-id-cc/
3
- * - remove 0, O, i, l for better readability and no disambiguity
4
- * - 32 length = 10 (numbers) - 1 (no zero) + 26 (alphabet) - 3 (i,l,o)
5
- * - ignores casing
6
- * - Crockford's Base32 - https://www.crockford.com/base32.html
7
- */
8
- export const urlAlphabet32 = "123456789abcdefghjkmnpqrstuvwxyz"
File without changes
File without changes
File without changes
File without changes