@code0-tech/pictor 0.0.0-mvp.29 → 0.0.0-mvp.30

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 (125) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +4 -0
  3. package/dist/_virtual/index2.js +4 -0
  4. package/dist/_virtual/react-contenteditable.js +7 -0
  5. package/dist/_virtual/react-contenteditable2.js +4 -0
  6. package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
  7. package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
  8. package/dist/_virtual/react-dom-server.browser.development.js +4 -0
  9. package/dist/_virtual/react-dom-server.browser.production.js +4 -0
  10. package/dist/_virtual/react-is.development.js +4 -0
  11. package/dist/_virtual/react-is.production.min.js +4 -0
  12. package/dist/_virtual/server.browser.js +5 -0
  13. package/dist/_virtual/server.browser2.js +4 -0
  14. package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
  15. package/dist/assets/components/form/Input.style.css +1 -1
  16. package/dist/components/breadcrumb/Breadcrumb.js +12 -12
  17. package/dist/components/button-group/ButtonGroup.js +12 -12
  18. package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
  19. package/dist/components/d-flow/DFlow.js +304 -268
  20. package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
  21. package/dist/components/d-flow/DFlow.service.d.ts +3 -2
  22. package/dist/components/d-flow/DFlow.service.js +62 -47
  23. package/dist/components/d-flow/DFlow.util.d.ts +4 -0
  24. package/dist/components/d-flow/DFlow.util.js +63 -0
  25. package/dist/components/d-flow/DFlowEdge.js +34 -34
  26. package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
  27. package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
  28. package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
  29. package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
  30. package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
  31. package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
  32. package/dist/components/d-flow-file/DFlowTabs.js +26 -27
  33. package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
  34. package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
  35. package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
  36. package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
  37. package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
  38. package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
  39. package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
  40. package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
  41. package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
  42. package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
  43. package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
  44. package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
  45. package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
  46. package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
  47. package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
  48. package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
  49. package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
  50. package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
  51. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
  52. package/dist/components/d-flow-panel/DFlowExport.js +1 -1
  53. package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
  54. package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
  55. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
  56. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
  57. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
  58. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
  59. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
  60. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
  61. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
  62. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
  63. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
  64. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
  65. package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
  66. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
  67. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
  68. package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
  69. package/dist/components/d-flow-type/DFlowType.view.js +22 -12
  70. package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
  71. package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
  72. package/dist/components/d-resizable/DResizable.d.ts +4 -4
  73. package/dist/components/d-resizable/DResizable.js +22 -21
  74. package/dist/components/d-user/DUserInput.js +23 -21
  75. package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
  76. package/dist/components/file-tabs/FileTabs.service.js +49 -53
  77. package/dist/components/form/EmailInput.js +9 -9
  78. package/dist/components/form/Input.d.ts +2 -1
  79. package/dist/components/form/Input.js +294 -397
  80. package/dist/components/form/Input.syntax.hook.d.ts +1 -18
  81. package/dist/components/form/Input.syntax.hook.js +7 -73
  82. package/dist/components/form/Input.utils.d.ts +1 -2
  83. package/dist/components/form/Input.utils.js +26 -21
  84. package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
  85. package/dist/components/form/InputContentEditable.hook.js +471 -0
  86. package/dist/components/form/InputSuggestion.d.ts +2 -2
  87. package/dist/components/form/InputSuggestion.js +169 -107
  88. package/dist/components/form/PasswordInput.js +8 -8
  89. package/dist/components/form/TextInput.js +11 -11
  90. package/dist/components/form/useForm.d.ts +1 -0
  91. package/dist/components/form/useForm.js +45 -60
  92. package/dist/components/menu/Menu.js +4 -4
  93. package/dist/index.js +155 -154
  94. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
  95. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
  96. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
  97. package/dist/node_modules/fast-deep-equal/index.js +31 -0
  98. package/dist/node_modules/object-assign/index.js +49 -0
  99. package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
  100. package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  101. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  102. package/dist/node_modules/prop-types/index.js +17 -0
  103. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  104. package/dist/node_modules/prop-types/lib/has.js +7 -0
  105. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
  106. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
  107. package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
  108. package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
  109. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
  110. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
  111. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
  112. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
  113. package/dist/node_modules/react-dom/server.browser.js +15 -0
  114. package/dist/utils/generics.d.ts +2 -0
  115. package/dist/utils/generics.js +93 -80
  116. package/dist/utils/index.js +22 -21
  117. package/dist/utils/inspection.d.ts +4 -2
  118. package/dist/utils/inspection.js +27 -2
  119. package/package.json +10 -8
  120. package/dist/components/form/Input.selection.hook.d.ts +0 -17
  121. package/dist/components/form/Input.selection.hook.js +0 -78
  122. package/dist/components/form/InputSyntax.d.ts +0 -19
  123. package/dist/components/form/InputSyntax.js +0 -52
  124. package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
  125. package/dist/components/form/inputSyntaxMapping.js +0 -42
