@lark-apaas/client-toolkit-lite 1.1.11 → 1.1.13

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 CHANGED
@@ -2066,15 +2066,16 @@ var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"), 1);
2066
2066
  // src/components/AppContainer/doubao-watermark-asset.ts
2067
2067
  var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
2068
2068
  var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
2069
- var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
2070
- var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
2071
- var DOUBAO_PILL_MOBILE_SRC = `${CDN}/Frame%202147223991%20(4).svg`;
2072
- var DOUBAO_REPORT_ITEM_SRC = `${CDN}/_Dropdown-item.svg`;
2073
- var DOUBAO_DONTSHOW_ITEM_SRC = `${CDN}/_Dropdown-item%20(1).svg`;
2069
+ var DOUBAO_PILL_MOBILE_PNG = `${CDN}/Frame%202147223991%20(2).png`;
2074
2070
 
2075
2071
  // src/components/AppContainer/Watermark.tsx
2076
2072
  var DOUBAO_SOURCE = "5";
2077
2073
  var REPORT_ENABLED = false;
2074
+ var BRAND_TEXT = "\u8C46\u5305AI";
2075
+ var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
2076
+ var FONT_FAMILY2 = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
2077
+ 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)";
2078
+ 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)";
2078
2079
  var reportDomainByEnv = /* @__PURE__ */ __name((env) => {
2079
2080
  if (env === "boe") return "tns.feishu-boe.cn";
2080
2081
  if (env === "pre") return "tns.feishu-pre.cn";
@@ -2091,51 +2092,199 @@ var openDoubaoReport = /* @__PURE__ */ __name(() => {
2091
2092
  const url = `https://${domain}/cust/lark_report/?type=common&params=${encodeURIComponent(params)}&lang=zh-CN`;
2092
2093
  window.open(url, "_blank", "noopener,noreferrer");
2093
2094
  }, "openDoubaoReport");
2094
- var mobilePillWrapper = {
2095
- position: "fixed",
2096
- right: 12,
2097
- bottom: 12,
2098
- width: 85,
2099
- height: 30,
2100
- zIndex: 9999,
2101
- cursor: "pointer"
2102
- };
2103
- var mobilePillImg = {
2104
- position: "absolute",
2105
- right: -12,
2106
- bottom: -40,
2107
- width: 129,
2108
- height: 94,
2109
- // 钉死尺寸:宿主页常带 Tailwind preflight 的 `img{max-width:100%;height:auto}`,
2110
- // 会把这张 129x94 的图压进 85x30 包裹层导致缩水变形 + 负偏移对齐错位。
2111
- // 内联 style 特异度高于 element 选择器,可盖过 preflight。
2112
- maxWidth: "none",
2113
- maxHeight: "none",
2114
- display: "block",
2115
- pointerEvents: "none"
2116
- };
2117
- var mobileMenu = {
2118
- display: "flex",
2119
- flexDirection: "column",
2120
- background: "#fff",
2121
- borderRadius: 12,
2122
- padding: 4,
2123
- boxShadow: "0px 6px 16px rgba(0,0,0,0.12)",
2124
- zIndex: 1e4,
2125
- // radix Content 打开时获取焦点,去掉浏览器默认 focus 描边(同 Safety sheetContent)
2126
- outline: "none"
2127
- };
2128
- var mobileMenuItem = {
2129
- display: "block",
2130
- // 同药丸:钉死尺寸盖过宿主 Tailwind preflight img{max-width:100%;height:auto}
2131
- width: 132,
2132
- height: 38,
2133
- maxWidth: "none",
2134
- maxHeight: "none",
2135
- cursor: "pointer"
2136
- };
2095
+ var FeedbackIcon = /* @__PURE__ */ __name(() => /* @__PURE__ */ import_react6.default.createElement("svg", {
2096
+ width: 16,
2097
+ height: 16,
2098
+ viewBox: "0 0 16 16",
2099
+ fill: "none",
2100
+ xmlns: "http://www.w3.org/2000/svg",
2101
+ style: {
2102
+ display: "block",
2103
+ flexShrink: 0
2104
+ }
2105
+ }, /* @__PURE__ */ import_react6.default.createElement("path", {
2106
+ d: "M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z",
2107
+ fill: "currentColor"
2108
+ }), /* @__PURE__ */ import_react6.default.createElement("path", {
2109
+ d: "M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z",
2110
+ fill: "currentColor"
2111
+ }), /* @__PURE__ */ import_react6.default.createElement("path", {
2112
+ d: "M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z",
2113
+ fill: "currentColor"
2114
+ }), /* @__PURE__ */ import_react6.default.createElement("path", {
2115
+ d: "M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z",
2116
+ fill: "currentColor"
2117
+ }), /* @__PURE__ */ import_react6.default.createElement("path", {
2118
+ d: "M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z",
2119
+ fill: "currentColor"
2120
+ })), "FeedbackIcon");
2121
+ var CloseIcon = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ import_react6.default.createElement("svg", {
2122
+ width: size,
2123
+ height: size,
2124
+ viewBox: "0 0 10 10",
2125
+ fill: "none",
2126
+ xmlns: "http://www.w3.org/2000/svg",
2127
+ style: {
2128
+ display: "block",
2129
+ flexShrink: 0
2130
+ }
2131
+ }, /* @__PURE__ */ import_react6.default.createElement("path", {
2132
+ d: "M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z",
2133
+ fill: "currentColor"
2134
+ })), "CloseIcon");
2135
+ var Avatar = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ import_react6.default.createElement("img", {
2136
+ src: DOUBAO_LOGO_SRC,
2137
+ width: size,
2138
+ height: size,
2139
+ alt: "",
2140
+ style: {
2141
+ width: size,
2142
+ height: size,
2143
+ maxWidth: "none",
2144
+ maxHeight: "none",
2145
+ borderRadius: 100,
2146
+ flexShrink: 0,
2147
+ display: "block"
2148
+ }
2149
+ }), "Avatar");
2150
+ var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
2151
+ const isDesktop = variant === "desktop";
2152
+ return /* @__PURE__ */ import_react6.default.createElement("div", {
2153
+ style: {
2154
+ boxSizing: "border-box",
2155
+ display: "inline-flex",
2156
+ alignItems: "center",
2157
+ gap: isDesktop ? 4 : 6,
2158
+ padding: isDesktop ? "6px 12px 6px 8px" : "4px 12px 4px 8px",
2159
+ background: "#363636",
2160
+ border: "0.5px solid rgba(255,255,255,0.1)",
2161
+ borderRadius: 100,
2162
+ boxShadow: PILL_SHADOW,
2163
+ cursor: "pointer"
2164
+ }
2165
+ }, /* @__PURE__ */ import_react6.default.createElement(Avatar, {
2166
+ size: isDesktop ? 16 : 18
2167
+ }), /* @__PURE__ */ import_react6.default.createElement("span", {
2168
+ style: {
2169
+ fontFamily: FONT_FAMILY2,
2170
+ fontSize: isDesktop ? 12 : 14,
2171
+ lineHeight: isDesktop ? "18px" : "22px",
2172
+ color: "rgba(255,255,255,0.85)",
2173
+ whiteSpace: "nowrap"
2174
+ }
2175
+ }, BRAND_TEXT), isDesktop && onClose && /* @__PURE__ */ import_react6.default.createElement("span", {
2176
+ role: "button",
2177
+ "aria-label": "\u5173\u95ED",
2178
+ onClick: /* @__PURE__ */ __name((e) => {
2179
+ e.stopPropagation();
2180
+ onClose();
2181
+ }, "onClick"),
2182
+ style: {
2183
+ display: "inline-flex",
2184
+ alignItems: "center",
2185
+ cursor: "pointer",
2186
+ flexShrink: 0,
2187
+ color: "rgba(255,255,255,0.5)"
2188
+ }
2189
+ }, /* @__PURE__ */ import_react6.default.createElement(CloseIcon, {
2190
+ size: 10
2191
+ })));
2192
+ }, "Pill");
2193
+ var MenuRow = /* @__PURE__ */ __name(({ icon, label, fontSize, onClick }) => {
2194
+ const [hover, setHover] = (0, import_react6.useState)(false);
2195
+ return /* @__PURE__ */ import_react6.default.createElement("div", {
2196
+ role: "menuitem",
2197
+ "data-label": label,
2198
+ onClick,
2199
+ onMouseEnter: /* @__PURE__ */ __name(() => setHover(true), "onMouseEnter"),
2200
+ onMouseLeave: /* @__PURE__ */ __name(() => setHover(false), "onMouseLeave"),
2201
+ style: {
2202
+ boxSizing: "border-box",
2203
+ display: "flex",
2204
+ alignItems: "center",
2205
+ gap: 8,
2206
+ padding: "4px 10px",
2207
+ borderRadius: 6,
2208
+ cursor: "pointer",
2209
+ color: "#000000",
2210
+ background: hover ? "rgba(0,0,0,0.04)" : "transparent"
2211
+ }
2212
+ }, /* @__PURE__ */ import_react6.default.createElement("span", {
2213
+ style: {
2214
+ display: "inline-flex",
2215
+ width: 16,
2216
+ height: 16,
2217
+ flexShrink: 0,
2218
+ color: "#000000"
2219
+ }
2220
+ }, icon === "feedback" ? /* @__PURE__ */ import_react6.default.createElement(FeedbackIcon, null) : /* @__PURE__ */ import_react6.default.createElement(CloseIcon, {
2221
+ size: 16
2222
+ })), /* @__PURE__ */ import_react6.default.createElement("span", {
2223
+ style: {
2224
+ fontFamily: FONT_FAMILY2,
2225
+ fontSize,
2226
+ lineHeight: `${fontSize + 8}px`,
2227
+ color: "#000000",
2228
+ whiteSpace: "nowrap"
2229
+ }
2230
+ }, label));
2231
+ }, "MenuRow");
2232
+ var MenuCard = /* @__PURE__ */ __name(({ items, fontSize, footerFontSize, minWidth, style }) => /* @__PURE__ */ import_react6.default.createElement("div", {
2233
+ style: {
2234
+ boxSizing: "border-box",
2235
+ display: "flex",
2236
+ flexDirection: "column",
2237
+ minWidth,
2238
+ background: "#ffffff",
2239
+ border: "0.5px solid rgba(0,0,0,0.1)",
2240
+ borderRadius: 10,
2241
+ boxShadow: CARD_SHADOW,
2242
+ overflow: "hidden",
2243
+ // radix Content 打开时获取焦点,去掉浏览器默认 focus 描边
2244
+ outline: "none",
2245
+ ...style
2246
+ }
2247
+ }, items.length > 0 && /* @__PURE__ */ import_react6.default.createElement("div", {
2248
+ style: {
2249
+ boxSizing: "border-box",
2250
+ padding: 4
2251
+ }
2252
+ }, items.map((it) => /* @__PURE__ */ import_react6.default.createElement(MenuRow, {
2253
+ key: it.label,
2254
+ icon: it.icon,
2255
+ label: it.label,
2256
+ fontSize,
2257
+ onClick: it.onClick
2258
+ }))), /* @__PURE__ */ import_react6.default.createElement("div", {
2259
+ style: {
2260
+ boxSizing: "border-box",
2261
+ background: "#f9f9f9",
2262
+ padding: "8px 14px",
2263
+ fontFamily: FONT_FAMILY2,
2264
+ fontSize: footerFontSize,
2265
+ lineHeight: `${footerFontSize + 8}px`,
2266
+ color: "rgba(0,0,0,0.35)",
2267
+ whiteSpace: "nowrap"
2268
+ }
2269
+ }, POWERED_BY_TEXT)), "MenuCard");
2137
2270
  var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
