ilx1-x-tool 1.2.4 → 1.2.6

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/dist/index.d.mts CHANGED
@@ -106,6 +106,17 @@ declare const decompressJsonGzip: (file: File) => Promise<any>;
106
106
  * @return {*}
107
107
  ********************************************************************************/
108
108
  declare function isShowPopover(popId: string): boolean;
109
+ /********************************************************************************
110
+ * @brief: 关闭指定Popover
111
+ * @param {string} id
112
+ * @return {*}
113
+ ********************************************************************************/
114
+ declare const closePopoverByID: (id: string) => void;
115
+ /********************************************************************************
116
+ * @brief: 关闭页面所有原生Popover
117
+ * @return {*}
118
+ ********************************************************************************/
119
+ declare const closeAllNativePopover: () => void;
109
120
  /********************************************************************************
110
121
  * @brief: 判断图片是否有效
111
122
  * @param {string} src
@@ -297,172 +308,182 @@ interface IConfig {
297
308
  /********************************************************************************
298
309
  * @brief: 图像处理工具函数库主对象
299
310
  ********************************************************************************/
300
- declare const ImageToHexArray: {
301
- /********************************************************************************
302
- * @brief: 生成十六进制数组
303
- * @param {string} picData - base64图像数据
304
- * @param {number} thresholdData - 阈值
305
- * @param {Array} config - 配置数组
306
- * @return {Promise<Array|Uint8Array>} 十六进制数组
307
- ********************************************************************************/
308
- generate: (picData: string, thresholdData: number, config: number[]) => Promise<Uint8Array>;
309
- /********************************************************************************
310
- * @brief: ImageData 对象转 hexArray
311
- * @param {ImageData} imageData - 图像数据对象
312
- * @param {number} threshold - 阈值
313
- * @param {Array} config - 配置数组
314
- * @return {Uint8Array} 处理后的字节数组
315
- ********************************************************************************/
316
- imageDataToHexArray: (imageData: ImageData, threshold: number, config: number[]) => Uint8Array;
317
- /********************************************************************************
318
- * @brief: 彩色图像取模 (RGB565格式)
319
- * @param {Uint8ClampedArray} pixels - 像素数组
320
- * @param {number} width - 图像宽度
321
- * @param {number} height - 图像高度
322
- * @param {Array} config - 配置数组
323
- * @return {Uint8Array} RGB565格式的字节数组
324
- ********************************************************************************/
325
- colorImageSampling: (pixels: Uint8ClampedArray, width: number, height: number, config: number[]) => Uint8Array;
326
- /********************************************************************************
327
- * @brief: 逐行式取模 (从左到右,从上到下)
328
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
329
- * @param {number} width - 图像宽度
330
- * @param {number} height - 图像高度
331
- * @param {Array} config - 配置数组
332
- * @return {Uint8Array} 取模后的字节数组
333
- ********************************************************************************/
334
- ImageSamplingRow: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
335
- /********************************************************************************
336
- * @brief: 逐列式取模 (从上到下,从左到右)
337
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
338
- * @param {number} width - 图像宽度
339
- * @param {number} height - 图像高度
340
- * @param {Array} config - 配置数组
341
- * @return {Uint8Array} 取模后的字节数组
342
- ********************************************************************************/
343
- ImageSamplingCol: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
344
- /********************************************************************************
345
- * @brief: 列行式取模 (先列后行)
346
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
347
- * @param {number} width - 图像宽度
348
- * @param {number} height - 图像高度
349
- * @param {Array} config - 配置数组
350
- * @return {Uint8Array} 取模后的字节数组
351
- ********************************************************************************/
352
- ImageSamplingColRow: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
353
- /********************************************************************************
354
- * @brief: 行列式取模 (先行后列)
355
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
356
- * @param {number} width - 图像宽度
357
- * @param {number} height - 图像高度
358
- * @param {Array} config - 配置数组
359
- * @return {Uint8Array} 取模后的字节数组
360
- ********************************************************************************/
361
- ImageSamplingRowCol: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
362
- /********************************************************************************
363
- * @brief: base64 ImageData 对象
364
- * @param {string} base64Data - base64编码的图像数据
365
- * @return {Promise<ImageData>} ImageData对象
366
- ********************************************************************************/
367
- base64ToImageData: (base64Data: string) => Promise<ImageData>;
368
- /********************************************************************************
369
- * @brief: 使用 Konva.js 缩放图像
370
- * @param {number} width - 目标宽度
371
- * @param {number} height - 目标高度
372
- * @param {HTMLImageElement} image - 源图像对象
373
- * @param {boolean} colorMode - 是否转换为灰度
374
- * @return {Promise<string>} base64编码的缩放后图像
375
- ********************************************************************************/
376
- resizeImageWithKonva: (width: number, height: number, image: HTMLImageElement, colorMode: boolean) => Promise<string>;
377
- /********************************************************************************
378
- * @brief: 使用 Canvas API 缩放图像 (Konva不可用时的备选方案)
379
- * @param {number} width - 目标宽度
380
- * @param {number} height - 目标高度
381
- * @param {HTMLImageElement} image - 源图像对象
382
- * @param {boolean} colorMode - 是否转换为灰度
383
- * @return {Promise<string>} base64编码的缩放后图像
384
- ********************************************************************************/
385
- resizeImageWithCanvas: (width: any, height: any, image: any, colorMode: any) => Promise<unknown>;
386
- /********************************************************************************
387
- * @brief: Uint8Array 转十六进制字符串
388
- * @param {Uint8Array} array - 字节数组
389
- * @return {string} 十六进制字符串
390
- ********************************************************************************/
391
- arrayToHex: (array: any) => string;
392
- /********************************************************************************
393
- * @brief: 十六进制数据加 '0x' 前缀
394
- * @param {string} hex - 十六进制字符串
395
- * @return {Array<string>} 带0x前缀的十六进制数组
396
- ********************************************************************************/
397
- hex2hex: (hex: string) => Array<string>;
398
- /********************************************************************************
399
- * @brief: 生成取模预览 (0=白点, 1=黑点)
400
- * @param {Uint8Array} unpackedBuffer - 解压后的像素缓冲区
401
- * @param {number} width - 图像宽度
402
- * @return {string} 预览字符串
403
- ********************************************************************************/
404
- generatePreview: (unpackedBuffer: Uint8Array, width: number) => string;
405
- /********************************************************************************
406
- * @brief: 创建图像数据对象(兼容性函数)
407
- * @param {number} width - 图像宽度
408
- * @param {number} height - 图像高度
409
- * @param {Uint8ClampedArray} data - 像素数据
410
- * @return {ImageData} ImageData对象
411
- ********************************************************************************/
412
- createImageData: (width: number, height: number, data?: Uint8ClampedArray) => ImageData;
413
- /********************************************************************************
414
- * @brief: 将字节数组格式化为可读字符串
415
- * @param {Uint8Array|Array} hexArray - 十六进制数组
416
- * @param {number} format - 输出格式 (0=带0x前缀, 1=原始数组)
417
- * @param {number} lineBreak - 每行显示的字节数
418
- * @return {string} 格式化后的字符串
419
- ********************************************************************************/
420
- formatHexOutput: (hexArray: Uint8Array | Array<string>, format?: number, lineBreak?: number) => string;
421
- /********************************************************************************
422
- * @brief: 计算输出字节数
423
- * @param {Uint8Array|Array} hexArray - 十六进制数组
424
- * @return {Object} 包含字节数和KB数的对象
425
- ********************************************************************************/
426
- calculateOutputSize: (hexArray: Uint8Array | Array<string>) => {
427
- bytes: number;
428
- kilobytes: number;
429
- formatted: string;
430
- };
431
- /********************************************************************************
432
- * @brief: 获取取模方式描述
433
- * @param {number} mode - 取模方式代码
434
- * @return {string} 取模方式描述
435
- ********************************************************************************/
436
- getSamplingModeDescription: (mode: number) => string;
437
- /********************************************************************************
438
- * @brief: 获取配置数组的默认值
439
- * @param: 无
440
- * @return {Array} 默认配置数组
441
- ********************************************************************************/
442
- getDefaultConfig: () => number[];
311
+ /********************************************************************************
312
+ * @brief: 生成十六进制数组
313
+ * @param {string} picData - base64图像数据
314
+ * @param {number} thresholdData - 阈值
315
+ * @param {Array} config - 配置数组
316
+ * @return {Promise<Array|Uint8Array>} 十六进制数组
317
+ ********************************************************************************/
318
+ declare function generate(picData: string, thresholdData: number, config: number[]): Promise<Uint8Array | string[]>;
319
+ /********************************************************************************
320
+ * @brief: ImageData 对象转 hexArray
321
+ * @param {ImageData} imageData - 图像数据对象
322
+ * @param {number} threshold - 阈值
323
+ * @param {Array} config - 配置数组
324
+ * @return {Uint8Array} 处理后的字节数组
325
+ ********************************************************************************/
326
+ declare function imageDataToHexArray(imageData: ImageData, threshold: number, config: number[]): Uint8Array;
327
+ /********************************************************************************
328
+ * @brief: 彩色图像取模 (RGB565格式)
329
+ * @param {Uint8ClampedArray} pixels - 像素数组
330
+ * @param {number} width - 图像宽度
331
+ * @param {number} height - 图像高度
332
+ * @param {Array} config - 配置数组
333
+ * @return {Uint8Array} RGB565格式的字节数组
334
+ ********************************************************************************/
335
+ declare function colorImageSampling(pixels: Uint8ClampedArray, width: number, height: number, config: number[]): Uint8Array;
336
+ /********************************************************************************
337
+ * @brief: 逐行式取模 (从左到右,从上到下)
338
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
339
+ * @param {number} width - 图像宽度
340
+ * @param {number} height - 图像高度
341
+ * @param {Array} config - 配置数组
342
+ * @return {Uint8Array} 取模后的字节数组
343
+ ********************************************************************************/
344
+ declare function ImageSamplingRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
345
+ /********************************************************************************
346
+ * @brief: 逐列式取模 (从上到下,从左到右)
347
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
348
+ * @param {number} width - 图像宽度
349
+ * @param {number} height - 图像高度
350
+ * @param {Array} config - 配置数组
351
+ * @return {Uint8Array} 取模后的字节数组
352
+ ********************************************************************************/
353
+ declare function ImageSamplingCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
354
+ /********************************************************************************
355
+ * @brief: 列行式取模 (先列后行)
356
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
357
+ * @param {number} width - 图像宽度
358
+ * @param {number} height - 图像高度
359
+ * @param {Array} config - 配置数组
360
+ * @return {Uint8Array} 取模后的字节数组
361
+ ********************************************************************************/
362
+ declare function ImageSamplingColRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
363
+ /********************************************************************************
364
+ * @brief: 行列式取模 (先行后列)
365
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
366
+ * @param {number} width - 图像宽度
367
+ * @param {number} height - 图像高度
368
+ * @param {Array} config - 配置数组
369
+ * @return {Uint8Array} 取模后的字节数组
370
+ ********************************************************************************/
371
+ declare function ImageSamplingRowCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
372
+ /********************************************************************************
373
+ * @brief: base64 转 ImageData 对象
374
+ * @param {string} base64Data - base64编码的图像数据
375
+ * @return {Promise<ImageData>} ImageData对象
376
+ ********************************************************************************/
377
+ declare function base64ToImageData(base64Data: string): Promise<ImageData>;
378
+ /********************************************************************************
379
+ * @brief: 调整图像大小
380
+ ********************************************************************************/
381
+ declare function resizeImage(width: number, height: number, imageSource: string | HTMLImageElement, colorMode: boolean): Promise<string>;
382
+ /********************************************************************************
383
+ * @brief: base64 Image 对象
384
+ * @param {string} base64
385
+ * @return {*}
386
+ ********************************************************************************/
387
+ declare const base64ToImage: (base64: string) => Promise<HTMLImageElement>;
388
+ /********************************************************************************
389
+ * @brief: 使用 Konva.js 缩放图像
390
+ * @param {number} width - 目标宽度
391
+ * @param {number} height - 目标高度
392
+ * @param {HTMLImageElement} image - 源图像对象
393
+ * @param {boolean} colorMode - 是否转换为灰度
394
+ * @return {Promise<string>} base64编码的缩放后图像
395
+ ********************************************************************************/
396
+ declare function resizeImageWithKonva(width: number, height: number, image: HTMLImageElement, colorMode: boolean): Promise<string>;
397
+ /********************************************************************************
398
+ * @brief: 使用 Canvas API 缩放图像 (Konva不可用时的备选方案)
399
+ * @param {number} width - 目标宽度
400
+ * @param {number} height - 目标高度
401
+ * @param {HTMLImageElement} image - 源图像对象
402
+ * @param {boolean} colorMode - 是否转换为灰度
403
+ * @return {Promise<string>} base64编码的缩放后图像
404
+ ********************************************************************************/
405
+ declare function resizeImageWithCanvas(width: any, height: any, image: any, colorMode: any): Promise<string>;
406
+ /********************************************************************************
407
+ * @brief: Uint8Array 转十六进制字符串
408
+ * @param {Uint8Array} array - 字节数组
409
+ * @return {string} 十六进制字符串
410
+ ********************************************************************************/
411
+ declare function arrayToHex(array: any): string;
412
+ /********************************************************************************
413
+ * @brief: 十六进制数据加 '0x' 前缀
414
+ * @param {string} hex - 十六进制字符串
415
+ * @return {Array<string>} 带0x前缀的十六进制数组
416
+ ********************************************************************************/
417
+ declare function hex2hex(hex: string): Array<string>;
418
+ /********************************************************************************
419
+ * @brief: 生成取模预览 (0=白点, 1=黑点)
420
+ * @param {Uint8Array} unpackedBuffer - 解压后的像素缓冲区
421
+ * @param {number} width - 图像宽度
422
+ * @return {string} 预览字符串
423
+ ********************************************************************************/
424
+ declare function generatePreview(unpackedBuffer: Uint8Array, width: number): string;
425
+ /********************************************************************************
426
+ * @brief: 创建图像数据对象(兼容性函数)
427
+ * @param {number} width - 图像宽度
428
+ * @param {number} height - 图像高度
429
+ * @param {Uint8ClampedArray} data - 像素数据
430
+ * @return {ImageData} ImageData对象
431
+ ********************************************************************************/
432
+ declare function createImageData(width: number, height: number, data?: Uint8ClampedArray): ImageData;
433
+ /********************************************************************************
434
+ * @brief: 将字节数组格式化为可读字符串
435
+ * @param {Uint8Array|Array} hexArray - 十六进制数组
436
+ * @param {number} format - 输出格式 (0=带0x前缀, 1=原始数组)
437
+ * @param {number} lineBreak - 每行显示的字节数
438
+ * @return {string} 格式化后的字符串
439
+ ********************************************************************************/
440
+ declare function formatHexOutput(hexArray: Uint8Array | Array<string>, format?: number, lineBreak?: number): string;
441
+ /********************************************************************************
442
+ * @brief: 计算输出字节数
443
+ * @param {Uint8Array|Array} hexArray - 十六进制数组
444
+ * @return {Object} 包含字节数和KB数的对象
445
+ ********************************************************************************/
446
+ declare function calculateOutputSize(hexArray: Uint8Array | Array<string>): {
447
+ bytes: number;
448
+ kilobytes: number;
449
+ formatted: string;
443
450
  };
444
451
  /********************************************************************************
445
- * @brief: 为了方便使用,单独导出每个函数
452
+ * @brief: 获取取模方式描述
453
+ * @param {number} mode - 取模方式代码
454
+ * @return {string} 取模方式描述
455
+ ********************************************************************************/
456
+ declare function getSamplingModeDescription(mode: number): string;
457
+ /********************************************************************************
458
+ * @brief: 获取配置数组的默认值
446
459
  * @param: 无
447
- * @return: 函数引用
448
- ********************************************************************************/
449
- declare const generate: any;
450
- declare const imageDataToHexArray: any;
451
- declare const colorImageSampling: any;
452
- declare const ImageSamplingRow: any;
453
- declare const ImageSamplingCol: any;
454
- declare const ImageSamplingColRow: any;
455
- declare const ImageSamplingRowCol: any;
456
- declare const base64ToImageData: any;
457
- declare const resizeImageWithKonva: any;
458
- declare const resizeImageWithCanvas: any;
459
- declare const arrayToHex: any;
460
- declare const hex2hex: any;
461
- declare const generatePreview: any;
462
- declare const createImageData: any;
463
- declare const formatHexOutput: any;
464
- declare const calculateOutputSize: any;
465
- declare const getSamplingModeDescription: any;
466
- declare const getDefaultConfig: any;
460
+ * @return {Array} 默认配置数组
461
+ ********************************************************************************/
462
+ declare function getDefaultConfig(): number[];
463
+ /********************************************************************************
464
+ * @brief: 图像处理工具函数库主对象(为了向后兼容)
465
+ ********************************************************************************/
466
+ declare const ImageToHexArray: {
467
+ generate: typeof generate;
468
+ imageDataToHexArray: typeof imageDataToHexArray;
469
+ colorImageSampling: typeof colorImageSampling;
470
+ ImageSamplingRow: typeof ImageSamplingRow;
471
+ ImageSamplingCol: typeof ImageSamplingCol;
472
+ ImageSamplingColRow: typeof ImageSamplingColRow;
473
+ ImageSamplingRowCol: typeof ImageSamplingRowCol;
474
+ base64ToImageData: typeof base64ToImageData;
475
+ resizeImage: typeof resizeImage;
476
+ base64ToImage: (base64: string) => Promise<HTMLImageElement>;
477
+ resizeImageWithKonva: typeof resizeImageWithKonva;
478
+ resizeImageWithCanvas: typeof resizeImageWithCanvas;
479
+ arrayToHex: typeof arrayToHex;
480
+ hex2hex: typeof hex2hex;
481
+ generatePreview: typeof generatePreview;
482
+ createImageData: typeof createImageData;
483
+ formatHexOutput: typeof formatHexOutput;
484
+ calculateOutputSize: typeof calculateOutputSize;
485
+ getSamplingModeDescription: typeof getSamplingModeDescription;
486
+ getDefaultConfig: typeof getDefaultConfig;
487
+ };
467
488
 
468
- export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };
489
+ export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImage, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, closeAllNativePopover, closePopoverByID, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImage, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };