@pixerate/editor 0.226.0 → 0.227.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 +57 -57
- package/dist/animation-editor/index.js +3 -3
- package/dist/{brushstrokeRender-C3UU6GVC.js → brushstrokeRender-MAHOXL7K.js} +2 -2
- package/dist/{brushstrokeRender-EAJNE6WP.cjs → brushstrokeRender-WDTKD54B.cjs} +5 -5
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-LCCMOWR7.cjs → chunk-ATKKG76G.cjs} +23 -23
- package/dist/{chunk-QAUIZPYI.cjs → chunk-BQE3Y6ZO.cjs} +2 -2
- package/dist/{chunk-G4E6RUPC.js → chunk-CDP2AKMA.js} +1 -1
- package/dist/{chunk-NDMXB4PR.js → chunk-CU6ANS5L.js} +1 -1
- package/dist/{chunk-ROVK6AXX.cjs → chunk-GNZI3KYK.cjs} +95 -23
- package/dist/{chunk-I7G3RSUJ.cjs → chunk-GXLZZVR5.cjs} +35 -35
- package/dist/{chunk-5YLOU7VF.js → chunk-KN3Y3FRY.js} +1 -1
- package/dist/{chunk-IWMDW7LB.cjs → chunk-MXJP77K4.cjs} +86 -86
- package/dist/{chunk-F7YA3MMC.js → chunk-TQOL6CF7.js} +76 -4
- package/dist/{chunk-ZMHPQ6HP.cjs → chunk-V3L7U63N.cjs} +1 -1
- package/dist/{chunk-DJBYJOHM.js → chunk-XSVUNSDJ.js} +1 -1
- package/dist/{chunk-BGOCAUXH.js → chunk-YMREOA67.js} +1 -1
- package/dist/image-editor/index.cjs +771 -771
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/controller.d.cts +54 -3
- package/dist/paint-editor/controller.d.ts +54 -3
- package/dist/paint-editor/dab-stroke.d.cts +3 -0
- package/dist/paint-editor/dab-stroke.d.ts +3 -0
- package/dist/paint-editor/effect-paint.d.cts +47 -0
- package/dist/paint-editor/effect-paint.d.ts +47 -0
- package/dist/paint-editor/effect-tools.d.cts +4 -2
- package/dist/paint-editor/effect-tools.d.ts +4 -2
- package/dist/paint-editor/effects.d.cts +3 -0
- package/dist/paint-editor/effects.d.ts +3 -0
- package/dist/paint-editor/engine.d.cts +4 -0
- package/dist/paint-editor/engine.d.ts +4 -0
- package/dist/paint-editor/index.cjs +536 -309
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +250 -23
- package/dist/paint-editor/procedural.d.cts +4 -0
- package/dist/paint-editor/procedural.d.ts +4 -0
- package/dist/paint-editor/stroke.d.cts +9 -0
- package/dist/paint-editor/stroke.d.ts +9 -0
- package/dist/paint-editor/strokes.d.cts +6 -2
- package/dist/paint-editor/strokes.d.ts +6 -2
- package/dist/vector/index.cjs +962 -962
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +2 -1
- package/skills/pixerate-paint-editor/SKILL.md +42 -6
- package/skills/pixerate-paint-sketch-to-finish/SKILL.md +7 -0
|
@@ -104,7 +104,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
var
|
|
107
|
+
var _chunkBQE3Y6ZOcjs = require('./chunk-BQE3Y6ZO.cjs');
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
@@ -2318,7 +2318,7 @@ function mapAnchor(a, f) {
|
|
|
2318
2318
|
return out;
|
|
2319
2319
|
}
|
|
2320
2320
|
function mapSubpaths(subpaths, f) {
|
|
2321
|
-
return
|
|
2321
|
+
return _chunkBQE3Y6ZOcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2322
2322
|
}
|
|
2323
2323
|
function liveShapeSubpaths(live) {
|
|
2324
2324
|
let out;
|
|
@@ -2326,19 +2326,19 @@ function liveShapeSubpaths(live) {
|
|
|
2326
2326
|
case "rect": {
|
|
2327
2327
|
const x = Math.min(live.x, live.x + live.width);
|
|
2328
2328
|
const y = Math.min(live.y, live.y + live.height);
|
|
2329
|
-
const sp =
|
|
2329
|
+
const sp = _chunkBQE3Y6ZOcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2330
2330
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2331
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2331
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkBQE3Y6ZOcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2332
2332
|
break;
|
|
2333
2333
|
}
|
|
2334
2334
|
case "ellipse":
|
|
2335
|
-
out = [
|
|
2335
|
+
out = [_chunkBQE3Y6ZOcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2336
2336
|
break;
|
|
2337
2337
|
case "polygon":
|
|
2338
|
-
out = [
|
|
2338
|
+
out = [_chunkBQE3Y6ZOcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2339
2339
|
break;
|
|
2340
2340
|
case "star":
|
|
2341
|
-
out = [
|
|
2341
|
+
out = [_chunkBQE3Y6ZOcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2342
2342
|
break;
|
|
2343
2343
|
case "line": {
|
|
2344
2344
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2361,7 +2361,7 @@ function liveShapeSubpaths(live) {
|
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
2363
|
const m = live.transform;
|
|
2364
|
-
return m && !
|
|
2364
|
+
return m && !_chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2365
2365
|
}
|
|
2366
2366
|
function normBox(b) {
|
|
2367
2367
|
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) };
|
|
@@ -2373,7 +2373,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2373
2373
|
function componentPath(c) {
|
|
2374
2374
|
let p = pathCache.get(c.subpaths);
|
|
2375
2375
|
if (!p) {
|
|
2376
|
-
p =
|
|
2376
|
+
p = _chunkBQE3Y6ZOcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2377
2377
|
pathCache.set(c.subpaths, p);
|
|
2378
2378
|
}
|
|
2379
2379
|
return p;
|
|
@@ -2700,7 +2700,7 @@ function matrixArg(v, path) {
|
|
|
2700
2700
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2701
2701
|
const m = v;
|
|
2702
2702
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2703
|
-
return
|
|
2703
|
+
return _chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2704
2704
|
}
|
|
2705
2705
|
function normalizeLiveShape(v, path = "shape") {
|
|
2706
2706
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2761,7 +2761,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2761
2761
|
if (typeof v === "string") {
|
|
2762
2762
|
let subs;
|
|
2763
2763
|
try {
|
|
2764
|
-
subs =
|
|
2764
|
+
subs = _chunkBQE3Y6ZOcjs.bezierToSubpaths.call(void 0, v);
|
|
2765
2765
|
} catch (e5) {
|
|
2766
2766
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2767
2767
|
}
|
|
@@ -2847,15 +2847,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2847
2847
|
function transformShapeComponents(components, f, affine) {
|
|
2848
2848
|
return components.map((c) => {
|
|
2849
2849
|
if (affine && c.live) {
|
|
2850
|
-
const live = { ...c.live, transform:
|
|
2851
|
-
if (
|
|
2850
|
+
const live = { ...c.live, transform: _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkBQE3Y6ZOcjs.IDENTITY_MATRIX)), affine) };
|
|
2851
|
+
if (_chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2852
2852
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2853
2853
|
}
|
|
2854
2854
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2855
2855
|
});
|
|
2856
2856
|
}
|
|
2857
2857
|
function offsetShape(layer, dx, dy, env) {
|
|
2858
|
-
const m =
|
|
2858
|
+
const m = _chunkBQE3Y6ZOcjs.translateMatrix.call(void 0, dx, dy);
|
|
2859
2859
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2860
2860
|
delete next.annotation;
|
|
2861
2861
|
return rerenderShape(next, env);
|
|
@@ -2863,7 +2863,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2863
2863
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2864
2864
|
if (components.length < 2) return [...components];
|
|
2865
2865
|
const path = shapeOutline(components, fillRule);
|
|
2866
|
-
const subpaths =
|
|
2866
|
+
const subpaths = _chunkBQE3Y6ZOcjs.bezierToSubpaths.call(void 0, path);
|
|
2867
2867
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2868
2868
|
return [{ op: "combine", subpaths }];
|
|
2869
2869
|
}
|
|
@@ -2880,7 +2880,7 @@ function annotationPaint(color, opacity) {
|
|
|
2880
2880
|
function shapeFromAnnotation(a) {
|
|
2881
2881
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2882
2882
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2883
|
-
const rotation = a.rotation ?
|
|
2883
|
+
const rotation = a.rotation ? _chunkBQE3Y6ZOcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2884
2884
|
const t = rotation ? { transform: rotation } : {};
|
|
2885
2885
|
const live = (l) => liveComponent(l);
|
|
2886
2886
|
switch (a.type) {
|
|
@@ -2923,7 +2923,7 @@ function shapeFromAnnotation(a) {
|
|
|
2923
2923
|
case "pen": {
|
|
2924
2924
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2925
2925
|
if (!paint) return null;
|
|
2926
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2926
|
+
const pts = rotation ? a.points.map((p) => _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2927
2927
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2928
2928
|
return {
|
|
2929
2929
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2956,7 +2956,7 @@ var JOIN_SIGMA = 2;
|
|
|
2956
2956
|
function vectorMaskSegments(components) {
|
|
2957
2957
|
const out = [];
|
|
2958
2958
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2959
|
-
for (let k = 0; k <
|
|
2959
|
+
for (let k = 0; k < _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2960
2960
|
}));
|
|
2961
2961
|
return out;
|
|
2962
2962
|
}
|
|
@@ -2964,7 +2964,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2964
2964
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2965
2965
|
return edges.filter((e) => {
|
|
2966
2966
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2967
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2967
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp);
|
|
2968
2968
|
});
|
|
2969
2969
|
}
|
|
2970
2970
|
function reach(e) {
|
|
@@ -2987,8 +2987,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2987
2987
|
const seedClass = [];
|
|
2988
2988
|
vm.components.forEach(
|
|
2989
2989
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2990
|
-
for (let k = 0; k <
|
|
2991
|
-
const seg =
|
|
2990
|
+
for (let k = 0; k < _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
2991
|
+
const seg = _chunkBQE3Y6ZOcjs.subpathSegment.call(void 0, sp, k);
|
|
2992
2992
|
let len = 0;
|
|
2993
2993
|
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]);
|
|
2994
2994
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3888,7 +3888,7 @@ var fail3 = (message) => {
|
|
|
3888
3888
|
};
|
|
3889
3889
|
var TEXT_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
|
|
3890
3890
|
function textMatrix(layer) {
|
|
3891
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3891
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkBQE3Y6ZOcjs.IDENTITY_MATRIX));
|
|
3892
3892
|
}
|
|
3893
3893
|
function rectCorners(r) {
|
|
3894
3894
|
return [
|
|
@@ -3899,7 +3899,7 @@ function rectCorners(r) {
|
|
|
3899
3899
|
];
|
|
3900
3900
|
}
|
|
3901
3901
|
function docRect(r, m) {
|
|
3902
|
-
const pts = rectCorners(r).map((p) =>
|
|
3902
|
+
const pts = rectCorners(r).map((p) => _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, p));
|
|
3903
3903
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3904
3904
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3905
3905
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3919,7 +3919,7 @@ function inkBounds(layout) {
|
|
|
3919
3919
|
for (const f of l.fragments) {
|
|
3920
3920
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3921
3921
|
const w = f.carets[f.carets.length - 1];
|
|
3922
|
-
const r =
|
|
3922
|
+
const r = _chunkBQE3Y6ZOcjs.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) });
|
|
3923
3923
|
if (!b) b = r;
|
|
3924
3924
|
else {
|
|
3925
3925
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3932,14 +3932,14 @@ function inkBounds(layout) {
|
|
|
3932
3932
|
}
|
|
3933
3933
|
function textOutlines(layer, shaper) {
|
|
3934
3934
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3935
|
-
const layout =
|
|
3935
|
+
const layout = _chunkBQE3Y6ZOcjs.layoutText.call(void 0, layer, shaper);
|
|
3936
3936
|
const m = textMatrix(layer);
|
|
3937
3937
|
const out = [];
|
|
3938
3938
|
for (const l of layout.lines) {
|
|
3939
3939
|
for (const f of l.fragments) {
|
|
3940
|
-
let path =
|
|
3941
|
-
for (const r of
|
|
3942
|
-
out.push({ fragment: f, path:
|
|
3940
|
+
let path = _chunkBQE3Y6ZOcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3941
|
+
for (const r of _chunkBQE3Y6ZOcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkBQE3Y6ZOcjs.textRectPath.call(void 0, r)];
|
|
3942
|
+
out.push({ fragment: f, path: _chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3943
3943
|
}
|
|
3944
3944
|
}
|
|
3945
3945
|
return out;
|
|
@@ -3995,7 +3995,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3995
3995
|
const canvas = env.createCanvas(region.width, region.height);
|
|
3996
3996
|
const ctx = canvas.getContext("2d");
|
|
3997
3997
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
3998
|
-
const layout =
|
|
3998
|
+
const layout = _chunkBQE3Y6ZOcjs.layoutText.call(void 0, layer, shaper);
|
|
3999
3999
|
const m = textMatrix(layer);
|
|
4000
4000
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4001
4001
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4005,8 +4005,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4005
4005
|
const [r, g, b] = rgbOf(f.style.color);
|
|
4006
4006
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
4007
4007
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4008
|
-
|
|
4009
|
-
for (const d of
|
|
4008
|
+
_chunkBQE3Y6ZOcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
4009
|
+
for (const d of _chunkBQE3Y6ZOcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4010
4010
|
}
|
|
4011
4011
|
}
|
|
4012
4012
|
ctx.globalAlpha = 1;
|
|
@@ -4017,7 +4017,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4017
4017
|
function renderText(layer, env) {
|
|
4018
4018
|
const shaper = env.shaper;
|
|
4019
4019
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4020
|
-
const layout =
|
|
4020
|
+
const layout = _chunkBQE3Y6ZOcjs.layoutText.call(void 0, layer, shaper);
|
|
4021
4021
|
const ink = inkBounds(layout);
|
|
4022
4022
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4023
4023
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4118,7 +4118,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4118
4118
|
continue;
|
|
4119
4119
|
}
|
|
4120
4120
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4121
|
-
if (k === "autoLeading" && value ===
|
|
4121
|
+
if (k === "autoLeading" && value === _chunkBQE3Y6ZOcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4122
4122
|
else o[k] = value;
|
|
4123
4123
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4124
4124
|
}
|
|
@@ -4159,15 +4159,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4159
4159
|
opacity: 1,
|
|
4160
4160
|
blend: "normal",
|
|
4161
4161
|
text: text3,
|
|
4162
|
-
runs:
|
|
4163
|
-
paragraphs:
|
|
4162
|
+
runs: _chunkBQE3Y6ZOcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE),
|
|
4163
|
+
paragraphs: _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4164
4164
|
frame: init.frame,
|
|
4165
4165
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
4166
4166
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
4167
4167
|
offset: { x: 0, y: 0 }
|
|
4168
4168
|
};
|
|
4169
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
4170
|
-
if (init.transform && !
|
|
4169
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE)) }];
|
|
4170
|
+
if (init.transform && !_chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4171
4171
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4172
4172
|
return rerenderText(layer, env);
|
|
4173
4173
|
}
|
|
@@ -4178,24 +4178,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4178
4178
|
const next = { ...current, ...patch };
|
|
4179
4179
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4180
4180
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
4181
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4182
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4183
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4181
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkBQE3Y6ZOcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE)));
|
|
4182
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkBQE3Y6ZOcjs.styleAt.call(void 0, current.runs, 0, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE) }];
|
|
4183
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4184
4184
|
const rendered = rerenderText(next, env);
|
|
4185
4185
|
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4186
4186
|
}
|
|
4187
4187
|
function replaceTextRange(layer, start, end, insert) {
|
|
4188
4188
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4189
|
-
const style =
|
|
4190
|
-
const runs =
|
|
4191
|
-
const pstyle =
|
|
4192
|
-
const paragraphs =
|
|
4193
|
-
return { text: text3, runs, paragraphs:
|
|
4189
|
+
const style = _chunkBQE3Y6ZOcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE);
|
|
4190
|
+
const runs = _chunkBQE3Y6ZOcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4191
|
+
const pstyle = _chunkBQE3Y6ZOcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4192
|
+
const paragraphs = _chunkBQE3Y6ZOcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4193
|
+
return { text: text3, runs, paragraphs: _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4194
4194
|
}
|
|
4195
4195
|
function transformTypeLayer(layer, m) {
|
|
4196
|
-
const t =
|
|
4196
|
+
const t = _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4197
4197
|
const next = { ...layer };
|
|
4198
|
-
if (
|
|
4198
|
+
if (_chunkBQE3Y6ZOcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4199
4199
|
else next.transform = t;
|
|
4200
4200
|
delete next.annotation;
|
|
4201
4201
|
return next;
|
|
@@ -4203,7 +4203,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4203
4203
|
function typeFrame(layer, shaper) {
|
|
4204
4204
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4205
4205
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4206
|
-
const b =
|
|
4206
|
+
const b = _chunkBQE3Y6ZOcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4207
4207
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4208
4208
|
}
|
|
4209
4209
|
function typeAsPixelLayer(layer) {
|
|
@@ -4211,7 +4211,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4211
4211
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4212
4212
|
}
|
|
4213
4213
|
function toTextSpace(layer, p) {
|
|
4214
|
-
return
|
|
4214
|
+
return _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, _chunkBQE3Y6ZOcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4215
4215
|
}
|
|
4216
4216
|
function typeFromAnnotation(a) {
|
|
4217
4217
|
if (a.type !== "text") return null;
|
|
@@ -4225,7 +4225,7 @@ function typeFromAnnotation(a) {
|
|
|
4225
4225
|
if (op !== 1) style.opacity = op;
|
|
4226
4226
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4227
4227
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4228
|
-
const transform = t.rotation ?
|
|
4228
|
+
const transform = t.rotation ? _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, translate, _chunkBQE3Y6ZOcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4229
4229
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4230
4230
|
}
|
|
4231
4231
|
function annotationOfType(layer) {
|
|
@@ -4559,7 +4559,7 @@ function identityTransform(box2) {
|
|
|
4559
4559
|
}
|
|
4560
4560
|
function cornersFromMatrix(box2, m) {
|
|
4561
4561
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4562
|
-
return [
|
|
4562
|
+
return [_chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[0]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[1]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[2]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4563
4563
|
}
|
|
4564
4564
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4565
4565
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4576,7 +4576,7 @@ function transformHomography(geometry) {
|
|
|
4576
4576
|
function hasWarp(geometry) {
|
|
4577
4577
|
const w = geometry.warp;
|
|
4578
4578
|
if (!w) return false;
|
|
4579
|
-
const id =
|
|
4579
|
+
const id = _chunkBQE3Y6ZOcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4580
4580
|
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;
|
|
4581
4581
|
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);
|
|
4582
4582
|
}
|
|
@@ -4591,7 +4591,7 @@ function transformMap(geometry) {
|
|
|
4591
4591
|
const { box: box2 } = geometry;
|
|
4592
4592
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4593
4593
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4594
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4594
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkBQE3Y6ZOcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4595
4595
|
}
|
|
4596
4596
|
function transformedPoint(geometry, fx, fy) {
|
|
4597
4597
|
const f = transformMap(geometry);
|
|
@@ -4635,8 +4635,8 @@ function matrixFromParams(box2, params) {
|
|
|
4635
4635
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4636
4636
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4637
4637
|
const ref = referencePoint(box2, params.reference);
|
|
4638
|
-
const linear =
|
|
4639
|
-
return
|
|
4638
|
+
const linear = _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkBQE3Y6ZOcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4639
|
+
return _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, _chunkBQE3Y6ZOcjs.matrixAbout.call(void 0, linear, ref), _chunkBQE3Y6ZOcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4640
4640
|
}
|
|
4641
4641
|
function describeTransform(geometry, reference = "center") {
|
|
4642
4642
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4653,7 +4653,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4653
4653
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4654
4654
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4655
4655
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4656
|
-
const at =
|
|
4656
|
+
const at = _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, ref);
|
|
4657
4657
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4658
4658
|
return {
|
|
4659
4659
|
affine: true,
|
|
@@ -4671,24 +4671,24 @@ function applyParams(geometry, params) {
|
|
|
4671
4671
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4672
4672
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4673
4673
|
const c = geometry.corners;
|
|
4674
|
-
return [
|
|
4674
|
+
return [_chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, c[0]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, c[1]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, c[2]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4675
4675
|
}
|
|
4676
4676
|
function flipCorners(geometry, axis) {
|
|
4677
4677
|
const c = anchorPoint(geometry, "center");
|
|
4678
4678
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4679
4679
|
const q2 = geometry.corners;
|
|
4680
|
-
return [
|
|
4680
|
+
return [_chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[0]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[1]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[2]), _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4681
4681
|
}
|
|
4682
4682
|
function boxPointOf(geometry, p) {
|
|
4683
4683
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4684
|
-
if (m) return
|
|
4684
|
+
if (m) return _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, _chunkBQE3Y6ZOcjs.invertMatrix.call(void 0, m), p);
|
|
4685
4685
|
return null;
|
|
4686
4686
|
}
|
|
4687
4687
|
function presetWarp(box2, preset) {
|
|
4688
|
-
return
|
|
4688
|
+
return _chunkBQE3Y6ZOcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4689
4689
|
}
|
|
4690
4690
|
function isValidWarp(mesh) {
|
|
4691
|
-
return
|
|
4691
|
+
return _chunkBQE3Y6ZOcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4692
4692
|
}
|
|
4693
4693
|
function geometryHomography(geometry) {
|
|
4694
4694
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4967,7 +4967,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4967
4967
|
}
|
|
4968
4968
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4969
4969
|
if (raw.warp) {
|
|
4970
|
-
if (!
|
|
4970
|
+
if (!_chunkBQE3Y6ZOcjs.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.");
|
|
4971
4971
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4972
4972
|
}
|
|
4973
4973
|
if (raw.interpolation !== void 0) {
|
|
@@ -5071,7 +5071,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5071
5071
|
case "shape": {
|
|
5072
5072
|
const next = {
|
|
5073
5073
|
...layer,
|
|
5074
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5074
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkBQE3Y6ZOcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5075
5075
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5076
5076
|
mask: moveMask(layer.mask)
|
|
5077
5077
|
};
|
|
@@ -5080,7 +5080,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5080
5080
|
return next;
|
|
5081
5081
|
}
|
|
5082
5082
|
case "type": {
|
|
5083
|
-
const next = { ...transformTypeLayer(layer,
|
|
5083
|
+
const next = { ...transformTypeLayer(layer, _chunkBQE3Y6ZOcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5084
5084
|
if (!next.mask) delete next.mask;
|
|
5085
5085
|
return next;
|
|
5086
5086
|
}
|
|
@@ -5266,7 +5266,7 @@ function refitPlacement(layer, contents) {
|
|
|
5266
5266
|
});
|
|
5267
5267
|
const out = { corners: pts };
|
|
5268
5268
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5269
|
-
if (layer.placement.warp) out.warp =
|
|
5269
|
+
if (layer.placement.warp) out.warp = _chunkBQE3Y6ZOcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5270
5270
|
return out;
|
|
5271
5271
|
}
|
|
5272
5272
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5643,7 +5643,7 @@ function readType(r, base, ctx) {
|
|
|
5643
5643
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5644
5644
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5645
5645
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5646
|
-
style: patchTextStyle(
|
|
5646
|
+
style: patchTextStyle(_chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5647
5647
|
}));
|
|
5648
5648
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5649
5649
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5656,13 +5656,13 @@ function readType(r, base, ctx) {
|
|
|
5656
5656
|
...base,
|
|
5657
5657
|
type: "type",
|
|
5658
5658
|
text: text3,
|
|
5659
|
-
runs:
|
|
5660
|
-
paragraphs:
|
|
5659
|
+
runs: _chunkBQE3Y6ZOcjs.fitRuns.call(void 0, runs, text3.length, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE),
|
|
5660
|
+
paragraphs: _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5661
5661
|
frame,
|
|
5662
5662
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5663
5663
|
offset: { x: 0, y: 0 }
|
|
5664
5664
|
};
|
|
5665
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5665
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5666
5666
|
if (m) layer.transform = m;
|
|
5667
5667
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5668
5668
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6132,7 +6132,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6132
6132
|
let placement;
|
|
6133
6133
|
try {
|
|
6134
6134
|
const raw = { corners: p.corners };
|
|
6135
|
-
if (p.warp &&
|
|
6135
|
+
if (p.warp && _chunkBQE3Y6ZOcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6136
6136
|
if (_chunkB46UQUDCcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6137
6137
|
placement = normalizePlacement(raw, contents);
|
|
6138
6138
|
} catch (e) {
|
|
@@ -7303,7 +7303,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7303
7303
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7304
7304
|
const subpaths = [];
|
|
7305
7305
|
components.forEach((c, ci) => {
|
|
7306
|
-
|
|
7306
|
+
_chunkBQE3Y6ZOcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7307
7307
|
if (!sp.anchors.length) return;
|
|
7308
7308
|
subpaths.push({
|
|
7309
7309
|
closed: sp.closed,
|
|
@@ -8129,7 +8129,7 @@ function merged(levels) {
|
|
|
8129
8129
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8130
8130
|
const n = (k) => eNum(eGet(d, k));
|
|
8131
8131
|
const flag = (k) => eBool(eGet(d, k));
|
|
8132
|
-
const s = { ...
|
|
8132
|
+
const s = { ..._chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE };
|
|
8133
8133
|
const fi = n("Font");
|
|
8134
8134
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8135
8135
|
if (ps) {
|
|
@@ -8214,7 +8214,7 @@ function typeFromTySh(data, notes) {
|
|
|
8214
8214
|
}
|
|
8215
8215
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8216
8216
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8217
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8217
|
+
let runs = [{ length: text3.length, style: { ..._chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE } }];
|
|
8218
8218
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8219
8219
|
let frame = { kind: "point" };
|
|
8220
8220
|
let transform = t.transform;
|
|
@@ -8270,14 +8270,14 @@ function typeFromTySh(data, notes) {
|
|
|
8270
8270
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8271
8271
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8272
8272
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8273
|
-
transform =
|
|
8273
|
+
transform = _chunkBQE3Y6ZOcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8274
8274
|
}
|
|
8275
8275
|
}
|
|
8276
8276
|
}
|
|
8277
8277
|
return {
|
|
8278
8278
|
text: text3,
|
|
8279
|
-
runs:
|
|
8280
|
-
paragraphs:
|
|
8279
|
+
runs: _chunkBQE3Y6ZOcjs.fitRuns.call(void 0, runs, text3.length, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE),
|
|
8280
|
+
paragraphs: _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8281
8281
|
frame,
|
|
8282
8282
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8283
8283
|
transform,
|
|
@@ -8353,7 +8353,7 @@ function buildEngineData(layer, template) {
|
|
|
8353
8353
|
fonts.push(ps);
|
|
8354
8354
|
return fonts.length - 1;
|
|
8355
8355
|
};
|
|
8356
|
-
const runs =
|
|
8356
|
+
const runs = _chunkBQE3Y6ZOcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE);
|
|
8357
8357
|
const vertical = layer.orientation === "vertical";
|
|
8358
8358
|
const sruns = [];
|
|
8359
8359
|
const slens = [];
|
|
@@ -8362,10 +8362,10 @@ function buildEngineData(layer, template) {
|
|
|
8362
8362
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8363
8363
|
});
|
|
8364
8364
|
if (!runs.length) {
|
|
8365
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8365
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8366
8366
|
slens.push(E.int(1));
|
|
8367
8367
|
}
|
|
8368
|
-
const paras =
|
|
8368
|
+
const paras = _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8369
8369
|
const pruns = [];
|
|
8370
8370
|
const plens = [];
|
|
8371
8371
|
paras.forEach((p, i) => {
|
|
@@ -8421,7 +8421,7 @@ function buildEngineData(layer, template) {
|
|
|
8421
8421
|
eSet(e, key, rd);
|
|
8422
8422
|
}
|
|
8423
8423
|
eSet(rd, "FontSet", fontSet);
|
|
8424
|
-
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]), () => (
|
|
8424
|
+
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]), () => ( _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8425
8425
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8426
8426
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8427
8427
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8432,13 +8432,13 @@ function inkBounds2(layer) {
|
|
|
8432
8432
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8433
8433
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8434
8434
|
if (!b) return [0, 0, 0, 0];
|
|
8435
|
-
const inv =
|
|
8435
|
+
const inv = _chunkBQE3Y6ZOcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8436
8436
|
const pts = [
|
|
8437
8437
|
{ x: b.x, y: b.y },
|
|
8438
8438
|
{ x: b.x + b.width, y: b.y },
|
|
8439
8439
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8440
8440
|
{ x: b.x, y: b.y + b.height }
|
|
8441
|
-
].map((p) =>
|
|
8441
|
+
].map((p) => _chunkBQE3Y6ZOcjs.applyMatrix.call(void 0, inv, p));
|
|
8442
8442
|
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))];
|
|
8443
8443
|
}
|
|
8444
8444
|
function tyShForLayer(layer) {
|
|
@@ -8719,7 +8719,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8719
8719
|
var warpStyleOf = (name) => {
|
|
8720
8720
|
if (!name.startsWith("warp")) return null;
|
|
8721
8721
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8722
|
-
return
|
|
8722
|
+
return _chunkBQE3Y6ZOcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8723
8723
|
};
|
|
8724
8724
|
function warpFromDescriptor(w, contents) {
|
|
8725
8725
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8749,7 +8749,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8749
8749
|
} else {
|
|
8750
8750
|
const style = warpStyleOf(styleName);
|
|
8751
8751
|
if (!style) return void 0;
|
|
8752
|
-
mesh =
|
|
8752
|
+
mesh = _chunkBQE3Y6ZOcjs.warpPresetMesh.call(void 0,
|
|
8753
8753
|
{
|
|
8754
8754
|
style,
|
|
8755
8755
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8764,7 +8764,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8764
8764
|
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;
|
|
8765
8765
|
if (!same) {
|
|
8766
8766
|
const m = mesh;
|
|
8767
|
-
mesh =
|
|
8767
|
+
mesh = _chunkBQE3Y6ZOcjs.fitWarpMesh.call(void 0, (s, t) => _chunkBQE3Y6ZOcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8768
8768
|
}
|
|
8769
8769
|
return { mesh, frame };
|
|
8770
8770
|
}
|
|
@@ -10356,7 +10356,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10356
10356
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10357
10357
|
const kx = contents.width / size.width;
|
|
10358
10358
|
const ky = contents.height / size.height;
|
|
10359
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10359
|
+
if (placement.warp) placement = { ...placement, warp: _chunkBQE3Y6ZOcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10360
10360
|
}
|
|
10361
10361
|
}
|
|
10362
10362
|
if (!contents || !placement) {
|