@kerebron/extension-yjs 0.4.25 → 0.4.27

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,102 +0,0 @@
1
- import * as Y from 'yjs';
2
- import * as PModel from 'prosemirror-model';
3
- import { MarkType, Node, Schema } from 'prosemirror-model';
4
- import { EditorState } from 'prosemirror-state';
5
- import { EditorView } from 'prosemirror-view';
6
- export type TransactFunc<T> = (f: (arg0?: Y.Transaction) => T, origin?: any) => T;
7
- export interface BindingMetadata {
8
- mapping: ProsemirrorMapping;
9
- isOMark: Map<MarkType, boolean>;
10
- }
11
- export declare const isVisible: (item: Y.Item, snapshot: Y.Snapshot) => boolean;
12
- type ProsemirrorMapping = Map<Y.AbstractType<any>, PModel.Node | Array<PModel.Node>>;
13
- interface ColorDef {
14
- light: string;
15
- dark: string;
16
- }
17
- interface YSyncOpts {
18
- colors?: Array<ColorDef>;
19
- colorMapping?: Map<string, ColorDef>;
20
- permanentUserData?: Y.PermanentUserData | null;
21
- mapping?: ProsemirrorMapping;
22
- onFirstRender?: () => void;
23
- }
24
- /**
25
- * This plugin listens to changes in prosemirror view and keeps yXmlState and view in sync.
26
- *
27
- * This plugin also keeps references to the type and the shared document so other plugins can access it.
28
- */
29
- export declare const ySyncPlugin: (yXmlFragment: Y.XmlFragment, { colors, colorMapping, permanentUserData, onFirstRender, mapping, }?: YSyncOpts) => any;
30
- interface TransactionSelection {
31
- type: string;
32
- anchor: Y.RelativePosition;
33
- head: Y.RelativePosition;
34
- }
35
- export declare const getRelativeSelection: (pmbinding: ProsemirrorBinding, state: EditorState) => TransactionSelection;
36
- interface PluginState {
37
- addToHistory: boolean;
38
- isChangeOrigin: boolean;
39
- restore: any;
40
- snapshot?: Y.Snapshot;
41
- prevSnapshot?: Y.Snapshot;
42
- isUndoRedoOperation: boolean;
43
- colors: Array<ColorDef>;
44
- colorMapping: Map<string, ColorDef>;
45
- permanentUserData: Y.PermanentUserData;
46
- }
47
- /**
48
- * Binding for prosemirror.
49
- *
50
- * @protected
51
- */
52
- export declare class ProsemirrorBinding implements BindingMetadata {
53
- mapping: ProsemirrorMapping;
54
- ydoc: Y.Doc;
55
- isOMark: Map<MarkType, boolean>;
56
- type: Y.XmlFragment;
57
- private mux;
58
- prosemirrorView: EditorView | null;
59
- private _beforeTransactionSelection;
60
- private beforeAllTransactions;
61
- private afterAllTransactions;
62
- private _observeFunction;
63
- private _domSelectionInView;
64
- get beforeTransactionSelection(): TransactionSelection;
65
- set beforeTransactionSelection(value: TransactionSelection);
66
- constructor(yXmlFragment: Y.XmlFragment, mapping?: ProsemirrorMapping);
67
- debug(msg?: string): void;
68
- _isLocalCursorInView(): boolean;
69
- _isDomSelectionInView(): boolean;
70
- renderSnapshot(snapshot: Y.Snapshot, prevSnapshot: Y.Snapshot): void;
71
- unrenderSnapshot(): void;
72
- _forceRerender(): void;
73
- _renderSnapshot(snapshot: Y.Snapshot | Uint8Array, prevSnapshot: Y.Snapshot | Uint8Array, pluginState: PluginState): void;
74
- yXmlChanged(events: Array<Y.YEvent<any>>, transaction: Y.Transaction): void;
75
- _prosemirrorChanged(doc: Node): void;
76
- /**
77
- * View is ready to listen to changes. Register observers.
78
- */
79
- initView(prosemirrorView: any): void;
80
- destroy(): void;
81
- }
82
- export declare const createNodeFromYElement: (el: Y.XmlElement, schema: any, meta: BindingMetadata, snapshot?: Y.Snapshot, prevSnapshot?: Y.Snapshot, computeYChange?: (arg0: "removed" | "added", arg1: Y.ID) => any) => PModel.Node | null;
83
- export declare const yattr2markname: (attrName: string) => string;
84
- /**
85
- * @todo move this to markstoattributes
86
- */
87
- export declare const attributesToMarks: (attrs: {
88
- [s: string]: any;
89
- }, schema: Schema) => PModel.Mark[];
90
- /**
91
- * Update a yDom node by syncing the current content of the prosemirror node.
92
- *
93
- * This is a y-prosemirror internal feature that you can use at your own risk.
94
- *
95
- * @private
96
- * @unstable
97
- */
98
- export declare const updateYFragment: (y: {
99
- transact: TransactFunc<void>;
100
- }, yDomFragment: Y.XmlFragment, pNode: Node, meta: BindingMetadata) => void;
101
- export {};
102
- //# sourceMappingURL=ySyncPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ySyncPlugin.d.ts","sourceRoot":"","sources":["../src/ySyncPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAS5C,OAAO,EAAQ,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqB9C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAC5B,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,KAAK,CAAC,EAC9B,MAAM,CAAC,EAAE,GAAG,KACT,CAAC,CAAC;AAEP,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,QAAQ,YAKnB,CAAC;AAE1C,KAAK,kBAAkB,GAAG,GAAG,CAC3B,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,EACnB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CACjC,CAAC;AAEF,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC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