@pixerate/editor 0.281.0 → 0.282.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 +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/brushes/index.cjs +76 -71
- package/dist/brushes/index.js +13 -8
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/types.d.cts +29 -3
- package/dist/brushes/types.d.ts +29 -3
- package/dist/{brushstrokeRender-EIK3625T.js → brushstrokeRender-4MA5CBW3.js} +3 -3
- package/dist/{brushstrokeRender-7HOMKZNO.cjs → brushstrokeRender-JVKVKWDA.cjs} +15 -15
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NJDEKU5D.js → chunk-2YGYYVSG.js} +1 -1
- package/dist/{chunk-JVFGK3DK.cjs → chunk-3JUKN3RM.cjs} +76 -53
- package/dist/{chunk-HN57I7KT.js → chunk-CG3FBNXE.js} +1 -1
- package/dist/{chunk-WFSYZO5Z.cjs → chunk-DFZ4I7EZ.cjs} +1 -1
- package/dist/{chunk-LZE2QZCT.js → chunk-IHMMHZGP.js} +1 -1
- package/dist/{chunk-K4ANWBF7.cjs → chunk-IJQ2YH2M.cjs} +35 -35
- package/dist/{chunk-HRUK5TFW.cjs → chunk-IUKPQCYQ.cjs} +164 -71
- package/dist/{chunk-WCC4NXWY.cjs → chunk-JD63B33V.cjs} +86 -86
- package/dist/{chunk-NJLPW4MM.js → chunk-KV7QHPKL.js} +27 -4
- package/dist/{chunk-H3EME3S5.cjs → chunk-MRIAR5DY.cjs} +2 -2
- package/dist/{chunk-ROURHJYT.js → chunk-NEDS6DSC.js} +1 -1
- package/dist/{chunk-FKO3CY2C.js → chunk-ULPXJ3NB.js} +1 -1
- package/dist/{chunk-WZYRYYXN.cjs → chunk-UOM5S4W5.cjs} +12 -12
- package/dist/{chunk-YOM76H2V.js → chunk-VEX6YVNG.js} +1 -1
- package/dist/{chunk-MNHP3AQT.cjs → chunk-WEXWDBUF.cjs} +23 -23
- package/dist/{chunk-PPDUCZZV.js → chunk-YRGTQLDN.js} +122 -29
- package/dist/image-editor/index.cjs +788 -788
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/antimatter.d.cts +154 -0
- package/dist/paint-editor/antimatter.d.ts +154 -0
- package/dist/paint-editor/brush-controls.d.cts +1 -0
- package/dist/paint-editor/brush-controls.d.ts +1 -0
- package/dist/paint-editor/brush-model.d.cts +9 -5
- package/dist/paint-editor/brush-model.d.ts +9 -5
- package/dist/paint-editor/controller.d.cts +23 -0
- package/dist/paint-editor/controller.d.ts +23 -0
- package/dist/paint-editor/index.cjs +1931 -891
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +1098 -58
- package/dist/paint-editor/mark-settings.d.cts +30 -0
- package/dist/paint-editor/mark-settings.d.ts +30 -0
- package/dist/paint-editor/stroke.d.cts +16 -0
- package/dist/paint-editor/stroke.d.ts +16 -0
- package/dist/paint-editor/strokes.d.cts +2 -0
- package/dist/paint-editor/strokes.d.ts +2 -0
- package/dist/paint-editor/ui.d.cts +4 -2
- package/dist/paint-editor/ui.d.ts +4 -2
- package/dist/vector/index.cjs +999 -999
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +8 -2
- package/skills/pixerate-paint-editor/references/antimatter.md +49 -0
- package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
|
@@ -115,7 +115,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var
|
|
118
|
+
var _chunkUOM5S4W5cjs = require('./chunk-UOM5S4W5.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
@@ -2058,7 +2058,7 @@ function mapAnchor(a, f) {
|
|
|
2058
2058
|
return out;
|
|
2059
2059
|
}
|
|
2060
2060
|
function mapSubpaths(subpaths, f) {
|
|
2061
|
-
return
|
|
2061
|
+
return _chunkUOM5S4W5cjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2062
2062
|
}
|
|
2063
2063
|
function liveShapeSubpaths(live) {
|
|
2064
2064
|
let out;
|
|
@@ -2066,19 +2066,19 @@ function liveShapeSubpaths(live) {
|
|
|
2066
2066
|
case "rect": {
|
|
2067
2067
|
const x = Math.min(live.x, live.x + live.width);
|
|
2068
2068
|
const y = Math.min(live.y, live.y + live.height);
|
|
2069
|
-
const sp =
|
|
2069
|
+
const sp = _chunkUOM5S4W5cjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2070
2070
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2071
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2071
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkUOM5S4W5cjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2072
2072
|
break;
|
|
2073
2073
|
}
|
|
2074
2074
|
case "ellipse":
|
|
2075
|
-
out = [
|
|
2075
|
+
out = [_chunkUOM5S4W5cjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2076
2076
|
break;
|
|
2077
2077
|
case "polygon":
|
|
2078
|
-
out = [
|
|
2078
|
+
out = [_chunkUOM5S4W5cjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2079
2079
|
break;
|
|
2080
2080
|
case "star":
|
|
2081
|
-
out = [
|
|
2081
|
+
out = [_chunkUOM5S4W5cjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2082
2082
|
break;
|
|
2083
2083
|
case "line": {
|
|
2084
2084
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2101,7 +2101,7 @@ function liveShapeSubpaths(live) {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
}
|
|
2103
2103
|
const m = live.transform;
|
|
2104
|
-
return m && !
|
|
2104
|
+
return m && !_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2105
2105
|
}
|
|
2106
2106
|
function normBox(b) {
|
|
2107
2107
|
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) };
|
|
@@ -2113,7 +2113,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2113
2113
|
function componentPath(c) {
|
|
2114
2114
|
let p = pathCache.get(c.subpaths);
|
|
2115
2115
|
if (!p) {
|
|
2116
|
-
p =
|
|
2116
|
+
p = _chunkUOM5S4W5cjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2117
2117
|
pathCache.set(c.subpaths, p);
|
|
2118
2118
|
}
|
|
2119
2119
|
return p;
|
|
@@ -2440,7 +2440,7 @@ function matrixArg(v, path) {
|
|
|
2440
2440
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2441
2441
|
const m = v;
|
|
2442
2442
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2443
|
-
return
|
|
2443
|
+
return _chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2444
2444
|
}
|
|
2445
2445
|
function normalizeLiveShape(v, path = "shape") {
|
|
2446
2446
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2501,7 +2501,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2501
2501
|
if (typeof v === "string") {
|
|
2502
2502
|
let subs;
|
|
2503
2503
|
try {
|
|
2504
|
-
subs =
|
|
2504
|
+
subs = _chunkUOM5S4W5cjs.bezierToSubpaths.call(void 0, v);
|
|
2505
2505
|
} catch (e5) {
|
|
2506
2506
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2507
2507
|
}
|
|
@@ -2587,15 +2587,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2587
2587
|
function transformShapeComponents(components, f, affine) {
|
|
2588
2588
|
return components.map((c) => {
|
|
2589
2589
|
if (affine && c.live) {
|
|
2590
|
-
const live = { ...c.live, transform:
|
|
2591
|
-
if (
|
|
2590
|
+
const live = { ...c.live, transform: _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkUOM5S4W5cjs.IDENTITY_MATRIX)), affine) };
|
|
2591
|
+
if (_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2592
2592
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2593
2593
|
}
|
|
2594
2594
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2595
2595
|
});
|
|
2596
2596
|
}
|
|
2597
2597
|
function offsetShape(layer, dx, dy, env) {
|
|
2598
|
-
const m =
|
|
2598
|
+
const m = _chunkUOM5S4W5cjs.translateMatrix.call(void 0, dx, dy);
|
|
2599
2599
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2600
2600
|
delete next.annotation;
|
|
2601
2601
|
return rerenderShape(next, env);
|
|
@@ -2603,7 +2603,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2603
2603
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2604
2604
|
if (components.length < 2) return [...components];
|
|
2605
2605
|
const path = shapeOutline(components, fillRule);
|
|
2606
|
-
const subpaths =
|
|
2606
|
+
const subpaths = _chunkUOM5S4W5cjs.bezierToSubpaths.call(void 0, path);
|
|
2607
2607
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2608
2608
|
return [{ op: "combine", subpaths }];
|
|
2609
2609
|
}
|
|
@@ -2620,7 +2620,7 @@ function annotationPaint(color, opacity) {
|
|
|
2620
2620
|
function shapeFromAnnotation(a) {
|
|
2621
2621
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2622
2622
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2623
|
-
const rotation = a.rotation ?
|
|
2623
|
+
const rotation = a.rotation ? _chunkUOM5S4W5cjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2624
2624
|
const t = rotation ? { transform: rotation } : {};
|
|
2625
2625
|
const live = (l) => liveComponent(l);
|
|
2626
2626
|
switch (a.type) {
|
|
@@ -2663,7 +2663,7 @@ function shapeFromAnnotation(a) {
|
|
|
2663
2663
|
case "pen": {
|
|
2664
2664
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2665
2665
|
if (!paint) return null;
|
|
2666
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2666
|
+
const pts = rotation ? a.points.map((p) => _chunkUOM5S4W5cjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2667
2667
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2668
2668
|
return {
|
|
2669
2669
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2696,7 +2696,7 @@ var JOIN_SIGMA = 2;
|
|
|
2696
2696
|
function vectorMaskSegments(components) {
|
|
2697
2697
|
const out = [];
|
|
2698
2698
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2699
|
-
for (let k = 0; k <
|
|
2699
|
+
for (let k = 0; k < _chunkUOM5S4W5cjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2700
2700
|
}));
|
|
2701
2701
|
return out;
|
|
2702
2702
|
}
|
|
@@ -2704,7 +2704,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2704
2704
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2705
2705
|
return edges.filter((e) => {
|
|
2706
2706
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2707
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2707
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkUOM5S4W5cjs.subpathSegmentCount.call(void 0, sp);
|
|
2708
2708
|
});
|
|
2709
2709
|
}
|
|
2710
2710
|
function reach(e) {
|
|
@@ -2727,8 +2727,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2727
2727
|
const seedClass = [];
|
|
2728
2728
|
vm.components.forEach(
|
|
2729
2729
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2730
|
-
for (let k = 0; k <
|
|
2731
|
-
const seg =
|
|
2730
|
+
for (let k = 0; k < _chunkUOM5S4W5cjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
2731
|
+
const seg = _chunkUOM5S4W5cjs.subpathSegment.call(void 0, sp, k);
|
|
2732
2732
|
let len = 0;
|
|
2733
2733
|
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]);
|
|
2734
2734
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3628,7 +3628,7 @@ var fail3 = (message) => {
|
|
|
3628
3628
|
};
|
|
3629
3629
|
var TEXT_RENDER_MARGIN = _chunkPVJMTLPJcjs.MAX_EFFECT_REACH;
|
|
3630
3630
|
function textMatrix(layer) {
|
|
3631
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3631
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkUOM5S4W5cjs.IDENTITY_MATRIX));
|
|
3632
3632
|
}
|
|
3633
3633
|
function rectCorners(r) {
|
|
3634
3634
|
return [
|
|
@@ -3639,7 +3639,7 @@ function rectCorners(r) {
|
|
|
3639
3639
|
];
|
|
3640
3640
|
}
|
|
3641
3641
|
function docRect(r, m) {
|
|
3642
|
-
const pts = rectCorners(r).map((p) =>
|
|
3642
|
+
const pts = rectCorners(r).map((p) => _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, p));
|
|
3643
3643
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3644
3644
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3645
3645
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3659,7 +3659,7 @@ function inkBounds(layout) {
|
|
|
3659
3659
|
for (const f of l.fragments) {
|
|
3660
3660
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3661
3661
|
const w = f.carets[f.carets.length - 1];
|
|
3662
|
-
const r =
|
|
3662
|
+
const r = _chunkUOM5S4W5cjs.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) });
|
|
3663
3663
|
if (!b) b = r;
|
|
3664
3664
|
else {
|
|
3665
3665
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3672,14 +3672,14 @@ function inkBounds(layout) {
|
|
|
3672
3672
|
}
|
|
3673
3673
|
function textOutlines(layer, shaper) {
|
|
3674
3674
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3675
|
-
const layout =
|
|
3675
|
+
const layout = _chunkUOM5S4W5cjs.layoutText.call(void 0, layer, shaper);
|
|
3676
3676
|
const m = textMatrix(layer);
|
|
3677
3677
|
const out = [];
|
|
3678
3678
|
for (const l of layout.lines) {
|
|
3679
3679
|
for (const f of l.fragments) {
|
|
3680
|
-
let path =
|
|
3681
|
-
for (const r of
|
|
3682
|
-
out.push({ fragment: f, path:
|
|
3680
|
+
let path = _chunkUOM5S4W5cjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3681
|
+
for (const r of _chunkUOM5S4W5cjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkUOM5S4W5cjs.textRectPath.call(void 0, r)];
|
|
3682
|
+
out.push({ fragment: f, path: _chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3683
3683
|
}
|
|
3684
3684
|
}
|
|
3685
3685
|
return out;
|
|
@@ -3735,7 +3735,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3735
3735
|
const canvas = env.createCanvas(region.width, region.height);
|
|
3736
3736
|
const ctx = canvas.getContext("2d");
|
|
3737
3737
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
3738
|
-
const layout =
|
|
3738
|
+
const layout = _chunkUOM5S4W5cjs.layoutText.call(void 0, layer, shaper);
|
|
3739
3739
|
const m = textMatrix(layer);
|
|
3740
3740
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3741
3741
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -3745,8 +3745,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3745
3745
|
const [r, g, b] = rgbOf(f.style.color);
|
|
3746
3746
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
3747
3747
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
3748
|
-
|
|
3749
|
-
for (const d of
|
|
3748
|
+
_chunkUOM5S4W5cjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
3749
|
+
for (const d of _chunkUOM5S4W5cjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
3750
3750
|
}
|
|
3751
3751
|
}
|
|
3752
3752
|
ctx.globalAlpha = 1;
|
|
@@ -3757,7 +3757,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
3757
3757
|
function renderText(layer, env) {
|
|
3758
3758
|
const shaper = env.shaper;
|
|
3759
3759
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
3760
|
-
const layout =
|
|
3760
|
+
const layout = _chunkUOM5S4W5cjs.layoutText.call(void 0, layer, shaper);
|
|
3761
3761
|
const ink = inkBounds(layout);
|
|
3762
3762
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
3763
3763
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -3858,7 +3858,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
3858
3858
|
continue;
|
|
3859
3859
|
}
|
|
3860
3860
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
3861
|
-
if (k === "autoLeading" && value ===
|
|
3861
|
+
if (k === "autoLeading" && value === _chunkUOM5S4W5cjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
3862
3862
|
else o[k] = value;
|
|
3863
3863
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
3864
3864
|
}
|
|
@@ -3899,15 +3899,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
3899
3899
|
opacity: 1,
|
|
3900
3900
|
blend: "normal",
|
|
3901
3901
|
text: text3,
|
|
3902
|
-
runs:
|
|
3903
|
-
paragraphs:
|
|
3902
|
+
runs: _chunkUOM5S4W5cjs.fitRuns.call(void 0, init.runs, text3.length, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE),
|
|
3903
|
+
paragraphs: _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
3904
3904
|
frame: init.frame,
|
|
3905
3905
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
3906
3906
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
3907
3907
|
offset: { x: 0, y: 0 }
|
|
3908
3908
|
};
|
|
3909
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
3910
|
-
if (init.transform && !
|
|
3909
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE)) }];
|
|
3910
|
+
if (init.transform && !_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
3911
3911
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
3912
3912
|
return rerenderText(layer, env);
|
|
3913
3913
|
}
|
|
@@ -3918,24 +3918,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3918
3918
|
const next = { ...current, ...patch };
|
|
3919
3919
|
if (!("annotation" in patch)) delete next.annotation;
|
|
3920
3920
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
3921
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
3922
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
3923
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
3921
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkUOM5S4W5cjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE)));
|
|
3922
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkUOM5S4W5cjs.styleAt.call(void 0, current.runs, 0, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE) }];
|
|
3923
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
3924
3924
|
const rendered = rerenderText(next, env);
|
|
3925
3925
|
return { layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
3926
3926
|
}
|
|
3927
3927
|
function replaceTextRange(layer, start, end, insert) {
|
|
3928
3928
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
3929
|
-
const style =
|
|
3930
|
-
const runs =
|
|
3931
|
-
const pstyle =
|
|
3932
|
-
const paragraphs =
|
|
3933
|
-
return { text: text3, runs, paragraphs:
|
|
3929
|
+
const style = _chunkUOM5S4W5cjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE);
|
|
3930
|
+
const runs = _chunkUOM5S4W5cjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
3931
|
+
const pstyle = _chunkUOM5S4W5cjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
3932
|
+
const paragraphs = _chunkUOM5S4W5cjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
3933
|
+
return { text: text3, runs, paragraphs: _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
3934
3934
|
}
|
|
3935
3935
|
function transformTypeLayer(layer, m) {
|
|
3936
|
-
const t =
|
|
3936
|
+
const t = _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
3937
3937
|
const next = { ...layer };
|
|
3938
|
-
if (
|
|
3938
|
+
if (_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
3939
3939
|
else next.transform = t;
|
|
3940
3940
|
delete next.annotation;
|
|
3941
3941
|
return next;
|
|
@@ -3943,7 +3943,7 @@ function transformTypeLayer(layer, m) {
|
|
|
3943
3943
|
function typeFrame(layer, shaper) {
|
|
3944
3944
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
3945
3945
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
3946
|
-
const b =
|
|
3946
|
+
const b = _chunkUOM5S4W5cjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
3947
3947
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
3948
3948
|
}
|
|
3949
3949
|
function typeAsPixelLayer(layer) {
|
|
@@ -3951,7 +3951,7 @@ function typeAsPixelLayer(layer) {
|
|
|
3951
3951
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
3952
3952
|
}
|
|
3953
3953
|
function toTextSpace(layer, p) {
|
|
3954
|
-
return
|
|
3954
|
+
return _chunkUOM5S4W5cjs.applyMatrix.call(void 0, _chunkUOM5S4W5cjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
3955
3955
|
}
|
|
3956
3956
|
function typeFromAnnotation(a) {
|
|
3957
3957
|
if (a.type !== "text") return null;
|
|
@@ -3965,7 +3965,7 @@ function typeFromAnnotation(a) {
|
|
|
3965
3965
|
if (op !== 1) style.opacity = op;
|
|
3966
3966
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
3967
3967
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
3968
|
-
const transform = t.rotation ?
|
|
3968
|
+
const transform = t.rotation ? _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, translate, _chunkUOM5S4W5cjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
3969
3969
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
3970
3970
|
}
|
|
3971
3971
|
function annotationOfType(layer) {
|
|
@@ -4605,7 +4605,7 @@ function identityTransform(box2) {
|
|
|
4605
4605
|
}
|
|
4606
4606
|
function cornersFromMatrix(box2, m) {
|
|
4607
4607
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4608
|
-
return [
|
|
4608
|
+
return [_chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[0]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[1]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[2]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4609
4609
|
}
|
|
4610
4610
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4611
4611
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4622,7 +4622,7 @@ function transformHomography(geometry) {
|
|
|
4622
4622
|
function hasWarp(geometry) {
|
|
4623
4623
|
const w = geometry.warp;
|
|
4624
4624
|
if (!w) return false;
|
|
4625
|
-
const id =
|
|
4625
|
+
const id = _chunkUOM5S4W5cjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4626
4626
|
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;
|
|
4627
4627
|
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);
|
|
4628
4628
|
}
|
|
@@ -4637,7 +4637,7 @@ function transformMap(geometry) {
|
|
|
4637
4637
|
const { box: box2 } = geometry;
|
|
4638
4638
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4639
4639
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4640
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4640
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkUOM5S4W5cjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4641
4641
|
}
|
|
4642
4642
|
function transformedPoint(geometry, fx, fy) {
|
|
4643
4643
|
const f = transformMap(geometry);
|
|
@@ -4681,8 +4681,8 @@ function matrixFromParams(box2, params) {
|
|
|
4681
4681
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4682
4682
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4683
4683
|
const ref = referencePoint(box2, params.reference);
|
|
4684
|
-
const linear =
|
|
4685
|
-
return
|
|
4684
|
+
const linear = _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkUOM5S4W5cjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4685
|
+
return _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, _chunkUOM5S4W5cjs.matrixAbout.call(void 0, linear, ref), _chunkUOM5S4W5cjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4686
4686
|
}
|
|
4687
4687
|
function describeTransform(geometry, reference = "center") {
|
|
4688
4688
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4699,7 +4699,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4699
4699
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4700
4700
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4701
4701
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4702
|
-
const at =
|
|
4702
|
+
const at = _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, ref);
|
|
4703
4703
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4704
4704
|
return {
|
|
4705
4705
|
affine: true,
|
|
@@ -4717,24 +4717,24 @@ function applyParams(geometry, params) {
|
|
|
4717
4717
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4718
4718
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4719
4719
|
const c = geometry.corners;
|
|
4720
|
-
return [
|
|
4720
|
+
return [_chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, c[0]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, c[1]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, c[2]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, c[3])];
|
|
4721
4721
|
}
|
|
4722
4722
|
function flipCorners(geometry, axis) {
|
|
4723
4723
|
const c = anchorPoint(geometry, "center");
|
|
4724
4724
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4725
4725
|
const q2 = geometry.corners;
|
|
4726
|
-
return [
|
|
4726
|
+
return [_chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[0]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[1]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[2]), _chunkUOM5S4W5cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4727
4727
|
}
|
|
4728
4728
|
function boxPointOf(geometry, p) {
|
|
4729
4729
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4730
|
-
if (m) return
|
|
4730
|
+
if (m) return _chunkUOM5S4W5cjs.applyMatrix.call(void 0, _chunkUOM5S4W5cjs.invertMatrix.call(void 0, m), p);
|
|
4731
4731
|
return null;
|
|
4732
4732
|
}
|
|
4733
4733
|
function presetWarp(box2, preset) {
|
|
4734
|
-
return
|
|
4734
|
+
return _chunkUOM5S4W5cjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4735
4735
|
}
|
|
4736
4736
|
function isValidWarp(mesh) {
|
|
4737
|
-
return
|
|
4737
|
+
return _chunkUOM5S4W5cjs.isValidWarpMesh.call(void 0, mesh);
|
|
4738
4738
|
}
|
|
4739
4739
|
function geometryHomography(geometry) {
|
|
4740
4740
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -5013,7 +5013,7 @@ function normalizePlacement(raw, contents) {
|
|
|
5013
5013
|
}
|
|
5014
5014
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
5015
5015
|
if (raw.warp) {
|
|
5016
|
-
if (!
|
|
5016
|
+
if (!_chunkUOM5S4W5cjs.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.");
|
|
5017
5017
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
5018
5018
|
}
|
|
5019
5019
|
if (raw.interpolation !== void 0) {
|
|
@@ -5117,7 +5117,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5117
5117
|
case "shape": {
|
|
5118
5118
|
const next = {
|
|
5119
5119
|
...layer,
|
|
5120
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5120
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkUOM5S4W5cjs.translateMatrix.call(void 0, dx, dy)),
|
|
5121
5121
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5122
5122
|
mask: moveMask(layer.mask)
|
|
5123
5123
|
};
|
|
@@ -5126,7 +5126,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5126
5126
|
return next;
|
|
5127
5127
|
}
|
|
5128
5128
|
case "type": {
|
|
5129
|
-
const next = { ...transformTypeLayer(layer,
|
|
5129
|
+
const next = { ...transformTypeLayer(layer, _chunkUOM5S4W5cjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5130
5130
|
if (!next.mask) delete next.mask;
|
|
5131
5131
|
return next;
|
|
5132
5132
|
}
|
|
@@ -5312,7 +5312,7 @@ function refitPlacement(layer, contents) {
|
|
|
5312
5312
|
});
|
|
5313
5313
|
const out = { corners: pts };
|
|
5314
5314
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5315
|
-
if (layer.placement.warp) out.warp =
|
|
5315
|
+
if (layer.placement.warp) out.warp = _chunkUOM5S4W5cjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5316
5316
|
return out;
|
|
5317
5317
|
}
|
|
5318
5318
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5689,7 +5689,7 @@ function readType(r, base, ctx) {
|
|
|
5689
5689
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5690
5690
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5691
5691
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5692
|
-
style: patchTextStyle(
|
|
5692
|
+
style: patchTextStyle(_chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5693
5693
|
}));
|
|
5694
5694
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5695
5695
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5702,13 +5702,13 @@ function readType(r, base, ctx) {
|
|
|
5702
5702
|
...base,
|
|
5703
5703
|
type: "type",
|
|
5704
5704
|
text: text3,
|
|
5705
|
-
runs:
|
|
5706
|
-
paragraphs:
|
|
5705
|
+
runs: _chunkUOM5S4W5cjs.fitRuns.call(void 0, runs, text3.length, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE),
|
|
5706
|
+
paragraphs: _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5707
5707
|
frame,
|
|
5708
5708
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5709
5709
|
offset: { x: 0, y: 0 }
|
|
5710
5710
|
};
|
|
5711
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5711
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE)) }];
|
|
5712
5712
|
if (m) layer.transform = m;
|
|
5713
5713
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5714
5714
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6178,7 +6178,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6178
6178
|
let placement;
|
|
6179
6179
|
try {
|
|
6180
6180
|
const raw = { corners: p.corners };
|
|
6181
|
-
if (p.warp &&
|
|
6181
|
+
if (p.warp && _chunkUOM5S4W5cjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6182
6182
|
if (_chunkPVJMTLPJcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6183
6183
|
placement = normalizePlacement(raw, contents);
|
|
6184
6184
|
} catch (e) {
|
|
@@ -7349,7 +7349,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7349
7349
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7350
7350
|
const subpaths = [];
|
|
7351
7351
|
components.forEach((c, ci) => {
|
|
7352
|
-
|
|
7352
|
+
_chunkUOM5S4W5cjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7353
7353
|
if (!sp.anchors.length) return;
|
|
7354
7354
|
subpaths.push({
|
|
7355
7355
|
closed: sp.closed,
|
|
@@ -8175,7 +8175,7 @@ function merged(levels) {
|
|
|
8175
8175
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8176
8176
|
const n = (k) => eNum(eGet(d, k));
|
|
8177
8177
|
const flag = (k) => eBool(eGet(d, k));
|
|
8178
|
-
const s = { ...
|
|
8178
|
+
const s = { ..._chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE };
|
|
8179
8179
|
const fi = n("Font");
|
|
8180
8180
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8181
8181
|
if (ps) {
|
|
@@ -8260,7 +8260,7 @@ function typeFromTySh(data, notes) {
|
|
|
8260
8260
|
}
|
|
8261
8261
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8262
8262
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8263
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8263
|
+
let runs = [{ length: text3.length, style: { ..._chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE } }];
|
|
8264
8264
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8265
8265
|
let frame = { kind: "point" };
|
|
8266
8266
|
let transform = t.transform;
|
|
@@ -8316,14 +8316,14 @@ function typeFromTySh(data, notes) {
|
|
|
8316
8316
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8317
8317
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8318
8318
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8319
|
-
transform =
|
|
8319
|
+
transform = _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8320
8320
|
}
|
|
8321
8321
|
}
|
|
8322
8322
|
}
|
|
8323
8323
|
return {
|
|
8324
8324
|
text: text3,
|
|
8325
|
-
runs:
|
|
8326
|
-
paragraphs:
|
|
8325
|
+
runs: _chunkUOM5S4W5cjs.fitRuns.call(void 0, runs, text3.length, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE),
|
|
8326
|
+
paragraphs: _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8327
8327
|
frame,
|
|
8328
8328
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8329
8329
|
transform,
|
|
@@ -8399,7 +8399,7 @@ function buildEngineData(layer, template) {
|
|
|
8399
8399
|
fonts.push(ps);
|
|
8400
8400
|
return fonts.length - 1;
|
|
8401
8401
|
};
|
|
8402
|
-
const runs =
|
|
8402
|
+
const runs = _chunkUOM5S4W5cjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE);
|
|
8403
8403
|
const vertical = layer.orientation === "vertical";
|
|
8404
8404
|
const sruns = [];
|
|
8405
8405
|
const slens = [];
|
|
@@ -8408,10 +8408,10 @@ function buildEngineData(layer, template) {
|
|
|
8408
8408
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8409
8409
|
});
|
|
8410
8410
|
if (!runs.length) {
|
|
8411
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8411
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8412
8412
|
slens.push(E.int(1));
|
|
8413
8413
|
}
|
|
8414
|
-
const paras =
|
|
8414
|
+
const paras = _chunkUOM5S4W5cjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8415
8415
|
const pruns = [];
|
|
8416
8416
|
const plens = [];
|
|
8417
8417
|
paras.forEach((p, i) => {
|
|
@@ -8467,7 +8467,7 @@ function buildEngineData(layer, template) {
|
|
|
8467
8467
|
eSet(e, key, rd);
|
|
8468
8468
|
}
|
|
8469
8469
|
eSet(rd, "FontSet", fontSet);
|
|
8470
|
-
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]), () => (
|
|
8470
|
+
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]), () => ( _chunkUOM5S4W5cjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8471
8471
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8472
8472
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8473
8473
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8478,13 +8478,13 @@ function inkBounds2(layer) {
|
|
|
8478
8478
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8479
8479
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8480
8480
|
if (!b) return [0, 0, 0, 0];
|
|
8481
|
-
const inv =
|
|
8481
|
+
const inv = _chunkUOM5S4W5cjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8482
8482
|
const pts = [
|
|
8483
8483
|
{ x: b.x, y: b.y },
|
|
8484
8484
|
{ x: b.x + b.width, y: b.y },
|
|
8485
8485
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8486
8486
|
{ x: b.x, y: b.y + b.height }
|
|
8487
|
-
].map((p) =>
|
|
8487
|
+
].map((p) => _chunkUOM5S4W5cjs.applyMatrix.call(void 0, inv, p));
|
|
8488
8488
|
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))];
|
|
8489
8489
|
}
|
|
8490
8490
|
function tyShForLayer(layer) {
|
|
@@ -8765,7 +8765,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8765
8765
|
var warpStyleOf = (name) => {
|
|
8766
8766
|
if (!name.startsWith("warp")) return null;
|
|
8767
8767
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8768
|
-
return
|
|
8768
|
+
return _chunkUOM5S4W5cjs.WARP_STYLES.includes(s) ? s : null;
|
|
8769
8769
|
};
|
|
8770
8770
|
function warpFromDescriptor(w, contents) {
|
|
8771
8771
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8795,7 +8795,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8795
8795
|
} else {
|
|
8796
8796
|
const style = warpStyleOf(styleName);
|
|
8797
8797
|
if (!style) return void 0;
|
|
8798
|
-
mesh =
|
|
8798
|
+
mesh = _chunkUOM5S4W5cjs.warpPresetMesh.call(void 0,
|
|
8799
8799
|
{
|
|
8800
8800
|
style,
|
|
8801
8801
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8810,7 +8810,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8810
8810
|
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;
|
|
8811
8811
|
if (!same) {
|
|
8812
8812
|
const m = mesh;
|
|
8813
|
-
mesh =
|
|
8813
|
+
mesh = _chunkUOM5S4W5cjs.fitWarpMesh.call(void 0, (s, t) => _chunkUOM5S4W5cjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8814
8814
|
}
|
|
8815
8815
|
return { mesh, frame };
|
|
8816
8816
|
}
|
|
@@ -10402,7 +10402,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10402
10402
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10403
10403
|
const kx = contents.width / size.width;
|
|
10404
10404
|
const ky = contents.height / size.height;
|
|
10405
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10405
|
+
if (placement.warp) placement = { ...placement, warp: _chunkUOM5S4W5cjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10406
10406
|
}
|
|
10407
10407
|
}
|
|
10408
10408
|
if (!contents || !placement) {
|