@mybricks/to-code-taro 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/handleModule.js +4 -6
- package/dist/cjs/processors/processModule.js +13 -5
- package/dist/cjs/taro-template.json +3 -3
- package/dist/cjs/utils/logic/handleProcess.js +2 -2
- package/dist/cjs/utils/style/converter.js +9 -0
- package/dist/cjs/utils/templates/renderManager.js +1 -1
- package/dist/cjs/utils/templates/scene.js +3 -2
- package/dist/esm/handleModule.js +3 -6
- package/dist/esm/processors/processModule.js +15 -2
- package/dist/esm/taro-template.json +3 -3
- package/dist/esm/utils/logic/handleProcess.js +2 -2
- package/dist/esm/utils/style/converter.js +11 -0
- package/dist/esm/utils/templates/renderManager.js +1 -1
- package/dist/esm/utils/templates/scene.js +2 -3
- package/package.json +1 -1
package/dist/cjs/handleModule.js
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(handleModule_exports);
|
|
|
25
25
|
var import_utils = require("./utils");
|
|
26
26
|
var import_handleProcess = require("./utils/logic/handleProcess");
|
|
27
27
|
var handleModule = (module2, config) => {
|
|
28
|
-
var _a
|
|
28
|
+
var _a;
|
|
29
29
|
const { events, moduleId, props } = module2;
|
|
30
30
|
const name = `C${String(moduleId).replace(/[^a-zA-Z0-9]/g, "_").toUpperCase()}`;
|
|
31
31
|
let comEventCode = "";
|
|
@@ -74,10 +74,7 @@ ${indent}},
|
|
|
74
74
|
currentProvider.controllers.add(module2.meta.id);
|
|
75
75
|
const resultStyle = (0, import_utils.convertComponentStyle)(module2.props.style);
|
|
76
76
|
const cssContent = (0, import_utils.convertStyleAryToCss)((_a = props.style) == null ? void 0 : _a.styleAry, module2.meta.id);
|
|
77
|
-
const componentController =
|
|
78
|
-
com: module2.meta,
|
|
79
|
-
scene: config.getCurrentScene()
|
|
80
|
-
})) || `controller_${module2.meta.id}`;
|
|
77
|
+
const componentController = module2.meta.id;
|
|
81
78
|
const initialIndent = config.codeStyle.indent * config.depth;
|
|
82
79
|
const indentView = (0, import_utils.indentation)(initialIndent);
|
|
83
80
|
const indent2 = (0, import_utils.indentation)(initialIndent + config.codeStyle.indent);
|
|
@@ -88,7 +85,8 @@ ${indent3}data={${(0, import_utils.genObjectCode)(configs, {
|
|
|
88
85
|
initialIndent: initialIndent + config.codeStyle.indent * 2,
|
|
89
86
|
indentSize: config.codeStyle.indent
|
|
90
87
|
})}}` : "") + `
|
|
91
|
-
${indent3}
|
|
88
|
+
${indent3}parentComRefs={comRefs}
|
|
89
|
+
${indent3}moduleId="${componentController}"` + (comEventCode ? `
|
|
92
90
|
${indent3}onEvents={{${comEventCode.replace(/\n/g, "\n" + indent3)}}}` : "") + `
|
|
93
91
|
${indent2}/>`;
|
|
94
92
|
const ui = `${indentView}<View id="${module2.meta.id}" className="${module2.meta.id}" style={${JSON.stringify(resultStyle.root)}}>
|
|
@@ -109,18 +109,26 @@ var processModule = (params) => {
|
|
|
109
109
|
abstractEventTypeDefMap[comId].eventIdMap[eventId] = schema;
|
|
110
110
|
},
|
|
111
111
|
getCallTemplate: (params2) => {
|
|
112
|
-
var _a2, _b, _c, _d;
|
|
112
|
+
var _a2, _b, _c, _d, _e;
|
|
113
113
|
const { com, pinId, args } = params2;
|
|
114
114
|
const targetScene = getSceneById(com.sceneId || com.id);
|
|
115
115
|
if (targetScene || com.isScene) {
|
|
116
116
|
const sceneId = (targetScene == null ? void 0 : targetScene.id) || com.sceneId || com.id;
|
|
117
|
-
|
|
117
|
+
if (sceneId === scene.id) {
|
|
118
|
+
const isOutput2 = (_a2 = targetScene == null ? void 0 : targetScene.outputs) == null ? void 0 : _a2.some((pin) => pin.id === pinId);
|
|
119
|
+
if (isOutput2) {
|
|
120
|
+
return {
|
|
121
|
+
code: `moduleOutputs?.${pinId}?.(${args || ""})`
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const isTargetPopup = (targetScene == null ? void 0 : targetScene.type) === "popup" || ((_b = targetScene == null ? void 0 : targetScene.deps) == null ? void 0 : _b.some((dep) => dep.namespace === "mybricks.taro.popup"));
|
|
118
126
|
const routerName = isTargetPopup ? "popupRouter" : "pageRouter";
|
|
119
|
-
const isInput = (
|
|
120
|
-
const isOutput = (
|
|
127
|
+
const isInput = (_c = targetScene == null ? void 0 : targetScene.inputs) == null ? void 0 : _c.some((pin) => pin.id === pinId);
|
|
128
|
+
const isOutput = (_d = targetScene == null ? void 0 : targetScene.outputs) == null ? void 0 : _d.some((pin) => pin.id === pinId);
|
|
121
129
|
if (isInput || isOutput) {
|
|
122
130
|
return {
|
|
123
|
-
code: `${routerName}.${pinId}("${((
|
|
131
|
+
code: `${routerName}.${pinId}("${((_e = config.getPageId) == null ? void 0 : _e.call(config, sceneId)) || sceneId}"${args ? `, ${args}` : ""})`,
|
|
124
132
|
import: {
|
|
125
133
|
packageName: config.getComponentPackageName(),
|
|
126
134
|
dependencyNames: [routerName],
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"path": "config/index.ts",
|
|
12
|
-
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n
|
|
12
|
+
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n },\n },\n h5: {\n publicPath: '/',\n staticDirectory: 'static',\n output: {\n filename: 'js/[name].[hash:8].js',\n chunkFilename: 'js/[name].[chunkhash:8].js'\n },\n miniCssExtractPluginOption: {\n ignoreOrder: true,\n filename: 'css/[name].[hash].css',\n chunkFilename: 'css/[name].[chunkhash].css'\n },\n postcss: {\n autoprefixer: {\n enable: true,\n config: {}\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n }\n },\n rn: {\n appName: 'taroDemo',\n postcss: {\n cssModules: {\n enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true\n }\n }\n }\n }\n\n process.env.BROWSERSLIST_ENV = process.env.NODE_ENV\n\n if (process.env.NODE_ENV === 'development') {\n // 本地开发构建配置(不混淆压缩)\n return merge({}, baseConfig, devConfig)\n }\n // 生产构建配置(默认开启压缩混淆等)\n return merge({}, baseConfig, prodConfig)\n})\n"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "config/prod.ts",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"path": "src/app.less",
|
|
80
|
-
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay
|
|
80
|
+
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay,\niframe[id=\"react-refresh-overlay\"] {\n display: none !important;\n}\n\n/* 系统页面 */\n.mybricks_taro_systemPage {\n height: 100vh !important;\n}\n\n.mybricks_com {\n flex-shrink: 0;\n min-height: 0;\n /* 防止子元素撑开父元素 */\n}\n\n.mybricks_slot {\n width: 100%;\n height: 100%;\n position: relative;\n transform: translateX(0)\n}\n\nview {\n box-sizing: border-box;\n}"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"path": "src/app.ts",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"path": "package.json",
|
|
140
|
-
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.
|
|
140
|
+
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.3\",\n \"@mybricks/taro-components\": \"^0.1.2\"\n },\n \"devDependencies\": {\n \"@tarojs/plugin-generator\": \"4.1.9\",\n \"@commitlint/cli\": \"^19.8.1\",\n \"@commitlint/config-conventional\": \"^19.8.1\",\n \"lint-staged\": \"^16.1.2\",\n \"husky\": \"^9.1.7\",\n \"stylelint-config-standard\": \"^38.0.0\",\n \"@babel/core\": \"^7.24.4\",\n \"@tarojs/cli\": \"4.1.9\",\n \"@babel/plugin-transform-class-properties\": \"7.25.9\",\n \"@types/webpack-env\": \"^1.13.6\",\n \"@types/react\": \"^18.0.0\",\n \"webpack\": \"5.91.0\",\n \"@tarojs/taro-loader\": \"4.1.9\",\n \"@tarojs/webpack5-runner\": \"4.1.9\",\n \"less\": \"^4.2.0\",\n \"babel-preset-taro\": \"4.1.9\",\n \"eslint-config-taro\": \"4.1.9\",\n \"eslint\": \"^8.57.0\",\n \"@pmmmwh/react-refresh-webpack-plugin\": \"^0.5.5\",\n \"react-refresh\": \"^0.14.0\",\n \"@babel/preset-react\": \"^7.24.1\",\n \"eslint-plugin-react\": \"^7.34.1\",\n \"eslint-plugin-react-hooks\": \"^4.4.0\",\n \"stylelint\": \"^16.4.0\",\n \"typescript\": \"^5.4.5\",\n \"tsconfig-paths-webpack-plugin\": \"^4.1.0\",\n \"postcss\": \"^8.5.6\",\n \"@types/node\": \"^18\",\n \"@types/minimatch\": \"^5\"\n }\n}\n"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"path": "project.config.json",
|
|
@@ -176,7 +176,7 @@ ${indent}${nextCode}globalVars.${varKey}.${props.id}(${nextValue}${xpathArg})`;
|
|
|
176
176
|
config
|
|
177
177
|
);
|
|
178
178
|
code += `${indent}/** ${props.title} 变量 ${props.meta.title} */
|
|
179
|
-
${indent}${nextCode}
|
|
179
|
+
${indent}${nextCode}$vars.current.${varKey}.${props.id}(${nextValue}${xpathArg})`;
|
|
180
180
|
}
|
|
181
181
|
} else if (category === "fx") {
|
|
182
182
|
if (props.meta.global) {
|
|
@@ -193,7 +193,7 @@ ${indent}${nextCode}globalFxs.${props.meta.ioProxy.id}(${nextValue}${nextValue ?
|
|
|
193
193
|
config
|
|
194
194
|
);
|
|
195
195
|
code += `${indent}/** 调用Fx ${props.meta.title} */
|
|
196
|
-
${indent}${nextCode}
|
|
196
|
+
${indent}${nextCode}$fxs.current.${props.meta.ioProxy.id}(${nextValue})`;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
} else {
|
|
@@ -99,6 +99,15 @@ var convertRootStyle = (style) => {
|
|
|
99
99
|
handleLayoutProp(value, rootStyle);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
+
if (key === "widthAuto" && value === true) {
|
|
103
|
+
rootStyle["width"] = "auto";
|
|
104
|
+
} else if (key === "heightAuto" && value === true) {
|
|
105
|
+
rootStyle["height"] = "auto";
|
|
106
|
+
} else if (key === "widthFull" && value === true) {
|
|
107
|
+
rootStyle["width"] = "100%";
|
|
108
|
+
} else if (key === "heightFull" && value === true) {
|
|
109
|
+
rootStyle["height"] = "100%";
|
|
110
|
+
}
|
|
102
111
|
const camelKey = key.includes("-") ? (0, import_string.kebabToCamel)(key) : key;
|
|
103
112
|
rootStyle[camelKey] = transformStyleValue(camelKey, value);
|
|
104
113
|
});
|
|
@@ -56,7 +56,7 @@ var RenderManager = class {
|
|
|
56
56
|
}
|
|
57
57
|
code += `${indent}function ${renderFunctionName}(params: any) {
|
|
58
58
|
`;
|
|
59
|
-
code += `${indent}${indent2}const { comRefs, $vars, $fxs, appContext } = useAppContext();
|
|
59
|
+
code += `${indent}${indent2}const { comRefs, $vars, $fxs, appContext, moduleOutputs } = useAppContext();
|
|
60
60
|
`;
|
|
61
61
|
if (logicCode == null ? void 0 : logicCode.includes("$outputs")) {
|
|
62
62
|
code += `${indent}${indent2}const $outputs = comRefs.current.$outputs;
|
|
@@ -31,7 +31,8 @@ var genReactiveDataManager = (indent, utilsPackageName) => {
|
|
|
31
31
|
return ``;
|
|
32
32
|
};
|
|
33
33
|
var genRootDefineCode = (indent, utilsPackageName, hasJsModules = false, isModule = false) => {
|
|
34
|
-
let code = `${indent}const {comRefs, $vars, $fxs, appContext} = useAppContext();
|
|
34
|
+
let code = isModule ? `${indent}const {comRefs, $vars, $fxs, appContext, moduleOutputs} = useAppContext();
|
|
35
|
+
` : `${indent}const {comRefs, $vars, $fxs, appContext} = useAppContext();
|
|
35
36
|
`;
|
|
36
37
|
if (!isModule) {
|
|
37
38
|
code += `${indent}usePageLife();
|
|
@@ -44,7 +45,7 @@ var genRootDefineCode = (indent, utilsPackageName, hasJsModules = false, isModul
|
|
|
44
45
|
return code;
|
|
45
46
|
};
|
|
46
47
|
var genSlotDefineCode = (indent) => {
|
|
47
|
-
return `${indent}const {comRefs, $vars, $fxs, appContext} = useAppContext();
|
|
48
|
+
return `${indent}const { comRefs, $vars, $fxs, appContext, moduleOutputs } = useAppContext();
|
|
48
49
|
`;
|
|
49
50
|
};
|
|
50
51
|
var genControllerInitCode = (indent, providerName) => {
|
package/dist/esm/handleModule.js
CHANGED
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
import { indentation, genObjectCode, convertComponentStyle, convertStyleAryToCss } from "./utils";
|
|
5
5
|
import { handleProcess } from "./utils/logic/handleProcess";
|
|
6
6
|
var handleModule = function handleModule(module, config) {
|
|
7
|
-
var _props$style
|
|
7
|
+
var _props$style;
|
|
8
8
|
var events = module.events,
|
|
9
9
|
moduleId = module.moduleId,
|
|
10
10
|
props = module.props;
|
|
@@ -51,10 +51,7 @@ var handleModule = function handleModule(module, config) {
|
|
|
51
51
|
currentProvider.controllers.add(module.meta.id);
|
|
52
52
|
var resultStyle = convertComponentStyle(module.props.style);
|
|
53
53
|
var cssContent = convertStyleAryToCss((_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.styleAry, module.meta.id);
|
|
54
|
-
var componentController =
|
|
55
|
-
com: module.meta,
|
|
56
|
-
scene: config.getCurrentScene()
|
|
57
|
-
})) || "controller_".concat(module.meta.id);
|
|
54
|
+
var componentController = module.meta.id;
|
|
58
55
|
var initialIndent = config.codeStyle.indent * config.depth;
|
|
59
56
|
var indentView = indentation(initialIndent);
|
|
60
57
|
var indent2 = indentation(initialIndent + config.codeStyle.indent);
|
|
@@ -62,7 +59,7 @@ var handleModule = function handleModule(module, config) {
|
|
|
62
59
|
var moduleCode = "".concat(indent2, "<").concat(name) + (config.verbose ? "\n".concat(indent3, "title=\"").concat(module.meta.title, "\"") : "") + (configs ? "\n".concat(indent3, "data={").concat(genObjectCode(configs, {
|
|
63
60
|
initialIndent: initialIndent + config.codeStyle.indent * 2,
|
|
64
61
|
indentSize: config.codeStyle.indent
|
|
65
|
-
}), "}") : "") + "\n".concat(indent3, "
|
|
62
|
+
}), "}") : "") + "\n".concat(indent3, "parentComRefs={comRefs}") + "\n".concat(indent3, "moduleId=\"").concat(componentController, "\"") + (comEventCode ? "\n".concat(indent3, "onEvents={{").concat(comEventCode.replace(/\n/g, "\n" + indent3), "}}") : "") + "\n".concat(indent2, "/>");
|
|
66
63
|
var ui = "".concat(indentView, "<View id=\"").concat(module.meta.id, "\" className=\"").concat(module.meta.id, "\" style={").concat(JSON.stringify(resultStyle.root), "}>\n").concat(moduleCode, "\n").concat(indentView, "</View>");
|
|
67
64
|
return {
|
|
68
65
|
ui: ui,
|
|
@@ -117,8 +117,21 @@ export var processModule = function processModule(params) {
|
|
|
117
117
|
// 优先通过 sceneId 查找,如果找不到再通过 id 查找
|
|
118
118
|
var targetScene = getSceneById(com.sceneId || com.id);
|
|
119
119
|
if (targetScene || com.isScene) {
|
|
120
|
-
var _targetScene$deps, _targetScene$inputs, _targetScene$
|
|
120
|
+
var _targetScene$deps, _targetScene$inputs, _targetScene$outputs2;
|
|
121
121
|
var sceneId = (targetScene === null || targetScene === void 0 ? void 0 : targetScene.id) || com.sceneId || com.id;
|
|
122
|
+
|
|
123
|
+
// 当前模块自身的 output → 通过 moduleOutputs 回调
|
|
124
|
+
if (sceneId === scene.id) {
|
|
125
|
+
var _targetScene$outputs;
|
|
126
|
+
var _isOutput = targetScene === null || targetScene === void 0 || (_targetScene$outputs = targetScene.outputs) === null || _targetScene$outputs === void 0 ? void 0 : _targetScene$outputs.some(function (pin) {
|
|
127
|
+
return pin.id === pinId;
|
|
128
|
+
});
|
|
129
|
+
if (_isOutput) {
|
|
130
|
+
return {
|
|
131
|
+
code: "moduleOutputs?.".concat(pinId, "?.(").concat(args || '', ")")
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
122
135
|
var isTargetPopup = (targetScene === null || targetScene === void 0 ? void 0 : targetScene.type) === 'popup' || (targetScene === null || targetScene === void 0 || (_targetScene$deps = targetScene.deps) === null || _targetScene$deps === void 0 ? void 0 : _targetScene$deps.some(function (dep) {
|
|
123
136
|
return dep.namespace === 'mybricks.taro.popup';
|
|
124
137
|
}));
|
|
@@ -128,7 +141,7 @@ export var processModule = function processModule(params) {
|
|
|
128
141
|
var isInput = targetScene === null || targetScene === void 0 || (_targetScene$inputs = targetScene.inputs) === null || _targetScene$inputs === void 0 ? void 0 : _targetScene$inputs.some(function (pin) {
|
|
129
142
|
return pin.id === pinId;
|
|
130
143
|
});
|
|
131
|
-
var isOutput = targetScene === null || targetScene === void 0 || (_targetScene$
|
|
144
|
+
var isOutput = targetScene === null || targetScene === void 0 || (_targetScene$outputs2 = targetScene.outputs) === null || _targetScene$outputs2 === void 0 ? void 0 : _targetScene$outputs2.some(function (pin) {
|
|
132
145
|
return pin.id === pinId;
|
|
133
146
|
});
|
|
134
147
|
if (isInput || isOutput) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"path": "config/index.ts",
|
|
12
|
-
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n
|
|
12
|
+
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n },\n },\n h5: {\n publicPath: '/',\n staticDirectory: 'static',\n output: {\n filename: 'js/[name].[hash:8].js',\n chunkFilename: 'js/[name].[chunkhash:8].js'\n },\n miniCssExtractPluginOption: {\n ignoreOrder: true,\n filename: 'css/[name].[hash].css',\n chunkFilename: 'css/[name].[chunkhash].css'\n },\n postcss: {\n autoprefixer: {\n enable: true,\n config: {}\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n }\n },\n rn: {\n appName: 'taroDemo',\n postcss: {\n cssModules: {\n enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true\n }\n }\n }\n }\n\n process.env.BROWSERSLIST_ENV = process.env.NODE_ENV\n\n if (process.env.NODE_ENV === 'development') {\n // 本地开发构建配置(不混淆压缩)\n return merge({}, baseConfig, devConfig)\n }\n // 生产构建配置(默认开启压缩混淆等)\n return merge({}, baseConfig, prodConfig)\n})\n"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "config/prod.ts",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"path": "src/app.less",
|
|
80
|
-
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay
|
|
80
|
+
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay,\niframe[id=\"react-refresh-overlay\"] {\n display: none !important;\n}\n\n/* 系统页面 */\n.mybricks_taro_systemPage {\n height: 100vh !important;\n}\n\n.mybricks_com {\n flex-shrink: 0;\n min-height: 0;\n /* 防止子元素撑开父元素 */\n}\n\n.mybricks_slot {\n width: 100%;\n height: 100%;\n position: relative;\n transform: translateX(0)\n}\n\nview {\n box-sizing: border-box;\n}"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"path": "src/app.ts",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"path": "package.json",
|
|
140
|
-
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.
|
|
140
|
+
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.3\",\n \"@mybricks/taro-components\": \"^0.1.2\"\n },\n \"devDependencies\": {\n \"@tarojs/plugin-generator\": \"4.1.9\",\n \"@commitlint/cli\": \"^19.8.1\",\n \"@commitlint/config-conventional\": \"^19.8.1\",\n \"lint-staged\": \"^16.1.2\",\n \"husky\": \"^9.1.7\",\n \"stylelint-config-standard\": \"^38.0.0\",\n \"@babel/core\": \"^7.24.4\",\n \"@tarojs/cli\": \"4.1.9\",\n \"@babel/plugin-transform-class-properties\": \"7.25.9\",\n \"@types/webpack-env\": \"^1.13.6\",\n \"@types/react\": \"^18.0.0\",\n \"webpack\": \"5.91.0\",\n \"@tarojs/taro-loader\": \"4.1.9\",\n \"@tarojs/webpack5-runner\": \"4.1.9\",\n \"less\": \"^4.2.0\",\n \"babel-preset-taro\": \"4.1.9\",\n \"eslint-config-taro\": \"4.1.9\",\n \"eslint\": \"^8.57.0\",\n \"@pmmmwh/react-refresh-webpack-plugin\": \"^0.5.5\",\n \"react-refresh\": \"^0.14.0\",\n \"@babel/preset-react\": \"^7.24.1\",\n \"eslint-plugin-react\": \"^7.34.1\",\n \"eslint-plugin-react-hooks\": \"^4.4.0\",\n \"stylelint\": \"^16.4.0\",\n \"typescript\": \"^5.4.5\",\n \"tsconfig-paths-webpack-plugin\": \"^4.1.0\",\n \"postcss\": \"^8.5.6\",\n \"@types/node\": \"^18\",\n \"@types/minimatch\": \"^5\"\n }\n}\n"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"path": "project.config.json",
|
|
@@ -187,7 +187,7 @@ export var handleProcess = function handleProcess(event, config) {
|
|
|
187
187
|
isSameScope: isSameScope,
|
|
188
188
|
props: props
|
|
189
189
|
}, config);
|
|
190
|
-
code += "".concat(indent, "/** ").concat(props.title, " \u53D8\u91CF ").concat(props.meta.title, " */") + "\n".concat(indent).concat(nextCode, "
|
|
190
|
+
code += "".concat(indent, "/** ").concat(props.title, " \u53D8\u91CF ").concat(props.meta.title, " */") + "\n".concat(indent).concat(nextCode, "$vars.current.").concat(varKey, ".").concat(props.id, "(").concat(nextValue).concat(xpathArg, ")");
|
|
191
191
|
}
|
|
192
192
|
} else if (category === "fx") {
|
|
193
193
|
if (props.meta.global) {
|
|
@@ -202,7 +202,7 @@ export var handleProcess = function handleProcess(event, config) {
|
|
|
202
202
|
isSameScope: isSameScope,
|
|
203
203
|
props: props
|
|
204
204
|
}, config);
|
|
205
|
-
code += "".concat(indent, "/** \u8C03\u7528Fx ").concat(props.meta.title, " */") + "\n".concat(indent).concat(nextCode, "
|
|
205
|
+
code += "".concat(indent, "/** \u8C03\u7528Fx ").concat(props.meta.title, " */") + "\n".concat(indent).concat(nextCode, "$fxs.current.").concat(props.meta.ioProxy.id, "(").concat(nextValue, ")");
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
} else {
|
|
@@ -95,6 +95,17 @@ export var convertRootStyle = function convertRootStyle(style) {
|
|
|
95
95
|
handleLayoutProp(value, rootStyle);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
// widthAuto、heightAuto、widthFull、heightFull
|
|
100
|
+
if (key === "widthAuto" && value === true) {
|
|
101
|
+
rootStyle["width"] = "auto";
|
|
102
|
+
} else if (key === "heightAuto" && value === true) {
|
|
103
|
+
rootStyle["height"] = "auto";
|
|
104
|
+
} else if (key === "widthFull" && value === true) {
|
|
105
|
+
rootStyle["width"] = "100%";
|
|
106
|
+
} else if (key === "heightFull" && value === true) {
|
|
107
|
+
rootStyle["height"] = "100%";
|
|
108
|
+
}
|
|
98
109
|
var camelKey = key.includes("-") ? kebabToCamel(key) : key;
|
|
99
110
|
rootStyle[camelKey] = transformStyleValue(camelKey, value);
|
|
100
111
|
});
|
|
@@ -55,7 +55,7 @@ export var RenderManager = /*#__PURE__*/function () {
|
|
|
55
55
|
code += "".concat(indent, "/** ").concat(description, " */\n");
|
|
56
56
|
}
|
|
57
57
|
code += "".concat(indent, "function ").concat(renderFunctionName, "(params: any) {\n");
|
|
58
|
-
code += "".concat(indent).concat(indent2, "const { comRefs, $vars, $fxs, appContext } = useAppContext();\n");
|
|
58
|
+
code += "".concat(indent).concat(indent2, "const { comRefs, $vars, $fxs, appContext, moduleOutputs } = useAppContext();\n");
|
|
59
59
|
if (logicCode !== null && logicCode !== void 0 && logicCode.includes('$outputs')) {
|
|
60
60
|
code += "".concat(indent).concat(indent2, "const $outputs = comRefs.current.$outputs;\n");
|
|
61
61
|
}
|
|
@@ -8,7 +8,7 @@ export var genRootDefineCode = function genRootDefineCode(indent, utilsPackageNa
|
|
|
8
8
|
var hasJsModules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
9
9
|
var isModule = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
10
10
|
// 使用 useAppContext 获取 comRefs / $vars / $fxs / appContext
|
|
11
|
-
var code = "".concat(indent, "const {comRefs, $vars, $fxs, appContext} = useAppContext();\n");
|
|
11
|
+
var code = isModule ? "".concat(indent, "const {comRefs, $vars, $fxs, appContext, moduleOutputs} = useAppContext();\n") : "".concat(indent, "const {comRefs, $vars, $fxs, appContext} = useAppContext();\n");
|
|
12
12
|
if (!isModule) {
|
|
13
13
|
code += "".concat(indent, "usePageLife();\n");
|
|
14
14
|
}
|
|
@@ -21,8 +21,7 @@ export var genRootDefineCode = function genRootDefineCode(indent, utilsPackageNa
|
|
|
21
21
|
|
|
22
22
|
/** 生成普通插槽定义代码 */
|
|
23
23
|
export var genSlotDefineCode = function genSlotDefineCode(indent) {
|
|
24
|
-
|
|
25
|
-
return "".concat(indent, "const {comRefs, $vars, $fxs, appContext} = useAppContext();\n");
|
|
24
|
+
return "".concat(indent, "const { comRefs, $vars, $fxs, appContext, moduleOutputs } = useAppContext();\n");
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
/** 生成控制器初始化代码 */
|