@textbus/platform-browser 3.5.0 → 4.0.0-alpha.1
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/browser-module.d.ts +33 -0
- package/bundles/{collaborate/collaborate-cursor.d.ts → collaborate-cursor.d.ts} +3 -4
- package/bundles/dom-adapter.d.ts +66 -0
- package/bundles/index.esm.js +682 -1271
- package/bundles/index.js +737 -1325
- package/bundles/{core/injection-tokens.d.ts → injection-tokens.d.ts} +2 -2
- package/bundles/{core/magic-input.d.ts → magic-input.d.ts} +2 -2
- package/bundles/{core/native-input.d.ts → native-input.d.ts} +7 -7
- package/bundles/{dom-support/parser.d.ts → parser.d.ts} +3 -16
- package/bundles/public-api.d.ts +8 -4
- package/bundles/{core/selection-bridge.d.ts → selection-bridge.d.ts} +8 -10
- package/bundles/types.d.ts +44 -0
- package/package.json +4 -4
- package/bundles/core/_api.d.ts +0 -6
- package/bundles/core/dom-renderer.d.ts +0 -53
- package/bundles/core/types.d.ts +0 -74
- package/bundles/dom-support/_api.d.ts +0 -2
- package/bundles/dom-support/output-translator.d.ts +0 -20
- package/bundles/viewer.d.ts +0 -90
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ComponentLiteral, Module } from '@textbus/core';
|
2
|
+
import { Provider } from '@viewfly/core';
|
3
|
+
import { AttributeLoader, ComponentLoader, FormatLoader } from './parser';
|
4
|
+
import { DomAdapter } from './dom-adapter';
|
5
|
+
/**
|
6
|
+
* Textbus PC 端配置接口
|
7
|
+
*/
|
8
|
+
export interface ViewOptions {
|
9
|
+
adapter: DomAdapter<any, any>;
|
10
|
+
/** 自动获取焦点 */
|
11
|
+
autoFocus?: boolean;
|
12
|
+
/** 编辑区最小高度 */
|
13
|
+
minHeight?: string;
|
14
|
+
/** 组件加载器 */
|
15
|
+
componentLoaders?: ComponentLoader[];
|
16
|
+
/** 格式加载器 */
|
17
|
+
formatLoaders?: FormatLoader<any>[];
|
18
|
+
/** 属性加载器 */
|
19
|
+
attributeLoaders?: AttributeLoader<any>[];
|
20
|
+
/** 默认内容 */
|
21
|
+
content?: string | ComponentLiteral;
|
22
|
+
/** 使用 contentEditable 作为编辑器控制可编辑范围 */
|
23
|
+
useContentEditable?: boolean;
|
24
|
+
}
|
25
|
+
export declare class BrowserModule implements Module {
|
26
|
+
host: HTMLElement;
|
27
|
+
config: ViewOptions;
|
28
|
+
providers: Provider[];
|
29
|
+
private workbench;
|
30
|
+
constructor(host: HTMLElement, config: ViewOptions);
|
31
|
+
onDestroy(): void;
|
32
|
+
private static createLayout;
|
33
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Injector } from '@
|
1
|
+
import { Injector } from '@viewfly/core';
|
2
2
|
import { Selection, SelectionPaths, AbstractSelection, Scheduler } from '@textbus/core';
|
3
|
-
import { SelectionBridge } from '
|
4
|
-
import { Rect } from '
|
3
|
+
import { SelectionBridge } from './selection-bridge';
|
4
|
+
import { Rect } from './_utils/uikit';
|
5
5
|
/**
|
6
6
|
* 远程用户及光标位置信息
|
7
7
|
*/
|
@@ -31,7 +31,6 @@ export declare abstract class CollaborateSelectionAwarenessDelegate {
|
|
31
31
|
* 协作光标绘制类
|
32
32
|
*/
|
33
33
|
export declare class CollaborateCursor {
|
34
|
-
private injector;
|
35
34
|
private nativeSelection;
|
36
35
|
private scheduler;
|
37
36
|
private selection;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { ComponentInstance, Slot, ViewAdapter, NodeLocation, VElement, VTextNode } from '@textbus/core';
|
2
|
+
/**
|
3
|
+
* Textbus PC 端浏览器渲染能力桥接器抽象类,提供了 DOM 元素查询能力,具体渲染能力由各前端框架实现相应桥接
|
4
|
+
*/
|
5
|
+
export declare abstract class DomAdapter<ViewComponent, ViewElement> extends ViewAdapter {
|
6
|
+
private mount;
|
7
|
+
host: HTMLElement;
|
8
|
+
protected componentRootElementCaches: {
|
9
|
+
set: {
|
10
|
+
(key: ComponentInstance<unknown, unknown, unknown>, value: HTMLElement): void;
|
11
|
+
(key: HTMLElement, value: ComponentInstance<unknown, unknown, unknown>): void;
|
12
|
+
};
|
13
|
+
get: {
|
14
|
+
(key: ComponentInstance<unknown, unknown, unknown>): HTMLElement;
|
15
|
+
(key: HTMLElement): ComponentInstance<unknown, unknown, unknown>;
|
16
|
+
};
|
17
|
+
remove: (key: HTMLElement | ComponentInstance<unknown, unknown, unknown>) => void;
|
18
|
+
};
|
19
|
+
protected slotRootNativeElementCaches: {
|
20
|
+
set: {
|
21
|
+
(key: Slot<any>, value: HTMLElement): void;
|
22
|
+
(key: HTMLElement, value: Slot<any>): void;
|
23
|
+
};
|
24
|
+
get: {
|
25
|
+
(key: Slot<any>): HTMLElement;
|
26
|
+
(key: HTMLElement): Slot<any>;
|
27
|
+
};
|
28
|
+
remove: (key: HTMLElement | Slot<any>) => void;
|
29
|
+
};
|
30
|
+
protected slotRootVElementCaches: WeakMap<Slot<any>, VElement>;
|
31
|
+
protected constructor(mount: (host: HTMLElement, viewComponent: ViewComponent) => (void | (() => void)));
|
32
|
+
render(rootComponent: ComponentInstance): void | (() => void);
|
33
|
+
abstract componentRender(component: ComponentInstance): ViewComponent;
|
34
|
+
abstract slotRender(slot: Slot, slotHostRender: (children: Array<VElement | VTextNode | ComponentInstance>) => VElement): ViewElement;
|
35
|
+
copy(): void;
|
36
|
+
/**
|
37
|
+
* 根据组件获取组件的根 DOM 节点
|
38
|
+
* @param component
|
39
|
+
*/
|
40
|
+
getNativeNodeByComponent(component: ComponentInstance): HTMLElement | null;
|
41
|
+
/**
|
42
|
+
* 根据 DOM 节点,获对对应的组件根节点,如传入的 DOM 节点不为组件的根节点,则返回 null
|
43
|
+
* @param node
|
44
|
+
*/
|
45
|
+
getComponentByNativeNode(node: HTMLElement): ComponentInstance | null;
|
46
|
+
/**
|
47
|
+
* 根据插槽获取插槽的根 DOM 节点
|
48
|
+
* @param slot
|
49
|
+
*/
|
50
|
+
getNativeNodeBySlot(slot: Slot): HTMLElement | null;
|
51
|
+
/**
|
52
|
+
* 根据 DOM 节点,获对对应的插槽根节点,如传入的 DOM 节点不为插槽的根节点,则返回 null
|
53
|
+
* @param node
|
54
|
+
*/
|
55
|
+
getSlotByNativeNode(node: HTMLElement): Slot | null;
|
56
|
+
/**
|
57
|
+
* 获取插槽内容节点集合
|
58
|
+
* @param slot
|
59
|
+
*/
|
60
|
+
getNodesBySlot(slot: Slot): Node[];
|
61
|
+
/**
|
62
|
+
* 获取原生节点的原始数据在文档中的位置
|
63
|
+
* @param node
|
64
|
+
*/
|
65
|
+
getLocationByNativeNode(node: Node): NodeLocation | null;
|
66
|
+
}
|