@mybricks/to-code-taro 1.0.2 → 1.0.4
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/README.md +58 -0
- package/dist/cjs/core/comlib/_AesEncode.js +115 -0
- package/dist/cjs/core/comlib/_BackTo.js +80 -0
- package/dist/cjs/core/comlib/{Index.js → _CallPhone.js} +29 -16
- package/dist/cjs/core/comlib/_ChooseFile.js +103 -0
- package/dist/cjs/core/comlib/_ChooseMedia.js +70 -0
- package/dist/cjs/core/comlib/_Connector.js +92 -0
- package/dist/cjs/core/comlib/_ConnectorGlobalHeaders.js +79 -0
- package/dist/cjs/core/comlib/_Format.js +123 -0
- package/dist/cjs/core/comlib/_GetLocation.js +60 -0
- package/dist/cjs/core/comlib/_GetStorage.js +68 -0
- package/dist/cjs/core/comlib/_GetSystemInfo.js +62 -0
- package/dist/cjs/core/comlib/_OpenCamera.js +73 -0
- package/dist/cjs/core/comlib/_OpenPetalMap.js +49 -0
- package/dist/cjs/core/comlib/_OpenUrl.js +62 -0
- package/dist/cjs/core/comlib/_RemoveStorage.js +68 -0
- package/dist/cjs/core/comlib/_Router.js +100 -0
- package/dist/cjs/core/comlib/_ScanQrcode.js +9 -10
- package/dist/cjs/core/comlib/_SetStorage.js +10 -19
- package/dist/cjs/core/comlib/_Share.js +58 -0
- package/dist/cjs/core/comlib/_ShowToast.js +23 -50
- package/dist/cjs/core/comlib/_TextToSpeech.js +120 -0
- package/dist/cjs/core/comlib/_TimerDebounce.js +72 -0
- package/dist/cjs/core/comlib/_TimerDelay.js +63 -0
- package/dist/cjs/core/comlib/_TimerThrottle.js +75 -0
- package/dist/cjs/core/comlib/_Vibrate.js +60 -0
- package/dist/cjs/core/comlib/index.js +111 -0
- package/dist/cjs/core/mybricks/index.js +47 -47
- package/dist/cjs/core/utils/ComContext.js +3 -0
- package/dist/cjs/core/utils/PopupRenderer.js +63 -0
- package/dist/cjs/core/utils/hooks.js +131 -0
- package/dist/cjs/core/utils/index.js +33 -57
- package/dist/cjs/core/utils/pageRouter.js +81 -0
- package/dist/cjs/core/utils/popupRouter.js +98 -0
- package/dist/cjs/core/utils/useContext.js +11 -2
- package/dist/cjs/core/utils/with.js +37 -13
- package/dist/cjs/generate/generateTaroProjectJson.d.ts +3 -14
- package/dist/cjs/generate/generateTaroProjectJson.js +39 -6
- package/dist/cjs/generate/utils/tabBarImages.d.ts +1 -1
- package/dist/cjs/handleCom.d.ts +1 -1
- package/dist/cjs/handleCom.js +91 -177
- package/dist/cjs/handleDom.js +7 -44
- package/dist/cjs/handleExtension.d.ts +2 -2
- package/dist/cjs/handleExtension.js +5 -5
- package/dist/cjs/handleGlobal.d.ts +2 -12
- package/dist/cjs/handleGlobal.js +23 -7
- package/dist/cjs/handleModule.js +3 -3
- package/dist/cjs/handleSlot.d.ts +4 -9
- package/dist/cjs/handleSlot.js +61 -150
- package/dist/cjs/processors/processComEvents.d.ts +9 -0
- package/dist/cjs/processors/processComEvents.js +164 -0
- package/dist/cjs/processors/processModule.d.ts +31 -0
- package/dist/cjs/processors/processModule.js +125 -0
- package/dist/cjs/processors/processScene.d.ts +32 -0
- package/dist/cjs/processors/processScene.js +128 -0
- package/dist/cjs/processors/processSceneLogic.d.ts +4 -0
- package/dist/cjs/processors/processSceneLogic.js +170 -0
- package/dist/cjs/shims-taro.d.ts +20 -0
- package/dist/cjs/taro-template.json +501 -351
- package/dist/cjs/toCodeTaro.d.ts +27 -6
- package/dist/cjs/toCodeTaro.js +68 -340
- package/dist/cjs/utils/builder/buildResult.d.ts +22 -0
- package/dist/cjs/utils/builder/buildResult.js +117 -0
- package/dist/cjs/utils/common/ImportManager.d.ts +19 -0
- package/dist/cjs/utils/common/ImportManager.js +105 -0
- package/dist/cjs/utils/common/helper.d.ts +2 -0
- package/dist/cjs/utils/common/helper.js +31 -0
- package/dist/cjs/utils/common/object.d.ts +5 -0
- package/dist/cjs/utils/common/object.js +58 -0
- package/dist/cjs/utils/common/string.d.ts +8 -0
- package/dist/cjs/utils/common/string.js +46 -0
- package/dist/cjs/utils/{pageConfig → config/content}/converter.js +1 -1
- package/dist/cjs/utils/{pageConfig → config/content}/index.js +9 -9
- package/dist/cjs/utils/{pageConfig → config/content}/pageConfig.js +12 -22
- package/dist/{esm/utils/pageConfig → cjs/utils/config/content}/saveBase64Image.d.ts +1 -1
- package/dist/cjs/utils/{pageConfig → config/content}/saveBase64Image.js +8 -17
- package/dist/cjs/utils/{pageConfig → config/content}/tabBarConfig.js +9 -32
- package/dist/cjs/utils/config/content/types.js +17 -0
- package/dist/cjs/utils/{pageConfig → config/content}/validator.js +1 -1
- package/dist/{esm/utils → cjs/utils/config}/handlePageConfig.d.ts +3 -2
- package/dist/cjs/utils/{handlePageConfig.js → config/handlePageConfig.js} +7 -6
- package/dist/cjs/utils/context/buildContext.d.ts +24 -0
- package/dist/cjs/utils/context/buildContext.js +65 -0
- package/dist/cjs/utils/context/buildFrameMap.d.ts +16 -0
- package/dist/cjs/utils/context/buildFrameMap.js +106 -0
- package/dist/cjs/utils/context/buildGlobalData.d.ts +13 -0
- package/dist/cjs/utils/context/buildGlobalData.js +58 -0
- package/dist/cjs/utils/context/collectJSModules.d.ts +37 -0
- package/dist/cjs/utils/context/collectJSModules.js +91 -0
- package/dist/cjs/utils/context/createEventQueries.d.ts +45 -0
- package/dist/cjs/utils/context/createEventQueries.js +99 -0
- package/dist/cjs/utils/context/createProvider.d.ts +21 -0
- package/dist/cjs/utils/context/createProvider.js +49 -0
- package/dist/cjs/utils/index.d.ts +10 -62
- package/dist/cjs/utils/index.js +21 -282
- package/dist/cjs/utils/{convertNamespace.js → logic/convertNamespace.js} +1 -1
- package/dist/cjs/utils/{genJSModules.js → logic/genJSModules.js} +1 -1
- package/dist/{esm/utils → cjs/utils/logic}/handleProcess.d.ts +2 -2
- package/dist/cjs/utils/{handleProcess.js → logic/handleProcess.js} +40 -16
- package/dist/cjs/utils/logic/processChildren.d.ts +12 -0
- package/dist/cjs/utils/logic/processChildren.js +82 -0
- package/dist/cjs/utils/style/color.d.ts +4 -0
- package/dist/cjs/utils/style/color.js +45 -0
- package/dist/cjs/utils/style/converter.d.ts +7 -0
- package/dist/cjs/utils/style/converter.js +181 -0
- package/dist/cjs/utils/{getComponentClassName.js → style/getComponentClassName.js} +1 -1
- package/dist/cjs/utils/{pxtransform.js → style/pxtransform.js} +1 -1
- package/dist/cjs/utils/style/types.d.ts +23 -0
- package/dist/cjs/utils/{pageConfig → style}/types.js +1 -1
- package/dist/cjs/utils/{code → templates}/component.js +1 -1
- package/dist/cjs/utils/{code → templates}/index.js +4 -4
- package/dist/cjs/utils/{code → templates}/renderManager.js +1 -1
- package/dist/cjs/utils/{code → templates}/scene.d.ts +3 -1
- package/dist/cjs/utils/{code → templates}/scene.js +17 -5
- package/dist/esm/core/comlib/_AesEncode.js +85 -0
- package/dist/esm/core/comlib/_BackTo.js +66 -0
- package/dist/esm/core/comlib/_CallPhone.js +30 -0
- package/dist/esm/core/comlib/_ChooseFile.js +81 -0
- package/dist/esm/core/comlib/_ChooseMedia.js +38 -0
- package/dist/esm/core/comlib/_Connector.js +60 -0
- package/dist/esm/core/comlib/_ConnectorGlobalHeaders.js +56 -0
- package/dist/esm/core/comlib/_Format.js +102 -0
- package/dist/esm/core/comlib/_GetLocation.js +26 -0
- package/dist/esm/core/comlib/_GetStorage.js +44 -0
- package/dist/esm/core/comlib/_GetSystemInfo.js +32 -0
- package/dist/esm/core/comlib/_OpenCamera.js +44 -0
- package/dist/esm/core/comlib/_OpenPetalMap.js +28 -0
- package/dist/esm/core/comlib/_OpenUrl.js +36 -0
- package/dist/esm/core/comlib/_RemoveStorage.js +42 -0
- package/dist/esm/core/comlib/_Router.js +113 -0
- package/dist/esm/core/comlib/_ScanQrcode.js +10 -11
- package/dist/esm/core/comlib/_SetStorage.js +13 -25
- package/dist/esm/core/comlib/_Share.js +28 -0
- package/dist/esm/core/comlib/_ShowToast.js +32 -55
- package/dist/esm/core/comlib/_TextToSpeech.js +117 -0
- package/dist/esm/core/comlib/_TimerDebounce.js +66 -0
- package/dist/esm/core/comlib/_TimerDelay.js +47 -0
- package/dist/esm/core/comlib/_TimerThrottle.js +69 -0
- package/dist/esm/core/comlib/_Vibrate.js +34 -0
- package/dist/esm/core/comlib/index.js +37 -0
- package/dist/esm/core/mybricks/index.js +1 -1
- package/dist/esm/core/utils/ComContext.js +1 -0
- package/dist/esm/core/utils/PopupRenderer.js +27 -0
- package/dist/esm/core/utils/hooks.js +130 -0
- package/dist/esm/core/utils/index.js +8 -57
- package/dist/esm/core/utils/pageRouter.js +69 -0
- package/dist/esm/core/utils/popupRouter.js +116 -0
- package/dist/esm/core/utils/useContext.js +16 -3
- package/dist/esm/core/utils/with.js +62 -19
- package/dist/esm/generate/generateTaroProjectJson.d.ts +3 -14
- package/dist/esm/generate/generateTaroProjectJson.js +62 -24
- package/dist/esm/generate/utils/tabBarImages.d.ts +1 -1
- package/dist/esm/handleCom.d.ts +1 -1
- package/dist/esm/handleCom.js +159 -244
- package/dist/esm/handleDom.js +9 -48
- package/dist/esm/handleExtension.d.ts +2 -2
- package/dist/esm/handleExtension.js +5 -5
- package/dist/esm/handleGlobal.d.ts +2 -12
- package/dist/esm/handleGlobal.js +17 -3
- package/dist/esm/handleModule.js +3 -3
- package/dist/esm/handleSlot.d.ts +4 -9
- package/dist/esm/handleSlot.js +112 -173
- package/dist/esm/processors/processComEvents.d.ts +9 -0
- package/dist/esm/processors/processComEvents.js +167 -0
- package/dist/esm/processors/processModule.d.ts +31 -0
- package/dist/esm/processors/processModule.js +126 -0
- package/dist/esm/processors/processScene.d.ts +32 -0
- package/dist/esm/processors/processScene.js +134 -0
- package/dist/esm/processors/processSceneLogic.d.ts +4 -0
- package/dist/esm/processors/processSceneLogic.js +170 -0
- package/dist/esm/shims-taro.d.ts +20 -0
- package/dist/esm/taro-template.json +501 -351
- package/dist/esm/toCodeTaro.d.ts +27 -6
- package/dist/esm/toCodeTaro.js +110 -395
- package/dist/esm/utils/builder/buildResult.d.ts +22 -0
- package/dist/esm/utils/builder/buildResult.js +82 -0
- package/dist/esm/utils/common/ImportManager.d.ts +19 -0
- package/dist/esm/utils/common/ImportManager.js +103 -0
- package/dist/esm/utils/common/helper.d.ts +2 -0
- package/dist/esm/utils/common/helper.js +4 -0
- package/dist/esm/utils/common/object.d.ts +5 -0
- package/dist/esm/utils/common/object.js +32 -0
- package/dist/esm/utils/common/string.d.ts +8 -0
- package/dist/esm/utils/common/string.js +21 -0
- package/dist/esm/utils/config/content/pageConfig.js +40 -0
- package/dist/{cjs/utils/pageConfig → esm/utils/config/content}/saveBase64Image.d.ts +1 -1
- package/dist/esm/utils/{pageConfig → config/content}/saveBase64Image.js +11 -30
- package/dist/esm/utils/{pageConfig → config/content}/tabBarConfig.js +12 -34
- package/dist/{cjs/utils → esm/utils/config}/handlePageConfig.d.ts +3 -2
- package/dist/esm/utils/{handlePageConfig.js → config/handlePageConfig.js} +6 -2
- package/dist/esm/utils/context/buildContext.d.ts +24 -0
- package/dist/esm/utils/context/buildContext.js +53 -0
- package/dist/esm/utils/context/buildFrameMap.d.ts +16 -0
- package/dist/esm/utils/context/buildFrameMap.js +131 -0
- package/dist/esm/utils/context/buildGlobalData.d.ts +13 -0
- package/dist/esm/utils/context/buildGlobalData.js +44 -0
- package/dist/esm/utils/context/collectJSModules.d.ts +37 -0
- package/dist/esm/utils/context/collectJSModules.js +87 -0
- package/dist/esm/utils/context/createEventQueries.d.ts +45 -0
- package/dist/esm/utils/context/createEventQueries.js +99 -0
- package/dist/esm/utils/context/createProvider.d.ts +21 -0
- package/dist/esm/utils/context/createProvider.js +33 -0
- package/dist/esm/utils/index.d.ts +10 -62
- package/dist/esm/utils/index.js +12 -345
- package/dist/{cjs/utils → esm/utils/logic}/handleProcess.d.ts +2 -2
- package/dist/esm/utils/{handleProcess.js → logic/handleProcess.js} +42 -9
- package/dist/esm/utils/logic/processChildren.d.ts +12 -0
- package/dist/esm/utils/logic/processChildren.js +48 -0
- package/dist/esm/utils/style/color.d.ts +4 -0
- package/dist/esm/utils/style/color.js +17 -0
- package/dist/esm/utils/style/converter.d.ts +7 -0
- package/dist/esm/utils/style/converter.js +176 -0
- package/dist/esm/utils/style/types.d.ts +23 -0
- package/dist/esm/utils/style/types.js +1 -0
- package/dist/esm/utils/{code → templates}/scene.d.ts +3 -1
- package/dist/esm/utils/{code → templates}/scene.js +13 -5
- package/package.json +4 -2
- package/dist/esm/core/comlib/Index.js +0 -3
- package/dist/esm/utils/pageConfig/pageConfig.js +0 -60
- /package/dist/cjs/utils/{pageConfig → config/content}/converter.d.ts +0 -0
- /package/dist/cjs/utils/{pageConfig → config/content}/index.d.ts +0 -0
- /package/dist/cjs/utils/{pageConfig → config/content}/pageConfig.d.ts +0 -0
- /package/dist/cjs/utils/{pageConfig → config/content}/tabBarConfig.d.ts +0 -0
- /package/dist/cjs/utils/{pageConfig → config/content}/types.d.ts +0 -0
- /package/dist/cjs/utils/{pageConfig → config/content}/validator.d.ts +0 -0
- /package/dist/cjs/utils/{convertNamespace.d.ts → logic/convertNamespace.d.ts} +0 -0
- /package/dist/cjs/utils/{genJSModules.d.ts → logic/genJSModules.d.ts} +0 -0
- /package/dist/cjs/utils/{getComponentClassName.d.ts → style/getComponentClassName.d.ts} +0 -0
- /package/dist/cjs/utils/{pxtransform.d.ts → style/pxtransform.d.ts} +0 -0
- /package/dist/cjs/utils/{code → templates}/component.d.ts +0 -0
- /package/dist/cjs/utils/{code → templates}/index.d.ts +0 -0
- /package/dist/cjs/utils/{code → templates}/renderManager.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/converter.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/converter.js +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/index.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/index.js +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/pageConfig.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/tabBarConfig.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/types.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/types.js +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/validator.d.ts +0 -0
- /package/dist/esm/utils/{pageConfig → config/content}/validator.js +0 -0
- /package/dist/esm/utils/{convertNamespace.d.ts → logic/convertNamespace.d.ts} +0 -0
- /package/dist/esm/utils/{convertNamespace.js → logic/convertNamespace.js} +0 -0
- /package/dist/esm/utils/{genJSModules.d.ts → logic/genJSModules.d.ts} +0 -0
- /package/dist/esm/utils/{genJSModules.js → logic/genJSModules.js} +0 -0
- /package/dist/esm/utils/{getComponentClassName.d.ts → style/getComponentClassName.d.ts} +0 -0
- /package/dist/esm/utils/{getComponentClassName.js → style/getComponentClassName.js} +0 -0
- /package/dist/esm/utils/{pxtransform.d.ts → style/pxtransform.d.ts} +0 -0
- /package/dist/esm/utils/{pxtransform.js → style/pxtransform.js} +0 -0
- /package/dist/esm/utils/{code → templates}/component.d.ts +0 -0
- /package/dist/esm/utils/{code → templates}/component.js +0 -0
- /package/dist/esm/utils/{code → templates}/index.d.ts +0 -0
- /package/dist/esm/utils/{code → templates}/index.js +0 -0
- /package/dist/esm/utils/{code → templates}/renderManager.d.ts +0 -0
- /package/dist/esm/utils/{code → templates}/renderManager.js +0 -0
|
@@ -38,23 +38,22 @@ var ScanQrcode_default = (context) => {
|
|
|
38
38
|
const data = context.data;
|
|
39
39
|
const inputs = context.inputs;
|
|
40
40
|
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs
|
|
41
|
+
(_a = inputs.scan) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
42
|
try {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onlyFromCamera,
|
|
47
|
-
scanType,
|
|
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"],
|
|
48
46
|
success: (res) => {
|
|
49
|
-
outputs
|
|
47
|
+
outputs.onSuccess(res.result || res);
|
|
50
48
|
},
|
|
51
49
|
fail: (err) => {
|
|
52
|
-
outputs
|
|
50
|
+
outputs.onFail(err.errMsg || "扫码失败");
|
|
53
51
|
}
|
|
54
|
-
}
|
|
52
|
+
};
|
|
53
|
+
import_taro.default.scanCode(scanConfig);
|
|
55
54
|
} catch (error) {
|
|
56
55
|
console.error("扫码失败:", error);
|
|
57
|
-
outputs
|
|
56
|
+
outputs.onFail((error == null ? void 0 : error.message) || "扫码失败");
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
59
|
};
|
|
@@ -40,37 +40,28 @@ var SetStorage_default = (context) => {
|
|
|
40
40
|
const outputs = context.outputs;
|
|
41
41
|
(_a = inputs.setStorage) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
42
|
try {
|
|
43
|
-
const key = (val == null ? void 0 : val.key) ||
|
|
44
|
-
const value = (val == null ? void 0 : val.value) !== void 0 ? val.value : data
|
|
45
|
-
const useSync = (val == null ? void 0 : val.sync) !== void 0 ? val.sync :
|
|
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
46
|
if (!key) {
|
|
47
|
-
outputs
|
|
47
|
+
outputs.onFail("存储 key 不能为空");
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
+
const result = { key, value };
|
|
50
51
|
if (useSync) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
outputs == null ? void 0 : outputs.onSuccess({ key, value });
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error("写入本地缓存失败:", error);
|
|
56
|
-
outputs == null ? void 0 : outputs.onFail((error == null ? void 0 : error.message) || "写入本地缓存失败");
|
|
57
|
-
}
|
|
52
|
+
import_taro.default.setStorageSync(key, value);
|
|
53
|
+
outputs.onSuccess(result);
|
|
58
54
|
} else {
|
|
59
55
|
import_taro.default.setStorage({
|
|
60
56
|
key,
|
|
61
57
|
data: value,
|
|
62
|
-
success: () =>
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
fail: (err) => {
|
|
66
|
-
console.error("写入本地缓存失败:", err);
|
|
67
|
-
outputs == null ? void 0 : outputs.onFail(err.errMsg || "写入本地缓存失败");
|
|
68
|
-
}
|
|
58
|
+
success: () => outputs.onSuccess(result),
|
|
59
|
+
fail: (err) => outputs.onFail(err.errMsg || "写入本地缓存失败")
|
|
69
60
|
});
|
|
70
61
|
}
|
|
71
62
|
} catch (error) {
|
|
72
63
|
console.error("写入本地缓存失败:", error);
|
|
73
|
-
outputs
|
|
64
|
+
outputs.onFail((error == null ? void 0 : error.message) || "写入本地缓存失败");
|
|
74
65
|
}
|
|
75
66
|
});
|
|
76
67
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
};
|
|
@@ -39,58 +39,31 @@ var ShowToast_default = (context) => {
|
|
|
39
39
|
const inputs = context.inputs;
|
|
40
40
|
const outputs = context.outputs;
|
|
41
41
|
(_a = inputs.showToast) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
toastConfig.icon = data.icon;
|
|
53
|
-
}
|
|
54
|
-
if (val && typeof val === "object" && val.image) {
|
|
55
|
-
toastConfig.image = val.image;
|
|
56
|
-
} else if (data.image) {
|
|
57
|
-
toastConfig.image = data.image;
|
|
58
|
-
}
|
|
59
|
-
import_taro.default.showToast(toastConfig);
|
|
60
|
-
if (data.asynchronous) {
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
outputs.afterShowToast(val);
|
|
63
|
-
}, Number(val && typeof val === "object" ? (val == null ? void 0 : val.duration) ?? data.duration ?? 1e3 : data.duration ?? 1e3));
|
|
64
|
-
} else {
|
|
65
|
-
outputs.afterShowToast(val);
|
|
66
|
-
}
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("显示 Toast 失败:", error);
|
|
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;
|
|
69
52
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
duration: Number(data.duration || 1e3),
|
|
75
|
-
mask: data.mask ?? false
|
|
76
|
-
};
|
|
77
|
-
if (data.icon) {
|
|
78
|
-
toastConfig.icon = data.icon;
|
|
79
|
-
}
|
|
80
|
-
if (data.image) {
|
|
81
|
-
toastConfig.image = data.image;
|
|
82
|
-
}
|
|
83
|
-
import_taro.default.showToast(toastConfig);
|
|
84
|
-
if (data.asynchronous) {
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
outputs.afterShowToast(val);
|
|
87
|
-
}, Number(data.duration || 1e3));
|
|
88
|
-
} else {
|
|
89
|
-
outputs.afterShowToast(val);
|
|
90
|
-
}
|
|
91
|
-
} catch (error) {
|
|
92
|
-
console.error("显示 Toast 失败:", error);
|
|
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;
|
|
93
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);
|
|
94
67
|
}
|
|
95
68
|
});
|
|
96
69
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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;
|
|
27
|
+
const data = context.data;
|
|
28
|
+
const inputs = context.inputs;
|
|
29
|
+
const outputs = context.outputs;
|
|
30
|
+
let timeoutId = null;
|
|
31
|
+
(_a = inputs.delay) == null ? void 0 : _a.call(inputs, (val) => {
|
|
32
|
+
try {
|
|
33
|
+
const delay = (val == null ? void 0 : val.delay) || data.delay || 1e3;
|
|
34
|
+
if (timeoutId) {
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
}
|
|
37
|
+
outputs.onStart({ delay, timestamp: Date.now() });
|
|
38
|
+
timeoutId = setTimeout(() => {
|
|
39
|
+
outputs.onExecute({ delay, timestamp: Date.now() });
|
|
40
|
+
timeoutId = null;
|
|
41
|
+
}, delay);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error("延迟执行失败:", error);
|
|
44
|
+
if (timeoutId) {
|
|
45
|
+
clearTimeout(timeoutId);
|
|
46
|
+
timeoutId = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
(_b = inputs.cancel) == null ? void 0 : _b.call(inputs, () => {
|
|
51
|
+
try {
|
|
52
|
+
if (timeoutId) {
|
|
53
|
+
clearTimeout(timeoutId);
|
|
54
|
+
timeoutId = null;
|
|
55
|
+
outputs.onCancel("延迟任务已取消");
|
|
56
|
+
} else {
|
|
57
|
+
outputs.onCancel("没有正在执行的延迟任务");
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("取消延迟失败:", error);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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/_TimerThrottle.ts
|
|
20
|
+
var TimerThrottle_exports = {};
|
|
21
|
+
__export(TimerThrottle_exports, {
|
|
22
|
+
default: () => TimerThrottle_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(TimerThrottle_exports);
|
|
25
|
+
function throttle(func, delay, options = {}) {
|
|
26
|
+
let timeoutId = null;
|
|
27
|
+
let lastExecTime = 0;
|
|
28
|
+
const { leading = true, trailing = true } = options;
|
|
29
|
+
return function(...args) {
|
|
30
|
+
const currentTime = Date.now();
|
|
31
|
+
if (currentTime - lastExecTime > delay) {
|
|
32
|
+
if (leading) {
|
|
33
|
+
func.apply(null, args);
|
|
34
|
+
lastExecTime = currentTime;
|
|
35
|
+
}
|
|
36
|
+
if (timeoutId) {
|
|
37
|
+
clearTimeout(timeoutId);
|
|
38
|
+
timeoutId = null;
|
|
39
|
+
}
|
|
40
|
+
} else if (trailing && !timeoutId) {
|
|
41
|
+
timeoutId = setTimeout(() => {
|
|
42
|
+
func.apply(null, args);
|
|
43
|
+
lastExecTime = Date.now();
|
|
44
|
+
timeoutId = null;
|
|
45
|
+
}, delay - (currentTime - lastExecTime));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
var TimerThrottle_default = (context) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const data = context.data;
|
|
52
|
+
const inputs = context.inputs;
|
|
53
|
+
const outputs = context.outputs;
|
|
54
|
+
let throttledFn = null;
|
|
55
|
+
(_a = inputs.throttle) == null ? void 0 : _a.call(inputs, (val) => {
|
|
56
|
+
try {
|
|
57
|
+
const interval = (val == null ? void 0 : val.interval) || data.interval || 1e3;
|
|
58
|
+
const leading = (val == null ? void 0 : val.leading) !== void 0 ? val.leading : data.leading || true;
|
|
59
|
+
const trailing = (val == null ? void 0 : val.trailing) !== void 0 ? val.trailing : data.trailing || true;
|
|
60
|
+
if (!throttledFn) {
|
|
61
|
+
throttledFn = throttle(
|
|
62
|
+
() => {
|
|
63
|
+
outputs.onExecute({ interval, leading, trailing, timestamp: Date.now() });
|
|
64
|
+
},
|
|
65
|
+
interval,
|
|
66
|
+
{ leading, trailing }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
throttledFn();
|
|
70
|
+
outputs.onComplete({ interval, leading, trailing });
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("节流执行失败:", error);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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/_Vibrate.ts
|
|
30
|
+
var Vibrate_exports = {};
|
|
31
|
+
__export(Vibrate_exports, {
|
|
32
|
+
default: () => Vibrate_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Vibrate_exports);
|
|
35
|
+
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
+
var Vibrate_default = (context) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const data = context.data;
|
|
39
|
+
const inputs = context.inputs;
|
|
40
|
+
const outputs = context.outputs;
|
|
41
|
+
(_a = inputs.vibrate) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
+
try {
|
|
43
|
+
const type = (val == null ? void 0 : val.type) || data.type || "short";
|
|
44
|
+
if (type === "long") {
|
|
45
|
+
import_taro.default.vibrateLong({
|
|
46
|
+
success: () => outputs.onSuccess("长振动成功"),
|
|
47
|
+
fail: (err) => outputs.onFail(err.errMsg || "长振动失败")
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
import_taro.default.vibrateShort({
|
|
51
|
+
success: () => outputs.onSuccess("短振动成功"),
|
|
52
|
+
fail: (err) => outputs.onFail(err.errMsg || "短振动失败")
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("设备振动失败:", error);
|
|
57
|
+
outputs.onFail((error == null ? void 0 : error.message) || "设备振动失败");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|