@mybricks/to-code-taro 1.2.6 → 1.2.8

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.
Files changed (229) hide show
  1. package/package.json +1 -1
  2. package/dist/cjs/abstractEventTypeDef.d.ts +0 -11
  3. package/dist/cjs/abstractEventTypeDef.js +0 -93
  4. package/dist/cjs/generate/compressImages.d.ts +0 -16
  5. package/dist/cjs/generate/compressImages.js +0 -76
  6. package/dist/cjs/generate/generateTaroProjectJson.d.ts +0 -13
  7. package/dist/cjs/generate/generateTaroProjectJson.js +0 -225
  8. package/dist/cjs/generate/generateTaroTempalteJson.d.ts +0 -15
  9. package/dist/cjs/generate/generateTaroTempalteJson.js +0 -103
  10. package/dist/cjs/generate/utils/appConfig.d.ts +0 -21
  11. package/dist/cjs/generate/utils/appConfig.js +0 -57
  12. package/dist/cjs/generate/utils/commonDir.d.ts +0 -21
  13. package/dist/cjs/generate/utils/commonDir.js +0 -63
  14. package/dist/cjs/generate/utils/customTabBar.d.ts +0 -11
  15. package/dist/cjs/generate/utils/customTabBar.js +0 -73
  16. package/dist/cjs/generate/utils/fileNode.d.ts +0 -21
  17. package/dist/cjs/generate/utils/fileNode.js +0 -67
  18. package/dist/cjs/generate/utils/index.d.ts +0 -7
  19. package/dist/cjs/generate/utils/index.js +0 -29
  20. package/dist/cjs/generate/utils/pageImages.d.ts +0 -14
  21. package/dist/cjs/generate/utils/pageImages.js +0 -36
  22. package/dist/cjs/generate/utils/tabBarImages.d.ts +0 -14
  23. package/dist/cjs/generate/utils/tabBarImages.js +0 -36
  24. package/dist/cjs/handleCom.d.ts +0 -8
  25. package/dist/cjs/handleCom.js +0 -280
  26. package/dist/cjs/handleDom.d.ts +0 -21
  27. package/dist/cjs/handleDom.js +0 -52
  28. package/dist/cjs/handleExtension.d.ts +0 -10
  29. package/dist/cjs/handleExtension.js +0 -300
  30. package/dist/cjs/handleGlobal.d.ts +0 -11
  31. package/dist/cjs/handleGlobal.js +0 -191
  32. package/dist/cjs/handleModule.d.ts +0 -15
  33. package/dist/cjs/handleModule.js +0 -104
  34. package/dist/cjs/handleSlot.d.ts +0 -29
  35. package/dist/cjs/handleSlot.js +0 -153
  36. package/dist/cjs/index.d.ts +0 -4
  37. package/dist/cjs/index.js +0 -48
  38. package/dist/cjs/processors/processComEvents.d.ts +0 -9
  39. package/dist/cjs/processors/processComEvents.js +0 -163
  40. package/dist/cjs/processors/processModule.d.ts +0 -31
  41. package/dist/cjs/processors/processModule.js +0 -159
  42. package/dist/cjs/processors/processScene.d.ts +0 -32
  43. package/dist/cjs/processors/processScene.js +0 -198
  44. package/dist/cjs/processors/processSceneLogic.d.ts +0 -7
  45. package/dist/cjs/processors/processSceneLogic.js +0 -230
  46. package/dist/cjs/shims-taro.d.ts +0 -20
  47. package/dist/cjs/taro-template.json +0 -154
  48. package/dist/cjs/toCodeTaro.d.ts +0 -168
  49. package/dist/cjs/toCodeTaro.js +0 -326
  50. package/dist/cjs/utils/builder/buildResult.d.ts +0 -24
  51. package/dist/cjs/utils/builder/buildResult.js +0 -163
  52. package/dist/cjs/utils/common/ImportManager.d.ts +0 -26
  53. package/dist/cjs/utils/common/ImportManager.js +0 -123
  54. package/dist/cjs/utils/common/helper.d.ts +0 -12
  55. package/dist/cjs/utils/common/helper.js +0 -52
  56. package/dist/cjs/utils/common/object.d.ts +0 -5
  57. package/dist/cjs/utils/common/object.js +0 -58
  58. package/dist/cjs/utils/common/string.d.ts +0 -18
  59. package/dist/cjs/utils/common/string.js +0 -59
  60. package/dist/cjs/utils/config/content/converter.d.ts +0 -17
  61. package/dist/cjs/utils/config/content/converter.js +0 -84
  62. package/dist/cjs/utils/config/content/index.d.ts +0 -10
  63. package/dist/cjs/utils/config/content/index.js +0 -33
  64. package/dist/cjs/utils/config/content/pageConfig.d.ts +0 -10
  65. package/dist/cjs/utils/config/content/pageConfig.js +0 -80
  66. package/dist/cjs/utils/config/content/saveBase64Image.d.ts +0 -24
  67. package/dist/cjs/utils/config/content/saveBase64Image.js +0 -113
  68. package/dist/cjs/utils/config/content/tabBarConfig.d.ts +0 -28
  69. package/dist/cjs/utils/config/content/tabBarConfig.js +0 -74
  70. package/dist/cjs/utils/config/content/types.d.ts +0 -73
  71. package/dist/cjs/utils/config/content/types.js +0 -17
  72. package/dist/cjs/utils/config/content/validator.d.ts +0 -13
  73. package/dist/cjs/utils/config/content/validator.js +0 -67
  74. package/dist/cjs/utils/config/handlePageConfig.d.ts +0 -31
  75. package/dist/cjs/utils/config/handlePageConfig.js +0 -88
  76. package/dist/cjs/utils/context/buildContext.d.ts +0 -31
  77. package/dist/cjs/utils/context/buildContext.js +0 -76
  78. package/dist/cjs/utils/context/buildFrameMap.d.ts +0 -16
  79. package/dist/cjs/utils/context/buildFrameMap.js +0 -106
  80. package/dist/cjs/utils/context/buildGlobalData.d.ts +0 -13
  81. package/dist/cjs/utils/context/buildGlobalData.js +0 -58
  82. package/dist/cjs/utils/context/collectJSModules.d.ts +0 -41
  83. package/dist/cjs/utils/context/collectJSModules.js +0 -93
  84. package/dist/cjs/utils/context/createEventQueries.d.ts +0 -45
  85. package/dist/cjs/utils/context/createEventQueries.js +0 -99
  86. package/dist/cjs/utils/context/createProvider.d.ts +0 -21
  87. package/dist/cjs/utils/context/createProvider.js +0 -49
  88. package/dist/cjs/utils/index.d.ts +0 -10
  89. package/dist/cjs/utils/index.js +0 -60
  90. package/dist/cjs/utils/logic/convertNamespace.d.ts +0 -11
  91. package/dist/cjs/utils/logic/convertNamespace.js +0 -43
  92. package/dist/cjs/utils/logic/genJSModules.d.ts +0 -16
  93. package/dist/cjs/utils/logic/genJSModules.js +0 -114
  94. package/dist/cjs/utils/logic/handleProcess.d.ts +0 -9
  95. package/dist/cjs/utils/logic/handleProcess.js +0 -462
  96. package/dist/cjs/utils/logic/processChildren.d.ts +0 -26
  97. package/dist/cjs/utils/logic/processChildren.js +0 -121
  98. package/dist/cjs/utils/style/color.d.ts +0 -4
  99. package/dist/cjs/utils/style/color.js +0 -45
  100. package/dist/cjs/utils/style/converter.d.ts +0 -7
  101. package/dist/cjs/utils/style/converter.js +0 -175
  102. package/dist/cjs/utils/style/getComponentClassName.d.ts +0 -16
  103. package/dist/cjs/utils/style/getComponentClassName.js +0 -47
  104. package/dist/cjs/utils/style/pxtransform.d.ts +0 -4
  105. package/dist/cjs/utils/style/pxtransform.js +0 -62
  106. package/dist/cjs/utils/style/types.d.ts +0 -23
  107. package/dist/cjs/utils/style/types.js +0 -17
  108. package/dist/cjs/utils/templates/component.d.ts +0 -19
  109. package/dist/cjs/utils/templates/component.js +0 -86
  110. package/dist/cjs/utils/templates/index.d.ts +0 -32
  111. package/dist/cjs/utils/templates/index.js +0 -116
  112. package/dist/cjs/utils/templates/renderManager.d.ts +0 -18
  113. package/dist/cjs/utils/templates/renderManager.js +0 -152
  114. package/dist/cjs/utils/templates/scene.d.ts +0 -23
  115. package/dist/cjs/utils/templates/scene.js +0 -113
  116. package/dist/esm/abstractEventTypeDef.d.ts +0 -11
  117. package/dist/esm/abstractEventTypeDef.js +0 -63
  118. package/dist/esm/generate/compressImages.d.ts +0 -16
  119. package/dist/esm/generate/compressImages.js +0 -108
  120. package/dist/esm/generate/generateTaroProjectJson.d.ts +0 -13
  121. package/dist/esm/generate/generateTaroProjectJson.js +0 -228
  122. package/dist/esm/generate/generateTaroTempalteJson.d.ts +0 -15
  123. package/dist/esm/generate/generateTaroTempalteJson.js +0 -94
  124. package/dist/esm/generate/utils/appConfig.d.ts +0 -21
  125. package/dist/esm/generate/utils/appConfig.js +0 -49
  126. package/dist/esm/generate/utils/commonDir.d.ts +0 -21
  127. package/dist/esm/generate/utils/commonDir.js +0 -53
  128. package/dist/esm/generate/utils/customTabBar.d.ts +0 -11
  129. package/dist/esm/generate/utils/customTabBar.js +0 -52
  130. package/dist/esm/generate/utils/fileNode.d.ts +0 -21
  131. package/dist/esm/generate/utils/fileNode.js +0 -62
  132. package/dist/esm/generate/utils/index.d.ts +0 -7
  133. package/dist/esm/generate/utils/index.js +0 -8
  134. package/dist/esm/generate/utils/pageImages.d.ts +0 -14
  135. package/dist/esm/generate/utils/pageImages.js +0 -15
  136. package/dist/esm/generate/utils/tabBarImages.d.ts +0 -14
  137. package/dist/esm/generate/utils/tabBarImages.js +0 -15
  138. package/dist/esm/handleCom.d.ts +0 -8
  139. package/dist/esm/handleCom.js +0 -350
  140. package/dist/esm/handleDom.d.ts +0 -21
  141. package/dist/esm/handleDom.js +0 -26
  142. package/dist/esm/handleExtension.d.ts +0 -10
  143. package/dist/esm/handleExtension.js +0 -243
  144. package/dist/esm/handleGlobal.d.ts +0 -11
  145. package/dist/esm/handleGlobal.js +0 -157
  146. package/dist/esm/handleModule.d.ts +0 -15
  147. package/dist/esm/handleModule.js +0 -73
  148. package/dist/esm/handleSlot.d.ts +0 -29
  149. package/dist/esm/handleSlot.js +0 -215
  150. package/dist/esm/index.d.ts +0 -4
  151. package/dist/esm/index.js +0 -4
  152. package/dist/esm/processors/processComEvents.d.ts +0 -9
  153. package/dist/esm/processors/processComEvents.js +0 -170
  154. package/dist/esm/processors/processModule.d.ts +0 -31
  155. package/dist/esm/processors/processModule.js +0 -177
  156. package/dist/esm/processors/processScene.d.ts +0 -32
  157. package/dist/esm/processors/processScene.js +0 -234
  158. package/dist/esm/processors/processSceneLogic.d.ts +0 -7
  159. package/dist/esm/processors/processSceneLogic.js +0 -247
  160. package/dist/esm/shims-taro.d.ts +0 -20
  161. package/dist/esm/taro-template.json +0 -154
  162. package/dist/esm/toCodeTaro.d.ts +0 -168
  163. package/dist/esm/toCodeTaro.js +0 -367
  164. package/dist/esm/utils/builder/buildResult.d.ts +0 -24
  165. package/dist/esm/utils/builder/buildResult.js +0 -119
  166. package/dist/esm/utils/common/ImportManager.d.ts +0 -26
  167. package/dist/esm/utils/common/ImportManager.js +0 -131
  168. package/dist/esm/utils/common/helper.d.ts +0 -12
  169. package/dist/esm/utils/common/helper.js +0 -33
  170. package/dist/esm/utils/common/object.d.ts +0 -5
  171. package/dist/esm/utils/common/object.js +0 -32
  172. package/dist/esm/utils/common/string.d.ts +0 -18
  173. package/dist/esm/utils/common/string.js +0 -37
  174. package/dist/esm/utils/config/content/converter.d.ts +0 -17
  175. package/dist/esm/utils/config/content/converter.js +0 -106
  176. package/dist/esm/utils/config/content/index.d.ts +0 -10
  177. package/dist/esm/utils/config/content/index.js +0 -11
  178. package/dist/esm/utils/config/content/pageConfig.d.ts +0 -10
  179. package/dist/esm/utils/config/content/pageConfig.js +0 -43
  180. package/dist/esm/utils/config/content/saveBase64Image.d.ts +0 -24
  181. package/dist/esm/utils/config/content/saveBase64Image.js +0 -127
  182. package/dist/esm/utils/config/content/tabBarConfig.d.ts +0 -28
  183. package/dist/esm/utils/config/content/tabBarConfig.js +0 -89
  184. package/dist/esm/utils/config/content/types.d.ts +0 -73
  185. package/dist/esm/utils/config/content/types.js +0 -1
  186. package/dist/esm/utils/config/content/validator.d.ts +0 -13
  187. package/dist/esm/utils/config/content/validator.js +0 -64
  188. package/dist/esm/utils/config/handlePageConfig.d.ts +0 -31
  189. package/dist/esm/utils/config/handlePageConfig.js +0 -89
  190. package/dist/esm/utils/context/buildContext.d.ts +0 -31
  191. package/dist/esm/utils/context/buildContext.js +0 -65
  192. package/dist/esm/utils/context/buildFrameMap.d.ts +0 -16
  193. package/dist/esm/utils/context/buildFrameMap.js +0 -131
  194. package/dist/esm/utils/context/buildGlobalData.d.ts +0 -13
  195. package/dist/esm/utils/context/buildGlobalData.js +0 -44
  196. package/dist/esm/utils/context/collectJSModules.d.ts +0 -41
  197. package/dist/esm/utils/context/collectJSModules.js +0 -87
  198. package/dist/esm/utils/context/createEventQueries.d.ts +0 -45
  199. package/dist/esm/utils/context/createEventQueries.js +0 -99
  200. package/dist/esm/utils/context/createProvider.d.ts +0 -21
  201. package/dist/esm/utils/context/createProvider.js +0 -33
  202. package/dist/esm/utils/index.d.ts +0 -10
  203. package/dist/esm/utils/index.js +0 -12
  204. package/dist/esm/utils/logic/convertNamespace.d.ts +0 -11
  205. package/dist/esm/utils/logic/convertNamespace.js +0 -27
  206. package/dist/esm/utils/logic/genJSModules.d.ts +0 -16
  207. package/dist/esm/utils/logic/genJSModules.js +0 -33
  208. package/dist/esm/utils/logic/handleProcess.d.ts +0 -9
  209. package/dist/esm/utils/logic/handleProcess.js +0 -520
  210. package/dist/esm/utils/logic/processChildren.d.ts +0 -26
  211. package/dist/esm/utils/logic/processChildren.js +0 -101
  212. package/dist/esm/utils/style/color.d.ts +0 -4
  213. package/dist/esm/utils/style/color.js +0 -17
  214. package/dist/esm/utils/style/converter.d.ts +0 -7
  215. package/dist/esm/utils/style/converter.js +0 -175
  216. package/dist/esm/utils/style/getComponentClassName.d.ts +0 -16
  217. package/dist/esm/utils/style/getComponentClassName.js +0 -37
  218. package/dist/esm/utils/style/pxtransform.d.ts +0 -4
  219. package/dist/esm/utils/style/pxtransform.js +0 -54
  220. package/dist/esm/utils/style/types.d.ts +0 -23
  221. package/dist/esm/utils/style/types.js +0 -1
  222. package/dist/esm/utils/templates/component.d.ts +0 -19
  223. package/dist/esm/utils/templates/component.js +0 -55
  224. package/dist/esm/utils/templates/index.d.ts +0 -32
  225. package/dist/esm/utils/templates/index.js +0 -97
  226. package/dist/esm/utils/templates/renderManager.d.ts +0 -18
  227. package/dist/esm/utils/templates/renderManager.js +0 -145
  228. package/dist/esm/utils/templates/scene.d.ts +0 -23
  229. package/dist/esm/utils/templates/scene.js +0 -66
