@textbus/xnote 0.0.1-alpha.8 → 0.0.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 (43) hide show
  1. package/README.md +103 -1
  2. package/bundles/components/_api.d.ts +2 -0
  3. package/bundles/components/dropdown/dropdown-menu.d.ts +4 -1
  4. package/bundles/components/dropdown/dropdown.d.ts +3 -1
  5. package/bundles/components/keymap/keymap.d.ts +5 -0
  6. package/bundles/components/menu-heading/menu-heading.d.ts +2 -0
  7. package/bundles/components/menu-item/menu-item.d.ts +2 -1
  8. package/bundles/components/popup/popup.d.ts +1 -1
  9. package/bundles/fonts/textbus.svg +3 -32
  10. package/bundles/fonts/textbus.ttf +0 -0
  11. package/bundles/fonts/textbus.woff +0 -0
  12. package/bundles/index.css +2 -2
  13. package/bundles/index.esm.css +2 -2
  14. package/bundles/index.esm.js +1587 -678
  15. package/bundles/index.js +1598 -673
  16. package/bundles/plugins/_api.d.ts +1 -0
  17. package/bundles/plugins/_common/attr.tool.d.ts +2 -2
  18. package/bundles/plugins/_common/color.tool.d.ts +2 -2
  19. package/bundles/plugins/left-toolbar/insert-tool.d.ts +1 -0
  20. package/bundles/plugins/link-jump/link-jump.d.ts +4 -0
  21. package/bundles/public-api.d.ts +1 -0
  22. package/bundles/services/editor.service.d.ts +4 -0
  23. package/bundles/textbus/components/SlotRender.d.ts +14 -0
  24. package/bundles/textbus/components/_api.d.ts +3 -0
  25. package/bundles/textbus/components/at/at-component.view.d.ts +6 -0
  26. package/bundles/textbus/components/at/at.component.d.ts +35 -0
  27. package/bundles/textbus/components/blockqoute/blockquote.component.d.ts +4 -1
  28. package/bundles/textbus/components/highlight-box/highlight-box.component.d.ts +1 -0
  29. package/bundles/textbus/components/image/image.component.d.ts +2 -1
  30. package/bundles/textbus/components/katex/katex-editor.d.ts +7 -0
  31. package/bundles/textbus/components/katex/katex.component.d.ts +16 -0
  32. package/bundles/textbus/components/list/list.component.d.ts +3 -0
  33. package/bundles/textbus/components/paragraph/paragraph.component.d.ts +1 -0
  34. package/bundles/textbus/components/root/root.component.d.ts +2 -0
  35. package/bundles/textbus/components/source-code/source-code.component.d.ts +2 -1
  36. package/bundles/textbus/components/table/components/resize-column.d.ts +2 -1
  37. package/bundles/textbus/components/table/components/scroll.d.ts +1 -2
  38. package/bundles/textbus/components/table/components/top-bar.d.ts +2 -2
  39. package/bundles/textbus/components/table/table-selection-awareness-delegate.d.ts +15 -0
  40. package/bundles/textbus/components/table/table.component.d.ts +1 -1
  41. package/bundles/textbus/components/todolist/todolist.component.d.ts +1 -0
  42. package/bundles/textbus/components/video/video.component.d.ts +1 -1
  43. package/package.json +35 -11
@@ -4,5 +4,6 @@ export * from './hooks/block-transform';
4
4
  export * from './left-toolbar/insert-tool';
5
5
  export * from './left-toolbar/left-toolbar.plugin';
6
6
  export * from './left-toolbar/left-toolbar';
7
+ export * from './link-jump/link-jump';
7
8
  export * from './toolbar/toolbar.plugin';
8
9
  export * from './toolbar/toolbar';
@@ -1,11 +1,11 @@
1
1
  import { Props } from '@viewfly/core';
2
+ import { Slot } from '@textbus/core';
2
3
  import { HTMLAttributes } from '@viewfly/platform-browser';
3
4
  import { DropdownProps } from '../../components/dropdown/dropdown';
4
5
  export interface AttrToolProps extends Props {
5
6
  abreast?: DropdownProps['abreast'];
6
7
  style?: HTMLAttributes<HTMLElement>['style'];
7
- queryBefore?(): void;
8
- queryAfter?(): void;
8
+ slot?: Slot | null;
9
9
  applyBefore?(): void;
10
10
  }
11
11
  export declare function AttrTool(props: AttrToolProps): () => any;
@@ -1,11 +1,11 @@
1
1
  import { Props } from '@viewfly/core';
