shortcutkit 0.1.0
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/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/cli.d.ts +1 -0
- package/dist/definitions.d.ts +69 -0
- package/dist/generated/actions.d.ts +5643 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +19912 -0
- package/dist/plist.d.ts +4 -0
- package/dist/provenance.d.ts +21 -0
- package/dist/values.d.ts +59 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type PlistValue } from "./plist.js";
|
|
2
|
+
import type { ActionId, MetaParams, ParamTypes } from "./generated/actions.js";
|
|
3
|
+
import type { Attachment, Picker, TokenString, Value } from "./values.js";
|
|
4
|
+
export { actions, ACTIONS, type ActionId, type ActionKey, type ParamKey, type ParamTypes, type MetaParams } from "./generated/actions.js";
|
|
5
|
+
export type { PlistValue } from "./plist.js";
|
|
6
|
+
export type * from "./values.js";
|
|
7
|
+
export { getDefinition, allDefinitions, type ActionDefinition, type ParameterDefinition, type Localized } from "./definitions.js";
|
|
8
|
+
export { provenance, type Provenance } from "./provenance.js";
|
|
9
|
+
/** Parameters accepted for an identifier: typed per key for built-in actions, open for anything else. */
|
|
10
|
+
export type ParamsFor<I extends string> = I extends ActionId ? Partial<ParamTypes[I] & MetaParams> : Record<string, Value>;
|
|
11
|
+
export type Action = {
|
|
12
|
+
WFWorkflowActionIdentifier: string;
|
|
13
|
+
WFWorkflowActionParameters: Record<string, Value>;
|
|
14
|
+
outputName?: string;
|
|
15
|
+
};
|
|
16
|
+
/** WFWorkflowIcon.backgroundColorValue for palette colors 0-14, unsigned as the plist stores it. */
|
|
17
|
+
export declare const ICON_COLORS: {
|
|
18
|
+
readonly Red: 4282601983;
|
|
19
|
+
readonly DarkOrange: 4251333119;
|
|
20
|
+
readonly Orange: 4271458815;
|
|
21
|
+
readonly Yellow: 4274264319;
|
|
22
|
+
readonly Green: 4292093695;
|
|
23
|
+
readonly Teal: 431817727;
|
|
24
|
+
readonly LightBlue: 1440408063;
|
|
25
|
+
readonly Blue: 463140863;
|
|
26
|
+
readonly DarkBlue: 946986751;
|
|
27
|
+
readonly Violet: 2071128575;
|
|
28
|
+
readonly Purple: 3679049983;
|
|
29
|
+
readonly Pink: 3980825855;
|
|
30
|
+
readonly Taupe: 255;
|
|
31
|
+
readonly Gray: 3031607807;
|
|
32
|
+
readonly DarkGray: 2846468607;
|
|
33
|
+
};
|
|
34
|
+
export type IconColor = keyof typeof ICON_COLORS;
|
|
35
|
+
export declare const DEFAULT_GLYPH = 61440;
|
|
36
|
+
/** Legacy WFCondition codes. Marked (v) = verified on this Mac or in Apple's gallery; others follow community docs. */
|
|
37
|
+
export declare const CONDITION: {
|
|
38
|
+
readonly less_than: 0;
|
|
39
|
+
readonly less_or_equal: 1;
|
|
40
|
+
readonly greater_than: 2;
|
|
41
|
+
readonly greater_or_equal: 3;
|
|
42
|
+
readonly is: 4;
|
|
43
|
+
readonly is_not: 5;
|
|
44
|
+
readonly begins_with: 8;
|
|
45
|
+
readonly ends_with: 9;
|
|
46
|
+
readonly contains: 99;
|
|
47
|
+
readonly has_any_value: 100;
|
|
48
|
+
readonly has_no_value: 101;
|
|
49
|
+
readonly does_not_contain: 999;
|
|
50
|
+
readonly is_between: 1003;
|
|
51
|
+
};
|
|
52
|
+
export type Condition = keyof typeof CONDITION;
|
|
53
|
+
/** Reference another action's output. */
|
|
54
|
+
export declare const ref: (action: Action, outputName?: string) => Attachment;
|
|
55
|
+
export declare const variable: (name: string) => Attachment;
|
|
56
|
+
export declare const shortcutInput: () => Attachment;
|
|
57
|
+
export declare const clipboard: () => Attachment;
|
|
58
|
+
export declare const currentDate: () => Attachment;
|
|
59
|
+
export declare const ask: (prompt?: string) => Attachment;
|
|
60
|
+
/** Wrap an attachment for WFVariablePickerParameter keys (Repeat with Each, If). */
|
|
61
|
+
export declare const picker: (a: Attachment) => Picker;
|
|
62
|
+
/** A WFTextTokenString: strings and attachments interleaved; each attachment becomes U+FFFC. */
|
|
63
|
+
export declare function text(...parts: Array<string | number | Attachment>): TokenString;
|
|
64
|
+
export interface ShortcutOptions {
|
|
65
|
+
color?: IconColor | number;
|
|
66
|
+
glyph?: number;
|
|
67
|
+
inputClasses?: string[];
|
|
68
|
+
}
|
|
69
|
+
export declare class Shortcut {
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly actions: Action[];
|
|
72
|
+
private readonly color;
|
|
73
|
+
private readonly glyph;
|
|
74
|
+
private readonly inputClasses;
|
|
75
|
+
constructor(name: string, options?: ShortcutOptions);
|
|
76
|
+
/**
|
|
77
|
+
* Append an action. With an identifier from `actions`, parameter keys are checked at compile
|
|
78
|
+
* time; any identifier is also validated at run time against the bundled definitions.
|
|
79
|
+
*/
|
|
80
|
+
action<I extends string>(identifier: I, params?: ParamsFor<I>): Action;
|
|
81
|
+
if(subject: Attachment, condition: Condition | number, value?: string | number): string;
|
|
82
|
+
otherwise(gid: string): void;
|
|
83
|
+
endIf(gid: string): void;
|
|
84
|
+
repeatEach(items: Attachment): string;
|
|
85
|
+
endRepeatEach(gid: string): void;
|
|
86
|
+
toPlist(): Record<string, PlistValue>;
|
|
87
|
+
toXml(): string;
|
|
88
|
+
/** Write the unsigned file. Shortcuts names an import after the file, so the default is "<name>.shortcut". Converts to binary plist via plutil when present. */
|
|
89
|
+
write(path?: string): Promise<string>;
|
|
90
|
+
/** Sign with the macOS `shortcuts` command so Shortcuts will import the file. */
|
|
91
|
+
static sign(input: string, output: string, mode?: "anyone" | "people-who-know-me"): string;
|
|
92
|
+
}
|