stickyflow 0.5.0 → 0.6.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/binding/index.cjs +9 -9
  3. package/dist/binding/index.d.cts +4 -4
  4. package/dist/binding/index.d.ts +4 -4
  5. package/dist/binding/index.js +3 -3
  6. package/dist/{chunk-IEHE6WVN.js → chunk-4G2R7PEL.js} +319 -45
  7. package/dist/chunk-4G2R7PEL.js.map +1 -0
  8. package/dist/{chunk-L3VJXZFD.cjs → chunk-4LENHH6C.cjs} +15 -15
  9. package/dist/{chunk-L3VJXZFD.cjs.map → chunk-4LENHH6C.cjs.map} +1 -1
  10. package/dist/{chunk-LTGF5OHP.js → chunk-FVHVOJS2.js} +395 -89
  11. package/dist/chunk-FVHVOJS2.js.map +1 -0
  12. package/dist/{chunk-TWDLOXRM.cjs → chunk-JIJMZMGY.cjs} +18 -18
  13. package/dist/{chunk-TWDLOXRM.cjs.map → chunk-JIJMZMGY.cjs.map} +1 -1
  14. package/dist/{chunk-VK3T6O5Z.cjs → chunk-KTNCDNDB.cjs} +33 -33
  15. package/dist/{chunk-VK3T6O5Z.cjs.map → chunk-KTNCDNDB.cjs.map} +1 -1
  16. package/dist/{chunk-BODZN3ZI.js → chunk-MFNUJA26.js} +4 -4
  17. package/dist/{chunk-BODZN3ZI.js.map → chunk-MFNUJA26.js.map} +1 -1
  18. package/dist/{chunk-7VW2XKVB.js → chunk-ULQZ6CZW.js} +3 -3
  19. package/dist/{chunk-7VW2XKVB.js.map → chunk-ULQZ6CZW.js.map} +1 -1
  20. package/dist/{chunk-ZMLQIMJK.cjs → chunk-WQRT5PVT.cjs} +993 -687
  21. package/dist/chunk-WQRT5PVT.cjs.map +1 -0
  22. package/dist/{chunk-G7NRK5AG.js → chunk-WRDVNMFS.js} +5 -5
  23. package/dist/{chunk-G7NRK5AG.js.map → chunk-WRDVNMFS.js.map} +1 -1
  24. package/dist/{chunk-XY2GZUHC.cjs → chunk-XJ4W6TW4.cjs} +326 -44
  25. package/dist/chunk-XJ4W6TW4.cjs.map +1 -0
  26. package/dist/index.cjs +49 -29
  27. package/dist/index.d.cts +52 -7
  28. package/dist/index.d.ts +52 -7
  29. package/dist/index.js +5 -5
  30. package/dist/interaction/index.cjs +245 -235
  31. package/dist/interaction/index.cjs.map +1 -1
  32. package/dist/interaction/index.d.cts +3 -2
  33. package/dist/interaction/index.d.ts +3 -2
  34. package/dist/interaction/index.js +17 -7
  35. package/dist/interaction/index.js.map +1 -1
  36. package/dist/{render-CgX_y15a.d.ts → render-Db0eSz_s.d.cts} +36 -15
  37. package/dist/{render-CgX_y15a.d.cts → render-Db0eSz_s.d.ts} +36 -15
  38. package/dist/{runtime-reWgr7MP.d.cts → runtime-BhivvBeL.d.cts} +2 -2
  39. package/dist/{runtime-DnUxca3Y.d.ts → runtime-n2yG-_j-.d.ts} +2 -2
  40. package/dist/{runtimeTypes-D60w6nyF.d.cts → runtimeTypes-CrkMHvVi.d.cts} +2 -2
  41. package/dist/{runtimeTypes-CEBGueYM.d.ts → runtimeTypes-DnI7mRF5.d.ts} +2 -2
  42. package/dist/stickyflow-diagram.global.js +35 -35
  43. package/dist/stickyflow-diagram.global.js.map +1 -1
  44. package/dist/{types-DvhMpqrL.d.cts → types-BHfUKT4s.d.cts} +1 -1
  45. package/dist/{types-DYLC_lsk.d.ts → types-D4cH4f1a.d.ts} +1 -1
  46. package/dist/viewer/index.cjs +9 -9
  47. package/dist/viewer/index.d.cts +4 -4
  48. package/dist/viewer/index.d.ts +4 -4
  49. package/dist/viewer/index.js +4 -4
  50. package/dist/web-component/index.cjs +6 -6
  51. package/dist/web-component/index.d.cts +2 -2
  52. package/dist/web-component/index.d.ts +2 -2
  53. package/dist/web-component/index.js +4 -4
  54. package/package.json +1 -1
  55. package/dist/chunk-IEHE6WVN.js.map +0 -1
  56. package/dist/chunk-LTGF5OHP.js.map +0 -1
  57. package/dist/chunk-XY2GZUHC.cjs.map +0 -1
  58. package/dist/chunk-ZMLQIMJK.cjs.map +0 -1
