@drjoshcsimmons/scl 0.1.0 → 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 (195) hide show
  1. package/dist/components/ui/alert/alert.d.ts +1 -1
  2. package/dist/components/ui/alert/alert.d.ts.map +1 -1
  3. package/dist/components/ui/badge/badge.d.ts +1 -1
  4. package/dist/components/ui/badge/badge.d.ts.map +1 -1
  5. package/dist/components/ui/button/button.d.ts +1 -1
  6. package/dist/components/ui/button/button.d.ts.map +1 -1
  7. package/dist/components/ui/combobox/combobox.d.ts +31 -0
  8. package/dist/components/ui/combobox/combobox.d.ts.map +1 -0
  9. package/dist/components/ui/combobox/index.d.ts +3 -0
  10. package/dist/components/ui/combobox/index.d.ts.map +1 -0
  11. package/dist/components/ui/command/command.d.ts +85 -0
  12. package/dist/components/ui/command/command.d.ts.map +1 -0
  13. package/dist/components/ui/command/index.d.ts +2 -0
  14. package/dist/components/ui/command/index.d.ts.map +1 -0
  15. package/dist/components/ui/dithered-image/dithered-image.d.ts +6 -2
  16. package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -1
  17. package/dist/components/ui/dithered-image/index.d.ts +1 -1
  18. package/dist/components/ui/dithered-image/index.d.ts.map +1 -1
  19. package/dist/components/ui/form/form.d.ts +24 -0
  20. package/dist/components/ui/form/form.d.ts.map +1 -0
  21. package/dist/components/ui/form/index.d.ts +2 -0
  22. package/dist/components/ui/form/index.d.ts.map +1 -0
  23. package/dist/components/ui/progress/progress.d.ts +0 -6
  24. package/dist/components/ui/progress/progress.d.ts.map +1 -1
  25. package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -1
  26. package/dist/components/ui/skeleton/skeleton.d.ts +4 -1
  27. package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -1
  28. package/dist/components/ui/statusline/statusline.d.ts.map +1 -1
  29. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +0 -5
  30. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -1
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +166 -143
  34. package/dist/index10.js +30 -30
  35. package/dist/index100.js +218 -29
  36. package/dist/index101.js +646 -11
  37. package/dist/index102.js +173 -127
  38. package/dist/index103.js +4 -50
  39. package/dist/index104.js +30 -9
  40. package/dist/index105.js +6 -4
  41. package/dist/index106.js +11 -180
  42. package/dist/index107.js +19 -648
  43. package/dist/index108.js +9 -107
  44. package/dist/index109.js +38 -91
  45. package/dist/index11.js +13 -13
  46. package/dist/index110.js +18 -67
  47. package/dist/index111.js +201 -154
  48. package/dist/index112.js +20 -395
  49. package/dist/index113.js +395 -1675
  50. package/dist/index114.js +2 -278
  51. package/dist/index115.js +49 -128
  52. package/dist/index116.js +65 -32
  53. package/dist/index117.js +19 -1605
  54. package/dist/index118.js +28 -297
  55. package/dist/index119.js +5 -635
  56. package/dist/index12.js +1 -1
  57. package/dist/index120.js +2 -144
  58. package/dist/index121.js +2 -21
  59. package/dist/index122.js +5 -9
  60. package/dist/index123.js +3 -38
  61. package/dist/index124.js +24 -18
  62. package/dist/index125.js +113 -6
  63. package/dist/index126.js +15 -11
  64. package/dist/index127.js +513 -194
  65. package/dist/index128.js +128 -22
  66. package/dist/index129.js +114 -380
  67. package/dist/index13.js +132 -93
  68. package/dist/index130.js +59 -1300
  69. package/dist/index131.js +63 -612
  70. package/dist/index132.js +9 -2
  71. package/dist/index133.js +13 -52
  72. package/dist/index134.js +64 -63
  73. package/dist/index135.js +3 -24
  74. package/dist/index136.js +23 -29
  75. package/dist/index137.js +23 -5
  76. package/dist/index138.js +13 -2
  77. package/dist/index139.js +28 -2
  78. package/dist/index14.js +106 -220
  79. package/dist/index140.js +5 -5
  80. package/dist/index15.js +79 -125
  81. package/dist/index16.js +280 -17
  82. package/dist/index17.js +139 -12
  83. package/dist/index18.js +92 -22
  84. package/dist/index19.js +18 -55
  85. package/dist/index2.js +2 -2
  86. package/dist/index20.js +14 -26
  87. package/dist/index21.js +19 -33
  88. package/dist/index22.js +38 -121
  89. package/dist/index23.js +29 -22
  90. package/dist/index24.js +31 -64
  91. package/dist/index25.js +121 -15
  92. package/dist/index26.js +19 -29
  93. package/dist/index27.js +68 -77
  94. package/dist/index28.js +20 -25
  95. package/dist/index29.js +32 -88
  96. package/dist/index3.js +11 -9
  97. package/dist/index30.js +138 -38
  98. package/dist/index31.js +20 -227
  99. package/dist/index32.js +88 -18
  100. package/dist/index33.js +37 -28
  101. package/dist/index34.js +86 -22
  102. package/dist/index35.js +17 -102
  103. package/dist/index36.js +34 -65
  104. package/dist/index37.js +23 -49
  105. package/dist/index38.js +38 -99
  106. package/dist/index39.js +65 -10
  107. package/dist/index4.js +6 -6
  108. package/dist/index40.js +49 -15
  109. package/dist/index41.js +93 -2256
  110. package/dist/index42.js +10 -32
  111. package/dist/index43.js +15 -18
  112. package/dist/index44.js +2251 -225
  113. package/dist/index45.js +237 -11
  114. package/dist/index46.js +11 -73
  115. package/dist/index47.js +33 -249
  116. package/dist/index48.js +118 -9
  117. package/dist/index49.js +63 -326
  118. package/dist/index5.js +23 -23
  119. package/dist/index50.js +307 -57
  120. package/dist/index51.js +12 -241
  121. package/dist/index52.js +222 -822
  122. package/dist/index53.js +6 -3
  123. package/dist/index54.js +56 -114
  124. package/dist/index55.js +248 -219
  125. package/dist/index56.js +249 -11
  126. package/dist/index57.js +3 -5
  127. package/dist/index58.js +110 -221
  128. package/dist/index59.js +12 -260
  129. package/dist/index6.js +12 -12
  130. package/dist/index60.js +18 -12
  131. package/dist/index61.js +221 -18
  132. package/dist/index62.js +11 -530
  133. package/dist/index63.js +11 -6155
  134. package/dist/index64.js +234 -2626
  135. package/dist/index65.js +230 -292
  136. package/dist/index66.js +504 -646
  137. package/dist/index67.js +155 -824
  138. package/dist/index68.js +128 -23
  139. package/dist/index69.js +319 -311
  140. package/dist/index7.js +22 -22
  141. package/dist/index70.js +72 -4889
  142. package/dist/index71.js +408 -802
  143. package/dist/index72.js +18 -1254
  144. package/dist/index73.js +844 -518
  145. package/dist/index74.js +9 -125
  146. package/dist/index75.js +31 -161
  147. package/dist/index76.js +7 -31
  148. package/dist/index77.js +62 -429
  149. package/dist/index78.js +50 -128
  150. package/dist/index79.js +4 -81
  151. package/dist/index8.js +17 -18
  152. package/dist/index80.js +23 -64
  153. package/dist/index81.js +33 -45
  154. package/dist/index82.js +63 -21
  155. package/dist/index83.js +10 -6
  156. package/dist/index84.js +52 -49
  157. package/dist/index85.js +10 -33
  158. package/dist/index86.js +30 -11
  159. package/dist/index87.js +12 -7
  160. package/dist/index88.js +46 -30
  161. package/dist/index89.js +7 -54
  162. package/dist/index9.js +23 -31
  163. package/dist/index90.js +14 -10
  164. package/dist/index91.js +125 -4
  165. package/dist/index92.js +131 -9
  166. package/dist/index93.js +14 -6
  167. package/dist/index94.js +14 -24
  168. package/dist/index95.js +9 -69
  169. package/dist/index96.js +47 -122
  170. package/dist/index97.js +51 -216
  171. package/dist/index98.js +6 -14
  172. package/dist/index99.js +24 -53
  173. package/dist/tokens/colors.d.ts +26 -86
  174. package/dist/tokens/colors.d.ts.map +1 -1
  175. package/dist/tokens/index.d.ts +12 -84
  176. package/dist/tokens/index.d.ts.map +1 -1
  177. package/package.json +28 -23
  178. package/dist/index141.js +0 -5
  179. package/dist/index142.js +0 -26
  180. package/dist/index143.js +0 -115
  181. package/dist/index144.js +0 -18
  182. package/dist/index145.js +0 -527
  183. package/dist/index146.js +0 -130
  184. package/dist/index147.js +0 -136
  185. package/dist/index148.js +0 -67
  186. package/dist/index149.js +0 -71
  187. package/dist/index150.js +0 -11
  188. package/dist/index151.js +0 -16
  189. package/dist/index152.js +0 -68
  190. package/dist/index153.js +0 -6
  191. package/dist/index154.js +0 -25
  192. package/dist/index155.js +0 -25
  193. package/dist/index156.js +0 -15
  194. package/dist/index157.js +0 -30
  195. package/dist/index158.js +0 -7
