@fieldnotes/core 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -190,6 +190,9 @@ function migrateElement(obj) {
190
190
  if (obj["type"] === "shape" && typeof obj["shape"] !== "string") {
191
191
  obj["shape"] = "rectangle";
192
192
  }
193
+ if (obj["type"] === "note" && typeof obj["textColor"] !== "string") {
194
+ obj["textColor"] = "#000000";
195
+ }
193
196
  }
194
197
 
195
198
  // src/core/auto-save.ts
@@ -1497,7 +1500,8 @@ function createNote(input) {
1497
1500
  locked: input.locked ?? false,
1498
1501
  size: input.size ?? { w: 200, h: 100 },
1499
1502
  text: input.text ?? "",
1500
- backgroundColor: input.backgroundColor ?? "#ffeb3b"
1503
+ backgroundColor: input.backgroundColor ?? "#ffeb3b",
1504
+ textColor: input.textColor ?? "#000000"
1501
1505
  };
1502
1506
  }
1503
1507
  function createArrow(input) {
@@ -1896,6 +1900,7 @@ var Viewport = class {
1896
1900
  node.dataset["initialized"] = "true";
1897
1901
  Object.assign(node.style, {
1898
1902
  backgroundColor: element.backgroundColor,
1903
+ color: element.textColor,
1899
1904
  padding: "8px",
1900
1905
  borderRadius: "4px",
1901
1906
  boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
@@ -1917,6 +1922,7 @@ var Viewport = class {
1917
1922
  node.textContent = element.text || "";
1918
1923
  }
1919
1924
  node.style.backgroundColor = element.backgroundColor;
1925
+ node.style.color = element.textColor;
1920
1926
  }
1921
1927
  }
1922
1928
  if (element.type === "image") {
@@ -2895,13 +2901,16 @@ var ArrowTool = class {
2895
2901
  var NoteTool = class {
2896
2902
  name = "note";
2897
2903
  backgroundColor;
2904
+ textColor;
2898
2905
  size;
2899
2906
  constructor(options = {}) {
2900
2907
  this.backgroundColor = options.backgroundColor ?? "#ffeb3b";
2908
+ this.textColor = options.textColor ?? "#000000";
2901
2909
  this.size = options.size ?? { w: 200, h: 100 };
2902
2910
  }
2903
2911
  setOptions(options) {
2904
2912
  if (options.backgroundColor !== void 0) this.backgroundColor = options.backgroundColor;
2913
+ if (options.textColor !== void 0) this.textColor = options.textColor;
2905
2914
  if (options.size !== void 0) this.size = options.size;
2906
2915
  }
2907
2916
  onPointerDown(_state, _ctx) {
@@ -2913,7 +2922,8 @@ var NoteTool = class {
2913
2922
  const note = createNote({
2914
2923
  position: world,
2915
2924
  size: { ...this.size },
2916
- backgroundColor: this.backgroundColor
2925
+ backgroundColor: this.backgroundColor,
2926
+ textColor: this.textColor
2917
2927
  });
2918
2928
  ctx.store.add(note);
2919
2929
  ctx.requestRender();
@@ -3109,7 +3119,7 @@ var ShapeTool = class {
3109
3119
  };
3110
3120
 
3111
3121
  // src/index.ts
3112
- var VERSION = "0.4.0";
3122
+ var VERSION = "0.4.1";
3113
3123
  // Annotate the CommonJS export names for ESM import in node:
3114
3124
  0 && (module.exports = {
3115
3125
  AddElementCommand,