@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 +83 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +872 -832
- package/dist/index.d.ts +872 -832
- package/dist/index.js +83 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
854
|
-
md: "0 4px 6px
|
|
855
|
-
lg: "0 10px 20px
|
|
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
|
|
885
|
-
md: "0 4px 6px
|
|
886
|
-
lg: "0 10px 20px
|
|
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.
|
|
939
|
-
result[`${prefix}-shadow-color`] = this.colors.
|
|
940
|
-
|
|
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
|
|
1060
|
+
const restStr = propStr.substring(firstDashIndex + 1);
|
|
1051
1061
|
if (!themeOptions[category]) {
|
|
1052
1062
|
themeOptions[category] = {};
|
|
1053
1063
|
}
|
|
1054
|
-
|
|
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;
|
|
@@ -1098,6 +1139,10 @@ var DeployMode = /* @__PURE__ */ ((DeployMode2) => {
|
|
|
1098
1139
|
var DeployedWidget = class extends DeployedPage {
|
|
1099
1140
|
shortcut;
|
|
1100
1141
|
deployMode;
|
|
1142
|
+
minWidth;
|
|
1143
|
+
minHeight;
|
|
1144
|
+
maxWidth;
|
|
1145
|
+
maxHeight;
|
|
1101
1146
|
isOverlap() {
|
|
1102
1147
|
return (this.deployMode & 16 /* OVERLAP */) > 0;
|
|
1103
1148
|
}
|
|
@@ -2926,6 +2971,9 @@ var DeployedWidgetApiImpl = class extends BaseApi {
|
|
|
2926
2971
|
return Promise.resolve([]);
|
|
2927
2972
|
}
|
|
2928
2973
|
}
|
|
2974
|
+
createDesktopShortcut(widgetName) {
|
|
2975
|
+
return this.invokeMethod("createDesktopShortcut", widgetName);
|
|
2976
|
+
}
|
|
2929
2977
|
/**
|
|
2930
2978
|
* 通过组件名移除已添加的组件
|
|
2931
2979
|
* @param name 组件名
|
|
@@ -2967,6 +3015,9 @@ var DeployedWidgetApiImpl = class extends BaseApi {
|
|
|
2967
3015
|
async setProxy(widgetId, proxy) {
|
|
2968
3016
|
return this.invokeMethod("setProxy", widgetId, proxy);
|
|
2969
3017
|
}
|
|
3018
|
+
async setSize(widgetId, width, height) {
|
|
3019
|
+
return this.invokeMethod("setSize", widgetId, width, height);
|
|
3020
|
+
}
|
|
2970
3021
|
};
|
|
2971
3022
|
var DeployedWidgetApi = new DeployedWidgetApiImpl();
|
|
2972
3023
|
|
|
@@ -3099,6 +3150,12 @@ var HttpApiImpl = class extends BaseApi {
|
|
|
3099
3150
|
};
|
|
3100
3151
|
var HttpApi = new HttpApiImpl();
|
|
3101
3152
|
|
|
3153
|
+
// src/api/interface/IAiApi.ts
|
|
3154
|
+
var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
|
|
3155
|
+
AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
|
|
3156
|
+
return AiApiEvent2;
|
|
3157
|
+
})(AiApiEvent || {});
|
|
3158
|
+
|
|
3102
3159
|
// src/api/interface/IAppApi.ts
|
|
3103
3160
|
var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
|
|
3104
3161
|
AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
|
|
@@ -3117,12 +3174,11 @@ var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
|
|
|
3117
3174
|
return AppApiConstants2;
|
|
3118
3175
|
})(AppApiConstants || {});
|
|
3119
3176
|
|
|
3120
|
-
// src/api/interface/
|
|
3121
|
-
var
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
})(WidgetPackageApiEvent || {});
|
|
3177
|
+
// src/api/interface/IDeployedWidgetApi.ts
|
|
3178
|
+
var DeployedWidgetApiEvent = /* @__PURE__ */ ((DeployedWidgetApiEvent2) => {
|
|
3179
|
+
DeployedWidgetApiEvent2["SECOND_INSTANCE"] = `channel::cn.widgetjs.core.deployed_widget.second_instance`;
|
|
3180
|
+
return DeployedWidgetApiEvent2;
|
|
3181
|
+
})(DeployedWidgetApiEvent || {});
|
|
3126
3182
|
|
|
3127
3183
|
// src/api/interface/IMouseApi.ts
|
|
3128
3184
|
var MouseApiEvent = /* @__PURE__ */ ((MouseApiEvent2) => {
|
|
@@ -3149,11 +3205,12 @@ var UserApiEvent = /* @__PURE__ */ ((UserApiEvent2) => {
|
|
|
3149
3205
|
return UserApiEvent2;
|
|
3150
3206
|
})(UserApiEvent || {});
|
|
3151
3207
|
|
|
3152
|
-
// src/api/interface/
|
|
3153
|
-
var
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3208
|
+
// src/api/interface/IWidgetPackageApi.ts
|
|
3209
|
+
var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
|
|
3210
|
+
WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
3211
|
+
WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
3212
|
+
return WidgetPackageApiEvent2;
|
|
3213
|
+
})(WidgetPackageApiEvent || {});
|
|
3157
3214
|
|
|
3158
3215
|
// src/api/LogApi.ts
|
|
3159
3216
|
var LogApiImpl = class extends BaseApi {
|
|
@@ -3540,6 +3597,7 @@ var WidgetApiEvent = /* @__PURE__ */ ((WidgetApiEvent2) => {
|
|
|
3540
3597
|
WidgetApiEvent2["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
|
|
3541
3598
|
WidgetApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
3542
3599
|
WidgetApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
3600
|
+
WidgetApiEvent2["WIDGET_REMOVED"] = "event::cn.widgetjs.core.widget.removed";
|
|
3543
3601
|
return WidgetApiEvent2;
|
|
3544
3602
|
})(WidgetApiEvent || {});
|
|
3545
3603
|
var WidgetApiImpl = class extends BaseApi {
|
|
@@ -3770,6 +3828,6 @@ var WidgetPackageApiImpl = class extends BaseApi {
|
|
|
3770
3828
|
};
|
|
3771
3829
|
var WidgetPackageApi = new WidgetPackageApiImpl();
|
|
3772
3830
|
|
|
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 };
|
|
3831
|
+
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
3832
|
//# sourceMappingURL=index.js.map
|
|
3775
3833
|
//# sourceMappingURL=index.js.map
|