@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
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* `createPointerDragSession`, whose document-level listeners deliver events even after the
|
|
4
4
|
* pointer leaves the originating block.
|
|
5
5
|
*/
|
|
6
|
-
import { applyCollapsedCaret } from './native-bridge';
|
|
6
|
+
import { applyCollapsedCaret, applySingleBlockRange, clearNativeSelection } from './native-bridge';
|
|
7
|
+
import { isWholeBlockEndpoint } from './primitives';
|
|
7
8
|
import { comparePaths } from './path-math';
|
|
8
9
|
import { createPointerDragSession } from './pointer-session';
|
|
9
10
|
import { blockNearPoint } from './nearest-block';
|
|
@@ -18,24 +19,74 @@ export function installDragListener(ctx, anchorPoint, down) {
|
|
|
18
19
|
if (!near)
|
|
19
20
|
return;
|
|
20
21
|
if (comparePaths(near.path, anchorPoint.path) === 0) {
|
|
22
|
+
if (!('offset' in anchorPoint)) {
|
|
23
|
+
if (ctx.paintSameBlock)
|
|
24
|
+
takeAnchorBlockWhole();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
21
27
|
if (ctx.selection.isCrossBlock) {
|
|
22
28
|
// Pointer returned to the anchor block: collapse so the overlay stops painting a
|
|
23
29
|
// stale remote range. The browser's drag has been extending the native selection
|
|
24
30
|
// underneath all along, so handing back gives the right single-block highlight.
|
|
25
31
|
ctx.selection.collapse();
|
|
26
32
|
}
|
|
33
|
+
if (ctx.paintSameBlock)
|
|
34
|
+
paintSameBlockRange(near.endpointHere());
|
|
27
35
|
return;
|
|
28
36
|
}
|
|
29
37
|
const focusPoint = near.endpointHere();
|
|
30
38
|
if (!focusPoint)
|
|
31
39
|
return;
|
|
32
|
-
if (!
|
|
40
|
+
if (isWholeBlockEndpoint(focusPoint) && !reachedCentreLine(near.path, clientY))
|
|
41
|
+
return;
|
|
42
|
+
// A whole unit re-enters rather than extends: its anchor's side is resolved against the
|
|
43
|
+
// new focus by the entry, where an extend would keep the unit's start as the anchor.
|
|
44
|
+
if (!ctx.selection.isCrossBlock || ctx.selection.wholeUnitPath) {
|
|
33
45
|
ctx.selection.enterCrossBlock(anchorPoint, focusPoint);
|
|
34
46
|
}
|
|
35
47
|
else {
|
|
36
48
|
ctx.selection.extendFocus(focusPoint);
|
|
37
49
|
}
|
|
38
50
|
}
|
|
51
|
+
// A block with no positions inside it is in or out as a unit, and the unit joins the range
|
|
52
|
+
// once the pointer has crossed its centre line coming from the anchor's side: a sweep that
|
|
53
|
+
// merely touched its edge has not asked for it. Not reached, the last focus stands, so the
|
|
54
|
+
// range grows to the block only when the pointer commits to it.
|
|
55
|
+
function reachedCentreLine(path, clientY) {
|
|
56
|
+
const box = ctx.getBlockElByPath(path)?.getBoundingClientRect();
|
|
57
|
+
if (!box)
|
|
58
|
+
return true;
|
|
59
|
+
const middle = box.top + box.height / 2;
|
|
60
|
+
return comparePaths(anchorPoint.path, path) < 0 ? clientY >= middle : clientY <= middle;
|
|
61
|
+
}
|
|
62
|
+
// A whole-block anchor (a table, an equation) has nothing to paint natively either, and a range
|
|
63
|
+
// that only appears once the pointer reaches ANOTHER block reads as a drag that does nothing.
|
|
64
|
+
// The block is taken whole the moment the pointer moves, as the unit the state stores and the
|
|
65
|
+
// overlay paints (`wholeUnitPath`); a pointer returning from outside takes it whole again.
|
|
66
|
+
function takeAnchorBlockWhole() {
|
|
67
|
+
if (ctx.selection.wholeUnitPath)
|
|
68
|
+
return;
|
|
69
|
+
// Both ends whole: the pointer's position INSIDE the block is not a rectangle to grow (a
|
|
70
|
+
// press beside a table dragged up over it would otherwise select the rows below the
|
|
71
|
+
// pointer, the opposite of the sweep). The block is the unit until the drag leaves it.
|
|
72
|
+
ctx.selection.enterCrossBlock(anchorPoint, {
|
|
73
|
+
path: anchorPoint.path.slice(),
|
|
74
|
+
wholeBlock: true
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// A margin-started drag has no native selection under it, so the range inside the anchor
|
|
78
|
+
// block is written here, and the block takes focus so the range is live for the next key.
|
|
79
|
+
function paintSameBlockRange(focusPoint) {
|
|
80
|
+
if (!focusPoint || !('offset' in focusPoint) || !('offset' in anchorPoint))
|
|
81
|
+
return;
|
|
82
|
+
const blockEl = ctx.getBlockElByPath(anchorPoint.path);
|
|
83
|
+
if (!blockEl)
|
|
84
|
+
return;
|
|
85
|
+
// A no-op once it holds focus; the range is a DOM Range, so it is written low-to-high (a
|
|
86
|
+
// drag from the right margin leftward would otherwise collapse it).
|
|
87
|
+
blockEl.focus({ preventScroll: true });
|
|
88
|
+
applySingleBlockRange(blockEl, Math.min(anchorPoint.offset, focusPoint.offset), Math.max(anchorPoint.offset, focusPoint.offset));
|
|
89
|
+
}
|
|
39
90
|
// Pointer may land on a scrollable element directly (the table's `.table-block` edge), so
|
|
40
91
|
// search from `target` itself, not its parent.
|
|
41
92
|
function scrollableSelfOrAncestor(target) {
|
|
@@ -79,6 +130,14 @@ function parkCaretInFocusBlock(ctx) {
|
|
|
79
130
|
const focus = ctx.selection.focus;
|
|
80
131
|
if (!focus)
|
|
81
132
|
return;
|
|
133
|
+
// A whole unit has no text node for a caret: focus parks on the editor root, whose keydown
|
|
134
|
+
// and clipboard arms serve a custom range (as they do for a windowed-out block), with no
|
|
135
|
+
// native range left behind for the browser to act on.
|
|
136
|
+
if (ctx.selection.wholeUnitPath) {
|
|
137
|
+
clearNativeSelection();
|
|
138
|
+
ctx.editorRoot.focus({ preventScroll: true });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
82
141
|
// A drag ending inside a table leaves a focus addressing the table block by cell index; the
|
|
83
142
|
// landing is the cell that actually holds a caret.
|
|
84
143
|
const landing = ctx.selection.cellLandingFor(focus);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* in, boolean out; `tryGapStop` is the one seam that turns it into an arrival.
|
|
5
5
|
* The gap is deliberately not a `SelectionPoint`: it is never a cross-block endpoint.
|
|
6
6
|
*/
|
|
7
|
-
import { isBlockNode, nodeAt } from '../tree-operations/node-
|
|
7
|
+
import { isBlockNode, nodeAt } from '../tree-operations/node-primitives';
|
|
8
8
|
import { tryGetBlockKindDescriptor } from '../schema/block-kind-descriptor';
|
|
9
9
|
import { isReadingMode } from '../presentation-mode';
|
|
10
10
|
import { placeGapCaret } from './caret-doors';
|
|
@@ -3,7 +3,7 @@ import { isVerticallyTransparentNode } from '../core/inline/transparency';
|
|
|
3
3
|
import { readNativeCaretInBlock, applyCollapsedCaret, focusCollapsedCaret, applySingleBlockRange, clearNativeSelection } from './native-bridge';
|
|
4
4
|
import { offsetFromViewportPoint } from '../cursor/point-offset';
|
|
5
5
|
import { nextPath, previousPath, firstPath, lastPath, firstLeafAtOrAfter, lastLeafAtOrBefore, findCellPathForElement } from './path-lookup';
|
|
6
|
-
import { nodeAt } from '../tree-operations/node-
|
|
6
|
+
import { nodeAt } from '../tree-operations/node-primitives';
|
|
7
7
|
import { comparePaths, isStrictAncestorOf, pathsEqual } from './path-math';
|
|
8
8
|
import { displayLength } from '../core/lines';
|
|
9
9
|
// ── Enter / Collapse / Scroll ──────────────────────────────────────────────
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Document-tree path navigation. Pure functions over a Document + path. */
|
|
2
|
-
import { nodeAt } from '../tree-operations/node-
|
|
2
|
+
import { nodeAt } from '../tree-operations/node-primitives';
|
|
3
3
|
/** Block immediately after `path` in doc order (children before siblings), else null. */
|
|
4
4
|
export function nextPath(doc, path) {
|
|
5
5
|
const node = nodeAt(doc, path);
|
|
@@ -10,8 +10,10 @@ import { charOffsetOf, walkBetween } from './primitives';
|
|
|
10
10
|
import { comparePaths, isStrictAncestorOf, isPathSubtreeBetween, lowestCommonAncestor, pathHasPrefix, pathsEqual } from './path-math';
|
|
11
11
|
import { cascadeCleanupEmptyAncestors } from '../tree-operations/cleanup';
|
|
12
12
|
import { deleteAtPath, replaceAtPath } from '../tree-operations/path-mutate';
|
|
13
|
-
import { blockNodeAt,
|
|
14
|
-
import {
|
|
13
|
+
import { blockNodeAt, emptyParagraph, nodeAt, normalizeOwnRaw } from '../tree-operations/node-primitives';
|
|
14
|
+
import { cleanJoinedRaw } from '../tree-operations/node-ops';
|
|
15
|
+
import { ensureUnsharedPath } from '../tree-operations/unshare';
|
|
16
|
+
import { rebuildUnsharedAncestry, rebuildUnsharedChain } from '../tree-operations/chain-rebuild';
|
|
15
17
|
// Wall primitives live with the chrome branch, which imports the atoms below back. The
|
|
16
18
|
// resulting cycle is function-body-only (resolved at call time, never at module load), so it
|
|
17
19
|
// is safe.
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { displayLength } from '../core/lines';
|
|
8
8
|
import { comparePaths, pathsEqual } from './path-math';
|
|
9
9
|
import { resolveEndWall, planCrossBlockDeletion, applyPlannedDeletion, truncateEndInPlace, truncateStartInPlace } from './range-delete-ceremony';
|
|
10
|
-
import { ensureUnsharedPath
|
|
10
|
+
import { ensureUnsharedPath } from '../tree-operations/unshare';
|
|
11
|
+
import { rebuildUnsharedChain } from '../tree-operations/chain-rebuild';
|
|
11
12
|
import { reservedChromeKindOf, isReservedChromeChild } from '../schema/reserved-chrome';
|
|
12
13
|
// ── Public API ──────────────────────────────────────────────────────────────
|
|
13
14
|
/**
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { deleteSnapshot } from './primitives';
|
|
7
7
|
import { metadataOf } from '../core/nodes';
|
|
8
|
-
import {
|
|
8
|
+
import { emptyParagraph } from '../tree-operations/node-primitives';
|
|
9
|
+
import { deleteNode } from '../tree-operations/settle';
|
|
9
10
|
import { trailingLineEnding } from '../core/lines';
|
|
10
11
|
import { expectStateForNode, getStateForNode } from '../reactivity/state-registry';
|
|
11
12
|
import { deleteRow as mutDeleteRow, deleteColumn as mutDeleteColumn, canDeleteRow, canDeleteColumn } from '../tree-operations/table-mutations';
|
|
@@ -11,8 +11,9 @@ import { cellRowCol } from '../cursor/coordinate-spaces';
|
|
|
11
11
|
import { cellIndexOf } from './primitives';
|
|
12
12
|
import { resolveEndWall, planCrossBlockDeletion, applyPlannedDeletion, rebuildSharedAncestries, truncateEndInPlace, truncateStartInPlace } from './range-delete-ceremony';
|
|
13
13
|
import { comparePaths } from './path-math';
|
|
14
|
-
import { blockNodeAt, emptyParagraph } from '../tree-operations/node-
|
|
15
|
-
import { ensureUnsharedNode, ensureUnsharedPath, ensureUnsharedSubtree, rebuildOwnedContainer
|
|
14
|
+
import { blockNodeAt, emptyParagraph } from '../tree-operations/node-primitives';
|
|
15
|
+
import { ensureUnsharedNode, ensureUnsharedPath, ensureUnsharedSubtree, rebuildOwnedContainer } from '../tree-operations/unshare';
|
|
16
|
+
import { rebuildUnsharedAncestry } from '../tree-operations/chain-rebuild';
|
|
16
17
|
import { rebuildTableRowRaw } from '../schema/container-rebuilders';
|
|
17
18
|
import { isCollapsedContainer } from '../schema/reserved-chrome';
|
|
18
19
|
import { nearestChromeContainer, isChromeChild } from './range-delete-chrome';
|
|
@@ -7,11 +7,30 @@ import { metadataOf } from '../core/nodes';
|
|
|
7
7
|
import { walkBetween, charOffsetOf } from './primitives';
|
|
8
8
|
import { comparePaths, lowestCommonAncestor, isPathSubtreeBetween } from './path-math';
|
|
9
9
|
import { firstLeafAtOrAfter } from './path-lookup';
|
|
10
|
-
import { blockNodeAt,
|
|
10
|
+
import { blockNodeAt, nodeAt, normalizeBodyWrite, normalizeOwnRaw, writeOwnRaw } from '../tree-operations/node-primitives';
|
|
11
|
+
import { settleSeparatorOnBlank } from '../tree-operations/settle';
|
|
12
|
+
import { isBlankParagraph } from '../core/parser';
|
|
13
|
+
import { displayLength } from '../core/lines';
|
|
14
|
+
import { deleteAtPath } from '../tree-operations/path-mutate';
|
|
15
|
+
import { cleanJoinedRaw } from '../tree-operations/node-ops';
|
|
11
16
|
import { deleteSubtreesIdentityGated, installTruncatedEndpoint, reparseTruncatedEndpoint } from './range-delete-ceremony';
|
|
12
|
-
import { ensureUnsharedNode, ensureUnsharedPath
|
|
17
|
+
import { ensureUnsharedNode, ensureUnsharedPath } from '../tree-operations/unshare';
|
|
18
|
+
import { rebuildUnsharedAncestry, rebuildUnsharedChain } from '../tree-operations/chain-rebuild';
|
|
13
19
|
import { involvesTable, tableAwareRangeDelete } from './range-delete-table';
|
|
14
20
|
import { involvesReservedChrome, chromeAwareRangeDelete } from './range-delete-chrome';
|
|
21
|
+
/** Whoever takes the slot gets the caret, at its start; the block above when nothing does. */
|
|
22
|
+
function deleteWholeUnit(doc, path, sharing, grammar) {
|
|
23
|
+
const parentPath = path.slice(0, -1);
|
|
24
|
+
const index = path[path.length - 1];
|
|
25
|
+
// The path-addressed door, so the commit's id ledger sees the slot go.
|
|
26
|
+
const chain = ensureUnsharedPath(doc, parentPath, sharing);
|
|
27
|
+
deleteAtPath(doc, path, sharing);
|
|
28
|
+
if (chain.length > 0)
|
|
29
|
+
rebuildUnsharedChain(doc, chain, sharing, null, grammar);
|
|
30
|
+
const survivors = (chain.length > 0 ? chain[chain.length - 1] : doc).children ?? [];
|
|
31
|
+
const landing = Math.max(0, Math.min(index, survivors.length - 1));
|
|
32
|
+
return { newDoc: doc, collapsedCaret: { path: [...parentPath, landing], offset: 0 } };
|
|
33
|
+
}
|
|
15
34
|
/**
|
|
16
35
|
* Delete [start, end] in place, merge at start's position with its container context preserved,
|
|
17
36
|
* cascade-clean empty ancestors, rebuild container raws. Copy-path-on-write: every spliced or
|
|
@@ -38,6 +57,15 @@ export function rangeDelete(doc, start, end, sharing, grammar, presentationMode,
|
|
|
38
57
|
const endRaw = endBlock.raw;
|
|
39
58
|
const startOffset = charOffsetOf(start, 'rangeDelete:prose-merge-start');
|
|
40
59
|
const endOffset = charOffsetOf(end, 'rangeDelete:prose-merge-end');
|
|
60
|
+
// The range holds one block whole, so none of its own bytes survive: the byte arm below would
|
|
61
|
+
// keep a husk holding a bare line ending, which no reload reads as that kind. A paragraph is
|
|
62
|
+
// the one kind that survives empty, because a blank one IS the separating line below it.
|
|
63
|
+
if (sameBlock &&
|
|
64
|
+
startOffset === 0 &&
|
|
65
|
+
endOffset >= displayLength(startRaw) &&
|
|
66
|
+
!isBlankParagraph({ kind: startBlock.kind, raw: '' })) {
|
|
67
|
+
return deleteWholeUnit(doc, start.path, sharing, grammar);
|
|
68
|
+
}
|
|
41
69
|
// The end slice answers to the END block's rule before the join: start's rule below speaks
|
|
42
70
|
// only for start's bytes, so a truncation from the end block's head strands its closer. A
|
|
43
71
|
// same-block merge is one block's bytes and takes that rule once, whole, on the arm below.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* can't be carried by only one. A gap caret takes {@link restoreGapCaret}, the same road minus
|
|
6
6
|
* the endpoint pair.
|
|
7
7
|
*/
|
|
8
|
-
import { isBlockNode, nodeAt } from '../tree-operations/node-
|
|
8
|
+
import { isBlockNode, nodeAt } from '../tree-operations/node-primitives';
|
|
9
9
|
import { applySelectionToDom } from './native-bridge';
|
|
10
10
|
import { placeGapCaret } from './caret-doors';
|
|
11
11
|
import { gapScopeChildren } from './gap-caret';
|
|
@@ -34,6 +34,12 @@ export interface SelectionState {
|
|
|
34
34
|
readonly selectAllCount: number;
|
|
35
35
|
/** The third mode: a collapsed caret in a between-blocks boundary (`gap-caret.ts`). */
|
|
36
36
|
readonly gapCaret: GapCaretPosition | null;
|
|
37
|
+
/**
|
|
38
|
+
* One block taken whole as the entire range — a press on a surface-less leaf (an equation)
|
|
39
|
+
* dragged inside it. The stored pair spans the block's bytes on a shared path, which the
|
|
40
|
+
* same-path guard would otherwise refuse, so the overlay reads this to paint it as a unit.
|
|
41
|
+
*/
|
|
42
|
+
readonly wholeUnitPath: number[] | null;
|
|
37
43
|
enterCrossBlock(anchor: SelectionEndpoint, focus: SelectionEndpoint): void;
|
|
38
44
|
extendFocus(point: SelectionEndpoint): void;
|
|
39
45
|
collapse(): void;
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* native browser selection rules, and the two are mutually exclusive here rather than at any
|
|
5
5
|
* call site. Transitions: `docs/design/editor.md` § Cross-block selection.
|
|
6
6
|
*/
|
|
7
|
-
import { nodeAt } from '../tree-operations/node-
|
|
7
|
+
import { nodeAt } from '../tree-operations/node-primitives';
|
|
8
8
|
import { isWholeBlockEndpoint, normalize } from './primitives';
|
|
9
9
|
import { cellEndpointDeepPath, normalizeTableEndpoint, snapCrossBlockTableEndpoints } from './table-endpoint-snap';
|
|
10
10
|
import { normalizeCharEndpoint } from './char-endpoint-snap';
|
|
11
11
|
import { pathsEqual } from './path-math';
|
|
12
|
+
import { displayLength } from '../core/lines';
|
|
12
13
|
import { assertInvariant } from '../assert';
|
|
13
14
|
import { checkCrossBlockEndpointCoordinates } from '../invariants/selection-endpoints';
|
|
14
15
|
export function createSelectionState(options) {
|
|
@@ -19,6 +20,7 @@ class SelectionStateImpl {
|
|
|
19
20
|
#anchor = $state(null);
|
|
20
21
|
#focus = $state(null);
|
|
21
22
|
#gapCaret = $state(null);
|
|
23
|
+
#wholeUnit = $state(null);
|
|
22
24
|
#selectAllCount = $state(0);
|
|
23
25
|
#onChange;
|
|
24
26
|
#getDoc;
|
|
@@ -63,6 +65,9 @@ class SelectionStateImpl {
|
|
|
63
65
|
get isCrossBlock() {
|
|
64
66
|
return this.#anchor !== null && this.#focus !== null;
|
|
65
67
|
}
|
|
68
|
+
get wholeUnitPath() {
|
|
69
|
+
return this.#wholeUnit?.slice() ?? null;
|
|
70
|
+
}
|
|
66
71
|
get isCustomRendered() {
|
|
67
72
|
const getDoc = this.#getDoc;
|
|
68
73
|
if (!getDoc)
|
|
@@ -71,6 +76,8 @@ class SelectionStateImpl {
|
|
|
71
76
|
const focus = this.#focus;
|
|
72
77
|
if (!anchor || !focus)
|
|
73
78
|
return false;
|
|
79
|
+
if (this.#wholeUnit)
|
|
80
|
+
return true;
|
|
74
81
|
if (!pathsEqual(anchor.path, focus.path))
|
|
75
82
|
return true;
|
|
76
83
|
if (anchor.offset === focus.offset)
|
|
@@ -102,6 +109,19 @@ class SelectionStateImpl {
|
|
|
102
109
|
}
|
|
103
110
|
enterCrossBlock(anchor, focus) {
|
|
104
111
|
this.#gapCaret = null;
|
|
112
|
+
// Both ends the same surface-less block: the unit itself is the range, stored as its full
|
|
113
|
+
// byte span and flagged, since below a same-path pair is refused as prose.
|
|
114
|
+
if (isWholeBlockEndpoint(anchor) &&
|
|
115
|
+
isWholeBlockEndpoint(focus) &&
|
|
116
|
+
pathsEqual(anchor.path, focus.path)) {
|
|
117
|
+
const path = anchor.path.slice();
|
|
118
|
+
this.#anchor = { path, offset: 0 };
|
|
119
|
+
this.#focus = { path: path.slice(), offset: this.#byteLengthAt(path) };
|
|
120
|
+
this.#wholeUnit = path.slice();
|
|
121
|
+
this.#notify();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.#wholeUnit = null;
|
|
105
125
|
const a = this.#normalizePoint(anchor, focus.path);
|
|
106
126
|
const f = this.#normalizePoint(focus, anchor.path);
|
|
107
127
|
// A same-path prose pair is a single-block range the browser owns; storing it mints an
|
|
@@ -124,6 +144,13 @@ class SelectionStateImpl {
|
|
|
124
144
|
throw new Error('SelectionState.extendFocus called without an anchor');
|
|
125
145
|
}
|
|
126
146
|
this.#gapCaret = null;
|
|
147
|
+
// Leaving a whole unit: its anchor is the block as a whole again, so the side it means
|
|
148
|
+
// (start below the new focus, end above it) is resolved afresh rather than kept at 0.
|
|
149
|
+
if (this.#wholeUnit) {
|
|
150
|
+
const unit = { path: this.#wholeUnit, wholeBlock: true };
|
|
151
|
+
this.#anchor = this.#normalizePoint(unit, point.path);
|
|
152
|
+
this.#wholeUnit = null;
|
|
153
|
+
}
|
|
127
154
|
const f = this.#normalizePoint(point, this.#anchor.path);
|
|
128
155
|
// A focus back on the anchor's prose leaf contracts to a single-block range. No
|
|
129
156
|
// `offset !== offset` guard, unlike #isSamePathProseRange: extendFocus never seeds, so
|
|
@@ -142,6 +169,11 @@ class SelectionStateImpl {
|
|
|
142
169
|
}
|
|
143
170
|
// G1.29 at the storing seam, the belt behind #normalizePoint: both entries carry it because
|
|
144
171
|
// both store an endpoint pair.
|
|
172
|
+
#byteLengthAt(path) {
|
|
173
|
+
const doc = this.#getDoc?.();
|
|
174
|
+
const node = doc ? nodeAt(doc, path) : null;
|
|
175
|
+
return node && 'raw' in node ? displayLength(node.raw) : 0;
|
|
176
|
+
}
|
|
145
177
|
#assertEndpointCoordinates(anchor, focus) {
|
|
146
178
|
const getDoc = this.#getDoc;
|
|
147
179
|
if (!getDoc)
|
|
@@ -177,6 +209,7 @@ class SelectionStateImpl {
|
|
|
177
209
|
this.#anchor = null;
|
|
178
210
|
this.#focus = null;
|
|
179
211
|
this.#gapCaret = null;
|
|
212
|
+
this.#wholeUnit = null;
|
|
180
213
|
this.#notify();
|
|
181
214
|
}
|
|
182
215
|
clear() {
|
|
@@ -185,6 +218,7 @@ class SelectionStateImpl {
|
|
|
185
218
|
this.#anchor = null;
|
|
186
219
|
this.#focus = null;
|
|
187
220
|
this.#gapCaret = null;
|
|
221
|
+
this.#wholeUnit = null;
|
|
188
222
|
this.#selectAllCount = 0;
|
|
189
223
|
this.#notify();
|
|
190
224
|
}
|
|
@@ -198,6 +232,7 @@ class SelectionStateImpl {
|
|
|
198
232
|
setGapCaret(pos) {
|
|
199
233
|
this.#anchor = null;
|
|
200
234
|
this.#focus = null;
|
|
235
|
+
this.#wholeUnit = null;
|
|
201
236
|
this.#gapCaret = { parentPath: pos.parentPath.slice(), index: pos.index };
|
|
202
237
|
this.#notify();
|
|
203
238
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* An intra-table pair is deliberately left unsnapped, so rectangular sub-cell selection survives.
|
|
6
6
|
*/
|
|
7
7
|
import { metadataOf } from '../core/nodes';
|
|
8
|
-
import { isBlockNode, nodeAt } from '../tree-operations/node-
|
|
8
|
+
import { isBlockNode, nodeAt } from '../tree-operations/node-primitives';
|
|
9
9
|
import { cellIndexOf } from './primitives';
|
|
10
10
|
import { asCellIndex, cellRowCol } from '../cursor/coordinate-spaces';
|
|
11
11
|
import { comparePaths, pathHasPrefix } from './path-math';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* horizontal extension clamps at the column edges, since a rectangle has no sideways exit.
|
|
6
6
|
*/
|
|
7
7
|
import { metadataOf } from '../core/nodes';
|
|
8
|
-
import { isBlockNode, nodeAt } from '../tree-operations/node-
|
|
8
|
+
import { isBlockNode, nodeAt } from '../tree-operations/node-primitives';
|
|
9
9
|
import { cellRowCol } from '../cursor/coordinate-spaces';
|
|
10
10
|
import { pathsEqual } from './path-math';
|
|
11
11
|
/**
|
|
@@ -9,40 +9,51 @@
|
|
|
9
9
|
/* ── Host-chrome tier: the consumer's vocabulary, defaults behind the class ── */
|
|
10
10
|
|
|
11
11
|
:where(.aragonite-editor-theme) {
|
|
12
|
+
/* Two faces, because they answer different questions. `--font-editor` is the SURFACE
|
|
13
|
+
face — prose, headings, markers — and a host may legitimately set it proportional.
|
|
14
|
+
`--font-code` is what must stay monospace whatever that choice is: code blocks, code
|
|
15
|
+
spans, raw HTML, revealed source. Defaulted to the same stack, so a consumer that
|
|
16
|
+
never names the second one sees exactly what it saw before. */
|
|
12
17
|
--font-editor: 'Cascadia Code', 'Cascadia Mono', 'Consolas', ui-monospace, monospace;
|
|
18
|
+
--font-code: 'Cascadia Code', 'Cascadia Mono', 'Consolas', ui-monospace, monospace;
|
|
19
|
+
/* The menus' and popovers' face: the host's own UI font where it names one. */
|
|
20
|
+
--font-ui: 'Inter', system-ui, sans-serif;
|
|
13
21
|
/* Type-scale root: headings, code and markers are all `em`-relative, so one override
|
|
14
22
|
scales the surface. A themed host sets it on any ancestor instead. */
|
|
15
23
|
--editor-font-size: 1rem;
|
|
16
24
|
|
|
17
25
|
/* Corner radii by role: small controls (buttons, inputs, chips) and elevated surfaces
|
|
18
26
|
(overlays, popovers). Chrome whose corner is neither keeps its own literal. */
|
|
19
|
-
--radius-ui:
|
|
27
|
+
--radius-ui: 4px;
|
|
20
28
|
--radius-surface: 8px;
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
--color-
|
|
24
|
-
--color-
|
|
25
|
-
--color-
|
|
26
|
-
--color-
|
|
27
|
-
--color-
|
|
28
|
-
|
|
29
|
-
--color-
|
|
30
|
+
/* The page ground, which the menus and the image toolbar paint on. */
|
|
31
|
+
--color-bg: #2c2c2a;
|
|
32
|
+
--color-surface: #1a1a19;
|
|
33
|
+
--color-text-secondary: #cfcfca;
|
|
34
|
+
--color-text-primary: #e8e8e5;
|
|
35
|
+
--color-border: #3e3e3b;
|
|
36
|
+
--color-ui-muted: #8f8f89;
|
|
37
|
+
--color-ui-dulled: #a3a39d;
|
|
38
|
+
--color-accent: #567b67;
|
|
30
39
|
/* Base the selection, search-match and reorder washes derive from, so one declaration
|
|
31
|
-
moves all of them; the washes themselves stay editor-owned.
|
|
32
|
-
|
|
33
|
-
--color-
|
|
40
|
+
moves all of them; the washes themselves stay editor-owned. Tracking the accent means
|
|
41
|
+
a host that recolors one recolors all four. */
|
|
42
|
+
--color-selection: var(--color-accent, #567b67);
|
|
43
|
+
--color-error: #ff5f57;
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
:where(.aragonite-editor-theme)[data-editor-theme='light'] {
|
|
37
|
-
--color-
|
|
38
|
-
--color-
|
|
39
|
-
--color-text-
|
|
40
|
-
--color-
|
|
41
|
-
--color-
|
|
42
|
-
--color-ui-
|
|
43
|
-
--color-
|
|
44
|
-
--color-
|
|
45
|
-
--color-
|
|
47
|
+
--color-bg: #dfddd7;
|
|
48
|
+
--color-surface: #efeee9;
|
|
49
|
+
--color-text-secondary: #4a4a45;
|
|
50
|
+
--color-text-primary: #2a2a27;
|
|
51
|
+
--color-border: #c9c7c0;
|
|
52
|
+
--color-ui-muted: #83837b;
|
|
53
|
+
--color-ui-dulled: #71716a;
|
|
54
|
+
--color-accent: #567b67;
|
|
55
|
+
--color-selection: var(--color-accent, #567b67);
|
|
56
|
+
--color-error: #d03025;
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
/* ── Editor-owned tier: defaults on `.editor`, so they hold with or without the class ── */
|
|
@@ -69,7 +80,10 @@
|
|
|
69
80
|
--syntax-code: currentColor;
|
|
70
81
|
--syntax-comment: currentColor;
|
|
71
82
|
--syntax-list: currentColor;
|
|
72
|
-
|
|
83
|
+
/* The rendered rule's colour, and its ONLY consumer. A divider separates rather than
|
|
84
|
+
announces, so it defaults to the border token; mid-grey at this weight competed with
|
|
85
|
+
the text either side. A host that wants a louder rule still names this token. */
|
|
86
|
+
--syntax-separator: var(--color-border, #3e3e3b);
|
|
73
87
|
--syntax-task: currentColor;
|
|
74
88
|
--syntax-task-done: rgba(128, 128, 128, 0.7);
|
|
75
89
|
|
|
@@ -114,35 +128,50 @@
|
|
|
114
128
|
--reorder-scope-bg: color-mix(in srgb, var(--color-selection, #6496ff) 14%, transparent);
|
|
115
129
|
--syntax-marker-dim: 0.65;
|
|
116
130
|
|
|
131
|
+
/* Menu/popout elevation, per mode: a shadow tuned for a near-black surface is invisible
|
|
132
|
+
over a white one. Editor-owned rather than host-family, since a host palette names
|
|
133
|
+
colors, not elevation. */
|
|
134
|
+
--menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
|
|
135
|
+
/* The rest of the host app's menu family, so a menu here is the host's menu to the pixel. */
|
|
136
|
+
--menu-item-hover: rgba(255, 255, 255, 0.07);
|
|
137
|
+
--menu-search-divider: rgba(255, 255, 255, 0.08);
|
|
138
|
+
--menu-scrollbar-thumb: rgba(255, 255, 255, 0.18);
|
|
139
|
+
--menu-scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
|
|
140
|
+
|
|
117
141
|
/* Placeholder tint behind off-window content (VR-8), so a spacer that outruns the
|
|
118
142
|
window recompute reads as "loading" rather than a white tear. */
|
|
119
143
|
--vr-spacer-bg: rgba(255, 255, 255, 0.025);
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
:where(.editor, .aragonite-editor-theme)[data-editor-theme='light'] {
|
|
123
|
-
--color-bg-secondary: rgba(0, 0, 0, 0.
|
|
147
|
+
--color-bg-secondary: rgba(0, 0, 0, 0.035);
|
|
124
148
|
--color-bg-elevated: #f5f6f8;
|
|
125
149
|
--color-bg-muted: #eaeaea;
|
|
126
150
|
--color-text-muted: #57606a;
|
|
127
151
|
--color-ui-faint: rgba(0, 0, 0, 0.06);
|
|
152
|
+
--menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
|
|
153
|
+
--menu-item-hover: rgba(0, 0, 0, 0.05);
|
|
154
|
+
--menu-search-divider: rgba(0, 0, 0, 0.07);
|
|
155
|
+
--menu-scrollbar-thumb: rgba(0, 0, 0, 0.2);
|
|
156
|
+
--menu-scrollbar-thumb-hover: rgba(0, 0, 0, 0.32);
|
|
128
157
|
|
|
129
158
|
/* --syntax-* tokens are mode-independent — no light overrides. */
|
|
130
159
|
|
|
131
160
|
/* Code block syntax highlighting — GitHub Light-inspired palette */
|
|
132
|
-
--code-tok-keyword: #
|
|
161
|
+
--code-tok-keyword: #c1202b;
|
|
133
162
|
--code-tok-string: #0a3069;
|
|
134
163
|
--code-tok-number: #0550ae;
|
|
135
164
|
--code-tok-literal: #0550ae;
|
|
136
|
-
--code-tok-comment: #
|
|
165
|
+
--code-tok-comment: #5c646d;
|
|
137
166
|
--code-tok-type: #953800;
|
|
138
|
-
--code-tok-function: #
|
|
139
|
-
--code-tok-operator: #
|
|
167
|
+
--code-tok-function: #7447c6;
|
|
168
|
+
--code-tok-operator: #c1202b;
|
|
140
169
|
--code-tok-meta: #953800;
|
|
141
170
|
--code-tok-attr: #116329;
|
|
142
171
|
--code-tok-regexp: #116329;
|
|
143
172
|
--code-tok-symbol: #0550ae;
|
|
144
173
|
--code-tok-added: #116329;
|
|
145
|
-
--code-tok-removed: #
|
|
174
|
+
--code-tok-removed: #c1202b;
|
|
146
175
|
--code-tok-heading: #0550ae;
|
|
147
176
|
--code-tok-link: #0550ae;
|
|
148
177
|
|