@lark-apaas/client-toolkit-lite 1.1.7 → 1.1.8-alpha.1

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.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // src/components/AppContainer/index.tsx
9
- import React4, { useEffect as useEffect5 } from "react";
9
+ import React5, { useEffect as useEffect5 } from "react";
10
10
  import { MiaodaInspector } from "@lark-apaas/miaoda-inspector";
11
11
 
12
12
  // src/runtime/react-devtools-hook.ts
@@ -2047,8 +2047,112 @@ var Safety = /* @__PURE__ */ __name(() => {
2047
2047
  }, "Safety");
2048
2048
  var safety_default = Safety;
2049
2049
 
2050
+ // src/components/AppContainer/Watermark.tsx
2051
+ import React3, { useRef as useRef2, useState as useState5 } from "react";
2052
+
2053
+ // src/components/AppContainer/doubao-watermark-asset.ts
2054
+ var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
2055
+ var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
2056
+ var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
2057
+ var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
2058
+
2059
+ // src/components/AppContainer/Watermark.tsx
2060
+ var DOUBAO_SOURCE = "5";
2061
+ var Watermark = /* @__PURE__ */ __name(() => {
2062
+ const [closed, setClosed] = useState5(false);
2063
+ const [open, setOpen] = useState5(false);
2064
+ const timer = useRef2(null);
2065
+ if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
2066
+ if (closed) return null;
2067
+ const enter = /* @__PURE__ */ __name(() => {
2068
+ if (timer.current) clearTimeout(timer.current);
2069
+ setOpen(true);
2070
+ }, "enter");
2071
+ const leave = /* @__PURE__ */ __name(() => {
2072
+ timer.current = setTimeout(() => setOpen(false), 100);
2073
+ }, "leave");
2074
+ return /* @__PURE__ */ React3.createElement("div", {
2075
+ "data-custom-element": "doubao-watermark",
2076
+ onMouseEnter: enter,
2077
+ onMouseLeave: leave,
2078
+ style: {
2079
+ position: "fixed",
2080
+ right: 12,
2081
+ bottom: 12,
2082
+ zIndex: 9999,
2083
+ display: "flex",
2084
+ flexDirection: "column",
2085
+ alignItems: "flex-end"
2086
+ }
2087
+ }, open && // TODO: 点击跳转「投诉与举报」链接(待产品给链接)
2088
+ /* @__PURE__ */ React3.createElement("img", {
2089
+ src: DOUBAO_REPORT_SRC,
2090
+ width: 168,
2091
+ height: 78,
2092
+ alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2093
+ style: {
2094
+ display: "block",
2095
+ cursor: "pointer",
2096
+ marginBottom: -8,
2097
+ marginRight: -12
2098
+ }
2099
+ }), /* @__PURE__ */ React3.createElement("div", {
2100
+ style: {
2101
+ boxSizing: "border-box",
2102
+ display: "inline-flex",
2103
+ alignItems: "center",
2104
+ gap: 4,
2105
+ padding: "6px 12px 6px 8px",
2106
+ background: "#363636",
2107
+ border: "0.5px solid rgba(255,255,255,0.1)",
2108
+ borderRadius: 100,
2109
+ boxShadow: "0px 2px 2px rgba(0,0,0,0.02), 0px 4px 8px rgba(0,0,0,0.04), 0px 8px 16px rgba(0,0,0,0.08)"
2110
+ }
2111
+ }, /* @__PURE__ */ React3.createElement("img", {
2112
+ src: DOUBAO_LOGO_SRC,
2113
+ width: 16,
2114
+ height: 16,
2115
+ alt: "",
2116
+ style: {
2117
+ borderRadius: 100,
2118
+ flexShrink: 0,
2119
+ display: "block"
2120
+ }
2121
+ }), /* @__PURE__ */ React3.createElement("span", {
2122
+ style: {
2123
+ fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
2124
+ fontSize: 12,
2125
+ lineHeight: "18px",
2126
+ color: "rgba(255,255,255,0.85)",
2127
+ whiteSpace: "nowrap"
2128
+ }
2129
+ }, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ React3.createElement("span", {
2130
+ role: "button",
2131
+ "aria-label": "\u5173\u95ED",
2132
+ onClick: /* @__PURE__ */ __name((e) => {
2133
+ e.stopPropagation();
2134
+ setClosed(true);
2135
+ }, "onClick"),
2136
+ style: {
2137
+ display: "inline-flex",
2138
+ alignItems: "center",
2139
+ cursor: "pointer",
2140
+ flexShrink: 0
2141
+ }
2142
+ }, /* @__PURE__ */ React3.createElement("img", {
2143
+ src: DOUBAO_CLOSE_SRC,
2144
+ width: 10,
2145
+ height: 10,
2146
+ alt: "",
2147
+ style: {
2148
+ display: "block"
2149
+ }
2150
+ }))));
2151
+ }, "Watermark");
2152
+ var Watermark_default = Watermark;
2153
+
2050
2154
  // src/components/QueryProvider/index.tsx
2051
- import React3 from "react";
2155
+ import React4 from "react";
2052
2156
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2053
2157
  var defaultQueryClient = null;
2054
2158
  var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
@@ -2069,20 +2173,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
2069
2173
  }, "getDefaultQueryClient");
