@mybricks/to-code-taro 1.1.8 → 1.2.2
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/generate/generateTaroProjectJson.js +11 -11
- package/dist/cjs/handleModule.js +1 -1
- package/dist/cjs/taro-template.json +6 -6008
- package/dist/cjs/utils/logic/handleProcess.js +1 -1
- package/dist/esm/generate/generateTaroProjectJson.js +12 -12
- package/dist/esm/handleModule.js +1 -1
- package/dist/esm/taro-template.json +6 -6008
- package/dist/esm/utils/logic/handleProcess.js +1 -1
- package/package.json +3 -9
- package/README.md +0 -58
- package/dist/cjs/core/mybricks/MyBricksDescriptor.js +0 -213
- package/dist/cjs/core/mybricks/Subject.js +0 -119
- package/dist/cjs/core/mybricks/constant.js +0 -70
- package/dist/cjs/core/mybricks/context.js +0 -33
- package/dist/cjs/core/mybricks/createEnv.js +0 -39
- package/dist/cjs/core/mybricks/createJSHandle.js +0 -191
- package/dist/cjs/core/mybricks/createModuleEventsHandle.js +0 -49
- package/dist/cjs/core/mybricks/createReactiveInputHandler.js +0 -63
- package/dist/cjs/core/mybricks/event.js +0 -70
- package/dist/cjs/core/mybricks/index.js +0 -871
- package/dist/cjs/core/mybricks/log.js +0 -37
- package/dist/cjs/core/mybricks/utils.js +0 -69
- package/dist/cjs/core/mybricks/variables.js +0 -217
- package/dist/cjs/core/utils/ComContext.js +0 -51
- package/dist/cjs/core/utils/PopupRenderer.js +0 -63
- package/dist/cjs/core/utils/comRefResolver.js +0 -112
- package/dist/cjs/core/utils/event.js +0 -53
- package/dist/cjs/core/utils/hooks.js +0 -238
- package/dist/cjs/core/utils/index.js +0 -77
- package/dist/cjs/core/utils/pageRouter.js +0 -104
- package/dist/cjs/core/utils/pool.js +0 -63
- package/dist/cjs/core/utils/popupRouter.js +0 -98
- package/dist/cjs/core/utils/slots.js +0 -183
- package/dist/cjs/core/utils/tabbar.js +0 -56
- package/dist/cjs/core/utils/useContext.js +0 -112
- package/dist/cjs/core/utils/with.js +0 -109
- package/dist/esm/core/mybricks/MyBricksDescriptor.js +0 -232
- package/dist/esm/core/mybricks/Subject.js +0 -149
- package/dist/esm/core/mybricks/constant.js +0 -18
- package/dist/esm/core/mybricks/context.js +0 -5
- package/dist/esm/core/mybricks/createEnv.js +0 -9
- package/dist/esm/core/mybricks/createJSHandle.js +0 -189
- package/dist/esm/core/mybricks/createModuleEventsHandle.js +0 -26
- package/dist/esm/core/mybricks/createReactiveInputHandler.js +0 -40
- package/dist/esm/core/mybricks/event.js +0 -44
- package/dist/esm/core/mybricks/index.js +0 -952
- package/dist/esm/core/mybricks/log.js +0 -8
- package/dist/esm/core/mybricks/utils.js +0 -41
- package/dist/esm/core/mybricks/variables.js +0 -190
- package/dist/esm/core/utils/ComContext.js +0 -16
- package/dist/esm/core/utils/PopupRenderer.js +0 -27
- package/dist/esm/core/utils/comRefResolver.js +0 -134
- package/dist/esm/core/utils/event.js +0 -32
- package/dist/esm/core/utils/hooks.js +0 -287
- package/dist/esm/core/utils/index.js +0 -12
- package/dist/esm/core/utils/pageRouter.js +0 -112
- package/dist/esm/core/utils/pool.js +0 -52
- package/dist/esm/core/utils/popupRouter.js +0 -117
- package/dist/esm/core/utils/slots.js +0 -194
- package/dist/esm/core/utils/tabbar.js +0 -47
- package/dist/esm/core/utils/useContext.js +0 -100
- package/dist/esm/core/utils/with.js +0 -115
|
@@ -1,37 +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/core/mybricks/log.js
|
|
20
|
-
var log_exports = {};
|
|
21
|
-
__export(log_exports, {
|
|
22
|
-
log: () => log,
|
|
23
|
-
logger: () => logger
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(log_exports);
|
|
26
|
-
var log = (...args) => {
|
|
27
|
-
};
|
|
28
|
-
var logger = {
|
|
29
|
-
info: log,
|
|
30
|
-
warn: log,
|
|
31
|
-
error: log
|
|
32
|
-
};
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
log,
|
|
36
|
-
logger
|
|
37
|
-
});
|
|
@@ -1,69 +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/core/mybricks/utils.js
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
isObject: () => isObject,
|
|
23
|
-
safeGetByPath: () => safeGetByPath,
|
|
24
|
-
safeSetByPath: () => safeSetByPath
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(utils_exports);
|
|
27
|
-
var safeSetByPath = (params) => {
|
|
28
|
-
const { data, path, value } = params;
|
|
29
|
-
const nextIndex = path.length - 1;
|
|
30
|
-
let current = data;
|
|
31
|
-
let errorFlag = false;
|
|
32
|
-
for (let i = 0; i < nextIndex; i++) {
|
|
33
|
-
try {
|
|
34
|
-
current = current[path[i]];
|
|
35
|
-
} catch (error) {
|
|
36
|
-
errorFlag = true;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (!errorFlag) {
|
|
41
|
-
current[path[nextIndex]] = value;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var safeGetByPath = (params) => {
|
|
45
|
-
const { data, path } = params;
|
|
46
|
-
let current = data;
|
|
47
|
-
let errorFlag = false;
|
|
48
|
-
for (let i = 0; i < path.length; i++) {
|
|
49
|
-
try {
|
|
50
|
-
current = current[path[i]];
|
|
51
|
-
} catch (error) {
|
|
52
|
-
errorFlag = true;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (!errorFlag) {
|
|
57
|
-
return current;
|
|
58
|
-
}
|
|
59
|
-
return void 0;
|
|
60
|
-
};
|
|
61
|
-
var isObject = (value) => {
|
|
62
|
-
return value && typeof value === "object";
|
|
63
|
-
};
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
isObject,
|
|
67
|
-
safeGetByPath,
|
|
68
|
-
safeSetByPath
|
|
69
|
-
});
|
|
@@ -1,217 +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/core/mybricks/variables.js
|
|
20
|
-
var variables_exports = {};
|
|
21
|
-
__export(variables_exports, {
|
|
22
|
-
createVariable: () => createVariable,
|
|
23
|
-
createVars: () => createVars
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(variables_exports);
|
|
26
|
-
var import_Subject = require("./Subject");
|
|
27
|
-
var import_context = require("./context");
|
|
28
|
-
var import_utils = require("./utils");
|
|
29
|
-
var import_constant = require("./constant");
|
|
30
|
-
var createVariable = (...args) => {
|
|
31
|
-
const hasDefaultValue = args.length > 0;
|
|
32
|
-
const initValue = args[0];
|
|
33
|
-
const value = new import_Subject.Subject();
|
|
34
|
-
if (hasDefaultValue) {
|
|
35
|
-
value[import_constant.SUBJECT_NEXT](initValue);
|
|
36
|
-
}
|
|
37
|
-
const ref = {
|
|
38
|
-
value,
|
|
39
|
-
callBacksMap: /* @__PURE__ */ new Map(),
|
|
40
|
-
// 注册change后,设置一个subject,用于触发change
|
|
41
|
-
changeValues: /* @__PURE__ */ new Set(),
|
|
42
|
-
// change到上述subject的映射
|
|
43
|
-
changeValuesMap: /* @__PURE__ */ new Map()
|
|
44
|
-
};
|
|
45
|
-
const variable = {
|
|
46
|
-
/** 读取 */
|
|
47
|
-
get(value2, path) {
|
|
48
|
-
const nextValue = new import_Subject.Subject();
|
|
49
|
-
const next = () => {
|
|
50
|
-
nextValue[import_constant.SUBJECT_NEXT](path ? (0, import_utils.safeGetByPath)({
|
|
51
|
-
data: ref.value[import_constant.SUBJECT_VALUE],
|
|
52
|
-
path: path.split(".")
|
|
53
|
-
}) : ref.value[import_constant.SUBJECT_VALUE]);
|
|
54
|
-
};
|
|
55
|
-
if (value2 == null ? void 0 : value2[import_constant.SUBJECT_SUBSCRIBE]) {
|
|
56
|
-
value2[import_constant.SUBJECT_SUBSCRIBE](() => {
|
|
57
|
-
next();
|
|
58
|
-
});
|
|
59
|
-
} else {
|
|
60
|
-
next();
|
|
61
|
-
}
|
|
62
|
-
return nextValue;
|
|
63
|
-
},
|
|
64
|
-
/** 赋值 */
|
|
65
|
-
set(value2, path) {
|
|
66
|
-
const nextValue = new import_Subject.Subject();
|
|
67
|
-
const next = (value3, extra) => {
|
|
68
|
-
if (path) {
|
|
69
|
-
const isEmpty = ref.value[import_constant.SUBJECT_EMPTY];
|
|
70
|
-
if (isEmpty) {
|
|
71
|
-
ref.value[import_constant.SUBJECT_SETVALUE]({});
|
|
72
|
-
}
|
|
73
|
-
(0, import_utils.safeSetByPath)({
|
|
74
|
-
data: ref.value[import_constant.SUBJECT_VALUE],
|
|
75
|
-
path: path.split("."),
|
|
76
|
-
value: value3
|
|
77
|
-
});
|
|
78
|
-
value3 = ref.value[import_constant.SUBJECT_VALUE];
|
|
79
|
-
}
|
|
80
|
-
ref.value[import_constant.SUBJECT_NEXT](value3, extra);
|
|
81
|
-
ref.changeValues.forEach((changeValue) => {
|
|
82
|
-
changeValue[import_constant.SUBJECT_NEXT](value3, extra);
|
|
83
|
-
});
|
|
84
|
-
nextValue[import_constant.SUBJECT_NEXT](value3, extra);
|
|
85
|
-
};
|
|
86
|
-
if (value2 == null ? void 0 : value2[import_constant.SUBJECT_SUBSCRIBE]) {
|
|
87
|
-
value2[import_constant.SUBJECT_SUBSCRIBE]((value3, extra) => {
|
|
88
|
-
next(value3, extra);
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
next(value2);
|
|
92
|
-
}
|
|
93
|
-
return nextValue;
|
|
94
|
-
},
|
|
95
|
-
/** 重置 */
|
|
96
|
-
reset(value2) {
|
|
97
|
-
const nextValue = new import_Subject.Subject();
|
|
98
|
-
const next = () => {
|
|
99
|
-
ref.value[import_constant.SUBJECT_NEXT](initValue);
|
|
100
|
-
ref.changeValues.forEach((changeValue) => {
|
|
101
|
-
changeValue[import_constant.SUBJECT_NEXT](initValue);
|
|
102
|
-
});
|
|
103
|
-
nextValue[import_constant.SUBJECT_NEXT](initValue);
|
|
104
|
-
};
|
|
105
|
-
if (value2 == null ? void 0 : value2[import_constant.SUBJECT_SUBSCRIBE]) {
|
|
106
|
-
value2[import_constant.SUBJECT_SUBSCRIBE](() => {
|
|
107
|
-
next();
|
|
108
|
-
});
|
|
109
|
-
} else {
|
|
110
|
-
next();
|
|
111
|
-
}
|
|
112
|
-
return nextValue;
|
|
113
|
-
},
|
|
114
|
-
/** 值变更监听 */
|
|
115
|
-
changed() {
|
|
116
|
-
const changeValue = new import_Subject.Subject();
|
|
117
|
-
ref.changeValues.add(changeValue);
|
|
118
|
-
const result = {
|
|
119
|
-
destroy() {
|
|
120
|
-
ref.changeValues.delete(changeValue);
|
|
121
|
-
},
|
|
122
|
-
[import_constant.SUBJECT_SUBSCRIBE](next) {
|
|
123
|
-
changeValue[import_constant.SUBJECT_SUBSCRIBE](next);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
if (import_context.context.apiRun) {
|
|
127
|
-
if (!import_context.context.apiRunVariablesSubject[import_context.context.apiRun]) {
|
|
128
|
-
import_context.context.apiRunVariablesSubject[import_context.context.apiRun] = [result];
|
|
129
|
-
} else {
|
|
130
|
-
import_context.context.apiRunVariablesSubject[import_context.context.apiRun].push(result);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return result;
|
|
134
|
-
},
|
|
135
|
-
bind(callBack) {
|
|
136
|
-
if (!ref.callBacksMap.has("")) {
|
|
137
|
-
ref.callBacksMap.set("", /* @__PURE__ */ new Set());
|
|
138
|
-
}
|
|
139
|
-
const callBacks = ref.callBacksMap.get("");
|
|
140
|
-
callBacks.add(callBack);
|
|
141
|
-
callBack(ref.value[import_constant.SUBJECT_VALUE]);
|
|
142
|
-
},
|
|
143
|
-
ext() {
|
|
144
|
-
return {
|
|
145
|
-
setValue(value2) {
|
|
146
|
-
variable.set(value2);
|
|
147
|
-
},
|
|
148
|
-
getValue() {
|
|
149
|
-
return ref.value[import_constant.SUBJECT_VALUE];
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
registerChange(change) {
|
|
154
|
-
const changeValue = new import_Subject.Subject();
|
|
155
|
-
change(changeValue);
|
|
156
|
-
ref.changeValues.add(changeValue);
|
|
157
|
-
ref.changeValuesMap.set(change, changeValue);
|
|
158
|
-
if (!ref.value[import_constant.SUBJECT_EMPTY]) {
|
|
159
|
-
changeValue[import_constant.SUBJECT_NEXT](ref.value[import_constant.SUBJECT_VALUE]);
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
unregisterChange(change) {
|
|
163
|
-
const changeValue = ref.changeValuesMap.get(change);
|
|
164
|
-
ref.changeValues.delete(changeValue);
|
|
165
|
-
ref.changeValuesMap.delete(change);
|
|
166
|
-
},
|
|
167
|
-
// 内置的赋值操作
|
|
168
|
-
setTrue() {
|
|
169
|
-
return variable.set(true);
|
|
170
|
-
},
|
|
171
|
-
setFalse() {
|
|
172
|
-
return variable.set(false);
|
|
173
|
-
},
|
|
174
|
-
setAryAdd(value2) {
|
|
175
|
-
const nextValue = new import_Subject.Subject();
|
|
176
|
-
if (Array.isArray(ref.value[import_constant.SUBJECT_VALUE])) {
|
|
177
|
-
const next = (value3) => {
|
|
178
|
-
const arrayValue = ref.value[import_constant.SUBJECT_VALUE].concat(value3);
|
|
179
|
-
ref.value[import_constant.SUBJECT_NEXT](arrayValue);
|
|
180
|
-
ref.changeValues.forEach((changeValue) => {
|
|
181
|
-
changeValue[import_constant.SUBJECT_NEXT](value3);
|
|
182
|
-
});
|
|
183
|
-
nextValue[import_constant.SUBJECT_NEXT](arrayValue);
|
|
184
|
-
};
|
|
185
|
-
if (value2 == null ? void 0 : value2[import_constant.SUBJECT_SUBSCRIBE]) {
|
|
186
|
-
value2[import_constant.SUBJECT_SUBSCRIBE]((value3) => {
|
|
187
|
-
next(value3);
|
|
188
|
-
});
|
|
189
|
-
} else {
|
|
190
|
-
next(value2);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return nextValue;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
return new Proxy({}, {
|
|
197
|
-
get(_, key) {
|
|
198
|
-
return variable[key];
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
var createVars = (vars) => {
|
|
203
|
-
return new Proxy(vars, {
|
|
204
|
-
get(target, key) {
|
|
205
|
-
const value = target[key];
|
|
206
|
-
if (value) {
|
|
207
|
-
return value.get()[import_constant.SUBJECT_VALUE];
|
|
208
|
-
}
|
|
209
|
-
return value;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
214
|
-
0 && (module.exports = {
|
|
215
|
-
createVariable,
|
|
216
|
-
createVars
|
|
217
|
-
});
|
|
@@ -1,51 +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/core/utils/ComContext.tsx
|
|
20
|
-
var ComContext_exports = {};
|
|
21
|
-
__export(ComContext_exports, {
|
|
22
|
-
SlotProvider: () => SlotProvider,
|
|
23
|
-
default: () => ComContext_default,
|
|
24
|
-
pageRouter: () => import_pageRouter.pageRouter,
|
|
25
|
-
useAppContext: () => useAppContext,
|
|
26
|
-
useParentSlot: () => useParentSlot
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(ComContext_exports);
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var import_pageRouter = require("./pageRouter");
|
|
31
|
-
var ComContext = (0, import_react.createContext)(void 0);
|
|
32
|
-
var SlotContext = (0, import_react.createContext)(null);
|
|
33
|
-
function useAppContext() {
|
|
34
|
-
const context = (0, import_react.useContext)(ComContext);
|
|
35
|
-
if (!context) {
|
|
36
|
-
throw new Error("useAppContext must be used within a ComContext.Provider");
|
|
37
|
-
}
|
|
38
|
-
return context;
|
|
39
|
-
}
|
|
40
|
-
function useParentSlot() {
|
|
41
|
-
return (0, import_react.useContext)(SlotContext);
|
|
42
|
-
}
|
|
43
|
-
var SlotProvider = SlotContext.Provider;
|
|
44
|
-
var ComContext_default = ComContext;
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
SlotProvider,
|
|
48
|
-
pageRouter,
|
|
49
|
-
useAppContext,
|
|
50
|
-
useParentSlot
|
|
51
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
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
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/utils/PopupRenderer.tsx
|
|
30
|
-
var PopupRenderer_exports = {};
|
|
31
|
-
__export(PopupRenderer_exports, {
|
|
32
|
-
PopupRenderer: () => PopupRenderer
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(PopupRenderer_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_components = require("@tarojs/components");
|
|
37
|
-
var import_ComContext = require("./ComContext");
|
|
38
|
-
var PopupRenderer = ({ popupMap }) => {
|
|
39
|
-
const { popupState } = (0, import_ComContext.useAppContext)();
|
|
40
|
-
const ActivePopup = popupState.visible && popupMap[popupState.name] ? popupMap[popupState.name] : null;
|
|
41
|
-
if (!ActivePopup)
|
|
42
|
-
return /* @__PURE__ */ import_react.default.createElement(import_components.View, null);
|
|
43
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
44
|
-
import_components.View,
|
|
45
|
-
{
|
|
46
|
-
className: "global-popup-container",
|
|
47
|
-
style: {
|
|
48
|
-
position: "fixed",
|
|
49
|
-
top: 0,
|
|
50
|
-
left: 0,
|
|
51
|
-
right: 0,
|
|
52
|
-
bottom: 0,
|
|
53
|
-
zIndex: 999999,
|
|
54
|
-
pointerEvents: "auto"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
/* @__PURE__ */ import_react.default.createElement(import_components.View, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ import_react.default.createElement(ActivePopup, null))
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
PopupRenderer
|
|
63
|
-
});
|
|
@@ -1,112 +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/core/utils/comRefResolver.ts
|
|
20
|
-
var comRefResolver_exports = {};
|
|
21
|
-
__export(comRefResolver_exports, {
|
|
22
|
-
ComRefResolver: () => ComRefResolver
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(comRefResolver_exports);
|
|
25
|
-
var import_pool = require("./pool");
|
|
26
|
-
var ComRefResolver = class {
|
|
27
|
-
constructor(registry, parent, todoPool, scopeIndex = 0) {
|
|
28
|
-
this.registry = registry;
|
|
29
|
-
this.parent = parent;
|
|
30
|
-
this.todoPool = todoPool;
|
|
31
|
-
this.scopeIndex = scopeIndex;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* 获取组件引用
|
|
35
|
-
* @returns 真实引用或影子对象
|
|
36
|
-
*/
|
|
37
|
-
get(id) {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
if (this.registry[id] && !this.registry[id].__isShadow) {
|
|
40
|
-
return this.registry[id];
|
|
41
|
-
}
|
|
42
|
-
const parentRef = (_a = this.parent) == null ? void 0 : _a.findRealRef(id);
|
|
43
|
-
if (parentRef) {
|
|
44
|
-
return parentRef;
|
|
45
|
-
}
|
|
46
|
-
if ((_b = this.registry[id]) == null ? void 0 : _b.__isShadow) {
|
|
47
|
-
return this.registry[id];
|
|
48
|
-
}
|
|
49
|
-
return this.createShadowProxy(id);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* 注册真实引用
|
|
53
|
-
*/
|
|
54
|
-
set(id, ref) {
|
|
55
|
-
var _a;
|
|
56
|
-
this.registry[id] = ref;
|
|
57
|
-
(_a = this.parent) == null ? void 0 : _a.set(id, ref);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 删除引用
|
|
61
|
-
*/
|
|
62
|
-
delete(id) {
|
|
63
|
-
var _a;
|
|
64
|
-
delete this.registry[id];
|
|
65
|
-
(_a = this.parent) == null ? void 0 : _a.delete(id);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 查找真实引用(仅用于父级链查找)
|
|
69
|
-
*/
|
|
70
|
-
findRealRef(id) {
|
|
71
|
-
var _a;
|
|
72
|
-
const local = this.registry[id];
|
|
73
|
-
if (local && !local.__isShadow) {
|
|
74
|
-
return local;
|
|
75
|
-
}
|
|
76
|
-
return ((_a = this.parent) == null ? void 0 : _a.findRealRef(id)) ?? null;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* 创建影子对象
|
|
80
|
-
* 关键:影子对象的方法被调用时,会动态查找真实引用
|
|
81
|
-
*/
|
|
82
|
-
createShadowProxy(id) {
|
|
83
|
-
const resolver = this;
|
|
84
|
-
const registry = this.registry;
|
|
85
|
-
const todoPool = this.todoPool;
|
|
86
|
-
const scopeIndex = this.scopeIndex;
|
|
87
|
-
const shadow = new Proxy({ __isShadow: true }, {
|
|
88
|
-
get(_, method) {
|
|
89
|
-
if (method === "__isShadow")
|
|
90
|
-
return true;
|
|
91
|
-
return (...args) => {
|
|
92
|
-
const realRef = registry[id];
|
|
93
|
-
if (realRef && !realRef.__isShadow) {
|
|
94
|
-
if (typeof realRef[method] === "function") {
|
|
95
|
-
return realRef[method](...args);
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (todoPool instanceof import_pool.TodoPool) {
|
|
100
|
-
todoPool.push(id, scopeIndex, method, args);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
this.registry[id] = shadow;
|
|
106
|
-
return shadow;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
ComRefResolver
|
|
112
|
-
});
|
|
@@ -1,53 +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/core/utils/event.ts
|
|
20
|
-
var event_exports = {};
|
|
21
|
-
__export(event_exports, {
|
|
22
|
-
EventEmitter: () => EventEmitter
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(event_exports);
|
|
25
|
-
var EventEmitter = class {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.eventsCache = {};
|
|
28
|
-
this.addEventListner = (evtName, listner) => {
|
|
29
|
-
if (!this.eventsCache[evtName]) {
|
|
30
|
-
this.eventsCache[evtName] = /* @__PURE__ */ new Set([listner]);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this.eventsCache[evtName].add(listner);
|
|
34
|
-
};
|
|
35
|
-
this.removeEventListner = (evtName, listner) => {
|
|
36
|
-
if (this.eventsCache[evtName]) {
|
|
37
|
-
this.eventsCache[evtName].delete(listner);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.dispatch = (evtName, detail) => {
|
|
41
|
-
if (!this.eventsCache[evtName]) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
let hasPreventDefault = false;
|
|
45
|
-
(this.eventsCache[evtName] ?? []).forEach((listner) => listner(detail));
|
|
46
|
-
return hasPreventDefault;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
EventEmitter
|
|
53
|
-
});
|