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/dist/psd.d.ts CHANGED
@@ -660,6 +660,7 @@ export interface GradientMapAdjustment {
660
660
  gradientType: 'solid' | 'noise';
661
661
  dither?: boolean;
662
662
  reverse?: boolean;
663
+ method?: InterpolationMethod;
663
664
  smoothness?: number;
664
665
  colorStops?: ColorStop[];
665
666
  opacityStops?: OpacityStop[];
package/dist/psd.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":";;;AAMA,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAS1B;AAED,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAKnC;AAw7CD,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,iEAAQ,CAAA;IACR,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,6EAAc,CAAA;AACf,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC"}
1
+ {"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":";;;AAMA,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAS1B;AAED,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAKnC;AAy7CD,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,iEAAQ,CAAA;IACR,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,6EAAc,CAAA;AACf,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC"}
@@ -14,7 +14,7 @@ import { readEffects, writeEffects } from './effectsHelpers';
14
14
  import { clamp, createEnum, layerColors, MOCK_HANDLERS } from './helpers';
15
15
  import { readSignature, readUnicodeString, skipBytes, readUint32, readUint8, readFloat64, readUint16, readBytes, readInt16, checkSignature, readFloat32, readFixedPointPath32, readSection, readColor, readInt32, readPascalString, readUnicodeStringWithLength, readAsciiString, readPattern, readLayerInfo } from './psdReader';
16
16
  import { writeZeros, writeSignature, writeBytes, writeUint32, writeUint16, writeFloat64, writeUint8, writeInt16, writeFloat32, writeFixedPointPath32, writeUnicodeString, writeSection, writeUnicodeStringWithPadding, writeColor, writePascalString, writeInt32 } from './psdWriter';
17
- import { Annt, BlnM, parsePercent, parseUnits, parseUnitsOrNumber, strokeStyleLineAlignment, strokeStyleLineCapType, strokeStyleLineJoinType, textGridding, unitsPercent, unitsValue, warpStyle, writeVersionAndDescriptor, readVersionAndDescriptor, Ornt, horzVrtcToXY, xyToHorzVrtc, serializeEffects, parseEffects, parseColor, serializeColor, serializeVectorContent, parseVectorContent, parseTrackList, serializeTrackList, BlrM, BlrQ, SmBQ, SmBM, DspM, UndA, Cnvr, RplS, SphM, Wvtp, ZZTy, Dstr, Chnl, MztT, Lns, blurType, DfsM, ExtT, ExtR, FlCl, CntE, WndM, Drct, IntE, IntC, FlMd, unitsPercentF, frac, ClrS, descBoundsToBounds, boundsToDescBounds, presetKindType } from './descriptor';
17
+ import { Annt, BlnM, parsePercent, parseUnits, parseUnitsOrNumber, strokeStyleLineAlignment, strokeStyleLineCapType, strokeStyleLineJoinType, textGridding, unitsPercent, unitsValue, warpStyle, writeVersionAndDescriptor, readVersionAndDescriptor, Ornt, horzVrtcToXY, xyToHorzVrtc, serializeEffects, parseEffects, parseColor, serializeColor, serializeVectorContent, parseVectorContent, parseTrackList, serializeTrackList, BlrM, BlrQ, SmBQ, SmBM, DspM, UndA, Cnvr, RplS, SphM, Wvtp, ZZTy, Dstr, Chnl, MztT, Lns, blurType, DfsM, ExtT, ExtR, FlCl, CntE, WndM, Drct, IntE, IntC, FlMd, unitsPercentF, frac, ClrS, descBoundsToBounds, boundsToDescBounds, presetKindType, gradientInterpolationMethodType } from './descriptor';
18
18
  import { serializeEngineData, parseEngineData } from './engineData';
19
19
  import { encodeEngineData, decodeEngineData } from './text';
20
20
  import { decodeEngineData2 } from './engineData2';
@@ -2397,6 +2397,26 @@ addHandler('pths', hasKey('pathList'), function (reader, target) {
2397
2397
  writeVersionAndDescriptor(writer, '', 'pathsDataClass', desc);
2398
2398
  });
2399
2399
  addHandler('lyvr', hasKey('version'), function (reader, target) { return target.version = readUint32(reader); }, function (writer, target) { return writeUint32(writer, target.version); });
2400
+ addHandler('lfxs', function () { return false; }, // TODO: not sure when we actually need to write this section
2401
+ // NOTE: this might be insufficient
2402
+ // target => target.effects !== undefined && (
2403
+ // !!target.effects.dropShadow?.some(e => e.choke) ||
2404
+ // !!target.effects.innerShadow?.some(e => e.choke) ||
2405
+ // !!target.effects.outerGlow?.choke ||
2406
+ // !!target.effects.innerGlow?.choke
2407
+ // ),
2408
+ function (reader, target, left) {
2409
+ var version = readUint32(reader);
2410
+ if (version !== 0)
2411
+ throw new Error("Invalid lfxs version");
2412
+ var desc = readVersionAndDescriptor(reader);
2413
+ target.effects = parseEffects(desc, !!reader.logMissingFeatures);
2414
+ skipBytes(reader, left());
2415
+ }, function (writer, target, _, options) {
2416
+ var desc = serializeEffects(target.effects, !!options.logMissingFeatures, true);
2417
+ writeUint32(writer, 0); // version
2418
+ writeVersionAndDescriptor(writer, '', 'null', desc);
2419
+ });
2400
2420
  function adjustmentType(type) {
2401
2421
  return function (target) { return !!target.adjustment && target.adjustment.type === type; };
2402
2422
  }
@@ -2858,7 +2878,8 @@ addHandler('thrs', adjustmentType('threshold'), function (reader, target, left)
2858
2878
  });
