plitejs 0.0.1 → 54.0.0-beta.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.
- package/LICENSE +4 -1
- package/README.md +83 -0
- package/dist/annotation-store-metrics-Ccjkef45.js +12 -0
- package/dist/annotations/index.d.ts +2 -0
- package/dist/annotations/index.js +2 -0
- package/dist/authored/index.d.ts +596 -0
- package/dist/authored/index.js +18558 -0
- package/dist/authored-veto-DSnQcHGR.js +6 -0
- package/dist/browser-protocol-pvt4HFF7.js +5 -0
- package/dist/comparison-plan-CEQL0ooW.js +1338 -0
- package/dist/comparison-types-Dt-unJZY.d.ts +179 -0
- package/dist/create-editor-CkHtPWXV.js +1107 -0
- package/dist/diff/index.d.ts +32 -0
- package/dist/diff/index.js +1748 -0
- package/dist/dom/index.d.ts +2 -0
- package/dist/dom/index.js +2 -0
- package/dist/dom-Cgfscvnm.js +9220 -0
- package/dist/editor-owner-IUmkTeXz.js +171 -0
- package/dist/editor-view-lifetime-GJKa_QGh.js +23 -0
- package/dist/history/index.d.ts +170 -0
- package/dist/history/index.js +6718 -0
- package/dist/hyperscript/index.d.ts +2 -0
- package/dist/hyperscript/index.js +2 -0
- package/dist/hyperscript-FPuoArEi.js +299 -0
- package/dist/index-BpQx2UG4.d.ts +1093 -0
- package/dist/index-Cw-oC2ps.d.ts +190 -0
- package/dist/index-DPWyk3lG.d.ts +65 -0
- package/dist/index-DpltOCot.d.ts +9753 -0
- package/dist/index-HPYawTae.d.ts +119 -0
- package/dist/index-K0Za9YXc.d.ts +1246 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +156 -0
- package/dist/mapped-view-store-ld-6uxEU.js +120 -0
- package/dist/native-grouping-input-DMNcsIaW.js +8 -0
- package/dist/pagination/index.d.ts +169 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/react.d.ts +33 -0
- package/dist/pagination/react.js +1509 -0
- package/dist/pagination-D_A8iPJP.js +1021 -0
- package/dist/plugin-DWzkJbnJ.js +50999 -0
- package/dist/range-geometry-BLAHRE11.d.ts +38 -0
- package/dist/range-geometry-BjeLHOnl.js +486 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +7 -0
- package/dist/react/virtualized.d.ts +13 -0
- package/dist/react/virtualized.js +209 -0
- package/dist/react-DZ15gmz2.js +1018 -0
- package/dist/retraction-BMem8Rfk.js +109 -0
- package/dist/src-cT1OTKP_.js +1386 -0
- package/dist/store-Cz2mXyDe.js +704 -0
- package/dist/testing/index.d.ts +183 -0
- package/dist/testing/index.js +96 -0
- package/dist/use-editor-dom-scope-BbMDSCpW.js +28354 -0
- package/dist/yjs/index.d.ts +2 -0
- package/dist/yjs/index.js +2 -0
- package/dist/yjs/react/index.d.ts +26 -0
- package/dist/yjs/react/index.js +85 -0
- package/dist/yjs-DOK-m7kl.js +13413 -0
- package/package.json +191 -43
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Zf as countCoreWork, u as destroyEditor, w as startEditor, wu as getEditorRuntimeOwner, x as releaseEditor } from "./plugin-DWzkJbnJ.js";
|
|
2
|
+
//#region src/core/same-result.ts
|
|
3
|
+
const MAX_VALUES = 100;
|
|
4
|
+
const MAX_DEPTH = 64;
|
|
5
|
+
let valuesLeft = 0;
|
|
6
|
+
const isEnumerable = (value, key) => Object.prototype.propertyIsEnumerable.call(value, key);
|
|
7
|
+
const isDataDescriptor = (descriptor) => descriptor !== void 0 && descriptor.get === void 0 && descriptor.set === void 0;
|
|
8
|
+
const ownsOnlyKeys = (value, count) => Reflect.ownKeys(value).length === count;
|
|
9
|
+
const marksReactElement = (key) => key === "$$typeof";
|
|
10
|
+
const marksDocumentNode = (key, value) => key === "text" && typeof value === "string" || key === "children" && Array.isArray(value);
|
|
11
|
+
const arePlainLists = (previous, next, length) => {
|
|
12
|
+
const entriesAndLength = length + 1;
|
|
13
|
+
if (!ownsOnlyKeys(previous, entriesAndLength) || !ownsOnlyKeys(next, entriesAndLength)) return false;
|
|
14
|
+
for (let index = 0; index < length; index++) if (!isEnumerable(next, index)) return false;
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
const sameList = (previous, next, depth) => {
|
|
18
|
+
const { length } = previous;
|
|
19
|
+
if (!Array.isArray(next) || length !== next.length) return false;
|
|
20
|
+
valuesLeft -= length;
|
|
21
|
+
if (valuesLeft < 0) return false;
|
|
22
|
+
if (Object.getPrototypeOf(previous) !== Array.prototype || Object.getPrototypeOf(next) !== Array.prototype) return false;
|
|
23
|
+
for (let index = 0; index < length; index++) {
|
|
24
|
+
const descriptor = Object.getOwnPropertyDescriptor(previous, index);
|
|
25
|
+
if (!isDataDescriptor(descriptor) || !descriptor.enumerable) return false;
|
|
26
|
+
const a = descriptor.value;
|
|
27
|
+
const b = next[index];
|
|
28
|
+
if (!Object.is(a, b) && !sameAt(a, b, depth + 1)) return false;
|
|
29
|
+
}
|
|
30
|
+
return arePlainLists(previous, next, length);
|
|
31
|
+
};
|
|
32
|
+
const sameAt = (previous, next, depth) => {
|
|
33
|
+
if (typeof previous !== "object" || typeof next !== "object" || previous === null || next === null || depth > MAX_DEPTH) return false;
|
|
34
|
+
if (Array.isArray(previous)) return sameList(previous, next, depth);
|
|
35
|
+
if (Array.isArray(next)) return false;
|
|
36
|
+
const prototype = Object.getPrototypeOf(previous);
|
|
37
|
+
if (prototype !== Object.prototype && prototype !== null || Object.getPrototypeOf(next) !== prototype) return false;
|
|
38
|
+
const keys = Object.keys(previous);
|
|
39
|
+
valuesLeft -= keys.length;
|
|
40
|
+
if (valuesLeft < 0) return false;
|
|
41
|
+
const nextFrozen = Object.isFrozen(next);
|
|
42
|
+
const frozen = nextFrozen || Object.isFrozen(previous);
|
|
43
|
+
let nested;
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const descriptor = Object.getOwnPropertyDescriptor(previous, key);
|
|
46
|
+
if (!isDataDescriptor(descriptor)) return false;
|
|
47
|
+
const a = descriptor.value;
|
|
48
|
+
if (marksReactElement(key) || frozen && marksDocumentNode(key, a)) return false;
|
|
49
|
+
let b;
|
|
50
|
+
if (nextFrozen) {
|
|
51
|
+
const nextDescriptor = Object.getOwnPropertyDescriptor(next, key);
|
|
52
|
+
if (!isDataDescriptor(nextDescriptor) || !nextDescriptor.enumerable) return false;
|
|
53
|
+
b = nextDescriptor.value;
|
|
54
|
+
} else {
|
|
55
|
+
if (!isEnumerable(next, key)) return false;
|
|
56
|
+
b = next[key];
|
|
57
|
+
}
|
|
58
|
+
if (Object.is(a, b)) continue;
|
|
59
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
60
|
+
nested ??= [];
|
|
61
|
+
nested.push(a, b);
|
|
62
|
+
}
|
|
63
|
+
if (nested !== void 0) {
|
|
64
|
+
for (let index = 0; index < nested.length; index += 2) if (!sameAt(nested[index], nested[index + 1], depth + 1)) return false;
|
|
65
|
+
}
|
|
66
|
+
return ownsOnlyKeys(previous, keys.length) && ownsOnlyKeys(next, keys.length);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Whether a selector's new result is the same as its earlier one, so the hook
|
|
70
|
+
* keeps the earlier result and skips the render.
|
|
71
|
+
*
|
|
72
|
+
* Lists and plain objects compare by their contents, with `Object.is` at every
|
|
73
|
+
* depth. A document node, a React element and any other object compare by
|
|
74
|
+
* identity. Every doubt answers "different", because that costs one render: a
|
|
75
|
+
* getter on the earlier result, a symbol or hidden key, a list that is not a
|
|
76
|
+
* plain list, a read that throws, and a result past 100 values or 64 levels.
|
|
77
|
+
* No getter of the earlier result runs, and no getter field of a frozen new
|
|
78
|
+
* plain object.
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
const sameResult = (previous, next) => {
|
|
83
|
+
if (Object.is(previous, next)) return true;
|
|
84
|
+
const outer = valuesLeft;
|
|
85
|
+
valuesLeft = MAX_VALUES;
|
|
86
|
+
try {
|
|
87
|
+
return sameAt(previous, next, 0);
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
} finally {
|
|
91
|
+
countCoreWork("selectorResultValues", MAX_VALUES - valuesLeft);
|
|
92
|
+
valuesLeft = outer;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/core/editor-owner.ts
|
|
97
|
+
const OWNERS = /* @__PURE__ */ new WeakMap();
|
|
98
|
+
const UNRELEASED_RETIREES = /* @__PURE__ */ new Set();
|
|
99
|
+
const release = (state) => {
|
|
100
|
+
UNRELEASED_RETIREES.delete(state);
|
|
101
|
+
if (state.released) return;
|
|
102
|
+
state.released = true;
|
|
103
|
+
releaseEditor(state.editor);
|
|
104
|
+
};
|
|
105
|
+
const destroy = (state) => {
|
|
106
|
+
release(state);
|
|
107
|
+
if (state.destroyed) return;
|
|
108
|
+
state.destroyed = true;
|
|
109
|
+
destroyEditor(state.editor);
|
|
110
|
+
};
|
|
111
|
+
const releaseRetirees = () => {
|
|
112
|
+
for (const retiree of [...UNRELEASED_RETIREES]) release(retiree);
|
|
113
|
+
};
|
|
114
|
+
const start = (state) => {
|
|
115
|
+
if (state.retired) return;
|
|
116
|
+
releaseRetirees();
|
|
117
|
+
startEditor(state.editor);
|
|
118
|
+
};
|
|
119
|
+
/** @internal */
|
|
120
|
+
const createEditorOwner = (createDormant) => {
|
|
121
|
+
const editor = createDormant();
|
|
122
|
+
const state = {
|
|
123
|
+
destroyed: false,
|
|
124
|
+
editor: getEditorRuntimeOwner(editor),
|
|
125
|
+
layout: false,
|
|
126
|
+
passive: false,
|
|
127
|
+
released: false,
|
|
128
|
+
retired: false,
|
|
129
|
+
startedByView: false
|
|
130
|
+
};
|
|
131
|
+
OWNERS.set(state.editor, state);
|
|
132
|
+
return Object.freeze({
|
|
133
|
+
editor,
|
|
134
|
+
layoutConnected: () => {
|
|
135
|
+
state.layout = true;
|
|
136
|
+
},
|
|
137
|
+
layoutDisconnected: () => {
|
|
138
|
+
state.layout = false;
|
|
139
|
+
if (state.retired) release(state);
|
|
140
|
+
},
|
|
141
|
+
passiveConnected: () => {
|
|
142
|
+
state.passive = true;
|
|
143
|
+
},
|
|
144
|
+
passiveDisconnected: () => {
|
|
145
|
+
state.passive = false;
|
|
146
|
+
if (state.retired) queueMicrotask(() => destroy(state));
|
|
147
|
+
},
|
|
148
|
+
retire: () => {
|
|
149
|
+
if (state.retired) return;
|
|
150
|
+
state.retired = true;
|
|
151
|
+
UNRELEASED_RETIREES.add(state);
|
|
152
|
+
queueMicrotask(() => {
|
|
153
|
+
if (state.layout) return;
|
|
154
|
+
release(state);
|
|
155
|
+
if (!state.passive) destroy(state);
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
startUnlessViewStarted: () => {
|
|
159
|
+
if (!state.startedByView) start(state);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
/** @internal */
|
|
164
|
+
const startOwnedEditor = (editor) => {
|
|
165
|
+
const state = OWNERS.get(getEditorRuntimeOwner(editor));
|
|
166
|
+
if (!state) return;
|
|
167
|
+
state.startedByView = true;
|
|
168
|
+
start(state);
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
171
|
+
export { startOwnedEditor as n, sameResult as r, createEditorOwner as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/core/editor-view-lifetime.ts
|
|
2
|
+
const viewCleanups = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const registerEditorViewLifetimeCleanup = (view, cleanup) => {
|
|
4
|
+
const cleanups = viewCleanups.get(view) ?? /* @__PURE__ */ new Set();
|
|
5
|
+
cleanups.add(cleanup);
|
|
6
|
+
viewCleanups.set(view, cleanups);
|
|
7
|
+
let active = true;
|
|
8
|
+
return () => {
|
|
9
|
+
if (!active) return;
|
|
10
|
+
active = false;
|
|
11
|
+
cleanups.delete(cleanup);
|
|
12
|
+
if (cleanups.size === 0) viewCleanups.delete(view);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const releaseEditorViewLifetime = (view) => {
|
|
16
|
+
const cleanups = viewCleanups.get(view);
|
|
17
|
+
if (!cleanups) return;
|
|
18
|
+
viewCleanups.delete(view);
|
|
19
|
+
for (const cleanup of cleanups) cleanup();
|
|
20
|
+
cleanups.clear();
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { releaseEditorViewLifetime as n, registerEditorViewLifetimeCleanup as t };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Am as TxOnlyMethod, Dc as Editor, Lm as DocumentChange, Om as TxDeclaredMethod, Qd as PluginTypeProvider, Qt as encodeEditorEffect, _a as CarriedRun, bf as Value, bt as encodeEditorSelection, fd as HistoryApi, ga as RootFactsJson, lo as EditorSchemaIdentity, nh as Selection, rl as EditorEffect, xd as Plugin } from "../index-DpltOCot.js";
|
|
2
|
+
//#region src/history/history.d.ts
|
|
3
|
+
interface Batch<_V extends Value = Value> {
|
|
4
|
+
/** Canonical change to apply when this batch is consumed. */
|
|
5
|
+
readonly change: DocumentChange;
|
|
6
|
+
/** Effects to emit when this batch is consumed. */
|
|
7
|
+
readonly effects: readonly EditorEffect[];
|
|
8
|
+
/** Selection after the original batch was applied. */
|
|
9
|
+
readonly selectionAfter: Selection;
|
|
10
|
+
/** Additional named root owning `selectionAfter`; omit for the primary root. */
|
|
11
|
+
readonly selectionAfterRoot?: string;
|
|
12
|
+
/** Selection before the original batch was applied. */
|
|
13
|
+
readonly selectionBefore: Selection;
|
|
14
|
+
/** Additional named root owning `selectionBefore`; omit for the primary root. */
|
|
15
|
+
readonly selectionBeforeRoot?: string;
|
|
16
|
+
/**
|
|
17
|
+
* On an undo step whose commit settled shown values or a decision's text:
|
|
18
|
+
* the change from the step's base that takes back what the commit settled.
|
|
19
|
+
* A redo step never has it.
|
|
20
|
+
*/
|
|
21
|
+
readonly unsettle?: DocumentChange;
|
|
22
|
+
/**
|
|
23
|
+
* Beside `unsettle` on a step whose commit settled a decision's text: the
|
|
24
|
+
* undo of everything else the commit did, from the document `unsettle`
|
|
25
|
+
* gives. `change` is `unsettle` then `rest`, and the step's redo is the
|
|
26
|
+
* inverse of `rest`.
|
|
27
|
+
*/
|
|
28
|
+
readonly rest?: DocumentChange;
|
|
29
|
+
/**
|
|
30
|
+
* On an undo step whose commit merged a line into a nested line or out of
|
|
31
|
+
* one, such as a line of one quote into the quote before it, and on
|
|
32
|
+
* each step an undo or redo of it pushes: the runs of tokens the step
|
|
33
|
+
* deletes at `source` in its base and inserts at `at` in the document it
|
|
34
|
+
* gives, with the same letters and element tokens however the step changed
|
|
35
|
+
* their marks. An outside edit inside a run moves with the run.
|
|
36
|
+
*/
|
|
37
|
+
readonly carried?: readonly CarriedRun[];
|
|
38
|
+
}
|
|
39
|
+
/** Undo and redo stacks of inverse document changes. */
|
|
40
|
+
interface History<V extends Value = Value> {
|
|
41
|
+
/** Monotonic revision of the published history value. */
|
|
42
|
+
readonly revision: number;
|
|
43
|
+
readonly redos: ReadonlyArray<Batch<V>>;
|
|
44
|
+
/** Schema identity that owns every persisted change in this history. */
|
|
45
|
+
readonly schema: EditorSchemaIdentity;
|
|
46
|
+
readonly undos: ReadonlyArray<Batch<V>>;
|
|
47
|
+
}
|
|
48
|
+
type HistoryJSON = Readonly<{
|
|
49
|
+
redos: readonly HistoryBatchJSON[];
|
|
50
|
+
schema: EditorSchemaIdentity;
|
|
51
|
+
undos: readonly HistoryBatchJSON[];
|
|
52
|
+
/** 7 for every history this build saves. It still reads 4, 5 and 6. */
|
|
53
|
+
version: 4 | 5 | 6 | 7;
|
|
54
|
+
}>;
|
|
55
|
+
type HistoryBatchJSON = Readonly<{
|
|
56
|
+
change: ReturnType<DocumentChange['toJSON']>;
|
|
57
|
+
effects: ReadonlyArray<ReturnType<typeof encodeEditorEffect>>;
|
|
58
|
+
selectionAfter: ReturnType<typeof encodeEditorSelection>;
|
|
59
|
+
/** Additional named root; omitted for the primary root. */
|
|
60
|
+
selectionAfterRoot?: string;
|
|
61
|
+
selectionBefore: ReturnType<typeof encodeEditorSelection>;
|
|
62
|
+
/** Additional named root; omitted for the primary root. */
|
|
63
|
+
selectionBeforeRoot?: string;
|
|
64
|
+
/** Only on an undo step whose commit settled shown values or a decision's text. */
|
|
65
|
+
unsettle?: ReturnType<DocumentChange['toJSON']>;
|
|
66
|
+
/** Only beside `unsettle` on a step whose commit settled a decision's text. */
|
|
67
|
+
rest?: ReturnType<DocumentChange['toJSON']>;
|
|
68
|
+
/**
|
|
69
|
+
* Only at version 7: the facts of what the step moved, split and joined,
|
|
70
|
+
* per root, or null when they are unknown. A step with no fact omits it.
|
|
71
|
+
*/
|
|
72
|
+
record?: Readonly<Record<string, RootFactsJson>> | null;
|
|
73
|
+
/**
|
|
74
|
+
* Only on a step that merges a line into a nested line or takes it back.
|
|
75
|
+
* A run names `landed` only when it differs from `length`.
|
|
76
|
+
*/
|
|
77
|
+
carried?: ReadonlyArray<Readonly<{
|
|
78
|
+
at: number;
|
|
79
|
+
landed?: number;
|
|
80
|
+
length: number;
|
|
81
|
+
root: string;
|
|
82
|
+
source: number;
|
|
83
|
+
}>>;
|
|
84
|
+
/**
|
|
85
|
+
* Only on a redo history maps apart from its plain rules: the redo it
|
|
86
|
+
* applies from the same document when a guard refuses this one.
|
|
87
|
+
*/
|
|
88
|
+
fallback?: Omit<HistoryBatchJSON, 'fallback' | 'id'>;
|
|
89
|
+
/**
|
|
90
|
+
* The step's id, which undo, redo, a merge and a restore keep. Never on a
|
|
91
|
+
* `fallback`. A step saved without one gets a fresh id when it loads.
|
|
92
|
+
*/
|
|
93
|
+
id?: string;
|
|
94
|
+
}>;
|
|
95
|
+
declare const History: {
|
|
96
|
+
/** Check whether a value is an in-memory history object. */
|
|
97
|
+
isHistory(value: unknown): value is History;
|
|
98
|
+
/** Decode and validate history against an editor without installing it. */
|
|
99
|
+
fromJSON<V extends Value>(editor: Editor<V>, json: unknown): History<V>;
|
|
100
|
+
/** Encode the editor's current history as validated versioned JSON. */
|
|
101
|
+
toJSON<V extends Value>(editor: Editor<V>): HistoryJSON;
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/history/history-plugin.d.ts
|
|
105
|
+
type HistoryStateApi<V extends Value = Value> = (() => History<V>) & {
|
|
106
|
+
/** Return whether the redo branch has a surviving mapped batch. */
|
|
107
|
+
hasRedo: () => boolean;
|
|
108
|
+
/** Return whether the undo branch has a surviving mapped batch. */
|
|
109
|
+
hasUndo: () => boolean;
|
|
110
|
+
/** Return the replay currently waiting for its session owner. */
|
|
111
|
+
pending: () => HistoryAction | null;
|
|
112
|
+
};
|
|
113
|
+
type HistoryControlTx = TxOnlyMethod<() => void>;
|
|
114
|
+
type HistoryTxApi<V extends Value = Value> = {
|
|
115
|
+
/**
|
|
116
|
+
* Merge this transaction into the previous compatible undo batch. Two
|
|
117
|
+
* batches whose commits change no root, such as ones that write only
|
|
118
|
+
* records, are compatible.
|
|
119
|
+
*/
|
|
120
|
+
merge: HistoryControlTx;
|
|
121
|
+
/** Make this transaction start a fresh undo batch. */
|
|
122
|
+
newBatch: HistoryControlTx;
|
|
123
|
+
/** Replace both history branches when the surrounding transaction commits. */
|
|
124
|
+
restore: TxDeclaredMethod<(history: History<V>) => void>;
|
|
125
|
+
/** Do not save this transaction to history. */
|
|
126
|
+
skip: HistoryControlTx;
|
|
127
|
+
};
|
|
128
|
+
type HistoryOptions<TEnabled extends boolean | undefined = undefined> = {
|
|
129
|
+
/** Disable history for an editor that installs history through a preset. */
|
|
130
|
+
enabled?: TEnabled;
|
|
131
|
+
/** Maximum number of undo and redo batches retained per branch. */
|
|
132
|
+
maxDepth?: number;
|
|
133
|
+
/** Idle time in milliseconds before an automatic edit starts a new batch. */
|
|
134
|
+
newBatchDelay?: number;
|
|
135
|
+
};
|
|
136
|
+
type HistoryPluginTypes<V extends Value = Value> = {
|
|
137
|
+
api: {
|
|
138
|
+
history: HistoryApi;
|
|
139
|
+
};
|
|
140
|
+
read: {
|
|
141
|
+
history: HistoryStateApi<V>;
|
|
142
|
+
};
|
|
143
|
+
update: {
|
|
144
|
+
history: HistoryTxApi<V>;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
type HistoryPluginDefinition<TEnabled extends boolean | undefined> = {
|
|
148
|
+
activate: true;
|
|
149
|
+
api: HistoryApi;
|
|
150
|
+
enabled: TEnabled;
|
|
151
|
+
name: 'history';
|
|
152
|
+
on: true;
|
|
153
|
+
read: HistoryStateApi;
|
|
154
|
+
update: HistoryTxApi;
|
|
155
|
+
validate: true;
|
|
156
|
+
};
|
|
157
|
+
/** Value-sensitive history capability provider for plugin composition. */
|
|
158
|
+
type HistoryPluginTypeProvider = PluginTypeProvider<HistoryPluginTypeProvider.Contract>;
|
|
159
|
+
declare namespace HistoryPluginTypeProvider {
|
|
160
|
+
interface Contract {
|
|
161
|
+
readonly input: Value;
|
|
162
|
+
readonly output: HistoryPluginTypes<this['input']>;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
type HistoryPlugin<TEnabled extends boolean | undefined = undefined> = Plugin<HistoryPluginDefinition<TEnabled>> & HistoryPluginTypeProvider;
|
|
166
|
+
type HistoryAction = 'redo' | 'undo';
|
|
167
|
+
/** Create the inverse-change history plugin. */
|
|
168
|
+
declare const history: <const TEnabled extends boolean | undefined = undefined>(options?: HistoryOptions<TEnabled>) => HistoryPlugin<TEnabled>;
|
|
169
|
+
//#endregion
|
|
170
|
+
export { Batch, type CarriedRun, History, HistoryBatchJSON, HistoryControlTx, HistoryJSON, HistoryOptions, HistoryPlugin, HistoryPluginTypeProvider, HistoryPluginTypes, HistoryStateApi, HistoryTxApi, history };
|