ag-psd 28.2.0 → 28.2.1

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-es/psd.d.ts CHANGED
@@ -1147,7 +1147,7 @@ type FilterVariant = {
1147
1147
  type: 'curves';
1148
1148
  filter: {
1149
1149
  presetKind: 'custom' | 'default';
1150
- adjustments: ({
1150
+ adjustments?: ({
1151
1151
  channels: ('composite' | 'red' | 'green' | 'blue')[];
1152
1152
  curve: {
1153
1153
  x: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-psd",
3
- "version": "28.2.0",
3
+ "version": "28.2.1",
4
4
  "description": "Library for reading and writing PSD files",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist-es/index.js",
@@ -1939,7 +1939,7 @@ type SoLdDescriptorFilterItem = {
1939
1939
  _name: 'Curves';
1940
1940
  _classID: 'Crvs';
1941
1941
  presetKind: string; // 'presetKindType.presetKindCustom';
1942
- Adjs: {
1942
+ Adjs?: {
1943
1943
  _name: '';
1944
1944
  _classID: 'CrvA';
1945
1945
  Chnl: string[]; // 'Chnl.Cmps' | 'Chnl.Rd ' | 'Chnl.Grn ' | 'Chnl.Bl '
@@ -2216,7 +2216,7 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
2216
2216
  reduceColorNoise: parsePercent(f.Fltr.ClNs),
2217
2217
  sharpenDetails: parsePercent(f.Fltr.Shrp),
2218
2218
  channelDenoise: f.Fltr.channelDenoise.map(c => ({
2219
- channels: c.Chnl.map(i => Chnl.decode(i)),
2219
+ channels: c.Chnl.map(Chnl.decode),
2220
2220
  amount: c.Amnt,
2221
2221
  ...(c.EdgF ? { preserveDetails: c.EdgF } : {}),
2222
2222
  })),
@@ -2565,24 +2565,25 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
2565
2565
  type: 'curves',
2566
2566
  filter: {
2567
2567
  presetKind: presetKindType.decode(f.Fltr.presetKind),
2568
- adjustments: f.Fltr.Adjs.map(a => {
2569
- const channels = a.Chnl.map(c => Chnl.decode(c));
2570
-
2571
- if (a['Crv ']) {
2572
- return {
2573
- channels,
2574
- curve: a['Crv '].map(c => {
2575
- const point: { x: number; y: number; curved?: boolean; } = { x: c.Hrzn, y: c.Vrtc };
2576
- if (c.Cnty) point.curved = true;
2577
- return point;
2578
- }),
2579
- };
2580
- } else if (a.Mpng) {
2581
- return { channels, values: a.Mpng };
2582
- } else {
2583
- throw new Error(`Unknown curve adjustment`);
2584
- }
2585
- }),
2568
+ ...(f.Fltr.Adjs ? {
2569
+ adjustments: f.Fltr.Adjs.map(a => {
2570
+ const channels = a.Chnl.map(Chnl.decode);
2571
+ if (a['Crv ']) {
2572
+ return {
2573
+ channels,
2574
+ curve: a['Crv '].map(c => {
2575
+ const point: { x: number; y: number; curved?: boolean; } = { x: c.Hrzn, y: c.Vrtc };
2576
+ if (c.Cnty) point.curved = true;
2577
+ return point;
2578
+ }),
2579
+ };
2580
+ } else if (a.Mpng) {
2581
+ return { channels, values: a.Mpng };
2582
+ } else {
2583
+ throw new Error(`Unknown curve adjustment`);
2584
+ }
2585
+ })
2586
+ } : {}),
2586
2587
  },
2587
2588
  };
2588
2589
  };
@@ -3297,23 +3298,25 @@ function serializeFilterFXItem(f: Filter): SoLdDescriptorFilterItem {
3297
3298
  _name: 'Curves',
3298
3299
  _classID: 'Crvs',
3299
3300
  presetKind: presetKindType.encode(f.filter.presetKind),
3300
- Adjs: f.filter.adjustments.map(a => 'curve' in a ? {
3301
- _name: '',
3302
- _classID: 'CrvA',
3303
- Chnl: a.channels.map(c => Chnl.encode(c)),
3304
- 'Crv ': a.curve.map(c => ({
3301
+ ...(f.filter.adjustments ? {
3302
+ Adjs: f.filter.adjustments.map(a => 'curve' in a ? {
3305
3303
  _name: '',
3306
- _classID: 'Pnt ',
3307
- Hrzn: c.x,
3308
- Vrtc: c.y,
3309
- ...(c.curved ? { Cnty: true } : {}),
3310
- }) as FilterCurvesCurvePoint),
3311
- } : {
3312
- _name: '',
3313
- _classID: 'CrvA',
3314
- Chnl: a.channels.map(c => Chnl.encode(c)),
3315
- Mpng: a.values,
3316
- }),
3304
+ _classID: 'CrvA',
3305
+ Chnl: a.channels.map(Chnl.encode),
3306
+ 'Crv ': a.curve.map(c => ({
3307
+ _name: '',
3308
+ _classID: 'Pnt ',
3309
+ Hrzn: c.x,
3310
+ Vrtc: c.y,
3311
+ ...(c.curved ? { Cnty: true } : {}),
3312
+ }) as FilterCurvesCurvePoint),
3313
+ } : {
3314
+ _name: '',
3315
+ _classID: 'CrvA',
3316
+ Chnl: a.channels.map(Chnl.encode),
3317
+ Mpng: a.values,
3318
+ })
3319
+ } : {}),
3317
3320
  },
3318
3321
  filterID: 1131574899,
3319
3322
  };
package/src/psd.ts CHANGED
@@ -1161,7 +1161,7 @@ type FilterVariant = {
1161
1161
  type: 'curves';
1162
1162
  filter: {
1163
1163
  presetKind: 'custom' | 'default';
1164
- adjustments: ({
1164
+ adjustments?: ({
1165
1165
  channels: ('composite' | 'red' | 'green' | 'blue')[];
1166
1166
  curve: { x: number; y: number; curved?: boolean; }[];
1167
1167
  } | {