@draftably/editor 0.1.0 → 0.3.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 (104) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/engine.worker-BY9GKt7x.js +7505 -0
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +20202 -2
  5. package/dist/types/src/cli/raster-fonts.d.ts +3 -0
  6. package/dist/types/src/components/controls.d.ts +8 -5
  7. package/dist/types/src/dsl/compile.d.ts +13 -0
  8. package/dist/types/src/dsl/corridors.d.ts +38 -0
  9. package/dist/types/src/model/types.d.ts +9 -0
  10. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  11. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  12. package/dist/types/src/state/links.d.ts +4 -1
  13. package/dist/types/src/state/workspace.d.ts +3 -0
  14. package/package.json +1 -1
  15. package/dist/assets/engine.worker-DmHew5f6.js +0 -6813
  16. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  17. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  18. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  19. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  20. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  21. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  22. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  23. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  24. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  25. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  26. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  27. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  28. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  29. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  30. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  31. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  32. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  33. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  34. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  35. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  36. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  37. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  38. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  39. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  40. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  41. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  42. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  43. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  44. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  45. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  46. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  47. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  48. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  49. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  50. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  51. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  52. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  53. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  54. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  55. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  56. package/dist/chunks/init-DjUOC4st.js +0 -16
  57. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  58. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  59. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  60. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  61. package/dist/chunks/linear-4t7D_ros.js +0 -259
  62. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  63. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  64. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  65. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  66. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  67. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  68. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  69. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  70. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  71. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  72. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  73. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  74. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  75. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  76. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  77. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  78. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  79. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  80. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  81. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  82. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  83. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  84. package/dist/types/src/cli/png.d.ts +0 -23
  85. package/dist/types/src/import/browser.d.ts +0 -3
  86. package/dist/types/src/import/detect.d.ts +0 -31
  87. package/dist/types/src/import/dot-importer.d.ts +0 -3
  88. package/dist/types/src/import/import-core.d.ts +0 -105
  89. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  90. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  91. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  92. package/dist/types/src/import/scratch.d.ts +0 -3
  93. package/dist/types/src/lib/source-hash.d.ts +0 -7
  94. package/dist/types/src/model/candidates.d.ts +0 -53
  95. package/dist/types/src/model/embed.d.ts +0 -17
  96. package/dist/types/src/model/examples.d.ts +0 -15
  97. package/dist/types/src/model/label-hits.d.ts +0 -27
  98. package/dist/types/src/model/static-scene.d.ts +0 -15
  99. package/dist/types/src/state/commands.d.ts +0 -529
  100. package/dist/types/src/state/comparison.d.ts +0 -151
  101. package/dist/types/src/state/files.d.ts +0 -61
  102. package/dist/types/src/state/keyboard.d.ts +0 -6
  103. package/dist/types/src/state/launch.d.ts +0 -61
  104. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,145 +0,0 @@
