plitejs 54.0.0-beta.2 → 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/dist/{internal/view/annotation-store-metrics.js → annotation-store-metrics-Ccjkef45.js} +1 -1
- package/dist/annotations/index.d.ts +1 -1
- package/dist/annotations/index.js +1 -1
- package/dist/authored/index.d.ts +596 -9
- package/dist/authored/index.js +18557 -4
- package/dist/{core/authored-veto.js → authored-veto-DSnQcHGR.js} +2 -2
- package/dist/{internal/browser-protocol.js → browser-protocol-pvt4HFF7.js} +1 -1
- package/dist/comparison-plan-CEQL0ooW.js +1338 -0
- package/dist/{diff/lib/comparison-types.d.ts → comparison-types-Dt-unJZY.d.ts} +11 -6
- package/dist/create-editor-CkHtPWXV.js +1107 -0
- package/dist/diff/index.d.ts +31 -3
- package/dist/diff/index.js +1747 -1
- package/dist/dom/index.d.ts +2 -19
- package/dist/dom/index.js +2 -16
- package/dist/dom-Cgfscvnm.js +9220 -0
- package/dist/{core/same-result.js → editor-owner-IUmkTeXz.js} +77 -2
- package/dist/{core/editor-view-lifetime.js → editor-view-lifetime-GJKa_QGh.js} +1 -1
- package/dist/history/index.d.ts +169 -3
- package/dist/history/index.js +6717 -2
- package/dist/hyperscript/index.d.ts +1 -19
- package/dist/hyperscript/index.js +1 -8
- package/dist/{hyperscript/creators.js → hyperscript-FPuoArEi.js} +134 -8
- package/dist/index-BpQx2UG4.d.ts +1093 -0
- package/dist/{yjs/core/plugin.d.ts → index-Cw-oC2ps.d.ts} +88 -5
- package/dist/{annotations/store.d.ts → index-DPWyk3lG.d.ts} +21 -6
- 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 +1 -50
- package/dist/index.js +4 -34
- package/dist/internal/index.d.ts +2 -54
- package/dist/internal/index.js +156 -52
- package/dist/{internal/view/mapped-view-store.js → mapped-view-store-ld-6uxEU.js} +2 -3
- package/dist/{core/native-grouping-input.js → native-grouping-input-DMNcsIaW.js} +2 -2
- package/dist/pagination/index.d.ts +1 -7
- package/dist/pagination/index.js +1 -693
- package/dist/pagination/react.d.ts +2 -4
- package/dist/pagination/react.js +436 -30
- package/dist/pagination-D_A8iPJP.js +1021 -0
- package/dist/plugin-DWzkJbnJ.js +50999 -0
- package/dist/{react/range-geometry.d.ts → range-geometry-BLAHRE11.d.ts} +2 -2
- package/dist/{react/range-geometry.js → range-geometry-BjeLHOnl.js} +23 -18
- package/dist/react/index.d.ts +5 -97
- package/dist/react/index.js +7 -72
- package/dist/react/virtualized.d.ts +2 -4
- package/dist/react/virtualized.js +146 -7
- package/dist/react-DZ15gmz2.js +1018 -0
- package/dist/{core/change/retraction.js → retraction-BMem8Rfk.js} +16 -4
- package/dist/src-cT1OTKP_.js +1386 -0
- package/dist/{internal/view/stable-id-mapped-source.js → store-Cz2mXyDe.js} +240 -3
- package/dist/testing/index.d.ts +182 -8
- package/dist/testing/index.js +95 -8
- package/dist/use-editor-dom-scope-BbMDSCpW.js +28354 -0
- package/dist/yjs/index.d.ts +1 -4
- package/dist/yjs/index.js +1 -2
- package/dist/yjs/react/index.d.ts +25 -5
- package/dist/yjs/react/index.js +84 -3
- package/dist/yjs-DOK-m7kl.js +13413 -0
- package/package.json +1 -1
- package/dist/annotations/store.js +0 -244
- package/dist/authored/authored.d.ts +0 -116
- package/dist/authored/authored.js +0 -1271
- package/dist/authored/changes.js +0 -365
- package/dist/authored/comparison.d.ts +0 -41
- package/dist/authored/comparison.js +0 -270
- package/dist/authored/decision-window.js +0 -42
- package/dist/authored/decision.js +0 -306
- package/dist/authored/facts/admission.js +0 -388
- package/dist/authored/facts/compact.d.ts +0 -2
- package/dist/authored/facts/compact.js +0 -91
- package/dist/authored/facts/dependencies.d.ts +0 -5
- package/dist/authored/facts/dependencies.js +0 -66
- package/dist/authored/facts/editing.js +0 -12
- package/dist/authored/facts/facts.d.ts +0 -8
- package/dist/authored/facts/facts.js +0 -535
- package/dist/authored/facts/records.d.ts +0 -28
- package/dist/authored/facts/records.js +0 -226
- package/dist/authored/facts/settle.js +0 -529
- package/dist/authored/format.d.ts +0 -34
- package/dist/authored/format.js +0 -175
- package/dist/authored/ledger/book.js +0 -809
- package/dist/authored/ledger/cards.js +0 -223
- package/dist/authored/ledger/ledger.js +0 -830
- package/dist/authored/ledger/level.js +0 -1081
- package/dist/authored/ledger/links.js +0 -20
- package/dist/authored/ledger/pairs.js +0 -334
- package/dist/authored/ledger/places.js +0 -524
- package/dist/authored/ledger/preview-lens.js +0 -252
- package/dist/authored/ledger/projection.js +0 -163
- package/dist/authored/ledger/roots.js +0 -11
- package/dist/authored/ledger/runs.js +0 -480
- package/dist/authored/ledger/slots.js +0 -330
- package/dist/authored/ledger/work.js +0 -66
- package/dist/authored/refusal.d.ts +0 -33
- package/dist/authored/refusal.js +0 -188
- package/dist/authored/resolve-schema.js +0 -62
- package/dist/authored/tree/alignment.js +0 -456
- package/dist/authored/tree/carried.js +0 -205
- package/dist/authored/tree/command-values.js +0 -344
- package/dist/authored/tree/cuts.js +0 -320
- package/dist/authored/tree/grid.js +0 -49
- package/dist/authored/tree/halves.js +0 -120
- package/dist/authored/tree/holders.js +0 -345
- package/dist/authored/tree/holds.js +0 -135
- package/dist/authored/tree/layers.d.ts +0 -49
- package/dist/authored/tree/layers.js +0 -354
- package/dist/authored/tree/marks.d.ts +0 -136
- package/dist/authored/tree/marks.js +0 -263
- package/dist/authored/tree/proposed.js +0 -212
- package/dist/authored/tree/readiness.js +0 -545
- package/dist/authored/tree/record-completion.js +0 -423
- package/dist/authored/tree/record.js +0 -2908
- package/dist/authored/tree/reserves.js +0 -449
- package/dist/authored/tree/resolve.d.ts +0 -9
- package/dist/authored/tree/resolve.js +0 -1860
- package/dist/authored/tree/shown.js +0 -153
- package/dist/authored/tree/spare-lines.js +0 -119
- package/dist/authored/tree/spares.js +0 -61
- package/dist/authored/types.d.ts +0 -177
- package/dist/core/anchor-state.d.ts +0 -15
- package/dist/core/anchor-state.js +0 -792
- package/dist/core/anchor.d.ts +0 -34
- package/dist/core/anchor.js +0 -843
- package/dist/core/authored-document-capability.d.ts +0 -106
- package/dist/core/authored-document-capability.js +0 -6
- package/dist/core/authored-runtime.d.ts +0 -10
- package/dist/core/authored-runtime.js +0 -67
- package/dist/core/authored-veto.d.ts +0 -30
- package/dist/core/change/builder.d.ts +0 -546
- package/dist/core/change/builder.js +0 -1120
- package/dist/core/change/carried-projection.js +0 -1518
- package/dist/core/change/carried-run.d.ts +0 -26
- package/dist/core/change/carried-run.js +0 -251
- package/dist/core/change/carry-program.js +0 -537
- package/dist/core/change/classification.d.ts +0 -22
- package/dist/core/change/classification.js +0 -205
- package/dist/core/change/cross-rule.js +0 -238
- package/dist/core/change/cross.js +0 -577
- package/dist/core/change/document-change.d.ts +0 -137
- package/dist/core/change/document-change.js +0 -872
- package/dist/core/change/document-index.d.ts +0 -117
- package/dist/core/change/document-index.js +0 -542
- package/dist/core/change/draft-facts.js +0 -323
- package/dist/core/change/enclosure.d.ts +0 -12
- package/dist/core/change/enclosure.js +0 -272
- package/dist/core/change/join.js +0 -751
- package/dist/core/change/json.d.ts +0 -4
- package/dist/core/change/json.js +0 -26
- package/dist/core/change/lazy-root.d.ts +0 -1
- package/dist/core/change/lazy-root.js +0 -73
- package/dist/core/change/lineage.d.ts +0 -49
- package/dist/core/change/lineage.js +0 -390
- package/dist/core/change/mapping.d.ts +0 -31
- package/dist/core/change/mapping.js +0 -186
- package/dist/core/change/new-letters.d.ts +0 -14
- package/dist/core/change/new-letters.js +0 -139
- package/dist/core/change/range-association.js +0 -10
- package/dist/core/change/read-back.d.ts +0 -7
- package/dist/core/change/read-back.js +0 -7
- package/dist/core/change/record.d.ts +0 -59
- package/dist/core/change/record.js +0 -346
- package/dist/core/change/root-change.d.ts +0 -180
- package/dist/core/change/root-change.js +0 -3544
- package/dist/core/change/slice-facts.js +0 -89
- package/dist/core/change/text-splices.js +0 -98
- package/dist/core/change/tokens.d.ts +0 -97
- package/dist/core/change/tokens.js +0 -449
- package/dist/core/change/transform.d.ts +0 -36
- package/dist/core/change/transform.js +0 -97
- package/dist/core/change/wrap-fidelity.js +0 -295
- package/dist/core/change-events.js +0 -223
- package/dist/core/clone.js +0 -28
- package/dist/core/command-definition.d.ts +0 -25
- package/dist/core/command-definition.js +0 -48
- package/dist/core/command-document.d.ts +0 -4
- package/dist/core/command-document.js +0 -20
- package/dist/core/command-frame.js +0 -628
- package/dist/core/command-registry.d.ts +0 -36
- package/dist/core/command-registry.js +0 -283
- package/dist/core/commit-publication.js +0 -40
- package/dist/core/commit.d.ts +0 -26
- package/dist/core/commit.js +0 -686
- package/dist/core/composition-stamp.d.ts +0 -14
- package/dist/core/composition-stamp.js +0 -79
- package/dist/core/content-completion.d.ts +0 -4
- package/dist/core/content-completion.js +0 -343
- package/dist/core/content-landing.js +0 -124
- package/dist/core/content-slice-roots.js +0 -36
- package/dist/core/content-slice.d.ts +0 -38
- package/dist/core/content-slice.js +0 -253
- package/dist/core/content.js +0 -18
- package/dist/core/correction.js +0 -25
- package/dist/core/default-storage.js +0 -53
- package/dist/core/document-admission.d.ts +0 -4
- package/dist/core/document-admission.js +0 -64
- package/dist/core/document-change.d.ts +0 -3
- package/dist/core/document-recorder.d.ts +0 -6
- package/dist/core/document-recorder.js +0 -67
- package/dist/core/document-shape.d.ts +0 -68
- package/dist/core/document-shape.js +0 -173
- package/dist/core/document-view-read.d.ts +0 -16
- package/dist/core/document-view-read.js +0 -36
- package/dist/core/draft-track.d.ts +0 -3
- package/dist/core/draft-track.js +0 -90
- package/dist/core/editor-commands.d.ts +0 -99
- package/dist/core/editor-commands.js +0 -505
- package/dist/core/editor-lifecycle-api.d.ts +0 -8
- package/dist/core/editor-lifecycle-api.js +0 -219
- package/dist/core/editor-lifetime.js +0 -12
- package/dist/core/editor-owner.d.ts +0 -24
- package/dist/core/editor-owner.js +0 -78
- package/dist/core/editor-read-execution.d.ts +0 -6
- package/dist/core/editor-read-execution.js +0 -64
- package/dist/core/editor-read-runtime.js +0 -176
- package/dist/core/editor-reads.d.ts +0 -128
- package/dist/core/editor-reads.js +0 -63
- package/dist/core/editor-runtime.d.ts +0 -112
- package/dist/core/editor-runtime.js +0 -20
- package/dist/core/editor-schema.d.ts +0 -314
- package/dist/core/editor-schema.js +0 -2295
- package/dist/core/element-owned-root-index.d.ts +0 -4
- package/dist/core/element-owned-root-index.js +0 -353
- package/dist/core/get-content-slice.js +0 -118
- package/dist/core/get-fragment.js +0 -22
- package/dist/core/identity-owner.js +0 -697
- package/dist/core/import-content-slice.js +0 -26
- package/dist/core/initial-value.js +0 -87
- package/dist/core/insert-limit.js +0 -81
- package/dist/core/is-empty-element.js +0 -20
- package/dist/core/json-fingerprint.js +0 -16
- package/dist/core/landing.d.ts +0 -11
- package/dist/core/landing.js +0 -279
- package/dist/core/lifecycle-error.d.ts +0 -11
- package/dist/core/lifecycle-error.js +0 -68
- package/dist/core/listener-state.d.ts +0 -1
- package/dist/core/listener-state.js +0 -59
- package/dist/core/measured-sequence.d.ts +0 -43
- package/dist/core/measured-sequence.js +0 -404
- package/dist/core/missing-reference.js +0 -15
- package/dist/core/node-property-mutation.js +0 -10
- package/dist/core/node-selection.js +0 -85
- package/dist/core/node-write-veto.d.ts +0 -37
- package/dist/core/node-write-veto.js +0 -17
- package/dist/core/persisted-document.d.ts +0 -6
- package/dist/core/persisted-document.js +0 -39
- package/dist/core/persistent-map.js +0 -139
- package/dist/core/plain-text.d.ts +0 -32
- package/dist/core/plain-text.js +0 -92
- package/dist/core/plugin-dispatch.d.ts +0 -21
- package/dist/core/plugin-dispatch.js +0 -166
- package/dist/core/plugin-point.d.ts +0 -6
- package/dist/core/plugin-point.js +0 -21
- package/dist/core/plugin-registry.d.ts +0 -78
- package/dist/core/plugin-registry.js +0 -485
- package/dist/core/plugin-slot.d.ts +0 -23
- package/dist/core/plugin-slot.js +0 -30
- package/dist/core/plugin.d.ts +0 -125
- package/dist/core/plugin.js +0 -1485
- package/dist/core/prefix-occupant-join.js +0 -52
- package/dist/core/profiling.js +0 -18
- package/dist/core/property-validity.d.ts +0 -14
- package/dist/core/property-validity.js +0 -65
- package/dist/core/public-root.d.ts +0 -10
- package/dist/core/public-root.js +0 -50
- package/dist/core/public-state.d.ts +0 -191
- package/dist/core/public-state.js +0 -6772
- package/dist/core/read-definition.js +0 -22
- package/dist/core/read-registry.js +0 -127
- package/dist/core/record-store.d.ts +0 -12
- package/dist/core/record-store.js +0 -297
- package/dist/core/refusal.d.ts +0 -1
- package/dist/core/refusal.js +0 -40
- package/dist/core/representation.d.ts +0 -11
- package/dist/core/representation.js +0 -844
- package/dist/core/resolved-token-cursor.d.ts +0 -21
- package/dist/core/resolved-token-cursor.js +0 -294
- package/dist/core/root-entries.js +0 -121
- package/dist/core/root-ownership.d.ts +0 -19
- package/dist/core/root-ownership.js +0 -354
- package/dist/core/root-target.d.ts +0 -7
- package/dist/core/root-target.js +0 -281
- package/dist/core/same-result.d.ts +0 -18
- package/dist/core/schema-compiler.d.ts +0 -345
- package/dist/core/schema-compiler.js +0 -3166
- package/dist/core/schema-contribution-registry.d.ts +0 -12
- package/dist/core/schema-contribution-registry.js +0 -88
- package/dist/core/schema-definition.d.ts +0 -307
- package/dist/core/schema-definition.js +0 -628
- package/dist/core/schema-source.internal.d.ts +0 -49
- package/dist/core/schema-validation.d.ts +0 -11
- package/dist/core/schema-validation.js +0 -85
- package/dist/core/screen-reader-announcement.d.ts +0 -13
- package/dist/core/screen-reader-announcement.js +0 -17
- package/dist/core/selection-protocol.d.ts +0 -38
- package/dist/core/selection-protocol.js +0 -523
- package/dist/core/selection-state.js +0 -9
- package/dist/core/semantic-update-method.d.ts +0 -11
- package/dist/core/semantic-update-method.js +0 -26
- package/dist/core/set-root.d.ts +0 -3
- package/dist/core/set-root.js +0 -244
- package/dist/core/slice-end-matter.js +0 -77
- package/dist/core/slice-fit/compiled-slice-fitter.d.ts +0 -56
- package/dist/core/slice-fit/compiled-slice-fitter.js +0 -2087
- package/dist/core/slice-fit/fit-report.d.ts +0 -36
- package/dist/core/slice-fit/fit-report.js +0 -122
- package/dist/core/slice-fit/frontier.js +0 -98
- package/dist/core/slice-fit/origin.js +0 -57
- package/dist/core/slice-fit/provenance.d.ts +0 -30
- package/dist/core/slice-fit/provenance.js +0 -245
- package/dist/core/slice-identities.js +0 -21
- package/dist/core/slice-landing-types.d.ts +0 -61
- package/dist/core/slice-landing.js +0 -124
- package/dist/core/snapshot-index.d.ts +0 -13
- package/dist/core/snapshot-index.js +0 -860
- package/dist/core/state-field.d.ts +0 -12
- package/dist/core/state-field.js +0 -102
- package/dist/core/state-fields.js +0 -36
- package/dist/core/survival.js +0 -61
- package/dist/core/target-runtime.d.ts +0 -5
- package/dist/core/target-runtime.js +0 -42
- package/dist/core/transaction-values.d.ts +0 -47
- package/dist/core/transaction-values.js +0 -66
- package/dist/core/transfer-guard.js +0 -299
- package/dist/core/transfer-types.d.ts +0 -170
- package/dist/core/transfer.d.ts +0 -72
- package/dist/core/transfer.js +0 -655
- package/dist/core/tx-only.d.ts +0 -64
- package/dist/core/tx-only.js +0 -84
- package/dist/core/unique-values.js +0 -298
- package/dist/core/update-context.js +0 -28
- package/dist/core/update-policy.d.ts +0 -17
- package/dist/core/update-policy.js +0 -45
- package/dist/core/value-codec.d.ts +0 -35
- package/dist/core/value-codec.js +0 -240
- package/dist/core/view-carets.d.ts +0 -39
- package/dist/core/view-carets.js +0 -676
- package/dist/core/view-presentation.d.ts +0 -9
- package/dist/core/view-presentation.js +0 -70
- package/dist/core/work.d.ts +0 -192
- package/dist/core/work.js +0 -122
- package/dist/core/writable-text.js +0 -37
- package/dist/create-editor.d.ts +0 -187
- package/dist/create-editor.js +0 -281
- package/dist/diff/lib/compare.d.ts +0 -33
- package/dist/diff/lib/compare.js +0 -459
- package/dist/diff/lib/comparison-align.js +0 -324
- package/dist/diff/lib/comparison-index.js +0 -160
- package/dist/diff/lib/comparison-internal.js +0 -108
- package/dist/diff/lib/comparison-matcher.js +0 -1221
- package/dist/diff/lib/comparison-moves.js +0 -151
- package/dist/diff/lib/comparison-plan.js +0 -556
- package/dist/diff/lib/index.d.ts +0 -3
- package/dist/dom/dom-soft-line-end.d.ts +0 -3
- package/dist/dom/dom-soft-line-end.js +0 -295
- package/dist/dom/internal/index.d.ts +0 -15
- package/dist/dom/plugin/data-transfer-format.d.ts +0 -90
- package/dist/dom/plugin/data-transfer-format.js +0 -525
- package/dist/dom/plugin/dom-clipboard-runtime.d.ts +0 -50
- package/dist/dom/plugin/dom-clipboard-runtime.js +0 -482
- package/dist/dom/plugin/dom-coverage.d.ts +0 -140
- package/dist/dom/plugin/dom-coverage.js +0 -443
- package/dist/dom/plugin/dom-drag-scroll.js +0 -176
- package/dist/dom/plugin/dom-drag.d.ts +0 -54
- package/dist/dom/plugin/dom-drag.js +0 -507
- package/dist/dom/plugin/dom-editor.d.ts +0 -421
- package/dist/dom/plugin/dom-editor.js +0 -1316
- package/dist/dom/plugin/dom-event-range-targets.js +0 -39
- package/dist/dom/plugin/dom-geometry.d.ts +0 -11
- package/dist/dom/plugin/dom-geometry.js +0 -888
- package/dist/dom/plugin/dom-input-runtime.d.ts +0 -1
- package/dist/dom/plugin/dom-input-runtime.js +0 -571
- package/dist/dom/plugin/dom-integrity-observer.js +0 -436
- package/dist/dom/plugin/dom-node-path.js +0 -61
- package/dist/dom/plugin/dom-phase-scheduler.d.ts +0 -1
- package/dist/dom/plugin/dom-phase-scheduler.js +0 -284
- package/dist/dom/plugin/dom-root-runtime.d.ts +0 -10
- package/dist/dom/plugin/dom-root-runtime.js +0 -716
- package/dist/dom/plugin/dom-sync-mutation-ownership.d.ts +0 -1
- package/dist/dom/plugin/dom-sync-mutation-ownership.js +0 -120
- package/dist/dom/plugin/dom-text-flow-index.js +0 -396
- package/dist/dom/plugin/dom-text-freshness.js +0 -188
- package/dist/dom/plugin/dom-text-proofs.d.ts +0 -2
- package/dist/dom/plugin/dom-text-proofs.js +0 -350
- package/dist/dom/plugin/dom-view-caret.js +0 -28
- package/dist/dom/plugin/with-dom.d.ts +0 -53
- package/dist/dom/plugin/with-dom.js +0 -101
- package/dist/dom/utils/constants.d.ts +0 -5
- package/dist/dom/utils/constants.js +0 -5
- package/dist/dom/utils/diff-text.d.ts +0 -51
- package/dist/dom/utils/diff-text.js +0 -264
- package/dist/dom/utils/dom.d.ts +0 -104
- package/dist/dom/utils/dom.js +0 -257
- package/dist/dom/utils/drag-session.d.ts +0 -2
- package/dist/dom/utils/drag-session.js +0 -115
- package/dist/dom/utils/drop-indicator.d.ts +0 -18
- package/dist/dom/utils/drop-indicator.js +0 -36
- package/dist/dom/utils/environment.d.ts +0 -12
- package/dist/dom/utils/environment.js +0 -118
- package/dist/dom/utils/hotkey-match.d.ts +0 -36
- package/dist/dom/utils/hotkey-match.js +0 -208
- package/dist/dom/utils/hotkeys.d.ts +0 -32
- package/dist/dom/utils/hotkeys.js +0 -121
- package/dist/dom/utils/key.d.ts +0 -14
- package/dist/dom/utils/key.js +0 -18
- package/dist/dom/utils/plite-dom-markers.d.ts +0 -26
- package/dist/dom/utils/plite-dom-markers.js +0 -25
- package/dist/dom/utils/selection-writes.d.ts +0 -18
- package/dist/dom/utils/selection-writes.js +0 -63
- package/dist/dom/utils/weak-maps.d.ts +0 -2
- package/dist/dom/utils/weak-maps.js +0 -51
- package/dist/editor/above.js +0 -30
- package/dist/editor/add-mark.js +0 -79
- package/dist/editor/adjacent-character-point.js +0 -120
- package/dist/editor/after.js +0 -37
- package/dist/editor/before.js +0 -124
- package/dist/editor/block-void-break.js +0 -20
- package/dist/editor/correct-document.js +0 -225
- package/dist/editor/delete-backward.js +0 -64
- package/dist/editor/delete-forward.js +0 -11
- package/dist/editor/delete-fragment.js +0 -40
- package/dist/editor/edges.js +0 -5
- package/dist/editor/element-read-only.js +0 -35
- package/dist/editor/end.d.ts +0 -7
- package/dist/editor/end.js +0 -5
- package/dist/editor/exit-break.js +0 -51
- package/dist/editor/first.js +0 -8
- package/dist/editor/get-void.js +0 -9
- package/dist/editor/has-blocks.js +0 -6
- package/dist/editor/has-inlines.js +0 -6
- package/dist/editor/has-path.js +0 -5
- package/dist/editor/has-texts.js +0 -5
- package/dist/editor/insert-break.js +0 -77
- package/dist/editor/insert-default-child.js +0 -55
- package/dist/editor/insert-soft-break.js +0 -14
- package/dist/editor/insert-text.js +0 -83
- package/dist/editor/is-block.js +0 -5
- package/dist/editor/is-edge.js +0 -5
- package/dist/editor/is-editor.js +0 -13
- package/dist/editor/is-empty.js +0 -6
- package/dist/editor/is-end.js +0 -9
- package/dist/editor/is-start.js +0 -9
- package/dist/editor/last.js +0 -20
- package/dist/editor/leaf.js +0 -9
- package/dist/editor/levels.js +0 -21
- package/dist/editor/next.js +0 -46
- package/dist/editor/node.js +0 -9
- package/dist/editor/nodes.js +0 -106
- package/dist/editor/parent.js +0 -14
- package/dist/editor/path.js +0 -26
- package/dist/editor/point.js +0 -52
- package/dist/editor/positions.js +0 -322
- package/dist/editor/previous.js +0 -48
- package/dist/editor/project-range.js +0 -6
- package/dist/editor/range.js +0 -12
- package/dist/editor/remove-mark.js +0 -65
- package/dist/editor/should-merge-nodes-remove-prev-node.js +0 -11
- package/dist/editor/string.js +0 -35
- package/dist/editor/toggle-mark.js +0 -71
- package/dist/editor/unhang-range.js +0 -71
- package/dist/editor-runtime-view.d.ts +0 -33
- package/dist/editor-runtime-view.js +0 -788
- package/dist/history/history-carets.js +0 -127
- package/dist/history/history-character-map.js +0 -425
- package/dist/history/history-codec.js +0 -176
- package/dist/history/history-merge-policy.js +0 -164
- package/dist/history/history-plugin.d.ts +0 -71
- package/dist/history/history-plugin.js +0 -814
- package/dist/history/history-replay.js +0 -799
- package/dist/history/history-selection.js +0 -75
- package/dist/history/history-state.js +0 -1287
- package/dist/history/history.d.ts +0 -112
- package/dist/history/history.js +0 -29
- package/dist/hyperscript/creators.d.ts +0 -51
- package/dist/hyperscript/hyperscript.d.ts +0 -36
- package/dist/hyperscript/hyperscript.js +0 -66
- package/dist/hyperscript/tokens.d.ts +0 -31
- package/dist/hyperscript/tokens.js +0 -63
- package/dist/interfaces/decoration.d.ts +0 -35
- package/dist/interfaces/editor.d.ts +0 -2783
- package/dist/interfaces/editor.js +0 -348
- package/dist/interfaces/element.d.ts +0 -66
- package/dist/interfaces/element.js +0 -34
- package/dist/interfaces/index.d.ts +0 -13
- package/dist/interfaces/json.d.ts +0 -7
- package/dist/interfaces/location.d.ts +0 -50
- package/dist/interfaces/location.js +0 -26
- package/dist/interfaces/node.d.ts +0 -306
- package/dist/interfaces/node.js +0 -339
- package/dist/interfaces/path.d.ts +0 -118
- package/dist/interfaces/path.js +0 -116
- package/dist/interfaces/point.d.ts +0 -45
- package/dist/interfaces/point.js +0 -32
- package/dist/interfaces/range.d.ts +0 -80
- package/dist/interfaces/range.js +0 -85
- package/dist/interfaces/schema-validation.d.ts +0 -33
- package/dist/interfaces/schema.d.ts +0 -870
- package/dist/interfaces/selection.d.ts +0 -61
- package/dist/interfaces/selection.js +0 -106
- package/dist/interfaces/text.d.ts +0 -68
- package/dist/interfaces/text.js +0 -52
- package/dist/interfaces/transforms/node.d.ts +0 -222
- package/dist/interfaces/transforms/selection.d.ts +0 -48
- package/dist/interfaces/transforms/text.d.ts +0 -58
- package/dist/internal/browser-protocol.d.ts +0 -5
- package/dist/internal/document-range.d.ts +0 -9
- package/dist/internal/document-range.js +0 -31
- package/dist/internal/editor-options.d.ts +0 -37
- package/dist/internal/editor-options.js +0 -36
- package/dist/internal/fail-invariant.d.ts +0 -4
- package/dist/internal/fail-invariant.js +0 -6
- package/dist/internal/get-defined.js +0 -7
- package/dist/internal/law-check.js +0 -7
- package/dist/internal/range-text-marks.js +0 -31
- package/dist/internal/root-location.d.ts +0 -23
- package/dist/internal/root-location.js +0 -86
- package/dist/internal/text-run.d.ts +0 -13
- package/dist/internal/text-run.js +0 -44
- package/dist/internal/view/annotation-store-metrics.d.ts +0 -11
- package/dist/internal/view/view-source.d.ts +0 -20
- package/dist/pagination/page-composition.internal.js +0 -313
- package/dist/pagination/page-geometry.internal.js +0 -99
- package/dist/pagination/page-layout-engine-invalidation.internal.js +0 -20
- package/dist/pagination/page-mount-plan.js +0 -84
- package/dist/pagination/paged-view-lines.js +0 -163
- package/dist/range-projection.d.ts +0 -7
- package/dist/range-projection.js +0 -50
- package/dist/react/components/dom-coverage-boundary.d.ts +0 -14
- package/dist/react/components/dom-coverage-boundary.js +0 -143
- package/dist/react/components/editable-descendant-binding.js +0 -70
- package/dist/react/components/editable-dom-commit-fence.js +0 -107
- package/dist/react/components/editable-element-placement.d.ts +0 -2
- package/dist/react/components/editable-element-placement.js +0 -117
- package/dist/react/components/editable-external-text.js +0 -47
- package/dist/react/components/editable-node-equality.js +0 -25
- package/dist/react/components/editable-rendered-element.d.ts +0 -3
- package/dist/react/components/editable-rendered-element.js +0 -61
- package/dist/react/components/editable-text-blocks.d.ts +0 -192
- package/dist/react/components/editable-text-blocks.js +0 -896
- package/dist/react/components/editable-text-containers.d.ts +0 -3
- package/dist/react/components/editable-text-containers.js +0 -28
- package/dist/react/components/editable-text-flow.js +0 -1039
- package/dist/react/components/editable-text-pieces.d.ts +0 -7
- package/dist/react/components/editable-text-pieces.js +0 -193
- package/dist/react/components/editable-text.d.ts +0 -80
- package/dist/react/components/editable-text.js +0 -322
- package/dist/react/components/editable.d.ts +0 -35
- package/dist/react/components/editable.js +0 -406
- package/dist/react/components/editor-announcement-live-region.js +0 -113
- package/dist/react/components/plite-element.d.ts +0 -18
- package/dist/react/components/plite-element.js +0 -54
- package/dist/react/components/plite-leaf.d.ts +0 -18
- package/dist/react/components/plite-leaf.js +0 -21
- package/dist/react/components/plite-placeholder.d.ts +0 -19
- package/dist/react/components/plite-placeholder.js +0 -39
- package/dist/react/components/plite-spacer.js +0 -14
- package/dist/react/components/plite-text.d.ts +0 -23
- package/dist/react/components/plite-text.js +0 -32
- package/dist/react/components/plite-void-shell.js +0 -49
- package/dist/react/components/plite.d.ts +0 -45
- package/dist/react/components/plite.js +0 -297
- package/dist/react/components/text-string.js +0 -18
- package/dist/react/components/windowed-editable.internal.js +0 -51
- package/dist/react/components/zero-width-string.js +0 -26
- package/dist/react/context.js +0 -11
- package/dist/react/decoration-context.d.ts +0 -2
- package/dist/react/decoration-context.js +0 -22
- package/dist/react/decoration-source.d.ts +0 -11
- package/dist/react/decoration-source.js +0 -1030
- package/dist/react/dom-text-sync.d.ts +0 -24
- package/dist/react/dom-text-sync.js +0 -48
- package/dist/react/editable/android-composition.d.ts +0 -3
- package/dist/react/editable/android-composition.js +0 -496
- package/dist/react/editable/browser-handle.js +0 -515
- package/dist/react/editable/caret-engine.js +0 -681
- package/dist/react/editable/clipboard-input-strategy.js +0 -632
- package/dist/react/editable/composition-lease.d.ts +0 -3
- package/dist/react/editable/composition-lease.js +0 -350
- package/dist/react/editable/composition-state.js +0 -716
- package/dist/react/editable/content-root-boundaries.js +0 -79
- package/dist/react/editable/content-root-coordinate-navigation.js +0 -28
- package/dist/react/editable/content-root-navigation-actions.js +0 -190
- package/dist/react/editable/content-root-navigation.js +0 -819
- package/dist/react/editable/content-root-owner-target.js +0 -36
- package/dist/react/editable/content-root-owners.js +0 -191
- package/dist/react/editable/content-root-vertical-geometry.js +0 -60
- package/dist/react/editable/decoration-repair-bridge.js +0 -29
- package/dist/react/editable/dom-coverage-selection.js +0 -158
- package/dist/react/editable/dom-coverage-vertical-selection.js +0 -446
- package/dist/react/editable/dom-input-event.js +0 -14
- package/dist/react/editable/dom-repair-queue.d.ts +0 -7
- package/dist/react/editable/dom-repair-queue.js +0 -543
- package/dist/react/editable/dom-repair-text.js +0 -47
- package/dist/react/editable/editable-command-types.d.ts +0 -1
- package/dist/react/editable/editable-dom-runtime.d.ts +0 -66
- package/dist/react/editable/editable-dom-runtime.js +0 -1022
- package/dist/react/editable/editing-epoch-adapter.js +0 -46
- package/dist/react/editable/editing-kernel.d.ts +0 -7
- package/dist/react/editable/editing-kernel.js +0 -593
- package/dist/react/editable/external-text-binding.js +0 -43
- package/dist/react/editable/external-text-runtime.d.ts +0 -5
- package/dist/react/editable/external-text-runtime.js +0 -851
- package/dist/react/editable/history-focus.js +0 -71
- package/dist/react/editable/history-keyboard.d.ts +0 -4
- package/dist/react/editable/history-keyboard.js +0 -9
- package/dist/react/editable/input-controller.d.ts +0 -7
- package/dist/react/editable/input-controller.js +0 -175
- package/dist/react/editable/input-history.js +0 -21
- package/dist/react/editable/input-router.js +0 -742
- package/dist/react/editable/input-state.d.ts +0 -18
- package/dist/react/editable/input-state.js +0 -330
- package/dist/react/editable/input-target.js +0 -30
- package/dist/react/editable/install-browser-handle.d.ts +0 -12
- package/dist/react/editable/install-browser-handle.js +0 -18
- package/dist/react/editable/interaction-owner.js +0 -88
- package/dist/react/editable/keyboard-input-strategy.js +0 -730
- package/dist/react/editable/line-boundary.js +0 -37
- package/dist/react/editable/model-input-strategy.d.ts +0 -9
- package/dist/react/editable/model-input-strategy.js +0 -242
- package/dist/react/editable/model-selection-dom-preference.js +0 -11
- package/dist/react/editable/mutation-block-editing.js +0 -48
- package/dist/react/editable/mutation-controller.d.ts +0 -32
- package/dist/react/editable/mutation-controller.js +0 -632
- package/dist/react/editable/mutation-full-block-editing.d.ts +0 -2
- package/dist/react/editable/mutation-full-block-editing.js +0 -44
- package/dist/react/editable/mutation-history.d.ts +0 -3
- package/dist/react/editable/mutation-history.js +0 -146
- package/dist/react/editable/native-input-strategy.js +0 -86
- package/dist/react/editable/native-text-input-delta.js +0 -40
- package/dist/react/editable/placed-drag.js +0 -177
- package/dist/react/editable/plite-string-coordinate-placement.js +0 -46
- package/dist/react/editable/press-fence.d.ts +0 -2
- package/dist/react/editable/press-fence.js +0 -70
- package/dist/react/editable/projected-clipboard.js +0 -123
- package/dist/react/editable/projected-native-affordance.js +0 -30
- package/dist/react/editable/projected-selection-target.js +0 -13
- package/dist/react/editable/render-contract-monitor.d.ts +0 -3
- package/dist/react/editable/render-contract-monitor.js +0 -152
- package/dist/react/editable/root-interaction-controller.js +0 -1400
- package/dist/react/editable/root-interaction-dom-selection-replay.js +0 -40
- package/dist/react/editable/root-interaction-resolver.js +0 -116
- package/dist/react/editable/root-selector-sources.js +0 -90
- package/dist/react/editable/runtime-android-engine.js +0 -40
- package/dist/react/editable/runtime-before-input-events.js +0 -671
- package/dist/react/editable/runtime-browser-handle-events.js +0 -40
- package/dist/react/editable/runtime-clipboard-events.js +0 -169
- package/dist/react/editable/runtime-composition-events.js +0 -163
- package/dist/react/editable/runtime-drag-events.js +0 -136
- package/dist/react/editable/runtime-editor-api.d.ts +0 -20
- package/dist/react/editable/runtime-editor-api.js +0 -21
- package/dist/react/editable/runtime-event-engine.js +0 -213
- package/dist/react/editable/runtime-focus-mouse-events.js +0 -264
- package/dist/react/editable/runtime-input-events.js +0 -166
- package/dist/react/editable/runtime-kernel-trace.js +0 -185
- package/dist/react/editable/runtime-keyboard-events.js +0 -333
- package/dist/react/editable/runtime-live-state.js +0 -44
- package/dist/react/editable/runtime-mutation-state.js +0 -11
- package/dist/react/editable/runtime-repair-engine.js +0 -118
- package/dist/react/editable/runtime-root-engine.js +0 -244
- package/dist/react/editable/runtime-root-lifecycle.js +0 -118
- package/dist/react/editable/runtime-root-selection-export.js +0 -38
- package/dist/react/editable/runtime-root-selection-import.js +0 -54
- package/dist/react/editable/runtime-root-state.js +0 -62
- package/dist/react/editable/runtime-selection-engine.js +0 -260
- package/dist/react/editable/runtime-selection-state.js +0 -12
- package/dist/react/editable/runtime-target-bridge.js +0 -29
- package/dist/react/editable/schema-runtime-invalidation.js +0 -26
- package/dist/react/editable/selection-change-listener.js +0 -99
- package/dist/react/editable/selection-claim.d.ts +0 -3
- package/dist/react/editable/selection-claim.js +0 -398
- package/dist/react/editable/selection-controller.d.ts +0 -8
- package/dist/react/editable/selection-controller.js +0 -693
- package/dist/react/editable/selection-dom-range.js +0 -84
- package/dist/react/editable/selection-projected-dom.js +0 -156
- package/dist/react/editable/selection-reconciler.js +0 -630
- package/dist/react/editable/selection-runtime.js +0 -89
- package/dist/react/editable/selection-side-effect-policy.js +0 -20
- package/dist/react/editable/selection-triple-click.js +0 -48
- package/dist/react/editable/selection-void-target.js +0 -172
- package/dist/react/editable/set-root-endpoints.js +0 -75
- package/dist/react/editable/soft-line-end-delete.js +0 -106
- package/dist/react/editable/text-direction.js +0 -82
- package/dist/react/editable/typed-text.d.ts +0 -17
- package/dist/react/editable/typed-text.js +0 -89
- package/dist/react/editable/unread-press.d.ts +0 -2
- package/dist/react/editable/unread-press.js +0 -86
- package/dist/react/editable/view-caret-restore.js +0 -128
- package/dist/react/editable/view-lines.d.ts +0 -7
- package/dist/react/editable/view-lines.js +0 -166
- package/dist/react/external-text.d.ts +0 -131
- package/dist/react/history-step-views.d.ts +0 -4
- package/dist/react/history-step-views.js +0 -119
- package/dist/react/hooks/android-input-manager/android-input-manager.d.ts +0 -7
- package/dist/react/hooks/android-input-manager/android-input-manager.js +0 -716
- package/dist/react/hooks/android-input-manager/use-android-input-manager.js +0 -53
- package/dist/react/hooks/focus-plite-editable.js +0 -116
- package/dist/react/hooks/use-claim-editable-dom-commit.d.ts +0 -12
- package/dist/react/hooks/use-claim-editable-dom-commit.js +0 -31
- package/dist/react/hooks/use-drop-indicator.d.ts +0 -9
- package/dist/react/hooks/use-drop-indicator.js +0 -14
- package/dist/react/hooks/use-editable-clip.d.ts +0 -18
- package/dist/react/hooks/use-editable-clip.js +0 -31
- package/dist/react/hooks/use-editable-layout-pass.js +0 -53
- package/dist/react/hooks/use-editor-composing.d.ts +0 -7
- package/dist/react/hooks/use-editor-composing.js +0 -12
- package/dist/react/hooks/use-editor-context.d.ts +0 -10
- package/dist/react/hooks/use-editor-context.js +0 -18
- package/dist/react/hooks/use-editor-dom-scope.d.ts +0 -27
- package/dist/react/hooks/use-editor-dom-scope.js +0 -23
- package/dist/react/hooks/use-editor-focused.d.ts +0 -7
- package/dist/react/hooks/use-editor-focused.js +0 -12
- package/dist/react/hooks/use-editor-read-only.d.ts +0 -25
- package/dist/react/hooks/use-editor-read-only.js +0 -19
- package/dist/react/hooks/use-editor-runtime-state.d.ts +0 -18
- package/dist/react/hooks/use-editor-runtime-state.js +0 -38
- package/dist/react/hooks/use-editor-selection.d.ts +0 -10
- package/dist/react/hooks/use-editor-selection.js +0 -13
- package/dist/react/hooks/use-editor-selector.d.ts +0 -38
- package/dist/react/hooks/use-editor-selector.js +0 -265
- package/dist/react/hooks/use-editor-view-state.d.ts +0 -16
- package/dist/react/hooks/use-editor-view-state.js +0 -20
- package/dist/react/hooks/use-editor.d.ts +0 -26
- package/dist/react/hooks/use-editor.js +0 -27
- package/dist/react/hooks/use-element-path.d.ts +0 -7
- package/dist/react/hooks/use-element-path.js +0 -36
- package/dist/react/hooks/use-element-selected.d.ts +0 -26
- package/dist/react/hooks/use-element-selected.js +0 -91
- package/dist/react/hooks/use-element.d.ts +0 -13
- package/dist/react/hooks/use-element.js +0 -17
- package/dist/react/hooks/use-generic-selector.js +0 -91
- package/dist/react/hooks/use-hydrated.js +0 -12
- package/dist/react/hooks/use-isomorphic-layout-effect.js +0 -9
- package/dist/react/hooks/use-node-selector.d.ts +0 -40
- package/dist/react/hooks/use-node-selector.js +0 -102
- package/dist/react/hooks/use-plite-annotation-store.d.ts +0 -21
- package/dist/react/hooks/use-plite-annotation-store.js +0 -61
- package/dist/react/hooks/use-plite-annotations.d.ts +0 -9
- package/dist/react/hooks/use-plite-annotations.js +0 -16
- package/dist/react/hooks/use-plite-child-root.d.ts +0 -14
- package/dist/react/hooks/use-plite-child-root.js +0 -38
- package/dist/react/hooks/use-plite-content-root.d.ts +0 -21
- package/dist/react/hooks/use-plite-content-root.js +0 -26
- package/dist/react/hooks/use-plite-history.d.ts +0 -43
- package/dist/react/hooks/use-plite-history.js +0 -137
- package/dist/react/hooks/use-plite-node-ref.js +0 -513
- package/dist/react/hooks/use-plite-root-chrome.d.ts +0 -34
- package/dist/react/hooks/use-plite-root-chrome.js +0 -98
- package/dist/react/hooks/use-plite-runtime.d.ts +0 -86
- package/dist/react/hooks/use-plite-runtime.js +0 -433
- package/dist/react/hooks/use-runtime-focus-state.js +0 -37
- package/dist/react/hooks/use-selection-geometry.d.ts +0 -12
- package/dist/react/hooks/use-selection-geometry.js +0 -39
- package/dist/react/hooks/use-selection-view.d.ts +0 -14
- package/dist/react/hooks/use-selection-view.js +0 -14
- package/dist/react/hooks/use-state-field.d.ts +0 -26
- package/dist/react/hooks/use-state-field.js +0 -38
- package/dist/react/inactive-selection.js +0 -175
- package/dist/react/plugin/react-editor.d.ts +0 -20
- package/dist/react/plugin/react-editor.js +0 -6
- package/dist/react/plugin/with-react.d.ts +0 -108
- package/dist/react/plugin/with-react.js +0 -58
- package/dist/react/render-profiler.js +0 -20
- package/dist/react/root-key.js +0 -12
- package/dist/react/shell-runtime.js +0 -29
- package/dist/react/update-policy.d.ts +0 -10
- package/dist/react/update-policy.js +0 -15
- package/dist/react/utils/environment.js +0 -5
- package/dist/react/view-boundary-graph-core.d.ts +0 -1
- package/dist/react/view-boundary-graph-core.js +0 -208
- package/dist/react/view-boundary-graph.js +0 -105
- package/dist/react/view-selection-decoration.js +0 -97
- package/dist/react/view-selection.js +0 -184
- package/dist/react/viewport-boundary.js +0 -45
- package/dist/react/viewport-commands.d.ts +0 -1
- package/dist/react/viewport-commands.js +0 -17
- package/dist/react/viewport-plan.d.ts +0 -2
- package/dist/react/viewport-plan.js +0 -77
- package/dist/react/virtualized/use-virtualized-root-plan.js +0 -148
- package/dist/testing/createDataTransfer.d.ts +0 -4
- package/dist/testing/createDataTransfer.js +0 -13
- package/dist/testing/jsx.d.ts +0 -181
- package/dist/testing/jsx.js +0 -82
- package/dist/transforms-node/insert-nodes.js +0 -143
- package/dist/transforms-node/lift-nodes.js +0 -117
- package/dist/transforms-node/merge-nodes.js +0 -180
- package/dist/transforms-node/move-nodes.js +0 -58
- package/dist/transforms-node/remove-nodes.js +0 -86
- package/dist/transforms-node/replace-children.js +0 -117
- package/dist/transforms-node/set-nodes.js +0 -188
- package/dist/transforms-node/split-nodes.js +0 -258
- package/dist/transforms-node/unset-nodes.js +0 -10
- package/dist/transforms-node/unwrap-nodes.js +0 -182
- package/dist/transforms-node/wrap-nodes.js +0 -250
- package/dist/transforms-selection/collapse.js +0 -20
- package/dist/transforms-selection/deselect.js +0 -8
- package/dist/transforms-selection/move.js +0 -35
- package/dist/transforms-selection/select.js +0 -59
- package/dist/transforms-selection/set-point.js +0 -32
- package/dist/transforms-selection/set-selection.js +0 -52
- package/dist/transforms-text/delete-text-collapsed-path-targets.js +0 -102
- package/dist/transforms-text/delete-text-grid.js +0 -402
- package/dist/transforms-text/delete-text-inline-points.js +0 -82
- package/dist/transforms-text/delete-text-plan.js +0 -55
- package/dist/transforms-text/delete-text-removal.js +0 -153
- package/dist/transforms-text/delete-text-structural-cleanup.js +0 -130
- package/dist/transforms-text/delete-text-whole-blocks.js +0 -70
- package/dist/transforms-text/delete-text.js +0 -804
- package/dist/transforms-text/full-document-range.js +0 -12
- package/dist/transforms-text/insert-text.js +0 -314
- package/dist/types/types.d.ts +0 -13
- package/dist/utils/format-debug-value.d.ts +0 -8
- package/dist/utils/format-debug-value.js +0 -31
- package/dist/utils/get-default-insert-location.js +0 -19
- package/dist/utils/is-object.d.ts +0 -4
- package/dist/utils/is-object.js +0 -4
- package/dist/utils/match-path.js +0 -8
- package/dist/utils/node-keys.d.ts +0 -15
- package/dist/utils/node-keys.js +0 -179
- package/dist/utils/node-match.js +0 -9
- package/dist/utils/string.js +0 -283
- package/dist/yjs/core/addresses.js +0 -98
- package/dist/yjs/core/ancestor-properties.js +0 -56
- package/dist/yjs/core/attributes.js +0 -21
- package/dist/yjs/core/awareness-adapter.d.ts +0 -5
- package/dist/yjs/core/awareness-adapter.js +0 -399
- package/dist/yjs/core/awareness-relative-selection.js +0 -22
- package/dist/yjs/core/awareness.js +0 -25
- package/dist/yjs/core/binding.d.ts +0 -3
- package/dist/yjs/core/binding.js +0 -128
- package/dist/yjs/core/boundaries.js +0 -453
- package/dist/yjs/core/canonical-split.js +0 -130
- package/dist/yjs/core/change-bridge.js +0 -124
- package/dist/yjs/core/change-regions.js +0 -119
- package/dist/yjs/core/controller-registry.js +0 -70
- package/dist/yjs/core/controller.d.ts +0 -6
- package/dist/yjs/core/controller.js +0 -1282
- package/dist/yjs/core/document.js +0 -1499
- package/dist/yjs/core/editor-adapter.d.ts +0 -18
- package/dist/yjs/core/editor-adapter.js +0 -145
- package/dist/yjs/core/editor-only-roots.js +0 -53
- package/dist/yjs/core/editor-types.d.ts +0 -1
- package/dist/yjs/core/enclosures.js +0 -410
- package/dist/yjs/core/event-change-bridge.js +0 -3642
- package/dist/yjs/core/index.d.ts +0 -4
- package/dist/yjs/core/joined-lines.js +0 -81
- package/dist/yjs/core/joins.js +0 -587
- package/dist/yjs/core/json-equality.js +0 -31
- package/dist/yjs/core/keys.js +0 -29
- package/dist/yjs/core/letter-scripts.js +0 -449
- package/dist/yjs/core/new-letters.js +0 -300
- package/dist/yjs/core/path.js +0 -25
- package/dist/yjs/core/plugin.js +0 -206
- package/dist/yjs/core/record.js +0 -4
- package/dist/yjs/core/replacement.js +0 -165
- package/dist/yjs/core/retraction.js +0 -132
- package/dist/yjs/core/root-owners.js +0 -110
- package/dist/yjs/core/root-projection-index.js +0 -428
- package/dist/yjs/core/schema-metadata.js +0 -88
- package/dist/yjs/core/selection.js +0 -34
- package/dist/yjs/core/set-valued-attributes.js +0 -57
- package/dist/yjs/core/shared-effect-log.d.ts +0 -4
- package/dist/yjs/core/shared-effect-log.js +0 -674
- package/dist/yjs/core/text-runs.js +0 -1596
- package/dist/yjs/core/types.d.ts +0 -76
- package/dist/yjs/react/useYjs.d.ts +0 -25
- package/dist/yjs/react/useYjs.js +0 -85
|
@@ -1,1271 +0,0 @@
|
|
|
1
|
-
import { getDefined } from "../internal/get-defined.js";
|
|
2
|
-
import { countCoreWork } from "../core/work.js";
|
|
3
|
-
import { jsonEqual } from "../core/change/json.js";
|
|
4
|
-
import { copyFields, lazyRootOf, setLazyRoot, visitRootNames } from "../core/change/lazy-root.js";
|
|
5
|
-
import { NO_RECORD_OPS, composeRecordOps, deriveValue, getValueRecords, withValueRecords } from "../core/record-store.js";
|
|
6
|
-
import { DocumentIndex, rootIndexOf } from "../core/change/document-index.js";
|
|
7
|
-
import { DocumentChange, createInternalDocumentChange, filterDocumentChangeRoots, getInternalDocumentChangeEntries, getInternalDocumentChangeRanges, getInternalDocumentChangeRecords, getInternalDocumentChangeRootKeys, getInternalDocumentRootChange, valueRoot, valueRootIndex, valueRootNodes, withDocumentChangeRecords } from "../core/change/document-change.js";
|
|
8
|
-
import { UNSCOPED_ORIGINS } from "../core/change/builder.js";
|
|
9
|
-
import { getEditorRuntime, getEditorRuntimeOwner, getEditorRuntimeRoot, getEditorSchema } from "../core/editor-runtime.js";
|
|
10
|
-
import { registerEditorCommandDocument } from "../core/command-document.js";
|
|
11
|
-
import { PathApi } from "../interfaces/path.js";
|
|
12
|
-
import { PointApi } from "../interfaces/point.js";
|
|
13
|
-
import { RangeApi } from "../interfaces/range.js";
|
|
14
|
-
import { registerEditorContent } from "../core/content.js";
|
|
15
|
-
import { SelectionApi } from "../interfaces/selection.js";
|
|
16
|
-
import { crossesUniqueTarget, holdsUniqueKey, tracksPlaces, uniquePropertiesOf } from "../core/schema-compiler.js";
|
|
17
|
-
import { getCompiledEditorSchema, getPluginContributions } from "../core/plugin-registry.js";
|
|
18
|
-
import { EditorRefusalError, publishEditorRefusal, subscribeEditorRefusals } from "../core/refusal.js";
|
|
19
|
-
import { notifyObservers, runEditorObserver } from "../core/lifecycle-error.js";
|
|
20
|
-
import { getAuthoredUpdateView, registerAuthoredRuntime } from "../core/authored-runtime.js";
|
|
21
|
-
import { authoredDocumentCapabilityPoint } from "../core/authored-document-capability.js";
|
|
22
|
-
import { changedRootsOf, orphanedValueRoots, rootsDeletedByName } from "../core/root-ownership.js";
|
|
23
|
-
import { elementSplitOutput } from "../core/default-storage.js";
|
|
24
|
-
import { readingCovered } from "../core/property-validity.js";
|
|
25
|
-
import { completeChildrenAt } from "../core/representation.js";
|
|
26
|
-
import { holdsOneText, withoutGeneration } from "../core/editor-schema.js";
|
|
27
|
-
import { admitDocument, documentAdmissionPoint } from "../core/document-admission.js";
|
|
28
|
-
import { txOnly, txStored } from "../core/tx-only.js";
|
|
29
|
-
import { getBaseViewPresentation } from "../core/view-presentation.js";
|
|
30
|
-
import { getViewAuthor, getViewPresentation } from "../editor-runtime-view.js";
|
|
31
|
-
import { getPlacementGeneration, nextMintedGeneration, subscribeCommittedPlacement } from "../core/view-carets.js";
|
|
32
|
-
import { gridHoldersOf, gridRolesOf } from "../core/survival.js";
|
|
33
|
-
import { registerEditorDocumentRecorder, registerEditorDraftGuard, registerEditorDraftView } from "../core/document-recorder.js";
|
|
34
|
-
import { applyDocumentChange, getActiveEditorUpdateId, getActiveEditorUpdateTags, getCurrentSelection, getCurrentSelectionRoot, isPresentationComposing, notifyPresentationViewState, subscribePresentationComposition, withEditorDocumentProjection } from "../core/public-state.js";
|
|
35
|
-
import { prepareCommandFrame } from "../core/command-frame.js";
|
|
36
|
-
import { definePlugin } from "../core/plugin.js";
|
|
37
|
-
import { authoredVeto } from "../core/authored-veto.js";
|
|
38
|
-
import { contentRootsOf, rootOf } from "./ledger/roots.js";
|
|
39
|
-
import { editingChangeOf, isEditingChange } from "./facts/editing.js";
|
|
40
|
-
import { acceptedValues } from "./tree/layers.js";
|
|
41
|
-
import { authoredMarksSchema, followsOf, isAuthoredSetValued, readAuthoredMarks, readMembers } from "./tree/marks.js";
|
|
42
|
-
import { authoredRecords, incarnationOfLink, landedOf, putContexts, putLanded, withStore } from "./facts/records.js";
|
|
43
|
-
import { claimsOf, factsOf, isAccepted, isSettledDeletion, marksOf, standingClaimsOf } from "./facts/facts.js";
|
|
44
|
-
import { relinkCuts } from "./tree/cuts.js";
|
|
45
|
-
import { indexAuthoredChanges, readAuthoredDetails } from "./changes.js";
|
|
46
|
-
import { carriedIn } from "./facts/compact.js";
|
|
47
|
-
import { createDependencies } from "./facts/dependencies.js";
|
|
48
|
-
import { joinCompares } from "./tree/halves.js";
|
|
49
|
-
import { claimsBreakBefore, isTextBlock, pastFollowers, projectAuthoredValue, resolveAuthoredChildren } from "./tree/resolve.js";
|
|
50
|
-
import { characterAlignedChange } from "./tree/alignment.js";
|
|
51
|
-
import { blockFactsOf, isBuilt } from "./ledger/runs.js";
|
|
52
|
-
import { NO_SPARE_WRITES, changedSitesOf, spareWritesChange, sparesFor, storesSpares } from "./tree/reserves.js";
|
|
53
|
-
import { authoredResolveSchemaOf, storedResolveSchemaOf } from "./resolve-schema.js";
|
|
54
|
-
import { claimOf, decide, isRefusal, spareGuardOver } from "./decision.js";
|
|
55
|
-
import { closeCommandValues, generatedOf } from "./tree/command-values.js";
|
|
56
|
-
import { GENERATED_VALUES_REFUSAL, proposalRefusal, splitOneTextRefusal, storesGeneratedValues, unplaced, unrepresentable, unrepresentableFor } from "./refusal.js";
|
|
57
|
-
import { projectAuthoredBlocks, projectAuthoredDocumentUnder } from "./format.js";
|
|
58
|
-
import { createReviewLedger, getReviewLedger } from "./ledger/ledger.js";
|
|
59
|
-
import { authoredAdmission, createDocumentMarksValidator } from "./facts/admission.js";
|
|
60
|
-
import { recordAuthoredSteps } from "./tree/record.js";
|
|
61
|
-
import { completeProposed, framedChild } from "./tree/record-completion.js";
|
|
62
|
-
import { spareBlock, spareRoot } from "./tree/spare-lines.js";
|
|
63
|
-
//#region src/authored/authored.ts
|
|
64
|
-
const STATES = /* @__PURE__ */ new WeakMap();
|
|
65
|
-
const authoredProposerOf = (editor) => {
|
|
66
|
-
const state = STATES.get(getEditorRuntimeOwner(editor));
|
|
67
|
-
const authorId = state?.authorId() ?? null;
|
|
68
|
-
if (!state || authorId === null) return null;
|
|
69
|
-
return {
|
|
70
|
-
authorId,
|
|
71
|
-
createChangeId: state.createChangeId,
|
|
72
|
-
pending: changesOf(editor, storedValue(editor)).idsAuthoredBy(authorId)
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const elementOf = (props) => ({
|
|
76
|
-
...props,
|
|
77
|
-
children: [],
|
|
78
|
-
type: String(props.type)
|
|
79
|
-
});
|
|
80
|
-
const isReplay = (tags) => tags.includes("historic") || tags.includes("collaboration");
|
|
81
|
-
const isStruck = (editor, node) => {
|
|
82
|
-
if (!readAuthoredMarks(node).some((mark) => mark.kind === "delete")) return false;
|
|
83
|
-
const facts = factsOf(storedValue(editor));
|
|
84
|
-
return isSettledDeletion(node, facts) || marksOf(node, facts).some((mark) => mark.kind === "delete");
|
|
85
|
-
};
|
|
86
|
-
const positionOf = (value, root, point) => valueRootIndex(value, root).positionAt(point);
|
|
87
|
-
const mapPoint = (point, input, assoc) => {
|
|
88
|
-
const index = input.indexes.get(input.root);
|
|
89
|
-
if (!index) return point;
|
|
90
|
-
const position = input.map(input.root, positionOf(input.after, input.root, point), assoc);
|
|
91
|
-
const recorded = position === null || position === void 0 ? null : index.pointAt(position, assoc);
|
|
92
|
-
return recorded ? {
|
|
93
|
-
...point,
|
|
94
|
-
offset: recorded.offset,
|
|
95
|
-
path: [...recorded.path]
|
|
96
|
-
} : point;
|
|
97
|
-
};
|
|
98
|
-
/** Map a selection on the written draft onto the document recorded from it. */
|
|
99
|
-
const mapSelection = (selection, input, assoc = -1) => {
|
|
100
|
-
if (selection?.kind === "text") return {
|
|
101
|
-
...selection,
|
|
102
|
-
anchor: mapPoint(selection.anchor, input, assoc),
|
|
103
|
-
focus: mapPoint(selection.focus, input, assoc)
|
|
104
|
-
};
|
|
105
|
-
const index = input.indexes.get(input.root);
|
|
106
|
-
if (selection?.kind !== "node" || !index) return selection;
|
|
107
|
-
const draft = DocumentIndex.fromValue(valueRoot(input.after, input.root));
|
|
108
|
-
const mapPath = (path) => {
|
|
109
|
-
const position = input.map(input.root, draft.nodeRange(path).from, 1);
|
|
110
|
-
const entry = position === null || position === void 0 ? null : index.nodeStartingAt(position);
|
|
111
|
-
return entry ? [...entry.path] : null;
|
|
112
|
-
};
|
|
113
|
-
const [first, ...rest] = selection.paths.flatMap((path) => {
|
|
114
|
-
const mapped = mapPath(path);
|
|
115
|
-
return mapped ? [mapped] : [];
|
|
116
|
-
});
|
|
117
|
-
if (!first) return null;
|
|
118
|
-
const { paths } = SelectionApi.nodes([first, ...rest], { mode: "block" });
|
|
119
|
-
const endpoint = (path, fallback) => {
|
|
120
|
-
const mapped = mapPath(path);
|
|
121
|
-
return mapped && paths.some((kept) => PathApi.equals(kept, mapped)) ? mapped : fallback;
|
|
122
|
-
};
|
|
123
|
-
return SelectionApi.nodes(paths, {
|
|
124
|
-
anchorPath: endpoint(selection.anchorPath, paths[0]),
|
|
125
|
-
focusPath: endpoint(selection.focusPath, paths.at(-1) ?? paths[0]),
|
|
126
|
-
mode: selection.mode,
|
|
127
|
-
...selection.root === void 0 ? {} : { root: selection.root }
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const framedLawCheck = () => {
|
|
131
|
-
const env = globalThis.process?.env;
|
|
132
|
-
return env?.NODE_ENV === "test" ? env.PLITE_LAW_CHECK : "0";
|
|
133
|
-
};
|
|
134
|
-
const isEmptiedGrid = (node, holdsParts) => holdsParts(node) && (node.children ?? []).every((child) => holdsParts(child) && isEmptiedGrid(child, holdsParts));
|
|
135
|
-
const listAcceptsTo = (acceptedList, wroteList, holdsParts) => {
|
|
136
|
-
const withoutEmptiedGrids = (list) => list.filter((node) => !isEmptiedGrid(node, holdsParts));
|
|
137
|
-
const accepted = withoutEmptiedGrids(acceptedList);
|
|
138
|
-
const wrote = withoutEmptiedGrids(wroteList);
|
|
139
|
-
let end = wrote.length;
|
|
140
|
-
while (end > accepted.length && isBuilt(getDefined(wrote[end - 1]))) end -= 1;
|
|
141
|
-
return end === accepted.length && accepted.every((node, index) => {
|
|
142
|
-
const other = getDefined(wrote[index]);
|
|
143
|
-
return jsonEqual(node, other) || !!node.children && !!other.children && jsonEqual(nodePropsOf(node), nodePropsOf(other)) && listAcceptsTo(node.children, other.children, holdsParts);
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
const acceptsTo = (accepted, wrote, holdsParts) => {
|
|
147
|
-
const { children, records: _records, roots = {}, ...fields } = accepted;
|
|
148
|
-
const { children: wroteChildren, records: _wroteRecords, roots: wroteRoots = {}, ...wroteFields } = wrote;
|
|
149
|
-
const names = Object.keys(roots);
|
|
150
|
-
return jsonEqual(fields, wroteFields) && listAcceptsTo(children, wroteChildren, holdsParts) && jsonEqual(names.toSorted(), Object.keys(wroteRoots).toSorted()) && names.every((name) => listAcceptsTo(getDefined(roots[name]), getDefined(wroteRoots[name]), holdsParts));
|
|
151
|
-
};
|
|
152
|
-
const assertFramedLaw = (input, schema, selection, mapAfter) => {
|
|
153
|
-
const { frame, root, stored } = input;
|
|
154
|
-
const written = contentOf(stored.value);
|
|
155
|
-
const accepted = contentOf(projectAuthoredValue(stored.value, "proposed", schema).value);
|
|
156
|
-
if (!acceptsTo(accepted, contentOf(frame.value), gridHoldersOf(schema.ownership))) throw new Error(`A framed recording does not accept to what its commands wrote: ${JSON.stringify({
|
|
157
|
-
accepted: accepted.children,
|
|
158
|
-
wrote: frame.value.children
|
|
159
|
-
})}`);
|
|
160
|
-
if (!selection || frame.selection?.kind !== "text" || stored.selection?.kind !== "text") return;
|
|
161
|
-
const map = mapAfter();
|
|
162
|
-
const index = DocumentIndex.fromValue(valueRoot(accepted, root));
|
|
163
|
-
for (const edge of ["anchor", "focus"]) {
|
|
164
|
-
const position = positionOf(written, root, stored.selection[edge]);
|
|
165
|
-
const expected = frame.selection[edge];
|
|
166
|
-
if (!["backward", "forward"].some((association) => [-1, 1].some((assoc) => {
|
|
167
|
-
const projected = map.toProjected(root, position, association);
|
|
168
|
-
const point = projected === null ? null : index.pointAt(projected, assoc);
|
|
169
|
-
return point !== null && point.offset === expected.offset && PathApi.equals(point.path, expected.path);
|
|
170
|
-
}))) throw new Error(`A framed recording does not accept to its commands' ${edge}: ${JSON.stringify({
|
|
171
|
-
accepted: valueRoot(accepted, root),
|
|
172
|
-
stored: stored.selection[edge],
|
|
173
|
-
whereCommandsLeftIt: expected,
|
|
174
|
-
written: valueRoot(written, root)
|
|
175
|
-
})}`);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const STORED_READS = /* @__PURE__ */ new WeakSet();
|
|
179
|
-
const NO_ROOTS = /* @__PURE__ */ new Set();
|
|
180
|
-
const PUBLISHERS = /* @__PURE__ */ new WeakMap();
|
|
181
|
-
const storedRead = (editor, read) => {
|
|
182
|
-
const owner = getEditorRuntimeOwner(editor);
|
|
183
|
-
if (STORED_READS.has(owner)) return read(owner);
|
|
184
|
-
STORED_READS.add(owner);
|
|
185
|
-
try {
|
|
186
|
-
return read(owner);
|
|
187
|
-
} finally {
|
|
188
|
-
STORED_READS.delete(owner);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const storedValue = (editor) => storedRead(editor, (owner) => owner.read.value());
|
|
192
|
-
const readCursor = (cursor) => {
|
|
193
|
-
let parsed;
|
|
194
|
-
try {
|
|
195
|
-
parsed = JSON.parse(cursor);
|
|
196
|
-
} catch {
|
|
197
|
-
parsed = null;
|
|
198
|
-
}
|
|
199
|
-
if (!Array.isArray(parsed) || parsed.length !== 3 || parsed.some((part) => typeof part !== "string")) throw new Error("Stale authored page cursor.");
|
|
200
|
-
return parsed;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* A review read on a preview named a point or a range, which a preview does
|
|
204
|
-
* not read: it reads the changes of a node by its key or path.
|
|
205
|
-
*/
|
|
206
|
-
var AuthoredPlaceError = class extends Error {
|
|
207
|
-
name = "AuthoredPlaceError";
|
|
208
|
-
constructor() {
|
|
209
|
-
super("A preview reads review changes by a node's key or path, not by a point or a range.");
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
const NOTHING_DISSOLVES = () => false;
|
|
213
|
-
const placeIds = (editor, book, at, places) => {
|
|
214
|
-
const viewRoot = getEditorRuntimeRoot(editor);
|
|
215
|
-
if (typeof at === "string" || PathApi.isPath(at)) {
|
|
216
|
-
const path = typeof at === "string" ? editor.read.nodes.path(at) : at;
|
|
217
|
-
const index = places?.index ?? valueRootIndex(storedValue(editor), viewRoot);
|
|
218
|
-
let from;
|
|
219
|
-
let to;
|
|
220
|
-
if (!path) return [];
|
|
221
|
-
try {
|
|
222
|
-
({from, to} = index.nodeRange(path));
|
|
223
|
-
if (typeof index.node(path).text === "string") to -= 1;
|
|
224
|
-
} catch {
|
|
225
|
-
return [];
|
|
226
|
-
}
|
|
227
|
-
return book.pendingInOrder(book.idsShown(viewRoot, places ? places.spans(from, to) : [[from, to]], places?.dissolves ?? NOTHING_DISSOLVES));
|
|
228
|
-
}
|
|
229
|
-
if (places) throw new AuthoredPlaceError();
|
|
230
|
-
const inViewRoot = (point) => point.root === void 0 ? {
|
|
231
|
-
...point,
|
|
232
|
-
root: viewRoot
|
|
233
|
-
} : point;
|
|
234
|
-
const range = RangeApi.isRange(at) ? {
|
|
235
|
-
...at,
|
|
236
|
-
anchor: inViewRoot(at.anchor),
|
|
237
|
-
focus: inViewRoot(at.focus)
|
|
238
|
-
} : {
|
|
239
|
-
anchor: inViewRoot(at),
|
|
240
|
-
focus: inViewRoot(at)
|
|
241
|
-
};
|
|
242
|
-
const [start, end] = RangeApi.edges(range);
|
|
243
|
-
return book.pendingInOrder([...book.idsIn(start.root ?? viewRoot, getDefined(start.path[0]), getDefined(end.path[0]) + 1)].filter((id) => getDefined(book.change(id)).ranges.some((candidate) => RangeApi.intersection(candidate, range) !== null)));
|
|
244
|
-
};
|
|
245
|
-
const ledgerOf = (editor) => getDefined(getReviewLedger(getEditorRuntimeOwner(editor)));
|
|
246
|
-
const changesOf = (editor, value) => ledgerOf(editor).changes(value);
|
|
247
|
-
/** `value` without its records, which a decision only adds to. */
|
|
248
|
-
const contentOf = (value) => {
|
|
249
|
-
const { records: _records, ...plain } = value;
|
|
250
|
-
return plain;
|
|
251
|
-
};
|
|
252
|
-
const contentChangeOf = (change) => withDocumentChangeRecords(change, NO_RECORD_OPS);
|
|
253
|
-
/** Whether `change` only removes tokens, in roots it neither creates nor deletes. */
|
|
254
|
-
const onlyRemovesTokens = (change) => change.createRoots.size === 0 && change.deleteRoots.size === 0 && getInternalDocumentChangeRootKeys(change).every((root) => getDefined(getInternalDocumentRootChange(change, root)).sections.every((value, index) => index % 2 === 0 || value === 0 || value === -1));
|
|
255
|
-
/**
|
|
256
|
-
* Whether a decision settles by removing text alone, so its undo can take
|
|
257
|
-
* the settlement back apart from everything else it wrote: every change it
|
|
258
|
-
* decides is an accepted deletion of text leaves that each keep an inline
|
|
259
|
-
* sibling, it withdraws nothing, and its text change only removes tokens.
|
|
260
|
-
* Without a withdrawal, the decision's verdicts name every occurrence of
|
|
261
|
-
* every change it acts on.
|
|
262
|
-
*/
|
|
263
|
-
const settlesTextAlone = (value, change, decided, actions, occurrencesOf, withdraws) => {
|
|
264
|
-
if (withdraws) return false;
|
|
265
|
-
const removed = /* @__PURE__ */ new Map();
|
|
266
|
-
for (const id of decided) {
|
|
267
|
-
if (actions.get(id) !== "accept") return false;
|
|
268
|
-
for (const { mark, node, path, root } of occurrencesOf(id)) {
|
|
269
|
-
if (mark.kind !== "delete" || typeof node.text !== "string") return false;
|
|
270
|
-
let children = valueRootNodes(value, root);
|
|
271
|
-
for (const index of path.slice(0, -1)) children = children?.at(index)?.children;
|
|
272
|
-
if (!children) return false;
|
|
273
|
-
const count = (removed.get(children) ?? 0) + 1;
|
|
274
|
-
if (count >= children.length) return false;
|
|
275
|
-
removed.set(children, count);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return onlyRemovesTokens(contentChangeOf(change));
|
|
279
|
-
};
|
|
280
|
-
const nodePropsOf = ({ children: _children, text: _text, ...props }) => props;
|
|
281
|
-
/**
|
|
282
|
-
* The deepest element whose children hold the range as whole blocks, so a
|
|
283
|
-
* join or split in the range lands among the blocks beside it.
|
|
284
|
-
*/
|
|
285
|
-
const siteOf = (index, from, to) => {
|
|
286
|
-
let site = [];
|
|
287
|
-
for (const range of index.openContextAt(from)) {
|
|
288
|
-
if (range.kind !== "element" || range.contentFrom > from || range.contentTo < to || isTextBlock(index.node(range.path))) break;
|
|
289
|
-
site = range.path;
|
|
290
|
-
}
|
|
291
|
-
return site;
|
|
292
|
-
};
|
|
293
|
-
const childrenOf = (index, path) => path.length === 0 ? index.nodes : index.node(path).children ?? [];
|
|
294
|
-
const holdsOwnStructure = (node, facts) => claimsOf(node, facts).some((mark) => (mark.kind === "join" || mark.kind === "split") && isEditingChange(mark.change)) || (node.children ?? []).some((child) => holdsOwnStructure(child, facts));
|
|
295
|
-
/** The pending joins Editing's claims in `node` say their blocks go with. */
|
|
296
|
-
const ownFollowed = (node, facts) => [...claimsOf(node, facts).flatMap((mark) => {
|
|
297
|
-
const key = isEditingChange(mark.change) ? followsOf(mark) : void 0;
|
|
298
|
-
return key ? [incarnationOfLink(key)] : [];
|
|
299
|
-
}), ...(node.children ?? []).flatMap((child) => ownFollowed(child, facts))];
|
|
300
|
-
/**
|
|
301
|
-
* The run around blocks `from` to `to` of the element at `path`: a
|
|
302
|
-
* line on either side, where a join in the run or a pending join after it
|
|
303
|
-
* lands, and before it whatever block a join or split in it lands on.
|
|
304
|
-
*/
|
|
305
|
-
const runAround = (index, path, from, to, facts) => {
|
|
306
|
-
const siblings = childrenOf(index, path);
|
|
307
|
-
const structural = siblings.slice(from, to).some((node) => holdsOwnStructure(node, facts));
|
|
308
|
-
let start = from > 0 && (structural || isTextBlock(getDefined(siblings.at(from - 1)))) ? from - 1 : from;
|
|
309
|
-
const landingPassesOver = (node) => holdsOwnStructure(node, facts) || structural && isSettledDeletion(node, facts);
|
|
310
|
-
while (start > 0 && landingPassesOver(getDefined(siblings.at(start)))) start -= 1;
|
|
311
|
-
const end = pastFollowers(siblings, to, (node) => claimsOf(node, facts));
|
|
312
|
-
return {
|
|
313
|
-
from: start,
|
|
314
|
-
path,
|
|
315
|
-
to: end < siblings.length && isTextBlock(getDefined(siblings.at(end))) ? end + 1 : end
|
|
316
|
-
};
|
|
317
|
-
};
|
|
318
|
-
const ownRuns = (index, change, facts) => {
|
|
319
|
-
const sites = /* @__PURE__ */ new Map();
|
|
320
|
-
change.iterChangedRanges((_fromA, _toA, from, to) => {
|
|
321
|
-
const path = siteOf(index, from, to);
|
|
322
|
-
const key = path.join(",");
|
|
323
|
-
const site = sites.get(key) ?? {
|
|
324
|
-
at: /* @__PURE__ */ new Set(),
|
|
325
|
-
path
|
|
326
|
-
};
|
|
327
|
-
for (const range of index.nodeRangesTouching(from, to)) if ((to === from || range.from < to && range.to > from) && range.path.length === path.length + 1 && path.every((step, depth) => range.path[depth] === step)) site.at.add(range.path[path.length]);
|
|
328
|
-
sites.set(key, site);
|
|
329
|
-
});
|
|
330
|
-
const runs = [];
|
|
331
|
-
for (const { at, path } of sites.values()) for (const child of [...at].toSorted((left, right) => left - right)) {
|
|
332
|
-
const run = runAround(index, path, child, child + 1, facts);
|
|
333
|
-
const last = runs.at(-1);
|
|
334
|
-
if (last && last.path === path && run.from <= last.to) runs[runs.length - 1] = {
|
|
335
|
-
from: Math.min(last.from, run.from),
|
|
336
|
-
path,
|
|
337
|
-
to: Math.max(last.to, run.to)
|
|
338
|
-
};
|
|
339
|
-
else runs.push(run);
|
|
340
|
-
}
|
|
341
|
-
return runs;
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* The contexts a recording minted that its written content rests on, directly
|
|
345
|
-
* or through a kept context's base. Accepting one's own claims can leave a
|
|
346
|
-
* minted context named by nothing, and only content the write changed can name
|
|
347
|
-
* one it minted.
|
|
348
|
-
*/
|
|
349
|
-
const restedOn = (minted, change, indexes) => {
|
|
350
|
-
if (minted.length === 0) return minted;
|
|
351
|
-
const named = /* @__PURE__ */ new Set();
|
|
352
|
-
for (const [root, index] of indexes) for (const range of getInternalDocumentChangeRanges(change, root)) for (const { path } of index.nodeRangesTouching(range[2], range[3])) for (const member of readMembers(index.node(path))) if (member.kind === "in") named.add(member.ctx);
|
|
353
|
-
const bases = new Map(minted.map(({ base, ctx }) => [ctx, base]));
|
|
354
|
-
for (const ctx of named) {
|
|
355
|
-
const base = bases.get(ctx);
|
|
356
|
-
if (base) named.add(base);
|
|
357
|
-
}
|
|
358
|
-
return minted.filter(({ ctx }) => named.has(ctx));
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
* Accept an Editing write's own claims in its commit, over runs of the
|
|
362
|
-
* blocks the write touched. A join or split whose landing waits on another
|
|
363
|
-
* pending change keeps its claim. Completion is left to the commit's
|
|
364
|
-
* canonical pass, which fills in place as Editing does.
|
|
365
|
-
*/
|
|
366
|
-
const acceptOwn = (change, indexes, dependencies, base) => {
|
|
367
|
-
const minted = new Map(dependencies.minted().map((record) => [record.ctx, record]));
|
|
368
|
-
const facts = minted.size === 0 ? base : {
|
|
369
|
-
...base,
|
|
370
|
-
contexts: {
|
|
371
|
-
get: (ctx) => minted.get(ctx) ?? base.contexts.get(ctx),
|
|
372
|
-
has: (ctx) => minted.has(ctx) || base.contexts.has(ctx)
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
const outcome = (id) => isEditingChange(id) ? "accept" : "keep";
|
|
376
|
-
const settledBy = (result) => {
|
|
377
|
-
const kept = /* @__PURE__ */ new Set();
|
|
378
|
-
const visit = (node) => {
|
|
379
|
-
for (const member of readMembers(node)) kept.add(member);
|
|
380
|
-
node.children?.forEach(visit);
|
|
381
|
-
};
|
|
382
|
-
result.forEach(visit);
|
|
383
|
-
const own = (kind) => (node) => claimsOf(node, facts).some((mark) => mark.kind === kind && isEditingChange(mark.change) && !kept.has(mark));
|
|
384
|
-
return {
|
|
385
|
-
joins: own("join"),
|
|
386
|
-
removes: own("delete"),
|
|
387
|
-
wholeWhenRemoved: () => false
|
|
388
|
-
};
|
|
389
|
-
};
|
|
390
|
-
const changes = /* @__PURE__ */ new Map();
|
|
391
|
-
const accepted = new Map(indexes);
|
|
392
|
-
const landed = [];
|
|
393
|
-
const resolveOwn = (nodes, root) => {
|
|
394
|
-
const resolution = resolveAuthoredChildren(nodes, outcome, null, root, {
|
|
395
|
-
dependencies,
|
|
396
|
-
facts,
|
|
397
|
-
stores: true
|
|
398
|
-
});
|
|
399
|
-
landed.push(...resolution.landed);
|
|
400
|
-
return resolution.children;
|
|
401
|
-
};
|
|
402
|
-
for (const [root, index] of indexes) {
|
|
403
|
-
const rootChange = getInternalDocumentRootChange(change, root);
|
|
404
|
-
if (!rootChange) continue;
|
|
405
|
-
const resolveRun = (first) => {
|
|
406
|
-
for (let run = first;;) {
|
|
407
|
-
const siblings = childrenOf(index, run.path);
|
|
408
|
-
const keys = new Set(siblings.slice(run.from, run.to).flatMap((node) => ownFollowed(node, facts)));
|
|
409
|
-
if (keys.size > 0) {
|
|
410
|
-
const lines = [];
|
|
411
|
-
if (run.path.length === 0) countCoreWork("wholeReadNodes", siblings.length);
|
|
412
|
-
siblings.forEach((node, at) => {
|
|
413
|
-
if (blockFactsOf(node).joins.some((key) => keys.has(key))) lines.push(at);
|
|
414
|
-
});
|
|
415
|
-
if (lines.length === 0 && run.path.length > 0) {
|
|
416
|
-
const at = getDefined(run.path.at(-1));
|
|
417
|
-
run = runAround(index, run.path.slice(0, -1), at, at + 1, facts);
|
|
418
|
-
continue;
|
|
419
|
-
}
|
|
420
|
-
run = {
|
|
421
|
-
...run,
|
|
422
|
-
from: Math.min(run.from, ...lines),
|
|
423
|
-
to: Math.max(run.to, ...lines.map((at) => at + 1))
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
const nodes = siblings.slice(run.from, run.to);
|
|
427
|
-
if (run.path.length === 0) return {
|
|
428
|
-
nodes,
|
|
429
|
-
result: resolveOwn(nodes, root),
|
|
430
|
-
run
|
|
431
|
-
};
|
|
432
|
-
const shell = {
|
|
433
|
-
...nodePropsOf(index.node(run.path)),
|
|
434
|
-
children: [...nodes]
|
|
435
|
-
};
|
|
436
|
-
const [only, ...rest] = resolveOwn([shell], root);
|
|
437
|
-
const leading = nodes.find((node) => !isSettledDeletion(node, facts));
|
|
438
|
-
if (only && rest.length === 0 && jsonEqual(nodePropsOf(only), nodePropsOf(shell)) && !(run.from === 0 && leading && holdsOwnStructure(leading, facts))) return {
|
|
439
|
-
nodes,
|
|
440
|
-
result: only.children ?? [],
|
|
441
|
-
run
|
|
442
|
-
};
|
|
443
|
-
const at = getDefined(run.path.at(-1));
|
|
444
|
-
run = runAround(index, run.path.slice(0, -1), at, at + 1, facts);
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
let runs = ownRuns(index, rootChange, facts);
|
|
448
|
-
let spans = [];
|
|
449
|
-
for (let merged = true; merged; runs = spans.map((span) => span.run)) {
|
|
450
|
-
merged = false;
|
|
451
|
-
spans = [];
|
|
452
|
-
for (const span of runs.map(resolveRun).map((entry) => ({
|
|
453
|
-
...entry,
|
|
454
|
-
from: index.childPosition(entry.run.path, entry.run.from),
|
|
455
|
-
to: index.childPosition(entry.run.path, entry.run.to)
|
|
456
|
-
})).toSorted((left, right) => left.from - right.from || right.to - left.to)) {
|
|
457
|
-
const last = spans.at(-1);
|
|
458
|
-
if (!last || span.from >= last.to) spans.push(span);
|
|
459
|
-
else if (span.to > last.to) {
|
|
460
|
-
spans[spans.length - 1] = {
|
|
461
|
-
...last,
|
|
462
|
-
run: {
|
|
463
|
-
...last.run,
|
|
464
|
-
to: span.run.to
|
|
465
|
-
},
|
|
466
|
-
to: span.to
|
|
467
|
-
};
|
|
468
|
-
merged = true;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
let current = index;
|
|
473
|
-
let composed = null;
|
|
474
|
-
for (const { from, nodes, result } of spans.toReversed()) {
|
|
475
|
-
if (jsonEqual(result, nodes)) continue;
|
|
476
|
-
const stored = { children: nodes };
|
|
477
|
-
const settled = { children: result };
|
|
478
|
-
const step = getDefined(getInternalDocumentRootChange(characterAlignedChange(stored, settled, settledBy(result)) ?? DocumentChange.between(stored, settled, { isSetValued: isAuthoredSetValued }), "main")).embed(current.length, from);
|
|
479
|
-
current = step.apply(current);
|
|
480
|
-
composed = composed ? composed.compose(step) : step;
|
|
481
|
-
}
|
|
482
|
-
if (composed) {
|
|
483
|
-
changes.set(root, composed);
|
|
484
|
-
accepted.set(root, current);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return changes.size === 0 ? null : {
|
|
488
|
-
change: createInternalDocumentChange(changes),
|
|
489
|
-
indexes: accepted,
|
|
490
|
-
landed
|
|
491
|
-
};
|
|
492
|
-
};
|
|
493
|
-
const writtenNamedRoots = (steps) => {
|
|
494
|
-
const written = /* @__PURE__ */ new Set();
|
|
495
|
-
for (const step of steps) {
|
|
496
|
-
if (UNSCOPED_ORIGINS.has(step.origin)) continue;
|
|
497
|
-
for (const [root] of getInternalDocumentChangeEntries(step.change)) if (root !== "main") written.add(root);
|
|
498
|
-
}
|
|
499
|
-
return written;
|
|
500
|
-
};
|
|
501
|
-
/**
|
|
502
|
-
* The `authored` plugin with deterministic ids, clock and starting intent,
|
|
503
|
-
* for tests.
|
|
504
|
-
*/
|
|
505
|
-
const createAuthoredPlugin = (options) => {
|
|
506
|
-
const createChangeId = options.createChangeId ?? (() => crypto.randomUUID());
|
|
507
|
-
const createTagId = options.createTagId ?? (() => crypto.randomUUID().replaceAll("-", "").slice(0, 12));
|
|
508
|
-
const now = options.now ?? Date.now;
|
|
509
|
-
const incarnationToken = crypto.randomUUID().slice(0, 8);
|
|
510
|
-
let incarnations = 0;
|
|
511
|
-
const createIncarnationId = options.createIncarnationId ?? (() => {
|
|
512
|
-
incarnations += 1;
|
|
513
|
-
return `${incarnationToken}:${incarnations}`;
|
|
514
|
-
});
|
|
515
|
-
const authorOf = (writing) => getViewAuthor(writing) ?? (typeof options.authorId === "function" ? options.authorId(writing) : options.authorId) ?? null;
|
|
516
|
-
const stateOf = (editor) => {
|
|
517
|
-
const state = STATES.get(getEditorRuntimeOwner(editor));
|
|
518
|
-
if (!state) throw new Error("Authored changes are not installed.");
|
|
519
|
-
return state;
|
|
520
|
-
};
|
|
521
|
-
const viewOf = (editor) => {
|
|
522
|
-
const { views } = stateOf(editor);
|
|
523
|
-
for (let runtime = getEditorRuntime(editor); runtime; runtime = runtime.policySource?.current()) {
|
|
524
|
-
const view = runtime.presentation && views.get(runtime.presentation);
|
|
525
|
-
if (view) return view;
|
|
526
|
-
}
|
|
527
|
-
return views.get(getBaseViewPresentation(getEditorRuntimeOwner(editor))) ?? { intent: "edit" };
|
|
528
|
-
};
|
|
529
|
-
const applyView = (editor, view) => {
|
|
530
|
-
const presentation = getViewPresentation(editor);
|
|
531
|
-
const state = stateOf(editor);
|
|
532
|
-
state.pending.delete(presentation);
|
|
533
|
-
state.views.set(presentation, view);
|
|
534
|
-
notifyPresentationViewState(editor, "authored");
|
|
535
|
-
};
|
|
536
|
-
const applyOnceWordsAreComposed = (editor) => {
|
|
537
|
-
const presentation = getViewPresentation(editor);
|
|
538
|
-
const stop = subscribePresentationComposition(editor, () => {
|
|
539
|
-
if (isPresentationComposing(editor)) return;
|
|
540
|
-
stop();
|
|
541
|
-
const next = stateOf(editor).pending.get(presentation);
|
|
542
|
-
if (next) applyView(editor, next);
|
|
543
|
-
});
|
|
544
|
-
};
|
|
545
|
-
const requestView = (editor, view) => {
|
|
546
|
-
const presentation = getViewPresentation(editor);
|
|
547
|
-
const state = stateOf(editor);
|
|
548
|
-
const waiting = state.pending.has(presentation);
|
|
549
|
-
if (isPresentationComposing(editor)) {
|
|
550
|
-
state.pending.set(presentation, view);
|
|
551
|
-
if (!waiting) applyOnceWordsAreComposed(editor);
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
const current = state.views.get(presentation);
|
|
555
|
-
const modeOf = (value) => "intent" in value ? value.intent : value.preview;
|
|
556
|
-
if (waiting || !current || modeOf(current) !== modeOf(view)) applyView(editor, view);
|
|
557
|
-
};
|
|
558
|
-
const settleWaitingView = (editor) => {
|
|
559
|
-
const waiting = stateOf(editor).pending.get(getViewPresentation(editor));
|
|
560
|
-
if (waiting && !isPresentationComposing(editor)) applyView(editor, waiting);
|
|
561
|
-
};
|
|
562
|
-
const previewModeOf = (editor) => {
|
|
563
|
-
const view = viewOf(editor);
|
|
564
|
-
return "preview" in view && !STORED_READS.has(getEditorRuntimeOwner(editor)) ? view.preview : null;
|
|
565
|
-
};
|
|
566
|
-
const viewPlacesOf = (editor) => {
|
|
567
|
-
const preview = previewModeOf(editor);
|
|
568
|
-
return preview ? ledgerOf(editor).viewPlaces(storedValue(editor), preview, getEditorRuntimeRoot(editor)) : null;
|
|
569
|
-
};
|
|
570
|
-
const decisionOn = (editor, value, decisions, withdraws) => {
|
|
571
|
-
const book = changesOf(editor, value);
|
|
572
|
-
const actions = /* @__PURE__ */ new Map();
|
|
573
|
-
let conflicting = false;
|
|
574
|
-
const stale = /* @__PURE__ */ new Set();
|
|
575
|
-
for (const decision of [decisions].flat()) for (const read of "groups" in decision ? decision.groups : decision.changes) {
|
|
576
|
-
const current = "groups" in decision ? book.groupOf(read.id) : book.change(read.id);
|
|
577
|
-
if (current?.id !== read.id || current.revision !== read.revision) stale.add(read.id);
|
|
578
|
-
}
|
|
579
|
-
if (stale.size > 0) return { result: {
|
|
580
|
-
ids: [...stale],
|
|
581
|
-
status: "stale"
|
|
582
|
-
} };
|
|
583
|
-
for (const decision of [decisions].flat()) {
|
|
584
|
-
const decided = "groups" in decision ? decision.groups.flatMap((group) => book.members(group.id).map((entry) => entry.id)) : decision.changes.map((change) => change.id);
|
|
585
|
-
for (const id of decided) {
|
|
586
|
-
conflicting ||= (actions.get(id) ?? decision.action) !== decision.action;
|
|
587
|
-
actions.set(id, decision.action);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
const ids = [...actions.keys()];
|
|
591
|
-
if (conflicting) return { result: {
|
|
592
|
-
ids,
|
|
593
|
-
status: "invalid"
|
|
594
|
-
} };
|
|
595
|
-
if (ids.length === 0) return { result: {
|
|
596
|
-
ids,
|
|
597
|
-
status: "unchanged"
|
|
598
|
-
} };
|
|
599
|
-
const outcome = decide(value, {
|
|
600
|
-
actions,
|
|
601
|
-
token: createIncarnationId,
|
|
602
|
-
withdraws
|
|
603
|
-
}, {
|
|
604
|
-
book,
|
|
605
|
-
resolveSchema: authoredResolveSchemaOf(editor),
|
|
606
|
-
spares: spareGuardOver(getCompiledEditorSchema(editor), getEditorSchema(editor), value)
|
|
607
|
-
});
|
|
608
|
-
if (outcome.status === "blocked") return { result: {
|
|
609
|
-
ids,
|
|
610
|
-
status: "blocked",
|
|
611
|
-
with: outcome.with
|
|
612
|
-
} };
|
|
613
|
-
if (outcome.status === "invalid") return { result: {
|
|
614
|
-
ids,
|
|
615
|
-
status: "invalid"
|
|
616
|
-
} };
|
|
617
|
-
const { change, value: decidedValue, windowed: decided } = outcome;
|
|
618
|
-
const schema = getEditorSchema(editor);
|
|
619
|
-
try {
|
|
620
|
-
if (decided) schema.checkDocumentChange({
|
|
621
|
-
after: decidedValue,
|
|
622
|
-
before: value,
|
|
623
|
-
change,
|
|
624
|
-
indexedAfter: decided.indexedAfter,
|
|
625
|
-
indexedBefore: decided.indexedBefore
|
|
626
|
-
});
|
|
627
|
-
else schema.assertDocument(decidedValue);
|
|
628
|
-
} catch (error) {
|
|
629
|
-
if (isRefusal(error)) return { result: {
|
|
630
|
-
ids,
|
|
631
|
-
status: "invalid"
|
|
632
|
-
} };
|
|
633
|
-
throw error;
|
|
634
|
-
}
|
|
635
|
-
if (change.empty) return { result: {
|
|
636
|
-
ids: [],
|
|
637
|
-
status: "unchanged"
|
|
638
|
-
} };
|
|
639
|
-
return {
|
|
640
|
-
change,
|
|
641
|
-
result: {
|
|
642
|
-
ids: [...outcome.decided],
|
|
643
|
-
status: "applied"
|
|
644
|
-
},
|
|
645
|
-
settles: settlesTextAlone(value, change, [.../* @__PURE__ */ new Set([...ids, ...outcome.decided])], actions, (id) => book.occurrences(id), withdraws)
|
|
646
|
-
};
|
|
647
|
-
};
|
|
648
|
-
const decideOn = (editor, value, decisions, withdraws, apply) => readingCovered({
|
|
649
|
-
cover: () => void 0,
|
|
650
|
-
read: () => apply(decisionOn(editor, value, decisions, withdraws))
|
|
651
|
-
});
|
|
652
|
-
return definePlugin("authored", {
|
|
653
|
-
dependencies: [authoredRecords],
|
|
654
|
-
schema: authoredMarksSchema,
|
|
655
|
-
contributions: [documentAdmissionPoint.of(authoredAdmission), authoredDocumentCapabilityPoint.of({
|
|
656
|
-
claimsBreakBefore,
|
|
657
|
-
pending: (document) => indexAuthoredChanges(document).changes.size,
|
|
658
|
-
project: (document, projection, schema) => withoutGeneration(() => projectAuthoredDocumentUnder(document, projection, storedResolveSchemaOf(schema, document))),
|
|
659
|
-
projectDecided: (document, projection, schema) => projectAuthoredDocumentUnder(document, projection, storedResolveSchemaOf(schema, document)),
|
|
660
|
-
projectBlocks: (document, projection, schema, root, paths) => withoutGeneration(() => projectAuthoredBlocks(document, projection, storedResolveSchemaOf(schema, document), root, paths)),
|
|
661
|
-
repair: (document, schema) => admitDocument(authoredAdmission, document, schema).document,
|
|
662
|
-
spareBlock,
|
|
663
|
-
spareRoot
|
|
664
|
-
})],
|
|
665
|
-
api: ({ editor }) => ({
|
|
666
|
-
setView: (view) => {
|
|
667
|
-
if (("preview" in view || view.intent === "propose") && !storesGeneratedValues(getCompiledEditorSchema(editor))) {
|
|
668
|
-
publishEditorRefusal(editor, GENERATED_VALUES_REFUSAL);
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
requestView(editor, view);
|
|
672
|
-
},
|
|
673
|
-
subscribeRefusals: (listener) => subscribeEditorRefusals(editor, (refusal) => runEditorObserver(editor, "commit-listener", () => listener(refusal))),
|
|
674
|
-
subscribeChanges: (listener) => {
|
|
675
|
-
const runtime = getEditorRuntime(editor);
|
|
676
|
-
let publisher = PUBLISHERS.get(runtime);
|
|
677
|
-
if (!publisher) {
|
|
678
|
-
const ledger = ledgerOf(editor);
|
|
679
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
680
|
-
const sink = ledger.subscribe(storedValue(editor), previewModeOf(editor));
|
|
681
|
-
const publish = () => ledger.publish(storedValue(editor), sink, previewModeOf(editor), getEditorRuntimeRoot(editor));
|
|
682
|
-
let delivered = publish().delta;
|
|
683
|
-
publisher = {
|
|
684
|
-
ledger,
|
|
685
|
-
listeners,
|
|
686
|
-
sink,
|
|
687
|
-
stop: runtime.subscribe(() => {
|
|
688
|
-
const { delta, ranks } = publish();
|
|
689
|
-
const fresh = delta !== delivered;
|
|
690
|
-
const blocks = ranks.flatMap((rank) => {
|
|
691
|
-
const key = editor.key([rank]);
|
|
692
|
-
return key ? [key] : [];
|
|
693
|
-
});
|
|
694
|
-
delivered = delta;
|
|
695
|
-
if (blocks.length === 0 && (!fresh || delta.changed.length === 0 && delta.groups.length === 0 && delta.removed.length === 0)) return;
|
|
696
|
-
const view = Object.freeze({
|
|
697
|
-
blocks: Object.freeze(blocks),
|
|
698
|
-
changed: fresh ? delta.changed : [],
|
|
699
|
-
groups: fresh ? delta.groups : [],
|
|
700
|
-
removed: fresh ? delta.removed : []
|
|
701
|
-
});
|
|
702
|
-
notifyObservers(editor, listeners, "snapshot-listener", (each) => each(view));
|
|
703
|
-
})
|
|
704
|
-
};
|
|
705
|
-
PUBLISHERS.set(runtime, publisher);
|
|
706
|
-
}
|
|
707
|
-
const { ledger, listeners, sink, stop } = publisher;
|
|
708
|
-
listeners.add(listener);
|
|
709
|
-
return () => {
|
|
710
|
-
if (!listeners.delete(listener) || listeners.size > 0) return;
|
|
711
|
-
stop();
|
|
712
|
-
ledger.unsubscribe(sink);
|
|
713
|
-
PUBLISHERS.delete(runtime);
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
}),
|
|
717
|
-
read: ({ editor }) => ({
|
|
718
|
-
view: () => viewOf(editor),
|
|
719
|
-
change: (id) => changesOf(editor, storedValue(editor)).change(id),
|
|
720
|
-
changes: (query = {}) => {
|
|
721
|
-
const limit = query.limit ?? 50;
|
|
722
|
-
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 200) throw new Error("Authored page limit must be between 1 and 200.");
|
|
723
|
-
const book = changesOf(editor, storedValue(editor));
|
|
724
|
-
const { cursor: _cursor, limit: _limit, ...rest } = query;
|
|
725
|
-
const fingerprint = JSON.stringify(query.at === void 0 ? rest : [
|
|
726
|
-
rest,
|
|
727
|
-
getEditorRuntimeRoot(editor),
|
|
728
|
-
previewModeOf(editor) ?? "stored"
|
|
729
|
-
]);
|
|
730
|
-
const inCard = query.group === void 0 ? null : book.inCard(query.group);
|
|
731
|
-
const at = query.at === void 0 ? null : placeIds(editor, book, query.at, viewPlacesOf(editor)).filter((id) => !inCard || inCard(id));
|
|
732
|
-
const matches = (id) => {
|
|
733
|
-
const change = getDefined(book.change(id));
|
|
734
|
-
return query.authorId === void 0 || change.authorId === query.authorId;
|
|
735
|
-
};
|
|
736
|
-
let start = null;
|
|
737
|
-
let after = false;
|
|
738
|
-
if (query.cursor !== void 0) {
|
|
739
|
-
const [text, next, last] = readCursor(query.cursor);
|
|
740
|
-
if (text !== fingerprint) throw new Error("Stale authored page cursor.");
|
|
741
|
-
if (book.has(next) && (!at || at.includes(next))) start = next;
|
|
742
|
-
else if (book.has(last) && (!at || at.includes(last))) {
|
|
743
|
-
start = last;
|
|
744
|
-
after = true;
|
|
745
|
-
} else throw new Error("Stale authored page cursor.");
|
|
746
|
-
}
|
|
747
|
-
const ids = at ? at.slice(start === null ? 0 : at.indexOf(start) + (after ? 1 : 0)) : book.idsFrom({
|
|
748
|
-
after,
|
|
749
|
-
group: query.group,
|
|
750
|
-
start
|
|
751
|
-
});
|
|
752
|
-
const items = [];
|
|
753
|
-
let next = null;
|
|
754
|
-
for (const id of ids) {
|
|
755
|
-
if (!matches(id)) continue;
|
|
756
|
-
if (items.length === limit) {
|
|
757
|
-
next = id;
|
|
758
|
-
break;
|
|
759
|
-
}
|
|
760
|
-
items.push(getDefined(book.change(id)));
|
|
761
|
-
}
|
|
762
|
-
return Object.freeze({
|
|
763
|
-
cursor: next === null ? null : JSON.stringify([
|
|
764
|
-
fingerprint,
|
|
765
|
-
next,
|
|
766
|
-
getDefined(items.at(-1)).id
|
|
767
|
-
]),
|
|
768
|
-
items: Object.freeze(items)
|
|
769
|
-
});
|
|
770
|
-
},
|
|
771
|
-
details: (id) => {
|
|
772
|
-
const book = changesOf(editor, storedValue(editor));
|
|
773
|
-
return readAuthoredDetails({
|
|
774
|
-
changes: { get: (change) => book.change(change) ?? void 0 },
|
|
775
|
-
occurrences: { get: (change) => book.occurrences(change) }
|
|
776
|
-
}, id);
|
|
777
|
-
},
|
|
778
|
-
groupOf: (changeId) => changesOf(editor, storedValue(editor)).groupOf(changeId),
|
|
779
|
-
outcome: (id) => {
|
|
780
|
-
const value = storedValue(editor);
|
|
781
|
-
return changesOf(editor, value).change(id) ? "pending" : factsOf(value).verdictOf(id);
|
|
782
|
-
},
|
|
783
|
-
groups: ({ at }) => {
|
|
784
|
-
const book = changesOf(editor, storedValue(editor));
|
|
785
|
-
return Object.freeze(book.cardsOf(placeIds(editor, book, at, viewPlacesOf(editor))));
|
|
786
|
-
},
|
|
787
|
-
reviewOf: (node) => {
|
|
788
|
-
const facts = factsOf(storedValue(editor));
|
|
789
|
-
const marks = marksOf(node, facts);
|
|
790
|
-
return Object.freeze({
|
|
791
|
-
accepted: Object.freeze(acceptedValues(node, standingClaimsOf(node, facts, facts).filter((mark) => mark.kind === "format"), {
|
|
792
|
-
accepted: (member) => isAccepted(facts, member),
|
|
793
|
-
landed: facts.landed,
|
|
794
|
-
output: elementSplitOutput(getCompiledEditorSchema(editor))
|
|
795
|
-
})),
|
|
796
|
-
hidden: isSettledDeletion(node, facts),
|
|
797
|
-
marks
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
}),
|
|
801
|
-
update: ({ editor, tx }) => {
|
|
802
|
-
const apply = (decided) => {
|
|
803
|
-
if (!("change" in decided)) return decided.result;
|
|
804
|
-
const update = getActiveEditorUpdateId(editor);
|
|
805
|
-
if (update) stateOf(editor).passThrough.add(update);
|
|
806
|
-
try {
|
|
807
|
-
if (decided.settles) applyDocumentChange(getEditorRuntimeOwner(editor), decided.change, { settles: "content" });
|
|
808
|
-
else tx.changes.apply(decided.change);
|
|
809
|
-
} catch (error) {
|
|
810
|
-
if (isRefusal(error)) return {
|
|
811
|
-
ids: decided.result.ids,
|
|
812
|
-
status: "invalid"
|
|
813
|
-
};
|
|
814
|
-
throw error;
|
|
815
|
-
}
|
|
816
|
-
return decided.result;
|
|
817
|
-
};
|
|
818
|
-
const decideCovered = (decisions, withdraws = false) => decideOn(editor, tx.value(), decisions, withdraws, apply);
|
|
819
|
-
return {
|
|
820
|
-
decide: txStored((decisions) => decideCovered(decisions)),
|
|
821
|
-
withdraw: txStored((changes) => {
|
|
822
|
-
const author = authorOf(getAuthoredUpdateView(editor));
|
|
823
|
-
if (changes.some((change) => change.authorId !== author)) return {
|
|
824
|
-
ids: changes.map((change) => change.id),
|
|
825
|
-
status: "invalid"
|
|
826
|
-
};
|
|
827
|
-
return decideCovered({
|
|
828
|
-
action: "reject",
|
|
829
|
-
changes
|
|
830
|
-
}, true);
|
|
831
|
-
}),
|
|
832
|
-
propose: txOnly((input = {}) => {
|
|
833
|
-
const state = stateOf(editor);
|
|
834
|
-
const update = getActiveEditorUpdateId(editor);
|
|
835
|
-
if (!update) throw new Error("Authored proposals require an active update.");
|
|
836
|
-
if (input.changeId !== void 0 && isEditingChange(input.changeId)) throw new Error(`Authored change ids starting with ${editingChangeOf("")} are reserved for Editing.`);
|
|
837
|
-
const changeId = input.changeId ?? createChangeId();
|
|
838
|
-
const value = tx.value();
|
|
839
|
-
const claim = state.marks.authorOf(changeId) === null ? null : claimOf(value, changeId);
|
|
840
|
-
const decided = !claim && (state.marks.authorOf(changeId) !== null || factsOf(value).verdictOf(changeId) !== null);
|
|
841
|
-
state.forced.set(update, claim ? {
|
|
842
|
-
at: claim.at,
|
|
843
|
-
changeId,
|
|
844
|
-
inc: claim.inc
|
|
845
|
-
} : {
|
|
846
|
-
at: now(),
|
|
847
|
-
changeId,
|
|
848
|
-
inc: decided ? createIncarnationId() : void 0
|
|
849
|
-
});
|
|
850
|
-
return changeId;
|
|
851
|
-
})
|
|
852
|
-
};
|
|
853
|
-
},
|
|
854
|
-
activate: ({ afterPublish, beforePublish, editor, onCleanup }) => {
|
|
855
|
-
const owner = getEditorRuntimeOwner(editor);
|
|
856
|
-
const state = {
|
|
857
|
-
authorId: () => authorOf(editor),
|
|
858
|
-
createChangeId,
|
|
859
|
-
forced: /* @__PURE__ */ new WeakMap(),
|
|
860
|
-
marks: createDocumentMarksValidator(),
|
|
861
|
-
passThrough: /* @__PURE__ */ new WeakSet(),
|
|
862
|
-
pending: /* @__PURE__ */ new WeakMap(),
|
|
863
|
-
refused: /* @__PURE__ */ new WeakMap(),
|
|
864
|
-
views: /* @__PURE__ */ new WeakMap()
|
|
865
|
-
};
|
|
866
|
-
if (options.intent) state.views.set(getBaseViewPresentation(owner), { intent: options.intent });
|
|
867
|
-
STATES.set(owner, state);
|
|
868
|
-
onCleanup(() => STATES.delete(owner));
|
|
869
|
-
const ledger = createReviewLedger(owner, () => authoredResolveSchemaOf(editor), state.marks);
|
|
870
|
-
const { holders } = ledger;
|
|
871
|
-
const spareBlocksOf = (value) => {
|
|
872
|
-
const schema = getCompiledEditorSchema(editor);
|
|
873
|
-
const generated = generatedOf(schema);
|
|
874
|
-
const indexes = contentRootsOf(value);
|
|
875
|
-
return {
|
|
876
|
-
indexes,
|
|
877
|
-
marked: (root) => holders.at({
|
|
878
|
-
contexts: factsOf(value),
|
|
879
|
-
generated,
|
|
880
|
-
schema
|
|
881
|
-
}, root, getDefined(indexes.get(root))).marked()
|
|
882
|
-
};
|
|
883
|
-
};
|
|
884
|
-
onCleanup(getEditorRuntime(owner).subscribeCommit((commit) => {
|
|
885
|
-
ledger.carry(commit);
|
|
886
|
-
if (commit.changes.createRoots.size > 0) ledger.buildProjectionAccepted(storedValue(editor));
|
|
887
|
-
}));
|
|
888
|
-
const builtPlacements = /* @__PURE__ */ new Map();
|
|
889
|
-
const leansFor = (preview) => builtPlacements.get(getPlacementGeneration(owner)) === preview;
|
|
890
|
-
onCleanup(subscribeCommittedPlacement(owner, (generation) => {
|
|
891
|
-
for (const placed of builtPlacements.keys()) if (placed !== generation) builtPlacements.delete(placed);
|
|
892
|
-
}));
|
|
893
|
-
onCleanup(registerAuthoredRuntime(owner, {
|
|
894
|
-
mapToView: (view, root, value) => {
|
|
895
|
-
const preview = previewModeOf(view);
|
|
896
|
-
if (!preview) return value;
|
|
897
|
-
const map = ledger.lens(storedValue(owner), preview).locations(root);
|
|
898
|
-
if (PathApi.isPath(value)) return map.path(value);
|
|
899
|
-
if (PointApi.isPoint(value)) return map.point(value, -1);
|
|
900
|
-
return map.range(value);
|
|
901
|
-
},
|
|
902
|
-
readStored: storedRead,
|
|
903
|
-
readView: (view, read) => {
|
|
904
|
-
const preview = previewModeOf(view);
|
|
905
|
-
if (!preview) return read();
|
|
906
|
-
const stored = storedValue(owner);
|
|
907
|
-
const root = withEditorDocumentProjection(owner, void 0, () => getCurrentSelectionRoot(owner));
|
|
908
|
-
return withEditorDocumentProjection(owner, ledger.preview(stored, preview), read, {
|
|
909
|
-
root,
|
|
910
|
-
selection: () => ledger.lens(stored, preview).toView(withEditorDocumentProjection(owner, void 0, () => getCurrentSelection(owner)), root, leansFor(preview))
|
|
911
|
-
});
|
|
912
|
-
},
|
|
913
|
-
requestView,
|
|
914
|
-
setView: (view, value) => {
|
|
915
|
-
state.views.set(getViewPresentation(view), value);
|
|
916
|
-
},
|
|
917
|
-
toStored: (view, root, target) => {
|
|
918
|
-
const preview = previewModeOf(view);
|
|
919
|
-
if (!preview) return {
|
|
920
|
-
kind: "stored",
|
|
921
|
-
target
|
|
922
|
-
};
|
|
923
|
-
const lifted = ledger.lens(storedValue(owner), preview).fromView(target, root);
|
|
924
|
-
if (lifted.kind === "stored" && lifted.shownInBuilt) builtPlacements.set(nextMintedGeneration(owner), preview);
|
|
925
|
-
return lifted;
|
|
926
|
-
},
|
|
927
|
-
view: viewOf,
|
|
928
|
-
viewCommit: (view, commit) => {
|
|
929
|
-
const preview = previewModeOf(view);
|
|
930
|
-
return preview ? ledger.previewCommit(commit, preview, leansFor(preview)) : commit;
|
|
931
|
-
}
|
|
932
|
-
}));
|
|
933
|
-
const passesThrough = () => {
|
|
934
|
-
const update = getActiveEditorUpdateId(editor);
|
|
935
|
-
return update !== null && state.passThrough.has(update);
|
|
936
|
-
};
|
|
937
|
-
let framed = false;
|
|
938
|
-
beforePublish(() => {
|
|
939
|
-
const value = editor.read.value();
|
|
940
|
-
({framed} = ledger.prepare(value));
|
|
941
|
-
if (storesSpares(getCompiledEditorSchema(editor))) {
|
|
942
|
-
const { indexes, marked } = spareBlocksOf(value);
|
|
943
|
-
for (const root of indexes.keys()) marked(root);
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
afterPublish(() => {
|
|
947
|
-
if (framed) prepareCommandFrame(editor);
|
|
948
|
-
const schema = getCompiledEditorSchema(editor);
|
|
949
|
-
if (storesSpares(schema)) ledger.shown.load(storedRead(editor, (stored) => stored.read.value()), schema);
|
|
950
|
-
});
|
|
951
|
-
onCleanup(registerEditorDraftGuard(editor, (value) => ledger.check(value)));
|
|
952
|
-
onCleanup(registerEditorContent(editor, (reader, node) => !isStruck(reader, node)));
|
|
953
|
-
onCleanup(registerEditorCommandDocument(editor, {
|
|
954
|
-
recorded: (input) => {
|
|
955
|
-
ledger.recorded(input);
|
|
956
|
-
const check = framedLawCheck();
|
|
957
|
-
if (check !== "0") assertFramedLaw(input, authoredResolveSchemaOf(editor), check !== "content", () => ledger.projectionMap(input.stored.value, "proposed"));
|
|
958
|
-
},
|
|
959
|
-
project: (value) => {
|
|
960
|
-
if (passesThrough() || isReplay(getActiveEditorUpdateTags(editor))) return null;
|
|
961
|
-
return ledger.frame(value);
|
|
962
|
-
},
|
|
963
|
-
refuse: unrepresentableFor,
|
|
964
|
-
unplaced
|
|
965
|
-
}));
|
|
966
|
-
onCleanup(registerEditorDraftView(editor, () => {
|
|
967
|
-
if (passesThrough() || isReplay(getActiveEditorUpdateTags(editor))) return false;
|
|
968
|
-
const update = getActiveEditorUpdateId(editor);
|
|
969
|
-
const viewEditor = getAuthoredUpdateView(editor);
|
|
970
|
-
settleWaitingView(viewEditor);
|
|
971
|
-
const view = viewOf(viewEditor);
|
|
972
|
-
return update !== null && state.forced.has(update) || "intent" in view && view.intent === "propose";
|
|
973
|
-
}));
|
|
974
|
-
const minted = /* @__PURE__ */ new WeakMap();
|
|
975
|
-
onCleanup(registerEditorDocumentRecorder(editor, (input) => {
|
|
976
|
-
if (isReplay(input.tags)) return null;
|
|
977
|
-
if (input.steps.length > 0 && input.steps.every((step) => step.origin === "migration")) return null;
|
|
978
|
-
if (passesThrough()) {
|
|
979
|
-
const relink = relinkCuts(input.change, input.before, input.after, (root) => rootOf(input.after, root));
|
|
980
|
-
return relink ? {
|
|
981
|
-
change: input.change.compose(relink.change),
|
|
982
|
-
selection: input.selection
|
|
983
|
-
} : null;
|
|
984
|
-
}
|
|
985
|
-
const update = getActiveEditorUpdateId(editor);
|
|
986
|
-
const forced = update ? state.forced.get(update) ?? null : null;
|
|
987
|
-
const viewEditor = getAuthoredUpdateView(editor);
|
|
988
|
-
settleWaitingView(viewEditor);
|
|
989
|
-
const updateView = viewOf(viewEditor);
|
|
990
|
-
const before = input.before;
|
|
991
|
-
const after = input.after;
|
|
992
|
-
const contentChange = contentChangeOf(input.change);
|
|
993
|
-
const steps = input.steps.map((step) => {
|
|
994
|
-
const change = contentChangeOf(step.change);
|
|
995
|
-
return change === step.change ? step : {
|
|
996
|
-
...step,
|
|
997
|
-
change
|
|
998
|
-
};
|
|
999
|
-
});
|
|
1000
|
-
const contentSteps = steps.filter((step) => step.origin !== "root");
|
|
1001
|
-
const ownRecords = getInternalDocumentChangeRecords(input.change);
|
|
1002
|
-
const known = factsOf(withStore(before, getValueRecords(after)));
|
|
1003
|
-
if ("preview" in updateView) throw new Error("A preview view does not take this write.");
|
|
1004
|
-
if (!input.projection) {
|
|
1005
|
-
const written = writtenNamedRoots(contentSteps);
|
|
1006
|
-
if (written.size > 0) {
|
|
1007
|
-
const dropped = ledger.dropped(before);
|
|
1008
|
-
if ([...written].some((root) => dropped.has(root))) throw unplaced();
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
const editing = !forced && updateView.intent === "edit";
|
|
1012
|
-
const writer = authorOf(viewEditor);
|
|
1013
|
-
if (writer === null) throw new Error("An author ID is required for authored writes.");
|
|
1014
|
-
const byName = contentChange.deleteRoots.size > 0 ? new Set(rootsDeletedByName(getCompiledEditorSchema(editor), input.projection?.value ?? before, after, changedRootsOf(contentChange), contentChange.deleteRoots)) : NO_ROOTS;
|
|
1015
|
-
if (!editing && byName.size > 0) throw unrepresentable("Suggesting cannot delete a named root; suggest deleting its content.");
|
|
1016
|
-
const followed = byName.size === 0 ? contentChange.deleteRoots : new Set([...contentChange.deleteRoots].filter((root) => !byName.has(root)));
|
|
1017
|
-
const createdThenDeleted = new Set(steps.flatMap((step) => [...step.change.createRoots].filter((root) => !contentChange.createRoots.has(root) && !before.roots?.[root])));
|
|
1018
|
-
const createRoots = createdThenDeleted.size === 0 ? contentChange.createRoots : /* @__PURE__ */ new Set([...contentChange.createRoots, ...createdThenDeleted]);
|
|
1019
|
-
const withdrawable = createdThenDeleted.size === 0 ? followed : /* @__PURE__ */ new Set([...followed, ...createdThenDeleted]);
|
|
1020
|
-
if (!editing) {
|
|
1021
|
-
const vetoes = options.vetoes === false || updateView.intent !== "propose" ? [] : getPluginContributions(editor, authoredVeto);
|
|
1022
|
-
const refusal = (update && state.refused.get(update)) ?? (!storesGeneratedValues(getCompiledEditorSchema(editor)) ? GENERATED_VALUES_REFUSAL : vetoes.length > 0 ? proposalRefusal(contentSteps, vetoes) : null);
|
|
1023
|
-
if (refusal) {
|
|
1024
|
-
if (update) state.refused.set(update, refusal);
|
|
1025
|
-
throw new EditorRefusalError(refusal, refusal.message);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
const { composition } = input;
|
|
1029
|
-
const focusBefore = input.selectionBefore?.kind !== "text" ? null : PointApi.equals(input.selectionBefore.anchor, input.selectionBefore.focus) ? input.selectionBefore.focus : composition ? RangeApi.start(input.selectionBefore) : null;
|
|
1030
|
-
const compositionRoot = composition ? composition.place.root ?? input.selectionBeforeRoot : null;
|
|
1031
|
-
const selectionPosition = focusBefore ? positionOf(before, input.selectionBeforeRoot, focusBefore) : null;
|
|
1032
|
-
const minting = minted.get(input.update) ?? {
|
|
1033
|
-
at: forced?.at ?? now(),
|
|
1034
|
-
changeId: editing ? editingChangeOf(writer) : createChangeId()
|
|
1035
|
-
};
|
|
1036
|
-
minted.set(input.update, minting);
|
|
1037
|
-
const { at, changeId } = minting;
|
|
1038
|
-
const dependencies = createDependencies(known, carriedIn(after));
|
|
1039
|
-
let commitWrite;
|
|
1040
|
-
const commitWriteId = () => commitWrite ??= createTagId();
|
|
1041
|
-
const landedHere = (write) => editing && write === commitWrite || known.landed(write);
|
|
1042
|
-
const standing = {
|
|
1043
|
-
accepted: (member) => isAccepted(known, member),
|
|
1044
|
-
landed: landedHere
|
|
1045
|
-
};
|
|
1046
|
-
const compiled = getCompiledEditorSchema(editor);
|
|
1047
|
-
const oneText = (type) => holdsOneText(getEditorSchema(editor), type);
|
|
1048
|
-
const recorded = recordAuthoredSteps({
|
|
1049
|
-
before,
|
|
1050
|
-
changeId,
|
|
1051
|
-
composition: composition && compositionRoot !== null ? {
|
|
1052
|
-
element: composition.place.path.slice(0, -1),
|
|
1053
|
-
position: positionOf(before, compositionRoot, composition.place),
|
|
1054
|
-
root: compositionRoot
|
|
1055
|
-
} : null,
|
|
1056
|
-
createRoots,
|
|
1057
|
-
createTagId,
|
|
1058
|
-
crossesUnique: (from, to) => crossesUniqueTarget(compiled, from, to),
|
|
1059
|
-
holdsUnique: (type, key) => holdsUniqueKey(compiled, type, key),
|
|
1060
|
-
deleteRoots: byName,
|
|
1061
|
-
dependencies,
|
|
1062
|
-
fill: (site, root) => completeChildrenAt(editor, site.map(elementOf), [], root).children,
|
|
1063
|
-
followed,
|
|
1064
|
-
forcedChangeId: forced?.changeId ?? (editing ? changeId : null),
|
|
1065
|
-
projection: input.projection,
|
|
1066
|
-
inc: forced?.inc ?? null,
|
|
1067
|
-
gridRoles: gridRolesOf(compiled),
|
|
1068
|
-
isInline: (props) => getEditorSchema(editor).isInline(elementOf(props)),
|
|
1069
|
-
emptyTextKeeps: (key, value, parents, root) => {
|
|
1070
|
-
const [parent, ...ancestors] = parents.map(elementOf);
|
|
1071
|
-
return !getEditorSchema(editor).emptyTextDrops({
|
|
1072
|
-
ancestors,
|
|
1073
|
-
parent,
|
|
1074
|
-
root
|
|
1075
|
-
})?.(key, value);
|
|
1076
|
-
},
|
|
1077
|
-
keepsOnSplit: ({ continuation, path, reviewDraft, source }, root) => getEditorSchema(editor).elementSplitKeepsAt(elementOf(source), elementOf(continuation), {
|
|
1078
|
-
children: reviewDraft,
|
|
1079
|
-
path: [...path],
|
|
1080
|
-
root
|
|
1081
|
-
}),
|
|
1082
|
-
slotted: (type, root) => (authoredResolveSchemaOf(editor).content(type, root)?.prefix ?? 0) > 0,
|
|
1083
|
-
declaredIn: (element, ancestors, root) => getEditorSchema(editor).elementDeclaredPropertiesIn(elementOf(element), {
|
|
1084
|
-
ancestors: ancestors.map(elementOf),
|
|
1085
|
-
root
|
|
1086
|
-
}),
|
|
1087
|
-
splitKeepsIn: (source, continuation, place, root) => getEditorSchema(editor).elementSplitKeepsIn(elementOf(source), elementOf(continuation), {
|
|
1088
|
-
continuationAncestors: place.continuationAncestors.map(elementOf),
|
|
1089
|
-
continuationIndex: place.continuationIndex,
|
|
1090
|
-
root,
|
|
1091
|
-
sourceAncestors: place.sourceAncestors.map(elementOf)
|
|
1092
|
-
}),
|
|
1093
|
-
joinCompares: (key) => joinCompares(getCompiledEditorSchema(editor), key),
|
|
1094
|
-
maxChildren: (type, root) => authoredResolveSchemaOf(editor).content(type, root)?.max ?? null,
|
|
1095
|
-
now: at,
|
|
1096
|
-
oneText,
|
|
1097
|
-
ownedRoots: (props) => {
|
|
1098
|
-
return getEditorSchema(editor).getElementOwnedRoots(props).map(({ ownership, root }) => ({
|
|
1099
|
-
exclusive: ownership === "exclusive",
|
|
1100
|
-
root
|
|
1101
|
-
}));
|
|
1102
|
-
},
|
|
1103
|
-
selectionBefore: selectionPosition === null ? null : {
|
|
1104
|
-
position: selectionPosition,
|
|
1105
|
-
root: input.selectionBeforeRoot
|
|
1106
|
-
},
|
|
1107
|
-
schema: tracksPlaces(compiled) ? compiled : null,
|
|
1108
|
-
unique: uniquePropertiesOf(compiled),
|
|
1109
|
-
standing,
|
|
1110
|
-
steps,
|
|
1111
|
-
commitWriteId,
|
|
1112
|
-
writer
|
|
1113
|
-
});
|
|
1114
|
-
const map = {
|
|
1115
|
-
after,
|
|
1116
|
-
indexes: recorded.indexedAfter,
|
|
1117
|
-
map: recorded.mapPosition
|
|
1118
|
-
};
|
|
1119
|
-
const kept = [.../* @__PURE__ */ new Set([...visitRootNames(before.roots), ...recorded.indexedAfter.keys()])].filter((root) => root !== "main" && !byName.has(root));
|
|
1120
|
-
const beforeRecords = getValueRecords(before);
|
|
1121
|
-
const valueWith = (roots, indexes) => {
|
|
1122
|
-
const next = copyFields({}, before, ["records", "roots"]);
|
|
1123
|
-
setLazyRoot(next, "children", indexes.get("main") ?? rootIndexOf(before, "children"));
|
|
1124
|
-
if (roots.length > 0) {
|
|
1125
|
-
const named = {};
|
|
1126
|
-
for (const root of roots) {
|
|
1127
|
-
const index = indexes.get(root) ?? lazyRootOf(before.roots, root);
|
|
1128
|
-
if (index) setLazyRoot(named, root, index);
|
|
1129
|
-
else named[root] = valueRoot(before, root);
|
|
1130
|
-
}
|
|
1131
|
-
next.roots = named;
|
|
1132
|
-
}
|
|
1133
|
-
return withValueRecords(next, beforeRecords);
|
|
1134
|
-
};
|
|
1135
|
-
const withdrawn = withdrawable.size > 0 ? orphanedValueRoots(getCompiledEditorSchema(editor), before, valueWith(kept, recorded.indexedAfter), changedRootsOf(recorded.change), createdThenDeleted).filter((root) => withdrawable.has(root)) : [];
|
|
1136
|
-
const roots = withdrawn.length > 0 ? kept.filter((root) => !withdrawn.includes(root)) : kept;
|
|
1137
|
-
const valueOf = (indexes) => valueWith(roots, indexes);
|
|
1138
|
-
const unborn = withdrawn.filter((root) => createdThenDeleted.has(root));
|
|
1139
|
-
const deleted = withdrawn.filter((root) => !createdThenDeleted.has(root));
|
|
1140
|
-
const born = unborn.length > 0 ? filterDocumentChangeRoots(recorded.change, (root) => !unborn.includes(root)) : recorded.change;
|
|
1141
|
-
const recordedChange = deleted.length > 0 ? born.compose(createInternalDocumentChange(/* @__PURE__ */ new Map(), { deleteRoots: deleted }), before) : born;
|
|
1142
|
-
const written = valueOf(recorded.indexedAfter);
|
|
1143
|
-
const relink = relinkCuts(recordedChange, before, written, (root) => recorded.indexedAfter.get(root) ?? DocumentIndex.fromValue(valueRoot(written, root)));
|
|
1144
|
-
const change = relink ? recordedChange.compose(relink.change, before) : recordedChange;
|
|
1145
|
-
const indexes = relink ? new Map([...recorded.indexedAfter, ...relink.indexes]) : recorded.indexedAfter;
|
|
1146
|
-
const writtenPlain = editing && recorded.writtenPlain;
|
|
1147
|
-
const mark = {
|
|
1148
|
-
at,
|
|
1149
|
-
author: writer,
|
|
1150
|
-
change: forced?.changeId ?? changeId,
|
|
1151
|
-
...forced?.inc === void 0 ? {} : { inc: forced.inc }
|
|
1152
|
-
};
|
|
1153
|
-
const filled = writtenPlain ? null : completeProposed({
|
|
1154
|
-
after: valueOf(indexes),
|
|
1155
|
-
before,
|
|
1156
|
-
change,
|
|
1157
|
-
dependencies,
|
|
1158
|
-
editor,
|
|
1159
|
-
indexes,
|
|
1160
|
-
mark,
|
|
1161
|
-
standing,
|
|
1162
|
-
commitWriteId
|
|
1163
|
-
});
|
|
1164
|
-
const content = filled ? change.compose(filled.change, before) : change;
|
|
1165
|
-
const writtenIndexes = filled?.indexes ?? indexes;
|
|
1166
|
-
const accepted = editing && !writtenPlain ? acceptOwn(content, writtenIndexes, dependencies, {
|
|
1167
|
-
...known,
|
|
1168
|
-
landed: landedHere
|
|
1169
|
-
}) : null;
|
|
1170
|
-
const relinkedOwn = accepted && relinkCuts(accepted.change, valueOf(writtenIndexes), valueOf(accepted.indexes), (root) => accepted.indexes.get(root) ?? DocumentIndex.fromValue(valueRoot(valueOf(accepted.indexes), root)), (root) => writtenIndexes.get(root) ?? DocumentIndex.fromValue(valueRoot(before, root)));
|
|
1171
|
-
const owned = accepted && relinkedOwn ? {
|
|
1172
|
-
change: accepted.change.compose(relinkedOwn.change),
|
|
1173
|
-
indexes: new Map([...accepted.indexes, ...relinkedOwn.indexes]),
|
|
1174
|
-
landed: accepted.landed
|
|
1175
|
-
} : accepted;
|
|
1176
|
-
const through = (changes) => (root, position, assoc) => changes.reduce((mapped, later) => (later && getInternalDocumentRootChange(later, root)?.mapPos(mapped, assoc)) ?? mapped, position);
|
|
1177
|
-
const mapPosition = (root, position, assoc) => through([
|
|
1178
|
-
relink?.change,
|
|
1179
|
-
filled?.change,
|
|
1180
|
-
owned?.change
|
|
1181
|
-
])(root, recorded.mapPosition(root, position, assoc, false), assoc);
|
|
1182
|
-
const staysAfter = 1;
|
|
1183
|
-
const record = (draftSelection, root) => {
|
|
1184
|
-
const selection = mapSelection(draftSelection, {
|
|
1185
|
-
...map,
|
|
1186
|
-
root
|
|
1187
|
-
});
|
|
1188
|
-
const filledSelection = filled ? mapSelection(selection, {
|
|
1189
|
-
after: valueOf(indexes),
|
|
1190
|
-
indexes: filled.indexes,
|
|
1191
|
-
map: through([filled.change]),
|
|
1192
|
-
root
|
|
1193
|
-
}) : selection;
|
|
1194
|
-
return owned ? mapSelection(filledSelection, {
|
|
1195
|
-
after: valueOf(writtenIndexes),
|
|
1196
|
-
indexes: owned.indexes,
|
|
1197
|
-
map: through([owned.change]),
|
|
1198
|
-
root
|
|
1199
|
-
}, staysAfter) : filledSelection;
|
|
1200
|
-
};
|
|
1201
|
-
const recordedLater = owned ? content.compose(owned.change, before) : content;
|
|
1202
|
-
const recordedIndexes = owned?.indexes ?? writtenIndexes;
|
|
1203
|
-
const recordedRecords = [putContexts(restedOn(dependencies.minted(), recordedLater, recordedIndexes)), putLanded([...editing && commitWrite !== void 0 ? [landedOf({
|
|
1204
|
-
at,
|
|
1205
|
-
change: changeId,
|
|
1206
|
-
id: commitWrite
|
|
1207
|
-
})] : [], ...owned?.landed ?? []])].reduce(composeRecordOps, ownRecords);
|
|
1208
|
-
const deferred = (filled?.deferred ?? []).flatMap((build) => {
|
|
1209
|
-
if (!owned || build.path.length === 0) return [build];
|
|
1210
|
-
const { from } = getDefined(writtenIndexes.get(build.root)).nodeRange(build.path);
|
|
1211
|
-
const rootChange = getInternalDocumentRootChange(owned.change, build.root);
|
|
1212
|
-
const start = rootChange ? rootChange.mapPos(from, 1, "after") : from;
|
|
1213
|
-
const host = start === null ? null : recordedIndexes.get(build.root)?.nodeStartingAt(start);
|
|
1214
|
-
return host && host.from === start && host.kind === "element" ? [{
|
|
1215
|
-
...build,
|
|
1216
|
-
path: host.path
|
|
1217
|
-
}] : [];
|
|
1218
|
-
});
|
|
1219
|
-
const recordedValue = deriveValue(valueOf(recordedIndexes), {}, recordedRecords);
|
|
1220
|
-
const writes = storesSpares(compiled) ? sparesFor(recordedValue, compiled, changedSitesOf(recordedLater, recordedIndexes), deferred.map(({ index, ...build }) => ({
|
|
1221
|
-
...build,
|
|
1222
|
-
node: framedChild(valueRootIndex(after, build.root), build.path.length === 0 ? null : getDefined(recordedIndexes.get(build.root)).nodeRange(build.path).from, index, String(build.node.type), (position, assoc) => mapPosition(build.root, position, assoc)) ?? build.node,
|
|
1223
|
-
writer: owned ? null : mark
|
|
1224
|
-
})), spareBlocksOf(recordedValue)) : NO_SPARE_WRITES;
|
|
1225
|
-
const spares = writes.containers.length > 0 ? spareWritesChange(writes, recordedIndexes) : null;
|
|
1226
|
-
const spared = spares ? recordedLater.compose(spares.change, before) : recordedLater;
|
|
1227
|
-
const sparedIndexes = spares?.indexes ?? recordedIndexes;
|
|
1228
|
-
const records = composeRecordOps(recordedRecords, writes.records);
|
|
1229
|
-
const shown = storesSpares(compiled) ? closeCommandValues({
|
|
1230
|
-
before,
|
|
1231
|
-
change: spared,
|
|
1232
|
-
compiled,
|
|
1233
|
-
editing,
|
|
1234
|
-
frame: after,
|
|
1235
|
-
framed: !!input.projection,
|
|
1236
|
-
holders,
|
|
1237
|
-
indexes: sparedIndexes,
|
|
1238
|
-
peek: (values, read) => ledger.peek(values, read),
|
|
1239
|
-
standing,
|
|
1240
|
-
storedOf: (edited) => deriveValue(valueOf(edited), {}, records),
|
|
1241
|
-
writer: {
|
|
1242
|
-
...mark,
|
|
1243
|
-
commitWriteId,
|
|
1244
|
-
isOwn: (tag) => tag.change === mark.change
|
|
1245
|
-
}
|
|
1246
|
-
}) : null;
|
|
1247
|
-
const later = shown ? spared.compose(shown.change, before) : spared;
|
|
1248
|
-
const indexedAfter = shown?.indexes ?? sparedIndexes;
|
|
1249
|
-
const split = splitOneTextRefusal(later, indexedAfter, oneText);
|
|
1250
|
-
if (split) throw split;
|
|
1251
|
-
return {
|
|
1252
|
-
anchorChange: (plainAfter) => [
|
|
1253
|
-
filled?.change,
|
|
1254
|
-
owned?.change,
|
|
1255
|
-
spares?.change,
|
|
1256
|
-
shown?.change
|
|
1257
|
-
].reduce((anchor, next) => next ? anchor.compose(next) : anchor, recorded.anchorChange(plainAfter)),
|
|
1258
|
-
bookmarks: input.bookmarks.map(({ root, selection }) => record(selection, root)),
|
|
1259
|
-
change: withDocumentChangeRecords(later, records),
|
|
1260
|
-
indexedAfter,
|
|
1261
|
-
mapPosition,
|
|
1262
|
-
selection: record(input.selection, input.selectionRoot)
|
|
1263
|
-
};
|
|
1264
|
-
}));
|
|
1265
|
-
}
|
|
1266
|
-
});
|
|
1267
|
-
};
|
|
1268
|
-
/** Suggestions recorded as review marks in the document. */
|
|
1269
|
-
const authored = (options) => createAuthoredPlugin({ authorId: options.authorId });
|
|
1270
|
-
//#endregion
|
|
1271
|
-
export { AuthoredPlaceError, authored, authoredProposerOf, createAuthoredPlugin };
|