@codehz/draw-call 0.5.2 → 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 -41
- package/{browser → dist/browser}/index.js +1 -39
- package/{node → dist/node}/index.cjs +2 -41
- package/dist/node/index.d.cts +454 -0
- package/dist/node/index.d.mts +454 -0
- 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
- /package/{node → dist/browser}/index.d.cts +0 -0
- /package/{node/index.d.mts → dist/browser/index.d.ts} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
2
|
//#region src/compat/index.ts
|
|
4
3
|
const DOMMatrix = typeof window !== "undefined" ? window.DOMMatrix : void 0;
|
|
5
4
|
const Path2D = typeof window !== "undefined" ? window.Path2D : void 0;
|
|
@@ -9,7 +8,6 @@ function createRawCanvas(width, height) {
|
|
|
9
8
|
canvas.height = height;
|
|
10
9
|
return canvas;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
12
|
//#region src/types/base.ts
|
|
15
13
|
function linearGradient(angle, ...stops) {
|
|
@@ -80,7 +78,6 @@ function normalizeBorderRadius(value) {
|
|
|
80
78
|
];
|
|
81
79
|
return value;
|
|
82
80
|
}
|
|
83
|
-
|
|
84
81
|
//#endregion
|
|
85
82
|
//#region src/layout/components/box.ts
|
|
86
83
|
/**
|
|
@@ -193,7 +190,6 @@ function measureBoxSize(element, ctx, availableWidth, measureChild) {
|
|
|
193
190
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
194
191
|
};
|
|
195
192
|
}
|
|
196
|
-
|
|
197
193
|
//#endregion
|
|
198
194
|
//#region src/layout/components/customDraw.ts
|
|
199
195
|
/**
|
|
@@ -210,7 +206,6 @@ function measureCustomDrawSize(element, ctx, availableWidth, measureChild) {
|
|
|
210
206
|
height: 0
|
|
211
207
|
};
|
|
212
208
|
}
|
|
213
|
-
|
|
214
209
|
//#endregion
|
|
215
210
|
//#region src/layout/components/image.ts
|
|
216
211
|
/**
|
|
@@ -236,7 +231,6 @@ function measureImageSize(element, _ctx, _availableWidth) {
|
|
|
236
231
|
height: 0
|
|
237
232
|
};
|
|
238
233
|
}
|
|
239
|
-
|
|
240
234
|
//#endregion
|
|
241
235
|
//#region src/layout/components/richtext.ts
|
|
242
236
|
/**
|
|
@@ -404,7 +398,6 @@ function wrapRichText(ctx, spans, maxWidth, lineHeightScale = 1.2, elementStyle
|
|
|
404
398
|
}];
|
|
405
399
|
return lines;
|
|
406
400
|
}
|
|
407
|
-
|
|
408
401
|
//#endregion
|
|
409
402
|
//#region src/layout/components/stack.ts
|
|
410
403
|
/**
|
|
@@ -441,7 +434,6 @@ function measureStackSize(element, ctx, availableWidth, measureChild) {
|
|
|
441
434
|
height: typeof element.height === "number" ? element.height : intrinsicHeight
|
|
442
435
|
};
|
|
443
436
|
}
|
|
444
|
-
|
|
445
437
|
//#endregion
|
|
446
438
|
//#region src/layout/components/svg.ts
|
|
447
439
|
/**
|
|
@@ -475,7 +467,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
475
467
|
height: 0
|
|
476
468
|
};
|
|
477
469
|
}
|
|
478
|
-
|
|
479
470
|
//#endregion
|
|
480
471
|
//#region src/render/utils/font.ts
|
|
481
472
|
/**
|
|
@@ -486,7 +477,6 @@ function measureSvgSize(element, _ctx, _availableWidth) {
|
|
|
486
477
|
function buildFontString(font) {
|
|
487
478
|
return `${font.style ?? "normal"} ${font.weight ?? "normal"} ${font.size ?? 16}px ${font.family ?? "sans-serif"}`;
|
|
488
479
|
}
|
|
489
|
-
|
|
490
480
|
//#endregion
|
|
491
481
|
//#region src/layout/utils/measure.ts
|
|
492
482
|
function createCanvasMeasureContext(ctx) {
|
|
@@ -578,7 +568,6 @@ function truncateText(ctx, text, maxWidth, font, ellipsis = "...") {
|
|
|
578
568
|
offset
|
|
579
569
|
};
|
|
580
570
|
}
|
|
581
|
-
|
|
582
571
|
//#endregion
|
|
583
572
|
//#region src/layout/components/text.ts
|
|
584
573
|
/**
|
|
@@ -604,7 +593,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
604
593
|
height: Math.max(height, lineHeightPx)
|
|
605
594
|
};
|
|
606
595
|
}
|
|
607
|
-
|
|
608
596
|
//#endregion
|
|
609
597
|
//#region src/layout/components/transform.ts
|
|
610
598
|
/**
|
|
@@ -615,7 +603,6 @@ function measureTextSize(element, ctx, availableWidth) {
|
|
|
615
603
|
function measureTransformSize(element, ctx, availableWidth, measureIntrinsicSize) {
|
|
616
604
|
return measureIntrinsicSize(element.children, ctx, availableWidth);
|
|
617
605
|
}
|
|
618
|
-
|
|
619
606
|
//#endregion
|
|
620
607
|
//#region src/layout/components/index.ts
|
|
621
608
|
/**
|
|
@@ -637,7 +624,6 @@ function measureIntrinsicSize(element, ctx, availableWidth) {
|
|
|
637
624
|
};
|
|
638
625
|
}
|
|
639
626
|
}
|
|
640
|
-
|
|
641
627
|
//#endregion
|
|
642
628
|
//#region src/layout/utils/offset.ts
|
|
643
629
|
/**
|
|
@@ -650,7 +636,6 @@ function applyOffset(node, dx, dy) {
|
|
|
650
636
|
node.layout.contentY += dy;
|
|
651
637
|
for (const child of node.children) applyOffset(child, dx, dy);
|
|
652
638
|
}
|
|
653
|
-
|
|
654
639
|
//#endregion
|
|
655
640
|
//#region src/types/layout.ts
|
|
656
641
|
function resolveSize(size, available, auto) {
|
|
@@ -665,7 +650,6 @@ function sizeNeedsParent(size) {
|
|
|
665
650
|
if (typeof size === "string" && size.endsWith("%")) return true;
|
|
666
651
|
return false;
|
|
667
652
|
}
|
|
668
|
-
|
|
669
653
|
//#endregion
|
|
670
654
|
//#region src/layout/engine.ts
|
|
671
655
|
/**
|
|
@@ -1083,7 +1067,6 @@ function computeLayoutImpl(element, ctx, constraints, x = 0, y = 0) {
|
|
|
1083
1067
|
}
|
|
1084
1068
|
return node;
|
|
1085
1069
|
}
|
|
1086
|
-
|
|
1087
1070
|
//#endregion
|
|
1088
1071
|
//#region src/render/utils/colors.ts
|
|
1089
1072
|
function isGradientDescriptor$1(color) {
|
|
@@ -1119,7 +1102,6 @@ function resolveColor$1(ctx, color, x, y, width, height) {
|
|
|
1119
1102
|
if (isGradientDescriptor$1(color)) return resolveGradient$1(ctx, color, x, y, width, height);
|
|
1120
1103
|
return color;
|
|
1121
1104
|
}
|
|
1122
|
-
|
|
1123
1105
|
//#endregion
|
|
1124
1106
|
//#region src/render/utils/shadows.ts
|
|
1125
1107
|
function applyShadow$1(ctx, shadow) {
|
|
@@ -1141,7 +1123,6 @@ function clearShadow$1(ctx) {
|
|
|
1141
1123
|
ctx.shadowBlur = 0;
|
|
1142
1124
|
ctx.shadowColor = "transparent";
|
|
1143
1125
|
}
|
|
1144
|
-
|
|
1145
1126
|
//#endregion
|
|
1146
1127
|
//#region src/render/utils/shapes.ts
|
|
1147
1128
|
function roundRectPath(ctx, x, y, width, height, radius) {
|
|
@@ -1158,7 +1139,6 @@ function roundRectPath(ctx, x, y, width, height, radius) {
|
|
|
1158
1139
|
ctx.quadraticCurveTo(x, y, x + tl, y);
|
|
1159
1140
|
ctx.closePath();
|
|
1160
1141
|
}
|
|
1161
|
-
|
|
1162
1142
|
//#endregion
|
|
1163
1143
|
//#region src/render/components/box.ts
|
|
1164
1144
|
function renderBox(ctx, node) {
|
|
@@ -1187,7 +1167,6 @@ function renderBox(ctx, node) {
|
|
|
1187
1167
|
}
|
|
1188
1168
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1189
1169
|
}
|
|
1190
|
-
|
|
1191
1170
|
//#endregion
|
|
1192
1171
|
//#region src/render/components/ProxiedCanvasContext.ts
|
|
1193
1172
|
/**
|
|
@@ -1305,7 +1284,6 @@ function createProxiedCanvasContext(ctx, baseTransform) {
|
|
|
1305
1284
|
}
|
|
1306
1285
|
});
|
|
1307
1286
|
}
|
|
1308
|
-
|
|
1309
1287
|
//#endregion
|
|
1310
1288
|
//#region src/render/components/customDraw.ts
|
|
1311
1289
|
/**
|
|
@@ -1333,7 +1311,6 @@ function renderCustomDraw(ctx, node) {
|
|
|
1333
1311
|
proxyCtx.destroy();
|
|
1334
1312
|
ctx.restore();
|
|
1335
1313
|
}
|
|
1336
|
-
|
|
1337
1314
|
//#endregion
|
|
1338
1315
|
//#region src/render/components/image.ts
|
|
1339
1316
|
function renderImage(ctx, node) {
|
|
@@ -1419,7 +1396,6 @@ function renderImage(ctx, node) {
|
|
|
1419
1396
|
}
|
|
1420
1397
|
if (element.opacity !== void 0 && element.opacity < 1) ctx.globalAlpha = 1;
|
|
1421
1398
|
}
|
|
1422
|
-
|
|
1423
1399
|
//#endregion
|
|
1424
1400
|
//#region src/render/components/richtext.ts
|
|
1425
1401
|
function renderRichText(ctx, node) {
|
|
@@ -1470,7 +1446,6 @@ function renderRichText(ctx, node) {
|
|
|
1470
1446
|
currentY += line.height;
|
|
1471
1447
|
}
|
|
1472
1448
|
}
|
|
1473
|
-
|
|
1474
1449
|
//#endregion
|
|
1475
1450
|
//#region src/render/components/svg.ts
|
|
1476
1451
|
function isGradientDescriptor(color) {
|
|
@@ -1742,7 +1717,6 @@ function renderSvg(ctx, node) {
|
|
|
1742
1717
|
for (const child of element.children) renderSvgChild(ctx, child, transform, bounds, baseTransform);
|
|
1743
1718
|
ctx.restore();
|
|
1744
1719
|
}
|
|
1745
|
-
|
|
1746
1720
|
//#endregion
|
|
1747
1721
|
//#region src/render/components/text.ts
|
|
1748
1722
|
function renderText(ctx, node) {
|
|
@@ -1777,7 +1751,6 @@ function renderText(ctx, node) {
|
|
|
1777
1751
|
}
|
|
1778
1752
|
if (element.shadow) clearShadow$1(ctx);
|
|
1779
1753
|
}
|
|
1780
|
-
|
|
1781
1754
|
//#endregion
|
|
1782
1755
|
//#region src/render/components/transform.ts
|
|
1783
1756
|
/**
|
|
@@ -1853,7 +1826,6 @@ function renderTransform(ctx, node) {
|
|
|
1853
1826
|
renderNode(ctx, childNode);
|
|
1854
1827
|
ctx.restore();
|
|
1855
1828
|
}
|
|
1856
|
-
|
|
1857
1829
|
//#endregion
|
|
1858
1830
|
//#region src/render/index.ts
|
|
1859
1831
|
function renderNode(ctx, node) {
|
|
@@ -1893,7 +1865,6 @@ function renderNode(ctx, node) {
|
|
|
1893
1865
|
break;
|
|
1894
1866
|
}
|
|
1895
1867
|
}
|
|
1896
|
-
|
|
1897
1868
|
//#endregion
|
|
1898
1869
|
//#region src/canvas.ts
|
|
1899
1870
|
/**
|
|
@@ -1963,7 +1934,6 @@ function createCanvas(options) {
|
|
|
1963
1934
|
}
|
|
1964
1935
|
};
|
|
1965
1936
|
}
|
|
1966
|
-
|
|
1967
1937
|
//#endregion
|
|
1968
1938
|
//#region src/components/Box.ts
|
|
1969
1939
|
function Box(props) {
|
|
@@ -1972,7 +1942,6 @@ function Box(props) {
|
|
|
1972
1942
|
...props
|
|
1973
1943
|
};
|
|
1974
1944
|
}
|
|
1975
|
-
|
|
1976
1945
|
//#endregion
|
|
1977
1946
|
//#region src/components/CustomDraw.ts
|
|
1978
1947
|
function CustomDraw(props) {
|
|
@@ -1981,7 +1950,6 @@ function CustomDraw(props) {
|
|
|
1981
1950
|
...props
|
|
1982
1951
|
};
|
|
1983
1952
|
}
|
|
1984
|
-
|
|
1985
1953
|
//#endregion
|
|
1986
1954
|
//#region src/components/Image.ts
|
|
1987
1955
|
function Image(props) {
|
|
@@ -1990,7 +1958,6 @@ function Image(props) {
|
|
|
1990
1958
|
...props
|
|
1991
1959
|
};
|
|
1992
1960
|
}
|
|
1993
|
-
|
|
1994
1961
|
//#endregion
|
|
1995
1962
|
//#region src/components/RichText.ts
|
|
1996
1963
|
function RichText(props) {
|
|
@@ -1999,7 +1966,6 @@ function RichText(props) {
|
|
|
1999
1966
|
...props
|
|
2000
1967
|
};
|
|
2001
1968
|
}
|
|
2002
|
-
|
|
2003
1969
|
//#endregion
|
|
2004
1970
|
//#region src/components/Stack.ts
|
|
2005
1971
|
function Stack(props) {
|
|
@@ -2008,7 +1974,6 @@ function Stack(props) {
|
|
|
2008
1974
|
...props
|
|
2009
1975
|
};
|
|
2010
1976
|
}
|
|
2011
|
-
|
|
2012
1977
|
//#endregion
|
|
2013
1978
|
//#region src/components/Svg.ts
|
|
2014
1979
|
function Svg(props) {
|
|
@@ -2055,7 +2020,6 @@ const svg = {
|
|
|
2055
2020
|
...props
|
|
2056
2021
|
})
|
|
2057
2022
|
};
|
|
2058
|
-
|
|
2059
2023
|
//#endregion
|
|
2060
2024
|
//#region src/components/Text.ts
|
|
2061
2025
|
function Text(props) {
|
|
@@ -2064,7 +2028,6 @@ function Text(props) {
|
|
|
2064
2028
|
...props
|
|
2065
2029
|
};
|
|
2066
2030
|
}
|
|
2067
|
-
|
|
2068
2031
|
//#endregion
|
|
2069
2032
|
//#region src/components/Transform.ts
|
|
2070
2033
|
function Transform(props) {
|
|
@@ -2073,7 +2036,6 @@ function Transform(props) {
|
|
|
2073
2036
|
...props
|
|
2074
2037
|
};
|
|
2075
2038
|
}
|
|
2076
|
-
|
|
2077
2039
|
//#endregion
|
|
2078
2040
|
//#region src/layout/utils/print.ts
|
|
2079
2041
|
/**
|
|
@@ -2133,7 +2095,6 @@ function printLayout(node) {
|
|
|
2133
2095
|
function layoutToString(node, _indent = " ") {
|
|
2134
2096
|
return printLayoutToString(node, "", true).join("\n");
|
|
2135
2097
|
}
|
|
2136
|
-
|
|
2137
2098
|
//#endregion
|
|
2138
2099
|
exports.Box = Box;
|
|
2139
2100
|
exports.CustomDraw = CustomDraw;
|
|
@@ -2150,4 +2111,4 @@ exports.layoutToString = layoutToString;
|
|
|
2150
2111
|
exports.linearGradient = linearGradient;
|
|
2151
2112
|
exports.printLayout = printLayout;
|
|
2152
2113
|
exports.radialGradient = radialGradient;
|
|
2153
|
-
exports.svg = svg;
|
|
2114
|
+
exports.svg = svg;
|
|
@@ -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 };
|