@textbus/adapter-react 5.2.2 → 5.2.3
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/dist/index.esm.js +97 -61
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +137 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,102 +1,138 @@
|
|
|
1
|
-
import { makeError
|
|
2
|
-
import { DomAdapter
|
|
3
|
-
import { createElement
|
|
4
|
-
import { ReflectiveInjector
|
|
5
|
-
import { merge
|
|
6
|
-
const
|
|
7
|
-
class
|
|
1
|
+
import { makeError, VElement, VTextNode, Adapter } from "@textbus/core";
|
|
2
|
+
import { DomAdapter } from "@textbus/platform-browser";
|
|
3
|
+
import { createElement, useState, useEffect } from "react";
|
|
4
|
+
import { ReflectiveInjector } from "@viewfly/core";
|
|
5
|
+
import { merge } from "@tanbo/stream";
|
|
6
|
+
const adapterError = makeError("ReactAdapter");
|
|
7
|
+
class ReactAdapter extends DomAdapter {
|
|
8
8
|
components = {};
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(components, mount) {
|
|
10
10
|
super({
|
|
11
|
-
createCompositionNode(
|
|
12
|
-
return new
|
|
11
|
+
createCompositionNode(compositionState, updateNativeCompositionNode) {
|
|
12
|
+
return new VElement("span", {
|
|
13
13
|
style: {
|
|
14
14
|
textDecoration: "underline"
|
|
15
15
|
},
|
|
16
|
-
ref: (
|
|
17
|
-
|
|
16
|
+
ref: (node) => {
|
|
17
|
+
updateNativeCompositionNode(node);
|
|
18
18
|
}
|
|
19
19
|
}, [
|
|
20
|
-
new
|
|
20
|
+
new VTextNode(compositionState.text)
|
|
21
21
|
]);
|
|
22
22
|
},
|
|
23
|
-
getParentNode(
|
|
24
|
-
return
|
|
23
|
+
getParentNode(node) {
|
|
24
|
+
return node.parentNode;
|
|
25
25
|
},
|
|
26
|
-
getChildNodes(
|
|
27
|
-
return Array.from(
|
|
26
|
+
getChildNodes(parentElement) {
|
|
27
|
+
return Array.from(parentElement.childNodes);
|
|
28
28
|
},
|
|
29
|
-
isNativeElementNode(
|
|
30
|
-
return
|
|
29
|
+
isNativeElementNode(node) {
|
|
30
|
+
return node instanceof Element;
|
|
31
31
|
},
|
|
32
|
-
getChildByIndex(
|
|
33
|
-
return
|
|
32
|
+
getChildByIndex(parentElement, index) {
|
|
33
|
+
return parentElement.childNodes[index];
|
|
34
34
|
},
|
|
35
|
-
getAndUpdateSlotRootNativeElement(
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
getAndUpdateSlotRootNativeElement(vEle, update) {
|
|
36
|
+
const currentRef = vEle.attrs.get("ref");
|
|
37
|
+
if (currentRef) {
|
|
38
|
+
vEle.attrs.set("ref", (v) => {
|
|
39
|
+
update(v);
|
|
40
|
+
if (typeof currentRef === "function") {
|
|
41
|
+
currentRef(v);
|
|
42
|
+
} else if (!currentRef.current) {
|
|
43
|
+
currentRef.current = v;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
vEle.attrs.set("ref", update);
|
|
48
|
+
}
|
|
40
49
|
},
|
|
41
|
-
componentRender: (
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
componentRender: (component) => {
|
|
51
|
+
const comp = this.components[component.name] || this.components["*"];
|
|
52
|
+
if (comp) {
|
|
53
|
+
component.changeMarker.rendered();
|
|
54
|
+
return createElement(comp, {
|
|
55
|
+
key: component.id,
|
|
56
|
+
component
|
|
47
57
|
});
|
|
48
|
-
|
|
58
|
+
}
|
|
59
|
+
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
|
49
60
|
},
|
|
50
|
-
vElementToViewElement(
|
|
51
|
-
const
|
|
52
|
-
...Array.from(
|
|
61
|
+
vElementToViewElement(vNode, children) {
|
|
62
|
+
const props = {
|
|
63
|
+
...Array.from(vNode.attrs).reduce((a, b) => {
|
|
64
|
+
a[b[0]] = b[1];
|
|
65
|
+
return a;
|
|
66
|
+
}, {})
|
|
53
67
|
};
|
|
54
|
-
|
|
68
|
+
if (vNode.classes.size) {
|
|
69
|
+
props.className = Array.from(vNode.classes).join(" ");
|
|
70
|
+
}
|
|
71
|
+
if (vNode.styles) {
|
|
72
|
+
props.style = Array.from(vNode.styles).reduce((a, b) => {
|
|
73
|
+
a[b[0]] = b[1];
|
|
74
|
+
return a;
|
|
75
|
+
}, {});
|
|
76
|
+
}
|
|
77
|
+
return createElement(vNode.tagName, props, ...children);
|
|
55
78
|
}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
}, mount);
|
|
80
|
+
Object.keys(components).forEach((key) => {
|
|
81
|
+
this.components[key] = (props) => {
|
|
82
|
+
const component = props.component;
|
|
83
|
+
const [updateKey, refreshUpdateKey] = useState(Math.random());
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
|
|
86
|
+
if (component.changeMarker.dirty) {
|
|
87
|
+
refreshUpdateKey(Math.random());
|
|
88
|
+
}
|
|
62
89
|
});
|
|
63
90
|
return () => {
|
|
64
|
-
|
|
91
|
+
sub.unsubscribe();
|
|
65
92
|
};
|
|
66
|
-
}, [])
|
|
93
|
+
}, []);
|
|
94
|
+
useEffect(() => {
|
|
67
95
|
this.onViewUpdated.next();
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
70
|
-
component
|
|
71
|
-
rootRef: (
|
|
72
|
-
|
|
96
|
+
}, [updateKey]);
|
|
97
|
+
const vNode = components[key]({
|
|
98
|
+
component,
|
|
99
|
+
rootRef: (rootNode) => {
|
|
100
|
+
if (rootNode) {
|
|
101
|
+
this.componentRootElementCaches.set(component, rootNode);
|
|
102
|
+
} else {
|
|
103
|
+
if (this.componentRootElementCaches.get(component) === rootNode) {
|
|
104
|
+
this.componentRootElementCaches.remove(component);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!this.componentRootElementCaches.get(component)) {
|
|
111
|
+
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
73
112
|
}
|
|
74
113
|
});
|
|
75
|
-
return
|
|
76
|
-
if (!this.componentRootElementCaches.get(t))
|
|
77
|
-
throw u(`Component \`${t.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
78
|
-
}), p;
|
|
114
|
+
return vNode;
|
|
79
115
|
};
|
|
80
116
|
});
|
|
81
117
|
}
|
|
82
|
-
render(
|
|
83
|
-
const
|
|
84
|
-
provide:
|
|
118
|
+
render(rootComponent, injector) {
|
|
119
|
+
const childInjector = new ReflectiveInjector(injector, [{
|
|
120
|
+
provide: Adapter,
|
|
85
121
|
useValue: this
|
|
86
122
|
}, {
|
|
87
|
-
provide:
|
|
123
|
+
provide: DomAdapter,
|
|
88
124
|
useValue: this
|
|
89
125
|
}, {
|
|
90
|
-
provide:
|
|
126
|
+
provide: ReactAdapter,
|
|
91
127
|
useValue: this
|
|
92
128
|
}]);
|
|
93
|
-
return super.render(
|
|
129
|
+
return super.render(rootComponent, childInjector);
|
|
94
130
|
}
|
|
95
131
|
copy() {
|
|
96
132
|
document.execCommand("copy");
|
|
97
133
|
}
|
|
98
134
|
}
|
|
99
135
|
export {
|
|
100
|
-
|
|
136
|
+
ReactAdapter
|
|
101
137
|
};
|
|
102
138
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/react-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { createElement, JSX, useEffect, useState } from 'react'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('ReactAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: ((rootNode: Element) => void)\n}\n\nexport interface ReactAdapterComponents {\n [key: string]: (props: ViewComponentProps<any>) => JSX.Element\n}\n\nexport class ReactAdapter extends DomAdapter<JSX.Element, JSX.Element> {\n private components: Record<string, (props: {component: Component}) => JSX.Element> = {}\n\n constructor(components: ReactAdapterComponents,\n mount: ViewMount<JSX.Element, Element>) {\n super({\n createCompositionNode(compositionState: CompositionState,\n updateNativeCompositionNode: (nativeNode: (Element | null)) => void): VElement {\n return new VElement('span', {\n style: {\n textDecoration: 'underline'\n },\n ref: (node: Element) => {\n updateNativeCompositionNode(node)\n }\n }, [\n new VTextNode(compositionState.text)\n ])\n },\n getParentNode(node: Element | Text): Element | null {\n return (node as Node).parentNode as Element\n },\n getChildNodes(parentElement: Element): Array<Element | Text> {\n return Array.from(parentElement.childNodes) as Element[]\n },\n isNativeElementNode(node: Element | Text): node is Element {\n return node instanceof Element\n },\n getChildByIndex(parentElement, index) {\n return parentElement.childNodes[index] as Element\n },\n getAndUpdateSlotRootNativeElement(vEle: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vEle.attrs.get('ref')\n if (currentRef) {\n vEle.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.current) {\n currentRef.current = v\n }\n })\n } else {\n vEle.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): JSX.Element => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n component.changeMarker.rendered()\n return createElement(comp, {\n key: component.id,\n component\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | JSX.Element>): JSX.Element {\n const props: any = {\n ...(Array.from(vNode.attrs).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>))\n }\n if (vNode.classes.size) {\n props.className = Array.from(vNode.classes).join(' ')\n }\n if (vNode.styles) {\n props.style = Array.from(vNode.styles).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>)\n }\n return createElement(vNode.tagName, props, ...children)\n }\n }, mount)\n Object.keys(components).forEach(key => {\n this.components[key] = (props: {component: Component}) => {\n const component = props.component\n const [updateKey, refreshUpdateKey] = useState(Math.random())\n\n useEffect(() => {\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n refreshUpdateKey(Math.random())\n }\n })\n return () => {\n sub.unsubscribe()\n }\n }, [])\n useEffect(() => {\n this.onViewUpdated.next()\n }, [updateKey])\n const vNode = components[key]({\n component,\n rootRef: (rootNode: Element) => {\n if (rootNode) {\n this.componentRootElementCaches.set(component, rootNode)\n } else {\n // 当组件移动层级位置到原位置之前并重新渲染后,由于时序的原因,再删除缓存会导致组件找不到对应视图节点\n // eslint-disable-next-line no-lonely-if\n if (this.componentRootElementCaches.get(component) === rootNode) {\n this.componentRootElementCaches.remove(component)\n }\n }\n }\n })\n useEffect(() => {\n if (!this.componentRootElementCaches.get(component)) {\n // eslint-disable-next-line max-len\n throw adapterError(`Component \\`${component.name}\\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`)\n }\n })\n return vNode\n }\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this\n }, {\n provide: ReactAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/react-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { createElement, JSX, useEffect, useState } from 'react'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('ReactAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: ((rootNode: Element) => void)\n}\n\nexport interface ReactAdapterComponents {\n [key: string]: (props: ViewComponentProps<any>) => JSX.Element\n}\n\nexport class ReactAdapter extends DomAdapter<JSX.Element, JSX.Element> {\n private components: Record<string, (props: {component: Component}) => JSX.Element> = {}\n\n constructor(components: ReactAdapterComponents,\n mount: ViewMount<JSX.Element, Element>) {\n super({\n createCompositionNode(compositionState: CompositionState,\n updateNativeCompositionNode: (nativeNode: (Element | null)) => void): VElement {\n return new VElement('span', {\n style: {\n textDecoration: 'underline'\n },\n ref: (node: Element) => {\n updateNativeCompositionNode(node)\n }\n }, [\n new VTextNode(compositionState.text)\n ])\n },\n getParentNode(node: Element | Text): Element | null {\n return (node as Node).parentNode as Element\n },\n getChildNodes(parentElement: Element): Array<Element | Text> {\n return Array.from(parentElement.childNodes) as Element[]\n },\n isNativeElementNode(node: Element | Text): node is Element {\n return node instanceof Element\n },\n getChildByIndex(parentElement, index) {\n return parentElement.childNodes[index] as Element\n },\n getAndUpdateSlotRootNativeElement(vEle: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vEle.attrs.get('ref')\n if (currentRef) {\n vEle.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.current) {\n currentRef.current = v\n }\n })\n } else {\n vEle.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): JSX.Element => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n component.changeMarker.rendered()\n return createElement(comp, {\n key: component.id,\n component\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | JSX.Element>): JSX.Element {\n const props: any = {\n ...(Array.from(vNode.attrs).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>))\n }\n if (vNode.classes.size) {\n props.className = Array.from(vNode.classes).join(' ')\n }\n if (vNode.styles) {\n props.style = Array.from(vNode.styles).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>)\n }\n return createElement(vNode.tagName, props, ...children)\n }\n }, mount)\n Object.keys(components).forEach(key => {\n this.components[key] = (props: {component: Component}) => {\n const component = props.component\n const [updateKey, refreshUpdateKey] = useState(Math.random())\n\n useEffect(() => {\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n refreshUpdateKey(Math.random())\n }\n })\n return () => {\n sub.unsubscribe()\n }\n }, [])\n useEffect(() => {\n this.onViewUpdated.next()\n }, [updateKey])\n const vNode = components[key]({\n component,\n rootRef: (rootNode: Element) => {\n if (rootNode) {\n this.componentRootElementCaches.set(component, rootNode)\n } else {\n // 当组件移动层级位置到原位置之前并重新渲染后,由于时序的原因,再删除缓存会导致组件找不到对应视图节点\n // eslint-disable-next-line no-lonely-if\n if (this.componentRootElementCaches.get(component) === rootNode) {\n this.componentRootElementCaches.remove(component)\n }\n }\n }\n })\n useEffect(() => {\n if (!this.componentRootElementCaches.get(component)) {\n // eslint-disable-next-line max-len\n throw adapterError(`Component \\`${component.name}\\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`)\n }\n })\n return vNode\n }\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this\n }, {\n provide: ReactAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,eAAe,UAAU,cAAc;AAWtC,MAAM,qBAAqB,WAAqC;AAAA,EAC7D,aAA6E,CA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2BAA2B,IAAI,WAAW,QAAQ;AAAA,YACzD,OAAO;AAGL,kBAAI,KAAK,2BAA2B,IAAI,SAAS,MAAM,UAAU;AAC/D,qBAAK,2BAA2B,OAAO,SAAS;AAAA,cAClD;AAAA,YACF;AAAA,UACF;AAAA,QAAA,CACD;AACD,kBAAU,MAAM;AACd,cAAI,CAAC,KAAK,2BAA2B,IAAI,SAAS,GAAG;AAEnD,kBAAM,aAAa,eAAe,UAAU,IAAI,mGAAmG;AAAA,UACrJ;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAES,OAAO,eAA0B,UAAyC;AACjF,UAAM,gBAAgB,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACtD,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,GACT;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,GACT;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,CACX,CAAC;AACF,WAAO,MAAM,OAAO,eAAe,aAAa;AAAA,EAClD;AAAA,EAES,OAAO;AACd,aAAS,YAAY,MAAM;AAAA,EAC7B;AACF;"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,138 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@textbus/core");
|
|
4
|
+
const platformBrowser = require("@textbus/platform-browser");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
const core$1 = require("@viewfly/core");
|
|
7
|
+
const stream = require("@tanbo/stream");
|
|
8
|
+
const adapterError = core.makeError("ReactAdapter");
|
|
9
|
+
class ReactAdapter extends platformBrowser.DomAdapter {
|
|
10
|
+
components = {};
|
|
11
|
+
constructor(components, mount) {
|
|
12
|
+
super({
|
|
13
|
+
createCompositionNode(compositionState, updateNativeCompositionNode) {
|
|
14
|
+
return new core.VElement("span", {
|
|
15
|
+
style: {
|
|
16
|
+
textDecoration: "underline"
|
|
17
|
+
},
|
|
18
|
+
ref: (node) => {
|
|
19
|
+
updateNativeCompositionNode(node);
|
|
20
|
+
}
|
|
21
|
+
}, [
|
|
22
|
+
new core.VTextNode(compositionState.text)
|
|
23
|
+
]);
|
|
24
|
+
},
|
|
25
|
+
getParentNode(node) {
|
|
26
|
+
return node.parentNode;
|
|
27
|
+
},
|
|
28
|
+
getChildNodes(parentElement) {
|
|
29
|
+
return Array.from(parentElement.childNodes);
|
|
30
|
+
},
|
|
31
|
+
isNativeElementNode(node) {
|
|
32
|
+
return node instanceof Element;
|
|
33
|
+
},
|
|
34
|
+
getChildByIndex(parentElement, index) {
|
|
35
|
+
return parentElement.childNodes[index];
|
|
36
|
+
},
|
|
37
|
+
getAndUpdateSlotRootNativeElement(vEle, update) {
|
|
38
|
+
const currentRef = vEle.attrs.get("ref");
|
|
39
|
+
if (currentRef) {
|
|
40
|
+
vEle.attrs.set("ref", (v) => {
|
|
41
|
+
update(v);
|
|
42
|
+
if (typeof currentRef === "function") {
|
|
43
|
+
currentRef(v);
|
|
44
|
+
} else if (!currentRef.current) {
|
|
45
|
+
currentRef.current = v;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
vEle.attrs.set("ref", update);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
componentRender: (component) => {
|
|
53
|
+
const comp = this.components[component.name] || this.components["*"];
|
|
54
|
+
if (comp) {
|
|
55
|
+
component.changeMarker.rendered();
|
|
56
|
+
return react.createElement(comp, {
|
|
57
|
+
key: component.id,
|
|
58
|
+
component
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
|
62
|
+
},
|
|
63
|
+
vElementToViewElement(vNode, children) {
|
|
64
|
+
const props = {
|
|
65
|
+
...Array.from(vNode.attrs).reduce((a, b) => {
|
|
66
|
+
a[b[0]] = b[1];
|
|
67
|
+
return a;
|
|
68
|
+
}, {})
|
|
69
|
+
};
|
|
70
|
+
if (vNode.classes.size) {
|
|
71
|
+
props.className = Array.from(vNode.classes).join(" ");
|
|
72
|
+
}
|
|
73
|
+
if (vNode.styles) {
|
|
74
|
+
props.style = Array.from(vNode.styles).reduce((a, b) => {
|
|
75
|
+
a[b[0]] = b[1];
|
|
76
|
+
return a;
|
|
77
|
+
}, {});
|
|
78
|
+
}
|
|
79
|
+
return react.createElement(vNode.tagName, props, ...children);
|
|
80
|
+
}
|
|
81
|
+
}, mount);
|
|
82
|
+
Object.keys(components).forEach((key) => {
|
|
83
|
+
this.components[key] = (props) => {
|
|
84
|
+
const component = props.component;
|
|
85
|
+
const [updateKey, refreshUpdateKey] = react.useState(Math.random());
|
|
86
|
+
react.useEffect(() => {
|
|
87
|
+
const sub = stream.merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
|
|
88
|
+
if (component.changeMarker.dirty) {
|
|
89
|
+
refreshUpdateKey(Math.random());
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return () => {
|
|
93
|
+
sub.unsubscribe();
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
96
|
+
react.useEffect(() => {
|
|
97
|
+
this.onViewUpdated.next();
|
|
98
|
+
}, [updateKey]);
|
|
99
|
+
const vNode = components[key]({
|
|
100
|
+
component,
|
|
101
|
+
rootRef: (rootNode) => {
|
|
102
|
+
if (rootNode) {
|
|
103
|
+
this.componentRootElementCaches.set(component, rootNode);
|
|
104
|
+
} else {
|
|
105
|
+
if (this.componentRootElementCaches.get(component) === rootNode) {
|
|
106
|
+
this.componentRootElementCaches.remove(component);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
react.useEffect(() => {
|
|
112
|
+
if (!this.componentRootElementCaches.get(component)) {
|
|
113
|
+
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return vNode;
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
render(rootComponent, injector) {
|
|
121
|
+
const childInjector = new core$1.ReflectiveInjector(injector, [{
|
|
122
|
+
provide: core.Adapter,
|
|
123
|
+
useValue: this
|
|
124
|
+
}, {
|
|
125
|
+
provide: platformBrowser.DomAdapter,
|
|
126
|
+
useValue: this
|
|
127
|
+
}, {
|
|
128
|
+
provide: ReactAdapter,
|
|
129
|
+
useValue: this
|
|
130
|
+
}]);
|
|
131
|
+
return super.render(rootComponent, childInjector);
|
|
132
|
+
}
|
|
133
|
+
copy() {
|
|
134
|
+
document.execCommand("copy");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.ReactAdapter = ReactAdapter;
|
|
2
138
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/react-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { createElement, JSX, useEffect, useState } from 'react'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('ReactAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: ((rootNode: Element) => void)\n}\n\nexport interface ReactAdapterComponents {\n [key: string]: (props: ViewComponentProps<any>) => JSX.Element\n}\n\nexport class ReactAdapter extends DomAdapter<JSX.Element, JSX.Element> {\n private components: Record<string, (props: {component: Component}) => JSX.Element> = {}\n\n constructor(components: ReactAdapterComponents,\n mount: ViewMount<JSX.Element, Element>) {\n super({\n createCompositionNode(compositionState: CompositionState,\n updateNativeCompositionNode: (nativeNode: (Element | null)) => void): VElement {\n return new VElement('span', {\n style: {\n textDecoration: 'underline'\n },\n ref: (node: Element) => {\n updateNativeCompositionNode(node)\n }\n }, [\n new VTextNode(compositionState.text)\n ])\n },\n getParentNode(node: Element | Text): Element | null {\n return (node as Node).parentNode as Element\n },\n getChildNodes(parentElement: Element): Array<Element | Text> {\n return Array.from(parentElement.childNodes) as Element[]\n },\n isNativeElementNode(node: Element | Text): node is Element {\n return node instanceof Element\n },\n getChildByIndex(parentElement, index) {\n return parentElement.childNodes[index] as Element\n },\n getAndUpdateSlotRootNativeElement(vEle: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vEle.attrs.get('ref')\n if (currentRef) {\n vEle.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.current) {\n currentRef.current = v\n }\n })\n } else {\n vEle.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): JSX.Element => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n component.changeMarker.rendered()\n return createElement(comp, {\n key: component.id,\n component\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | JSX.Element>): JSX.Element {\n const props: any = {\n ...(Array.from(vNode.attrs).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>))\n }\n if (vNode.classes.size) {\n props.className = Array.from(vNode.classes).join(' ')\n }\n if (vNode.styles) {\n props.style = Array.from(vNode.styles).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>)\n }\n return createElement(vNode.tagName, props, ...children)\n }\n }, mount)\n Object.keys(components).forEach(key => {\n this.components[key] = (props: {component: Component}) => {\n const component = props.component\n const [updateKey, refreshUpdateKey] = useState(Math.random())\n\n useEffect(() => {\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n refreshUpdateKey(Math.random())\n }\n })\n return () => {\n sub.unsubscribe()\n }\n }, [])\n useEffect(() => {\n this.onViewUpdated.next()\n }, [updateKey])\n const vNode = components[key]({\n component,\n rootRef: (rootNode: Element) => {\n if (rootNode) {\n this.componentRootElementCaches.set(component, rootNode)\n } else {\n // 当组件移动层级位置到原位置之前并重新渲染后,由于时序的原因,再删除缓存会导致组件找不到对应视图节点\n // eslint-disable-next-line no-lonely-if\n if (this.componentRootElementCaches.get(component) === rootNode) {\n this.componentRootElementCaches.remove(component)\n }\n }\n }\n })\n useEffect(() => {\n if (!this.componentRootElementCaches.get(component)) {\n // eslint-disable-next-line max-len\n throw adapterError(`Component \\`${component.name}\\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`)\n }\n })\n return vNode\n }\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this\n }, {\n provide: ReactAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/react-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { createElement, JSX, useEffect, useState } from 'react'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('ReactAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: ((rootNode: Element) => void)\n}\n\nexport interface ReactAdapterComponents {\n [key: string]: (props: ViewComponentProps<any>) => JSX.Element\n}\n\nexport class ReactAdapter extends DomAdapter<JSX.Element, JSX.Element> {\n private components: Record<string, (props: {component: Component}) => JSX.Element> = {}\n\n constructor(components: ReactAdapterComponents,\n mount: ViewMount<JSX.Element, Element>) {\n super({\n createCompositionNode(compositionState: CompositionState,\n updateNativeCompositionNode: (nativeNode: (Element | null)) => void): VElement {\n return new VElement('span', {\n style: {\n textDecoration: 'underline'\n },\n ref: (node: Element) => {\n updateNativeCompositionNode(node)\n }\n }, [\n new VTextNode(compositionState.text)\n ])\n },\n getParentNode(node: Element | Text): Element | null {\n return (node as Node).parentNode as Element\n },\n getChildNodes(parentElement: Element): Array<Element | Text> {\n return Array.from(parentElement.childNodes) as Element[]\n },\n isNativeElementNode(node: Element | Text): node is Element {\n return node instanceof Element\n },\n getChildByIndex(parentElement, index) {\n return parentElement.childNodes[index] as Element\n },\n getAndUpdateSlotRootNativeElement(vEle: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vEle.attrs.get('ref')\n if (currentRef) {\n vEle.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.current) {\n currentRef.current = v\n }\n })\n } else {\n vEle.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): JSX.Element => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n component.changeMarker.rendered()\n return createElement(comp, {\n key: component.id,\n component\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | JSX.Element>): JSX.Element {\n const props: any = {\n ...(Array.from(vNode.attrs).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>))\n }\n if (vNode.classes.size) {\n props.className = Array.from(vNode.classes).join(' ')\n }\n if (vNode.styles) {\n props.style = Array.from(vNode.styles).reduce((a, b) => {\n a[b[0]] = b[1]\n return a\n }, {} as Record<string, any>)\n }\n return createElement(vNode.tagName, props, ...children)\n }\n }, mount)\n Object.keys(components).forEach(key => {\n this.components[key] = (props: {component: Component}) => {\n const component = props.component\n const [updateKey, refreshUpdateKey] = useState(Math.random())\n\n useEffect(() => {\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n refreshUpdateKey(Math.random())\n }\n })\n return () => {\n sub.unsubscribe()\n }\n }, [])\n useEffect(() => {\n this.onViewUpdated.next()\n }, [updateKey])\n const vNode = components[key]({\n component,\n rootRef: (rootNode: Element) => {\n if (rootNode) {\n this.componentRootElementCaches.set(component, rootNode)\n } else {\n // 当组件移动层级位置到原位置之前并重新渲染后,由于时序的原因,再删除缓存会导致组件找不到对应视图节点\n // eslint-disable-next-line no-lonely-if\n if (this.componentRootElementCaches.get(component) === rootNode) {\n this.componentRootElementCaches.remove(component)\n }\n }\n }\n })\n useEffect(() => {\n if (!this.componentRootElementCaches.get(component)) {\n // eslint-disable-next-line max-len\n throw adapterError(`Component \\`${component.name}\\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`)\n }\n })\n return vNode\n }\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this\n }, {\n provide: ReactAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":["makeError","DomAdapter","VElement","VTextNode","createElement","useState","useEffect","merge","ReflectiveInjector","Adapter"],"mappings":";;;;;;;AAMA,MAAM,eAAeA,KAAAA,UAAU,cAAc;AAWtC,MAAM,qBAAqBC,gBAAAA,WAAqC;AAAA,EAC7D,aAA6E,CAAA;AAAA,EAErF,YAAY,YACA,OAAwC;AAClD,UAAM;AAAA,MACJ,sBAAsB,kBACA,6BAA+E;AACnG,eAAO,IAAIC,KAAAA,SAAS,QAAQ;AAAA,UAC1B,OAAO;AAAA,YACL,gBAAgB;AAAA,UAAA;AAAA,UAElB,KAAK,CAAC,SAAkB;AACtB,wCAA4B,IAAI;AAAA,UAClC;AAAA,QAAA,GACC;AAAA,UACD,IAAIC,KAAAA,UAAU,iBAAiB,IAAI;AAAA,QAAA,CACpC;AAAA,MACH;AAAA,MACA,cAAc,MAAsC;AAClD,eAAQ,KAAc;AAAA,MACxB;AAAA,MACA,cAAc,eAA+C;AAC3D,eAAO,MA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AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAES,OAAO,eAA0B,UAAyC;AACjF,UAAM,gBAAgB,IAAIE,0BAAmB,UAAU,CAAC;AAAA,MACtD,SAASC,KAAAA;AAAAA,MACT,UAAU;AAAA,IAAA,GACT;AAAA,MACD,SAASR,gBAAAA;AAAAA,MACT,UAAU;AAAA,IAAA,GACT;AAAA,MACD,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,CACX,CAAC;AACF,WAAO,MAAM,OAAO,eAAe,aAAa;AAAA,EAClD;AAAA,EAES,OAAO;AACd,aAAS,YAAY,MAAM;AAAA,EAC7B;AACF;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textbus/adapter-react",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3",
|
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@tanbo/stream": "^1.2.7",
|
|
36
|
-
"@viewfly/core": "^2.2.0 || >=3.0.0-alpha.
|
|
37
|
-
"@textbus/core": "^5.2.
|
|
38
|
-
"@textbus/platform-browser": "^5.2.
|
|
36
|
+
"@viewfly/core": "^2.2.0 || >=3.0.0-alpha.3 <4",
|
|
37
|
+
"@textbus/core": "^5.2.3",
|
|
38
|
+
"@textbus/platform-browser": "^5.2.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^17.0.0 || ^18.0.0"
|