@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.
@@ -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.6 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
11
+ ESM dist/index.js 20.97 KB
12
12
  ESM ⚡️ Build success in 28ms
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 2406ms
15
+ DTS dist/index.d.ts 11.62 KB
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 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<{
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
- layerKind: number;
233
+ group: boolean;
211
234
  layerSection: {
212
235
  _value: "layerSectionStart" | "layerSectionEnd" | "layerSectionContent";
213
236
  _enum: "layerSectionType";
214
237
  };
215
- }[]>;
216
-
217
- declare function createGetLayerPropertiesCommand(docId: number): UTCommandNonModifying<{
218
- list: {
219
- name: string;
220
- layerID: number;
221
- visible?: boolean | undefined;
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 const photoshopLayerDescriptorsToUTLayers: (layers: LayerDescriptor[]) => Promise<UTLayer[]>;
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 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 };
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 };