@voithos-labs/aragonite 0.10.2 → 0.10.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/README.md +6 -21
- package/THIRD-PARTY-NOTICES.md +25 -0
- package/dist/a11y-strings.d.ts +18 -0
- package/dist/a11y-strings.js +18 -0
- package/dist/action-contracts.d.ts +7 -1
- package/dist/ambient/ambient-dom.js +5 -1
- package/dist/block-component.d.ts +14 -0
- package/dist/components/BlockDragHandle.svelte +35 -24
- package/dist/components/BlockHost.svelte +16 -9
- package/dist/components/Editor.svelte +381 -198
- package/dist/components/Editor.svelte.d.ts +1 -1
- package/dist/components/SelectionOverlay.svelte +17 -3
- package/dist/components/TailInsert.svelte +107 -0
- package/dist/components/TailInsert.svelte.d.ts +17 -0
- package/dist/components/block-content-selector.d.ts +6 -2
- package/dist/components/block-content-selector.js +6 -2
- package/dist/components/blocks/ThematicBreakBlock.svelte +19 -6
- package/dist/components/blocks/ThematicBreakBlock.svelte.d.ts +1 -0
- package/dist/components/blocks/code/CodeBlock.svelte +211 -30
- package/dist/components/blocks/code/CodeBlockRail.svelte +686 -0
- package/dist/components/blocks/code/CodeBlockRail.svelte.d.ts +26 -0
- package/dist/components/blocks/code/code-bootstrap.js +4 -0
- package/dist/components/blocks/code/code-context-actions.d.ts +1 -0
- package/dist/components/blocks/code/code-context-actions.js +24 -0
- package/dist/components/blocks/code/code-fence-exit.d.ts +15 -0
- package/dist/components/blocks/code/code-fence-exit.js +26 -0
- package/dist/components/blocks/code/code-languages.d.ts +6 -0
- package/dist/components/blocks/code/code-languages.js +11 -0
- package/dist/components/blocks/code/code-renderer.js +11 -0
- package/dist/components/blocks/directive/DirectiveContainerBlock.svelte +1 -1
- package/dist/components/blocks/editable-leaf.d.ts +37 -6
- package/dist/components/blocks/editable-leaf.js +243 -29
- package/dist/components/blocks/editable-surface.d.ts +9 -0
- package/dist/components/blocks/editable-surface.js +22 -3
- package/dist/components/blocks/list/ListItemBlock.svelte +3 -3
- package/dist/components/blocks/list/task-checkbox.d.ts +2 -0
- package/dist/components/blocks/list/task-checkbox.js +11 -2
- package/dist/components/blocks/surface-wiring.svelte.d.ts +4 -0
- package/dist/components/blocks/surface-wiring.svelte.js +8 -1
- package/dist/components/blocks/table/TableActionMenu.svelte +210 -86
- package/dist/components/blocks/table/TableActionMenu.svelte.d.ts +5 -0
- package/dist/components/blocks/table/TableBlock.svelte +205 -186
- package/dist/components/blocks/table/TableBlock.svelte.d.ts +1 -0
- package/dist/components/blocks/table/TableCellBlock.svelte +87 -22
- package/dist/components/blocks/table/TableRowBlock.svelte +4 -18
- package/dist/components/blocks/table/TableRowBlock.svelte.d.ts +0 -5
- package/dist/components/blocks/table/cell-clipboard.d.ts +10 -0
- package/dist/components/blocks/table/cell-clipboard.js +34 -1
- package/dist/components/blocks/table/cell-keydown-plan.d.ts +1 -1
- package/dist/components/blocks/table/cell-keydown-plan.js +3 -1
- package/dist/components/blocks/table/table-cell-paste.js +2 -1
- package/dist/components/blocks/table/table-menu-model.d.ts +35 -8
- package/dist/components/blocks/table/table-menu-model.js +36 -17
- package/dist/components/blocks/text/TextEditableBlock.svelte +58 -11
- package/dist/components/blocks/text/delimiter-autopair.d.ts +71 -0
- package/dist/components/blocks/text/delimiter-autopair.js +216 -0
- package/dist/components/blocks/text/edge-policy-dispatch.d.ts +4 -0
- package/dist/components/blocks/text/edge-policy-dispatch.js +56 -2
- package/dist/components/blocks/text/live-selection-edit.js +27 -0
- package/dist/components/blocks/text/text-keydown.d.ts +7 -1
- package/dist/components/blocks/text/text-keydown.js +11 -1
- package/dist/components/blocks/text/text-render.d.ts +1 -1
- package/dist/components/blocks/text/text-render.js +3 -1
- package/dist/components/blocks/text/widget-interaction.d.ts +3 -0
- package/dist/components/blocks/text/widget-interaction.js +144 -22
- package/dist/components/drag-handle.d.ts +35 -0
- package/dist/components/drag-handle.js +126 -0
- package/dist/components/editor-root-focus.d.ts +19 -0
- package/dist/components/editor-root-focus.js +67 -0
- package/dist/components/editor-root-geometry.d.ts +39 -0
- package/dist/components/editor-root-geometry.js +91 -0
- package/dist/components/editor-root-keydown.d.ts +1 -1
- package/dist/components/editor-root-keydown.js +12 -3
- package/dist/components/editor-root-listeners.d.ts +10 -6
- package/dist/components/editor-root-listeners.js +23 -22
- package/dist/components/editor-root-mode-flip.d.ts +36 -0
- package/dist/components/editor-root-mode-flip.js +92 -0
- package/dist/components/image/ImageOverlayHost.svelte +14 -6
- package/dist/components/image/ImageProperties.svelte +512 -70
- package/dist/components/image/ImageProperties.svelte.d.ts +6 -1
- package/dist/components/image/ImageResizeHandles.svelte +59 -34
- package/dist/components/image/image-crop.d.ts +39 -0
- package/dist/components/image/image-crop.js +74 -0
- package/dist/components/image/image-edit-commit.d.ts +1 -0
- package/dist/components/image/image-edit-commit.js +21 -5
- package/dist/components/image/image-source-bytes.js +10 -3
- package/dist/components/image/image-widget-editing.js +1 -0
- package/dist/components/image/widget-dom.js +5 -1
- package/dist/components/link-card/link-card-commit.js +1 -1
- package/dist/components/lrd-map-gate.js +1 -1
- package/dist/components/menu/BlockMenu.svelte +315 -0
- package/dist/components/menu/BlockMenu.svelte.d.ts +34 -0
- package/dist/components/menu/MenuIcon.svelte +153 -0
- package/dist/components/menu/MenuIcon.svelte.d.ts +51 -0
- package/dist/components/menu/clipboard-actions.d.ts +12 -0
- package/dist/components/menu/clipboard-actions.js +42 -0
- package/dist/components/menu/default-context-actions.d.ts +15 -0
- package/dist/components/menu/default-context-actions.js +76 -0
- package/dist/components/menu/flyout-placement.d.ts +6 -0
- package/dist/components/menu/flyout-placement.js +25 -0
- package/dist/core/inline/format-toggle.d.ts +12 -4
- package/dist/core/inline/format-toggle.js +94 -40
- package/dist/core/inline/image-dimensions.d.ts +3 -0
- package/dist/core/inline/image-dimensions.js +46 -10
- package/dist/core/inline/inline-widgets.d.ts +11 -0
- package/dist/core/inline/scan/brackets.js +1 -0
- package/dist/core/inline/scan/plugin-syntax.d.ts +8 -0
- package/dist/core/inline/scan/plugin-syntax.js +15 -1
- package/dist/core/inline-render.d.ts +6 -0
- package/dist/core/inline-render.js +32 -0
- package/dist/core/nodes.d.ts +14 -0
- package/dist/cursor/edge-affinity.js +2 -1
- package/dist/cursor/overlay-remeasure.js +8 -0
- package/dist/cursor/reveal-source.js +7 -2
- package/dist/cursor/widget-offset.d.ts +6 -0
- package/dist/cursor/widget-offset.js +61 -4
- package/dist/debug/interaction-trace.d.ts +4 -0
- package/dist/debug/interaction-trace.js +15 -0
- package/dist/decorations/decoration-state.svelte.js +1 -1
- package/dist/editor-actions/ancestry-folds.d.ts +2 -2
- package/dist/editor-actions/ancestry-folds.js +1 -1
- package/dist/editor-actions/block-edit-scope.js +1 -1
- package/dist/editor-actions/commit/text-batch.d.ts +3 -2
- package/dist/editor-actions/commit/text-batch.js +1 -1
- package/dist/editor-actions/commit/undo-controller.js +4 -2
- package/dist/editor-actions/container-edit.js +2 -1
- package/dist/editor-actions/enter-completion.d.ts +2 -0
- package/dist/editor-actions/enter-completion.js +23 -2
- package/dist/editor-actions/inline-range-commit.js +1 -1
- package/dist/editor-actions/reorder-action.js +19 -10
- package/dist/editor-actions/reorder-drag.js +29 -1
- package/dist/editor-actions/replacement-focus.d.ts +1 -1
- package/dist/editor-actions/replacement-focus.js +1 -1
- package/dist/editor-actions/search-replace.js +1 -1
- package/dist/editor-actions/table-context.d.ts +4 -1
- package/dist/editor-actions/table-context.js +57 -1
- package/dist/editor-events.d.ts +3 -0
- package/dist/editor-keys.d.ts +33 -0
- package/dist/editor-props.d.ts +21 -12
- package/dist/index.d.ts +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.js +11 -0
- package/dist/plugins/latex/BlockMath.svelte +264 -29
- package/dist/plugins/latex/BlockMath.svelte.d.ts +2 -0
- package/dist/plugins/latex/index.d.ts +2 -1
- package/dist/plugins/latex/latex-kind.js +36 -3
- package/dist/plugins/latex/math-completion.js +4 -1
- package/dist/plugins/latex/math-layout.d.ts +15 -0
- package/dist/plugins/latex/math-layout.js +13 -0
- package/dist/plugins/latex/math-source.d.ts +19 -0
- package/dist/plugins/latex/math-source.js +97 -0
- package/dist/plugins/latex/register.d.ts +11 -2
- package/dist/plugins/latex/register.js +3 -1
- package/dist/plugins/latex/renderer.d.ts +3 -3
- package/dist/plugins/latex/renderer.js +13 -6
- package/dist/reactivity/list-windowing.svelte.d.ts +8 -8
- package/dist/reactivity/list-windowing.svelte.js +49 -24
- package/dist/schema/block-completions.d.ts +8 -0
- package/dist/schema/block-completions.js +11 -0
- package/dist/schema/context-actions.d.ts +31 -0
- package/dist/schema/context-actions.js +23 -0
- package/dist/schema/fenced-code-raw.js +31 -1
- package/dist/schema/operations.d.ts +8 -1
- package/dist/schema/reserved-chords.js +25 -4
- package/dist/schema/table-cell-raw.d.ts +1 -1
- package/dist/schema/table-cell-raw.js +1 -1
- package/dist/selection/block-hit-test.js +3 -2
- package/dist/selection/char-endpoint-snap.js +1 -1
- package/dist/selection/clipboard-text.js +6 -1
- package/dist/selection/covered-block.d.ts +10 -0
- package/dist/selection/covered-block.js +24 -0
- package/dist/selection/cross-block/dispatch.d.ts +3 -0
- package/dist/selection/cross-block/dispatch.js +13 -1
- package/dist/selection/cross-block/format-range.d.ts +1 -1
- package/dist/selection/cross-block/format-range.js +4 -15
- package/dist/selection/cross-block/format-toggle.js +1 -1
- package/dist/selection/cross-block/keydown.js +1 -1
- package/dist/selection/cross-block/ops.js +1 -1
- package/dist/selection/cross-block/paste.js +32 -30
- package/dist/selection/cross-block/type-replace.d.ts +3 -2
- package/dist/selection/cross-block/type-replace.js +62 -13
- package/dist/selection/dead-space-caret.d.ts +10 -0
- package/dist/selection/dead-space-caret.js +47 -1
- package/dist/selection/double-click-trim.d.ts +17 -0
- package/dist/selection/double-click-trim.js +57 -0
- package/dist/selection/drag-pointer.d.ts +7 -2
- package/dist/selection/drag-pointer.js +61 -2
- package/dist/selection/gap-caret.js +1 -1
- package/dist/selection/keyboard-extend.js +1 -1
- package/dist/selection/path-lookup.js +1 -1
- package/dist/selection/range-delete-ceremony.js +4 -2
- package/dist/selection/range-delete-chrome.js +2 -1
- package/dist/selection/range-delete-table-coverage.js +2 -1
- package/dist/selection/range-delete-table.js +3 -2
- package/dist/selection/range-delete.js +30 -2
- package/dist/selection/selection-restore.js +1 -1
- package/dist/selection/selection-state.svelte.d.ts +6 -0
- package/dist/selection/selection-state.svelte.js +36 -1
- package/dist/selection/table-endpoint-snap.js +1 -1
- package/dist/selection/table-rect-extend.js +1 -1
- package/dist/styles/editor-theme.css +57 -28
- package/dist/styles/editor.css +217 -18
- package/dist/testing/container-conformance.js +2 -2
- package/dist/testing/inline-conformance.js +2 -1
- package/dist/tree-operations/blockquote.js +1 -1
- package/dist/tree-operations/chain-rebuild.d.ts +63 -0
- package/dist/tree-operations/chain-rebuild.js +142 -0
- package/dist/tree-operations/children.d.ts +1 -1
- package/dist/tree-operations/children.js +1 -1
- package/dist/tree-operations/cleanup.js +1 -1
- package/dist/tree-operations/content-write.d.ts +50 -0
- package/dist/tree-operations/content-write.js +263 -0
- package/dist/tree-operations/index.d.ts +8 -3
- package/dist/tree-operations/index.js +6 -2
- package/dist/tree-operations/list/exit-replacement.js +1 -1
- package/dist/tree-operations/list/unwrap-merge.js +3 -3
- package/dist/tree-operations/node-ops.d.ts +17 -234
- package/dist/tree-operations/node-ops.js +47 -1113
- package/dist/tree-operations/node-primitives.d.ts +75 -0
- package/dist/tree-operations/node-primitives.js +117 -0
- package/dist/tree-operations/paste/apply.js +1 -1
- package/dist/tree-operations/paste/body-write.d.ts +1 -1
- package/dist/tree-operations/paste/body-write.js +2 -2
- package/dist/tree-operations/paste/container-match.js +4 -2
- package/dist/tree-operations/paste/dispatch.js +2 -1
- package/dist/tree-operations/paste/find-enclosing-list.js +1 -1
- package/dist/tree-operations/paste/focus-target.d.ts +1 -1
- package/dist/tree-operations/paste/list-absorb.js +1 -1
- package/dist/tree-operations/paste/list-break-out.js +1 -1
- package/dist/tree-operations/paste/parent-scope.js +1 -1
- package/dist/tree-operations/paste/paste-replacement.js +1 -1
- package/dist/tree-operations/paste/replace-block-at-parent.js +1 -1
- package/dist/tree-operations/path-mutate.d.ts +1 -1
- package/dist/tree-operations/path-mutate.js +2 -1
- package/dist/tree-operations/reorder-unit.js +1 -1
- package/dist/tree-operations/reorder.d.ts +5 -2
- package/dist/tree-operations/reorder.js +55 -2
- package/dist/tree-operations/settle.d.ts +105 -0
- package/dist/tree-operations/settle.js +660 -0
- package/dist/tree-operations/table-grid-clipboard.d.ts +21 -0
- package/dist/tree-operations/table-grid-clipboard.js +90 -0
- package/dist/tree-operations/unshare.d.ts +15 -77
- package/dist/tree-operations/unshare.js +15 -166
- package/docs/guide/consumer-guide.md +126 -96
- package/docs/guide/plugin-api.md +31 -3
- package/docs/guide/plugin-guide.md +26 -3
- package/package.json +4 -2
- package/dist/components/blocks/code/CodeLanguageChip.svelte +0 -127
- package/dist/components/blocks/code/CodeLanguageChip.svelte.d.ts +0 -14
- package/dist/components/blocks/table/TableGrip.svelte +0 -91
- package/dist/components/blocks/table/TableGrip.svelte.d.ts +0 -8
- package/dist/components/blocks/table/table-drop-target.d.ts +0 -1
- package/dist/components/blocks/table/table-drop-target.js +0 -16
- package/dist/components/blocks/table/table-reorder-drag.d.ts +0 -78
- package/dist/components/blocks/table/table-reorder-drag.js +0 -97
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { tick } from 'svelte';
|
|
3
|
-
import { CODE_LANGUAGE_FIELD, codeLanguageLabel } from '../../../a11y-strings';
|
|
4
|
-
|
|
5
|
-
// The fence-info door for the modes that paint no fence. The draft lives here and only a
|
|
6
|
-
// commit reaches the tree.
|
|
7
|
-
let {
|
|
8
|
-
info,
|
|
9
|
-
editable,
|
|
10
|
-
onCommit,
|
|
11
|
-
onCancel
|
|
12
|
-
}: {
|
|
13
|
-
/** The opener's full info string; the button shows its first token. */
|
|
14
|
-
info: string;
|
|
15
|
-
/** False in reading mode, which writes no bytes — the chip is then a label. */
|
|
16
|
-
editable: boolean;
|
|
17
|
-
/** Only Enter calls this, and it owns the caret's landing afterwards. */
|
|
18
|
-
onCommit: (info: string) => void;
|
|
19
|
-
/** Nothing written. Escape asks for the caret back; a blur must not yank it from
|
|
20
|
-
* wherever the user just clicked, so it does not. */
|
|
21
|
-
onCancel: (returnCaret: boolean) => void;
|
|
22
|
-
} = $props();
|
|
23
|
-
|
|
24
|
-
const language = $derived(info.split(/\s+/)[0] || 'text');
|
|
25
|
-
|
|
26
|
-
let editing = $state(false);
|
|
27
|
-
let draft = $state('');
|
|
28
|
-
let inputEl: HTMLInputElement | undefined = $state();
|
|
29
|
-
|
|
30
|
-
function open(): void {
|
|
31
|
-
if (!editable) return;
|
|
32
|
-
draft = info;
|
|
33
|
-
editing = true;
|
|
34
|
-
void tick().then(() => {
|
|
35
|
-
inputEl?.focus();
|
|
36
|
-
inputEl?.select();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function onFieldKeyDown(e: KeyboardEvent): void {
|
|
41
|
-
// The field owns its keys while open: no Escape of this state may reach whatever else
|
|
42
|
-
// listens for one. A composing Enter/Escape is the IME's, never the field's.
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
if (e.isComposing) return;
|
|
45
|
-
if (e.key === 'Enter') {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
const committed = draft;
|
|
48
|
-
editing = false;
|
|
49
|
-
onCommit(committed);
|
|
50
|
-
} else if (e.key === 'Escape') {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
editing = false;
|
|
53
|
-
onCancel(true);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function onFieldBlur(): void {
|
|
58
|
-
if (!editing) return;
|
|
59
|
-
editing = false;
|
|
60
|
-
onCancel(false);
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<span class="code-lang-chip">
|
|
65
|
-
{#if editing}
|
|
66
|
-
<input
|
|
67
|
-
bind:this={inputEl}
|
|
68
|
-
bind:value={draft}
|
|
69
|
-
type="text"
|
|
70
|
-
spellcheck="false"
|
|
71
|
-
aria-label={CODE_LANGUAGE_FIELD}
|
|
72
|
-
onkeydown={onFieldKeyDown}
|
|
73
|
-
onfocusout={onFieldBlur}
|
|
74
|
-
/>
|
|
75
|
-
{:else}
|
|
76
|
-
<button type="button" aria-label={codeLanguageLabel(language)} onclick={open}>{language}</button
|
|
77
|
-
>
|
|
78
|
-
{/if}
|
|
79
|
-
</span>
|
|
80
|
-
|
|
81
|
-
<style>
|
|
82
|
-
/* Positioned against the block host, whose box the code box fills, and out of the code
|
|
83
|
-
box's own scroller so a horizontal scroll leaves it where it is. */
|
|
84
|
-
.code-lang-chip {
|
|
85
|
-
position: absolute;
|
|
86
|
-
top: 5px;
|
|
87
|
-
right: 5px;
|
|
88
|
-
z-index: 1;
|
|
89
|
-
display: flex;
|
|
90
|
-
font-family: var(--font-editor, ui-monospace, monospace);
|
|
91
|
-
font-size: 0.75em;
|
|
92
|
-
line-height: 1;
|
|
93
|
-
opacity: 0;
|
|
94
|
-
pointer-events: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Transient, like the drag handle: the pointer over the block or the caret inside it, plus
|
|
98
|
-
the open field, which outlives both. Child and sibling combinators, so an outer container's
|
|
99
|
-
hover never reveals a nested block's chip. */
|
|
100
|
-
:global(.block-host:hover) > .code-lang-chip,
|
|
101
|
-
:global(.code-block:focus) ~ .code-lang-chip,
|
|
102
|
-
.code-lang-chip:focus-within {
|
|
103
|
-
opacity: 1;
|
|
104
|
-
pointer-events: auto;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
button,
|
|
108
|
-
input {
|
|
109
|
-
padding: 2px 6px;
|
|
110
|
-
border: 1px solid var(--color-ui-muted, #a4a4a4);
|
|
111
|
-
border-radius: var(--radius-ui, 3px);
|
|
112
|
-
background: var(--color-bg-elevated, #2a2a2a);
|
|
113
|
-
color: var(--color-accent, #567b67);
|
|
114
|
-
font: inherit;
|
|
115
|
-
cursor: pointer;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
button:hover {
|
|
119
|
-
background: var(--color-ui-faint, rgba(255, 255, 255, 0.07));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
input {
|
|
123
|
-
width: 9ch;
|
|
124
|
-
color: var(--color-text-secondary, #eee);
|
|
125
|
-
cursor: text;
|
|
126
|
-
}
|
|
127
|
-
</style>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
/** The opener's full info string; the button shows its first token. */
|
|
3
|
-
info: string;
|
|
4
|
-
/** False in reading mode, which writes no bytes — the chip is then a label. */
|
|
5
|
-
editable: boolean;
|
|
6
|
-
/** Only Enter calls this, and it owns the caret's landing afterwards. */
|
|
7
|
-
onCommit: (info: string) => void;
|
|
8
|
-
/** Nothing written. Escape asks for the caret back; a blur must not yank it from
|
|
9
|
-
* wherever the user just clicked, so it does not. */
|
|
10
|
-
onCancel: (returnCaret: boolean) => void;
|
|
11
|
-
};
|
|
12
|
-
declare const CodeLanguageChip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
-
type CodeLanguageChip = ReturnType<typeof CodeLanguageChip>;
|
|
14
|
-
export default CodeLanguageChip;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let {
|
|
3
|
-
axis,
|
|
4
|
-
onActivate,
|
|
5
|
-
onpointerdown
|
|
6
|
-
}: {
|
|
7
|
-
axis: 'row' | 'column';
|
|
8
|
-
onActivate: (e: MouseEvent) => void;
|
|
9
|
-
onpointerdown?: (e: PointerEvent) => void;
|
|
10
|
-
} = $props();
|
|
11
|
-
|
|
12
|
-
function handlePointerDown(e: PointerEvent): void {
|
|
13
|
-
// The affordance opens a menu, it doesn't place a caret, so the grip's pointer
|
|
14
|
-
// stream stays off the editor's selection/focus handlers.
|
|
15
|
-
e.stopPropagation();
|
|
16
|
-
onpointerdown?.(e);
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<!-- Pointer-only affordance: the cell chords are the operable, screen-reader path, so the
|
|
21
|
-
grip stays out of the tab/SR flow. Reveal is pure CSS: hover in editor.css, touch below. -->
|
|
22
|
-
<span class="table-grip-anchor table-grip-anchor-{axis}">
|
|
23
|
-
<span
|
|
24
|
-
class="table-grip table-grip-{axis}"
|
|
25
|
-
data-table-col-grip={axis === 'column' ? '' : undefined}
|
|
26
|
-
data-table-row-grip={axis === 'row' ? '' : undefined}
|
|
27
|
-
aria-hidden="true"
|
|
28
|
-
onclick={onActivate}
|
|
29
|
-
onpointerdown={handlePointerDown}
|
|
30
|
-
></span>
|
|
31
|
-
</span>
|
|
32
|
-
|
|
33
|
-
<style>
|
|
34
|
-
/* Zero-height so it never adds a visible band or shifts caret-measured layout;
|
|
35
|
-
z-index lifts the dots above the DOM-later header cell, which would eat the click. */
|
|
36
|
-
.table-grip-anchor-column {
|
|
37
|
-
position: relative;
|
|
38
|
-
z-index: 2;
|
|
39
|
-
height: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* The dotted bar shared by both axes; the axis rules add only the geometry. */
|
|
43
|
-
.table-grip {
|
|
44
|
-
position: absolute;
|
|
45
|
-
color: var(--color-ui-muted, #a4a4a4);
|
|
46
|
-
background-image: radial-gradient(currentColor 40%, transparent 45%);
|
|
47
|
-
background-position: center;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
opacity: 0;
|
|
50
|
-
pointer-events: none;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* Sits within the header cell's top padding so it never overlaps the caret-click target. */
|
|
54
|
-
.table-grip-column {
|
|
55
|
-
top: 0;
|
|
56
|
-
left: 50%;
|
|
57
|
-
transform: translateX(-50%);
|
|
58
|
-
width: 1.75rem;
|
|
59
|
-
height: 0.35rem;
|
|
60
|
-
background-size: 0.25rem 0.35rem;
|
|
61
|
-
background-repeat: repeat-x;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* Zero-width gutter item, stretched to the row height. z-index lifts the dots above
|
|
65
|
-
cell A, which renders DOM-later and would otherwise paint over them. */
|
|
66
|
-
.table-grip-anchor-row {
|
|
67
|
-
position: relative;
|
|
68
|
-
z-index: 2;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* Overflows out of the zero-width gutter into cell A's left padding, clear of the text. */
|
|
72
|
-
.table-grip-row {
|
|
73
|
-
top: 50%;
|
|
74
|
-
left: 0.15rem;
|
|
75
|
-
transform: translateY(-50%);
|
|
76
|
-
width: 0.35rem;
|
|
77
|
-
height: 1rem;
|
|
78
|
-
background-size: 0.35rem 0.25rem;
|
|
79
|
-
background-repeat: repeat-y;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* Touch fires no hover, so the editor.css reveal never runs and an opted-in host's grips
|
|
83
|
-
would be unreachable. `touch-action` keeps a reorder drag off the table's own scroll. */
|
|
84
|
-
@media (hover: none) {
|
|
85
|
-
.table-grip {
|
|
86
|
-
opacity: 1;
|
|
87
|
-
pointer-events: auto;
|
|
88
|
-
touch-action: none;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
</style>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
axis: 'row' | 'column';
|
|
3
|
-
onActivate: (e: MouseEvent) => void;
|
|
4
|
-
onpointerdown?: (e: PointerEvent) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const TableGrip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type TableGrip = ReturnType<typeof TableGrip>;
|
|
8
|
-
export default TableGrip;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dropGapIndex(pointer: number, edges: number[]): number;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Map a reorder drag's pointer to the insertion gap it sits nearest. `edges` are the
|
|
2
|
-
// row/column boundaries in pointer space, so N tracks yield N+1 edges. The result is a
|
|
3
|
-
// gap index, not the occupied cell `table-drag-hit-test` returns.
|
|
4
|
-
export function dropGapIndex(pointer, edges) {
|
|
5
|
-
let nearest = 0;
|
|
6
|
-
let nearestDistance = Infinity;
|
|
7
|
-
for (let i = 0; i < edges.length; i++) {
|
|
8
|
-
const distance = Math.abs(pointer - edges[i]);
|
|
9
|
-
// Strict `<` keeps the lower gap when the pointer is exactly equidistant.
|
|
10
|
-
if (distance < nearestDistance) {
|
|
11
|
-
nearest = i;
|
|
12
|
-
nearestDistance = distance;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return nearest;
|
|
16
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pointer drag-to-reorder for table rows and columns: a shared drag session paints a single
|
|
3
|
-
* insertion line (no tree mutation, no reflow) and commits ONE move on release. The axes diverge
|
|
4
|
-
* only in geometry — rows are windowed under a fixed header, so their indices are absolute and
|
|
5
|
-
* off-window targets need autoscroll to mount; columns are neither.
|
|
6
|
-
*/
|
|
7
|
-
import type { UserScrollport } from '../../../cursor/scroll-ancestors';
|
|
8
|
-
import { type PointerPosition } from '../../../selection/pointer-session';
|
|
9
|
-
/** Members every reorder-axis context shares; the row/column contexts extend it. */
|
|
10
|
-
interface AxisReorderDragContext<TLine> {
|
|
11
|
-
/** The editor's scrollport, which in host mode may be an ancestor or the window. */
|
|
12
|
-
getScrollContainer(): UserScrollport | null;
|
|
13
|
-
setLine(line: TLine | null): void;
|
|
14
|
-
/** Marks the gesture a drag (not a click) so the grip's menu stays closed. */
|
|
15
|
-
onDragRecognized(): void;
|
|
16
|
-
commit(from: number, to: number): void;
|
|
17
|
-
/** Aborted on editor unmount — tears down a drag whose pointerup can't fire. */
|
|
18
|
-
lifetimeSignal?: AbortSignal;
|
|
19
|
-
}
|
|
20
|
-
export interface TableReorderDragContext<TLine> extends AxisReorderDragContext<TLine> {
|
|
21
|
-
from: number;
|
|
22
|
-
/**
|
|
23
|
-
* Pure per-axis map from the live pointer to the insertion line and clamped drop
|
|
24
|
-
* index (null when geometry is unavailable). Returns rather than sets, so the axis
|
|
25
|
-
* clamps stay unit-testable in isolation.
|
|
26
|
-
*/
|
|
27
|
-
process(pointer: PointerPosition): {
|
|
28
|
-
line: TLine;
|
|
29
|
-
dropTo: number;
|
|
30
|
-
} | null;
|
|
31
|
-
/** The autoscroll axis only — rows scroll both ways, a wide table's columns horizontally. */
|
|
32
|
-
autoScrollAxis: 'horizontal' | 'vertical' | 'both';
|
|
33
|
-
}
|
|
34
|
-
export declare function startTableReorderDrag<TLine>(down: PointerEvent, ctx: TableReorderDragContext<TLine>): void;
|
|
35
|
-
export interface RowReorderLine {
|
|
36
|
-
left: number;
|
|
37
|
-
top: number;
|
|
38
|
-
width: number;
|
|
39
|
-
}
|
|
40
|
-
export interface RowReorderGeometry {
|
|
41
|
-
/** Viewport-Y boundaries of the mounted rows: each row's top, plus the last row's bottom. */
|
|
42
|
-
rowEdges: number[];
|
|
43
|
-
/**
|
|
44
|
-
* Absolute gap index for each `rowEdges` entry, so a drop maps a local edge to a
|
|
45
|
-
* body position even once the window has scrolled past row 0.
|
|
46
|
-
*/
|
|
47
|
-
gapIndices: number[];
|
|
48
|
-
/** Viewport-left and width of the table, for the insertion line's horizontal span. */
|
|
49
|
-
left: number;
|
|
50
|
-
width: number;
|
|
51
|
-
}
|
|
52
|
-
export interface RowReorderDragContext extends AxisReorderDragContext<RowReorderLine> {
|
|
53
|
-
fromRowIdx: number;
|
|
54
|
-
/** Live total row count — read each move so the header clamp tracks edits/re-slices. */
|
|
55
|
-
getRowCount(): number;
|
|
56
|
-
getGeometry(): RowReorderGeometry | null;
|
|
57
|
-
}
|
|
58
|
-
export declare function startRowReorderDrag(down: PointerEvent, ctx: RowReorderDragContext): void;
|
|
59
|
-
export interface ColumnReorderLine {
|
|
60
|
-
left: number;
|
|
61
|
-
top: number;
|
|
62
|
-
height: number;
|
|
63
|
-
}
|
|
64
|
-
export interface ColumnReorderGeometry {
|
|
65
|
-
/** Viewport-X boundaries of the columns: each column's left, plus the last column's right. */
|
|
66
|
-
colEdges: number[];
|
|
67
|
-
/** Viewport-top and height of the table, for the insertion line's vertical span. */
|
|
68
|
-
top: number;
|
|
69
|
-
height: number;
|
|
70
|
-
}
|
|
71
|
-
export interface ColumnReorderDragContext extends AxisReorderDragContext<ColumnReorderLine> {
|
|
72
|
-
fromColIdx: number;
|
|
73
|
-
/** Live total column count — read each move so the clamp tracks edits. */
|
|
74
|
-
getColCount(): number;
|
|
75
|
-
getGeometry(): ColumnReorderGeometry | null;
|
|
76
|
-
}
|
|
77
|
-
export declare function startColumnReorderDrag(down: PointerEvent, ctx: ColumnReorderDragContext): void;
|
|
78
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pointer drag-to-reorder for table rows and columns: a shared drag session paints a single
|
|
3
|
-
* insertion line (no tree mutation, no reflow) and commits ONE move on release. The axes diverge
|
|
4
|
-
* only in geometry — rows are windowed under a fixed header, so their indices are absolute and
|
|
5
|
-
* off-window targets need autoscroll to mount; columns are neither.
|
|
6
|
-
*/
|
|
7
|
-
import { dropGapIndex } from './table-drop-target';
|
|
8
|
-
import { createPointerDragSession } from '../../../selection/pointer-session';
|
|
9
|
-
// Past this much pointer travel the gesture is a drag, not a menu-opening click.
|
|
10
|
-
const DRAG_THRESHOLD_PX = 4;
|
|
11
|
-
export function startTableReorderDrag(down, ctx) {
|
|
12
|
-
let dragging = false;
|
|
13
|
-
let dropTo = null;
|
|
14
|
-
createPointerDragSession(down, {
|
|
15
|
-
threshold: DRAG_THRESHOLD_PX,
|
|
16
|
-
onDragRecognized: () => {
|
|
17
|
-
dragging = true;
|
|
18
|
-
ctx.onDragRecognized();
|
|
19
|
-
},
|
|
20
|
-
onMove: (pointer) => {
|
|
21
|
-
const result = ctx.process(pointer);
|
|
22
|
-
if (!result)
|
|
23
|
-
return;
|
|
24
|
-
dropTo = result.dropTo;
|
|
25
|
-
ctx.setLine(result.line);
|
|
26
|
-
},
|
|
27
|
-
// A sub-threshold press is a menu-opening click, not a reorder.
|
|
28
|
-
onEnd: (reason) => {
|
|
29
|
-
if (reason === 'up' && dragging && dropTo !== null && dropTo !== ctx.from) {
|
|
30
|
-
ctx.commit(ctx.from, dropTo);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
onTeardown: () => ctx.setLine(null),
|
|
34
|
-
autoScroll: {
|
|
35
|
-
axis: ctx.autoScrollAxis,
|
|
36
|
-
getTargets: () => {
|
|
37
|
-
const sc = ctx.getScrollContainer();
|
|
38
|
-
return sc ? [sc] : [];
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
escape: true,
|
|
42
|
-
// Up front, not at threshold: a native text selection can begin from the empty
|
|
43
|
-
// grip before the first qualifying move and survive the drag.
|
|
44
|
-
disableUserSelect: true,
|
|
45
|
-
lifetimeSignal: ctx.lifetimeSignal
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
export function startRowReorderDrag(down, ctx) {
|
|
49
|
-
startTableReorderDrag(down, {
|
|
50
|
-
from: ctx.fromRowIdx,
|
|
51
|
-
autoScrollAxis: 'both',
|
|
52
|
-
getScrollContainer: ctx.getScrollContainer,
|
|
53
|
-
setLine: ctx.setLine,
|
|
54
|
-
onDragRecognized: ctx.onDragRecognized,
|
|
55
|
-
commit: ctx.commit,
|
|
56
|
-
lifetimeSignal: ctx.lifetimeSignal,
|
|
57
|
-
process(pointer) {
|
|
58
|
-
const geom = ctx.getGeometry();
|
|
59
|
-
if (!geom)
|
|
60
|
-
return null;
|
|
61
|
-
// The LOCAL edge among mounted rows; gapIndices maps it to the absolute gap.
|
|
62
|
-
let edge = dropGapIndex(pointer.clientY, geom.rowEdges);
|
|
63
|
-
// Never land above the fixed header (gap 0); reachable only while row 0 is mounted.
|
|
64
|
-
if (geom.gapIndices[edge] < 1)
|
|
65
|
-
edge = Math.min(edge + 1, geom.gapIndices.length - 1);
|
|
66
|
-
const gap = geom.gapIndices[edge];
|
|
67
|
-
// Insert semantics: removing the dragged row shifts later slots down by one.
|
|
68
|
-
const target = gap <= ctx.fromRowIdx ? gap : gap - 1;
|
|
69
|
-
const dropTo = Math.max(1, Math.min(target, ctx.getRowCount() - 1));
|
|
70
|
-
return { line: { left: geom.left, top: geom.rowEdges[edge], width: geom.width }, dropTo };
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export function startColumnReorderDrag(down, ctx) {
|
|
75
|
-
startTableReorderDrag(down, {
|
|
76
|
-
from: ctx.fromColIdx,
|
|
77
|
-
// Pinned in the table's top band; vertical evaluation would spin the loop on a
|
|
78
|
-
// `.table-block` that only scrolls horizontally (autoscroll.ts § axis).
|
|
79
|
-
autoScrollAxis: 'horizontal',
|
|
80
|
-
getScrollContainer: ctx.getScrollContainer,
|
|
81
|
-
setLine: ctx.setLine,
|
|
82
|
-
onDragRecognized: ctx.onDragRecognized,
|
|
83
|
-
commit: ctx.commit,
|
|
84
|
-
lifetimeSignal: ctx.lifetimeSignal,
|
|
85
|
-
process(pointer) {
|
|
86
|
-
const geom = ctx.getGeometry();
|
|
87
|
-
if (!geom)
|
|
88
|
-
return null;
|
|
89
|
-
// Columns aren't windowed and have no header, so the edge index IS the drop gap.
|
|
90
|
-
const gap = dropGapIndex(pointer.clientX, geom.colEdges);
|
|
91
|
-
// Insert semantics: removing the dragged column shifts later slots left by one.
|
|
92
|
-
const target = gap <= ctx.fromColIdx ? gap : gap - 1;
|
|
93
|
-
const dropTo = Math.max(0, Math.min(target, ctx.getColCount() - 1));
|
|
94
|
-
return { line: { left: geom.colEdges[gap], top: geom.top, height: geom.height }, dropTo };
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|