@zero-library/common 2.5.0 → 3.0.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.esm.js CHANGED
@@ -1077,6 +1077,10 @@ function createRequest(config) {
1077
1077
  // 默认基础URL
1078
1078
  timeout: 6e4,
1079
1079
  // 请求超时时间设为60秒
1080
+ paramsSerializer: {
1081
+ // 自定义序列化参数,处理数组格式为 key=value&key=value
1082
+ serialize: (params) => buildUrlParams(params)
1083
+ },
1080
1084
  ...config
1081
1085
  // 合并传入的配置项
1082
1086
  });
@@ -1105,6 +1109,9 @@ function createRequest(config) {
1105
1109
  return response;
1106
1110
  },
1107
1111
  function(err) {
1112
+ if (axios.isCancel(err)) {
1113
+ return Promise.reject(err);
1114
+ }
1108
1115
  if (!err.response) {
1109
1116
  if (showError(err?.config?.showError)) cachedMessage({ content: "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC", type: "error" });
1110
1117
  } else {
@@ -1353,7 +1360,7 @@ var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }
1353
1360
  lazyCache.set(type, component);
1354
1361
  return component;
1355
1362
  }, [loader]);
1356
- if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { message: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1363
+ if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { title: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1357
1364
  return /* @__PURE__ */ jsx(
1358
1365
  Suspense,
1359
1366
  {
@@ -1850,140 +1857,325 @@ var useThrottle_default = (func, wait) => {
1850
1857
  throttle2.cancel = cancel;
1851
1858
  return useCallback(throttle2, []);
1852
1859
  };
1853
- var useWebSocket_default = ({
1854
- url,
1855
- onMessage,
1856
- onClose,
1857
- heartbeatInterval = 3e4,
1858
- heartbeatMessage = "ping",
1859
- clientHeartbeat = true,
1860
- reconnectInterval = 5e3,
1861
- maxReconnectAttempts,
1862
- isReconnect = true
1863
- }) => {
1864
- const socketRef = useRef(null);
1865
- const heartbeatIntervalRef = useRef(null);
1866
- const [socketReadyState, setSocketReadyState] = useState(null);
1867
- const reconnectIntervalRef = useRef(null);
1868
- const reconnectAttempts = useRef(0);
1869
- const documentHide = useRef(document.visibilityState === "hidden");
1870
- const isDestroy = useRef(false);
1871
- const onMessageEctype = useCallback(onMessage, [onMessage]);
1872
- const startHeartbeat = (currentSocket) => {
1873
- if (!clientHeartbeat) {
1874
- return;
1875
- }
1860
+
1861
+ // src/hooks/webSocket/WebSocketManager.ts
1862
+ var WebSocketManager = class _WebSocketManager {
1863
+ /** 存储不同 URL 对应的 WebSocketManager 单例实例 */
1864
+ static instances = /* @__PURE__ */ new Map();
1865
+ /** 当前 WebSocket 的服务器地址 */
1866
+ url;
1867
+ /** WebSocket 原生实例 */
1868
+ socket = null;
1869
+ /** 当前连接状态 */
1870
+ readyState = null;
1871
+ /** 当前连接的所有订阅者(监听器)集合 */
1872
+ listeners = /* @__PURE__ */ new Set();
1873
+ // --- 配置参数 ---
1874
+ heartbeatInterval;
1875
+ heartbeatMessage;
1876
+ clientHeartbeat;
1877
+ reconnectInterval;
1878
+ maxReconnectAttempts;
1879
+ isReconnect;
1880
+ // --- 内部状态与定时器 ---
1881
+ /** 心跳定时器引用 */
1882
+ heartbeatIntervalRef = null;
1883
+ /** 重连定时器引用 */
1884
+ reconnectIntervalRef = null;
1885
+ /** 销毁防抖定时器引用(用于避免 React StrictMode 导致的连接抖动) */
1886
+ destroyTimeoutRef = null;
1887
+ /** 当前已尝试重连的次数 */
1888
+ reconnectAttempts = 0;
1889
+ /** 记录页面是否处于隐藏状态 */
1890
+ documentHide = document.visibilityState === "hidden";
1891
+ /** 标记实例是否已被销毁,防止销毁后继续重连 */
1892
+ isDestroy = false;
1893
+ /**
1894
+ * 私有构造函数,确保只能通过 getInstance 获取实例
1895
+ */
1896
+ constructor(props) {
1897
+ this.url = props.url;
1898
+ this.heartbeatInterval = props.heartbeatInterval ?? 3e4;
1899
+ this.heartbeatMessage = props.heartbeatMessage ?? "ping";
1900
+ this.clientHeartbeat = props.clientHeartbeat ?? true;
1901
+ this.reconnectInterval = props.reconnectInterval ?? 5e3;
1902
+ this.maxReconnectAttempts = props.maxReconnectAttempts;
1903
+ this.isReconnect = props.isReconnect ?? true;
1904
+ window.addEventListener("visibilitychange", this.handleVisibilityChange);
1905
+ this.createAndListenWebSocket();
1906
+ }
1907
+ /**
1908
+ * 获取指定 URL 的 WebSocketManager 单例
1909
+ * @param props WebSocket 配置参数
1910
+ * @returns WebSocketManager 实例
1911
+ */
1912
+ static getInstance(props) {
1913
+ if (!_WebSocketManager.instances.has(props.url)) {
1914
+ _WebSocketManager.instances.set(props.url, new _WebSocketManager(props));
1915
+ }
1916
+ return _WebSocketManager.instances.get(props.url);
1917
+ }
1918
+ /**
1919
+ * 添加监听器(组件挂载时调用)
1920
+ * @param listener 组件级别的监听器
1921
+ */
1922
+ addListener(listener) {
1923
+ this.listeners.add(listener);
1924
+ if (this.destroyTimeoutRef) {
1925
+ clearTimeout(this.destroyTimeoutRef);
1926
+ this.destroyTimeoutRef = null;
1927
+ }
1928
+ listener.onStateChange(this.readyState);
1929
+ }
1930
+ /**
1931
+ * 移除监听器(组件卸载时调用)
1932
+ * @param listener 组件级别的监听器
1933
+ */
1934
+ removeListener(listener) {
1935
+ this.listeners.delete(listener);
1936
+ if (this.listeners.size === 0) {
1937
+ this.destroyTimeoutRef = setTimeout(() => {
1938
+ this.destroy();
1939
+ _WebSocketManager.instances.delete(this.url);
1940
+ }, 200);
1941
+ }
1942
+ }
1943
+ /**
1944
+ * 更新连接状态并广播给所有监听器
1945
+ */
1946
+ setSocketReadyState(state) {
1947
+ this.readyState = state;
1948
+ this.listeners.forEach((l) => l.onStateChange(state));
1949
+ }
1950
+ /**
1951
+ * 启动心跳机制
1952
+ */
1953
+ startHeartbeat = (currentSocket) => {
1954
+ if (!this.clientHeartbeat) return;
1955
+ this.stopHeartbeat();
1876
1956
  const intervalId = setInterval(() => {
1877
1957
  if (currentSocket.readyState === WebSocket.OPEN) {
1878
- currentSocket.send(heartbeatMessage);
1958
+ currentSocket.send(this.heartbeatMessage);
1879
1959
  }
1880
- }, heartbeatInterval);
1881
- heartbeatIntervalRef.current = intervalId;
1960
+ }, this.heartbeatInterval);
1961
+ this.heartbeatIntervalRef = intervalId;
1962
+ };
1963
+ /**
1964
+ * 停止心跳机制
1965
+ */
1966
+ stopHeartbeat = () => {
1967
+ if (this.heartbeatIntervalRef !== null) {
1968
+ clearInterval(this.heartbeatIntervalRef);
1969
+ this.heartbeatIntervalRef = null;
1970
+ }
1882
1971
  };
1883
- const stopHeartbeat = () => {
1884
- if (heartbeatIntervalRef.current) {
1885
- clearInterval(heartbeatIntervalRef.current);
1886
- heartbeatIntervalRef.current = null;
1972
+ /**
1973
+ * 停止重连定时器
1974
+ */
1975
+ stopReconnectTimer = () => {
1976
+ if (this.reconnectIntervalRef !== null) {
1977
+ clearTimeout(this.reconnectIntervalRef);
1978
+ this.reconnectIntervalRef = null;
1887
1979
  }
1888
1980
  };
1889
- const stopReconnectTimer = () => {
1890
- if (reconnectIntervalRef.current) {
1891
- clearTimeout(reconnectIntervalRef.current);
1892
- reconnectIntervalRef.current = null;
1981
+ /**
1982
+ * 重置心跳定时器
1983
+ */
1984
+ resetHeartbeat = (currentSocket = this.socket) => {
1985
+ if (!currentSocket) return;
1986
+ this.startHeartbeat(currentSocket);
1987
+ };
1988
+ /**
1989
+ * 广播消息给所有订阅者
1990
+ */
1991
+ emitMessage = (message3) => {
1992
+ this.listeners.forEach((listener) => listener.onMessage(message3));
1993
+ };
1994
+ /**
1995
+ * 解析消息内容,JSON 解析失败时回退为原始字符串
1996
+ */
1997
+ parseMessage = (data) => {
1998
+ try {
1999
+ return JSON.parse(data);
2000
+ } catch {
2001
+ return data;
1893
2002
  }
1894
2003
  };
1895
- const tryReconnect = () => {
1896
- if (isDestroy.current) return;
1897
- if (isReconnect && !documentHide.current) {
1898
- if ((!isNumber(maxReconnectAttempts) || reconnectAttempts.current < maxReconnectAttempts) && isNullOrUnDef(reconnectIntervalRef.current)) {
1899
- reconnectIntervalRef.current = setTimeout(() => {
1900
- console.log(`\u5C1D\u8BD5\u7B2C ${reconnectAttempts.current + 1} \u6B21\u91CD\u8FDE...`, url);
1901
- reconnectAttempts.current = reconnectAttempts.current + 1;
1902
- createAndListenWebSocket();
1903
- stopReconnectTimer();
1904
- }, reconnectInterval);
2004
+ /**
2005
+ * 尝试重新连接
2006
+ */
2007
+ tryReconnect = () => {
2008
+ if (this.isDestroy || this.listeners.size === 0) return;
2009
+ if (this.isReconnect && !this.documentHide) {
2010
+ if ((!isNumber(this.maxReconnectAttempts) || this.reconnectAttempts < this.maxReconnectAttempts) && this.reconnectIntervalRef === null) {
2011
+ this.reconnectIntervalRef = setTimeout(() => {
2012
+ this.reconnectIntervalRef = null;
2013
+ console.log(`\u5C1D\u8BD5\u7B2C ${this.reconnectAttempts + 1} \u6B21\u91CD\u8FDE...`, this.url);
2014
+ this.reconnectAttempts++;
2015
+ this.createAndListenWebSocket();
2016
+ }, this.reconnectInterval);
1905
2017
  } else {
1906
- if (isNumber(maxReconnectAttempts)) {
2018
+ if (isNumber(this.maxReconnectAttempts) && this.reconnectAttempts >= this.maxReconnectAttempts) {
1907
2019
  console.log("\u8FBE\u5230\u6700\u5927\u91CD\u8FDE\u5C1D\u8BD5\u6B21\u6570\uFF0C\u505C\u6B62\u91CD\u8FDE");
1908
2020
  }
1909
2021
  }
1910
2022
  }
1911
2023
  };
1912
- const handleOpen = (newSocket) => {
2024
+ /**
2025
+ * WebSocket onopen 事件处理
2026
+ */
2027
+ handleOpen = (newSocket) => {
1913
2028
  console.log("WebSocket \u8FDE\u63A5\u5DF2\u6253\u5F00");
1914
- setSocketReadyState(newSocket.readyState);
1915
- startHeartbeat(newSocket);
1916
- reconnectAttempts.current = 0;
2029
+ this.stopReconnectTimer();
2030
+ this.setSocketReadyState(newSocket.readyState);
2031
+ this.resetHeartbeat(newSocket);
2032
+ this.reconnectAttempts = 0;
1917
2033
  };
1918
- const handleMessage = (event) => {
1919
- if (isString(event.data)) {
1920
- try {
1921
- const parsedData = JSON.parse(event.data);
1922
- onMessageEctype?.(parsedData);
1923
- stopHeartbeat();
1924
- startHeartbeat(socketRef.current);
1925
- } catch (error) {
1926
- console.error("\u89E3\u6790\u6D88\u606F\u6570\u636E\u65F6\u51FA\u9519:", error);
1927
- }
1928
- }
2034
+ /**
2035
+ * WebSocket onmessage 事件处理
2036
+ */
2037
+ handleMessage = (event) => {
2038
+ const message3 = this.parseMessage(event.data);
2039
+ this.emitMessage(message3);
2040
+ this.resetHeartbeat();
1929
2041
  };
1930
- const handleClose = (event) => {
2042
+ /**
2043
+ * WebSocket onclose 事件处理
2044
+ */
2045
+ handleClose = (event) => {
1931
2046
  console.log("WebSocket \u8FDE\u63A5\u5DF2\u5173\u95ED", event.code, event.reason);
1932
- setSocketReadyState(event.code);
1933
- stopHeartbeat();
1934
- onClose?.();
1935
- tryReconnect();
2047
+ this.setSocketReadyState(WebSocket.CLOSED);
2048
+ this.stopHeartbeat();
2049
+ this.listeners.forEach((l) => l.onClose?.());
2050
+ this.tryReconnect();
1936
2051
  };
1937
- const handleError = (error) => {
2052
+ /**
2053
+ * WebSocket onerror 事件处理
2054
+ */
2055
+ handleError = (error) => {
1938
2056
  console.error("WebSocket \u53D1\u751F\u9519\u8BEF:", error);
1939
- setSocketReadyState(null);
1940
- stopHeartbeat();
1941
- tryReconnect();
2057
+ this.setSocketReadyState(null);
2058
+ this.stopHeartbeat();
2059
+ this.tryReconnect();
2060
+ };
2061
+ /**
2062
+ * 清理当前的 WebSocket 实例,取消所有事件绑定并关闭连接
2063
+ */
2064
+ cleanupSocket = (notifyClose = false) => {
2065
+ this.stopHeartbeat();
2066
+ if (this.socket) {
2067
+ this.socket.onopen = null;
2068
+ this.socket.onmessage = null;
2069
+ this.socket.onerror = null;
2070
+ if (!notifyClose) {
2071
+ this.socket.onclose = null;
2072
+ }
2073
+ if (this.socket.readyState === WebSocket.OPEN || this.socket.readyState === WebSocket.CONNECTING) {
2074
+ this.socket.close();
2075
+ }
2076
+ }
1942
2077
  };
1943
- const createAndListenWebSocket = () => {
1944
- const newSocket = new WebSocket(url);
1945
- socketRef.current = newSocket;
1946
- setSocketReadyState(newSocket.readyState);
1947
- newSocket.onopen = () => handleOpen(newSocket);
1948
- newSocket.onmessage = handleMessage;
1949
- newSocket.onclose = handleClose;
1950
- newSocket.onerror = handleError;
2078
+ /**
2079
+ * 创建新的 WebSocket 实例并绑定事件
2080
+ */
2081
+ createAndListenWebSocket = () => {
2082
+ this.cleanupSocket();
2083
+ const newSocket = new WebSocket(this.url);
2084
+ this.socket = newSocket;
2085
+ this.setSocketReadyState(newSocket.readyState);
2086
+ newSocket.onopen = () => this.handleOpen(newSocket);
2087
+ newSocket.onmessage = this.handleMessage;
2088
+ newSocket.onclose = this.handleClose;
2089
+ newSocket.onerror = this.handleError;
1951
2090
  };
1952
- const handleVisibilityChange = () => {
1953
- documentHide.current = document.visibilityState === "hidden";
1954
- if (socketRef.current?.readyState !== WebSocket.OPEN) {
1955
- tryReconnect();
2091
+ /**
2092
+ * 处理页面可见性变化
2093
+ * 页面隐藏时暂停部分活动,重新显示且断开时尝试重连
2094
+ */
2095
+ handleVisibilityChange = () => {
2096
+ this.documentHide = document.visibilityState === "hidden";
2097
+ if (!this.documentHide && (this.readyState === WebSocket.CLOSED || this.readyState === null)) {
2098
+ this.tryReconnect();
1956
2099
  }
1957
2100
  };
2101
+ /**
2102
+ * 供外部调用的发送消息方法
2103
+ * @param message 要发送的消息内容(字符串)
2104
+ */
2105
+ sendMessage = (message3) => {
2106
+ if (this.socket?.readyState === WebSocket.OPEN) {
2107
+ this.socket.send(message3);
2108
+ this.resetHeartbeat(this.socket);
2109
+ } else {
2110
+ console.warn("WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
2111
+ }
2112
+ };
2113
+ /**
2114
+ * 销毁当前实例,清理所有资源
2115
+ */
2116
+ destroy = () => {
2117
+ this.isDestroy = true;
2118
+ window.removeEventListener("visibilitychange", this.handleVisibilityChange);
2119
+ if (this.destroyTimeoutRef) {
2120
+ clearTimeout(this.destroyTimeoutRef);
2121
+ this.destroyTimeoutRef = null;
2122
+ }
2123
+ this.cleanupSocket(true);
2124
+ this.stopHeartbeat();
2125
+ this.stopReconnectTimer();
2126
+ };
2127
+ };
2128
+
2129
+ // src/hooks/webSocket/useWebSocket.ts
2130
+ var useWebSocket_default = ({
2131
+ url,
2132
+ onMessage,
2133
+ onClose,
2134
+ heartbeatInterval = 3e4,
2135
+ heartbeatMessage = "ping",
2136
+ clientHeartbeat = true,
2137
+ reconnectInterval = 5e3,
2138
+ maxReconnectAttempts,
2139
+ isReconnect = true
2140
+ }) => {
2141
+ const [socketReadyState, setSocketReadyState] = useState(null);
2142
+ const onMessageRef = useRef(onMessage);
2143
+ useEffect(() => {
2144
+ onMessageRef.current = onMessage;
2145
+ }, [onMessage]);
2146
+ const onCloseRef = useRef(onClose);
2147
+ useEffect(() => {
2148
+ onCloseRef.current = onClose;
2149
+ }, [onClose]);
2150
+ const managerRef = useRef(null);
1958
2151
  useEffect(() => {
1959
2152
  if (!url) return;
1960
- isDestroy.current = false;
1961
- createAndListenWebSocket();
1962
- window.addEventListener("visibilitychange", handleVisibilityChange);
2153
+ const manager = WebSocketManager.getInstance({
2154
+ url,
2155
+ heartbeatInterval,
2156
+ heartbeatMessage,
2157
+ clientHeartbeat,
2158
+ reconnectInterval,
2159
+ maxReconnectAttempts,
2160
+ isReconnect
2161
+ });
2162
+ managerRef.current = manager;
2163
+ const listener = {
2164
+ onMessage: (msg) => onMessageRef.current?.(msg),
2165
+ onClose: () => onCloseRef.current?.(),
2166
+ onStateChange: (state) => setSocketReadyState(state)
2167
+ };
2168
+ manager.addListener(listener);
1963
2169
  return () => {
1964
- window.removeEventListener("visibilitychange", handleVisibilityChange);
1965
- isDestroy.current = true;
1966
- if (socketRef.current) {
1967
- socketRef.current.close();
1968
- return;
1969
- }
1970
- stopHeartbeat();
1971
- stopReconnectTimer();
2170
+ manager.removeListener(listener);
2171
+ managerRef.current = null;
1972
2172
  };
1973
2173
  }, [url]);
1974
- const sendMessage = (message3) => {
1975
- if (socketRef.current?.readyState === WebSocket.OPEN) {
1976
- socketRef.current.send(message3);
1977
- stopHeartbeat();
1978
- startHeartbeat(socketRef.current);
1979
- } else {
1980
- console.warn("WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
1981
- }
1982
- };
2174
+ const sendMessage = useCallback((message3) => {
2175
+ managerRef.current?.sendMessage(message3);
2176
+ }, []);
1983
2177
  return {
1984
- /** 发送消息方法 */
1985
2178
  sendMessage,
1986
- /** Socket 连接状态 */
1987
2179
  socketReadyState
1988
2180
  };
1989
2181
  };
@@ -2216,7 +2408,7 @@ var ProtectedView = ({
2216
2408
  });
2217
2409
  };
2218
2410
  return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsxs("div", { style: { width: 300 }, children: [
2219
- passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { message: "\u5BC6\u7801\u65E0\u6548\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\uFF01", type: "error" }),
2411
+ passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: "\u5BC6\u7801\u65E0\u6548\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\uFF01", type: "error" }),
2220
2412
  /* @__PURE__ */ jsxs(Form, { form, size: "large", className: "m-t-24", children: [
2221
2413
  /* @__PURE__ */ jsx(Form.Item, { name: "password", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5BC6\u7801" }], children: /* @__PURE__ */ jsx(Input.Password, { autoComplete: "new-password", placeholder: "\u8BF7\u8F93\u5165\u5BC6\u7801" }) }),
2222
2414
  /* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: onSubmit, children: "\u63D0 \u4EA4" }) })
@@ -2326,7 +2518,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2326
2518
  message3 = "\u65E0\u6CD5\u52A0\u8F7D\u6587\u6863";
2327
2519
  break;
2328
2520
  }
2329
- return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { message: message3, type: "error", showIcon: true }) });
2521
+ return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { title: message3, type: "error", showIcon: true }) });
2330
2522
  };
2331
2523
  const onPageChange = (e) => {
2332
2524
  let newCurrentPage = e.currentPage;
@@ -2403,7 +2595,7 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
2403
2595
  case "JPG":
2404
2596
  case "JPEG":
2405
2597
  case "GIF":
2406
- return /* @__PURE__ */ jsx(Image$1, { rootClassName: styles_module_default.nsPreviewImage, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
2598
+ return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
2407
2599
  case "PDF":
2408
2600
  return /* @__PURE__ */ jsx(PdfPreview_default, { fileUrl, ...pdfParams, password, onSetPassword });
2409
2601
  case "PDF_IMG":
@@ -2434,7 +2626,7 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
2434
2626
  {
2435
2627
  title,
2436
2628
  push: false,
2437
- width: "100%",
2629
+ size: "100%",
2438
2630
  open,
2439
2631
  onClose,
2440
2632
  children: /* @__PURE__ */ jsx(FilePreview_default, { ...props })
@@ -2442,8 +2634,10 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
2442
2634
  );
2443
2635
  };
2444
2636
 
2445
- // src/components/MicroApp/styles.less
2446
- var styles_default = {};
2637
+ // src/components/MicroApp/styles.module.less
2638
+ var styles_module_default3 = {
2639
+ microApp: "styles_module_microApp"
2640
+ };
2447
2641
  var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
2448
2642
  const [loading, setLoading] = useState(false);
2449
2643
  useEffect(() => {
@@ -2462,13 +2656,13 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
2462
2656
  return { mainSource: [...parentMainSource, name], ...data };
2463
2657
  }, [data, name]);
2464
2658
  const TagName = microApp.tagName || "micro-app";
2465
- return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D..." }, /* @__PURE__ */ jsxCustomEvent(
2659
+ return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D..." }, /* @__PURE__ */ jsxCustomEvent(
2466
2660
  TagName,
2467
2661
  {
2468
2662
  name,
2469
2663
  url,
2470
2664
  data: microAppData,
2471
- class: classNames2(styles_default.microApp, className),
2665
+ class: classNames2(styles_module_default3.microApp, className),
2472
2666
  onMounted: handleLoad,
2473
2667
  onError: handleError,
2474
2668
  ...rest
@@ -2505,7 +2699,7 @@ var Drawer_default = ({ name: podName }) => {
2505
2699
  classNames: {
2506
2700
  header: currentPod.title === false ? "hidden" : ""
2507
2701
  },
2508
- width: "100%",
2702
+ size: "100%",
2509
2703
  open: fullPodOpen,
2510
2704
  onClose: () => setFullPodOpen(false),
2511
2705
  children: /* @__PURE__ */ jsx(MicroApp_default, { iframe: true, name: podName, url: currentPod.url, "router-mode": "pure" }, currentPod.url)
@@ -2547,7 +2741,7 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2547
2741
  };
2548
2742
 
2549
2743
  // src/components/Iframe/styles.module.less
2550
- var styles_module_default3 = {
2744
+ var styles_module_default4 = {
2551
2745
  iframe: "styles_module_iframe"
2552
2746
  };
2553
2747
  var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
@@ -2562,13 +2756,13 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
2562
2756
  useEffect(() => {
2563
2757
  setLoading(true);
2564
2758
  }, [src]);
2565
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsx(
2759
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsx(
2566
2760
  "iframe",
2567
2761
  {
2568
2762
  id,
2569
2763
  ref,
2570
2764
  src: finalSrc,
2571
- className: classNames2(styles_module_default3.iframe, className),
2765
+ className: classNames2(styles_module_default4.iframe, className),
2572
2766
  onLoad: onHandleLoad,
2573
2767
  allow: "clipboard-write"
2574
2768
  }
@@ -2576,7 +2770,7 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
2576
2770
  });
2577
2771
 
2578
2772
  // src/components/MarkdownEditor/styles.module.less
2579
- var styles_module_default4 = {
2773
+ var styles_module_default5 = {
2580
2774
  editorParent: "styles_module_editorParent",
2581
2775
  extraToolbar: "styles_module_extraToolbar",
2582
2776
  editorFloatingToolbar: "styles_module_editorFloatingToolbar",
@@ -3267,7 +3461,7 @@ var ANNOTATION_KEY = "annotation";
3267
3461
  var ANNOTATION_ATTRS = ["annotation-id", "user-name", "user-id", "update-time", "content"];
3268
3462
 
3269
3463
  // src/components/MarkdownEditor/annotation/styles.module.less
3270
- var styles_module_default5 = {
3464
+ var styles_module_default6 = {
3271
3465
  annotations: "styles_module_annotations",
3272
3466
  annotationItem: "styles_module_annotationItem",
3273
3467
  annotationItemSelected: "styles_module_annotationItemSelected"
@@ -3330,7 +3524,7 @@ var AnnotationSidebar_default = ({
3330
3524
  children: annotations.length > 0 ? /* @__PURE__ */ jsx(
3331
3525
  List,
3332
3526
  {
3333
- className: classNames2(styles_module_default5.annotations, "height-full", "scroll-fade-in"),
3527
+ className: classNames2(styles_module_default6.annotations, "height-full", "scroll-fade-in"),
3334
3528
  dataSource: annotations,
3335
3529
  renderItem: (annotation) => /* @__PURE__ */ jsx(
3336
3530
  List.Item,
@@ -3338,14 +3532,14 @@ var AnnotationSidebar_default = ({
3338
3532
  ref: (el) => {
3339
3533
  itemRefs.current[annotation[ANNOTATION_ATTRS[0]]] = el;
3340
3534
  },
3341
- className: classNames2(styles_module_default5.annotationItem, {
3342
- [styles_module_default5.annotationItemSelected]: annotation[ANNOTATION_ATTRS[0]] === selectedAnnotationId
3535
+ className: classNames2(styles_module_default6.annotationItem, {
3536
+ [styles_module_default6.annotationItemSelected]: annotation[ANNOTATION_ATTRS[0]] === selectedAnnotationId
3343
3537
  }),
3344
3538
  onClick: () => {
3345
3539
  handleSelectAnnotation(annotation[ANNOTATION_ATTRS[0]]);
3346
3540
  },
3347
3541
  children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, flex: 1, children: [
3348
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default5.annotationMeta, children: [
3542
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default6.annotationMeta, children: [
3349
3543
  /* @__PURE__ */ jsx(Text, { strong: true, type: "secondary", children: annotation["user-name"] }),
3350
3544
  /* @__PURE__ */ jsx(Text, { type: "secondary", children: formatDate(annotation["update-time"]) })
3351
3545
  ] }),
@@ -3949,7 +4143,7 @@ var CollectionPlugin = Extension.create({
3949
4143
  });
3950
4144
 
3951
4145
  // src/components/MarkdownEditor/collection/styles.module.less
3952
- var styles_module_default6 = {
4146
+ var styles_module_default7 = {
3953
4147
  collections: "styles_module_collections",
3954
4148
  collectionItem: "styles_module_collectionItem",
3955
4149
  collectionItemSelected: "styles_module_collectionItemSelected"
@@ -3995,7 +4189,7 @@ var collectionSidebar_default = ({
3995
4189
  children: collections.length > 0 ? /* @__PURE__ */ jsx(
3996
4190
  List,
3997
4191
  {
3998
- className: classNames2(styles_module_default6.collections, "height-full", "scroll-fade-in"),
4192
+ className: classNames2(styles_module_default7.collections, "height-full", "scroll-fade-in"),
3999
4193
  dataSource: collections,
4000
4194
  renderItem: (collection) => {
4001
4195
  if (collectionConfig?.renderItem) {
@@ -4012,14 +4206,14 @@ var collectionSidebar_default = ({
4012
4206
  ref: (el) => {
4013
4207
  itemRefs.current[collection[COLLECTION_ATTRS[0]]] = el;
4014
4208
  },
4015
- className: classNames2(styles_module_default6.collectionItem, {
4016
- [styles_module_default6.collectionItemSelected]: collection[COLLECTION_ATTRS[0]] === selectedCollectionId
4209
+ className: classNames2(styles_module_default7.collectionItem, {
4210
+ [styles_module_default7.collectionItemSelected]: collection[COLLECTION_ATTRS[0]] === selectedCollectionId
4017
4211
  }),
4018
4212
  onClick: () => {
4019
4213
  handleSelectCollection?.(collection[COLLECTION_ATTRS[0]]);
4020
4214
  },
4021
4215
  children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, flex: 1, children: [
4022
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default6.collectionMeta, children: [
4216
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default7.collectionMeta, children: [
4023
4217
  /* @__PURE__ */ jsx(Text2, { strong: true, type: "secondary", children: collection["user-name"] }),
4024
4218
  /* @__PURE__ */ jsx(Text2, { type: "secondary", children: formatDate(collection["update-time"]) })
4025
4219
  ] }),
@@ -8926,7 +9120,7 @@ var MarkdownEditor_default = forwardRef(
8926
9120
  const fixedTools = useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
8927
9121
  const floatTools = useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
8928
9122
  return /* @__PURE__ */ jsxs(Flex, { className: "height-full width-full", children: [
8929
- /* @__PURE__ */ jsx("div", { className: classNames2("height-full", "flex-1", styles_module_default4.editorParent), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
9123
+ /* @__PURE__ */ jsx("div", { className: classNames2("height-full", "flex-1", styles_module_default5.editorParent), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
8930
9124
  /* @__PURE__ */ jsxs(Fragment, { children: [
8931
9125
  /* @__PURE__ */ jsxs(Flex, { justify: "end", align: "center", children: [
8932
9126
  fixedToolbar !== false && /* @__PURE__ */ jsx(
@@ -8939,7 +9133,7 @@ var MarkdownEditor_default = forwardRef(
8939
9133
  tools: fixedTools
8940
9134
  }
8941
9135
  ),
8942
- /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default4.extraToolbar), children: [
9136
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default5.extraToolbar), children: [
8943
9137
  annotationConfig?.enabled && annotationConfig?.showListButton !== false && /* @__PURE__ */ jsx(
8944
9138
  Button,
8945
9139
  {
@@ -8968,7 +9162,7 @@ var MarkdownEditor_default = forwardRef(
8968
9162
  extraNav
8969
9163
  ] })
8970
9164
  ] }),
8971
- !isMobile && floatToolbar !== false && /* @__PURE__ */ jsx(FloatingElement, { editor, zIndex: 188, resetTextSelectionOnClose: false, className: styles_module_default4.editorFloatingToolbar, children: /* @__PURE__ */ jsx(
9165
+ !isMobile && floatToolbar !== false && /* @__PURE__ */ jsx(FloatingElement, { editor, zIndex: 188, resetTextSelectionOnClose: false, className: styles_module_default5.editorFloatingToolbar, children: /* @__PURE__ */ jsx(
8972
9166
  EditorToolbar,
8973
9167
  {
8974
9168
  isBubble: true,
@@ -8979,17 +9173,17 @@ var MarkdownEditor_default = forwardRef(
8979
9173
  }
8980
9174
  ) })
8981
9175
  ] }),
8982
- /* @__PURE__ */ jsx("div", { id: "contentWrapper", className: classNames2(styles_module_default4.contentWrapper, "scroll-fade-in"), children: /* @__PURE__ */ jsx(
9176
+ /* @__PURE__ */ jsx("div", { id: "contentWrapper", className: classNames2(styles_module_default5.contentWrapper, "scroll-fade-in"), children: /* @__PURE__ */ jsx(
8983
9177
  EditorContent,
8984
9178
  {
8985
9179
  editor,
8986
9180
  role: "presentation",
8987
- className: classNames2(styles_module_default4.simpleEditorContent, "ns-markdown", { [styles_module_default4.noToolbar]: fixedToolbar === false })
9181
+ className: classNames2(styles_module_default5.simpleEditorContent, "ns-markdown", { [styles_module_default5.noToolbar]: fixedToolbar === false })
8988
9182
  }
8989
9183
  ) })
8990
9184
  ] }) }),
8991
9185
  annotationConfig?.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
8992
- showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
9186
+ showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default5.extraSidebarParent), children: /* @__PURE__ */ jsx(
8993
9187
  AnnotationSidebar_default,
8994
9188
  {
8995
9189
  disabled,
@@ -9004,7 +9198,7 @@ var MarkdownEditor_default = forwardRef(
9004
9198
  ) }),
9005
9199
  showAnnotationModal && /* @__PURE__ */ jsx(AnnotationModal_default, { visible: showAnnotationModal, onCancel: closeAnnotationCreateModal, onConfirm: onCreateAnnotationConfirm })
9006
9200
  ] }),
9007
- collectionConfig?.enabled && showCollection && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
9201
+ collectionConfig?.enabled && showCollection && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default5.extraSidebarParent), children: /* @__PURE__ */ jsx(
9008
9202
  collectionSidebar_default,
9009
9203
  {
9010
9204
  disabled,
@@ -9021,7 +9215,7 @@ var MarkdownEditor_default = forwardRef(
9021
9215
  );
9022
9216
 
9023
9217
  // src/components/MarkDrawing/styles.module.less
9024
- var styles_module_default7 = {
9218
+ var styles_module_default8 = {
9025
9219
  container: "styles_module_container",
9026
9220
  rect: "styles_module_rect",
9027
9221
  score: "styles_module_score"
@@ -9045,7 +9239,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
9045
9239
  }, []);
9046
9240
  const scaleX = containerSize.width / originalSize.width;
9047
9241
  const scaleY = containerSize.height / originalSize.height;
9048
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: styles_module_default7.container, children: [
9242
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: styles_module_default8.container, children: [
9049
9243
  children,
9050
9244
  detections?.map((det, idx) => {
9051
9245
  const [x1, y1, x2, y2] = det.bbox;
@@ -9057,7 +9251,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
9057
9251
  /* @__PURE__ */ jsx(
9058
9252
  "div",
9059
9253
  {
9060
- className: styles_module_default7.rect,
9254
+ className: styles_module_default8.rect,
9061
9255
  style: {
9062
9256
  left,
9063
9257
  top,
@@ -9069,7 +9263,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
9069
9263
  /* @__PURE__ */ jsx(
9070
9264
  "div",
9071
9265
  {
9072
- className: styles_module_default7.score,
9266
+ className: styles_module_default8.score,
9073
9267
  style: {
9074
9268
  left,
9075
9269
  top: Math.max(top - 20, 0)