@lark-apaas/client-toolkit-lite 1.1.18 → 1.1.19-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.cjs +62 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +73 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2141,6 +2141,7 @@ var safety_default = Safety;
|
|
|
2141
2141
|
|
|
2142
2142
|
// src/components/AppContainer/Watermark.tsx
|
|
2143
2143
|
var import_react6 = __toESM(require("react"), 1);
|
|
2144
|
+
var import_client = require("react-dom/client");
|
|
2144
2145
|
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"), 1);
|
|
2145
2146
|
|
|
2146
2147
|
// src/components/AppContainer/doubao-watermark-asset.ts
|
|
@@ -2149,6 +2150,7 @@ var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
|
|
|
2149
2150
|
var DOUBAO_PILL_MOBILE_PNG = `${CDN}/Frame%202147223991%20(3).png`;
|
|
2150
2151
|
|
|
2151
2152
|
// src/components/AppContainer/Watermark.tsx
|
|
2153
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react6.useLayoutEffect : import_react6.useEffect;
|
|
2152
2154
|
var DOUBAO_SOURCE = "5";
|
|
2153
2155
|
var REPORT_ENABLED = true;
|
|
2154
2156
|
var BRAND_TEXT = "\u8C46\u5305 AI \u751F\u6210";
|
|
@@ -2156,6 +2158,7 @@ var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
|
|
|
2156
2158
|
var FONT_FAMILY2 = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
2157
2159
|
var PILL_SHADOW = "0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)";
|
|
2158
2160
|
var CARD_SHADOW = "0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)";
|
|
2161
|
+
var HOST_TAG = "doubao-watermark";
|
|
2159
2162
|
var reportDomainByEnv = /* @__PURE__ */ __name((env) => {
|
|
2160
2163
|
if (env === "boe") return "tns.feishu-boe.cn";
|
|
2161
2164
|
if (env === "pre") return "tns.feishu-pre.cn";
|
|
@@ -2220,8 +2223,6 @@ var Avatar = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ import_react6.
|
|
|
2220
2223
|
style: {
|
|
2221
2224
|
width: size,
|
|
2222
2225
|
height: size,
|
|
2223
|
-
maxWidth: "none",
|
|
2224
|
-
maxHeight: "none",
|
|
2225
2226
|
borderRadius: 100,
|
|
2226
2227
|
flexShrink: 0,
|
|
2227
2228
|
display: "block"
|
|
@@ -2347,7 +2348,7 @@ var MenuCard = /* @__PURE__ */ __name(({ items, fontSize, footerFontSize, minWid
|
|
|
2347
2348
|
whiteSpace: "nowrap"
|
|
2348
2349
|
}
|
|
2349
2350
|
}, POWERED_BY_TEXT)), "MenuCard");
|
|
2350
|
-
var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
2351
|
+
var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow, portalContainer }) => {
|
|
2351
2352
|
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2352
2353
|
const items = [];
|
|
2353
2354
|
if (REPORT_ENABLED) {
|
|
@@ -2373,12 +2374,9 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
|
2373
2374
|
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2374
2375
|
"data-custom-element": "doubao-watermark-mobile",
|
|
2375
2376
|
style: {
|
|
2376
|
-
position: "
|
|
2377
|
-
right: 12,
|
|
2378
|
-
bottom: 12,
|
|
2377
|
+
position: "relative",
|
|
2379
2378
|
width: 122,
|
|
2380
2379
|
height: 30,
|
|
2381
|
-
zIndex: 9999,
|
|
2382
2380
|
cursor: "pointer"
|
|
2383
2381
|
}
|
|
2384
2382
|
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
@@ -2392,12 +2390,12 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
|
2392
2390
|
bottom: -40,
|
|
2393
2391
|
width: 166,
|
|
2394
2392
|
height: 94,
|
|
2395
|
-
maxWidth: "none",
|
|
2396
|
-
maxHeight: "none",
|
|
2397
2393
|
display: "block",
|
|
2398
2394
|
pointerEvents: "none"
|
|
2399
2395
|
}
|
|
2400
|
-
}))), /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Portal,
|
|
2396
|
+
}))), /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Portal, {
|
|
2397
|
+
container: portalContainer
|
|
2398
|
+
}, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Content, {
|
|
2401
2399
|
side: "top",
|
|
2402
2400
|
align: "end",
|
|
2403
2401
|
sideOffset: 8,
|
|
@@ -2411,16 +2409,26 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
|
2411
2409
|
minWidth: 160
|
|
2412
2410
|
}))));
|
|
2413
2411
|
}, "MobileWatermark");
|
|
2414
|
-
var
|
|
2412
|
+
var ShadowRootUI = /* @__PURE__ */ __name(({ shadowRoot }) => {
|
|
2415
2413
|
const [closed, setClosed] = (0, import_react6.useState)(false);
|
|
2416
|
-
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2417
|
-
const timer = (0, import_react6.useRef)(null);
|
|
2418
2414
|
const isMobile2 = useIsMobile();
|
|
2419
|
-
if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
|
|
2420
2415
|
if (closed) return null;
|
|
2416
|
+
return /* @__PURE__ */ import_react6.default.createElement(WatermarkContent, {
|
|
2417
|
+
isMobile: isMobile2,
|
|
2418
|
+
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose"),
|
|
2419
|
+
portalContainer: shadowRoot
|
|
2420
|
+
});
|
|
2421
|
+
}, "ShadowRootUI");
|
|
2422
|
+
var WatermarkContent = /* @__PURE__ */ __name(({ isMobile: isMobile2, onClose, portalContainer }) => {
|
|
2423
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2424
|
+
const timer = (0, import_react6.useRef)(null);
|
|
2425
|
+
(0, import_react6.useEffect)(() => () => {
|
|
2426
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2427
|
+
}, []);
|
|
2421
2428
|
if (isMobile2) {
|
|
2422
2429
|
return /* @__PURE__ */ import_react6.default.createElement(MobileWatermark, {
|
|
2423
|
-
onDontShow:
|
|
2430
|
+
onDontShow: onClose,
|
|
2431
|
+
portalContainer
|
|
2424
2432
|
});
|
|
2425
2433
|
}
|
|
2426
2434
|
const enter = /* @__PURE__ */ __name(() => {
|
|
@@ -2443,10 +2451,6 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2443
2451
|
onMouseEnter: enter,
|
|
2444
2452
|
onMouseLeave: leave,
|
|
2445
2453
|
style: {
|
|
2446
|
-
position: "fixed",
|
|
2447
|
-
right: 12,
|
|
2448
|
-
bottom: 12,
|
|
2449
|
-
zIndex: 9999,
|
|
2450
2454
|
display: "flex",
|
|
2451
2455
|
flexDirection: "column",
|
|
2452
2456
|
alignItems: "flex-end",
|
|
@@ -2459,9 +2463,47 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2459
2463
|
minWidth: 144
|
|
2460
2464
|
}), /* @__PURE__ */ import_react6.default.createElement(Pill, {
|
|
2461
2465
|
variant: "desktop",
|
|
2462
|
-
onClose
|
|
2466
|
+
onClose,
|
|
2463
2467
|
showClose: open
|
|
2464
2468
|
}));
|
|
2469
|
+
}, "WatermarkContent");
|
|
2470
|
+
var Watermark = /* @__PURE__ */ __name(() => {
|
|
2471
|
+
const hostRef = (0, import_react6.useRef)(null);
|
|
2472
|
+
const rootRef = (0, import_react6.useRef)(null);
|
|
2473
|
+
useIsomorphicLayoutEffect(() => {
|
|
2474
|
+
if (!hostRef.current) return;
|
|
2475
|
+
const host = hostRef.current;
|
|
2476
|
+
const shadow = host.shadowRoot ?? host.attachShadow({
|
|
2477
|
+
mode: "open"
|
|
2478
|
+
});
|
|
2479
|
+
const root = (0, import_client.createRoot)(shadow);
|
|
2480
|
+
rootRef.current = root;
|
|
2481
|
+
root.render(/* @__PURE__ */ import_react6.default.createElement(ShadowRootUI, {
|
|
2482
|
+
shadowRoot: shadow
|
|
2483
|
+
}));
|
|
2484
|
+
return () => {
|
|
2485
|
+
const r = root;
|
|
2486
|
+
queueMicrotask(() => r.unmount());
|
|
2487
|
+
rootRef.current = null;
|
|
2488
|
+
};
|
|
2489
|
+
}, []);
|
|
2490
|
+
if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
|
|
2491
|
+
const hostStyle = {
|
|
2492
|
+
all: "initial",
|
|
2493
|
+
position: "fixed",
|
|
2494
|
+
right: 12,
|
|
2495
|
+
bottom: 12,
|
|
2496
|
+
// 32-bit 有符号整数上限,盖过绝大多数应用 z-index 竞争。
|
|
2497
|
+
zIndex: 2147483647,
|
|
2498
|
+
// 自定义元素默认 display:inline,shadow 内 flex 布局需要 block/inline-block。
|
|
2499
|
+
display: "block",
|
|
2500
|
+
width: "auto",
|
|
2501
|
+
height: "auto"
|
|
2502
|
+
};
|
|
2503
|
+
return /* @__PURE__ */ import_react6.default.createElement(HOST_TAG, {
|
|
2504
|
+
ref: hostRef,
|
|
2505
|
+
style: hostStyle
|
|
2506
|
+
});
|
|
2465
2507
|
}, "Watermark");
|
|
2466
2508
|
var Watermark_default = Watermark;
|
|
2467
2509
|
|