@pixerate/editor 0.236.0 → 0.238.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/README.md +1 -1
- package/dist/agent/index.cjs +40 -39
- package/dist/agent/index.js +9 -8
- package/dist/animation/index.cjs +7 -6
- package/dist/animation/index.js +6 -5
- package/dist/animation-editor/index.cjs +66 -65
- package/dist/animation-editor/index.js +9 -8
- package/dist/{brushstrokeRender-WDTKD54B.cjs → brushstrokeRender-MPOM7BFW.cjs} +7 -5
- package/dist/{brushstrokeRender-MAHOXL7K.js → brushstrokeRender-WB67GMUP.js} +4 -2
- package/dist/canvas/index.cjs +55 -54
- package/dist/canvas/index.js +10 -9
- package/dist/chart/index.cjs +159 -158
- package/dist/chart/index.js +9 -8
- package/dist/{chunk-L6Y7TSQ4.js → chunk-36ZTV7WO.js} +1 -1
- package/dist/{chunk-JVNGCS26.js → chunk-3E36VDMJ.js} +1 -1
- package/dist/{chunk-WRZ6C4TU.cjs → chunk-3R5P3DVY.cjs} +6 -6
- package/dist/{chunk-RUONPPMC.cjs → chunk-44BMJJVA.cjs} +8 -8
- package/dist/{chunk-YBAPT7NL.js → chunk-6ADHGQ73.js} +4 -2
- package/dist/chunk-7AHBW2CQ.cjs +200 -0
- package/dist/{chunk-EUIDTZNQ.cjs → chunk-7PT4RJL5.cjs} +113 -111
- package/dist/{chunk-CU6ANS5L.js → chunk-7YGBSFC6.js} +2 -2
- package/dist/{chunk-ATKKG76G.cjs → chunk-AD7GA3TL.cjs} +23 -23
- package/dist/{chunk-FSLKBQU7.js → chunk-AIS56JOO.js} +3 -3
- package/dist/{chunk-5VQXSS2S.cjs → chunk-BBUE3UJL.cjs} +86 -86
- package/dist/{chunk-7272D3K2.js → chunk-BP6KSGVD.js} +6 -4
- package/dist/{chunk-F6R67I3A.js → chunk-CXXXAZ7H.js} +1 -1
- package/dist/{chunk-5DQPDXOM.cjs → chunk-D2SGV525.cjs} +76 -76
- package/dist/chunk-F67XMVDI.js +200 -0
- package/dist/{chunk-PHYOZK3B.js → chunk-FQVVO5YA.js} +85 -8
- package/dist/{chunk-UXETV2NC.cjs → chunk-GA4EU4P3.cjs} +4 -4
- package/dist/{chunk-UFEDHACQ.js → chunk-GXAK6Q5J.js} +2 -2
- package/dist/{chunk-MHLU6GRJ.js → chunk-JEGJP4OW.js} +7 -196
- package/dist/{chunk-GOBOCZZI.js → chunk-LEQKZGQI.js} +1 -1
- package/dist/{chunk-M5GLQQWG.cjs → chunk-LJZRHVZV.cjs} +2 -2
- package/dist/{chunk-N76AMOKE.cjs → chunk-MOW3JMNG.cjs} +42 -42
- package/dist/{chunk-WKMUBATU.js → chunk-N4DFDI73.js} +1 -1
- package/dist/{chunk-GNZI3KYK.cjs → chunk-NKTNLJUJ.cjs} +49 -9
- package/dist/{chunk-TQOL6CF7.js → chunk-PJYG6FCF.js} +49 -9
- package/dist/{chunk-V3L7U63N.cjs → chunk-PP6BXVRL.cjs} +1 -1
- package/dist/{chunk-TFF2GTGN.cjs → chunk-PPFJHTW5.cjs} +24 -22
- package/dist/{chunk-6ZZKRH7R.js → chunk-QARCM66V.js} +3 -3
- package/dist/{chunk-5UEFBM2M.cjs → chunk-RD7RX52G.cjs} +18 -207
- package/dist/{chunk-CDP2AKMA.js → chunk-RV5DKZHU.js} +1 -1
- package/dist/{chunk-HUAISCUX.cjs → chunk-T7KQEMAE.cjs} +18 -18
- package/dist/{chunk-BQE3Y6ZO.cjs → chunk-THXFU3JB.cjs} +5 -5
- package/dist/{chunk-4ZC5QJE2.cjs → chunk-UTI5IITZ.cjs} +3 -3
- package/dist/{chunk-XSVUNSDJ.js → chunk-UUBO6RB5.js} +1 -1
- package/dist/{chunk-WPWHT4Z6.cjs → chunk-UZU6DIZA.cjs} +221 -144
- package/dist/{chunk-M2TPMYJE.js → chunk-V6DT2CDH.js} +1 -1
- package/dist/{chunk-WV5WTOC6.cjs → chunk-W7GRGGBH.cjs} +16 -16
- package/dist/{chunk-23E5GI2U.js → chunk-WGN7AUKB.js} +2 -2
- package/dist/{chunk-YMREOA67.js → chunk-XK4SST43.js} +2 -2
- package/dist/{chunk-SOSBOS5T.cjs → chunk-XWOLPNBW.cjs} +22 -22
- package/dist/{chunk-ILP77UD6.js → chunk-YGQVCQTG.js} +1 -1
- package/dist/{chunk-GXLZZVR5.cjs → chunk-ZXNO3ZOX.cjs} +37 -37
- package/dist/color/index.cjs +6 -4
- package/dist/color/index.js +9 -7
- package/dist/export/index.cjs +8 -7
- package/dist/export/index.js +7 -6
- package/dist/extensions/index.cjs +13 -10
- package/dist/extensions/index.js +12 -9
- package/dist/extensions/loading-node.d.cts +45 -1
- package/dist/extensions/loading-node.d.ts +45 -1
- package/dist/gradient/index.cjs +29 -28
- package/dist/gradient/index.js +4 -3
- package/dist/image-editor/index.cjs +778 -777
- package/dist/image-editor/index.js +9 -8
- package/dist/index.cjs +19 -16
- package/dist/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +31 -1
- package/dist/paint-editor/controller.d.ts +31 -1
- package/dist/paint-editor/index.cjs +403 -195
- package/dist/paint-editor/index.js +231 -23
- package/dist/paint-editor/sticker-tools.d.cts +1 -1
- package/dist/paint-editor/sticker-tools.d.ts +1 -1
- package/dist/paint-editor/stickers.d.cts +10 -3
- package/dist/paint-editor/stickers.d.ts +10 -3
- package/dist/paint-editor/ui.d.cts +10 -3
- package/dist/paint-editor/ui.d.ts +10 -3
- package/dist/tokens/index.cjs +4 -3
- package/dist/tokens/index.js +3 -2
- package/dist/typography/index.cjs +8 -7
- package/dist/typography/index.js +3 -2
- package/dist/vector/index.cjs +967 -966
- package/dist/vector/index.js +9 -8
- package/dist/video-editor/index.cjs +7 -6
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/skills/pixerate-color/SKILL.md +3 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +6 -2
|
@@ -104,7 +104,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
var
|
|
107
|
+
var _chunkTHXFU3JBcjs = require('./chunk-THXFU3JB.cjs');
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
@@ -2323,7 +2323,7 @@ function mapAnchor(a, f) {
|
|
|
2323
2323
|
return out;
|
|
2324
2324
|
}
|
|
2325
2325
|
function mapSubpaths(subpaths, f) {
|
|
2326
|
-
return
|
|
2326
|
+
return _chunkTHXFU3JBcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2327
2327
|
}
|
|
2328
2328
|
function liveShapeSubpaths(live) {
|
|
2329
2329
|
let out;
|
|
@@ -2331,19 +2331,19 @@ function liveShapeSubpaths(live) {
|
|
|
2331
2331
|
case "rect": {
|
|
2332
2332
|
const x = Math.min(live.x, live.x + live.width);
|
|
2333
2333
|
const y = Math.min(live.y, live.y + live.height);
|
|
2334
|
-
const sp =
|
|
2334
|
+
const sp = _chunkTHXFU3JBcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2335
2335
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2336
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2336
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkTHXFU3JBcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2337
2337
|
break;
|
|
2338
2338
|
}
|
|
2339
2339
|
case "ellipse":
|
|
2340
|
-
out = [
|
|
2340
|
+
out = [_chunkTHXFU3JBcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2341
2341
|
break;
|
|
2342
2342
|
case "polygon":
|
|
2343
|
-
out = [
|
|
2343
|
+
out = [_chunkTHXFU3JBcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2344
2344
|
break;
|
|
2345
2345
|
case "star":
|
|
2346
|
-
out = [
|
|
2346
|
+
out = [_chunkTHXFU3JBcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2347
2347
|
break;
|
|
2348
2348
|
case "line": {
|
|
2349
2349
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2366,7 +2366,7 @@ function liveShapeSubpaths(live) {
|
|
|
2366
2366
|
}
|
|
2367
2367
|
}
|
|
2368
2368
|
const m = live.transform;
|
|
2369
|
-
return m && !
|
|
2369
|
+
return m && !_chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2370
2370
|
}
|
|
2371
2371
|
function normBox(b) {
|
|
2372
2372
|
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) };
|
|
@@ -2378,7 +2378,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2378
2378
|
function componentPath(c) {
|
|
2379
2379
|
let p = pathCache.get(c.subpaths);
|
|
2380
2380
|
if (!p) {
|
|
2381
|
-
p =
|
|
2381
|
+
p = _chunkTHXFU3JBcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2382
2382
|
pathCache.set(c.subpaths, p);
|
|
2383
2383
|
}
|
|
2384
2384
|
return p;
|
|
@@ -2705,7 +2705,7 @@ function matrixArg(v, path) {
|
|
|
2705
2705
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2706
2706
|
const m = v;
|
|
2707
2707
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2708
|
-
return
|
|
2708
|
+
return _chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2709
2709
|
}
|
|
2710
2710
|
function normalizeLiveShape(v, path = "shape") {
|
|
2711
2711
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2766,7 +2766,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2766
2766
|
if (typeof v === "string") {
|
|
2767
2767
|
let subs;
|
|
2768
2768
|
try {
|
|
2769
|
-
subs =
|
|
2769
|
+
subs = _chunkTHXFU3JBcjs.bezierToSubpaths.call(void 0, v);
|
|
2770
2770
|
} catch (e5) {
|
|
2771
2771
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2772
2772
|
}
|
|
@@ -2852,15 +2852,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2852
2852
|
function transformShapeComponents(components, f, affine) {
|
|
2853
2853
|
return components.map((c) => {
|
|
2854
2854
|
if (affine && c.live) {
|
|
2855
|
-
const live = { ...c.live, transform:
|
|
2856
|
-
if (
|
|
2855
|
+
const live = { ...c.live, transform: _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkTHXFU3JBcjs.IDENTITY_MATRIX)), affine) };
|
|
2856
|
+
if (_chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2857
2857
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2858
2858
|
}
|
|
2859
2859
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2860
2860
|
});
|
|
2861
2861
|
}
|
|
2862
2862
|
function offsetShape(layer, dx, dy, env) {
|
|
2863
|
-
const m =
|
|
2863
|
+
const m = _chunkTHXFU3JBcjs.translateMatrix.call(void 0, dx, dy);
|
|
2864
2864
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2865
2865
|
delete next.annotation;
|
|
2866
2866
|
return rerenderShape(next, env);
|
|
@@ -2868,7 +2868,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2868
2868
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2869
2869
|
if (components.length < 2) return [...components];
|
|
2870
2870
|
const path = shapeOutline(components, fillRule);
|
|
2871
|
-
const subpaths =
|
|
2871
|
+
const subpaths = _chunkTHXFU3JBcjs.bezierToSubpaths.call(void 0, path);
|
|
2872
2872
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2873
2873
|
return [{ op: "combine", subpaths }];
|
|
2874
2874
|
}
|
|
@@ -2885,7 +2885,7 @@ function annotationPaint(color, opacity) {
|
|
|
2885
2885
|
function shapeFromAnnotation(a) {
|
|
2886
2886
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2887
2887
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2888
|
-
const rotation = a.rotation ?
|
|
2888
|
+
const rotation = a.rotation ? _chunkTHXFU3JBcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2889
2889
|
const t = rotation ? { transform: rotation } : {};
|
|
2890
2890
|
const live = (l) => liveComponent(l);
|
|
2891
2891
|
switch (a.type) {
|
|
@@ -2928,7 +2928,7 @@ function shapeFromAnnotation(a) {
|
|
|
2928
2928
|
case "pen": {
|
|
2929
2929
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2930
2930
|
if (!paint) return null;
|
|
2931
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2931
|
+
const pts = rotation ? a.points.map((p) => _chunkTHXFU3JBcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2932
2932
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2933
2933
|
return {
|
|
2934
2934
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2961,7 +2961,7 @@ var JOIN_SIGMA = 2;
|
|
|
2961
2961
|
function vectorMaskSegments(components) {
|
|
2962
2962
|
const out = [];
|
|
2963
2963
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2964
|
-
for (let k = 0; k <
|
|
2964
|
+
for (let k = 0; k < _chunkTHXFU3JBcjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2965
2965
|
}));
|
|
2966
2966
|
return out;
|
|
2967
2967
|
}
|
|
@@ -2969,7 +2969,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2969
2969
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2970
2970
|
return edges.filter((e) => {
|
|
2971
2971
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2972
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2972
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkTHXFU3JBcjs.subpathSegmentCount.call(void 0, sp);
|
|
2973
2973
|
});
|
|
2974
2974
|
}
|
|
2975
2975
|
function reach(e) {
|
|
@@ -2992,8 +2992,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2992
2992
|
const seedClass = [];
|
|
2993
2993
|
vm.components.forEach(
|
|
2994
2994
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2995
|
-
for (let k = 0; k <
|
|
2996
|
-
const seg =
|
|
2995
|
+
for (let k = 0; k < _chunkTHXFU3JBcjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
2996
|
+
const seg = _chunkTHXFU3JBcjs.subpathSegment.call(void 0, sp, k);
|
|
2997
2997
|
let len = 0;
|
|
2998
2998
|
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]);
|
|
2999
2999
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3893,7 +3893,7 @@ var fail3 = (message) => {
|
|
|
3893
3893
|
};
|
|
3894
3894
|
var TEXT_RENDER_MARGIN = _chunkHB4ICNNAcjs.MAX_EFFECT_REACH;
|
|
3895
3895
|
function textMatrix(layer) {
|
|
3896
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3896
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkTHXFU3JBcjs.IDENTITY_MATRIX));
|
|
3897
3897
|
}
|
|
3898
3898
|
function rectCorners(r) {
|
|
3899
3899
|
return [
|
|
@@ -3904,7 +3904,7 @@ function rectCorners(r) {
|
|
|
3904
3904
|
];
|
|
3905
3905
|
}
|
|
3906
3906
|
function docRect(r, m) {
|
|
3907
|
-
const pts = rectCorners(r).map((p) =>
|
|
3907
|
+
const pts = rectCorners(r).map((p) => _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, p));
|
|
3908
3908
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3909
3909
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3910
3910
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3924,7 +3924,7 @@ function inkBounds(layout) {
|
|
|
3924
3924
|
for (const f of l.fragments) {
|
|
3925
3925
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3926
3926
|
const w = f.carets[f.carets.length - 1];
|
|
3927
|
-
const r =
|
|
3927
|
+
const r = _chunkTHXFU3JBcjs.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) });
|
|
3928
3928
|
if (!b) b = r;
|
|
3929
3929
|
else {
|
|
3930
3930
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3937,14 +3937,14 @@ function inkBounds(layout) {
|
|
|
3937
3937
|
}
|
|
3938
3938
|
function textOutlines(layer, shaper) {
|
|
3939
3939
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3940
|
-
const layout =
|
|
3940
|
+
const layout = _chunkTHXFU3JBcjs.layoutText.call(void 0, layer, shaper);
|
|
3941
3941
|
const m = textMatrix(layer);
|
|
3942
3942
|
const out = [];
|
|
3943
3943
|
for (const l of layout.lines) {
|
|
3944
3944
|
for (const f of l.fragments) {
|
|
3945
|
-
let path =
|
|
3946
|
-
for (const r of
|
|
3947
|
-
out.push({ fragment: f, path:
|
|
3945
|
+
let path = _chunkTHXFU3JBcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3946
|
+
for (const r of _chunkTHXFU3JBcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkTHXFU3JBcjs.textRectPath.call(void 0, r)];
|
|
3947
|
+
out.push({ fragment: f, path: _chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3948
3948
|
}
|
|
3949
3949
|
}
|
|
3950
3950
|
return out;
|
|
@@ -4000,7 +4000,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4000
4000
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4001
4001
|
const ctx = canvas.getContext("2d");
|
|
4002
4002
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4003
|
-
const layout =
|
|
4003
|
+
const layout = _chunkTHXFU3JBcjs.layoutText.call(void 0, layer, shaper);
|
|
4004
4004
|
const m = textMatrix(layer);
|
|
4005
4005
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4006
4006
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4010,8 +4010,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4010
4010
|
const [r, g, b] = rgbOf(f.style.color);
|
|
4011
4011
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
4012
4012
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4013
|
-
|
|
4014
|
-
for (const d of
|
|
4013
|
+
_chunkTHXFU3JBcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
4014
|
+
for (const d of _chunkTHXFU3JBcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4015
4015
|
}
|
|
4016
4016
|
}
|
|
4017
4017
|
ctx.globalAlpha = 1;
|
|
@@ -4022,7 +4022,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4022
4022
|
function renderText(layer, env) {
|
|
4023
4023
|
const shaper = env.shaper;
|
|
4024
4024
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4025
|
-
const layout =
|
|
4025
|
+
const layout = _chunkTHXFU3JBcjs.layoutText.call(void 0, layer, shaper);
|
|
4026
4026
|
const ink = inkBounds(layout);
|
|
4027
4027
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4028
4028
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4123,7 +4123,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4123
4123
|
continue;
|
|
4124
4124
|
}
|
|
4125
4125
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4126
|
-
if (k === "autoLeading" && value ===
|
|
4126
|
+
if (k === "autoLeading" && value === _chunkTHXFU3JBcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4127
4127
|
else o[k] = value;
|
|
4128
4128
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4129
4129
|
}
|
|
@@ -4164,15 +4164,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4164
4164
|
opacity: 1,
|
|
4165
4165
|
blend: "normal",
|
|
4166
4166
|
text: text3,
|
|
4167
|
-
runs:
|
|
4168
|
-
paragraphs:
|
|
4167
|
+
runs: _chunkTHXFU3JBcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE),
|
|
4168
|
+
paragraphs: _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4169
4169
|
frame: init.frame,
|
|
4170
4170
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
4171
4171
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
4172
4172
|
offset: { x: 0, y: 0 }
|
|
4173
4173
|
};
|
|
4174
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
4175
|
-
if (init.transform && !
|
|
4174
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE)) }];
|
|
4175
|
+
if (init.transform && !_chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4176
4176
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4177
4177
|
return rerenderText(layer, env);
|
|
4178
4178
|
}
|
|
@@ -4183,24 +4183,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4183
4183
|
const next = { ...current, ...patch };
|
|
4184
4184
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4185
4185
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
4186
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4187
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4188
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4186
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkTHXFU3JBcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE)));
|
|
4187
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkTHXFU3JBcjs.styleAt.call(void 0, current.runs, 0, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE) }];
|
|
4188
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4189
4189
|
const rendered = rerenderText(next, env);
|
|
4190
4190
|
return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4191
4191
|
}
|
|
4192
4192
|
function replaceTextRange(layer, start, end, insert) {
|
|
4193
4193
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4194
|
-
const style =
|
|
4195
|
-
const runs =
|
|
4196
|
-
const pstyle =
|
|
4197
|
-
const paragraphs =
|
|
4198
|
-
return { text: text3, runs, paragraphs:
|
|
4194
|
+
const style = _chunkTHXFU3JBcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE);
|
|
4195
|
+
const runs = _chunkTHXFU3JBcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4196
|
+
const pstyle = _chunkTHXFU3JBcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4197
|
+
const paragraphs = _chunkTHXFU3JBcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4198
|
+
return { text: text3, runs, paragraphs: _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4199
4199
|
}
|
|
4200
4200
|
function transformTypeLayer(layer, m) {
|
|
4201
|
-
const t =
|
|
4201
|
+
const t = _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4202
4202
|
const next = { ...layer };
|
|
4203
|
-
if (
|
|
4203
|
+
if (_chunkTHXFU3JBcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4204
4204
|
else next.transform = t;
|
|
4205
4205
|
delete next.annotation;
|
|
4206
4206
|
return next;
|
|
@@ -4208,7 +4208,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4208
4208
|
function typeFrame(layer, shaper) {
|
|
4209
4209
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4210
4210
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4211
|
-
const b =
|
|
4211
|
+
const b = _chunkTHXFU3JBcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4212
4212
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4213
4213
|
}
|
|
4214
4214
|
function typeAsPixelLayer(layer) {
|
|
@@ -4216,7 +4216,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4216
4216
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4217
4217
|
}
|
|
4218
4218
|
function toTextSpace(layer, p) {
|
|
4219
|
-
return
|
|
4219
|
+
return _chunkTHXFU3JBcjs.applyMatrix.call(void 0, _chunkTHXFU3JBcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4220
4220
|
}
|
|
4221
4221
|
function typeFromAnnotation(a) {
|
|
4222
4222
|
if (a.type !== "text") return null;
|
|
@@ -4230,7 +4230,7 @@ function typeFromAnnotation(a) {
|
|
|
4230
4230
|
if (op !== 1) style.opacity = op;
|
|
4231
4231
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4232
4232
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4233
|
-
const transform = t.rotation ?
|
|
4233
|
+
const transform = t.rotation ? _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, translate, _chunkTHXFU3JBcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4234
4234
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4235
4235
|
}
|
|
4236
4236
|
function annotationOfType(layer) {
|
|
@@ -4564,7 +4564,7 @@ function identityTransform(box2) {
|
|
|
4564
4564
|
}
|
|
4565
4565
|
function cornersFromMatrix(box2, m) {
|
|
4566
4566
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4567
|
-
return [
|
|
4567
|
+
return [_chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[0]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[1]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[2]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4568
4568
|
}
|
|
4569
4569
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4570
4570
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4581,7 +4581,7 @@ function transformHomography(geometry) {
|
|
|
4581
4581
|
function hasWarp(geometry) {
|
|
4582
4582
|
const w = geometry.warp;
|
|
4583
4583
|
if (!w) return false;
|
|
4584
|
-
const id =
|
|
4584
|
+
const id = _chunkTHXFU3JBcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4585
4585
|
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;
|
|
4586
4586
|
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);
|
|
4587
4587
|
}
|
|
@@ -4596,7 +4596,7 @@ function transformMap(geometry) {
|
|
|
4596
4596
|
const { box: box2 } = geometry;
|
|
4597
4597
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4598
4598
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4599
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4599
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkTHXFU3JBcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4600
4600
|
}
|
|
4601
4601
|
function transformedPoint(geometry, fx, fy) {
|
|
4602
4602
|
const f = transformMap(geometry);
|
|
@@ -4640,8 +4640,8 @@ function matrixFromParams(box2, params) {
|
|
|
4640
4640
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4641
4641
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4642
4642
|
const ref = referencePoint(box2, params.reference);
|
|
4643
|
-
const linear =
|
|
4644
|
-
return
|
|
4643
|
+
const linear = _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkTHXFU3JBcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4644
|
+
return _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, _chunkTHXFU3JBcjs.matrixAbout.call(void 0, linear, ref), _chunkTHXFU3JBcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4645
4645
|
}
|
|
4646
4646
|
function describeTransform(geometry, reference = "center") {
|
|
4647
4647
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4658,7 +4658,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4658
4658
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4659
4659
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4660
4660
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4661
|
-
const at =
|
|
4661
|
+
const at = _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, ref);
|
|
4662
4662
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4663
4663
|
return {
|
|
4664
4664
|
affine: true,
|
|
@@ -4676,24 +4676,24 @@ function applyParams(geometry, params) {
|
|
|
4676
4676
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4677
4677
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4678
4678
|
const c = geometry.corners;
|
|
4679
|
-
return [
|
|
4679
|
+
return [_chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, c[0]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, c[1]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, c[2]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4680
4680
|
}
|
|
4681
4681
|
function flipCorners(geometry, axis) {
|
|
4682
4682
|
const c = anchorPoint(geometry, "center");
|
|
4683
4683
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4684
4684
|
const q2 = geometry.corners;
|
|
4685
|
-
return [
|
|
4685
|
+
return [_chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[0]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[1]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[2]), _chunkTHXFU3JBcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4686
4686
|
}
|
|
4687
4687
|
function boxPointOf(geometry, p) {
|
|
4688
4688
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4689
|
-
if (m) return
|
|
4689
|
+
if (m) return _chunkTHXFU3JBcjs.applyMatrix.call(void 0, _chunkTHXFU3JBcjs.invertMatrix.call(void 0, m), p);
|
|
4690
4690
|
return null;
|
|
4691
4691
|
}
|
|
4692
4692
|
function presetWarp(box2, preset) {
|
|
4693
|
-
return
|
|
4693
|
+
return _chunkTHXFU3JBcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4694
4694
|
}
|
|
4695
4695
|
function isValidWarp(mesh) {
|
|
4696
|
-
return
|
|
4696
|
+
return _chunkTHXFU3JBcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4697
4697
|
}
|
|
4698
4698
|
function geometryHomography(geometry) {
|
|
4699
4699
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4972,7 +4972,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4972
4972
|
}
|
|
4973
4973
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4974
4974
|
if (raw.warp) {
|
|
4975
|
-
if (!
|
|
4975
|
+
if (!_chunkTHXFU3JBcjs.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.");
|
|
4976
4976
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4977
4977
|
}
|
|
4978
4978
|
if (raw.interpolation !== void 0) {
|
|
@@ -5076,7 +5076,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5076
5076
|
case "shape": {
|
|
5077
5077
|
const next = {
|
|
5078
5078
|
...layer,
|
|
5079
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5079
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkTHXFU3JBcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5080
5080
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5081
5081
|
mask: moveMask(layer.mask)
|
|
5082
5082
|
};
|
|
@@ -5085,7 +5085,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5085
5085
|
return next;
|
|
5086
5086
|
}
|
|
5087
5087
|
case "type": {
|
|
5088
|
-
const next = { ...transformTypeLayer(layer,
|
|
5088
|
+
const next = { ...transformTypeLayer(layer, _chunkTHXFU3JBcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5089
5089
|
if (!next.mask) delete next.mask;
|
|
5090
5090
|
return next;
|
|
5091
5091
|
}
|
|
@@ -5271,7 +5271,7 @@ function refitPlacement(layer, contents) {
|
|
|
5271
5271
|
});
|
|
5272
5272
|
const out = { corners: pts };
|
|
5273
5273
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5274
|
-
if (layer.placement.warp) out.warp =
|
|
5274
|
+
if (layer.placement.warp) out.warp = _chunkTHXFU3JBcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5275
5275
|
return out;
|
|
5276
5276
|
}
|
|
5277
5277
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5648,7 +5648,7 @@ function readType(r, base, ctx) {
|
|
|
5648
5648
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5649
5649
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5650
5650
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5651
|
-
style: patchTextStyle(
|
|
5651
|
+
style: patchTextStyle(_chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5652
5652
|
}));
|
|
5653
5653
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5654
5654
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5661,13 +5661,13 @@ function readType(r, base, ctx) {
|
|
|
5661
5661
|
...base,
|
|
5662
5662
|
type: "type",
|
|
5663
5663
|
text: text3,
|
|
5664
|
-
runs:
|
|
5665
|
-
paragraphs:
|
|
5664
|
+
runs: _chunkTHXFU3JBcjs.fitRuns.call(void 0, runs, text3.length, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE),
|
|
5665
|
+
paragraphs: _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5666
5666
|
frame,
|
|
5667
5667
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5668
5668
|
offset: { x: 0, y: 0 }
|
|
5669
5669
|
};
|
|
5670
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5670
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5671
5671
|
if (m) layer.transform = m;
|
|
5672
5672
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5673
5673
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -6137,7 +6137,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6137
6137
|
let placement;
|
|
6138
6138
|
try {
|
|
6139
6139
|
const raw = { corners: p.corners };
|
|
6140
|
-
if (p.warp &&
|
|
6140
|
+
if (p.warp && _chunkTHXFU3JBcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6141
6141
|
if (_chunkHB4ICNNAcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6142
6142
|
placement = normalizePlacement(raw, contents);
|
|
6143
6143
|
} catch (e) {
|
|
@@ -7308,7 +7308,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7308
7308
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7309
7309
|
const subpaths = [];
|
|
7310
7310
|
components.forEach((c, ci) => {
|
|
7311
|
-
|
|
7311
|
+
_chunkTHXFU3JBcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7312
7312
|
if (!sp.anchors.length) return;
|
|
7313
7313
|
subpaths.push({
|
|
7314
7314
|
closed: sp.closed,
|
|
@@ -8134,7 +8134,7 @@ function merged(levels) {
|
|
|
8134
8134
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8135
8135
|
const n = (k) => eNum(eGet(d, k));
|
|
8136
8136
|
const flag = (k) => eBool(eGet(d, k));
|
|
8137
|
-
const s = { ...
|
|
8137
|
+
const s = { ..._chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE };
|
|
8138
8138
|
const fi = n("Font");
|
|
8139
8139
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8140
8140
|
if (ps) {
|
|
@@ -8219,7 +8219,7 @@ function typeFromTySh(data, notes) {
|
|
|
8219
8219
|
}
|
|
8220
8220
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8221
8221
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8222
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8222
|
+
let runs = [{ length: text3.length, style: { ..._chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE } }];
|
|
8223
8223
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8224
8224
|
let frame = { kind: "point" };
|
|
8225
8225
|
let transform = t.transform;
|
|
@@ -8275,14 +8275,14 @@ function typeFromTySh(data, notes) {
|
|
|
8275
8275
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8276
8276
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8277
8277
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8278
|
-
transform =
|
|
8278
|
+
transform = _chunkTHXFU3JBcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8279
8279
|
}
|
|
8280
8280
|
}
|
|
8281
8281
|
}
|
|
8282
8282
|
return {
|
|
8283
8283
|
text: text3,
|
|
8284
|
-
runs:
|
|
8285
|
-
paragraphs:
|
|
8284
|
+
runs: _chunkTHXFU3JBcjs.fitRuns.call(void 0, runs, text3.length, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE),
|
|
8285
|
+
paragraphs: _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8286
8286
|
frame,
|
|
8287
8287
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8288
8288
|
transform,
|
|
@@ -8358,7 +8358,7 @@ function buildEngineData(layer, template) {
|
|
|
8358
8358
|
fonts.push(ps);
|
|
8359
8359
|
return fonts.length - 1;
|
|
8360
8360
|
};
|
|
8361
|
-
const runs =
|
|
8361
|
+
const runs = _chunkTHXFU3JBcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE);
|
|
8362
8362
|
const vertical = layer.orientation === "vertical";
|
|
8363
8363
|
const sruns = [];
|
|
8364
8364
|
const slens = [];
|
|
@@ -8367,10 +8367,10 @@ function buildEngineData(layer, template) {
|
|
|
8367
8367
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8368
8368
|
});
|
|
8369
8369
|
if (!runs.length) {
|
|
8370
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8370
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8371
8371
|
slens.push(E.int(1));
|
|
8372
8372
|
}
|
|
8373
|
-
const paras =
|
|
8373
|
+
const paras = _chunkTHXFU3JBcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8374
8374
|
const pruns = [];
|
|
8375
8375
|
const plens = [];
|
|
8376
8376
|
paras.forEach((p, i) => {
|
|
@@ -8426,7 +8426,7 @@ function buildEngineData(layer, template) {
|
|
|
8426
8426
|
eSet(e, key, rd);
|
|
8427
8427
|
}
|
|
8428
8428
|
eSet(rd, "FontSet", fontSet);
|
|
8429
|
-
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]), () => (
|
|
8429
|
+
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]), () => ( _chunkTHXFU3JBcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8430
8430
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8431
8431
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8432
8432
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8437,13 +8437,13 @@ function inkBounds2(layer) {
|
|
|
8437
8437
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8438
8438
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8439
8439
|
if (!b) return [0, 0, 0, 0];
|
|
8440
|
-
const inv =
|
|
8440
|
+
const inv = _chunkTHXFU3JBcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8441
8441
|
const pts = [
|
|
8442
8442
|
{ x: b.x, y: b.y },
|
|
8443
8443
|
{ x: b.x + b.width, y: b.y },
|
|
8444
8444
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8445
8445
|
{ x: b.x, y: b.y + b.height }
|
|
8446
|
-
].map((p) =>
|
|
8446
|
+
].map((p) => _chunkTHXFU3JBcjs.applyMatrix.call(void 0, inv, p));
|
|
8447
8447
|
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))];
|
|
8448
8448
|
}
|
|
8449
8449
|
function tyShForLayer(layer) {
|
|
@@ -8724,7 +8724,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8724
8724
|
var warpStyleOf = (name) => {
|
|
8725
8725
|
if (!name.startsWith("warp")) return null;
|
|
8726
8726
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8727
|
-
return
|
|
8727
|
+
return _chunkTHXFU3JBcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8728
8728
|
};
|
|
8729
8729
|
function warpFromDescriptor(w, contents) {
|
|
8730
8730
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8754,7 +8754,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8754
8754
|
} else {
|
|
8755
8755
|
const style = warpStyleOf(styleName);
|
|
8756
8756
|
if (!style) return void 0;
|
|
8757
|
-
mesh =
|
|
8757
|
+
mesh = _chunkTHXFU3JBcjs.warpPresetMesh.call(void 0,
|
|
8758
8758
|
{
|
|
8759
8759
|
style,
|
|
8760
8760
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8769,7 +8769,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8769
8769
|
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;
|
|
8770
8770
|
if (!same) {
|
|
8771
8771
|
const m = mesh;
|
|
8772
|
-
mesh =
|
|
8772
|
+
mesh = _chunkTHXFU3JBcjs.fitWarpMesh.call(void 0, (s, t) => _chunkTHXFU3JBcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8773
8773
|
}
|
|
8774
8774
|
return { mesh, frame };
|
|
8775
8775
|
}
|
|
@@ -10361,7 +10361,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10361
10361
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10362
10362
|
const kx = contents.width / size.width;
|
|
10363
10363
|
const ky = contents.height / size.height;
|
|
10364
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10364
|
+
if (placement.warp) placement = { ...placement, warp: _chunkTHXFU3JBcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10365
10365
|
}
|
|
10366
10366
|
}
|
|
10367
10367
|
if (!contents || !placement) {
|
|
@@ -6,23 +6,25 @@ import {
|
|
|
6
6
|
normalizeColor,
|
|
7
7
|
suggestAccessibleForeground,
|
|
8
8
|
toSrgbGamut
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6ADHGQ73.js";
|
|
10
10
|
import {
|
|
11
11
|
contrastLevel,
|
|
12
12
|
contrastRatio,
|
|
13
|
+
parseColor,
|
|
14
|
+
relativeLuminance
|
|
15
|
+
} from "./chunk-JEGJP4OW.js";
|
|
16
|
+
import {
|
|
13
17
|
hslToRgb,
|
|
14
18
|
hsvToRgb,
|
|
15
19
|
linearToSrgb,
|
|
16
20
|
oklabToOklch,
|
|
17
21
|
oklabToRgb,
|
|
18
22
|
oklchToOklab,
|
|
19
|
-
parseColor,
|
|
20
|
-
relativeLuminance,
|
|
21
23
|
rgbToHsl,
|
|
22
24
|
rgbToHsv,
|
|
23
25
|
rgbToOklab,
|
|
24
26
|
srgbToLinear
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-F67XMVDI.js";
|
|
26
28
|
|
|
27
29
|
// src/color/vision.ts
|
|
28
30
|
var CVD = {
|