@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.
- package/LICENSE +21 -0
- package/dist/contract-C4vydf6-.d.ts +1270 -0
- package/dist/contract.d.ts +3 -0
- package/dist/contract.js +19 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2482 -0
- package/dist/index.js.map +1 -0
- package/jsx/Action/autoCutout.jsx +12 -0
- package/jsx/Action/redo.jsx +5 -0
- package/jsx/Action/removeBackground.jsx +10 -0
- package/jsx/Common/alert.jsx +4 -0
- package/jsx/Common/debug.jsx +43 -0
- package/jsx/Common/event-dispatch.jsx +4 -0
- package/jsx/Document/exportDocument.jsx +128 -0
- package/jsx/Document/getDocumentInfo.jsx +222 -0
- package/jsx/Document/openPsd.jsx +6 -0
- package/jsx/Document/openPsdFile.jsx +7 -0
- package/jsx/Document/saveDocument.jsx +37 -0
- package/jsx/Layer/addImageLayer.jsx +182 -0
- package/jsx/Layer/createSelectionStroke.jsx +44 -0
- package/jsx/Layer/getActiveLayerID.jsx +1 -0
- package/jsx/Layer/getLayerBounds.jsx +114 -0
- package/jsx/Layer/getLayerInfo.jsx +323 -0
- package/jsx/Layer/getLayerPixmap.jsx +337 -0
- package/jsx/Layer/getSelection.jsx +6 -0
- package/jsx/Layer/layer.jsx +284 -0
- package/jsx/Layer/saveEngineDataToLayer.jsx +26 -0
- package/jsx/Layer/setLayerWorkpathMask.jsx +126 -0
- package/jsx/Layer/transformLayer.jsx +121 -0
- package/jsx/Selection/getSelectionPath.jsx +389 -0
- package/jsx/Selection/pathtosvg.jsx +257 -0
- package/jsx/Selection/registerEvent.jsx +10 -0
- package/jsx/Selection/selectiontopath.jsx +9 -0
- package/jsx/polyfills/Array.js +159 -0
- package/jsx/polyfills/Function.js +29 -0
- package/jsx/polyfills/JSON.js +182 -0
- package/jsx/polyfills/Number.js +24 -0
- package/jsx/polyfills/Object.js +80 -0
- package/jsx/polyfills/String.js +87 -0
- package/jsx/types/extendscript/README.md +34 -0
- package/jsx/types/extendscript/actions.d.ts +148 -0
- package/jsx/types/extendscript/application.d.ts +74 -0
- package/jsx/types/extendscript/channel.d.ts +70 -0
- package/jsx/types/extendscript/color.d.ts +92 -0
- package/jsx/types/extendscript/document.d.ts +110 -0
- package/jsx/types/extendscript/enums.d.ts +796 -0
- package/jsx/types/extendscript/index.d.ts +504 -0
- package/jsx/types/extendscript/layer.d.ts +530 -0
- package/jsx/types/extendscript/misc.d.ts +274 -0
- package/jsx/types/extendscript/open-options.d.ts +86 -0
- package/jsx/types/extendscript/path.d.ts +196 -0
- package/jsx/types/extendscript/save-options.d.ts +144 -0
- package/jsx/types/extendscript/selection.d.ts +191 -0
- package/jsx/types/extendscript/text.d.ts +169 -0
- package/main.js +16 -0
- package/package.json +75 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region Object Polyfills (ES3 compatible)
|
|
2
|
+
|
|
3
|
+
// Object.keys
|
|
4
|
+
if (!Object.keys) {
|
|
5
|
+
Object.keys = function (obj) {
|
|
6
|
+
if (obj !== Object(obj)) {
|
|
7
|
+
throw new TypeError("Object.keys called on a non-object");
|
|
8
|
+
}
|
|
9
|
+
var result = [];
|
|
10
|
+
for (var key in obj) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
12
|
+
result.push(key);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Object.values
|
|
20
|
+
if (!Object.values) {
|
|
21
|
+
Object.values = function (obj) {
|
|
22
|
+
if (obj !== Object(obj)) {
|
|
23
|
+
throw new TypeError("Object.values called on a non-object");
|
|
24
|
+
}
|
|
25
|
+
var result = [];
|
|
26
|
+
for (var key in obj) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
28
|
+
result.push(obj[key]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Object.entries
|
|
36
|
+
if (!Object.entries) {
|
|
37
|
+
Object.entries = function (obj) {
|
|
38
|
+
if (obj !== Object(obj)) {
|
|
39
|
+
throw new TypeError("Object.entries called on a non-object");
|
|
40
|
+
}
|
|
41
|
+
var result = [];
|
|
42
|
+
for (var key in obj) {
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
44
|
+
result.push([key, obj[key]]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Object.assign
|
|
52
|
+
if (!Object.assign) {
|
|
53
|
+
Object.assign = function (target) {
|
|
54
|
+
if (target == null) {
|
|
55
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
56
|
+
}
|
|
57
|
+
var to = Object(target);
|
|
58
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
59
|
+
var source = arguments[i];
|
|
60
|
+
if (source != null) {
|
|
61
|
+
for (var key in source) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
63
|
+
to[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return to;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Object.freeze
|
|
73
|
+
if (!Object.freeze) {
|
|
74
|
+
Object.freeze = function (obj) {
|
|
75
|
+
// ES3 cannot truly freeze objects — return as-is (noop shim)
|
|
76
|
+
return obj;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//#region String Polyfills (ES3 compatible)
|
|
2
|
+
|
|
3
|
+
// String.prototype.trim
|
|
4
|
+
if (!String.prototype.trim) {
|
|
5
|
+
String.prototype.trim = function () {
|
|
6
|
+
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// String.prototype.startsWith
|
|
11
|
+
if (!String.prototype.startsWith) {
|
|
12
|
+
String.prototype.startsWith = function (searchString, position) {
|
|
13
|
+
var pos = position || 0;
|
|
14
|
+
return this.substring(pos, pos + searchString.length) === searchString;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// String.prototype.endsWith
|
|
19
|
+
if (!String.prototype.endsWith) {
|
|
20
|
+
String.prototype.endsWith = function (searchString, length) {
|
|
21
|
+
var len = typeof length === "number" ? length : this.length;
|
|
22
|
+
var end = len;
|
|
23
|
+
var start = end - searchString.length;
|
|
24
|
+
if (start < 0) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return this.substring(start, end) === searchString;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// String.prototype.includes
|
|
32
|
+
if (!String.prototype.includes) {
|
|
33
|
+
String.prototype.includes = function (search, start) {
|
|
34
|
+
if (typeof start !== "number") {
|
|
35
|
+
start = 0;
|
|
36
|
+
}
|
|
37
|
+
if (start + search.length > this.length) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return this.indexOf(search, start) !== -1;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// String.prototype.repeat
|
|
45
|
+
if (!String.prototype.repeat) {
|
|
46
|
+
String.prototype.repeat = function (count) {
|
|
47
|
+
var n = Math.floor(Number(count));
|
|
48
|
+
if (n < 0 || n === Infinity) {
|
|
49
|
+
throw new RangeError("Invalid count value");
|
|
50
|
+
}
|
|
51
|
+
var result = "";
|
|
52
|
+
var str = String(this);
|
|
53
|
+
while (n > 0) {
|
|
54
|
+
if (n % 2 === 1) {
|
|
55
|
+
result = result + str;
|
|
56
|
+
}
|
|
57
|
+
n = Math.floor(n / 2);
|
|
58
|
+
if (n > 0) {
|
|
59
|
+
str = str + str;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// String.prototype.padStart
|
|
67
|
+
if (!String.prototype.padStart) {
|
|
68
|
+
String.prototype.padStart = function (targetLength, padString) {
|
|
69
|
+
var str = String(this);
|
|
70
|
+
targetLength = targetLength >> 0;
|
|
71
|
+
if (str.length >= targetLength) {
|
|
72
|
+
return str;
|
|
73
|
+
}
|
|
74
|
+
var pad = typeof padString !== "undefined" ? String(padString) : " ";
|
|
75
|
+
if (pad.length === 0) {
|
|
76
|
+
return str;
|
|
77
|
+
}
|
|
78
|
+
var needed = targetLength - str.length;
|
|
79
|
+
var full = "";
|
|
80
|
+
while (full.length < needed) {
|
|
81
|
+
full = full + pad;
|
|
82
|
+
}
|
|
83
|
+
return full.substring(0, needed) + str;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ExtendScript ambient type declarations
|
|
2
|
+
|
|
3
|
+
Ambient (`declare`) type declarations for the Photoshop ExtendScript runtime DOM
|
|
4
|
+
— the global `app`, `File`/`Folder`, `Document`, `Layer`, `RGBColor`, the enum
|
|
5
|
+
constants, and so on. Sourced from the Photoshop scripting reference
|
|
6
|
+
(https://theiviaxx.github.io/photoshop-docs/).
|
|
7
|
+
|
|
8
|
+
## Status: reference only — not compiled
|
|
9
|
+
|
|
10
|
+
These declarations are **not wired into any `tsconfig`**. The packaged `.jsx`
|
|
11
|
+
files under `jsx/` are authored as plain ExtendScript and are not type-checked by
|
|
12
|
+
the build (`tsconfig.json` includes only `src`, `test`, and `jsx/polyfills`).
|
|
13
|
+
|
|
14
|
+
They are kept here as:
|
|
15
|
+
|
|
16
|
+
- a reference while hand-writing `.jsx` files, and
|
|
17
|
+
- ready material for a future opt-in JSX type-checking pass (a separate
|
|
18
|
+
`tsconfig` with `allowJs`/`checkJs` over `jsx/**/*.jsx` that loads these
|
|
19
|
+
globals).
|
|
20
|
+
|
|
21
|
+
Because every file uses `declare` (global) declarations, they must **not** be
|
|
22
|
+
added to a `tsconfig` that compiles consumer-facing code — doing so would inject
|
|
23
|
+
`app`, `File`, `RGBColor`, etc. into that project's global scope. To use them
|
|
24
|
+
manually, reference the barrel from a single jsx-authoring `tsconfig`:
|
|
25
|
+
|
|
26
|
+
```jsonc
|
|
27
|
+
// e.g. a dedicated jsx/tsconfig.json (not created yet)
|
|
28
|
+
{
|
|
29
|
+
"compilerOptions": { "allowJs": true, "checkJs": true, "noEmit": true },
|
|
30
|
+
"include": ["**/*.jsx", "types/extendscript/index.d.ts"],
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`index.d.ts` is the triple-slash aggregator that pulls in every sibling `.d.ts`.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photoshop Action Manager 类型声明
|
|
3
|
+
* 来源: https://theiviaxx.github.io/photoshop-docs/Photoshop/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================================
|
|
7
|
+
// ActionDescriptor
|
|
8
|
+
// ============================================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Action Manager 的核心类,包含键值对的记录,用于定义和存储动作。
|
|
12
|
+
* 用于 app.executeAction() 和 app.executeActionGet()。
|
|
13
|
+
*/
|
|
14
|
+
declare class ActionDescriptor {
|
|
15
|
+
/** 描述符中包含的键的数量(只读)*/
|
|
16
|
+
readonly count: number;
|
|
17
|
+
|
|
18
|
+
/** 清空描述符 */
|
|
19
|
+
clear(): void;
|
|
20
|
+
|
|
21
|
+
/** 判断描述符是否包含指定键 */
|
|
22
|
+
hasKey(key: number): boolean;
|
|
23
|
+
|
|
24
|
+
/** 获取键对应的值类型 */
|
|
25
|
+
getType(key: number): DescValueType;
|
|
26
|
+
|
|
27
|
+
// Getter 方法
|
|
28
|
+
getBoolean(key: number): boolean;
|
|
29
|
+
getClass(key: number): number;
|
|
30
|
+
getData(key: number): string;
|
|
31
|
+
getDouble(key: number): number;
|
|
32
|
+
getEnumerationType(key: number): number;
|
|
33
|
+
getEnumerationValue(key: number): number;
|
|
34
|
+
getInteger(key: number): number;
|
|
35
|
+
getLargeInteger(key: number): number;
|
|
36
|
+
getList(key: number): ActionList;
|
|
37
|
+
getObjectType(key: number): number;
|
|
38
|
+
getObjectValue(key: number): ActionDescriptor;
|
|
39
|
+
getPath(key: number): File;
|
|
40
|
+
getReference(key: number): ActionReference;
|
|
41
|
+
getString(key: number): string;
|
|
42
|
+
getUnitDoubleType(key: number): number;
|
|
43
|
+
getUnitDoubleValue(key: number): number;
|
|
44
|
+
|
|
45
|
+
// Setter 方法
|
|
46
|
+
putBoolean(key: number, value: boolean): void;
|
|
47
|
+
putClass(key: number, value: number): void;
|
|
48
|
+
putData(key: number, value: string): void;
|
|
49
|
+
putDouble(key: number, value: number): void;
|
|
50
|
+
putEnumerated(key: number, enumType: number, value: number): void;
|
|
51
|
+
putInteger(key: number, value: number): void;
|
|
52
|
+
putLargeInteger(key: number, value: number): void;
|
|
53
|
+
putList(key: number, value: ActionList): void;
|
|
54
|
+
putObject(key: number, type: number, value: ActionDescriptor): void;
|
|
55
|
+
putPath(key: number, value: File): void;
|
|
56
|
+
putReference(key: number, value: ActionReference): void;
|
|
57
|
+
putString(key: number, value: string): void;
|
|
58
|
+
putUnitDouble(key: number, unitID: number, value: number): void;
|
|
59
|
+
|
|
60
|
+
/** 返回描述符中位置为 index 的键 */
|
|
61
|
+
getKey(index: number): number;
|
|
62
|
+
|
|
63
|
+
/** 将描述符序列化为字符串 */
|
|
64
|
+
toStream(): string;
|
|
65
|
+
|
|
66
|
+
/** 从字符串反序列化描述符 */
|
|
67
|
+
fromStream(stream: string): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ============================================================
|
|
71
|
+
// ActionList
|
|
72
|
+
// ============================================================
|
|
73
|
+
|
|
74
|
+
/** Action Manager 的列表容器,存储一系列值。*/
|
|
75
|
+
declare class ActionList {
|
|
76
|
+
/** 列表中的元素数量(只读)*/
|
|
77
|
+
readonly count: number;
|
|
78
|
+
|
|
79
|
+
/** 获取指定索引的值类型 */
|
|
80
|
+
getType(index: number): DescValueType;
|
|
81
|
+
|
|
82
|
+
// Getter 方法
|
|
83
|
+
getBoolean(index: number): boolean;
|
|
84
|
+
getClass(index: number): number;
|
|
85
|
+
getData(index: number): string;
|
|
86
|
+
getDouble(index: number): number;
|
|
87
|
+
getEnumerationType(index: number): number;
|
|
88
|
+
getEnumerationValue(index: number): number;
|
|
89
|
+
getInteger(index: number): number;
|
|
90
|
+
getLargeInteger(index: number): number;
|
|
91
|
+
getList(index: number): ActionList;
|
|
92
|
+
getObjectType(index: number): number;
|
|
93
|
+
getObjectValue(index: number): ActionDescriptor;
|
|
94
|
+
getPath(index: number): File;
|
|
95
|
+
getReference(index: number): ActionReference;
|
|
96
|
+
getString(index: number): string;
|
|
97
|
+
getUnitDoubleType(index: number): number;
|
|
98
|
+
getUnitDoubleValue(index: number): number;
|
|
99
|
+
|
|
100
|
+
// Putter 方法(附加到末尾)
|
|
101
|
+
putBoolean(value: boolean): void;
|
|
102
|
+
putClass(value: number): void;
|
|
103
|
+
putData(value: string): void;
|
|
104
|
+
putDouble(value: number): void;
|
|
105
|
+
putEnumerated(enumType: number, value: number): void;
|
|
106
|
+
putInteger(value: number): void;
|
|
107
|
+
putLargeInteger(value: number): void;
|
|
108
|
+
putList(value: ActionList): void;
|
|
109
|
+
putObject(type: number, value: ActionDescriptor): void;
|
|
110
|
+
putPath(value: File): void;
|
|
111
|
+
putReference(value: ActionReference): void;
|
|
112
|
+
putString(value: string): void;
|
|
113
|
+
putUnitDouble(unitID: number, value: number): void;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ============================================================
|
|
117
|
+
// ActionReference
|
|
118
|
+
// ============================================================
|
|
119
|
+
|
|
120
|
+
/** Action Manager 的引用对象,用于引用文档中的特定元素。*/
|
|
121
|
+
declare class ActionReference {
|
|
122
|
+
/** 获取此引用的容器 */
|
|
123
|
+
getContainer(): ActionReference;
|
|
124
|
+
|
|
125
|
+
/** 获取引用表示类型 */
|
|
126
|
+
getForm(): ReferenceFormType;
|
|
127
|
+
|
|
128
|
+
/** 获取引用的实际对象类型 */
|
|
129
|
+
getDesiredClass(): number;
|
|
130
|
+
|
|
131
|
+
// 获取各种类型的引用值
|
|
132
|
+
getEnumerationType(): number;
|
|
133
|
+
getEnumerationValue(): number;
|
|
134
|
+
getIdentifier(): number;
|
|
135
|
+
getIndex(): number;
|
|
136
|
+
getName(): string;
|
|
137
|
+
getOffset(): number;
|
|
138
|
+
getProperty(): number;
|
|
139
|
+
|
|
140
|
+
// 设置各种类型的引用值
|
|
141
|
+
putClass(value: number): void;
|
|
142
|
+
putEnumerated(desiredClass: number, enumType: number, value: number): void;
|
|
143
|
+
putIdentifier(desiredClass: number, value: number): void;
|
|
144
|
+
putIndex(desiredClass: number, value: number): void;
|
|
145
|
+
putName(desiredClass: number, value: string): void;
|
|
146
|
+
putOffset(desiredClass: number, value: number): void;
|
|
147
|
+
putProperty(desiredClass: number, value: number): void;
|
|
148
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photoshop Application 类型声明
|
|
3
|
+
* 来源: https://theiviaxx.github.io/photoshop-docs/Photoshop/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare class Application {
|
|
7
|
+
activeDocument: Document;
|
|
8
|
+
backgroundColor: SolidColor;
|
|
9
|
+
readonly build: string;
|
|
10
|
+
colorSettings: string;
|
|
11
|
+
currentTool: string;
|
|
12
|
+
displayDialogs: DialogModes;
|
|
13
|
+
readonly documents: Documents;
|
|
14
|
+
readonly fonts: TextFonts;
|
|
15
|
+
foregroundColor: SolidColor;
|
|
16
|
+
readonly freeMemory: number;
|
|
17
|
+
readonly locale: string;
|
|
18
|
+
readonly macintoshFileTypes: string[];
|
|
19
|
+
readonly measurementLog: MeasurementLog;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly notifiers: Notifiers;
|
|
22
|
+
notifiersEnabled: boolean;
|
|
23
|
+
readonly parent: any;
|
|
24
|
+
readonly path: File;
|
|
25
|
+
readonly playbackDisplayDialogs: DialogModes;
|
|
26
|
+
readonly playbackParameters: ActionDescriptor;
|
|
27
|
+
readonly preferences: Preferences;
|
|
28
|
+
readonly preferencesFolder: Folder;
|
|
29
|
+
readonly recentFiles: File[];
|
|
30
|
+
readonly scriptingBuildDate: string;
|
|
31
|
+
readonly scriptingVersion: string;
|
|
32
|
+
readonly systemInformation: string;
|
|
33
|
+
readonly typename: string;
|
|
34
|
+
readonly version: string;
|
|
35
|
+
readonly windowsFileTypes: string[];
|
|
36
|
+
|
|
37
|
+
batch(inputFiles: File[], action: string, from: string, options?: BatchOptions): string;
|
|
38
|
+
beep(): void;
|
|
39
|
+
bringToFront(): void;
|
|
40
|
+
changeProgressText(progressString: string): void;
|
|
41
|
+
charIDToTypeID(charID: string): number;
|
|
42
|
+
doAction(action: string, from: string): void;
|
|
43
|
+
doForcedProgress(taskName: string, func: Function): void;
|
|
44
|
+
doProgress(progressString: string, func: Function): void;
|
|
45
|
+
eraseCustomOptions(key: string): void;
|
|
46
|
+
executeAction(
|
|
47
|
+
eventID: number,
|
|
48
|
+
descriptor?: ActionDescriptor,
|
|
49
|
+
displayDialogs?: DialogModes
|
|
50
|
+
): ActionDescriptor;
|
|
51
|
+
executeActionGet(reference: ActionReference): ActionDescriptor;
|
|
52
|
+
featureEnabled(name: string): boolean;
|
|
53
|
+
getCustomOptions(key: string): ActionDescriptor;
|
|
54
|
+
isQuicktimeAvailable(): boolean;
|
|
55
|
+
load(document: File): void;
|
|
56
|
+
makeContactSheet(inputFiles: File[], options?: any): string;
|
|
57
|
+
makePDFPresentation(inputFiles: File[], outputFile: File, options?: any): string;
|
|
58
|
+
makePicturePackage(inputFiles?: File[], options?: any): string;
|
|
59
|
+
open(document: File, openAs?: OpenDocumentType, openOptions?: any): Document;
|
|
60
|
+
openDialog(): File[];
|
|
61
|
+
purge(target: PurgeTarget): void;
|
|
62
|
+
putCustomOptions(key: string, customObject: ActionDescriptor, persistent?: boolean): void;
|
|
63
|
+
refresh(): void;
|
|
64
|
+
refreshFonts(): void;
|
|
65
|
+
runMenuItem(menuID: number): void;
|
|
66
|
+
showColorPicker(): boolean;
|
|
67
|
+
stringIDToTypeID(stringID: string): number;
|
|
68
|
+
system(callString: string): number;
|
|
69
|
+
togglePalettes(): void;
|
|
70
|
+
toolSupportsBrushes(tool: string): boolean;
|
|
71
|
+
typeIDToCharID(typeID: number): string;
|
|
72
|
+
typeIDToStringID(typeID: number): string;
|
|
73
|
+
updateProgress(done: number, total: number): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photoshop 通道类型声明
|
|
3
|
+
* 来源: https://theiviaxx.github.io/photoshop-docs/Photoshop/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 存储图像颜色元素信息的通道对象。
|
|
8
|
+
* 文档的颜色模式决定了默认通道的数量。
|
|
9
|
+
*/
|
|
10
|
+
declare class Channel {
|
|
11
|
+
/** 通道的颜色(对组件通道无效)*/
|
|
12
|
+
color: SolidColor;
|
|
13
|
+
/** 通道颜色的直方图(只读)*/
|
|
14
|
+
readonly histogram: number[];
|
|
15
|
+
/** 通道的类型(只读)*/
|
|
16
|
+
readonly kind: ChannelType;
|
|
17
|
+
/** 通道的名称 */
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Alpha 通道的不透明度(对专色通道称为 solidity)。
|
|
21
|
+
* 范围:0 到 100。仅当类型为 masked area 或 selected area 时有效。
|
|
22
|
+
*/
|
|
23
|
+
opacity: number;
|
|
24
|
+
/** 对象的容器(只读)*/
|
|
25
|
+
readonly parent: Document;
|
|
26
|
+
/** 对象的类名(只读)*/
|
|
27
|
+
readonly typename: string;
|
|
28
|
+
/** 如果为 true,则通道可见 */
|
|
29
|
+
visible: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 复制该通道。
|
|
33
|
+
* @param targetDocument 目标文档(可选)
|
|
34
|
+
* @param placement 放置位置(可选)
|
|
35
|
+
*/
|
|
36
|
+
duplicate(targetDocument?: Document, placement?: ElementPlacement): Channel;
|
|
37
|
+
|
|
38
|
+
/** 将专色通道合并到组件通道中 */
|
|
39
|
+
merge(): void;
|
|
40
|
+
|
|
41
|
+
/** 删除此通道 */
|
|
42
|
+
remove(): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 通道集合 */
|
|
46
|
+
declare class Channels {
|
|
47
|
+
/** 通道数量(只读)*/
|
|
48
|
+
readonly length: number;
|
|
49
|
+
/** 对象的容器(只读)*/
|
|
50
|
+
readonly parent: Document;
|
|
51
|
+
/** 对象的类名(只读)*/
|
|
52
|
+
readonly typename: string;
|
|
53
|
+
/** 通过索引访问通道 */
|
|
54
|
+
[index: number]: Channel;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 添加一个新通道。
|
|
58
|
+
* @returns 新创建的通道
|
|
59
|
+
*/
|
|
60
|
+
add(): Channel;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 通过名称获取通道。
|
|
64
|
+
* @param name 通道名称
|
|
65
|
+
*/
|
|
66
|
+
getByName(name: string): Channel;
|
|
67
|
+
|
|
68
|
+
/** 删除所有通道 */
|
|
69
|
+
removeAll(): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photoshop 颜色类型声明
|
|
3
|
+
* 来源: https://theiviaxx.github.io/photoshop-docs/Photoshop/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================================
|
|
7
|
+
// 颜色分量类
|
|
8
|
+
// ============================================================
|
|
9
|
+
|
|
10
|
+
/** RGB 颜色模型 */
|
|
11
|
+
declare class RGBColor {
|
|
12
|
+
/** 蓝色通道值。范围:0.0 到 255.0 */
|
|
13
|
+
blue: number;
|
|
14
|
+
/** 绿色通道值。范围:0.0 到 255.0 */
|
|
15
|
+
green: number;
|
|
16
|
+
/** 十六进制颜色字符串(例如 "ff0000")*/
|
|
17
|
+
hexValue: string;
|
|
18
|
+
/** 红色通道值。范围:0.0 到 255.0 */
|
|
19
|
+
red: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** CMYK 颜色模型 */
|
|
23
|
+
declare class CMYKColor {
|
|
24
|
+
/** 黑色(K)通道值。范围:0.0 到 100.0 */
|
|
25
|
+
black: number;
|
|
26
|
+
/** 青色通道值。范围:0.0 到 100.0 */
|
|
27
|
+
cyan: number;
|
|
28
|
+
/** 品红色通道值。范围:0.0 到 100.0 */
|
|
29
|
+
magenta: number;
|
|
30
|
+
/** 黄色通道值。范围:0.0 到 100.0 */
|
|
31
|
+
yellow: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** HSB 颜色模型 */
|
|
35
|
+
declare class HSBColor {
|
|
36
|
+
/** 亮度。范围:0.0 到 100.0 */
|
|
37
|
+
brightness: number;
|
|
38
|
+
/** 色相。范围:0.0 到 360.0 */
|
|
39
|
+
hue: number;
|
|
40
|
+
/** 饱和度。范围:0.0 到 100.0 */
|
|
41
|
+
saturation: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Lab 颜色模型 */
|
|
45
|
+
declare class LabColor {
|
|
46
|
+
/** A 通道值。范围:-128.0 到 127.0 */
|
|
47
|
+
a: number;
|
|
48
|
+
/** B 通道值。范围:-128.0 到 127.0 */
|
|
49
|
+
b: number;
|
|
50
|
+
/** 亮度(L)值。范围:0.0 到 100.0 */
|
|
51
|
+
l: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 灰度颜色模型 */
|
|
55
|
+
declare class GrayColor {
|
|
56
|
+
/** 灰度值。范围:0.0 到 100.0 */
|
|
57
|
+
gray: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 无颜色(透明)*/
|
|
61
|
+
declare class NoColor {}
|
|
62
|
+
|
|
63
|
+
// ============================================================
|
|
64
|
+
// SolidColor 主颜色类
|
|
65
|
+
// ============================================================
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 用于文档中的颜色定义。
|
|
69
|
+
* 可通过 rgb、cmyk、hsb、lab、gray 属性访问不同颜色模型。
|
|
70
|
+
*/
|
|
71
|
+
declare class SolidColor {
|
|
72
|
+
/** CMYK 颜色模型 */
|
|
73
|
+
cmyk: CMYKColor;
|
|
74
|
+
/** 灰度颜色模型 */
|
|
75
|
+
gray: GrayColor;
|
|
76
|
+
/** HSB 颜色模型 */
|
|
77
|
+
hsb: HSBColor;
|
|
78
|
+
/** Lab 颜色模型 */
|
|
79
|
+
lab: LabColor;
|
|
80
|
+
/** 颜色模型 */
|
|
81
|
+
model: ColorModel;
|
|
82
|
+
/** 最接近当前颜色的 Web 安全色(只读)*/
|
|
83
|
+
readonly nearestWebColor: RGBColor;
|
|
84
|
+
/** RGB 颜色模型 */
|
|
85
|
+
rgb: RGBColor;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 比较两种颜色是否相等。
|
|
89
|
+
* @param color 要比较的颜色
|
|
90
|
+
*/
|
|
91
|
+
isEqual(color: SolidColor): boolean;
|
|
92
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photoshop 文档类型声明
|
|
3
|
+
* 来源: https://theiviaxx.github.io/photoshop-docs/Photoshop/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare class Document {
|
|
7
|
+
activeChannels: Channel[];
|
|
8
|
+
readonly activeHistoryBrushSource: HistoryState;
|
|
9
|
+
activeHistoryState: HistoryState;
|
|
10
|
+
activeLayer: ArtLayer | LayerSet;
|
|
11
|
+
readonly artLayers: ArtLayers;
|
|
12
|
+
readonly backgroundLayer: ArtLayer;
|
|
13
|
+
bitsPerChannel: BitsPerChannelType;
|
|
14
|
+
readonly channels: Channels;
|
|
15
|
+
colorProfileName: string;
|
|
16
|
+
colorProfileType: ColorProfileType;
|
|
17
|
+
readonly colorSamplers: ColorSamplers;
|
|
18
|
+
readonly componentChannels: Channel[];
|
|
19
|
+
readonly countItems: CountItems;
|
|
20
|
+
readonly fullName: File;
|
|
21
|
+
readonly guides: Guides;
|
|
22
|
+
readonly height: number;
|
|
23
|
+
readonly histogram: number[];
|
|
24
|
+
readonly historyStates: HistoryStates;
|
|
25
|
+
readonly id: number;
|
|
26
|
+
readonly info: DocumentInfo;
|
|
27
|
+
readonly layerComps: LayerComps;
|
|
28
|
+
readonly layerSets: LayerSets;
|
|
29
|
+
readonly layers: Layers;
|
|
30
|
+
readonly managed: boolean;
|
|
31
|
+
readonly measurementScale: MeasurementScale;
|
|
32
|
+
readonly mode: DocumentMode;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly parent: Application;
|
|
35
|
+
readonly path: File;
|
|
36
|
+
readonly pathItems: PathItems;
|
|
37
|
+
readonly pixelAspectRatio: number;
|
|
38
|
+
readonly printSettings: DocumentPrintSettings;
|
|
39
|
+
quickMaskMode: boolean;
|
|
40
|
+
readonly resolution: number;
|
|
41
|
+
readonly saved: boolean;
|
|
42
|
+
readonly selection: Selection;
|
|
43
|
+
readonly typename: string;
|
|
44
|
+
readonly width: number;
|
|
45
|
+
readonly xmpMetadata: XMPMetadata;
|
|
46
|
+
|
|
47
|
+
autoCount(channel: Channel, merge: boolean): void;
|
|
48
|
+
changeMode(destinationMode: ChangeMode, options?: any): void;
|
|
49
|
+
close(saving?: SaveOptions): void;
|
|
50
|
+
convertProfile(
|
|
51
|
+
destinationProfile: string,
|
|
52
|
+
intent: Intent,
|
|
53
|
+
blackPointCompensation?: boolean,
|
|
54
|
+
dither?: boolean
|
|
55
|
+
): void;
|
|
56
|
+
crop(bounds: Rectangle, angle?: number, width?: number, height?: number): void;
|
|
57
|
+
duplicate(name?: string, mergeLayersOnly?: boolean): Document;
|
|
58
|
+
exportDocument(exportIn: File, exportAs?: ExportType, options?: ExportOptions): void;
|
|
59
|
+
flatten(): void;
|
|
60
|
+
flipCanvas(direction: Direction): void;
|
|
61
|
+
importAnnotations(from: File): void;
|
|
62
|
+
mergeVisibleLayers(): void;
|
|
63
|
+
paste(intoSelection?: boolean): ArtLayer;
|
|
64
|
+
print(
|
|
65
|
+
sourceSpace?: SourceSpaceType,
|
|
66
|
+
printSpace?: string,
|
|
67
|
+
intent?: Intent,
|
|
68
|
+
blackPointCompensation?: boolean
|
|
69
|
+
): void;
|
|
70
|
+
printOneCopy(): void;
|
|
71
|
+
rasterizeAllLayers(): void;
|
|
72
|
+
recordMeasurements(selection?: MeasurementSource, dataPoints?: string[]): void;
|
|
73
|
+
resizeCanvas(width: number, height: number, anchor?: AnchorPosition): void;
|
|
74
|
+
resizeImage(
|
|
75
|
+
width?: number,
|
|
76
|
+
height?: number,
|
|
77
|
+
resolution?: number,
|
|
78
|
+
resampleImage?: ResampleMethod,
|
|
79
|
+
amount?: number
|
|
80
|
+
): void;
|
|
81
|
+
revealAll(): void;
|
|
82
|
+
rotateCanvas(angle: number): void;
|
|
83
|
+
save(): void;
|
|
84
|
+
saveAs(saveIn: File, options?: any, asCopy?: boolean, extensionType?: MacExtensionType): void;
|
|
85
|
+
splitChannels(): Document[];
|
|
86
|
+
suspendHistory(historyString: string, javaScriptString: string): void;
|
|
87
|
+
trap(width: number): void;
|
|
88
|
+
trim(type?: TrimType, top?: boolean, left?: boolean, bottom?: boolean, right?: boolean): void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** 打开文档的集合 */
|
|
92
|
+
declare class Documents {
|
|
93
|
+
readonly length: number;
|
|
94
|
+
readonly parent: Application;
|
|
95
|
+
readonly typename: string;
|
|
96
|
+
[index: number]: Document;
|
|
97
|
+
|
|
98
|
+
add(
|
|
99
|
+
width?: number,
|
|
100
|
+
height?: number,
|
|
101
|
+
resolution?: number,
|
|
102
|
+
name?: string,
|
|
103
|
+
mode?: NewDocumentMode,
|
|
104
|
+
initialFill?: DocumentFill,
|
|
105
|
+
pixelAspectRatio?: number,
|
|
106
|
+
bitsPerChannel?: BitsPerChannelType,
|
|
107
|
+
colorProfileName?: string
|
|
108
|
+
): Document;
|
|
109
|
+
getByName(name: string): Document;
|
|
110
|
+
}
|