@lark-apaas/client-toolkit-lite 1.1.1-beta.0 → 1.1.1-beta.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/index.cjs +152 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +147 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,9 +34,11 @@ __export(index_exports, {
|
|
|
34
34
|
ActiveLink: () => ActiveLink,
|
|
35
35
|
AppContainer: () => AppContainer_default,
|
|
36
36
|
NavLink: () => NavLink2,
|
|
37
|
+
PagePlaceholder: () => PagePlaceholder_default,
|
|
37
38
|
QueryProvider: () => QueryProvider_default,
|
|
38
39
|
TrackKey: () => TrackKey,
|
|
39
40
|
UniversalLink: () => UniversalLink,
|
|
41
|
+
Welcome: () => Welcome_default,
|
|
40
42
|
avatarImages: () => avatar_exports,
|
|
41
43
|
axiosForBackend: () => axiosForBackend,
|
|
42
44
|
bannerImages: () => banner_exports,
|
|
@@ -559,19 +561,62 @@ var messages = {
|
|
|
559
561
|
},
|
|
560
562
|
"safety.cover.pc": {
|
|
561
563
|
zh: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png",
|
|
562
|
-
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-
|
|
564
|
+
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-weben.png"
|
|
563
565
|
},
|
|
564
566
|
"safety.cover.mobile": {
|
|
565
567
|
zh: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png",
|
|
566
|
-
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-
|
|
568
|
+
en: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobileen.png"
|
|
567
569
|
}
|
|
568
570
|
};
|
|
569
571
|
var messages_default = messages;
|
|
570
572
|
|
|
571
573
|
// src/utils/locale.ts
|
|
574
|
+
var STORAGE_KEY = "miaoda:preview-locale";
|
|
575
|
+
function toLocale(value) {
|
|
576
|
+
const lang = value ?? "zh";
|
|
577
|
+
return lang.toLowerCase().startsWith("zh") ? "zh" : "en";
|
|
578
|
+
}
|
|
579
|
+
__name(toLocale, "toLocale");
|
|
580
|
+
function readLocaleFromQuery() {
|
|
581
|
+
if (typeof window === "undefined") return null;
|
|
582
|
+
try {
|
|
583
|
+
const value = new URLSearchParams(window.location.search).get("locale");
|
|
584
|
+
return value && value.length > 0 ? value : null;
|
|
585
|
+
} catch {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
__name(readLocaleFromQuery, "readLocaleFromQuery");
|
|
590
|
+
function readLocaleFromStorage() {
|
|
591
|
+
if (typeof window === "undefined") return null;
|
|
592
|
+
try {
|
|
593
|
+
const value = window.localStorage?.getItem(STORAGE_KEY);
|
|
594
|
+
return value && value.length > 0 ? value : null;
|
|
595
|
+
} catch {
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
__name(readLocaleFromStorage, "readLocaleFromStorage");
|
|
600
|
+
function writeLocaleToStorage(value) {
|
|
601
|
+
if (typeof window === "undefined") return;
|
|
602
|
+
try {
|
|
603
|
+
window.localStorage?.setItem(STORAGE_KEY, value);
|
|
604
|
+
} catch {
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
__name(writeLocaleToStorage, "writeLocaleToStorage");
|
|
572
608
|
function getLocale() {
|
|
573
|
-
|
|
574
|
-
|
|
609
|
+
if (process.env.NODE_ENV === "production") {
|
|
610
|
+
return toLocale(navigator.language);
|
|
611
|
+
}
|
|
612
|
+
const fromQuery = readLocaleFromQuery();
|
|
613
|
+
if (fromQuery) {
|
|
614
|
+
writeLocaleToStorage(fromQuery);
|
|
615
|
+
return toLocale(fromQuery);
|
|
616
|
+
}
|
|
617
|
+
const fromStorage = readLocaleFromStorage();
|
|
618
|
+
if (fromStorage) return toLocale(fromStorage);
|
|
619
|
+
return toLocale(navigator.language);
|
|
575
620
|
}
|
|
576
621
|
__name(getLocale, "getLocale");
|
|
577
622
|
|
|
@@ -1235,13 +1280,100 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
1235
1280
|
}, "AppContainer");
|
|
1236
1281
|
var AppContainer_default = AppContainer;
|
|
1237
1282
|
|
|
1238
|
-
// src/
|
|
1283
|
+
// src/components/Welcome/index.tsx
|
|
1239
1284
|
var import_react8 = __toESM(require("react"), 1);
|
|
1285
|
+
var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
1286
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
1287
|
+
style: {
|
|
1288
|
+
display: "flex",
|
|
1289
|
+
flexDirection: "column",
|
|
1290
|
+
alignItems: "center",
|
|
1291
|
+
justifyContent: "center",
|
|
1292
|
+
width: "100%",
|
|
1293
|
+
height: "calc(100vh - 64px)",
|
|
1294
|
+
padding: "0 24px",
|
|
1295
|
+
textAlign: "center"
|
|
1296
|
+
}
|
|
1297
|
+
}, /* @__PURE__ */ import_react8.default.createElement("img", {
|
|
1298
|
+
style: {
|
|
1299
|
+
borderRadius: 6,
|
|
1300
|
+
marginBottom: 24
|
|
1301
|
+
},
|
|
1302
|
+
width: "320",
|
|
1303
|
+
height: "200",
|
|
1304
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
1305
|
+
alt: "Welcome"
|
|
1306
|
+
}), /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
1307
|
+
style: {
|
|
1308
|
+
fontSize: 16,
|
|
1309
|
+
fontWeight: 500,
|
|
1310
|
+
lineHeight: "24px",
|
|
1311
|
+
marginBottom: 4,
|
|
1312
|
+
color: "#1f2329"
|
|
1313
|
+
}
|
|
1314
|
+
}, title), /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
1315
|
+
style: {
|
|
1316
|
+
fontSize: 16,
|
|
1317
|
+
lineHeight: "24px",
|
|
1318
|
+
color: "#8f959e",
|
|
1319
|
+
maxWidth: 480
|
|
1320
|
+
}
|
|
1321
|
+
}, description));
|
|
1322
|
+
}, "Welcome");
|
|
1323
|
+
var Welcome_default = Welcome;
|
|
1324
|
+
|
|
1325
|
+
// src/components/PagePlaceholder/index.tsx
|
|
1326
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
1327
|
+
var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
1328
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1329
|
+
style: {
|
|
1330
|
+
display: "flex",
|
|
1331
|
+
flexDirection: "column",
|
|
1332
|
+
alignItems: "center",
|
|
1333
|
+
justifyContent: "center",
|
|
1334
|
+
padding: "0 24px",
|
|
1335
|
+
width: "100%",
|
|
1336
|
+
height: "calc(100vh - 64px)",
|
|
1337
|
+
textAlign: "center"
|
|
1338
|
+
}
|
|
1339
|
+
}, /* @__PURE__ */ import_react9.default.createElement("img", {
|
|
1340
|
+
style: {
|
|
1341
|
+
borderRadius: "6px",
|
|
1342
|
+
marginBottom: "24px"
|
|
1343
|
+
},
|
|
1344
|
+
width: "320",
|
|
1345
|
+
height: "200",
|
|
1346
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
1347
|
+
alt: "Welcome"
|
|
1348
|
+
}), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1349
|
+
style: {
|
|
1350
|
+
fontSize: "16px",
|
|
1351
|
+
fontWeight: 500,
|
|
1352
|
+
marginBottom: "4px",
|
|
1353
|
+
lineHeight: "24px"
|
|
1354
|
+
}
|
|
1355
|
+
}, title), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1356
|
+
style: {
|
|
1357
|
+
color: "#6b7280",
|
|
1358
|
+
fontSize: "16px",
|
|
1359
|
+
lineHeight: "24px",
|
|
1360
|
+
maxWidth: "480px",
|
|
1361
|
+
overflow: "hidden",
|
|
1362
|
+
display: "-webkit-box",
|
|
1363
|
+
WebkitLineClamp: 2,
|
|
1364
|
+
WebkitBoxOrient: "vertical"
|
|
1365
|
+
}
|
|
1366
|
+
}, description));
|
|
1367
|
+
}, "PagePlaceholder");
|
|
1368
|
+
var PagePlaceholder_default = PagePlaceholder;
|
|
1369
|
+
|
|
1370
|
+
// src/route-components/ActiveLink.tsx
|
|
1371
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
1240
1372
|
var import_react_router_dom = require("react-router-dom");
|
|
1241
|
-
var ActiveLink = /* @__PURE__ */ (0,
|
|
1242
|
-
const [currentHash, setCurrentHash] = (0,
|
|
1373
|
+
var ActiveLink = /* @__PURE__ */ (0, import_react10.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
1374
|
+
const [currentHash, setCurrentHash] = (0, import_react10.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
1243
1375
|
const isHashRoute = typeof to === "string" && to.startsWith("#");
|
|
1244
|
-
(0,
|
|
1376
|
+
(0, import_react10.useEffect)(() => {
|
|
1245
1377
|
if (!isHashRoute) return;
|
|
1246
1378
|
const handleHashChange = /* @__PURE__ */ __name(() => {
|
|
1247
1379
|
setCurrentHash(window.location.hash);
|
|
@@ -1253,7 +1385,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react8.forwardRef)(({ to, onClick, c
|
|
|
1253
1385
|
]);
|
|
1254
1386
|
const isActive = isHashRoute && currentHash === to;
|
|
1255
1387
|
if (!isHashRoute) {
|
|
1256
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react_router_dom.NavLink, {
|
|
1257
1389
|
ref,
|
|
1258
1390
|
to,
|
|
1259
1391
|
onClick,
|
|
@@ -1294,7 +1426,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react8.forwardRef)(({ to, onClick, c
|
|
|
1294
1426
|
isPending: false,
|
|
1295
1427
|
isTransitioning: false
|
|
1296
1428
|
}) : children;
|
|
1297
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ import_react10.default.createElement("a", {
|
|
1298
1430
|
ref,
|
|
1299
1431
|
href: to,
|
|
1300
1432
|
onClick: handleHashClick,
|
|
@@ -1306,9 +1438,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react8.forwardRef)(({ to, onClick, c
|
|
|
1306
1438
|
ActiveLink.displayName = "ActiveLink";
|
|
1307
1439
|
|
|
1308
1440
|
// src/route-components/NavLink.tsx
|
|
1309
|
-
var
|
|
1441
|
+
var React8 = __toESM(require("react"), 1);
|
|
1310
1442
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1311
|
-
var NavLink2 = /* @__PURE__ */
|
|
1443
|
+
var NavLink2 = /* @__PURE__ */ React8.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
1312
1444
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
1313
1445
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
1314
1446
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
@@ -1332,7 +1464,7 @@ var NavLink2 = /* @__PURE__ */ React6.forwardRef(({ to, children, className, sty
|
|
|
1332
1464
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
1333
1465
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
1334
1466
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
1335
|
-
return /* @__PURE__ */
|
|
1467
|
+
return /* @__PURE__ */ React8.createElement("a", {
|
|
1336
1468
|
href: to,
|
|
1337
1469
|
onClick: handleClick,
|
|
1338
1470
|
ref,
|
|
@@ -1341,7 +1473,7 @@ var NavLink2 = /* @__PURE__ */ React6.forwardRef(({ to, children, className, sty
|
|
|
1341
1473
|
...restProps
|
|
1342
1474
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
1343
1475
|
}
|
|
1344
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ React8.createElement(import_react_router_dom2.NavLink, {
|
|
1345
1477
|
to,
|
|
1346
1478
|
ref,
|
|
1347
1479
|
className,
|
|
@@ -1356,7 +1488,7 @@ var NavLink2 = /* @__PURE__ */ React6.forwardRef(({ to, children, className, sty
|
|
|
1356
1488
|
NavLink2.displayName = "NavLink";
|
|
1357
1489
|
|
|
1358
1490
|
// src/route-components/UniversalLink.tsx
|
|
1359
|
-
var
|
|
1491
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
1360
1492
|
var import_react_router_dom3 = require("react-router-dom");
|
|
1361
1493
|
function isInternalRoute(to) {
|
|
1362
1494
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -1366,15 +1498,15 @@ function isExternalLink(to) {
|
|
|
1366
1498
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
1367
1499
|
}
|
|
1368
1500
|
__name(isExternalLink, "isExternalLink");
|
|
1369
|
-
var UniversalLink = /* @__PURE__ */
|
|
1501
|
+
var UniversalLink = /* @__PURE__ */ import_react11.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
1370
1502
|
if (isInternalRoute(to)) {
|
|
1371
|
-
return /* @__PURE__ */
|
|
1503
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_router_dom3.Link, {
|
|
1372
1504
|
to,
|
|
1373
1505
|
ref,
|
|
1374
1506
|
...props
|
|
1375
1507
|
});
|
|
1376
1508
|
}
|
|
1377
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ import_react11.default.createElement("a", {
|
|
1378
1510
|
href: to,
|
|
1379
1511
|
ref,
|
|
1380
1512
|
...props,
|
|
@@ -1799,9 +1931,11 @@ var abstractArt3dRenderingCoverImg6 = "https://lf3-static.bytednsdoc.com/obj/ede
|
|
|
1799
1931
|
ActiveLink,
|
|
1800
1932
|
AppContainer,
|
|
1801
1933
|
NavLink,
|
|
1934
|
+
PagePlaceholder,
|
|
1802
1935
|
QueryProvider,
|
|
1803
1936
|
TrackKey,
|
|
1804
1937
|
UniversalLink,
|
|
1938
|
+
Welcome,
|
|
1805
1939
|
avatarImages,
|
|
1806
1940
|
axiosForBackend,
|
|
1807
1941
|
bannerImages,
|