@drjoshcsimmons/scl 0.1.1 → 0.1.2

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.
Files changed (101) hide show
  1. package/dist/index100.js +218 -8
  2. package/dist/index101.js +648 -48
  3. package/dist/index102.js +167 -205
  4. package/dist/index104.js +1 -1
  5. package/dist/index106.js +12 -21
  6. package/dist/index107.js +15 -3
  7. package/dist/index108.js +3 -32
  8. package/dist/index109.js +32 -12
  9. package/dist/index11.js +2 -2
  10. package/dist/index110.js +18 -12
  11. package/dist/index112.js +1 -1
  12. package/dist/index115.js +1 -1
  13. package/dist/index116.js +1 -1
  14. package/dist/index117.js +25 -2
  15. package/dist/index118.js +29 -2
  16. package/dist/index119.js +5 -25
  17. package/dist/index12.js +1 -1
  18. package/dist/index120.js +2 -29
  19. package/dist/index121.js +2 -5
  20. package/dist/index125.js +1 -1
  21. package/dist/index126.js +1 -1
  22. package/dist/index13.js +2 -2
  23. package/dist/index130.js +1 -1
  24. package/dist/index14.js +2 -2
  25. package/dist/index15.js +2 -2
  26. package/dist/index17.js +4 -4
  27. package/dist/index18.js +2 -2
  28. package/dist/index20.js +2 -2
  29. package/dist/index21.js +1 -1
  30. package/dist/index23.js +2 -2
  31. package/dist/index24.js +1 -1
  32. package/dist/index25.js +4 -4
  33. package/dist/index26.js +1 -1
  34. package/dist/index27.js +3 -3
  35. package/dist/index29.js +1 -1
  36. package/dist/index31.js +1 -1
  37. package/dist/index33.js +1 -1
  38. package/dist/index36.js +2 -2
  39. package/dist/index37.js +1 -1
  40. package/dist/index4.js +2 -2
  41. package/dist/index45.js +237 -33
  42. package/dist/index46.js +11 -125
  43. package/dist/index47.js +33 -237
  44. package/dist/index48.js +118 -11
  45. package/dist/index49.js +70 -57
  46. package/dist/index5.js +1 -1
  47. package/dist/index50.js +298 -237
  48. package/dist/index51.js +6 -3
  49. package/dist/index52.js +249 -62
  50. package/dist/index53.js +12 -236
  51. package/dist/index54.js +60 -11
  52. package/dist/index55.js +242 -298
  53. package/dist/index56.js +249 -12
  54. package/dist/index57.js +9 -225
  55. package/dist/index58.js +125 -11
  56. package/dist/index59.js +12 -31
  57. package/dist/index6.js +1 -1
  58. package/dist/index60.js +16 -258
  59. package/dist/index61.js +225 -12
  60. package/dist/index62.js +11 -118
  61. package/dist/index63.js +4 -5
  62. package/dist/index64.js +238 -19
  63. package/dist/index65.js +234 -16
  64. package/dist/index66.js +509 -220
  65. package/dist/index67.js +143 -112
  66. package/dist/index68.js +112 -143
  67. package/dist/index69.js +323 -241
  68. package/dist/index7.js +1 -1
  69. package/dist/index70.js +2 -2
  70. package/dist/index71.js +392 -487
  71. package/dist/index72.js +20 -433
  72. package/dist/index73.js +823 -299
  73. package/dist/index74.js +9 -860
  74. package/dist/index75.js +31 -9
  75. package/dist/index76.js +5 -66
  76. package/dist/index77.js +64 -23
  77. package/dist/index78.js +51 -6
  78. package/dist/index79.js +4 -54
  79. package/dist/index8.js +1 -1
  80. package/dist/index80.js +25 -44
  81. package/dist/index81.js +33 -51
  82. package/dist/index82.js +67 -32
  83. package/dist/index83.js +1 -1
  84. package/dist/index84.js +54 -7
  85. package/dist/index85.js +10 -5
  86. package/dist/index86.js +30 -25
  87. package/dist/index87.js +11 -67
  88. package/dist/index88.js +43 -52
  89. package/dist/index89.js +7 -10
  90. package/dist/index9.js +2 -2
  91. package/dist/index90.js +15 -4
  92. package/dist/index91.js +124 -29
  93. package/dist/index92.js +131 -9
  94. package/dist/index93.js +14 -181
  95. package/dist/index94.js +13 -13
  96. package/dist/index95.js +8 -649
  97. package/dist/index96.js +47 -122
  98. package/dist/index97.js +47 -128
  99. package/dist/index98.js +6 -14
  100. package/dist/index99.js +24 -14
  101. package/package.json +3 -2
