ag-psd 28.0.1 → 28.1.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/src/descriptor.ts CHANGED
@@ -1115,6 +1115,8 @@ export interface EffectDescriptor extends Partial<DescriptorGradientContent>, Pa
1115
1115
  present?: boolean;
1116
1116
  showInDialog?: boolean;
1117
1117
  overprint?: boolean;
1118
+ uglg?: boolean; // useGlobalLight
1119
+ // more fields here used in parseEffectObject
1118
1120
  }
1119
1121
 
1120
1122
  export interface Lfx2Descriptor {
@@ -1145,7 +1147,7 @@ export interface LmfxDescriptor {
1145
1147
  IrGl?: EffectDescriptor;
1146
1148
  ebbl?: EffectDescriptor;
1147
1149
  ChFX?: EffectDescriptor;
1148
- numModifyingFX?: number;
1150
+ numModifyingFX?: number; // number of effects with enabled = true
1149
1151
  }
1150
1152
 
1151
1153
  function parseFxObject(fx: EffectDescriptor) {
@@ -1238,23 +1240,25 @@ export function serializeEffects(e: LayerEffectsInfo, log: boolean, multi: boole
1238
1240
 
1239
1241
  export function parseEffects(info: Lfx2Descriptor & LmfxDescriptor, log: boolean) {
1240
1242
  const effects: LayerEffectsInfo = {};
1241
- if (!info.masterFXSwitch) effects.disabled = true;
1243
+ const { masterFXSwitch, DrSh, dropShadowMulti, IrSh, innerShadowMulti, OrGl, IrGl, ebbl, SoFi, solidFillMulti, patternFill, GrFl, gradientFillMulti, ChFX, FrFX, frameFXMulti, numModifyingFX, ...rest } = info;
1244
+ if (!masterFXSwitch) effects.disabled = true;
1242
1245
  if (info['Scl ']) effects.scale = parsePercent(info['Scl ']);
1243
- if (info.DrSh) effects.dropShadow = [parseEffectObject(info.DrSh, log)];
1244
- if (info.dropShadowMulti) effects.dropShadow = info.dropShadowMulti.map(i => parseEffectObject(i, log));
1245
- if (info.IrSh) effects.innerShadow = [parseEffectObject(info.IrSh, log)];
1246
- if (info.innerShadowMulti) effects.innerShadow = info.innerShadowMulti.map(i => parseEffectObject(i, log));
1247
- if (info.OrGl) effects.outerGlow = parseEffectObject(info.OrGl, log);
1248
- if (info.IrGl) effects.innerGlow = parseEffectObject(info.IrGl, log);
1249
- if (info.ebbl) effects.bevel = parseEffectObject(info.ebbl, log);
1250
- if (info.SoFi) effects.solidFill = [parseEffectObject(info.SoFi, log)];
1251
- if (info.solidFillMulti) effects.solidFill = info.solidFillMulti.map(i => parseEffectObject(i, log));
1252
- if (info.patternFill) effects.patternOverlay = parseEffectObject(info.patternFill, log);
1253
- if (info.GrFl) effects.gradientOverlay = [parseEffectObject(info.GrFl, log)];
1254
- if (info.gradientFillMulti) effects.gradientOverlay = info.gradientFillMulti.map(i => parseEffectObject(i, log));
1255
- if (info.ChFX) effects.satin = parseEffectObject(info.ChFX, log);
1256
- if (info.FrFX) effects.stroke = [parseFxObject(info.FrFX)];
1257
- if (info.frameFXMulti) effects.stroke = info.frameFXMulti.map(i => parseFxObject(i));
1246
+ if (DrSh) effects.dropShadow = [parseEffectObject(DrSh, log)];
1247
+ if (dropShadowMulti) effects.dropShadow = dropShadowMulti.map(i => parseEffectObject(i, log));
1248
+ if (IrSh) effects.innerShadow = [parseEffectObject(IrSh, log)];
1249
+ if (innerShadowMulti) effects.innerShadow = innerShadowMulti.map(i => parseEffectObject(i, log));
1250
+ if (OrGl) effects.outerGlow = parseEffectObject(OrGl, log);
1251
+ if (IrGl) effects.innerGlow = parseEffectObject(IrGl, log);
1252
+ if (ebbl) effects.bevel = parseEffectObject(ebbl, log);
1253
+ if (SoFi) effects.solidFill = [parseEffectObject(SoFi, log)];
1254
+ if (solidFillMulti) effects.solidFill = solidFillMulti.map(i => parseEffectObject(i, log));
1255
+ if (patternFill) effects.patternOverlay = parseEffectObject(patternFill, log);
1256
+ if (GrFl) effects.gradientOverlay = [parseEffectObject(GrFl, log)];
1257
+ if (gradientFillMulti) effects.gradientOverlay = gradientFillMulti.map(i => parseEffectObject(i, log));
1258
+ if (ChFX) effects.satin = parseEffectObject(ChFX, log);
1259
+ if (FrFX) effects.stroke = [parseFxObject(FrFX)];
1260
+ if (frameFXMulti) effects.stroke = frameFXMulti.map(i => parseFxObject(i));
1261
+ if (log && Object.keys(rest).length > 1) console.log('Unhandled effect keys:', rest);
1258
1262
  return effects;
1259
1263
  }
1260
1264
 
@@ -1935,6 +1939,7 @@ export const gradientInterpolationMethodType = createEnum<InterpolationMethod>('
1935
1939
  linear: 'Lnr ',
1936
1940
  classic: 'Gcls',
1937
1941
  smooth: 'Smoo',
1942
+ // TODO: stripes
1938
1943
  });
1939
1944
 
1940
1945
  export const ClrS = createEnum<'rgb' | 'hsb' | 'lab'>('ClrS', 'rgb', {
package/src/psd.ts CHANGED
@@ -680,6 +680,7 @@ export interface GradientMapAdjustment {
680
680
  gradientType: 'solid' | 'noise';
681
681
  dither?: boolean;
682
682
  reverse?: boolean;
683
+ method?: InterpolationMethod;
683
684
  // solid
684
685
  smoothness?: number;
685
686
  colorStops?: ColorStop[];