@ibodr/draw 0.2.0 → 0.2.1

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
@@ -3735,265 +3735,6 @@ var getFill = (element) => {
3735
3735
  }
3736
3736
  return fillStylesToFillType[element.fillStyle] ?? "solid";
3737
3737
  };
3738
-
3739
- // src/features/clipboard/miro/miroStyleMap.ts
3740
- function parseMiroStyle(style) {
3741
- if (!style) return {};
3742
- if (typeof style === "object") return style;
3743
- if (typeof style !== "string") return {};
3744
- try {
3745
- return JSON.parse(style);
3746
- } catch {
3747
- return {};
3748
- }
3749
- }
3750
- function miroColorToHex(color) {
3751
- if (typeof color !== "number" || !Number.isFinite(color) || color < 0) return null;
3752
- const n = Math.floor(color) & 16777215;
3753
- return `#${n.toString(16).padStart(6, "0")}`;
3754
- }
3755
- function miroColorToDrawColor(color, fallback = "black") {
3756
- const hex = miroColorToHex(color);
3757
- if (hex) return hex;
3758
- return fallback;
3759
- }
3760
- function miroStickyColor(style) {
3761
- return miroColorToHex(style.sbc ?? style.bc) ?? "#ffe86d";
3762
- }
3763
- function breakLongStickyTokens(text) {
3764
- if (!text) return text;
3765
- return text.replace(/\S{14,}/g, (run) => {
3766
- if (/[\/\\_\-.=?&#]/.test(run)) {
3767
- return run.replace(/([\/\\_\-.=?&#])/g, "$1\u200B");
3768
- }
3769
- const chunks = [];
3770
- for (let i = 0; i < run.length; i += 12) {
3771
- chunks.push(run.slice(i, i + 12));
3772
- }
3773
- return chunks.join("\u200B");
3774
- });
3775
- }
3776
- function miroLineStyleToDash(style) {
3777
- const ls = typeof style.ls === "number" ? style.ls : Number(style.ls);
3778
- if (ls === 1) return "dashed";
3779
- if (ls === 3) return "dotted";
3780
- return "solid";
3781
- }
3782
- function miroStrokeWidthToSize(width) {
3783
- const w = typeof width === "number" ? width : Number(width);
3784
- if (!Number.isFinite(w)) return "m";
3785
- if (w <= 1) return "s";
3786
- if (w <= 2) return "m";
3787
- if (w <= 4) return "l";
3788
- return "xl";
3789
- }
3790
- function miroFontSizeToSizeAndScale(fontSize) {
3791
- const fs = typeof fontSize === "number" ? fontSize : Number(fontSize);
3792
- if (!Number.isFinite(fs) || fs <= 0) {
3793
- return { size: "s", scale: 14 / 18 };
3794
- }
3795
- if (fs <= 12) return { size: "s", scale: Math.max(0.5, fs / 18) };
3796
- if (fs <= 16) return { size: "s", scale: fs / 18 };
3797
- if (fs <= 22) return { size: "m", scale: fs / 24 };
3798
- if (fs <= 30) return { size: "l", scale: fs / 36 };
3799
- return { size: "xl", scale: Math.min(4, fs / 44) };
3800
- }
3801
- function miroTextFontFromJson(style) {
3802
- if (typeof style.fs === "number" && style.fs > 0) {
3803
- return miroFontSizeToSizeAndScale(style.fs);
3804
- }
3805
- if (typeof style.st === "number" && style.st > 0) {
3806
- return miroFontSizeToSizeAndScale(style.st);
3807
- }
3808
- return miroFontSizeToSizeAndScale(14);
3809
- }
3810
- function readLocalSize(json) {
3811
- const size = json?.size;
3812
- return {
3813
- w: Math.max(1, readNumber(size?.width ?? json?.width, 100)),
3814
- h: Math.max(1, readNumber(size?.height ?? json?.height, 100))
3815
- };
3816
- }
3817
- function miroBorderStyleToDash(brs) {
3818
- const n = typeof brs === "number" ? brs : Number(brs);
3819
- if (n === 1) return "dashed";
3820
- if (n === 3) return "dotted";
3821
- return "solid";
3822
- }
3823
- function miroFillFromStyle(style) {
3824
- const bc = style.bc;
3825
- if (typeof bc !== "number" || bc < 0) return "none";
3826
- const bo = typeof style.bo === "number" ? style.bo : 1;
3827
- if (bo <= 0) return "none";
3828
- if (bo < 0.85) return "semi";
3829
- return "solid";
3830
- }
3831
- function miroTextAlign(ta) {
3832
- const v = String(ta ?? "c");
3833
- if (v === "l" || v === "left") return { align: "start", textAlign: "start" };
3834
- if (v === "r" || v === "right") return { align: "end", textAlign: "end" };
3835
- return { align: "middle", textAlign: "middle" };
3836
- }
3837
- function miroVerticalAlign(tav) {
3838
- const v = String(tav ?? "m");
3839
- if (v === "t" || v === "top") return "start";
3840
- if (v === "b" || v === "bottom") return "end";
3841
- return "middle";
3842
- }
3843
- var MIRO_SHAPE_TO_GEO = {
3844
- "3": "rectangle",
3845
- "4": "ellipse",
3846
- "5": "triangle",
3847
- "6": "rectangle",
3848
- // speech bubble → placeholder
3849
- "7": "rectangle",
3850
- // squircle / round_rectangle
3851
- "8": "diamond",
3852
- "10": "rhombus",
3853
- // parallelogram
3854
- "11": "star",
3855
- "12": "arrow-right",
3856
- "13": "arrow-left",
3857
- "16": "pentagon",
3858
- "17": "hexagon",
3859
- "18": "octagon",
3860
- "19": "trapezoid",
3861
- "20": "rectangle",
3862
- // predefined process
3863
- "21": "arrow-right",
3864
- "22": "cloud",
3865
- "23": "rectangle",
3866
- "24": "rectangle",
3867
- "25": "x-box",
3868
- "26": "oval"
3869
- // barrel / cylinder ≈ oval
3870
- };
3871
- var MIRO_STENCIL_TO_GEO = {
3872
- "flowchart-terminator": "oval",
3873
- "flowchart-process": "rectangle",
3874
- "flowchart-decision": "diamond",
3875
- "flowchart-input-output": "rhombus",
3876
- "flowchart-data": "rhombus",
3877
- "flowchart-document": "rectangle",
3878
- "flowchart-preparation": "hexagon",
3879
- "flowchart-connector": "ellipse",
3880
- "flowchart-display": "ellipse",
3881
- "flowchart-manual-input": "trapezoid",
3882
- "flowchart-manual-operation": "trapezoid",
3883
- "flowchart-predefined-process": "rectangle",
3884
- "flowchart-predefined-process-2": "rectangle",
3885
- "flowchart-offpage-connector": "arrow-right",
3886
- "flowchart-delay": "ellipse",
3887
- "flowchart-merge": "triangle",
3888
- "flowchart-or": "ellipse",
3889
- "flowchart-summing-junction": "ellipse",
3890
- "flowchart-internal-storage": "rectangle",
3891
- "flowchart-note-square": "rectangle"
3892
- };
3893
- function miroShapeToGeo(shape) {
3894
- const key = String(shape ?? "3");
3895
- return MIRO_SHAPE_TO_GEO[key] ?? "rectangle";
3896
- }
3897
- function miroStencilToGeo(schemaId) {
3898
- const key = String(schemaId ?? "");
3899
- return MIRO_STENCIL_TO_GEO[key] ?? "rectangle";
3900
- }
3901
- function miroStencilText(json) {
3902
- const schema = json?.schema;
3903
- const texts = schema?.data?.texts;
3904
- if (!texts || typeof texts !== "object") return "";
3905
- const named = texts.name?.text;
3906
- if (typeof named === "string") return named;
3907
- for (const value of Object.values(texts)) {
3908
- if (value && typeof value.text === "string") return value.text;
3909
- }
3910
- return "";
3911
- }
3912
- function miroStencilFontStyle(json, fallback) {
3913
- const schema = json?.schema;
3914
- const fromText = schema?.data?.texts?.name?.styles;
3915
- if (fromText && typeof fromText === "object") {
3916
- return { ...fallback, ...fromText };
3917
- }
3918
- return fallback;
3919
- }
3920
- function miroArrowhead(code) {
3921
- const n = typeof code === "number" ? code : Number(code);
3922
- if (!Number.isFinite(n) || n === 0) return "none";
3923
- if (n === 1) return "dot";
3924
- if (n === 2) return "square";
3925
- if (n === 3) return "diamond";
3926
- if (n === 5) return "bar";
3927
- if (n === 6) return "pipe";
3928
- if (n === 7) return "triangle";
3929
- return "arrow";
3930
- }
3931
- function miroHtmlToPlainText(html) {
3932
- if (typeof html !== "string" || !html) return "";
3933
- 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) => {
3934
- const code = parseInt(hex, 16);
3935
- return Number.isFinite(code) ? String.fromCodePoint(code) : "";
3936
- }).replace(/&#(\d+);/g, (_, dec) => {
3937
- const code = parseInt(dec, 10);
3938
- return Number.isFinite(code) ? String.fromCodePoint(code) : "";
3939
- }).replace(/\n{3,}/g, "\n\n").trim();
3940
- }
3941
- function readNumber(value, fallback = 0) {
3942
- const n = typeof value === "number" ? value : Number(value);
3943
- return Number.isFinite(n) ? n : fallback;
3944
- }
3945
- function readScale(scale) {
3946
- if (typeof scale === "number") return scale > 0 ? scale : 1;
3947
- if (scale && typeof scale === "object" && "scale" in scale) {
3948
- return readScale(scale.scale);
3949
- }
3950
- return 1;
3951
- }
3952
- function readRotation(rotation) {
3953
- if (typeof rotation === "number") return rotation * Math.PI / 180;
3954
- if (rotation && typeof rotation === "object" && "rotation" in rotation) {
3955
- return readRotation(rotation.rotation);
3956
- }
3957
- return 0;
3958
- }
3959
- function readOffsetPosition(json) {
3960
- if (!json) return { x: 0, y: 0, isParentLocal: false };
3961
- const pos = json._position ?? json.position;
3962
- const isParentLocal = pos?.schema === "parentOffsetPx";
3963
- if (pos?.offsetPx) {
3964
- return {
3965
- x: readNumber(pos.offsetPx.x),
3966
- y: readNumber(pos.offsetPx.y),
3967
- isParentLocal
3968
- };
3969
- }
3970
- if (typeof json.x === "number" || typeof json.y === "number") {
3971
- return { x: readNumber(json.x), y: readNumber(json.y), isParentLocal: false };
3972
- }
3973
- if (pos && (typeof pos.x === "number" || typeof pos.y === "number")) {
3974
- return { x: readNumber(pos.x), y: readNumber(pos.y), isParentLocal: false };
3975
- }
3976
- return { x: 0, y: 0, isParentLocal: false };
3977
- }
3978
- function miroCenterToTopLeft(center, size, rotationRad = 0) {
3979
- const hx = size.w / 2;
3980
- const hy = size.h / 2;
3981
- if (!rotationRad) {
3982
- return { x: center.x - hx, y: center.y - hy };
3983
- }
3984
- const cos = Math.cos(rotationRad);
3985
- const sin = Math.sin(rotationRad);
3986
- return {
3987
- x: center.x - (cos * hx - sin * hy),
3988
- y: center.y - (sin * hx + cos * hy)
3989
- };
3990
- }
3991
- function readSize(json, scale = 1) {
3992
- const size = json?.size;
3993
- const w = readNumber(size?.width ?? json?.width, 100) * scale;
3994
- const h = readNumber(size?.height ?? json?.height, 100) * scale;
3995
- return { w: Math.max(1, w), h: Math.max(1, h) };
3996
- }
3997
3738
  var DefaultFontFaces = {
3998
3739
  draw_draw: {
3999
3740
  normal: {
@@ -4218,880 +3959,6 @@ function defaultAddFontsFromNode(node, state, addFont) {
4218
3959
  return state;
4219
3960
  }
4220
3961
 
4221
- // src/features/clipboard/miro/miroRichText.ts
4222
- function mapRichTextTextNodes(doc, mapText) {
4223
- const walk = (node) => {
4224
- if (node.type === "text" && typeof node.text === "string") {
4225
- return { ...node, text: mapText(node.text) };
4226
- }
4227
- const content = node.content;
4228
- if (Array.isArray(content)) {
4229
- return { ...node, content: content.map((c) => walk(c)) };
4230
- }
4231
- return node;
4232
- };
4233
- return walk(doc);
4234
- }
4235
- function isQuillBulletListType(type) {
4236
- return type === "bullet" || type === "checked" || type === "unchecked";
4237
- }
4238
- function convertQuillListsToSemanticHtml(html) {
4239
- if (!/data-list\s*=/i.test(html) || typeof DOMParser === "undefined") return html;
4240
- const doc = new DOMParser().parseFromString(`<div id="__miro_rt">${html}</div>`, "text/html");
4241
- const root = doc.getElementById("__miro_rt");
4242
- if (!root) return html;
4243
- const ols = Array.from(root.querySelectorAll("ol")).sort((a, b) => {
4244
- let da = 0;
4245
- let db = 0;
4246
- for (let n = a; n; n = n.parentElement) da++;
4247
- for (let n = b; n; n = n.parentElement) db++;
4248
- return db - da;
4249
- });
4250
- for (const ol of ols) {
4251
- const items = Array.from(ol.children).filter((c) => c.tagName === "LI");
4252
- if (!items.some((li) => li.hasAttribute("data-list"))) continue;
4253
- const groups = [];
4254
- for (const li of items) {
4255
- const bullet = isQuillBulletListType(li.getAttribute("data-list"));
4256
- const last7 = groups[groups.length - 1];
4257
- if (last7 && last7.bullet === bullet) last7.items.push(li);
4258
- else groups.push({ bullet, items: [li] });
4259
- }
4260
- const parent = ol.parentNode;
4261
- if (!parent) continue;
4262
- for (const group of groups) {
4263
- const list = doc.createElement(group.bullet ? "ul" : "ol");
4264
- for (const li of group.items) {
4265
- li.removeAttribute("data-list");
4266
- li.querySelectorAll("span.ql-ui").forEach((el) => el.remove());
4267
- list.appendChild(li);
4268
- }
4269
- parent.insertBefore(list, ol);
4270
- }
4271
- parent.removeChild(ol);
4272
- }
4273
- return root.innerHTML;
4274
- }
4275
- function normalizeMiroHtml(html) {
4276
- let s = html.trim();
4277
- if (!s) return s;
4278
- s = s.replace(/<\s*b(\s[^>]*)?>/gi, "<strong$1>").replace(/<\/\s*b\s*>/gi, "</strong>");
4279
- s = s.replace(/<\s*i(\s[^>]*)?>/gi, "<em$1>").replace(/<\/\s*i\s*>/gi, "</em>");
4280
- s = s.replace(/<\s*del(\s[^>]*)?>/gi, "<s$1>").replace(/<\/\s*del\s*>/gi, "</s>");
4281
- s = convertQuillListsToSemanticHtml(s);
4282
- if (!/^<(p|ul|ol|h[1-6]|blockquote|pre)\b/i.test(s)) {
4283
- s = `<p>${s}</p>`;
4284
- }
4285
- return s;
4286
- }
4287
- function miroHtmlToRichText(editor, html, opts) {
4288
- if (typeof html !== "string" || !html.trim()) {
4289
- return toRichText(" ");
4290
- }
4291
- const plain = miroHtmlToPlainText(html);
4292
- const plainOut = opts?.breakLongTokens ? breakLongStickyTokens(plain) : plain;
4293
- try {
4294
- let rich = renderRichTextFromHTML(editor, normalizeMiroHtml(html));
4295
- if (isEmptyRichText(rich)) {
4296
- return toRichText(plainOut || " ");
4297
- }
4298
- if (opts?.breakLongTokens) {
4299
- rich = mapRichTextTextNodes(rich, breakLongStickyTokens);
4300
- }
4301
- return rich;
4302
- } catch {
4303
- return toRichText(plainOut || " ");
4304
- }
4305
- }
4306
- function estimateMiroTextLineCount(html, plain) {
4307
- if (typeof html === "string") {
4308
- const li = (html.match(/<li\b/gi) ?? []).length;
4309
- if (li > 0) return Math.max(1, li);
4310
- const blocks = (html.match(/<(p|div|br)\b/gi) ?? []).length;
4311
- if (blocks > 1) return blocks;
4312
- }
4313
- return Math.max(1, plain.split("\n").filter((l) => l.trim().length > 0).length);
4314
- }
4315
-
4316
- // src/features/clipboard/miro/putMiroContent.ts
4317
- function getWidgetType(obj) {
4318
- if (obj.type === 10) return "group";
4319
- if (obj.type === 13) return "tag";
4320
- return obj.widgetData?.type ?? null;
4321
- }
4322
- function getJson(obj) {
4323
- return obj.widgetData?.json ?? {};
4324
- }
4325
- function withMiroCenterLocal(meta, size) {
4326
- return {
4327
- ...meta,
4328
- miroCenterLocal: { x: size.w / 2, y: size.h / 2 }
4329
- };
4330
- }
4331
- function alignShapesToMiroCenters(editor, drafts) {
4332
- const fixes = [];
4333
- for (const draft of drafts) {
4334
- const local = draft.meta?.miroCenterLocal;
4335
- if (!local) continue;
4336
- const live = editor.getShape(draft.id);
4337
- if (!live) continue;
4338
- const metaLocal = live.meta?.miroCenterLocal ?? local;
4339
- const pageBounds = editor.getShapePageBounds(live);
4340
- const pageTransform = editor.getShapePageTransform(live);
4341
- if (!pageBounds || !pageTransform) continue;
4342
- const intendedPage = pageTransform.applyToPoint(metaLocal);
4343
- const parentTransform = editor.getShapeParentTransform(live);
4344
- const inv = parentTransform.clone().invert();
4345
- const intendedParent = inv.applyToPoint(intendedPage);
4346
- const actualParent = inv.applyToPoint(pageBounds.center);
4347
- const dx = intendedParent.x - actualParent.x;
4348
- const dy = intendedParent.y - actualParent.y;
4349
- if (Math.abs(dx) < 0.05 && Math.abs(dy) < 0.05) continue;
4350
- fixes.push({
4351
- id: live.id,
4352
- type: live.type,
4353
- x: (live.x ?? 0) + dx,
4354
- y: (live.y ?? 0) + dy
4355
- });
4356
- }
4357
- if (fixes.length) {
4358
- editor.updateShapes(fixes);
4359
- }
4360
- }
4361
- function isNormalizedAnchor(point) {
4362
- if (!point) return false;
4363
- const x = readNumber(point.x, NaN);
4364
- const y = readNumber(point.y, NaN);
4365
- if (!Number.isFinite(x) || !Number.isFinite(y)) return false;
4366
- return x >= -0.05 && x <= 1.05 && y >= -0.05 && y <= 1.05;
4367
- }
4368
- function pointInParentLocalBox(p, parentBounds, pad = 1) {
4369
- return p.x >= -pad && p.y >= -pad && p.x <= parentBounds.w + pad && p.y <= parentBounds.h + pad;
4370
- }
4371
- async function putMiroContent(editor, miroClipboardContent, point) {
4372
- const objects = miroClipboardContent.data?.objects ?? [];
4373
- if (!objects.length) return null;
4374
- const shiftRaw = miroClipboardContent.data?.shift;
4375
- const shift = shiftRaw && (shiftRaw.x != null || shiftRaw.y != null) ? { x: readNumber(shiftRaw.x), y: readNumber(shiftRaw.y) } : null;
4376
- const drawContent = {
4377
- shapes: [],
4378
- bindings: [],
4379
- rootShapeIds: [],
4380
- assets: [],
4381
- schema: editor.store.schema.serialize()
4382
- };
4383
- const currentPageId = editor.getCurrentPageId();
4384
- const indexToShapeId = /* @__PURE__ */ new Map();
4385
- const indexToBounds = /* @__PURE__ */ new Map();
4386
- const parentsWithLocalChildren = /* @__PURE__ */ new Set();
4387
- const groupMemberIds = /* @__PURE__ */ new Map();
4388
- const pendingParents = [];
4389
- const pendingLines = [];
4390
- for (const obj of objects) {
4391
- if (typeof obj.id === "number") {
4392
- indexToShapeId.set(obj.id, createShapeId());
4393
- }
4394
- }
4395
- const zByObjectId = /* @__PURE__ */ new Map();
4396
- let zCursor = ZERO_INDEX_KEY;
4397
- const takeZ = (obj) => {
4398
- if (typeof obj.id === "number" && zByObjectId.has(obj.id)) {
4399
- return zByObjectId.get(obj.id);
4400
- }
4401
- const z = zCursor;
4402
- zCursor = getIndexAbove(zCursor);
4403
- if (typeof obj.id === "number") zByObjectId.set(obj.id, z);
4404
- return z;
4405
- };
4406
- for (const obj of objects) {
4407
- const widgetType = getWidgetType(obj);
4408
- if (!widgetType || widgetType === "group" || widgetType === "tag") continue;
4409
- if (typeof obj.id === "number") takeZ(obj);
4410
- }
4411
- for (const obj of objects) {
4412
- const widgetType = getWidgetType(obj);
4413
- if (!widgetType || widgetType === "line") continue;
4414
- if (widgetType === "group" || widgetType === "tag") continue;
4415
- const shapeId = typeof obj.id === "number" ? indexToShapeId.get(obj.id) : createShapeId();
4416
- const json = getJson(obj);
4417
- const scale = readScale(json.scale ?? json.relativeScale);
4418
- const rotation = readRotation(json.rotation);
4419
- const pos = readOffsetPosition(json);
4420
- if (shift && !pos.isParentLocal) {
4421
- pos.x -= shift.x;
4422
- pos.y -= shift.y;
4423
- }
4424
- const parentRef = json._parent;
4425
- if (pos.isParentLocal && parentRef && typeof parentRef.index === "number") {
4426
- parentsWithLocalChildren.add(parentRef.index);
4427
- }
4428
- const base = {
4429
- id: shapeId,
4430
- typeName: "shape",
4431
- parentId: currentPageId,
4432
- index: takeZ(obj),
4433
- x: pos.x,
4434
- y: pos.y,
4435
- rotation,
4436
- isLocked: false,
4437
- opacity: 1,
4438
- meta: {
4439
- miroInitialId: obj.initialId ?? null,
4440
- miroWidgetType: widgetType
4441
- }
4442
- };
4443
- let created = false;
4444
- switch (widgetType) {
4445
- case "sticker": {
4446
- const style = parseMiroStyle(json.style);
4447
- const local = readLocalSize(json);
4448
- const richText = miroHtmlToRichText(editor, json.text, { breakLongTokens: true });
4449
- const scaleFactor = scale > 0 ? scale : 1;
4450
- const noteW = local.w * scaleFactor;
4451
- const noteH = local.h * scaleFactor;
4452
- const topLeft = miroCenterToTopLeft(pos, { w: noteW, h: noteH }, rotation);
4453
- const baseNote = 200;
4454
- const noteScale = noteW / baseNote;
4455
- const miroGrowY = Math.max(0, (noteH - noteW) / Math.max(noteScale, 0.01));
4456
- const aligns = miroTextAlign(style.ta);
4457
- const verticalAlign = miroVerticalAlign(style.tav);
4458
- drawContent.shapes.push({
4459
- ...base,
4460
- x: topLeft.x,
4461
- y: topLeft.y,
4462
- type: "note",
4463
- meta: withMiroCenterLocal(
4464
- {
4465
- ...base.meta,
4466
- // NoteShapeUtil.onBeforeCreate auto-grows to fit text; we restore
4467
- // Miro's fixed box after paste so overlay buttons stay aligned.
4468
- miroNoteGrowY: miroGrowY,
4469
- miroNoteScale: noteScale
4470
- },
4471
- { w: noteW, h: noteH }
4472
- ),
4473
- props: {
4474
- ...editor.getShapeUtil("note").getDefaultProps(),
4475
- color: miroStickyColor(style),
4476
- labelColor: "black",
4477
- // Miro stickies are denser than default note 'm'.
4478
- size: "s",
4479
- font: "sans",
4480
- align: aligns.align,
4481
- // Honor Miro vertical align (usually middle) — do not force top.
4482
- verticalAlign,
4483
- richText,
4484
- scale: noteScale,
4485
- fontSizeAdjustment: 0.9,
4486
- growY: miroGrowY
4487
- }
4488
- });
4489
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, noteW, noteH));
4490
- created = true;
4491
- break;
4492
- }
4493
- case "text": {
4494
- const style = parseMiroStyle(json.style);
4495
- const rawHtml = (typeof json.text === "string" ? json.text : null) ?? json.html;
4496
- const plain = miroHtmlToPlainText(rawHtml);
4497
- const richText = miroHtmlToRichText(editor, rawHtml);
4498
- const local = readLocalSize(json);
4499
- const { size: fontSize, scale: fontAdj } = miroTextFontFromJson(style);
4500
- const aligns = miroTextAlign(style.ta);
4501
- const color = miroColorToDrawColor(style.tc, "black");
4502
- const propsScale = Math.max(0.01, scale * fontAdj);
4503
- const displayW = local.w * scale;
4504
- const lineCount = estimateMiroTextLineCount(rawHtml, plain);
4505
- const approxUnscaledLine = fontSize === "s" ? 22 : fontSize === "m" ? 28 : fontSize === "l" ? 36 : 44;
4506
- const contentH = Math.max(1, approxUnscaledLine * lineCount * propsScale);
4507
- const topLeft = miroCenterToTopLeft(pos, { w: displayW, h: contentH }, rotation);
4508
- drawContent.shapes.push({
4509
- ...base,
4510
- x: topLeft.x,
4511
- y: topLeft.y,
4512
- type: "text",
4513
- meta: withMiroCenterLocal(base.meta, { w: displayW, h: contentH }),
4514
- props: {
4515
- ...editor.getShapeUtil("text").getDefaultProps(),
4516
- richText,
4517
- color,
4518
- size: fontSize,
4519
- scale: propsScale,
4520
- font: "sans",
4521
- textAlign: aligns.textAlign,
4522
- autoSize: false,
4523
- // Keep display width = local.w * scale
4524
- w: Math.max(1, local.w / Math.max(fontAdj, 0.01))
4525
- }
4526
- });
4527
- indexToBounds.set(
4528
- obj.id,
4529
- new Box(topLeft.x, topLeft.y, displayW, Math.max(contentH, 20))
4530
- );
4531
- created = true;
4532
- break;
4533
- }
4534
- case "shape": {
4535
- const style = parseMiroStyle(json.style);
4536
- const local = readLocalSize(json);
4537
- const display = { w: local.w * scale, h: local.h * scale };
4538
- const plain = miroHtmlToPlainText(json.text);
4539
- const richText = miroHtmlToRichText(editor, json.text);
4540
- const aligns = miroTextAlign(style.ta);
4541
- const fill = miroFillFromStyle(style);
4542
- const fillColor = fill === "none" ? miroColorToDrawColor(style.brc ?? style.sc, "black") : miroColorToDrawColor(style.bc, "black");
4543
- const strokeSize = miroStrokeWidthToSize(style.brw ?? 2);
4544
- const hasLabel = Boolean(plain.trim());
4545
- 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;
4546
- const fontFromFs = miroFontSizeToSizeAndScale(fsHint * Math.max(scale, 0.01));
4547
- const geoSize = hasLabel ? fontFromFs.size : strokeSize;
4548
- const geoScale = Math.max(0.01, scale);
4549
- const topLeft = miroCenterToTopLeft(pos, display, rotation);
4550
- drawContent.shapes.push({
4551
- ...base,
4552
- x: topLeft.x,
4553
- y: topLeft.y,
4554
- type: "geo",
4555
- meta: withMiroCenterLocal(base.meta, display),
4556
- props: {
4557
- ...editor.getShapeUtil("geo").getDefaultProps(),
4558
- geo: miroShapeToGeo(json.shape),
4559
- w: display.w,
4560
- h: display.h,
4561
- color: fillColor,
4562
- labelColor: miroColorToDrawColor(style.tc, "black"),
4563
- fill,
4564
- dash: miroBorderStyleToDash(style.brs),
4565
- size: geoSize,
4566
- font: "sans",
4567
- align: aligns.align,
4568
- verticalAlign: miroVerticalAlign(style.tav),
4569
- richText,
4570
- scale: geoScale
4571
- }
4572
- });
4573
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, display.w, display.h));
4574
- created = true;
4575
- break;
4576
- }
4577
- case "stencil": {
4578
- const style = parseMiroStyle(json.style);
4579
- const local = readLocalSize(json);
4580
- const display = { w: local.w * scale, h: local.h * scale };
4581
- const schema = json.schema;
4582
- const labelHtml = miroStencilText(json) || json.text;
4583
- const plain = miroHtmlToPlainText(labelHtml);
4584
- const richText = miroHtmlToRichText(editor, labelHtml);
4585
- const fontStyle = miroStencilFontStyle(json, style);
4586
- const aligns = miroTextAlign(fontStyle.ta ?? style.ta);
4587
- const fill = miroFillFromStyle(style);
4588
- const fillColor = fill === "none" ? miroColorToDrawColor(style.brc ?? style.sc, "black") : miroColorToDrawColor(style.bc, "black");
4589
- const fsHint = typeof fontStyle.fs === "number" && fontStyle.fs > 0 ? fontStyle.fs : typeof style.fs === "number" && style.fs > 0 ? style.fs : 14;
4590
- const fontFromFs = miroFontSizeToSizeAndScale(fsHint * Math.max(scale, 0.01));
4591
- const topLeft = miroCenterToTopLeft(pos, display, rotation);
4592
- drawContent.shapes.push({
4593
- ...base,
4594
- x: topLeft.x,
4595
- y: topLeft.y,
4596
- type: "geo",
4597
- meta: withMiroCenterLocal(
4598
- {
4599
- ...base.meta,
4600
- miroStencilId: schema?.id ?? null
4601
- },
4602
- display
4603
- ),
4604
- props: {
4605
- ...editor.getShapeUtil("geo").getDefaultProps(),
4606
- geo: miroStencilToGeo(schema?.id),
4607
- w: display.w,
4608
- h: display.h,
4609
- color: fillColor,
4610
- labelColor: miroColorToDrawColor(fontStyle.tc ?? style.tc, "black"),
4611
- fill: fill === "none" ? "semi" : fill,
4612
- dash: miroBorderStyleToDash(style.brs),
4613
- size: plain.trim() ? fontFromFs.size : miroStrokeWidthToSize(style.brw ?? 2),
4614
- font: "sans",
4615
- align: aligns.align,
4616
- verticalAlign: miroVerticalAlign(fontStyle.tav ?? style.tav),
4617
- richText,
4618
- scale: Math.max(0.01, scale)
4619
- }
4620
- });
4621
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, display.w, display.h));
4622
- created = true;
4623
- break;
4624
- }
4625
- case "frame": {
4626
- const style = parseMiroStyle(json.style);
4627
- const w = Math.max(1, readNumber(json.width ?? json.size?.width, 400) * scale);
4628
- const h = Math.max(1, readNumber(json.height ?? json.size?.height, 300) * scale);
4629
- const name = miroHtmlToPlainText(json.text) || "Frame";
4630
- const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4631
- drawContent.shapes.push({
4632
- ...base,
4633
- x: topLeft.x,
4634
- y: topLeft.y,
4635
- type: "frame",
4636
- meta: withMiroCenterLocal(base.meta, { w, h }),
4637
- props: {
4638
- ...editor.getShapeUtil("frame").getDefaultProps(),
4639
- w,
4640
- h,
4641
- name,
4642
- color: miroColorToDrawColor(style.sc ?? style.bc, "black")
4643
- }
4644
- });
4645
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4646
- created = true;
4647
- break;
4648
- }
4649
- case "image": {
4650
- const resource = json.resource ?? {};
4651
- const crop = json.crop ?? {};
4652
- const imgW = readNumber(crop.width ?? resource.width, 200);
4653
- const imgH = readNumber(crop.height ?? resource.height, 150);
4654
- const w = Math.max(1, imgW * scale);
4655
- const h = Math.max(1, imgH * scale);
4656
- const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4657
- const label = resource.name?.trim() ? `\u{1F5BC} ${resource.name}` : "Image (from Miro)";
4658
- drawContent.shapes.push({
4659
- ...base,
4660
- x: topLeft.x,
4661
- y: topLeft.y,
4662
- type: "geo",
4663
- props: {
4664
- ...editor.getShapeUtil("geo").getDefaultProps(),
4665
- geo: "rectangle",
4666
- w,
4667
- h,
4668
- color: "grey",
4669
- labelColor: "grey",
4670
- fill: "semi",
4671
- dash: "dashed",
4672
- size: "s",
4673
- font: "sans",
4674
- align: "middle",
4675
- verticalAlign: "middle",
4676
- richText: toRichText(label)
4677
- },
4678
- meta: withMiroCenterLocal(
4679
- {
4680
- ...base.meta,
4681
- miroPlaceholder: "image",
4682
- miroResourceId: json.resource?.id ?? null
4683
- },
4684
- { w, h }
4685
- )
4686
- });
4687
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4688
- created = true;
4689
- break;
4690
- }
4691
- case "paint": {
4692
- const style = parseMiroStyle(json.style);
4693
- const pointsRaw = json.points ?? [];
4694
- if (pointsRaw.length < 2) break;
4695
- const localPoints = pointsRaw.map((p2) => ({
4696
- x: readNumber(p2.x),
4697
- y: readNumber(p2.y),
4698
- z: 0.5
4699
- }));
4700
- const minX = Math.min(...localPoints.map((p2) => p2.x));
4701
- const minY = Math.min(...localPoints.map((p2) => p2.y));
4702
- const maxX = Math.max(...localPoints.map((p2) => p2.x));
4703
- const maxY = Math.max(...localPoints.map((p2) => p2.y));
4704
- const w = Math.max(1, maxX - minX);
4705
- const h = Math.max(1, maxY - minY);
4706
- const normalized = localPoints.map((p2) => ({
4707
- x: p2.x - minX,
4708
- y: p2.y - minY,
4709
- z: p2.z
4710
- }));
4711
- const topLeft = { x: pos.x + minX, y: pos.y + minY };
4712
- drawContent.shapes.push({
4713
- ...base,
4714
- x: topLeft.x,
4715
- y: topLeft.y,
4716
- type: "draw",
4717
- meta: withMiroCenterLocal(base.meta, { w, h }),
4718
- props: {
4719
- ...editor.getShapeUtil("draw").getDefaultProps(),
4720
- color: miroColorToDrawColor(style.lc, "black"),
4721
- size: miroStrokeWidthToSize(style.t ?? 2),
4722
- dash: "draw",
4723
- fill: "none",
4724
- segments: [{ type: "free", path: b64Vecs.encodePoints(normalized) }],
4725
- isComplete: true,
4726
- isClosed: false,
4727
- isPen: false,
4728
- scale: 1
4729
- }
4730
- });
4731
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4732
- created = true;
4733
- break;
4734
- }
4735
- default: {
4736
- const size = readSize(json, scale);
4737
- const w = Math.max(80, size.w);
4738
- const h = Math.max(40, size.h);
4739
- const topLeft = miroCenterToTopLeft(pos, { w, h }, rotation);
4740
- const label = miroHtmlToPlainText(json.text) || `[${widgetType}]`;
4741
- drawContent.shapes.push({
4742
- ...base,
4743
- x: topLeft.x,
4744
- y: topLeft.y,
4745
- type: "geo",
4746
- meta: withMiroCenterLocal(base.meta, { w, h }),
4747
- props: {
4748
- ...editor.getShapeUtil("geo").getDefaultProps(),
4749
- geo: "rectangle",
4750
- w,
4751
- h,
4752
- color: "grey",
4753
- labelColor: "black",
4754
- fill: "semi",
4755
- dash: "dashed",
4756
- size: "s",
4757
- font: "sans",
4758
- align: "middle",
4759
- verticalAlign: "middle",
4760
- richText: toRichText(label),
4761
- // Keep label readable inside scaled placeholders
4762
- scale: Math.max(0.5, scale)
4763
- }
4764
- });
4765
- indexToBounds.set(obj.id, new Box(topLeft.x, topLeft.y, w, h));
4766
- created = true;
4767
- break;
4768
- }
4769
- }
4770
- if (created) {
4771
- if (parentRef && typeof parentRef.index === "number") {
4772
- pendingParents.push({
4773
- childId: shapeId,
4774
- parentIndex: parentRef.index,
4775
- isParentLocal: pos.isParentLocal
4776
- });
4777
- } else {
4778
- drawContent.rootShapeIds.push(shapeId);
4779
- }
4780
- }
4781
- }
4782
- for (const obj of objects) {
4783
- if (getWidgetType(obj) !== "line") continue;
4784
- const shapeId = typeof obj.id === "number" ? indexToShapeId.get(obj.id) : createShapeId();
4785
- pendingLines.push({ obj, shapeId, json: getJson(obj) });
4786
- }
4787
- for (const { obj, shapeId, json } of pendingLines) {
4788
- const style = parseMiroStyle(json.style);
4789
- const primary = json.primary;
4790
- const secondary = json.secondary;
4791
- const midPoints = json.points ?? [];
4792
- const parentRef = json._parent;
4793
- let startPage = resolveLineEndpoint(primary, indexToBounds);
4794
- let endPage = resolveLineEndpoint(secondary, indexToBounds);
4795
- if (!startPage || !endPage) continue;
4796
- const parentIndex = parentRef && typeof parentRef.index === "number" ? parentRef.index : null;
4797
- const parentBounds = parentIndex != null ? indexToBounds.get(parentIndex) : void 0;
4798
- const preferParentLocal = parentIndex != null && parentBounds != null && parentsWithLocalChildren.has(parentIndex);
4799
- const adjustFreePoint = (p2, ep) => {
4800
- const widgetBound = typeof ep?.widgetIndex === "number" && ep.widgetIndex >= 0;
4801
- if (widgetBound) return p2;
4802
- if (preferParentLocal && parentBounds && pointInParentLocalBox(p2, parentBounds)) {
4803
- return p2;
4804
- }
4805
- if (shift) {
4806
- p2 = { x: p2.x - shift.x, y: p2.y - shift.y };
4807
- }
4808
- if (preferParentLocal && parentBounds) {
4809
- return { x: p2.x - parentBounds.x, y: p2.y - parentBounds.y };
4810
- }
4811
- return p2;
4812
- };
4813
- startPage = adjustFreePoint(startPage, primary);
4814
- endPage = adjustFreePoint(endPage, secondary);
4815
- let mids = midPoints.map((p2) => ({ x: readNumber(p2.x), y: readNumber(p2.y) }));
4816
- mids = mids.map((p2) => adjustFreePoint(p2, void 0));
4817
- let isParentLocal = false;
4818
- if (preferParentLocal) {
4819
- isParentLocal = true;
4820
- } else if (parentIndex != null && parentBounds) {
4821
- const hasAbsolutePoint = Boolean(
4822
- 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)
4823
- );
4824
- isParentLocal = !hasAbsolutePoint;
4825
- if (hasAbsolutePoint) {
4826
- isParentLocal = [startPage, endPage].every(
4827
- (p2) => pointInParentLocalBox(p2, parentBounds)
4828
- );
4829
- }
4830
- }
4831
- const allPts = [startPage, ...mids, endPage];
4832
- const minX = Math.min(...allPts.map((p2) => p2.x));
4833
- const minY = Math.min(...allPts.map((p2) => p2.y));
4834
- const arrowheadStart = miroArrowhead(style.a_start);
4835
- const arrowheadEnd = miroArrowhead(style.a_end);
4836
- const isArrow = arrowheadStart !== "none" || arrowheadEnd !== "none";
4837
- const color = miroColorToDrawColor(style.lc, "black");
4838
- const size = miroStrokeWidthToSize(style.t ?? 2);
4839
- const dash = miroLineStyleToDash(style);
4840
- const base = {
4841
- id: shapeId,
4842
- typeName: "shape",
4843
- parentId: currentPageId,
4844
- index: takeZ(obj),
4845
- x: minX,
4846
- y: minY,
4847
- rotation: 0,
4848
- isLocked: false,
4849
- opacity: 1,
4850
- meta: {
4851
- miroInitialId: obj.initialId ?? null,
4852
- miroWidgetType: "line"
4853
- }
4854
- };
4855
- if (mids.length > 0) {
4856
- const pts = allPts.map((p2) => ({ x: p2.x - minX, y: p2.y - minY }));
4857
- const indices = getIndices(pts.length);
4858
- drawContent.shapes.push({
4859
- ...base,
4860
- type: "line",
4861
- props: {
4862
- ...editor.getShapeUtil("line").getDefaultProps(),
4863
- color,
4864
- size,
4865
- dash,
4866
- spline: "line",
4867
- scale: 1,
4868
- points: Object.fromEntries(
4869
- pts.map((p2, i) => {
4870
- const idx = indices[i];
4871
- return [idx, { id: idx, index: idx, x: p2.x, y: p2.y }];
4872
- })
4873
- )
4874
- }
4875
- });
4876
- } else if (isArrow) {
4877
- drawContent.shapes.push({
4878
- ...base,
4879
- type: "arrow",
4880
- props: {
4881
- ...editor.getShapeUtil("arrow").getDefaultProps(),
4882
- kind: "elbow",
4883
- start: { x: startPage.x - minX, y: startPage.y - minY },
4884
- end: { x: endPage.x - minX, y: endPage.y - minY },
4885
- bend: 0,
4886
- color,
4887
- size,
4888
- dash,
4889
- arrowheadStart,
4890
- arrowheadEnd,
4891
- richText: toRichText(""),
4892
- scale: 1
4893
- }
4894
- });
4895
- const startTarget = typeof primary?.widgetIndex === "number" && primary.widgetIndex >= 0 ? indexToShapeId.get(primary.widgetIndex) : void 0;
4896
- const endTarget = typeof secondary?.widgetIndex === "number" && secondary.widgetIndex >= 0 ? indexToShapeId.get(secondary.widgetIndex) : void 0;
4897
- if (startTarget) {
4898
- const anchor = isNormalizedAnchor(primary?.point) ? { x: readNumber(primary.point.x), y: readNumber(primary.point.y) } : { x: 0.5, y: 0.5 };
4899
- drawContent.bindings.push({
4900
- id: createBindingId(),
4901
- typeName: "binding",
4902
- type: "arrow",
4903
- fromId: shapeId,
4904
- toId: startTarget,
4905
- props: {
4906
- terminal: "start",
4907
- snap: "none",
4908
- normalizedAnchor: anchor,
4909
- isPrecise: false,
4910
- isExact: false
4911
- },
4912
- meta: {}
4913
- });
4914
- }
4915
- if (endTarget) {
4916
- const anchor = isNormalizedAnchor(secondary?.point) ? { x: readNumber(secondary.point.x), y: readNumber(secondary.point.y) } : { x: 0.5, y: 0.5 };
4917
- drawContent.bindings.push({
4918
- id: createBindingId(),
4919
- typeName: "binding",
4920
- type: "arrow",
4921
- fromId: shapeId,
4922
- toId: endTarget,
4923
- props: {
4924
- terminal: "end",
4925
- snap: "none",
4926
- normalizedAnchor: anchor,
4927
- isPrecise: false,
4928
- isExact: false
4929
- },
4930
- meta: {}
4931
- });
4932
- }
4933
- } else {
4934
- const pts = allPts.map((p2) => ({ x: p2.x - minX, y: p2.y - minY }));
4935
- const indices = getIndices(pts.length);
4936
- drawContent.shapes.push({
4937
- ...base,
4938
- type: "line",
4939
- props: {
4940
- ...editor.getShapeUtil("line").getDefaultProps(),
4941
- color,
4942
- size,
4943
- dash,
4944
- spline: "line",
4945
- scale: 1,
4946
- points: Object.fromEntries(
4947
- pts.map((p2, i) => {
4948
- const idx = indices[i];
4949
- return [idx, { id: idx, index: idx, x: p2.x, y: p2.y }];
4950
- })
4951
- )
4952
- }
4953
- });
4954
- }
4955
- indexToBounds.set(
4956
- obj.id,
4957
- new Box(
4958
- minX,
4959
- minY,
4960
- Math.max(1, Math.abs(endPage.x - startPage.x)),
4961
- Math.max(1, Math.abs(endPage.y - startPage.y))
4962
- )
4963
- );
4964
- if (parentIndex != null) {
4965
- pendingParents.push({
4966
- childId: shapeId,
4967
- parentIndex,
4968
- isParentLocal
4969
- });
4970
- } else {
4971
- drawContent.rootShapeIds.push(shapeId);
4972
- }
4973
- }
4974
- const shapeById = new Map(drawContent.shapes.map((s) => [s.id, s]));
4975
- for (const { childId, parentIndex, isParentLocal } of pendingParents) {
4976
- const parentId = indexToShapeId.get(parentIndex);
4977
- const parentBounds = indexToBounds.get(parentIndex);
4978
- const child = shapeById.get(childId);
4979
- if (!parentId || !parentBounds || !child) continue;
4980
- child.parentId = parentId;
4981
- if (!isParentLocal) {
4982
- child.x = (child.x ?? 0) - parentBounds.x;
4983
- child.y = (child.y ?? 0) - parentBounds.y;
4984
- }
4985
- drawContent.rootShapeIds = drawContent.rootShapeIds.filter((id) => id !== childId);
4986
- }
4987
- for (const obj of objects) {
4988
- if (obj.type !== 10) continue;
4989
- const items = obj.items ?? [];
4990
- const memberIds = items.map((i) => indexToShapeId.get(i)).filter((id) => Boolean(id));
4991
- if (memberIds.length < 2) continue;
4992
- groupMemberIds.set(obj.id, memberIds);
4993
- }
4994
- if (!drawContent.shapes.length) return null;
4995
- const parented = new Set(
4996
- drawContent.shapes.filter((s) => s.parentId !== currentPageId).map((s) => s.id)
4997
- );
4998
- for (const s of drawContent.shapes) {
4999
- if (!parented.has(s.id) && !drawContent.rootShapeIds.includes(s.id)) {
5000
- drawContent.rootShapeIds.push(s.id);
5001
- }
5002
- }
5003
- drawContent.shapes.sort((a, b) => {
5004
- if (a.index < b.index) return -1;
5005
- if (a.index > b.index) return 1;
5006
- return 0;
5007
- });
5008
- const p = point ?? (editor.inputs.getShiftKey() ? editor.inputs.getCurrentPagePoint() : void 0);
5009
- editor.putContentOntoCurrentPage(drawContent, {
5010
- point: p,
5011
- select: false,
5012
- preserveIds: true
5013
- });
5014
- const stickyFixes = [];
5015
- for (const draft of drawContent.shapes) {
5016
- if (draft.type !== "note") continue;
5017
- const growY = draft.meta?.miroNoteGrowY;
5018
- if (typeof growY !== "number") continue;
5019
- const live = editor.getShape(draft.id);
5020
- if (!live || live.type !== "note") continue;
5021
- const draftAlign = draft.props.verticalAlign ?? "middle";
5022
- const liveAdj = live.props.fontSizeAdjustment ?? 0.9;
5023
- const autoGrowY = live.props.growY ?? 0;
5024
- let fontSizeAdjustment = Math.min(liveAdj, 0.9);
5025
- if (autoGrowY > growY + 1) {
5026
- const ratio = (200 + growY) / (200 + autoGrowY);
5027
- fontSizeAdjustment = Math.max(0.35, fontSizeAdjustment * ratio);
5028
- }
5029
- stickyFixes.push({
5030
- id: draft.id,
5031
- type: "note",
5032
- props: {
5033
- growY,
5034
- verticalAlign: draftAlign,
5035
- fontSizeAdjustment
5036
- }
5037
- });
5038
- }
5039
- if (stickyFixes.length) {
5040
- editor.updateShapes(stickyFixes);
5041
- }
5042
- alignShapesToMiroCenters(editor, drawContent.shapes);
5043
- const previousTool = editor.getCurrentToolId();
5044
- if (groupMemberIds.size > 0 && previousTool !== "select") {
5045
- editor.setCurrentTool("select");
5046
- }
5047
- for (const memberIds of groupMemberIds.values()) {
5048
- const existing = memberIds.filter((id) => editor.getShape(id));
5049
- if (existing.length > 1) {
5050
- editor.groupShapes(existing, { select: false });
5051
- }
5052
- }
5053
- if (previousTool !== "select" && previousTool) {
5054
- editor.setCurrentTool(previousTool);
5055
- }
5056
- const createdIds = drawContent.shapes.map((s) => s.id).filter((id) => editor.getShape(id));
5057
- if (createdIds.length) {
5058
- editor.select(...createdIds);
5059
- editor.setCurrentTool("select");
5060
- }
5061
- const widgetTypes = Array.from(
5062
- new Set(
5063
- drawContent.shapes.map((s) => s.meta?.miroWidgetType).filter((t2) => typeof t2 === "string" && t2.length > 0)
5064
- )
5065
- );
5066
- return {
5067
- shapeCount: createdIds.length,
5068
- shapeIds: createdIds,
5069
- widgetTypes,
5070
- miroBoardId: miroClipboardContent.boardId ?? null,
5071
- miroHost: miroClipboardContent.host ?? null
5072
- };
5073
- }
5074
- function resolveLineEndpoint(endpoint, bounds) {
5075
- if (!endpoint) return null;
5076
- const widgetIndex = endpoint.widgetIndex;
5077
- if (typeof widgetIndex === "number" && widgetIndex >= 0) {
5078
- const box = bounds.get(widgetIndex);
5079
- if (box) {
5080
- if (isNormalizedAnchor(endpoint.point)) {
5081
- return {
5082
- x: box.x + readNumber(endpoint.point.x) * box.w,
5083
- y: box.y + readNumber(endpoint.point.y) * box.h
5084
- };
5085
- }
5086
- return box.center;
5087
- }
5088
- }
5089
- if (endpoint.point && (endpoint.point.x !== void 0 || endpoint.point.y !== void 0)) {
5090
- return { x: readNumber(endpoint.point.x), y: readNumber(endpoint.point.y) };
5091
- }
5092
- return null;
5093
- }
5094
-
5095
3962
  // src/lib/shapes/shared/TextHelpers.ts
