@widget-js/core 0.7.5 → 0.7.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.cjs CHANGED
@@ -170,8 +170,8 @@ var Page = class {
170
170
  constructor(options) {
171
171
  this.name = options.name;
172
172
  this.title = options.title;
173
- this.description = options.description;
174
- this.keywords = options.keywords;
173
+ this.description = options.description ?? {};
174
+ this.keywords = options.keywords ?? [];
175
175
  this.lang = options.lang;
176
176
  this.width = options.width;
177
177
  this.height = options.height;
@@ -200,6 +200,8 @@ var Page = class {
200
200
  * @param lang 语言环境,不传则获取默认标题
201
201
  */
202
202
  getDescription(lang) {
203
+ if (this.description == void 0)
204
+ return void 0;
203
205
  return getTextByLanguageCode(this.description, lang);
204
206
  }
205
207
  static parseJSON(json) {
@@ -272,6 +274,9 @@ var Widget = class extends Page {
272
274
  isSupportNormal() {
273
275
  return (this.supportDeployMode & 1 /* NORMAL */) > 0;
274
276
  }
277
+ isConfigurable() {
278
+ return this.configPagePath != null && this.configPagePath != "";
279
+ }
275
280
  };
276
281
  var WidgetKeyword = /* @__PURE__ */ ((WidgetKeyword2) => {
277
282
  WidgetKeyword2["RECOMMEND"] = "recommend";
@@ -1279,6 +1284,9 @@ var WidgetApiImpl = class extends BaseApi {
1279
1284
  }
1280
1285
  return widgets;
1281
1286
  }
1287
+ async openConfigPage(widgetId) {
1288
+ return this.invokeMethod("openConfigPage", widgetId);
1289
+ }
1282
1290
  async getWidgetPackages() {
1283
1291
  return await this.invokeMethod("getWidgetPackages");
1284
1292
  }
@@ -1594,6 +1602,28 @@ var BrowserWindowApiImpl = class extends BaseApi {
1594
1602
  close() {
1595
1603
  return this.invokeMethod("close");
1596
1604
  }
1605
+ setZoomFactor(factor) {
1606
+ return this.invokeMethod("setZoomFactor", factor);
1607
+ }
1608
+ async setup(options) {
1609
+ if (options.alwaysOnTop) {
1610
+ await this.setAlwaysOnTop(true);
1611
+ }
1612
+ if (options.center) {
1613
+ await this.center();
1614
+ }
1615
+ await this.setResizable(!!options.resizable);
1616
+ await this.setMovable(!!options.movable);
1617
+ if (options.width && options.height) {
1618
+ await this.setSize(options.width, options.height);
1619
+ }
1620
+ if (options.minWidth && options.minHeight) {
1621
+ await this.setMinimumSize(options.minWidth, options.minHeight);
1622
+ }
1623
+ if (options.maxWidth && options.maxHeight) {
1624
+ await this.setMaximumSize(options.maxWidth, options.maxHeight);
1625
+ }
1626
+ }
1597
1627
  };
1598
1628
  var BrowserWindowApi = new BrowserWindowApiImpl();
1599
1629
 
@@ -1708,7 +1738,7 @@ var NotificationApiImpl = class extends BaseApi {
1708
1738
  };
1709
1739
  var NotificationApi = new NotificationApiImpl();
1710
1740
 
1711
- // src/api/HostedWidgetApi.ts
1741
+ // src/api/DeployedWidgetApi.ts
1712
1742
  var DeployedWidgetApiImpl = class extends BaseApi {
1713
1743
  getChannel() {
1714
1744
  return "channel::cn.widgetjs.core.hosted_widget" /* HOSTED_WIDGET */;
@@ -1749,8 +1779,8 @@ var DeployedWidgetApiImpl = class extends BaseApi {
1749
1779
  async openDevTools(widgetId) {
1750
1780
  return this.invokeMethod("openDevTools", widgetId);
1751
1781
  }
1752
- async openConfigRoute(widgetId, params) {
1753
- return this.invokeMethod("openConfigRoute", widgetId, params);
1782
+ async openConfigPage(widgetId, params) {
1783
+ return this.invokeMethod("openConfigPage", widgetId, params);
1754
1784
  }
1755
1785
  /**
1756
1786
  * 注册激活、呼出、置顶组件快捷键
@@ -1836,6 +1866,7 @@ var ShortcutApi = new ShortcutApiImpl();
1836
1866
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
1837
1867
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
1838
1868
  AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
1869
+ AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
1839
1870
  return AppApiEvent2;
1840
1871
  })(AppApiEvent || {});
1841
1872
  var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {