@bendyline/squisq-editor-react 2.0.0 → 2.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/README.md +10 -2
- package/dist/index.d.ts +579 -47
- package/dist/index.js +7477 -2943
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1008 -38
- package/package.json +6 -5
- package/src/DocumentSettingsDialog.tsx +32 -18
- package/src/EditorContext.tsx +27 -0
- package/src/EditorShell.tsx +25 -1
- package/src/PreviewControls.tsx +77 -29
- package/src/PreviewPanel.tsx +5 -1
- package/src/RawEditor.tsx +12 -0
- package/src/RecorderEntry.tsx +5 -0
- package/src/Toolbar.tsx +479 -36
- package/src/WysiwygEditor.tsx +25 -11
- package/src/__tests__/buildPreviewDocContent.test.ts +17 -0
- package/src/__tests__/codeContextSectionView.test.tsx +8 -6
- package/src/__tests__/documentSettingsDialog.test.tsx +22 -0
- package/src/__tests__/editorShellProps.test.tsx +65 -0
- package/src/__tests__/findMode.test.tsx +104 -0
- package/src/__tests__/findModel.test.ts +55 -0
- package/src/__tests__/markdownCodeFence.test.ts +45 -0
- package/src/__tests__/mediaAttachmentFlow.test.ts +2 -2
- package/src/__tests__/mediaReferences.test.ts +15 -0
- package/src/__tests__/previewControls.test.tsx +195 -0
- package/src/__tests__/recorderTheme.test.tsx +42 -0
- package/src/__tests__/selectionConversions.test.ts +80 -0
- package/src/__tests__/tiptapBridge.test.ts +57 -7
- package/src/__tests__/tiptapImageRoundTrip.test.ts +1 -1
- package/src/__tests__/toolbarSelectionConversion.test.tsx +190 -0
- package/src/__tests__/writeCanvasSettings.test.ts +15 -0
- package/src/asciiDiagram/AsciiDiagramWidget.tsx +34 -4
- package/src/asciiDiagram/__tests__/AsciiDiagramExtension.test.ts +20 -1
- package/src/asciiDiagram/__tests__/asciiDiagramCommands.test.ts +58 -1
- package/src/asciiDiagram/asciiDiagramCommands.ts +36 -10
- package/src/asciiDiagram/asciiDiagramData.ts +33 -0
- package/src/asciiDiagram/asciiDiagramOps.ts +19 -0
- package/src/buildPreviewDoc.ts +9 -7
- package/src/codeContext/types.ts +1 -1
- package/src/codeSnippet/CodeSnippetExtension.ts +205 -0
- package/src/codeSnippet/CodeSnippetWidget.tsx +109 -0
- package/src/codeSnippet/__tests__/CodeSnippetExtension.test.ts +95 -0
- package/src/codeSnippet/__tests__/codeSnippetLanguages.test.ts +50 -0
- package/src/codeSnippet/codeSnippetCommands.ts +21 -0
- package/src/codeSnippet/codeSnippetData.ts +43 -0
- package/src/codeSnippet/codeSnippetLanguages.ts +216 -0
- package/src/customTemplates/__tests__/useMemoryLayerAdapter.test.ts +13 -0
- package/src/customTemplates/useMemoryLayerAdapter.ts +7 -1
- package/src/diagram/DiagramCanvas.tsx +17 -2
- package/src/find/FindHighlightExtension.ts +81 -0
- package/src/find/FindToolbar.tsx +314 -0
- package/src/find/findModel.ts +77 -0
- package/src/frontmatterSettings.ts +23 -0
- package/src/index.ts +96 -1
- package/src/markdownCodeFence.ts +72 -0
- package/src/mediaReferences.ts +5 -3
- package/src/mermaid/MermaidDiagramCanvas.tsx +693 -0
- package/src/mermaid/MermaidDiagramExtension.ts +243 -0
- package/src/mermaid/MermaidDiagramTypeThumbnail.tsx +184 -0
- package/src/mermaid/MermaidDiagramWidget.tsx +653 -0
- package/src/mermaid/MermaidShapePalette.tsx +245 -0
- package/src/mermaid/__tests__/MermaidDiagramExtension.test.ts +361 -0
- package/src/mermaid/__tests__/mermaidDiagramTypes.test.ts +35 -0
- package/src/mermaid/__tests__/mermaidRenderer.test.ts +49 -0
- package/src/mermaid/__tests__/mermaidSourceOps.test.ts +213 -0
- package/src/mermaid/__tests__/mermaidSyntax.test.ts +71 -0
- package/src/mermaid/mermaidCommands.ts +34 -0
- package/src/mermaid/mermaidData.ts +31 -0
- package/src/mermaid/mermaidDiagramTypes.ts +325 -0
- package/src/mermaid/mermaidModel.ts +31 -0
- package/src/mermaid/mermaidRenderer.ts +181 -0
- package/src/mermaid/mermaidShapes.ts +113 -0
- package/src/mermaid/mermaidSourceOps.ts +454 -0
- package/src/recorder/RecorderButton.tsx +9 -1
- package/src/recorder/RecorderModal.tsx +84 -41
- package/src/recorder/RecorderPanel.tsx +9 -1
- package/src/scene/Scene.tsx +46 -15
- package/src/scene/SceneBlockToolbar.tsx +29 -14
- package/src/scene/SceneViewControls.tsx +43 -0
- package/src/scene/__tests__/fitScale.test.ts +19 -0
- package/src/scene/__tests__/sceneIsolation.test.tsx +27 -1
- package/src/scene/__tests__/useScenePanZoom.test.ts +28 -1
- package/src/scene/adapters/DrawingAdapter.ts +6 -1
- package/src/scene/adapters/LayoutAdapter.ts +3 -0
- package/src/scene/commands/SceneCommand.ts +13 -2
- package/src/scene/fitScale.ts +17 -0
- package/src/scene/hooks/useScenePanZoom.ts +11 -4
- package/src/scene/scene.css +85 -3
- package/src/scene/tools/SelectTool.ts +5 -5
- package/src/selectionConversions.ts +155 -0
- package/src/styles/ascii-timeline.css +101 -4
- package/src/styles/code-snippet.css +76 -0
- package/src/styles/editor.css +352 -2
- package/src/styles/index.css +2 -0
- package/src/styles/mermaid-diagram.css +487 -0
- package/src/styles/tree-view.css +51 -1
- package/src/timeline/TimelineEditorWidget.tsx +200 -41
- package/src/timeline/__tests__/TimelineEditorWidget.test.tsx +61 -2
- package/src/timeline/__tests__/timelineCommands.test.ts +32 -0
- package/src/timeline/__tests__/timelineOps.test.ts +55 -0
- package/src/timeline/timelineCommands.ts +54 -0
- package/src/timeline/timelineOps.ts +107 -3
- package/src/tiptapBridge.ts +23 -5
- package/src/treeview/TreeOutlineWidget.tsx +153 -3
- package/src/treeview/__tests__/TreeOutlineWidget.test.tsx +156 -0
- package/src/treeview/__tests__/treeOps.test.ts +52 -0
- package/src/treeview/__tests__/treeViewCommands.test.ts +16 -0
- package/src/treeview/treeOps.ts +59 -0
- package/src/treeview/treeViewCommands.ts +5 -0
- package/src/writeCanvasSettings.ts +30 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiptap extension for `mermaid` code fences.
|
|
3
|
+
*
|
|
4
|
+
* The code block always remains the document source of truth. The extension
|
|
5
|
+
* only hides/shows that block and mounts a rendered Mermaid canvas after it;
|
|
6
|
+
* it never replaces the fence with an editor-only node or a reduced graph
|
|
7
|
+
* model. That keeps every Mermaid diagram type and directive round-trippable.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Extension } from '@tiptap/core';
|
|
11
|
+
import type { Node as PMNode } from '@tiptap/pm/model';
|
|
12
|
+
import { Plugin, PluginKey, type Transaction } from '@tiptap/pm/state';
|
|
13
|
+
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
14
|
+
import type { Editor } from '@tiptap/react';
|
|
15
|
+
import { createElement } from 'react';
|
|
16
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
17
|
+
import { MermaidDiagramWidget } from './MermaidDiagramWidget';
|
|
18
|
+
|
|
19
|
+
export interface MermaidDiagramBlockEntry {
|
|
20
|
+
/** Synthetic session id, stable while this code block remains in the doc. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Current ProseMirror position of the `codeBlock`. */
|
|
23
|
+
pos: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface MermaidDiagramPluginState {
|
|
27
|
+
entries: MermaidDiagramBlockEntry[];
|
|
28
|
+
decorations: DecorationSet;
|
|
29
|
+
sourceVisible: ReadonlySet<string>;
|
|
30
|
+
seq: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MermaidDiagramExtensionOptions {
|
|
34
|
+
/** When false, leave Mermaid fences as ordinary code blocks. */
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const MERMAID_DIAGRAM_KEY = new PluginKey<MermaidDiagramPluginState>(
|
|
39
|
+
'squisq-mermaid-diagram',
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function fenceLanguage(node: PMNode): string {
|
|
43
|
+
const language = (node.attrs as { language?: unknown }).language;
|
|
44
|
+
return typeof language === 'string' ? language.trim().toLowerCase() : '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Mermaid is an explicit mode: only a `mermaid` language tag claims it. */
|
|
48
|
+
export function isMermaidDiagramNode(node: PMNode): boolean {
|
|
49
|
+
return node.type.name === 'codeBlock' && fenceLanguage(node) === 'mermaid';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function findMermaidDiagramBlockPos(editor: Editor, blockId: string): number | null {
|
|
53
|
+
const state = MERMAID_DIAGRAM_KEY.getState(editor.state);
|
|
54
|
+
return state?.entries.find((entry) => entry.id === blockId)?.pos ?? null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function isMermaidSourceVisible(editor: Editor, blockId: string): boolean {
|
|
58
|
+
return MERMAID_DIAGRAM_KEY.getState(editor.state)?.sourceVisible.has(blockId) ?? false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Toggle the editable code block without changing any document bytes. */
|
|
62
|
+
export function toggleMermaidSource(editor: Editor, blockId: string): void {
|
|
63
|
+
editor.view.dispatch(editor.state.tr.setMeta(MERMAID_DIAGRAM_KEY, { toggleSource: blockId }));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface WidgetRootRef {
|
|
67
|
+
root: Root;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function buildDecorations(
|
|
71
|
+
doc: PMNode,
|
|
72
|
+
entries: readonly MermaidDiagramBlockEntry[],
|
|
73
|
+
sourceVisible: ReadonlySet<string>,
|
|
74
|
+
editor: Editor,
|
|
75
|
+
): DecorationSet {
|
|
76
|
+
const decorations: Decoration[] = [];
|
|
77
|
+
for (const entry of entries) {
|
|
78
|
+
const node = doc.nodeAt(entry.pos);
|
|
79
|
+
if (!node || !isMermaidDiagramNode(node)) continue;
|
|
80
|
+
decorations.push(
|
|
81
|
+
Decoration.node(entry.pos, entry.pos + node.nodeSize, {
|
|
82
|
+
class: sourceVisible.has(entry.id)
|
|
83
|
+
? 'squisq-mermaid-fence-source'
|
|
84
|
+
: 'squisq-mermaid-fence-hidden',
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
const blockId = entry.id;
|
|
88
|
+
decorations.push(
|
|
89
|
+
Decoration.widget(
|
|
90
|
+
entry.pos + node.nodeSize,
|
|
91
|
+
(view) => {
|
|
92
|
+
const container = document.createElement('div');
|
|
93
|
+
container.className = 'squisq-mermaid-diagram-widget-host';
|
|
94
|
+
container.contentEditable = 'false';
|
|
95
|
+
container.addEventListener('mousedown', (event) => event.stopPropagation());
|
|
96
|
+
container.addEventListener('keydown', (event) => event.stopPropagation());
|
|
97
|
+
const root = createRoot(container);
|
|
98
|
+
root.render(
|
|
99
|
+
createElement(MermaidDiagramWidget, {
|
|
100
|
+
editor,
|
|
101
|
+
blockId,
|
|
102
|
+
host: view.dom.parentElement ?? view.dom,
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
105
|
+
(container as HTMLElement & { __squisqMermaidRoot?: WidgetRootRef }).__squisqMermaidRoot =
|
|
106
|
+
{ root };
|
|
107
|
+
return container;
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
destroy: (dom) => {
|
|
111
|
+
const ref = (dom as HTMLElement & { __squisqMermaidRoot?: WidgetRootRef })
|
|
112
|
+
.__squisqMermaidRoot;
|
|
113
|
+
if (ref) setTimeout(() => ref.root.unmount(), 0);
|
|
114
|
+
},
|
|
115
|
+
ignoreSelection: true,
|
|
116
|
+
key: `squisq-mermaid-${entry.id}`,
|
|
117
|
+
side: 1,
|
|
118
|
+
},
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return DecorationSet.create(doc, decorations);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function remapEntries(
|
|
126
|
+
tr: Transaction,
|
|
127
|
+
previous: MermaidDiagramPluginState,
|
|
128
|
+
doc: PMNode,
|
|
129
|
+
): { entries: MermaidDiagramBlockEntry[]; seq: number } {
|
|
130
|
+
const mapped = new Map<number, string>();
|
|
131
|
+
const claimed = new Set<string>();
|
|
132
|
+
|
|
133
|
+
for (const entry of previous.entries) {
|
|
134
|
+
const result = tr.mapping.mapResult(entry.pos, 1);
|
|
135
|
+
if (!result.deleted) {
|
|
136
|
+
mapped.set(result.pos, entry.id);
|
|
137
|
+
claimed.add(entry.id);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Attribute and content edits can mark the opening token as replaced even
|
|
142
|
+
// when the same code block remains at the mapped position.
|
|
143
|
+
for (const entry of previous.entries) {
|
|
144
|
+
if (claimed.has(entry.id)) continue;
|
|
145
|
+
const result = tr.mapping.mapResult(entry.pos, 1);
|
|
146
|
+
if (mapped.has(result.pos)) continue;
|
|
147
|
+
if (doc.nodeAt(result.pos)?.type.name === 'codeBlock') {
|
|
148
|
+
mapped.set(result.pos, entry.id);
|
|
149
|
+
claimed.add(entry.id);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
let seq = previous.seq;
|
|
154
|
+
const entries: MermaidDiagramBlockEntry[] = [];
|
|
155
|
+
doc.descendants((node, pos) => {
|
|
156
|
+
if (node.type.name !== 'codeBlock') return;
|
|
157
|
+
if (!isMermaidDiagramNode(node)) return false;
|
|
158
|
+
entries.push({ id: mapped.get(pos) ?? `mermaid-${++seq}`, pos });
|
|
159
|
+
return false;
|
|
160
|
+
});
|
|
161
|
+
return { entries, seq };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function applyState(
|
|
165
|
+
tr: Transaction,
|
|
166
|
+
previous: MermaidDiagramPluginState,
|
|
167
|
+
editor: Editor,
|
|
168
|
+
doc: PMNode,
|
|
169
|
+
): MermaidDiagramPluginState {
|
|
170
|
+
const meta = tr.getMeta(MERMAID_DIAGRAM_KEY) as { toggleSource?: string } | undefined;
|
|
171
|
+
let sourceVisible = previous.sourceVisible;
|
|
172
|
+
if (meta?.toggleSource) {
|
|
173
|
+
const next = new Set(sourceVisible);
|
|
174
|
+
if (next.has(meta.toggleSource)) next.delete(meta.toggleSource);
|
|
175
|
+
else next.add(meta.toggleSource);
|
|
176
|
+
sourceVisible = next;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!tr.docChanged) {
|
|
180
|
+
if (!meta?.toggleSource) return previous;
|
|
181
|
+
return {
|
|
182
|
+
...previous,
|
|
183
|
+
sourceVisible,
|
|
184
|
+
decorations: buildDecorations(doc, previous.entries, sourceVisible, editor),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const { entries, seq } = remapEntries(tr, previous, doc);
|
|
189
|
+
const liveIds = new Set(entries.map((entry) => entry.id));
|
|
190
|
+
const prunedSourceVisible = new Set([...sourceVisible].filter((id) => liveIds.has(id)));
|
|
191
|
+
return {
|
|
192
|
+
entries,
|
|
193
|
+
seq,
|
|
194
|
+
sourceVisible: prunedSourceVisible,
|
|
195
|
+
decorations: buildDecorations(doc, entries, prunedSourceVisible, editor),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const MermaidDiagramExtension = Extension.create<MermaidDiagramExtensionOptions>({
|
|
200
|
+
name: 'squisqMermaidDiagram',
|
|
201
|
+
|
|
202
|
+
addOptions() {
|
|
203
|
+
return { enabled: true };
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
addProseMirrorPlugins() {
|
|
207
|
+
if (this.options.enabled === false) return [];
|
|
208
|
+
const editor = this.editor as Editor;
|
|
209
|
+
return [
|
|
210
|
+
new Plugin<MermaidDiagramPluginState>({
|
|
211
|
+
key: MERMAID_DIAGRAM_KEY,
|
|
212
|
+
state: {
|
|
213
|
+
init: (_config, state) => {
|
|
214
|
+
let seq = 0;
|
|
215
|
+
const entries: MermaidDiagramBlockEntry[] = [];
|
|
216
|
+
state.doc.descendants((node, pos) => {
|
|
217
|
+
if (node.type.name !== 'codeBlock') return;
|
|
218
|
+
if (!isMermaidDiagramNode(node)) return false;
|
|
219
|
+
entries.push({ id: `mermaid-${++seq}`, pos });
|
|
220
|
+
return false;
|
|
221
|
+
});
|
|
222
|
+
const sourceVisible = new Set<string>();
|
|
223
|
+
return {
|
|
224
|
+
entries,
|
|
225
|
+
seq,
|
|
226
|
+
sourceVisible,
|
|
227
|
+
decorations: buildDecorations(state.doc, entries, sourceVisible, editor),
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
apply: (tr, previous, _oldState, newState) =>
|
|
231
|
+
applyState(tr, previous, editor, newState.doc),
|
|
232
|
+
},
|
|
233
|
+
props: {
|
|
234
|
+
decorations(state) {
|
|
235
|
+
return this.getState(state)?.decorations ?? DecorationSet.empty;
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
}),
|
|
239
|
+
];
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export default MermaidDiagramExtension;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MermaidDiagramPreview } from './mermaidDiagramTypes';
|
|
3
|
+
|
|
4
|
+
/** Small authored SVG cues; these avoid spinning up Mermaid for every gallery tile. */
|
|
5
|
+
export function MermaidDiagramTypeThumbnail({ preview }: { preview: MermaidDiagramPreview }) {
|
|
6
|
+
const common = { fill: 'none', stroke: 'currentColor', strokeWidth: 2 } as const;
|
|
7
|
+
|
|
8
|
+
let art: ReactNode;
|
|
9
|
+
switch (preview) {
|
|
10
|
+
case 'sequence':
|
|
11
|
+
art = (
|
|
12
|
+
<>
|
|
13
|
+
<rect x="14" y="8" width="28" height="12" rx="2" />
|
|
14
|
+
<rect x="78" y="8" width="28" height="12" rx="2" />
|
|
15
|
+
<path d="M28 20v36M92 20v36M30 30h58l-6-4m6 4-6 4M90 45H32l6-4m-6 4 6 4" />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
break;
|
|
19
|
+
case 'state':
|
|
20
|
+
art = (
|
|
21
|
+
<>
|
|
22
|
+
<circle cx="13" cy="32" r="5" fill="currentColor" />
|
|
23
|
+
<rect x="32" y="20" width="34" height="24" rx="10" />
|
|
24
|
+
<circle cx="101" cy="32" r="8" />
|
|
25
|
+
<circle cx="101" cy="32" r="4" fill="currentColor" />
|
|
26
|
+
<path d="M18 32h14m34 0h27m-5-4 5 4-5 4" />
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
break;
|
|
30
|
+
case 'class':
|
|
31
|
+
case 'requirement':
|
|
32
|
+
art = (
|
|
33
|
+
<>
|
|
34
|
+
<rect x="10" y="10" width="40" height="44" rx="2" />
|
|
35
|
+
<path d="M10 23h40M10 37h40M24 29h18M18 44h24" />
|
|
36
|
+
<rect x="75" y="18" width="35" height="30" rx="2" />
|
|
37
|
+
<path d="M50 32h25m-6-4 6 4-6 4M82 28h20M82 38h14" />
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
break;
|
|
41
|
+
case 'er':
|
|
42
|
+
art = (
|
|
43
|
+
<>
|
|
44
|
+
<rect x="8" y="17" width="35" height="30" rx="2" />
|
|
45
|
+
<rect x="78" y="17" width="35" height="30" rx="2" />
|
|
46
|
+
<path d="M43 32h35M50 26v12m21-12v12M55 32l6-6v12z" />
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
break;
|
|
50
|
+
case 'mindmap':
|
|
51
|
+
art = (
|
|
52
|
+
<>
|
|
53
|
+
<ellipse cx="60" cy="32" rx="20" ry="10" />
|
|
54
|
+
<path d="M40 29L18 16m22 19L18 49m62-20 22-13M80 35l22 14" />
|
|
55
|
+
<circle cx="15" cy="14" r="5" />
|
|
56
|
+
<circle cx="15" cy="50" r="5" />
|
|
57
|
+
<circle cx="105" cy="14" r="5" />
|
|
58
|
+
<circle cx="105" cy="50" r="5" />
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
break;
|
|
62
|
+
case 'c4':
|
|
63
|
+
case 'architecture':
|
|
64
|
+
art = (
|
|
65
|
+
<>
|
|
66
|
+
<rect x="6" y="7" width="108" height="50" rx="5" strokeDasharray="4 3" />
|
|
67
|
+
<rect x="14" y="21" width="25" height="20" rx="3" />
|
|
68
|
+
<rect x="48" y="21" width="25" height="20" rx="3" />
|
|
69
|
+
<ellipse cx="99" cy="31" rx="12" ry="10" />
|
|
70
|
+
<path d="M39 31h9m25 0h14m-5-4 5 4-5 4" />
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
break;
|
|
74
|
+
case 'gantt':
|
|
75
|
+
art = (
|
|
76
|
+
<>
|
|
77
|
+
<path d="M20 8v48M20 16h94M20 30h94M20 44h94M40 8v48M65 8v48M90 8v48" opacity=".35" />
|
|
78
|
+
<rect x="28" y="19" width="30" height="7" rx="2" fill="currentColor" />
|
|
79
|
+
<rect x="52" y="33" width="42" height="7" rx="2" fill="currentColor" />
|
|
80
|
+
<path d="M94 47l5 5 5-5-5-5z" fill="currentColor" />
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
break;
|
|
84
|
+
case 'timeline':
|
|
85
|
+
case 'journey':
|
|
86
|
+
art = (
|
|
87
|
+
<>
|
|
88
|
+
<path d="M8 38h104M18 38V20M58 38V12M99 38V24" />
|
|
89
|
+
<circle cx="18" cy="38" r="5" fill="currentColor" />
|
|
90
|
+
<circle cx="58" cy="38" r="5" fill="currentColor" />
|
|
91
|
+
<circle cx="99" cy="38" r="5" fill="currentColor" />
|
|
92
|
+
<path d="M12 17h22M48 9h25M88 21h25" />
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
break;
|
|
96
|
+
case 'kanban':
|
|
97
|
+
art = (
|
|
98
|
+
<>
|
|
99
|
+
<rect x="7" y="8" width="31" height="48" rx="3" />
|
|
100
|
+
<rect x="44" y="8" width="31" height="48" rx="3" />
|
|
101
|
+
<rect x="81" y="8" width="31" height="48" rx="3" />
|
|
102
|
+
<path d="M13 17h19M50 17h19M87 17h19" />
|
|
103
|
+
<rect x="12" y="24" width="21" height="10" rx="2" fill="currentColor" opacity=".55" />
|
|
104
|
+
<rect x="49" y="24" width="21" height="17" rx="2" fill="currentColor" opacity=".55" />
|
|
105
|
+
<rect x="86" y="24" width="21" height="10" rx="2" fill="currentColor" opacity=".55" />
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
break;
|
|
109
|
+
case 'git':
|
|
110
|
+
art = (
|
|
111
|
+
<>
|
|
112
|
+
<path d="M13 16h94M34 16c10 0 8 32 22 32h40" />
|
|
113
|
+
{[13, 34, 68, 96].map((x) => (
|
|
114
|
+
<circle key={x} cx={x} cy="16" r="5" fill="currentColor" />
|
|
115
|
+
))}
|
|
116
|
+
<circle cx="56" cy="48" r="5" fill="currentColor" />
|
|
117
|
+
<circle cx="96" cy="48" r="5" fill="currentColor" />
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
break;
|
|
121
|
+
case 'pie':
|
|
122
|
+
art = (
|
|
123
|
+
<>
|
|
124
|
+
<circle cx="60" cy="32" r="24" />
|
|
125
|
+
<path d="M60 32V8a24 24 0 0 1 20.8 36z" fill="currentColor" opacity=".65" />
|
|
126
|
+
<path d="M60 32l20.8 12A24 24 0 0 1 38 48z" fill="currentColor" opacity=".32" />
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
break;
|
|
130
|
+
case 'quadrant':
|
|
131
|
+
art = (
|
|
132
|
+
<>
|
|
133
|
+
<path d="M12 54h98M12 54V8M61 8v46M12 31h98" opacity=".55" />
|
|
134
|
+
<circle cx="35" cy="20" r="5" fill="currentColor" />
|
|
135
|
+
<circle cx="85" cy="17" r="5" fill="currentColor" opacity=".7" />
|
|
136
|
+
<circle cx="73" cy="42" r="5" fill="currentColor" opacity=".45" />
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
break;
|
|
140
|
+
case 'sankey':
|
|
141
|
+
art = (
|
|
142
|
+
<>
|
|
143
|
+
<rect x="7" y="12" width="9" height="40" rx="2" fill="currentColor" />
|
|
144
|
+
<rect x="55" y="8" width="9" height="48" rx="2" fill="currentColor" opacity=".65" />
|
|
145
|
+
<rect x="104" y="10" width="9" height="18" rx="2" fill="currentColor" />
|
|
146
|
+
<rect x="104" y="38" width="9" height="14" rx="2" fill="currentColor" opacity=".5" />
|
|
147
|
+
<path
|
|
148
|
+
d="M16 20C35 20 37 17 55 17M16 44c20 0 21 3 39 3M64 18c20 0 21 0 40 0M64 45c20 0 20 0 40 0"
|
|
149
|
+
strokeWidth="8"
|
|
150
|
+
opacity=".35"
|
|
151
|
+
/>
|
|
152
|
+
</>
|
|
153
|
+
);
|
|
154
|
+
break;
|
|
155
|
+
case 'xy':
|
|
156
|
+
art = (
|
|
157
|
+
<>
|
|
158
|
+
<path d="M15 8v46h96" />
|
|
159
|
+
<rect x="27" y="35" width="10" height="19" fill="currentColor" opacity=".35" />
|
|
160
|
+
<rect x="51" y="25" width="10" height="29" fill="currentColor" opacity=".35" />
|
|
161
|
+
<rect x="75" y="16" width="10" height="38" fill="currentColor" opacity=".35" />
|
|
162
|
+
<path d="M20 43l24-12 24 5 33-22" strokeWidth="3" />
|
|
163
|
+
<circle cx="44" cy="31" r="3" fill="currentColor" />
|
|
164
|
+
<circle cx="68" cy="36" r="3" fill="currentColor" />
|
|
165
|
+
<circle cx="101" cy="14" r="3" fill="currentColor" />
|
|
166
|
+
</>
|
|
167
|
+
);
|
|
168
|
+
break;
|
|
169
|
+
default:
|
|
170
|
+
art = (
|
|
171
|
+
<>
|
|
172
|
+
<rect x="8" y="18" width="35" height="28" rx="3" />
|
|
173
|
+
<path d="M43 32h33m-6-5 6 5-6 5" />
|
|
174
|
+
<rect x="77" y="18" width="35" height="28" rx="3" />
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<svg viewBox="0 0 120 64" aria-hidden="true" focusable="false" {...common}>
|
|
181
|
+
{art}
|
|
182
|
+
</svg>
|
|
183
|
+
);
|
|
184
|
+
}
|