@popclip/types 1.4624.1 → 1.4636.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/package.json +1 -1
- package/popclip.d.ts +26 -6
- package/extra/require.d.ts +0 -32
- package/extra/shims.d.ts +0 -20
- package/extra/timeout.d.ts +0 -27
package/package.json
CHANGED
package/popclip.d.ts
CHANGED
|
@@ -554,13 +554,13 @@ interface MultipleOption extends OptionBase {
|
|
|
554
554
|
/**
|
|
555
555
|
* The possible values for a `multiple` option.
|
|
556
556
|
*/
|
|
557
|
-
readonly values?: string[];
|
|
557
|
+
readonly values?: readonly string[];
|
|
558
558
|
|
|
559
559
|
/**
|
|
560
560
|
* Display names corresponding to the entries in the {@link values} array. These are shown in the option UI.
|
|
561
561
|
* If ommitted, the raw value strings are shown instead.
|
|
562
562
|
*/
|
|
563
|
-
readonly valueLabels?: LocalizableString[];
|
|
563
|
+
readonly valueLabels?: readonly LocalizableString[];
|
|
564
564
|
}
|
|
565
565
|
|
|
566
566
|
/**
|
|
@@ -604,9 +604,8 @@ type Option =
|
|
|
604
604
|
|
|
605
605
|
// Create a type mapping from Option Type to TypeScript types
|
|
606
606
|
type OptionTypeMapping = {
|
|
607
|
-
secret: string;
|
|
608
|
-
password: string;
|
|
609
607
|
string: string;
|
|
608
|
+
secret: string;
|
|
610
609
|
multiple: string;
|
|
611
610
|
boolean: boolean;
|
|
612
611
|
};
|
|
@@ -616,12 +615,17 @@ type ExtractType<T extends Option> = T["type"] extends keyof OptionTypeMapping
|
|
|
616
615
|
? OptionTypeMapping[T["type"]]
|
|
617
616
|
: never;
|
|
618
617
|
|
|
618
|
+
// Helper type to exclude `never` properties
|
|
619
|
+
type ExcludeNever<T> = {
|
|
620
|
+
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
621
|
+
};
|
|
622
|
+
|
|
619
623
|
// Create a utility type to infer the OmnivoreOptions type
|
|
620
|
-
type InferOptions<T extends readonly Option[]> = {
|
|
624
|
+
type InferOptions<T extends readonly Option[]> = ExcludeNever<{
|
|
621
625
|
readonly [K in T[number]["identifier"]]: ExtractType<
|
|
622
626
|
Extract<T[number], { identifier: K }>
|
|
623
627
|
>;
|
|
624
|
-
}
|
|
628
|
+
}>;
|
|
625
629
|
|
|
626
630
|
/**
|
|
627
631
|
* Represents a generic range, as a location and length
|
|
@@ -1125,6 +1129,22 @@ interface Util {
|
|
|
1125
1129
|
| BigUint64Array,
|
|
1126
1130
|
): void;
|
|
1127
1131
|
|
|
1132
|
+
/**
|
|
1133
|
+
* Generate a RFC 4122 version 4 UUID using a cryptographically secure random number generator.
|
|
1134
|
+
* @returns UUID string such as "e621e1f8-c36c-495a-93fc-0c247a3e6e5f".
|
|
1135
|
+
*/
|
|
1136
|
+
randomUuid(): string;
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Generate hash-based message authentication code (HMAC) using the supplied data, key and algorithm.
|
|
1140
|
+
* Implemented internally by Apple's CommonCrypto.
|
|
1141
|
+
*/
|
|
1142
|
+
hmac(
|
|
1143
|
+
data: Uint8Array,
|
|
1144
|
+
key: Uint8Array,
|
|
1145
|
+
algorithm: "sha1" | "md5" | "sha256" | "sha384" | "sha512" | "sha224",
|
|
1146
|
+
): Uint8Array;
|
|
1147
|
+
|
|
1128
1148
|
/**
|
|
1129
1149
|
* The `constant` property is a container for pre-defined constants.
|
|
1130
1150
|
*/
|
package/extra/require.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* Declare ambient module + exports for CommonJS-style exporting */
|
|
2
|
-
declare const module: { exports: any };
|
|
3
|
-
declare const exports: any;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Import an object from another file.
|
|
7
|
-
*
|
|
8
|
-
* #### Notes
|
|
9
|
-
*
|
|
10
|
-
* PopClip's `require()` implementation attempts to import from the following module formats:
|
|
11
|
-
*
|
|
12
|
-
* - AMD modules, which use `define(...)`.
|
|
13
|
-
* - CommonJS modules, which use `module.exports = ...` or `exports.name = ...`
|
|
14
|
-
* - TypeScript-compiled ES modules, which use `exports.default = ...`
|
|
15
|
-
*
|
|
16
|
-
* #### Notes
|
|
17
|
-
*
|
|
18
|
-
* Paths beginning with `./` or `../` are resolved relative to the the location of the current file.
|
|
19
|
-
*
|
|
20
|
-
* Otherwise, the path is resolved relative to the extensions's package root.
|
|
21
|
-
* If there is no file in the extension, PopClip will look in its internal module repository.
|
|
22
|
-
*
|
|
23
|
-
* If no file extension is given, PopCLip will try adding the extensions `.js`, `.ts`, `.json` in that order.
|
|
24
|
-
*
|
|
25
|
-
* TypeScript files are transpiled to JavaScript on the fly.
|
|
26
|
-
*
|
|
27
|
-
* JSON files are parsed and returned as an object.å
|
|
28
|
-
*
|
|
29
|
-
* @param file Path to the file to import.
|
|
30
|
-
* @return The imported object.
|
|
31
|
-
*/
|
|
32
|
-
declare function require(file: string): object;
|
package/extra/shims.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* WebAPI and Node.js Globals
|
|
2
|
-
* The following functions and objects are available in PopClip via polyfills.
|
|
3
|
-
* TODO: Not sure how to improve typings for these?
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// these are from WebAPI, and are implemented in PopClip with polyfills from `core-js` library
|
|
7
|
-
declare function btoa(string: string): string;
|
|
8
|
-
declare function atob(string: string): string;
|
|
9
|
-
declare function structuredClone<T>(value: T): T;
|
|
10
|
-
declare const URL: any;
|
|
11
|
-
declare const URLSearchParams: any;
|
|
12
|
-
|
|
13
|
-
// XMLHttpRequest is implemented natively in PopClip
|
|
14
|
-
declare const XMLHttpRequest: any;
|
|
15
|
-
|
|
16
|
-
// Blob is is a WebAPI object, implemented in PopClip with 'node-blob` library
|
|
17
|
-
declare const Blob: any;
|
|
18
|
-
|
|
19
|
-
// Buffer is a node.js object, implemented in PopClip with 'buffer' library
|
|
20
|
-
declare const Buffer: any;
|
package/extra/timeout.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Call a function after a specified time interval.
|
|
3
|
-
*
|
|
4
|
-
* #### Notes
|
|
5
|
-
*
|
|
6
|
-
* This is PopClip's own implementation of the standard
|
|
7
|
-
* [setTimeout](http://developer.mozilla.org/en-US/docs/Web/API/SetTimeout) function,
|
|
8
|
-
* as found in browsers.
|
|
9
|
-
* Ordinarily you shouldn't need to use this. It is is mainly included for
|
|
10
|
-
* compatibility with libraries that might need it.
|
|
11
|
-
*
|
|
12
|
-
* @param callback A function to be called after the timer expires.
|
|
13
|
-
* @param timeout Timeout in milliseconds. If this parameter is omitted, a value of 0 is used,
|
|
14
|
-
* @param args Additional arguments to be passed to the callback function.
|
|
15
|
-
* @returns Numeric identifier for the timer which can be passed to {@link clearTimeout} to cancel it.
|
|
16
|
-
*/
|
|
17
|
-
declare function setTimeout(
|
|
18
|
-
callback: (...args: any) => void,
|
|
19
|
-
timeout?: number,
|
|
20
|
-
...args: any
|
|
21
|
-
): number;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cancels a timeout prevouly created with {@link setTimeout}.
|
|
25
|
-
* @param timeoutId Identifier of the timeout to cancel.
|
|
26
|
-
*/
|
|
27
|
-
declare function clearTimeout(timeoutId: number): void;
|