@popclip/types 1.4586.2 → 1.4615.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/package.json +6 -2
- package/popclip.d.ts +38 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popclip/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4615.0",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"typedoc": "0.25.13",
|
|
6
6
|
"typescript": "5.4.5"
|
|
@@ -10,5 +10,9 @@
|
|
|
10
10
|
"check": "tsc --noEmit",
|
|
11
11
|
"docs": "typedoc"
|
|
12
12
|
},
|
|
13
|
-
"types": "./popclip.d.ts"
|
|
13
|
+
"types": "./popclip.d.ts",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/pilotmoon/popclip-types"
|
|
17
|
+
}
|
|
14
18
|
}
|
package/popclip.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ interface AssociatedApp {
|
|
|
152
152
|
* @param context Information about the context surrounding the selection. (Same object as {@link PopClip.context}.)
|
|
153
153
|
* @returns A single action, an array of actions.
|
|
154
154
|
*/
|
|
155
|
-
type PopulationFunction<CustomOptions
|
|
155
|
+
type PopulationFunction<CustomOptions = Options> = (
|
|
156
156
|
input: Input,
|
|
157
157
|
options: CustomOptions,
|
|
158
158
|
context: Context,
|
|
@@ -413,7 +413,7 @@ interface ActionProperties extends IconProperties {
|
|
|
413
413
|
* @param options Current values of the options for this extension. (Same object as {@link PopClip.options}.)
|
|
414
414
|
* @param context Information about the context surrounding the selection. (Same object as {@link PopClip.context}.)
|
|
415
415
|
*/
|
|
416
|
-
type ActionFunction<CustomOptions
|
|
416
|
+
type ActionFunction<CustomOptions = Options> = (
|
|
417
417
|
input: Input,
|
|
418
418
|
options: CustomOptions & AuthOptions,
|
|
419
419
|
context: Context,
|
|
@@ -423,8 +423,7 @@ type ActionFunction<CustomOptions extends Options = Options> = (
|
|
|
423
423
|
* **Action** represents the properties of a single action.
|
|
424
424
|
* If `code` is omitted, the action displays a disabled title/icon only.
|
|
425
425
|
*/
|
|
426
|
-
interface Action<CustomOptions
|
|
427
|
-
extends ActionProperties {
|
|
426
|
+
interface Action<CustomOptions = Options> extends ActionProperties {
|
|
428
427
|
code?: ActionFunction<CustomOptions>;
|
|
429
428
|
}
|
|
430
429
|
|
|
@@ -434,8 +433,7 @@ type Entitlement = "network" | "dynamic";
|
|
|
434
433
|
/**
|
|
435
434
|
* The Extension object defines the PopClip extension.
|
|
436
435
|
*/
|
|
437
|
-
interface Extension<CustomOptions
|
|
438
|
-
extends ActionProperties {
|
|
436
|
+
interface Extension<CustomOptions = Options> extends ActionProperties {
|
|
439
437
|
/**
|
|
440
438
|
* The display name of this extension.
|
|
441
439
|
*/
|
|
@@ -480,6 +478,9 @@ interface Extension<CustomOptions extends Options = Options>
|
|
|
480
478
|
module?: string;
|
|
481
479
|
}
|
|
482
480
|
|
|
481
|
+
/**
|
|
482
|
+
* The possible values for `type` of {@link Option}.
|
|
483
|
+
*/
|
|
483
484
|
type OptionType =
|
|
484
485
|
| "string"
|
|
485
486
|
| "boolean"
|
|
@@ -529,6 +530,9 @@ interface OptionBase {
|
|
|
529
530
|
inset?: boolean;
|
|
530
531
|
}
|
|
531
532
|
|
|
533
|
+
/**
|
|
534
|
+
A string-valued option.
|
|
535
|
+
*/
|
|
532
536
|
interface StringOption extends OptionBase {
|
|
533
537
|
type: "string";
|
|
534
538
|
/**
|
|
@@ -537,6 +541,9 @@ interface StringOption extends OptionBase {
|
|
|
537
541
|
defaultValue?: string;
|
|
538
542
|
}
|
|
539
543
|
|
|
544
|
+
/**
|
|
545
|
+
* A multiple-choice option.
|
|
546
|
+
*/
|
|
540
547
|
interface MultipleOption extends OptionBase {
|
|
541
548
|
type: "multiple";
|
|
542
549
|
/**
|
|
@@ -550,12 +557,15 @@ interface MultipleOption extends OptionBase {
|
|
|
550
557
|
values?: string[];
|
|
551
558
|
|
|
552
559
|
/**
|
|
553
|
-
* Display names corresponding to the entries in the
|
|
560
|
+
* Display names corresponding to the entries in the {@link values} array. These are shown in the option UI.
|
|
554
561
|
* If ommitted, the raw value strings are shown instead.
|
|
555
562
|
*/
|
|
556
563
|
valueLabels?: LocalizableString[];
|
|
557
564
|
}
|
|
558
565
|
|
|
566
|
+
/**
|
|
567
|
+
* A boolean option.
|
|
568
|
+
*/
|
|
559
569
|
interface BooleanOption extends OptionBase {
|
|
560
570
|
type: "boolean";
|
|
561
571
|
/**
|
|
@@ -568,14 +578,23 @@ interface BooleanOption extends OptionBase {
|
|
|
568
578
|
icon?: string;
|
|
569
579
|
}
|
|
570
580
|
|
|
581
|
+
/**
|
|
582
|
+
* A concealed string option.
|
|
583
|
+
*/
|
|
571
584
|
interface PasswordOption extends OptionBase {
|
|
572
585
|
type: "password" | "secret";
|
|
573
586
|
}
|
|
574
587
|
|
|
588
|
+
/**
|
|
589
|
+
* A heading option, which does not define an actual option, but adds a heading in the preferences window.
|
|
590
|
+
*/
|
|
575
591
|
interface HeadingOption extends OptionBase {
|
|
576
592
|
type: "heading";
|
|
577
593
|
}
|
|
578
594
|
|
|
595
|
+
/**
|
|
596
|
+
Represents a single option in the extension's preferences.
|
|
597
|
+
*/
|
|
579
598
|
type Option =
|
|
580
599
|
| StringOption
|
|
581
600
|
| MultipleOption
|
|
@@ -831,17 +850,22 @@ interface PopClip {
|
|
|
831
850
|
) => void;
|
|
832
851
|
|
|
833
852
|
/**
|
|
834
|
-
* Display text
|
|
835
|
-
*
|
|
836
|
-
* @param
|
|
837
|
-
* @param options
|
|
853
|
+
* Display text to the user.
|
|
854
|
+
* @param text The text to display.
|
|
855
|
+
* @param options Options.
|
|
838
856
|
*/
|
|
839
857
|
showText: (
|
|
840
858
|
text: string,
|
|
841
859
|
options?: {
|
|
842
860
|
/**
|
|
843
|
-
*
|
|
844
|
-
*
|
|
861
|
+
* Display style:
|
|
862
|
+
* - `compact` (default): Show the text inside PopClip's popup. It will be truncated to 160 characters when shown.
|
|
863
|
+
* - `large`: Show as "Large Type" in full screen.
|
|
864
|
+
*/
|
|
865
|
+
style?: "compact" | "large";
|
|
866
|
+
/**
|
|
867
|
+
* Applies to `compact` display mode only. If `true`, and the app's Paste command is available,
|
|
868
|
+
* the displayed text will be in a clickable button, which clicked, pastes the full text.
|
|
845
869
|
*/
|
|
846
870
|
preview?: boolean;
|
|
847
871
|
},
|
|
@@ -1249,6 +1273,6 @@ declare function sleep(durationMilliseconds: number): Promise<void>;
|
|
|
1249
1273
|
*
|
|
1250
1274
|
* @param extension The extension object to export.
|
|
1251
1275
|
*/
|
|
1252
|
-
declare function defineExtension<CustomOptions
|
|
1276
|
+
declare function defineExtension<CustomOptions = Options>(
|
|
1253
1277
|
extension: Extension<CustomOptions>,
|
|
1254
1278
|
): void;
|