@widget-js/core 0.11.8 → 0.11.10

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,6 +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
+ import { FormatEnum, ColourspaceEnum, Channels, LevelMetadata } from 'sharp';
4
4
 
5
5
  /**
6
6
  * @deprecated use DeployedMode instead
@@ -1513,58 +1513,6 @@ interface ILogApi {
1513
1513
  type LogApiMethods = keyof ILogApi;
1514
1514
  declare const LogApi: ILogApi;
1515
1515
 
1516
- interface SystemFile {
1517
- isDir: boolean;
1518
- name: string;
1519
- absolutePath: string;
1520
- /**
1521
- * mine type
1522
- */
1523
- type: string;
1524
- children?: SystemFile[];
1525
- /**
1526
- * 上传后的ID
1527
- */
1528
- uploadId?: string;
1529
- }
1530
- interface ReadDirOptions {
1531
- ignoreDir?: boolean;
1532
- traverseDir?: boolean;
1533
- }
1534
- interface IFileApi {
1535
- readDirectory(path: string, options?: ReadDirOptions): Promise<SystemFile[]>;
1536
- isDirectory(filePath: string): Promise<boolean>;
1537
- getFileType(filePath: string): Promise<FileTypeResult>;
1538
- downloadUrl(url: string, savePath: string, fileName: string): Promise<string>;
1539
- exists(filePath: string): Promise<boolean>;
1540
- delete(filePath: string): Promise<boolean>;
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>;
1558
- /**
1559
- * read file contents
1560
- * @param filePath
1561
- * @return base64 encoded string
1562
- */
1563
- readFile(filePath: string): Promise<string>;
1564
- }
1565
- type FileApiMethods = keyof IFileApi;
1566
- declare const FileApi: IFileApi;
1567
-
1568
1516
  interface Metadata {
1569
1517
  /** Number value of the EXIF Orientation header, if present */
1570
1518
  orientation?: number | undefined;
@@ -1620,4 +1568,67 @@ interface Metadata {
1620
1568
  formatMagick?: string | undefined;
1621
1569
  }
1622
1570
 
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 };
1571
+ interface SystemFile {
1572
+ isDir: boolean;
1573
+ name: string;
1574
+ absolutePath: string;
1575
+ /**
1576
+ * mine type
1577
+ */
1578
+ type: string;
1579
+ children?: SystemFile[];
1580
+ /**
1581
+ * 上传后的ID
1582
+ */
1583
+ uploadId?: string;
1584
+ }
1585
+ interface ReadDirOptions {
1586
+ ignoreDir?: boolean;
1587
+ traverseDir?: boolean;
1588
+ }
1589
+ interface DownloadUrlOptions {
1590
+ url: string;
1591
+ savePath: string;
1592
+ fileName: string;
1593
+ /**
1594
+ * true - overwrite existing
1595
+ * false - ignore
1596
+ */
1597
+ overwrite?: boolean;
1598
+ }
1599
+ interface IFileApi {
1600
+ readDirectory(path: string, options?: ReadDirOptions): Promise<SystemFile[]>;
1601
+ isDirectory(filePath: string): Promise<boolean>;
1602
+ getFileType(filePath: string): Promise<FileTypeResult>;
1603
+ downloadUrl(option: DownloadUrlOptions): Promise<string>;
1604
+ exists(filePath: string): Promise<boolean>;
1605
+ delete(filePath: string): Promise<boolean>;
1606
+ /**
1607
+ * @param childPath
1608
+ * @example childPath = "/images/" will return "C:/Users/username/Documents/widgets/com/exmaple/widget/images"
1609
+ * @see https://sharp.pixelplumbing.com/api-input
1610
+ * @return folder relative to system user's documents folder
1611
+ */
1612
+ getDocumentFolder(childPath?: string): Promise<string>;
1613
+ /**
1614
+ *
1615
+ * @param filePath absolute path
1616
+ */
1617
+ getPictureMetadata(filePath: string): Promise<Metadata>;
1618
+ /**
1619
+ * 移动文件
1620
+ * @param form
1621
+ * @param to
1622
+ */
1623
+ move(form: string, to: string): Promise<string>;
1624
+ /**
1625
+ * read file contents
1626
+ * @param filePath
1627
+ * @return base64 encoded string
1628
+ */
1629
+ readFile(filePath: string): Promise<string>;
1630
+ }
1631
+ type FileApiMethods = keyof IFileApi;
1632
+ declare const FileApi: IFileApi;
1633
+
1634
+ 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, DownloadUrlOptions, 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
@@ -2040,8 +2040,8 @@ var FileApiImpl = class extends BaseApi {
2040
2040
  delete(filePath) {
2041
2041
  return this.invokeMethod("delete", filePath);
2042
2042
  }
2043
- downloadUrl(url, savePath, fileName) {
2044
- return this.invokeMethod("downloadUrl", url, savePath, fileName);
2043
+ downloadUrl(options) {
2044
+ return this.invokeMethod("downloadUrl", options);
2045
2045
  }
2046
2046
  exists(filePath) {
2047
2047
  return this.invokeMethod("exists", filePath);