microboard-temp 0.7.0 → 0.8.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/cjs/browser.js +57 -39
- package/dist/cjs/index.js +57 -39
- package/dist/cjs/node.js +57 -39
- package/dist/esm/browser.js +57 -39
- package/dist/esm/index.js +57 -39
- package/dist/esm/node.js +57 -39
- package/dist/types/Items/Drawing/Drawing.d.ts +5 -1
- package/dist/types/Items/RichText/CanvasText/Render.d.ts +2 -2
- package/dist/types/Items/RichText/Editor/TextNode.d.ts +3 -2
- package/dist/types/Items/RichText/RichText.d.ts +4 -4
- package/dist/types/Items/RichText/editorHelpers/selectionOps/applySelectionFontColor.d.ts +2 -1
- package/dist/types/Items/RichText/editorHelpers/selectionOps/setSelectionFontHighlight.d.ts +2 -1
- package/dist/types/Settings.d.ts +4 -4
- package/dist/types/Tools/AddDrawing/AddDrawing.d.ts +6 -3
- package/dist/types/Tools/AddDrawing/AddHighlighter.d.ts +4 -1
- package/dist/types/Tools/AddSticker/AddSticker.d.ts +4 -3
- package/package.json +1 -1
package/dist/esm/node.js
CHANGED
|
@@ -7809,7 +7809,7 @@ var conf = {
|
|
|
7809
7809
|
"rgb(231, 232, 238)",
|
|
7810
7810
|
"rgb(156, 156, 156)"
|
|
7811
7811
|
],
|
|
7812
|
-
DEFAULT_STICKER_COLOR: "
|
|
7812
|
+
DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
|
|
7813
7813
|
STICKER_COLOR_NAMES: [
|
|
7814
7814
|
"purple",
|
|
7815
7815
|
"pink",
|
|
@@ -8019,7 +8019,7 @@ var conf = {
|
|
|
8019
8019
|
DEFAULT_TEXT_STYLES: {
|
|
8020
8020
|
fontFamily: "Manrope",
|
|
8021
8021
|
fontSize: 14,
|
|
8022
|
-
fontColor: "
|
|
8022
|
+
fontColor: semanticColor("contrastNeutral"),
|
|
8023
8023
|
fontHighlight: "",
|
|
8024
8024
|
lineHeight: 1.4,
|
|
8025
8025
|
bold: false,
|
|
@@ -9708,7 +9708,7 @@ function getTextStyle(data) {
|
|
|
9708
9708
|
const leafStyle = {
|
|
9709
9709
|
fontStyle: "normal",
|
|
9710
9710
|
fontWeight: "normal",
|
|
9711
|
-
color: data.fontColor ?? "
|
|
9711
|
+
color: data.fontColor ?? semanticColor("contrastNeutral"),
|
|
9712
9712
|
backgroundColor: data.fontHighlight,
|
|
9713
9713
|
fontSize: data.fontSize ?? 14,
|
|
9714
9714
|
fontFamily: data.fontFamily ?? "Arial"
|
|
@@ -10168,7 +10168,7 @@ function fillHighlight(ctx, textBlock) {
|
|
|
10168
10168
|
return;
|
|
10169
10169
|
}
|
|
10170
10170
|
const measure = textBlock.measure;
|
|
10171
|
-
ctx.fillStyle = textBlock.style.backgroundColor;
|
|
10171
|
+
ctx.fillStyle = resolveColor(textBlock.style.backgroundColor, conf.theme, "background");
|
|
10172
10172
|
ctx.fillRect(textBlock.x, textBlock.y - measure.ascent, measure.width, measure.height);
|
|
10173
10173
|
}
|
|
10174
10174
|
function underline(ctx, textBlock) {
|
|
@@ -10180,14 +10180,13 @@ function underline(ctx, textBlock) {
|
|
|
10180
10180
|
const style = textBlock.style;
|
|
10181
10181
|
const measure = textBlock.measure;
|
|
10182
10182
|
const width = measure.width - (textBlock.marginLeft || 0);
|
|
10183
|
-
|
|
10184
|
-
ctx.strokeStyle = color;
|
|
10183
|
+
ctx.strokeStyle = resolveColor(style.color, conf.theme, "foreground");
|
|
10185
10184
|
ctx.lineWidth = textBlock.fontSize / 14;
|
|
10186
10185
|
ctx.beginPath();
|
|
10187
10186
|
ctx.moveTo(x, y + 2 * textBlock.fontSize / 14);
|
|
10188
10187
|
ctx.lineTo(x + width, y + 2 * textBlock.fontSize / 14);
|
|
10189
10188
|
ctx.stroke();
|
|
10190
|
-
ctx.strokeStyle = style.backgroundColor
|
|
10189
|
+
ctx.strokeStyle = style.backgroundColor ? resolveColor(style.backgroundColor, conf.theme, "background") : "black";
|
|
10191
10190
|
ctx.lineWidth = 2;
|
|
10192
10191
|
}
|
|
10193
10192
|
function cross(ctx, textBlock) {
|
|
@@ -10200,19 +10199,18 @@ function cross(ctx, textBlock) {
|
|
|
10200
10199
|
const measure = textBlock.measure;
|
|
10201
10200
|
const width = measure.width;
|
|
10202
10201
|
const height = measure.height;
|
|
10203
|
-
|
|
10204
|
-
ctx.strokeStyle = color;
|
|
10202
|
+
ctx.strokeStyle = resolveColor(style.color, conf.theme, "foreground");
|
|
10205
10203
|
ctx.lineWidth = textBlock.fontSize / 14;
|
|
10206
10204
|
ctx.beginPath();
|
|
10207
10205
|
ctx.moveTo(x, y - height / 4);
|
|
10208
10206
|
ctx.lineTo(x + width, y - height / 4);
|
|
10209
10207
|
ctx.stroke();
|
|
10210
|
-
ctx.strokeStyle = style.backgroundColor
|
|
10208
|
+
ctx.strokeStyle = style.backgroundColor ? resolveColor(style.backgroundColor, conf.theme, "background") : "black";
|
|
10211
10209
|
ctx.lineWidth = 2;
|
|
10212
10210
|
}
|
|
10213
10211
|
function fillText(ctx, textBlock) {
|
|
10214
10212
|
const { text, style, x, y } = textBlock;
|
|
10215
|
-
ctx.fillStyle = style.color;
|
|
10213
|
+
ctx.fillStyle = resolveColor(style.color, conf.theme, "foreground");
|
|
10216
10214
|
ctx.fillText(text, x, y);
|
|
10217
10215
|
if (textBlock.listMark) {
|
|
10218
10216
|
ctx.fillText(textBlock.listMark, x - measureText(textBlock.listMark, style).width - 4, y);
|
|
@@ -19254,7 +19252,7 @@ function setSelectionFontHighlight(editor, format, selectionContext) {
|
|
|
19254
19252
|
}
|
|
19255
19253
|
if (format === "none") {
|
|
19256
19254
|
Editor21.removeMark(editor, "fontHighlight");
|
|
19257
|
-
} else if (marks.fontHighlight === format) {
|
|
19255
|
+
} else if (typeof format === "string" && marks.fontHighlight === format) {
|
|
19258
19256
|
Editor21.removeMark(editor, "fontHighlight");
|
|
19259
19257
|
} else {
|
|
19260
19258
|
Editor21.addMark(editor, "fontHighlight", format);
|
|
@@ -24941,8 +24939,8 @@ class RichText extends BaseItem {
|
|
|
24941
24939
|
node2.underline ? "underline" : "",
|
|
24942
24940
|
node2["line-through"] ? "line-through" : ""
|
|
24943
24941
|
].filter(Boolean).join(" "),
|
|
24944
|
-
color: node2.fontColor
|
|
24945
|
-
backgroundColor: node2.fontHighlight
|
|
24942
|
+
color: node2.fontColor ? resolveColor(node2.fontColor, conf.theme, "foreground") : conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
24943
|
+
backgroundColor: node2.fontHighlight ? resolveColor(node2.fontHighlight, conf.theme, "background") : conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
24946
24944
|
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
24947
24945
|
fontFamily: node2.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
24948
24946
|
});
|
|
@@ -40108,6 +40106,12 @@ class Connector2 extends BaseItem {
|
|
|
40108
40106
|
mbr.strokeWidth = 3;
|
|
40109
40107
|
mbr.borderStyle = "solid";
|
|
40110
40108
|
this.clipText(context);
|
|
40109
|
+
const resolvedLineColor = resolveColor(this.lineColor, conf.theme, "foreground");
|
|
40110
|
+
this.lines.setBorderColor(resolvedLineColor);
|
|
40111
|
+
this.startPointer.path.setBorderColor(resolvedLineColor);
|
|
40112
|
+
this.startPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40113
|
+
this.endPointer.path.setBorderColor(resolvedLineColor);
|
|
40114
|
+
this.endPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40111
40115
|
if (!this.text.isRenderEnabled && this.board.selection.getContext() !== "EditTextUnderPointer") {
|
|
40112
40116
|
this.lines.render(context);
|
|
40113
40117
|
}
|
|
@@ -40389,17 +40393,11 @@ class Connector2 extends BaseItem {
|
|
|
40389
40393
|
const endPoint = this.endPoint;
|
|
40390
40394
|
this.lines = getLine(this.lineStyle, startPoint, endPoint, this.middlePoint).addConnectedItemType(this.itemType);
|
|
40391
40395
|
this.startPointer = getStartPointer(startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
40392
|
-
const resolvedLineColor = resolveColor(this.lineColor, conf.theme, "foreground");
|
|
40393
|
-
this.startPointer.path.setBorderColor(resolvedLineColor);
|
|
40394
40396
|
this.startPointer.path.setBorderWidth(this.lineWidth);
|
|
40395
|
-
this.startPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40396
40397
|
this.endPointer = getEndPointer(endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
40397
|
-
this.endPointer.path.setBorderColor(resolvedLineColor);
|
|
40398
40398
|
this.endPointer.path.setBorderWidth(this.lineWidth);
|
|
40399
|
-
this.endPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40400
40399
|
this.offsetLines();
|
|
40401
40400
|
this.lines.setBorderWidth(this.lineWidth);
|
|
40402
|
-
this.lines.setBorderColor(resolvedLineColor);
|
|
40403
40401
|
this.lines.setBorderStyle(this.borderStyle);
|
|
40404
40402
|
this.updateTitle();
|
|
40405
40403
|
}
|
|
@@ -42179,7 +42177,6 @@ class Shape extends BaseItem {
|
|
|
42179
42177
|
}
|
|
42180
42178
|
applyBackgroundColor(backgroundColor) {
|
|
42181
42179
|
this.backgroundColor = backgroundColor;
|
|
42182
|
-
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
42183
42180
|
}
|
|
42184
42181
|
setBackgroundColor(backgroundColor) {
|
|
42185
42182
|
this.emit({
|
|
@@ -42215,7 +42212,6 @@ class Shape extends BaseItem {
|
|
|
42215
42212
|
}
|
|
42216
42213
|
applyBorderColor(borderColor) {
|
|
42217
42214
|
this.borderColor = borderColor;
|
|
42218
|
-
this.path.setBorderColor(resolveColor(borderColor, conf.theme, "foreground"));
|
|
42219
42215
|
}
|
|
42220
42216
|
setBorderColor(borderColor) {
|
|
42221
42217
|
this.emit({
|
|
@@ -42323,6 +42319,8 @@ class Shape extends BaseItem {
|
|
|
42323
42319
|
if (this.transformationRenderBlock) {
|
|
42324
42320
|
return;
|
|
42325
42321
|
}
|
|
42322
|
+
this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
42323
|
+
this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
42326
42324
|
this.path.render(context);
|
|
42327
42325
|
this.text.render(context);
|
|
42328
42326
|
if (this.getLinkTo()) {
|
|
@@ -42423,9 +42421,7 @@ class Shape extends BaseItem {
|
|
|
42423
42421
|
this.text.setContainer(this.textContainer.copy());
|
|
42424
42422
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
42425
42423
|
this.path.transform(this.transformation.toMatrix());
|
|
42426
|
-
this.path.setBackgroundColor(this.backgroundColor);
|
|
42427
42424
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
42428
|
-
this.path.setBorderColor(this.borderColor);
|
|
42429
42425
|
this.path.setBorderWidth(this.borderWidth);
|
|
42430
42426
|
this.path.setBorderStyle(this.borderStyle);
|
|
42431
42427
|
this.path.setBorderOpacity(this.borderOpacity);
|
|
@@ -42474,7 +42470,7 @@ class StickerData {
|
|
|
42474
42470
|
linkTo;
|
|
42475
42471
|
text;
|
|
42476
42472
|
itemType = "Sticker";
|
|
42477
|
-
constructor(backgroundColor =
|
|
42473
|
+
constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
|
|
42478
42474
|
this.backgroundColor = backgroundColor;
|
|
42479
42475
|
this.transformation = transformation;
|
|
42480
42476
|
this.linkTo = linkTo;
|
|
@@ -42612,7 +42608,6 @@ class Sticker extends BaseItem {
|
|
|
42612
42608
|
this.stickerPath.transform(this.transformation.toMatrix());
|
|
42613
42609
|
this.text.setContainer(this.textContainer.copy());
|
|
42614
42610
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
42615
|
-
this.stickerPath.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
42616
42611
|
this.saveStickerData();
|
|
42617
42612
|
}
|
|
42618
42613
|
setId(id) {
|
|
@@ -42656,7 +42651,6 @@ class Sticker extends BaseItem {
|
|
|
42656
42651
|
}
|
|
42657
42652
|
applyBackgroundColor(backgroundColor) {
|
|
42658
42653
|
this.backgroundColor = backgroundColor;
|
|
42659
|
-
this.stickerPath.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
42660
42654
|
}
|
|
42661
42655
|
setBackgroundColor(backgroundColor) {
|
|
42662
42656
|
this.emit({
|
|
@@ -42703,6 +42697,7 @@ class Sticker extends BaseItem {
|
|
|
42703
42697
|
return;
|
|
42704
42698
|
}
|
|
42705
42699
|
this.renderShadow(context);
|
|
42700
|
+
this.stickerPath.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
42706
42701
|
this.stickerPath.render(context);
|
|
42707
42702
|
this.text.render(context);
|
|
42708
42703
|
if (this.getLinkTo()) {
|
|
@@ -43245,9 +43240,7 @@ class Frame2 extends BaseItem {
|
|
|
43245
43240
|
this.path.transform(this.transformation.toMatrix());
|
|
43246
43241
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
43247
43242
|
}
|
|
43248
|
-
this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
43249
43243
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
43250
|
-
this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
43251
43244
|
this.path.setBorderWidth(this.borderWidth);
|
|
43252
43245
|
this.path.setBorderStyle(this.borderStyle);
|
|
43253
43246
|
this.path.setBorderOpacity(this.borderOpacity);
|
|
@@ -43398,7 +43391,6 @@ class Frame2 extends BaseItem {
|
|
|
43398
43391
|
}
|
|
43399
43392
|
applyBackgroundColor(backgroundColor) {
|
|
43400
43393
|
this.backgroundColor = backgroundColor;
|
|
43401
|
-
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
43402
43394
|
}
|
|
43403
43395
|
setBackgroundColor(backgroundColor) {
|
|
43404
43396
|
this.emit({
|
|
@@ -43446,6 +43438,8 @@ class Frame2 extends BaseItem {
|
|
|
43446
43438
|
if (this.transformationRenderBlock) {
|
|
43447
43439
|
return;
|
|
43448
43440
|
}
|
|
43441
|
+
this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
43442
|
+
this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
43449
43443
|
this.path.render(context);
|
|
43450
43444
|
this.renderNewShape(context);
|
|
43451
43445
|
if (this.getLinkTo()) {
|
|
@@ -45108,8 +45102,9 @@ class Drawing extends BaseItem {
|
|
|
45108
45102
|
lines = [];
|
|
45109
45103
|
linkTo;
|
|
45110
45104
|
strokeWidth = 1;
|
|
45111
|
-
borderColor =
|
|
45105
|
+
borderColor = semanticColor("contrastNeutral");
|
|
45112
45106
|
borderStyle = "solid";
|
|
45107
|
+
colorRole = "foreground";
|
|
45113
45108
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
45114
45109
|
borderOpacity = 1;
|
|
45115
45110
|
transformationRenderBlock = undefined;
|
|
@@ -45143,6 +45138,7 @@ class Drawing extends BaseItem {
|
|
|
45143
45138
|
transformation: this.transformation.serialize(),
|
|
45144
45139
|
strokeStyle: this.borderColor,
|
|
45145
45140
|
strokeWidth: this.strokeWidth,
|
|
45141
|
+
colorRole: this.colorRole,
|
|
45146
45142
|
linkTo: this.linkTo.serialize()
|
|
45147
45143
|
};
|
|
45148
45144
|
}
|
|
@@ -45156,6 +45152,9 @@ class Drawing extends BaseItem {
|
|
|
45156
45152
|
this.transformation.deserialize(data.transformation);
|
|
45157
45153
|
this.borderColor = coerceColorValue(data.strokeStyle);
|
|
45158
45154
|
this.strokeWidth = data.strokeWidth;
|
|
45155
|
+
if (data.colorRole) {
|
|
45156
|
+
this.colorRole = data.colorRole;
|
|
45157
|
+
}
|
|
45159
45158
|
this.updateGeometry();
|
|
45160
45159
|
return this;
|
|
45161
45160
|
}
|
|
@@ -45262,7 +45261,8 @@ class Drawing extends BaseItem {
|
|
|
45262
45261
|
}
|
|
45263
45262
|
const ctx = context.ctx;
|
|
45264
45263
|
ctx.save();
|
|
45265
|
-
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme,
|
|
45264
|
+
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
45265
|
+
ctx.globalAlpha = this.borderOpacity;
|
|
45266
45266
|
ctx.lineWidth = this.strokeWidth;
|
|
45267
45267
|
ctx.lineCap = "round";
|
|
45268
45268
|
ctx.setLineDash(this.linePattern);
|
|
@@ -45289,7 +45289,8 @@ class Drawing extends BaseItem {
|
|
|
45289
45289
|
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
45290
45290
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
45291
45291
|
pathElement.setAttribute("d", this.getPathData());
|
|
45292
|
-
pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme,
|
|
45292
|
+
pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
|
|
45293
|
+
pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
|
|
45293
45294
|
pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
|
|
45294
45295
|
pathElement.setAttribute("fill", "none");
|
|
45295
45296
|
svg3.appendChild(pathElement);
|
|
@@ -45445,6 +45446,13 @@ class Drawing extends BaseItem {
|
|
|
45445
45446
|
getStrokeColor() {
|
|
45446
45447
|
return this.borderColor;
|
|
45447
45448
|
}
|
|
45449
|
+
setColorRole(role) {
|
|
45450
|
+
this.colorRole = role;
|
|
45451
|
+
return this;
|
|
45452
|
+
}
|
|
45453
|
+
getColorRole() {
|
|
45454
|
+
return this.colorRole;
|
|
45455
|
+
}
|
|
45448
45456
|
setStrokeWidth(width2) {
|
|
45449
45457
|
this.emit({
|
|
45450
45458
|
class: "Drawing",
|
|
@@ -46430,7 +46438,7 @@ class AddDrawing extends BoardTool {
|
|
|
46430
46438
|
drawing = null;
|
|
46431
46439
|
isDown = false;
|
|
46432
46440
|
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
46433
|
-
strokeColor =
|
|
46441
|
+
strokeColor = semanticColor("contrastNeutral");
|
|
46434
46442
|
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
46435
46443
|
constructor(board) {
|
|
46436
46444
|
super(board);
|
|
@@ -46485,6 +46493,9 @@ class AddDrawing extends BoardTool {
|
|
|
46485
46493
|
isHighlighter() {
|
|
46486
46494
|
return false;
|
|
46487
46495
|
}
|
|
46496
|
+
applyDrawingRole(drawing) {
|
|
46497
|
+
drawing.setColorRole("foreground");
|
|
46498
|
+
}
|
|
46488
46499
|
leftButtonDown() {
|
|
46489
46500
|
if (this.strokeColor === "none") {
|
|
46490
46501
|
return false;
|
|
@@ -46524,9 +46535,10 @@ class AddDrawing extends BoardTool {
|
|
|
46524
46535
|
}
|
|
46525
46536
|
const drawing = new Drawing(this.board, points);
|
|
46526
46537
|
drawing.transformation.translateTo(x, y);
|
|
46527
|
-
drawing.setStrokeColor(this.strokeColor);
|
|
46538
|
+
drawing.setStrokeColor(coerceColorValue(this.strokeColor));
|
|
46528
46539
|
drawing.setStrokeWidth(this.strokeWidth);
|
|
46529
46540
|
drawing.setBorderStyle(this.strokeStyle);
|
|
46541
|
+
this.applyDrawingRole(drawing);
|
|
46530
46542
|
this.board.add(drawing).updateMbr();
|
|
46531
46543
|
this.board.selection.removeAll();
|
|
46532
46544
|
this.drawing = null;
|
|
@@ -46565,16 +46577,17 @@ class AddDrawing extends BoardTool {
|
|
|
46565
46577
|
return;
|
|
46566
46578
|
}
|
|
46567
46579
|
const drawing = this.drawing;
|
|
46568
|
-
drawing.setStrokeColor(this.strokeColor);
|
|
46580
|
+
drawing.setStrokeColor(coerceColorValue(this.strokeColor));
|
|
46569
46581
|
drawing.setStrokeWidth(this.strokeWidth);
|
|
46570
46582
|
drawing.setBorderStyle(this.strokeStyle);
|
|
46583
|
+
this.applyDrawingRole(drawing);
|
|
46571
46584
|
drawing.render(context);
|
|
46572
46585
|
}
|
|
46573
46586
|
}
|
|
46574
46587
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
46575
46588
|
class AddHighlighter extends AddDrawing {
|
|
46576
46589
|
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
46577
|
-
strokeColor =
|
|
46590
|
+
strokeColor = semanticColor("contrastGreen");
|
|
46578
46591
|
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
46579
46592
|
constructor(board) {
|
|
46580
46593
|
super(board);
|
|
@@ -46592,6 +46605,10 @@ class AddHighlighter extends AddDrawing {
|
|
|
46592
46605
|
isHighlighter() {
|
|
46593
46606
|
return true;
|
|
46594
46607
|
}
|
|
46608
|
+
applyDrawingRole(drawing) {
|
|
46609
|
+
drawing.setColorRole("background");
|
|
46610
|
+
drawing.setStrokeOpacity(0.5);
|
|
46611
|
+
}
|
|
46595
46612
|
updateSettings() {
|
|
46596
46613
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
46597
46614
|
strokeWidth: this.strokeWidth,
|
|
@@ -47011,7 +47028,8 @@ class AddSticker extends BoardTool {
|
|
|
47011
47028
|
}
|
|
47012
47029
|
setCursor(color2) {
|
|
47013
47030
|
if (conf.STICKER_COLOR_NAMES) {
|
|
47014
|
-
const
|
|
47031
|
+
const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
|
|
47032
|
+
const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
|
|
47015
47033
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
47016
47034
|
} else {
|
|
47017
47035
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -47022,7 +47040,7 @@ class AddSticker extends BoardTool {
|
|
|
47022
47040
|
class: "Sticker",
|
|
47023
47041
|
method: "setBackgroundColor",
|
|
47024
47042
|
item: [this.sticker.getId()],
|
|
47025
|
-
backgroundColor: color2
|
|
47043
|
+
backgroundColor: coerceColorValue(color2)
|
|
47026
47044
|
});
|
|
47027
47045
|
this.setCursor(color2);
|
|
47028
47046
|
this.board.tools.publish();
|
|
@@ -12,7 +12,7 @@ import { LinkTo } from "../LinkTo/LinkTo";
|
|
|
12
12
|
import { DocumentFactory } from "../../api/DocumentFactory";
|
|
13
13
|
import { Board } from "../../Board";
|
|
14
14
|
import { BaseItem } from "../BaseItem/BaseItem";
|
|
15
|
-
import { ColorValue } from "../../..";
|
|
15
|
+
import { ColorValue, ColorRole } from "../../..";
|
|
16
16
|
export interface DrawingData {
|
|
17
17
|
itemType: "Drawing";
|
|
18
18
|
points: {
|
|
@@ -22,6 +22,7 @@ export interface DrawingData {
|
|
|
22
22
|
transformation: TransformationData;
|
|
23
23
|
strokeStyle: ColorValue | string;
|
|
24
24
|
strokeWidth: number;
|
|
25
|
+
colorRole?: ColorRole;
|
|
25
26
|
linkTo?: string;
|
|
26
27
|
}
|
|
27
28
|
export declare class Drawing extends BaseItem {
|
|
@@ -38,6 +39,7 @@ export declare class Drawing extends BaseItem {
|
|
|
38
39
|
strokeWidth: BorderWidth;
|
|
39
40
|
borderColor: ColorValue;
|
|
40
41
|
borderStyle: BorderStyle;
|
|
42
|
+
colorRole: ColorRole;
|
|
41
43
|
private linePattern;
|
|
42
44
|
private borderOpacity;
|
|
43
45
|
transformationRenderBlock?: boolean;
|
|
@@ -68,6 +70,8 @@ export declare class Drawing extends BaseItem {
|
|
|
68
70
|
getBorderStyle(): BorderStyle;
|
|
69
71
|
setStrokeColor(color: ColorValue): this;
|
|
70
72
|
getStrokeColor(): ColorValue;
|
|
73
|
+
setColorRole(role: ColorRole): this;
|
|
74
|
+
getColorRole(): ColorRole;
|
|
71
75
|
setStrokeWidth(width: number): this;
|
|
72
76
|
getLinkTo(): string | undefined;
|
|
73
77
|
getStrokeWidth(): number;
|
|
@@ -27,8 +27,8 @@ interface LayoutTextNode {
|
|
|
27
27
|
interface LeafStyle {
|
|
28
28
|
fontStyle: string;
|
|
29
29
|
fontWeight: string;
|
|
30
|
-
color: string;
|
|
31
|
-
backgroundColor: string | undefined;
|
|
30
|
+
color: string | import("../../../..").ColorValue;
|
|
31
|
+
backgroundColor: string | import("../../../..").ColorValue | undefined;
|
|
32
32
|
fontSize: number | "auto";
|
|
33
33
|
fontFamily: string;
|
|
34
34
|
textDecorationLine?: 'underline';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HorisontalAlignment } from "../../Alignment";
|
|
2
|
+
import type { ColorValue } from "../../../..";
|
|
2
3
|
export declare const TextStyles: string[];
|
|
3
4
|
export type TextStyle = (typeof TextStyles)[number];
|
|
4
5
|
export type TextNode = {
|
|
@@ -14,9 +15,9 @@ export type TextNode = {
|
|
|
14
15
|
subscript: boolean;
|
|
15
16
|
superscript: boolean;
|
|
16
17
|
fontFamily?: string;
|
|
17
|
-
fontColor?: string;
|
|
18
|
+
fontColor?: string | ColorValue;
|
|
18
19
|
fontSize?: number | "auto";
|
|
19
|
-
fontHighlight?: string;
|
|
20
|
+
fontHighlight?: string | ColorValue;
|
|
20
21
|
enableAuto?: boolean;
|
|
21
22
|
paddingTop?: number;
|
|
22
23
|
paddingBottom?: number;
|
|
@@ -47,7 +47,7 @@ export declare class RichText extends BaseItem {
|
|
|
47
47
|
private selection?;
|
|
48
48
|
transformationRenderBlock?: boolean;
|
|
49
49
|
lastClickPoint?: Point;
|
|
50
|
-
initialFontColor?: string;
|
|
50
|
+
initialFontColor?: string | import("../../..").ColorValue;
|
|
51
51
|
frameMbr?: Mbr;
|
|
52
52
|
private _onLimitReached;
|
|
53
53
|
private shrinkWidth;
|
|
@@ -109,7 +109,7 @@ export declare class RichText extends BaseItem {
|
|
|
109
109
|
set onLimitReached(handler: () => void);
|
|
110
110
|
setSelectionFontColor(format: string, selectionContext?: SelectionContext): SlateOp[];
|
|
111
111
|
setHyperLink(link: string | undefined, selection: BaseRange | null): SlateOp[];
|
|
112
|
-
applySelectionFontColor(fontColor: string): void;
|
|
112
|
+
applySelectionFontColor(fontColor: string | import("../../..").ColorValue): void;
|
|
113
113
|
setSelectionFontStyle(style: TextStyle | TextStyle[], selectionContext?: SelectionContext): SlateOp[];
|
|
114
114
|
applySelectionFontSize(fontSize: number, selectionContext?: SelectionContext): void;
|
|
115
115
|
setSelectionFontSize(fontSize: number | "auto", selectionContext?: SelectionContext): SlateOp[];
|
|
@@ -118,11 +118,11 @@ export declare class RichText extends BaseItem {
|
|
|
118
118
|
setSelectionHorisontalAlignment(horisontalAlignment: HorisontalAlignment, selectionContext?: SelectionContext): SlateOp[];
|
|
119
119
|
applySetSelectionHorisontalAlignment(horisontalAlignment: HorisontalAlignment, selectionContext?: SelectionContext): void;
|
|
120
120
|
getFontStyles(): TextStyle[];
|
|
121
|
-
getFontColor(): string;
|
|
121
|
+
getFontColor(): string | import("../../..").ColorValue;
|
|
122
122
|
getFontFamily(): string;
|
|
123
123
|
getFontSize(): number;
|
|
124
124
|
getMinFontSize(): number;
|
|
125
|
-
getFontHighlight(): string;
|
|
125
|
+
getFontHighlight(): string | import("../../..").ColorValue;
|
|
126
126
|
getBlockType(): BlockType;
|
|
127
127
|
getHorisontalAlignment(): HorisontalAlignment | undefined;
|
|
128
128
|
getVerticalAlignment(): VerticalAlignment;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Editor } from 'slate';
|
|
2
|
-
|
|
2
|
+
import type { ColorValue } from '../../../../..';
|
|
3
|
+
export declare function applySelectionFontColor(editor: Editor, fontColor: string | ColorValue): void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Editor } from 'slate';
|
|
2
|
-
|
|
2
|
+
import type { ColorValue } from '../../../../..';
|
|
3
|
+
export declare function setSelectionFontHighlight(editor: Editor, format: string | ColorValue, selectionContext?: string): void;
|
package/dist/types/Settings.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BrowserPath2D } from "./api/BrowserPath2DFactory";
|
|
|
4
4
|
import { MockDocumentFactory } from "./api/MockDocumentFactory";
|
|
5
5
|
import { MockPath2D } from "./api/MockPath2D";
|
|
6
6
|
import type { BorderStyle } from "./Items/Path/Path";
|
|
7
|
-
import type { Theme } from "./Color/ColorValue";
|
|
7
|
+
import type { Theme, ColorValue } from "./Color/ColorValue";
|
|
8
8
|
export interface Connection {
|
|
9
9
|
connectionId: number;
|
|
10
10
|
getCurrentUser: () => string;
|
|
@@ -80,8 +80,8 @@ type ExportFrameDecorationRecord = Record<`${"top" | "bottom"}-${"left" | "right
|
|
|
80
80
|
export type DefaultTextStyles = {
|
|
81
81
|
fontFamily: string;
|
|
82
82
|
fontSize: number;
|
|
83
|
-
fontColor: string;
|
|
84
|
-
fontHighlight: string;
|
|
83
|
+
fontColor: string | ColorValue;
|
|
84
|
+
fontHighlight: string | ColorValue;
|
|
85
85
|
lineHeight: number;
|
|
86
86
|
bold: boolean;
|
|
87
87
|
italic: boolean;
|
|
@@ -182,7 +182,7 @@ export declare const conf: {
|
|
|
182
182
|
TEXT_COLORS: string[];
|
|
183
183
|
TEXT_HIGHLIGHT_COLORS: string[];
|
|
184
184
|
STICKER_COLORS: string[];
|
|
185
|
-
DEFAULT_STICKER_COLOR:
|
|
185
|
+
DEFAULT_STICKER_COLOR: import("./Color").SemanticColor;
|
|
186
186
|
STICKER_COLOR_NAMES: string[];
|
|
187
187
|
SHAPE_STROKE_COLORS: string[];
|
|
188
188
|
SHAPE_DEFAULT_STROKE_COLOR: string;
|
|
@@ -4,21 +4,24 @@ import { Drawing } from '../../Items/Drawing';
|
|
|
4
4
|
import { DrawingContext } from '../../Items/DrawingContext';
|
|
5
5
|
import { BorderStyle } from '../../Items/Path';
|
|
6
6
|
import { BoardTool } from '../BoardTool';
|
|
7
|
+
import { ColorValue } from '../../..';
|
|
7
8
|
export declare class AddDrawing extends BoardTool {
|
|
8
9
|
drawing: Drawing | null;
|
|
9
10
|
isDown: boolean;
|
|
10
11
|
strokeWidth: number;
|
|
11
|
-
strokeColor: string;
|
|
12
|
+
strokeColor: ColorValue | string;
|
|
12
13
|
strokeStyle: BorderStyle;
|
|
13
14
|
constructor(board: Board);
|
|
14
15
|
private updateSettings;
|
|
15
16
|
setStrokeWidth(strokeWidth: number): void;
|
|
16
|
-
setStrokeColor(strokeColor: string): void;
|
|
17
|
+
setStrokeColor(strokeColor: ColorValue | string): void;
|
|
17
18
|
getStrokeWidth(): number;
|
|
18
|
-
getStrokeColor(): string;
|
|
19
|
+
getStrokeColor(): ColorValue | string;
|
|
19
20
|
renderPointerCircle(point: Point, context: DrawingContext): void;
|
|
20
21
|
setCursor(): void;
|
|
21
22
|
isHighlighter(): boolean;
|
|
23
|
+
/** Apply the correct color role and opacity to a drawing based on tool type. */
|
|
24
|
+
protected applyDrawingRole(drawing: Drawing): void;
|
|
22
25
|
leftButtonDown(): boolean;
|
|
23
26
|
pointerMoveBy(_x: number, _y: number): boolean;
|
|
24
27
|
leftButtonUp(): boolean;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Board } from '../../Board';
|
|
2
|
+
import { Drawing } from '../../Items/Drawing';
|
|
2
3
|
import { BorderStyle } from '../../Items/Path';
|
|
4
|
+
import { ColorValue } from '../../..';
|
|
3
5
|
import { AddDrawing } from './AddDrawing';
|
|
4
6
|
export declare class AddHighlighter extends AddDrawing {
|
|
5
7
|
strokeWidth: number;
|
|
6
|
-
strokeColor: string;
|
|
8
|
+
strokeColor: ColorValue | string;
|
|
7
9
|
strokeStyle: BorderStyle;
|
|
8
10
|
constructor(board: Board);
|
|
9
11
|
isHighlighter(): boolean;
|
|
12
|
+
protected applyDrawingRole(drawing: Drawing): void;
|
|
10
13
|
private updateSettings;
|
|
11
14
|
}
|
|
@@ -2,6 +2,7 @@ import { Board } from '../../Board';
|
|
|
2
2
|
import { Line, Mbr } from '../../Items';
|
|
3
3
|
import { DrawingContext } from '../../Items/DrawingContext';
|
|
4
4
|
import { Sticker } from '../../Items/Sticker';
|
|
5
|
+
import { ColorValue } from '../../..';
|
|
5
6
|
import { BoardTool } from '../BoardTool';
|
|
6
7
|
export declare class AddSticker extends BoardTool {
|
|
7
8
|
static MIN_SIZE: number;
|
|
@@ -11,9 +12,9 @@ export declare class AddSticker extends BoardTool {
|
|
|
11
12
|
sticker: Sticker;
|
|
12
13
|
isDown: boolean;
|
|
13
14
|
constructor(board: Board);
|
|
14
|
-
setCursor(color?: string): void;
|
|
15
|
-
setBackgroundColor(color: string): void;
|
|
16
|
-
getBackgroundColor():
|
|
15
|
+
setCursor(color?: ColorValue | string): void;
|
|
16
|
+
setBackgroundColor(color: ColorValue | string): void;
|
|
17
|
+
getBackgroundColor(): ColorValue;
|
|
17
18
|
leftButtonDown(): boolean;
|
|
18
19
|
pointerMoveBy(_x: number, _y: number): boolean;
|
|
19
20
|
leftButtonUp(): boolean;
|