@bubblydoo/uxp-toolkit 0.0.4 → 0.0.6
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +80 -58
- package/dist/index.js +219 -188
- package/package.json +5 -2
- package/src/commands-library/getDocument.ts +36 -0
- package/src/commands-library/getDocument.txt +62 -0
- package/src/commands-library/getLayer.ts +56 -0
- package/src/commands-library/getLayer.txt +186 -0
- package/src/commands-library/multiGetDocument.ts +47 -0
- package/src/commands-library/renameLayer.uxp-test.ts +4 -4
- package/src/core/command.test-d.ts +25 -0
- package/src/index.ts +26 -17
- package/src/ut-tree/getDocumentLayerDescriptors.ts +29 -0
- package/src/ut-tree/getLayerEffects.ts +3 -26
- package/src/ut-tree/hasBackgroundLayer.uxp-test.ts +42 -0
- package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.test.ts +114 -0
- package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.ts +30 -58
- package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.uxp-test.ts +36 -3
- package/src/ut-tree/utLayersToText.test.ts +94 -0
- package/src/ut-tree/utLayersToText.ts +32 -0
- package/src/ut-tree/utLayersToTree.ts +2 -1
- package/src/util/utLayerPickKeysType.ts +5 -0
- package/test/fixtures/one-layer-with-bg.psd +0 -0
- package/test/index.ts +4 -1
- package/vitest-photoshop-alias-plugin.ts +41 -0
- package/vitest.config.ts +17 -0
- package/src/commands-library/getLayerProperties.ts +0 -32
- package/src/ut-tree/getFlattenedLayerDescriptorsList.ts +0 -72
- package/src/ut-tree/getLayerProperties.ts +0 -35
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @bubblydoo/uxp-toolkit@0.0.
|
|
2
|
+
> @bubblydoo/uxp-toolkit@0.0.6 build /home/runner/work/uxp-toolkit/uxp-toolkit/packages/uxp-toolkit
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
[34mCLI[39m Using tsup config: /home/runner/work/uxp-toolkit/uxp-toolkit/packages/uxp-toolkit/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m20.97 KB[39m
|
|
12
12
|
[32mESM[39m ⚡️ Build success in 28ms
|
|
13
13
|
[34mDTS[39m Build start
|
|
14
|
-
[32mDTS[39m ⚡️ Build success in
|
|
15
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
14
|
+
[32mDTS[39m ⚡️ Build success in 2406ms
|
|
15
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m11.62 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @bubblydoo/uxp-toolkit
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 31534d4: Fix layer descriptors exorts
|
|
8
|
+
|
|
9
|
+
## 0.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c98453b: Get all layers with one batchPlay command
|
|
14
|
+
Add utLayersToText helper
|
|
15
|
+
|
|
3
16
|
## 0.0.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -97,12 +97,6 @@ declare function suspendHistory<T>(document: Document, historyStateName: string,
|
|
|
97
97
|
type CombinedFn<T> = (executionContext: ExtendedExecutionContext, suspendHistoryContext: SuspendHistoryContext) => Promise<T>;
|
|
98
98
|
declare const executeAsModalAndSuspendHistory: <T>(commandName: string, document: Document, fn: CombinedFn<T>) => Promise<T>;
|
|
99
99
|
|
|
100
|
-
declare const getLayerProperties$1: (document: Document) => Promise<{
|
|
101
|
-
name: string;
|
|
102
|
-
layerID: number;
|
|
103
|
-
visible?: boolean | undefined;
|
|
104
|
-
}[]>;
|
|
105
|
-
|
|
106
100
|
type PsLayerRef = {
|
|
107
101
|
id: number;
|
|
108
102
|
docId: number;
|
|
@@ -110,6 +104,39 @@ type PsLayerRef = {
|
|
|
110
104
|
|
|
111
105
|
declare function createRenameLayerCommand(layerRef: PsLayerRef, newName: string): UTCommandModifying<unknown>;
|
|
112
106
|
|
|
107
|
+
declare function createGetDocumentCommand(documentId: number): UTCommandNonModifying<{
|
|
108
|
+
title: string;
|
|
109
|
+
documentID: number;
|
|
110
|
+
visible: boolean;
|
|
111
|
+
hasBackgroundLayer: boolean;
|
|
112
|
+
}>;
|
|
113
|
+
declare function createGetDocumentHasBackgroundLayerCommand(documentId: number): UTCommandNonModifying<{
|
|
114
|
+
hasBackgroundLayer: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
|
|
117
|
+
declare function createGetBackgroundLayerCommand(docId: number): UTCommandNonModifying<{
|
|
118
|
+
name: string;
|
|
119
|
+
visible: boolean;
|
|
120
|
+
group: boolean;
|
|
121
|
+
layerSection: {
|
|
122
|
+
_value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
|
|
123
|
+
_enum: "layerSectionType";
|
|
124
|
+
};
|
|
125
|
+
layerKind: number;
|
|
126
|
+
itemIndex: number;
|
|
127
|
+
background: boolean;
|
|
128
|
+
mode: {
|
|
129
|
+
_enum: "blendMode";
|
|
130
|
+
_value: string;
|
|
131
|
+
};
|
|
132
|
+
layerID: number;
|
|
133
|
+
layerEffects?: Record<string, {
|
|
134
|
+
enabled?: boolean | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
}[]> | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
|
|
113
140
|
declare const getFlattenedDomLayersList: (layers: Layer[]) => Layer[];
|
|
114
141
|
|
|
115
142
|
type Tree<TRef = unknown> = {
|
|
@@ -173,69 +200,56 @@ declare const uxpEntrypointsSchema: z.ZodObject<{
|
|
|
173
200
|
}, z.core.$strip>;
|
|
174
201
|
}, z.core.$strip>;
|
|
175
202
|
|
|
176
|
-
declare
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
};
|
|
199
|
-
|
|
203
|
+
declare function createMultiGetDocumentCommand(docId: number): UTCommandNonModifying<{
|
|
204
|
+
list: {
|
|
205
|
+
name: string;
|
|
206
|
+
layerID: number;
|
|
207
|
+
visible: boolean;
|
|
208
|
+
group: boolean;
|
|
209
|
+
layerSection: {
|
|
210
|
+
_value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
|
|
211
|
+
_enum: "layerSectionType";
|
|
212
|
+
};
|
|
213
|
+
layerKind: number;
|
|
214
|
+
itemIndex: number;
|
|
215
|
+
background: boolean;
|
|
216
|
+
mode: {
|
|
217
|
+
_enum: "blendMode";
|
|
218
|
+
_value: string;
|
|
219
|
+
};
|
|
220
|
+
layerEffects?: Record<string, {
|
|
221
|
+
enabled?: boolean | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
enabled: boolean;
|
|
224
|
+
}[]> | undefined;
|
|
225
|
+
}[];
|
|
226
|
+
}>;
|
|
227
|
+
|
|
228
|
+
declare const getDocumentLayerDescriptors: (documentId: number) => Promise<{
|
|
200
229
|
docId: number;
|
|
201
230
|
name: string;
|
|
202
231
|
layerID: number;
|
|
203
|
-
mode: {
|
|
204
|
-
_enum: "blendMode";
|
|
205
|
-
_value: string;
|
|
206
|
-
};
|
|
207
|
-
background: boolean;
|
|
208
|
-
itemIndex: number;
|
|
209
232
|
visible: boolean;
|
|
210
|
-
|
|
233
|
+
group: boolean;
|
|
211
234
|
layerSection: {
|
|
212
235
|
_value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
|
|
213
236
|
_enum: "layerSectionType";
|
|
214
237
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}[];
|
|
223
|
-
}>;
|
|
224
|
-
declare const getLayerProperties: (documentId: number) => Promise<{
|
|
225
|
-
name: string;
|
|
226
|
-
layerID: number;
|
|
227
|
-
visible?: boolean | undefined;
|
|
228
|
-
}[]>;
|
|
229
|
-
|
|
230
|
-
declare function createGetLayerCommand(layerRef: PsLayerRef): UTCommandNonModifying<{
|
|
231
|
-
layerID: number;
|
|
232
|
-
group?: boolean | undefined;
|
|
238
|
+
layerKind: number;
|
|
239
|
+
itemIndex: number;
|
|
240
|
+
background: boolean;
|
|
241
|
+
mode: {
|
|
242
|
+
_enum: "blendMode";
|
|
243
|
+
_value: string;
|
|
244
|
+
};
|
|
233
245
|
layerEffects?: Record<string, {
|
|
234
246
|
enabled?: boolean | undefined;
|
|
235
247
|
} | {
|
|
236
248
|
enabled: boolean;
|
|
237
249
|
}[]> | undefined;
|
|
238
|
-
}>;
|
|
250
|
+
}[]>;
|
|
251
|
+
type LayerDescriptor = Awaited<ReturnType<typeof getDocumentLayerDescriptors>>[number];
|
|
252
|
+
|
|
239
253
|
declare function getLayerEffects(layerRef: PsLayerRef): Promise<Record<string, boolean>>;
|
|
240
254
|
|
|
241
255
|
type UTLayerKind = "pixel" | "adjustment-layer" | "text" | "curves" | "smartObject" | "video" | "group" | "threeD" | "gradientFill" | "pattern" | "solidColor" | "background";
|
|
@@ -249,16 +263,24 @@ type UTLayerBuilder = {
|
|
|
249
263
|
blendMode: UTBlendMode;
|
|
250
264
|
effects: Record<string, boolean>;
|
|
251
265
|
isClippingMask: boolean;
|
|
266
|
+
background: boolean;
|
|
252
267
|
layers?: UTLayerBuilder[];
|
|
253
268
|
};
|
|
254
269
|
type UTLayer = Readonly<Omit<UTLayerBuilder, "layers">> & {
|
|
255
270
|
layers?: UTLayer[];
|
|
256
271
|
};
|
|
257
|
-
declare
|
|
272
|
+
declare function photoshopLayerDescriptorsToUTLayers(layers: LayerDescriptor[]): UTLayer[];
|
|
258
273
|
|
|
259
274
|
type UTLayerWithoutChildren = Omit<UTLayer, "layers">;
|
|
260
275
|
declare function utLayersToTree(layer: UTLayer[]): Tree<UTLayerWithoutChildren>;
|
|
261
276
|
|
|
277
|
+
type UTLayerPickKeys<TKey extends keyof Omit<UTLayer, "layers">> = Pick<Omit<UTLayer, "layers">, TKey> & {
|
|
278
|
+
layers?: UTLayerPickKeys<TKey>[];
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
type MinimalUTLayer = UTLayerPickKeys<"effects" | "visible" | "isClippingMask" | "kind" | "blendMode" | "name">;
|
|
282
|
+
declare function utLayersToText(tree: MinimalUTLayer[], depth?: number): string;
|
|
283
|
+
|
|
262
284
|
declare function utLayerToDomLayer(layer: UTLayer): Layer;
|
|
263
285
|
declare function utLayersToDomLayers(layers: UTLayer[]): Layer[];
|
|
264
286
|
|
|
@@ -268,4 +290,4 @@ declare function parseUxpErrorSourcemaps(error: Error, opts?: {
|
|
|
268
290
|
}): Promise<BasicStackFrame[]>;
|
|
269
291
|
declare function getBasicStackFrameAbsoluteFilePath(frame: BasicStackFrame): Promise<string>;
|
|
270
292
|
|
|
271
|
-
export { type BasicStackFrame, type CorrectBatchPlayOptions, type CorrectExecuteAsModalOptions, type CorrectExecutionContext, type ExtendedExecutionContext, type
|
|
293
|
+
export { type BasicStackFrame, type CorrectBatchPlayOptions, type CorrectExecuteAsModalOptions, type CorrectExecutionContext, type ExtendedExecutionContext, type LayerRef, type PsLayerRef, type SuspendHistoryContext, type Tree, type UTCommandBase, type UTCommandModifying, type UTCommandNonModifying, type UTCommandResult, type UTLayer, type UTLayerPickKeys, type UTLayerWithoutChildren, batchPlay, batchPlayCommand, batchPlayCommands, copyToClipboard, createCommand, createGetBackgroundLayerCommand, createGetDocumentCommand, createGetDocumentHasBackgroundLayerCommand, createModifyingBatchPlayContext, createMultiGetDocumentCommand, createRenameLayerCommand, executeAsModal, executeAsModalAndSuspendHistory, flattenTree, getBasicStackFrameAbsoluteFilePath, getDocumentLayerDescriptors, getFlattenedDomLayersList, getLayerEffects, mapTree, mapTreeRef, openFileByPath, parseUxpErrorSourcemaps, photoshopDomLayersToTree, photoshopGetApplicationInfo, photoshopLayerDescriptorsToUTLayers, readFromClipboard, suspendHistory, utLayerToDomLayer, utLayersToDomLayers, utLayersToTree, utLayersToText as utTreeToText, uxpEntrypointsSchema };
|