2859
2879
  var grdmColorModels = ['', '', '', 'rgb', 'hsb', '', 'lab'];
2860
2880
  addHandler('grdm', adjustmentType('gradient map'), function (reader, target, left) {
2861
- if (readUint16(reader) !== 1)
2881
+ var version = readUint16(reader);
2882
+ if (version !== 1 && version !== 3)
2862
2883
  throw new Error('Invalid grdm version');
2863
2884
  var info = {
2864
2885
  type: 'gradient map',
@@ -2866,6 +2887,12 @@ addHandler('grdm', adjustmentType('gradient map'), function (reader, target, lef
2866
2887
  };
2867
2888
  info.reverse = !!readUint8(reader);
2868
2889
  info.dither = !!readUint8(reader);
2890
+ var hasMethod = !!readUint8(reader);
2891
+ reader.offset--;
2892
+ if (hasMethod) {
2893
+ var method = readSignature(reader);
2894
+ info.method = gradientInterpolationMethodType.decode(method);
2895
+ }
2869
2896
  info.name = readUnicodeString(reader);
2870
2897
  info.colorStops = [];
2871
2898
  info.opacityStops = [];
@@ -2925,9 +2952,12 @@ addHandler('grdm', adjustmentType('gradient map'), function (reader, target, lef
2925
2952
  }, function (writer, target) {
2926
2953
  var _a, _b, _c;
2927
2954
  var info = target.adjustment;
2928
- writeUint16(writer, 1); // version
2955
+ writeUint16(writer, info.method !== undefined ? 3 : 1); // version
2929
2956
  writeUint8(writer, info.reverse ? 1 : 0);
2930
2957
  writeUint8(writer, info.dither ? 1 : 0);
2958
+ if (info.method !== undefined) {
2959
+ writeSignature(writer, gradientInterpolationMethodType.encode(info.method));
2960
+ }
2931
2961
  writeUnicodeStringWithPadding(writer, info.name || '');
2932
2962
  writeUint16(writer, info.colorStops && info.colorStops.length || 0);
2933
2963
  var interpolation = Math.round(((_a = info.smoothness) !== null && _a !== void 0 ? _a : 1) * 4096);