@drjoshcsimmons/scl 0.1.0 → 0.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.
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 +9 -30
  36. package/dist/index101.js +50 -15
  37. package/dist/index102.js +212 -128
  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 +19 -179
  42. package/dist/index107.js +9 -650
  43. package/dist/index108.js +38 -107
  44. package/dist/index109.js +17 -90
  45. package/dist/index11.js +13 -13
  46. package/dist/index110.js +11 -66
  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 +2 -1611
  54. package/dist/index118.js +2 -298
  55. package/dist/index119.js +22 -632
  56. package/dist/index12.js +1 -1
  57. package/dist/index120.js +29 -144
  58. package/dist/index121.js +5 -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 +33 -11
  114. package/dist/index46.js +116 -64
  115. package/dist/index47.js +207 -219
  116. package/dist/index48.js +5 -3
  117. package/dist/index49.js +54 -330
  118. package/dist/index5.js +23 -23
  119. package/dist/index50.js +244 -55
  120. package/dist/index51.js +9 -241
  121. package/dist/index52.js +60 -847
  122. package/dist/index53.js +236 -9
  123. package/dist/index54.js +11 -118
  124. package/dist/index55.js +300 -215
  125. package/dist/index56.js +4 -3
  126. package/dist/index57.js +225 -11
  127. package/dist/index58.js +11 -236
  128. package/dist/index59.js +27 -256
  129. package/dist/index6.js +12 -12
  130. package/dist/index60.js +260 -12
  131. package/dist/index61.js +12 -22
  132. package/dist/index62.js +94 -506
  133. package/dist/index63.js +12 -6155
  134. package/dist/index64.js +20 -2631
  135. package/dist/index65.js +16 -296
  136. package/dist/index66.js +232 -663
  137. package/dist/index67.js +125 -825
  138. package/dist/index68.js +159 -23
  139. package/dist/index69.js +241 -315
  140. package/dist/index7.js +22 -22
  141. package/dist/index70.js +72 -4889
  142. package/dist/index71.js +503 -802
  143. package/dist/index72.js +412 -1235
  144. package/dist/index73.js +323 -521
  145. package/dist/index74.js +839 -104
  146. package/dist/index75.js +9 -161
  147. package/dist/index76.js +67 -30
  148. package/dist/index77.js +22 -430
  149. package/dist/index78.js +6 -129
  150. package/dist/index79.js +48 -75
  151. package/dist/index8.js +17 -18
  152. package/dist/index80.js +42 -64
  153. package/dist/index81.js +50 -44
  154. package/dist/index82.js +32 -25
  155. package/dist/index83.js +10 -6
  156. package/dist/index84.js +7 -51
  157. package/dist/index85.js +5 -33
  158. package/dist/index86.js +24 -10
  159. package/dist/index87.js +68 -7
  160. package/dist/index88.js +55 -30
  161. package/dist/index89.js +10 -54
  162. package/dist/index9.js +23 -31
  163. package/dist/index90.js +4 -11
  164. package/dist/index91.js +30 -4
  165. package/dist/index92.js +1 -1
  166. package/dist/index93.js +180 -5
  167. package/dist/index94.js +14 -24
  168. package/dist/index95.js +643 -62
  169. package/dist/index96.js +5 -5
  170. package/dist/index97.js +128 -212
  171. package/dist/index98.js +2 -2
  172. package/dist/index99.js +13 -52
  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 +26 -22
  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,256 @@
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;
1
+ import u from "react";
2
+ var z = (e) => e.type === "checkbox", k = (e) => e instanceof Date, w = (e) => e == null;
3
+ const H = (e) => typeof e == "object";
4
+ var p = (e) => !w(e) && !Array.isArray(e) && H(e) && !k(e), J = (e) => p(e) && e.target ? z(e.target) ? e.target.checked : e.target.value : e, Q = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, X = (e, s) => e.has(Q(s)), Y = (e) => {
5
+ const s = e.constructor && e.constructor.prototype;
6
+ return p(s) && s.hasOwnProperty("isPrototypeOf");
7
+ }, Z = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function W(e) {
9
+ if (e instanceof Date)
10
+ return new Date(e);
11
+ const s = typeof FileList < "u" && e instanceof FileList;
12
+ if (Z && (e instanceof Blob || s))
13
+ return e;
14
+ const t = Array.isArray(e);
15
+ if (!t && !(p(e) && Y(e)))
16
+ return e;
17
+ const n = t ? [] : Object.create(Object.getPrototypeOf(e));
18
+ for (const r in e)
19
+ Object.prototype.hasOwnProperty.call(e, r) && (n[r] = W(e[r]));
20
+ return n;
23
21
  }
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;
22
+ var G = (e) => /^\w*$/.test(e), R = (e) => e === void 0, j = (e) => Array.isArray(e) ? e.filter(Boolean) : [], $ = (e) => j(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
23
+ if (!s || !p(e))
24
+ return t;
25
+ const n = (G(s) ? [s] : $(s)).reduce((r, a) => w(r) ? r : r[a], e);
26
+ return R(n) || n === e ? R(e[s]) ? t : e[s] : n;
27
+ }, P = (e) => typeof e == "boolean", E = (e) => typeof e == "function", D = (e, s, t) => {
28
+ let n = -1;
29
+ const r = G(s) ? [s] : $(s), a = r.length, i = a - 1;
30
+ for (; ++n < a; ) {
31
+ const l = r[n];
32
+ let c = t;
33
+ if (n !== i) {
34
+ const f = e[l];
35
+ c = p(f) || Array.isArray(f) ? f : isNaN(+r[n + 1]) ? {} : [];
66
36
  }
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;
37
+ if (l === "__proto__" || l === "constructor" || l === "prototype")
38
+ return;
39
+ e[l] = c, e = e[l];
73
40
  }
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 : "");
41
+ };
42
+ const I = {
43
+ BLUR: "blur",
44
+ CHANGE: "change"
45
+ }, B = {
46
+ all: "all"
47
+ }, L = u.createContext(null);
48
+ L.displayName = "HookFormContext";
49
+ const M = () => u.useContext(L), oe = (e) => {
50
+ const { children: s, ...t } = e;
51
+ return u.createElement(L.Provider, { value: t }, s);
52
+ };
53
+ var ee = (e, s, t, n = !0) => {
54
+ const r = {
55
+ defaultValues: s._defaultValues
56
+ };
57
+ for (const a in e)
58
+ Object.defineProperty(r, a, {
59
+ get: () => {
60
+ const i = a;
61
+ return s._proxyFormState[i] !== B.all && (s._proxyFormState[i] = !n || B.all), t && (t[i] = !0), e[i];
62
+ }
63
+ });
64
+ return r;
65
+ };
66
+ const q = typeof window < "u" ? u.useLayoutEffect : u.useEffect;
67
+ function te(e) {
68
+ const s = M(), { control: t = s.control, disabled: n, name: r, exact: a } = e || {}, [i, l] = u.useState(t._formState), c = u.useRef({
69
+ isDirty: !1,
70
+ isLoading: !1,
71
+ dirtyFields: !1,
72
+ touchedFields: !1,
73
+ validatingFields: !1,
74
+ isValidating: !1,
75
+ isValid: !1,
76
+ errors: !1
77
+ });
78
+ return q(() => t._subscribe({
79
+ name: r,
80
+ formState: c.current,
81
+ exact: a,
82
+ callback: (f) => {
83
+ !n && l({
84
+ ...t._formState,
85
+ ...f
86
+ });
84
87
  }
85
- }
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
- }
88
+ }), [r, n, a]), u.useEffect(() => {
89
+ c.current.isValid && t._setValid(!0);
90
+ }, [t]), u.useMemo(() => ee(i, t, c.current, !1), [i, t]);
90
91
  }
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);
97
- }
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));
92
+ var re = (e) => typeof e == "string", T = (e, s, t, n, r) => re(e) ? y(t, e, r) : Array.isArray(e) ? e.map((a) => y(t, a)) : t, U = (e) => w(e) || !H(e);
93
+ function S(e, s, t = /* @__PURE__ */ new WeakSet()) {
94
+ if (U(e) || U(s))
95
+ return Object.is(e, s);
96
+ if (k(e) && k(s))
97
+ return e.getTime() === s.getTime();
98
+ const n = Object.keys(e), r = Object.keys(s);
99
+ if (n.length !== r.length)
100
+ return !1;
101
+ if (t.has(e) || t.has(s))
102
+ return !0;
103
+ t.add(e), t.add(s);
104
+ for (const a of n) {
105
+ const i = e[a];
106
+ if (!r.includes(a))
107
+ return !1;
108
+ if (a !== "ref") {
109
+ const l = s[a];
110
+ if (k(i) && k(l) || p(i) && p(l) || Array.isArray(i) && Array.isArray(l) ? !S(i, l, t) : !Object.is(i, l))
111
+ return !1;
110
112
  }
111
113
  }
112
- return t;
114
+ return !0;
113
115
  }
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;
116
+ function se(e) {
117
+ const s = M(), { control: t = s.control, name: n, defaultValue: r, disabled: a, exact: i, compute: l } = e || {}, c = u.useRef(r), f = u.useRef(l), V = u.useRef(void 0), d = u.useRef(t), g = u.useRef(n);
118
+ f.current = l;
119
+ const [A, v] = u.useState(() => {
120
+ const o = t._getWatch(n, c.current);
121
+ return f.current ? f.current(o) : o;
122
+ }), C = u.useCallback((o) => {
123
+ const m = T(n, t._names, o || t._formValues, !1, c.current);
124
+ return f.current ? f.current(m) : m;
125
+ }, [t._formValues, t._names, n]), b = u.useCallback((o) => {
126
+ if (!a) {
127
+ const m = T(n, t._names, o || t._formValues, !1, c.current);
128
+ if (f.current) {
129
+ const _ = f.current(m);
130
+ S(_, V.current) || (v(_), V.current = _);
131
+ } else
132
+ v(m);
127
133
  }
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 }
168
- };
169
- }
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 };
179
- }
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);
211
- }
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
221
- break;
222
- return o;
223
- }
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
- }
134
+ }, [t._formValues, t._names, a, n]);
135
+ q(() => ((d.current !== t || !S(g.current, n)) && (d.current = t, g.current = n, b()), t._subscribe({
136
+ name: n,
137
+ formState: {
138
+ values: !0
139
+ },
140
+ exact: i,
141
+ callback: (o) => {
142
+ b(o.values);
252
143
  }
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);
270
- }
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")
144
+ })), [t, i, n, b]), u.useEffect(() => t._removeUnmounted());
145
+ const h = d.current !== t, F = g.current, O = u.useMemo(() => {
146
+ if (a)
278
147
  return null;
279
- e = e.parent;
280
- }
281
- return {
282
- from: o - t[0].length,
283
- to: o,
284
- options: Se(),
285
- validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
286
- };
148
+ const o = !h && !S(F, n);
149
+ return h || o ? C() : null;
150
+ }, [a, h, n, F, C]);
151
+ return O !== null ? O : A;
287
152
  }
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 : [];
153
+ function ne(e) {
154
+ const s = M(), { name: t, disabled: n, control: r = s.control, shouldUnregister: a, defaultValue: i, exact: l = !0 } = e, c = X(r._names.array, t), f = u.useMemo(() => y(r._formValues, t, y(r._defaultValues, t, i)), [r, t, i]), V = se({
155
+ control: r,
156
+ name: t,
157
+ defaultValue: f,
158
+ exact: l
159
+ }), d = te({
160
+ control: r,
161
+ name: t,
162
+ exact: l
163
+ }), g = u.useRef(e), A = u.useRef(void 0), v = u.useRef(r.register(t, {
164
+ ...e.rules,
165
+ value: V,
166
+ ...P(e.disabled) ? { disabled: e.disabled } : {}
167
+ }));
168
+ g.current = e;
169
+ const C = u.useMemo(() => Object.defineProperties({}, {
170
+ invalid: {
171
+ enumerable: !0,
172
+ get: () => !!y(d.errors, t)
173
+ },
174
+ isDirty: {
175
+ enumerable: !0,
176
+ get: () => !!y(d.dirtyFields, t)
177
+ },
178
+ isTouched: {
179
+ enumerable: !0,
180
+ get: () => !!y(d.touchedFields, t)
181
+ },
182
+ isValidating: {
183
+ enumerable: !0,
184
+ get: () => !!y(d.validatingFields, t)
185
+ },
186
+ error: {
187
+ enumerable: !0,
188
+ get: () => y(d.errors, t)
189
+ }
190
+ }), [d, t]), b = u.useCallback((o) => v.current.onChange({
191
+ target: {
192
+ value: J(o),
193
+ name: t
194
+ },
195
+ type: I.CHANGE
196
+ }), [t]), h = u.useCallback(() => v.current.onBlur({
197
+ target: {
198
+ value: y(r._formValues, t),
199
+ name: t
200
+ },
201
+ type: I.BLUR
202
+ }), [t, r._formValues]), F = u.useCallback((o) => {
203
+ const m = y(r._fields, t);
204
+ m && m._f && o && (m._f.ref = {
205
+ focus: () => E(o.focus) && o.focus(),
206
+ select: () => E(o.select) && o.select(),
207
+ setCustomValidity: (_) => E(o.setCustomValidity) && o.setCustomValidity(_),
208
+ reportValidity: () => E(o.reportValidity) && o.reportValidity()
209
+ });
210
+ }, [r._fields, t]), O = u.useMemo(() => ({
211
+ name: t,
212
+ value: V,
213
+ ...P(n) || d.disabled ? { disabled: d.disabled || n } : {},
214
+ onChange: b,
215
+ onBlur: h,
216
+ ref: F
217
+ }), [t, n, d.disabled, b, h, F, V]);
218
+ return u.useEffect(() => {
219
+ const o = r._options.shouldUnregister || a, m = A.current;
220
+ m && m !== t && !c && r.unregister(m), r.register(t, {
221
+ ...g.current.rules,
222
+ ...P(g.current.disabled) ? { disabled: g.current.disabled } : {}
223
+ });
224
+ const _ = (x, K) => {
225
+ const N = y(r._fields, x);
226
+ N && N._f && (N._f.mount = K);
227
+ };
228
+ if (_(t, !0), o) {
229
+ const x = W(y(r._options.defaultValues, t, g.current.defaultValue));
230
+ D(r._defaultValues, t, x), R(y(r._formValues, t)) && D(r._formValues, t, x);
231
+ }
232
+ return !c && r.register(t), A.current = t, () => {
233
+ (c ? o && !r._state.action : o) ? r.unregister(t) : _(t, !1);
234
+ };
235
+ }, [t, r, c, a]), u.useEffect(() => {
236
+ r._setDisabledField({
237
+ disabled: n,
238
+ name: t
239
+ });
240
+ }, [n, t, r]), u.useMemo(() => ({
241
+ field: O,
242
+ formState: d,
243
+ fieldState: C
244
+ }), [O, d, C]);
294
245
  }
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);
319
- }
320
- });
246
+ const ae = (e) => e.render(ne(e));
321
247
  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