5096
3963
  var INDENT = " ";
5097
3964
  var TextHelpers = class _TextHelpers {
@@ -5190,9 +4057,6 @@ function registerDefaultExternalContentHandlers(editor, options) {
5190
4057
  editor.registerExternalContentHandler("excalidraw", async (externalContent) => {
5191
4058
  return defaultHandleExternalExcalidrawContent(editor, externalContent);
5192
4059
  });
5193
- editor.registerExternalContentHandler("miro", async (externalContent) => {
5194
- return defaultHandleExternalMiroContent(editor, externalContent);
5195
- });
5196
4060
  }
5197
4061
  async function defaultHandleExternalFileAsset(editor, { file, assetId }, options) {
5198
4062
  const isSuccess = notifyIfFileNotAllowed(editor, file, options);
@@ -5532,13 +4396,6 @@ async function defaultHandleExternalExcalidrawContent(editor, { point, content }
5532
4396
  putExcalidrawContent(editor, content, point);
5533
4397
  });
5534
4398
  }
5535
- async function defaultHandleExternalMiroContent(editor, { point, content }) {
5536
- const info = await putMiroContent(editor, content, point);
5537
- if (info) {
5538
- editor.emit("paste-miro", info);
5539
- }
5540
- return info;
5541
- }
5542
4399
  async function createShapesForAssets(editor, assets, position) {
5543
4400
  if (!assets.length) return [];
5544
4401
  const currentPoint = Vec.From(position);
@@ -7871,52 +6728,6 @@ function getLocalFiles(options) {
7871
6728
  input?.click();
7872
6729
  });