package/dist/index96.js CHANGED
@@ -1,127 +1,52 @@
1
- import * as n from "react";
2
- import { composeEventHandlers as m } from "./index78.js";
3
- import { Primitive as g, dispatchDiscreteCustomEvent as k } from "./index82.js";
4
- import { useComposedRefs as R } from "./index77.js";
5
- import { useCallbackRef as w } from "./index89.js";
6
- import { useEscapeKeydown as U } from "./index110.js";
7
- import { jsx as T } from "react/jsx-runtime";
8
- var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", L, B = n.createContext({
9
- layers: /* @__PURE__ */ new Set(),
10
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
11
- branches: /* @__PURE__ */ new Set()
12
- }), j = n.forwardRef(
13
- (r, e) => {
14
- const {
15
- disableOutsidePointerEvents: i = !1,
16
- onEscapeKeyDown: o,
17
- onPointerDownOutside: t,
18
- onFocusOutside: a,
19
- onInteractOutside: l,
20
- onDismiss: d,
21
- ...v
22
- } = r, c = n.useContext(B), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = R(e, (s) => S(s)), p = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = p.indexOf(A), b = u ? p.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
23
- const E = s.target, C = [...c.branches].some((h) => h.contains(E));
24
- !P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
25
- }, f), D = G((s) => {
26
- const E = s.target;
27
- [...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
28
- }, f);
29
- return U((s) => {
30
- b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
31
- }, f), n.useEffect(() => {
32
- if (u)
33
- return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
34
- i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
35
- };
36
- }, [u, f, i, c]), n.useEffect(() => () => {
37
- u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
38
- }, [u, c]), n.useEffect(() => {
39
- const s = () => F({});
40
- return document.addEventListener(y, s), () => document.removeEventListener(y, s);
41
- }, []), /* @__PURE__ */ T(
42
- g.div,
43
- {
44
- ...v,
45
- ref: W,
46
- style: {
47
- pointerEvents: I ? P ? "auto" : "none" : void 0,
48
- ...r.style
49
- },
50
- onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
51
- onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
52
- onPointerDownCapture: m(
53
- r.onPointerDownCapture,
54
- _.onPointerDownCapture
55
- )
56
- }
57
- );
58
- }
59
- );
60
- j.displayName = z;
61
- var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
62
- const i = n.useContext(B), o = n.useRef(null), t = R(e, o);
63
- return n.useEffect(() => {
64
- const a = o.current;
65
- if (a)
66
- return i.branches.add(a), () => {
67
- i.branches.delete(a);
68
- };
69
- }, [i.branches]), /* @__PURE__ */ T(g.div, { ...r, ref: t });
70
- });
71
- Y.displayName = X;
72
- function q(r, e = globalThis == null ? void 0 : globalThis.document) {
73
- const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
1
+ var S = function(r) {
2
+ if (typeof document > "u")
3
+ return null;
4
+ var u = Array.isArray(r) ? r[0] : r;
5
+ return u.ownerDocument.body;
6
+ }, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
7
+ return r && (r.host || W(r.parentNode));
8
+ }, D = function(r, u) {
9
+ return u.map(function(e) {
10
+ if (r.contains(e))
11
+ return e;
12
+ var n = W(e);
13
+ return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
14
+ }).filter(function(e) {
15
+ return !!e;
74
16
  });
75
- return n.useEffect(() => {
76
- const a = (d) => {
77
- if (d.target && !o.current) {
78
- let v = function() {
79
- x(
80
- H,
81
- i,
82
- c,
83
- { discrete: !0 }
84
- );
85
- };
86
- const c = { originalEvent: d };
87
- d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
88
- } else
89
- e.removeEventListener("click", t.current);
90
- o.current = !1;
91
- }, l = window.setTimeout(() => {
92
- e.addEventListener("pointerdown", a);
93
- }, 0);
94
- return () => {
95
- window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
96
- };
97
- }, [e, i]), {
98
- // ensures we check React component tree (not just DOM tree)
99
- onPointerDownCapture: () => o.current = !0
17
+ }, E = function(r, u, e, n) {
18
+ var i = D(u, Array.isArray(r) ? r : [r]);
19
+ p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
20
+ var s = p[e], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
21
+ !t || o.has(t) || (o.add(t), y(t.parentNode));
100
22
  };
101
- }
102
- function G(r, e = globalThis == null ? void 0 : globalThis.document) {
103
- const i = w(r), o = n.useRef(!1);
104
- return n.useEffect(() => {
105
- const t = (a) => {
106
- a.target && !o.current && x(M, i, { originalEvent: a }, {
107
- discrete: !1
108
- });
109
- };
110
- return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
111
- }, [e, i]), {
112
- onFocusCapture: () => o.current = !0,
113
- onBlurCapture: () => o.current = !1
23
+ i.forEach(y);
24
+ var A = function(t) {
25
+ !t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
26
+ if (o.has(a))
27
+ A(a);
28
+ else
29
+ try {
30
+ var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
31
+ f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
32
+ } catch (k) {
33
+ console.error("aria-hidden: cannot operate on ", a, k);
34
+ }
35
+ });
114
36
  };
