@bubblydoo/uxp-toolkit 0.0.8 → 0.0.10

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.
Files changed (79) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-3CLJMC63.js → chunk-JBXCIUBZ.js} +49 -90
  4. package/dist/commands-library/index.d.ts +38 -39
  5. package/dist/commands-library/index.js +171 -171
  6. package/dist/index.d.ts +41 -83
  7. package/dist/index.js +203 -152
  8. package/dist/{psLayerRef-OY3h7srv.d.ts → psLayerRef-CGbTO4a5.d.ts} +36 -37
  9. package/package.json +9 -7
  10. package/src/commands-library/addLayerToSelection.ts +4 -4
  11. package/src/commands-library/applyLayerMask.ts +2 -2
  12. package/src/commands-library/convertMode.ts +2 -2
  13. package/src/commands-library/createColorLookupAdjustmentLayer.ts +2 -2
  14. package/src/commands-library/expandFolder.ts +4 -4
  15. package/src/commands-library/exportLUTs.ts +4 -4
  16. package/src/commands-library/getDocument.ts +7 -7
  17. package/src/commands-library/getLayer.ts +13 -13
  18. package/src/commands-library/hasVectorMask.ts +2 -2
  19. package/src/commands-library/index.ts +18 -18
  20. package/src/commands-library/loadLayerMaskAsSelection.ts +2 -2
  21. package/src/commands-library/multiGetDocument.ts +14 -14
  22. package/src/commands-library/rasterizeLayerStyle.ts +3 -3
  23. package/src/commands-library/rasterizeVectorMask.ts +2 -2
  24. package/src/commands-library/removeLayerMask.ts +2 -2
  25. package/src/commands-library/renameLayer.ts +6 -6
  26. package/src/commands-library/renameLayer.uxp-test.ts +13 -13
  27. package/src/commands-library/renderGrid.ts +2 -2
  28. package/src/commands-library/selectLayer.ts +3 -3
  29. package/src/commands-library/set3DLUTColorLookup.ts +2 -2
  30. package/src/core/batchPlay.ts +3 -3
  31. package/src/core/command.test-d.ts +11 -8
  32. package/src/core/command.ts +20 -23
  33. package/src/core/executeAsModal.ts +11 -67
  34. package/src/core/suspendHistory.ts +3 -3
  35. package/src/core/suspendHistory.uxp-test.ts +8 -8
  36. package/src/core-wrappers/executeAsModalAndSuspendHistory.ts +8 -6
  37. package/src/dom/getFlattenedDomLayersList.ts +6 -7
  38. package/src/dom/photoshopDomLayersToTree.ts +5 -5
  39. package/src/error-sourcemaps/sourcemaps.ts +27 -26
  40. package/src/error-sourcemaps/sourcemaps.uxp-test.ts +9 -8
  41. package/src/errors/ut-error.ts +2 -2
  42. package/src/filesystem/isFileOrFolder.ts +9 -0
  43. package/src/filesystem/openFileByPath.ts +10 -6
  44. package/src/general-tree/flattenTree.ts +1 -1
  45. package/src/general-tree/layerRef.ts +2 -2
  46. package/src/general-tree/mapTree.ts +1 -1
  47. package/src/general-tree/mapTreeRef.ts +1 -1
  48. package/src/general-tree/treeTypes.ts +0 -2
  49. package/src/index.ts +42 -43
  50. package/src/metadata-storage/metadataStorage.ts +31 -31
  51. package/src/metadata-storage/metadataStorage.uxp-test.ts +11 -11
  52. package/src/node-compat/path/resolvePath.ts +6 -4
  53. package/src/other/applicationInfo.ts +11 -11
  54. package/src/other/applicationInfo.uxp-test.ts +6 -6
  55. package/src/other/clipboard.ts +2 -2
  56. package/src/other/clipboard.uxp-test.ts +9 -8
  57. package/src/other/uxpEntrypoints.ts +2 -2
  58. package/src/ut-tree/getDocumentLayerDescriptors.ts +6 -6
  59. package/src/ut-tree/getLayerEffects.ts +5 -5
  60. package/src/ut-tree/hasBackgroundLayer.uxp-test.ts +25 -23
  61. package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.test.ts +29 -29
  62. package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.ts +62 -62
  63. package/src/ut-tree/photoshopLayerDescriptorsToUTLayers.uxp-test.ts +29 -29
  64. package/src/ut-tree/psLayerRef.ts +2 -2
  65. package/src/ut-tree/utLayersToText.test.ts +32 -32
  66. package/src/ut-tree/utLayersToText.ts +19 -19
  67. package/src/ut-tree/utLayersToTree.ts +4 -4
  68. package/src/util/utLayerPickKeysType.ts +3 -3
  69. package/src/util/utLayerToLayer.ts +14 -13
  70. package/test/index.ts +11 -11
  71. package/test/meta-tests/builtinModules.uxp-test.ts +28 -26
  72. package/test/meta-tests/executeAsModal.uxp-test.ts +14 -12
  73. package/test/meta-tests/suspendHistory.uxp-test.ts +10 -9
  74. package/tsconfig.json +5 -5
  75. package/tsup.config.ts +5 -5
  76. package/typedoc.json +6 -0
  77. package/uxp-tests.json +1 -1
  78. package/vitest-photoshop-alias-plugin.ts +23 -21
  79. package/vitest.config.ts +6 -6
