ag-psd 17.0.2 → 17.0.3
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/CHANGELOG.md +3 -0
- package/dist/additionalInfo.js +43 -2
- package/dist/additionalInfo.js.map +1 -1
- package/dist/bundle.js +43 -2
- package/dist-es/additionalInfo.js +43 -2
- package/dist-es/additionalInfo.js.map +1 -1
- package/package.json +1 -1
- package/src/additionalInfo.ts +45 -2
- package/src/psd.ts +5 -5
package/CHANGELOG.md
CHANGED
package/dist/additionalInfo.js
CHANGED
|
@@ -852,6 +852,9 @@ addHandler('PlLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
852
852
|
var placed = target.placedLayer;
|
|
853
853
|
(0, psdWriter_1.writeSignature)(writer, 'plcL');
|
|
854
854
|
(0, psdWriter_1.writeInt32)(writer, 3); // version
|
|
855
|
+
if (!placed.id || typeof placed.id !== 'string' || !/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(placed.id)) {
|
|
856
|
+
throw new Error('Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)');
|
|
857
|
+
}
|
|
855
858
|
(0, psdWriter_1.writePascalString)(writer, placed.id, 1);
|
|
856
859
|
(0, psdWriter_1.writeInt32)(writer, 1); // pageNumber
|
|
857
860
|
(0, psdWriter_1.writeInt32)(writer, 1); // totalPages
|
|
@@ -1739,9 +1742,44 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
1739
1742
|
(0, psdWriter_1.writeSignature)(writer, 'soLD');
|
|
1740
1743
|
(0, psdWriter_1.writeInt32)(writer, 4); // version
|
|
1741
1744
|
var placed = target.placedLayer;
|
|
1745
|
+
var warp = placed.warp;
|
|
1746
|
+
if (!warp) {
|
|
1747
|
+
if (!placed.width || !placed.height)
|
|
1748
|
+
throw new Error('You must provide width and height of the linked image in placedLayer');
|
|
1749
|
+
var w = placed.width;
|
|
1750
|
+
var h = placed.height;
|
|
1751
|
+
var x0 = 0, x1 = w / 3, x2 = w * 2 / 3, x3 = w;
|
|
1752
|
+
var y0 = 0, y1 = h / 3, y2 = h * 2 / 3, y3 = h;
|
|
1753
|
+
warp = {
|
|
1754
|
+
style: 'custom',
|
|
1755
|
+
value: 0,
|
|
1756
|
+
perspective: 0,
|
|
1757
|
+
perspectiveOther: 0,
|
|
1758
|
+
rotate: 'horizontal',
|
|
1759
|
+
bounds: {
|
|
1760
|
+
top: { value: 0, units: 'Pixels' },
|
|
1761
|
+
left: { value: 0, units: 'Pixels' },
|
|
1762
|
+
bottom: { value: h, units: 'Pixels' },
|
|
1763
|
+
right: { value: w, units: 'Pixels' },
|
|
1764
|
+
},
|
|
1765
|
+
uOrder: 4,
|
|
1766
|
+
vOrder: 4,
|
|
1767
|
+
customEnvelopeWarp: {
|
|
1768
|
+
meshPoints: [
|
|
1769
|
+
{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x2, y: y0 }, { x: x3, y: y0 },
|
|
1770
|
+
{ x: x0, y: y1 }, { x: x1, y: y1 }, { x: x2, y: y1 }, { x: x3, y: y1 },
|
|
1771
|
+
{ x: x0, y: y2 }, { x: x1, y: y2 }, { x: x2, y: y2 }, { x: x3, y: y2 },
|
|
1772
|
+
{ x: x0, y: y3 }, { x: x1, y: y3 }, { x: x2, y: y3 }, { x: x3, y: y3 },
|
|
1773
|
+
],
|
|
1774
|
+
},
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
if (!placed.id || typeof placed.id !== 'string' || !/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(placed.id)) {
|
|
1778
|
+
throw new Error('Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)');
|
|
1779
|
+
}
|
|
1742
1780
|
var desc = __assign(__assign({ Idnt: placed.id, placed: (_a = placed.placed) !== null && _a !== void 0 ? _a : placed.id, PgNm: placed.pageNumber || 1, totalPages: placed.totalPages || 1 }, (placed.crop ? { Crop: placed.crop } : {})), { frameStep: placed.frameStep || { numerator: 0, denominator: 600 }, duration: placed.duration || { numerator: 0, denominator: 600 }, frameCount: placed.frameCount || 0, Annt: 16, Type: placedLayerTypes.indexOf(placed.type), Trnf: placed.transform, nonAffineTransform: (_b = placed.nonAffineTransform) !== null && _b !== void 0 ? _b : placed.transform,
|
|
1743
1781
|
// quiltWarp: {} as any,
|
|
1744
|
-
warp: encodeWarp(
|
|
1782
|
+
warp: encodeWarp(warp || {}), 'Sz ': {
|
|
1745
1783
|
_name: '',
|
|
1746
1784
|
_classID: 'Pnt ',
|
|
1747
1785
|
Wdth: placed.width || 0,
|
|
@@ -2009,7 +2047,10 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
2009
2047
|
var sizeOffset = writer.offset;
|
|
2010
2048
|
(0, psdWriter_1.writeSignature)(writer, file.data ? 'liFD' : 'liFA');
|
|
2011
2049
|
(0, psdWriter_1.writeInt32)(writer, version);
|
|
2012
|
-
|
|
2050
|
+
if (!file.id || typeof file.id !== 'string' || !/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(file.id)) {
|
|
2051
|
+
throw new Error('Linked file ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)');
|
|
2052
|
+
}
|
|
2053
|
+
(0, psdWriter_1.writePascalString)(writer, file.id, 1);
|
|
2013
2054
|
(0, psdWriter_1.writeUnicodeStringWithPadding)(writer, file.name || '');
|
|
2014
2055
|
(0, psdWriter_1.writeSignature)(writer, file.type ? "".concat(file.type, " ").substring(0, 4) : ' ');
|
|
2015
2056
|
(0, psdWriter_1.writeSignature)(writer, file.creator ? "".concat(file.creator, " ").substring(0, 4) : '\0\0\0\0');
|