@fieldnotes/core 0.40.4 → 0.41.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 +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +31 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2753,6 +2753,16 @@ function updateBoundArrow(arrow, store) {
|
|
|
2753
2753
|
var ARROWHEAD_LENGTH = 12;
|
|
2754
2754
|
var ARROWHEAD_ANGLE = Math.PI / 6;
|
|
2755
2755
|
var ARROW_LABEL_FONT_SIZE = 14;
|
|
2756
|
+
function getArrowDashPattern(strokeStyle) {
|
|
2757
|
+
switch (strokeStyle) {
|
|
2758
|
+
case "dashed":
|
|
2759
|
+
return [8, 4];
|
|
2760
|
+
case "dotted":
|
|
2761
|
+
return [2, 4];
|
|
2762
|
+
default:
|
|
2763
|
+
return [];
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2756
2766
|
function renderArrow(ctx, arrow, store, labelEditingId) {
|
|
2757
2767
|
const geometry = getArrowRenderGeometry(arrow);
|
|
2758
2768
|
const { visualFrom, visualTo } = getVisualEndpoints(arrow, geometry, store);
|
|
@@ -2760,9 +2770,8 @@ function renderArrow(ctx, arrow, store, labelEditingId) {
|
|
|
2760
2770
|
ctx.strokeStyle = arrow.color;
|
|
2761
2771
|
ctx.lineWidth = arrow.width;
|
|
2762
2772
|
ctx.lineCap = "round";
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
}
|
|
2773
|
+
const dash = getArrowDashPattern(arrow.strokeStyle);
|
|
2774
|
+
if (dash.length > 0) ctx.setLineDash(dash);
|
|
2766
2775
|
ctx.beginPath();
|
|
2767
2776
|
ctx.moveTo(visualFrom.x, visualFrom.y);
|
|
2768
2777
|
if (arrow.bend !== 0) {
|
|
@@ -3682,6 +3691,7 @@ function createArrow(input) {
|
|
|
3682
3691
|
if (input.fromBinding) result.fromBinding = input.fromBinding;
|
|
3683
3692
|
if (input.toBinding) result.toBinding = input.toBinding;
|
|
3684
3693
|
if (input.label !== void 0) result.label = input.label;
|
|
3694
|
+
if (input.strokeStyle !== void 0) result.strokeStyle = input.strokeStyle;
|
|
3685
3695
|
return result;
|
|
3686
3696
|
}
|
|
3687
3697
|
function createImage(input) {
|
|
@@ -5085,7 +5095,8 @@ function emitArrow(arrow, store) {
|
|
|
5085
5095
|
} else {
|
|
5086
5096
|
d = `M${n(from.x)} ${n(from.y)} L${n(to.x)} ${n(to.y)}`;
|
|
5087
5097
|
}
|
|
5088
|
-
const
|
|
5098
|
+
const pattern = getArrowDashPattern(arrow.strokeStyle);
|
|
5099
|
+
const dash = pattern.length > 0 ? ` stroke-dasharray="${pattern.join(" ")}"` : "";
|
|
5089
5100
|
let out = `<path d="${d}" fill="none" stroke="${esc(arrow.color)}" stroke-width="${n(arrow.width)}" stroke-linecap="round"${dash} />`;
|
|
5090
5101
|
const angle = geometry.tangentEnd;
|
|
5091
5102
|
const p1x = to.x - ARROWHEAD_LENGTH2 * Math.cos(angle - ARROWHEAD_ANGLE2);
|
|
@@ -6289,7 +6300,7 @@ function translateElementPatch(el, dx, dy) {
|
|
|
6289
6300
|
|
|
6290
6301
|
// src/elements/element-style.ts
|
|
6291
6302
|
function styleToPatch(element, style) {
|
|
6292
|
-
const { color, fillColor, strokeWidth, opacity, fontSize } = style;
|
|
6303
|
+
const { color, fillColor, strokeWidth, opacity, fontSize, strokeStyle } = style;
|
|
6293
6304
|
switch (element.type) {
|
|
6294
6305
|
case "stroke":
|
|
6295
6306
|
return {
|
|
@@ -6300,7 +6311,8 @@ function styleToPatch(element, style) {
|
|
|
6300
6311
|
case "arrow":
|
|
6301
6312
|
return {
|
|
6302
6313
|
...color !== void 0 ? { color } : {},
|
|
6303
|
-
...strokeWidth !== void 0 ? { width: strokeWidth } : {}
|
|
6314
|
+
...strokeWidth !== void 0 ? { width: strokeWidth } : {},
|
|
6315
|
+
...strokeStyle !== void 0 ? { strokeStyle } : {}
|
|
6304
6316
|
};
|
|
6305
6317
|
case "shape":
|
|
6306
6318
|
return {
|
|
@@ -6341,7 +6353,11 @@ function getElementStyle(element) {
|
|
|
6341
6353
|
case "stroke":
|
|
6342
6354
|
return { color: element.color, strokeWidth: element.width, opacity: element.opacity };
|
|
6343
6355
|
case "arrow":
|
|
6344
|
-
return {
|
|
6356
|
+
return {
|
|
6357
|
+
color: element.color,
|
|
6358
|
+
strokeWidth: element.width,
|
|
6359
|
+
...element.strokeStyle !== void 0 ? { strokeStyle: element.strokeStyle } : {}
|
|
6360
|
+
};
|
|
6345
6361
|
case "shape":
|
|
6346
6362
|
return {
|
|
6347
6363
|
color: element.strokeColor,
|
|
@@ -6415,6 +6431,8 @@ var SelectionOps = class {
|
|
|
6415
6431
|
if (opacity !== void 0) result.opacity = opacity;
|
|
6416
6432
|
const fontSize = sharedValue(styles.map((s) => s.fontSize));
|
|
6417
6433
|
if (fontSize !== void 0) result.fontSize = fontSize;
|
|
6434
|
+
const strokeStyle = sharedValue(styles.map((s) => s.strokeStyle));
|
|
6435
|
+
if (strokeStyle !== void 0) result.strokeStyle = strokeStyle;
|
|
6418
6436
|
return result;
|
|
6419
6437
|
}
|
|
6420
6438
|
applyStyle(style) {
|
|
@@ -8832,6 +8850,7 @@ var ArrowTool = class {
|
|
|
8832
8850
|
end = { x: 0, y: 0 };
|
|
8833
8851
|
color;
|
|
8834
8852
|
width;
|
|
8853
|
+
strokeStyle;
|
|
8835
8854
|
fromBinding;
|
|
8836
8855
|
fromTarget = null;
|
|
8837
8856
|
toTarget = null;
|
|
@@ -8839,9 +8858,10 @@ var ArrowTool = class {
|
|
|
8839
8858
|
constructor(options = {}) {
|
|
8840
8859
|
this.color = options.color ?? "#000000";
|
|
8841
8860
|
this.width = options.width ?? 2;
|
|
8861
|
+
this.strokeStyle = options.strokeStyle ?? "solid";
|
|
8842
8862
|
}
|
|
8843
8863
|
getOptions() {
|
|
8844
|
-
return { color: this.color, width: this.width };
|
|
8864
|
+
return { color: this.color, width: this.width, strokeStyle: this.strokeStyle };
|
|
8845
8865
|
}
|
|
8846
8866
|
onOptionsChange(listener) {
|
|
8847
8867
|
this.optionListeners.add(listener);
|
|
@@ -8850,6 +8870,7 @@ var ArrowTool = class {
|
|
|
8850
8870
|
setOptions(options) {
|
|
8851
8871
|
if (options.color !== void 0) this.color = options.color;
|
|
8852
8872
|
if (options.width !== void 0) this.width = options.width;
|
|
8873
|
+
if (options.strokeStyle !== void 0) this.strokeStyle = options.strokeStyle;
|
|
8853
8874
|
this.notifyOptionsChange();
|
|
8854
8875
|
}
|
|
8855
8876
|
notifyOptionsChange() {
|
|
@@ -8909,6 +8930,7 @@ var ArrowTool = class {
|
|
|
8909
8930
|
position: this.start,
|
|
8910
8931
|
color: this.color,
|
|
8911
8932
|
width: this.width,
|
|
8933
|
+
strokeStyle: this.strokeStyle,
|
|
8912
8934
|
fromBinding: this.fromBinding,
|
|
8913
8935
|
toBinding: this.toTarget ? { elementId: this.toTarget.id } : void 0,
|
|
8914
8936
|
layerId: ctx.activeLayerId ?? ""
|
|
@@ -9776,7 +9798,7 @@ var LaserTool = class {
|
|
|
9776
9798
|
};
|
|
9777
9799
|
|
|
9778
9800
|
// src/index.ts
|
|
9779
|
-
var VERSION = "0.
|
|
9801
|
+
var VERSION = "0.41.0";
|
|
9780
9802
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9781
9803
|
0 && (module.exports = {
|
|
9782
9804
|
ArrowTool,
|