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/index.js CHANGED
@@ -637,12 +637,17 @@ __export(exports_src, {
637
637
  tempStorage: () => tempStorage,
638
638
  tagByType: () => tagByType,
639
639
  stickerColors: () => stickerColors,
640
+ srgbChannelToLinear: () => srgbChannelToLinear,
640
641
  sha256: () => sha256,
642
+ semanticColor: () => semanticColor,
641
643
  scalePatterns: () => scalePatterns,
642
644
  scaleElementBy: () => scaleElementBy,
643
645
  rgbToRgba: () => rgbToRgba,
646
+ resolvePairedForeground: () => resolvePairedForeground,
647
+ resolveColor: () => resolveColor,
644
648
  resizeAndConvertToPng: () => resizeAndConvertToPng,
645
649
  resetElementScale: () => resetElementScale,
650
+ relativeLuminance: () => relativeLuminance,
646
651
  registerItem: () => registerItem,
647
652
  quickAddItem: () => quickAddItem,
648
653
  prepareVideo: () => prepareVideo,
@@ -651,8 +656,11 @@ __export(exports_src, {
651
656
  positionRelatively: () => positionRelatively,
652
657
  positionAbsolutely: () => positionAbsolutely,
653
658
  parsersHTML: () => parsersHTML,
659
+ parseCssRgb: () => parseCssRgb,
654
660
  omitDefaultProperties: () => omitDefaultProperties,
655
661
  messageRouter: () => messageRouter,
662
+ meetsWCAG_AAA: () => meetsWCAG_AAA,
663
+ meetsWCAG_AA: () => meetsWCAG_AA,
656
664
  itemValidators: () => itemValidators,
657
665
  itemFactories: () => itemFactories,
658
666
  isShallowSimilarTo: () => isShallowSimilarTo,
@@ -679,14 +687,19 @@ __export(exports_src, {
679
687
  getControlPointData: () => getControlPointData,
680
688
  getBlobFromDataURL: () => getBlobFromDataURL,
681
689
  forceNumberIntoInterval: () => forceNumberIntoInterval,
690
+ fixedColor: () => fixedColor,
682
691
  fileTosha256: () => fileTosha256,
683
692
  exportBoardSnapshot: () => exportBoardSnapshot,
684
693
  editModeHotkeyRegistry: () => editModeHotkeyRegistry,
685
694
  decodeHtml: () => decodeHtml,
686
695
  cursors: () => defaultCursors,
696
+ cssContrastRatio: () => cssContrastRatio,
687
697
  createVideoItem: () => createVideoItem,
688
698
  createEvents: () => createEvents,
699
+ contrastRatio: () => contrastRatio,
689
700
  conf: () => conf,
701
+ coerceOptionalColorValue: () => coerceOptionalColorValue,
702
+ coerceColorValue: () => coerceColorValue,
690
703
  checkHotkeys: () => checkHotkeys,
691
704
  catmullRomInterpolate: () => catmullRomInterpolate,
692
705
  captureFrame: () => captureFrame,
@@ -712,6 +725,7 @@ __export(exports_src, {
712
725
  STEP_STROKE_WIDTH: () => STEP_STROKE_WIDTH,
713
726
  SHAPE_LAST_TYPE_KEY: () => SHAPE_LAST_TYPE_KEY,
714
727
  SHAPES_CATEGORIES: () => SHAPES_CATEGORIES,
728
+ SEMANTIC_COLOR_IDS: () => SEMANTIC_COLOR_IDS,
715
729
  RichText: () => RichText,
716
730
  QuadraticBezier: () => QuadraticBezier,
717
731
  Presence: () => Presence,
@@ -763,6 +777,8 @@ __export(exports_src, {
763
777
  Camera: () => Camera,
764
778
  CURSORS_IDLE_CLEANUP_DELAY: () => CURSORS_IDLE_CLEANUP_DELAY,
765
779
  CURSORS_ANIMATION_DURATION: () => CURSORS_ANIMATION_DURATION,
780
+ CONTRAST_PALETTE_LIST: () => CONTRAST_PALETTE_LIST,
781
+ CONTRAST_PALETTE: () => CONTRAST_PALETTE,
766
782
  CONTEXT_NODE_HIGHLIGHT_COLOR: () => CONTEXT_NODE_HIGHLIGHT_COLOR,
767
783
  CONNECTOR_POINTER_TYPES: () => CONNECTOR_POINTER_TYPES,
768
784
  BoardSelection: () => BoardSelection,
@@ -778,6 +794,184 @@ __export(exports_src, {
778
794
  });
779
795
  module.exports = __toCommonJS(exports_src);
780
796
 
797
+ // src/Color/ColorValue.ts
798
+ var SEMANTIC_COLOR_IDS = [
799
+ "contrastNeutral",
800
+ "contrastGray",
801
+ "contrastRed",
802
+ "contrastOrange",
803
+ "contrastYellow",
804
+ "contrastGreen",
805
+ "contrastTeal",
806
+ "contrastBlue",
807
+ "contrastPurple",
808
+ "contrastPink",
809
+ "contrastBrown"
810
+ ];
811
+ var semanticColor = (id) => ({
812
+ type: "semantic",
813
+ id
814
+ });
815
+ var fixedColor = (value) => ({
816
+ type: "fixed",
817
+ value
818
+ });
819
+ function coerceColorValue(value) {
820
+ if (typeof value === "string")
821
+ return fixedColor(value);
822
+ return value;
823
+ }
824
+ function coerceOptionalColorValue(value) {
825
+ if (value === undefined)
826
+ return;
827
+ return coerceColorValue(value);
828
+ }
829
+ // src/Color/ContrastPalette.ts
830
+ var CONTRAST_PALETTE = {
831
+ contrastNeutral: {
832
+ id: "contrastNeutral",
833
+ label: "Neutral",
834
+ light: "rgb(245, 246, 248)",
835
+ dark: "rgb(20, 21, 26)",
836
+ contrastRatio: 17.2
837
+ },
838
+ contrastGray: {
839
+ id: "contrastGray",
840
+ label: "Gray",
841
+ light: "rgb(224, 225, 229)",
842
+ dark: "rgb(55, 58, 70)",
843
+ contrastRatio: 8.6
844
+ },
845
+ contrastRed: {
846
+ id: "contrastRed",
847
+ label: "Red",
848
+ light: "rgb(255, 215, 210)",
849
+ dark: "rgb(120, 10, 10)",
850
+ contrastRatio: 8.5
851
+ },
852
+ contrastOrange: {
853
+ id: "contrastOrange",
854
+ label: "Orange",
855
+ light: "rgb(255, 229, 195)",
856
+ dark: "rgb(110, 44, 0)",
857
+ contrastRatio: 8.4
858
+ },
859
+ contrastYellow: {
860
+ id: "contrastYellow",
861
+ label: "Yellow",
862
+ light: "rgb(255, 249, 185)",
863
+ dark: "rgb(89, 71, 0)",
864
+ contrastRatio: 8.3
865
+ },
866
+ contrastGreen: {
867
+ id: "contrastGreen",
868
+ label: "Green",
869
+ light: "rgb(193, 243, 179)",
870
+ dark: "rgb(0, 74, 22)",
871
+ contrastRatio: 8.4
872
+ },
873
+ contrastTeal: {
874
+ id: "contrastTeal",
875
+ label: "Teal",
876
+ light: "rgb(176, 243, 240)",
877
+ dark: "rgb(0, 68, 64)",
878
+ contrastRatio: 8.8
879
+ },
880
+ contrastBlue: {
881
+ id: "contrastBlue",
882
+ label: "Blue",
883
+ light: "rgb(208, 222, 255)",
884
+ dark: "rgb(15, 42, 148)",
885
+ contrastRatio: 8.7
886
+ },
887
+ contrastPurple: {
888
+ id: "contrastPurple",
889
+ label: "Purple",
890
+ light: "rgb(232, 210, 255)",
891
+ dark: "rgb(62, 0, 132)",
892
+ contrastRatio: 9.8
893
+ },
894
+ contrastPink: {
895
+ id: "contrastPink",
896
+ label: "Pink",
897
+ light: "rgb(255, 212, 228)",
898
+ dark: "rgb(120, 0, 55)",
899
+ contrastRatio: 8.5
900
+ },
901
+ contrastBrown: {
902
+ id: "contrastBrown",
903
+ label: "Brown",
904
+ light: "rgb(242, 224, 200)",
905
+ dark: "rgb(74, 33, 0)",
906
+ contrastRatio: 10.7
907
+ }
908
+ };
909
+ var CONTRAST_PALETTE_LIST = [
910
+ CONTRAST_PALETTE.contrastNeutral,
911
+ CONTRAST_PALETTE.contrastGray,
912
+ CONTRAST_PALETTE.contrastRed,
913
+ CONTRAST_PALETTE.contrastOrange,
914
+ CONTRAST_PALETTE.contrastYellow,
915
+ CONTRAST_PALETTE.contrastGreen,
916
+ CONTRAST_PALETTE.contrastTeal,
917
+ CONTRAST_PALETTE.contrastBlue,
918
+ CONTRAST_PALETTE.contrastPurple,
919
+ CONTRAST_PALETTE.contrastPink,
920
+ CONTRAST_PALETTE.contrastBrown
921
+ ];
922
+ // src/Color/resolveColor.ts
923
+ function resolveColor(value, theme, role) {
924
+ if (typeof value === "string")
925
+ return value;
926
+ if (value.type === "fixed") {
927
+ return value.value;
928
+ }
929
+ const pair = CONTRAST_PALETTE[value.id];
930
+ const lightMode = theme === "light";
931
+ if (role === "background") {
932
+ return lightMode ? pair.light : pair.dark;
933
+ } else {
934
+ return lightMode ? pair.dark : pair.light;
935
+ }
936
+ }
937
+ function resolvePairedForeground(background, theme) {
938
+ if (background.type === "semantic") {
939
+ return resolveColor(background, theme, "foreground");
940
+ }
941
+ return theme === "light" ? CONTRAST_PALETTE.contrastNeutral.dark : CONTRAST_PALETTE.contrastNeutral.light;
942
+ }
943
+ // src/Color/colorUtils.ts
944
+ function srgbChannelToLinear(channel) {
945
+ const c = channel / 255;
946
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
947
+ }
948
+ function relativeLuminance(r, g, b) {
949
+ return 0.2126 * srgbChannelToLinear(r) + 0.7152 * srgbChannelToLinear(g) + 0.0722 * srgbChannelToLinear(b);
950
+ }
951
+ function contrastRatio(lum1, lum2) {
952
+ const lighter = Math.max(lum1, lum2);
953
+ const darker = Math.min(lum1, lum2);
954
+ return (lighter + 0.05) / (darker + 0.05);
955
+ }
956
+ function meetsWCAG_AA(ratio) {
957
+ return ratio >= 4.5;
958
+ }
959
+ function meetsWCAG_AAA(ratio) {
960
+ return ratio >= 7;
961
+ }
962
+ function parseCssRgb(css) {
963
+ const m = css.match(/rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)/);
964
+ if (!m)
965
+ return null;
966
+ return [parseFloat(m[1]), parseFloat(m[2]), parseFloat(m[3])];
967
+ }
968
+ function cssContrastRatio(css1, css2) {
969
+ const rgb1 = parseCssRgb(css1);
970
+ const rgb2 = parseCssRgb(css2);
971
+ if (!rgb1 || !rgb2)
972
+ return null;
973
+ return contrastRatio(relativeLuminance(...rgb1), relativeLuminance(...rgb2));
974
+ }
781
975
  // src/BoardCommand.ts
782
976
  class BoardCommand {
783
977
  board;
@@ -1371,12 +1565,14 @@ class Mbr {
1371
1565
  }
1372
1566
  render(context) {
1373
1567
  const { ctx } = context;
1374
- if (this.backgroundColor !== "none") {
1375
- ctx.fillStyle = this.backgroundColor;
1568
+ const resolvedBg = typeof this.backgroundColor === "string" ? this.backgroundColor : resolveColor(this.backgroundColor, "light", "background");
1569
+ const resolvedBorder = typeof this.borderColor === "string" ? this.borderColor : resolveColor(this.borderColor, "light", "foreground");
1570
+ if (resolvedBg !== "none") {
1571
+ ctx.fillStyle = resolvedBg;
1376
1572
  ctx.fillRect(this.left, this.top, this.getWidth(), this.getHeight());
1377
1573
  }
1378
1574
  if (this.strokeWidth) {
1379
- ctx.strokeStyle = this.borderColor;
1575
+ ctx.strokeStyle = resolvedBorder;
1380
1576
  ctx.lineWidth = this.strokeWidth;
1381
1577
  ctx.setLineDash([]);
1382
1578
  ctx.strokeRect(this.left, this.top, this.getWidth(), this.getHeight());
@@ -6935,6 +7131,7 @@ var conf = {
6935
7131
  plus: "Plus",
6936
7132
  plusAI: "PlusAI"
6937
7133
  },
7134
+ theme: "light",
6938
7135
  EVENTS_PUBLISH_INTERVAL: 100,
6939
7136
  EVENTS_RESEND_INTERVAL: 1000,
6940
7137
  SELECTION_COLOR: "rgb(71, 120, 245)",
@@ -37203,7 +37400,7 @@ class Connector2 extends BaseItem {
37203
37400
  this.endPointerStyle = endPointerStyle;
37204
37401
  this.transformation = new Transformation(this.id, this.board.events);
37205
37402
  this.linkTo = new LinkTo(this.id, this.board.events);
37206
- this.lineColor = lineColor ?? CONNECTOR_COLOR;
37403
+ this.lineColor = lineColor ?? fixedColor(CONNECTOR_COLOR);
37207
37404
  this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
37208
37405
  this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
37209
37406
  this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
@@ -37710,7 +37907,7 @@ class Connector2 extends BaseItem {
37710
37907
  div.style.transformOrigin = "left top";
37711
37908
  div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
37712
37909
  div.style.position = "absolute";
37713
- div.setAttribute("data-line-color", this.lineColor);
37910
+ div.setAttribute("data-line-color", resolveColor(this.lineColor, conf.theme, "foreground"));
37714
37911
  div.setAttribute("data-line-width", this.lineWidth.toString());
37715
37912
  div.setAttribute("data-line-style", this.lineStyle);
37716
37913
  div.setAttribute("data-border-style", this.borderStyle);
@@ -37806,7 +38003,9 @@ class Connector2 extends BaseItem {
37806
38003
  this.startPointerStyle = data.startPointerStyle ?? this.startPointerStyle;
37807
38004
  this.endPointerStyle = data.endPointerStyle ?? this.endPointerStyle;
37808
38005
  this.lineStyle = data.lineStyle ?? this.lineStyle;
37809
- this.lineColor = data.lineColor ?? this.lineColor;
38006
+ if (data.lineColor != null) {
38007
+ this.lineColor = coerceColorValue(data.lineColor);
38008
+ }
37810
38009
  this.lineWidth = data.lineWidth ?? this.lineWidth;
37811
38010
  this.borderStyle = data.borderStyle ?? this.borderStyle;
37812
38011
  if (data.transformation) {
@@ -37899,16 +38098,17 @@ class Connector2 extends BaseItem {
37899
38098
  const endPoint = this.endPoint;
37900
38099
  this.lines = getLine(this.lineStyle, startPoint, endPoint, this.middlePoint).addConnectedItemType(this.itemType);
37901
38100
  this.startPointer = getStartPointer(startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
37902
- this.startPointer.path.setBorderColor(this.lineColor);
38101
+ const resolvedLineColor = resolveColor(this.lineColor, conf.theme, "foreground");
38102
+ this.startPointer.path.setBorderColor(resolvedLineColor);
37903
38103
  this.startPointer.path.setBorderWidth(this.lineWidth);
37904
- this.startPointer.path.setBackgroundColor(this.lineColor);
38104
+ this.startPointer.path.setBackgroundColor(resolvedLineColor);
37905
38105
  this.endPointer = getEndPointer(endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
37906
- this.endPointer.path.setBorderColor(this.lineColor);
38106
+ this.endPointer.path.setBorderColor(resolvedLineColor);
37907
38107
  this.endPointer.path.setBorderWidth(this.lineWidth);
37908
- this.endPointer.path.setBackgroundColor(this.lineColor);
38108
+ this.endPointer.path.setBackgroundColor(resolvedLineColor);
37909
38109
  this.offsetLines();
37910
38110
  this.lines.setBorderWidth(this.lineWidth);
37911
- this.lines.setBorderColor(this.lineColor);
38111
+ this.lines.setBorderColor(resolvedLineColor);
37912
38112
  this.lines.setBorderStyle(this.borderStyle);
37913
38113
  this.updateTitle();
37914
38114
  }
@@ -38014,7 +38214,7 @@ class ConnectorData2 {
38014
38214
  startPointerStyle = "None";
38015
38215
  endPointerStyle = "ArrowThin";
38016
38216
  lineStyle = "straight";
38017
- lineColor = "";
38217
+ lineColor = fixedColor(CONNECTOR_COLOR);
38018
38218
  linkTo;
38019
38219
  lineWidth = 1;
38020
38220
  borderStyle = "solid";
@@ -38707,7 +38907,7 @@ class DefaultShapeData {
38707
38907
  text;
38708
38908
  linkTo;
38709
38909
  itemType = "Shape";
38710
- 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) {
38910
+ 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) {
38711
38911
  this.shapeType = shapeType;
38712
38912
  this.backgroundColor = backgroundColor;
38713
38913
  this.backgroundOpacity = backgroundOpacity;
@@ -39575,9 +39775,13 @@ class Shape extends BaseItem {
39575
39775
  if (data.linkTo) {
39576
39776
  this.linkTo.deserialize(data.linkTo);
39577
39777
  }
39578
- this.backgroundColor = data.backgroundColor ?? this.backgroundColor;
39778
+ if (data.backgroundColor != null) {
39779
+ this.backgroundColor = coerceColorValue(data.backgroundColor);
39780
+ }
39579
39781
  this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
39580
- this.borderColor = data.borderColor ?? this.borderColor;
39782
+ if (data.borderColor != null) {
39783
+ this.borderColor = coerceColorValue(data.borderColor);
39784
+ }
39581
39785
  this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
39582
39786
  this.borderStyle = data.borderStyle ?? this.borderStyle;
39583
39787
  this.borderWidth = data.borderWidth ?? this.borderWidth;
@@ -39684,7 +39888,7 @@ class Shape extends BaseItem {
39684
39888
  }
39685
39889
  applyBackgroundColor(backgroundColor) {
39686
39890
  this.backgroundColor = backgroundColor;
39687
- this.path.setBackgroundColor(backgroundColor);
39891
+ this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
39688
39892
  }
39689
39893
  setBackgroundColor(backgroundColor) {
39690
39894
  this.emit({
@@ -39720,7 +39924,7 @@ class Shape extends BaseItem {
39720
39924
  }
39721
39925
  applyBorderColor(borderColor) {
39722
39926
  this.borderColor = borderColor;
39723
- this.path.setBorderColor(borderColor);
39927
+ this.path.setBorderColor(resolveColor(borderColor, conf.theme, "foreground"));
39724
39928
  }
39725
39929
  setBorderColor(borderColor) {
39726
39930
  this.emit({
@@ -39979,7 +40183,7 @@ class StickerData {
39979
40183
  linkTo;
39980
40184
  text;
39981
40185
  itemType = "Sticker";
39982
- constructor(backgroundColor = stickerColors["Sky Blue"], transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40186
+ constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
39983
40187
  this.backgroundColor = backgroundColor;
39984
40188
  this.transformation = transformation;
39985
40189
  this.linkTo = linkTo;
@@ -40091,7 +40295,9 @@ class Sticker extends BaseItem {
40091
40295
  };
40092
40296
  }
40093
40297
  deserialize(data) {
40094
- this.backgroundColor = data.backgroundColor ?? this.backgroundColor;
40298
+ if (data.backgroundColor != null) {
40299
+ this.backgroundColor = coerceColorValue(data.backgroundColor);
40300
+ }
40095
40301
  if (data.transformation) {
40096
40302
  this.transformation.deserialize(data.transformation);
40097
40303
  }
@@ -40115,7 +40321,7 @@ class Sticker extends BaseItem {
40115
40321
  this.stickerPath.transform(this.transformation.toMatrix());
40116
40322
  this.text.setContainer(this.textContainer.copy());
40117
40323
  this.textContainer.transform(this.transformation.toMatrix());
40118
- this.stickerPath.setBackgroundColor(this.backgroundColor);
40324
+ this.stickerPath.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
40119
40325
  this.saveStickerData();
40120
40326
  }
40121
40327
  setId(id) {
@@ -40159,7 +40365,7 @@ class Sticker extends BaseItem {
40159
40365
  }
40160
40366
  applyBackgroundColor(backgroundColor) {
40161
40367
  this.backgroundColor = backgroundColor;
40162
- this.stickerPath.setBackgroundColor(backgroundColor);
40368
+ this.stickerPath.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
40163
40369
  }
40164
40370
  setBackgroundColor(backgroundColor) {
40165
40371
  this.emit({
@@ -40222,7 +40428,7 @@ class Sticker extends BaseItem {
40222
40428
  const unscaledWidth = itemMbr.getWidth() / scaleX;
40223
40429
  const unscaledHeight = height2 / scaleY;
40224
40430
  div.id = this.getId();
40225
- div.style.backgroundColor = this.backgroundColor;
40431
+ div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
40226
40432
  div.style.width = `${unscaledWidth}px`;
40227
40433
  div.style.height = `${unscaledHeight}px`;
40228
40434
  div.style.transformOrigin = "top left";
@@ -40496,7 +40702,7 @@ class DefaultFrameData {
40496
40702
  canChangeRatio;
40497
40703
  linkTo;
40498
40704
  itemType = "Frame";
40499
- 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) {
40705
+ 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) {
40500
40706
  this.shapeType = shapeType;
40501
40707
  this.backgroundColor = backgroundColor;
40502
40708
  this.backgroundOpacity = backgroundOpacity;
@@ -40704,9 +40910,13 @@ class Frame2 extends BaseItem {
40704
40910
  this.initPath();
40705
40911
  }
40706
40912
  this.linkTo.deserialize(data.linkTo);
40707
- this.backgroundColor = data.backgroundColor ?? this.backgroundColor;
40913
+ if (data.backgroundColor != null) {
40914
+ this.backgroundColor = coerceColorValue(data.backgroundColor);
40915
+ }
40708
40916
  this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
40709
- this.borderColor = data.borderColor ?? this.borderColor;
40917
+ if (data.borderColor != null) {
40918
+ this.borderColor = coerceColorValue(data.borderColor);
40919
+ }
40710
40920
  this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
40711
40921
  this.borderStyle = data.borderStyle ?? this.borderStyle;
40712
40922
  this.borderWidth = data.borderWidth ?? this.borderWidth;
@@ -40744,9 +40954,9 @@ class Frame2 extends BaseItem {
40744
40954
  this.path.transform(this.transformation.toMatrix());
40745
40955
  this.textContainer.transform(this.transformation.toMatrix());
40746
40956
  }
40747
- this.path.setBackgroundColor(this.backgroundColor);
40957
+ this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
40748
40958
  this.path.setBackgroundOpacity(this.backgroundOpacity);
40749
- this.path.setBorderColor(this.borderColor);
40959
+ this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
40750
40960
  this.path.setBorderWidth(this.borderWidth);
40751
40961
  this.path.setBorderStyle(this.borderStyle);
40752
40962
  this.path.setBorderOpacity(this.borderOpacity);
@@ -40897,7 +41107,7 @@ class Frame2 extends BaseItem {
40897
41107
  }
40898
41108
  applyBackgroundColor(backgroundColor) {
40899
41109
  this.backgroundColor = backgroundColor;
40900
- this.path.setBackgroundColor(backgroundColor);
41110
+ this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
40901
41111
  }
40902
41112
  setBackgroundColor(backgroundColor) {
40903
41113
  this.emit({
@@ -40969,9 +41179,9 @@ class Frame2 extends BaseItem {
40969
41179
  renderHTML(documentFactory) {
40970
41180
  const div = documentFactory.createElement("frame-item");
40971
41181
  div.id = this.getId();
40972
- div.style.backgroundColor = this.backgroundColor;
41182
+ div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
40973
41183
  div.style.opacity = this.backgroundOpacity.toString();
40974
- div.style.borderColor = this.borderColor;
41184
+ div.style.borderColor = resolveColor(this.borderColor, conf.theme, "foreground");
40975
41185
  div.style.borderWidth = `${this.borderWidth}px`;
40976
41186
  div.style.borderStyle = this.borderStyle;
40977
41187
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
@@ -42607,6 +42817,7 @@ class Drawing extends BaseItem {
42607
42817
  lines = [];
42608
42818
  linkTo;
42609
42819
  strokeWidth = 1;
42820
+ borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
42610
42821
  borderStyle = "solid";
42611
42822
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
42612
42823
  borderOpacity = 1;
@@ -42652,7 +42863,7 @@ class Drawing extends BaseItem {
42652
42863
  this.linkTo.deserialize(data.linkTo);
42653
42864
  this.optimizePoints();
42654
42865
  this.transformation.deserialize(data.transformation);
42655
- this.borderColor = data.strokeStyle;
42866
+ this.borderColor = coerceColorValue(data.strokeStyle);
42656
42867
  this.strokeWidth = data.strokeWidth;
42657
42868
  this.updateGeometry();
42658
42869
  return this;
@@ -42760,7 +42971,7 @@ class Drawing extends BaseItem {
42760
42971
  }
42761
42972
  const ctx = context.ctx;
42762
42973
  ctx.save();
42763
- ctx.strokeStyle = this.borderColor;
42974
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
42764
42975
  ctx.lineWidth = this.strokeWidth;
42765
42976
  ctx.lineCap = "round";
42766
42977
  ctx.setLineDash(this.linePattern);
@@ -42787,7 +42998,7 @@ class Drawing extends BaseItem {
42787
42998
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
42788
42999
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
42789
43000
  pathElement.setAttribute("d", this.getPathData());
42790
- pathElement.setAttribute("stroke", this.borderColor);
43001
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
42791
43002
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
42792
43003
  pathElement.setAttribute("fill", "none");
42793
43004
  svg3.appendChild(pathElement);
@@ -42880,7 +43091,7 @@ class Drawing extends BaseItem {
42880
43091
  case "Drawing":
42881
43092
  switch (op.method) {
42882
43093
  case "setStrokeColor":
42883
- this.borderColor = op.color;
43094
+ this.borderColor = coerceColorValue(op.color);
42884
43095
  break;
42885
43096
  case "setStrokeWidth":
42886
43097
  this.strokeWidth = op.width;
@@ -49452,32 +49663,31 @@ class Camera {
49452
49663
  this.zoomRelativeToPointBy(scale, this.pointer.x, this.pointer.y);
49453
49664
  }
49454
49665
  zoomRelativeToPointBy(scale, x, y, duration = 400) {
49455
- const startScaleX = this.matrix.scaleX;
49456
- const startScaleY = this.matrix.scaleY;
49457
- const startTranslateX = this.matrix.translateX;
49458
- const startTranslateY = this.matrix.translateY;
49666
+ const base3 = this.localAnimationTarget ?? this.matrix;
49667
+ const startScaleX = base3.scaleX;
49668
+ const startScaleY = base3.scaleY;
49669
+ const startTranslateX = base3.translateX;
49670
+ const startTranslateY = base3.translateY;
49459
49671
  const boardPointX = (x - startTranslateX) / startScaleX;
49460
49672
  const boardPointY = (y - startTranslateY) / startScaleY;
49461
- const targetScaleX = startScaleX * scale;
49462
- const targetScaleY = startScaleY * scale;
49463
- const targetTranslateX = x - boardPointX * targetScaleX;
49464
- const targetTranslateY = y - boardPointY * targetScaleY;
49465
- const finalScaleX = this.limitScale(targetScaleX);
49466
- const finalScaleY = this.limitScale(targetScaleY);
49673
+ const finalScaleX = this.limitScale(startScaleX * scale);
49674
+ const finalScaleY = this.limitScale(startScaleY * scale);
49467
49675
  if (finalScaleX === startScaleX && finalScaleY === startScaleY) {
49468
49676
  return;
49469
49677
  }
49678
+ const finalTranslateX = x - boardPointX * finalScaleX;
49679
+ const finalTranslateY = y - boardPointY * finalScaleY;
49470
49680
  if (duration === 0) {
49471
- this.matrix.translateX = targetTranslateX;
49472
- this.matrix.translateY = targetTranslateY;
49681
+ this.matrix.translateX = finalTranslateX;
49682
+ this.matrix.translateY = finalTranslateY;
49473
49683
  this.matrix.scaleX = finalScaleX;
49474
49684
  this.matrix.scaleY = finalScaleY;
49475
49685
  this.subject.publish(this);
49476
49686
  return;
49477
49687
  }
49478
49688
  this.animateLocalToTarget({
49479
- translateX: targetTranslateX,
49480
- translateY: targetTranslateY,
49689
+ translateX: finalTranslateX,
49690
+ translateY: finalTranslateY,
49481
49691
  scaleX: finalScaleX,
49482
49692
  scaleY: finalScaleY
49483
49693
  });