@@ -1,74 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/config/content/tabBarConfig.ts
20
- var tabBarConfig_exports = {};
21
- __export(tabBarConfig_exports, {
22
- formatTabBarConfigForAppConfig: () => formatTabBarConfigForAppConfig,
23
- generateCustomTabBarFileContent: () => generateCustomTabBarFileContent,
24
- generateTabBarConfigContent: () => generateTabBarConfigContent
25
- });
26
- module.exports = __toCommonJS(tabBarConfig_exports);
27
- var import_converter = require("./converter");
28
- var import_saveBase64Image = require("./saveBase64Image");
29
- function generateTabBarConfigContent(tabBar, pageIdToPath = (pageId) => `pages/${pageId}/index`, imageFiles) {
30
- if (!tabBar || !Array.isArray(tabBar)) {
31
- return null;
32
- }
33
- const iconProcessor = imageFiles ? (iconPath, index, type) => (0, import_saveBase64Image.processTabBarIcon)(iconPath, index, type, imageFiles) : void 0;
34
- const config = (0, import_converter.convertToTaroTabBarConfig)(tabBar, pageIdToPath, iconProcessor);
35
- if (!config) {
36
- return null;
37
- }
38
- return config;
39
- }
40
- function formatTabBarConfigForAppConfig(config, indent = " ") {
41
- const tabBarJson = JSON.stringify(config, null, 2);
42
- const formattedJson = tabBarJson.replace(/"([^"]+)":/g, "$1:").replace(/"/g, "'");
43
- const lines = formattedJson.split("\n");
44
- return lines.map((line, index) => {
45
- if (index === 0)
46
- return `${indent}tabBar: ${line}`;
47
- return `${indent}${line}`;
48
- }).join("\n");
49
- }
50
- function generateCustomTabBarFileContent(tabBar, config) {
51
- const customTabbarConfig = tabBar.map((item, index) => {
52
- const { iconPath, selectedIconPath } = config.list[index];
53
- const cleanPath = (p) => {
54
- if (!p)
55
- return void 0;
56
- const cleaned = p.replace(/^\/?@\//, "").replace(/^\//, "");
57
- return `/${cleaned}`;
58
- };
59
- return {
60
- ...item,
61
- pagePath: config.list[index].pagePath,
62
- normalIconPath: cleanPath(iconPath),
63
- selectedIconPath: cleanPath(selectedIconPath)
64
- };
65
- });
66
- const tabBarJson = JSON.stringify(customTabbarConfig, null, 2);
67
- return `export default ${tabBarJson} as any`;
68
- }
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- formatTabBarConfigForAppConfig,
72
- generateCustomTabBarFileContent,
73
- generateTabBarConfigContent
74
- });
@@ -1,73 +0,0 @@
1
- /**
2
- * TabBar 相关类型定义
3
- */
4
- /// <reference types="node" />
5
- /// <reference types="node" />
6
- /**
7
- * TabBar 项源数据(来自 toJson.tabbar)
8
- */
9
- export interface TabBarItemSource {
10
- scene: {
11
- id: string;
12
- title?: string;
13
- };
14
- text?: string;
15
- type?: string;
16
- normalIconUseImg?: boolean;
17
- selectedIconUseImg?: boolean;
18
- normalIcon?: string;
19
- selectedIcon?: string;
20
- normalFontIconStyle?: Record<string, any>;
21
- selectedFontIconStyle?: Record<string, any>;
22
- normalIconPath?: string;
23
- selectedIconPath?: string;
24
- normalTextStyle?: Record<string, any>;
25
- selectedTextStyle?: Record<string, any>;
26
- normalIconStyle?: Record<string, any>;
27
- selectedIconStyle?: Record<string, any>;
28
- normalBackgroundStyle?: Record<string, any>;
29
- selectedBackgroundStyle?: Record<string, any>;
30
- }
31
- /**
32
- * 转换后的自定义Tabbar项配置
33
- * 增加页面路径pagePath
34
- * normalIconPath/selectedIconPath替换成本地图片路径
35
- */
36
- export interface CustomTabbarConfig extends TabBarItemSource {
37
- pagePath: string;
38
- }
39
- /**
40
- * Taro TabBar 项配置
41
- */
42
- export interface TaroTabBarItem {
43
- pagePath: string;
44
- text: string;
45
- iconPath?: string;
46
- selectedIconPath?: string;
47
- }
48
- /**
49
- * Taro TabBar 配置
50
- */
51
- export interface TaroTabBarConfig {
52
- custom?: boolean;
53
- color?: string;
54
- selectedColor?: string;
55
- backgroundColor?: string;
56
- borderStyle?: string;
57
- list: TaroTabBarItem[];
58
- }
59
- /**
60
- * TabBar 验证结果
61
- */
62
- export interface TabBarValidationResult {
63
- useTabBar: boolean;
64
- validItems: TabBarItemSource[];
65
- error?: string;
66
- }
67
- /**
68
- * 图片文件信息
69
- */
70
- export interface ImageFileInfo {
71
- filePath: string;
72
- fileContent: Buffer;
73
- }
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __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);
@@ -1,13 +0,0 @@
1
- import type { TabBarItemSource, TabBarValidationResult } from './types';
2
- /**
3
- * 验证 TabBar 配置
4
- * @param tabBar TabBar 项数组(来自 toJson.tabbar)
5
- * @returns 验证结果
6
- */
7
- export declare function validateTabBar(tabBar: TabBarItemSource[] | undefined | null): TabBarValidationResult;
8
- /**
9
- * 判断是否启用 TabBar
10
- * @param tabBar TabBar 项数组
11
- * @returns 是否启用
12
- */
13
- export declare function shouldUseTabBar(tabBar: TabBarItemSource[] | undefined | null): boolean;
@@ -1,67 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/config/content/validator.ts
20
- var validator_exports = {};
21
- __export(validator_exports, {
22
- shouldUseTabBar: () => shouldUseTabBar,
23
- validateTabBar: () => validateTabBar
24
- });
25
- module.exports = __toCommonJS(validator_exports);
26
- var MIN_TAB_BAR_ITEMS = 2;
27
- var MAX_TAB_BAR_ITEMS = 5;
28
- function validateTabBar(tabBar) {
29
- if (!Array.isArray(tabBar)) {
30
- return {
31
- useTabBar: false,
32
- validItems: [],
33
- error: "TabBar 配置不存在或格式错误"
34
- };
35
- }
36
- const validItems = tabBar.filter((item) => {
37
- var _a;
38
- return !!((_a = item == null ? void 0 : item.scene) == null ? void 0 : _a.id);
39
- });
40
- const itemCount = validItems.length;
41
- if (itemCount < MIN_TAB_BAR_ITEMS) {
42
- return {
43
- useTabBar: false,
44
- validItems: [],
45
- error: `TabBar 项数量不足,需要至少 ${MIN_TAB_BAR_ITEMS} 个,当前 ${itemCount} 个`
46
- };
47
- }
48
- if (itemCount > MAX_TAB_BAR_ITEMS) {
49
- return {
50
- useTabBar: false,
51
- validItems: [],
52
- error: `TabBar 项数量过多,最多 ${MAX_TAB_BAR_ITEMS} 个,当前 ${itemCount} 个`
53
- };
54
- }
55
- return {
56
- useTabBar: true,
57
- validItems
58
- };
59
- }
60
- function shouldUseTabBar(tabBar) {
61
- return validateTabBar(tabBar).useTabBar;
62
- }
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- shouldUseTabBar,
66
- validateTabBar
67
- });
@@ -1,31 +0,0 @@
1
- import toCode from "@mybricks/to-code-react/dist/cjs/toCode";
2
- import { type ImageFileInfo } from "./content";
3
- /**
4
- * 处理页面配置的类
5
- * 负责提取 systemPage 组件数据,生成页面配置和 TabBar 配置
6
- */
7
- export declare class HandlePageConfig {
8
- private globalTabBarConfig;
9
- private tabBarImageFiles;
10
- private customTabbarFileContent;
11
- /**
12
- * 处理页面配置(提取 systemPage 组件数据)
13
- * @param scene 场景数据
14
- * @param isPopup 是否为弹窗场景
15
- * @returns 页面配置内容
16
- */
17
- handle(scene: ReturnType<typeof toCode>["scenes"][0]["scene"], isPopup?: boolean): string | undefined;
18
- /**
19
- * 获取全局 TabBar 配置
20
- */
21
- getTabBarConfig(): string | null;
22
- /**
23
- * 获取 TabBar 图片文件数组
24
- */
25
- getTabBarImageFiles(): ImageFileInfo[];
26
- /**
27
- * 获取自定义 TabBar 配置文件数据
28
- * 用于生成文件/src/custom-tab-bar/mybricks/tabbar-config.ts
29
- */
30
- getCustomTabBarFileContent(): string | null;
31
- }
@@ -1,88 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/config/handlePageConfig.ts
20
- var handlePageConfig_exports = {};
21
- __export(handlePageConfig_exports, {
22
- HandlePageConfig: () => HandlePageConfig
23
- });
24
- module.exports = __toCommonJS(handlePageConfig_exports);
25
- var import_content = require("./content");
26
- var HandlePageConfig = class {
27
- constructor() {
28
- this.globalTabBarConfig = null;
29
- this.tabBarImageFiles = [];
30
- this.customTabbarFileContent = null;
31
- }
32
- /**
33
- * 处理页面配置(提取 systemPage 组件数据)
34
- * @param scene 场景数据
35
- * @param isPopup 是否为弹窗场景
36
- * @returns 页面配置内容
37
- */
38
- handle(scene, isPopup = false) {
39
- var _a;
40
- let pageConfigContent;
41
- const systemPageCom = Object.values(scene.coms || {}).find((com) => {
42
- var _a2;
43
- return ((_a2 = com.def) == null ? void 0 : _a2.namespace) === "mybricks.taro.systemPage";
44
- });
45
- if ((_a = systemPageCom == null ? void 0 : systemPageCom.model) == null ? void 0 : _a.data) {
46
- const systemPageData = { ...systemPageCom.model.data };
47
- pageConfigContent = (0, import_content.generatePageConfigContent)(systemPageData);
48
- if (!this.globalTabBarConfig && systemPageData.tabBar && Array.isArray(systemPageData.tabBar)) {
49
- const pageIdToPath = (pageId) => `pages/${pageId}/index`;
50
- const globalTabBarConfigJson = (0, import_content.generateTabBarConfigContent)(
51
- systemPageData.tabBar,
52
- pageIdToPath,
53
- this.tabBarImageFiles
54
- );
55
- if (globalTabBarConfigJson) {
56
- this.globalTabBarConfig = (0, import_content.formatTabBarConfigForAppConfig)(globalTabBarConfigJson);
57
- if (this.globalTabBarConfig) {
58
- this.customTabbarFileContent = (0, import_content.generateCustomTabBarFileContent)(systemPageData.tabBar, globalTabBarConfigJson);
59
- }
60
- }
61
- }
62
- }
63
- return pageConfigContent;
64
- }
65
- /**
66
- * 获取全局 TabBar 配置
67
- */
68
- getTabBarConfig() {
69
- return this.globalTabBarConfig;
70
- }
71
- /**
72
- * 获取 TabBar 图片文件数组
73
- */
74
- getTabBarImageFiles() {
75
- return this.tabBarImageFiles;
76
- }
77
- /**
78
- * 获取自定义 TabBar 配置文件数据
79
- * 用于生成文件/src/custom-tab-bar/mybricks/tabbar-config.ts
80
- */
81
- getCustomTabBarFileContent() {
82
- return this.customTabbarFileContent;
83
- }
84
- };
85
- // Annotate the CommonJS export names for ESM import in node:
86
- 0 && (module.exports = {
87
- HandlePageConfig
88
- });
@@ -1,31 +0,0 @@
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 buildConnectorMap: (plugins: any) => {
17
- connectors: any;
18
- config: any;
19
- };
20
- /**
21
- * 创建场景查询函数
22
- */
23
- export declare const createGetSceneById: (sceneMap: Record<string, any>) => (id: string) => any;
24
- /**
25
- * 创建扩展事件查询函数
26
- */
27
- export declare const createGetExtensionEventById: (eventsMap: Record<string, any>) => (id: string) => any;
28
- /**
29
- * 创建 frame 查询函数
30
- */
31
- export declare const createGetFrameById: (frameMap: Record<string, any>) => (id: string) => any;
@@ -1,76 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/context/buildContext.ts
20
- var buildContext_exports = {};
21
- __export(buildContext_exports, {
22
- buildConnectorMap: () => buildConnectorMap,
23
- buildEventsMap: () => buildEventsMap,
24
- buildSceneMap: () => buildSceneMap,
25
- createGetExtensionEventById: () => createGetExtensionEventById,
26
- createGetFrameById: () => createGetFrameById,
27
- createGetSceneById: () => createGetSceneById
28
- });
29
- module.exports = __toCommonJS(buildContext_exports);
30
- var buildSceneMap = (scenes) => {
31
- return scenes.reduce((pre, cur) => {
32
- pre[cur.id] = cur;
33
- return pre;
34
- }, {});
35
- };
36
- var buildEventsMap = (frames) => {
37
- return frames.reduce((pre, cur) => {
38
- if (cur.type === "extension-event") {
39
- pre[cur.id] = cur;
40
- }
41
- return pre;
42
- }, {});
43
- };
44
- var buildConnectorMap = (plugins) => {
45
- const servicePlugin = plugins == null ? void 0 : plugins["@mybricks/plugins/service"];
46
- if (!servicePlugin)
47
- return null;
48
- return {
49
- connectors: servicePlugin.connectors || [],
50
- config: servicePlugin.config || {}
51
- };
52
- };
53
- var createGetSceneById = (sceneMap) => {
54
- return (id) => {
55
- return sceneMap[id];
56
- };
57
- };
58
- var createGetExtensionEventById = (eventsMap) => {
59
- return (id) => {
60
- return eventsMap[id];
61
- };
62
- };
63
- var createGetFrameById = (frameMap) => {
64
- return (id) => {
65
- return frameMap[id];
66
- };
67
- };
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- buildConnectorMap,
71
- buildEventsMap,
72
- buildSceneMap,
73
- createGetExtensionEventById,
74
- createGetFrameById,
75
- createGetSceneById
76
- });
@@ -1,16 +0,0 @@
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;
@@ -1,106 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/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
- });
@@ -1,13 +0,0 @@
1
- /**
2
- * 构建全局数据
3
- * 包括全局变量类型定义、FX Map 等
4
- */
5
- import type { Provider } from "./createProvider";
6
- /**
7
- * 构建全局变量类型定义
8
- */
9
- export declare const buildGlobalVarTypeDef: (comsReg: Record<string, any>) => Record<string, any>;
10
- /**
11
- * 构建默认 FX Map
12
- */
13
- export declare const buildDefaultFxsMap: (fxFrames: any[]) => Record<string, Provider>;
@@ -1,58 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/context/buildGlobalData.ts
20
- var buildGlobalData_exports = {};
21
- __export(buildGlobalData_exports, {
22
- buildDefaultFxsMap: () => buildDefaultFxsMap,
23
- buildGlobalVarTypeDef: () => buildGlobalVarTypeDef
24
- });
25
- module.exports = __toCommonJS(buildGlobalData_exports);
26
- var buildGlobalVarTypeDef = (comsReg) => {
27
- const globalVarTypeDef = {};
28
- Object.entries(comsReg).forEach(([, com]) => {
29
- if (com.def.namespace !== "mybricks.core-comlib.var") {
30
- return;
31
- }
32
- globalVarTypeDef[com.title] = com;
33
- });
34
- return globalVarTypeDef;
35
- };
36
- var buildDefaultFxsMap = (fxFrames) => {
37
- const defaultFxsMap = {};
38
- (fxFrames || []).filter((fxFrame) => {
39
- return fxFrame.type === "fx";
40
- }).forEach((fxFrame) => {
41
- defaultFxsMap[fxFrame.id] = {
42
- name: "global",
43
- class: "global",
44
- controllers: /* @__PURE__ */ new Set(),
45
- useParams: false,
46
- useEvents: false,
47
- coms: /* @__PURE__ */ new Set(),
48
- useController: false,
49
- useData: false
50
- };
51
- });
52
- return defaultFxsMap;
53
- };
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- buildDefaultFxsMap,
57
- buildGlobalVarTypeDef
58
- });