@ibodr/draw 0.2.1 → 0.2.3

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.mjs CHANGED
@@ -1726,6 +1726,7 @@ var DEFAULT_TRANSLATION = {
1726
1726
  "dash-style.dotted": "Dotted",
1727
1727
  "dash-style.draw": "Draw",
1728
1728
  "dash-style.solid": "Solid",
1729
+ "size-style.xs": "Extra small",
1729
1730
  "size-style.s": "Small",
1730
1731
  "size-style.m": "Medium",
1731
1732
  "size-style.l": "Large",
@@ -3265,24 +3266,28 @@ var TEXT_PROPS = {
3265
3266
  padding: "0px"
3266
3267
  };
3267
3268
  var STROKE_SIZES = {
3269
+ xs: 0.35,
3268
3270
  s: 1,
3269
3271
  m: 1.75,
3270
3272
  l: 2.5,
3271
3273
  xl: 5
3272
3274
  };
3273
3275
  var FONT_SIZES = {
3276
+ xs: 0.875,
3274
3277
  s: 1.125,
3275
3278
  m: 1.5,
3276
3279
  l: 2.25,
3277
3280
  xl: 2.75
3278
3281
  };
3279
3282
  var LABEL_FONT_SIZES = {
3283
+ xs: 0.875,
3280
3284
  s: 1.125,
3281
3285
  m: 1.375,
3282
3286
  l: 1.625,
3283
3287
  xl: 2
3284
3288
  };
3285
3289
  var ARROW_LABEL_FONT_SIZES = {
3290
+ xs: 0.875,
3286
3291
  s: 1.125,
3287
3292
  m: 1.25,
3288
3293
  l: 1.5,
@@ -3735,6 +3740,266 @@ var getFill = (element) => {
3735
3740
  }
3736
3741
  return fillStylesToFillType[element.fillStyle] ?? "solid";
3737
3742
  };
3743
+
3744
+ // src/features/clipboard/miro/miroStyleMap.ts
3745
+ function parseMiroStyle(style) {
3746
+ if (!style) return {};
3747
+ if (typeof style === "object") return style;
3748
+ if (typeof style !== "string") return {};
3749
+ try {
3750
+ return JSON.parse(style);
3751
+ } catch {
3752
+ return {};
3753
+ }
3754
+ }
3755
+ function miroColorToHex(color) {
3756
+ if (typeof color !== "number" || !Number.isFinite(color) || color < 0) return null;
3757
+ const n = Math.floor(color) & 16777215;
3758
+ return `#${n.toString(16).padStart(6, "0")}`;
3759
+ }
3760
+ function miroColorToDrawColor(color, fallback = "black") {
3761
+ const hex = miroColorToHex(color);
3762
+ if (hex) return hex;
3763
+ return fallback;
3764
+ }
3765
+ function miroStickyColor(style) {
3766
+ return miroColorToHex(style.sbc ?? style.bc) ?? "#ffe86d";
3767
+ }
3768
+ function breakLongStickyTokens(text) {
3769
+ if (!text) return text;
3770
+ return text.replace(/\S{14,}/g, (run) => {
3771
+ if (/[\/\\_\-.=?&#]/.test(run)) {
3772
+ return run.replace(/([\/\\_\-.=?&#])/g, "$1\u200B");
3773
+ }
3774
+ const chunks = [];
3775
+ for (let i = 0; i < run.length; i += 12) {
3776
+ chunks.push(run.slice(i, i + 12));
3777
+ }
3778
+ return chunks.join("\u200B");
3779
+ });
3780
+ }
3781
+ function miroLineStyleToDash(style) {
3782
+ const ls = typeof style.ls === "number" ? style.ls : Number(style.ls);
3783
+ if (ls === 1) return "dashed";
3784
+ if (ls === 3) return "dotted";
3785
+ return "solid";
3786
+ }
3787
+ function miroStrokeWidthToSize(width) {
3788
+ const w = typeof width === "number" ? width : Number(width);
3789
+ if (!Number.isFinite(w)) return "m";
3790
+ if (w <= 0.5) return "xs";
3791
+ if (w <= 1) return "s";
3792
+ if (w <= 2) return "m";
3793
+ if (w <= 4) return "l";
3794
+ return "xl";
3795
+ }
3796
+ function miroFontSizeToSizeAndScale(fontSize) {
3797
+ const fs = typeof fontSize === "number" ? fontSize : Number(fontSize);
3798
+ if (!Number.isFinite(fs) || fs <= 0) {
3799
+ return { size: "s", scale: 14 / 18 };
3800
+ }
3801
+ if (fs <= 12) return { size: "s", scale: Math.max(0.5, fs / 18) };
3802
+ if (fs <= 16) return { size: "s", scale: fs / 18 };
3803
+ if (fs <= 22) return { size: "m", scale: fs / 24 };
3804
+ if (fs <= 30) return { size: "l", scale: fs / 36 };
3805
+ return { size: "xl", scale: Math.min(4, fs / 44) };
3806
+ }
3807
+ function miroTextFontFromJson(style) {
3808
+ if (typeof style.fs === "number" && style.fs > 0) {
3809
+ return miroFontSizeToSizeAndScale(style.fs);
3810
+ }
3811
+ if (typeof style.st === "number" && style.st > 0) {
3812
+ return miroFontSizeToSizeAndScale(style.st);
3813
+ }
3814
+ return miroFontSizeToSizeAndScale(14);
3815
+ }
3816
+ function readLocalSize(json) {
3817
+ const size = json?.size;
3818
+ return {
3819
+ w: Math.max(1, readNumber(size?.width ?? json?.width, 100)),
3820
+ h: Math.max(1, readNumber(size?.height ?? json?.height, 100))
3821
+ };
3822
+ }
3823
+ function miroBorderStyleToDash(brs) {
3824
+ const n = typeof brs === "number" ? brs : Number(brs);
3825
+ if (n === 1) return "dashed";
3826
+ if (n === 3) return "dotted";
3827
+ return "solid";
3828
+ }
3829
+ function miroFillFromStyle(style) {
3830
+ const bc = style.bc;
3831
+ if (typeof bc !== "number" || bc < 0) return "none";
3832
+ const bo = typeof style.bo === "number" ? style.bo : 1;
3833
+ if (bo <= 0) return "none";
3834
+ if (bo < 0.85) return "semi";
3835
+ return "solid";
3836
+ }
3837
+ function miroTextAlign(ta) {
3838
+ const v = String(ta ?? "c");
3839
+ if (v === "l" || v === "left") return { align: "start", textAlign: "start" };
3840
+ if (v === "r" || v === "right") return { align: "end", textAlign: "end" };
3841
+ return { align: "middle", textAlign: "middle" };
3842
+ }
3843
+ function miroVerticalAlign(tav) {
3844
+ const v = String(tav ?? "m");
3845
+ if (v === "t" || v === "top") return "start";
3846
+ if (v === "b" || v === "bottom") return "end";
3847
+ return "middle";
3848
+ }
3849
+ var MIRO_SHAPE_TO_GEO = {
3850
+ "3": "rectangle",
3851
+ "4": "ellipse",
3852
+ "5": "triangle",
3853
+ "6": "rectangle",
3854
+ // speech bubble → placeholder
3855
+ "7": "rectangle",
3856
+ // squircle / round_rectangle
3857
+ "8": "diamond",
3858
+ "10": "rhombus",
3859
+ // parallelogram
3860
+ "11": "star",
3861
+ "12": "arrow-right",
3862
+ "13": "arrow-left",
3863
+ "16": "pentagon",
3864
+ "17": "hexagon",
3865
+ "18": "octagon",
3866
+ "19": "trapezoid",
3867
+ "20": "rectangle",
3868
+ // predefined process
3869
+ "21": "arrow-right",
3870
+ "22": "cloud",
3871
+ "23": "rectangle",
3872
+ "24": "rectangle",
3873
+ "25": "x-box",
3874
+ "26": "oval"
3875
+ // barrel / cylinder ≈ oval
3876
+ };
3877
+ var MIRO_STENCIL_TO_GEO = {
3878
+ "flowchart-terminator": "oval",
3879
+ "flowchart-process": "rectangle",
3880
+ "flowchart-decision": "diamond",
3881
+ "flowchart-input-output": "rhombus",
3882
+ "flowchart-data": "rhombus",
3883
+ "flowchart-document": "rectangle",
3884
+ "flowchart-preparation": "hexagon",
3885
+ "flowchart-connector": "ellipse",
3886
+ "flowchart-display": "ellipse",
3887
+ "flowchart-manual-input": "trapezoid",
3888
+ "flowchart-manual-operation": "trapezoid",
3889
+ "flowchart-predefined-process": "rectangle",
3890
+ "flowchart-predefined-process-2": "rectangle",
3891
+ "flowchart-offpage-connector": "arrow-right",
3892
+ "flowchart-delay": "ellipse",
3893
+ "flowchart-merge": "triangle",
3894
+ "flowchart-or": "ellipse",
3895
+ "flowchart-summing-junction": "ellipse",
3896
+ "flowchart-internal-storage": "rectangle",
3897
+ "flowchart-note-square": "rectangle"
3898
+ };
3899
+ function miroShapeToGeo(shape) {
3900
+ const key = String(shape ?? "3");
3901
+ return MIRO_SHAPE_TO_GEO[key] ?? "rectangle";
3902
+ }
3903
+ function miroStencilToGeo(schemaId) {
3904
+ const key = String(schemaId ?? "");
3905
+ return MIRO_STENCIL_TO_GEO[key] ?? "rectangle";
3906
+ }
3907
+ function miroStencilText(json) {
3908
+ const schema = json?.schema;
3909
+ const texts = schema?.data?.texts;
3910
+ if (!texts || typeof texts !== "object") return "";
3911
+ const named = texts.name?.text;
3912
+ if (typeof named === "string") return named;
3913
+ for (const value of Object.values(texts)) {
3914
+ if (value && typeof value.text === "string") return value.text;
3915
+ }
3916
+ return "";
3917
+ }
3918
+ function miroStencilFontStyle(json, fallback) {
3919
+ const schema = json?.schema;
3920
+ const fromText = schema?.data?.texts?.name?.styles;
3921
+ if (fromText && typeof fromText === "object") {
3922
+ return { ...fallback, ...fromText };
3923
+ }
3924
+ return fallback;
3925
+ }
3926
+ function miroArrowhead(code) {
3927
+ const n = typeof code === "number" ? code : Number(code);
3928
+ if (!Number.isFinite(n) || n === 0) return "none";
3929
+ if (n === 1) return "dot";
3930
+ if (n === 2) return "square";
3931
+ if (n === 3) return "diamond";
3932
+ if (n === 5) return "bar";
3933
+ if (n === 6) return "pipe";
3934
+ if (n === 7) return "triangle";
3935
+ return "arrow";
3936
+ }
3937
+ function miroHtmlToPlainText(html) {
3938
+ if (typeof html !== "string" || !html) return "";
3939
+ return html.replace(/<\s*br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&#39;/g, "'").replace(/&#x([0-9a-f]+);/gi, (_, hex) => {
3940
+ const code = parseInt(hex, 16);
3941
+ return Number.isFinite(code) ? String.fromCodePoint(code) : "";
3942
+ }).replace(/&#(\d+);/g, (_, dec) => {
3943
+ const code = parseInt(dec, 10);
3944
+ return Number.isFinite(code) ? String.fromCodePoint(code) : "";
3945
+ }).replace(/\n{3,}/g, "\n\n").trim();
3946
+ }
3947
+ function readNumber(value, fallback = 0) {
3948
+ const n = typeof value === "number" ? value : Number(value);
3949
+ return Number.isFinite(n) ? n : fallback;
3950
+ }
3951
+ function readScale(scale) {
3952
+ if (typeof scale === "number") return scale > 0 ? scale : 1;
3953
+ if (scale && typeof scale === "object" && "scale" in scale) {
3954
+ return readScale(scale.scale);
3955
+ }
3956
+ return 1;
3957
+ }
3958
+ function readRotation(rotation) {
3959
+ if (typeof rotation === "number") return rotation * Math.PI / 180;
3960
+ if (rotation && typeof rotation === "object" && "rotation" in rotation) {
3961
+ return readRotation(rotation.rotation);
3962
+ }
3963
+ return 0;
3964
+ }
3965
+ function readOffsetPosition(json) {
3966
+ if (!json) return { x: 0, y: 0, isParentLocal: false };
3967
+ const pos = json._position ?? json.position;
3968
+ const isParentLocal = pos?.schema === "parentOffsetPx";
3969
+ if (pos?.offsetPx) {
3970
+ return {
3971
+ x: readNumber(pos.offsetPx.x),
3972
+ y: readNumber(pos.offsetPx.y),
3973
+ isParentLocal
3974
+ };
3975
+ }
3976
+ if (typeof json.x === "number" || typeof json.y === "number") {
3977
+ return { x: readNumber(json.x), y: readNumber(json.y), isParentLocal: false };
3978
+ }
3979
+ if (pos && (typeof pos.x === "number" || typeof pos.y === "number")) {
3980
+ return { x: readNumber(pos.x), y: readNumber(pos.y), isParentLocal: false };
3981
+ }
3982
+ return { x: 0, y: 0, isParentLocal: false };
3983
+ }
3984
+ function miroCenterToTopLeft(center, size, rotationRad = 0) {
3985
+ const hx = size.w / 2;
3986
+ const hy = size.h / 2;
3987
+ if (!rotationRad) {
3988
+ return { x: center.x - hx, y: center.y - hy };
3989
+ }
3990
+ const cos = Math.cos(rotationRad);
3991
+ const sin = Math.sin(rotationRad);
3992
+ return {
3993
+ x: center.x - (cos * hx - sin * hy),
3994
+ y: center.y - (sin * hx + cos * hy)
3995
+ };
3996
+ }
3997
+ function readSize(json, scale = 1) {
3998
+ const size = json?.size;
3999
+ const w = readNumber(size?.width ?? json?.width, 100) * scale;
4000
+ const h = readNumber(size?.height ?? json?.height, 100) * scale;
4001
+ return { w: Math.max(1, w), h: Math.max(1, h) };
4002
+ }
3738
4003
  var DefaultFontFaces = {
3739
4004
  draw_draw: {
3740
4005
  normal: {
@@ -3959,6 +4224,880 @@ function defaultAddFontsFromNode(node, state, addFont) {
3959
4224
  return state;
3960
4225
  }
3961
4226
 
4227
+ // src/features/clipboard/miro/miroRichText.ts
4228
+ function mapRichTextTextNodes(doc, mapText) {
4229
+ const walk = (node) => {
4230
+ if (node.type === "text" && typeof node.text === "string") {
4231
+ return { ...node, text: mapText(node.text) };
4232
+ }
4233
+ const content = node.content;
4234
+ if (Array.isArray(content)) {
4235
+ return { ...node, content: content.map((c) => walk(c)) };
4236
+ }
4237
+ return node;
4238
+ };
4239
+ return walk(doc);
4240
+ }
4241
+ function isQuillBulletListType(type) {
4242
+ return type === "bullet" || type === "checked" || type === "unchecked";
4243
+ }
4244
+ function convertQuillListsToSemanticHtml(html) {
4245
+ if (!/data-list\s*=/i.test(html) || typeof DOMParser === "undefined") return html;
4246
+ const doc = new DOMParser().parseFromString(`<div id="__miro_rt">${html}</div>`, "text/html");
4247
+ const root = doc.getElementById("__miro_rt");
4248
+ if (!root) return html;
4249
+ const ols = Array.from(root.querySelectorAll("ol")).sort((a, b) => {
4250
+ let da = 0;
4251
+ let db = 0;
4252
+ for (let n = a; n; n = n.parentElement) da++;
4253
+ for (let n = b; n; n = n.parentElement) db++;
4254
+ return db - da;
4255
+ });
4256
+ for (const ol of ols) {
4257
+ const items = Array.from(ol.children).filter((c) => c.tagName === "LI");
4258
+ if (!items.some((li) => li.hasAttribute("data-list"))) continue;
4259
+ const groups = [];
4260
+ for (const li of items) {
4261
+ const bullet = isQuillBulletListType(li.getAttribute("data-list"));
4262
+ const last7 = groups[groups.length - 1];
4263
+ if (last7 && last7.bullet === bullet) last7.items.push(li);
4264
+ else groups.push({ bullet, items: [li] });
4265
+ }
4266
+ const parent = ol.parentNode;
4267
+ if (!parent) continue;
4268
+ for (const group of groups) {
4269
+ const list = doc.createElement(group.bullet ? "ul" : "ol");
4270
+ for (const li of group.items) {
4271
+ li.removeAttribute("data-list");
4272
+ li.querySelectorAll("span.ql-ui").forEach((el) => el.remove());
4273
+ list.appendChild(li);
4274
+ }
4275
+ parent.insertBefore(list, ol);
4276
+ }
4277
+ parent.removeChild(ol);
4278
+ }
4279
+ return root.innerHTML;
4280
+ }
4281
+ function normalizeMiroHtml(html) {
4282
+ let s = html.trim();
4283
+ if (!s) return s;
4284
+ s = s.replace(/<\s*b(\s[^>]*)?>/gi, "<strong$1>").replace(/<\/\s*b\s*>/gi, "</strong>");
4285
+ s = s.replace(/<\s*i(\s[^>]*)?>/gi, "<em$1>").replace(/<\/\s*i\s*>/gi, "</em>");
4286
+ s = s.replace(/<\s*del(\s[^>]*)?>/gi, "<s$1>").replace(/<\/\s*del\s*>/gi, "</s>");
4287
+ s = convertQuillListsToSemanticHtml(s);
4288
+ if (!/^<(p|ul|ol|h[1-6]|blockquote|pre)\b/i.test(s)) {
4289
+ s = `<p>${s}</p>`;
4290
+ }
4291
+ return s;
4292
+ }
4293
+ function miroHtmlToRichText(editor, html, opts) {
4294
+ if (typeof html !== "string" || !html.trim()) {
4295
+ return toRichText(" ");
4296
+ }
4297
+ const plain = miroHtmlToPlainText(html);
4298
+ const plainOut = opts?.breakLongTokens ? breakLongStickyTokens(plain) : plain;
4299
+ try {
4300
+ let rich = renderRichTextFromHTML(editor, normalizeMiroHtml(html));
4301
+ if (isEmptyRichText(rich)) {
4302
+ return toRichText(plainOut || " ");
4303
+ }
4304
+ if (opts?.breakLongTokens) {
4305
+ rich = mapRichTextTextNodes(rich, breakLongStickyTokens);
4306
+ }
4307
+ return rich;
4308
+ } catch {
4309
+ return toRichText(plainOut || " ");
4310
+ }
4311
+ }
4312
+ function estimateMiroTextLineCount(html, plain) {
4313
+ if (typeof html === "string") {
4314
+ const li = (html.match(/<li\b/gi) ?? []).length;
4315
+ if (li > 0) return Math.max(1, li);
4316
+ const blocks = (html.match(/<(p|div|br)\b/gi) ?? []).length;
4317
+ if (blocks > 1) return blocks;
4318
+ }
4319
+ return Math.max(1, plain.split("\n").filter((l) => l.trim().length > 0).length);
4320
+ }
4321
+
4322
+ // src/features/clipboard/miro/putMiroContent.ts
4323
+ function getWidgetType(obj) {
4324
+ if (obj.type === 10) return "group";
4325
+ if (obj.type === 13) return "tag";
4326
+ return obj.widgetData?.type ?? null;
4327
+ }
4328
+ function getJson(obj) {
4329
+ return obj.widgetData?.json ?? {};
4330
+ }
4331
+ function withMiroCenterLocal(meta, size) {
4332
+ return {
4333
+ ...meta,
4334
+ miroCenterLocal: { x: size.w / 2, y: size.h / 2 }
4335
+ };
4336
+ }
4337
+ function alignShapesToMiroCenters(editor, drafts) {
4338
+ const fixes = [];
4339
+ for (const draft of drafts) {
4340
+ const local = draft.meta?.miroCenterLocal;
4341
+ if (!local) continue;
4342
+ const live = editor.getShape(draft.id);
4343
+ if (!live) continue;
4344
+ const metaLocal = live.meta?.miroCenterLocal ?? local;
4345
+ const pageBounds = editor.getShapePageBounds(live);
4346
+ const pageTransform = editor.getShapePageTransform(live);
4347
+ if (!pageBounds || !pageTransform) continue;
4348
+ const intendedPage = pageTransform.applyToPoint(metaLocal);
4349
+ const parentTransform = editor.getShapeParentTransform(live);
4350
+ const inv = parentTransform.clone().invert();
4351
+ const intendedParent = inv.applyToPoint(intendedPage);
4352
+ const actualParent = inv.applyToPoint(pageBounds.center);
4353
+ const dx = intendedParent.x - actualParent.x;
4354
+ const dy = intendedParent.y - actualParent.y;
4355
+ if (Math.abs(dx) < 0.05 && Math.abs(dy) < 0.05) continue;
4356
+ fixes.push({
4357
+ id: live.id,
4358
+ type: live.type,
4359
+ x: (live.x ?? 0) + dx,
4360
+ y: (live.y ?? 0) + dy
4361
+ });
4362
+ }
4363
+ if (fixes.length) {
4364
+ editor.updateShapes(fixes);
4365
+ }
4366
+ }
4367
+ function isNormalizedAnchor(point) {
4368
+ if (!point) return false;
4369
+ const x = readNumber(point.x, NaN);
4370
+ const y = readNumber(point.y, NaN);
4371
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return false;
4372
+ return x >= -0.05 && x <= 1.05 && y >= -0.05 && y <= 1.05;
4373
+ }
4374
+ function pointInParentLocalBox(p, parentBounds, pad = 1) {
4375
+ return p.x >= -pad && p.y >= -pad && p.x <= parentBounds.w + pad && p.y <= parentBounds.h + pad;
4376
+ }
4377
+ async function putMiroContent(editor, miroClipboardContent, point) {
4378
+ const objects = miroClipboardContent.data?.objects ?? [];
4379
+ if (!objects.length) return null;
4380
+ const shiftRaw = miroClipboardContent.data?.shift;
4381
+ const shift = shiftRaw && (shiftRaw.x != null || shiftRaw.y != null) ? { x: readNumber(shiftRaw.x), y: readNumber(shiftRaw.y) } : null;
4382
+ const drawContent = {
4383
+ shapes: [],
4384
+ bindings: [],
4385
+ rootShapeIds: [],
4386
+ assets: [],
4387
+ schema: editor.store.schema.serialize()
4388
+ };
4389
+ const currentPageId = editor.getCurrentPageId();
4390
+ const indexToShapeId = /* @__PURE__ */ new Map();
4391
+ const indexToBounds = /* @__PURE__ */ new Map();
4392
+ const parentsWithLocalChildren = /* @__PURE__ */ new Set();
4393
+ const groupMemberIds = /* @__PURE__ */ new Map();
4394
+ const pendingParents = [];
4395
+ const pendingLines = [];
4396
+ for (const obj of objects) {
4397
+ if (typeof obj.id === "number") {
4398
+ indexToShapeId.set(obj.id, createShapeId());
4399
+ }
4400
+ }
4401
+ const zByObjectId = /* @__PURE__ */ new Map();
4402
+ let zCursor = ZERO_INDEX_KEY;
4403
+ const takeZ = (obj) => {
4404
+ if (typeof obj.id === "number" && zByObjectId.has(obj.id)) {
4405
+ return zByObjectId.get(obj.id);
4406
+ }
4407
+ const z = zCursor;
4408
+ zCursor = getIndexAbove(zCursor);
4409
+ if (typeof obj.id === "number") zByObjectId.set(obj.id, z);
4410
+ return z;
4411
+ };
4412
+ for (const obj of objects) {
4413
+ const widgetType = getWidgetType(obj);
4414
+ if (!widgetType || widgetType === "group" || widgetType === "tag") continue;
4415
+ if (typeof obj.id === "number") takeZ(obj);
4416
+ }
4417
+ for (const obj of objects) {
4418
+ const widgetType = getWidgetType(obj);
4419
+ if (!widgetType || widgetType === "line") continue;
4420
+ if (widgetType === "group" || widgetType === "tag") continue;
4421
+ const shapeId = typeof obj.id === "number" ? indexToShapeId.get(obj.id) : createShapeId();
4422
+ const json = getJson(obj);
4423
+ const scale = readScale(json.scale ?? json.relativeScale);
4424
+ const rotation = readRotation(json.rotation);
4425
+ const pos = readOffsetPosition(json);
4426
+ if (shift && !pos.isParentLocal) {
4427
+ pos.x -= shift.x;
4428
+ pos.y -= shift.y;
4429
+ }
4430
+ const parentRef = json._parent;
4431
+ if (pos.isParentLocal && parentRef && typeof parentRef.index === "number") {
4432
+ parentsWithLocalChildren.add(parentRef.index);
4433
+ }
4434
+ const base = {
4435
+ id: shapeId,
4436
+ typeName: "shape",
4437
+ parentId: currentPageId,
4438
+ index: takeZ(obj),
4439
+ x: pos.x,
4440
+ y: pos.y,
4441
+ rotation,
4442
+ isLocked: false,
4443
+ opacity: 1,
4444
+ meta: {
4445
+ miroInitialId: obj.initialId ?? null,
4446
+ miroWidgetType: widgetType
4447
+ }
4448
+ };
4449
+ let created = false;
4450
+ switch (widgetType) {
4451
+ case "sticker": {
4452
+ const style = parseMiroStyle(json.style);
4453
+ const local = readLocalSize(json);
4454
+ const richText = miroHtmlToRichText(editor, json.text, { breakLongTokens: true });
4455
+ const scaleFactor = scale > 0 ? scale : 1;
4456
+ const noteW = local.w * scaleFactor;
4457
+ const noteH = local.h * scaleFactor;
4458
+ const topLeft = miroCenterToTopLeft(pos, { w: noteW, h: noteH }, rotation);
4459
+ const baseNote = 200;
4460
+ const noteScale = noteW / baseNote;
4461
+ const miroGrowY = Math.max(0, (noteH - noteW) / Math.max(noteScale, 0.01));
4462
+ const aligns = miroTextAlign(style.ta);
4463
+ const verticalAlign = miroVerticalAlign(style.tav);
4464
+ drawContent.shapes.push({
4465
+ ...base,
4466
+ x: topLeft.x,
4467
+ y: topLeft.y,
4468
+ type: "note",
4469
+ meta: withMiroCenterLocal(
4470
+ {
4471
+ ...base.meta,
4472
+ // NoteShapeUtil.onBeforeCreate auto-grows to fit text; we restore
4473
+ // Miro's fixed box after paste so overlay buttons stay aligned.
4474
+ miroNoteGrowY: miroGrowY,
4475
+ miroNoteScale: noteScale
4476
+ },
4477
+ { w: noteW, h: noteH }
4478
+ ),
4479
+ props: {
4480
+ ...editor.getShapeUtil("note").getDefaultProps(),
4481
+ color: miroStickyColor(style),
4482
+ labelColor: "black",
4483
+ // Miro stickies are denser than default note 'm'.
4484
+ size: "s",
4485
+ font: "sans",
4486
+ align: aligns.align,
4487
+ // Honor Miro vertical align (usually middle) — do not force top.
4488
+ verticalAlign,
4489
+ richText,
4490
+ scale: noteScale,
4491
+ fontSizeAdjustment: 0.9,
4492
+ growY: miroGrowY
4493
+ }
4494
+ });
4495
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, noteW, noteH));
4496
+ created = true;
4497
+ break;
4498
+ }
4499
+ case "text": {
4500
+ const style = parseMiroStyle(json.style);
4501
+ const rawHtml = (typeof json.text === "string" ? json.text : null) ?? json.html;
4502
+ const plain = miroHtmlToPlainText(rawHtml);
4503
+ const richText = miroHtmlToRichText(editor, rawHtml);
4504
+ const local = readLocalSize(json);
4505
+ const { size: fontSize, scale: fontAdj } = miroTextFontFromJson(style);
4506
+ const aligns = miroTextAlign(style.ta);
4507
+ const color = miroColorToDrawColor(style.tc, "black");
4508
+ const propsScale = Math.max(0.01, scale * fontAdj);
4509
+ const displayW = local.w * scale;
4510
+ const lineCount = estimateMiroTextLineCount(rawHtml, plain);
4511
+ const approxUnscaledLine = fontSize === "s" ? 22 : fontSize === "m" ? 28 : fontSize === "l" ? 36 : 44;
4512
+ const contentH = Math.max(1, approxUnscaledLine * lineCount * propsScale);
4513
+ const topLeft = miroCenterToTopLeft(pos, { w: displayW, h: contentH }, rotation);
4514
+ drawContent.shapes.push({
4515
+ ...base,
4516
+ x: topLeft.x,
4517
+ y: topLeft.y,
4518
+ type: "text",
4519
+ meta: withMiroCenterLocal(base.meta, { w: displayW, h: contentH }),
4520
+ props: {
4521
+ ...editor.getShapeUtil("text").getDefaultProps(),
4522
+ richText,
4523
+ color,
4524
+ size: fontSize,
4525
+ scale: propsScale,
4526
+ font: "sans",
4527
+ textAlign: aligns.textAlign,
4528
+ autoSize: false,
4529
+ // Keep display width = local.w * scale
4530
+ w: Math.max(1, local.w / Math.max(fontAdj, 0.01))
4531
+ }
4532
+ });
4533
+ indexToBounds.set(
4534
+ obj.id,
4535
+ new Box(topLeft.x, topLeft.y, displayW, Math.max(contentH, 20))
4536
+ );
4537
+ created = true;
4538
+ break;
4539
+ }
4540
+ case "shape": {
4541
+ const style = parseMiroStyle(json.style);
4542
+ const local = readLocalSize(json);
4543
+ const display = { w: local.w * scale, h: local.h * scale };
4544
+ const plain = miroHtmlToPlainText(json.text);
4545
+ const richText = miroHtmlToRichText(editor, json.text);
4546
+ const aligns = miroTextAlign(style.ta);
4547
+ const fill = miroFillFromStyle(style);
4548
+ const fillColor = fill === "none" ? miroColorToDrawColor(style.brc ?? style.sc, "black") : miroColorToDrawColor(style.bc, "black");
4549
+ const strokeSize = miroStrokeWidthToSize(style.brw ?? 2);
4550
+ const hasLabel = Boolean(plain.trim());
4551
+ const fsHint = typeof style.fs === "number" && style.fs > 0 ? style.fs : hasLabel && display.h < 56 ? Math.max(10, display.h / Math.max(scale, 0.01) / 2.2) : 14;
4552
+ const fontFromFs = miroFontSizeToSizeAndScale(fsHint * Math.max(scale, 0.01));
4553
+ const geoSize = hasLabel ? fontFromFs.size : strokeSize;
4554
+ const geoScale = Math.max(0.01, scale);
4555
+ const topLeft = miroCenterToTopLeft(pos, display, rotation);
4556
+ drawContent.shapes.push({
4557
+ ...base,
4558
+ x: topLeft.x,
4559
+ y: topLeft.y,
4560
+ type: "geo",
4561
+ meta: withMiroCenterLocal(base.meta, display),
4562
+ props: {
4563
+ ...editor.getShapeUtil("geo").getDefaultProps(),
4564
+ geo: miroShapeToGeo(json.shape),
4565
+ w: display.w,
4566
+ h: display.h,
4567
+ color: fillColor,
4568
+ labelColor: miroColorToDrawColor(style.tc, "black"),
4569
+ fill,
4570
+ dash: miroBorderStyleToDash(style.brs),
4571
+ size: geoSize,
4572
+ font: "sans",
4573
+ align: aligns.align,
4574
+ verticalAlign: miroVerticalAlign(style.tav),
4575
+ richText,
4576
+ scale: geoScale
4577
+ }
4578
+ });
4579
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, display.w, display.h));
4580
+ created = true;
4581
+ break;
4582
+ }
4583
+ case "stencil": {
4584
+ const style = parseMiroStyle(json.style);
4585
+ const local = readLocalSize(json);
4586
+ const display = { w: local.w * scale, h: local.h * scale };
4587
+ const schema = json.schema;
4588
+ const labelHtml = miroStencilText(json) || json.text;
4589
+ const plain = miroHtmlToPlainText(labelHtml);
4590
+ const richText = miroHtmlToRichText(editor, labelHtml);
4591
+ const fontStyle = miroStencilFontStyle(json, style);
4592
+ const aligns = miroTextAlign(fontStyle.ta ?? style.ta);
4593
+ const fill = miroFillFromStyle(style);
4594
+ const fillColor = fill === "none" ? miroColorToDrawColor(style.brc ?? style.sc, "black") : miroColorToDrawColor(style.bc, "black");
4595
+ const fsHint = typeof fontStyle.fs === "number" && fontStyle.fs > 0 ? fontStyle.fs : typeof style.fs === "number" && style.fs > 0 ? style.fs : 14;
4596
+ const fontFromFs = miroFontSizeToSizeAndScale(fsHint * Math.max(scale, 0.01));
4597
+ const topLeft = miroCenterToTopLeft(pos, display, rotation);
4598
+ drawContent.shapes.push({
4599
+ ...base,
4600
+ x: topLeft.x,
4601
+ y: topLeft.y,
4602
+ type: "geo",
4603
+ meta: withMiroCenterLocal(
4604
+ {
4605
+ ...base.meta,
4606
+ miroStencilId: schema?.id ?? null
4607
+ },
4608
+ display
4609
+ ),
4610
+ props: {
4611
+ ...editor.getShapeUtil("geo").getDefaultProps(),
4612
+ geo: miroStencilToGeo(schema?.id),
4613
+ w: display.w,
4614
+ h: display.h,
4615
+ color: fillColor,
4616
+ labelColor: miroColorToDrawColor(fontStyle.tc ?? style.tc, "black"),
4617
+ fill: fill === "none" ? "semi" : fill,
4618
+ dash: miroBorderStyleToDash(style.brs),
4619
+ size: plain.trim() ? fontFromFs.size : miroStrokeWidthToSize(style.brw ?? 2),
4620
+ font: "sans",
4621
+ align: aligns.align,
4622
+ verticalAlign: miroVerticalAlign(fontStyle.tav ?? style.tav),
4623
+ richText,
4624
+ scale: Math.max(0.01, scale)
4625
+ }
4626
+ });
4627
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, display.w, display.h));
4628
+ created = true;
4629
+ break;
4630
+ }
4631
+ case "frame": {
4632
+ const style = parseMiroStyle(json.style);
4633
+ const w = Math.max(1, readNumber(json.width ?? json.size?.width, 400) * scale);
4634
+ const h = Math.max(1, readNumber(json.height ?? json.size?.height, 300) * scale);
4635
+ const name = miroHtmlToPlainText(json.text) || "Frame";
4636
+ const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4637
+ drawContent.shapes.push({
4638
+ ...base,
4639
+ x: topLeft.x,
4640
+ y: topLeft.y,
4641
+ type: "frame",
4642
+ meta: withMiroCenterLocal(base.meta, { w, h }),
4643
+ props: {
4644
+ ...editor.getShapeUtil("frame").getDefaultProps(),
4645
+ w,
4646
+ h,
4647
+ name,
4648
+ color: miroColorToDrawColor(style.sc ?? style.bc, "black")
4649
+ }
4650
+ });
4651
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4652
+ created = true;
4653
+ break;
4654
+ }
4655
+ case "image": {
4656
+ const resource = json.resource ?? {};
4657
+ const crop = json.crop ?? {};
4658
+ const imgW = readNumber(crop.width ?? resource.width, 200);
4659
+ const imgH = readNumber(crop.height ?? resource.height, 150);
4660
+ const w = Math.max(1, imgW * scale);
4661
+ const h = Math.max(1, imgH * scale);
4662
+ const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4663
+ const label = resource.name?.trim() ? `\u{1F5BC} ${resource.name}` : "Image (from Miro)";
4664
+ drawContent.shapes.push({
4665
+ ...base,
4666
+ x: topLeft.x,
4667
+ y: topLeft.y,
4668
+ type: "geo",
4669
+ props: {
4670
+ ...editor.getShapeUtil("geo").getDefaultProps(),
4671
+ geo: "rectangle",
4672
+ w,
4673
+ h,
4674
+ color: "grey",
4675
+ labelColor: "grey",
4676
+ fill: "semi",
4677
+ dash: "dashed",
4678
+ size: "s",
4679
+ font: "sans",
4680
+ align: "middle",
4681
+ verticalAlign: "middle",
4682
+ richText: toRichText(label)
4683
+ },
4684
+ meta: withMiroCenterLocal(
4685
+ {
4686
+ ...base.meta,
4687
+ miroPlaceholder: "image",
4688
+ miroResourceId: json.resource?.id ?? null
4689
+ },
4690
+ { w, h }
4691
+ )
4692
+ });
4693
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4694
+ created = true;
4695
+ break;
4696
+ }
4697
+ case "paint": {
4698
+ const style = parseMiroStyle(json.style);
4699
+ const pointsRaw = json.points ?? [];
4700
+ if (pointsRaw.length < 2) break;
4701
+ const localPoints = pointsRaw.map((p2) => ({
4702
+ x: readNumber(p2.x),
4703
+ y: readNumber(p2.y),
4704
+ z: 0.5
4705
+ }));
4706
+ const minX = Math.min(...localPoints.map((p2) => p2.x));
4707
+ const minY = Math.min(...localPoints.map((p2) => p2.y));
4708
+ const maxX = Math.max(...localPoints.map((p2) => p2.x));
4709
+ const maxY = Math.max(...localPoints.map((p2) => p2.y));
4710
+ const w = Math.max(1, maxX - minX);
4711
+ const h = Math.max(1, maxY - minY);
4712
+ const normalized = localPoints.map((p2) => ({
4713
+ x: p2.x - minX,
4714
+ y: p2.y - minY,
4715
+ z: p2.z
4716
+ }));
4717
+ const topLeft = { x: pos.x + minX, y: pos.y + minY };
4718
+ drawContent.shapes.push({
4719
+ ...base,
4720
+ x: topLeft.x,
4721
+ y: topLeft.y,
4722
+ type: "draw",
4723
+ meta: withMiroCenterLocal(base.meta, { w, h }),
4724
+ props: {
4725
+ ...editor.getShapeUtil("draw").getDefaultProps(),
4726
+ color: miroColorToDrawColor(style.lc, "black"),
4727
+ size: miroStrokeWidthToSize(style.t ?? 2),
4728
+ dash: "draw",
4729
+ fill: "none",
4730
+ segments: [{ type: "free", path: b64Vecs.encodePoints(normalized) }],
4731
+ isComplete: true,
4732
+ isClosed: false,
4733
+ isPen: false,
4734
+ scale: 1
4735
+ }
4736
+ });
4737
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4738
+ created = true;
4739
+ break;
4740
+ }
4741
+ default: {
4742
+ const size = readSize(json, scale);
4743
+ const w = Math.max(80, size.w);
4744
+ const h = Math.max(40, size.h);
4745
+ const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4746
+ const label = miroHtmlToPlainText(json.text) || `[${widgetType}]`;
4747
+ drawContent.shapes.push({
4748
+ ...base,
4749
+ x: topLeft.x,
4750
+ y: topLeft.y,
4751
+ type: "geo",
4752
+ meta: withMiroCenterLocal(base.meta, { w, h }),
4753
+ props: {
4754
+ ...editor.getShapeUtil("geo").getDefaultProps(),
4755
+ geo: "rectangle",
4756
+ w,
4757
+ h,
4758
+ color: "grey",
4759
+ labelColor: "black",
4760
+ fill: "semi",
4761
+ dash: "dashed",
4762
+ size: "s",
4763
+ font: "sans",
4764
+ align: "middle",
4765
+ verticalAlign: "middle",
4766
+ richText: toRichText(label),
4767
+ // Keep label readable inside scaled placeholders
4768
+ scale: Math.max(0.5, scale)
4769
+ }
4770
+ });
4771
+ indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4772
+ created = true;
4773
+ break;
4774
+ }
4775
+ }
4776
+ if (created) {
4777
+ if (parentRef && typeof parentRef.index === "number") {
4778
+ pendingParents.push({
4779
+ childId: shapeId,
4780
+ parentIndex: parentRef.index,
4781
+ isParentLocal: pos.isParentLocal
4782
+ });
4783
+ } else {
4784
+ drawContent.rootShapeIds.push(shapeId);
4785
+ }
4786
+ }
4787
+ }
4788
+ for (const obj of objects) {
4789
+ if (getWidgetType(obj) !== "line") continue;
4790
+ const shapeId = typeof obj.id === "number" ? indexToShapeId.get(obj.id) : createShapeId();
4791
+ pendingLines.push({ obj, shapeId, json: getJson(obj) });
4792
+ }
4793
+ for (const { obj, shapeId, json } of pendingLines) {
4794
+ const style = parseMiroStyle(json.style);
4795
+ const primary = json.primary;
4796
+ const secondary = json.secondary;
4797
+ const midPoints = json.points ?? [];
4798
+ const parentRef = json._parent;
4799
+ let startPage = resolveLineEndpoint(primary, indexToBounds);
4800
+ let endPage = resolveLineEndpoint(secondary, indexToBounds);
4801
+ if (!startPage || !endPage) continue;
4802
+ const parentIndex = parentRef && typeof parentRef.index === "number" ? parentRef.index : null;
4803
+ const parentBounds = parentIndex != null ? indexToBounds.get(parentIndex) : void 0;
4804
+ const preferParentLocal = parentIndex != null && parentBounds != null && parentsWithLocalChildren.has(parentIndex);
4805
+ const adjustFreePoint = (p2, ep) => {
4806
+ const widgetBound = typeof ep?.widgetIndex === "number" && ep.widgetIndex >= 0;
4807
+ if (widgetBound) return p2;
4808
+ if (preferParentLocal && parentBounds && pointInParentLocalBox(p2, parentBounds)) {
4809
+ return p2;
4810
+ }
4811
+ if (shift) {
4812
+ p2 = { x: p2.x - shift.x, y: p2.y - shift.y };
4813
+ }
4814
+ if (preferParentLocal && parentBounds) {
4815
+ return { x: p2.x - parentBounds.x, y: p2.y - parentBounds.y };
4816
+ }
4817
+ return p2;
4818
+ };
4819
+ startPage = adjustFreePoint(startPage, primary);
4820
+ endPage = adjustFreePoint(endPage, secondary);
4821
+ let mids = midPoints.map((p2) => ({ x: readNumber(p2.x), y: readNumber(p2.y) }));
4822
+ mids = mids.map((p2) => adjustFreePoint(p2, void 0));
4823
+ let isParentLocal = false;
4824
+ if (preferParentLocal) {
4825
+ isParentLocal = true;
4826
+ } else if (parentIndex != null && parentBounds) {
4827
+ const hasAbsolutePoint = Boolean(
4828
+ primary?.point && (primary.point.x !== void 0 || primary.point.y !== void 0) && !isNormalizedAnchor(primary.point) || secondary?.point && (secondary.point.x !== void 0 || secondary.point.y !== void 0) && !isNormalizedAnchor(secondary.point)
4829
+ );
4830
+ isParentLocal = !hasAbsolutePoint;
4831
+ if (hasAbsolutePoint) {
4832
+ isParentLocal = [startPage, endPage].every(
4833
+ (p2) => pointInParentLocalBox(p2, parentBounds)
4834
+ );
4835
+ }
4836
+ }
4837
+ const allPts = [startPage, ...mids, endPage];
4838
+ const minX = Math.min(...allPts.map((p2) => p2.x));
4839
+ const minY = Math.min(...allPts.map((p2) => p2.y));
4840
+ const arrowheadStart = miroArrowhead(style.a_start);
4841
+ const arrowheadEnd = miroArrowhead(style.a_end);
4842
+ const isArrow = arrowheadStart !== "none" || arrowheadEnd !== "none";
4843
+ const color = miroColorToDrawColor(style.lc, "black");
4844
+ const size = miroStrokeWidthToSize(style.t ?? 2);
4845
+ const dash = miroLineStyleToDash(style);
4846
+ const base = {
4847
+ id: shapeId,
4848
+ typeName: "shape",
4849
+ parentId: currentPageId,
4850
+ index: takeZ(obj),
4851
+ x: minX,
4852
+ y: minY,
4853
+ rotation: 0,
4854
+ isLocked: false,
4855
+ opacity: 1,
4856
+ meta: {
4857
+ miroInitialId: obj.initialId ?? null,
4858
+ miroWidgetType: "line"
4859
+ }
4860
+ };
4861
+ if (mids.length > 0) {
4862
+ const pts = allPts.map((p2) => ({ x: p2.x - minX, y: p2.y - minY }));
4863
+ const indices = getIndices(pts.length);
4864
+ drawContent.shapes.push({
4865
+ ...base,
4866
+ type: "line",
4867
+ props: {
4868
+ ...editor.getShapeUtil("line").getDefaultProps(),
4869
+ color,
4870
+ size,
4871
+ dash,
4872
+ spline: "line",
4873
+ scale: 1,
4874
+ points: Object.fromEntries(
4875
+ pts.map((p2, i) => {
4876
+ const idx = indices[i];
4877
+ return [idx, { id: idx, index: idx, x: p2.x, y: p2.y }];
4878
+ })
4879
+ )
4880
+ }
4881
+ });
4882
+ } else if (isArrow) {
4883
+ drawContent.shapes.push({
4884
+ ...base,
4885
+ type: "arrow",
4886
+ props: {
4887
+ ...editor.getShapeUtil("arrow").getDefaultProps(),
4888
+ kind: "elbow",
4889
+ start: { x: startPage.x - minX, y: startPage.y - minY },
4890
+ end: { x: endPage.x - minX, y: endPage.y - minY },
4891
+ bend: 0,
4892
+ color,
4893
+ size,
4894
+ dash,
4895
+ arrowheadStart,
4896
+ arrowheadEnd,
4897
+ richText: toRichText(""),
4898
+ scale: 1
4899
+ }
4900
+ });
4901
+ const startTarget = typeof primary?.widgetIndex === "number" && primary.widgetIndex >= 0 ? indexToShapeId.get(primary.widgetIndex) : void 0;
4902
+ const endTarget = typeof secondary?.widgetIndex === "number" && secondary.widgetIndex >= 0 ? indexToShapeId.get(secondary.widgetIndex) : void 0;
4903
+ if (startTarget) {
4904
+ const anchor = isNormalizedAnchor(primary?.point) ? { x: readNumber(primary.point.x), y: readNumber(primary.point.y) } : { x: 0.5, y: 0.5 };
4905
+ drawContent.bindings.push({
4906
+ id: createBindingId(),
4907
+ typeName: "binding",
4908
+ type: "arrow",
4909
+ fromId: shapeId,
4910
+ toId: startTarget,
4911
+ props: {
4912
+ terminal: "start",
4913
+ snap: "none",
4914
+ normalizedAnchor: anchor,
4915
+ isPrecise: false,
4916
+ isExact: false
4917
+ },
4918
+ meta: {}
4919
+ });
4920
+ }
4921
+ if (endTarget) {
4922
+ const anchor = isNormalizedAnchor(secondary?.point) ? { x: readNumber(secondary.point.x), y: readNumber(secondary.point.y) } : { x: 0.5, y: 0.5 };
4923
+ drawContent.bindings.push({
4924
+ id: createBindingId(),
4925
+ typeName: "binding",
4926
+ type: "arrow",
4927
+ fromId: shapeId,
4928
+ toId: endTarget,
4929
+ props: {
4930
+ terminal: "end",
4931
+ snap: "none",
4932
+ normalizedAnchor: anchor,
4933
+ isPrecise: false,
4934
+ isExact: false
4935
+ },
4936
+ meta: {}
4937
+ });
4938
+ }
4939
+ } else {
4940
+ const pts = allPts.map((p2) => ({ x: p2.x - minX, y: p2.y - minY }));
4941
+ const indices = getIndices(pts.length);
4942
+ drawContent.shapes.push({
4943
+ ...base,
4944
+ type: "line",
4945
+ props: {
4946
+ ...editor.getShapeUtil("line").getDefaultProps(),
4947
+ color,
4948
+ size,
4949
+ dash,
4950
+ spline: "line",
4951
+ scale: 1,
4952
+ points: Object.fromEntries(
4953
+ pts.map((p2, i) => {
4954
+ const idx = indices[i];
4955
+ return [idx, { id: idx, index: idx, x: p2.x, y: p2.y }];
4956
+ })
4957
+ )
4958
+ }
4959
+ });
4960
+ }
4961
+ indexToBounds.set(
4962
+ obj.id,
4963
+ new Box(
4964
+ minX,
4965
+ minY,
4966
+ Math.max(1, Math.abs(endPage.x - startPage.x)),
4967
+ Math.max(1, Math.abs(endPage.y - startPage.y))
4968
+ )
4969
+ );
4970
+ if (parentIndex != null) {
4971
+ pendingParents.push({
4972
+ childId: shapeId,
4973
+ parentIndex,
4974
+ isParentLocal
4975
+ });
4976
+ } else {
4977
+ drawContent.rootShapeIds.push(shapeId);
4978
+ }
4979
+ }
4980
+ const shapeById = new Map(drawContent.shapes.map((s) => [s.id, s]));
4981
+ for (const { childId, parentIndex, isParentLocal } of pendingParents) {
4982
+ const parentId = indexToShapeId.get(parentIndex);
4983
+ const parentBounds = indexToBounds.get(parentIndex);
4984
+ const child = shapeById.get(childId);
4985
+ if (!parentId || !parentBounds || !child) continue;
4986
+ child.parentId = parentId;
4987
+ if (!isParentLocal) {
4988
+ child.x = (child.x ?? 0) - parentBounds.x;
4989
+ child.y = (child.y ?? 0) - parentBounds.y;
4990
+ }
4991
+ drawContent.rootShapeIds = drawContent.rootShapeIds.filter((id) => id !== childId);
4992
+ }
4993
+ for (const obj of objects) {
4994
+ if (obj.type !== 10) continue;
4995
+ const items = obj.items ?? [];
4996
+ const memberIds = items.map((i) => indexToShapeId.get(i)).filter((id) => Boolean(id));
4997
+ if (memberIds.length < 2) continue;
4998
+ groupMemberIds.set(obj.id, memberIds);
4999
+ }
5000
+ if (!drawContent.shapes.length) return null;
5001
+ const parented = new Set(
5002
+ drawContent.shapes.filter((s) => s.parentId !== currentPageId).map((s) => s.id)
5003
+ );
5004
+ for (const s of drawContent.shapes) {
5005
+ if (!parented.has(s.id) && !drawContent.rootShapeIds.includes(s.id)) {
5006
+ drawContent.rootShapeIds.push(s.id);
5007
+ }
5008
+ }
5009
+ drawContent.shapes.sort((a, b) => {
5010
+ if (a.index < b.index) return -1;
5011
+ if (a.index > b.index) return 1;
5012
+ return 0;
5013
+ });
5014
+ const p = point ?? (editor.inputs.getShiftKey() ? editor.inputs.getCurrentPagePoint() : void 0);
5015
+ editor.putContentOntoCurrentPage(drawContent, {
5016
+ point: p,
5017
+ select: false,
5018
+ preserveIds: true
5019
+ });
5020
+ const stickyFixes = [];
5021
+ for (const draft of drawContent.shapes) {
5022
+ if (draft.type !== "note") continue;
5023
+ const growY = draft.meta?.miroNoteGrowY;
5024
+ if (typeof growY !== "number") continue;
5025
+ const live = editor.getShape(draft.id);
5026
+ if (!live || live.type !== "note") continue;
5027
+ const draftAlign = draft.props.verticalAlign ?? "middle";
5028
+ const liveAdj = live.props.fontSizeAdjustment ?? 0.9;
5029
+ const autoGrowY = live.props.growY ?? 0;
5030
+ let fontSizeAdjustment = Math.min(liveAdj, 0.9);
5031
+ if (autoGrowY > growY + 1) {
5032
+ const ratio = (200 + growY) / (200 + autoGrowY);
5033
+ fontSizeAdjustment = Math.max(0.35, fontSizeAdjustment * ratio);
5034
+ }
5035
+ stickyFixes.push({
5036
+ id: draft.id,
5037
+ type: "note",
5038
+ props: {
5039
+ growY,
5040
+ verticalAlign: draftAlign,
5041
+ fontSizeAdjustment
5042
+ }
5043
+ });
5044
+ }
5045
+ if (stickyFixes.length) {
5046
+ editor.updateShapes(stickyFixes);
5047
+ }
5048
+ alignShapesToMiroCenters(editor, drawContent.shapes);
5049
+ const previousTool = editor.getCurrentToolId();
5050
+ if (groupMemberIds.size > 0 && previousTool !== "select") {
5051
+ editor.setCurrentTool("select");
5052
+ }
5053
+ for (const memberIds of groupMemberIds.values()) {
5054
+ const existing = memberIds.filter((id) => editor.getShape(id));
5055
+ if (existing.length > 1) {
5056
+ editor.groupShapes(existing, { select: false });
5057
+ }
5058
+ }
5059
+ if (previousTool !== "select" && previousTool) {
5060
+ editor.setCurrentTool(previousTool);
5061
+ }
5062
+ const createdIds = drawContent.shapes.map((s) => s.id).filter((id) => editor.getShape(id));
5063
+ if (createdIds.length) {
5064
+ editor.select(...createdIds);
5065
+ editor.setCurrentTool("select");
5066
+ }
5067
+ const widgetTypes = Array.from(
5068
+ new Set(
5069
+ drawContent.shapes.map((s) => s.meta?.miroWidgetType).filter((t2) => typeof t2 === "string" && t2.length > 0)
5070
+ )
5071
+ );
5072
+ return {
5073
+ shapeCount: createdIds.length,
5074
+ shapeIds: createdIds,
5075
+ widgetTypes,
5076
+ miroBoardId: miroClipboardContent.boardId ?? null,
5077
+ miroHost: miroClipboardContent.host ?? null
5078
+ };
5079
+ }
5080
+ function resolveLineEndpoint(endpoint, bounds) {
5081
+ if (!endpoint) return null;
5082
+ const widgetIndex = endpoint.widgetIndex;
5083
+ if (typeof widgetIndex === "number" && widgetIndex >= 0) {
5084
+ const box = bounds.get(widgetIndex);
5085
+ if (box) {
5086
+ if (isNormalizedAnchor(endpoint.point)) {
5087
+ return {
5088
+ x: box.x + readNumber(endpoint.point.x) * box.w,
5089
+ y: box.y + readNumber(endpoint.point.y) * box.h
5090
+ };
5091
+ }
5092
+ return box.center;
5093
+ }
5094
+ }
5095
+ if (endpoint.point && (endpoint.point.x !== void 0 || endpoint.point.y !== void 0)) {
5096
+ return { x: readNumber(endpoint.point.x), y: readNumber(endpoint.point.y) };
5097
+ }
5098
+ return null;
5099
+ }
5100
+
3962
5101
  // src/lib/shapes/shared/TextHelpers.ts
