@adaptive-sm/astro-ui 0.1.0 → 0.2.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.
- package/README.md +81 -21
- package/lib/button/buttonCva.ts +4 -4
- package/lib/details/Details.astro +7 -7
- package/lib/generate_demo_list/DemoList.astro +6 -4
- package/lib/generate_image_list/generateImageList.ts +24 -0
- package/lib/grid/FeatureGridSection.astro +80 -0
- package/lib/grid/GridFeatureType.ts +5 -0
- package/lib/icon/Icon1.astro +1 -1
- package/lib/img/ImageType.ts +1 -0
- package/lib/img/Img.astro +2 -2
- package/lib/img/TypedImg.astro +11 -8
- package/lib/img/classInvertBlack.ts +1 -0
- package/lib/img/classesImgZoomInOnHover10.ts +1 -0
- package/lib/img/classesImgZoomInOnHover5.ts +1 -0
- package/lib/layouts/parts/ThemeToggle.astro +1 -1
- package/lib/page/{classesBg.ts → classesBg100.ts} +2 -2
- package/lib/page/classesBg50.ts +27 -0
- package/package.json +23 -5
- package/lib/img/classInvertDiagram.ts +0 -1
- package/lib/img/classesImgZoomInOnHover.ts +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
A library of reusable UI components for Astro projects. Built with TypeScript, Tailwind CSS, and Astro in static output mode. Components are designed to be accessible, customizable, and easy to integrate.
|
|
4
4
|
|
|
5
|
+
Quick link
|
|
6
|
+
|
|
7
|
+
- code - https://github.com/adaptive-shield-matrix/astro-ui
|
|
8
|
+
- npm - https://www.npmjs.com/package/@adaptive-sm/astro-ui
|
|
9
|
+
- component demo - https://adaptive-astro-ui.pages.dev/
|
|
10
|
+
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
7
13
|
Install the package using Bun:
|
|
@@ -10,37 +16,55 @@ Install the package using Bun:
|
|
|
10
16
|
bun add @adaptive-sm/astro-ui
|
|
11
17
|
```
|
|
12
18
|
|
|
13
|
-
##
|
|
19
|
+
## Tailwind CSS Configuration
|
|
20
|
+
|
|
21
|
+
To ensure Tailwind scans the library's source files for classes (since components are published as source without a build step), add the following `@source` directive to your project's `src/layouts/global.css` (or equivalent global stylesheet):
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@source '/node_modules/@adaptive-sm/astro-ui/lib/**/*.{astro,html,md,mdx,ts,tsx}';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This tells Tailwind to include classes from the library's `.astro`, `.ts`, and other relevant files in the purge process, preventing unused classes from being purged during the build. Without it, Tailwind might not detect classes used in imported components, leading to missing styles.
|
|
28
|
+
|
|
29
|
+
## Option configuration: import alias
|
|
30
|
+
|
|
31
|
+
### Typescript
|
|
32
|
+
|
|
33
|
+
In your `tsconfig.json`, set up the `~` alias to point to the library:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"compilerOptions": {
|
|
38
|
+
"baseUrl": ".",
|
|
39
|
+
"paths": {
|
|
40
|
+
"@/*": ["src/*"],
|
|
41
|
+
"~/*": ["node_modules/@adaptive-sm/astro-ui/lib/*"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Astro
|
|
14
48
|
|
|
15
49
|
In your `astro.config.mjs`, set up the `~` alias to point to the library:
|
|
16
50
|
|
|
17
51
|
```js
|
|
18
|
-
import { defineConfig } from
|
|
52
|
+
import { defineConfig } from "astro/config"
|
|
19
53
|
|
|
20
54
|
export default defineConfig({
|
|
21
55
|
vite: {
|
|
22
56
|
resolve: {
|
|
23
57
|
alias: {
|
|
24
|
-
|
|
58
|
+
"~": new URL("./node_modules/@adaptive-sm/astro-ui/lib", import.meta.url).pathname,
|
|
25
59
|
},
|
|
26
60
|
},
|
|
27
61
|
},
|
|
28
|
-
})
|
|
62
|
+
})
|
|
29
63
|
```
|
|
30
64
|
|
|
31
|
-
## Tailwind CSS Configuration
|
|
32
|
-
|
|
33
|
-
To ensure Tailwind scans the library's source files for classes (since components are published as source without a build step), add the following `@source` directive to your project's `src/layouts/global.css` (or equivalent global stylesheet):
|
|
34
|
-
|
|
35
|
-
```css
|
|
36
|
-
@source '/node_modules/@adaptive-sm/astro-ui/lib/**/*.{astro,html,md,mdx,ts,tsx}';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
This tells Tailwind to include classes from the library's `.astro`, `.ts`, and other relevant files in the purge process, preventing unused classes from being purged during the build. Without it, Tailwind might not detect classes used in imported components, leading to missing styles.
|
|
40
|
-
|
|
41
65
|
## Usage
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
### No Build Step Required
|
|
44
68
|
|
|
45
69
|
This library ships source `.astro` and `.ts` files directly—no pre-build needed. Benefits include:
|
|
46
70
|
|
|
@@ -57,7 +81,7 @@ Import and use components directly in your Astro files. For example:
|
|
|
57
81
|
|
|
58
82
|
```astro
|
|
59
83
|
---
|
|
60
|
-
import { Button } from
|
|
84
|
+
import { Button } from "~/button/Button.astro"
|
|
61
85
|
---
|
|
62
86
|
|
|
63
87
|
<Button variant="primary">Click me</Button>
|
|
@@ -67,19 +91,17 @@ import { Button } from '~/button/Button.astro';
|
|
|
67
91
|
|
|
68
92
|
```astro
|
|
69
93
|
---
|
|
70
|
-
import { CardWrapper } from
|
|
94
|
+
import { CardWrapper } from "~/card/CardWrapper.astro"
|
|
71
95
|
---
|
|
72
96
|
|
|
73
|
-
<CardWrapper>
|
|
74
|
-
Card content here.
|
|
75
|
-
</CardWrapper>
|
|
97
|
+
<CardWrapper> Card content here. </CardWrapper>
|
|
76
98
|
```
|
|
77
99
|
|
|
78
100
|
### Image Component
|
|
79
101
|
|
|
80
102
|
```astro
|
|
81
103
|
---
|
|
82
|
-
import { Img } from
|
|
104
|
+
import { Img } from "~/img/Img.astro"
|
|
83
105
|
---
|
|
84
106
|
|
|
85
107
|
<Img src="/path/to/image.jpg" alt="Description" />
|
|
@@ -90,53 +112,83 @@ Refer to individual component documentation in the source code for props and var
|
|
|
90
112
|
## Components
|
|
91
113
|
|
|
92
114
|
### Buttons
|
|
115
|
+
|
|
93
116
|
- [Button.astro](lib/button/Button.astro)
|
|
94
117
|
- Button variants and animations via CVAs in `buttonCva.ts`, `buttonIconCva.ts`
|
|
95
118
|
|
|
96
119
|
### Cards
|
|
120
|
+
|
|
97
121
|
- [CardWrapper.astro](lib/card/CardWrapper.astro)
|
|
98
122
|
|
|
99
123
|
### Details
|
|
124
|
+
|
|
100
125
|
- [Details.astro](lib/details/Details.astro)
|
|
101
126
|
|
|
102
127
|
### Forms
|
|
128
|
+
|
|
103
129
|
- [Fieldset.astro](lib/form/Fieldset.astro)
|
|
104
130
|
|
|
105
131
|
### Icons
|
|
132
|
+
|
|
106
133
|
- [Icon1.astro](lib/icon/Icon1.astro) (replaces SVG icons)
|
|
107
134
|
|
|
135
|
+
usage:
|
|
136
|
+
|
|
137
|
+
- Choose from over 7000 icons: https://pictogrammers.com/library/mdi/
|
|
138
|
+
- Import name from "@mdi/js" library
|
|
139
|
+
- Passed on as `path` prop
|
|
140
|
+
|
|
108
141
|
### Images
|
|
142
|
+
|
|
109
143
|
- [Img.astro](lib/img/Img.astro)
|
|
144
|
+
|
|
145
|
+
A small wrapper setting loading lazy and decoding to async.
|
|
146
|
+
|
|
110
147
|
- [TypedImg.astro](lib/img/TypedImg.astro)
|
|
111
148
|
|
|
149
|
+
An image with given width and height to prevent layout shifts.
|
|
150
|
+
|
|
151
|
+
Generate types using `lib/generate_image_list/generateImageList.ts`
|
|
152
|
+
|
|
112
153
|
### Layouts
|
|
154
|
+
|
|
113
155
|
- [MinimalLayout.astro](lib/layouts/MinimalLayout.astro)
|
|
114
156
|
- [MarkdownWrapper.astro](lib/layouts/MarkdownWrapper.astro)
|
|
157
|
+
|
|
158
|
+
### Navigation bar
|
|
159
|
+
|
|
115
160
|
- [ThemeToggle.astro](lib/layouts/parts/ThemeToggle.astro)
|
|
116
161
|
|
|
117
162
|
### Links
|
|
163
|
+
|
|
118
164
|
- [LinkText.astro](lib/link/LinkText.astro)
|
|
119
165
|
- [LinkButton.astro](lib/link/LinkButton.astro)
|
|
120
166
|
|
|
121
167
|
### Lists
|
|
168
|
+
|
|
122
169
|
- [BlackBulletPoints.astro](lib/list/BlackBulletPoints.astro)
|
|
123
170
|
- [CheckPoints.astro](lib/list/CheckPoints.astro)
|
|
124
171
|
- [NumberedList.astro](lib/list/NumberedList.astro)
|
|
125
172
|
|
|
126
173
|
### Modals
|
|
174
|
+
|
|
127
175
|
- [ModalButton.astro](lib/modal/ModalButton.astro)
|
|
128
176
|
|
|
129
177
|
### Pages
|
|
178
|
+
|
|
130
179
|
- [PageCentered.astro](lib/page/PageCentered.astro)
|
|
131
180
|
- [PageCenteredCard.astro](lib/page/PageCenteredCard.astro)
|
|
132
181
|
|
|
133
182
|
### Popovers
|
|
183
|
+
|
|
134
184
|
- [Popover1.astro](lib/popover/Popover1.astro)
|
|
135
185
|
|
|
136
186
|
### Selects
|
|
187
|
+
|
|
137
188
|
- [Select.astro](lib/select/Select.astro)
|
|
138
189
|
|
|
139
190
|
### Table
|
|
191
|
+
|
|
140
192
|
- [Table.astro](lib/table/Table.astro)
|
|
141
193
|
|
|
142
194
|
## Demos
|
|
@@ -181,3 +233,11 @@ Follow the coding rules in `.roo/rules-code/` for style and best practices.
|
|
|
181
233
|
## License
|
|
182
234
|
|
|
183
235
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
236
|
+
|
|
237
|
+
## Acknowledgments
|
|
238
|
+
|
|
239
|
+
- Built on top of [Astro](https://astro.build).
|
|
240
|
+
- Styled with [Tailwind CSS](https://tailwindcss.com/).
|
|
241
|
+
- Icons from [MDI](https://pictogrammers.com/library/mdi/).
|
|
242
|
+
|
|
243
|
+
For more information, visit the [GitHub repository](https://github.com/adaptive-shield-matrix/astro-ui).
|
package/lib/button/buttonCva.ts
CHANGED
|
@@ -94,19 +94,19 @@ const variantClasses = {
|
|
|
94
94
|
// filled colors
|
|
95
95
|
//
|
|
96
96
|
filledYellow: classArr(
|
|
97
|
-
"text-white
|
|
97
|
+
"text-white", // text
|
|
98
98
|
"bg-yellow-500 dark:bg-yellow-800 ", // bg
|
|
99
99
|
"hover:bg-yellow-700 dark:hover:bg-yellow-600", // bg hover
|
|
100
100
|
"focus:ring-yellow-400 dark:focus:ring-yellow-400", // focus
|
|
101
101
|
),
|
|
102
102
|
filledAmber: classArr(
|
|
103
|
-
"text-white
|
|
103
|
+
"text-white", // text
|
|
104
104
|
"bg-amber-500 dark:bg-amber-800 ", // bg
|
|
105
105
|
"hover:bg-amber-700 dark:hover:bg-amber-600", // bg hover
|
|
106
106
|
"focus:ring-amber-400 dark:focus:ring-amber-400", // focus
|
|
107
107
|
),
|
|
108
108
|
filledOrange: classArr(
|
|
109
|
-
"text-white
|
|
109
|
+
"text-white", // text
|
|
110
110
|
"bg-orange-500 dark:bg-orange-800 ", // bg
|
|
111
111
|
"hover:bg-orange-700 dark:hover:bg-orange-600", // bg hover
|
|
112
112
|
"focus:ring-orange-400 dark:focus:ring-orange-400", // focus
|
|
@@ -128,7 +128,7 @@ const variantClasses = {
|
|
|
128
128
|
"focus:ring-sky-400 dark:focus:ring-sky-400", // focus
|
|
129
129
|
),
|
|
130
130
|
filledIndigo: classArr(
|
|
131
|
-
"text-white
|
|
131
|
+
"text-white", // text
|
|
132
132
|
"bg-indigo-500 dark:bg-indigo-800 ", // bg
|
|
133
133
|
"hover:bg-indigo-700 dark:hover:bg-indigo-600", // bg hover
|
|
134
134
|
"focus:ring-indigo-400 dark:focus:ring-indigo-400", // focus
|
|
@@ -11,11 +11,10 @@ interface Props {
|
|
|
11
11
|
class?: string
|
|
12
12
|
summaryClass?: string
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const icon =
|
|
16
|
-
const title =
|
|
17
|
-
const subtitle =
|
|
18
|
-
const summaryClass = props.summaryClass
|
|
14
|
+
const p = Astro.props
|
|
15
|
+
const icon = p.icon
|
|
16
|
+
const title = p.title
|
|
17
|
+
const subtitle = p.subtitle
|
|
19
18
|
const hasSummary = Astro.slots.has("summary")
|
|
20
19
|
---
|
|
21
20
|
|
|
@@ -26,14 +25,15 @@ const hasSummary = Astro.slots.has("summary")
|
|
|
26
25
|
"rounded-lg border border-gray-200",
|
|
27
26
|
"shadow-sm",
|
|
28
27
|
"overflow-hidden",
|
|
29
|
-
|
|
28
|
+
p.class,
|
|
30
29
|
)}
|
|
31
30
|
>
|
|
32
31
|
<summary
|
|
33
32
|
class={classArr(
|
|
34
33
|
"flex flex-col sm:flex-row items-center justify-between gap-4",
|
|
35
|
-
"p-6",
|
|
34
|
+
"p-4 sm:p-6",
|
|
36
35
|
"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",
|
|
36
|
+
p.summaryClass,
|
|
37
37
|
)}
|
|
38
38
|
>
|
|
39
39
|
{
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
import { classesTextLink } from "~/link/classesTextLink"
|
|
3
3
|
import { classArr } from "~/utils/ui/classArr"
|
|
4
4
|
import { type DemoListType } from "./DemoListType"
|
|
5
|
+
import { classMerge } from "~/utils/ui/classMerge"
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
demos: DemoListType
|
|
9
|
+
urlPrefix?: string
|
|
8
10
|
class?: string
|
|
9
11
|
}
|
|
10
|
-
const
|
|
12
|
+
const p = Astro.props
|
|
11
13
|
|
|
12
14
|
// Extract categories and their demo pages
|
|
13
|
-
const categories = Object.entries(
|
|
15
|
+
const categories = Object.entries(p.demos)
|
|
14
16
|
---
|
|
15
17
|
|
|
16
|
-
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
18
|
+
<div class={classMerge("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4", p.class)}>
|
|
17
19
|
{
|
|
18
20
|
categories.map(([category, pages]) => (
|
|
19
21
|
<section class="bg-white dark:bg-zinc-700 rounded-lg shadow-md p-4 border border-gray-200 dark:border-zinc-600">
|
|
@@ -21,7 +23,7 @@ const categories = Object.entries(props.demos)
|
|
|
21
23
|
<ul class="list-disc pl-4 space-y-1">
|
|
22
24
|
{pages.map((page) => (
|
|
23
25
|
<li class={classArr(classesTextLink)}>
|
|
24
|
-
<a href={
|
|
26
|
+
<a href={`${p.urlPrefix ?? ""}/${category}/${page}`}>{page.replace(/_/g, " ").replaceAll("demo ", "")}</a>
|
|
25
27
|
</li>
|
|
26
28
|
))}
|
|
27
29
|
</ul>
|
|
@@ -6,6 +6,28 @@ import { runCmdAsync } from "~/utils/bun/runCmdAsync"
|
|
|
6
6
|
|
|
7
7
|
const IMAGE_EXTENSIONS = new Set([".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".tiff", ".svg"])
|
|
8
8
|
|
|
9
|
+
function getMimeType(ext: string): string {
|
|
10
|
+
switch (ext) {
|
|
11
|
+
case ".jpg":
|
|
12
|
+
case ".jpeg":
|
|
13
|
+
return "image/jpeg"
|
|
14
|
+
case ".png":
|
|
15
|
+
return "image/png"
|
|
16
|
+
case ".gif":
|
|
17
|
+
return "image/gif"
|
|
18
|
+
case ".webp":
|
|
19
|
+
return "image/webp"
|
|
20
|
+
case ".avif":
|
|
21
|
+
return "image/avif"
|
|
22
|
+
case ".tiff":
|
|
23
|
+
return "image/tiff"
|
|
24
|
+
case ".svg":
|
|
25
|
+
return "image/svg+xml"
|
|
26
|
+
default:
|
|
27
|
+
return "application/octet-stream"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
9
31
|
export async function generateImageList(
|
|
10
32
|
imageDirectory: string,
|
|
11
33
|
existingImages: Record<string, ImageType>,
|
|
@@ -55,12 +77,14 @@ async function processImageFiles(
|
|
|
55
77
|
|
|
56
78
|
const prevAlt = existingImages[key]?.alt
|
|
57
79
|
const alt = prevAlt || fileName.replace(/[-_]/g, " ")
|
|
80
|
+
const mimeType = getMimeType(ext)
|
|
58
81
|
|
|
59
82
|
imageMap[key] = {
|
|
60
83
|
path: relativePath,
|
|
61
84
|
width: dimensions.width,
|
|
62
85
|
height: dimensions.height,
|
|
63
86
|
alt,
|
|
87
|
+
mimeType,
|
|
64
88
|
}
|
|
65
89
|
} catch (error) {
|
|
66
90
|
console.error(`Error processing ${filePath}:`, error)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon1 from "~/icon/Icon1.astro"
|
|
3
|
+
import { classArr } from "~/utils/ui/classArr"
|
|
4
|
+
import { mdiLink } from "@mdi/js"
|
|
5
|
+
import type { GridFeatureType } from "./GridFeatureType"
|
|
6
|
+
import { classMerge } from "~/utils/ui/classMerge"
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
id: string
|
|
10
|
+
title: string
|
|
11
|
+
subtitle1: string
|
|
12
|
+
subtitle2?: string
|
|
13
|
+
features: GridFeatureType[]
|
|
14
|
+
class?: string
|
|
15
|
+
gridClass?: string
|
|
16
|
+
cardClass?: string
|
|
17
|
+
}
|
|
18
|
+
const p = Astro.props
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<section id={p.id} class={classMerge("w-full", "py-25 px-4", p.class)}>
|
|
22
|
+
<div class={classArr("max-w-7xl mx-auto", "text-center mb-8")}>
|
|
23
|
+
<h2 class={classArr("text-3xl sm:text-4xl font-bold", "mb-4", "group flex items-center justify-center")}>
|
|
24
|
+
<span>{p.title}</span>
|
|
25
|
+
<button
|
|
26
|
+
onclick={`copyLink('${p.id}')`}
|
|
27
|
+
class="opacity-0 group-hover:opacity-100 ml-2 p-1 rounded hidden sm:flex"
|
|
28
|
+
title="Copy link to this section"
|
|
29
|
+
>
|
|
30
|
+
<Icon1 path={mdiLink} class="size-4" />
|
|
31
|
+
</button>
|
|
32
|
+
</h2>
|
|
33
|
+
<p class="text-xl text-muted-foreground mx-auto">
|
|
34
|
+
{p.subtitle1}
|
|
35
|
+
</p>
|
|
36
|
+
{p.subtitle2 && <p class="text-xl text-muted-foreground mx-auto mt-1">{p.subtitle2}</p>}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div class={classMerge("grid md:grid-cols-2 lg:grid-cols-3 gap-8", "max-w-7xl mx-auto", p.gridClass)}>
|
|
40
|
+
{
|
|
41
|
+
p.features.map((feature, index) => (
|
|
42
|
+
<div
|
|
43
|
+
class={classMerge(
|
|
44
|
+
"bg-white dark:bg-gray-800", // bg
|
|
45
|
+
"rounded-lg p-6", // padding
|
|
46
|
+
// "border", // border
|
|
47
|
+
"shadow-sm hover:shadow-lg transition-shadow", // shadow
|
|
48
|
+
p.cardClass,
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
51
|
+
<div class="flex items-center gap-3 mb-4">
|
|
52
|
+
<Icon1 path={feature.icon} class="size-8" />
|
|
53
|
+
<h3 class="text-xl font-semibold">{feature.title}</h3>
|
|
54
|
+
</div>
|
|
55
|
+
<p class="text-muted-foreground">{feature.description}</p>
|
|
56
|
+
</div>
|
|
57
|
+
))
|
|
58
|
+
}
|
|
59
|
+
</div>
|
|
60
|
+
</section>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
declare global {
|
|
64
|
+
interface Window {
|
|
65
|
+
copyLink?: (id: string) => void
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
window.copyLink = function (id: string) {
|
|
69
|
+
const url = window.location.href.split("#")[0] + "#" + id
|
|
70
|
+
navigator.clipboard
|
|
71
|
+
.writeText(url)
|
|
72
|
+
.then(() => {
|
|
73
|
+
// Optional: show a toast or feedback
|
|
74
|
+
console.log("Link copied:", url)
|
|
75
|
+
})
|
|
76
|
+
.catch((err) => {
|
|
77
|
+
console.error("Failed to copy link:", err)
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
</script>
|
package/lib/icon/Icon1.astro
CHANGED
|
@@ -15,7 +15,7 @@ const ariaHidden = props.ariaHidden ?? !props.title
|
|
|
15
15
|
<svg
|
|
16
16
|
viewBox={"0 0 24 24"}
|
|
17
17
|
aria-hidden={ariaHidden}
|
|
18
|
-
class={classMerge("size-6 align-middle dark:fill-white", props.class)}
|
|
18
|
+
class={classMerge("size-6 flex-shrink-0 align-middle dark:fill-white", props.class)}
|
|
19
19
|
>
|
|
20
20
|
<path d={props.path}></path>
|
|
21
21
|
</svg>
|
package/lib/img/ImageType.ts
CHANGED
package/lib/img/Img.astro
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { classesImgZoomInOnHover10 } from "./classesImgZoomInOnHover10"
|
|
3
3
|
import { classMerge } from "~/utils/ui/classMerge"
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
@@ -19,7 +19,7 @@ const p = Astro.props
|
|
|
19
19
|
<img
|
|
20
20
|
src={p.src}
|
|
21
21
|
alt={p.alt}
|
|
22
|
-
class={classMerge(p.zoomIn &&
|
|
22
|
+
class={classMerge(p.zoomIn && classesImgZoomInOnHover10, p.class)}
|
|
23
23
|
loading={p.loadingLazy ?? true ? "lazy" : undefined}
|
|
24
24
|
decoding={p.decodeAsync ?? true ? "async" : undefined}
|
|
25
25
|
width={p.size ?? p.width}
|
package/lib/img/TypedImg.astro
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
import { classArr } from "~/utils/ui/classArr"
|
|
3
3
|
import type { ImageType } from "./ImageType"
|
|
4
4
|
import Img from "./Img.astro"
|
|
5
|
-
import {
|
|
5
|
+
import { classInvertBlack } from "~/img/classInvertBlack"
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
img: ImageType
|
|
9
9
|
zoomIn?: boolean
|
|
10
|
+
invertColorsInDarkMode?: boolean
|
|
10
11
|
class?: string
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
const isSvg =
|
|
13
|
+
const p = Astro.props
|
|
14
|
+
const isSvg = p.img.path.endsWith(".svg")
|
|
15
|
+
// const invert = isSvg && p.invertColorsInDarkMode
|
|
16
|
+
const invert = p.invertColorsInDarkMode
|
|
14
17
|
|
|
15
18
|
function imageUrl(p: string) {
|
|
16
19
|
return "/media-b2/" + p
|
|
@@ -18,9 +21,9 @@ function imageUrl(p: string) {
|
|
|
18
21
|
---
|
|
19
22
|
|
|
20
23
|
<Img
|
|
21
|
-
src={imageUrl(
|
|
22
|
-
alt={
|
|
23
|
-
class={classArr(
|
|
24
|
-
width={isSvg ? null :
|
|
25
|
-
height={isSvg ? null :
|
|
24
|
+
src={imageUrl(p.img.path)}
|
|
25
|
+
alt={p.img.alt}
|
|
26
|
+
class={classArr(invert ? classInvertBlack : "", p.class)}
|
|
27
|
+
width={isSvg ? null : p.img.width}
|
|
28
|
+
height={isSvg ? null : p.img.height}
|
|
26
29
|
/>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const classInvertBlack = "invert-black"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const classesImgZoomInOnHover10 = "transform transition-transform duration-200 hover:scale-110"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const classesImgZoomInOnHover5 = "transform transition-transform duration-200 hover:scale-105"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type ClassesBg = keyof typeof
|
|
1
|
+
export type ClassesBg = keyof typeof classesBg100
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const classesBg100 = {
|
|
4
4
|
white: "bg-white dark:bg-black",
|
|
5
5
|
orange: "bg-orange-100 dark:bg-yellow-900",
|
|
6
6
|
red: "bg-red-100 dark:bg-red-900",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ClassesBg = keyof typeof classesBg50
|
|
2
|
+
|
|
3
|
+
export const classesBg50 = {
|
|
4
|
+
white: "bg-white dark:bg-black",
|
|
5
|
+
orange: "bg-orange-50 dark:bg-yellow-950",
|
|
6
|
+
red: "bg-red-50 dark:bg-red-950",
|
|
7
|
+
amber: "bg-amber-50 dark:bg-amber-950",
|
|
8
|
+
yellow: "bg-yellow-50 dark:bg-yellow-950",
|
|
9
|
+
lime: "bg-lime-50 dark:bg-lime-950",
|
|
10
|
+
green: "bg-green-50 dark:bg-green-950",
|
|
11
|
+
emerald: "bg-emerald-50 dark:bg-emerald-950",
|
|
12
|
+
teal: "bg-teal-50 dark:bg-teal-950",
|
|
13
|
+
cyan: "bg-cyan-50 dark:bg-cyan-950",
|
|
14
|
+
sky: "bg-sky-50 dark:bg-sky-950",
|
|
15
|
+
blue: "bg-blue-50 dark:bg-blue-950",
|
|
16
|
+
indigo: "bg-indigo-50 dark:bg-indigo-950",
|
|
17
|
+
violet: "bg-violet-50 dark:bg-violet-950",
|
|
18
|
+
purple: "bg-purple-50 dark:bg-purple-950",
|
|
19
|
+
fuchsia: "bg-fuchsia-50 dark:bg-fuchsia-950",
|
|
20
|
+
pink: "bg-pink-50 dark:bg-pink-950",
|
|
21
|
+
rose: "bg-rose-50 dark:bg-rose-950",
|
|
22
|
+
slate: "bg-slate-50 dark:bg-slate-950",
|
|
23
|
+
gray: "bg-gray-50 dark:bg-gray-950",
|
|
24
|
+
zinc: "bg-zinc-50 dark:bg-zinc-950",
|
|
25
|
+
neutral: "bg-neutral-50 dark:bg-neutral-950",
|
|
26
|
+
stone: "bg-stone-50 dark:bg-stone-950",
|
|
27
|
+
} as const
|
package/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptive-sm/astro-ui",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"type": "module",
|
|
5
|
-
"private": false,
|
|
3
|
+
"version": "0.2.1",
|
|
6
4
|
"scripts": {
|
|
7
5
|
"astro": "astro",
|
|
8
6
|
"dev": "nice -5 astro dev",
|
|
@@ -11,11 +9,12 @@
|
|
|
11
9
|
"deploy": "bun run build && bun run upload && bun run tag",
|
|
12
10
|
"upload": "bun run wrangler pages deploy ./dist --project-name=adaptive-astro-ui --commit-dirty",
|
|
13
11
|
"tag": "git branch -f deployed",
|
|
14
|
-
"
|
|
12
|
+
"release": "bash ./ops/release.sh",
|
|
13
|
+
"generateDemoList": "bun run ./lib/generate_demo_list/generateDemoList.ts",
|
|
15
14
|
"generateImageList": "bun run ./src/pages/images/generateImageList.cli.ts",
|
|
16
15
|
"generateAiRulesLib": "bash ./lib/generate_ai_rules/generate_agent_rules_1_lib.bash",
|
|
17
16
|
"update": "nice -15 bun x npm-check-updates -u && bun i",
|
|
18
|
-
"update:commit": "bun x npm-check-updates -u && bun i && git add package.json && bun run tsc && git commit -m \"update dependencies\" && git push",
|
|
17
|
+
"update:commit": "bun x npm-check-updates -u && bun i && git add package.json && bun run tsc && git commit -m \"chore(deps): update dependencies\" && git push",
|
|
19
18
|
"clean": "rm -rf ./dist",
|
|
20
19
|
"reset": "rm -rf ./node_modules"
|
|
21
20
|
},
|
|
@@ -52,5 +51,24 @@
|
|
|
52
51
|
],
|
|
53
52
|
"exports": {
|
|
54
53
|
"./*": "./lib/*"
|
|
54
|
+
},
|
|
55
|
+
"type": "module",
|
|
56
|
+
"private": false,
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"homepage": "https://github.com/adaptive-shield-matrix/astro-ui",
|
|
59
|
+
"description": "A library of reusable UI components for Astro projects. Built with TypeScript, Tailwind CSS, and Astro in static output mode. Components are designed to be accessible, customizable, and easy to integrate.",
|
|
60
|
+
"keywords": [
|
|
61
|
+
"astro",
|
|
62
|
+
"astro-ui",
|
|
63
|
+
"tailwind",
|
|
64
|
+
"tailwindcss",
|
|
65
|
+
"components",
|
|
66
|
+
"ui-components",
|
|
67
|
+
"web-development",
|
|
68
|
+
"frontend",
|
|
69
|
+
"typescript"
|
|
70
|
+
],
|
|
71
|
+
"repository": {
|
|
72
|
+
"url": "git+https://github.com/adaptive-shield-matrix/astro-ui.git"
|
|
55
73
|
}
|
|
56
74
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const classInvertDiagram = "invert-diagram"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const classesImgZoomInOnHover = "transform transition-transform duration-200 -translate-x-3 hover:scale-110"
|