@gpustack/core-ui 1.0.33 → 1.0.34

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.
@@ -1,31 +1,14 @@
1
1
  import { t as e } from "./rolldown-runtime-BETGA6I9.js";
2
- import "axios";
3
- import { createContext as t, useContext as n, useMemo as r } from "react";
4
- //#region src/lib/context/CoreUIContext.ts
5
- var i = t({
6
- config: {
7
- apiBaseUrl: "",
8
- iconUrl: "",
9
- theme: "light"
10
- },
11
- i18n: { formatMessage: (e, t) => e.id },
12
- locale: {
13
- getAllLocales: () => [],
14
- setLocale: () => {}
15
- },
16
- hooks: {
17
- useIntl: () => ({
18
- locale: "en-US",
19
- formatMessage: (e, t) => e.id
20
- }),
21
- useCurrentUser: () => void 0,
22
- useTableFetch: (() => {
23
- throw Error("useTableFetch was not provided by the host CoreUIProvider");
24
- })
25
- },
26
- tokens: {},
27
- services: { request: async (e, t) => Promise.resolve({}) }
28
- }), a = () => n(i), o = /* @__PURE__ */ e(((e, t) => {
2
+ import { t } from "./useCoreUIContext-_TAsecw_.js";
3
+ import { useMemo as n } from "react";
4
+ //#region src/lib/hooks/useIntl.ts
5
+ var r = () => {
6
+ let { hooks: e } = t(), r = e.useIntl();
7
+ return n(() => ({
8
+ ...r,
9
+ locale: r.locale || "en-US"
10
+ }), [r]);
11
+ }, i = /* @__PURE__ */ e(((e, t) => {
29
12
  (function() {
30
13
  var e = {}.hasOwnProperty;
31
14
  function n() {
@@ -51,12 +34,6 @@ var i = t({
51
34
  return n;
52
35
  }) : window.classNames = n;
53
36
  })();
54
- })), s = () => {
55
- let { hooks: e } = a(), t = e.useIntl();
56
- return r(() => ({
57
- ...t,
58
- locale: t.locale || "en-US"
59
- }), [t]);
60
- };
37
+ }));
61
38
  //#endregion
62
- export { i, o as n, a as r, s as t };
39
+ export { r as n, i as t };
@@ -1,5 +1,5 @@
1
1
  import { o as e } from "./rolldown-runtime-BETGA6I9.js";
2
- import { n as t } from "./useIntl-ClqxSZNY.js";
2
+ import { t } from "./classnames-1RsQ5HaB.js";
3
3
  import "react";
4
4
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
5
  import i from "styled-components";
@@ -5,7 +5,7 @@ function t(e) {
5
5
  let r = new FileReader();
6
6
  r.onload = async function(e) {
7
7
  try {
8
- let { default: n } = await import("./xlsx-DLkyLHwb.js").then((e) => e.t), r = e.target.result, i = n.read(r, { type: "string" }), a = i.SheetNames[0];
8
+ let { default: n } = await import("./xlsx-CkHo9SHP.js").then((e) => e.t), r = e.target.result, i = n.read(r, { type: "string" }), a = i.SheetNames[0];
9
9
  if (!a) {
10
10
  t("[]");
11
11
  return;
@@ -24,7 +24,7 @@ function t(e) {
24
24
  });
25
25
  }
26
26
  function n({ sheets: t, fileName: n = "data.xlsx" }) {
27
- import("./xlsx-DLkyLHwb.js").then((e) => e.t).then(({ default: r }) => {
27
+ import("./xlsx-CkHo9SHP.js").then((e) => e.t).then(({ default: r }) => {
28
28
  let i = r.utils.book_new();
29
29
  t.forEach((e) => {
30
30
  let { sheetName: t, jsonData: n, fields: a, fieldLabels: o, formatMap: s } = e, c = n.map((e) => {
package/dist/excel.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./excel-reader-Bgm6Gd2H.js";
1
+ import { t as e } from "./excel-reader-Dm-T5v37.js";
2
2
  export { e as exportJsonToExcel };
@@ -1,3 +1,3 @@
1
- import { n as e } from "./excel-reader-Bgm6Gd2H.js";
2
- import { a as t, i as n, n as r, r as i, t as a } from "./word-reader-CSmNlWcx.js";
3
- export { t as readEpubContent, e as readExcelContent, r as readHtmlContent, n as readPDFContent, i as readPptxContent, a as readWordContent };
1
+ import { a as e, i as t, n, r, t as i } from "./word-reader-DZfu7nOd.js";
2
+ import { n as a } from "./excel-reader-Dm-T5v37.js";
3
+ export { e as readEpubContent, a as readExcelContent, n as readHtmlContent, t as readPDFContent, r as readPptxContent, i as readWordContent };
@@ -1,17 +1,18 @@
1
1
  import { o as e, t } from "./rolldown-runtime-BETGA6I9.js";
2
- import { n, r, t as i } from "./useIntl-ClqxSZNY.js";
3
- import { t as a } from "./lodash-i3XVVuwG.js";
2
+ import { t as n } from "./lodash-CFrt21kh.js";
3
+ import { t as r } from "./useCoreUIContext-_TAsecw_.js";
4
+ import { n as i, t as a } from "./classnames-1RsQ5HaB.js";
4
5
  import o, { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
5
6
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
- import { CheckCircleFilled as m, CloseOutlined as h, CopyOutlined as g } from "@ant-design/icons";
7
- import { Button as _, Tag as v, Tooltip as y, message as b } from "antd";
8
- import x from "styled-components";
9
- import { useMemoizedFn as S } from "ahooks";
10
- import { useOverlayScrollbars as C } from "overlayscrollbars-react";
7
+ import { Button as m, Tag as h, Tooltip as g, message as _ } from "antd";
8
+ import { useMemoizedFn as v } from "ahooks";
9
+ import { useOverlayScrollbars as y } from "overlayscrollbars-react";
10
+ import { CheckCircleFilled as b, CloseOutlined as x, CopyOutlined as S } from "@ant-design/icons";
11
+ import C from "styled-components";
11
12
  //#region src/lib/hooks/use-overlay-scroller.ts
12
- var w = /* @__PURE__ */ e(n(), 1), T = /* @__PURE__ */ e(a(), 1), E = 5e3;
13
- function D(e) {
14
- let { config: t } = r(), { theme: n } = t, { options: i, events: a, defer: s = !0 } = e || {}, { scrollbars: l, overflow: u, oppositeTheme: d } = i || {}, f = o.useRef(null), p = o.useRef(null), m = o.useRef(!1), h = o.useRef(null), g = o.useRef(!1), _ = o.useRef(null), [v, y] = C({
13
+ var w = /* @__PURE__ */ e(n(), 1), T = 5e3;
14
+ function E(e) {
15
+ let { config: t } = r(), { theme: n } = t, { options: i, events: a, defer: s = !0 } = e || {}, { scrollbars: l, overflow: u, oppositeTheme: d } = i || {}, f = o.useRef(null), p = o.useRef(null), m = o.useRef(!1), h = o.useRef(null), g = o.useRef(!1), _ = o.useRef(null), [b, x] = y({
15
16
  options: {
16
17
  update: { debounce: 0 },
17
18
  overflow: {
@@ -29,65 +30,65 @@ function D(e) {
29
30
  events: { ...a },
30
31
  defer: s
31
32
  });
32
- p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement;
33
- let b = () => {
33
+ p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement;
34
+ let S = () => {
34
35
  let e = f.current?.scrollTop, t = f.current?.scrollHeight;
35
36
  e + f.current?.clientHeight + 20 >= t ? g.current = !1 : g.current = !0;
36
- }, x = S((0, T.throttle)(() => {
37
+ }, C = v((0, w.throttle)(() => {
37
38
  f.current?.scrollTo?.({
38
39
  top: f.current?.scrollHeight,
39
40
  behavior: "smooth"
40
41
  }), p.current?.update?.();
41
- }, 100)), w = S(() => {
42
+ }, 100)), E = v(() => {
42
43
  f.current?.scrollTo?.({
43
44
  top: f.current.scrollHeight,
44
45
  behavior: "auto"
45
46
  }), p.current?.update?.();
46
- }), D = S((e) => {
47
- g.current || (e === 0 ? w() : x());
48
- }), O = S(() => {
47
+ }), D = v((e) => {
48
+ g.current || (e === 0 ? E() : C());
49
+ }), O = v(() => {
49
50
  f.current?.scrollTo?.({
50
51
  top: 0,
51
52
  behavior: "auto"
52
53
  }), p.current?.update?.();
53
54
  }), k = () => {
54
- p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement;
55
- }, A = S((e) => {
56
- b(), _.current && clearTimeout(_.current), _.current = setTimeout(() => {
55
+ p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement;
56
+ }, A = v((e) => {
57
+ S(), _.current && clearTimeout(_.current), _.current = setTimeout(() => {
57
58
  g.current = !1;
58
- }, E);
59
+ }, T);
59
60
  }), j = () => {
60
61
  h.current?.addEventListener?.("wheel", A, { passive: !0 });
61
62
  }, M = () => {
62
63
  h.current?.removeEventListener?.("wheel", A, { passive: !0 });
63
- }, N = S((e) => (p.current || e && (v(e), h.current = e, m.current = !0, p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement, j()), p.current));
64
+ }, N = v((e) => (p.current || e && (b(e), h.current = e, m.current = !0, p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement, j()), p.current));
64
65
  return c(() => () => {
65
66
  p.current?.destroy?.(), M();
66
- }, [y]), {
67
+ }, [x]), {
67
68
  initialize: N,
68
69
  instance: p,
69
70
  scrollEventElement: f,
70
71
  initialized: m.current,
71
72
  getScrollElementScrollableHeight: () => {
72
- (!p.current || !f.current) && (p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement);
73
+ (!p.current || !f.current) && (p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement);
73
74
  let e = p.current?.elements().viewport;
74
75
  return {
75
76
  scrollTop: e?.scrollTop,
76
77
  scrollHeight: e?.scrollHeight - e?.clientHeight
77
78
  };
78
79
  },
79
- getScrollElement: () => ((!p.current || !f.current) && (p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement), f),
80
+ getScrollElement: () => ((!p.current || !f.current) && (p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement), f),
80
81
  generateInstance: k,
81
82
  destroyInstance: () => {
82
83
  p.current?.destroy?.(), M(), p.current = null;
83
84
  },
84
85
  updateScrollerPosition: D,
85
86
  updateScrollerPositionToTop: O,
86
- scrollToBottom: w,
87
+ scrollToBottom: E,
87
88
  scrollToTop: O,
88
89
  scrollToTarget: (e, t = 100) => {
89
90
  if (!e) return;
90
- (!p.current || !f.current) && (p.current = y?.(), f.current = p.current?.elements()?.scrollEventElement);
91
+ (!p.current || !f.current) && (p.current = x?.(), f.current = p.current?.elements()?.scrollEventElement);
91
92
  let n = (p.current?.elements().viewport).getBoundingClientRect(), r = e.getBoundingClientRect(), i = (p.current?.state()).current?.overflowAmount?.y, a = r.top - n.top + i;
92
93
  f.current.scroll({
93
94
  y: a - t,
@@ -96,8 +97,10 @@ function D(e) {
96
97
  }
97
98
  };
98
99
  }
99
- var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHeight: t, scrollbars: n, oppositeTheme: r, style: i, styles: a, onScroll: s }) => {
100
- let c = o.useRef(null), { initialize: l } = D({ options: {
100
+ //#endregion
101
+ //#region src/lib/components/overlay-scroller/index.module.less
102
+ var D = /* @__PURE__ */ e(a(), 1), O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHeight: t, scrollbars: n, oppositeTheme: r, style: i, styles: a, onScroll: s }) => {
103
+ let c = o.useRef(null), { initialize: l } = E({ options: {
101
104
  scrollbars: n,
102
105
  oppositeTheme: r
103
106
  } });
@@ -106,7 +109,7 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
106
109
  }, []), /* @__PURE__ */ f("div", {
107
110
  ref: c,
108
111
  "data-overlayscrollbars-initialize": !0,
109
- className: (0, w.default)(O.wrapper, "overlay-scroller-wrapper"),
112
+ className: (0, D.default)(O.wrapper, "overlay-scroller-wrapper"),
110
113
  hidden: !1,
111
114
  onWheel: s,
112
115
  style: {
@@ -118,7 +121,7 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
118
121
  });
119
122
  }, A = ({ children: e, maxHeight: t, title: n, toolTipProps: r, scrollbars: i, oppositeTheme: a }) => {
120
123
  let { styles: o, ...s } = r || {}, c = typeof o == "function" ? void 0 : o;
121
- return /* @__PURE__ */ f(y, {
124
+ return /* @__PURE__ */ f(g, {
122
125
  styles: {
123
126
  ...c,
124
127
  container: {
@@ -138,64 +141,64 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
138
141
  ...s,
139
142
  children: e
140
143
  });
141
- }, j = x(v)`
144
+ }, j = C(h)`
142
145
  margin: 0;
143
146
  &.tag-filled {
144
147
  border: none;
145
148
  background-color: var(--ant-color-fill-secondary);
146
149
  }
147
- `, M = ({ children: e, maxWidth: t = "100%", minWidth: n, ghost: r = !1, title: i, showTitle: a = !1, tooltipProps: o, radius: p = 12, filled: m = !1, ...g }) => {
148
- let _ = u(null), [v, y] = d(!1), b = u(null), x = s(() => {
149
- if (_.current) {
150
- let { scrollWidth: e, clientWidth: t } = _.current;
151
- y(e > t);
150
+ `, M = ({ children: e, maxWidth: t = "100%", minWidth: n, ghost: r = !1, title: i, showTitle: a = !1, tooltipProps: o, radius: p = 12, filled: m = !1, ...h }) => {
151
+ let g = u(null), [_, v] = d(!1), y = u(null), b = s(() => {
152
+ if (g.current) {
153
+ let { scrollWidth: e, clientWidth: t } = g.current;
154
+ v(e > t);
152
155
  }
153
- }, [_.current]);
156
+ }, [g.current]);
154
157
  c(() => {
155
- let e = _.current;
156
- if (e) return b.current?.disconnect(), b.current = new ResizeObserver(() => {
157
- x();
158
- }), b.current?.observe(e), x(), () => {
159
- b.current?.disconnect(), b.current = null;
160
- };
161
- }, [x]), c(() => {
162
- let e = (0, T.throttle)(x, 200);
158
+ let e = g.current;
159
+ if (e) return y.current?.disconnect(), y.current = new ResizeObserver(() => {
160
+ b();
161
+ }), y.current?.observe(e), b(), () => {
162
+ y.current?.disconnect(), y.current = null;
163
+ };
164
+ }, [b]), c(() => {
165
+ let e = (0, w.throttle)(b, 200);
163
166
  return window.addEventListener("resize", e), () => {
164
167
  window.removeEventListener("resize", e), e.cancel();
165
168
  };
166
- }, [x]), c(() => {
167
- x();
168
- }, [e, x]);
169
+ }, [b]), c(() => {
170
+ b();
171
+ }, [e, b]);
169
172
  let S = l(() => ({
170
173
  maxWidth: t,
171
174
  minWidth: n,
172
175
  overflow: "hidden",
173
176
  textOverflow: "ellipsis",
174
177
  whiteSpace: "nowrap",
175
- ...g.style
176
- }), [t, g.style]);
178
+ ...h.style
179
+ }), [t, h.style]);
177
180
  return /* @__PURE__ */ f(A, {
178
181
  toolTipProps: {
179
182
  ...o,
180
183
  destroyOnHidden: !1
181
184
  },
182
- title: v || a ? i || e : !1,
185
+ title: _ || a ? i || e : !1,
183
186
  children: r ? /* @__PURE__ */ f("div", {
184
- ref: _,
187
+ ref: g,
185
188
  style: S,
186
- "data-overflow": v,
189
+ "data-overflow": _,
187
190
  children: e
188
191
  }) : /* @__PURE__ */ f(j, {
189
- ...g,
192
+ ...h,
190
193
  variant: "outlined",
191
- className: `${g.className || ""} ${m ? "tag-filled" : ""}`,
192
- ref: _,
194
+ className: `${h.className || ""} ${m ? "tag-filled" : ""}`,
195
+ ref: g,
193
196
  style: {
194
- paddingInline: g.closable ? "8px 22px" : 8,
197
+ paddingInline: h.closable ? "8px 22px" : 8,
195
198
  borderRadius: p,
196
199
  ...S
197
200
  },
198
- closeIcon: g.closable ? /* @__PURE__ */ f(h, { style: {
201
+ closeIcon: h.closable ? /* @__PURE__ */ f(x, { style: {
199
202
  position: "absolute",
200
203
  right: 8,
201
204
  top: "50%",
@@ -204,8 +207,8 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
204
207
  children: e
205
208
  })
206
209
  });
207
- }, N = ({ children: e, tips: t, text: n, type: r = "text", shape: a = "default", fontSize: o = "14px", style: s, btnStyle: h, placement: v, size: x = "small" }) => {
208
- let S = i(), [C, w] = d(!1), T = u(), E = () => {
210
+ }, N = ({ children: e, tips: t, text: n, type: r = "text", shape: a = "default", fontSize: o = "14px", style: s, btnStyle: h, placement: v, size: y = "small" }) => {
211
+ let x = i(), [C, w] = d(!1), T = u(), E = () => {
209
212
  window.clearTimeout(T.current), T.current = window.setTimeout(() => {
210
213
  w(!1);
211
214
  }, 3e3);
@@ -243,11 +246,11 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
243
246
  w(!0);
244
247
  return;
245
248
  }
246
- b.error(S.formatMessage({ id: "common.copy.fail" }));
247
- }, A = l(() => C ? S.formatMessage({ id: "common.button.copied" }) : t ?? S.formatMessage({ id: "common.button.copy" }), [
249
+ _.error(x.formatMessage({ id: "common.copy.fail" }));
250
+ }, A = l(() => C ? x.formatMessage({ id: "common.button.copied" }) : t ?? x.formatMessage({ id: "common.button.copy" }), [
248
251
  C,
249
252
  t,
250
- S
253
+ x
251
254
  ]);
252
255
  return c(() => (E(), () => {
253
256
  window.clearTimeout(T.current);
@@ -258,20 +261,20 @@ var O = { wrapper: "index-module__wrapper___AP3Au" }, k = ({ children: e, maxHei
258
261
  minWidth: 20,
259
262
  ghost: !0,
260
263
  children: e
261
- }), /* @__PURE__ */ f(y, {
264
+ }), /* @__PURE__ */ f(g, {
262
265
  title: A,
263
266
  placement: v,
264
- children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(_, {
267
+ children: /* @__PURE__ */ f("span", { children: /* @__PURE__ */ f(m, {
265
268
  className: "copy-button",
266
269
  type: r,
267
270
  shape: a,
268
- size: x,
271
+ size: y,
269
272
  onClick: k,
270
273
  style: { ...h },
271
- icon: C ? /* @__PURE__ */ f(m, { style: {
274
+ icon: C ? /* @__PURE__ */ f(b, { style: {
272
275
  color: "var(--ant-color-success)",
273
276
  fontSize: o
274
- } }) : /* @__PURE__ */ f(g, { style: {
277
+ } }) : /* @__PURE__ */ f(S, { style: {
275
278
  fontSize: o,
276
279
  ...s
277
280
  } })
@@ -19038,7 +19041,7 @@ function pr(e) {
19038
19041
  }
19039
19042
  //#endregion
19040
19043
  //#region src/lib/components/highlight-code/code-viewer.tsx
19041
- var mr = x.div`
19044
+ var mr = C.div`
19042
19045
  display: flex;
19043
19046
  justify-content: space-between;
19044
19047
  align-items: center;
@@ -19053,7 +19056,7 @@ var mr = x.div`
19053
19056
  background-color: var(--color-editor-header-bg);
19054
19057
  color: rgba(255, 255, 255, 0.65);
19055
19058
  }
19056
- `, hr = x.div`
19059
+ `, hr = C.div`
19057
19060
  border-radius: var(--border-radius-mini);
19058
19061
  &:hover {
19059
19062
  .custome-scrollbar {
@@ -19064,7 +19067,7 @@ var mr = x.div`
19064
19067
  }
19065
19068
  }
19066
19069
  `, gr = ({ copyValue: e, lang: t, theme: n, copyable: r }) => r ? /* @__PURE__ */ p(mr, {
19067
- className: (0, w.default)({
19070
+ className: (0, D.default)({
19068
19071
  dark: n === "dark",
19069
19072
  light: n === "light"
19070
19073
  }),
@@ -19103,7 +19106,7 @@ var mr = x.div`
19103
19106
  copyable: o,
19104
19107
  theme: e.theme || "light"
19105
19108
  }), /* @__PURE__ */ f("pre", {
19106
- className: (0, w.default)("code-pre custome-scrollbar custom-scrollbar-horizontal ", {
19109
+ className: (0, D.default)("code-pre custome-scrollbar custom-scrollbar-horizontal ", {
19107
19110
  dark: e.theme === "dark",
19108
19111
  light: e.theme === "light",
19109
19112
  "x-scrollable": u
@@ -19118,7 +19121,7 @@ var mr = x.div`
19118
19121
  minHeight: s,
19119
19122
  ...u ? { width: "max-content" } : {}
19120
19123
  },
19121
- className: (0, w.default)(d.className, {
19124
+ className: (0, D.default)(d.className, {
19122
19125
  dark: e.theme === "dark",
19123
19126
  light: e.theme === "light"
19124
19127
  }),
@@ -19177,4 +19180,4 @@ var mr = x.div`
19177
19180
  });
19178
19181
  };
19179
19182
  //#endregion
19180
- export { A as a, k as i, N as n, D as o, M as r, br as t };
19183
+ export { A as a, k as i, N as n, E as o, M as r, br as t };