@textbus/adapter-viewfly 4.0.0-alpha.17 → 4.0.0-alpha.19
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/bundles/adapter.d.ts +2 -2
- package/bundles/index.esm.js +7 -4
- package/bundles/index.js +6 -3
- package/package.json +5 -5
package/bundles/adapter.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import { JSXComponent, JSXInternal,
|
1
|
+
import { JSXComponent, JSXInternal, DynamicRef } from '@viewfly/core';
|
2
2
|
import { Subject } from '@tanbo/stream';
|
3
3
|
import { Component, ComponentInstance, ExtractComponentInstanceType, Slot, VElement, VTextNode } from '@textbus/core';
|
4
4
|
import { DomAdapter } from '@textbus/platform-browser';
|
5
5
|
export interface ViewComponentProps<T extends Component = Component> {
|
6
6
|
component: ExtractComponentInstanceType<T>;
|
7
|
-
rootRef:
|
7
|
+
rootRef: DynamicRef<HTMLElement>;
|
8
8
|
}
|
9
9
|
export interface ViewflyAdapterComponents {
|
10
10
|
[key: string]: JSXInternal.ComponentSetup<ViewComponentProps>;
|
package/bundles/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getCurrentInstance, onUpdated,
|
1
|
+
import { getCurrentInstance, onUpdated, createDynamicRef, jsx, DynamicRef } from '@viewfly/core';
|
2
2
|
import { Subject } from '@tanbo/stream';
|
3
3
|
import { makeError, VElement, VTextNode, replaceEmpty } from '@textbus/core';
|
4
4
|
import { DomAdapter } from '@textbus/platform-browser';
|
@@ -41,7 +41,7 @@ class Adapter extends DomAdapter {
|
|
41
41
|
if (comp) {
|
42
42
|
let ref = this.componentRefs.get(component);
|
43
43
|
if (!ref) {
|
44
|
-
ref =
|
44
|
+
ref = createDynamicRef(rootNode => {
|
45
45
|
this.componentRootElementCaches.set(component, rootNode);
|
46
46
|
return () => {
|
47
47
|
this.componentRootElementCaches.remove(component);
|
@@ -93,10 +93,13 @@ class Adapter extends DomAdapter {
|
|
93
93
|
};
|
94
94
|
const jsxNode = vNodeToJSX(vElement);
|
95
95
|
const currentRef = jsxNode.props.ref;
|
96
|
-
const ref =
|
96
|
+
const ref = createDynamicRef(nativeNode => {
|
97
97
|
this.slotRootNativeElementCaches.set(slot, nativeNode);
|
98
|
+
return () => {
|
99
|
+
this.slotRootNativeElementCaches.remove(slot);
|
100
|
+
};
|
98
101
|
});
|
99
|
-
if (currentRef instanceof
|
102
|
+
if (currentRef instanceof DynamicRef) {
|
100
103
|
jsxNode.props.ref = [currentRef, ref];
|
101
104
|
}
|
102
105
|
else if (Array.isArray(currentRef)) {
|
package/bundles/index.js
CHANGED
@@ -43,7 +43,7 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
43
43
|
if (comp) {
|
44
44
|
let ref = this.componentRefs.get(component);
|
45
45
|
if (!ref) {
|
46
|
-
ref = core$1.
|
46
|
+
ref = core$1.createDynamicRef(rootNode => {
|
47
47
|
this.componentRootElementCaches.set(component, rootNode);
|
48
48
|
return () => {
|
49
49
|
this.componentRootElementCaches.remove(component);
|
@@ -95,10 +95,13 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
95
95
|
};
|
96
96
|
const jsxNode = vNodeToJSX(vElement);
|
97
97
|
const currentRef = jsxNode.props.ref;
|
98
|
-
const ref = core$1.
|
98
|
+
const ref = core$1.createDynamicRef(nativeNode => {
|
99
99
|
this.slotRootNativeElementCaches.set(slot, nativeNode);
|
100
|
+
return () => {
|
101
|
+
this.slotRootNativeElementCaches.remove(slot);
|
102
|
+
};
|
100
103
|
});
|
101
|
-
if (currentRef instanceof core$1.
|
104
|
+
if (currentRef instanceof core$1.DynamicRef) {
|
102
105
|
jsxNode.props.ref = [currentRef, ref];
|
103
106
|
}
|
104
107
|
else if (Array.isArray(currentRef)) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/adapter-viewfly",
|
3
|
-
"version": "4.0.0-alpha.
|
3
|
+
"version": "4.0.0-alpha.19",
|
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": "./bundles/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -26,9 +26,9 @@
|
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/stream": "^1.2.0",
|
29
|
-
"@textbus/core": "^4.0.0-alpha.
|
30
|
-
"@textbus/platform-browser": "^4.0.0-alpha.
|
31
|
-
"@viewfly/core": "^0.
|
29
|
+
"@textbus/core": "^4.0.0-alpha.19",
|
30
|
+
"@textbus/platform-browser": "^4.0.0-alpha.19",
|
31
|
+
"@viewfly/core": "^0.5.0"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@rollup/plugin-commonjs": "^23.0.2",
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"bugs": {
|
49
49
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "7f951b0c4cf33aa7873e26d6e04da5a4301ca066"
|
52
52
|
}
|