@ps-generator-bridge/generator 0.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/dist/contract-C4vydf6-.d.ts +1270 -0
  3. package/dist/contract.d.ts +3 -0
  4. package/dist/contract.js +19 -0
  5. package/dist/contract.js.map +1 -0
  6. package/dist/index.d.ts +8 -0
  7. package/dist/index.js +2482 -0
  8. package/dist/index.js.map +1 -0
  9. package/jsx/Action/autoCutout.jsx +12 -0
  10. package/jsx/Action/redo.jsx +5 -0
  11. package/jsx/Action/removeBackground.jsx +10 -0
  12. package/jsx/Common/alert.jsx +4 -0
  13. package/jsx/Common/debug.jsx +43 -0
  14. package/jsx/Common/event-dispatch.jsx +4 -0
  15. package/jsx/Document/exportDocument.jsx +128 -0
  16. package/jsx/Document/getDocumentInfo.jsx +222 -0
  17. package/jsx/Document/openPsd.jsx +6 -0
  18. package/jsx/Document/openPsdFile.jsx +7 -0
  19. package/jsx/Document/saveDocument.jsx +37 -0
  20. package/jsx/Layer/addImageLayer.jsx +182 -0
  21. package/jsx/Layer/createSelectionStroke.jsx +44 -0
  22. package/jsx/Layer/getActiveLayerID.jsx +1 -0
  23. package/jsx/Layer/getLayerBounds.jsx +114 -0
  24. package/jsx/Layer/getLayerInfo.jsx +323 -0
  25. package/jsx/Layer/getLayerPixmap.jsx +337 -0
  26. package/jsx/Layer/getSelection.jsx +6 -0
  27. package/jsx/Layer/layer.jsx +284 -0
  28. package/jsx/Layer/saveEngineDataToLayer.jsx +26 -0
  29. package/jsx/Layer/setLayerWorkpathMask.jsx +126 -0
  30. package/jsx/Layer/transformLayer.jsx +121 -0
  31. package/jsx/Selection/getSelectionPath.jsx +389 -0
  32. package/jsx/Selection/pathtosvg.jsx +257 -0
  33. package/jsx/Selection/registerEvent.jsx +10 -0
  34. package/jsx/Selection/selectiontopath.jsx +9 -0
  35. package/jsx/polyfills/Array.js +159 -0
  36. package/jsx/polyfills/Function.js +29 -0
  37. package/jsx/polyfills/JSON.js +182 -0
  38. package/jsx/polyfills/Number.js +24 -0
  39. package/jsx/polyfills/Object.js +80 -0
  40. package/jsx/polyfills/String.js +87 -0
  41. package/jsx/types/extendscript/README.md +34 -0
  42. package/jsx/types/extendscript/actions.d.ts +148 -0
  43. package/jsx/types/extendscript/application.d.ts +74 -0
  44. package/jsx/types/extendscript/channel.d.ts +70 -0
  45. package/jsx/types/extendscript/color.d.ts +92 -0
  46. package/jsx/types/extendscript/document.d.ts +110 -0
  47. package/jsx/types/extendscript/enums.d.ts +796 -0
  48. package/jsx/types/extendscript/index.d.ts +504 -0
  49. package/jsx/types/extendscript/layer.d.ts +530 -0
  50. package/jsx/types/extendscript/misc.d.ts +274 -0
  51. package/jsx/types/extendscript/open-options.d.ts +86 -0
  52. package/jsx/types/extendscript/path.d.ts +196 -0
  53. package/jsx/types/extendscript/save-options.d.ts +144 -0
  54. package/jsx/types/extendscript/selection.d.ts +191 -0
  55. package/jsx/types/extendscript/text.d.ts +169 -0
  56. package/main.js +16 -0
  57. package/package.json +75 -0
