triafly-ui-kit 1.0.23 → 1.0.25

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 (181) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/_virtual/index2.js +7 -0
  4. package/dist/_virtual/index3.js +4 -0
  5. package/dist/_virtual/papaparse.min.js +7 -0
  6. package/dist/_virtual/papaparse.min2.js +4 -0
  7. package/dist/_virtual/react-paginate.js +7 -0
  8. package/dist/_virtual/react-paginate2.js +4 -0
  9. package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
  10. package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
  11. package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
  12. package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
  13. package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
  14. package/dist/assets/src/components/Ui/Accordeon/Accordeon.css +1 -0
  15. package/dist/assets/src/components/Ui/Alert/Alert.css +1 -0
  16. package/dist/assets/src/components/Ui/Avatar/Avatar.css +1 -0
  17. package/dist/assets/src/components/Ui/Badge/Badge.module.css +1 -0
  18. package/dist/assets/src/components/Ui/Button/Button.css +1 -0
  19. package/dist/assets/src/components/Ui/ButtonsArray/ButtonsArray.css +1 -0
  20. package/dist/assets/src/components/Ui/Checkbox/Checkbox.css +1 -0
  21. package/dist/assets/src/components/Ui/CliTextareaInput/CliTextareaInput.css +1 -0
  22. package/dist/assets/src/components/Ui/CustomLink/CustomLink.css +1 -0
  23. package/dist/assets/src/components/Ui/DatePicker/DatePicker.css +1 -0
  24. package/dist/assets/src/components/Ui/DropdownInput/DropdownInput.css +1 -0
  25. package/dist/assets/src/components/Ui/DropdownMenu/DropdownMenu.css +1 -0
  26. package/dist/assets/src/components/Ui/FileUpload/FileUpload.css +1 -0
  27. package/dist/assets/src/components/Ui/Form/FormRoot/Form.css +1 -0
  28. package/dist/assets/src/components/Ui/Loader/Loader.css +1 -0
  29. package/dist/assets/src/components/Ui/ModalWindow/ModalWindow.css +1 -0
  30. package/dist/assets/src/components/Ui/Pagination/Pagination.css +1 -0
  31. package/dist/assets/src/components/Ui/Radio/Radio.css +1 -0
  32. package/dist/assets/src/components/Ui/SearchInput/SearchInput.css +1 -0
  33. package/dist/assets/src/components/Ui/Skeleton/Skeleton.module.css +1 -0
  34. package/dist/assets/src/components/Ui/Switch/Switch.css +1 -0
  35. package/dist/assets/src/components/Ui/Table/Table.css +1 -0
  36. package/dist/assets/src/components/Ui/Tabs/Tabs.css +1 -0
  37. package/dist/assets/src/components/Ui/TextInput/TextInput.css +1 -0
  38. package/dist/assets/src/components/Ui/TextareaInput/TextareaInput.css +1 -0
  39. package/dist/assets/src/components/Ui/Tooltip/Tooltip.css +1 -0
  40. package/dist/assets/src/components/Ui/Tooltip/Tooltip.stories.module.css +1 -0
  41. package/dist/assets/src/context/ToastContext/ToastContext.module.css +1 -0
  42. package/dist/components/Ui/Accordeon/Accordeon.js +34 -0
  43. package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
  44. package/dist/components/Ui/Accordeon/index.js +4 -0
  45. package/dist/components/Ui/Alert/Alert.js +15 -0
  46. package/dist/components/Ui/Alert/index.js +4 -0
  47. package/dist/components/Ui/Avatar/Avatar.js +11 -0
  48. package/dist/components/Ui/Avatar/index.js +4 -0
  49. package/dist/components/Ui/Badge/Badge.js +30 -0
  50. package/dist/components/Ui/Badge/index.js +4 -0
  51. package/dist/components/Ui/Button/Button.js +50 -0
  52. package/dist/components/Ui/Button/index.js +4 -0
  53. package/dist/components/Ui/ButtonsArray/ButtonsArray.js +29 -0
  54. package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
  55. package/dist/components/Ui/ButtonsArray/index.js +4 -0
  56. package/dist/components/Ui/Checkbox/Checkbox.js +40 -0
  57. package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
  58. package/dist/components/Ui/Checkbox/index.js +4 -0
  59. package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +122 -0
  60. package/dist/components/Ui/CliTextareaInput/index.js +23 -0
  61. package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
  62. package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
  63. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
  64. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
  65. package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
  66. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
  67. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
  68. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
  69. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
  70. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
  71. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
  72. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
  73. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
  74. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
  75. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
  76. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
  77. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
  78. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
  79. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
  80. package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
  81. package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
  82. package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
  83. package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
  84. package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
  85. package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
  86. package/dist/components/Ui/CustomLink/CustomLink.js +50 -0
  87. package/dist/components/Ui/CustomLink/index.js +4 -0
  88. package/dist/components/Ui/DatePicker/DatePicker.js +183 -0
  89. package/dist/components/Ui/DatePicker/DatePicker.stories.js +120 -0
  90. package/dist/components/Ui/DropdownInput/DropdownInput.js +92 -0
  91. package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
  92. package/dist/components/Ui/DropdownInput/index.js +4 -0
  93. package/dist/components/Ui/DropdownMenu/DropdownMenu.js +84 -0
  94. package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
  95. package/dist/components/Ui/DropdownMenu/index.js +4 -0
  96. package/dist/components/Ui/FileUpload/FileUpload.js +197 -0
  97. package/dist/components/Ui/FileUpload/fn.js +10 -0
  98. package/dist/components/Ui/FileUpload/index.js +4 -0
  99. package/dist/components/Ui/FileUpload/types.js +1 -0
  100. package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
  101. package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
  102. package/dist/components/Ui/Form/FormItem/fn.js +25 -0
  103. package/dist/components/Ui/Form/FormItem/types.js +1 -0
  104. package/dist/components/Ui/Form/FormRoot/FormRoot.js +26 -0
  105. package/dist/components/Ui/Form/FormRoot/index.js +4 -0
  106. package/dist/components/Ui/Form/FormRoot/types.js +1 -0
  107. package/dist/components/Ui/Form/index.js +6 -0
  108. package/dist/components/Ui/Form/useForm/index.js +4 -0
  109. package/dist/components/Ui/Form/useForm/useForm.js +111 -0
  110. package/dist/components/Ui/Form/utils/fn.js +31 -0
  111. package/dist/components/Ui/Form/utils/types.js +1 -0
  112. package/dist/components/Ui/Icons/Icons.js +577 -0
  113. package/dist/components/Ui/Icons/index.js +97 -0
  114. package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
  115. package/dist/components/Ui/Loader/Loader.js +7 -0
  116. package/dist/components/Ui/Loader/index.js +4 -0
  117. package/dist/components/Ui/ModalWindow/ModalWindow.js +51 -0
  118. package/dist/components/Ui/ModalWindow/index.js +4 -0
  119. package/dist/components/Ui/Pagination/Pagination.js +39 -0
  120. package/dist/components/Ui/Pagination/index.js +4 -0
  121. package/dist/components/Ui/Radio/Radio.js +31 -0
  122. package/dist/components/Ui/Radio/Radio.stories.js +42 -0
  123. package/dist/components/Ui/Radio/index.js +4 -0
  124. package/dist/components/Ui/SearchInput/SearchData.js +30 -0
  125. package/dist/components/Ui/SearchInput/SearchInput.js +110 -0
  126. package/dist/components/Ui/Skeleton/Skeleton.js +26 -0
  127. package/dist/components/Ui/Skeleton/index.js +4 -0
  128. package/dist/components/Ui/Switch/Switch.js +26 -0
  129. package/dist/components/Ui/Switch/index.js +4 -0
  130. package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +50 -0
  131. package/dist/components/Ui/Table/Table.js +161 -0
  132. package/dist/components/Ui/Table/TableTypes.js +1 -0
  133. package/dist/components/Ui/Table/index.js +4 -0
  134. package/dist/components/Ui/Tabs/Tabs.js +25 -0
  135. package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
  136. package/dist/components/Ui/Tabs/index.js +4 -0
  137. package/dist/components/Ui/TextInput/TextInput.js +86 -0
  138. package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
  139. package/dist/components/Ui/TextInput/index.js +4 -0
  140. package/dist/components/Ui/TextareaInput/TextareaInput.js +69 -0
  141. package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
  142. package/dist/components/Ui/TextareaInput/index.js +4 -0
  143. package/dist/components/Ui/Tooltip/Tooltip.js +93 -0
  144. package/dist/components/Ui/Tooltip/Tooltip.stories.js +87 -0
  145. package/dist/components/Ui/Tooltip/index.js +4 -0
  146. package/dist/context/ToastContext/ToastContext.js +38 -0
  147. package/dist/context/ToastContext/index.js +5 -0
  148. package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
  149. package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
  150. package/dist/context/TriaflyContext/hooks/index.js +8 -0
  151. package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
  152. package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
  153. package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
  154. package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
  155. package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
  156. package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
  157. package/dist/context/TriaflyContext/index.js +12 -0
  158. package/dist/main.d.ts +1229 -0
  159. package/dist/main.js +162 -0
  160. package/dist/node_modules/classnames/index.js +42 -0
  161. package/dist/node_modules/fast-deep-equal/index.js +31 -0
  162. package/dist/node_modules/papaparse/papaparse.min.js +421 -0
  163. package/dist/node_modules/react-paginate/dist/react-paginate.js +259 -0
  164. package/dist/src/components/Ui/Badge/Badge.module.scss.js +30 -0
  165. package/dist/src/components/Ui/Skeleton/Skeleton.module.scss.js +9 -0
  166. package/dist/src/components/Ui/Tooltip/Tooltip.stories.module.css.js +15 -0
  167. package/dist/src/context/ToastContext/ToastContext.module.scss.js +9 -0
  168. package/dist/styles/_mixins.scss +22 -0
  169. package/dist/styles/fix.scss +4 -0
  170. package/dist/styles/main.scss +27 -0
  171. package/dist/styles/reset.scss +106 -0
  172. package/dist/styles/typography.scss +102 -0
  173. package/dist/styles/variables.scss +278 -0
  174. package/dist/vite-env.d.js +1 -0
  175. package/package.json +6 -2
  176. package/src/styles/_mixins.scss +22 -0
  177. package/src/styles/fix.scss +4 -0
  178. package/src/styles/main.scss +27 -0
  179. package/src/styles/reset.scss +106 -0
  180. package/src/styles/typography.scss +102 -0
  181. package/src/styles/variables.scss +278 -0
