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

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.js CHANGED
@@ -837,7 +837,9 @@ var DefaultThemeDark = {
837
837
  destructiveForeground: "#fff",
838
838
  border: "hsl(0 0% 30%)",
839
839
  input: "hsl(0 0% 25%)",
840
- ring: "hsl(210 100% 60%)"
840
+ ring: "hsl(210 100% 60%)",
841
+ shadow: "0 0% 0%",
842
+ innerShadow: "0 0% 0%"
841
843
  },
842
844
  radius: {
843
845
  sm: "6px",
@@ -850,9 +852,9 @@ var DefaultThemeDark = {
850
852
  fontSize: "14px"
851
853
  },
852
854
  shadow: {
853
- sm: "0 1px 2px rgba(0,0,0,0.2)",
854
- md: "0 4px 6px rgba(0,0,0,0.3)",
855
- lg: "0 10px 20px rgba(0,0,0,0.4)"
855
+ sm: { offsetX: "0", offsetY: "1px", blur: "2px" },
856
+ md: { offsetX: "0", offsetY: "4px", blur: "6px" },
857
+ lg: { offsetX: "0", offsetY: "10px", blur: "20px" }
856
858
  },
857
859
  spacing: "0.5rem"
858
860
  };
@@ -878,12 +880,14 @@ var DefaultThemeLight = {
878
880
  destructiveForeground: "#fff",
879
881
  border: "hsl(0 0% 90%)",
880
882
  input: "hsl(0 0% 85%)",
881
- ring: "hsl(210 100% 56%)"
883
+ ring: "hsl(210 100% 56%)",
884
+ shadow: "0 0% 0%",
885
+ innerShadow: "0 0% 0%"
882
886
  },
883
887
  shadow: {
884
- sm: "0 1px 2px rgba(0,0,0,0.05)",
885
- md: "0 4px 6px rgba(0,0,0,0.1)",
886
- lg: "0 10px 20px rgba(0,0,0,0.15)"
888
+ sm: { offsetX: "0", offsetY: "1px", blur: "2px" },
889
+ md: { offsetX: "0", offsetY: "4px", blur: "6px" },
890
+ lg: { offsetX: "0", offsetY: "10px", blur: "20px" }
887
891
  }
888
892
  };
889
893
  var DefaultTheme = DefaultThemeDark;
@@ -935,9 +939,11 @@ var AppTheme = class _AppTheme {
935
939
  result[`${prefix}-divider-color`] = this.colors.border;
936
940
  result[`${prefix}-background-border-color`] = this.colors.border;
937
941
  }
938
- if (this.colors.ring) {
939
- result[`${prefix}-shadow-color`] = this.colors.ring;
940
- result[`${prefix}-background-box-shadow-color`] = this.colors.ring;
942
+ if (this.colors.shadow) {
943
+ result[`${prefix}-shadow-color`] = this.colors.shadow;
944
+ }
945
+ if (this.colors.innerShadow) {
946
+ result[`${prefix}-background-box-shadow-color`] = this.colors.innerShadow;
941
947
  }
942
948
  }
