stickyflow 0.6.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 +27 -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-WQRT5PVT.cjs → chunk-A73UJ5AQ.cjs} +1165 -672
- package/dist/chunk-A73UJ5AQ.cjs.map +1 -0
- package/dist/{chunk-KTNCDNDB.cjs → chunk-BUOWM3LC.cjs} +745 -62
- package/dist/chunk-BUOWM3LC.cjs.map +1 -0
- package/dist/{chunk-4LENHH6C.cjs → chunk-EKAWJFJQ.cjs} +15 -15
- package/dist/{chunk-4LENHH6C.cjs.map → chunk-EKAWJFJQ.cjs.map} +1 -1
- package/dist/{chunk-MFNUJA26.js → chunk-JCRPLPKV.js} +156 -23
- package/dist/chunk-JCRPLPKV.js.map +1 -0
- package/dist/{chunk-4G2R7PEL.js → chunk-JQK4IGXJ.js} +173 -9
- package/dist/chunk-JQK4IGXJ.js.map +1 -0
- package/dist/{chunk-XJ4W6TW4.cjs → chunk-KXYSO6GC.cjs} +174 -8
- package/dist/chunk-KXYSO6GC.cjs.map +1 -0
- package/dist/{chunk-WRDVNMFS.js → chunk-MUKIGLR5.js} +717 -34
- package/dist/chunk-MUKIGLR5.js.map +1 -0
- package/dist/{chunk-JIJMZMGY.cjs → chunk-OWNVXKXN.cjs} +170 -37
- package/dist/chunk-OWNVXKXN.cjs.map +1 -0
- package/dist/{chunk-FVHVOJS2.js → chunk-SDMQRSRW.js} +549 -57
- package/dist/chunk-SDMQRSRW.js.map +1 -0
- package/dist/{chunk-ULQZ6CZW.js → chunk-ZNHYW47T.js} +3 -3
- package/dist/{chunk-ULQZ6CZW.js.map → chunk-ZNHYW47T.js.map} +1 -1
- package/dist/index.cjs +42 -34
- package/dist/index.d.cts +34 -6
- package/dist/index.d.ts +34 -6
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +230 -230
- package/dist/interaction/index.d.cts +2 -2
- package/dist/interaction/index.d.ts +2 -2
- package/dist/interaction/index.js +2 -2
- package/dist/{render-Db0eSz_s.d.cts → render-BU2uYzjG.d.cts} +4 -1
- package/dist/{render-Db0eSz_s.d.ts → render-BU2uYzjG.d.ts} +4 -1
- package/dist/{runtime-BhivvBeL.d.cts → runtime-B7KiTmn8.d.cts} +2 -2
- package/dist/{runtime-n2yG-_j-.d.ts → runtime-BPzyD-Nd.d.ts} +2 -2
- package/dist/{runtimeTypes-DnI7mRF5.d.ts → runtimeTypes-BIP70z72.d.cts} +2 -1
- package/dist/{runtimeTypes-CrkMHvVi.d.cts → runtimeTypes-DalvhScn.d.ts} +2 -1
- package/dist/stickyflow-diagram.global.js +387 -36
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-D4cH4f1a.d.ts → types-DMWs27Hn.d.ts} +1 -1
- package/dist/{types-BHfUKT4s.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-4G2R7PEL.js.map +0 -1
- package/dist/chunk-FVHVOJS2.js.map +0 -1
- package/dist/chunk-JIJMZMGY.cjs.map +0 -1
- package/dist/chunk-KTNCDNDB.cjs.map +0 -1
- package/dist/chunk-MFNUJA26.js.map +0 -1
- package/dist/chunk-WQRT5PVT.cjs.map +0 -1
- package/dist/chunk-WRDVNMFS.js.map +0 -1
- package/dist/chunk-XJ4W6TW4.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, clipSegmentToRect, formatFieldValue, renderPieLabels, interpolateHexColorStops, contrastTextColor, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, zoneColorAtValue, ellipsizeToWidth, barPath, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath, resolveRollingNumberStyle, formatRollingNumber } from './chunk-
|
|
1
|
+
import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, clipSegmentToRect, formatFieldValue, renderPieLabels, interpolateHexColorStops, contrastTextColor, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, zoneColorAtValue, ellipsizeToWidth, barPath, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath, resolveRollingNumberStyle, formatRollingNumber } from './chunk-JQK4IGXJ.js';
|
|
2
2
|
|
|
3
3
|
// src/renderInput/styleDecoding/colorToken.ts
|
|
4
4
|
var COLOR_TOKEN_PATTERN = String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;
|
|
@@ -1332,7 +1332,7 @@ function buildTickScale(component, index) {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
function buildTickLabels(component, box) {
|
|
1334
1334
|
const labels = component.labels ?? {};
|
|
1335
|
-
const
|
|
1335
|
+
const ticks2 = Math.max(1, finite(Number(component.parameters.ticks), 48));
|
|
1336
1336
|
const major = Math.max(1, finite(Number(component.parameters.major), 5));
|
|
1337
1337
|
const start = finite(Number(component.parameters.start), 225) * Math.PI / 180;
|
|
1338
1338
|
const sweep = finite(Number(component.parameters.sweep), 270) * Math.PI / 180;
|
|
@@ -1340,10 +1340,10 @@ function buildTickLabels(component, box) {
|
|
|
1340
1340
|
const fontSize = finite(labels.size, 12);
|
|
1341
1341
|
const centerX = box.x + box.width / 2;
|
|
1342
1342
|
const centerY = box.y + box.height / 2;
|
|
1343
|
-
const count = Math.floor(
|
|
1343
|
+
const count = Math.floor(ticks2 / major);
|
|
1344
1344
|
const nodes = [];
|
|
1345
1345
|
for (let step = 0; step <= count; step += 1) {
|
|
1346
|
-
const fraction = step * major /
|
|
1346
|
+
const fraction = step * major / ticks2;
|
|
1347
1347
|
const angle = start - fraction * sweep;
|
|
1348
1348
|
const labelX2 = centerX + Math.cos(angle) * radius * (box.width / 2);
|
|
1349
1349
|
const labelY = centerY - Math.sin(angle) * radius * (box.height / 2);
|
|
@@ -1398,7 +1398,7 @@ function buildRuler(component, index) {
|
|
|
1398
1398
|
function buildRulerLabels(component, box) {
|
|
1399
1399
|
const labels = component.labels ?? {};
|
|
1400
1400
|
const horizontal = component.parameters.axis === "horizontal";
|
|
1401
|
-
const
|
|
1401
|
+
const ticks2 = Math.max(1, finite(Number(component.parameters.ticks), 50));
|
|
1402
1402
|
const major = Math.max(1, finite(Number(component.parameters.major), 5));
|
|
1403
1403
|
const inset = finite(Number(component.parameters.inset), 0.05) > 0 ? finite(Number(component.parameters.inset), 0.05) : 0.05;
|
|
1404
1404
|
const line = finite(Number(component.parameters.line), 0.7) > 0 ? finite(Number(component.parameters.line), 0.7) : 0.7;
|
|
@@ -1406,10 +1406,10 @@ function buildRulerLabels(component, box) {
|
|
|
1406
1406
|
const tickLength = (finite(Number(component.parameters.length), 0.1) > 0 ? finite(Number(component.parameters.length), 0.1) : 0.1) * across * 1.9;
|
|
1407
1407
|
const edge = line * across - 0.12 * across - tickLength - finite(labels.offset, 0.04) * across;
|
|
1408
1408
|
const fontSize = finite(labels.size, 12);
|
|
1409
|
-
const count = Math.floor(
|
|
1409
|
+
const count = Math.floor(ticks2 / major);
|
|
1410
1410
|
const nodes = [];
|
|
1411
1411
|
for (let step = 0; step <= count; step += 1) {
|
|
1412
|
-
const fraction = step * major /
|
|
1412
|
+
const fraction = step * major / ticks2;
|
|
1413
1413
|
const along2 = inset + (1 - 2 * inset) * fraction;
|
|
1414
1414
|
const labelBox = horizontal ? { x: box.x + box.width * along2 - 24, y: box.y + edge - fontSize * 2, width: 48, height: fontSize * 2 } : { x: box.x + edge - 48, y: box.y + box.height * (1 - along2) - fontSize, width: 48, height: fontSize * 2 };
|
|
1415
1415
|
nodes.push({
|
|
@@ -1447,7 +1447,9 @@ var numberProperty2 = (component, key) => Number(component.properties[key] ?? 0)
|
|
|
1447
1447
|
var solid = (color) => ({ kind: "solid", color });
|
|
1448
1448
|
var ink = (component, color) => component.disabled ? DISABLED_INK : color;
|
|
1449
1449
|
function fade(component, style) {
|
|
1450
|
-
|
|
1450
|
+
const animate = Number(component.properties.animate ?? 0);
|
|
1451
|
+
const shown = component.disabled ? { ...style, opacity: 0.4 } : style;
|
|
1452
|
+
return animate > 0 ? { ...shown, transition: animate } : shown;
|
|
1451
1453
|
}
|
|
1452
1454
|
function hitArea(component, box) {
|
|
1453
1455
|
return {
|
|
@@ -1580,6 +1582,463 @@ function buildCheckbox(component, index) {
|
|
|
1580
1582
|
];
|
|
1581
1583
|
}
|
|
1582
1584
|
|
|
1585
|
+
// src/renderScene/artifacts/component/knob.ts
|
|
1586
|
+
var DOT_RATIO = 0.62;
|
|
1587
|
+
function decimals(step) {
|
|
1588
|
+
return step > 0 ? String(step).split(".")[1]?.length ?? 0 : 0;
|
|
1589
|
+
}
|
|
1590
|
+
function readout(component, fraction) {
|
|
1591
|
+
const display = textProperty(component, "display");
|
|
1592
|
+
if (display === "percent") {
|
|
1593
|
+
return `${Math.round(fraction * 100)}%`;
|
|
1594
|
+
}
|
|
1595
|
+
return display === "value" ? Number(component.value).toFixed(decimals(numberProperty2(component, "step"))) : "";
|
|
1596
|
+
}
|
|
1597
|
+
function buildKnob(component, index) {
|
|
1598
|
+
const box = controlBox(component, index, { width: 96, height: 96 });
|
|
1599
|
+
const min = numberProperty2(component, "min");
|
|
1600
|
+
const max = numberProperty2(component, "max");
|
|
1601
|
+
const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
|
|
1602
|
+
const start = numberProperty2(component, "start");
|
|
1603
|
+
const sweep = Math.min(360, Math.max(1, numberProperty2(component, "sweep")));
|
|
1604
|
+
const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 3);
|
|
1605
|
+
const cx = box.x + box.width / 2;
|
|
1606
|
+
const cy = box.y + box.height / 2;
|
|
1607
|
+
const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
|
|
1608
|
+
const circumference = 2 * Math.PI * radius;
|
|
1609
|
+
const round2 = textProperty(component, "rounded") !== "false";
|
|
1610
|
+
const angle = (start - fraction * sweep) * Math.PI / 180;
|
|
1611
|
+
const arc = (part, order, color, length, extra = {}) => ({
|
|
1612
|
+
id: `widget-${component.id}-${part}`,
|
|
1613
|
+
type: "ellipse",
|
|
1614
|
+
order: box.order + order,
|
|
1615
|
+
bounds: rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
|
|
1616
|
+
cx,
|
|
1617
|
+
cy,
|
|
1618
|
+
rx: radius,
|
|
1619
|
+
ry: radius,
|
|
1620
|
+
rotation: -start,
|
|
1621
|
+
style: fade(component, {
|
|
1622
|
+
fill: { kind: "none" },
|
|
1623
|
+
stroke: solid(color),
|
|
1624
|
+
strokeWidth: thickness,
|
|
1625
|
+
dash: [Math.max(1e-3, length), circumference],
|
|
1626
|
+
lineCap: round2 ? "round" : "butt",
|
|
1627
|
+
...extra
|
|
1628
|
+
})
|
|
1629
|
+
});
|
|
1630
|
+
const faceRadius = Math.max(1, radius - thickness / 2 - Math.max(2, thickness * 0.4));
|
|
1631
|
+
const dotRadius = thickness / 2 * DOT_RATIO + 1;
|
|
1632
|
+
const nodes = [
|
|
1633
|
+
hitArea(component, box),
|
|
1634
|
+
arc("track", 0.1, textProperty(component, "track"), sweep / 360 * circumference),
|
|
1635
|
+
arc("fill", 0.2, textProperty(component, "accent"), fraction * sweep / 360 * circumference, {
|
|
1636
|
+
opacity: fraction > 0 ? 1 : 0
|
|
1637
|
+
}),
|
|
1638
|
+
{
|
|
1639
|
+
id: `widget-${component.id}-face`,
|
|
1640
|
+
type: "ellipse",
|
|
1641
|
+
order: box.order + 0.3,
|
|
1642
|
+
bounds: rotatedBounds(
|
|
1643
|
+
{ x: cx - faceRadius, y: cy - faceRadius, width: faceRadius * 2, height: faceRadius * 2 },
|
|
1644
|
+
0,
|
|
1645
|
+
0
|
|
1646
|
+
),
|
|
1647
|
+
cx,
|
|
1648
|
+
cy,
|
|
1649
|
+
rx: faceRadius,
|
|
1650
|
+
ry: faceRadius,
|
|
1651
|
+
style: fade(component, { fill: solid(textProperty(component, "face")), stroke: { kind: "none" } })
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
id: `widget-${component.id}-dot`,
|
|
1655
|
+
type: "ellipse",
|
|
1656
|
+
order: box.order + 0.4,
|
|
1657
|
+
bounds: rotatedBounds(
|
|
1658
|
+
{
|
|
1659
|
+
x: cx + radius * Math.cos(angle) - dotRadius,
|
|
1660
|
+
y: cy - radius * Math.sin(angle) - dotRadius,
|
|
1661
|
+
width: dotRadius * 2,
|
|
1662
|
+
height: dotRadius * 2
|
|
1663
|
+
},
|
|
1664
|
+
0,
|
|
1665
|
+
0
|
|
1666
|
+
),
|
|
1667
|
+
cx: cx + radius * Math.cos(angle),
|
|
1668
|
+
cy: cy - radius * Math.sin(angle),
|
|
1669
|
+
rx: dotRadius,
|
|
1670
|
+
ry: dotRadius,
|
|
1671
|
+
style: fade(component, { fill: solid(textProperty(component, "dot")), stroke: { kind: "none" } })
|
|
1672
|
+
}
|
|
1673
|
+
];
|
|
1674
|
+
const text = readout(component, fraction);
|
|
1675
|
+
if (text) {
|
|
1676
|
+
const label = {
|
|
1677
|
+
text,
|
|
1678
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1679
|
+
fontSize: numberProperty2(component, "fontSize"),
|
|
1680
|
+
align: "center"
|
|
1681
|
+
};
|
|
1682
|
+
nodes.push(
|
|
1683
|
+
labelText(
|
|
1684
|
+
component,
|
|
1685
|
+
"value",
|
|
1686
|
+
{ x: cx - faceRadius, y: cy - faceRadius, width: faceRadius * 2, height: faceRadius * 2 },
|
|
1687
|
+
label,
|
|
1688
|
+
box.order + 0.5
|
|
1689
|
+
)
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
return nodes;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
// src/renderScene/artifacts/component/progress.ts
|
|
1696
|
+
function readout2(component, fraction) {
|
|
1697
|
+
const display = textProperty(component, "display");
|
|
1698
|
+
if (display === "percent") {
|
|
1699
|
+
return `${Math.round(fraction * 100)}%`;
|
|
1700
|
+
}
|
|
1701
|
+
return display === "value" ? String(Number(component.value)) : "";
|
|
1702
|
+
}
|
|
1703
|
+
function buildProgress(component, index) {
|
|
1704
|
+
const box = controlBox(component, index, { width: 220, height: 12 });
|
|
1705
|
+
const min = numberProperty2(component, "min");
|
|
1706
|
+
const max = numberProperty2(component, "max");
|
|
1707
|
+
const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
|
|
1708
|
+
const round2 = textProperty(component, "rounded") !== "false";
|
|
1709
|
+
const nodes = [hitArea(component, box)];
|
|
1710
|
+
if (textProperty(component, "variant") === "ring") {
|
|
1711
|
+
const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 2);
|
|
1712
|
+
const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
|
|
1713
|
+
const circumference = 2 * Math.PI * radius;
|
|
1714
|
+
const cx = box.x + box.width / 2;
|
|
1715
|
+
const cy = box.y + box.height / 2;
|
|
1716
|
+
const ring = (part, order, color, extra) => ({
|
|
1717
|
+
id: `widget-${component.id}-${part}`,
|
|
1718
|
+
type: "ellipse",
|
|
1719
|
+
order: box.order + order,
|
|
1720
|
+
bounds: rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
|
|
1721
|
+
cx,
|
|
1722
|
+
cy,
|
|
1723
|
+
rx: radius,
|
|
1724
|
+
ry: radius,
|
|
1725
|
+
rotation: -90,
|
|
1726
|
+
style: fade(component, { fill: { kind: "none" }, stroke: solid(color), strokeWidth: thickness, ...extra })
|
|
1727
|
+
});
|
|
1728
|
+
nodes.push(ring("track", 0.1, textProperty(component, "track"), {}));
|
|
1729
|
+
nodes.push(
|
|
1730
|
+
ring("fill", 0.2, textProperty(component, "accent"), {
|
|
1731
|
+
dash: [Math.max(1e-3, fraction * circumference), circumference],
|
|
1732
|
+
lineCap: round2 ? "round" : "butt",
|
|
1733
|
+
opacity: fraction > 0 ? 1 : 0
|
|
1734
|
+
})
|
|
1735
|
+
);
|
|
1736
|
+
} else {
|
|
1737
|
+
const vertical = textProperty(component, "direction") === "vertical";
|
|
1738
|
+
const radius = round2 ? (vertical ? box.width : box.height) / 2 : 0;
|
|
1739
|
+
const bar = (part, order, length, color, opacity) => {
|
|
1740
|
+
const shape = vertical ? { x: box.x, y: box.y + box.height - length, width: box.width, height: length } : { x: box.x, y: box.y, width: length, height: box.height };
|
|
1741
|
+
return {
|
|
1742
|
+
id: `widget-${component.id}-${part}`,
|
|
1743
|
+
type: "rect",
|
|
1744
|
+
order: box.order + order,
|
|
1745
|
+
bounds: rotatedBounds(shape, 0, 0),
|
|
1746
|
+
...shape,
|
|
1747
|
+
rx: radius,
|
|
1748
|
+
style: fade(component, {
|
|
1749
|
+
fill: solid(color),
|
|
1750
|
+
stroke: { kind: "none" },
|
|
1751
|
+
...opacity === void 0 ? {} : { opacity }
|
|
1752
|
+
})
|
|
1753
|
+
};
|
|
1754
|
+
};
|
|
1755
|
+
const full = vertical ? box.height : box.width;
|
|
1756
|
+
nodes.push(bar("track", 0.1, full, textProperty(component, "track")));
|
|
1757
|
+
nodes.push(bar("fill", 0.2, Math.max(0, fraction * full), textProperty(component, "accent"), fraction > 0 ? 1 : 0));
|
|
1758
|
+
}
|
|
1759
|
+
const text = readout2(component, fraction);
|
|
1760
|
+
if (text) {
|
|
1761
|
+
const label = {
|
|
1762
|
+
text,
|
|
1763
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1764
|
+
fontSize: numberProperty2(component, "fontSize"),
|
|
1765
|
+
align: "center"
|
|
1766
|
+
};
|
|
1767
|
+
nodes.push(labelText(component, "value", box, label, box.order + 0.3));
|
|
1768
|
+
}
|
|
1769
|
+
return nodes;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// src/renderScene/artifacts/component/segmented.ts
|
|
1773
|
+
function buildSegmented(component, index) {
|
|
1774
|
+
const box = controlBox(component, index, { width: 300, height: 40 });
|
|
1775
|
+
const options = textProperty(component, "options").split(",").map((option) => option.trim()).filter(Boolean);
|
|
1776
|
+
const count = Math.max(1, options.length);
|
|
1777
|
+
const active = Math.min(count - 1, Math.max(0, Math.round(Number(component.value)) || 0));
|
|
1778
|
+
const inset = Math.min(numberProperty2(component, "inset"), box.height / 2);
|
|
1779
|
+
const radius = Math.min(numberProperty2(component, "radius"), box.height / 2);
|
|
1780
|
+
const cellWidth = (box.width - inset * 2) / count;
|
|
1781
|
+
const cell = { y: box.y + inset, height: box.height - inset * 2 };
|
|
1782
|
+
const nodes = [
|
|
1783
|
+
hitArea(component, box),
|
|
1784
|
+
{
|
|
1785
|
+
id: `widget-${component.id}-track`,
|
|
1786
|
+
type: "rect",
|
|
1787
|
+
order: box.order + 0.1,
|
|
1788
|
+
bounds: rotatedBounds(box, 0, 0),
|
|
1789
|
+
x: box.x,
|
|
1790
|
+
y: box.y,
|
|
1791
|
+
width: box.width,
|
|
1792
|
+
height: box.height,
|
|
1793
|
+
rx: radius,
|
|
1794
|
+
style: fade(component, { fill: solid(textProperty(component, "track")), stroke: { kind: "none" } })
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
id: `widget-${component.id}-active`,
|
|
1798
|
+
type: "rect",
|
|
1799
|
+
order: box.order + 0.2,
|
|
1800
|
+
bounds: rotatedBounds({ x: box.x + inset + active * cellWidth, width: cellWidth, ...cell }, 0, 0),
|
|
1801
|
+
x: box.x + inset + active * cellWidth,
|
|
1802
|
+
y: cell.y,
|
|
1803
|
+
width: cellWidth,
|
|
1804
|
+
height: cell.height,
|
|
1805
|
+
rx: Math.max(0, radius - inset),
|
|
1806
|
+
style: fade(component, {
|
|
1807
|
+
fill: solid(textProperty(component, "accent")),
|
|
1808
|
+
stroke: { kind: "none" },
|
|
1809
|
+
shadow: { color: "#000000", opacity: 0.18, blur: 3, dx: 0, dy: 1 }
|
|
1810
|
+
})
|
|
1811
|
+
}
|
|
1812
|
+
];
|
|
1813
|
+
options.forEach((option, position) => {
|
|
1814
|
+
const area = { x: box.x + inset + position * cellWidth, width: cellWidth, ...cell };
|
|
1815
|
+
const color = ink(component, textProperty(component, position === active ? "activeTextColor" : "textColor"));
|
|
1816
|
+
nodes.push(
|
|
1817
|
+
labelText(
|
|
1818
|
+
component,
|
|
1819
|
+
`option-${position}`,
|
|
1820
|
+
area,
|
|
1821
|
+
{ text: option, color, fontSize: numberProperty2(component, "fontSize"), align: "center" },
|
|
1822
|
+
box.order + 0.3
|
|
1823
|
+
)
|
|
1824
|
+
);
|
|
1825
|
+
});
|
|
1826
|
+
return nodes;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// src/model/component/sliderReach.ts
|
|
1830
|
+
function sliderReach(variant2, height) {
|
|
1831
|
+
return variant2 === "field" ? Math.min(8, height / 2) : height / 2;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// src/renderScene/artifacts/component/slider.ts
|
|
1835
|
+
var HANDLE_WIDTH = 4;
|
|
1836
|
+
var TEXT_PADDING = 12;
|
|
1837
|
+
var TICK_LENGTH = 5;
|
|
1838
|
+
var TICK_THICKNESS = 1.5;
|
|
1839
|
+
function decimals2(step) {
|
|
1840
|
+
return step > 0 ? String(step).split(".")[1]?.length ?? 0 : 0;
|
|
1841
|
+
}
|
|
1842
|
+
function readout3(component, thumbs) {
|
|
1843
|
+
const display = textProperty(component, "display");
|
|
1844
|
+
const places = decimals2(numberProperty2(component, "step"));
|
|
1845
|
+
const parts = display === "percent" ? thumbs.two ? [thumbs.from, thumbs.to].map((fraction) => `${Math.round(fraction * 100)}%`) : [`${Math.round(thumbs.to * 100)}%`] : display === "value" ? thumbs.values.map((value) => value.toFixed(places)) : [];
|
|
1846
|
+
return parts.join(" \u2013 ");
|
|
1847
|
+
}
|
|
1848
|
+
var rect = (component, box, part, order, shape, color, extra = {}) => ({
|
|
1849
|
+
id: `widget-${component.id}-${part}`,
|
|
1850
|
+
type: "rect",
|
|
1851
|
+
order: box.order + order,
|
|
1852
|
+
bounds: rotatedBounds(shape, 0, 0),
|
|
1853
|
+
...shape,
|
|
1854
|
+
style: fade(component, { fill: solid(color), stroke: { kind: "none" }, ...extra })
|
|
1855
|
+
});
|
|
1856
|
+
function ticks(component, box, vertical, reach, offset) {
|
|
1857
|
+
const count = Math.round(numberProperty2(component, "ticks"));
|
|
1858
|
+
const color = textProperty(component, "tickColor");
|
|
1859
|
+
return Array.from({ length: count >= 2 ? count : 0 }, (_, index) => {
|
|
1860
|
+
const t = index / (count - 1);
|
|
1861
|
+
const shape = vertical ? {
|
|
1862
|
+
x: box.x + offset,
|
|
1863
|
+
y: box.y + box.height - reach - t * (box.height - reach * 2) - TICK_THICKNESS / 2,
|
|
1864
|
+
width: TICK_LENGTH,
|
|
1865
|
+
height: TICK_THICKNESS,
|
|
1866
|
+
rx: TICK_THICKNESS / 2
|
|
1867
|
+
} : {
|
|
1868
|
+
x: box.x + reach + t * (box.width - reach * 2) - TICK_THICKNESS / 2,
|
|
1869
|
+
y: box.y + offset,
|
|
1870
|
+
width: TICK_THICKNESS,
|
|
1871
|
+
height: TICK_LENGTH,
|
|
1872
|
+
rx: TICK_THICKNESS / 2
|
|
1873
|
+
};
|
|
1874
|
+
return rect(component, box, `tick-${index}`, 0.15, shape, color);
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
function buildLine(component, box, thumbs, vertical) {
|
|
1878
|
+
const reach = sliderReach("line", vertical ? box.width : box.height);
|
|
1879
|
+
const radius = reach * numberProperty2(component, "thumbSize") / 100;
|
|
1880
|
+
const thickness = Math.min(numberProperty2(component, "trackHeight"), vertical ? box.width : box.height);
|
|
1881
|
+
const mid = vertical ? box.x + box.width / 2 : box.y + box.height / 2;
|
|
1882
|
+
const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
|
|
1883
|
+
const line = (start, end) => vertical ? {
|
|
1884
|
+
x: mid - thickness / 2,
|
|
1885
|
+
y: Math.min(start, end),
|
|
1886
|
+
width: thickness,
|
|
1887
|
+
height: Math.abs(end - start),
|
|
1888
|
+
rx: thickness / 2
|
|
1889
|
+
} : {
|
|
1890
|
+
x: Math.min(start, end),
|
|
1891
|
+
y: mid - thickness / 2,
|
|
1892
|
+
width: Math.abs(end - start),
|
|
1893
|
+
height: thickness,
|
|
1894
|
+
rx: thickness / 2
|
|
1895
|
+
};
|
|
1896
|
+
const whole = vertical ? line(box.y, box.y + box.height) : line(box.x, box.x + box.width);
|
|
1897
|
+
const filled = line(thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x, along2(thumbs.to));
|
|
1898
|
+
const thumb = (part, fraction, order) => {
|
|
1899
|
+
const cx = vertical ? mid : along2(fraction);
|
|
1900
|
+
const cy = vertical ? along2(fraction) : mid;
|
|
1901
|
+
return {
|
|
1902
|
+
id: `widget-${component.id}-${part}`,
|
|
1903
|
+
type: "ellipse",
|
|
1904
|
+
order: box.order + order,
|
|
1905
|
+
bounds: rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, 0),
|
|
1906
|
+
cx,
|
|
1907
|
+
cy,
|
|
1908
|
+
rx: radius,
|
|
1909
|
+
ry: radius,
|
|
1910
|
+
style: fade(component, {
|
|
1911
|
+
fill: solid(textProperty(component, "thumb")),
|
|
1912
|
+
stroke: { kind: "none" },
|
|
1913
|
+
shadow: { color: "#000000", opacity: 0.25, blur: 3, dx: 0, dy: 1 }
|
|
1914
|
+
})
|
|
1915
|
+
};
|
|
1916
|
+
};
|
|
1917
|
+
return [
|
|
1918
|
+
rect(component, box, "track", 0.1, whole, textProperty(component, "track")),
|
|
1919
|
+
...ticks(
|
|
1920
|
+
component,
|
|
1921
|
+
box,
|
|
1922
|
+
vertical,
|
|
1923
|
+
reach,
|
|
1924
|
+
vertical ? box.width / 2 + thickness / 2 + 5 : box.height / 2 + thickness / 2 + 5
|
|
1925
|
+
),
|
|
1926
|
+
rect(component, box, "fill", 0.2, filled, textProperty(component, "accent")),
|
|
1927
|
+
...thumbs.two ? [thumb("thumb-start", thumbs.from, 0.3)] : [],
|
|
1928
|
+
thumb(thumbs.two ? "thumb-end" : "thumb", thumbs.to, 0.31)
|
|
1929
|
+
];
|
|
1930
|
+
}
|
|
1931
|
+
function buildField(component, box, thumbs, vertical) {
|
|
1932
|
+
const reach = sliderReach("field", vertical ? box.width : box.height);
|
|
1933
|
+
const radius = Math.min(numberProperty2(component, "radius"), Math.min(box.width, box.height) / 2);
|
|
1934
|
+
const whole = { x: box.x, y: box.y, width: box.width, height: box.height, rx: radius };
|
|
1935
|
+
const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
|
|
1936
|
+
const start = thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x;
|
|
1937
|
+
const end = along2(thumbs.to);
|
|
1938
|
+
const first = Math.min(start, end) - (thumbs.two ? HANDLE_WIDTH / 2 : 0);
|
|
1939
|
+
const last = Math.max(start, end) + HANDLE_WIDTH / 2;
|
|
1940
|
+
const filled = vertical ? {
|
|
1941
|
+
...whole,
|
|
1942
|
+
y: thumbs.two ? first : end - HANDLE_WIDTH / 2,
|
|
1943
|
+
height: thumbs.two ? last - first : Math.max(0, box.y + box.height - end + HANDLE_WIDTH / 2),
|
|
1944
|
+
rx: thumbs.two ? 0 : radius
|
|
1945
|
+
} : {
|
|
1946
|
+
...whole,
|
|
1947
|
+
x: thumbs.two ? first : box.x,
|
|
1948
|
+
width: thumbs.two ? last - first : Math.max(0, end + HANDLE_WIDTH / 2 - box.x),
|
|
1949
|
+
rx: thumbs.two ? 0 : radius
|
|
1950
|
+
};
|
|
1951
|
+
const handleLength = (vertical ? box.width : box.height) * 0.5;
|
|
1952
|
+
const handle = (part, at) => {
|
|
1953
|
+
const shape = vertical ? {
|
|
1954
|
+
x: box.x + (box.width - handleLength) / 2,
|
|
1955
|
+
y: at - HANDLE_WIDTH / 2,
|
|
1956
|
+
width: handleLength,
|
|
1957
|
+
height: HANDLE_WIDTH,
|
|
1958
|
+
rx: HANDLE_WIDTH / 2
|
|
1959
|
+
} : {
|
|
1960
|
+
x: at - HANDLE_WIDTH / 2,
|
|
1961
|
+
y: box.y + (box.height - handleLength) / 2,
|
|
1962
|
+
width: HANDLE_WIDTH,
|
|
1963
|
+
height: handleLength,
|
|
1964
|
+
rx: HANDLE_WIDTH / 2
|
|
1965
|
+
};
|
|
1966
|
+
return rect(component, box, part, 0.3, shape, textProperty(component, "accent"));
|
|
1967
|
+
};
|
|
1968
|
+
const nodes = [
|
|
1969
|
+
rect(component, box, "track", 0.1, whole, textProperty(component, "surface")),
|
|
1970
|
+
rect(component, box, "fill", 0.2, filled, textProperty(component, "fill")),
|
|
1971
|
+
...thumbs.two ? [handle("handle-start", start)] : [],
|
|
1972
|
+
handle(thumbs.two ? "handle-end" : "handle", end)
|
|
1973
|
+
];
|
|
1974
|
+
const text = {
|
|
1975
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1976
|
+
fontSize: numberProperty2(component, "fontSize")
|
|
1977
|
+
};
|
|
1978
|
+
const value = readout3(component, thumbs);
|
|
1979
|
+
if (vertical) {
|
|
1980
|
+
if (value) {
|
|
1981
|
+
nodes.push(
|
|
1982
|
+
labelText(
|
|
1983
|
+
component,
|
|
1984
|
+
"value",
|
|
1985
|
+
{ x: box.x, y: box.y + 6, width: box.width, height: 20 },
|
|
1986
|
+
{ ...text, text: value, align: "center" },
|
|
1987
|
+
box.order + 0.4
|
|
1988
|
+
)
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
return nodes;
|
|
1992
|
+
}
|
|
1993
|
+
const inner = { y: box.y, height: box.height, width: Math.max(0, box.width / 2 - TEXT_PADDING) };
|
|
1994
|
+
if (component.label) {
|
|
1995
|
+
nodes.push(
|
|
1996
|
+
labelText(
|
|
1997
|
+
component,
|
|
1998
|
+
"label",
|
|
1999
|
+
{ x: box.x + TEXT_PADDING, ...inner },
|
|
2000
|
+
{ ...text, text: component.label, align: "left" },
|
|
2001
|
+
box.order + 0.4
|
|
2002
|
+
)
|
|
2003
|
+
);
|
|
2004
|
+
}
|
|
2005
|
+
if (value) {
|
|
2006
|
+
nodes.push(
|
|
2007
|
+
labelText(
|
|
2008
|
+
component,
|
|
2009
|
+
"value",
|
|
2010
|
+
{ x: box.x + box.width / 2, ...inner },
|
|
2011
|
+
{ ...text, text: value, align: "right" },
|
|
2012
|
+
box.order + 0.4
|
|
2013
|
+
)
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
nodes.push(...ticks(component, box, false, reach, box.height - TICK_LENGTH - 5));
|
|
2017
|
+
return nodes;
|
|
2018
|
+
}
|
|
2019
|
+
function buildSlider(component, index) {
|
|
2020
|
+
const field = textProperty(component, "variant") === "field";
|
|
2021
|
+
const vertical = textProperty(component, "direction") === "vertical";
|
|
2022
|
+
const fallback = vertical ? { width: field ? 56 : 28, height: 180 } : { width: 220, height: field ? 36 : 28 };
|
|
2023
|
+
const box = controlBox(component, index, fallback);
|
|
2024
|
+
const min = numberProperty2(component, "min");
|
|
2025
|
+
const max = numberProperty2(component, "max");
|
|
2026
|
+
const fractionOf = (value) => Math.min(1, Math.max(0, (value - min) / (max - min || 1)));
|
|
2027
|
+
const two = component.type === "range";
|
|
2028
|
+
const low = Number(component.value);
|
|
2029
|
+
const high = two ? Number(component.properties.valueEnd ?? max) : low;
|
|
2030
|
+
const thumbs = {
|
|
2031
|
+
from: fractionOf(two ? Math.min(low, high) : min),
|
|
2032
|
+
to: fractionOf(two ? Math.max(low, high) : low),
|
|
2033
|
+
values: two ? [Math.min(low, high), Math.max(low, high)] : [low],
|
|
2034
|
+
two
|
|
2035
|
+
};
|
|
2036
|
+
return [
|
|
2037
|
+
hitArea(component, box),
|
|
2038
|
+
...field ? buildField(component, box, thumbs, vertical) : buildLine(component, box, thumbs, vertical)
|
|
2039
|
+
];
|
|
2040
|
+
}
|
|
2041
|
+
|
|
1583
2042
|
// src/renderScene/artifacts/component/switch.ts
|
|
1584
2043
|
var PADDING_RATIO = 0.12;
|
|
1585
2044
|
function buildSwitch(component, index) {
|
|
@@ -1668,7 +2127,12 @@ var builders = /* @__PURE__ */ new Map([
|
|
|
1668
2127
|
["switch", asComponentBuilder(buildSwitch)],
|
|
1669
2128
|
["checkbox", asComponentBuilder(buildCheckbox)],
|
|
1670
2129
|
["toggleButton", asComponentBuilder(buildToggleButton)],
|
|
1671
|
-
["button", asComponentBuilder(buildButton)]
|
|
2130
|
+
["button", asComponentBuilder(buildButton)],
|
|
2131
|
+
["slider", asComponentBuilder(buildSlider)],
|
|
2132
|
+
["progress", asComponentBuilder(buildProgress)],
|
|
2133
|
+
["segmented", asComponentBuilder(buildSegmented)],
|
|
2134
|
+
["knob", asComponentBuilder(buildKnob)],
|
|
2135
|
+
["range", asComponentBuilder(buildSlider)]
|
|
1672
2136
|
]);
|
|
1673
2137
|
function registerComponentBuilder(type, builder) {
|
|
1674
2138
|
builders.set(type, builder);
|
|
@@ -3073,6 +3537,46 @@ function renderShapeGeometry(context) {
|
|
|
3073
3537
|
return renderer(context);
|
|
3074
3538
|
}
|
|
3075
3539
|
|
|
3540
|
+
// src/renderScene/artifacts/shape/shaderSurface.ts
|
|
3541
|
+
var RECT_PROGRAMS = /* @__PURE__ */ new Set(["reactivePanel", "ledMatrix", "lightBand", "silkFolds"]);
|
|
3542
|
+
function shaderMask(context) {
|
|
3543
|
+
if (context.shape.shapeType === "circle" || context.shape.shapeType === "oval") {
|
|
3544
|
+
return "ellipse";
|
|
3545
|
+
}
|
|
3546
|
+
const rectangular = context.shape.shapeType === "rectangle" || context.shape.shapeType === "rounded_rectangle";
|
|
3547
|
+
if (rectangular && context.shape.shader && RECT_PROGRAMS.has(context.shape.shader.program)) {
|
|
3548
|
+
return "rect";
|
|
3549
|
+
}
|
|
3550
|
+
return void 0;
|
|
3551
|
+
}
|
|
3552
|
+
function renderShapeShaderSurface(context) {
|
|
3553
|
+
if (!context.shape.shader) {
|
|
3554
|
+
return void 0;
|
|
3555
|
+
}
|
|
3556
|
+
const mask = shaderMask(context);
|
|
3557
|
+
if (!mask) {
|
|
3558
|
+
return void 0;
|
|
3559
|
+
}
|
|
3560
|
+
const padding = mask === "rect" ? Math.max(0, context.shape.shader.surfacePadding ?? 0) : 0;
|
|
3561
|
+
const surfaceBounds = {
|
|
3562
|
+
x: context.x - padding,
|
|
3563
|
+
y: context.y - padding,
|
|
3564
|
+
width: context.width + padding * 2,
|
|
3565
|
+
height: context.height + padding * 2
|
|
3566
|
+
};
|
|
3567
|
+
return {
|
|
3568
|
+
id: `${context.id}-shader`,
|
|
3569
|
+
type: "shader-surface",
|
|
3570
|
+
order: context.order,
|
|
3571
|
+
bounds: rotatedBounds(surfaceBounds, context.rotation, 0),
|
|
3572
|
+
...surfaceBounds,
|
|
3573
|
+
rotation: context.rotation,
|
|
3574
|
+
shader: context.shape.shader,
|
|
3575
|
+
mask,
|
|
3576
|
+
fillColor: context.style.fill?.kind === "solid" ? context.style.fill.color : void 0
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3076
3580
|
// src/renderScene/artifacts/shape/style.ts
|
|
3077
3581
|
var REMOVED_SHAPE_HINTS = {
|
|
3078
3582
|
container_rectangle: " (use 'rectangle' with strokeStyle: dashed)"
|
|
@@ -3315,32 +3819,13 @@ function createRenderContext(shape, index, diagnostics) {
|
|
|
3315
3819
|
}
|
|
3316
3820
|
};
|
|
3317
3821
|
}
|
|
3318
|
-
function renderShaderSurface(context) {
|
|
3319
|
-
if (!context.shape.shader || context.shape.shapeType !== "circle" && context.shape.shapeType !== "oval") {
|
|
3320
|
-
return void 0;
|
|
3321
|
-
}
|
|
3322
|
-
return {
|
|
3323
|
-
id: `${context.id}-shader`,
|
|
3324
|
-
type: "shader-surface",
|
|
3325
|
-
order: context.order,
|
|
3326
|
-
bounds: context.bounds,
|
|
3327
|
-
x: context.x,
|
|
3328
|
-
y: context.y,
|
|
3329
|
-
width: context.width,
|
|
3330
|
-
height: context.height,
|
|
3331
|
-
rotation: context.rotation,
|
|
3332
|
-
shader: context.shape.shader,
|
|
3333
|
-
mask: "ellipse",
|
|
3334
|
-
fillColor: context.style.fill?.kind === "solid" ? context.style.fill.color : void 0
|
|
3335
|
-
};
|
|
3336
|
-
}
|
|
3337
3822
|
function buildShape(shape, index, diagnostics, measureText) {
|
|
3338
3823
|
if (shape.isVisible === false) {
|
|
3339
3824
|
return [];
|
|
3340
3825
|
}
|
|
3341
3826
|
const { context, strokeWidth } = createRenderContext(shape, index, diagnostics);
|
|
3342
3827
|
const nodes = shape.strokeStyle === "double" ? renderDoubleStroke(context, strokeWidth || 1) : renderShapeGeometry(context);
|
|
3343
|
-
const shader =
|
|
3828
|
+
const shader = renderShapeShaderSurface(context);
|
|
3344
3829
|
if (shader) {
|
|
3345
3830
|
for (const node of nodes) {
|
|
3346
3831
|
if (node.type === "ellipse" || node.type === "path" || node.type === "rect") {
|
|
@@ -4172,19 +4657,19 @@ function buildChartBackdrop(chart, bounds, order) {
|
|
|
4172
4657
|
if (!chart.fillImage) {
|
|
4173
4658
|
return [];
|
|
4174
4659
|
}
|
|
4175
|
-
const
|
|
4660
|
+
const rect2 = chartImageRect(chart);
|
|
4176
4661
|
const nodes = [
|
|
4177
4662
|
{
|
|
4178
4663
|
type: "image",
|
|
4179
4664
|
id: `chart-image-${chart.id}`,
|
|
4180
4665
|
order: order.next(),
|
|
4181
4666
|
bounds,
|
|
4182
|
-
x:
|
|
4183
|
-
y:
|
|
4184
|
-
width:
|
|
4185
|
-
height:
|
|
4667
|
+
x: rect2.x,
|
|
4668
|
+
y: rect2.y,
|
|
4669
|
+
width: rect2.width,
|
|
4670
|
+
height: rect2.height,
|
|
4186
4671
|
href: chart.fillImage.url,
|
|
4187
|
-
style: { clip: { type: "rect", ...
|
|
4672
|
+
style: { clip: { type: "rect", ...rect2 }, pointerEvents: "none" }
|
|
4188
4673
|
}
|
|
4189
4674
|
];
|
|
4190
4675
|
if (chart.fillImage.overlay) {
|
|
@@ -4193,11 +4678,11 @@ function buildChartBackdrop(chart, bounds, order) {
|
|
|
4193
4678
|
id: `chart-image-overlay-${chart.id}`,
|
|
4194
4679
|
order: order.next(),
|
|
4195
4680
|
bounds,
|
|
4196
|
-
x:
|
|
4197
|
-
y:
|
|
4198
|
-
width:
|
|
4199
|
-
height:
|
|
4200
|
-
rx:
|
|
4681
|
+
x: rect2.x,
|
|
4682
|
+
y: rect2.y,
|
|
4683
|
+
width: rect2.width,
|
|
4684
|
+
height: rect2.height,
|
|
4685
|
+
rx: rect2.rx,
|
|
4201
4686
|
style: { fill: { kind: "solid", color: chart.fillImage.overlay }, pointerEvents: "none" }
|
|
4202
4687
|
});
|
|
4203
4688
|
}
|
|
@@ -4211,17 +4696,17 @@ function createGlassBackdropNodes(context, id, d) {
|
|
|
4211
4696
|
if (blur <= 0 || !chart.fillImage) {
|
|
4212
4697
|
return [];
|
|
4213
4698
|
}
|
|
4214
|
-
const
|
|
4699
|
+
const rect2 = chartImageRect(chart);
|
|
4215
4700
|
const nodes = [
|
|
4216
4701
|
{
|
|
4217
4702
|
type: "image",
|
|
4218
4703
|
id: `chart-bar-glass-${chart.id}-${id}`,
|
|
4219
4704
|
order: nextOrder(),
|
|
4220
4705
|
bounds,
|
|
4221
|
-
x:
|
|
4222
|
-
y:
|
|
4223
|
-
width:
|
|
4224
|
-
height:
|
|
4706
|
+
x: rect2.x,
|
|
4707
|
+
y: rect2.y,
|
|
4708
|
+
width: rect2.width,
|
|
4709
|
+
height: rect2.height,
|
|
4225
4710
|
href: chart.fillImage.url,
|
|
4226
4711
|
style: {
|
|
4227
4712
|
blur,
|
|
@@ -8191,7 +8676,7 @@ function treemapLeafColor(leaf, layout) {
|
|
|
8191
8676
|
|
|
8192
8677
|
// src/renderScene/charts/renderers/treemap/legend.ts
|
|
8193
8678
|
var BAR_THICKNESS = 10;
|
|
8194
|
-
var
|
|
8679
|
+
var TICK_LENGTH2 = 4;
|
|
8195
8680
|
var ROW_GAP2 = 2;
|
|
8196
8681
|
var CHART_GAP = 16;
|
|
8197
8682
|
var LABEL_SIZE = 34;
|
|
@@ -8239,14 +8724,14 @@ function renderBottomLegend(context, layout) {
|
|
|
8239
8724
|
strokeWidth: 1
|
|
8240
8725
|
}
|
|
8241
8726
|
};
|
|
8242
|
-
const
|
|
8727
|
+
const ticks2 = layout.bands.flatMap((value, index) => {
|
|
8243
8728
|
const x = barX + bandRatio2(layout, value) * barWidth;
|
|
8244
8729
|
const tick = {
|
|
8245
8730
|
type: "path",
|
|
8246
8731
|
id: `chart-treemap-legend-tick-${chart.id}-${index}`,
|
|
8247
8732
|
order: nextOrder(),
|
|
8248
8733
|
bounds,
|
|
8249
|
-
d: `M ${x} ${barY + BAR_THICKNESS} L ${x} ${barY + BAR_THICKNESS +
|
|
8734
|
+
d: `M ${x} ${barY + BAR_THICKNESS} L ${x} ${barY + BAR_THICKNESS + TICK_LENGTH2}`,
|
|
8250
8735
|
style: {
|
|
8251
8736
|
fill: { kind: "none" },
|
|
8252
8737
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
@@ -8261,14 +8746,14 @@ function renderBottomLegend(context, layout) {
|
|
|
8261
8746
|
id: `chart-treemap-legend-tick-label-${chart.id}-${index}`,
|
|
8262
8747
|
order: nextOrder(),
|
|
8263
8748
|
bounds,
|
|
8264
|
-
frame: { x: frameX, y: barY + BAR_THICKNESS +
|
|
8749
|
+
frame: { x: frameX, y: barY + BAR_THICKNESS + TICK_LENGTH2 + ROW_GAP2, width: LABEL_SIZE, height: labelHeight },
|
|
8265
8750
|
text: formatFieldValue(value),
|
|
8266
8751
|
chart,
|
|
8267
8752
|
align
|
|
8268
8753
|
});
|
|
8269
8754
|
return [tick, label];
|
|
8270
8755
|
});
|
|
8271
|
-
return [bar, ...
|
|
8756
|
+
return [bar, ...ticks2];
|
|
8272
8757
|
}
|
|
8273
8758
|
function renderSideLegend(context, layout) {
|
|
8274
8759
|
const { chart, plot, bounds, nextOrder } = context;
|
|
@@ -8296,9 +8781,9 @@ function renderSideLegend(context, layout) {
|
|
|
8296
8781
|
}
|
|
8297
8782
|
};
|
|
8298
8783
|
const tickX = side === "left" ? barX : barX + BAR_THICKNESS;
|
|
8299
|
-
const tickEndX = side === "left" ? tickX -
|
|
8784
|
+
const tickEndX = side === "left" ? tickX - TICK_LENGTH2 : tickX + TICK_LENGTH2;
|
|
8300
8785
|
const labelX2 = side === "left" ? tickEndX - ROW_GAP2 - LABEL_SIZE : tickEndX + ROW_GAP2;
|
|
8301
|
-
const
|
|
8786
|
+
const ticks2 = layout.bands.flatMap((value, index) => {
|
|
8302
8787
|
const y = barTop + (1 - bandRatio2(layout, value)) * barHeight;
|
|
8303
8788
|
const tick = {
|
|
8304
8789
|
type: "path",
|
|
@@ -8323,7 +8808,7 @@ function renderSideLegend(context, layout) {
|
|
|
8323
8808
|
});
|
|
8324
8809
|
return [tick, label];
|
|
8325
8810
|
});
|
|
8326
|
-
return [bar, ...
|
|
8811
|
+
return [bar, ...ticks2];
|
|
8327
8812
|
}
|
|
8328
8813
|
|
|
8329
8814
|
// src/renderScene/charts/renderers/treemap/tiles.ts
|
|
@@ -9148,6 +9633,12 @@ function addStrokeAttrs(attrs, style) {
|
|
|
9148
9633
|
if (style.pointerEvents) {
|
|
9149
9634
|
attrs.push(`pointer-events="${style.pointerEvents}"`);
|
|
9150
9635
|
}
|
|
9636
|
+
if (style.transition && style.transition > 0) {
|
|
9637
|
+
const time = `${num(style.transition)}ms ease`;
|
|
9638
|
+
attrs.push(
|
|
9639
|
+
`style="transition: x ${time}, y ${time}, width ${time}, height ${time}, cx ${time}, cy ${time}, rx ${time}, ry ${time}, fill ${time}, stroke ${time}, stroke-width ${time}, stroke-dasharray ${time}, opacity ${time}"`
|
|
9640
|
+
);
|
|
9641
|
+
}
|
|
9151
9642
|
}
|
|
9152
9643
|
function elementSize(node) {
|
|
9153
9644
|
const shape = node;
|
|
@@ -9397,8 +9888,9 @@ function lineOffset(index, linePx) {
|
|
|
9397
9888
|
function shaderSurfaceSvg(node, defs) {
|
|
9398
9889
|
const rotation = transform(node.rotation, { x: node.x + node.width / 2, y: node.y + node.height / 2 });
|
|
9399
9890
|
const parameters = xml(JSON.stringify(node.shader.parameters));
|
|
9891
|
+
const surfacePadding = node.shader.surfacePadding ?? 0;
|
|
9400
9892
|
const fillColor = node.fillColor ? ` data-sf-shader-fill="${xml(node.fillColor)}"` : "";
|
|
9401
|
-
return `<foreignObject id="${defs.elementId(node.id)}"${contractAttrs(node)} data-sf-shader="${xml(node.shader.program)}" data-sf-shader-name="${xml(node.shader.name)}" data-sf-shader-params="${parameters}" data-sf-shader-mask="${node.mask}"${fillColor} x="${num(node.x)}" y="${num(node.y)}" width="${num(node.width)}" height="${num(node.height)}"${rotation} pointer-events="${node.shader.program === "ruler" || node.identity?.role === "widget" ? "all" : "none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`;
|
|
9893
|
+
return `<foreignObject id="${defs.elementId(node.id)}"${contractAttrs(node)} data-sf-shader="${xml(node.shader.program)}" data-sf-shader-name="${xml(node.shader.name)}" data-sf-shader-params="${parameters}" data-sf-shader-mask="${node.mask}" data-sf-shader-padding="${num(surfacePadding)}"${fillColor} x="${num(node.x)}" y="${num(node.y)}" width="${num(node.width)}" height="${num(node.height)}"${rotation} pointer-events="${node.shader.program === "ruler" || node.identity?.role === "widget" ? "all" : "none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`;
|
|
9402
9894
|
}
|
|
9403
9895
|
function rollingDigitSvg(character, node) {
|
|
9404
9896
|
const style = node.componentStyle;
|
|
@@ -9513,6 +10005,6 @@ function defineComponent(definition) {
|
|
|
9513
10005
|
};
|
|
9514
10006
|
}
|
|
9515
10007
|
|
|
9516
|
-
export { collectCanvasObjects, decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput };
|
|
9517
|
-
//# sourceMappingURL=chunk-
|
|
9518
|
-
//# sourceMappingURL=chunk-
|
|
10008
|
+
export { collectCanvasObjects, decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput, sliderReach };
|
|
10009
|
+
//# sourceMappingURL=chunk-SDMQRSRW.js.map
|
|
10010
|
+
//# sourceMappingURL=chunk-SDMQRSRW.js.map
|