@widget-js/core 0.7.6 → 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
  }
@@ -1597,6 +1605,25 @@ var BrowserWindowApiImpl = class extends BaseApi {
1597
1605
  setZoomFactor(factor) {
1598
1606
  return this.invokeMethod("setZoomFactor", factor);
1599
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
+ }
1600
1627
  };
1601
1628
  var BrowserWindowApi = new BrowserWindowApiImpl();
1602
1629
 
@@ -1711,7 +1738,7 @@ var NotificationApiImpl = class extends BaseApi {
1711
1738
  };
1712
1739
  var NotificationApi = new NotificationApiImpl();
1713
1740
 
1714
- // src/api/HostedWidgetApi.ts
1741
+ // src/api/DeployedWidgetApi.ts
1715
1742
  var DeployedWidgetApiImpl = class extends BaseApi {
1716
1743
  getChannel() {
1717
1744
  return "channel::cn.widgetjs.core.hosted_widget" /* HOSTED_WIDGET */;
@@ -1752,8 +1779,8 @@ var DeployedWidgetApiImpl = class extends BaseApi {
1752
1779
  async openDevTools(widgetId) {
1753
1780
  return this.invokeMethod("openDevTools", widgetId);
1754
1781
  }
1755
- async openConfigRoute(widgetId, params) {
1756
- return this.invokeMethod("openConfigRoute", widgetId, params);
1782
+ async openConfigPage(widgetId, params) {
1783
+ return this.invokeMethod("openConfigPage", widgetId, params);
1757
1784
  }
1758
1785
  /**
1759
1786
  * 注册激活、呼出、置顶组件快捷键
@@ -1839,6 +1866,7 @@ var ShortcutApi = new ShortcutApiImpl();
1839
1866
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
1840
1867
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
1841
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";
1842
1870
  return AppApiEvent2;
1843
1871
  })(AppApiEvent || {});
1844
1872
  var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {