@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
|
@@ -0,0 +1,105 @@
|
|
|
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/utils/common/ImportManager.ts
|
|
20
|
+
var ImportManager_exports = {};
|
|
21
|
+
__export(ImportManager_exports, {
|
|
22
|
+
ImportManager: () => ImportManager
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ImportManager_exports);
|
|
25
|
+
var import_helper = require("./helper");
|
|
26
|
+
var ImportManager = class {
|
|
27
|
+
constructor(_config) {
|
|
28
|
+
this._config = _config;
|
|
29
|
+
this._imports = {};
|
|
30
|
+
}
|
|
31
|
+
/** 添加依赖 */
|
|
32
|
+
addImport({
|
|
33
|
+
packageName,
|
|
34
|
+
dependencyNames,
|
|
35
|
+
importType
|
|
36
|
+
}) {
|
|
37
|
+
if (!packageName) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { _imports } = this;
|
|
41
|
+
if (!_imports[packageName]) {
|
|
42
|
+
_imports[packageName] = {};
|
|
43
|
+
}
|
|
44
|
+
if (importType === "module" && dependencyNames.length === 0) {
|
|
45
|
+
_imports[packageName]["__module__"] = {
|
|
46
|
+
importType: "module"
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
dependencyNames.forEach((dependencyName) => {
|
|
50
|
+
_imports[packageName][dependencyName] = {
|
|
51
|
+
importType
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** 依赖解析为code */
|
|
57
|
+
toCode() {
|
|
58
|
+
const indent = (0, import_helper.indentation)(this._config.codeStyle.indent);
|
|
59
|
+
return Object.entries(this._imports).reduce(
|
|
60
|
+
(pre, [packageName, dependencies]) => {
|
|
61
|
+
var _a;
|
|
62
|
+
let defaultDependency = "";
|
|
63
|
+
let namedDependencies = "";
|
|
64
|
+
const dependencyEntries = Object.entries(dependencies);
|
|
65
|
+
const hasModuleType = ((_a = dependencies["__module__"]) == null ? void 0 : _a.importType) === "module" || dependencyEntries.some(([, { importType }]) => importType === "module");
|
|
66
|
+
if (hasModuleType) {
|
|
67
|
+
return pre + `import '${packageName}';
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
const validEntries = dependencyEntries.filter(([key]) => key !== "__module__");
|
|
71
|
+
const wrap = validEntries.length > 3;
|
|
72
|
+
validEntries.forEach(([dependencyName, { importType }], index) => {
|
|
73
|
+
if (importType === "default") {
|
|
74
|
+
defaultDependency = dependencyName;
|
|
75
|
+
} else if (importType === "named") {
|
|
76
|
+
if (wrap) {
|
|
77
|
+
namedDependencies += `${indent}${dependencyName},
|
|
78
|
+
`;
|
|
79
|
+
} else {
|
|
80
|
+
namedDependencies += `${index ? ", " : ""}${dependencyName}`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (namedDependencies) {
|
|
85
|
+
if (wrap) {
|
|
86
|
+
namedDependencies = `{
|
|
87
|
+
${namedDependencies}}`;
|
|
88
|
+
} else {
|
|
89
|
+
namedDependencies = `{ ${namedDependencies} }`;
|
|
90
|
+
}
|
|
91
|
+
if (defaultDependency) {
|
|
92
|
+
defaultDependency += ", ";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return pre + `import ${defaultDependency}${namedDependencies} from '${packageName}';
|
|
96
|
+
`;
|
|
97
|
+
},
|
|
98
|
+
""
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
ImportManager
|
|
105
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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/utils/common/helper.ts
|
|
20
|
+
var helper_exports = {};
|
|
21
|
+
__export(helper_exports, {
|
|
22
|
+
indentation: () => indentation
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(helper_exports);
|
|
25
|
+
var indentation = (level) => {
|
|
26
|
+
return " ".repeat(level);
|
|
27
|
+
};
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
indentation
|
|
31
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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/utils/common/object.ts
|
|
20
|
+
var object_exports = {};
|
|
21
|
+
__export(object_exports, {
|
|
22
|
+
genObjectCode: () => genObjectCode
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(object_exports);
|
|
25
|
+
var import_helper = require("./helper");
|
|
26
|
+
var genObjectCode = (object, config) => {
|
|
27
|
+
const { initialIndent, indentSize } = config;
|
|
28
|
+
const keys = Object.keys(object);
|
|
29
|
+
if (keys.length === 0)
|
|
30
|
+
return "{}";
|
|
31
|
+
let result = "{\n";
|
|
32
|
+
keys.forEach((key, idx) => {
|
|
33
|
+
const value = object[key];
|
|
34
|
+
let formattedValue;
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
formattedValue = JSON.stringify(value);
|
|
37
|
+
} else if (value && typeof value === "object") {
|
|
38
|
+
formattedValue = genObjectCode(value, {
|
|
39
|
+
initialIndent: initialIndent + indentSize,
|
|
40
|
+
indentSize
|
|
41
|
+
});
|
|
42
|
+
} else if (typeof value === "string") {
|
|
43
|
+
formattedValue = JSON.stringify(value);
|
|
44
|
+
} else {
|
|
45
|
+
formattedValue = String(value);
|
|
46
|
+
}
|
|
47
|
+
result += (0, import_helper.indentation)(initialIndent + indentSize) + `${JSON.stringify(key)}: ${formattedValue}`;
|
|
48
|
+
if (idx < keys.length - 1)
|
|
49
|
+
result += ",";
|
|
50
|
+
result += "\n";
|
|
51
|
+
});
|
|
52
|
+
result += (0, import_helper.indentation)(initialIndent) + "}";
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
genObjectCode
|
|
58
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** 将第一个字符转大写 */
|
|
2
|
+
export declare const firstCharToUpperCase: (str: string) => string;
|
|
3
|
+
/** 将第一个字符转小写 */
|
|
4
|
+
export declare const firstCharToLowerCase: (str: string) => string;
|
|
5
|
+
/** 驼峰转中划线 */
|
|
6
|
+
export declare const camelToKebab: (str: string) => string;
|
|
7
|
+
/** 中划线转驼峰 */
|
|
8
|
+
export declare const kebabToCamel: (str: string) => string;
|
|
@@ -0,0 +1,46 @@
|
|
|
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/utils/common/string.ts
|
|
20
|
+
var string_exports = {};
|
|
21
|
+
__export(string_exports, {
|
|
22
|
+
camelToKebab: () => camelToKebab,
|
|
23
|
+
firstCharToLowerCase: () => firstCharToLowerCase,
|
|
24
|
+
firstCharToUpperCase: () => firstCharToUpperCase,
|
|
25
|
+
kebabToCamel: () => kebabToCamel
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(string_exports);
|
|
28
|
+
var firstCharToUpperCase = (str) => {
|
|
29
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
30
|
+
};
|
|
31
|
+
var firstCharToLowerCase = (str) => {
|
|
32
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
33
|
+
};
|
|
34
|
+
var camelToKebab = (str) => {
|
|
35
|
+
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
36
|
+
};
|
|
37
|
+
var kebabToCamel = (str) => {
|
|
38
|
+
return str.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
camelToKebab,
|
|
43
|
+
firstCharToLowerCase,
|
|
44
|
+
firstCharToUpperCase,
|
|
45
|
+
kebabToCamel
|
|
46
|
+
});
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/
|
|
19
|
+
// src/utils/config/content/converter.ts
|
|
20
20
|
var converter_exports = {};
|
|
21
21
|
__export(converter_exports, {
|
|
22
22
|
convertToTaroTabBarConfig: () => convertToTaroTabBarConfig,
|
|
@@ -13,15 +13,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
|
|
16
|
-
// src/utils/
|
|
17
|
-
var
|
|
18
|
-
module.exports = __toCommonJS(
|
|
19
|
-
__reExport(
|
|
20
|
-
__reExport(
|
|
21
|
-
__reExport(
|
|
22
|
-
__reExport(
|
|
23
|
-
__reExport(
|
|
24
|
-
__reExport(
|
|
16
|
+
// src/utils/config/content/index.ts
|
|
17
|
+
var content_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(content_exports);
|
|
19
|
+
__reExport(content_exports, require("./types"), module.exports);
|
|
20
|
+
__reExport(content_exports, require("./validator"), module.exports);
|
|
21
|
+
__reExport(content_exports, require("./converter"), module.exports);
|
|
22
|
+
__reExport(content_exports, require("./pageConfig"), module.exports);
|
|
23
|
+
__reExport(content_exports, require("./tabBarConfig"), module.exports);
|
|
24
|
+
__reExport(content_exports, require("./saveBase64Image"), module.exports);
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
...require("./types"),
|
|
@@ -16,12 +16,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/
|
|
19
|
+
// src/utils/config/content/pageConfig.ts
|
|
20
20
|
var pageConfig_exports = {};
|
|
21
21
|
__export(pageConfig_exports, {
|
|
22
22
|
generatePageConfigContent: () => generatePageConfigContent
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(pageConfig_exports);
|
|
25
|
+
var import__ = require("../../index");
|
|
25
26
|
var TARO_NAVIGATION_BAR_PROPERTIES = [
|
|
26
27
|
"navigationBarBackgroundColor",
|
|
27
28
|
"navigationBarTextStyle",
|
|
@@ -51,34 +52,23 @@ var TARO_PAGE_CONFIG_TEMPLATE_PROPERTIES = [
|
|
|
51
52
|
function generatePageConfigContent(systemPageData) {
|
|
52
53
|
const pageConfig = {};
|
|
53
54
|
if (systemPageData) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (useNavigationStyle === "default") {
|
|
57
|
-
propertiesToUse = TARO_NAVIGATION_BAR_PROPERTIES;
|
|
58
|
-
} else {
|
|
59
|
-
propertiesToUse = TARO_PAGE_CONFIG_TEMPLATE_PROPERTIES;
|
|
55
|
+
if (systemPageData.useNavigationStyle === "none") {
|
|
56
|
+
pageConfig.navigationStyle = "custom";
|
|
60
57
|
}
|
|
58
|
+
const propertiesToUse = systemPageData.useNavigationStyle === "default" ? TARO_NAVIGATION_BAR_PROPERTIES : TARO_PAGE_CONFIG_TEMPLATE_PROPERTIES;
|
|
61
59
|
propertiesToUse.forEach((prop) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
} else if (typeof value === "boolean" || typeof value === "number") {
|
|
67
|
-
pageConfig[prop] = value;
|
|
68
|
-
} else if (typeof value === "object") {
|
|
69
|
-
pageConfig[prop] = JSON.stringify(value);
|
|
60
|
+
let value = systemPageData[prop];
|
|
61
|
+
if (value !== void 0 && value !== null) {
|
|
62
|
+
if (prop.includes("BackgroundColor") || prop === "backgroundColor" || prop === "backgroundColorTop" || prop === "backgroundColorBottom") {
|
|
63
|
+
value = (0, import__.colorToHex)(value);
|
|
70
64
|
}
|
|
65
|
+
pageConfig[prop] = value;
|
|
71
66
|
}
|
|
72
67
|
});
|
|
73
68
|
}
|
|
74
|
-
|
|
75
|
-
pageConfig.navigationBarTitleText = `'页面'`;
|
|
76
|
-
}
|
|
77
|
-
const configLines = Object.entries(pageConfig).map(([key, value]) => {
|
|
78
|
-
return ` ${key}: ${value}`;
|
|
79
|
-
});
|
|
69
|
+
const configContent = JSON.stringify(pageConfig, null, 2).replace(/^\{/, "").replace(/\}$/, "").trim();
|
|
80
70
|
return `export default definePageConfig({
|
|
81
|
-
${
|
|
71
|
+
${configContent}
|
|
82
72
|
})`;
|
|
83
73
|
}
|
|
84
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -11,4 +11,4 @@ import type { ImageFileInfo } from './types';
|
|
|
11
11
|
* @param imageFiles 用于收集需要保存的图片文件的数组(可选)
|
|
12
12
|
* @returns 处理后的图标路径(用于 app.config.ts),如果不是 base64 则返回原路径
|
|
13
13
|
*/
|
|
14
|
-
export declare function processTabBarIcon(iconPath: string | undefined, tabBarIndex: number, type:
|
|
14
|
+
export declare function processTabBarIcon(iconPath: string | undefined, tabBarIndex: number, type: "normal" | "selected", imageFiles?: ImageFileInfo[]): string | undefined;
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/
|
|
19
|
+
// src/utils/config/content/saveBase64Image.ts
|
|
20
20
|
var saveBase64Image_exports = {};
|
|
21
21
|
__export(saveBase64Image_exports, {
|
|
22
22
|
processTabBarIcon: () => processTabBarIcon
|
|
@@ -31,42 +31,33 @@ var MIME_TO_EXT = {
|
|
|
31
31
|
svg: "svg"
|
|
32
32
|
};
|
|
33
33
|
function parseBase64Image(base64Str) {
|
|
34
|
-
if (typeof base64Str !== "string"
|
|
34
|
+
if (typeof base64Str !== "string")
|
|
35
35
|
return null;
|
|
36
|
-
}
|
|
37
36
|
const match = base64Str.match(/^data:image\/([^;]+);base64,(.+)$/);
|
|
38
|
-
if (!match)
|
|
37
|
+
if (!match)
|
|
39
38
|
return null;
|
|
40
|
-
}
|
|
41
39
|
return {
|
|
42
40
|
mimeType: match[1],
|
|
43
41
|
base64Data: match[2]
|
|
44
42
|
};
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
function generateFileName(index, type, extension) {
|
|
50
|
-
return `tabbar_${index}_${type}.${extension}`;
|
|
51
|
-
}
|
|
44
|
+
var getFileExtension = (mimeType) => MIME_TO_EXT[mimeType.toLowerCase()] ?? "png";
|
|
45
|
+
var generateFileName = (index, type, extension) => `tabbar_${index}_${type}.${extension}`;
|
|
52
46
|
function processTabBarIcon(iconPath, tabBarIndex, type, imageFiles) {
|
|
53
|
-
if (!iconPath)
|
|
47
|
+
if (!iconPath)
|
|
54
48
|
return void 0;
|
|
55
|
-
}
|
|
56
49
|
const parsed = parseBase64Image(iconPath);
|
|
57
|
-
if (!parsed)
|
|
50
|
+
if (!parsed)
|
|
58
51
|
return iconPath;
|
|
59
|
-
}
|
|
60
52
|
const extension = getFileExtension(parsed.mimeType);
|
|
61
53
|
const fileName = generateFileName(tabBarIndex, type, extension);
|
|
62
54
|
const fileSystemPath = `src/assets/tabbar/${fileName}`;
|
|
63
55
|
const configPath = `assets/tabbar/${fileName}`;
|
|
64
56
|
if (imageFiles) {
|
|
65
57
|
try {
|
|
66
|
-
const imageBuffer = Buffer.from(parsed.base64Data, "base64");
|
|
67
58
|
imageFiles.push({
|
|
68
59
|
filePath: fileSystemPath,
|
|
69
|
-
fileContent:
|
|
60
|
+
fileContent: Buffer.from(parsed.base64Data, "base64")
|
|
70
61
|
});
|
|
71
62
|
} catch (error) {
|
|
72
63
|
console.error(`处理 TabBar 图标失败: ${error}`);
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/
|
|
19
|
+
// src/utils/config/content/tabBarConfig.ts
|
|
20
20
|
var tabBarConfig_exports = {};
|
|
21
21
|
__export(tabBarConfig_exports, {
|
|
22
22
|
generateTabBarConfigContent: () => generateTabBarConfigContent
|
|
@@ -36,37 +36,14 @@ function generateTabBarConfigContent(tabBar, pageIdToPath = (pageId) => `pages/$
|
|
|
36
36
|
return formatTabBarConfigForAppConfig(config);
|
|
37
37
|
}
|
|
38
38
|
function formatTabBarConfigForAppConfig(config, indent = " ") {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (config.backgroundColor) {
|
|
48
|
-
lines.push(`${indent} backgroundColor: '${config.backgroundColor}',`);
|
|
49
|
-
}
|
|
50
|
-
if (config.borderStyle) {
|
|
51
|
-
lines.push(`${indent} borderStyle: '${config.borderStyle}',`);
|
|
52
|
-
}
|
|
53
|
-
lines.push(`${indent} list: [`);
|
|
54
|
-
config.list.forEach((item, index) => {
|
|
55
|
-
const isLast = index === config.list.length - 1;
|
|
56
|
-
lines.push(`${indent} {`);
|
|
57
|
-
lines.push(`${indent} pagePath: '${item.pagePath}',`);
|
|
58
|
-
lines.push(`${indent} text: '${item.text}',`);
|
|
59
|
-
if (item.iconPath) {
|
|
60
|
-
lines.push(`${indent} iconPath: '${item.iconPath}',`);
|
|
61
|
-
}
|
|
62
|
-
if (item.selectedIconPath) {
|
|
63
|
-
lines.push(`${indent} selectedIconPath: '${item.selectedIconPath}',`);
|
|
64
|
-
}
|
|
65
|
-
lines.push(`${indent} }${isLast ? "" : ","}`);
|
|
66
|
-
});
|
|
67
|
-
lines.push(`${indent} ]`);
|
|
68
|
-
lines.push(`${indent}}`);
|
|
69
|
-
return lines.join("\n");
|
|
39
|
+
const tabBarJson = JSON.stringify(config, null, 2);
|
|
40
|
+
const formattedJson = tabBarJson.replace(/"([^"]+)":/g, "$1:").replace(/"/g, "'");
|
|
41
|
+
const lines = formattedJson.split("\n");
|
|
42
|
+
return lines.map((line, index) => {
|
|
43
|
+
if (index === 0)
|
|
44
|
+
return `${indent}tabBar: ${line}`;
|
|
45
|
+
return `${indent}${line}`;
|
|
46
|
+
}).join("\n");
|
|
70
47
|
}
|
|
71
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
72
49
|
0 && (module.exports = {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/utils/config/content/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/
|
|
19
|
+
// src/utils/config/content/validator.ts
|
|
20
20
|
var validator_exports = {};
|
|
21
21
|
__export(validator_exports, {
|
|
22
22
|
shouldUseTabBar: () => shouldUseTabBar,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import toCode from "@mybricks/to-code-react/dist/cjs/toCode";
|
|
2
|
-
import { type ImageFileInfo } from "./
|
|
2
|
+
import { type ImageFileInfo } from "./content";
|
|
3
3
|
/**
|
|
4
4
|
* 处理页面配置的类
|
|
5
5
|
* 负责提取 systemPage 组件数据,生成页面配置和 TabBar 配置
|
|
@@ -10,9 +10,10 @@ export declare class HandlePageConfig {
|
|
|
10
10
|
/**
|
|
11
11
|
* 处理页面配置(提取 systemPage 组件数据)
|
|
12
12
|
* @param scene 场景数据
|
|
13
|
+
* @param isPopup 是否为弹窗场景
|
|
13
14
|
* @returns 页面配置内容
|
|
14
15
|
*/
|
|
15
|
-
handle(scene: ReturnType<typeof toCode>["scenes"][0]["scene"]): string | undefined;
|
|
16
|
+
handle(scene: ReturnType<typeof toCode>["scenes"][0]["scene"], isPopup?: boolean): string | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* 获取全局 TabBar 配置
|
|
18
19
|
*/
|
|
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// src/utils/handlePageConfig.ts
|
|
19
|
+
// src/utils/config/handlePageConfig.ts
|
|
20
20
|
var handlePageConfig_exports = {};
|
|
21
21
|
__export(handlePageConfig_exports, {
|
|
22
22
|
HandlePageConfig: () => HandlePageConfig
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(handlePageConfig_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_content = require("./content");
|
|
26
26
|
var HandlePageConfig = class {
|
|
27
27
|
constructor() {
|
|
28
28
|
this.globalTabBarConfig = null;
|
|
@@ -31,9 +31,10 @@ var HandlePageConfig = class {
|
|
|
31
31
|
/**
|
|
32
32
|
* 处理页面配置(提取 systemPage 组件数据)
|
|
33
33
|
* @param scene 场景数据
|
|
34
|
+
* @param isPopup 是否为弹窗场景
|
|
34
35
|
* @returns 页面配置内容
|
|
35
36
|
*/
|
|
36
|
-
handle(scene) {
|
|
37
|
+
handle(scene, isPopup = false) {
|
|
37
38
|
var _a;
|
|
38
39
|
let pageConfigContent;
|
|
39
40
|
const systemPageCom = Object.values(scene.coms || {}).find((com) => {
|
|
@@ -41,11 +42,11 @@ var HandlePageConfig = class {
|
|
|
41
42
|
return ((_a2 = com.def) == null ? void 0 : _a2.namespace) === "mybricks.taro.systemPage";
|
|
42
43
|
});
|
|
43
44
|
if ((_a = systemPageCom == null ? void 0 : systemPageCom.model) == null ? void 0 : _a.data) {
|
|
44
|
-
const systemPageData = systemPageCom.model.data;
|
|
45
|
-
pageConfigContent = (0,
|
|
45
|
+
const systemPageData = { ...systemPageCom.model.data };
|
|
46
|
+
pageConfigContent = (0, import_content.generatePageConfigContent)(systemPageData);
|
|
46
47
|
if (!this.globalTabBarConfig && systemPageData.tabBar && Array.isArray(systemPageData.tabBar)) {
|
|
47
48
|
const pageIdToPath = (pageId) => `pages/${pageId}/index`;
|
|
48
|
-
this.globalTabBarConfig = (0,
|
|
49
|
+
this.globalTabBarConfig = (0, import_content.generateTabBarConfigContent)(
|
|
49
50
|
systemPageData.tabBar,
|
|
50
51
|
pageIdToPath,
|
|
51
52
|
this.tabBarImageFiles
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 构建上下文数据
|
|
3
|
+
* 包括 sceneMap, eventsMap 等查询映射
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 构建场景映射表
|
|
7
|
+
*/
|
|
8
|
+
export declare const buildSceneMap: (scenes: any[]) => any;
|
|
9
|
+
/**
|
|
10
|
+
* 构建扩展事件映射表
|
|
11
|
+
*/
|
|
12
|
+
export declare const buildEventsMap: (frames: any[]) => any;
|
|
13
|
+
/**
|
|
14
|
+
* 创建场景查询函数
|
|
15
|
+
*/
|
|
16
|
+
export declare const createGetSceneById: (sceneMap: Record<string, any>) => (id: string) => any;
|
|
17
|
+
/**
|
|
18
|
+
* 创建扩展事件查询函数
|
|
19
|
+
*/
|
|
20
|
+
export declare const createGetExtensionEventById: (eventsMap: Record<string, any>) => (id: string) => any;
|
|
21
|
+
/**
|
|
22
|
+
* 创建 frame 查询函数
|
|
23
|
+
*/
|
|
24
|
+
export declare const createGetFrameById: (frameMap: Record<string, any>) => (id: string) => any;
|
|
@@ -0,0 +1,65 @@
|
|
|
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/utils/context/buildContext.ts
|
|
20
|
+
var buildContext_exports = {};
|
|
21
|
+
__export(buildContext_exports, {
|
|
22
|
+
buildEventsMap: () => buildEventsMap,
|
|
23
|
+
buildSceneMap: () => buildSceneMap,
|
|
24
|
+
createGetExtensionEventById: () => createGetExtensionEventById,
|
|
25
|
+
createGetFrameById: () => createGetFrameById,
|
|
26
|
+
createGetSceneById: () => createGetSceneById
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(buildContext_exports);
|
|
29
|
+
var buildSceneMap = (scenes) => {
|
|
30
|
+
return scenes.reduce((pre, cur) => {
|
|
31
|
+
pre[cur.id] = cur;
|
|
32
|
+
return pre;
|
|
33
|
+
}, {});
|
|
34
|
+
};
|
|
35
|
+
var buildEventsMap = (frames) => {
|
|
36
|
+
return frames.reduce((pre, cur) => {
|
|
37
|
+
if (cur.type === "extension-event") {
|
|
38
|
+
pre[cur.id] = cur;
|
|
39
|
+
}
|
|
40
|
+
return pre;
|
|
41
|
+
}, {});
|
|
42
|
+
};
|
|
43
|
+
var createGetSceneById = (sceneMap) => {
|
|
44
|
+
return (id) => {
|
|
45
|
+
return sceneMap[id];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var createGetExtensionEventById = (eventsMap) => {
|
|
49
|
+
return (id) => {
|
|
50
|
+
return eventsMap[id];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
var createGetFrameById = (frameMap) => {
|
|
54
|
+
return (id) => {
|
|
55
|
+
return frameMap[id];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
buildEventsMap,
|
|
61
|
+
buildSceneMap,
|
|
62
|
+
createGetExtensionEventById,
|
|
63
|
+
createGetFrameById,
|
|
64
|
+
createGetSceneById
|
|
65
|
+
});
|