@wangeditor-next/yjs 0.1.2 → 0.1.3

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.
@@ -1,29 +1,29 @@
1
1
  import type { Descendant, Editor, Element, Node } from 'slate';
2
2
  import type Y from 'yjs';
3
- export declare type DeltaAttributes = {
3
+ export type DeltaAttributes = {
4
4
  retain: number;
5
5
  attributes: Record<string, unknown>;
6
6
  };
7
- export declare type DeltaRetain = {
7
+ export type DeltaRetain = {
8
8
  retain: number;
9
9
  };
10
- export declare type DeltaDelete = {
10
+ export type DeltaDelete = {
11
11
  delete: number;
12
12
  };
13
- export declare type DeltaInsert = {
13
+ export type DeltaInsert = {
14
14
  insert: string | Y.XmlText;
15
15
  attributes?: Record<string, unknown>;
16
16
  };
17
- export declare type InsertDelta = Array<DeltaInsert>;
18
- export declare type Delta = Array<DeltaRetain | DeltaDelete | DeltaInsert | DeltaAttributes>;
19
- export declare type TextRange = {
17
+ export type InsertDelta = Array<DeltaInsert>;
18
+ export type Delta = Array<DeltaRetain | DeltaDelete | DeltaInsert | DeltaAttributes>;
19
+ export type TextRange = {
20
20
  start: number;
21
21
  end: number;
22
22
  };
23
- export declare type HistoryStackItem = {
23
+ export type HistoryStackItem = {
24
24
  meta: Map<string, unknown>;
25
25
  };
26
- export declare type YTarget = {
26
+ export type YTarget = {
27
27
  textRange: TextRange;
28
28
  yParent: Y.XmlText;
29
29
  slateParent: Element | Editor;
@@ -31,11 +31,11 @@ export declare type YTarget = {
31
31
  slateTarget?: Node;
32
32
  targetDelta: InsertDelta;
33
33
  };
34
- export declare type RelativeRange = {
34
+ export type RelativeRange = {
35
35
  anchor: Y.RelativePosition;
36
36
  focus: Y.RelativePosition;
37
37
  };
38
- export declare type NodeElement = {
38
+ export type NodeElement = {
39
39
  type: string;
40
40
  children: Descendant[];
41
41
  };
@@ -3,18 +3,18 @@ import { Awareness } from 'y-protocols/awareness';
3
3
  import * as Y from 'yjs';
4
4
  import { RelativeRange } from '../module/custom-types';
5
5
  import { YjsEditor } from './withYjs';
6
- export declare type CursorStateChangeEvent = {
6
+ export type CursorStateChangeEvent = {
7
7
  added: number[];
8
8
  updated: number[];
9
9
  removed: number[];
10
10
  };
11
- export declare type RemoteCursorChangeEventListener = (event: CursorStateChangeEvent) => void;
12
- export declare type CursorState<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
11
+ export type RemoteCursorChangeEventListener = (event: CursorStateChangeEvent) => void;
12
+ export type CursorState<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
13
13
  relativeSelection: RelativeRange | null;
14
14
  data?: TCursorData;
15
15
  clientId: number;
16
16
  };
17
- export declare type CursorEditor<TCursorData extends Record<string, unknown> = Record<string, unknown>> = YjsEditor & {
17
+ export type CursorEditor<TCursorData extends Record<string, unknown> = Record<string, unknown>> = YjsEditor & {
18
18
  awareness: Awareness;
19
19
  cursorDataField: string;
20
20
  selectionStateField: string;
@@ -25,12 +25,12 @@ export declare const CursorEditor: {
25
25
  isCursorEditor(value: unknown): value is CursorEditor<Record<string, unknown>>;
26
26
  sendCursorPosition<TCursorData extends Record<string, unknown>>(editor: CursorEditor<TCursorData>, range?: Range | null): void;
27
27
  sendCursorData<TCursorData_1 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_1>, data: TCursorData_1): void;
28
- on<TCursorData_2 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_2> | null, event: 'change', handler: RemoteCursorChangeEventListener): void;
28
+ on<TCursorData_2 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_2>, event: 'change', handler: RemoteCursorChangeEventListener): void;
29
29
  off<TCursorData_3 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_3>, event: 'change', listener: RemoteCursorChangeEventListener): void;
30
30
  cursorState<TCursorData_4 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_4>, clientId: number): CursorState<TCursorData_4> | null;
31
31
  cursorStates<TCursorData_5 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_5>): Record<string, CursorState<TCursorData_5>>;
32
32
  };
33
- export declare type WithCursorsOptions<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
33
+ export type WithCursorsOptions<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
34
34
  cursorStateField?: string;
35
35
  cursorDataField?: string;
36
36
  data?: TCursorData;
@@ -1,6 +1,6 @@
1
1
  import * as Y from 'yjs';
2
2
  import { YjsEditor } from './withYjs';
3
- export declare type YHistoryEditor = YjsEditor & {
3
+ export type YHistoryEditor = YjsEditor & {
4
4
  undoManager: Y.UndoManager;
5
5
  withoutSavingOrigin: unknown;
6
6
  undo: () => void;
@@ -13,7 +13,7 @@ export declare const YHistoryEditor: {
13
13
  isSaving(editor: YHistoryEditor): boolean;
14
14
  withoutSaving(editor: YHistoryEditor, fn: () => void): void;
15
15
  };
16
- export declare type WithYHistoryOptions = NonNullable<ConstructorParameters<typeof Y.UndoManager>[1]> & {
16
+ export type WithYHistoryOptions = NonNullable<ConstructorParameters<typeof Y.UndoManager>[1]> & {
17
17
  withoutSavingOrigin?: unknown;
18
18
  };
19
19
  export declare function withYHistory(options?: WithYHistoryOptions): <T extends YjsEditor>(editor: T) => T & import("slate").BaseEditor & {
@@ -1,11 +1,11 @@
1
1
  import { BaseEditor, Descendant, Operation, Point } from 'slate';
2
2
  import * as Y from 'yjs';
3
- declare type LocalChange = {
3
+ type LocalChange = {
4
4
  op: Operation;
5
5
  doc: Descendant[];
6
6
  origin: unknown;
7
7
  };
8
- export declare type YjsEditor = BaseEditor & {
8
+ export type YjsEditor = BaseEditor & {
9
9
  sharedRoot: Y.XmlText;
10
10
  localOrigin: unknown;
11
11
  positionStorageOrigin: unknown;
@@ -33,7 +33,7 @@ export declare const YjsEditor: {
33
33
  position(editor: YjsEditor, key: string): Point | null | undefined;
34
34
  storedPositionsRelative(editor: YjsEditor): Record<string, Y.RelativePosition>;
35
35
  };
36
- export declare type WithYjsOptions = {
36
+ export type WithYjsOptions = {
37
37
  autoConnect?: boolean;
38
38
  localOrigin?: unknown;
39
39
  positionStorageOrigin?: unknown;
@@ -1,9 +1,9 @@
1
- declare type InspectableObject = Record<string | number | symbol, unknown>;
1
+ type InspectableObject = Record<string | number | symbol, unknown>;
2
2
  export declare function isPlainObject(o: unknown): o is InspectableObject;
3
3
  export declare function deepEquals(node: InspectableObject, another: InspectableObject): boolean;
4
- export declare function pick<TObj, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Pick<TObj, TKeys>;
5
- export declare function omit<TObj, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Omit<TObj, TKeys>;
6
- export declare function omitNullEntries<TObj>(obj: TObj): {
4
+ export declare function pick<TObj extends Object, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Pick<TObj, TKeys>;
5
+ export declare function omit<TObj extends Object, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Omit<TObj, TKeys>;
6
+ export declare function omitNullEntries<TObj extends Object>(obj: TObj): {
7
7
  [K in keyof TObj]: TObj[K] extends null ? never : K;
8
8
  };
9
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangeditor-next/yjs",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "author": "cycleccc <2991205548@qq.com>",
5
5
  "contributors": [],
6
6
  "description": "Yjs binding for wangeditor-next.",
@@ -48,7 +48,7 @@
48
48
  "size-stats": "cross-env NODE_ENV=production:size_stats rollup -c rollup.config.js"
49
49
  },
50
50
  "peerDependencies": {
51
- "@wangeditor-next/core": "1.x",
51
+ "@wangeditor-next/core": "1.7.5",
52
52
  "slate": "^0.72.0",
53
53
  "yjs": "^13.5.29"
54
54
  },