7873
6730
  }
7874
-
7875
- // src/features/clipboard/miro/decodeMiroData.ts
7876
- var MIRO_DATA_RE = /\(miro-data-v(\d+)\)([\s\S]*?)\(\/miro-data-v\1\)/;
7877
- var DEFAULT_OFFSET = 59;
7878
- function extractMiroDataPayload(htmlOrMeta) {
7879
- const match = htmlOrMeta.match(MIRO_DATA_RE);
7880
- if (!match) return null;
7881
- return { version: Number(match[1]), payload: match[2] };
7882
- }
7883
- function decodeMiroDataBytes(base64Payload, encodingOffset = DEFAULT_OFFSET) {
7884
- const binary = atob(base64Payload);
7885
- const out = new Uint8Array(binary.length);
7886
- for (let i = 0; i < binary.length; i++) {
7887
- const code = binary.charCodeAt(i);
7888
- out[i] = (code - encodingOffset + 256) % 256;
7889
- }
7890
- return out;
7891
- }
7892
- function decodeMiroClipboardHtml(htmlOrMeta, encodingOffset = DEFAULT_OFFSET) {
7893
- const extracted = extractMiroDataPayload(htmlOrMeta);
7894
- if (!extracted) return null;
7895
- try {
7896
- const bytes = decodeMiroDataBytes(extracted.payload.trim(), encodingOffset);
7897
- const json = new TextDecoder().decode(bytes);
7898
- return JSON.parse(json);
7899
- } catch {
7900
- return null;
7901
- }
7902
- }
7903
- function summarizeMiroClipboard(root) {
7904
- const objects = root.data?.objects ?? [];
7905
- const widgetTypes = objects.map((o) => {
7906
- if (o.type === 10) return "group";
7907
- return o.widgetData?.type ?? `objectType:${o.type ?? "?"}`;
7908
- });
7909
- return {
7910
- boardId: root.boardId ?? null,
7911
- host: root.host ?? null,
7912
- version: root.version ?? null,
7913
- isProtected: root.isProtected ?? null,
7914
- objectCount: objects.length,
7915
- widgetTypes,
7916
- hasShift: Boolean(root.data?.shift),
7917
- shift: root.data?.shift ?? null
7918
- };
7919
- }
7920
6731
  var DRAW_CUSTOM_PNG_MIME_TYPE = "web image/vnd.draw+png";
