@milkdown/vue 6.1.5 → 6.3.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/lib/Editor.d.ts CHANGED
@@ -1,28 +1,13 @@
1
- import { Ctx, Editor } from '@milkdown/core';
2
- import { ViewFactory } from '@milkdown/prose';
3
- import { ComponentInternalInstance, DefineComponent, Ref } from 'vue';
4
- import { AnyVueComponent } from './utils';
5
- import { RenderOptions } from './VueNodeView';
6
- export declare type RenderVue = (Component: AnyVueComponent, options?: RenderOptions) => (ctx: Ctx) => ViewFactory;
7
- export declare type GetEditor = (container: HTMLDivElement, renderVue: RenderVue) => Editor;
8
- export declare const EditorComponent: DefineComponent<{
9
- editor: GetEditor;
10
- editorRef?: Ref<EditorRef> | undefined;
11
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
12
- editor: GetEditor;
13
- editorRef?: Ref<EditorRef> | undefined;
14
- }>, {}>;
15
- export declare type EditorRef = {
16
- get: () => Editor | undefined;
17
- dom: () => HTMLDivElement | null;
18
- };
1
+ import { ComponentInternalInstance, DefineComponent, InjectionKey } from 'vue';
2
+ import { EditorRef } from './EditorComponent';
3
+ import { EditorInfo, EditorInfoCtx } from './types';
19
4
  export declare const getRootInstance: () => ComponentInternalInstance | null;
5
+ export declare const editorInfoCtxKey: InjectionKey<EditorInfoCtx>;
20
6
  export declare const VueEditor: DefineComponent<{
21
- editor: GetEditor;
22
- editorRef?: Ref<EditorRef> | undefined;
7
+ editor: EditorInfo;
8
+ editorRef?: EditorRef | undefined;
23
9
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
24
- editor: GetEditor;
25
- editorRef?: Ref<EditorRef> | undefined;
10
+ editor: EditorInfo;
11
+ editorRef?: EditorRef | undefined;
26
12
  }>, {}>;
27
- export declare const useEditor: (getEditor: GetEditor) => (container: HTMLDivElement, renderVue: RenderVue) => Editor;
28
13
  //# sourceMappingURL=Editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,EAA0B,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACH,yBAAyB,EACzB,eAAe,EAWf,GAAG,EAGN,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,oBAAY,SAAS,GAAG,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,WAAW,CAAC;AAC3G,oBAAY,SAAS,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC;AAiCpF,eAAO,MAAM,eAAe;YAA6B,SAAS;;;YAAT,SAAS;;OAahE,CAAC;AAGH,oBAAY,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,cAAc,GAAG,IAAI,CAAA;CAAE,CAAC;AAO5F,eAAO,MAAM,eAAe,wCAE3B,CAAC;AAGF,eAAO,MAAM,SAAS;YAA6B,SAAS;;;YAAT,SAAS;;OAmC1D,CAAC;AAGH,eAAO,MAAM,SAAS,cAAe,SAAS,gEAE7C,CAAC"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AACA,OAAO,EACH,yBAAyB,EACzB,eAAe,EAKf,YAAY,EAMf,MAAM,KAAK,CAAC;AAEb,OAAO,EAAmB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AASpD,eAAO,MAAM,eAAe,wCAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAAY,CAAC;AA4BtE,eAAO,MAAM,SAAS;YAA6B,UAAU;;;YAAV,UAAU;;OA0D3D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Editor } from '@milkdown/core';
2
+ import { GetEditor } from './types';
3
+ export declare const EditorComponent: import("vue").DefineComponent<{
4
+ editor: GetEditor;
5
+ editorRef?: EditorRef | undefined;
6
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
7
+ editor: GetEditor;
8
+ editorRef?: EditorRef | undefined;
9
+ }>, {}>;
10
+ export declare type EditorRef = {
11
+ get: () => Editor | undefined;
12
+ dom: () => HTMLDivElement | null;
13
+ };
14
+ //# sourceMappingURL=EditorComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorComponent.d.ts","sourceRoot":"","sources":["../src/EditorComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,eAAe;YAA6B,SAAS;;;YAAT,SAAS;;OAahE,CAAC;AAGH,oBAAY,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,cAAc,GAAG,IAAI,CAAA;CAAE,CAAC"}
package/lib/VueNode.d.ts CHANGED
@@ -1,18 +1,20 @@
1
1
  import { Ctx } from '@milkdown/core';
2
2
  import { Mark, Node } from '@milkdown/prose/model';
3
3
  import { Decoration, EditorView } from '@milkdown/prose/view';
