@draftably/editor 0.1.0 → 0.2.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.
Files changed (97) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/{engine.worker-DmHew5f6.js → engine.worker-DwN9io_m.js} +2765 -2722
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +19553 -2
  5. package/dist/types/src/components/controls.d.ts +8 -5
  6. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  7. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  8. package/dist/types/src/state/links.d.ts +4 -1
  9. package/dist/types/src/state/workspace.d.ts +3 -0
  10. package/package.json +1 -1
  11. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  12. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  13. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  14. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  15. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  16. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  17. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  18. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  19. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  20. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  21. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  22. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  23. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  24. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  25. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  26. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  27. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  28. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  29. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  30. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  31. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  32. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  33. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  34. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  35. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  36. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  37. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  38. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  39. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  40. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  41. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  42. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  43. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  44. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  45. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  46. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  47. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  48. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  49. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  50. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  51. package/dist/chunks/init-DjUOC4st.js +0 -16
  52. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  53. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  54. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  55. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  56. package/dist/chunks/linear-4t7D_ros.js +0 -259
  57. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  58. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  59. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  60. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  61. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  62. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  63. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  64. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  65. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  66. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  67. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  68. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  69. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  70. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  71. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  72. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  73. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  74. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  75. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  76. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  77. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  78. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  79. package/dist/types/src/import/browser.d.ts +0 -3
  80. package/dist/types/src/import/detect.d.ts +0 -31
  81. package/dist/types/src/import/dot-importer.d.ts +0 -3
  82. package/dist/types/src/import/import-core.d.ts +0 -105
  83. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  84. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  85. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  86. package/dist/types/src/import/scratch.d.ts +0 -3
  87. package/dist/types/src/lib/source-hash.d.ts +0 -7
  88. package/dist/types/src/model/candidates.d.ts +0 -53
  89. package/dist/types/src/model/examples.d.ts +0 -15
  90. package/dist/types/src/model/label-hits.d.ts +0 -27
  91. package/dist/types/src/model/static-scene.d.ts +0 -15
  92. package/dist/types/src/state/commands.d.ts +0 -529
  93. package/dist/types/src/state/comparison.d.ts +0 -151
  94. package/dist/types/src/state/files.d.ts +0 -61
  95. package/dist/types/src/state/keyboard.d.ts +0 -6
  96. package/dist/types/src/state/launch.d.ts +0 -61
  97. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,346 +0,0 @@
