@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.js CHANGED
@@ -1995,15 +1995,16 @@ import * as PopoverPrimitive2 from "@radix-ui/react-popover";
1995
1995
  // src/components/AppContainer/doubao-watermark-asset.ts
1996
1996
  var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
1997
1997
  var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
1998
- var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
1999
- var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
2000
- var DOUBAO_PILL_MOBILE_SRC = `${CDN}/Frame%202147223991%20(4).svg`;
2001
- var DOUBAO_REPORT_ITEM_SRC = `${CDN}/_Dropdown-item.svg`;
2002
- var DOUBAO_DONTSHOW_ITEM_SRC = `${CDN}/_Dropdown-item%20(1).svg`;
1998
+ var DOUBAO_PILL_MOBILE_PNG = `${CDN}/Frame%202147223991%20(2).png`;
2003
1999
 
2004
2000
  // src/components/AppContainer/Watermark.tsx
2005
2001
  var DOUBAO_SOURCE = "5";
2006
2002
  var REPORT_ENABLED = false;
2003
+ var BRAND_TEXT = "\u8C46\u5305AI";
2004
+ var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
2005
+ var FONT_FAMILY2 = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
2006
+ 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)";
2007
+ 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)";
2007
2008
  var reportDomainByEnv = /* @__PURE__ */ __name((env) => {
2008
2009
  if (env === "boe") return "tns.feishu-boe.cn";
2009
2010
  if (env === "pre") return "tns.feishu-pre.cn";
@@ -2020,51 +2021,199 @@ var openDoubaoReport = /* @__PURE__ */ __name(() => {
2020
2021
  const url = `https://${domain}/cust/lark_report/?type=common&params=${encodeURIComponent(params)}&lang=zh-CN`;
2021
2022
  window.open(url, "_blank", "noopener,noreferrer");
2022
2023
  }, "openDoubaoReport");
2023
- var mobilePillWrapper = {
2024
- position: "fixed",
2025
- right: 12,
2026
- bottom: 12,
2027
- width: 85,
2028
- height: 30,
2029
- zIndex: 9999,
2030
- cursor: "pointer"
2031
- };
2032
- var mobilePillImg = {
2033
- position: "absolute",
2034
- right: -12,
2035
- bottom: -40,
2036
- width: 129,
2037
- height: 94,
2038
- // 钉死尺寸:宿主页常带 Tailwind preflight 的 `img{max-width:100%;height:auto}`,
2039
- // 会把这张 129x94 的图压进 85x30 包裹层导致缩水变形 + 负偏移对齐错位。
2040
- // 内联 style 特异度高于 element 选择器,可盖过 preflight。
2041
- maxWidth: "none",
2042
- maxHeight: "none",
2043
- display: "block",
2044
- pointerEvents: "none"
2045
- };
2046
- var mobileMenu = {
2047
- display: "flex",
2048
- flexDirection: "column",
2049
- background: "#fff",
2050
- borderRadius: 12,
2051
- padding: 4,
2052
- boxShadow: "0px 6px 16px rgba(0,0,0,0.12)",
2053
- zIndex: 1e4,
2054
- // radix Content 打开时获取焦点,去掉浏览器默认 focus 描边(同 Safety sheetContent)
2055
- outline: "none"
2056
- };
2057
- var mobileMenuItem = {
2058
- display: "block",
2059
- // 同药丸:钉死尺寸盖过宿主 Tailwind preflight img{max-width:100%;height:auto}
2060
- width: 132,
2061
- height: 38,
2062
- maxWidth: "none",
2063
- maxHeight: "none",
2064
- cursor: "pointer"
2065
- };
2024
+ var FeedbackIcon = /* @__PURE__ */ __name(() => /* @__PURE__ */ React3.createElement("svg", {
2025
+ width: 16,
2026
+ height: 16,
2027
+ viewBox: "0 0 16 16",
2028
+ fill: "none",
2029
+ xmlns: "http://www.w3.org/2000/svg",
2030
+ style: {
2031
+ display: "block",
2032
+ flexShrink: 0
2033
+ }
2034
+ }, /* @__PURE__ */ React3.createElement("path", {
2035
+ 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",
2036
+ fill: "currentColor"
2037
+ }), /* @__PURE__ */ React3.createElement("path", {
2038
+ 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",
2039
+ fill: "currentColor"
2040
+ }), /* @__PURE__ */ React3.createElement("path", {
2041
+ 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",
2042
+ fill: "currentColor"
2043
+ }), /* @__PURE__ */ React3.createElement("path", {
2044
+ 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",
2045
+ fill: "currentColor"
2046
+ }), /* @__PURE__ */ React3.createElement("path", {
2047
+ 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",
2048
+ fill: "currentColor"
2049
+ })), "FeedbackIcon");
2050
+ var CloseIcon = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ React3.createElement("svg", {
2051
+ width: size,
2052
+ height: size,
2053
+ viewBox: "0 0 10 10",
2054
+ fill: "none",
2055
+ xmlns: "http://www.w3.org/2000/svg",
2056
+ style: {
2057
+ display: "block",
2058
+ flexShrink: 0
2059
+ }
2060
+ }, /* @__PURE__ */ React3.createElement("path", {
2061
+ 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",
2062
+ fill: "currentColor"
2063
+ })), "CloseIcon");
2064
+ var Avatar = /* @__PURE__ */ __name(({ size }) => /* @__PURE__ */ React3.createElement("img", {
2065
+ src: DOUBAO_LOGO_SRC,
2066
+ width: size,
2067
+ height: size,
2068
+ alt: "",
2069
+ style: {
2070
+ width: size,
2071
+ height: size,
2072
+ maxWidth: "none",
2073
+ maxHeight: "none",
2074
+ borderRadius: 100,
2075
+ flexShrink: 0,
2076
+ display: "block"
2077
+ }
2078
+ }), "Avatar");
2079
+ var Pill = /* @__PURE__ */ __name(({ variant, onClose }) => {
2080
+ const isDesktop = variant === "desktop";
2081
+ return /* @__PURE__ */ React3.createElement("div", {
2082
+ style: {
2083
+ boxSizing: "border-box",
2084
+ display: "inline-flex",
2085
+ alignItems: "center",
2086
+ gap: isDesktop ? 4 : 6,
2087
+ padding: isDesktop ? "6px 12px 6px 8px" : "4px 12px 4px 8px",
2088
+ background: "#363636",
2089
+ border: "0.5px solid rgba(255,255,255,0.1)",
2090
+ borderRadius: 100,
2091
+ boxShadow: PILL_SHADOW,
2092
+ cursor: "pointer"
2093
+ }
2094
+ }, /* @__PURE__ */ React3.createElement(Avatar, {
2095
+ size: isDesktop ? 16 : 18
2096
+ }), /* @__PURE__ */ React3.createElement("span", {
2097
+ style: {
2098
+ fontFamily: FONT_FAMILY2,
2099
+ fontSize: isDesktop ? 12 : 14,
2100
+ lineHeight: isDesktop ? "18px" : "22px",
2101
+ color: "rgba(255,255,255,0.85)",
2102
+ whiteSpace: "nowrap"
2103
+ }
2104
+ }, BRAND_TEXT), isDesktop && onClose && /* @__PURE__ */ React3.createElement("span", {
2105
+ role: "button",
2106
+ "aria-label": "\u5173\u95ED",
2107
+ onClick: /* @__PURE__ */ __name((e) => {
2108
+ e.stopPropagation();
2109
+ onClose();
2110
+ }, "onClick"),
2111
+ style: {
2112
+ display: "inline-flex",
2113
+ alignItems: "center",
2114
+ cursor: "pointer",
2115
+ flexShrink: 0,
2116
+ color: "rgba(255,255,255,0.5)"
2117
+ }
2118
+ }, /* @__PURE__ */ React3.createElement(CloseIcon, {
2119
+ size: 10
2120
+ })));
2121
+ }, "Pill");
2122
+ var MenuRow = /* @__PURE__ */ __name(({ icon, label, fontSize, onClick }) => {
2123
+ const [hover, setHover] = useState5(false);
2124
+ return /* @__PURE__ */ React3.createElement("div", {
2125
+ role: "menuitem",
2126
+ "data-label": label,
2127
+ onClick,
2128
+ onMouseEnter: /* @__PURE__ */ __name(() => setHover(true), "onMouseEnter"),
2129
+ onMouseLeave: /* @__PURE__ */ __name(() => setHover(false), "onMouseLeave"),
2130
+ style: {
2131
+ boxSizing: "border-box",
2132
+ display: "flex",
2133
+ alignItems: "center",
2134
+ gap: 8,
2135
+ padding: "4px 10px",
2136
+ borderRadius: 6,
2137
+ cursor: "pointer",
2138
+ color: "#000000",
2139
+ background: hover ? "rgba(0,0,0,0.04)" : "transparent"
2140
+ }
2141
+ }, /* @__PURE__ */ React3.createElement("span", {
2142
+ style: {
2143
+ display: "inline-flex",
2144
+ width: 16,
2145
+ height: 16,
2146
+ flexShrink: 0,
2147
+ color: "#000000"
2148
+ }
2149
+ }, icon === "feedback" ? /* @__PURE__ */ React3.createElement(FeedbackIcon, null) : /* @__PURE__ */ React3.createElement(CloseIcon, {
2150
+ size: 16
2151
+ })), /* @__PURE__ */ React3.createElement("span", {
2152
+ style: {
2153
+ fontFamily: FONT_FAMILY2,
2154
+ fontSize,
2155
+ lineHeight: `${fontSize + 8}px`,
2156
+ color: "#000000",
2157
+ whiteSpace: "nowrap"
2158
+ }
2159
+ }, label));
2160
+ }, "MenuRow");
2161
+ var MenuCard = /* @__PURE__ */ __name(({ items, fontSize, footerFontSize, minWidth, style }) => /* @__PURE__ */ React3.createElement("div", {
2162
+ style: {
2163
+ boxSizing: "border-box",
2164
+ display: "flex",
2165
+ flexDirection: "column",
2166
+ minWidth,
2167
+ background: "#ffffff",
2168
+ border: "0.5px solid rgba(0,0,0,0.1)",
2169
+ borderRadius: 10,
2170
+ boxShadow: CARD_SHADOW,
2171
+ overflow: "hidden",
2172
+ // radix Content 打开时获取焦点,去掉浏览器默认 focus 描边
2173
+ outline: "none",
2174
+ ...style
2175
+ }
2176
+ }, items.length > 0 && /* @__PURE__ */ React3.createElement("div", {
2177
+ style: {
2178
+ boxSizing: "border-box",
2179
+ padding: 4
2180
+ }
2181
+ }, items.map((it) => /* @__PURE__ */ React3.createElement(MenuRow, {
2182
+ key: it.label,
2183
+ icon: it.icon,
2184
+ label: it.label,
2185
+ fontSize,
2186
+ onClick: it.onClick
2187
+ }))), /* @__PURE__ */ React3.createElement("div", {
2188
+ style: {
2189
+ boxSizing: "border-box",
2190
+ background: "#f9f9f9",
2191
+ padding: "8px 14px",
2192
+ fontFamily: FONT_FAMILY2,
2193
+ fontSize: footerFontSize,
2194
+ lineHeight: `${footerFontSize + 8}px`,
2195
+ color: "rgba(0,0,0,0.35)",
2196
+ whiteSpace: "nowrap"
2197
+ }
2198
+ }, POWERED_BY_TEXT)), "MenuCard");
2066
2199
  var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
2067
2200
  const [open, setOpen] = useState5(false);
2201
+ const items = [];
2202
+ if (REPORT_ENABLED) {
2203
+ items.push({
2204
+ icon: "feedback",
2205
+ label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2206
+ onClick: openDoubaoReport
2207
+ });
2208
+ }
2209
+ items.push({
2210
+ icon: "close",
2211
+ label: "\u4E0D\u518D\u5C55\u793A",
2212
+ onClick: /* @__PURE__ */ __name(() => {
2213
+ setOpen(false);
2214
+ onDontShow();
2215
+ }, "onClick")
2216
+ });
2068
2217
  return /* @__PURE__ */ React3.createElement(PopoverPrimitive2.Root, {
2069
2218
  open,
2070
2219
  onOpenChange: setOpen
@@ -2072,34 +2221,43 @@ var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
2072
2221
  asChild: true
2073
2222
  }, /* @__PURE__ */ React3.createElement("div", {
2074
2223
  "data-custom-element": "doubao-watermark-mobile",
2075
- style: mobilePillWrapper
2224
+ style: {
2225
+ position: "fixed",
2226
+ right: 12,
2227
+ bottom: 12,
2228
+ width: 85,
2229
+ height: 30,
2230
+ zIndex: 9999,
2231
+ cursor: "pointer"
2232
+ }
2076
2233
  }, /* @__PURE__ */ React3.createElement("img", {
2077
- src: DOUBAO_PILL_MOBILE_SRC,
2234
+ src: DOUBAO_PILL_MOBILE_PNG,
2078
2235
  width: 129,
2079
2236
  height: 94,
2080
- alt: "\u8C46\u5305 AI \u751F\u6210",
2081
- style: mobilePillImg
2237
+ alt: "\u8C46\u5305AI",
2238
+ style: {
2239
+ position: "absolute",
2240
+ right: -12,
2241
+ bottom: -40,
2242
+ width: 129,
2243
+ height: 94,
2244
+ maxWidth: "none",
2245
+ maxHeight: "none",
2246
+ display: "block",
2247
+ pointerEvents: "none"
2248
+ }
2082
2249
  }))), /* @__PURE__ */ React3.createElement(PopoverPrimitive2.Portal, null, /* @__PURE__ */ React3.createElement(PopoverPrimitive2.Content, {
2083
2250
  side: "top",
2084
2251
  align: "end",
2085
2252
  sideOffset: 8,
2086
- style: mobileMenu
2087
- }, /* @__PURE__ */ React3.createElement("img", {
2088
- src: DOUBAO_REPORT_ITEM_SRC,
2089
- width: 132,
2090
- height: 38,
2091
- alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2092
- style: mobileMenuItem
2093
- }), /* @__PURE__ */ React3.createElement("img", {
2094
- src: DOUBAO_DONTSHOW_ITEM_SRC,
2095
- width: 132,
2096
- height: 38,
2097
- alt: "\u4E0D\u518D\u5C55\u793A",
2098
- style: mobileMenuItem,
2099
- onClick: /* @__PURE__ */ __name(() => {
2100
- setOpen(false);
2101
- onDontShow();
2102
- }, "onClick")
2253
+ style: {
2254
+ outline: "none"
2255
+ }
2256
+ }, /* @__PURE__ */ React3.createElement(MenuCard, {
2257
+ items,
2258
+ fontSize: 16,
2259
+ footerFontSize: 14,
2260
+ minWidth: 160
2103
2261
  }))));
2104
2262
  }, "MobileWatermark");
