@popclip/types 1.4586.0 → 1.4586.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/extra/define.d.ts +23 -0
- package/extra/require.d.ts +32 -0
- package/extra/shims.d.ts +20 -0
- package/extra/timeout.d.ts +27 -0
- package/package.json +6 -6
- package/popclip.d.ts +5 -112
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export an object for use by another file.
|
|
3
|
+
*
|
|
4
|
+
* #### Notes
|
|
5
|
+
*
|
|
6
|
+
* The _define_ function family exports an arbitrary object, which other files can import using {@link require}.
|
|
7
|
+
*
|
|
8
|
+
* It should be called only once in any file; if it is called more than once, only the
|
|
9
|
+
* final call will have any effect.
|
|
10
|
+
*
|
|
11
|
+
* Partially implements AMD spec: https://github.com/amdjs/amdjs-api/wiki/AMD
|
|
12
|
+
*
|
|
13
|
+
* Recommendation: instead of this, use {@link defineExtension} or `module.exports = ...`.
|
|
14
|
+
*/
|
|
15
|
+
declare function define(object: object): void;
|
|
16
|
+
declare function define(factory: () => object): void;
|
|
17
|
+
declare function define(dependencies: string[], factory: () => object): void;
|
|
18
|
+
declare function define(id: string, factory: () => object): void;
|
|
19
|
+
declare function define(
|
|
20
|
+
id: string,
|
|
21
|
+
dependencies: string[],
|
|
22
|
+
factory: () => object,
|
|
23
|
+
): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popclip/types",
|
|
3
|
+
"version": "1.4586.1",
|
|
4
|
+
"devDependencies": {
|
|
5
|
+
"typedoc": "0.25.13",
|
|
6
|
+
"typescript": "5.4.5"
|
|
7
|
+
},
|
|
3
8
|
"license": "MIT",
|
|
4
|
-
"version": "1.4586.0",
|
|
5
|
-
"types": "./popclip.d.ts",
|
|
6
9
|
"scripts": {
|
|
7
10
|
"check": "tsc --noEmit",
|
|
8
11
|
"docs": "typedoc"
|
|
9
12
|
},
|
|
10
|
-
"
|
|
11
|
-
"typedoc": "0.25.13",
|
|
12
|
-
"typescript": "5.4.5"
|
|
13
|
-
}
|
|
13
|
+
"types": "./popclip.d.ts"
|
|
14
14
|
}
|
package/popclip.d.ts
CHANGED
|
@@ -1195,29 +1195,12 @@ declare const pasteboard: Pasteboard;
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
declare function print(...args: any[]): void;
|
|
1197
1197
|
|
|
1198
|
-
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
*
|
|
1203
|
-
* The _define_ function family exports an arbitrary object, which other files can import using {@link require}.
|
|
1204
|
-
*
|
|
1205
|
-
* It should be called only once in any file; if it is called more than once, only the
|
|
1206
|
-
* final call will have any effect.
|
|
1207
|
-
*
|
|
1208
|
-
* Partially implements AMD spec: https://github.com/amdjs/amdjs-api/wiki/AMD
|
|
1209
|
-
*
|
|
1210
|
-
* Recommendation: instead of this, use {@link defineExtension} or `module.exports = ...`.
|
|
1198
|
+
/**
|
|
1199
|
+
* A promise-based sleep function. Included as a more convenient alternative
|
|
1200
|
+
* to {@link setTimeout} for performing simple delays. Call as `await sleep(1000)`.
|
|
1201
|
+
* @param durationMilliseconds How long to sleep in milliseconds
|
|
1211
1202
|
*/
|
|
1212
|
-
declare function
|
|
1213
|
-
declare function define(factory: () => object): void;
|
|
1214
|
-
declare function define(dependencies: string[], factory: () => object): void;
|
|
1215
|
-
declare function define(id: string, factory: () => object): void;
|
|
1216
|
-
declare function define(
|
|
1217
|
-
id: string,
|
|
1218
|
-
dependencies: string[],
|
|
1219
|
-
factory: () => object,
|
|
1220
|
-
): void;
|
|
1203
|
+
declare function sleep(durationMilliseconds: number): Promise<void>;
|
|
1221
1204
|
|
|
1222
1205
|
/**
|
|
1223
1206
|
* This global function may be called as an alternative to setting `module.exports` directly.
|
|
@@ -1233,93 +1216,3 @@ declare function define(
|
|
|
1233
1216
|
declare function defineExtension<CustomOptions extends Options = Options>(
|
|
1234
1217
|
extension: Extension<CustomOptions>,
|
|
1235
1218
|
): void;
|
|
1236
|
-
|
|
1237
|
-
/* Declare ambient module + exports for CommonJS-style exporting */
|
|
1238
|
-
declare const module: { exports: any };
|
|
1239
|
-
declare const exports: any;
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* Import an object from another file.
|
|
1243
|
-
*
|
|
1244
|
-
* #### Notes
|
|
1245
|
-
*
|
|
1246
|
-
* PopClip's `require()` implementation attempts to import from the following module formats:
|
|
1247
|
-
*
|
|
1248
|
-
* - AMD modules, which use `define(...)`.
|
|
1249
|
-
* - CommonJS modules, which use `module.exports = ...` or `exports.name = ...`
|
|
1250
|
-
* - TypeScript-compiled ES modules, which use `exports.default = ...`
|
|
1251
|
-
*
|
|
1252
|
-
* #### Notes
|
|
1253
|
-
*
|
|
1254
|
-
* Paths beginning with `./` or `../` are resolved relative to the the location of the current file.
|
|
1255
|
-
*
|
|
1256
|
-
* Otherwise, the path is resolved relative to the extensions's package root.
|
|
1257
|
-
* If there is no file in the extension, PopClip will look in its internal module repository.
|
|
1258
|
-
*
|
|
1259
|
-
* If no file extension is given, PopCLip will try adding the extensions `.js`, `.ts`, `.json` in that order.
|
|
1260
|
-
*
|
|
1261
|
-
* TypeScript files are transpiled to JavaScript on the fly.
|
|
1262
|
-
*
|
|
1263
|
-
* JSON files are parsed and returned as an object.å
|
|
1264
|
-
*
|
|
1265
|
-
* @param file Path to the file to import.
|
|
1266
|
-
* @return The imported object.
|
|
1267
|
-
*/
|
|
1268
|
-
declare function require(file: string): object;
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* A promise-based sleep function. Included as a more convenient alternative
|
|
1272
|
-
* to {@link setTimeout} for performing simple delays. Call as `await sleep(1000)`.
|
|
1273
|
-
* @param durationMilliseconds How long to sleep in milliseconds
|
|
1274
|
-
*/
|
|
1275
|
-
declare function sleep(durationMilliseconds: number): Promise<void>;
|
|
1276
|
-
|
|
1277
|
-
/* WebAPI and Node.js Globals
|
|
1278
|
-
* The following functions and objects are available in PopClip via polyfills.
|
|
1279
|
-
*/
|
|
1280
|
-
|
|
1281
|
-
/**
|
|
1282
|
-
* Call a function after a specified time interval.
|
|
1283
|
-
*
|
|
1284
|
-
* #### Notes
|
|
1285
|
-
*
|
|
1286
|
-
* This is PopClip's own implementation of the standard
|
|
1287
|
-
* [setTimeout](http://developer.mozilla.org/en-US/docs/Web/API/SetTimeout) function,
|
|
1288
|
-
* as found in browsers.
|
|
1289
|
-
* Ordinarily you shouldn't need to use this. It is is mainly included for
|
|
1290
|
-
* compatibility with libraries that might need it.
|
|
1291
|
-
*
|
|
1292
|
-
* @param callback A function to be called after the timer expires.
|
|
1293
|
-
* @param timeout Timeout in milliseconds. If this parameter is omitted, a value of 0 is used,
|
|
1294
|
-
* @param args Additional arguments to be passed to the callback function.
|
|
1295
|
-
* @returns Numeric identifier for the timer which can be passed to {@link clearTimeout} to cancel it.
|
|
1296
|
-
*/
|
|
1297
|
-
declare function setTimeout(
|
|
1298
|
-
callback: (...args: any) => void,
|
|
1299
|
-
timeout?: number,
|
|
1300
|
-
...args: any
|
|
1301
|
-
): number;
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* Cancels a timeout prevouly created with {@link setTimeout}.
|
|
1305
|
-
* @param timeoutId Identifier of the timeout to cancel.
|
|
1306
|
-
*/
|
|
1307
|
-
declare function clearTimeout(timeoutId: number): void;
|
|
1308
|
-
|
|
1309
|
-
// these are from WebAPI, and are implemented in PopClip with polyfills from `core-js` library
|
|
1310
|
-
declare function btoa(string: string): string;
|
|
1311
|
-
declare function atob(string: string): string;
|
|
1312
|
-
declare function structuredClone<T>(value: T): T;
|
|
1313
|
-
declare const URL: any;
|
|
1314
|
-
declare const URLSearchParams: any;
|
|
1315
|
-
|
|
1316
|
-
// XMLHttpRequest is implemented natively in PopClip
|
|
1317
|
-
declare const XMLHttpRequest: any;
|
|
1318
|
-
|
|
1319
|
-
// Blob is is a WebAPI object, implemented in PopClip with 'node-blob` library
|
|
1320
|
-
declare const Blob: any;
|
|
1321
|
-
|
|
1322
|
-
// Buffer is a node.js object, implemented in PopClip with 'buffer' library
|
|
1323
|
-
declare const Buffer: any;
|
|
1324
|
-
|
|
1325
|
-
// TODO: Not sure how to improve typings for these imported globals?
|