@widget-js/core 24.1.1-beta.2 → 24.1.1-beta.3

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
@@ -302,7 +302,7 @@ interface LocalPackageUrlInfo {
302
302
  /**
303
303
  * 是否使用hash路由
304
304
  */
305
- hash: boolean;
305
+ hash?: boolean;
306
306
  }
307
307
  interface RemotePackageUrlInfo extends LocalPackageUrlInfo {
308
308
  /**
@@ -1426,6 +1426,11 @@ declare class NotificationApiImpl extends BaseApi<NotificationApiMethods> implem
1426
1426
  }
1427
1427
  declare const NotificationApi: NotificationApiImpl;
1428
1428
 
1429
+ interface AddWidgetOption {
1430
+ widgetName: string;
1431
+ deployMode: DeployMode;
1432
+ packageJsonUrl?: string;
1433
+ }
1429
1434
  interface IDeployedWidgetApi {
1430
1435
  removeDeployedWidget(id: string): Promise<void>;
1431
1436
  removeDeployedWidgetByName(name: string): Promise<DeployedWidget[]>;
@@ -1435,7 +1440,7 @@ interface IDeployedWidgetApi {
1435
1440
  registerActiveShortcut(id: string, shortcut: string): Promise<boolean>;
1436
1441
  setProxy(id: string, proxy: string): Promise<boolean>;
1437
1442
  getDeployedWidget(id: string): Promise<DeployedWidget>;
1438
- addWidget(widgetName: string, hostMode: DeployMode): Promise<Widget[]>;
1443
+ addWidget(options: AddWidgetOption): Promise<Widget[]>;
1439
1444
  }
1440
1445
  type DeployedWidgetApiMethods = keyof IDeployedWidgetApi;
1441
1446
  declare class DeployedWidgetApiImpl extends BaseApi<DeployedWidgetApiMethods> implements IDeployedWidgetApi {
@@ -1445,7 +1450,7 @@ declare class DeployedWidgetApiImpl extends BaseApi<DeployedWidgetApiMethods> im
1445
1450
  * @param id
1446
1451
  */
1447
1452
  removeDeployedWidget(id: string): Promise<any>;
1448
- addWidget(widgetName: string, hostMode: DeployMode): Promise<Widget[]>;
1453
+ addWidget(options: AddWidgetOption): Promise<Widget[]>;
1449
1454
  /**
1450
1455
  * 通过组件名移除已添加的组件
1451
1456
  * @param name 组件名
@@ -1730,4 +1735,4 @@ declare enum SystemApiEvent {
1730
1735
  DATE_CHANGED = "event::cn.widgetjs.core.sys.date.changed"
1731
1736
  }
1732
1737
 
1733
- export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BackgroundWidget, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, DownloadUrlOptions, ElectronApi, ElectronUtils, FileApi, FileApiMethods, FileInfo, Gravity, GridRect, GridSystem, HostedMode, IBackgroundWidgetOptions, 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, SystemApiEvent, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetTheme, WidgetThemeKey, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
1738
+ export { AddWidgetOption, AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BackgroundWidget, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, DownloadUrlOptions, ElectronApi, ElectronUtils, FileApi, FileApiMethods, FileInfo, Gravity, GridRect, GridSystem, HostedMode, IBackgroundWidgetOptions, 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, SystemApiEvent, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetTheme, WidgetThemeKey, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
package/dist/index.js CHANGED
@@ -1329,7 +1329,7 @@ var WidgetPackage = class {
1329
1329
  this.remoteEntry = options.remoteEntry;
1330
1330
  this.requiredAppVersion = options.requiredAppVersion;
1331
1331
  this.remotePackage = options.remotePackage;
1332
- this.hash = options.hash;
1332
+ this.hash = options.hash ?? false;
1333
1333
  this.url = "";
1334
1334
  this.icon = options.icon;
1335
1335
  this.devOptions = options.devOptions;
@@ -2004,8 +2004,8 @@ var WidgetDataApiImpl = class {
2004
2004
  let data;
2005
2005
  if (args.length === 2) {
2006
2006
  name = args[0];
2007
- const type = args[1];
2008
- data = new type(name);
2007
+ const Type = args[1];
2008
+ data = new Type(name);
2009
2009
  } else {
2010
2010
  data = args[0];
2011
2011
  name = data.name;
@@ -2018,11 +2018,11 @@ var WidgetDataApiImpl = class {
2018
2018
  }
2019
2019
  return void 0;
2020
2020
  }
2021
- async find(name, id, type) {
2021
+ async find(name, id, Type) {
2022
2022
  const store = this.getStore(name);
2023
2023
  const result = await store.getItem(this.getKey(name, id));
2024
2024
  if (result) {
2025
- const widgetData = new type(name, id);
2025
+ const widgetData = new Type(name, id);
2026
2026
  widgetData.parseJSON(JSON.parse(result));
2027
2027
  return widgetData;
2028
2028
  }
@@ -2328,8 +2328,8 @@ var DeployedWidgetApiImpl = class extends BaseApi {
2328
2328
  async removeDeployedWidget(id) {
2329
2329
  return this.invokeMethod("removeDeployedWidget", id);
2330
2330
  }
2331
- addWidget(widgetName, hostMode) {
2332
- return this.invokeMethod("addWidget", widgetName, hostMode);
2331
+ addWidget(options) {
2332
+ return this.invokeMethod("addWidget", options);
2333
2333
  }
2334
2334
  /**
2335
2335
  * 通过组件名移除已添加的组件