@codehz/draw-call 0.5.1 → 0.5.3
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/{browser → dist/browser}/index.cjs +2 -40
- package/{node → dist/browser}/index.d.cts +1 -1
- package/dist/browser/index.d.ts +454 -0
- package/{browser → dist/browser}/index.js +1 -39
- package/{node → dist/node}/index.cjs +2 -40
- package/dist/node/index.d.cts +454 -0
- package/{node → dist/node}/index.d.mts +1 -1
- package/{node → dist/node}/index.mjs +1 -40
- package/examples/card.ts +1 -1
- package/examples/customdraw-basic.ts +1 -1
- package/examples/customdraw.ts +1 -1
- package/examples/demo.html +114 -0
- package/examples/demo.ts +1 -1
- package/examples/image-smoothing.ts +1 -1
- package/examples/richtext.ts +1 -1
- package/examples/transform.ts +1 -1
- package/package.json +55 -32
- package/browser/index.d.cts +0 -998
- package/browser/index.d.ts +0 -998
|
@@ -7,7 +7,6 @@ function createRawCanvas(width, height) {
|
|
|
7
7
|
canvas.height = height;
|
|
8
8
|
return canvas;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
//#endregion
|
|
12
11
|
//#region src/types/base.ts
|
|
13
12
|
function linearGradient(angle, ...stops) {
|
|
@@ -78,7 +77,6 @@ function normalizeBorderRadius(value) {
|
|
|
78
77
|
];
|
|
79
78
|
return value;
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
//#endregion
|
|
83
81
|
//#region src/layout/components/box.ts
|
|
84
82
|
/**
|
|
@@ -191,7 +189,6 @@ function measureBoxSize(element, ctx, availableWidth, measureChild) {
|
|
|
191
189
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
192
190
|
};
|
|
193
191
|
}
|
|
194
|
-
|
|
195
192
|
//#endregion
|
|
196
193
|
//#region src/layout/components/customDraw.ts
|
|
197
194
|
/**
|
|
@@ -208,7 +205,6 @@ function measureCustomDrawSize(element, ctx, availableWidth, measureChild) {
|
|
|
208
205
|
height: 0
|
|
209
206
|
};
|
|
210
207
|
}
|
|
211
|
-
|
|
212
208
|
//#endregion
|
|
213
209
|
//#region src/layout/components/image.ts
|
|
214
210
|
/**
|
|
@@ -234,7 +230,6 @@ function measureImageSize(element, _ctx, _availableWidth) {
|
|
|
234
230
|
height: 0
|
|
235
231
|
};
|
|
236
232
|
}
|
|
237
|
-
|
|
238
233
|
//#endregion
|
|
239
234
|
//#region src/layout/components/richtext.ts
|
|
240
235
|
/**
|
|
@@ -402,7 +397,6 @@ function wrapRichText(ctx, spans, maxWidth, lineHeightScale = 1.2, elementStyle
|
|
|
402
397
|
}];
|
|
403
398
|
return lines;
|
|
404
399
|
}
|
|
405
|
-
|
|
406
400
|
//#endregion
|
|
407
401
|
//#region src/layout/components/stack.ts
|
|
408
402
|
/**
|
|
@@ -439,7 +433,6 @@ function measureStackSize(element, ctx, availableWidth, measureChild) {
|
|
|
439
433
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
440
434
|
};
|
|
441
435
|
}
|
|
442
|
-
|
|
443
436
|
//#endregion
|
|
444
437
|
//#region src/layout/components/svg.ts
|
|
445
438
|
/**
|
|
@@ -473,7 +466,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
473
466
|
height: 0
|
|
474
467
|
};
|
|
475
468
|
}
|
|
476
|
-
|
|
477
469
|
//#endregion
|
|
478
470
|
//#region src/render/utils/font.ts
|
|
479
471
|
/**
|
|
@@ -484,7 +476,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
484
476
|
function buildFontString(font) {
|
|
485
477
|
return `${font.style ?? "normal"} ${font.weight ?? "normal"} ${font.size ?? 16}px ${font.family ?? "sans-serif"}`;
|
|
486
478
|
}
|
|
487
|
-
|
|
488
479
|
//#endregion
|
|
489
480
|
//#region src/layout/utils/measure.ts
|
|
490
481
|
function createCanvasMeasureContext(ctx) {
|
|
@@ -576,7 +567,6 @@ function truncateText(ctx, text, maxWidth, font, ellipsis = "...") {
|
|
|
576
567
|
offset
|
|
577
568
|
};
|
|
578
569
|
}
|
|
579
|
-
|
|
580
570
|
//#endregion
|
|
581
571
|
//#region src/layout/components/text.ts
|
|
582
572
|
/**
|
|
@@ -602,7 +592,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
602
592
|
height: Math.max(height, lineHeightPx)
|
|
603
593
|
};
|
|
604
594
|
}
|
|
605
|
-
|
|
606
595
|
//#endregion
|
|
607
596
|
//#region src/layout/components/transform.ts
|
|
608
597
|
/**
|
|
@@ -613,7 +602,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
613
602
|
function measureTransformSize(element, ctx, availableWidth, measureIntrinsicSize) {
|
|
614
603
|
return measureIntrinsicSize(element.children, ctx, availableWidth);
|
|
615
604
|
}
|
|
616
|
-
|
|
617
605
|
//#endregion
|
|
618
606
|
//#region src/layout/components/index.ts
|
|
619
607
|
/**
|
|
@@ -635,7 +623,6 @@ function measureIntrinsicSize(element, ctx, availableWidth) {
|
|
|
635
623
|
};
|
|
636
624
|
}
|
|
637
625
|
}
|
|
638
|
-
|
|
639
626
|
//#endregion
|
|
640
627
|
//#region src/layout/utils/offset.ts
|
|
641
628
|
/**
|
|
@@ -648,7 +635,6 @@ function applyOffset(node, dx, dy) {
|
|
|
648
635
|
node.layout.contentY += dy;
|
|
649
636
|
for (const child of node.children) applyOffset(child, dx, dy);
|
|
650
637
|
}
|
|
651
|
-
|
|
652
638
|
//#endregion
|
|
653
639
|
//#region src/types/layout.ts
|
|
654
640
|
function resolveSize(size, available, auto) {
|
|
@@ -663,7 +649,6 @@ function sizeNeedsParent(size) {
|
|
|
663
649
|
if (typeof size === "string" && size.endsWith("%")) return true;
|
|
664
650
|
return false;
|
|
665
651
|
}
|
|
666
|
-
|
|
667
652
|
//#endregion
|
|
668
653
|
//#region src/layout/engine.ts
|
|
669
654
|
/**
|
|
@@ -1081,7 +1066,6 @@ function computeLayoutImpl(element, ctx, constraints, x = 0, y = 0) {
|
|
|
1081
1066
|
}
|
|
1082
1067
|
return node;
|
|
1083
1068
|
}
|
|
1084
|
-
|
|
1085
1069
|
//#endregion
|
|
1086
1070
|
//#region src/render/utils/colors.ts
|
|
1087
1071
|
function isGradientDescriptor$1(color) {
|
|
@@ -1117,7 +1101,6 @@ function resolveColor$1(ctx, color, x, y, width, height) {
|
|
|
1117
1101
|
if (isGradientDescriptor$1(color)) return resolveGradient$1(ctx, color, x, y, width, height);
|
|
1118
1102
|
return color;
|
|
1119
1103
|
}
|
|
1120
|
-
|
|
1121
1104
|
//#endregion
|
|
1122
1105
|
//#region src/render/utils/shadows.ts
|
|
1123
1106
|
function applyShadow$1(ctx, shadow) {
|
|
@@ -1139,7 +1122,6 @@ function clearShadow$1(ctx) {
|
|
|
1139
1122
|
ctx.shadowBlur = 0;
|
|
1140
1123
|
ctx.shadowColor = "transparent";
|
|
1141
1124
|
}
|
|
1142
|
-
|
|
1143
1125
|
//#endregion
|
|
1144
1126
|
//#region src/render/utils/shapes.ts
|
|
1145
1127
|
function roundRectPath(ctx, x, y, width, height, radius) {
|
|
@@ -1156,7 +1138,6 @@ function roundRectPath(ctx, x, y, width, height, radius) {
|
|
|
1156
1138
|
ctx.quadraticCurveTo(x, y, x + tl, y);
|
|
1157
1139
|
ctx.closePath();
|
|
1158
1140
|
}
|
|
1159
|
-
|
|
1160
1141
|
//#endregion
|
|
1161
1142
|
//#region src/render/components/box.ts
|
|
1162
1143
|
function renderBox(ctx, node) {
|
|
@@ -1185,7 +1166,6 @@ function renderBox(ctx, node) {
|
|
|
1185
1166
|
}
|
|
1186
1167
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1187
1168
|
}
|
|
1188
|
-
|
|
1189
1169
|
//#endregion
|
|
1190
1170
|
//#region src/render/components/ProxiedCanvasContext.ts
|
|
1191
1171
|
/**
|
|
@@ -1303,7 +1283,6 @@ function createProxiedCanvasContext(ctx, baseTransform) {
|
|
|
1303
1283
|
}
|
|
1304
1284
|
});
|
|
1305
1285
|
}
|
|
1306
|
-
|
|
1307
1286
|
//#endregion
|
|
1308
1287
|
//#region src/render/components/customDraw.ts
|
|
1309
1288
|
/**
|
|
@@ -1331,7 +1310,6 @@ function renderCustomDraw(ctx, node) {
|
|
|
1331
1310
|
proxyCtx.destroy();
|
|
1332
1311
|
ctx.restore();
|
|
1333
1312
|
}
|
|
1334
|
-
|
|
1335
1313
|
//#endregion
|
|
1336
1314
|
//#region src/render/components/image.ts
|
|
1337
1315
|
function renderImage(ctx, node) {
|
|
@@ -1417,7 +1395,6 @@ function renderImage(ctx, node) {
|
|
|
1417
1395
|
}
|
|
1418
1396
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1419
1397
|
}
|
|
1420
|
-
|
|
1421
1398
|
//#endregion
|
|
1422
1399
|
//#region src/render/components/richtext.ts
|
|
1423
1400
|
function renderRichText(ctx, node) {
|
|
@@ -1468,7 +1445,6 @@ function renderRichText(ctx, node) {
|
|
|
1468
1445
|
currentY += line.height;
|
|
1469
1446
|
}
|
|
1470
1447
|
}
|
|
1471
|
-
|
|
1472
1448
|
//#endregion
|
|
1473
1449
|
//#region src/render/components/svg.ts
|
|
1474
1450
|
function isGradientDescriptor(color) {
|
|
@@ -1740,7 +1716,6 @@ function renderSvg(ctx, node) {
|
|
|
1740
1716
|
for (const child of element.children) renderSvgChild(ctx, child, transform, bounds, baseTransform);
|
|
1741
1717
|
ctx.restore();
|
|
1742
1718
|
}
|
|
1743
|
-
|
|
1744
1719
|
//#endregion
|
|
1745
1720
|
//#region src/render/components/text.ts
|
|
1746
1721
|
function renderText(ctx, node) {
|
|
@@ -1775,7 +1750,6 @@ function renderText(ctx, node) {
|
|
|
1775
1750
|
}
|
|
1776
1751
|
if (element.shadow) clearShadow$1(ctx);
|
|
1777
1752
|
}
|
|
1778
|
-
|
|
1779
1753
|
//#endregion
|
|
1780
1754
|
//#region src/render/components/transform.ts
|
|
1781
1755
|
/**
|
|
@@ -1851,7 +1825,6 @@ function renderTransform(ctx, node) {
|
|
|
1851
1825
|
renderNode(ctx, childNode);
|
|
1852
1826
|
ctx.restore();
|
|
1853
1827
|
}
|
|
1854
|
-
|
|
1855
1828
|
//#endregion
|
|
1856
1829
|
//#region src/render/index.ts
|
|
1857
1830
|
function renderNode(ctx, node) {
|
|
@@ -1891,7 +1864,6 @@ function renderNode(ctx, node) {
|
|
|
1891
1864
|
break;
|
|
1892
1865
|
}
|
|
1893
1866
|
}
|
|
1894
|
-
|
|
1895
1867
|
//#endregion
|
|
1896
1868
|
//#region src/canvas.ts
|
|
1897
1869
|
/**
|
|
@@ -1961,7 +1933,6 @@ function createCanvas(options) {
|
|
|
1961
1933
|
}
|
|
1962
1934
|
};
|
|
1963
1935
|
}
|
|
1964
|
-
|
|
1965
1936
|
//#endregion
|
|
1966
1937
|
//#region src/components/Box.ts
|
|
1967
1938
|
function Box(props) {
|
|
@@ -1970,7 +1941,6 @@ function Box(props) {
|
|
|
1970
1941
|
...props
|
|
1971
1942
|
};
|
|
1972
1943
|
}
|
|
1973
|
-
|
|
1974
1944
|
//#endregion
|
|
1975
1945
|
//#region src/components/CustomDraw.ts
|
|
1976
1946
|
function CustomDraw(props) {
|
|
@@ -1979,7 +1949,6 @@ function CustomDraw(props) {
|
|
|
1979
1949
|
...props
|
|
1980
1950
|
};
|
|
1981
1951
|
}
|
|
1982
|
-
|
|
1983
1952
|
//#endregion
|
|
1984
1953
|
//#region src/components/Image.ts
|
|
1985
1954
|
function Image(props) {
|
|
@@ -1988,7 +1957,6 @@ function Image(props) {
|
|
|
1988
1957
|
...props
|
|
1989
1958
|
};
|
|
1990
1959
|
}
|
|
1991
|
-
|
|
1992
1960
|
//#endregion
|
|
1993
1961
|
//#region src/components/RichText.ts
|
|
1994
1962
|
function RichText(props) {
|
|
@@ -1997,7 +1965,6 @@ function RichText(props) {
|
|
|
1997
1965
|
...props
|
|
1998
1966
|
};
|
|
1999
1967
|
}
|
|
2000
|
-
|
|
2001
1968
|
//#endregion
|
|
2002
1969
|
//#region src/components/Stack.ts
|
|
2003
1970
|
function Stack(props) {
|
|
@@ -2006,7 +1973,6 @@ function Stack(props) {
|
|
|
2006
1973
|
...props
|
|
2007
1974
|
};
|
|
2008
1975
|
}
|
|
2009
|
-
|
|
2010
1976
|
//#endregion
|
|
2011
1977
|
//#region src/components/Svg.ts
|
|
2012
1978
|
function Svg(props) {
|
|
@@ -2053,7 +2019,6 @@ const svg = {
|
|
|
2053
2019
|
...props
|
|
2054
2020
|
})
|
|
2055
2021
|
};
|
|
2056
|
-
|
|
2057
2022
|
//#endregion
|
|
2058
2023
|
//#region src/components/Text.ts
|
|
2059
2024
|
function Text(props) {
|
|
@@ -2062,7 +2027,6 @@ function Text(props) {
|
|
|
2062
2027
|
...props
|
|
2063
2028
|
};
|
|
2064
2029
|
}
|
|
2065
|
-
|
|
2066
2030
|
//#endregion
|
|
2067
2031
|
//#region src/components/Transform.ts
|
|
2068
2032
|
function Transform(props) {
|
|
@@ -2071,7 +2035,6 @@ function Transform(props) {
|
|
|
2071
2035
|
...props
|
|
2072
2036
|
};
|
|
2073
2037
|
}
|
|
2074
|
-
|
|
2075
2038
|
//#endregion
|
|
2076
2039
|
//#region src/layout/utils/print.ts
|
|
2077
2040
|
/**
|
|
@@ -2131,6 +2094,5 @@ function printLayout(node) {
|
|
|
2131
2094
|
function layoutToString(node, _indent = " ") {
|
|
2132
2095
|
return printLayoutToString(node, "", true).join("\n");
|
|
2133
2096
|
}
|
|
2134
|
-
|
|
2135
2097
|
//#endregion
|
|
2136
|
-
export { Box, CustomDraw, Image, RichText, Stack, Svg, Text, Transform, computeLayout, createCanvas, createCanvasMeasureContext, layoutToString, linearGradient, printLayout, radialGradient, svg };
|
|
2098
|
+
export { Box, CustomDraw, Image, RichText, Stack, Svg, Text, Transform, computeLayout, createCanvas, createCanvasMeasureContext, layoutToString, linearGradient, printLayout, radialGradient, svg };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
let _napi_rs_canvas = require("@napi-rs/canvas");
|
|
2
|
-
|
|
3
3
|
//#region src/compat/index.ts
|
|
4
4
|
function createRawCanvas(width, height) {
|
|
5
5
|
return (0, _napi_rs_canvas.createCanvas)(width, height);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
//#endregion
|
|
9
8
|
//#region src/types/base.ts
|
|
10
9
|
function linearGradient(angle, ...stops) {
|
|
@@ -75,7 +74,6 @@ function normalizeBorderRadius(value) {
|
|
|
75
74
|
];
|
|
76
75
|
return value;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
77
|
//#endregion
|
|
80
78
|
//#region src/layout/components/box.ts
|
|
81
79
|
/**
|
|
@@ -188,7 +186,6 @@ function measureBoxSize(element, ctx, availableWidth, measureChild) {
|
|
|
188
186
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
189
187
|
};
|
|
190
188
|
}
|
|
191
|
-
|
|
192
189
|
//#endregion
|
|
193
190
|
//#region src/layout/components/customDraw.ts
|
|
194
191
|
/**
|
|
@@ -205,7 +202,6 @@ function measureCustomDrawSize(element, ctx, availableWidth, measureChild) {
|
|
|
205
202
|
height: 0
|
|
206
203
|
};
|
|
207
204
|
}
|
|
208
|
-
|
|
209
205
|
//#endregion
|
|
210
206
|
//#region src/layout/components/image.ts
|
|
211
207
|
/**
|
|
@@ -231,7 +227,6 @@ function measureImageSize(element, _ctx, _availableWidth) {
|
|
|
231
227
|
height: 0
|
|
232
228
|
};
|
|
233
229
|
}
|
|
234
|
-
|
|
235
230
|
//#endregion
|
|
236
231
|
//#region src/layout/components/richtext.ts
|
|
237
232
|
/**
|
|
@@ -399,7 +394,6 @@ function wrapRichText(ctx, spans, maxWidth, lineHeightScale = 1.2, elementStyle
|
|
|
399
394
|
}];
|
|
400
395
|
return lines;
|
|
401
396
|
}
|
|
402
|
-
|
|
403
397
|
//#endregion
|
|
404
398
|
//#region src/layout/components/stack.ts
|
|
405
399
|
/**
|
|
@@ -436,7 +430,6 @@ function measureStackSize(element, ctx, availableWidth, measureChild) {
|
|
|
436
430
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
437
431
|
};
|
|
438
432
|
}
|
|
439
|
-
|
|
440
433
|
//#endregion
|
|
441
434
|
//#region src/layout/components/svg.ts
|
|
442
435
|
/**
|
|
@@ -470,7 +463,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
470
463
|
height: 0
|
|
471
464
|
};
|
|
472
465
|
}
|
|
473
|
-
|
|
474
466
|
//#endregion
|
|
475
467
|
//#region src/render/utils/font.ts
|
|
476
468
|
/**
|
|
@@ -481,7 +473,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
481
473
|
function buildFontString(font) {
|
|
482
474
|
return `${font.style ?? "normal"} ${font.weight ?? "normal"} ${font.size ?? 16}px ${font.family ?? "sans-serif"}`;
|
|
483
475
|
}
|
|
484
|
-
|
|
485
476
|
//#endregion
|
|
486
477
|
//#region src/layout/utils/measure.ts
|
|
487
478
|
function createCanvasMeasureContext(ctx) {
|
|
@@ -573,7 +564,6 @@ function truncateText(ctx, text, maxWidth, font, ellipsis = "...") {
|
|
|
573
564
|
offset
|
|
574
565
|
};
|
|
575
566
|
}
|
|
576
|
-
|
|
577
567
|
//#endregion
|
|
578
568
|
//#region src/layout/components/text.ts
|
|
579
569
|
/**
|
|
@@ -599,7 +589,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
599
589
|
height: Math.max(height, lineHeightPx)
|
|
600
590
|
};
|
|
601
591
|
}
|
|
602
|
-
|
|
603
592
|
//#endregion
|
|
604
593
|
//#region src/layout/components/transform.ts
|
|
605
594
|
/**
|
|
@@ -610,7 +599,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
610
599
|
function measureTransformSize(element, ctx, availableWidth, measureIntrinsicSize) {
|
|
611
600
|
return measureIntrinsicSize(element.children, ctx, availableWidth);
|
|
612
601
|
}
|
|
613
|
-
|
|
614
602
|
//#endregion
|
|
615
603
|
//#region src/layout/components/index.ts
|
|
616
604
|
/**
|
|
@@ -632,7 +620,6 @@ function measureIntrinsicSize(element, ctx, availableWidth) {
|
|
|
632
620
|
};
|
|
633
621
|
}
|
|
634
622
|
}
|
|
635
|
-
|
|
636
623
|
//#endregion
|
|
637
624
|
//#region src/layout/utils/offset.ts
|
|
638
625
|
/**
|
|
@@ -645,7 +632,6 @@ function applyOffset(node, dx, dy) {
|
|
|
645
632
|
node.layout.contentY += dy;
|
|
646
633
|
for (const child of node.children) applyOffset(child, dx, dy);
|
|
647
634
|
}
|
|
648
|
-
|
|
649
635
|
//#endregion
|
|
650
636
|
//#region src/types/layout.ts
|
|
651
637
|
function resolveSize(size, available, auto) {
|
|
@@ -660,7 +646,6 @@ function sizeNeedsParent(size) {
|
|
|
660
646
|
if (typeof size === "string" && size.endsWith("%")) return true;
|
|
661
647
|
return false;
|
|
662
648
|
}
|
|
663
|
-
|
|
664
649
|
//#endregion
|
|
665
650
|
//#region src/layout/engine.ts
|
|
666
651
|
/**
|
|
@@ -1078,7 +1063,6 @@ function computeLayoutImpl(element, ctx, constraints, x = 0, y = 0) {
|
|
|
1078
1063
|
}
|
|
1079
1064
|
return node;
|
|
1080
1065
|
}
|
|
1081
|
-
|
|
1082
1066
|
//#endregion
|
|
1083
1067
|
//#region src/render/utils/colors.ts
|
|
1084
1068
|
function isGradientDescriptor$1(color) {
|
|
@@ -1114,7 +1098,6 @@ function resolveColor$1(ctx, color, x, y, width, height) {
|
|
|
1114
1098
|
if (isGradientDescriptor$1(color)) return resolveGradient$1(ctx, color, x, y, width, height);
|
|
1115
1099
|
return color;
|
|
1116
1100
|
}
|
|
1117
|
-
|
|
1118
1101
|
//#endregion
|
|
1119
1102
|
//#region src/render/utils/shadows.ts
|
|
1120
1103
|
function applyShadow$1(ctx, shadow) {
|
|
@@ -1136,7 +1119,6 @@ function clearShadow$1(ctx) {
|
|
|
1136
1119
|
ctx.shadowBlur = 0;
|
|
1137
1120
|
ctx.shadowColor = "transparent";
|
|
1138
1121
|
}
|
|
1139
|
-
|
|
1140
1122
|
//#endregion
|
|
1141
1123
|
//#region src/render/utils/shapes.ts
|
|
1142
1124
|
function roundRectPath(ctx, x, y, width, height, radius) {
|
|
@@ -1153,7 +1135,6 @@ function roundRectPath(ctx, x, y, width, height, radius) {
|
|
|
1153
1135
|
ctx.quadraticCurveTo(x, y, x + tl, y);
|
|
1154
1136
|
ctx.closePath();
|
|
1155
1137
|
}
|
|
1156
|
-
|
|
1157
1138
|
//#endregion
|
|
1158
1139
|
//#region src/render/components/box.ts
|
|
1159
1140
|
function renderBox(ctx, node) {
|
|
@@ -1182,7 +1163,6 @@ function renderBox(ctx, node) {
|
|
|
1182
1163
|
}
|
|
1183
1164
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1184
1165
|
}
|
|
1185
|
-
|
|
1186
1166
|
//#endregion
|
|
1187
1167
|
//#region src/render/components/ProxiedCanvasContext.ts
|
|
1188
1168
|
/**
|
|
@@ -1300,7 +1280,6 @@ function createProxiedCanvasContext(ctx, baseTransform) {
|
|
|
1300
1280
|
}
|
|
1301
1281
|
});
|
|
1302
1282
|
}
|
|
1303
|
-
|
|
1304
1283
|
//#endregion
|
|
1305
1284
|
//#region src/render/components/customDraw.ts
|
|
1306
1285
|
/**
|
|
@@ -1328,7 +1307,6 @@ function renderCustomDraw(ctx, node) {
|
|
|
1328
1307
|
proxyCtx.destroy();
|
|
1329
1308
|
ctx.restore();
|
|
1330
1309
|
}
|
|
1331
|
-
|
|
1332
1310
|
//#endregion
|
|
1333
1311
|
//#region src/render/components/image.ts
|
|
1334
1312
|
function renderImage(ctx, node) {
|
|
@@ -1414,7 +1392,6 @@ function renderImage(ctx, node) {
|
|
|
1414
1392
|
}
|
|
1415
1393
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1416
1394
|
}
|
|
1417
|
-
|
|
1418
1395
|
//#endregion
|
|
1419
1396
|
//#region src/render/components/richtext.ts
|
|
1420
1397
|
function renderRichText(ctx, node) {
|
|
@@ -1465,7 +1442,6 @@ function renderRichText(ctx, node) {
|
|
|
1465
1442
|
currentY += line.height;
|
|
1466
1443
|
}
|
|
1467
1444
|
}
|
|
1468
|
-
|
|
1469
1445
|
//#endregion
|
|
1470
1446
|
//#region src/render/components/svg.ts
|
|
1471
1447
|
function isGradientDescriptor(color) {
|
|
@@ -1737,7 +1713,6 @@ function renderSvg(ctx, node) {
|
|
|
1737
1713
|
for (const child of element.children) renderSvgChild(ctx, child, transform, bounds, baseTransform);
|
|
1738
1714
|
ctx.restore();
|
|
1739
1715
|
}
|
|
1740
|
-
|
|
1741
1716
|
//#endregion
|
|
1742
1717
|
//#region src/render/components/text.ts
|
|
1743
1718
|
function renderText(ctx, node) {
|
|
@@ -1772,7 +1747,6 @@ function renderText(ctx, node) {
|
|
|
1772
1747
|
}
|
|
1773
1748
|
if (element.shadow) clearShadow$1(ctx);
|
|
1774
1749
|
}
|
|
1775
|
-
|
|
1776
1750
|
//#endregion
|
|
1777
1751
|
//#region src/render/components/transform.ts
|
|
1778
1752
|
/**
|
|
@@ -1848,7 +1822,6 @@ function renderTransform(ctx, node) {
|
|
|
1848
1822
|
renderNode(ctx, childNode);
|
|
1849
1823
|
ctx.restore();
|
|
1850
1824
|
}
|
|
1851
|
-
|
|
1852
1825
|
//#endregion
|
|
1853
1826
|
//#region src/render/index.ts
|
|
1854
1827
|
function renderNode(ctx, node) {
|
|
@@ -1888,7 +1861,6 @@ function renderNode(ctx, node) {
|
|
|
1888
1861
|
break;
|
|
1889
1862
|
}
|
|
1890
1863
|
}
|
|
1891
|
-
|
|
1892
1864
|
//#endregion
|
|
1893
1865
|
//#region src/canvas.ts
|
|
1894
1866
|
/**
|
|
@@ -1958,7 +1930,6 @@ function createCanvas(options) {
|
|
|
1958
1930
|
}
|
|
1959
1931
|
};
|
|
1960
1932
|
}
|
|
1961
|
-
|
|
1962
1933
|
//#endregion
|
|
1963
1934
|
//#region src/components/Box.ts
|
|
1964
1935
|
function Box(props) {
|
|
@@ -1967,7 +1938,6 @@ function Box(props) {
|
|
|
1967
1938
|
...props
|
|
1968
1939
|
};
|
|
1969
1940
|
}
|
|
1970
|
-
|
|
1971
1941
|
//#endregion
|
|
1972
1942
|
//#region src/components/CustomDraw.ts
|
|
1973
1943
|
function CustomDraw(props) {
|
|
@@ -1976,7 +1946,6 @@ function CustomDraw(props) {
|
|
|
1976
1946
|
...props
|
|
1977
1947
|
};
|
|
1978
1948
|
}
|
|
1979
|
-
|
|
1980
1949
|
//#endregion
|
|
1981
1950
|
//#region src/components/Image.ts
|
|
1982
1951
|
function Image(props) {
|
|
@@ -1985,7 +1954,6 @@ function Image(props) {
|
|
|
1985
1954
|
...props
|
|
1986
1955
|
};
|
|
1987
1956
|
}
|
|
1988
|
-
|
|
1989
1957
|
//#endregion
|
|
1990
1958
|
//#region src/components/RichText.ts
|
|
1991
1959
|
function RichText(props) {
|
|
@@ -1994,7 +1962,6 @@ function RichText(props) {
|
|
|
1994
1962
|
...props
|
|
1995
1963
|
};
|
|
1996
1964
|
}
|
|
1997
|
-
|
|
1998
1965
|
//#endregion
|
|
1999
1966
|
//#region src/components/Stack.ts
|
|
2000
1967
|
function Stack(props) {
|
|
@@ -2003,7 +1970,6 @@ function Stack(props) {
|
|
|
2003
1970
|
...props
|
|
2004
1971
|
};
|
|
2005
1972
|
}
|
|
2006
|
-
|
|
2007
1973
|
//#endregion
|
|
2008
1974
|
//#region src/components/Svg.ts
|
|
2009
1975
|
function Svg(props) {
|
|
@@ -2050,7 +2016,6 @@ const svg = {
|
|
|
2050
2016
|
...props
|
|
2051
2017
|
})
|
|
2052
2018
|
};
|
|
2053
|
-
|
|
2054
2019
|
//#endregion
|
|
2055
2020
|
//#region src/components/Text.ts
|
|
2056
2021
|
function Text(props) {
|
|
@@ -2059,7 +2024,6 @@ function Text(props) {
|
|
|
2059
2024
|
...props
|
|
2060
2025
|
};
|
|
2061
2026
|
}
|
|
2062
|
-
|
|
2063
2027
|
//#endregion
|
|
2064
2028
|
//#region src/components/Transform.ts
|
|
2065
2029
|
function Transform(props) {
|
|
@@ -2068,7 +2032,6 @@ function Transform(props) {
|
|
|
2068
2032
|
...props
|
|
2069
2033
|
};
|
|
2070
2034
|
}
|
|
2071
|
-
|
|
2072
2035
|
//#endregion
|
|
2073
2036
|
//#region src/layout/utils/print.ts
|
|
2074
2037
|
/**
|
|
@@ -2128,7 +2091,6 @@ function printLayout(node) {
|
|
|
2128
2091
|
function layoutToString(node, _indent = " ") {
|
|
2129
2092
|
return printLayoutToString(node, "", true).join("\n");
|
|
2130
2093
|
}
|
|
2131
|
-
|
|
2132
2094
|
//#endregion
|
|
2133
2095
|
exports.Box = Box;
|
|
2134
2096
|
exports.CustomDraw = CustomDraw;
|
|
@@ -2145,4 +2107,4 @@ exports.layoutToString = layoutToString;
|
|
|
2145
2107
|
exports.linearGradient = linearGradient;
|
|
2146
2108
|
exports.printLayout = printLayout;
|
|
2147
2109
|
exports.radialGradient = radialGradient;
|
|
2148
|
-
exports.svg = svg;
|
|
2110
|
+
exports.svg = svg;
|