microboard-temp 0.14.16 → 0.14.17
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/cjs/browser.js +206 -2
- package/dist/cjs/index.js +206 -2
- package/dist/cjs/node.js +206 -2
- package/dist/esm/browser.js +206 -2
- package/dist/esm/index.js +206 -2
- package/dist/esm/node.js +206 -2
- package/dist/types/Board.d.ts +5 -0
- package/dist/types/Import/Miro/MiroItemConverter.d.ts +43 -0
- package/dist/types/Items/AINode/AINode.d.ts +1 -0
- package/dist/types/Items/Group/Group.d.ts +3 -0
- package/dist/types/Items/Image/Image.d.ts +1 -0
- package/dist/types/Items/RichText/index.d.ts +1 -0
- package/dist/types/Items/Video/Video.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -765,6 +765,7 @@ __export(exports_browser, {
|
|
|
765
765
|
PRESENCE_CURSOR_THROTTLE: () => PRESENCE_CURSOR_THROTTLE,
|
|
766
766
|
PRESENCE_CLEANUP_USER_TIMER: () => PRESENCE_CLEANUP_USER_TIMER,
|
|
767
767
|
PRESENCE_CLEANUP_IDLE_TIMER: () => PRESENCE_CLEANUP_IDLE_TIMER,
|
|
768
|
+
MiroItemConverter: () => MiroItemConverter,
|
|
768
769
|
Mbr: () => Mbr,
|
|
769
770
|
Matrix: () => Matrix,
|
|
770
771
|
MIN_STROKE_WIDTH: () => MIN_STROKE_WIDTH,
|
|
@@ -793,6 +794,7 @@ __export(exports_browser, {
|
|
|
793
794
|
Dice: () => Dice,
|
|
794
795
|
DefaultTransformationData: () => DefaultTransformationData,
|
|
795
796
|
DefaultShapeData: () => DefaultShapeData,
|
|
797
|
+
DefaultRichTextData: () => DefaultRichTextData,
|
|
796
798
|
DefaultPlaceholderData: () => DefaultPlaceholderData,
|
|
797
799
|
DefaultImageItemData: () => DefaultImageItemData,
|
|
798
800
|
DefaultGroupData: () => DefaultGroupData,
|
|
@@ -44044,6 +44046,7 @@ class Group extends BaseItem {
|
|
|
44044
44046
|
transformationRenderBlock = undefined;
|
|
44045
44047
|
isLockedGroup = false;
|
|
44046
44048
|
static movingGroupId = null;
|
|
44049
|
+
static reparentingGroupId = null;
|
|
44047
44050
|
constructor(board, id = "") {
|
|
44048
44051
|
super(board, id);
|
|
44049
44052
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -44109,6 +44112,23 @@ class Group extends BaseItem {
|
|
|
44109
44112
|
this.apply(operation);
|
|
44110
44113
|
}
|
|
44111
44114
|
}
|
|
44115
|
+
applyAddChildren(childIds) {
|
|
44116
|
+
Group.reparentingGroupId = this.getId();
|
|
44117
|
+
super.applyAddChildren(childIds);
|
|
44118
|
+
Group.reparentingGroupId = null;
|
|
44119
|
+
for (const child of this.index?.listAll() || []) {
|
|
44120
|
+
child.subject.publish(child);
|
|
44121
|
+
}
|
|
44122
|
+
}
|
|
44123
|
+
applyRemoveChildren(childIds) {
|
|
44124
|
+
Group.reparentingGroupId = this.getId();
|
|
44125
|
+
super.applyRemoveChildren(childIds);
|
|
44126
|
+
Group.reparentingGroupId = null;
|
|
44127
|
+
for (const childId of childIds) {
|
|
44128
|
+
const child = this.board.items.getById(childId);
|
|
44129
|
+
child?.subject.publish(child);
|
|
44130
|
+
}
|
|
44131
|
+
}
|
|
44112
44132
|
setId(id) {
|
|
44113
44133
|
this.id = id;
|
|
44114
44134
|
this.transformation.setId(id);
|
|
@@ -44558,7 +44578,7 @@ class Connector2 extends BaseItem {
|
|
|
44558
44578
|
}
|
|
44559
44579
|
this.text = new RichText(this.board, this.id);
|
|
44560
44580
|
this.text.container = this.getMbr();
|
|
44561
|
-
this.text.transformation =
|
|
44581
|
+
this.text.transformation = this.transformation;
|
|
44562
44582
|
this.text.linkTo = this.linkTo;
|
|
44563
44583
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
44564
44584
|
ns: "default"
|
|
@@ -44603,6 +44623,10 @@ class Connector2 extends BaseItem {
|
|
|
44603
44623
|
observerStartPointItem = () => {
|
|
44604
44624
|
const point3 = this.startPoint;
|
|
44605
44625
|
if (point3.pointType !== "Board") {
|
|
44626
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44627
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44628
|
+
return;
|
|
44629
|
+
}
|
|
44606
44630
|
const movingGroupId = Group.movingGroupId;
|
|
44607
44631
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44608
44632
|
return;
|
|
@@ -44621,6 +44645,10 @@ class Connector2 extends BaseItem {
|
|
|
44621
44645
|
observerEndPointItem = () => {
|
|
44622
44646
|
const point3 = this.endPoint;
|
|
44623
44647
|
if (point3.pointType !== "Board") {
|
|
44648
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44649
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44650
|
+
return;
|
|
44651
|
+
}
|
|
44624
44652
|
const movingGroupId = Group.movingGroupId;
|
|
44625
44653
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44626
44654
|
return;
|
|
@@ -62063,6 +62091,9 @@ class AINode extends BaseItem {
|
|
|
62063
62091
|
getLinkTo() {
|
|
62064
62092
|
return this.linkTo.link;
|
|
62065
62093
|
}
|
|
62094
|
+
getRichText() {
|
|
62095
|
+
return this.text;
|
|
62096
|
+
}
|
|
62066
62097
|
renderButton(context) {
|
|
62067
62098
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
62068
62099
|
const { ctx } = context;
|
|
@@ -74325,7 +74356,10 @@ class Board {
|
|
|
74325
74356
|
return parseHTML(el);
|
|
74326
74357
|
}
|
|
74327
74358
|
add(item, timeStamp) {
|
|
74328
|
-
const id = this.getNewItemId();
|
|
74359
|
+
const id = item.getId() || this.getNewItemId();
|
|
74360
|
+
if (!item.getId()) {
|
|
74361
|
+
item.setId(id);
|
|
74362
|
+
}
|
|
74329
74363
|
this.emit({
|
|
74330
74364
|
class: "Board",
|
|
74331
74365
|
method: "add",
|
|
@@ -74340,6 +74374,17 @@ class Board {
|
|
|
74340
74374
|
this.handleNesting(newItem);
|
|
74341
74375
|
return newItem;
|
|
74342
74376
|
}
|
|
74377
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
74378
|
+
const id = data.id || this.getNewItemId();
|
|
74379
|
+
const fullData = { ...data, itemType, id };
|
|
74380
|
+
const item = this.createItem(id, fullData);
|
|
74381
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
74382
|
+
const conn = item;
|
|
74383
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
74384
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
74385
|
+
}
|
|
74386
|
+
return this.add(item, timeStamp);
|
|
74387
|
+
}
|
|
74343
74388
|
addLockedGroup(items) {
|
|
74344
74389
|
const id = this.getNewItemId();
|
|
74345
74390
|
const groupData = {
|
|
@@ -75209,6 +75254,165 @@ function validateTransformationData(transformationData) {
|
|
|
75209
75254
|
function validatePointData(pointData) {
|
|
75210
75255
|
return PointSchema.safeParse(pointData).success;
|
|
75211
75256
|
}
|
|
75257
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
75258
|
+
var SHAPE_TYPES = {
|
|
75259
|
+
round_rectangle: "RoundedRectangle",
|
|
75260
|
+
circle: "Circle",
|
|
75261
|
+
triangle: "Triangle",
|
|
75262
|
+
rhombus: "Rhombus",
|
|
75263
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
75264
|
+
parallelogram: "Parallelogram",
|
|
75265
|
+
star: "Star",
|
|
75266
|
+
right_arrow: "ArrowRight",
|
|
75267
|
+
left_arrow: "ArrowLeft",
|
|
75268
|
+
rectangle: "Rectangle",
|
|
75269
|
+
left_right_arrow: "ArrowLeftRight",
|
|
75270
|
+
pentagon: "Pentagon",
|
|
75271
|
+
octagon: "Octagon",
|
|
75272
|
+
hexagon: "Hexagon",
|
|
75273
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
75274
|
+
trapezoid: "Trapezoid",
|
|
75275
|
+
cloud: "Cloud",
|
|
75276
|
+
cross: "Cross",
|
|
75277
|
+
can: "Cylinder",
|
|
75278
|
+
left_brace: "BracesRight",
|
|
75279
|
+
right_brace: "BracesLeft"
|
|
75280
|
+
};
|
|
75281
|
+
var BORDER_STYLES = {
|
|
75282
|
+
normal: "solid",
|
|
75283
|
+
dotted: "dot",
|
|
75284
|
+
dashed: "dash"
|
|
75285
|
+
};
|
|
75286
|
+
var STICKER_COLOR_MAP = {
|
|
75287
|
+
dark_blue: 2,
|
|
75288
|
+
blue: 2,
|
|
75289
|
+
light_blue: 3,
|
|
75290
|
+
red: 1,
|
|
75291
|
+
orange: 6,
|
|
75292
|
+
violet: 0,
|
|
75293
|
+
pink: 1,
|
|
75294
|
+
light_pink: 1,
|
|
75295
|
+
cyan: 5,
|
|
75296
|
+
dark_green: 4,
|
|
75297
|
+
green: 4,
|
|
75298
|
+
light_green: 4,
|
|
75299
|
+
yellow: 7,
|
|
75300
|
+
light_yellow: 7,
|
|
75301
|
+
gray: 8,
|
|
75302
|
+
black: 9
|
|
75303
|
+
};
|
|
75304
|
+
var FRAME_TYPES2 = {
|
|
75305
|
+
custom: "Custom",
|
|
75306
|
+
a4: "A4",
|
|
75307
|
+
letter: "Letter",
|
|
75308
|
+
ratio_16x9: "Frame16x9",
|
|
75309
|
+
ratio_4x3: "Frame4x3",
|
|
75310
|
+
ratio_1x1: "Frame1x1",
|
|
75311
|
+
phone: "Custom",
|
|
75312
|
+
tablet: "Custom",
|
|
75313
|
+
desktop: "Custom"
|
|
75314
|
+
};
|
|
75315
|
+
var CONNECTOR_LINE_STYLES = {
|
|
75316
|
+
straight: "straight",
|
|
75317
|
+
curved: "curved",
|
|
75318
|
+
elbowed: "orthogonal"
|
|
75319
|
+
};
|
|
75320
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
75321
|
+
stealth: "ArrowBroad",
|
|
75322
|
+
"Arc Arrow": "ArrowThin",
|
|
75323
|
+
filled_triangle: "Angle",
|
|
75324
|
+
arrow: "ArrowThin",
|
|
75325
|
+
triangle: "TriangleEmpty",
|
|
75326
|
+
filled_diamond: "DiamondFilled",
|
|
75327
|
+
diamond: "DiamondEmpty",
|
|
75328
|
+
filled_oval: "CircleFilled",
|
|
75329
|
+
oval: "Zero",
|
|
75330
|
+
erd_one: "One",
|
|
75331
|
+
erd_many: "Many",
|
|
75332
|
+
erd_one_or_many: "ManyMandatory",
|
|
75333
|
+
erd_only_one: "OneMandatory",
|
|
75334
|
+
erd_zero_or_many: "ManyOptional",
|
|
75335
|
+
erd_zero_or_one: "OneOptional"
|
|
75336
|
+
};
|
|
75337
|
+
|
|
75338
|
+
class MiroItemConverter {
|
|
75339
|
+
static convert(miroItem) {
|
|
75340
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
75341
|
+
const baseData = {
|
|
75342
|
+
id,
|
|
75343
|
+
parent: parent?.id || "Board",
|
|
75344
|
+
linkTo
|
|
75345
|
+
};
|
|
75346
|
+
switch (type) {
|
|
75347
|
+
case "shape":
|
|
75348
|
+
return {
|
|
75349
|
+
...baseData,
|
|
75350
|
+
itemType: "Shape",
|
|
75351
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
75352
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
75353
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
75354
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
75355
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
75356
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
75357
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
75358
|
+
};
|
|
75359
|
+
case "sticky_note":
|
|
75360
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
75361
|
+
return {
|
|
75362
|
+
...baseData,
|
|
75363
|
+
itemType: "Sticker",
|
|
75364
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
75365
|
+
};
|
|
75366
|
+
case "text":
|
|
75367
|
+
return {
|
|
75368
|
+
...baseData,
|
|
75369
|
+
itemType: "RichText"
|
|
75370
|
+
};
|
|
75371
|
+
case "frame":
|
|
75372
|
+
return {
|
|
75373
|
+
...baseData,
|
|
75374
|
+
itemType: "Frame",
|
|
75375
|
+
title: data?.title || "Frame",
|
|
75376
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
75377
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
75378
|
+
};
|
|
75379
|
+
case "connector":
|
|
75380
|
+
return {
|
|
75381
|
+
...baseData,
|
|
75382
|
+
itemType: "Connector",
|
|
75383
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
75384
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
75385
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
75386
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
75387
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
75388
|
+
};
|
|
75389
|
+
case "image":
|
|
75390
|
+
return {
|
|
75391
|
+
...baseData,
|
|
75392
|
+
itemType: "Image"
|
|
75393
|
+
};
|
|
75394
|
+
case "paint":
|
|
75395
|
+
return {
|
|
75396
|
+
...baseData,
|
|
75397
|
+
itemType: "Drawing",
|
|
75398
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
75399
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
75400
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
75401
|
+
};
|
|
75402
|
+
default:
|
|
75403
|
+
return {
|
|
75404
|
+
...baseData,
|
|
75405
|
+
itemType: "Placeholder"
|
|
75406
|
+
};
|
|
75407
|
+
}
|
|
75408
|
+
}
|
|
75409
|
+
static convertColor(color2, fallback = "black") {
|
|
75410
|
+
if (!color2)
|
|
75411
|
+
return coerceColorValue(fallback);
|
|
75412
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
75413
|
+
return coerceColorValue(hex3);
|
|
75414
|
+
}
|
|
75415
|
+
}
|
|
75212
75416
|
// src/api/initI18N.ts
|
|
75213
75417
|
function initI18N(i18nInstance) {
|
|
75214
75418
|
conf.i18n = i18nInstance;
|
package/dist/cjs/index.js
CHANGED
|
@@ -765,6 +765,7 @@ __export(exports_src, {
|
|
|
765
765
|
PRESENCE_CURSOR_THROTTLE: () => PRESENCE_CURSOR_THROTTLE,
|
|
766
766
|
PRESENCE_CLEANUP_USER_TIMER: () => PRESENCE_CLEANUP_USER_TIMER,
|
|
767
767
|
PRESENCE_CLEANUP_IDLE_TIMER: () => PRESENCE_CLEANUP_IDLE_TIMER,
|
|
768
|
+
MiroItemConverter: () => MiroItemConverter,
|
|
768
769
|
Mbr: () => Mbr,
|
|
769
770
|
Matrix: () => Matrix,
|
|
770
771
|
MIN_STROKE_WIDTH: () => MIN_STROKE_WIDTH,
|
|
@@ -793,6 +794,7 @@ __export(exports_src, {
|
|
|
793
794
|
Dice: () => Dice,
|
|
794
795
|
DefaultTransformationData: () => DefaultTransformationData,
|
|
795
796
|
DefaultShapeData: () => DefaultShapeData,
|
|
797
|
+
DefaultRichTextData: () => DefaultRichTextData,
|
|
796
798
|
DefaultPlaceholderData: () => DefaultPlaceholderData,
|
|
797
799
|
DefaultImageItemData: () => DefaultImageItemData,
|
|
798
800
|
DefaultGroupData: () => DefaultGroupData,
|
|
@@ -44044,6 +44046,7 @@ class Group extends BaseItem {
|
|
|
44044
44046
|
transformationRenderBlock = undefined;
|
|
44045
44047
|
isLockedGroup = false;
|
|
44046
44048
|
static movingGroupId = null;
|
|
44049
|
+
static reparentingGroupId = null;
|
|
44047
44050
|
constructor(board, id = "") {
|
|
44048
44051
|
super(board, id);
|
|
44049
44052
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -44109,6 +44112,23 @@ class Group extends BaseItem {
|
|
|
44109
44112
|
this.apply(operation);
|
|
44110
44113
|
}
|
|
44111
44114
|
}
|
|
44115
|
+
applyAddChildren(childIds) {
|
|
44116
|
+
Group.reparentingGroupId = this.getId();
|
|
44117
|
+
super.applyAddChildren(childIds);
|
|
44118
|
+
Group.reparentingGroupId = null;
|
|
44119
|
+
for (const child of this.index?.listAll() || []) {
|
|
44120
|
+
child.subject.publish(child);
|
|
44121
|
+
}
|
|
44122
|
+
}
|
|
44123
|
+
applyRemoveChildren(childIds) {
|
|
44124
|
+
Group.reparentingGroupId = this.getId();
|
|
44125
|
+
super.applyRemoveChildren(childIds);
|
|
44126
|
+
Group.reparentingGroupId = null;
|
|
44127
|
+
for (const childId of childIds) {
|
|
44128
|
+
const child = this.board.items.getById(childId);
|
|
44129
|
+
child?.subject.publish(child);
|
|
44130
|
+
}
|
|
44131
|
+
}
|
|
44112
44132
|
setId(id) {
|
|
44113
44133
|
this.id = id;
|
|
44114
44134
|
this.transformation.setId(id);
|
|
@@ -44558,7 +44578,7 @@ class Connector2 extends BaseItem {
|
|
|
44558
44578
|
}
|
|
44559
44579
|
this.text = new RichText(this.board, this.id);
|
|
44560
44580
|
this.text.container = this.getMbr();
|
|
44561
|
-
this.text.transformation =
|
|
44581
|
+
this.text.transformation = this.transformation;
|
|
44562
44582
|
this.text.linkTo = this.linkTo;
|
|
44563
44583
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
44564
44584
|
ns: "default"
|
|
@@ -44603,6 +44623,10 @@ class Connector2 extends BaseItem {
|
|
|
44603
44623
|
observerStartPointItem = () => {
|
|
44604
44624
|
const point3 = this.startPoint;
|
|
44605
44625
|
if (point3.pointType !== "Board") {
|
|
44626
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44627
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44628
|
+
return;
|
|
44629
|
+
}
|
|
44606
44630
|
const movingGroupId = Group.movingGroupId;
|
|
44607
44631
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44608
44632
|
return;
|
|
@@ -44621,6 +44645,10 @@ class Connector2 extends BaseItem {
|
|
|
44621
44645
|
observerEndPointItem = () => {
|
|
44622
44646
|
const point3 = this.endPoint;
|
|
44623
44647
|
if (point3.pointType !== "Board") {
|
|
44648
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44649
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44650
|
+
return;
|
|
44651
|
+
}
|
|
44624
44652
|
const movingGroupId = Group.movingGroupId;
|
|
44625
44653
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44626
44654
|
return;
|
|
@@ -62063,6 +62091,9 @@ class AINode extends BaseItem {
|
|
|
62063
62091
|
getLinkTo() {
|
|
62064
62092
|
return this.linkTo.link;
|
|
62065
62093
|
}
|
|
62094
|
+
getRichText() {
|
|
62095
|
+
return this.text;
|
|
62096
|
+
}
|
|
62066
62097
|
renderButton(context) {
|
|
62067
62098
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
62068
62099
|
const { ctx } = context;
|
|
@@ -74325,7 +74356,10 @@ class Board {
|
|
|
74325
74356
|
return parseHTML(el);
|
|
74326
74357
|
}
|
|
74327
74358
|
add(item, timeStamp) {
|
|
74328
|
-
const id = this.getNewItemId();
|
|
74359
|
+
const id = item.getId() || this.getNewItemId();
|
|
74360
|
+
if (!item.getId()) {
|
|
74361
|
+
item.setId(id);
|
|
74362
|
+
}
|
|
74329
74363
|
this.emit({
|
|
74330
74364
|
class: "Board",
|
|
74331
74365
|
method: "add",
|
|
@@ -74340,6 +74374,17 @@ class Board {
|
|
|
74340
74374
|
this.handleNesting(newItem);
|
|
74341
74375
|
return newItem;
|
|
74342
74376
|
}
|
|
74377
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
74378
|
+
const id = data.id || this.getNewItemId();
|
|
74379
|
+
const fullData = { ...data, itemType, id };
|
|
74380
|
+
const item = this.createItem(id, fullData);
|
|
74381
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
74382
|
+
const conn = item;
|
|
74383
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
74384
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
74385
|
+
}
|
|
74386
|
+
return this.add(item, timeStamp);
|
|
74387
|
+
}
|
|
74343
74388
|
addLockedGroup(items) {
|
|
74344
74389
|
const id = this.getNewItemId();
|
|
74345
74390
|
const groupData = {
|
|
@@ -75209,6 +75254,165 @@ function validateTransformationData(transformationData) {
|
|
|
75209
75254
|
function validatePointData(pointData) {
|
|
75210
75255
|
return PointSchema.safeParse(pointData).success;
|
|
75211
75256
|
}
|
|
75257
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
75258
|
+
var SHAPE_TYPES = {
|
|
75259
|
+
round_rectangle: "RoundedRectangle",
|
|
75260
|
+
circle: "Circle",
|
|
75261
|
+
triangle: "Triangle",
|
|
75262
|
+
rhombus: "Rhombus",
|
|
75263
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
75264
|
+
parallelogram: "Parallelogram",
|
|
75265
|
+
star: "Star",
|
|
75266
|
+
right_arrow: "ArrowRight",
|
|
75267
|
+
left_arrow: "ArrowLeft",
|
|
75268
|
+
rectangle: "Rectangle",
|
|
75269
|
+
left_right_arrow: "ArrowLeftRight",
|
|
75270
|
+
pentagon: "Pentagon",
|
|
75271
|
+
octagon: "Octagon",
|
|
75272
|
+
hexagon: "Hexagon",
|
|
75273
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
75274
|
+
trapezoid: "Trapezoid",
|
|
75275
|
+
cloud: "Cloud",
|
|
75276
|
+
cross: "Cross",
|
|
75277
|
+
can: "Cylinder",
|
|
75278
|
+
left_brace: "BracesRight",
|
|
75279
|
+
right_brace: "BracesLeft"
|
|
75280
|
+
};
|
|
75281
|
+
var BORDER_STYLES = {
|
|
75282
|
+
normal: "solid",
|
|
75283
|
+
dotted: "dot",
|
|
75284
|
+
dashed: "dash"
|
|
75285
|
+
};
|
|
75286
|
+
var STICKER_COLOR_MAP = {
|
|
75287
|
+
dark_blue: 2,
|
|
75288
|
+
blue: 2,
|
|
75289
|
+
light_blue: 3,
|
|
75290
|
+
red: 1,
|
|
75291
|
+
orange: 6,
|
|
75292
|
+
violet: 0,
|
|
75293
|
+
pink: 1,
|
|
75294
|
+
light_pink: 1,
|
|
75295
|
+
cyan: 5,
|
|
75296
|
+
dark_green: 4,
|
|
75297
|
+
green: 4,
|
|
75298
|
+
light_green: 4,
|
|
75299
|
+
yellow: 7,
|
|
75300
|
+
light_yellow: 7,
|
|
75301
|
+
gray: 8,
|
|
75302
|
+
black: 9
|
|
75303
|
+
};
|
|
75304
|
+
var FRAME_TYPES2 = {
|
|
75305
|
+
custom: "Custom",
|
|
75306
|
+
a4: "A4",
|
|
75307
|
+
letter: "Letter",
|
|
75308
|
+
ratio_16x9: "Frame16x9",
|
|
75309
|
+
ratio_4x3: "Frame4x3",
|
|
75310
|
+
ratio_1x1: "Frame1x1",
|
|
75311
|
+
phone: "Custom",
|
|
75312
|
+
tablet: "Custom",
|
|
75313
|
+
desktop: "Custom"
|
|
75314
|
+
};
|
|
75315
|
+
var CONNECTOR_LINE_STYLES = {
|
|
75316
|
+
straight: "straight",
|
|
75317
|
+
curved: "curved",
|
|
75318
|
+
elbowed: "orthogonal"
|
|
75319
|
+
};
|
|
75320
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
75321
|
+
stealth: "ArrowBroad",
|
|
75322
|
+
"Arc Arrow": "ArrowThin",
|
|
75323
|
+
filled_triangle: "Angle",
|
|
75324
|
+
arrow: "ArrowThin",
|
|
75325
|
+
triangle: "TriangleEmpty",
|
|
75326
|
+
filled_diamond: "DiamondFilled",
|
|
75327
|
+
diamond: "DiamondEmpty",
|
|
75328
|
+
filled_oval: "CircleFilled",
|
|
75329
|
+
oval: "Zero",
|
|
75330
|
+
erd_one: "One",
|
|
75331
|
+
erd_many: "Many",
|
|
75332
|
+
erd_one_or_many: "ManyMandatory",
|
|
75333
|
+
erd_only_one: "OneMandatory",
|
|
75334
|
+
erd_zero_or_many: "ManyOptional",
|
|
75335
|
+
erd_zero_or_one: "OneOptional"
|
|
75336
|
+
};
|
|
75337
|
+
|
|
75338
|
+
class MiroItemConverter {
|
|
75339
|
+
static convert(miroItem) {
|
|
75340
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
75341
|
+
const baseData = {
|
|
75342
|
+
id,
|
|
75343
|
+
parent: parent?.id || "Board",
|
|
75344
|
+
linkTo
|
|
75345
|
+
};
|
|
75346
|
+
switch (type) {
|
|
75347
|
+
case "shape":
|
|
75348
|
+
return {
|
|
75349
|
+
...baseData,
|
|
75350
|
+
itemType: "Shape",
|
|
75351
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
75352
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
75353
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
75354
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
75355
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
75356
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
75357
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
75358
|
+
};
|
|
75359
|
+
case "sticky_note":
|
|
75360
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
75361
|
+
return {
|
|
75362
|
+
...baseData,
|
|
75363
|
+
itemType: "Sticker",
|
|
75364
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
75365
|
+
};
|
|
75366
|
+
case "text":
|
|
75367
|
+
return {
|
|
75368
|
+
...baseData,
|
|
75369
|
+
itemType: "RichText"
|
|
75370
|
+
};
|
|
75371
|
+
case "frame":
|
|
75372
|
+
return {
|
|
75373
|
+
...baseData,
|
|
75374
|
+
itemType: "Frame",
|
|
75375
|
+
title: data?.title || "Frame",
|
|
75376
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
75377
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
75378
|
+
};
|
|
75379
|
+
case "connector":
|
|
75380
|
+
return {
|
|
75381
|
+
...baseData,
|
|
75382
|
+
itemType: "Connector",
|
|
75383
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
75384
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
75385
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
75386
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
75387
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
75388
|
+
};
|
|
75389
|
+
case "image":
|
|
75390
|
+
return {
|
|
75391
|
+
...baseData,
|
|
75392
|
+
itemType: "Image"
|
|
75393
|
+
};
|
|
75394
|
+
case "paint":
|
|
75395
|
+
return {
|
|
75396
|
+
...baseData,
|
|
75397
|
+
itemType: "Drawing",
|
|
75398
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
75399
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
75400
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
75401
|
+
};
|
|
75402
|
+
default:
|
|
75403
|
+
return {
|
|
75404
|
+
...baseData,
|
|
75405
|
+
itemType: "Placeholder"
|
|
75406
|
+
};
|
|
75407
|
+
}
|
|
75408
|
+
}
|
|
75409
|
+
static convertColor(color2, fallback = "black") {
|
|
75410
|
+
if (!color2)
|
|
75411
|
+
return coerceColorValue(fallback);
|
|
75412
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
75413
|
+
return coerceColorValue(hex3);
|
|
75414
|
+
}
|
|
75415
|
+
}
|
|
75212
75416
|
// src/api/initI18N.ts
|
|
75213
75417
|
function initI18N(i18nInstance) {
|
|
75214
75418
|
conf.i18n = i18nInstance;
|