@popclip/types 1.4624.2 → 1.4663.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popclip/types",
3
- "version": "1.4624.2",
3
+ "version": "1.4663.0",
4
4
  "devDependencies": {
5
5
  "typedoc": "0.25.13",
6
6
  "typescript": "5.4.5"
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
  /**
@@ -984,6 +984,14 @@ interface PopClip {
984
984
  * Bundle identifier of the app to open the URL with. For example `"com.google.Chrome"`.
985
985
  */
986
986
  app?: string;
987
+ /**
988
+ * Whether to request that macOS activate the target app. (Default: `true`)
989
+ */
990
+ activate?: boolean;
991
+ /**
992
+ * Whether to open the URL in a background browser tab, where supported. (Default: `false`)
993
+ */
994
+ backgroundTab?: boolean;
987
995
  },
988
996
  ) => void;
989
997
 
@@ -1026,7 +1034,7 @@ interface Util {
1026
1034
  * @param string The string to localize.
1027
1035
  * @return The localized string, or the original string if no localized version was avaiable.
1028
1036
  */
1029
- localize: (string: string) => string;
1037
+ localize(string: string): string;
1030
1038
 
1031
1039
  /**
1032
1040
  Get information about the current locale as configures in macOS settings.
@@ -1051,7 +1059,7 @@ interface Util {
1051
1059
  daylightSaving: boolean;
1052
1060
  };
1053
1061
 
1054
- htmlToRtf: (html: string) => string | undefined;
1062
+ htmlToRtf(html: string): string | undefined;
1055
1063
 
1056
1064
  /**
1057
1065
  * Encode a string as UTF-8 then Base-64 encode the result.
@@ -1059,7 +1067,7 @@ interface Util {
1059
1067
  * @param string The string to encode.
1060
1068
  * @param options
1061
1069
  */
1062
- base64Encode: (
1070
+ base64Encode(
1063
1071
  string: string,
1064
1072
  options?: {
1065
1073
  /**
@@ -1071,7 +1079,7 @@ interface Util {
1071
1079
  */
1072
1080
  trimmed?: boolean;
1073
1081
  },
1074
- ) => string;
1082
+ ): string;
1075
1083
 
1076
1084
  /**
1077
1085
  * Decode a Base-64 string and interpret the result as a UTF-8 string.
@@ -1082,7 +1090,7 @@ interface Util {
1082
1090
  * @param string
1083
1091
  * @returns The decoded string
1084
1092
  */
1085
- base64Decode: (string: string) => string;
1093
+ base64Decode(string: string): string;
1086
1094
 
1087
1095
  /* Build a URL from a base URL and additional query parameters */
1088
1096
  buildQueryUrl: (baseUrl: string, params: { [key: string]: string }) => string;
@@ -1094,13 +1102,13 @@ interface Util {
1094
1102
  parseQuery: (query: string) => any;
1095
1103
 
1096
1104
  /** Decipher a JSON object that has been lightly obscured to prevent constants such as
1097
- * API keys appearing in plaintext in the source files.
1105
+ * API client identifiers appearing in plaintext in the source files.
1098
1106
  *
1099
1107
  * This function will ROT13 decipher the text, apply Base64 decoding, and parse the result as JSON. */
1100
- clarify: (obscuredString: string) => any;
1108
+ clarify(obscuredString: string): any;
1101
1109
 
1102
1110
  // same as global sleep()
1103
- sleep: (durationMilliseconds: number) => Promise<void>;
1111
+ sleep(durationMilliseconds: number): Promise<void>;
1104
1112
 
1105
1113
  /**
1106
1114
  * Fill the provided `TypedArray` with cryptographically secure random values.
@@ -1129,6 +1137,22 @@ interface Util {
1129
1137
  | BigUint64Array,
1130
1138
  ): void;
1131
1139
 
1140
+ /**
1141
+ * Generate a RFC 4122 version 4 UUID using a cryptographically secure random number generator.
1142
+ * @returns UUID string such as "e621e1f8-c36c-495a-93fc-0c247a3e6e5f".
1143
+ */
1144
+ randomUuid(): string;
1145
+
1146
+ /**
1147
+ * Generate hash-based message authentication code (HMAC) using the supplied data, key and algorithm.
1148
+ * Implemented internally by Apple's CommonCrypto.
1149
+ */
1150
+ hmac(
1151
+ data: Uint8Array,
1152
+ key: Uint8Array,
1153
+ algorithm: "sha1" | "md5" | "sha256" | "sha384" | "sha512" | "sha224",
1154
+ ): Uint8Array;
1155
+
1132
1156
  /**
1133
1157
  * The `constant` property is a container for pre-defined constants.
1134
1158
  */
@@ -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;
@@ -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;