2105
2263
  var Watermark = /* @__PURE__ */ __name(() => {
@@ -2121,6 +2279,14 @@ var Watermark = /* @__PURE__ */ __name(() => {
2121
2279
  const leave = /* @__PURE__ */ __name(() => {
2122
2280
  timer.current = setTimeout(() => setOpen(false), 100);
2123
2281
  }, "leave");
2282
+ const desktopItems = [];
2283
+ if (REPORT_ENABLED) {
2284
+ desktopItems.push({
2285
+ icon: "feedback",
2286
+ label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2287
+ onClick: openDoubaoReport
2288
+ });
2289
+ }
2124
2290
  return /* @__PURE__ */ React3.createElement("div", {
2125
2291
  "data-custom-element": "doubao-watermark",
2126
2292
  onMouseEnter: enter,
@@ -2132,72 +2298,18 @@ var Watermark = /* @__PURE__ */ __name(() => {
2132
2298
  zIndex: 9999,
2133
2299
  display: "flex",
2134
2300
  flexDirection: "column",
2135
- alignItems: "flex-end"
2136
- }
2137
- }, REPORT_ENABLED && open && /* @__PURE__ */ React3.createElement("img", {
2138
- src: DOUBAO_REPORT_SRC,
2139
- width: 168,
2140
- height: 78,
2141
- alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
2142
- onClick: openDoubaoReport,
2143
- style: {
2144
- display: "block",
2145
- cursor: "pointer",
2146
- marginBottom: -8,
2147
- marginRight: -12
2148
- }
2149
- }), /* @__PURE__ */ React3.createElement("div", {
2150
- style: {
2151
- boxSizing: "border-box",
2152
- display: "inline-flex",
2153
- alignItems: "center",
2154
- gap: 4,
2155
- padding: "6px 12px 6px 8px",
2156
- background: "#363636",
2157
- border: "0.5px solid rgba(255,255,255,0.1)",
2158
- borderRadius: 100,
2159
- 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)"
2160
- }
2161
- }, /* @__PURE__ */ React3.createElement("img", {
2162
- src: DOUBAO_LOGO_SRC,
2163
- width: 16,
2164
- height: 16,
2165
- alt: "",
2166
- style: {
2167
- borderRadius: 100,
2168
- flexShrink: 0,
2169
- display: "block"
2170
- }
2171
- }), /* @__PURE__ */ React3.createElement("span", {
2172
- style: {
2173
- fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
2174
- fontSize: 12,
2175
- lineHeight: "18px",
2176
- color: "rgba(255,255,255,0.85)",
2177
- whiteSpace: "nowrap"
2178
- }
2179
- }, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ React3.createElement("span", {
2180
- role: "button",
2181
- "aria-label": "\u5173\u95ED",
2182
- onClick: /* @__PURE__ */ __name((e) => {
2183
- e.stopPropagation();
2184
- setClosed(true);
2185
- }, "onClick"),
2186
- style: {
2187
- display: "inline-flex",
2188
- alignItems: "center",
2189
- cursor: "pointer",
2190
- flexShrink: 0
2191
- }
2192
- }, /* @__PURE__ */ React3.createElement("img", {
2193
- src: DOUBAO_CLOSE_SRC,
2194
- width: 10,
2195
- height: 10,
2196
- alt: "",
2197
- style: {
2198
- display: "block"
2199
- }
2200
- }))));
2301
+ alignItems: "flex-end",
2302
+ gap: 8
2303
+ }
2304
+ }, open && /* @__PURE__ */ React3.createElement(MenuCard, {
2305
+ items: desktopItems,
2306
+ fontSize: 14,
2307
+ footerFontSize: 12,
2308
+ minWidth: 144
2309
+ }), /* @__PURE__ */ React3.createElement(Pill, {
2310
+ variant: "desktop",
2311
+ onClose: /* @__PURE__ */ __name(() => setClosed(true), "onClose")
2312
+ }));
2201
2313
  }, "Watermark");
2202
2314
  var Watermark_default = Watermark;
2203
2315