microboard-temp 0.8.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.
@@ -7211,7 +7211,7 @@ var conf = {
7211
7211
  "rgb(231, 232, 238)",
7212
7212
  "rgb(156, 156, 156)"
7213
7213
  ],
7214
- DEFAULT_STICKER_COLOR: "rgb(233, 208, 255)",
7214
+ DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
7215
7215
  STICKER_COLOR_NAMES: [
7216
7216
  "purple",
7217
7217
  "pink",
@@ -7421,7 +7421,7 @@ var conf = {
7421
7421
  DEFAULT_TEXT_STYLES: {
7422
7422
  fontFamily: "Manrope",
7423
7423
  fontSize: 14,
7424
- fontColor: "rgb(20, 21, 26)",
7424
+ fontColor: semanticColor("contrastNeutral"),
7425
7425
  fontHighlight: "",
7426
7426
  lineHeight: 1.4,
7427
7427
  bold: false,
@@ -9105,7 +9105,7 @@ function getTextStyle(data) {
9105
9105
  const leafStyle = {
9106
9106
  fontStyle: "normal",
9107
9107
  fontWeight: "normal",
9108
- color: data.fontColor ?? "black",
9108
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
9109
9109
  backgroundColor: data.fontHighlight,
9110
9110
  fontSize: data.fontSize ?? 14,
9111
9111
  fontFamily: data.fontFamily ?? "Arial"
@@ -40179,7 +40179,7 @@ class StickerData {
40179
40179
  linkTo;
40180
40180
  text;
40181
40181
  itemType = "Sticker";
40182
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40182
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40183
40183
  this.backgroundColor = backgroundColor;
40184
40184
  this.transformation = transformation;
40185
40185
  this.linkTo = linkTo;
@@ -42811,8 +42811,9 @@ class Drawing extends BaseItem {
42811
42811
  lines = [];
42812
42812
  linkTo;
42813
42813
  strokeWidth = 1;
42814
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
42814
+ borderColor = semanticColor("contrastNeutral");
42815
42815
  borderStyle = "solid";
42816
+ colorRole = "foreground";
42816
42817
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
42817
42818
  borderOpacity = 1;
42818
42819
  transformationRenderBlock = undefined;
@@ -42846,6 +42847,7 @@ class Drawing extends BaseItem {
42846
42847
  transformation: this.transformation.serialize(),
42847
42848
  strokeStyle: this.borderColor,
42848
42849
  strokeWidth: this.strokeWidth,
42850
+ colorRole: this.colorRole,
42849
42851
  linkTo: this.linkTo.serialize()
42850
42852
  };
42851
42853
  }
@@ -42859,6 +42861,9 @@ class Drawing extends BaseItem {
42859
42861
  this.transformation.deserialize(data.transformation);
42860
42862
  this.borderColor = coerceColorValue(data.strokeStyle);
42861
42863
  this.strokeWidth = data.strokeWidth;
42864
+ if (data.colorRole) {
42865
+ this.colorRole = data.colorRole;
42866
+ }
42862
42867
  this.updateGeometry();
42863
42868
  return this;
42864
42869
  }
@@ -42965,7 +42970,8 @@ class Drawing extends BaseItem {
42965
42970
  }
42966
42971
  const ctx = context.ctx;
42967
42972
  ctx.save();
42968
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
42973
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
42974
+ ctx.globalAlpha = this.borderOpacity;
42969
42975
  ctx.lineWidth = this.strokeWidth;
42970
42976
  ctx.lineCap = "round";
42971
42977
  ctx.setLineDash(this.linePattern);
@@ -42992,7 +42998,8 @@ class Drawing extends BaseItem {
42992
42998
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
42993
42999
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
42994
43000
  pathElement.setAttribute("d", this.getPathData());
42995
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
43001
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
43002
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
42996
43003
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
42997
43004
  pathElement.setAttribute("fill", "none");
42998
43005
  svg3.appendChild(pathElement);
@@ -43148,6 +43155,13 @@ class Drawing extends BaseItem {
43148
43155
  getStrokeColor() {
43149
43156
  return this.borderColor;
43150
43157
  }
43158
+ setColorRole(role) {
43159
+ this.colorRole = role;
43160
+ return this;
43161
+ }
43162
+ getColorRole() {
43163
+ return this.colorRole;
43164
+ }
43151
43165
  setStrokeWidth(width2) {
43152
43166
  this.emit({
43153
43167
  class: "Drawing",
@@ -44133,7 +44147,7 @@ class AddDrawing extends BoardTool {
44133
44147
  drawing = null;
44134
44148
  isDown = false;
44135
44149
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
44136
- strokeColor = conf.PEN_DEFAULT_COLOR;
44150
+ strokeColor = semanticColor("contrastNeutral");
44137
44151
  strokeStyle = conf.PEN_STROKE_STYLE;
44138
44152
  constructor(board) {
44139
44153
  super(board);
@@ -44188,6 +44202,9 @@ class AddDrawing extends BoardTool {
44188
44202
  isHighlighter() {
44189
44203
  return false;
44190
44204
  }
44205
+ applyDrawingRole(drawing) {
44206
+ drawing.setColorRole("foreground");
44207
+ }
44191
44208
  leftButtonDown() {
44192
44209
  if (this.strokeColor === "none") {
44193
44210
  return false;
@@ -44227,9 +44244,10 @@ class AddDrawing extends BoardTool {
44227
44244
  }
44228
44245
  const drawing = new Drawing(this.board, points);
44229
44246
  drawing.transformation.translateTo(x, y);
44230
- drawing.setStrokeColor(this.strokeColor);
44247
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44231
44248
  drawing.setStrokeWidth(this.strokeWidth);
44232
44249
  drawing.setBorderStyle(this.strokeStyle);
44250
+ this.applyDrawingRole(drawing);
44233
44251
  this.board.add(drawing).updateMbr();
44234
44252
  this.board.selection.removeAll();
44235
44253
  this.drawing = null;
@@ -44268,16 +44286,17 @@ class AddDrawing extends BoardTool {
44268
44286
  return;
44269
44287
  }
44270
44288
  const drawing = this.drawing;
44271
- drawing.setStrokeColor(this.strokeColor);
44289
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44272
44290
  drawing.setStrokeWidth(this.strokeWidth);
44273
44291
  drawing.setBorderStyle(this.strokeStyle);
44292
+ this.applyDrawingRole(drawing);
44274
44293
  drawing.render(context);
44275
44294
  }
44276
44295
  }
44277
44296
  // src/Tools/AddDrawing/AddHighlighter.ts
44278
44297
  class AddHighlighter extends AddDrawing {
44279
44298
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
44280
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
44299
+ strokeColor = semanticColor("contrastGreen");
44281
44300
  strokeStyle = conf.PEN_STROKE_STYLE;
44282
44301
  constructor(board) {
44283
44302
  super(board);
@@ -44295,6 +44314,10 @@ class AddHighlighter extends AddDrawing {
44295
44314
  isHighlighter() {
44296
44315
  return true;
44297
44316
  }
44317
+ applyDrawingRole(drawing) {
44318
+ drawing.setColorRole("background");
44319
+ drawing.setStrokeOpacity(0.5);
44320
+ }
44298
44321
  updateSettings() {
44299
44322
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
44300
44323
  strokeWidth: this.strokeWidth,
@@ -44714,7 +44737,8 @@ class AddSticker extends BoardTool {
44714
44737
  }
44715
44738
  setCursor(color2) {
44716
44739
  if (conf.STICKER_COLOR_NAMES) {
44717
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
44740
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
44741
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
44718
44742
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
44719
44743
  } else {
44720
44744
  this.board.pointer.setCursor("crosshair");
@@ -44725,7 +44749,7 @@ class AddSticker extends BoardTool {
44725
44749
  class: "Sticker",
44726
44750
  method: "setBackgroundColor",
44727
44751
  item: [this.sticker.getId()],
44728
- backgroundColor: color2
44752
+ backgroundColor: coerceColorValue(color2)
44729
44753
  });
44730
44754
  this.setCursor(color2);
44731
44755
  this.board.tools.publish();
package/dist/cjs/index.js CHANGED
@@ -7211,7 +7211,7 @@ var conf = {
7211
7211
  "rgb(231, 232, 238)",
7212
7212
  "rgb(156, 156, 156)"
7213
7213
  ],
7214
- DEFAULT_STICKER_COLOR: "rgb(233, 208, 255)",
7214
+ DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
7215
7215
  STICKER_COLOR_NAMES: [
7216
7216
  "purple",
7217
7217
  "pink",
@@ -7421,7 +7421,7 @@ var conf = {
7421
7421
  DEFAULT_TEXT_STYLES: {
7422
7422
  fontFamily: "Manrope",
7423
7423
  fontSize: 14,
7424
- fontColor: "rgb(20, 21, 26)",
7424
+ fontColor: semanticColor("contrastNeutral"),
7425
7425
  fontHighlight: "",
7426
7426
  lineHeight: 1.4,
7427
7427
  bold: false,
@@ -9105,7 +9105,7 @@ function getTextStyle(data) {
9105
9105
  const leafStyle = {
9106
9106
  fontStyle: "normal",
9107
9107
  fontWeight: "normal",
9108
- color: data.fontColor ?? "black",
9108
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
9109
9109
  backgroundColor: data.fontHighlight,
9110
9110
  fontSize: data.fontSize ?? 14,
9111
9111
  fontFamily: data.fontFamily ?? "Arial"
@@ -40179,7 +40179,7 @@ class StickerData {
40179
40179
  linkTo;
40180
40180
  text;
40181
40181
  itemType = "Sticker";
40182
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40182
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40183
40183
  this.backgroundColor = backgroundColor;
40184
40184
  this.transformation = transformation;
40185
40185
  this.linkTo = linkTo;
@@ -42811,8 +42811,9 @@ class Drawing extends BaseItem {
42811
42811
  lines = [];
42812
42812
  linkTo;
42813
42813
  strokeWidth = 1;
42814
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
42814
+ borderColor = semanticColor("contrastNeutral");
42815
42815
  borderStyle = "solid";
42816
+ colorRole = "foreground";
42816
42817
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
42817
42818
  borderOpacity = 1;
42818
42819
  transformationRenderBlock = undefined;
@@ -42846,6 +42847,7 @@ class Drawing extends BaseItem {
42846
42847
  transformation: this.transformation.serialize(),
42847
42848
  strokeStyle: this.borderColor,
42848
42849
  strokeWidth: this.strokeWidth,
42850
+ colorRole: this.colorRole,
42849
42851
  linkTo: this.linkTo.serialize()
42850
42852
  };
42851
42853
  }
@@ -42859,6 +42861,9 @@ class Drawing extends BaseItem {
42859
42861
  this.transformation.deserialize(data.transformation);
42860
42862
  this.borderColor = coerceColorValue(data.strokeStyle);
42861
42863
  this.strokeWidth = data.strokeWidth;
42864
+ if (data.colorRole) {
42865
+ this.colorRole = data.colorRole;
42866
+ }
42862
42867
  this.updateGeometry();
42863
42868
  return this;
42864
42869
  }
@@ -42965,7 +42970,8 @@ class Drawing extends BaseItem {
42965
42970
  }
42966
42971
  const ctx = context.ctx;
42967
42972
  ctx.save();
42968
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
42973
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
42974
+ ctx.globalAlpha = this.borderOpacity;
42969
42975
  ctx.lineWidth = this.strokeWidth;
42970
42976
  ctx.lineCap = "round";
42971
42977
  ctx.setLineDash(this.linePattern);
@@ -42992,7 +42998,8 @@ class Drawing extends BaseItem {
42992
42998
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
42993
42999
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
42994
43000
  pathElement.setAttribute("d", this.getPathData());
42995
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
43001
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
43002
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
42996
43003
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
42997
43004
  pathElement.setAttribute("fill", "none");
42998
43005
  svg3.appendChild(pathElement);
@@ -43148,6 +43155,13 @@ class Drawing extends BaseItem {
43148
43155
  getStrokeColor() {
43149
43156
  return this.borderColor;
43150
43157
  }
43158
+ setColorRole(role) {
43159
+ this.colorRole = role;
43160
+ return this;
43161
+ }
43162
+ getColorRole() {
43163
+ return this.colorRole;
43164
+ }
43151
43165
  setStrokeWidth(width2) {
43152
43166
  this.emit({
43153
43167
  class: "Drawing",
@@ -44133,7 +44147,7 @@ class AddDrawing extends BoardTool {
44133
44147
  drawing = null;
44134
44148
  isDown = false;
44135
44149
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
44136
- strokeColor = conf.PEN_DEFAULT_COLOR;
44150
+ strokeColor = semanticColor("contrastNeutral");
44137
44151
  strokeStyle = conf.PEN_STROKE_STYLE;
44138
44152
  constructor(board) {
44139
44153
  super(board);
@@ -44188,6 +44202,9 @@ class AddDrawing extends BoardTool {
44188
44202
  isHighlighter() {
44189
44203
  return false;
44190
44204
  }
44205
+ applyDrawingRole(drawing) {
44206
+ drawing.setColorRole("foreground");
44207
+ }
44191
44208
  leftButtonDown() {
44192
44209
  if (this.strokeColor === "none") {
44193
44210
  return false;
@@ -44227,9 +44244,10 @@ class AddDrawing extends BoardTool {
44227
44244
  }
44228
44245
  const drawing = new Drawing(this.board, points);
44229
44246
  drawing.transformation.translateTo(x, y);
44230
- drawing.setStrokeColor(this.strokeColor);
44247
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44231
44248
  drawing.setStrokeWidth(this.strokeWidth);
44232
44249
  drawing.setBorderStyle(this.strokeStyle);
44250
+ this.applyDrawingRole(drawing);
44233
44251
  this.board.add(drawing).updateMbr();
44234
44252
  this.board.selection.removeAll();
44235
44253
  this.drawing = null;
@@ -44268,16 +44286,17 @@ class AddDrawing extends BoardTool {
44268
44286
  return;
44269
44287
  }
44270
44288
  const drawing = this.drawing;
44271
- drawing.setStrokeColor(this.strokeColor);
44289
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44272
44290
  drawing.setStrokeWidth(this.strokeWidth);
44273
44291
  drawing.setBorderStyle(this.strokeStyle);
44292
+ this.applyDrawingRole(drawing);
44274
44293
  drawing.render(context);
44275
44294
  }
44276
44295
  }
44277
44296
  // src/Tools/AddDrawing/AddHighlighter.ts
44278
44297
  class AddHighlighter extends AddDrawing {
44279
44298
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
44280
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
44299
+ strokeColor = semanticColor("contrastGreen");
44281
44300
  strokeStyle = conf.PEN_STROKE_STYLE;
44282
44301
  constructor(board) {
44283
44302
  super(board);
@@ -44295,6 +44314,10 @@ class AddHighlighter extends AddDrawing {
44295
44314
  isHighlighter() {
44296
44315
  return true;
44297
44316
  }
44317
+ applyDrawingRole(drawing) {
44318
+ drawing.setColorRole("background");
44319
+ drawing.setStrokeOpacity(0.5);
44320
+ }
44298
44321
  updateSettings() {
44299
44322
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
44300
44323
  strokeWidth: this.strokeWidth,
@@ -44714,7 +44737,8 @@ class AddSticker extends BoardTool {
44714
44737
  }
44715
44738
  setCursor(color2) {
44716
44739
  if (conf.STICKER_COLOR_NAMES) {
44717
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
44740
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
44741
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
44718
44742
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
44719
44743
  } else {
44720
44744
  this.board.pointer.setCursor("crosshair");
@@ -44725,7 +44749,7 @@ class AddSticker extends BoardTool {
44725
44749
  class: "Sticker",
44726
44750
  method: "setBackgroundColor",
44727
44751
  item: [this.sticker.getId()],
44728
- backgroundColor: color2
44752
+ backgroundColor: coerceColorValue(color2)
44729
44753
  });
44730
44754
  this.setCursor(color2);
44731
44755
  this.board.tools.publish();
package/dist/cjs/node.js CHANGED
@@ -8248,7 +8248,7 @@ var conf = {
8248
8248
  "rgb(231, 232, 238)",
8249
8249
  "rgb(156, 156, 156)"
8250
8250
  ],
8251
- DEFAULT_STICKER_COLOR: "rgb(233, 208, 255)",
8251
+ DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
8252
8252
  STICKER_COLOR_NAMES: [
8253
8253
  "purple",
8254
8254
  "pink",
@@ -8458,7 +8458,7 @@ var conf = {
8458
8458
  DEFAULT_TEXT_STYLES: {
8459
8459
  fontFamily: "Manrope",
8460
8460
  fontSize: 14,
8461
- fontColor: "rgb(20, 21, 26)",
8461
+ fontColor: semanticColor("contrastNeutral"),
8462
8462
  fontHighlight: "",
8463
8463
  lineHeight: 1.4,
8464
8464
  bold: false,
@@ -10142,7 +10142,7 @@ function getTextStyle(data) {
10142
10142
  const leafStyle = {
10143
10143
  fontStyle: "normal",
10144
10144
  fontWeight: "normal",
10145
- color: data.fontColor ?? "black",
10145
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
10146
10146
  backgroundColor: data.fontHighlight,
10147
10147
  fontSize: data.fontSize ?? 14,
10148
10148
  fontFamily: data.fontFamily ?? "Arial"
@@ -42652,7 +42652,7 @@ class StickerData {
42652
42652
  linkTo;
42653
42653
  text;
42654
42654
  itemType = "Sticker";
42655
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
42655
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
42656
42656
  this.backgroundColor = backgroundColor;
42657
42657
  this.transformation = transformation;
42658
42658
  this.linkTo = linkTo;
@@ -45284,8 +45284,9 @@ class Drawing extends BaseItem {
45284
45284
  lines = [];
45285
45285
  linkTo;
45286
45286
  strokeWidth = 1;
45287
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
45287
+ borderColor = semanticColor("contrastNeutral");
45288
45288
  borderStyle = "solid";
45289
+ colorRole = "foreground";
45289
45290
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
45290
45291
  borderOpacity = 1;
45291
45292
  transformationRenderBlock = undefined;
@@ -45319,6 +45320,7 @@ class Drawing extends BaseItem {
45319
45320
  transformation: this.transformation.serialize(),
45320
45321
  strokeStyle: this.borderColor,
45321
45322
  strokeWidth: this.strokeWidth,
45323
+ colorRole: this.colorRole,
45322
45324
  linkTo: this.linkTo.serialize()
45323
45325
  };
45324
45326
  }
@@ -45332,6 +45334,9 @@ class Drawing extends BaseItem {
45332
45334
  this.transformation.deserialize(data.transformation);
45333
45335
  this.borderColor = coerceColorValue(data.strokeStyle);
45334
45336
  this.strokeWidth = data.strokeWidth;
45337
+ if (data.colorRole) {
45338
+ this.colorRole = data.colorRole;
45339
+ }
45335
45340
  this.updateGeometry();
45336
45341
  return this;
45337
45342
  }
@@ -45438,7 +45443,8 @@ class Drawing extends BaseItem {
45438
45443
  }
45439
45444
  const ctx = context.ctx;
45440
45445
  ctx.save();
45441
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
45446
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
45447
+ ctx.globalAlpha = this.borderOpacity;
45442
45448
  ctx.lineWidth = this.strokeWidth;
45443
45449
  ctx.lineCap = "round";
45444
45450
  ctx.setLineDash(this.linePattern);
@@ -45465,7 +45471,8 @@ class Drawing extends BaseItem {
45465
45471
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
45466
45472
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
45467
45473
  pathElement.setAttribute("d", this.getPathData());
45468
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
45474
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
45475
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
45469
45476
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
45470
45477
  pathElement.setAttribute("fill", "none");
45471
45478
  svg3.appendChild(pathElement);
@@ -45621,6 +45628,13 @@ class Drawing extends BaseItem {
45621
45628
  getStrokeColor() {
45622
45629
  return this.borderColor;
45623
45630
  }
45631
+ setColorRole(role) {
45632
+ this.colorRole = role;
45633
+ return this;
45634
+ }
45635
+ getColorRole() {
45636
+ return this.colorRole;
45637
+ }
45624
45638
  setStrokeWidth(width2) {
45625
45639
  this.emit({
45626
45640
  class: "Drawing",
@@ -46606,7 +46620,7 @@ class AddDrawing extends BoardTool {
46606
46620
  drawing = null;
46607
46621
  isDown = false;
46608
46622
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
46609
- strokeColor = conf.PEN_DEFAULT_COLOR;
46623
+ strokeColor = semanticColor("contrastNeutral");
46610
46624
  strokeStyle = conf.PEN_STROKE_STYLE;
46611
46625
  constructor(board) {
46612
46626
  super(board);
@@ -46661,6 +46675,9 @@ class AddDrawing extends BoardTool {
46661
46675
  isHighlighter() {
46662
46676
  return false;
46663
46677
  }
46678
+ applyDrawingRole(drawing) {
46679
+ drawing.setColorRole("foreground");
46680
+ }
46664
46681
  leftButtonDown() {
46665
46682
  if (this.strokeColor === "none") {
46666
46683
  return false;
@@ -46700,9 +46717,10 @@ class AddDrawing extends BoardTool {
46700
46717
  }
46701
46718
  const drawing = new Drawing(this.board, points);
46702
46719
  drawing.transformation.translateTo(x, y);
46703
- drawing.setStrokeColor(this.strokeColor);
46720
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
46704
46721
  drawing.setStrokeWidth(this.strokeWidth);
46705
46722
  drawing.setBorderStyle(this.strokeStyle);
46723
+ this.applyDrawingRole(drawing);
46706
46724
  this.board.add(drawing).updateMbr();
46707
46725
  this.board.selection.removeAll();
46708
46726
  this.drawing = null;
@@ -46741,16 +46759,17 @@ class AddDrawing extends BoardTool {
46741
46759
  return;
46742
46760
  }
46743
46761
  const drawing = this.drawing;
46744
- drawing.setStrokeColor(this.strokeColor);
46762
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
46745
46763
  drawing.setStrokeWidth(this.strokeWidth);
46746
46764
  drawing.setBorderStyle(this.strokeStyle);
46765
+ this.applyDrawingRole(drawing);
46747
46766
  drawing.render(context);
46748
46767
  }
46749
46768
  }
46750
46769
  // src/Tools/AddDrawing/AddHighlighter.ts
46751
46770
  class AddHighlighter extends AddDrawing {
46752
46771
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
46753
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
46772
+ strokeColor = semanticColor("contrastGreen");
46754
46773
  strokeStyle = conf.PEN_STROKE_STYLE;
46755
46774
  constructor(board) {
46756
46775
  super(board);
@@ -46768,6 +46787,10 @@ class AddHighlighter extends AddDrawing {
46768
46787
  isHighlighter() {
46769
46788
  return true;
46770
46789
  }
46790
+ applyDrawingRole(drawing) {
46791
+ drawing.setColorRole("background");
46792
+ drawing.setStrokeOpacity(0.5);
46793
+ }
46771
46794
  updateSettings() {
46772
46795
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
46773
46796
  strokeWidth: this.strokeWidth,
@@ -47187,7 +47210,8 @@ class AddSticker extends BoardTool {
47187
47210
  }
47188
47211
  setCursor(color2) {
47189
47212
  if (conf.STICKER_COLOR_NAMES) {
47190
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
47213
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
47214
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
47191
47215
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
47192
47216
  } else {
47193
47217
  this.board.pointer.setCursor("crosshair");
@@ -47198,7 +47222,7 @@ class AddSticker extends BoardTool {
47198
47222
  class: "Sticker",
47199
47223
  method: "setBackgroundColor",
47200
47224
  item: [this.sticker.getId()],
47201
- backgroundColor: color2
47225
+ backgroundColor: coerceColorValue(color2)
47202
47226
  });
47203
47227
  this.setCursor(color2);
47204
47228
  this.board.tools.publish();
@@ -7032,7 +7032,7 @@ var conf = {
7032
7032
  "rgb(231, 232, 238)",
7033
7033
  "rgb(156, 156, 156)"
7034
7034
  ],
7035
- DEFAULT_STICKER_COLOR: "rgb(233, 208, 255)",
7035
+ DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
7036
7036
  STICKER_COLOR_NAMES: [
7037
7037
  "purple",
7038
7038
  "pink",
@@ -7242,7 +7242,7 @@ var conf = {
7242
7242
  DEFAULT_TEXT_STYLES: {
7243
7243
  fontFamily: "Manrope",
7244
7244
  fontSize: 14,
7245
- fontColor: "rgb(20, 21, 26)",
7245
+ fontColor: semanticColor("contrastNeutral"),
7246
7246
  fontHighlight: "",
7247
7247
  lineHeight: 1.4,
7248
7248
  bold: false,
@@ -8931,7 +8931,7 @@ function getTextStyle(data) {
8931
8931
  const leafStyle = {
8932
8932
  fontStyle: "normal",
8933
8933
  fontWeight: "normal",
8934
- color: data.fontColor ?? "black",
8934
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
8935
8935
  backgroundColor: data.fontHighlight,
8936
8936
  fontSize: data.fontSize ?? 14,
8937
8937
  fontFamily: data.fontFamily ?? "Arial"
@@ -40009,7 +40009,7 @@ class StickerData {
40009
40009
  linkTo;
40010
40010
  text;
40011
40011
  itemType = "Sticker";
40012
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40012
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40013
40013
  this.backgroundColor = backgroundColor;
40014
40014
  this.transformation = transformation;
40015
40015
  this.linkTo = linkTo;
@@ -42641,8 +42641,9 @@ class Drawing extends BaseItem {
42641
42641
  lines = [];
42642
42642
  linkTo;
42643
42643
  strokeWidth = 1;
42644
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
42644
+ borderColor = semanticColor("contrastNeutral");
42645
42645
  borderStyle = "solid";
42646
+ colorRole = "foreground";
42646
42647
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
42647
42648
  borderOpacity = 1;
42648
42649
  transformationRenderBlock = undefined;
@@ -42676,6 +42677,7 @@ class Drawing extends BaseItem {
42676
42677
  transformation: this.transformation.serialize(),
42677
42678
  strokeStyle: this.borderColor,
42678
42679
  strokeWidth: this.strokeWidth,
42680
+ colorRole: this.colorRole,
42679
42681
  linkTo: this.linkTo.serialize()
42680
42682
  };
42681
42683
  }
@@ -42689,6 +42691,9 @@ class Drawing extends BaseItem {
42689
42691
  this.transformation.deserialize(data.transformation);
42690
42692
  this.borderColor = coerceColorValue(data.strokeStyle);
42691
42693
  this.strokeWidth = data.strokeWidth;
42694
+ if (data.colorRole) {
42695
+ this.colorRole = data.colorRole;
42696
+ }
42692
42697
  this.updateGeometry();
42693
42698
  return this;
42694
42699
  }
@@ -42795,7 +42800,8 @@ class Drawing extends BaseItem {
42795
42800
  }
42796
42801
  const ctx = context.ctx;
42797
42802
  ctx.save();
42798
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
42803
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
42804
+ ctx.globalAlpha = this.borderOpacity;
42799
42805
  ctx.lineWidth = this.strokeWidth;
42800
42806
  ctx.lineCap = "round";
42801
42807
  ctx.setLineDash(this.linePattern);
@@ -42822,7 +42828,8 @@ class Drawing extends BaseItem {
42822
42828
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
42823
42829
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
42824
42830
  pathElement.setAttribute("d", this.getPathData());
42825
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
42831
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
42832
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
42826
42833
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
42827
42834
  pathElement.setAttribute("fill", "none");
42828
42835
  svg3.appendChild(pathElement);
@@ -42978,6 +42985,13 @@ class Drawing extends BaseItem {
42978
42985
  getStrokeColor() {
42979
42986
  return this.borderColor;
42980
42987
  }
42988
+ setColorRole(role) {
42989
+ this.colorRole = role;
42990
+ return this;
42991
+ }
42992
+ getColorRole() {
42993
+ return this.colorRole;
42994
+ }
42981
42995
  setStrokeWidth(width2) {
42982
42996
  this.emit({
42983
42997
  class: "Drawing",
@@ -43963,7 +43977,7 @@ class AddDrawing extends BoardTool {
43963
43977
  drawing = null;
43964
43978
  isDown = false;
43965
43979
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
43966
- strokeColor = conf.PEN_DEFAULT_COLOR;
43980
+ strokeColor = semanticColor("contrastNeutral");
43967
43981
  strokeStyle = conf.PEN_STROKE_STYLE;
43968
43982
  constructor(board) {
43969
43983
  super(board);
@@ -44018,6 +44032,9 @@ class AddDrawing extends BoardTool {
44018
44032
  isHighlighter() {
44019
44033
  return false;
44020
44034
  }
44035
+ applyDrawingRole(drawing) {
44036
+ drawing.setColorRole("foreground");
44037
+ }
44021
44038
  leftButtonDown() {
44022
44039
  if (this.strokeColor === "none") {
44023
44040
  return false;
@@ -44057,9 +44074,10 @@ class AddDrawing extends BoardTool {
44057
44074
  }
44058
44075
  const drawing = new Drawing(this.board, points);
44059
44076
  drawing.transformation.translateTo(x, y);
44060
- drawing.setStrokeColor(this.strokeColor);
44077
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44061
44078
  drawing.setStrokeWidth(this.strokeWidth);
44062
44079
  drawing.setBorderStyle(this.strokeStyle);
44080
+ this.applyDrawingRole(drawing);
44063
44081
  this.board.add(drawing).updateMbr();
44064
44082
  this.board.selection.removeAll();
44065
44083
  this.drawing = null;
@@ -44098,16 +44116,17 @@ class AddDrawing extends BoardTool {
44098
44116
  return;
44099
44117
  }
44100
44118
  const drawing = this.drawing;
44101
- drawing.setStrokeColor(this.strokeColor);
44119
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44102
44120
  drawing.setStrokeWidth(this.strokeWidth);
44103
44121
  drawing.setBorderStyle(this.strokeStyle);
44122
+ this.applyDrawingRole(drawing);
44104
44123
  drawing.render(context);
44105
44124
  }
44106
44125
  }
44107
44126
  // src/Tools/AddDrawing/AddHighlighter.ts
44108
44127
  class AddHighlighter extends AddDrawing {
44109
44128
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
44110
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
44129
+ strokeColor = semanticColor("contrastGreen");
44111
44130
  strokeStyle = conf.PEN_STROKE_STYLE;
44112
44131
  constructor(board) {
44113
44132
  super(board);
@@ -44125,6 +44144,10 @@ class AddHighlighter extends AddDrawing {
44125
44144
  isHighlighter() {
44126
44145
  return true;
44127
44146
  }
44147
+ applyDrawingRole(drawing) {
44148
+ drawing.setColorRole("background");
44149
+ drawing.setStrokeOpacity(0.5);
44150
+ }
44128
44151
  updateSettings() {
44129
44152
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
44130
44153
  strokeWidth: this.strokeWidth,
@@ -44544,7 +44567,8 @@ class AddSticker extends BoardTool {
44544
44567
  }
44545
44568
  setCursor(color2) {
44546
44569
  if (conf.STICKER_COLOR_NAMES) {
44547
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
44570
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
44571
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
44548
44572
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
44549
44573
  } else {
44550
44574
  this.board.pointer.setCursor("crosshair");
@@ -44555,7 +44579,7 @@ class AddSticker extends BoardTool {
44555
44579
  class: "Sticker",
44556
44580
  method: "setBackgroundColor",
44557
44581
  item: [this.sticker.getId()],
44558
- backgroundColor: color2
44582
+ backgroundColor: coerceColorValue(color2)
44559
44583
  });
44560
44584
  this.setCursor(color2);
44561
44585
  this.board.tools.publish();
package/dist/esm/index.js CHANGED
@@ -7025,7 +7025,7 @@ var conf = {
7025
7025
  "rgb(231, 232, 238)",
7026
7026
  "rgb(156, 156, 156)"
7027
7027
  ],
7028
- DEFAULT_STICKER_COLOR: "rgb(233, 208, 255)",
7028
+ DEFAULT_STICKER_COLOR: semanticColor("contrastBlue"),
7029
7029
  STICKER_COLOR_NAMES: [
7030
7030
  "purple",
7031
7031
  "pink",
@@ -7235,7 +7235,7 @@ var conf = {
7235
7235
  DEFAULT_TEXT_STYLES: {
7236
7236
  fontFamily: "Manrope",
7237
7237
  fontSize: 14,
7238
- fontColor: "rgb(20, 21, 26)",
7238
+ fontColor: semanticColor("contrastNeutral"),
7239
7239
  fontHighlight: "",
7240
7240
  lineHeight: 1.4,
7241
7241
  bold: false,
@@ -8924,7 +8924,7 @@ function getTextStyle(data) {
8924
8924
  const leafStyle = {
8925
8925
  fontStyle: "normal",
8926
8926
  fontWeight: "normal",
8927
- color: data.fontColor ?? "black",
8927
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
8928
8928
  backgroundColor: data.fontHighlight,
8929
8929
  fontSize: data.fontSize ?? 14,
8930
8930
  fontFamily: data.fontFamily ?? "Arial"
@@ -40002,7 +40002,7 @@ class StickerData {
40002
40002
  linkTo;
40003
40003
  text;
40004
40004
  itemType = "Sticker";
40005
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40005
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
40006
40006
  this.backgroundColor = backgroundColor;
40007
40007
  this.transformation = transformation;
40008
40008
  this.linkTo = linkTo;
@@ -42634,8 +42634,9 @@ class Drawing extends BaseItem {
42634
42634
  lines = [];
42635
42635
  linkTo;
42636
42636
  strokeWidth = 1;
42637
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
42637
+ borderColor = semanticColor("contrastNeutral");
42638
42638
  borderStyle = "solid";
42639
+ colorRole = "foreground";
42639
42640
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
42640
42641
  borderOpacity = 1;
42641
42642
  transformationRenderBlock = undefined;
@@ -42669,6 +42670,7 @@ class Drawing extends BaseItem {
42669
42670
  transformation: this.transformation.serialize(),
42670
42671
  strokeStyle: this.borderColor,
42671
42672
  strokeWidth: this.strokeWidth,
42673
+ colorRole: this.colorRole,
42672
42674
  linkTo: this.linkTo.serialize()
42673
42675
  };
42674
42676
  }
@@ -42682,6 +42684,9 @@ class Drawing extends BaseItem {
42682
42684
  this.transformation.deserialize(data.transformation);
42683
42685
  this.borderColor = coerceColorValue(data.strokeStyle);
42684
42686
  this.strokeWidth = data.strokeWidth;
42687
+ if (data.colorRole) {
42688
+ this.colorRole = data.colorRole;
42689
+ }
42685
42690
  this.updateGeometry();
42686
42691
  return this;
42687
42692
  }
@@ -42788,7 +42793,8 @@ class Drawing extends BaseItem {
42788
42793
  }
42789
42794
  const ctx = context.ctx;
42790
42795
  ctx.save();
42791
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
42796
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
42797
+ ctx.globalAlpha = this.borderOpacity;
42792
42798
  ctx.lineWidth = this.strokeWidth;
42793
42799
  ctx.lineCap = "round";
42794
42800
  ctx.setLineDash(this.linePattern);
@@ -42815,7 +42821,8 @@ class Drawing extends BaseItem {
42815
42821
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
42816
42822
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
42817
42823
  pathElement.setAttribute("d", this.getPathData());
42818
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
42824
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
42825
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
42819
42826
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
42820
42827
  pathElement.setAttribute("fill", "none");
42821
42828
  svg3.appendChild(pathElement);
@@ -42971,6 +42978,13 @@ class Drawing extends BaseItem {
42971
42978
  getStrokeColor() {
42972
42979
  return this.borderColor;
42973
42980
  }
42981
+ setColorRole(role) {
42982
+ this.colorRole = role;
42983
+ return this;
42984
+ }
42985
+ getColorRole() {
42986
+ return this.colorRole;
42987
+ }
42974
42988
  setStrokeWidth(width2) {
42975
42989
  this.emit({
42976
42990
  class: "Drawing",
@@ -43956,7 +43970,7 @@ class AddDrawing extends BoardTool {
43956
43970
  drawing = null;
43957
43971
  isDown = false;
43958
43972
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
43959
- strokeColor = conf.PEN_DEFAULT_COLOR;
43973
+ strokeColor = semanticColor("contrastNeutral");
43960
43974
  strokeStyle = conf.PEN_STROKE_STYLE;
43961
43975
  constructor(board) {
43962
43976
  super(board);
@@ -44011,6 +44025,9 @@ class AddDrawing extends BoardTool {
44011
44025
  isHighlighter() {
44012
44026
  return false;
44013
44027
  }
44028
+ applyDrawingRole(drawing) {
44029
+ drawing.setColorRole("foreground");
44030
+ }
44014
44031
  leftButtonDown() {
44015
44032
  if (this.strokeColor === "none") {
44016
44033
  return false;
@@ -44050,9 +44067,10 @@ class AddDrawing extends BoardTool {
44050
44067
  }
44051
44068
  const drawing = new Drawing(this.board, points);
44052
44069
  drawing.transformation.translateTo(x, y);
44053
- drawing.setStrokeColor(this.strokeColor);
44070
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44054
44071
  drawing.setStrokeWidth(this.strokeWidth);
44055
44072
  drawing.setBorderStyle(this.strokeStyle);
44073
+ this.applyDrawingRole(drawing);
44056
44074
  this.board.add(drawing).updateMbr();
44057
44075
  this.board.selection.removeAll();
44058
44076
  this.drawing = null;
@@ -44091,16 +44109,17 @@ class AddDrawing extends BoardTool {
44091
44109
  return;
44092
44110
  }
44093
44111
  const drawing = this.drawing;
44094
- drawing.setStrokeColor(this.strokeColor);
44112
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
44095
44113
  drawing.setStrokeWidth(this.strokeWidth);
44096
44114
  drawing.setBorderStyle(this.strokeStyle);
44115
+ this.applyDrawingRole(drawing);
44097
44116
  drawing.render(context);
44098
44117
  }
44099
44118
  }
44100
44119
  // src/Tools/AddDrawing/AddHighlighter.ts
44101
44120
  class AddHighlighter extends AddDrawing {
44102
44121
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
44103
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
44122
+ strokeColor = semanticColor("contrastGreen");
44104
44123
  strokeStyle = conf.PEN_STROKE_STYLE;
44105
44124
  constructor(board) {
44106
44125
  super(board);
@@ -44118,6 +44137,10 @@ class AddHighlighter extends AddDrawing {
44118
44137
  isHighlighter() {
44119
44138
  return true;
44120
44139
  }
44140
+ applyDrawingRole(drawing) {
44141
+ drawing.setColorRole("background");
44142
+ drawing.setStrokeOpacity(0.5);
44143
+ }
44121
44144
  updateSettings() {
44122
44145
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
44123
44146
  strokeWidth: this.strokeWidth,
@@ -44537,7 +44560,8 @@ class AddSticker extends BoardTool {
44537
44560
  }
44538
44561
  setCursor(color2) {
44539
44562
  if (conf.STICKER_COLOR_NAMES) {
44540
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
44563
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
44564
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
44541
44565
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
44542
44566
  } else {
44543
44567
  this.board.pointer.setCursor("crosshair");
@@ -44548,7 +44572,7 @@ class AddSticker extends BoardTool {
44548
44572
  class: "Sticker",
44549
44573
  method: "setBackgroundColor",
44550
44574
  item: [this.sticker.getId()],
44551
- backgroundColor: color2
44575
+ backgroundColor: coerceColorValue(color2)
44552
44576
  });
44553
44577
  this.setCursor(color2);
44554
44578
  this.board.tools.publish();
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: "rgb(233, 208, 255)",
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: "rgb(20, 21, 26)",
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 ?? "black",
9711
+ color: data.fontColor ?? semanticColor("contrastNeutral"),
9712
9712
  backgroundColor: data.fontHighlight,
9713
9713
  fontSize: data.fontSize ?? 14,
9714
9714
  fontFamily: data.fontFamily ?? "Arial"
@@ -42470,7 +42470,7 @@ class StickerData {
42470
42470
  linkTo;
42471
42471
  text;
42472
42472
  itemType = "Sticker";
42473
- constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
42473
+ constructor(backgroundColor = semanticColor("contrastBlue"), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
42474
42474
  this.backgroundColor = backgroundColor;
42475
42475
  this.transformation = transformation;
42476
42476
  this.linkTo = linkTo;
@@ -45102,8 +45102,9 @@ class Drawing extends BaseItem {
45102
45102
  lines = [];
45103
45103
  linkTo;
45104
45104
  strokeWidth = 1;
45105
- borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
45105
+ borderColor = semanticColor("contrastNeutral");
45106
45106
  borderStyle = "solid";
45107
+ colorRole = "foreground";
45107
45108
  linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
45108
45109
  borderOpacity = 1;
45109
45110
  transformationRenderBlock = undefined;
@@ -45137,6 +45138,7 @@ class Drawing extends BaseItem {
45137
45138
  transformation: this.transformation.serialize(),
45138
45139
  strokeStyle: this.borderColor,
45139
45140
  strokeWidth: this.strokeWidth,
45141
+ colorRole: this.colorRole,
45140
45142
  linkTo: this.linkTo.serialize()
45141
45143
  };
45142
45144
  }
@@ -45150,6 +45152,9 @@ class Drawing extends BaseItem {
45150
45152
  this.transformation.deserialize(data.transformation);
45151
45153
  this.borderColor = coerceColorValue(data.strokeStyle);
45152
45154
  this.strokeWidth = data.strokeWidth;
45155
+ if (data.colorRole) {
45156
+ this.colorRole = data.colorRole;
45157
+ }
45153
45158
  this.updateGeometry();
45154
45159
  return this;
45155
45160
  }
@@ -45256,7 +45261,8 @@ class Drawing extends BaseItem {
45256
45261
  }
45257
45262
  const ctx = context.ctx;
45258
45263
  ctx.save();
45259
- ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
45264
+ ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
45265
+ ctx.globalAlpha = this.borderOpacity;
45260
45266
  ctx.lineWidth = this.strokeWidth;
45261
45267
  ctx.lineCap = "round";
45262
45268
  ctx.setLineDash(this.linePattern);
@@ -45283,7 +45289,8 @@ class Drawing extends BaseItem {
45283
45289
  svg3.setAttribute("style", "position: absolute; overflow: visible;");
45284
45290
  const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
45285
45291
  pathElement.setAttribute("d", this.getPathData());
45286
- pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
45292
+ pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, this.colorRole));
45293
+ pathElement.setAttribute("stroke-opacity", `${this.borderOpacity}`);
45287
45294
  pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
45288
45295
  pathElement.setAttribute("fill", "none");
45289
45296
  svg3.appendChild(pathElement);
@@ -45439,6 +45446,13 @@ class Drawing extends BaseItem {
45439
45446
  getStrokeColor() {
45440
45447
  return this.borderColor;
45441
45448
  }
45449
+ setColorRole(role) {
45450
+ this.colorRole = role;
45451
+ return this;
45452
+ }
45453
+ getColorRole() {
45454
+ return this.colorRole;
45455
+ }
45442
45456
  setStrokeWidth(width2) {
45443
45457
  this.emit({
45444
45458
  class: "Drawing",
@@ -46424,7 +46438,7 @@ class AddDrawing extends BoardTool {
46424
46438
  drawing = null;
46425
46439
  isDown = false;
46426
46440
  strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
46427
- strokeColor = conf.PEN_DEFAULT_COLOR;
46441
+ strokeColor = semanticColor("contrastNeutral");
46428
46442
  strokeStyle = conf.PEN_STROKE_STYLE;
46429
46443
  constructor(board) {
46430
46444
  super(board);
@@ -46479,6 +46493,9 @@ class AddDrawing extends BoardTool {
46479
46493
  isHighlighter() {
46480
46494
  return false;
46481
46495
  }
46496
+ applyDrawingRole(drawing) {
46497
+ drawing.setColorRole("foreground");
46498
+ }
46482
46499
  leftButtonDown() {
46483
46500
  if (this.strokeColor === "none") {
46484
46501
  return false;
@@ -46518,9 +46535,10 @@ class AddDrawing extends BoardTool {
46518
46535
  }
46519
46536
  const drawing = new Drawing(this.board, points);
46520
46537
  drawing.transformation.translateTo(x, y);
46521
- drawing.setStrokeColor(this.strokeColor);
46538
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
46522
46539
  drawing.setStrokeWidth(this.strokeWidth);
46523
46540
  drawing.setBorderStyle(this.strokeStyle);
46541
+ this.applyDrawingRole(drawing);
46524
46542
  this.board.add(drawing).updateMbr();
46525
46543
  this.board.selection.removeAll();
46526
46544
  this.drawing = null;
@@ -46559,16 +46577,17 @@ class AddDrawing extends BoardTool {
46559
46577
  return;
46560
46578
  }
46561
46579
  const drawing = this.drawing;
46562
- drawing.setStrokeColor(this.strokeColor);
46580
+ drawing.setStrokeColor(coerceColorValue(this.strokeColor));
46563
46581
  drawing.setStrokeWidth(this.strokeWidth);
46564
46582
  drawing.setBorderStyle(this.strokeStyle);
46583
+ this.applyDrawingRole(drawing);
46565
46584
  drawing.render(context);
46566
46585
  }
46567
46586
  }
46568
46587
  // src/Tools/AddDrawing/AddHighlighter.ts
46569
46588
  class AddHighlighter extends AddDrawing {
46570
46589
  strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
46571
- strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
46590
+ strokeColor = semanticColor("contrastGreen");
46572
46591
  strokeStyle = conf.PEN_STROKE_STYLE;
46573
46592
  constructor(board) {
46574
46593
  super(board);
@@ -46586,6 +46605,10 @@ class AddHighlighter extends AddDrawing {
46586
46605
  isHighlighter() {
46587
46606
  return true;
46588
46607
  }
46608
+ applyDrawingRole(drawing) {
46609
+ drawing.setColorRole("background");
46610
+ drawing.setStrokeOpacity(0.5);
46611
+ }
46589
46612
  updateSettings() {
46590
46613
  localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
46591
46614
  strokeWidth: this.strokeWidth,
@@ -47005,7 +47028,8 @@ class AddSticker extends BoardTool {
47005
47028
  }
47006
47029
  setCursor(color2) {
47007
47030
  if (conf.STICKER_COLOR_NAMES) {
47008
- const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
47031
+ const cssColor = color2 ? resolveColor(color2, conf.theme, "background") : undefined;
47032
+ const colorName = cssColor ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(cssColor)] : undefined;
47009
47033
  this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
47010
47034
  } else {
47011
47035
  this.board.pointer.setCursor("crosshair");
@@ -47016,7 +47040,7 @@ class AddSticker extends BoardTool {
47016
47040
  class: "Sticker",
47017
47041
  method: "setBackgroundColor",
47018
47042
  item: [this.sticker.getId()],
47019
- backgroundColor: color2
47043
+ backgroundColor: coerceColorValue(color2)
47020
47044
  });
47021
47045
  this.setCursor(color2);
47022
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;
@@ -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: string;
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(): string;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",