@mdocify/components 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/README.md +36 -0
- package/index.d.ts +6 -0
- package/index.ts +10 -0
- package/package.json +54 -0
- package/src/callout.astro +39 -0
- package/src/icon.astro +16 -0
- package/src/icons.ts +10 -0
- package/src/types.ts +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/non-html-pages)
|
|
10
|
+
[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/non-html-pages)
|
|
11
|
+
[](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) |
|
|
36
|
+
# mdocify-components
|
package/index.d.ts
ADDED
package/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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 Callout from './src/callout.astro'
|
|
5
|
+
import Icon from './src/icon.astro'
|
|
6
|
+
|
|
7
|
+
export * from '@lucide/astro'
|
|
8
|
+
export * from './src/icons'
|
|
9
|
+
|
|
10
|
+
export { Callout, Icon }
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mdocify/components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.ts",
|
|
8
|
+
"./callout.astro": "./src/callout.astro",
|
|
9
|
+
"./icon.astro": "./src/icon.astro",
|
|
10
|
+
"./types": "./src/types.ts",
|
|
11
|
+
"./icons": "./src/icons.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"index.ts",
|
|
16
|
+
"index.d.ts",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"astro-component",
|
|
25
|
+
"mdocify",
|
|
26
|
+
"markdoc",
|
|
27
|
+
"components",
|
|
28
|
+
"markdoc components"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"astro": "^5.16.6",
|
|
33
|
+
"@lucide/astro": "^0.562.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"astro": "^4.0.0 || ^5.0.0",
|
|
37
|
+
"@lucide/astro": "^0.562.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
},
|
|
41
|
+
"author": "Lazaro Osee <oseelazaro@gmail.com> (https://www.lazaroosee.xyz)",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/lazosee/mdocify-components.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/lazosee/mdocify-components/issues"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from './icon.astro';
|
|
3
|
+
import type { CalloutProps } from './types';
|
|
4
|
+
|
|
5
|
+
interface Props extends CalloutProps {}
|
|
6
|
+
const { title, type } = Astro.props;
|
|
7
|
+
|
|
8
|
+
const icon = type === "danger" ? "triangle-alert" : type ==="success" ? "circle-check" : type === 'warning' ? 'circle-alert' : 'lightbulb'
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div class:list={[
|
|
12
|
+
'block m-1 border border-spacing-1.5 overflow-hidden rounded-xl [corner-shape:squircle]',
|
|
13
|
+
{'border-teal-700': type === 'tip'},
|
|
14
|
+
{'border-orange-700': type === 'warning'},
|
|
15
|
+
{'border-red-700': type === 'danger'},
|
|
16
|
+
{'border-green-700': type === 'success'}
|
|
17
|
+
]}>
|
|
18
|
+
<div class:list={[
|
|
19
|
+
'flex font-semibold p-2 gap-2 justify-start items-center text-white',
|
|
20
|
+
{'bg-teal-500': type === 'tip'},
|
|
21
|
+
{'bg-orange-500': type === 'warning'},
|
|
22
|
+
{'bg-red-500': type === 'danger'},
|
|
23
|
+
{'bg-green-500': type === 'success'}
|
|
24
|
+
]}>
|
|
25
|
+
<slot name="icon">
|
|
26
|
+
<Icon name={icon} class="w-8" />
|
|
27
|
+
</slot>
|
|
28
|
+
<slot name="title">{title}</slot>
|
|
29
|
+
</div>
|
|
30
|
+
<div class:list={[
|
|
31
|
+
"block p-2",
|
|
32
|
+
{'bg-teal-50': type === 'tip'},
|
|
33
|
+
{'bg-orange-50': type === 'warning'},
|
|
34
|
+
{'bg-red-50': type === 'danger'},
|
|
35
|
+
{'bg-green-50': type === 'success'}
|
|
36
|
+
]}>
|
|
37
|
+
<slot></slot>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
package/src/icon.astro
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import { iconsList } from './icons';
|
|
4
|
+
import type { IconProps } from './types';
|
|
5
|
+
|
|
6
|
+
type Props = IconProps & Omit<HTMLAttributes<'svg'>, "color">;
|
|
7
|
+
const { name, slot, ...rest } = Astro.props
|
|
8
|
+
|
|
9
|
+
const LucideIcon = iconsList[name] as any;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
{ (slot===undefined) ? (
|
|
13
|
+
<LucideIcon {...rest} />
|
|
14
|
+
) : (
|
|
15
|
+
<LucideIcon {slot} {...rest} />
|
|
16
|
+
)}
|
package/src/icons.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CircleAlert, CircleCheck, Lightbulb, TriangleAlert } from '@lucide/astro/icons/index'
|
|
2
|
+
|
|
3
|
+
export const iconsList = {
|
|
4
|
+
lightbulb: Lightbulb,
|
|
5
|
+
'circle-check': CircleCheck,
|
|
6
|
+
'circle-alert': CircleAlert,
|
|
7
|
+
'triangle-alert': TriangleAlert,
|
|
8
|
+
} as const
|
|
9
|
+
|
|
10
|
+
export type IconType = keyof typeof iconsList
|