@code0-tech/pictor 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/compiler-runtime.js +5 -0
- package/dist/_virtual/compiler-runtime2.js +4 -0
- package/dist/_virtual/react-compiler-runtime.development.js +4 -0
- package/dist/_virtual/react-compiler-runtime.production.js +4 -0
- package/dist/assets/components/alert/Alert.style.css +1 -0
- package/dist/assets/components/aurora/Aurora.style.css +1 -0
- package/dist/assets/components/avatar/Avatar.style.css +1 -0
- package/dist/assets/components/badge/Badge.style.css +1 -0
- package/dist/assets/components/breadcrumb/Breadcrumb.style.css +1 -0
- package/dist/assets/components/button/Button.style.css +1 -0
- package/dist/assets/components/button-group/ButtonGroup.style.css +1 -0
- package/dist/assets/components/card/Card.style.css +1 -0
- package/dist/assets/components/col/Col.style.css +1 -0
- package/dist/assets/components/command/Command.style.css +1 -0
- package/dist/assets/components/container/Container.style.css +1 -0
- package/dist/assets/components/context-menu/ContextMenu.style.css +1 -0
- package/dist/assets/components/data-table/DataTable.style.css +1 -0
- package/dist/assets/components/dialog/Dialog.style.css +1 -0
- package/dist/assets/components/editor/Editor.styles.css +1 -0
- package/dist/assets/components/file-tabs/FileTabs.style.css +1 -0
- package/dist/assets/components/flex/Flex.style.css +1 -0
- package/dist/assets/components/form/Input.style.css +1 -0
- package/dist/assets/components/fullscreen/FullScreen.style.css +1 -0
- package/dist/assets/components/layout/Layout.style.css +1 -0
- package/dist/assets/components/menu/Menu.style.css +1 -0
- package/dist/assets/components/quote/Quote.style.css +1 -0
- package/dist/assets/components/resizable/Resizable.style.css +1 -0
- package/dist/assets/components/row/Row.style.css +1 -0
- package/dist/assets/components/scroll-area/ScrollArea.style.css +1 -0
- package/dist/assets/components/segmented-control/SegmentedControl.style.css +1 -0
- package/dist/assets/components/spacing/Spacing.style.css +1 -0
- package/dist/assets/components/tab/Tab.style.css +1 -0
- package/dist/assets/components/text/Text.style.css +1 -0
- package/dist/assets/components/toast/Toast.style.css +1 -0
- package/dist/assets/components/tooltip/Tooltip.style.css +1 -0
- package/dist/components/alert/Alert.d.ts +7 -0
- package/dist/components/alert/Alert.js +39 -0
- package/dist/components/aurora/Aurora.d.ts +5 -0
- package/dist/components/aurora/Aurora.js +23 -0
- package/dist/components/avatar/Avatar.d.ts +10 -0
- package/dist/components/avatar/Avatar.js +53 -0
- package/dist/components/badge/Badge.d.ts +8 -0
- package/dist/components/badge/Badge.js +63 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +7 -0
- package/dist/components/breadcrumb/Breadcrumb.js +19 -0
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +31 -0
- package/dist/components/button-group/ButtonGroup.d.ts +8 -0
- package/dist/components/button-group/ButtonGroup.js +28 -0
- package/dist/components/card/Card.d.ts +15 -0
- package/dist/components/card/Card.js +42 -0
- package/dist/components/card/CardSection.d.ts +10 -0
- package/dist/components/card/CardSection.js +28 -0
- package/dist/{esm/components → components}/col/Col.d.ts +3 -5
- package/dist/components/col/Col.js +27 -0
- package/dist/components/command/Command.d.ts +30 -0
- package/dist/components/command/Command.js +103 -0
- package/dist/components/container/Container.d.ts +6 -0
- package/dist/components/container/Container.js +21 -0
- package/dist/components/context-menu/ContextMenu.d.ts +31 -0
- package/dist/components/context-menu/ContextMenu.js +106 -0
- package/dist/components/data-table/DataTable.d.ts +23 -0
- package/dist/components/data-table/DataTable.js +41 -0
- package/dist/components/data-table/DataTableColumn.d.ts +6 -0
- package/dist/components/data-table/DataTableColumn.js +22 -0
- package/dist/components/data-table/DataTableFilterInput.d.ts +18 -0
- package/dist/components/data-table/DataTableFilterInput.js +212 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.d.ts +7 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.js +53 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +11 -0
- package/dist/components/dialog/Dialog.d.ts +29 -0
- package/dist/components/dialog/Dialog.js +102 -0
- package/dist/components/editor/Editor.d.ts +29 -0
- package/dist/components/editor/Editor.js +337 -0
- package/dist/components/file-tabs/FileTabs.d.ts +17 -0
- package/dist/components/file-tabs/FileTabs.js +71 -0
- package/dist/components/file-tabs/FileTabs.service.d.ts +17 -0
- package/dist/components/file-tabs/FileTabs.service.js +88 -0
- package/dist/components/file-tabs/FileTabs.view.d.ts +10 -0
- package/dist/components/file-tabs/FileTabs.view.js +1 -0
- package/dist/components/file-tabs/index.d.ts +3 -0
- package/dist/components/file-tabs/index.js +9 -0
- package/dist/components/flex/Flex.d.ts +7 -0
- package/dist/components/flex/Flex.js +21 -0
- package/dist/components/form/CheckboxInput.d.ts +5 -0
- package/dist/components/form/CheckboxInput.js +76 -0
- package/dist/components/form/EmailInput.d.ts +8 -0
- package/dist/components/form/EmailInput.js +21 -0
- package/dist/components/form/Input.d.ts +35 -0
- package/dist/components/form/Input.js +434 -0
- package/dist/components/form/Input.syntax.hook.d.ts +10 -0
- package/dist/components/form/Input.syntax.hook.js +14 -0
- package/dist/components/form/Input.utils.d.ts +10 -0
- package/dist/components/form/Input.utils.js +38 -0
- package/dist/components/form/InputContentEditable.hook.d.ts +52 -0
- package/dist/components/form/InputContentEditable.hook.js +449 -0
- package/dist/components/form/InputDescription.d.ts +5 -0
- package/dist/components/form/InputDescription.js +12 -0
- package/dist/components/form/InputLabel.d.ts +5 -0
- package/dist/components/form/InputLabel.js +12 -0
- package/dist/components/form/InputMessage.d.ts +5 -0
- package/dist/components/form/InputMessage.js +18 -0
- package/dist/components/form/InputSuggestion.d.ts +27 -0
- package/dist/components/form/InputSuggestion.js +218 -0
- package/dist/components/form/NumberInput.d.ts +6 -0
- package/dist/components/form/NumberInput.js +20 -0
- package/dist/components/form/PasswordInput.d.ts +8 -0
- package/dist/components/form/PasswordInput.js +19 -0
- package/dist/components/form/PinInput.d.ts +11 -0
- package/dist/components/form/PinInput.js +66 -0
- package/dist/components/form/RadioGroup.d.ts +5 -0
- package/dist/components/form/RadioGroup.js +48 -0
- package/dist/components/form/RadioInput.d.ts +7 -0
- package/dist/components/form/RadioInput.js +27 -0
- package/dist/components/form/SwitchInput.d.ts +6 -0
- package/dist/components/form/SwitchInput.js +19 -0
- package/dist/components/form/TextAreaInput.d.ts +7 -0
- package/dist/components/form/TextAreaInput.js +20 -0
- package/dist/components/form/TextInput.d.ts +7 -0
- package/dist/components/form/TextInput.js +20 -0
- package/dist/components/form/index.d.ts +17 -0
- package/dist/components/form/index.js +40 -0
- package/dist/components/form/useForm.d.ts +30 -0
- package/dist/components/form/useForm.js +78 -0
- package/dist/components/fullscreen/FullScreen.d.ts +6 -0
- package/dist/components/fullscreen/FullScreen.js +26 -0
- package/dist/components/layout/Layout.d.ts +12 -0
- package/dist/components/layout/Layout.js +75 -0
- package/dist/components/menu/Menu.d.ts +35 -0
- package/dist/components/menu/Menu.js +120 -0
- package/dist/components/quote/Quote.d.ts +10 -0
- package/dist/components/quote/Quote.js +44 -0
- package/dist/components/resizable/Resizable.d.ts +12 -0
- package/dist/components/resizable/Resizable.js +34 -0
- package/dist/components/row/Row.d.ts +6 -0
- package/dist/components/row/Row.js +21 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +13 -0
- package/dist/components/scroll-area/ScrollArea.js +43 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +10 -0
- package/dist/components/segmented-control/SegmentedControl.js +26 -0
- package/dist/components/spacing/Spacing.d.ts +6 -0
- package/dist/components/spacing/Spacing.js +23 -0
- package/dist/components/tab/Tab.d.ts +11 -0
- package/dist/components/tab/Tab.js +40 -0
- package/dist/components/text/Text.d.ts +8 -0
- package/dist/components/text/Text.js +23 -0
- package/dist/components/toast/Toast.d.ts +13 -0
- package/dist/components/toast/Toast.js +66 -0
- package/dist/components/tooltip/Tooltip.d.ts +17 -0
- package/dist/components/tooltip/Tooltip.js +48 -0
- package/dist/index.d.ts +33 -305
- package/dist/index.js +191 -0
- package/dist/node_modules/@lezer/common/dist/index.js +146 -0
- package/dist/node_modules/@lezer/highlight/dist/index.js +543 -0
- package/dist/node_modules/prettier/plugins/babel.js +7157 -0
- package/dist/node_modules/prettier/plugins/estree.js +4453 -0
- package/dist/node_modules/prettier/standalone.js +2429 -0
- package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +21 -0
- package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +14 -0
- package/dist/node_modules/react/compiler-runtime.js +10 -0
- package/dist/utils/arrayService.d.ts +10 -0
- package/dist/utils/arrayService.js +1 -0
- package/dist/utils/contextStore.d.ts +62 -0
- package/dist/utils/contextStore.js +60 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/inspection.d.ts +15 -0
- package/dist/utils/inspection.js +29 -0
- package/dist/utils/nonReactiveArrayService.d.ts +19 -0
- package/dist/utils/nonReactiveArrayService.js +54 -0
- package/dist/utils/objectStore.d.ts +12 -0
- package/dist/utils/objectStore.js +34 -0
- package/dist/utils/reactiveArrayService.d.ts +23 -0
- package/dist/utils/reactiveArrayService.js +90 -0
- package/dist/{cjs/utils → utils}/types.d.ts +4 -4
- package/dist/utils/types.js +4 -0
- package/dist/utils/utils.d.ts +55 -0
- package/dist/utils/utils.js +159 -0
- package/dist/utils/view.d.ts +8 -0
- package/dist/utils/view.js +28 -0
- package/package.json +130 -54
- package/dist/cjs/components/Text/Text.d.ts +0 -10
- package/dist/cjs/components/alert/Alert.d.ts +0 -16
- package/dist/cjs/components/badge/Badge.d.ts +0 -9
- package/dist/cjs/components/button/Button.d.ts +0 -17
- package/dist/cjs/components/button-group/ButtonGroup.d.ts +0 -9
- package/dist/cjs/components/card/Card.d.ts +0 -20
- package/dist/cjs/components/col/Col.d.ts +0 -15
- package/dist/cjs/components/container/Container.d.ts +0 -8
- package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -24
- package/dist/cjs/components/dropdown/DropdownFooter.d.ts +0 -13
- package/dist/cjs/components/dropdown/DropdownHeader.d.ts +0 -13
- package/dist/cjs/components/dropdown/DropdownItem.d.ts +0 -12
- package/dist/cjs/components/dropdown/DropdownItemGroup.d.ts +0 -12
- package/dist/cjs/components/flex/Flex.d.ts +0 -8
- package/dist/cjs/components/input/Input.d.ts +0 -37
- package/dist/cjs/components/list-group/ListGroup.d.ts +0 -12
- package/dist/cjs/components/menu/InternalMenu.d.ts +0 -4
- package/dist/cjs/components/menu/Menu.d.ts +0 -41
- package/dist/cjs/components/popover/InternalPopover.d.ts +0 -10
- package/dist/cjs/components/popover/Popover.d.ts +0 -16
- package/dist/cjs/components/quote/Quote.d.ts +0 -12
- package/dist/cjs/components/row/Row.d.ts +0 -8
- package/dist/cjs/components/tooltip/Tooltip.d.ts +0 -18
- package/dist/cjs/index.d.ts +0 -17
- package/dist/cjs/index.js +0 -9284
- package/dist/cjs/utils/utils.d.ts +0 -18
- package/dist/esm/components/Text/Text.d.ts +0 -10
- package/dist/esm/components/alert/Alert.d.ts +0 -16
- package/dist/esm/components/badge/Badge.d.ts +0 -9
- package/dist/esm/components/button/Button.d.ts +0 -17
- package/dist/esm/components/button-group/ButtonGroup.d.ts +0 -9
- package/dist/esm/components/card/Card.d.ts +0 -20
- package/dist/esm/components/container/Container.d.ts +0 -8
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -24
- package/dist/esm/components/dropdown/DropdownFooter.d.ts +0 -13
- package/dist/esm/components/dropdown/DropdownHeader.d.ts +0 -13
- package/dist/esm/components/dropdown/DropdownItem.d.ts +0 -12
- package/dist/esm/components/dropdown/DropdownItemGroup.d.ts +0 -12
- package/dist/esm/components/flex/Flex.d.ts +0 -8
- package/dist/esm/components/input/Input.d.ts +0 -37
- package/dist/esm/components/list-group/ListGroup.d.ts +0 -12
- package/dist/esm/components/menu/InternalMenu.d.ts +0 -4
- package/dist/esm/components/menu/Menu.d.ts +0 -41
- package/dist/esm/components/popover/InternalPopover.d.ts +0 -10
- package/dist/esm/components/popover/Popover.d.ts +0 -16
- package/dist/esm/components/quote/Quote.d.ts +0 -12
- package/dist/esm/components/row/Row.d.ts +0 -8
- package/dist/esm/components/tooltip/Tooltip.d.ts +0 -18
- package/dist/esm/index.d.ts +0 -17
- package/dist/esm/index.js +0 -9259
- package/dist/esm/utils/types.d.ts +0 -57
- package/dist/esm/utils/utils.d.ts +0 -18
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { c as Y } from "../../_virtual/compiler-runtime.js";
|
|
2
|
+
import Z from "react";
|
|
3
|
+
const F = "input__token", K = "input__token--selected", q = "aria-data", O = "", k = (t) => (t ?? "").split(O).join(""), D = (t) => !!t && t.nodeType === Node.TEXT_NODE && (t.textContent ?? "") === O, U = (t) => {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.stringify(t);
|
|
6
|
+
} catch {
|
|
7
|
+
return JSON.stringify({
|
|
8
|
+
value: String(t ?? "")
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}, ee = (t) => {
|
|
12
|
+
if (!t) return null;
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(t);
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}, te = (t) => t == null ? "" : typeof t == "string" ? t : U(t), j = (t) => {
|
|
19
|
+
const e = (t.innerHTML ?? "").trim().toLowerCase();
|
|
20
|
+
(e === "<br>" || e === "<br/>" || e === "<br />") && (t.innerHTML = ""), t.childNodes.length === 1 && t.childNodes[0]?.tagName === "BR" && (t.innerHTML = "");
|
|
21
|
+
}, C = (t) => t instanceof HTMLElement && t.classList.contains(F), ne = (t) => {
|
|
22
|
+
let e = t;
|
|
23
|
+
for (; e; ) {
|
|
24
|
+
if (C(e)) return !0;
|
|
25
|
+
e = e.parentNode;
|
|
26
|
+
}
|
|
27
|
+
return !1;
|
|
28
|
+
}, re = (t) => {
|
|
29
|
+
if (t && typeof t == "object") {
|
|
30
|
+
const {
|
|
31
|
+
children: e,
|
|
32
|
+
__contentHtml: r,
|
|
33
|
+
...n
|
|
34
|
+
} = t;
|
|
35
|
+
return n;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
value: t
|
|
39
|
+
};
|
|
40
|
+
}, P = (t) => ee(t.getAttribute(q)) ?? {
|
|
41
|
+
value: t.textContent ?? ""
|
|
42
|
+
}, oe = (t) => {
|
|
43
|
+
const e = document.createElement("span");
|
|
44
|
+
e.setAttribute("contenteditable", "false"), e.className = F;
|
|
45
|
+
const r = re(t);
|
|
46
|
+
e.setAttribute(q, U(r));
|
|
47
|
+
const n = r?.label ?? r?.value ?? "";
|
|
48
|
+
return e.textContent = String(n ?? ""), e.style.display = "inline-flex", e.style.alignItems = "center", e.style.verticalAlign = "middle", e.style.userSelect = "text", e.style.webkitUserSelect = "text", e;
|
|
49
|
+
}, se = (t) => {
|
|
50
|
+
const e = window.getSelection();
|
|
51
|
+
if (e && e.rangeCount > 0) {
|
|
52
|
+
const o = e.getRangeAt(0);
|
|
53
|
+
if (t.contains(o.startContainer)) return o;
|
|
54
|
+
}
|
|
55
|
+
const r = document.createRange();
|
|
56
|
+
r.selectNodeContents(t), r.collapse(!1);
|
|
57
|
+
const n = window.getSelection();
|
|
58
|
+
return n?.removeAllRanges(), n?.addRange(r), r;
|
|
59
|
+
}, ae = (t, e) => {
|
|
60
|
+
if (!t) return;
|
|
61
|
+
const r = window.getSelection();
|
|
62
|
+
if (!r || r.rangeCount === 0) return;
|
|
63
|
+
const n = r.getRangeAt(0);
|
|
64
|
+
if (!t.contains(n.startContainer)) return;
|
|
65
|
+
n.deleteContents();
|
|
66
|
+
const o = document.createTextNode(e);
|
|
67
|
+
n.insertNode(o);
|
|
68
|
+
const l = document.createRange();
|
|
69
|
+
l.setStartAfter(o), l.collapse(!0), r.removeAllRanges(), r.addRange(l);
|
|
70
|
+
}, ce = (t) => {
|
|
71
|
+
if (!t) return [""];
|
|
72
|
+
const e = [], r = (n) => {
|
|
73
|
+
if (n.nodeType === Node.TEXT_NODE) {
|
|
74
|
+
const l = k(n.textContent ?? "");
|
|
75
|
+
l.length && e.push(l);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (n.nodeType !== Node.ELEMENT_NODE) return;
|
|
79
|
+
const o = n;
|
|
80
|
+
if (C(o)) {
|
|
81
|
+
e.push(P(o));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
Array.from(n.childNodes).forEach(r);
|
|
85
|
+
};
|
|
86
|
+
return Array.from(t.childNodes).forEach(r), e.length ? e.reduce((n, o) => (typeof o == "string" && typeof n[n.length - 1] == "string" ? n[n.length - 1] = `${n[n.length - 1]}${o}` : n.push(o), n), []) : [""];
|
|
87
|
+
}, ie = (t) => t.map((e) => {
|
|
88
|
+
if (typeof e == "string") return e;
|
|
89
|
+
const r = e?.value ?? e;
|
|
90
|
+
return te(r);
|
|
91
|
+
}).join(""), le = (t) => {
|
|
92
|
+
const {
|
|
93
|
+
children: e,
|
|
94
|
+
__contentHtml: r,
|
|
95
|
+
...n
|
|
96
|
+
} = t;
|
|
97
|
+
return n;
|
|
98
|
+
}, z = (t) => {
|
|
99
|
+
if (!t) return null;
|
|
100
|
+
const e = window.getSelection();
|
|
101
|
+
if (!e || e.rangeCount === 0) return null;
|
|
102
|
+
const r = e.getRangeAt(0);
|
|
103
|
+
if (!t.contains(r.startContainer)) return null;
|
|
104
|
+
const n = r.startContainer, o = r.startOffset;
|
|
105
|
+
let l = null;
|
|
106
|
+
n.nodeType === Node.ELEMENT_NODE && (l = n.childNodes[o] ?? null);
|
|
107
|
+
const m = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, {
|
|
108
|
+
acceptNode: (c) => c.nodeType === Node.TEXT_NODE ? ne(c) || (c.textContent ?? "") === O ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT : c.nodeType === Node.ELEMENT_NODE && C(c) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
109
|
+
});
|
|
110
|
+
let f = null, d = m.nextNode();
|
|
111
|
+
for (; d && !(l && d === l); ) {
|
|
112
|
+
if (d === n && d.nodeType === Node.TEXT_NODE) {
|
|
113
|
+
const c = d.textContent?.slice(0, o) ?? "", a = [...k(c).matchAll(/\S+/g)], s = a[a.length - 1];
|
|
114
|
+
if (s && s.index !== void 0) {
|
|
115
|
+
const N = s.index, p = N + s[0].length, h = document.createRange();
|
|
116
|
+
h.setStart(d, Math.min(N, c.length)), h.setEnd(d, Math.min(p, c.length)), f = {
|
|
117
|
+
token: s[0],
|
|
118
|
+
range: h
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
if (C(d)) {
|
|
124
|
+
f = null, d = m.nextNode();
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (d.nodeType === Node.TEXT_NODE) {
|
|
128
|
+
const c = d.textContent ?? "", a = [...k(c).matchAll(/\S+/g)], s = a[a.length - 1];
|
|
129
|
+
if (s && s.index !== void 0) {
|
|
130
|
+
const N = s.index, p = N + s[0].length, h = document.createRange();
|
|
131
|
+
h.setStart(d, Math.min(N, c.length)), h.setEnd(d, Math.min(p, c.length)), f = {
|
|
132
|
+
token: s[0],
|
|
133
|
+
range: h
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
d = m.nextNode();
|
|
138
|
+
}
|
|
139
|
+
return f;
|
|
140
|
+
}, de = (t) => {
|
|
141
|
+
const e = window.getSelection();
|
|
142
|
+
if (!e || e.rangeCount === 0) return null;
|
|
143
|
+
const r = e.getRangeAt(0);
|
|
144
|
+
if (!t.contains(r.startContainer) || !t.contains(r.endContainer)) return null;
|
|
145
|
+
const n = (f) => {
|
|
146
|
+
if (f.nodeType === Node.TEXT_NODE) return k(f.textContent ?? "").length;
|
|
147
|
+
if (f.nodeType === Node.ELEMENT_NODE) {
|
|
148
|
+
const d = f;
|
|
149
|
+
if (C(d)) {
|
|
150
|
+
const u = P(d);
|
|
151
|
+
return String(u?.value ?? "").length;
|
|
152
|
+
}
|
|
153
|
+
let c = 0;
|
|
154
|
+
return Array.from(f.childNodes).forEach((u) => c += n(u)), c;
|
|
155
|
+
}
|
|
156
|
+
return 0;
|
|
157
|
+
}, o = (f, d) => {
|
|
158
|
+
let c = 0;
|
|
159
|
+
const u = (a) => {
|
|
160
|
+
if (a === f) {
|
|
161
|
+
if (a.nodeType === Node.TEXT_NODE)
|
|
162
|
+
return c += k(a.textContent ?? "").slice(0, d).length, !0;
|
|
163
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
164
|
+
const s = Array.from(a.childNodes), N = Math.max(0, Math.min(d, s.length));
|
|
165
|
+
for (let p = 0; p < N; p++) c += n(s[p]);
|
|
166
|
+
return !0;
|
|
167
|
+
}
|
|
168
|
+
return !0;
|
|
169
|
+
}
|
|
170
|
+
if (a.nodeType === Node.TEXT_NODE)
|
|
171
|
+
return c += k(a.textContent ?? "").length, !1;
|
|
172
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
173
|
+
const s = a;
|
|
174
|
+
if (C(s)) {
|
|
175
|
+
const N = P(s);
|
|
176
|
+
return c += String(N?.value ?? "").length, !1;
|
|
177
|
+
}
|
|
178
|
+
for (const N of Array.from(a.childNodes))
|
|
179
|
+
if (u(N)) return !0;
|
|
180
|
+
}
|
|
181
|
+
return !1;
|
|
182
|
+
};
|
|
183
|
+
return u(t), c;
|
|
184
|
+
}, l = o(r.startContainer, r.startOffset), m = o(r.endContainer, r.endOffset);
|
|
185
|
+
return {
|
|
186
|
+
start: Math.min(l, m),
|
|
187
|
+
end: Math.max(l, m)
|
|
188
|
+
};
|
|
189
|
+
}, ye = (t, e, r) => {
|
|
190
|
+
const n = (a) => Math.max(0, a), o = n(e), l = n(r), m = (a) => {
|
|
191
|
+
let s = a;
|
|
192
|
+
const N = (p) => {
|
|
193
|
+
if (p.nodeType === Node.TEXT_NODE) {
|
|
194
|
+
const h = p.textContent ?? "", y = k(h).length;
|
|
195
|
+
return s <= y ? {
|
|
196
|
+
node: p,
|
|
197
|
+
offset: Math.min(s, h.length)
|
|
198
|
+
} : (s -= y, null);
|
|
199
|
+
}
|
|
200
|
+
if (p.nodeType === Node.ELEMENT_NODE) {
|
|
201
|
+
const h = p;
|
|
202
|
+
if (C(h)) {
|
|
203
|
+
const y = P(h), x = String(y?.value ?? "").length, S = h.parentNode ?? t, w = Array.from(S.childNodes).indexOf(h);
|
|
204
|
+
return s <= 0 ? {
|
|
205
|
+
node: S,
|
|
206
|
+
offset: w
|
|
207
|
+
} : s < x ? {
|
|
208
|
+
node: S,
|
|
209
|
+
offset: w + 1
|
|
210
|
+
} : (s -= x, null);
|
|
211
|
+
}
|
|
212
|
+
for (const y of Array.from(p.childNodes)) {
|
|
213
|
+
const x = N(y);
|
|
214
|
+
if (x) return x;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
};
|
|
219
|
+
return N(t) ?? {
|
|
220
|
+
node: t,
|
|
221
|
+
offset: t.childNodes.length
|
|
222
|
+
};
|
|
223
|
+
}, f = m(o), d = m(l), c = window.getSelection();
|
|
224
|
+
if (!c) return;
|
|
225
|
+
const u = document.createRange();
|
|
226
|
+
try {
|
|
227
|
+
u.setStart(f.node, f.offset), u.setEnd(d.node, d.offset);
|
|
228
|
+
} catch {
|
|
229
|
+
u.selectNodeContents(t), u.collapse(!1);
|
|
230
|
+
}
|
|
231
|
+
c.removeAllRanges(), c.addRange(u);
|
|
232
|
+
}, ue = (t, e, r) => {
|
|
233
|
+
const n = window.getSelection();
|
|
234
|
+
if (!n || typeof n.modify != "function" || !t.contains(n.focusNode) || !t.contains(n.anchorNode)) return !1;
|
|
235
|
+
const o = r === "right" ? "forward" : "backward";
|
|
236
|
+
try {
|
|
237
|
+
return n.modify(e, o, "character"), D(n.focusNode) && n.modify(e, o, "character"), !0;
|
|
238
|
+
} catch {
|
|
239
|
+
return !1;
|
|
240
|
+
}
|
|
241
|
+
}, fe = (t) => {
|
|
242
|
+
const e = window.getSelection();
|
|
243
|
+
if (!e || e.rangeCount === 0) return null;
|
|
244
|
+
const r = e.getRangeAt(0);
|
|
245
|
+
return !t.contains(r.startContainer) || !t.contains(r.endContainer) ? null : r;
|
|
246
|
+
}, ge = (t) => {
|
|
247
|
+
const e = t.parentNode;
|
|
248
|
+
return e ? Array.from(e.childNodes).indexOf(t) : -1;
|
|
249
|
+
}, he = (t) => {
|
|
250
|
+
const e = t.startContainer, r = t.startOffset;
|
|
251
|
+
if (e.nodeType === Node.ELEMENT_NODE) return {
|
|
252
|
+
parent: e,
|
|
253
|
+
index: r
|
|
254
|
+
};
|
|
255
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
256
|
+
const n = e, o = n.textContent ?? "", l = ge(n);
|
|
257
|
+
return l < 0 || !n.parentNode ? null : o === O ? {
|
|
258
|
+
parent: n.parentNode,
|
|
259
|
+
index: l + (r > 0 ? 1 : 0)
|
|
260
|
+
} : r === 0 ? {
|
|
261
|
+
parent: n.parentNode,
|
|
262
|
+
index: l
|
|
263
|
+
} : r === o.length ? {
|
|
264
|
+
parent: n.parentNode,
|
|
265
|
+
index: l + 1
|
|
266
|
+
} : null;
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}, J = (t, e) => {
|
|
270
|
+
const r = window.getSelection();
|
|
271
|
+
if (!r) return;
|
|
272
|
+
const n = document.createRange();
|
|
273
|
+
n.setStart(t, e), n.collapse(!0), r.removeAllRanges(), r.addRange(n);
|
|
274
|
+
}, W = (t, e) => {
|
|
275
|
+
const r = t.childNodes[e - 1];
|
|
276
|
+
r && D(r) && r.parentNode === t && t.removeChild(r);
|
|
277
|
+
const n = Math.max(0, Math.min(e, t.childNodes.length - 1)), o = t.childNodes[n + 1];
|
|
278
|
+
o && D(o) && o.parentNode === t && t.removeChild(o);
|
|
279
|
+
}, Ne = (t, e) => {
|
|
280
|
+
const r = fe(t);
|
|
281
|
+
if (!r || !r.collapsed) return !1;
|
|
282
|
+
const n = he(r);
|
|
283
|
+
if (!n) return !1;
|
|
284
|
+
const o = n.parent, l = o.childNodes, m = (u) => {
|
|
285
|
+
let a = u;
|
|
286
|
+
for (; a > 0 && D(l[a - 1]); ) a--;
|
|
287
|
+
return a;
|
|
288
|
+
}, f = (u) => {
|
|
289
|
+
let a = u;
|
|
290
|
+
for (; a < l.length && D(l[a]); ) a++;
|
|
291
|
+
return a;
|
|
292
|
+
};
|
|
293
|
+
if (e === "backspace") {
|
|
294
|
+
const u = m(n.index), a = u > 0 ? l[u - 1] : null;
|
|
295
|
+
if (a && C(a)) {
|
|
296
|
+
if (a.parentNode !== o) return !1;
|
|
297
|
+
const s = u - 1;
|
|
298
|
+
return o.removeChild(a), W(o, s), J(o, Math.max(0, Math.min(s, o.childNodes.length))), !0;
|
|
299
|
+
}
|
|
300
|
+
return !1;
|
|
301
|
+
}
|
|
302
|
+
const d = f(n.index), c = l[d] ?? null;
|
|
303
|
+
if (c && C(c)) {
|
|
304
|
+
if (c.parentNode !== o) return !1;
|
|
305
|
+
const u = d;
|
|
306
|
+
return o.removeChild(c), W(o, u), J(o, Math.max(0, Math.min(u, o.childNodes.length))), !0;
|
|
307
|
+
}
|
|
308
|
+
return !1;
|
|
309
|
+
}, $ = (t) => {
|
|
310
|
+
t.querySelectorAll(`.${F}`).forEach((n) => n.classList.remove(K));
|
|
311
|
+
const e = window.getSelection();
|
|
312
|
+
if (!e || e.rangeCount === 0) return;
|
|
313
|
+
const r = e.getRangeAt(0);
|
|
314
|
+
!t.contains(r.startContainer) || !t.contains(r.endContainer) || t.querySelectorAll(`.${F}`).forEach((n) => {
|
|
315
|
+
try {
|
|
316
|
+
r.intersectsNode(n) && n.classList.add(K);
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}, xe = (t) => {
|
|
321
|
+
const e = Y.c(30), {
|
|
322
|
+
editorRef: r,
|
|
323
|
+
transformSyntax: n,
|
|
324
|
+
filterSuggestionsByLastToken: o,
|
|
325
|
+
onLastTokenChange: l,
|
|
326
|
+
onStateChange: m
|
|
327
|
+
} = t, f = o === void 0 ? !1 : o, [d, c] = Z.useState(""), u = Z.useRef(null);
|
|
328
|
+
let a;
|
|
329
|
+
e[0] !== f || e[1] !== l || e[2] !== m || e[3] !== n ? (a = (i) => {
|
|
330
|
+
if (!i)
|
|
331
|
+
return;
|
|
332
|
+
j(i);
|
|
333
|
+
const g = de(i);
|
|
334
|
+
u.current = g;
|
|
335
|
+
const T = ce(i), R = ie(T), A = T.filter(pe);
|
|
336
|
+
f && l?.(z(i)?.token ?? null);
|
|
337
|
+
let b = null;
|
|
338
|
+
n && (b = n(R, T)), $(i), m?.({
|
|
339
|
+
value: R,
|
|
340
|
+
tokens: A,
|
|
341
|
+
segments: b
|
|
342
|
+
});
|
|
343
|
+
}, e[0] = f, e[1] = l, e[2] = m, e[3] = n, e[4] = a) : a = e[4];
|
|
344
|
+
const s = a;
|
|
345
|
+
let N;
|
|
346
|
+
e[5] !== m || e[6] !== n ? (N = (i) => {
|
|
347
|
+
const g = [], T = i ?? "", R = n ? n(T, g) : null;
|
|
348
|
+
return m?.({
|
|
349
|
+
value: T,
|
|
350
|
+
tokens: [],
|
|
351
|
+
segments: R
|
|
352
|
+
}), c(""), T;
|
|
353
|
+
}, e[5] = m, e[6] = n, e[7] = N) : N = e[7];
|
|
354
|
+
const p = N;
|
|
355
|
+
let h;
|
|
356
|
+
e[8] !== r || e[9] !== f || e[10] !== s ? (h = (i) => {
|
|
357
|
+
const g = r.current;
|
|
358
|
+
if (!g)
|
|
359
|
+
return;
|
|
360
|
+
j(g), g.focus({
|
|
361
|
+
preventScroll: !0
|
|
362
|
+
});
|
|
363
|
+
const T = i.insertMode ?? "replace", A = (() => {
|
|
364
|
+
const E = document.createRange();
|
|
365
|
+
switch (T) {
|
|
366
|
+
case "append":
|
|
367
|
+
return E.selectNodeContents(g), E.collapse(!1), E;
|
|
368
|
+
case "prepend":
|
|
369
|
+
return E.selectNodeContents(g), E.collapse(!0), E;
|
|
370
|
+
case "replace":
|
|
371
|
+
return E.selectNodeContents(g), E;
|
|
372
|
+
default:
|
|
373
|
+
return se(g);
|
|
374
|
+
}
|
|
375
|
+
})(), b = le(i);
|
|
376
|
+
if (f && T !== "replace") {
|
|
377
|
+
const E = z(g);
|
|
378
|
+
E ? E.range.deleteContents() : A.deleteContents();
|
|
379
|
+
} else
|
|
380
|
+
A.deleteContents();
|
|
381
|
+
const v = oe(b), Q = document.createTextNode(O), H = document.createTextNode(O);
|
|
382
|
+
A.insertNode(Q), A.insertNode(v), v.parentNode?.insertBefore(H, v.nextSibling ?? null);
|
|
383
|
+
const B = window.getSelection(), I = document.createRange();
|
|
384
|
+
try {
|
|
385
|
+
I.setStart(H, 1);
|
|
386
|
+
} catch {
|
|
387
|
+
I.setStartAfter(v);
|
|
388
|
+
}
|
|
389
|
+
I.collapse(!0), B?.removeAllRanges(), B?.addRange(I), s(g);
|
|
390
|
+
}, e[8] = r, e[9] = f, e[10] = s, e[11] = h) : h = e[11];
|
|
391
|
+
const y = h;
|
|
392
|
+
let x;
|
|
393
|
+
e[12] !== r || e[13] !== s ? (x = (i) => {
|
|
394
|
+
i.preventDefault();
|
|
395
|
+
const g = i.clipboardData.getData("text/plain");
|
|
396
|
+
ae(r.current, g), s(r.current);
|
|
397
|
+
}, e[12] = r, e[13] = s, e[14] = x) : x = e[14];
|
|
398
|
+
const S = x;
|
|
399
|
+
let w;
|
|
400
|
+
e[15] !== r || e[16] !== s ? (w = (i) => {
|
|
401
|
+
s(r.current);
|
|
402
|
+
}, e[15] = r, e[16] = s, e[17] = w) : w = e[17];
|
|
403
|
+
const V = w, G = me;
|
|
404
|
+
let L;
|
|
405
|
+
e[18] !== r || e[19] !== s ? (L = (i) => {
|
|
406
|
+
const g = r.current;
|
|
407
|
+
if (!g || document.activeElement !== g)
|
|
408
|
+
return !1;
|
|
409
|
+
if ((i.key === "Backspace" || i.key === "Delete") && Ne(g, i.key === "Backspace" ? "backspace" : "delete"))
|
|
410
|
+
return i.preventDefault(), i.stopPropagation(), s(g), !0;
|
|
411
|
+
if (i.key === "ArrowLeft" || i.key === "ArrowRight") {
|
|
412
|
+
const T = i.key === "ArrowLeft" ? "left" : "right";
|
|
413
|
+
if (ue(g, i.shiftKey ? "extend" : "move", T))
|
|
414
|
+
return i.preventDefault(), i.stopPropagation(), $(g), !0;
|
|
415
|
+
}
|
|
416
|
+
return i.key === "Enter" ? (i.preventDefault(), !0) : !1;
|
|
417
|
+
}, e[18] = r, e[19] = s, e[20] = L) : L = e[20];
|
|
418
|
+
const X = L;
|
|
419
|
+
let M;
|
|
420
|
+
e[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = () => {
|
|
421
|
+
const i = u.current;
|
|
422
|
+
return u.current = null, i;
|
|
423
|
+
}, e[21] = M) : M = e[21];
|
|
424
|
+
let _;
|
|
425
|
+
return e[22] !== y || e[23] !== d || e[24] !== V || e[25] !== X || e[26] !== S || e[27] !== p || e[28] !== s ? (_ = {
|
|
426
|
+
editorHtml: d,
|
|
427
|
+
setEditorHtml: c,
|
|
428
|
+
initializeFromExternalValue: p,
|
|
429
|
+
updateEditorState: s,
|
|
430
|
+
takePendingSelection: M,
|
|
431
|
+
applySuggestionValueSyntax: y,
|
|
432
|
+
handlePaste: S,
|
|
433
|
+
handleChange: V,
|
|
434
|
+
handleKeyDownCapture: G,
|
|
435
|
+
handleKeyDown: X
|
|
436
|
+
}, e[22] = y, e[23] = d, e[24] = V, e[25] = X, e[26] = S, e[27] = p, e[28] = s, e[29] = _) : _ = e[29], _;
|
|
437
|
+
};
|
|
438
|
+
function pe(t) {
|
|
439
|
+
return typeof t != "string";
|
|
440
|
+
}
|
|
441
|
+
function me(t) {
|
|
442
|
+
(t.key === " " || t.code === "Space") && (t.stopPropagation(), t.nativeEvent?.stopImmediatePropagation?.());
|
|
443
|
+
}
|
|
444
|
+
export {
|
|
445
|
+
de as getSelectionOffsetsInValue,
|
|
446
|
+
ce as serializeEditorParts,
|
|
447
|
+
ye as setSelectionOffsetsInValue,
|
|
448
|
+
xe as useContentEditableController
|
|
449
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
const p = (s) => {
|
|
4
|
+
const t = i.c(2), {
|
|
5
|
+
children: r
|
|
6
|
+
} = s;
|
|
7
|
+
let o;
|
|
8
|
+
return t[0] !== r ? (o = /* @__PURE__ */ e("span", { className: "input__description", children: r }), t[0] = r, t[1] = o) : o = t[1], o;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
p as InputDescription
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as s } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
const i = (o) => {
|
|
4
|
+
const t = s.c(2), {
|
|
5
|
+
children: l
|
|
6
|
+
} = o;
|
|
7
|
+
let e;
|
|
8
|
+
return t[0] !== l ? (e = /* @__PURE__ */ r("label", { className: "input__label", children: l }), t[0] = l, t[1] = e) : e = t[1], e;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
i as InputLabel
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as c, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as m } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { IconExclamationCircle as n } from "@tabler/icons-react";
|
|
4
|
+
const f = (r) => {
|
|
5
|
+
const e = m.c(3), {
|
|
6
|
+
children: o
|
|
7
|
+
} = r;
|
|
8
|
+
let s;
|
|
9
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(n, { size: 16 }), e[0] = s) : s = e[0];
|
|
10
|
+
let t;
|
|
11
|
+
return e[1] !== o ? (t = /* @__PURE__ */ i("span", { className: "input__message", children: [
|
|
12
|
+
s,
|
|
13
|
+
o
|
|
14
|
+
] }), e[1] = o, e[2] = t) : t = e[2], t;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
f as InputMessage
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MenuContentProps } from '../menu/Menu';
|
|
2
|
+
import { default as React, RefObject } from 'react';
|
|
3
|
+
export interface InputSuggestion {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
value: any;
|
|
6
|
+
valueData?: any;
|
|
7
|
+
groupBy?: string;
|
|
8
|
+
insertMode?: "replace" | "append" | "prepend" | "insert";
|
|
9
|
+
}
|
|
10
|
+
export type InputSuggestionMenuContentProps = MenuContentProps & {
|
|
11
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
12
|
+
};
|
|
13
|
+
export interface InputSuggestionMenuContentItemsProps {
|
|
14
|
+
suggestions?: InputSuggestion[];
|
|
15
|
+
onSuggestionSelect?: (suggestion: InputSuggestion) => void;
|
|
16
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
17
|
+
}
|
|
18
|
+
export interface InputSuggestionMenuContentItemsHandle {
|
|
19
|
+
focusFirstItem: () => InputSuggestion | undefined;
|
|
20
|
+
focusLastItem: () => InputSuggestion | undefined;
|
|
21
|
+
highlightNextItem: () => InputSuggestion | undefined;
|
|
22
|
+
highlightPreviousItem: () => InputSuggestion | undefined;
|
|
23
|
+
selectActiveItem: () => InputSuggestion | undefined;
|
|
24
|
+
clearActiveItem: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const InputSuggestionMenuContent: React.NamedExoticComponent<InputSuggestionMenuContentProps>;
|
|
27
|
+
export declare const InputSuggestionMenuContentItems: React.NamedExoticComponent<InputSuggestionMenuContentItemsProps>;
|