@bubblydoo/uxp-toolkit 0.0.3 → 0.0.5
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 +5 -5
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +77 -58
- package/dist/index.js +196 -276
- package/package.json +6 -3
- 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/renameLayer.uxp-test.ts +4 -4
- package/src/core/command.test-d.ts +25 -0
- package/src/index.ts +22 -17
- package/src/ut-tree/getLayerEffects.ts +3 -26
- package/src/ut-tree/getLayerProperties.ts +46 -7
- 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/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @bubblydoo/uxp-toolkit@0.0.
|
|
2
|
+
> @bubblydoo/uxp-toolkit@0.0.5 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[
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m18.29 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 29ms
|
|
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 2357ms
|
|
15
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m11.44 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @bubblydoo/uxp-toolkit
|
|
2
2
|
|
|
3
|
+
## 0.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c98453b: Get all layers with one batchPlay command
|
|
8
|
+
Add utLayersToText helper
|
|
9
|
+
|
|
10
|
+
## 0.0.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- d0d1067: Setup changeset releases
|
|
15
|
+
|
|
3
16
|
## 0.0.3
|
|
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,54 @@ declare const uxpEntrypointsSchema: z.ZodObject<{
|
|
|
173
200
|
}, z.core.$strip>;
|
|
174
201
|
}, z.core.$strip>;
|
|
175
202
|
|
|
176
|
-
declare const layerDescriptorSchema: z.ZodObject<{
|
|
177
|
-
name: z.ZodString;
|
|
178
|
-
layerID: z.ZodNumber;
|
|
179
|
-
mode: z.ZodObject<{
|
|
180
|
-
_enum: z.ZodLiteral<"blendMode">;
|
|
181
|
-
_value: z.ZodString;
|
|
182
|
-
}, z.core.$strip>;
|
|
183
|
-
background: z.ZodBoolean;
|
|
184
|
-
itemIndex: z.ZodNumber;
|
|
185
|
-
visible: z.ZodBoolean;
|
|
186
|
-
layerKind: z.ZodNumber;
|
|
187
|
-
layerSection: z.ZodObject<{
|
|
188
|
-
_value: z.ZodEnum<{
|
|
189
|
-
layerSectionStart: "layerSectionStart";
|
|
190
|
-
layerSectionEnd: "layerSectionEnd";
|
|
191
|
-
layerSectionContent: "layerSectionContent";
|
|
192
|
-
}>;
|
|
193
|
-
_enum: z.ZodLiteral<"layerSectionType">;
|
|
194
|
-
}, z.core.$strip>;
|
|
195
|
-
}, z.core.$strip>;
|
|
196
|
-
type LayerDescriptor = z.infer<typeof layerDescriptorSchema> & {
|
|
197
|
-
docId: number;
|
|
198
|
-
};
|
|
199
|
-
declare const getFlattenedLayerDescriptorsList: (documentId: number) => Promise<{
|
|
200
|
-
docId: number;
|
|
201
|
-
name: string;
|
|
202
|
-
layerID: number;
|
|
203
|
-
mode: {
|
|
204
|
-
_enum: "blendMode";
|
|
205
|
-
_value: string;
|
|
206
|
-
};
|
|
207
|
-
background: boolean;
|
|
208
|
-
itemIndex: number;
|
|
209
|
-
visible: boolean;
|
|
210
|
-
layerKind: number;
|
|
211
|
-
layerSection: {
|
|
212
|
-
_value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
|
|
213
|
-
_enum: "layerSectionType";
|
|
214
|
-
};
|
|
215
|
-
}[]>;
|
|
216
|
-
|
|
217
203
|
declare function createGetLayerPropertiesCommand(docId: number): UTCommandNonModifying<{
|
|
218
204
|
list: {
|
|
219
205
|
name: string;
|
|
220
206
|
layerID: number;
|
|
221
|
-
visible
|
|
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;
|
|
222
225
|
}[];
|
|
223
226
|
}>;
|
|
224
|
-
declare const
|
|
227
|
+
declare const getDocumentLayerDescriptors: (documentId: number) => Promise<{
|
|
228
|
+
docId: number;
|
|
225
229
|
name: string;
|
|
226
230
|
layerID: number;
|
|
227
|
-
visible
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
visible: boolean;
|
|
232
|
+
group: boolean;
|
|
233
|
+
layerSection: {
|
|
234
|
+
_value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
|
|
235
|
+
_enum: "layerSectionType";
|
|
236
|
+
};
|
|
237
|
+
layerKind: number;
|
|
238
|
+
itemIndex: number;
|
|
239
|
+
background: boolean;
|
|
240
|
+
mode: {
|
|
241
|
+
_enum: "blendMode";
|
|
242
|
+
_value: string;
|
|
243
|
+
};
|
|
233
244
|
layerEffects?: Record<string, {
|
|
234
245
|
enabled?: boolean | undefined;
|
|
235
246
|
} | {
|
|
236
247
|
enabled: boolean;
|
|
237
248
|
}[]> | undefined;
|
|
238
|
-
}>;
|
|
249
|
+
}[]>;
|
|
250
|
+
|
|
239
251
|
declare function getLayerEffects(layerRef: PsLayerRef): Promise<Record<string, boolean>>;
|
|
240
252
|
|
|
241
253
|
type UTLayerKind = "pixel" | "adjustment-layer" | "text" | "curves" | "smartObject" | "video" | "group" | "threeD" | "gradientFill" | "pattern" | "solidColor" | "background";
|
|
@@ -249,16 +261,23 @@ type UTLayerBuilder = {
|
|
|
249
261
|
blendMode: UTBlendMode;
|
|
250
262
|
effects: Record<string, boolean>;
|
|
251
263
|
isClippingMask: boolean;
|
|
264
|
+
background: boolean;
|
|
252
265
|
layers?: UTLayerBuilder[];
|
|
253
266
|
};
|
|
254
267
|
type UTLayer = Readonly<Omit<UTLayerBuilder, "layers">> & {
|
|
255
268
|
layers?: UTLayer[];
|
|
256
269
|
};
|
|
257
|
-
declare const photoshopLayerDescriptorsToUTLayers: (layers: LayerDescriptor[]) => Promise<UTLayer[]>;
|
|
258
270
|
|
|
259
271
|
type UTLayerWithoutChildren = Omit<UTLayer, "layers">;
|
|
260
272
|
declare function utLayersToTree(layer: UTLayer[]): Tree<UTLayerWithoutChildren>;
|
|
261
273
|
|
|
274
|
+
type UTLayerPickKeys<TKey extends keyof Omit<UTLayer, "layers">> = Pick<Omit<UTLayer, "layers">, TKey> & {
|
|
275
|
+
layers?: UTLayerPickKeys<TKey>[];
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type MinimalUTLayer = UTLayerPickKeys<"effects" | "visible" | "isClippingMask" | "kind" | "blendMode" | "name">;
|
|
279
|
+
declare function utLayersToText(tree: MinimalUTLayer[], depth?: number): string;
|
|
280
|
+
|
|
262
281
|
declare function utLayerToDomLayer(layer: UTLayer): Layer;
|
|
263
282
|
declare function utLayersToDomLayers(layers: UTLayer[]): Layer[];
|
|
264
283
|
|
|
@@ -268,4 +287,4 @@ declare function parseUxpErrorSourcemaps(error: Error, opts?: {
|
|
|
268
287
|
}): Promise<BasicStackFrame[]>;
|
|
269
288
|
declare function getBasicStackFrameAbsoluteFilePath(frame: BasicStackFrame): Promise<string>;
|
|
270
289
|
|
|
271
|
-
export { type BasicStackFrame, type CorrectBatchPlayOptions, type CorrectExecuteAsModalOptions, type CorrectExecutionContext, type ExtendedExecutionContext, type
|
|
290
|
+
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, createGetLayerPropertiesCommand, createModifyingBatchPlayContext, createRenameLayerCommand, executeAsModal, executeAsModalAndSuspendHistory, flattenTree, getBasicStackFrameAbsoluteFilePath, getFlattenedDomLayersList, getLayerEffects, getDocumentLayerDescriptors as getLayerPropertiesFromUtTree, mapTree, mapTreeRef, openFileByPath, parseUxpErrorSourcemaps, photoshopDomLayersToTree, photoshopGetApplicationInfo, readFromClipboard, suspendHistory, utLayerToDomLayer, utLayersToDomLayers, utLayersToTree, utLayersToText as utTreeToText, uxpEntrypointsSchema };
|