@textbus/xnote 0.1.2 → 0.2.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.
Files changed (54) hide show
  1. package/bundles/components/dropdown/dropdown-menu.d.ts +2 -1
  2. package/bundles/components/dropdown/dropdown.d.ts +1 -0
  3. package/bundles/editor.d.ts +6 -0
  4. package/bundles/fonts/textbus.svg +4 -3
  5. package/bundles/fonts/textbus.ttf +0 -0
  6. package/bundles/fonts/textbus.woff +0 -0
  7. package/bundles/index.css +2 -2
  8. package/bundles/index.esm.css +2 -2
  9. package/bundles/index.esm.js +1007 -496
  10. package/bundles/index.js +1022 -495
  11. package/bundles/plugins/_api.d.ts +8 -4
  12. package/bundles/plugins/inline-toolbar/inline-toolbar.d.ts +4 -0
  13. package/bundles/plugins/inline-toolbar/inline-toolbar.plugin.d.ts +12 -0
  14. package/bundles/plugins/static-toolbar/static-toolbar.d.ts +4 -0
  15. package/bundles/plugins/static-toolbar/static-toolbar.plugin.d.ts +14 -0
  16. package/bundles/plugins/suspension-toolbar/suspension-toolbar.d.ts +4 -0
  17. package/bundles/plugins/suspension-toolbar/suspension-toolbar.plugin.d.ts +13 -0
  18. package/bundles/plugins/{_common → tools}/_api.d.ts +8 -0
  19. package/bundles/plugins/tools/_common/common-state.d.ts +1 -0
  20. package/bundles/plugins/tools/_common/split-line.d.ts +1 -0
  21. package/bundles/plugins/tools/_common/tool.service.d.ts +14 -0
  22. package/bundles/plugins/tools/clean-formats.tool.d.ts +1 -0
  23. package/bundles/plugins/{left-toolbar/insert-tool.d.ts → tools/insert-menu.d.ts} +1 -1
  24. package/bundles/plugins/tools/insert.tool.d.ts +1 -0
  25. package/bundles/plugins/tools/redo.tool.d.ts +1 -0
  26. package/bundles/plugins/tools/subscript.tool.d.ts +1 -0
  27. package/bundles/plugins/tools/superscript.tool.d.ts +1 -0
  28. package/bundles/plugins/tools/table/help.d.ts +5 -0
  29. package/bundles/plugins/tools/undo.tool.d.ts +1 -0
  30. package/bundles/textbus/components/at/at.component.d.ts +13 -5
  31. package/bundles/textbus/components/table/table.component.d.ts +1 -0
  32. package/bundles/textbus/formatters/_api.d.ts +2 -0
  33. package/bundles/textbus/formatters/subscript.d.ts +4 -0
  34. package/bundles/textbus/formatters/superscript.d.ts +4 -0
  35. package/bundles/xnote-message-bus.d.ts +1 -1
  36. package/package.json +10 -10
  37. package/bundles/plugins/toolbar/toolbar.d.ts +0 -1
  38. package/bundles/plugins/toolbar/toolbar.plugin.d.ts +0 -7
  39. /package/bundles/plugins/{_common → tools}/attr.tool.d.ts +0 -0
  40. /package/bundles/plugins/{_common → tools}/block.tool.d.ts +0 -0
  41. /package/bundles/plugins/{_common → tools}/bold.tool.d.ts +0 -0
  42. /package/bundles/plugins/{_common → tools}/code.tool.d.ts +0 -0
  43. /package/bundles/plugins/{_common → tools}/color.tool.d.ts +0 -0
  44. /package/bundles/plugins/{_common → tools}/font-family.tool.d.ts +0 -0
  45. /package/bundles/plugins/{_common → tools}/font-size.tool.d.ts +0 -0
  46. /package/bundles/plugins/{_common → tools}/italic.tool.d.ts +0 -0
  47. /package/bundles/plugins/{_common → tools}/link.tool.d.ts +0 -0
  48. /package/bundles/plugins/{_common → tools}/strike-through.tool.d.ts +0 -0
  49. /package/bundles/plugins/{_common → tools}/table/_api.d.ts +0 -0
  50. /package/bundles/plugins/{_common → tools}/table/cell-align.tool.d.ts +0 -0
  51. /package/bundles/plugins/{_common → tools}/table/cell-background.tool.d.ts +0 -0
  52. /package/bundles/plugins/{_common → tools}/table/merge-cells.tool.d.ts +0 -0
  53. /package/bundles/plugins/{_common → tools}/table/split-cells.tool.d.ts +0 -0
  54. /package/bundles/plugins/{_common → tools}/underline.tool.d.ts +0 -0