2138
2271
  const [open, setOpen] = (0, import_react6.useState)(false);
2272
+ const items = [];
2273
+ if (REPORT_ENABLED) {
2274
+ items.push({
2275
+ icon: "feedback",
2276
+ label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2277
+ onClick: openDoubaoReport
2278
+ });
2279
+ }
2280
+ items.push({
2281
+ icon: "close",
2282
+ label: "\u4E0D\u518D\u5C55\u793A",
2283
+ onClick: /* @__PURE__ */ __name(() => {
2284
+ setOpen(false);
2285
+ onDontShow();
2286
+ }, "onClick")
2287
+ });
2139
2288
  return /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Root, {
2140
2289
  open,
2141
2290
  onOpenChange: setOpen
@@ -2143,34 +2292,43 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
2143
2292
  asChild: true
2144
2293
  }, /* @__PURE__ */ import_react6.default.createElement("div", {
2145
2294
  "data-custom-element": "doubao-watermark-mobile",
2146
- style: mobilePillWrapper
2295
+ style: {
2296
+ position: "fixed",
2297
+ right: 12,
2298
+ bottom: 12,
2299
+ width: 85,
2300
+ height: 30,
2301
+ zIndex: 9999,
2302
+ cursor: "pointer"
2303
+ }
2147
2304
  }, /* @__PURE__ */ import_react6.default.createElement("img", {
2148
- src: DOUBAO_PILL_MOBILE_SRC,
2305
+ src: DOUBAO_PILL_MOBILE_PNG,
2149
2306
  width: 129,
2150
2307
  height: 94,
2151
- alt: "\u8C46\u5305 AI \u751F\u6210",
2152
- style: mobilePillImg
2308
+ alt: "\u8C46\u5305AI",
2309
+ style: {
2310
+ position: "absolute",
2311
+ right: -12,
2312
+ bottom: -40,
2313
+ width: 129,
2314
+ height: 94,
2315
+ maxWidth: "none",
2316
+ maxHeight: "none",
2317
+ display: "block",
2318
+ pointerEvents: "none"
2319
+ }
2153
2320
  }))), /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Portal, null, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Content, {
2154
2321
  side: "top",
2155
2322
  align: "end",
2156
2323
  sideOffset: 8,
2157
- style: mobileMenu
2158
- }, /* @__PURE__ */ import_react6.default.createElement("img", {
2159
- src: DOUBAO_REPORT_ITEM_SRC,
2160
- width: 132,
2161
- height: 38,
2162
- alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2163
- style: mobileMenuItem
2164
- }), /* @__PURE__ */ import_react6.default.createElement("img", {
2165
- src: DOUBAO_DONTSHOW_ITEM_SRC,
2166
- width: 132,
2167
- height: 38,
2168
- alt: "\u4E0D\u518D\u5C55\u793A",
2169
- style: mobileMenuItem,
2170
- onClick: /* @__PURE__ */ __name(() => {
2171
- setOpen(false);
2172
- onDontShow();
2173
- }, "onClick")
2324
+ style: {
2325
+ outline: "none"
2326
+ }
2327
+ }, /* @__PURE__ */ import_react6.default.createElement(MenuCard, {
2328
+ items,
2329
+ fontSize: 16,
2330
+ footerFontSize: 14,
2331
+ minWidth: 160
2174
2332
  }))));
