@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.
- package/README.md +52 -12
- package/lib/badge/Badge.astro +27 -0
- package/lib/badge/classesBadge.ts +67 -0
- package/lib/button/Button.astro +17 -27
- package/lib/button/buttonCva.ts +6 -6
- package/lib/button/buttonIconCva.ts +2 -2
- package/lib/button/classesButtonClickAnimation.ts +1 -1
- package/lib/button/classesButtonClickAnimationPush.ts +1 -1
- package/lib/button/classesButtonClickAnimationSquish.ts +1 -1
- package/lib/card/CardWrapper.astro +6 -5
- package/lib/card/classesBorderWrapper.ts +1 -0
- package/lib/card/classesCardWrapper.ts +21 -9
- package/lib/card/classesShadow.ts +5 -0
- package/lib/details/Details.astro +20 -15
- package/lib/dev/TailwindIndicator.astro +2 -2
- package/lib/form/Fieldset.astro +8 -5
- package/lib/generate_demo_list/DemoList.astro +8 -6
- package/lib/generate_demo_list/generateDemoList.ts +2 -2
- package/lib/generate_image_list/generateImageList.ts +27 -3
- package/lib/grid/FeatureGridSection.astro +73 -0
- package/lib/grid/GridFeatureType.ts +5 -0
- package/lib/grid/classesGridCols.ts +27 -2
- package/lib/header/PageHeader.astro +25 -0
- package/lib/header/SectionHeader.astro +37 -0
- package/lib/icon/Icon.astro +26 -0
- package/lib/icons/iconGithub.ts +4 -0
- package/lib/icons/iconGoogle.ts +4 -0
- package/lib/icons/iconLinkedin.ts +2 -0
- package/lib/icons/iconNpm.ts +2 -0
- package/lib/icons/iconTelegram.ts +2 -0
- package/lib/icons/iconTrello.ts +2 -0
- package/lib/icons/iconXcom.ts +1 -0
- package/lib/img/ImageType.ts +1 -0
- package/lib/img/Img.astro +10 -7
- package/lib/img/TypedImg.astro +15 -13
- package/lib/img/TypedImgB2.astro +23 -0
- package/lib/img/classInvertBlack.ts +1 -0
- package/lib/img/classesImgZoomInOnHover10.ts +1 -0
- package/lib/img/classesImgZoomInOnHover5.ts +1 -0
- package/lib/layouts/MarkdownPageWrapper.astro +19 -0
- package/lib/layouts/MinimalLayout.astro +23 -16
- package/lib/layouts/parts/ThemeToggle.astro +10 -10
- package/lib/link/LinkButton.astro +18 -19
- package/lib/link/LinkText.astro +10 -7
- package/lib/link/classesTextLink.ts +1 -1
- package/lib/list/BlackBulletPoint.astro +1 -1
- package/lib/list/BlackBulletPoints.astro +7 -7
- package/lib/list/CheckPoint.astro +3 -3
- package/lib/list/CheckPoints.astro +3 -3
- package/lib/list/NumberedList.astro +1 -1
- package/lib/list/Ps.astro +8 -5
- package/lib/list/TextOrLink.astro +3 -9
- package/lib/md/MarkdownDiv.astro +18 -0
- package/lib/modal/Modal.astro +4 -4
- package/lib/modal/ModalButton.astro +24 -11
- package/lib/page/PageCentered.astro +5 -3
- package/lib/page/PageCenteredCard.astro +7 -5
- package/lib/page/{classesBg.ts → classesBg100.ts} +2 -2
- package/lib/page/classesBg50.ts +27 -0
- package/lib/page/classesPageCentered.ts +1 -1
- package/lib/popover/Popover1.astro +4 -4
- package/lib/select/Select.astro +14 -10
- package/lib/table/Table.astro +2 -2
- package/lib/table/TableD.astro +2 -2
- package/lib/table/TableM.astro +2 -2
- package/lib/table/TableMEntry.astro +2 -2
- package/lib/table/tableVisibilityClasses.ts +3 -3
- package/lib/utils/HasId.ts +3 -0
- package/lib/utils/HasSubtitle.ts +4 -0
- package/lib/utils/HasTitle.ts +4 -0
- package/lib/utils/MayHaveButtonVariant.ts +5 -0
- package/lib/utils/MayHaveClass.ts +3 -0
- package/lib/utils/MayHaveIcon.ts +4 -0
- package/lib/utils/MayHaveId.ts +3 -0
- package/lib/utils/MayHaveInnerClass.ts +3 -0
- package/lib/utils/MayHaveSubtitle.ts +4 -0
- package/lib/utils/MayHaveTitle.ts +4 -0
- package/package.json +19 -14
- package/lib/icon/Icon1.astro +0 -21
- package/lib/img/classInvertDiagram.ts +0 -1
- package/lib/img/classesImgZoomInOnHover.ts +0 -1
- package/lib/layouts/MarkdownWrapper.astro +0 -17
- package/lib/utils/bun/BunCmd.ts +0 -7
- package/lib/utils/bun/cryAndTryAgainLater.ts +0 -6
- package/lib/utils/bun/logBunCmd.ts +0 -1
- package/lib/utils/bun/runCmdAsync.ts +0 -44
- package/lib/utils/bun/runCmdLocally.ts +0 -13
- package/lib/utils/obj/objectKeys.ts +0 -21
- package/lib/utils/ran/generateId12.ts +0 -7
- package/lib/utils/ran/generateId3.ts +0 -7
- package/lib/utils/ran/generateId4.ts +0 -7
- package/lib/utils/ran/generateId5.ts +0 -7
- package/lib/utils/ran/generateId6.ts +0 -7
- package/lib/utils/ran/generateId7.ts +0 -7
- package/lib/utils/ran/generateReadableId.ts +0 -35
- package/lib/utils/ran/urlAlphabet32.ts +0 -8
- /package/lib/{layouts/parts → md}/markdown.css +0 -0
- /package/lib/utils/{ui/classArr.ts → classArr.ts} +0 -0
- /package/lib/utils/{ui/classMerge.ts → classMerge.ts} +0 -0
- /package/lib/utils/{ui/isDevEnv.ts → isDevEnv.ts} +0 -0
- /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>
|
package/lib/utils/bun/BunCmd.ts
DELETED
|
@@ -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,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
|
|
File without changes
|