@fieldnotes/core 0.40.1 → 0.40.2
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 +20 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1048,6 +1048,6 @@ declare class LaserTool implements Tool {
|
|
|
1048
1048
|
private notifyOptionsChange;
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
|
-
declare const VERSION = "0.40.
|
|
1051
|
+
declare const VERSION = "0.40.2";
|
|
1052
1052
|
|
|
1053
1053
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1048,6 +1048,6 @@ declare class LaserTool implements Tool {
|
|
|
1048
1048
|
private notifyOptionsChange;
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
|
-
declare const VERSION = "0.40.
|
|
1051
|
+
declare const VERSION = "0.40.2";
|
|
1052
1052
|
|
|
1053
1053
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, 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 };
|
package/dist/index.js
CHANGED
|
@@ -3948,6 +3948,7 @@ var NoteEditor = class {
|
|
|
3948
3948
|
inputHandler = null;
|
|
3949
3949
|
pendingEditId = null;
|
|
3950
3950
|
onStopCallback = null;
|
|
3951
|
+
onInputCallback = null;
|
|
3951
3952
|
beginHistory = null;
|
|
3952
3953
|
commitHistory = null;
|
|
3953
3954
|
toolbar;
|
|
@@ -3965,6 +3966,9 @@ var NoteEditor = class {
|
|
|
3965
3966
|
setOnStop(callback) {
|
|
3966
3967
|
this.onStopCallback = callback;
|
|
3967
3968
|
}
|
|
3969
|
+
setOnInput(callback) {
|
|
3970
|
+
this.onInputCallback = callback;
|
|
3971
|
+
}
|
|
3968
3972
|
setHistoryHooks(begin, commit) {
|
|
3969
3973
|
this.beginHistory = begin;
|
|
3970
3974
|
this.commitHistory = commit;
|
|
@@ -4007,7 +4011,6 @@ var NoteEditor = class {
|
|
|
4007
4011
|
cursor: "default"
|
|
4008
4012
|
});
|
|
4009
4013
|
this.toolbar?.hide();
|
|
4010
|
-
this.beginHistory?.();
|
|
4011
4014
|
if (textChanged) {
|
|
4012
4015
|
store.update(this.editingId, { text });
|
|
4013
4016
|
}
|
|
@@ -4036,6 +4039,7 @@ var NoteEditor = class {
|
|
|
4036
4039
|
activateEditing(node, elementId, store) {
|
|
4037
4040
|
this.editingId = elementId;
|
|
4038
4041
|
this.editingNode = node;
|
|
4042
|
+
this.beginHistory?.();
|
|
4039
4043
|
node.contentEditable = "true";
|
|
4040
4044
|
Object.assign(node.style, {
|
|
4041
4045
|
userSelect: "text",
|
|
@@ -4056,6 +4060,7 @@ var NoteEditor = class {
|
|
|
4056
4060
|
node.setAttribute("data-fn-empty", String(isNodeEmpty(node)));
|
|
4057
4061
|
this.inputHandler = () => {
|
|
4058
4062
|
node.setAttribute("data-fn-empty", String(isNodeEmpty(node)));
|
|
4063
|
+
this.onInputCallback?.(elementId);
|
|
4059
4064
|
};
|
|
4060
4065
|
node.addEventListener("input", this.inputHandler);
|
|
4061
4066
|
this.toolbar?.show(node);
|
|
@@ -6519,6 +6524,16 @@ var ViewportInteractions = class {
|
|
|
6519
6524
|
this.deps.noteEditor.startEditing(node, id, this.deps.store);
|
|
6520
6525
|
}
|
|
6521
6526
|
}
|
|
6527
|
+
liveFitHeight(elementId) {
|
|
6528
|
+
const element = this.deps.store.getById(elementId);
|
|
6529
|
+
if (!element || element.type !== "note" && element.type !== "text") return;
|
|
6530
|
+
const node = this.deps.domNodeManager.getNode(elementId);
|
|
6531
|
+
if (!node) return;
|
|
6532
|
+
const measured = node.scrollHeight;
|
|
6533
|
+
if (measured > 0 && measured !== element.size.h) {
|
|
6534
|
+
this.deps.store.update(elementId, { size: { w: element.size.w, h: measured } });
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6522
6537
|
fitNoteHeight(elementId) {
|
|
6523
6538
|
const element = this.deps.store.getById(elementId);
|
|
6524
6539
|
if (!element || element.type !== "note") return;
|
|
@@ -6538,7 +6553,7 @@ var ViewportInteractions = class {
|
|
|
6538
6553
|
this.deps.store.remove(elementId);
|
|
6539
6554
|
return;
|
|
6540
6555
|
}
|
|
6541
|
-
this.
|
|
6556
|
+
this.liveFitHeight(elementId);
|
|
6542
6557
|
return;
|
|
6543
6558
|
}
|
|
6544
6559
|
if (element.type !== "text") return;
|
|
@@ -6546,13 +6561,7 @@ var ViewportInteractions = class {
|
|
|
6546
6561
|
this.deps.store.remove(elementId);
|
|
6547
6562
|
return;
|
|
6548
6563
|
}
|
|
6549
|
-
|
|
6550
|
-
if (node && "size" in element) {
|
|
6551
|
-
const measured = node.scrollHeight;
|
|
6552
|
-
if (measured !== element.size.h) {
|
|
6553
|
-
this.deps.store.update(elementId, { size: { w: element.size.w, h: measured } });
|
|
6554
|
-
}
|
|
6555
|
-
}
|
|
6564
|
+
this.liveFitHeight(elementId);
|
|
6556
6565
|
}
|
|
6557
6566
|
onTapDown = (e) => {
|
|
6558
6567
|
this.tapDownX = e.clientX;
|
|
@@ -6688,6 +6697,7 @@ var Viewport = class {
|
|
|
6688
6697
|
placeholder: options.placeholder
|
|
6689
6698
|
});
|
|
6690
6699
|
this.noteEditor.setOnStop((id) => this.interactions.onTextEditStop(id));
|
|
6700
|
+
this.noteEditor.setOnInput((id) => this.interactions.liveFitHeight(id));
|
|
6691
6701
|
this.arrowLabelEditor = new ArrowLabelEditor();
|
|
6692
6702
|
this.noteEditor.setHistoryHooks(
|
|
6693
6703
|
() => this.historyRecorder.begin(),
|
|
@@ -9654,7 +9664,7 @@ var LaserTool = class {
|
|
|
9654
9664
|
};
|
|
9655
9665
|
|
|
9656
9666
|
// src/index.ts
|
|
9657
|
-
var VERSION = "0.40.
|
|
9667
|
+
var VERSION = "0.40.2";
|
|
9658
9668
|
export {
|
|
9659
9669
|
ArrowTool,
|
|
9660
9670
|
AutoSave,
|