943
949
  if (this.typography) {
@@ -977,6 +983,10 @@ var AppTheme = class _AppTheme {
977
983
  }
978
984
  const newPath = [...path, key];
979
985
  if (typeof value === "object") {
986
+ if ("offsetX" in value && "offsetY" in value && "blur" in value) {
987
+ const varName = `${prefix}-${newPath.map(import_kebabCase.default).join("-")}`;
988
+ result[varName] = `${value.offsetX} ${value.offsetY} ${value.blur} var(${prefix}-colors-shadow)`;
989
+ }
980
990
  walk(value, newPath);
981
991
  } else {
982
992
  const varName = `${prefix}-${newPath.map(import_kebabCase.default).join("-")}`;
@@ -1047,11 +1057,42 @@ ${body}
1047
1057
  const value = cssNode.value.value?.trim() || "";
1048
1058
  if (firstDashIndex !== -1) {
1049
1059
  const category = propStr.substring(0, firstDashIndex);
1050
- const property = (0, import_camelCase.default)(propStr.substring(firstDashIndex + 1));
1060
+ const restStr = propStr.substring(firstDashIndex + 1);
1051
1061
  if (!themeOptions[category]) {
1052
1062
  themeOptions[category] = {};
1053
1063
  }
1054
- themeOptions[category][property] = value;
1064
+ if (category === "shadow") {
1065
+ const dashIndex = restStr.indexOf("-");
1066
+ if (dashIndex === -1) {
1067
+ const shadowSize = restStr;
1068
+ if (!themeOptions.shadow[shadowSize]) {
1069
+ themeOptions.shadow[shadowSize] = {};
1070
+ }
1071
+ const match = value.match(/^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/);
1072
+ if (match) {
1073
+ const obj = themeOptions.shadow[shadowSize];
1074
+ if (!obj.offsetX) {
1075
+ obj.offsetX = match[1];
1076
+ }
1077
+ if (!obj.offsetY) {
1078
+ obj.offsetY = match[2];
1079
+ }
1080
+ if (!obj.blur) {
1081
+ obj.blur = match[3];
1082
+ }
1083
+ }
1084
+ } else {
1085
+ const shadowSize = restStr.substring(0, dashIndex);
1086
+ const shadowProp = (0, import_camelCase.default)(restStr.substring(dashIndex + 1));
1087
+ if (!themeOptions.shadow[shadowSize]) {
1088
+ themeOptions.shadow[shadowSize] = {};
1089
+ }
1090
+ themeOptions.shadow[shadowSize][shadowProp] = value;
1091
+ }
1092
+ } else {
1093
+ const propName = (0, import_camelCase.default)(restStr);
1094
+ themeOptions[category][propName] = value;
1095
+ }
1055
1096
  } else {
1056
1097
  const category = (0, import_camelCase.default)(propStr);
1057
1098
  themeOptions[category] = value;
@@ -2926,6 +2967,9 @@ var DeployedWidgetApiImpl = class extends BaseApi {
2926
2967
  return Promise.resolve([]);
2927
2968
  }
2928
2969
  }
2970
+ createDesktopShortcut(widgetName) {
2971
+ return this.invokeMethod("createDesktopShortcut", widgetName);
2972
+ }
2929
2973
  /**
2930
2974
  * 通过组件名移除已添加的组件
2931
2975
  * @param name 组件名
@@ -3099,6 +3143,12 @@ var HttpApiImpl = class extends BaseApi {
3099
3143
  };
3100
3144
  var HttpApi = new HttpApiImpl();
3101
3145
 
3146
+ // src/api/interface/IAiApi.ts
3147
+ var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
3148
+ AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
3149
+ return AiApiEvent2;
3150
+ })(AiApiEvent || {});
3151
+
3102
3152
  // src/api/interface/IAppApi.ts
3103
3153
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
3104
3154
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
@@ -3117,12 +3167,11 @@ var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
3117
3167
  return AppApiConstants2;
3118
3168
  })(AppApiConstants || {});
3119
3169
 
3120
- // src/api/interface/IWidgetPackageApi.ts
3121
- var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
3122
- WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3123
- WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3124
- return WidgetPackageApiEvent2;
3125
- })(WidgetPackageApiEvent || {});
3170
+ // src/api/interface/IDeployedWidgetApi.ts
3171
+ var DeployedWidgetApiEvent = /* @__PURE__ */ ((DeployedWidgetApiEvent2) => {
3172
+ DeployedWidgetApiEvent2["SECOND_INSTANCE"] = `channel::cn.widgetjs.core.deployed_widget.second_instance`;
3173
+ return DeployedWidgetApiEvent2;
3174
+ })(DeployedWidgetApiEvent || {});
3126
3175
 
3127
3176
  // src/api/interface/IMouseApi.ts
3128
3177
  var MouseApiEvent = /* @__PURE__ */ ((MouseApiEvent2) => {
@@ -3149,11 +3198,12 @@ var UserApiEvent = /* @__PURE__ */ ((UserApiEvent2) => {
3149
3198
  return UserApiEvent2;
3150
3199
  })(UserApiEvent || {});
3151
3200
 
3152
- // src/api/interface/IAiApi.ts
3153
- var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
3154
- AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
3155
- return AiApiEvent2;
3156
- })(AiApiEvent || {});
3201
+ // src/api/interface/IWidgetPackageApi.ts
3202
+ var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
3203
+ WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3204
+ WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3205
+ return WidgetPackageApiEvent2;
3206
+ })(WidgetPackageApiEvent || {});
3157
3207
 