@@ -1,9 +1,13 @@
1
- export * from './_common/_api';
1
+ export * from './tools/_api';
2
2
  export * from './hooks/active-block';
3
3
  export * from './hooks/block-transform';
4
- export * from './left-toolbar/insert-tool';
4
+ export * from './tools/insert-menu';
5
5
  export * from './left-toolbar/left-toolbar.plugin';
6
6
  export * from './left-toolbar/left-toolbar';
7
7
  export * from './link-jump/link-jump';
8
- export * from './toolbar/toolbar.plugin';
9
- export * from './toolbar/toolbar';
8
+ export * from './inline-toolbar/inline-toolbar.plugin';
9
+ export * from './inline-toolbar/inline-toolbar';
10
+ export * from './static-toolbar/static-toolbar.plugin';
11
+ export * from './static-toolbar/static-toolbar';
12
+ export * from './suspension-toolbar/suspension-toolbar.plugin';
13
+ export * from './suspension-toolbar/suspension-toolbar';
@@ -0,0 +1,4 @@
1
+ export interface InlineToolbarProps {
2
+ theme?: 'dark' | 'light';
3
+ }
4
+ export declare const InlineToolbar: (props: InlineToolbarProps) => () => import("@viewfly/core").JSXNode;
@@ -0,0 +1,12 @@
1
+ import { Plugin } from '@textbus/core';
2
+ import { Injector } from '@viewfly/core';
3
+ export interface InlineToolbarOptions {
4
+ theme?: 'dark' | 'light';
5
+ }
6
+ export declare class InlineToolbarPlugin implements Plugin {
7
+ private config;
8
+ private app;
9
+ constructor(config?: InlineToolbarOptions);
10
+ setup(injector: Injector): void;
11
+ onDestroy(): void;
12
+ }
@@ -0,0 +1,4 @@
1
+ export interface StaticToolbarProps {
2
+ theme?: 'dark' | 'light';
3
+ }
4
+ export declare const StaticToolbar: (props: StaticToolbarProps) => () => import("@viewfly/core").JSXNode;
@@ -0,0 +1,14 @@
1
+ import { Plugin } from '@textbus/core';
2
+ import { Injector } from '@viewfly/core';
3
+ export interface StaticToolbarOptions {
4
+ host: HTMLElement;
5
+ theme?: 'dark' | 'light';
6
+ }
7
+ export declare class StaticToolbarPlugin implements Plugin {
8
+ options: StaticToolbarOptions;
9
+ private app;
10
+ private container;
11
+ constructor(options: StaticToolbarOptions);
12
+ setup(injector: Injector): void;
13
+ onDestroy(): void;
14
+ }
@@ -0,0 +1,4 @@
1
+ export interface SuspensionToolbarProps {
2
+ theme?: 'dark' | 'light';
3
+ }
4
+ export declare const SuspensionToolbar: (props: SuspensionToolbarProps) => () => import("@viewfly/core").JSXNode;
@@ -0,0 +1,13 @@
1
+ import { Plugin } from '@textbus/core';
2
+ import { Injector } from '@viewfly/core';
3
+ export interface SuspensionToolbarOptions {
4
+ theme?: 'dark' | 'light';
5
+ }
6
+ export declare class SuspensionToolbarPlugin implements Plugin {
7
+ options: SuspensionToolbarOptions;
8
+ private app;
9
+ private container;
10
+ constructor(options?: SuspensionToolbarOptions);
11
+ setup(injector: Injector): void;
12
+ onDestroy(): void;
13
+ }
@@ -1,12 +1,20 @@
1
1
  export * from './attr.tool';
