@textbus/adapter-vue 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 +108 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +138 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,94 +1,139 @@
|
|
|
1
|
-
import { makeError
|
|
2
|
-
import { h
|
|
3
|
-
import { DomAdapter
|
|
4
|
-
import { ReflectiveInjector
|
|
5
|
-
import { merge
|
|
6
|
-
const
|
|
7
|
-
class
|
|
1
|
+
import { makeError, VElement, VTextNode, Adapter } from "@textbus/core";
|
|
2
|
+
import { h, ref, getCurrentInstance, onMounted, onUpdated, onUnmounted } from "vue";
|
|
3
|
+
import { DomAdapter } from "@textbus/platform-browser";
|
|
4
|
+
import { ReflectiveInjector } from "@viewfly/core";
|
|
5
|
+
import { merge } from "@tanbo/stream";
|
|
6
|
+
const adapterError = makeError("VueAdapter");
|
|
7
|
+
class VueAdapter extends DomAdapter {
|
|
8
8
|
// private compositionRef = ref<Element>()
|
|
9
9
|
componentRefs = /* @__PURE__ */ new WeakMap();
|
|
10
10
|
components = {};
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(components, mount) {
|
|
12
12
|
super({
|
|
13
|
-
createCompositionNode: (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return e.parentNode;
|
|
13
|
+
createCompositionNode: (compositionState, updateNativeCompositionNode) => {
|
|
14
|
+
return new VElement("span", {
|
|
15
|
+
style: {
|
|
16
|
+
textDecoration: "underline"
|
|
17
|
+
},
|
|
18
|
+
ref: updateNativeCompositionNode
|
|
19
|
+
}, [
|
|
20
|
+
new VTextNode(compositionState.text)
|
|
21
|
+
]);
|
|
23
22
|
},
|
|
24
|
-
|
|
25
|
-
return
|
|
23
|
+
getParentNode(node) {
|
|
24
|
+
return node.parentNode;
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
26
|
+
getChildNodes(parentElement) {
|
|
27
|
+
return Array.from(parentElement.childNodes);
|
|
29
28
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
29
|
+
isNativeElementNode(node) {
|
|
30
|
+
return node instanceof Element;
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
t ? e.attrs.set("ref", (n) => {
|
|
36
|
-
o(n), typeof t == "function" ? t(n) : t.value || (t.value = n);
|
|
37
|
-
}) : e.attrs.set("ref", o);
|
|
32
|
+
getChildByIndex(parentElement, index) {
|
|
33
|
+
return parentElement.childNodes[index];
|
|
38
34
|
},
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
getAndUpdateSlotRootNativeElement(vElement, update) {
|
|
36
|
+
const currentRef = vElement.attrs.get("ref");
|
|
37
|
+
if (currentRef) {
|
|
38
|
+
vElement.attrs.set("ref", (v) => {
|
|
39
|
+
update(v);
|
|
40
|
+
if (typeof currentRef === "function") {
|
|
41
|
+
currentRef(v);
|
|
42
|
+
} else if (!currentRef.value) {
|
|
43
|
+
currentRef.value = v;
|
|
44
|
+
}
|
|
47
45
|
});
|
|
46
|
+
} else {
|
|
47
|
+
vElement.attrs.set("ref", update);
|
|
48
48
|
}
|
|
49
|
-
throw u(`cannot found view component \`${e.name}\`!`);
|
|
50
49
|
},
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
50
|
+
componentRender: (component) => {
|
|
51
|
+
const comp = this.components[component.name] || this.components["*"];
|
|
52
|
+
if (comp) {
|
|
53
|
+
let rootRef = this.componentRefs.get(component);
|
|
54
|
+
if (!rootRef) {
|
|
55
|
+
rootRef = ref();
|
|
56
|
+
this.componentRefs.set(component, rootRef);
|
|
57
|
+
}
|
|
58
|
+
return h(comp, {
|
|
59
|
+
component,
|
|
60
|
+
rootRef,
|
|
61
|
+
key: component.id
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
|
65
|
+
},
|
|
66
|
+
vElementToViewElement(vNode, children) {
|
|
67
|
+
const props = {
|
|
68
|
+
...Array.from(vNode.attrs).reduce((a, b) => {
|
|
69
|
+
a[b[0]] = b[1];
|
|
70
|
+
return a;
|
|
71
|
+
}, {})
|
|
54
72
|
};
|
|
55
|
-
|
|
73
|
+
if (vNode.classes.size) {
|
|
74
|
+
props.class = Array.from(vNode.classes).join(" ");
|
|
75
|
+
}
|
|
76
|
+
if (vNode.styles) {
|
|
77
|
+
props.style = Array.from(vNode.styles).reduce((a, b) => {
|
|
78
|
+
a[b[0]] = b[1];
|
|
79
|
+
return a;
|
|
80
|
+
}, {});
|
|
81
|
+
}
|
|
82
|
+
return h(vNode.tagName, props, ...children);
|
|
56
83
|
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
}, mount);
|
|
85
|
+
Object.keys(components).forEach((key) => {
|
|
86
|
+
const vueComponent = components[key];
|
|
87
|
+
const setup = vueComponent.setup;
|
|
88
|
+
const self = this;
|
|
89
|
+
vueComponent.setup = function(props, context, ...args) {
|
|
90
|
+
const component = props.component;
|
|
91
|
+
const vueInstance = getCurrentInstance();
|
|
92
|
+
const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
|
|
93
|
+
if (component.changeMarker.dirty) {
|
|
94
|
+
vueInstance.proxy.$forceUpdate();
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
onMounted(() => {
|
|
98
|
+
if (props.rootRef.value) {
|
|
99
|
+
self.componentRootElementCaches.set(component, props.rootRef.value);
|
|
100
|
+
} else {
|
|
101
|
+
self.componentRootElementCaches.remove(component);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
onUpdated(() => {
|
|
105
|
+
component.changeMarker.rendered();
|
|
106
|
+
self.onViewUpdated.next();
|
|
107
|
+
if (!(self.componentRefs.get(component)?.value instanceof Element)) {
|
|
108
|
+
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
onUnmounted(() => {
|
|
112
|
+
sub.unsubscribe();
|
|
62
113
|
});
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (s.changeMarker.rendered(), n.onViewUpdated.next(), !(n.componentRefs.get(s)?.value instanceof Element))
|
|
67
|
-
throw u(`Component \`${s.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
68
|
-
}), A(() => {
|
|
69
|
-
h.unsubscribe();
|
|
70
|
-
}), t(r, d, ...l);
|
|
71
|
-
}, this.components[e] = o;
|
|
114
|
+
return setup(props, context, ...args);
|
|
115
|
+
};
|
|
116
|
+
this.components[key] = vueComponent;
|
|
72
117
|
});
|
|
73
118
|
}
|
|
74
|
-
render(
|
|
75
|
-
const
|
|
76
|
-
provide:
|
|
119
|
+
render(rootComponent, injector) {
|
|
120
|
+
const childrenInjector = new ReflectiveInjector(injector, [{
|
|
121
|
+
provide: Adapter,
|
|
77
122
|
useValue: this
|
|
78
123
|
}, {
|
|
79
|
-
provide:
|
|
124
|
+
provide: DomAdapter,
|
|
80
125
|
useValue: this
|
|
81
126
|
}, {
|
|
82
|
-
provide:
|
|
127
|
+
provide: VueAdapter,
|
|
83
128
|
useValue: this
|
|
84
129
|
}]);
|
|
85
|
-
return super.render(
|
|
130
|
+
return super.render(rootComponent, childrenInjector);
|
|
86
131
|
}
|
|
87
132
|
copy() {
|
|
88
133
|
document.execCommand("copy");
|
|
89
134
|
}
|
|
90
135
|
}
|
|
91
136
|
export {
|
|
92
|
-
|
|
137
|
+
VueAdapter
|
|
93
138
|
};
|
|
94
139
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/vue-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DefineComponent, getCurrentInstance, h, onMounted, onUnmounted, onUpdated, ref, Ref, VNode } from 'vue'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('VueAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: Ref<Element | undefined>\n}\n\nexport interface VueAdapterComponents {\n [key: string]: DefineComponent<ViewComponentProps<any>>\n}\n\nexport class VueAdapter extends DomAdapter<VNode, VNode> {\n // private compositionRef = ref<Element>()\n private componentRefs = new WeakMap<Component, Ref<Element | undefined>>()\n private components: Record<string, DefineComponent<ViewComponentProps<any>>> = {}\n\n constructor(components: VueAdapterComponents,\n mount: ViewMount<VNode, 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: updateNativeCompositionNode\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(vElement: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vElement.attrs.get('ref')\n if (currentRef) {\n vElement.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.value) {\n currentRef.value = v\n }\n })\n } else {\n vElement.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): VNode => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n let rootRef = this.componentRefs.get(component)\n if (!rootRef) {\n rootRef = ref<Element>()\n this.componentRefs.set(component, rootRef)\n }\n return h(comp, {\n component,\n rootRef,\n key: component.id\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | VNode>): VNode {\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.class = 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 h(vNode.tagName, props, ...children)\n }\n }, mount)\n\n // watchEffect(() => {\n // this.compositionNode = this.compositionRef.value || null\n // })\n\n Object.keys(components).forEach(key => {\n const vueComponent = components[key]\n const setup = vueComponent.setup!\n const self = this\n vueComponent.setup = function (props: ViewComponentProps<Component>, context, ...args: any[]) {\n const component = props.component\n const vueInstance = getCurrentInstance()!\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n vueInstance.proxy!.$forceUpdate()\n }\n })\n onMounted(() => {\n if (props.rootRef.value) {\n self.componentRootElementCaches.set(component, props.rootRef.value)\n } else {\n self.componentRootElementCaches.remove(component)\n }\n })\n onUpdated(() => {\n component.changeMarker.rendered()\n self.onViewUpdated.next()\n\n if (!(self.componentRefs.get(component)?.value instanceof Element)) {\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 onUnmounted(() => {\n sub.unsubscribe()\n })\n return (setup as any)(props, context, ...args)\n }\n this.components[key] = vueComponent\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childrenInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this,\n }, {\n provide: VueAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childrenInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/vue-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DefineComponent, getCurrentInstance, h, onMounted, onUnmounted, onUpdated, ref, Ref, VNode } from 'vue'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('VueAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: Ref<Element | undefined>\n}\n\nexport interface VueAdapterComponents {\n [key: string]: DefineComponent<ViewComponentProps<any>>\n}\n\nexport class VueAdapter extends DomAdapter<VNode, VNode> {\n // private compositionRef = ref<Element>()\n private componentRefs = new WeakMap<Component, Ref<Element | undefined>>()\n private components: Record<string, DefineComponent<ViewComponentProps<any>>> = {}\n\n constructor(components: VueAdapterComponents,\n mount: ViewMount<VNode, 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: updateNativeCompositionNode\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(vElement: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vElement.attrs.get('ref')\n if (currentRef) {\n vElement.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.value) {\n currentRef.value = v\n }\n })\n } else {\n vElement.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): VNode => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n let rootRef = this.componentRefs.get(component)\n if (!rootRef) {\n rootRef = ref<Element>()\n this.componentRefs.set(component, rootRef)\n }\n return h(comp, {\n component,\n rootRef,\n key: component.id\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | VNode>): VNode {\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.class = 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 h(vNode.tagName, props, ...children)\n }\n }, mount)\n\n // watchEffect(() => {\n // this.compositionNode = this.compositionRef.value || null\n // })\n\n Object.keys(components).forEach(key => {\n const vueComponent = components[key]\n const setup = vueComponent.setup!\n const self = this\n vueComponent.setup = function (props: ViewComponentProps<Component>, context, ...args: any[]) {\n const component = props.component\n const vueInstance = getCurrentInstance()!\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n vueInstance.proxy!.$forceUpdate()\n }\n })\n onMounted(() => {\n if (props.rootRef.value) {\n self.componentRootElementCaches.set(component, props.rootRef.value)\n } else {\n self.componentRootElementCaches.remove(component)\n }\n })\n onUpdated(() => {\n component.changeMarker.rendered()\n self.onViewUpdated.next()\n\n if (!(self.componentRefs.get(component)?.value instanceof Element)) {\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 onUnmounted(() => {\n sub.unsubscribe()\n })\n return (setup as any)(props, context, ...args)\n }\n this.components[key] = vueComponent\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childrenInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this,\n }, {\n provide: VueAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childrenInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,eAAe,UAAU,YAAY;AAWpC,MAAM,mBAAmB,WAAyB;AAAA;AAAA,EAE/C,oCAAoB,QAAA;AAAA,EACpB,aAAuE,CAAA;AAAA,EAE/E,YAAY,YACA,OAAkC;AAC5C,UAAM;AAAA,MACJ,uBAAuB,CAAC,kBACA,gCAAkF;AACxG,eAAO,IAAI,SAAS,QAAQ;AAAA,UAC1B,OAAO;AAAA,YACL,gBAAgB;AAAA,UAAA;AAAA,UAElB,KAAK;AAAA,QAAA,GACJ;AAAA,UACD,IAAI,UAAU,iBAAiB,IAAI;AAAA,QAAA,CACpC;AAAA,MACH;AAAA,MACA,cAAc,MAAsC;AAClD,eAAQ,KAAc;AAAA,MACxB;AAAA,MACA,cAAc,eAA+C;AAC3D,eAAO,MAAM,KAAK,cAAc,UAAU;AAAA,MAC5C;AAAA,MACA,oBAAoB,MAAuC;AACzD,eAAO,gBAAgB;AAAA,MACzB;AAAA,MACA,gBAAgB,eAAe,OAAO;AACpC,eAAO,cAAc,WAAW,KAAK;AAAA,MACvC;AAAA,MACA,kCAAkC,UAAoB,QAAmD;AACvG,cAAM,aAAa,SAAS,MAAM,IAAI,KAAK;AAC3C,YAAI,YAAY;AACd,mBAAS,MAAM,IAAI,OAAO,CAAC,MAAe;AACxC,mBAAO,CAAC;AACR,gBAAI,OAAO,eAAe,YAAY;AACpC,yBAAW,CAAC;AAAA,YACd,WAAW,CA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HANGED
|
@@ -1,2 +1,139 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@textbus/core");
|
|
4
|
+
const vue = require("vue");
|
|
5
|
+
const platformBrowser = require("@textbus/platform-browser");
|
|
6
|
+
const core$1 = require("@viewfly/core");
|
|
7
|
+
const stream = require("@tanbo/stream");
|
|
8
|
+
const adapterError = core.makeError("VueAdapter");
|
|
9
|
+
class VueAdapter extends platformBrowser.DomAdapter {
|
|
10
|
+
// private compositionRef = ref<Element>()
|
|
11
|
+
componentRefs = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
components = {};
|
|
13
|
+
constructor(components, mount) {
|
|
14
|
+
super({
|
|
15
|
+
createCompositionNode: (compositionState, updateNativeCompositionNode) => {
|
|
16
|
+
return new core.VElement("span", {
|
|
17
|
+
style: {
|
|
18
|
+
textDecoration: "underline"
|
|
19
|
+
},
|
|
20
|
+
ref: updateNativeCompositionNode
|
|
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(vElement, update) {
|
|
38
|
+
const currentRef = vElement.attrs.get("ref");
|
|
39
|
+
if (currentRef) {
|
|
40
|
+
vElement.attrs.set("ref", (v) => {
|
|
41
|
+
update(v);
|
|
42
|
+
if (typeof currentRef === "function") {
|
|
43
|
+
currentRef(v);
|
|
44
|
+
} else if (!currentRef.value) {
|
|
45
|
+
currentRef.value = v;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
vElement.attrs.set("ref", update);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
componentRender: (component) => {
|
|
53
|
+
const comp = this.components[component.name] || this.components["*"];
|
|
54
|
+
if (comp) {
|
|
55
|
+
let rootRef = this.componentRefs.get(component);
|
|
56
|
+
if (!rootRef) {
|
|
57
|
+
rootRef = vue.ref();
|
|
58
|
+
this.componentRefs.set(component, rootRef);
|
|
59
|
+
}
|
|
60
|
+
return vue.h(comp, {
|
|
61
|
+
component,
|
|
62
|
+
rootRef,
|
|
63
|
+
key: component.id
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
|
67
|
+
},
|
|
68
|
+
vElementToViewElement(vNode, children) {
|
|
69
|
+
const props = {
|
|
70
|
+
...Array.from(vNode.attrs).reduce((a, b) => {
|
|
71
|
+
a[b[0]] = b[1];
|
|
72
|
+
return a;
|
|
73
|
+
}, {})
|
|
74
|
+
};
|
|
75
|
+
if (vNode.classes.size) {
|
|
76
|
+
props.class = Array.from(vNode.classes).join(" ");
|
|
77
|
+
}
|
|
78
|
+
if (vNode.styles) {
|
|
79
|
+
props.style = Array.from(vNode.styles).reduce((a, b) => {
|
|
80
|
+
a[b[0]] = b[1];
|
|
81
|
+
return a;
|
|
82
|
+
}, {});
|
|
83
|
+
}
|
|
84
|
+
return vue.h(vNode.tagName, props, ...children);
|
|
85
|
+
}
|
|
86
|
+
}, mount);
|
|
87
|
+
Object.keys(components).forEach((key) => {
|
|
88
|
+
const vueComponent = components[key];
|
|
89
|
+
const setup = vueComponent.setup;
|
|
90
|
+
const self = this;
|
|
91
|
+
vueComponent.setup = function(props, context, ...args) {
|
|
92
|
+
const component = props.component;
|
|
93
|
+
const vueInstance = vue.getCurrentInstance();
|
|
94
|
+
const sub = stream.merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
|
|
95
|
+
if (component.changeMarker.dirty) {
|
|
96
|
+
vueInstance.proxy.$forceUpdate();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
vue.onMounted(() => {
|
|
100
|
+
if (props.rootRef.value) {
|
|
101
|
+
self.componentRootElementCaches.set(component, props.rootRef.value);
|
|
102
|
+
} else {
|
|
103
|
+
self.componentRootElementCaches.remove(component);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
vue.onUpdated(() => {
|
|
107
|
+
component.changeMarker.rendered();
|
|
108
|
+
self.onViewUpdated.next();
|
|
109
|
+
if (!(self.componentRefs.get(component)?.value instanceof Element)) {
|
|
110
|
+
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
vue.onUnmounted(() => {
|
|
114
|
+
sub.unsubscribe();
|
|
115
|
+
});
|
|
116
|
+
return setup(props, context, ...args);
|
|
117
|
+
};
|
|
118
|
+
this.components[key] = vueComponent;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
render(rootComponent, injector) {
|
|
122
|
+
const childrenInjector = new core$1.ReflectiveInjector(injector, [{
|
|
123
|
+
provide: core.Adapter,
|
|
124
|
+
useValue: this
|
|
125
|
+
}, {
|
|
126
|
+
provide: platformBrowser.DomAdapter,
|
|
127
|
+
useValue: this
|
|
128
|
+
}, {
|
|
129
|
+
provide: VueAdapter,
|
|
130
|
+
useValue: this
|
|
131
|
+
}]);
|
|
132
|
+
return super.render(rootComponent, childrenInjector);
|
|
133
|
+
}
|
|
134
|
+
copy() {
|
|
135
|
+
document.execCommand("copy");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.VueAdapter = VueAdapter;
|
|
2
139
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/vue-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DefineComponent, getCurrentInstance, h, onMounted, onUnmounted, onUpdated, ref, Ref, VNode } from 'vue'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('VueAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: Ref<Element | undefined>\n}\n\nexport interface VueAdapterComponents {\n [key: string]: DefineComponent<ViewComponentProps<any>>\n}\n\nexport class VueAdapter extends DomAdapter<VNode, VNode> {\n // private compositionRef = ref<Element>()\n private componentRefs = new WeakMap<Component, Ref<Element | undefined>>()\n private components: Record<string, DefineComponent<ViewComponentProps<any>>> = {}\n\n constructor(components: VueAdapterComponents,\n mount: ViewMount<VNode, 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: updateNativeCompositionNode\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(vElement: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vElement.attrs.get('ref')\n if (currentRef) {\n vElement.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.value) {\n currentRef.value = v\n }\n })\n } else {\n vElement.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): VNode => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n let rootRef = this.componentRefs.get(component)\n if (!rootRef) {\n rootRef = ref<Element>()\n this.componentRefs.set(component, rootRef)\n }\n return h(comp, {\n component,\n rootRef,\n key: component.id\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | VNode>): VNode {\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.class = 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 h(vNode.tagName, props, ...children)\n }\n }, mount)\n\n // watchEffect(() => {\n // this.compositionNode = this.compositionRef.value || null\n // })\n\n Object.keys(components).forEach(key => {\n const vueComponent = components[key]\n const setup = vueComponent.setup!\n const self = this\n vueComponent.setup = function (props: ViewComponentProps<Component>, context, ...args: any[]) {\n const component = props.component\n const vueInstance = getCurrentInstance()!\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n vueInstance.proxy!.$forceUpdate()\n }\n })\n onMounted(() => {\n if (props.rootRef.value) {\n self.componentRootElementCaches.set(component, props.rootRef.value)\n } else {\n self.componentRootElementCaches.remove(component)\n }\n })\n onUpdated(() => {\n component.changeMarker.rendered()\n self.onViewUpdated.next()\n\n if (!(self.componentRefs.get(component)?.value instanceof Element)) {\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 onUnmounted(() => {\n sub.unsubscribe()\n })\n return (setup as any)(props, context, ...args)\n }\n this.components[key] = vueComponent\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childrenInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this,\n }, {\n provide: VueAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childrenInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/vue-adapter.ts"],"sourcesContent":["import { Adapter, Component, CompositionState, makeError, VElement, ViewMount, VTextNode } from '@textbus/core'\nimport { DefineComponent, getCurrentInstance, h, onMounted, onUnmounted, onUpdated, ref, Ref, VNode } from 'vue'\nimport { DomAdapter } from '@textbus/platform-browser'\nimport { Injector, ReflectiveInjector } from '@viewfly/core'\nimport { merge } from '@tanbo/stream'\n\nconst adapterError = makeError('VueAdapter')\n\nexport interface ViewComponentProps<T extends Component> {\n component: T\n rootRef: Ref<Element | undefined>\n}\n\nexport interface VueAdapterComponents {\n [key: string]: DefineComponent<ViewComponentProps<any>>\n}\n\nexport class VueAdapter extends DomAdapter<VNode, VNode> {\n // private compositionRef = ref<Element>()\n private componentRefs = new WeakMap<Component, Ref<Element | undefined>>()\n private components: Record<string, DefineComponent<ViewComponentProps<any>>> = {}\n\n constructor(components: VueAdapterComponents,\n mount: ViewMount<VNode, 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: updateNativeCompositionNode\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(vElement: VElement, update: (nativeElement: (Element | null)) => void) {\n const currentRef = vElement.attrs.get('ref')\n if (currentRef) {\n vElement.attrs.set('ref', (v: Element) => {\n update(v)\n if (typeof currentRef === 'function') {\n currentRef(v)\n } else if (!currentRef.value) {\n currentRef.value = v\n }\n })\n } else {\n vElement.attrs.set('ref', update)\n }\n },\n componentRender: (component: Component<any>): VNode => {\n const comp = this.components[component.name] || this.components['*']\n if (comp) {\n let rootRef = this.componentRefs.get(component)\n if (!rootRef) {\n rootRef = ref<Element>()\n this.componentRefs.set(component, rootRef)\n }\n return h(comp, {\n component,\n rootRef,\n key: component.id\n })\n }\n throw adapterError(`cannot found view component \\`${component.name}\\`!`)\n },\n vElementToViewElement(vNode: VElement, children: Array<string | VNode>): VNode {\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.class = 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 h(vNode.tagName, props, ...children)\n }\n }, mount)\n\n // watchEffect(() => {\n // this.compositionNode = this.compositionRef.value || null\n // })\n\n Object.keys(components).forEach(key => {\n const vueComponent = components[key]\n const setup = vueComponent.setup!\n const self = this\n vueComponent.setup = function (props: ViewComponentProps<Component>, context, ...args: any[]) {\n const component = props.component\n const vueInstance = getCurrentInstance()!\n const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {\n if (component.changeMarker.dirty) {\n vueInstance.proxy!.$forceUpdate()\n }\n })\n onMounted(() => {\n if (props.rootRef.value) {\n self.componentRootElementCaches.set(component, props.rootRef.value)\n } else {\n self.componentRootElementCaches.remove(component)\n }\n })\n onUpdated(() => {\n component.changeMarker.rendered()\n self.onViewUpdated.next()\n\n if (!(self.componentRefs.get(component)?.value instanceof Element)) {\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 onUnmounted(() => {\n sub.unsubscribe()\n })\n return (setup as any)(props, context, ...args)\n }\n this.components[key] = vueComponent\n })\n }\n\n override render(rootComponent: Component, injector: Injector): void | (() => void) {\n const childrenInjector = new ReflectiveInjector(injector, [{\n provide: Adapter,\n useValue: this\n }, {\n provide: DomAdapter,\n useValue: this,\n }, {\n provide: VueAdapter,\n useValue: this\n }])\n return super.render(rootComponent, childrenInjector)\n }\n\n override copy() {\n document.execCommand('copy')\n }\n}\n"],"names":["makeError","DomAdapter","VElement","VTextNode","ref","h","getCurrentInstance","merge","onMounted","onUpdated","onUnmounted","ReflectiveInjector","Adapter"],"mappings":";;;;;;;AAMA,MAAM,eAAeA,KAAAA,UAAU,YAAY;AAWpC,MAAM,mBAAmBC,gBAAAA,WAAyB;AAAA;AAAA,EAE/C,oCAAoB,QAAA;AAAA,EACpB,aAAuE,CAAA;AAAA,EAE/E,YAAY,YACA,OAAkC;AAC5C,UAAM;AAAA,MACJ,uBAAuB,CAAC,kBACA,gCAAkF;AACxG,eAAO,IAAIC,KAAAA,SAAS,QAAQ;AAAA,UAC1B,OAAO;AAAA,YACL,gBAAgB;AAAA,UAAA;AAAA,UAElB,KAAK;AAAA,QAAA,GACJ;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,MAAM,KAAK,cAAc,UAAU;AAAA,MAC5C;AAAA,MACA,oBAAoB,MAAuC;AACzD,eAAO,gBAAgB;AAAA,MACzB;AAAA,MACA,gBAAgB,eAAe,OAAO;AACpC,eAAO,cAAc,WAAW,KAAK;AAAA,MACvC;AAAA,MACA,kCAAkC,UAAoB,QAAmD;AACvG,cAAM,aAAa,SAAS,MAAM,IAAI,KAAK;AAC3C,YAAI,YAAY;AACd,mBAAS,MAAM,IAAI,OAAO,CAAC,MAAe;AACxC,mBAAO,CAAC;AACR,gBAAI,OAAO,eAAe,YAAY;AACpC,yBAAW,CAAC;AAAA,YAC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AAgB;AAAA,EACrD;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-vue",
|
|
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
|
"vue": "^3.4.28"
|