ag-psd 28.0.0 → 28.1.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/.v8-cache/v22.13.1-x64-00250a7c/4511bacf +0 -0
- package/.v8-cache/v22.13.1-x64-00250a7c/a7e80865 +0 -0
- package/.v8-cache/v22.13.1-x64-00250a7c/b3c2fab7 +0 -0
- package/.v8-cache/v22.13.1-x64-00250a7c/e03e2acd +0 -0
- package/CHANGELOG.md +3 -0
- package/dist/additionalInfo.js +20 -0
- package/dist/additionalInfo.js.map +1 -1
- package/dist/bundle.js +74 -36
- package/dist/descriptor.d.ts +1 -0
- package/dist/descriptor.js +46 -32
- package/dist/descriptor.js.map +1 -1
- package/dist/engineData.js +8 -4
- package/dist/engineData.js.map +1 -1
- package/dist-es/additionalInfo.js +20 -0
- package/dist-es/additionalInfo.js.map +1 -1
- package/dist-es/descriptor.d.ts +1 -0
- package/dist-es/descriptor.js +46 -32
- package/dist-es/descriptor.js.map +1 -1
- package/dist-es/engineData.js +8 -4
- package/dist-es/engineData.js.map +1 -1
- package/package.json +1 -2
- package/src/additionalInfo.ts +26 -0
- package/src/descriptor.ts +22 -18
- package/src/engineData.ts +9 -4
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
|
-
|
|
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 (
|
|
1244
|
-
if (
|
|
1245
|
-
if (
|
|
1246
|
-
if (
|
|
1247
|
-
if (
|
|
1248
|
-
if (
|
|
1249
|
-
if (
|
|
1250
|
-
if (
|
|
1251
|
-
if (
|
|
1252
|
-
if (
|
|
1253
|
-
if (
|
|
1254
|
-
if (
|
|
1255
|
-
if (
|
|
1256
|
-
if (
|
|
1257
|
-
if (
|
|
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
|
|
|
@@ -1932,7 +1936,7 @@ export const stdTrackID = createEnum<TimelineTrackType>('stdTrackID', 'opacity',
|
|
|
1932
1936
|
|
|
1933
1937
|
export const gradientInterpolationMethodType = createEnum<InterpolationMethod>('gradientInterpolationMethodType', 'perceptual', {
|
|
1934
1938
|
perceptual: 'Perc',
|
|
1935
|
-
linear: 'Lnr',
|
|
1939
|
+
linear: 'Lnr ',
|
|
1936
1940
|
classic: 'Gcls',
|
|
1937
1941
|
smooth: 'Smoo',
|
|
1938
1942
|
});
|
package/src/engineData.ts
CHANGED
|
@@ -110,7 +110,11 @@ export function parseEngineData(data: number[] | Uint8Array) {
|
|
|
110
110
|
|
|
111
111
|
skipWhitespace();
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
let dataLength = data.length;
|
|
114
|
+
|
|
115
|
+
while (dataLength > 0 && data[dataLength - 1] === 0) dataLength--; // trim 0 bytes from end
|
|
116
|
+
|
|
117
|
+
while (index < dataLength) {
|
|
114
118
|
const i = index;
|
|
115
119
|
const char = data[i];
|
|
116
120
|
|
|
@@ -164,10 +168,11 @@ export function parseEngineData(data: number[] | Uint8Array) {
|
|
|
164
168
|
pushValue(parseFloat(value));
|
|
165
169
|
} else {
|
|
166
170
|
index += 1;
|
|
167
|
-
console.log(`Invalid token ${String.fromCharCode(char)} at ${index}`
|
|
171
|
+
console.log(`Invalid token '${String.fromCharCode(char)}' (${char}) at ${index}`
|
|
172
|
+
// + ` near '${String.fromCharCode.apply(null, data.slice(index - 10, index + 20) as any)}'`
|
|
173
|
+
// + ` data [${Array.from(data.slice(index - 10, index + 20)).join(', ')}]`
|
|
174
|
+
);
|
|
168
175
|
// throw new Error(`Invalid token ${String.fromCharCode(char)} at ${index}`);
|
|
169
|
-
// ` near ${String.fromCharCode.apply(null, data.slice(index - 10, index + 20) as any)}` +
|
|
170
|
-
// `data [${Array.from(data.slice(index - 10, index + 20)).join(', ')}]`
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
skipWhitespace();
|