@lit-pigeon/react 0.1.4 → 0.1.5
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 +51 -0
- package/package.json +19 -4
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @lit-pigeon/react
|
|
2
|
+
|
|
3
|
+
React wrapper for the [Lit Pigeon](https://github.com/snxstudio/lit-pigeon)
|
|
4
|
+
email editor. Wraps the `<pigeon-editor>` custom element with
|
|
5
|
+
[`@lit/react`](https://www.npmjs.com/package/@lit/react) so you get a real
|
|
6
|
+
React component with typed `on*` event props.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @lit-pigeon/react
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires `react` and `react-dom` (v18 or v19) as peer dependencies.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { PigeonEditor } from '@lit-pigeon/react';
|
|
20
|
+
import type { PigeonDocument } from '@lit-pigeon/react';
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
return (
|
|
24
|
+
<PigeonEditor
|
|
25
|
+
onChange={(e) => console.log(e.detail.document)}
|
|
26
|
+
onSelect={(e) => console.log(e.detail.selection)}
|
|
27
|
+
onReady={() => console.log('ready')}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Event props
|
|
34
|
+
|
|
35
|
+
| Prop | DOM event | Detail |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `onChange` | `pigeon:change` | `{ document: PigeonDocument }` |
|
|
38
|
+
| `onSelect` | `pigeon:select` | `{ selection: Selection \| null }` |
|
|
39
|
+
| `onReady` | `pigeon:ready` | `void` |
|
|
40
|
+
| `onPreview` | `pigeon:preview` | `void` |
|
|
41
|
+
| `onExport` | `pigeon:export` | `void` |
|
|
42
|
+
|
|
43
|
+
Set the initial document and config as props (they are assigned as live DOM
|
|
44
|
+
properties, never stringified). Core types — `PigeonDocument`, `EditorConfig`,
|
|
45
|
+
`Selection`, `ContentBlock`, and friends — are re-exported for convenience.
|
|
46
|
+
|
|
47
|
+
Part of [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) — open-source drag-and-drop email editor.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-pigeon/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "React wrapper for the Pigeon email editor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
17
19
|
],
|
|
18
20
|
"dependencies": {
|
|
19
21
|
"@lit/react": "^1.0.0",
|
|
20
|
-
"@lit-pigeon/core": "^0.3.
|
|
21
|
-
"@lit-pigeon/editor": "^0.3.
|
|
22
|
+
"@lit-pigeon/core": "^0.3.1",
|
|
23
|
+
"@lit-pigeon/editor": "^0.3.1"
|
|
22
24
|
},
|
|
23
25
|
"peerDependencies": {
|
|
24
26
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -40,6 +42,19 @@
|
|
|
40
42
|
"directory": "packages/react"
|
|
41
43
|
},
|
|
42
44
|
"license": "MIT",
|
|
45
|
+
"homepage": "https://github.com/snxstudio/lit-pigeon/tree/main/packages/react#readme",
|
|
46
|
+
"bugs": "https://github.com/snxstudio/lit-pigeon/issues",
|
|
47
|
+
"author": "Lit Pigeon Contributors",
|
|
48
|
+
"keywords": [
|
|
49
|
+
"email",
|
|
50
|
+
"email-template",
|
|
51
|
+
"email-editor",
|
|
52
|
+
"mjml",
|
|
53
|
+
"html-email",
|
|
54
|
+
"lit",
|
|
55
|
+
"web-components",
|
|
56
|
+
"react"
|
|
57
|
+
],
|
|
43
58
|
"scripts": {
|
|
44
59
|
"build": "vite build",
|
|
45
60
|
"dev": "vite build --watch",
|