🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@farjs/filelist

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farjs/filelist - npm Package Compare versions

Comparing version
0.9.0
to
0.10.0
+1
-1
package.json
{
"name": "@farjs/filelist",
"author": "viktor-podzigun",
"version": "0.9.0",
"version": "0.10.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "description": "Common plugin/api/ui for FAR.js File Browser module",

@@ -16,22 +16,20 @@ /**

/**
* @typedef {{
* onKeyTrigger(key: string, stacks: WithStacksProps, data?: any): Promise<ReactComponent | undefined>;
* onFileTrigger(filePath: string, fileHeader: Uint8Array, onClose: () => void): Promise<PanelStackItem<FileListState> | undefined>;
* }} IFileListPlugin
*/
/**
* @implements {IFileListPlugin}
*/
class FileListPlugin {
/**
* @param {string} key
* @param {WithStacksProps} stacks
* @param {any} [data]
* @returns {Promise<ReactComponent | undefined>}
*/
//@ts-ignore
onKeyTrigger(key, stacks, data) {
/** @type {IFileListPlugin['onKeyTrigger']} */
onKeyTrigger() {
return Promise.resolve(undefined);
}
/**
* @param {string} filePath
* @param {Uint8Array} fileHeader
* @param {() => void} onClose
* @returns {Promise<PanelStackItem<FileListState> | undefined>}
*/
//@ts-ignore
onFileTrigger(filePath, fileHeader, onClose) {
/** @type {IFileListPlugin['onFileTrigger']} */
onFileTrigger() {
return Promise.resolve(undefined);

@@ -38,0 +36,0 @@ }

@@ -1,33 +0,39 @@

import FileListPlugin from "./FileListPlugin.mjs";
/**
* @import { IFileListPlugin } from "./FileListPlugin.mjs"
*/
import { lazyFn } from "./utils.mjs";
class FileListPluginLoader extends FileListPlugin {
/**
* @param {readonly string[]} triggerKeys
* @param {() => Promise<FileListPlugin>} load
*/
constructor(triggerKeys, load) {
super();
/**
* @typedef {IFileListPlugin & {
* readonly triggerKeys: readonly string[];
* }} FileListPluginLoader
*/
/** @readonly @type {readonly string[]} */
this.triggerKeys = triggerKeys;
/**
* @param {readonly string[]} triggerKeys
* @param {() => Promise<IFileListPlugin>} load
* @returns {FileListPluginLoader}
*/
function FileListPluginLoader(triggerKeys, load) {
const lazyLoad = lazyFn(load);
/** @readonly @private @type {() => Promise<FileListPlugin>} */
this.load = load;
}
return {
triggerKeys,
/** @type {FileListPlugin['onKeyTrigger']} */
async onKeyTrigger(key, stacks, data) {
const p = await this.load();
/** @type {IFileListPlugin['onKeyTrigger']} */
onKeyTrigger: async (key, stacks, data) => {
const p = await lazyLoad();
return p.onKeyTrigger(key, stacks, data);
}
return p.onKeyTrigger(key, stacks, data);
},
/** @type {FileListPlugin['onFileTrigger']} */
async onFileTrigger(filePath, fileHeader, onClose) {
const p = await this.load();
/** @type {IFileListPlugin['onFileTrigger']} */
onFileTrigger: async (filePath, fileHeader, onClose) => {
const p = await lazyLoad();
return p.onFileTrigger(filePath, fileHeader, onClose);
}
return p.onFileTrigger(filePath, fileHeader, onClose);
},
};
}
export default FileListPluginLoader;

@@ -6,2 +6,6 @@ export default FileListPlugin;

};
export type IFileListPlugin = {
onKeyTrigger(key: string, stacks: WithStacksProps, data?: any): Promise<ReactComponent | undefined>;
onFileTrigger(filePath: string, fileHeader: Uint8Array, onClose: () => void): Promise<PanelStackItem<FileListState> | undefined>;
};
/**

@@ -13,16 +17,13 @@ * @typedef {{

*/
declare class FileListPlugin {
/**
* @param {string} key
* @param {WithStacksProps} stacks
* @param {any} [data]
* @returns {Promise<ReactComponent | undefined>}
*/
/**
* @typedef {{
* onKeyTrigger(key: string, stacks: WithStacksProps, data?: any): Promise<ReactComponent | undefined>;
* onFileTrigger(filePath: string, fileHeader: Uint8Array, onClose: () => void): Promise<PanelStackItem<FileListState> | undefined>;
* }} IFileListPlugin
*/
/**
* @implements {IFileListPlugin}
*/
declare class FileListPlugin implements IFileListPlugin {
onKeyTrigger(key: string, stacks: WithStacksProps, data?: any): Promise<ReactComponent | undefined>;
/**
* @param {string} filePath
* @param {Uint8Array} fileHeader
* @param {() => void} onClose
* @returns {Promise<PanelStackItem<FileListState> | undefined>}
*/
onFileTrigger(filePath: string, fileHeader: Uint8Array, onClose: () => void): Promise<PanelStackItem<FileListState> | undefined>;

@@ -29,0 +30,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"FileListPlugin.d.mts","sourceRoot":"","sources":["../src/FileListPlugin.mjs"],"names":[],"mappings":";oCASa;IACZ,QAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC;CAChB;AAJJ;;;;;GAKG;AAEH;IACE;;;;;OAKG;IAEH,kBANW,MAAM,UACN,eAAe,SACf,GAAG,GACD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAK/C;IAED;;;;;OAKG;IAEH,wBANW,MAAM,cACN,UAAU,WACV,MAAM,IAAI,GACR,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,CAK9D;CACF;8BAlC4B,oBAAoB;qCAFb,wBAAwB;oCAGzB,oBAAoB;2BAE5B,4BAA4B;mCAJrB,qBAAqB"}
{"version":3,"file":"FileListPlugin.d.mts","sourceRoot":"","sources":["../src/FileListPlugin.mjs"],"names":[],"mappings":";oCASa;IACZ,QAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC;CAChB;8BAIS;IACT,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACpG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,CAAC;CACjI;AAXJ;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;GAEG;AACH,wCAFgB,eAAe;IAN9B,kBAAqB,MAAM,UAAU,eAAe,SAAS,GAAG,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACvG,wBAA2B,MAAM,cAAc,UAAU,WAAW,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,CAAC;CAiBpI;8BAhC4B,oBAAoB;qCAFb,wBAAwB;oCAGzB,oBAAoB;2BAE5B,4BAA4B;mCAJrB,qBAAqB"}
export default FileListPluginLoader;
declare class FileListPluginLoader extends FileListPlugin {
/**
* @param {readonly string[]} triggerKeys
* @param {() => Promise<FileListPlugin>} load
*/
constructor(triggerKeys: readonly string[], load: () => Promise<FileListPlugin>);
/** @readonly @type {readonly string[]} */
export type FileListPluginLoader = IFileListPlugin & {
readonly triggerKeys: readonly string[];
/** @readonly @private @type {() => Promise<FileListPlugin>} */
private readonly load;
}
import FileListPlugin from "./FileListPlugin.mjs";
};
/**
* @typedef {IFileListPlugin & {
* readonly triggerKeys: readonly string[];
* }} FileListPluginLoader
*/
/**
* @param {readonly string[]} triggerKeys
* @param {() => Promise<IFileListPlugin>} load
* @returns {FileListPluginLoader}
*/
declare function FileListPluginLoader(triggerKeys: readonly string[], load: () => Promise<IFileListPlugin>): FileListPluginLoader;
import type { IFileListPlugin } from "./FileListPlugin.mjs";
//# sourceMappingURL=FileListPluginLoader.d.mts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"FileListPluginLoader.d.mts","sourceRoot":"","sources":["../src/FileListPluginLoader.mjs"],"names":[],"mappings":";AAEA;IACE;;;OAGG;IACH,yBAHW,SAAS,MAAM,EAAE,QACjB,MAAM,OAAO,CAAC,cAAc,CAAC,EAUvC;IALC,0CAA0C;IAC1C,sBADqB,SAAS,MAAM,EAAE,CACR;IAE9B,+DAA+D;IAC/D,sBAAgB;CAgBnB;2BA9B0B,sBAAsB"}
{"version":3,"file":"FileListPluginLoader.d.mts","sourceRoot":"","sources":["../src/FileListPluginLoader.mjs"],"names":[],"mappings":";mCAMa,eAAe,GAAG;IAC9B,QAAW,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAHJ;;;;GAIG;AAEH;;;;GAIG;AACH,mDAJW,SAAS,MAAM,EAAE,QACjB,MAAM,OAAO,CAAC,eAAe,CAAC,GAC5B,oBAAoB,CAsBhC;qCAnCmC,sBAAsB"}