welcome-ui 7.1.0 → 7.1.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/types/utils/index.d.ts +1 -0
- package/dist/utils.mjs +16 -14
- package/package.json +1 -1
package/dist/utils.mjs
CHANGED
|
@@ -6,8 +6,9 @@ import { o as N } from "./overflow-ellipsis-DGV5Kgt-.mjs";
|
|
|
6
6
|
import { t as P } from "./throttle-BDBzFeFj.mjs";
|
|
7
7
|
import { useState as d, useCallback as m } from "react";
|
|
8
8
|
import { g as y } from "./_commonjsHelpers-CXJ7dpIk.mjs";
|
|
9
|
-
import { s as
|
|
9
|
+
import { s as B, u as _ } from "./use-fork-ref-CUZErtAC.mjs";
|
|
10
10
|
import { u as G } from "./use-isomorphic-layout-effect-Izr-e2pi.mjs";
|
|
11
|
+
import { u as O } from "./use-viewport-m3glsbna.mjs";
|
|
11
12
|
var g = function() {
|
|
12
13
|
var e = document.getSelection();
|
|
13
14
|
if (!e.rangeCount)
|
|
@@ -25,8 +26,8 @@ var g = function() {
|
|
|
25
26
|
break;
|
|
26
27
|
}
|
|
27
28
|
return e.removeAllRanges(), function() {
|
|
28
|
-
e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(
|
|
29
|
-
e.addRange(
|
|
29
|
+
e.type === "Caret" && e.removeAllRanges(), e.rangeCount || r.forEach(function(c) {
|
|
30
|
+
e.addRange(c);
|
|
30
31
|
}), t && t.focus();
|
|
31
32
|
};
|
|
32
33
|
}, v = g, f = {
|
|
@@ -39,10 +40,10 @@ function C(e) {
|
|
|
39
40
|
return e.replace(/#{\s*key\s*}/g, t);
|
|
40
41
|
}
|
|
41
42
|
function x(e, t) {
|
|
42
|
-
var r, o,
|
|
43
|
+
var r, o, c, n, s, a, i = !1;
|
|
43
44
|
t || (t = {}), r = t.debug || !1;
|
|
44
45
|
try {
|
|
45
|
-
|
|
46
|
+
c = v(), n = document.createRange(), s = document.getSelection(), a = document.createElement("span"), a.textContent = e, a.ariaHidden = "true", a.style.all = "unset", a.style.position = "fixed", a.style.top = 0, a.style.clip = "rect(0, 0, 0, 0)", a.style.whiteSpace = "pre", a.style.webkitUserSelect = "text", a.style.MozUserSelect = "text", a.style.msUserSelect = "text", a.style.userSelect = "text", a.addEventListener("copy", function(l) {
|
|
46
47
|
if (l.stopPropagation(), t.format)
|
|
47
48
|
if (l.preventDefault(), typeof l.clipboardData > "u") {
|
|
48
49
|
r && console.warn("unable to use e.clipboardData"), r && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
|
|
@@ -51,7 +52,7 @@ function x(e, t) {
|
|
|
51
52
|
} else
|
|
52
53
|
l.clipboardData.clearData(), l.clipboardData.setData(t.format, e);
|
|
53
54
|
t.onCopy && (l.preventDefault(), t.onCopy(l.clipboardData));
|
|
54
|
-
}), document.body.appendChild(a), n.selectNodeContents(a),
|
|
55
|
+
}), document.body.appendChild(a), n.selectNodeContents(a), s.addRange(n);
|
|
55
56
|
var p = document.execCommand("copy");
|
|
56
57
|
if (!p)
|
|
57
58
|
throw new Error("copy command was unsuccessful");
|
|
@@ -64,19 +65,19 @@ function x(e, t) {
|
|
|
64
65
|
r && console.error("unable to copy using clipboardData: ", u), r && console.error("falling back to prompt"), o = C("message" in t ? t.message : b), window.prompt(o, e);
|
|
65
66
|
}
|
|
66
67
|
} finally {
|
|
67
|
-
|
|
68
|
+
s && (typeof s.removeRange == "function" ? s.removeRange(n) : s.removeAllRanges()), a && document.body.removeChild(a), c();
|
|
68
69
|
}
|
|
69
70
|
return i;
|
|
70
71
|
}
|
|
71
72
|
var w = x;
|
|
72
73
|
const D = /* @__PURE__ */ y(w);
|
|
73
|
-
function
|
|
74
|
+
function S(e, t) {
|
|
74
75
|
const [r, o] = d();
|
|
75
76
|
return [m(() => {
|
|
76
77
|
let n;
|
|
77
78
|
typeof e == "number" || typeof e == "string" ? n = e.toString() : e.current instanceof HTMLInputElement ? n = e.current.value : e.current instanceof HTMLElement && (n = e.current.textContent);
|
|
78
|
-
const
|
|
79
|
-
o(
|
|
79
|
+
const s = D(n);
|
|
80
|
+
o(s), t && setTimeout(o, t);
|
|
80
81
|
}, [e, t]), r];
|
|
81
82
|
}
|
|
82
83
|
export {
|
|
@@ -85,9 +86,10 @@ export {
|
|
|
85
86
|
k as formatBytes,
|
|
86
87
|
A as hexToRGBA,
|
|
87
88
|
N as overflowEllipsis,
|
|
88
|
-
|
|
89
|
+
B as setRef,
|
|
89
90
|
P as throttle,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
G as useIsomorphicLayoutEffect
|
|
91
|
+
S as useCopyText,
|
|
92
|
+
_ as useForkRef,
|
|
93
|
+
G as useIsomorphicLayoutEffect,
|
|
94
|
+
O as useViewportSize
|
|
93
95
|
};
|