@pixerate/editor 0.254.1 → 0.256.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/agent/index.cjs +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/index.cjs +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/brushes/index.cjs +31 -29
- package/dist/brushes/index.d.cts +1 -1
- package/dist/brushes/index.d.ts +1 -1
- package/dist/brushes/index.js +27 -25
- package/dist/brushes/library.d.cts +17 -0
- package/dist/brushes/library.d.ts +17 -0
- package/dist/{brushstrokeRender-5PYSKZIJ.js → brushstrokeRender-HCOQUSWW.js} +53 -18
- package/dist/{brushstrokeRender-7FLLSQEC.cjs → brushstrokeRender-ZZOXI5O5.cjs} +55 -20
- package/dist/canvas/brushTypes.d.cts +22 -3
- package/dist/canvas/brushTypes.d.ts +22 -3
- package/dist/canvas/brushstroke.d.cts +34 -12
- package/dist/canvas/brushstroke.d.ts +34 -12
- package/dist/canvas/brushstrokeRender.d.cts +14 -8
- package/dist/canvas/brushstrokeRender.d.ts +14 -8
- package/dist/canvas/drawController.d.cts +11 -3
- package/dist/canvas/drawController.d.ts +11 -3
- package/dist/canvas/freehand.d.cts +6 -1
- package/dist/canvas/freehand.d.ts +6 -1
- package/dist/canvas/index.cjs +114 -102
- package/dist/canvas/index.js +16 -4
- package/dist/{chunk-XVIK73LS.js → chunk-5P4JEOIV.js} +4 -4
- package/dist/{chunk-JPEHXIB5.cjs → chunk-5YWWQ36H.cjs} +66 -21
- package/dist/{chunk-CHAWTXBE.cjs → chunk-6WCQ35GI.cjs} +4 -4
- package/dist/{chunk-GYMMNCFT.js → chunk-AF23QK5F.js} +56 -11
- package/dist/{chunk-JFHBXNR2.cjs → chunk-B7V34GIH.cjs} +86 -86
- package/dist/{chunk-QC3OXRE4.js → chunk-DMTEQ6SH.js} +1 -1
- package/dist/{chunk-TLOGFIIV.cjs → chunk-GCTUOTCW.cjs} +35 -35
- package/dist/{chunk-34KLWUH4.cjs → chunk-HIMGBZAM.cjs} +1133 -597
- package/dist/{chunk-7P6VF3FG.js → chunk-HYWRU5VX.js} +1 -1
- package/dist/{chunk-QPHNVZHO.js → chunk-JVRLGV3C.js} +1118 -582
- package/dist/{chunk-LFMKWGFL.cjs → chunk-LRNUZKWV.cjs} +22 -8
- package/dist/chunk-PGPFWC35.cjs +517 -0
- package/dist/{chunk-QLSGTCYT.cjs → chunk-TBAVCLEQ.cjs} +23 -23
- package/dist/{chunk-2ZJ4DT3M.js → chunk-VUKUTT2W.js} +1 -1
- package/dist/{chunk-5JNA6LLY.js → chunk-WYGSR3IJ.js} +22 -8
- package/dist/chunk-YHUMGBZD.js +517 -0
- package/dist/commands/builtins.d.cts +1 -1
- package/dist/commands/builtins.d.ts +1 -1
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/image-editor/brush-presets.d.cts +32 -0
- package/dist/image-editor/brush-presets.d.ts +32 -0
- package/dist/image-editor/controller.d.cts +15 -0
- package/dist/image-editor/controller.d.ts +15 -0
- package/dist/image-editor/index.cjs +848 -775
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +81 -8
- package/dist/image-editor/types.d.cts +7 -0
- package/dist/image-editor/types.d.ts +7 -0
- package/dist/paint-editor/collaboration-tools.d.cts +19 -0
- package/dist/paint-editor/collaboration-tools.d.ts +19 -0
- package/dist/paint-editor/collaboration.d.cts +180 -0
- package/dist/paint-editor/collaboration.d.ts +180 -0
- package/dist/paint-editor/controller.d.cts +54 -0
- package/dist/paint-editor/controller.d.ts +54 -0
- package/dist/paint-editor/index.cjs +816 -283
- package/dist/paint-editor/index.d.cts +2 -0
- package/dist/paint-editor/index.d.ts +2 -0
- package/dist/paint-editor/index.js +567 -34
- package/dist/vector/brushstroke.d.cts +21 -5
- package/dist/vector/brushstroke.d.ts +21 -5
- package/dist/vector/controller.d.cts +14 -1
- package/dist/vector/controller.d.ts +14 -1
- package/dist/vector/index.cjs +1220 -1199
- package/dist/vector/index.js +34 -13
- package/dist/vector/types.d.cts +7 -0
- package/dist/vector/types.d.ts +7 -0
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +9 -3
- package/skills/pixerate-canvas/SKILL.md +10 -5
- package/skills/pixerate-image-editor/SKILL.md +2 -1
- package/skills/pixerate-paint-editor/SKILL.md +31 -46
- package/skills/pixerate-paint-editor/references/painting-alongside.md +19 -0
- package/skills/pixerate-vector/SKILL.md +1 -1
- package/dist/chunk-HS6QDWDF.cjs +0 -1029
- package/dist/chunk-MTKY6K3Q.js +0 -1029
|
@@ -106,7 +106,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
var
|
|
109
|
+
var _chunk5YWWQ36Hcjs = require('./chunk-5YWWQ36H.cjs');
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
@@ -2328,7 +2328,7 @@ function mapAnchor(a, f) {
|
|
|
2328
2328
|
return out;
|
|
2329
2329
|
}
|
|
2330
2330
|
function mapSubpaths(subpaths, f) {
|
|
2331
|
-
return
|
|
2331
|
+
return _chunk5YWWQ36Hcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2332
2332
|
}
|
|
2333
2333
|
function liveShapeSubpaths(live) {
|
|
2334
2334
|
let out;
|
|
@@ -2336,19 +2336,19 @@ function liveShapeSubpaths(live) {
|
|
|
2336
2336
|
case "rect": {
|
|
2337
2337
|
const x = Math.min(live.x, live.x + live.width);
|
|
2338
2338
|
const y = Math.min(live.y, live.y + live.height);
|
|
2339
|
-
const sp =
|
|
2339
|
+
const sp = _chunk5YWWQ36Hcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2340
2340
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2341
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2341
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunk5YWWQ36Hcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2342
2342
|
break;
|
|
2343
2343
|
}
|
|
2344
2344
|
case "ellipse":
|
|
2345
|
-
out = [
|
|
2345
|
+
out = [_chunk5YWWQ36Hcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2346
2346
|
break;
|
|
2347
2347
|
case "polygon":
|
|
2348
|
-
out = [
|
|
2348
|
+
out = [_chunk5YWWQ36Hcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2349
2349
|
break;
|
|
2350
2350
|
case "star":
|
|
2351
|
-
out = [
|
|
2351
|
+
out = [_chunk5YWWQ36Hcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2352
2352
|
break;
|
|
2353
2353
|
case "line": {
|
|
2354
2354
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2371,7 +2371,7 @@ function liveShapeSubpaths(live) {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
2373
|
const m = live.transform;
|
|
2374
|
-
return m && !
|
|
2374
|
+
return m && !_chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2375
2375
|
}
|
|
2376
2376
|
function normBox(b) {
|
|
2377
2377
|
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) };
|
|
@@ -2383,7 +2383,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2383
2383
|
function componentPath(c) {
|
|
2384
2384
|
let p = pathCache.get(c.subpaths);
|
|
2385
2385
|
if (!p) {
|
|
2386
|
-
p =
|
|
2386
|
+
p = _chunk5YWWQ36Hcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2387
2387
|
pathCache.set(c.subpaths, p);
|
|
2388
2388
|
}
|
|
2389
2389
|
return p;
|
|
@@ -2710,7 +2710,7 @@ function matrixArg(v, path) {
|
|
|
2710
2710
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2711
2711
|
const m = v;
|
|
2712
2712
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2713
|
-
return
|
|
2713
|
+
return _chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2714
2714
|
}
|
|
2715
2715
|
function normalizeLiveShape(v, path = "shape") {
|
|
2716
2716
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2771,7 +2771,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2771
2771
|
if (typeof v === "string") {
|
|
2772
2772
|
let subs;
|
|
2773
2773
|
try {
|
|
2774
|
-
subs =
|
|
2774
|
+
subs = _chunk5YWWQ36Hcjs.bezierToSubpaths.call(void 0, v);
|
|
2775
2775
|
} catch (e5) {
|
|
2776
2776
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2777
2777
|
}
|
|
@@ -2857,15 +2857,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2857
2857
|
function transformShapeComponents(components, f, affine) {
|
|
2858
2858
|
return components.map((c) => {
|
|
2859
2859
|
if (affine && c.live) {
|
|
2860
|
-
const live = { ...c.live, transform:
|
|
2861
|
-
if (
|
|
2860
|
+
const live = { ...c.live, transform: _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunk5YWWQ36Hcjs.IDENTITY_MATRIX)), affine) };
|
|
2861
|
+
if (_chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2862
2862
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2863
2863
|
}
|
|
2864
2864
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2865
2865
|
});
|
|
2866
2866
|
}
|
|
2867
2867
|
function offsetShape(layer, dx, dy, env) {
|
|
2868
|
-
const m =
|
|
2868
|
+
const m = _chunk5YWWQ36Hcjs.translateMatrix.call(void 0, dx, dy);
|
|
2869
2869
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2870
2870
|
delete next.annotation;
|
|
2871
2871
|
return rerenderShape(next, env);
|
|
@@ -2873,7 +2873,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2873
2873
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2874
2874
|
if (components.length < 2) return [...components];
|
|
2875
2875
|
const path = shapeOutline(components, fillRule);
|
|
2876
|
-
const subpaths =
|
|
2876
|
+
const subpaths = _chunk5YWWQ36Hcjs.bezierToSubpaths.call(void 0, path);
|
|
2877
2877
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2878
2878
|
return [{ op: "combine", subpaths }];
|
|
2879
2879
|
}
|
|
@@ -2890,7 +2890,7 @@ function annotationPaint(color, opacity) {
|
|
|
2890
2890
|
function shapeFromAnnotation(a) {
|
|
2891
2891
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2892
2892
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2893
|
-
const rotation = a.rotation ?
|
|
2893
|
+
const rotation = a.rotation ? _chunk5YWWQ36Hcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2894
2894
|
const t = rotation ? { transform: rotation } : {};
|
|
2895
2895
|
const live = (l) => liveComponent(l);
|
|
2896
2896
|
switch (a.type) {
|
|
@@ -2933,7 +2933,7 @@ function shapeFromAnnotation(a) {
|
|
|
2933
2933
|
case "pen": {
|
|
2934
2934
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2935
2935
|
if (!paint) return null;
|
|
2936
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2936
|
+
const pts = rotation ? a.points.map((p) => _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2937
2937
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2938
2938
|
return {
|
|
2939
2939
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2966,7 +2966,7 @@ var JOIN_SIGMA = 2;
|
|
|
2966
2966
|
function vectorMaskSegments(components) {
|
|
2967
2967
|
const out = [];
|
|
2968
2968
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2969
|
-
for (let k = 0; k <
|
|
2969
|
+
for (let k = 0; k < _chunk5YWWQ36Hcjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2970
2970
|
}));
|
|
2971
2971
|
return out;
|
|
2972
2972
|
}
|
|
@@ -2974,7 +2974,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2974
2974
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2975
2975
|
return edges.filter((e) => {
|
|
2976
2976
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2977
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2977
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunk5YWWQ36Hcjs.subpathSegmentCount.call(void 0, sp);
|
|
2978
2978
|
});
|
|
2979
2979
|
}
|
|
2980
2980
|
function reach(e) {
|
|
@@ -2997,8 +2997,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2997
2997
|
const seedClass = [];
|
|
2998
2998
|
vm.components.forEach(
|
|
2999
2999
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
3000
|
-
for (let k = 0; k <
|
|
3001
|
-
const seg =
|
|
3000
|
+
for (let k = 0; k < _chunk5YWWQ36Hcjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
3001
|
+
const seg = _chunk5YWWQ36Hcjs.subpathSegment.call(void 0, sp, k);
|
|
3002
3002
|
let len = 0;
|
|
3003
3003
|
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]);
|
|
3004
3004
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3898,7 +3898,7 @@ var fail3 = (message) => {
|
|
|
3898
3898
|
};
|
|
3899
3899
|
var TEXT_RENDER_MARGIN = _chunkDPYAO5U6cjs.MAX_EFFECT_REACH;
|
|
3900
3900
|
function textMatrix(layer) {
|
|
3901
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3901
|
+
return _nullishCoalesce(layer.transform, () => ( _chunk5YWWQ36Hcjs.IDENTITY_MATRIX));
|
|
3902
3902
|
}
|
|
3903
3903
|
function rectCorners(r) {
|
|
3904
3904
|
return [
|
|
@@ -3909,7 +3909,7 @@ function rectCorners(r) {
|
|
|
3909
3909
|
];
|
|
3910
3910
|
}
|
|
3911
3911
|
function docRect(r, m) {
|
|
3912
|
-
const pts = rectCorners(r).map((p) =>
|
|
3912
|
+
const pts = rectCorners(r).map((p) => _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, p));
|
|
3913
3913
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3914
3914
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3915
3915
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3929,7 +3929,7 @@ function inkBounds(layout) {
|
|
|
3929
3929
|
for (const f of l.fragments) {
|
|
3930
3930
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3931
3931
|
const w = f.carets[f.carets.length - 1];
|
|
3932
|
-
const r =
|
|
3932
|
+
const r = _chunk5YWWQ36Hcjs.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) });
|
|
3933
3933
|
if (!b) b = r;
|
|
3934
3934
|
else {
|
|
3935
3935
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3942,14 +3942,14 @@ function inkBounds(layout) {
|
|
|
3942
3942
|
}
|
|
3943
3943
|
function textOutlines(layer, shaper) {
|
|
3944
3944
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3945
|
-
const layout =
|
|
3945
|
+
const layout = _chunk5YWWQ36Hcjs.layoutText.call(void 0, layer, shaper);
|
|
3946
3946
|
const m = textMatrix(layer);
|
|
3947
3947
|
const out = [];
|
|
3948
3948
|
for (const l of layout.lines) {
|
|
3949
3949
|
for (const f of l.fragments) {
|
|
3950
|
-
let path =
|
|
3951
|
-
for (const r of
|
|
3952
|
-
out.push({ fragment: f, path:
|
|
3950
|
+
let path = _chunk5YWWQ36Hcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3951
|
+
for (const r of _chunk5YWWQ36Hcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunk5YWWQ36Hcjs.textRectPath.call(void 0, r)];
|
|
3952
|
+
out.push({ fragment: f, path: _chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3953
3953
|
}
|
|
3954
3954
|
}
|
|
3955
3955
|
return out;
|
|
@@ -4005,7 +4005,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4005
4005
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4006
4006
|
const ctx = canvas.getContext("2d");
|
|
4007
4007
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4008
|
-
const layout =
|
|
4008
|
+
const layout = _chunk5YWWQ36Hcjs.layoutText.call(void 0, layer, shaper);
|
|
4009
4009
|
const m = textMatrix(layer);
|
|
4010
4010
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4011
4011
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4015,8 +4015,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4015
4015
|
const [r, g, b] = rgbOf(f.style.color);
|
|
4016
4016
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
4017
4017
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4018
|
-
|
|
4019
|
-
for (const d of
|
|
4018
|
+
_chunk5YWWQ36Hcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
4019
|
+
for (const d of _chunk5YWWQ36Hcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4020
4020
|
}
|
|
4021
4021
|
}
|
|
4022
4022
|
ctx.globalAlpha = 1;
|
|
@@ -4027,7 +4027,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4027
4027
|
function renderText(layer, env) {
|
|
4028
4028
|
const shaper = env.shaper;
|
|
4029
4029
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4030
|
-
const layout =
|
|
4030
|
+
const layout = _chunk5YWWQ36Hcjs.layoutText.call(void 0, layer, shaper);
|
|
4031
4031
|
const ink = inkBounds(layout);
|
|
4032
4032
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4033
4033
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4128,7 +4128,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4128
4128
|
continue;
|
|
4129
4129
|
}
|
|
4130
4130
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4131
|
-
if (k === "autoLeading" && value ===
|
|
4131
|
+
if (k === "autoLeading" && value === _chunk5YWWQ36Hcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4132
4132
|
else o[k] = value;
|
|
4133
4133
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4134
4134
|
}
|
|
@@ -4169,15 +4169,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4169
4169
|
opacity: 1,
|
|
4170
4170
|
blend: "normal",
|
|
4171
4171
|
text: text3,
|
|
4172
|
-
runs:
|
|
4173
|
-
paragraphs:
|
|
4172
|
+
runs: _chunk5YWWQ36Hcjs.fitRuns.call(void 0, init.runs, text3.length, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE),
|
|
4173
|
+
paragraphs: _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4174
4174
|
frame: init.frame,
|
|
4175
4175
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
4176
4176
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
4177
4177
|
offset: { x: 0, y: 0 }
|
|
4178
4178
|
};
|
|
4179
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
4180
|
-
if (init.transform && !
|
|
4179
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE)) }];
|
|
4180
|
+
if (init.transform && !_chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4181
4181
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4182
4182
|
return rerenderText(layer, env);
|
|
4183
4183
|
}
|
|
@@ -4188,24 +4188,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4188
4188
|
const next = { ...current, ...patch };
|
|
4189
4189
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4190
4190
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
4191
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4192
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4193
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4191
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunk5YWWQ36Hcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE)));
|
|
4192
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunk5YWWQ36Hcjs.styleAt.call(void 0, current.runs, 0, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE) }];
|
|
4193
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4194
4194
|
const rendered = rerenderText(next, env);
|
|
4195
4195
|
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4196
4196
|
}
|
|
4197
4197
|
function replaceTextRange(layer, start, end, insert) {
|
|
4198
4198
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4199
|
-
const style =
|
|
4200
|
-
const runs =
|
|
4201
|
-
const pstyle =
|
|
4202
|
-
const paragraphs =
|
|
4203
|
-
return { text: text3, runs, paragraphs:
|
|
4199
|
+
const style = _chunk5YWWQ36Hcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE);
|
|
4200
|
+
const runs = _chunk5YWWQ36Hcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4201
|
+
const pstyle = _chunk5YWWQ36Hcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4202
|
+
const paragraphs = _chunk5YWWQ36Hcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4203
|
+
return { text: text3, runs, paragraphs: _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4204
4204
|
}
|
|
4205
4205
|
function transformTypeLayer(layer, m) {
|
|
4206
|
-
const t =
|
|
4206
|
+
const t = _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4207
4207
|
const next = { ...layer };
|
|
4208
|
-
if (
|
|
4208
|
+
if (_chunk5YWWQ36Hcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4209
4209
|
else next.transform = t;
|
|
4210
4210
|
delete next.annotation;
|
|
4211
4211
|
return next;
|
|
@@ -4213,7 +4213,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4213
4213
|
function typeFrame(layer, shaper) {
|
|
4214
4214
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4215
4215
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4216
|
-
const b =
|
|
4216
|
+
const b = _chunk5YWWQ36Hcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4217
4217
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4218
4218
|
}
|
|
4219
4219
|
function typeAsPixelLayer(layer) {
|
|
@@ -4221,7 +4221,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4221
4221
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4222
4222
|
}
|
|
4223
4223
|
function toTextSpace(layer, p) {
|
|
4224
|
-
return
|
|
4224
|
+
return _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, _chunk5YWWQ36Hcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4225
4225
|
}
|
|
4226
4226
|
function typeFromAnnotation(a) {
|
|
4227
4227
|
if (a.type !== "text") return null;
|
|
@@ -4235,7 +4235,7 @@ function typeFromAnnotation(a) {
|
|
|
4235
4235
|
if (op !== 1) style.opacity = op;
|
|
4236
4236
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4237
4237
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4238
|
-
const transform = t.rotation ?
|
|
4238
|
+
const transform = t.rotation ? _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, translate, _chunk5YWWQ36Hcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4239
4239
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4240
4240
|
}
|
|
4241
4241
|
function annotationOfType(layer) {
|
|
@@ -4569,7 +4569,7 @@ function identityTransform(box2) {
|
|
|
4569
4569
|
}
|
|
4570
4570
|
function cornersFromMatrix(box2, m) {
|
|
4571
4571
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4572
|
-
return [
|
|
4572
|
+
return [_chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[0]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[1]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[2]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4573
4573
|
}
|
|
4574
4574
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4575
4575
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4586,7 +4586,7 @@ function transformHomography(geometry) {
|
|
|
4586
4586
|
function hasWarp(geometry) {
|
|
4587
4587
|
const w = geometry.warp;
|
|
4588
4588
|
if (!w) return false;
|
|
4589
|
-
const id =
|
|
4589
|
+
const id = _chunk5YWWQ36Hcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4590
4590
|
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;
|
|
4591
4591
|
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);
|
|
4592
4592
|
}
|
|
@@ -4601,7 +4601,7 @@ function transformMap(geometry) {
|
|
|
4601
4601
|
const { box: box2 } = geometry;
|
|
4602
4602
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4603
4603
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4604
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4604
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunk5YWWQ36Hcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4605
4605
|
}
|
|
4606
4606
|
function transformedPoint(geometry, fx, fy) {
|
|
4607
4607
|
const f = transformMap(geometry);
|
|
@@ -4645,8 +4645,8 @@ function matrixFromParams(box2, params) {
|
|
|
4645
4645
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4646
4646
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4647
4647
|
const ref = referencePoint(box2, params.reference);
|
|
4648
|
-
const linear =
|
|
4649
|
-
return
|
|
4648
|
+
const linear = _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunk5YWWQ36Hcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4649
|
+
return _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, _chunk5YWWQ36Hcjs.matrixAbout.call(void 0, linear, ref), _chunk5YWWQ36Hcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4650
4650
|
}
|
|
4651
4651
|
function describeTransform(geometry, reference = "center") {
|
|
4652
4652
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4663,7 +4663,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4663
4663
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4664
4664
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4665
4665
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4666
|
-
const at =
|
|
4666
|
+
const at = _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, ref);
|
|
4667
4667
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4668
4668
|
return {
|
|
4669
4669
|
affine: true,
|
|
@@ -4681,24 +4681,24 @@ function applyParams(geometry, params) {
|
|
|
4681
4681
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4682
4682
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4683
4683
|
const c = geometry.corners;
|
|
4684
|
-
return [
|
|
4684
|
+
return [_chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, c[0]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, c[1]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, c[2]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4685
4685
|
}
|
|
4686
4686
|
function flipCorners(geometry, axis) {
|
|
4687
4687
|
const c = anchorPoint(geometry, "center");
|
|
4688
4688
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4689
4689
|
const q2 = geometry.corners;
|
|
4690
|
-
return [
|
|
4690
|
+
return [_chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[0]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[1]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[2]), _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4691
4691
|
}
|
|
4692
4692
|
function boxPointOf(geometry, p) {
|
|
4693
4693
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4694
|
-
if (m) return
|
|
4694
|
+
if (m) return _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, _chunk5YWWQ36Hcjs.invertMatrix.call(void 0, m), p);
|
|
4695
4695
|
return null;
|
|
4696
4696
|
}
|
|
4697
4697
|
function presetWarp(box2, preset) {
|
|
4698
|
-
return
|
|
4698
|
+
return _chunk5YWWQ36Hcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4699
4699
|
}
|
|
4700
4700
|
function isValidWarp(mesh) {
|
|
4701
|
-
return
|
|
4701
|
+
return _chunk5YWWQ36Hcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4702
4702
|
}
|
|
4703
4703
|
function geometryHomography(geometry) {
|
|
4704
4704
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4977,7 +4977,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4977
4977
|
}
|
|
4978
4978
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4979
4979
|
if (raw.warp) {
|
|
4980
|
-
if (!
|
|
4980
|
+
if (!_chunk5YWWQ36Hcjs.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.");
|
|
4981
4981
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4982
4982
|
}
|
|
4983
4983
|
if (raw.interpolation !== void 0) {
|
|
@@ -5081,7 +5081,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5081
5081
|
case "shape": {
|
|
5082
5082
|
const next = {
|
|
5083
5083
|
...layer,
|
|
5084
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5084
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunk5YWWQ36Hcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5085
5085
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5086
5086
|
mask: moveMask(layer.mask)
|
|
5087
5087
|
};
|
|
@@ -5090,7 +5090,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5090
5090
|
return next;
|
|
5091
5091
|
}
|
|
5092
5092
|
case "type": {
|
|
5093
|
-
const next = { ...transformTypeLayer(layer,
|
|
5093
|
+
const next = { ...transformTypeLayer(layer, _chunk5YWWQ36Hcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5094
5094
|
if (!next.mask) delete next.mask;
|
|
5095
5095
|
return next;
|
|
5096
5096
|
}
|
|
@@ -5276,7 +5276,7 @@ function refitPlacement(layer, contents) {
|
|
|
5276
5276
|
});
|
|
5277
5277
|
const out = { corners: pts };
|
|
5278
5278
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5279
|
-
if (layer.placement.warp) out.warp =
|
|
5279
|
+
if (layer.placement.warp) out.warp = _chunk5YWWQ36Hcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5280
5280
|
return out;
|
|
5281
5281
|
}
|
|
5282
5282
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5653,7 +5653,7 @@ function readType(r, base, ctx) {
|
|
|
5653
5653
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5654
5654
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5655
5655
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5656
|
-
style: patchTextStyle(
|
|
5656
|
+
style: patchTextStyle(_chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5657
5657
|
}));
|
|
5658
5658
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5659
5659
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5666,13 +5666,13 @@ function readType(r, base, ctx) {
|
|
|
5666
5666
|
...base,
|
|
5667
5667
|
type: "type",
|
|
5668
5668
|
text: text3,
|
|
5669
|
-
runs:
|
|
5670
|
-
paragraphs:
|
|
5669
|
+
runs: _chunk5YWWQ36Hcjs.fitRuns.call(void 0, runs, text3.length, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE),
|
|
5670
|
+
paragraphs: _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5671
5671
|
frame,
|
|
5672
5672
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5673
5673
|
offset: { x: 0, y: 0 }
|
|
5674
5674
|
};
|
|
5675
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5675
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5676
5676
|
if (m) layer.transform = m;
|
|
5677
5677
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5678
5678
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6142,7 +6142,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6142
6142
|
let placement;
|
|
6143
6143
|
try {
|
|
6144
6144
|
const raw = { corners: p.corners };
|
|
6145
|
-
if (p.warp &&
|
|
6145
|
+
if (p.warp && _chunk5YWWQ36Hcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6146
6146
|
if (_chunkDPYAO5U6cjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6147
6147
|
placement = normalizePlacement(raw, contents);
|
|
6148
6148
|
} catch (e) {
|
|
@@ -7313,7 +7313,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7313
7313
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7314
7314
|
const subpaths = [];
|
|
7315
7315
|
components.forEach((c, ci) => {
|
|
7316
|
-
|
|
7316
|
+
_chunk5YWWQ36Hcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7317
7317
|
if (!sp.anchors.length) return;
|
|
7318
7318
|
subpaths.push({
|
|
7319
7319
|
closed: sp.closed,
|
|
@@ -8139,7 +8139,7 @@ function merged(levels) {
|
|
|
8139
8139
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8140
8140
|
const n = (k) => eNum(eGet(d, k));
|
|
8141
8141
|
const flag = (k) => eBool(eGet(d, k));
|
|
8142
|
-
const s = { ...
|
|
8142
|
+
const s = { ..._chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE };
|
|
8143
8143
|
const fi = n("Font");
|
|
8144
8144
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8145
8145
|
if (ps) {
|
|
@@ -8224,7 +8224,7 @@ function typeFromTySh(data, notes) {
|
|
|
8224
8224
|
}
|
|
8225
8225
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8226
8226
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8227
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8227
|
+
let runs = [{ length: text3.length, style: { ..._chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE } }];
|
|
8228
8228
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8229
8229
|
let frame = { kind: "point" };
|
|
8230
8230
|
let transform = t.transform;
|
|
@@ -8280,14 +8280,14 @@ function typeFromTySh(data, notes) {
|
|
|
8280
8280
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8281
8281
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8282
8282
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8283
|
-
transform =
|
|
8283
|
+
transform = _chunk5YWWQ36Hcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8284
8284
|
}
|
|
8285
8285
|
}
|
|
8286
8286
|
}
|
|
8287
8287
|
return {
|
|
8288
8288
|
text: text3,
|
|
8289
|
-
runs:
|
|
8290
|
-
paragraphs:
|
|
8289
|
+
runs: _chunk5YWWQ36Hcjs.fitRuns.call(void 0, runs, text3.length, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE),
|
|
8290
|
+
paragraphs: _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8291
8291
|
frame,
|
|
8292
8292
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8293
8293
|
transform,
|
|
@@ -8363,7 +8363,7 @@ function buildEngineData(layer, template) {
|
|
|
8363
8363
|
fonts.push(ps);
|
|
8364
8364
|
return fonts.length - 1;
|
|
8365
8365
|
};
|
|
8366
|
-
const runs =
|
|
8366
|
+
const runs = _chunk5YWWQ36Hcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE);
|
|
8367
8367
|
const vertical = layer.orientation === "vertical";
|
|
8368
8368
|
const sruns = [];
|
|
8369
8369
|
const slens = [];
|
|
@@ -8372,10 +8372,10 @@ function buildEngineData(layer, template) {
|
|
|
8372
8372
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8373
8373
|
});
|
|
8374
8374
|
if (!runs.length) {
|
|
8375
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8375
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8376
8376
|
slens.push(E.int(1));
|
|
8377
8377
|
}
|
|
8378
|
-
const paras =
|
|
8378
|
+
const paras = _chunk5YWWQ36Hcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8379
8379
|
const pruns = [];
|
|
8380
8380
|
const plens = [];
|
|
8381
8381
|
paras.forEach((p, i) => {
|
|
@@ -8431,7 +8431,7 @@ function buildEngineData(layer, template) {
|
|
|
8431
8431
|
eSet(e, key, rd);
|
|
8432
8432
|
}
|
|
8433
8433
|
eSet(rd, "FontSet", fontSet);
|
|
8434
|
-
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]), () => (
|
|
8434
|
+
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]), () => ( _chunk5YWWQ36Hcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8435
8435
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8436
8436
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8437
8437
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8442,13 +8442,13 @@ function inkBounds2(layer) {
|
|
|
8442
8442
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8443
8443
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8444
8444
|
if (!b) return [0, 0, 0, 0];
|
|
8445
|
-
const inv =
|
|
8445
|
+
const inv = _chunk5YWWQ36Hcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8446
8446
|
const pts = [
|
|
8447
8447
|
{ x: b.x, y: b.y },
|
|
8448
8448
|
{ x: b.x + b.width, y: b.y },
|
|
8449
8449
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8450
8450
|
{ x: b.x, y: b.y + b.height }
|
|
8451
|
-
].map((p) =>
|
|
8451
|
+
].map((p) => _chunk5YWWQ36Hcjs.applyMatrix.call(void 0, inv, p));
|
|
8452
8452
|
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))];
|
|
8453
8453
|
}
|
|
8454
8454
|
function tyShForLayer(layer) {
|
|
@@ -8729,7 +8729,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8729
8729
|
var warpStyleOf = (name) => {
|
|
8730
8730
|
if (!name.startsWith("warp")) return null;
|
|
8731
8731
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8732
|
-
return
|
|
8732
|
+
return _chunk5YWWQ36Hcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8733
8733
|
};
|
|
8734
8734
|
function warpFromDescriptor(w, contents) {
|
|
8735
8735
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8759,7 +8759,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8759
8759
|
} else {
|
|
8760
8760
|
const style = warpStyleOf(styleName);
|
|
8761
8761
|
if (!style) return void 0;
|
|
8762
|
-
mesh =
|
|
8762
|
+
mesh = _chunk5YWWQ36Hcjs.warpPresetMesh.call(void 0,
|
|
8763
8763
|
{
|
|
8764
8764
|
style,
|
|
8765
8765
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8774,7 +8774,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8774
8774
|
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;
|
|
8775
8775
|
if (!same) {
|
|
8776
8776
|
const m = mesh;
|
|
8777
|
-
mesh =
|
|
8777
|
+
mesh = _chunk5YWWQ36Hcjs.fitWarpMesh.call(void 0, (s, t) => _chunk5YWWQ36Hcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8778
8778
|
}
|
|
8779
8779
|
return { mesh, frame };
|
|
8780
8780
|
}
|
|
@@ -10366,7 +10366,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10366
10366
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10367
10367
|
const kx = contents.width / size.width;
|
|
10368
10368
|
const ky = contents.height / size.height;
|
|
10369
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10369
|
+
if (placement.warp) placement = { ...placement, warp: _chunk5YWWQ36Hcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10370
10370
|
}
|
|
10371
10371
|
}
|
|
10372
10372
|
if (!contents || !placement) {
|