115
- }
116
- function O() {
117
- const r = new CustomEvent(y);
118
- document.dispatchEvent(r);
119
- }
120
- function x(r, e, i, { discrete: o }) {
121
- const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
122
- e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
123
- }
37
+ return A(u), o.clear(), h++, function() {
38
+ l.forEach(function(t) {
39
+ var a = f.get(t) - 1, c = s.get(t) - 1;
40
+ f.set(t, a), s.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
41
+ }), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
42
+ };
43
+ }, C = function(r, u, e) {
44
+ e === void 0 && (e = "data-aria-hidden");
45
+ var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
46
+ return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live], script"))), E(n, i, e, "aria-hidden")) : function() {
47
+ return null;
48
+ };
49
+ };
124
50
  export {
125
- j as DismissableLayer,
126
- Y as DismissableLayerBranch
51
+ C as hideOthers
127
52
  };
package/dist/index97.js CHANGED
@@ -1,137 +1,56 @@
1
- import * as d from "react";
2
- import { useComposedRefs as R } from "./index77.js";
3
- import { Primitive as M } from "./index82.js";
4
- import { useCallbackRef as y } from "./index89.js";
5
- import { jsx as _ } from "react/jsx-runtime";
6
- var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
7
- const {
8
- loop: t = !1,
9
- trapped: u = !1,
10
- onMountAutoFocus: p,
11
- onUnmountAutoFocus: L,
12
- ...g
13
- } = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(n, (s) => U(s)), a = d.useRef({
14
- paused: !1,
15
- pause() {
16
- this.paused = !0;
17
- },
18
- resume() {
19
- this.paused = !1;
1
+ import * as l from "react";
2
+ import { composeRefs as y } from "./index80.js";
3
+ import { jsx as p, Fragment as S } from "react/jsx-runtime";
4
+ // @__NO_SIDE_EFFECTS__
5
+ function _(e) {
6
+ const r = /* @__PURE__ */ g(e), o = l.forwardRef((n, t) => {
7
+ const { children: i, ...a } = n, s = l.Children.toArray(i), c = s.find(E);
8
+ if (c) {
9
+ const f = c.props.children, m = s.map((u) => u === c ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : u);
10
+ return /* @__PURE__ */ p(r, { ...a, ref: t, children: l.isValidElement(f) ? l.cloneElement(f, void 0, m) : null });
20
11
  }
21
- }).current;
22
- d.useEffect(() => {
23
- if (u) {
24
- let s = function(i) {
25
- if (a.paused || !o) return;
26
- const c = i.target;
27
- o.contains(c) ? b.current = c : f(b.current, { select: !0 });
28
- }, l = function(i) {
29
- if (a.paused || !o) return;
30
- const c = i.relatedTarget;
31
- c !== null && (o.contains(c) || f(b.current, { select: !0 }));
32
- }, r = function(i) {
33
- if (document.activeElement === document.body)
34
- for (const h of i)
35
- h.removedNodes.length > 0 && f(o);
36
- };
37
- document.addEventListener("focusin", s), document.addEventListener("focusout", l);
38
- const m = new MutationObserver(r);
39
- return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
40
- document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
41
- };
42
- }
43
- }, [u, o, a.paused]), d.useEffect(() => {
44
- if (o) {
45
- S.add(a);
46
- const s = document.activeElement;
47
- if (!o.contains(s)) {
48
- const r = new CustomEvent(F, N);
49
- o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
50
- }
51
- return () => {
52
- o.removeEventListener(F, E), setTimeout(() => {
53
- const r = new CustomEvent(T, N);
54
- o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), S.remove(a);
55
- }, 0);
56
- };
57
- }
58
- }, [o, E, v, a]);
59
- const P = d.useCallback(
60
- (s) => {
61
- if (!t && !u || a.paused) return;
62
- const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
63
- if (l && r) {
64
- const m = s.currentTarget, [i, c] = x(m);
65
- i && c ? !s.shiftKey && r === c ? (s.preventDefault(), t && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), t && f(c, { select: !0 })) : r === m && s.preventDefault();
66
- }
67
- },
68
- [t, u, a.paused]
69
- );
70
- return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
71
- });
72
- k.displayName = K;
73
- function w(e, { select: n = !1 } = {}) {
74
- const t = document.activeElement;
75
- for (const u of e)
76
- if (f(u, { select: n }), document.activeElement !== t) return;
77
- }
78
- function x(e) {
79
- const n = I(e), t = O(n, e), u = O(n.reverse(), e);
80
- return [t, u];
81
- }
82
- function I(e) {
83
- const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
84
- acceptNode: (u) => {
85
- const p = u.tagName === "INPUT" && u.type === "hidden";
86
- return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
12
+ return /* @__PURE__ */ p(r, { ...a, ref: t, children: i });
13
+ });
14
+ return o.displayName = `${e}.Slot`, o;
15
+ }
16
+ // @__NO_SIDE_EFFECTS__
17
+ function g(e) {
18
+ const r = l.forwardRef((o, n) => {
19
+ const { children: t, ...i } = o;
20
+ if (l.isValidElement(t)) {
21
+ const a = b(t), s = C(i, t.props);
22
+ return t.type !== l.Fragment && (s.ref = n ? y(n, a) : a), l.cloneElement(t, s);
87
23
  }
24
+ return l.Children.count(t) > 1 ? l.Children.only(null) : null;
88
25
  });
89
- for (; t.nextNode(); ) n.push(t.currentNode);
90
- return n;
91
- }
92
- function O(e, n) {
93
- for (const t of e)
94
- if (!D(t, { upTo: n })) return t;
26
+ return r.displayName = `${e}.SlotClone`, r;
95
27
  }
