@widget-js/core 24.1.1-beta.87 → 24.1.1-beta.89

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
@@ -844,7 +844,9 @@ var DefaultThemeDark = {
844
844
  destructiveForeground: "#fff",
845
845
  border: "hsl(0 0% 30%)",
846
846
  input: "hsl(0 0% 25%)",
847
- ring: "hsl(210 100% 60%)"
847
+ ring: "hsl(210 100% 60%)",
848
+ shadow: "0 0% 0%",
849
+ innerShadow: "0 0% 0%"
848
850
  },
849
851
  radius: {
850
852
  sm: "6px",
@@ -857,9 +859,9 @@ var DefaultThemeDark = {
857
859
  fontSize: "14px"
858
860
  },
859
861
  shadow: {
860
- sm: "0 1px 2px rgba(0,0,0,0.2)",
861
- md: "0 4px 6px rgba(0,0,0,0.3)",
862
- lg: "0 10px 20px rgba(0,0,0,0.4)"
862
+ sm: { offsetX: "0", offsetY: "1px", blur: "2px" },
863
+ md: { offsetX: "0", offsetY: "4px", blur: "6px" },
864
+ lg: { offsetX: "0", offsetY: "10px", blur: "20px" }
863
865
  },
864
866
  spacing: "0.5rem"
865
867
  };
@@ -885,12 +887,14 @@ var DefaultThemeLight = {
885
887
  destructiveForeground: "#fff",
886
888
  border: "hsl(0 0% 90%)",
887
889
  input: "hsl(0 0% 85%)",
888
- ring: "hsl(210 100% 56%)"
890
+ ring: "hsl(210 100% 56%)",
891
+ shadow: "0 0% 0%",
892
+ innerShadow: "0 0% 0%"
889
893
  },
890
894
  shadow: {
891
- sm: "0 1px 2px rgba(0,0,0,0.05)",
892
- md: "0 4px 6px rgba(0,0,0,0.1)",
893
- lg: "0 10px 20px rgba(0,0,0,0.15)"
895
+ sm: { offsetX: "0", offsetY: "1px", blur: "2px" },
896
+ md: { offsetX: "0", offsetY: "4px", blur: "6px" },
897
+ lg: { offsetX: "0", offsetY: "10px", blur: "20px" }
894
898
  }
895
899
  };
896
900
  var DefaultTheme = DefaultThemeDark;
@@ -942,9 +946,11 @@ var AppTheme = class _AppTheme {
942
946
  result[`${prefix}-divider-color`] = this.colors.border;
943
947
  result[`${prefix}-background-border-color`] = this.colors.border;
944
948
  }
945
- if (this.colors.ring) {
946
- result[`${prefix}-shadow-color`] = this.colors.ring;
947
- result[`${prefix}-background-box-shadow-color`] = this.colors.ring;
949
+ if (this.colors.shadow) {
950
+ result[`${prefix}-shadow-color`] = this.colors.shadow;
951
+ }
952
+ if (this.colors.innerShadow) {
953
+ result[`${prefix}-background-box-shadow-color`] = this.colors.innerShadow;
948
954
  }
949
955
  }
