shortcutkit 0.7.0 → 0.8.1
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/README.md +41 -10
- package/dist/generated/actions.d.ts +4495 -600
- package/dist/index.d.ts +34 -16
- package/dist/index.js +1045 -16
- package/dist/values.d.ts +16 -5
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { type PlistValue } from "./plist.js";
|
|
|
2
2
|
import { type ActionDefinition } from "./definitions.js";
|
|
3
3
|
import { ACTIONS } from "./generated/actions.js";
|
|
4
4
|
import type { ActionId, MetaParams, ParamTypes } from "./generated/actions.js";
|
|
5
|
-
import type { Attachment,
|
|
6
|
-
export { actions, ACTIONS, PARAM_KINDS, type ActionId, type ActionKey, type ParamKey, type ParamTypes, type MetaParams } from "./generated/actions.js";
|
|
5
|
+
import type { AskAttachment, Attachment, ConditionSubject, TokenString, Value } from "./values.js";
|
|
6
|
+
export { actions, ACTIONS, PARAM_KINDS, PARAM_CHOICES, PARAM_VARIABLE_TYPES, type ActionId, type ActionKey, type ParamKey, type ParamTypes, type MetaParams } from "./generated/actions.js";
|
|
7
7
|
export type { PlistValue } from "./plist.js";
|
|
8
8
|
export type * from "./values.js";
|
|
9
9
|
export { getDefinition, allDefinitions, type ActionDefinition, type ParameterDefinition, type Localized } from "./definitions.js";
|
|
@@ -26,7 +26,7 @@ export type CatalogEntry = {
|
|
|
26
26
|
name: string;
|
|
27
27
|
/** Parameter keys the action accepts, in the editor's order. */
|
|
28
28
|
params: readonly string[];
|
|
29
|
-
/** Value kind per key: bool, number, string, text, picker, plainString, plainNumber, dictionary, quantity, filter, any. */
|
|
29
|
+
/** Value kind per key: bool, number, string, text, picker, subject, plainString, plainNumber, dictionary, quantity, filter, any. */
|
|
30
30
|
kinds: Record<string, string>;
|
|
31
31
|
/** Output name, or null when the action produces nothing. */
|
|
32
32
|
output: string | null;
|
|
@@ -87,20 +87,35 @@ export declare const CONDITION: {
|
|
|
87
87
|
};
|
|
88
88
|
export type Condition = keyof typeof CONDITION;
|
|
89
89
|
/** Reference another action's output. */
|
|
90
|
-
export declare const ref: (action: Action, outputName?: string) => Attachment
|
|
91
|
-
export declare const variable: (name: string) => Attachment
|
|
92
|
-
export declare const shortcutInput: () => Attachment
|
|
93
|
-
export declare const clipboard: () => Attachment
|
|
94
|
-
export declare const currentDate: () => Attachment
|
|
95
|
-
export declare const ask: (prompt?: string) =>
|
|
96
|
-
/**
|
|
97
|
-
export declare const
|
|
90
|
+
export declare const ref: (action: Action, outputName?: string) => Attachment<"ActionOutput">;
|
|
91
|
+
export declare const variable: (name: string) => Attachment<"Variable">;
|
|
92
|
+
export declare const shortcutInput: () => Attachment<"ExtensionInput">;
|
|
93
|
+
export declare const clipboard: () => Attachment<"Clipboard">;
|
|
94
|
+
export declare const currentDate: () => Attachment<"CurrentDate">;
|
|
95
|
+
export declare const ask: (prompt?: string) => AskAttachment;
|
|
96
|
+
/** Device Details (name, model, OS version, …); the app usually adds a property aggrandizement. */
|
|
97
|
+
export declare const deviceDetails: () => Attachment<"DeviceDetails">;
|
|
98
|
+
/** The app the shortcut was run from. */
|
|
99
|
+
export declare const currentApp: () => Attachment<"CurrentApp">;
|
|
100
|
+
/** Wrap an attachment as the subject of an If condition, the form the app writes for `WFInput` on `is.workflow.actions.conditional`. Variable-picker parameters (Repeat with Each, Filter, Quick Look, …) take the bare attachment instead. */
|
|
101
|
+
export declare const subject: (a: Attachment) => ConditionSubject;
|
|
102
|
+
/** @deprecated Misnamed: this produces the If-subject form. Pass a bare `ref()` to variable-picker parameters; use `subject()` for If. */
|
|
103
|
+
export declare const picker: (a: Attachment) => ConditionSubject;
|
|
104
|
+
/** The current item inside a Repeat with Each block. */
|
|
105
|
+
export declare const repeatItem: () => Attachment<"Variable">;
|
|
106
|
+
/** The current index (1-based) inside a Repeat block. */
|
|
107
|
+
export declare const repeatIndex: () => Attachment<"Variable">;
|
|
98
108
|
/** A WFTextTokenString: strings and attachments interleaved; each attachment becomes U+FFFC. */
|
|
99
109
|
export declare function text(...parts: Array<string | number | Attachment>): TokenString;
|
|
110
|
+
/** Where a shortcut is offered beyond the app: `ActionExtension` is the share sheet, `QuickActions` the Finder and Services menus, `MenuBar`, `NCWidget`, `WatchKit`, `Sleep`, `ReceivesOnScreenContent`. */
|
|
111
|
+
export type WorkflowType = "ActionExtension" | "QuickActions" | "MenuBar" | "NCWidget" | "WatchKit" | "Sleep" | "ReceivesOnScreenContent";
|
|
100
112
|
export interface ShortcutOptions {
|
|
101
113
|
color?: IconColor | number;
|
|
102
114
|
glyph?: number;
|
|
115
|
+
/** Content item classes accepted as input (`WFSafariWebPageContentItem`, `WFURLContentItem`, …); what the share sheet offers this shortcut for. */
|
|
103
116
|
inputClasses?: string[];
|
|
117
|
+
/** Surfaces the shortcut appears in (`WFWorkflowTypes`); `["ActionExtension"]` puts it in the share sheet. Default none. */
|
|
118
|
+
types?: WorkflowType[];
|
|
104
119
|
}
|
|
105
120
|
export declare class Shortcut {
|
|
106
121
|
readonly name: string;
|
|
@@ -108,20 +123,23 @@ export declare class Shortcut {
|
|
|
108
123
|
private readonly color;
|
|
109
124
|
private readonly glyph;
|
|
110
125
|
private readonly inputClasses;
|
|
126
|
+
private readonly types;
|
|
111
127
|
constructor(name: string, options?: ShortcutOptions);
|
|
112
128
|
/**
|
|
113
129
|
* Append an action. With an identifier from `actions`, parameter keys are checked at compile
|
|
114
130
|
* time; any identifier is also validated at run time against the bundled definitions.
|
|
115
131
|
*/
|
|
116
132
|
action<I extends string>(identifier: I, params?: ParamsFor<I>): Action;
|
|
117
|
-
if(
|
|
133
|
+
if(subject_: Attachment, condition: Condition | number, value?: string | number): string;
|
|
118
134
|
otherwise(gid: string): void;
|
|
119
135
|
endIf(gid: string): void;
|
|
120
|
-
repeatEach(items:
|
|
121
|
-
|
|
136
|
+
repeatEach(items: ParamTypes["is.workflow.actions.repeat.each"]["WFInput"]): string;
|
|
137
|
+
/** Close a Repeat with Each block. The returned action is the block's output: `ref()` it for the collected "Repeat Results". */
|
|
138
|
+
endRepeatEach(gid: string): Action;
|
|
122
139
|
/** Open a Repeat block that runs `count` times; returns the grouping identifier for endRepeatCount(). */
|
|
123
|
-
repeatCount(count:
|
|
124
|
-
|
|
140
|
+
repeatCount(count: ParamTypes["is.workflow.actions.repeat.count"]["WFRepeatCount"]): string;
|
|
141
|
+
/** Close a Repeat block. The returned action is the block's output: `ref()` it for the collected "Repeat Results". */
|
|
142
|
+
endRepeatCount(gid: string): Action;
|
|
125
143
|
/**
|
|
126
144
|
* Open a Choose from Menu block. Follow with one menuItem() per title, in order, each with the
|
|
127
145
|
* actions of that branch, then endMenu(). Returns the grouping identifier.
|