@@ -0,0 +1,122 @@
1
+ import { jsxs as y, jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as A, useState as C, useRef as d, useCallback as g, useEffect as p } from "react";
3
+ import '../../../assets/src/components/Ui/CliTextareaInput/CliTextareaInput.css';/* empty css */
4
+ import F from "../../../_virtual/index.js";
5
+ import { highlightSyntax as $ } from "./utils/highlightSyntax/highlightSyntax.js";
6
+ import { useHistoryNavigation as q } from "./utils/hooks/useHistoryNavigation/useHistoryNavigation.js";
7
+ import { useTextCoursore as B } from "./utils/hooks/useTextCoursore/useTextCoursore.js";
8
+ import { useLineNumbers as G } from "./utils/hooks/useLineNumbers/useLineNumbers.js";
9
+ import { useScrollSync as J } from "./utils/hooks/useScrollSync/useScrollSync.js";
10
+ import { useTextActions as O } from "./utils/hooks/useTextActions/useTextActions.js";
11
+ import { useKeyHandlers as Q } from "./utils/hooks/useKeyHandlers/useKeyHandlers.js";
12
+ const W = A(
13
+ ({
14
+ name: c,
15
+ spellCheck: T = !1,
16
+ isDisabled: b = !1,
17
+ onChange: s,
18
+ value: i,
19
+ resize: H = !1,
20
+ format: l,
21
+ onSubmit: L,
22
+ onError: R,
23
+ history: I,
24
+ numberColl: K = !1,
25
+ showPrompt: u = !1
26
+ }, o) => {
27
+ const [a, m] = C(i), r = d(null), S = d(null), N = d(null);
28
+ J(r, S, N, a);
29
+ const { saveSelectionCoursore: h, restoreSelectionCoursore: v } = B(r), { visibleLines: M } = G(r, a), f = g(
30
+ (e) => {
31
+ const { selectionStart: t, selectionEnd: z, value: x } = e.target;
32
+ h({ start: t, end: z }), m(x), s == null || s(
33
+ {
34
+ target: { value: x }
35
+ },
36
+ void 0
37
+ );
38
+ },
39
+ [s, c, h]
40
+ ), j = g(
41
+ (e, t) => {
42
+ m(e), s == null || s(
43
+ {
44
+ target: { value: e }
45
+ },
46
+ t
47
+ );
48
+ },
49
+ [s, c]
50
+ ), { handleFormat: w, handleSubmit: D } = O({
51
+ value: i,
52
+ format: l,
53
+ onChange: f,
54
+ onSubmit: L,
55
+ onError: R
56
+ }), { navigate: E } = q(I, l, j), U = Q({
57
+ navigate: E,
58
+ handleFormat: w,
59
+ handleSubmit: D,
60
+ onChange: f,
61
+ localValue: a,
62
+ showPrompt: u
63
+ });
64
+ p(() => {
65
+ m(i), v();
66
+ }, [i, v]), p(() => {
67
+ const e = r.current;
68
+ e && e.selectionStart < 3 && e.setSelectionRange(3, 3);
69
+ }, [a]), p(() => {
70
+ typeof o == "function" ? o(r.current) : o && (o.current = r.current);
71
+ }, [o]);
72
+ const V = F({
73
+ "no-resize": !H
74
+ }), _ = (e) => {
75
+ if (u) {
76
+ const t = e.currentTarget;
77
+ setTimeout(() => {
78
+ t.selectionStart < 4 && t.setSelectionRange(4, 4);
79
+ }, 0);
80
+ }
81
+ }, k = (e) => {
82
+ if (u) {
83
+ const t = e.currentTarget;
84
+ t.selectionStart < 4 && t.setSelectionRange(4, 4);
85
+ }
86
+ };
87
+ return /* @__PURE__ */ y("div", { className: "cli-textarea-input", children: [
88
+ K && /* @__PURE__ */ n("div", { ref: N, className: "line-numbers", children: M.map((e) => /* @__PURE__ */ n("div", { className: "line-number", "data-line": e, children: e }, e)) }),
89
+ /* @__PURE__ */ y("div", { className: "input-with-highlight", children: [
90
+ /* @__PURE__ */ n(
91
+ "textarea",
92
+ {
93
+ onMouseUp: _,
94
+ onSelect: k,
95
+ ref: r,
96
+ className: V,
97
+ value: a,
98
+ onKeyDown: U,
99
+ onChange: f,
100
+ name: c,
101
+ disabled: b,
102
+ spellCheck: T
103
+ }
104
+ ),
105
+ /* @__PURE__ */ n(
106
+ "pre",
107
+ {
108
+ ref: S,
109
+ className: `formatted-content ${l}`,
110
+ dangerouslySetInnerHTML: {
111
+ __html: $(a || "", l) || "&nbsp;"
112
+ }
113
+ }
114
+ )
115
+ ] })
116
+ ] });
117
+ }
118
+ );
119
+ W.displayName = "CliTextareaInput";
120
+ export {
121
+ W as CliTextareaInput
122
+ };
@@ -0,0 +1,23 @@
1
+ import { CliTextareaInput as e } from "./CliTextareaInput.js";
2
+ import { highlightSyntax as s } from "./utils/highlightSyntax/highlightSyntax.js";
3
+ import { processJson as m } from "./utils/processJson/processJson.js";
4
+ import { useFixFormat as f } from "./utils/hooks/useFixFormat/useFixFormat.js";
5
+ import { useHistoryNavigation as i } from "./utils/hooks/useHistoryNavigation/useHistoryNavigation.js";
6
+ import { useTextCoursore as a } from "./utils/hooks/useTextCoursore/useTextCoursore.js";
7
+ import { LINE_HEIGHT as c, useLineNumbers as y } from "./utils/hooks/useLineNumbers/useLineNumbers.js";
8
+ import { useScrollSync as T } from "./utils/hooks/useScrollSync/useScrollSync.js";
9
+ import { useTextActions as h } from "./utils/hooks/useTextActions/useTextActions.js";
10
+ import { useKeyHandlers as N } from "./utils/hooks/useKeyHandlers/useKeyHandlers.js";
11
+ export {
12
+ e as CliTextareaInput,
13
+ c as LINE_HEIGHT,
14
+ s as highlightSyntax,
15
+ m as processJson,
16
+ f as useFixFormat,
17
+ i as useHistoryNavigation,
18
+ N as useKeyHandlers,
19
+ y as useLineNumbers,
20
+ T as useScrollSync,
21
+ h as useTextActions,
22
+ a as useTextCoursore
23
+ };
@@ -0,0 +1,4 @@
1
+ const p = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2
+ export {
3
+ p as escapeHtml
4
+ };
@@ -0,0 +1,12 @@
1
+ const $ = (l) => {
2
+ let e = l.replace(/([{,]\s*)([a-zA-Z_][a-zA-Z0-9_]*)(\s*:)/g, '$1"$2"$3').replace(/([}\]"0-9truefalsenull])\s*(\n\s*["{])/g, "$1,$2").replace(/,\s*\]\s*$/g, "").replace(/\s*\/\*.*\*\/\s*/g, "").replace(/,(\s*[}\]])/g, "$1").replace(
3
+ /(['"])?([a-zA-Z_][a-zA-Z0-9_]*)(['"])?\s*:/g,
4
+ (r, c, t) => `${r || '"'}${c}${t || '"'}:`
5
+ ).replace(/([0-9truefalsenull}])\s*(\s*\[)/g, "$1,$2").replace(/(['"])([a-zA-Z_][a-zA-Z0-9_]*)(['"])?\s*:/g, '"$2":');
6
+ const a = (e.match(/{/g) || []).length, s = (e.match(/}/g) || []).length;
7
+ return a > s && (e += `
8
+ `.repeat(a - s) + "}".repeat(a - s)), e;
9
+ };
10
+ export {
11
+ $ as fixJson
12
+ };
@@ -0,0 +1,20 @@
1
+ import { escapeHtml as s } from "../escapeHtml/escapeHtml.js";
2
+ import { processJson as m } from "../processJson/processJson.js";
3
+ import { processXml as e } from "../processXml/processXml.js";
4
+ import { processYml as o } from "../processYml/processYml.js";
5
+ const a = (r, t) => {
6
+ if (t === "plain") return r;
7
+ switch (t) {
8
+ case "json":
9
+ return m(r);
10
+ case "yml":
11
+ return o(r);
12
+ case "xml":
13
+ return e(r);
14
+ default:
15
+ return s(r);
16
+ }
17
+ };
18
+ export {
19
+ a as highlightSyntax
20
+ };
@@ -0,0 +1,4 @@
1
+ import { highlightSyntax as g } from "./highlightSyntax.js";
2
+ export {
3
+ g as highlightSyntax
4
+ };
@@ -0,0 +1,17 @@
1
+ import { useFixFormat as r } from "./useFixFormat/useFixFormat.js";
2
+ import { useHistoryNavigation as s } from "./useHistoryNavigation/useHistoryNavigation.js";
3
+ import { useTextCoursore as m } from "./useTextCoursore/useTextCoursore.js";
4
+ import { LINE_HEIGHT as f, useLineNumbers as p } from "./useLineNumbers/useLineNumbers.js";
5
+ import { useScrollSync as n } from "./useScrollSync/useScrollSync.js";
6
+ import { useTextActions as H } from "./useTextActions/useTextActions.js";
7
+ import { useKeyHandlers as l } from "./useKeyHandlers/useKeyHandlers.js";
8
+ export {
9
+ f as LINE_HEIGHT,
10
+ r as useFixFormat,
11
+ s as useHistoryNavigation,
12
+ l as useKeyHandlers,
13
+ p as useLineNumbers,
14
+ n as useScrollSync,
15
+ H as useTextActions,
16
+ m as useTextCoursore
17
+ };
@@ -0,0 +1,4 @@
1
+ import { useFixFormat as e } from "./useFixFormat.js";
2
+ export {
3
+ e as useFixFormat
4
+ };
@@ -0,0 +1,29 @@
1
+ import { useCallback as e } from "react";
2
+ import { fixJson as a } from "../../fixJson/fixJson.js";
3
+ const c = (o, t) => {
4
+ const r = t.message.match(/at position (\d+)/);
5
+ if (!r) return 0;
6
+ const n = parseInt(r[1], 10);
7
+ return o.substring(0, n).split(`
8
+ `).length;
9
+ }, f = () => ({
10
+ formatJson: e(async (t) => {
11
+ try {
12
+ return JSON.stringify(JSON.parse(t), null, 2);
13
+ } catch {
14
+ try {
15
+ const r = a(t), n = JSON.parse(r);
16
+ return JSON.stringify(n, null, 2);
17
+ } catch (r) {
18
+ const n = r instanceof Error ? r : new Error(String(r)), s = new Error(
19
+ `JSON Error: ${n.message}
20
+ Line: ${c(t, n)}`
21
+ );
22
+ throw s.name = "Ошибка валидации JSON", s;
23
+ }
24
+ }
25
+ }, [])
26
+ });
27
+ export {
28
+ f as useFixFormat
29
+ };
@@ -0,0 +1,4 @@
1
+ import { useHistoryNavigation as r } from "./useHistoryNavigation.js";
2
+ export {
3
+ r as useHistoryNavigation
4
+ };
@@ -0,0 +1,34 @@
1
+ import { useState as g, useRef as I, useEffect as v, useCallback as p } from "react";
2
+ const w = (c, u, a) => {
3
+ const [r, d] = g(-1), e = I(c);
4
+ return v(() => {
5
+ e.current = c;
6
+ }, [c]), { navigate: p(
7
+ (f) => {
8
+ var o;
9
+ if (!((o = e.current) != null && o.length) || !e.current.filter((t) => t.format === u).length) return;
10
+ let n = r;
11
+ if (f === "up") {
12
+ const t = e.current.findIndex(
13
+ (s, i) => i > r && s.format === u
14
+ );
15
+ n = t !== -1 ? t : r;
16
+ } else {
17
+ const t = [...e.current].reverse().findIndex(
18
+ (s, i) => {
19
+ var l;
20
+ return (((l = e == null ? void 0 : e.current) == null ? void 0 : l.length) ?? 0) - 1 - i < r && s.format === u;
21
+ }
22
+ );
23
+ n = t !== -1 ? e.current.length - 1 - t : -1;
24
+ }
25
+ d(n);
26
+ const x = n === -1 ? ">>> " : `>>> ${e.current[n].value}`;
27
+ a(x, e.current[n]);
28
+ },
29
+ [r, u]
30
+ ) };
31
+ };
32
+ export {
33
+ w as useHistoryNavigation
34
+ };
@@ -0,0 +1,4 @@
1
+ import { useKeyHandlers as o } from "./useKeyHandlers.js";
2
+ export {
3
+ o as useKeyHandlers
4
+ };
@@ -0,0 +1,45 @@
1
+ import { useCallback as y } from "react";
2
+ function u(i, r = "", s) {
3
+ const e = i.currentTarget, n = e.selectionStart, c = e.selectionEnd, t = r.substring(0, n) + (i.key === "Tab" ? " " : " ") + (r.substring(c) || "");
4
+ s == null || s({
5
+ target: { value: t }
6
+ }), setTimeout(() => {
7
+ e.selectionStart = n + (i.key === "Tab" ? 4 : 1), e.selectionEnd = e.selectionStart;
8
+ }, 0);
9
+ }
10
+ function k(i, r = "", s) {
11
+ const e = i.currentTarget, n = e.selectionStart, c = `${r == null ? void 0 : r.substring(0, n)}{}${r == null ? void 0 : r.substring(n)}`;
12
+ s == null || s({
13
+ target: { value: c }
14
+ }), setTimeout(() => {
15
+ e.selectionStart = n + 1, e.selectionEnd = e.selectionStart;
16
+ }, 0);
17
+ }
18
+ const T = ({
19
+ navigate: i,
20
+ handleFormat: r,
21
+ handleSubmit: s,
22
+ onChange: e,
23
+ localValue: n = "",
24
+ showPrompt: c
25
+ }) => y(
26
+ (t) => {
27
+ if (c) {
28
+ const f = t.currentTarget;
29
+ f.selectionStart < 4 && ["Backspace", "Delete", "ArrowLeft"].includes(t.key) && (t.preventDefault(), f.setSelectionRange(4, 4));
30
+ }
31
+ if (t.shiftKey && (t.key === "ArrowUp" || t.key === "ArrowDown")) {
32
+ t.preventDefault(), i(t.key === "ArrowUp" ? "up" : "down");
33
+ return;
34
+ }
35
+ if (t.key === "Tab" || t.key === " ") {
36
+ t.preventDefault(), u(t, n, e);
37
+ return;
38
+ }
39
+ (t.ctrlKey || t.metaKey) && t.key === "s" && (t.preventDefault(), r()), t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && (t.preventDefault(), s()), t.key === "{" && (t.preventDefault(), k(t, n, e));
40
+ },
41
+ [i, r, s, e, c, n]
42
+ );
43
+ export {
44
+ T as useKeyHandlers
45
+ };
@@ -0,0 +1,5 @@
1
+ import { LINE_HEIGHT as m, useLineNumbers as o } from "./useLineNumbers.js";
2
+ export {
3
+ m as LINE_HEIGHT,
4
+ o as useLineNumbers
5
+ };
@@ -0,0 +1,17 @@
1
+ import { useState as c, useEffect as a } from "react";
2
+ const l = 24, L = (r, s) => {
3
+ const [n, i] = c([0]);
4
+ return a(() => {
5
+ const e = () => {
6
+ const t = r.current;
7
+ if (!t) return;
8
+ const o = Math.floor(t.scrollHeight / l) || 1;
9
+ i(Array.from({ length: o }, (f, u) => u + 1));
10
+ };
11
+ return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
12
+ }, [s]), { visibleLines: n };
13
+ };
14
+ export {
15
+ l as LINE_HEIGHT,
16
+ L as useLineNumbers
17
+ };
@@ -0,0 +1,4 @@
1
+ import { useScrollSync as c } from "./useScrollSync.js";
2
+ export {
3
+ c as useScrollSync
4
+ };
@@ -0,0 +1,13 @@
1
+ import { useEffect as u } from "react";
2
+ const a = (t, l, n, s) => (u(() => {
3
+ const r = t.current, e = l.current, o = n.current;
4
+ if (!r || !e || !o) return;
5
+ const c = () => {
6
+ e.scrollTop = r.scrollTop, o.scrollTop = r.scrollTop;
7
+ };
8
+ return r.addEventListener("scroll", c), () => r.removeEventListener("scroll", c);
9
+ }, [s]), { syncScroll: () => {
10
+ } });
11
+ export {
12
+ a as useScrollSync
13
+ };
@@ -0,0 +1,4 @@
1
+ import { useTextActions as t } from "./useTextActions.js";
2
+ export {
3
+ t as useTextActions
4
+ };
@@ -0,0 +1,37 @@
1
+ import { useCallback as m } from "react";
2
+ import { useFixFormat as x } from "../useFixFormat/useFixFormat.js";
3
+ const p = ({
4
+ value: s,
5
+ format: f,
6
+ onChange: a,
7
+ onSubmit: i,
8
+ onError: c
9
+ }) => {
10
+ const { formatJson: e } = x(), n = m(async () => {
11
+ if (s)
12
+ try {
13
+ const t = await e(s);
14
+ t !== s && a && a({
15
+ target: { value: t }
16
+ });
17
+ } catch (t) {
18
+ c == null || c(t instanceof Error ? t : new Error(String(t)));
19
+ }
20
+ }, [s, a, c, e]), w = m(async () => {
21
+ if (!(!s || !i))
22
+ try {
23
+ const t = f === "json" ? await e(s) : s;
24
+ await i(t);
25
+ } catch (t) {
26
+ c == null || c(
27
+ new Error(
28
+ `Отправка не удалась: ${t instanceof Error ? t.message : "Ошибка валидации"}`
29
+ )
30
+ );
31
+ }
32
+ }, [s, f, i, c, e]);
33
+ return { handleFormat: n, handleSubmit: w };
34
+ };
35
+ export {
36
+ p as useTextActions
37
+ };
@@ -0,0 +1,4 @@
1
+ import { useTextCoursore as r } from "./useTextCoursore.js";
2
+ export {
3
+ r as useTextCoursore
4
+ };
@@ -0,0 +1,14 @@
1
+ import { useRef as u, useCallback as t } from "react";
2
+ const l = (r) => {
3
+ const e = u({ start: 0, end: 0 }), n = t(({ start: s, end: c }) => {
4
+ e.current = { start: s, end: c };
5
+ }, []), o = t(() => {
6
+ requestAnimationFrame(() => {
7
+ r.current && (r.current.selectionStart = e.current.start, r.current.selectionEnd = e.current.end);
8
+ });
9
+ }, [r]);
10
+ return { saveSelectionCoursore: n, restoreSelectionCoursore: o };
11
+ };
12
+ export {
13
+ l as useTextCoursore
14
+ };
@@ -0,0 +1,21 @@
1
+ import { highlightSyntax as e } from "./highlightSyntax/highlightSyntax.js";
2
+ import { processJson as s } from "./processJson/processJson.js";
3
+ import { useFixFormat as m } from "./hooks/useFixFormat/useFixFormat.js";
4
+ import { useHistoryNavigation as f } from "./hooks/useHistoryNavigation/useHistoryNavigation.js";
5
+ import { useTextCoursore as i } from "./hooks/useTextCoursore/useTextCoursore.js";
6
+ import { LINE_HEIGHT as a, useLineNumbers as c } from "./hooks/useLineNumbers/useLineNumbers.js";
7
+ import { useScrollSync as y } from "./hooks/useScrollSync/useScrollSync.js";
8
+ import { useTextActions as g } from "./hooks/useTextActions/useTextActions.js";
9
+ import { useKeyHandlers as N } from "./hooks/useKeyHandlers/useKeyHandlers.js";
10
+ export {
11
+ a as LINE_HEIGHT,
12
+ e as highlightSyntax,
13
+ s as processJson,
14
+ m as useFixFormat,
15
+ f as useHistoryNavigation,
16
+ N as useKeyHandlers,
17
+ c as useLineNumbers,
18
+ y as useScrollSync,
19
+ g as useTextActions,
20
+ i as useTextCoursore
21
+ };
@@ -0,0 +1,4 @@
1
+ import { processJson as s } from "./processJson.js";
2
+ export {
3
+ s as processJson
4
+ };
@@ -0,0 +1,11 @@
1
+ const c = (l) => {
2
+ let a = 0, p = !1, e = "";
3
+ for (let n = 0; n < l.length; n++) {
4
+ const s = l[n];
5
+ s === '"' && (n === 0 || l[n - 1] !== "\\") && (p = !p), p ? e += s : s === "{" || s === "}" ? s === "{" ? (e += a === 0 ? '<span class="json-bracket">{</span>' : '<span class="json-nested-bracket">{</span>', a++) : (a--, e += a === 0 ? '<span class="json-bracket">}</span>' : '<span class="json-nested-bracket">}</span>') : e += s;
6
+ }
7
+ return e.replace(/"([^"\\]*(?:\\.[^"\\]*)*)"\s*:/g, '<span class="json-key">"$1"</span>:').replace(/:\s*"([^"\\]*(?:\\.[^"\\]*)*)"/g, ': <span class="json-string">"$1"</span>').replace(/([:[,]\s*)(-?\d+\.?\d*([eE][+-]?\d+)?)/g, '$1<span class="json-number">$2</span>').replace(/([:[,]\s*)(true|false|null)/g, '$1<span class="json-literal">$2</span>');
8
+ };
9
+ export {
10
+ c as processJson
11
+ };
@@ -0,0 +1,8 @@
1
+ import { escapeHtml as a } from "../escapeHtml/escapeHtml.js";
2
+ const p = (s) => a(s).replace(/(&lt;\/?)([\w:-]+)(?=[\s&gt;])/g, '$1<span class="xml-tag">$2</span>').replace(
3
+ /([\w:-]+)=(&quot;[^&]*?&quot;)/g,
4
+ "<span class='xml-attr'>$1</span>=<span class='xml-value'>$2</span>"
5
+ );
6
+ export {
7
+ p as processXml
8
+ };
@@ -0,0 +1,27 @@
1
+ import { escapeHtml as c } from "../escapeHtml/escapeHtml.js";
2
+ const g = (r) => r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").split(`
3
+ `).map((t) => {
4
+ const p = t.match(/(.*?)(#.*)/);
5
+ let s = t, l = "";
6
+ if (p) {
7
+ const [, n, e] = p;
8
+ s = n, l = `<span class="comment">${c(e)}</span>`;
9
+ }
10
+ return s = s.replace(
11
+ /^(\s*)([^:\n]+)(:\s*)/,
12
+ (n, e, a, o) => `${e}<span class="key">${c(a)}</span>${o}`
13
+ ), s = s.replace(
14
+ /(:\s*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,
15
+ (n, e, a) => `${e}<span class="string">${c(a)}</span>`
16
+ ), s = s.replace(
17
+ /(:\s*)(\d+(?:\.\d+)?)/,
18
+ (n, e, a) => `${e}<span class="number">${a}</span>`
19
+ ), s = s.replace(
20
+ /(:\s*)(true|false|null)/,
21
+ (n, e, a) => `${e}<span class="boolean">${a}</span>`
22
+ ), s + l;
23
+ }).join(`
24
+ `);
25
+ export {
26
+ g as processYml
27
+ };
@@ -0,0 +1,50 @@
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { Link as x } from "react-router-dom";
3
+ import '../../../assets/src/components/Ui/CustomLink/CustomLink.css';/* empty css */
4
+ const j = ({
5
+ href: s,
6
+ children: t,
7
+ target: $ = "_self",
8
+ className: r = "",
9
+ style: a = {},
10
+ onClick: l,
11
+ ariaLabel: o,
12
+ title: e,
13
+ icon: n
14
+ }) => {
15
+ const i = !!(s != null && s.startsWith("http://")), m = `link ${r} ${i ? "external" : ""}`;
16
+ return i ? /* @__PURE__ */ p(
17
+ "a",
18
+ {
19
+ href: s,
20
+ target: $,
21
+ rel: "noopener noreferrer",
22
+ className: `${m} ${r}`,
23
+ style: a,
24
+ onClick: l,
25
+ "aria-label": o,
26
+ title: e,
27
+ children: [
28
+ n && /* @__PURE__ */ c("span", { className: "icon", children: n }),
29
+ t
30
+ ]
31
+ }
32
+ ) : /* @__PURE__ */ p(
33
+ x,
34
+ {
35
+ to: s,
36
+ className: `${m} ${r}`,
37
+ style: a,
38
+ onClick: l,
39
+ "aria-label": o,
40
+ title: e,
41
+ children: [
42
+ n && /* @__PURE__ */ c("span", { className: "icon", children: n }),
43
+ t
44
+ ]
45
+ }
46
+ );
47
+ };
48
+ export {
49
+ j as CustomLink
50
+ };
@@ -0,0 +1,4 @@
1
+ import { CustomLink as r } from "./CustomLink.js";
2
+ export {
3
+ r as CustomLink
4
+ };