@@ -82,6 +82,115 @@ function isometricFaces(object) {
82
82
  };
83
83
  }
84
84
 
85
+ // src/model/isometricObject/footprint.ts
86
+ function signedArea(points) {
87
+ let sum = 0;
88
+ for (let i = 0; i < points.length; i += 1) {
89
+ const [x1, y1] = points[i];
90
+ const [x2, y2] = points[(i + 1) % points.length];
91
+ sum += x1 * y2 - x2 * y1;
92
+ }
93
+ return sum / 2;
94
+ }
95
+ function cleanFootprint(points) {
96
+ const clean = (points ?? []).filter(
97
+ (point) => Array.isArray(point) && Number.isFinite(point[0]) && Number.isFinite(point[1])
98
+ );
99
+ const unique = clean.filter((point, index) => {
100
+ const next = clean[(index + 1) % clean.length];
101
+ return point[0] !== next[0] || point[1] !== next[1];
102
+ });
103
+ return unique.length >= 3 ? unique : [];
104
+ }
105
+ var ARC_STEP = Math.PI / 12;
106
+ function roundFootprint(points, radius, width, depth) {
107
+ if (!(radius > 0) || width <= 0 || depth <= 0) {
108
+ return [...points];
109
+ }
110
+ const world = points.map(([u, v]) => ({ x: u * width, y: v * depth }));
111
+ const rounded = [];
112
+ for (let i = 0; i < world.length; i += 1) {
113
+ const here = world[i];
114
+ const before = world[(i - 1 + world.length) % world.length];
115
+ const after = world[(i + 1) % world.length];
116
+ const a = { x: before.x - here.x, y: before.y - here.y };
117
+ const b = { x: after.x - here.x, y: after.y - here.y };
118
+ const lengthA = Math.hypot(a.x, a.y);
119
+ const lengthB = Math.hypot(b.x, b.y);
120
+ const cos = (a.x * b.x + a.y * b.y) / (lengthA * lengthB);
121
+ const angle = Math.acos(Math.max(-1, Math.min(1, cos)));
122
+ if (!Number.isFinite(angle) || angle < 1e-3 || Math.PI - angle < 1e-3) {
123
+ rounded.push(points[i]);
124
+ continue;
125
+ }
126
+ const reach = Math.min(radius / Math.tan(angle / 2), Math.min(lengthA, lengthB) / 2);
127
+ const effective = reach * Math.tan(angle / 2);
128
+ const unitA = { x: a.x / lengthA, y: a.y / lengthA };
129
+ const unitB = { x: b.x / lengthB, y: b.y / lengthB };
130
+ const from = { x: here.x + unitA.x * reach, y: here.y + unitA.y * reach };
131
+ const to = { x: here.x + unitB.x * reach, y: here.y + unitB.y * reach };
132
+ const bisector = { x: unitA.x + unitB.x, y: unitA.y + unitB.y };
133
+ const bisectorLength = Math.hypot(bisector.x, bisector.y);
134
+ const centerDistance = effective / Math.sin(angle / 2);
135
+ const center = {
136
+ x: here.x + bisector.x / bisectorLength * centerDistance,
137
+ y: here.y + bisector.y / bisectorLength * centerDistance
138
+ };
139
+ const start = Math.atan2(from.y - center.y, from.x - center.x);
140
+ let sweep = Math.atan2(to.y - center.y, to.x - center.x) - start;
141
+ sweep -= 2 * Math.PI * Math.round(sweep / (2 * Math.PI));
142
+ const steps = Math.max(2, Math.ceil(Math.abs(sweep) / ARC_STEP));
143
+ for (let step = 0; step <= steps; step += 1) {
144
+ const t = start + sweep * step / steps;
145
+ rounded.push([(center.x + effective * Math.cos(t)) / width, (center.y + effective * Math.sin(t)) / depth]);
146
+ }
147
+ }
148
+ return rounded;
149
+ }
150
+ function extrudeFootprint(frame, footprint, cornerRadius = 0) {
151
+ const width = Math.max(0, frame.width);
152
+ const depth = Math.max(0, frame.depth);
153
+ const height = Math.max(0, frame.height);
154
+ const points = roundFootprint(cleanFootprint(footprint), cornerRadius, width, depth);
155
+ const apexX = frame.x + depth * AXIS_COS;
156
+ const project = ([u, v], z) => ({
157
+ x: apexX + (u * width - v * depth) * AXIS_COS,
158
+ y: frame.y + (u * width + v * depth) * AXIS_SIN + z
159
+ });
160
+ const top = points.map((point) => project(point, 0));
161
+ const turn = signedArea(points) >= 0 ? 1 : -1;
162
+ const edges = points.map((from, i) => {
163
+ const to = points[(i + 1) % points.length];
164
+ const edgeU = (to[0] - from[0]) * width;
165
+ const edgeV = (to[1] - from[1]) * depth;
166
+ const length = Math.hypot(edgeU, edgeV);
167
+ const normalU = length === 0 ? 0 : edgeV / length * turn;
168
+ const normalV = length === 0 ? 0 : -edgeU / length * turn;
169
+ return { from, to, length, normalU, normalV, visible: length > 0 && normalU + normalV > 1e-9 };
170
+ });
171
+ const sameWay = (a, b) => {
172
+ return a.visible && b.visible && a.normalU * b.normalU + a.normalV * b.normalV > Math.cos(0.5);
173
+ };
174
+ const sides = [];
175
+ edges.forEach((edge, i) => {
176
+ if (!edge.visible) {
177
+ return;
178
+ }
179
+ const before = edges[(i - 1 + edges.length) % edges.length];
180
+ const after = edges[(i + 1) % edges.length];
181
+ const { from, to } = edge;
182
+ sides.push({
183
+ points: [project(from, 0), project(to, 0), project(to, height), project(from, height)],
184
+ light: 0.72 + 0.28 * Math.max(0, Math.min(1, edge.normalV / (Math.abs(edge.normalU) + Math.abs(edge.normalV)))),
185
+ depth: (from[0] + to[0]) / 2 + (from[1] + to[1]) / 2,
186
+ smoothStart: sameWay(before, edge),
187
+ smoothEnd: sameWay(edge, after)
188
+ });
189
+ });
190
+ sides.sort((a, b) => a.depth - b.depth);
191
+ return { top, sides };
192
+ }
193
+
85
194
  // src/model/isometricObject/shading.ts
86
195
  function clamp255(value) {
87
196
  return Math.max(0, Math.min(255, Math.round(value)));
@@ -105,6 +214,9 @@ function multiply(hex, factor) {
105
214
  const [r, g, b] = rgb;
106
215
  return rgbToHex(r * factor, g * factor, b * factor);
107
216
  }
217
+ function shadeFill(fill, factor) {
218
+ return multiply(fill, factor);
219
+ }
108
220
  function deriveFaceFills(fill) {
109
221
  return {
110
222
  topFill: fill,
@@ -113,6 +225,102 @@ function deriveFaceFills(fill) {
113
225
  };
114
226
  }
115
227
 
228
+ // src/model/path/curve.ts
229
+ var SAMPLES_PER_SEGMENT = 8;
230
+ function pointTension(curve, point) {
231
+ return Math.max(0, point.tension ?? curve.tension);
232
+ }
233
+ function isStraight(curve) {
234
+ return curve.points.length < 3 || curve.points.every((point) => pointTension(curve, point) <= 0);
235
+ }
236
+ function pointAt(curve, index) {
237
+ const { points } = curve;
238
+ if (curve.closed) {
239
+ return points[(index + points.length) % points.length];
240
+ }
241
+ return points[Math.max(0, Math.min(points.length - 1, index))];
242
+ }
243
+ function pathSegments(curve) {
244
+ const count = curve.closed ? curve.points.length : curve.points.length - 1;
245
+ return Array.from({ length: Math.max(0, count) }, (_, index) => {
246
+ const previous = pointAt(curve, index - 1);
247
+ const from = pointAt(curve, index);
248
+ const to = pointAt(curve, index + 1);
249
+ const next = pointAt(curve, index + 2);
250
+ const fromFactor = pointTension(curve, from) / 6;
251
+ const toFactor = pointTension(curve, to) / 6;
252
+ if (fromFactor === 0 && toFactor === 0) {
253
+ return { from, to, controls: null };
254
+ }
255
+ const first = { x: from.x + (to.x - previous.x) * fromFactor, y: from.y + (to.y - previous.y) * fromFactor };
256
+ const second = { x: to.x - (next.x - from.x) * toFactor, y: to.y - (next.y - from.y) * toFactor };
257
+ return { from, to, controls: [first, second] };
258
+ });
259
+ }
260
+ function bezierAt(segment, t) {
261
+ const { from, to, controls } = segment;
262
+ const u = 1 - t;
263
+ const weights = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
264
+ const anchors = [from, controls[0], controls[1], to];
265
+ return {
266
+ x: anchors.reduce((sum, anchor, i) => sum + anchor.x * weights[i], 0),
267
+ y: anchors.reduce((sum, anchor, i) => sum + anchor.y * weights[i], 0)
268
+ };
269
+ }
270
+ function flattenPath(curve, samples = SAMPLES_PER_SEGMENT) {
271
+ if (isStraight(curve)) {
272
+ return curve.points.map((point) => ({ x: point.x, y: point.y }));
273
+ }
274
+ const flat = [];
275
+ const segments = pathSegments(curve);
276
+ segments.forEach((segment) => {
277
+ flat.push({ x: segment.from.x, y: segment.from.y });
278
+ if (segment.controls) {
279
+ const curved = { ...segment, controls: segment.controls };
280
+ for (let step = 1; step < samples; step++) {
281
+ flat.push(bezierAt(curved, step / samples));
282
+ }
283
+ }
284
+ });
285
+ const last = segments[segments.length - 1];
286
+ if (!curve.closed && last) {
287
+ flat.push({ x: last.to.x, y: last.to.y });
288
+ }
289
+ return flat;
290
+ }
291
+
292
+ // src/model/path/symbol.ts
293
+ function pathBounds(points) {
294
+ const xs = points.map((point) => point.x);
295
+ const ys = points.map((point) => point.y);
296
+ const x = Math.min(...xs);
297
+ const y = Math.min(...ys);
298
+ return { x, y, width: Math.max(...xs) - x, height: Math.max(...ys) - y };
299
+ }
300
+ var round = (value) => Math.round(value * 1e4) / 1e4;
301
+ function pathToSymbol(points) {
302
+ if (points.length === 0) {
303
+ return { points: [], width: 0, height: 0 };
304
+ }
305
+ const frame = pathBounds(points);
306
+ const unit = (value, size) => size === 0 ? 0 : round(value / size);
307
+ return {
308
+ width: frame.width,
309
+ height: frame.height,
310
+ points: points.map((point) => {
311
+ const x = unit(point.x - frame.x, frame.width);
312
+ const y = unit(point.y - frame.y, frame.height);
313
+ return point.tension === void 0 ? [x, y] : [x, y, point.tension];
314
+ })
315
+ };
316
+ }
317
+ function symbolToPath(points, frame) {
318
+ return points.map((point) => {
319
+ const placed = { x: frame.x + point[0] * frame.width, y: frame.y + point[1] * frame.height };
320
+ return point[2] === void 0 ? placed : { ...placed, tension: point[2] };
321
+ });
322
+ }
323
+
116
324
  // src/model/component/supportedTypes.ts
117
325
  var BUILT_IN_COMPONENT_TYPES = ["rollingNumber", "tickScale", "ruler"];
118
326
  function isBuiltInComponentType(value) {
@@ -691,6 +899,7 @@ var NAMED_BLOCK_KINDS = [
691
899
  "Shape",
692
900
  "Text",
693
901
  "Isometric",
902
+ "Dimension",
694
903
  "Link",
695
904
  "Connection",
696
905
  "Layout",
@@ -1464,6 +1673,11 @@ function isChartObject(canvasObject) {
1464
1673
  return canvasObject.objectType === "chart" && canvasObject.chart !== void 0;
1465
1674
  }
1466
1675
 
1676
+ // src/sflSemantic/canvasObjects/artifacts/dimension/types.ts
1677
+ function isDimensionObject(canvasObject) {
1678
+ return canvasObject.objectType === "dimension" && canvasObject.dimension !== void 0;
1679
+ }
1680
+
1467
1681
  // src/sflSemantic/canvasObjects/artifacts/isometric/types.ts
1468
1682
  function isIsometricObject(canvasObject) {
1469
1683
  return canvasObject.objectType === "isometric" && canvasObject.isometric !== void 0;
@@ -1601,7 +1815,8 @@ var CANVAS_OBJECT_BLOCK_KINDS = [
1601
1815
  "Chart",
1602
1816
  "Widget",
1603
1817
  "Component",
1604
- "Isometric"
1818
+ "Isometric",
1819
+ "Dimension"
1605
1820
  ];
1606
1821
  var canvasObjectBlockKinds = new Set(CANVAS_OBJECT_BLOCK_KINDS);
1607
1822
  function isCanvasObjectBlockKind(kind) {
@@ -2007,21 +2222,77 @@ function resolveChartObject(base, block2, properties, symbolDefinitions, mergedP
2007
2222
  };
2008
2223
  }
2009
2224
 
2225
+ // src/sflSemantic/canvasObjects/artifacts/dimension/reader.ts
2226
+ function readPoint(value, origin) {
2227
+ const [x, y] = tupleValues(value) ?? [];
2228
+ return { x: origin.x + (x ?? 0), y: origin.y + (y ?? 0) };
2229
+ }
2230
+ function readDimension(properties, origin) {
2231
+ return {
2232
+ start: readPoint(properties.get("start"), origin),
2233
+ end: readPoint(properties.get("end"), origin),
2234
+ offset: asNumber(properties.get("offset")) ?? 0,
2235
+ unit: asString(properties.get("unit"))
2236
+ };
2237
+ }
2238
+
2239
+ // src/sflSemantic/canvasObjects/artifacts/dimension/resolver.ts
2240
+ function resolveDimensionObject(base, properties, origin) {
2241
+ return {
2242
+ ...base,
2243
+ objectType: "dimension",
2244
+ dimension: readDimension(properties, origin)
2245
+ };
2246
+ }
2247
+
2010
2248
  // src/sflSemantic/canvasObjects/artifacts/isometric/reader.ts
2011
- function readIsometric(properties, depth) {
2249
+ function readFootprintPoint(value) {
2250
+ if (value.type !== "list" || value.values.length < 2) {
2251
+ return [];
2252
+ }
2253
+ const x = asNumber(value.values[0]);
2254
+ const y = asNumber(value.values[1]);
2255
+ const tension = value.values[2] === void 0 ? void 0 : asNumber(value.values[2]);
2256
+ if (x === void 0 || y === void 0) {
2257
+ return [];
2258
+ }
2259
+ return [tension === void 0 ? { x, y } : { x, y, tension }];
2260
+ }
2261
+ function asPolygon(points, tension) {
2262
+ const flat = flattenPath({ points, tension, closed: true });
2263
+ return flat.length >= 3 ? flat.map((point) => [point.x, point.y]) : void 0;
2264
+ }
2265
+ function readFootprint(value, symbolDefs) {
2266
+ if (value?.type === "list") {
2267
+ return asPolygon(value.values.flatMap(readFootprintPoint), 0);
2268
+ }
2269
+ const name = asString(value);
2270
+ const definition = name ? symbolDefs.get(name) : void 0;
2271
+ if (!definition) {
2272
+ return void 0;
2273
+ }
2274
+ const points = definition.points.map(([x, y], index) => {
2275
+ const tension = definition.pointTensions?.[index];
2276
+ return tension === void 0 ? { x, y } : { x, y, tension };
2277
+ });
2278
+ return asPolygon(points, definition.tension ?? 0);
2279
+ }
2280
+ function readIsometric(properties, depth, symbolDefs) {
2012
2281
  return {
2013
2282
  depth,
2014
- icon: asString(properties.get("icon"))
2283
+ icon: asString(properties.get("icon")),
2284
+ footprint: readFootprint(properties.get("symbol"), symbolDefs),
2285
+ form: asString(properties.get("shape")) === "sphere" ? "sphere" : "box"
2015
2286
  };
2016
2287
  }
2017
2288
 
2018
2289
  // src/sflSemantic/canvasObjects/artifacts/isometric/resolver.ts
2019
- function resolveIsometricObject(base, block2, properties, layoutProperty) {
2290
+ function resolveIsometricObject(base, block2, properties, layoutProperty, symbolDefinitions) {
2020
2291
  const size = tupleValues(layoutProperty(block2, "size"));
2021
2292
  return {
2022
2293
  ...base,
2023
2294
  objectType: "isometric",
2024
- isometric: readIsometric(properties, size?.[2] ?? 24)
2295
+ isometric: readIsometric(properties, size?.[2] ?? 24, symbolDefinitions)
2025
2296
  };
2026
2297
  }
2027
2298
 
@@ -2034,7 +2305,12 @@ function readPath(p, origin) {
2034
2305
  }
2035
2306
  const x = asNumber(value.values[0]);
2036
2307
  const y = asNumber(value.values[1]);
2037
- return x !== void 0 && y !== void 0 ? [{ x: origin.x + x, y: origin.y + y }] : [];
2308
+ const tension = value.values[2] === void 0 ? void 0 : asNumber(value.values[2]);
2309
+ if (x === void 0 || y === void 0) {
2310
+ return [];
2311
+ }
2312
+ const point = { x: origin.x + x, y: origin.y + y };
2313
+ return [tension === void 0 ? point : { ...point, tension }];
2038
2314
  }) : [];
2039
2315
  return {
2040
2316
  points,
@@ -2101,6 +2377,9 @@ function declaredCanvasObjectKind(block2, properties) {
2101
2377
  if (block2.kind === "Isometric") {
2102
2378
  return "isometric";
2103
2379
  }
2380
+ if (block2.kind === "Dimension") {
2381
+ return "dimension";
2382
+ }
2104
2383
  return asString(properties.get("kind")) ?? "";
2105
2384
  }
2106
2385
  function canvasObjectTypeForKind(kind) {
@@ -2122,6 +2401,9 @@ function canvasObjectTypeForKind(kind) {
2122
2401
  if (kind === "isometric") {
2123
2402
  return "isometric";
2124
2403
  }
2404
+ if (kind === "dimension") {
2405
+ return "dimension";
2406
+ }
2125
2407
  return "shape";
2126
2408
  }
2127
2409
  function classifyCanvasObject(block2, properties, symbolDefinitions) {
@@ -2184,9 +2466,11 @@ function resolveCanvasObject(block2, origin, context, frameId, positionOverride)
2184
2466
  case "chart":
2185
2467
  return resolveChartObject(base, block2, properties, symbolDefs, mergedProps);
2186
2468
  case "isometric":
2187
- return resolveIsometricObject(base, block2, properties, layoutProp);
2469
+ return resolveIsometricObject(base, block2, properties, layoutProp, symbolDefs);
2188
2470
  case "path":
2189
2471
  return resolvePathObject(base, properties, origin);
2472
+ case "dimension":
2473
+ return resolveDimensionObject(base, properties, origin);
2190
2474
  case "swimlane":
2191
2475
  return resolveSwimlaneObject(base, properties);
2192
2476
  case "frame":
@@ -2342,17 +2626,24 @@ function readShaderDefinition(block2) {
2342
2626
  // src/sflSemantic/definitions/symbols.ts
2343
2627
  function readSymbolPoints(block2) {
2344
2628
  const value = directProperties(block2).get("points");
2629
+ const points = [];
2630
+ const tensions = [];
2345
2631
  if (value?.type !== "list") {
2346
- return [];
2632
+ return { points, tensions };
2347
2633
  }
2348
- return value.values.flatMap((item) => {
2634
+ for (const item of value.values) {
2349
2635
  if (item.type !== "list" || item.values.length < 2) {
2350
- return [];
2636
+ continue;
2351
2637
  }
2352
2638
  const x = asNumber(item.values[0]);
2353
2639
  const y = asNumber(item.values[1]);
2354
- return x === void 0 || y === void 0 ? [] : [[x, y]];
2355
- });
2640
+ if (x === void 0 || y === void 0) {
2641
+ continue;
2642
+ }
2643
+ points.push([x, y]);
2644
+ tensions.push(item.values[2] === void 0 ? void 0 : asNumber(item.values[2]));
2645
+ }
2646
+ return { points, tensions };
2356
2647
  }
2357
2648
  function readSymbolPorts(block2) {
2358
2649
  const ports = childBlocks(block2).filter((child) => child.kind === "Port").flatMap((port) => {
@@ -2365,13 +2656,14 @@ function readSymbolPorts(block2) {
2365
2656
  return ports.length > 0 ? ports : void 0;
2366
2657
  }
2367
2658
  function readSymbolDefinition(block2) {
2368
- const points = readSymbolPoints(block2);
2659
+ const { points, tensions } = readSymbolPoints(block2);
2369
2660
  if (points.length < 2) {
2370
2661
  return void 0;
2371
2662
  }
2372
2663
  return {
2373
2664
  name: block2.name,
2374
2665
  points,
2666
+ pointTensions: tensions.some((tension) => tension !== void 0) ? tensions : void 0,
2375
2667
  tension: asNumber(directProperties(block2).get("tension")),
2376
2668
  ports: readSymbolPorts(block2)
2377
2669
  };
@@ -2912,43 +3204,25 @@ function freeformPathData(geometry) {
2912
3204
  if (geometry.points.length === 0) {
2913
3205
  return "";
2914
3206
  }
2915
- if (geometry.points.length < 3 || geometry.tension <= 0) {
3207
+ if (isStraight(geometry)) {
2916
3208
  return linearPathData(geometry);
2917
3209
  }
2918
- return smoothPathData(geometry);
2919
- }
2920
- function linearPathData(geometry) {
2921
- const [first, ...remaining] = geometry.points;
2922
- const segments = remaining.map((point) => `L ${point.x} ${point.y}`).join(" ");
2923
- return `M ${first.x} ${first.y} ${segments}${geometry.closed ? " Z" : ""}`;
2924
- }
2925
- function smoothPathData(geometry) {
2926
3210
  const first = geometry.points[0];
2927
- const segmentCount = geometry.closed ? geometry.points.length : geometry.points.length - 1;
2928
3211
  const commands = [`M ${first.x} ${first.y}`];
2929
- for (let index = 0; index < segmentCount; index++) {
2930
- commands.push(curveSegmentCommand(geometry, index));
3212
+ for (const { to, controls } of pathSegments(geometry)) {
3213
+ commands.push(
3214
+ controls ? `C ${controls[0].x} ${controls[0].y} ${controls[1].x} ${controls[1].y} ${to.x} ${to.y}` : `L ${to.x} ${to.y}`
3215
+ );
2931
3216
  }
2932
3217
  if (geometry.closed) {
2933
3218
  commands.push("Z");
2934
3219
  }
2935
3220
  return commands.join(" ");
2936
3221
  }
2937
- function curveSegmentCommand(geometry, index) {
2938
- const previous = freeformPointAt(geometry, index - 1);
2939
- const start = freeformPointAt(geometry, index);
2940
- const end = freeformPointAt(geometry, index + 1);
2941
- const next = freeformPointAt(geometry, index + 2);
2942
- const factor = geometry.tension / 6;
2943
- const firstControl = { x: start.x + (end.x - previous.x) * factor, y: start.y + (end.y - previous.y) * factor };
2944
- const secondControl = { x: end.x - (next.x - start.x) * factor, y: end.y - (next.y - start.y) * factor };
2945
- return `C ${firstControl.x} ${firstControl.y} ${secondControl.x} ${secondControl.y} ${end.x} ${end.y}`;
2946
- }
2947
- function freeformPointAt(geometry, index) {
2948
- if (geometry.closed) {
2949
- return geometry.points[(index + geometry.points.length) % geometry.points.length];
2950
- }
2951
- return geometry.points[Math.max(0, Math.min(geometry.points.length - 1, index))];
3222
+ function linearPathData(geometry) {
3223
+ const [first, ...remaining] = geometry.points;
3224
+ const segments = remaining.map((point) => `L ${point.x} ${point.y}`).join(" ");
3225
+ return `M ${first.x} ${first.y} ${segments}${geometry.closed ? " Z" : ""}`;
2952
3226
  }
2953
3227
 
2954
3228
  // src/renderScene/charts/primitives/radarShape.ts
@@ -3447,8 +3721,8 @@ function createRoundedCorner(previous, corner, next, maximumRadius) {
3447
3721
  const outgoing = { x: next.x - corner.x, y: next.y - corner.y };
3448
3722
  const incomingIsAxisAligned = incoming.x === 0 || incoming.y === 0;
3449
3723
  const outgoingIsAxisAligned = outgoing.x === 0 || outgoing.y === 0;
3450
- const isStraight = incoming.x === 0 && outgoing.x === 0 || incoming.y === 0 && outgoing.y === 0;
3451
- if (!incomingIsAxisAligned || !outgoingIsAxisAligned || isStraight) {
3724
+ const isStraight2 = incoming.x === 0 && outgoing.x === 0 || incoming.y === 0 && outgoing.y === 0;
3725
+ if (!incomingIsAxisAligned || !outgoingIsAxisAligned || isStraight2) {
3452
3726
  return null;
3453
3727
  }
3454
3728
  const radius = Math.min(maximumRadius, axisLength(incoming) * 0.4, axisLength(outgoing) * 0.4);
@@ -4912,6 +5186,7 @@ exports.canonicalizeSource = canonicalizeSource;
4912
5186
  exports.categoryProp = categoryProp;
4913
5187
  exports.chartText = chartText;
4914
5188
  exports.chartTicks = chartTicks;
5189
+ exports.cleanFootprint = cleanFootprint;
4915
5190
  exports.clipSegmentToRect = clipSegmentToRect;
4916
5191
  exports.colorWithAlpha = colorWithAlpha;
4917
5192
  exports.componentRegistryVersion = componentRegistryVersion;
@@ -4927,7 +5202,9 @@ exports.elementCenter = elementCenter;
4927
5202
  exports.ellipsizeToWidth = ellipsizeToWidth;
4928
5203
  exports.errorBarRange = errorBarRange;
4929
5204
  exports.estimateTextWidth = estimateTextWidth;
5205
+ exports.extrudeFootprint = extrudeFootprint;
4930
5206
  exports.finite = finite;
5207
+ exports.flattenPath = flattenPath;
4931
5208
  exports.formatBarLabel = formatBarLabel;
4932
5209
  exports.formatFieldValue = formatFieldValue;
4933
5210
  exports.formatRollingNumber = formatRollingNumber;
@@ -4940,6 +5217,7 @@ exports.horizontalRows = horizontalRows;
4940
5217
  exports.interpolateHexColorStops = interpolateHexColorStops;
4941
5218
  exports.isBuiltInComponentType = isBuiltInComponentType;
4942
5219
  exports.isChartObject = isChartObject;
5220
+ exports.isDimensionObject = isDimensionObject;
4943
5221
  exports.isGenericComponent = isGenericComponent;
4944
5222
  exports.isHorizontalBar = isHorizontalBar;
4945
5223
  exports.isIsometricObject = isIsometricObject;
@@ -4959,6 +5237,8 @@ exports.maxApexCornerRadius = maxApexCornerRadius;
4959
5237
  exports.maxPieCornerRadius = maxPieCornerRadius;
4960
5238
  exports.paint = paint;
4961
5239
  exports.parseSource = parseSource;
5240
+ exports.pathBounds = pathBounds;
5241
+ exports.pathToSymbol = pathToSymbol;
4962
5242
  exports.personLabelArea = personLabelArea;
4963
5243
  exports.pieApexRadius = pieApexRadius;
4964
5244
  exports.pieArcPoint = pieArcPoint;
@@ -4999,13 +5279,15 @@ exports.seriesLabelProp = seriesLabelProp;
4999
5279
  exports.seriesValueColorProp = seriesValueColorProp;
5000
5280
  exports.seriesValueProp = seriesValueProp;
5001
5281
  exports.sflToCanvasState = sflToCanvasState;
5282
+ exports.shadeFill = shadeFill;
5002
5283
  exports.stackRank = stackRank;
5003
5284
  exports.stackSequence = stackSequence;
5004
5285
  exports.stackedSegment = stackedSegment;
5286
+ exports.symbolToPath = symbolToPath;
5005
5287
  exports.tag = tag;
5006
5288
  exports.tokenizeSource = tokenizeSource;
5007
5289
  exports.topRoundedRectPath = topRoundedRectPath;
5008
5290
  exports.wrapText = wrapText;
5009
5291
  exports.zoneColorAtValue = zoneColorAtValue;
5010
- //# sourceMappingURL=chunk-XY2GZUHC.cjs.map
5011
- //# sourceMappingURL=chunk-XY2GZUHC.cjs.map
5292
+ //# sourceMappingURL=chunk-XJ4W6TW4.cjs.map
5293
+ //# sourceMappingURL=chunk-XJ4W6TW4.cjs.map