1
- import { I as W } from "./chunk-2Q5K7J3B-gqtzQ8ux.js";
2
- import { p as X } from "./chunk-JWPE2WC7-CnAFS2xF.js";
3
- import { q as z, b as G, s as Y, t as P, g as q, a as F, _ as g, N as k, l as A, Q as Z, d as j, L as E, A as U, j as Q, aq as J, O as K, ar as ee } from "./mermaid.core-DXv6D2Sm.js";
4
- import { p as te } from "./cynefin-EF2NZ3EQ-Bt6b88hY.js";
5
- var L = /[─━│┃└┗├┣]/, D = /[└┗├┣]/, ne = /[─━]/, N = /^[\s│┃]+$/, T = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/, V = /^\s*%%/, re = " ";
6
- function _(n) {
7
- return n.some((t) => L.test(t));
8
- }
9
- g(_, "isBoxDrawingFormat");
10
- function M(n) {
11
- for (const t of n) {
12
- const e = D.exec(t);
13
- if (e?.index && e.index > 0)
14
- return e.index;
15
- }
16
- return 4;
17
- }
18
- g(M, "inferSegmentWidth");
19
- function S(n, t) {
20
- return n.replace(/\bline\s+(\d+)\b/gi, (e, r) => {
21
- const s = parseInt(r, 10), i = t.get(s);
22
- return i ? `line ${i}` : e;
23
- });
24
- }
25
- g(S, "remapErrorLines");
26
- function R(n) {
27
- const t = n.split(`
28
- `), e = /* @__PURE__ */ new Map();
29
- let r = -1;
30
- for (const [p, c] of t.entries())
31
- if (c.trim() === "treeView-beta") {
32
- r = p;
33
- break;
34
- }
35
- if (r === -1)
36
- return { text: n, lineMap: e };
37
- const s = [];
38
- for (let p = r + 1; p < t.length; p++) {
39
- const c = t[p];
40
- c.trim() === "" || V.test(c) || T.test(c) || N.test(c) || s.push(c.replace(/\t/g, " "));
41
- }
42
- if (!_(s))
43
- return { text: n, lineMap: e };
44
- const i = M(s), o = [];
45
- let a = 0;
46
- for (let p = 0; p <= r; p++)
47
- o.push(t[p]), a++, e.set(a, p + 1);
48
- for (let p = r + 1; p < t.length; p++) {
49
- const c = t[p], d = c.trim(), h = p + 1;
50
- if (d === "") {
51
- o.push(c), a++, e.set(a, h);
52
- continue;
53
- }
54
- if (V.test(c)) {
55
- o.push(c), a++, e.set(a, h);
56
- continue;
57
- }
58
- if (T.test(c)) {
59
- o.push(c), a++, e.set(a, h);
60
- continue;
61
- }
62
- if (N.test(c))
63
- continue;
64
- const l = c.replace(/\t/g, " "), w = D.exec(l);
65
- if (w?.index !== void 0) {
66
- const f = w.index, m = Math.round(f / i) + 1;
67
- let u = f + 1;
68
- for (; u < l.length && ne.test(l[u]); )
69
- u++;
70
- for (; u < l.length && l[u] === " "; )
71
- u++;
72
- const v = l.slice(u).trimEnd();
73
- if (!v)
74
- throw new Error(
75
- `Line ${h}: Empty node — expected a filename or directory name after the box-drawing prefix`
76
- );
77
- const O = re.repeat(m);
78
- o.push(O + v), a++, e.set(a, h);
79
- } else {
80
- if (/^[\s─━│┃└┗├┣]+$/.test(l))
81
- continue;
82
- if (L.test(l))
83
- o.push(c), a++, e.set(a, h);
84
- else {
85
- if (/^\s+/.test(l))
86
- throw new Error(
87
- `Line ${h}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`
88
- );
89
- o.push(c), a++, e.set(a, h);
90
- }
91
- }
92
- }
93
- return { text: o.join(`
94
- `), lineMap: e };
95
- }
96
- g(R, "preprocessBoxDrawing");
97
- var x = new W(() => ({
98
- cnt: 1,
99
- stack: [
100
- {
101
- id: 0,
102
- level: -1,
103
- name: "/",
104
- nodeType: "directory",
105
- children: []
106
- }
107
- ]
108
- })), ie = /* @__PURE__ */ g(() => {
109
- x.reset(), U();
110
- }, "clear"), oe = /* @__PURE__ */ g(() => x.records.stack[0], "getRoot"), se = /* @__PURE__ */ g(() => x.records.cnt, "getCount"), ae = K.treeView, ce = /* @__PURE__ */ g(() => k(ae, E().treeView), "getConfig"), le = /* @__PURE__ */ g((n, t, e, r, s, i) => {
111
- for (; n <= x.records.stack[x.records.stack.length - 1].level; )
112
- x.records.stack.pop();
113
- const o = {
114
- id: x.records.cnt++,
115
- level: n,
116
- name: t,
117
- nodeType: e,
118
- icon: s,
119
- cssClass: r,
120
- description: i,
121
- children: []
122
- };
123
- x.records.stack[x.records.stack.length - 1].children.push(o), x.records.stack.push(o);
124
- }, "addNode"), de = {
125
- clear: ie,
126
- addNode: le,
127
- getRoot: oe,
128
- getCount: se,
129
- getConfig: ce,
130
- getAccTitle: F,
131
- getAccDescription: q,
132
- getDiagramTitle: P,
133
- setAccDescription: Y,
134
- setAccTitle: G,
135
- setDiagramTitle: z
136
- }, I = de, he = /* @__PURE__ */ g((n) => {
137
- X(n, I);
138
- for (const t of n.nodes) {
139
- const e = typeof t.indent == "number" ? t.indent : 0;
140
- let r = t.name;
141
- const s = r.endsWith("/");
142
- s && (r = r.slice(0, -1));
143
- const i = s ? "directory" : "file", o = t.classAnnotation || void 0, a = t.iconAnnotation, p = a !== void 0 ? a || "none" : void 0, c = t.descAnnotation || void 0, d = c ? Q(c, E()) : void 0;
144
- I.addNode(e, r, i, o, p, d);
145
- }
146
- }, "populate"), pe = {
147
- parse: /* @__PURE__ */ g(async (n) => {
148
- const { text: t, lineMap: e } = R(n);
149
- try {
150
- const r = await te("treeView", t);
151
- A.debug(r), he(r);
152
- } catch (r) {
153
- throw e.size > 0 && r instanceof Error && (r.message = S(r.message, e)), r;
154
- }
155
- }, "parse")
156
- }, b = {
157
- prefix: "mermaid-treeview",
158
- height: 24,
159
- width: 24,
160
- icons: {
161
- folder: {
162
- body: '<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'
163
- },
164
- file: {
165
- body: '<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'
166
- }
167
- }
168
- };
169
- function H(n, t) {
170
- const e = t?.filenameIcons?.[n];
171
- if (e)
172
- return e;
173
- const r = n.lastIndexOf(".");
174
- if (r > 0) {
175
- const s = n.substring(r).toLowerCase(), i = t?.extensionIcons;
176
- return i?.[s] ?? i?.[s.slice(1)];
177
- }
178
- }
179
- g(H, "detectIcon");
180
- function C(n, t) {
181
- return n.includes(":") ? n : n in b.icons || !t ? `${b.prefix}:${n}` : `${t}:${n}`;
182
- }
183
- g(C, "qualifyIcon");
184
- function B(n, t) {
185
- if (n.icon !== "none") {
186
- if (n.icon)
187
- return C(n.icon, t.defaultIconPack);
188
- if (t.showIcons) {
189
- if (n.nodeType === "file") {
190
- const e = H(n.name, t);
191
- if (e === "none")
192
- return;
193
- if (e)
194
- return C(e, t.defaultIconPack);
195
- }
196
- return `${b.prefix}:${n.nodeType === "directory" ? "folder" : "file"}`;
197
- }
198
- }
199
- }
200
- g(B, "getNodeIcon");
201
- ee([
202
- {
203
- name: b.prefix,
204
- icons: b
205
- }
206
- ]);
207
- var y = 14, ge = 4, fe = 16, ue = /* @__PURE__ */ g(async (n, t) => {
208
- const e = [], r = /* @__PURE__ */ g((i) => {
209
- const o = B(i, t);
210
- o && e.push({ icon: o, node: i }), i.children.forEach(r);
211
- }, "collect");
212
- r(n);
213
- const s = await Promise.all(
214
- e.map(async ({ icon: i, node: o }) => ({
215
- id: o.id,
216
- svg: await J(i, {
217
- height: y,
218
- width: y
219
- })
220
- }))
221
- );
222
- return new Map(s.map(({ id: i, svg: o }) => [i, o]));
223
- }, "resolveNodeIcons"), we = /* @__PURE__ */ g((n, t, e, r, s, i) => {
224
- const o = r.append("g");
225
- let a = "treeView-node-label";
226
- e.nodeType === "directory" && (a += " treeView-node-dir"), e.cssClass && (a += ` ${e.cssClass}`);
227
- const p = y + ge, c = B(e, s), d = c !== void 0;
228
- c && o.append("g").attr("class", "treeView-node-icon").attr("transform", `translate(${n + s.paddingX}, ${t + s.paddingY})`).html(i.get(e.id) ?? "");
229
- const h = o.append("text").text(e.name).attr("dominant-baseline", "middle").attr("class", a), { height: l, width: w } = h.node().getBBox(), f = l + s.paddingY * 2, m = n + s.paddingX + (d ? p : 0);
230
- h.attr("x", m), h.attr("y", t + f / 2);
231
- const u = m + w, v = w + s.paddingX * 2 + (d ? p : 0);
232
- return e.BBox = { x: n, y: t, width: v, height: f }, e.cssClass?.split(/\s+/).includes("highlight") && o.insert("rect", ":first-child").attr("x", n).attr("y", t + 1).attr("width", 0).attr("height", f - 2).attr("rx", 3).attr("class", "treeView-highlight-bg"), { node: e, nodeGroup: o, labelRightEdge: u, centerY: t + f / 2 };
233
- }, "positionLabel"), $ = /* @__PURE__ */ g((n, t, e, r, s, i) => n.append("line").attr("x1", t).attr("y1", e).attr("x2", r).attr("y2", s).attr("stroke-width", i).attr("class", "treeView-node-line"), "positionLine"), me = /* @__PURE__ */ g((n, t, e, r) => {
234
- let s = 0, i = 0;
235
- const o = [], a = /* @__PURE__ */ g((d, h, l, w) => {
236
- const f = w * (l.rowIndent + l.paddingX), m = we(f, s, h, d, l, r);
237
- o.push(m);
238
- const { height: u, width: v } = h.BBox;
239
- $(
240
- d,
241
- f - l.rowIndent,
242
- s + u / 2,
243
- f,
244
- s + u / 2,
245
- l.lineThickness
246
- ), i = Math.max(i, f + v), s += u;
247
- }, "drawNode"), p = /* @__PURE__ */ g((d, h = 0) => {
248
- a(n, d, e, h), d.children.forEach((m) => {
249
- p(m, h + 1);
250
- });
251
- const { x: l, y: w, height: f } = d.BBox;
252
- if (d.children.length) {
253
- const { y: m, height: u } = d.children[d.children.length - 1].BBox;
254
- $(
255
- n,
256
- l + e.paddingX,
257
- w + f,
258
- l + e.paddingX,
259
- m + u / 2 + e.lineThickness / 2,
260
- e.lineThickness
261
- );
262
- }
263
- }, "processNode");
264
- p(t);
265
- const c = o.filter((d) => d.node.description);
266
- if (c.length > 0) {
267
- const h = Math.max(...o.map((l) => l.labelRightEdge)) + fe;
268
- for (const l of c) {
269
- const f = l.nodeGroup.append("text").text(l.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", h).attr("y", l.centerY).node().getBBox();
270
- i = Math.max(i, h + f.width + e.paddingX);
271
- }
272
- }
273
- for (const d of o)
274
- if (d.node.cssClass?.split(/\s+/).includes("highlight")) {
275
- const h = d.nodeGroup.select(".treeView-highlight-bg");
276
- if (!h.empty()) {
277
- const l = i - d.node.BBox.x + 8;
278
- h.attr("width", l), i = Math.max(i, d.node.BBox.x + l + 2);
279
- }
280
- }
281
- return { totalHeight: s, totalWidth: i };
282
- }, "drawTree"), xe = /* @__PURE__ */ g(async (n, t, e, r) => {
283
- A.debug(`Rendering treeView diagram
284
- ` + n);
285
- const s = r.db, i = s.getRoot(), o = s.getConfig(), a = Z(t), p = a.append("g");
286
- p.attr("class", "tree-view");
287
- const c = await ue(i, o), { totalHeight: d, totalWidth: h } = me(p, i, o, c);
288
- a.attr("viewBox", `-${o.lineThickness / 2} 0 ${h} ${d}`), j(a, d, h, o.useMaxWidth);
289
- }, "draw"), ve = {
290
- draw: xe
291
- }, be = ve, Ie = {
292
- labelFontSize: "16px",
293
- labelColor: "black",
294
- lineColor: "black",
295
- iconColor: "#546e7a",
296
- descriptionColor: "#6a9955",
297
- highlightBg: "rgba(255, 193, 7, 0.15)",
298
- highlightStroke: "#ffc107"
299
- }, Ce = /* @__PURE__ */ g(({
300
- treeView: n
301
- }) => {
302
- const {
303
- labelFontSize: t,
304
- labelColor: e,
305
- lineColor: r,
306
- iconColor: s,
307
- descriptionColor: i,
308
- highlightBg: o,
309
- highlightStroke: a
310
- } = k(Ie, n);
311
- return `
312
- .treeView-node-label {
313
- font-size: ${t};
314
- fill: ${e};
315
- white-space: pre;
316
- }
317
- .treeView-node-dir {
318
- font-weight: bold;
319
- }
320
- .treeView-node-line {
321
- stroke: ${r};
322
- }
323
- .treeView-node-icon {
324
- color: ${s};
325
- }
326
- .treeView-node-description {
327
- font-size: ${t};
328
- fill: ${i};
329
- font-style: italic;
330
- white-space: pre;
331
- }
332
- .treeView-highlight-bg {
333
- fill: ${o};
334
- stroke: ${a};
335
- stroke-width: 1;
336
- }
337
- `;
338
- }, "styles"), ye = Ce, $e = {
339
- db: I,
340
- renderer: be,
341
- parser: pe,
342
- styles: ye
343
- };
344
- export {
345
- $e as diagram
346
- };