96
- function D(e, { upTo: n }) {
97
- if (getComputedStyle(e).visibility === "hidden") return !0;
98
- for (; e; ) {
99
- if (n !== void 0 && e === n) return !1;
100
- if (getComputedStyle(e).display === "none") return !0;
101
- e = e.parentElement;
102
- }
103
- return !1;
104
- }
105
- function H(e) {
106
- return e instanceof HTMLInputElement && "select" in e;
107
- }
108
- function f(e, { select: n = !1 } = {}) {
109
- if (e && e.focus) {
110
- const t = document.activeElement;
111
- e.focus({ preventScroll: !0 }), e !== t && H(e) && n && e.select();
28
+ var d = Symbol("radix.slottable");
29
+ // @__NO_SIDE_EFFECTS__
30
+ function x(e) {
31
+ const r = ({ children: o }) => /* @__PURE__ */ p(S, { children: o });
32
+ return r.displayName = `${e}.Slottable`, r.__radixId = d, r;
33
+ }
34
+ function E(e) {
35
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === d;
36
+ }
37
+ function C(e, r) {
38
+ const o = { ...r };
39
+ for (const n in r) {
40
+ const t = e[n], i = r[n];
41
+ /^on[A-Z]/.test(n) ? t && i ? o[n] = (...s) => {
42
+ const c = i(...s);
43
+ return t(...s), c;
44
+ } : t && (o[n] = t) : n === "style" ? o[n] = { ...t, ...i } : n === "className" && (o[n] = [t, i].filter(Boolean).join(" "));
112
45
  }
46
+ return { ...e, ...o };
113
47
  }
114
- var S = V();
115
- function V() {
116
- let e = [];
117
- return {
118
- add(n) {
119
- const t = e[0];
120
- n !== t && (t == null || t.pause()), e = C(e, n), e.unshift(n);
121
- },
122
- remove(n) {
123
- var t;
124
- e = C(e, n), (t = e[0]) == null || t.resume();
125
- }
126
- };
127
- }
128
- function C(e, n) {
129
- const t = [...e], u = t.indexOf(n);
130
- return u !== -1 && t.splice(u, 1), t;
131
- }
132
- function W(e) {
133
- return e.filter((n) => n.tagName !== "A");
48
+ function b(e) {
49
+ var n, t;
50
+ let r = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, o = r && "isReactWarning" in r && r.isReactWarning;
51
+ return o ? e.ref : (r = (t = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : t.get, o = r && "isReactWarning" in r && r.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
134
52
  }
135
53
  export {
136
- k as FocusScope
54
+ _ as createSlot,
55
+ x as createSlottable
137
56
  };
package/dist/index98.js CHANGED
@@ -1,16 +1,8 @@
1
- import * as r from "react";
2
- import s from "react-dom";
3
- import { Primitive as c } from "./index82.js";
4
- import { useLayoutEffect as u } from "./index90.js";
5
- import { jsx as l } from "react/jsx-runtime";
6
- var p = "Portal", d = r.forwardRef((e, a) => {
7
- var o;
8
- const { container: f, ...i } = e, [m, n] = r.useState(!1);
9
- u(() => n(!0), []);
10
- const t = f || m && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
11
- return t ? s.createPortal(/* @__PURE__ */ l(c.div, { ...i, ref: a }), t) : null;
12
- });
13
- d.displayName = p;
1
+ import * as u from "react";
2
+ function t(r) {
3
+ const e = u.useRef({ value: r, previous: r });
4
+ return u.useMemo(() => (e.current.value !== r && (e.current.previous = e.current.value, e.current.value = r), e.current.previous), [r]);
5
+ }
14
6
  export {
15
- d as Portal
7
+ t as usePrevious
16
8
  };
package/dist/index99.js CHANGED
@@ -1,17 +1,27 @@
1
- import * as r from "react";
2
- var t = 0;
3
- function a() {
4
- r.useEffect(() => {
5
- const e = document.querySelectorAll("[data-radix-focus-guard]");
6
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? n()), document.body.insertAdjacentElement("beforeend", e[1] ?? n()), t++, () => {
7
- t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), t--;
8
- };
9
- }, []);
10
- }
11
- function n() {
12
- const e = document.createElement("span");
13
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
1
+ import * as h from "react";
2
+ import { useLayoutEffect as z } from "./index79.js";
3
+ function c(r) {
4
+ const [d, e] = h.useState(void 0);
5
+ return z(() => {
6
+ if (r) {
7
+ e({ width: r.offsetWidth, height: r.offsetHeight });
8
+ const f = new ResizeObserver((i) => {
9
+ if (!Array.isArray(i) || !i.length)
10
+ return;
11
+ const b = i[0];
12
+ let o, t;
13
+ if ("borderBoxSize" in b) {
14
+ const s = b.borderBoxSize, u = Array.isArray(s) ? s[0] : s;
15
+ o = u.inlineSize, t = u.blockSize;
16
+ } else
17
+ o = r.offsetWidth, t = r.offsetHeight;
18
+ e({ width: o, height: t });
19
+ });
20
+ return f.observe(r, { box: "border-box" }), () => f.unobserve(r);
21
+ } else
22
+ e(void 0);
23
+ }, [r]), d;
14
24
  }
15
25
  export {
16
- a as useFocusGuards
26
+ c as useSize
17
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drjoshcsimmons/scl",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -118,7 +118,8 @@
118
118
  "@codemirror/state": "^6.5.2",
119
119
  "@codemirror/view": "^6.39.4",
120
120
  "@lezer/highlight": "^1.2.3",
121
- "@replit/codemirror-vim": "^6.3.0"
121
+ "@replit/codemirror-vim": "^6.3.0",
122
+ "@vercel/analytics": "^1.6.1"
122
123
  },
123
124
  "scripts": {
124
125
  "dev": "storybook dev -p 6006",