flowcloudai-ui 0.1.4 → 0.1.6

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.css CHANGED
@@ -1891,32 +1891,26 @@
1891
1891
  .fc-tab-bar__nav-outer {
1892
1892
  display: flex;
1893
1893
  align-items: stretch;
1894
- }
1895
- .fc-tab-bar__nav-outer--scroll {
1896
- overflow: hidden;
1897
- }
1898
- .fc-tab-bar__nav {
1899
1894
  flex: 1;
1900
1895
  min-width: 0;
1901
- display: flex;
1902
- align-items: stretch;
1903
- position: relative;
1904
- z-index: 0;
1905
- }
1906
- .fc-tab-bar__nav--scroll {
1907
- overflow: hidden;
1908
- flex-shrink: 0;
1909
1896
  }
1910
1897
  .fc-tab-bar__nav-wrap {
1911
1898
  display: flex;
1912
- gap: 0;
1913
1899
  align-items: stretch;
1914
- max-width: 100%;
1915
- box-sizing: border-box;
1900
+ flex: 1;
1901
+ min-width: 0;
1902
+ overflow-x: auto;
1903
+ scrollbar-width: none;
1904
+ }
1905
+ .fc-tab-bar__nav-wrap::-webkit-scrollbar {
1906
+ display: none;
1916
1907
  }
1917
1908
  .fc-tab-bar__tab {
1909
+ flex: 1 1 0;
1910
+ min-width: var(--tab-min-width, 80px);
1911
+ max-width: var(--tab-max-width, 200px);
1918
1912
  position: relative;
1919
- display: inline-flex;
1913
+ display: flex;
1920
1914
  align-items: center;
1921
1915
  gap: var(--fc-space-sm, 8px);
1922
1916
  padding: var(--fc-space-sm, 8px) var(--fc-space-lg, 16px);
@@ -1928,10 +1922,9 @@
1928
1922
  white-space: nowrap;
1929
1923
  border: none;
1930
1924
  user-select: none;
1925
+ box-sizing: border-box;
1931
1926
  border-radius: var(--tab-item-radius-tl) var(--tab-item-radius-tr) var(--tab-item-radius-br) var(--tab-item-radius-bl);
1932
- }
1933
- .fc-tab-bar__nav--scroll .fc-tab-bar__tab {
1934
- justify-content: space-between;
1927
+ overflow: hidden;
1935
1928
  }
1936
1929
  .fc-tab-bar__tab:hover:not(.fc-tab-bar__tab--disabled):not(.fc-tab-bar__tab--dragging) {
1937
1930
  color: var(--tab-hover-color);
@@ -1946,6 +1939,24 @@
1946
1939
  cursor: not-allowed;
1947
1940
  opacity: 0.6;
1948
1941
  }
1942
+ .fc-tab-bar__tab-label {
1943
+ flex: 1;
1944
+ min-width: 0;
1945
+ overflow: hidden;
1946
+ white-space: nowrap;
1947
+ -webkit-mask-image:
1948
+ linear-gradient(
1949
+ to right,
1950
+ black 0%,
1951
+ black calc(100% - 20px),
1952
+ transparent 100%);
1953
+ mask-image:
1954
+ linear-gradient(
1955
+ to right,
1956
+ black 0%,
1957
+ black calc(100% - 20px),
1958
+ transparent 100%);
1959
+ }
1949
1960
  .fc-tab-bar--attached {
1950
1961
  border-bottom: 2px solid var(--fc-color-border);
1951
1962
  }
@@ -2022,32 +2033,6 @@
2022
2033
  .fc-tab-bar__add-btn {
2023
2034
  -webkit-app-region: no-drag;
2024
2035
  }
2025
- .fc-tab-bar--shrink .fc-tab-bar__tab {
2026
- overflow: hidden;
2027
- min-width: 0;
2028
- }
2029
- .fc-tab-bar--shrink .fc-tab-bar__tab[data-compact=true] {
2030
- padding-left: var(--fc-space-xs, 6px);
2031
- padding-right: var(--fc-space-xs, 6px);
2032
- }
2033
- .fc-tab-bar--shrink .fc-tab-bar__tab-label {
2034
- flex: 1;
2035
- min-width: 0;
2036
- overflow: hidden;
2037
- white-space: nowrap;
2038
- -webkit-mask-image:
2039
- linear-gradient(
2040
- to right,
2041
- black 0%,
2042
- black calc(100% - 20px),
2043
- transparent 100%);
2044
- mask-image:
2045
- linear-gradient(
2046
- to right,
2047
- black 0%,
2048
- black calc(100% - 20px),
2049
- transparent 100%);
2050
- }
2051
2036
  .fc-tab-bar__tab--draggable {
2052
2037
  cursor: default;
2053
2038
  }