package/dist/index69.js CHANGED
@@ -1,330 +1,338 @@
1
- import { Prec as z, EditorSelection as x, countColumn as w, EditorState as K } from "./index64.js";
2
- import { keymap as _, EditorView as j } from "./index63.js";
3
- import { foldService as G, LanguageSupport as N, Language as Q, defineLanguageFacet as J, syntaxTree as A, indentUnit as Y, foldNodeProp as R, indentNodeProp as Z, languageDataProp as W, LanguageDescription as D, ParseContext as ee } from "./index72.js";
4
- import { CompletionContext as te } from "./index112.js";
5
- import { MarkdownParser as re, parseCode as ne, parser as oe, GFM as ie, Subscript as le, Superscript as se, Emoji as fe } from "./index117.js";
6
- import { html as ae, htmlCompletionSource as me } from "./index66.js";
7
- import { NodeProp as ue } from "./index113.js";
8
- const $ = /* @__PURE__ */ J({ commentTokens: { block: { open: "<!--", close: "-->" } } }), q = /* @__PURE__ */ new ue(), H = /* @__PURE__ */ oe.configure({
9
- props: [
10
- /* @__PURE__ */ R.add((r) => !r.is("Block") || r.is("Document") || P(r) != null || ce(r) ? void 0 : (n, o) => ({ from: o.doc.lineAt(n.from).to, to: n.to })),
11
- /* @__PURE__ */ q.add(P),
12
- /* @__PURE__ */ Z.add({
13
- Document: () => null
14
- }),
15
- /* @__PURE__ */ W.add({
16
- Document: $
17
- })
18
- ]
19
- });
20
- function P(r) {
21
- let n = /^(?:ATX|Setext)Heading(\d)$/.exec(r.name);
22
- return n ? +n[1] : void 0;
23
- }
24
- function ce(r) {
25
- return r.name == "OrderedList" || r.name == "BulletList";
26
- }
27
- function pe(r, n) {
28
- let o = r;
29
- for (; ; ) {
30
- let t = o.nextSibling, e;
31
- if (!t || (e = P(t.type)) != null && e <= n)
32
- break;
33
- o = t;
34
- }
35
- return o.to;
36
- }
37
- const de = /* @__PURE__ */ G.of((r, n, o) => {
38
- for (let t = A(r).resolveInner(o, -1); t && !(t.from < n); t = t.parent) {
39
- let e = t.type.prop(q);
40
- if (e == null)
41
- continue;
42
- let i = pe(t, e);
43
- if (i > o)
44
- return { from: o, to: i };
45
- }
46
- return null;
47
- });
48
- function T(r) {
49
- return new Q($, r, [], "markdown");
50
- }
51
- const he = /* @__PURE__ */ T(H), ge = /* @__PURE__ */ H.configure([ie, le, se, fe, {
52
- props: [
53
- /* @__PURE__ */ R.add({
54
- Table: (r, n) => ({ from: n.doc.lineAt(r.from).to, to: r.to })
55
- })
56
- ]
57
- }]), b = /* @__PURE__ */ T(ge);
58
- function ke(r, n) {
59
- return (o) => {
60
- if (o && r) {
61
- let t = null;
62
- if (o = /\S*/.exec(o)[0], typeof r == "function" ? t = r(o) : t = D.matchLanguageName(r, o, !0), t instanceof D)
63
- return t.support ? t.support.language.parser : ee.getSkippingParser(t.load());
64
- if (t)
65
- return t.parser;
1
+ import * as s from "react";
2
+ import { composeEventHandlers as g } from "./index76.js";
3
+ import { useComposedRefs as N } from "./index80.js";
4
+ import { createContextScope as K } from "./index77.js";
5
+ import { DismissableLayer as W } from "./index91.js";
6
+ import { useId as $ } from "./index83.js";
7
+ import { createPopperScope as S, Root as z, Anchor as J, Content as Q, Arrow as Z } from "./index100.js";
8
+ import { Portal as ee } from "./index93.js";
9
+ import { Presence as G } from "./index82.js";
10
+ import { Primitive as te } from "./index81.js";
11
+ import { createSlottable as oe } from "./index97.js";
12
+ import { useControllableState as re } from "./index78.js";
13
+ import { Root as ne } from "./index104.js";
14
+ import { jsx as f, jsxs as se } from "react/jsx-runtime";
15
+ var [D] = K("Tooltip", [
16
+ S
17
+ ]), O = S(), j = "TooltipProvider", ie = 700, L = "tooltip.open", [ae, k] = D(j), F = (t) => {
18
+ const {
19
+ __scopeTooltip: o,
20
+ delayDuration: e = ie,
21
+ skipDelayDuration: r = 300,
22
+ disableHoverableContent: n = !1,
23
+ children: a
24
+ } = t, l = s.useRef(!0), v = s.useRef(!1), i = s.useRef(0);
25
+ return s.useEffect(() => {
26
+ const p = i.current;
27
+ return () => window.clearTimeout(p);
28
+ }, []), /* @__PURE__ */ f(
29
+ ae,
30
+ {
31
+ scope: o,
32
+ isOpenDelayedRef: l,
33
+ delayDuration: e,
34
+ onOpen: s.useCallback(() => {
35
+ window.clearTimeout(i.current), l.current = !1;
36
+ }, []),
37
+ onClose: s.useCallback(() => {
38
+ window.clearTimeout(i.current), i.current = window.setTimeout(
39
+ () => l.current = !0,
40
+ r
41
+ );
42
+ }, [r]),
43
+ isPointerInTransitRef: v,
44
+ onPointerInTransitChange: s.useCallback((p) => {
45
+ v.current = p;
46
+ }, []),
47
+ disableHoverableContent: n,
48
+ children: a
66
49
  }
67
- return n ? n.parser : null;
68
- };
69
- }
70
- class v {
71
- constructor(n, o, t, e, i, a, m) {
72
- this.node = n, this.from = o, this.to = t, this.spaceBefore = e, this.spaceAfter = i, this.type = a, this.item = m;
73
- }
74
- blank(n, o = !0) {
75
- let t = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
76
- if (n != null) {
77
- for (; t.length < n; )
78
- t += " ";
79
- return t;
80
- } else {
81
- for (let e = this.to - this.from - t.length - this.spaceAfter.length; e > 0; e--)
82
- t += " ";
83
- return t + (o ? this.spaceAfter : "");
50
+ );
51
+ };
52
+ F.displayName = j;
53
+ var R = "Tooltip", [le, _] = D(R), B = (t) => {
54
+ const {
55
+ __scopeTooltip: o,
56
+ children: e,
57
+ open: r,
58
+ defaultOpen: n,
59
+ onOpenChange: a,
60
+ disableHoverableContent: l,
61
+ delayDuration: v
62
+ } = t, i = k(R, t.__scopeTooltip), p = O(o), [c, d] = s.useState(null), h = $(), u = s.useRef(0), m = l ?? i.disableHoverableContent, y = v ?? i.delayDuration, T = s.useRef(!1), [x, C] = re({
63
+ prop: r,
64
+ defaultProp: n ?? !1,
65
+ onChange: (H) => {
66
+ H ? (i.onOpen(), document.dispatchEvent(new CustomEvent(L))) : i.onClose(), a == null || a(H);
67
+ },
68
+ caller: R
69
+ }), w = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), P = s.useCallback(() => {
70
+ window.clearTimeout(u.current), u.current = 0, T.current = !1, C(!0);
71
+ }, [C]), E = s.useCallback(() => {
72
+ window.clearTimeout(u.current), u.current = 0, C(!1);
73
+ }, [C]), I = s.useCallback(() => {
74
+ window.clearTimeout(u.current), u.current = window.setTimeout(() => {
75
+ T.current = !0, C(!0), u.current = 0;
76
+ }, y);
77
+ }, [y, C]);
78
+ return s.useEffect(() => () => {
79
+ u.current && (window.clearTimeout(u.current), u.current = 0);
80
+ }, []), /* @__PURE__ */ f(z, { ...p, children: /* @__PURE__ */ f(
81
+ le,
82
+ {
83
+ scope: o,
84
+ contentId: h,
85
+ open: x,
86
+ stateAttribute: w,
87
+ trigger: c,
88
+ onTriggerChange: d,
89
+ onTriggerEnter: s.useCallback(() => {
90
+ i.isOpenDelayedRef.current ? I() : P();
91
+ }, [i.isOpenDelayedRef, I, P]),
92
+ onTriggerLeave: s.useCallback(() => {
93
+ m ? E() : (window.clearTimeout(u.current), u.current = 0);
94
+ }, [E, m]),
95
+ onOpen: P,
96
+ onClose: E,
97
+ disableHoverableContent: m,
98
+ children: e
84
99
  }
100
+ ) });
101
+ };
102
+ B.displayName = R;
103
+ var A = "TooltipTrigger", U = s.forwardRef(
104
+ (t, o) => {
105
+ const { __scopeTooltip: e, ...r } = t, n = _(A, e), a = k(A, e), l = O(e), v = s.useRef(null), i = N(o, v, n.onTriggerChange), p = s.useRef(!1), c = s.useRef(!1), d = s.useCallback(() => p.current = !1, []);
106
+ return s.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ f(J, { asChild: !0, ...l, children: /* @__PURE__ */ f(
107
+ te.button,
108
+ {
109
+ "aria-describedby": n.open ? n.contentId : void 0,
110
+ "data-state": n.stateAttribute,
111
+ ...r,
112
+ ref: i,
113
+ onPointerMove: g(t.onPointerMove, (h) => {
114
+ h.pointerType !== "touch" && !c.current && !a.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
115
+ }),
116
+ onPointerLeave: g(t.onPointerLeave, () => {
117
+ n.onTriggerLeave(), c.current = !1;
118
+ }),
119
+ onPointerDown: g(t.onPointerDown, () => {
120
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", d, { once: !0 });
121
+ }),
122
+ onFocus: g(t.onFocus, () => {
123
+ p.current || n.onOpen();
124
+ }),
125
+ onBlur: g(t.onBlur, n.onClose),
126
+ onClick: g(t.onClick, n.onClose)
127
+ }
128
+ ) });
85
129
  }
86
- marker(n, o) {
87
- let t = this.node.name == "OrderedList" ? String(+V(this.item, n)[2] + o) : "";
88
- return this.spaceBefore + t + this.type + this.spaceAfter;
89
- }
90
- }
91
- function U(r, n) {
92
- let o = [], t = [];
93
- for (let e = r; e; e = e.parent) {
94
- if (e.name == "FencedCode")
95
- return t;
96
- (e.name == "ListItem" || e.name == "Blockquote") && o.push(e);
130
+ );
131
+ U.displayName = A;
132
+ var M = "TooltipPortal", [ce, ue] = D(M, {
133
+ forceMount: void 0
134
+ }), V = (t) => {
135
+ const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, a = _(M, o);
136
+ return /* @__PURE__ */ f(ce, { scope: o, forceMount: e, children: /* @__PURE__ */ f(G, { present: e || a.open, children: /* @__PURE__ */ f(ee, { asChild: !0, container: n, children: r }) }) });
137
+ };
138
+ V.displayName = M;
139
+ var b = "TooltipContent", Y = s.forwardRef(
140
+ (t, o) => {
141
+ const e = ue(b, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...a } = t, l = _(b, t.__scopeTooltip);
142
+ return /* @__PURE__ */ f(G, { present: r || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ f(q, { side: n, ...a, ref: o }) : /* @__PURE__ */ f(pe, { side: n, ...a, ref: o }) });
97
143
  }
98
- for (let e = o.length - 1; e >= 0; e--) {
99
- let i = o[e], a, m = n.lineAt(i.from), s = i.from - m.from;
100
- if (i.name == "Blockquote" && (a = /^ *>( ?)/.exec(m.text.slice(s))))
101
- t.push(new v(i, s, s + a[0].length, "", a[1], ">", null));
102
- else if (i.name == "ListItem" && i.parent.name == "OrderedList" && (a = /^( *)\d+([.)])( *)/.exec(m.text.slice(s)))) {
103
- let f = a[3], l = a[0].length;
104
- f.length >= 4 && (f = f.slice(0, f.length - 4), l -= 4), t.push(new v(i.parent, s, s + l, a[1], f, a[2], i));
105
- } else if (i.name == "ListItem" && i.parent.name == "BulletList" && (a = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(m.text.slice(s)))) {
106
- let f = a[4], l = a[0].length;
107
- f.length > 4 && (f = f.slice(0, f.length - 4), l -= 4);
108
- let u = a[2];
109
- a[3] && (u += a[3].replace(/[xX]/, " ")), t.push(new v(i.parent, s, s + l, a[1], f, u, i));
144
+ ), pe = s.forwardRef((t, o) => {
145
+ const e = _(b, t.__scopeTooltip), r = k(b, t.__scopeTooltip), n = s.useRef(null), a = N(o, n), [l, v] = s.useState(null), { trigger: i, onClose: p } = e, c = n.current, { onPointerInTransitChange: d } = r, h = s.useCallback(() => {
146
+ v(null), d(!1);
147
+ }, [d]), u = s.useCallback(
148
+ (m, y) => {
149
+ const T = m.currentTarget, x = { x: m.clientX, y: m.clientY }, C = me(x, T.getBoundingClientRect()), w = Te(x, C), P = ye(y.getBoundingClientRect()), E = xe([...w, ...P]);
150
+ v(E), d(!0);
151
+ },
152
+ [d]
153
+ );
154
+ return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
155
+ if (i && c) {
156
+ const m = (T) => u(T, c), y = (T) => u(T, i);
157
+ return i.addEventListener("pointerleave", m), c.addEventListener("pointerleave", y), () => {
158
+ i.removeEventListener("pointerleave", m), c.removeEventListener("pointerleave", y);
159
+ };
110
160
  }
111
- }
112
- return t;
113
- }
114
- function V(r, n) {
115
- return /^(\s*)(\d+)(?=[.)])/.exec(n.sliceString(r.from, r.from + 10));
116
- }
117
- function I(r, n, o, t = 0) {
118
- for (let e = -1, i = r; ; ) {
119
- if (i.name == "ListItem") {
120
- let m = V(i, n), s = +m[2];
121
- if (e >= 0) {
122
- if (s != e + 1)
123
- return;
124
- o.push({ from: i.from + m[1].length, to: i.from + m[0].length, insert: String(e + 2 + t) });
125
- }
126
- e = s;
161
+ }, [i, c, u, h]), s.useEffect(() => {
162
+ if (l) {
163
+ const m = (y) => {
164
+ const T = y.target, x = { x: y.clientX, y: y.clientY }, C = (i == null ? void 0 : i.contains(T)) || (c == null ? void 0 : c.contains(T)), w = !Ce(x, l);
165
+ C ? h() : w && (h(), p());
166
+ };
167
+ return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
127
168
  }
128
- let a = i.nextSibling;
129
- if (!a)
130
- break;
131
- i = a;
132
- }
133
- }
134
- function E(r, n) {
135
- let o = /^[ \t]*/.exec(r)[0].length;
136
- if (!o || n.facet(Y) != " ")
137
- return r;
138
- let t = w(r, 4, o), e = "";
139
- for (let i = t; i > 0; )
140
- i >= 4 ? (e += " ", i -= 4) : (e += " ", i--);
141
- return e + r.slice(o);
142
- }
143
- const xe = (r = {}) => ({ state: n, dispatch: o }) => {
144
- let t = A(n), { doc: e } = n, i = null, a = n.changeByRange((m) => {
145
- if (!m.empty || !b.isActiveAt(n, m.from, -1) && !b.isActiveAt(n, m.from, 1))
146
- return i = { range: m };
147
- let s = m.from, f = e.lineAt(s), l = U(t.resolveInner(s, -1), e);
148
- for (; l.length && l[l.length - 1].from > s - f.from; )
149
- l.pop();
150
- if (!l.length)
151
- return i = { range: m };
152
- let u = l[l.length - 1];
153
- if (u.to - u.spaceAfter.length > s - f.from)
154
- return i = { range: m };
155
- let d = s >= u.to - u.spaceAfter.length && !/\S/.test(f.text.slice(u.to));
156
- if (u.item && d) {
157
- let p = u.node.firstChild, h = u.node.getChild("ListItem", "ListItem");
158
- if (p.to >= s || h && h.to < s || f.from > 0 && !/[^\s>]/.test(e.lineAt(f.from - 1).text) || r.nonTightLists === !1) {
159
- let c = l.length > 1 ? l[l.length - 2] : null, C, B = "";
160
- c && c.item ? (C = f.from + c.from, B = c.marker(e, 1)) : C = f.from + (c ? c.to : 0);
161
- let S = [{ from: C, to: s, insert: B }];
162
- return u.node.name == "OrderedList" && I(u.item, e, S, -2), c && c.node.name == "OrderedList" && I(c.item, e, S), { range: x.cursor(C + B.length), changes: S };
163
- } else {
164
- let c = F(l, n, f);
165
- return {
166
- range: x.cursor(s + c.length + 1),
167
- changes: { from: f.from, insert: c + n.lineBreak }
169
+ }, [i, c, l, p, h]), /* @__PURE__ */ f(q, { ...t, ref: a });
170
+ }), [de, fe] = D(R, { isInside: !1 }), ve = oe("TooltipContent"), q = s.forwardRef(
171
+ (t, o) => {
172
+ const {
173
+ __scopeTooltip: e,
174
+ children: r,
175
+ "aria-label": n,
176
+ onEscapeKeyDown: a,
177
+ onPointerDownOutside: l,
178
+ ...v
179
+ } = t, i = _(b, e), p = O(e), { onClose: c } = i;
180
+ return s.useEffect(() => (document.addEventListener(L, c), () => document.removeEventListener(L, c)), [c]), s.useEffect(() => {
181
+ if (i.trigger) {
182
+ const d = (h) => {
183
+ const u = h.target;
184
+ u != null && u.contains(i.trigger) && c();
168
185
  };
186
+ return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
169
187
  }
170
- }
171
- if (u.node.name == "Blockquote" && d && f.from) {
172
- let p = e.lineAt(f.from - 1), h = />\s*$/.exec(p.text);
173
- if (h && h.index == u.from) {
174
- let c = n.changes([
175
- { from: p.from + h.index, to: p.to },
176
- { from: f.from + u.from, to: f.to }
177
- ]);
178
- return { range: m.map(c), changes: c };
188
+ }, [i.trigger, c]), /* @__PURE__ */ f(
189
+ W,
190
+ {
191
+ asChild: !0,
192
+ disableOutsidePointerEvents: !1,
193
+ onEscapeKeyDown: a,
194
+ onPointerDownOutside: l,
195
+ onFocusOutside: (d) => d.preventDefault(),
196
+ onDismiss: c,
197
+ children: /* @__PURE__ */ se(
198
+ Q,
199
+ {
200
+ "data-state": i.stateAttribute,
201
+ ...p,
202
+ ...v,
203
+ ref: o,
204
+ style: {
205
+ ...v.style,
206
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
207
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
208
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
209
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
210
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
211
+ },
212
+ children: [
213
+ /* @__PURE__ */ f(ve, { children: r }),
214
+ /* @__PURE__ */ f(de, { scope: e, isInside: !0, children: /* @__PURE__ */ f(ne, { id: i.contentId, role: "tooltip", children: n || r }) })
215
+ ]
216
+ }
217
+ )
179
218
  }
180
- }
181
- let g = [];
182
- u.node.name == "OrderedList" && I(u.item, e, g);
183
- let M = u.item && u.item.from < f.from, k = "";
184
- if (!M || /^[\s\d.)\-+*>]*/.exec(f.text)[0].length >= u.to)
185
- for (let p = 0, h = l.length - 1; p <= h; p++)
186
- k += p == h && !M ? l[p].marker(e, 1) : l[p].blank(p < h ? w(f.text, 4, l[p + 1].from) - k.length : null);
187
- let L = s;
188
- for (; L > f.from && /\s/.test(f.text.charAt(L - f.from - 1)); )
189
- L--;
190
- return k = E(k, n), we(u.node, n.doc) && (k = F(l, n, f) + n.lineBreak + k), g.push({ from: L, to: s, insert: n.lineBreak + k }), { range: x.cursor(L + k.length + 1), changes: g };
191
- });
192
- return i ? !1 : (o(n.update(a, { scrollIntoView: !0, userEvent: "input" })), !0);
193
- }, Le = /* @__PURE__ */ xe();
194
- function O(r) {
195
- return r.name == "QuoteMark" || r.name == "ListMark";
196
- }
197
- function we(r, n) {
198
- if (r.name != "OrderedList" && r.name != "BulletList")
199
- return !1;
200
- let o = r.firstChild, t = r.getChild("ListItem", "ListItem");
201
- if (!t)
202
- return !1;
203
- let e = n.lineAt(o.to), i = n.lineAt(t.from), a = /^[\s>]*$/.test(e.text);
204
- return e.number + (a ? 0 : 1) < i.number;
205
- }
206
- function F(r, n, o) {
207
- let t = "";
208
- for (let e = 0, i = r.length - 2; e <= i; e++)
209
- t += r[e].blank(e < i ? w(o.text, 4, r[e + 1].from) - t.length : null, e < i);
210
- return E(t, n);
219
+ );
220
+ }
221
+ );
222
+ Y.displayName = b;
223
+ var X = "TooltipArrow", he = s.forwardRef(
224
+ (t, o) => {
225
+ const { __scopeTooltip: e, ...r } = t, n = O(e);
226
+ return fe(
227
+ X,
228
+ e
229
+ ).isInside ? null : /* @__PURE__ */ f(Z, { ...n, ...r, ref: o });
230
+ }
231
+ );
232
+ he.displayName = X;
233
+ function me(t, o) {
234
+ const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), a = Math.abs(o.left - t.x);
235
+ switch (Math.min(e, r, n, a)) {
236
+ case a:
237
+ return "left";
238
+ case n:
239
+ return "right";
240
+ case e:
241
+ return "top";
242
+ case r:
243
+ return "bottom";
244
+ default:
245
+ throw new Error("unreachable");
246
+ }
211
247
  }
212
- function Ae(r, n) {
213
- let o = r.resolveInner(n, -1), t = n;
214
- O(o) && (t = o.from, o = o.parent);
215
- for (let e; e = o.childBefore(t); )
216
- if (O(e))
217
- t = e.from;
218
- else if (e.name == "OrderedList" || e.name == "BulletList")
219
- o = e.lastChild, t = o.to;
220
- else
248
+ function Te(t, o, e = 5) {
249
+ const r = [];
250
+ switch (o) {
251
+ case "top":
252
+ r.push(
253
+ { x: t.x - e, y: t.y + e },
254
+ { x: t.x + e, y: t.y + e }
255
+ );
256
+ break;
257
+ case "bottom":
258
+ r.push(
259
+ { x: t.x - e, y: t.y - e },
260
+ { x: t.x + e, y: t.y - e }
261
+ );
262
+ break;
263
+ case "left":
264
+ r.push(
265
+ { x: t.x + e, y: t.y - e },
266
+ { x: t.x + e, y: t.y + e }
267
+ );
221
268
  break;
222
- return o;
269
+ case "right":
270
+ r.push(
271
+ { x: t.x - e, y: t.y - e },
272
+ { x: t.x - e, y: t.y + e }
273
+ );
274
+ break;
275
+ }
276
+ return r;
223
277
  }
224
- const Ce = ({ state: r, dispatch: n }) => {
225
- let o = A(r), t = null, e = r.changeByRange((i) => {
226
- let a = i.from, { doc: m } = r;
227
- if (i.empty && b.isActiveAt(r, i.from)) {
228
- let s = m.lineAt(a), f = U(Ae(o, a), m);
229
- if (f.length) {
230
- let l = f[f.length - 1], u = l.to - l.spaceAfter.length + (l.spaceAfter ? 1 : 0);
231
- if (a - s.from > u && !/\S/.test(s.text.slice(u, a - s.from)))
232
- return {
233
- range: x.cursor(s.from + u),
234
- changes: { from: s.from + u, to: a }
235
- };
236
- if (a - s.from == u && // Only apply this if we're on the line that has the
237
- // construct's syntax, or there's only indentation in the
238
- // target range
239
- (!l.item || s.from <= l.item.from || !/\S/.test(s.text.slice(0, l.to)))) {
240
- let d = s.from + l.from;
241
- if (l.item && l.node.from < l.item.from && /\S/.test(s.text.slice(l.from, l.to))) {
242
- let g = l.blank(w(s.text, 4, l.to) - w(s.text, 4, l.from));
243
- return d == s.from && (g = E(g, r)), {
244
- range: x.cursor(d + g.length),
245
- changes: { from: d, to: s.from + l.to, insert: g }
246
- };
247
- }
248
- if (d < a)
249
- return { range: x.cursor(d), changes: { from: d, to: a } };
250
- }
251
- }
252
- }
253
- return t = { range: i };
254
- });
255
- return t ? !1 : (n(r.update(e, { scrollIntoView: !0, userEvent: "delete" })), !0);
256
- }, be = [
257
- { key: "Enter", run: Le },
258
- { key: "Backspace", run: Ce }
259
- ], X = /* @__PURE__ */ ae({ matchClosingTags: !1 });
260
- function Oe(r = {}) {
261
- let { codeLanguages: n, defaultCodeLanguage: o, addKeymap: t = !0, base: { parser: e } = he, completeHTMLTags: i = !0, pasteURLAsLink: a = !0, htmlTagLanguage: m = X } = r;
262
- if (!(e instanceof re))
263
- throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
264
- let s = r.extensions ? [r.extensions] : [], f = [m.support, de], l;
265
- a && f.push(Ie), o instanceof N ? (f.push(o.support), l = o.language) : o && (l = o);
266
- let u = n || l ? ke(n, l) : void 0;
267
- s.push(ne({ codeParser: u, htmlParser: m.language.parser })), t && f.push(z.high(_.of(be)));
268
- let d = T(e.configure(s));
269
- return i && f.push(d.data.of({ autocomplete: Be })), new N(d, f);
278
+ function ye(t) {
279
+ const { top: o, right: e, bottom: r, left: n } = t;
280
+ return [
281
+ { x: n, y: o },
282
+ { x: e, y: o },
283
+ { x: e, y: r },
284
+ { x: n, y: r }
285
+ ];
270
286
  }
271
- function Be(r) {
272
- let { state: n, pos: o } = r, t = /<[:\-\.\w\u00b7-\uffff]*$/.exec(n.sliceDoc(o - 25, o));
273
- if (!t)
274
- return null;
275
- let e = A(n).resolveInner(o, -1);
276
- for (; e && !e.type.isTop; ) {
277
- if (e.name == "CodeBlock" || e.name == "FencedCode" || e.name == "ProcessingInstructionBlock" || e.name == "CommentBlock" || e.name == "Link" || e.name == "Image")
278
- return null;
279
- e = e.parent;
287
+ function Ce(t, o) {
288
+ const { x: e, y: r } = t;
289
+ let n = !1;
290
+ for (let a = 0, l = o.length - 1; a < o.length; l = a++) {
291
+ const v = o[a], i = o[l], p = v.x, c = v.y, d = i.x, h = i.y;
292
+ c > r != h > r && e < (d - p) * (r - c) / (h - c) + p && (n = !n);
280
293
  }
281
- return {
282
- from: o - t[0].length,
283
- to: o,
284
- options: Se(),
285
- validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
286
- };
294
+ return n;
287
295
  }
288
- let y = null;
289
- function Se() {
290
- if (y)
291
- return y;
292
- let r = me(new te(K.create({ extensions: X }), 0, !0));
293
- return y = r ? r.options : [];
296
+ function xe(t) {
297
+ const o = t.slice();
298
+ return o.sort((e, r) => e.x < r.x ? -1 : e.x > r.x ? 1 : e.y < r.y ? -1 : e.y > r.y ? 1 : 0), ge(o);
294
299
  }
295
- const ve = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i, Ie = /* @__PURE__ */ j.domEventHandlers({
296
- paste: (r, n) => {
297
- var o;
298
- let { main: t } = n.state.selection;
299
- if (t.empty)
300
- return !1;
301
- let e = (o = r.clipboardData) === null || o === void 0 ? void 0 : o.getData("text/plain");
302
- if (!e || !/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(e) || (/^www\./.test(e) && (e = "https://" + e), !b.isActiveAt(n.state, t.from, 1)))
303
- return !1;
304
- let i = A(n.state), a = !1;
305
- return i.iterate({
306
- from: t.from,
307
- to: t.to,
308
- enter: (m) => {
309
- (m.from > t.from || ve.test(m.name)) && (a = !0);
310
- },
311
- leave: (m) => {
312
- m.to < t.to && (a = !0);
313
- }
314
- }), a ? !1 : (n.dispatch({
315
- changes: [{ from: t.from, insert: "[" }, { from: t.to, insert: `](${e})` }],
316
- userEvent: "input.paste",
317
- scrollIntoView: !0
318
- }), !0);
300
+ function ge(t) {
301
+ if (t.length <= 1) return t.slice();
302
+ const o = [];
303
+ for (let r = 0; r < t.length; r++) {
304
+ const n = t[r];
305
+ for (; o.length >= 2; ) {
306
+ const a = o[o.length - 1], l = o[o.length - 2];
307
+ if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) o.pop();
308
+ else break;
309
+ }
310
+ o.push(n);
319
311
  }
320
- });
312
+ o.pop();
313
+ const e = [];
314
+ for (let r = t.length - 1; r >= 0; r--) {
315
+ const n = t[r];
316
+ for (; e.length >= 2; ) {
317
+ const a = e[e.length - 1], l = e[e.length - 2];
318
+ if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) e.pop();
319
+ else break;
320
+ }
321
+ e.push(n);
322
+ }
323
+ return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
324
+ }
325
+ var He = F, Ne = B, Se = U, Ge = V, je = Y;
321
326
  export {
322
- he as commonmarkLanguage,
323
- Ce as deleteMarkupBackward,
324
- Le as insertNewlineContinueMarkup,
325
- xe as insertNewlineContinueMarkupCommand,
326
- Oe as markdown,
327
- be as markdownKeymap,
328
- b as markdownLanguage,
329
- Ie as pasteURLAsLink
327
+ je as Content,
328
+ Ge as Portal,
329
+ He as Provider,
330
+ Ne as Root,
331
+ B as Tooltip,
332
+ he as TooltipArrow,
333
+ Y as TooltipContent,
334
+ V as TooltipPortal,
335
+ F as TooltipProvider,
336
+ U as TooltipTrigger,
337
+ Se as Trigger
330
338
  };