3963
5102
  var INDENT = " ";
3964
5103
  var TextHelpers = class _TextHelpers {
@@ -4057,6 +5196,9 @@ function registerDefaultExternalContentHandlers(editor, options) {
4057
5196
  editor.registerExternalContentHandler("excalidraw", async (externalContent) => {
4058
5197
  return defaultHandleExternalExcalidrawContent(editor, externalContent);
4059
5198
  });
5199
+ editor.registerExternalContentHandler("miro", async (externalContent) => {
5200
+ return defaultHandleExternalMiroContent(editor, externalContent);
5201
+ });
4060
5202
  }
4061
5203
  async function defaultHandleExternalFileAsset(editor, { file, assetId }, options) {
4062
5204
  const isSuccess = notifyIfFileNotAllowed(editor, file, options);
@@ -4396,6 +5538,13 @@ async function defaultHandleExternalExcalidrawContent(editor, { point, content }
4396
5538
  putExcalidrawContent(editor, content, point);
4397
5539
  });
4398
5540
  }
5541
+ async function defaultHandleExternalMiroContent(editor, { point, content }) {
5542
+ const info = await putMiroContent(editor, content, point);
5543
+ if (info) {
5544
+ editor.emit("paste-miro", info);
5545
+ }
5546
+ return info;
5547
+ }
4399
5548
  async function createShapesForAssets(editor, assets, position) {
4400
5549
  if (!assets.length) return [];
4401
5550
  const currentPoint = Vec.From(position);
@@ -6728,6 +7877,52 @@ function getLocalFiles(options) {
6728
7877
  input?.click();
6729
7878
  });