2
2
  export * from './block.tool';
3
3
  export * from './bold.tool';
4
+ export * from './clean-formats.tool';
4
5
  export * from './code.tool';
5
6
  export * from './color.tool';
6
7
  export * from './font-family.tool';
7
8
  export * from './font-size.tool';
9
+ export * from './insert.tool';
10
+ export * from './insert-menu';
8
11
  export * from './italic.tool';
9
12
  export * from './link.tool';
13
+ export * from './redo.tool';
10
14
  export * from './strike-through.tool';
15
+ export * from './subscript.tool';
16
+ export * from './superscript.tool';
11
17
  export * from './underline.tool';
18
+ export * from './undo.tool';
12
19
  export * from './table/_api';
20
+ export * from './_common/split-line';
@@ -0,0 +1 @@
1
+ export declare function useCommonState(): import("@viewfly/core").Signal<import("./tool.service").CommonState>;
@@ -0,0 +1 @@
1
+ export declare function SplitLine(): () => import("@viewfly/core").JSXNode;
@@ -0,0 +1,14 @@
1
+ import { Controller, Selection } from '@textbus/core';
2
+ import { Signal } from '@viewfly/core';
3
+ export interface CommonState {
4
+ inSourceCode: boolean;
5
+ readonly: boolean;
6
+ }
7
+ export declare class ToolService {
8
+ private selection;
9
+ private controller;
10
+ state: Signal<CommonState>;
11
+ private sub;
12
+ constructor(selection: Selection, controller: Controller);
13
+ destroy(): void;
14
+ }
@@ -0,0 +1 @@
1
+ export declare function CleanFormatsTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -4,4 +4,4 @@ export interface InsertToolProps {
4
4
  hideTitle?: boolean;
5
5
  replace?: boolean;
6
6
  }
7
- export declare function InsertTool(props: InsertToolProps): () => import("@viewfly/core").JSXNode;
7
+ export declare function InsertMenu(props: InsertToolProps): () => import("@viewfly/core").JSXNode;
@@ -0,0 +1 @@
1
+ export declare function InsertTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function RedoTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function SubscriptTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function SuperscriptTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Selection, Slot } from '@textbus/core';
2
+ import { TableComponent } from '../../../textbus/components/table/table.component';
3
+ export declare function isInTable(selection: Selection): boolean;
4
+ export declare function getParentTable(slot: Slot | null): TableComponent | null;
5
+ export declare function getTableSlotBySlot(slot: Slot | null): Slot | null;
@@ -0,0 +1 @@
1
+ export declare function UndoTool(): () => import("@viewfly/core/jsx-runtime").JSX.Element;
@@ -13,12 +13,17 @@ export interface Member {
13
13
  /** 成员背景色 */
14
14
  color?: string;
15
15
  }
