quick-platform 1.0.46
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/LICENSE +21 -0
- package/README.md +63 -0
- package/dist/application/constants.d.ts +4 -0
- package/dist/application/index.d.ts +29 -0
- package/dist/application/manage.d.ts +31 -0
- package/dist/business/index.d.ts +72 -0
- package/dist/business/version.d.ts +7 -0
- package/dist/components/IconFont.d.ts +4 -0
- package/dist/components/LocalDebug.d.ts +6 -0
- package/dist/components/MicroApp.d.ts +14 -0
- package/dist/components/Permission.d.ts +6 -0
- package/dist/components/context.d.ts +3 -0
- package/dist/components/i18n.d.ts +2 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/event.d.ts +13 -0
- package/dist/index-543d110b.js +547 -0
- package/dist/index-543d110b.js.map +1 -0
- package/dist/index-be61d86b.js +2 -0
- package/dist/index-be61d86b.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/define/color.d.ts +9 -0
- package/dist/theme/define/font.d.ts +50 -0
- package/dist/theme/define/index.d.ts +5 -0
- package/dist/theme/define/size.d.ts +24 -0
- package/dist/theme/define/style.d.ts +21 -0
- package/dist/theme/doc.d.ts +2 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/lib/index.d.ts +1 -0
- package/dist/theme/react/hook.d.ts +5 -0
- package/dist/theme/react/index.d.ts +3 -0
- package/dist/theme/uno.d.ts +19 -0
- package/dist/utils/i18n.d.ts +6 -0
- package/dist/utils/image.d.ts +2 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/localstorage.d.ts +6 -0
- package/dist/utils/request.d.ts +37 -0
- package/dist/utils/utils.d.ts +3 -0
- package/package.json +67 -0
- package/src/application/constants.ts +7 -0
- package/src/application/index.ts +82 -0
- package/src/application/manage.ts +119 -0
- package/src/business/declare.d.ts +39 -0
- package/src/business/index.ts +130 -0
- package/src/business/version.ts +58 -0
- package/src/components/IconFont.ts +11 -0
- package/src/components/LocalDebug.ts +244 -0
- package/src/components/MicroApp.ts +97 -0
- package/src/components/Permission.ts +13 -0
- package/src/components/context.ts +31 -0
- package/src/components/i18n.ts +17 -0
- package/src/config.ts +3 -0
- package/src/event.ts +24 -0
- package/src/index.ts +38 -0
- package/src/theme/define/color.ts +53 -0
- package/src/theme/define/font.ts +29 -0
- package/src/theme/define/index.ts +8 -0
- package/src/theme/define/size.ts +31 -0
- package/src/theme/define/style.ts +41 -0
- package/src/theme/doc.tsx +438 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/lib/index.ts +15 -0
- package/src/theme/react/hook.ts +42 -0
- package/src/theme/react/index.ts +14 -0
- package/src/theme/uno.ts +218 -0
- package/src/utils/i18n.ts +84 -0
- package/src/utils/image.ts +52 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/localstorage.ts +32 -0
- package/src/utils/request.ts +173 -0
- package/src/utils/utils.ts +15 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
2
|
+
try {
|
|
3
|
+
var i = n[a](c),
|
|
4
|
+
u = i.value;
|
|
5
|
+
} catch (n) {
|
|
6
|
+
return void e(n);
|
|
7
|
+
}
|
|
8
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
9
|
+
}
|
|
10
|
+
function _asyncToGenerator(n) {
|
|
11
|
+
return function () {
|
|
12
|
+
var t = this,
|
|
13
|
+
e = arguments;
|
|
14
|
+
return new Promise(function (r, o) {
|
|
15
|
+
var a = n.apply(t, e);
|
|
16
|
+
function _next(n) {
|
|
17
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
18
|
+
}
|
|
19
|
+
function _throw(n) {
|
|
20
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
21
|
+
}
|
|
22
|
+
_next(void 0);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function _defineProperties(e, r) {
|
|
27
|
+
for (var t = 0; t < r.length; t++) {
|
|
28
|
+
var o = r[t];
|
|
29
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function _createClass(e, r, t) {
|
|
33
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
34
|
+
writable: !1
|
|
35
|
+
}), e;
|
|
36
|
+
}
|
|
37
|
+
function _extends() {
|
|
38
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
39
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
40
|
+
var t = arguments[e];
|
|
41
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
42
|
+
}
|
|
43
|
+
return n;
|
|
44
|
+
}, _extends.apply(null, arguments);
|
|
45
|
+
}
|
|
46
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
47
|
+
if (null == r) return {};
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
50
|
+
if (e.includes(n)) continue;
|
|
51
|
+
t[n] = r[n];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
function _regeneratorRuntime() {
|
|
56
|
+
_regeneratorRuntime = function () {
|
|
57
|
+
return e;
|
|
58
|
+
};
|
|
59
|
+
var t,
|
|
60
|
+
e = {},
|
|
61
|
+
r = Object.prototype,
|
|
62
|
+
n = r.hasOwnProperty,
|
|
63
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
64
|
+
t[e] = r.value;
|
|
65
|
+
},
|
|
66
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
67
|
+
a = i.iterator || "@@iterator",
|
|
68
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
69
|
+
u = i.toStringTag || "@@toStringTag";
|
|
70
|
+
function define(t, e, r) {
|
|
71
|
+
return Object.defineProperty(t, e, {
|
|
72
|
+
value: r,
|
|
73
|
+
enumerable: !0,
|
|
74
|
+
configurable: !0,
|
|
75
|
+
writable: !0
|
|
76
|
+
}), t[e];
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
define({}, "");
|
|
80
|
+
} catch (t) {
|
|
81
|
+
define = function (t, e, r) {
|
|
82
|
+
return t[e] = r;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function wrap(t, e, r, n) {
|
|
86
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
87
|
+
a = Object.create(i.prototype),
|
|
88
|
+
c = new Context(n || []);
|
|
89
|
+
return o(a, "_invoke", {
|
|
90
|
+
value: makeInvokeMethod(t, r, c)
|
|
91
|
+
}), a;
|
|
92
|
+
}
|
|
93
|
+
function tryCatch(t, e, r) {
|
|
94
|
+
try {
|
|
95
|
+
return {
|
|
96
|
+
type: "normal",
|
|
97
|
+
arg: t.call(e, r)
|
|
98
|
+
};
|
|
99
|
+
} catch (t) {
|
|
100
|
+
return {
|
|
101
|
+
type: "throw",
|
|
102
|
+
arg: t
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
e.wrap = wrap;
|
|
107
|
+
var h = "suspendedStart",
|
|
108
|
+
l = "suspendedYield",
|
|
109
|
+
f = "executing",
|
|
110
|
+
s = "completed",
|
|
111
|
+
y = {};
|
|
112
|
+
function Generator() {}
|
|
113
|
+
function GeneratorFunction() {}
|
|
114
|
+
function GeneratorFunctionPrototype() {}
|
|
115
|
+
var p = {};
|
|
116
|
+
define(p, a, function () {
|
|
117
|
+
return this;
|
|
118
|
+
});
|
|
119
|
+
var d = Object.getPrototypeOf,
|
|
120
|
+
v = d && d(d(values([])));
|
|
121
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
122
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
123
|
+
function defineIteratorMethods(t) {
|
|
124
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
125
|
+
define(t, e, function (t) {
|
|
126
|
+
return this._invoke(e, t);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function AsyncIterator(t, e) {
|
|
131
|
+
function invoke(r, o, i, a) {
|
|
132
|
+
var c = tryCatch(t[r], t, o);
|
|
133
|
+
if ("throw" !== c.type) {
|
|
134
|
+
var u = c.arg,
|
|
135
|
+
h = u.value;
|
|
136
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
137
|
+
invoke("next", t, i, a);
|
|
138
|
+
}, function (t) {
|
|
139
|
+
invoke("throw", t, i, a);
|
|
140
|
+
}) : e.resolve(h).then(function (t) {
|
|
141
|
+
u.value = t, i(u);
|
|
142
|
+
}, function (t) {
|
|
143
|
+
return invoke("throw", t, i, a);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
a(c.arg);
|
|
147
|
+
}
|
|
148
|
+
var r;
|
|
149
|
+
o(this, "_invoke", {
|
|
150
|
+
value: function (t, n) {
|
|
151
|
+
function callInvokeWithMethodAndArg() {
|
|
152
|
+
return new e(function (e, r) {
|
|
153
|
+
invoke(t, n, e, r);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function makeInvokeMethod(e, r, n) {
|
|
161
|
+
var o = h;
|
|
162
|
+
return function (i, a) {
|
|
163
|
+
if (o === f) throw Error("Generator is already running");
|
|
164
|
+
if (o === s) {
|
|
165
|
+
if ("throw" === i) throw a;
|
|
166
|
+
return {
|
|
167
|
+
value: t,
|
|
168
|
+
done: !0
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
for (n.method = i, n.arg = a;;) {
|
|
172
|
+
var c = n.delegate;
|
|
173
|
+
if (c) {
|
|
174
|
+
var u = maybeInvokeDelegate(c, n);
|
|
175
|
+
if (u) {
|
|
176
|
+
if (u === y) continue;
|
|
177
|
+
return u;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
181
|
+
if (o === h) throw o = s, n.arg;
|
|
182
|
+
n.dispatchException(n.arg);
|
|
183
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
184
|
+
o = f;
|
|
185
|
+
var p = tryCatch(e, r, n);
|
|
186
|
+
if ("normal" === p.type) {
|
|
187
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
188
|
+
return {
|
|
189
|
+
value: p.arg,
|
|
190
|
+
done: n.done
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function maybeInvokeDelegate(e, r) {
|
|
198
|
+
var n = r.method,
|
|
199
|
+
o = e.iterator[n];
|
|
200
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
201
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
202
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
203
|
+
var a = i.arg;
|
|
204
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
205
|
+
}
|
|
206
|
+
function pushTryEntry(t) {
|
|
207
|
+
var e = {
|
|
208
|
+
tryLoc: t[0]
|
|
209
|
+
};
|
|
210
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
211
|
+
}
|
|
212
|
+
function resetTryEntry(t) {
|
|
213
|
+
var e = t.completion || {};
|
|
214
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
215
|
+
}
|
|
216
|
+
function Context(t) {
|
|
217
|
+
this.tryEntries = [{
|
|
218
|
+
tryLoc: "root"
|
|
219
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
220
|
+
}
|
|
221
|
+
function values(e) {
|
|
222
|
+
if (e || "" === e) {
|
|
223
|
+
var r = e[a];
|
|
224
|
+
if (r) return r.call(e);
|
|
225
|
+
if ("function" == typeof e.next) return e;
|
|
226
|
+
if (!isNaN(e.length)) {
|
|
227
|
+
var o = -1,
|
|
228
|
+
i = function next() {
|
|
229
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
230
|
+
return next.value = t, next.done = !0, next;
|
|
231
|
+
};
|
|
232
|
+
return i.next = i;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
236
|
+
}
|
|
237
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
238
|
+
value: GeneratorFunctionPrototype,
|
|
239
|
+
configurable: !0
|
|
240
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
241
|
+
value: GeneratorFunction,
|
|
242
|
+
configurable: !0
|
|
243
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
244
|
+
var e = "function" == typeof t && t.constructor;
|
|
245
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
246
|
+
}, e.mark = function (t) {
|
|
247
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
248
|
+
}, e.awrap = function (t) {
|
|
249
|
+
return {
|
|
250
|
+
__await: t
|
|
251
|
+
};
|
|
252
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
253
|
+
return this;
|
|
254
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
255
|
+
void 0 === i && (i = Promise);
|
|
256
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
257
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
258
|
+
return t.done ? t.value : a.next();
|
|
259
|
+
});
|
|
260
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
261
|
+
return this;
|
|
262
|
+
}), define(g, "toString", function () {
|
|
263
|
+
return "[object Generator]";
|
|
264
|
+
}), e.keys = function (t) {
|
|
265
|
+
var e = Object(t),
|
|
266
|
+
r = [];
|
|
267
|
+
for (var n in e) r.push(n);
|
|
268
|
+
return r.reverse(), function next() {
|
|
269
|
+
for (; r.length;) {
|
|
270
|
+
var t = r.pop();
|
|
271
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
272
|
+
}
|
|
273
|
+
return next.done = !0, next;
|
|
274
|
+
};
|
|
275
|
+
}, e.values = values, Context.prototype = {
|
|
276
|
+
constructor: Context,
|
|
277
|
+
reset: function (e) {
|
|
278
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
279
|
+
},
|
|
280
|
+
stop: function () {
|
|
281
|
+
this.done = !0;
|
|
282
|
+
var t = this.tryEntries[0].completion;
|
|
283
|
+
if ("throw" === t.type) throw t.arg;
|
|
284
|
+
return this.rval;
|
|
285
|
+
},
|
|
286
|
+
dispatchException: function (e) {
|
|
287
|
+
if (this.done) throw e;
|
|
288
|
+
var r = this;
|
|
289
|
+
function handle(n, o) {
|
|
290
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
291
|
+
}
|
|
292
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
293
|
+
var i = this.tryEntries[o],
|
|
294
|
+
a = i.completion;
|
|
295
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
296
|
+
if (i.tryLoc <= this.prev) {
|
|
297
|
+
var c = n.call(i, "catchLoc"),
|
|
298
|
+
u = n.call(i, "finallyLoc");
|
|
299
|
+
if (c && u) {
|
|
300
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
301
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
302
|
+
} else if (c) {
|
|
303
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
304
|
+
} else {
|
|
305
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
306
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
abrupt: function (t, e) {
|
|
312
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
313
|
+
var o = this.tryEntries[r];
|
|
314
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
315
|
+
var i = o;
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
320
|
+
var a = i ? i.completion : {};
|
|
321
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
322
|
+
},
|
|
323
|
+
complete: function (t, e) {
|
|
324
|
+
if ("throw" === t.type) throw t.arg;
|
|
325
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
326
|
+
},
|
|
327
|
+
finish: function (t) {
|
|
328
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
329
|
+
var r = this.tryEntries[e];
|
|
330
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
catch: function (t) {
|
|
334
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
335
|
+
var r = this.tryEntries[e];
|
|
336
|
+
if (r.tryLoc === t) {
|
|
337
|
+
var n = r.completion;
|
|
338
|
+
if ("throw" === n.type) {
|
|
339
|
+
var o = n.arg;
|
|
340
|
+
resetTryEntry(r);
|
|
341
|
+
}
|
|
342
|
+
return o;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
throw Error("illegal catch attempt");
|
|
346
|
+
},
|
|
347
|
+
delegateYield: function (e, r, n) {
|
|
348
|
+
return this.delegate = {
|
|
349
|
+
iterator: values(e),
|
|
350
|
+
resultName: r,
|
|
351
|
+
nextLoc: n
|
|
352
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
353
|
+
}
|
|
354
|
+
}, e;
|
|
355
|
+
}
|
|
356
|
+
function _toPrimitive(t, r) {
|
|
357
|
+
if ("object" != typeof t || !t) return t;
|
|
358
|
+
var e = t[Symbol.toPrimitive];
|
|
359
|
+
if (void 0 !== e) {
|
|
360
|
+
var i = e.call(t, r || "default");
|
|
361
|
+
if ("object" != typeof i) return i;
|
|
362
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
363
|
+
}
|
|
364
|
+
return ("string" === r ? String : Number)(t);
|
|
365
|
+
}
|
|
366
|
+
function _toPropertyKey(t) {
|
|
367
|
+
var i = _toPrimitive(t, "string");
|
|
368
|
+
return "symbol" == typeof i ? i : i + "";
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
var DefaultOpacity = /*#__PURE__*/(0.6 * 255).toString(16);
|
|
372
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
373
|
+
var PrimaryColor = '#ff6600';
|
|
374
|
+
var generateVar = function generateVar(name) {
|
|
375
|
+
return "--color-g-" + name;
|
|
376
|
+
};
|
|
377
|
+
//
|
|
378
|
+
/* todo 预留主题色阶
|
|
379
|
+
{
|
|
380
|
+
'brand-1': string;
|
|
381
|
+
'brand-2': string;
|
|
382
|
+
'brand-3': string;
|
|
383
|
+
'brand-4': string;
|
|
384
|
+
'brand-5': string;
|
|
385
|
+
'brand-6': string;
|
|
386
|
+
}
|
|
387
|
+
*/
|
|
388
|
+
var BrandColor = {};
|
|
389
|
+
var updateBrandColor = function updateBrandColor(color) {
|
|
390
|
+
PrimaryColor = color;
|
|
391
|
+
return BrandColor;
|
|
392
|
+
};
|
|
393
|
+
// todo 预留中性色
|
|
394
|
+
// export const NeutralColor = {} ;
|
|
395
|
+
// // todo 预留中性色-浅色
|
|
396
|
+
// export const NeutralHelperColor: Record<
|
|
397
|
+
// `${keyof typeof NeutralColor}-6`,
|
|
398
|
+
// string
|
|
399
|
+
// > = Object.keys(NeutralColor).reduce<any>((map, key) => {
|
|
400
|
+
// map[`${key}-6`] =
|
|
401
|
+
// NeutralColor[key as unknown as keyof typeof NeutralColor] + DefaultOpacity;
|
|
402
|
+
// return map;
|
|
403
|
+
// }, {});
|
|
404
|
+
/**
|
|
405
|
+
* todo预留功能色
|
|
406
|
+
*/
|
|
407
|
+
var FunctionalColor = {};
|
|
408
|
+
var FunctionalHelperColor = /*#__PURE__*/Object.keys(FunctionalColor).reduce(function (map, key) {
|
|
409
|
+
map[key + "-6"] = FunctionalColor[key] + DefaultOpacity;
|
|
410
|
+
return map;
|
|
411
|
+
}, {});
|
|
412
|
+
|
|
413
|
+
var color = {
|
|
414
|
+
__proto__: null,
|
|
415
|
+
get PrimaryColor () { return PrimaryColor; },
|
|
416
|
+
generateVar: generateVar,
|
|
417
|
+
BrandColor: BrandColor,
|
|
418
|
+
updateBrandColor: updateBrandColor,
|
|
419
|
+
FunctionalColor: FunctionalColor,
|
|
420
|
+
FunctionalHelperColor: FunctionalHelperColor
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
var EnFont = 'Inter';
|
|
424
|
+
var NumberFont = 'Inter';
|
|
425
|
+
var font = function font(size, _lineHeight) {
|
|
426
|
+
return {
|
|
427
|
+
fontSize: size,
|
|
428
|
+
fontWeight: 'initial'
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
var bold = function bold(_font) {
|
|
432
|
+
return _extends({}, _font, {
|
|
433
|
+
fontWeight: 'bold'
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
var TextFont = {
|
|
437
|
+
Normal: /*#__PURE__*/font(13),
|
|
438
|
+
NormalBold: /*#__PURE__*/bold( /*#__PURE__*/font(13)),
|
|
439
|
+
Small: /*#__PURE__*/font(12),
|
|
440
|
+
SmallBold: /*#__PURE__*/bold( /*#__PURE__*/font(12)),
|
|
441
|
+
Middle: /*#__PURE__*/font(14),
|
|
442
|
+
MiddleBold: /*#__PURE__*/bold( /*#__PURE__*/font(14)),
|
|
443
|
+
Large: /*#__PURE__*/font(16),
|
|
444
|
+
LargeBold: /*#__PURE__*/bold( /*#__PURE__*/font(16)),
|
|
445
|
+
Helper: /*#__PURE__*/font(12)
|
|
446
|
+
};
|
|
447
|
+
var TitleFont = {
|
|
448
|
+
Normal: /*#__PURE__*/font(14),
|
|
449
|
+
// Small: font(16, 24),
|
|
450
|
+
Middle: /*#__PURE__*/font(16)
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
var font$1 = {
|
|
454
|
+
__proto__: null,
|
|
455
|
+
EnFont: EnFont,
|
|
456
|
+
NumberFont: NumberFont,
|
|
457
|
+
TextFont: TextFont,
|
|
458
|
+
TitleFont: TitleFont
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
var DefaultSize = 4;
|
|
462
|
+
// todo 还未定义,暂时不处理
|
|
463
|
+
var BaseSize = /*#__PURE__*/Array.from({
|
|
464
|
+
length: 10
|
|
465
|
+
}).reduce(function (map, _, index) {
|
|
466
|
+
map["size-" + (index + 1)] = (index + 1) * DefaultSize;
|
|
467
|
+
return map;
|
|
468
|
+
}, {});
|
|
469
|
+
var ComponentSize = {};
|
|
470
|
+
var MarginSize = {};
|
|
471
|
+
var IconSize = {
|
|
472
|
+
normal: 16
|
|
473
|
+
};
|
|
474
|
+
// 参考 https://www.woshipm.com/pd/4736098.html
|
|
475
|
+
var ResponsiveScreenSize = {
|
|
476
|
+
s: 480,
|
|
477
|
+
m: 640,
|
|
478
|
+
l: 1024,
|
|
479
|
+
xl: 1366,
|
|
480
|
+
xxl: 1920
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
var size = {
|
|
484
|
+
__proto__: null,
|
|
485
|
+
BaseSize: BaseSize,
|
|
486
|
+
ComponentSize: ComponentSize,
|
|
487
|
+
MarginSize: MarginSize,
|
|
488
|
+
IconSize: IconSize,
|
|
489
|
+
ResponsiveScreenSize: ResponsiveScreenSize
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
var border = function border(width, style) {
|
|
493
|
+
return {
|
|
494
|
+
borderStyle: style,
|
|
495
|
+
borderWidth: width,
|
|
496
|
+
borderColor: '#F0F0F0'
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
var borderRadius = function borderRadius(radius) {
|
|
500
|
+
return {
|
|
501
|
+
borderRadius: radius
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
var BorderRadius = {
|
|
505
|
+
Small: /*#__PURE__*/borderRadius(6),
|
|
506
|
+
Normal: /*#__PURE__*/borderRadius(8)
|
|
507
|
+
};
|
|
508
|
+
var Border = {
|
|
509
|
+
SolidStroke: /*#__PURE__*/border(1, 'solid'),
|
|
510
|
+
// SolidNormal: border(2, 'solid'),
|
|
511
|
+
// SolidBold: border(3, 'solid'),
|
|
512
|
+
DashedStroke: /*#__PURE__*/border(1, 'dashed')
|
|
513
|
+
};
|
|
514
|
+
// const shadow = (x: number, y: number, b: number, s: number) => {
|
|
515
|
+
// return {
|
|
516
|
+
// offsetX: x,
|
|
517
|
+
// offsetY: y,
|
|
518
|
+
// blurRadius: b,
|
|
519
|
+
// spreadRadius: s,
|
|
520
|
+
// color: '#00000020',
|
|
521
|
+
// };
|
|
522
|
+
// };
|
|
523
|
+
var Shadow = {
|
|
524
|
+
// Level1: shadow(0, 2, 5, 0),
|
|
525
|
+
// Level2: shadow(0, 4, 10, 0),
|
|
526
|
+
// Level3: shadow(0, 8, 20, 0),
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var style = {
|
|
530
|
+
__proto__: null,
|
|
531
|
+
BorderRadius: BorderRadius,
|
|
532
|
+
Border: Border,
|
|
533
|
+
Shadow: Shadow
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
var index = {
|
|
539
|
+
__proto__: null,
|
|
540
|
+
Color: color,
|
|
541
|
+
Size: size,
|
|
542
|
+
Font: font$1,
|
|
543
|
+
Style: style
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export { BrandColor as B, MarginSize as M, PrimaryColor as P, Shadow as S, TextFont as T, _createClass as _, _asyncToGenerator as a, _regeneratorRuntime as b, _objectWithoutPropertiesLoose as c, _extends as d, BorderRadius as e, Border as f, generateVar as g, TitleFont as h, index as i, BaseSize as j, updateBrandColor as u };
|
|
547
|
+
//# sourceMappingURL=index-543d110b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-543d110b.js","sources":["../src/theme/define/color.ts","../src/theme/define/font.ts","../src/theme/define/size.ts","../src/theme/define/style.ts"],"sourcesContent":["const DefaultOpacity = (0.6 * 255).toString(16);\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let PrimaryColor = '#ff6600';\n\nexport const generateVar = (name: string) => {\n return `--color-g-${name}`;\n};\n\n//\n/* todo 预留主题色阶\n{\n 'brand-1': string;\n 'brand-2': string;\n 'brand-3': string;\n 'brand-4': string;\n 'brand-5': string;\n 'brand-6': string;\n}\n*/\nexport const BrandColor = {} as const;\n\nexport const updateBrandColor = (color: string) => {\n PrimaryColor = color;\n return BrandColor;\n};\n\n// todo 预留中性色\n// export const NeutralColor = {} ;\n\n// // todo 预留中性色-浅色\n// export const NeutralHelperColor: Record<\n// `${keyof typeof NeutralColor}-6`,\n// string\n// > = Object.keys(NeutralColor).reduce<any>((map, key) => {\n// map[`${key}-6`] =\n// NeutralColor[key as unknown as keyof typeof NeutralColor] + DefaultOpacity;\n// return map;\n// }, {});\n\n/**\n * todo预留功能色\n */\nexport const FunctionalColor = {};\n\nexport const FunctionalHelperColor: typeof FunctionalColor = Object.keys(\n FunctionalColor\n).reduce<any>((map, key) => {\n map[`${key}-6`] =\n FunctionalColor[(key as unknown) as keyof typeof FunctionalColor] +\n DefaultOpacity;\n return map;\n}, {});\n","export const EnFont = 'Inter';\nexport const NumberFont = 'Inter';\n\nconst font = (size: number, _lineHeight?: number) => {\n return { fontSize: size, fontWeight: 'initial' };\n};\n\nconst bold = (_font: ReturnType<typeof font>) => {\n return { ..._font, fontWeight: 'bold' };\n};\n\nexport const TextFont = {\n Normal: font(13, 22),\n NormalBold: bold(font(13, 22)),\n Small: font(12, 20),\n SmallBold: bold(font(12, 20)),\n Middle: font(14, 22),\n MiddleBold: bold(font(14, 22)),\n Large: font(16, 28),\n LargeBold: bold(font(16, 28)),\n Helper: font(12, 20),\n};\n\nexport const TitleFont = {\n Normal: font(14, 24),\n // Small: font(16, 24),\n Middle: font(16, 28),\n // Large: font(24, 32),\n};\n","const DefaultSize = 4;\n// todo 还未定义,暂时不处理\nexport const BaseSize: {\n 'size-1': number;\n 'size-2': number;\n 'size-3': number;\n 'size-4': number;\n 'size-5': number;\n 'size-6': number;\n 'size-7': number;\n 'size-8': number;\n 'size-9': number;\n 'size-10': number;\n} = Array.from({ length: 10 }).reduce<any>((map, _, index) => {\n map[`size-${index + 1}`] = (index + 1) * DefaultSize;\n return map;\n}, {});\n\nexport const ComponentSize = {};\n\nexport const MarginSize = {};\nexport const IconSize = { normal: 16 };\n\n// 参考 https://www.woshipm.com/pd/4736098.html\nexport const ResponsiveScreenSize = {\n s: 480,\n m: 640,\n l: 1024,\n xl: 1366,\n xxl: 1920,\n};\n","const border = (width: number, style: 'dashed' | 'solid') => {\n return {\n borderStyle: style,\n borderWidth: width,\n borderColor: '#F0F0F0', // todo\n };\n};\nconst borderRadius = (radius: number) => {\n return { borderRadius: radius };\n};\n\nexport const BorderRadius = {\n Small: borderRadius(6),\n Normal: borderRadius(8),\n // Large: borderRadius(10), // todo\n};\n\nexport const Border = {\n SolidStroke: border(1, 'solid'),\n // SolidNormal: border(2, 'solid'),\n // SolidBold: border(3, 'solid'),\n DashedStroke: border(1, 'dashed'),\n // DashedNormal: border(2, 'dashed'),\n // DashedBold: border(3, 'dashed'),\n};\n\n// const shadow = (x: number, y: number, b: number, s: number) => {\n// return {\n// offsetX: x,\n// offsetY: y,\n// blurRadius: b,\n// spreadRadius: s,\n// color: '#00000020',\n// };\n// };\n\nexport const Shadow = {\n // Level1: shadow(0, 2, 5, 0),\n // Level2: shadow(0, 4, 10, 0),\n // Level3: shadow(0, 8, 20, 0),\n};\n"],"names":["DefaultOpacity","toString","PrimaryColor","generateVar","name","BrandColor","updateBrandColor","color","FunctionalColor","FunctionalHelperColor","Object","keys","reduce","map","key","EnFont","NumberFont","font","size","_lineHeight","fontSize","fontWeight","bold","_font","_extends","TextFont","Normal","NormalBold","Small","SmallBold","Middle","MiddleBold","Large","LargeBold","Helper","TitleFont","DefaultSize","BaseSize","Array","from","length","_","index","ComponentSize","MarginSize","IconSize","normal","ResponsiveScreenSize","s","m","l","xl","xxl","border","width","style","borderStyle","borderWidth","borderColor","borderRadius","radius","BorderRadius","Border","SolidStroke","DashedStroke","Shadow"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function t(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function r(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function e(){return(e=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(null,arguments)}function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),a=new B(n||[]);return i(o,"_invoke",{value:j(t,e,a)}),o}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",y="executing",d="completed",v={};function g(){}function m(){}function w(){}var x={};f(x,u,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(C([])));_&&_!==e&&o.call(_,u)&&(x=_);var L=w.prototype=g.prototype=Object.create(x);function S(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function E(t,r){function e(n,i,a,u){var c=h(t[n],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function j(r,e,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=h(r,e,n);if("normal"===l.type){if(o=n.done?d:"suspendedYield",l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function O(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,O(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,v;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function F(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=w,i(L,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=f(w,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,l,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},S(E.prototype),f(E.prototype,c,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new E(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(L),f(L,l,"Generator"),f(L,u,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=C,B.prototype={constructor:B,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),F(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;F(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:C(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}function o(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof r?r:r+""}var i=153..toString(16);exports.PrimaryColor="#ff6600";var a=function(t){return"--color-g-"+t},u={},c=function(t){return exports.PrimaryColor=t,u},l={},f={__proto__:null,get PrimaryColor(){return exports.PrimaryColor},generateVar:a,BrandColor:u,updateBrandColor:c,FunctionalColor:l,FunctionalHelperColor:Object.keys(l).reduce((function(t,r){return t[r+"-6"]=l[r]+i,t}),{})},s=function(t,r){return{fontSize:t,fontWeight:"initial"}},h=function(t){return e({},t,{fontWeight:"bold"})},p={Normal:s(13),NormalBold:h(s(13)),Small:s(12),SmallBold:h(s(12)),Middle:s(14),MiddleBold:h(s(14)),Large:s(16),LargeBold:h(s(16)),Helper:s(12)},y={Normal:s(14),Middle:s(16)},d={__proto__:null,EnFont:"Inter",NumberFont:"Inter",TextFont:p,TitleFont:y},v=Array.from({length:10}).reduce((function(t,r,e){return t["size-"+(e+1)]=4*(e+1),t}),{}),g={},m={__proto__:null,BaseSize:v,ComponentSize:{},MarginSize:g,IconSize:{normal:16},ResponsiveScreenSize:{s:480,m:640,l:1024,xl:1366,xxl:1920}},w=function(t,r){return{borderStyle:r,borderWidth:t,borderColor:"#F0F0F0"}},x=function(t){return{borderRadius:t}},b={Small:x(6),Normal:x(8)},_={SolidStroke:w(1,"solid"),DashedStroke:w(1,"dashed")},L={},S={__proto__:null,Color:f,Size:m,Font:d,Style:{__proto__:null,BorderRadius:b,Border:_,Shadow:L}};exports.BaseSize=v,exports.Border=_,exports.BorderRadius=b,exports.BrandColor=u,exports.MarginSize=g,exports.Shadow=L,exports.TextFont=p,exports.TitleFont=y,exports._asyncToGenerator=function(r){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=r.apply(e,n);function u(r){t(a,o,i,u,c,"next",r)}function c(r){t(a,o,i,u,c,"throw",r)}u(void 0)}))}},exports._createClass=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},exports._extends=e,exports._objectWithoutPropertiesLoose=function(t,r){if(null==t)return{};var e={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.includes(n))continue;e[n]=t[n]}return e},exports._regeneratorRuntime=n,exports.generateVar=a,exports.index=S,exports.updateBrandColor=c;
|
|
2
|
+
//# sourceMappingURL=index-be61d86b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-be61d86b.js","sources":["../src/theme/define/color.ts","../src/theme/define/font.ts","../src/theme/define/size.ts","../src/theme/define/style.ts"],"sourcesContent":["const DefaultOpacity = (0.6 * 255).toString(16);\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let PrimaryColor = '#ff6600';\n\nexport const generateVar = (name: string) => {\n return `--color-g-${name}`;\n};\n\n//\n/* todo 预留主题色阶\n{\n 'brand-1': string;\n 'brand-2': string;\n 'brand-3': string;\n 'brand-4': string;\n 'brand-5': string;\n 'brand-6': string;\n}\n*/\nexport const BrandColor = {} as const;\n\nexport const updateBrandColor = (color: string) => {\n PrimaryColor = color;\n return BrandColor;\n};\n\n// todo 预留中性色\n// export const NeutralColor = {} ;\n\n// // todo 预留中性色-浅色\n// export const NeutralHelperColor: Record<\n// `${keyof typeof NeutralColor}-6`,\n// string\n// > = Object.keys(NeutralColor).reduce<any>((map, key) => {\n// map[`${key}-6`] =\n// NeutralColor[key as unknown as keyof typeof NeutralColor] + DefaultOpacity;\n// return map;\n// }, {});\n\n/**\n * todo预留功能色\n */\nexport const FunctionalColor = {};\n\nexport const FunctionalHelperColor: typeof FunctionalColor = Object.keys(\n FunctionalColor\n).reduce<any>((map, key) => {\n map[`${key}-6`] =\n FunctionalColor[(key as unknown) as keyof typeof FunctionalColor] +\n DefaultOpacity;\n return map;\n}, {});\n","export const EnFont = 'Inter';\nexport const NumberFont = 'Inter';\n\nconst font = (size: number, _lineHeight?: number) => {\n return { fontSize: size, fontWeight: 'initial' };\n};\n\nconst bold = (_font: ReturnType<typeof font>) => {\n return { ..._font, fontWeight: 'bold' };\n};\n\nexport const TextFont = {\n Normal: font(13, 22),\n NormalBold: bold(font(13, 22)),\n Small: font(12, 20),\n SmallBold: bold(font(12, 20)),\n Middle: font(14, 22),\n MiddleBold: bold(font(14, 22)),\n Large: font(16, 28),\n LargeBold: bold(font(16, 28)),\n Helper: font(12, 20),\n};\n\nexport const TitleFont = {\n Normal: font(14, 24),\n // Small: font(16, 24),\n Middle: font(16, 28),\n // Large: font(24, 32),\n};\n","const DefaultSize = 4;\n// todo 还未定义,暂时不处理\nexport const BaseSize: {\n 'size-1': number;\n 'size-2': number;\n 'size-3': number;\n 'size-4': number;\n 'size-5': number;\n 'size-6': number;\n 'size-7': number;\n 'size-8': number;\n 'size-9': number;\n 'size-10': number;\n} = Array.from({ length: 10 }).reduce<any>((map, _, index) => {\n map[`size-${index + 1}`] = (index + 1) * DefaultSize;\n return map;\n}, {});\n\nexport const ComponentSize = {};\n\nexport const MarginSize = {};\nexport const IconSize = { normal: 16 };\n\n// 参考 https://www.woshipm.com/pd/4736098.html\nexport const ResponsiveScreenSize = {\n s: 480,\n m: 640,\n l: 1024,\n xl: 1366,\n xxl: 1920,\n};\n","const border = (width: number, style: 'dashed' | 'solid') => {\n return {\n borderStyle: style,\n borderWidth: width,\n borderColor: '#F0F0F0', // todo\n };\n};\nconst borderRadius = (radius: number) => {\n return { borderRadius: radius };\n};\n\nexport const BorderRadius = {\n Small: borderRadius(6),\n Normal: borderRadius(8),\n // Large: borderRadius(10), // todo\n};\n\nexport const Border = {\n SolidStroke: border(1, 'solid'),\n // SolidNormal: border(2, 'solid'),\n // SolidBold: border(3, 'solid'),\n DashedStroke: border(1, 'dashed'),\n // DashedNormal: border(2, 'dashed'),\n // DashedBold: border(3, 'dashed'),\n};\n\n// const shadow = (x: number, y: number, b: number, s: number) => {\n// return {\n// offsetX: x,\n// offsetY: y,\n// blurRadius: b,\n// spreadRadius: s,\n// color: '#00000020',\n// };\n// };\n\nexport const Shadow = {\n // Level1: shadow(0, 2, 5, 0),\n // Level2: shadow(0, 4, 10, 0),\n // Level3: shadow(0, 8, 20, 0),\n};\n"],"names":["DefaultOpacity","toString","PrimaryColor","generateVar","name","BrandColor","updateBrandColor","color","FunctionalColor","Object","keys","reduce","map","key","font","size","_lineHeight","fontSize","fontWeight","bold","_font","_extends","TextFont","Normal","NormalBold","Small","SmallBold","Middle","MiddleBold","Large","LargeBold","Helper","TitleFont","BaseSize","Array","from","length","_","index","MarginSize","normal","s","m","l","xl","xxl","border","width","style","borderStyle","borderWidth","borderColor","borderRadius","radius","BorderRadius","Border","SolidStroke","DashedStroke","Shadow"],"mappings":"uoOAAA,IAAMA,EAAiB,KAAYC,SAAS,IAGjCC,qBAAe,cAEbC,EAAc,SAACC,GAC1B,mBAAoBA,GAcTC,EAAa,GAEbC,EAAmB,SAACC,GAE/B,OADAL,qBAAeK,EACRF,GAmBIG,EAAkB,2JAE8BC,OAAOC,KAClEF,GACAG,QAAY,SAACC,EAAKC,GAIlB,OAHAD,EAAOC,QACLL,EAAiBK,GACjBb,EACKY,IACN,KCjDGE,EAAO,SAACC,EAAcC,GAC1B,MAAO,CAAEC,SAAUF,EAAMG,WAAY,YAGjCC,EAAO,SAACC,GACZ,OAAAC,KAAYD,GAAOF,WAAY,UAGpBI,EAAW,CACtBC,OAAQT,EAAK,IACbU,WAAYL,EAAKL,EAAK,KACtBW,MAAOX,EAAK,IACZY,UAAWP,EAAKL,EAAK,KACrBa,OAAQb,EAAK,IACbc,WAAYT,EAAKL,EAAK,KACtBe,MAAOf,EAAK,IACZgB,UAAWX,EAAKL,EAAK,KACrBiB,OAAQjB,EAAK,KAGFkB,EAAY,CACvBT,OAAQT,EAAK,IAEba,OAAQb,EAAK,8BA1BO,mBACI,gCCCbmB,EAWTC,MAAMC,KAAK,CAAEC,OAAQ,KAAMzB,QAAY,SAACC,EAAKyB,EAAGC,GAElD,OADA1B,WAAY0B,EAAQ,IAdF,GAcUA,EAAQ,GAC7B1B,IACN,IAIU2B,EAAa,8CAFG,yBAGL,CAAEC,OAAQ,yBAGE,CAClCC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,KACJC,IAAK,OC7BDC,EAAS,SAACC,EAAeC,GAC7B,MAAO,CACLC,YAAaD,EACbE,YAAaH,EACbI,YAAa,YAGXC,EAAe,SAACC,GACpB,MAAO,CAAED,aAAcC,IAGZC,EAAe,CAC1B7B,MAAO2B,EAAa,GACpB7B,OAAQ6B,EAAa,IAIVG,EAAS,CACpBC,YAAaV,EAAO,EAAG,SAGvBW,aAAcX,EAAO,EAAG,WAebY,EAAS"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { registerApp, getCurrentApp } from './application';
|
|
2
|
+
import MicroApp from './components/MicroApp';
|
|
3
|
+
import Permission from './components/Permission';
|
|
4
|
+
import LocalDebug from './components/LocalDebug';
|
|
5
|
+
import I18nFC from './components/i18n';
|
|
6
|
+
import IconFont from './components/IconFont';
|
|
7
|
+
import { App, useAppData } from './components/context';
|
|
8
|
+
import AppEvent from './event';
|
|
9
|
+
import * as Utils from './utils';
|
|
10
|
+
import * as Authentication from './business';
|
|
11
|
+
export * from './theme';
|
|
12
|
+
export { App, useAppData, getCurrentApp, registerApp, LocalDebug, MicroApp, Permission, IconFont, AppEvent, Utils, Authentication, I18nFC, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,n,r,o=require("./index-be61d86b.js"),i=require("qiankun"),a=e(require("eventemitter3")),u=require("react"),c=e(u),s=require("@ant-design/icons"),l=e(require("heic2any")),f=e(require("axios")),d=!!window.__POWERED_BY_QIANKUN__,p=function(e,t,n){var r;return e&&t?Object.assign(n||{},((r={})[e]=t,r)):n||{}},m=(0,eval)("this"),h=m.quick_qiankun_manage||(m.quick_qiankun_manage=new Map),g=function(){function e(e,t){this.children=[],this.cacheMap=new Map,this.emitter=new a,this.on=this.emitter.on.bind(this.emitter),this.once=this.emitter.once.bind(this.emitter),this.off=this.emitter.off.bind(this.emitter),this.name=e,t&&(this.parent=this.getParent(t),this.parent.addChildren(this)),h.set(e,this)}var t=e.prototype;return t.getParent=function(t){if("root"===t&&!h.has(t)){var n=new e("root","");return h.set(t,n),n}if(!h.has(t))throw new Error("quick micro app manage error:"+t+" 应用未加载!");return h.get(t)},t.addChildren=function(e){this.children.push(e)},t.removeChildren=function(e){this.children=this.children.filter((function(t){return t.name!==e}))},t.trigger=function(e,t){this.parent&&this.parent.emitter.emit(e,t)},t.broadcast=function(e,t){for(var n=0,r=this.children.length;n<r;n++)this.children[n].emitter.emit(e,t)},t.cache=function(e,t){return void 0!==t&&this.cacheMap.set(e,t),this.cacheMap.get(e)},t.destroy=function(){for(this.emitter.removeAllListeners(),this.cacheMap.clear();this.children.length;)this.children.pop().destroy();this.parent&&this.parent.removeChildren(this.name)},o._createClass(e,[{key:"root",get:function(){for(var e=this;null!=(t=e)&&t.parent;){var t;e=e.parent}return e}},{key:"isRoot",get:function(){return this.root.name===this.name}}])}(),v=function(e){var n=window,r=n.quick_qiankun_parent_cache||n.quick_qiankun_parent_app||"root";t||(t=new g(e,r),n.quick_qiankun_parent_app=e,n.quick_qiankun_parent_cache=r)},_=function(){return t||h.get("root")||function(){var e=new g("root");return h.set("root",e),e}()},y=function(e){var t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){console.error(e)}return null};!function(e){e[e.Trial=1]="Trial",e[e.Free=2]="Free",e[e.Basic=3]="Basic",e[e.Professional=4]="Professional",e[e.Ultimate=5]="Ultimate",e[e.FreeCode=13]="FreeCode",e[e.Starter=14]="Starter",e[e.Growth=15]="Growth",e[e.Enterprise=6]="Enterprise"}(n||(n={})),function(e){e.Enterprise="ENTERPRISE",e.PLG="PLG"}(r||(r={}));var w=[n.Free,n.FreeCode,n.Starter,n.Growth],b=function(e){return void 0!==e.licenceId&&w.includes(e.licenceId)},k=function(e){return!b(e)},E=function(e){return n.Enterprise===e.licenceId},C=function(e){return n.Free===e.licenceId},I=function(e){return n.Professional===e.licenceId},q=function(e){return!(r.Enterprise===e.licenceType&&1===e.useBalance)},P=function(e){var t,n,r=null==(t=_())?void 0:t.root;null!=(n=_())&&n.isRoot||console.warn("quick platform login warn:current App is not Root App. Invalid login!",_()),r&&(null==r||r.cache("userinfo",e))},S=function(e){return function(){var t,n=null==(t=_())?void 0:t.root;n||console.warn("quick platform warn:root App not found!!!");var r=null==n?void 0:n.cache("userinfo");return null!=r&&r.userId||console.error("quick platform warn:root App not logged in yet"),e(r||{})}},x=S((function(e){return e.rightList||[]})),A=S((function(e){return e.statffInfo||{}})),R=S((function(e){return e.staffInfo||{}})),j=S((function(e){return e.storeInfo||{}})),z=S((function(e){return e.storeLicenceInfo||{}})),L=function(e){return x().includes(e)},T=function(){var e=process.env.OEM_NAME,t=e?"zh-CN":"en-US";return{oem:e,env:process.env.REACT_APP_ENVKEY,lang:y("qs_lang")||t,token:sessionStorage.getItem("quick-token")||"",requestTokenKey:"quick-token",storeId:sessionStorage.getItem("quick-im-storeId")||""}},M=function(){var e;return null==(e=window.QUICK_CEP)||null==(e=e.oem)?void 0:e.name},N=function(e){return function(){return e(z())}},U={isPLG:N(b),isSLG:N(k),isEnterprise:N(E),isFree:N(C),isProfessional:N(I),isCredits:N(q),getLicense:z,isOEM:function(){return!!M()}},O={__proto__:null,login:P,getUserInfo:A,getStaffInfo:R,getStoreInfo:j,getStoreLicense:z,hasAuth:L,getSystem:T,getOEMName:M,License:U},F="https://quick-multilingual.obs.ap-southeast-3.myhuaweicloud.com",G={"zh-CN":"zh","en-US":"en",ko:"ko",ja:"ja","zh-TW":"zh-tw"},$=function(e,t){return void 0===t&&(t={}),e.replace(/\{[a-zA-Z_0-9]*\}/g,(function(e){return t[e.slice(1,-1)]}))},D=function(e,t){var n=function(e,t){var n={},r=T();return{messages:n,setup:function(){var o=d?r.lang:window.localStorage.getItem("quick_local_debug_lang")||r.lang;return function(e,t,n){var r;return r=function(e,t,n){return"prod"===e?F+"/"+t+"/"+G[n]+".json":F+"/"+t+"/"+e+"/"+G[n]+".json"}("dev"===e?"dev":"prod"===e?"prod":"test",t,n),fetch(r+"?t="+Date.now()).then((function(e){return e.json()})).catch((function(){return{}}))}(t||"prod",e,o).then((function(e){Object.assign(n,e)}))},i18n:function(e,t){var r=n[e];return void 0===r?e:t?r.replace(/\{[a-zA-Z_0-9]*\}/g,(function(e){return t[e.slice(1,-1)]})):r}}}(e,t);return{$i18n:n.i18n,$$i18n:$,messages:n.messages,loadPromise:(0,n.setup)()}},B={trigger:function(e,t){var n;null==(n=_())||n.trigger(e,t)},broadcast:function(e,t){var n;null==(n=_())||n.broadcast(e,t)},on:function(e,t){var n;null==(n=_())||n.on(e,t)},off:function(e,t){var n;null==(n=_())||n.off(e,t)}},W=["auth"],K=["post"],Q=["post"],Z=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];var i=u.useState(),a=i[0],c=i[1],s=u.useState(!0),l=s[0],f=s[1],d=function(){return f(!0),e.apply(void 0,[t].concat(r)).then((function(e){c(e)})).finally((function(){f(!1)}))};return u.useEffect((function(){d()}),[]),{data:a,loading:l,request:d,setData:c}},H=c.createElement("div",{style:{width:"100%",height:"100&",textAlign:"center",fontSize:40}},["微应用本地调试模式初始化中..."]),V=function(e){return document.getElementById(e).value},Y=function(e){return c.createElement("div",{style:{fontSize:20,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%"}},[c.createElement("div",{}),["请先登录:",c.createElement("table",{},[c.createElement("tr",{},[c.createElement("td",{},["帐号:",c.createElement("input",{id:"local_debug_account",style:{fontSize:20,width:400}})])]),c.createElement("tr",{},[c.createElement("td",{},["密码:",c.createElement("input",{id:"local_debug_password",type:"password",style:{fontSize:20,width:400}})])]),c.createElement("tr",{},[c.createElement("td",{colSpan:2},[c.createElement("button",{style:{fontSize:20,width:"100%"},onClickCapture:function(){e.onLogin({email:V("local_debug_account"),loginStatus:2,password:V("local_debug_password")})}},["登录"])])])])]])},J=function(e){var t=e.post,n=o._objectWithoutPropertiesLoose(e,K),r=j(),i=R(),a=window.localStorage.getItem("quick_local_debug_lang")||"zh-CN",u=Z(t,"/store/store/list").data;return c.createElement("div",{style:{position:"fixed",right:10,bottom:10,zIndex:1e4}},["quick-platform子应用调试工具:",c.createElement("div",{key:"store"},[c.createElement("span",{style:{float:"left"}},["当前店铺:"]),c.createElement("select",{style:{fontSize:16},value:r.id,onChange:function(e){t("/store/store/switch",{storeId:e.target.value}).then((function(e){sessionStorage.setItem("quick-storeId",e.storeId),sessionStorage.setItem("quick-token",e.jwt),sessionStorage.removeItem("quick-qyWechat"),console.log("%c [ halvee>]-133","font-size:13px; background:pink; color:#bf2c9f;",e.jwt),window.location.reload()})).catch((function(){alert("切换店铺失败")}))}},(u||[]).map((function(e){return c.createElement("option",{value:e.id,key:e.id},[e.storeName])})))]),c.createElement("div",{},[c.createElement("span",{style:{float:"left"}},["当前语言:"]),c.createElement("select",{style:{fontSize:16},value:a,onChange:function(e){localStorage.setItem("quick_local_debug_lang",e.target.value),window.location.reload()}},["zh-CN","en-US","ko","ja","zh-TW"].map((function(e){return c.createElement("option",{value:e,key:e},[e])})))]),c.createElement("div",{key:"user"},["当前用户:"+i.email]),c.createElement("button",{onClick:function(){sessionStorage.clear(),n.onLogout()}},["退出登录"])])},X=s.createFromIconfontCN({scriptUrl:document.getElementById("_CD_ICON_1633")?"":"https://front-assets.obs.ap-southeast-3.myhuaweicloud.com/library/icon/icon.js"}),ee=c.createContext({data:null}),te=function(e,t){return new Promise((function(n,r){var o=new window.Image;o.src=URL.createObjectURL(t),o.onload=n.bind(null,o.src),o.onerror=r.bind(null,e)}))},ne=function(e){return function(t){return e(t).then(te.bind(null,t)).catch((function(){return Promise.reject(t)}))}},re=ne((function(e){return fetch(e,{headers:{},mode:"cors"}).then((function(e){return e.blob()})).then((function(e){return l({blob:e})})).then((function(e){return Array.isArray(e)?e[0]:e}))})),oe=new Map,ie=function(e,t){if(oe.has(e))return oe.get(e);var n=t(e);return oe.set(e,n),n.finally((function(){oe.delete(e)})),n},ae=f.CancelToken,ue=function(e,t){return void 0===t&&(t={}),function(n,r){return void 0===r&&(r={}),function(o,i){return void 0===i&&(i={}),e(n,o||{},Object.assign({},t,r,i))}}},ce={__proto__:null,isMicroApp:d,tryImageTranscode:function(e,t){if(!t)return ie(e,(function(){return re(e)}));var n=ne(t);return ie(e,(function(){return re(e).catch(n)}))},buildHttpCtrl:function(e){var t,n=[],r=function(e){var t=f.create({baseURL:e}),n=t.interceptors.response.use.bind(t.interceptors.response),r=t.interceptors.request.use.bind(t.interceptors.request);return{instance:t,useRequestInterCeptor:r,useResponseInterCeptor:n}}(e),i=r.useRequestInterCeptor,a=r.useResponseInterCeptor,u=(t=n,function(e){for(;t.length;)t.shift().cancel(e)}),c=function(e,t){return["get","post"].map((function(n){return function(r,i,a){var u,c=(null==a?void 0:a.cancelTokenSource)||ae.source();null==a||delete a.cancelTokenSource;var s=((u={})["get"===n?"params":"data"]=i,u);t.push(c);var l=r.replace(/\{([a-zA-Z]+)\}/g,(function(e,t){if(!i)return t;var n=i[t]||t;return i.saveQuery?(console.log("params",i),delete i.saveQuery):delete i[t],n}));return e.request(o._extends({url:l,method:n.toUpperCase(),cancelToken:c.token},s,a||{})).then((function(e){return null==e?void 0:e.data})).then((function(e){return e.success?e.data:Promise.reject(e)}))}}))}(r.instance,n),s=c[0],l=c[1];return{abort:u,get:s,post:l,cancelCreator:function(e){return function(){for(var t=ae.source(),n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i="string"==typeof r[0]?2:1;return r[i]=Object.assign({},r[i]||{},{cancelTokenSource:t}),[e.apply(void 0,r),function(e){t.cancel(e)}]}},getCreator:ue(s),postCreator:ue(l),useRequestInterCeptor:i,useResponseInterCeptor:a}},installI18n:D},se=c.createContext({colorPrimary:o.PrimaryColor,setPrimaryColor:function(e){}});window.__quick_platform_get_current_app__=_,exports.Theme=o.index,exports.App=function(e){var t,n=_(),r=u.useState(null==(t=n.parent)?void 0:t.cache(n.name+"-data")),o=r[0],i=r[1];u.useEffect((function(){var e=function(e){i(e)};return B.on(n.name+"-data-change",e),function(){B.off(n.name+"-data-change",e)}}),[n.name]);var a=u.useMemo((function(){return{data:o}}),[o]);return c.createElement(ee.Provider,{value:a},[e.children])},exports.AppEvent=B,exports.Authentication=O,exports.I18nFC=function(e,t){if(!t)return e;var n=[],r=0;return e.replace(/\{[a-zA-Z_0-9]*\}/g,(function(o,i){var a=e.slice(r,i);return n.push(a),n.push(t[o.slice(1,-1)]),r=i+o.length,""})),n.push(e.slice(r,e.length)),c.createElement(c.Fragment,{},n)},exports.IconFont=X,exports.LocalDebug=function(e){var t=e.post,n=o._objectWithoutPropertiesLoose(e,Q),r=Z(t,"/store/user/getUserInfo"),i=r.data,a=r.setData;return r.loading?H:i?(sessionStorage.setItem("quick-token",i.jwt),P(i),c.createElement(c.Fragment,{},n.hideInfo?n.children:[c.createElement(J,{key:"info-wrapper",post:t,onLogout:function(){a(null)}}),n.children])):c.createElement(Y,{onLogin:function(e){t("/store/user/login",e).then((function(e){P(e),a(e)})).catch((function(e){alert(e.data.message||"登录失败")}))}})},exports.MicroApp=function(e){var t=u.useRef(),n=u.useState(!0),r=n[0],o=n[1];return u.useEffect((function(){return function(){t.current&&(console.log(e.name,"应用卸载"),t.current.unmount(),console.log(e.name,"应用卸载完成"))}}),[]),u.useState((function(){e.data&&_().cache(e.name+"-data",e.data)})),u.useEffect((function(){e.data&&(_().cache(e.name+"-data",e.data),B.broadcast(e.name+"-data-change",e.data))}),[e.data,e.name]),c.createElement("div",{style:{width:"100%",height:"100%",position:"relative"}},[c.createElement("div",{style:{width:"100%",height:"100%"},className:e.className,ref:function(n){if(n&&!t.current){var r=T();t.current=function(e,t,n){var r=n||{},o=r.host,a=r.base,u=i.loadMicroApp({name:e,entry:(void 0===o?"":o)||window.location.origin+"/micro/"+e+"/"+((null==n?void 0:n.entry)||"micro")+".html",container:t,props:{base:void 0===a?"":a,name:e}});return u.mountPromise.catch((function(e){console.log("----启动子应用失败",e)})),u}(e.name,n,Object.assign({},e.extra,p("base",e.base),p("host",e.host),p("env",e.env||r.env),p("entry",e.entry))),t.current.mountPromise.then((function(){o(!1),null==e.onMounted||e.onMounted()}))}}}),r?c.createElement("div",{style:{width:"100%",height:"100%",position:"absolute",top:0,left:0}},[e.loading]):null])},exports.Permission=function(e){var t=e.auth,n=void 0===t?function(){return!0}:t,r=o._objectWithoutPropertiesLoose(e,W);return L(r.code)&&n()?r.children:null},exports.ThemeHOC=function(e){return function(e){return function(t){var n=u.useState(o.PrimaryColor),r=n[1];return c.createElement(se.Provider,{key:"theme-hoc",value:{colorPrimary:n[0],setPrimaryColor:function(e){r(e)}}},[c.createElement(e,o._extends({},t,{key:"theme-hoc-component"}))])}}(e)},exports.Utils=ce,exports.getCurrentApp=_,exports.registerApp=function(e){v(e.name);var n=e.i18n?function(){var t=D(e.name,e.env);return!1!==e.i18n.global&&(window.$$i18n=t.$$i18n,window.$i18n=t.$i18n),Promise.all([t.loadPromise,null==e.i18n.onReady?void 0:e.i18n.onReady(t)])}:function(){return Promise.resolve()};return{beforeMount:function(){return o._asyncToGenerator(o._regeneratorRuntime().mark((function e(){return o._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(){})));case 1:case"end":return e.stop()}}),e)})))()},mount:function(t){return o._asyncToGenerator(o._regeneratorRuntime().mark((function n(){return o._regeneratorRuntime().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return v(e.name),n.abrupt("return",null==e.lifecycles.mount?void 0:e.lifecycles.mount(t));case 2:case"end":return n.stop()}}),n)})))()},unmount:function(n){return o._asyncToGenerator(o._regeneratorRuntime().mark((function r(){return o._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t&&(t.destroy(),t=void 0),r.abrupt("return",null==e.lifecycles.unmount?void 0:e.lifecycles.unmount(n));case 2:case"end":return r.stop()}}),r)})))()},bootstrap:function(t){return o._asyncToGenerator(o._regeneratorRuntime().mark((function r(){return o._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n();case 2:return d&&t.base&&(console.log("来自主应用的路由base控制:",t.base),window.quick_qiankun_router_base=t.base),r.abrupt("return",null==e.lifecycles.bootstrap?void 0:e.lifecycles.bootstrap(t));case 4:case"end":return r.stop()}}),r)})))()}}},exports.useAppData=function(){return c.useContext(ee).data},exports.useThemePrimaryColor=function(){var e=u.useContext(se);return{color:e.colorPrimary,set:function(t){e.setPrimaryColor(t),o.updateBrandColor(t),document.documentElement.style.setProperty(o.generateVar("primary"),o.PrimaryColor)}}};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|