248
+ ae as Controller,
249
+ oe as FormProvider,
250
+ y as get,
251
+ D as set,
252
+ ne as useController,
253
+ M as useFormContext,
254
+ te as useFormState,
255
+ se as useWatch
330
256
  };
package/dist/index7.js CHANGED
@@ -1,42 +1,42 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import { Root as s, Image as t, Fallback as m } from "./index46.js";
4
- import { cn as o } from "./index2.js";
5
- const d = f.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ l(
2
+ import * as o from "react";
3
+ import { Root as s, Image as t, Fallback as d } from "./index52.js";
4
+ import { cn as m } from "./index2.js";
5
+ const f = o.forwardRef(({ className: a, ...r }, e) => /* @__PURE__ */ l(
6
6
  s,
7
7
  {
8
- ref: r,
9
- className: o(
10
- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full border border-[#00ff00]",
8
+ ref: e,
9
+ className: m(
10
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full border border-primary",
11
11
  a
12
12
  ),
13
- ...e
13
+ ...r
14
14
  }
15
15
  ));
16
- d.displayName = s.displayName;
17
- const i = f.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ l(
16
+ f.displayName = s.displayName;
17
+ const i = o.forwardRef(({ className: a, ...r }, e) => /* @__PURE__ */ l(
18
18
  t,
19
19
  {
20
- ref: r,
21
- className: o("aspect-square h-full w-full", a),
22
- ...e
20
+ ref: e,
21
+ className: m("aspect-square h-full w-full", a),
22
+ ...r
23
23
  }
24
24
  ));
25
25
  i.displayName = t.displayName;
26
- const c = f.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ l(
27
- m,
26
+ const p = o.forwardRef(({ className: a, ...r }, e) => /* @__PURE__ */ l(
27
+ d,
28
28
  {
29
- ref: r,
30
- className: o(
31
- "flex h-full w-full items-center justify-center rounded-full bg-black border border-[#00ff00] text-[#00ff00]",
29
+ ref: e,
30
+ className: m(
31
+ "flex h-full w-full items-center justify-center rounded-full bg-background border border-primary text-primary",
32
32
  a
33
33
  ),
34
- ...e
34
+ ...r
35
35
  }
36
36
  ));
37
- c.displayName = m.displayName;
37
+ p.displayName = d.displayName;
38
38
  export {
39
- d as Avatar,
40
- c as AvatarFallback,
39
+ f as Avatar,
40
+ p as AvatarFallback,
41
41
  i as AvatarImage
42
42
  };