@zuilib/text-editor 0.8.0 → 0.9.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/dist/index.js CHANGED
@@ -1699,12 +1699,26 @@ import {
1699
1699
  useEffect as useEffect7,
1700
1700
  useMemo,
1701
1701
  useRef as useRef4,
1702
- useState as useState3
1702
+ useState as useState3,
1703
+ useContext as useContext2
1703
1704
  } from "react";
1704
1705
  import { $getNodeByKey as $getNodeByKey2 } from "lexical";
1705
1706
  import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
1706
1707
  import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
1707
1708
 
1709
+ // src/editorContext.ts
1710
+ import { createContext, useContext } from "react";
1711
+ var EditorContext = createContext(null);
1712
+ function useEditorContext() {
1713
+ const ctx = useContext(EditorContext);
1714
+ if (!ctx) {
1715
+ throw new Error(
1716
+ "@zuilib/text-editor: this component must be rendered inside <MarkdownEditor> or <MarkdownEditor.Root>"
1717
+ );
1718
+ }
1719
+ return ctx;
1720
+ }
1721
+
1708
1722
  // src/drawing/focusCommand.ts
1709
1723
  import { createCommand } from "lexical";
1710
1724
  var DRAWING_FOCUS_COMMAND = createCommand(
@@ -2138,23 +2152,23 @@ var BOX_DEFINITIONS = {
2138
2152
  defaultFill: "#ffec99",
2139
2153
  outline: (s) => {
2140
2154
  const b = bbox(s);
2141
- const f = NOTE_FOLD(b);
2155
+ const f3 = NOTE_FOLD(b);
2142
2156
  return [
2143
2157
  { x: b.x, y: b.y },
2144
2158
  { x: b.x + b.w, y: b.y },
2145
- { x: b.x + b.w, y: b.y + b.h - f },
2146
- { x: b.x + b.w - f, y: b.y + b.h },
2159
+ { x: b.x + b.w, y: b.y + b.h - f3 },
2160
+ { x: b.x + b.w - f3, y: b.y + b.h },
2147
2161
  { x: b.x, y: b.y + b.h }
2148
2162
  ];
2149
2163
  },
2150
2164
  textArea: (s) => {
2151
2165
  const b = bbox(s);
2152
- const f = NOTE_FOLD(b);
2166
+ const f3 = NOTE_FOLD(b);
2153
2167
  return {
2154
2168
  x: b.x + BOX_TEXT_PADDING,
2155
2169
  y: b.y + BOX_TEXT_PADDING,
2156
2170
  w: Math.max(b.w - BOX_TEXT_PADDING * 2, 20),
2157
- h: Math.max(b.h - BOX_TEXT_PADDING * 2 - f / 2, 10)
2171
+ h: Math.max(b.h - BOX_TEXT_PADDING * 2 - f3 / 2, 10)
2158
2172
  };
2159
2173
  }
2160
2174
  },
@@ -2656,13 +2670,17 @@ function segmentAngleAt(points, index, backward) {
2656
2670
  }
2657
2671
  return 0;
2658
2672
  }