2
+ import { Slot } from '@textbus/core';
2
3
  import { HTMLAttributes } from '@viewfly/platform-browser';
3
4
  import { DropdownProps } from '../../components/dropdown/dropdown';
4
5
  export interface ColorToolProps extends Props {
5
6
  abreast?: DropdownProps['abreast'];
6
7
  style?: HTMLAttributes<HTMLElement>['style'];
7
- queryBefore?(): void;
8
- queryAfter?(): void;
8
+ slot?: Slot | null;
9
9
  applyBefore?(): void;
10
10
  }
11
11
  export declare function ColorTool(props: ColorToolProps): () => any;
@@ -1,6 +1,7 @@
1
1
  import { Slot } from '@textbus/core';
2
2
  export interface InsertToolProps {
3
3
  slot: Slot | null;
4
+ hideTitle?: boolean;
4
5
  replace?: boolean;
5
6
  }
6
7
  export declare function InsertTool(props: InsertToolProps): () => any;
@@ -0,0 +1,4 @@
1
+ export declare function LinkJump(): {
2
+ $portalHost: HTMLElement;
3
+ $render: () => import("@viewfly/core").ViewFlyNode<string | import("@viewfly/core").ComponentSetup<any>>;
4
+ };
@@ -2,4 +2,5 @@ export * from './components/_api';
2
2
  export * from './plugins/_api';
3
3
  export * from './services/_api';
4
4
  export * from './textbus/_api';
5
+ export * from './interfaces';
5
6
  export * from './editor';
@@ -1,3 +1,7 @@
1
+ import { Subject } from '@textbus/core';
1
2
  export declare class EditorService {
2
3
  hideInlineToolbar: boolean;
4
+ canShowLeftToolbar: boolean;
5
+ onLeftToolbarCanVisibleChange: Subject<void>;
6
+ changeLeftToolbarVisible(b: boolean): void;
3
7
  }
@@ -0,0 +1,14 @@
1
+ import { Slot } from '@textbus/core';
2
+ import { DynamicRef } from '@viewfly/core';
3
+ import { HTMLAttributes } from '@viewfly/platform-browser';
4
+ interface Props extends HTMLAttributes<unknown> {
5
+ slot: Slot;
6
+ /** 默认值为 div */
7
+ tag?: string;
8
+ class?: string;
9
+ renderEnv?: boolean;
10
+ elRef?: DynamicRef<HTMLElement>;
11
+ elKey?: number | string;
12
+ }
13
+ export declare function SlotRender(props: Props): () => any;
14
+ export {};
@@ -1,6 +1,9 @@
1
+ export * from './at/at.component';
2
+ export * from './at/at-component.view';
1
3
  export * from './blockqoute/blockquote.component';
2
4
  export * from './highlight-box/highlight-box.component';
3
5
  export * from './image/image.component';
6
+ export * from './katex/katex.component';
4
7
  export * from './list/list.component';
5
8
  export * from './paragraph/paragraph.component';
6
9
  export * from './root/root.component';
@@ -0,0 +1,6 @@
1
+ import { ViewComponentProps } from '@textbus/adapter-viewfly';
2
+ import { ComponentLoader } from '@textbus/platform-browser';
3
+ import { AtComponent } from './at.component';
4
+ import './at.component.scss';
5
+ export declare function AtComponentView(props: ViewComponentProps<AtComponent>): () => any;
6
+ export declare const atComponentLoader: ComponentLoader;
@@ -0,0 +1,35 @@
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Subject, Textbus } from '@textbus/core';
2
+ export interface Member {
3
+ /** 头像 url */
4
+ avatar: string;
5
+ /** 成员名称 */
6
+ name: string;
7
+ /** 成员 id */
8
+ id: string;
9
+ /** 成员所属群组名 */
10
+ groupName: string;
11
+ /** 成员所属群组 id */
12
+ groupId: string;
13
+ /** 成员背景色 */
14
+ color?: string;
15
+ }
16
+ export declare abstract class Organization {
17
+ abstract getMembers(name?: string): Promise<Member[]>;
18
+ abstract getMemberById(id: string): Promise<Member | null>;
19
+ }
20
+ export interface AtComponentState {
21
+ userInfo?: Member;
22
+ slot?: Slot;
23
+ }
24
+ export declare function registerAtShortcut(textbus: Textbus): void;
25
+ export declare class AtComponent extends Component<AtComponentState> {
26
+ static componentName: string;
27
+ static type: ContentType;
28
+ static fromJSON(textbus: Textbus, { slot: slotState, userInfo }: ComponentStateLiteral<AtComponentState>): AtComponent;
29
+ focus: Subject<boolean>;
30
+ members: import("@viewfly/core").Signal<Member[]>;
31
+ selectedIndex: import("@viewfly/core").Signal<number>;
32
+ constructor(textbus: Textbus, state?: AtComponentState);
33
+ getSlots(): Slot[];
34
+ setup(): void;
35
+ }
@@ -1,4 +1,4 @@
1
- import { Component, ContentType, Slot, ComponentStateLiteral, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
2
2
  import { ComponentLoader } from '@textbus/platform-browser';
3
3
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
4
4
  import './blockquote.component.scss';
@@ -11,7 +11,10 @@ export declare class BlockquoteComponent extends Component<BlockquoteComponentSt
11
11
  static zenCoding: ZenCodingGrammarInterceptor<BlockquoteComponentState>;
12
12
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<BlockquoteComponentState>): BlockquoteComponent;
13
13
  constructor(textbus: Textbus, state?: BlockquoteComponentState);
