@damiro/stylo 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/InPlaceView-Ba7JCZ2Y.js +2346 -0
- package/dist/InPlaceView-Ba7JCZ2Y.js.map +1 -0
- package/dist/Preview-Dxb9zPVv.js +93 -0
- package/dist/Preview-Dxb9zPVv.js.map +1 -0
- package/dist/SplitView.d.ts +23 -0
- package/dist/SplitView.d.ts.map +1 -0
- package/dist/Stylo.d.ts +15 -0
- package/dist/Stylo.d.ts.map +1 -0
- package/dist/callout-oLE630ZP.js +37 -0
- package/dist/callout-oLE630ZP.js.map +1 -0
- package/dist/callout.d.ts +18 -0
- package/dist/callout.d.ts.map +1 -0
- package/dist/config-DTBxVhtH.js +101 -0
- package/dist/config-DTBxVhtH.js.map +1 -0
- package/dist/editor/SourceView.d.ts +17 -0
- package/dist/editor/SourceView.d.ts.map +1 -0
- package/dist/editor/extensions.d.ts +20 -0
- package/dist/editor/extensions.d.ts.map +1 -0
- package/dist/editor/highlight.d.ts +19 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/save.d.ts +12 -0
- package/dist/editor/save.d.ts.map +1 -0
- package/dist/editor/theme.d.ts +3 -0
- package/dist/editor/theme.d.ts.map +1 -0
- package/dist/editor/useCodeMirror.d.ts +26 -0
- package/dist/editor/useCodeMirror.d.ts.map +1 -0
- package/dist/frontmatter.d.ts +21 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/inplace/InPlaceView.d.ts +30 -0
- package/dist/inplace/InPlaceView.d.ts.map +1 -0
- package/dist/inplace/autoformat.d.ts +23 -0
- package/dist/inplace/autoformat.d.ts.map +1 -0
- package/dist/inplace/config.d.ts +57 -0
- package/dist/inplace/config.d.ts.map +1 -0
- package/dist/inplace/context-menu-actions.d.ts +53 -0
- package/dist/inplace/context-menu-actions.d.ts.map +1 -0
- package/dist/inplace/context-menu.d.ts +50 -0
- package/dist/inplace/context-menu.d.ts.map +1 -0
- package/dist/inplace/decorate.d.ts +17 -0
- package/dist/inplace/decorate.d.ts.map +1 -0
- package/dist/inplace/edit-boundaries.d.ts +59 -0
- package/dist/inplace/edit-boundaries.d.ts.map +1 -0
- package/dist/inplace/edit-insert-assoc.d.ts +17 -0
- package/dist/inplace/edit-insert-assoc.d.ts.map +1 -0
- package/dist/inplace/edit-line-prefix.d.ts +23 -0
- package/dist/inplace/edit-line-prefix.d.ts.map +1 -0
- package/dist/inplace/extension.d.ts +21 -0
- package/dist/inplace/extension.d.ts.map +1 -0
- package/dist/inplace/frontmatter.d.ts +13 -0
- package/dist/inplace/frontmatter.d.ts.map +1 -0
- package/dist/inplace/inline-md.d.ts +13 -0
- package/dist/inplace/inline-md.d.ts.map +1 -0
- package/dist/inplace/lazyInPlace.d.ts +7 -0
- package/dist/inplace/lazyInPlace.d.ts.map +1 -0
- package/dist/inplace/link-click.d.ts +24 -0
- package/dist/inplace/link-click.d.ts.map +1 -0
- package/dist/inplace/link-hover.d.ts +11 -0
- package/dist/inplace/link-hover.d.ts.map +1 -0
- package/dist/inplace/list-guides.d.ts +16 -0
- package/dist/inplace/list-guides.d.ts.map +1 -0
- package/dist/inplace/long-press.d.ts +39 -0
- package/dist/inplace/long-press.d.ts.map +1 -0
- package/dist/inplace/math.d.ts +16 -0
- package/dist/inplace/math.d.ts.map +1 -0
- package/dist/inplace/menu-plugin.d.ts +30 -0
- package/dist/inplace/menu-plugin.d.ts.map +1 -0
- package/dist/inplace/nodes.d.ts +24 -0
- package/dist/inplace/nodes.d.ts.map +1 -0
- package/dist/inplace/plugin.d.ts +21 -0
- package/dist/inplace/plugin.d.ts.map +1 -0
- package/dist/inplace/reveal.d.ts +8 -0
- package/dist/inplace/reveal.d.ts.map +1 -0
- package/dist/inplace/scan.d.ts +11 -0
- package/dist/inplace/scan.d.ts.map +1 -0
- package/dist/inplace/selection-bar.d.ts +38 -0
- package/dist/inplace/selection-bar.d.ts.map +1 -0
- package/dist/inplace/table-cell-dom.d.ts +30 -0
- package/dist/inplace/table-cell-dom.d.ts.map +1 -0
- package/dist/inplace/table-enter.d.ts +22 -0
- package/dist/inplace/table-enter.d.ts.map +1 -0
- package/dist/inplace/table-gizmos.d.ts +55 -0
- package/dist/inplace/table-gizmos.d.ts.map +1 -0
- package/dist/inplace/table-structure.d.ts +23 -0
- package/dist/inplace/table-structure.d.ts.map +1 -0
- package/dist/inplace/table-widget.d.ts +81 -0
- package/dist/inplace/table-widget.d.ts.map +1 -0
- package/dist/inplace/tables.d.ts +8 -0
- package/dist/inplace/tables.d.ts.map +1 -0
- package/dist/inplace/theme.d.ts +14 -0
- package/dist/inplace/theme.d.ts.map +1 -0
- package/dist/inplace/widgets.d.ts +25 -0
- package/dist/inplace/widgets.d.ts.map +1 -0
- package/dist/inplace/wikilinks.d.ts +10 -0
- package/dist/inplace/wikilinks.d.ts.map +1 -0
- package/dist/katex-BfiLlqfN.js +21979 -0
- package/dist/katex-BfiLlqfN.js.map +1 -0
- package/dist/katex.css +3 -0
- package/dist/markdown-N3lRmU2n.js +8524 -0
- package/dist/markdown-N3lRmU2n.js.map +1 -0
- package/dist/render/Preview.d.ts +10 -0
- package/dist/render/Preview.d.ts.map +1 -0
- package/dist/render/lazyPreview.d.ts +8 -0
- package/dist/render/lazyPreview.d.ts.map +1 -0
- package/dist/render/remark-callout.d.ts +10 -0
- package/dist/render/remark-callout.d.ts.map +1 -0
- package/dist/render/remark-wikilink.d.ts +8 -0
- package/dist/render/remark-wikilink.d.ts.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/stylo.js +293 -0
- package/dist/stylo.js.map +1 -0
- package/dist/toolbar/Toolbar.d.ts +28 -0
- package/dist/toolbar/Toolbar.d.ts.map +1 -0
- package/dist/toolbar/block.d.ts +56 -0
- package/dist/toolbar/block.d.ts.map +1 -0
- package/dist/toolbar/cell-inline.d.ts +16 -0
- package/dist/toolbar/cell-inline.d.ts.map +1 -0
- package/dist/toolbar/commands.d.ts +25 -0
- package/dist/toolbar/commands.d.ts.map +1 -0
- package/dist/toolbar/config.d.ts +21 -0
- package/dist/toolbar/config.d.ts.map +1 -0
- package/dist/toolbar/fence.d.ts +28 -0
- package/dist/toolbar/fence.d.ts.map +1 -0
- package/dist/toolbar/floating-watchdog.d.ts +18 -0
- package/dist/toolbar/floating-watchdog.d.ts.map +1 -0
- package/dist/toolbar/icon-paths.d.ts +10 -0
- package/dist/toolbar/icon-paths.d.ts.map +1 -0
- package/dist/toolbar/icons.d.ts +10 -0
- package/dist/toolbar/icons.d.ts.map +1 -0
- package/dist/toolbar/inline-ops.d.ts +101 -0
- package/dist/toolbar/inline-ops.d.ts.map +1 -0
- package/dist/toolbar/inline.d.ts +38 -0
- package/dist/toolbar/inline.d.ts.map +1 -0
- package/dist/toolbar/keyboard-inset.d.ts +10 -0
- package/dist/toolbar/keyboard-inset.d.ts.map +1 -0
- package/dist/toolbar/keymap.d.ts +8 -0
- package/dist/toolbar/keymap.d.ts.map +1 -0
- package/dist/toolbar/labels.d.ts +16 -0
- package/dist/toolbar/labels.d.ts.map +1 -0
- package/dist/toolbar/table-grid.d.ts +23 -0
- package/dist/toolbar/table-grid.d.ts.map +1 -0
- package/dist/toolbar/table.d.ts +35 -0
- package/dist/toolbar/table.d.ts.map +1 -0
- package/dist/toolbar-settings/SortableRow.d.ts +15 -0
- package/dist/toolbar-settings/SortableRow.d.ts.map +1 -0
- package/dist/toolbar-settings/StyloToolbarSettings.d.ts +29 -0
- package/dist/toolbar-settings/StyloToolbarSettings.d.ts.map +1 -0
- package/dist/toolbar-settings/index.d.ts +3 -0
- package/dist/toolbar-settings/index.d.ts.map +1 -0
- package/dist/toolbar-settings/items.d.ts +24 -0
- package/dist/toolbar-settings/items.d.ts.map +1 -0
- package/dist/toolbar-settings.js +269 -0
- package/dist/toolbar-settings.js.map +1 -0
- package/dist/types.d.ts +264 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useCodeMirror-YnIFkvKn.js +1361 -0
- package/dist/useCodeMirror-YnIFkvKn.js.map +1 -0
- package/dist/wikilink-BFpTehto.js +42 -0
- package/dist/wikilink-BFpTehto.js.map +1 -0
- package/dist/wikilink.d.ts +11 -0
- package/dist/wikilink.d.ts.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Facet } from "@codemirror/state";
|
|
2
|
+
import type { InPlaceConfig, InPlaceDecorationToggles, MenuGroupId, RevealMode, SelectionUI, TableEditing, ToolbarCommandId } from "../types";
|
|
3
|
+
/** `InPlaceDecorationToggles` with every key resolved to a concrete boolean. */
|
|
4
|
+
export type ResolvedToggles = Required<InPlaceDecorationToggles>;
|
|
5
|
+
export declare function resolveToggles(config?: InPlaceConfig): ResolvedToggles;
|
|
6
|
+
/**
|
|
7
|
+
* Carries the resolved decoration toggles to every producer (the view plugin
|
|
8
|
+
* and the three state fields). Seeded once by `inPlaceExtension`; read, never
|
|
9
|
+
* written, by `decorate.ts`, `math.ts`, `frontmatter.ts`, and `tables.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const inPlaceConfigFacet: Facet<Required<InPlaceDecorationToggles>, Required<InPlaceDecorationToggles>>;
|
|
12
|
+
/** Table editing mode, seeded once by `inPlaceExtension`; read by `tables.ts`. */
|
|
13
|
+
export declare const tableEditingFacet: Facet<TableEditing, TableEditing>;
|
|
14
|
+
/**
|
|
15
|
+
* Marker reveal behaviour (ADR-007). `"never"` makes `decorate.ts` hide every
|
|
16
|
+
* inline marker regardless of the caret line. Seeded once by `inPlaceExtension`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const revealModeFacet: Facet<RevealMode, RevealMode>;
|
|
19
|
+
/**
|
|
20
|
+
* The host's `onLinkClick` (the "Open link" action in the right-click link
|
|
21
|
+
* editor), or `null`. Seeded once by `inPlaceExtension`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const linkOpenFacet: Facet<((href: string) => void) | null, ((href: string) => void) | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the right-click menu takes over from the browser's own context menu
|
|
26
|
+
* in the canvas. Seeded once by `inPlaceExtension`; read by `menu-plugin.ts`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const contextMenuEnabled: Facet<boolean, boolean>;
|
|
29
|
+
/** The menu's groups in their default order. */
|
|
30
|
+
export declare const DEFAULT_MENU_GROUPS: MenuGroupId[];
|
|
31
|
+
/** The selection bar's buttons in their default order. */
|
|
32
|
+
export declare const DEFAULT_SELECTION_BAR_ITEMS: ToolbarCommandId[];
|
|
33
|
+
/** `enabled` false keeps the browser menu; `groups` is always a non-empty list. */
|
|
34
|
+
export declare function resolveContextMenu(c: InPlaceConfig["contextMenu"]): {
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
groups: MenuGroupId[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Ordered right-click menu groups. Seeded once by `inPlaceExtension`; read by
|
|
40
|
+
* `context-menu-actions.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const menuGroupsFacet: Facet<MenuGroupId[], MenuGroupId[]>;
|
|
43
|
+
/** Selection-bar buttons, resolved to the known inline ids in the given order. */
|
|
44
|
+
export declare function resolveSelectionBarItems(ids?: ToolbarCommandId[]): ToolbarCommandId[];
|
|
45
|
+
/**
|
|
46
|
+
* Ordered selection-bar button ids. Seeded once by `inPlaceExtension`; read by
|
|
47
|
+
* `selection-bar.ts`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const selectionBarItemsFacet: Facet<ToolbarCommandId[], ToolbarCommandId[]>;
|
|
50
|
+
/**
|
|
51
|
+
* What a non-empty selection offers (ADR-007). `"bar"` shows the floating
|
|
52
|
+
* formatting bar; `"menu"` (default) keeps the inline group in the right-click
|
|
53
|
+
* menu instead; `"none"` shows neither. Seeded once by `inPlaceExtension`; read
|
|
54
|
+
* by `selection-bar.ts` and `context-menu-actions.ts`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const selectionUIFacet: Facet<SelectionUI, SelectionUI>;
|
|
57
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/inplace/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAEjB,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAAA;AAiBhE,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,eAAe,CAEtE;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+EAE7B,CAAA;AAEF,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,mCAE5B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,+BAE1B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,gBAChB,MAAM,KAAK,IAAI,kBACf,MAAM,KAAK,IAAI,SAGvB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,yBAE7B,CAAA;AAEF,gDAAgD;AAChD,eAAO,MAAM,mBAAmB,EAAE,WAAW,EAM5C,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,2BAA2B,EAAE,gBAAgB,EAQzD,CAAA;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG;IACnE,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,CAIA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,qCAE1B,CAAA;AAEF,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAIrF;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,+CAEjC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,iCAE3B,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps the shared toolbar command set onto rows for the in-place right-click
|
|
3
|
+
* menu. One shape everywhere (Obsidian style): the link rows, then Format /
|
|
4
|
+
* Paragraph / Insert submenus, then clipboard. Every command already carries
|
|
5
|
+
* its own `run` / `isActive` / `disabled`, so an item that can't apply where
|
|
6
|
+
* the caret sits is greyed, not hidden — the menu shape stays put.
|
|
7
|
+
*/
|
|
8
|
+
import type { EditorView } from "@codemirror/view";
|
|
9
|
+
import type { MenuField, MenuRow } from "./context-menu";
|
|
10
|
+
/**
|
|
11
|
+
* A non-empty text selection inside a focused editable table cell. The cell is a
|
|
12
|
+
* `contenteditable` surface, so this selection lives in the DOM, not in
|
|
13
|
+
* `state.selection` — but the inline commands route through `runInlineInCell`,
|
|
14
|
+
* so the Format group still applies.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cellHasSelection(view: EditorView): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The "Add external link" row — an editable `[text](url)` URL field. Prefilled,
|
|
19
|
+
* with Open / Remove and the label "Edit external link", when the caret sits in
|
|
20
|
+
* an existing `[text](url)`; otherwise an empty field that wraps the selection
|
|
21
|
+
* (or the word the menu just selected) on submit.
|
|
22
|
+
*/
|
|
23
|
+
export declare function linkRow(view: EditorView): MenuField;
|
|
24
|
+
/**
|
|
25
|
+
* The "Add link" row — an editable `[[target]]` field for an internal link.
|
|
26
|
+
* Prefilled, with Remove and the label "Edit link", when the caret sits in an
|
|
27
|
+
* existing `[[target|label]]`; otherwise an empty field that wraps the
|
|
28
|
+
* selection (or the word the menu just selected) on submit.
|
|
29
|
+
*/
|
|
30
|
+
export declare function wikiLinkRow(view: EditorView): MenuField;
|
|
31
|
+
/**
|
|
32
|
+
* The "Language" row shown when the caret is in a fenced code block: an
|
|
33
|
+
* editable info string (` ```ts `), plus **Remove code block** to unwrap it.
|
|
34
|
+
* The opening fence line is hidden in the seamless canvas, so this is the way
|
|
35
|
+
* to reach the language at all.
|
|
36
|
+
*/
|
|
37
|
+
export declare function codeBlockRow(view: EditorView): MenuField;
|
|
38
|
+
/**
|
|
39
|
+
* Rows for a non-empty selection inside an editable table cell: the Format
|
|
40
|
+
* submenu (forced live — see `toAction`) and clipboard, gated by `menuGroups`.
|
|
41
|
+
* Shared by the canvas menu and the table widget's own structural menu, which
|
|
42
|
+
* appends these under its row / column / align actions.
|
|
43
|
+
*/
|
|
44
|
+
export declare function cellSelectionRows(view: EditorView): MenuRow[];
|
|
45
|
+
/**
|
|
46
|
+
* The right-click menu. `menuGroupsFacet` picks and orders the top-level groups
|
|
47
|
+
* (`link` / `format` / `paragraph` / `insert` / `clipboard`); `selectionUI`
|
|
48
|
+
* independently decides whether `link` and `format` live here or on the floating
|
|
49
|
+
* bar. A table-cell selection and a fenced-code caret are focused contexts that
|
|
50
|
+
* ignore the ordering and offer only what applies.
|
|
51
|
+
*/
|
|
52
|
+
export declare function menuRows(view: EditorView): MenuRow[];
|
|
53
|
+
//# sourceMappingURL=context-menu-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu-actions.d.ts","sourceRoot":"","sources":["../../src/inplace/context-menu-actions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQlD,OAAO,KAAK,EAAc,SAAS,EAAE,OAAO,EAAe,MAAM,gBAAgB,CAAA;AAejF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAK1D;AA+GD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAgEnD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CA6DvD;AASD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAsBxD;AASD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,EAAE,CAQ7D;AAyBD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,EAAE,CA0CpD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pointer-positioned menu shell for the in-place canvas. It owns the popup
|
|
3
|
+
* element, its placement, one level of flyout submenu, and dismissal (outside
|
|
4
|
+
* press, Escape, scroll). It knows nothing about editor commands; the caller
|
|
5
|
+
* passes plain rows with `onSelect` callbacks.
|
|
6
|
+
*/
|
|
7
|
+
export interface MenuAction {
|
|
8
|
+
label: string;
|
|
9
|
+
/** Stroke-path data for a leading glyph (see `toolbar/icon-paths`). */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** Rendered with emphasis when true. */
|
|
12
|
+
active?: boolean;
|
|
13
|
+
/** Shown greyed and not selectable. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Native `title` tooltip — e.g. why a disabled row is disabled. */
|
|
16
|
+
title?: string;
|
|
17
|
+
onSelect: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface MenuSubmenu {
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: string;
|
|
22
|
+
rows: MenuRow[];
|
|
23
|
+
/** Greyed, and its flyout never opens. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** A row whose flyout is a single text input plus optional action buttons. */
|
|
27
|
+
export interface MenuField {
|
|
28
|
+
field: true;
|
|
29
|
+
label: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
value: string;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
onSubmit: (value: string) => void;
|
|
34
|
+
actions?: MenuAction[];
|
|
35
|
+
}
|
|
36
|
+
export type MenuRow = MenuAction | MenuSubmenu | MenuField | "separator";
|
|
37
|
+
export interface ContextMenu {
|
|
38
|
+
/** Append once to a stable container (typically `document.body`). */
|
|
39
|
+
readonly el: HTMLElement;
|
|
40
|
+
readonly isOpen: boolean;
|
|
41
|
+
/** Render `rows` and show the menu at a viewport point, clamped on-screen. */
|
|
42
|
+
show: (rows: MenuRow[], x: number, y: number) => void;
|
|
43
|
+
/** Show a single field panel directly, with no wrapping menu row. */
|
|
44
|
+
showField: (field: MenuField, x: number, y: number) => void;
|
|
45
|
+
hide: () => void;
|
|
46
|
+
/** Remove the element and drop document listeners. */
|
|
47
|
+
destroy: () => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function createContextMenu(doc: Document, className?: string): ContextMenu;
|
|
50
|
+
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../src/inplace/context-menu.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,CAAA;AAExE,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,8EAA8E;IAC9E,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,qEAAqE;IACrE,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,sDAAsD;IACtD,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAKD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,SAAoB,GAAG,WAAW,CA6O3F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type DecorationSet, type EditorView } from "@codemirror/view";
|
|
2
|
+
export interface InPlaceDecorations {
|
|
3
|
+
decorations: DecorationSet;
|
|
4
|
+
/** Every replacing decoration — the caret steps over these rather than into them. */
|
|
5
|
+
atomic: DecorationSet;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build the in-place decoration set for the visible viewport only — the syntax
|
|
9
|
+
* tree is walked across `view.visibleRanges`, never the whole document, so the
|
|
10
|
+
* cost stays bounded on long notes. Decorations are collected unordered and
|
|
11
|
+
* sorted by `Decoration.set`, which tolerates the overlaps that nested emphasis
|
|
12
|
+
* and marker-inside-styled-span produce. Multi-line `$$` blocks and the
|
|
13
|
+
* frontmatter block are handled by their own state fields (a plugin may not
|
|
14
|
+
* replace line breaks).
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildDecorations(view: EditorView): InPlaceDecorations;
|
|
17
|
+
//# sourceMappingURL=decorate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../src/inplace/decorate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAelF,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,aAAa,CAAA;IAC1B,qFAAqF;IACrF,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,CAiErE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-007 Stage 2 (first slice): editing at a hidden marker's edge.
|
|
3
|
+
*
|
|
4
|
+
* Under `reveal: "never"` (or off-caret under `"caret"`) an inline construct's
|
|
5
|
+
* markers are hidden and atomic. The stock Backspace/Delete skips the whole
|
|
6
|
+
* atomic range and eats the marker itself, stranding its partner — and for a
|
|
7
|
+
* nested `***word***` it strips a level of formatting per keypress.
|
|
8
|
+
*
|
|
9
|
+
* Here the key steps *over* the run of hidden markers and removes the real
|
|
10
|
+
* character beyond them instead: Backspace at the front of a bold word deletes
|
|
11
|
+
* the space before it, the bold stays. The one exception is deleting the last
|
|
12
|
+
* character *inside* a wrapper — the now-empty markers go with it.
|
|
13
|
+
*
|
|
14
|
+
* Arrow keys get the same treatment: `atomicRanges` leaves both edges of a
|
|
15
|
+
* hidden run as caret stops that render at the same point, so a press can look
|
|
16
|
+
* like it did nothing — when a step only crossed hidden markers, take one more.
|
|
17
|
+
* This covers both a plain caret move and `Shift`-extending a selection, which
|
|
18
|
+
* the stock `select*` commands park on the near edge just the same.
|
|
19
|
+
*/
|
|
20
|
+
import { type EditorState, type Extension } from "@codemirror/state";
|
|
21
|
+
import { type Command } from "@codemirror/view";
|
|
22
|
+
export interface Wrap {
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
contentFrom: number;
|
|
26
|
+
contentTo: number;
|
|
27
|
+
/** `"mark"` — a paired inline mark (`**`, `*`, `~~`, `` ` ``); `"link"` — a
|
|
28
|
+
* link or wikilink, whose label is not itself a Markdown context, so a
|
|
29
|
+
* right-click formats the *whole* construct rather than the label. */
|
|
30
|
+
kind: "mark" | "link";
|
|
31
|
+
}
|
|
32
|
+
/** Are inline markers on this line hidden right now? */
|
|
33
|
+
export declare function markersHidden(state: EditorState, lineNumber: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The hidden-marker inline construct enclosing `pos`, or `null`. With
|
|
36
|
+
* `emphasisOnly`, only the paired-mark constructs whose *both* delimiters are
|
|
37
|
+
* hidden count (strong / emphasis / strike / inline code) — links and wikilinks
|
|
38
|
+
* keep a directly editable label, so their edges are not boundary-escaped.
|
|
39
|
+
*
|
|
40
|
+
* By default the construct's markers must be hidden right now (boundary editing
|
|
41
|
+
* only applies then); `ignoreReveal` drops that check for callers that just want
|
|
42
|
+
* the span — the right-click menu selecting the whole phrase, which should work
|
|
43
|
+
* whether or not the caret has revealed the line.
|
|
44
|
+
*/
|
|
45
|
+
export declare function wrapAt(state: EditorState, pos: number, emphasisOnly?: boolean, ignoreReveal?: boolean): Wrap | null;
|
|
46
|
+
/** Backspace that steps over a hidden marker rather than stranding it. */
|
|
47
|
+
export declare const deleteAcrossMarkerBackward: Command;
|
|
48
|
+
/** Delete — the forward mirror. */
|
|
49
|
+
export declare const deleteAcrossMarkerForward: Command;
|
|
50
|
+
/** Plain caret step across a hidden marker run (leftward). */
|
|
51
|
+
export declare const arrowAcrossMarkerLeft: Command;
|
|
52
|
+
/** Plain caret step — the forward mirror. */
|
|
53
|
+
export declare const arrowAcrossMarkerRight: Command;
|
|
54
|
+
/** `Shift`-extend the selection head across a hidden marker run (leftward). */
|
|
55
|
+
export declare const selectAcrossMarkerLeft: Command;
|
|
56
|
+
/** `Shift`-extend — the forward mirror. */
|
|
57
|
+
export declare const selectAcrossMarkerRight: Command;
|
|
58
|
+
export declare const inPlaceEditBoundaries: Extension;
|
|
59
|
+
//# sourceMappingURL=edit-boundaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-boundaries.d.ts","sourceRoot":"","sources":["../../src/inplace/edit-boundaries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAmB,KAAK,WAAW,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC3F,OAAO,EAAE,KAAK,OAAO,EAA2B,MAAM,kBAAkB,CAAA;AAgBxE,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB;;2EAEuE;IACvE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAE7E;AAyBD;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,YAAY,UAAQ,EACpB,YAAY,UAAQ,GACnB,IAAI,GAAG,IAAI,CA0Db;AA6CD,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,EAAE,OAAiC,CAAA;AAC1E,mCAAmC;AACnC,eAAO,MAAM,yBAAyB,EAAE,OAAgC,CAAA;AAiDxE,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,OAA0C,CAAA;AAC9E,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,EAAE,OAAyC,CAAA;AAC9E,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,EAAE,OAAyC,CAAA;AAC9E,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,EAAE,OAAwC,CAAA;AAE9E,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-007 Stage 2 — insertion association at a hidden marker's edge.
|
|
3
|
+
*
|
|
4
|
+
* With a construct's markers hidden and atomic, the caret at the visual end of a
|
|
5
|
+
* bold word actually sits *before* the hidden `**`, so a keystroke there lands
|
|
6
|
+
* inside the markup: `**bold**` + "x" → `**boldx**`. This transaction filter
|
|
7
|
+
* moves a single boundary insertion to the outer edge of the marker run, so it
|
|
8
|
+
* lands on the side the user perceives: `**bold**x`. The mirror case at the
|
|
9
|
+
* front of the word is handled the same way (`x**bold**`, never `**xbold**`).
|
|
10
|
+
*
|
|
11
|
+
* Scope: the paired-mark inline constructs whose *both* delimiters are hidden —
|
|
12
|
+
* strong / emphasis / strikethrough / inline code. Links and wikilinks keep a
|
|
13
|
+
* directly editable label, so typing at a label edge is left alone.
|
|
14
|
+
*/
|
|
15
|
+
import { type Extension } from "@codemirror/state";
|
|
16
|
+
export declare const inPlaceInsertAssociation: Extension;
|
|
17
|
+
//# sourceMappingURL=edit-insert-assoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-insert-assoc.d.ts","sourceRoot":"","sources":["../../src/inplace/edit-insert-assoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAmC/D,eAAO,MAAM,wBAAwB,EAAE,SA8BrC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-007 Stage 3 — line-prefix backspace.
|
|
3
|
+
*
|
|
4
|
+
* With `## `, `> `, `- ` and friends hidden and atomic, the caret at the visual
|
|
5
|
+
* start of a heading / quote / list line sits just past the hidden prefix.
|
|
6
|
+
* Backspace there removes one level of prefix instead of joining the line to the
|
|
7
|
+
* one above — the Notion "backspace to unstyle" gesture:
|
|
8
|
+
*
|
|
9
|
+
* - heading → paragraph (the whole `#{1,6} ` goes)
|
|
10
|
+
* - quote → one `> ` level out (nested quotes step out one at a time)
|
|
11
|
+
* - list → outdent one step, or drop the marker when already flush
|
|
12
|
+
* - task → paragraph (`- [ ] ` goes)
|
|
13
|
+
*
|
|
14
|
+
* Only fires while that prefix is actually hidden (so `reveal: "caret"` with the
|
|
15
|
+
* caret on the line is untouched — the prefix is visible there and a normal
|
|
16
|
+
* backspace edits it).
|
|
17
|
+
*/
|
|
18
|
+
import { type Extension } from "@codemirror/state";
|
|
19
|
+
import { type Command } from "@codemirror/view";
|
|
20
|
+
/** Backspace at visual column 0 of a hidden-prefix line — one level out. */
|
|
21
|
+
export declare const unwrapLinePrefix: Command;
|
|
22
|
+
export declare const inPlaceLinePrefixEdit: Extension;
|
|
23
|
+
//# sourceMappingURL=edit-line-prefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-line-prefix.d.ts","sourceRoot":"","sources":["../../src/inplace/edit-line-prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,KAAK,OAAO,EAA2B,MAAM,kBAAkB,CAAA;AAoCxE,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,EAAE,OAwB9B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,SAEnC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Extension } from "@codemirror/state";
|
|
2
|
+
import type { InPlaceConfig } from "../types";
|
|
3
|
+
export interface InPlaceOptions {
|
|
4
|
+
/** Fired when a collapsed `[[wikilink]]` is clicked in the canvas. */
|
|
5
|
+
onWikiLinkClick?: (target: string) => void;
|
|
6
|
+
/** Fired by the link editor's "Open link" action with the link's href. */
|
|
7
|
+
onLinkClick?: (href: string) => void;
|
|
8
|
+
/** Which decoration types render; see ADR-005. Applied once, at construction. */
|
|
9
|
+
inPlace?: InPlaceConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The complete in-place canvas layer: decoration plugin, display theme, a
|
|
13
|
+
* reveal-on-click fallback for rendered widgets, and a delegated click handler
|
|
14
|
+
* for wikilinks.
|
|
15
|
+
*
|
|
16
|
+
* The theme is raised with `Prec.high` so its `.cm-content` font rule overrides
|
|
17
|
+
* the base editor theme (which sets the source surface to monospace) for
|
|
18
|
+
* in-place editors only.
|
|
19
|
+
*/
|
|
20
|
+
export declare function inPlaceExtension(opts?: InPlaceOptions): Extension;
|
|
21
|
+
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/inplace/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA6B7C,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,0EAA0E;IAC1E,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AAuCD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,cAAmB,GAAG,SAAS,CA8DrE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StateField } from "@codemirror/state";
|
|
2
|
+
import { type DecorationSet } from "@codemirror/view";
|
|
3
|
+
import { frontmatterRange } from "../frontmatter";
|
|
4
|
+
export { frontmatterRange };
|
|
5
|
+
/**
|
|
6
|
+
* Recesses the leading YAML block — muted, monospace, with a "Frontmatter"
|
|
7
|
+
* label on the first line — without collapsing it. Line decorations only: the rows
|
|
8
|
+
* keep their height, so click-to-position stays accurate (an earlier `block`
|
|
9
|
+
* widget that folded the block to a one-line chip desynced it). A state field,
|
|
10
|
+
* not the plugin, only because the region has no grammar node to hang off.
|
|
11
|
+
*/
|
|
12
|
+
export declare const frontmatterField: StateField<DecorationSet>;
|
|
13
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/inplace/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAc,KAAK,aAAa,EAAc,MAAM,kBAAkB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGjD,OAAO,EAAE,gBAAgB,EAAE,CAAA;AA2B3B;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,2BAI3B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a single line of inline Markdown to DOM nodes — the subset that can
|
|
3
|
+
* appear in a table cell: `` `code` ``, `$math$`, `[[wiki]]`, `[text](url)`,
|
|
4
|
+
* `***both***`, `**bold**`, `*em*`, `~~strike~~`. Block constructs are out of
|
|
5
|
+
* scope (a cell is one line). Reuses the `.cm-inplace-*` classes so cell text
|
|
6
|
+
* matches the rest of the canvas, and tags wikilinks with `data-stylo-wikilink`
|
|
7
|
+
* so the existing delegated click handler picks them up.
|
|
8
|
+
*
|
|
9
|
+
* `code` and `math` win first and keep their contents literal; everything else
|
|
10
|
+
* recurses so `**a `code` b**` styles the bold and the code.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderInline(text: string): DocumentFragment;
|
|
13
|
+
//# sourceMappingURL=inline-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-md.d.ts","sourceRoot":"","sources":["../../src/inplace/inline-md.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAI3D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-place canvas carries the decoration plugin (and, in later increments,
|
|
3
|
+
* its KaTeX widgets). It loads only when `mode` resolves to `in-place`, so
|
|
4
|
+
* `source` consumers never fetch it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LazyInPlaceView: import("react").LazyExoticComponent<typeof import("./InPlaceView").InPlaceView>;
|
|
7
|
+
//# sourceMappingURL=lazyInPlace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyInPlace.d.ts","sourceRoot":"","sources":["../../src/inplace/lazyInPlace.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,eAAe,iFAEzB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Click a collapsed `[text](url)` in the seamless canvas and its URL editor
|
|
3
|
+
* opens at the pointer — the same field the right-click menu and the selection
|
|
4
|
+
* bar use. Under `reveal: "never"` the `(url)` is never on screen as text, so a
|
|
5
|
+
* plain click otherwise has nowhere to go for an edit. The read side is
|
|
6
|
+
* `link-hover.ts`; this is the write side (ADR-007 Stage 5, the click half).
|
|
7
|
+
*
|
|
8
|
+
* Scope:
|
|
9
|
+
* - Only under `reveal: "never"`. In `"caret"` mode a click already reveals the
|
|
10
|
+
* source on that line, so inline editing is the path there.
|
|
11
|
+
* - External links only. A wikilink click is navigation (`onWikiLinkClick`);
|
|
12
|
+
* its target stays editable through hover + the right-click menu.
|
|
13
|
+
*/
|
|
14
|
+
import { ViewPlugin, type EditorView, type PluginValue } from "@codemirror/view";
|
|
15
|
+
declare class LinkClickEditor implements PluginValue {
|
|
16
|
+
private menu;
|
|
17
|
+
private contentDOM;
|
|
18
|
+
private onClick;
|
|
19
|
+
constructor(view: EditorView);
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
22
|
+
export declare const linkClickEditor: ViewPlugin<LinkClickEditor, undefined>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=link-click.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-click.d.ts","sourceRoot":"","sources":["../../src/inplace/link-click.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAKhF,cAAM,eAAgB,YAAW,WAAW;IAC1C,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAyB;IAExC,YAAY,IAAI,EAAE,UAAU,EAsB3B;IAED,OAAO,SAGN;CACF;AAED,eAAO,MAAM,eAAe,wCAAwC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hover a link or wikilink in the in-place canvas and a small bubble shows where
|
|
3
|
+
* it points — the raw `(url)` of a `[text](url)`, or the `[[target]]`. Under
|
|
4
|
+
* `reveal: "never"` the destination is otherwise never on screen, so this is the
|
|
5
|
+
* read affordance for it (ADR-007 Stage 5, the hover half).
|
|
6
|
+
*/
|
|
7
|
+
import { type Tooltip } from "@codemirror/view";
|
|
8
|
+
export declare const linkHoverTooltip: import("@codemirror/state").Extension & {
|
|
9
|
+
active: import("@codemirror/state").StateField<readonly Tooltip[]>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=link-hover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-hover.d.ts","sourceRoot":"","sources":["../../src/inplace/link-hover.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAoD9E,eAAO,MAAM,gBAAgB;;CAM3B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vertical indent guides for nested lists on the in-place canvas — one faint
|
|
3
|
+
* rule per nesting level, drawn from the list's left padding (Obsidian /
|
|
4
|
+
* Notion). Purely decorative: a `.cm-inplace-li` line decoration carrying the
|
|
5
|
+
* nesting depth in `--sl-li-depth`, which the theme turns into that many guide
|
|
6
|
+
* rules via a background gradient.
|
|
7
|
+
*
|
|
8
|
+
* Only a list item's *own* lines are decorated — the range stops before its
|
|
9
|
+
* first nested list — so each line's depth is its innermost item's.
|
|
10
|
+
*/
|
|
11
|
+
import type { Range, Text } from "@codemirror/state";
|
|
12
|
+
import { Decoration } from "@codemirror/view";
|
|
13
|
+
import type { ResolvedToggles } from "./config";
|
|
14
|
+
import type { Tree } from "./scan";
|
|
15
|
+
export declare function scanListGuides(from: number, to: number, tree: Tree, doc: Text, toggles: ResolvedToggles, out: Range<Decoration>[]): void;
|
|
16
|
+
//# sourceMappingURL=list-guides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-guides.d.ts","sourceRoot":"","sources":["../../src/inplace/list-guides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAWlC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,CA4BN"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Touch / pen long-press detection.
|
|
3
|
+
*
|
|
4
|
+
* A mouse gets the context menu from the native `contextmenu` event on
|
|
5
|
+
* right-click. A touch device has no dependable equivalent — iOS Safari in
|
|
6
|
+
* particular races its own selection callout on a long-press and usually wins,
|
|
7
|
+
* so `contextmenu` never arrives. This runs a plain timer instead: pointer
|
|
8
|
+
* down, hold still for `delay` ms, and `onLongPress` fires with the contact
|
|
9
|
+
* point.
|
|
10
|
+
*
|
|
11
|
+
* Mouse pointers are ignored — they already have `contextmenu`. Moving past
|
|
12
|
+
* `slop` pixels, or lifting / cancelling before the timer, aborts the press.
|
|
13
|
+
* `cancel()` aborts a pending press without detaching — the caller uses it when
|
|
14
|
+
* a real `contextmenu` lands first (Android synthesises one from the same
|
|
15
|
+
* gesture) so the two paths can't both open the menu.
|
|
16
|
+
*
|
|
17
|
+
* The defaults are tuned for a fingertip, not a stylus: a finger cannot hold a
|
|
18
|
+
* contact point to within a few pixels for half a second, so `slop` is generous
|
|
19
|
+
* and `delay` sits just under the ~500 ms where iOS Safari commits to its own
|
|
20
|
+
* long-press selection.
|
|
21
|
+
*/
|
|
22
|
+
export interface LongPressOptions {
|
|
23
|
+
/** Hold time before the press completes. Default 450 ms. */
|
|
24
|
+
delay?: number;
|
|
25
|
+
/** Movement (from the contact point, on either axis) that aborts it. Default 20 px. */
|
|
26
|
+
slop?: number;
|
|
27
|
+
/** Fired when the hold completes: viewport coordinates and the element the
|
|
28
|
+
* finger first landed on. */
|
|
29
|
+
onLongPress: (x: number, y: number, target: EventTarget | null) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface LongPressHandle {
|
|
32
|
+
/** Abort a press in progress; keeps the listeners attached. */
|
|
33
|
+
cancel: () => void;
|
|
34
|
+
/** Abort and detach every listener. */
|
|
35
|
+
dispose: () => void;
|
|
36
|
+
}
|
|
37
|
+
/** Attach long-press detection to `el`. */
|
|
38
|
+
export declare function attachLongPress(el: HTMLElement, opts: LongPressOptions): LongPressHandle;
|
|
39
|
+
//# sourceMappingURL=long-press.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-press.d.ts","sourceRoot":"","sources":["../../src/inplace/long-press.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;kCAC8B;IAC9B,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACxE;AAED,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,uCAAuC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,2CAA2C;AAC3C,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,gBAAgB,GAAG,eAAe,CA8CxF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Range, StateField } from "@codemirror/state";
|
|
2
|
+
import { Decoration, type DecorationSet, EditorView } from "@codemirror/view";
|
|
3
|
+
import { type Tree } from "./scan";
|
|
4
|
+
/**
|
|
5
|
+
* Viewport pass for `$…$` and single-line `$$…$$` — the CodeMirror grammar has
|
|
6
|
+
* no math node. Off-caret matches become KaTeX widgets. Multi-line `$$` blocks
|
|
7
|
+
* are handled by `blockMathField` instead (a plugin may not replace line breaks).
|
|
8
|
+
*/
|
|
9
|
+
export declare function scanInlineMath(view: EditorView, from: number, to: number, revealed: Set<number>, tree: Tree, out: Range<Decoration>[]): void;
|
|
10
|
+
/**
|
|
11
|
+
* Multi-line `$$…$$` blocks, whose delimiters sit alone on their own lines.
|
|
12
|
+
* A state field (not a plugin) because the replacement spans line breaks. Not
|
|
13
|
+
* viewport-scoped — the whole document is scanned — but `$$` blocks are few.
|
|
14
|
+
*/
|
|
15
|
+
export declare const blockMathField: StateField<DecorationSet>;
|
|
16
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/inplace/math.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAA;AAIzF,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AAmChE;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,CAyBN;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,2BASzB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns the in-place right-click menu: one `ContextMenu` per editor, a
|
|
3
|
+
* `contextmenu` listener on the content DOM, and the rule for when Stylo takes
|
|
4
|
+
* over from the browser's own menu (see the 2026-09-03 journal note). On touch
|
|
5
|
+
* there is no `contextmenu` event, so a long-press opens the same menu.
|
|
6
|
+
*/
|
|
7
|
+
import { ViewPlugin, type EditorView, type PluginValue } from "@codemirror/view";
|
|
8
|
+
declare class ContextMenuController implements PluginValue {
|
|
9
|
+
private view;
|
|
10
|
+
private menu;
|
|
11
|
+
private onContextMenu;
|
|
12
|
+
private onPointerDown;
|
|
13
|
+
private longPress;
|
|
14
|
+
private contentDOM;
|
|
15
|
+
/** Selection captured at pointer-down — a right-click can collapse it before
|
|
16
|
+
* `contextmenu` fires, which would drop the selection-aware menu rows. */
|
|
17
|
+
private stashed;
|
|
18
|
+
/** When a long-press last opened the menu. Android also synthesises a
|
|
19
|
+
* `contextmenu` from the same gesture; one that lands within the window is
|
|
20
|
+
* swallowed so the menu does not re-open on top of itself. */
|
|
21
|
+
private longPressAt;
|
|
22
|
+
constructor(view: EditorView);
|
|
23
|
+
/** Open the canvas menu at a screen point, from a right-click or a long-press.
|
|
24
|
+
* Reconciles the selection first so the menu offers the right rows. */
|
|
25
|
+
private openMenuAt;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const contextMenuLayer: ViewPlugin<ContextMenuController, undefined>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=menu-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-plugin.d.ts","sourceRoot":"","sources":["../../src/inplace/menu-plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAOhF,cAAM,qBAAsB,YAAW,WAAW;IAChD,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,UAAU,CAAa;IAC/B;+EAC2E;IAC3E,OAAO,CAAC,OAAO,CAAgD;IAC/D;;mEAE+D;IAC/D,OAAO,CAAC,WAAW,CAAI;IAEvB,YAAY,IAAI,EAAE,UAAU,EA4C3B;IAED;4EACwE;IACxE,OAAO,CAAC,UAAU;IAiClB,OAAO,SAKN;CACF;AAED,eAAO,MAAM,gBAAgB,8CAA8C,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Range, Text } from "@codemirror/state";
|
|
2
|
+
import { Decoration } from "@codemirror/view";
|
|
3
|
+
import type { SyntaxNodeRef } from "@lezer/common";
|
|
4
|
+
import type { ResolvedToggles } from "./config";
|
|
5
|
+
export interface NodeCtx {
|
|
6
|
+
doc: Text;
|
|
7
|
+
revealed: Set<number>;
|
|
8
|
+
/** Lines the caret actually touches. Equals `revealed` except under
|
|
9
|
+
* `reveal: "never"`, where `revealed` is empty but this is not — a few
|
|
10
|
+
* constructs (fenced code) still reveal their delimiters on caret entry
|
|
11
|
+
* because there is no other way to see or remove them. */
|
|
12
|
+
caretRevealed: Set<number>;
|
|
13
|
+
out: Range<Decoration>[];
|
|
14
|
+
toggles: ResolvedToggles;
|
|
15
|
+
/** End of the frontmatter block, or -1. Nodes within are left to `frontmatterField`. */
|
|
16
|
+
fmEnd: number;
|
|
17
|
+
/** Lines of a blockquote / callout whose block the caret is in — its `> ` and
|
|
18
|
+
* `[!type]` markers show raw, like a fenced code / `$$` block. Filled by the
|
|
19
|
+
* `Blockquote` handler before its `QuoteMark` children are visited. */
|
|
20
|
+
quoteRevealed: Set<number>;
|
|
21
|
+
}
|
|
22
|
+
/** Decorate one syntax node. Returns `false` to stop descent, `undefined` to continue. */
|
|
23
|
+
export declare function decorateNode(node: SyntaxNodeRef, ctx: NodeCtx): boolean | undefined;
|
|
24
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/inplace/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAgB/C,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,IAAI,CAAA;IACT,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrB;;;+DAG2D;IAC3D,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAA;IACxB,OAAO,EAAE,eAAe,CAAA;IACxB,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAA;IACb;;4EAEwE;IACxE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC3B;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAgPnF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Extension } from "@codemirror/state";
|
|
2
|
+
import { type DecorationSet, ViewPlugin, type ViewUpdate } from "@codemirror/view";
|
|
3
|
+
/**
|
|
4
|
+
* Owns the in-place decoration set and rebuilds it when the document, the
|
|
5
|
+
* viewport, or the selection changes. Selection is a trigger because the
|
|
6
|
+
* cursor-reveal behaviour depends on where the caret sits.
|
|
7
|
+
*
|
|
8
|
+
* Also provides `EditorView.atomicRanges` covering every replacing decoration —
|
|
9
|
+
* hidden markers and widgets alike — so the caret steps over hidden syntax
|
|
10
|
+
* instead of into invisible positions.
|
|
11
|
+
*
|
|
12
|
+
* Exported (not just the factory) so tests can read the live sets via
|
|
13
|
+
* `view.plugin(inPlacePlugin)`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const inPlacePlugin: ViewPlugin<{
|
|
16
|
+
decorations: DecorationSet;
|
|
17
|
+
atomic: DecorationSet;
|
|
18
|
+
update(update: ViewUpdate): void;
|
|
19
|
+
}, undefined>;
|
|
20
|
+
export declare function inPlaceDecorations(): Extension;
|
|
21
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/inplace/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAEL,KAAK,aAAa,EAElB,UAAU,EACV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAA;AAGzB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;iBAET,aAAa;YAClB,aAAa;mBAQN,UAAU;aAa5B,CAAA;AAED,wBAAgB,kBAAkB,IAAI,SAAS,CAE9C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EditorState } from "@codemirror/state";
|
|
2
|
+
/**
|
|
3
|
+
* Line numbers (1-based) that a selection range currently touches. A node whose
|
|
4
|
+
* line is in this set keeps its raw Markdown markers visible for editing;
|
|
5
|
+
* elsewhere the decoration builder hides them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function revealedLines(state: EditorState): Set<number>;
|
|
8
|
+
//# sourceMappingURL=reveal.d.ts.map
|