@textbus/platform-browser 3.4.10 → 4.0.0-alpha.0

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.
@@ -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 '@tanbo/di';
1
+ import { Injector } from '@viewfly/core';
2
2
  import { Selection, SelectionPaths, AbstractSelection, Scheduler } from '@textbus/core';
3
- import { SelectionBridge } from '../core/selection-bridge';
4
- import { Rect } from '../_utils/uikit';
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,37 @@
1
+ import { ComponentInstance, Slot, ViewAdapter, NodeLocation, VElement } from '@textbus/core';
2
+ /**
3
+ * Textbus PC 端浏览器渲染能力实现
4
+ */
5
+ export declare abstract class DomAdapter<ViewComponent, ViewElement> extends ViewAdapter<ViewElement> {
6
+ private mount;
7
+ host: HTMLElement;
8
+ protected componentRootElementCaches: WeakMap<ComponentInstance<unknown, unknown, unknown>, HTMLElement>;
9
+ protected slotRootNativeElementCaches: {
10
+ set: {
11
+ (key: Slot<any>, value: Node): void;
12
+ (key: Node, value: Slot<any>): void;
13
+ };
14
+ get: {
15
+ (key: Slot<any>): Node;
16
+ (key: Node): Slot<any>;
17
+ };
18
+ remove: (key: Node | Slot<any>) => void;
19
+ };
20
+ protected slotRootVElementCaches: WeakMap<Slot<any>, VElement>;
21
+ protected constructor(mount: (host: HTMLElement, viewComponent: ViewComponent) => (void | (() => void)));
22
+ render(rootComponent: ComponentInstance): void | (() => void);
23
+ abstract componentRender(component: ComponentInstance): ViewComponent;
24
+ copy(): void;
25
+ getNativeNodeByComponent(component: ComponentInstance): HTMLElement | null;
26
+ getNativeNodeBySlot(slot: Slot): HTMLElement | null;
27
+ /**
28
+ * 获取插槽内容节点集合
29
+ * @param slot
30
+ */
31
+ getNodesBySlot(slot: Slot): Node[];
32
+ /**
33
+ * 获取原生节点的原始数据在文档中的位置
34
+ * @param node
35
+ */
36
+ getLocationByNativeNode(node: Node): NodeLocation | null;
37
+ }