edytor 1.0.0-rc.3 → 2.0.0
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/README.md +21 -39
- package/dist/block/block.svelte.d.ts +11 -84
- package/dist/block/block.svelte.js +30 -134
- package/dist/block/colors.d.ts +0 -9
- package/dist/block/colors.js +1 -18
- package/dist/block/contentRange.d.ts +5 -1
- package/dist/block/contentRange.js +15 -16
- package/dist/block/inlineBlock.svelte.d.ts +11 -9
- package/dist/block/inlineBlock.svelte.js +18 -21
- package/dist/clipboard/createClipboardFragment.js +22 -64
- package/dist/clipboard/fragmentData.js +17 -42
- package/dist/clipboard/htmlFlow.js +7 -7
- package/dist/clipboard/insertClipboardFragment.js +5 -4
- package/dist/clipboard/moveText.js +16 -8
- package/dist/clipboard/serializeClipboardFragment.d.ts +2 -0
- package/dist/clipboard/serializeClipboardFragment.js +32 -28
- package/dist/cloudflare/DocumentRoom.d.ts +4 -17
- package/dist/cloudflare/DocumentRoom.js +3 -5
- package/dist/cloudflare/move.d.ts +1 -18
- package/dist/cloudflare/move.js +2 -48
- package/dist/cloudflare/room/admission.d.ts +1 -60
- package/dist/cloudflare/room/admission.js +25 -29
- package/dist/cloudflare/room/comments.d.ts +1 -3
- package/dist/cloudflare/room/comments.js +6 -6
- package/dist/cloudflare/room/context.d.ts +25 -82
- package/dist/cloudflare/room/context.js +8 -8
- package/dist/cloudflare/room/forged.d.ts +1 -1
- package/dist/cloudflare/room/forged.js +2 -12
- package/dist/cloudflare/room/frames.d.ts +1 -1
- package/dist/cloudflare/room/frames.js +1 -1
- package/dist/cloudflare/room/history.d.ts +1 -25
- package/dist/cloudflare/room/history.js +39 -54
- package/dist/cloudflare/room/moves.d.ts +1 -13
- package/dist/cloudflare/room/moves.js +33 -57
- package/dist/cloudflare/room/presence.d.ts +1 -11
- package/dist/cloudflare/room/presence.js +4 -4
- package/dist/cloudflare/room/purge.d.ts +1 -2
- package/dist/cloudflare/room/purge.js +2 -2
- package/dist/cloudflare/room/replicas.d.ts +1 -7
- package/dist/cloudflare/room/replicas.js +2 -2
- package/dist/cloudflare/room/storage.d.ts +3 -32
- package/dist/cloudflare/room/storage.js +33 -108
- package/dist/cloudflare/room/updates.d.ts +4 -4
- package/dist/cloudflare/room/updates.js +17 -24
- package/dist/cloudflare/room/validation.d.ts +1 -5
- package/dist/cloudflare/room/validation.js +16 -37
- package/dist/collaboration/RemoteSelections.svelte +13 -17
- package/dist/collaboration/awarenessSelection.d.ts +22 -1
- package/dist/collaboration/awarenessSelection.js +42 -0
- package/dist/collaboration/comments/client.d.ts +2 -2
- package/dist/collaboration/comments/client.js +1 -1
- package/dist/collaboration/history/index.d.ts +5 -5
- package/dist/collaboration/history/index.js +5 -5
- package/dist/collaboration/history/panel.svelte.d.ts +91 -0
- package/dist/collaboration/history/panel.svelte.js +223 -0
- package/dist/collaboration/providers.d.ts +12 -3
- package/dist/collaboration/providers.js +5 -4
- package/dist/components/Block.svelte +42 -56
- package/dist/components/Block.svelte.d.ts +7 -5
- package/dist/components/Content.svelte +1 -5
- package/dist/components/Edytor.svelte +82 -99
- package/dist/components/Edytor.svelte.d.ts +16 -13
- package/dist/components/InlineBlock.svelte +1 -1
- package/dist/components/Ranges.svelte +96 -0
- package/dist/components/Ranges.svelte.d.ts +19 -0
- package/dist/components/Suggestion.svelte +3 -2
- package/dist/components/Text.svelte +2 -5
- package/dist/components/Text.svelte.d.ts +1 -1
- package/dist/crdt/admission.d.ts +2 -9
- package/dist/crdt/admission.js +3 -9
- package/dist/crdt/attribution/attribution.d.ts +11 -72
- package/dist/crdt/attribution/attribution.js +5 -52
- package/dist/crdt/attribution/block.d.ts +0 -78
- package/dist/crdt/attribution/block.js +1 -144
- package/dist/crdt/data.d.ts +18 -13
- package/dist/crdt/data.js +49 -71
- package/dist/crdt/doc/anchors.js +4 -4
- package/dist/crdt/doc/content.d.ts +5 -1
- package/dist/crdt/doc/content.js +3 -1
- package/dist/crdt/doc/delete.d.ts +1 -0
- package/dist/crdt/doc/funnel.d.ts +0 -23
- package/dist/crdt/doc/funnel.js +34 -85
- package/dist/crdt/doc/gate.d.ts +8 -9
- package/dist/crdt/doc/gate.js +7 -17
- package/dist/crdt/doc/history.d.ts +87 -14
- package/dist/crdt/doc/history.js +334 -149
- package/dist/crdt/doc/layout.d.ts +0 -1
- package/dist/crdt/doc/layout.js +2 -3
- package/dist/crdt/doc/meta.d.ts +4 -4
- package/dist/crdt/doc/meta.js +10 -21
- package/dist/crdt/doc/moves.d.ts +4 -4
- package/dist/crdt/doc/moves.js +5 -5
- package/dist/crdt/doc/plan.d.ts +2 -0
- package/dist/crdt/doc/plan.js +2 -0
- package/dist/crdt/doc/reads.d.ts +8 -5
- package/dist/crdt/doc/reads.js +49 -50
- package/dist/crdt/doc/seed.d.ts +15 -6
- package/dist/crdt/doc/seed.js +27 -26
- package/dist/crdt/doc/split-merge.d.ts +1 -3
- package/dist/crdt/doc/split-merge.js +4 -5
- package/dist/crdt/doc/steps.d.ts +3 -7
- package/dist/crdt/doc/steps.js +20 -9
- package/dist/crdt/doc/types.d.ts +0 -10
- package/dist/crdt/document.d.ts +32 -115
- package/dist/crdt/document.js +216 -302
- package/dist/crdt/edytor-doc.d.ts +689 -90
- package/dist/crdt/edytor-doc.js +74 -149
- package/dist/crdt/engine-api.d.ts +15 -47
- package/dist/crdt/engine.d.ts +7 -17
- package/dist/crdt/engine.js +9 -19
- package/dist/crdt/flow.d.ts +9 -37
- package/dist/crdt/flow.js +260 -238
- package/dist/crdt/index.d.ts +32 -85
- package/dist/crdt/index.js +21 -47
- package/dist/crdt/operations.d.ts +24 -33
- package/dist/crdt/operations.js +8 -17
- package/dist/crdt/placement/display.d.ts +0 -2
- package/dist/crdt/placement/display.js +0 -15
- package/dist/crdt/placement/model.d.ts +160 -12
- package/dist/crdt/placement/model.js +413 -414
- package/dist/crdt/placement/rank.d.ts +1 -5
- package/dist/crdt/placement/rank.js +28 -38
- package/dist/crdt/props.d.ts +32 -0
- package/dist/crdt/props.js +172 -0
- package/dist/crdt/protocol.d.ts +4 -5
- package/dist/crdt/protocol.js +3 -4
- package/dist/crdt/protocols/awareness.d.ts +3 -7
- package/dist/crdt/protocols/awareness.js +17 -33
- package/dist/crdt/protocols/envelope.d.ts +9 -29
- package/dist/crdt/protocols/envelope.js +8 -25
- package/dist/crdt/protocols/sync.d.ts +15 -30
- package/dist/crdt/protocols/sync.js +27 -89
- package/dist/crdt/providers/bound.d.ts +3 -1
- package/dist/crdt/providers/bound.js +3 -1
- package/dist/crdt/providers/container.d.ts +11 -17
- package/dist/crdt/providers/container.js +39 -27
- package/dist/crdt/providers/index.d.ts +34 -6
- package/dist/crdt/providers/index.js +106 -111
- package/dist/crdt/providers/indexeddb.d.ts +2 -12
- package/dist/crdt/providers/indexeddb.js +29 -90
- package/dist/crdt/providers/room.d.ts +58 -2
- package/dist/crdt/providers/room.js +38 -21
- package/dist/crdt/providers/websocket.d.ts +1 -1
- package/dist/crdt/providers/websocket.js +3 -4
- package/dist/crdt/purge.d.ts +2 -2
- package/dist/crdt/purge.js +69 -6
- package/dist/crdt/rangeDelete.d.ts +4 -42
- package/dist/crdt/rangeDelete.js +7 -6
- package/dist/crdt/restore.d.ts +21 -1
- package/dist/crdt/restore.js +54 -59
- package/dist/crdt/schema.d.ts +2 -2
- package/dist/crdt/schema.js +4 -5
- package/dist/crdt/semantics.d.ts +10 -15
- package/dist/crdt/semantics.js +22 -21
- package/dist/crdt/storage.d.ts +7 -13
- package/dist/crdt/storage.js +10 -24
- package/dist/crdt/structs.d.ts +42 -47
- package/dist/crdt/structs.js +76 -67
- package/dist/crdt/tables.d.ts +9 -0
- package/dist/crdt/tables.js +20 -0
- package/dist/crdt/text/delete-index.d.ts +0 -13
- package/dist/crdt/text/delete-index.js +7 -14
- package/dist/crdt/text/deletes.d.ts +9 -22
- package/dist/crdt/text/deletes.js +11 -74
- package/dist/crdt/text/index/cache.js +3 -3
- package/dist/crdt/text/index/fold.d.ts +1 -2
- package/dist/crdt/text/index/fold.js +15 -10
- package/dist/crdt/text/index/layout.d.ts +0 -10
- package/dist/crdt/text/index/layout.js +6 -20
- package/dist/crdt/text/index/records.js +2 -1
- package/dist/crdt/text/index/report.js +5 -6
- package/dist/crdt/text/index/shared.d.ts +11 -4
- package/dist/crdt/text/index/shared.js +8 -7
- package/dist/crdt/text/index/state.d.ts +3 -33
- package/dist/crdt/text/index/state.js +2 -4
- package/dist/crdt/text/model.d.ts +82 -2
- package/dist/crdt/text/model.js +344 -354
- package/dist/crdt/text/rows.d.ts +0 -2
- package/dist/crdt/text/rows.js +0 -11
- package/dist/crdt/text/runs.d.ts +6 -3
- package/dist/crdt/text/runs.js +132 -137
- package/dist/crdt/text/streams.d.ts +1 -1
- package/dist/crdt/text/streams.js +1 -1
- package/dist/crdt/vendor/yjs/API-NOTES.md +25 -8
- package/dist/crdt/vendor/yjs/UPSTREAM.md +288 -8
- package/dist/crdt/vendor/yjs/dts/global.d.ts +5 -26
- package/dist/crdt/vendor/yjs/dts/index.d.ts +10 -15
- package/dist/crdt/vendor/yjs/dts/structs/AbstractStruct.d.ts +2 -2
- package/dist/crdt/vendor/yjs/dts/structs/Item.d.ts +14 -219
- package/dist/crdt/vendor/yjs/dts/structs/Skip.d.ts +2 -2
- package/dist/crdt/vendor/yjs/dts/utils/BlockSet.d.ts +2 -2
- package/dist/crdt/vendor/yjs/dts/utils/Doc.d.ts +12 -123
- package/dist/crdt/vendor/yjs/dts/utils/ID.d.ts +1 -1
- package/dist/crdt/vendor/yjs/dts/utils/RangeCursor.d.ts +37 -58
- package/dist/crdt/vendor/yjs/dts/utils/Transaction.d.ts +3 -78
- package/dist/crdt/vendor/yjs/dts/utils/UpdateDecoder.d.ts +2 -81
- package/dist/crdt/vendor/yjs/dts/utils/UpdateEncoder.d.ts +2 -74
- package/dist/crdt/vendor/yjs/dts/utils/encoding-helpers.d.ts +4 -4
- package/dist/crdt/vendor/yjs/dts/utils/encoding.d.ts +6 -18
- package/dist/crdt/vendor/yjs/dts/utils/ids.d.ts +12 -237
- package/dist/crdt/vendor/yjs/dts/utils/positions.d.ts +5 -0
- package/dist/crdt/vendor/yjs/dts/utils/redo.d.ts +3 -0
- package/dist/crdt/vendor/yjs/dts/utils/transaction-helpers.d.ts +1 -3
- package/dist/crdt/vendor/yjs/dts/utils/updates.d.ts +6 -23
- package/dist/crdt/vendor/yjs/dts/ynode.d.ts +73 -498
- package/dist/crdt/vendor/yjs/global.d.ts +5 -26
- package/dist/crdt/vendor/yjs/src/index.js +11 -25
- package/dist/crdt/vendor/yjs/src/structs/AbstractStruct.js +1 -1
- package/dist/crdt/vendor/yjs/src/structs/GC.js +1 -1
- package/dist/crdt/vendor/yjs/src/structs/Item.js +10 -372
- package/dist/crdt/vendor/yjs/src/structs/Skip.js +1 -1
- package/dist/crdt/vendor/yjs/src/utils/BlockSet.js +2 -2
- package/dist/crdt/vendor/yjs/src/utils/Doc.js +14 -170
- package/dist/crdt/vendor/yjs/src/utils/ID.js +1 -1
- package/dist/crdt/vendor/yjs/src/utils/RangeCursor.js +61 -128
- package/dist/crdt/vendor/yjs/src/utils/StructStore.js +0 -22
- package/dist/crdt/vendor/yjs/src/utils/Transaction.js +17 -282
- package/dist/crdt/vendor/yjs/src/utils/UpdateDecoder.js +3 -130
- package/dist/crdt/vendor/yjs/src/utils/UpdateEncoder.js +2 -132
- package/dist/crdt/vendor/yjs/src/utils/encoding-helpers.js +4 -4
- package/dist/crdt/vendor/yjs/src/utils/encoding.js +49 -146
- package/dist/crdt/vendor/yjs/src/utils/ids.js +23 -900
- package/dist/crdt/vendor/yjs/src/utils/positions.js +115 -0
- package/dist/crdt/vendor/yjs/src/utils/redo.js +143 -0
- package/dist/crdt/vendor/yjs/src/utils/transaction-helpers.js +10 -127
- package/dist/crdt/vendor/yjs/src/utils/updates.js +7 -50
- package/dist/crdt/vendor/yjs/src/ynode.js +261 -2226
- package/dist/dnd/autoScroll.js +1 -2
- package/dist/{plugins/blockHandles → dnd}/dropIndicator.d.ts +2 -2
- package/dist/{plugins/blockHandles → dnd}/dropIndicator.js +52 -60
- package/dist/{plugins/blockHandles → dnd}/geometry.d.ts +4 -3
- package/dist/{plugins/blockHandles → dnd}/geometry.js +6 -6
- package/dist/dnd/placement.d.ts +200 -0
- package/dist/dnd/placement.js +426 -0
- package/dist/dnd/pragmatic.d.ts +4 -22
- package/dist/dnd/pragmatic.js +7 -26
- package/dist/dnd/track.d.ts +14 -0
- package/dist/dnd/track.js +55 -0
- package/dist/dnd/vendor/pragmatic/UPSTREAM.md +103 -0
- package/dist/dnd/vendor/pragmatic/bind-event-listener/LICENSE +21 -0
- package/dist/dnd/vendor/pragmatic/bind-event-listener/bind-all.js +46 -0
- package/dist/dnd/vendor/pragmatic/bind-event-listener/bind.js +7 -0
- package/dist/dnd/vendor/pragmatic/bind-event-listener/index.js +2 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/LICENSE.md +11 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter-native-data-key.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.d.ts +57 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.js +306 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/entry-point/element/adapter.d.ts +8 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/entry-point/element/adapter.js +10 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/entry-point/element/set-custom-native-drag-preview.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/entry-point/element/set-custom-native-drag-preview.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/entry-point/types.d.ts +1 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/get-element-from-point-without-honey-pot.js +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/honey-pot-data-attribute.js +3 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/is-honey-pot-element.js +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js +333 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/internal-types.d.ts +350 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/ledger/dispatch-consumer-event.js +128 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/ledger/lifecycle-manager.js +340 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/ledger/usage-ledger.js +32 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-adapter.js +59 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-drop-target.js +288 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-monitor.js +85 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/combine.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +36 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.js +153 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/types.d.ts +16 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/once.js +13 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/add-attribute.js +7 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/android.js +10 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/count-events-for-safari.js +104 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-from-another-window.js +16 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-leaving-window-in-safari.js +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-leaving-window.js +55 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/detect-broken-drag.js +48 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/get-input.js +14 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/is-firefox.js +13 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/is-safari.js +19 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/max-z-index.js +3 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/media-types/text-media-type.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/media-types/url-media-type.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/popover-reset-styles.js +40 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/supports-popover.js +16 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/LICENSE.md +11 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/element.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/element.js +8 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/internal-types.d.ts +50 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/data-attributes.js +9 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/get-scroll-by.js +117 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/make-api.js +90 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/try-scroll.js +183 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/axis.js +22 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/can-scroll-on-edge.js +17 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/configuration.js +49 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/edges.js +9 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/engagement-history.js +43 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-over-element-hitbox.js +50 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-percentage-in-range.js +19 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-scroll-change.js +106 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-axis-allowed.js +3 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-within.js +11 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/scheduler.js +104 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/side.js +6 -0
- package/dist/dnd/vendor/pragmatic/raf-schd/LICENSE +21 -0
- package/dist/dnd/vendor/pragmatic/raf-schd/raf-schd.esm.js +34 -0
- package/dist/edytor.svelte.d.ts +46 -63
- package/dist/edytor.svelte.js +126 -181
- package/dist/events/beforeInputCommands.d.ts +6 -11
- package/dist/events/beforeInputCommands.js +189 -181
- package/dist/events/beforeInputDeleteCommands.d.ts +20 -1
- package/dist/events/beforeInputDeleteCommands.js +153 -204
- package/dist/events/domTextOffset.d.ts +9 -9
- package/dist/events/domTextOffset.js +20 -48
- package/dist/events/events.utils.d.ts +0 -2
- package/dist/events/events.utils.js +0 -4
- package/dist/events/nativeInteractiveControl.d.ts +13 -13
- package/dist/events/nativeInteractiveControl.js +28 -56
- package/dist/events/onBeforeInput.d.ts +6 -1
- package/dist/events/onBeforeInput.js +207 -331
- package/dist/events/onCopy.js +1 -5
- package/dist/events/onDrop.d.ts +7 -1
- package/dist/events/onDrop.js +64 -78
- package/dist/events/onFocus.d.ts +9 -4
- package/dist/events/onFocus.js +45 -67
- package/dist/events/onInput.d.ts +8 -4
- package/dist/events/onInput.js +34 -147
- package/dist/events/onKeyDown.js +55 -122
- package/dist/events/onPaste.d.ts +14 -1
- package/dist/events/onPaste.js +51 -76
- package/dist/index.d.ts +11 -15
- package/dist/index.js +3 -3
- package/dist/kinds.d.ts +4 -6
- package/dist/kinds.js +28 -27
- package/dist/labels.d.ts +83 -320
- package/dist/labels.js +181 -408
- package/dist/plugins/Chrome.svelte +29 -0
- package/dist/plugins/Chrome.svelte.d.ts +32 -0
- package/dist/plugins/Control.svelte +23 -0
- package/dist/plugins/Control.svelte.d.ts +30 -0
- package/dist/plugins/anchored.svelte.d.ts +47 -0
- package/dist/plugins/anchored.svelte.js +73 -0
- package/dist/plugins/arrowMove/arrowMove.d.ts +2 -1
- package/dist/plugins/arrowMove/arrowMove.js +9 -5
- package/dist/plugins/bands.svelte.d.ts +57 -0
- package/dist/plugins/bands.svelte.js +95 -0
- package/dist/plugins/blockHandles/BlockHandle.svelte +14 -154
- package/dist/plugins/blockHandles/BlockHandle.svelte.d.ts +2 -2
- package/dist/plugins/blockHandles/BlockHandleController.svelte.d.ts +21 -196
- package/dist/plugins/blockHandles/BlockHandleController.svelte.js +158 -573
- package/dist/plugins/blockHandles/BlockHandles.svelte +15 -23
- package/dist/plugins/blockHandles/BlockHandles.svelte.d.ts +2 -2
- package/dist/plugins/blockHandles/blockHandlesPlugin.d.ts +25 -39
- package/dist/plugins/blockHandles/blockHandlesPlugin.js +130 -185
- package/dist/plugins/blockHandles/dragPreview.d.ts +8 -6
- package/dist/plugins/blockHandles/dragPreview.js +18 -16
- package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +28 -38
- package/dist/plugins/blockMenu/BlockMenuController.svelte.js +116 -183
- package/dist/plugins/blockMenu/blockMenuPlugin.d.ts +1 -3
- package/dist/plugins/blockMenu/blockMenuPlugin.js +12 -29
- package/dist/plugins/brand.d.ts +8 -0
- package/dist/plugins/brand.js +8 -0
- package/dist/plugins/chrome.d.ts +45 -38
- package/dist/plugins/chrome.js +59 -36
- package/dist/plugins/code/CodeHeader.svelte +8 -38
- package/dist/plugins/code/CodePlugin.svelte +53 -56
- package/dist/plugins/code/CodePlugin.svelte.d.ts +0 -2
- package/dist/plugins/code/LanguageMenu.svelte +16 -125
- package/dist/plugins/code/LanguageMenu.svelte.d.ts +2 -1
- package/dist/plugins/code/code.css +5 -117
- package/dist/plugins/code/header.svelte.d.ts +2 -11
- package/dist/plugins/code/header.svelte.js +11 -38
- package/dist/plugins/code/languageMenu.svelte.d.ts +12 -32
- package/dist/plugins/code/languageMenu.svelte.js +30 -160
- package/dist/plugins/code/languages.d.ts +9 -22
- package/dist/plugins/code/languages.js +39 -128
- package/dist/plugins/columns/ColumnResize.svelte +16 -27
- package/dist/plugins/columns/ColumnResize.svelte.d.ts +1 -1
- package/dist/plugins/columns/ColumnsPlugin.svelte +46 -78
- package/dist/plugins/columns/ColumnsPlugin.svelte.d.ts +0 -12
- package/dist/plugins/columns/columns.css +7 -26
- package/dist/plugins/columns/gaps.d.ts +7 -5
- package/dist/plugins/columns/gaps.js +11 -6
- package/dist/plugins/columns/resize.svelte.d.ts +17 -54
- package/dist/plugins/columns/resize.svelte.js +80 -173
- package/dist/plugins/comments/CommentsController.svelte.d.ts +1 -4
- package/dist/plugins/comments/CommentsController.svelte.js +14 -25
- package/dist/plugins/comments/CommentsSidebar.svelte +82 -431
- package/dist/plugins/comments/CommentsSidebar.svelte.d.ts +4 -2
- package/dist/plugins/comments/commentsPlugin.d.ts +25 -9
- package/dist/plugins/comments/commentsPlugin.js +12 -10
- package/dist/plugins/equation/EquationEditor.svelte +16 -130
- package/dist/plugins/equation/EquationEditor.svelte.d.ts +1 -2
- package/dist/plugins/equation/EquationPlugin.svelte +109 -172
- package/dist/plugins/equation/EquationPlugin.svelte.d.ts +3 -2
- package/dist/plugins/equation/EquationView.svelte +20 -11
- package/dist/plugins/equation/equation.css +7 -0
- package/dist/plugins/equation/equation.svelte.d.ts +37 -24
- package/dist/plugins/equation/equation.svelte.js +20 -94
- package/dist/plugins/equation/katex.js +6 -9
- package/dist/plugins/fileDrop.d.ts +28 -0
- package/dist/plugins/fileDrop.js +116 -0
- package/dist/plugins/find/FindController.svelte.d.ts +8 -13
- package/dist/plugins/find/FindController.svelte.js +34 -55
- package/dist/plugins/find/findPlugin.d.ts +4 -8
- package/dist/plugins/find/findPlugin.js +29 -9
- package/dist/plugins/image/ImageChrome.svelte +6 -167
- package/dist/plugins/image/ImageChrome.svelte.d.ts +0 -2
- package/dist/plugins/image/ImagePlugin.svelte +71 -151
- package/dist/plugins/image/ImagePlugin.svelte.d.ts +12 -41
- package/dist/plugins/image/ImageToolbarHost.svelte +37 -0
- package/dist/plugins/image/ImageToolbarHost.svelte.d.ts +9 -0
- package/dist/plugins/image/controls.svelte.d.ts +6 -36
- package/dist/plugins/image/controls.svelte.js +43 -212
- package/dist/plugins/image/image.css +17 -0
- package/dist/plugins/image/image.d.ts +0 -5
- package/dist/plugins/image/image.js +0 -3
- package/dist/plugins/image/toolbar.svelte.d.ts +69 -0
- package/dist/plugins/image/toolbar.svelte.js +145 -0
- package/dist/plugins/index.d.ts +30 -26
- package/dist/plugins/index.js +28 -22
- package/dist/plugins/list.svelte.d.ts +128 -0
- package/dist/plugins/list.svelte.js +217 -0
- package/dist/plugins/markdownShortcuts.d.ts +1 -1
- package/dist/plugins/markdownShortcuts.js +10 -9
- package/dist/plugins/marquee/MarqueeBox.svelte +3 -20
- package/dist/plugins/marquee/MarqueeBox.svelte.d.ts +1 -1
- package/dist/plugins/marquee/MarqueeController.svelte.d.ts +0 -2
- package/dist/plugins/marquee/MarqueeController.svelte.js +20 -23
- package/dist/plugins/marquee/marquee.js +4 -21
- package/dist/plugins/marquee/marqueePlugin.d.ts +4 -3
- package/dist/plugins/marquee/marqueePlugin.js +16 -15
- package/dist/plugins/media/AudioPlugin.svelte +13 -88
- package/dist/plugins/media/AudioPlugin.svelte.d.ts +11 -4
- package/dist/plugins/media/BookmarkPlugin.svelte +113 -120
- package/dist/plugins/media/BookmarkPlugin.svelte.d.ts +10 -15
- package/dist/plugins/media/EmbedPlugin.svelte +82 -86
- package/dist/plugins/media/EmbedPlugin.svelte.d.ts +11 -17
- package/dist/plugins/media/EmptySlot.svelte +44 -0
- package/dist/plugins/media/EmptySlot.svelte.d.ts +25 -0
- package/dist/plugins/media/FilePlugin.svelte +45 -113
- package/dist/plugins/media/FilePlugin.svelte.d.ts +21 -4
- package/dist/plugins/media/MediaEmpty.svelte +51 -90
- package/dist/plugins/media/MediaEmpty.svelte.d.ts +26 -10
- package/dist/plugins/media/SourceBlock.svelte +200 -0
- package/dist/plugins/media/SourceBlock.svelte.d.ts +34 -0
- package/dist/plugins/media/UploadPreview.svelte +32 -0
- package/dist/plugins/media/UploadPreview.svelte.d.ts +11 -0
- package/dist/plugins/media/VideoPlugin.svelte +14 -97
- package/dist/plugins/media/VideoPlugin.svelte.d.ts +12 -5
- package/dist/plugins/media/empty.svelte.d.ts +47 -46
- package/dist/plugins/media/empty.svelte.js +67 -60
- package/dist/plugins/media/media.d.ts +97 -44
- package/dist/plugins/media/media.js +77 -99
- package/dist/plugins/media/upload.css +23 -0
- package/dist/plugins/media/urlPaste.svelte.d.ts +6 -37
- package/dist/plugins/media/urlPaste.svelte.js +32 -102
- package/dist/plugins/mention/MentionPlugin.svelte +84 -126
- package/dist/plugins/mention/MentionPlugin.svelte.d.ts +17 -27
- package/dist/plugins/mention/mention.css +6 -0
- package/dist/plugins/page/PageLink.svelte +54 -38
- package/dist/plugins/page/PagePlugin.svelte +20 -18
- package/dist/plugins/page/PagePlugin.svelte.d.ts +2 -4
- package/dist/plugins/page/page.d.ts +35 -9
- package/dist/plugins/page/page.js +3 -4
- package/dist/plugins/pageLink/PageLinkPlugin.svelte +154 -109
- package/dist/plugins/pageLink/PageLinkPlugin.svelte.d.ts +19 -26
- package/dist/plugins/pageLink/pageLink.css +6 -0
- package/dist/plugins/planned.d.ts +10 -0
- package/dist/plugins/planned.js +12 -0
- package/dist/plugins/richtext/CalloutIcon.svelte +13 -26
- package/dist/plugins/richtext/CalloutIconPicker.svelte +26 -0
- package/dist/plugins/richtext/CalloutIconPicker.svelte.d.ts +9 -0
- package/dist/plugins/richtext/EmptyBody.svelte +13 -20
- package/dist/plugins/richtext/RichTextControl.svelte +39 -0
- package/dist/plugins/richtext/RichTextControl.svelte.d.ts +8 -0
- package/dist/plugins/richtext/RichTextPlugin.svelte +174 -183
- package/dist/plugins/richtext/RichTextPlugin.svelte.d.ts +34 -34
- package/dist/plugins/richtext/TodoCheckbox.svelte +10 -21
- package/dist/plugins/richtext/TodoCheckbox.svelte.d.ts +0 -2
- package/dist/plugins/richtext/body.js +2 -2
- package/dist/plugins/richtext/calloutIcons.svelte.d.ts +50 -55
- package/dist/plugins/richtext/calloutIcons.svelte.js +86 -174
- package/dist/plugins/richtext/callouts.d.ts +15 -0
- package/dist/plugins/richtext/callouts.js +23 -0
- package/dist/plugins/richtext/controls.svelte.d.ts +110 -0
- package/dist/plugins/richtext/controls.svelte.js +126 -0
- package/dist/plugins/richtext/richTextOperations.js +37 -28
- package/dist/plugins/richtext/richtext.css +6 -0
- package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +2 -14
- package/dist/plugins/slashMenu/SlashMenuController.svelte.js +34 -71
- package/dist/plugins/slashMenu/slashMenuPlugin.d.ts +9 -26
- package/dist/plugins/slashMenu/slashMenuPlugin.js +27 -68
- package/dist/plugins/suggestions/SuggestionBars.svelte +27 -84
- package/dist/plugins/suggestions/SuggestionBars.svelte.d.ts +9 -3
- package/dist/plugins/suggestions/suggestionsPlugin.d.ts +10 -18
- package/dist/plugins/suggestions/suggestionsPlugin.js +9 -24
- package/dist/plugins/table/TableChrome.svelte +40 -124
- package/dist/plugins/table/TablePlugin.svelte +106 -168
- package/dist/plugins/table/TablePlugin.svelte.d.ts +0 -4
- package/dist/plugins/table/chrome.svelte.d.ts +38 -141
- package/dist/plugins/table/chrome.svelte.js +340 -589
- package/dist/plugins/table/ops.d.ts +47 -0
- package/dist/plugins/table/ops.js +233 -0
- package/dist/plugins/table/table.css +16 -152
- package/dist/plugins/table/table.d.ts +15 -14
- package/dist/plugins/table/table.js +22 -16
- package/dist/plugins/toc/TableOfContents.svelte +32 -38
- package/dist/plugins/toc/TableOfContents.svelte.d.ts +1 -5
- package/dist/plugins/toc/TocPlugin.svelte +22 -22
- package/dist/plugins/toc/TocPlugin.svelte.d.ts +4 -6
- package/dist/plugins/toc/toc.d.ts +41 -10
- package/dist/plugins/toc/toc.js +2 -3
- package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +4 -68
- package/dist/plugins/toolbar/ToolbarController.svelte.js +63 -89
- package/dist/plugins/toolbar/toolbarPlugin.d.ts +8 -18
- package/dist/plugins/toolbar/toolbarPlugin.js +28 -43
- package/dist/plugins/triggers/TriggerController.svelte.d.ts +4 -68
- package/dist/plugins/triggers/TriggerController.svelte.js +48 -129
- package/dist/plugins/triggers/place.d.ts +0 -9
- package/dist/plugins/triggers/place.js +1 -17
- package/dist/plugins/triggers/triggers.d.ts +31 -9
- package/dist/plugins/triggers/triggers.js +82 -62
- package/dist/plugins/uploads.svelte.d.ts +55 -24
- package/dist/plugins/uploads.svelte.js +123 -50
- package/dist/plugins.d.ts +187 -66
- package/dist/selection/domSelection.d.ts +13 -4
- package/dist/selection/domSelection.js +110 -183
- package/dist/selection/pointer.svelte.d.ts +8 -10
- package/dist/selection/pointer.svelte.js +32 -73
- package/dist/selection/replaceSelection.d.ts +21 -22
- package/dist/selection/replaceSelection.js +60 -69
- package/dist/selection/selection.svelte.d.ts +5 -73
- package/dist/selection/selection.svelte.js +224 -542
- package/dist/selection/selection.utils.d.ts +34 -11
- package/dist/selection/selection.utils.js +128 -247
- package/dist/selection/visibility.d.ts +3 -8
- package/dist/selection/visibility.js +7 -5
- package/dist/session/announcer.svelte.d.ts +2 -1
- package/dist/session/announcer.svelte.js +7 -3
- package/dist/session/attempt.d.ts +43 -39
- package/dist/session/attempt.js +62 -55
- package/dist/session/bindings.js +117 -145
- package/dist/session/commands.d.ts +47 -22
- package/dist/session/commands.js +208 -208
- package/dist/session/composition.svelte.d.ts +2 -4
- package/dist/session/composition.svelte.js +55 -65
- package/dist/session/editing/text.d.ts +6 -0
- package/dist/session/editing/text.js +17 -3
- package/dist/session/handles.d.ts +10 -1
- package/dist/session/handles.js +28 -0
- package/dist/session/history.d.ts +0 -4
- package/dist/session/history.js +16 -21
- package/dist/session/inputRules.d.ts +6 -3
- package/dist/session/inputRules.js +78 -83
- package/dist/session/keymap.d.ts +1 -6
- package/dist/session/keymap.js +17 -20
- package/dist/session/moves.d.ts +43 -10
- package/dist/session/moves.js +101 -59
- package/dist/session/navigation.d.ts +10 -2
- package/dist/session/navigation.js +140 -172
- package/dist/session/ports.d.ts +2 -7
- package/dist/session/props.d.ts +25 -25
- package/dist/session/props.js +62 -159
- package/dist/session/selection.d.ts +4 -3
- package/dist/session/selection.js +5 -0
- package/dist/session/suggestions.svelte.d.ts +1 -1
- package/dist/session/suggestions.svelte.js +42 -47
- package/dist/session/uploads.d.ts +29 -0
- package/dist/session/uploads.js +10 -0
- package/dist/session/virtual.d.ts +3 -3
- package/dist/session/virtual.js +18 -40
- package/dist/surface/attributes.d.ts +1 -0
- package/dist/surface/attributes.js +3 -26
- package/dist/surface/cells.d.ts +5 -0
- package/dist/surface/cells.js +5 -0
- package/dist/surface/lines.d.ts +2 -2
- package/dist/surface/lines.js +1 -1
- package/dist/surface/observer.svelte.d.ts +3 -20
- package/dist/surface/observer.svelte.js +52 -72
- package/dist/surface/overlay.d.ts +41 -3
- package/dist/surface/overlay.js +92 -37
- package/dist/surface/pin.svelte.d.ts +5 -0
- package/dist/surface/pin.svelte.js +5 -0
- package/dist/surface/projector.svelte.d.ts +4 -6
- package/dist/surface/projector.svelte.js +42 -69
- package/dist/text/text.svelte.d.ts +14 -40
- package/dist/text/text.svelte.js +35 -51
- package/dist/text/wordBoundary.d.ts +19 -0
- package/dist/text/wordBoundary.js +29 -44
- package/dist/themes/notion.css +272 -106
- package/dist/utils/json.d.ts +3 -1
- package/dist/utils/json.js +52 -51
- package/dist/utils/listen.d.ts +8 -0
- package/dist/utils/listen.js +19 -0
- package/package.json +4 -5
- package/dist/block/block.utils.d.ts +0 -340
- package/dist/block/block.utils.js +0 -356
- package/dist/collaboration/history/HistoryPanel.svelte +0 -554
- package/dist/collaboration/history/HistoryPanel.svelte.d.ts +0 -7
- package/dist/collaboration/history/panel.d.ts +0 -61
- package/dist/collaboration/history/panel.js +0 -3
- package/dist/components/SuggestionRanges.svelte +0 -58
- package/dist/components/SuggestionRanges.svelte.d.ts +0 -7
- package/dist/crdt/doc/table.d.ts +0 -21
- package/dist/crdt/doc/table.js +0 -288
- package/dist/crdt/migration/generation.d.ts +0 -58
- package/dist/crdt/migration/generation.js +0 -70
- package/dist/crdt/migration/legacy-schema.d.ts +0 -61
- package/dist/crdt/migration/legacy-schema.js +0 -151
- package/dist/crdt/migration/migrate.d.ts +0 -56
- package/dist/crdt/migration/migrate.js +0 -227
- package/dist/crdt/nodes.d.ts +0 -121
- package/dist/crdt/nodes.js +0 -56
- package/dist/crdt/text/index/checks.d.ts +0 -15
- package/dist/crdt/text/index/checks.js +0 -156
- package/dist/crdt/vendor/yjs/dts/utils/EventHandler.d.ts +0 -17
- package/dist/crdt/vendor/yjs/dts/utils/RelativePosition.d.ts +0 -80
- package/dist/crdt/vendor/yjs/dts/utils/UndoManager.d.ts +0 -205
- package/dist/crdt/vendor/yjs/dts/utils/YEvent.d.ts +0 -93
- package/dist/crdt/vendor/yjs/dts/utils/meta.d.ts +0 -25
- package/dist/crdt/vendor/yjs/dts/utils/renderer-helpers.d.ts +0 -98
- package/dist/crdt/vendor/yjs/dts/utils/schemas.d.ts +0 -2
- package/dist/crdt/vendor/yjs/src/utils/EventHandler.js +0 -75
- package/dist/crdt/vendor/yjs/src/utils/RelativePosition.js +0 -301
- package/dist/crdt/vendor/yjs/src/utils/UndoManager.js +0 -554
- package/dist/crdt/vendor/yjs/src/utils/YEvent.js +0 -158
- package/dist/crdt/vendor/yjs/src/utils/meta.js +0 -74
- package/dist/crdt/vendor/yjs/src/utils/renderer-helpers.js +0 -186
- package/dist/crdt/vendor/yjs/src/utils/schemas.js +0 -3
- package/dist/edytor.utils.d.ts +0 -50
- package/dist/edytor.utils.js +0 -67
- package/dist/plugins/blockMenu/BlockMenu.svelte +0 -335
- package/dist/plugins/blockMenu/BlockMenu.svelte.d.ts +0 -9
- package/dist/plugins/find/FindBar.svelte +0 -170
- package/dist/plugins/find/FindBar.svelte.d.ts +0 -9
- package/dist/plugins/find/FindHighlights.svelte +0 -75
- package/dist/plugins/find/FindHighlights.svelte.d.ts +0 -9
- package/dist/plugins/icons.d.ts +0 -2
- package/dist/plugins/icons.js +0 -63
- package/dist/plugins/image/ImageEmpty.svelte +0 -93
- package/dist/plugins/image/ImageEmpty.svelte.d.ts +0 -15
- package/dist/plugins/image/empty.svelte.d.ts +0 -56
- package/dist/plugins/image/empty.svelte.js +0 -83
- package/dist/plugins/keepInView.d.ts +0 -4
- package/dist/plugins/keepInView.js +0 -6
- package/dist/plugins/media/UrlPasteMenu.svelte +0 -92
- package/dist/plugins/media/UrlPasteMenu.svelte.d.ts +0 -9
- package/dist/plugins/richtext/CalloutIconMenu.svelte +0 -98
- package/dist/plugins/richtext/CalloutIconMenu.svelte.d.ts +0 -9
- package/dist/plugins/richtext/labels.d.ts +0 -9
- package/dist/plugins/richtext/labels.js +0 -7
- package/dist/plugins/slashMenu/SlashMenu.svelte +0 -276
- package/dist/plugins/slashMenu/SlashMenu.svelte.d.ts +0 -11
- package/dist/plugins/table/dragPreview.d.ts +0 -29
- package/dist/plugins/table/dragPreview.js +0 -103
- package/dist/plugins/toolbar/LinkCard.svelte +0 -122
- package/dist/plugins/toolbar/LinkCard.svelte.d.ts +0 -9
- package/dist/plugins/toolbar/Toolbar.svelte +0 -349
- package/dist/plugins/toolbar/Toolbar.svelte.d.ts +0 -9
- package/dist/plugins/triggers/TriggerMenu.svelte +0 -135
- package/dist/plugins/triggers/TriggerMenu.svelte.d.ts +0 -7
- package/dist/text/deltas.d.ts +0 -22
- package/dist/text/deltas.js +0 -46
- package/dist/text/text.utils.d.ts +0 -45
- package/dist/text/text.utils.js +0 -199
- /package/dist/{plugins/columns → dnd}/stacking.d.ts +0 -0
- /package/dist/{plugins/columns → dnd}/stacking.js +0 -0
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Plugin } from '../../plugins.js';
|
|
3
3
|
import { SlashMenuController } from './SlashMenuController.svelte.js';
|
|
4
|
-
import { type PartialLabels } from '../../labels.js';
|
|
5
|
-
import type { MenuItemPayload } from '../chrome.js';
|
|
6
|
-
/**
|
|
7
|
-
* One row, for an `item` snippet: the row shape every menu shares (`item`
|
|
8
|
-
* is the command, `label` its label, `run` runs it, removing the `/query`
|
|
9
|
-
* first; set `id`, or spread `option`, so the keyboard's owner names the
|
|
10
|
-
* highlighted row), with the command again and its icon.
|
|
11
|
-
*/
|
|
12
|
-
export type SlashMenuItem = MenuItemPayload<EditorCommand> & {
|
|
13
|
-
/** The command (the same as `item`). */
|
|
14
|
-
command: EditorCommand;
|
|
15
|
-
/** The built-in line icon as a CSS `mask-image` value, when the command has one. */
|
|
16
|
-
icon: string | undefined;
|
|
17
|
-
};
|
|
18
4
|
export type SlashMenuOptions = {
|
|
19
5
|
/**
|
|
20
|
-
*
|
|
21
|
-
* placement stay the plugin's. Keep
|
|
22
|
-
* controller.popup}` on the list
|
|
23
|
-
* each row; in a `+`'s menu
|
|
6
|
+
* The menu's markup and its words; it renders while `controller.isOpen`
|
|
7
|
+
* (without it, nothing shows). Keys and placement stay the plugin's. Keep
|
|
8
|
+
* its ARIA with `{@attach controller.popup}` on the list (name it) and
|
|
9
|
+
* `{...controller.option(index)}` on each row; in a `+`'s menu (while
|
|
10
|
+
* `controller.addition`), `{@attach controller.keys}` on the element that
|
|
11
|
+
* holds the keyboard (your field, or the menu itself: typing then edits
|
|
12
|
+
* the query).
|
|
24
13
|
*/
|
|
25
14
|
menu?: Snippet<[SlashMenuController]>;
|
|
26
|
-
/** Replace each row of the default menu. */
|
|
27
|
-
item?: Snippet<[SlashMenuItem]>;
|
|
28
|
-
/** The words the menu shows (its field, headings, empty state), over the English ones. */
|
|
29
|
-
labels?: PartialLabels<'slashMenu'>;
|
|
30
15
|
};
|
|
31
|
-
/** The slash menu,
|
|
16
|
+
/** The slash menu, drawn by your `menu` snippet. */
|
|
32
17
|
export declare const createSlashMenuPlugin: (options?: SlashMenuOptions) => Plugin;
|
|
33
|
-
/** The Notion-style slash menu. */
|
|
34
|
-
export declare const slashMenuPlugin: Plugin;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import SlashMenu from './SlashMenu.svelte';
|
|
4
|
-
import { caretRect, placeBelow } from '../triggers/place.js';
|
|
1
|
+
import { caretRect } from '../triggers/place.js';
|
|
2
|
+
import { placeNear } from '../../surface/overlay.js';
|
|
5
3
|
import { SlashMenuController } from './SlashMenuController.svelte.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { handleMenuEvents, mountChrome } from '../chrome.js';
|
|
5
|
+
import { withTriggerMenus } from '../triggers/triggers.js';
|
|
6
|
+
/** The slash menu, drawn by your `menu` snippet. */
|
|
8
7
|
export const createSlashMenuPlugin = (options = {}) => (edytor) => {
|
|
9
|
-
const controller = new SlashMenuController(edytor
|
|
8
|
+
const controller = new SlashMenuController(edytor);
|
|
10
9
|
/**
|
|
11
10
|
* Beside the caret (below a `+` it was opened from), kept in the
|
|
12
11
|
* viewport; measured in the overlay's frame, written after, as
|
|
@@ -22,68 +21,28 @@ export const createSlashMenuPlugin = (options = {}) => (edytor) => {
|
|
|
22
21
|
const anchor = addition?.anchor?.isConnected ? addition.anchor : addition?.block.node;
|
|
23
22
|
const box = anchor?.getBoundingClientRect();
|
|
24
23
|
const rect = box && (box.width || box.height) ? box : caretRect(edytor);
|
|
25
|
-
return rect &&
|
|
24
|
+
return rect && placeNear(host, rect, [310, 350]);
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (controller.isOpen && controller.commands.length)
|
|
39
|
-
prevent(() => void controller.runSelected());
|
|
40
|
-
},
|
|
41
|
-
escape: ({ prevent }) => {
|
|
42
|
-
if (controller.isOpen)
|
|
43
|
-
prevent(() => controller.dismiss());
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
onAfterOperation: (change) => {
|
|
47
|
-
if (change.operation !== 'insertText' || !('text' in change))
|
|
48
|
-
return;
|
|
49
|
-
controller.handleTextInsertion(change.text, change.block, change.payload);
|
|
26
|
+
const plugin = {
|
|
27
|
+
onEdytorAttached: ({ node }) => handleMenuEvents(edytor, node,
|
|
28
|
+
// A grip's menu takes over (one menu at a time).
|
|
29
|
+
() => {
|
|
30
|
+
if (controller.addition)
|
|
31
|
+
controller.close();
|
|
32
|
+
},
|
|
33
|
+
// A `+` offers its block: nothing is added until a row is picked.
|
|
34
|
+
(event) => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
controller.offer(event.detail);
|
|
50
37
|
edytor.overlay.invalidate();
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
edytor.overlay.invalidate();
|
|
55
|
-
},
|
|
56
|
-
onEdytorAttached: ({ node }) => {
|
|
57
|
-
// A `+` offers its block: nothing is added until a row is picked.
|
|
58
|
-
const offer = (event) => {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
controller.offer(event.detail);
|
|
61
|
-
edytor.overlay.invalidate();
|
|
62
|
-
};
|
|
63
|
-
const outside = (event) => {
|
|
64
|
-
const target = event.target;
|
|
65
|
-
// The selection as it was; a press in the editor then places its caret.
|
|
66
|
-
if (controller.addition && !target?.closest?.('[data-edytor-slash-menu-host]'))
|
|
67
|
-
controller.dismiss(false);
|
|
68
|
-
};
|
|
69
|
-
// A grip's menu takes over (one menu at a time).
|
|
70
|
-
const activate = () => {
|
|
71
|
-
if (controller.addition)
|
|
72
|
-
controller.close();
|
|
73
|
-
};
|
|
74
|
-
node.addEventListener(BLOCK_ADD_EVENT, offer);
|
|
75
|
-
node.addEventListener(BLOCK_ACTIVATE_EVENT, activate);
|
|
76
|
-
// Every press, WebKit's lone `mousedown` after a drag too (`onPress`).
|
|
77
|
-
const offPress = onPress(edytor, node.ownerDocument, outside, true);
|
|
78
|
-
const unmount = edytor.overlay.mount(SlashMenu, { controller, menu: options.menu, item: options.item }, 'edytor-slash-menu-host', 50, positionMenu);
|
|
79
|
-
return () => {
|
|
80
|
-
node.removeEventListener(BLOCK_ADD_EVENT, offer);
|
|
81
|
-
node.removeEventListener(BLOCK_ACTIVATE_EVENT, activate);
|
|
82
|
-
offPress();
|
|
83
|
-
unmount();
|
|
84
|
-
};
|
|
85
|
-
}
|
|
38
|
+
}, '[data-edytor-slash-menu-host]',
|
|
39
|
+
// The selection as it was; a press in the editor then places its caret.
|
|
40
|
+
() => controller.addition && controller.dismiss(false))
|
|
86
41
|
};
|
|
42
|
+
// The `/` trigger, wired as a plugin's triggers are.
|
|
43
|
+
return withTriggerMenus(edytor, plugin, [controller], () => ({
|
|
44
|
+
move: controller.move,
|
|
45
|
+
pick: controller.commands.length ? () => void controller.runSelected() : undefined,
|
|
46
|
+
close: () => controller.dismiss()
|
|
47
|
+
}), () => mountChrome(edytor, options.menu, controller, () => controller.isOpen, { name: 'edytor-slash-menu-host', zIndex: 50, measure: positionMenu }, () => controller.dismiss(false)));
|
|
87
48
|
};
|
|
88
|
-
/** The Notion-style slash menu. */
|
|
89
|
-
export const slashMenuPlugin = createSlashMenuPlugin();
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { mount, unmount } from 'svelte';
|
|
3
|
+
import type { Plugin } from '../../plugins.js';
|
|
4
|
+
import type { SuggestionBarOptions } from './suggestionsPlugin.js';
|
|
5
|
+
import Self from './SuggestionBars.svelte';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The suggestion bar (Notion AI's): your `bar` under each block
|
|
9
|
+
* suggestion (Accept, Discard, and Try again when the app passed
|
|
10
|
+
* `onRetry`); its keys are the suggestions plugin's.
|
|
11
|
+
*/
|
|
12
|
+
export const createSuggestionBarPlugin =
|
|
13
|
+
({ bar }: SuggestionBarOptions): Plugin =>
|
|
14
|
+
(edytor) => ({
|
|
15
|
+
onEdytorAttached: () => {
|
|
16
|
+
const bars = mount(Self, { target: edytor.overlay.layer!, props: { edytor, bar } });
|
|
17
|
+
return () => void unmount(bars);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
1
22
|
<script lang="ts">
|
|
23
|
+
import { takeKeys } from '../../events/onFocus.js';
|
|
2
24
|
import { onMount, type Snippet } from 'svelte';
|
|
3
25
|
import type { Edytor } from '../../edytor.svelte.js';
|
|
4
26
|
import type { Suggestion } from '../../session/suggestions.svelte.js';
|
|
5
27
|
import type { SuggestionBarPayload } from './suggestionsPlugin.js';
|
|
6
|
-
import type { SuggestionsLabels } from '../../labels.js';
|
|
7
28
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bar,
|
|
11
|
-
labels
|
|
12
|
-
}: { edytor: Edytor; bar?: Snippet<[SuggestionBarPayload]>; labels: SuggestionsLabels } =
|
|
13
|
-
$props();
|
|
29
|
+
/** The plugin's `bar` under each block suggestion's preview, placed once per frame. */
|
|
30
|
+
let { edytor, bar }: { edytor: Edytor; bar: Snippet<[SuggestionBarPayload]> } = $props();
|
|
14
31
|
|
|
15
32
|
/** Each bar's place under its preview, layer-relative, measured once per frame. */
|
|
16
33
|
let places = $state<Record<string, { left: number; top: number; width: number }>>({});
|
|
@@ -48,20 +65,17 @@
|
|
|
48
65
|
suggestion,
|
|
49
66
|
accept: () => {
|
|
50
67
|
suggestion.accept();
|
|
51
|
-
edytor
|
|
52
|
-
edytor.node?.focus({ preventScroll: true });
|
|
68
|
+
takeKeys(edytor);
|
|
53
69
|
},
|
|
54
70
|
discard: suggestion.discard,
|
|
55
71
|
retry: suggestion.retryable ? suggestion.retry : undefined,
|
|
56
72
|
readonly: edytor.readonly,
|
|
57
|
-
|
|
73
|
+
mac: edytor.keymap.isMac
|
|
58
74
|
});
|
|
59
|
-
const keep = (event: MouseEvent) => event.preventDefault();
|
|
60
75
|
</script>
|
|
61
76
|
|
|
62
77
|
{#each shown as suggestion (suggestion.id)}
|
|
63
78
|
{@const place = places[suggestion.id]}
|
|
64
|
-
{@const actions = payload(suggestion)}
|
|
65
79
|
<div
|
|
66
80
|
data-edytor-suggestion-bar={suggestion.id}
|
|
67
81
|
data-status={suggestion.status}
|
|
@@ -70,38 +84,7 @@
|
|
|
70
84
|
style:top={`${place?.top ?? 0}px`}
|
|
71
85
|
style:visibility={place ? undefined : 'hidden'}
|
|
72
86
|
>
|
|
73
|
-
{
|
|
74
|
-
{@render bar(actions)}
|
|
75
|
-
{:else}
|
|
76
|
-
<span data-edytor-suggestion-label
|
|
77
|
-
>{suggestion.status === 'streaming'
|
|
78
|
-
? labels.writing(suggestion.label)
|
|
79
|
-
: (suggestion.label ?? labels.suggestion)}</span
|
|
80
|
-
>
|
|
81
|
-
{#if !actions.readonly}
|
|
82
|
-
<button
|
|
83
|
-
type="button"
|
|
84
|
-
data-edytor-suggestion-accept
|
|
85
|
-
onmousedown={keep}
|
|
86
|
-
onclick={actions.accept}
|
|
87
|
-
>{labels.accept} <kbd>{edytor.keymap.isMac ? '⌘↵' : `${labels.ctrl}+↵`}</kbd></button
|
|
88
|
-
>
|
|
89
|
-
{/if}
|
|
90
|
-
<button
|
|
91
|
-
type="button"
|
|
92
|
-
data-edytor-suggestion-discard
|
|
93
|
-
onmousedown={keep}
|
|
94
|
-
onclick={actions.discard}>{labels.discard} <kbd>{labels.escape}</kbd></button
|
|
95
|
-
>
|
|
96
|
-
{#if actions.retry && !actions.readonly}
|
|
97
|
-
<button
|
|
98
|
-
type="button"
|
|
99
|
-
data-edytor-suggestion-retry
|
|
100
|
-
onmousedown={keep}
|
|
101
|
-
onclick={actions.retry}>{labels.retry}</button
|
|
102
|
-
>
|
|
103
|
-
{/if}
|
|
104
|
-
{/if}
|
|
87
|
+
{@render bar(payload(suggestion))}
|
|
105
88
|
</div>
|
|
106
89
|
{/each}
|
|
107
90
|
|
|
@@ -109,45 +92,5 @@
|
|
|
109
92
|
[data-edytor-suggestion-bar] {
|
|
110
93
|
position: absolute;
|
|
111
94
|
z-index: 30;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
gap: 4px;
|
|
115
|
-
padding: 4px;
|
|
116
|
-
border-radius: 8px;
|
|
117
|
-
background: var(--edytor-suggestion-bar-background, #fff);
|
|
118
|
-
box-shadow:
|
|
119
|
-
0 0 0 1px rgb(15 15 15 / 0.05),
|
|
120
|
-
0 3px 6px rgb(15 15 15 / 0.1),
|
|
121
|
-
0 9px 24px rgb(15 15 15 / 0.2);
|
|
122
|
-
font-size: 13px;
|
|
123
|
-
line-height: 1.2;
|
|
124
|
-
white-space: nowrap;
|
|
125
|
-
user-select: none;
|
|
126
|
-
}
|
|
127
|
-
[data-edytor-suggestion-label] {
|
|
128
|
-
padding: 0 6px;
|
|
129
|
-
color: var(--edytor-suggestion-accent, #2383e2);
|
|
130
|
-
font-weight: 500;
|
|
131
|
-
}
|
|
132
|
-
[data-edytor-suggestion-bar] button {
|
|
133
|
-
display: inline-flex;
|
|
134
|
-
align-items: center;
|
|
135
|
-
gap: 6px;
|
|
136
|
-
height: 26px;
|
|
137
|
-
padding: 0 8px;
|
|
138
|
-
border: 0;
|
|
139
|
-
border-radius: 6px;
|
|
140
|
-
background: transparent;
|
|
141
|
-
color: inherit;
|
|
142
|
-
font: inherit;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
}
|
|
145
|
-
[data-edytor-suggestion-bar] button:hover {
|
|
146
|
-
background: rgb(55 53 47 / 0.08);
|
|
147
|
-
}
|
|
148
|
-
[data-edytor-suggestion-bar] kbd {
|
|
149
|
-
color: rgb(55 53 47 / 0.5);
|
|
150
|
-
font: inherit;
|
|
151
|
-
font-size: 11px;
|
|
152
95
|
}
|
|
153
96
|
</style>
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import type { Plugin } from '../../plugins.js';
|
|
2
|
+
import type { SuggestionBarOptions } from './suggestionsPlugin.js';
|
|
3
|
+
/**
|
|
4
|
+
* The suggestion bar (Notion AI's): your `bar` under each block
|
|
5
|
+
* suggestion (Accept, Discard, and Try again when the app passed
|
|
6
|
+
* `onRetry`); its keys are the suggestions plugin's.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createSuggestionBarPlugin: ({ bar }: SuggestionBarOptions) => Plugin;
|
|
1
9
|
import { type Snippet } from 'svelte';
|
|
2
10
|
import type { Edytor } from '../../edytor.svelte.js';
|
|
3
11
|
import type { SuggestionBarPayload } from './suggestionsPlugin.js';
|
|
4
|
-
import type { SuggestionsLabels } from '../../labels.js';
|
|
5
12
|
type $$ComponentProps = {
|
|
6
13
|
edytor: Edytor;
|
|
7
|
-
bar
|
|
8
|
-
labels: SuggestionsLabels;
|
|
14
|
+
bar: Snippet<[SuggestionBarPayload]>;
|
|
9
15
|
};
|
|
10
16
|
declare const SuggestionBars: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
17
|
type SuggestionBars = ReturnType<typeof SuggestionBars>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { Plugin } from '../../plugins.js';
|
|
3
3
|
import type { Suggestion } from '../../session/suggestions.svelte.js';
|
|
4
|
-
import { type PartialLabels, type SuggestionsLabels } from '../../labels.js';
|
|
5
4
|
/** What a `bar` snippet receives: one block suggestion and its actions. */
|
|
6
5
|
export type SuggestionBarPayload = {
|
|
7
6
|
suggestion: Suggestion;
|
|
@@ -11,23 +10,16 @@ export type SuggestionBarPayload = {
|
|
|
11
10
|
/** Ask for another answer (`onRetry`); `undefined` without one. */
|
|
12
11
|
retry: (() => void) | undefined;
|
|
13
12
|
readonly: boolean;
|
|
14
|
-
/** The
|
|
15
|
-
|
|
13
|
+
/** The view's keys are a Mac's: Mod is ⌘ (name the Accept key with it). */
|
|
14
|
+
mac: boolean;
|
|
16
15
|
};
|
|
17
|
-
export type
|
|
18
|
-
/**
|
|
19
|
-
bar
|
|
20
|
-
/** The words the bar shows, over the English ones. */
|
|
21
|
-
labels?: PartialLabels<'suggestions'>;
|
|
16
|
+
export type SuggestionBarOptions = {
|
|
17
|
+
/** The bar under each block suggestion and its words; its placement is the plugin's. */
|
|
18
|
+
bar: Snippet<[SuggestionBarPayload]>;
|
|
22
19
|
};
|
|
23
|
-
/** Recognize any suggestions plugin instance (the component's default yields to yours). */
|
|
24
|
-
export declare const isSuggestionsPlugin: (plugin: Plugin) => boolean;
|
|
25
20
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* discards; Tab accepts an `end` suggestion at the caret.
|
|
21
|
+
* The keys of `edytor.suggestions` (Notion AI's), a default plugin: for the
|
|
22
|
+
* latest one, Mod+Enter accepts and Escape discards; Tab accepts an `end`
|
|
23
|
+
* suggestion at the caret. Its bar is `createSuggestionBarPlugin`'s.
|
|
30
24
|
*/
|
|
31
|
-
export declare const createSuggestionsPlugin: (
|
|
32
|
-
/** The default suggestion UI. */
|
|
33
|
-
export declare const suggestionsPlugin: Plugin;
|
|
25
|
+
export declare const createSuggestionsPlugin: () => Plugin;
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import SuggestionBars from './SuggestionBars.svelte';
|
|
3
|
-
import { labelsWith } from '../../labels.js';
|
|
4
|
-
const suggestionPlugins = new WeakSet();
|
|
5
|
-
/** Recognize any suggestions plugin instance (the component's default yields to yours). */
|
|
6
|
-
export const isSuggestionsPlugin = (plugin) => suggestionPlugins.has(plugin);
|
|
1
|
+
import { branded } from '../brand.js';
|
|
7
2
|
/**
|
|
8
3
|
* The `end` suggestion a Tab at the caret accepts: a collapsed caret in its
|
|
9
4
|
* block, unless that block indents with Tab (a list-like kind or a list's item).
|
|
10
5
|
*/
|
|
11
6
|
const endAtCaret = (edytor) => {
|
|
12
|
-
const {
|
|
7
|
+
const { startText } = edytor.selection.textRange();
|
|
8
|
+
const { isCollapsed } = edytor.selection.projection;
|
|
9
|
+
const startBlock = startText?.parent;
|
|
13
10
|
if (!startBlock || !isCollapsed || startBlock.definition.continues || startBlock.list)
|
|
14
11
|
return;
|
|
15
12
|
return edytor.suggestions.at(startBlock.id).end.at(-1);
|
|
16
13
|
};
|
|
17
14
|
/**
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* discards; Tab accepts an `end` suggestion at the caret.
|
|
15
|
+
* The keys of `edytor.suggestions` (Notion AI's), a default plugin: for the
|
|
16
|
+
* latest one, Mod+Enter accepts and Escape discards; Tab accepts an `end`
|
|
17
|
+
* suggestion at the caret. Its bar is `createSuggestionBarPlugin`'s.
|
|
22
18
|
*/
|
|
23
|
-
export const createSuggestionsPlugin = (
|
|
24
|
-
const labels = labelsWith('suggestions', options.labels);
|
|
19
|
+
export const createSuggestionsPlugin = () => {
|
|
25
20
|
const plugin = (edytor) => ({
|
|
26
21
|
hotkeys: {
|
|
27
22
|
'mod+enter': ({ prevent }) => {
|
|
@@ -39,17 +34,7 @@ export const createSuggestionsPlugin = (options = {}) => {
|
|
|
39
34
|
if (suggestion)
|
|
40
35
|
prevent(() => suggestion.accept());
|
|
41
36
|
}
|
|
42
|
-
},
|
|
43
|
-
onEdytorAttached: () => {
|
|
44
|
-
const bars = mount(SuggestionBars, {
|
|
45
|
-
target: edytor.overlay.layer,
|
|
46
|
-
props: { edytor, bar: options.bar, labels }
|
|
47
|
-
});
|
|
48
|
-
return () => void unmount(bars);
|
|
49
37
|
}
|
|
50
38
|
});
|
|
51
|
-
|
|
52
|
-
return plugin;
|
|
39
|
+
return branded('suggestions', plugin);
|
|
53
40
|
};
|
|
54
|
-
/** The default suggestion UI. */
|
|
55
|
-
export const suggestionsPlugin = createSuggestionsPlugin();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { keepFocus } from '../chrome.js';
|
|
4
|
+
import { labelsOf, tableEnglish } from '../../labels.js';
|
|
4
5
|
import type { TableAddPayload, TableChrome, TableGripPayload } from './chrome.svelte.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -10,8 +11,8 @@
|
|
|
10
11
|
* the drop line of a grip's drag, and a resize band on each column's
|
|
11
12
|
* right edge. Over a table wider than its box, only what its box shows
|
|
12
13
|
* (`table.overflow`). A grip, a menu and a `+` are the plugin's `grip`,
|
|
13
|
-
* `menu` and `add` snippets
|
|
14
|
-
* their keys and ARIA the controller's attachments
|
|
14
|
+
* `menu` and `add` snippets (none without them): placed by the hosts
|
|
15
|
+
* here, their keys and ARIA the controller's attachments.
|
|
15
16
|
*/
|
|
16
17
|
let {
|
|
17
18
|
chrome,
|
|
@@ -25,80 +26,43 @@
|
|
|
25
26
|
add?: Snippet<[TableAddPayload]>;
|
|
26
27
|
} = $props();
|
|
27
28
|
|
|
29
|
+
const labels = $derived(labelsOf(chrome.edytor, 'table', tableEnglish));
|
|
28
30
|
const layout = $derived(chrome.layout);
|
|
29
|
-
const
|
|
30
|
-
const grips = $derived([chrome.rowGrip, chrome.columnGrip].filter((place) => place !== null));
|
|
31
|
-
const bars = $derived(chrome.bars);
|
|
31
|
+
const line = $derived(chrome.line);
|
|
32
32
|
const menuPlace = $derived(chrome.menuPlace);
|
|
33
|
-
/** The drop line of a grip's drag: between two rows (columns), where the drop would land. */
|
|
34
|
-
const line = $derived.by(() => {
|
|
35
|
-
const move = chrome.moving;
|
|
36
|
-
const gap = move?.gap ?? null;
|
|
37
|
-
if (!move || gap === null || !layout) return null;
|
|
38
|
-
if (move.kind === 'row') {
|
|
39
|
-
const row = layout.rows[gap];
|
|
40
|
-
const last = layout.rows[layout.rows.length - 1];
|
|
41
|
-
const y = row ? row.top : last ? last.top + last.height : null;
|
|
42
|
-
const { left, width } = chrome.span;
|
|
43
|
-
return y === null ? null : { kind: 'row', gap, left, top: y, width };
|
|
44
|
-
}
|
|
45
|
-
const column = layout.columns[gap];
|
|
46
|
-
const last = layout.columns[layout.columns.length - 1];
|
|
47
|
-
const x = column ? column.left : last ? last.left + last.width : null;
|
|
48
|
-
if (x === null || !chrome.inView(x)) return null;
|
|
49
|
-
return { kind: 'column', gap, left: x, top: layout.top, height: layout.height };
|
|
50
|
-
});
|
|
51
33
|
|
|
52
34
|
// The view turning readonly mid-drag drops the preview at once.
|
|
53
35
|
$effect(() => {
|
|
54
|
-
if (chrome.readonly) chrome.lock();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
/** A grip's snippet payload. */
|
|
58
|
-
const gripPayload = (place: NonNullable<TableChrome['rowGrip']>): TableGripPayload => ({
|
|
59
|
-
kind: place.kind,
|
|
60
|
-
id: place.id,
|
|
61
|
-
index: place.index,
|
|
62
|
-
expanded: chrome.menu?.kind === place.kind,
|
|
63
|
-
dragging: chrome.moving?.kind === place.kind,
|
|
64
|
-
label: place.kind === 'row' ? labels.rowMenu : labels.columnMenu,
|
|
65
|
-
toggle: () => chrome.toggle(place.kind),
|
|
66
|
-
grip: chrome.gripOf(place.kind),
|
|
67
|
-
labels,
|
|
68
|
-
chrome
|
|
36
|
+
if (chrome.readonly) chrome.band.lock();
|
|
69
37
|
});
|
|
70
38
|
|
|
71
|
-
|
|
72
|
-
const addPayload = (kind: 'row' | 'column'): TableAddPayload => ({
|
|
73
|
-
kind,
|
|
74
|
-
label: kind === 'row' ? labels.addRow : labels.addColumn,
|
|
75
|
-
add: kind === 'row' ? chrome.addRow : chrome.addColumn,
|
|
76
|
-
labels
|
|
77
|
-
});
|
|
39
|
+
const px = (value: number | undefined) => (value === undefined ? undefined : `${value}px`);
|
|
78
40
|
</script>
|
|
79
41
|
|
|
80
42
|
<div
|
|
81
43
|
role="presentation"
|
|
82
44
|
data-edytor-table-chrome
|
|
83
|
-
data-selecting={chrome.selecting ? 'true' : undefined}
|
|
45
|
+
data-selecting={chrome.band.selecting ? 'true' : undefined}
|
|
84
46
|
>
|
|
85
47
|
{#if chrome.shown && layout}
|
|
86
|
-
{#each grips as place (place.kind)}
|
|
48
|
+
{#each grip ? chrome.grips : [] as place (place.kind)}
|
|
87
49
|
<!-- Centered on where the grip stands: its flex host is a point. -->
|
|
88
50
|
<div
|
|
89
51
|
data-edytor-table-grip-host={place.kind}
|
|
90
|
-
style:left=
|
|
91
|
-
style:top=
|
|
52
|
+
style:left={px(place.x)}
|
|
53
|
+
style:top={px(place.y)}
|
|
92
54
|
>
|
|
93
55
|
{#if grip}
|
|
94
|
-
{@render grip(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
56
|
+
{@render grip({
|
|
57
|
+
kind: place.kind,
|
|
58
|
+
id: place.id,
|
|
59
|
+
index: place.index,
|
|
60
|
+
expanded: chrome.menu?.kind === place.kind,
|
|
61
|
+
dragging: chrome.moving?.kind === place.kind,
|
|
62
|
+
toggle: () => chrome.toggle(place.kind),
|
|
63
|
+
grip: chrome.gripOf(place.kind),
|
|
64
|
+
chrome
|
|
65
|
+
})}
|
|
102
66
|
{/if}
|
|
103
67
|
</div>
|
|
104
68
|
{/each}
|
|
@@ -107,56 +71,27 @@
|
|
|
107
71
|
data-edytor-table-drop={line.kind}
|
|
108
72
|
data-gap={line.gap}
|
|
109
73
|
aria-hidden="true"
|
|
110
|
-
style:left=
|
|
111
|
-
style:top=
|
|
112
|
-
style:width={line.
|
|
113
|
-
style:height={line.
|
|
74
|
+
style:left={px(line.left)}
|
|
75
|
+
style:top={px(line.top)}
|
|
76
|
+
style:width={px(line.width)}
|
|
77
|
+
style:height={px(line.height)}
|
|
114
78
|
></div>
|
|
115
79
|
{/if}
|
|
116
|
-
{#
|
|
80
|
+
{#each add ? chrome.bars : [] as bar (bar.kind)}
|
|
117
81
|
<div
|
|
118
|
-
data-edytor-table-add-host=
|
|
82
|
+
data-edytor-table-add-host={bar.kind}
|
|
119
83
|
role="presentation"
|
|
120
|
-
style:left=
|
|
121
|
-
style:top=
|
|
122
|
-
style:width=
|
|
84
|
+
style:left={px(bar.left)}
|
|
85
|
+
style:top={px(bar.top)}
|
|
86
|
+
style:width={px(bar.width)}
|
|
87
|
+
style:height={px(bar.height)}
|
|
123
88
|
onmousedown={keepFocus}
|
|
124
89
|
>
|
|
125
90
|
{#if add}
|
|
126
|
-
{@render add(
|
|
127
|
-
{:else}
|
|
128
|
-
<button
|
|
129
|
-
type="button"
|
|
130
|
-
data-edytor-table-add="row"
|
|
131
|
-
aria-label={labels.addRow}
|
|
132
|
-
title={labels.addRow}
|
|
133
|
-
onclick={() => chrome.addRow()}
|
|
134
|
-
></button>
|
|
91
|
+
{@render add({ kind: bar.kind, add: () => chrome.add(bar.kind) })}
|
|
135
92
|
{/if}
|
|
136
93
|
</div>
|
|
137
|
-
{/
|
|
138
|
-
{#if bars.column}
|
|
139
|
-
<div
|
|
140
|
-
data-edytor-table-add-host="column"
|
|
141
|
-
role="presentation"
|
|
142
|
-
style:left="{bars.column.left}px"
|
|
143
|
-
style:top="{bars.column.top}px"
|
|
144
|
-
style:height="{bars.column.height}px"
|
|
145
|
-
onmousedown={keepFocus}
|
|
146
|
-
>
|
|
147
|
-
{#if add}
|
|
148
|
-
{@render add(addPayload('column'))}
|
|
149
|
-
{:else}
|
|
150
|
-
<button
|
|
151
|
-
type="button"
|
|
152
|
-
data-edytor-table-add="column"
|
|
153
|
-
aria-label={labels.addColumn}
|
|
154
|
-
title={labels.addColumn}
|
|
155
|
-
onclick={() => chrome.addColumn()}
|
|
156
|
-
></button>
|
|
157
|
-
{/if}
|
|
158
|
-
</div>
|
|
159
|
-
{/if}
|
|
94
|
+
{/each}
|
|
160
95
|
{#each layout.columns as column, index (column.id)}
|
|
161
96
|
{#if chrome.inView(column.left + column.width)}
|
|
162
97
|
<!-- A focusable separator is a widget (WAI-ARIA window splitter): its keys resize. -->
|
|
@@ -170,37 +105,18 @@
|
|
|
170
105
|
aria-valuenow={Math.round(column.width)}
|
|
171
106
|
aria-keyshortcuts="ArrowLeft ArrowRight Shift+ArrowLeft Shift+ArrowRight"
|
|
172
107
|
data-dragging={chrome.drag?.column === index ? 'true' : undefined}
|
|
173
|
-
style:left=
|
|
174
|
-
style:top=
|
|
175
|
-
style:height=
|
|
176
|
-
|
|
177
|
-
onmousedown={(event) => chrome.mousedown(event, index)}
|
|
108
|
+
style:left={px(column.left + column.width - 4)}
|
|
109
|
+
style:top={px(layout.top)}
|
|
110
|
+
style:height={px(layout.height)}
|
|
111
|
+
{@attach chrome.band.press((event) => chrome.start(event, index))}
|
|
178
112
|
onkeydown={(event) => chrome.key(event, index)}
|
|
179
113
|
></div>
|
|
180
114
|
{/if}
|
|
181
115
|
{/each}
|
|
182
116
|
{/if}
|
|
183
|
-
{#if chrome.menu && menuPlace}
|
|
184
|
-
<div data-edytor-table-menu-host style:left=
|
|
185
|
-
{
|
|
186
|
-
{@render menu(chrome)}
|
|
187
|
-
{:else}
|
|
188
|
-
<div class="edytor-table-menu" {@attach chrome.popup} {@attach chrome.keys}>
|
|
189
|
-
{#each chrome.items as item (item.item.id)}
|
|
190
|
-
<button
|
|
191
|
-
type="button"
|
|
192
|
-
class="edytor-table-menu-row"
|
|
193
|
-
class:danger={item.danger}
|
|
194
|
-
{...item.option}
|
|
195
|
-
disabled={item.disabled}
|
|
196
|
-
data-testid={`table-menu-${item.item.id}`}
|
|
197
|
-
style:--table-menu-icon={item.icon}
|
|
198
|
-
onmousemove={item.select}
|
|
199
|
-
onclick={item.run}>{item.label}</button
|
|
200
|
-
>
|
|
201
|
-
{/each}
|
|
202
|
-
</div>
|
|
203
|
-
{/if}
|
|
117
|
+
{#if menu && chrome.menu && menuPlace}
|
|
118
|
+
<div data-edytor-table-menu-host style:left={px(menuPlace.left)} style:top={px(menuPlace.top)}>
|
|
119
|
+
{@render menu(chrome)}
|
|
204
120
|
</div>
|
|
205
121
|
{/if}
|
|
206
122
|
</div>
|