@pindoba/astro-button 0.0.0-alpha-20241003230712

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 ADDED
@@ -0,0 +1,35 @@
1
+ # Astro Starter Kit: Component Package
2
+
3
+ This is a template for an Astro component library. Use this template for writing components to use in multiple projects or publish to NPM.
4
+
5
+ ```sh
6
+ npm create astro@latest -- --template component
7
+ ```
8
+
9
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/non-html-pages)
10
+ [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/non-html-pages)
11
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/component/devcontainer.json)
12
+
13
+ ## 🚀 Project Structure
14
+
15
+ Inside of your Astro project, you'll see the following folders and files:
16
+
17
+ ```text
18
+ /
19
+ ├── index.ts
20
+ ├── src
21
+ │ └── MyComponent.astro
22
+ ├── tsconfig.json
23
+ ├── package.json
24
+ ```
25
+
26
+ The `index.ts` file is the "entry point" for your package. Export your components in `index.ts` to make them importable from your package.
27
+
28
+ ## 🧞 Commands
29
+
30
+ All commands are run from the root of the project, from a terminal:
31
+
32
+ | Command | Action |
33
+ | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `npm link` | Registers this package locally. Run `npm link my-component-library` in an Astro project to install your components |
35
+ | `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) |
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ // Do not write code directly here, instead use the `src` folder!
2
+ // Then, use this file to export everything you want your user to access.
3
+
4
+ import Button from "./src/Button.astro";
5
+
6
+ export default Button;
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@pindoba/astro-button",
3
+ "version": "0.0.0-alpha-20241003230712",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.ts"
7
+ },
8
+ "files": [
9
+ "src",
10
+ "index.ts"
11
+ ],
12
+ "keywords": [
13
+ "astro-component"
14
+ ],
15
+ "devDependencies": {
16
+ "astro": "^4.15.11"
17
+ },
18
+ "peerDependencies": {
19
+ "astro": "^4.0.0"
20
+ },
21
+ "dependencies": {
22
+ "@astrojs/check": "^0.9.3",
23
+ "typescript": "^5.6.2",
24
+ "@pindoba/styles": "0.0.0-alpha-20241003230712",
25
+ "@pindoba/panda": "0.0.0-alpha-20241003230712"
26
+ },
27
+ "scripts": {
28
+ "lint": "eslint . --max-warnings 0",
29
+ "lint:fix": "eslint . --fix --max-warnings 0",
30
+ "format": "prettier --write .",
31
+ "format:fix": "prettier --write .",
32
+ "check": "astro check",
33
+ "dev": "astro check --watch",
34
+ "clean": "rm -rf .astro && rm -rf node_modules && rm -rf .turbo"
35
+ }
36
+ }
@@ -0,0 +1,37 @@
1
+ ---
2
+ import { css, cx } from "@pindoba/panda/css";
3
+ import {
4
+ buttonStyles,
5
+ getButtonFeedbackColor,
6
+ type ButtonFeedback,
7
+ type ButtonStyleProps,
8
+ } from "@pindoba/styles/button";
9
+
10
+ import type { HTMLAttributes } from "astro/types";
11
+
12
+ interface Props extends HTMLAttributes<"button"> {
13
+ feedback?: ButtonFeedback;
14
+ emphasis?: ButtonStyleProps["emphasis"];
15
+ shape?: ButtonStyleProps["shape"];
16
+ size?: ButtonStyleProps["size"];
17
+ }
18
+
19
+ const { emphasis, shape, size, class: className, ...props } = Astro.props;
20
+
21
+ const classes = buttonStyles({
22
+ emphasis,
23
+ shape,
24
+ size,
25
+ });
26
+ ---
27
+
28
+ <button
29
+ class={cx(
30
+ css({ colorPalette: getButtonFeedbackColor(Astro.props.feedback) }),
31
+ classes.root,
32
+ className,
33
+ )}
34
+ {...props}
35
+ >
36
+ <slot />
37
+ </button>
package/src/env.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
2
+ /// <reference path="../.astro/types.d.ts" />