@@ -5,11 +5,11 @@ import {
5
5
  createGetDocumentHasBackgroundLayerCommand,
6
6
  createGetLayerCommand,
7
7
  createMultiGetDocumentCommand
8
- } from "../chunk-3CLJMC63.js";
8
+ } from "../chunk-JBXCIUBZ.js";
9
9
 
10
- // src/commands-library/selectLayer.ts
10
+ // src/commands-library/addLayerToSelection.ts
11
11
  import { z } from "zod";
12
- function createSelectLayerCommand(layerRef) {
12
+ function createAddLayerToSelectionCommand(layerRef, previousLayerRef) {
13
13
  return createCommand({
14
14
  modifying: true,
15
15
  descriptor: {
@@ -24,176 +24,172 @@ function createSelectLayerCommand(layerRef) {
24
24
  _id: layerRef.docId
25
25
  }
26
26
  ],
27
+ selectionModifier: {
28
+ _enum: "selectionModifierType",
29
+ _value: "addToSelection"
30
+ },
27
31
  makeVisible: false,
28
- layerID: [layerRef.id],
29
- _isCommand: false
32
+ layerID: [layerRef.id, previousLayerRef.id],
33
+ _isCommand: true
30
34
  },
31
35
  schema: z.unknown()
32
36
  });
33
37
  }
34
38
 
35
- // src/commands-library/addLayerToSelection.ts
39
+ // src/commands-library/applyLayerMask.ts
36
40
  import { z as z2 } from "zod";
