@reiwuzen/blocky-react 1.0.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rei WuZen
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,163 @@
1
+ # @reiwuzen/blocky-react
2
+
3
+ React UI layer for **@reiwuzen/blocky** โ€” a composable, headless block editor engine.
4
+
5
+ This package provides React components, hooks, and store bindings for building Notion-style editors while keeping core logic framework-agnostic.
6
+
7
+ ---
8
+
9
+ ## โœจ Features
10
+
11
+ - Composable block components
12
+ - Controlled & uncontrolled modes
13
+ - Zustand-based state isolation
14
+ - Headless engine separation (`@reiwuzen/blocky`)
15
+ - Fully testable
16
+ - No CSS framework required
17
+ - ESM + CJS support
18
+
19
+ ---
20
+
21
+ ## ๐Ÿ“ฆ Installation
22
+
23
+ ```bash
24
+ pnpm add @reiwuzen/blocky-react @reiwuzen/blocky
25
+ # or
26
+ npm install @reiwuzen/blocky-react @reiwuzen/blocky
27
+ ```
28
+
29
+ Peer dependencies:
30
+
31
+ ```bash
32
+ react >= 18
33
+ react-dom >= 18
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ๐Ÿš€ Basic Usage (Uncontrolled)
39
+
40
+ ```tsx
41
+ import { Editor } from "@reiwuzen/blocky-react";
42
+ import "@reiwuzen/blocky-react/styles.css";
43
+
44
+ export default function App() {
45
+ return (
46
+ <Editor />
47
+ );
48
+ }
49
+ ```
50
+
51
+ The editor will initialize with a single empty paragraph block.
52
+
53
+ ---
54
+
55
+ ## ๐ŸŽฏ Controlled Mode
56
+
57
+ ```tsx
58
+ import { useState } from "react";
59
+ import { Editor } from "@reiwuzen/blocky-react";
60
+ import type { AnyBlock } from "@reiwuzen/blocky";
61
+
62
+ export default function App() {
63
+ const [blocks, setBlocks] = useState<AnyBlock[]>([]);
64
+
65
+ return (
66
+ <Editor
67
+ blocks={blocks}
68
+ onChange={setBlocks}
69
+ />
70
+ );
71
+ }
72
+ ```
73
+
74
+ You now own the editor state.
75
+
76
+ ---
77
+
78
+ ## ๐Ÿงฑ Available Components
79
+
80
+ You can build your own layout using individual components:
81
+
82
+ ```tsx
83
+ import {
84
+ BlockList,
85
+ Block,
86
+ FormatToolbar,
87
+ BlockTypeSwitcher
88
+ } from "@reiwuzen/blocky-react";
89
+ ```
90
+
91
+ ---
92
+
93
+ ## ๐Ÿช Hooks
94
+
95
+ ```tsx
96
+ import {
97
+ useBlocks,
98
+ useActiveBlockId,
99
+ useEditorActions
100
+ } from "@reiwuzen/blocky-react";
101
+ ```
102
+
103
+ Example:
104
+
105
+ ```tsx
106
+ const blocks = useBlocks();
107
+ const { insertBlockAfter } = useEditorActions();
108
+ ```
109
+
110
+ ---
111
+
112
+ ## ๐Ÿ— Architecture
113
+
114
+ ```
115
+ @reiwuzen/blocky โ†’ Headless editor engine
116
+ @reiwuzen/blocky-react โ†’ React UI adapter
117
+ ```
118
+
119
+ Core editing logic lives in `blocky`.
120
+ React layer only handles rendering and interaction.
121
+
122
+ This separation ensures:
123
+
124
+ - Framework independence
125
+ - Testability
126
+ - Predictable state updates
127
+ - Clean packaging
128
+
129
+ ---
130
+
131
+ ## ๐ŸŽจ Styling
132
+
133
+ Basic styles are included:
134
+
135
+ ```tsx
136
+ import "@reiwuzen/blocky-react/styles.css";
137
+ ```
138
+
139
+ You may fully override styles or ignore them entirely.
140
+
141
+ ---
142
+
143
+ ## ๐Ÿงช Testing
144
+
145
+ This package uses:
146
+
147
+ - Vitest
148
+ - React Testing Library
149
+ - jsdom
150
+
151
+ All components are fully testable without a browser.
152
+
153
+ ---
154
+
155
+ ## ๐Ÿ“„ License
156
+
157
+ ISC
158
+
159
+ ---
160
+
161
+ ## ๐Ÿ‘ค Author
162
+
163
+ Rei WuZen