@lark-apaas/client-toolkit-lite 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +106 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +102 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -61,6 +61,11 @@ declare const Welcome: React__default.FC<{
|
|
|
61
61
|
description?: string;
|
|
62
62
|
}>;
|
|
63
63
|
|
|
64
|
+
declare const PagePlaceholder: React__default.FC<{
|
|
65
|
+
title?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
}>;
|
|
68
|
+
|
|
64
69
|
interface ActiveLinkProps extends Omit<NavLinkProps, 'to'> {
|
|
65
70
|
to: string;
|
|
66
71
|
}
|
|
@@ -427,4 +432,4 @@ declare namespace cover {
|
|
|
427
432
|
export { cover_abstractArt3dRenderingCoverImg1 as abstractArt3dRenderingCoverImg1, cover_abstractArt3dRenderingCoverImg2 as abstractArt3dRenderingCoverImg2, cover_abstractArt3dRenderingCoverImg3 as abstractArt3dRenderingCoverImg3, cover_abstractArt3dRenderingCoverImg4 as abstractArt3dRenderingCoverImg4, cover_abstractArt3dRenderingCoverImg5 as abstractArt3dRenderingCoverImg5, cover_abstractArt3dRenderingCoverImg6 as abstractArt3dRenderingCoverImg6, cover_appealClothingCoverImg1 as appealClothingCoverImg1, cover_appealClothingCoverImg2 as appealClothingCoverImg2, cover_appealClothingCoverImg3 as appealClothingCoverImg3, cover_appealClothingCoverImg4 as appealClothingCoverImg4, cover_appealClothingCoverImg5 as appealClothingCoverImg5, cover_appealClothingCoverImg6 as appealClothingCoverImg6, cover_architectureCoverImg1 as architectureCoverImg1, cover_architectureCoverImg2 as architectureCoverImg2, cover_architectureCoverImg3 as architectureCoverImg3, cover_architectureCoverImg4 as architectureCoverImg4, cover_architectureCoverImg5 as architectureCoverImg5, cover_architectureCoverImg6 as architectureCoverImg6, cover_officeCoverImg1 as officeCoverImg1, cover_officeCoverImg2 as officeCoverImg2, cover_officeCoverImg3 as officeCoverImg3, cover_officeCoverImg4 as officeCoverImg4, cover_officeCoverImg5 as officeCoverImg5, cover_officeCoverImg6 as officeCoverImg6, cover_sceneryCoverImg1 as sceneryCoverImg1, cover_sceneryCoverImg2 as sceneryCoverImg2, cover_sceneryCoverImg3 as sceneryCoverImg3, cover_sceneryCoverImg4 as sceneryCoverImg4, cover_sceneryCoverImg5 as sceneryCoverImg5, cover_sceneryCoverImg6 as sceneryCoverImg6, cover_technologyInternetCoverImg1 as technologyInternetCoverImg1, cover_technologyInternetCoverImg2 as technologyInternetCoverImg2, cover_technologyInternetCoverImg3 as technologyInternetCoverImg3, cover_technologyInternetCoverImg4 as technologyInternetCoverImg4, cover_technologyInternetCoverImg5 as technologyInternetCoverImg5, cover_technologyInternetCoverImg6 as technologyInternetCoverImg6 };
|
|
428
433
|
}
|
|
429
434
|
|
|
430
|
-
export { ActiveLink, AppContainer, type AppInfoPayload, type IFileAttachment, type IJson, type IUserProfile, NavLink, QueryProvider, TrackKey, type TrackParams, UniversalLink, Welcome, avatar as avatarImages, axiosForBackend, banner as bannerImages, clsxWithTw, copyToClipboard, cover as coverImages, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, isIOS, isIpad, isMobile, isPreview, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
|
|
435
|
+
export { ActiveLink, AppContainer, type AppInfoPayload, type IFileAttachment, type IJson, type IUserProfile, NavLink, PagePlaceholder, QueryProvider, TrackKey, type TrackParams, UniversalLink, Welcome, avatar as avatarImages, axiosForBackend, banner as bannerImages, clsxWithTw, copyToClipboard, cover as coverImages, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, isIOS, isIpad, isMobile, isPreview, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,11 @@ declare const Welcome: React__default.FC<{
|
|
|
61
61
|
description?: string;
|
|
62
62
|
}>;
|
|
63
63
|
|
|
64
|
+
declare const PagePlaceholder: React__default.FC<{
|
|
65
|
+
title?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
}>;
|
|
68
|
+
|
|
64
69
|
interface ActiveLinkProps extends Omit<NavLinkProps, 'to'> {
|
|
65
70
|
to: string;
|
|
66
71
|
}
|
|
@@ -427,4 +432,4 @@ declare namespace cover {
|
|
|
427
432
|
export { cover_abstractArt3dRenderingCoverImg1 as abstractArt3dRenderingCoverImg1, cover_abstractArt3dRenderingCoverImg2 as abstractArt3dRenderingCoverImg2, cover_abstractArt3dRenderingCoverImg3 as abstractArt3dRenderingCoverImg3, cover_abstractArt3dRenderingCoverImg4 as abstractArt3dRenderingCoverImg4, cover_abstractArt3dRenderingCoverImg5 as abstractArt3dRenderingCoverImg5, cover_abstractArt3dRenderingCoverImg6 as abstractArt3dRenderingCoverImg6, cover_appealClothingCoverImg1 as appealClothingCoverImg1, cover_appealClothingCoverImg2 as appealClothingCoverImg2, cover_appealClothingCoverImg3 as appealClothingCoverImg3, cover_appealClothingCoverImg4 as appealClothingCoverImg4, cover_appealClothingCoverImg5 as appealClothingCoverImg5, cover_appealClothingCoverImg6 as appealClothingCoverImg6, cover_architectureCoverImg1 as architectureCoverImg1, cover_architectureCoverImg2 as architectureCoverImg2, cover_architectureCoverImg3 as architectureCoverImg3, cover_architectureCoverImg4 as architectureCoverImg4, cover_architectureCoverImg5 as architectureCoverImg5, cover_architectureCoverImg6 as architectureCoverImg6, cover_officeCoverImg1 as officeCoverImg1, cover_officeCoverImg2 as officeCoverImg2, cover_officeCoverImg3 as officeCoverImg3, cover_officeCoverImg4 as officeCoverImg4, cover_officeCoverImg5 as officeCoverImg5, cover_officeCoverImg6 as officeCoverImg6, cover_sceneryCoverImg1 as sceneryCoverImg1, cover_sceneryCoverImg2 as sceneryCoverImg2, cover_sceneryCoverImg3 as sceneryCoverImg3, cover_sceneryCoverImg4 as sceneryCoverImg4, cover_sceneryCoverImg5 as sceneryCoverImg5, cover_sceneryCoverImg6 as sceneryCoverImg6, cover_technologyInternetCoverImg1 as technologyInternetCoverImg1, cover_technologyInternetCoverImg2 as technologyInternetCoverImg2, cover_technologyInternetCoverImg3 as technologyInternetCoverImg3, cover_technologyInternetCoverImg4 as technologyInternetCoverImg4, cover_technologyInternetCoverImg5 as technologyInternetCoverImg5, cover_technologyInternetCoverImg6 as technologyInternetCoverImg6 };
|
|
428
433
|
}
|
|
429
434
|
|
|
430
|
-
export { ActiveLink, AppContainer, type AppInfoPayload, type IFileAttachment, type IJson, type IUserProfile, NavLink, QueryProvider, TrackKey, type TrackParams, UniversalLink, Welcome, avatar as avatarImages, axiosForBackend, banner as bannerImages, clsxWithTw, copyToClipboard, cover as coverImages, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, isIOS, isIpad, isMobile, isPreview, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
|
|
435
|
+
export { ActiveLink, AppContainer, type AppInfoPayload, type IFileAttachment, type IJson, type IUserProfile, NavLink, PagePlaceholder, QueryProvider, TrackKey, type TrackParams, UniversalLink, Welcome, avatar as avatarImages, axiosForBackend, banner as bannerImages, clsxWithTw, copyToClipboard, cover as coverImages, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, isIOS, isIpad, isMobile, isPreview, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
|
package/dist/index.js
CHANGED
|
@@ -506,9 +506,52 @@ var messages = {
|
|
|
506
506
|
var messages_default = messages;
|
|
507
507
|
|
|
508
508
|
// src/utils/locale.ts
|
|
509
|
+
var STORAGE_KEY = "miaoda:preview-locale";
|
|
510
|
+
function toLocale(value) {
|
|
511
|
+
const lang = value ?? "zh";
|
|
512
|
+
return lang.toLowerCase().startsWith("zh") ? "zh" : "en";
|
|
513
|
+
}
|
|
514
|
+
__name(toLocale, "toLocale");
|
|
515
|
+
function readLocaleFromQuery() {
|
|
516
|
+
if (typeof window === "undefined") return null;
|
|
517
|
+
try {
|
|
518
|
+
const value = new URLSearchParams(window.location.search).get("locale");
|
|
519
|
+
return value && value.length > 0 ? value : null;
|
|
520
|
+
} catch {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
__name(readLocaleFromQuery, "readLocaleFromQuery");
|
|
525
|
+
function readLocaleFromStorage() {
|
|
526
|
+
if (typeof window === "undefined") return null;
|
|
527
|
+
try {
|
|
528
|
+
const value = window.localStorage?.getItem(STORAGE_KEY);
|
|
529
|
+
return value && value.length > 0 ? value : null;
|
|
530
|
+
} catch {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
__name(readLocaleFromStorage, "readLocaleFromStorage");
|
|
535
|
+
function writeLocaleToStorage(value) {
|
|
536
|
+
if (typeof window === "undefined") return;
|
|
537
|
+
try {
|
|
538
|
+
window.localStorage?.setItem(STORAGE_KEY, value);
|
|
539
|
+
} catch {
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
__name(writeLocaleToStorage, "writeLocaleToStorage");
|
|
509
543
|
function getLocale() {
|
|
510
|
-
|
|
511
|
-
|
|
544
|
+
if (process.env.NODE_ENV === "production") {
|
|
545
|
+
return toLocale(navigator.language);
|
|
546
|
+
}
|
|
547
|
+
const fromQuery = readLocaleFromQuery();
|
|
548
|
+
if (fromQuery) {
|
|
549
|
+
writeLocaleToStorage(fromQuery);
|
|
550
|
+
return toLocale(fromQuery);
|
|
551
|
+
}
|
|
552
|
+
const fromStorage = readLocaleFromStorage();
|
|
553
|
+
if (fromStorage) return toLocale(fromStorage);
|
|
554
|
+
return toLocale(navigator.language);
|
|
512
555
|
}
|
|
513
556
|
__name(getLocale, "getLocale");
|
|
514
557
|
|
|
@@ -1214,8 +1257,53 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
1214
1257
|
}, "Welcome");
|
|
1215
1258
|
var Welcome_default = Welcome;
|
|
1216
1259
|
|
|
1260
|
+
// src/components/PagePlaceholder/index.tsx
|
|
1261
|
+
import React6 from "react";
|
|
1262
|
+
var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
1263
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
1264
|
+
style: {
|
|
1265
|
+
display: "flex",
|
|
1266
|
+
flexDirection: "column",
|
|
1267
|
+
alignItems: "center",
|
|
1268
|
+
justifyContent: "center",
|
|
1269
|
+
padding: "0 24px",
|
|
1270
|
+
width: "100%",
|
|
1271
|
+
height: "calc(100vh - 64px)",
|
|
1272
|
+
textAlign: "center"
|
|
1273
|
+
}
|
|
1274
|
+
}, /* @__PURE__ */ React6.createElement("img", {
|
|
1275
|
+
style: {
|
|
1276
|
+
borderRadius: "6px",
|
|
1277
|
+
marginBottom: "24px"
|
|
1278
|
+
},
|
|
1279
|
+
width: "320",
|
|
1280
|
+
height: "200",
|
|
1281
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
1282
|
+
alt: "Welcome"
|
|
1283
|
+
}), /* @__PURE__ */ React6.createElement("div", {
|
|
1284
|
+
style: {
|
|
1285
|
+
fontSize: "16px",
|
|
1286
|
+
fontWeight: 500,
|
|
1287
|
+
marginBottom: "4px",
|
|
1288
|
+
lineHeight: "24px"
|
|
1289
|
+
}
|
|
1290
|
+
}, title), /* @__PURE__ */ React6.createElement("div", {
|
|
1291
|
+
style: {
|
|
1292
|
+
color: "#6b7280",
|
|
1293
|
+
fontSize: "16px",
|
|
1294
|
+
lineHeight: "24px",
|
|
1295
|
+
maxWidth: "480px",
|
|
1296
|
+
overflow: "hidden",
|
|
1297
|
+
display: "-webkit-box",
|
|
1298
|
+
WebkitLineClamp: 2,
|
|
1299
|
+
WebkitBoxOrient: "vertical"
|
|
1300
|
+
}
|
|
1301
|
+
}, description));
|
|
1302
|
+
}, "PagePlaceholder");
|
|
1303
|
+
var PagePlaceholder_default = PagePlaceholder;
|
|
1304
|
+
|
|
1217
1305
|
// src/route-components/ActiveLink.tsx
|
|
1218
|
-
import
|
|
1306
|
+
import React7, { forwardRef, useEffect as useEffect5, useState as useState5 } from "react";
|
|
1219
1307
|
import { NavLink } from "react-router-dom";
|
|
1220
1308
|
var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
1221
1309
|
const [currentHash, setCurrentHash] = useState5(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
@@ -1232,7 +1320,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
1232
1320
|
]);
|
|
1233
1321
|
const isActive = isHashRoute && currentHash === to;
|
|
1234
1322
|
if (!isHashRoute) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1323
|
+
return /* @__PURE__ */ React7.createElement(NavLink, {
|
|
1236
1324
|
ref,
|
|
1237
1325
|
to,
|
|
1238
1326
|
onClick,
|
|
@@ -1273,7 +1361,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
1273
1361
|
isPending: false,
|
|
1274
1362
|
isTransitioning: false
|
|
1275
1363
|
}) : children;
|
|
1276
|
-
return /* @__PURE__ */
|
|
1364
|
+
return /* @__PURE__ */ React7.createElement("a", {
|
|
1277
1365
|
ref,
|
|
1278
1366
|
href: to,
|
|
1279
1367
|
onClick: handleHashClick,
|
|
@@ -1285,9 +1373,9 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
1285
1373
|
ActiveLink.displayName = "ActiveLink";
|
|
1286
1374
|
|
|
1287
1375
|
// src/route-components/NavLink.tsx
|
|
1288
|
-
import * as
|
|
1376
|
+
import * as React8 from "react";
|
|
1289
1377
|
import { NavLink as OriginalNavLink, useLocation, useNavigate } from "react-router-dom";
|
|
1290
|
-
var NavLink2 = /* @__PURE__ */
|
|
1378
|
+
var NavLink2 = /* @__PURE__ */ React8.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
1291
1379
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
1292
1380
|
const location = useLocation();
|
|
1293
1381
|
const navigate = useNavigate();
|
|
@@ -1311,7 +1399,7 @@ var NavLink2 = /* @__PURE__ */ React7.forwardRef(({ to, children, className, sty
|
|
|
1311
1399
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
1312
1400
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
1313
1401
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
1314
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ React8.createElement("a", {
|
|
1315
1403
|
href: to,
|
|
1316
1404
|
onClick: handleClick,
|
|
1317
1405
|
ref,
|
|
@@ -1320,7 +1408,7 @@ var NavLink2 = /* @__PURE__ */ React7.forwardRef(({ to, children, className, sty
|
|
|
1320
1408
|
...restProps
|
|
1321
1409
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
1322
1410
|
}
|
|
1323
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ React8.createElement(OriginalNavLink, {
|
|
1324
1412
|
to,
|
|
1325
1413
|
ref,
|
|
1326
1414
|
className,
|
|
@@ -1335,7 +1423,7 @@ var NavLink2 = /* @__PURE__ */ React7.forwardRef(({ to, children, className, sty
|
|
|
1335
1423
|
NavLink2.displayName = "NavLink";
|
|
1336
1424
|
|
|
1337
1425
|
// src/route-components/UniversalLink.tsx
|
|
1338
|
-
import
|
|
1426
|
+
import React9 from "react";
|
|
1339
1427
|
import { Link as RouterLink } from "react-router-dom";
|
|
1340
1428
|
function isInternalRoute(to) {
|
|
1341
1429
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -1345,15 +1433,15 @@ function isExternalLink(to) {
|
|
|
1345
1433
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
1346
1434
|
}
|
|
1347
1435
|
__name(isExternalLink, "isExternalLink");
|
|
1348
|
-
var UniversalLink = /* @__PURE__ */
|
|
1436
|
+
var UniversalLink = /* @__PURE__ */ React9.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
1349
1437
|
if (isInternalRoute(to)) {
|
|
1350
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ React9.createElement(RouterLink, {
|
|
1351
1439
|
to,
|
|
1352
1440
|
ref,
|
|
1353
1441
|
...props
|
|
1354
1442
|
});
|
|
1355
1443
|
}
|
|
1356
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ React9.createElement("a", {
|
|
1357
1445
|
href: to,
|
|
1358
1446
|
ref,
|
|
1359
1447
|
...props,
|
|
@@ -1777,6 +1865,7 @@ export {
|
|
|
1777
1865
|
ActiveLink,
|
|
1778
1866
|
AppContainer_default as AppContainer,
|
|
1779
1867
|
NavLink2 as NavLink,
|
|
1868
|
+
PagePlaceholder_default as PagePlaceholder,
|
|
1780
1869
|
QueryProvider_default as QueryProvider,
|
|
1781
1870
|
TrackKey,
|
|
1782
1871
|
UniversalLink,
|