@@ -0,0 +1,504 @@
1
+ /**
2
+ * Photoshop ExtendScript TypeScript 类型声明入口文件
3
+ *
4
+ * 使用说明:在 tsconfig.json 中配置 typeRoots 或通过三斜线引用此文件。
5
+ *
6
+ * 所有类型均声明为全局类型(declare),在 Photoshop ExtendScript 环境中可直接使用。
7
+ *
8
+ * @example
9
+ * // 在 JSX 脚本中
10
+ * var doc = app.activeDocument;
11
+ * var layer = doc.activeLayer;
12
+ */
13
+
14
+ /// <reference path="./enums.d.ts" />
15
+ /// <reference path="./color.d.ts" />
16
+ /// <reference path="./channel.d.ts" />
17
+ /// <reference path="./selection.d.ts" />
18
+ /// <reference path="./path.d.ts" />
19
+ /// <reference path="./text.d.ts" />
20
+ /// <reference path="./layer.d.ts" />
21
+ /// <reference path="./actions.d.ts" />
22
+ /// <reference path="./save-options.d.ts" />
23
+ /// <reference path="./open-options.d.ts" />
24
+ /// <reference path="./misc.d.ts" />
25
+ /// <reference path="./document.d.ts" />
26
+ /// <reference path="./application.d.ts" />
27
+
28
+ // ============================================================
29
+ // 全局变量声明(Photoshop ExtendScript 运行时注入)
30
+ // ============================================================
31
+
32
+ /** Photoshop 应用程序根对象 */
33
+ declare const app: Application;
34
+
35
+ /** 当前活动文档(等同于 app.activeDocument)*/
36
+ declare let activeDocument: Document;
37
+
38
+ // ============================================================
39
+ // Core 对象(ExtendScript 内置)
40
+ // ============================================================
41
+
42
+ /**
43
+ * 代表本地文件系统中的一个文件。
44
+ * 来源: https://theiviaxx.github.io/photoshop-docs/Core/File.html
45
+ */
46
+ declare class File {
47
+ readonly absoluteURI: string;
48
+ readonly alias: boolean;
49
+ readonly created: Date | null;
50
+ readonly creator: string;
51
+ readonly displayName: string;
52
+ encoding: string;
53
+ readonly eof: boolean;
54
+ readonly error: string;
55
+ readonly exists: boolean;
56
+ readonly fsName: string;
57
+ readonly fullName: string;
58
+ readonly hidden: boolean;
59
+ readonly length: number;
60
+ lineFeed: string;
61
+ readonly modified: Date | null;
62
+ readonly name: string;
63
+ readonly parent: Folder;
64
+ readonly path: string;
65
+ readonly readonly: boolean;
66
+ readonly relativeURI: string;
67
+ readonly type: string;
68
+ static readonly fs: string;
69
+
70
+ constructor(path?: string);
71
+
72
+ changePath(path: string): boolean;
73
+ close(): boolean;
74
+ copy(destination: string): boolean;
75
+ createAlias(path?: string): boolean;
76
+ execute(): boolean;
77
+ getRelativeURI(baseURI?: string): string;
78
+ open(mode: string, type?: string, creator?: string): boolean;
79
+ openDlg(prompt?: string, filter?: string, multiSelect?: boolean): File | File[] | null;
80
+ read(): string;
81
+ readch(): string;
82
+ readln(): string;
83
+ remove(): boolean;
84
+ rename(newName: string): boolean;
85
+ resolve(): File | null;
86
+ saveDlg(prompt?: string, filter?: string): File | null;
87
+ seek(pos: number, mode?: number): boolean;
88
+ tell(): number;
89
+ toSource(): string;
90
+ toString(): string;
91
+ write(text: string): boolean;
92
+ writeln(text: string): boolean;
93
+
94
+ static decode(uri: string): string;
95
+ static encode(name: string): string;
96
+ static isEncodingAvailable(name: string): boolean;
97
+ static openDialog(prompt?: string, filter?: string, multiSelect?: boolean): File | File[] | null;
98
+ static saveDialog(prompt?: string, filter?: string): File | null;
99
+ }
100
+
101
+ /**
102
+ * 代表文件系统中的文件夹或目录。
103
+ * 来源: https://theiviaxx.github.io/photoshop-docs/Core/Folder.html
104
+ */
105
+ declare class Folder {
106
+ readonly absoluteURI: string;
107
+ readonly alias: boolean;
108
+ readonly created: Date | null;
109
+ readonly displayName: string;
110
+ readonly error: string;
111
+ readonly exists: boolean;
112
+ readonly fsName: string;
113
+ readonly fullName: string;
114
+ readonly modified: Date | null;
115
+ readonly name: string;
116
+ readonly parent: Folder | null;
117
+ readonly path: string;
118
+ readonly relativeURI: string;
119
+
120
+ static readonly appData: Folder;
121
+ static readonly appPackage: Folder;
122
+ static readonly commonFiles: Folder;
123
+ static current: Folder;
124
+ static readonly desktop: Folder;
125
+ static readonly fs: string;
126
+ static readonly myDocuments: Folder;
127
+ static readonly startup: Folder;
128
+ static readonly system: Folder;
129
+ static readonly temp: Folder;
130
+ static readonly trash: Folder | null;
131
+ static readonly userData: Folder;
132
+
133
+ constructor(path?: string);
134
+
135
+ changePath(path: string): boolean;
136
+ create(): boolean;
137
+ execute(): boolean;
138
+ getFiles(mask?: string | Function): (File | Folder)[];
139
+ getRelativeURI(baseURI?: string): string;
140
+ remove(): boolean;
141
+ rename(newName: string): boolean;
142
+ resolve(): Folder | null;
143
+ selectDlg(prompt?: string): Folder | null;
144
+ toSource(): string;
145
+ toString(): string;
146
+
147
+ static decode(uri: string): string;
148
+ static encode(name: string): string;
149
+ static isEncodingAvailable(name: string): boolean;
150
+ static selectDialog(prompt?: string): Folder | null;
151
+ }
152
+
153
+ // ============================================================
154
+ // 其他未覆盖枚举的占位符声明(避免编译错误)
155
+ // ============================================================
156
+
157
+ declare enum WarpStyle {
158
+ ARC = 1,
159
+ ARCH = 2,
160
+ ARCLOWER = 3,
161
+ ARCUPPER = 4,
162
+ BULGE = 5,
163
+ FISH = 6,
164
+ FISHEYE = 7,
165
+ FLAG = 8,
166
+ INFLATE = 9,
167
+ NONE = 16,
168
+ RISE = 10,
169
+ SHELLLOWER = 11,
170
+ SHELLUPPER = 12,
171
+ SQUEEZE = 13,
172
+ TWIST = 14,
173
+ WAVE = 15,
174
+ }
175
+
176
+ declare enum PaintingCursors {
177
+ BRUSHSIZE = 3,
178
+ PRECISE = 2,
179
+ STANDARD = 1,
180
+ }
181
+ declare enum OtherPaintingCursors {
182
+ PRECISE = 2,
183
+ STANDARD = 1,
184
+ }
185
+ declare enum ColorPicker {
186
+ ADOBE = 1,
187
+ APPLE = 2,
188
+ PLUGIN = 4,
189
+ WINDOWS = 3,
190
+ }
191
+ declare enum FontPreviewType {
192
+ EXTRA_LARGE = 5,
193
+ HUGE = 6,
194
+ LARGE = 4,
195
+ MEDIUM = 3,
196
+ NONE = 1,
197
+ SMALL = 2,
198
+ }
199
+ declare enum FontSize {
200
+ LARGE = 3,
201
+ MEDIUM = 2,
202
+ SMALL = 1,
203
+ }
204
+ declare enum GridSize {
205
+ LARGE = 4,
206
+ MEDIUM = 3,
207
+ NONE = 1,
208
+ SMALL = 2,
209
+ }
210
+ declare enum GridLineStyle {
211
+ DASHED = 2,
212
+ DOTTED = 3,
213
+ SOLID = 1,
214
+ }
215
+ declare enum GuideLineStyle {
216
+ DASHED = 2,
217
+ SOLID = 1,
218
+ }
219
+ declare enum PointType {
220
+ POSTSCRIPT = 2,
221
+ TRADITIONAL = 1,
222
+ }
223
+ declare enum ToolType {
224
+ ARTHISTORYBRUSH = 9,
225
+ BACKGROUNDERASER = 3,
226
+ BLUR = 11,
227
+ BRUSH = 2,
228
+ BURN = 14,
229
+ CLONESTAMP = 5,
230
+ COLORREPLACEMENTTOOL = 16,
231
+ DODGE = 13,
232
+ ERASER = 4,
233
+ HEALINGBRUSH = 7,
234
+ HISTORYBRUSH = 8,
235
+ PATTERNSTAMP = 6,
236
+ PENCIL = 1,
237
+ SHARPEN = 12,
238
+ SMUDGE = 10,
239
+ SPONGE = 15,
240
+ }
241
+ declare enum ShapeOperation {
242
+ SHAPEADD = 1,
243
+ SHAPEINTERSECT = 3,
244
+ SHAPESUBTRACT = 2,
245
+ SHAPEXOR = 4,
246
+ }
247
+ declare enum NoiseDistribution {
248
+ GAUSSIAN = 2,
249
+ UNIFORM = 1,
250
+ }
251
+ declare enum LensType {
252
+ MOVIEPRIME = 3,
253
+ PRIME105 = 2,
254
+ PRIME35 = 1,
255
+ ZOOMLENS = 4,
256
+ }
257
+ declare enum RadialBlurMethod {
258
+ SPIN = 1,
259
+ ZOOM = 2,
260
+ }
261
+ declare enum RadialBlurQuality {
262
+ BEST = 3,
263
+ DRAFT = 1,
264
+ GOOD = 2,
265
+ }
266
+ declare enum SmartBlurQuality {
267
+ HIGH = 3,
268
+ LOW = 1,
269
+ MEDIUM = 2,
270
+ }
271
+ declare enum SmartBlurMode {
272
+ EDGEONLY = 2,
273
+ NORMAL = 1,
274
+ OVERLAYEDGE = 3,
275
+ }
276
+ declare enum SpherizeMode {
277
+ HORIZONTAL = 2,
278
+ NORMAL = 1,
279
+ VERTICAL = 3,
280
+ }
281
+ declare enum OffsetUndefinedAreas {
282
+ REPEATEDGEPIXELS = 3,
283
+ SETTOBACKGROUND = 1,
284
+ WRAPAROUND = 2,
285
+ }
286
+ declare enum FileNamingType {
287
+ DDMM = 8,
288
+ DDMMYY = 9,
289
+ DOCUMENTNAMELOWER = 2,
290
+ DOCUMENTNAMEMIXED = 1,
291
+ DOCUMENTNAMEUPPER = 3,
292
+ EXTENSIONLOWER = 17,
293
+ EXTENSIONUPPER = 18,
294
+ MMDD = 6,
295
+ MMDDYY = 7,
296
+ SERIALLETTERALPHA = 14,
297
+ SERIALLETTERUPPER = 13,
298
+ SERIALNUMBER1 = 10,
299
+ SERIALNUMBER2 = 11,
300
+ SERIALNUMBER3 = 12,
301
+ SERIALNUMBER4 = 15,
302
+ NONE = 16,
303
+ YYDDMM = 5,
304
+ YYMMDD = 4,
305
+ }
306
+ declare enum BatchDestinationType {
307
+ FOLDER = 3,
308
+ NODESTINATION = 1,
309
+ SAVEANDCLOSE = 2,
310
+ }
311
+ declare enum ColorSpaceType {
312
+ ADOBE_RGB = 1,
313
+ COLORMATCH_RGB = 3,
314
+ PROPHOTO_RGB = 4,
315
+ SRGB = 2,
316
+ }
317
+ declare enum Language {
318
+ BRAZILLIANPORTUGUESE = 13,
319
+ CANADIANFRENCH = 4,
320
+ DANISH = 17,
321
+ DUTCH = 16,
322
+ ENGLISHUK = 2,
323
+ ENGLISHUSA = 1,
324
+ FINNISH = 18,
325
+ FRENCH = 3,
326
+ GERMAN = 5,
327
+ ITALIAN = 9,
328
+ JAPANESE = 14,
329
+ NORWEGIAN = 19,
330
+ NYNORSKNORWEGIAN = 20,
331
+ OLDGERMAN = 6,
332
+ POLISH = 15,
333
+ PORTUGUESE = 12,
334
+ SPANISH = 10,
335
+ STANDARDFRENCH = 4,
336
+ STANDARDGERMAN = 5,
337
+ STANDARDPORTUGUESE = 11,
338
+ SWEDISH = 21,
339
+ SWISSGERMAN = 7,
340
+ UKENGLISH = 2,
341
+ USENGLISH = 1,
342
+ }
343
+ declare enum CopyrightedType {
344
+ COPYRIGHTEDWORK = 1,
345
+ PUBLICDOMAIN = 2,
346
+ UNMARKED = 3,
347
+ }
348
+ declare enum Urgency {
349
+ FOUR = 4,
350
+ HIGH = 8,
351
+ LOW = 1,
352
+ NONE = 0,
353
+ NORMAL = 5,
354
+ THREE = 3,
355
+ TWO = 2,
356
+ URGENT = 7,
357
+ }
358
+ declare enum Intent {
359
+ ABSOLUTECOLORIMETRIC = 4,
360
+ PERCEPTUAL = 1,
361
+ RELATIVECOLORIMETRIC = 3,
362
+ SATURATION = 2,
363
+ }
364
+ declare enum SourceSpaceType {
365
+ DOCUMENT = 1,
366
+ PROOF = 2,
367
+ }
368
+ declare enum MeasurementRange {
369
+ ALLMEASUREMENTS = 1,
370
+ ACTIVEMEASUREMENTS = 2,
371
+ }
372
+ declare enum MeasurementSource {
373
+ MEASURECURRENTIMAGE = 3,
374
+ MEASUREMENTLOG = 1,
375
+ MEASURESELECTEDLAYERS = 2,
376
+ }
377
+ declare enum EditLogItemsType {
378
+ CONCISE = 2,
379
+ DETAILED = 3,
380
+ SESSIONONLY = 1,
381
+ }
382
+ declare enum SaveLogItemsType {
383
+ LOGFILE = 2,
384
+ LOGFILEANDMETADATA = 3,
385
+ METADATA = 1,
386
+ }
387
+ declare enum MacPreviewType {
388
+ EIGHTBITIIFF = 3,
389
+ MACOSPICT = 4,
390
+ MONOIIFF = 2,
391
+ NONE = 1,
392
+ }
393
+ declare enum MacExtensionType {
394
+ ALWAYS = 3,
395
+ NEVER = 2,
396
+ USE_DEFAULT = 1,
397
+ }
398
+ declare enum SaveBehavior {
399
+ ALWAYSSAVE = 3,
400
+ ASKSAVE = 2,
401
+ NEVERSAVE = 1,
402
+ }
403
+ declare enum QueryStateType {
404
+ ALWAYS = 1,
405
+ ASK = 2,
406
+ NEVER = 3,
407
+ }
408
+ declare enum PaletteType {
409
+ ADAPTIVE = 5,
410
+ BLACKBODY = 11,
411
+ CUSTOM = 10,
412
+ EXACT = 1,
413
+ MACOSPALETTE = 2,
414
+ PERCEPTUAL = 6,
415
+ PREVIOUSPALETTE = 12,
416
+ RESTRICTEDCOLORS = 3,
417
+ SELECTIVE = 7,
418
+ SPECTRUM = 12,
419
+ UNIFORM = 4,
420
+ WEBPALETTE = 9,
421
+ WINDOWSPALETTE = 2,
422
+ }
423
+ declare enum DitherType {
424
+ DIFFUSION = 3,
425
+ NOISE = 2,
426
+ NONE = 1,
427
+ PATTERN = 2,
428
+ }
429
+ declare enum SaveEncoding {
430
+ BINARY = 1,
431
+ JPEGLOW = 5,
432
+ JPEGMEDIUM = 6,
433
+ JPEGHIGH = 7,
434
+ JPEGMAXIMUM = 8,
435
+ ASCII = 2,
436
+ ASCIIINTERCALATED = 3,
437
+ BINARYFLOAT = 4,
438
+ }
439
+ declare enum OperatingSystem {
440
+ OS2 = 1,
441
+ WINDOWS = 2,
442
+ }
443
+ declare enum TargaBitsPerPixels {
444
+ SIXTEEN = 16,
445
+ THIRTYTWO = 32,
446
+ TWENTYFOUR = 24,
447
+ }
448
+ declare enum DCSType {
449
+ COLORCOMPOSITE = 3,
450
+ GRAYSCALECOMPOSITE = 2,
451
+ NOCOMPOSITE = 1,
452
+ }
453
+ declare enum PDFCompatibilityType {
454
+ PDF13 = 1,
455
+ PDF14 = 2,
456
+ PDF15 = 3,
457
+ PDF16 = 4,
458
+ PDF17 = 5,
459
+ }
460
+ declare enum PDFEncodingType {
461
+ JPEG = 2,
462
+ JPEGLOW = 6,
463
+ JPEGMEDIUM = 5,
464
+ JPEGHIGH = 4,
465
+ JPEGMAXIMUM = 3,
466
+ NONE = 0,
467
+ PDFZIP = 1,
468
+ PDFZIP4BIT = 7,
469
+ }
470
+ declare enum PDFResampleType {
471
+ NONE = 1,
472
+ PDFAVERAGE = 2,
473
+ PDFBICUBIC = 4,
474
+ PDFSUBSAMPLE = 3,
475
+ }
476
+ declare enum PDFStandardType {
477
+ NONE = 1,
478
+ PDFA1B = 3,
479
+ PDFX1A2001 = 4,
480
+ PDFX1A2003 = 5,
481
+ PDFX32002 = 6,
482
+ PDFX32003 = 7,
483
+ PDFX42007 = 8,
484
+ }
485
+ declare type PhotoCDColorSpace = any;
486
+ declare enum EliminateFields {
487
+ EVENFIELDS = 1,
488
+ ODDFIELDS = 2,
489
+ }
490
+ declare enum CreateFields {
491
+ DUPLICATION = 1,
492
+ INTERPOLATION = 2,
493
+ }
494
+ declare enum IllustratorPathType {
495
+ ALLPATHS = 2,
496
+ DOCUMENTBOUNDS = 1,
497
+ NAMEDPATH = 3,
498
+ }
499
+
500
+ // 源文件中未显式声明但被引用的占位类型
501
+ declare type CameraRAWSize = any;
502
+ declare type CameraRAWSettingsType = any;
503
+ declare type WhiteBalanceType = any;
504
+ declare type PrintColorHandling = any;