@edv4h/usketch-plugin-shape-markdown 0.1.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 +39 -0
- package/dist/constants.d.ts +15 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -0
- package/dist/external-content-handler.d.ts +17 -0
- package/dist/external-content-handler.d.ts.map +1 -0
- package/dist/external-content-handler.js +93 -0
- package/dist/external-content-handler.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown-editing-machine.d.ts +39 -0
- package/dist/markdown-editing-machine.d.ts.map +1 -0
- package/dist/markdown-editing-machine.js +190 -0
- package/dist/markdown-editing-machine.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +223 -0
- package/dist/plugin.js.map +1 -0
- package/dist/render.d.ts +11 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +280 -0
- package/dist/render.js.map +1 -0
- package/dist/selection-store.d.ts +7 -0
- package/dist/selection-store.d.ts.map +1 -0
- package/dist/selection-store.js +37 -0
- package/dist/selection-store.js.map +1 -0
- package/dist/table-paste.d.ts +23 -0
- package/dist/table-paste.d.ts.map +1 -0
- package/dist/table-paste.js +72 -0
- package/dist/table-paste.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdV4H
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @edv4h/usketch-plugin-shape-markdown
|
|
2
|
+
|
|
3
|
+
Markdown を整形表示する uSketch の shape プラグイン。付箋 / テキストと同じ HTML 描画 shape として、GFM 記法・シンタックスハイライト・Mermaid 図をキャンバス上でレンダリングする。
|
|
4
|
+
|
|
5
|
+
## 特徴
|
|
6
|
+
|
|
7
|
+
- **shape 型** `markdown`(`ShapeData<{ source: string; isEditing: boolean }>` の `meta` 方式、`renderTarget: "html"`)。
|
|
8
|
+
- **GFM レンダリング**: 見出し / 太字・斜体 / リスト / リンク / 表 / コードブロック / タスクリスト(チェックボックス)/ 引用。`react-markdown + remark-gfm`。
|
|
9
|
+
- **XSS 安全**: `dangerouslySetInnerHTML` を使わず、raw HTML は既定で無効。悪意ある `<script>` 等はレンダリングされない。
|
|
10
|
+
- **シンタックスハイライト**: `rehype-highlight`(github 風テーマを内蔵注入、ライト/ダーク追従)。
|
|
11
|
+
- **Mermaid**: ` ```mermaid ` ブロックを図として描画。`mermaid` は**動的 import で code-split**(図を含むボードを開いたときだけロード)。`securityLevel: "strict"` で描画し、不正構文は生コード+エラー文言にフォールバック。
|
|
12
|
+
- **編集(明示操作)**: shape を選択し、Control HUD の `Markdown ▸ ✎ Edit source`(バッククォート `` ` `` で HUD を開く)で raw Markdown 編集モードに入る。blur / Esc / 外側クリック / 選択解除で確定。undo 対応。空にすると shape は削除。ダブルクリックには**バインドしない**(コンテンツ操作を邪魔しないため)。
|
|
13
|
+
- **コンテンツ操作(選択中のみ)**: shape 選択中はリンククリック可+**テキスト選択は Alt+ドラッグ**(プレーンなドラッグは shape の移動、Alt を押しながらドラッグでテキスト選択)。**未選択時はコンテンツ非操作**(リンクも押せない)で、クリック/ドラッグは shape の選択/移動になる。
|
|
14
|
+
- **ペースト / ドロップ**: キャンバスにペースト(Cmd/Ctrl+V)またはドロップで markdown shape を自動生成(external-content handler)。
|
|
15
|
+
- **表データ**(Excel / Google スプレッドシートの HTML table、TSV/CSV)→ **GFM 表**に変換(`order:10`)。
|
|
16
|
+
- それ以外のテキスト → そのまま Markdown(catch-all `order:0`、host が上書き可)。
|
|
17
|
+
- =「具体 match が勝ち/無ければ Markdown」という order ベースのルーティング(専用ルータープラグイン不要。canvas-engine の `externalContent` レジストリがルーターを担う)。
|
|
18
|
+
- 内部シェイプコピー(`usketch/shapes` JSON)は横取りしない。編集中の textarea へのペーストはブラウザ標準動作。
|
|
19
|
+
- **高さ自動フィット**: 表示は描画内容に追従(Mermaid の非同期描画にも `ResizeObserver` で追従)。
|
|
20
|
+
- ツール `markdown-draw`(ショートカット `m`)、LOD 簡易表示、AI serialize、Debug HUD の debug fields 対応。
|
|
21
|
+
|
|
22
|
+
## 非対応(今後)
|
|
23
|
+
|
|
24
|
+
- KaTeX 数式。
|
|
25
|
+
- ボード全体の Markdown インポート / エクスポート。
|
|
26
|
+
|
|
27
|
+
## 使い方
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createApp } from "@edv4h/usketch-core";
|
|
31
|
+
import { createMarkdownPlugin } from "@edv4h/usketch-plugin-shape-markdown";
|
|
32
|
+
|
|
33
|
+
const app = await createApp({
|
|
34
|
+
store,
|
|
35
|
+
plugins: [createMarkdownPlugin()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
ツールバー / ショートカット `m` で配置(配置直後は編集モード)→ 確定後に再編集するときは shape を選択し、Control HUD(`` ` `` で開く)の `Markdown ▸ ✎ Edit source` を実行 → フォーカスを外す / Esc で整形表示に切り替わる。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Default size for a freshly placed markdown shape. */
|
|
2
|
+
export declare const MARKDOWN_DEFAULT_SIZE: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
/** Minimum resizable size. Height auto-fits content, so this is mostly a floor. */
|
|
7
|
+
export declare const MARKDOWN_MIN_SIZE: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
/** Keyboard shortcut for the markdown draw tool. */
|
|
12
|
+
export declare const MARKDOWN_SHORTCUT = "m";
|
|
13
|
+
/** Placeholder shown in the editor while the source is empty. */
|
|
14
|
+
export declare const MARKDOWN_PLACEHOLDER = "# Markdown\n\n- **GFM** \u5BFE\u5FDC\n- ```mermaid``` \u56F3\u3082\u53EF";
|
|
15
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,eAAO,MAAM,qBAAqB;IAAK,KAAK;IAAO,MAAM;CAAO,CAAC;AAEjE,mFAAmF;AACnF,eAAO,MAAM,iBAAiB;IAAK,KAAK;IAAO,MAAM;CAAM,CAAC;AAE5D,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,6EAAoD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Default size for a freshly placed markdown shape. */
|
|
2
|
+
export const MARKDOWN_DEFAULT_SIZE = { width: 320, height: 120 };
|
|
3
|
+
/** Minimum resizable size. Height auto-fits content, so this is mostly a floor. */
|
|
4
|
+
export const MARKDOWN_MIN_SIZE = { width: 140, height: 48 };
|
|
5
|
+
/** Keyboard shortcut for the markdown draw tool. */
|
|
6
|
+
export const MARKDOWN_SHORTCUT = "m";
|
|
7
|
+
/** Placeholder shown in the editor while the source is empty. */
|
|
8
|
+
export const MARKDOWN_PLACEHOLDER = "# Markdown\n\n- **GFM** 対応\n- ```mermaid``` 図も可";
|
|
9
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAEjE,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE5D,oDAAoD;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ExternalContentHandler } from "@edv4h/usketch-shared";
|
|
2
|
+
/**
|
|
3
|
+
* External-content handler: paste or drop of plain text creates a markdown
|
|
4
|
+
* shape from the text. Registered at `order: 0` so a host/third-party handler
|
|
5
|
+
* can override. Skips the internal shape-clipboard JSON so Cmd+V of copied
|
|
6
|
+
* shapes still pastes shapes (both the keyboard shortcut and the document
|
|
7
|
+
* `paste` event fire on Cmd+V).
|
|
8
|
+
*/
|
|
9
|
+
export declare function createMarkdownTextHandler(): ExternalContentHandler<"text">;
|
|
10
|
+
/**
|
|
11
|
+
* Table paste: a spreadsheet selection (Excel / Google Sheets / web `<table>`)
|
|
12
|
+
* or delimited TSV/CSV text becomes a GFM markdown table shape. Registered at a
|
|
13
|
+
* higher `order` than the plain-text catch-all so tabular pastes win; anything
|
|
14
|
+
* non-tabular falls through to {@link createMarkdownTextHandler}.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createMarkdownTableHandler(): ExternalContentHandler<"text">;
|
|
17
|
+
//# sourceMappingURL=external-content-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-content-handler.d.ts","sourceRoot":"","sources":["../src/external-content-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,sBAAsB,EAG3B,MAAM,uBAAuB,CAAC;AA+C/B;;;;;;GAMG;AACH,wBAAgB,yBAAyB,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAgB1E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAgB3E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DEFAULT_STYLE, generateId, } from "@edv4h/usketch-shared";
|
|
2
|
+
import { createAddShapeCommand } from "@edv4h/usketch-store";
|
|
3
|
+
import { MARKDOWN_DEFAULT_SIZE } from "./constants.js";
|
|
4
|
+
import { htmlHasTable, parseDelimited, parseHtmlTable, toMarkdownTable } from "./table-paste.js";
|
|
5
|
+
import { MARKDOWN_TYPE } from "./types.js";
|
|
6
|
+
/** Internal shape copy/paste marker (from usketch-plugin-keyboard-shortcuts). */
|
|
7
|
+
const INTERNAL_SHAPES_FORMAT = "usketch/shapes";
|
|
8
|
+
function viewportCenterToWorld(ctx) {
|
|
9
|
+
const vp = ctx.store.getViewport();
|
|
10
|
+
const screenW = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
11
|
+
const screenH = typeof window !== "undefined" ? window.innerHeight : 0;
|
|
12
|
+
return { x: (screenW / 2 - vp.x) / vp.zoom, y: (screenH / 2 - vp.y) / vp.zoom };
|
|
13
|
+
}
|
|
14
|
+
/** Create a markdown shape centered on the viewport and select it (undoable). */
|
|
15
|
+
function placeMarkdownShape(ctx, source) {
|
|
16
|
+
const center = viewportCenterToWorld(ctx);
|
|
17
|
+
const id = generateId();
|
|
18
|
+
const shape = {
|
|
19
|
+
id,
|
|
20
|
+
type: MARKDOWN_TYPE,
|
|
21
|
+
x: Math.round(center.x - MARKDOWN_DEFAULT_SIZE.width / 2),
|
|
22
|
+
y: Math.round(center.y - MARKDOWN_DEFAULT_SIZE.height / 2),
|
|
23
|
+
width: MARKDOWN_DEFAULT_SIZE.width,
|
|
24
|
+
height: MARKDOWN_DEFAULT_SIZE.height,
|
|
25
|
+
style: { ...DEFAULT_STYLE, fill: "transparent", strokeWidth: 0 },
|
|
26
|
+
meta: { source, isEditing: false },
|
|
27
|
+
};
|
|
28
|
+
ctx.commands.execute(createAddShapeCommand(ctx.store, shape));
|
|
29
|
+
ctx.store.setSelection([id]);
|
|
30
|
+
}
|
|
31
|
+
/** True when the text is the internal shape-clipboard JSON (don't hijack it). */
|
|
32
|
+
function isInternalShapesClipboard(text) {
|
|
33
|
+
if (!text.startsWith("{"))
|
|
34
|
+
return false;
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(text);
|
|
37
|
+
return (typeof parsed === "object" && parsed !== null && parsed.format === INTERNAL_SHAPES_FORMAT);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* External-content handler: paste or drop of plain text creates a markdown
|
|
45
|
+
* shape from the text. Registered at `order: 0` so a host/third-party handler
|
|
46
|
+
* can override. Skips the internal shape-clipboard JSON so Cmd+V of copied
|
|
47
|
+
* shapes still pastes shapes (both the keyboard shortcut and the document
|
|
48
|
+
* `paste` event fire on Cmd+V).
|
|
49
|
+
*/
|
|
50
|
+
export function createMarkdownTextHandler() {
|
|
51
|
+
return {
|
|
52
|
+
id: "usketch-plugin-shape-markdown:text",
|
|
53
|
+
kind: "text",
|
|
54
|
+
order: 0,
|
|
55
|
+
match: (content) => {
|
|
56
|
+
const text = content.text?.trim();
|
|
57
|
+
if (!text)
|
|
58
|
+
return false;
|
|
59
|
+
return !isInternalShapesClipboard(text);
|
|
60
|
+
},
|
|
61
|
+
handle: (content, ctx) => {
|
|
62
|
+
// Preserve the original text verbatim (rendered as GFM on view; plain
|
|
63
|
+
// text renders as-is). Height auto-fits after render.
|
|
64
|
+
placeMarkdownShape(ctx, content.text);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Table paste: a spreadsheet selection (Excel / Google Sheets / web `<table>`)
|
|
70
|
+
* or delimited TSV/CSV text becomes a GFM markdown table shape. Registered at a
|
|
71
|
+
* higher `order` than the plain-text catch-all so tabular pastes win; anything
|
|
72
|
+
* non-tabular falls through to {@link createMarkdownTextHandler}.
|
|
73
|
+
*/
|
|
74
|
+
export function createMarkdownTableHandler() {
|
|
75
|
+
return {
|
|
76
|
+
id: "usketch-plugin-shape-markdown:table",
|
|
77
|
+
kind: "text",
|
|
78
|
+
order: 10,
|
|
79
|
+
match: (content) => {
|
|
80
|
+
if (content.text && isInternalShapesClipboard(content.text.trim()))
|
|
81
|
+
return false;
|
|
82
|
+
return htmlHasTable(content.html) || parseDelimited(content.text) !== null;
|
|
83
|
+
},
|
|
84
|
+
handle: (content, ctx) => {
|
|
85
|
+
// Prefer the rich HTML table (handles multi-word cells) over delimited text.
|
|
86
|
+
const rows = parseHtmlTable(content.html) ?? parseDelimited(content.text);
|
|
87
|
+
if (!rows)
|
|
88
|
+
return;
|
|
89
|
+
placeMarkdownShape(ctx, toMarkdownTable(rows));
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=external-content-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-content-handler.js","sourceRoot":"","sources":["../src/external-content-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAGb,UAAU,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,aAAa,EAA0B,MAAM,YAAY,CAAC;AAEnE,iFAAiF;AACjF,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEhD,SAAS,qBAAqB,CAAC,GAA8B;IAC5D,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC;AAED,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,GAA8B,EAAE,MAAc;IACzE,MAAM,M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
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { MARKDOWN_DEFAULT_SIZE, MARKDOWN_MIN_SIZE, MARKDOWN_SHORTCUT } from "./constants.js";
|
|
2
|
+
export { createMarkdownPlugin } from "./plugin.js";
|
|
3
|
+
export { MARKDOWN_TYPE, type MarkdownMeta, type MarkdownShapeData } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAA6C,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PluginContext } from "@edv4h/usketch-shared";
|
|
2
|
+
type MarkdownEvent = {
|
|
3
|
+
type: "CREATE_SHAPE";
|
|
4
|
+
shapeId: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "BEGIN_EDIT";
|
|
7
|
+
shapeId: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "ENTER_EDIT";
|
|
10
|
+
} | {
|
|
11
|
+
type: "SETTLE_TIMEOUT";
|
|
12
|
+
} | {
|
|
13
|
+
type: "EDIT_INPUT";
|
|
14
|
+
id: string;
|
|
15
|
+
source: string;
|
|
16
|
+
scrollHeight: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: "EDIT_BLUR";
|
|
19
|
+
id: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "EDIT_ESCAPE";
|
|
22
|
+
id: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "OUTSIDE_CLICK";
|
|
25
|
+
} | {
|
|
26
|
+
type: "DESELECTED";
|
|
27
|
+
};
|
|
28
|
+
export type { MarkdownEvent };
|
|
29
|
+
export declare function createMarkdownEditingService(pluginCtx: PluginContext): {
|
|
30
|
+
send: (event: MarkdownEvent) => void;
|
|
31
|
+
readonly context: {
|
|
32
|
+
editingShapeId: string | null;
|
|
33
|
+
metaSnapshot: Record<string, unknown> | null;
|
|
34
|
+
heightSnapshot: number | null;
|
|
35
|
+
};
|
|
36
|
+
matches: (...values: string[]) => boolean;
|
|
37
|
+
stop(): void;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=markdown-editing-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-editing-machine.d.ts","sourceRoot":"","sources":["../src/markdown-editing-machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,uBAAuB,CAAC;AAWtE,KAAK,aAAa,GACf;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAwN1B,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,aAAa;IAMnE,IAAI;aACA,OAAO;QAET,cAAc;QACd,YAAY;QACZ,cAAc;;IAGhB,OAAO,cAAc,MAAM,EAAE;IAI7B,IAAI;EAML"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { createDeleteShapeCommand, createUpdateShapeCommand } from "@edv4h/usketch-store";
|
|
2
|
+
import { createMachine } from "@zag-js/core";
|
|
3
|
+
import { VanillaMachine } from "@zag-js/vanilla";
|
|
4
|
+
import { MARKDOWN_TYPE, readMarkdownMeta } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Merge a partial patch onto the shape's current meta. Spreads the **raw**
|
|
7
|
+
* existing meta (not the normalized {source,isEditing}) so any extra keys —
|
|
8
|
+
* present now or added later by other tooling — are preserved through edits.
|
|
9
|
+
* `store.updateShape` replaces `meta` wholesale, so we must carry it forward.
|
|
10
|
+
*/
|
|
11
|
+
function metaPatch(shape, patch) {
|
|
12
|
+
const existing = (shape.meta ?? {});
|
|
13
|
+
return { meta: { ...existing, ...patch } };
|
|
14
|
+
}
|
|
15
|
+
// ── Machine Definition ──
|
|
16
|
+
const markdownEditingMachine = createMachine({
|
|
17
|
+
initialState: () => "idle",
|
|
18
|
+
context({ bindable }) {
|
|
19
|
+
return {
|
|
20
|
+
editingShapeId: bindable(() => ({ defaultValue: null })),
|
|
21
|
+
metaSnapshot: bindable(() => ({ defaultValue: null })),
|
|
22
|
+
heightSnapshot: bindable(() => ({ defaultValue: null })),
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
refs() {
|
|
26
|
+
return {
|
|
27
|
+
settleTimer: null,
|
|
28
|
+
pluginCtx: null,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
states: {
|
|
32
|
+
idle: {
|
|
33
|
+
on: {
|
|
34
|
+
CREATE_SHAPE: { target: "creating", actions: ["setEditing"] },
|
|
35
|
+
BEGIN_EDIT: { target: "creating", actions: ["setEditing"] },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
creating: {
|
|
39
|
+
entry: ["sendEnterEdit"],
|
|
40
|
+
on: {
|
|
41
|
+
ENTER_EDIT: { target: "editing", actions: ["enterEdit"] },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
editing: {
|
|
45
|
+
initial: "settling",
|
|
46
|
+
states: {
|
|
47
|
+
settling: {
|
|
48
|
+
entry: ["startSettleTimer"],
|
|
49
|
+
on: {
|
|
50
|
+
EDIT_INPUT: { guard: "isEditingTarget", actions: ["updateSource"] },
|
|
51
|
+
EDIT_ESCAPE: { guard: "isEditingTarget", target: "idle", actions: ["exitEdit"] },
|
|
52
|
+
DESELECTED: { target: "idle", actions: ["exitEdit"] },
|
|
53
|
+
SETTLE_TIMEOUT: { target: "active" },
|
|
54
|
+
// EDIT_BLUR and OUTSIDE_CLICK are ignored while settling
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
active: {
|
|
58
|
+
on: {
|
|
59
|
+
EDIT_INPUT: { guard: "isEditingTarget", actions: ["updateSource"] },
|
|
60
|
+
EDIT_BLUR: { guard: "isEditingTarget", target: "idle", actions: ["exitEdit"] },
|
|
61
|
+
OUTSIDE_CLICK: { target: "idle", actions: ["exitEdit"] },
|
|
62
|
+
EDIT_ESCAPE: { guard: "isEditingTarget", target: "idle", actions: ["exitEdit"] },
|
|
63
|
+
DESELECTED: { target: "idle", actions: ["exitEdit"] },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
implementations: {
|
|
70
|
+
guards: {
|
|
71
|
+
isEditingTarget({ context, event }) {
|
|
72
|
+
return event.id === context.get("editingShapeId");
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
actions: {
|
|
76
|
+
setEditing({ context, event }) {
|
|
77
|
+
context.set("editingShapeId", event.shapeId);
|
|
78
|
+
},
|
|
79
|
+
enterEdit({ context, refs }) {
|
|
80
|
+
const id = context.get("editingShapeId");
|
|
81
|
+
if (!id)
|
|
82
|
+
return;
|
|
83
|
+
const pluginCtx = refs.get("pluginCtx");
|
|
84
|
+
const shape = pluginCtx.store.getShape(id);
|
|
85
|
+
if (!shape || shape.type !== MARKDOWN_TYPE)
|
|
86
|
+
return;
|
|
87
|
+
context.set("metaSnapshot", { ...(shape.meta ?? {}) });
|
|
88
|
+
context.set("heightSnapshot", shape.height);
|
|
89
|
+
pluginCtx.store.updateShape(id, metaPatch(shape, { isEditing: true }));
|
|
90
|
+
},
|
|
91
|
+
startSettleTimer({ refs, send }) {
|
|
92
|
+
const prev = refs.get("settleTimer");
|
|
93
|
+
if (prev != null)
|
|
94
|
+
clearTimeout(prev);
|
|
95
|
+
const timer = setTimeout(() => {
|
|
96
|
+
send({ type: "SETTLE_TIMEOUT" });
|
|
97
|
+
}, 200);
|
|
98
|
+
refs.set("settleTimer", timer);
|
|
99
|
+
},
|
|
100
|
+
exitEdit({ context, refs }) {
|
|
101
|
+
const id = context.get("editingShapeId");
|
|
102
|
+
if (!id)
|
|
103
|
+
return;
|
|
104
|
+
const prevMeta = context.get("metaSnapshot") ?? {};
|
|
105
|
+
const prevSource = readMarkdownMeta({ meta: prevMeta }).source;
|
|
106
|
+
const prevHeight = context.get("heightSnapshot");
|
|
107
|
+
const pluginCtx = refs.get("pluginCtx");
|
|
108
|
+
const settleTimer = refs.get("settleTimer");
|
|
109
|
+
if (settleTimer != null) {
|
|
110
|
+
clearTimeout(settleTimer);
|
|
111
|
+
refs.set("settleTimer", null);
|
|
112
|
+
}
|
|
113
|
+
const shape = pluginCtx.store.getShape(id);
|
|
114
|
+
if (!shape) {
|
|
115
|
+
context.set("editingShapeId", null);
|
|
116
|
+
context.set("metaSnapshot", null);
|
|
117
|
+
context.set("heightSnapshot", null);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Leave edit mode first so the from/to snapshots capture the
|
|
121
|
+
// non-editing meta (isEditing:false) on both sides of the undo step.
|
|
122
|
+
pluginCtx.store.updateShape(id, metaPatch(shape, { isEditing: false }));
|
|
123
|
+
const currentShape = pluginCtx.store.getShape(id) ?? shape;
|
|
124
|
+
const currentSource = readMarkdownMeta(currentShape).source;
|
|
125
|
+
if (currentSource.trim() === "") {
|
|
126
|
+
pluginCtx.commands.execute(createDeleteShapeCommand(pluginCtx.store, id));
|
|
127
|
+
}
|
|
128
|
+
else if (currentSource !== prevSource) {
|
|
129
|
+
// Preserve any extra meta keys on both sides of the undo step.
|
|
130
|
+
pluginCtx.commands.execute(createUpdateShapeCommand(pluginCtx.store, id, {
|
|
131
|
+
meta: { ...prevMeta, isEditing: false },
|
|
132
|
+
height: prevHeight ?? currentShape.height,
|
|
133
|
+
}, {
|
|
134
|
+
meta: {
|
|
135
|
+
...(currentShape.meta ?? {}),
|
|
136
|
+
isEditing: false,
|
|
137
|
+
},
|
|
138
|
+
height: currentShape.height,
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
context.set("editingShapeId", null);
|
|
142
|
+
context.set("metaSnapshot", null);
|
|
143
|
+
context.set("heightSnapshot", null);
|
|
144
|
+
},
|
|
145
|
+
updateSource({ refs, event }) {
|
|
146
|
+
const id = event.id;
|
|
147
|
+
if (!id)
|
|
148
|
+
return;
|
|
149
|
+
const pluginCtx = refs.get("pluginCtx");
|
|
150
|
+
const shape = pluginCtx.store.getShape(id);
|
|
151
|
+
if (!shape)
|
|
152
|
+
return;
|
|
153
|
+
const newHeight = Math.max(48, event.scrollHeight);
|
|
154
|
+
pluginCtx.store.updateShape(id, {
|
|
155
|
+
...metaPatch(shape, { source: event.source }),
|
|
156
|
+
height: newHeight,
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
sendEnterEdit({ send }) {
|
|
160
|
+
send({ type: "ENTER_EDIT" });
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
export function createMarkdownEditingService(pluginCtx) {
|
|
166
|
+
const machine = new VanillaMachine(markdownEditingMachine);
|
|
167
|
+
machine.refs.set("pluginCtx", pluginCtx);
|
|
168
|
+
machine.start();
|
|
169
|
+
return {
|
|
170
|
+
send: machine.send,
|
|
171
|
+
get context() {
|
|
172
|
+
return {
|
|
173
|
+
editingShapeId: machine.context.get("editingShapeId"),
|
|
174
|
+
metaSnapshot: machine.context.get("metaSnapshot"),
|
|
175
|
+
heightSnapshot: machine.context.get("heightSnapshot"),
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
matches: (...values) => {
|
|
179
|
+
const state = machine.state.get();
|
|
180
|
+
return values.some((v) => state === v || state.startsWith(`${v}.`));
|
|
181
|
+
},
|
|
182
|
+
stop() {
|
|
183
|
+
const settleTimer = machine.refs.get("settleTimer");
|
|
184
|
+
if (settleTimer != null)
|
|
185
|
+
clearTimeout(settleTimer);
|
|
186
|
+
machine.stop();
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=markdown-editing-machine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-editing-machine.js","sourceRoot":"","sources":["../src/markdown-editing-machine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA8ChF;;;;;GAKG;AAC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