@mybricks/to-code-taro 1.1.4 → 1.1.5
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/core/comlib/_Connector.js +49 -62
- package/dist/cjs/core/mybricks/createJSHandle.js +2 -1
- package/dist/cjs/core/utils/hooks.js +13 -18
- package/dist/cjs/core/utils/index.js +3 -0
- package/dist/cjs/core/utils/pool.js +63 -0
- package/dist/cjs/core/utils/slots.js +8 -8
- package/dist/cjs/core/utils/useContext.js +8 -6
- package/dist/cjs/generate/generateTaroProjectJson.js +8 -0
- package/dist/cjs/taro-template.json +16 -8
- package/dist/cjs/toCodeTaro.d.ts +1 -1
- package/dist/cjs/toCodeTaro.js +2 -0
- package/dist/cjs/utils/builder/buildResult.d.ts +1 -0
- package/dist/cjs/utils/builder/buildResult.js +53 -0
- package/dist/cjs/utils/context/buildContext.d.ts +7 -0
- package/dist/cjs/utils/context/buildContext.js +11 -0
- package/dist/cjs/utils/templates/renderManager.js +0 -2
- package/dist/esm/core/comlib/_Connector.js +71 -54
- package/dist/esm/core/mybricks/createJSHandle.js +2 -1
- package/dist/esm/core/utils/hooks.js +15 -22
- package/dist/esm/core/utils/index.js +1 -0
- package/dist/esm/core/utils/pool.js +52 -0
- package/dist/esm/core/utils/slots.js +8 -8
- package/dist/esm/core/utils/useContext.js +15 -6
- package/dist/esm/generate/generateTaroProjectJson.js +12 -0
- package/dist/esm/taro-template.json +16 -8
- package/dist/esm/toCodeTaro.d.ts +1 -1
- package/dist/esm/toCodeTaro.js +3 -1
- package/dist/esm/utils/builder/buildResult.d.ts +1 -0
- package/dist/esm/utils/builder/buildResult.js +41 -1
- package/dist/esm/utils/context/buildContext.d.ts +7 -0
- package/dist/esm/utils/context/buildContext.js +12 -0
- package/dist/esm/utils/templates/renderManager.js +2 -1
- package/package.json +1 -1
- package/dist/esm/abstractEventTypeDef.d.ts.map +0 -1
- package/dist/esm/generate/generateTaroTempalteJson.d.ts.map +0 -1
- package/dist/esm/generate/utils/appConfig.d.ts.map +0 -1
- package/dist/esm/generate/utils/fileNode.d.ts.map +0 -1
- package/dist/esm/generate/utils/index.d.ts.map +0 -1
- package/dist/esm/generate/utils/pageImages.d.ts.map +0 -1
- package/dist/esm/generate/utils/tabBarImages.d.ts.map +0 -1
- package/dist/esm/handleExtension.d.ts.map +0 -1
- package/dist/esm/handleModule.d.ts.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/processors/processComEvents.d.ts.map +0 -1
- package/dist/esm/processors/processModule.d.ts.map +0 -1
- package/dist/esm/processors/processScene.d.ts.map +0 -1
- package/dist/esm/processors/processSceneLogic.d.ts.map +0 -1
- package/dist/esm/toCodeTaro.d.ts.map +0 -1
- package/dist/esm/utils/builder/buildResult.d.ts.map +0 -1
- package/dist/esm/utils/common/ImportManager.d.ts.map +0 -1
- package/dist/esm/utils/common/helper.d.ts.map +0 -1
- package/dist/esm/utils/common/object.d.ts.map +0 -1
- package/dist/esm/utils/common/string.d.ts.map +0 -1
- package/dist/esm/utils/config/content/index.d.ts.map +0 -1
- package/dist/esm/utils/config/content/types.d.ts.map +0 -1
- package/dist/esm/utils/config/content/validator.d.ts.map +0 -1
- package/dist/esm/utils/config/handlePageConfig.d.ts.map +0 -1
- package/dist/esm/utils/context/buildContext.d.ts.map +0 -1
- package/dist/esm/utils/context/buildFrameMap.d.ts.map +0 -1
- package/dist/esm/utils/context/buildGlobalData.d.ts.map +0 -1
- package/dist/esm/utils/context/collectJSModules.d.ts.map +0 -1
- package/dist/esm/utils/context/createEventQueries.d.ts.map +0 -1
- package/dist/esm/utils/context/createProvider.d.ts.map +0 -1
- package/dist/esm/utils/index.d.ts.map +0 -1
- package/dist/esm/utils/logic/convertNamespace.d.ts.map +0 -1
- package/dist/esm/utils/logic/genJSModules.d.ts.map +0 -1
- package/dist/esm/utils/style/color.d.ts.map +0 -1
- package/dist/esm/utils/style/getComponentClassName.d.ts.map +0 -1
- package/dist/esm/utils/style/pxtransform.d.ts.map +0 -1
- package/dist/esm/utils/style/types.d.ts.map +0 -1
- package/dist/esm/utils/templates/component.d.ts.map +0 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/core/comlib/_Connector.ts
|
|
@@ -32,61 +22,58 @@ __export(Connector_exports, {
|
|
|
32
22
|
default: () => Connector_default
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(Connector_exports);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.request) == null ? void 0 : _a.call(inputs, (val) => {
|
|
25
|
+
function callCon({ env, data, inputs, outputs, onError }, params = {}) {
|
|
26
|
+
if (data.connector || data.dynamicConfig) {
|
|
42
27
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
header: (val == null ? void 0 : val.headers) || data.headers || {},
|
|
47
|
-
data: (val == null ? void 0 : val.data) || data.data,
|
|
48
|
-
timeout: (val == null ? void 0 : val.timeout) || data.timeout,
|
|
49
|
-
dataType: (val == null ? void 0 : val.dataType) || data.dataType || "json",
|
|
50
|
-
responseType: (val == null ? void 0 : val.responseType) || data.responseType || "text"
|
|
28
|
+
let finnalConnector = {
|
|
29
|
+
...data.connector || {},
|
|
30
|
+
outputSchema: data.outputSchema
|
|
51
31
|
};
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
return;
|
|
32
|
+
if (data.dynamicConfig) {
|
|
33
|
+
finnalConnector = data.dynamicConfig;
|
|
55
34
|
}
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
return;
|
|
35
|
+
if (data.timeout) {
|
|
36
|
+
finnalConnector.timeout = data.timeout;
|
|
59
37
|
}
|
|
60
|
-
|
|
61
|
-
...
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
outputs.onFail({
|
|
71
|
-
message: `请求失败: ${res.statusCode}`,
|
|
72
|
-
statusCode: res.statusCode,
|
|
73
|
-
data: res.data
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
fail: (err) => {
|
|
78
|
-
outputs.onFail({
|
|
79
|
-
message: err.errMsg || "网络请求失败",
|
|
80
|
-
error: err
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error("网络请求失败:", error);
|
|
86
|
-
outputs.onFail({
|
|
87
|
-
message: (error == null ? void 0 : error.message) || "网络请求失败",
|
|
88
|
-
error
|
|
38
|
+
env.request(finnalConnector, params, {
|
|
39
|
+
...data.connectorConfig || {},
|
|
40
|
+
outputSchema: finnalConnector == null ? void 0 : finnalConnector.outputSchema,
|
|
41
|
+
isMultipleOutputs: true
|
|
42
|
+
}).then((val) => {
|
|
43
|
+
outputs[(val == null ? void 0 : val.__OUTPUT_ID__) ?? "then"](
|
|
44
|
+
(val == null ? void 0 : val.__ORIGIN_RESPONSE__) ?? val
|
|
45
|
+
);
|
|
46
|
+
}).catch((err) => {
|
|
47
|
+
outputs["catch"](err);
|
|
89
48
|
});
|
|
49
|
+
} catch (ex) {
|
|
50
|
+
console.error(ex);
|
|
51
|
+
outputs["catch"](`执行错误 ${ex.message || ex}`);
|
|
90
52
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
53
|
+
} else {
|
|
54
|
+
outputs["catch"](`没有选择接口`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isPlainObject(value) {
|
|
58
|
+
if (typeof value !== "object" || value === null)
|
|
59
|
+
return false;
|
|
60
|
+
let proto = Object.getPrototypeOf(value);
|
|
61
|
+
if (proto === null)
|
|
62
|
+
return true;
|
|
63
|
+
return proto === Object.prototype;
|
|
64
|
+
}
|
|
65
|
+
function Connector_default({ env, data, inputs, outputs, onError }) {
|
|
66
|
+
if (!env.runtime) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (data.immediate) {
|
|
70
|
+
callCon({ env, data, outputs });
|
|
71
|
+
} else {
|
|
72
|
+
inputs["call"]((params) => {
|
|
73
|
+
if (!isPlainObject(params)) {
|
|
74
|
+
params = {};
|
|
75
|
+
}
|
|
76
|
+
callCon({ env, data, outputs, onError }, params);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -71,7 +71,8 @@ var createJSHandle = (fn, options) => {
|
|
|
71
71
|
inputs,
|
|
72
72
|
outputs,
|
|
73
73
|
logger: import_log.logger,
|
|
74
|
-
env: appContext == null ? void 0 : appContext.env
|
|
74
|
+
env: appContext == null ? void 0 : appContext.env,
|
|
75
|
+
appContext
|
|
75
76
|
});
|
|
76
77
|
const isJsMultipleInputs = props.inputs[0] ? validateJsMultipleInputs(props.inputs[0]) : false;
|
|
77
78
|
const exeOutputs = new Proxy(
|
|
@@ -29,6 +29,7 @@ module.exports = __toCommonJS(hooks_exports);
|
|
|
29
29
|
var import_react = require("react");
|
|
30
30
|
var import_createReactiveInputHandler = require("../mybricks/createReactiveInputHandler");
|
|
31
31
|
var import_ComContext = require("./ComContext");
|
|
32
|
+
var import_pool = require("./pool");
|
|
32
33
|
function deepProxy(target, onSet) {
|
|
33
34
|
if (target === null || typeof target !== "object" || target.__isProxy)
|
|
34
35
|
return target;
|
|
@@ -56,27 +57,27 @@ function useModel(rawData) {
|
|
|
56
57
|
const dataRef = (0, import_react.useRef)(rawData || {});
|
|
57
58
|
return (0, import_react.useMemo)(() => deepProxy(dataRef.current, () => forceUpdate({})), []);
|
|
58
59
|
}
|
|
59
|
-
function proxyRefs(target, parentComRefs,
|
|
60
|
+
function proxyRefs(target, parentComRefs, todoPool) {
|
|
60
61
|
return new Proxy(target, {
|
|
61
62
|
get(obj, prop) {
|
|
63
|
+
var _a;
|
|
62
64
|
if (prop === "__isProxy")
|
|
63
65
|
return true;
|
|
64
66
|
if (prop === "toJSON")
|
|
65
67
|
return () => obj;
|
|
66
68
|
if (typeof prop === "string" && prop.startsWith("u_") && obj[prop] === void 0) {
|
|
69
|
+
if (((_a = parentComRefs == null ? void 0 : parentComRefs.current) == null ? void 0 : _a[prop]) && !parentComRefs.current[prop].__isShadow) {
|
|
70
|
+
return parentComRefs.current[prop];
|
|
71
|
+
}
|
|
72
|
+
const currentIndex = obj.$index ?? 0;
|
|
67
73
|
return obj[prop] = new Proxy({ __isShadow: true }, {
|
|
68
74
|
get(_, method) {
|
|
69
75
|
if (method === "__isShadow")
|
|
70
76
|
return true;
|
|
71
77
|
return (...args) => {
|
|
72
|
-
if (!(
|
|
78
|
+
if (!(todoPool instanceof import_pool.TodoPool))
|
|
73
79
|
return;
|
|
74
|
-
|
|
75
|
-
if (!globalTodoPool.has(prop))
|
|
76
|
-
globalTodoPool.set(prop, instances);
|
|
77
|
-
const index = obj.$index ?? 0;
|
|
78
|
-
const todo = instances[index] || (instances[index] = {});
|
|
79
|
-
todo[method] = args;
|
|
80
|
+
todoPool.push(prop, currentIndex, method, args);
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
});
|
|
@@ -110,7 +111,7 @@ function proxyRefs(target, parentComRefs, globalTodoPool) {
|
|
|
110
111
|
function useBindInputs(scope, id, initialHandlers) {
|
|
111
112
|
var _a, _b;
|
|
112
113
|
const handlersRef = (0, import_react.useRef)({ ...initialHandlers });
|
|
113
|
-
const {
|
|
114
|
+
const { todoPool } = (0, import_ComContext.useAppContext)();
|
|
114
115
|
const parentSlot = (0, import_ComContext.useParentSlot)();
|
|
115
116
|
const index = ((_b = (_a = parentSlot == null ? void 0 : parentSlot.params) == null ? void 0 : _a.inputValues) == null ? void 0 : _b.index) ?? 0;
|
|
116
117
|
(0, import_react.useEffect)(() => {
|
|
@@ -130,19 +131,13 @@ function useBindInputs(scope, id, initialHandlers) {
|
|
|
130
131
|
return (arg, ...args) => {
|
|
131
132
|
if (typeof arg === "function") {
|
|
132
133
|
handlersRef.current[pin] = arg;
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
if (todo == null ? void 0 : todo[pin]) {
|
|
136
|
-
const pendingArgs = todo[pin];
|
|
134
|
+
const pendingArgs = todoPool == null ? void 0 : todoPool.pop(id, index, pin);
|
|
135
|
+
if (pendingArgs) {
|
|
137
136
|
if (pin === "_setData") {
|
|
138
137
|
arg(...pendingArgs);
|
|
139
138
|
} else {
|
|
140
139
|
(0, import_createReactiveInputHandler.createReactiveInputHandler)({ input: arg, value: pendingArgs[0], rels: {}, title: id });
|
|
141
140
|
}
|
|
142
|
-
delete todo[pin];
|
|
143
|
-
const hasTasks = instances == null ? void 0 : instances.some((inst) => inst && Object.keys(inst).length > 0);
|
|
144
|
-
if (!hasTasks)
|
|
145
|
-
globalTodoInputs.delete(id);
|
|
146
141
|
}
|
|
147
142
|
} else {
|
|
148
143
|
const handler = handlersRef.current[pin];
|
|
@@ -159,7 +154,7 @@ function useBindInputs(scope, id, initialHandlers) {
|
|
|
159
154
|
Object.keys(initialHandlers).forEach((pin) => proxy[pin](initialHandlers[pin]));
|
|
160
155
|
}
|
|
161
156
|
return proxy;
|
|
162
|
-
}, [scope, id,
|
|
157
|
+
}, [scope, id, todoPool, index]);
|
|
163
158
|
}
|
|
164
159
|
function useBindEvents(props, context) {
|
|
165
160
|
return (0, import_react.useMemo)(() => {
|
|
@@ -24,6 +24,7 @@ __export(utils_exports, {
|
|
|
24
24
|
SUBJECT_SUBSCRIBE: () => import_constant.SUBJECT_SUBSCRIBE,
|
|
25
25
|
SUBJECT_VALUE: () => import_constant.SUBJECT_VALUE,
|
|
26
26
|
SlotProvider: () => import_ComContext.SlotProvider,
|
|
27
|
+
TodoPool: () => import_pool.TodoPool,
|
|
27
28
|
WithCom: () => import_with.WithCom,
|
|
28
29
|
WithWrapper: () => import_with.WithWrapper,
|
|
29
30
|
closeActivePopupRouter: () => import_popupRouter.closeActivePopupRouter,
|
|
@@ -39,6 +40,7 @@ __export(utils_exports, {
|
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(utils_exports);
|
|
41
42
|
__reExport(utils_exports, require("./hooks"), module.exports);
|
|
43
|
+
var import_pool = require("./pool");
|
|
42
44
|
var import_with = require("./with");
|
|
43
45
|
var import_PopupRenderer = require("./PopupRenderer");
|
|
44
46
|
var import_pageRouter = require("./pageRouter");
|
|
@@ -54,6 +56,7 @@ __reExport(utils_exports, require("./slots"), module.exports);
|
|
|
54
56
|
SUBJECT_SUBSCRIBE,
|
|
55
57
|
SUBJECT_VALUE,
|
|
56
58
|
SlotProvider,
|
|
59
|
+
TodoPool,
|
|
57
60
|
WithCom,
|
|
58
61
|
WithWrapper,
|
|
59
62
|
closeActivePopupRouter,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/core/utils/pool.ts
|
|
20
|
+
var pool_exports = {};
|
|
21
|
+
__export(pool_exports, {
|
|
22
|
+
TodoPool: () => TodoPool
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(pool_exports);
|
|
25
|
+
var TodoPool = class {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.pool = /* @__PURE__ */ new Map();
|
|
28
|
+
}
|
|
29
|
+
/** 存:记录待执行指令 */
|
|
30
|
+
push(id, index, method, args) {
|
|
31
|
+
if (!this.pool.has(id)) {
|
|
32
|
+
this.pool.set(id, /* @__PURE__ */ new Map());
|
|
33
|
+
}
|
|
34
|
+
const instances = this.pool.get(id);
|
|
35
|
+
if (!instances.has(index)) {
|
|
36
|
+
instances.set(index, {});
|
|
37
|
+
}
|
|
38
|
+
instances.get(index)[method] = args;
|
|
39
|
+
}
|
|
40
|
+
/** 取:获取并物理删除指令 */
|
|
41
|
+
pop(id, index, method) {
|
|
42
|
+
const instances = this.pool.get(id);
|
|
43
|
+
if (!instances)
|
|
44
|
+
return void 0;
|
|
45
|
+
const todo = instances.get(index);
|
|
46
|
+
if (todo && todo[method]) {
|
|
47
|
+
const args = todo[method];
|
|
48
|
+
delete todo[method];
|
|
49
|
+
if (Object.keys(todo).length === 0) {
|
|
50
|
+
instances.delete(index);
|
|
51
|
+
}
|
|
52
|
+
if (instances.size === 0) {
|
|
53
|
+
this.pool.delete(id);
|
|
54
|
+
}
|
|
55
|
+
return args;
|
|
56
|
+
}
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
TodoPool
|
|
63
|
+
});
|
|
@@ -38,9 +38,9 @@ var import_react = __toESM(require("react"));
|
|
|
38
38
|
var import_ComContext = __toESM(require("./ComContext"));
|
|
39
39
|
var import_createReactiveInputHandler = require("../mybricks/createReactiveInputHandler");
|
|
40
40
|
var import_hooks = require("./hooks");
|
|
41
|
-
function createPenetratingComRefs(parentComRefs,
|
|
41
|
+
function createPenetratingComRefs(parentComRefs, todoPool, index = 0) {
|
|
42
42
|
const localTarget = { $inputs: {}, $outputs: {}, $index: index };
|
|
43
|
-
return { current: (0, import_hooks.proxyRefs)(localTarget, parentComRefs,
|
|
43
|
+
return { current: (0, import_hooks.proxyRefs)(localTarget, parentComRefs, todoPool) };
|
|
44
44
|
}
|
|
45
45
|
function SlotParamsBridge(props) {
|
|
46
46
|
var _a, _b;
|
|
@@ -76,7 +76,7 @@ function createChannelProxy(title) {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
function useEnhancedSlots(rawSlots, id) {
|
|
79
|
-
const { comRefs: parentComRefs,
|
|
79
|
+
const { comRefs: parentComRefs, todoPool } = (0, import_ComContext.useAppContext)();
|
|
80
80
|
const slotStoreRef = (0, import_react.useRef)({});
|
|
81
81
|
return (0, import_react.useMemo)(() => {
|
|
82
82
|
if (!rawSlots)
|
|
@@ -90,15 +90,15 @@ function useEnhancedSlots(rawSlots, id) {
|
|
|
90
90
|
_scopedComRefs: {},
|
|
91
91
|
_render: void 0,
|
|
92
92
|
render: (params) => {
|
|
93
|
-
var _a, _b, _c
|
|
93
|
+
var _a, _b, _c;
|
|
94
94
|
const r = state._render;
|
|
95
|
-
const rawScope = (
|
|
95
|
+
const rawScope = ((_a = params == null ? void 0 : params.inputValues) == null ? void 0 : _a.index) ?? (params == null ? void 0 : params.key);
|
|
96
96
|
if (rawScope === void 0 || rawScope === null) {
|
|
97
97
|
return /* @__PURE__ */ import_react.default.createElement(SlotParamsBridge, { state, params, render: r });
|
|
98
98
|
}
|
|
99
99
|
const scopeId = `${id}.${slotKey}::${String(rawScope)}`;
|
|
100
|
-
const index = ((
|
|
101
|
-
const scopedComRefs = (
|
|
100
|
+
const index = ((_b = params == null ? void 0 : params.inputValues) == null ? void 0 : _b.index) ?? 0;
|
|
101
|
+
const scopedComRefs = (_c = state._scopedComRefs)[scopeId] || (_c[scopeId] = createPenetratingComRefs(parentComRefs, todoPool, index));
|
|
102
102
|
return /* @__PURE__ */ import_react.default.createElement(ScopedComContextProvider, { comRefs: scopedComRefs, scopeId }, /* @__PURE__ */ import_react.default.createElement(SlotParamsBridge, { state, params, render: r }));
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -112,7 +112,7 @@ function useEnhancedSlots(rawSlots, id) {
|
|
|
112
112
|
};
|
|
113
113
|
});
|
|
114
114
|
return nextSlots;
|
|
115
|
-
}, [rawSlots, id, parentComRefs,
|
|
115
|
+
}, [rawSlots, id, parentComRefs, todoPool]);
|
|
116
116
|
}
|
|
117
117
|
function ScopedComContextProvider(props) {
|
|
118
118
|
const parent = (0, import_ComContext.useAppContext)();
|
|
@@ -24,10 +24,11 @@ __export(useContext_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(useContext_exports);
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_hooks = require("./hooks");
|
|
27
|
-
var
|
|
27
|
+
var import_pool = require("./pool");
|
|
28
|
+
var import_request = require("@/common/request");
|
|
28
29
|
function useAppCreateContext(id) {
|
|
29
|
-
const
|
|
30
|
-
const comRefs = (0, import_react.useRef)((0, import_hooks.proxyRefs)({ $inputs: {}, $outputs: {} }, void 0,
|
|
30
|
+
const todoPool = (0, import_react.useMemo)(() => new import_pool.TodoPool(), []);
|
|
31
|
+
const comRefs = (0, import_react.useRef)((0, import_hooks.proxyRefs)({ $inputs: {}, $outputs: {} }, void 0, todoPool));
|
|
31
32
|
const $vars = (0, import_react.useRef)({});
|
|
32
33
|
const $fxs = (0, import_react.useRef)({});
|
|
33
34
|
const [popupState, setPopupState] = (0, import_react.useState)({
|
|
@@ -40,8 +41,9 @@ function useAppCreateContext(id) {
|
|
|
40
41
|
canvas: {
|
|
41
42
|
id
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
env: {
|
|
45
|
+
runtime: true,
|
|
46
|
+
request: (connector, params, config) => (0, import_request.request)(connector, params, config, { $vars })
|
|
45
47
|
},
|
|
46
48
|
edit: false,
|
|
47
49
|
isH5: false,
|
|
@@ -58,7 +60,7 @@ function useAppCreateContext(id) {
|
|
|
58
60
|
comRefs,
|
|
59
61
|
$vars,
|
|
60
62
|
$fxs,
|
|
61
|
-
|
|
63
|
+
todoPool,
|
|
62
64
|
appContext,
|
|
63
65
|
popupState,
|
|
64
66
|
setPopupState
|
|
@@ -164,6 +164,14 @@ ${item.content || ""}`;
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
(0, import_commonDir.handleCommonDir)(commonDir, files);
|
|
167
|
+
const apiItem = files.find((item) => item.type === "connector-api");
|
|
168
|
+
if (apiItem) {
|
|
169
|
+
commonDir.children = commonDir.children || [];
|
|
170
|
+
commonDir.children.push({
|
|
171
|
+
path: "src/common/api.ts",
|
|
172
|
+
content: apiItem.content
|
|
173
|
+
});
|
|
174
|
+
}
|
|
167
175
|
const popupFile = files.find((f) => f.type === "popup" && !f.meta);
|
|
168
176
|
if (popupFile) {
|
|
169
177
|
commonDir.children.push({
|