microboard-temp 0.6.4 → 0.7.0
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 +258 -48
- package/dist/cjs/index.js +258 -48
- package/dist/cjs/node.js +258 -48
- package/dist/esm/browser.js +258 -48
- package/dist/esm/index.js +258 -48
- package/dist/esm/node.js +258 -48
- package/dist/types/Color/ColorValue.d.ts +54 -0
- package/dist/types/Color/ContrastPalette.d.ts +45 -0
- package/dist/types/Color/colorUtils.d.ts +32 -0
- package/dist/types/Color/index.d.ts +6 -0
- package/dist/types/Color/resolveColor.d.ts +26 -0
- package/dist/types/Items/Connector/Connector.d.ts +4 -3
- package/dist/types/Items/Connector/ConnectorOperations.d.ts +3 -2
- package/dist/types/Items/Drawing/Drawing.d.ts +5 -3
- package/dist/types/Items/Drawing/DrawingOperation.d.ts +2 -1
- package/dist/types/Items/Frame/Frame.d.ts +7 -6
- package/dist/types/Items/Frame/FrameData.d.ts +6 -5
- package/dist/types/Items/Frame/FrameOperation.d.ts +2 -1
- package/dist/types/Items/Mbr/Mbr.d.ts +3 -3
- package/dist/types/Items/Shape/Shape.d.ts +9 -8
- package/dist/types/Items/Shape/ShapeData.d.ts +6 -5
- package/dist/types/Items/Shape/ShapeOperation.d.ts +3 -2
- package/dist/types/Items/Sticker/Sticker.d.ts +5 -4
- package/dist/types/Items/Sticker/StickerOperation.d.ts +4 -3
- package/dist/types/Settings.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -608,6 +608,184 @@ var require_escape_html = __commonJS((exports, module) => {
|
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
+
// src/Color/ColorValue.ts
|
|
612
|
+
var SEMANTIC_COLOR_IDS = [
|
|
613
|
+
"contrastNeutral",
|
|
614
|
+
"contrastGray",
|
|
615
|
+
"contrastRed",
|
|
616
|
+
"contrastOrange",
|
|
617
|
+
"contrastYellow",
|
|
618
|
+
"contrastGreen",
|
|
619
|
+
"contrastTeal",
|
|
620
|
+
"contrastBlue",
|
|
621
|
+
"contrastPurple",
|
|
622
|
+
"contrastPink",
|
|
623
|
+
"contrastBrown"
|
|
624
|
+
];
|
|
625
|
+
var semanticColor = (id) => ({
|
|
626
|
+
type: "semantic",
|
|
627
|
+
id
|
|
628
|
+
});
|
|
629
|
+
var fixedColor = (value) => ({
|
|
630
|
+
type: "fixed",
|
|
631
|
+
value
|
|
632
|
+
});
|
|
633
|
+
function coerceColorValue(value) {
|
|
634
|
+
if (typeof value === "string")
|
|
635
|
+
return fixedColor(value);
|
|
636
|
+
return value;
|
|
637
|
+
}
|
|
638
|
+
function coerceOptionalColorValue(value) {
|
|
639
|
+
if (value === undefined)
|
|
640
|
+
return;
|
|
641
|
+
return coerceColorValue(value);
|
|
642
|
+
}
|
|
643
|
+
// src/Color/ContrastPalette.ts
|
|
644
|
+
var CONTRAST_PALETTE = {
|
|
645
|
+
contrastNeutral: {
|
|
646
|
+
id: "contrastNeutral",
|
|
647
|
+
label: "Neutral",
|
|
648
|
+
light: "rgb(245, 246, 248)",
|
|
649
|
+
dark: "rgb(20, 21, 26)",
|
|
650
|
+
contrastRatio: 17.2
|
|
651
|
+
},
|
|
652
|
+
contrastGray: {
|
|
653
|
+
id: "contrastGray",
|
|
654
|
+
label: "Gray",
|
|
655
|
+
light: "rgb(224, 225, 229)",
|
|
656
|
+
dark: "rgb(55, 58, 70)",
|
|
657
|
+
contrastRatio: 8.6
|
|
658
|
+
},
|
|
659
|
+
contrastRed: {
|
|
660
|
+
id: "contrastRed",
|
|
661
|
+
label: "Red",
|
|
662
|
+
light: "rgb(255, 215, 210)",
|
|
663
|
+
dark: "rgb(120, 10, 10)",
|
|
664
|
+
contrastRatio: 8.5
|
|
665
|
+
},
|
|
666
|
+
contrastOrange: {
|
|
667
|
+
id: "contrastOrange",
|
|
668
|
+
label: "Orange",
|
|
669
|
+
light: "rgb(255, 229, 195)",
|
|
670
|
+
dark: "rgb(110, 44, 0)",
|
|
671
|
+
contrastRatio: 8.4
|
|
672
|
+
},
|
|
673
|
+
contrastYellow: {
|
|
674
|
+
id: "contrastYellow",
|
|
675
|
+
label: "Yellow",
|
|
676
|
+
light: "rgb(255, 249, 185)",
|
|
677
|
+
dark: "rgb(89, 71, 0)",
|
|
678
|
+
contrastRatio: 8.3
|
|
679
|
+
},
|
|
680
|
+
contrastGreen: {
|
|
681
|
+
id: "contrastGreen",
|
|
682
|
+
label: "Green",
|
|
683
|
+
light: "rgb(193, 243, 179)",
|
|
684
|
+
dark: "rgb(0, 74, 22)",
|
|
685
|
+
contrastRatio: 8.4
|
|
686
|
+
},
|
|
687
|
+
contrastTeal: {
|
|
688
|
+
id: "contrastTeal",
|
|
689
|
+
label: "Teal",
|
|
690
|
+
light: "rgb(176, 243, 240)",
|
|
691
|
+
dark: "rgb(0, 68, 64)",
|
|
692
|
+
contrastRatio: 8.8
|
|
693
|
+
},
|
|
694
|
+
contrastBlue: {
|
|
695
|
+
id: "contrastBlue",
|
|
696
|
+
label: "Blue",
|
|
697
|
+
light: "rgb(208, 222, 255)",
|
|
698
|
+
dark: "rgb(15, 42, 148)",
|
|
699
|
+
contrastRatio: 8.7
|
|
700
|
+
},
|
|
701
|
+
contrastPurple: {
|
|
702
|
+
id: "contrastPurple",
|
|
703
|
+
label: "Purple",
|
|
704
|
+
light: "rgb(232, 210, 255)",
|
|
705
|
+
dark: "rgb(62, 0, 132)",
|
|
706
|
+
contrastRatio: 9.8
|
|
707
|
+
},
|
|
708
|
+
contrastPink: {
|
|
709
|
+
id: "contrastPink",
|
|
710
|
+
label: "Pink",
|
|
711
|
+
light: "rgb(255, 212, 228)",
|
|
712
|
+
dark: "rgb(120, 0, 55)",
|
|
713
|
+
contrastRatio: 8.5
|
|
714
|
+
},
|
|
715
|
+
contrastBrown: {
|
|
716
|
+
id: "contrastBrown",
|
|
717
|
+
label: "Brown",
|
|
718
|
+
light: "rgb(242, 224, 200)",
|
|
719
|
+
dark: "rgb(74, 33, 0)",
|
|
720
|
+
contrastRatio: 10.7
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
var CONTRAST_PALETTE_LIST = [
|
|
724
|
+
CONTRAST_PALETTE.contrastNeutral,
|
|
725
|
+
CONTRAST_PALETTE.contrastGray,
|
|
726
|
+
CONTRAST_PALETTE.contrastRed,
|
|
727
|
+
CONTRAST_PALETTE.contrastOrange,
|
|
728
|
+
CONTRAST_PALETTE.contrastYellow,
|
|
729
|
+
CONTRAST_PALETTE.contrastGreen,
|
|
730
|
+
CONTRAST_PALETTE.contrastTeal,
|
|
731
|
+
CONTRAST_PALETTE.contrastBlue,
|
|
732
|
+
CONTRAST_PALETTE.contrastPurple,
|
|
733
|
+
CONTRAST_PALETTE.contrastPink,
|
|
734
|
+
CONTRAST_PALETTE.contrastBrown
|
|
735
|
+
];
|
|
736
|
+
// src/Color/resolveColor.ts
|
|
737
|
+
function resolveColor(value, theme, role) {
|
|
738
|
+
if (typeof value === "string")
|
|
739
|
+
return value;
|
|
740
|
+
if (value.type === "fixed") {
|
|
741
|
+
return value.value;
|
|
742
|
+
}
|
|
743
|
+
const pair = CONTRAST_PALETTE[value.id];
|
|
744
|
+
const lightMode = theme === "light";
|
|
745
|
+
if (role === "background") {
|
|
746
|
+
return lightMode ? pair.light : pair.dark;
|
|
747
|
+
} else {
|
|
748
|
+
return lightMode ? pair.dark : pair.light;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function resolvePairedForeground(background, theme) {
|
|
752
|
+
if (background.type === "semantic") {
|
|
753
|
+
return resolveColor(background, theme, "foreground");
|
|
754
|
+
}
|
|
755
|
+
return theme === "light" ? CONTRAST_PALETTE.contrastNeutral.dark : CONTRAST_PALETTE.contrastNeutral.light;
|
|
756
|
+
}
|
|
757
|
+
// src/Color/colorUtils.ts
|
|
758
|
+
function srgbChannelToLinear(channel) {
|
|
759
|
+
const c = channel / 255;
|
|
760
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
761
|
+
}
|
|
762
|
+
function relativeLuminance(r, g, b) {
|
|
763
|
+
return 0.2126 * srgbChannelToLinear(r) + 0.7152 * srgbChannelToLinear(g) + 0.0722 * srgbChannelToLinear(b);
|
|
764
|
+
}
|
|
765
|
+
function contrastRatio(lum1, lum2) {
|
|
766
|
+
const lighter = Math.max(lum1, lum2);
|
|
767
|
+
const darker = Math.min(lum1, lum2);
|
|
768
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
769
|
+
}
|
|
770
|
+
function meetsWCAG_AA(ratio) {
|
|
771
|
+
return ratio >= 4.5;
|
|
772
|
+
}
|
|
773
|
+
function meetsWCAG_AAA(ratio) {
|
|
774
|
+
return ratio >= 7;
|
|
775
|
+
}
|
|
776
|
+
function parseCssRgb(css) {
|
|
777
|
+
const m = css.match(/rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)/);
|
|
778
|
+
if (!m)
|
|
779
|
+
return null;
|
|
780
|
+
return [parseFloat(m[1]), parseFloat(m[2]), parseFloat(m[3])];
|
|
781
|
+
}
|
|
782
|
+
function cssContrastRatio(css1, css2) {
|
|
783
|
+
const rgb1 = parseCssRgb(css1);
|
|
784
|
+
const rgb2 = parseCssRgb(css2);
|
|
785
|
+
if (!rgb1 || !rgb2)
|
|
786
|
+
return null;
|
|
787
|
+
return contrastRatio(relativeLuminance(...rgb1), relativeLuminance(...rgb2));
|
|
788
|
+
}
|
|
611
789
|
// src/BoardCommand.ts
|
|
612
790
|
class BoardCommand {
|
|
613
791
|
board;
|
|
@@ -1201,12 +1379,14 @@ class Mbr {
|
|
|
1201
1379
|
}
|
|
1202
1380
|
render(context) {
|
|
1203
1381
|
const { ctx } = context;
|
|
1204
|
-
|
|
1205
|
-
|
|
1382
|
+
const resolvedBg = typeof this.backgroundColor === "string" ? this.backgroundColor : resolveColor(this.backgroundColor, "light", "background");
|
|
1383
|
+
const resolvedBorder = typeof this.borderColor === "string" ? this.borderColor : resolveColor(this.borderColor, "light", "foreground");
|
|
1384
|
+
if (resolvedBg !== "none") {
|
|
1385
|
+
ctx.fillStyle = resolvedBg;
|
|
1206
1386
|
ctx.fillRect(this.left, this.top, this.getWidth(), this.getHeight());
|
|
1207
1387
|
}
|
|
1208
1388
|
if (this.strokeWidth) {
|
|
1209
|
-
ctx.strokeStyle =
|
|
1389
|
+
ctx.strokeStyle = resolvedBorder;
|
|
1210
1390
|
ctx.lineWidth = this.strokeWidth;
|
|
1211
1391
|
ctx.setLineDash([]);
|
|
1212
1392
|
ctx.strokeRect(this.left, this.top, this.getWidth(), this.getHeight());
|
|
@@ -6765,6 +6945,7 @@ var conf = {
|
|
|
6765
6945
|
plus: "Plus",
|
|
6766
6946
|
plusAI: "PlusAI"
|
|
6767
6947
|
},
|
|
6948
|
+
theme: "light",
|
|
6768
6949
|
EVENTS_PUBLISH_INTERVAL: 100,
|
|
6769
6950
|
EVENTS_RESEND_INTERVAL: 1000,
|
|
6770
6951
|
SELECTION_COLOR: "rgb(71, 120, 245)",
|
|
@@ -37042,7 +37223,7 @@ class Connector2 extends BaseItem {
|
|
|
37042
37223
|
this.endPointerStyle = endPointerStyle;
|
|
37043
37224
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
37044
37225
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
37045
|
-
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
37226
|
+
this.lineColor = lineColor ?? fixedColor(CONNECTOR_COLOR);
|
|
37046
37227
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
37047
37228
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
37048
37229
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
@@ -37549,7 +37730,7 @@ class Connector2 extends BaseItem {
|
|
|
37549
37730
|
div.style.transformOrigin = "left top";
|
|
37550
37731
|
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
37551
37732
|
div.style.position = "absolute";
|
|
37552
|
-
div.setAttribute("data-line-color", this.lineColor);
|
|
37733
|
+
div.setAttribute("data-line-color", resolveColor(this.lineColor, conf.theme, "foreground"));
|
|
37553
37734
|
div.setAttribute("data-line-width", this.lineWidth.toString());
|
|
37554
37735
|
div.setAttribute("data-line-style", this.lineStyle);
|
|
37555
37736
|
div.setAttribute("data-border-style", this.borderStyle);
|
|
@@ -37645,7 +37826,9 @@ class Connector2 extends BaseItem {
|
|
|
37645
37826
|
this.startPointerStyle = data.startPointerStyle ?? this.startPointerStyle;
|
|
37646
37827
|
this.endPointerStyle = data.endPointerStyle ?? this.endPointerStyle;
|
|
37647
37828
|
this.lineStyle = data.lineStyle ?? this.lineStyle;
|
|
37648
|
-
|
|
37829
|
+
if (data.lineColor != null) {
|
|
37830
|
+
this.lineColor = coerceColorValue(data.lineColor);
|
|
37831
|
+
}
|
|
37649
37832
|
this.lineWidth = data.lineWidth ?? this.lineWidth;
|
|
37650
37833
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
37651
37834
|
if (data.transformation) {
|
|
@@ -37738,16 +37921,17 @@ class Connector2 extends BaseItem {
|
|
|
37738
37921
|
const endPoint = this.endPoint;
|
|
37739
37922
|
this.lines = getLine(this.lineStyle, startPoint, endPoint, this.middlePoint).addConnectedItemType(this.itemType);
|
|
37740
37923
|
this.startPointer = getStartPointer(startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
37741
|
-
|
|
37924
|
+
const resolvedLineColor = resolveColor(this.lineColor, conf.theme, "foreground");
|
|
37925
|
+
this.startPointer.path.setBorderColor(resolvedLineColor);
|
|
37742
37926
|
this.startPointer.path.setBorderWidth(this.lineWidth);
|
|
37743
|
-
this.startPointer.path.setBackgroundColor(
|
|
37927
|
+
this.startPointer.path.setBackgroundColor(resolvedLineColor);
|
|
37744
37928
|
this.endPointer = getEndPointer(endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
37745
|
-
this.endPointer.path.setBorderColor(
|
|
37929
|
+
this.endPointer.path.setBorderColor(resolvedLineColor);
|
|
37746
37930
|
this.endPointer.path.setBorderWidth(this.lineWidth);
|
|
37747
|
-
this.endPointer.path.setBackgroundColor(
|
|
37931
|
+
this.endPointer.path.setBackgroundColor(resolvedLineColor);
|
|
37748
37932
|
this.offsetLines();
|
|
37749
37933
|
this.lines.setBorderWidth(this.lineWidth);
|
|
37750
|
-
this.lines.setBorderColor(
|
|
37934
|
+
this.lines.setBorderColor(resolvedLineColor);
|
|
37751
37935
|
this.lines.setBorderStyle(this.borderStyle);
|
|
37752
37936
|
this.updateTitle();
|
|
37753
37937
|
}
|
|
@@ -37853,7 +38037,7 @@ class ConnectorData2 {
|
|
|
37853
38037
|
startPointerStyle = "None";
|
|
37854
38038
|
endPointerStyle = "ArrowThin";
|
|
37855
38039
|
lineStyle = "straight";
|
|
37856
|
-
lineColor =
|
|
38040
|
+
lineColor = fixedColor(CONNECTOR_COLOR);
|
|
37857
38041
|
linkTo;
|
|
37858
38042
|
lineWidth = 1;
|
|
37859
38043
|
borderStyle = "solid";
|
|
@@ -38546,7 +38730,7 @@ class DefaultShapeData {
|
|
|
38546
38730
|
text;
|
|
38547
38731
|
linkTo;
|
|
38548
38732
|
itemType = "Shape";
|
|
38549
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor = conf.SHAPE_DEFAULT_STROKE_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
38733
|
+
constructor(shapeType = "Rectangle", backgroundColor = fixedColor("none"), backgroundOpacity = 1, borderColor = fixedColor(conf.SHAPE_DEFAULT_STROKE_COLOR), borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
38550
38734
|
this.shapeType = shapeType;
|
|
38551
38735
|
this.backgroundColor = backgroundColor;
|
|
38552
38736
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -39414,9 +39598,13 @@ class Shape extends BaseItem {
|
|
|
39414
39598
|
if (data.linkTo) {
|
|
39415
39599
|
this.linkTo.deserialize(data.linkTo);
|
|
39416
39600
|
}
|
|
39417
|
-
|
|
39601
|
+
if (data.backgroundColor != null) {
|
|
39602
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
39603
|
+
}
|
|
39418
39604
|
this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
|
|
39419
|
-
|
|
39605
|
+
if (data.borderColor != null) {
|
|
39606
|
+
this.borderColor = coerceColorValue(data.borderColor);
|
|
39607
|
+
}
|
|
39420
39608
|
this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
|
|
39421
39609
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
39422
39610
|
this.borderWidth = data.borderWidth ?? this.borderWidth;
|
|
@@ -39523,7 +39711,7 @@ class Shape extends BaseItem {
|
|
|
39523
39711
|
}
|
|
39524
39712
|
applyBackgroundColor(backgroundColor) {
|
|
39525
39713
|
this.backgroundColor = backgroundColor;
|
|
39526
|
-
this.path.setBackgroundColor(backgroundColor);
|
|
39714
|
+
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
39527
39715
|
}
|
|
39528
39716
|
setBackgroundColor(backgroundColor) {
|
|
39529
39717
|
this.emit({
|
|
@@ -39559,7 +39747,7 @@ class Shape extends BaseItem {
|
|
|
39559
39747
|
}
|
|
39560
39748
|
applyBorderColor(borderColor) {
|
|
39561
39749
|
this.borderColor = borderColor;
|
|
39562
|
-
this.path.setBorderColor(borderColor);
|
|
39750
|
+
this.path.setBorderColor(resolveColor(borderColor, conf.theme, "foreground"));
|
|
39563
39751
|
}
|
|
39564
39752
|
setBorderColor(borderColor) {
|
|
39565
39753
|
this.emit({
|
|
@@ -39818,7 +40006,7 @@ class StickerData {
|
|
|
39818
40006
|
linkTo;
|
|
39819
40007
|
text;
|
|
39820
40008
|
itemType = "Sticker";
|
|
39821
|
-
constructor(backgroundColor = stickerColors["Sky Blue"], transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
|
|
40009
|
+
constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
|
|
39822
40010
|
this.backgroundColor = backgroundColor;
|
|
39823
40011
|
this.transformation = transformation;
|
|
39824
40012
|
this.linkTo = linkTo;
|
|
@@ -39930,7 +40118,9 @@ class Sticker extends BaseItem {
|
|
|
39930
40118
|
};
|
|
39931
40119
|
}
|
|
39932
40120
|
deserialize(data) {
|
|
39933
|
-
|
|
40121
|
+
if (data.backgroundColor != null) {
|
|
40122
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
40123
|
+
}
|
|
39934
40124
|
if (data.transformation) {
|
|
39935
40125
|
this.transformation.deserialize(data.transformation);
|
|
39936
40126
|
}
|
|
@@ -39954,7 +40144,7 @@ class Sticker extends BaseItem {
|
|
|
39954
40144
|
this.stickerPath.transform(this.transformation.toMatrix());
|
|
39955
40145
|
this.text.setContainer(this.textContainer.copy());
|
|
39956
40146
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
39957
|
-
this.stickerPath.setBackgroundColor(this.backgroundColor);
|
|
40147
|
+
this.stickerPath.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
39958
40148
|
this.saveStickerData();
|
|
39959
40149
|
}
|
|
39960
40150
|
setId(id) {
|
|
@@ -39998,7 +40188,7 @@ class Sticker extends BaseItem {
|
|
|
39998
40188
|
}
|
|
39999
40189
|
applyBackgroundColor(backgroundColor) {
|
|
40000
40190
|
this.backgroundColor = backgroundColor;
|
|
40001
|
-
this.stickerPath.setBackgroundColor(backgroundColor);
|
|
40191
|
+
this.stickerPath.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
40002
40192
|
}
|
|
40003
40193
|
setBackgroundColor(backgroundColor) {
|
|
40004
40194
|
this.emit({
|
|
@@ -40061,7 +40251,7 @@ class Sticker extends BaseItem {
|
|
|
40061
40251
|
const unscaledWidth = itemMbr.getWidth() / scaleX;
|
|
40062
40252
|
const unscaledHeight = height2 / scaleY;
|
|
40063
40253
|
div.id = this.getId();
|
|
40064
|
-
div.style.backgroundColor = this.backgroundColor;
|
|
40254
|
+
div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
|
|
40065
40255
|
div.style.width = `${unscaledWidth}px`;
|
|
40066
40256
|
div.style.height = `${unscaledHeight}px`;
|
|
40067
40257
|
div.style.transformOrigin = "top left";
|
|
@@ -40335,7 +40525,7 @@ class DefaultFrameData {
|
|
|
40335
40525
|
canChangeRatio;
|
|
40336
40526
|
linkTo;
|
|
40337
40527
|
itemType = "Frame";
|
|
40338
|
-
constructor(shapeType = "Custom", backgroundColor = FRAME_FILL_COLOR, backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
|
|
40528
|
+
constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
|
|
40339
40529
|
this.shapeType = shapeType;
|
|
40340
40530
|
this.backgroundColor = backgroundColor;
|
|
40341
40531
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -40543,9 +40733,13 @@ class Frame2 extends BaseItem {
|
|
|
40543
40733
|
this.initPath();
|
|
40544
40734
|
}
|
|
40545
40735
|
this.linkTo.deserialize(data.linkTo);
|
|
40546
|
-
|
|
40736
|
+
if (data.backgroundColor != null) {
|
|
40737
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
40738
|
+
}
|
|
40547
40739
|
this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
|
|
40548
|
-
|
|
40740
|
+
if (data.borderColor != null) {
|
|
40741
|
+
this.borderColor = coerceColorValue(data.borderColor);
|
|
40742
|
+
}
|
|
40549
40743
|
this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
|
|
40550
40744
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
40551
40745
|
this.borderWidth = data.borderWidth ?? this.borderWidth;
|
|
@@ -40583,9 +40777,9 @@ class Frame2 extends BaseItem {
|
|
|
40583
40777
|
this.path.transform(this.transformation.toMatrix());
|
|
40584
40778
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
40585
40779
|
}
|
|
40586
|
-
this.path.setBackgroundColor(this.backgroundColor);
|
|
40780
|
+
this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
40587
40781
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
40588
|
-
this.path.setBorderColor(this.borderColor);
|
|
40782
|
+
this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
40589
40783
|
this.path.setBorderWidth(this.borderWidth);
|
|
40590
40784
|
this.path.setBorderStyle(this.borderStyle);
|
|
40591
40785
|
this.path.setBorderOpacity(this.borderOpacity);
|
|
@@ -40736,7 +40930,7 @@ class Frame2 extends BaseItem {
|
|
|
40736
40930
|
}
|
|
40737
40931
|
applyBackgroundColor(backgroundColor) {
|
|
40738
40932
|
this.backgroundColor = backgroundColor;
|
|
40739
|
-
this.path.setBackgroundColor(backgroundColor);
|
|
40933
|
+
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
40740
40934
|
}
|
|
40741
40935
|
setBackgroundColor(backgroundColor) {
|
|
40742
40936
|
this.emit({
|
|
@@ -40808,9 +41002,9 @@ class Frame2 extends BaseItem {
|
|
|
40808
41002
|
renderHTML(documentFactory) {
|
|
40809
41003
|
const div = documentFactory.createElement("frame-item");
|
|
40810
41004
|
div.id = this.getId();
|
|
40811
|
-
div.style.backgroundColor = this.backgroundColor;
|
|
41005
|
+
div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
|
|
40812
41006
|
div.style.opacity = this.backgroundOpacity.toString();
|
|
40813
|
-
div.style.borderColor = this.borderColor;
|
|
41007
|
+
div.style.borderColor = resolveColor(this.borderColor, conf.theme, "foreground");
|
|
40814
41008
|
div.style.borderWidth = `${this.borderWidth}px`;
|
|
40815
41009
|
div.style.borderStyle = this.borderStyle;
|
|
40816
41010
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
@@ -42446,6 +42640,7 @@ class Drawing extends BaseItem {
|
|
|
42446
42640
|
lines = [];
|
|
42447
42641
|
linkTo;
|
|
42448
42642
|
strokeWidth = 1;
|
|
42643
|
+
borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
|
|
42449
42644
|
borderStyle = "solid";
|
|
42450
42645
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
42451
42646
|
borderOpacity = 1;
|
|
@@ -42491,7 +42686,7 @@ class Drawing extends BaseItem {
|
|
|
42491
42686
|
this.linkTo.deserialize(data.linkTo);
|
|
42492
42687
|
this.optimizePoints();
|
|
42493
42688
|
this.transformation.deserialize(data.transformation);
|
|
42494
|
-
this.borderColor = data.strokeStyle;
|
|
42689
|
+
this.borderColor = coerceColorValue(data.strokeStyle);
|
|
42495
42690
|
this.strokeWidth = data.strokeWidth;
|
|
42496
42691
|
this.updateGeometry();
|
|
42497
42692
|
return this;
|
|
@@ -42599,7 +42794,7 @@ class Drawing extends BaseItem {
|
|
|
42599
42794
|
}
|
|
42600
42795
|
const ctx = context.ctx;
|
|
42601
42796
|
ctx.save();
|
|
42602
|
-
ctx.strokeStyle = this.borderColor;
|
|
42797
|
+
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
|
|
42603
42798
|
ctx.lineWidth = this.strokeWidth;
|
|
42604
42799
|
ctx.lineCap = "round";
|
|
42605
42800
|
ctx.setLineDash(this.linePattern);
|
|
@@ -42626,7 +42821,7 @@ class Drawing extends BaseItem {
|
|
|
42626
42821
|
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
42627
42822
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
42628
42823
|
pathElement.setAttribute("d", this.getPathData());
|
|
42629
|
-
pathElement.setAttribute("stroke", this.borderColor);
|
|
42824
|
+
pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
42630
42825
|
pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
|
|
42631
42826
|
pathElement.setAttribute("fill", "none");
|
|
42632
42827
|
svg3.appendChild(pathElement);
|
|
@@ -42719,7 +42914,7 @@ class Drawing extends BaseItem {
|
|
|
42719
42914
|
case "Drawing":
|
|
42720
42915
|
switch (op.method) {
|
|
42721
42916
|
case "setStrokeColor":
|
|
42722
|
-
this.borderColor = op.color;
|
|
42917
|
+
this.borderColor = coerceColorValue(op.color);
|
|
42723
42918
|
break;
|
|
42724
42919
|
case "setStrokeWidth":
|
|
42725
42920
|
this.strokeWidth = op.width;
|
|
@@ -49291,32 +49486,31 @@ class Camera {
|
|
|
49291
49486
|
this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
|
|
49292
49487
|
}
|
|
49293
49488
|
zoomRelativeToPointBy(scale, x, y, duration = 400) {
|
|
49294
|
-
const
|
|
49295
|
-
const
|
|
49296
|
-
const
|
|
49297
|
-
const
|
|
49489
|
+
const base3 = this.localAnimationTarget ?? this.matrix;
|
|
49490
|
+
const startScaleX = base3.scaleX;
|
|
49491
|
+
const startScaleY = base3.scaleY;
|
|
49492
|
+
const startTranslateX = base3.translateX;
|
|
49493
|
+
const startTranslateY = base3.translateY;
|
|
49298
49494
|
const boardPointX = (x - startTranslateX) / startScaleX;
|
|
49299
49495
|
const boardPointY = (y - startTranslateY) / startScaleY;
|
|
49300
|
-
const
|
|
49301
|
-
const
|
|
49302
|
-
const targetTranslateX = x - boardPointX * targetScaleX;
|
|
49303
|
-
const targetTranslateY = y - boardPointY * targetScaleY;
|
|
49304
|
-
const finalScaleX = this.limitScale(targetScaleX);
|
|
49305
|
-
const finalScaleY = this.limitScale(targetScaleY);
|
|
49496
|
+
const finalScaleX = this.limitScale(startScaleX * scale);
|
|
49497
|
+
const finalScaleY = this.limitScale(startScaleY * scale);
|
|
49306
49498
|
if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
|
|
49307
49499
|
return;
|
|
49308
49500
|
}
|
|
49501
|
+
const finalTranslateX = x - boardPointX * finalScaleX;
|
|
49502
|
+
const finalTranslateY = y - boardPointY * finalScaleY;
|
|
49309
49503
|
if (duration === 0) {
|
|
49310
|
-
this.matrix.translateX =
|
|
49311
|
-
this.matrix.translateY =
|
|
49504
|
+
this.matrix.translateX = finalTranslateX;
|
|
49505
|
+
this.matrix.translateY = finalTranslateY;
|
|
49312
49506
|
this.matrix.scaleX = finalScaleX;
|
|
49313
49507
|
this.matrix.scaleY = finalScaleY;
|
|
49314
49508
|
this.subject.publish(this);
|
|
49315
49509
|
return;
|
|
49316
49510
|
}
|
|
49317
49511
|
this.animateLocalToTarget({
|
|
49318
|
-
translateX:
|
|
49319
|
-
translateY:
|
|
49512
|
+
translateX: finalTranslateX,
|
|
49513
|
+
translateY: finalTranslateY,
|
|
49320
49514
|
scaleX: finalScaleX,
|
|
49321
49515
|
scaleY: finalScaleY
|
|
49322
49516
|
});
|
|
@@ -57106,12 +57300,17 @@ export {
|
|
|
57106
57300
|
tempStorage,
|
|
57107
57301
|
tagByType,
|
|
57108
57302
|
stickerColors,
|
|
57303
|
+
srgbChannelToLinear,
|
|
57109
57304
|
sha256,
|
|
57305
|
+
semanticColor,
|
|
57110
57306
|
scalePatterns,
|
|
57111
57307
|
scaleElementBy,
|
|
57112
57308
|
rgbToRgba,
|
|
57309
|
+
resolvePairedForeground,
|
|
57310
|
+
resolveColor,
|
|
57113
57311
|
resizeAndConvertToPng,
|
|
57114
57312
|
resetElementScale,
|
|
57313
|
+
relativeLuminance,
|
|
57115
57314
|
registerItem,
|
|
57116
57315
|
quickAddItem,
|
|
57117
57316
|
prepareVideo,
|
|
@@ -57120,8 +57319,11 @@ export {
|
|
|
57120
57319
|
positionRelatively,
|
|
57121
57320
|
positionAbsolutely,
|
|
57122
57321
|
parsersHTML,
|
|
57322
|
+
parseCssRgb,
|
|
57123
57323
|
omitDefaultProperties,
|
|
57124
57324
|
messageRouter,
|
|
57325
|
+
meetsWCAG_AAA,
|
|
57326
|
+
meetsWCAG_AA,
|
|
57125
57327
|
itemValidators,
|
|
57126
57328
|
itemFactories,
|
|
57127
57329
|
isShallowSimilarTo,
|
|
@@ -57148,14 +57350,19 @@ export {
|
|
|
57148
57350
|
getControlPointData,
|
|
57149
57351
|
getBlobFromDataURL,
|
|
57150
57352
|
forceNumberIntoInterval,
|
|
57353
|
+
fixedColor,
|
|
57151
57354
|
fileTosha256,
|
|
57152
57355
|
exportBoardSnapshot,
|
|
57153
57356
|
editModeHotkeyRegistry,
|
|
57154
57357
|
decodeHtml,
|
|
57155
57358
|
defaultCursors as cursors,
|
|
57359
|
+
cssContrastRatio,
|
|
57156
57360
|
createVideoItem,
|
|
57157
57361
|
createEvents,
|
|
57362
|
+
contrastRatio,
|
|
57158
57363
|
conf,
|
|
57364
|
+
coerceOptionalColorValue,
|
|
57365
|
+
coerceColorValue,
|
|
57159
57366
|
checkHotkeys,
|
|
57160
57367
|
catmullRomInterpolate,
|
|
57161
57368
|
captureFrame,
|
|
@@ -57181,6 +57388,7 @@ export {
|
|
|
57181
57388
|
STEP_STROKE_WIDTH,
|
|
57182
57389
|
SHAPE_LAST_TYPE_KEY,
|
|
57183
57390
|
SHAPES_CATEGORIES,
|
|
57391
|
+
SEMANTIC_COLOR_IDS,
|
|
57184
57392
|
RichText,
|
|
57185
57393
|
QuadraticBezier,
|
|
57186
57394
|
Presence,
|
|
@@ -57232,6 +57440,8 @@ export {
|
|
|
57232
57440
|
Camera,
|
|
57233
57441
|
CURSORS_IDLE_CLEANUP_DELAY,
|
|
57234
57442
|
CURSORS_ANIMATION_DURATION,
|
|
57443
|
+
CONTRAST_PALETTE_LIST,
|
|
57444
|
+
CONTRAST_PALETTE,
|
|
57235
57445
|
CONTEXT_NODE_HIGHLIGHT_COLOR,
|
|
57236
57446
|
CONNECTOR_POINTER_TYPES,
|
|
57237
57447
|
BoardSelection,
|