plitejs 54.0.0-beta.4 → 54.0.0-beta.6
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/dist/annotations/index.d.ts +1 -1
- package/dist/annotations/index.js +1 -1
- package/dist/authored/index.d.ts +2 -2
- package/dist/authored/index.js +1302 -490
- package/dist/{authored-veto-D_9wCJcK.js → authored-veto-BsBDXC0b.js} +1 -1
- package/dist/{comparison-plan-DY_vuGPq.js → comparison-plan-IOewH50q.js} +1 -1
- package/dist/{comparison-types-DdwE6mYq.d.ts → comparison-types-DBQFu7Rt.d.ts} +1 -1
- package/dist/{create-editor-CLQEkEZ1.js → create-editor-DRRzGwaC.js} +1 -1
- package/dist/diff/index.d.ts +2 -2
- package/dist/diff/index.js +2 -2
- package/dist/dom/index.d.ts +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/{dom-CH2BXXj6.js → dom-CVYV5Qd5.js} +400 -100
- package/dist/{editor-owner-C9rVbMTs.js → editor-owner-CGj1wYCa.js} +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.js +252 -178
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/hyperscript/index.js +1 -1
- package/dist/{hyperscript-CeT83ZLB.js → hyperscript-CT6hhnAY.js} +2 -2
- package/dist/{index-UrB4jAwl.d.ts → index-BT7D4vtf.d.ts} +5 -1
- package/dist/{index-BWPcE4ac.d.ts → index-BvQzYVAW.d.ts} +1 -1
- package/dist/{index-Db-ktCTE.d.ts → index-D7-n2GCk.d.ts} +6 -3
- package/dist/{index-BXjLmx1n.d.ts → index-DHt8nZQ6.d.ts} +143 -78
- package/dist/{index-Dq3Jlj8O.d.ts → index-PDROnF1G.d.ts} +1 -1
- package/dist/{index-DVMNewDn.d.ts → index-VZrKWWeh.d.ts} +20 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +4 -4
- package/dist/{mapped-view-store-CbWqba_1.js → mapped-view-store-CBk2-bDR.js} +1 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/react.d.ts +2 -2
- package/dist/pagination/react.js +5 -5
- package/dist/{pagination-CBdYiOuR.js → pagination-Cs5ka6hW.js} +1 -1
- package/dist/{plugin-SR3HTH0j.js → plugin-Bm6nsPHh.js} +1984 -751
- package/dist/{range-geometry-CdltxcH6.js → range-geometry-D1XfYWs0.js} +2 -2
- package/dist/{range-geometry-Dwp2oyCc.d.ts → range-geometry-DO-kbNrb.d.ts} +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +6 -6
- package/dist/react/virtualized.d.ts +2 -2
- package/dist/react/virtualized.js +1 -1
- package/dist/{react-CN-iBh1z.js → react-BYtwRr4v.js} +18 -9
- package/dist/{retraction-BmPJB9cE.js → retraction-DnEUo8oE.js} +18 -2
- package/dist/{src-B-zm0kz4.js → src-DIQDddmh.js} +227 -40
- package/dist/{store-51r4zpCR.js → store-BLYxJgOU.js} +35 -5
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +3 -3
- package/dist/{use-editor-dom-scope-uDJQ692F.js → use-editor-dom-scope-hT7W9d-p.js} +1089 -606
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/index.js +1 -1
- package/dist/yjs/react/index.d.ts +3 -3
- package/dist/yjs/react/index.js +3 -3
- package/dist/{yjs-IGE0Al3n.js → yjs-C_g9gZwI.js} +6 -3
- package/package.json +1 -1
- package/dist/native-grouping-input-DXNhlPHd.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bu as getEditorRuntimeOwner, jp as countCoreWork, u as destroyEditor, w as startEditor, x as releaseEditor } from "./plugin-Bm6nsPHh.js";
|
|
2
2
|
//#region src/core/same-result.ts
|
|
3
3
|
const MAX_VALUES = 100;
|
|
4
4
|
const MAX_DEPTH = 64;
|
package/dist/history/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as encodeEditorEffect,
|
|
1
|
+
import { $t as encodeEditorEffect, Bm as TxOnlyMethod, Mc as Editor, Rm as TxDeclaredMethod, ba as RootFactsJson, cl as EditorEffect, fh as Selection, kd as Plugin, kf as Value, mo as EditorSchemaIdentity, of as PluginTypeProvider, qm as DocumentChange, xa as CarriedRun, xt as encodeEditorSelection, yd as HistoryApi } from "../index-DHt8nZQ6.js";
|
|
2
2
|
//#region src/history/history.d.ts
|
|
3
3
|
interface Batch<_V extends Value = Value> {
|
|
4
4
|
/** Canonical change to apply when this batch is consumed. */
|
package/dist/history/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as nativeGroupingInput } from "../native-grouping-input-DXNhlPHd.js";
|
|
1
|
+
import { Ac as getEditorCommitUnsettle, Ad as getInternalDocumentRootChange, As as assertSelectionSupported, Au as ElementApi, Bs as withLandedMarks, Bu as getEditorRuntimeOwner, Cc as getEditorCommitCompletedTextDeletion, Cf as tokenLength, Cp as isObject, Dd as getInternalDocumentChangeRanges, Ec as getEditorCommitRest, Ed as getInternalDocumentChangeEntries, Ei as withEditorUpdateRootScope, Fc as snapshotIndexOf, Fd as mapInternalDocumentChangePosition, Ga as getBookmark, Gn as getCurrentSelectionRoot, Gr as registerEditorTransactionGuard, Ha as changedBookmarks, Hd as withoutRetainedRecordSets, Hr as recordEditorHistoryReplayReceipt, Hu as getEditorSchema, Ic as getDocumentChangeRelocations, Id as transformInternalDocumentChange, If as getRecordText, Ip as jsonEqual, Is as mapSelectionThroughChange, Jd as getDocumentPropertyContext, Jn as getEditorDocumentValue, Kc as consumeAnchorHistoryCapture, Kd as applyPropertyModifications, Ld as valueRoot, Ll as getPluginRegistry, Mc as historyReplayClaim, Mp as readCoreWork, Ms as encodeEditorSelection, Nd as isInternalDocumentChangeNoop, Nf as getRecordEntries, Oc as getEditorCommitSnapshot, Od as getInternalDocumentChangeRecords, Ol as reportEditorLifecycleError, Pl as getCompiledEditorSchema, Qc as mergeAnchorHistoryRecovery, Qf as decodeEditorEffect, Qi as recordedDeleteGroupingInput, Qo as txOnly, Qu as composeFacts, Rd as valueRootIndex, Rf as getValueRecords, Rp as getDefined, Sc as getEditorCommitCarriedRuns, Sd as documentChangeWritesOnlyElementProperties, Sf as textToken, Td as getInternalDocumentChangeClassificationEntries, Tl as HISTORY_BOUNDARY_TAG, Tp as copyRoot, Ud as RootChange, Ul as areEditorSchemaIdentitiesEqual, Ur as registerEditorHistoryRuntime, Vd as withInternalDocumentRootChange, Wa as consumeCommitCarets, Wd as addSection, Ws as constructCanonicalDocumentChange, Xu as NO_ROOT_FACTS, Yu as NO_FACTS, Zc as mapAnchorHistoryRecovery, Zd as mapRootChangePositionBackward, Zi as nativeGroupingInput, Zo as txLocate, Zu as UNKNOWN_FACTS, _d as collapseDocumentElementPropertyWrites, _f as isElementNode, ad as recordedFacts, ao as restoreHistoryCarets, bf as openToken, bn as applyDocumentChange, cd as carriesRun, cp as createEditorEffect, ct as getSelection, dd as landCarriedRuns, dp as invertEffect, ed as factsFromJSON, ef as markReadBack, ep as encodeEditorEffect, fd as mapCarriedRunThrough, ff as PreparedTokenSlice, fi as setTypedMarks, fp as mapEffect, gf as getDocumentSliceNodeKeys, hd as alignedDocumentChange, hl as toPublicRoot, hu as EditorSchemaValidationError, il as getAuthoredUpdateView, iu as propertyTargetsReadParents, jc as getEditorCommitValue, jp as countCoreWork, jr as isInTransaction, js as decodeEditorSelection, kc as getEditorCommitStartedAt, kd as getInternalDocumentChangeRootKeys, kn as documentReplacement, kr as isBuildingTransactionSpec, ku as SelectionApi, l as definePlugin, ld as exactRunOn, md as DocumentChange, mf as closeToken, mp as RangeApi, mu as EditorNoncanonicalChangeError, nd as flipFacts, nf as liftOf, no as resolveBookmark, nr as getEditorUpdateRoot, of as decodeNodes, oo as rootChildrenOf, ou as readEditorSchemaIdentity, pd as widenRun, qd as applyPropertyModificationsToSlice, qu as classifyDocumentChange, rf as DocumentIndex, sd as carriedLetterPairs, so as sameCarets, td as factsToJSON, tf as joinsOf, tl as stageAnchorHistoryRecovery, ud as invertCarriedRun, uf as normalizeSetValues, up as defineUpdateAnnotation, vd as createInternalDocumentChange, vf as isTextNode, vp as MAIN_ROOT_KEY, wc as getEditorCommitFacts, wf as tokensEqual, xc as getEditorCommitAdmission, xd as documentChangePropertyOnlyWrites, yf as nodeProps, yr as getUpdateView, zf as hasRecord, zu as getEditorRuntime } from "../plugin-Bm6nsPHh.js";
|
|
3
2
|
//#region src/core/change/carried-projection.ts
|
|
4
3
|
/** A projection the documents leave no place for. */
|
|
5
4
|
var CarriedProjectionError = class extends Error {
|
|
@@ -4163,10 +4162,228 @@ const mergeHistoryCarets = (editor, previous, next) => {
|
|
|
4163
4162
|
};
|
|
4164
4163
|
};
|
|
4165
4164
|
//#endregion
|
|
4166
|
-
//#region src/history/history-
|
|
4165
|
+
//#region src/history/history-merge-policy.ts
|
|
4167
4166
|
const failInvariant$2 = (message) => {
|
|
4168
4167
|
throw new Error(message);
|
|
4169
4168
|
};
|
|
4169
|
+
const pathKey = (path) => path.join(".");
|
|
4170
|
+
const getChangedRoot = (commit) => {
|
|
4171
|
+
const roots = /* @__PURE__ */ new Set([
|
|
4172
|
+
...getInternalDocumentChangeRootKeys(commit.changes),
|
|
4173
|
+
...commit.changes.createRoots,
|
|
4174
|
+
...commit.changes.deleteRoots
|
|
4175
|
+
]);
|
|
4176
|
+
return roots.size === 1 ? [...roots][0] : null;
|
|
4177
|
+
};
|
|
4178
|
+
const getDeepestChangedPath = (paths) => {
|
|
4179
|
+
if (!paths || paths.length === 0) return null;
|
|
4180
|
+
const deepest = Math.max(...paths.map((path) => path.length));
|
|
4181
|
+
const candidates = new Map(paths.filter((path) => path.length === deepest).map((path) => [pathKey(path), path]));
|
|
4182
|
+
return candidates.size === 1 ? [...candidates.values()][0] : null;
|
|
4183
|
+
};
|
|
4184
|
+
const getCollapsedPoint = (selection, fallbackRoot, root) => {
|
|
4185
|
+
if (!selection || !RangeApi.isRange(selection) || !RangeApi.isCollapsed(selection)) return null;
|
|
4186
|
+
const point = selection.anchor;
|
|
4187
|
+
return (point.root ?? fallbackRoot) === root ? Object.freeze({
|
|
4188
|
+
offset: point.offset,
|
|
4189
|
+
path: Object.freeze([...point.path])
|
|
4190
|
+
}) : null;
|
|
4191
|
+
};
|
|
4192
|
+
const selectionIsExpandedInRoot = (selection, fallbackRoot, root) => Boolean(selection && RangeApi.isRange(selection) && !RangeApi.isCollapsed(selection) && (selection.anchor.root ?? fallbackRoot) === root && (selection.focus.root ?? fallbackRoot) === root);
|
|
4193
|
+
const getTarget = (commit, root, path) => {
|
|
4194
|
+
const nodeKeys = commit.changed.nodeKeys("text", toPublicRoot(root));
|
|
4195
|
+
if (!path && nodeKeys.length !== 1) return null;
|
|
4196
|
+
return Object.freeze({
|
|
4197
|
+
path: path ? pathKey(path) : "",
|
|
4198
|
+
...nodeKeys.length === 1 ? { nodeKey: nodeKeys[0] } : {}
|
|
4199
|
+
});
|
|
4200
|
+
};
|
|
4201
|
+
const sameTarget = (left, right) => left.nodeKey && right.nodeKey ? left.nodeKey === right.nodeKey : left.path === right.path;
|
|
4202
|
+
const isSameHistoryPath = (left, right) => left.length === right.length && left.every((part, index) => part === right[index]);
|
|
4203
|
+
const samePoint = (left, right) => Boolean(left && right && left.offset === right.offset && isSameHistoryPath(left.path, right.path));
|
|
4204
|
+
const getChangedSpan = (ranges) => {
|
|
4205
|
+
if (ranges.length === 0) return null;
|
|
4206
|
+
return Object.freeze([
|
|
4207
|
+
Math.min(...ranges.map((range) => range[0])),
|
|
4208
|
+
Math.max(...ranges.map((range) => range[1])),
|
|
4209
|
+
Math.min(...ranges.map((range) => range[2])),
|
|
4210
|
+
Math.max(...ranges.map((range) => range[3]))
|
|
4211
|
+
]);
|
|
4212
|
+
};
|
|
4213
|
+
const getPropertyGroup = (commit) => {
|
|
4214
|
+
const writes = documentChangePropertyOnlyWrites(commit.changes, getEditorCommitValue(commit, "before"));
|
|
4215
|
+
if (!writes || writes.length === 0) return null;
|
|
4216
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
4217
|
+
for (const { keys, path, root } of writes) {
|
|
4218
|
+
const nodeKey = getEditorCommitSnapshot(commit, root, "before").index.keyAt(path);
|
|
4219
|
+
if (!nodeKey) return null;
|
|
4220
|
+
const targetKey = JSON.stringify([root, nodeKey]);
|
|
4221
|
+
let entry = nodes.get(targetKey);
|
|
4222
|
+
if (!entry) {
|
|
4223
|
+
entry = {
|
|
4224
|
+
keys: /* @__PURE__ */ new Set(),
|
|
4225
|
+
nodeKey,
|
|
4226
|
+
root
|
|
4227
|
+
};
|
|
4228
|
+
nodes.set(targetKey, entry);
|
|
4229
|
+
}
|
|
4230
|
+
for (const key of keys) entry.keys.add(key);
|
|
4231
|
+
}
|
|
4232
|
+
const includeKeys = nodes.size > 1;
|
|
4233
|
+
const targets = [...nodes.values()].map(({ keys, nodeKey, root }) => JSON.stringify(includeKeys ? [
|
|
4234
|
+
root,
|
|
4235
|
+
nodeKey,
|
|
4236
|
+
[...keys].sort()
|
|
4237
|
+
] : [root, nodeKey])).sort();
|
|
4238
|
+
const roots = [...new Set(writes.map(({ root }) => root))].sort();
|
|
4239
|
+
return Object.freeze({
|
|
4240
|
+
kind: "properties",
|
|
4241
|
+
roots: Object.freeze(roots),
|
|
4242
|
+
targets: Object.freeze(targets)
|
|
4243
|
+
});
|
|
4244
|
+
};
|
|
4245
|
+
const sameStrings = (left, right) => left.length === right.length && left.every((item, index) => item === right[index]);
|
|
4246
|
+
const groupRoots = (group) => group.kind === "effects" ? [] : group.kind === "text" ? [group.root] : group.roots;
|
|
4247
|
+
const sameGroupRoots = (left, right) => sameStrings(groupRoots(left), groupRoots(right));
|
|
4248
|
+
const createHistoryBatchGroup = (commit) => {
|
|
4249
|
+
const recordedDelete = commit.annotations[recordedDeleteGroupingInput.key];
|
|
4250
|
+
const propertyGroup = recordedDelete ? null : getPropertyGroup(commit);
|
|
4251
|
+
if (propertyGroup) return propertyGroup;
|
|
4252
|
+
const root = getChangedRoot(commit);
|
|
4253
|
+
if (!root) return recordedDelete ? getPropertyGroup(commit) : null;
|
|
4254
|
+
const publicRoot = root === "main" ? void 0 : root;
|
|
4255
|
+
const ranges = getInternalDocumentChangeRanges(commit.changes, root);
|
|
4256
|
+
const range = ranges.length === 1 ? ranges[0] : null;
|
|
4257
|
+
const changedSpan = getChangedSpan(ranges);
|
|
4258
|
+
const changedPath = getDeepestChangedPath(commit.changed.paths(publicRoot));
|
|
4259
|
+
const replacedSelection = selectionIsExpandedInRoot(commit.selectionBefore, commit.selectionBeforeRoot ?? "main", root);
|
|
4260
|
+
const afterPoint = getCollapsedPoint(commit.selectionAfter, commit.selectionAfterRoot ?? "main", root);
|
|
4261
|
+
const beforePoint = getCollapsedPoint(commit.selectionBefore, commit.selectionBeforeRoot ?? "main", root);
|
|
4262
|
+
if (recordedDelete) {
|
|
4263
|
+
const blockKey = recordedDelete.root === root ? getEditorCommitSnapshot(commit, root, "before").index.keyAt(recordedDelete.blockPath) : null;
|
|
4264
|
+
if (changedSpan && !replacedSelection && beforePoint && afterPoint && blockKey && blockKey === getEditorCommitSnapshot(commit, root, "after").index.keyAt(recordedDelete.blockPath)) return Object.freeze({
|
|
4265
|
+
afterPoint,
|
|
4266
|
+
beforePoint,
|
|
4267
|
+
fromAfter: changedSpan[2],
|
|
4268
|
+
fromBefore: changedSpan[0],
|
|
4269
|
+
kind: "text",
|
|
4270
|
+
mode: "delete",
|
|
4271
|
+
recordedDelete: Object.freeze({
|
|
4272
|
+
direction: recordedDelete.direction,
|
|
4273
|
+
group: recordedDelete.group
|
|
4274
|
+
}),
|
|
4275
|
+
replacedSelection: false,
|
|
4276
|
+
root,
|
|
4277
|
+
target: Object.freeze({
|
|
4278
|
+
nodeKey: blockKey,
|
|
4279
|
+
path: pathKey(recordedDelete.blockPath)
|
|
4280
|
+
}),
|
|
4281
|
+
toAfter: changedSpan[3],
|
|
4282
|
+
toBefore: changedSpan[1]
|
|
4283
|
+
});
|
|
4284
|
+
const fallbackPropertyGroup = getPropertyGroup(commit);
|
|
4285
|
+
if (fallbackPropertyGroup) return fallbackPropertyGroup;
|
|
4286
|
+
}
|
|
4287
|
+
const selectionStart = RangeApi.isRange(commit.selectionBefore) ? RangeApi.edges(commit.selectionBefore)[0] : null;
|
|
4288
|
+
const structuralReplacementInsertedText = Boolean(selectionStart && afterPoint && (selectionStart.root ?? commit.selectionBeforeRoot ?? "main") === root && isSameHistoryPath(selectionStart.path, afterPoint.path) && afterPoint.offset > selectionStart.offset);
|
|
4289
|
+
const textChanged = commit.changed.has("text", publicRoot);
|
|
4290
|
+
const structureChanged = commit.changed.has("structure", publicRoot);
|
|
4291
|
+
const propertiesChanged = commit.changed.has("properties", publicRoot);
|
|
4292
|
+
const textTarget = getTarget(commit, root, changedPath ?? afterPoint?.path ?? beforePoint?.path ?? null);
|
|
4293
|
+
if (changedSpan && replacedSelection && structuralReplacementInsertedText && afterPoint && structureChanged) return Object.freeze({
|
|
4294
|
+
afterPoint,
|
|
4295
|
+
beforePoint,
|
|
4296
|
+
fromAfter: changedSpan[2],
|
|
4297
|
+
fromBefore: changedSpan[0],
|
|
4298
|
+
kind: "text",
|
|
4299
|
+
mode: "structural-replace",
|
|
4300
|
+
replacedSelection: true,
|
|
4301
|
+
root,
|
|
4302
|
+
target: getTarget(commit, root, afterPoint.path) ?? failInvariant$2("Expected value to be defined"),
|
|
4303
|
+
toAfter: changedSpan[3],
|
|
4304
|
+
toBefore: changedSpan[1]
|
|
4305
|
+
});
|
|
4306
|
+
const opened = structureChanged ? commit.changed.nodeKeys("presence", publicRoot) : [];
|
|
4307
|
+
const opensLeaf = !replacedSelection && opened.length > 0 && opened.every((key) => commit.changed.nodeKeys("text", publicRoot).includes(key));
|
|
4308
|
+
if (range && textTarget && (opensLeaf || textChanged && !structureChanged) && !propertiesChanged) {
|
|
4309
|
+
const beforeLength = range[1] - range[0];
|
|
4310
|
+
const afterLength = range[3] - range[2];
|
|
4311
|
+
const mode = opensLeaf || beforeLength === 0 && afterLength > 0 ? "insert" : beforeLength > 0 && afterLength === 0 ? "delete" : "replace";
|
|
4312
|
+
return Object.freeze({
|
|
4313
|
+
afterPoint,
|
|
4314
|
+
beforePoint,
|
|
4315
|
+
fromAfter: range[2],
|
|
4316
|
+
fromBefore: range[0],
|
|
4317
|
+
kind: "text",
|
|
4318
|
+
mode,
|
|
4319
|
+
replacedSelection,
|
|
4320
|
+
root,
|
|
4321
|
+
target: textTarget,
|
|
4322
|
+
toAfter: range[3],
|
|
4323
|
+
toBefore: range[1]
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
const deletion = getEditorCommitCompletedTextDeletion(commit);
|
|
4327
|
+
if (deletion?.root === root) {
|
|
4328
|
+
const fromAfter = mapInternalDocumentChangePosition(commit.changes, root, deletion.fromBefore) ?? failInvariant$2("Expected the deleted text to map into the commit");
|
|
4329
|
+
const nodeKey = getEditorCommitSnapshot(commit, root, "before").index.keyAt(deletion.pathBefore);
|
|
4330
|
+
return Object.freeze({
|
|
4331
|
+
afterPoint,
|
|
4332
|
+
beforePoint,
|
|
4333
|
+
fromAfter,
|
|
4334
|
+
fromBefore: deletion.fromBefore,
|
|
4335
|
+
kind: "text",
|
|
4336
|
+
mode: "delete",
|
|
4337
|
+
replacedSelection,
|
|
4338
|
+
root,
|
|
4339
|
+
target: Object.freeze({
|
|
4340
|
+
path: pathKey(deletion.pathBefore),
|
|
4341
|
+
...nodeKey ? { nodeKey } : {}
|
|
4342
|
+
}),
|
|
4343
|
+
toAfter: fromAfter,
|
|
4344
|
+
toBefore: deletion.toBefore
|
|
4345
|
+
});
|
|
4346
|
+
}
|
|
4347
|
+
return Object.freeze({
|
|
4348
|
+
kind: "document",
|
|
4349
|
+
roots: Object.freeze([root])
|
|
4350
|
+
});
|
|
4351
|
+
};
|
|
4352
|
+
const shouldMergeText = (current, previous) => {
|
|
4353
|
+
if (current.root !== previous.root || !sameTarget(current.target, previous.target)) return false;
|
|
4354
|
+
if (current.mode === "insert" && previous.replacedSelection && (previous.mode === "replace" || previous.mode === "structural-replace") && (samePoint(previous.afterPoint, current.beforePoint) || current.fromBefore === previous.toAfter)) return true;
|
|
4355
|
+
if (current.mode === "insert" && previous.mode === "insert") return current.fromBefore === previous.toAfter || samePoint(previous.afterPoint, current.beforePoint) && current.fromBefore > previous.fromAfter && current.fromBefore < previous.toAfter;
|
|
4356
|
+
if (current.mode === "delete" && previous.mode === "delete") {
|
|
4357
|
+
if (current.recordedDelete || previous.recordedDelete) return Boolean(current.recordedDelete && previous.recordedDelete && current.recordedDelete.group === previous.recordedDelete.group && current.recordedDelete.direction === previous.recordedDelete.direction && samePoint(previous.afterPoint, current.beforePoint));
|
|
4358
|
+
return current.toBefore === previous.fromAfter;
|
|
4359
|
+
}
|
|
4360
|
+
return false;
|
|
4361
|
+
};
|
|
4362
|
+
const shouldMergeBatch = (currentBatch, current, previousBatch, previous, effectsCompatible = false) => {
|
|
4363
|
+
if (!effectsCompatible && (currentBatch.effects.length > 0 || previousBatch.effects.length > 0)) return false;
|
|
4364
|
+
if (!current || !previous || !sameGroupRoots(current, previous) || current.scope !== previous.scope) return false;
|
|
4365
|
+
if (current.kind === "text" && previous.kind === "text") return shouldMergeText(current, previous);
|
|
4366
|
+
return current.kind === "properties" && previous.kind === "properties" && sameStrings(current.targets, previous.targets);
|
|
4367
|
+
};
|
|
4368
|
+
const shouldMergeCompositionBatch = (current, previous) => Boolean(current && previous && (current.kind === "effects" || previous.kind === "effects" || sameGroupRoots(current, previous)) && current.scope === previous.scope);
|
|
4369
|
+
const changesNoRoot = ({ change }) => change.createRoots.size === 0 && change.deleteRoots.size === 0 && getInternalDocumentChangeRootKeys(change).length === 0;
|
|
4370
|
+
const shouldMergeExplicitBatch = (currentBatch, current, previousBatch, previous, isNativeTextInput, effectsCompatible = false) => {
|
|
4371
|
+
if (shouldMergeBatch(currentBatch, current, previousBatch, previous, effectsCompatible)) return true;
|
|
4372
|
+
if (effectsCompatible && !isNativeTextInput) return true;
|
|
4373
|
+
if (!current && !previous) return changesNoRoot(currentBatch) && changesNoRoot(previousBatch);
|
|
4374
|
+
if (!current || !previous || !sameGroupRoots(current, previous) || current.scope !== previous.scope) return false;
|
|
4375
|
+
if (!isNativeTextInput) return true;
|
|
4376
|
+
return current.kind === "text" && previous.kind === "text" && shouldMergeText(current, previous);
|
|
4377
|
+
};
|
|
4378
|
+
const mergeHistoryBatchGroups = (previous, current) => current?.kind === "effects" && previous ? previous : current?.kind === "text" && previous?.kind === "text" ? Object.freeze({
|
|
4379
|
+
...current,
|
|
4380
|
+
replacedSelection: previous.replacedSelection || current.replacedSelection
|
|
4381
|
+
}) : current;
|
|
4382
|
+
//#endregion
|
|
4383
|
+
//#region src/history/history-state.ts
|
|
4384
|
+
const failInvariant$1 = (message) => {
|
|
4385
|
+
throw new Error(message);
|
|
4386
|
+
};
|
|
4170
4387
|
const HISTORY = /* @__PURE__ */ new WeakMap();
|
|
4171
4388
|
const HISTORY_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
4172
4389
|
const PUBLISHED_HISTORY_READ_DEPTH = /* @__PURE__ */ new WeakMap();
|
|
@@ -4283,7 +4500,7 @@ const cloneFrozen = (value) => {
|
|
|
4283
4500
|
const pending = clone && typeof clone === "object" ? [clone] : [];
|
|
4284
4501
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
4285
4502
|
while (pending.length > 0) {
|
|
4286
|
-
const item = pending.pop() ?? failInvariant$
|
|
4503
|
+
const item = pending.pop() ?? failInvariant$1("Expected value to be defined");
|
|
4287
4504
|
if (seen.has(item)) continue;
|
|
4288
4505
|
seen.add(item);
|
|
4289
4506
|
for (const nested of Object.values(item)) if (nested && typeof nested === "object") pending.push(nested);
|
|
@@ -4475,14 +4692,13 @@ const retainMappedCompositionGroup = (group) => {
|
|
|
4475
4692
|
native: group.native,
|
|
4476
4693
|
...group.scope ? { scope: group.scope } : {}
|
|
4477
4694
|
};
|
|
4478
|
-
return group.
|
|
4695
|
+
return group.kind === "effects" ? Object.freeze({
|
|
4479
4696
|
...shared,
|
|
4480
|
-
kind: "effects"
|
|
4481
|
-
root: void 0
|
|
4697
|
+
kind: "effects"
|
|
4482
4698
|
}) : Object.freeze({
|
|
4483
4699
|
...shared,
|
|
4484
4700
|
kind: "document",
|
|
4485
|
-
|
|
4701
|
+
roots: groupRoots(group)
|
|
4486
4702
|
});
|
|
4487
4703
|
};
|
|
4488
4704
|
const yieldTo = (change, edit, base) => transformInternalDocumentChange(change, edit, base, { keepRecordWrites: true }).a;
|
|
@@ -5660,164 +5876,6 @@ const History = {
|
|
|
5660
5876
|
}
|
|
5661
5877
|
};
|
|
5662
5878
|
//#endregion
|
|
5663
|
-
//#region src/history/history-merge-policy.ts
|
|
5664
|
-
const failInvariant$1 = (message) => {
|
|
5665
|
-
throw new Error(message);
|
|
5666
|
-
};
|
|
5667
|
-
const pathKey = (path) => path.join(".");
|
|
5668
|
-
const getChangedRoot = (commit) => {
|
|
5669
|
-
const roots = /* @__PURE__ */ new Set([
|
|
5670
|
-
...getInternalDocumentChangeRootKeys(commit.changes),
|
|
5671
|
-
...commit.changes.createRoots,
|
|
5672
|
-
...commit.changes.deleteRoots
|
|
5673
|
-
]);
|
|
5674
|
-
return roots.size === 1 ? [...roots][0] : null;
|
|
5675
|
-
};
|
|
5676
|
-
const getDeepestChangedPath = (paths) => {
|
|
5677
|
-
if (!paths || paths.length === 0) return null;
|
|
5678
|
-
const deepest = Math.max(...paths.map((path) => path.length));
|
|
5679
|
-
const candidates = new Map(paths.filter((path) => path.length === deepest).map((path) => [pathKey(path), path]));
|
|
5680
|
-
return candidates.size === 1 ? [...candidates.values()][0] : null;
|
|
5681
|
-
};
|
|
5682
|
-
const getCollapsedPoint = (selection, fallbackRoot, root) => {
|
|
5683
|
-
if (!selection || !RangeApi.isRange(selection) || !RangeApi.isCollapsed(selection)) return null;
|
|
5684
|
-
const point = selection.anchor;
|
|
5685
|
-
return (point.root ?? fallbackRoot) === root ? Object.freeze({
|
|
5686
|
-
offset: point.offset,
|
|
5687
|
-
path: Object.freeze([...point.path])
|
|
5688
|
-
}) : null;
|
|
5689
|
-
};
|
|
5690
|
-
const selectionIsExpandedInRoot = (selection, fallbackRoot, root) => Boolean(selection && RangeApi.isRange(selection) && !RangeApi.isCollapsed(selection) && (selection.anchor.root ?? fallbackRoot) === root && (selection.focus.root ?? fallbackRoot) === root);
|
|
5691
|
-
const getTarget = (commit, root, path, kind) => {
|
|
5692
|
-
const nodeKeys = commit.changed.nodeKeys(kind, toPublicRoot(root));
|
|
5693
|
-
if (!path && nodeKeys.length !== 1) return null;
|
|
5694
|
-
return Object.freeze({
|
|
5695
|
-
path: path ? pathKey(path) : "",
|
|
5696
|
-
...nodeKeys.length === 1 ? { nodeKey: nodeKeys[0] } : {}
|
|
5697
|
-
});
|
|
5698
|
-
};
|
|
5699
|
-
const sameTarget = (left, right) => left.nodeKey && right.nodeKey ? left.nodeKey === right.nodeKey : left.path === right.path;
|
|
5700
|
-
const isSameHistoryPath = (left, right) => left.length === right.length && left.every((part, index) => part === right[index]);
|
|
5701
|
-
const samePoint = (left, right) => Boolean(left && right && left.offset === right.offset && isSameHistoryPath(left.path, right.path));
|
|
5702
|
-
const getChangedSpan = (ranges) => {
|
|
5703
|
-
if (ranges.length === 0) return null;
|
|
5704
|
-
return Object.freeze([
|
|
5705
|
-
Math.min(...ranges.map((range) => range[0])),
|
|
5706
|
-
Math.max(...ranges.map((range) => range[1])),
|
|
5707
|
-
Math.min(...ranges.map((range) => range[2])),
|
|
5708
|
-
Math.max(...ranges.map((range) => range[3]))
|
|
5709
|
-
]);
|
|
5710
|
-
};
|
|
5711
|
-
const createHistoryBatchGroup = (commit) => {
|
|
5712
|
-
const root = getChangedRoot(commit);
|
|
5713
|
-
if (!root) return null;
|
|
5714
|
-
const publicRoot = root === "main" ? void 0 : root;
|
|
5715
|
-
const ranges = getInternalDocumentChangeRanges(commit.changes, root);
|
|
5716
|
-
const range = ranges.length === 1 ? ranges[0] : null;
|
|
5717
|
-
const changedSpan = getChangedSpan(ranges);
|
|
5718
|
-
const changedPath = getDeepestChangedPath(commit.changed.paths(publicRoot));
|
|
5719
|
-
const replacedSelection = selectionIsExpandedInRoot(commit.selectionBefore, commit.selectionBeforeRoot ?? "main", root);
|
|
5720
|
-
const afterPoint = getCollapsedPoint(commit.selectionAfter, commit.selectionAfterRoot ?? "main", root);
|
|
5721
|
-
const beforePoint = getCollapsedPoint(commit.selectionBefore, commit.selectionBeforeRoot ?? "main", root);
|
|
5722
|
-
const selectionStart = RangeApi.isRange(commit.selectionBefore) ? RangeApi.edges(commit.selectionBefore)[0] : null;
|
|
5723
|
-
const structuralReplacementInsertedText = Boolean(selectionStart && afterPoint && (selectionStart.root ?? commit.selectionBeforeRoot ?? "main") === root && isSameHistoryPath(selectionStart.path, afterPoint.path) && afterPoint.offset > selectionStart.offset);
|
|
5724
|
-
const textChanged = commit.changed.has("text", publicRoot);
|
|
5725
|
-
const structureChanged = commit.changed.has("structure", publicRoot);
|
|
5726
|
-
const propertiesChanged = commit.changed.has("properties", publicRoot);
|
|
5727
|
-
const textTarget = getTarget(commit, root, changedPath ?? afterPoint?.path ?? beforePoint?.path ?? null, "text");
|
|
5728
|
-
const propertyTarget = getTarget(commit, root, changedPath, "node");
|
|
5729
|
-
if (changedSpan && replacedSelection && structuralReplacementInsertedText && afterPoint && structureChanged) return Object.freeze({
|
|
5730
|
-
afterPoint,
|
|
5731
|
-
beforePoint,
|
|
5732
|
-
fromAfter: changedSpan[2],
|
|
5733
|
-
fromBefore: changedSpan[0],
|
|
5734
|
-
kind: "text",
|
|
5735
|
-
mode: "structural-replace",
|
|
5736
|
-
replacedSelection: true,
|
|
5737
|
-
root,
|
|
5738
|
-
target: getTarget(commit, root, afterPoint.path, "text") ?? failInvariant$1("Expected value to be defined"),
|
|
5739
|
-
toAfter: changedSpan[3],
|
|
5740
|
-
toBefore: changedSpan[1]
|
|
5741
|
-
});
|
|
5742
|
-
const opened = structureChanged ? commit.changed.nodeKeys("presence", publicRoot) : [];
|
|
5743
|
-
const opensLeaf = !replacedSelection && opened.length > 0 && opened.every((key) => commit.changed.nodeKeys("text", publicRoot).includes(key));
|
|
5744
|
-
if (range && textTarget && (opensLeaf || textChanged && !structureChanged) && !propertiesChanged) {
|
|
5745
|
-
const beforeLength = range[1] - range[0];
|
|
5746
|
-
const afterLength = range[3] - range[2];
|
|
5747
|
-
const mode = opensLeaf || beforeLength === 0 && afterLength > 0 ? "insert" : beforeLength > 0 && afterLength === 0 ? "delete" : "replace";
|
|
5748
|
-
return Object.freeze({
|
|
5749
|
-
afterPoint,
|
|
5750
|
-
beforePoint,
|
|
5751
|
-
fromAfter: range[2],
|
|
5752
|
-
fromBefore: range[0],
|
|
5753
|
-
kind: "text",
|
|
5754
|
-
mode,
|
|
5755
|
-
replacedSelection,
|
|
5756
|
-
root,
|
|
5757
|
-
target: textTarget,
|
|
5758
|
-
toAfter: range[3],
|
|
5759
|
-
toBefore: range[1]
|
|
5760
|
-
});
|
|
5761
|
-
}
|
|
5762
|
-
if (range && propertyTarget && propertiesChanged && !structureChanged && !textChanged) return Object.freeze({
|
|
5763
|
-
kind: "properties",
|
|
5764
|
-
root,
|
|
5765
|
-
target: propertyTarget
|
|
5766
|
-
});
|
|
5767
|
-
const deletion = getEditorCommitCompletedTextDeletion(commit);
|
|
5768
|
-
if (deletion?.root === root) {
|
|
5769
|
-
const fromAfter = mapInternalDocumentChangePosition(commit.changes, root, deletion.fromBefore) ?? failInvariant$1("Expected the deleted text to map into the commit");
|
|
5770
|
-
const nodeKey = getEditorCommitSnapshot(commit, root, "before").index.keyAt(deletion.pathBefore);
|
|
5771
|
-
return Object.freeze({
|
|
5772
|
-
afterPoint,
|
|
5773
|
-
beforePoint,
|
|
5774
|
-
fromAfter,
|
|
5775
|
-
fromBefore: deletion.fromBefore,
|
|
5776
|
-
kind: "text",
|
|
5777
|
-
mode: "delete",
|
|
5778
|
-
replacedSelection,
|
|
5779
|
-
root,
|
|
5780
|
-
target: Object.freeze({
|
|
5781
|
-
path: pathKey(deletion.pathBefore),
|
|
5782
|
-
...nodeKey ? { nodeKey } : {}
|
|
5783
|
-
}),
|
|
5784
|
-
toAfter: fromAfter,
|
|
5785
|
-
toBefore: deletion.toBefore
|
|
5786
|
-
});
|
|
5787
|
-
}
|
|
5788
|
-
return Object.freeze({
|
|
5789
|
-
kind: "document",
|
|
5790
|
-
root
|
|
5791
|
-
});
|
|
5792
|
-
};
|
|
5793
|
-
const shouldMergeText = (current, previous) => {
|
|
5794
|
-
if (current.root !== previous.root || !sameTarget(current.target, previous.target)) return false;
|
|
5795
|
-
if (current.mode === "insert" && previous.replacedSelection && (previous.mode === "replace" || previous.mode === "structural-replace") && (samePoint(previous.afterPoint, current.beforePoint) || current.fromBefore === previous.toAfter)) return true;
|
|
5796
|
-
if (current.mode === "insert" && previous.mode === "insert") return current.fromBefore === previous.toAfter || samePoint(previous.afterPoint, current.beforePoint) && current.fromBefore > previous.fromAfter && current.fromBefore < previous.toAfter;
|
|
5797
|
-
if (current.mode === "delete" && previous.mode === "delete") return current.toBefore === previous.fromAfter;
|
|
5798
|
-
return false;
|
|
5799
|
-
};
|
|
5800
|
-
const shouldMergeBatch = (currentBatch, current, previousBatch, previous, effectsCompatible = false) => {
|
|
5801
|
-
if (!effectsCompatible && (currentBatch.effects.length > 0 || previousBatch.effects.length > 0)) return false;
|
|
5802
|
-
if (!current || !previous || current.root !== previous.root || current.scope !== previous.scope) return false;
|
|
5803
|
-
if (current.kind === "text" && previous.kind === "text") return shouldMergeText(current, previous);
|
|
5804
|
-
return current.kind === "properties" && previous.kind === "properties" && sameTarget(current.target, previous.target);
|
|
5805
|
-
};
|
|
5806
|
-
const shouldMergeCompositionBatch = (current, previous) => Boolean(current && previous && (current.kind === "effects" || previous.kind === "effects" || current.root === previous.root) && current.scope === previous.scope);
|
|
5807
|
-
const changesNoRoot = ({ change }) => change.createRoots.size === 0 && change.deleteRoots.size === 0 && getInternalDocumentChangeRootKeys(change).length === 0;
|
|
5808
|
-
const shouldMergeExplicitBatch = (currentBatch, current, previousBatch, previous, isNativeTextInput, effectsCompatible = false) => {
|
|
5809
|
-
if (shouldMergeBatch(currentBatch, current, previousBatch, previous, effectsCompatible)) return true;
|
|
5810
|
-
if (effectsCompatible && !isNativeTextInput) return true;
|
|
5811
|
-
if (!current && !previous) return changesNoRoot(currentBatch) && changesNoRoot(previousBatch);
|
|
5812
|
-
if (!current || !previous || current.root !== previous.root || current.scope !== previous.scope) return false;
|
|
5813
|
-
if (!isNativeTextInput) return true;
|
|
5814
|
-
return current.kind === "text" && previous.kind === "text" && shouldMergeText(current, previous);
|
|
5815
|
-
};
|
|
5816
|
-
const mergeHistoryBatchGroups = (previous, current) => current?.kind === "effects" && previous ? previous : current?.kind === "text" && previous?.kind === "text" ? Object.freeze({
|
|
5817
|
-
...current,
|
|
5818
|
-
replacedSelection: previous.replacedSelection || current.replacedSelection
|
|
5819
|
-
}) : current;
|
|
5820
|
-
//#endregion
|
|
5821
5879
|
//#region src/history/history-selection.ts
|
|
5822
5880
|
const clonePoint = (point, root) => {
|
|
5823
5881
|
const nextRoot = point.root ?? root;
|
|
@@ -5871,18 +5929,25 @@ const shouldRestoreHistoricSelection = (root, caretRoot, batch, target) => {
|
|
|
5871
5929
|
const stepPlacedCaret = caretRoot !== root && batchHasRoot(batch, caretRoot);
|
|
5872
5930
|
return caretRootGoes || stepPlacedCaret;
|
|
5873
5931
|
};
|
|
5874
|
-
const
|
|
5932
|
+
const readHistoricSelection = (editor, batch, target) => {
|
|
5875
5933
|
const selection = target === "before" ? batch.selectionBefore : batch.selectionAfter;
|
|
5876
5934
|
const root = getHistoricSelectionRoot(batch, target) ?? SelectionApi.root(selection) ?? "main";
|
|
5877
5935
|
const owner = getEditorRuntimeOwner(editor);
|
|
5878
5936
|
const cloned = cloneSelection(selection, root);
|
|
5879
|
-
|
|
5937
|
+
return Object.freeze({
|
|
5938
|
+
root,
|
|
5939
|
+
selection: SelectionApi.isText(cloned) && cloned.marks ? withLandedMarks(owner, cloned, getEditorDocumentValue(owner), root) : cloned
|
|
5940
|
+
});
|
|
5941
|
+
};
|
|
5942
|
+
const restoreHistoricSelection = (editor, tx, batch, viewRoot, target) => {
|
|
5943
|
+
const { root, selection } = readHistoricSelection(editor, batch, target);
|
|
5880
5944
|
if (root === viewRoot) {
|
|
5881
|
-
tx.selection.set(
|
|
5945
|
+
tx.selection.set(selection);
|
|
5882
5946
|
return;
|
|
5883
5947
|
}
|
|
5948
|
+
const owner = getEditorRuntimeOwner(editor);
|
|
5884
5949
|
withEditorUpdateRootScope(owner, root, () => {
|
|
5885
|
-
getUpdateView(owner).selection.set(
|
|
5950
|
+
getUpdateView(owner).selection.set(selection);
|
|
5886
5951
|
});
|
|
5887
5952
|
};
|
|
5888
5953
|
//#endregion
|
|
@@ -6015,10 +6080,11 @@ const runHistoricUpdate = (editor, root, tx, batch, fn) => {
|
|
|
6015
6080
|
fn();
|
|
6016
6081
|
setTypedMarks(editor, null);
|
|
6017
6082
|
};
|
|
6018
|
-
const toChangeValue = (value) =>
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6083
|
+
const toChangeValue = (value) => {
|
|
6084
|
+
const changeValue = value.roots ? { roots: value.roots } : {};
|
|
6085
|
+
copyRoot(changeValue, "children", value, "children");
|
|
6086
|
+
return changeValue;
|
|
6087
|
+
};
|
|
6022
6088
|
const consumeHistoryBatch = (editor, tx, batch, direction, root) => {
|
|
6023
6089
|
const target = direction === "undo" ? "before" : "after";
|
|
6024
6090
|
const caretRoot = getSelection(getEditorRuntimeOwner(editor)) ? getCurrentSelectionRoot(editor) : void 0;
|
|
@@ -6081,8 +6147,7 @@ const prepareHistoryBatch = (action, commit, effects) => {
|
|
|
6081
6147
|
...native ? { native } : {}
|
|
6082
6148
|
}) : native?.composition === void 0 ? null : Object.freeze({
|
|
6083
6149
|
kind: "effects",
|
|
6084
|
-
native
|
|
6085
|
-
root: void 0
|
|
6150
|
+
native
|
|
6086
6151
|
});
|
|
6087
6152
|
const resolveSelectionRoot = (selection, fallback) => {
|
|
6088
6153
|
if (!selection) return void 0;
|
|
@@ -6192,6 +6257,7 @@ const createHistoryPlugin = (options = {}) => {
|
|
|
6192
6257
|
receipt: Object.freeze({
|
|
6193
6258
|
claimVersion,
|
|
6194
6259
|
group: identity,
|
|
6260
|
+
selection: null,
|
|
6195
6261
|
version: commit.version
|
|
6196
6262
|
}),
|
|
6197
6263
|
request: replaySettlement.request
|
|
@@ -6258,6 +6324,7 @@ const createHistoryPlugin = (options = {}) => {
|
|
|
6258
6324
|
return Object.freeze({
|
|
6259
6325
|
receipt: Object.freeze({
|
|
6260
6326
|
group: entry.identity,
|
|
6327
|
+
selection: readHistoricSelection(editor, batch, action === "undo" ? "before" : "after"),
|
|
6261
6328
|
version: commit.version
|
|
6262
6329
|
}),
|
|
6263
6330
|
request: replayRequest
|
|
@@ -6304,7 +6371,8 @@ const createHistoryPlugin = (options = {}) => {
|
|
|
6304
6371
|
const previousAutomaticGroupTime = LAST_AUTOMATIC_HISTORY_GROUP_TIME.get(editor);
|
|
6305
6372
|
const explicitMerge = commit.tags.includes("history-merge");
|
|
6306
6373
|
const settles = commit.tags.includes("document-settled") || getEditorCommitRest(commit) !== null;
|
|
6307
|
-
const
|
|
6374
|
+
const boundary = commit.tags.includes(HISTORY_BOUNDARY_TAG);
|
|
6375
|
+
const explicitPush = commit.tags.includes("history-push") || settles || boundary || carried !== null;
|
|
6308
6376
|
const textInput = commit.tags.includes("native-text-input") || commit.tags.includes("dom-text-input");
|
|
6309
6377
|
const composition = commit.tags.includes("composition");
|
|
6310
6378
|
const effectsCompatible = false;
|
|
@@ -6387,7 +6455,13 @@ const createHistoryPlugin = (options = {}) => {
|
|
|
6387
6455
|
anchorCeiling: anchorCapture?.anchorCeiling ?? 0,
|
|
6388
6456
|
carets,
|
|
6389
6457
|
clearRedos: true,
|
|
6390
|
-
group:
|
|
6458
|
+
group: boundary ? Object.freeze({
|
|
6459
|
+
...prepared.group ?? {
|
|
6460
|
+
kind: "document",
|
|
6461
|
+
roots: []
|
|
6462
|
+
},
|
|
6463
|
+
closed: true
|
|
6464
|
+
}) : settles && prepared.group ? Object.freeze({
|
|
6391
6465
|
...prepared.group,
|
|
6392
6466
|
closed: true
|
|
6393
6467
|
}) : prepared.group,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as HyperscriptEditorFixture, c as createText, i as createHyperscript, n as HyperscriptCreators, o as createEditor, r as HyperscriptShorthands, s as createEditorFixture, t as jsx } from "../index-
|
|
1
|
+
import { a as HyperscriptEditorFixture, c as createText, i as createHyperscript, n as HyperscriptCreators, o as createEditor, r as HyperscriptShorthands, s as createEditorFixture, t as jsx } from "../index-PDROnF1G.js";
|
|
2
2
|
export { type HyperscriptCreators, type HyperscriptEditorFixture, type HyperscriptShorthands, createEditor, createEditorFixture, createHyperscript, createText, jsx };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createText, i as createEditorFixture, n as createHyperscript, r as createEditor, t as jsx } from "../hyperscript-
|
|
1
|
+
import { a as createText, i as createEditorFixture, n as createHyperscript, r as createEditor, t as jsx } from "../hyperscript-CT6hhnAY.js";
|
|
2
2
|
export { createEditor, createEditorFixture, createHyperscript, createText, jsx };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as createEditor$1 } from "./create-editor-
|
|
1
|
+
import { Au as ElementApi, B as NodeApi, Jt as replace, Pu as TextApi, ku as SelectionApi, mp as RangeApi } from "./plugin-Bm6nsPHh.js";
|
|
2
|
+
import { a as createEditor$1 } from "./create-editor-DRRzGwaC.js";
|
|
3
3
|
//#region src/hyperscript/tokens.ts
|
|
4
4
|
/**
|
|
5
5
|
* A weak map to hold anchor tokens.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gd as PluginFactoryTypeProvider, Wd as PluginFactoryTypeLambda, kd as Plugin, kg as Range } from "./index-DHt8nZQ6.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
//#region src/yjs/core/editor-adapter.d.ts
|
|
4
4
|
/**
|
|
@@ -97,6 +97,7 @@ type YjsOptionsWithCompaction<TCursorData extends YjsRemoteCursorData = YjsRemot
|
|
|
97
97
|
}>;
|
|
98
98
|
}>;
|
|
99
99
|
declare const createBaseYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsPluginOptions<TCursorData>) => Plugin<Readonly<{
|
|
100
|
+
readonly contributions: true;
|
|
100
101
|
readonly activate: true;
|
|
101
102
|
readonly on: true;
|
|
102
103
|
readonly validate: true;
|
|
@@ -109,6 +110,7 @@ declare const createBaseYjsPlugin: <TCursorData extends YjsRemoteCursorData>(opt
|
|
|
109
110
|
name: "yjs";
|
|
110
111
|
}>>;
|
|
111
112
|
declare const createPresenceYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithAwareness<TCursorData>) => Plugin<Readonly<{
|
|
113
|
+
readonly contributions: true;
|
|
112
114
|
readonly activate: true;
|
|
113
115
|
readonly on: true;
|
|
114
116
|
readonly validate: true;
|
|
@@ -135,6 +137,7 @@ declare const createPresenceYjsPlugin: <TCursorData extends YjsRemoteCursorData>
|
|
|
135
137
|
name: "yjs";
|
|
136
138
|
}>>;
|
|
137
139
|
declare const createCompactionYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithCompaction<TCursorData>) => Plugin<Readonly<{
|
|
140
|
+
readonly contributions: true;
|
|
138
141
|
readonly activate: true;
|
|
139
142
|
readonly on: true;
|
|
140
143
|
readonly validate: true;
|
|
@@ -148,6 +151,7 @@ declare const createCompactionYjsPlugin: <TCursorData extends YjsRemoteCursorDat
|
|
|
148
151
|
name: "yjs";
|
|
149
152
|
}>>;
|
|
150
153
|
declare const createPresenceCompactionYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithAwareness<TCursorData> & YjsOptionsWithCompaction<TCursorData>) => Plugin<Readonly<{
|
|
154
|
+
readonly contributions: true;
|
|
151
155
|
readonly activate: true;
|
|
152
156
|
readonly on: true;
|
|
153
157
|
readonly validate: true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mc as Editor, Td as NodeKey, kf as Value, kg as Range, yg as Anchor } from "./index-DHt8nZQ6.js";
|
|
2
2
|
//#region src/internal/view/view-source.d.ts
|
|
3
3
|
type ViewSourcePhase = 'project' | 'read' | 'resolve';
|
|
4
4
|
/** Diagnostic emitted when an optional view source is deactivated. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bg as Point, Cs as SchemaProperty, Fh as Node$1, Mc as Editor, Oh as Descendant, Rc as EditorCommand, Tc as AnyEditor, Td as NodeKey, Wg as Path, cn as ContentSlice, kd as Plugin, kf as Value, kg as Range$1, mf as RootKey, mh as SelectionAssociation, rc as Element$1, tl as EditorCoreStateView, uh as NodeSelection, yc as Text$1 } from "./index-DHt8nZQ6.js";
|
|
2
2
|
import { StandardBehaviorOptions } from "scroll-into-view-if-needed";
|
|
3
3
|
//#region src/dom/utils/dom.d.ts
|
|
4
4
|
/**
|
|
@@ -467,8 +467,11 @@ interface DOMApi {
|
|
|
467
467
|
assertPath: (node: Node$1) => Path;
|
|
468
468
|
/**
|
|
469
469
|
* Focus the editor's view. The root's `nodeSelectionFocus` element takes
|
|
470
|
-
* focus while
|
|
471
|
-
*
|
|
470
|
+
* focus while no range is shown into the root and the root's own selection
|
|
471
|
+
* is none or a node selection of its top-level blocks, including one the
|
|
472
|
+
* root kept while the caret was in another root. A range shown into the root
|
|
473
|
+
* stays shown. Inside an open update or read, such a root's editable takes
|
|
474
|
+
* focus instead.
|
|
472
475
|
*/
|
|
473
476
|
focus: (options?: {
|
|
474
477
|
retries?: number;
|