@pixerate/editor 0.163.0 → 0.165.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 +54 -39
- package/dist/agent/index.js +24 -9
- package/dist/animation/index.cjs +6 -5
- package/dist/animation/index.js +5 -4
- package/dist/animation-editor/index.cjs +65 -64
- package/dist/animation-editor/index.js +8 -7
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/canvas/displacement.d.cts +34 -2
- package/dist/canvas/displacement.d.ts +34 -2
- package/dist/canvas/explosion-tools.d.cts +43 -0
- package/dist/canvas/explosion-tools.d.ts +43 -0
- package/dist/canvas/explosionLayout.d.cts +50 -0
- package/dist/canvas/explosionLayout.d.ts +50 -0
- package/dist/canvas/explosionState.d.cts +52 -0
- package/dist/canvas/explosionState.d.ts +52 -0
- package/dist/canvas/index.cjs +512 -168
- package/dist/canvas/index.d.cts +3 -0
- package/dist/canvas/index.d.ts +3 -0
- package/dist/canvas/index.js +434 -90
- package/dist/canvas/types.d.cts +27 -2
- package/dist/canvas/types.d.ts +27 -2
- package/dist/chart/controller.d.cts +31 -2
- package/dist/chart/controller.d.ts +31 -2
- package/dist/chart/index.cjs +504 -132
- package/dist/chart/index.d.cts +2 -0
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.js +386 -14
- package/dist/chart/layout-families.d.cts +7 -0
- package/dist/chart/layout-families.d.ts +7 -0
- package/dist/chart/links.d.cts +34 -0
- package/dist/chart/links.d.ts +34 -0
- package/dist/chart/mermaid.d.cts +9 -6
- package/dist/chart/mermaid.d.ts +9 -6
- package/dist/chart/schemas.d.cts +3 -0
- package/dist/chart/schemas.d.ts +3 -0
- package/dist/chart/spec.d.cts +3 -2
- package/dist/chart/spec.d.ts +3 -2
- package/dist/chart/style.d.cts +33 -0
- package/dist/chart/style.d.ts +33 -0
- package/dist/chart/types.d.cts +24 -2
- package/dist/chart/types.d.ts +24 -2
- package/dist/{chunk-TALQONZ5.js → chunk-2J5VLJHC.js} +3 -3
- package/dist/{chunk-3NEZJCBY.js → chunk-2ZRN43IN.js} +340 -201
- package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
- package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
- package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
- package/dist/{chunk-YSAGBIRW.cjs → chunk-64VWWR5U.cjs} +16 -16
- package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
- package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
- package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
- package/dist/{chunk-POR54B55.js → chunk-CRFSQWKQ.js} +4 -1
- package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
- package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
- package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
- package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-5FNGLV2D.js → chunk-FEU2XVQH.js} +15 -3
- package/dist/{chunk-SZA42R4N.js → chunk-FRBRLKNQ.js} +154 -16
- package/dist/chunk-HIDFL5LQ.js +484 -0
- package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
- package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
- package/dist/{chunk-GKNEJ6EN.cjs → chunk-IMRXC7OA.cjs} +241 -103
- package/dist/chunk-KGRZMHZB.js +204 -0
- package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
- package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
- package/dist/{chunk-D54JHQK2.cjs → chunk-MKXK6E4O.cjs} +51 -51
- package/dist/{chunk-DAPQGA55.js → chunk-N7NBGT2Y.js} +2 -2
- package/dist/chunk-O6OGNDND.js +164 -0
- package/dist/{chunk-22KLZZGH.cjs → chunk-ODFCS7HF.cjs} +8 -8
- package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
- package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
- package/dist/{chunk-YGG7WDWT.cjs → chunk-Q25WAFTD.cjs} +21 -18
- package/dist/{chunk-SBQVEBSU.cjs → chunk-QO2T6KA5.cjs} +165 -67
- package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
- package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
- package/dist/chunk-TFF2GTGN.cjs +153 -0
- package/dist/chunk-TTCJPX4U.cjs +204 -0
- package/dist/{chunk-NZD2MZJC.cjs → chunk-TVQW26AV.cjs} +35 -23
- package/dist/{chunk-R3P2M7HU.cjs → chunk-UVXTOZ2B.cjs} +346 -207
- package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
- package/dist/{chunk-Z4P2RBMJ.js → chunk-V5GSY3NC.js} +101 -3
- package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
- package/dist/chunk-VU6WQSMB.cjs +164 -0
- package/dist/{chunk-OXERWBKE.js → chunk-X5W645RI.js} +3 -3
- package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
- package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
- package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
- package/dist/chunk-YBAPT7NL.js +153 -0
- package/dist/chunk-Z2UQYMPS.cjs +484 -0
- package/dist/color/index.cjs +5 -3
- package/dist/color/index.js +12 -10
- package/dist/diagram/index.cjs +55 -243
- package/dist/diagram/index.js +12 -200
- package/dist/export/index.cjs +7 -6
- package/dist/export/index.js +6 -5
- package/dist/extensions/index.cjs +12 -9
- package/dist/extensions/index.js +11 -8
- package/dist/gradient/index.cjs +29 -27
- package/dist/gradient/index.js +6 -4
- package/dist/image-editor/index.cjs +644 -643
- package/dist/image-editor/index.js +7 -6
- package/dist/index.cjs +21 -18
- package/dist/index.js +14 -11
- package/dist/paint-editor/index.cjs +19 -18
- package/dist/paint-editor/index.js +7 -6
- package/dist/parameters/index.cjs +2 -2
- package/dist/parameters/index.js +1 -1
- package/dist/persistence/assetWrites.d.cts +22 -0
- package/dist/persistence/assetWrites.d.ts +22 -0
- package/dist/persistence/assets.d.cts +71 -0
- package/dist/persistence/assets.d.ts +71 -0
- package/dist/persistence/documentStore.d.cts +17 -1
- package/dist/persistence/documentStore.d.ts +17 -1
- package/dist/persistence/documentTools.d.cts +5 -1
- package/dist/persistence/documentTools.d.ts +5 -1
- package/dist/persistence/editorAutosave.d.cts +7 -0
- package/dist/persistence/editorAutosave.d.ts +7 -0
- package/dist/persistence/index.cjs +141 -21
- package/dist/persistence/index.js +130 -10
- package/dist/persistence/storage.d.cts +13 -1
- package/dist/persistence/storage.d.ts +13 -1
- package/dist/spreadsheet/index.cjs +3 -3
- package/dist/spreadsheet/index.js +2 -2
- package/dist/tokens/index.cjs +11 -3
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +10 -2
- package/dist/tokens/style.d.cts +36 -0
- package/dist/tokens/style.d.ts +36 -0
- package/dist/tools/index.cjs +15 -3
- package/dist/tools/index.d.cts +2 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +14 -2
- package/dist/tools/style-tools.d.cts +19 -0
- package/dist/tools/style-tools.d.ts +19 -0
- package/dist/tools/style.d.cts +212 -0
- package/dist/tools/style.d.ts +212 -0
- package/dist/tools/view.d.cts +6 -0
- package/dist/tools/view.d.ts +6 -0
- package/dist/typography/index.cjs +8 -6
- package/dist/typography/index.js +5 -3
- package/dist/vector/index.cjs +953 -952
- package/dist/vector/index.js +7 -6
- package/dist/video-editor/index.cjs +8 -7
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/skills/README.md +12 -0
- package/skills/pixerate-agent-tools/SKILL.md +34 -1
- package/skills/pixerate-chart/SKILL.md +41 -9
- package/skills/pixerate-image-editor/SKILL.md +2 -0
- package/skills/pixerate-paint-editor/SKILL.md +2 -0
- package/skills/pixerate-tokens/SKILL.md +5 -0
- package/dist/chunk-ERAGQL2N.cjs +0 -68
- package/dist/chunk-KMU6QJB7.js +0 -68
|
@@ -89,7 +89,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
var
|
|
92
|
+
var _chunkEGZM52EOcjs = require('./chunk-EGZM52EO.cjs');
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
|
|
@@ -3285,7 +3285,7 @@ function mapAnchor(a, f) {
|
|
|
3285
3285
|
return out;
|
|
3286
3286
|
}
|
|
3287
3287
|
function mapSubpaths(subpaths, f) {
|
|
3288
|
-
return
|
|
3288
|
+
return _chunkEGZM52EOcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
3289
3289
|
}
|
|
3290
3290
|
function liveShapeSubpaths(live) {
|
|
3291
3291
|
let out;
|
|
@@ -3293,19 +3293,19 @@ function liveShapeSubpaths(live) {
|
|
|
3293
3293
|
case "rect": {
|
|
3294
3294
|
const x = Math.min(live.x, live.x + live.width);
|
|
3295
3295
|
const y = Math.min(live.y, live.y + live.height);
|
|
3296
|
-
const sp =
|
|
3296
|
+
const sp = _chunkEGZM52EOcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
3297
3297
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
3298
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
3298
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkEGZM52EOcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
3299
3299
|
break;
|
|
3300
3300
|
}
|
|
3301
3301
|
case "ellipse":
|
|
3302
|
-
out = [
|
|
3302
|
+
out = [_chunkEGZM52EOcjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
3303
3303
|
break;
|
|
3304
3304
|
case "polygon":
|
|
3305
|
-
out = [
|
|
3305
|
+
out = [_chunkEGZM52EOcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
3306
3306
|
break;
|
|
3307
3307
|
case "star":
|
|
3308
|
-
out = [
|
|
3308
|
+
out = [_chunkEGZM52EOcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
3309
3309
|
break;
|
|
3310
3310
|
case "line": {
|
|
3311
3311
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -3328,7 +3328,7 @@ function liveShapeSubpaths(live) {
|
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
3330
|
const m = live.transform;
|
|
3331
|
-
return m && !
|
|
3331
|
+
return m && !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, p)) : out;
|
|
3332
3332
|
}
|
|
3333
3333
|
function normBox(b) {
|
|
3334
3334
|
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) };
|
|
@@ -3340,7 +3340,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
3340
3340
|
function componentPath(c) {
|
|
3341
3341
|
let p = pathCache.get(c.subpaths);
|
|
3342
3342
|
if (!p) {
|
|
3343
|
-
p =
|
|
3343
|
+
p = _chunkEGZM52EOcjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
3344
3344
|
pathCache.set(c.subpaths, p);
|
|
3345
3345
|
}
|
|
3346
3346
|
return p;
|
|
@@ -3663,7 +3663,7 @@ function matrixArg(v, path) {
|
|
|
3663
3663
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail2(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
3664
3664
|
const m = v;
|
|
3665
3665
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail2(`${path} is singular.`);
|
|
3666
|
-
return
|
|
3666
|
+
return _chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
3667
3667
|
}
|
|
3668
3668
|
function normalizeLiveShape(v, path = "shape") {
|
|
3669
3669
|
if (!v || typeof v !== "object") return fail2(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -3724,7 +3724,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
3724
3724
|
if (typeof v === "string") {
|
|
3725
3725
|
let subs;
|
|
3726
3726
|
try {
|
|
3727
|
-
subs =
|
|
3727
|
+
subs = _chunkEGZM52EOcjs.bezierToSubpaths.call(void 0, v);
|
|
3728
3728
|
} catch (e5) {
|
|
3729
3729
|
return fail2(`${path}: could not read the SVG path data.`);
|
|
3730
3730
|
}
|
|
@@ -3810,15 +3810,15 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3810
3810
|
function transformShapeComponents(components, f, affine) {
|
|
3811
3811
|
return components.map((c) => {
|
|
3812
3812
|
if (affine && c.live) {
|
|
3813
|
-
const live = { ...c.live, transform:
|
|
3814
|
-
if (
|
|
3813
|
+
const live = { ...c.live, transform: _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkEGZM52EOcjs.IDENTITY_MATRIX)), affine) };
|
|
3814
|
+
if (_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
3815
3815
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
3816
3816
|
}
|
|
3817
3817
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
3818
3818
|
});
|
|
3819
3819
|
}
|
|
3820
3820
|
function offsetShape(layer, dx, dy, env) {
|
|
3821
|
-
const m =
|
|
3821
|
+
const m = _chunkEGZM52EOcjs.translateMatrix.call(void 0, dx, dy);
|
|
3822
3822
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
3823
3823
|
delete next.annotation;
|
|
3824
3824
|
return rerenderShape(next, env);
|
|
@@ -3826,7 +3826,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
3826
3826
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
3827
3827
|
if (components.length < 2) return [...components];
|
|
3828
3828
|
const path = shapeOutline(components, fillRule);
|
|
3829
|
-
const subpaths =
|
|
3829
|
+
const subpaths = _chunkEGZM52EOcjs.bezierToSubpaths.call(void 0, path);
|
|
3830
3830
|
if (!subpaths.length) fail2("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
3831
3831
|
return [{ op: "combine", subpaths }];
|
|
3832
3832
|
}
|
|
@@ -3843,7 +3843,7 @@ function annotationPaint(color, opacity) {
|
|
|
3843
3843
|
function shapeFromAnnotation(a) {
|
|
3844
3844
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
3845
3845
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
3846
|
-
const rotation = a.rotation ?
|
|
3846
|
+
const rotation = a.rotation ? _chunkEGZM52EOcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
3847
3847
|
const t = rotation ? { transform: rotation } : {};
|
|
3848
3848
|
const live = (l) => liveComponent(l);
|
|
3849
3849
|
switch (a.type) {
|
|
@@ -3886,7 +3886,7 @@ function shapeFromAnnotation(a) {
|
|
|
3886
3886
|
case "pen": {
|
|
3887
3887
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
3888
3888
|
if (!paint) return null;
|
|
3889
|
-
const pts = rotation ? a.points.map((p) =>
|
|
3889
|
+
const pts = rotation ? a.points.map((p) => _chunkEGZM52EOcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
3890
3890
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
3891
3891
|
return {
|
|
3892
3892
|
components: [{ op: "combine", subpaths }],
|
|
@@ -3919,7 +3919,7 @@ var fail3 = (message) => {
|
|
|
3919
3919
|
};
|
|
3920
3920
|
var TEXT_RENDER_MARGIN = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH;
|
|
3921
3921
|
function textMatrix(layer) {
|
|
3922
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3922
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkEGZM52EOcjs.IDENTITY_MATRIX));
|
|
3923
3923
|
}
|
|
3924
3924
|
function rectCorners(r) {
|
|
3925
3925
|
return [
|
|
@@ -3930,7 +3930,7 @@ function rectCorners(r) {
|
|
|
3930
3930
|
];
|
|
3931
3931
|
}
|
|
3932
3932
|
function docRect(r, m) {
|
|
3933
|
-
const pts = rectCorners(r).map((p) =>
|
|
3933
|
+
const pts = rectCorners(r).map((p) => _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, p));
|
|
3934
3934
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3935
3935
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3936
3936
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3963,14 +3963,14 @@ function inkBounds(layout) {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
function textOutlines(layer, shaper) {
|
|
3965
3965
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3966
|
-
const layout =
|
|
3966
|
+
const layout = _chunkEGZM52EOcjs.layoutText.call(void 0, layer, shaper);
|
|
3967
3967
|
const m = textMatrix(layer);
|
|
3968
3968
|
const out = [];
|
|
3969
3969
|
for (const l of layout.lines) {
|
|
3970
3970
|
for (const f of l.fragments) {
|
|
3971
|
-
let path =
|
|
3972
|
-
for (const r of
|
|
3973
|
-
out.push({ fragment: f, path:
|
|
3971
|
+
let path = _chunkEGZM52EOcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3972
|
+
for (const r of _chunkEGZM52EOcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkEGZM52EOcjs.textRectPath.call(void 0, r)];
|
|
3973
|
+
out.push({ fragment: f, path: _chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3974
3974
|
}
|
|
3975
3975
|
}
|
|
3976
3976
|
return out;
|
|
@@ -4026,7 +4026,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4026
4026
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4027
4027
|
const ctx = canvas.getContext("2d");
|
|
4028
4028
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4029
|
-
const layout =
|
|
4029
|
+
const layout = _chunkEGZM52EOcjs.layoutText.call(void 0, layer, shaper);
|
|
4030
4030
|
const m = textMatrix(layer);
|
|
4031
4031
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4032
4032
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4038,8 +4038,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4038
4038
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4039
4039
|
const s = layer.text.slice(f.start, f.end);
|
|
4040
4040
|
if (!f.spaced) shaper.draw(ctx, s, f.font, f.x, f.y);
|
|
4041
|
-
else for (let k = 0; k < s.length; k++) if (!
|
|
4042
|
-
for (const d of
|
|
4041
|
+
else for (let k = 0; k < s.length; k++) if (!_chunkEGZM52EOcjs.isTextSpace.call(void 0, s[k])) shaper.draw(ctx, s[k], f.font, f.x + f.carets[k], f.y);
|
|
4042
|
+
for (const d of _chunkEGZM52EOcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4043
4043
|
}
|
|
4044
4044
|
}
|
|
4045
4045
|
ctx.globalAlpha = 1;
|
|
@@ -4050,7 +4050,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4050
4050
|
function renderText(layer, env) {
|
|
4051
4051
|
const shaper = env.shaper;
|
|
4052
4052
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4053
|
-
const layout =
|
|
4053
|
+
const layout = _chunkEGZM52EOcjs.layoutText.call(void 0, layer, shaper);
|
|
4054
4054
|
const ink = inkBounds(layout);
|
|
4055
4055
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4056
4056
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4150,7 +4150,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4150
4150
|
continue;
|
|
4151
4151
|
}
|
|
4152
4152
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4153
|
-
if (k === "autoLeading" && value ===
|
|
4153
|
+
if (k === "autoLeading" && value === _chunkEGZM52EOcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4154
4154
|
else o[k] = value;
|
|
4155
4155
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4156
4156
|
}
|
|
@@ -4187,14 +4187,14 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4187
4187
|
opacity: 1,
|
|
4188
4188
|
blend: "normal",
|
|
4189
4189
|
text: text3,
|
|
4190
|
-
runs:
|
|
4191
|
-
paragraphs:
|
|
4190
|
+
runs: _chunkEGZM52EOcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE),
|
|
4191
|
+
paragraphs: _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4192
4192
|
frame: init.frame,
|
|
4193
4193
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
4194
4194
|
offset: { x: 0, y: 0 }
|
|
4195
4195
|
};
|
|
4196
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _63 => _63.runs, 'access', _64 => _64[0], 'optionalAccess', _65 => _65.style]), () => (
|
|
4197
|
-
if (init.transform && !
|
|
4196
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _63 => _63.runs, 'access', _64 => _64[0], 'optionalAccess', _65 => _65.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
|
|
4197
|
+
if (init.transform && !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4198
4198
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4199
4199
|
return rerenderText(layer, env);
|
|
4200
4200
|
}
|
|
@@ -4204,24 +4204,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4204
4204
|
const patch = change(current);
|
|
4205
4205
|
const next = { ...current, ...patch };
|
|
4206
4206
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4207
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4208
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4209
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4207
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkEGZM52EOcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _66 => _66.runs, 'access', _67 => _67[0], 'optionalAccess', _68 => _68.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)));
|
|
4208
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkEGZM52EOcjs.styleAt.call(void 0, current.runs, 0, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE) }];
|
|
4209
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4210
4210
|
const rendered = rerenderText(next, env);
|
|
4211
4211
|
return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4212
4212
|
}
|
|
4213
4213
|
function replaceTextRange(layer, start, end, insert) {
|
|
4214
4214
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4215
|
-
const style =
|
|
4216
|
-
const runs =
|
|
4217
|
-
const pstyle =
|
|
4218
|
-
const paragraphs =
|
|
4219
|
-
return { text: text3, runs, paragraphs:
|
|
4215
|
+
const style = _chunkEGZM52EOcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE);
|
|
4216
|
+
const runs = _chunkEGZM52EOcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4217
|
+
const pstyle = _chunkEGZM52EOcjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4218
|
+
const paragraphs = _chunkEGZM52EOcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4219
|
+
return { text: text3, runs, paragraphs: _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4220
4220
|
}
|
|
4221
4221
|
function transformTypeLayer(layer, m) {
|
|
4222
|
-
const t =
|
|
4222
|
+
const t = _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4223
4223
|
const next = { ...layer };
|
|
4224
|
-
if (
|
|
4224
|
+
if (_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4225
4225
|
else next.transform = t;
|
|
4226
4226
|
delete next.annotation;
|
|
4227
4227
|
return next;
|
|
@@ -4229,7 +4229,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4229
4229
|
function typeFrame(layer, shaper) {
|
|
4230
4230
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4231
4231
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4232
|
-
const b =
|
|
4232
|
+
const b = _chunkEGZM52EOcjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4233
4233
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4234
4234
|
}
|
|
4235
4235
|
function typeAsPixelLayer(layer) {
|
|
@@ -4237,7 +4237,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4237
4237
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4238
4238
|
}
|
|
4239
4239
|
function toTextSpace(layer, p) {
|
|
4240
|
-
return
|
|
4240
|
+
return _chunkEGZM52EOcjs.applyMatrix.call(void 0, _chunkEGZM52EOcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4241
4241
|
}
|
|
4242
4242
|
function typeFromAnnotation(a) {
|
|
4243
4243
|
if (a.type !== "text") return null;
|
|
@@ -4251,7 +4251,7 @@ function typeFromAnnotation(a) {
|
|
|
4251
4251
|
if (op !== 1) style.opacity = op;
|
|
4252
4252
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4253
4253
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4254
|
-
const transform = t.rotation ?
|
|
4254
|
+
const transform = t.rotation ? _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, translate, _chunkEGZM52EOcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4255
4255
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4256
4256
|
}
|
|
4257
4257
|
function annotationOfType(layer) {
|
|
@@ -4585,7 +4585,7 @@ function identityTransform(box2) {
|
|
|
4585
4585
|
}
|
|
4586
4586
|
function cornersFromMatrix(box2, m) {
|
|
4587
4587
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4588
|
-
return [
|
|
4588
|
+
return [_chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[0]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[1]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[2]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4589
4589
|
}
|
|
4590
4590
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4591
4591
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4602,7 +4602,7 @@ function transformHomography(geometry) {
|
|
|
4602
4602
|
function hasWarp(geometry) {
|
|
4603
4603
|
const w = geometry.warp;
|
|
4604
4604
|
if (!w) return false;
|
|
4605
|
-
const id =
|
|
4605
|
+
const id = _chunkEGZM52EOcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4606
4606
|
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;
|
|
4607
4607
|
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);
|
|
4608
4608
|
}
|
|
@@ -4617,7 +4617,7 @@ function transformMap(geometry) {
|
|
|
4617
4617
|
const { box: box2 } = geometry;
|
|
4618
4618
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4619
4619
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4620
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4620
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkEGZM52EOcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4621
4621
|
}
|
|
4622
4622
|
function transformedPoint(geometry, fx, fy) {
|
|
4623
4623
|
const f = transformMap(geometry);
|
|
@@ -4661,8 +4661,8 @@ function matrixFromParams(box2, params) {
|
|
|
4661
4661
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4662
4662
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4663
4663
|
const ref = referencePoint(box2, params.reference);
|
|
4664
|
-
const linear =
|
|
4665
|
-
return
|
|
4664
|
+
const linear = _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkEGZM52EOcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4665
|
+
return _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, _chunkEGZM52EOcjs.matrixAbout.call(void 0, linear, ref), _chunkEGZM52EOcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4666
4666
|
}
|
|
4667
4667
|
function describeTransform(geometry, reference = "center") {
|
|
4668
4668
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4679,7 +4679,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4679
4679
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4680
4680
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4681
4681
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4682
|
-
const at =
|
|
4682
|
+
const at = _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, ref);
|
|
4683
4683
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4684
4684
|
return {
|
|
4685
4685
|
affine: true,
|
|
@@ -4697,24 +4697,24 @@ function applyParams(geometry, params) {
|
|
|
4697
4697
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4698
4698
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4699
4699
|
const c = geometry.corners;
|
|
4700
|
-
return [
|
|
4700
|
+
return [_chunkEGZM52EOcjs.applyMatrix.call(void 0, m, c[0]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, c[1]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, c[2]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, c[3])];
|
|
4701
4701
|
}
|
|
4702
4702
|
function flipCorners(geometry, axis) {
|
|
4703
4703
|
const c = anchorPoint(geometry, "center");
|
|
4704
4704
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4705
4705
|
const q2 = geometry.corners;
|
|
4706
|
-
return [
|
|
4706
|
+
return [_chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[0]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[1]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[2]), _chunkEGZM52EOcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4707
4707
|
}
|
|
4708
4708
|
function boxPointOf(geometry, p) {
|
|
4709
4709
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4710
|
-
if (m) return
|
|
4710
|
+
if (m) return _chunkEGZM52EOcjs.applyMatrix.call(void 0, _chunkEGZM52EOcjs.invertMatrix.call(void 0, m), p);
|
|
4711
4711
|
return null;
|
|
4712
4712
|
}
|
|
4713
4713
|
function presetWarp(box2, preset) {
|
|
4714
|
-
return
|
|
4714
|
+
return _chunkEGZM52EOcjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4715
4715
|
}
|
|
4716
4716
|
function isValidWarp(mesh) {
|
|
4717
|
-
return
|
|
4717
|
+
return _chunkEGZM52EOcjs.isValidWarpMesh.call(void 0, mesh);
|
|
4718
4718
|
}
|
|
4719
4719
|
function geometryHomography(geometry) {
|
|
4720
4720
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4980,7 +4980,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4980
4980
|
}
|
|
4981
4981
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4982
4982
|
if (raw.warp) {
|
|
4983
|
-
if (!
|
|
4983
|
+
if (!_chunkEGZM52EOcjs.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.");
|
|
4984
4984
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4985
4985
|
}
|
|
4986
4986
|
if (raw.interpolation !== void 0) {
|
|
@@ -5083,7 +5083,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5083
5083
|
case "shape": {
|
|
5084
5084
|
const next = {
|
|
5085
5085
|
...layer,
|
|
5086
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5086
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkEGZM52EOcjs.translateMatrix.call(void 0, dx, dy)),
|
|
5087
5087
|
surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5088
5088
|
mask: moveMask(layer.mask)
|
|
5089
5089
|
};
|
|
@@ -5092,7 +5092,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5092
5092
|
return next;
|
|
5093
5093
|
}
|
|
5094
5094
|
case "type": {
|
|
5095
|
-
const next = { ...transformTypeLayer(layer,
|
|
5095
|
+
const next = { ...transformTypeLayer(layer, _chunkEGZM52EOcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5096
5096
|
if (!next.mask) delete next.mask;
|
|
5097
5097
|
return next;
|
|
5098
5098
|
}
|
|
@@ -5278,7 +5278,7 @@ function refitPlacement(layer, contents) {
|
|
|
5278
5278
|
});
|
|
5279
5279
|
const out = { corners: pts };
|
|
5280
5280
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5281
|
-
if (layer.placement.warp) out.warp =
|
|
5281
|
+
if (layer.placement.warp) out.warp = _chunkEGZM52EOcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5282
5282
|
return out;
|
|
5283
5283
|
}
|
|
5284
5284
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
@@ -5592,7 +5592,7 @@ function readType(r, base, ctx) {
|
|
|
5592
5592
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5593
5593
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5594
5594
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _141 => _141.length]), 0, 1e9, 0))),
|
|
5595
|
-
style: patchTextStyle(
|
|
5595
|
+
style: patchTextStyle(_chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _142 => _142.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5596
5596
|
}));
|
|
5597
5597
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5598
5598
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _143 => _143.length]), 0, 1e9, 0))),
|
|
@@ -5605,13 +5605,13 @@ function readType(r, base, ctx) {
|
|
|
5605
5605
|
...base,
|
|
5606
5606
|
type: "type",
|
|
5607
5607
|
text: text3,
|
|
5608
|
-
runs:
|
|
5609
|
-
paragraphs:
|
|
5608
|
+
runs: _chunkEGZM52EOcjs.fitRuns.call(void 0, runs, text3.length, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE),
|
|
5609
|
+
paragraphs: _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5610
5610
|
frame,
|
|
5611
5611
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
5612
5612
|
offset: { x: 0, y: 0 }
|
|
5613
5613
|
};
|
|
5614
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _147 => _147[0], 'optionalAccess', _148 => _148.style]), () => (
|
|
5614
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _147 => _147[0], 'optionalAccess', _148 => _148.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5615
5615
|
if (m) layer.transform = m;
|
|
5616
5616
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
5617
5617
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
@@ -6064,7 +6064,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6064
6064
|
let placement;
|
|
6065
6065
|
try {
|
|
6066
6066
|
const raw = { corners: p.corners };
|
|
6067
|
-
if (p.warp &&
|
|
6067
|
+
if (p.warp && _chunkEGZM52EOcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6068
6068
|
if (_chunkHGTDMKNEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6069
6069
|
placement = normalizePlacement(raw, contents);
|
|
6070
6070
|
} catch (e) {
|
|
@@ -7047,7 +7047,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7047
7047
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7048
7048
|
const subpaths = [];
|
|
7049
7049
|
components.forEach((c, ci) => {
|
|
7050
|
-
|
|
7050
|
+
_chunkEGZM52EOcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7051
7051
|
if (!sp.anchors.length) return;
|
|
7052
7052
|
subpaths.push({
|
|
7053
7053
|
closed: sp.closed,
|
|
@@ -7769,7 +7769,7 @@ function merged(levels) {
|
|
|
7769
7769
|
function charStyle(d, fonts, notes) {
|
|
7770
7770
|
const n = (k) => eNum(eGet(d, k));
|
|
7771
7771
|
const flag = (k) => eBool(eGet(d, k));
|
|
7772
|
-
const s = { ...
|
|
7772
|
+
const s = { ..._chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE };
|
|
7773
7773
|
const fi = n("Font");
|
|
7774
7774
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
7775
7775
|
if (ps) {
|
|
@@ -7852,7 +7852,7 @@ function typeFromTySh(data, notes) {
|
|
|
7852
7852
|
}
|
|
7853
7853
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
7854
7854
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
7855
|
-
let runs = [{ length: text3.length, style: { ...
|
|
7855
|
+
let runs = [{ length: text3.length, style: { ..._chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE } }];
|
|
7856
7856
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
7857
7857
|
let frame = { kind: "point" };
|
|
7858
7858
|
let transform = t.transform;
|
|
@@ -7908,14 +7908,14 @@ function typeFromTySh(data, notes) {
|
|
|
7908
7908
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
7909
7909
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
7910
7910
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
7911
|
-
transform =
|
|
7911
|
+
transform = _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
7912
7912
|
}
|
|
7913
7913
|
}
|
|
7914
7914
|
}
|
|
7915
7915
|
return {
|
|
7916
7916
|
text: text3,
|
|
7917
|
-
runs:
|
|
7918
|
-
paragraphs:
|
|
7917
|
+
runs: _chunkEGZM52EOcjs.fitRuns.call(void 0, runs, text3.length, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE),
|
|
7918
|
+
paragraphs: _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
7919
7919
|
frame,
|
|
7920
7920
|
transform,
|
|
7921
7921
|
antiAlias,
|
|
@@ -7989,7 +7989,7 @@ function buildEngineData(layer, template) {
|
|
|
7989
7989
|
fonts.push(ps);
|
|
7990
7990
|
return fonts.length - 1;
|
|
7991
7991
|
};
|
|
7992
|
-
const runs =
|
|
7992
|
+
const runs = _chunkEGZM52EOcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE);
|
|
7993
7993
|
const sruns = [];
|
|
7994
7994
|
const slens = [];
|
|
7995
7995
|
runs.forEach((r, i) => {
|
|
@@ -7997,10 +7997,10 @@ function buildEngineData(layer, template) {
|
|
|
7997
7997
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
7998
7998
|
});
|
|
7999
7999
|
if (!runs.length) {
|
|
8000
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8000
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8001
8001
|
slens.push(E.int(1));
|
|
8002
8002
|
}
|
|
8003
|
-
const paras =
|
|
8003
|
+
const paras = _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8004
8004
|
const pruns = [];
|
|
8005
8005
|
const plens = [];
|
|
8006
8006
|
paras.forEach((p, i) => {
|
|
@@ -8056,7 +8056,7 @@ function buildEngineData(layer, template) {
|
|
|
8056
8056
|
eSet(e, key, rd);
|
|
8057
8057
|
}
|
|
8058
8058
|
eSet(rd, "FontSet", fontSet);
|
|
8059
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _213 => _213[0], 'optionalAccess', _214 => _214.style]), () => (
|
|
8059
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _213 => _213[0], 'optionalAccess', _214 => _214.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8060
8060
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8061
8061
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8062
8062
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8067,13 +8067,13 @@ function inkBounds2(layer) {
|
|
|
8067
8067
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8068
8068
|
const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
|
|
8069
8069
|
if (!b) return [0, 0, 0, 0];
|
|
8070
|
-
const inv =
|
|
8070
|
+
const inv = _chunkEGZM52EOcjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8071
8071
|
const pts = [
|
|
8072
8072
|
{ x: b.x, y: b.y },
|
|
8073
8073
|
{ x: b.x + b.width, y: b.y },
|
|
8074
8074
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8075
8075
|
{ x: b.x, y: b.y + b.height }
|
|
8076
|
-
].map((p) =>
|
|
8076
|
+
].map((p) => _chunkEGZM52EOcjs.applyMatrix.call(void 0, inv, p));
|
|
8077
8077
|
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))];
|
|
8078
8078
|
}
|
|
8079
8079
|
function tyShForLayer(layer) {
|
|
@@ -8540,7 +8540,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8540
8540
|
var warpStyleOf = (name) => {
|
|
8541
8541
|
if (!name.startsWith("warp")) return null;
|
|
8542
8542
|
const s = _optionalChain([name, 'access', _228 => _228[4], 'optionalAccess', _229 => _229.toLowerCase, 'call', _230 => _230()]) + name.slice(5);
|
|
8543
|
-
return
|
|
8543
|
+
return _chunkEGZM52EOcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8544
8544
|
};
|
|
8545
8545
|
function warpFromDescriptor(w, contents) {
|
|
8546
8546
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8570,7 +8570,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8570
8570
|
} else {
|
|
8571
8571
|
const style = warpStyleOf(styleName);
|
|
8572
8572
|
if (!style) return void 0;
|
|
8573
|
-
mesh =
|
|
8573
|
+
mesh = _chunkEGZM52EOcjs.warpPresetMesh.call(void 0,
|
|
8574
8574
|
{
|
|
8575
8575
|
style,
|
|
8576
8576
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8585,7 +8585,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8585
8585
|
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;
|
|
8586
8586
|
if (!same) {
|
|
8587
8587
|
const m = mesh;
|
|
8588
|
-
mesh =
|
|
8588
|
+
mesh = _chunkEGZM52EOcjs.fitWarpMesh.call(void 0, (s, t) => _chunkEGZM52EOcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8589
8589
|
}
|
|
8590
8590
|
return { mesh, frame };
|
|
8591
8591
|
}
|
|
@@ -10161,7 +10161,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10161
10161
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10162
10162
|
const kx = contents.width / size.width;
|
|
10163
10163
|
const ky = contents.height / size.height;
|
|
10164
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10164
|
+
if (placement.warp) placement = { ...placement, warp: _chunkEGZM52EOcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10165
10165
|
}
|
|
10166
10166
|
}
|
|
10167
10167
|
if (!contents || !placement) {
|