@bubblydoo/uxp-toolkit 0.0.6 → 0.0.8

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.
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+
4
+ export function createLoadLayerMaskAsSelectionCommand(layerId: number) {
5
+ return createCommand({
6
+ modifying: true,
7
+ descriptor: {
8
+ _obj: 'set',
9
+ _target: [
10
+ {
11
+ _ref: 'channel',
12
+ _property: 'selection',
13
+ },
14
+ ],
15
+ to: {
16
+ _ref: [
17
+ {
18
+ _ref: 'channel',
19
+ _enum: 'channel',
20
+ _value: 'mask',
21
+ },
22
+ {
23
+ _ref: 'layer',
24
+ _id: layerId,
25
+ },
26
+ ],
27
+ },
28
+ },
29
+ schema: z.unknown(),
30
+ });
31
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+ import type { PsLayerRef } from "../ut-tree/psLayerRef";
4
+
5
+ export function createRasterizeLayerStyleCommand(psLayerRef: PsLayerRef) {
6
+ return createCommand({
7
+ modifying: true,
8
+ descriptor: {
9
+ _obj: 'rasterizeLayer',
10
+ _target: [{ _ref: 'layer', _id: psLayerRef.id }, { _ref: 'document', _id: psLayerRef.docId }],
11
+ what: { _enum: 'rasterizeItem', _value: 'layerStyle' },
12
+ },
13
+ schema: z.unknown(),
14
+ });
15
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+
4
+ export function createRasterizeVectorMaskCommand() {
5
+ return createCommand({
6
+ modifying: true,
7
+ descriptor: {
8
+ _obj: 'rasterizeLayer',
9
+ _target: [
10
+ {
11
+ _ref: 'layer',
12
+ _enum: 'ordinal',
13
+ _value: 'targetEnum',
14
+ },
15
+ ],
16
+ what: {
17
+ _enum: 'rasterizeItem',
18
+ _value: 'vectorMask',
19
+ },
20
+ },
21
+ schema: z.unknown(),
22
+ });
23
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+
4
+ export function createDeleteChannelCommand() {
5
+ return createCommand({
6
+ modifying: true,
7
+ descriptor: {
8
+ _obj: 'delete',
9
+ _target: [
10
+ {
11
+ _ref: 'channel',
12
+ _enum: 'ordinal',
13
+ _value: 'targetEnum',
14
+ },
15
+ ],
16
+ },
17
+ schema: z.unknown(),
18
+ });
19
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+
4
+ export function createRenderGridCommand(gridPoints: number) {
5
+ return createCommand({
6
+ modifying: true,
7
+ descriptor: {
8
+ _obj: '$3grd',
9
+ $grdP: gridPoints,
10
+ },
11
+ schema: z.unknown(),
12
+ });
13
+ }
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+ import type { PsLayerRef } from "../ut-tree/psLayerRef";
4
+
5
+ export function createSelectLayerCommand(layerRef: PsLayerRef) {
6
+ return createCommand({
7
+ modifying: true,
8
+ descriptor: {
9
+ _obj: 'select',
10
+ _target: [
11
+ {
12
+ _ref: 'layer',
13
+ _id: layerRef.id,
14
+ },
15
+ {
16
+ _ref: 'document',
17
+ _id: layerRef.docId,
18
+ },
19
+ ],
20
+ makeVisible: false,
21
+ layerID: [layerRef.id],
22
+ _isCommand: false,
23
+ },
24
+ schema: z.unknown(),
25
+ });
26
+ }
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ import { createCommand } from "../core/command";
3
+
4
+ export type LUTFormatType = 'LUTFormatCUBE' | 'LUTFormat3DL' | 'LUTFormatCSP';
5
+
6
+ export interface Set3DLUTColorLookupOptions {
7
+ lutPath: string;
8
+ lutFormat?: LUTFormatType;
9
+ profileBase64?: string;
10
+ lutFileDataBase64?: string;
11
+ }
12
+
13
+ export function createSet3DLUTColorLookupCommand(options: Set3DLUTColorLookupOptions) {
14
+ const {
15
+ lutPath,
16
+ lutFormat = 'LUTFormatCUBE',
17
+ profileBase64,
18
+ lutFileDataBase64,
19
+ } = options;
20
+
21
+ return createCommand({
22
+ modifying: true,
23
+ descriptor: {
24
+ _obj: 'set',
25
+ _target: [
26
+ {
27
+ _enum: 'ordinal',
28
+ _ref: 'adjustmentLayer',
29
+ _value: 'targetEnum',
30
+ },
31
+ ],
32
+ to: {
33
+ _obj: 'colorLookup',
34
+ lookupType: {
35
+ _enum: 'colorLookupType',
36
+ _value: '3DLUT',
37
+ },
38
+ name: lutPath,
39
+ LUTFormat: {
40
+ _enum: 'LUTFormatType',
41
+ _value: lutFormat,
42
+ },
43
+ ...(profileBase64 && {
44
+ profile: {
45
+ _data: profileBase64,
46
+ _rawData: 'base64',
47
+ },
48
+ }),
49
+ ...(lutFileDataBase64 && {
50
+ LUT3DFileData: {
51
+ _data: lutFileDataBase64,
52
+ _rawData: 'base64',
53
+ },
54
+ }),
55
+ LUT3DFileName: lutPath,
56
+ },
57
+ _isCommand: true,
58
+ },
59
+ schema: z.unknown(),
60
+ });
61
+ }
package/src/index.ts CHANGED
@@ -26,14 +26,6 @@ export {
26
26
  // Core wrappers
27
27
  export { executeAsModalAndSuspendHistory } from "./core-wrappers/executeAsModalAndSuspendHistory";
28
28
 
29
- // Commands library
30
- export { createRenameLayerCommand } from "./commands-library/renameLayer";
31
- export {
32
- createGetDocumentCommand,
33
- createGetDocumentHasBackgroundLayerCommand,
34
- } from "./commands-library/getDocument";
35
- export { createGetBackgroundLayerCommand } from "./commands-library/getLayer";
36
-
37
29
  // DOM – layers
38
30
  export { getFlattenedDomLayersList } from "./dom/getFlattenedDomLayersList";
39
31
  export { photoshopDomLayersToTree } from "./dom/photoshopDomLayersToTree";
@@ -55,7 +47,7 @@ export { uxpEntrypointsSchema } from "./other/uxpEntrypoints";
55
47
 
56
48
  // UT tree – layer descriptors & Photoshop tree
57
49
  export { createMultiGetDocumentCommand } from "./commands-library/multiGetDocument";
58
- export { getDocumentLayerDescriptors } from "./ut-tree/getDocumentLayerDescriptors";
50
+ export { getDocumentLayerDescriptors, type LayerDescriptor } from "./ut-tree/getDocumentLayerDescriptors";
59
51
  export { getLayerEffects } from "./ut-tree/getLayerEffects";
60
52
  export {
61
53
  type UTLayer,
package/tsup.config.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { defineConfig } from "tsup";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: "esm",
6
- dts: true,
7
- external: ["photoshop", "uxp"],
8
- outDir: "dist",
9
- });
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts", "src/commands-library/index.ts"],
5
+ format: "esm",
6
+ dts: true,
7
+ external: ["photoshop", "uxp"],
8
+ outDir: "dist",
9
+ });