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/esm/index.js
CHANGED
|
@@ -43834,6 +43834,7 @@ class Group extends BaseItem {
|
|
|
43834
43834
|
transformationRenderBlock = undefined;
|
|
43835
43835
|
isLockedGroup = false;
|
|
43836
43836
|
static movingGroupId = null;
|
|
43837
|
+
static reparentingGroupId = null;
|
|
43837
43838
|
constructor(board, id = "") {
|
|
43838
43839
|
super(board, id);
|
|
43839
43840
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -43899,6 +43900,23 @@ class Group extends BaseItem {
|
|
|
43899
43900
|
this.apply(operation);
|
|
43900
43901
|
}
|
|
43901
43902
|
}
|
|
43903
|
+
applyAddChildren(childIds) {
|
|
43904
|
+
Group.reparentingGroupId = this.getId();
|
|
43905
|
+
super.applyAddChildren(childIds);
|
|
43906
|
+
Group.reparentingGroupId = null;
|
|
43907
|
+
for (const child of this.index?.listAll() || []) {
|
|
43908
|
+
child.subject.publish(child);
|
|
43909
|
+
}
|
|
43910
|
+
}
|
|
43911
|
+
applyRemoveChildren(childIds) {
|
|
43912
|
+
Group.reparentingGroupId = this.getId();
|
|
43913
|
+
super.applyRemoveChildren(childIds);
|
|
43914
|
+
Group.reparentingGroupId = null;
|
|
43915
|
+
for (const childId of childIds) {
|
|
43916
|
+
const child = this.board.items.getById(childId);
|
|
43917
|
+
child?.subject.publish(child);
|
|
43918
|
+
}
|
|
43919
|
+
}
|
|
43902
43920
|
setId(id) {
|
|
43903
43921
|
this.id = id;
|
|
43904
43922
|
this.transformation.setId(id);
|
|
@@ -44348,7 +44366,7 @@ class Connector2 extends BaseItem {
|
|
|
44348
44366
|
}
|
|
44349
44367
|
this.text = new RichText(this.board, this.id);
|
|
44350
44368
|
this.text.container = this.getMbr();
|
|
44351
|
-
this.text.transformation =
|
|
44369
|
+
this.text.transformation = this.transformation;
|
|
44352
44370
|
this.text.linkTo = this.linkTo;
|
|
44353
44371
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
44354
44372
|
ns: "default"
|
|
@@ -44393,6 +44411,10 @@ class Connector2 extends BaseItem {
|
|
|
44393
44411
|
observerStartPointItem = () => {
|
|
44394
44412
|
const point3 = this.startPoint;
|
|
44395
44413
|
if (point3.pointType !== "Board") {
|
|
44414
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44415
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44416
|
+
return;
|
|
44417
|
+
}
|
|
44396
44418
|
const movingGroupId = Group.movingGroupId;
|
|
44397
44419
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44398
44420
|
return;
|
|
@@ -44411,6 +44433,10 @@ class Connector2 extends BaseItem {
|
|
|
44411
44433
|
observerEndPointItem = () => {
|
|
44412
44434
|
const point3 = this.endPoint;
|
|
44413
44435
|
if (point3.pointType !== "Board") {
|
|
44436
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
44437
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
44438
|
+
return;
|
|
44439
|
+
}
|
|
44414
44440
|
const movingGroupId = Group.movingGroupId;
|
|
44415
44441
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
44416
44442
|
return;
|
|
@@ -61853,6 +61879,9 @@ class AINode extends BaseItem {
|
|
|
61853
61879
|
getLinkTo() {
|
|
61854
61880
|
return this.linkTo.link;
|
|
61855
61881
|
}
|
|
61882
|
+
getRichText() {
|
|
61883
|
+
return this.text;
|
|
61884
|
+
}
|
|
61856
61885
|
renderButton(context) {
|
|
61857
61886
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
61858
61887
|
const { ctx } = context;
|
|
@@ -74115,7 +74144,10 @@ class Board {
|
|
|
74115
74144
|
return parseHTML(el);
|
|
74116
74145
|
}
|
|
74117
74146
|
add(item, timeStamp) {
|
|
74118
|
-
const id = this.getNewItemId();
|
|
74147
|
+
const id = item.getId() || this.getNewItemId();
|
|
74148
|
+
if (!item.getId()) {
|
|
74149
|
+
item.setId(id);
|
|
74150
|
+
}
|
|
74119
74151
|
this.emit({
|
|
74120
74152
|
class: "Board",
|
|
74121
74153
|
method: "add",
|
|
@@ -74130,6 +74162,17 @@ class Board {
|
|
|
74130
74162
|
this.handleNesting(newItem);
|
|
74131
74163
|
return newItem;
|
|
74132
74164
|
}
|
|
74165
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
74166
|
+
const id = data.id || this.getNewItemId();
|
|
74167
|
+
const fullData = { ...data, itemType, id };
|
|
74168
|
+
const item = this.createItem(id, fullData);
|
|
74169
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
74170
|
+
const conn = item;
|
|
74171
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
74172
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
74173
|
+
}
|
|
74174
|
+
return this.add(item, timeStamp);
|
|
74175
|
+
}
|
|
74133
74176
|
addLockedGroup(items) {
|
|
74134
74177
|
const id = this.getNewItemId();
|
|
74135
74178
|
const groupData = {
|
|
@@ -74999,6 +75042,165 @@ function validateTransformationData(transformationData) {
|
|
|
74999
75042
|
function validatePointData(pointData) {
|
|
75000
75043
|
return PointSchema.safeParse(pointData).success;
|
|
75001
75044
|
}
|
|
75045
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
75046
|
+
var SHAPE_TYPES = {
|
|
75047
|
+
round_rectangle: "RoundedRectangle",
|
|
75048
|
+
circle: "Circle",
|
|
75049
|
+
triangle: "Triangle",
|
|
75050
|
+
rhombus: "Rhombus",
|
|
75051
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
75052
|
+
parallelogram: "Parallelogram",
|
|
75053
|
+
star: "Star",
|
|
75054
|
+
right_arrow: "ArrowRight",
|
|
75055
|
+
left_arrow: "ArrowLeft",
|
|
75056
|
+
rectangle: "Rectangle",
|
|
75057
|
+
left_right_arrow: "ArrowLeftRight",
|
|
75058
|
+
pentagon: "Pentagon",
|
|
75059
|
+
octagon: "Octagon",
|
|
75060
|
+
hexagon: "Hexagon",
|
|
75061
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
75062
|
+
trapezoid: "Trapezoid",
|
|
75063
|
+
cloud: "Cloud",
|
|
75064
|
+
cross: "Cross",
|
|
75065
|
+
can: "Cylinder",
|
|
75066
|
+
left_brace: "BracesRight",
|
|
75067
|
+
right_brace: "BracesLeft"
|
|
75068
|
+
};
|
|
75069
|
+
var BORDER_STYLES = {
|
|
75070
|
+
normal: "solid",
|
|
75071
|
+
dotted: "dot",
|
|
75072
|
+
dashed: "dash"
|
|
75073
|
+
};
|
|
75074
|
+
var STICKER_COLOR_MAP = {
|
|
75075
|
+
dark_blue: 2,
|
|
75076
|
+
blue: 2,
|
|
75077
|
+
light_blue: 3,
|
|
75078
|
+
red: 1,
|
|
75079
|
+
orange: 6,
|
|
75080
|
+
violet: 0,
|
|
75081
|
+
pink: 1,
|
|
75082
|
+
light_pink: 1,
|
|
75083
|
+
cyan: 5,
|
|
75084
|
+
dark_green: 4,
|
|
75085
|
+
green: 4,
|
|
75086
|
+
light_green: 4,
|
|
75087
|
+
yellow: 7,
|
|
75088
|
+
light_yellow: 7,
|
|
75089
|
+
gray: 8,
|
|
75090
|
+
black: 9
|
|
75091
|
+
};
|
|
75092
|
+
var FRAME_TYPES2 = {
|
|
75093
|
+
custom: "Custom",
|
|
75094
|
+
a4: "A4",
|
|
75095
|
+
letter: "Letter",
|
|
75096
|
+
ratio_16x9: "Frame16x9",
|
|
75097
|
+
ratio_4x3: "Frame4x3",
|
|
75098
|
+
ratio_1x1: "Frame1x1",
|
|
75099
|
+
phone: "Custom",
|
|
75100
|
+
tablet: "Custom",
|
|
75101
|
+
desktop: "Custom"
|
|
75102
|
+
};
|
|
75103
|
+
var CONNECTOR_LINE_STYLES = {
|
|
75104
|
+
straight: "straight",
|
|
75105
|
+
curved: "curved",
|
|
75106
|
+
elbowed: "orthogonal"
|
|
75107
|
+
};
|
|
75108
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
75109
|
+
stealth: "ArrowBroad",
|
|
75110
|
+
"Arc Arrow": "ArrowThin",
|
|
75111
|
+
filled_triangle: "Angle",
|
|
75112
|
+
arrow: "ArrowThin",
|
|
75113
|
+
triangle: "TriangleEmpty",
|
|
75114
|
+
filled_diamond: "DiamondFilled",
|
|
75115
|
+
diamond: "DiamondEmpty",
|
|
75116
|
+
filled_oval: "CircleFilled",
|
|
75117
|
+
oval: "Zero",
|
|
75118
|
+
erd_one: "One",
|
|
75119
|
+
erd_many: "Many",
|
|
75120
|
+
erd_one_or_many: "ManyMandatory",
|
|
75121
|
+
erd_only_one: "OneMandatory",
|
|
75122
|
+
erd_zero_or_many: "ManyOptional",
|
|
75123
|
+
erd_zero_or_one: "OneOptional"
|
|
75124
|
+
};
|
|
75125
|
+
|
|
75126
|
+
class MiroItemConverter {
|
|
75127
|
+
static convert(miroItem) {
|
|
75128
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
75129
|
+
const baseData = {
|
|
75130
|
+
id,
|
|
75131
|
+
parent: parent?.id || "Board",
|
|
75132
|
+
linkTo
|
|
75133
|
+
};
|
|
75134
|
+
switch (type) {
|
|
75135
|
+
case "shape":
|
|
75136
|
+
return {
|
|
75137
|
+
...baseData,
|
|
75138
|
+
itemType: "Shape",
|
|
75139
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
75140
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
75141
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
75142
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
75143
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
75144
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
75145
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
75146
|
+
};
|
|
75147
|
+
case "sticky_note":
|
|
75148
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
75149
|
+
return {
|
|
75150
|
+
...baseData,
|
|
75151
|
+
itemType: "Sticker",
|
|
75152
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
75153
|
+
};
|
|
75154
|
+
case "text":
|
|
75155
|
+
return {
|
|
75156
|
+
...baseData,
|
|
75157
|
+
itemType: "RichText"
|
|
75158
|
+
};
|
|
75159
|
+
case "frame":
|
|
75160
|
+
return {
|
|
75161
|
+
...baseData,
|
|
75162
|
+
itemType: "Frame",
|
|
75163
|
+
title: data?.title || "Frame",
|
|
75164
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
75165
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
75166
|
+
};
|
|
75167
|
+
case "connector":
|
|
75168
|
+
return {
|
|
75169
|
+
...baseData,
|
|
75170
|
+
itemType: "Connector",
|
|
75171
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
75172
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
75173
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
75174
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
75175
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
75176
|
+
};
|
|
75177
|
+
case "image":
|
|
75178
|
+
return {
|
|
75179
|
+
...baseData,
|
|
75180
|
+
itemType: "Image"
|
|
75181
|
+
};
|
|
75182
|
+
case "paint":
|
|
75183
|
+
return {
|
|
75184
|
+
...baseData,
|
|
75185
|
+
itemType: "Drawing",
|
|
75186
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
75187
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
75188
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
75189
|
+
};
|
|
75190
|
+
default:
|
|
75191
|
+
return {
|
|
75192
|
+
...baseData,
|
|
75193
|
+
itemType: "Placeholder"
|
|
75194
|
+
};
|
|
75195
|
+
}
|
|
75196
|
+
}
|
|
75197
|
+
static convertColor(color2, fallback = "black") {
|
|
75198
|
+
if (!color2)
|
|
75199
|
+
return coerceColorValue(fallback);
|
|
75200
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
75201
|
+
return coerceColorValue(hex3);
|
|
75202
|
+
}
|
|
75203
|
+
}
|
|
75002
75204
|
// src/api/initI18N.ts
|
|
75003
75205
|
function initI18N(i18nInstance) {
|
|
75004
75206
|
conf.i18n = i18nInstance;
|
|
@@ -75152,6 +75354,7 @@ export {
|
|
|
75152
75354
|
PRESENCE_CURSOR_THROTTLE,
|
|
75153
75355
|
PRESENCE_CLEANUP_USER_TIMER,
|
|
75154
75356
|
PRESENCE_CLEANUP_IDLE_TIMER,
|
|
75357
|
+
MiroItemConverter,
|
|
75155
75358
|
Mbr,
|
|
75156
75359
|
Matrix,
|
|
75157
75360
|
MIN_STROKE_WIDTH,
|
|
@@ -75180,6 +75383,7 @@ export {
|
|
|
75180
75383
|
Dice,
|
|
75181
75384
|
DefaultTransformationData,
|
|
75182
75385
|
DefaultShapeData,
|
|
75386
|
+
DefaultRichTextData,
|
|
75183
75387
|
DefaultPlaceholderData,
|
|
75184
75388
|
DefaultImageItemData,
|
|
75185
75389
|
DefaultGroupData,
|
package/dist/esm/node.js
CHANGED
|
@@ -46301,6 +46301,7 @@ class Group extends BaseItem {
|
|
|
46301
46301
|
transformationRenderBlock = undefined;
|
|
46302
46302
|
isLockedGroup = false;
|
|
46303
46303
|
static movingGroupId = null;
|
|
46304
|
+
static reparentingGroupId = null;
|
|
46304
46305
|
constructor(board, id = "") {
|
|
46305
46306
|
super(board, id);
|
|
46306
46307
|
this.index = new SimpleSpatialIndex(this.board.camera, this.board.pointer);
|
|
@@ -46366,6 +46367,23 @@ class Group extends BaseItem {
|
|
|
46366
46367
|
this.apply(operation);
|
|
46367
46368
|
}
|
|
46368
46369
|
}
|
|
46370
|
+
applyAddChildren(childIds) {
|
|
46371
|
+
Group.reparentingGroupId = this.getId();
|
|
46372
|
+
super.applyAddChildren(childIds);
|
|
46373
|
+
Group.reparentingGroupId = null;
|
|
46374
|
+
for (const child of this.index?.listAll() || []) {
|
|
46375
|
+
child.subject.publish(child);
|
|
46376
|
+
}
|
|
46377
|
+
}
|
|
46378
|
+
applyRemoveChildren(childIds) {
|
|
46379
|
+
Group.reparentingGroupId = this.getId();
|
|
46380
|
+
super.applyRemoveChildren(childIds);
|
|
46381
|
+
Group.reparentingGroupId = null;
|
|
46382
|
+
for (const childId of childIds) {
|
|
46383
|
+
const child = this.board.items.getById(childId);
|
|
46384
|
+
child?.subject.publish(child);
|
|
46385
|
+
}
|
|
46386
|
+
}
|
|
46369
46387
|
setId(id) {
|
|
46370
46388
|
this.id = id;
|
|
46371
46389
|
this.transformation.setId(id);
|
|
@@ -46815,7 +46833,7 @@ class Connector2 extends BaseItem {
|
|
|
46815
46833
|
}
|
|
46816
46834
|
this.text = new RichText(this.board, this.id);
|
|
46817
46835
|
this.text.container = this.getMbr();
|
|
46818
|
-
this.text.transformation =
|
|
46836
|
+
this.text.transformation = this.transformation;
|
|
46819
46837
|
this.text.linkTo = this.linkTo;
|
|
46820
46838
|
this.text.placeholderText = conf.i18n.t("connector.textPlaceholder", {
|
|
46821
46839
|
ns: "default"
|
|
@@ -46860,6 +46878,10 @@ class Connector2 extends BaseItem {
|
|
|
46860
46878
|
observerStartPointItem = () => {
|
|
46861
46879
|
const point3 = this.startPoint;
|
|
46862
46880
|
if (point3.pointType !== "Board") {
|
|
46881
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
46882
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
46883
|
+
return;
|
|
46884
|
+
}
|
|
46863
46885
|
const movingGroupId = Group.movingGroupId;
|
|
46864
46886
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
46865
46887
|
return;
|
|
@@ -46878,6 +46900,10 @@ class Connector2 extends BaseItem {
|
|
|
46878
46900
|
observerEndPointItem = () => {
|
|
46879
46901
|
const point3 = this.endPoint;
|
|
46880
46902
|
if (point3.pointType !== "Board") {
|
|
46903
|
+
const reparentingGroupId = Group.reparentingGroupId;
|
|
46904
|
+
if (reparentingGroupId !== null && (this.parent === reparentingGroupId || point3.item instanceof BaseItem && point3.item.parent === reparentingGroupId)) {
|
|
46905
|
+
return;
|
|
46906
|
+
}
|
|
46881
46907
|
const movingGroupId = Group.movingGroupId;
|
|
46882
46908
|
if (movingGroupId !== null && this.parent === movingGroupId && point3.item instanceof BaseItem && point3.item.parent === movingGroupId) {
|
|
46883
46909
|
return;
|
|
@@ -64321,6 +64347,9 @@ class AINode extends BaseItem {
|
|
|
64321
64347
|
getLinkTo() {
|
|
64322
64348
|
return this.linkTo.link;
|
|
64323
64349
|
}
|
|
64350
|
+
getRichText() {
|
|
64351
|
+
return this.text;
|
|
64352
|
+
}
|
|
64324
64353
|
renderButton(context) {
|
|
64325
64354
|
const { left, right, top, bottom } = this.buttonMbr;
|
|
64326
64355
|
const { ctx } = context;
|
|
@@ -76583,7 +76612,10 @@ class Board {
|
|
|
76583
76612
|
return parseHTML(el);
|
|
76584
76613
|
}
|
|
76585
76614
|
add(item, timeStamp) {
|
|
76586
|
-
const id = this.getNewItemId();
|
|
76615
|
+
const id = item.getId() || this.getNewItemId();
|
|
76616
|
+
if (!item.getId()) {
|
|
76617
|
+
item.setId(id);
|
|
76618
|
+
}
|
|
76587
76619
|
this.emit({
|
|
76588
76620
|
class: "Board",
|
|
76589
76621
|
method: "add",
|
|
@@ -76598,6 +76630,17 @@ class Board {
|
|
|
76598
76630
|
this.handleNesting(newItem);
|
|
76599
76631
|
return newItem;
|
|
76600
76632
|
}
|
|
76633
|
+
createItemAndAdd(itemType, data, timeStamp) {
|
|
76634
|
+
const id = data.id || this.getNewItemId();
|
|
76635
|
+
const fullData = { ...data, itemType, id };
|
|
76636
|
+
const item = this.createItem(id, fullData);
|
|
76637
|
+
if (item.itemType === "Connector" && data.startPoint && data.endPoint) {
|
|
76638
|
+
const conn = item;
|
|
76639
|
+
conn.apply({ class: "Connector", method: "setStartPoint", startPointData: data.startPoint });
|
|
76640
|
+
conn.apply({ class: "Connector", method: "setEndPoint", endPointData: data.endPoint });
|
|
76641
|
+
}
|
|
76642
|
+
return this.add(item, timeStamp);
|
|
76643
|
+
}
|
|
76601
76644
|
addLockedGroup(items) {
|
|
76602
76645
|
const id = this.getNewItemId();
|
|
76603
76646
|
const groupData = {
|
|
@@ -77467,6 +77510,165 @@ function validateTransformationData(transformationData) {
|
|
|
77467
77510
|
function validatePointData(pointData) {
|
|
77468
77511
|
return PointSchema.safeParse(pointData).success;
|
|
77469
77512
|
}
|
|
77513
|
+
// src/Import/Miro/MiroItemConverter.ts
|
|
77514
|
+
var SHAPE_TYPES = {
|
|
77515
|
+
round_rectangle: "RoundedRectangle",
|
|
77516
|
+
circle: "Circle",
|
|
77517
|
+
triangle: "Triangle",
|
|
77518
|
+
rhombus: "Rhombus",
|
|
77519
|
+
wedge_round_rectangle_callout: "SpeachBubble",
|
|
77520
|
+
parallelogram: "Parallelogram",
|
|
77521
|
+
star: "Star",
|
|
77522
|
+
right_arrow: "ArrowRight",
|
|
77523
|
+
left_arrow: "ArrowLeft",
|
|
77524
|
+
rectangle: "Rectangle",
|
|
77525
|
+
left_right_arrow: "ArrowLeftRight",
|
|
77526
|
+
pentagon: "Pentagon",
|
|
77527
|
+
octagon: "Octagon",
|
|
77528
|
+
hexagon: "Hexagon",
|
|
77529
|
+
flow_chart_predefined_process: "PredefinedProcess",
|
|
77530
|
+
trapezoid: "Trapezoid",
|
|
77531
|
+
cloud: "Cloud",
|
|
77532
|
+
cross: "Cross",
|
|
77533
|
+
can: "Cylinder",
|
|
77534
|
+
left_brace: "BracesRight",
|
|
77535
|
+
right_brace: "BracesLeft"
|
|
77536
|
+
};
|
|
77537
|
+
var BORDER_STYLES = {
|
|
77538
|
+
normal: "solid",
|
|
77539
|
+
dotted: "dot",
|
|
77540
|
+
dashed: "dash"
|
|
77541
|
+
};
|
|
77542
|
+
var STICKER_COLOR_MAP = {
|
|
77543
|
+
dark_blue: 2,
|
|
77544
|
+
blue: 2,
|
|
77545
|
+
light_blue: 3,
|
|
77546
|
+
red: 1,
|
|
77547
|
+
orange: 6,
|
|
77548
|
+
violet: 0,
|
|
77549
|
+
pink: 1,
|
|
77550
|
+
light_pink: 1,
|
|
77551
|
+
cyan: 5,
|
|
77552
|
+
dark_green: 4,
|
|
77553
|
+
green: 4,
|
|
77554
|
+
light_green: 4,
|
|
77555
|
+
yellow: 7,
|
|
77556
|
+
light_yellow: 7,
|
|
77557
|
+
gray: 8,
|
|
77558
|
+
black: 9
|
|
77559
|
+
};
|
|
77560
|
+
var FRAME_TYPES2 = {
|
|
77561
|
+
custom: "Custom",
|
|
77562
|
+
a4: "A4",
|
|
77563
|
+
letter: "Letter",
|
|
77564
|
+
ratio_16x9: "Frame16x9",
|
|
77565
|
+
ratio_4x3: "Frame4x3",
|
|
77566
|
+
ratio_1x1: "Frame1x1",
|
|
77567
|
+
phone: "Custom",
|
|
77568
|
+
tablet: "Custom",
|
|
77569
|
+
desktop: "Custom"
|
|
77570
|
+
};
|
|
77571
|
+
var CONNECTOR_LINE_STYLES = {
|
|
77572
|
+
straight: "straight",
|
|
77573
|
+
curved: "curved",
|
|
77574
|
+
elbowed: "orthogonal"
|
|
77575
|
+
};
|
|
77576
|
+
var CONNECTOR_POINTER_STYLES = {
|
|
77577
|
+
stealth: "ArrowBroad",
|
|
77578
|
+
"Arc Arrow": "ArrowThin",
|
|
77579
|
+
filled_triangle: "Angle",
|
|
77580
|
+
arrow: "ArrowThin",
|
|
77581
|
+
triangle: "TriangleEmpty",
|
|
77582
|
+
filled_diamond: "DiamondFilled",
|
|
77583
|
+
diamond: "DiamondEmpty",
|
|
77584
|
+
filled_oval: "CircleFilled",
|
|
77585
|
+
oval: "Zero",
|
|
77586
|
+
erd_one: "One",
|
|
77587
|
+
erd_many: "Many",
|
|
77588
|
+
erd_one_or_many: "ManyMandatory",
|
|
77589
|
+
erd_only_one: "OneMandatory",
|
|
77590
|
+
erd_zero_or_many: "ManyOptional",
|
|
77591
|
+
erd_zero_or_one: "OneOptional"
|
|
77592
|
+
};
|
|
77593
|
+
|
|
77594
|
+
class MiroItemConverter {
|
|
77595
|
+
static convert(miroItem) {
|
|
77596
|
+
const { type, style: style2, data, geometry, position: position4, id, linkTo, parent } = miroItem;
|
|
77597
|
+
const baseData = {
|
|
77598
|
+
id,
|
|
77599
|
+
parent: parent?.id || "Board",
|
|
77600
|
+
linkTo
|
|
77601
|
+
};
|
|
77602
|
+
switch (type) {
|
|
77603
|
+
case "shape":
|
|
77604
|
+
return {
|
|
77605
|
+
...baseData,
|
|
77606
|
+
itemType: "Shape",
|
|
77607
|
+
shapeType: SHAPE_TYPES[data?.shape] || "Rectangle",
|
|
77608
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor, "transparent"),
|
|
77609
|
+
backgroundOpacity: style2?.fillOpacity ? parseFloat(style2.fillOpacity) : 1,
|
|
77610
|
+
borderColor: MiroItemConverter.convertColor(style2?.borderColor),
|
|
77611
|
+
borderOpacity: style2?.borderOpacity ? parseFloat(style2.borderOpacity) : 1,
|
|
77612
|
+
borderStyle: BORDER_STYLES[style2?.borderStyle || "normal"] || "solid",
|
|
77613
|
+
borderWidth: style2?.borderWidth ? parseFloat(style2.borderWidth) : 2
|
|
77614
|
+
};
|
|
77615
|
+
case "sticky_note":
|
|
77616
|
+
const colorIdx = STICKER_COLOR_MAP[style2?.fillColor || "yellow"] ?? 7;
|
|
77617
|
+
return {
|
|
77618
|
+
...baseData,
|
|
77619
|
+
itemType: "Sticker",
|
|
77620
|
+
backgroundColor: coerceColorValue(conf.STICKER_COLORS[colorIdx])
|
|
77621
|
+
};
|
|
77622
|
+
case "text":
|
|
77623
|
+
return {
|
|
77624
|
+
...baseData,
|
|
77625
|
+
itemType: "RichText"
|
|
77626
|
+
};
|
|
77627
|
+
case "frame":
|
|
77628
|
+
return {
|
|
77629
|
+
...baseData,
|
|
77630
|
+
itemType: "Frame",
|
|
77631
|
+
title: data?.title || "Frame",
|
|
77632
|
+
frameType: FRAME_TYPES2[data?.format] || "Custom",
|
|
77633
|
+
backgroundColor: MiroItemConverter.convertColor(style2?.fillColor)
|
|
77634
|
+
};
|
|
77635
|
+
case "connector":
|
|
77636
|
+
return {
|
|
77637
|
+
...baseData,
|
|
77638
|
+
itemType: "Connector",
|
|
77639
|
+
lineColor: MiroItemConverter.convertColor(style2?.strokeColor),
|
|
77640
|
+
lineStyle: CONNECTOR_LINE_STYLES[miroItem.shape || "straight"] || "straight",
|
|
77641
|
+
lineWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 1,
|
|
77642
|
+
startPointerStyle: CONNECTOR_POINTER_STYLES[style2?.startStrokeCap || ""] || "None",
|
|
77643
|
+
endPointerStyle: CONNECTOR_POINTER_STYLES[style2?.endStrokeCap || ""] || "ArrowThin"
|
|
77644
|
+
};
|
|
77645
|
+
case "image":
|
|
77646
|
+
return {
|
|
77647
|
+
...baseData,
|
|
77648
|
+
itemType: "Image"
|
|
77649
|
+
};
|
|
77650
|
+
case "paint":
|
|
77651
|
+
return {
|
|
77652
|
+
...baseData,
|
|
77653
|
+
itemType: "Drawing",
|
|
77654
|
+
strokeColor: MiroItemConverter.convertColor(style2?.color),
|
|
77655
|
+
strokeWidth: style2?.strokeWidth ? parseFloat(style2.strokeWidth) : 2,
|
|
77656
|
+
strokeOpacity: style2?.strokeOpacity ?? 1
|
|
77657
|
+
};
|
|
77658
|
+
default:
|
|
77659
|
+
return {
|
|
77660
|
+
...baseData,
|
|
77661
|
+
itemType: "Placeholder"
|
|
77662
|
+
};
|
|
77663
|
+
}
|
|
77664
|
+
}
|
|
77665
|
+
static convertColor(color2, fallback = "black") {
|
|
77666
|
+
if (!color2)
|
|
77667
|
+
return coerceColorValue(fallback);
|
|
77668
|
+
const hex3 = color2 === "#ffffff" ? "transparent" : color2;
|
|
77669
|
+
return coerceColorValue(hex3);
|
|
77670
|
+
}
|
|
77671
|
+
}
|
|
77470
77672
|
// src/api/initI18N.ts
|
|
77471
77673
|
function initI18N(i18nInstance) {
|
|
77472
77674
|
conf.i18n = i18nInstance;
|
|
@@ -77787,6 +77989,7 @@ export {
|
|
|
77787
77989
|
PRESENCE_CURSOR_THROTTLE,
|
|
77788
77990
|
PRESENCE_CLEANUP_USER_TIMER,
|
|
77789
77991
|
PRESENCE_CLEANUP_IDLE_TIMER,
|
|
77992
|
+
MiroItemConverter,
|
|
77790
77993
|
Mbr,
|
|
77791
77994
|
Matrix,
|
|
77792
77995
|
MIN_STROKE_WIDTH,
|
|
@@ -77815,6 +78018,7 @@ export {
|
|
|
77815
78018
|
Dice,
|
|
77816
78019
|
DefaultTransformationData,
|
|
77817
78020
|
DefaultShapeData,
|
|
78021
|
+
DefaultRichTextData,
|
|
77818
78022
|
DefaultPlaceholderData,
|
|
77819
78023
|
DefaultImageItemData,
|
|
77820
78024
|
DefaultGroupData,
|
package/dist/types/Board.d.ts
CHANGED
|
@@ -86,6 +86,11 @@ export declare class Board {
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
add<T extends Item>(item: T, timeStamp?: number): T;
|
|
89
|
+
/**
|
|
90
|
+
* High-level method to create and add an item in one step.
|
|
91
|
+
* Useful for UI components and converters.
|
|
92
|
+
*/
|
|
93
|
+
createItemAndAdd<T extends Item>(itemType: string, data: Partial<ItemData>, timeStamp?: number): T;
|
|
89
94
|
addLockedGroup(items: BaseItem[]): Group;
|
|
90
95
|
remove(item: Item, withConnectors?: boolean): void;
|
|
91
96
|
removeLockedGroup(item: Group): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface MiroGeometry {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface MiroPosition {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
relativeTo: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MiroStyle {
|
|
11
|
+
fillColor?: string;
|
|
12
|
+
fillOpacity?: string;
|
|
13
|
+
borderColor?: string;
|
|
14
|
+
borderOpacity?: string;
|
|
15
|
+
borderStyle?: string;
|
|
16
|
+
borderWidth?: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
fontSize?: string;
|
|
19
|
+
textAlign?: string;
|
|
20
|
+
textAlignVertical?: string;
|
|
21
|
+
strokeColor?: string;
|
|
22
|
+
strokeOpacity?: number;
|
|
23
|
+
strokeWidth?: string;
|
|
24
|
+
startStrokeCap?: string;
|
|
25
|
+
endStrokeCap?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface MiroItem {
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
shape?: string;
|
|
31
|
+
data?: any;
|
|
32
|
+
style?: MiroStyle;
|
|
33
|
+
geometry?: MiroGeometry;
|
|
34
|
+
position?: MiroPosition;
|
|
35
|
+
parent?: {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
linkTo?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class MiroItemConverter {
|
|
41
|
+
static convert(miroItem: MiroItem): any;
|
|
42
|
+
private static convertColor;
|
|
43
|
+
}
|
|
@@ -44,6 +44,7 @@ export declare class AINode extends BaseItem<AINode> {
|
|
|
44
44
|
getPath(): Path | Paths;
|
|
45
45
|
apply(op: Operation): void;
|
|
46
46
|
getLinkTo(): string | undefined;
|
|
47
|
+
getRichText(): RichText;
|
|
47
48
|
renderButton(context: DrawingContext): void;
|
|
48
49
|
render(context: DrawingContext): void;
|
|
49
50
|
getPrevMbr(): Mbr | null;
|
|
@@ -28,6 +28,7 @@ export declare class Group extends BaseItem<Group> {
|
|
|
28
28
|
* via recalculatePoint) and avoid persisting spurious setStartPoint/setEndPoint ops.
|
|
29
29
|
*/
|
|
30
30
|
static movingGroupId: string | null;
|
|
31
|
+
static reparentingGroupId: string | null;
|
|
31
32
|
constructor(board: Board, id?: string);
|
|
32
33
|
isClosed(): boolean;
|
|
33
34
|
getRichText(): null;
|
|
@@ -35,6 +36,8 @@ export declare class Group extends BaseItem<Group> {
|
|
|
35
36
|
protected updateVisuals(op: Operation, hint: UpdateHint): void;
|
|
36
37
|
protected getPropertyUpdateHint(property: string): UpdateHint;
|
|
37
38
|
emit(operation: GroupOperation): void;
|
|
39
|
+
applyAddChildren(childIds: string[]): void;
|
|
40
|
+
applyRemoveChildren(childIds: string[]): void;
|
|
38
41
|
setId(id: string): this;
|
|
39
42
|
getMbr(): Mbr;
|
|
40
43
|
updateMbr(): void;
|
|
@@ -3,6 +3,7 @@ export type { RichTextOperation } from "./RichTextOperations";
|
|
|
3
3
|
export type { TextStyle, TextNode } from "./Editor/TextNode";
|
|
4
4
|
export type { BlockNode, ListType } from "./Editor/BlockNode";
|
|
5
5
|
export type { RichTextData } from "./RichTextData";
|
|
6
|
+
export { DefaultRichTextData } from "./RichTextData";
|
|
6
7
|
export { transformHtmlOrTextToMarkdown } from "./transformHtmlToMarkdown";
|
|
7
8
|
export { getSlateSelectionRect } from "./getSlateSelectionRect";
|
|
8
9
|
export { EditorContainer } from "./EditorContainer";
|
|
@@ -26,6 +26,7 @@ export interface VideoConstructorData {
|
|
|
26
26
|
url?: string;
|
|
27
27
|
videoDimension: Dimension;
|
|
28
28
|
previewUrl?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
29
30
|
}
|
|
30
31
|
export declare const createPlaceholderImage: (width: number, height: number) => HTMLImageElement;
|
|
31
32
|
export declare class VideoItem extends BaseItem<VideoItem> {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./SpatialIndex";
|
|
|
19
19
|
export * from "./Tools";
|
|
20
20
|
export * from "./Overlay";
|
|
21
21
|
export * from "./HTMLAdapter/Utils";
|
|
22
|
+
export * from "./Import/Miro/MiroItemConverter";
|
|
22
23
|
export * from "./drawMbrOnCanvas";
|
|
23
24
|
export * from "./itemFactories";
|
|
24
25
|
export * from "./HTMLAdapter/Parser";
|