4
- import { InjectionKey } from 'vue';
5
- export declare type NodeContext = {
4
+ import { InjectionKey, Ref } from 'vue';
5
+ export declare type NodeContext<T extends Node | Mark = Node | Mark> = {
6
6
  ctx: Ctx;
7
- node: Node | Mark;
7
+ node: Ref<T>;
8
8
  view: EditorView;
9
- getPos: boolean | (() => number);
10
- decorations: Decoration[];
9
+ getPos: T extends Mark ? boolean : T extends Node ? () => number : boolean | (() => number);
10
+ decorations: Ref<readonly Decoration[]>;
11
11
  };
12
12
  export declare const nodeMetadata: InjectionKey<NodeContext>;
13
- export declare const VueNodeContainer: import("vue").DefineComponent<NodeContext & {
13
+ export declare type UseNodeCtx = <T extends Node | Mark = Node | Mark>() => NodeContext<T>;
14
+ export declare const useNodeCtx: UseNodeCtx;
15
+ export declare const VueNodeContainer: import("vue").DefineComponent<NodeContext<Mark | Node> & {
14
16
  as: string;
15
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NodeContext & {
17
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NodeContext<Mark | Node> & {
16
18
  as: string;
17
19
  }>, {}>;
18
20
  export declare const Content: import("vue").DefineComponent<{
@@ -1 +1 @@
1
- {"version":3,"file":"VueNode.d.ts","sourceRoot":"","sources":["../src/VueNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB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AAY,CAAC;AAEhE,oBAAY,UAAU,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AACnF,eAAO,MAAM,UAAU,EAAE,UAA6D,CAAC;AAEvF,eAAO,MAAM,gBAAgB;QAAuC,MAAM;;QAAN,MAAM;OAYxE,CAAC;AAGH,eAAO,MAAM,OAAO;;;;OAKlB,CAAC"}
@@ -1,36 +1,34 @@
1
1
  import { Ctx } from '@milkdown/core';
2
- import type { ViewFactory } from '@milkdown/prose';
3
2
  import { Mark, Node } from '@milkdown/prose/model';
4
- import type { Decoration, DecorationSet, EditorView, NodeView } from '@milkdown/prose/view';
3
+ import type { Decoration, DecorationSource, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from '@milkdown/prose/view';
5
4
  import { DefineComponent } from 'vue';
6
5
  export declare type RenderOptions = Partial<{
7
6
  as: string;
8
- } & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy' | 'update'>>;
9
- export declare const createVueView: (addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void) => (component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => ViewFactory;
7
+ update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
8
+ } & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>>;
9
+ export declare const createVueView: (addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void) => (component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => NodeViewConstructor | MarkViewConstructor;
10
10
  export declare class VueNodeView implements NodeView {
11
11
  private ctx;
12
12
  private component;
13
13
  private addPortal;
14
14
  private removePortalByKey;
15
15
  private options;
16
- private node;
17
16
  private view;
18
17
  private getPos;
19
- private decorations;
20
18
  teleportDOM: HTMLElement;
21
19
  key: string;
22
20
  get isInlineOrMark(): boolean;
23
- constructor(ctx: Ctx, component: DefineComponent, addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void, options: RenderOptions, node: Node | Mark, view: EditorView, getPos: boolean | (() => number), decorations: Decoration[]);
24
- get dom(): Element;
25
- get contentDOM(): Element | null;
21
+ private node;
22
+ private decorations;
23
+ constructor(ctx: Ctx, component: DefineComponent, addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void, options: RenderOptions, node: Node | Mark, view: EditorView, getPos: boolean | (() => number), decorations: readonly Decoration[]);
24
+ get dom(): HTMLElement;
25
+ get contentDOM(): HTMLElement | undefined;
26
+ getPortal: () => DefineComponent;
26
27
  renderPortal(): void;
27
28
  destroy(): void;
28
- ignoreMutation(mutation: MutationRecord | {
29
- type: 'selection';
30
- target: Element;
31
- }): boolean;
32
- update(node: Node, decorations: Decoration[], innerDecorations: DecorationSet): boolean;
33
- selectNode: (() => void) | null | undefined;
34
- deselectNode: (() => void) | null | undefined;
29
+ ignoreMutation(mutation: MutationRecord): boolean;
30
+ update(node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource): boolean;
31
+ selectNode: (() => void) | undefined;
32
+ deselectNode: (() => void) | undefined;
35
33
  }
36
34
  //# sourceMappingURL=VueNodeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VueNodeView.d.ts","sourceRoot":"","sources":["../src/VueNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAyC,MAAM,KAAK,CAAC;AAO7E,oBAAY,aAAa,GAAG,OAAO,CAC/B;IACI,EAAE,EAAE,MA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;gBAGpC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,EACzD,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACxC,OAAO,EAAE,aAAa,EAC9B,IAAI,EAAE,IAAI,GAAG,IAAI,EACT,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,EACxC,WAAW,EAAE,SAAS,UAAU,EAAE;IAUtC,IAAI,GAAG,gBAEN;IAED,IAAI,UAAU,4BAMb;IAED,SAAS,QAAO,eAAe,CA0B7B;IAEF,YAAY;IAWZ,OAAO;IAMP,cAAc,CAAC,QAAQ,EAAE,cAAc;IA6BvC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,gBAAgB,EAAE,gBAAgB;IA0BzF,UAAU,2BAA4B;IAEtC,YAAY,2BAA8B;CAC7C"}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './Editor';
2
- export { nodeMetadata } from './VueNode';
2
+ export * from './types';
3
+ export * from './useEditor';
4
+ export * from './VueNode';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}