@starwind-ui/core 0.0.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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/src/components/badge/Badge.astro +64 -0
- package/dist/src/components/badge/index.ts +5 -0
- package/dist/src/components/button/Button.astro +83 -0
- package/dist/src/components/button/index.ts +5 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Boston343 (webreaper)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @starwind-ui/core
|
|
2
|
+
|
|
3
|
+
A collection of accessible UI components built with [Astro](https://astro.build).
|
|
4
|
+
|
|
5
|
+
This package is utilized by the Starwind UI CLI in order to add components to your project.
|
|
6
|
+
|
|
7
|
+
**This is not meant to be used independently of the CLI.**
|
|
8
|
+
|
|
9
|
+
Starwind UI website: [https://starwind.dev/](https://starwind.dev/)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component metadata interface describing a Starwind UI component
|
|
3
|
+
*/
|
|
4
|
+
interface ComponentMeta {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
type: "component";
|
|
8
|
+
dependencies: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registry interface containing all available components
|
|
12
|
+
*/
|
|
13
|
+
interface Registry {
|
|
14
|
+
components: ComponentMeta[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the absolute path to a component file
|
|
18
|
+
* @param {string} componentName - The name of the component
|
|
19
|
+
* @param {string} fileName - The name of the file within the component
|
|
20
|
+
* @returns {string} The absolute path to the component file
|
|
21
|
+
*/
|
|
22
|
+
declare const getComponentPath: (componentName: string, fileName: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Map of all components and their metadata from registry
|
|
25
|
+
*/
|
|
26
|
+
declare const registry: ComponentMeta[];
|
|
27
|
+
|
|
28
|
+
export { type ComponentMeta, type Registry, getComponentPath, registry };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
// src/registry.json
|
|
6
|
+
var registry_default = [
|
|
7
|
+
{
|
|
8
|
+
name: "badge",
|
|
9
|
+
type: "component",
|
|
10
|
+
version: "0.0.11",
|
|
11
|
+
dependencies: []
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "button",
|
|
15
|
+
type: "component",
|
|
16
|
+
version: "0.0.11",
|
|
17
|
+
dependencies: []
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
23
|
+
var getComponentPath = (componentName, fileName) => {
|
|
24
|
+
const componentsDir = __dirname.includes("dist") ? "src/components" : "src/components";
|
|
25
|
+
return join(__dirname, componentsDir, componentName, fileName);
|
|
26
|
+
};
|
|
27
|
+
var registry = registry_default;
|
|
28
|
+
export {
|
|
29
|
+
getComponentPath,
|
|
30
|
+
registry
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/registry.json"],"sourcesContent":["import { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport componentRegistry from \"./registry.json\" assert { type: \"json\" };\n\n/**\n * Component metadata interface describing a Starwind UI component\n */\nexport interface ComponentMeta {\n\tname: string;\n\tversion: string;\n\ttype: \"component\";\n\tdependencies: string[];\n}\n\n/**\n * Registry interface containing all available components\n */\nexport interface Registry {\n\tcomponents: ComponentMeta[];\n}\n\nconst __dirname = fileURLToPath(new URL(\".\", import.meta.url));\n\n/**\n * Get the absolute path to a component file\n * @param {string} componentName - The name of the component\n * @param {string} fileName - The name of the file within the component\n * @returns {string} The absolute path to the component file\n */\nexport const getComponentPath = (componentName: string, fileName: string): string => {\n\t// In production (when installed as a dependency), the components will be in dist/src/components\n\t// In development, they will be in src/components\n\tconst componentsDir = __dirname.includes(\"dist\") ? \"src/components\" : \"src/components\";\n\treturn join(__dirname, componentsDir, componentName, fileName);\n};\n\n/**\n * Map of all components and their metadata from registry\n */\nexport const registry = componentRegistry as ComponentMeta[];\n","[\n\t{\n\t\t\"name\": \"badge\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"0.0.11\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"button\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"0.0.11\",\n\t\t\"dependencies\": []\n\t}\n]\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,qBAAqB;;;ACD9B;AAAA,EACC;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AACD;;;ADQA,IAAM,YAAY,cAAc,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC;AAQtD,IAAM,mBAAmB,CAAC,eAAuB,aAA6B;AAGpF,QAAM,gBAAgB,UAAU,SAAS,MAAM,IAAI,mBAAmB;AACtE,SAAO,KAAK,WAAW,eAAe,eAAe,QAAQ;AAC9D;AAKO,IAAM,WAAW;","names":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
|
|
4
|
+
interface Props extends HTMLAttributes<"div">, Omit<HTMLAttributes<"a">, "type"> {
|
|
5
|
+
/**
|
|
6
|
+
* Sets the variant of the badge
|
|
7
|
+
* @default "default"
|
|
8
|
+
*/
|
|
9
|
+
variant?:
|
|
10
|
+
| "default"
|
|
11
|
+
| "primary"
|
|
12
|
+
| "secondary"
|
|
13
|
+
| "outline"
|
|
14
|
+
| "ghost"
|
|
15
|
+
| "info"
|
|
16
|
+
| "success"
|
|
17
|
+
| "warning"
|
|
18
|
+
| "error";
|
|
19
|
+
/**
|
|
20
|
+
* Sets the size of the badge
|
|
21
|
+
* @default "md"
|
|
22
|
+
*/
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const { variant = "default", size = "md", class: className, ...rest } = Astro.props;
|
|
27
|
+
|
|
28
|
+
const Tag = Astro.props.href ? "a" : "div";
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<Tag
|
|
32
|
+
class:list={[
|
|
33
|
+
"starwind-badge starwind-transition-colors inline-flex items-center rounded-full font-semibold",
|
|
34
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
35
|
+
{
|
|
36
|
+
"bg-foreground text-background hover:bg-foreground/80": variant === "default",
|
|
37
|
+
"bg-primary text-primary-foreground hover:bg-primary/80 focus-visible:outline-primary":
|
|
38
|
+
variant === "primary",
|
|
39
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80 focus-visible:outline-secondary":
|
|
40
|
+
variant === "secondary",
|
|
41
|
+
"border-border hover:border-border/80 focus-visible:outline-outline border":
|
|
42
|
+
variant === "outline",
|
|
43
|
+
"bg-info text-info-foreground hover:bg-info/80 focus-visible:outline-info":
|
|
44
|
+
variant === "info",
|
|
45
|
+
"bg-success text-success-foreground hover:bg-success/80 focus-visible:outline-success":
|
|
46
|
+
variant === "success",
|
|
47
|
+
"bg-warning text-warning-foreground hover:bg-warning/80 focus-visible:outline-warning":
|
|
48
|
+
variant === "warning",
|
|
49
|
+
"bg-error text-error-foreground hover:bg-error/80 focus-visible:outline-error":
|
|
50
|
+
variant === "error",
|
|
51
|
+
"bg-foreground/10 text-foreground hover:bg-foreground/7 focus-visible:outline-outline":
|
|
52
|
+
variant === "ghost",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"px-2.5 py-0.5 text-xs": size === "sm",
|
|
56
|
+
"px-3 py-0.5 text-sm": size === "md",
|
|
57
|
+
"px-4 py-1 text-base": size === "lg",
|
|
58
|
+
},
|
|
59
|
+
className,
|
|
60
|
+
]}
|
|
61
|
+
{...rest}
|
|
62
|
+
>
|
|
63
|
+
<slot />
|
|
64
|
+
</Tag>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
|
|
4
|
+
interface Props extends HTMLAttributes<"button">, Omit<HTMLAttributes<"a">, "type"> {
|
|
5
|
+
/**
|
|
6
|
+
* Sets the variant of the button
|
|
7
|
+
* @default "primary"
|
|
8
|
+
*/
|
|
9
|
+
variant?:
|
|
10
|
+
| "default"
|
|
11
|
+
| "primary"
|
|
12
|
+
| "secondary"
|
|
13
|
+
| "outline"
|
|
14
|
+
| "ghost"
|
|
15
|
+
| "info"
|
|
16
|
+
| "success"
|
|
17
|
+
| "warning"
|
|
18
|
+
| "error";
|
|
19
|
+
/**
|
|
20
|
+
* Sets the size of the button
|
|
21
|
+
* @default "md"
|
|
22
|
+
*/
|
|
23
|
+
size?: "sm" | "md" | "lg" | "icon";
|
|
24
|
+
/**
|
|
25
|
+
* Sets the border radius of the button
|
|
26
|
+
* @default "md"
|
|
27
|
+
*/
|
|
28
|
+
radius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { variant = "default", size = "md", radius = "md", class: className, ...rest } = Astro.props;
|
|
32
|
+
|
|
33
|
+
const Tag = Astro.props.href ? "a" : "button";
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<Tag
|
|
37
|
+
class:list={[
|
|
38
|
+
"inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap",
|
|
39
|
+
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
40
|
+
"starwind-transition-colors",
|
|
41
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
42
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
43
|
+
{
|
|
44
|
+
"bg-foreground text-background hover:bg-foreground/90 focus-visible:outline-outline":
|
|
45
|
+
variant === "default",
|
|
46
|
+
"bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:outline-primary":
|
|
47
|
+
variant === "primary",
|
|
48
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/90 focus-visible:outline-secondary":
|
|
49
|
+
variant === "secondary",
|
|
50
|
+
"border-border hover:bg-border hover:text-foreground focus-visible:outline-outline border":
|
|
51
|
+
variant === "outline",
|
|
52
|
+
"hover:bg-foreground/10 hover:text-foreground focus-visible:outline-outline bg-transparent":
|
|
53
|
+
variant === "ghost",
|
|
54
|
+
"bg-info text-info-foreground hover:bg-info/90 focus-visible:outline-info":
|
|
55
|
+
variant === "info",
|
|
56
|
+
"bg-success text-success-foreground hover:bg-success/90 focus-visible:outline-success":
|
|
57
|
+
variant === "success",
|
|
58
|
+
"bg-warning text-warning-foreground hover:bg-warning/90 focus-visible:outline-warning":
|
|
59
|
+
variant === "warning",
|
|
60
|
+
"bg-error text-error-foreground hover:bg-error/90 focus-visible:outline-error":
|
|
61
|
+
variant === "error",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"h-9 px-3 py-2 text-sm": size === "sm",
|
|
65
|
+
"h-11 px-4 py-2 text-base": size === "md",
|
|
66
|
+
"h-12 px-8 py-2 text-lg": size === "lg",
|
|
67
|
+
"h-11 w-11": size === "icon",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"rounded-none": radius === "none",
|
|
71
|
+
"rounded-xs": radius === "xs",
|
|
72
|
+
"rounded-sm": radius === "sm",
|
|
73
|
+
"rounded-md": radius === "md",
|
|
74
|
+
"rounded-lg": radius === "lg",
|
|
75
|
+
"rounded-xl": radius === "xl",
|
|
76
|
+
"rounded-full": radius === "full",
|
|
77
|
+
},
|
|
78
|
+
className,
|
|
79
|
+
]}
|
|
80
|
+
{...rest}
|
|
81
|
+
>
|
|
82
|
+
<slot />
|
|
83
|
+
</Tag>
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@starwind-ui/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Starwind UI core components and registry",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./registry.json": "./dist/registry.json",
|
|
14
|
+
"./components/*": "./dist/components/*",
|
|
15
|
+
"./dist/*": "./dist/*"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"astro": "^5.0.0",
|
|
22
|
+
"fs-extra": "^11.2.0",
|
|
23
|
+
"glob": "^10.3.10",
|
|
24
|
+
"tailwindcss": "^4.0.0-beta",
|
|
25
|
+
"tsup": "^8.0.2"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "pnpm clean && tsup",
|
|
29
|
+
"clean": "node -e \"require('fs-extra').remove('dist')\"",
|
|
30
|
+
"dev": "tsup --watch",
|
|
31
|
+
"core:link": "pnpm link --global",
|
|
32
|
+
"core:unlink": "pnpm rm --global @starwind-ui/core",
|
|
33
|
+
"sync:docs": "pnpm exec starwind sync src/components ../../apps/docs/src/components/starwind",
|
|
34
|
+
"sync:demo": "pnpm exec starwind sync src/components ../../apps/demo/src/components/starwind",
|
|
35
|
+
"publish:beta": "pnpm publish --tag beta --access public",
|
|
36
|
+
"publish:next": "pnpm publish --tag next --access public",
|
|
37
|
+
"publish:release": "pnpm publish --access public"
|
|
38
|
+
}
|
|
39
|
+
}
|