@widget-js/core 0.10.13 → 0.10.19

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,3 +1,4 @@
1
+ import { CPUUsage, IOCounters, BlinkMemoryInfo, HeapStatistics, ProcessMemoryInfo, SystemMemoryInfo } from 'electron';
1
2
  import { FileTypeResult } from 'file-type';
2
3
 
3
4
  /**
@@ -115,6 +116,7 @@ interface IPageOptions extends IWindowSize {
115
116
  resizable?: boolean;
116
117
  backgroundThrottling?: boolean;
117
118
  security?: boolean;
119
+ webviewTag?: boolean;
118
120
  path: string;
119
121
  /**
120
122
  * 是否只能添加一次
@@ -132,6 +134,7 @@ interface IPage {
132
134
  */
133
135
  readonly title: LanguageTextMap;
134
136
  readonly permissions: WidgetPermission[];
137
+ readonly webviewTag: boolean;
135
138
  /**
136
139
  * 窗口介绍
137
140
  */
@@ -183,6 +186,7 @@ declare class Page implements IPage {
183
186
  packageName?: string | null;
184
187
  readonly height: number;
185
188
  readonly maxWidth: number;
189
+ readonly webviewTag: boolean;
186
190
  readonly maxHeight: number;
187
191
  readonly minWidth: number;
188
192
  readonly minHeight: number;
@@ -1424,6 +1428,23 @@ interface IBroadcastApi {
1424
1428
  type BroadcastApiMethods = keyof IBroadcastApi;
1425
1429
  declare const BroadcastApi: IBroadcastApi;
1426
1430
 
1431
+ interface IProcessApi {
1432
+ getCPUUsage(): Promise<CPUUsage>;
1433
+ getIOCounters(): Promise<IOCounters>;
1434
+ getBlinkMemoryInfo(): Promise<BlinkMemoryInfo>;
1435
+ getHeapStatistics(): Promise<HeapStatistics>;
1436
+ /**
1437
+ * // On macOS -> '10.13.6'
1438
+ * // On Windows -> '10.0.17763'
1439
+ * // On Linux -> '4.15.0-45-generic'
1440
+ */
1441
+ getSystemVersion(): Promise<string>;
1442
+ getProcessMemoryInfo(): Promise<ProcessMemoryInfo>;
1443
+ getSystemMemoryInfo(): Promise<SystemMemoryInfo>;
1444
+ }
1445
+ type ProcessApiMethods = keyof IProcessApi;
1446
+ declare const ProcessApi: IProcessApi;
1447
+
1427
1448
  interface IDialogApi {
1428
1449
  pickFile(extensions?: string[]): Promise<string | undefined>;
1429
1450
  pickFolder(): Promise<string | undefined>;
@@ -1463,20 +1484,4 @@ interface IFileApi {
1463
1484
  type FileApiMethods = keyof IFileApi;
1464
1485
  declare const FileApi: IFileApi;
1465
1486
 
1466
- /**
1467
- * An object with V8 heap statistics. Note that all statistics are reported in Kilobytes.
1468
- * @link https://www.electronjs.org/docs/latest/api/process#processgetheapstatistics
1469
- */
1470
- interface HeapStatistics {
1471
- totalHeapSize: number;
1472
- totalHeapSizeExecutable: number;
1473
- totalPhysicalSize: number;
1474
- totalAvailableSize: number;
1475
- usedHeapSize: number;
1476
- heapSizeLimit: number;
1477
- mallocedMemory: number;
1478
- peakMallocedMemory: number;
1479
- doesZapGarbage: boolean;
1480
- }
1481
-
1482
- 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, HeapStatistics, 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, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
1487
+ 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, 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
@@ -74,6 +74,7 @@ var Page = class {
74
74
  packageName;
75
75
  height;
76
76
  maxWidth;
77
+ webviewTag;
77
78
  maxHeight;
78
79
  minWidth;
79
80
  minHeight;
@@ -108,6 +109,7 @@ var Page = class {
108
109
  this.path = options.path;
109
110
  this.meta = options.meta ?? {};
110
111
  this.security = options.security ?? false;
112
+ this.webviewTag = options.webviewTag ?? false;
111
113
  this.permissions = options.permissions ?? [];
112
114
  }
113
115
  /**
@@ -1799,6 +1801,35 @@ var ShortcutApiImpl = class extends BaseApi {
1799
1801
  };
1800
1802
  var ShortcutApi = new ShortcutApiImpl();
1801
1803
 
1804
+ // src/api/ProcessApi.ts
1805
+ var ProcessApiImpl = class extends BaseApi {
1806
+ getChannel() {
1807
+ return "channel::cn.widgetjs.core.process" /* PROCESS */;
1808
+ }
1809
+ getBlinkMemoryInfo() {
1810
+ return this.invokeMethod("getBlinkMemoryInfo");
1811
+ }
1812
+ getCPUUsage() {
1813
+ return this.invokeMethod("getCPUUsage");
1814
+ }
1815
+ getHeapStatistics() {
1816
+ return this.invokeMethod("getHeapStatistics");
1817
+ }
1818
+ getIOCounters() {
1819
+ return this.invokeMethod("getIOCounters");
1820
+ }
1821
+ getProcessMemoryInfo() {
1822
+ return this.invokeMethod("getProcessMemoryInfo");
1823
+ }
1824
+ getSystemMemoryInfo() {
1825
+ return this.invokeMethod("getSystemMemoryInfo");
1826
+ }
1827
+ getSystemVersion() {
1828
+ return this.invokeMethod("getSystemVersion");
1829
+ }
1830
+ };
1831
+ var ProcessApi = new ProcessApiImpl();
1832
+
1802
1833
  // src/api/AppApi.ts
1803
1834
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
1804
1835
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
@@ -1982,6 +2013,7 @@ export {
1982
2013
  NotificationApiEvent,
1983
2014
  NotificationSize,
1984
2015
  Page,
2016
+ ProcessApi,
1985
2017
  ShortcutApi,
1986
2018
  ShortcutApiEvent,
1987
2019
  StoreApi,