@fieldnotes/core 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -108,6 +108,7 @@ interface GridElement extends BaseElement {
|
|
|
108
108
|
opacity: number;
|
|
109
109
|
}
|
|
110
110
|
type TemplateShape = 'circle' | 'cone' | 'line' | 'square';
|
|
111
|
+
type TemplateRenderStyle = 'cells' | 'geometric';
|
|
111
112
|
interface TemplateElement extends BaseElement {
|
|
112
113
|
type: 'template';
|
|
113
114
|
templateShape: TemplateShape;
|
|
@@ -119,6 +120,7 @@ interface TemplateElement extends BaseElement {
|
|
|
119
120
|
opacity: number;
|
|
120
121
|
feetPerCell?: number;
|
|
121
122
|
radiusFeet?: number;
|
|
123
|
+
renderStyle?: TemplateRenderStyle;
|
|
122
124
|
}
|
|
123
125
|
type CanvasElement = StrokeElement | NoteElement | ArrowElement | ImageElement | HtmlElement | TextElement | ShapeElement | GridElement | TemplateElement;
|
|
124
126
|
type ElementType = CanvasElement['type'];
|
|
@@ -701,6 +703,7 @@ interface TemplateInput extends BaseDefaults {
|
|
|
701
703
|
opacity?: number;
|
|
702
704
|
feetPerCell?: number;
|
|
703
705
|
radiusFeet?: number;
|
|
706
|
+
renderStyle?: TemplateRenderStyle;
|
|
704
707
|
}
|
|
705
708
|
declare function createTemplate(input: TemplateInput): TemplateElement;
|
|
706
709
|
|
|
@@ -995,6 +998,7 @@ interface TemplateToolOptions {
|
|
|
995
998
|
strokeWidth?: number;
|
|
996
999
|
opacity?: number;
|
|
997
1000
|
feetPerCell?: number;
|
|
1001
|
+
renderStyle?: TemplateRenderStyle;
|
|
998
1002
|
}
|
|
999
1003
|
declare class TemplateTool implements Tool {
|
|
1000
1004
|
readonly name = "template";
|
|
@@ -1011,6 +1015,7 @@ declare class TemplateTool implements Tool {
|
|
|
1011
1015
|
private strokeWidth;
|
|
1012
1016
|
private opacity;
|
|
1013
1017
|
private feetPerCell;
|
|
1018
|
+
private renderStyle;
|
|
1014
1019
|
private optionListeners;
|
|
1015
1020
|
constructor(options?: TemplateToolOptions);
|
|
1016
1021
|
getOptions(): TemplateToolOptions;
|
|
@@ -1060,6 +1065,6 @@ declare class LaserTool implements Tool {
|
|
|
1060
1065
|
private notifyOptionsChange;
|
|
1061
1066
|
}
|
|
1062
1067
|
|
|
1063
|
-
declare const VERSION = "0.
|
|
1068
|
+
declare const VERSION = "0.44.0";
|
|
1064
1069
|
|
|
1065
|
-
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
1070
|
+
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ interface GridElement extends BaseElement {
|
|
|
108
108
|
opacity: number;
|
|
109
109
|
}
|
|
110
110
|
type TemplateShape = 'circle' | 'cone' | 'line' | 'square';
|
|
111
|
+
type TemplateRenderStyle = 'cells' | 'geometric';
|
|
111
112
|
interface TemplateElement extends BaseElement {
|
|
112
113
|
type: 'template';
|
|
113
114
|
templateShape: TemplateShape;
|
|
@@ -119,6 +120,7 @@ interface TemplateElement extends BaseElement {
|
|
|
119
120
|
opacity: number;
|
|
120
121
|
feetPerCell?: number;
|
|
121
122
|
radiusFeet?: number;
|
|
123
|
+
renderStyle?: TemplateRenderStyle;
|
|
122
124
|
}
|
|
123
125
|
type CanvasElement = StrokeElement | NoteElement | ArrowElement | ImageElement | HtmlElement | TextElement | ShapeElement | GridElement | TemplateElement;
|
|
124
126
|
type ElementType = CanvasElement['type'];
|
|
@@ -701,6 +703,7 @@ interface TemplateInput extends BaseDefaults {
|
|
|
701
703
|
opacity?: number;
|
|
702
704
|
feetPerCell?: number;
|
|
703
705
|
radiusFeet?: number;
|
|
706
|
+
renderStyle?: TemplateRenderStyle;
|
|
704
707
|
}
|
|
705
708
|
declare function createTemplate(input: TemplateInput): TemplateElement;
|
|
706
709
|
|
|
@@ -995,6 +998,7 @@ interface TemplateToolOptions {
|
|
|
995
998
|
strokeWidth?: number;
|
|
996
999
|
opacity?: number;
|
|
997
1000
|
feetPerCell?: number;
|
|
1001
|
+
renderStyle?: TemplateRenderStyle;
|
|
998
1002
|
}
|
|
999
1003
|
declare class TemplateTool implements Tool {
|
|
1000
1004
|
readonly name = "template";
|
|
@@ -1011,6 +1015,7 @@ declare class TemplateTool implements Tool {
|
|
|
1011
1015
|
private strokeWidth;
|
|
1012
1016
|
private opacity;
|
|
1013
1017
|
private feetPerCell;
|
|
1018
|
+
private renderStyle;
|
|
1014
1019
|
private optionListeners;
|
|
1015
1020
|
constructor(options?: TemplateToolOptions);
|
|
1016
1021
|
getOptions(): TemplateToolOptions;
|
|
@@ -1060,6 +1065,6 @@ declare class LaserTool implements Tool {
|
|
|
1060
1065
|
private notifyOptionsChange;
|
|
1061
1066
|
}
|
|
1062
1067
|
|
|
1063
|
-
declare const VERSION = "0.
|
|
1068
|
+
declare const VERSION = "0.44.0";
|
|
1064
1069
|
|
|
1065
|
-
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
1070
|
+
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.js
CHANGED
|
@@ -3121,7 +3121,7 @@ function drawHexPath(ctx, cx, cy, cellSize, orientation) {
|
|
|
3121
3121
|
// src/elements/renderers/template-renderer.ts
|
|
3122
3122
|
function renderTemplate(ctx, template, store) {
|
|
3123
3123
|
const grid = store?.getElementsByType("grid")[0];
|
|
3124
|
-
if (grid && grid.gridType === "hex") {
|
|
3124
|
+
if (grid && grid.gridType === "hex" && template.renderStyle !== "geometric") {
|
|
3125
3125
|
renderHexTemplate(ctx, template, grid.cellSize, grid.hexOrientation);
|
|
3126
3126
|
return;
|
|
3127
3127
|
}
|
|
@@ -3797,7 +3797,8 @@ function createTemplate(input) {
|
|
|
3797
3797
|
strokeWidth: input.strokeWidth ?? 2,
|
|
3798
3798
|
opacity: input.opacity ?? 0.6,
|
|
3799
3799
|
feetPerCell: input.feetPerCell,
|
|
3800
|
-
radiusFeet: input.radiusFeet
|
|
3800
|
+
radiusFeet: input.radiusFeet,
|
|
3801
|
+
...input.renderStyle !== void 0 ? { renderStyle: input.renderStyle } : {}
|
|
3801
3802
|
};
|
|
3802
3803
|
}
|
|
3803
3804
|
|
|
@@ -9612,6 +9613,7 @@ var TemplateTool = class {
|
|
|
9612
9613
|
strokeWidth;
|
|
9613
9614
|
opacity;
|
|
9614
9615
|
feetPerCell;
|
|
9616
|
+
renderStyle;
|
|
9615
9617
|
optionListeners = /* @__PURE__ */ new Set();
|
|
9616
9618
|
constructor(options = {}) {
|
|
9617
9619
|
this.templateShape = options.templateShape ?? "circle";
|
|
@@ -9620,6 +9622,7 @@ var TemplateTool = class {
|
|
|
9620
9622
|
this.strokeWidth = options.strokeWidth ?? 2;
|
|
9621
9623
|
this.opacity = options.opacity ?? 0.6;
|
|
9622
9624
|
this.feetPerCell = options.feetPerCell ?? 5;
|
|
9625
|
+
this.renderStyle = options.renderStyle ?? "cells";
|
|
9623
9626
|
}
|
|
9624
9627
|
getOptions() {
|
|
9625
9628
|
return {
|
|
@@ -9628,7 +9631,8 @@ var TemplateTool = class {
|
|
|
9628
9631
|
strokeColor: this.strokeColor,
|
|
9629
9632
|
strokeWidth: this.strokeWidth,
|
|
9630
9633
|
opacity: this.opacity,
|
|
9631
|
-
feetPerCell: this.feetPerCell
|
|
9634
|
+
feetPerCell: this.feetPerCell,
|
|
9635
|
+
renderStyle: this.renderStyle
|
|
9632
9636
|
};
|
|
9633
9637
|
}
|
|
9634
9638
|
setOptions(options) {
|
|
@@ -9638,6 +9642,7 @@ var TemplateTool = class {
|
|
|
9638
9642
|
if (options.strokeWidth !== void 0) this.strokeWidth = options.strokeWidth;
|
|
9639
9643
|
if (options.opacity !== void 0) this.opacity = options.opacity;
|
|
9640
9644
|
if (options.feetPerCell !== void 0) this.feetPerCell = options.feetPerCell;
|
|
9645
|
+
if (options.renderStyle !== void 0) this.renderStyle = options.renderStyle;
|
|
9641
9646
|
this.notifyOptionsChange();
|
|
9642
9647
|
}
|
|
9643
9648
|
onOptionsChange(listener) {
|
|
@@ -9680,6 +9685,7 @@ var TemplateTool = class {
|
|
|
9680
9685
|
opacity: this.opacity,
|
|
9681
9686
|
feetPerCell: this.feetPerCell,
|
|
9682
9687
|
radiusFeet: radiusFeet > 0 ? radiusFeet : void 0,
|
|
9688
|
+
renderStyle: this.renderStyle,
|
|
9683
9689
|
layerId: ctx.activeLayerId ?? ""
|
|
9684
9690
|
});
|
|
9685
9691
|
ctx.store.add(element);
|
|
@@ -9695,7 +9701,7 @@ var TemplateTool = class {
|
|
|
9695
9701
|
if (!this.drawing) return;
|
|
9696
9702
|
const radius = this.computeRadius();
|
|
9697
9703
|
if (radius <= 0) return;
|
|
9698
|
-
if (this.gridType === "hex" && this.hexOrientation) {
|
|
9704
|
+
if (this.gridType === "hex" && this.hexOrientation && this.renderStyle !== "geometric") {
|
|
9699
9705
|
this.renderHexOverlay(ctx, radius);
|
|
9700
9706
|
return;
|
|
9701
9707
|
}
|
|
@@ -9968,7 +9974,7 @@ var LaserTool = class {
|
|
|
9968
9974
|
};
|
|
9969
9975
|
|
|
9970
9976
|
// src/index.ts
|
|
9971
|
-
var VERSION = "0.
|
|
9977
|
+
var VERSION = "0.44.0";
|
|
9972
9978
|
export {
|
|
9973
9979
|
ArrowTool,
|
|
9974
9980
|
AutoSave,
|