@widget-js/core 0.11.6 → 0.11.8

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.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 { Metadata as Metadata$1, FormatEnum, ColourspaceEnum, Channels, LevelMetadata } from 'sharp';
3
4
 
4
5
  /**
5
6
  * @deprecated use DeployedMode instead
@@ -1534,10 +1535,26 @@ interface IFileApi {
1534
1535
  readDirectory(path: string, options?: ReadDirOptions): Promise<SystemFile[]>;
1535
1536
  isDirectory(filePath: string): Promise<boolean>;
1536
1537
  getFileType(filePath: string): Promise<FileTypeResult>;
1537
- downloadUrl(url: string, savePath: string): Promise<string>;
1538
+ downloadUrl(url: string, savePath: string, fileName: string): Promise<string>;
1538
1539
  exists(filePath: string): Promise<boolean>;
1539
1540
  delete(filePath: string): Promise<boolean>;
1540
- getDocumentFolder(filePath?: string): Promise<string>;
1541
+ /**
1542
+ * @param childPath
1543
+ * @example childPath = "/images/" will return "C:/Users/username/Documents/widgets/com/exmaple/widget/images"
1544
+ * @return folder relative to system user's documents folder
1545
+ */
1546
+ getDocumentFolder(childPath?: string): Promise<string>;
1547
+ /**
1548
+ *
1549
+ * @param filePath
1550
+ */
1551
+ getPictureMetadata(filePath: string): Promise<Metadata$1>;
1552
+ /**
1553
+ * 移动文件
1554
+ * @param form
1555
+ * @param to
1556
+ */
1557
+ move(form: string, to: string): Promise<string>;
1541
1558
  /**
1542
1559
  * read file contents
1543
1560
  * @param filePath
@@ -1548,4 +1565,59 @@ interface IFileApi {
1548
1565
  type FileApiMethods = keyof IFileApi;
1549
1566
  declare const FileApi: IFileApi;
1550
1567
 
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 };
1568
+ interface Metadata {
1569
+ /** Number value of the EXIF Orientation header, if present */
1570
+ orientation?: number | undefined;
1571
+ /** Name of decoder used to decompress image data e.g. jpeg, png, webp, gif, svg */
1572
+ format?: keyof FormatEnum | undefined;
1573
+ /** Total size of image in bytes, for Stream and Buffer input only */
1574
+ size?: number | undefined;
1575
+ /** Number of pixels wide (EXIF orientation is not taken into consideration) */
1576
+ width?: number | undefined;
1577
+ /** Number of pixels high (EXIF orientation is not taken into consideration) */
1578
+ height?: number | undefined;
1579
+ /** Name of colour space interpretation */
1580
+ space?: keyof ColourspaceEnum | undefined;
1581
+ /** Number of bands e.g. 3 for sRGB, 4 for CMYK */
1582
+ channels?: Channels | undefined;
1583
+ /** Name of pixel depth format e.g. uchar, char, ushort, float ... */
1584
+ depth?: string | undefined;
1585
+ /** Number of pixels per inch (DPI), if present */
1586
+ density?: number | undefined;
1587
+ /** 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 */
1588
+ chromaSubsampling: string;
1589
+ /** Boolean indicating whether the image is interlaced using a progressive scan */
1590
+ isProgressive?: boolean | undefined;
1591
+ /** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
1592
+ pages?: number | undefined;
1593
+ /** Number of pixels high each page in a multi-page image will be. */
1594
+ pageHeight?: number | undefined;
1595
+ /** Number of times to loop an animated image, zero refers to a continuous loop. */
1596
+ loop?: number | undefined;
1597
+ /** Delay in ms between each page in an animated image, provided as an array of integers. */
1598
+ delay?: number[] | undefined;
1599
+ /** Number of the primary page in a HEIF image */
1600
+ pagePrimary?: number | undefined;
1601
+ /** Boolean indicating the presence of an embedded ICC profile */
1602
+ hasProfile?: boolean | undefined;
1603
+ /** Boolean indicating the presence of an alpha transparency channel */
1604
+ hasAlpha?: boolean | undefined;
1605
+ /** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
1606
+ compression?: 'av1' | 'hevc';
1607
+ /** Default background colour, if present, for PNG (bKGD) and GIF images, either an RGB Object or a single greyscale value */
1608
+ background?: {
1609
+ r: number;
1610
+ g: number;
1611
+ b: number;
1612
+ } | number;
1613
+ /** Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide */
1614
+ levels?: LevelMetadata[] | undefined;
1615
+ /** Number of Sub Image File Directories in an OME-TIFF image */
1616
+ subifds?: number | undefined;
1617
+ /** The unit of resolution (density) */
1618
+ resolutionUnit?: 'inch' | 'cm' | undefined;
1619
+ /** String containing format for images loaded via *magick */
1620
+ formatMagick?: string | undefined;
1621
+ }
1622
+
1623
+ 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
  }
@@ -2034,8 +2040,8 @@ var FileApiImpl = class extends BaseApi {
2034
2040
  delete(filePath) {
2035
2041
  return this.invokeMethod("delete", filePath);
2036
2042
  }
2037
- downloadUrl(url, savePath) {
2038
- return this.invokeMethod("downloadUrl", url, savePath);
2043
+ downloadUrl(url, savePath, fileName) {
2044
+ return this.invokeMethod("downloadUrl", url, savePath, fileName);
2039
2045
  }
2040
2046
  exists(filePath) {
2041
2047
  return this.invokeMethod("exists", filePath);