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/node.js
CHANGED
|
@@ -1802,6 +1802,7 @@ __export(exports_node, {
|
|
|
1802
1802
|
PRESENCE_CURSOR_THROTTLE: () => PRESENCE_CURSOR_THROTTLE,
|
|
1803
1803
|
PRESENCE_CLEANUP_USER_TIMER: () => PRESENCE_CLEANUP_USER_TIMER,
|
|
1804
1804
|
PRESENCE_CLEANUP_IDLE_TIMER: () => PRESENCE_CLEANUP_IDLE_TIMER,
|
|
1805
|
+
MiroItemConverter: () => MiroItemConverter,
|
|
1805
1806
|
Mbr: () => Mbr,
|
|
1806
1807
|
Matrix: () => Matrix,
|
|
1807
1808
|
MIN_STROKE_WIDTH: () => MIN_STROKE_WIDTH,
|
|
@@ -1830,6 +1831,7 @@ __export(exports_node, {
|
|
|
1830
1831
|
Dice: () => Dice,
|
|
1831
1832
|
DefaultTransformationData: () => DefaultTransformationData,
|
|
1832
1833
|
DefaultShapeData: () => DefaultShapeData,
|
|
1834
|
+
DefaultRichTextData: () => DefaultRichTextData,
|
|
1833
1835
|
DefaultPlaceholderData: () => DefaultPlaceholderData,
|
|
1834
1836
|
DefaultImageItemData: () => DefaultImageItemData,
|
|
1835
1837
|
DefaultGroupData: () => DefaultGroupData,
|
|
@@ -46516,6 +46518,7 @@ class Group extends BaseItem {
|
|
|
46516
46518
|
transformationRenderBlock = undefined;
|
|
46517
46519
|
isLockedGroup = false;
|
|
46518
46520
|
static movingGroupId = null;
|
|
46521
|
+
static reparentingGroupId = null;
|
|
46519
46522
|
constructor(board, id = "") {
|
|
46520
46523
|
super(board, id);
|
|
46521
46524
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -46581,6 +46584,23 @@ class Group extends BaseItem {
|
|
|
46581
46584
|
this.apply(operation);
|
|
46582
46585
|
}
|
|
46583
46586
|
}
|
|
46587
|
+
applyAddChildren(childIds) {
|
|
46588
|
+
Group.reparentingGroupId = this.getId();
|
|
46589
|
+
super.applyAddChildren(childIds);
|
|
46590
|
+
Group.reparentingGroupId = null;
|
|
46591
|
+
for (const child of this.index?.listAll() || []) {
|
|
46592
|
+
child.subject.publish(child);
|
|
46593
|
+
}
|
|
46594
|
+
}
|
|
46595
|
+
applyRemoveChildren(childIds) {
|
|
46596
|
+
Group.reparentingGroupId = this.getId();
|
|
46597
|
+
super.applyRemoveChildren(childIds);
|
|
46598
|
+
Group.reparentingGroupId = null;
|
|
46599
|
+
for (const childId of childIds) {
|
|
46600
|
+
const child = this.board.items.getById(childId);
|
|
46601
|
+
child?.subject.publish(child);
|
|
46602
|
+
}
|
|
46603
|
+
}
|
|
46584
46604
|
setId(id) {
|
|
46585
46605
|
this.id = id;
|
|
46586
46606
|
this.transformation.setId(id);
|
|
@@ -47030,7 +47050,7 @@ class Connector2 extends BaseItem {
|
|
|
47030
47050
|
}
|
|
47031
47051
|
this.text = new RichText(this.board, this.id);
|
|
47032
47052
|
this.text.container = this.getMbr();
|
|
47033
|
-
this.text.transformation =
|
|
47053
|
+
this.text.transformation = this.transformation;
|
|
47034
47054
|
this.text.linkTo = this.linkTo;
|
|
47035
47055
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
47036
47056
|
ns: "default"
|
|
@@ -47075,6 +47095,10 @@ class Connector2 extends BaseItem {
|
|
|
47075
47095
|
observerStartPointItem = () => {
|
|
47076
47096
|
const point3 = this.startPoint;
|
|
47077
47097
|
if (point3.pointType !== "Board") {
|
|
47098
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
47099
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
47100
|
+
return;
|
|
47101
|
+
}
|
|
47078
47102
|
const movingGroupId = Group.movingGroupId;
|
|
47079
47103
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
47080
47104
|
return;
|
|
@@ -47093,6 +47117,10 @@ class Connector2 extends BaseItem {
|
|
|
47093
47117
|
observerEndPointItem = () => {
|
|
47094
47118
|
const point3 = this.endPoint;
|
|
47095
47119
|
if (point3.pointType !== "Board") {
|
|
47120
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
47121
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
47122
|
+
return;
|
|
47123
|
+
}
|
|
47096
47124
|
const movingGroupId = Group.movingGroupId;
|
|
47097
47125
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
47098
47126
|
return;
|
|
@@ -64536,6 +64564,9 @@ class AINode extends BaseItem {
|
|
|
64536
64564
|
getLinkTo() {
|
|
64537
64565
|
return this.linkTo.link;
|
|
64538
64566
|
}
|
|
64567
|
+
getRichText() {
|
|
64568
|
+
return this.text;
|
|
64569
|
+
}
|
|
64539
64570
|
renderButton(context) {
|
|
64540
64571
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
64541
64572
|
const { ctx } = context;
|
|
@@ -76798,7 +76829,10 @@ class Board {
|
|
|
76798
76829
|
return parseHTML(el);
|
|
76799
76830
|
}
|
|
76800
76831
|
add(item, timeStamp) {
|
|
76801
|
-
const id = this.getNewItemId();
|
|
76832
|
+
const id = item.getId() || this.getNewItemId();
|
|
76833
|
+
if (!item.getId()) {
|
|
76834
|
+
item.setId(id);
|
|
76835
|
+
}
|
|
76802
76836
|
this.emit({
|
|
76803
76837
|
class: "Board",
|
|
76804
76838
|
method: "add",
|
|
@@ -76813,6 +76847,17 @@ class Board {
|
|
|
76813
76847
|
this.handleNesting(newItem);
|
|
76814
76848
|
return newItem;
|
|
76815
76849
|
}
|
|
76850
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
76851
|
+
const id = data.id || this.getNewItemId();
|
|
76852
|
+
const fullData = { ...data, itemType, id };
|
|
76853
|
+
const item = this.createItem(id, fullData);
|
|
76854
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
76855
|
+
const conn = item;
|
|
76856
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
76857
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
76858
|
+
}
|
|
76859
|
+
return this.add(item, timeStamp);
|
|
76860
|
+
}
|
|
76816
76861
|
addLockedGroup(items) {
|
|
76817
76862
|
const id = this.getNewItemId();
|
|
76818
76863
|
const groupData = {
|
|
@@ -77682,6 +77727,165 @@ function validateTransformationData(transformationData) {
|
|
|
77682
77727
|
function validatePointData(pointData) {
|
|
77683
77728
|
return PointSchema.safeParse(pointData).success;
|
|
77684
77729
|
}
|
|
77730
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
77731
|
+
var SHAPE_TYPES = {
|
|
77732
|
+
round_rectangle: "RoundedRectangle",
|
|
77733
|
+
circle: "Circle",
|
|
77734
|
+
triangle: "Triangle",
|
|
77735
|
+
rhombus: "Rhombus",
|
|
77736
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
77737
|
+
parallelogram: "Parallelogram",
|
|
77738
|
+
star: "Star",
|
|
77739
|
+
right_arrow: "ArrowRight",
|
|
77740
|
+
left_arrow: "ArrowLeft",
|
|
77741
|
+
rectangle: "Rectangle",
|
|
77742
|
+
left_right_arrow: "ArrowLeftRight",
|
|
77743
|
+
pentagon: "Pentagon",
|
|
77744
|
+
octagon: "Octagon",
|
|
77745
|
+
hexagon: "Hexagon",
|
|
77746
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
77747
|
+
trapezoid: "Trapezoid",
|
|
77748
|
+
cloud: "Cloud",
|
|
77749
|
+
cross: "Cross",
|
|
77750
|
+
can: "Cylinder",
|
|
77751
|
+
left_brace: "BracesRight",
|
|
77752
|
+
right_brace: "BracesLeft"
|
|
77753
|
+
};
|
|
77754
|
+
var BORDER_STYLES = {
|
|
77755
|
+
normal: "solid",
|
|
77756
|
+
dotted: "dot",
|
|
77757
|
+
dashed: "dash"
|
|
77758
|
+
};
|
|
77759
|
+
var STICKER_COLOR_MAP = {
|
|
77760
|
+
dark_blue: 2,
|
|
77761
|
+
blue: 2,
|
|
77762
|
+
light_blue: 3,
|
|
77763
|
+
red: 1,
|
|
77764
|
+
orange: 6,
|
|
77765
|
+
violet: 0,
|
|
77766
|
+
pink: 1,
|
|
77767
|
+
light_pink: 1,
|
|
77768
|
+
cyan: 5,
|
|
77769
|
+
dark_green: 4,
|
|
77770
|
+
green: 4,
|
|
77771
|
+
light_green: 4,
|
|
77772
|
+
yellow: 7,
|
|
77773
|
+
light_yellow: 7,
|
|
77774
|
+
gray: 8,
|
|
77775
|
+
black: 9
|
|
77776
|
+
};
|
|
77777
|
+
var FRAME_TYPES2 = {
|
|
77778
|
+
custom: "Custom",
|
|
77779
|
+
a4: "A4",
|
|
77780
|
+
letter: "Letter",
|
|
77781
|
+
ratio_16x9: "Frame16x9",
|
|
77782
|
+
ratio_4x3: "Frame4x3",
|
|
77783
|
+
ratio_1x1: "Frame1x1",
|
|
77784
|
+
phone: "Custom",
|
|
77785
|
+
tablet: "Custom",
|
|
77786
|
+
desktop: "Custom"
|
|
77787
|
+
};
|
|
77788
|
+
var CONNECTOR_LINE_STYLES = {
|
|
77789
|
+
straight: "straight",
|
|
77790
|
+
curved: "curved",
|
|
77791
|
+
elbowed: "orthogonal"
|
|
77792
|
+
};
|
|
77793
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
77794
|
+
stealth: "ArrowBroad",
|
|
77795
|
+
"Arc Arrow": "ArrowThin",
|
|
77796
|
+
filled_triangle: "Angle",
|
|
77797
|
+
arrow: "ArrowThin",
|
|
77798
|
+
triangle: "TriangleEmpty",
|
|
77799
|
+
filled_diamond: "DiamondFilled",
|
|
77800
|
+
diamond: "DiamondEmpty",
|
|
77801
|
+
filled_oval: "CircleFilled",
|
|
77802
|
+
oval: "Zero",
|
|
77803
|
+
erd_one: "One",
|
|
77804
|
+
erd_many: "Many",
|
|
77805
|
+
erd_one_or_many: "ManyMandatory",
|
|
77806
|
+
erd_only_one: "OneMandatory",
|
|
77807
|
+
erd_zero_or_many: "ManyOptional",
|
|
77808
|
+
erd_zero_or_one: "OneOptional"
|
|
77809
|
+
};
|
|
77810
|
+
|
|
77811
|
+
class MiroItemConverter {
|
|
77812
|
+
static convert(miroItem) {
|
|
77813
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
77814
|
+
const baseData = {
|
|
77815
|
+
id,
|
|
77816
|
+
parent: parent?.id || "Board",
|
|
77817
|
+
linkTo
|
|
77818
|
+
};
|
|
77819
|
+
switch (type) {
|
|
77820
|
+
case "shape":
|
|
77821
|
+
return {
|
|
77822
|
+
...baseData,
|
|
77823
|
+
itemType: "Shape",
|
|
77824
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
77825
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
77826
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
77827
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
77828
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
77829
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
77830
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
77831
|
+
};
|
|
77832
|
+
case "sticky_note":
|
|
77833
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
77834
|
+
return {
|
|
77835
|
+
...baseData,
|
|
77836
|
+
itemType: "Sticker",
|
|
77837
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
77838
|
+
};
|
|
77839
|
+
case "text":
|
|
77840
|
+
return {
|
|
77841
|
+
...baseData,
|
|
77842
|
+
itemType: "RichText"
|
|
77843
|
+
};
|
|
77844
|
+
case "frame":
|
|
77845
|
+
return {
|
|
77846
|
+
...baseData,
|
|
77847
|
+
itemType: "Frame",
|
|
77848
|
+
title: data?.title || "Frame",
|
|
77849
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
77850
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
77851
|
+
};
|
|
77852
|
+
case "connector":
|
|
77853
|
+
return {
|
|
77854
|
+
...baseData,
|
|
77855
|
+
itemType: "Connector",
|
|
77856
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
77857
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
77858
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
77859
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
77860
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
77861
|
+
};
|
|
77862
|
+
case "image":
|
|
77863
|
+
return {
|
|
77864
|
+
...baseData,
|
|
77865
|
+
itemType: "Image"
|
|
77866
|
+
};
|
|
77867
|
+
case "paint":
|
|
77868
|
+
return {
|
|
77869
|
+
...baseData,
|
|
77870
|
+
itemType: "Drawing",
|
|
77871
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
77872
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
77873
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
77874
|
+
};
|
|
77875
|
+
default:
|
|
77876
|
+
return {
|
|
77877
|
+
...baseData,
|
|
77878
|
+
itemType: "Placeholder"
|
|
77879
|
+
};
|
|
77880
|
+
}
|
|
77881
|
+
}
|
|
77882
|
+
static convertColor(color2, fallback = "black") {
|
|
77883
|
+
if (!color2)
|
|
77884
|
+
return coerceColorValue(fallback);
|
|
77885
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
77886
|
+
return coerceColorValue(hex3);
|
|
77887
|
+
}
|
|
77888
|
+
}
|
|
77685
77889
|
// src/api/initI18N.ts
|
|
77686
77890
|
function initI18N(i18nInstance) {
|
|
77687
77891
|
conf.i18n = i18nInstance;
|
package/dist/esm/browser.js
CHANGED
|
@@ -43841,6 +43841,7 @@ class Group extends BaseItem {
|
|
|
43841
43841
|
transformationRenderBlock = undefined;
|
|
43842
43842
|
isLockedGroup = false;
|
|
43843
43843
|
static movingGroupId = null;
|
|
43844
|
+
static reparentingGroupId = null;
|
|
43844
43845
|
constructor(board, id = "") {
|
|
43845
43846
|
super(board, id);
|
|
43846
43847
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -43906,6 +43907,23 @@ class Group extends BaseItem {
|
|
|
43906
43907
|
this.apply(operation);
|
|
43907
43908
|
}
|
|
43908
43909
|
}
|
|
43910
|
+
applyAddChildren(childIds) {
|
|
43911
|
+
Group.reparentingGroupId = this.getId();
|
|
43912
|
+
super.applyAddChildren(childIds);
|
|
43913
|
+
Group.reparentingGroupId = null;
|
|
43914
|
+
for (const child of this.index?.listAll() || []) {
|
|
43915
|
+
child.subject.publish(child);
|
|
43916
|
+
}
|
|
43917
|
+
}
|
|
43918
|
+
applyRemoveChildren(childIds) {
|
|
43919
|
+
Group.reparentingGroupId = this.getId();
|
|
43920
|
+
super.applyRemoveChildren(childIds);
|
|
43921
|
+
Group.reparentingGroupId = null;
|
|
43922
|
+
for (const childId of childIds) {
|
|
43923
|
+
const child = this.board.items.getById(childId);
|
|
43924
|
+
child?.subject.publish(child);
|
|
43925
|
+
}
|
|
43926
|
+
}
|
|
43909
43927
|
setId(id) {
|
|
43910
43928
|
this.id = id;
|
|
43911
43929
|
this.transformation.setId(id);
|
|
@@ -44355,7 +44373,7 @@ class Connector2 extends BaseItem {
|
|
|
44355
44373
|
}
|
|
44356
44374
|
this.text = new RichText(this.board, this.id);
|
|
44357
44375
|
this.text.container = this.getMbr();
|
|
44358
|
-
this.text.transformation =
|
|
44376
|
+
this.text.transformation = this.transformation;
|
|
44359
44377
|
this.text.linkTo = this.linkTo;
|
|
44360
44378
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
44361
44379
|
ns: "default"
|
|
@@ -44400,6 +44418,10 @@ class Connector2 extends BaseItem {
|
|
|
44400
44418
|
observerStartPointItem = () => {
|
|
44401
44419
|
const point3 = this.startPoint;
|
|
44402
44420
|
if (point3.pointType !== "Board") {
|
|
44421
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44422
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44423
|
+
return;
|
|
44424
|
+
}
|
|
44403
44425
|
const movingGroupId = Group.movingGroupId;
|
|
44404
44426
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44405
44427
|
return;
|
|
@@ -44418,6 +44440,10 @@ class Connector2 extends BaseItem {
|
|
|
44418
44440
|
observerEndPointItem = () => {
|
|
44419
44441
|
const point3 = this.endPoint;
|
|
44420
44442
|
if (point3.pointType !== "Board") {
|
|
44443
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44444
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44445
|
+
return;
|
|
44446
|
+
}
|
|
44421
44447
|
const movingGroupId = Group.movingGroupId;
|
|
44422
44448
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44423
44449
|
return;
|
|
@@ -61860,6 +61886,9 @@ class AINode extends BaseItem {
|
|
|
61860
61886
|
getLinkTo() {
|
|
61861
61887
|
return this.linkTo.link;
|
|
61862
61888
|
}
|
|
61889
|
+
getRichText() {
|
|
61890
|
+
return this.text;
|
|
61891
|
+
}
|
|
61863
61892
|
renderButton(context) {
|
|
61864
61893
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
61865
61894
|
const { ctx } = context;
|
|
@@ -74122,7 +74151,10 @@ class Board {
|
|
|
74122
74151
|
return parseHTML(el);
|
|
74123
74152
|
}
|
|
74124
74153
|
add(item, timeStamp) {
|
|
74125
|
-
const id = this.getNewItemId();
|
|
74154
|
+
const id = item.getId() || this.getNewItemId();
|
|
74155
|
+
if (!item.getId()) {
|
|
74156
|
+
item.setId(id);
|
|
74157
|
+
}
|
|
74126
74158
|
this.emit({
|
|
74127
74159
|
class: "Board",
|
|
74128
74160
|
method: "add",
|
|
@@ -74137,6 +74169,17 @@ class Board {
|
|
|
74137
74169
|
this.handleNesting(newItem);
|
|
74138
74170
|
return newItem;
|
|
74139
74171
|
}
|
|
74172
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
74173
|
+
const id = data.id || this.getNewItemId();
|
|
74174
|
+
const fullData = { ...data, itemType, id };
|
|
74175
|
+
const item = this.createItem(id, fullData);
|
|
74176
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
74177
|
+
const conn = item;
|
|
74178
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
74179
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
74180
|
+
}
|
|
74181
|
+
return this.add(item, timeStamp);
|
|
74182
|
+
}
|
|
74140
74183
|
addLockedGroup(items) {
|
|
74141
74184
|
const id = this.getNewItemId();
|
|
74142
74185
|
const groupData = {
|
|
@@ -75006,6 +75049,165 @@ function validateTransformationData(transformationData) {
|
|
|
75006
75049
|
function validatePointData(pointData) {
|
|
75007
75050
|
return PointSchema.safeParse(pointData).success;
|
|
75008
75051
|
}
|
|
75052
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
75053
|
+
var SHAPE_TYPES = {
|
|
75054
|
+
round_rectangle: "RoundedRectangle",
|
|
75055
|
+
circle: "Circle",
|
|
75056
|
+
triangle: "Triangle",
|
|
75057
|
+
rhombus: "Rhombus",
|
|
75058
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
75059
|
+
parallelogram: "Parallelogram",
|
|
75060
|
+
star: "Star",
|
|
75061
|
+
right_arrow: "ArrowRight",
|
|
75062
|
+
left_arrow: "ArrowLeft",
|
|
75063
|
+
rectangle: "Rectangle",
|
|
75064
|
+
left_right_arrow: "ArrowLeftRight",
|
|
75065
|
+
pentagon: "Pentagon",
|
|
75066
|
+
octagon: "Octagon",
|
|
75067
|
+
hexagon: "Hexagon",
|
|
75068
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
75069
|
+
trapezoid: "Trapezoid",
|
|
75070
|
+
cloud: "Cloud",
|
|
75071
|
+
cross: "Cross",
|
|
75072
|
+
can: "Cylinder",
|
|
75073
|
+
left_brace: "BracesRight",
|
|
75074
|
+
right_brace: "BracesLeft"
|
|
75075
|
+
};
|
|
75076
|
+
var BORDER_STYLES = {
|
|
75077
|
+
normal: "solid",
|
|
75078
|
+
dotted: "dot",
|
|
75079
|
+
dashed: "dash"
|
|
75080
|
+
};
|
|
75081
|
+
var STICKER_COLOR_MAP = {
|
|
75082
|
+
dark_blue: 2,
|
|
75083
|
+
blue: 2,
|
|
75084
|
+
light_blue: 3,
|
|
75085
|
+
red: 1,
|
|
75086
|
+
orange: 6,
|
|
75087
|
+
violet: 0,
|
|
75088
|
+
pink: 1,
|
|
75089
|
+
light_pink: 1,
|
|
75090
|
+
cyan: 5,
|
|
75091
|
+
dark_green: 4,
|
|
75092
|
+
green: 4,
|
|
75093
|
+
light_green: 4,
|
|
75094
|
+
yellow: 7,
|
|
75095
|
+
light_yellow: 7,
|
|
75096
|
+
gray: 8,
|
|
75097
|
+
black: 9
|
|
75098
|
+
};
|
|
75099
|
+
var FRAME_TYPES2 = {
|
|
75100
|
+
custom: "Custom",
|
|
75101
|
+
a4: "A4",
|
|
75102
|
+
letter: "Letter",
|
|
75103
|
+
ratio_16x9: "Frame16x9",
|
|
75104
|
+
ratio_4x3: "Frame4x3",
|
|
75105
|
+
ratio_1x1: "Frame1x1",
|
|
75106
|
+
phone: "Custom",
|
|
75107
|
+
tablet: "Custom",
|
|
75108
|
+
desktop: "Custom"
|
|
75109
|
+
};
|
|
75110
|
+
var CONNECTOR_LINE_STYLES = {
|
|
75111
|
+
straight: "straight",
|
|
75112
|
+
curved: "curved",
|
|
75113
|
+
elbowed: "orthogonal"
|
|
75114
|
+
};
|
|
75115
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
75116
|
+
stealth: "ArrowBroad",
|
|
75117
|
+
"Arc Arrow": "ArrowThin",
|
|
75118
|
+
filled_triangle: "Angle",
|
|
75119
|
+
arrow: "ArrowThin",
|
|
75120
|
+
triangle: "TriangleEmpty",
|
|
75121
|
+
filled_diamond: "DiamondFilled",
|
|
75122
|
+
diamond: "DiamondEmpty",
|
|
75123
|
+
filled_oval: "CircleFilled",
|
|
75124
|
+
oval: "Zero",
|
|
75125
|
+
erd_one: "One",
|
|
75126
|
+
erd_many: "Many",
|
|
75127
|
+
erd_one_or_many: "ManyMandatory",
|
|
75128
|
+
erd_only_one: "OneMandatory",
|
|
75129
|
+
erd_zero_or_many: "ManyOptional",
|
|
75130
|
+
erd_zero_or_one: "OneOptional"
|
|
75131
|
+
};
|
|
75132
|
+
|
|
75133
|
+
class MiroItemConverter {
|
|
75134
|
+
static convert(miroItem) {
|
|
75135
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
75136
|
+
const baseData = {
|
|
75137
|
+
id,
|
|
75138
|
+
parent: parent?.id || "Board",
|
|
75139
|
+
linkTo
|
|
75140
|
+
};
|
|
75141
|
+
switch (type) {
|
|
75142
|
+
case "shape":
|
|
75143
|
+
return {
|
|
75144
|
+
...baseData,
|
|
75145
|
+
itemType: "Shape",
|
|
75146
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
75147
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
75148
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
75149
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
75150
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
75151
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
75152
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
75153
|
+
};
|
|
75154
|
+
case "sticky_note":
|
|
75155
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
75156
|
+
return {
|
|
75157
|
+
...baseData,
|
|
75158
|
+
itemType: "Sticker",
|
|
75159
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
75160
|
+
};
|
|
75161
|
+
case "text":
|
|
75162
|
+
return {
|
|
75163
|
+
...baseData,
|
|
75164
|
+
itemType: "RichText"
|
|
75165
|
+
};
|
|
75166
|
+
case "frame":
|
|
75167
|
+
return {
|
|
75168
|
+
...baseData,
|
|
75169
|
+
itemType: "Frame",
|
|
75170
|
+
title: data?.title || "Frame",
|
|
75171
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
75172
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
75173
|
+
};
|
|
75174
|
+
case "connector":
|
|
75175
|
+
return {
|
|
75176
|
+
...baseData,
|
|
75177
|
+
itemType: "Connector",
|
|
75178
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
75179
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
75180
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
75181
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
75182
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
75183
|
+
};
|
|
75184
|
+
case "image":
|
|
75185
|
+
return {
|
|
75186
|
+
...baseData,
|
|
75187
|
+
itemType: "Image"
|
|
75188
|
+
};
|
|
75189
|
+
case "paint":
|
|
75190
|
+
return {
|
|
75191
|
+
...baseData,
|
|
75192
|
+
itemType: "Drawing",
|
|
75193
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
75194
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
75195
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
75196
|
+
};
|
|
75197
|
+
default:
|
|
75198
|
+
return {
|
|
75199
|
+
...baseData,
|
|
75200
|
+
itemType: "Placeholder"
|
|
75201
|
+
};
|
|
75202
|
+
}
|
|
75203
|
+
}
|
|
75204
|
+
static convertColor(color2, fallback = "black") {
|
|
75205
|
+
if (!color2)
|
|
75206
|
+
return coerceColorValue(fallback);
|
|
75207
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
75208
|
+
return coerceColorValue(hex3);
|
|
75209
|
+
}
|
|
75210
|
+
}
|
|
75009
75211
|
// src/api/initI18N.ts
|
|
75010
75212
|
function initI18N(i18nInstance) {
|
|
75011
75213
|
conf.i18n = i18nInstance;
|
|
@@ -75254,6 +75456,7 @@ export {
|
|
|
75254
75456
|
PRESENCE_CURSOR_THROTTLE,
|
|
75255
75457
|
PRESENCE_CLEANUP_USER_TIMER,
|
|
75256
75458
|
PRESENCE_CLEANUP_IDLE_TIMER,
|
|
75459
|
+
MiroItemConverter,
|
|
75257
75460
|
Mbr,
|
|
75258
75461
|
Matrix,
|
|
75259
75462
|
MIN_STROKE_WIDTH,
|
|
@@ -75282,6 +75485,7 @@ export {
|
|
|
75282
75485
|
Dice,
|
|
75283
75486
|
DefaultTransformationData,
|
|
75284
75487
|
DefaultShapeData,
|
|
75488
|
+
DefaultRichTextData,
|
|
75285
75489
|
DefaultPlaceholderData,
|
|
75286
75490
|
DefaultImageItemData,
|
|
75287
75491
|
DefaultGroupData,
|