37
- function createAddLayerToSelectionCommand(layerRef, previousLayerRef) {
41
+ function createSelectLayerMaskCommand(layerId) {
38
42
  return createCommand({
39
43
  modifying: true,
40
44
  descriptor: {
41
45
  _obj: "select",
42
46
  _target: [
43
47
  {
44
- _ref: "layer",
45
- _id: layerRef.id
48
+ _ref: "channel",
49
+ _enum: "channel",
50
+ _value: "mask"
46
51
  },
47
52
  {
48
- _ref: "document",
49
- _id: layerRef.docId
53
+ _ref: "layer",
54
+ _id: layerId
50
55
  }
51
56
  ],
52
- selectionModifier: {
53
- _enum: "selectionModifierType",
54
- _value: "addToSelection"
55
- },
56
- makeVisible: false,
57
- layerID: [layerRef.id, previousLayerRef.id],
58
- _isCommand: true
57
+ makeVisible: false
58
+ },
59
+ schema: z2.unknown()
60
+ });
61
+ }
62
+ function createDeleteChannelAndApplyCommand() {
63
+ return createCommand({
64
+ modifying: true,
65
+ descriptor: {
66
+ _obj: "delete",
67
+ _target: [
68
+ {
69
+ _ref: "channel",
70
+ _enum: "ordinal",
71
+ _value: "targetEnum"
72
+ }
73
+ ],
74
+ apply: true
59
75
  },
60
76
  schema: z2.unknown()
61
77
  });
62
78
  }
63
79
 
64
- // src/commands-library/expandFolder.ts
80
+ // src/commands-library/convertMode.ts
65
81
  import { z as z3 } from "zod";
66
- function createExpandFolderCommand(layerRef) {
82
+ function createConvertModeCommand(depth) {
67
83
  return createCommand({
68
84
  modifying: true,
69
85
  descriptor: {
70
- _obj: "set",
71
- _target: {
72
- _ref: [
73
- { _property: "layerSectionExpanded" },
74
- { _ref: "layer", _id: layerRef.id },
75
- { _ref: "document", _id: layerRef.docId }
76
- ]
77
- },
78
- to: true
86
+ _obj: "convertMode",
87
+ depth
79
88
  },
80
89
  schema: z3.unknown()
81
90
  });
82
91
  }
83
92
 
84
- // src/commands-library/renameLayer.ts
93
+ // src/commands-library/createColorLookupAdjustmentLayer.ts
85
94
  import { z as z4 } from "zod";
86
- function createRenameLayerCommand(layerRef, newName) {
95
+ function createColorLookupAdjustmentLayerCommand() {
87
96
  return createCommand({
88
97
  modifying: true,
89
98
  descriptor: {
90
- _obj: "set",
91
- _target: [{ _ref: "layer", _id: layerRef.id }, { _ref: "document", _id: layerRef.docId }],
92
- to: { _obj: "layer", name: newName }
99
+ _obj: "make",
100
+ _target: [
101
+ {
102
+ _ref: "adjustmentLayer"
103
+ }
104
+ ],
105
+ using: {
106
+ _obj: "adjustmentLayer",
107
+ type: {
108
+ _class: "colorLookup"
109
+ }
110
+ },
111
+ _isCommand: true
93
112
  },
94
113
  schema: z4.unknown()
95
114
  });
96
115
  }
97
116
 
98
- // src/commands-library/rasterizeLayerStyle.ts
117
+ // src/commands-library/expandFolder.ts
99
118
  import { z as z5 } from "zod";
100
- function createRasterizeLayerStyleCommand(psLayerRef) {
119
+ function createExpandFolderCommand(layerRef) {
101
120
  return createCommand({
102
121
  modifying: true,
103
122
  descriptor: {
104
- _obj: "rasterizeLayer",
105
- _target: [{ _ref: "layer", _id: psLayerRef.id }, { _ref: "document", _id: psLayerRef.docId }],
106
- what: { _enum: "rasterizeItem", _value: "layerStyle" }
123
+ _obj: "set",
124
+ _target: {
125
+ _ref: [
126
+ { _property: "layerSectionExpanded" },
127
+ { _ref: "layer", _id: layerRef.id },
128
+ { _ref: "document", _id: layerRef.docId }
129
+ ]
130
+ },
131
+ to: true
107
132
  },
108
133
  schema: z5.unknown()
109
134
  });
110
135
  }
111
136
 
112
- // src/commands-library/rasterizeVectorMask.ts
137
+ // src/commands-library/exportLUTs.ts
113
138
  import { z as z6 } from "zod";
114
- function createRasterizeVectorMaskCommand() {
139
+ function createExportLUTsCommand(path, options = {}) {
140
+ const {
141
+ description = "Exported LUT",
142
+ gridPoints = 32,
143
+ copyright = "Copyright",
144
+ exportFormats = ["CUBE", "ICC", "3DL", "CSP"],
145
+ lowercaseExtension = false
146
+ } = options;
115
147
  return createCommand({
116
148
  modifying: true,
117
149
  descriptor: {
118
- _obj: "rasterizeLayer",
119
- _target: [
120
- {
121
- _ref: "layer",
122
- _enum: "ordinal",
123
- _value: "targetEnum"
124
- }
125
- ],
126
- what: {
127
- _enum: "rasterizeItem",
128
- _value: "vectorMask"
150
+ _obj: "export",
151
+ using: {
152
+ _obj: "$lut ",
153
+ $fpth: path,
154
+ $dscr: description,
155
+ $gPts: gridPoints,
156
+ copyright,
157
+ $wICC: exportFormats.includes("ICC"),
158
+ $w3DL: exportFormats.includes("3DL"),
159
+ $wCUB: exportFormats.includes("CUBE"),
160
+ $wCSP: exportFormats.includes("CSP"),
161
+ $lcFE: lowercaseExtension
129
162
  }
130
163
  },
131
164
  schema: z6.unknown()
132
165
  });
133
166
  }
134
167
 
135
- // src/commands-library/applyLayerMask.ts
168
+ // src/commands-library/hasVectorMask.ts
136
169
  import { z as z7 } from "zod";
137
- function createSelectLayerMaskCommand(layerId) {
170
+ function createHasVectorMaskCommand(layerId) {
138
171
  return createCommand({
139
- modifying: true,
172
+ modifying: false,
140
173
  descriptor: {
141
- _obj: "select",
174
+ _obj: "get",
142
175
  _target: [
143
176
  {
144
- _ref: "channel",
145
- _enum: "channel",
146
- _value: "mask"
177
+ _property: "hasVectorMask"
147
178
  },
148
179
  {
149
180
  _ref: "layer",
150
181
  _id: layerId
151
182
  }
152
- ],
153
- makeVisible: false
154
- },
155
- schema: z7.unknown()
156
- });
157
- }
158
- function createDeleteChannelAndApplyCommand() {
159
- return createCommand({
160
- modifying: true,
161
- descriptor: {
162
- _obj: "delete",
163
- _target: [
164
- {
165
- _ref: "channel",
166
- _enum: "ordinal",
167
- _value: "targetEnum"
168
- }
169
- ],
170
- apply: true
171
- },
172
- schema: z7.unknown()
173
- });
174
- }
175
-
176
- // src/commands-library/removeLayerMask.ts
177
- import { z as z8 } from "zod";
178
- function createDeleteChannelCommand() {
179
- return createCommand({
180
- modifying: true,
181
- descriptor: {
182
- _obj: "delete",
183
- _target: [
184
- {
185
- _ref: "channel",
186
- _enum: "ordinal",
187
- _value: "targetEnum"
188
- }
189
183
  ]
190
184
  },
191
- schema: z8.unknown()
185
+ schema: z7.object({
186
+ hasVectorMask: z7.boolean()
187
+ })
192
188
  });
193
189
  }
194
190
 
195
191
  // src/commands-library/loadLayerMaskAsSelection.ts
196
- import { z as z9 } from "zod";
192
+ import { z as z8 } from "zod";
197
193
  function createLoadLayerMaskAsSelectionCommand(layerId) {
198
194
  return createCommand({
199
195
  modifying: true,
@@ -219,72 +215,120 @@ function createLoadLayerMaskAsSelectionCommand(layerId) {
219
215
  ]
220
216
  }
221
217
  },
218
+ schema: z8.unknown()
219
+ });
220
+ }
221
+
222
+ // src/commands-library/rasterizeLayerStyle.ts
223
+ import { z as z9 } from "zod";
224
+ function createRasterizeLayerStyleCommand(psLayerRef) {
225
+ return createCommand({
226
+ modifying: true,
227
+ descriptor: {
228
+ _obj: "rasterizeLayer",
229
+ _target: [{ _ref: "layer", _id: psLayerRef.id }, { _ref: "document", _id: psLayerRef.docId }],
230
+ what: { _enum: "rasterizeItem", _value: "layerStyle" }
231
+ },
222
232
  schema: z9.unknown()
223
233
  });
224
234
  }
225
235
 
226
- // src/commands-library/hasVectorMask.ts
236
+ // src/commands-library/rasterizeVectorMask.ts
227
237
  import { z as z10 } from "zod";
228
- function createHasVectorMaskCommand(layerId) {
238
+ function createRasterizeVectorMaskCommand() {
229
239
  return createCommand({
230
- modifying: false,
240
+ modifying: true,
231
241
  descriptor: {
232
- _obj: "get",
242
+ _obj: "rasterizeLayer",
233
243
  _target: [
234
- {
235
- _property: "hasVectorMask"
236
- },
237
244
  {
238
245
  _ref: "layer",
239
- _id: layerId
246
+ _enum: "ordinal",
247
+ _value: "targetEnum"
240
248
  }
241
- ]
249
+ ],
250
+ what: {
251
+ _enum: "rasterizeItem",
252
+ _value: "vectorMask"
253
+ }
242
254
  },
243
- schema: z10.object({
244
- hasVectorMask: z10.boolean()
245
- })
255
+ schema: z10.unknown()
246
256
  });
247
257
  }
248
258
 
249
- // src/commands-library/convertMode.ts
259
+ // src/commands-library/removeLayerMask.ts
250
260
  import { z as z11 } from "zod";
251
- function createConvertModeCommand(depth) {
261
+ function createDeleteChannelCommand() {
252
262
  return createCommand({
253
263
  modifying: true,
254
264
  descriptor: {
255
- _obj: "convertMode",
256
- depth
265
+ _obj: "delete",
266
+ _target: [
267
+ {
268
+ _ref: "channel",
269
+ _enum: "ordinal",
270
+ _value: "targetEnum"
271
+ }
272
+ ]
257
273
  },
258
274
  schema: z11.unknown()
259
275
  });
260
276
  }
261
277
 
262
- // src/commands-library/createColorLookupAdjustmentLayer.ts
278
+ // src/commands-library/renameLayer.ts
263
279
  import { z as z12 } from "zod";
264
- function createColorLookupAdjustmentLayerCommand() {
280
+ function createRenameLayerCommand(layerRef, newName) {
265
281
  return createCommand({
266
282
  modifying: true,
267
283
  descriptor: {
268
- _obj: "make",
284
+ _obj: "set",
285
+ _target: [{ _ref: "layer", _id: layerRef.id }, { _ref: "document", _id: layerRef.docId }],
286
+ to: { _obj: "layer", name: newName }
287
+ },
288
+ schema: z12.unknown()
289
+ });
290
+ }
291
+
292
+ // src/commands-library/renderGrid.ts
293
+ import { z as z13 } from "zod";
294
+ function createRenderGridCommand(gridPoints) {
295
+ return createCommand({
296
+ modifying: true,
297
+ descriptor: {
298
+ _obj: "$3grd",
299
+ $grdP: gridPoints
300
+ },
301
+ schema: z13.unknown()
302
+ });
303
+ }
304
+
305
+ // src/commands-library/selectLayer.ts
306
+ import { z as z14 } from "zod";
307
+ function createSelectLayerCommand(layerRef) {
308
+ return createCommand({
309
+ modifying: true,
310
+ descriptor: {
311
+ _obj: "select",
269
312
  _target: [
270
313
  {
271
- _ref: "adjustmentLayer"
314
+ _ref: "layer",
315
+ _id: layerRef.id
316
+ },
317
+ {
318
+ _ref: "document",
319
+ _id: layerRef.docId
272
320
  }
273
321
  ],
274
- using: {
275
- _obj: "adjustmentLayer",
276
- type: {
277
- _class: "colorLookup"
278
- }
279
- },
280
- _isCommand: true
322
+ makeVisible: false,
323
+ layerID: [layerRef.id],
324
+ _isCommand: false
281
325
  },
282
- schema: z12.unknown()
326
+ schema: z14.unknown()
283
327
  });
284
328
  }
285
329
 
286
330
  // src/commands-library/set3DLUTColorLookup.ts
287
- import { z as z13 } from "zod";
331
+ import { z as z15 } from "zod";
288
332
  function createSet3DLUTColorLookupCommand(options) {
289
333
  const {
290
334
  lutPath,
@@ -330,50 +374,6 @@ function createSet3DLUTColorLookupCommand(options) {
330
374
  },
331
375
  _isCommand: true
332
376
  },
333
- schema: z13.unknown()
334
- });
335
- }
336
-
337
- // src/commands-library/exportLUTs.ts
338
- import { z as z14 } from "zod";
339
- function createExportLUTsCommand(path, options = {}) {
340
- const {
341
- description = "Exported LUT",
342
- gridPoints = 32,
343
- copyright = "Copyright",
344
- exportFormats = ["CUBE", "ICC", "3DL", "CSP"],
345
- lowercaseExtension = false
346
- } = options;
347
- return createCommand({
348
- modifying: true,
349
- descriptor: {
350
- _obj: "export",
351
- using: {
352
- _obj: "$lut ",
353
- $fpth: path,
354
- $dscr: description,
355
- $gPts: gridPoints,
356
- copyright,
357
- $wICC: exportFormats.includes("ICC"),
358
- $w3DL: exportFormats.includes("3DL"),
359
- $wCUB: exportFormats.includes("CUBE"),
360
- $wCSP: exportFormats.includes("CSP"),
361
- $lcFE: lowercaseExtension
362
- }
363
- },
364
- schema: z14.unknown()
365
- });
366
- }
367
-
368
- // src/commands-library/renderGrid.ts
369
- import { z as z15 } from "zod";
370
- function createRenderGridCommand(gridPoints) {
371
- return createCommand({
372
- modifying: true,
373
- descriptor: {
374
- _obj: "$3grd",
375
- $grdP: gridPoints
376
- },
377
377
  schema: z15.unknown()
378
378
  });
379
379
  }
package/dist/index.d.ts CHANGED
@@ -1,70 +1,25 @@
1
- import { c as createModifyingBatchPlayContext, P as PsLayerRef } from './psLayerRef-OY3h7srv.js';
2
- export { C as CorrectBatchPlayOptions, U as UTCommandBase, a as UTCommandModifying, b as UTCommandNonModifying, d as UTCommandResult, e as batchPlay, f as batchPlayCommand, g as batchPlayCommands, h as createCommand, i as createMultiGetDocumentCommand } from './psLayerRef-OY3h7srv.js';
3
- import * as photoshop_dom_Document from 'photoshop/dom/Document';
4
- import { Document } from 'photoshop/dom/Document';
5
- import { Layer } from 'photoshop/dom/Layer';
6
- import { z } from 'zod';
1
+ import { c as createModifyingBatchPlayContext, P as PsLayerRef } from './psLayerRef-CGbTO4a5.js';
2
+ export { C as CorrectBatchPlayOptions, U as UTCommandBase, a as UTCommandModifying, b as UTCommandNonModifying, d as UTCommandResult, e as batchPlay, f as batchPlayCommand, g as batchPlayCommands, h as createCommand, i as createMultiGetDocumentCommand } from './psLayerRef-CGbTO4a5.js';
3
+ import * as photoshop from 'photoshop';
4
+ import { ExecutionContext, ExecuteAsModalOptions, Document, Layer } from 'photoshop';
7
5
  import ErrorStackParser from 'error-stack-parser';
8
- import 'photoshop/dom/CoreModules';
9
- import 'photoshop';
10
-
11
- type CorrectExecutionContext = {
12
- /**
13
- * True if user has cancelled the modal interaction.
14
- *
15
- * User can cancel by hitting the Escape key, or by pressing the "Cancel" button in the progress bar.
16
- */
17
- isCancelled: boolean;
18
- /**
19
- * If assigned a method, it will be called when user cancels the modal interaction.
20
- */
21
- onCancel: () => void;
22
- /**
23
- * Call this to customize the progress bar.
24
- */
25
- reportProgress: (info: {
26
- value: number;
27
- commandName?: string;
28
- }) => void;
29
- /**
30
- * Use the methods in here to control Photoshop state
31
- */
32
- hostControl: {
33
- /**
34
- * Call to suspend history on a target document, returns the suspension ID which can be used for resumeHistory
35
- */
36
- suspendHistory: (info: {
37
- documentID: number;
38
- name: string;
39
- }) => Promise<number>;
40
- /**
41
- * Call to resume history on a target document
42
- */
43
- resumeHistory: (suspensionID: number, commit: boolean) => Promise<void>;
44
- /** Register a document to be closed when the modal scope exits. See below for details. */
45
- registerAutoCloseDocument: (documentID: number) => Promise<void>;
46
- /** Unregister a document from being closed when the modal scope exits */
47
- unregisterAutoCloseDocument: (documentID: number) => Promise<void>;
48
- };
49
- };
50
- type CorrectExecuteAsModalOptions = {
51
- commandName: string;
52
- interactive?: boolean;
53
- timeOut?: number;
54
- };
55
- type ExtendedExecutionContext = Omit<CorrectExecutionContext, "onCancel"> & ReturnType<typeof createModifyingBatchPlayContext> & {
6
+ import { Entry, File, Folder } from 'uxp';
7
+ import { z } from 'zod';
8
+
9
+ type ExtendedExecutionContext = Omit<ExecutionContext, 'onCancel'> & ReturnType<typeof createModifyingBatchPlayContext> & {
56
10
  signal: AbortSignal;
57
11
  };
58
- type OptionsWithoutCommandName = Omit<CorrectExecuteAsModalOptions, "commandName">;
12
+ type OptionsWithoutCommandName = Omit<ExecuteAsModalOptions, 'commandName'>;
59
13
  declare function executeAsModal<T>(commandName: string, fn: (executionContext: ExtendedExecutionContext) => Promise<T>, opts?: OptionsWithoutCommandName): Promise<T>;
60
14
 
61
- type SuspendHistoryContext = {};
15
+ interface SuspendHistoryContext {
16
+ }
62
17
  declare function suspendHistory<T>(document: Document, historyStateName: string, fn: (context: SuspendHistoryContext) => Promise<T>): Promise<T>;
63
18
 
64
19
  type CombinedFn<T> = (executionContext: ExtendedExecutionContext, suspendHistoryContext: SuspendHistoryContext) => Promise<T>;
65
- declare const executeAsModalAndSuspendHistory: <T>(commandName: string, document: Document, fn: CombinedFn<T>) => Promise<T>;
20
+ declare function executeAsModalAndSuspendHistory<T>(commandName: string, document: Document, fn: CombinedFn<T>): Promise<T>;
66
21
 
67
- declare const getFlattenedDomLayersList: (layers: Layer[]) => Layer[];
22
+ declare function getFlattenedDomLayersList(layers: Layer[]): Layer[];
68
23
 
69
24
  type Tree<TRef = unknown> = {
70
25
  ref: TRef;
@@ -72,20 +27,29 @@ type Tree<TRef = unknown> = {
72
27
  children?: Tree<TRef>;
73
28
  }[];
74
29
 
75
- declare const photoshopDomLayersToTree: (layers: Layer[]) => Tree<Layer>;
30
+ declare function photoshopDomLayersToTree(layers: Layer[]): Tree<Layer>;
76
31
 
77
- declare function openFileByPath(path: string): Promise<photoshop_dom_Document.Document>;
32
+ type BasicStackFrame = Pick<ErrorStackParser.StackFrame, 'functionName' | 'fileName' | 'lineNumber' | 'columnNumber'>;
33
+ declare function parseUxpErrorSourcemaps(error: Error, opts?: {
34
+ unsourcemappedHeaderLines?: number;
35
+ }): Promise<BasicStackFrame[]>;
36
+ declare function getBasicStackFrameAbsoluteFilePath(frame: BasicStackFrame): Promise<string>;
78
37
 
79
- declare function flattenTree<T>(tree: Tree<T>): Tree<T>[0][];
38
+ declare function isFile(entry: Entry): entry is File;
39
+ declare function isFolder(entry: Entry): entry is Folder;
80
40
 
81
- declare function mapTree<TRef, TMappedRef>(tree: Tree<TRef>, mapFn: (node: TRef) => TMappedRef): Tree<TMappedRef>;
41
+ declare function openFileByPath(path: string): Promise<photoshop.Document>;
82
42
 
83
- declare function mapTreeRef<TRef, TMappedRef>(tree: Tree<TRef>, mapFn: (node: TRef) => TMappedRef): Tree<TMappedRef>;
43
+ declare function flattenTree<T>(tree: Tree<T>): Tree<T>[0][];
84
44
 
85
- type LayerRef = {
45
+ interface LayerRef {
86
46
  id: number;
87
47
  docId: number;
88
- };
48
+ }
49
+
50
+ declare function mapTree<TRef, TMappedRef>(tree: Tree<TRef>, mapFn: (node: TRef) => TMappedRef): Tree<TMappedRef>;
51
+
52
+ declare function mapTreeRef<TRef, TMappedRef>(tree: Tree<TRef>, mapFn: (node: TRef) => TMappedRef): Tree<TMappedRef>;
89
53
 
90
54
  declare function photoshopGetApplicationInfo(): Promise<{
91
55
  active: boolean;
@@ -127,7 +91,7 @@ declare const uxpEntrypointsSchema: z.ZodObject<{
127
91
  }, z.core.$strip>;
128
92
  }, z.core.$strip>;
129
93
 
130
- declare const getDocumentLayerDescriptors: (documentId: number) => Promise<{
94
+ declare function getDocumentLayerDescriptors(documentId: number): Promise<{
131
95
  docId: number;
132
96
  name: string;
133
97
  layerID: number;
@@ -154,9 +118,9 @@ type LayerDescriptor = Awaited<ReturnType<typeof getDocumentLayerDescriptors>>[n
154
118
 
155
119
  declare function getLayerEffects(layerRef: PsLayerRef): Promise<Record<string, boolean>>;
156
120
 
157
- type UTLayerKind = "pixel" | "adjustment-layer" | "text" | "curves" | "smartObject" | "video" | "group" | "threeD" | "gradientFill" | "pattern" | "solidColor" | "background";
158
- type UTBlendMode = "normal" | "dissolve" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "blendSubtraction" | "blendDivide" | "hue" | "saturation" | "color" | "luminosity" | "passThrough";
159
- type UTLayerBuilder = {
121
+ type UTLayerKind = 'pixel' | 'adjustment-layer' | 'text' | 'curves' | 'smartObject' | 'video' | 'group' | 'threeD' | 'gradientFill' | 'pattern' | 'solidColor' | 'background';
122
+ type UTBlendMode = 'normal' | 'dissolve' | 'darken' | 'multiply' | 'colorBurn' | 'linearBurn' | 'darkerColor' | 'lighten' | 'screen' | 'colorDodge' | 'linearDodge' | 'lighterColor' | 'overlay' | 'softLight' | 'hardLight' | 'vividLight' | 'linearLight' | 'pinLight' | 'hardMix' | 'difference' | 'exclusion' | 'blendSubtraction' | 'blendDivide' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'passThrough';
123
+ interface UTLayerBuilder {
160
124
  name: string;
161
125
  docId: number;
162
126
  id: number;
@@ -167,29 +131,23 @@ type UTLayerBuilder = {
167
131
  isClippingMask: boolean;
168
132
  background: boolean;
169
133
  layers?: UTLayerBuilder[];
170
- };
171
- type UTLayer = Readonly<Omit<UTLayerBuilder, "layers">> & {
134
+ }
135
+ type UTLayer = Readonly<Omit<UTLayerBuilder, 'layers'>> & {
172
136
  layers?: UTLayer[];
173
137
  };
174
138
  declare function photoshopLayerDescriptorsToUTLayers(layers: LayerDescriptor[]): UTLayer[];
175
139
 
176
- type UTLayerWithoutChildren = Omit<UTLayer, "layers">;
177
- declare function utLayersToTree(layer: UTLayer[]): Tree<UTLayerWithoutChildren>;
178
-
179
- type UTLayerPickKeys<TKey extends keyof Omit<UTLayer, "layers">> = Pick<Omit<UTLayer, "layers">, TKey> & {
140
+ type UTLayerPickKeys<TKey extends keyof Omit<UTLayer, 'layers'>> = Pick<Omit<UTLayer, 'layers'>, TKey> & {
180
141
  layers?: UTLayerPickKeys<TKey>[];
181
142
  };
182
143
 
183
- type MinimalUTLayer = UTLayerPickKeys<"effects" | "visible" | "isClippingMask" | "kind" | "blendMode" | "name">;
144
+ type MinimalUTLayer = UTLayerPickKeys<'effects' | 'visible' | 'isClippingMask' | 'kind' | 'blendMode' | 'name'>;
184
145
  declare function utLayersToText(tree: MinimalUTLayer[], depth?: number): string;
185
146
 
147
+ type UTLayerWithoutChildren = Omit<UTLayer, 'layers'>;
148
+ declare function utLayersToTree(layer: UTLayer[]): Tree<UTLayerWithoutChildren>;
149
+
186
150
  declare function utLayerToDomLayer(layer: UTLayer): Layer;
187
151
  declare function utLayersToDomLayers(layers: UTLayer[]): Layer[];
188
152
 
189
- type BasicStackFrame = Pick<ErrorStackParser.StackFrame, "functionName" | "fileName" | "lineNumber" | "columnNumber">;
190
- declare function parseUxpErrorSourcemaps(error: Error, opts?: {
191
- unsourcemappedHeaderLines?: number;
192
- }): Promise<BasicStackFrame[]>;
193
- declare function getBasicStackFrameAbsoluteFilePath(frame: BasicStackFrame): Promise<string>;
194
-
195
- export { type BasicStackFrame, type CorrectExecuteAsModalOptions, type CorrectExecutionContext, type ExtendedExecutionContext, type LayerDescriptor, type LayerRef, PsLayerRef, type SuspendHistoryContext, type Tree, type UTLayer, type UTLayerPickKeys, type UTLayerWithoutChildren, copyToClipboard, createModifyingBatchPlayContext, executeAsModal, executeAsModalAndSuspendHistory, flattenTree, getBasicStackFrameAbsoluteFilePath, getDocumentLayerDescriptors, getFlattenedDomLayersList, getLayerEffects, mapTree, mapTreeRef, openFileByPath, parseUxpErrorSourcemaps, photoshopDomLayersToTree, photoshopGetApplicationInfo, photoshopLayerDescriptorsToUTLayers, readFromClipboard, suspendHistory, utLayerToDomLayer, utLayersToDomLayers, utLayersToTree, utLayersToText as utTreeToText, uxpEntrypointsSchema };
153
+ export { type BasicStackFrame, type ExtendedExecutionContext, type LayerDescriptor, type LayerRef, PsLayerRef, type SuspendHistoryContext, type Tree, type UTLayer, type UTLayerPickKeys, type UTLayerWithoutChildren, copyToClipboard, createModifyingBatchPlayContext, executeAsModal, executeAsModalAndSuspendHistory, flattenTree, getBasicStackFrameAbsoluteFilePath, getDocumentLayerDescriptors, getFlattenedDomLayersList, getLayerEffects, isFile, isFolder, mapTree, mapTreeRef, openFileByPath, parseUxpErrorSourcemaps, photoshopDomLayersToTree, photoshopGetApplicationInfo, photoshopLayerDescriptorsToUTLayers, readFromClipboard, suspendHistory, utLayerToDomLayer, utLayersToDomLayers, utLayersToTree, utLayersToText as utTreeToText, uxpEntrypointsSchema };