6730
7879
  }
7880
+
7881
+ // src/features/clipboard/miro/decodeMiroData.ts
7882
+ var MIRO_DATA_RE = /\(miro-data-v(\d+)\)([\s\S]*?)\(\/miro-data-v\1\)/;
7883
+ var DEFAULT_OFFSET = 59;
7884
+ function extractMiroDataPayload(htmlOrMeta) {
7885
+ const match = htmlOrMeta.match(MIRO_DATA_RE);
7886
+ if (!match) return null;
7887
+ return { version: Number(match[1]), payload: match[2] };
7888
+ }
7889
+ function decodeMiroDataBytes(base64Payload, encodingOffset = DEFAULT_OFFSET) {
7890
+ const binary = atob(base64Payload);
7891
+ const out = new Uint8Array(binary.length);
7892
+ for (let i = 0; i < binary.length; i++) {
7893
+ const code = binary.charCodeAt(i);
7894
+ out[i] = (code - encodingOffset + 256) % 256;
7895
+ }
7896
+ return out;
7897
+ }
7898
+ function decodeMiroClipboardHtml(htmlOrMeta, encodingOffset = DEFAULT_OFFSET) {
7899
+ const extracted = extractMiroDataPayload(htmlOrMeta);
7900
+ if (!extracted) return null;
7901
+ try {
7902
+ const bytes = decodeMiroDataBytes(extracted.payload.trim(), encodingOffset);
7903
+ const json = new TextDecoder().decode(bytes);
7904
+ return JSON.parse(json);
7905
+ } catch {
7906
+ return null;
7907
+ }
7908
+ }
7909
+ function summarizeMiroClipboard(root) {
7910
+ const objects = root.data?.objects ?? [];
7911
+ const widgetTypes = objects.map((o) => {
7912
+ if (o.type === 10) return "group";
7913
+ return o.widgetData?.type ?? `objectType:${o.type ?? "?"}`;
7914
+ });
7915
+ return {
7916
+ boardId: root.boardId ?? null,
7917
+ host: root.host ?? null,
7918
+ version: root.version ?? null,
7919
+ isProtected: root.isProtected ?? null,
7920
+ objectCount: objects.length,
7921
+ widgetTypes,
7922
+ hasShift: Boolean(root.data?.shift),
7923
+ shift: root.data?.shift ?? null
7924
+ };
7925
+ }
6731
7926
  var DRAW_CUSTOM_PNG_MIME_TYPE = "web image/vnd.draw+png";