14
+ getSlots(): Slot[];
14
15
  setup(): void;
15
16
  }
17
+ export declare function toBlockquote(textbus: Textbus): void;
18
+ export declare function registerBlockquoteShortcut(textbus: Textbus): void;
16
19
  export declare function BlockquoteView(props: ViewComponentProps<BlockquoteComponent>): () => any;
17
20
  export declare const blockquoteComponentLoader: ComponentLoader;
@@ -12,6 +12,7 @@ export declare class HighlightBoxComponent extends Component<HighlightBoxCompone
12
12
  static type: ContentType;
13
13
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<HighlightBoxComponentState>): HighlightBoxComponent;
14
14
  constructor(textbus: Textbus, state?: HighlightBoxComponentState);
15
+ getSlots(): Slot[];
15
16
  setup(): void;
16
17
  }
17
18
  export declare function HighlightBoxView(props: ViewComponentProps<HighlightBoxComponent>): () => any;
@@ -1,4 +1,4 @@
1
- import { Component, ComponentStateLiteral, ContentType, Textbus } from '@textbus/core';
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Textbus } from '@textbus/core';
2
2
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
3
3
  import { ComponentLoader } from '@textbus/platform-browser';
4
4
  import './image.component.scss';
@@ -11,6 +11,7 @@ export declare class ImageComponent extends Component<ImageComponentState> {
11
11
  static type: ContentType;
12
12
  static componentName: string;
13
13
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<ImageComponentState>): ImageComponent;
14
+ getSlots(): Slot[];
14
15
  }
15
16
  export declare function ImageView(props: ViewComponentProps<ImageComponent>): () => any;
16
17
  export declare const imageComponentLoader: ComponentLoader;
@@ -0,0 +1,7 @@
1
+ import { Subject, Textbus } from '@textbus/core';
2
+ export declare class KatexEditor extends Textbus {
3
+ host: HTMLElement;
4
+ onValueChange: Subject<string>;
5
+ constructor();
6
+ mount(host: HTMLElement, code: string): Promise<this>;
7
+ }
@@ -0,0 +1,16 @@
1
+ import { Component, ComponentStateLiteral, ContentType, Slot, Textbus } from '@textbus/core';
2
+ import { ViewComponentProps } from '@textbus/adapter-viewfly';
3
+ import { ComponentLoader } from '@textbus/platform-browser';
4
+ import './katex.component.scss';
5
+ export interface KatexComponentState {
6
+ text: string;
7
+ }
8
+ export declare class KatexComponent extends Component<KatexComponentState> {
9
+ static componentName: string;
10
+ static type: ContentType;
11
+ static fromJSON(textbus: Textbus, state: ComponentStateLiteral<KatexComponentState>): KatexComponent;
12
+ constructor(textbus: Textbus, state?: KatexComponentState);
13
+ getSlots(): Slot[];
14
+ }
15
+ export declare function KatexComponentView(props: ViewComponentProps<KatexComponent>): () => any;
16
+ export declare const katexComponentLoader: ComponentLoader;
@@ -7,11 +7,14 @@ export interface ListComponentState {
7
7
  slot: Slot;
8
8
  reorder: boolean;
9
9
  }
10
+ export declare function toList(textbus: Textbus, type: 'OrderedList' | 'UnorderedList'): void;
11
+ export declare function registerListShortcut(textbus: Textbus): void;
10
12
  export declare class ListComponent extends Component<ListComponentState> {
11
13
  static componentName: string;
12
14
  static type: ContentType;
13
15
  static zenCoding: ZenCodingGrammarInterceptor<ListComponentState>;
14
16
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<ListComponentState>): ListComponent;
17
+ getSlots(): Slot[];
15
18
  setup(): void;
