@coze-editor/react 0.1.0-alpha.0fd19e
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 +21 -0
- package/dist/esm/index.js +129 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 coze-dev
|
|
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.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// src/renderer.tsx
|
|
2
|
+
import React2, {
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef as useRef2,
|
|
5
|
+
useState as useState2
|
|
6
|
+
} from "react";
|
|
7
|
+
import {
|
|
8
|
+
create
|
|
9
|
+
} from "@coze-editor/core";
|
|
10
|
+
|
|
11
|
+
// src/provider.tsx
|
|
12
|
+
import React, {
|
|
13
|
+
createContext,
|
|
14
|
+
useContext,
|
|
15
|
+
useRef,
|
|
16
|
+
useState
|
|
17
|
+
} from "react";
|
|
18
|
+
import { createInjector } from "@coze-editor/core";
|
|
19
|
+
var InternalEditorContext = createContext(null);
|
|
20
|
+
var InternalSetEditorContext = createContext(null);
|
|
21
|
+
var InjectorContext = createContext(void 0);
|
|
22
|
+
function useEditor() {
|
|
23
|
+
return useContext(InternalEditorContext);
|
|
24
|
+
}
|
|
25
|
+
function useSetEditor() {
|
|
26
|
+
return useContext(InternalSetEditorContext);
|
|
27
|
+
}
|
|
28
|
+
function useInjector() {
|
|
29
|
+
const injector = useContext(InjectorContext);
|
|
30
|
+
if (!injector) {
|
|
31
|
+
throw new Error("useInjector should be used in EditorProvider");
|
|
32
|
+
}
|
|
33
|
+
return injector;
|
|
34
|
+
}
|
|
35
|
+
function EditorProvider({ children }) {
|
|
36
|
+
const [editor, setEditor] = useState(null);
|
|
37
|
+
const injectorRef = useRef(null);
|
|
38
|
+
if (!injectorRef.current) {
|
|
39
|
+
injectorRef.current = createInjector();
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ React.createElement(InternalEditorContext.Provider, { value: editor }, /* @__PURE__ */ React.createElement(InternalSetEditorContext.Provider, { value: setEditor }, /* @__PURE__ */ React.createElement(InjectorContext.Provider, { value: injectorRef.current }, children)));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/renderer.tsx
|
|
45
|
+
function firstLetterToUppercase(str) {
|
|
46
|
+
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
47
|
+
}
|
|
48
|
+
function Renderer(props) {
|
|
49
|
+
const {
|
|
50
|
+
plugins,
|
|
51
|
+
defaultValue,
|
|
52
|
+
options,
|
|
53
|
+
domProps = {},
|
|
54
|
+
extensions,
|
|
55
|
+
didMount,
|
|
56
|
+
children
|
|
57
|
+
} = props;
|
|
58
|
+
const [api, setAPI] = useState2();
|
|
59
|
+
const ref = useRef2(null);
|
|
60
|
+
const apiRef = useRef2(null);
|
|
61
|
+
const propsRef = useRef2(null);
|
|
62
|
+
const setEditor = useSetEditor();
|
|
63
|
+
const injector = useInjector();
|
|
64
|
+
propsRef.current = props;
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const { render, eventKeys } = create({
|
|
67
|
+
plugins,
|
|
68
|
+
injector
|
|
69
|
+
});
|
|
70
|
+
const exported = render({
|
|
71
|
+
parent: ref.current,
|
|
72
|
+
defaultValue,
|
|
73
|
+
options: options ?? {},
|
|
74
|
+
extensions
|
|
75
|
+
});
|
|
76
|
+
apiRef.current = exported;
|
|
77
|
+
eventKeys.forEach((eventName) => {
|
|
78
|
+
exported.$on(eventName, (e) => {
|
|
79
|
+
var _a;
|
|
80
|
+
const handler = (_a = propsRef.current) == null ? void 0 : _a[`on${firstLetterToUppercase(eventName)}`];
|
|
81
|
+
if (typeof handler === "function") {
|
|
82
|
+
handler(e);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
if (typeof didMount === "function") {
|
|
87
|
+
didMount(exported);
|
|
88
|
+
}
|
|
89
|
+
setAPI(exported);
|
|
90
|
+
return () => {
|
|
91
|
+
exported.$destroy();
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!api || !setEditor) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
setEditor(api);
|
|
99
|
+
}, [api, setEditor]);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
apiRef.current.$set(props.options ?? {});
|
|
102
|
+
}, [props.options]);
|
|
103
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { ...domProps, ref }), children);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/create-renderer.tsx
|
|
107
|
+
import React3, { useMemo } from "react";
|
|
108
|
+
var OriginRenderer = Renderer;
|
|
109
|
+
function createRenderer(plugins, builtinExtensions) {
|
|
110
|
+
return function CustomRenderer(props) {
|
|
111
|
+
const userExtensions = props.extensions;
|
|
112
|
+
const extensions = useMemo(
|
|
113
|
+
() => [...builtinExtensions ?? [], ...userExtensions ?? []],
|
|
114
|
+
[userExtensions]
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ React3.createElement(OriginRenderer, { ...props, extensions, plugins });
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/index.ts
|
|
121
|
+
export * from "@coze-editor/core";
|
|
122
|
+
export {
|
|
123
|
+
EditorProvider,
|
|
124
|
+
Renderer,
|
|
125
|
+
createRenderer,
|
|
126
|
+
useEditor,
|
|
127
|
+
useInjector
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/renderer.tsx","../../src/provider.tsx","../../src/create-renderer.tsx","../../src/index.ts"],"sourcesContent":["// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, {\n type CSSProperties,\n useEffect,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\n\nimport {\n type EditorPluginSpec,\n type InferEditorAPIFromPlugins,\n type InferEvents,\n type InferValues,\n create,\n} from '@coze-editor/core';\nimport { type Extension } from '@codemirror/state';\n\nimport { useInjector, useSetEditor } from './provider';\n\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\ntype InferReactEvents<T extends Record<string, any>> = UnionToIntersection<{\n [K in keyof T as `on${Capitalize<string & K>}`]?: (e: T[K]) => void;\n}>;\n\nfunction firstLetterToUppercase(str: string) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\ntype InferRendererProps<T extends EditorPluginSpec<string, any, any>[]> = {\n domProps?: {\n style?: CSSProperties;\n className?: string;\n };\n defaultValue?: string;\n options?: Partial<InferValues<T[number]>>;\n extensions?: Extension[];\n didMount?: (api: InferEditorAPIFromPlugins<T>) => void;\n children?: ReactNode;\n} & (InferEvents<T[number]> extends Record<string, any>\n ? InferReactEvents<InferEvents<T[number]>>\n : unknown);\n\nfunction Renderer<T extends EditorPluginSpec<string, any, any>[]>(\n props: { plugins: T } & InferRendererProps<T>,\n) {\n const {\n plugins,\n defaultValue,\n options,\n domProps = {},\n extensions,\n didMount,\n children,\n } = props;\n\n const [api, setAPI] = useState<any>();\n const ref = useRef(null);\n const apiRef = useRef<any>(null);\n const propsRef = useRef<typeof props | null>(null);\n const setEditor = useSetEditor();\n const injector = useInjector();\n\n propsRef.current = props;\n\n useEffect(() => {\n const { render, eventKeys } = create({\n plugins,\n injector,\n });\n\n const exported = render({\n parent: ref.current!,\n defaultValue,\n options: options ?? {},\n extensions,\n });\n\n apiRef.current = exported;\n\n eventKeys.forEach((eventName: any) => {\n exported.$on(eventName, e => {\n const handler = (propsRef.current as any)?.[\n `on${firstLetterToUppercase(eventName)}`\n ];\n if (typeof handler === 'function') {\n handler(e);\n }\n });\n });\n\n if (typeof didMount === 'function') {\n didMount(exported);\n }\n\n setAPI(exported);\n\n return () => {\n exported.$destroy();\n };\n }, []);\n\n useEffect(() => {\n if (!api || !setEditor) {\n return;\n }\n\n setEditor(api);\n }, [api, setEditor]);\n\n useEffect(() => {\n apiRef.current.$set(props.options ?? {});\n }, [props.options]);\n\n return (\n <>\n <div {...domProps} ref={ref} />\n {children}\n </>\n );\n}\n\nexport { Renderer };\n\nexport type { InferRendererProps };\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nimport React, {\n type Dispatch,\n type ReactNode,\n createContext,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { type Injector, createInjector } from '@coze-editor/core';\n\nconst InternalEditorContext = createContext<unknown>(null);\nconst InternalSetEditorContext = createContext<Dispatch<any> | null>(null);\nconst InjectorContext = createContext<Injector | undefined>(undefined);\n\nfunction useEditor<T>(): T {\n return useContext(InternalEditorContext) as T;\n}\n\nfunction useSetEditor(): Dispatch<any> | null {\n return useContext(InternalSetEditorContext);\n}\n\nfunction useInjector(): Injector {\n const injector = useContext(InjectorContext);\n\n if (!injector) {\n throw new Error('useInjector should be used in EditorProvider');\n }\n\n return injector;\n}\n\nfunction EditorProvider({ children }: { children?: ReactNode }) {\n const [editor, setEditor] = useState(null);\n const injectorRef = useRef<Injector | null>(null);\n\n if (!injectorRef.current) {\n injectorRef.current = createInjector();\n }\n\n return (\n <InternalEditorContext.Provider value={editor}>\n <InternalSetEditorContext.Provider value={setEditor}>\n <InjectorContext.Provider value={injectorRef.current}>\n {children}\n </InjectorContext.Provider>\n </InternalSetEditorContext.Provider>\n </InternalEditorContext.Provider>\n );\n}\n\nexport { EditorProvider, useEditor, useSetEditor, useInjector };\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nimport React, { useMemo } from 'react';\n\nimport { type EditorPluginSpec } from '@coze-editor/core';\nimport { type Extension } from '@codemirror/state';\n\nimport { Renderer, type InferRendererProps } from './renderer';\n\nconst OriginRenderer: (props: any) => JSX.Element = Renderer;\n\nfunction createRenderer<T extends EditorPluginSpec<string, any, any>[]>(\n plugins: T,\n builtinExtensions?: Extension[],\n) {\n return function CustomRenderer(props: InferRendererProps<T>) {\n const userExtensions = props.extensions;\n\n const extensions: Extension[] = useMemo(\n () => [...(builtinExtensions ?? []), ...(userExtensions ?? [])],\n [userExtensions],\n );\n\n return (\n <OriginRenderer {...props} extensions={extensions} plugins={plugins} />\n );\n };\n}\n\nexport { createRenderer };\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nexport { Renderer, type InferRendererProps } from './renderer';\n\nexport { createRenderer } from './create-renderer';\n\nexport { EditorProvider, useEditor, useInjector } from './provider';\n\nexport * from '@coze-editor/core';\n"],"mappings":";AAIA,OAAOA;AAAA,EAEL;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,OAEK;AAEP;AAAA,EAKE;AAAA,OACK;;;ACfP,OAAO;AAAA,EAGL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAwB,sBAAsB;AAE9C,IAAM,wBAAwB,cAAuB,IAAI;AACzD,IAAM,2BAA2B,cAAoC,IAAI;AACzE,IAAM,kBAAkB,cAAoC,MAAS;AAErE,SAAS,YAAkB;AACzB,SAAO,WAAW,qBAAqB;AACzC;AAEA,SAAS,eAAqC;AAC5C,SAAO,WAAW,wBAAwB;AAC5C;AAEA,SAAS,cAAwB;AAC/B,QAAM,WAAW,WAAW,eAAe;AAE3C,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AAEA,SAAO;AACT;AAEA,SAAS,eAAe,EAAE,SAAS,GAA6B;AAC9D,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,IAAI;AACzC,QAAM,cAAc,OAAwB,IAAI;AAEhD,MAAI,CAAC,YAAY,SAAS;AACxB,gBAAY,UAAU,eAAe;AAAA,EACvC;AAEA,SACE,oCAAC,sBAAsB,UAAtB,EAA+B,OAAO,UACrC,oCAAC,yBAAyB,UAAzB,EAAkC,OAAO,aACxC,oCAAC,gBAAgB,UAAhB,EAAyB,OAAO,YAAY,WAC1C,QACH,CACF,CACF;AAEJ;;;ADpBA,SAAS,uBAAuB,KAAa;AAC3C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,UAAU,CAAC;AACtD;AAgBA,SAAS,SACP,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,CAAC;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EAC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A8C;AAEpD,SAAS,eACP,SACA,mBACA;AACA,SAAO,SAAS,eAAe,OAA8B;AAC3D,UAAM,iBAAiB,MAAM;AAE7B,UAAM,aAA0B;AAAA,MAC9B,MAAM,CAAC,GAAI,qBAAqB,CAAC,GAAI,GAAI,kBAAkB,CAAC,CAAE;AAAA,MAC9D,CAAC,cAAc;AAAA,IACjB;AAEA,WACE,gBAAAC,OAAA,cAAC,kBAAgB,GAAG,OAAO,YAAwB,SAAkB;AAAA,EAEzE;AACF;;;ACnBA,cAAc;","names":["React","useRef","useState","useState","useRef","React","React","React"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { EditorPluginSpec, InferValues, InferEditorAPIFromPlugins, InferEvents, Injector } from '@coze-editor/core';
|
|
4
|
+
export * from '@coze-editor/core';
|
|
5
|
+
import { Extension } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
8
|
+
type InferReactEvents<T extends Record<string, any>> = UnionToIntersection<{
|
|
9
|
+
[K in keyof T as `on${Capitalize<string & K>}`]?: (e: T[K]) => void;
|
|
10
|
+
}>;
|
|
11
|
+
type InferRendererProps<T extends EditorPluginSpec<string, any, any>[]> = {
|
|
12
|
+
domProps?: {
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
options?: Partial<InferValues<T[number]>>;
|
|
18
|
+
extensions?: Extension[];
|
|
19
|
+
didMount?: (api: InferEditorAPIFromPlugins<T>) => void;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
} & (InferEvents<T[number]> extends Record<string, any> ? InferReactEvents<InferEvents<T[number]>> : unknown);
|
|
22
|
+
declare function Renderer<T extends EditorPluginSpec<string, any, any>[]>(props: {
|
|
23
|
+
plugins: T;
|
|
24
|
+
} & InferRendererProps<T>): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function createRenderer<T extends EditorPluginSpec<string, any, any>[]>(plugins: T, builtinExtensions?: Extension[]): (props: InferRendererProps<T>) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
declare function useEditor<T>(): T;
|
|
29
|
+
declare function useInjector(): Injector;
|
|
30
|
+
declare function EditorProvider({ children }: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}): react_jsx_runtime.JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { EditorProvider, type InferRendererProps, Renderer, createRenderer, useEditor, useInjector };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { EditorPluginSpec, InferValues, InferEditorAPIFromPlugins, InferEvents, Injector } from '@coze-editor/core';
|
|
4
|
+
export * from '@coze-editor/core';
|
|
5
|
+
import { Extension } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
8
|
+
type InferReactEvents<T extends Record<string, any>> = UnionToIntersection<{
|
|
9
|
+
[K in keyof T as `on${Capitalize<string & K>}`]?: (e: T[K]) => void;
|
|
10
|
+
}>;
|
|
11
|
+
type InferRendererProps<T extends EditorPluginSpec<string, any, any>[]> = {
|
|
12
|
+
domProps?: {
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
options?: Partial<InferValues<T[number]>>;
|
|
18
|
+
extensions?: Extension[];
|
|
19
|
+
didMount?: (api: InferEditorAPIFromPlugins<T>) => void;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
} & (InferEvents<T[number]> extends Record<string, any> ? InferReactEvents<InferEvents<T[number]>> : unknown);
|
|
22
|
+
declare function Renderer<T extends EditorPluginSpec<string, any, any>[]>(props: {
|
|
23
|
+
plugins: T;
|
|
24
|
+
} & InferRendererProps<T>): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function createRenderer<T extends EditorPluginSpec<string, any, any>[]>(plugins: T, builtinExtensions?: Extension[]): (props: InferRendererProps<T>) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
declare function useEditor<T>(): T;
|
|
29
|
+
declare function useInjector(): Injector;
|
|
30
|
+
declare function EditorProvider({ children }: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}): react_jsx_runtime.JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { EditorProvider, type InferRendererProps, Renderer, createRenderer, useEditor, useInjector };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
EditorProvider: () => EditorProvider,
|
|
34
|
+
Renderer: () => Renderer,
|
|
35
|
+
createRenderer: () => createRenderer,
|
|
36
|
+
useEditor: () => useEditor,
|
|
37
|
+
useInjector: () => useInjector
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(index_exports);
|
|
40
|
+
|
|
41
|
+
// src/renderer.tsx
|
|
42
|
+
var import_react2 = __toESM(require("react"));
|
|
43
|
+
var import_core2 = require("@coze-editor/core");
|
|
44
|
+
|
|
45
|
+
// src/provider.tsx
|
|
46
|
+
var import_react = __toESM(require("react"));
|
|
47
|
+
var import_core = require("@coze-editor/core");
|
|
48
|
+
var InternalEditorContext = (0, import_react.createContext)(null);
|
|
49
|
+
var InternalSetEditorContext = (0, import_react.createContext)(null);
|
|
50
|
+
var InjectorContext = (0, import_react.createContext)(void 0);
|
|
51
|
+
function useEditor() {
|
|
52
|
+
return (0, import_react.useContext)(InternalEditorContext);
|
|
53
|
+
}
|
|
54
|
+
function useSetEditor() {
|
|
55
|
+
return (0, import_react.useContext)(InternalSetEditorContext);
|
|
56
|
+
}
|
|
57
|
+
function useInjector() {
|
|
58
|
+
const injector = (0, import_react.useContext)(InjectorContext);
|
|
59
|
+
if (!injector) {
|
|
60
|
+
throw new Error("useInjector should be used in EditorProvider");
|
|
61
|
+
}
|
|
62
|
+
return injector;
|
|
63
|
+
}
|
|
64
|
+
function EditorProvider({ children }) {
|
|
65
|
+
const [editor, setEditor] = (0, import_react.useState)(null);
|
|
66
|
+
const injectorRef = (0, import_react.useRef)(null);
|
|
67
|
+
if (!injectorRef.current) {
|
|
68
|
+
injectorRef.current = (0, import_core.createInjector)();
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ import_react.default.createElement(InternalEditorContext.Provider, { value: editor }, /* @__PURE__ */ import_react.default.createElement(InternalSetEditorContext.Provider, { value: setEditor }, /* @__PURE__ */ import_react.default.createElement(InjectorContext.Provider, { value: injectorRef.current }, children)));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/renderer.tsx
|
|
74
|
+
function firstLetterToUppercase(str) {
|
|
75
|
+
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
76
|
+
}
|
|
77
|
+
function Renderer(props) {
|
|
78
|
+
const {
|
|
79
|
+
plugins,
|
|
80
|
+
defaultValue,
|
|
81
|
+
options,
|
|
82
|
+
domProps = {},
|
|
83
|
+
extensions,
|
|
84
|
+
didMount,
|
|
85
|
+
children
|
|
86
|
+
} = props;
|
|
87
|
+
const [api, setAPI] = (0, import_react2.useState)();
|
|
88
|
+
const ref = (0, import_react2.useRef)(null);
|
|
89
|
+
const apiRef = (0, import_react2.useRef)(null);
|
|
90
|
+
const propsRef = (0, import_react2.useRef)(null);
|
|
91
|
+
const setEditor = useSetEditor();
|
|
92
|
+
const injector = useInjector();
|
|
93
|
+
propsRef.current = props;
|
|
94
|
+
(0, import_react2.useEffect)(() => {
|
|
95
|
+
const { render, eventKeys } = (0, import_core2.create)({
|
|
96
|
+
plugins,
|
|
97
|
+
injector
|
|
98
|
+
});
|
|
99
|
+
const exported = render({
|
|
100
|
+
parent: ref.current,
|
|
101
|
+
defaultValue,
|
|
102
|
+
options: options ?? {},
|
|
103
|
+
extensions
|
|
104
|
+
});
|
|
105
|
+
apiRef.current = exported;
|
|
106
|
+
eventKeys.forEach((eventName) => {
|
|
107
|
+
exported.$on(eventName, (e) => {
|
|
108
|
+
var _a;
|
|
109
|
+
const handler = (_a = propsRef.current) == null ? void 0 : _a[`on${firstLetterToUppercase(eventName)}`];
|
|
110
|
+
if (typeof handler === "function") {
|
|
111
|
+
handler(e);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
if (typeof didMount === "function") {
|
|
116
|
+
didMount(exported);
|
|
117
|
+
}
|
|
118
|
+
setAPI(exported);
|
|
119
|
+
return () => {
|
|
120
|
+
exported.$destroy();
|
|
121
|
+
};
|
|
122
|
+
}, []);
|
|
123
|
+
(0, import_react2.useEffect)(() => {
|
|
124
|
+
if (!api || !setEditor) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setEditor(api);
|
|
128
|
+
}, [api, setEditor]);
|
|
129
|
+
(0, import_react2.useEffect)(() => {
|
|
130
|
+
apiRef.current.$set(props.options ?? {});
|
|
131
|
+
}, [props.options]);
|
|
132
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { ...domProps, ref }), children);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/create-renderer.tsx
|
|
136
|
+
var import_react3 = __toESM(require("react"));
|
|
137
|
+
var OriginRenderer = Renderer;
|
|
138
|
+
function createRenderer(plugins, builtinExtensions) {
|
|
139
|
+
return function CustomRenderer(props) {
|
|
140
|
+
const userExtensions = props.extensions;
|
|
141
|
+
const extensions = (0, import_react3.useMemo)(
|
|
142
|
+
() => [...builtinExtensions ?? [], ...userExtensions ?? []],
|
|
143
|
+
[userExtensions]
|
|
144
|
+
);
|
|
145
|
+
return /* @__PURE__ */ import_react3.default.createElement(OriginRenderer, { ...props, extensions, plugins });
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/index.ts
|
|
150
|
+
__reExport(index_exports, require("@coze-editor/core"), module.exports);
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
EditorProvider,
|
|
154
|
+
Renderer,
|
|
155
|
+
createRenderer,
|
|
156
|
+
useEditor,
|
|
157
|
+
useInjector,
|
|
158
|
+
...require("@coze-editor/core")
|
|
159
|
+
});
|
|
160
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/renderer.tsx","../src/provider.tsx","../src/create-renderer.tsx"],"sourcesContent":["// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nexport { Renderer, type InferRendererProps } from './renderer';\n\nexport { createRenderer } from './create-renderer';\n\nexport { EditorProvider, useEditor, useInjector } from './provider';\n\nexport * from '@coze-editor/core';\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, {\n type CSSProperties,\n useEffect,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\n\nimport {\n type EditorPluginSpec,\n type InferEditorAPIFromPlugins,\n type InferEvents,\n type InferValues,\n create,\n} from '@coze-editor/core';\nimport { type Extension } from '@codemirror/state';\n\nimport { useInjector, useSetEditor } from './provider';\n\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\ntype InferReactEvents<T extends Record<string, any>> = UnionToIntersection<{\n [K in keyof T as `on${Capitalize<string & K>}`]?: (e: T[K]) => void;\n}>;\n\nfunction firstLetterToUppercase(str: string) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\ntype InferRendererProps<T extends EditorPluginSpec<string, any, any>[]> = {\n domProps?: {\n style?: CSSProperties;\n className?: string;\n };\n defaultValue?: string;\n options?: Partial<InferValues<T[number]>>;\n extensions?: Extension[];\n didMount?: (api: InferEditorAPIFromPlugins<T>) => void;\n children?: ReactNode;\n} & (InferEvents<T[number]> extends Record<string, any>\n ? InferReactEvents<InferEvents<T[number]>>\n : unknown);\n\nfunction Renderer<T extends EditorPluginSpec<string, any, any>[]>(\n props: { plugins: T } & InferRendererProps<T>,\n) {\n const {\n plugins,\n defaultValue,\n options,\n domProps = {},\n extensions,\n didMount,\n children,\n } = props;\n\n const [api, setAPI] = useState<any>();\n const ref = useRef(null);\n const apiRef = useRef<any>(null);\n const propsRef = useRef<typeof props | null>(null);\n const setEditor = useSetEditor();\n const injector = useInjector();\n\n propsRef.current = props;\n\n useEffect(() => {\n const { render, eventKeys } = create({\n plugins,\n injector,\n });\n\n const exported = render({\n parent: ref.current!,\n defaultValue,\n options: options ?? {},\n extensions,\n });\n\n apiRef.current = exported;\n\n eventKeys.forEach((eventName: any) => {\n exported.$on(eventName, e => {\n const handler = (propsRef.current as any)?.[\n `on${firstLetterToUppercase(eventName)}`\n ];\n if (typeof handler === 'function') {\n handler(e);\n }\n });\n });\n\n if (typeof didMount === 'function') {\n didMount(exported);\n }\n\n setAPI(exported);\n\n return () => {\n exported.$destroy();\n };\n }, []);\n\n useEffect(() => {\n if (!api || !setEditor) {\n return;\n }\n\n setEditor(api);\n }, [api, setEditor]);\n\n useEffect(() => {\n apiRef.current.$set(props.options ?? {});\n }, [props.options]);\n\n return (\n <>\n <div {...domProps} ref={ref} />\n {children}\n </>\n );\n}\n\nexport { Renderer };\n\nexport type { InferRendererProps };\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nimport React, {\n type Dispatch,\n type ReactNode,\n createContext,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { type Injector, createInjector } from '@coze-editor/core';\n\nconst InternalEditorContext = createContext<unknown>(null);\nconst InternalSetEditorContext = createContext<Dispatch<any> | null>(null);\nconst InjectorContext = createContext<Injector | undefined>(undefined);\n\nfunction useEditor<T>(): T {\n return useContext(InternalEditorContext) as T;\n}\n\nfunction useSetEditor(): Dispatch<any> | null {\n return useContext(InternalSetEditorContext);\n}\n\nfunction useInjector(): Injector {\n const injector = useContext(InjectorContext);\n\n if (!injector) {\n throw new Error('useInjector should be used in EditorProvider');\n }\n\n return injector;\n}\n\nfunction EditorProvider({ children }: { children?: ReactNode }) {\n const [editor, setEditor] = useState(null);\n const injectorRef = useRef<Injector | null>(null);\n\n if (!injectorRef.current) {\n injectorRef.current = createInjector();\n }\n\n return (\n <InternalEditorContext.Provider value={editor}>\n <InternalSetEditorContext.Provider value={setEditor}>\n <InjectorContext.Provider value={injectorRef.current}>\n {children}\n </InjectorContext.Provider>\n </InternalSetEditorContext.Provider>\n </InternalEditorContext.Provider>\n );\n}\n\nexport { EditorProvider, useEditor, useSetEditor, useInjector };\n","// Copyright (c) 2025 coze-dev\n// SPDX-License-Identifier: MIT\n\nimport React, { useMemo } from 'react';\n\nimport { type EditorPluginSpec } from '@coze-editor/core';\nimport { type Extension } from '@codemirror/state';\n\nimport { Renderer, type InferRendererProps } from './renderer';\n\nconst OriginRenderer: (props: any) => JSX.Element = Renderer;\n\nfunction createRenderer<T extends EditorPluginSpec<string, any, any>[]>(\n plugins: T,\n builtinExtensions?: Extension[],\n) {\n return function CustomRenderer(props: InferRendererProps<T>) {\n const userExtensions = props.extensions;\n\n const extensions: Extension[] = useMemo(\n () => [...(builtinExtensions ?? []), ...(userExtensions ?? [])],\n [userExtensions],\n );\n\n return (\n <OriginRenderer {...props} extensions={extensions} plugins={plugins} />\n );\n };\n}\n\nexport { createRenderer };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,IAAAA,gBAMO;AAEP,IAAAC,eAMO;;;ACfP,mBAOO;AAEP,kBAA8C;AAE9C,IAAM,4BAAwB,4BAAuB,IAAI;AACzD,IAAM,+BAA2B,4B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AEzE;AACF;;;AHnBA,0BAAc,8BATd;","names":["import_react","import_core","React","React","import_react","React"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coze-editor/react",
|
|
3
|
+
"version": "0.1.0-alpha.0fd19e",
|
|
4
|
+
"description": "react",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "fengzilong",
|
|
7
|
+
"maintainers": [],
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css",
|
|
10
|
+
"**/*.less",
|
|
11
|
+
"**/*.sass",
|
|
12
|
+
"**/*.scss"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/esm/index.js",
|
|
15
|
+
"module": "./dist/esm/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"dev": "vite --force",
|
|
23
|
+
"lint": "eslint && tsc --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@coze-editor/core": "0.1.0-alpha.0fd19e"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@codemirror/state": "^6.4.1",
|
|
30
|
+
"@codemirror/view": "^6.26.1",
|
|
31
|
+
"@coze-arch/ts-config": "workspace:*",
|
|
32
|
+
"@coze-editor/eslint-config": "workspace:*",
|
|
33
|
+
"@types/node": "^22",
|
|
34
|
+
"@types/react": "18.2.37",
|
|
35
|
+
"@types/react-dom": "18.2.15",
|
|
36
|
+
"eslint": "9.14.0",
|
|
37
|
+
"react": "~18.2.0",
|
|
38
|
+
"react-dom": "~18.2.0",
|
|
39
|
+
"tsup": "^8.0.1",
|
|
40
|
+
"typescript": "^5.8.2"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@codemirror/state": "^6.4.1",
|
|
44
|
+
"@codemirror/view": "^6.26.1",
|
|
45
|
+
"react": "~18.2.0",
|
|
46
|
+
"react-dom": "~18.2.0"
|
|
47
|
+
},
|
|
48
|
+
"packageManager": "pnpm@9.15.0",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"registry": "https://registry.npmjs.org"
|
|
52
|
+
},
|
|
53
|
+
"test:main": "./src/index.ts"
|
|
54
|
+
}
|