2070
2174
  var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
2071
2175
  const qc = client ?? getDefaultQueryClient();
2072
- return /* @__PURE__ */ React3.createElement(QueryClientProvider, {
2176
+ return /* @__PURE__ */ React4.createElement(QueryClientProvider, {
2073
2177
  client: qc
2074
2178
  }, children);
2075
2179
  }, "QueryProvider");
2076
2180
  var QueryProvider_default = QueryProvider;
2077
2181
 
2078
2182
  // src/components/AppContainer/IframeBridge.tsx
2079
- import { useEffect as useEffect4, useCallback, useRef as useRef3, useMemo, createElement } from "react";
2183
+ import { useEffect as useEffect4, useCallback, useRef as useRef4, useMemo, createElement } from "react";
2080
2184
  import { useLocation, useNavigate } from "react-router-dom";
2081
2185
 
2082
2186
  // src/hooks/useUpdatingRef.ts
2083
- import { useRef as useRef2 } from "react";
2187
+ import { useRef as useRef3 } from "react";
2084
2188
  function useUpdatingRef(value) {
2085
- const ref = useRef2(value);
2189
+ const ref = useRef3(value);
2086
2190
  ref.current = value;
2087
2191
  return ref;
2088
2192
  }
@@ -2103,7 +2207,7 @@ function IframeBridge() {
2103
2207
  const location = useLocation();
2104
2208
  const navigate = useNavigate();
2105
2209
  const navigateRef = useUpdatingRef(navigate);
2106
- const isActive = useRef3(false);
2210
+ const isActive = useRef4(false);
2107
2211
  const historyBack = useCallback((_payload) => {
2108
2212
  navigateRef.current(-1);
2109
2213
  isActive.current = true;
@@ -2293,14 +2397,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
2293
2397
  });
2294
2398
  }
2295
2399
  }, []);
2296
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ React4.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React4.createElement(MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React4.createElement(IframeBridge, null), /* @__PURE__ */ React4.createElement(QueryProvider_default, null, children));
2400
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ React5.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React5.createElement(MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React5.createElement(IframeBridge, null), /* @__PURE__ */ React5.createElement(safety_default, null), /* @__PURE__ */ React5.createElement(Watermark_default, null), /* @__PURE__ */ React5.createElement(QueryProvider_default, null, children));
2297
2401
  }, "AppContainer");
2298
2402
  var AppContainer_default = AppContainer;
2299
2403
 
2300
2404
  // src/components/Welcome/index.tsx
2301
- import React5 from "react";
2405
+ import React6 from "react";
2302
2406
  var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2303
