@lark-apaas/client-toolkit-lite 1.1.18 → 1.1.19-alpha.0
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 +51 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +62 -32
- 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_react_dom = require("react-dom");
|
|
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,16 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
|
2411
2409
|
minWidth: 160
|
|
2412
2410
|
}))));
|
|
2413
2411
|
}, "MobileWatermark");
|
|
2414
|
-
var
|
|
2415
|
-
const [closed, setClosed] = (0, import_react6.useState)(false);
|
|
2412
|
+
var WatermarkContent = /* @__PURE__ */ __name(({ isMobile: isMobile2, onClose, portalContainer }) => {
|
|
2416
2413
|
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2417
2414
|
const timer = (0, import_react6.useRef)(null);
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2415
|
+
(0, import_react6.useEffect)(() => () => {
|
|
2416
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2417
|
+
}, []);
|
|
2421
2418
|
if (isMobile2) {
|
|
2422
2419
|
return /* @__PURE__ */ import_react6.default.createElement(MobileWatermark, {
|
|
2423
|
-
onDontShow:
|
|
2420
|
+
onDontShow: onClose,
|
|
2421
|
+
portalContainer
|
|
2424
2422
|
});
|
|
2425
2423
|
}
|
|
2426
2424
|
const enter = /* @__PURE__ */ __name(() => {
|
|
@@ -2443,10 +2441,6 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2443
2441
|
onMouseEnter: enter,
|
|
2444
2442
|
onMouseLeave: leave,
|
|
2445
2443
|
style: {
|
|
2446
|
-
position: "fixed",
|
|
2447
|
-
right: 12,
|
|
2448
|
-
bottom: 12,
|
|
2449
|
-
zIndex: 9999,
|
|
2450
2444
|
display: "flex",
|
|
2451
2445
|
flexDirection: "column",
|
|
2452
2446
|
alignItems: "flex-end",
|
|
@@ -2459,9 +2453,45 @@ var Watermark = /* @__PURE__ */ __name(() => {
|
|
|
2459
2453
|
minWidth: 144
|
|
2460
2454
|
}), /* @__PURE__ */ import_react6.default.createElement(Pill, {
|
|
2461
2455
|
variant: "desktop",
|
|
2462
|
-
onClose
|
|
2456
|
+
onClose,
|
|
2463
2457
|
showClose: open
|
|
2464
2458
|
}));
|
|
2459
|
+
}, "WatermarkContent");
|
|
2460
|
+
var Watermark = /* @__PURE__ */ __name(() => {
|
|
2461
|
+
const [closed, setClosed] = (0, import_react6.useState)(false);
|
|
2462
|
+
const [shadowRoot, setShadowRoot] = (0, import_react6.useState)(null);
|
|
2463
|
+
const hostRef = (0, import_react6.useRef)(null);
|
|
2464
|
+
const isMobile2 = useIsMobile();
|
|
2465
|
+
useIsomorphicLayoutEffect(() => {
|
|
2466
|
+
if (!hostRef.current) return;
|
|
2467
|
+
const root = hostRef.current.shadowRoot ?? hostRef.current.attachShadow({
|
|
2468
|
+
mode: "open"
|
|
2469
|
+
});
|
|
2470
|
+
setShadowRoot(root);
|
|
2471
|
+
}, []);
|
|
2472
|
+
if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
|
|
2473
|
+
if (closed) return null;
|
|
2474
|
+
const hostStyle = {
|
|
2475
|
+
all: "initial",
|
|
2476
|
+
position: "fixed",
|
|
2477
|
+
right: 12,
|
|
2478
|
+
bottom: 12,
|
|
2479
|
+
// 32-bit 有符号整数上限,盖过绝大多数应用 z-index 竞争。
|
|
2480
|
+
zIndex: 2147483647,
|
|
2481
|
+
// 自定义元素默认 display:inline,shadow 内 flex 布局需要 block/inline-block。
|
|
2482
|
+
display: "block",
|
|
2483
|
+
width: "auto",
|
|
2484
|
+
height: "auto"
|
|
2485
|
+
};
|
|
2486
|
+
const content = /* @__PURE__ */ import_react6.default.createElement(WatermarkContent, {
|
|
2487
|
+
isMobile: isMobile2,
|
|
2488
|
+
onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose"),
|
|
2489
|
+
portalContainer: shadowRoot
|
|
2490
|
+
});
|
|
2491
|
+
return /* @__PURE__ */ import_react6.default.createElement(HOST_TAG, {
|
|
2492
|
+
ref: hostRef,
|
|
2493
|
+
style: hostStyle
|
|
2494
|
+
}, shadowRoot ? /* @__PURE__ */ (0, import_react_dom.createPortal)(content, shadowRoot) : content);
|
|
2465
2495
|
}, "Watermark");
|
|
2466
2496
|
var Watermark_default = Watermark;
|
|
2467
2497
|
|