@damiro/stylo 0.4.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -10
- package/dist/{InPlaceView-Ba7JCZ2Y.js → InPlaceView-CS1qy-Ba.js} +277 -265
- package/dist/InPlaceView-CS1qy-Ba.js.map +1 -0
- package/dist/{Preview-Dxb9zPVv.js → Preview-Bw0k3Mev.js} +2 -2
- package/dist/{Preview-Dxb9zPVv.js.map → Preview-Bw0k3Mev.js.map} +1 -1
- package/dist/SplitView.d.ts +3 -2
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +4 -2
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/extensions.d.ts +2 -2
- package/dist/editor/extensions.d.ts.map +1 -1
- package/dist/editor/theme.d.ts.map +1 -1
- package/dist/editor/useCodeMirror.d.ts +4 -2
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/editor/wikilink-complete.d.ts +15 -0
- package/dist/editor/wikilink-complete.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +4 -2
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/context-menu.d.ts +1 -1
- package/dist/inplace/context-menu.d.ts.map +1 -1
- package/dist/inplace/extension.d.ts.map +1 -1
- package/dist/inplace/menu-open.d.ts +11 -0
- package/dist/inplace/menu-open.d.ts.map +1 -0
- package/dist/inplace/menu-plugin.d.ts +1 -0
- package/dist/inplace/menu-plugin.d.ts.map +1 -1
- package/dist/inplace/selection-bar.d.ts.map +1 -1
- package/dist/inplace/theme.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/stylo.js +58 -53
- package/dist/stylo.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-YnIFkvKn.js → useCodeMirror-GPSkaYW6.js} +204 -168
- package/dist/useCodeMirror-GPSkaYW6.js.map +1 -0
- package/dist/wikilink-CTR8IFKc.js +42 -0
- package/dist/wikilink-CTR8IFKc.js.map +1 -0
- package/package.json +4 -1
- package/dist/InPlaceView-Ba7JCZ2Y.js.map +0 -1
- package/dist/useCodeMirror-YnIFkvKn.js.map +0 -1
- package/dist/wikilink-BFpTehto.js +0 -42
- package/dist/wikilink-BFpTehto.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./markdown-N3lRmU2n.js";
|
|
2
|
-
import { i as o, r as s, t as c } from "./wikilink-
|
|
2
|
+
import { i as o, r as s, t as c } from "./wikilink-CTR8IFKc.js";
|
|
3
3
|
import { n as l, r as u } from "./callout-oLE630ZP.js";
|
|
4
4
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
5
|
//#region src/render/remark-callout.ts
|
|
@@ -90,4 +90,4 @@ function _({ value: t, onWikiLinkClick: n, frontmatter: r = "hidden" }) {
|
|
|
90
90
|
//#endregion
|
|
91
91
|
export { _ as Preview };
|
|
92
92
|
|
|
93
|
-
//# sourceMappingURL=Preview-
|
|
93
|
+
//# sourceMappingURL=Preview-Bw0k3Mev.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview-
|
|
1
|
+
{"version":3,"file":"Preview-Bw0k3Mev.js","names":[],"sources":["../src/render/remark-callout.ts","../src/render/remark-wikilink.ts","../src/render/Preview.tsx"],"sourcesContent":["import type { Blockquote, Root } from \"mdast\"\nimport { visit } from \"unist-util-visit\"\nimport { CALLOUT_TOKEN, calloutBucket } from \"../callout\"\n\n/**\n * Turns an Obsidian callout blockquote (`> [!note] Title`) into a\n * `<blockquote class=\"stylo-callout stylo-callout-<bucket>\" data-callout=\"note\">`.\n * The `[!type]` token is stripped from the first line; a `::before` label keyed\n * off `data-callout` stands in for it (matching the in-place canvas). The\n * `-` / `+` fold marker is accepted and ignored — the box always renders open.\n */\nexport function remarkCallout() {\n return (tree: Root) => {\n visit(tree, \"blockquote\", (node: Blockquote) => {\n const para = node.children[0]\n if (para?.type !== \"paragraph\") return\n const first = para.children[0]\n if (first?.type !== \"text\") return\n\n const m = CALLOUT_TOKEN.exec(first.value)\n if (!m) return\n\n first.value = first.value.slice(m[0].length)\n const type = m[1]!.toLowerCase()\n node.data ??= {}\n const props = (node.data.hProperties ??= {}) as Record<string, unknown>\n props.className = [\"stylo-callout\", `stylo-callout-${calloutBucket(type)}`]\n props[\"data-callout\"] = type\n })\n }\n}\n","import type { Link, Root, Text } from \"mdast\"\nimport { visit } from \"unist-util-visit\"\nimport { WIKILINK_PATTERN } from \"../wikilink\"\n\n/**\n * Rewrites `[[target]]` and `[[target|label]]` inside text into link nodes that\n * carry a `data-wikilink` attribute holding the target. The rendered href is\n * inert (`#`); navigation is the host's job via `onWikiLinkClick`.\n */\nexport function remarkWikilink() {\n return (tree: Root) => {\n visit(tree, \"text\", (node: Text, index, parent) => {\n if (parent == null || index == null || !node.value.includes(\"[[\")) return\n\n const out: Array<Text | Link> = []\n let cursor = 0\n\n for (const match of node.value.matchAll(WIKILINK_PATTERN)) {\n const [raw = \"\", rawTarget = \"\", rawLabel] = match\n const start = match.index ?? 0\n if (start > cursor) {\n out.push({ type: \"text\", value: node.value.slice(cursor, start) })\n }\n out.push({\n type: \"link\",\n url: \"#\",\n data: { hProperties: { \"data-wikilink\": rawTarget.trim() } },\n children: [{ type: \"text\", value: (rawLabel ?? rawTarget).trim() }],\n })\n cursor = start + raw.length\n }\n\n if (cursor === 0) return\n if (cursor < node.value.length) {\n out.push({ type: \"text\", value: node.value.slice(cursor) })\n }\n\n parent.children.splice(index, 1, ...out)\n return index + out.length\n })\n }\n}\n","import Markdown, { type Components } from \"react-markdown\"\nimport rehypeKatex from \"rehype-katex\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkMath from \"remark-math\"\nimport { splitFrontmatter } from \"../frontmatter\"\nimport styles from \"../styles/stylo.module.css\"\nimport type { FrontmatterDisplay } from \"../types\"\nimport { remarkCallout } from \"./remark-callout\"\nimport { remarkWikilink } from \"./remark-wikilink\"\n\nconst REMARK_PLUGINS = [remarkFrontmatter, remarkGfm, remarkMath, remarkWikilink, remarkCallout]\nconst REHYPE_PLUGINS = [rehypeKatex]\n\nexport interface PreviewProps {\n value: string\n onWikiLinkClick?: (target: string) => void\n /** `\"code\"` renders the `---` block as a styled `<pre>`; `\"hidden\"` (default) drops it. */\n frontmatter?: FrontmatterDisplay\n}\n\n/** Rendered Markdown + KaTeX view. A pure function of the string. */\nexport function Preview({ value, onWikiLinkClick, frontmatter = \"hidden\" }: PreviewProps) {\n const fm = frontmatter === \"code\" ? splitFrontmatter(value) : null\n const components: Components = {\n a({ node: _node, children, ...rest }) {\n const target = (rest as Record<string, unknown>)[\"data-wikilink\"]\n if (typeof target === \"string\") {\n return (\n <a\n {...rest}\n href=\"#\"\n onClick={(event) => {\n event.preventDefault()\n onWikiLinkClick?.(target)\n }}\n >\n {children}\n </a>\n )\n }\n return (\n <a {...rest} rel=\"noreferrer\">\n {children}\n </a>\n )\n },\n }\n\n return (\n <div className={styles.preview}>\n {fm && <div className=\"stylo-frontmatter\">{fm.frontmatter}</div>}\n <Markdown\n remarkPlugins={REMARK_PLUGINS}\n rehypePlugins={REHYPE_PLUGINS}\n components={components}\n >\n {value}\n </Markdown>\n </div>\n )\n}\n"],"mappings":";;;;;AAWA,SAAgB,IAAgB;CAC9B,QAAQ,MAAe;EACrB,EAAM,GAAM,eAAe,MAAqB;GAC9C,IAAM,IAAO,EAAK,SAAS;GAC3B,IAAI,GAAM,SAAS,aAAa;GAChC,IAAM,IAAQ,EAAK,SAAS;GAC5B,IAAI,GAAO,SAAS,QAAQ;GAE5B,IAAM,IAAI,EAAc,KAAK,EAAM,KAAK;GACxC,IAAI,CAAC,GAAG;GAER,EAAM,QAAQ,EAAM,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM;GAC3C,IAAM,IAAO,EAAE,EAAE,CAAE,YAAY;GAC/B,EAAK,SAAS,CAAC;GACf,IAAM,IAAS,EAAK,KAAK,gBAAgB,CAAC;GAE1C,AADA,EAAM,YAAY,CAAC,iBAAiB,iBAAiB,EAAc,CAAI,GAAG,GAC1E,EAAM,kBAAkB;EAC1B,CAAC;CACH;AACF;;;ACrBA,SAAgB,IAAiB;CAC/B,QAAQ,MAAe;EACrB,EAAM,GAAM,SAAS,GAAY,GAAO,MAAW;GACjD,IAAI,KAAU,QAAQ,KAAS,QAAQ,CAAC,EAAK,MAAM,SAAS,IAAI,GAAG;GAEnE,IAAM,IAA0B,CAAC,GAC7B,IAAS;GAEb,KAAK,IAAM,KAAS,EAAK,MAAM,SAAS,CAAgB,GAAG;IACzD,IAAM,CAAC,IAAM,IAAI,IAAY,IAAI,KAAY,GACvC,IAAQ,EAAM,SAAS;IAU7B,AATI,IAAQ,KACV,EAAI,KAAK;KAAE,MAAM;KAAQ,OAAO,EAAK,MAAM,MAAM,GAAQ,CAAK;IAAE,CAAC,GAEnE,EAAI,KAAK;KACP,MAAM;KACN,KAAK;KACL,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAU,KAAK,EAAE,EAAE;KAC3D,UAAU,CAAC;MAAE,MAAM;MAAQ,QAAQ,KAAY,EAAA,CAAW,KAAK;KAAE,CAAC;IACpE,CAAC,GACD,IAAS,IAAQ,EAAI;GACvB;GAEI,UAAW,GAMf,OALI,IAAS,EAAK,MAAM,UACtB,EAAI,KAAK;IAAE,MAAM;IAAQ,OAAO,EAAK,MAAM,MAAM,CAAM;GAAE,CAAC,GAG5D,EAAO,SAAS,OAAO,GAAO,GAAG,GAAG,CAAG,GAChC,IAAQ,EAAI;EACrB,CAAC;CACH;AACF;;;AC9BA,IAAM,IAAiB;CAAC;CAAmB;CAAW;CAAY;CAAgB;AAAa,GACzF,IAAiB,CAAC,CAAW;AAUnC,SAAgB,EAAQ,EAAE,UAAO,oBAAiB,iBAAc,YAA0B;CACxF,IAAM,IAAK,MAAgB,SAAS,EAAiB,CAAK,IAAI;CA0B9D,OACE,kBAAC,OAAD;EAAK,WAAW,EAAO;EAAvB,UAAA,CACG,KAAM,kBAAC,OAAD;GAAK,WAAU;GAAqB,UAAA,EAAG;EAAiB,CAAA,GAC/D,kBAAC,GAAD;GACE,eAAe;GACf,eAAe;GACH,YAAA,EA9BhB,EAAE,EAAE,MAAM,GAAO,aAAU,GAAG,KAAQ;IACpC,IAAM,IAAU,EAAiC;IAejD,OAdI,OAAO,KAAW,WAElB,kBAAC,KAAD;KACE,GAAI;KACJ,MAAK;KACL,UAAU,MAAU;MAElB,AADA,EAAM,eAAe,GACrB,IAAkB,CAAM;KAC1B;KAEC;IACA,CAAA,IAIL,kBAAC,KAAD;KAAG,GAAI;KAAM,KAAI;KACd;IACA,CAAA;GAEP,EASgB;GAEX,UAAA;EACO,CAAA,CACP;;AAET"}
|
package/dist/SplitView.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from "@codemirror/view";
|
|
2
|
-
import type { CodeLanguages, FrontmatterDisplay } from "./types";
|
|
2
|
+
import type { CodeLanguages, FrontmatterDisplay, WikiLinkSource } from "./types";
|
|
3
3
|
export interface SplitViewProps {
|
|
4
4
|
value: string;
|
|
5
5
|
onChange: (next: string) => void;
|
|
@@ -7,6 +7,7 @@ export interface SplitViewProps {
|
|
|
7
7
|
readOnly?: boolean;
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
codeLanguages?: CodeLanguages;
|
|
10
|
+
wikiLinkSource?: WikiLinkSource;
|
|
10
11
|
frontmatter?: FrontmatterDisplay;
|
|
11
12
|
/** Called with the doc string on `Mod-s`. */
|
|
12
13
|
onSave?: (value: string) => void;
|
|
@@ -19,5 +20,5 @@ export interface SplitViewProps {
|
|
|
19
20
|
* Stylo root to have a bounded height — otherwise both panes grow and the page
|
|
20
21
|
* scrolls instead.
|
|
21
22
|
*/
|
|
22
|
-
export declare function SplitView({ value, onChange, onWikiLinkClick, readOnly, placeholder, codeLanguages, frontmatter, onSave, onViewChange, }: SplitViewProps): import("react").JSX.Element;
|
|
23
|
+
export declare function SplitView({ value, onChange, onWikiLinkClick, readOnly, placeholder, codeLanguages, wikiLinkSource, frontmatter, onSave, onViewChange, }: SplitViewProps): import("react").JSX.Element;
|
|
23
24
|
//# sourceMappingURL=SplitView.d.ts.map
|
package/dist/SplitView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitView.d.ts","sourceRoot":"","sources":["../src/SplitView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SplitView.d.ts","sourceRoot":"","sources":["../src/SplitView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;CACjD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,WAAW,EACX,MAAM,EACN,YAAY,GACb,EAAE,cAAc,+BAyDhB"}
|
package/dist/Stylo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stylo.d.ts","sourceRoot":"","sources":["../src/Stylo.tsx"],"names":[],"mappings":"AAUA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Stylo.d.ts","sourceRoot":"","sources":["../src/Stylo.tsx"],"names":[],"mappings":"AAUA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,oGA4JhB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from "@codemirror/view";
|
|
2
|
-
import type { CodeLanguages } from "../types";
|
|
2
|
+
import type { CodeLanguages, WikiLinkSource } from "../types";
|
|
3
3
|
export interface SourceViewProps {
|
|
4
4
|
value: string;
|
|
5
5
|
onChange: (next: string) => void;
|
|
@@ -7,11 +7,13 @@ export interface SourceViewProps {
|
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
/** Fenced-code grammars, forwarded to the Markdown language. Read once. */
|
|
9
9
|
codeLanguages?: CodeLanguages;
|
|
10
|
+
/** `[[wikilink]]` autocomplete source. Read once. */
|
|
11
|
+
wikiLinkSource?: WikiLinkSource;
|
|
10
12
|
/** Called with the doc string on `Mod-s`. */
|
|
11
13
|
onSave?: (value: string) => void;
|
|
12
14
|
/** Called with the `EditorView` once created, and with `null` on teardown. */
|
|
13
15
|
onViewChange?: (view: EditorView | null) => void;
|
|
14
16
|
}
|
|
15
17
|
/** Raw CodeMirror 6 Markdown surface bound to the canonical string. */
|
|
16
|
-
export declare function SourceView({ value, onChange, readOnly, placeholder, codeLanguages, onSave, onViewChange, }: SourceViewProps): import("react").JSX.Element;
|
|
18
|
+
export declare function SourceView({ value, onChange, readOnly, placeholder, codeLanguages, wikiLinkSource, onSave, onViewChange, }: SourceViewProps): import("react").JSX.Element;
|
|
17
19
|
//# sourceMappingURL=SourceView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceView.d.ts","sourceRoot":"","sources":["../../src/editor/SourceView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"SourceView.d.ts","sourceRoot":"","sources":["../../src/editor/SourceView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG7D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;CACjD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,MAAM,EACN,YAAY,GACb,EAAE,eAAe,+BAYjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
|
-
import type { CodeLanguages } from "../types";
|
|
2
|
+
import type { CodeLanguages, WikiLinkSource } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Static extensions — created once with the view.
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ import type { CodeLanguages } from "../types";
|
|
|
10
10
|
* consumer opts in with exactly the set they want. See the 2026-09-01 journal
|
|
11
11
|
* note and the ADR-001 amendment.
|
|
12
12
|
*/
|
|
13
|
-
export declare function baseExtensions(codeLanguages?: CodeLanguages): Extension;
|
|
13
|
+
export declare function baseExtensions(codeLanguages?: CodeLanguages, wikiLinkSource?: WikiLinkSource): Extension;
|
|
14
14
|
/** Extensions that depend on props and are swapped via a compartment on change. */
|
|
15
15
|
export declare function dynamicConfig(opts: {
|
|
16
16
|
readOnly: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/editor/extensions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAA;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/editor/extensions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAA;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAM7D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,aAAa,CAAC,EAAE,aAAa,EAC7B,cAAc,CAAC,EAAE,cAAc,GAC9B,SAAS,CAqBX;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,GAAG,SAAS,CAOZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/editor/theme.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/editor/theme.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,UAAU,uCAuFrB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
2
|
import { EditorView } from "@codemirror/view";
|
|
3
|
-
import type { CodeLanguages } from "../types";
|
|
3
|
+
import type { CodeLanguages, WikiLinkSource } from "../types";
|
|
4
4
|
export interface UseCodeMirrorOptions {
|
|
5
5
|
value: string;
|
|
6
6
|
onChange: (next: string) => void;
|
|
@@ -17,10 +17,12 @@ export interface UseCodeMirrorOptions {
|
|
|
17
17
|
extensions?: Extension[];
|
|
18
18
|
/** Fenced-code grammars, forwarded to the Markdown language. Read once. */
|
|
19
19
|
codeLanguages?: CodeLanguages;
|
|
20
|
+
/** `[[wikilink]]` autocomplete source. Read once. */
|
|
21
|
+
wikiLinkSource?: WikiLinkSource;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Owns a CodeMirror `EditorView` for the lifetime of the host element and keeps
|
|
23
25
|
* it in sync with a controlled Markdown string. Returns a ref for the container.
|
|
24
26
|
*/
|
|
25
|
-
export declare function useCodeMirror({ value, onChange, readOnly, placeholder, onSave, onViewChange, extensions, codeLanguages, }: UseCodeMirrorOptions): import("react").RefObject<HTMLDivElement | null>;
|
|
27
|
+
export declare function useCodeMirror({ value, onChange, readOnly, placeholder, onSave, onViewChange, extensions, codeLanguages, wikiLinkSource, }: UseCodeMirrorOptions): import("react").RefObject<HTMLDivElement | null>;
|
|
26
28
|
//# sourceMappingURL=useCodeMirror.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/editor/useCodeMirror.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/editor/useCodeMirror.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAO7D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,oFAAoF;IACpF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAChD;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;IACxB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,WAAW,EACX,MAAM,EACN,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,GACf,EAAE,oBAAoB,oDAwEtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CompletionContext, type CompletionResult } from "@codemirror/autocomplete";
|
|
2
|
+
import type { Extension } from "@codemirror/state";
|
|
3
|
+
import type { WikiLinkSource } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* The completion source. Exposed for unit tests; consumers use
|
|
6
|
+
* `wikilinkCompletion`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function wikilinkCompletionSource(source: WikiLinkSource): (ctx: CompletionContext) => Promise<CompletionResult | null>;
|
|
9
|
+
/**
|
|
10
|
+
* `[[wikilink]]` autocomplete. Off unless the host passes `wikiLinkSource`.
|
|
11
|
+
* Registered through the Markdown language data, so it is inert inside a fenced
|
|
12
|
+
* code block and leaves any embedded-language completions intact.
|
|
13
|
+
*/
|
|
14
|
+
export declare function wikilinkCompletion(source?: WikiLinkSource): Extension;
|
|
15
|
+
//# sourceMappingURL=wikilink-complete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wikilink-complete.d.ts","sourceRoot":"","sources":["../../src/editor/wikilink-complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,UAAU,CAAA;AAyBlE;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,SAC1C,iBAAiB,KAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAiBxE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAMrE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Stylo } from "./Stylo";
|
|
2
2
|
export { splitFrontmatter } from "./frontmatter";
|
|
3
|
-
export type { CodeLanguages, FrontmatterDisplay, InPlaceConfig, InPlaceDecorationToggles, RevealMode, SelectionUI, StyloHandle, StyloMode, StyloProps, TableEditing, ToolbarCommandId, ToolbarConfig, ToolbarCustomItem, ToolbarItem, } from "./types";
|
|
3
|
+
export type { CodeLanguages, FrontmatterDisplay, InPlaceConfig, InPlaceDecorationToggles, RevealMode, SelectionUI, StyloHandle, StyloMode, StyloProps, TableEditing, ToolbarCommandId, ToolbarConfig, ToolbarCustomItem, ToolbarItem, WikiLinkCompletion, WikiLinkSource, } from "./types";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,cAAc,GACf,MAAM,SAAS,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from "@codemirror/view";
|
|
2
|
-
import type { CodeLanguages, InPlaceConfig } from "../types";
|
|
2
|
+
import type { CodeLanguages, InPlaceConfig, WikiLinkSource } from "../types";
|
|
3
3
|
export interface InPlaceViewProps {
|
|
4
4
|
value: string;
|
|
5
5
|
onChange: (next: string) => void;
|
|
@@ -12,6 +12,8 @@ export interface InPlaceViewProps {
|
|
|
12
12
|
inPlace?: InPlaceConfig;
|
|
13
13
|
/** Fenced-code grammars, forwarded to the Markdown language. Read once. */
|
|
14
14
|
codeLanguages?: CodeLanguages;
|
|
15
|
+
/** `[[wikilink]]` autocomplete source. Read once. */
|
|
16
|
+
wikiLinkSource?: WikiLinkSource;
|
|
15
17
|
/** Called with the doc string on `Mod-s`. */
|
|
16
18
|
onSave?: (value: string) => void;
|
|
17
19
|
/** Called with the `EditorView` once created, and with `null` on teardown. */
|
|
@@ -26,5 +28,5 @@ export interface InPlaceViewProps {
|
|
|
26
28
|
* `onWikiLinkClick` is reached through a ref so a changed handler does not force
|
|
27
29
|
* the editor to be rebuilt.
|
|
28
30
|
*/
|
|
29
|
-
export declare function InPlaceView({ value, onChange, readOnly, placeholder, onWikiLinkClick, onLinkClick, inPlace, codeLanguages, onSave, onViewChange, }: InPlaceViewProps): import("react").JSX.Element;
|
|
31
|
+
export declare function InPlaceView({ value, onChange, readOnly, placeholder, onWikiLinkClick, onLinkClick, inPlace, codeLanguages, wikiLinkSource, onSave, onViewChange, }: InPlaceViewProps): import("react").JSX.Element;
|
|
30
32
|
//# sourceMappingURL=InPlaceView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InPlaceView.d.ts","sourceRoot":"","sources":["../../src/inplace/InPlaceView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"InPlaceView.d.ts","sourceRoot":"","sources":["../../src/inplace/InPlaceView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG5E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;CACjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,cAAc,EACd,MAAM,EACN,YAAY,GACb,EAAE,gBAAgB,+BA2BlB"}
|
|
@@ -46,5 +46,5 @@ export interface ContextMenu {
|
|
|
46
46
|
/** Remove the element and drop document listeners. */
|
|
47
47
|
destroy: () => void;
|
|
48
48
|
}
|
|
49
|
-
export declare function createContextMenu(doc: Document, className?: string): ContextMenu;
|
|
49
|
+
export declare function createContextMenu(doc: Document, className?: string, onOpenChange?: (open: boolean) => void): ContextMenu;
|
|
50
50
|
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -1 +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,
|
|
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,CAC/B,GAAG,EAAE,QAAQ,EACb,SAAS,SAAoB,EAC7B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GACrC,WAAW,CAgPb"}
|
|
@@ -1 +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;
|
|
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;AA8B7C,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,CA+DrE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateField } from "@codemirror/state";
|
|
2
|
+
/**
|
|
3
|
+
* Tracks whether the in-place right-click menu is open. The selection bar reads
|
|
4
|
+
* it and steps aside while the menu is up, rather than the two floating popups
|
|
5
|
+
* overlapping at the same `z-index` with no awareness of each other. The menu
|
|
6
|
+
* controller (`menu-plugin.ts`) dispatches `setMenuOpen` on open and on every
|
|
7
|
+
* dismissal path.
|
|
8
|
+
*/
|
|
9
|
+
export declare const setMenuOpen: import("@codemirror/state").StateEffectType<boolean>;
|
|
10
|
+
export declare const menuOpenField: StateField<boolean>;
|
|
11
|
+
//# sourceMappingURL=menu-open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-open.d.ts","sourceRoot":"","sources":["../../src/inplace/menu-open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,sDAAgC,CAAA;AAExD,eAAO,MAAM,aAAa,qBAMxB,CAAA"}
|
|
@@ -19,6 +19,7 @@ declare class ContextMenuController implements PluginValue {
|
|
|
19
19
|
* `contextmenu` from the same gesture; one that lands within the window is
|
|
20
20
|
* swallowed so the menu does not re-open on top of itself. */
|
|
21
21
|
private longPressAt;
|
|
22
|
+
private destroyed;
|
|
22
23
|
constructor(view: EditorView);
|
|
23
24
|
/** Open the canvas menu at a screen point, from a right-click or a long-press.
|
|
24
25
|
* Reconciles the selection first so the menu offers the right rows. */
|
|
@@ -1 +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;
|
|
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;AAQhF,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;IACvB,OAAO,CAAC,SAAS,CAAQ;IAEzB,YAAY,IAAI,EAAE,UAAU,EAmD3B;IAED;4EACwE;IACxE,OAAO,CAAC,UAAU;IAiClB,OAAO,SAMN;CACF;AAED,eAAO,MAAM,gBAAgB,8CAA8C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-bar.d.ts","sourceRoot":"","sources":["../../src/inplace/selection-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"selection-bar.d.ts","sourceRoot":"","sources":["../../src/inplace/selection-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAiBjG,cAAM,YAAa,YAAW,WAAW;IAe3B,OAAO,CAAC,IAAI;IAdxB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,GAAG,CAAoB;IAC/B,OAAO,CAAC,OAAO,CAAiD;IAChE,OAAO,CAAC,QAAQ,CAAa;IAG7B,OAAO,CAAC,QAAQ,CAEf;IAED,OAAO,CAAC,iBAAiB,CAExB;IAED,YAAoB,IAAI,EAAE,UAAU,EAiDnC;IAED,MAAM,CAAC,CAAC,EAAE,UAAU,QAMnB;IAED;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAQhB,2EAA2E;IAC3E,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,OAAO;IAyCf,OAAO,CAAC,KAAK;IAcb,OAAO,SAMN;CACF;AASD,eAAO,MAAM,YAAY,qCAAqC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/inplace/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/inplace/theme.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,uCAuavB,CAAA"}
|
package/dist/styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
._root_18e48_1{min-height:0;color:var(--stylo-text);background:var(--stylo-bg);border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);flex-direction:column;display:flex;overflow:hidden}._root_18e48_1 .cm-scroller{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--stylo-border) 90%, transparent) transparent}._root_18e48_1 .cm-scroller::-webkit-scrollbar{width:10px;height:10px}._root_18e48_1 .cm-scroller::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--stylo-border) 90%, transparent);background-clip:padding-box;border:3px solid #0000;border-radius:6px}._root_18e48_1 .cm-scroller::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--stylo-text-muted) 55%, transparent);background-clip:padding-box}._root_18e48_1 .cm-scroller::-webkit-scrollbar-corner{background:0 0}._source_18e48_42{flex:auto;min-height:0;overflow:auto}._source_18e48_42 .cm-editor{height:100%}._source_18e48_42 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._inplace_18e48_57{flex:auto;min-height:0;overflow:auto}._toolbar_18e48_63{background:var(--stylo-bg);border-bottom:1px solid var(--stylo-border);flex-wrap:wrap;align-items:center;gap:2px;padding:4px 6px;display:flex}._toolbarButton_18e48_73{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 3px);min-width:28px;height:28px;color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0 5px;font-size:.75rem;font-weight:600;line-height:1;display:inline-flex}._toolbarButton_18e48_73:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._toolbarButton_18e48_73[data-active]{background:color-mix(in srgb, var(--stylo-accent) 12%, transparent);color:var(--stylo-text)}._toolbarButton_18e48_73:disabled{opacity:.4;cursor:default}._toolbarButton_18e48_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._toolbarButton_18e48_73 svg{width:16px;height:16px;display:block}._toolbarButton_18e48_73 code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.8125rem;font-weight:500}._toolbarSep_18e48_125{background:var(--stylo-border);align-self:stretch;width:1px;margin:4px 3px}._toolbarSticky_18e48_135{z-index:50;-webkit-overflow-scrolling:touch;scrollbar-width:none;flex-wrap:nowrap;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:opacity .15s;overflow-x:auto}._toolbarSticky_18e48_135::-webkit-scrollbar{display:none}._toolbarSticky_18e48_135 ._toolbarButton_18e48_73{flex:none;min-width:40px;height:40px}._toolbarStickyBottom_18e48_135{border-bottom:none;border-top:1px solid var(--stylo-border);box-shadow:0 -2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;bottom:0;left:0;right:0}._toolbarStickyTop_18e48_135{box-shadow:0 2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;top:0;left:0;right:0}._toolbarStickyHidden_18e48_194{opacity:0;pointer-events:none}._stickyToolbarRootBottom_18e48_205 ._source_18e48_42,._stickyToolbarRootBottom_18e48_205 ._inplace_18e48_57{padding-bottom:52px}._stickyToolbarRootTop_18e48_210 ._source_18e48_42,._stickyToolbarRootTop_18e48_210 ._inplace_18e48_57{padding-top:52px}._inplace_18e48_57 .cm-editor{height:100%}._inplace_18e48_57 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._split_18e48_224{flex:1;grid-template-columns:1fr 1fr;min-height:0;display:grid}._splitPane_18e48_231{box-sizing:border-box;flex-direction:column;min-height:0;display:flex;overflow:auto}._splitPane_18e48_231+._splitPane_18e48_231{border-left:1px solid var(--stylo-border)}._splitPane_18e48_231>._source_18e48_42{flex:1;min-height:0}._preview_18e48_251{overflow-wrap:break-word;padding:.75rem 1rem;font-size:.9375rem;line-height:1.75}._preview_18e48_251>:first-child{margin-top:0}._preview_18e48_251>:last-child{margin-bottom:0}._preview_18e48_251 :is(h1,h2,h3,h4,h5,h6){font-weight:600}._preview_18e48_251 h1{margin:0 0 .888889em;font-size:2.25em;line-height:1.11111}._preview_18e48_251 h2{margin:2em 0 1em;font-size:1.5em;line-height:1.33333}._preview_18e48_251 h3{margin:1.6em 0 .6em;font-size:1.25em;line-height:1.6}._preview_18e48_251 :is(h4,h5,h6){margin:1.5em 0 .5em;line-height:1.5}._preview_18e48_251 p{margin:1.25em 0}._preview_18e48_251 :is(ul,ol){margin:1.25em 0;padding-left:1.625em}._preview_18e48_251 li{margin:.5em 0}._preview_18e48_251 li>:is(ul,ol){margin:.75em 0}._preview_18e48_251 a{color:var(--stylo-link);text-decoration:none}._preview_18e48_251 code{border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 45%, transparent);padding:.1em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.9em}._preview_18e48_251 pre{border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-border) 35%, transparent);margin:1.71429em 0;padding:.75rem .9rem;overflow-x:auto}._preview_18e48_251 pre code{background:0 0;padding:0;font-size:.85em}.stylo-frontmatter{border-left:3px solid var(--stylo-border);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 22%, transparent);color:var(--stylo-text-muted);white-space:pre-wrap;margin:0 0 1.2em;padding:.7rem .9rem;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.8125rem;line-height:1.5;overflow-x:auto}.stylo-frontmatter:before{content:"Frontmatter";letter-spacing:.04em;text-transform:uppercase;margin-bottom:.5em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:.7rem;font-weight:600;display:block}._preview_18e48_251 blockquote{border-left:.25rem solid var(--stylo-border);color:var(--stylo-text-muted);margin:1.6em 0;padding-left:1em}._preview_18e48_251 .stylo-callout{border-left:.25rem solid var(--stylo-callout-accent,var(--stylo-border));border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-callout-accent,var(--stylo-border)) 10%, transparent);color:var(--stylo-text);margin:1.6em 0;padding:.6em 1em}._preview_18e48_251 .stylo-callout:before{content:attr(data-callout);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-callout-accent,var(--stylo-text-muted));margin-bottom:.2em;font-size:.8em;font-weight:700;display:block}._preview_18e48_251 .stylo-callout-note{--stylo-callout-accent:var(--stylo-callout-note,#3b82f6)}._preview_18e48_251 .stylo-callout-tip{--stylo-callout-accent:var(--stylo-callout-tip,#22c55e)}._preview_18e48_251 .stylo-callout-warn{--stylo-callout-accent:var(--stylo-callout-warn,#f59e0b)}._preview_18e48_251 .stylo-callout-danger{--stylo-callout-accent:var(--stylo-callout-danger,#ef4444)}._preview_18e48_251 .stylo-callout-example{--stylo-callout-accent:var(--stylo-callout-example,#a855f7)}._preview_18e48_251 table{border-collapse:collapse;margin:2em 0;display:block;overflow-x:auto}._preview_18e48_251 :is(th,td){border:1px solid var(--stylo-table-border);text-align:left;padding:.35em .6em}._preview_18e48_251 thead th{background:var(--stylo-table-header-bg);font-weight:600}._preview_18e48_251 tbody tr:nth-child(2n) td{background:var(--stylo-table-stripe-bg)}._preview_18e48_251 hr{border:none;border-top:1px solid var(--stylo-border);margin:1em 0}._preview_18e48_251 .katex-display{padding:.25em 0;overflow:auto hidden}.stylo{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--stylo-bg:#fff;--stylo-surface-floating:#fff;--stylo-text:#09090b;--stylo-text-muted:#71717a;--stylo-border:#e4e4e7;--stylo-accent:#18181b;--stylo-link:#2563eb;--stylo-ring:#a1a1aa;--stylo-radius:.5rem;--stylo-table-border:var(--stylo-border);--stylo-table-header-bg:color-mix(in srgb, var(--stylo-border) 30%, transparent);--stylo-table-stripe-bg:transparent;--stylo-guide:var(--stylo-border);--stylo-syntax-keyword:#7c3aed;--stylo-syntax-string:#0a7c2f;--stylo-syntax-escape:#b45309;--stylo-syntax-comment:#8a8f98;--stylo-syntax-number:#b45309;--stylo-syntax-constant:#b45309;--stylo-syntax-function:#2563eb;--stylo-syntax-type:#a16207;--stylo-syntax-property:#0f766e;--stylo-syntax-tag:#cf222e;--stylo-syntax-invalid:#dc2626}:where(.dark,[data-theme=dark]) .stylo,.stylo:where(.dark,[data-theme=dark]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--stylo-bg:#09090b;--stylo-surface-floating:#09090b;--stylo-text:#fafafa;--stylo-text-muted:#a1a1aa;--stylo-border:#27272a;--stylo-accent:#fafafa;--stylo-link:#60a5fa;--stylo-ring:#52525b;--stylo-syntax-keyword:#c678dd;--stylo-syntax-string:#98c379;--stylo-syntax-escape:#d19a66;--stylo-syntax-comment:#7f848e;--stylo-syntax-number:#d19a66;--stylo-syntax-constant:#d19a66;--stylo-syntax-function:#61afef;--stylo-syntax-type:#e5c07b;--stylo-syntax-property:#56b6c2;--stylo-syntax-tag:#e06c75;--stylo-syntax-invalid:#e06c75}._root_18hcd_3{color:var(--stylo-text);font:inherit;grid-template-columns:1fr 1fr;gap:12px;display:grid}@media (width<=460px){._root_18hcd_3{grid-template-columns:1fr}}._col_18hcd_17{border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);background:var(--stylo-bg);flex-direction:column;min-width:0;display:flex}._colHead_18hcd_26{border-bottom:1px solid var(--stylo-border);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-text-muted);margin:0;padding:8px 12px;font-size:.75rem;font-weight:600}._list_18hcd_37{flex-direction:column;flex:1;gap:2px;margin:0;padding:4px;list-style:none;display:flex}._row_18hcd_47{border-radius:calc(var(--stylo-radius) - 3px);background:var(--stylo-bg);align-items:center;gap:8px;padding:5px 6px;display:flex}._row_18hcd_47:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._row_18hcd_47:hover{background:color-mix(in srgb, var(--stylo-border) 30%, transparent)}._row_18hcd_47[data-dragging]{background:var(--stylo-surface-floating,#fff);opacity:.9;box-shadow:0 4px 16px #00000024}._handle_18hcd_73{border-radius:calc(var(--stylo-radius) - 4px);width:20px;height:22px;color:var(--stylo-text-muted);font:inherit;cursor:grab;touch-action:none;background:0 0;border:1px solid #0000;flex:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}._handle_18hcd_73:hover{background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._handle_18hcd_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._handle_18hcd_73:active{cursor:grabbing}._glyph_18hcd_105{width:18px;height:18px;color:var(--stylo-text-muted);flex:none;justify-content:center;align-items:center;display:inline-flex}._glyph_18hcd_105 svg{width:16px;height:16px;display:block}._label_18hcd_121{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:.8125rem;overflow:hidden}._rowActions_18hcd_130{flex:none;gap:2px;display:flex}._iconButton_18hcd_136,._textButton_18hcd_137{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 4px);color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:1px solid #0000}._iconButton_18hcd_136{width:22px;height:22px;font-size:.8125rem;line-height:1}._textButton_18hcd_137{padding:3px 8px;font-size:.75rem}._iconButton_18hcd_136:hover:not(:disabled),._textButton_18hcd_137:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._iconButton_18hcd_136:focus-visible,._textButton_18hcd_137:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._iconButton_18hcd_136:disabled{opacity:.35;cursor:default}._footer_18hcd_176{border-top:1px solid var(--stylo-border);flex-wrap:wrap;gap:6px;padding:6px;display:flex}._empty_18hcd_184{color:var(--stylo-text-muted);padding:8px 6px;font-size:.8125rem}._srOnly_18hcd_190{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
|
|
1
|
+
._root_12qra_1{min-height:0;color:var(--stylo-text);background:var(--stylo-bg);border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);flex-direction:column;display:flex;overflow:hidden}._root_12qra_1 .cm-scroller{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--stylo-border) 90%, transparent) transparent}._root_12qra_1 .cm-scroller::-webkit-scrollbar{width:10px;height:10px}._root_12qra_1 .cm-scroller::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--stylo-border) 90%, transparent);background-clip:padding-box;border:3px solid #0000;border-radius:6px}._root_12qra_1 .cm-scroller::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--stylo-text-muted) 55%, transparent);background-clip:padding-box}._root_12qra_1 .cm-scroller::-webkit-scrollbar-corner{background:0 0}._source_12qra_42{flex:auto;min-height:0;overflow:auto}._source_12qra_42 .cm-editor{height:100%}._source_12qra_42 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._inplace_12qra_57{flex:auto;min-height:0;overflow:auto}._toolbar_12qra_63{background:var(--stylo-bg);border-bottom:1px solid var(--stylo-border);flex-wrap:wrap;align-items:center;gap:2px;padding:4px 6px;display:flex}._toolbarButton_12qra_73{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 3px);min-width:28px;height:28px;color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0 5px;font-size:.75rem;font-weight:600;line-height:1;display:inline-flex}._toolbarButton_12qra_73:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._toolbarButton_12qra_73[data-active]{background:color-mix(in srgb, var(--stylo-accent) 12%, transparent);color:var(--stylo-text)}._toolbarButton_12qra_73:disabled{opacity:.4;cursor:default}._toolbarButton_12qra_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._toolbarButton_12qra_73 svg{width:16px;height:16px;display:block}._toolbarButton_12qra_73 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-size:.8125rem;font-weight:500}._toolbarSep_12qra_132{background:var(--stylo-border);align-self:stretch;width:1px;margin:4px 3px}._toolbarSticky_12qra_142{z-index:50;-webkit-overflow-scrolling:touch;scrollbar-width:none;font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);flex-wrap:nowrap;transition:opacity .15s;overflow-x:auto}._toolbarSticky_12qra_142::-webkit-scrollbar{display:none}._toolbarSticky_12qra_142 ._toolbarButton_12qra_73{flex:none;min-width:40px;height:40px}._toolbarStickyBottom_12qra_142{border-bottom:none;border-top:1px solid var(--stylo-border);box-shadow:0 -2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;bottom:0;left:0;right:0}._toolbarStickyTop_12qra_142{box-shadow:0 2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;top:0;left:0;right:0}._toolbarStickyHidden_12qra_211{opacity:0;pointer-events:none}._stickyToolbarRootBottom_12qra_222 ._source_12qra_42,._stickyToolbarRootBottom_12qra_222 ._inplace_12qra_57{padding-bottom:52px}._stickyToolbarRootTop_12qra_227 ._source_12qra_42,._stickyToolbarRootTop_12qra_227 ._inplace_12qra_57{padding-top:52px}._inplace_12qra_57 .cm-editor{height:100%}._inplace_12qra_57 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._split_12qra_241{flex:1;grid-template-columns:1fr 1fr;min-height:0;display:grid}._splitPane_12qra_248{box-sizing:border-box;flex-direction:column;min-height:0;display:flex;overflow:auto}._splitPane_12qra_248+._splitPane_12qra_248{border-left:1px solid var(--stylo-border)}._splitPane_12qra_248>._source_12qra_42{flex:1;min-height:0}._preview_12qra_268{overflow-wrap:break-word;padding:.75rem 1rem;font-size:.9375rem;line-height:1.75}._preview_12qra_268>:first-child{margin-top:0}._preview_12qra_268>:last-child{margin-bottom:0}._preview_12qra_268 :is(h1,h2,h3,h4,h5,h6){font-weight:600}._preview_12qra_268 h1{margin:0 0 .888889em;font-size:2.25em;line-height:1.11111}._preview_12qra_268 h2{margin:2em 0 1em;font-size:1.5em;line-height:1.33333}._preview_12qra_268 h3{margin:1.6em 0 .6em;font-size:1.25em;line-height:1.6}._preview_12qra_268 :is(h4,h5,h6){margin:1.5em 0 .5em;line-height:1.5}._preview_12qra_268 p{margin:1.25em 0}._preview_12qra_268 :is(ul,ol){margin:1.25em 0;padding-left:1.625em}._preview_12qra_268 li{margin:.5em 0}._preview_12qra_268 li>:is(ul,ol){margin:.75em 0}._preview_12qra_268 a{color:var(--stylo-link);text-decoration:none}._preview_12qra_268 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 45%, transparent);padding:.1em .35em;font-size:.9em}._preview_12qra_268 pre{border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-border) 35%, transparent);margin:1.71429em 0;padding:.75rem .9rem;overflow-x:auto}._preview_12qra_268 pre code{background:0 0;padding:0;font-size:.85em}.stylo-frontmatter{border-left:3px solid var(--stylo-border);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 22%, transparent);color:var(--stylo-text-muted);font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);white-space:pre-wrap;margin:0 0 1.2em;padding:.7rem .9rem;font-size:.8125rem;line-height:1.5;overflow-x:auto}.stylo-frontmatter:before{content:"Frontmatter";font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);letter-spacing:.04em;text-transform:uppercase;margin-bottom:.5em;font-size:.7rem;font-weight:600;display:block}._preview_12qra_268 blockquote{border-left:.25rem solid var(--stylo-border);color:var(--stylo-text-muted);margin:1.6em 0;padding-left:1em}._preview_12qra_268 .stylo-callout{border-left:.25rem solid var(--stylo-callout-accent,var(--stylo-border));border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-callout-accent,var(--stylo-border)) 10%, transparent);color:var(--stylo-text);margin:1.6em 0;padding:.6em 1em}._preview_12qra_268 .stylo-callout:before{content:attr(data-callout);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-callout-accent,var(--stylo-text-muted));margin-bottom:.2em;font-size:.8em;font-weight:700;display:block}._preview_12qra_268 .stylo-callout-note{--stylo-callout-accent:var(--stylo-callout-note,#3b82f6)}._preview_12qra_268 .stylo-callout-tip{--stylo-callout-accent:var(--stylo-callout-tip,#22c55e)}._preview_12qra_268 .stylo-callout-warn{--stylo-callout-accent:var(--stylo-callout-warn,#f59e0b)}._preview_12qra_268 .stylo-callout-danger{--stylo-callout-accent:var(--stylo-callout-danger,#ef4444)}._preview_12qra_268 .stylo-callout-example{--stylo-callout-accent:var(--stylo-callout-example,#a855f7)}._preview_12qra_268 table{border-collapse:collapse;margin:2em 0;display:block;overflow-x:auto}._preview_12qra_268 :is(th,td){border:1px solid var(--stylo-table-border);text-align:left;padding:.35em .6em}._preview_12qra_268 thead th{background:var(--stylo-table-header-bg);font-weight:600}._preview_12qra_268 tbody tr:nth-child(2n) td{background:var(--stylo-table-stripe-bg)}._preview_12qra_268 hr{border:none;border-top:1px solid var(--stylo-border);margin:1em 0}._preview_12qra_268 .katex-display{padding:.25em 0;overflow:auto hidden}.stylo{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--stylo-bg:#fff;--stylo-surface-floating:#fff;--stylo-text:#09090b;--stylo-text-muted:#71717a;--stylo-border:#e4e4e7;--stylo-accent:#18181b;--stylo-link:#2563eb;--stylo-ring:#a1a1aa;--stylo-radius:.5rem;--stylo-font-size:.9375rem;--stylo-font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--stylo-font-family-mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--stylo-table-border:var(--stylo-border);--stylo-table-header-bg:color-mix(in srgb, var(--stylo-border) 30%, transparent);--stylo-table-stripe-bg:transparent;--stylo-guide:var(--stylo-border);--stylo-syntax-keyword:#7c3aed;--stylo-syntax-string:#0a7c2f;--stylo-syntax-escape:#b45309;--stylo-syntax-comment:#8a8f98;--stylo-syntax-number:#b45309;--stylo-syntax-constant:#b45309;--stylo-syntax-function:#2563eb;--stylo-syntax-type:#a16207;--stylo-syntax-property:#0f766e;--stylo-syntax-tag:#cf222e;--stylo-syntax-invalid:#dc2626}:where(.dark,[data-theme=dark]) .stylo,.stylo:where(.dark,[data-theme=dark]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--stylo-bg:#09090b;--stylo-surface-floating:#09090b;--stylo-text:#fafafa;--stylo-text-muted:#a1a1aa;--stylo-border:#27272a;--stylo-accent:#fafafa;--stylo-link:#60a5fa;--stylo-ring:#52525b;--stylo-syntax-keyword:#c678dd;--stylo-syntax-string:#98c379;--stylo-syntax-escape:#d19a66;--stylo-syntax-comment:#7f848e;--stylo-syntax-number:#d19a66;--stylo-syntax-constant:#d19a66;--stylo-syntax-function:#61afef;--stylo-syntax-type:#e5c07b;--stylo-syntax-property:#56b6c2;--stylo-syntax-tag:#e06c75;--stylo-syntax-invalid:#e06c75}._root_18hcd_3{color:var(--stylo-text);font:inherit;grid-template-columns:1fr 1fr;gap:12px;display:grid}@media (width<=460px){._root_18hcd_3{grid-template-columns:1fr}}._col_18hcd_17{border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);background:var(--stylo-bg);flex-direction:column;min-width:0;display:flex}._colHead_18hcd_26{border-bottom:1px solid var(--stylo-border);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-text-muted);margin:0;padding:8px 12px;font-size:.75rem;font-weight:600}._list_18hcd_37{flex-direction:column;flex:1;gap:2px;margin:0;padding:4px;list-style:none;display:flex}._row_18hcd_47{border-radius:calc(var(--stylo-radius) - 3px);background:var(--stylo-bg);align-items:center;gap:8px;padding:5px 6px;display:flex}._row_18hcd_47:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._row_18hcd_47:hover{background:color-mix(in srgb, var(--stylo-border) 30%, transparent)}._row_18hcd_47[data-dragging]{background:var(--stylo-surface-floating,#fff);opacity:.9;box-shadow:0 4px 16px #00000024}._handle_18hcd_73{border-radius:calc(var(--stylo-radius) - 4px);width:20px;height:22px;color:var(--stylo-text-muted);font:inherit;cursor:grab;touch-action:none;background:0 0;border:1px solid #0000;flex:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}._handle_18hcd_73:hover{background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._handle_18hcd_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._handle_18hcd_73:active{cursor:grabbing}._glyph_18hcd_105{width:18px;height:18px;color:var(--stylo-text-muted);flex:none;justify-content:center;align-items:center;display:inline-flex}._glyph_18hcd_105 svg{width:16px;height:16px;display:block}._label_18hcd_121{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:.8125rem;overflow:hidden}._rowActions_18hcd_130{flex:none;gap:2px;display:flex}._iconButton_18hcd_136,._textButton_18hcd_137{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 4px);color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:1px solid #0000}._iconButton_18hcd_136{width:22px;height:22px;font-size:.8125rem;line-height:1}._textButton_18hcd_137{padding:3px 8px;font-size:.75rem}._iconButton_18hcd_136:hover:not(:disabled),._textButton_18hcd_137:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._iconButton_18hcd_136:focus-visible,._textButton_18hcd_137:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._iconButton_18hcd_136:disabled{opacity:.35;cursor:default}._footer_18hcd_176{border-top:1px solid var(--stylo-border);flex-wrap:wrap;gap:6px;padding:6px;display:flex}._empty_18hcd_184{color:var(--stylo-text-muted);padding:8px 6px;font-size:.8125rem}._srOnly_18hcd_190{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/stylo.js
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { i as e, r as t } from "./wikilink-
|
|
2
|
-
import { n, t as r } from "./useCodeMirror-
|
|
1
|
+
import { i as e, r as t } from "./wikilink-CTR8IFKc.js";
|
|
2
|
+
import { n, t as r } from "./useCodeMirror-GPSkaYW6.js";
|
|
3
3
|
import { n as i, r as a } from "./config-DTBxVhtH.js";
|
|
4
4
|
import { Suspense as o, forwardRef as s, lazy as c, useEffect as l, useImperativeHandle as u, useReducer as d, useRef as f, useState as p } from "react";
|
|
5
5
|
import { EditorView as m } from "@codemirror/view";
|
|
6
6
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
7
7
|
//#region src/editor/SourceView.tsx
|
|
8
|
-
function _({ value: t, onChange: n, readOnly: i, placeholder: a, codeLanguages: o,
|
|
9
|
-
let
|
|
8
|
+
function _({ value: t, onChange: n, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: s, onSave: c, onViewChange: l }) {
|
|
9
|
+
let u = r({
|
|
10
10
|
value: t,
|
|
11
11
|
onChange: n,
|
|
12
12
|
readOnly: i,
|
|
13
13
|
placeholder: a,
|
|
14
14
|
codeLanguages: o,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
wikiLinkSource: s,
|
|
16
|
+
onSave: c,
|
|
17
|
+
onViewChange: l
|
|
17
18
|
});
|
|
18
19
|
return /* @__PURE__ */ h("div", {
|
|
19
20
|
className: e.source,
|
|
20
|
-
ref:
|
|
21
|
+
ref: u
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
//#endregion
|
|
24
25
|
//#region src/inplace/lazyInPlace.ts
|
|
25
|
-
var v = c(async () => ({ default: (await import("./InPlaceView-
|
|
26
|
+
var v = c(async () => ({ default: (await import("./InPlaceView-CS1qy-Ba.js")).InPlaceView })), y = c(async () => ({ default: (await import("./Preview-Bw0k3Mev.js")).Preview }));
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/SplitView.tsx
|
|
28
|
-
function b({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: s,
|
|
29
|
-
let [
|
|
29
|
+
function b({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: s, wikiLinkSource: c, frontmatter: u, onSave: d, onViewChange: m }) {
|
|
30
|
+
let [v, b] = p(null), x = f(null), S = f(!1);
|
|
30
31
|
return l(() => {
|
|
31
|
-
let e =
|
|
32
|
+
let e = v?.scrollDOM, t = x.current;
|
|
32
33
|
if (!e || !t) return;
|
|
33
34
|
let n = (e, t) => {
|
|
34
|
-
if (
|
|
35
|
+
if (S.current) return;
|
|
35
36
|
let n = e.scrollHeight - e.clientHeight;
|
|
36
|
-
n <= 0 || (
|
|
37
|
-
|
|
37
|
+
n <= 0 || (S.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
|
|
38
|
+
S.current = !1;
|
|
38
39
|
}));
|
|
39
40
|
}, r = () => n(e, t), i = () => n(t, e);
|
|
40
41
|
return e.addEventListener("scroll", r, { passive: !0 }), t.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
41
42
|
e.removeEventListener("scroll", r), t.removeEventListener("scroll", i);
|
|
42
43
|
};
|
|
43
|
-
}, [
|
|
44
|
+
}, [v]), /* @__PURE__ */ g("div", {
|
|
44
45
|
className: e.split,
|
|
45
46
|
children: [/* @__PURE__ */ h("div", {
|
|
46
47
|
className: e.splitPane,
|
|
@@ -50,14 +51,15 @@ function b({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder
|
|
|
50
51
|
readOnly: i,
|
|
51
52
|
placeholder: a,
|
|
52
53
|
codeLanguages: s,
|
|
53
|
-
|
|
54
|
+
wikiLinkSource: c,
|
|
55
|
+
onSave: d,
|
|
54
56
|
onViewChange: (e) => {
|
|
55
|
-
|
|
57
|
+
b(e), m?.(e);
|
|
56
58
|
}
|
|
57
59
|
})
|
|
58
60
|
}), /* @__PURE__ */ h("div", {
|
|
59
61
|
className: e.splitPane,
|
|
60
|
-
ref:
|
|
62
|
+
ref: x,
|
|
61
63
|
children: /* @__PURE__ */ h(o, {
|
|
62
64
|
fallback: /* @__PURE__ */ h("div", {
|
|
63
65
|
className: e.preview,
|
|
@@ -186,64 +188,65 @@ function w({ view: t, items: n, icons: r, disabled: i, sticky: a, stickyVisibili
|
|
|
186
188
|
}
|
|
187
189
|
//#endregion
|
|
188
190
|
//#region src/Stylo.tsx
|
|
189
|
-
var T = s(function({ value: n, onChange: r, mode: a = "in-place", onSave: s, onFrontmatter: c, onWikiLinkClick: d, onLinkClick: x, readOnly: S, placeholder: C, className: T, inPlace: E, codeLanguages: D,
|
|
190
|
-
let
|
|
191
|
-
|
|
192
|
-
let
|
|
191
|
+
var T = s(function({ value: n, onChange: r, mode: a = "in-place", onSave: s, onFrontmatter: c, onWikiLinkClick: d, onLinkClick: x, readOnly: S, placeholder: C, className: T, inPlace: E, codeLanguages: D, wikiLinkSource: O, toolbar: k, icons: A, frontmatter: j }, M) {
|
|
192
|
+
let N = a === "preview" || a === "split" || a === "in-place" ? a : "source", [P, F] = p(null), I = N === "preview" ? null : i(k), L = k && typeof k == "object" ? k.render : void 0, R = k && typeof k == "object" ? k.sticky : void 0, z = R === "top" ? "top" : R ? "bottom" : !1, B = k && typeof k == "object" ? k.stickyVisibility : void 0, V = f(c);
|
|
193
|
+
V.current = c;
|
|
194
|
+
let H = f(void 0);
|
|
193
195
|
l(() => {
|
|
194
196
|
let e = t(n)?.frontmatter ?? null;
|
|
195
|
-
e !==
|
|
196
|
-
}, [n]), u(
|
|
197
|
-
focus: () =>
|
|
198
|
-
getView: () =>
|
|
197
|
+
e !== H.current && (H.current = e, V.current?.(e));
|
|
198
|
+
}, [n]), u(M, () => ({
|
|
199
|
+
focus: () => P?.focus(),
|
|
200
|
+
getView: () => P,
|
|
199
201
|
insertAtCursor: (e) => {
|
|
200
|
-
|
|
202
|
+
P && (P.dispatch(P.state.replaceSelection(e)), P.focus());
|
|
201
203
|
},
|
|
202
204
|
scrollToHeading: (e) => {
|
|
203
|
-
if (!
|
|
204
|
-
let t = e.trim().toLowerCase(), { doc: n } =
|
|
205
|
+
if (!P) return !1;
|
|
206
|
+
let t = e.trim().toLowerCase(), { doc: n } = P.state;
|
|
205
207
|
for (let e = 1; e <= n.lines; e++) {
|
|
206
208
|
let r = n.line(e), i = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(r.text);
|
|
207
|
-
if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return
|
|
209
|
+
if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return P.dispatch({
|
|
208
210
|
selection: { anchor: r.from },
|
|
209
211
|
effects: m.scrollIntoView(r.from, { y: "start" })
|
|
210
|
-
}),
|
|
212
|
+
}), P.focus(), !0;
|
|
211
213
|
}
|
|
212
214
|
return !1;
|
|
213
215
|
}
|
|
214
|
-
}), [
|
|
215
|
-
let
|
|
216
|
+
}), [P]);
|
|
217
|
+
let U = [
|
|
216
218
|
e.root,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
+
z === "bottom" && e.stickyToolbarRootBottom,
|
|
220
|
+
z === "top" && e.stickyToolbarRootTop,
|
|
219
221
|
"stylo",
|
|
220
222
|
T
|
|
221
223
|
].filter(Boolean).join(" ");
|
|
222
224
|
return /* @__PURE__ */ g("div", {
|
|
223
|
-
className:
|
|
224
|
-
"data-stylo-mode":
|
|
225
|
+
className: U,
|
|
226
|
+
"data-stylo-mode": N,
|
|
225
227
|
children: [
|
|
226
|
-
|
|
228
|
+
I && (() => {
|
|
227
229
|
let e = /* @__PURE__ */ h(w, {
|
|
228
|
-
view:
|
|
229
|
-
items:
|
|
230
|
-
icons:
|
|
230
|
+
view: P,
|
|
231
|
+
items: I,
|
|
232
|
+
icons: A,
|
|
231
233
|
disabled: S,
|
|
232
|
-
sticky:
|
|
233
|
-
stickyVisibility:
|
|
234
|
+
sticky: z,
|
|
235
|
+
stickyVisibility: B
|
|
234
236
|
});
|
|
235
|
-
return
|
|
237
|
+
return L ? L(e, { view: P }) : e;
|
|
236
238
|
})(),
|
|
237
|
-
|
|
239
|
+
N === "source" && /* @__PURE__ */ h(_, {
|
|
238
240
|
value: n,
|
|
239
241
|
onChange: r,
|
|
240
242
|
readOnly: S,
|
|
241
243
|
placeholder: C,
|
|
242
244
|
codeLanguages: D,
|
|
245
|
+
wikiLinkSource: O,
|
|
243
246
|
onSave: s,
|
|
244
|
-
onViewChange:
|
|
247
|
+
onViewChange: F
|
|
245
248
|
}),
|
|
246
|
-
|
|
249
|
+
N === "preview" && /* @__PURE__ */ h(o, {
|
|
247
250
|
fallback: /* @__PURE__ */ h("div", {
|
|
248
251
|
className: e.preview,
|
|
249
252
|
"aria-busy": "true"
|
|
@@ -251,21 +254,22 @@ var T = s(function({ value: n, onChange: r, mode: a = "in-place", onSave: s, onF
|
|
|
251
254
|
children: /* @__PURE__ */ h(y, {
|
|
252
255
|
value: n,
|
|
253
256
|
onWikiLinkClick: d,
|
|
254
|
-
frontmatter:
|
|
257
|
+
frontmatter: j
|
|
255
258
|
})
|
|
256
259
|
}),
|
|
257
|
-
|
|
260
|
+
N === "split" && /* @__PURE__ */ h(b, {
|
|
258
261
|
value: n,
|
|
259
262
|
onChange: r,
|
|
260
263
|
onWikiLinkClick: d,
|
|
261
264
|
readOnly: S,
|
|
262
265
|
placeholder: C,
|
|
263
266
|
codeLanguages: D,
|
|
264
|
-
|
|
267
|
+
wikiLinkSource: O,
|
|
268
|
+
frontmatter: j,
|
|
265
269
|
onSave: s,
|
|
266
|
-
onViewChange:
|
|
270
|
+
onViewChange: F
|
|
267
271
|
}),
|
|
268
|
-
|
|
272
|
+
N === "in-place" && /* @__PURE__ */ h(o, {
|
|
269
273
|
fallback: /* @__PURE__ */ h("div", {
|
|
270
274
|
className: e.inplace,
|
|
271
275
|
"aria-busy": "true"
|
|
@@ -279,8 +283,9 @@ var T = s(function({ value: n, onChange: r, mode: a = "in-place", onSave: s, onF
|
|
|
279
283
|
onLinkClick: x,
|
|
280
284
|
inPlace: E,
|
|
281
285
|
codeLanguages: D,
|
|
286
|
+
wikiLinkSource: O,
|
|
282
287
|
onSave: s,
|
|
283
|
-
onViewChange:
|
|
288
|
+
onViewChange: F
|
|
284
289
|
})
|
|
285
290
|
})
|
|
286
291
|
]
|