2175
2333
  }, "MobileWatermark");
2176
2334
  var Watermark = /* @__PURE__ */ __name(() => {
@@ -2192,6 +2350,14 @@ var Watermark = /* @__PURE__ */ __name(() => {
2192
2350
  const leave = /* @__PURE__ */ __name(() => {
2193
2351
  timer.current = setTimeout(() => setOpen(false), 100);
2194
2352
  }, "leave");
2353
+ const desktopItems = [];
2354
+ if (REPORT_ENABLED) {
2355
+ desktopItems.push({
2356
+ icon: "feedback",
2357
+ label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2358
+ onClick: openDoubaoReport
2359
+ });
2360
+ }
2195
2361
  return /* @__PURE__ */ import_react6.default.createElement("div", {
2196
2362
  "data-custom-element": "doubao-watermark",
2197
2363
  onMouseEnter: enter,
@@ -2203,72 +2369,18 @@ var Watermark = /* @__PURE__ */ __name(() => {
2203
2369
  zIndex: 9999,
2204
2370
  display: "flex",
2205
2371
  flexDirection: "column",
2206
- alignItems: "flex-end"
2207
- }
2208
- }, REPORT_ENABLED && open && /* @__PURE__ */ import_react6.default.createElement("img", {
2209
- src: DOUBAO_REPORT_SRC,
2210
- width: 168,
2211
- height: 78,
2212
- alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2213
- onClick: openDoubaoReport,
2214
- style: {
2215
- display: "block",
2216
- cursor: "pointer",
2217
- marginBottom: -8,
2218
- marginRight: -12
2219
- }
2220
- }), /* @__PURE__ */ import_react6.default.createElement("div", {
2221
- style: {
2222
- boxSizing: "border-box",
2223
- display: "inline-flex",
2224
- alignItems: "center",
2225
- gap: 4,
2226
- padding: "6px 12px 6px 8px",
2227
- background: "#363636",
2228
- border: "0.5px solid rgba(255,255,255,0.1)",
2229
- borderRadius: 100,
2230
- 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)"
2231
- }
2232
- }, /* @__PURE__ */ import_react6.default.createElement("img", {
2233
- src: DOUBAO_LOGO_SRC,
2234
- width: 16,
2235
- height: 16,
2236
- alt: "",
2237
- style: {
2238
- borderRadius: 100,
2239
- flexShrink: 0,
2240
- display: "block"
2241
- }
2242
- }), /* @__PURE__ */ import_react6.default.createElement("span", {
2243
- style: {
2244
- fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
2245
- fontSize: 12,
2246
- lineHeight: "18px",
2247
- color: "rgba(255,255,255,0.85)",
2248
- whiteSpace: "nowrap"
2249
- }
2250
- }, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ import_react6.default.createElement("span", {
2251
- role: "button",
2252
- "aria-label": "\u5173\u95ED",
2253
- onClick: /* @__PURE__ */ __name((e) => {
2254
- e.stopPropagation();
2255
- setClosed(true);
2256
- }, "onClick"),
2257
- style: {
2258
- display: "inline-flex",
2259
- alignItems: "center",
2260
- cursor: "pointer",
2261
- flexShrink: 0
2262
- }
2263
- }, /* @__PURE__ */ import_react6.default.createElement("img", {
2264
- src: DOUBAO_CLOSE_SRC,
2265
- width: 10,
2266
- height: 10,
2267
- alt: "",
2268
- style: {
2269
- display: "block"
2270
- }
2271
- }))));
2372
+ alignItems: "flex-end",
2373
+ gap: 8
2374
+ }
2375
+ }, open && /* @__PURE__ */ import_react6.default.createElement(MenuCard, {
2376
+ items: desktopItems,
2377
+ fontSize: 14,
2378
+ footerFontSize: 12,
2379
+ minWidth: 144
2380
+ }), /* @__PURE__ */ import_react6.default.createElement(Pill, {
2381
+ variant: "desktop",
2382
+ onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose")
2383
+ }));
2272
2384
  }, "Watermark");
2273
2385
  var Watermark_default = Watermark;
2274
2386