@gpustack/core-ui 1.0.34 → 1.0.35
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/charts.es.js +1 -1
- package/dist/{classnames-1RsQ5HaB.js → classnames-fDEzIsab.js} +3 -11
- package/dist/{editor-wrap-DV6LD3QO.js → editor-wrap-CwTlkQeF.js} +1 -1
- package/dist/{excel-reader-Dm-T5v37.js → excel-reader-fp4wfcR5.js} +2 -2
- package/dist/excel.es.js +1 -1
- package/dist/file-readers.es.js +2 -2
- package/dist/{highlight-code-DFrfrxgM.js → highlight-code-D8pDWkNV.js} +2 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +1606 -9438
- package/dist/lib/components/index.d.ts +0 -2
- package/dist/lib-pzRljAkJ.js +2 -0
- package/dist/{mammoth-D6zSLJGM.js → mammoth-CCaoEfUd.js} +1 -1
- package/dist/markdown.es.js +1 -1
- package/dist/query-string-D_RrDOJF.js +325 -0
- package/dist/resize-panel-D5BF2EHO.js +529 -0
- package/dist/terminal.d.ts +5 -0
- package/dist/terminal.es.js +7333 -0
- package/dist/useIntl-CBh5liUu.js +12 -0
- package/dist/{utils-B4OCyMbr.js → utils-CHekcXoK.js} +256 -578
- package/dist/utils.es.js +3 -3
- package/dist/{word-reader-DZfu7nOd.js → word-reader-Dy0F38kq.js} +4 -4
- package/dist/yaml-editor.es.js +2 -2
- package/package.json +5 -1
- package/dist/lib-BIUIGY5e.js +0 -2
- /package/dist/{epubjs-DDuu_UAH.js → epubjs-CCPXKy-j.js} +0 -0
- /package/dist/{jszip-CYj7myrF.js → jszip-D49X9-jp.js} +0 -0
- /package/dist/{pdfjs-dist-CHJ4PZaN.js → pdfjs-dist-D4wgLSOe.js} +0 -0
- /package/dist/{xlsx-CkHo9SHP.js → xlsx-C7SIkCvo.js} +0 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { t as e } from "./useIntl-CBh5liUu.js";
|
|
2
|
+
import { PureComponent as t, forwardRef as n, memo as r, useCallback as i, useImperativeHandle as a, useMemo as o, useRef as s } from "react";
|
|
3
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
import { Button as u } from "antd";
|
|
5
|
+
import "@ant-design/icons";
|
|
6
|
+
import d from "styled-components";
|
|
7
|
+
import { flushSync as f } from "react-dom";
|
|
8
|
+
//#region node_modules/.pnpm/re-resizable@6.11.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/re-resizable/lib/resizer.js
|
|
9
|
+
var p = function() {
|
|
10
|
+
return p = Object.assign || function(e) {
|
|
11
|
+
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
12
|
+
return e;
|
|
13
|
+
}, p.apply(this, arguments);
|
|
14
|
+
}, m = {
|
|
15
|
+
width: "100%",
|
|
16
|
+
height: "10px",
|
|
17
|
+
top: "0px",
|
|
18
|
+
left: "0px",
|
|
19
|
+
cursor: "row-resize"
|
|
20
|
+
}, h = {
|
|
21
|
+
width: "10px",
|
|
22
|
+
height: "100%",
|
|
23
|
+
top: "0px",
|
|
24
|
+
left: "0px",
|
|
25
|
+
cursor: "col-resize"
|
|
26
|
+
}, g = {
|
|
27
|
+
width: "20px",
|
|
28
|
+
height: "20px",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
zIndex: 1
|
|
31
|
+
}, _ = {
|
|
32
|
+
top: p(p({}, m), { top: "-5px" }),
|
|
33
|
+
right: p(p({}, h), {
|
|
34
|
+
left: void 0,
|
|
35
|
+
right: "-5px"
|
|
36
|
+
}),
|
|
37
|
+
bottom: p(p({}, m), {
|
|
38
|
+
top: void 0,
|
|
39
|
+
bottom: "-5px"
|
|
40
|
+
}),
|
|
41
|
+
left: p(p({}, h), { left: "-5px" }),
|
|
42
|
+
topRight: p(p({}, g), {
|
|
43
|
+
right: "-10px",
|
|
44
|
+
top: "-10px",
|
|
45
|
+
cursor: "ne-resize"
|
|
46
|
+
}),
|
|
47
|
+
bottomRight: p(p({}, g), {
|
|
48
|
+
right: "-10px",
|
|
49
|
+
bottom: "-10px",
|
|
50
|
+
cursor: "se-resize"
|
|
51
|
+
}),
|
|
52
|
+
bottomLeft: p(p({}, g), {
|
|
53
|
+
left: "-10px",
|
|
54
|
+
bottom: "-10px",
|
|
55
|
+
cursor: "sw-resize"
|
|
56
|
+
}),
|
|
57
|
+
topLeft: p(p({}, g), {
|
|
58
|
+
left: "-10px",
|
|
59
|
+
top: "-10px",
|
|
60
|
+
cursor: "nw-resize"
|
|
61
|
+
})
|
|
62
|
+
}, v = r(function(e) {
|
|
63
|
+
var t = e.onResizeStart, n = e.direction, r = e.children, a = e.replaceStyles, s = e.className, l = i(function(e) {
|
|
64
|
+
t(e, n);
|
|
65
|
+
}, [t, n]), u = i(function(e) {
|
|
66
|
+
t(e, n);
|
|
67
|
+
}, [t, n]), d = o(function() {
|
|
68
|
+
return p(p({
|
|
69
|
+
position: "absolute",
|
|
70
|
+
userSelect: "none"
|
|
71
|
+
}, _[n]), a ?? {});
|
|
72
|
+
}, [a, n]);
|
|
73
|
+
return c("div", {
|
|
74
|
+
className: s || void 0,
|
|
75
|
+
style: d,
|
|
76
|
+
onMouseDown: l,
|
|
77
|
+
onTouchStart: u,
|
|
78
|
+
children: r
|
|
79
|
+
});
|
|
80
|
+
}), y = (function() {
|
|
81
|
+
var e = function(t, n) {
|
|
82
|
+
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
83
|
+
e.__proto__ = t;
|
|
84
|
+
} || function(e, t) {
|
|
85
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
86
|
+
}, e(t, n);
|
|
87
|
+
};
|
|
88
|
+
return function(t, n) {
|
|
89
|
+
if (typeof n != "function" && n !== null) throw TypeError("Class extends value " + String(n) + " is not a constructor or null");
|
|
90
|
+
e(t, n);
|
|
91
|
+
function r() {
|
|
92
|
+
this.constructor = t;
|
|
93
|
+
}
|
|
94
|
+
t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
|
|
95
|
+
};
|
|
96
|
+
})(), b = function() {
|
|
97
|
+
return b = Object.assign || function(e) {
|
|
98
|
+
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
99
|
+
return e;
|
|
100
|
+
}, b.apply(this, arguments);
|
|
101
|
+
}, x = {
|
|
102
|
+
width: "auto",
|
|
103
|
+
height: "auto"
|
|
104
|
+
}, S = function(e, t, n) {
|
|
105
|
+
return Math.max(Math.min(e, n), t);
|
|
106
|
+
}, C = function(e, t, n) {
|
|
107
|
+
var r = Math.round(e / t);
|
|
108
|
+
return r * t + n * (r - 1);
|
|
109
|
+
}, w = function(e, t) {
|
|
110
|
+
return new RegExp(e, "i").test(t);
|
|
111
|
+
}, T = function(e) {
|
|
112
|
+
return !!(e.touches && e.touches.length);
|
|
113
|
+
}, E = function(e) {
|
|
114
|
+
return !!((e.clientX || e.clientX === 0) && (e.clientY || e.clientY === 0));
|
|
115
|
+
}, D = function(e, t, n) {
|
|
116
|
+
n === void 0 && (n = 0);
|
|
117
|
+
var r = t.reduce(function(n, r, i) {
|
|
118
|
+
return Math.abs(r - e) < Math.abs(t[n] - e) ? i : n;
|
|
119
|
+
}, 0), i = Math.abs(t[r] - e);
|
|
120
|
+
return n === 0 || i < n ? t[r] : e;
|
|
121
|
+
}, O = function(e) {
|
|
122
|
+
return e = e.toString(), e === "auto" || e.endsWith("px") || e.endsWith("%") || e.endsWith("vh") || e.endsWith("vw") || e.endsWith("vmax") || e.endsWith("vmin") ? e : `${e}px`;
|
|
123
|
+
}, k = function(e, t, n, r) {
|
|
124
|
+
if (e && typeof e == "string") {
|
|
125
|
+
if (e.endsWith("px")) return Number(e.replace("px", ""));
|
|
126
|
+
if (e.endsWith("%")) {
|
|
127
|
+
var i = Number(e.replace("%", "")) / 100;
|
|
128
|
+
return t * i;
|
|
129
|
+
}
|
|
130
|
+
if (e.endsWith("vw")) {
|
|
131
|
+
var i = Number(e.replace("vw", "")) / 100;
|
|
132
|
+
return n * i;
|
|
133
|
+
}
|
|
134
|
+
if (e.endsWith("vh")) {
|
|
135
|
+
var i = Number(e.replace("vh", "")) / 100;
|
|
136
|
+
return r * i;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return e;
|
|
140
|
+
}, A = function(e, t, n, r, i, a, o) {
|
|
141
|
+
return r = k(r, e.width, t, n), i = k(i, e.height, t, n), a = k(a, e.width, t, n), o = k(o, e.height, t, n), {
|
|
142
|
+
maxWidth: r === void 0 ? void 0 : Number(r),
|
|
143
|
+
maxHeight: i === void 0 ? void 0 : Number(i),
|
|
144
|
+
minWidth: a === void 0 ? void 0 : Number(a),
|
|
145
|
+
minHeight: o === void 0 ? void 0 : Number(o)
|
|
146
|
+
};
|
|
147
|
+
}, j = function(e) {
|
|
148
|
+
return Array.isArray(e) ? e : [e, e];
|
|
149
|
+
}, M = /* @__PURE__ */ "as.ref.style.className.grid.gridGap.snap.bounds.boundsByDirection.size.defaultSize.minWidth.minHeight.maxWidth.maxHeight.lockAspectRatio.lockAspectRatioExtraWidth.lockAspectRatioExtraHeight.enable.handleStyles.handleClasses.handleWrapperStyle.handleWrapperClass.children.onResizeStart.onResize.onResizeStop.handleComponent.scale.resizeRatio.snapGap".split("."), N = "__resizable_base__", P = function(e) {
|
|
150
|
+
y(t, e);
|
|
151
|
+
function t(t) {
|
|
152
|
+
var n = e.call(this, t) || this;
|
|
153
|
+
return n.ratio = 1, n.resizable = null, n.parentLeft = 0, n.parentTop = 0, n.resizableLeft = 0, n.resizableRight = 0, n.resizableTop = 0, n.resizableBottom = 0, n.targetLeft = 0, n.targetTop = 0, n.delta = {
|
|
154
|
+
width: 0,
|
|
155
|
+
height: 0
|
|
156
|
+
}, n.appendBase = function() {
|
|
157
|
+
if (!n.resizable || !n.window) return null;
|
|
158
|
+
var e = n.parentNode;
|
|
159
|
+
if (!e) return null;
|
|
160
|
+
var t = n.window.document.createElement("div");
|
|
161
|
+
return t.style.width = "100%", t.style.height = "100%", t.style.position = "absolute", t.style.transform = "scale(0, 0)", t.style.left = "0", t.style.flex = "0 0 100%", t.classList ? t.classList.add(N) : t.className += N, e.appendChild(t), t;
|
|
162
|
+
}, n.removeBase = function(e) {
|
|
163
|
+
var t = n.parentNode;
|
|
164
|
+
t && t.removeChild(e);
|
|
165
|
+
}, n.state = {
|
|
166
|
+
isResizing: !1,
|
|
167
|
+
width: n.propsSize?.width ?? "auto",
|
|
168
|
+
height: n.propsSize?.height ?? "auto",
|
|
169
|
+
direction: "right",
|
|
170
|
+
original: {
|
|
171
|
+
x: 0,
|
|
172
|
+
y: 0,
|
|
173
|
+
width: 0,
|
|
174
|
+
height: 0
|
|
175
|
+
},
|
|
176
|
+
backgroundStyle: {
|
|
177
|
+
height: "100%",
|
|
178
|
+
width: "100%",
|
|
179
|
+
backgroundColor: "rgba(0,0,0,0)",
|
|
180
|
+
cursor: "auto",
|
|
181
|
+
opacity: 0,
|
|
182
|
+
position: "fixed",
|
|
183
|
+
zIndex: 9999,
|
|
184
|
+
top: "0",
|
|
185
|
+
left: "0",
|
|
186
|
+
bottom: "0",
|
|
187
|
+
right: "0"
|
|
188
|
+
},
|
|
189
|
+
flexBasis: void 0
|
|
190
|
+
}, n.onResizeStart = n.onResizeStart.bind(n), n.onMouseMove = n.onMouseMove.bind(n), n.onMouseUp = n.onMouseUp.bind(n), n;
|
|
191
|
+
}
|
|
192
|
+
return Object.defineProperty(t.prototype, "parentNode", {
|
|
193
|
+
get: function() {
|
|
194
|
+
return this.resizable ? this.resizable.parentNode : null;
|
|
195
|
+
},
|
|
196
|
+
enumerable: !1,
|
|
197
|
+
configurable: !0
|
|
198
|
+
}), Object.defineProperty(t.prototype, "window", {
|
|
199
|
+
get: function() {
|
|
200
|
+
return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView;
|
|
201
|
+
},
|
|
202
|
+
enumerable: !1,
|
|
203
|
+
configurable: !0
|
|
204
|
+
}), Object.defineProperty(t.prototype, "propsSize", {
|
|
205
|
+
get: function() {
|
|
206
|
+
return this.props.size || this.props.defaultSize || x;
|
|
207
|
+
},
|
|
208
|
+
enumerable: !1,
|
|
209
|
+
configurable: !0
|
|
210
|
+
}), Object.defineProperty(t.prototype, "size", {
|
|
211
|
+
get: function() {
|
|
212
|
+
var e = 0, t = 0;
|
|
213
|
+
if (this.resizable && this.window) {
|
|
214
|
+
var n = this.resizable.offsetWidth, r = this.resizable.offsetHeight, i = this.resizable.style.position;
|
|
215
|
+
i !== "relative" && (this.resizable.style.position = "relative"), e = this.resizable.style.width === "auto" ? n : this.resizable.offsetWidth, t = this.resizable.style.height === "auto" ? r : this.resizable.offsetHeight, this.resizable.style.position = i;
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
width: e,
|
|
219
|
+
height: t
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
enumerable: !1,
|
|
223
|
+
configurable: !0
|
|
224
|
+
}), Object.defineProperty(t.prototype, "sizeStyle", {
|
|
225
|
+
get: function() {
|
|
226
|
+
var e = this, t = this.props.size, n = function(t) {
|
|
227
|
+
if (e.state[t] === void 0 || e.state[t] === "auto") return "auto";
|
|
228
|
+
if (e.propsSize && e.propsSize[t] && e.propsSize[t]?.toString().endsWith("%")) {
|
|
229
|
+
if (e.state[t].toString().endsWith("%")) return e.state[t].toString();
|
|
230
|
+
var n = e.getParentSize();
|
|
231
|
+
return `${Number(e.state[t].toString().replace("px", "")) / n[t] * 100}%`;
|
|
232
|
+
}
|
|
233
|
+
return O(e.state[t]);
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
width: t && t.width !== void 0 && !this.state.isResizing ? O(t.width) : n("width"),
|
|
237
|
+
height: t && t.height !== void 0 && !this.state.isResizing ? O(t.height) : n("height")
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
enumerable: !1,
|
|
241
|
+
configurable: !0
|
|
242
|
+
}), t.prototype.getParentSize = function() {
|
|
243
|
+
if (!this.parentNode) return this.window ? {
|
|
244
|
+
width: this.window.innerWidth,
|
|
245
|
+
height: this.window.innerHeight
|
|
246
|
+
} : {
|
|
247
|
+
width: 0,
|
|
248
|
+
height: 0
|
|
249
|
+
};
|
|
250
|
+
var e = this.appendBase();
|
|
251
|
+
if (!e) return {
|
|
252
|
+
width: 0,
|
|
253
|
+
height: 0
|
|
254
|
+
};
|
|
255
|
+
var t = !1, n = this.parentNode.style.flexWrap;
|
|
256
|
+
n !== "wrap" && (t = !0, this.parentNode.style.flexWrap = "wrap"), e.style.position = "relative", e.style.minWidth = "100%", e.style.minHeight = "100%";
|
|
257
|
+
var r = {
|
|
258
|
+
width: e.offsetWidth,
|
|
259
|
+
height: e.offsetHeight
|
|
260
|
+
};
|
|
261
|
+
return t && (this.parentNode.style.flexWrap = n), this.removeBase(e), r;
|
|
262
|
+
}, t.prototype.bindEvents = function() {
|
|
263
|
+
this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, {
|
|
264
|
+
capture: !0,
|
|
265
|
+
passive: !1
|
|
266
|
+
}), this.window.addEventListener("touchend", this.onMouseUp));
|
|
267
|
+
}, t.prototype.unbindEvents = function() {
|
|
268
|
+
this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp));
|
|
269
|
+
}, t.prototype.componentDidMount = function() {
|
|
270
|
+
if (!(!this.resizable || !this.window)) {
|
|
271
|
+
var e = this.window.getComputedStyle(this.resizable);
|
|
272
|
+
this.setState({
|
|
273
|
+
width: this.state.width || this.size.width,
|
|
274
|
+
height: this.state.height || this.size.height,
|
|
275
|
+
flexBasis: e.flexBasis === "auto" ? void 0 : e.flexBasis
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}, t.prototype.componentWillUnmount = function() {
|
|
279
|
+
this.window && this.unbindEvents();
|
|
280
|
+
}, t.prototype.createSizeForCssProperty = function(e, t) {
|
|
281
|
+
var n = this.propsSize && this.propsSize[t];
|
|
282
|
+
return this.state[t] === "auto" && this.state.original[t] === e && (n === void 0 || n === "auto") ? "auto" : e;
|
|
283
|
+
}, t.prototype.calculateNewMaxFromBoundary = function(e, t) {
|
|
284
|
+
var n = this.props.boundsByDirection, r = this.state.direction, i = n && w("left", r), a = n && w("top", r), o, s;
|
|
285
|
+
if (this.props.bounds === "parent") {
|
|
286
|
+
var c = this.parentNode;
|
|
287
|
+
c && (o = i ? this.resizableRight - this.parentLeft : c.offsetWidth + (this.parentLeft - this.resizableLeft), s = a ? this.resizableBottom - this.parentTop : c.offsetHeight + (this.parentTop - this.resizableTop));
|
|
288
|
+
} else this.props.bounds === "window" ? this.window && (o = i ? this.resizableRight : this.window.innerWidth - this.resizableLeft, s = a ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (o = i ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), s = a ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop));
|
|
289
|
+
return o && Number.isFinite(o) && (e = e && e < o ? e : o), s && Number.isFinite(s) && (t = t && t < s ? t : s), {
|
|
290
|
+
maxWidth: e,
|
|
291
|
+
maxHeight: t
|
|
292
|
+
};
|
|
293
|
+
}, t.prototype.calculateNewSizeFromDirection = function(e, t) {
|
|
294
|
+
var n = this.props.scale || 1, r = j(this.props.resizeRatio || 1), i = r[0], a = r[1], o = this.state, s = o.direction, c = o.original, l = this.props, u = l.lockAspectRatio, d = l.lockAspectRatioExtraHeight, f = l.lockAspectRatioExtraWidth, p = c.width, m = c.height, h = d || 0, g = f || 0;
|
|
295
|
+
return w("right", s) && (p = c.width + (e - c.x) * i / n, u && (m = (p - g) / this.ratio + h)), w("left", s) && (p = c.width - (e - c.x) * i / n, u && (m = (p - g) / this.ratio + h)), w("bottom", s) && (m = c.height + (t - c.y) * a / n, u && (p = (m - h) * this.ratio + g)), w("top", s) && (m = c.height - (t - c.y) * a / n, u && (p = (m - h) * this.ratio + g)), {
|
|
296
|
+
newWidth: p,
|
|
297
|
+
newHeight: m
|
|
298
|
+
};
|
|
299
|
+
}, t.prototype.calculateNewSizeFromAspectRatio = function(e, t, n, r) {
|
|
300
|
+
var i = this.props, a = i.lockAspectRatio, o = i.lockAspectRatioExtraHeight, s = i.lockAspectRatioExtraWidth, c = r.width === void 0 ? 10 : r.width, l = n.width === void 0 || n.width < 0 ? e : n.width, u = r.height === void 0 ? 10 : r.height, d = n.height === void 0 || n.height < 0 ? t : n.height, f = o || 0, p = s || 0;
|
|
301
|
+
if (a) {
|
|
302
|
+
var m = (u - f) * this.ratio + p, h = (d - f) * this.ratio + p, g = (c - p) / this.ratio + f, _ = (l - p) / this.ratio + f, v = Math.max(c, m), y = Math.min(l, h), b = Math.max(u, g), x = Math.min(d, _);
|
|
303
|
+
e = S(e, v, y), t = S(t, b, x);
|
|
304
|
+
} else e = S(e, c, l), t = S(t, u, d);
|
|
305
|
+
return {
|
|
306
|
+
newWidth: e,
|
|
307
|
+
newHeight: t
|
|
308
|
+
};
|
|
309
|
+
}, t.prototype.setBoundingClientRect = function() {
|
|
310
|
+
var e = 1 / (this.props.scale || 1);
|
|
311
|
+
if (this.props.bounds === "parent") {
|
|
312
|
+
var t = this.parentNode;
|
|
313
|
+
if (t) {
|
|
314
|
+
var n = t.getBoundingClientRect();
|
|
315
|
+
this.parentLeft = n.left * e, this.parentTop = n.top * e;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (this.props.bounds && typeof this.props.bounds != "string") {
|
|
319
|
+
var r = this.props.bounds.getBoundingClientRect();
|
|
320
|
+
this.targetLeft = r.left * e, this.targetTop = r.top * e;
|
|
321
|
+
}
|
|
322
|
+
if (this.resizable) {
|
|
323
|
+
var i = this.resizable.getBoundingClientRect(), a = i.left, o = i.top, s = i.right, c = i.bottom;
|
|
324
|
+
this.resizableLeft = a * e, this.resizableRight = s * e, this.resizableTop = o * e, this.resizableBottom = c * e;
|
|
325
|
+
}
|
|
326
|
+
}, t.prototype.onResizeStart = function(e, t) {
|
|
327
|
+
if (!(!this.resizable || !this.window)) {
|
|
328
|
+
var n = 0, r = 0;
|
|
329
|
+
if (e.nativeEvent && E(e.nativeEvent) ? (n = e.nativeEvent.clientX, r = e.nativeEvent.clientY) : e.nativeEvent && T(e.nativeEvent) && (n = e.nativeEvent.touches[0].clientX, r = e.nativeEvent.touches[0].clientY), !(this.props.onResizeStart && this.resizable && this.props.onResizeStart(e, t, this.resizable) === !1)) {
|
|
330
|
+
this.props.size && (this.props.size.height !== void 0 && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), this.props.size.width !== void 0 && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
|
|
331
|
+
var i, a = this.window.getComputedStyle(this.resizable);
|
|
332
|
+
if (a.flexBasis !== "auto") {
|
|
333
|
+
var o = this.parentNode;
|
|
334
|
+
o && (this.flexDir = this.window.getComputedStyle(o).flexDirection.startsWith("row") ? "row" : "column", i = a.flexBasis);
|
|
335
|
+
}
|
|
336
|
+
this.setBoundingClientRect(), this.bindEvents();
|
|
337
|
+
var s = {
|
|
338
|
+
original: {
|
|
339
|
+
x: n,
|
|
340
|
+
y: r,
|
|
341
|
+
width: this.size.width,
|
|
342
|
+
height: this.size.height
|
|
343
|
+
},
|
|
344
|
+
isResizing: !0,
|
|
345
|
+
backgroundStyle: b(b({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(e.target).cursor || "auto" }),
|
|
346
|
+
direction: t,
|
|
347
|
+
flexBasis: i
|
|
348
|
+
};
|
|
349
|
+
this.setState(s);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}, t.prototype.onMouseMove = function(e) {
|
|
353
|
+
var t = this;
|
|
354
|
+
if (!(!this.state.isResizing || !this.resizable || !this.window)) {
|
|
355
|
+
if (this.window.TouchEvent && T(e)) try {
|
|
356
|
+
e.preventDefault(), e.stopPropagation();
|
|
357
|
+
} catch {}
|
|
358
|
+
var n = this.props, r = n.maxWidth, i = n.maxHeight, a = n.minWidth, o = n.minHeight, s = T(e) ? e.touches[0].clientX : e.clientX, c = T(e) ? e.touches[0].clientY : e.clientY, l = this.state, u = l.direction, d = l.original, p = l.width, m = l.height, h = this.getParentSize(), g = A(h, this.window.innerWidth, this.window.innerHeight, r, i, a, o);
|
|
359
|
+
r = g.maxWidth, i = g.maxHeight, a = g.minWidth, o = g.minHeight;
|
|
360
|
+
var _ = this.calculateNewSizeFromDirection(s, c), v = _.newHeight, y = _.newWidth, b = this.calculateNewMaxFromBoundary(r, i);
|
|
361
|
+
this.props.snap && this.props.snap.x && (y = D(y, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (v = D(v, this.props.snap.y, this.props.snapGap));
|
|
362
|
+
var x = this.calculateNewSizeFromAspectRatio(y, v, {
|
|
363
|
+
width: b.maxWidth,
|
|
364
|
+
height: b.maxHeight
|
|
365
|
+
}, {
|
|
366
|
+
width: a,
|
|
367
|
+
height: o
|
|
368
|
+
});
|
|
369
|
+
if (y = x.newWidth, v = x.newHeight, this.props.grid) {
|
|
370
|
+
var S = C(y, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), w = C(v, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), E = this.props.snapGap || 0, O = E === 0 || Math.abs(S - y) <= E ? S : y, k = E === 0 || Math.abs(w - v) <= E ? w : v;
|
|
371
|
+
y = O, v = k;
|
|
372
|
+
}
|
|
373
|
+
var j = {
|
|
374
|
+
width: y - d.width,
|
|
375
|
+
height: v - d.height
|
|
376
|
+
};
|
|
377
|
+
if (this.delta = j, p && typeof p == "string") {
|
|
378
|
+
if (p.endsWith("%")) {
|
|
379
|
+
var M = y / h.width * 100;
|
|
380
|
+
y = `${M}%`;
|
|
381
|
+
} else if (p.endsWith("vw")) {
|
|
382
|
+
var N = y / this.window.innerWidth * 100;
|
|
383
|
+
y = `${N}vw`;
|
|
384
|
+
} else if (p.endsWith("vh")) {
|
|
385
|
+
var P = y / this.window.innerHeight * 100;
|
|
386
|
+
y = `${P}vh`;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (m && typeof m == "string") {
|
|
390
|
+
if (m.endsWith("%")) {
|
|
391
|
+
var M = v / h.height * 100;
|
|
392
|
+
v = `${M}%`;
|
|
393
|
+
} else if (m.endsWith("vw")) {
|
|
394
|
+
var N = v / this.window.innerWidth * 100;
|
|
395
|
+
v = `${N}vw`;
|
|
396
|
+
} else if (m.endsWith("vh")) {
|
|
397
|
+
var P = v / this.window.innerHeight * 100;
|
|
398
|
+
v = `${P}vh`;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
var F = {
|
|
402
|
+
width: this.createSizeForCssProperty(y, "width"),
|
|
403
|
+
height: this.createSizeForCssProperty(v, "height")
|
|
404
|
+
};
|
|
405
|
+
this.flexDir === "row" ? F.flexBasis = F.width : this.flexDir === "column" && (F.flexBasis = F.height);
|
|
406
|
+
var I = this.state.width !== F.width, L = this.state.height !== F.height, R = this.state.flexBasis !== F.flexBasis, z = I || L || R;
|
|
407
|
+
z && f(function() {
|
|
408
|
+
t.setState(F);
|
|
409
|
+
}), this.props.onResize && z && this.props.onResize(e, u, this.resizable, j);
|
|
410
|
+
}
|
|
411
|
+
}, t.prototype.onMouseUp = function(e) {
|
|
412
|
+
var t = this.state, n = t.isResizing, r = t.direction;
|
|
413
|
+
t.original, !(!n || !this.resizable) && (this.props.onResizeStop && this.props.onResizeStop(e, r, this.resizable, this.delta), this.props.size && this.setState({
|
|
414
|
+
width: this.props.size.width ?? "auto",
|
|
415
|
+
height: this.props.size.height ?? "auto"
|
|
416
|
+
}), this.unbindEvents(), this.setState({
|
|
417
|
+
isResizing: !1,
|
|
418
|
+
backgroundStyle: b(b({}, this.state.backgroundStyle), { cursor: "auto" })
|
|
419
|
+
}));
|
|
420
|
+
}, t.prototype.updateSize = function(e) {
|
|
421
|
+
this.setState({
|
|
422
|
+
width: e.width ?? "auto",
|
|
423
|
+
height: e.height ?? "auto"
|
|
424
|
+
});
|
|
425
|
+
}, t.prototype.renderResizer = function() {
|
|
426
|
+
var e = this, t = this.props, n = t.enable, r = t.handleStyles, i = t.handleClasses, a = t.handleWrapperStyle, o = t.handleWrapperClass, s = t.handleComponent;
|
|
427
|
+
return n ? c("div", {
|
|
428
|
+
className: o,
|
|
429
|
+
style: a,
|
|
430
|
+
children: Object.keys(n).map(function(t) {
|
|
431
|
+
return n[t] === !1 ? null : c(v, {
|
|
432
|
+
direction: t,
|
|
433
|
+
onResizeStart: e.onResizeStart,
|
|
434
|
+
replaceStyles: r && r[t],
|
|
435
|
+
className: i && i[t],
|
|
436
|
+
children: s && s[t] ? s[t] : null
|
|
437
|
+
}, t);
|
|
438
|
+
})
|
|
439
|
+
}) : null;
|
|
440
|
+
}, t.prototype.render = function() {
|
|
441
|
+
var e = this, t = Object.keys(this.props).reduce(function(t, n) {
|
|
442
|
+
return M.indexOf(n) === -1 && (t[n] = e.props[n]), t;
|
|
443
|
+
}, {}), n = b(b(b({
|
|
444
|
+
position: "relative",
|
|
445
|
+
userSelect: this.state.isResizing ? "none" : "auto"
|
|
446
|
+
}, this.props.style), this.sizeStyle), {
|
|
447
|
+
maxWidth: this.props.maxWidth,
|
|
448
|
+
maxHeight: this.props.maxHeight,
|
|
449
|
+
minWidth: this.props.minWidth,
|
|
450
|
+
minHeight: this.props.minHeight,
|
|
451
|
+
boxSizing: "border-box",
|
|
452
|
+
flexShrink: 0
|
|
453
|
+
});
|
|
454
|
+
return this.state.flexBasis && (n.flexBasis = this.state.flexBasis), l(this.props.as || "div", b({
|
|
455
|
+
style: n,
|
|
456
|
+
className: this.props.className
|
|
457
|
+
}, t, {
|
|
458
|
+
ref: function(t) {
|
|
459
|
+
t && (e.resizable = t);
|
|
460
|
+
},
|
|
461
|
+
children: [
|
|
462
|
+
this.state.isResizing && c("div", { style: this.state.backgroundStyle }),
|
|
463
|
+
this.props.children,
|
|
464
|
+
this.renderResizer()
|
|
465
|
+
]
|
|
466
|
+
}));
|
|
467
|
+
}, t.defaultProps = {
|
|
468
|
+
as: "div",
|
|
469
|
+
onResizeStart: function() {},
|
|
470
|
+
onResize: function() {},
|
|
471
|
+
onResizeStop: function() {},
|
|
472
|
+
enable: {
|
|
473
|
+
top: !0,
|
|
474
|
+
right: !0,
|
|
475
|
+
bottom: !0,
|
|
476
|
+
left: !0,
|
|
477
|
+
topRight: !0,
|
|
478
|
+
bottomRight: !0,
|
|
479
|
+
bottomLeft: !0,
|
|
480
|
+
topLeft: !0
|
|
481
|
+
},
|
|
482
|
+
style: {},
|
|
483
|
+
grid: [1, 1],
|
|
484
|
+
gridGap: [0, 0],
|
|
485
|
+
lockAspectRatio: !1,
|
|
486
|
+
lockAspectRatioExtraWidth: 0,
|
|
487
|
+
lockAspectRatioExtraHeight: 0,
|
|
488
|
+
scale: 1,
|
|
489
|
+
resizeRatio: 1,
|
|
490
|
+
snapGap: 0
|
|
491
|
+
}, t;
|
|
492
|
+
}(t);
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/lib/components/terminal-tabs/resize-panel.tsx
|
|
495
|
+
d(u)`
|
|
496
|
+
position: absolute;
|
|
497
|
+
padding: 0;
|
|
498
|
+
top: -12px;
|
|
499
|
+
font-size: var(--font-size-middle);
|
|
500
|
+
left: calc(50% + 10px);
|
|
501
|
+
transform: translateX(-50%);
|
|
502
|
+
background: none !important;
|
|
503
|
+
cursor: ns-resize;
|
|
504
|
+
&::hover {
|
|
505
|
+
background: none !important;
|
|
506
|
+
}
|
|
507
|
+
`;
|
|
508
|
+
var F = n((t, n) => {
|
|
509
|
+
let { defaultWidth: r, defaultHeight: i = 180, minHeight: o = 180, maxHeight: l = 400, children: u, onReSize: d, onReSizeStop: f, ...p } = t;
|
|
510
|
+
e();
|
|
511
|
+
let m = s(null);
|
|
512
|
+
return a(n, () => ({ container: m.current })), /* @__PURE__ */ c(P, {
|
|
513
|
+
ref: m,
|
|
514
|
+
enable: { top: !0 },
|
|
515
|
+
defaultSize: {
|
|
516
|
+
height: i,
|
|
517
|
+
width: r
|
|
518
|
+
},
|
|
519
|
+
handleComponent: { top: void 0 },
|
|
520
|
+
maxHeight: l,
|
|
521
|
+
minHeight: o,
|
|
522
|
+
onResize: d,
|
|
523
|
+
onResizeStop: f,
|
|
524
|
+
...p,
|
|
525
|
+
children: u
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
//#endregion
|
|
529
|
+
export { F as t };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as TerminalTabs } from './lib/components/terminal-tabs';
|
|
2
|
+
export type { TerminalModalProps } from './lib/components/terminal-tabs';
|
|
3
|
+
export type { TerminalTabsProps } from './lib/components/terminal-tabs/tabs';
|
|
4
|
+
export type { TerminalProps } from './lib/components/terminal-tabs/types';
|
|
5
|
+
export { default as XTerminal } from './lib/components/x-terminal';
|