2659
- function arrowHeadPath(tip, angle, length) {
2673
+ function arrowHeadPoints(tip, angle, length) {
2660
2674
  const spread = Math.PI / 7;
2661
- const hx1 = tip.x - length * Math.cos(angle - spread);
2662
- const hy1 = tip.y - length * Math.sin(angle - spread);
2663
- const hx2 = tip.x - length * Math.cos(angle + spread);
2664
- const hy2 = tip.y - length * Math.sin(angle + spread);
2665
- return `M ${fmt(hx1)} ${fmt(hy1)} L ${fmt(tip.x)} ${fmt(tip.y)} L ${fmt(hx2)} ${fmt(hy2)}`;
2675
+ return [
2676
+ { x: tip.x - length * Math.cos(angle - spread), y: tip.y - length * Math.sin(angle - spread) },
2677
+ tip,
2678
+ { x: tip.x - length * Math.cos(angle + spread), y: tip.y - length * Math.sin(angle + spread) }
2679
+ ];
2680
+ }
2681
+ function arrowHeadPath(tip, angle, length) {
2682
+ const [a, t, b] = arrowHeadPoints(tip, angle, length);
2683
+ return `M ${fmt(a.x)} ${fmt(a.y)} L ${fmt(t.x)} ${fmt(t.y)} L ${fmt(b.x)} ${fmt(b.y)}`;
2666
2684
  }
2667
2685
  function pathLength(points) {
2668
2686
  let total = 0;
@@ -3774,7 +3792,7 @@ function BoxGeometry({
3774
3792
  }
3775
3793
  );
3776
3794
  case "note": {
3777
- const f = NOTE_FOLD(b);
3795
+ const f3 = NOTE_FOLD(b);
3778
3796
  const r = b.x + b.w;
3779
3797
  const btm = b.y + b.h;
3780
3798
  return /* @__PURE__ */ jsxs4("g", { children: [
@@ -3782,7 +3800,7 @@ function BoxGeometry({
3782
3800
  "path",
3783
3801
  {
3784
3802
  ...stroke,
3785
- d: `M ${n(b.x)} ${n(b.y)} H ${n(r)} V ${n(btm - f)} L ${n(r - f)} ${n(btm)} H ${n(b.x)} Z`,
3803
+ d: `M ${n(b.x)} ${n(b.y)} H ${n(r)} V ${n(btm - f3)} L ${n(r - f3)} ${n(btm)} H ${n(b.x)} Z`,
3786
3804
  fill
3787
3805
  }
3788
3806
  ),
@@ -3790,7 +3808,7 @@ function BoxGeometry({
3790
3808
  "path",
3791
3809
  {
3792
3810
  ...stroke,
3793
- d: `M ${n(r - f)} ${n(btm)} V ${n(btm - f)} H ${n(r)}`,
3811
+ d: `M ${n(r - f3)} ${n(btm)} V ${n(btm - f3)} H ${n(r)}`,
3794
3812
  fill: "rgba(0,0,0,0.08)"
3795
3813
  }
3796
3814
  )
@@ -3873,8 +3891,385 @@ function BoxGeometry({
3873
3891
  }
3874
3892
  }
3875
3893
 
3876
- // src/drawing/canvas/ShapeView.tsx
3894
+ // src/drawing/ink.ts
3895
+ var SAMPLE_STEP = 5;
3896
+ var PRESSURE = 0.3;
3897
+ function seedFrom(text) {
3898
+ let h = 2166136261;
3899
+ for (let i = 0; i < text.length; i++) {
3900
+ h ^= text.charCodeAt(i);
3901
+ h = Math.imul(h, 16777619);
3902
+ }
3903
+ return h >>> 0;
3904
+ }
3905
+ function mulberry32(seed) {
3906
+ let a = seed >>> 0;
3907
+ return () => {
3908
+ a = a + 1831565813 | 0;
3909
+ let t = Math.imul(a ^ a >>> 15, 1 | a);
3910
+ t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
3911
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
3912
+ };
3913
+ }
3914
+ function inkAmplitude(size) {
3915
+ return Math.min(4, Math.max(1, size * 0.03));
3916
+ }
3917
+ function inkFillOffset(seed) {
3918
+ const rand = mulberry32(seed ^ 2654435769);
3919
+ const angle = rand() * Math.PI * 2;
3920
+ const d = 2 + rand();
3921
+ return { x: Math.cos(angle) * d, y: Math.sin(angle) * d };
3922
+ }
3923
+ function makeField(seed, amplitude, closed) {
3924
+ const rand = mulberry32(seed);
3925
+ const int = (lo, span) => lo + Math.floor(rand() * span);
3926
+ const f1 = closed ? int(2, 2) : 1.5 + rand();
3927
+ const f22 = closed ? int(5, 3) : 3 + rand() * 2;
3928
+ const g = closed ? int(2, 2) : 1 + rand();
3929
+ const p1 = rand() * Math.PI * 2;
3930
+ const p2 = rand() * Math.PI * 2;
3931
+ const pg = rand() * Math.PI * 2;
3932
+ const a1 = amplitude * (0.55 + rand() * 0.15);
3933
+ const a2 = amplitude * 0.3;
3934
+ const TAU = Math.PI * 2;
3935
+ return {
3936
+ offset: (t) => a1 * Math.sin(TAU * f1 * t + p1) + a2 * Math.sin(TAU * f22 * t + p2),
3937
+ pressure: (t) => 1 + PRESSURE * Math.sin(TAU * g * t + pg)
3938
+ };
3939
+ }
3940
+ function resample(points, closed) {
3941
+ const src = closed ? [...points, points[0]] : [...points];
3942
+ const lengths = [];
3943
+ let total = 0;
3944
+ for (let i = 1; i < src.length; i++) {
3945
+ const l = Math.hypot(src[i].x - src[i - 1].x, src[i].y - src[i - 1].y);
3946
+ lengths.push(l);
3947
+ total += l;
3948
+ }
3949
+ if (total === 0) return { points: [src[0]], ts: [0] };
3950
+ const out = [];
3951
+ const ts = [];
3952
+ let walked = 0;
3953
+ for (let i = 1; i < src.length; i++) {
3954
+ const a = src[i - 1];
3955
+ const b = src[i];
3956
+ const l = lengths[i - 1];
3957
+ const n2 = Math.max(1, Math.round(l / SAMPLE_STEP));
3958
+ for (let k = 0; k < n2; k++) {
3959
+ const u = k / n2;
3960
+ out.push({ x: a.x + (b.x - a.x) * u, y: a.y + (b.y - a.y) * u });
3961
+ ts.push((walked + l * u) / total);
3962
+ }
3963
+ walked += l;
3964
+ }
3965
+ if (!closed) {
3966
+ out.push(src[src.length - 1]);
3967
+ ts.push(1);
3968
+ }
3969
+ return { points: out, ts };
3970
+ }
3971
+ function normalAt(points, i, closed) {
3972
+ const n2 = points.length;
3973
+ const prev = points[closed ? (i - 1 + n2) % n2 : Math.max(0, i - 1)];
3974
+ const next = points[closed ? (i + 1) % n2 : Math.min(n2 - 1, i + 1)];
3975
+ const tx = next.x - prev.x;
3976
+ const ty = next.y - prev.y;
3977
+ const len = Math.hypot(tx, ty) || 1;
3978
+ return { x: -ty / len, y: tx / len };
3979
+ }
3980
+ var f = (v) => Number.isInteger(v) ? String(v) : v.toFixed(2);
3981
+ var pathOf = (points) => points.map((p, i) => `${i === 0 ? "M" : "L"} ${f(p.x)} ${f(p.y)}`).join(" ");
3982
+ function inkStroke(points, options) {
3983
+ if (points.length < 2) return { ring: "", center: "" };
3984
+ const { closed, seed, width, amplitude } = options;
3985
+ const field = makeField(seed, amplitude, closed);
3986
+ const { points: pts, ts } = resample(points, closed);
3987
+ if (pts.length < 2) return { ring: "", center: "" };
3988
+ const center2 = [];
3989
+ const outer = [];
3990
+ const inner = [];
3991
+ for (let i = 0; i < pts.length; i++) {
3992
+ const t = ts[i];
3993
+ const nrm = normalAt(pts, i, closed);
3994
+ const off = field.offset(t);
3995
+ const c2 = { x: pts[i].x + nrm.x * off, y: pts[i].y + nrm.y * off };
3996
+ const taper = closed ? 1 : 0.55 + 0.45 * Math.min(1, t / 0.1, (1 - t) / 0.1);
3997
+ const half = width * field.pressure(t) * taper / 2;
3998
+ center2.push(c2);
3999
+ outer.push({ x: c2.x + nrm.x * half, y: c2.y + nrm.y * half });
4000
+ inner.push({ x: c2.x - nrm.x * half, y: c2.y - nrm.y * half });
4001
+ }
4002
+ if (closed) {
4003
+ return {
4004
+ ring: `${pathOf(outer)} Z ${pathOf([...inner].reverse())} Z`,
4005
+ center: `${pathOf(center2)} Z`
4006
+ };
4007
+ }
4008
+ return {
4009
+ ring: `${pathOf(outer)} ${pathOf([...inner].reverse()).replace(/^M/, "L")} Z`,
4010
+ center: pathOf(center2)
4011
+ };
4012
+ }
4013
+ function roundedRectPolygon(r, radius, segments = 4) {
4014
+ const rad = Math.min(radius, r.w / 2, r.h / 2);
4015
+ if (rad <= 0) {
4016
+ return [
4017
+ { x: r.x, y: r.y },
4018
+ { x: r.x + r.w, y: r.y },
4019
+ { x: r.x + r.w, y: r.y + r.h },
4020
+ { x: r.x, y: r.y + r.h }
4021
+ ];
4022
+ }
4023
+ const corners = [
4024
+ [r.x + r.w - rad, r.y + rad, -Math.PI / 2],
4025
+ [r.x + r.w - rad, r.y + r.h - rad, 0],
4026
+ [r.x + rad, r.y + r.h - rad, Math.PI / 2],
4027
+ [r.x + rad, r.y + rad, Math.PI]
4028
+ ];
4029
+ const out = [];
4030
+ for (const [cx, cy, start] of corners) {
4031
+ for (let i = 0; i <= segments; i++) {
4032
+ const a = start + Math.PI / 2 * (i / segments);
4033
+ out.push({ x: cx + rad * Math.cos(a), y: cy + rad * Math.sin(a) });
4034
+ }
4035
+ }
4036
+ return out;
4037
+ }
4038
+ function roundedPolyline(points, cornerRadius = 6, segments = 4) {
4039
+ if (points.length < 3) return [...points];
4040
+ const out = [points[0]];
4041
+ for (let i = 1; i < points.length - 1; i++) {
4042
+ const prev = points[i - 1];
4043
+ const p = points[i];
4044
+ const next = points[i + 1];
4045
+ const inLen = Math.hypot(p.x - prev.x, p.y - prev.y);
4046
+ const outLen = Math.hypot(next.x - p.x, next.y - p.y);
4047
+ const r = Math.min(cornerRadius, inLen / 2, outLen / 2);
4048
+ if (r < 0.5) {
4049
+ out.push(p);
4050
+ continue;
4051
+ }
4052
+ const a = { x: p.x - (p.x - prev.x) / inLen * r, y: p.y - (p.y - prev.y) / inLen * r };
4053
+ const b = { x: p.x + (next.x - p.x) / outLen * r, y: p.y + (next.y - p.y) / outLen * r };
4054
+ for (let k = 0; k <= segments; k++) {
4055
+ const u = k / segments;
4056
+ const v = 1 - u;
4057
+ out.push({
4058
+ x: v * v * a.x + 2 * v * u * p.x + u * u * b.x,
4059
+ y: v * v * a.y + 2 * v * u * p.y + u * u * b.y
4060
+ });
4061
+ }
4062
+ }
4063
+ out.push(points[points.length - 1]);
4064
+ return out;
4065
+ }
4066
+ function sampleCubic(p0, p1, p2, p3, segments = 10) {
4067
+ const out = [];
4068
+ for (let k = 1; k <= segments; k++) {
4069
+ const u = k / segments;
4070
+ const v = 1 - u;
4071
+ out.push({
4072
+ x: v * v * v * p0.x + 3 * v * v * u * p1.x + 3 * v * u * u * p2.x + u * u * u * p3.x,
4073
+ y: v * v * v * p0.y + 3 * v * v * u * p1.y + 3 * v * u * u * p2.y + u * u * u * p3.y
4074
+ });
4075
+ }
4076
+ return out;
4077
+ }
4078
+ function arcPolygon(cx, cy, rx, ry, from, to, segments = 12) {
4079
+ return Array.from({ length: segments + 1 }, (_, i) => {
4080
+ const a = from + (to - from) * i / segments;
4081
+ return { x: cx + rx * Math.cos(a), y: cy + ry * Math.sin(a) };
4082
+ });
4083
+ }
4084
+
4085
+ // src/drawing/shapes/inkRender.tsx
3877
4086
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
4087
+ var f2 = (v) => Number.isInteger(v) ? String(v) : v.toFixed(2);
4088
+ function extent(points) {
4089
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
4090
+ for (const p of points) {
4091
+ if (p.x < minX) minX = p.x;
4092
+ if (p.x > maxX) maxX = p.x;
4093
+ if (p.y < minY) minY = p.y;
4094
+ if (p.y > maxY) maxY = p.y;
4095
+ }
4096
+ return { w: maxX - minX, h: maxY - minY };
4097
+ }
4098
+ function InkBoxGeometry({ shape }) {
4099
+ const b = bbox(shape);
4100
+ const seed = seedFrom(shape.id);
4101
+ const width = shape.strokeWidth;
4102
+ const off = inkFillOffset(seed);
4103
+ const fillTransform = `translate(${f2(off.x)} ${f2(off.y)})`;
4104
+ const amplitudeOf = (points) => inkAmplitude(Math.min(extent(points).w, extent(points).h));
4105
+ const closed = (points, part, fill = shape.fill) => {
4106
+ const s = inkStroke(points, { closed: true, seed: seed + part, width, amplitude: amplitudeOf(points) });
4107
+ return /* @__PURE__ */ jsxs5("g", { children: [
4108
+ /* @__PURE__ */ jsx5("path", { d: s.center, fill, stroke: "none", transform: fillTransform }),
4109
+ /* @__PURE__ */ jsx5("path", { d: s.ring, fill: shape.stroke, fillRule: "evenodd", stroke: "none" })
4110
+ ] });
4111
+ };
4112
+ const open = (points, part, w = width) => /* @__PURE__ */ jsx5(
4113
+ "path",
4114
+ {
4115
+ d: inkStroke(points, { closed: false, seed: seed + part, width: w, amplitude: amplitudeOf(points) }).ring,
4116
+ fill: shape.stroke,
4117
+ stroke: "none"
4118
+ }
4119
+ );
4120
+ switch (shape.type) {
4121
+ case "rect":
4122
+ return closed(roundedRectPolygon(b, Math.min(8, b.w / 4, b.h / 4)), 0);
4123
+ case "ellipse":
4124
+ return closed(ellipsePolygon(b, 64), 0);
4125
+ case "diamond":
4126
+ return closed(
4127
+ [
4128
+ { x: b.x + b.w / 2, y: b.y },
4129
+ { x: b.x + b.w, y: b.y + b.h / 2 },
4130
+ { x: b.x + b.w / 2, y: b.y + b.h },
4131
+ { x: b.x, y: b.y + b.h / 2 }
4132
+ ],
4133
+ 0
4134
+ );
4135
+ case "note": {
4136
+ const fold = NOTE_FOLD(b);
4137
+ const r = b.x + b.w;
4138
+ const btm = b.y + b.h;
4139
+ const fillPts = [
4140
+ { x: b.x, y: b.y },
4141
+ { x: r, y: b.y },
4142
+ { x: r, y: btm - fold },
4143
+ { x: r - fold, y: btm },
4144
+ { x: b.x, y: btm }
4145
+ ];
4146
+ const foldPts = [
4147
+ { x: r - fold, y: btm },
4148
+ { x: r - fold, y: btm - fold },
4149
+ { x: r, y: btm - fold }
4150
+ ];
4151
+ return /* @__PURE__ */ jsxs5("g", { children: [
4152
+ closed(fillPts, 0),
4153
+ /* @__PURE__ */ jsx5(
4154
+ "path",
4155
+ {
4156
+ d: `M ${foldPts.map((p) => `${f2(p.x)} ${f2(p.y)}`).join(" L ")} Z`,
4157
+ fill: "rgba(0,0,0,0.08)",
4158
+ stroke: "none"
4159
+ }
4160
+ ),
4161
+ open(foldPts, 1)
4162
+ ] });
4163
+ }
4164
+ case "cylinder": {
4165
+ const ry = CYLINDER_RY(b);
4166
+ const rx = b.w / 2;
4167
+ const cx = b.x + rx;
4168
+ const body = [
4169
+ { x: b.x, y: b.y + ry },
4170
+ { x: b.x, y: b.y + b.h - ry },
4171
+ ...arcPolygon(cx, b.y + b.h - ry, rx, ry, Math.PI, 0, 16),
4172
+ { x: b.x + b.w, y: b.y + ry }
4173
+ ];
4174
+ const s = inkStroke(body, { closed: false, seed: seed + 0, width, amplitude: amplitudeOf(body) });
4175
+ return /* @__PURE__ */ jsxs5("g", { children: [
4176
+ /* @__PURE__ */ jsx5("path", { d: `${s.center} Z`, fill: shape.fill, stroke: "none", transform: fillTransform }),
4177
+ /* @__PURE__ */ jsx5("path", { d: s.ring, fill: shape.stroke, stroke: "none" }),
4178
+ closed(ellipsePolygon({ x: b.x, y: b.y, w: b.w, h: ry * 2 }, 48), 1)
4179
+ ] });
4180
+ }
4181
+ case "cloud": {
4182
+ const p = (u, v) => ({ x: b.x + u * b.w, y: b.y + v * b.h });
4183
+ const start = p(0.22, 0.86);
4184
+ const segs = [
4185
+ [p(0.04, 0.88), p(0, 0.58), p(0.16, 0.5)],
4186
+ [p(0.08, 0.26), p(0.3, 0.12), p(0.42, 0.28)],
4187
+ [p(0.5, 0.02), p(0.76, 0.04), p(0.78, 0.3)],
4188
+ [p(0.98, 0.26), p(1.04, 0.56), p(0.88, 0.64)],
4189
+ [p(1, 0.8), p(0.9, 0.9), p(0.76, 0.86)]
4190
+ ];
4191
+ const pts = [start];
4192
+ let from = start;
4193
+ for (const [c1, c2, to] of segs) {
4194
+ pts.push(...sampleCubic(from, c1, c2, to, 8));
4195
+ from = to;
4196
+ }
4197
+ return closed(pts, 0);
4198
+ }
4199
+ case "queue": {
4200
+ const rx = QUEUE_RX(b);
4201
+ const ry = b.h / 2;
4202
+ const body = [
4203
+ { x: b.x + rx, y: b.y },
4204
+ { x: b.x + b.w - rx, y: b.y },
4205
+ { x: b.x + b.w - rx, y: b.y + b.h },
4206
+ { x: b.x + rx, y: b.y + b.h },
4207
+ ...arcPolygon(b.x + rx, b.y + ry, rx, ry, Math.PI / 2, 3 * Math.PI / 2, 16).slice(1, -1)
4208
+ ];
4209
+ return /* @__PURE__ */ jsxs5("g", { children: [
4210
+ closed(body, 0),
4211
+ closed(ellipsePolygon({ x: b.x + b.w - rx * 2, y: b.y, w: rx * 2, h: b.h }, 48), 1)
4212
+ ] });
4213
+ }
4214
+ case "actor": {
4215
+ const figH = b.h * ACTOR_FIGURE_RATIO;
4216
+ const cx = b.x + b.w / 2;
4217
+ const r = Math.max(4, Math.min(figH * 0.16, b.w * 0.2));
4218
+ const neck = b.y + r * 2;
4219
+ const hip = b.y + figH * 0.62;
4220
+ const armY = neck + figH * 0.12;
4221
+ const reach = Math.min(b.w * 0.32, figH * 0.3);
4222
+ return /* @__PURE__ */ jsxs5("g", { children: [
4223
+ closed(ellipsePolygon({ x: cx - r, y: b.y, w: r * 2, h: r * 2 }, 32), 0),
4224
+ open([{ x: cx, y: neck }, { x: cx, y: hip }], 1),
4225
+ open([{ x: cx - reach, y: armY }, { x: cx + reach, y: armY }], 2),
4226
+ open(
4227
+ [
4228
+ { x: cx - reach, y: b.y + figH },
4229
+ { x: cx, y: hip },
4230
+ { x: cx + reach, y: b.y + figH }
4231
+ ],
4232
+ 3
4233
+ )
4234
+ ] });
4235
+ }
4236
+ default:
4237
+ return null;
4238
+ }
4239
+ }
4240
+ function InkConnector({
4241
+ shape,
4242
+ points
4243
+ }) {
4244
+ if (points.length < 2) return null;
4245
+ const seed = seedFrom(shape.id);
4246
+ const length = pathLength(points);
4247
+ const amplitude = Math.min(3, Math.max(0.8, length * 0.015));
4248
+ const width = shape.strokeWidth;
4249
+ const line = inkStroke(roundedPolyline(points), { closed: false, seed, width, amplitude });
4250
+ const heads = [];
4251
+ if (shape.type === "arrow" && length >= 1) {
4252
+ const headLength = Math.min(14, 4 + length / 4);
4253
+ const last = points.length - 1;
4254
+ heads.push(arrowHeadPoints(points[last], segmentAngleAt(points, last, false), headLength));
4255
+ if (shape.bidirectional) {
4256
+ heads.push(arrowHeadPoints(points[0], segmentAngleAt(points, 0, true), headLength));
4257
+ }
4258
+ }
4259
+ return /* @__PURE__ */ jsxs5("g", { fill: shape.stroke, stroke: "none", children: [
4260
+ /* @__PURE__ */ jsx5("path", { d: line.ring }),
4261
+ heads.map((pts, i) => /* @__PURE__ */ jsx5(
4262
+ "path",
4263
+ {
4264
+ d: inkStroke(pts, { closed: false, seed: seed + 1 + i, width: width * 1.15, amplitude: 0.8 }).ring
4265
+ },
4266
+ i
4267
+ ))
4268
+ ] });
4269
+ }
4270
+
4271
+ // src/drawing/canvas/ShapeView.tsx
4272
+ import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3878
4273
  import { createElement } from "react";
3879
4274
  var CONNECTOR_FONT_SIZE = 12;
3880
4275
  var CONNECTOR_LABEL_MAX_WIDTH = 160;
@@ -3925,7 +4320,7 @@ function BoxTexts({
3925
4320
  fill: textColorFor(shape),
3926
4321
  textAnchor: "middle"
3927
4322
  };
3928
- return /* @__PURE__ */ jsxs5("g", { children: [
4323
+ return /* @__PURE__ */ jsxs6("g", { children: [
3929
4324
  slots.includes("label") && hideField !== "label" && (shape.label ? labelLines.map((line, i) => /* @__PURE__ */ createElement(
3930
4325
  "text",
3931
4326
  {
@@ -3940,7 +4335,7 @@ function BoxTexts({
3940
4335
  style: textStyle
3941
4336
  },
3942
4337
  line
3943
- )) : hints && /* @__PURE__ */ jsx5(
4338
+ )) : hints && /* @__PURE__ */ jsx6(
3944
4339
  "text",
3945
4340
  {
3946
4341
  ...common,
@@ -3963,7 +4358,7 @@ function BoxTexts({
3963
4358
  style: textStyle
3964
4359
  },
3965
4360
  line
3966
- )) : hints && /* @__PURE__ */ jsx5(
4361
+ )) : hints && /* @__PURE__ */ jsx6(
3967
4362
  "text",
3968
4363
  {
3969
4364
  ...common,
@@ -3987,7 +4382,7 @@ function BoxTexts({
3987
4382
  style: textStyle
3988
4383
  },
3989
4384
  line
3990
- )) : hints && /* @__PURE__ */ jsx5(
4385
+ )) : hints && /* @__PURE__ */ jsx6(
3991
4386
  "text",
3992
4387
  {
3993
4388
  ...common,
@@ -4011,8 +4406,8 @@ function ConnectorLabel({
4011
4406
  const { x: midX, y: midY } = connectorMidpoint(points);
4012
4407
  const lineH = CONNECTOR_FONT_SIZE * LINE_HEIGHT;
4013
4408
  const startY = midY - (lines.length - 1) * lineH / 2 + CONNECTOR_FONT_SIZE * 0.35;
4014
- return /* @__PURE__ */ jsxs5("g", { children: [
4015
- /* @__PURE__ */ jsx5(
4409
+ return /* @__PURE__ */ jsxs6("g", { children: [
4410
+ /* @__PURE__ */ jsx6(
4016
4411
  "rect",
4017
4412
  {
4018
4413
  x: midX - size.w / 2 - 5,
@@ -4024,7 +4419,7 @@ function ConnectorLabel({
4024
4419
  opacity: 0.94
4025
4420
  }
4026
4421
  ),
4027
- lines.map((line, i) => /* @__PURE__ */ jsx5(
4422
+ lines.map((line, i) => /* @__PURE__ */ jsx6(
4028
4423
  "text",
4029
4424
  {
4030
4425
  x: midX,
@@ -4043,7 +4438,8 @@ function ShapeView({
4043
4438
  shape,
4044
4439
  points,
4045
4440
  hideField,
4046
- showHints
4441
+ showHints,
4442
+ ink = false
4047
4443
  }) {
4048
4444
  const stroke = {
4049
4445
  stroke: shape.stroke,
@@ -4052,9 +4448,9 @@ function ShapeView({
4052
4448
  strokeLinejoin: "round"
4053
4449
  };
4054
4450
  if (isBoxType(shape.type)) {
4055
- return /* @__PURE__ */ jsxs5("g", { children: [
4056
- /* @__PURE__ */ jsx5(BoxGeometry, { shape, stroke }),
4057
- /* @__PURE__ */ jsx5(BoxTexts, { shape, hideField, showHints })
4451
+ return /* @__PURE__ */ jsxs6("g", { children: [
4452
+ ink ? /* @__PURE__ */ jsx6(InkBoxGeometry, { shape }) : /* @__PURE__ */ jsx6(BoxGeometry, { shape, stroke }),
4453
+ /* @__PURE__ */ jsx6(BoxTexts, { shape, hideField, showHints })
4058
4454
  ] });
4059
4455
  }
4060
4456
  if (isConnectorType(shape.type)) {
@@ -4062,13 +4458,15 @@ function ShapeView({
4062
4458
  { x: shape.x, y: shape.y },
4063
4459
  { x: shape.x + shape.w, y: shape.y + shape.h }
4064
4460
  ];
4065
- return /* @__PURE__ */ jsxs5("g", { children: [
4066
- /* @__PURE__ */ jsx5("path", { ...stroke, d: polylinePath(pts), fill: "none" }),
4067
- arrowHeads(shape, pts).map((d, i) => /* @__PURE__ */ jsx5("path", { ...stroke, d, fill: "none" }, i)),
4068
- shape.text && hideField !== "text" && /* @__PURE__ */ jsx5(ConnectorLabel, { shape, points: pts })
4461
+ return /* @__PURE__ */ jsxs6("g", { children: [
4462
+ ink ? /* @__PURE__ */ jsx6(InkConnector, { shape, points: pts }) : /* @__PURE__ */ jsxs6(Fragment, { children: [
4463
+ /* @__PURE__ */ jsx6("path", { ...stroke, d: polylinePath(pts), fill: "none" }),
4464
+ arrowHeads(shape, pts).map((d, i) => /* @__PURE__ */ jsx6("path", { ...stroke, d, fill: "none" }, i))
4465
+ ] }),
4466
+ shape.text && hideField !== "text" && /* @__PURE__ */ jsx6(ConnectorLabel, { shape, points: pts })
4069
4467
  ] });
4070
4468
  }
4071
- return /* @__PURE__ */ jsx5(
4469
+ return /* @__PURE__ */ jsx6(
4072
4470
  "text",
4073
4471
  {
4074
4472
  x: shape.x,
@@ -4076,7 +4474,7 @@ function ShapeView({
4076
4474
  fill: shape.stroke,
4077
4475
  fontSize: FONT_SIZE,
4078
4476
  style: { userSelect: "none", whiteSpace: "pre" },
4079
- children: (shape.text ?? "").split("\n").map((line, i) => /* @__PURE__ */ jsx5("tspan", { x: shape.x, dy: i === 0 ? 0 : FONT_SIZE * LINE_HEIGHT, children: line }, i))
4477
+ children: (shape.text ?? "").split("\n").map((line, i) => /* @__PURE__ */ jsx6("tspan", { x: shape.x, dy: i === 0 ? 0 : FONT_SIZE * LINE_HEIGHT, children: line }, i))
4080
4478
  }
4081
4479
  );
4082
4480
  }
@@ -4085,10 +4483,10 @@ function HitArea({
4085
4483
  points
4086
4484
  }) {
4087
4485
  if (isConnectorType(shape.type) && points) {
4088
- return /* @__PURE__ */ jsx5("path", { d: polylinePath(points), fill: "none", stroke: "transparent", strokeWidth: 16 });
4486
+ return /* @__PURE__ */ jsx6("path", { d: polylinePath(points), fill: "none", stroke: "transparent", strokeWidth: 16 });
4089
4487
  }
4090
4488
  const b = bbox(shape);
4091
- return /* @__PURE__ */ jsx5(
4489
+ return /* @__PURE__ */ jsx6(
4092
4490
  "rect",
4093
4491
  {
4094
4492
  x: b.x - 2,
@@ -4107,7 +4505,7 @@ import {
4107
4505
  useRef as useRef2,
4108
4506
  useState
4109
4507
  } from "react";
4110
- import { jsx as jsx6 } from "react/jsx-runtime";
4508
+ import { jsx as jsx7 } from "react/jsx-runtime";
4111
4509
  function TextEditOverlay({
4112
4510
  shape,
4113
4511
  field,
@@ -4210,7 +4608,7 @@ function TextEditOverlay({
4210
4608
  });
4211
4609
  }
4212
4610
  const placeholder = field === "label" ? "Label" : field === "footer" ? "Footer" : "Text";
4213
- return /* @__PURE__ */ jsx6(
4611
+ return /* @__PURE__ */ jsx7(
4214
4612
  "textarea",
4215
4613
  {
4216
4614
  ref,
@@ -4230,16 +4628,16 @@ function TextEditOverlay({
4230
4628
  import { useEffect as useEffect6, useRef as useRef3, useState as useState2 } from "react";
4231
4629
 
4232
4630
  // src/components/blockWidthOptions.tsx
4233
- import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
4631
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
4234
4632
  var LAYOUT_OPTIONS = [
4235
4633
  {
4236
4634
  preset: "compact",
4237
4635
  label: "Compact (shrink to content, tight rows)",
4238
4636
  width: "content",
4239
4637
  density: "compact",
4240
- icon: /* @__PURE__ */ jsxs6(Fragment, { children: [
4241
- /* @__PURE__ */ jsx7("path", { d: "M3 4v12M17 4v12" }),
4242
- /* @__PURE__ */ jsx7("path", { d: "M5.5 10h3M11.5 10h3M6.5 7.5L9 10l-2.5 2.5M13.5 7.5L11 10l2.5 2.5" })
4638
+ icon: /* @__PURE__ */ jsxs7(Fragment2, { children: [
4639
+ /* @__PURE__ */ jsx8("path", { d: "M3 4v12M17 4v12" }),
4640
+ /* @__PURE__ */ jsx8("path", { d: "M5.5 10h3M11.5 10h3M6.5 7.5L9 10l-2.5 2.5M13.5 7.5L11 10l2.5 2.5" })
4243
4641
  ] })
4244
4642
  },
4245
4643
  {
@@ -4247,9 +4645,9 @@ var LAYOUT_OPTIONS = [
4247
4645
  label: "Comfortable (text width)",
4248
4646
  width: "text",
4249
4647
  density: "comfortable",
4250
- icon: /* @__PURE__ */ jsxs6(Fragment, { children: [
4251
- /* @__PURE__ */ jsx7("path", { d: "M3 4v12M17 4v12" }),
4252
- /* @__PURE__ */ jsx7("path", { d: "M6.5 7h7M6.5 10h7M6.5 13h4.5" })
4648
+ icon: /* @__PURE__ */ jsxs7(Fragment2, { children: [
4649
+ /* @__PURE__ */ jsx8("path", { d: "M3 4v12M17 4v12" }),
4650
+ /* @__PURE__ */ jsx8("path", { d: "M6.5 7h7M6.5 10h7M6.5 13h4.5" })
4253
4651
  ] })
4254
4652
  },
4255
4653
  {
@@ -4257,9 +4655,9 @@ var LAYOUT_OPTIONS = [
4257
4655
  label: "Full width",
4258
4656
  width: "full",
4259
4657
  density: "comfortable",
4260
- icon: /* @__PURE__ */ jsxs6(Fragment, { children: [
4261
- /* @__PURE__ */ jsx7("path", { d: "M3 4v12M17 4v12" }),
4262
- /* @__PURE__ */ jsx7("path", { d: "M6 10h8M8.5 7.5L6 10l2.5 2.5M11.5 7.5L14 10l-2.5 2.5" })
4658
+ icon: /* @__PURE__ */ jsxs7(Fragment2, { children: [
4659
+ /* @__PURE__ */ jsx8("path", { d: "M3 4v12M17 4v12" }),
4660
+ /* @__PURE__ */ jsx8("path", { d: "M6 10h8M8.5 7.5L6 10l2.5 2.5M11.5 7.5L14 10l-2.5 2.5" })
4263
4661
  ] })
4264
4662
  }
4265
4663
  ];
@@ -4268,7 +4666,7 @@ function layoutPreset(width) {
4268
4666
  }
4269
4667
 
4270
4668
  // src/drawing/canvas/Toolbar.tsx
4271
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
4669
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
4272
4670
  var PRIMARY_TOOLS = [
4273
4671
  { tool: "select", label: "Select" },
4274
4672
  { tool: "rect", label: "Rectangle" },
@@ -4287,7 +4685,7 @@ function ToolButton({
4287
4685
  className,
4288
4686
  pressed
4289
4687
  }) {
4290
- return /* @__PURE__ */ jsx8(
4688
+ return /* @__PURE__ */ jsx9(
4291
4689
  "button",
4292
4690
  {
4293
4691
  type: "button",
@@ -4296,7 +4694,7 @@ function ToolButton({
4296
4694
  "aria-pressed": pressed ?? active,
4297
4695
  className: `zui-drawing-tool ${active ? "is-active" : ""} ${className ?? ""}`,
4298
4696
  onClick,
4299
- children: /* @__PURE__ */ jsx8(Icon, { children })
4697
+ children: /* @__PURE__ */ jsx9(Icon, { children })
4300
4698
  }
4301
4699
  );
4302
4700
  }
@@ -4329,11 +4727,11 @@ function DrawingToolbar({
4329
4727
  }, [moreOpen]);
4330
4728
  const moreActive = MORE_SHAPES.includes(tool);
4331
4729
  const moreIcon = moreActive ? SHAPE_ICONS[tool] : SHAPE_ICONS[lastMore];
4332
- return /* @__PURE__ */ jsxs7(Fragment2, { children: [
4333
- /* @__PURE__ */ jsxs7("div", { className: "zui-drawing-toolbar-group", role: "toolbar", "aria-label": "Drawing tools", children: [
4334
- PRIMARY_TOOLS.map(({ tool: t, label }) => /* @__PURE__ */ jsx8(ToolButton, { label, active: tool === t, onClick: () => onToolChange(t), children: SHAPE_ICONS[t] }, t)),
4335
- /* @__PURE__ */ jsxs7("div", { className: "zui-drawing-more", ref: moreRef, children: [
4336
- /* @__PURE__ */ jsxs7(
4730
+ return /* @__PURE__ */ jsxs8(Fragment3, { children: [
4731
+ /* @__PURE__ */ jsxs8("div", { className: "zui-drawing-toolbar-group", role: "toolbar", "aria-label": "Drawing tools", children: [
4732
+ PRIMARY_TOOLS.map(({ tool: t, label }) => /* @__PURE__ */ jsx9(ToolButton, { label, active: tool === t, onClick: () => onToolChange(t), children: SHAPE_ICONS[t] }, t)),
4733
+ /* @__PURE__ */ jsxs8("div", { className: "zui-drawing-more", ref: moreRef, children: [
4734
+ /* @__PURE__ */ jsxs8(
4337
4735
  "button",
4338
4736
  {
4339
4737
  type: "button",
@@ -4344,12 +4742,12 @@ function DrawingToolbar({
4344
4742
  className: `zui-drawing-tool zui-drawing-tool-more ${moreActive ? "is-active" : ""}`,
4345
4743
  onClick: () => setMoreOpen((open) => !open),
4346
4744
  children: [
4347
- /* @__PURE__ */ jsx8(Icon, { children: moreIcon }),
4348
- /* @__PURE__ */ jsx8("span", { className: "zui-drawing-caret", "aria-hidden": "true" })
4745
+ /* @__PURE__ */ jsx9(Icon, { children: moreIcon }),
4746
+ /* @__PURE__ */ jsx9("span", { className: "zui-drawing-caret", "aria-hidden": "true" })
4349
4747
  ]
4350
4748
  }
4351
4749
  ),
4352
- moreOpen && /* @__PURE__ */ jsx8("div", { className: "zui-drawing-popover", role: "menu", children: MORE_SHAPES.map((type) => /* @__PURE__ */ jsxs7(
4750
+ moreOpen && /* @__PURE__ */ jsx9("div", { className: "zui-drawing-popover", role: "menu", children: MORE_SHAPES.map((type) => /* @__PURE__ */ jsxs8(
4353
4751
  "button",
4354
4752
  {
4355
4753
  type: "button",
@@ -4362,8 +4760,8 @@ function DrawingToolbar({
4362
4760
  setMoreOpen(false);
4363
4761
  },
4364
4762
  children: [
4365
- /* @__PURE__ */ jsx8(Icon, { size: 18, children: SHAPE_ICONS[type] }),
4366
- /* @__PURE__ */ jsx8("span", { children: BOX_DEFINITIONS[type].label })
4763
+ /* @__PURE__ */ jsx9(Icon, { size: 18, children: SHAPE_ICONS[type] }),
4764
+ /* @__PURE__ */ jsx9("span", { children: BOX_DEFINITIONS[type].label })
4367
4765
  ]
4368
4766
  },
4369
4767
  type
@@ -4371,8 +4769,8 @@ function DrawingToolbar({
4371
4769
  ] })
4372
4770
  ] }),
4373
4771
  properties,
4374
- /* @__PURE__ */ jsxs7("div", { className: "zui-drawing-toolbar-group zui-drawing-toolbar-group-end", children: [
4375
- /* @__PURE__ */ jsx8(
4772
+ /* @__PURE__ */ jsxs8("div", { className: "zui-drawing-toolbar-group zui-drawing-toolbar-group-end", children: [
4773
+ /* @__PURE__ */ jsx9(
4376
4774
  ToolButton,
4377
4775
  {
4378
4776
  label: copied ? "Copied Mermaid to clipboard" : "Copy as Mermaid",
@@ -4387,8 +4785,8 @@ function DrawingToolbar({
4387
4785
  children: copied ? UI_ICONS.check : UI_ICONS.mermaid
4388
4786
  }
4389
4787
  ),
4390
- /* @__PURE__ */ jsx8("span", { className: "zui-drawing-toolbar-divider" }),
4391
- LAYOUT_OPTIONS.map(({ preset, label, icon, width: presetWidth }) => /* @__PURE__ */ jsx8(
4788
+ /* @__PURE__ */ jsx9("span", { className: "zui-drawing-toolbar-divider" }),
4789
+ LAYOUT_OPTIONS.map(({ preset, label, icon, width: presetWidth }) => /* @__PURE__ */ jsx9(
4392
4790
  ToolButton,
4393
4791
  {
4394
4792
  label,
@@ -4403,7 +4801,7 @@ function DrawingToolbar({
4403
4801
  }
4404
4802
 
4405
4803
  // src/drawing/canvas/DrawingCanvas.tsx
4406
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
4804
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
4407
4805
  var MIN_HEIGHT = 120;
4408
4806
  var MAX_HEIGHT = 1200;
4409
4807
  var WIDTH_CLASS = {
@@ -4439,6 +4837,7 @@ function DrawingCanvas({ nodeKey, data }) {
4439
4837
  const [shapes, setShapes] = useState3(data.shapes);
4440
4838
  const [canvasHeight, setCanvasHeight] = useState3(data.canvasHeight);
4441
4839
  const [width, setWidth] = useState3(data.width ?? "full");
4840
+ const ink = useContext2(EditorContext)?.drawingStyle === "ink";
4442
4841
  const [tool, setTool] = useState3("select");
4443
4842
  const [selectedIds, setSelectedIds] = useState3(EMPTY_SET);
4444
4843
  const [editingText, setEditingText] = useState3(null);
@@ -4899,11 +5298,11 @@ function DrawingCanvas({ nodeKey, data }) {
4899
5298
  const propStroke = single?.stroke ?? selection[0]?.stroke ?? stroke;
4900
5299
  const propFill = single?.fill ?? selection[0]?.fill ?? fill;
4901
5300
  const canvasCursor = tool === "select" ? "default" : tool === "text" ? "text" : "crosshair";
4902
- return /* @__PURE__ */ jsxs8(
5301
+ return /* @__PURE__ */ jsxs9(
4903
5302
  "div",
4904
5303
  {
4905
5304
  ref: rootRef,
4906
- className: `zui-drawing-canvas ${WIDTH_CLASS[width]} ${isEditable ? "is-editable" : ""}`,
5305
+ className: `zui-drawing-canvas ${WIDTH_CLASS[width]} ${isEditable ? "is-editable" : ""} ${ink ? "is-ink" : ""}`,
4907
5306
  tabIndex: isEditable ? 0 : void 0,
4908
5307
  onFocus: () => editor.dispatchCommand(DRAWING_FOCUS_COMMAND, nodeKey),
4909
5308
  onBlur: (e) => {
@@ -4911,7 +5310,7 @@ function DrawingCanvas({ nodeKey, data }) {
4911
5310
  editor.dispatchCommand(DRAWING_FOCUS_COMMAND, null);
4912
5311
  },
4913
5312
  children: [
4914
- isEditable && /* @__PURE__ */ jsx9("div", { className: "zui-drawing-toolbar", onPointerDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx9(
5313
+ isEditable && /* @__PURE__ */ jsx10("div", { className: "zui-drawing-toolbar", onPointerDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx10(
4915
5314
  DrawingToolbar,
4916
5315
  {
4917
5316
  tool,
@@ -4925,7 +5324,7 @@ function DrawingCanvas({ nodeKey, data }) {
4925
5324
  properties: (
4926
5325
  // Inline in the same row (so the stage never shifts); shown
4927
5326
  // only while the canvas has focus (see .zui-drawing-props-host)
4928
- /* @__PURE__ */ jsx9("div", { className: "zui-drawing-props-host", children: /* @__PURE__ */ jsx9(
5327
+ /* @__PURE__ */ jsx10("div", { className: "zui-drawing-props-host", children: /* @__PURE__ */ jsx10(
4929
5328
  PropertyBar,
4930
5329
  {
4931
5330
  selection,
@@ -4940,8 +5339,8 @@ function DrawingCanvas({ nodeKey, data }) {
4940
5339
  )
4941
5340
  }
4942
5341
  ) }),
4943
- /* @__PURE__ */ jsxs8("div", { className: "zui-drawing-stage", children: [
4944
- /* @__PURE__ */ jsxs8(
5342
+ /* @__PURE__ */ jsxs9("div", { className: "zui-drawing-stage", children: [
5343
+ /* @__PURE__ */ jsxs9(
4945
5344
  "svg",
4946
5345
  {
4947
5346
  ref: svgRef,
@@ -4972,7 +5371,7 @@ function DrawingCanvas({ nodeKey, data }) {
4972
5371
  }
4973
5372
  },
4974
5373
  children: [
4975
- shapes.map((shape) => /* @__PURE__ */ jsxs8(
5374
+ shapes.map((shape) => /* @__PURE__ */ jsxs9(
4976
5375
  "g",
4977
5376
  {
4978
5377
  "data-shape-id": shape.id,
@@ -4980,11 +5379,12 @@ function DrawingCanvas({ nodeKey, data }) {
4980
5379
  style: { cursor: isEditable && tool === "select" ? "move" : void 0 },
4981
5380
  onPointerDown: (e) => handleShapePointerDown(e, shape),
4982
5381
  children: [
4983
- /* @__PURE__ */ jsx9(HitArea, { shape, points: paths.get(shape.id) }),
4984
- shape.id === editingText?.id && shape.type === "text" ? null : /* @__PURE__ */ jsx9(
5382
+ /* @__PURE__ */ jsx10(HitArea, { shape, points: paths.get(shape.id) }),
5383
+ shape.id === editingText?.id && shape.type === "text" ? null : /* @__PURE__ */ jsx10(
4985
5384
  ShapeView,
4986
5385
  {
4987
5386
  shape,
5387
+ ink,
4988
5388
  points: paths.get(shape.id),
4989
5389
  hideField: shape.id === editingText?.id ? editingText.field : null,
4990
5390
  showHints: isEditable && tool === "select" && single?.id === shape.id && shape.id !== editingText?.id
@@ -4994,7 +5394,7 @@ function DrawingCanvas({ nodeKey, data }) {
4994
5394
  },
4995
5395
  shape.id
4996
5396
  )),
4997
- hoverBox && /* @__PURE__ */ jsx9(
5397
+ hoverBox && /* @__PURE__ */ jsx10(
4998
5398
  "polygon",
4999
5399
  {
5000
5400
  className: "zui-drawing-selection zui-drawing-bind-target",
@@ -5007,7 +5407,7 @@ function DrawingCanvas({ nodeKey, data }) {
5007
5407
  pointerEvents: "none"
5008
5408
  }
5009
5409
  ),
5010
- single && isEditable && !editingText && /* @__PURE__ */ jsx9(
5410
+ single && isEditable && !editingText && /* @__PURE__ */ jsx10(
5011
5411
  SelectionOverlay,
5012
5412
  {
5013
5413
  shape: single,
@@ -5017,13 +5417,13 @@ function DrawingCanvas({ nodeKey, data }) {
5017
5417
  onWaypointRemove: removeWaypoint
5018
5418
  }
5019
5419
  ),
5020
- selection.length > 1 && isEditable && /* @__PURE__ */ jsx9(GroupSelectionOverlay, { shapes: selection, paths }),
5021
- marquee && /* @__PURE__ */ jsx9(MarqueeOverlay, { rect: marqueeRect(marquee.origin, marquee.current) })
5420
+ selection.length > 1 && isEditable && /* @__PURE__ */ jsx10(GroupSelectionOverlay, { shapes: selection, paths }),
5421
+ marquee && /* @__PURE__ */ jsx10(MarqueeOverlay, { rect: marqueeRect(marquee.origin, marquee.current) })
5022
5422
  ]
5023
5423
  }
5024
5424
  ),
5025
- isEditable && shapes.length === 0 && /* @__PURE__ */ jsx9("div", { className: "zui-drawing-empty", "aria-hidden": "true", children: "Pick a shape above, then click or drag on the canvas" }),
5026
- editingShape && editingText && /* @__PURE__ */ jsx9(
5425
+ isEditable && shapes.length === 0 && /* @__PURE__ */ jsx10("div", { className: "zui-drawing-empty", "aria-hidden": "true", children: "Pick a shape above, then click or drag on the canvas" }),
5426
+ editingShape && editingText && /* @__PURE__ */ jsx10(
5027
5427
  "div",
5028
5428
  {
5029
5429
  className: "zui-drawing-overlay",
@@ -5032,7 +5432,7 @@ function DrawingCanvas({ nodeKey, data }) {
5032
5432
  width: logicalWidth ?? void 0,
5033
5433
  height: logicalWidth ? canvasHeight : void 0
5034
5434
  },
5035
- children: /* @__PURE__ */ jsx9(
5435
+ children: /* @__PURE__ */ jsx10(
5036
5436
  TextEditOverlay,
5037
5437
  {
5038
5438
  shape: editingShape,
@@ -5044,7 +5444,7 @@ function DrawingCanvas({ nodeKey, data }) {
5044
5444
  )
5045
5445
  }
5046
5446
  ),
5047
- isEditable && /* @__PURE__ */ jsx9(
5447
+ isEditable && /* @__PURE__ */ jsx10(
5048
5448
  HeightHandle,
5049
5449
  {
5050
5450
  height: canvasHeight,
@@ -5068,7 +5468,7 @@ function HeightHandle({
5068
5468
  const latestRef = useRef4(height);
5069
5469
  latestRef.current = height;
5070
5470
  const clamp = (h) => Math.round(Math.min(MAX_HEIGHT, Math.max(MIN_HEIGHT, h)));
5071
- return /* @__PURE__ */ jsx9(
5471
+ return /* @__PURE__ */ jsx10(
5072
5472
  "div",
5073
5473
  {
5074
5474
  className: "zui-drawing-resize",
@@ -5091,13 +5491,13 @@ function HeightHandle({
5091
5491
  dragRef.current = null;
5092
5492
  onCommit(latestRef.current);
5093
5493
  },
5094
- children: /* @__PURE__ */ jsx9(Icon, { size: 14, children: UI_ICONS.grip })
5494
+ children: /* @__PURE__ */ jsx10(Icon, { size: 14, children: UI_ICONS.grip })
5095
5495
  }
5096
5496
  );
5097
5497
  }
5098
5498
 
5099
5499
  // src/nodes/DrawingNode.tsx
5100
- import { jsx as jsx10 } from "react/jsx-runtime";
5500
+ import { jsx as jsx11 } from "react/jsx-runtime";
5101
5501
  var DrawingNode = class _DrawingNode extends DecoratorNode {
5102
5502
  static getType() {
5103
5503
  return "drawing";
@@ -5161,7 +5561,7 @@ var DrawingNode = class _DrawingNode extends DecoratorNode {
5161
5561
  return false;
5162
5562
  }
5163
5563
  decorate(_editor, _config) {
5164
- return /* @__PURE__ */ jsx10(DrawingCanvas, { nodeKey: this.getKey(), data: this.getData() });
5564
+ return /* @__PURE__ */ jsx11(DrawingCanvas, { nodeKey: this.getKey(), data: this.getData() });
5165
5565
  }
5166
5566
  };
5167
5567
  function $createDrawingNode(data = serializeDrawingData(EMPTY_DRAWING)) {
@@ -5538,21 +5938,8 @@ var editorTheme = {
5538
5938
  drawing: "zui-drawing"
5539
5939
  };
5540
5940
 
5541
- // src/editorContext.ts
5542
- import { createContext, useContext } from "react";
5543
- var EditorContext = createContext(null);
5544
- function useEditorContext() {
5545
- const ctx = useContext(EditorContext);
5546
- if (!ctx) {
5547
- throw new Error(
5548
- "@zuilib/text-editor: this component must be rendered inside <MarkdownEditor> or <MarkdownEditor.Root>"
5549
- );
5550
- }
5551
- return ctx;
5552
- }
5553
-
5554
5941
  // src/EditorRoot.tsx
5555
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
5942
+ import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
5556
5943
  var SYNC_TRANSFORMERS = [
5557
5944
  FRONTMATTER,
5558
5945
  DRAWING,
@@ -5598,6 +5985,7 @@ function EditorRoot({
5598
5985
  autoFocus = false,
5599
5986
  measure,
5600
5987
  defaultBlockWidth = NO_DEFAULT_BLOCK_WIDTH,
5988
+ drawingStyle = "clean",
5601
5989
  children
5602
5990
  }) {
5603
5991
  const latestValueRef = useRef5(value ?? "");
@@ -5639,19 +6027,20 @@ function EditorRoot({
5639
6027
  autoFocus,
5640
6028
  rawValue: value ?? "",
5641
6029
  onRawChange: handleChange,
5642
- defaultBlockWidth
6030
+ defaultBlockWidth,
6031
+ drawingStyle
5643
6032
  }),
5644
- [mode, readOnly, autoFocus, value, handleChange, defaultBlockWidth]
6033
+ [mode, readOnly, autoFocus, value, handleChange, defaultBlockWidth, drawingStyle]
5645
6034
  );
5646
6035
  const isRaw = mode === "edit-raw";
5647
6036
  const rootStyle = useMemo2(
5648
6037
  () => measure !== void 0 ? { "--zui-text-editor-measure": measure } : void 0,
5649
6038
  [measure]
5650
6039
  );
5651
- return /* @__PURE__ */ jsx11(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx11(EditorContext.Provider, { value: context, children: /* @__PURE__ */ jsxs9("div", { className: `zui-text-editor ${className ?? ""}`, style: rootStyle, children: [
6040
+ return /* @__PURE__ */ jsx12(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx12(EditorContext.Provider, { value: context, children: /* @__PURE__ */ jsxs10("div", { className: `zui-text-editor ${className ?? ""}`, style: rootStyle, children: [
5652
6041
  children,
5653
- !isRaw && /* @__PURE__ */ jsxs9(Fragment3, { children: [
5654
- /* @__PURE__ */ jsx11(
6042
+ !isRaw && /* @__PURE__ */ jsxs10(Fragment4, { children: [
6043
+ /* @__PURE__ */ jsx12(
5655
6044
  MarkdownSyncPlugin,
5656
6045
  {
5657
6046
  initialMarkdown: mode === "view" ? value ?? "" : capturedMarkdown,
@@ -5659,17 +6048,17 @@ function EditorRoot({
5659
6048
  transformers: SYNC_TRANSFORMERS
5660
6049
  }
5661
6050
  ),
5662
- /* @__PURE__ */ jsx11(HistoryPlugin, {}),
5663
- /* @__PURE__ */ jsx11(ListPlugin, {}),
5664
- /* @__PURE__ */ jsx11(CheckListPlugin, {}),
5665
- /* @__PURE__ */ jsx11(ChecklistShortcutPlugin, {}),
5666
- /* @__PURE__ */ jsx11(CodeBlockShortcutPlugin, {}),
5667
- /* @__PURE__ */ jsx11(CodeHighlightPlugin, {}),
5668
- /* @__PURE__ */ jsx11(TablePlugin, {}),
5669
- /* @__PURE__ */ jsx11(LinkPlugin, {}),
5670
- /* @__PURE__ */ jsx11(MarkdownShortcutPlugin, { transformers: SHORTCUT_TRANSFORMERS }),
5671
- /* @__PURE__ */ jsx11(ReadOnlyPlugin, { readOnly: readOnly || mode === "view" }),
5672
- autoFocus && /* @__PURE__ */ jsx11(AutoFocusPlugin, {})
6051
+ /* @__PURE__ */ jsx12(HistoryPlugin, {}),
6052
+ /* @__PURE__ */ jsx12(ListPlugin, {}),
6053
+ /* @__PURE__ */ jsx12(CheckListPlugin, {}),
6054
+ /* @__PURE__ */ jsx12(ChecklistShortcutPlugin, {}),
6055
+ /* @__PURE__ */ jsx12(CodeBlockShortcutPlugin, {}),
6056
+ /* @__PURE__ */ jsx12(CodeHighlightPlugin, {}),
6057
+ /* @__PURE__ */ jsx12(TablePlugin, {}),
6058
+ /* @__PURE__ */ jsx12(LinkPlugin, {}),
6059
+ /* @__PURE__ */ jsx12(MarkdownShortcutPlugin, { transformers: SHORTCUT_TRANSFORMERS }),
6060
+ /* @__PURE__ */ jsx12(ReadOnlyPlugin, { readOnly: readOnly || mode === "view" }),
6061
+ autoFocus && /* @__PURE__ */ jsx12(AutoFocusPlugin, {})
5673
6062
  ] })
5674
6063
  ] }) }) }, mountKey);
5675
6064
  }
@@ -5689,7 +6078,7 @@ import {
5689
6078
  import { $getRoot, $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection3 } from "lexical";
5690
6079
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
5691
6080
  import { $isHeadingNode } from "@lexical/rich-text";
5692
- import { jsx as jsx12 } from "react/jsx-runtime";
6081
+ import { jsx as jsx13 } from "react/jsx-runtime";
5693
6082
  var HEADING_LEVELS = {
5694
6083
  h1: 1,
5695
6084
  h2: 2,
@@ -5787,7 +6176,7 @@ function FoldingPlugin() {
5787
6176
  return next;
5788
6177
  });
5789
6178
  }, []);
5790
- return /* @__PURE__ */ jsx12("div", { className: "zui-text-editor-fold-gutter", children: buttons.map(({ key, folded, top, height }) => /* @__PURE__ */ jsx12(
6179
+ return /* @__PURE__ */ jsx13("div", { className: "zui-text-editor-fold-gutter", children: buttons.map(({ key, folded, top, height }) => /* @__PURE__ */ jsx13(
5791
6180
  "button",
5792
6181
  {
5793
6182
  type: "button",
@@ -5797,7 +6186,7 @@ function FoldingPlugin() {
5797
6186
  "aria-label": folded ? "Expand section" : "Collapse section",
5798
6187
  "aria-expanded": !folded,
5799
6188
  onClick: () => toggle(key),
5800
- children: /* @__PURE__ */ jsx12(
6189
+ children: /* @__PURE__ */ jsx13(
5801
6190
  "svg",
5802
6191
  {
5803
6192
  viewBox: "0 0 20 20",
@@ -5808,7 +6197,7 @@ function FoldingPlugin() {
5808
6197
  strokeWidth: "2",
5809
6198
  strokeLinecap: "round",
5810
6199
  strokeLinejoin: "round",
5811
- children: /* @__PURE__ */ jsx12("path", { d: "M6 8l4 4 4-4" })
6200
+ children: /* @__PURE__ */ jsx13("path", { d: "M6 8l4 4 4-4" })
5812
6201
  }
5813
6202
  )
5814
6203
  },
@@ -6003,23 +6392,23 @@ function useMarkdownEditor() {
6003
6392
  }
6004
6393
 
6005
6394
  // src/components/Toolbar.tsx
6006
- import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
6395
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
6007
6396
  function Toolbar({ children, className }) {
6008
- return /* @__PURE__ */ jsx13(
6397
+ return /* @__PURE__ */ jsx14(
6009
6398
  "div",
6010
6399
  {
6011
6400
  className: `zui-text-editor-toolbar ${className ?? ""}`,
6012
6401
  role: "toolbar",
6013
- children: children ?? /* @__PURE__ */ jsxs10(Fragment4, { children: [
6014
- /* @__PURE__ */ jsx13(FormatButtons, {}),
6015
- /* @__PURE__ */ jsx13(ToolbarDivider, {}),
6016
- /* @__PURE__ */ jsx13(InsertButtons, {})
6402
+ children: children ?? /* @__PURE__ */ jsxs11(Fragment5, { children: [
6403
+ /* @__PURE__ */ jsx14(FormatButtons, {}),
6404
+ /* @__PURE__ */ jsx14(ToolbarDivider, {}),
6405
+ /* @__PURE__ */ jsx14(InsertButtons, {})
6017
6406
  ] })
6018
6407
  }
6019
6408
  );
6020
6409
  }
6021
6410
  function ToolbarDivider() {
6022
- return /* @__PURE__ */ jsx13("div", { className: "zui-text-editor-toolbar-divider" });
6411
+ return /* @__PURE__ */ jsx14("div", { className: "zui-text-editor-toolbar-divider" });
6023
6412
  }
6024
6413
  function ToolbarButton({
6025
6414
  label,
@@ -6029,7 +6418,7 @@ function ToolbarButton({
6029
6418
  disabled = false,
6030
6419
  className
6031
6420
  }) {
6032
- return /* @__PURE__ */ jsx13(
6421
+ return /* @__PURE__ */ jsx14(
6033
6422
  "button",
6034
6423
  {
6035
6424
  type: "button",
@@ -6045,7 +6434,7 @@ function ToolbarButton({
6045
6434
  );
6046
6435
  }
6047
6436
  function Icon2({ children, strokeWidth = 1.5 }) {
6048
- return /* @__PURE__ */ jsx13(
6437
+ return /* @__PURE__ */ jsx14(
6049
6438
  "svg",
6050
6439
  {
6051
6440
  viewBox: "0 0 20 20",
@@ -6064,27 +6453,27 @@ var FORMAT_BUTTONS = [
6064
6453
  {
6065
6454
  format: "bold",
6066
6455
  label: "Bold",
6067
- icon: /* @__PURE__ */ jsx13(Icon2, { strokeWidth: 1.8, children: /* @__PURE__ */ jsx13("path", { d: "M6 3.5h5a3 3 0 0 1 0 6H6zm0 6h6a3 3 0 0 1 0 6H6z" }) })
6456
+ icon: /* @__PURE__ */ jsx14(Icon2, { strokeWidth: 1.8, children: /* @__PURE__ */ jsx14("path", { d: "M6 3.5h5a3 3 0 0 1 0 6H6zm0 6h6a3 3 0 0 1 0 6H6z" }) })
6068
6457
  },
6069
6458
  {
6070
6459
  format: "italic",
6071
6460
  label: "Italic",
6072
- icon: /* @__PURE__ */ jsx13(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx13("path", { d: "M8.5 3.5h6M5.5 16.5h6M11.5 3.5l-3 13" }) })
6461
+ icon: /* @__PURE__ */ jsx14(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx14("path", { d: "M8.5 3.5h6M5.5 16.5h6M11.5 3.5l-3 13" }) })
6073
6462
  },
6074
6463
  {
6075
6464
  format: "strikethrough",
6076
6465
  label: "Strikethrough",
6077
- icon: /* @__PURE__ */ jsx13(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx13("path", { d: "M4 10h12M13.5 5.5c-.6-1.2-2-2-3.5-2-2 0-3.5 1.2-3.5 2.8 0 .5.1.9.4 1.3m-.4 5c.5 1.6 2 2.9 3.9 2.9 2 0 3.6-1.2 3.6-2.9 0-.4-.1-.8-.2-1.1" }) })
6466
+ icon: /* @__PURE__ */ jsx14(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx14("path", { d: "M4 10h12M13.5 5.5c-.6-1.2-2-2-3.5-2-2 0-3.5 1.2-3.5 2.8 0 .5.1.9.4 1.3m-.4 5c.5 1.6 2 2.9 3.9 2.9 2 0 3.6-1.2 3.6-2.9 0-.4-.1-.8-.2-1.1" }) })
6078
6467
  },
6079
6468
  {
6080
6469
  format: "code",
6081
6470
  label: "Inline code",
6082
- icon: /* @__PURE__ */ jsx13(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx13("path", { d: "M7.5 6L4 10l3.5 4M12.5 6L16 10l-3.5 4" }) })
6471
+ icon: /* @__PURE__ */ jsx14(Icon2, { strokeWidth: 1.6, children: /* @__PURE__ */ jsx14("path", { d: "M7.5 6L4 10l3.5 4M12.5 6L16 10l-3.5 4" }) })
6083
6472
  }
6084
6473
  ];
6085
6474
  function FormatButtons() {
6086
6475
  const { activeFormats, toggleFormat } = useMarkdownEditor();
6087
- return /* @__PURE__ */ jsx13(Fragment4, { children: FORMAT_BUTTONS.map(({ format, label, icon }) => /* @__PURE__ */ jsx13(
6476
+ return /* @__PURE__ */ jsx14(Fragment5, { children: FORMAT_BUTTONS.map(({ format, label, icon }) => /* @__PURE__ */ jsx14(
6088
6477
  ToolbarButton,
6089
6478
  {
6090
6479
  label,
@@ -6097,36 +6486,36 @@ function FormatButtons() {
6097
6486
  }
6098
6487
  function InsertButtons() {
6099
6488
  const { insertTable, insertDrawing } = useMarkdownEditor();
6100
- return /* @__PURE__ */ jsxs10(Fragment4, { children: [
6101
- /* @__PURE__ */ jsx13(ToolbarButton, { label: "Insert table", onClick: () => insertTable(), children: /* @__PURE__ */ jsxs10(Icon2, { children: [
6102
- /* @__PURE__ */ jsx13("rect", { x: "3", y: "3.5", width: "14", height: "13", rx: "1.5" }),
6103
- /* @__PURE__ */ jsx13("path", { d: "M3 8h14M8 8v8.5M13 8v8.5" })
6489
+ return /* @__PURE__ */ jsxs11(Fragment5, { children: [
6490
+ /* @__PURE__ */ jsx14(ToolbarButton, { label: "Insert table", onClick: () => insertTable(), children: /* @__PURE__ */ jsxs11(Icon2, { children: [
6491
+ /* @__PURE__ */ jsx14("rect", { x: "3", y: "3.5", width: "14", height: "13", rx: "1.5" }),
6492
+ /* @__PURE__ */ jsx14("path", { d: "M3 8h14M8 8v8.5M13 8v8.5" })
6104
6493
  ] }) }),
6105
- /* @__PURE__ */ jsx13(ToolbarButton, { label: "Insert drawing", onClick: insertDrawing, children: /* @__PURE__ */ jsxs10(Icon2, { children: [
6106
- /* @__PURE__ */ jsx13("rect", { x: "3", y: "5", width: "8", height: "6", rx: "1.5" }),
6107
- /* @__PURE__ */ jsx13("path", { d: "M13.5 8h3M14.5 6.5L17.5 8l-3 1.5" }),
6108
- /* @__PURE__ */ jsx13("ellipse", { cx: "13", cy: "14.5", rx: "4", ry: "2.8" })
6494
+ /* @__PURE__ */ jsx14(ToolbarButton, { label: "Insert drawing", onClick: insertDrawing, children: /* @__PURE__ */ jsxs11(Icon2, { children: [
6495
+ /* @__PURE__ */ jsx14("rect", { x: "3", y: "5", width: "8", height: "6", rx: "1.5" }),
6496
+ /* @__PURE__ */ jsx14("path", { d: "M13.5 8h3M14.5 6.5L17.5 8l-3 1.5" }),
6497
+ /* @__PURE__ */ jsx14("ellipse", { cx: "13", cy: "14.5", rx: "4", ry: "2.8" })
6109
6498
  ] }) })
6110
6499
  ] });
6111
6500
  }
6112
6501
  function HistoryButtons() {
6113
6502
  const { canUndo, canRedo, undo, redo } = useMarkdownEditor();
6114
- return /* @__PURE__ */ jsxs10(Fragment4, { children: [
6115
- /* @__PURE__ */ jsx13(ToolbarButton, { label: "Undo", onClick: undo, disabled: !canUndo, children: /* @__PURE__ */ jsxs10(Icon2, { children: [
6116
- /* @__PURE__ */ jsx13("path", { d: "M7 6L3.5 9.5 7 13" }),
6117
- /* @__PURE__ */ jsx13("path", { d: "M3.5 9.5H12a4 4 0 0 1 0 8h-1" })
6503
+ return /* @__PURE__ */ jsxs11(Fragment5, { children: [
6504
+ /* @__PURE__ */ jsx14(ToolbarButton, { label: "Undo", onClick: undo, disabled: !canUndo, children: /* @__PURE__ */ jsxs11(Icon2, { children: [
6505
+ /* @__PURE__ */ jsx14("path", { d: "M7 6L3.5 9.5 7 13" }),
6506
+ /* @__PURE__ */ jsx14("path", { d: "M3.5 9.5H12a4 4 0 0 1 0 8h-1" })
6118
6507
  ] }) }),
6119
- /* @__PURE__ */ jsx13(ToolbarButton, { label: "Redo", onClick: redo, disabled: !canRedo, children: /* @__PURE__ */ jsxs10(Icon2, { children: [
6120
- /* @__PURE__ */ jsx13("path", { d: "M13 6l3.5 3.5L13 13" }),
6121
- /* @__PURE__ */ jsx13("path", { d: "M16.5 9.5H8a4 4 0 0 0 0 8h1" })
6508
+ /* @__PURE__ */ jsx14(ToolbarButton, { label: "Redo", onClick: redo, disabled: !canRedo, children: /* @__PURE__ */ jsxs11(Icon2, { children: [
6509
+ /* @__PURE__ */ jsx14("path", { d: "M13 6l3.5 3.5L13 13" }),
6510
+ /* @__PURE__ */ jsx14("path", { d: "M16.5 9.5H8a4 4 0 0 0 0 8h1" })
6122
6511
  ] }) })
6123
6512
  ] });
6124
6513
  }
6125
6514
 
6126
6515
  // src/plugins/TableSettingsPlugin.tsx
6127
- import { jsx as jsx14 } from "react/jsx-runtime";
6516
+ import { jsx as jsx15 } from "react/jsx-runtime";
6128
6517
  function Icon3({ children }) {
6129
- return /* @__PURE__ */ jsx14(
6518
+ return /* @__PURE__ */ jsx15(
6130
6519
  "svg",
6131
6520
  {
6132
6521
  viewBox: "0 0 20 20",
@@ -6187,20 +6576,20 @@ function TableSettingsPlugin() {
6187
6576
  [editor]
6188
6577
  );
6189
6578
  if (!isEditable || !anchor || !settings) return null;
6190
- return /* @__PURE__ */ jsx14(
6579
+ return /* @__PURE__ */ jsx15(
6191
6580
  "div",
6192
6581
  {
6193
6582
  className: "zui-table-settings",
6194
6583
  role: "toolbar",
6195
6584
  "aria-label": "Table settings",
6196
6585
  style: { top: anchor.top, right: anchor.right },
6197
- children: LAYOUT_OPTIONS.map(({ preset, label, icon, width, density }) => /* @__PURE__ */ jsx14(
6586
+ children: LAYOUT_OPTIONS.map(({ preset, label, icon, width, density }) => /* @__PURE__ */ jsx15(
6198
6587
  ToolbarButton,
6199
6588
  {
6200
6589
  label,
6201
6590
  active: layoutPreset(settings.width) === preset,
6202
6591
  onClick: () => update({ width, density }),
6203
- children: /* @__PURE__ */ jsx14(Icon3, { children: icon })
6592
+ children: /* @__PURE__ */ jsx15(Icon3, { children: icon })
6204
6593
  },
6205
6594
  preset
6206
6595
  ))
@@ -6209,7 +6598,7 @@ function TableSettingsPlugin() {
6209
6598
  }
6210
6599
 
6211
6600
  // src/EditorContent.tsx
6212
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
6601
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
6213
6602
  function EditorContent({
6214
6603
  placeholder = "Start writing...",
6215
6604
  foldable = true,
@@ -6217,7 +6606,7 @@ function EditorContent({
6217
6606
  }) {
6218
6607
  const { mode, readOnly, autoFocus, rawValue, onRawChange } = useEditorContext();
6219
6608
  if (mode === "edit-raw") {
6220
- return /* @__PURE__ */ jsx15(
6609
+ return /* @__PURE__ */ jsx16(
6221
6610
  "textarea",
6222
6611
  {
6223
6612
  className: "zui-text-editor-textarea",
@@ -6230,24 +6619,24 @@ function EditorContent({
6230
6619
  }
6231
6620
  );
6232
6621
  }
6233
- return /* @__PURE__ */ jsxs11("div", { className: "zui-text-editor-body", children: [
6234
- /* @__PURE__ */ jsxs11("div", { className: "zui-text-editor-main", children: [
6235
- /* @__PURE__ */ jsx15(
6622
+ return /* @__PURE__ */ jsxs12("div", { className: "zui-text-editor-body", children: [
6623
+ /* @__PURE__ */ jsxs12("div", { className: "zui-text-editor-main", children: [
6624
+ /* @__PURE__ */ jsx16(
6236
6625
  RichTextPlugin,
6237
6626
  {
6238
- contentEditable: /* @__PURE__ */ jsx15(
6627
+ contentEditable: /* @__PURE__ */ jsx16(
6239
6628
  ContentEditable,
6240
6629
  {
6241
6630
  className: "zui-text-editor-content",
6242
6631
  "aria-placeholder": placeholder,
6243
- placeholder: /* @__PURE__ */ jsx15("div", { className: "zui-text-editor-placeholder", children: placeholder })
6632
+ placeholder: /* @__PURE__ */ jsx16("div", { className: "zui-text-editor-placeholder", children: placeholder })
6244
6633
  }
6245
6634
  ),
6246
6635
  ErrorBoundary: LexicalErrorBoundary
6247
6636
  }
6248
6637
  ),
6249
- foldable && /* @__PURE__ */ jsx15(FoldingPlugin, {}),
6250
- /* @__PURE__ */ jsx15(TableSettingsPlugin, {})
6638
+ foldable && /* @__PURE__ */ jsx16(FoldingPlugin, {}),
6639
+ /* @__PURE__ */ jsx16(TableSettingsPlugin, {})
6251
6640
  ] }),
6252
6641
  children
6253
6642
  ] });
@@ -6259,7 +6648,7 @@ import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexic
6259
6648
  import {
6260
6649
  TableOfContentsPlugin
6261
6650
  } from "@lexical/react/LexicalTableOfContentsPlugin";
6262
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
6651
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
6263
6652
  var INDENT_PER_LEVEL = {
6264
6653
  h1: 0,
6265
6654
  h2: 1,
@@ -6311,16 +6700,16 @@ function OutlinePlugin() {
6311
6700
  },
6312
6701
  [editor]
6313
6702
  );
6314
- return /* @__PURE__ */ jsx16(TableOfContentsPlugin, { children: (entries) => {
6703
+ return /* @__PURE__ */ jsx17(TableOfContentsPlugin, { children: (entries) => {
6315
6704
  for (const [key] of entries) {
6316
6705
  editor.getElementByKey(key)?.setAttribute("data-outline-key", key);
6317
6706
  }
6318
- return /* @__PURE__ */ jsxs12(
6707
+ return /* @__PURE__ */ jsxs13(
6319
6708
  "div",
6320
6709
  {
6321
6710
  className: `zui-text-editor-outline ${collapsed ? "is-collapsed" : ""}`,
6322
6711
  children: [
6323
- /* @__PURE__ */ jsx16(
6712
+ /* @__PURE__ */ jsx17(
6324
6713
  "button",
6325
6714
  {
6326
6715
  type: "button",
@@ -6329,7 +6718,7 @@ function OutlinePlugin() {
6329
6718
  "aria-label": collapsed ? "Show outline" : "Hide outline",
6330
6719
  "aria-expanded": !collapsed,
6331
6720
  onClick: () => setCollapsed((c2) => !c2),
6332
- children: /* @__PURE__ */ jsx16(
6721
+ children: /* @__PURE__ */ jsx17(
6333
6722
  "svg",
6334
6723
  {
6335
6724
  viewBox: "0 0 20 20",
@@ -6339,14 +6728,14 @@ function OutlinePlugin() {
6339
6728
  stroke: "currentColor",
6340
6729
  strokeWidth: "1.8",
6341
6730
  strokeLinecap: "round",
6342
- children: /* @__PURE__ */ jsx16("path", { d: "M4 5h12M4 10h8M4 15h10" })
6731
+ children: /* @__PURE__ */ jsx17("path", { d: "M4 5h12M4 10h8M4 15h10" })
6343
6732
  }
6344
6733
  )
6345
6734
  }
6346
6735
  ),
6347
- !collapsed && /* @__PURE__ */ jsxs12("nav", { className: "zui-text-editor-outline-list", "aria-label": "Table of contents", children: [
6348
- entries.length === 0 && /* @__PURE__ */ jsx16("div", { className: "zui-text-editor-outline-empty", children: "No headings" }),
6349
- entries.map(([key, text, tag]) => /* @__PURE__ */ jsx16(
6736
+ !collapsed && /* @__PURE__ */ jsxs13("nav", { className: "zui-text-editor-outline-list", "aria-label": "Table of contents", children: [
6737
+ entries.length === 0 && /* @__PURE__ */ jsx17("div", { className: "zui-text-editor-outline-empty", children: "No headings" }),
6738
+ entries.map(([key, text, tag]) => /* @__PURE__ */ jsx17(
6350
6739
  "button",
6351
6740
  {
6352
6741
  type: "button",
@@ -6367,11 +6756,11 @@ function OutlinePlugin() {
6367
6756
  }
6368
6757
 
6369
6758
  // src/MarkdownEditor.tsx
6370
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
6759
+ import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
6371
6760
  var DEFAULT_ITEMS = {
6372
- format: /* @__PURE__ */ jsx17(FormatButtons, {}),
6373
- insert: /* @__PURE__ */ jsx17(InsertButtons, {}),
6374
- history: /* @__PURE__ */ jsx17(HistoryButtons, {})
6761
+ format: /* @__PURE__ */ jsx18(FormatButtons, {}),
6762
+ insert: /* @__PURE__ */ jsx18(InsertButtons, {}),
6763
+ history: /* @__PURE__ */ jsx18(HistoryButtons, {})
6375
6764
  };
6376
6765
  function EditorToolbar({
6377
6766
  children,
@@ -6379,7 +6768,7 @@ function EditorToolbar({
6379
6768
  }) {
6380
6769
  const { mode, readOnly } = useEditorContext();
6381
6770
  if (mode !== "edit-md" || readOnly) return null;
6382
- return /* @__PURE__ */ jsx17(Toolbar, { className, children });
6771
+ return /* @__PURE__ */ jsx18(Toolbar, { className, children });
6383
6772
  }
6384
6773
  function MarkdownEditor({
6385
6774
  placeholder,
@@ -6388,10 +6777,10 @@ function MarkdownEditor({
6388
6777
  foldable = true,
6389
6778
  ...rootProps
6390
6779
  }) {
6391
- return /* @__PURE__ */ jsxs13(EditorRoot, { ...rootProps, children: [
6392
- toolbar === true && /* @__PURE__ */ jsx17(EditorToolbar, {}),
6780
+ return /* @__PURE__ */ jsxs14(EditorRoot, { ...rootProps, children: [
6781
+ toolbar === true && /* @__PURE__ */ jsx18(EditorToolbar, {}),
6393
6782
  typeof toolbar === "function" && toolbar(DEFAULT_ITEMS),
6394
- /* @__PURE__ */ jsx17(EditorContent, { placeholder, foldable, children: outline && /* @__PURE__ */ jsx17(OutlinePlugin, {}) })
6783
+ /* @__PURE__ */ jsx18(EditorContent, { placeholder, foldable, children: outline && /* @__PURE__ */ jsx18(OutlinePlugin, {}) })
6395
6784
  ] });
6396
6785
  }
6397
6786
  MarkdownEditor.Root = EditorRoot;
@@ -6618,6 +7007,9 @@ export {
6618
7007
  formatTableSettingsMarker,
6619
7008
  getCodeLanguages,
6620
7009
  hasCodeLanguage,
7010
+ inkAmplitude,
7011
+ inkFillOffset,
7012
+ inkStroke,
6621
7013
  isBlockWidth,
6622
7014
  isDrawingSkeleton,
6623
7015
  makeBinding,
@@ -6629,7 +7021,10 @@ export {
6629
7021
  registerCodeLanguage,
6630
7022
  resolveBindings,
6631
7023
  resolveCodeLanguage,
7024
+ roundedPolyline,
7025
+ roundedRectPolygon,
6632
7026
  routeElbow,
7027
+ seedFrom,
6633
7028
  serializeDrawingData,
6634
7029
  tokenizeCode,
6635
7030
  useMarkdownEditor