@voithos-labs/aragonite 0.10.2 → 0.10.4
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 +19 -0
- package/dist/a11y-strings.js +19 -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 +37 -24
- package/dist/components/BlockHost.svelte +18 -11
- package/dist/components/Editor.svelte +434 -198
- package/dist/components/Editor.svelte.d.ts +1 -1
- package/dist/components/SelectionOverlay.svelte +25 -17
- package/dist/components/SelectionOverlay.svelte.d.ts +1 -1
- 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 +704 -0
- package/dist/components/blocks/code/CodeBlockRail.svelte.d.ts +26 -0
- package/dist/components/blocks/code/code-bootstrap.js +16 -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 +22 -3
- 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 +248 -30
- package/dist/components/blocks/editable-surface.d.ts +9 -0
- package/dist/components/blocks/editable-surface.js +22 -3
- package/dist/components/blocks/list/ListBlock.svelte +1 -0
- package/dist/components/blocks/list/ListItemBlock.svelte +14 -5
- package/dist/components/blocks/list/ListItemBlock.svelte.d.ts +2 -0
- 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/click-snap-guard.d.ts +3 -0
- package/dist/components/blocks/text/click-snap-guard.js +8 -0
- 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 +89 -20
- package/dist/components/blocks/text/live-selection-edit.d.ts +5 -5
- package/dist/components/blocks/text/live-selection-edit.js +37 -7
- package/dist/components/blocks/text/text-clipboard.js +2 -2
- 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 +181 -37
- package/dist/components/drag-handle.d.ts +41 -0
- package/dist/components/drag-handle.js +134 -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 +3 -6
- package/dist/components/editor-root-listeners.js +3 -24
- 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 +67 -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/SelectionToolbar.svelte +385 -0
- package/dist/components/menu/SelectionToolbar.svelte.d.ts +16 -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 +19 -0
- package/dist/core/inline/inline-widgets.js +5 -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/transparency.js +3 -3
- 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/height-oracle.d.ts +2 -3
- package/dist/cursor/height-oracle.js +0 -1
- package/dist/cursor/overlay-remeasure.js +8 -0
- package/dist/cursor/reveal-source.js +7 -2
- package/dist/cursor/scroll-hold.d.ts +10 -0
- package/dist/cursor/scroll-hold.js +22 -0
- package/dist/cursor/scrollport.d.ts +9 -0
- package/dist/cursor/scrollport.js +30 -1
- package/dist/cursor/visual-lines.d.ts +5 -4
- package/dist/cursor/visual-lines.js +56 -11
- package/dist/cursor/widget-edge-snap.d.ts +28 -0
- package/dist/cursor/widget-edge-snap.js +38 -0
- package/dist/cursor/widget-offset.d.ts +9 -0
- package/dist/cursor/widget-offset.js +71 -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/decorations/reserved-attrs.js +1 -0
- 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/focus/focus-dispatch.js +7 -4
- package/dist/editor-actions/focus/focus-landing.d.ts +10 -1
- package/dist/editor-actions/focus/focus-landing.js +20 -6
- package/dist/editor-actions/inline-range-commit.js +1 -1
- package/dist/editor-actions/plugin/container.d.ts +7 -0
- package/dist/editor-actions/plugin/container.js +3 -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 +24 -12
- package/dist/index.d.ts +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.js +16 -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 +60 -10
- 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 +103 -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/plugins/mermaid/MermaidBlock.svelte +19 -9
- package/dist/plugins/parrot/ParrotBlock.svelte +3 -1
- package/dist/reactivity/list-windowing.svelte.d.ts +8 -8
- package/dist/reactivity/list-windowing.svelte.js +75 -30
- package/dist/schema/block-completions.d.ts +8 -0
- package/dist/schema/block-completions.js +11 -0
- package/dist/schema/commands.d.ts +9 -5
- package/dist/schema/commands.js +12 -7
- 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 +37 -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 +3 -29
- package/dist/selection/cross-block/ops.js +1 -1
- package/dist/selection/cross-block/paste.js +31 -35
- package/dist/selection/cross-block/type-replace.d.ts +3 -2
- package/dist/selection/cross-block/type-replace.js +52 -13
- package/dist/selection/dead-space-caret.d.ts +13 -0
- package/dist/selection/dead-space-caret.js +57 -1
- package/dist/selection/drag-pointer.d.ts +26 -2
- package/dist/selection/drag-pointer.js +103 -2
- package/dist/selection/gap-caret.js +1 -1
- package/dist/selection/keyboard-extend.d.ts +3 -2
- package/dist/selection/keyboard-extend.js +4 -3
- package/dist/selection/multi-click.d.ts +42 -0
- package/dist/selection/multi-click.js +203 -0
- package/dist/selection/native-bridge.d.ts +3 -0
- package/dist/selection/native-bridge.js +31 -2
- package/dist/selection/path-lookup.d.ts +10 -2
- package/dist/selection/path-lookup.js +11 -4
- package/dist/selection/pointer-gesture.d.ts +9 -0
- package/dist/selection/pointer-gesture.js +11 -0
- package/dist/selection/primitives.d.ts +7 -0
- package/dist/selection/primitives.js +19 -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.d.ts +4 -0
- package/dist/selection/range-delete.js +31 -3
- package/dist/selection/selection-drop.d.ts +34 -0
- package/dist/selection/selection-drop.js +253 -0
- 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 +75 -31
- package/dist/styles/editor.css +268 -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.d.ts +3 -1
- package/dist/tree-operations/paste/replace-block-at-parent.js +5 -2
- package/dist/tree-operations/paste/replacement-parse.d.ts +17 -0
- package/dist/tree-operations/paste/replacement-parse.js +22 -0
- 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 +136 -104
- package/docs/guide/plugin-api.md +73 -29
- package/docs/guide/plugin-guide.md +55 -23
- package/package.json +9 -7
- 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
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* A limestone-styled list menu the editor opens at a point: the block picker behind the
|
|
4
|
+
* bottom `+` (rows insert Markdown at the caret) and a block's context menu (rows run that
|
|
5
|
+
* kind's registered actions). Pointer- and keyboard-driven without ever taking focus, so the
|
|
6
|
+
* caret it acts on stays exactly where it is.
|
|
7
|
+
*/
|
|
8
|
+
import { isPluginInstalled } from '../../schema/plugin-install';
|
|
9
|
+
import type { MenuIconName } from './MenuIcon.svelte';
|
|
10
|
+
|
|
11
|
+
interface BlockMenuItem {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
icon: MenuIconName;
|
|
15
|
+
md: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MenuEntry {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: MenuIconName;
|
|
22
|
+
danger?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** A separator row; nothing else on the entry is read. */
|
|
25
|
+
divider?: boolean;
|
|
26
|
+
/** A flyout: hover or ArrowRight opens these beside the row; a pick is one of THEIR ids. */
|
|
27
|
+
children?: MenuEntry[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Blocks that stand on their own when empty. A heading is not one — it is text turned into a
|
|
31
|
+
// heading, which the selection popover offers — so it is deliberately not here.
|
|
32
|
+
const BUILT_IN: readonly BlockMenuItem[] = [
|
|
33
|
+
{ id: 'bullet', label: 'Bulleted list', icon: 'list', md: '- ' },
|
|
34
|
+
{ id: 'numbered', label: 'Numbered list', icon: 'list-ordered', md: '1. ' },
|
|
35
|
+
{ id: 'todo', label: 'To-do list', icon: 'square-check', md: '- [ ] ' },
|
|
36
|
+
{ id: 'quote', label: 'Quote', icon: 'text-quote', md: '> ' },
|
|
37
|
+
{ id: 'divider', label: 'Divider', icon: 'minus', md: '---\n' },
|
|
38
|
+
{ id: 'code', label: 'Code block', icon: 'code', md: '```\n\n```\n' },
|
|
39
|
+
{
|
|
40
|
+
id: 'table',
|
|
41
|
+
label: 'Table',
|
|
42
|
+
icon: 'table',
|
|
43
|
+
md: '| Column | Column |\n| --- | --- |\n| | |\n'
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
// Listed only while the plugin that reads the syntax is installed.
|
|
47
|
+
const FROM_PLUGINS: readonly { plugin: string; item: BlockMenuItem }[] = [
|
|
48
|
+
{ plugin: 'latex', item: { id: 'math', label: 'Math block', icon: 'sigma', md: '$$\n\n$$\n' } },
|
|
49
|
+
{
|
|
50
|
+
plugin: 'admonitions',
|
|
51
|
+
item: { id: 'note', label: 'Note', icon: 'info', md: ':::note\n\n:::\n' }
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
/** Every insertable block, keyed by id, for resolving a pick from either level of the menu. */
|
|
56
|
+
export function insertSnippets(): Map<string, string> {
|
|
57
|
+
const all = [
|
|
58
|
+
...BUILT_IN,
|
|
59
|
+
...FROM_PLUGINS.filter((entry) => isPluginInstalled(entry.plugin)).map((entry) => entry.item)
|
|
60
|
+
];
|
|
61
|
+
return new Map(all.map((item) => [item.id, item.md]));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Every insertable block as one flat list, for a flyout that is already a level down. */
|
|
65
|
+
export function insertFlyoutEntries(): MenuEntry[] {
|
|
66
|
+
return [
|
|
67
|
+
...BUILT_IN,
|
|
68
|
+
...FROM_PLUGINS.filter((entry) => isPluginInstalled(entry.plugin)).map((entry) => entry.item)
|
|
69
|
+
].map(({ id, label, icon }) => ({ id, label, icon }));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const COMMON = new Set(['bullet', 'numbered', 'todo', 'code', 'table', 'math']);
|
|
73
|
+
|
|
74
|
+
/** The insert menu: the common blocks, the rest behind "More blocks". */
|
|
75
|
+
export function insertMenuEntries(): MenuEntry[] {
|
|
76
|
+
const all = [
|
|
77
|
+
...BUILT_IN,
|
|
78
|
+
...FROM_PLUGINS.filter((entry) => isPluginInstalled(entry.plugin)).map((entry) => entry.item)
|
|
79
|
+
];
|
|
80
|
+
const row = ({ id, label, icon }: BlockMenuItem): MenuEntry => ({ id, label, icon });
|
|
81
|
+
const common = all.filter((item) => COMMON.has(item.id)).map(row);
|
|
82
|
+
const more = all.filter((item) => !COMMON.has(item.id)).map(row);
|
|
83
|
+
return more.length
|
|
84
|
+
? [...common, { id: 'more', label: 'More blocks', icon: 'plus', children: more }]
|
|
85
|
+
: common;
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<script lang="ts">
|
|
90
|
+
import { clampMenuToViewport } from '../blocks/table/table-menu-model';
|
|
91
|
+
import { BLOCK_MENU_LABEL } from '../../a11y-strings';
|
|
92
|
+
import { keepFlyoutOnScreen } from './flyout-placement';
|
|
93
|
+
import MenuIcon from './MenuIcon.svelte';
|
|
94
|
+
|
|
95
|
+
let {
|
|
96
|
+
x,
|
|
97
|
+
y,
|
|
98
|
+
anchor,
|
|
99
|
+
items,
|
|
100
|
+
label = BLOCK_MENU_LABEL,
|
|
101
|
+
onPick,
|
|
102
|
+
onClose
|
|
103
|
+
}: {
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
/** Where the open point is NOW, re-read on scroll and resize so the menu stays on it. */
|
|
107
|
+
anchor?: () => { x: number; y: number } | null;
|
|
108
|
+
items: MenuEntry[];
|
|
109
|
+
label?: string;
|
|
110
|
+
onPick: (id: string) => void;
|
|
111
|
+
onClose: () => void;
|
|
112
|
+
} = $props();
|
|
113
|
+
|
|
114
|
+
let menuEl: HTMLDivElement | undefined = $state();
|
|
115
|
+
let activeIndex = $state(0);
|
|
116
|
+
/** The open flyout: the index of its parent row, and the active child inside it. */
|
|
117
|
+
let flyout = $state<{ row: number; child: number } | null>(null);
|
|
118
|
+
const selectable = $derived(items.map((item, i) => (item.divider || item.disabled ? -1 : i)));
|
|
119
|
+
function step(from: number, delta: number): number {
|
|
120
|
+
const n = items.length;
|
|
121
|
+
let i = from;
|
|
122
|
+
for (let k = 0; k < n; k++) {
|
|
123
|
+
i = (i + delta + n) % n;
|
|
124
|
+
if (selectable[i] !== -1) return i;
|
|
125
|
+
}
|
|
126
|
+
return from;
|
|
127
|
+
}
|
|
128
|
+
function pick(entry: MenuEntry): void {
|
|
129
|
+
if (entry.disabled || entry.divider) return;
|
|
130
|
+
if (entry.children) {
|
|
131
|
+
flyout = { row: items.indexOf(entry), child: 0 };
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
onPick(entry.id);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Same anchoring as the table's menu: follows the content, clamped once when first sized.
|
|
138
|
+
// svelte-ignore state_referenced_locally
|
|
139
|
+
let at = $state({ x, y });
|
|
140
|
+
let shift = $state<{ x: number; y: number } | null>(null);
|
|
141
|
+
$effect(() => {
|
|
142
|
+
const follow = () => {
|
|
143
|
+
const next = anchor?.();
|
|
144
|
+
if (next) at = next;
|
|
145
|
+
};
|
|
146
|
+
window.addEventListener('scroll', follow, { capture: true, passive: true });
|
|
147
|
+
window.addEventListener('resize', follow, { passive: true });
|
|
148
|
+
return () => {
|
|
149
|
+
window.removeEventListener('scroll', follow, { capture: true });
|
|
150
|
+
window.removeEventListener('resize', follow);
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
$effect(() => {
|
|
154
|
+
if (!menuEl || shift) return;
|
|
155
|
+
const rect = menuEl.getBoundingClientRect();
|
|
156
|
+
const clamped = clampMenuToViewport(
|
|
157
|
+
{ x, y },
|
|
158
|
+
{ width: rect.width, height: rect.height },
|
|
159
|
+
{ width: window.innerWidth, height: window.innerHeight }
|
|
160
|
+
);
|
|
161
|
+
shift = { x: clamped.x - x, y: clamped.y - y };
|
|
162
|
+
});
|
|
163
|
+
const left = $derived(at.x + (shift?.x ?? 0));
|
|
164
|
+
const top = $derived(at.y + (shift?.y ?? 0));
|
|
165
|
+
|
|
166
|
+
// Keys are read at the document, capture phase: the caret's surface keeps focus, and the
|
|
167
|
+
// menu answers first while it is open. Anything it does not claim reaches the editor as usual.
|
|
168
|
+
$effect(() => {
|
|
169
|
+
const onPointerDown = (e: PointerEvent) => {
|
|
170
|
+
if (menuEl && e.target instanceof Node && menuEl.contains(e.target)) return;
|
|
171
|
+
onClose();
|
|
172
|
+
};
|
|
173
|
+
// Claimed keys stop here: the caret's surface would otherwise take the same press (an
|
|
174
|
+
// Enter splitting the block the menu is about to insert into).
|
|
175
|
+
const claim = (e: KeyboardEvent) => {
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
e.stopImmediatePropagation();
|
|
178
|
+
};
|
|
179
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
180
|
+
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
181
|
+
const open = flyout;
|
|
182
|
+
const children = open ? (items[open.row].children ?? []) : [];
|
|
183
|
+
switch (e.key) {
|
|
184
|
+
case 'Escape':
|
|
185
|
+
claim(e);
|
|
186
|
+
if (open) flyout = null;
|
|
187
|
+
else onClose();
|
|
188
|
+
return;
|
|
189
|
+
case 'ArrowDown':
|
|
190
|
+
case 'ArrowUp': {
|
|
191
|
+
claim(e);
|
|
192
|
+
const delta = e.key === 'ArrowDown' ? 1 : -1;
|
|
193
|
+
if (open)
|
|
194
|
+
flyout = { ...open, child: (open.child + delta + children.length) % children.length };
|
|
195
|
+
else activeIndex = step(activeIndex, delta);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
case 'ArrowRight':
|
|
199
|
+
if (items[activeIndex]?.children) {
|
|
200
|
+
claim(e);
|
|
201
|
+
flyout = { row: activeIndex, child: 0 };
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
case 'ArrowLeft':
|
|
205
|
+
if (open) {
|
|
206
|
+
claim(e);
|
|
207
|
+
flyout = null;
|
|
208
|
+
}
|
|
209
|
+
return;
|
|
210
|
+
case 'Enter':
|
|
211
|
+
claim(e);
|
|
212
|
+
if (open) onPick(children[open.child].id);
|
|
213
|
+
else pick(items[activeIndex]);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
218
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
219
|
+
return () => {
|
|
220
|
+
document.removeEventListener('pointerdown', onPointerDown, true);
|
|
221
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<div
|
|
227
|
+
bind:this={menuEl}
|
|
228
|
+
class="md-menu block-menu"
|
|
229
|
+
role="menu"
|
|
230
|
+
aria-label={label}
|
|
231
|
+
style:left="{left}px"
|
|
232
|
+
style:top="{top}px"
|
|
233
|
+
>
|
|
234
|
+
{#each items as item, i (item.id)}
|
|
235
|
+
{#if item.divider}
|
|
236
|
+
<div class="md-menu-divider" role="separator"></div>
|
|
237
|
+
{:else}
|
|
238
|
+
<div class="block-menu-row" role="presentation">
|
|
239
|
+
<button
|
|
240
|
+
type="button"
|
|
241
|
+
role="menuitem"
|
|
242
|
+
tabindex="-1"
|
|
243
|
+
class="md-menu-item block-menu-item"
|
|
244
|
+
class:block-menu-danger={item.danger}
|
|
245
|
+
disabled={item.disabled}
|
|
246
|
+
data-active={i === activeIndex ? 'true' : undefined}
|
|
247
|
+
data-testid="block-menu-{item.id}"
|
|
248
|
+
aria-haspopup={item.children ? 'menu' : undefined}
|
|
249
|
+
aria-expanded={item.children ? flyout?.row === i : undefined}
|
|
250
|
+
onmousedown={(e) => e.preventDefault()}
|
|
251
|
+
onpointerenter={() => {
|
|
252
|
+
activeIndex = i;
|
|
253
|
+
flyout = item.children ? { row: i, child: 0 } : null;
|
|
254
|
+
}}
|
|
255
|
+
onclick={() => pick(item)}
|
|
256
|
+
>
|
|
257
|
+
{#if item.icon}<span class="md-menu-icon"><MenuIcon name={item.icon} /></span>{/if}
|
|
258
|
+
<span class="block-menu-label">{item.label}</span>
|
|
259
|
+
{#if item.children}<span class="md-menu-icon"
|
|
260
|
+
><MenuIcon name="chevron-right" size={13} /></span
|
|
261
|
+
>{/if}
|
|
262
|
+
</button>
|
|
263
|
+
{#if item.children && flyout?.row === i}
|
|
264
|
+
<div
|
|
265
|
+
class="md-menu block-menu block-menu-flyout"
|
|
266
|
+
role="menu"
|
|
267
|
+
{@attach keepFlyoutOnScreen}
|
|
268
|
+
>
|
|
269
|
+
{#each item.children as child, j (child.id)}
|
|
270
|
+
<button
|
|
271
|
+
type="button"
|
|
272
|
+
role="menuitem"
|
|
273
|
+
tabindex="-1"
|
|
274
|
+
class="md-menu-item block-menu-item"
|
|
275
|
+
data-active={flyout.child === j ? 'true' : undefined}
|
|
276
|
+
data-testid="block-menu-{child.id}"
|
|
277
|
+
onmousedown={(e) => e.preventDefault()}
|
|
278
|
+
onpointerenter={() => (flyout = { row: i, child: j })}
|
|
279
|
+
onclick={() => onPick(child.id)}
|
|
280
|
+
>
|
|
281
|
+
{#if child.icon}<span class="md-menu-icon"><MenuIcon name={child.icon} /></span
|
|
282
|
+
>{/if}
|
|
283
|
+
<span class="block-menu-label">{child.label}</span>
|
|
284
|
+
</button>
|
|
285
|
+
{/each}
|
|
286
|
+
</div>
|
|
287
|
+
{/if}
|
|
288
|
+
</div>
|
|
289
|
+
{/if}
|
|
290
|
+
{/each}
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<style>
|
|
294
|
+
/* Surface and rows are the shared `.md-menu` family (editor.css). */
|
|
295
|
+
.block-menu {
|
|
296
|
+
min-width: 188px;
|
|
297
|
+
}
|
|
298
|
+
.block-menu-row {
|
|
299
|
+
position: relative;
|
|
300
|
+
}
|
|
301
|
+
.block-menu-label {
|
|
302
|
+
flex: 1;
|
|
303
|
+
}
|
|
304
|
+
/* limestone's submenu: a second surface hung off the row's right edge. */
|
|
305
|
+
.block-menu-flyout {
|
|
306
|
+
position: absolute;
|
|
307
|
+
left: 100%;
|
|
308
|
+
top: -4px;
|
|
309
|
+
margin-left: 4px;
|
|
310
|
+
}
|
|
311
|
+
.block-menu-danger,
|
|
312
|
+
.block-menu-danger .md-menu-icon {
|
|
313
|
+
color: var(--color-error, #d03025);
|
|
314
|
+
}
|
|
315
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MenuIconName } from './MenuIcon.svelte';
|
|
2
|
+
export interface MenuEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: MenuIconName;
|
|
6
|
+
danger?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** A separator row; nothing else on the entry is read. */
|
|
9
|
+
divider?: boolean;
|
|
10
|
+
/** A flyout: hover or ArrowRight opens these beside the row; a pick is one of THEIR ids. */
|
|
11
|
+
children?: MenuEntry[];
|
|
12
|
+
}
|
|
13
|
+
/** Every insertable block, keyed by id, for resolving a pick from either level of the menu. */
|
|
14
|
+
export declare function insertSnippets(): Map<string, string>;
|
|
15
|
+
/** Every insertable block as one flat list, for a flyout that is already a level down. */
|
|
16
|
+
export declare function insertFlyoutEntries(): MenuEntry[];
|
|
17
|
+
/** The insert menu: the common blocks, the rest behind "More blocks". */
|
|
18
|
+
export declare function insertMenuEntries(): MenuEntry[];
|
|
19
|
+
type $$ComponentProps = {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
/** Where the open point is NOW, re-read on scroll and resize so the menu stays on it. */
|
|
23
|
+
anchor?: () => {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | null;
|
|
27
|
+
items: MenuEntry[];
|
|
28
|
+
label?: string;
|
|
29
|
+
onPick: (id: string) => void;
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
};
|
|
32
|
+
declare const BlockMenu: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
33
|
+
type BlockMenu = ReturnType<typeof BlockMenu>;
|
|
34
|
+
export default BlockMenu;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* Lucide glyphs the editor's own chrome draws (menus, the selection bar, table affordances),
|
|
4
|
+
* inlined as path data so the library carries no icon dependency. Every shape is a path so
|
|
5
|
+
* the stroke styling below covers all of them.
|
|
6
|
+
*/
|
|
7
|
+
const GLYPHS = {
|
|
8
|
+
plus: ['M5 12h14', 'M12 5v14'],
|
|
9
|
+
type: ['M4 7V4h16v3', 'M9 20h6', 'M12 4v16'],
|
|
10
|
+
trash: [
|
|
11
|
+
'M3 6h18',
|
|
12
|
+
'M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6',
|
|
13
|
+
'M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2',
|
|
14
|
+
'M10 11v6',
|
|
15
|
+
'M14 11v6'
|
|
16
|
+
],
|
|
17
|
+
'arrow-up': ['m5 12 7-7 7 7', 'M12 19V5'],
|
|
18
|
+
'arrow-down': ['M12 5v14', 'm19 12-7 7-7-7'],
|
|
19
|
+
'arrow-left': ['m12 19-7-7 7-7', 'M19 12H5'],
|
|
20
|
+
'arrow-right': ['M5 12h14', 'm12 5 7 7-7 7'],
|
|
21
|
+
scissors: [
|
|
22
|
+
'M9 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0',
|
|
23
|
+
'M8.12 8.12 12 12',
|
|
24
|
+
'M20 4 8.12 15.88',
|
|
25
|
+
'M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0',
|
|
26
|
+
'M14.8 14.8 20 20'
|
|
27
|
+
],
|
|
28
|
+
copy: [
|
|
29
|
+
'M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z',
|
|
30
|
+
'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'
|
|
31
|
+
],
|
|
32
|
+
clipboard: [
|
|
33
|
+
'M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z',
|
|
34
|
+
'M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'
|
|
35
|
+
],
|
|
36
|
+
'align-left': ['M15 12H3', 'M17 18H3', 'M21 6H3'],
|
|
37
|
+
'align-center': ['M17 12H7', 'M19 18H5', 'M21 6H3'],
|
|
38
|
+
'align-right': ['M21 12H9', 'M21 18H7', 'M21 6H3'],
|
|
39
|
+
bold: ['M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8'],
|
|
40
|
+
italic: ['M19 4h-9', 'M14 20H5', 'M15 4 9 20'],
|
|
41
|
+
strikethrough: ['M16 4H9a3 3 0 0 0-2.83 4', 'M14 12a4 4 0 0 1 0 8H6', 'M4 12h16'],
|
|
42
|
+
code: ['m16 18 6-6-6-6', 'm8 6-6 6 6 6'],
|
|
43
|
+
link: [
|
|
44
|
+
'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71',
|
|
45
|
+
'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'
|
|
46
|
+
],
|
|
47
|
+
heading: ['M6 12h12', 'M6 20V4', 'M18 20V4'],
|
|
48
|
+
list: ['M3 12h.01', 'M3 18h.01', 'M3 6h.01', 'M8 12h13', 'M8 18h13', 'M8 6h13'],
|
|
49
|
+
'list-ordered': [
|
|
50
|
+
'M10 12h11',
|
|
51
|
+
'M10 18h11',
|
|
52
|
+
'M10 6h11',
|
|
53
|
+
'M4 10h2',
|
|
54
|
+
'M4 6h1v4',
|
|
55
|
+
'M6 18H4c0-1 2-2 2-3s-1-1.5-2-1'
|
|
56
|
+
],
|
|
57
|
+
'square-check': [
|
|
58
|
+
'M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z',
|
|
59
|
+
'm9 12 2 2 4-4'
|
|
60
|
+
],
|
|
61
|
+
'text-quote': ['M17 6H3', 'M21 12H8', 'M21 18H8', 'M3 12v6'],
|
|
62
|
+
minus: ['M5 12h14'],
|
|
63
|
+
table: [
|
|
64
|
+
'M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z',
|
|
65
|
+
'M12 3v18',
|
|
66
|
+
'M3 9h18',
|
|
67
|
+
'M3 15h18'
|
|
68
|
+
],
|
|
69
|
+
sigma: [
|
|
70
|
+
'M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2'
|
|
71
|
+
],
|
|
72
|
+
info: ['M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0', 'M12 16v-4', 'M12 8h.01'],
|
|
73
|
+
'chevron-right': ['m9 18 6-6-6-6'],
|
|
74
|
+
'chevron-down': ['m6 9 6 6 6-6'],
|
|
75
|
+
'rows-2': [
|
|
76
|
+
'M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z',
|
|
77
|
+
'M3 12h18'
|
|
78
|
+
],
|
|
79
|
+
'columns-2': [
|
|
80
|
+
'M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z',
|
|
81
|
+
'M12 3v18'
|
|
82
|
+
],
|
|
83
|
+
check: ['M20 6 9 17l-5-5'],
|
|
84
|
+
crop: ['M6 2v14a2 2 0 0 0 2 2h14', 'M18 22V8a2 2 0 0 0-2-2H2'],
|
|
85
|
+
captions: [
|
|
86
|
+
'M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z',
|
|
87
|
+
'M7 15h4',
|
|
88
|
+
'M15 15h2',
|
|
89
|
+
'M7 11h2',
|
|
90
|
+
'M13 11h4'
|
|
91
|
+
],
|
|
92
|
+
x: ['M18 6 6 18', 'm6 6 12 12'],
|
|
93
|
+
'grip-vertical': [
|
|
94
|
+
'M10 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0',
|
|
95
|
+
'M10 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0',
|
|
96
|
+
'M10 19a1 1 0 1 1-2 0 1 1 0 0 1 2 0',
|
|
97
|
+
'M16 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0',
|
|
98
|
+
'M16 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0',
|
|
99
|
+
'M16 19a1 1 0 1 1-2 0 1 1 0 0 1 2 0'
|
|
100
|
+
]
|
|
101
|
+
} as const;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The marks as LETTERS, the way a formatting bar draws them: a bold B, a slanted I, an S with
|
|
105
|
+
* its own line through it. Lucide's stroked outlines of these read as clip art at 16px.
|
|
106
|
+
*/
|
|
107
|
+
const LETTERS = {
|
|
108
|
+
bold: { text: 'B', weight: 800, italic: false, strike: false },
|
|
109
|
+
italic: { text: 'I', weight: 500, italic: true, strike: false },
|
|
110
|
+
strikethrough: { text: 'S', weight: 600, italic: false, strike: true }
|
|
111
|
+
} as const;
|
|
112
|
+
|
|
113
|
+
export type MenuIconName = keyof typeof GLYPHS;
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<script lang="ts">
|
|
117
|
+
let { name, size = 14 }: { name: MenuIconName; size?: number } = $props();
|
|
118
|
+
const letter = $derived(name in LETTERS ? LETTERS[name as keyof typeof LETTERS] : null);
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
{#if letter}
|
|
122
|
+
<svg viewBox="0 0 24 24" width={size} height={size} aria-hidden="true">
|
|
123
|
+
<text
|
|
124
|
+
x="12"
|
|
125
|
+
y="17.5"
|
|
126
|
+
text-anchor="middle"
|
|
127
|
+
font-family="Georgia, 'Times New Roman', serif"
|
|
128
|
+
font-size="17"
|
|
129
|
+
font-weight={letter.weight}
|
|
130
|
+
font-style={letter.italic ? 'italic' : 'normal'}
|
|
131
|
+
fill="currentColor">{letter.text}</text
|
|
132
|
+
>
|
|
133
|
+
{#if letter.strike}
|
|
134
|
+
<path d="M5 12.5h14" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
|
135
|
+
{/if}
|
|
136
|
+
</svg>
|
|
137
|
+
{:else}
|
|
138
|
+
<svg
|
|
139
|
+
viewBox="0 0 24 24"
|
|
140
|
+
width={size}
|
|
141
|
+
height={size}
|
|
142
|
+
fill="none"
|
|
143
|
+
stroke="currentColor"
|
|
144
|
+
stroke-width="1.75"
|
|
145
|
+
stroke-linecap="round"
|
|
146
|
+
stroke-linejoin="round"
|
|
147
|
+
aria-hidden="true"
|
|
148
|
+
>
|
|
149
|
+
{#each GLYPHS[name] as d (d)}
|
|
150
|
+
<path {d} />
|
|
151
|
+
{/each}
|
|
152
|
+
</svg>
|
|
153
|
+
{/if}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucide glyphs the editor's own chrome draws (menus, the selection bar, table affordances),
|
|
3
|
+
* inlined as path data so the library carries no icon dependency. Every shape is a path so
|
|
4
|
+
* the stroke styling below covers all of them.
|
|
5
|
+
*/
|
|
6
|
+
declare const GLYPHS: {
|
|
7
|
+
readonly plus: readonly ["M5 12h14", "M12 5v14"];
|
|
8
|
+
readonly type: readonly ["M4 7V4h16v3", "M9 20h6", "M12 4v16"];
|
|
9
|
+
readonly trash: readonly ["M3 6h18", "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", "M10 11v6", "M14 11v6"];
|
|
10
|
+
readonly 'arrow-up': readonly ["m5 12 7-7 7 7", "M12 19V5"];
|
|
11
|
+
readonly 'arrow-down': readonly ["M12 5v14", "m19 12-7 7-7-7"];
|
|
12
|
+
readonly 'arrow-left': readonly ["m12 19-7-7 7-7", "M19 12H5"];
|
|
13
|
+
readonly 'arrow-right': readonly ["M5 12h14", "m12 5 7 7-7 7"];
|
|
14
|
+
readonly scissors: readonly ["M9 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0", "M8.12 8.12 12 12", "M20 4 8.12 15.88", "M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0", "M14.8 14.8 20 20"];
|
|
15
|
+
readonly copy: readonly ["M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z", "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"];
|
|
16
|
+
readonly clipboard: readonly ["M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z", "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"];
|
|
17
|
+
readonly 'align-left': readonly ["M15 12H3", "M17 18H3", "M21 6H3"];
|
|
18
|
+
readonly 'align-center': readonly ["M17 12H7", "M19 18H5", "M21 6H3"];
|
|
19
|
+
readonly 'align-right': readonly ["M21 12H9", "M21 18H7", "M21 6H3"];
|
|
20
|
+
readonly bold: readonly ["M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"];
|
|
21
|
+
readonly italic: readonly ["M19 4h-9", "M14 20H5", "M15 4 9 20"];
|
|
22
|
+
readonly strikethrough: readonly ["M16 4H9a3 3 0 0 0-2.83 4", "M14 12a4 4 0 0 1 0 8H6", "M4 12h16"];
|
|
23
|
+
readonly code: readonly ["m16 18 6-6-6-6", "m8 6-6 6 6 6"];
|
|
24
|
+
readonly link: readonly ["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"];
|
|
25
|
+
readonly heading: readonly ["M6 12h12", "M6 20V4", "M18 20V4"];
|
|
26
|
+
readonly list: readonly ["M3 12h.01", "M3 18h.01", "M3 6h.01", "M8 12h13", "M8 18h13", "M8 6h13"];
|
|
27
|
+
readonly 'list-ordered': readonly ["M10 12h11", "M10 18h11", "M10 6h11", "M4 10h2", "M4 6h1v4", "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"];
|
|
28
|
+
readonly 'square-check': readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "m9 12 2 2 4-4"];
|
|
29
|
+
readonly 'text-quote': readonly ["M17 6H3", "M21 12H8", "M21 18H8", "M3 12v6"];
|
|
30
|
+
readonly minus: readonly ["M5 12h14"];
|
|
31
|
+
readonly table: readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M12 3v18", "M3 9h18", "M3 15h18"];
|
|
32
|
+
readonly sigma: readonly ["M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2"];
|
|
33
|
+
readonly info: readonly ["M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0", "M12 16v-4", "M12 8h.01"];
|
|
34
|
+
readonly 'chevron-right': readonly ["m9 18 6-6-6-6"];
|
|
35
|
+
readonly 'chevron-down': readonly ["m6 9 6 6 6-6"];
|
|
36
|
+
readonly 'rows-2': readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M3 12h18"];
|
|
37
|
+
readonly 'columns-2': readonly ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M12 3v18"];
|
|
38
|
+
readonly check: readonly ["M20 6 9 17l-5-5"];
|
|
39
|
+
readonly crop: readonly ["M6 2v14a2 2 0 0 0 2 2h14", "M18 22V8a2 2 0 0 0-2-2H2"];
|
|
40
|
+
readonly captions: readonly ["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z", "M7 15h4", "M15 15h2", "M7 11h2", "M13 11h4"];
|
|
41
|
+
readonly x: readonly ["M18 6 6 18", "m6 6 12 12"];
|
|
42
|
+
readonly 'grip-vertical': readonly ["M10 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0", "M10 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0", "M10 19a1 1 0 1 1-2 0 1 1 0 0 1 2 0", "M16 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0", "M16 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0", "M16 19a1 1 0 1 1-2 0 1 1 0 0 1 2 0"];
|
|
43
|
+
};
|
|
44
|
+
export type MenuIconName = keyof typeof GLYPHS;
|
|
45
|
+
type $$ComponentProps = {
|
|
46
|
+
name: MenuIconName;
|
|
47
|
+
size?: number;
|
|
48
|
+
};
|
|
49
|
+
declare const MenuIcon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
50
|
+
type MenuIcon = ReturnType<typeof MenuIcon>;
|
|
51
|
+
export default MenuIcon;
|