@widget-js/core 0.11.7 → 0.11.9
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.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +75 -2
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config, CPUUsage, IOCounters, BlinkMemoryInfo, HeapStatistics, ProcessMemoryInfo, SystemMemoryInfo } from 'electron';
|
|
2
2
|
import { FileTypeResult } from 'file-type';
|
|
3
|
+
import { FormatEnum, ColourspaceEnum, Channels, LevelMetadata } from 'sharp';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @deprecated use DeployedMode instead
|
|
@@ -1512,6 +1513,61 @@ interface ILogApi {
|
|
|
1512
1513
|
type LogApiMethods = keyof ILogApi;
|
|
1513
1514
|
declare const LogApi: ILogApi;
|
|
1514
1515
|
|
|
1516
|
+
interface Metadata {
|
|
1517
|
+
/** Number value of the EXIF Orientation header, if present */
|
|
1518
|
+
orientation?: number | undefined;
|
|
1519
|
+
/** Name of decoder used to decompress image data e.g. jpeg, png, webp, gif, svg */
|
|
1520
|
+
format?: keyof FormatEnum | undefined;
|
|
1521
|
+
/** Total size of image in bytes, for Stream and Buffer input only */
|
|
1522
|
+
size?: number | undefined;
|
|
1523
|
+
/** Number of pixels wide (EXIF orientation is not taken into consideration) */
|
|
1524
|
+
width?: number | undefined;
|
|
1525
|
+
/** Number of pixels high (EXIF orientation is not taken into consideration) */
|
|
1526
|
+
height?: number | undefined;
|
|
1527
|
+
/** Name of colour space interpretation */
|
|
1528
|
+
space?: keyof ColourspaceEnum | undefined;
|
|
1529
|
+
/** Number of bands e.g. 3 for sRGB, 4 for CMYK */
|
|
1530
|
+
channels?: Channels | undefined;
|
|
1531
|
+
/** Name of pixel depth format e.g. uchar, char, ushort, float ... */
|
|
1532
|
+
depth?: string | undefined;
|
|
1533
|
+
/** Number of pixels per inch (DPI), if present */
|
|
1534
|
+
density?: number | undefined;
|
|
1535
|
+
/** String containing JPEG chroma subsampling, 4:2:0 or 4:4:4 for RGB, 4:2:0:4 or 4:4:4:4 for CMYK */
|
|
1536
|
+
chromaSubsampling: string;
|
|
1537
|
+
/** Boolean indicating whether the image is interlaced using a progressive scan */
|
|
1538
|
+
isProgressive?: boolean | undefined;
|
|
1539
|
+
/** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
|
|
1540
|
+
pages?: number | undefined;
|
|
1541
|
+
/** Number of pixels high each page in a multi-page image will be. */
|
|
1542
|
+
pageHeight?: number | undefined;
|
|
1543
|
+
/** Number of times to loop an animated image, zero refers to a continuous loop. */
|
|
1544
|
+
loop?: number | undefined;
|
|
1545
|
+
/** Delay in ms between each page in an animated image, provided as an array of integers. */
|
|
1546
|
+
delay?: number[] | undefined;
|
|
1547
|
+
/** Number of the primary page in a HEIF image */
|
|
1548
|
+
pagePrimary?: number | undefined;
|
|
1549
|
+
/** Boolean indicating the presence of an embedded ICC profile */
|
|
1550
|
+
hasProfile?: boolean | undefined;
|
|
1551
|
+
/** Boolean indicating the presence of an alpha transparency channel */
|
|
1552
|
+
hasAlpha?: boolean | undefined;
|
|
1553
|
+
/** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
|
|
1554
|
+
compression?: 'av1' | 'hevc';
|
|
1555
|
+
/** Default background colour, if present, for PNG (bKGD) and GIF images, either an RGB Object or a single greyscale value */
|
|
1556
|
+
background?: {
|
|
1557
|
+
r: number;
|
|
1558
|
+
g: number;
|
|
1559
|
+
b: number;
|
|
1560
|
+
} | number;
|
|
1561
|
+
/** Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide */
|
|
1562
|
+
levels?: LevelMetadata[] | undefined;
|
|
1563
|
+
/** Number of Sub Image File Directories in an OME-TIFF image */
|
|
1564
|
+
subifds?: number | undefined;
|
|
1565
|
+
/** The unit of resolution (density) */
|
|
1566
|
+
resolutionUnit?: 'inch' | 'cm' | undefined;
|
|
1567
|
+
/** String containing format for images loaded via *magick */
|
|
1568
|
+
formatMagick?: string | undefined;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1515
1571
|
interface SystemFile {
|
|
1516
1572
|
isDir: boolean;
|
|
1517
1573
|
name: string;
|
|
@@ -1537,7 +1593,24 @@ interface IFileApi {
|
|
|
1537
1593
|
downloadUrl(url: string, savePath: string, fileName: string): Promise<string>;
|
|
1538
1594
|
exists(filePath: string): Promise<boolean>;
|
|
1539
1595
|
delete(filePath: string): Promise<boolean>;
|
|
1540
|
-
|
|
1596
|
+
/**
|
|
1597
|
+
* @param childPath
|
|
1598
|
+
* @example childPath = "/images/" will return "C:/Users/username/Documents/widgets/com/exmaple/widget/images"
|
|
1599
|
+
* @see https://sharp.pixelplumbing.com/api-input
|
|
1600
|
+
* @return folder relative to system user's documents folder
|
|
1601
|
+
*/
|
|
1602
|
+
getDocumentFolder(childPath?: string): Promise<string>;
|
|
1603
|
+
/**
|
|
1604
|
+
*
|
|
1605
|
+
* @param filePath absolute path
|
|
1606
|
+
*/
|
|
1607
|
+
getPictureMetadata(filePath: string): Promise<Metadata>;
|
|
1608
|
+
/**
|
|
1609
|
+
* 移动文件
|
|
1610
|
+
* @param form
|
|
1611
|
+
* @param to
|
|
1612
|
+
*/
|
|
1613
|
+
move(form: string, to: string): Promise<string>;
|
|
1541
1614
|
/**
|
|
1542
1615
|
* read file contents
|
|
1543
1616
|
* @param filePath
|
|
@@ -1548,4 +1621,4 @@ interface IFileApi {
|
|
|
1548
1621
|
type FileApiMethods = keyof IFileApi;
|
|
1549
1622
|
declare const FileApi: IFileApi;
|
|
1550
1623
|
|
|
1551
|
-
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, ElectronApi, ElectronUtils, FileApi, FileApiMethods, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
|
|
1624
|
+
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, ElectronApi, ElectronUtils, FileApi, FileApiMethods, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, Metadata, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
|
package/dist/index.js
CHANGED
|
@@ -2019,6 +2019,12 @@ var LogApi = new LogApiImpl();
|
|
|
2019
2019
|
|
|
2020
2020
|
// src/api/FileApi.ts
|
|
2021
2021
|
var FileApiImpl = class extends BaseApi {
|
|
2022
|
+
getPictureMetadata(filePath) {
|
|
2023
|
+
return this.invokeMethod("getPictureMetadata", filePath);
|
|
2024
|
+
}
|
|
2025
|
+
move(form, to) {
|
|
2026
|
+
return this.invokeMethod("move", form, to);
|
|
2027
|
+
}
|
|
2022
2028
|
getFileType(filePath) {
|
|
2023
2029
|
return this.invokeMethod("getFileType", filePath);
|
|
2024
2030
|
}
|