stickyflow 0.5.0 → 0.7.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/CHANGELOG.md +43 -0
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +4 -4
- package/dist/binding/index.d.ts +4 -4
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-ZMLQIMJK.cjs → chunk-A73UJ5AQ.cjs} +1537 -738
- package/dist/chunk-A73UJ5AQ.cjs.map +1 -0
- package/dist/{chunk-VK3T6O5Z.cjs → chunk-BUOWM3LC.cjs} +745 -62
- package/dist/chunk-BUOWM3LC.cjs.map +1 -0
- package/dist/{chunk-L3VJXZFD.cjs → chunk-EKAWJFJQ.cjs} +15 -15
- package/dist/{chunk-L3VJXZFD.cjs.map → chunk-EKAWJFJQ.cjs.map} +1 -1
- package/dist/{chunk-BODZN3ZI.js → chunk-JCRPLPKV.js} +156 -23
- package/dist/chunk-JCRPLPKV.js.map +1 -0
- package/dist/{chunk-IEHE6WVN.js → chunk-JQK4IGXJ.js} +489 -51
- package/dist/chunk-JQK4IGXJ.js.map +1 -0
- package/dist/{chunk-XY2GZUHC.cjs → chunk-KXYSO6GC.cjs} +498 -50
- package/dist/chunk-KXYSO6GC.cjs.map +1 -0
- package/dist/{chunk-G7NRK5AG.js → chunk-MUKIGLR5.js} +717 -34
- package/dist/chunk-MUKIGLR5.js.map +1 -0
- package/dist/{chunk-TWDLOXRM.cjs → chunk-OWNVXKXN.cjs} +170 -37
- package/dist/chunk-OWNVXKXN.cjs.map +1 -0
- package/dist/{chunk-LTGF5OHP.js → chunk-SDMQRSRW.js} +941 -143
- package/dist/chunk-SDMQRSRW.js.map +1 -0
- package/dist/{chunk-7VW2XKVB.js → chunk-ZNHYW47T.js} +3 -3
- package/dist/{chunk-7VW2XKVB.js.map → chunk-ZNHYW47T.js.map} +1 -1
- package/dist/index.cjs +57 -29
- package/dist/index.d.cts +80 -7
- package/dist/index.d.ts +80 -7
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +245 -235
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +3 -2
- package/dist/interaction/index.d.ts +3 -2
- package/dist/interaction/index.js +17 -7
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-CgX_y15a.d.ts → render-BU2uYzjG.d.cts} +40 -16
- package/dist/{render-CgX_y15a.d.cts → render-BU2uYzjG.d.ts} +40 -16
- package/dist/{runtime-reWgr7MP.d.cts → runtime-B7KiTmn8.d.cts} +2 -2
- package/dist/{runtime-DnUxca3Y.d.ts → runtime-BPzyD-Nd.d.ts} +2 -2
- package/dist/{runtimeTypes-D60w6nyF.d.cts → runtimeTypes-BIP70z72.d.cts} +3 -2
- package/dist/{runtimeTypes-CEBGueYM.d.ts → runtimeTypes-DalvhScn.d.ts} +3 -2
- package/dist/stickyflow-diagram.global.js +387 -36
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-DYLC_lsk.d.ts → types-DMWs27Hn.d.ts} +1 -1
- package/dist/{types-DvhMpqrL.d.cts → types-D_2NZ6lL.d.cts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +5 -4
- package/dist/viewer/index.d.ts +5 -4
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.d.cts +2 -2
- package/dist/web-component/index.d.ts +2 -2
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-BODZN3ZI.js.map +0 -1
- package/dist/chunk-G7NRK5AG.js.map +0 -1
- package/dist/chunk-IEHE6WVN.js.map +0 -1
- package/dist/chunk-LTGF5OHP.js.map +0 -1
- package/dist/chunk-TWDLOXRM.cjs.map +0 -1
- package/dist/chunk-VK3T6O5Z.cjs.map +0 -1
- package/dist/chunk-XY2GZUHC.cjs.map +0 -1
- package/dist/chunk-ZMLQIMJK.cjs.map +0 -1
|
@@ -80,6 +80,115 @@ function isometricFaces(object) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// src/model/isometricObject/footprint.ts
|
|
84
|
+
function signedArea(points) {
|
|
85
|
+
let sum = 0;
|
|
86
|
+
for (let i = 0; i < points.length; i += 1) {
|
|
87
|
+
const [x1, y1] = points[i];
|
|
88
|
+
const [x2, y2] = points[(i + 1) % points.length];
|
|
89
|
+
sum += x1 * y2 - x2 * y1;
|
|
90
|
+
}
|
|
91
|
+
return sum / 2;
|
|
92
|
+
}
|
|
93
|
+
function cleanFootprint(points) {
|
|
94
|
+
const clean = (points ?? []).filter(
|
|
95
|
+
(point) => Array.isArray(point) && Number.isFinite(point[0]) && Number.isFinite(point[1])
|
|
96
|
+
);
|
|
97
|
+
const unique = clean.filter((point, index) => {
|
|
98
|
+
const next = clean[(index + 1) % clean.length];
|
|
99
|
+
return point[0] !== next[0] || point[1] !== next[1];
|
|
100
|
+
});
|
|
101
|
+
return unique.length >= 3 ? unique : [];
|
|
102
|
+
}
|
|
103
|
+
var ARC_STEP = Math.PI / 12;
|
|
104
|
+
function roundFootprint(points, radius, width, depth) {
|
|
105
|
+
if (!(radius > 0) || width <= 0 || depth <= 0) {
|
|
106
|
+
return [...points];
|
|
107
|
+
}
|
|
108
|
+
const world = points.map(([u, v]) => ({ x: u * width, y: v * depth }));
|
|
109
|
+
const rounded = [];
|
|
110
|
+
for (let i = 0; i < world.length; i += 1) {
|
|
111
|
+
const here = world[i];
|
|
112
|
+
const before = world[(i - 1 + world.length) % world.length];
|
|
113
|
+
const after = world[(i + 1) % world.length];
|
|
114
|
+
const a = { x: before.x - here.x, y: before.y - here.y };
|
|
115
|
+
const b = { x: after.x - here.x, y: after.y - here.y };
|
|
116
|
+
const lengthA = Math.hypot(a.x, a.y);
|
|
117
|
+
const lengthB = Math.hypot(b.x, b.y);
|
|
118
|
+
const cos = (a.x * b.x + a.y * b.y) / (lengthA * lengthB);
|
|
119
|
+
const angle = Math.acos(Math.max(-1, Math.min(1, cos)));
|
|
120
|
+
if (!Number.isFinite(angle) || angle < 1e-3 || Math.PI - angle < 1e-3) {
|
|
121
|
+
rounded.push(points[i]);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const reach = Math.min(radius / Math.tan(angle / 2), Math.min(lengthA, lengthB) / 2);
|
|
125
|
+
const effective = reach * Math.tan(angle / 2);
|
|
126
|
+
const unitA = { x: a.x / lengthA, y: a.y / lengthA };
|
|
127
|
+
const unitB = { x: b.x / lengthB, y: b.y / lengthB };
|
|
128
|
+
const from = { x: here.x + unitA.x * reach, y: here.y + unitA.y * reach };
|
|
129
|
+
const to = { x: here.x + unitB.x * reach, y: here.y + unitB.y * reach };
|
|
130
|
+
const bisector = { x: unitA.x + unitB.x, y: unitA.y + unitB.y };
|
|
131
|
+
const bisectorLength = Math.hypot(bisector.x, bisector.y);
|
|
132
|
+
const centerDistance = effective / Math.sin(angle / 2);
|
|
133
|
+
const center = {
|
|
134
|
+
x: here.x + bisector.x / bisectorLength * centerDistance,
|
|
135
|
+
y: here.y + bisector.y / bisectorLength * centerDistance
|
|
136
|
+
};
|
|
137
|
+
const start = Math.atan2(from.y - center.y, from.x - center.x);
|
|
138
|
+
let sweep = Math.atan2(to.y - center.y, to.x - center.x) - start;
|
|
139
|
+
sweep -= 2 * Math.PI * Math.round(sweep / (2 * Math.PI));
|
|
140
|
+
const steps = Math.max(2, Math.ceil(Math.abs(sweep) / ARC_STEP));
|
|
141
|
+
for (let step = 0; step <= steps; step += 1) {
|
|
142
|
+
const t = start + sweep * step / steps;
|
|
143
|
+
rounded.push([(center.x + effective * Math.cos(t)) / width, (center.y + effective * Math.sin(t)) / depth]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return rounded;
|
|
147
|
+
}
|
|
148
|
+
function extrudeFootprint(frame, footprint, cornerRadius = 0) {
|
|
149
|
+
const width = Math.max(0, frame.width);
|
|
150
|
+
const depth = Math.max(0, frame.depth);
|
|
151
|
+
const height = Math.max(0, frame.height);
|
|
152
|
+
const points = roundFootprint(cleanFootprint(footprint), cornerRadius, width, depth);
|
|
153
|
+
const apexX = frame.x + depth * AXIS_COS;
|
|
154
|
+
const project = ([u, v], z) => ({
|
|
155
|
+
x: apexX + (u * width - v * depth) * AXIS_COS,
|
|
156
|
+
y: frame.y + (u * width + v * depth) * AXIS_SIN + z
|
|
157
|
+
});
|
|
158
|
+
const top = points.map((point) => project(point, 0));
|
|
159
|
+
const turn = signedArea(points) >= 0 ? 1 : -1;
|
|
160
|
+
const edges = points.map((from, i) => {
|
|
161
|
+
const to = points[(i + 1) % points.length];
|
|
162
|
+
const edgeU = (to[0] - from[0]) * width;
|
|
163
|
+
const edgeV = (to[1] - from[1]) * depth;
|
|
164
|
+
const length = Math.hypot(edgeU, edgeV);
|
|
165
|
+
const normalU = length === 0 ? 0 : edgeV / length * turn;
|
|
166
|
+
const normalV = length === 0 ? 0 : -edgeU / length * turn;
|
|
167
|
+
return { from, to, length, normalU, normalV, visible: length > 0 && normalU + normalV > 1e-9 };
|
|
168
|
+
});
|
|
169
|
+
const sameWay = (a, b) => {
|
|
170
|
+
return a.visible && b.visible && a.normalU * b.normalU + a.normalV * b.normalV > Math.cos(0.5);
|
|
171
|
+
};
|
|
172
|
+
const sides = [];
|
|
173
|
+
edges.forEach((edge, i) => {
|
|
174
|
+
if (!edge.visible) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const before = edges[(i - 1 + edges.length) % edges.length];
|
|
178
|
+
const after = edges[(i + 1) % edges.length];
|
|
179
|
+
const { from, to } = edge;
|
|
180
|
+
sides.push({
|
|
181
|
+
points: [project(from, 0), project(to, 0), project(to, height), project(from, height)],
|
|
182
|
+
light: 0.72 + 0.28 * Math.max(0, Math.min(1, edge.normalV / (Math.abs(edge.normalU) + Math.abs(edge.normalV)))),
|
|
183
|
+
depth: (from[0] + to[0]) / 2 + (from[1] + to[1]) / 2,
|
|
184
|
+
smoothStart: sameWay(before, edge),
|
|
185
|
+
smoothEnd: sameWay(edge, after)
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
sides.sort((a, b) => a.depth - b.depth);
|
|
189
|
+
return { top, sides };
|
|
190
|
+
}
|
|
191
|
+
|
|
83
192
|
// src/model/isometricObject/shading.ts
|
|
84
193
|
function clamp255(value) {
|
|
85
194
|
return Math.max(0, Math.min(255, Math.round(value)));
|
|
@@ -103,6 +212,9 @@ function multiply(hex, factor) {
|
|
|
103
212
|
const [r, g, b] = rgb;
|
|
104
213
|
return rgbToHex(r * factor, g * factor, b * factor);
|
|
105
214
|
}
|
|
215
|
+
function shadeFill(fill, factor) {
|
|
216
|
+
return multiply(fill, factor);
|
|
217
|
+
}
|
|
106
218
|
function deriveFaceFills(fill) {
|
|
107
219
|
return {
|
|
108
220
|
topFill: fill,
|
|
@@ -111,6 +223,114 @@ function deriveFaceFills(fill) {
|
|
|
111
223
|
};
|
|
112
224
|
}
|
|
113
225
|
|
|
226
|
+
// src/model/path/curve.ts
|
|
227
|
+
var SAMPLES_PER_SEGMENT = 8;
|
|
228
|
+
function pointTension(curve, point) {
|
|
229
|
+
return Math.max(0, point.tension ?? curve.tension);
|
|
230
|
+
}
|
|
231
|
+
function isStraight(curve) {
|
|
232
|
+
return curve.points.length < 3 || curve.points.every((point) => pointTension(curve, point) <= 0);
|
|
233
|
+
}
|
|
234
|
+
function pointAt(curve, index) {
|
|
235
|
+
const { points } = curve;
|
|
236
|
+
if (curve.closed) {
|
|
237
|
+
return points[(index + points.length) % points.length];
|
|
238
|
+
}
|
|
239
|
+
return points[Math.max(0, Math.min(points.length - 1, index))];
|
|
240
|
+
}
|
|
241
|
+
function pathSegments(curve) {
|
|
242
|
+
const count = curve.closed ? curve.points.length : curve.points.length - 1;
|
|
243
|
+
return Array.from({ length: Math.max(0, count) }, (_, index) => {
|
|
244
|
+
const previous = pointAt(curve, index - 1);
|
|
245
|
+
const from = pointAt(curve, index);
|
|
246
|
+
const to = pointAt(curve, index + 1);
|
|
247
|
+
const next = pointAt(curve, index + 2);
|
|
248
|
+
const fromFactor = pointTension(curve, from) / 6;
|
|
249
|
+
const toFactor = pointTension(curve, to) / 6;
|
|
250
|
+
if (fromFactor === 0 && toFactor === 0) {
|
|
251
|
+
return { from, to, controls: null };
|
|
252
|
+
}
|
|
253
|
+
const first = { x: from.x + (to.x - previous.x) * fromFactor, y: from.y + (to.y - previous.y) * fromFactor };
|
|
254
|
+
const second = { x: to.x - (next.x - from.x) * toFactor, y: to.y - (next.y - from.y) * toFactor };
|
|
255
|
+
return { from, to, controls: [first, second] };
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function bezierAt(segment, t) {
|
|
259
|
+
const { from, to, controls } = segment;
|
|
260
|
+
const u = 1 - t;
|
|
261
|
+
const weights = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
|
|
262
|
+
const anchors = [from, controls[0], controls[1], to];
|
|
263
|
+
return {
|
|
264
|
+
x: anchors.reduce((sum, anchor, i) => sum + anchor.x * weights[i], 0),
|
|
265
|
+
y: anchors.reduce((sum, anchor, i) => sum + anchor.y * weights[i], 0)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function flattenPath(curve, samples = SAMPLES_PER_SEGMENT) {
|
|
269
|
+
if (isStraight(curve)) {
|
|
270
|
+
return curve.points.map((point) => ({ x: point.x, y: point.y }));
|
|
271
|
+
}
|
|
272
|
+
const flat = [];
|
|
273
|
+
const segments = pathSegments(curve);
|
|
274
|
+
segments.forEach((segment) => {
|
|
275
|
+
flat.push({ x: segment.from.x, y: segment.from.y });
|
|
276
|
+
if (segment.controls) {
|
|
277
|
+
const curved = { ...segment, controls: segment.controls };
|
|
278
|
+
for (let step = 1; step < samples; step++) {
|
|
279
|
+
flat.push(bezierAt(curved, step / samples));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
const last = segments[segments.length - 1];
|
|
284
|
+
if (!curve.closed && last) {
|
|
285
|
+
flat.push({ x: last.to.x, y: last.to.y });
|
|
286
|
+
}
|
|
287
|
+
return flat;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/model/path/symbol.ts
|
|
291
|
+
function pathBounds(points) {
|
|
292
|
+
const xs = points.map((point) => point.x);
|
|
293
|
+
const ys = points.map((point) => point.y);
|
|
294
|
+
const x = Math.min(...xs);
|
|
295
|
+
const y = Math.min(...ys);
|
|
296
|
+
return { x, y, width: Math.max(...xs) - x, height: Math.max(...ys) - y };
|
|
297
|
+
}
|
|
298
|
+
var round = (value) => Math.round(value * 1e4) / 1e4;
|
|
299
|
+
function pathToSymbol(points) {
|
|
300
|
+
if (points.length === 0) {
|
|
301
|
+
return { points: [], width: 0, height: 0 };
|
|
302
|
+
}
|
|
303
|
+
const frame = pathBounds(points);
|
|
304
|
+
const unit = (value, size) => size === 0 ? 0 : round(value / size);
|
|
305
|
+
return {
|
|
306
|
+
width: frame.width,
|
|
307
|
+
height: frame.height,
|
|
308
|
+
points: points.map((point) => {
|
|
309
|
+
const x = unit(point.x - frame.x, frame.width);
|
|
310
|
+
const y = unit(point.y - frame.y, frame.height);
|
|
311
|
+
return point.tension === void 0 ? [x, y] : [x, y, point.tension];
|
|
312
|
+
})
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function symbolToPath(points, frame) {
|
|
316
|
+
return points.map((point) => {
|
|
317
|
+
const placed = { x: frame.x + point[0] * frame.width, y: frame.y + point[1] * frame.height };
|
|
318
|
+
return point[2] === void 0 ? placed : { ...placed, tension: point[2] };
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/model/component/categories.ts
|
|
323
|
+
var COMPONENT_CATEGORIES = [
|
|
324
|
+
{ id: "action", label: "Actions" },
|
|
325
|
+
{ id: "selection", label: "Selection" },
|
|
326
|
+
{ id: "value", label: "Value input" },
|
|
327
|
+
{ id: "text", label: "Text input" },
|
|
328
|
+
{ id: "indicator", label: "Indicators" },
|
|
329
|
+
{ id: "instrument", label: "Instruments" },
|
|
330
|
+
{ id: "navigation", label: "Navigation" },
|
|
331
|
+
{ id: "container", label: "Containers" }
|
|
332
|
+
];
|
|
333
|
+
|
|
114
334
|
// src/model/component/supportedTypes.ts
|
|
115
335
|
var BUILT_IN_COMPONENT_TYPES = ["rollingNumber", "tickScale", "ruler"];
|
|
116
336
|
function isBuiltInComponentType(value) {
|
|
@@ -127,6 +347,7 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
127
347
|
{
|
|
128
348
|
type: "rollingNumber",
|
|
129
349
|
group: "readout",
|
|
350
|
+
category: "indicator",
|
|
130
351
|
value: { type: "number", writable: false, default: 0 },
|
|
131
352
|
properties: {},
|
|
132
353
|
interaction: "none",
|
|
@@ -136,6 +357,7 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
136
357
|
{
|
|
137
358
|
type: "tickScale",
|
|
138
359
|
group: "readout",
|
|
360
|
+
category: "instrument",
|
|
139
361
|
value: { type: "number", writable: false, default: 0 },
|
|
140
362
|
properties: {},
|
|
141
363
|
interaction: "none",
|
|
@@ -145,6 +367,7 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
145
367
|
{
|
|
146
368
|
type: "ruler",
|
|
147
369
|
group: "input",
|
|
370
|
+
category: "instrument",
|
|
148
371
|
value: { type: "number", writable: false, default: 0 },
|
|
149
372
|
properties: {},
|
|
150
373
|
interaction: "scale",
|
|
@@ -154,11 +377,13 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
154
377
|
{
|
|
155
378
|
type: "switch",
|
|
156
379
|
group: "input",
|
|
380
|
+
category: "selection",
|
|
157
381
|
value: { type: "boolean", writable: true, default: false },
|
|
158
382
|
properties: {
|
|
159
383
|
accent: { type: "color", default: "#5a6bff" },
|
|
160
384
|
track: { type: "color", default: "#cbd5e1" },
|
|
161
|
-
thumb: { type: "color", default: "#ffffff" }
|
|
385
|
+
thumb: { type: "color", default: "#ffffff" },
|
|
386
|
+
animate: { type: "number", default: 160, min: 0, max: 2e3, step: 10 }
|
|
162
387
|
},
|
|
163
388
|
interaction: "toggle",
|
|
164
389
|
pointerScale: false,
|
|
@@ -168,13 +393,15 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
168
393
|
{
|
|
169
394
|
type: "checkbox",
|
|
170
395
|
group: "input",
|
|
396
|
+
category: "selection",
|
|
171
397
|
value: { type: "boolean", writable: true, default: false },
|
|
172
398
|
properties: {
|
|
173
399
|
accent: { type: "color", default: "#5a6bff" },
|
|
174
400
|
stroke: { type: "color", default: "#94a3b8" },
|
|
175
401
|
check: { type: "color", default: "#ffffff" },
|
|
176
402
|
textColor: { type: "color", default: "#0f172a" },
|
|
177
|
-
fontSize: { type: "number", default: 14, min: 6, max: 200 }
|
|
403
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
404
|
+
animate: { type: "number", default: 160, min: 0, max: 2e3, step: 10 }
|
|
178
405
|
},
|
|
179
406
|
interaction: "toggle",
|
|
180
407
|
pointerScale: false,
|
|
@@ -184,13 +411,15 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
184
411
|
{
|
|
185
412
|
type: "toggleButton",
|
|
186
413
|
group: "input",
|
|
414
|
+
category: "action",
|
|
187
415
|
value: { type: "boolean", writable: true, default: false },
|
|
188
416
|
properties: {
|
|
189
417
|
accent: { type: "color", default: "#5a6bff" },
|
|
190
418
|
stroke: { type: "color", default: "#94a3b8" },
|
|
191
419
|
textColor: { type: "color", default: "#0f172a" },
|
|
192
420
|
onTextColor: { type: "color", default: "#ffffff" },
|
|
193
|
-
fontSize: { type: "number", default: 14, min: 6, max: 200 }
|
|
421
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
422
|
+
animate: { type: "number", default: 160, min: 0, max: 2e3, step: 10 }
|
|
194
423
|
},
|
|
195
424
|
interaction: "toggle",
|
|
196
425
|
pointerScale: false,
|
|
@@ -200,16 +429,153 @@ var BUILT_IN_DESCRIPTORS = [
|
|
|
200
429
|
{
|
|
201
430
|
type: "button",
|
|
202
431
|
group: "action",
|
|
432
|
+
category: "action",
|
|
203
433
|
properties: {
|
|
204
434
|
accent: { type: "color", default: "#5a6bff" },
|
|
205
435
|
textColor: { type: "color", default: "#ffffff" },
|
|
206
436
|
radius: { type: "number", default: 8, min: 0, max: 200 },
|
|
207
|
-
fontSize: { type: "number", default: 14, min: 6, max: 200 }
|
|
437
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
438
|
+
animate: { type: "number", default: 160, min: 0, max: 2e3, step: 10 }
|
|
208
439
|
},
|
|
209
440
|
interaction: "press",
|
|
210
441
|
pointerScale: false,
|
|
211
442
|
size: { width: 120, height: 40, minWidth: 40, minHeight: 24 },
|
|
212
443
|
role: "button"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
type: "slider",
|
|
447
|
+
group: "input",
|
|
448
|
+
category: "value",
|
|
449
|
+
value: { type: "number", writable: true, default: 40 },
|
|
450
|
+
properties: {
|
|
451
|
+
variant: { type: "enum", default: "line", options: ["line", "field"] },
|
|
452
|
+
direction: { type: "enum", default: "horizontal", options: ["horizontal", "vertical"] },
|
|
453
|
+
ticks: { type: "number", default: 0, min: 0, max: 200 },
|
|
454
|
+
tickColor: { type: "color", default: "#94a3b8" },
|
|
455
|
+
min: { type: "number", default: 0 },
|
|
456
|
+
max: { type: "number", default: 100 },
|
|
457
|
+
step: { type: "number", default: 0, min: 0 },
|
|
458
|
+
surface: { type: "color", default: "#eef1f6" },
|
|
459
|
+
fill: { type: "color", default: "#cbd5e1" },
|
|
460
|
+
textColor: { type: "color", default: "#0f172a" },
|
|
461
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
462
|
+
display: { type: "enum", default: "value", options: ["none", "value", "percent"] },
|
|
463
|
+
radius: { type: "number", default: 10, min: 0, max: 200 },
|
|
464
|
+
accent: { type: "color", default: "#5a6bff" },
|
|
465
|
+
track: { type: "color", default: "#cbd5e1" },
|
|
466
|
+
thumb: { type: "color", default: "#ffffff" },
|
|
467
|
+
trackHeight: { type: "number", default: 6, min: 1, max: 80 },
|
|
468
|
+
thumbSize: { type: "number", default: 56, min: 20, max: 100, step: 5 },
|
|
469
|
+
animate: { type: "number", default: 0, min: 0, max: 2e3, step: 10 }
|
|
470
|
+
},
|
|
471
|
+
interaction: "slide",
|
|
472
|
+
pointerScale: false,
|
|
473
|
+
size: { width: 220, height: 28, minWidth: 60, minHeight: 12 },
|
|
474
|
+
role: "slider"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
type: "range",
|
|
478
|
+
group: "input",
|
|
479
|
+
category: "value",
|
|
480
|
+
value: { type: "number", writable: true, default: 25 },
|
|
481
|
+
properties: {
|
|
482
|
+
variant: { type: "enum", default: "line", options: ["line", "field"] },
|
|
483
|
+
direction: { type: "enum", default: "horizontal", options: ["horizontal", "vertical"] },
|
|
484
|
+
ticks: { type: "number", default: 0, min: 0, max: 200 },
|
|
485
|
+
tickColor: { type: "color", default: "#94a3b8" },
|
|
486
|
+
valueEnd: { type: "number", default: 75 },
|
|
487
|
+
min: { type: "number", default: 0 },
|
|
488
|
+
max: { type: "number", default: 100 },
|
|
489
|
+
step: { type: "number", default: 0, min: 0 },
|
|
490
|
+
surface: { type: "color", default: "#eef1f6" },
|
|
491
|
+
fill: { type: "color", default: "#cbd5e1" },
|
|
492
|
+
textColor: { type: "color", default: "#0f172a" },
|
|
493
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
494
|
+
display: { type: "enum", default: "value", options: ["none", "value", "percent"] },
|
|
495
|
+
radius: { type: "number", default: 10, min: 0, max: 200 },
|
|
496
|
+
accent: { type: "color", default: "#5a6bff" },
|
|
497
|
+
track: { type: "color", default: "#cbd5e1" },
|
|
498
|
+
thumb: { type: "color", default: "#ffffff" },
|
|
499
|
+
trackHeight: { type: "number", default: 6, min: 1, max: 80 },
|
|
500
|
+
thumbSize: { type: "number", default: 56, min: 20, max: 100, step: 5 },
|
|
501
|
+
animate: { type: "number", default: 0, min: 0, max: 2e3, step: 10 }
|
|
502
|
+
},
|
|
503
|
+
interaction: "range",
|
|
504
|
+
pointerScale: false,
|
|
505
|
+
size: { width: 220, height: 28, minWidth: 60, minHeight: 12 },
|
|
506
|
+
role: "slider"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
type: "progress",
|
|
510
|
+
group: "readout",
|
|
511
|
+
category: "indicator",
|
|
512
|
+
value: { type: "number", writable: false, default: 60 },
|
|
513
|
+
properties: {
|
|
514
|
+
min: { type: "number", default: 0 },
|
|
515
|
+
max: { type: "number", default: 100 },
|
|
516
|
+
variant: { type: "enum", default: "bar", options: ["bar", "ring"] },
|
|
517
|
+
direction: { type: "enum", default: "horizontal", options: ["horizontal", "vertical"] },
|
|
518
|
+
accent: { type: "color", default: "#5a6bff" },
|
|
519
|
+
track: { type: "color", default: "#e2e8f0" },
|
|
520
|
+
thickness: { type: "number", default: 10, min: 1, max: 80 },
|
|
521
|
+
rounded: { type: "boolean", default: true },
|
|
522
|
+
display: { type: "enum", default: "none", options: ["none", "percent", "value"] },
|
|
523
|
+
textColor: { type: "color", default: "#0f172a" },
|
|
524
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
525
|
+
animate: { type: "number", default: 300, min: 0, max: 2e3, step: 10 }
|
|
526
|
+
},
|
|
527
|
+
interaction: "none",
|
|
528
|
+
pointerScale: false,
|
|
529
|
+
size: { width: 220, height: 12, minWidth: 20, minHeight: 4 },
|
|
530
|
+
role: "progressbar"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
type: "segmented",
|
|
534
|
+
group: "input",
|
|
535
|
+
category: "selection",
|
|
536
|
+
value: { type: "number", writable: true, default: 0 },
|
|
537
|
+
properties: {
|
|
538
|
+
options: { type: "string", default: "Day,Week,Month" },
|
|
539
|
+
accent: { type: "color", default: "#5a6bff" },
|
|
540
|
+
track: { type: "color", default: "#e2e8f0" },
|
|
541
|
+
textColor: { type: "color", default: "#475569" },
|
|
542
|
+
activeTextColor: { type: "color", default: "#ffffff" },
|
|
543
|
+
radius: { type: "number", default: 200, min: 0, max: 200 },
|
|
544
|
+
inset: { type: "number", default: 3, min: 0, max: 20 },
|
|
545
|
+
fontSize: { type: "number", default: 14, min: 6, max: 200 },
|
|
546
|
+
animate: { type: "number", default: 200, min: 0, max: 2e3, step: 10 }
|
|
547
|
+
},
|
|
548
|
+
interaction: "pick",
|
|
549
|
+
pointerScale: false,
|
|
550
|
+
size: { width: 300, height: 40, minWidth: 80, minHeight: 20 },
|
|
551
|
+
role: "radiogroup"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
type: "knob",
|
|
555
|
+
group: "input",
|
|
556
|
+
category: "value",
|
|
557
|
+
value: { type: "number", writable: true, default: 40 },
|
|
558
|
+
properties: {
|
|
559
|
+
min: { type: "number", default: 0 },
|
|
560
|
+
max: { type: "number", default: 100 },
|
|
561
|
+
step: { type: "number", default: 0, min: 0 },
|
|
562
|
+
start: { type: "number", default: 225, min: 0, max: 360 },
|
|
563
|
+
sweep: { type: "number", default: 270, min: 30, max: 360 },
|
|
564
|
+
accent: { type: "color", default: "#5a6bff" },
|
|
565
|
+
track: { type: "color", default: "#cbd5e1" },
|
|
566
|
+
face: { type: "color", default: "#f1f5f9" },
|
|
567
|
+
dot: { type: "color", default: "#0f172a" },
|
|
568
|
+
thickness: { type: "number", default: 8, min: 1, max: 80 },
|
|
569
|
+
rounded: { type: "boolean", default: true },
|
|
570
|
+
display: { type: "enum", default: "value", options: ["none", "value", "percent"] },
|
|
571
|
+
textColor: { type: "color", default: "#0f172a" },
|
|
572
|
+
fontSize: { type: "number", default: 16, min: 6, max: 200 },
|
|
573
|
+
animate: { type: "number", default: 0, min: 0, max: 2e3, step: 10 }
|
|
574
|
+
},
|
|
575
|
+
interaction: "turn",
|
|
576
|
+
pointerScale: false,
|
|
577
|
+
size: { width: 96, height: 96, minWidth: 40, minHeight: 40, aspect: 1 },
|
|
578
|
+
role: "slider"
|
|
213
579
|
}
|
|
214
580
|
];
|
|
215
581
|
|
|
@@ -689,6 +1055,7 @@ var NAMED_BLOCK_KINDS = [
|
|
|
689
1055
|
"Shape",
|
|
690
1056
|
"Text",
|
|
691
1057
|
"Isometric",
|
|
1058
|
+
"Dimension",
|
|
692
1059
|
"Link",
|
|
693
1060
|
"Connection",
|
|
694
1061
|
"Layout",
|
|
@@ -1462,6 +1829,11 @@ function isChartObject(canvasObject) {
|
|
|
1462
1829
|
return canvasObject.objectType === "chart" && canvasObject.chart !== void 0;
|
|
1463
1830
|
}
|
|
1464
1831
|
|
|
1832
|
+
// src/sflSemantic/canvasObjects/artifacts/dimension/types.ts
|
|
1833
|
+
function isDimensionObject(canvasObject) {
|
|
1834
|
+
return canvasObject.objectType === "dimension" && canvasObject.dimension !== void 0;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1465
1837
|
// src/sflSemantic/canvasObjects/artifacts/isometric/types.ts
|
|
1466
1838
|
function isIsometricObject(canvasObject) {
|
|
1467
1839
|
return canvasObject.objectType === "isometric" && canvasObject.isometric !== void 0;
|
|
@@ -1599,7 +1971,8 @@ var CANVAS_OBJECT_BLOCK_KINDS = [
|
|
|
1599
1971
|
"Chart",
|
|
1600
1972
|
"Widget",
|
|
1601
1973
|
"Component",
|
|
1602
|
-
"Isometric"
|
|
1974
|
+
"Isometric",
|
|
1975
|
+
"Dimension"
|
|
1603
1976
|
];
|
|
1604
1977
|
var canvasObjectBlockKinds = new Set(CANVAS_OBJECT_BLOCK_KINDS);
|
|
1605
1978
|
function isCanvasObjectBlockKind(kind) {
|
|
@@ -2005,21 +2378,77 @@ function resolveChartObject(base, block2, properties, symbolDefinitions, mergedP
|
|
|
2005
2378
|
};
|
|
2006
2379
|
}
|
|
2007
2380
|
|
|
2381
|
+
// src/sflSemantic/canvasObjects/artifacts/dimension/reader.ts
|
|
2382
|
+
function readPoint(value, origin) {
|
|
2383
|
+
const [x, y] = tupleValues(value) ?? [];
|
|
2384
|
+
return { x: origin.x + (x ?? 0), y: origin.y + (y ?? 0) };
|
|
2385
|
+
}
|
|
2386
|
+
function readDimension(properties, origin) {
|
|
2387
|
+
return {
|
|
2388
|
+
start: readPoint(properties.get("start"), origin),
|
|
2389
|
+
end: readPoint(properties.get("end"), origin),
|
|
2390
|
+
offset: asNumber(properties.get("offset")) ?? 0,
|
|
2391
|
+
unit: asString(properties.get("unit"))
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// src/sflSemantic/canvasObjects/artifacts/dimension/resolver.ts
|
|
2396
|
+
function resolveDimensionObject(base, properties, origin) {
|
|
2397
|
+
return {
|
|
2398
|
+
...base,
|
|
2399
|
+
objectType: "dimension",
|
|
2400
|
+
dimension: readDimension(properties, origin)
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2008
2404
|
// src/sflSemantic/canvasObjects/artifacts/isometric/reader.ts
|
|
2009
|
-
function
|
|
2405
|
+
function readFootprintPoint(value) {
|
|
2406
|
+
if (value.type !== "list" || value.values.length < 2) {
|
|
2407
|
+
return [];
|
|
2408
|
+
}
|
|
2409
|
+
const x = asNumber(value.values[0]);
|
|
2410
|
+
const y = asNumber(value.values[1]);
|
|
2411
|
+
const tension = value.values[2] === void 0 ? void 0 : asNumber(value.values[2]);
|
|
2412
|
+
if (x === void 0 || y === void 0) {
|
|
2413
|
+
return [];
|
|
2414
|
+
}
|
|
2415
|
+
return [tension === void 0 ? { x, y } : { x, y, tension }];
|
|
2416
|
+
}
|
|
2417
|
+
function asPolygon(points, tension) {
|
|
2418
|
+
const flat = flattenPath({ points, tension, closed: true });
|
|
2419
|
+
return flat.length >= 3 ? flat.map((point) => [point.x, point.y]) : void 0;
|
|
2420
|
+
}
|
|
2421
|
+
function readFootprint(value, symbolDefs) {
|
|
2422
|
+
if (value?.type === "list") {
|
|
2423
|
+
return asPolygon(value.values.flatMap(readFootprintPoint), 0);
|
|
2424
|
+
}
|
|
2425
|
+
const name = asString(value);
|
|
2426
|
+
const definition = name ? symbolDefs.get(name) : void 0;
|
|
2427
|
+
if (!definition) {
|
|
2428
|
+
return void 0;
|
|
2429
|
+
}
|
|
2430
|
+
const points = definition.points.map(([x, y], index) => {
|
|
2431
|
+
const tension = definition.pointTensions?.[index];
|
|
2432
|
+
return tension === void 0 ? { x, y } : { x, y, tension };
|
|
2433
|
+
});
|
|
2434
|
+
return asPolygon(points, definition.tension ?? 0);
|
|
2435
|
+
}
|
|
2436
|
+
function readIsometric(properties, depth, symbolDefs) {
|
|
2010
2437
|
return {
|
|
2011
2438
|
depth,
|
|
2012
|
-
icon: asString(properties.get("icon"))
|
|
2439
|
+
icon: asString(properties.get("icon")),
|
|
2440
|
+
footprint: readFootprint(properties.get("symbol"), symbolDefs),
|
|
2441
|
+
form: asString(properties.get("shape")) === "sphere" ? "sphere" : "box"
|
|
2013
2442
|
};
|
|
2014
2443
|
}
|
|
2015
2444
|
|
|
2016
2445
|
// src/sflSemantic/canvasObjects/artifacts/isometric/resolver.ts
|
|
2017
|
-
function resolveIsometricObject(base, block2, properties, layoutProperty) {
|
|
2446
|
+
function resolveIsometricObject(base, block2, properties, layoutProperty, symbolDefinitions) {
|
|
2018
2447
|
const size = tupleValues(layoutProperty(block2, "size"));
|
|
2019
2448
|
return {
|
|
2020
2449
|
...base,
|
|
2021
2450
|
objectType: "isometric",
|
|
2022
|
-
isometric: readIsometric(properties, size?.[2] ?? 24)
|
|
2451
|
+
isometric: readIsometric(properties, size?.[2] ?? 24, symbolDefinitions)
|
|
2023
2452
|
};
|
|
2024
2453
|
}
|
|
2025
2454
|
|
|
@@ -2032,7 +2461,12 @@ function readPath(p, origin) {
|
|
|
2032
2461
|
}
|
|
2033
2462
|
const x = asNumber(value.values[0]);
|
|
2034
2463
|
const y = asNumber(value.values[1]);
|
|
2035
|
-
|
|
2464
|
+
const tension = value.values[2] === void 0 ? void 0 : asNumber(value.values[2]);
|
|
2465
|
+
if (x === void 0 || y === void 0) {
|
|
2466
|
+
return [];
|
|
2467
|
+
}
|
|
2468
|
+
const point = { x: origin.x + x, y: origin.y + y };
|
|
2469
|
+
return [tension === void 0 ? point : { ...point, tension }];
|
|
2036
2470
|
}) : [];
|
|
2037
2471
|
return {
|
|
2038
2472
|
points,
|
|
@@ -2099,6 +2533,9 @@ function declaredCanvasObjectKind(block2, properties) {
|
|
|
2099
2533
|
if (block2.kind === "Isometric") {
|
|
2100
2534
|
return "isometric";
|
|
2101
2535
|
}
|
|
2536
|
+
if (block2.kind === "Dimension") {
|
|
2537
|
+
return "dimension";
|
|
2538
|
+
}
|
|
2102
2539
|
return asString(properties.get("kind")) ?? "";
|
|
2103
2540
|
}
|
|
2104
2541
|
function canvasObjectTypeForKind(kind) {
|
|
@@ -2120,6 +2557,9 @@ function canvasObjectTypeForKind(kind) {
|
|
|
2120
2557
|
if (kind === "isometric") {
|
|
2121
2558
|
return "isometric";
|
|
2122
2559
|
}
|
|
2560
|
+
if (kind === "dimension") {
|
|
2561
|
+
return "dimension";
|
|
2562
|
+
}
|
|
2123
2563
|
return "shape";
|
|
2124
2564
|
}
|
|
2125
2565
|
function classifyCanvasObject(block2, properties, symbolDefinitions) {
|
|
@@ -2182,9 +2622,11 @@ function resolveCanvasObject(block2, origin, context, frameId, positionOverride)
|
|
|
2182
2622
|
case "chart":
|
|
2183
2623
|
return resolveChartObject(base, block2, properties, symbolDefs, mergedProps);
|
|
2184
2624
|
case "isometric":
|
|
2185
|
-
return resolveIsometricObject(base, block2, properties, layoutProp);
|
|
2625
|
+
return resolveIsometricObject(base, block2, properties, layoutProp, symbolDefs);
|
|
2186
2626
|
case "path":
|
|
2187
2627
|
return resolvePathObject(base, properties, origin);
|
|
2628
|
+
case "dimension":
|
|
2629
|
+
return resolveDimensionObject(base, properties, origin);
|
|
2188
2630
|
case "swimlane":
|
|
2189
2631
|
return resolveSwimlaneObject(base, properties);
|
|
2190
2632
|
case "frame":
|
|
@@ -2318,12 +2760,13 @@ function resolveCanvasTree(model, resolution) {
|
|
|
2318
2760
|
function readShaderDefinition(block2) {
|
|
2319
2761
|
const properties = directProperties(block2);
|
|
2320
2762
|
const program = asString(properties.get("program"));
|
|
2763
|
+
const surfacePadding = asNumber(properties.get("surfacePadding"));
|
|
2321
2764
|
if (!program) {
|
|
2322
2765
|
return void 0;
|
|
2323
2766
|
}
|
|
2324
2767
|
const parameters = {};
|
|
2325
2768
|
for (const [key, value] of properties) {
|
|
2326
|
-
if (key === "program") {
|
|
2769
|
+
if (key === "program" || key === "surfacePadding") {
|
|
2327
2770
|
continue;
|
|
2328
2771
|
}
|
|
2329
2772
|
const number = asNumber(value);
|
|
@@ -2334,23 +2777,35 @@ function readShaderDefinition(block2) {
|
|
|
2334
2777
|
parameters[key] = text === "true" ? true : text === "false" ? false : text;
|
|
2335
2778
|
}
|
|
2336
2779
|
}
|
|
2337
|
-
return {
|
|
2780
|
+
return {
|
|
2781
|
+
name: block2.name,
|
|
2782
|
+
program,
|
|
2783
|
+
...surfacePadding === void 0 ? {} : { surfacePadding: Math.max(0, surfacePadding) },
|
|
2784
|
+
parameters
|
|
2785
|
+
};
|
|
2338
2786
|
}
|
|
2339
2787
|
|
|
2340
2788
|
// src/sflSemantic/definitions/symbols.ts
|
|
2341
2789
|
function readSymbolPoints(block2) {
|
|
2342
2790
|
const value = directProperties(block2).get("points");
|
|
2791
|
+
const points = [];
|
|
2792
|
+
const tensions = [];
|
|
2343
2793
|
if (value?.type !== "list") {
|
|
2344
|
-
return
|
|
2794
|
+
return { points, tensions };
|
|
2345
2795
|
}
|
|
2346
|
-
|
|
2796
|
+
for (const item of value.values) {
|
|
2347
2797
|
if (item.type !== "list" || item.values.length < 2) {
|
|
2348
|
-
|
|
2798
|
+
continue;
|
|
2349
2799
|
}
|
|
2350
2800
|
const x = asNumber(item.values[0]);
|
|
2351
2801
|
const y = asNumber(item.values[1]);
|
|
2352
|
-
|
|
2353
|
-
|
|
2802
|
+
if (x === void 0 || y === void 0) {
|
|
2803
|
+
continue;
|
|
2804
|
+
}
|
|
2805
|
+
points.push([x, y]);
|
|
2806
|
+
tensions.push(item.values[2] === void 0 ? void 0 : asNumber(item.values[2]));
|
|
2807
|
+
}
|
|
2808
|
+
return { points, tensions };
|
|
2354
2809
|
}
|
|
2355
2810
|
function readSymbolPorts(block2) {
|
|
2356
2811
|
const ports = childBlocks(block2).filter((child) => child.kind === "Port").flatMap((port) => {
|
|
@@ -2363,13 +2818,14 @@ function readSymbolPorts(block2) {
|
|
|
2363
2818
|
return ports.length > 0 ? ports : void 0;
|
|
2364
2819
|
}
|
|
2365
2820
|
function readSymbolDefinition(block2) {
|
|
2366
|
-
const points = readSymbolPoints(block2);
|
|
2821
|
+
const { points, tensions } = readSymbolPoints(block2);
|
|
2367
2822
|
if (points.length < 2) {
|
|
2368
2823
|
return void 0;
|
|
2369
2824
|
}
|
|
2370
2825
|
return {
|
|
2371
2826
|
name: block2.name,
|
|
2372
2827
|
points,
|
|
2828
|
+
pointTensions: tensions.some((tension) => tension !== void 0) ? tensions : void 0,
|
|
2373
2829
|
tension: asNumber(directProperties(block2).get("tension")),
|
|
2374
2830
|
ports: readSymbolPorts(block2)
|
|
2375
2831
|
};
|
|
@@ -2910,43 +3366,25 @@ function freeformPathData(geometry) {
|
|
|
2910
3366
|
if (geometry.points.length === 0) {
|
|
2911
3367
|
return "";
|
|
2912
3368
|
}
|
|
2913
|
-
if (geometry
|
|
3369
|
+
if (isStraight(geometry)) {
|
|
2914
3370
|
return linearPathData(geometry);
|
|
2915
3371
|
}
|
|
2916
|
-
return smoothPathData(geometry);
|
|
2917
|
-
}
|
|
2918
|
-
function linearPathData(geometry) {
|
|
2919
|
-
const [first, ...remaining] = geometry.points;
|
|
2920
|
-
const segments = remaining.map((point) => `L ${point.x} ${point.y}`).join(" ");
|
|
2921
|
-
return `M ${first.x} ${first.y} ${segments}${geometry.closed ? " Z" : ""}`;
|
|
2922
|
-
}
|
|
2923
|
-
function smoothPathData(geometry) {
|
|
2924
3372
|
const first = geometry.points[0];
|
|
2925
|
-
const segmentCount = geometry.closed ? geometry.points.length : geometry.points.length - 1;
|
|
2926
3373
|
const commands = [`M ${first.x} ${first.y}`];
|
|
2927
|
-
for (
|
|
2928
|
-
commands.push(
|
|
3374
|
+
for (const { to, controls } of pathSegments(geometry)) {
|
|
3375
|
+
commands.push(
|
|
3376
|
+
controls ? `C ${controls[0].x} ${controls[0].y} ${controls[1].x} ${controls[1].y} ${to.x} ${to.y}` : `L ${to.x} ${to.y}`
|
|
3377
|
+
);
|
|
2929
3378
|
}
|
|
2930
3379
|
if (geometry.closed) {
|
|
2931
3380
|
commands.push("Z");
|
|
2932
3381
|
}
|
|
2933
3382
|
return commands.join(" ");
|
|
2934
3383
|
}
|
|
2935
|
-
function
|
|
2936
|
-
const
|
|
2937
|
-
const
|
|
2938
|
-
|
|
2939
|
-
const next = freeformPointAt(geometry, index + 2);
|
|
2940
|
-
const factor = geometry.tension / 6;
|
|
2941
|
-
const firstControl = { x: start.x + (end.x - previous.x) * factor, y: start.y + (end.y - previous.y) * factor };
|
|
2942
|
-
const secondControl = { x: end.x - (next.x - start.x) * factor, y: end.y - (next.y - start.y) * factor };
|
|
2943
|
-
return `C ${firstControl.x} ${firstControl.y} ${secondControl.x} ${secondControl.y} ${end.x} ${end.y}`;
|
|
2944
|
-
}
|
|
2945
|
-
function freeformPointAt(geometry, index) {
|
|
2946
|
-
if (geometry.closed) {
|
|
2947
|
-
return geometry.points[(index + geometry.points.length) % geometry.points.length];
|
|
2948
|
-
}
|
|
2949
|
-
return geometry.points[Math.max(0, Math.min(geometry.points.length - 1, index))];
|
|
3384
|
+
function linearPathData(geometry) {
|
|
3385
|
+
const [first, ...remaining] = geometry.points;
|
|
3386
|
+
const segments = remaining.map((point) => `L ${point.x} ${point.y}`).join(" ");
|
|
3387
|
+
return `M ${first.x} ${first.y} ${segments}${geometry.closed ? " Z" : ""}`;
|
|
2950
3388
|
}
|
|
2951
3389
|
|
|
2952
3390
|
// src/renderScene/charts/primitives/radarShape.ts
|
|
@@ -3445,8 +3883,8 @@ function createRoundedCorner(previous, corner, next, maximumRadius) {
|
|
|
3445
3883
|
const outgoing = { x: next.x - corner.x, y: next.y - corner.y };
|
|
3446
3884
|
const incomingIsAxisAligned = incoming.x === 0 || incoming.y === 0;
|
|
3447
3885
|
const outgoingIsAxisAligned = outgoing.x === 0 || outgoing.y === 0;
|
|
3448
|
-
const
|
|
3449
|
-
if (!incomingIsAxisAligned || !outgoingIsAxisAligned ||
|
|
3886
|
+
const isStraight2 = incoming.x === 0 && outgoing.x === 0 || incoming.y === 0 && outgoing.y === 0;
|
|
3887
|
+
if (!incomingIsAxisAligned || !outgoingIsAxisAligned || isStraight2) {
|
|
3450
3888
|
return null;
|
|
3451
3889
|
}
|
|
3452
3890
|
const radius = Math.min(maximumRadius, axisLength(incoming) * 0.4, axisLength(outgoing) * 0.4);
|
|
@@ -4868,6 +5306,6 @@ function localShapePath(type, x, y, width, height) {
|
|
|
4868
5306
|
}
|
|
4869
5307
|
}
|
|
4870
5308
|
|
|
4871
|
-
export { AXIS_COS, AXIS_SIN, BAR_LABEL, CATEGORY_LABEL_ROW, CHART_COLORS, CHART_TITLE_PROP, CHART_TYPES, CORNER_RADIUS_ATTR, DEFAULT_FONT, DEFAULT_HEATMAP_ZONES, DEFAULT_HEX_RADIUS, DEFAULT_ROLLING_NUMBER_STYLE, DEFAULT_ZONE_FILL, DOM_CONTRACT_VERSION, EMPTY_BOUNDS, ISOMETRIC_LABEL_OFFSET_ATTR, ISOMETRIC_SIZE_ATTR, LABEL_WIDTH, LEADER_INSET, PATH_CLOSED_ATTR, PATH_POINTS_ATTR, PATH_POINT_INDEX_ATTR, PATH_TENSION_ATTR, SQUARE_CORNER_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, VISIBLE_ISOMETRIC_FACES, angleForAxisValue, axisBands, axisLabelProp, barCategoryCount, barLabelSize, barPath, barShapePath, bottomRoundedRectPath, boxBounds, calculateLinkRoute, canonicalizeSource, categoryProp, chartText, chartTicks, clipSegmentToRect, colorWithAlpha, componentRegistryVersion, computeBoxplotStats, contrastTextColor, cornersRoundedRectPath, createPieGeometry, createPieSlicePath, createVerticalErrorWhiskerNode, deriveFaceFills, edgePointToward, elementCenter, ellipsizeToWidth, errorBarRange, estimateTextWidth, finite, formatBarLabel, formatFieldValue, formatRollingNumber, freeformPathData, gapInsetAngle, getComponentDescriptor, getLineMidpoint, heuristicRichMeasure, horizontalRows, interpolateHexColorStops, isBuiltInComponentType, isChartObject, isGenericComponent, isHorizontalBar, isIsometricObject, isLightColor, isPathObject, isSwimlaneObject, isometricBounds, isometricFaceCenter, isometricFaces, isometricTopFaceCenter, labelGapDash, leftRoundedRectPath, linePathData, localShapePath, mapChartValue, maxApexCornerRadius, maxPieCornerRadius, paint, parseSource, personLabelArea, pieApexRadius, pieArcPoint, pieUsesInnerArc, pillCornerRadius, pillPath, pointAtNormalizedPort, pointAtPort, radarCategoryCount, radarPointAt, radarRadius, radarRadiusForValue, radarSeriesPath, radarValueAtPoint, radarVertexPoint, registerComponentDescriptor, relativeOffsetOnRectangleSide, renderPieLabels, representativeColor, resolveChartShadow, resolvePieRadii, resolveRollingNumberStyle, rightRoundedRectPath, rotatedBounds, roundedBarPath, roundedOrthogonalPathData, roundedPolygonPath, rowTop, ruleAtProp, ruleTextProp, sameHueContrastColor, sameHueTint, segmentedBarPath, seriesColorProp, seriesLabelOffsetXProp, seriesLabelOffsetYProp, seriesLabelProp, seriesValueColorProp, seriesValueProp, sflToCanvasState, stackRank, stackSequence, stackedSegment, tag, tokenizeSource, topRoundedRectPath, wrapText, zoneColorAtValue };
|
|
4872
|
-
//# sourceMappingURL=chunk-
|
|
4873
|
-
//# sourceMappingURL=chunk-
|
|
5309
|
+
export { AXIS_COS, AXIS_SIN, BAR_LABEL, CATEGORY_LABEL_ROW, CHART_COLORS, CHART_TITLE_PROP, CHART_TYPES, COMPONENT_CATEGORIES, CORNER_RADIUS_ATTR, DEFAULT_FONT, DEFAULT_HEATMAP_ZONES, DEFAULT_HEX_RADIUS, DEFAULT_ROLLING_NUMBER_STYLE, DEFAULT_ZONE_FILL, DOM_CONTRACT_VERSION, EMPTY_BOUNDS, ISOMETRIC_LABEL_OFFSET_ATTR, ISOMETRIC_SIZE_ATTR, LABEL_WIDTH, LEADER_INSET, PATH_CLOSED_ATTR, PATH_POINTS_ATTR, PATH_POINT_INDEX_ATTR, PATH_TENSION_ATTR, SQUARE_CORNER_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, VISIBLE_ISOMETRIC_FACES, angleForAxisValue, axisBands, axisLabelProp, barCategoryCount, barLabelSize, barPath, barShapePath, bottomRoundedRectPath, boxBounds, calculateLinkRoute, canonicalizeSource, categoryProp, chartText, chartTicks, cleanFootprint, clipSegmentToRect, colorWithAlpha, componentRegistryVersion, componentTypes, computeBoxplotStats, contrastTextColor, cornersRoundedRectPath, createPieGeometry, createPieSlicePath, createVerticalErrorWhiskerNode, deriveFaceFills, edgePointToward, elementCenter, ellipsizeToWidth, errorBarRange, estimateTextWidth, extrudeFootprint, finite, flattenPath, formatBarLabel, formatFieldValue, formatRollingNumber, freeformPathData, gapInsetAngle, getComponentDescriptor, getLineMidpoint, heuristicRichMeasure, horizontalRows, interpolateHexColorStops, isBuiltInComponentType, isChartObject, isDimensionObject, isGenericComponent, isHorizontalBar, isIsometricObject, isLightColor, isPathObject, isSwimlaneObject, isometricBounds, isometricFaceCenter, isometricFaces, isometricTopFaceCenter, labelGapDash, leftRoundedRectPath, linePathData, localShapePath, mapChartValue, maxApexCornerRadius, maxPieCornerRadius, paint, parseSource, pathBounds, pathToSymbol, personLabelArea, pieApexRadius, pieArcPoint, pieUsesInnerArc, pillCornerRadius, pillPath, pointAtNormalizedPort, pointAtPort, radarCategoryCount, radarPointAt, radarRadius, radarRadiusForValue, radarSeriesPath, radarValueAtPoint, radarVertexPoint, registerComponentDescriptor, relativeOffsetOnRectangleSide, renderPieLabels, representativeColor, resolveChartShadow, resolvePieRadii, resolveRollingNumberStyle, rightRoundedRectPath, rotatedBounds, roundedBarPath, roundedOrthogonalPathData, roundedPolygonPath, rowTop, ruleAtProp, ruleTextProp, sameHueContrastColor, sameHueTint, segmentedBarPath, seriesColorProp, seriesLabelOffsetXProp, seriesLabelOffsetYProp, seriesLabelProp, seriesValueColorProp, seriesValueProp, sflToCanvasState, shadeFill, stackRank, stackSequence, stackedSegment, symbolToPath, tag, tokenizeSource, topRoundedRectPath, wrapText, zoneColorAtValue };
|
|
5310
|
+
//# sourceMappingURL=chunk-JQK4IGXJ.js.map
|
|
5311
|
+
//# sourceMappingURL=chunk-JQK4IGXJ.js.map
|