@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.d.cts CHANGED
@@ -43,6 +43,7 @@ interface NoteElement extends BaseElement {
43
43
  size: Size;
44
44
  text: string;
45
45
  backgroundColor: string;
46
+ textColor: string;
46
47
  }
47
48
  interface Binding {
48
49
  elementId: string;
@@ -455,6 +456,7 @@ interface NoteInput extends BaseDefaults {
455
456
  size?: Size;
456
457
  text?: string;
457
458
  backgroundColor?: string;
459
+ textColor?: string;
458
460
  }
459
461
  interface ArrowInput extends BaseDefaults {
460
462
  from: Point;
@@ -654,11 +656,13 @@ declare class ArrowTool implements Tool {
654
656
 
655
657
  interface NoteToolOptions {
656
658
  backgroundColor?: string;
659
+ textColor?: string;
657
660
  size?: Size;
658
661
  }
659
662
  declare class NoteTool implements Tool {
660
663
  readonly name = "note";
661
664
  private backgroundColor;
665
+ private textColor;
662
666
  private size;
663
667
  constructor(options?: NoteToolOptions);
664
668
  setOptions(options: NoteToolOptions): void;
@@ -729,6 +733,6 @@ declare class ShapeTool implements Tool {
729
733
  private onKeyUp;
730
734
  }
731
735
 
732
- declare const VERSION = "0.4.0";
736
+ declare const VERSION = "0.4.1";
733
737
 
734
738
  export { AddElementCommand, type ArrowElement, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, Background, type BackgroundOptions, type BackgroundPattern, BatchCommand, type Binding, type Bounds, Camera, type CameraOptions, type CanvasElement, type CanvasState, type Command, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, HandTool, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputHandler, NoteEditor, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, RemoveElementCommand, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type Size, type StrokeElement, type StrokePoint, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, UpdateElementCommand, VERSION, Viewport, type ViewportOptions, clearStaleBindings, createArrow, createHtmlElement, createId, createImage, createNote, createShape, createStroke, createText, exportState, findBindTarget, findBoundArrows, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, isBindable, isNearBezier, parseState, unbindArrow, updateBoundArrow };
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ interface NoteElement extends BaseElement {
43
43
  size: Size;
44
44
  text: string;
45
45
  backgroundColor: string;
46
+ textColor: string;
46
47
  }
47
48
  interface Binding {
48
49
  elementId: string;
@@ -455,6 +456,7 @@ interface NoteInput extends BaseDefaults {
455
456
  size?: Size;
456
457
  text?: string;
457
458
  backgroundColor?: string;
459
+ textColor?: string;
458
460
  }
459
461
  interface ArrowInput extends BaseDefaults {
460
462
  from: Point;
@@ -654,11 +656,13 @@ declare class ArrowTool implements Tool {
654
656
 
655
657
  interface NoteToolOptions {
656
658
  backgroundColor?: string;
659
+ textColor?: string;
657
660
  size?: Size;
658
661
  }
659
662
  declare class NoteTool implements Tool {
660
663
  readonly name = "note";
661
664
  private backgroundColor;
665
+ private textColor;
662
666
  private size;
663
667
  constructor(options?: NoteToolOptions);
664
668
  setOptions(options: NoteToolOptions): void;
@@ -729,6 +733,6 @@ declare class ShapeTool implements Tool {
729
733
  private onKeyUp;
730
734
  }
731
735
 
732
- declare const VERSION = "0.4.0";
736
+ declare const VERSION = "0.4.1";
733
737
 
734
738
  export { AddElementCommand, type ArrowElement, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, Background, type BackgroundOptions, type BackgroundPattern, BatchCommand, type Binding, type Bounds, Camera, type CameraOptions, type CanvasElement, type CanvasState, type Command, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, HandTool, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputHandler, NoteEditor, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, RemoveElementCommand, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type Size, type StrokeElement, type StrokePoint, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, UpdateElementCommand, VERSION, Viewport, type ViewportOptions, clearStaleBindings, createArrow, createHtmlElement, createId, createImage, createNote, createShape, createStroke, createText, exportState, findBindTarget, findBoundArrows, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, isBindable, isNearBezier, parseState, unbindArrow, updateBoundArrow };
package/dist/index.js CHANGED
@@ -114,6 +114,9 @@ function migrateElement(obj) {
114
114
  if (obj["type"] === "shape" && typeof obj["shape"] !== "string") {
115
115
  obj["shape"] = "rectangle";
116
116
  }
117
+ if (obj["type"] === "note" && typeof obj["textColor"] !== "string") {
118
+ obj["textColor"] = "#000000";
119
+ }
117
120
  }
118
121
 
119
122
  // src/core/auto-save.ts
@@ -1421,7 +1424,8 @@ function createNote(input) {
1421
1424
  locked: input.locked ?? false,
1422
1425
  size: input.size ?? { w: 200, h: 100 },
1423
1426
  text: input.text ?? "",
1424
- backgroundColor: input.backgroundColor ?? "#ffeb3b"
1427
+ backgroundColor: input.backgroundColor ?? "#ffeb3b",
1428
+ textColor: input.textColor ?? "#000000"
1425
1429
  };
1426
1430
  }
1427
1431
  function createArrow(input) {
@@ -1820,6 +1824,7 @@ var Viewport = class {
1820
1824
  node.dataset["initialized"] = "true";
1821
1825
  Object.assign(node.style, {
1822
1826
  backgroundColor: element.backgroundColor,
1827
+ color: element.textColor,
1823
1828
  padding: "8px",
1824
1829
  borderRadius: "4px",
1825
1830
  boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
@@ -1841,6 +1846,7 @@ var Viewport = class {
1841
1846
  node.textContent = element.text || "";
1842
1847
  }
1843
1848
  node.style.backgroundColor = element.backgroundColor;
1849
+ node.style.color = element.textColor;
1844
1850
  }
1845
1851
  }
1846
1852
  if (element.type === "image") {
@@ -2819,13 +2825,16 @@ var ArrowTool = class {
2819
2825
  var NoteTool = class {
2820
2826
  name = "note";
2821
2827
  backgroundColor;
2828
+ textColor;
2822
2829
  size;
2823
2830
  constructor(options = {}) {
2824
2831
  this.backgroundColor = options.backgroundColor ?? "#ffeb3b";
2832
+ this.textColor = options.textColor ?? "#000000";
2825
2833
  this.size = options.size ?? { w: 200, h: 100 };
2826
2834
  }
2827
2835
  setOptions(options) {
2828
2836
  if (options.backgroundColor !== void 0) this.backgroundColor = options.backgroundColor;
2837
+ if (options.textColor !== void 0) this.textColor = options.textColor;
2829
2838
  if (options.size !== void 0) this.size = options.size;
2830
2839
  }
2831
2840
  onPointerDown(_state, _ctx) {
@@ -2837,7 +2846,8 @@ var NoteTool = class {
2837
2846
  const note = createNote({
2838
2847
  position: world,
2839
2848
  size: { ...this.size },
2840
- backgroundColor: this.backgroundColor
2849
+ backgroundColor: this.backgroundColor,
2850
+ textColor: this.textColor
2841
2851
  });
2842
2852
  ctx.store.add(note);
2843
2853
  ctx.requestRender();
@@ -3033,7 +3043,7 @@ var ShapeTool = class {
3033
3043
  };
3034
3044
 
3035
3045
  // src/index.ts
3036
- var VERSION = "0.4.0";
3046
+ var VERSION = "0.4.1";
3037
3047
  export {
3038
3048
  AddElementCommand,
3039
3049
  ArrowTool,