@bubblydoo/uxp-toolkit 0.0.4 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @bubblydoo/uxp-toolkit@0.0.4 build /home/runner/work/uxp-toolkit/uxp-toolkit/packages/uxp-toolkit
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
  CLI Building entry: src/index.ts
@@ -8,8 +8,8 @@
8
8
  CLI Using tsup config: /home/runner/work/uxp-toolkit/uxp-toolkit/packages/uxp-toolkit/tsup.config.ts
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 19.84 KB
12
- ESM ⚡️ Build success in 28ms
11
+ ESM dist/index.js 18.29 KB
12
+ ESM ⚡️ Build success in 29ms
13
13
  DTS Build start
14
- DTS ⚡️ Build success in 2388ms
15
- DTS dist/index.d.ts 10.96 KB
14
+ DTS ⚡️ Build success in 2357ms
15
+ DTS dist/index.d.ts 11.44 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 0.0.4
4
11
 
5
12
  ### 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?: boolean | undefined;
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 getLayerProperties: (documentId: number) => Promise<{
227
+ declare const getDocumentLayerDescriptors: (documentId: number) => Promise<{
228
+ docId: number;
225
229
  name: string;
226
230
  layerID: number;
227
- visible?: boolean | undefined;
228
- }[]>;
229
-
230
- declare function createGetLayerCommand(layerRef: PsLayerRef): UTCommandNonModifying<{
231
- layerID: number;
232
- group?: boolean | undefined;
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 LayerDescriptor, type LayerRef, type PsLayerRef, type SuspendHistoryContext, type Tree, type UTCommandBase, type UTCommandModifying, type UTCommandNonModifying, type UTCommandResult, type UTLayer, type UTLayerWithoutChildren, batchPlay, batchPlayCommand, batchPlayCommands, copyToClipboard, createCommand, createGetLayerCommand as createGetLayerEffectsCommand, createGetLayerPropertiesCommand, createModifyingBatchPlayContext, createRenameLayerCommand, executeAsModal, executeAsModalAndSuspendHistory, flattenTree, getBasicStackFrameAbsoluteFilePath, getFlattenedDomLayersList, getFlattenedLayerDescriptorsList, getLayerEffects, getLayerProperties$1 as getLayerProperties, getLayerProperties as getLayerPropertiesFromUtTree, mapTree, mapTreeRef, openFileByPath, parseUxpErrorSourcemaps, photoshopDomLayersToTree, photoshopGetApplicationInfo, photoshopLayerDescriptorsToUTLayers, readFromClipboard, suspendHistory, utLayerToDomLayer, utLayersToDomLayers, utLayersToTree, uxpEntrypointsSchema };
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 };