@clepit/react 0.2.0 → 0.2.1-beta.350
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 +14 -26
- package/dist/editor.cjs +1 -1
- package/dist/editor.js +1 -1
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
# @clepit/react
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React components for the [Clepit](https://clepit.com) block-style editor. `ClepitContent` renders saved documents to finished HTML on the server, so crawlers see real markup and nothing repaints on mount. `ClepitEditor` is the client-only editing component that owns the `Editor.create` lifecycle.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```sh
|
|
8
8
|
bun add @clepit/core @clepit/react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
`react >= 19` and `@clepit/core` are peer dependencies.
|
|
12
12
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
`ClepitContent` renders a document to finished HTML through `renderBlocks`, so it works in Server Components, during SSR inside `'use client'` pages, and in the browser. The markup is in the initial response: crawlers read it, and nothing repaints on mount.
|
|
13
|
+
## Quick start
|
|
16
14
|
|
|
17
15
|
```tsx
|
|
18
16
|
import { ClepitContent } from '@clepit/react';
|
|
@@ -20,34 +18,24 @@ import { ClepitContent } from '@clepit/react';
|
|
|
20
18
|
export const Article = ({ document }) => <ClepitContent data={document} />;
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
The core stylesheet rides along as a hoisted `<style>` tag, deduplicated across instances by React. Interactive blocks come alive after mount through `activateBlocks` from `@clepit/core`: code variant tabs, language sync and the copy button, openapi response tabs, and the table CSV download all work on the server-rendered markup, and only the interactive blocks' data crosses to the browser. Optional props:
|
|
24
|
-
|
|
25
|
-
- `theme`: `'auto' | 'light' | 'dark'` (default `'auto'`)
|
|
26
|
-
- `themeOverrides`: `{ light?, dark? }` token overrides, emitted as a scoped stylesheet
|
|
27
|
-
- `context`: `docHref` for doc-card links, `mapsEmbedKey` for map embeds, `activeVariant` for code blocks
|
|
28
|
-
- `transformHtml`: pure post-processing of the rendered HTML string, e.g. injecting anchor ids
|
|
29
|
-
- `className`, `testId`
|
|
30
|
-
|
|
31
|
-
## Edit content
|
|
32
|
-
|
|
33
|
-
`ClepitEditor` is client-only and lives on its own subpath so importing the display component never pulls editing code into a server bundle.
|
|
34
|
-
|
|
35
21
|
```tsx
|
|
36
22
|
'use client';
|
|
37
23
|
|
|
38
24
|
import { ClepitEditor } from '@clepit/react/editor';
|
|
39
25
|
|
|
40
|
-
export const Compose = ({ initialData, onSave }) =>
|
|
41
|
-
<ClepitEditor
|
|
42
|
-
initialData={initialData}
|
|
43
|
-
onChange={data => onSave(data)}
|
|
44
|
-
placeholder='Start writing'
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
26
|
+
export const Compose = ({ initialData, onSave }) => <ClepitEditor initialData={initialData} onChange={onSave} />;
|
|
47
27
|
```
|
|
48
28
|
|
|
49
|
-
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
The full documentation lives at [clepit.com/docs](https://clepit.com/docs) and is rendered with these components:
|
|
32
|
+
|
|
33
|
+
- [React components](https://clepit.com/docs/react)
|
|
34
|
+
- [Getting started](https://clepit.com/docs/getting-started)
|
|
35
|
+
- [Block types](https://clepit.com/docs/blocks)
|
|
36
|
+
- [Theming](https://clepit.com/docs/themes)
|
|
37
|
+
- [API reference](https://clepit.com/docs/api)
|
|
50
38
|
|
|
51
39
|
## License
|
|
52
40
|
|
|
53
|
-
MIT
|
|
41
|
+
MIT.
|
package/dist/editor.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";"use client";var
|
|
2
|
+
"use strict";"use client";var u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var U=(i,r)=>{for(var t in r)u(i,t,{get:r[t],enumerable:!0})},P=(i,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of I(r))!E.call(i,d)&&d!==t&&u(i,d,{get:()=>r[d],enumerable:!(l=v(r,d))||l.enumerable});return i};var A=i=>P(u({},"__esModule",{value:!0}),i);var y={};U(y,{ClepitEditor:()=>C});module.exports=A(y);var f=require("@clepit/core"),s=require("react"),p=require("react/jsx-runtime"),C=({className:i,id:r,onApi:t,testId:l,...d})=>{let g=(0,s.useId)(),a=r??`clepit-editor-${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,n=(0,s.useRef)({config:d,onApi:t});return n.current={config:d,onApi:t},(0,s.useEffect)(()=>{let o=n.current.config,m=f.Editor.create({...o,audioUploader:o.audioUploader?e=>n.current.config.audioUploader?.(e)??Promise.resolve(""):void 0,containerId:a,fileUploader:o.fileUploader?e=>n.current.config.fileUploader?.(e)??Promise.resolve(""):void 0,imageUploader:o.imageUploader?e=>n.current.config.imageUploader?.(e)??Promise.resolve(""):void 0,onChange:o.onChange?e=>n.current.config.onChange?.(e):void 0,onEmbedAction:o.onEmbedAction?(e,c)=>n.current.config.onEmbedAction?.(e,c):void 0,onInlineRewrite:o.onInlineRewrite?(e,c)=>n.current.config.onInlineRewrite?.(e,c)??Promise.resolve(null):void 0,onIssueAction:o.onIssueAction?(e,c)=>n.current.config.onIssueAction?.(e,c):void 0,onLocaleFallback:o.onLocaleFallback?e=>n.current.config.onLocaleFallback?.(e):void 0,onReady:o.onReady?()=>n.current.config.onReady?.():void 0,resolveIssues:o.resolveIssues?e=>n.current.config.resolveIssues?.(e)??Promise.resolve({}):void 0,resolveLink:o.resolveLink?e=>n.current.config.resolveLink?.(e)??Promise.resolve({}):void 0,videoUploader:o.videoUploader?e=>n.current.config.videoUploader?.(e)??Promise.resolve(""):void 0});return n.current.onApi?.(m),()=>f.Editor.destroy(a)},[a]),(0,p.jsx)("div",{className:i,"data-testid":l,id:a})};0&&(module.exports={ClepitEditor});
|
|
3
3
|
//# sourceMappingURL=editor.cjs.map
|
package/dist/editor.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use client";import{Editor as
|
|
2
|
+
"use client";import{Editor as s}from"@clepit/core";import{useEffect as p,useId as g,useRef as m}from"react";import{jsx as v}from"react/jsx-runtime";var U=({className:c,id:l,onApi:d,testId:a,...t})=>{let u=g(),i=l??`clepit-editor-${u.replace(/[^a-zA-Z0-9_-]/g,"")}`,n=m({config:t,onApi:d});return n.current={config:t,onApi:d},p(()=>{let o=n.current.config,f=s.create({...o,audioUploader:o.audioUploader?e=>n.current.config.audioUploader?.(e)??Promise.resolve(""):void 0,containerId:i,fileUploader:o.fileUploader?e=>n.current.config.fileUploader?.(e)??Promise.resolve(""):void 0,imageUploader:o.imageUploader?e=>n.current.config.imageUploader?.(e)??Promise.resolve(""):void 0,onChange:o.onChange?e=>n.current.config.onChange?.(e):void 0,onEmbedAction:o.onEmbedAction?(e,r)=>n.current.config.onEmbedAction?.(e,r):void 0,onInlineRewrite:o.onInlineRewrite?(e,r)=>n.current.config.onInlineRewrite?.(e,r)??Promise.resolve(null):void 0,onIssueAction:o.onIssueAction?(e,r)=>n.current.config.onIssueAction?.(e,r):void 0,onLocaleFallback:o.onLocaleFallback?e=>n.current.config.onLocaleFallback?.(e):void 0,onReady:o.onReady?()=>n.current.config.onReady?.():void 0,resolveIssues:o.resolveIssues?e=>n.current.config.resolveIssues?.(e)??Promise.resolve({}):void 0,resolveLink:o.resolveLink?e=>n.current.config.resolveLink?.(e)??Promise.resolve({}):void 0,videoUploader:o.videoUploader?e=>n.current.config.videoUploader?.(e)??Promise.resolve(""):void 0});return n.current.onApi?.(f),()=>s.destroy(i)},[i]),v("div",{className:c,"data-testid":a,id:i})};export{U as ClepitEditor};
|
|
3
3
|
//# sourceMappingURL=editor.js.map
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"author": "Bomdisoft",
|
|
3
|
+
"description": "React components for the Clepit block-style editor: server-first content rendering and a client-only editor component",
|
|
3
4
|
"devDependencies": {
|
|
4
5
|
"@bomdisoft/typescript-config": "0.0.0",
|
|
5
|
-
"@clepit/core": "0.
|
|
6
|
-
"@happy-dom/global-registrator": "^20.
|
|
6
|
+
"@clepit/core": "0.5.0",
|
|
7
|
+
"@happy-dom/global-registrator": "^20.11.6",
|
|
7
8
|
"@testing-library/react": "^16.3.2",
|
|
8
|
-
"@types/bun": "^1.
|
|
9
|
-
"@types/react": "^19.2.
|
|
10
|
-
"@types/react-dom": "^19.2.
|
|
11
|
-
"react": "19.2.
|
|
12
|
-
"react-dom": "19.2.
|
|
9
|
+
"@types/bun": "^1.4.0",
|
|
10
|
+
"@types/react": "^19.2.18",
|
|
11
|
+
"@types/react-dom": "^19.2.4",
|
|
12
|
+
"react": "19.2.8",
|
|
13
|
+
"react-dom": "19.2.8",
|
|
13
14
|
"tsup": "8.5.1",
|
|
14
15
|
"typescript": "^6.0.3"
|
|
15
16
|
},
|
|
@@ -28,12 +29,13 @@
|
|
|
28
29
|
},
|
|
29
30
|
"files": ["dist", "!dist/**/*.map"],
|
|
30
31
|
"homepage": "https://clepit.com",
|
|
32
|
+
"keywords": ["clepit", "react", "editor", "block-editor", "block-style editor", "rich-text", "ssr", "server-components", "renderer", "editorjs"],
|
|
31
33
|
"license": "MIT",
|
|
32
34
|
"main": "./dist/index.cjs",
|
|
33
35
|
"module": "./dist/index.js",
|
|
34
36
|
"name": "@clepit/react",
|
|
35
37
|
"peerDependencies": {
|
|
36
|
-
"@clepit/core": "^0.
|
|
38
|
+
"@clepit/core": "^0.5.0",
|
|
37
39
|
"react": ">=19"
|
|
38
40
|
},
|
|
39
41
|
"publishConfig": {
|
|
@@ -52,5 +54,5 @@
|
|
|
52
54
|
"sideEffects": false,
|
|
53
55
|
"type": "module",
|
|
54
56
|
"types": "./dist/index.d.ts",
|
|
55
|
-
"version": "0.2.
|
|
57
|
+
"version": "0.2.1-beta.350"
|
|
56
58
|
}
|