@mybricks/to-code-taro 1.0.1 → 1.0.3
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/{Index.js → index.js} +4 -4
- package/dist/cjs/core/mybricks/index.js +47 -47
- package/dist/cjs/core/utils/ComContext.js +3 -0
- package/dist/cjs/core/utils/hooks.js +125 -0
- package/dist/cjs/core/utils/index.js +21 -57
- package/dist/cjs/core/utils/page.js +67 -0
- package/dist/cjs/core/utils/useContext.js +2 -1
- package/dist/cjs/generate/generateTaroProjectJson.d.ts +3 -14
- package/dist/cjs/generate/generateTaroProjectJson.js +9 -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 +2 -9
- package/dist/cjs/handleSlot.js +47 -150
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +4 -3
- package/dist/cjs/processors/processComEvents.d.ts +9 -0
- package/dist/cjs/processors/processComEvents.js +122 -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 +124 -0
- package/dist/cjs/processors/processSceneLogic.d.ts +4 -0
- package/dist/cjs/processors/processSceneLogic.js +166 -0
- package/dist/cjs/taro-template.json +15 -7
- package/dist/cjs/toCodeTaro.d.ts +26 -5
- package/dist/cjs/toCodeTaro.js +59 -343
- package/dist/cjs/utils/builder/buildResult.d.ts +21 -0
- package/dist/cjs/utils/builder/buildResult.js +91 -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 +1 -1
- package/dist/cjs/utils/{handlePageConfig.js → config/handlePageConfig.js} +4 -4
- 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} +14 -11
- 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.js +1 -1
- package/dist/esm/core/mybricks/index.js +1 -1
- package/dist/esm/core/utils/ComContext.js +1 -0
- package/dist/esm/core/utils/hooks.js +118 -0
- package/dist/esm/core/utils/index.js +6 -57
- package/dist/esm/core/utils/page.js +50 -0
- package/dist/esm/core/utils/useContext.js +2 -1
- package/dist/esm/generate/generateTaroProjectJson.d.ts +3 -14
- package/dist/esm/generate/generateTaroProjectJson.js +27 -23
- 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 +2 -9
- package/dist/esm/handleSlot.js +97 -174
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/processors/processComEvents.d.ts +9 -0
- package/dist/esm/processors/processComEvents.js +110 -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 +126 -0
- package/dist/esm/processors/processSceneLogic.d.ts +4 -0
- package/dist/esm/processors/processSceneLogic.js +160 -0
- package/dist/esm/taro-template.json +15 -7
- package/dist/esm/toCodeTaro.d.ts +26 -5
- package/dist/esm/toCodeTaro.js +96 -396
- package/dist/esm/utils/builder/buildResult.d.ts +21 -0
- package/dist/esm/utils/builder/buildResult.js +61 -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 +1 -1
- package/dist/esm/utils/{handlePageConfig.js → config/handlePageConfig.js} +1 -1
- 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 +98 -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} +11 -5
- 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/package.json +1 -1
- 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/cjs/utils/{code → templates}/scene.d.ts +0 -0
- /package/dist/esm/core/comlib/{Index.js → index.js} +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
- /package/dist/esm/utils/{code → templates}/scene.d.ts +0 -0
- /package/dist/esm/utils/{code → templates}/scene.js +0 -0
|
@@ -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,
|
|
@@ -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;
|
|
@@ -42,10 +42,10 @@ var HandlePageConfig = class {
|
|
|
42
42
|
});
|
|
43
43
|
if ((_a = systemPageCom == null ? void 0 : systemPageCom.model) == null ? void 0 : _a.data) {
|
|
44
44
|
const systemPageData = systemPageCom.model.data;
|
|
45
|
-
pageConfigContent = (0,
|
|
45
|
+
pageConfigContent = (0, import_content.generatePageConfigContent)(systemPageData);
|
|
46
46
|
if (!this.globalTabBarConfig && systemPageData.tabBar && Array.isArray(systemPageData.tabBar)) {
|
|
47
47
|
const pageIdToPath = (pageId) => `pages/${pageId}/index`;
|
|
48
|
-
this.globalTabBarConfig = (0,
|
|
48
|
+
this.globalTabBarConfig = (0, import_content.generateTabBarConfigContent)(
|
|
49
49
|
systemPageData.tabBar,
|
|
50
50
|
pageIdToPath,
|
|
51
51
|
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
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 构建 frames 映射表
|
|
3
|
+
* 参考鸿蒙实现 handleFrame.ts
|
|
4
|
+
* 用于快速查找 frame 和对应的组件信息
|
|
5
|
+
*/
|
|
6
|
+
export interface FrameMapItem {
|
|
7
|
+
frame: any;
|
|
8
|
+
meta: any;
|
|
9
|
+
}
|
|
10
|
+
export type FrameMap = Record<string, FrameMapItem>;
|
|
11
|
+
/**
|
|
12
|
+
* 构建完整的 frameMap
|
|
13
|
+
* @param tojson - 完整的 tojson 数据
|
|
14
|
+
* @returns frameMap 对象
|
|
15
|
+
*/
|
|
16
|
+
export declare const buildFrameMap: (tojson: any) => FrameMap;
|
|
@@ -0,0 +1,106 @@
|
|
|
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/buildFrameMap.ts
|
|
20
|
+
var buildFrameMap_exports = {};
|
|
21
|
+
__export(buildFrameMap_exports, {
|
|
22
|
+
buildFrameMap: () => buildFrameMap
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(buildFrameMap_exports);
|
|
25
|
+
var buildFrameMapRecursive = (frames, frameMap, tojson, config) => {
|
|
26
|
+
frames.forEach((frame) => {
|
|
27
|
+
var _a;
|
|
28
|
+
frameMap[frame.id] = {
|
|
29
|
+
frame,
|
|
30
|
+
meta: ((_a = config == null ? void 0 : config.getComInfo) == null ? void 0 : _a.call(config, "")) || void 0
|
|
31
|
+
};
|
|
32
|
+
if (frame.frames && frame.frames.length > 0) {
|
|
33
|
+
buildFrameMapRecursive(frame.frames, frameMap, tojson, config);
|
|
34
|
+
}
|
|
35
|
+
if (frame.coms) {
|
|
36
|
+
Object.entries(frame.coms).forEach(([comId, comFrame]) => {
|
|
37
|
+
if (comFrame.frames && comFrame.frames.length > 0) {
|
|
38
|
+
buildFrameMapRecursive(
|
|
39
|
+
comFrame.frames,
|
|
40
|
+
frameMap,
|
|
41
|
+
tojson,
|
|
42
|
+
{
|
|
43
|
+
getComInfo: (id) => {
|
|
44
|
+
var _a2;
|
|
45
|
+
for (const scene of tojson.scenes) {
|
|
46
|
+
const comInfo = (_a2 = scene.coms) == null ? void 0 : _a2[comId || id];
|
|
47
|
+
if (comInfo) {
|
|
48
|
+
return comInfo;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var buildFrameMap = (tojson) => {
|
|
61
|
+
const frameMap = {};
|
|
62
|
+
tojson.frames.forEach((frame) => {
|
|
63
|
+
if (frame.id && !frameMap[frame.id]) {
|
|
64
|
+
frameMap[frame.id] = {
|
|
65
|
+
frame,
|
|
66
|
+
meta: void 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (frame.frames && frame.frames.length > 0) {
|
|
70
|
+
buildFrameMapRecursive(frame.frames, frameMap, tojson);
|
|
71
|
+
}
|
|
72
|
+
if (frame.coms) {
|
|
73
|
+
Object.entries(frame.coms).forEach(([comId, comFrame]) => {
|
|
74
|
+
if (comFrame.frames && comFrame.frames.length > 0) {
|
|
75
|
+
buildFrameMapRecursive(comFrame.frames, frameMap, tojson, {
|
|
76
|
+
getComInfo: (id) => {
|
|
77
|
+
var _a;
|
|
78
|
+
for (const scene of tojson.scenes) {
|
|
79
|
+
const comInfo = (_a = scene.coms) == null ? void 0 : _a[comId || id];
|
|
80
|
+
if (comInfo) {
|
|
81
|
+
return comInfo;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (tojson.global.fxFrames && tojson.global.fxFrames.length > 0) {
|
|
92
|
+
tojson.global.fxFrames.forEach((fxFrame) => {
|
|
93
|
+
if (!frameMap[fxFrame.id]) {
|
|
94
|
+
frameMap[fxFrame.id] = {
|
|
95
|
+
frame: fxFrame,
|
|
96
|
+
meta: void 0
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return frameMap;
|
|
102
|
+
};
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
buildFrameMap
|
|
106
|
+
});
|