16
- export declare abstract class Organization {
17
- abstract getMembers(name?: string): Promise<Member[]>;
18
- abstract getMemberById(id: string): Promise<Member | null>;
16
+ /**
17
+ * 组件架构信息
18
+ */
19
+ export declare abstract class Organization<T extends Member = Member> {
20
+ /** 根据当前输入获取成员列表 */
21
+ abstract getMembers(name?: string): Promise<T[]>;
22
+ /** 当 @ 某个成员时的回调 */
23
+ abstract atMember(member: T): void;
19
24
  }
20
- export interface AtComponentState {
21
- userInfo?: Member;
25
+ export interface AtComponentState<T extends Member = Member> {
26
+ userInfo?: T;
22
27
  slot?: Slot;
23
28
  }
24
29
  export declare function registerAtShortcut(textbus: Textbus): void;
@@ -29,7 +34,10 @@ export declare class AtComponent extends Component<AtComponentState> {
29
34
  focus: Subject<boolean>;
30
35
  members: import("@viewfly/core").Signal<Member[]>;
31
36
  selectedIndex: import("@viewfly/core").Signal<number>;
37
+ private selection;
38
+ private organization;
32
39
  constructor(textbus: Textbus, state?: AtComponentState);
33
40
  getSlots(): Slot[];
34
41
  setup(): void;
42
+ atMember(member?: Member): void;
35
43
  }
@@ -29,6 +29,7 @@ export declare class TableComponent extends Component<TableComponentState> {
29
29
  getSlots(): Slot[];
30
30
  mergeCellBySelection(): void;
31
31
  splitCellsBySelection(): void;
32
+ splitCellBySlot(slot: Slot): void;
32
33
  getMaxRectangle(startSlot: Slot, endSlot: Slot): Rectangle | null;
33
34
  getSelectedNormalizedSlots(): {
34
35
  row: Row;
@@ -7,4 +7,6 @@ export * from './font-size';
7
7
  export * from './italic';
8
8
  export * from './link';
9
9
  export * from './strike-through';
10
+ export * from './subscript';
11
+ export * from './superscript';
10
12
  export * from './underline';
@@ -0,0 +1,4 @@
1
+ import { Formatter } from '@textbus/core';
2
+ import { FormatLoader } from '@textbus/platform-browser';
3
+ export declare const subscriptFormatter: Formatter<boolean>;
4
+ export declare const subscriptFormatLoader: FormatLoader;
@@ -0,0 +1,4 @@
1
+ import { Formatter } from '@textbus/core';
2
+ import { FormatLoader } from '@textbus/platform-browser';
3
+ export declare const superscriptFormatter: Formatter<boolean>;
4
+ export declare const superscriptFormatLoader: FormatLoader;
@@ -9,7 +9,7 @@ export interface UserInfo {
9
9
  export interface XNoteMessage extends UserSelectionCursor {
10
10
  id: string;
11
11
  }
12
- export declare class XNoteMessageBug extends MessageBus<XNoteMessage> {
12
+ export declare class XNoteMessageBus extends MessageBus<XNoteMessage> {
13
13
  private selection;
14
14
  private collaborateCursor;
15
15
  private userinfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "A high-performance rich text editor that supports multiplayer online collaboration.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -27,14 +27,14 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@tanbo/color": "^0.1.1",
30
- "@textbus/adapter-viewfly": "^4.2.2",
31
- "@textbus/collaborate": "^4.2.1",
32
- "@textbus/core": "^4.2.1",
33
- "@textbus/platform-browser": "^4.2.2",
34
- "@viewfly/core": "^1.0.5",
35
- "@viewfly/hooks": "^1.0.5",
36
- "@viewfly/platform-browser": "^1.0.6",
37
- "@viewfly/scoped-css": "^1.0.5",
30
+ "@textbus/adapter-viewfly": "^4.2.5",
31
+ "@textbus/collaborate": "^4.2.4",
32
+ "@textbus/core": "^4.2.4",
33
+ "@textbus/platform-browser": "^4.2.5",
34
+ "@viewfly/core": "^1.1.0",
35
+ "@viewfly/hooks": "^1.1.0",
36
+ "@viewfly/platform-browser": "^1.1.0",
37
+ "@viewfly/scoped-css": "^1.1.0",
38
38
  "highlight.js": "^11.9.0",
39
39
  "katex": "^0.16.10",
40
40
  "uuid": "^10.0.0"
@@ -47,7 +47,7 @@
47
47
  "@types/uuid": "^10.0.0",
48
48
  "@typescript-eslint/eslint-plugin": "^5.8.0",
49
49
  "@typescript-eslint/parser": "^5.8.0",
50
- "@viewfly/devtools": "^1.0.2",
50
+ "@viewfly/devtools": "^1.0.8",
51
51
  "autoprefixer": "^10.4.0",
52
52
  "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
53
53
  "core-js": "^3.20.1",
@@ -1 +0,0 @@
1
- export declare const Toolbar: () => () => import("@viewfly/core").JSXNode;
@@ -1,7 +0,0 @@
1
- import { Plugin } from '@textbus/core';
2
- import { Injector } from '@viewfly/core';
3
- export declare class ToolbarPlugin implements Plugin {
4
- private app;
5
- setup(injector: Injector): void;
6
- onDestroy(): void;
7
- }