microboard-temp 0.12.9 → 0.13.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.
@@ -22211,6 +22211,8 @@ class RichText extends BaseItem {
22211
22211
  _onLimitReached = () => {};
22212
22212
  shrinkWidth = false;
22213
22213
  prevMbr = null;
22214
+ customTransformationMatrix;
22215
+ renderingScale;
22214
22216
  rtCounter = 0;
22215
22217
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22216
22218
  super(board, id);
@@ -22504,11 +22506,8 @@ class RichText extends BaseItem {
22504
22506
  return this.shrinkWidth;
22505
22507
  }
22506
22508
  getTransformedContainer() {
22507
- if (this.insideOf === "Frame") {
22508
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22509
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22510
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22511
- return this.container.getTransformed(matrix);
22509
+ if (this.customTransformationMatrix) {
22510
+ return this.container.getTransformed(this.customTransformationMatrix());
22512
22511
  }
22513
22512
  return this.container.getTransformed(this.transformation.toMatrix());
22514
22513
  }
@@ -22879,7 +22878,9 @@ class RichText extends BaseItem {
22879
22878
  ctx.clip(this.clipPath.nativePath);
22880
22879
  }
22881
22880
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22882
- this.layoutNodes.render(ctx, autoSizeScale);
22881
+ const cameraScale = context.getCameraScale();
22882
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22883
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22883
22884
  ctx.restore();
22884
22885
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22885
22886
  const { top, right } = this.getMbr();
@@ -23005,7 +23006,9 @@ class RichText extends BaseItem {
23005
23006
  };
23006
23007
  const elements = this.editor.editor.children.map(renderNode);
23007
23008
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
23008
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
23009
+ const cameraScale = this.board.camera.getScale();
23010
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23011
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
23009
23012
  const transformedWidth = this.getTransformedContainer().getWidth();
23010
23013
  const transformedHeight = this.getTransformedContainer().getHeight();
23011
23014
  const div = documentFactory.createElement("rich-text");
@@ -40933,11 +40936,11 @@ function convertBlobToDataUrl(blob) {
40933
40936
  }
40934
40937
 
40935
40938
  // src/Items/Frame/FrameData.ts
40936
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40939
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40937
40940
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40938
40941
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40939
40942
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40940
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40943
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40941
40944
  var FRAME_TYPES = [
40942
40945
  { id: "Custom", label: "Custom" },
40943
40946
  { id: "Frame16x9", label: "16:9" },
@@ -40982,7 +40985,7 @@ class DefaultFrameData {
40982
40985
  canChangeRatio;
40983
40986
  linkTo;
40984
40987
  itemType = "Frame";
40985
- 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) {
40988
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40986
40989
  this.shapeType = shapeType;
40987
40990
  this.backgroundColor = backgroundColor;
40988
40991
  this.backgroundOpacity = backgroundOpacity;
@@ -41042,6 +41045,14 @@ class Frame2 extends BaseItem {
41042
41045
  this.linkTo = new LinkTo(this.id, board.events);
41043
41046
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
41044
41047
  this.text.setSelectionHorisontalAlignment("left");
41048
+ this.text.customTransformationMatrix = () => {
41049
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
41050
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
41051
+ return new Matrix(translateX, translateY, scaleX, scaleY);
41052
+ };
41053
+ this.text.renderingScale = (cameraScale) => {
41054
+ return Math.max(1, Math.min(5, 1 / cameraScale));
41055
+ };
41045
41056
  this.transformation.subject.subscribe(() => {
41046
41057
  this.transformPath();
41047
41058
  this.updateMbr();
package/dist/cjs/index.js CHANGED
@@ -22211,6 +22211,8 @@ class RichText extends BaseItem {
22211
22211
  _onLimitReached = () => {};
22212
22212
  shrinkWidth = false;
22213
22213
  prevMbr = null;
22214
+ customTransformationMatrix;
22215
+ renderingScale;
22214
22216
  rtCounter = 0;
22215
22217
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22216
22218
  super(board, id);
@@ -22504,11 +22506,8 @@ class RichText extends BaseItem {
22504
22506
  return this.shrinkWidth;
22505
22507
  }
22506
22508
  getTransformedContainer() {
22507
- if (this.insideOf === "Frame") {
22508
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22509
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22510
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22511
- return this.container.getTransformed(matrix);
22509
+ if (this.customTransformationMatrix) {
22510
+ return this.container.getTransformed(this.customTransformationMatrix());
22512
22511
  }
22513
22512
  return this.container.getTransformed(this.transformation.toMatrix());
22514
22513
  }
@@ -22879,7 +22878,9 @@ class RichText extends BaseItem {
22879
22878
  ctx.clip(this.clipPath.nativePath);
22880
22879
  }
22881
22880
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22882
- this.layoutNodes.render(ctx, autoSizeScale);
22881
+ const cameraScale = context.getCameraScale();
22882
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22883
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22883
22884
  ctx.restore();
22884
22885
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22885
22886
  const { top, right } = this.getMbr();
@@ -23005,7 +23006,9 @@ class RichText extends BaseItem {
23005
23006
  };
23006
23007
  const elements = this.editor.editor.children.map(renderNode);
23007
23008
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
23008
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
23009
+ const cameraScale = this.board.camera.getScale();
23010
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
23011
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
23009
23012
  const transformedWidth = this.getTransformedContainer().getWidth();
23010
23013
  const transformedHeight = this.getTransformedContainer().getHeight();
23011
23014
  const div = documentFactory.createElement("rich-text");
@@ -40933,11 +40936,11 @@ function convertBlobToDataUrl(blob) {
40933
40936
  }
40934
40937
 
40935
40938
  // src/Items/Frame/FrameData.ts
40936
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40939
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40937
40940
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40938
40941
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40939
40942
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40940
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40943
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40941
40944
  var FRAME_TYPES = [
40942
40945
  { id: "Custom", label: "Custom" },
40943
40946
  { id: "Frame16x9", label: "16:9" },
@@ -40982,7 +40985,7 @@ class DefaultFrameData {
40982
40985
  canChangeRatio;
40983
40986
  linkTo;
40984
40987
  itemType = "Frame";
40985
- 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) {
40988
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40986
40989
  this.shapeType = shapeType;
40987
40990
  this.backgroundColor = backgroundColor;
40988
40991
  this.backgroundOpacity = backgroundOpacity;
@@ -41042,6 +41045,14 @@ class Frame2 extends BaseItem {
41042
41045
  this.linkTo = new LinkTo(this.id, board.events);
41043
41046
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
41044
41047
  this.text.setSelectionHorisontalAlignment("left");
41048
+ this.text.customTransformationMatrix = () => {
41049
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
41050
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
41051
+ return new Matrix(translateX, translateY, scaleX, scaleY);
41052
+ };
41053
+ this.text.renderingScale = (cameraScale) => {
41054
+ return Math.max(1, Math.min(5, 1 / cameraScale));
41055
+ };
41045
41056
  this.transformation.subject.subscribe(() => {
41046
41057
  this.transformPath();
41047
41058
  this.updateMbr();
package/dist/cjs/node.js CHANGED
@@ -24683,6 +24683,8 @@ class RichText extends BaseItem {
24683
24683
  _onLimitReached = () => {};
24684
24684
  shrinkWidth = false;
24685
24685
  prevMbr = null;
24686
+ customTransformationMatrix;
24687
+ renderingScale;
24686
24688
  rtCounter = 0;
24687
24689
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
24688
24690
  super(board, id);
@@ -24976,11 +24978,8 @@ class RichText extends BaseItem {
24976
24978
  return this.shrinkWidth;
24977
24979
  }
24978
24980
  getTransformedContainer() {
24979
- if (this.insideOf === "Frame") {
24980
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
24981
- const scaleY = this.getMbr().getHeight() * 2 / 10;
24982
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
24983
- return this.container.getTransformed(matrix);
24981
+ if (this.customTransformationMatrix) {
24982
+ return this.container.getTransformed(this.customTransformationMatrix());
24984
24983
  }
24985
24984
  return this.container.getTransformed(this.transformation.toMatrix());
24986
24985
  }
@@ -25351,7 +25350,9 @@ class RichText extends BaseItem {
25351
25350
  ctx.clip(this.clipPath.nativePath);
25352
25351
  }
25353
25352
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
25354
- this.layoutNodes.render(ctx, autoSizeScale);
25353
+ const cameraScale = context.getCameraScale();
25354
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25355
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
25355
25356
  ctx.restore();
25356
25357
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
25357
25358
  const { top, right } = this.getMbr();
@@ -25477,7 +25478,9 @@ class RichText extends BaseItem {
25477
25478
  };
25478
25479
  const elements = this.editor.editor.children.map(renderNode);
25479
25480
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
25480
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
25481
+ const cameraScale = this.board.camera.getScale();
25482
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25483
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
25481
25484
  const transformedWidth = this.getTransformedContainer().getWidth();
25482
25485
  const transformedHeight = this.getTransformedContainer().getHeight();
25483
25486
  const div = documentFactory.createElement("rich-text");
@@ -43406,11 +43409,11 @@ function convertBlobToDataUrl(blob) {
43406
43409
  }
43407
43410
 
43408
43411
  // src/Items/Frame/FrameData.ts
43409
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
43412
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
43410
43413
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
43411
43414
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
43412
43415
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
43413
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
43416
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
43414
43417
  var FRAME_TYPES = [
43415
43418
  { id: "Custom", label: "Custom" },
43416
43419
  { id: "Frame16x9", label: "16:9" },
@@ -43455,7 +43458,7 @@ class DefaultFrameData {
43455
43458
  canChangeRatio;
43456
43459
  linkTo;
43457
43460
  itemType = "Frame";
43458
- 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) {
43461
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43459
43462
  this.shapeType = shapeType;
43460
43463
  this.backgroundColor = backgroundColor;
43461
43464
  this.backgroundOpacity = backgroundOpacity;
@@ -43515,6 +43518,14 @@ class Frame2 extends BaseItem {
43515
43518
  this.linkTo = new LinkTo(this.id, board.events);
43516
43519
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
43517
43520
  this.text.setSelectionHorisontalAlignment("left");
43521
+ this.text.customTransformationMatrix = () => {
43522
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
43523
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
43524
+ return new Matrix(translateX, translateY, scaleX, scaleY);
43525
+ };
43526
+ this.text.renderingScale = (cameraScale) => {
43527
+ return Math.max(1, Math.min(5, 1 / cameraScale));
43528
+ };
43518
43529
  this.transformation.subject.subscribe(() => {
43519
43530
  this.transformPath();
43520
43531
  this.updateMbr();
@@ -22040,6 +22040,8 @@ class RichText extends BaseItem {
22040
22040
  _onLimitReached = () => {};
22041
22041
  shrinkWidth = false;
22042
22042
  prevMbr = null;
22043
+ customTransformationMatrix;
22044
+ renderingScale;
22043
22045
  rtCounter = 0;
22044
22046
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22045
22047
  super(board, id);
@@ -22333,11 +22335,8 @@ class RichText extends BaseItem {
22333
22335
  return this.shrinkWidth;
22334
22336
  }
22335
22337
  getTransformedContainer() {
22336
- if (this.insideOf === "Frame") {
22337
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22338
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22339
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22340
- return this.container.getTransformed(matrix);
22338
+ if (this.customTransformationMatrix) {
22339
+ return this.container.getTransformed(this.customTransformationMatrix());
22341
22340
  }
22342
22341
  return this.container.getTransformed(this.transformation.toMatrix());
22343
22342
  }
@@ -22708,7 +22707,9 @@ class RichText extends BaseItem {
22708
22707
  ctx.clip(this.clipPath.nativePath);
22709
22708
  }
22710
22709
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22711
- this.layoutNodes.render(ctx, autoSizeScale);
22710
+ const cameraScale = context.getCameraScale();
22711
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22712
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22712
22713
  ctx.restore();
22713
22714
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22714
22715
  const { top, right } = this.getMbr();
@@ -22834,7 +22835,9 @@ class RichText extends BaseItem {
22834
22835
  };
22835
22836
  const elements = this.editor.editor.children.map(renderNode);
22836
22837
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
22837
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
22838
+ const cameraScale = this.board.camera.getScale();
22839
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22840
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
22838
22841
  const transformedWidth = this.getTransformedContainer().getWidth();
22839
22842
  const transformedHeight = this.getTransformedContainer().getHeight();
22840
22843
  const div = documentFactory.createElement("rich-text");
@@ -40762,11 +40765,11 @@ function convertBlobToDataUrl(blob) {
40762
40765
  }
40763
40766
 
40764
40767
  // src/Items/Frame/FrameData.ts
40765
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40768
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40766
40769
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40767
40770
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40768
40771
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40769
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40772
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40770
40773
  var FRAME_TYPES = [
40771
40774
  { id: "Custom", label: "Custom" },
40772
40775
  { id: "Frame16x9", label: "16:9" },
@@ -40811,7 +40814,7 @@ class DefaultFrameData {
40811
40814
  canChangeRatio;
40812
40815
  linkTo;
40813
40816
  itemType = "Frame";
40814
- 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) {
40817
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40815
40818
  this.shapeType = shapeType;
40816
40819
  this.backgroundColor = backgroundColor;
40817
40820
  this.backgroundOpacity = backgroundOpacity;
@@ -40871,6 +40874,14 @@ class Frame2 extends BaseItem {
40871
40874
  this.linkTo = new LinkTo(this.id, board.events);
40872
40875
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
40873
40876
  this.text.setSelectionHorisontalAlignment("left");
40877
+ this.text.customTransformationMatrix = () => {
40878
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
40879
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
40880
+ return new Matrix(translateX, translateY, scaleX, scaleY);
40881
+ };
40882
+ this.text.renderingScale = (cameraScale) => {
40883
+ return Math.max(1, Math.min(5, 1 / cameraScale));
40884
+ };
40874
40885
  this.transformation.subject.subscribe(() => {
40875
40886
  this.transformPath();
40876
40887
  this.updateMbr();
package/dist/esm/index.js CHANGED
@@ -22033,6 +22033,8 @@ class RichText extends BaseItem {
22033
22033
  _onLimitReached = () => {};
22034
22034
  shrinkWidth = false;
22035
22035
  prevMbr = null;
22036
+ customTransformationMatrix;
22037
+ renderingScale;
22036
22038
  rtCounter = 0;
22037
22039
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
22038
22040
  super(board, id);
@@ -22326,11 +22328,8 @@ class RichText extends BaseItem {
22326
22328
  return this.shrinkWidth;
22327
22329
  }
22328
22330
  getTransformedContainer() {
22329
- if (this.insideOf === "Frame") {
22330
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
22331
- const scaleY = this.getMbr().getHeight() * 2 / 10;
22332
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
22333
- return this.container.getTransformed(matrix);
22331
+ if (this.customTransformationMatrix) {
22332
+ return this.container.getTransformed(this.customTransformationMatrix());
22334
22333
  }
22335
22334
  return this.container.getTransformed(this.transformation.toMatrix());
22336
22335
  }
@@ -22701,7 +22700,9 @@ class RichText extends BaseItem {
22701
22700
  ctx.clip(this.clipPath.nativePath);
22702
22701
  }
22703
22702
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
22704
- this.layoutNodes.render(ctx, autoSizeScale);
22703
+ const cameraScale = context.getCameraScale();
22704
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22705
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
22705
22706
  ctx.restore();
22706
22707
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
22707
22708
  const { top, right } = this.getMbr();
@@ -22827,7 +22828,9 @@ class RichText extends BaseItem {
22827
22828
  };
22828
22829
  const elements = this.editor.editor.children.map(renderNode);
22829
22830
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
22830
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
22831
+ const cameraScale = this.board.camera.getScale();
22832
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
22833
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
22831
22834
  const transformedWidth = this.getTransformedContainer().getWidth();
22832
22835
  const transformedHeight = this.getTransformedContainer().getHeight();
22833
22836
  const div = documentFactory.createElement("rich-text");
@@ -40755,11 +40758,11 @@ function convertBlobToDataUrl(blob) {
40755
40758
  }
40756
40759
 
40757
40760
  // src/Items/Frame/FrameData.ts
40758
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
40761
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
40759
40762
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
40760
40763
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
40761
40764
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
40762
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
40765
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
40763
40766
  var FRAME_TYPES = [
40764
40767
  { id: "Custom", label: "Custom" },
40765
40768
  { id: "Frame16x9", label: "16:9" },
@@ -40804,7 +40807,7 @@ class DefaultFrameData {
40804
40807
  canChangeRatio;
40805
40808
  linkTo;
40806
40809
  itemType = "Frame";
40807
- 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) {
40810
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
40808
40811
  this.shapeType = shapeType;
40809
40812
  this.backgroundColor = backgroundColor;
40810
40813
  this.backgroundOpacity = backgroundOpacity;
@@ -40864,6 +40867,14 @@ class Frame2 extends BaseItem {
40864
40867
  this.linkTo = new LinkTo(this.id, board.events);
40865
40868
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
40866
40869
  this.text.setSelectionHorisontalAlignment("left");
40870
+ this.text.customTransformationMatrix = () => {
40871
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
40872
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
40873
+ return new Matrix(translateX, translateY, scaleX, scaleY);
40874
+ };
40875
+ this.text.renderingScale = (cameraScale) => {
40876
+ return Math.max(1, Math.min(5, 1 / cameraScale));
40877
+ };
40867
40878
  this.transformation.subject.subscribe(() => {
40868
40879
  this.transformPath();
40869
40880
  this.updateMbr();
package/dist/esm/node.js CHANGED
@@ -24500,6 +24500,8 @@ class RichText extends BaseItem {
24500
24500
  _onLimitReached = () => {};
24501
24501
  shrinkWidth = false;
24502
24502
  prevMbr = null;
24503
+ customTransformationMatrix;
24504
+ renderingScale;
24503
24505
  rtCounter = 0;
24504
24506
  constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
24505
24507
  super(board, id);
@@ -24793,11 +24795,8 @@ class RichText extends BaseItem {
24793
24795
  return this.shrinkWidth;
24794
24796
  }
24795
24797
  getTransformedContainer() {
24796
- if (this.insideOf === "Frame") {
24797
- const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
24798
- const scaleY = this.getMbr().getHeight() * 2 / 10;
24799
- const matrix = new Matrix(translateX, translateY, scaleX, scaleY);
24800
- return this.container.getTransformed(matrix);
24798
+ if (this.customTransformationMatrix) {
24799
+ return this.container.getTransformed(this.customTransformationMatrix());
24801
24800
  }
24802
24801
  return this.container.getTransformed(this.transformation.toMatrix());
24803
24802
  }
@@ -25168,7 +25167,9 @@ class RichText extends BaseItem {
25168
25167
  ctx.clip(this.clipPath.nativePath);
25169
25168
  }
25170
25169
  const autoSizeScale = this.autoSize ? this.autoSizeScale : undefined;
25171
- this.layoutNodes.render(ctx, autoSizeScale);
25170
+ const cameraScale = context.getCameraScale();
25171
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25172
+ this.layoutNodes.render(ctx, autoSizeScale ? autoSizeScale * extraScale : extraScale);
25172
25173
  ctx.restore();
25173
25174
  if (this.getLinkTo() && (this.insideOf === "RichText" || !this.insideOf)) {
25174
25175
  const { top, right } = this.getMbr();
@@ -25294,7 +25295,9 @@ class RichText extends BaseItem {
25294
25295
  };
25295
25296
  const elements = this.editor.editor.children.map(renderNode);
25296
25297
  const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
25297
- const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
25298
+ const cameraScale = this.board.camera.getScale();
25299
+ const extraScale = this.renderingScale ? this.renderingScale(cameraScale) : 1;
25300
+ const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX * extraScale}, ${scaleY * extraScale})`;
25298
25301
  const transformedWidth = this.getTransformedContainer().getWidth();
25299
25302
  const transformedHeight = this.getTransformedContainer().getHeight();
25300
25303
  const div = documentFactory.createElement("rich-text");
@@ -43223,11 +43226,11 @@ function convertBlobToDataUrl(blob) {
43223
43226
  }
43224
43227
 
43225
43228
  // src/Items/Frame/FrameData.ts
43226
- var FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
43229
+ var FRAME_BORDER_COLOR = semanticColor("contrastGray");
43227
43230
  var FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
43228
43231
  var FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
43229
43232
  var FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
43230
- var FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
43233
+ var FRAME_TITLE_COLOR = semanticColor("contrastNeutral");
43231
43234
  var FRAME_TYPES = [
43232
43235
  { id: "Custom", label: "Custom" },
43233
43236
  { id: "Frame16x9", label: "16:9" },
@@ -43272,7 +43275,7 @@ class DefaultFrameData {
43272
43275
  canChangeRatio;
43273
43276
  linkTo;
43274
43277
  itemType = "Frame";
43275
- 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) {
43278
+ constructor(shapeType = "Custom", backgroundColor = semanticColor("contrastNeutral"), backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
43276
43279
  this.shapeType = shapeType;
43277
43280
  this.backgroundColor = backgroundColor;
43278
43281
  this.backgroundOpacity = backgroundOpacity;
@@ -43332,6 +43335,14 @@ class Frame2 extends BaseItem {
43332
43335
  this.linkTo = new LinkTo(this.id, board.events);
43333
43336
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
43334
43337
  this.text.setSelectionHorisontalAlignment("left");
43338
+ this.text.customTransformationMatrix = () => {
43339
+ const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
43340
+ const scaleY = this.getMbr().getHeight() * 2 / 10;
43341
+ return new Matrix(translateX, translateY, scaleX, scaleY);
43342
+ };
43343
+ this.text.renderingScale = (cameraScale) => {
43344
+ return Math.max(1, Math.min(5, 1 / cameraScale));
43345
+ };
43335
43346
  this.transformation.subject.subscribe(() => {
43336
43347
  this.transformPath();
43337
43348
  this.updateMbr();
@@ -3,11 +3,11 @@ import { RichTextData } from '../RichText';
3
3
  import { BorderStyle, BorderWidth } from '../Path';
4
4
  import { FrameType } from './Basic';
5
5
  import { ColorValue } from '../../..';
6
- export declare const FRAME_BORDER_COLOR = "rgba(10, 15, 41, 0.08)";
6
+ export declare const FRAME_BORDER_COLOR: import("../../..").SemanticColor;
7
7
  export declare const FRAME_HIGHLIGHTER_BORDER_COLOR = "#93AFF6";
8
8
  export declare const FRAME_CHILDREN_HIGHLIGHTER_COLOR = "rgb(10, 15, 41, .08)";
9
9
  export declare const FRAME_CHILDREN_HIGHLIGHTER_BORDER_COLOR = "#4778F5";
10
- export declare const FRAME_TITLE_COLOR = "rgb(107, 110, 120)";
10
+ export declare const FRAME_TITLE_COLOR: import("../../..").SemanticColor;
11
11
  export declare const FRAME_TYPES: readonly [{
12
12
  readonly id: "Custom";
13
13
  readonly label: "Custom";
@@ -6,7 +6,7 @@ import { SelectionContext } from "../../Selection";
6
6
  import { DefaultTextStyles } from "../../Settings";
7
7
  import { Subject } from "../../Subject";
8
8
  import { BaseRange, BaseSelection, Descendant, Operation as SlateOp } from "slate";
9
- import { ItemType, Mbr, Point, RichTextData, Transformation } from "..";
9
+ import { ItemType, Matrix, Mbr, Point, RichTextData, Transformation } from "..";
10
10
  import { HorisontalAlignment, VerticalAlignment } from "../Alignment";
11
11
  import { DrawingContext } from "../DrawingContext";
12
12
  import { LinkTo } from "../LinkTo/LinkTo";
@@ -52,6 +52,8 @@ export declare class RichText extends BaseItem {
52
52
  private _onLimitReached;
53
53
  private shrinkWidth;
54
54
  prevMbr: Mbr | null;
55
+ customTransformationMatrix?: () => Matrix;
56
+ renderingScale?: (cameraScale: number) => number;
55
57
  rtCounter: number;
56
58
  constructor(board: Board, container: Mbr, id?: string, transformation?: Transformation, linkTo?: LinkTo, placeholderText?: string, isInShape?: boolean, autoSize?: boolean, insideOf?: ItemType | undefined, initialTextStyles?: DefaultTextStyles);
57
59
  isClosed(): boolean;
@@ -1,5 +1,6 @@
1
+ import type { ColorValue } from '../../../../Color/index.js';
1
2
  import { HorisontalAlignment } from '../../../Alignment.js';
2
3
  import { BlockNode } from '../../Editor/BlockNode.js';
3
4
  import { TextNode, TextStyle } from '../../Editor/TextNode.js';
4
- export declare function getParagraph(fontStyles: TextStyle[], fontColor: string, fontSize: number, fontFamily: string, defaultHorizontalAlignment: HorisontalAlignment, text: string): BlockNode[];
5
+ export declare function getParagraph(fontStyles: TextStyle[], fontColor: string | ColorValue, fontSize: number, fontFamily: string, defaultHorizontalAlignment: HorisontalAlignment, text: string): BlockNode[];
5
6
  export declare function getParagraphWithPassedTextNode(textNode: TextNode): BlockNode[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.12.9",
3
+ "version": "0.13.0",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",