6732
7927
  var additionalClipboardWriteTypes = {
6733
7928
  png: DRAW_CUSTOM_PNG_MIME_TYPE
@@ -7093,6 +8288,13 @@ async function handleClipboardThings(editor, things, point, clipboardPasteSource
7093
8288
  return;
7094
8289
  }
7095
8290
  } else {
8291
+ if (thing.type === "html" || text.includes("miro-data-v")) {
8292
+ const miro = decodeMiroClipboardHtml(text);
8293
+ if (miro) {
8294
+ r({ type: "miro", data: miro });
8295
+ return;
8296
+ }
8297
+ }
7096
8298
  if (thing.type === "html") {
7097
8299
  r({ type: "text", data: text, subtype: "html" });
7098
8300
  return;
@@ -7142,8 +8344,29 @@ async function handleClipboardThings(editor, things, point, clipboardPasteSource
7142
8344
  return;
7143
8345
  }
7144
8346
  }
8347
+ for (const result of results) {
8348
+ if (result.type === "miro") {
8349
+ editor.markHistoryStoppingPoint("paste");
8350
+ putPastedExternalContent(
8351
+ editor,
8352
+ { type: "miro", content: result.data, point },
8353
+ { source: clipboardPasteSource, point }
8354
+ );
8355
+ return;
8356
+ }
8357
+ }
7145
8358
  for (const result of results) {
7146
8359
  if (result.type === "text" && result.subtype === "html") {
8360
+ const miro = decodeMiroClipboardHtml(result.data);
8361
+ if (miro) {
8362
+ editor.markHistoryStoppingPoint("paste");
8363
+ putPastedExternalContent(
8364
+ editor,
8365
+ { type: "miro", content: miro, point },
8366
+ { source: clipboardPasteSource, point }
8367
+ );
8368
+ return;
8369
+ }
7147
8370
  const rootNode = new DOMParser().parseFromString(result.data, "text/html");
7148
8371
  const bodyNode = rootNode.querySelector("body");
7149
8372
  const iframeInfo = extractIframeFromHtml(result.data);
@@ -12188,6 +13411,7 @@ function getPillPoints(width, height, numPoints) {
12188
13411
  return points;
12189
13412
  }
12190
13413
  var SIZES = {
13414
+ xs: 40,
12191
13415
  s: 50,
12192
13416
  m: 70,
12193
13417
  l: 100,
@@ -12329,6 +13553,7 @@ var STYLES = {
12329
13553
  { value: "solid", icon: "dash-solid" }
12330
13554
  ],
12331
13555
  size: [
13556
+ { value: "xs", icon: "size-small" },
12332
13557
  { value: "s", icon: "size-small" },
12333
13558
  { value: "m", icon: "size-medium" },
12334
13559
  { value: "l", icon: "size-large" },
@@ -25290,12 +26515,14 @@ var ArrowShapeUtil = class extends ShapeUtil {
25290
26515
  static migrations = arrowShapeMigrations;
25291
26516
  options = {
25292
26517
  expandElbowLegLength: {
26518
+ xs: 22,
25293
26519
  s: 28,
25294
26520
  m: 36,
25295
26521
  l: 44,
25296
26522
  xl: 66
25297
26523
  },
25298
26524
  minElbowLegLength: {
26525
+ xs: 4,
25299
26526
  s: 6,
25300
26527
  m: 10.5,
25301
26528
  l: 15,
@@ -27721,6 +28948,7 @@ function GeoShapeBody({
27721
28948
  ] });
27722
28949
  }
27723
28950
  var GEO_SHAPE_MIN_WIDTHS = Object.freeze({
28951
+ xs: 10,
27724
28952
  s: 12,
27725
28953
  m: 14,
27726
28954
  l: 16,
@@ -37243,7 +38471,7 @@ async function extractAssets(editor, snapshot, msg, addToast) {
37243
38471
  // src/index.ts
37244
38472
  registerDrawLibraryVersion(
37245
38473
  "@ibodr/draw",
37246
- "0.2.1",
38474
+ "0.2.3",
37247
38475
  "esm"
37248
38476
  );
37249
38477
  /*!
@@ -37267,6 +38495,6 @@ registerDrawLibraryVersion(
37267
38495
  * Source: https://github.com/jaywcjlove/hotkeys-js
37268
38496
  */
37269
38497
 
37270
- export { ASPECT_RATIO_OPTIONS, ASPECT_RATIO_TO_VALUE, AccessibilityMenu, AlignMenuItems, ArrangeMenuSubmenu, ArrowBindingHintOverlayUtil, ArrowBindingUtil, ArrowDownToolbarItem, ArrowHintOverlayUtil, ArrowLeftToolbarItem, ArrowRightToolbarItem, ArrowShapeTool, ArrowShapeUtil, ArrowToolbarItem, ArrowUpToolbarItem, AssetToolbarItem, AssetUrlsProvider, BookmarkAssetUtil, BookmarkShapeUtil, BreakPointProvider, BrushOverlayUtil, CenteredTopPanelContainer, CheckBoxToolbarItem, ClipboardMenuGroup, CloudToolbarItem, CollaboratorBrushOverlayUtil, CollaboratorCursorBadge, CollaboratorCursorOverlayUtil, CollaboratorCursorPointer, CollaboratorCursors, CollaboratorHintOverlayUtil, CollaboratorScribbleOverlayUtil, CollaboratorShapeIndicatorOverlayUtil, ColorSchemeMenu, DefaultContextMenu as ContextMenu, ConversionsMenuGroup, ConvertToBookmarkMenuItem, ConvertToEmbedMenuItem, CopyAsMenuGroup, CopyMenuItem, CursorChatItem, CutMenuItem, DEFAULT_COLLABORATOR_CURSOR_LAYOUT, DEFAULT_EMBED_DEFINITIONS, DEFAULT_MAX_ASSET_SIZE, DEFAULT_MAX_IMAGE_DIMENSION, DRAW_FILE_EXTENSION, DebugFlags, DefaultA11yAnnouncer, DefaultActionsMenu, DefaultActionsMenuContent, DefaultCollaboratorCursor, DefaultContextMenu, DefaultContextMenuContent, DefaultDebugMenu, DefaultDebugMenuContent, DefaultDialogs, DefaultFollowingIndicator, DefaultFontFaces, DefaultHelpMenu, DefaultHelpMenuContent, DefaultHelperButtons, DefaultHelperButtonsContent, DefaultImageToolbar, DefaultImageToolbarContent, DefaultKeyboardShortcutsDialog, DefaultKeyboardShortcutsDialogContent, DefaultMainMenu, DefaultMainMenuContent, DefaultMenuPanel, DefaultMinimap, DefaultNavigationPanel, DefaultPageMenu, DefaultPeopleMenu, DefaultPeopleMenuAvatar, DefaultPeopleMenuContent, DefaultPeopleMenuFacePile, DefaultPeopleMenuItem, DefaultQuickActions, DefaultQuickActionsContent, DefaultRichTextToolbar, DefaultRichTextToolbarContent, DefaultSharePanel, DefaultStylePanel, DefaultStylePanelContent, DefaultToasts, DefaultToolbar, DefaultToolbarContent, DefaultUserPresenceEditor, DefaultVideoToolbar, DefaultVideoToolbarContent, DefaultZoomMenu, DefaultZoomMenuContent, DeleteMenuItem, DiamondToolbarItem, DistributeMenuItems, DrV1AlignStyle, DrV1AssetType, DrV1ColorStyle, DrV1DashStyle, DrV1Decoration, DrV1FontStyle, DrV1ShapeType, DrV1SizeStyle, Draw, DrawImage, DrawShapeTool, DrawShapeUtil, DrawToolbarItem, DrawUi, DrawUiA11yProvider, DrawUiButton, DrawUiButtonCheck, DrawUiButtonIcon, DrawUiButtonLabel, DrawUiColumn, DrawUiComponentsProvider, DrawUiContextProvider, DrawUiContextualToolbar, DrawUiDialogBody, DrawUiDialogCloseButton, DrawUiDialogFooter, DrawUiDialogHeader, DrawUiDialogTitle, DrawUiDialogsProvider, DrawUiDropdownMenuCheckboxItem, DrawUiDropdownMenuContent, DrawUiDropdownMenuGroup, DrawUiDropdownMenuIndicator, DrawUiDropdownMenuItem, DrawUiDropdownMenuRoot, DrawUiDropdownMenuSub, DrawUiDropdownMenuSubContent, DrawUiDropdownMenuSubTrigger, DrawUiDropdownMenuTrigger, DrawUiEventsProvider, DrawUiGrid, DrawUiIcon, DrawUiInFrontOfTheCanvas, DrawUiInput, DrawUiKbd, DrawUiMenuActionCheckboxItem, DrawUiMenuActionItem, DrawUiMenuCheckboxItem, DrawUiMenuContextProvider, DrawUiMenuGroup, DrawUiMenuItem, DrawUiMenuSubmenu, DrawUiMenuToolItem, DrawUiOrientationProvider, DrawUiPopover, DrawUiPopoverContent, DrawUiPopoverTrigger, DrawUiRow, DrawUiSelect, DrawUiSelectContent, DrawUiSelectItem, DrawUiSelectTrigger, DrawUiSelectValue, DrawUiSlider, DrawUiToastsProvider, DrawUiToolbar, DrawUiToolbarButton, DrawUiToolbarToggleGroup, DrawUiToolbarToggleItem, DrawUiTooltip, DrawUiTooltipProvider, DrawUiTranslationProvider, DuplicateMenuItem, EditLinkMenuItem2 as EditLinkMenuItem, EditMenuSubmenu, EditSubmenu, EllipseToolbarItem, EmbedShapeUtil, EraserTool, EraserToolbarItem, ExampleDialog, ExportFileContentSubMenu, ExtrasGroup, FeatureFlags, FitFrameToContentMenuItem, FrameShapeTool, FrameShapeUtil, FrameToolbarItem, GeoShapeTool, GeoShapeUtil, GroupMenuItem2 as GroupMenuItem, GroupOrUngroupMenuItem, HandTool, HandToolbarItem, HeartToolbarItem, HexagonToolbarItem, HighlightShapeTool, HighlightShapeUtil, HighlightToolbarItem, ImageAssetUtil, ImageShapeUtil, InputModeMenu, KeyboardShiftEnterTweakExtension, KeyboardShortcutsMenuItem, LanguageMenu, LaserTool, LaserToolbarItem, LineShapeTool, LineShapeUtil, LineToolbarItem, LockGroup, MiscMenuGroup, MobileStylePanel, MoveToPageMenu, NoteShapeTool, NoteShapeUtil, NoteToolbarItem, OfflineIndicator, OvalToolbarItem, OverflowingToolbar, PORTRAIT_BREAKPOINT, PageItemInput, PageItemSubmenu, PasteMenuItem, PathBuilder, PathBuilderGeometry2d, DefaultPeopleMenu as PeopleMenu, PlainTextArea, PlainTextLabel, PreferencesGroup, PrintItem, RTL_LANGUAGES, RectangleToolbarItem, RemoveFrameMenuItem, ReorderMenuItems, ReorderMenuSubmenu, RhombusToolbarItem, RichTextArea, RichTextLabel, RichTextSVG, RotateCWMenuItem, STROKE_SIZES, ScribbleOverlayUtil, SelectAllMenuItem, SelectTool, SelectToolbarItem, SelectionForegroundOverlayUtil, ShapeHandleOverlayUtil, SnapIndicatorOverlayUtil, Spinner, StackMenuItems, StarToolbarItem, StylePanelArrowKindPicker, StylePanelArrowheadPicker, StylePanelButtonPicker, StylePanelButtonPickerInline, StylePanelColorPicker, StylePanelContextProvider, StylePanelDashPicker, StylePanelDoubleDropdownPicker, StylePanelDoubleDropdownPickerInline, StylePanelDropdownPicker, StylePanelDropdownPickerInline, StylePanelFillPicker, StylePanelFontPicker, StylePanelGeoShapePicker, StylePanelLabelAlignPicker, StylePanelOpacityPicker, StylePanelSection, StylePanelSizePicker, StylePanelSplinePicker, StylePanelSubheading, StylePanelTextAlignPicker, TextShapeTool, TextShapeUtil, TextToolbarItem, ToggleAutoSizeMenuItem, ToggleDebugModeItem, ToggleDynamicSizeModeItem, ToggleEdgeScrollingItem, ToggleEnhancedA11yModeItem, ToggleFocusModeItem, ToggleGridItem, ToggleInvertZoomItem, ToggleKeyboardShortcutsItem, ToggleLockMenuItem, TogglePasteAtCursorItem, ToggleReduceMotionItem, ToggleSnapModeItem, ToggleToolLockItem, ToggleToolLockedButton, ToggleTransparentBgMenuItem, ToggleWrapModeItem, ToolbarItem, TrapezoidToolbarItem, TriangleToolbarItem, UndoRedoGroup, UngroupMenuItem2 as UngroupMenuItem, UnlockAllMenuItem, VideoAssetUtil, VideoShapeUtil, ViewSubmenu, XBoxToolbarItem, ZoomBrushOverlayUtil, ZoomOrRotateMenuItem, ZoomTo100MenuItem, ZoomToFitMenuItem, ZoomToSelectionMenuItem, ZoomTool, allDefaultFontFaces, buildFromV1Document, centerSelectionAroundPoint, clearArrowTargetState, containBoxSize, copyAs, createBookmarkFromUrl, createEmptyBookmarkShape, createShapesForAssets, defaultAddFontsFromNode, defaultAssetUtils, defaultBindingUtils, defaultEditorAssetUrls, defaultGeoTypeDefinitions, defaultHandleExternalDrawContent, defaultHandleExternalEmbedContent, defaultHandleExternalExcalidrawContent, defaultHandleExternalFileAsset, defaultHandleExternalFileContent, defaultHandleExternalFileReplaceContent, defaultHandleExternalSvgTextContent, defaultHandleExternalTextContent, defaultHandleExternalUrlAsset, defaultHandleExternalUrlContent, defaultOverlayUtils, defaultShapeTools, defaultShapeUtils, defaultTools, downloadFile, downsizeImage, embedShapePermissionDefaults, exportAs, fitFrameToContent, getArrowBindings, getArrowInfo, getArrowTargetState, getArrowTerminalsInArrowSpace, getAssetInfo, getCollaboratorCursorScale, getColorStyleItems, getCropBox, getDefaultCrop, getDisplayValues, getEmbedInfo, getFontFamily, getFontStyleItems, getGeoTypeDefinition, getHitShapeOnCanvasPointerDown, getPointsFromDrawSegment, getPointsFromDrawSegments, getStroke, getStrokeOutlinePoints, getStrokePoints, getSvgPathFromStrokePoints, getUncroppedSize, handleNativeOrMenuCopy, hideAllTooltips, iconTypes, mergeCollaboratorCursorLayout, notifyIfFileNotAllowed, onDragFromToolbarToCreateShape, parseAndLoadDocument, parseDrawJsonFile, preloadFont, putExcalidrawContent, registerDefaultExternalContentHandlers, registerDefaultSideEffects, removeFrame, renderHtmlFromRichText, renderHtmlFromRichTextForMeasurement, renderPlaintextFromRichText, renderRichTextFromHTML, sanitizeSvg, serializeDrawJson, serializeDrawJsonBlob, setDefaultEditorAssetUrls, setDefaultUiAssetUrls, setStrokePointRadii, startEditingShapeWithRichText, tipTapDefaultExtensions, truncateStringWithEllipsis, unknownEmbedShapePermissionOverrides, unwrapLabel, updateArrowTargetState, useA11y, useActions, useAssetUrls, useBreakpoint, useCanApplySelectionAction, useCanRedo, useCanUndo, useCollaborationStatus, useCopyAs, useCurrentTranslation, useDefaultHelpers, useDialogs, useDirection, useDrawUiComponents, useDrawUiOrientation, useEditablePlainText, useEditableRichText, useExportAs, useImageOrVideoAsset, useIsToolSelected, useKeyboardShortcuts, useLocalStorageState, useMenuClipboardEvents, useMenuIsOpen, useNativeClipboardEvents, usePrefersReducedMotion, useReadonly, useRelevantStyles, useSelectedShapesAnnouncer, useShowCollaborationUi, useStylePanelContext, useToasts, useTools, useTranslation, useUiEvents, useUnlockedSelectedShapesCount };
38498
+ export { ASPECT_RATIO_OPTIONS, ASPECT_RATIO_TO_VALUE, AccessibilityMenu, AlignMenuItems, ArrangeMenuSubmenu, ArrowBindingHintOverlayUtil, ArrowBindingUtil, ArrowDownToolbarItem, ArrowHintOverlayUtil, ArrowLeftToolbarItem, ArrowRightToolbarItem, ArrowShapeTool, ArrowShapeUtil, ArrowToolbarItem, ArrowUpToolbarItem, AssetToolbarItem, AssetUrlsProvider, BookmarkAssetUtil, BookmarkShapeUtil, BreakPointProvider, BrushOverlayUtil, CenteredTopPanelContainer, CheckBoxToolbarItem, ClipboardMenuGroup, CloudToolbarItem, CollaboratorBrushOverlayUtil, CollaboratorCursorBadge, CollaboratorCursorOverlayUtil, CollaboratorCursorPointer, CollaboratorCursors, CollaboratorHintOverlayUtil, CollaboratorScribbleOverlayUtil, CollaboratorShapeIndicatorOverlayUtil, ColorSchemeMenu, DefaultContextMenu as ContextMenu, ConversionsMenuGroup, ConvertToBookmarkMenuItem, ConvertToEmbedMenuItem, CopyAsMenuGroup, CopyMenuItem, CursorChatItem, CutMenuItem, DEFAULT_COLLABORATOR_CURSOR_LAYOUT, DEFAULT_EMBED_DEFINITIONS, DEFAULT_MAX_ASSET_SIZE, DEFAULT_MAX_IMAGE_DIMENSION, DRAW_FILE_EXTENSION, DebugFlags, DefaultA11yAnnouncer, DefaultActionsMenu, DefaultActionsMenuContent, DefaultCollaboratorCursor, DefaultContextMenu, DefaultContextMenuContent, DefaultDebugMenu, DefaultDebugMenuContent, DefaultDialogs, DefaultFollowingIndicator, DefaultFontFaces, DefaultHelpMenu, DefaultHelpMenuContent, DefaultHelperButtons, DefaultHelperButtonsContent, DefaultImageToolbar, DefaultImageToolbarContent, DefaultKeyboardShortcutsDialog, DefaultKeyboardShortcutsDialogContent, DefaultMainMenu, DefaultMainMenuContent, DefaultMenuPanel, DefaultMinimap, DefaultNavigationPanel, DefaultPageMenu, DefaultPeopleMenu, DefaultPeopleMenuAvatar, DefaultPeopleMenuContent, DefaultPeopleMenuFacePile, DefaultPeopleMenuItem, DefaultQuickActions, DefaultQuickActionsContent, DefaultRichTextToolbar, DefaultRichTextToolbarContent, DefaultSharePanel, DefaultStylePanel, DefaultStylePanelContent, DefaultToasts, DefaultToolbar, DefaultToolbarContent, DefaultUserPresenceEditor, DefaultVideoToolbar, DefaultVideoToolbarContent, DefaultZoomMenu, DefaultZoomMenuContent, DeleteMenuItem, DiamondToolbarItem, DistributeMenuItems, DrV1AlignStyle, DrV1AssetType, DrV1ColorStyle, DrV1DashStyle, DrV1Decoration, DrV1FontStyle, DrV1ShapeType, DrV1SizeStyle, Draw, DrawImage, DrawShapeTool, DrawShapeUtil, DrawToolbarItem, DrawUi, DrawUiA11yProvider, DrawUiButton, DrawUiButtonCheck, DrawUiButtonIcon, DrawUiButtonLabel, DrawUiColumn, DrawUiComponentsProvider, DrawUiContextProvider, DrawUiContextualToolbar, DrawUiDialogBody, DrawUiDialogCloseButton, DrawUiDialogFooter, DrawUiDialogHeader, DrawUiDialogTitle, DrawUiDialogsProvider, DrawUiDropdownMenuCheckboxItem, DrawUiDropdownMenuContent, DrawUiDropdownMenuGroup, DrawUiDropdownMenuIndicator, DrawUiDropdownMenuItem, DrawUiDropdownMenuRoot, DrawUiDropdownMenuSub, DrawUiDropdownMenuSubContent, DrawUiDropdownMenuSubTrigger, DrawUiDropdownMenuTrigger, DrawUiEventsProvider, DrawUiGrid, DrawUiIcon, DrawUiInFrontOfTheCanvas, DrawUiInput, DrawUiKbd, DrawUiMenuActionCheckboxItem, DrawUiMenuActionItem, DrawUiMenuCheckboxItem, DrawUiMenuContextProvider, DrawUiMenuGroup, DrawUiMenuItem, DrawUiMenuSubmenu, DrawUiMenuToolItem, DrawUiOrientationProvider, DrawUiPopover, DrawUiPopoverContent, DrawUiPopoverTrigger, DrawUiRow, DrawUiSelect, DrawUiSelectContent, DrawUiSelectItem, DrawUiSelectTrigger, DrawUiSelectValue, DrawUiSlider, DrawUiToastsProvider, DrawUiToolbar, DrawUiToolbarButton, DrawUiToolbarToggleGroup, DrawUiToolbarToggleItem, DrawUiTooltip, DrawUiTooltipProvider, DrawUiTranslationProvider, DuplicateMenuItem, EditLinkMenuItem2 as EditLinkMenuItem, EditMenuSubmenu, EditSubmenu, EllipseToolbarItem, EmbedShapeUtil, EraserTool, EraserToolbarItem, ExampleDialog, ExportFileContentSubMenu, ExtrasGroup, FeatureFlags, FitFrameToContentMenuItem, FrameShapeTool, FrameShapeUtil, FrameToolbarItem, GeoShapeTool, GeoShapeUtil, GroupMenuItem2 as GroupMenuItem, GroupOrUngroupMenuItem, HandTool, HandToolbarItem, HeartToolbarItem, HexagonToolbarItem, HighlightShapeTool, HighlightShapeUtil, HighlightToolbarItem, ImageAssetUtil, ImageShapeUtil, InputModeMenu, KeyboardShiftEnterTweakExtension, KeyboardShortcutsMenuItem, LanguageMenu, LaserTool, LaserToolbarItem, LineShapeTool, LineShapeUtil, LineToolbarItem, LockGroup, MiscMenuGroup, MobileStylePanel, MoveToPageMenu, NoteShapeTool, NoteShapeUtil, NoteToolbarItem, OfflineIndicator, OvalToolbarItem, OverflowingToolbar, PORTRAIT_BREAKPOINT, PageItemInput, PageItemSubmenu, PasteMenuItem, PathBuilder, PathBuilderGeometry2d, DefaultPeopleMenu as PeopleMenu, PlainTextArea, PlainTextLabel, PreferencesGroup, PrintItem, RTL_LANGUAGES, RectangleToolbarItem, RemoveFrameMenuItem, ReorderMenuItems, ReorderMenuSubmenu, RhombusToolbarItem, RichTextArea, RichTextLabel, RichTextSVG, RotateCWMenuItem, STROKE_SIZES, ScribbleOverlayUtil, SelectAllMenuItem, SelectTool, SelectToolbarItem, SelectionForegroundOverlayUtil, ShapeHandleOverlayUtil, SnapIndicatorOverlayUtil, Spinner, StackMenuItems, StarToolbarItem, StylePanelArrowKindPicker, StylePanelArrowheadPicker, StylePanelButtonPicker, StylePanelButtonPickerInline, StylePanelColorPicker, StylePanelContextProvider, StylePanelDashPicker, StylePanelDoubleDropdownPicker, StylePanelDoubleDropdownPickerInline, StylePanelDropdownPicker, StylePanelDropdownPickerInline, StylePanelFillPicker, StylePanelFontPicker, StylePanelGeoShapePicker, StylePanelLabelAlignPicker, StylePanelOpacityPicker, StylePanelSection, StylePanelSizePicker, StylePanelSplinePicker, StylePanelSubheading, StylePanelTextAlignPicker, TextShapeTool, TextShapeUtil, TextToolbarItem, ToggleAutoSizeMenuItem, ToggleDebugModeItem, ToggleDynamicSizeModeItem, ToggleEdgeScrollingItem, ToggleEnhancedA11yModeItem, ToggleFocusModeItem, ToggleGridItem, ToggleInvertZoomItem, ToggleKeyboardShortcutsItem, ToggleLockMenuItem, TogglePasteAtCursorItem, ToggleReduceMotionItem, ToggleSnapModeItem, ToggleToolLockItem, ToggleToolLockedButton, ToggleTransparentBgMenuItem, ToggleWrapModeItem, ToolbarItem, TrapezoidToolbarItem, TriangleToolbarItem, UndoRedoGroup, UngroupMenuItem2 as UngroupMenuItem, UnlockAllMenuItem, VideoAssetUtil, VideoShapeUtil, ViewSubmenu, XBoxToolbarItem, ZoomBrushOverlayUtil, ZoomOrRotateMenuItem, ZoomTo100MenuItem, ZoomToFitMenuItem, ZoomToSelectionMenuItem, ZoomTool, allDefaultFontFaces, buildFromV1Document, centerSelectionAroundPoint, clearArrowTargetState, containBoxSize, copyAs, createBookmarkFromUrl, createEmptyBookmarkShape, createShapesForAssets, decodeMiroClipboardHtml, defaultAddFontsFromNode, defaultAssetUtils, defaultBindingUtils, defaultEditorAssetUrls, defaultGeoTypeDefinitions, defaultHandleExternalDrawContent, defaultHandleExternalEmbedContent, defaultHandleExternalExcalidrawContent, defaultHandleExternalFileAsset, defaultHandleExternalFileContent, defaultHandleExternalFileReplaceContent, defaultHandleExternalMiroContent, defaultHandleExternalSvgTextContent, defaultHandleExternalTextContent, defaultHandleExternalUrlAsset, defaultHandleExternalUrlContent, defaultOverlayUtils, defaultShapeTools, defaultShapeUtils, defaultTools, downloadFile, downsizeImage, embedShapePermissionDefaults, exportAs, extractMiroDataPayload, fitFrameToContent, getArrowBindings, getArrowInfo, getArrowTargetState, getArrowTerminalsInArrowSpace, getAssetInfo, getCollaboratorCursorScale, getColorStyleItems, getCropBox, getDefaultCrop, getDisplayValues, getEmbedInfo, getFontFamily, getFontStyleItems, getGeoTypeDefinition, getHitShapeOnCanvasPointerDown, getPointsFromDrawSegment, getPointsFromDrawSegments, getStroke, getStrokeOutlinePoints, getStrokePoints, getSvgPathFromStrokePoints, getUncroppedSize, handleNativeOrMenuCopy, hideAllTooltips, iconTypes, mergeCollaboratorCursorLayout, notifyIfFileNotAllowed, onDragFromToolbarToCreateShape, parseAndLoadDocument, parseDrawJsonFile, preloadFont, putExcalidrawContent, putMiroContent, registerDefaultExternalContentHandlers, registerDefaultSideEffects, removeFrame, renderHtmlFromRichText, renderHtmlFromRichTextForMeasurement, renderPlaintextFromRichText, renderRichTextFromHTML, sanitizeSvg, serializeDrawJson, serializeDrawJsonBlob, setDefaultEditorAssetUrls, setDefaultUiAssetUrls, setStrokePointRadii, startEditingShapeWithRichText, summarizeMiroClipboard, tipTapDefaultExtensions, truncateStringWithEllipsis, unknownEmbedShapePermissionOverrides, unwrapLabel, updateArrowTargetState, useA11y, useActions, useAssetUrls, useBreakpoint, useCanApplySelectionAction, useCanRedo, useCanUndo, useCollaborationStatus, useCopyAs, useCurrentTranslation, useDefaultHelpers, useDialogs, useDirection, useDrawUiComponents, useDrawUiOrientation, useEditablePlainText, useEditableRichText, useExportAs, useImageOrVideoAsset, useIsToolSelected, useKeyboardShortcuts, useLocalStorageState, useMenuClipboardEvents, useMenuIsOpen, useNativeClipboardEvents, usePrefersReducedMotion, useReadonly, useRelevantStyles, useSelectedShapesAnnouncer, useShowCollaborationUi, useStylePanelContext, useToasts, useTools, useTranslation, useUiEvents, useUnlockedSelectedShapesCount };
37271
38499
  //# sourceMappingURL=index.mjs.map
37272
38500
  //# sourceMappingURL=index.mjs.map