@refactico/pages 0.1.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) 2023 Rayyamhk
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,99 @@
1
+ # @refactico/pages
2
+
3
+ A Medium-style block editor for React applications. Build rich content editors with support for text, headings, images, code blocks, tables, lists, quotes, callouts, and more.
4
+
5
+ [![Storybook](https://img.shields.io/badge/Storybook-Live%20Demo-ff4785?logo=storybook&logoColor=white)](https://refactico.github.io/pages/)
6
+ [![npm](https://img.shields.io/npm/v/@refactico/pages)](https://www.npmjs.com/package/@refactico/pages)
7
+
8
+ ## Demo
9
+
10
+ **[View Live Storybook →](https://refactico.github.io/pages/)**
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @refactico/pages
16
+ # or
17
+ pnpm add @refactico/pages
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```tsx
23
+ import { PagesEditor, createEmptyEditorData } from '@refactico/pages';
24
+ import '@refactico/pages/style.css';
25
+
26
+ function App() {
27
+ const [data, setData] = useState(createEmptyEditorData());
28
+
29
+ return (
30
+ <PagesEditor
31
+ initialData={data}
32
+ onChange={setData}
33
+ theme="light"
34
+ />
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## Features
40
+
41
+ - **9 Block Types**: Text, Heading (H1-H6), Image, Code, Table, Divider, Quote, List, Callout
42
+ - **Rich Formatting**: Bold, italic, underline, strikethrough, inline code, links
43
+ - **Drag & Drop**: Reorder blocks with intuitive drag handles
44
+ - **Dark Mode**: Full light/dark theme support
45
+ - **Keyboard Shortcuts**: Markdown-style shortcuts (e.g., `# ` for headings, `- ` for lists)
46
+ - **Smart Toolbars**: Context-aware toolbars that flip position when near viewport edges
47
+ - **Accessible**: ARIA labels and keyboard navigation support
48
+ - **TypeScript**: Fully typed API
49
+
50
+ ## Tech Stack
51
+
52
+ - React 19
53
+ - TypeScript
54
+ - Tailwind CSS
55
+ - Vite
56
+
57
+ ## Development
58
+
59
+ 1. Clone this repository
60
+ 2. Install dependencies: `pnpm install`
61
+ 3. Start Storybook: `pnpm dev`
62
+
63
+ ## Scripts
64
+
65
+ - `dev`: Starts the local Storybook server, use this to develop and preview your components.
66
+ - `test`: Runs all your tests with vitest.
67
+ - `test:watch`: Runs tests in watch mode.
68
+ - `build`: Builds your Storybook as a static web application.
69
+ - `build:lib`: Builds your component library with Vite.
70
+ - `lint`: Runs ESLint.
71
+ - `format`: Formats your code with Prettier.
72
+
73
+ ## API
74
+
75
+ ### PagesEditor Props
76
+
77
+ | Prop | Type | Default | Description |
78
+ | ------------- | ---------------------------- | -------------------- | ----------------------------- |
79
+ | `initialData` | `EditorData` | - | Initial editor content |
80
+ | `onChange` | `(data: EditorData) => void` | - | Callback when content changes |
81
+ | `readOnly` | `boolean` | `false` | Disable editing |
82
+ | `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
83
+ | `placeholder` | `string` | `'Start writing...'` | Empty state placeholder |
84
+
85
+ ### Utility Functions
86
+
87
+ ```tsx
88
+ import {
89
+ createEmptyEditorData,
90
+ createTextBlock,
91
+ createHeadingBlock,
92
+ validateEditorData,
93
+ generateId,
94
+ } from '@refactico/pages';
95
+ ```
96
+
97
+ ## License
98
+
99
+ MIT