950
956
  if (this.typography) {
@@ -984,6 +990,10 @@ var AppTheme = class _AppTheme {
984
990
  }
985
991
  const newPath = [...path, key];
986
992
  if (typeof value === "object") {
993
+ if ("offsetX" in value && "offsetY" in value && "blur" in value) {
994
+ const varName = `${prefix}-${newPath.map(import_kebabCase.default).join("-")}`;
995
+ result[varName] = `${value.offsetX} ${value.offsetY} ${value.blur} var(${prefix}-colors-shadow)`;
996
+ }
987
997
  walk(value, newPath);
988
998
  } else {
989
999
  const varName = `${prefix}-${newPath.map(import_kebabCase.default).join("-")}`;
@@ -1054,11 +1064,42 @@ ${body}
1054
1064
  const value = cssNode.value.value?.trim() || "";
1055
1065
  if (firstDashIndex !== -1) {
1056
1066
  const category = propStr.substring(0, firstDashIndex);
1057
- const property = (0, import_camelCase.default)(propStr.substring(firstDashIndex + 1));
1067
+ const restStr = propStr.substring(firstDashIndex + 1);
1058
1068
  if (!themeOptions[category]) {
1059
1069
  themeOptions[category] = {};
1060
1070
  }
1061
- themeOptions[category][property] = value;
1071
+ if (category === "shadow") {
1072
+ const dashIndex = restStr.indexOf("-");
1073
+ if (dashIndex === -1) {
1074
+ const shadowSize = restStr;
1075
+ if (!themeOptions.shadow[shadowSize]) {
1076
+ themeOptions.shadow[shadowSize] = {};
1077
+ }
1078
+ const match = value.match(/^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/);
1079
+ if (match) {
1080
+ const obj = themeOptions.shadow[shadowSize];
1081
+ if (!obj.offsetX) {
1082
+ obj.offsetX = match[1];
1083
+ }
1084
+ if (!obj.offsetY) {
1085
+ obj.offsetY = match[2];
1086
+ }
1087
+ if (!obj.blur) {
1088
+ obj.blur = match[3];
1089
+ }
1090
+ }
1091
+ } else {
1092
+ const shadowSize = restStr.substring(0, dashIndex);
1093
+ const shadowProp = (0, import_camelCase.default)(restStr.substring(dashIndex + 1));
1094
+ if (!themeOptions.shadow[shadowSize]) {
1095
+ themeOptions.shadow[shadowSize] = {};
1096
+ }
1097
+ themeOptions.shadow[shadowSize][shadowProp] = value;
1098
+ }
1099
+ } else {
1100
+ const propName = (0, import_camelCase.default)(restStr);
1101
+ themeOptions[category][propName] = value;
1102
+ }
1062
1103
  } else {
1063
1104
  const category = (0, import_camelCase.default)(propStr);
1064
1105
  themeOptions[category] = value;
@@ -1105,6 +1146,10 @@ var DeployMode = /* @__PURE__ */ ((DeployMode2) => {
1105
1146
  var DeployedWidget = class extends DeployedPage {
1106
1147
  shortcut;
1107
1148
  deployMode;
1149
+ minWidth;
1150
+ minHeight;
1151
+ maxWidth;
1152
+ maxHeight;
1108
1153
  isOverlap() {
1109
1154
  return (this.deployMode & 16 /* OVERLAP */) > 0;
1110
1155
  }
@@ -2933,6 +2978,9 @@ var DeployedWidgetApiImpl = class extends BaseApi {
2933
2978
  return Promise.resolve([]);
2934
2979
  }
2935
2980
  }
2981
+ createDesktopShortcut(widgetName) {
2982
+ return this.invokeMethod("createDesktopShortcut", widgetName);
2983
+ }
2936
2984
  /**
2937
2985
  * 通过组件名移除已添加的组件
2938
2986
  * @param name 组件名
@@ -2974,6 +3022,9 @@ var DeployedWidgetApiImpl = class extends BaseApi {
2974
3022
  async setProxy(widgetId, proxy) {
2975
3023
  return this.invokeMethod("setProxy", widgetId, proxy);
2976
3024
  }
3025
+ async setSize(widgetId, width, height) {
3026
+ return this.invokeMethod("setSize", widgetId, width, height);
3027
+ }
2977
3028
  };
2978
3029
  var DeployedWidgetApi = new DeployedWidgetApiImpl();
2979
3030
 
@@ -3106,6 +3157,12 @@ var HttpApiImpl = class extends BaseApi {
3106
3157
  };
3107
3158
  var HttpApi = new HttpApiImpl();
3108
3159
 
3160
+ // src/api/interface/IAiApi.ts
3161
+ var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
3162
+ AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
3163
+ return AiApiEvent2;
3164
+ })(AiApiEvent || {});
3165
+
3109
3166
  // src/api/interface/IAppApi.ts
3110
3167
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
3111
3168
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
@@ -3124,12 +3181,11 @@ var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
3124
3181
  return AppApiConstants2;
3125
3182
  })(AppApiConstants || {});
3126
3183
 
3127
- // src/api/interface/IWidgetPackageApi.ts
3128
- var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
3129
- WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3130
- WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3131
- return WidgetPackageApiEvent2;
3132
- })(WidgetPackageApiEvent || {});
3184
+ // src/api/interface/IDeployedWidgetApi.ts
3185
+ var DeployedWidgetApiEvent = /* @__PURE__ */ ((DeployedWidgetApiEvent2) => {
3186
+ DeployedWidgetApiEvent2["SECOND_INSTANCE"] = `channel::cn.widgetjs.core.deployed_widget.second_instance`;
3187
+ return DeployedWidgetApiEvent2;
3188
+ })(DeployedWidgetApiEvent || {});
3133
3189
 
3134
3190
  // src/api/interface/IMouseApi.ts
3135
3191
  var MouseApiEvent = /* @__PURE__ */ ((MouseApiEvent2) => {
@@ -3156,11 +3212,12 @@ var UserApiEvent = /* @__PURE__ */ ((UserApiEvent2) => {
3156
3212
  return UserApiEvent2;
3157
3213
  })(UserApiEvent || {});
3158
3214
 
3159
- // src/api/interface/IAiApi.ts
3160
- var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
3161
- AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
3162
- return AiApiEvent2;
3163
- })(AiApiEvent || {});
3215
+ // src/api/interface/IWidgetPackageApi.ts
3216
+ var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
3217
+ WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3218
+ WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3219
+ return WidgetPackageApiEvent2;
3220
+ })(WidgetPackageApiEvent || {});
3164
3221
 
3165
3222
  // src/api/LogApi.ts
3166
3223
  var LogApiImpl = class extends BaseApi {
@@ -3547,6 +3604,7 @@ var WidgetApiEvent = /* @__PURE__ */ ((WidgetApiEvent2) => {
3547
3604
  WidgetApiEvent2["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
3548
3605
  WidgetApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3549
3606
  WidgetApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3607
+ WidgetApiEvent2["WIDGET_REMOVED"] = "event::cn.widgetjs.core.widget.removed";
3550
3608
  return WidgetApiEvent2;
3551
3609
  })(WidgetApiEvent || {});
3552
3610
  var WidgetApiImpl = class extends BaseApi {
@@ -3804,6 +3862,7 @@ exports.DeployMode = DeployMode;
3804
3862
  exports.DeployedPage = DeployedPage;
3805
3863
  exports.DeployedWidget = DeployedWidget;
3806
3864
  exports.DeployedWidgetApi = DeployedWidgetApi;
3865
+ exports.DeployedWidgetApiEvent = DeployedWidgetApiEvent;
3807
3866
  exports.DeviceApi = DeviceApi;
3808
3867
  exports.DialogApi = DialogApi;
3809
3868
  exports.ElectronApi = ElectronApi;