@pixerate/editor 0.263.0 → 0.264.1
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 +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/brushes/index.cjs +155 -68
- package/dist/brushes/index.d.cts +3 -3
- package/dist/brushes/index.d.ts +3 -3
- package/dist/brushes/index.js +111 -24
- package/dist/brushes/library.d.cts +2 -0
- package/dist/brushes/library.d.ts +2 -0
- package/dist/brushes/profiles.d.cts +21 -2
- package/dist/brushes/profiles.d.ts +21 -2
- package/dist/brushes/ui.d.cts +57 -4
- package/dist/brushes/ui.d.ts +57 -4
- package/dist/{brushstrokeRender-S5DABANG.js → brushstrokeRender-3MOI7PH4.js} +2 -2
- package/dist/{brushstrokeRender-2GBME4XD.cjs → brushstrokeRender-SMMPIJF2.cjs} +12 -12
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-CNLO6E2K.js → chunk-4OJC4MCD.js} +8 -7
- package/dist/{chunk-ZBACQHW3.cjs → chunk-BY5EBP26.cjs} +27 -6
- package/dist/{chunk-JGI4PZWO.js → chunk-CECCP2V7.js} +1 -1
- package/dist/{chunk-P5343XZO.js → chunk-EE7SAYBF.js} +23 -2
- package/dist/{chunk-TILEUVRO.cjs → chunk-F3KKR6DD.cjs} +35 -34
- package/dist/{chunk-TIHW7CUY.cjs → chunk-FQC5TDB6.cjs} +35 -35
- package/dist/{chunk-4E6BGHWN.cjs → chunk-G5ADO47G.cjs} +1 -1
- package/dist/{chunk-QW7LKWKE.js → chunk-HAUDEVMC.js} +1 -1
- package/dist/{chunk-LG6MEEV7.js → chunk-JEML4FSA.js} +1 -1
- package/dist/{chunk-XQW6R7VW.cjs → chunk-KXNZNOEF.cjs} +86 -86
- package/dist/{chunk-6XX7E7O2.js → chunk-ROBSFJ6F.js} +1 -1
- package/dist/{chunk-LWHUU6A6.cjs → chunk-USJX5SW4.cjs} +10 -10
- package/dist/{chunk-73QFSPDG.cjs → chunk-V7MJ4HIN.cjs} +23 -23
- package/dist/{chunk-34HIZXFX.js → chunk-WWI6FLH2.js} +1 -1
- package/dist/image-editor/controller.d.cts +3 -0
- package/dist/image-editor/controller.d.ts +3 -0
- package/dist/image-editor/index.cjs +789 -786
- package/dist/image-editor/index.js +7 -4
- package/dist/image-editor/types.d.cts +7 -0
- package/dist/image-editor/types.d.ts +7 -0
- package/dist/paint-editor/brush-library-tools.d.cts +8 -1
- package/dist/paint-editor/brush-library-tools.d.ts +8 -1
- package/dist/paint-editor/controller.d.cts +1 -1
- package/dist/paint-editor/controller.d.ts +1 -1
- package/dist/paint-editor/index.cjs +88 -83
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +16 -11
- package/dist/vector/controller.d.cts +13 -0
- package/dist/vector/controller.d.ts +13 -0
- package/dist/vector/index.cjs +1215 -1205
- package/dist/vector/index.js +16 -6
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +11 -3
- package/skills/pixerate-brushes-design/SKILL.md +1 -0
- package/skills/pixerate-vector/SKILL.md +1 -1
|
@@ -108,7 +108,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
var
|
|
111
|
+
var _chunkUSJX5SW4cjs = require('./chunk-USJX5SW4.cjs');
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
|
|
@@ -2336,7 +2336,7 @@ function mapAnchor(a, f) {
|
|
|
2336
2336
|
return out;
|
|
2337
2337
|
}
|
|
2338
2338
|
function mapSubpaths(subpaths, f) {
|
|
2339
|
-
return
|
|
2339
|
+
return _chunkUSJX5SW4cjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2340
2340
|
}
|
|
2341
2341
|
function liveShapeSubpaths(live) {
|
|
2342
2342
|
let out;
|
|
@@ -2344,19 +2344,19 @@ function liveShapeSubpaths(live) {
|
|
|
2344
2344
|
case "rect": {
|
|
2345
2345
|
const x = Math.min(live.x, live.x + live.width);
|
|
2346
2346
|
const y = Math.min(live.y, live.y + live.height);
|
|
2347
|
-
const sp =
|
|
2347
|
+
const sp = _chunkUSJX5SW4cjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2348
2348
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2349
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2349
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkUSJX5SW4cjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2350
2350
|
break;
|
|
2351
2351
|
}
|
|
2352
2352
|
case "ellipse":
|
|
2353
|
-
out = [
|
|
2353
|
+
out = [_chunkUSJX5SW4cjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2354
2354
|
break;
|
|
2355
2355
|
case "polygon":
|
|
2356
|
-
out = [
|
|
2356
|
+
out = [_chunkUSJX5SW4cjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2357
2357
|
break;
|
|
2358
2358
|
case "star":
|
|
2359
|
-
out = [
|
|
2359
|
+
out = [_chunkUSJX5SW4cjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2360
2360
|
break;
|
|
2361
2361
|
case "line": {
|
|
2362
2362
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2379,7 +2379,7 @@ function liveShapeSubpaths(live) {
|
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
2381
|
const m = live.transform;
|
|
2382
|
-
return m && !
|
|
2382
|
+
return m && !_chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2383
2383
|
}
|
|
2384
2384
|
function normBox(b) {
|
|
2385
2385
|
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) };
|
|
@@ -2391,7 +2391,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2391
2391
|
function componentPath(c) {
|
|
2392
2392
|
let p = pathCache.get(c.subpaths);
|
|
2393
2393
|
if (!p) {
|
|
2394
|
-
p =
|
|
2394
|
+
p = _chunkUSJX5SW4cjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2395
2395
|
pathCache.set(c.subpaths, p);
|
|
2396
2396
|
}
|
|
2397
2397
|
return p;
|
|
@@ -2718,7 +2718,7 @@ function matrixArg(v, path) {
|
|
|
2718
2718
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2719
2719
|
const m = v;
|
|
2720
2720
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2721
|
-
return
|
|
2721
|
+
return _chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2722
2722
|
}
|
|
2723
2723
|
function normalizeLiveShape(v, path = "shape") {
|
|
2724
2724
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2779,7 +2779,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2779
2779
|
if (typeof v === "string") {
|
|
2780
2780
|
let subs;
|
|
2781
2781
|
try {
|
|
2782
|
-
subs =
|
|
2782
|
+
subs = _chunkUSJX5SW4cjs.bezierToSubpaths.call(void 0, v);
|
|
2783
2783
|
} catch (e5) {
|
|
2784
2784
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2785
2785
|
}
|
|
@@ -2865,15 +2865,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2865
2865
|
function transformShapeComponents(components, f, affine) {
|
|
2866
2866
|
return components.map((c) => {
|
|
2867
2867
|
if (affine && c.live) {
|
|
2868
|
-
const live = { ...c.live, transform:
|
|
2869
|
-
if (
|
|
2868
|
+
const live = { ...c.live, transform: _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkUSJX5SW4cjs.IDENTITY_MATRIX)), affine) };
|
|
2869
|
+
if (_chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2870
2870
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2871
2871
|
}
|
|
2872
2872
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2873
2873
|
});
|
|
2874
2874
|
}
|
|
2875
2875
|
function offsetShape(layer, dx, dy, env) {
|
|
2876
|
-
const m =
|
|
2876
|
+
const m = _chunkUSJX5SW4cjs.translateMatrix.call(void 0, dx, dy);
|
|
2877
2877
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2878
2878
|
delete next.annotation;
|
|
2879
2879
|
return rerenderShape(next, env);
|
|
@@ -2881,7 +2881,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2881
2881
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2882
2882
|
if (components.length < 2) return [...components];
|
|
2883
2883
|
const path = shapeOutline(components, fillRule);
|
|
2884
|
-
const subpaths =
|
|
2884
|
+
const subpaths = _chunkUSJX5SW4cjs.bezierToSubpaths.call(void 0, path);
|
|
2885
2885
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2886
2886
|
return [{ op: "combine", subpaths }];
|
|
2887
2887
|
}
|
|
@@ -2898,7 +2898,7 @@ function annotationPaint(color, opacity) {
|
|
|
2898
2898
|
function shapeFromAnnotation(a) {
|
|
2899
2899
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2900
2900
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2901
|
-
const rotation = a.rotation ?
|
|
2901
|
+
const rotation = a.rotation ? _chunkUSJX5SW4cjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2902
2902
|
const t = rotation ? { transform: rotation } : {};
|
|
2903
2903
|
const live = (l) => liveComponent(l);
|
|
2904
2904
|
switch (a.type) {
|
|
@@ -2941,7 +2941,7 @@ function shapeFromAnnotation(a) {
|
|
|
2941
2941
|
case "pen": {
|
|
2942
2942
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2943
2943
|
if (!paint) return null;
|
|
2944
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2944
|
+
const pts = rotation ? a.points.map((p) => _chunkUSJX5SW4cjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2945
2945
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2946
2946
|
return {
|
|
2947
2947
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2974,7 +2974,7 @@ var JOIN_SIGMA = 2;
|
|
|
2974
2974
|
function vectorMaskSegments(components) {
|
|
2975
2975
|
const out = [];
|
|
2976
2976
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2977
|
-
for (let k = 0; k <
|
|
2977
|
+
for (let k = 0; k < _chunkUSJX5SW4cjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2978
2978
|
}));
|
|
2979
2979
|
return out;
|
|
2980
2980
|
}
|
|
@@ -2982,7 +2982,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2982
2982
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2983
2983
|
return edges.filter((e) => {
|
|
2984
2984
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2985
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2985
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkUSJX5SW4cjs.subpathSegmentCount.call(void 0, sp);
|
|
2986
2986
|
});
|
|
2987
2987
|
}
|
|
2988
2988
|
function reach(e) {
|
|
@@ -3005,8 +3005,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
3005
3005
|
const seedClass = [];
|
|
3006
3006
|
vm.components.forEach(
|
|
3007
3007
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
3008
|
-
for (let k = 0; k <
|
|
3009
|
-
const seg =
|
|
3008
|
+
for (let k = 0; k < _chunkUSJX5SW4cjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
3009
|
+
const seg = _chunkUSJX5SW4cjs.subpathSegment.call(void 0, sp, k);
|
|
3010
3010
|
let len = 0;
|
|
3011
3011
|
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]);
|
|
3012
3012
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3906,7 +3906,7 @@ var fail3 = (message) => {
|
|
|
3906
3906
|
};
|
|
3907
3907
|
var TEXT_RENDER_MARGIN = _chunkPVJMTLPJcjs.MAX_EFFECT_REACH;
|
|
3908
3908
|
function textMatrix(layer) {
|
|
3909
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3909
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkUSJX5SW4cjs.IDENTITY_MATRIX));
|
|
3910
3910
|
}
|
|
3911
3911
|
function rectCorners(r) {
|
|
3912
3912
|
return [
|
|
@@ -3917,7 +3917,7 @@ function rectCorners(r) {
|
|
|
3917
3917
|
];
|
|
3918
3918
|
}
|
|
3919
3919
|
function docRect(r, m) {
|
|
3920
|
-
const pts = rectCorners(r).map((p) =>
|
|
3920
|
+
const pts = rectCorners(r).map((p) => _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, p));
|
|
3921
3921
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3922
3922
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3923
3923
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3937,7 +3937,7 @@ function inkBounds(layout) {
|
|
|
3937
3937
|
for (const f of l.fragments) {
|
|
3938
3938
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3939
3939
|
const w = f.carets[f.carets.length - 1];
|
|
3940
|
-
const r =
|
|
3940
|
+
const r = _chunkUSJX5SW4cjs.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) });
|
|
3941
3941
|
if (!b) b = r;
|
|
3942
3942
|
else {
|
|
3943
3943
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3950,14 +3950,14 @@ function inkBounds(layout) {
|
|
|
3950
3950
|
}
|
|
3951
3951
|
function textOutlines(layer, shaper) {
|
|
3952
3952
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3953
|
-
const layout =
|
|
3953
|
+
const layout = _chunkUSJX5SW4cjs.layoutText.call(void 0, layer, shaper);
|
|
3954
3954
|
const m = textMatrix(layer);
|
|
3955
3955
|
const out = [];
|
|
3956
3956
|
for (const l of layout.lines) {
|
|
3957
3957
|
for (const f of l.fragments) {
|
|
3958
|
-
let path =
|
|
3959
|
-
for (const r of
|
|
3960
|
-
out.push({ fragment: f, path:
|
|
3958
|
+
let path = _chunkUSJX5SW4cjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3959
|
+
for (const r of _chunkUSJX5SW4cjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkUSJX5SW4cjs.textRectPath.call(void 0, r)];
|
|
3960
|
+
out.push({ fragment: f, path: _chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3961
3961
|
}
|
|
3962
3962
|
}
|
|
3963
3963
|
return out;
|
|
@@ -4013,7 +4013,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4013
4013
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4014
4014
|
const ctx = canvas.getContext("2d");
|
|
4015
4015
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4016
|
-
const layout =
|
|
4016
|
+
const layout = _chunkUSJX5SW4cjs.layoutText.call(void 0, layer, shaper);
|
|
4017
4017
|
const m = textMatrix(layer);
|
|
4018
4018
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4019
4019
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4023,8 +4023,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4023
4023
|
const [r, g, b] = rgbOf(f.style.color);
|
|
4024
4024
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
4025
4025
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4026
|
-
|
|
4027
|
-
for (const d of
|
|
4026
|
+
_chunkUSJX5SW4cjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
4027
|
+
for (const d of _chunkUSJX5SW4cjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4028
4028
|
}
|
|
4029
4029
|
}
|
|
4030
4030
|
ctx.globalAlpha = 1;
|
|
@@ -4035,7 +4035,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4035
4035
|
function renderText(layer, env) {
|
|
4036
4036
|
const shaper = env.shaper;
|
|
4037
4037
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4038
|
-
const layout =
|
|
4038
|
+
const layout = _chunkUSJX5SW4cjs.layoutText.call(void 0, layer, shaper);
|
|
4039
4039
|
const ink = inkBounds(layout);
|
|
4040
4040
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4041
4041
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4136,7 +4136,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4136
4136
|
continue;
|
|
4137
4137
|
}
|
|
4138
4138
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4139
|
-
if (k === "autoLeading" && value ===
|
|
4139
|
+
if (k === "autoLeading" && value === _chunkUSJX5SW4cjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4140
4140
|
else o[k] = value;
|
|
4141
4141
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4142
4142
|
}
|
|
@@ -4177,15 +4177,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4177
4177
|
opacity: 1,
|
|
4178
4178
|
blend: "normal",
|
|
4179
4179
|
text: text3,
|
|
4180
|
-
runs:
|
|
4181
|
-
paragraphs:
|
|
4180
|
+
runs: _chunkUSJX5SW4cjs.fitRuns.call(void 0, init.runs, text3.length, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE),
|
|
4181
|
+
paragraphs: _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4182
4182
|
frame: init.frame,
|
|
4183
4183
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
4184
4184
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
4185
4185
|
offset: { x: 0, y: 0 }
|
|
4186
4186
|
};
|
|
4187
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
4188
|
-
if (init.transform && !
|
|
4187
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE)) }];
|
|
4188
|
+
if (init.transform && !_chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4189
4189
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4190
4190
|
return rerenderText(layer, env);
|
|
4191
4191
|
}
|
|
@@ -4196,24 +4196,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4196
4196
|
const next = { ...current, ...patch };
|
|
4197
4197
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4198
4198
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
4199
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4200
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4201
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4199
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkUSJX5SW4cjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE)));
|
|
4200
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkUSJX5SW4cjs.styleAt.call(void 0, current.runs, 0, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE) }];
|
|
4201
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4202
4202
|
const rendered = rerenderText(next, env);
|
|
4203
4203
|
return { layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4204
4204
|
}
|
|
4205
4205
|
function replaceTextRange(layer, start, end, insert) {
|
|
4206
4206
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4207
|
-
const style =
|
|
4208
|
-
const runs =
|
|
4209
|
-
const pstyle =
|
|
4210
|
-
const paragraphs =
|
|
4211
|
-
return { text: text3, runs, paragraphs:
|
|
4207
|
+
const style = _chunkUSJX5SW4cjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE);
|
|
4208
|
+
const runs = _chunkUSJX5SW4cjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4209
|
+
const pstyle = _chunkUSJX5SW4cjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4210
|
+
const paragraphs = _chunkUSJX5SW4cjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4211
|
+
return { text: text3, runs, paragraphs: _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4212
4212
|
}
|
|
4213
4213
|
function transformTypeLayer(layer, m) {
|
|
4214
|
-
const t =
|
|
4214
|
+
const t = _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4215
4215
|
const next = { ...layer };
|
|
4216
|
-
if (
|
|
4216
|
+
if (_chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4217
4217
|
else next.transform = t;
|
|
4218
4218
|
delete next.annotation;
|
|
4219
4219
|
return next;
|
|
@@ -4221,7 +4221,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4221
4221
|
function typeFrame(layer, shaper) {
|
|
4222
4222
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4223
4223
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4224
|
-
const b =
|
|
4224
|
+
const b = _chunkUSJX5SW4cjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4225
4225
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4226
4226
|
}
|
|
4227
4227
|
function typeAsPixelLayer(layer) {
|
|
@@ -4229,7 +4229,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4229
4229
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4230
4230
|
}
|
|
4231
4231
|
function toTextSpace(layer, p) {
|
|
4232
|
-
return
|
|
4232
|
+
return _chunkUSJX5SW4cjs.applyMatrix.call(void 0, _chunkUSJX5SW4cjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4233
4233
|
}
|
|
4234
4234
|
function typeFromAnnotation(a) {
|
|
4235
4235
|
if (a.type !== "text") return null;
|
|
@@ -4243,7 +4243,7 @@ function typeFromAnnotation(a) {
|
|
|
4243
4243
|
if (op !== 1) style.opacity = op;
|
|
4244
4244
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4245
4245
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4246
|
-
const transform = t.rotation ?
|
|
4246
|
+
const transform = t.rotation ? _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, translate, _chunkUSJX5SW4cjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4247
4247
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4248
4248
|
}
|
|
4249
4249
|
function annotationOfType(layer) {
|
|
@@ -4883,7 +4883,7 @@ function identityTransform(box2) {
|
|
|
4883
4883
|
}
|
|
4884
4884
|
function cornersFromMatrix(box2, m) {
|
|
4885
4885
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4886
|
-
return [
|
|
4886
|
+
return [_chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[0]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[1]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[2]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4887
4887
|
}
|
|
4888
4888
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4889
4889
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4900,7 +4900,7 @@ function transformHomography(geometry) {
|
|
|
4900
4900
|
function hasWarp(geometry) {
|
|
4901
4901
|
const w = geometry.warp;
|
|
4902
4902
|
if (!w) return false;
|
|
4903
|
-
const id =
|
|
4903
|
+
const id = _chunkUSJX5SW4cjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4904
4904
|
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;
|
|
4905
4905
|
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);
|
|
4906
4906
|
}
|
|
@@ -4915,7 +4915,7 @@ function transformMap(geometry) {
|
|
|
4915
4915
|
const { box: box2 } = geometry;
|
|
4916
4916
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4917
4917
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4918
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4918
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkUSJX5SW4cjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4919
4919
|
}
|
|
4920
4920
|
function transformedPoint(geometry, fx, fy) {
|
|
4921
4921
|
const f = transformMap(geometry);
|
|
@@ -4959,8 +4959,8 @@ function matrixFromParams(box2, params) {
|
|
|
4959
4959
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4960
4960
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4961
4961
|
const ref = referencePoint(box2, params.reference);
|
|
4962
|
-
const linear =
|
|
4963
|
-
return
|
|
4962
|
+
const linear = _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkUSJX5SW4cjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4963
|
+
return _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, _chunkUSJX5SW4cjs.matrixAbout.call(void 0, linear, ref), _chunkUSJX5SW4cjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4964
4964
|
}
|
|
4965
4965
|
function describeTransform(geometry, reference = "center") {
|
|
4966
4966
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4977,7 +4977,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4977
4977
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4978
4978
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4979
4979
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4980
|
-
const at =
|
|
4980
|
+
const at = _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, ref);
|
|
4981
4981
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4982
4982
|
return {
|
|
4983
4983
|
affine: true,
|
|
@@ -4995,24 +4995,24 @@ function applyParams(geometry, params) {
|
|
|
4995
4995
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4996
4996
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4997
4997
|
const c = geometry.corners;
|
|
4998
|
-
return [
|
|
4998
|
+
return [_chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, c[0]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, c[1]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, c[2]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, c[3])];
|
|
4999
4999
|
}
|
|
5000
5000
|
function flipCorners(geometry, axis) {
|
|
5001
5001
|
const c = anchorPoint(geometry, "center");
|
|
5002
5002
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
5003
5003
|
const q2 = geometry.corners;
|
|
5004
|
-
return [
|
|
5004
|
+
return [_chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[0]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[1]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[2]), _chunkUSJX5SW4cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
5005
5005
|
}
|
|
5006
5006
|
function boxPointOf(geometry, p) {
|
|
5007
5007
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
5008
|
-
if (m) return
|
|
5008
|
+
if (m) return _chunkUSJX5SW4cjs.applyMatrix.call(void 0, _chunkUSJX5SW4cjs.invertMatrix.call(void 0, m), p);
|
|
5009
5009
|
return null;
|
|
5010
5010
|
}
|
|
5011
5011
|
function presetWarp(box2, preset) {
|
|
5012
|
-
return
|
|
5012
|
+
return _chunkUSJX5SW4cjs.warpPresetMesh.call(void 0, preset, box2);
|
|
5013
5013
|
}
|
|
5014
5014
|
function isValidWarp(mesh) {
|
|
5015
|
-
return
|
|
5015
|
+
return _chunkUSJX5SW4cjs.isValidWarpMesh.call(void 0, mesh);
|
|
5016
5016
|
}
|
|
5017
5017
|
function geometryHomography(geometry) {
|
|
5018
5018
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -5291,7 +5291,7 @@ function normalizePlacement(raw, contents) {
|
|
|
5291
5291
|
}
|
|
5292
5292
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
5293
5293
|
if (raw.warp) {
|
|
5294
|
-
if (!
|
|
5294
|
+
if (!_chunkUSJX5SW4cjs.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.");
|
|
5295
5295
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
5296
5296
|
}
|
|
5297
5297
|
if (raw.interpolation !== void 0) {
|
|
@@ -5395,7 +5395,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5395
5395
|
case "shape": {
|
|
5396
5396
|
const next = {
|
|
5397
5397
|
...layer,
|
|
5398
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5398
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkUSJX5SW4cjs.translateMatrix.call(void 0, dx, dy)),
|
|
5399
5399
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5400
5400
|
mask: moveMask(layer.mask)
|
|
5401
5401
|
};
|
|
@@ -5404,7 +5404,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5404
5404
|
return next;
|
|
5405
5405
|
}
|
|
5406
5406
|
case "type": {
|
|
5407
|
-
const next = { ...transformTypeLayer(layer,
|
|
5407
|
+
const next = { ...transformTypeLayer(layer, _chunkUSJX5SW4cjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5408
5408
|
if (!next.mask) delete next.mask;
|
|
5409
5409
|
return next;
|
|
5410
5410
|
}
|
|
@@ -5590,7 +5590,7 @@ function refitPlacement(layer, contents) {
|
|
|
5590
5590
|
});
|
|
5591
5591
|
const out = { corners: pts };
|
|
5592
5592
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5593
|
-
if (layer.placement.warp) out.warp =
|
|
5593
|
+
if (layer.placement.warp) out.warp = _chunkUSJX5SW4cjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5594
5594
|
return out;
|
|
5595
5595
|
}
|
|
5596
5596
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5967,7 +5967,7 @@ function readType(r, base, ctx) {
|
|
|
5967
5967
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5968
5968
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5969
5969
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5970
|
-
style: patchTextStyle(
|
|
5970
|
+
style: patchTextStyle(_chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5971
5971
|
}));
|
|
5972
5972
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5973
5973
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5980,13 +5980,13 @@ function readType(r, base, ctx) {
|
|
|
5980
5980
|
...base,
|
|
5981
5981
|
type: "type",
|
|
5982
5982
|
text: text3,
|
|
5983
|
-
runs:
|
|
5984
|
-
paragraphs:
|
|
5983
|
+
runs: _chunkUSJX5SW4cjs.fitRuns.call(void 0, runs, text3.length, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE),
|
|
5984
|
+
paragraphs: _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5985
5985
|
frame,
|
|
5986
5986
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5987
5987
|
offset: { x: 0, y: 0 }
|
|
5988
5988
|
};
|
|
5989
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5989
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE)) }];
|
|
5990
5990
|
if (m) layer.transform = m;
|
|
5991
5991
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5992
5992
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6456,7 +6456,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6456
6456
|
let placement;
|
|
6457
6457
|
try {
|
|
6458
6458
|
const raw = { corners: p.corners };
|
|
6459
|
-
if (p.warp &&
|
|
6459
|
+
if (p.warp && _chunkUSJX5SW4cjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6460
6460
|
if (_chunkPVJMTLPJcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6461
6461
|
placement = normalizePlacement(raw, contents);
|
|
6462
6462
|
} catch (e) {
|
|
@@ -7627,7 +7627,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7627
7627
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7628
7628
|
const subpaths = [];
|
|
7629
7629
|
components.forEach((c, ci) => {
|
|
7630
|
-
|
|
7630
|
+
_chunkUSJX5SW4cjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7631
7631
|
if (!sp.anchors.length) return;
|
|
7632
7632
|
subpaths.push({
|
|
7633
7633
|
closed: sp.closed,
|
|
@@ -8453,7 +8453,7 @@ function merged(levels) {
|
|
|
8453
8453
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8454
8454
|
const n = (k) => eNum(eGet(d, k));
|
|
8455
8455
|
const flag = (k) => eBool(eGet(d, k));
|
|
8456
|
-
const s = { ...
|
|
8456
|
+
const s = { ..._chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE };
|
|
8457
8457
|
const fi = n("Font");
|
|
8458
8458
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8459
8459
|
if (ps) {
|
|
@@ -8538,7 +8538,7 @@ function typeFromTySh(data, notes) {
|
|
|
8538
8538
|
}
|
|
8539
8539
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8540
8540
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8541
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8541
|
+
let runs = [{ length: text3.length, style: { ..._chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE } }];
|
|
8542
8542
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8543
8543
|
let frame = { kind: "point" };
|
|
8544
8544
|
let transform = t.transform;
|
|
@@ -8594,14 +8594,14 @@ function typeFromTySh(data, notes) {
|
|
|
8594
8594
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8595
8595
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8596
8596
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8597
|
-
transform =
|
|
8597
|
+
transform = _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8598
8598
|
}
|
|
8599
8599
|
}
|
|
8600
8600
|
}
|
|
8601
8601
|
return {
|
|
8602
8602
|
text: text3,
|
|
8603
|
-
runs:
|
|
8604
|
-
paragraphs:
|
|
8603
|
+
runs: _chunkUSJX5SW4cjs.fitRuns.call(void 0, runs, text3.length, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE),
|
|
8604
|
+
paragraphs: _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8605
8605
|
frame,
|
|
8606
8606
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8607
8607
|
transform,
|
|
@@ -8677,7 +8677,7 @@ function buildEngineData(layer, template) {
|
|
|
8677
8677
|
fonts.push(ps);
|
|
8678
8678
|
return fonts.length - 1;
|
|
8679
8679
|
};
|
|
8680
|
-
const runs =
|
|
8680
|
+
const runs = _chunkUSJX5SW4cjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE);
|
|
8681
8681
|
const vertical = layer.orientation === "vertical";
|
|
8682
8682
|
const sruns = [];
|
|
8683
8683
|
const slens = [];
|
|
@@ -8686,10 +8686,10 @@ function buildEngineData(layer, template) {
|
|
|
8686
8686
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8687
8687
|
});
|
|
8688
8688
|
if (!runs.length) {
|
|
8689
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8689
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8690
8690
|
slens.push(E.int(1));
|
|
8691
8691
|
}
|
|
8692
|
-
const paras =
|
|
8692
|
+
const paras = _chunkUSJX5SW4cjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8693
8693
|
const pruns = [];
|
|
8694
8694
|
const plens = [];
|
|
8695
8695
|
paras.forEach((p, i) => {
|
|
@@ -8745,7 +8745,7 @@ function buildEngineData(layer, template) {
|
|
|
8745
8745
|
eSet(e, key, rd);
|
|
8746
8746
|
}
|
|
8747
8747
|
eSet(rd, "FontSet", fontSet);
|
|
8748
|
-
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]), () => (
|
|
8748
|
+
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]), () => ( _chunkUSJX5SW4cjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8749
8749
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8750
8750
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8751
8751
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8756,13 +8756,13 @@ function inkBounds2(layer) {
|
|
|
8756
8756
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8757
8757
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8758
8758
|
if (!b) return [0, 0, 0, 0];
|
|
8759
|
-
const inv =
|
|
8759
|
+
const inv = _chunkUSJX5SW4cjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8760
8760
|
const pts = [
|
|
8761
8761
|
{ x: b.x, y: b.y },
|
|
8762
8762
|
{ x: b.x + b.width, y: b.y },
|
|
8763
8763
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8764
8764
|
{ x: b.x, y: b.y + b.height }
|
|
8765
|
-
].map((p) =>
|
|
8765
|
+
].map((p) => _chunkUSJX5SW4cjs.applyMatrix.call(void 0, inv, p));
|
|
8766
8766
|
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))];
|
|
8767
8767
|
}
|
|
8768
8768
|
function tyShForLayer(layer) {
|
|
@@ -9043,7 +9043,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
9043
9043
|
var warpStyleOf = (name) => {
|
|
9044
9044
|
if (!name.startsWith("warp")) return null;
|
|
9045
9045
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
9046
|
-
return
|
|
9046
|
+
return _chunkUSJX5SW4cjs.WARP_STYLES.includes(s) ? s : null;
|
|
9047
9047
|
};
|
|
9048
9048
|
function warpFromDescriptor(w, contents) {
|
|
9049
9049
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -9073,7 +9073,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
9073
9073
|
} else {
|
|
9074
9074
|
const style = warpStyleOf(styleName);
|
|
9075
9075
|
if (!style) return void 0;
|
|
9076
|
-
mesh =
|
|
9076
|
+
mesh = _chunkUSJX5SW4cjs.warpPresetMesh.call(void 0,
|
|
9077
9077
|
{
|
|
9078
9078
|
style,
|
|
9079
9079
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -9088,7 +9088,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
9088
9088
|
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;
|
|
9089
9089
|
if (!same) {
|
|
9090
9090
|
const m = mesh;
|
|
9091
|
-
mesh =
|
|
9091
|
+
mesh = _chunkUSJX5SW4cjs.fitWarpMesh.call(void 0, (s, t) => _chunkUSJX5SW4cjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
9092
9092
|
}
|
|
9093
9093
|
return { mesh, frame };
|
|
9094
9094
|
}
|
|
@@ -10680,7 +10680,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10680
10680
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10681
10681
|
const kx = contents.width / size.width;
|
|
10682
10682
|
const ky = contents.height / size.height;
|
|
10683
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10683
|
+
if (placement.warp) placement = { ...placement, warp: _chunkUSJX5SW4cjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10684
10684
|
}
|
|
10685
10685
|
}
|
|
10686
10686
|
if (!contents || !placement) {
|