@pixerate/editor 0.267.0 → 0.268.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/dist/animation-editor/index.cjs +62 -62
- package/dist/animation-editor/index.js +6 -6
- package/dist/brushes/index.cjs +198 -72
- package/dist/brushes/index.d.cts +4 -3
- package/dist/brushes/index.d.ts +4 -3
- package/dist/brushes/index.js +136 -10
- package/dist/brushes/library.d.cts +27 -1
- package/dist/brushes/library.d.ts +27 -1
- package/dist/brushes/profiles.d.cts +4 -0
- package/dist/brushes/profiles.d.ts +4 -0
- package/dist/brushes/schema.d.cts +4 -0
- package/dist/brushes/schema.d.ts +4 -0
- package/dist/brushes/sources.d.cts +114 -0
- package/dist/brushes/sources.d.ts +114 -0
- package/dist/brushes/types.d.cts +37 -5
- package/dist/brushes/types.d.ts +37 -5
- package/dist/brushes/ui.d.cts +40 -4
- package/dist/brushes/ui.d.ts +40 -4
- package/dist/{brushstrokeRender-NLFPEBGI.js → brushstrokeRender-A727TTNQ.js} +6 -6
- package/dist/{brushstrokeRender-L7JYRR2R.cjs → brushstrokeRender-WR2N5HHY.cjs} +22 -22
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-J2TNIZ55.cjs → chunk-2WOGXEDX.cjs} +1 -1
- package/dist/{chunk-JGWVZPT6.js → chunk-3XDSNIGF.js} +72 -5
- package/dist/{chunk-EXB2EGBE.cjs → chunk-62MFUHSI.cjs} +16 -16
- package/dist/{chunk-FGJHJIMN.js → chunk-74ODPZLX.js} +10 -10
- package/dist/{chunk-GCVFEPJG.js → chunk-ACTHSQOI.js} +182 -0
- package/dist/{chunk-LHPEG5AU.cjs → chunk-B3G7BKUV.cjs} +90 -90
- package/dist/{chunk-EF7LZAXQ.js → chunk-BAZMCFVL.js} +1 -1
- package/dist/{chunk-HIO6E7LC.cjs → chunk-BPJSI4NT.cjs} +2 -2
- package/dist/{chunk-XVOP3CGQ.cjs → chunk-EU2ZZA6L.cjs} +393 -62
- package/dist/{chunk-YIC6MAJ2.js → chunk-HFY5LG5J.js} +1 -1
- package/dist/{chunk-7UKFXXWL.js → chunk-HVO6XCI4.js} +1 -1
- package/dist/{chunk-OKHKA43L.cjs → chunk-JBB3GDBB.cjs} +330 -216
- package/dist/{chunk-AGNUD5BI.js → chunk-KZI3YWKW.js} +351 -20
- package/dist/{chunk-EYSHTYLG.js → chunk-LETF75CA.js} +1 -1
- package/dist/{chunk-FQPUF2W2.cjs → chunk-NIBFKXMD.cjs} +217 -35
- package/dist/{chunk-G7NHE2VD.cjs → chunk-NPWWSCWT.cjs} +35 -35
- package/dist/{chunk-OSEXT7JL.js → chunk-QNY7BDFP.js} +1 -1
- package/dist/{chunk-PXDIAYB6.cjs → chunk-STLTOISW.cjs} +34 -214
- package/dist/{chunk-4IDUYB45.js → chunk-UVTO3D4E.js} +130 -16
- package/dist/{chunk-TXFWZ5ZJ.js → chunk-W6JDUXP3.js} +4 -184
- package/dist/{chunk-LA5Y4ETA.cjs → chunk-YOVXQHA3.cjs} +23 -23
- package/dist/{chunk-DT4YQUGT.cjs → chunk-YXP6X3SY.cjs} +101 -34
- package/dist/image-editor/index.cjs +851 -851
- package/dist/image-editor/index.js +23 -23
- package/dist/paint/index.cjs +5 -5
- package/dist/paint/index.js +11 -11
- package/dist/paint-editor/brush-library-tools.d.cts +12 -2
- package/dist/paint-editor/brush-library-tools.d.ts +12 -2
- package/dist/paint-editor/brush-model.d.cts +29 -1
- package/dist/paint-editor/brush-model.d.ts +29 -1
- package/dist/paint-editor/brush-source-art.d.cts +32 -0
- package/dist/paint-editor/brush-source-art.d.ts +32 -0
- package/dist/paint-editor/controller.d.cts +6 -1
- package/dist/paint-editor/controller.d.ts +6 -1
- package/dist/paint-editor/dab-stroke.d.cts +2 -0
- package/dist/paint-editor/dab-stroke.d.ts +2 -0
- package/dist/paint-editor/engine.d.cts +11 -2
- package/dist/paint-editor/engine.d.ts +11 -2
- package/dist/paint-editor/index.cjs +576 -481
- package/dist/paint-editor/index.d.cts +3 -1
- package/dist/paint-editor/index.d.ts +3 -1
- package/dist/paint-editor/index.js +127 -32
- package/dist/paint-editor/stamp-tip.d.cts +8 -5
- package/dist/paint-editor/stamp-tip.d.ts +8 -5
- package/dist/paint-editor/thumbnails.d.cts +6 -0
- package/dist/paint-editor/thumbnails.d.ts +6 -0
- package/dist/paint-editor/tip-grain.d.cts +34 -0
- package/dist/paint-editor/tip-grain.d.ts +34 -0
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- package/dist/vector/index.cjs +1002 -1002
- package/dist/vector/index.js +7 -7
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +35 -8
- package/skills/pixerate-brushes-design/SKILL.md +8 -1
- package/skills/pixerate-paint-editor/SKILL.md +6 -0
- package/skills/pixerate-paint-editor/references/brush-facets.md +3 -1
- package/skills/pixerate-paint-sketch-to-finish/SKILL.md +1 -0
|
@@ -115,7 +115,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var
|
|
118
|
+
var _chunkJBB3GDBBcjs = require('./chunk-JBB3GDBB.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
@@ -129,7 +129,7 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
|
|
|
129
129
|
var _chunkJBZRVLXVcjs = require('./chunk-JBZRVLXV.cjs');
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
var
|
|
132
|
+
var _chunkNIBFKXMDcjs = require('./chunk-NIBFKXMD.cjs');
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
|
|
@@ -137,11 +137,11 @@ var _chunkFQPUF2W2cjs = require('./chunk-FQPUF2W2.cjs');
|
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
141
140
|
|
|
142
141
|
|
|
143
142
|
|
|
144
143
|
|
|
144
|
+
var _chunk2VX55NFMcjs = require('./chunk-2VX55NFM.cjs');
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
|
|
@@ -149,7 +149,7 @@ var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
|
|
152
|
-
var
|
|
152
|
+
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
|
|
@@ -2010,7 +2010,7 @@ function mapAnchor(a, f) {
|
|
|
2010
2010
|
return out;
|
|
2011
2011
|
}
|
|
2012
2012
|
function mapSubpaths(subpaths, f) {
|
|
2013
|
-
return
|
|
2013
|
+
return _chunkJBB3GDBBcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2014
2014
|
}
|
|
2015
2015
|
function liveShapeSubpaths(live) {
|
|
2016
2016
|
let out;
|
|
@@ -2018,19 +2018,19 @@ function liveShapeSubpaths(live) {
|
|
|
2018
2018
|
case "rect": {
|
|
2019
2019
|
const x = Math.min(live.x, live.x + live.width);
|
|
2020
2020
|
const y = Math.min(live.y, live.y + live.height);
|
|
2021
|
-
const sp =
|
|
2021
|
+
const sp = _chunkJBB3GDBBcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2022
2022
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2023
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2023
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkJBB3GDBBcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2024
2024
|
break;
|
|
2025
2025
|
}
|
|
2026
2026
|
case "ellipse":
|
|
2027
|
-
out = [
|
|
2027
|
+
out = [_chunkJBB3GDBBcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2028
2028
|
break;
|
|
2029
2029
|
case "polygon":
|
|
2030
|
-
out = [
|
|
2030
|
+
out = [_chunkJBB3GDBBcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2031
2031
|
break;
|
|
2032
2032
|
case "star":
|
|
2033
|
-
out = [
|
|
2033
|
+
out = [_chunkJBB3GDBBcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2034
2034
|
break;
|
|
2035
2035
|
case "line": {
|
|
2036
2036
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2053,7 +2053,7 @@ function liveShapeSubpaths(live) {
|
|
|
2053
2053
|
}
|
|
2054
2054
|
}
|
|
2055
2055
|
const m = live.transform;
|
|
2056
|
-
return m && !
|
|
2056
|
+
return m && !_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2057
2057
|
}
|
|
2058
2058
|
function normBox(b) {
|
|
2059
2059
|
return { x: Math.min(b.x, b.x + b.width), y: Math.min(b.y, b.y + b.height), width: Math.abs(b.width), height: Math.abs(b.height) };
|
|
@@ -2065,7 +2065,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2065
2065
|
function componentPath(c) {
|
|
2066
2066
|
let p = pathCache.get(c.subpaths);
|
|
2067
2067
|
if (!p) {
|
|
2068
|
-
p =
|
|
2068
|
+
p = _chunkJBB3GDBBcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2069
2069
|
pathCache.set(c.subpaths, p);
|
|
2070
2070
|
}
|
|
2071
2071
|
return p;
|
|
@@ -2392,7 +2392,7 @@ function matrixArg(v, path) {
|
|
|
2392
2392
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2393
2393
|
const m = v;
|
|
2394
2394
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2395
|
-
return
|
|
2395
|
+
return _chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2396
2396
|
}
|
|
2397
2397
|
function normalizeLiveShape(v, path = "shape") {
|
|
2398
2398
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2453,7 +2453,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2453
2453
|
if (typeof v === "string") {
|
|
2454
2454
|
let subs;
|
|
2455
2455
|
try {
|
|
2456
|
-
subs =
|
|
2456
|
+
subs = _chunkJBB3GDBBcjs.bezierToSubpaths.call(void 0, v);
|
|
2457
2457
|
} catch (e5) {
|
|
2458
2458
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2459
2459
|
}
|
|
@@ -2539,15 +2539,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2539
2539
|
function transformShapeComponents(components, f, affine) {
|
|
2540
2540
|
return components.map((c) => {
|
|
2541
2541
|
if (affine && c.live) {
|
|
2542
|
-
const live = { ...c.live, transform:
|
|
2543
|
-
if (
|
|
2542
|
+
const live = { ...c.live, transform: _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkJBB3GDBBcjs.IDENTITY_MATRIX)), affine) };
|
|
2543
|
+
if (_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2544
2544
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2545
2545
|
}
|
|
2546
2546
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2547
2547
|
});
|
|
2548
2548
|
}
|
|
2549
2549
|
function offsetShape(layer, dx, dy, env) {
|
|
2550
|
-
const m =
|
|
2550
|
+
const m = _chunkJBB3GDBBcjs.translateMatrix.call(void 0, dx, dy);
|
|
2551
2551
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2552
2552
|
delete next.annotation;
|
|
2553
2553
|
return rerenderShape(next, env);
|
|
@@ -2555,7 +2555,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2555
2555
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2556
2556
|
if (components.length < 2) return [...components];
|
|
2557
2557
|
const path = shapeOutline(components, fillRule);
|
|
2558
|
-
const subpaths =
|
|
2558
|
+
const subpaths = _chunkJBB3GDBBcjs.bezierToSubpaths.call(void 0, path);
|
|
2559
2559
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2560
2560
|
return [{ op: "combine", subpaths }];
|
|
2561
2561
|
}
|
|
@@ -2572,7 +2572,7 @@ function annotationPaint(color, opacity) {
|
|
|
2572
2572
|
function shapeFromAnnotation(a) {
|
|
2573
2573
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2574
2574
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2575
|
-
const rotation = a.rotation ?
|
|
2575
|
+
const rotation = a.rotation ? _chunkJBB3GDBBcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2576
2576
|
const t = rotation ? { transform: rotation } : {};
|
|
2577
2577
|
const live = (l) => liveComponent(l);
|
|
2578
2578
|
switch (a.type) {
|
|
@@ -2615,7 +2615,7 @@ function shapeFromAnnotation(a) {
|
|
|
2615
2615
|
case "pen": {
|
|
2616
2616
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2617
2617
|
if (!paint) return null;
|
|
2618
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2618
|
+
const pts = rotation ? a.points.map((p) => _chunkJBB3GDBBcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2619
2619
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2620
2620
|
return {
|
|
2621
2621
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2648,7 +2648,7 @@ var JOIN_SIGMA = 2;
|
|
|
2648
2648
|
function vectorMaskSegments(components) {
|
|
2649
2649
|
const out = [];
|
|
2650
2650
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2651
|
-
for (let k = 0; k <
|
|
2651
|
+
for (let k = 0; k < _chunkJBB3GDBBcjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2652
2652
|
}));
|
|
2653
2653
|
return out;
|
|
2654
2654
|
}
|
|
@@ -2656,7 +2656,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2656
2656
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2657
2657
|
return edges.filter((e) => {
|
|
2658
2658
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2659
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2659
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkJBB3GDBBcjs.subpathSegmentCount.call(void 0, sp);
|
|
2660
2660
|
});
|
|
2661
2661
|
}
|
|
2662
2662
|
function reach(e) {
|
|
@@ -2679,8 +2679,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2679
2679
|
const seedClass = [];
|
|
2680
2680
|
vm.components.forEach(
|
|
2681
2681
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2682
|
-
for (let k = 0; k <
|
|
2683
|
-
const seg =
|
|
2682
|
+
for (let k = 0; k < _chunkJBB3GDBBcjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
2683
|
+
const seg = _chunkJBB3GDBBcjs.subpathSegment.call(void 0, sp, k);
|
|
2684
2684
|
let len = 0;
|
|
2685
2685
|
for (let i = 1; i < seg.length; i++) len += Math.hypot(seg[i][0] - seg[i - 1][0], seg[i][1] - seg[i - 1][1]);
|
|
2686
2686
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3580,7 +3580,7 @@ var fail3 = (message) => {
|
|
|
3580
3580
|
};
|
|
3581
3581
|
var TEXT_RENDER_MARGIN = _chunkPVJMTLPJcjs.MAX_EFFECT_REACH;
|
|
3582
3582
|
function textMatrix(layer) {
|
|
3583
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3583
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkJBB3GDBBcjs.IDENTITY_MATRIX));
|
|
3584
3584
|
}
|
|
3585
3585
|
function rectCorners(r) {
|
|
3586
3586
|
return [
|
|
@@ -3591,7 +3591,7 @@ function rectCorners(r) {
|
|
|
3591
3591
|
];
|
|
3592
3592
|
}
|
|
3593
3593
|
function docRect(r, m) {
|
|
3594
|
-
const pts = rectCorners(r).map((p) =>
|
|
3594
|
+
const pts = rectCorners(r).map((p) => _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, p));
|
|
3595
3595
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3596
3596
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3597
3597
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3611,7 +3611,7 @@ function inkBounds(layout) {
|
|
|
3611
3611
|
for (const f of l.fragments) {
|
|
3612
3612
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3613
3613
|
const w = f.carets[f.carets.length - 1];
|
|
3614
|
-
const r =
|
|
3614
|
+
const r = _chunkJBB3GDBBcjs.transformTextRect.call(void 0, l.matrix, { x: f.x - pad, y: l.baseline - l.ascent - pad + Math.min(0, f.y - l.baseline), width: w + 2 * pad, height: l.ascent + l.descent + 2 * pad + Math.abs(f.y - l.baseline) });
|
|
3615
3615
|
if (!b) b = r;
|
|
3616
3616
|
else {
|
|
3617
3617
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3624,14 +3624,14 @@ function inkBounds(layout) {
|
|
|
3624
3624
|
}
|
|
3625
3625
|
function textOutlines(layer, shaper) {
|
|
3626
3626
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3627
|
-
const layout =
|
|
3627
|
+
const layout = _chunkJBB3GDBBcjs.layoutText.call(void 0, layer, shaper);
|
|
3628
3628
|
const m = textMatrix(layer);
|
|
3629
3629
|
const out = [];
|
|
3630
3630
|
for (const l of layout.lines) {
|
|
3631
3631
|
for (const f of l.fragments) {
|
|
3632
|
-
let path =
|
|
3633
|
-
for (const r of
|
|
3634
|
-
out.push({ fragment: f, path:
|
|
3632
|
+
let path = _chunkJBB3GDBBcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3633
|
+
for (const r of _chunkJBB3GDBBcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkJBB3GDBBcjs.textRectPath.call(void 0, r)];
|
|
3634
|
+
out.push({ fragment: f, path: _chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3635
3635
|
}
|
|
3636
3636
|
}
|
|
3637
3637
|
return out;
|
|
@@ -3687,7 +3687,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3687
3687
|
const canvas = env.createCanvas(region.width, region.height);
|
|
3688
3688
|
const ctx = canvas.getContext("2d");
|
|
3689
3689
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
3690
|
-
const layout =
|
|
3690
|
+
const layout = _chunkJBB3GDBBcjs.layoutText.call(void 0, layer, shaper);
|
|
3691
3691
|
const m = textMatrix(layer);
|
|
3692
3692
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3693
3693
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -3697,8 +3697,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3697
3697
|
const [r, g, b] = rgbOf(f.style.color);
|
|
3698
3698
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
3699
3699
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
3700
|
-
|
|
3701
|
-
for (const d of
|
|
3700
|
+
_chunkJBB3GDBBcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
3701
|
+
for (const d of _chunkJBB3GDBBcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
3702
3702
|
}
|
|
3703
3703
|
}
|
|
3704
3704
|
ctx.globalAlpha = 1;
|
|
@@ -3709,7 +3709,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3709
3709
|
function renderText(layer, env) {
|
|
3710
3710
|
const shaper = env.shaper;
|
|
3711
3711
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
3712
|
-
const layout =
|
|
3712
|
+
const layout = _chunkJBB3GDBBcjs.layoutText.call(void 0, layer, shaper);
|
|
3713
3713
|
const ink = inkBounds(layout);
|
|
3714
3714
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
3715
3715
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -3810,7 +3810,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
3810
3810
|
continue;
|
|
3811
3811
|
}
|
|
3812
3812
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
3813
|
-
if (k === "autoLeading" && value ===
|
|
3813
|
+
if (k === "autoLeading" && value === _chunkJBB3GDBBcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
3814
3814
|
else o[k] = value;
|
|
3815
3815
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
3816
3816
|
}
|
|
@@ -3851,15 +3851,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
3851
3851
|
opacity: 1,
|
|
3852
3852
|
blend: "normal",
|
|
3853
3853
|
text: text3,
|
|
3854
|
-
runs:
|
|
3855
|
-
paragraphs:
|
|
3854
|
+
runs: _chunkJBB3GDBBcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE),
|
|
3855
|
+
paragraphs: _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
3856
3856
|
frame: init.frame,
|
|
3857
3857
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
3858
3858
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
3859
3859
|
offset: { x: 0, y: 0 }
|
|
3860
3860
|
};
|
|
3861
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
3862
|
-
if (init.transform && !
|
|
3861
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE)) }];
|
|
3862
|
+
if (init.transform && !_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
3863
3863
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
3864
3864
|
return rerenderText(layer, env);
|
|
3865
3865
|
}
|
|
@@ -3870,24 +3870,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3870
3870
|
const next = { ...current, ...patch };
|
|
3871
3871
|
if (!("annotation" in patch)) delete next.annotation;
|
|
3872
3872
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
3873
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
3874
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
3875
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
3873
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkJBB3GDBBcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE)));
|
|
3874
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkJBB3GDBBcjs.styleAt.call(void 0, current.runs, 0, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE) }];
|
|
3875
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
3876
3876
|
const rendered = rerenderText(next, env);
|
|
3877
3877
|
return { layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
3878
3878
|
}
|
|
3879
3879
|
function replaceTextRange(layer, start, end, insert) {
|
|
3880
3880
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
3881
|
-
const style =
|
|
3882
|
-
const runs =
|
|
3883
|
-
const pstyle =
|
|
3884
|
-
const paragraphs =
|
|
3885
|
-
return { text: text3, runs, paragraphs:
|
|
3881
|
+
const style = _chunkJBB3GDBBcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE);
|
|
3882
|
+
const runs = _chunkJBB3GDBBcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
3883
|
+
const pstyle = _chunkJBB3GDBBcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
3884
|
+
const paragraphs = _chunkJBB3GDBBcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
3885
|
+
return { text: text3, runs, paragraphs: _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
3886
3886
|
}
|
|
3887
3887
|
function transformTypeLayer(layer, m) {
|
|
3888
|
-
const t =
|
|
3888
|
+
const t = _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
3889
3889
|
const next = { ...layer };
|
|
3890
|
-
if (
|
|
3890
|
+
if (_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
3891
3891
|
else next.transform = t;
|
|
3892
3892
|
delete next.annotation;
|
|
3893
3893
|
return next;
|
|
@@ -3895,7 +3895,7 @@ function transformTypeLayer(layer, m) {
|
|
|
3895
3895
|
function typeFrame(layer, shaper) {
|
|
3896
3896
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
3897
3897
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
3898
|
-
const b =
|
|
3898
|
+
const b = _chunkJBB3GDBBcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
3899
3899
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
3900
3900
|
}
|
|
3901
3901
|
function typeAsPixelLayer(layer) {
|
|
@@ -3903,7 +3903,7 @@ function typeAsPixelLayer(layer) {
|
|
|
3903
3903
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
3904
3904
|
}
|
|
3905
3905
|
function toTextSpace(layer, p) {
|
|
3906
|
-
return
|
|
3906
|
+
return _chunkJBB3GDBBcjs.applyMatrix.call(void 0, _chunkJBB3GDBBcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
3907
3907
|
}
|
|
3908
3908
|
function typeFromAnnotation(a) {
|
|
3909
3909
|
if (a.type !== "text") return null;
|
|
@@ -3917,7 +3917,7 @@ function typeFromAnnotation(a) {
|
|
|
3917
3917
|
if (op !== 1) style.opacity = op;
|
|
3918
3918
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
3919
3919
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
3920
|
-
const transform = t.rotation ?
|
|
3920
|
+
const transform = t.rotation ? _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, translate, _chunkJBB3GDBBcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
3921
3921
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
3922
3922
|
}
|
|
3923
3923
|
function annotationOfType(layer) {
|
|
@@ -4557,7 +4557,7 @@ function identityTransform(box2) {
|
|
|
4557
4557
|
}
|
|
4558
4558
|
function cornersFromMatrix(box2, m) {
|
|
4559
4559
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4560
|
-
return [
|
|
4560
|
+
return [_chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[0]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[1]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[2]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4561
4561
|
}
|
|
4562
4562
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4563
4563
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4574,7 +4574,7 @@ function transformHomography(geometry) {
|
|
|
4574
4574
|
function hasWarp(geometry) {
|
|
4575
4575
|
const w = geometry.warp;
|
|
4576
4576
|
if (!w) return false;
|
|
4577
|
-
const id =
|
|
4577
|
+
const id = _chunkJBB3GDBBcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4578
4578
|
if (id.points.length !== w.points.length || id.us.some((u, i) => Math.abs(u - w.us[i]) > 1e-12) || id.vs.some((v, i) => Math.abs(v - w.vs[i]) > 1e-12)) return true;
|
|
4579
4579
|
return w.points.some((p, i) => Math.abs(p.x - id.points[i].x) > 1e-6 || Math.abs(p.y - id.points[i].y) > 1e-6);
|
|
4580
4580
|
}
|
|
@@ -4589,7 +4589,7 @@ function transformMap(geometry) {
|
|
|
4589
4589
|
const { box: box2 } = geometry;
|
|
4590
4590
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4591
4591
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4592
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4592
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkJBB3GDBBcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4593
4593
|
}
|
|
4594
4594
|
function transformedPoint(geometry, fx, fy) {
|
|
4595
4595
|
const f = transformMap(geometry);
|
|
@@ -4633,8 +4633,8 @@ function matrixFromParams(box2, params) {
|
|
|
4633
4633
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4634
4634
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4635
4635
|
const ref = referencePoint(box2, params.reference);
|
|
4636
|
-
const linear =
|
|
4637
|
-
return
|
|
4636
|
+
const linear = _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkJBB3GDBBcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4637
|
+
return _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, _chunkJBB3GDBBcjs.matrixAbout.call(void 0, linear, ref), _chunkJBB3GDBBcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4638
4638
|
}
|
|
4639
4639
|
function describeTransform(geometry, reference = "center") {
|
|
4640
4640
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4651,7 +4651,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4651
4651
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4652
4652
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4653
4653
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4654
|
-
const at =
|
|
4654
|
+
const at = _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, ref);
|
|
4655
4655
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4656
4656
|
return {
|
|
4657
4657
|
affine: true,
|
|
@@ -4669,24 +4669,24 @@ function applyParams(geometry, params) {
|
|
|
4669
4669
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4670
4670
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4671
4671
|
const c = geometry.corners;
|
|
4672
|
-
return [
|
|
4672
|
+
return [_chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, c[0]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, c[1]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, c[2]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4673
4673
|
}
|
|
4674
4674
|
function flipCorners(geometry, axis) {
|
|
4675
4675
|
const c = anchorPoint(geometry, "center");
|
|
4676
4676
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4677
4677
|
const q2 = geometry.corners;
|
|
4678
|
-
return [
|
|
4678
|
+
return [_chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[0]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[1]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[2]), _chunkJBB3GDBBcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4679
4679
|
}
|
|
4680
4680
|
function boxPointOf(geometry, p) {
|
|
4681
4681
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4682
|
-
if (m) return
|
|
4682
|
+
if (m) return _chunkJBB3GDBBcjs.applyMatrix.call(void 0, _chunkJBB3GDBBcjs.invertMatrix.call(void 0, m), p);
|
|
4683
4683
|
return null;
|
|
4684
4684
|
}
|
|
4685
4685
|
function presetWarp(box2, preset) {
|
|
4686
|
-
return
|
|
4686
|
+
return _chunkJBB3GDBBcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4687
4687
|
}
|
|
4688
4688
|
function isValidWarp(mesh) {
|
|
4689
|
-
return
|
|
4689
|
+
return _chunkJBB3GDBBcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4690
4690
|
}
|
|
4691
4691
|
function geometryHomography(geometry) {
|
|
4692
4692
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4965,7 +4965,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4965
4965
|
}
|
|
4966
4966
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4967
4967
|
if (raw.warp) {
|
|
4968
|
-
if (!
|
|
4968
|
+
if (!_chunkJBB3GDBBcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
|
|
4969
4969
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4970
4970
|
}
|
|
4971
4971
|
if (raw.interpolation !== void 0) {
|
|
@@ -5069,7 +5069,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5069
5069
|
case "shape": {
|
|
5070
5070
|
const next = {
|
|
5071
5071
|
...layer,
|
|
5072
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5072
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkJBB3GDBBcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5073
5073
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5074
5074
|
mask: moveMask(layer.mask)
|
|
5075
5075
|
};
|
|
@@ -5078,7 +5078,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5078
5078
|
return next;
|
|
5079
5079
|
}
|
|
5080
5080
|
case "type": {
|
|
5081
|
-
const next = { ...transformTypeLayer(layer,
|
|
5081
|
+
const next = { ...transformTypeLayer(layer, _chunkJBB3GDBBcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5082
5082
|
if (!next.mask) delete next.mask;
|
|
5083
5083
|
return next;
|
|
5084
5084
|
}
|
|
@@ -5264,7 +5264,7 @@ function refitPlacement(layer, contents) {
|
|
|
5264
5264
|
});
|
|
5265
5265
|
const out = { corners: pts };
|
|
5266
5266
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5267
|
-
if (layer.placement.warp) out.warp =
|
|
5267
|
+
if (layer.placement.warp) out.warp = _chunkJBB3GDBBcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5268
5268
|
return out;
|
|
5269
5269
|
}
|
|
5270
5270
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5641,7 +5641,7 @@ function readType(r, base, ctx) {
|
|
|
5641
5641
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5642
5642
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5643
5643
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5644
|
-
style: patchTextStyle(
|
|
5644
|
+
style: patchTextStyle(_chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5645
5645
|
}));
|
|
5646
5646
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5647
5647
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5654,13 +5654,13 @@ function readType(r, base, ctx) {
|
|
|
5654
5654
|
...base,
|
|
5655
5655
|
type: "type",
|
|
5656
5656
|
text: text3,
|
|
5657
|
-
runs:
|
|
5658
|
-
paragraphs:
|
|
5657
|
+
runs: _chunkJBB3GDBBcjs.fitRuns.call(void 0, runs, text3.length, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE),
|
|
5658
|
+
paragraphs: _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5659
5659
|
frame,
|
|
5660
5660
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5661
5661
|
offset: { x: 0, y: 0 }
|
|
5662
5662
|
};
|
|
5663
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5663
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5664
5664
|
if (m) layer.transform = m;
|
|
5665
5665
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5666
5666
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6130,7 +6130,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6130
6130
|
let placement;
|
|
6131
6131
|
try {
|
|
6132
6132
|
const raw = { corners: p.corners };
|
|
6133
|
-
if (p.warp &&
|
|
6133
|
+
if (p.warp && _chunkJBB3GDBBcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6134
6134
|
if (_chunkPVJMTLPJcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6135
6135
|
placement = normalizePlacement(raw, contents);
|
|
6136
6136
|
} catch (e) {
|
|
@@ -7301,7 +7301,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7301
7301
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7302
7302
|
const subpaths = [];
|
|
7303
7303
|
components.forEach((c, ci) => {
|
|
7304
|
-
|
|
7304
|
+
_chunkJBB3GDBBcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7305
7305
|
if (!sp.anchors.length) return;
|
|
7306
7306
|
subpaths.push({
|
|
7307
7307
|
closed: sp.closed,
|
|
@@ -8127,7 +8127,7 @@ function merged(levels) {
|
|
|
8127
8127
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8128
8128
|
const n = (k) => eNum(eGet(d, k));
|
|
8129
8129
|
const flag = (k) => eBool(eGet(d, k));
|
|
8130
|
-
const s = { ...
|
|
8130
|
+
const s = { ..._chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE };
|
|
8131
8131
|
const fi = n("Font");
|
|
8132
8132
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8133
8133
|
if (ps) {
|
|
@@ -8212,7 +8212,7 @@ function typeFromTySh(data, notes) {
|
|
|
8212
8212
|
}
|
|
8213
8213
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8214
8214
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8215
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8215
|
+
let runs = [{ length: text3.length, style: { ..._chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE } }];
|
|
8216
8216
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8217
8217
|
let frame = { kind: "point" };
|
|
8218
8218
|
let transform = t.transform;
|
|
@@ -8268,14 +8268,14 @@ function typeFromTySh(data, notes) {
|
|
|
8268
8268
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8269
8269
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8270
8270
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8271
|
-
transform =
|
|
8271
|
+
transform = _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8272
8272
|
}
|
|
8273
8273
|
}
|
|
8274
8274
|
}
|
|
8275
8275
|
return {
|
|
8276
8276
|
text: text3,
|
|
8277
|
-
runs:
|
|
8278
|
-
paragraphs:
|
|
8277
|
+
runs: _chunkJBB3GDBBcjs.fitRuns.call(void 0, runs, text3.length, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE),
|
|
8278
|
+
paragraphs: _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8279
8279
|
frame,
|
|
8280
8280
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8281
8281
|
transform,
|
|
@@ -8351,7 +8351,7 @@ function buildEngineData(layer, template) {
|
|
|
8351
8351
|
fonts.push(ps);
|
|
8352
8352
|
return fonts.length - 1;
|
|
8353
8353
|
};
|
|
8354
|
-
const runs =
|
|
8354
|
+
const runs = _chunkJBB3GDBBcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE);
|
|
8355
8355
|
const vertical = layer.orientation === "vertical";
|
|
8356
8356
|
const sruns = [];
|
|
8357
8357
|
const slens = [];
|
|
@@ -8360,10 +8360,10 @@ function buildEngineData(layer, template) {
|
|
|
8360
8360
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8361
8361
|
});
|
|
8362
8362
|
if (!runs.length) {
|
|
8363
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8363
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8364
8364
|
slens.push(E.int(1));
|
|
8365
8365
|
}
|
|
8366
|
-
const paras =
|
|
8366
|
+
const paras = _chunkJBB3GDBBcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8367
8367
|
const pruns = [];
|
|
8368
8368
|
const plens = [];
|
|
8369
8369
|
paras.forEach((p, i) => {
|
|
@@ -8419,7 +8419,7 @@ function buildEngineData(layer, template) {
|
|
|
8419
8419
|
eSet(e, key, rd);
|
|
8420
8420
|
}
|
|
8421
8421
|
eSet(rd, "FontSet", fontSet);
|
|
8422
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.style]), () => (
|
|
8422
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.style]), () => ( _chunkJBB3GDBBcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8423
8423
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8424
8424
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8425
8425
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8430,13 +8430,13 @@ function inkBounds2(layer) {
|
|
|
8430
8430
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8431
8431
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8432
8432
|
if (!b) return [0, 0, 0, 0];
|
|
8433
|
-
const inv =
|
|
8433
|
+
const inv = _chunkJBB3GDBBcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8434
8434
|
const pts = [
|
|
8435
8435
|
{ x: b.x, y: b.y },
|
|
8436
8436
|
{ x: b.x + b.width, y: b.y },
|
|
8437
8437
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8438
8438
|
{ x: b.x, y: b.y + b.height }
|
|
8439
|
-
].map((p) =>
|
|
8439
|
+
].map((p) => _chunkJBB3GDBBcjs.applyMatrix.call(void 0, inv, p));
|
|
8440
8440
|
return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
|
|
8441
8441
|
}
|
|
8442
8442
|
function tyShForLayer(layer) {
|
|
@@ -8717,7 +8717,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8717
8717
|
var warpStyleOf = (name) => {
|
|
8718
8718
|
if (!name.startsWith("warp")) return null;
|
|
8719
8719
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8720
|
-
return
|
|
8720
|
+
return _chunkJBB3GDBBcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8721
8721
|
};
|
|
8722
8722
|
function warpFromDescriptor(w, contents) {
|
|
8723
8723
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8747,7 +8747,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8747
8747
|
} else {
|
|
8748
8748
|
const style = warpStyleOf(styleName);
|
|
8749
8749
|
if (!style) return void 0;
|
|
8750
|
-
mesh =
|
|
8750
|
+
mesh = _chunkJBB3GDBBcjs.warpPresetMesh.call(void 0,
|
|
8751
8751
|
{
|
|
8752
8752
|
style,
|
|
8753
8753
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8762,7 +8762,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8762
8762
|
const same = Math.abs(bounds.x) < 1e-6 && Math.abs(bounds.y) < 1e-6 && Math.abs(bounds.width - contents.width) < 1e-6 && Math.abs(bounds.height - contents.height) < 1e-6;
|
|
8763
8763
|
if (!same) {
|
|
8764
8764
|
const m = mesh;
|
|
8765
|
-
mesh =
|
|
8765
|
+
mesh = _chunkJBB3GDBBcjs.fitWarpMesh.call(void 0, (s, t) => _chunkJBB3GDBBcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8766
8766
|
}
|
|
8767
8767
|
return { mesh, frame };
|
|
8768
8768
|
}
|
|
@@ -10354,7 +10354,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10354
10354
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10355
10355
|
const kx = contents.width / size.width;
|
|
10356
10356
|
const ky = contents.height / size.height;
|
|
10357
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10357
|
+
if (placement.warp) placement = { ...placement, warp: _chunkJBB3GDBBcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10358
10358
|
}
|
|
10359
10359
|
}
|
|
10360
10360
|
if (!contents || !placement) {
|
|
@@ -12796,7 +12796,7 @@ function handlePaintShortcut(controller, e) {
|
|
|
12796
12796
|
}
|
|
12797
12797
|
if (key === "]" || key === "}") {
|
|
12798
12798
|
if (e.shiftKey || key === "}") set({ hardness: Math.min(1, Math.round((brush.hardness + 0.25) * 4) / 4) });
|
|
12799
|
-
else set({ size: Math.min(
|
|
12799
|
+
else set({ size: Math.min(_chunkNIBFKXMDcjs.MAX_BRUSH_SIZE, brush.size + sizeStep(brush.size)) });
|
|
12800
12800
|
return true;
|
|
12801
12801
|
}
|
|
12802
12802
|
if (/^[0-9]$/.test(key) && isPaintTool(controller.getState().activeTool)) {
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= import("./brushstrokeRender-
|
|
77
|
+
loading ??= import("./brushstrokeRender-A727TTNQ.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|