1
- const d = Object.freeze({
2
- sourceBytes: 262144,
3
- objects: 500,
4
- edges: 1200,
5
- depth: 12,
6
- labelChars: 16384,
7
- totalLabelBytes: 1048576,
8
- outputBytes: 1048576,
9
- nativeSourceChars: 3e5
10
- }), T = /* @__PURE__ */ new Set(["root", "__proto__", "constructor", "prototype"]);
11
- class p {
12
- entries = [];
13
- byForeign = /* @__PURE__ */ new Map();
14
- taken = new Set(T);
15
- get(n, t, a = t) {
16
- const f = JSON.stringify([n, t]), i = this.byForeign.get(f);
17
- if (i) return i;
18
- let r = [...a].map((c) => /[A-Za-z0-9_.-]/.test(c) ? c : "_u" + c.codePointAt(0).toString(16) + "_").join("");
19
- /^[A-Za-z_]/.test(r) || (r = n + "_" + r), (!r || T.has(r)) && (r = n + "_" + (r || "item"));
20
- let l = r;
21
- for (let c = 2; this.taken.has(l); c++) l = r + "__" + c;
22
- return this.byForeign.set(f, l), this.taken.add(l), this.entries.push({ kind: n, foreign: t, native: l }), l;
23
- }
24
- }
25
- const u = (o) => JSON.stringify(o), M = (o) => ({
26
- title: o,
27
- objects: [],
28
- edges: [],
29
- layouts: [],
30
- colors: []
31
- });
32
- function L(o) {
33
- return new TextEncoder().encode(o).length <= d.sourceBytes && !o.includes("\0") ? [] : [
34
- {
35
- code: "IMPORT_INPUT_LIMIT",
36
- severity: "error",
37
- impact: "limit",
38
- message: "Input must be UTF-8 text without NUL and at most 256 KiB."
39
- }
40
- ];
41
- }
42
- function y(o, n, t, a, f) {
43
- const i = (e, s, h = "semantics") => a.push({ code: e, severity: "error", impact: h, message: s });
44
- (t.objects.length > d.objects || t.edges.length > d.edges) && i(
45
- "IMPORT_GRAPH_LIMIT",
46
- "Native source allows at most 500 nodes plus groups, and 1,200 edges.",
47
- "limit"
48
- );
49
- const r = new TextEncoder();
50
- [t.title, ...t.objects.map((e) => e.label), ...t.edges.map((e) => e.label)].reduce((e, s) => e + r.encode(s).length, 0) > d.totalLabelBytes && i(
51
- "IMPORT_TOTAL_LABEL_LIMIT",
52
- "Expanded native labels exceed a combined 1 MiB of UTF-8 text.",
53
- "limit"
54
- ), t.title.length > d.labelChars && i("IMPORT_LABEL_LIMIT", "Diagram title exceeds 16,384 characters.", "limit");
55
- const c = new Map(t.objects.map((e) => [e.id, e])), I = [...t.objects.map((e) => e.id), ...t.edges.map((e) => e.id)];
56
- (new Set(I).size !== I.length || I.some((e) => T.has(e) || !/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(e))) && i("IMPORT_ID_INVARIANT", "Generated IDs must be safe, globally unique native identifiers.");
57
- const b = (e) => {
58
- const s = [];
59
- let h = c.get(e)?.parent;
60
- for (; h; ) {
61
- if (s.includes(h) || s.length >= d.depth) {
62
- i("IMPORT_HIERARCHY", "Containment cycle or excessive nesting.");
63
- break;
64
- }
65
- if (s.push(h), c.get(h)?.kind !== "group") {
66
- i("IMPORT_PARENT", "Missing or non-group parent: " + h);
67
- break;
68
- }
69
- h = c.get(h)?.parent;
70
- }
71
- return s;
72
- };
73
- for (const e of t.objects)
74
- b(e.id).length + 1 > d.depth && i("IMPORT_DEPTH", "Native source permits 12 nesting levels.", "limit"), e.label.length > d.labelChars && i("IMPORT_LABEL_LIMIT", "Label exceeds 16,384 characters.", "limit");
75
- for (const e of t.edges)
76
- (!c.has(e.from) || !c.has(e.to)) && i("IMPORT_ENDPOINT", "Missing endpoint for " + e.id), (b(e.from).includes(e.to) || b(e.to).includes(e.from)) && i(
77
- "IMPORT_ANCESTOR_EDGE",
78
- "Native source cannot connect a group to one of its descendants."
79
- ), e.label.length > d.labelChars && i("IMPORT_LABEL_LIMIT", "Edge label exceeds 16,384 characters.", "limit");
80
- const g = t.edges.some((e) => !e.directed) ? ["IMP-02-native-undirected"] : [];
81
- if (a.some((e) => e.severity === "error"))
82
- return { status: "failed", format: o, family: n, diagnostics: a, ids: f.entries, requires: g };
83
- const m = ["diagram " + u(t.title) + " version=1"];
84
- for (const e of t.colors)
85
- m.push(
86
- "theme-color " + e.name + " shade=500 fill=" + u(e.fill) + " stroke=" + u(e.stroke) + " ink=" + u(e.ink)
87
- );
88
- for (const e of t.objects) {
89
- let s = e.kind + " " + e.id + " " + u(e.label);
90
- e.parent && (s += " in=" + e.parent), e.shape && e.shape !== "box" && e.kind === "node" && (s += " shape=" + e.shape), e.color && (s += " color=" + e.color + " shade=" + (e.shade ?? 500)), m.push(s);
91
- }
92
- for (const e of t.edges) {
93
- let s = "edge " + e.id + " " + e.from + " -> " + e.to + " " + u(e.label);
94
- e.directed || (s += " directed=false"), e.head && e.head !== "arrow" && (s += " head=" + e.head), e.tail && e.tail !== "none" && (s += " tail=" + e.tail), e.dashed && (s += " kind=async"), e.constraint === !1 && (s += " constraint=false"), e.fromSide && (s += " from=" + e.fromSide), e.toSide && (s += " to=" + e.toSide), m.push(s);
95
- }
96
- for (const e of t.layouts)
97
- m.push(
98
- "layout " + e.scope + " " + e.kind + (e.direction ? " direction=" + e.direction : "")
99
- );
100
- for (const e of t.phases ?? [])
101
- m.push(["phase", e.id, u(e.label), ...e.members].join(" "));
102
- for (const e of t.notes ?? []) {
103
- let s = "note " + u(e.text);
104
- e.near && (s += " near=" + e.near), e.side && (s += " side=" + e.side), m.push(s);
105
- }
106
- const _ = m.join(`
107
- `) + `
108
- `;
109
- return _.length > d.nativeSourceChars && i(
110
- "IMPORT_NATIVE_SOURCE_LIMIT",
111
- "Generated source exceeds the native parser limit of 300,000 source characters.",
112
- "limit"
113
- ), r.encode(_).length > d.outputBytes && i("IMPORT_OUTPUT_LIMIT", "Generated native source exceeds 1 MiB of UTF-8 text.", "limit"), a.some((e) => e.severity === "error") ? { status: "failed", format: o, family: n, diagnostics: a, ids: f.entries, requires: g } : {
114
- status: a.some((e) => e.severity === "warning") ? "needs-review" : "ready",
115
- format: o,
116
- family: n,
117
- diagnostics: a,
118
- ids: f.entries,
119
- requires: g,
120
- nativeSource: _,
121
- facts: t
122
- };
123
- }
124
- function P(o) {
125
- if (o) {
126
- if (/^#[a-f0-9]{6}$/i.test(o)) return o.toLowerCase();
127
- if (/^#[a-f0-9]{3}$/i.test(o))
128
- return "#" + [...o.slice(1)].map((n) => n + n).join("").toLowerCase();
129
- }
130
- }
131
- function O(o, n, t, a, f) {
132
- if (!t && !a && !f) return;
133
- const i = { fill: t ?? "#ffffff", stroke: a ?? "#64748b", ink: f ?? "#172033" };
134
- let r = o.colors.find((l) => l.fill === i.fill && l.stroke === i.stroke && l.ink === i.ink);
135
- r || (r = { name: "import_" + (o.colors.length + 1), ...i }, o.colors.push(r)), n.color = r.name, n.shade = 500;
136
- }
137
- export {
138
- p as I,
139
- d as L,
140
- O as a,
141
- M as b,
142
- y as f,
143
- P as h,
144
- L as i
145
- };
@@ -1,24 +0,0 @@
1
- import { _ as e, l as s, Q as o, d as i } from "./mermaid.core-DXv6D2Sm.js";
2
- import { p as g } from "./cynefin-EF2NZ3EQ-Bt6b88hY.js";
3
- var d = {
4
- parse: /* @__PURE__ */ e(async (r) => {
5
- const a = await g("info", r);
6
- s.debug(a);
7
- }, "parse")
8
- }, p = {
9
- version: "12.2.0"
10
- }, v = /* @__PURE__ */ e(() => p.version, "getVersion"), m = {
11
- getVersion: v
12
- }, c = /* @__PURE__ */ e((r, a, n) => {
13
- s.debug(`rendering info diagram
14
- ` + r);
15
- const t = o(a);
16
- i(t, 100, 400, !0), t.append("g").append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${n}`);
17
- }, "draw"), l = { draw: c }, _ = {
18
- parser: d,
19
- db: m,
20
- renderer: l
21
- };
22
- export {
23
- _ as diagram
24
- };
@@ -1,16 +0,0 @@
1
- function t(e, a) {
2
- switch (arguments.length) {
3
- case 0:
4
- break;
5
- case 1:
6
- this.range(e);
7
- break;
8
- default:
9
- this.range(a).domain(e);
10
- break;
11
- }
12
- return this;
13
- }
14
- export {
15
- t as i
16
- };