16
19
  }
17
20
  export declare function ListComponentView(props: ViewComponentProps<ListComponent>): () => any;
@@ -10,6 +10,7 @@ export declare class ParagraphComponent extends Component<ParagraphComponentStat
10
10
  static type: ContentType;
11
11
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<ParagraphComponentState>): ParagraphComponent;
12
12
  constructor(textbus: Textbus, state?: ParagraphComponentState);
13
+ getSlots(): Slot[];
13
14
  setup(): void;
14
15
  }
15
16
  export declare function ParagraphView(props: ViewComponentProps<ParagraphComponent>): () => any;
@@ -10,7 +10,9 @@ export declare class RootComponent extends Component<RootComponentState> {
10
10
  static type: ContentType;
11
11
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<RootComponentState>): RootComponent;
12
12
  onCompositionStart: Subject<Event<Slot, CompositionStartEventData>>;
13
+ getSlots(): Slot[];
13
14
  setup(): void;
15
+ afterCheck(): void;
14
16
  }
15
17
  export declare function RootView(props: ViewComponentProps<RootComponent>): () => any;
16
18
  export declare const rootComponentLoader: ComponentLoader;
@@ -1,4 +1,4 @@
1
- import { ComponentStateLiteral, BehaviorSubject, Component, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
1
+ import { BehaviorSubject, Component, ComponentStateLiteral, ContentType, Slot, Textbus, ZenCodingGrammarInterceptor } from '@textbus/core';
2
2
  import { ComponentLoader } from '@textbus/platform-browser';
3
3
  import { ViewComponentProps } from '@textbus/adapter-viewfly';
4
4
  import './source-code.component.scss';
@@ -27,6 +27,7 @@ export declare class SourceCodeComponent extends Component<SourceCodeComponentSt
27
27
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<SourceCodeComponentState>): SourceCodeComponent;
28
28
  static zenCoding: ZenCodingGrammarInterceptor<SourceCodeComponentState>;
29
29
  focus: BehaviorSubject<boolean>;
30
+ getSlots(): Slot[];
30
31
  setup(): void;
31
32
  removeSlot(slot: Slot): boolean;
32
33
  cancelEmphasize: () => void;
@@ -1,8 +1,9 @@
1
- import { StaticRef } from '@viewfly/core';
1
+ import { Signal, StaticRef } from '@viewfly/core';
2
2
  import { TableComponent } from '../table.component';
3
3
  export interface ResizeColumnProps {
4
4
  tableRef: StaticRef<HTMLTableElement>;
5
5
  component: TableComponent;
6
+ layoutWidth: Signal<number[]>;
6
7
  onActiveStateChange(isActive: boolean): void;
7
8
  }
8
9
  export declare function ResizeColumn(props: ResizeColumnProps): () => any;
@@ -1,6 +1,5 @@
1
- import { Props, Signal, StaticRef } from '@viewfly/core';
1
+ import { Props, Signal } from '@viewfly/core';
2
2
  export interface ScrollProps extends Props {
3
3
  isFocus: Signal<boolean>;
4
- scrollRef: StaticRef<HTMLDivElement>;
5
4
  }
6
5
  export declare function Scroll(props: ScrollProps): () => any;
@@ -1,8 +1,8 @@
1
- import { Signal, StaticRef } from '@viewfly/core';
1
+ import { Signal } from '@viewfly/core';
2
2
  import { TableComponent } from '../table.component';
3
3
  export interface TopBarProps {
4
4
  isFocus: Signal<boolean>;
5
5
  component: TableComponent;
6
- scrollRef: StaticRef<HTMLDivElement>;
6
+ layoutWidth: Signal<number[]>;
7
7
  }
8
8
  export declare function TopBar(props: TopBarProps): () => any;
