@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,238 +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/hooks.ts
|
|
20
|
-
var hooks_exports = {};
|
|
21
|
-
__export(hooks_exports, {
|
|
22
|
-
deepProxy: () => deepProxy,
|
|
23
|
-
proxyRefs: () => proxyRefs,
|
|
24
|
-
useBindInputs: () => useBindInputs,
|
|
25
|
-
useBindOutputs: () => useBindOutputs,
|
|
26
|
-
useBuiltinHandlers: () => useBuiltinHandlers,
|
|
27
|
-
useModel: () => useModel
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_createReactiveInputHandler = require("../mybricks/createReactiveInputHandler");
|
|
32
|
-
var import_ComContext = require("./ComContext");
|
|
33
|
-
var import_comRefResolver = require("./comRefResolver");
|
|
34
|
-
function deepProxy(target, onSet) {
|
|
35
|
-
if (target === null || typeof target !== "object" || target.__isProxy)
|
|
36
|
-
return target;
|
|
37
|
-
return new Proxy(target, {
|
|
38
|
-
get(obj, prop) {
|
|
39
|
-
if (prop === "__isProxy")
|
|
40
|
-
return true;
|
|
41
|
-
if (prop === "toJSON")
|
|
42
|
-
return () => obj;
|
|
43
|
-
const value = obj[prop];
|
|
44
|
-
if (typeof value === "object" && value !== null && !value.__isProxy) {
|
|
45
|
-
obj[prop] = deepProxy(value, onSet);
|
|
46
|
-
}
|
|
47
|
-
return obj[prop];
|
|
48
|
-
},
|
|
49
|
-
set(obj, prop, value) {
|
|
50
|
-
const result = Reflect.set(obj, prop, value);
|
|
51
|
-
onSet == null ? void 0 : onSet();
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function useModel(rawData) {
|
|
57
|
-
const [, forceUpdate] = (0, import_react.useState)({});
|
|
58
|
-
const dataRef = (0, import_react.useRef)(rawData || {});
|
|
59
|
-
return (0, import_react.useMemo)(() => deepProxy(dataRef.current, () => forceUpdate({})), []);
|
|
60
|
-
}
|
|
61
|
-
function proxyRefs(target, parentComRefs, todoPool) {
|
|
62
|
-
var _a;
|
|
63
|
-
const parentResolver = (_a = parentComRefs == null ? void 0 : parentComRefs.current) == null ? void 0 : _a.__resolver;
|
|
64
|
-
const scopeIndex = target.$index ?? 0;
|
|
65
|
-
const resolver = new import_comRefResolver.ComRefResolver(target, parentResolver, todoPool, scopeIndex);
|
|
66
|
-
target.__resolver = resolver;
|
|
67
|
-
return new Proxy(target, {
|
|
68
|
-
get(obj, prop) {
|
|
69
|
-
if (prop === "__isProxy")
|
|
70
|
-
return true;
|
|
71
|
-
if (prop === "__resolver")
|
|
72
|
-
return resolver;
|
|
73
|
-
if (prop === "toJSON")
|
|
74
|
-
return () => obj;
|
|
75
|
-
if (typeof prop === "string" && prop.startsWith("u_")) {
|
|
76
|
-
return resolver.get(prop);
|
|
77
|
-
}
|
|
78
|
-
return obj[prop];
|
|
79
|
-
},
|
|
80
|
-
set(obj, prop, value) {
|
|
81
|
-
const result = Reflect.set(obj, prop, value);
|
|
82
|
-
const isRealRef = typeof prop === "string" && !prop.startsWith("$") && (value == null ? void 0 : value.__isShadow) !== true;
|
|
83
|
-
if (isRealRef && typeof prop === "string" && prop.startsWith("u_")) {
|
|
84
|
-
resolver.set(prop, value);
|
|
85
|
-
} else if (isRealRef && (parentComRefs == null ? void 0 : parentComRefs.current)) {
|
|
86
|
-
try {
|
|
87
|
-
parentComRefs.current[prop] = value;
|
|
88
|
-
} catch {
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
},
|
|
93
|
-
deleteProperty(obj, prop) {
|
|
94
|
-
const result = Reflect.deleteProperty(obj, prop);
|
|
95
|
-
if (typeof prop === "string" && prop.startsWith("u_")) {
|
|
96
|
-
resolver.delete(prop);
|
|
97
|
-
} else if (typeof prop === "string" && !prop.startsWith("$") && (parentComRefs == null ? void 0 : parentComRefs.current)) {
|
|
98
|
-
try {
|
|
99
|
-
delete parentComRefs.current[prop];
|
|
100
|
-
} catch {
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function useBindInputs(scope, id, initialHandlers) {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const handlersRef = (0, import_react.useRef)({ ...initialHandlers });
|
|
110
|
-
const { todoPool } = (0, import_ComContext.useAppContext)();
|
|
111
|
-
const parentSlot = (0, import_ComContext.useParentSlot)();
|
|
112
|
-
const index = ((_b = (_a = parentSlot == null ? void 0 : parentSlot.params) == null ? void 0 : _a.inputValues) == null ? void 0 : _b.index) ?? 0;
|
|
113
|
-
(0, import_react.useEffect)(() => {
|
|
114
|
-
return () => {
|
|
115
|
-
if (scope == null ? void 0 : scope.current) {
|
|
116
|
-
delete scope.current[id];
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}, [scope, id]);
|
|
120
|
-
return (0, import_react.useMemo)(() => {
|
|
121
|
-
const proxy = new Proxy({}, {
|
|
122
|
-
get: (target, pin) => {
|
|
123
|
-
if (pin === "__isShadow")
|
|
124
|
-
return false;
|
|
125
|
-
if (pin === "__isLazyProxy")
|
|
126
|
-
return false;
|
|
127
|
-
if (pin === "toJSON")
|
|
128
|
-
return () => target;
|
|
129
|
-
return (arg, ...args) => {
|
|
130
|
-
if (typeof arg === "function") {
|
|
131
|
-
handlersRef.current[pin] = arg;
|
|
132
|
-
const pendingArgs = todoPool == null ? void 0 : todoPool.pop(id, index, pin);
|
|
133
|
-
if (pendingArgs) {
|
|
134
|
-
if (pin === "_setData") {
|
|
135
|
-
arg(...pendingArgs);
|
|
136
|
-
} else {
|
|
137
|
-
(0, import_createReactiveInputHandler.createReactiveInputHandler)({ input: arg, value: pendingArgs[0], rels: {}, title: id });
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
const handler = handlersRef.current[pin];
|
|
142
|
-
if (typeof handler === "function") {
|
|
143
|
-
return pin === "_setData" ? handler(arg, ...args) : (0, import_createReactiveInputHandler.createReactiveInputHandler)({ input: handler, value: arg, rels: {}, title: id });
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
if (scope == null ? void 0 : scope.current)
|
|
150
|
-
scope.current[id] = proxy;
|
|
151
|
-
if (initialHandlers) {
|
|
152
|
-
Object.keys(initialHandlers).forEach((pin) => proxy[pin](initialHandlers[pin]));
|
|
153
|
-
}
|
|
154
|
-
return proxy;
|
|
155
|
-
}, [scope, id, todoPool, index]);
|
|
156
|
-
}
|
|
157
|
-
function useBuiltinHandlers(opts) {
|
|
158
|
-
const { data, setDynamicStyle, setShow, isPopup } = opts;
|
|
159
|
-
return (0, import_react.useMemo)(() => {
|
|
160
|
-
const handlers = {
|
|
161
|
-
_setStyle: (style) => {
|
|
162
|
-
setDynamicStyle((prev) => ({ ...prev, ...style }));
|
|
163
|
-
},
|
|
164
|
-
_setData: (path, value) => {
|
|
165
|
-
const paths = path.split(".");
|
|
166
|
-
let current = data;
|
|
167
|
-
for (let i = 0; i < paths.length - 1; i++) {
|
|
168
|
-
if (!current[paths[i]])
|
|
169
|
-
current[paths[i]] = {};
|
|
170
|
-
current = current[paths[i]];
|
|
171
|
-
}
|
|
172
|
-
current[paths[paths.length - 1]] = value;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
if (!isPopup) {
|
|
176
|
-
Object.assign(handlers, {
|
|
177
|
-
show: () => setShow(true),
|
|
178
|
-
hide: () => setShow(false),
|
|
179
|
-
showOrHide: () => setShow((prev) => !prev)
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
return handlers;
|
|
183
|
-
}, [data, setDynamicStyle, setShow, isPopup]);
|
|
184
|
-
}
|
|
185
|
-
function useBindOutputs(comRefs, id, props, enhancedSlots, context) {
|
|
186
|
-
var _a;
|
|
187
|
-
const eventProxy = (0, import_react.useMemo)(() => {
|
|
188
|
-
const events = {};
|
|
189
|
-
Object.keys(props).forEach((key) => {
|
|
190
|
-
if (typeof props[key] === "function") {
|
|
191
|
-
const handler = props[key];
|
|
192
|
-
const wrapped = (original) => handler(original);
|
|
193
|
-
wrapped.getConnections = () => [{ id: "default" }];
|
|
194
|
-
events[key] = wrapped;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
return new Proxy(events, {
|
|
198
|
-
get(target, key) {
|
|
199
|
-
if (typeof key === "string" && key.startsWith("on")) {
|
|
200
|
-
if (target[key])
|
|
201
|
-
return target[key];
|
|
202
|
-
const fn = () => {
|
|
203
|
-
};
|
|
204
|
-
fn.getConnections = () => [];
|
|
205
|
-
return fn;
|
|
206
|
-
}
|
|
207
|
-
return target[key];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}, [props, context]);
|
|
211
|
-
if ((_a = comRefs == null ? void 0 : comRefs.current) == null ? void 0 : _a.$outputs) {
|
|
212
|
-
const slotOutputsList = Object.values(enhancedSlots || {}).map((slot) => slot == null ? void 0 : slot.outputs).filter(Boolean);
|
|
213
|
-
if (slotOutputsList.length > 0) {
|
|
214
|
-
comRefs.current.$outputs[id] = new Proxy({}, {
|
|
215
|
-
get(_, prop) {
|
|
216
|
-
for (const outputs of slotOutputsList) {
|
|
217
|
-
const fn = outputs[prop];
|
|
218
|
-
if (fn)
|
|
219
|
-
return fn;
|
|
220
|
-
}
|
|
221
|
-
return eventProxy[prop];
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
} else {
|
|
225
|
-
comRefs.current.$outputs[id] = eventProxy;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return eventProxy;
|
|
229
|
-
}
|
|
230
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
231
|
-
0 && (module.exports = {
|
|
232
|
-
deepProxy,
|
|
233
|
-
proxyRefs,
|
|
234
|
-
useBindInputs,
|
|
235
|
-
useBindOutputs,
|
|
236
|
-
useBuiltinHandlers,
|
|
237
|
-
useModel
|
|
238
|
-
});
|
|
@@ -1,77 +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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/core/utils/index.ts
|
|
21
|
-
var utils_exports = {};
|
|
22
|
-
__export(utils_exports, {
|
|
23
|
-
ComRefResolver: () => import_comRefResolver.ComRefResolver,
|
|
24
|
-
PopupRenderer: () => import_PopupRenderer.PopupRenderer,
|
|
25
|
-
SUBJECT_SUBSCRIBE: () => import_constant.SUBJECT_SUBSCRIBE,
|
|
26
|
-
SUBJECT_VALUE: () => import_constant.SUBJECT_VALUE,
|
|
27
|
-
SlotProvider: () => import_ComContext.SlotProvider,
|
|
28
|
-
TodoPool: () => import_pool.TodoPool,
|
|
29
|
-
WithCom: () => import_with.WithCom,
|
|
30
|
-
WithWrapper: () => import_with.WithWrapper,
|
|
31
|
-
closeActivePopupRouter: () => import_popupRouter.closeActivePopupRouter,
|
|
32
|
-
createFx: () => import_mybricks.createFx,
|
|
33
|
-
createVariable: () => import_mybricks.createVariable,
|
|
34
|
-
merge: () => import_mybricks.merge,
|
|
35
|
-
pageRouter: () => import_pageRouter.pageRouter,
|
|
36
|
-
popupRouter: () => import_popupRouter.popupRouter,
|
|
37
|
-
router: () => import_pageRouter.router,
|
|
38
|
-
subscribePopupRouter: () => import_popupRouter.subscribePopupRouter,
|
|
39
|
-
useAppContext: () => import_ComContext.useAppContext,
|
|
40
|
-
useAppCreateContext: () => import_useContext.useAppCreateContext
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(utils_exports);
|
|
43
|
-
__reExport(utils_exports, require("./hooks"), module.exports);
|
|
44
|
-
var import_pool = require("./pool");
|
|
45
|
-
var import_comRefResolver = require("./comRefResolver");
|
|
46
|
-
var import_with = require("./with");
|
|
47
|
-
var import_PopupRenderer = require("./PopupRenderer");
|
|
48
|
-
var import_pageRouter = require("./pageRouter");
|
|
49
|
-
var import_popupRouter = require("./popupRouter");
|
|
50
|
-
var import_ComContext = require("./ComContext");
|
|
51
|
-
var import_useContext = require("./useContext");
|
|
52
|
-
var import_mybricks = require("../mybricks");
|
|
53
|
-
var import_constant = require("../mybricks/constant");
|
|
54
|
-
__reExport(utils_exports, require("./slots"), module.exports);
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
ComRefResolver,
|
|
58
|
-
PopupRenderer,
|
|
59
|
-
SUBJECT_SUBSCRIBE,
|
|
60
|
-
SUBJECT_VALUE,
|
|
61
|
-
SlotProvider,
|
|
62
|
-
TodoPool,
|
|
63
|
-
WithCom,
|
|
64
|
-
WithWrapper,
|
|
65
|
-
closeActivePopupRouter,
|
|
66
|
-
createFx,
|
|
67
|
-
createVariable,
|
|
68
|
-
merge,
|
|
69
|
-
pageRouter,
|
|
70
|
-
popupRouter,
|
|
71
|
-
router,
|
|
72
|
-
subscribePopupRouter,
|
|
73
|
-
useAppContext,
|
|
74
|
-
useAppCreateContext,
|
|
75
|
-
...require("./hooks"),
|
|
76
|
-
...require("./slots")
|
|
77
|
-
});
|
|
@@ -1,104 +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/pageRouter.ts
|
|
30
|
-
var pageRouter_exports = {};
|
|
31
|
-
__export(pageRouter_exports, {
|
|
32
|
-
pageRouter: () => pageRouter,
|
|
33
|
-
router: () => router
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(pageRouter_exports);
|
|
36
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
37
|
-
var import_tabBar = __toESM(require("@/custom-tab-bar/tabBar.json"));
|
|
38
|
-
var import_mybricks = require("../mybricks");
|
|
39
|
-
var TaroRouter = class {
|
|
40
|
-
constructor() {
|
|
41
|
-
this.paramsBackup = {};
|
|
42
|
-
}
|
|
43
|
-
getParams(name) {
|
|
44
|
-
var _a;
|
|
45
|
-
const instance = import_taro.default.getCurrentInstance();
|
|
46
|
-
const inputParams = ((_a = instance.router) == null ? void 0 : _a.params) || {};
|
|
47
|
-
let params = Object.keys(inputParams).length === 2 && inputParams.data && typeof inputParams.data === "string" ? inputParams : {
|
|
48
|
-
data: Object.keys(inputParams).length > 1 ? JSON.stringify({ ...inputParams, $taroTimestamp: void 0 }) : void 0,
|
|
49
|
-
$taroTimestamp: inputParams.$taroTimestamp
|
|
50
|
-
};
|
|
51
|
-
if (!params.data && this.paramsBackup[name]) {
|
|
52
|
-
params = { data: this.paramsBackup[name] };
|
|
53
|
-
}
|
|
54
|
-
const paramsDataStr = params.data ? decodeURIComponent(params.data) : void 0;
|
|
55
|
-
let paramsData;
|
|
56
|
-
try {
|
|
57
|
-
paramsData = paramsDataStr ? JSON.parse(paramsDataStr) : void 0;
|
|
58
|
-
} catch (error) {
|
|
59
|
-
paramsData = paramsDataStr;
|
|
60
|
-
}
|
|
61
|
-
return { value: paramsData };
|
|
62
|
-
}
|
|
63
|
-
push(name, { value }) {
|
|
64
|
-
const path = `pages/${name}/index`;
|
|
65
|
-
const navigateType = this.isTabBarPage(path) ? "switchTab" : "navigateTo";
|
|
66
|
-
this.navigate(navigateType, name, { value });
|
|
67
|
-
}
|
|
68
|
-
replace(name, { value }) {
|
|
69
|
-
const path = `pages/${name}/index`;
|
|
70
|
-
const navigateType = this.isTabBarPage(path) ? "switchTab" : "redirectTo";
|
|
71
|
-
this.navigate(navigateType, name, { value });
|
|
72
|
-
}
|
|
73
|
-
navigate(type, name, { value }) {
|
|
74
|
-
const url = `/pages/${name}/index`;
|
|
75
|
-
const dataStr = value ? encodeURIComponent(JSON.stringify(value)) : "";
|
|
76
|
-
if (dataStr) {
|
|
77
|
-
this.paramsBackup[name] = dataStr;
|
|
78
|
-
}
|
|
79
|
-
import_taro.default[type]({
|
|
80
|
-
url: `${url}${dataStr ? `?data=${dataStr}` : ""}`
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
pop() {
|
|
84
|
-
import_taro.default.navigateBack();
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* 判断是否为标签栏页面
|
|
88
|
-
* @param pagePath 页面路径
|
|
89
|
-
* @returns 是否为标签栏页面
|
|
90
|
-
*/
|
|
91
|
-
isTabBarPage(pagePath) {
|
|
92
|
-
var _a, _b, _c;
|
|
93
|
-
return (_c = (_b = (_a = import_tabBar.default) == null ? void 0 : _a.tabBar) == null ? void 0 : _b.list) == null ? void 0 : _c.some(
|
|
94
|
-
(item) => item.pagePath === pagePath
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
var router = new TaroRouter();
|
|
99
|
-
var pageRouter = new import_mybricks.Page(router);
|
|
100
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
-
0 && (module.exports = {
|
|
102
|
-
pageRouter,
|
|
103
|
-
router
|
|
104
|
-
});
|
|
@@ -1,63 +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/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
|
-
});
|
|
@@ -1,98 +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/popupRouter.ts
|
|
20
|
-
var popupRouter_exports = {};
|
|
21
|
-
__export(popupRouter_exports, {
|
|
22
|
-
closeActivePopupRouter: () => closeActivePopupRouter,
|
|
23
|
-
popupRouter: () => popupRouter,
|
|
24
|
-
subscribePopupRouter: () => subscribePopupRouter
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(popupRouter_exports);
|
|
27
|
-
var import_mybricks = require("../mybricks");
|
|
28
|
-
var PopupStore = class {
|
|
29
|
-
constructor() {
|
|
30
|
-
this.activePopup = null;
|
|
31
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
32
|
-
}
|
|
33
|
-
/** 订阅弹窗状态变化 */
|
|
34
|
-
subscribe(listener) {
|
|
35
|
-
this.listeners.add(listener);
|
|
36
|
-
return () => {
|
|
37
|
-
this.listeners.delete(listener);
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
notify() {
|
|
41
|
-
this.listeners.forEach(
|
|
42
|
-
(l) => l(
|
|
43
|
-
this.activePopup || {
|
|
44
|
-
visible: false,
|
|
45
|
-
name: "",
|
|
46
|
-
value: null,
|
|
47
|
-
controller: null
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
/** 获取弹窗参数 */
|
|
53
|
-
getParams(name) {
|
|
54
|
-
if (this.activePopup && this.activePopup.name === name) {
|
|
55
|
-
return {
|
|
56
|
-
value: this.activePopup.value,
|
|
57
|
-
controller: this.activePopup.controller
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return { value: null };
|
|
61
|
-
}
|
|
62
|
-
/** 获取当前激活的弹窗名称 */
|
|
63
|
-
getActiveName() {
|
|
64
|
-
var _a;
|
|
65
|
-
return (_a = this.activePopup) == null ? void 0 : _a.name;
|
|
66
|
-
}
|
|
67
|
-
/** 打开弹窗 */
|
|
68
|
-
push(name, { value, controller }) {
|
|
69
|
-
this.activePopup = { visible: true, name, value, controller };
|
|
70
|
-
this.notify();
|
|
71
|
-
}
|
|
72
|
-
/** 行为同 push */
|
|
73
|
-
replace(name, params) {
|
|
74
|
-
this.push(name, params);
|
|
75
|
-
}
|
|
76
|
-
/** 关闭弹窗 */
|
|
77
|
-
pop() {
|
|
78
|
-
this.activePopup = null;
|
|
79
|
-
this.notify();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var popupStore = new PopupStore();
|
|
83
|
-
var subscribePopupRouter = (listener) => {
|
|
84
|
-
return popupStore.subscribe(listener);
|
|
85
|
-
};
|
|
86
|
-
var popupRouter = new import_mybricks.Page(popupStore);
|
|
87
|
-
var closeActivePopupRouter = () => {
|
|
88
|
-
const name = popupStore.getActiveName();
|
|
89
|
-
if (!name)
|
|
90
|
-
return;
|
|
91
|
-
popupRouter.close(name);
|
|
92
|
-
};
|
|
93
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
-
0 && (module.exports = {
|
|
95
|
-
closeActivePopupRouter,
|
|
96
|
-
popupRouter,
|
|
97
|
-
subscribePopupRouter
|
|
98
|
-
});
|