@mybricks/to-code-taro 1.1.4 → 1.1.6
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/cjs/core/mybricks/Subject.js +9 -5
- package/dist/cjs/core/mybricks/createJSHandle.js +45 -4
- package/dist/cjs/core/utils/comRefResolver.js +112 -0
- package/dist/cjs/core/utils/event.js +53 -0
- package/dist/cjs/core/utils/hooks.js +76 -39
- package/dist/cjs/core/utils/index.js +6 -0
- package/dist/cjs/core/utils/pageRouter.js +34 -11
- package/dist/cjs/core/utils/pool.js +63 -0
- package/dist/cjs/core/utils/slots.js +59 -13
- package/dist/cjs/core/utils/tabbar.js +56 -0
- package/dist/cjs/core/utils/useContext.js +46 -4
- package/dist/cjs/core/utils/with.js +9 -34
- package/dist/cjs/generate/generateTaroProjectJson.js +11 -18
- package/dist/cjs/generate/utils/appConfig.d.ts +1 -1
- package/dist/cjs/generate/utils/appConfig.js +23 -12
- package/dist/cjs/generate/utils/commonDir.js +9 -0
- package/dist/cjs/generate/utils/customTabBar.d.ts +11 -0
- package/dist/cjs/generate/utils/customTabBar.js +73 -0
- package/dist/cjs/generate/utils/fileNode.d.ts +4 -0
- package/dist/cjs/generate/utils/fileNode.js +12 -2
- package/dist/cjs/handleCom.js +15 -16
- package/dist/cjs/handleGlobal.d.ts +1 -1
- package/dist/cjs/handleGlobal.js +6 -0
- package/dist/cjs/handleSlot.js +4 -9
- package/dist/cjs/processors/processScene.js +13 -1
- package/dist/cjs/processors/processSceneLogic.js +2 -6
- package/dist/cjs/taro-template.json +1318 -1016
- package/dist/cjs/toCodeTaro.d.ts +1 -2
- package/dist/cjs/toCodeTaro.js +2 -0
- package/dist/cjs/utils/builder/buildResult.d.ts +1 -0
- package/dist/cjs/utils/builder/buildResult.js +54 -2
- package/dist/cjs/utils/common/ImportManager.d.ts +7 -0
- package/dist/cjs/utils/common/ImportManager.js +19 -1
- package/dist/cjs/utils/context/buildContext.d.ts +7 -0
- package/dist/cjs/utils/context/buildContext.js +11 -0
- package/dist/cjs/utils/logic/genJSModules.js +2 -2
- package/dist/cjs/utils/logic/handleProcess.js +54 -12
- package/dist/cjs/utils/templates/renderManager.js +4 -2
- package/dist/esm/core/mybricks/Subject.js +11 -5
- package/dist/esm/core/mybricks/createJSHandle.js +57 -6
- package/dist/esm/core/utils/comRefResolver.js +134 -0
- package/dist/esm/core/utils/event.js +32 -0
- package/dist/esm/core/utils/hooks.js +114 -51
- package/dist/esm/core/utils/index.js +2 -0
- package/dist/esm/core/utils/pageRouter.js +56 -13
- package/dist/esm/core/utils/pool.js +52 -0
- package/dist/esm/core/utils/slots.js +82 -16
- package/dist/esm/core/utils/tabbar.js +47 -0
- package/dist/esm/core/utils/useContext.js +53 -4
- package/dist/esm/core/utils/with.js +19 -53
- package/dist/esm/generate/generateTaroProjectJson.js +14 -20
- package/dist/esm/generate/utils/appConfig.d.ts +1 -1
- package/dist/esm/generate/utils/appConfig.js +29 -9
- package/dist/esm/generate/utils/commonDir.js +13 -0
- package/dist/esm/generate/utils/customTabBar.d.ts +11 -0
- package/dist/esm/generate/utils/customTabBar.js +52 -0
- package/dist/esm/generate/utils/fileNode.d.ts +4 -0
- package/dist/esm/generate/utils/fileNode.js +13 -0
- package/dist/esm/handleCom.js +24 -21
- package/dist/esm/handleGlobal.d.ts +1 -1
- package/dist/esm/handleGlobal.js +6 -1
- package/dist/esm/handleSlot.js +6 -11
- package/dist/esm/processors/processScene.js +23 -3
- package/dist/esm/processors/processSceneLogic.js +3 -5
- package/dist/esm/taro-template.json +1318 -1016
- package/dist/esm/toCodeTaro.d.ts +1 -2
- package/dist/esm/toCodeTaro.js +4 -2
- package/dist/esm/utils/builder/buildResult.d.ts +1 -0
- package/dist/esm/utils/builder/buildResult.js +42 -3
- package/dist/esm/utils/common/ImportManager.d.ts +7 -0
- package/dist/esm/utils/common/ImportManager.js +42 -14
- package/dist/esm/utils/context/buildContext.d.ts +7 -0
- package/dist/esm/utils/context/buildContext.js +12 -0
- package/dist/esm/utils/logic/genJSModules.js +2 -2
- package/dist/esm/utils/logic/handleProcess.js +66 -12
- package/dist/esm/utils/templates/renderManager.js +4 -4
- package/package.json +1 -1
- package/dist/cjs/core/comlib/Index.js +0 -114
- package/dist/cjs/core/comlib/_AesEncode.js +0 -115
- package/dist/cjs/core/comlib/_BackTo.js +0 -80
- package/dist/cjs/core/comlib/_CallPhone.js +0 -58
- package/dist/cjs/core/comlib/_ChooseFile.js +0 -103
- package/dist/cjs/core/comlib/_ChooseMedia.js +0 -70
- package/dist/cjs/core/comlib/_Connector.js +0 -92
- package/dist/cjs/core/comlib/_ConnectorGlobalHeaders.js +0 -79
- package/dist/cjs/core/comlib/_Format.js +0 -123
- package/dist/cjs/core/comlib/_GetLocation.js +0 -60
- package/dist/cjs/core/comlib/_GetStorage.js +0 -68
- package/dist/cjs/core/comlib/_GetSystemInfo.js +0 -62
- package/dist/cjs/core/comlib/_Modal.js +0 -68
- package/dist/cjs/core/comlib/_OpenCamera.js +0 -73
- package/dist/cjs/core/comlib/_OpenPetalMap.js +0 -49
- package/dist/cjs/core/comlib/_OpenUrl.js +0 -62
- package/dist/cjs/core/comlib/_RemoveStorage.js +0 -68
- package/dist/cjs/core/comlib/_Router.js +0 -100
- package/dist/cjs/core/comlib/_ScanQrcode.js +0 -59
- package/dist/cjs/core/comlib/_SetStorage.js +0 -67
- package/dist/cjs/core/comlib/_Share.js +0 -58
- package/dist/cjs/core/comlib/_ShowToast.js +0 -69
- package/dist/cjs/core/comlib/_TextToSpeech.js +0 -120
- package/dist/cjs/core/comlib/_TimerDebounce.js +0 -72
- package/dist/cjs/core/comlib/_TimerDelay.js +0 -88
- package/dist/cjs/core/comlib/_TimerThrottle.js +0 -75
- package/dist/cjs/core/comlib/_Vibrate.js +0 -60
- package/dist/esm/abstractEventTypeDef.d.ts.map +0 -1
- package/dist/esm/core/comlib/Index.js +0 -39
- package/dist/esm/core/comlib/_AesEncode.js +0 -85
- package/dist/esm/core/comlib/_BackTo.js +0 -66
- package/dist/esm/core/comlib/_CallPhone.js +0 -30
- package/dist/esm/core/comlib/_ChooseFile.js +0 -81
- package/dist/esm/core/comlib/_ChooseMedia.js +0 -38
- package/dist/esm/core/comlib/_Connector.js +0 -60
- package/dist/esm/core/comlib/_ConnectorGlobalHeaders.js +0 -56
- package/dist/esm/core/comlib/_Format.js +0 -102
- package/dist/esm/core/comlib/_GetLocation.js +0 -26
- package/dist/esm/core/comlib/_GetStorage.js +0 -44
- package/dist/esm/core/comlib/_GetSystemInfo.js +0 -32
- package/dist/esm/core/comlib/_Modal.js +0 -51
- package/dist/esm/core/comlib/_OpenCamera.js +0 -44
- package/dist/esm/core/comlib/_OpenPetalMap.js +0 -28
- package/dist/esm/core/comlib/_OpenUrl.js +0 -36
- package/dist/esm/core/comlib/_RemoveStorage.js +0 -42
- package/dist/esm/core/comlib/_Router.js +0 -113
- package/dist/esm/core/comlib/_ScanQrcode.js +0 -26
- package/dist/esm/core/comlib/_SetStorage.js +0 -40
- package/dist/esm/core/comlib/_Share.js +0 -28
- package/dist/esm/core/comlib/_ShowToast.js +0 -45
- package/dist/esm/core/comlib/_TextToSpeech.js +0 -117
- package/dist/esm/core/comlib/_TimerDebounce.js +0 -66
- package/dist/esm/core/comlib/_TimerDelay.js +0 -79
- package/dist/esm/core/comlib/_TimerThrottle.js +0 -69
- package/dist/esm/core/comlib/_Vibrate.js +0 -34
- package/dist/esm/generate/generateTaroTempalteJson.d.ts.map +0 -1
- package/dist/esm/generate/utils/appConfig.d.ts.map +0 -1
- package/dist/esm/generate/utils/fileNode.d.ts.map +0 -1
- package/dist/esm/generate/utils/index.d.ts.map +0 -1
- package/dist/esm/generate/utils/pageImages.d.ts.map +0 -1
- package/dist/esm/generate/utils/tabBarImages.d.ts.map +0 -1
- package/dist/esm/handleExtension.d.ts.map +0 -1
- package/dist/esm/handleModule.d.ts.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/processors/processComEvents.d.ts.map +0 -1
- package/dist/esm/processors/processModule.d.ts.map +0 -1
- package/dist/esm/processors/processScene.d.ts.map +0 -1
- package/dist/esm/processors/processSceneLogic.d.ts.map +0 -1
- package/dist/esm/toCodeTaro.d.ts.map +0 -1
- package/dist/esm/utils/builder/buildResult.d.ts.map +0 -1
- package/dist/esm/utils/common/ImportManager.d.ts.map +0 -1
- package/dist/esm/utils/common/helper.d.ts.map +0 -1
- package/dist/esm/utils/common/object.d.ts.map +0 -1
- package/dist/esm/utils/common/string.d.ts.map +0 -1
- package/dist/esm/utils/config/content/index.d.ts.map +0 -1
- package/dist/esm/utils/config/content/types.d.ts.map +0 -1
- package/dist/esm/utils/config/content/validator.d.ts.map +0 -1
- package/dist/esm/utils/config/handlePageConfig.d.ts.map +0 -1
- package/dist/esm/utils/context/buildContext.d.ts.map +0 -1
- package/dist/esm/utils/context/buildFrameMap.d.ts.map +0 -1
- package/dist/esm/utils/context/buildGlobalData.d.ts.map +0 -1
- package/dist/esm/utils/context/collectJSModules.d.ts.map +0 -1
- package/dist/esm/utils/context/createEventQueries.d.ts.map +0 -1
- package/dist/esm/utils/context/createProvider.d.ts.map +0 -1
- package/dist/esm/utils/index.d.ts.map +0 -1
- package/dist/esm/utils/logic/convertNamespace.d.ts.map +0 -1
- package/dist/esm/utils/logic/genJSModules.d.ts.map +0 -1
- package/dist/esm/utils/style/color.d.ts.map +0 -1
- package/dist/esm/utils/style/getComponentClassName.d.ts.map +0 -1
- package/dist/esm/utils/style/pxtransform.d.ts.map +0 -1
- package/dist/esm/utils/style/types.d.ts.map +0 -1
- package/dist/esm/utils/templates/component.d.ts.map +0 -1
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_Router.ts
|
|
30
|
-
var Router_exports = {};
|
|
31
|
-
__export(Router_exports, {
|
|
32
|
-
default: () => Router_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Router_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var Router_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.navigate) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const type = (val == null ? void 0 : val.type) || data.type || "navigateTo";
|
|
44
|
-
const path = (val == null ? void 0 : val.path) || data.path;
|
|
45
|
-
const params = (val == null ? void 0 : val.params) || data.params || {};
|
|
46
|
-
const delta = (val == null ? void 0 : val.delta) || data.delta || 1;
|
|
47
|
-
if (!path && type !== "navigateBack") {
|
|
48
|
-
outputs.onFail("路由路径不能为空");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
let url = path;
|
|
52
|
-
if (params && Object.keys(params).length > 0) {
|
|
53
|
-
const queryString = Object.entries(params).map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`).join("&");
|
|
54
|
-
url += (url.includes("?") ? "&" : "?") + queryString;
|
|
55
|
-
}
|
|
56
|
-
switch (type) {
|
|
57
|
-
case "navigateTo":
|
|
58
|
-
import_taro.default.navigateTo({
|
|
59
|
-
url,
|
|
60
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
61
|
-
fail: (err) => outputs.onFail(err.errMsg || "页面跳转失败")
|
|
62
|
-
});
|
|
63
|
-
break;
|
|
64
|
-
case "redirectTo":
|
|
65
|
-
import_taro.default.redirectTo({
|
|
66
|
-
url,
|
|
67
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
68
|
-
fail: (err) => outputs.onFail(err.errMsg || "页面重定向失败")
|
|
69
|
-
});
|
|
70
|
-
break;
|
|
71
|
-
case "switchTab":
|
|
72
|
-
import_taro.default.switchTab({
|
|
73
|
-
url,
|
|
74
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
75
|
-
fail: (err) => outputs.onFail(err.errMsg || "切换Tab失败")
|
|
76
|
-
});
|
|
77
|
-
break;
|
|
78
|
-
case "reLaunch":
|
|
79
|
-
import_taro.default.reLaunch({
|
|
80
|
-
url,
|
|
81
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
82
|
-
fail: (err) => outputs.onFail(err.errMsg || "重启应用失败")
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
85
|
-
case "navigateBack":
|
|
86
|
-
import_taro.default.navigateBack({
|
|
87
|
-
delta,
|
|
88
|
-
success: () => outputs.onSuccess({ type, delta }),
|
|
89
|
-
fail: (err) => outputs.onFail(err.errMsg || "返回失败")
|
|
90
|
-
});
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
outputs.onFail(`不支持的路由类型: ${type}`);
|
|
94
|
-
}
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error("路由跳转失败:", error);
|
|
97
|
-
outputs.onFail((error == null ? void 0 : error.message) || "路由跳转失败");
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_ScanQrcode.ts
|
|
30
|
-
var ScanQrcode_exports = {};
|
|
31
|
-
__export(ScanQrcode_exports, {
|
|
32
|
-
default: () => ScanQrcode_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ScanQrcode_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var ScanQrcode_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.scan) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const scanConfig = {
|
|
44
|
-
onlyFromCamera: (val == null ? void 0 : val.onlyFromCamera) ?? data.onlyFromCamera ?? false,
|
|
45
|
-
scanType: (val == null ? void 0 : val.scanType) ?? data.scanType ?? ["barCode", "qrCode"],
|
|
46
|
-
success: (res) => {
|
|
47
|
-
outputs.onSuccess(res.result || res);
|
|
48
|
-
},
|
|
49
|
-
fail: (err) => {
|
|
50
|
-
outputs.onFail(err.errMsg || "扫码失败");
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
import_taro.default.scanCode(scanConfig);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error("扫码失败:", error);
|
|
56
|
-
outputs.onFail((error == null ? void 0 : error.message) || "扫码失败");
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_SetStorage.ts
|
|
30
|
-
var SetStorage_exports = {};
|
|
31
|
-
__export(SetStorage_exports, {
|
|
32
|
-
default: () => SetStorage_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(SetStorage_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var SetStorage_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.setStorage) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const key = (val == null ? void 0 : val.key) || data.key;
|
|
44
|
-
const value = (val == null ? void 0 : val.value) !== void 0 ? val.value : data.value;
|
|
45
|
-
const useSync = (val == null ? void 0 : val.sync) !== void 0 ? val.sync : data.sync || false;
|
|
46
|
-
if (!key) {
|
|
47
|
-
outputs.onFail("存储 key 不能为空");
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const result = { key, value };
|
|
51
|
-
if (useSync) {
|
|
52
|
-
import_taro.default.setStorageSync(key, value);
|
|
53
|
-
outputs.onSuccess(result);
|
|
54
|
-
} else {
|
|
55
|
-
import_taro.default.setStorage({
|
|
56
|
-
key,
|
|
57
|
-
data: value,
|
|
58
|
-
success: () => outputs.onSuccess(result),
|
|
59
|
-
fail: (err) => outputs.onFail(err.errMsg || "写入本地缓存失败")
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error("写入本地缓存失败:", error);
|
|
64
|
-
outputs.onFail((error == null ? void 0 : error.message) || "写入本地缓存失败");
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_Share.ts
|
|
30
|
-
var Share_exports = {};
|
|
31
|
-
__export(Share_exports, {
|
|
32
|
-
default: () => Share_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Share_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var Share_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.share) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const shareData = {
|
|
44
|
-
title: (val == null ? void 0 : val.title) || data.title || "分享",
|
|
45
|
-
path: (val == null ? void 0 : val.path) || data.path || "/pages/index/index",
|
|
46
|
-
imageUrl: (val == null ? void 0 : val.imageUrl) || data.imageUrl
|
|
47
|
-
};
|
|
48
|
-
import_taro.default.showShareMenu({
|
|
49
|
-
withShareTicket: true,
|
|
50
|
-
success: () => outputs.onSuccess(shareData),
|
|
51
|
-
fail: (err) => outputs.onFail(err.errMsg || "分享失败")
|
|
52
|
-
});
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error("分享失败:", error);
|
|
55
|
-
outputs.onFail((error == null ? void 0 : error.message) || "分享失败");
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_ShowToast.ts
|
|
30
|
-
var ShowToast_exports = {};
|
|
31
|
-
__export(ShowToast_exports, {
|
|
32
|
-
default: () => ShowToast_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ShowToast_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var ShowToast_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.showToast) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const toastConfig = {
|
|
44
|
-
title: typeof val === "string" ? val : (val == null ? void 0 : val.title) || data.title || "",
|
|
45
|
-
duration: Number(typeof val === "object" && (val == null ? void 0 : val.duration) ? val.duration : data.duration || 1e3),
|
|
46
|
-
mask: typeof val === "object" && (val == null ? void 0 : val.mask) !== void 0 ? val.mask : data.mask || false
|
|
47
|
-
};
|
|
48
|
-
if (typeof val === "object" && (val == null ? void 0 : val.icon)) {
|
|
49
|
-
toastConfig.icon = val.icon;
|
|
50
|
-
} else if (data.icon) {
|
|
51
|
-
toastConfig.icon = data.icon;
|
|
52
|
-
}
|
|
53
|
-
if (typeof val === "object" && (val == null ? void 0 : val.image)) {
|
|
54
|
-
toastConfig.image = val.image;
|
|
55
|
-
} else if (data.image) {
|
|
56
|
-
toastConfig.image = data.image;
|
|
57
|
-
}
|
|
58
|
-
import_taro.default.showToast(toastConfig);
|
|
59
|
-
const triggerOutput = () => outputs.afterShowToast(val);
|
|
60
|
-
if (data.asynchronous) {
|
|
61
|
-
setTimeout(triggerOutput, toastConfig.duration);
|
|
62
|
-
} else {
|
|
63
|
-
triggerOutput();
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error("显示 Toast 失败:", error);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_TextToSpeech.ts
|
|
20
|
-
var TextToSpeech_exports = {};
|
|
21
|
-
__export(TextToSpeech_exports, {
|
|
22
|
-
default: () => TextToSpeech_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(TextToSpeech_exports);
|
|
25
|
-
var speechSupported = typeof window !== "undefined" && "speechSynthesis" in window;
|
|
26
|
-
var currentUtterance = null;
|
|
27
|
-
var TextToSpeech_default = (context) => {
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
const data = context.data;
|
|
30
|
-
const inputs = context.inputs;
|
|
31
|
-
const outputs = context.outputs;
|
|
32
|
-
if (!speechSupported) {
|
|
33
|
-
console.warn("当前环境不支持语音合成功能");
|
|
34
|
-
}
|
|
35
|
-
(_a = inputs.speak) == null ? void 0 : _a.call(inputs, (val) => {
|
|
36
|
-
try {
|
|
37
|
-
const text = (val == null ? void 0 : val.text) || data.text;
|
|
38
|
-
const lang = (val == null ? void 0 : val.lang) || data.lang || "zh-CN";
|
|
39
|
-
const rate = (val == null ? void 0 : val.rate) || data.rate || 1;
|
|
40
|
-
const pitch = (val == null ? void 0 : val.pitch) || data.pitch || 1;
|
|
41
|
-
const volume = (val == null ? void 0 : val.volume) || data.volume || 1;
|
|
42
|
-
if (!text) {
|
|
43
|
-
outputs.onFail("待合成的文本不能为空");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!speechSupported) {
|
|
47
|
-
outputs.onFail("当前环境不支持语音合成功能");
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (currentUtterance && window.speechSynthesis.speaking) {
|
|
51
|
-
window.speechSynthesis.cancel();
|
|
52
|
-
}
|
|
53
|
-
currentUtterance = new SpeechSynthesisUtterance(text);
|
|
54
|
-
currentUtterance.lang = lang;
|
|
55
|
-
currentUtterance.rate = Math.max(0.1, Math.min(10, rate));
|
|
56
|
-
currentUtterance.pitch = Math.max(0, Math.min(2, pitch));
|
|
57
|
-
currentUtterance.volume = Math.max(0, Math.min(1, volume));
|
|
58
|
-
currentUtterance.onstart = () => {
|
|
59
|
-
outputs.onStart({ text, lang, rate, pitch, volume });
|
|
60
|
-
};
|
|
61
|
-
currentUtterance.onend = () => {
|
|
62
|
-
outputs.onEnd({ text, lang, rate, pitch, volume });
|
|
63
|
-
currentUtterance = null;
|
|
64
|
-
};
|
|
65
|
-
currentUtterance.onerror = (event) => {
|
|
66
|
-
outputs.onError({
|
|
67
|
-
error: event.error,
|
|
68
|
-
text,
|
|
69
|
-
message: "语音合成失败"
|
|
70
|
-
});
|
|
71
|
-
currentUtterance = null;
|
|
72
|
-
};
|
|
73
|
-
window.speechSynthesis.speak(currentUtterance);
|
|
74
|
-
outputs.onSuccess({ text, lang, rate, pitch, volume });
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error("语音合成失败:", error);
|
|
77
|
-
outputs.onFail((error == null ? void 0 : error.message) || "语音合成失败");
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
(_b = inputs.stop) == null ? void 0 : _b.call(inputs, () => {
|
|
81
|
-
try {
|
|
82
|
-
if (speechSupported && currentUtterance) {
|
|
83
|
-
window.speechSynthesis.cancel();
|
|
84
|
-
currentUtterance = null;
|
|
85
|
-
outputs.onSuccess("已停止语音播放");
|
|
86
|
-
} else {
|
|
87
|
-
outputs.onFail("没有正在播放的语音");
|
|
88
|
-
}
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error("停止语音失败:", error);
|
|
91
|
-
outputs.onFail((error == null ? void 0 : error.message) || "停止语音失败");
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
(_c = inputs.pause) == null ? void 0 : _c.call(inputs, () => {
|
|
95
|
-
try {
|
|
96
|
-
if (speechSupported && window.speechSynthesis.pause) {
|
|
97
|
-
window.speechSynthesis.pause();
|
|
98
|
-
outputs.onSuccess("已暂停语音播放");
|
|
99
|
-
} else {
|
|
100
|
-
outputs.onFail("当前环境不支持暂停功能");
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error("暂停语音失败:", error);
|
|
104
|
-
outputs.onFail((error == null ? void 0 : error.message) || "暂停语音失败");
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
(_d = inputs.resume) == null ? void 0 : _d.call(inputs, () => {
|
|
108
|
-
try {
|
|
109
|
-
if (speechSupported && window.speechSynthesis.resume) {
|
|
110
|
-
window.speechSynthesis.resume();
|
|
111
|
-
outputs.onSuccess("已恢复语音播放");
|
|
112
|
-
} else {
|
|
113
|
-
outputs.onFail("当前环境不支持恢复功能");
|
|
114
|
-
}
|
|
115
|
-
} catch (error) {
|
|
116
|
-
console.error("恢复语音失败:", error);
|
|
117
|
-
outputs.onFail((error == null ? void 0 : error.message) || "恢复语音失败");
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_TimerDebounce.ts
|
|
20
|
-
var TimerDebounce_exports = {};
|
|
21
|
-
__export(TimerDebounce_exports, {
|
|
22
|
-
default: () => TimerDebounce_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(TimerDebounce_exports);
|
|
25
|
-
function debounce(func, delay, options = {}) {
|
|
26
|
-
let timeoutId = null;
|
|
27
|
-
let lastExecTime = 0;
|
|
28
|
-
const { leading = false, trailing = true } = options;
|
|
29
|
-
return function(...args) {
|
|
30
|
-
const currentTime = Date.now();
|
|
31
|
-
if (!timeoutId && leading) {
|
|
32
|
-
func.apply(null, args);
|
|
33
|
-
lastExecTime = currentTime;
|
|
34
|
-
}
|
|
35
|
-
if (timeoutId) {
|
|
36
|
-
clearTimeout(timeoutId);
|
|
37
|
-
}
|
|
38
|
-
timeoutId = setTimeout(() => {
|
|
39
|
-
if (trailing && (!leading || currentTime - lastExecTime >= delay)) {
|
|
40
|
-
func.apply(null, args);
|
|
41
|
-
}
|
|
42
|
-
timeoutId = null;
|
|
43
|
-
}, delay);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
var TimerDebounce_default = (context) => {
|
|
47
|
-
var _a;
|
|
48
|
-
const data = context.data;
|
|
49
|
-
const inputs = context.inputs;
|
|
50
|
-
const outputs = context.outputs;
|
|
51
|
-
let debouncedFn = null;
|
|
52
|
-
(_a = inputs.debounce) == null ? void 0 : _a.call(inputs, (val) => {
|
|
53
|
-
try {
|
|
54
|
-
const delay = (val == null ? void 0 : val.delay) || data.delay || 300;
|
|
55
|
-
const leading = (val == null ? void 0 : val.leading) !== void 0 ? val.leading : data.leading || false;
|
|
56
|
-
const trailing = (val == null ? void 0 : val.trailing) !== void 0 ? val.trailing : data.trailing || true;
|
|
57
|
-
if (!debouncedFn) {
|
|
58
|
-
debouncedFn = debounce(
|
|
59
|
-
() => {
|
|
60
|
-
outputs.onExecute({ delay, leading, trailing, timestamp: Date.now() });
|
|
61
|
-
},
|
|
62
|
-
delay,
|
|
63
|
-
{ leading, trailing }
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
debouncedFn();
|
|
67
|
-
outputs.onComplete({ delay, leading, trailing });
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error("防抖执行失败:", error);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_TimerDelay.ts
|
|
20
|
-
var TimerDelay_exports = {};
|
|
21
|
-
__export(TimerDelay_exports, {
|
|
22
|
-
default: () => TimerDelay_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(TimerDelay_exports);
|
|
25
|
-
var TimerDelay_default = (context) => {
|
|
26
|
-
var _a, _b, _c;
|
|
27
|
-
const data = context.data;
|
|
28
|
-
const inputs = context.inputs;
|
|
29
|
-
const outputs = context.outputs;
|
|
30
|
-
let timeoutId = null;
|
|
31
|
-
const inputPins = new Set(Object.keys(inputs));
|
|
32
|
-
const outputPins = new Set(Object.keys(outputs));
|
|
33
|
-
const hasIn = (pin) => inputPins.has(pin);
|
|
34
|
-
const hasOut = (pin) => outputPins.has(pin);
|
|
35
|
-
const clear = () => {
|
|
36
|
-
if (timeoutId) {
|
|
37
|
-
clearTimeout(timeoutId);
|
|
38
|
-
timeoutId = null;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
if (hasIn("trigger"))
|
|
42
|
-
(_a = inputs.trigger) == null ? void 0 : _a.call(inputs, (payload) => {
|
|
43
|
-
var _a2;
|
|
44
|
-
try {
|
|
45
|
-
const delay = (payload == null ? void 0 : payload.delay) || data.delay || 1e3;
|
|
46
|
-
clear();
|
|
47
|
-
(_a2 = outputs.onStart) == null ? void 0 : _a2.call(outputs, { delay, timestamp: Date.now() });
|
|
48
|
-
timeoutId = setTimeout(() => {
|
|
49
|
-
var _a3, _b2;
|
|
50
|
-
if (hasOut("trigger"))
|
|
51
|
-
(_a3 = outputs.trigger) == null ? void 0 : _a3.call(outputs, payload);
|
|
52
|
-
(_b2 = outputs.onExecute) == null ? void 0 : _b2.call(outputs, { delay, timestamp: Date.now() });
|
|
53
|
-
timeoutId = null;
|
|
54
|
-
}, delay);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.error("延迟执行失败:", error);
|
|
57
|
-
clear();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
if (hasIn("delay"))
|
|
61
|
-
(_b = inputs.delay) == null ? void 0 : _b.call(inputs, (val) => {
|
|
62
|
-
try {
|
|
63
|
-
const delay = (val == null ? void 0 : val.delay) || data.delay || 1e3;
|
|
64
|
-
clear();
|
|
65
|
-
outputs.onStart({ delay, timestamp: Date.now() });
|
|
66
|
-
timeoutId = setTimeout(() => {
|
|
67
|
-
outputs.onExecute({ delay, timestamp: Date.now() });
|
|
68
|
-
timeoutId = null;
|
|
69
|
-
}, delay);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.error("延迟执行失败:", error);
|
|
72
|
-
clear();
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
if (hasIn("cancel"))
|
|
76
|
-
(_c = inputs.cancel) == null ? void 0 : _c.call(inputs, () => {
|
|
77
|
-
try {
|
|
78
|
-
if (timeoutId) {
|
|
79
|
-
clear();
|
|
80
|
-
outputs.onCancel("延迟任务已取消");
|
|
81
|
-
} else {
|
|
82
|
-
outputs.onCancel("没有正在执行的延迟任务");
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error("取消延迟失败:", error);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
};
|