@@ -2072,6 +2057,9 @@
2072
2057
  background-color: var(--fc-color-border-light);
2073
2058
  }
2074
2059
  .fc-tab-bar__add-btn {
2060
+ position: sticky;
2061
+ right: 0;
2062
+ flex-shrink: 0;
2075
2063
  display: inline-flex;
2076
2064
  align-items: center;
2077
2065
  justify-content: center;
@@ -2084,6 +2072,7 @@
2084
2072
  cursor: pointer;
2085
2073
  transition: all var(--fc-transition, 150ms ease);
2086
2074
  border-radius: var(--fc-radius-sm, 4px);
2075
+ background-color: var(--tab-bar-bg);
2087
2076
  }
2088
2077
  .fc-tab-bar__add-btn:hover {
2089
2078
  color: var(--fc-color-primary);
package/dist/index.d.ts CHANGED
@@ -455,17 +455,17 @@ interface TabBarProps {
455
455
  /** 是否启用拖拽排序 */
456
456
  draggable?: boolean;
457
457
  /**
458
- * Tab 最小宽度比例(相对 window.innerWidth)。
459
- * 当均分后每个 Tab 宽度 < window.innerWidth * minWidthRatio 时,切换为横向滚动模式。
460
- * @default 0.07
458
+ * Tab 最小宽度(rem 单位)。
459
+ * Tab 压缩至此宽度后触发横向滚动。
460
+ * @default '7rem'
461
461
  */
462
- minWidthRatio?: number;
462
+ minWidth?: string;
463
463
  /**
464
- * Tab 最大宽度比例(相对 window.innerWidth)。
465
- * 在固定模式下,单个 Tab 的宽度不会超过此值,防止子项很少时占满过多空间。
466
- * @default 0.15
464
+ * Tab 最大宽度(rem 单位)。
465
+ * Tab 较少时不超过此宽度。
466
+ * @default '15rem'
467
467
  */
468
- maxTabWidthRatio?: number;
468
+ maxTabWidth?: string;
469
469
  onChange: (activeKey: string) => void;
470
470
  onClose?: (key: string) => void;
471
471
  onAdd?: () => void;
package/dist/index.js CHANGED
@@ -2025,113 +2025,13 @@ var Card = ({
2025
2025
  };
2026
2026
 
2027
2027
  // src/components/Bar/TabBar.tsx
2028
- import { useRef as useRef8, useCallback as useCallback9, memo as memo4, useEffect as useEffect9 } from "react";
2029
-
2030
- // src/components/Bar/useAdaptiveTabLayout.ts
2031
- import { useState as useState13, useRef as useRef7, useCallback as useCallback8, useEffect as useEffect8 } from "react";
2032
- function useAdaptiveTabLayout(navRef, options) {
2033
- const { itemsLength, addable, minWidthRatio, maxTabWidthRatio } = options;
2034
- const itemsLengthRef = useRef7(itemsLength);
2035
- itemsLengthRef.current = itemsLength;
2036
- const addableRef = useRef7(addable);
2037
- addableRef.current = addable;
2038
- const minWidthRatioRef = useRef7(minWidthRatio);
2039
- minWidthRatioRef.current = minWidthRatio;
2040
- const maxTabWidthRatioRef = useRef7(maxTabWidthRatio);
2041
- maxTabWidthRatioRef.current = maxTabWidthRatio;
2042
- const [layout, setLayout] = useState13({ scrollMode: false, tabWidth: void 0 });
2043
- const rafRef = useRef7(null);
2044
- const lastLayoutRef = useRef7({ scrollMode: false, tabWidth: void 0 });
2045
- const addBtnWidthRef = useRef7(0);
2046
- const lastAddableRef = useRef7(void 0);
2047
- const calculate = useCallback8(() => {
2048
- const navOuter = navRef.current?.parentElement;
2049
- const nav = navRef.current;
2050
- const currentItemsLength = itemsLengthRef.current;
2051
- const currentAddable = addableRef.current;
2052
- const currentMinWidthRatio = minWidthRatioRef.current;
2053
- const currentMaxTabWidthRatio = maxTabWidthRatioRef.current;
2054
- if (!nav || !navOuter || currentItemsLength === 0) return;
2055
- if (currentAddable !== lastAddableRef.current) {
2056
- lastAddableRef.current = currentAddable;
2057
- if (currentAddable) {
2058
- const addBtnElement = navOuter.querySelector(".fc-tab-bar__add-btn");
2059
- if (addBtnElement) {
2060
- const btnStyle = getComputedStyle(addBtnElement);
2061
- const marginL = parseFloat(btnStyle.marginLeft) || 0;
2062
- const marginR = parseFloat(btnStyle.marginRight) || 0;
2063
- addBtnWidthRef.current = addBtnElement.getBoundingClientRect().width + marginL + marginR;
2064
- }
2065
- } else {
2066
- addBtnWidthRef.current = 0;
2067
- }
2068
- }
2069
- const navOuterCS = getComputedStyle(navOuter);
2070
- const navWrap = nav.querySelector(".fc-tab-bar__nav-wrap");
2071
- const navOuterW = navOuter.clientWidth - parseFloat(navOuterCS.paddingLeft) - parseFloat(navOuterCS.paddingRight);
2072
- const navW = navOuterW - addBtnWidthRef.current;
2073
- const tabGap = navWrap ? parseFloat(getComputedStyle(navWrap).gap) : 0;
2074
- const totalGapWidth = (currentItemsLength - 1) * tabGap;
2075
- const idealW = (navW - totalGapWidth) / currentItemsLength;
2076
- const threshold = screen.width * currentMinWidthRatio;
2077
- const maxAllowedWidth = screen.width * currentMaxTabWidthRatio;
2078
- const minAllowedWidth = 42;
2079
- const prev = lastLayoutRef.current;
2080
- const hysteresisFactor = 1.1;
2081
- let newScrollMode;
2082
- let newTabWidth;
2083
- if (idealW < threshold) {
2084
- newScrollMode = true;
2085
- newTabWidth = Math.max(threshold, minAllowedWidth);
2086
- } else if (prev.scrollMode && idealW < threshold * hysteresisFactor) {
2087
- newScrollMode = true;
2088
- newTabWidth = Math.max(threshold, minAllowedWidth);
2089
- } else {
2090
- newScrollMode = false;
2091
- newTabWidth = Math.min(Math.max(idealW, minAllowedWidth), maxAllowedWidth);
2092
- }
2093
- if (prev.tabWidth !== newTabWidth || prev.scrollMode !== newScrollMode) {
2094
- const newLayout = { scrollMode: newScrollMode, tabWidth: newTabWidth };
2095
- lastLayoutRef.current = newLayout;
2096
- setLayout(newLayout);
2097
- }
2098
- }, [navRef]);
2099
- const calculateRef = useRef7(calculate);
2100
- calculateRef.current = calculate;
2101
- useEffect8(() => {
2102
- const navOuter = navRef.current?.parentElement;
2103
- if (!navOuter) return;
2104
- const ro = new ResizeObserver(() => {
2105
- if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
2106
- rafRef.current = requestAnimationFrame(() => {
2107
- rafRef.current = null;
2108
- calculateRef.current();
2109
- });
2110
- });
2111
- ro.observe(navOuter);
2112
- rafRef.current = requestAnimationFrame(() => {
2113
- rafRef.current = null;
2114
- calculateRef.current();
2115
- });
2116
- return () => {
2117
- ro.disconnect();
2118
- if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
2119
- };
2120
- }, []);
2121
- useEffect8(() => {
2122
- calculate();
2123
- }, [itemsLength, calculate]);
2124
- return layout;
2125
- }
2126
-
2127
- // src/components/Bar/TabBar.tsx
2028
+ import { useRef as useRef7, useCallback as useCallback8, memo as memo4, useEffect as useEffect8 } from "react";
2128
2029
  import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
2129
2030
  var TabItemView = memo4(({
2130
2031
  item,
2131
2032
  isActive,
2132
2033
  closable,
2133
2034
  draggable,
2134
- tabWidth,
2135
2035
  tabClassName,
2136
2036
  activeTabClassName,
2137
2037
  tabStyle,
@@ -2145,7 +2045,6 @@ var TabItemView = memo4(({
2145
2045
  onDragEnd
2146
2046
  }) => {
2147
2047
  const showClose = item.closable !== void 0 ? item.closable : closable;
2148
- const isCompact = tabWidth !== void 0 && tabWidth < 42;
2149
2048
  const classes = [
2150
2049
  "fc-tab-bar__tab",
2151
2050
  isActive && "fc-tab-bar__tab--active",
@@ -2155,7 +2054,6 @@ var TabItemView = memo4(({
2155
2054
  isActive && activeTabClassName
2156
2055
  ].filter(Boolean).join(" ");
2157
2056
  const mergedStyle = {
2158
- ...tabWidth !== void 0 ? { width: tabWidth, boxSizing: "border-box", flexShrink: 0 } : void 0,
2159
2057
  ...tabStyle,
2160
2058
  ...isActive ? activeTabStyle : void 0
2161
2059
  };
@@ -2164,7 +2062,6 @@ var TabItemView = memo4(({
2164
2062
  {
2165
2063
  className: classes,
2166
2064
  style: mergedStyle,
2167
- "data-compact": isCompact || void 0,
2168
2065
  onClick: () => !item.disabled && onClick(item.key),
2169
2066
  draggable: draggable && !item.disabled,
2170
2067
  onDragStart: (e) => onDragStart(e, item.key),
@@ -2183,7 +2080,7 @@ var TabItemView = memo4(({
2183
2080
  className: "fc-tab-bar__tab-close",
2184
2081
  onClick: (e) => onClose(e, item.key),
2185
2082
  role: "button",
2186
- "aria-label": `\u5173\u95ED`,
2083
+ "aria-label": "\u5173\u95ED",
2187
2084
  children: renderCloseIcon ? renderCloseIcon(item.key) : "\xD7"
2188
2085
  }
2189
2086
  )
@@ -2201,8 +2098,8 @@ var TabBar = memo4(({
2201
2098
  closable = false,
2202
2099
  addable = false,
2203
2100
  draggable = false,
2204
- minWidthRatio = 0.07,
2205
- maxTabWidthRatio = 0.15,
2101
+ minWidth = "7rem",
2102
+ maxTabWidth = "15rem",
2206
2103
  onChange,
2207
2104
  onClose,
2208
2105
  onAdd,
@@ -2240,37 +2137,42 @@ var TabBar = memo4(({
2240
2137
  }
2241
2138
  }
2242
2139
  const mergedStyle = { ...overrideStyle, ...style };
2243
- const dragKeyRef = useRef8(null);
2244
- const navRef = useRef8(null);
2245
- const layout = useAdaptiveTabLayout(navRef, {
2246
- itemsLength: items.length,
2247
- addable,
2248
- minWidthRatio,
2249
- maxTabWidthRatio
2250
- });
2251
- const prevItemsLengthRef = useRef8(items.length);
2252
- useEffect9(() => {
2140
+ const dragKeyRef = useRef7(null);
2141
+ const navRef = useRef7(null);
2142
+ const prevItemsLengthRef = useRef7(items.length);
2143
+ useEffect8(() => {
2253
2144
  const prev = prevItemsLengthRef.current;
2254
2145
  prevItemsLengthRef.current = items.length;
2255
- if (items.length <= prev || !layout.scrollMode) return;
2256
- const roll = navRef.current?.querySelector(".fc-roll");
2257
- if (!roll) return;
2146
+ if (items.length <= prev) return;
2147
+ const nav = navRef.current;
2148
+ if (!nav) return;
2258
2149
  requestAnimationFrame(() => {
2259
- roll.scrollLeft = roll.scrollWidth;
2150
+ nav.scrollLeft = nav.scrollWidth;
2260
2151
  });
2261
- }, [items.length, layout.scrollMode]);
2262
- const handleClick = useCallback9(
2152
+ }, [items.length]);
2153
+ useEffect8(() => {
2154
+ const nav = navRef.current;
2155
+ if (!nav) return;
2156
+ const handleWheel = (e) => {
2157
+ if (e.deltaY === 0) return;
2158
+ e.preventDefault();
2159
+ nav.scrollLeft += Number(e.deltaY);
2160
+ };
2161
+ nav.addEventListener("wheel", handleWheel, { passive: false });
2162
+ return () => nav.removeEventListener("wheel", handleWheel);
2163
+ }, []);
2164
+ const handleClick = useCallback8(
2263
2165
  (key) => onChange(key),
2264
2166
  [onChange]
2265
2167
  );
2266
- const handleClose = useCallback9(
2168
+ const handleClose = useCallback8(
2267
2169
  (e, key) => {
2268
2170
  e.stopPropagation();
2269
2171
  onClose?.(key);
2270
2172
  },
2271
2173
  [onClose]
2272
2174
  );
2273
- const handleDragStart = useCallback9(
2175
+ const handleDragStart = useCallback8(
2274
2176
  (e, key) => {
2275
2177
  dragKeyRef.current = key;
2276
2178
  e.dataTransfer.effectAllowed = "move";
@@ -2279,11 +2181,11 @@ var TabBar = memo4(({
2279
2181
  },
2280
2182
  []
2281
2183
  );
2282
- const handleDragOver = useCallback9((e) => {
2184
+ const handleDragOver = useCallback8((e) => {
2283
2185
  e.preventDefault();
2284
2186
  e.dataTransfer.dropEffect = "move";
2285
2187
  }, []);
2286
- const handleDrop = useCallback9(
2188
+ const handleDrop = useCallback8(
2287
2189
  (e, targetKey) => {
2288
2190
  e.preventDefault();
2289
2191
  const dragKey = dragKeyRef.current;
@@ -2298,61 +2200,60 @@ var TabBar = memo4(({
2298
2200
  },
2299
2201
  [items, onReorder]
2300
2202
  );
2301
- const handleDragEnd = useCallback9((e) => {
2203
+ const handleDragEnd = useCallback8((e) => {
2302
2204
  dragKeyRef.current = null;
2303
2205
  e.currentTarget.classList.remove("fc-tab-bar__tab--dragging");
2304
2206
  }, []);
2305
- const { scrollMode, tabWidth } = layout;
2306
2207
  const rootClasses = [
2307
2208
  "fc-tab-bar",
2308
2209
  `fc-tab-bar--${variant}`,
2309
2210
  `fc-tab-bar--radius-${radius}`,
2310
2211
  tabRadius && `fc-tab-bar--tab-radius-${tabRadius}`,
2311
- !scrollMode && tabWidth !== void 0 && "fc-tab-bar--shrink",
2312
2212
  className
2313
2213
  ].filter(Boolean).join(" ");
2314
- const tabList = /* @__PURE__ */ jsx18("div", { className: "fc-tab-bar__nav-wrap", children: items.map((item) => /* @__PURE__ */ jsx18(
2315
- TabItemView,
2316
- {
2317
- item,
2318
- isActive: activeKey === item.key,
2319
- closable,
2320
- draggable,
2321
- tabWidth,
2322
- tabClassName,
2323
- activeTabClassName,
2324
- tabStyle,
2325
- activeTabStyle,
2326
- renderCloseIcon,
2327
- onClick: handleClick,
2328
- onClose: handleClose,
2329
- onDragStart: handleDragStart,
2330
- onDragOver: handleDragOver,
2331
- onDrop: handleDrop,
2332
- onDragEnd: handleDragEnd
2333
- },
2334
- item.key
2335
- )) });
2336
- const addBtn = addable && /* @__PURE__ */ jsx18(
2337
- "div",
2338
- {
2339
- className: "fc-tab-bar__add-btn",
2340
- onClick: onAdd,
2341
- role: "button",
2342
- "aria-label": "\u6DFB\u52A0\u6807\u7B7E",
2343
- children: renderAddButton ? renderAddButton() : "+"
2344
- }
2345
- );
2214
+ const navWrapStyle = {
2215
+ "--tab-min-width": minWidth,
2216
+ "--tab-max-width": maxTabWidth
2217
+ };
2346
2218
  const dragRegion = tauriDragRegion ? { "data-tauri-drag-region": "" } : {};
2347
- return /* @__PURE__ */ jsx18("div", { className: rootClasses, style: mergedStyle, role: "tablist", ...dragRegion, children: /* @__PURE__ */ jsxs13("div", { className: `fc-tab-bar__nav-outer${scrollMode ? " fc-tab-bar__nav-outer--scroll" : ""}`, ...dragRegion, children: [
2348
- /* @__PURE__ */ jsx18("div", { className: `fc-tab-bar__nav${scrollMode ? " fc-tab-bar__nav--scroll" : ""}`, ref: navRef, children: scrollMode ? /* @__PURE__ */ jsx18(RollingBox, { horizontal: true, showThumb: "hide", style: { flex: 1, minWidth: 0, height: "auto" }, children: tabList }) : tabList }),
2349
- addBtn
2350
- ] }) });
2219
+ return /* @__PURE__ */ jsx18("div", { className: rootClasses, style: mergedStyle, role: "tablist", ...dragRegion, children: /* @__PURE__ */ jsx18("div", { className: "fc-tab-bar__nav-outer", ...dragRegion, children: /* @__PURE__ */ jsxs13("div", { className: "fc-tab-bar__nav-wrap", ref: navRef, style: navWrapStyle, children: [
2220
+ items.map((item) => /* @__PURE__ */ jsx18(
2221
+ TabItemView,
2222
+ {
2223
+ item,
2224
+ isActive: activeKey === item.key,
2225
+ closable,
2226
+ draggable,
2227
+ tabClassName,
2228
+ activeTabClassName,
2229
+ tabStyle,
2230
+ activeTabStyle,
2231
+ renderCloseIcon,
2232
+ onClick: handleClick,
2233
+ onClose: handleClose,
2234
+ onDragStart: handleDragStart,
2235
+ onDragOver: handleDragOver,
2236
+ onDrop: handleDrop,
2237
+ onDragEnd: handleDragEnd
2238
+ },
2239
+ item.key
2240
+ )),
2241
+ addable && /* @__PURE__ */ jsx18(
2242
+ "div",
2243
+ {
2244
+ className: "fc-tab-bar__add-btn",
2245
+ onClick: onAdd,
2246
+ role: "button",
2247
+ "aria-label": "\u6DFB\u52A0\u6807\u7B7E",
2248
+ children: renderAddButton ? renderAddButton() : "+"
2249
+ }
2250
+ )
2251
+ ] }) }) });
2351
2252
  });
2352
2253
  TabBar.displayName = "TabBar";
2353
2254
 
2354
2255
  // src/components/Tag/TagItem.tsx
2355
- import { useEffect as useEffect10, useRef as useRef9, useState as useState14 } from "react";
2256
+ import { useEffect as useEffect9, useRef as useRef8, useState as useState13 } from "react";
2356
2257
  import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
2357
2258
  function TagItem({
2358
2259
  schema,
@@ -2363,10 +2264,10 @@ function TagItem({
2363
2264
  color,
2364
2265
  borderColor
2365
2266
  }) {
2366
- const [editing, setEditing] = useState14(false);
2367
- const [draft, setDraft] = useState14(() => value !== void 0 ? String(value) : "");
2368
- const inputRef = useRef9(null);
2369
- useEffect10(() => {
2267
+ const [editing, setEditing] = useState13(false);
2268
+ const [draft, setDraft] = useState13(() => value !== void 0 ? String(value) : "");
2269
+ const inputRef = useRef8(null);
2270
+ useEffect9(() => {
2370
2271
  if (!editing) setDraft(value !== void 0 ? String(value) : "");
2371
2272
  }, [value, editing]);
2372
2273
  const colorVars = {
@@ -2465,7 +2366,7 @@ function TagItem({
2465
2366
  }
2466
2367
 
2467
2368
  // src/components/MarkdownEditor/MarkdownEditor.tsx
2468
- import { useState as useState15 } from "react";
2369
+ import { useState as useState14 } from "react";
2469
2370
  import MDEditor, { commands } from "@uiw/react-md-editor";
2470
2371
  import { jsx as jsx20 } from "react/jsx-runtime";
2471
2372
  function withTitle(cmd, title) {
@@ -2501,7 +2402,7 @@ function MarkdownEditor({
2501
2402
  borderColor
2502
2403
  }) {
2503
2404
  const { resolvedTheme } = useTheme();
2504
- const [showSplit, setShowSplit] = useState15(false);
2405
+ const [showSplit, setShowSplit] = useState14(false);
2505
2406
  const colorVars = {
2506
2407
  "--md-bg": background,
2507
2408
  "--md-toolbar-bg": toolbarBackground,
@@ -2560,7 +2461,7 @@ function MarkdownEditor({
2560
2461
  }
2561
2462
 
2562
2463
  // src/components/ContextMenu/ContextMenuContext.tsx
2563
- import { createContext as createContext4, useContext as useContext4, useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
2464
+ import { createContext as createContext4, useContext as useContext4, useEffect as useEffect10, useRef as useRef9, useState as useState15 } from "react";
2564
2465
  import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2565
2466
  var ContextMenuContext = createContext4(null);
2566
2467
  function ContextMenuProvider({
@@ -2569,13 +2470,13 @@ function ContextMenuProvider({
2569
2470
  borderColor,
2570
2471
  hoverBackground
2571
2472
  }) {
2572
- const [menu, setMenu] = useState16({
2473
+ const [menu, setMenu] = useState15({
2573
2474
  visible: false,
2574
2475
  x: 0,
2575
2476
  y: 0,
2576
2477
  items: []
2577
2478
  });
2578
- const menuRef = useRef10(null);
2479
+ const menuRef = useRef9(null);
2579
2480
  const showContextMenu = (e, items) => {
2580
2481
  e.preventDefault();
2581
2482
  e.stopPropagation();
@@ -2583,7 +2484,7 @@ function ContextMenuProvider({
2583
2484
  };
2584
2485
  const hide = () => setMenu((s) => ({ ...s, visible: false }));
2585
2486
  useClickOutside(menuRef, hide, menu.visible);
2586
- useEffect11(() => {
2487
+ useEffect10(() => {
2587
2488
  if (!menu.visible) return;
2588
2489
  const onKeyDown = (e) => {
2589
2490
  if (e.key === "Escape") hide();
@@ -2652,10 +2553,10 @@ function ContextMenuProvider({
2652
2553
  var useContextMenu = () => useContext4(ContextMenuContext);
2653
2554
 
2654
2555
  // src/components/Chat/Chat.tsx
2655
- import { useState as useState18, useRef as useRef11, useEffect as useEffect12, useCallback as useCallback11, useMemo as useMemo5 } from "react";
2556
+ import { useState as useState17, useRef as useRef10, useEffect as useEffect11, useCallback as useCallback10, useMemo as useMemo5 } from "react";
2656
2557
 
2657
2558
  // src/components/SmartMessage/SmartMessage.tsx
2658
- import { useState as useState17, useCallback as useCallback10 } from "react";
2559
+ import { useState as useState16, useCallback as useCallback9 } from "react";
2659
2560
  import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2660
2561
  var SmartMessage = ({
2661
2562
  id,
@@ -2668,8 +2569,8 @@ var SmartMessage = ({
2668
2569
  className = "",
2669
2570
  style = {}
2670
2571
  }) => {
2671
- const [copied, setCopied] = useState17(false);
2672
- const handleCopy = useCallback10(async () => {
2572
+ const [copied, setCopied] = useState16(false);
2573
+ const handleCopy = useCallback9(async () => {
2673
2574
  try {
2674
2575
  await navigator.clipboard.writeText(content);
2675
2576
  setCopied(true);
@@ -2757,34 +2658,34 @@ var Chat = ({
2757
2658
  height = "600px",
2758
2659
  width
2759
2660
  }) => {
2760
- const [showHistory, setShowHistory] = useState18(false);
2761
- const [isMinimized, setIsMinimized] = useState18(false);
2762
- const messagesContainerRef = useRef11(null);
2763
- const messagesEndRef = useRef11(null);
2764
- const historyPanelRef = useRef11(null);
2661
+ const [showHistory, setShowHistory] = useState17(false);
2662
+ const [isMinimized, setIsMinimized] = useState17(false);
2663
+ const messagesContainerRef = useRef10(null);
2664
+ const messagesEndRef = useRef10(null);
2665
+ const historyPanelRef = useRef10(null);
2765
2666
  const currentConversation = useMemo5(
2766
2667
  () => conversations.find((c) => c.id === currentConversationId),
2767
2668
  [conversations, currentConversationId]
2768
2669
  );
2769
2670
  const currentTitle = currentConversation?.title || title;
2770
- useEffect12(() => {
2671
+ useEffect11(() => {
2771
2672
  if (autoScroll && messagesContainerRef.current && !showHistory && !isMinimized) {
2772
2673
  messagesContainerRef.current.scrollTop = messagesContainerRef.current.scrollHeight;
2773
2674
  }
2774
2675
  }, [messages, loading, showHistory, isMinimized, autoScroll]);
2775
2676
  useClickOutside(historyPanelRef, () => setShowHistory(false), showHistory);
2776
- const handleDeleteConversation = useCallback11((conversationId) => {
2677
+ const handleDeleteConversation = useCallback10((conversationId) => {
2777
2678
  onDeleteConversation?.(conversationId);
2778
2679
  }, [onDeleteConversation]);
2779
- const handleMinimize = useCallback11(() => {
2680
+ const handleMinimize = useCallback10(() => {
2780
2681
  setIsMinimized(true);
2781
2682
  onMinimize?.();
2782
2683
  }, [onMinimize]);
2783
- const handleRestore = useCallback11(() => {
2684
+ const handleRestore = useCallback10(() => {
2784
2685
  setIsMinimized(false);
2785
2686
  onRestore?.();
2786
2687
  }, [onRestore]);
2787
- const handleCopy = useCallback11((content) => {
2688
+ const handleCopy = useCallback10((content) => {
2788
2689
  const message = messages.find((m) => m.content === content);
2789
2690
  if (message) {
2790
2691
  onMessageCopy?.(message);
@@ -2962,7 +2863,7 @@ var Chat = ({
2962
2863
  };
2963
2864
 
2964
2865
  // src/components/Relation/Relation.tsx
2965
- import React13, { useCallback as useCallback12, useEffect as useEffect13, memo as memo5 } from "react";
2866
+ import React13, { useCallback as useCallback11, useEffect as useEffect12, memo as memo5 } from "react";
2966
2867
  import {
2967
2868
  ReactFlow,
2968
2869
  useNodesState,
@@ -3184,7 +3085,7 @@ var RelationContent = ({
3184
3085
  const theme = propTheme;
3185
3086
  const isDark = theme === "dark";
3186
3087
  const bgColor = isDark ? "#0f172a" : "#f5f7fa";
3187
- useEffect13(() => {
3088
+ useEffect12(() => {
3188
3089
  if (fitView && fitViewFn && (propNodes?.length || 0) > 0) {
3189
3090
  const timer = setTimeout(() => {
3190
3091
  fitViewFn({ duration: 300, padding: 0.2, ...fitViewOptions }).catch((error) => {
@@ -3194,17 +3095,17 @@ var RelationContent = ({
3194
3095
  return () => clearTimeout(timer);
3195
3096
  }
3196
3097
  }, [fitView, fitViewFn, fitViewOptions, propNodes]);
3197
- useEffect13(() => {
3098
+ useEffect12(() => {
3198
3099
  if (propNodes) {
3199
3100
  setNodes(propNodes);
3200
3101
  }
3201
3102
  }, [propNodes, setNodes]);
3202
- useEffect13(() => {
3103
+ useEffect12(() => {
3203
3104
  if (propEdges) {
3204
3105
  setEdges(propEdges);
3205
3106
  }
3206
3107
  }, [propEdges, setEdges]);
3207
- const handleNodesChange = useCallback12(
3108
+ const handleNodesChange = useCallback11(
3208
3109
  (changes) => {
3209
3110
  onNodesChange(changes);
3210
3111
  if (onNodesChangeProp) {
@@ -3215,7 +3116,7 @@ var RelationContent = ({
3215
3116
  },
3216
3117
  [onNodesChange, onNodesChangeProp, nodes]
3217
3118
  );
3218
- const handleEdgesChange = useCallback12(
3119
+ const handleEdgesChange = useCallback11(
3219
3120
  (changes) => {
3220
3121
  onEdgesChange(changes);
3221
3122
  if (onEdgesChangeProp) {
@@ -3226,7 +3127,7 @@ var RelationContent = ({
3226
3127
  },
3227
3128
  [onEdgesChange, onEdgesChangeProp, edges]
3228
3129
  );
3229
- const onConnect = useCallback12(
3130
+ const onConnect = useCallback11(
3230
3131
  (params) => {
3231
3132
  const newEdge = {
3232
3133
  ...params,
@@ -3250,7 +3151,7 @@ var RelationContent = ({
3250
3151
  },
3251
3152
  [setEdges, onConnectProp, edgeStyles.defaultColor, isDark]
3252
3153
  );
3253
- const handleNodeClick = useCallback12(
3154
+ const handleNodeClick = useCallback11(
3254
3155
  (_event, node) => {
3255
3156
  if (onNodeClick && node.data) {
3256
3157
  onNodeClick(node.id, node.data, _event);
@@ -3258,7 +3159,7 @@ var RelationContent = ({
3258
3159
  },
3259
3160
  [onNodeClick]
3260
3161
  );
3261
- const handleNodeDoubleClick = useCallback12(
3162
+ const handleNodeDoubleClick = useCallback11(
3262
3163
  (_event, node) => {
3263
3164
  if (onNodeDoubleClick && node.data) {
3264
3165
  onNodeDoubleClick(node.id, node.data);
@@ -3266,7 +3167,7 @@ var RelationContent = ({
3266
3167
  },
3267
3168
  [onNodeDoubleClick]
3268
3169
  );
3269
- const handleNodeContextMenu = useCallback12(
3170
+ const handleNodeContextMenu = useCallback11(
3270
3171
  (event, node) => {
3271
3172
  event.preventDefault();
3272
3173
  if (onNodeContextMenu && node.data) {
@@ -3275,7 +3176,7 @@ var RelationContent = ({
3275
3176
  },
3276
3177
  [onNodeContextMenu]
3277
3178
  );
3278
- const handleEdgeClick = useCallback12(
3179
+ const handleEdgeClick = useCallback11(
3279
3180
  (_event, edge) => {
3280
3181
  if (onEdgeClick) {
3281
3182
  onEdgeClick(edge.id, edge.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcloudai-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "author": "flowcloudai",
6
6
  "module": "dist/index.js",