3158
3208
  // src/api/LogApi.ts
3159
3209
  var LogApiImpl = class extends BaseApi {
@@ -3770,6 +3820,6 @@ var WidgetPackageApiImpl = class extends BaseApi {
3770
3820
  };
3771
3821
  var WidgetPackageApi = new WidgetPackageApiImpl();
3772
3822
 
3773
- export { AiApiEvent, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppConfig, AppEvent, AppNotification, AppReminderNotification, AppTheme, BackgroundWidget, BaseApi, BroadcastApi, BroadcastEvent, BrowserWindowApi, BrowserWindowApiEvent, Channel, ClipboardApi, ClipboardApiEvent, DefaultTheme, DefaultThemeDark, DefaultThemeLight, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeviceApi, DialogApi, ElectronApi, ElectronUtils, FileApi, Gravity, GridRect, GridSystem, HostedMode, HttpApi, LanguageMap, LanguageUtils, LogApi, MenuApi, MenuApiEvent, MouseApi, MouseApiEvent, NotificationApi, NotificationApiEvent, NotificationSize, Page, ProcessApi, ShortcutApi, ShortcutApiEvent, SocialInfo, StorageApi, StoreApi, SystemApi, SystemApiEvent, ThemeMode, TrayApi, TrayApiEvent, UserApi, UserApiEvent, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetData, WidgetDataApi, WidgetKeyword, WidgetPackage, WidgetPackageApi, WidgetPackageApiEvent, WidgetPackageUtils, WidgetParams, WidgetTheme, WidgetUtils, delay, normalizeUrl, parseQuery, stringifyQuery };
3823
+ export { AiApiEvent, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppConfig, AppEvent, AppNotification, AppReminderNotification, AppTheme, BackgroundWidget, BaseApi, BroadcastApi, BroadcastEvent, BrowserWindowApi, BrowserWindowApiEvent, Channel, ClipboardApi, ClipboardApiEvent, DefaultTheme, DefaultThemeDark, DefaultThemeLight, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiEvent, DeviceApi, DialogApi, ElectronApi, ElectronUtils, FileApi, Gravity, GridRect, GridSystem, HostedMode, HttpApi, LanguageMap, LanguageUtils, LogApi, MenuApi, MenuApiEvent, MouseApi, MouseApiEvent, NotificationApi, NotificationApiEvent, NotificationSize, Page, ProcessApi, ShortcutApi, ShortcutApiEvent, SocialInfo, StorageApi, StoreApi, SystemApi, SystemApiEvent, ThemeMode, TrayApi, TrayApiEvent, UserApi, UserApiEvent, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetData, WidgetDataApi, WidgetKeyword, WidgetPackage, WidgetPackageApi, WidgetPackageApiEvent, WidgetPackageUtils, WidgetParams, WidgetTheme, WidgetUtils, delay, normalizeUrl, parseQuery, stringifyQuery };
3774
3824
  //# sourceMappingURL=index.js.map
3775
3825
  //# sourceMappingURL=index.js.map