7921
6732
  var additionalClipboardWriteTypes = {
7922
6733
  png: DRAW_CUSTOM_PNG_MIME_TYPE
@@ -8282,13 +7093,6 @@ async function handleClipboardThings(editor, things, point, clipboardPasteSource
8282
7093
  return;
8283
7094
  }
8284
7095
  } else {
8285
- if (thing.type === "html" || text.includes("miro-data-v")) {
8286
- const miro = decodeMiroClipboardHtml(text);
8287
- if (miro) {
8288
- r({ type: "miro", data: miro });
8289
- return;
8290
- }
8291
- }
8292
7096
  if (thing.type === "html") {
8293
7097
  r({ type: "text", data: text, subtype: "html" });
8294
7098
  return;
@@ -8338,29 +7142,8 @@ async function handleClipboardThings(editor, things, point, clipboardPasteSource
8338
7142
  return;
8339
7143
  }
8340
7144
  }
8341
- for (const result of results) {
8342
- if (result.type === "miro") {
8343
- editor.markHistoryStoppingPoint("paste");
8344
- putPastedExternalContent(
8345
- editor,
8346
- { type: "miro", content: result.data, point },
8347
- { source: clipboardPasteSource, point }
8348
- );
8349
- return;
8350
- }
8351
- }
8352
7145
  for (const result of results) {
8353
7146
  if (result.type === "text" && result.subtype === "html") {
8354
- const miro = decodeMiroClipboardHtml(result.data);
8355
- if (miro) {
8356
- editor.markHistoryStoppingPoint("paste");
8357
- putPastedExternalContent(
8358
- editor,
8359
- { type: "miro", content: miro, point },
8360
- { source: clipboardPasteSource, point }
8361
- );
8362
- return;
8363
- }
8364
7147
  const rootNode = new DOMParser().parseFromString(result.data, "text/html");
8365
7148
  const bodyNode = rootNode.querySelector("body");
8366
7149
  const iframeInfo = extractIframeFromHtml(result.data);
@@ -25656,7 +24439,8 @@ var RichTextLabel = React4__default.memo(function RichTextLabel2({
25656
24439
  textWidth,
25657
24440
  textHeight,
25658
24441
  hasCustomTabBehavior,
25659
- showTextOutline = true
24442
+ showTextOutline = true,
24443
+ openLinksOnClick = true
25660
24444
  }) {
25661
24445
  const editor = useEditor();
25662
24446
  const isDragging = React4__default.useRef(false);
@@ -25685,7 +24469,7 @@ var RichTextLabel = React4__default.memo(function RichTextLabel2({
25685
24469
  const HTMLElementCtor = editor.getContainerWindow().HTMLElement;
25686
24470
  if (e.target instanceof HTMLElementCtor && (e.target.tagName === "A" || e.target.closest("a"))) {
25687
24471
  preventDefault(e);
25688
- if (!selectToolActive) return;
24472
+ if (!openLinksOnClick || !selectToolActive) return;
25689
24473
  const link = e.target.closest("a")?.getAttribute("href") ?? "";
25690
24474
  const handlePointerUp = (e2) => {
25691
24475
  if (e2.name !== "pointer_up" || !link) return;
@@ -25697,6 +24481,13 @@ var RichTextLabel = React4__default.memo(function RichTextLabel2({
25697
24481
  editor.on("event", handlePointerUp);
25698
24482
  }
25699
24483
  };
24484
+ const handleClick = (e) => {
24485
+ if (openLinksOnClick) return;
24486
+ const HTMLElementCtor = editor.getContainerWindow().HTMLElement;
24487
+ if (e.target instanceof HTMLElementCtor && (e.target.tagName === "A" || e.target.closest("a"))) {
24488
+ preventDefault(e);
24489
+ }
24490
+ };
25700
24491
  if (!isEditing && isEmpty) return null;
25701
24492
  const cssPrefix = classNamePrefix || "dr-text";
25702
24493
  return /* @__PURE__ */ jsx(
@@ -25740,6 +24531,7 @@ var RichTextLabel = React4__default.memo(function RichTextLabel2({
25740
24531
  "data-is-select-tool-active": selectToolActive,
25741
24532
  dangerouslySetInnerHTML: { __html: html || "" },
25742
24533
  onPointerDown: handlePointerDown,
24534
+ onClick: handleClick,
25743
24535
  "data-is-ready-for-editing": isReadyForEditing
25744
24536
  }
25745
24537
  ) }),
@@ -26527,6 +25319,7 @@ var ArrowShapeUtil = class extends ShapeUtil {
26527
25319
  return editor.inputs.getCtrlKey();
26528
25320
  },
26529
25321
  showTextOutline: true,
25322
+ openLinksOnClick: true,
26530
25323
  getDefaultDisplayValues(_editor, shape, theme, colorMode) {
26531
25324
  const { color, fill, labelColor, size, font } = shape.props;
26532
25325
  const colors = theme.colors[colorMode];
@@ -27077,6 +25870,7 @@ var ArrowShapeUtil = class extends ShapeUtil {
27077
25870
  isSelected,
27078
25871
  padding: 0,
27079
25872
  showTextOutline: this.options.showTextOutline,
25873
+ openLinksOnClick: this.options.openLinksOnClick,
27080
25874
  style: {
27081
25875
  transform: `translate(${labelPosition.box.center.x}px, ${labelPosition.box.center.y}px)${shape.props.scale !== 1 ? ` scale(${shape.props.scale})` : ""}`
27082
25876
  }
@@ -31343,6 +30137,7 @@ var TextShapeUtil = class extends ShapeUtil {
31343
30137
  options = {
31344
30138
  extraArrowHorizontalPadding: 10,
31345
30139
  showTextOutline: true,
30140
+ openLinksOnClick: true,
31346
30141
  getDefaultDisplayValues(_editor, shape, theme, colorMode) {
31347
30142
  const { color, font, size } = shape.props;
31348
30143
  return {
@@ -31432,6 +30227,7 @@ var TextShapeUtil = class extends ShapeUtil {
31432
30227
  textWidth: width,
31433
30228
  textHeight: height,
31434
30229
  showTextOutline: this.options.showTextOutline,
30230
+ openLinksOnClick: this.options.openLinksOnClick,
31435
30231
  style: {
31436
30232
  transform: `scale(${scale})`,
31437
30233
  transformOrigin: "top left"
@@ -38447,7 +37243,7 @@ async function extractAssets(editor, snapshot, msg, addToast) {
38447
37243
  // src/index.ts
38448
37244
  registerDrawLibraryVersion(
38449
37245
  "@ibodr/draw",
38450
- "0.2.0",
37246
+ "0.2.1",
38451
37247
  "esm"
38452
37248
  );
38453
37249
  /*!
@@ -38471,6 +37267,6 @@ registerDrawLibraryVersion(
38471
37267
  * Source: https://github.com/jaywcjlove/hotkeys-js
38472
37268
  */
38473
37269
 
38474
- 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 };
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 };
38475
37271
  //# sourceMappingURL=index.mjs.map
38476
37272
  //# sourceMappingURL=index.mjs.map