@@ -0,0 +1,15 @@
1
+ import { CollaborateSelectionAwarenessDelegate, DomAdapter } from '@textbus/platform-browser';
2
+ import { AbstractSelection, Slot, Selection } from '@textbus/core';
3
+ import { TableComponent } from './table.component';
4
+ export declare function findFocusCell(table: TableComponent, slot: Slot): Slot | null;
5
+ export declare class TableSelectionAwarenessDelegate extends CollaborateSelectionAwarenessDelegate {
6
+ private domAdapter;
7
+ private selection;
8
+ constructor(domAdapter: DomAdapter, selection: Selection);
9
+ getRects(abstractSelection: AbstractSelection): false | {
10
+ left: number;
11
+ top: number;
12
+ width: number;
13
+ height: number;
14
+ }[];
15
+ }
@@ -21,8 +21,8 @@ export declare class TableComponent extends Component<TableComponentState> {
21
21
  constructor(textbus: Textbus, state?: TableComponentState);
22
22
  focus: Subject<boolean>;
23
23
  tableSelection: import("@viewfly/core").Signal<TableSelection | null>;
24
+ getSlots(): Slot[];
24
25
  setup(): void;
25
- afterContentCheck(): void;
26
26
  deleteColumn(index: number): void;
27
27
  deleteRow(index: number): void;
28
28
  insertColumn(index: number): void;
@@ -11,6 +11,7 @@ export declare class TodolistComponent extends Component<TodolistComponentState>
11
11
  static componentName: string;
12
12
  static zenCoding: ZenCodingGrammarInterceptor<TodolistComponentState>;
13
13
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<TodolistComponentState>): TodolistComponent;
14
+ getSlots(): Slot[];
14
15
  setup(): void;
15
16
  }
16
17
  export declare function TodolistView(props: ViewComponentProps<TodolistComponent>): () => any;
@@ -11,7 +11,7 @@ export declare class VideoComponent extends Component<VideoComponentState> {
11
11
  static type: ContentType;
12
12
  static componentName: string;
13
13
  static fromJSON(textbus: Textbus, json: ComponentStateLiteral<VideoComponentState>): VideoComponent;
14
- setup(): void;
14
+ getSlots(): never[];
15
15
  }
16
16
  export declare function VideoView(props: ViewComponentProps<VideoComponent>): () => any;
17
17
  export declare const videoComponentLoader: ComponentLoader;
package/package.json CHANGED
@@ -1,10 +1,22 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.0.1-alpha.8",
4
- "description": "Viewfly project.",
3
+ "version": "0.0.1",
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",
7
7
  "types": "./bundles/public-api.d.ts",
8
+ "keywords": [
9
+ "textbus",
10
+ "xnote",
11
+ "富文本编辑器",
12
+ "wysiwyg",
13
+ "wysiwyg editor",
14
+ "rich text editor",
15
+ "editor",
16
+ "html editor",
17
+ "web editor",
18
+ "collaborate"
19
+ ],
8
20
  "scripts": {
9
21
  "start": "webpack-dev-server",
10
22
  "serve": "npx y-websocket HOST=localhost PORT=1234 ",
@@ -14,16 +26,17 @@
14
26
  "test": "echo \"Error: no test specified\" && exit 1"
15
27
  },
16
28
  "dependencies": {
17
- "@textbus/adapter-viewfly": "^4.0.0-alpha.45",
18
- "@textbus/collaborate": "^4.0.0-alpha.45",
19
- "@textbus/core": "^4.0.0-alpha.45",
20
- "@textbus/platform-browser": "^4.0.0-alpha.45",
21
- "@viewfly/core": "^1.0.0-alpha.2",
22
- "@viewfly/hooks": "^1.0.0-alpha.2",
23
- "@viewfly/platform-browser": "^1.0.0-alpha.2",
24
- "@viewfly/scoped-css": "^1.0.0-alpha.2",
29
+ "@tanbo/color": "^0.1.1",
30
+ "@textbus/adapter-viewfly": "^4.0.0",
31
+ "@textbus/collaborate": "^4.0.0",
32
+ "@textbus/core": "^4.0.0",
33
+ "@textbus/platform-browser": "^4.0.0",
34
+ "@viewfly/core": "^1.0.0-alpha.22",
35
+ "@viewfly/hooks": "^1.0.0-alpha.22",
36
+ "@viewfly/platform-browser": "^1.0.0-alpha.22",
37
+ "@viewfly/scoped-css": "^1.0.0-alpha.22",
25
38
  "highlight.js": "^11.9.0",
26
- "reflect-metadata": "^0.1.13"
39
+ "katex": "^0.16.10"
27
40
  },
28
41
  "devDependencies": {
29
42
  "@babel/core": "^7.16.5",
@@ -65,5 +78,16 @@
65
78
  "webpack": "^5.65.0",
66
79
  "webpack-cli": "^4.10.0",
67
80
  "webpack-dev-server": "^4.7.1"
81
+ },
82
+ "author": {
83
+ "name": "Tanbo",
84
+ "email": "tanbohb@qq.com"
85
+ },
86
+ "bugs": {
87
+ "url": "https://github.com/textbus/xnote.git/issues"
88
+ },
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "https://github.com/textbus/xnote.git"
68
92
  }
69
93
  }