@@ -0,0 +1,471 @@
1
+ import { jsx as ee, Fragment as te } from "react/jsx-runtime";
2
+ import { c as ne } from "../../_virtual/compiler-runtime.js";
3
+ import re from "react";
4
+ import { s as oe } from "../../_virtual/server.browser.js";
5
+ import { buildDefaultSyntax as se } from "./Input.syntax.hook.js";
6
+ const I = "input__token", j = "input__token--selected", Q = "title", k = "​", O = (t) => (t ?? "").split(k).join(""), L = (t) => !!t && t.nodeType === Node.TEXT_NODE && (t.textContent ?? "") === k, U = (t) => {
7
+ try {
8
+ return JSON.stringify(t);
9
+ } catch {
10
+ return JSON.stringify({
11
+ value: String(t ?? "")
12
+ });
13
+ }
14
+ }, ie = (t) => {
15
+ if (!t) return null;
16
+ try {
17
+ return JSON.parse(t);
18
+ } catch {
19
+ return null;
20
+ }
21
+ }, X = (t) => t == null ? "" : typeof t == "string" ? t : U(t), H = (t) => {
22
+ const e = (t.innerHTML ?? "").trim().toLowerCase();
23
+ (e === "<br>" || e === "<br/>" || e === "<br />") && (t.innerHTML = ""), t.childNodes.length === 1 && t.childNodes[0]?.tagName === "BR" && (t.innerHTML = "");
24
+ }, S = (t) => t instanceof HTMLElement && t.classList.contains(I), ae = (t) => {
25
+ let e = t;
26
+ for (; e; ) {
27
+ if (S(e)) return !0;
28
+ e = e.parentNode;
29
+ }
30
+ return !1;
31
+ }, ce = (t) => {
32
+ if (t && typeof t == "object") {
33
+ const {
34
+ children: e,
35
+ __contentHtml: n,
36
+ ...r
37
+ } = t;
38
+ return r;
39
+ }
40
+ return {
41
+ value: t
42
+ };
43
+ }, P = (t) => ie(t.getAttribute(Q)) ?? {
44
+ value: t.textContent ?? ""
45
+ }, G = (t, e) => {
46
+ const n = document.createElement("span");
47
+ n.setAttribute("contenteditable", "false"), n.className = I;
48
+ const r = ce(t);
49
+ if (n.setAttribute(Q, U(r)), e !== void 0)
50
+ n.innerHTML = e;
51
+ else {
52
+ const i = r?.label ?? r?.value ?? "";
53
+ n.textContent = String(i ?? "");
54
+ }
55
+ return n.style.display = "inline-flex", n.style.alignItems = "center", n.style.verticalAlign = "middle", n.style.userSelect = "text", n.style.webkitUserSelect = "text", n;
56
+ }, K = (t) => {
57
+ const e = window.getSelection();
58
+ if (e && e.rangeCount > 0) {
59
+ const i = e.getRangeAt(0);
60
+ if (t.contains(i.startContainer)) return i;
61
+ }
62
+ const n = document.createRange();
63
+ n.selectNodeContents(t), n.collapse(!1);
64
+ const r = window.getSelection();
65
+ return r?.removeAllRanges(), r?.addRange(n), n;
66
+ }, le = (t, e) => {
67
+ if (!t) return;
68
+ const n = window.getSelection();
69
+ if (!n || n.rangeCount === 0) return;
70
+ const r = n.getRangeAt(0);
71
+ if (!t.contains(r.startContainer)) return;
72
+ r.deleteContents();
73
+ const i = document.createTextNode(e);
74
+ r.insertNode(i);
75
+ const u = document.createRange();
76
+ u.setStartAfter(i), u.collapse(!0), n.removeAllRanges(), n.addRange(u);
77
+ }, de = (t) => {
78
+ if (!t) return [""];
79
+ const e = [], n = (r) => {
80
+ if (r.nodeType === Node.TEXT_NODE) {
81
+ const u = O(r.textContent ?? "");
82
+ u.length && e.push(u);
83
+ return;
84
+ }
85
+ if (r.nodeType !== Node.ELEMENT_NODE) return;
86
+ const i = r;
87
+ if (S(i)) {
88
+ e.push(P(i));
89
+ return;
90
+ }
91
+ Array.from(r.childNodes).forEach(n);
92
+ };
93
+ return Array.from(t.childNodes).forEach(n), e.length ? e.reduce((r, i) => (typeof i == "string" && typeof r[r.length - 1] == "string" ? r[r.length - 1] = `${r[r.length - 1]}${i}` : r.push(i), r), []) : [""];
94
+ }, ue = (t) => t.map((e) => {
95
+ if (typeof e == "string") return e;
96
+ const n = e?.value ?? e;
97
+ return X(n);
98
+ }).join(""), fe = (t) => {
99
+ const {
100
+ children: e,
101
+ __contentHtml: n,
102
+ ...r
103
+ } = t;
104
+ return r;
105
+ }, z = (t) => {
106
+ if (!t) return null;
107
+ const e = window.getSelection();
108
+ if (!e || e.rangeCount === 0) return null;
109
+ const n = e.getRangeAt(0);
110
+ if (!t.contains(n.startContainer)) return null;
111
+ const r = n.startContainer, i = n.startOffset;
112
+ let u = null;
113
+ r.nodeType === Node.ELEMENT_NODE && (u = r.childNodes[i] ?? null);
114
+ const N = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, {
115
+ acceptNode: (o) => o.nodeType === Node.TEXT_NODE ? ae(o) || (o.textContent ?? "") === k ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT : o.nodeType === Node.ELEMENT_NODE && S(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
116
+ });
117
+ let f = null, d = N.nextNode();
118
+ for (; d && !(u && d === u); ) {
119
+ if (d === r && d.nodeType === Node.TEXT_NODE) {
120
+ const o = d.textContent?.slice(0, i) ?? "", s = [...O(o).matchAll(/\S+/g)], a = s[s.length - 1];
121
+ if (a && a.index !== void 0) {
122
+ const m = a.index, g = m + a[0].length, h = document.createRange();
123
+ h.setStart(d, Math.min(m, o.length)), h.setEnd(d, Math.min(g, o.length)), f = {
124
+ token: a[0],
125
+ range: h
126
+ };
127
+ }
128
+ break;
129
+ }
130
+ if (S(d)) {
131
+ f = null, d = N.nextNode();
132
+ continue;
133
+ }
134
+ if (d.nodeType === Node.TEXT_NODE) {
135
+ const o = d.textContent ?? "", s = [...O(o).matchAll(/\S+/g)], a = s[s.length - 1];
136
+ if (a && a.index !== void 0) {
137
+ const m = a.index, g = m + a[0].length, h = document.createRange();
138
+ h.setStart(d, Math.min(m, o.length)), h.setEnd(d, Math.min(g, o.length)), f = {
139
+ token: a[0],
140
+ range: h
141
+ };
142
+ }
143
+ }
144
+ d = N.nextNode();
145
+ }
146
+ return f;
147
+ }, ge = (t) => {
148
+ const e = window.getSelection();
149
+ if (!e || e.rangeCount === 0) return null;
150
+ const n = e.getRangeAt(0);
151
+ if (!t.contains(n.startContainer) || !t.contains(n.endContainer)) return null;
152
+ const r = (f) => {
153
+ if (f.nodeType === Node.TEXT_NODE) return O(f.textContent ?? "").length;
154
+ if (f.nodeType === Node.ELEMENT_NODE) {
155
+ const d = f;
156
+ if (S(d)) {
157
+ const c = P(d);
158
+ return String(c?.value ?? "").length;
159
+ }
160
+ let o = 0;
161
+ return Array.from(f.childNodes).forEach((c) => o += r(c)), o;
162
+ }
163
+ return 0;
164
+ }, i = (f, d) => {
165
+ let o = 0;
166
+ const c = (s) => {
167
+ if (s === f) {
168
+ if (s.nodeType === Node.TEXT_NODE)
169
+ return o += O(s.textContent ?? "").slice(0, d).length, !0;
170
+ if (s.nodeType === Node.ELEMENT_NODE) {
171
+ const a = Array.from(s.childNodes), m = Math.max(0, Math.min(d, a.length));
172
+ for (let g = 0; g < m; g++) o += r(a[g]);
173
+ return !0;
174
+ }
175
+ return !0;
176
+ }
177
+ if (s.nodeType === Node.TEXT_NODE)
178
+ return o += O(s.textContent ?? "").length, !1;
179
+ if (s.nodeType === Node.ELEMENT_NODE) {
180
+ const a = s;
181
+ if (S(a)) {
182
+ const m = P(a);
183
+ return o += String(m?.value ?? "").length, !1;
184
+ }
185
+ for (const m of Array.from(s.childNodes))
186
+ if (c(m)) return !0;
187
+ }
188
+ return !1;
189
+ };
190
+ return c(t), o;
191
+ }, u = i(n.startContainer, n.startOffset), N = i(n.endContainer, n.endOffset);
192
+ return {
193
+ start: Math.min(u, N),
194
+ end: Math.max(u, N)
195
+ };
196
+ }, pe = (t, e, n) => {
197
+ const r = (s) => Math.max(0, s), i = r(e), u = r(n), N = (s) => {
198
+ let a = s;
199
+ const m = (g) => {
200
+ if (g.nodeType === Node.TEXT_NODE) {
201
+ const h = g.textContent ?? "", y = O(h).length;
202
+ return a <= y ? {
203
+ node: g,
204
+ offset: Math.min(a, h.length)
205
+ } : (a -= y, null);
206
+ }
207
+ if (g.nodeType === Node.ELEMENT_NODE) {
208
+ const h = g;
209
+ if (S(h)) {
210
+ const y = P(h), x = String(y?.value ?? "").length, w = h.parentNode ?? t, D = Array.from(w.childNodes).indexOf(h);
211
+ return a <= 0 ? {
212
+ node: w,
213
+ offset: D
214
+ } : a < x ? {
215
+ node: w,
216
+ offset: D + 1
217
+ } : (a -= x, null);
218
+ }
219
+ for (const y of Array.from(g.childNodes)) {
220
+ const x = m(y);
221
+ if (x) return x;
222
+ }
223
+ }
224
+ return null;
225
+ };
226
+ return m(t) ?? {
227
+ node: t,
228
+ offset: t.childNodes.length
229
+ };
230
+ }, f = N(i), d = N(u), o = window.getSelection();
231
+ if (!o) return;
232
+ const c = document.createRange();
233
+ try {
234
+ c.setStart(f.node, f.offset), c.setEnd(d.node, d.offset);
235
+ } catch {
236
+ c.selectNodeContents(t), c.collapse(!1);
237
+ }
238
+ o.removeAllRanges(), o.addRange(c);
239
+ }, he = (t, e, n) => {
240
+ const r = window.getSelection();
241
+ if (!r || typeof r.modify != "function" || !t.contains(r.focusNode) || !t.contains(r.anchorNode)) return !1;
242
+ const i = n === "right" ? "forward" : "backward";
243
+ try {
244
+ return r.modify(e, i, "character"), L(r.focusNode) && r.modify(e, i, "character"), !0;
245
+ } catch {
246
+ return !1;
247
+ }
248
+ }, me = (t) => {
249
+ const e = window.getSelection();
250
+ if (!e || e.rangeCount === 0) return null;
251
+ const n = e.getRangeAt(0);
252
+ return !t.contains(n.startContainer) || !t.contains(n.endContainer) ? null : n;
253
+ }, Ne = (t) => {
254
+ const e = t.parentNode;
255
+ return e ? Array.from(e.childNodes).indexOf(t) : -1;
256
+ }, Te = (t) => {
257
+ const e = t.startContainer, n = t.startOffset;
258
+ if (e.nodeType === Node.ELEMENT_NODE) return {
259
+ parent: e,
260
+ index: n
261
+ };
262
+ if (e.nodeType === Node.TEXT_NODE) {
263
+ const r = e, i = r.textContent ?? "", u = Ne(r);
264
+ return u < 0 || !r.parentNode ? null : i === k ? {
265
+ parent: r.parentNode,
266
+ index: u + (n > 0 ? 1 : 0)
267
+ } : n === 0 ? {
268
+ parent: r.parentNode,
269
+ index: u
270
+ } : n === i.length ? {
271
+ parent: r.parentNode,
272
+ index: u + 1
273
+ } : null;
274
+ }
275
+ return null;
276
+ }, J = (t, e) => {
277
+ const n = window.getSelection();
278
+ if (!n) return;
279
+ const r = document.createRange();
280
+ r.setStart(t, e), r.collapse(!0), n.removeAllRanges(), n.addRange(r);
281
+ }, W = (t, e) => {
282
+ const n = t.childNodes[e - 1];
283
+ n && L(n) && t.removeChild(n);
284
+ const r = Math.max(0, Math.min(e, t.childNodes.length - 1)), i = t.childNodes[r + 1];
285
+ i && L(i) && t.removeChild(i);
286
+ }, ye = (t, e) => {
287
+ const n = me(t);
288
+ if (!n || !n.collapsed) return !1;
289
+ const r = Te(n);
290
+ if (!r) return !1;
291
+ const i = r.parent, u = i.childNodes, N = (c) => {
292
+ let s = c;
293
+ for (; s > 0 && L(u[s - 1]); ) s--;
294
+ return s;
295
+ }, f = (c) => {
296
+ let s = c;
297
+ for (; s < u.length && L(u[s]); ) s++;
298
+ return s;
299
+ };
300
+ if (e === "backspace") {
301
+ const c = N(r.index), s = c > 0 ? u[c - 1] : null;
302
+ if (s && S(s)) {
303
+ const a = c - 1;
304
+ return i.removeChild(s), W(i, a), J(i, Math.max(0, Math.min(a, i.childNodes.length))), !0;
305
+ }
306
+ return !1;
307
+ }
308
+ const d = f(r.index), o = u[d] ?? null;
309
+ if (o && S(o)) {
310
+ const c = d;
311
+ return i.removeChild(o), W(i, c), J(i, Math.max(0, Math.min(c, i.childNodes.length))), !0;
312
+ }
313
+ return !1;
314
+ }, $ = (t) => {
315
+ t.querySelectorAll(`.${I}`).forEach((r) => r.classList.remove(j));
316
+ const e = window.getSelection();
317
+ if (!e || e.rangeCount === 0) return;
318
+ const n = e.getRangeAt(0);
319
+ !t.contains(n.startContainer) || !t.contains(n.endContainer) || t.querySelectorAll(`.${I}`).forEach((r) => {
320
+ try {
321
+ n.intersectsNode(r) && r.classList.add(j);
322
+ } catch {
323
+ }
324
+ });
325
+ }, q = (t, e, n, r) => {
326
+ H(t);
327
+ const i = (n ?? []).filter(Boolean).filter((o) => o && (o.type === "text" || o.type === "block") && Number.isFinite(o.start) && Number.isFinite(o.end) && o.start <= o.end), u = i.length ? i : se(e), N = r.filter((o) => typeof o != "string"), f = document.createDocumentFragment(), d = () => {
328
+ const o = f.lastChild;
329
+ o?.nodeType === Node.TEXT_NODE && (o.textContent ?? "") === k || f.appendChild(document.createTextNode(k));
330
+ };
331
+ u.forEach((o) => {
332
+ if (!o || !o.type) return;
333
+ const c = o.value ?? e.slice(o.start, o.end);
334
+ if (o.type === "text") {
335
+ const g = typeof o.content == "string" ? o.content : typeof c == "string" ? c : e.slice(o.start, o.end);
336
+ g?.length && f.appendChild(document.createTextNode(g));
337
+ return;
338
+ }
339
+ const s = X(c);
340
+ let a;
341
+ if (N.length) {
342
+ const g = N[0], h = X(g?.value ?? g);
343
+ (s === "" || h === s) && (a = g, N.shift());
344
+ }
345
+ a || (a = {
346
+ value: c
347
+ });
348
+ const m = o.content && typeof o.content != "string" ? oe.renderToStaticMarkup(/* @__PURE__ */ ee(te, { children: o.content })) : void 0;
349
+ d(), f.appendChild(G(a, m)), d();
350
+ }), t.innerHTML = "", t.appendChild(f), H(t);
351
+ }, Ae = (t) => {
352
+ const e = ne.c(28), {
353
+ editorRef: n,
354
+ transformSyntax: r,
355
+ filterSuggestionsByLastToken: i,
356
+ onLastTokenChange: u,
357
+ onStateChange: N
358
+ } = t, f = i === void 0 ? !1 : i, [d, o] = re.useState("");
359
+ let c;
360
+ e[0] !== f || e[1] !== u || e[2] !== N || e[3] !== r ? (c = (l) => {
361
+ if (!l)
362
+ return;
363
+ H(l);
364
+ const p = ge(l), T = de(l), R = ue(T), C = T.filter(Ee);
365
+ f && u?.(z(l)?.token ?? null);
366
+ let M = null;
367
+ r && (M = r(R, T), q(l, R, M, T)), p ? pe(l, p.start, p.end) : K(l), $(l);
368
+ const A = l.innerHTML ?? "";
369
+ o((v) => v === A ? v : A), N?.({
370
+ value: R,
371
+ tokens: C,
372
+ segments: M
373
+ });
374
+ }, e[0] = f, e[1] = u, e[2] = N, e[3] = r, e[4] = c) : c = e[4];
375
+ const s = c;
376
+ let a;
377
+ e[5] !== r ? (a = (l) => {
378
+ const p = document.createElement("div"), T = [], R = r ? r(l, T) : null;
379
+ q(p, l, R, T);
380
+ const C = p.innerHTML ?? "";
381
+ return o(C), C;
382
+ }, e[5] = r, e[6] = a) : a = e[6];
383
+ const m = a;
384
+ let g;
385
+ e[7] !== n || e[8] !== f || e[9] !== s ? (g = (l) => {
386
+ const p = n.current;
387
+ if (!p)
388
+ return;
389
+ H(p), p.focus({
390
+ preventScroll: !0
391
+ });
392
+ const T = l.insertMode ?? "replace", C = (() => {
393
+ const E = document.createRange();
394
+ switch (T) {
395
+ case "append":
396
+ return E.selectNodeContents(p), E.collapse(!1), E;
397
+ case "prepend":
398
+ return E.selectNodeContents(p), E.collapse(!0), E;
399
+ case "replace":
400
+ return E.selectNodeContents(p), E;
401
+ case "insert":
402
+ default:
403
+ return K(p);
404
+ }
405
+ })(), M = fe(l);
406
+ if (f && T !== "replace") {
407
+ const E = z(p);
408
+ E ? E.range.deleteContents() : C.deleteContents();
409
+ } else
410
+ C.deleteContents();
411
+ const A = G(M), v = document.createTextNode(k), B = document.createTextNode(k);
412
+ C.insertNode(v), C.insertNode(A), A.parentNode?.insertBefore(B, A.nextSibling ?? null);
413
+ const Z = window.getSelection(), F = document.createRange();
414
+ try {
415
+ F.setStart(B, 1);
416
+ } catch {
417
+ F.setStartAfter(A);
418
+ }
419
+ F.collapse(!0), Z?.removeAllRanges(), Z?.addRange(F), s(p);
420
+ }, e[7] = n, e[8] = f, e[9] = s, e[10] = g) : g = e[10];
421
+ const h = g;
422
+ let y;
423
+ e[11] !== n || e[12] !== s ? (y = (l) => {
424
+ l.preventDefault();
425
+ const p = l.clipboardData.getData("text/plain");
426
+ le(n.current, p), s(n.current);
427
+ }, e[11] = n, e[12] = s, e[13] = y) : y = e[13];
428
+ const x = y;
429
+ let w;
430
+ e[14] !== n || e[15] !== s ? (w = (l) => {
431
+ s(n.current);
432
+ }, e[14] = n, e[15] = s, e[16] = w) : w = e[16];
433
+ const D = w, Y = xe;
434
+ let _;
435
+ e[17] !== n || e[18] !== s ? (_ = (l) => {
436
+ const p = n.current;
437
+ if (!p || document.activeElement !== p)
438
+ return !1;
439
+ if ((l.key === "Backspace" || l.key === "Delete") && ye(p, l.key === "Backspace" ? "backspace" : "delete"))
440
+ return l.preventDefault(), l.stopPropagation(), s(p), !0;
441
+ if (l.key === "ArrowLeft" || l.key === "ArrowRight") {
442
+ const T = l.key === "ArrowLeft" ? "left" : "right";
443
+ if (he(p, l.shiftKey ? "extend" : "move", T))
444
+ return l.preventDefault(), l.stopPropagation(), $(p), !0;
445
+ }
446
+ return l.key === "Enter" ? (l.preventDefault(), !0) : !1;
447
+ }, e[17] = n, e[18] = s, e[19] = _) : _ = e[19];
448
+ const V = _;
449
+ let b;
450
+ return e[20] !== h || e[21] !== d || e[22] !== D || e[23] !== V || e[24] !== x || e[25] !== m || e[26] !== s ? (b = {
451
+ editorHtml: d,
452
+ setEditorHtml: o,
453
+ initializeFromExternalValue: m,
454
+ updateEditorState: s,
455
+ applySuggestionValueSyntax: h,
456
+ handlePaste: x,
457
+ handleChange: D,
458
+ handleKeyDownCapture: Y,
459
+ handleKeyDown: V
460
+ }, e[20] = h, e[21] = d, e[22] = D, e[23] = V, e[24] = x, e[25] = m, e[26] = s, e[27] = b) : b = e[27], b;
461
+ };
462
+ function Ee(t) {
463
+ return typeof t != "string";
464
+ }
465
+ function xe(t) {
466
+ (t.key === " " || t.code === "Space") && (t.stopPropagation(), t.nativeEvent?.stopImmediatePropagation?.());
467
+ }
468
+ export {
469
+ de as serializeEditorParts,
470
+ Ae as useContentEditableController
471
+ };
@@ -23,5 +23,5 @@ export interface InputSuggestionMenuContentItemsHandle {
23
23
  selectActiveItem: () => InputSuggestion | undefined;
24
24
  clearActiveItem: () => void;
25
25
  }
26
- export declare const InputSuggestionMenuContent: React.FC<InputSuggestionMenuContentProps>;
27
- export declare const InputSuggestionMenuContentItems: React.FC<InputSuggestionMenuContentItemsProps>;
26
+ export declare const InputSuggestionMenuContent: React.NamedExoticComponent<InputSuggestionMenuContentProps>;
27
+ export declare const InputSuggestionMenuContentItems: React.NamedExoticComponent<InputSuggestionMenuContentItemsProps>;