@macolmenerori/component-library 1.1.0 → 1.1.2
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 +35 -14
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@ A modern React component library built with TypeScript, providing reusable UI co
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- Built with React and TypeScript
|
|
7
|
+
- Built with React 18/19 and TypeScript
|
|
8
8
|
- Fully typed components with TypeScript declarations
|
|
9
9
|
- ESM and CommonJS support
|
|
10
|
-
-
|
|
10
|
+
- **Subpath exports** for tree-shaking and optional dependencies
|
|
11
11
|
- Strict TypeScript configuration for type safety
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -34,7 +34,15 @@ yarn add @macolmenerori/component-library
|
|
|
34
34
|
|
|
35
35
|
## Usage
|
|
36
36
|
|
|
37
|
-
Import components from the library
|
|
37
|
+
Import components from the library. You can use the main entry point or subpath imports for better tree-shaking.
|
|
38
|
+
|
|
39
|
+
### Subpath Exports
|
|
40
|
+
|
|
41
|
+
| Import Path | Components | Dependencies Required |
|
|
42
|
+
| -------------------------------------------------- | -------------- | --------------------------------- |
|
|
43
|
+
| `@macolmenerori/component-library` | All | react, react-markdown, remark-gfm |
|
|
44
|
+
| `@macolmenerori/component-library/theme-switch` | ThemeSwitch | react |
|
|
45
|
+
| `@macolmenerori/component-library/markdown-render` | MarkdownRender | react, react-markdown, remark-gfm |
|
|
38
46
|
|
|
39
47
|
### Available Components
|
|
40
48
|
|
|
@@ -53,7 +61,10 @@ A visually appealing theme toggle component with sun/moon animations, clouds, an
|
|
|
53
61
|
|
|
54
62
|
```tsx
|
|
55
63
|
import { useState } from 'react';
|
|
56
|
-
|
|
64
|
+
// Import CSS separately (required for styling)
|
|
65
|
+
import '@macolmenerori/component-library/theme-switch-css';
|
|
66
|
+
// Subpath import (recommended - no react-markdown dependency required)
|
|
67
|
+
import { ThemeSwitch } from '@macolmenerori/component-library/theme-switch';
|
|
57
68
|
|
|
58
69
|
function App() {
|
|
59
70
|
const [darkMode, setDarkMode] = useState(false);
|
|
@@ -66,6 +77,8 @@ function App() {
|
|
|
66
77
|
}
|
|
67
78
|
```
|
|
68
79
|
|
|
80
|
+
> **Note:** ThemeSwitch requires manual CSS import to support SSG/SSR environments. Import the CSS file before using the component.
|
|
81
|
+
|
|
69
82
|
</details>
|
|
70
83
|
|
|
71
84
|
<details>
|
|
@@ -73,6 +86,8 @@ function App() {
|
|
|
73
86
|
|
|
74
87
|
A simple and flexible markdown renderer with GitHub Flavored Markdown (GFM) support, including tables, task lists, strikethrough, and code blocks.
|
|
75
88
|
|
|
89
|
+
> **Note:** This component requires `react-markdown` and `remark-gfm` peer dependencies.
|
|
90
|
+
|
|
76
91
|
**Props:**
|
|
77
92
|
|
|
78
93
|
- `content` (string, required): The markdown string to render
|
|
@@ -89,7 +104,7 @@ A simple and flexible markdown renderer with GitHub Flavored Markdown (GFM) supp
|
|
|
89
104
|
**Example:**
|
|
90
105
|
|
|
91
106
|
```tsx
|
|
92
|
-
import MarkdownRender from '@macolmenerori/component-library';
|
|
107
|
+
import { MarkdownRender } from '@macolmenerori/component-library/markdown-render';
|
|
93
108
|
|
|
94
109
|
function App() {
|
|
95
110
|
const markdownContent = `
|
|
@@ -120,12 +135,17 @@ This is **bold** and this is *italic*.
|
|
|
120
135
|
|
|
121
136
|
## Peer Dependencies
|
|
122
137
|
|
|
123
|
-
|
|
138
|
+
**Required:**
|
|
139
|
+
|
|
140
|
+
- `react`: ^18.0.0 or ^19.0.0
|
|
141
|
+
- `react-dom`: ^18.0.0 or ^19.0.0
|
|
142
|
+
|
|
143
|
+
**Optional** (only needed for MarkdownRender):
|
|
124
144
|
|
|
125
|
-
-
|
|
126
|
-
-
|
|
145
|
+
- `react-markdown`: ^10.0.0
|
|
146
|
+
- `react-gfm`: ^4.0.0
|
|
127
147
|
|
|
128
|
-
|
|
148
|
+
If you only use ThemeSwitch via the subpath import (`/theme-switch`), you don't need to install react-markdown.
|
|
129
149
|
|
|
130
150
|
## Development
|
|
131
151
|
|
|
@@ -134,7 +154,7 @@ This section is for contributors working on the library itself.
|
|
|
134
154
|
### Prerequisites
|
|
135
155
|
|
|
136
156
|
- Node.js 24
|
|
137
|
-
- pnpm 10.
|
|
157
|
+
- pnpm 10.28.0
|
|
138
158
|
|
|
139
159
|
### Setup
|
|
140
160
|
|
|
@@ -159,11 +179,12 @@ To build the library:
|
|
|
159
179
|
pnpm build
|
|
160
180
|
```
|
|
161
181
|
|
|
162
|
-
This will generate:
|
|
182
|
+
This will generate multiple entry points:
|
|
163
183
|
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
184
|
+
- `dist/index.js` / `dist/index.cjs` - Main entry (all components)
|
|
185
|
+
- `dist/theme-switch.js` / `dist/theme-switch.cjs` - ThemeSwitch only
|
|
186
|
+
- `dist/markdown-render.js` / `dist/markdown-render.cjs` - MarkdownRender only
|
|
187
|
+
- `dist/types/` - TypeScript declarations
|
|
167
188
|
|
|
168
189
|
### Publishing
|
|
169
190
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macolmenerori/component-library",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"default": "./dist/theme-switch.cjs"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
+
"./theme-switch-css": "./dist/ThemeSwitch.css",
|
|
40
41
|
"./markdown-render": {
|
|
41
42
|
"import": {
|
|
42
43
|
"types": "./dist/types/components/MarkdownRender/index.d.ts",
|