- return /* @__PURE__ */ React5.createElement("div", {
2407
+ return /* @__PURE__ */ React6.createElement("div", {
2304
2408
  style: {
2305
2409
  display: "flex",
2306
2410
  flexDirection: "column",
@@ -2311,7 +2415,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2311
2415
  padding: "0 24px",
2312
2416
  textAlign: "center"
2313
2417
  }
2314
- }, /* @__PURE__ */ React5.createElement("img", {
2418
+ }, /* @__PURE__ */ React6.createElement("img", {
2315
2419
  style: {
2316
2420
  borderRadius: 6,
2317
2421
  marginBottom: 24
@@ -2320,7 +2424,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2320
2424
  height: "200",
2321
2425
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2322
2426
  alt: "Welcome"
2323
- }), /* @__PURE__ */ React5.createElement("div", {
2427
+ }), /* @__PURE__ */ React6.createElement("div", {
2324
2428
  style: {
2325
2429
  fontSize: 16,
2326
2430
  fontWeight: 500,
@@ -2328,7 +2432,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2328
2432
  marginBottom: 4,
2329
2433
  color: "#1f2329"
2330
2434
  }
2331
- }, title), /* @__PURE__ */ React5.createElement("div", {
2435
+ }, title), /* @__PURE__ */ React6.createElement("div", {
2332
2436
  style: {
2333
2437
  fontSize: 16,
2334
2438
  lineHeight: "24px",
@@ -2340,9 +2444,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
2340
2444
  var Welcome_default = Welcome;
2341
2445
 
2342
2446
  // src/components/PagePlaceholder/index.tsx
2343
- import React6 from "react";
2447
+ import React7 from "react";
2344
2448
  var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
2345
- return /* @__PURE__ */ React6.createElement("div", {
2449
+ return /* @__PURE__ */ React7.createElement("div", {
2346
2450
  style: {
2347
2451
  display: "flex",
2348
2452
  flexDirection: "column",
@@ -2353,7 +2457,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2353
2457
  height: "calc(100vh - 64px)",
2354
2458
  textAlign: "center"
2355
2459
  }
2356
- }, /* @__PURE__ */ React6.createElement("img", {
2460
+ }, /* @__PURE__ */ React7.createElement("img", {
2357
2461
  style: {
2358
2462
  borderRadius: "6px",
2359
2463
  marginBottom: "24px"
@@ -2362,14 +2466,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2362
2466
  height: "200",
2363
2467
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
2364
2468
  alt: "Welcome"
2365
- }), /* @__PURE__ */ React6.createElement("div", {
2469
+ }), /* @__PURE__ */ React7.createElement("div", {
2366
2470
  style: {
2367
2471
  fontSize: "16px",
2368
2472
  fontWeight: 500,
2369
2473
  marginBottom: "4px",
2370
2474
  lineHeight: "24px"
2371
2475
  }
2372
- }, title), /* @__PURE__ */ React6.createElement("div", {
2476
+ }, title), /* @__PURE__ */ React7.createElement("div", {
2373
2477
  style: {
2374
2478
  color: "#6b7280",
2375
2479
  fontSize: "16px",
@@ -2385,7 +2489,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
2385
2489
  var PagePlaceholder_default = PagePlaceholder;
2386
2490
 
2387
2491
  // src/components/ErrorRender/index.tsx
2388
- import React7, { useEffect as useEffect6 } from "react";
2492
+ import React8, { useEffect as useEffect6 } from "react";
2389
2493
  var ErrorRender = /* @__PURE__ */ __name((props) => {
2390
2494
  const { error, resetErrorBoundary } = props;
2391
2495
  useEffect6(() => {
@@ -2424,25 +2528,25 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
2424
2528
  }, [
2425
2529
  resetErrorBoundary
2426
2530
  ]);
2427
- return /* @__PURE__ */ React7.createElement("div", {
2531
+ return /* @__PURE__ */ React8.createElement("div", {
2428
2532
  className: "min-h-screen flex items-center justify-center bg-white"
2429
- }, /* @__PURE__ */ React7.createElement("div", {
2533
+ }, /* @__PURE__ */ React8.createElement("div", {
2430
2534
  className: "flex flex-col justify-center items-center text-center"
2431
- }, /* @__PURE__ */ React7.createElement("img", {
2535
+ }, /* @__PURE__ */ React8.createElement("img", {
2432
2536
  src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
2433
2537
  alt: "render error",
2434
2538
  className: "mb-3 w-[100px]"
2435
- }), /* @__PURE__ */ React7.createElement("p", {
2539
+ }), /* @__PURE__ */ React8.createElement("p", {
2436
2540
  className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
2437
2541
  }, "\u9875\u9762\u51FA\u9519\u4E86")));
2438
2542
  }, "ErrorRender");
2439
2543
  var ErrorRender_default = ErrorRender;
2440
2544
 
2441
2545
  // src/route-components/ActiveLink.tsx
2442
- import React8, { forwardRef, useEffect as useEffect7, useState as useState5 } from "react";
2546
+ import React9, { forwardRef, useEffect as useEffect7, useState as useState6 } from "react";
2443
2547
  import { NavLink } from "react-router-dom";
2444
2548
  var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, children, ...rest }, ref) => {
2445
- const [currentHash, setCurrentHash] = useState5(() => typeof window !== "undefined" ? window.location.hash : "");
2549
+ const [currentHash, setCurrentHash] = useState6(() => typeof window !== "undefined" ? window.location.hash : "");
2446
2550
  const isHashRoute = typeof to === "string" && to.startsWith("#");
2447
2551
  useEffect7(() => {
2448
2552
  if (!isHashRoute) return;
@@ -2456,7 +2560,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
2456
2560
  ]);
2457
2561
  const isActive = isHashRoute && currentHash === to;
2458
2562
  if (!isHashRoute) {
2459
- return /* @__PURE__ */ React8.createElement(NavLink, {
2563
+ return /* @__PURE__ */ React9.createElement(NavLink, {
2460
2564
  ref,
2461
2565
  to,
2462
2566
  onClick,
@@ -2497,7 +2601,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
2497
2601
  isPending: false,
2498
2602
  isTransitioning: false
2499
2603
  }) : children;
2500
- return /* @__PURE__ */ React8.createElement("a", {
2604
+ return /* @__PURE__ */ React9.createElement("a", {
2501
2605
  ref,
2502
2606
  href: to,
2503
2607
  onClick: handleHashClick,
@@ -2509,9 +2613,9 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
2509
2613
  ActiveLink.displayName = "ActiveLink";
2510
2614
 
2511
2615
  // src/route-components/NavLink.tsx
2512
- import * as React9 from "react";
2616
+ import * as React10 from "react";
2513
2617
  import { NavLink as OriginalNavLink, useLocation as useLocation2, useNavigate as useNavigate2 } from "react-router-dom";
2514
- var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
2618
+ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
2515
2619
  const isHashLink = typeof to === "string" && to.startsWith("#");
2516
2620
  const location = useLocation2();
2517
2621
  const navigate = useNavigate2();
@@ -2535,7 +2639,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2535
2639
  const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
2536
2640
  const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
2537
2641
  const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
2538
- return /* @__PURE__ */ React9.createElement("a", {
2642
+ return /* @__PURE__ */ React10.createElement("a", {
2539
2643
  href: to,
2540
2644
  onClick: handleClick,
2541
2645
  ref,
@@ -2544,7 +2648,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2544
2648
  ...restProps
2545
2649
  }, typeof children === "function" ? children(renderProps) : children);
2546
2650
  }
2547
- return /* @__PURE__ */ React9.createElement(OriginalNavLink, {
2651
+ return /* @__PURE__ */ React10.createElement(OriginalNavLink, {
2548
2652
  to,
2549
2653
  ref,
2550
2654
  className,
@@ -2559,7 +2663,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
2559
2663
  NavLink2.displayName = "NavLink";
2560
2664
 
2561
2665
  // src/route-components/UniversalLink.tsx
2562
- import React10 from "react";
2666
+ import React11 from "react";
2563
2667
  import { Link as RouterLink } from "react-router-dom";
2564
2668
  function isInternalRoute(to) {
2565
2669
  return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
@@ -2569,15 +2673,15 @@ function isExternalLink(to) {
2569
2673
  return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
2570
2674
  }
2571
2675
  __name(isExternalLink, "isExternalLink");
2572
- var UniversalLink = /* @__PURE__ */ React10.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2676
+ var UniversalLink = /* @__PURE__ */ React11.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
2573
2677
  if (isInternalRoute(to)) {
2574
- return /* @__PURE__ */ React10.createElement(RouterLink, {
2678
+ return /* @__PURE__ */ React11.createElement(RouterLink, {
2575
2679
  to,
2576
2680
  ref,
2577
2681
  ...props
2578
2682
  });
2579
2683
  }
2580
- return /* @__PURE__ */ React10.createElement("a", {
2684
+ return /* @__PURE__ */ React11.createElement("a", {
2581
2685
  href: to,
2582
2686
  ref,
2583
2687
  ...props,