@rolder/kit 3.0.0-alpha.7 → 3.0.0-alpha.8

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 (263) hide show
  1. package/package.json +1 -4
  2. package/rslib.config.ts +21 -0
  3. package/src/ai/ui/conversation/ConversationContext.ts +21 -0
  4. package/src/ai/ui/conversation/ConversationProvider.tsx +21 -0
  5. package/src/ai/ui/conversation/Empty.tsx +15 -0
  6. package/src/ai/ui/conversation/File.tsx +40 -0
  7. package/src/ai/ui/conversation/FileIcon.tsx +143 -0
  8. package/src/ai/ui/conversation/Loader.tsx +8 -0
  9. package/src/ai/ui/conversation/Message.tsx +34 -0
  10. package/src/ai/ui/conversation/Root.tsx +24 -0
  11. package/src/ai/ui/conversation/index.ts +16 -0
  12. package/{dist/ai/ui/conversation/types.d.ts → src/ai/ui/conversation/types.ts} +5 -4
  13. package/src/ai/ui/conversation/useChatMessage.ts +13 -0
  14. package/src/ai/ui/promptInput/File.tsx +98 -0
  15. package/src/ai/ui/promptInput/FileIcon.tsx +149 -0
  16. package/src/ai/ui/promptInput/Footer.tsx +5 -0
  17. package/src/ai/ui/promptInput/PromptInputContext.ts +24 -0
  18. package/src/ai/ui/promptInput/PromptInputProvider.tsx +54 -0
  19. package/src/ai/ui/promptInput/Root.tsx +29 -0
  20. package/src/ai/ui/promptInput/Submit.tsx +39 -0
  21. package/src/ai/ui/promptInput/Textarea.tsx +39 -0
  22. package/src/ai/ui/promptInput/index.ts +15 -0
  23. package/src/ai/ui/promptInput/types.ts +9 -0
  24. package/src/ai/utils/convertFileUIPartBlobToDataURL.ts +29 -0
  25. package/src/ai/utils/parseAiMessagePart.ts +19 -0
  26. package/src/app/AppDefaults.tsx +21 -0
  27. package/src/app/DefaultApp.tsx +50 -0
  28. package/src/app/cookieColorSchemeManager.ts +70 -0
  29. package/src/app/defaultRequestMiddlewares.ts +22 -0
  30. package/src/app/defaultTheme.ts +22 -0
  31. package/src/functions/getCookie.ts +36 -0
  32. package/src/functions/setCookie.ts +29 -0
  33. package/src/functions/setCookies.ts +24 -0
  34. package/src/hooks/useMutation.ts +14 -0
  35. package/src/hooks/useMutationWithInvalidate.ts +23 -0
  36. package/{dist/index.d.ts → src/index.ts} +45 -5
  37. package/{dist → src}/styles.css +21 -11
  38. package/src/surreal/connection.ts +72 -0
  39. package/src/surreal/deafaultCrud.ts +25 -0
  40. package/src/surreal/deserialize.ts +144 -0
  41. package/src/surreal/encryption.ts +51 -0
  42. package/src/ui/AnimatedChevron.tsx +32 -0
  43. package/src/ui/JsonInput.tsx +52 -0
  44. package/src/ui/RouterLink.tsx +78 -0
  45. package/src/ui/editor/Content.tsx +11 -0
  46. package/src/ui/editor/Provider.tsx +96 -0
  47. package/src/ui/editor/Root.tsx +25 -0
  48. package/src/ui/editor/Toolbar.tsx +92 -0
  49. package/src/ui/editor/index.ts +13 -0
  50. package/src/ui/editor/types.ts +7 -0
  51. package/src/ui/error/DefaultError.tsx +60 -0
  52. package/src/ui/error/DefaultNotFound.tsx +19 -0
  53. package/src/ui/error/Forbidden.tsx +18 -0
  54. package/src/ui/error/defaultErrorNotification.ts +9 -0
  55. package/src/ui/form/blurOnError.ts +21 -0
  56. package/src/ui/form/buttons/CancelButton.tsx +42 -0
  57. package/src/ui/form/buttons/SubmitButton.tsx +43 -0
  58. package/src/ui/form/buttons/SubscribeActionIcon.tsx +18 -0
  59. package/src/ui/form/buttons/SubscribeButton.tsx +17 -0
  60. package/src/ui/form/context.ts +45 -0
  61. package/src/ui/form/fields/JsonField.tsx +16 -0
  62. package/src/ui/form/fields/MultiSelectField.tsx +17 -0
  63. package/src/ui/form/fields/NumberField.tsx +17 -0
  64. package/src/ui/form/fields/PassowrdField.tsx +20 -0
  65. package/src/ui/form/fields/SelectField.tsx +17 -0
  66. package/src/ui/form/fields/SwitchField.tsx +17 -0
  67. package/src/ui/form/fields/TextField.tsx +17 -0
  68. package/src/ui/form/fields/TextPassowrdField.tsx +51 -0
  69. package/src/ui/form/fields/TextareaField.tsx +17 -0
  70. package/src/ui/form/fieldsSchema.ts +24 -0
  71. package/src/ui/hoverPaper/HoverPaper.tsx +17 -0
  72. package/src/ui/hoverPaper/usePaperHover.ts +9 -0
  73. package/src/ui/saveInput/JsonInput.tsx +40 -0
  74. package/src/ui/saveInput/NumberInput.tsx +40 -0
  75. package/src/ui/saveInput/SaveInput.tsx +15 -0
  76. package/src/ui/saveInput/Select.tsx +41 -0
  77. package/src/ui/saveInput/Switch.tsx +46 -0
  78. package/src/ui/saveInput/TextInput.tsx +40 -0
  79. package/src/ui/saveInput/Textarea.tsx +40 -0
  80. package/src/ui/scrollArea/ARCH.md +204 -0
  81. package/src/ui/scrollArea/README.md +369 -0
  82. package/{dist/ui/scrollArea/ScrollArea.d.ts → src/ui/scrollArea/ScrollArea.tsx} +41 -10
  83. package/src/ui/scrollArea/ScrollAreaButton.tsx +56 -0
  84. package/src/ui/scrollArea/ScrollAreaContent.tsx +36 -0
  85. package/{dist/ui/scrollArea/context.d.ts → src/ui/scrollArea/context.tsx} +18 -3
  86. package/src/ui/scrollArea/index.ts +10 -0
  87. package/src/ui/scrollArea/types.ts +77 -0
  88. package/src/ui/scrollArea/useScrollArea.ts +227 -0
  89. package/tsconfig.json +14 -0
  90. package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
  91. package/dist/ai/ui/conversation/ConversationContext.js +0 -8
  92. package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
  93. package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
  94. package/dist/ai/ui/conversation/Empty.d.ts +0 -1
  95. package/dist/ai/ui/conversation/Empty.js +0 -21
  96. package/dist/ai/ui/conversation/File.d.ts +0 -4
  97. package/dist/ai/ui/conversation/File.js +0 -42
  98. package/dist/ai/ui/conversation/FileIcon.d.ts +0 -3
  99. package/dist/ai/ui/conversation/FileIcon.js +0 -225
  100. package/dist/ai/ui/conversation/Loader.d.ts +0 -2
  101. package/dist/ai/ui/conversation/Loader.js +0 -12
  102. package/dist/ai/ui/conversation/Message.d.ts +0 -4
  103. package/dist/ai/ui/conversation/Message.js +0 -25
  104. package/dist/ai/ui/conversation/Root.d.ts +0 -2
  105. package/dist/ai/ui/conversation/Root.js +0 -26
  106. package/dist/ai/ui/conversation/index.d.ts +0 -13
  107. package/dist/ai/ui/conversation/index.js +0 -14
  108. package/dist/ai/ui/conversation/types.js +0 -0
  109. package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
  110. package/dist/ai/ui/conversation/useChatMessage.js +0 -12
  111. package/dist/ai/ui/promptInput/File.d.ts +0 -2
  112. package/dist/ai/ui/promptInput/File.js +0 -117
  113. package/dist/ai/ui/promptInput/FileIcon.d.ts +0 -3
  114. package/dist/ai/ui/promptInput/FileIcon.js +0 -225
  115. package/dist/ai/ui/promptInput/Footer.d.ts +0 -2
  116. package/dist/ai/ui/promptInput/Footer.js +0 -8
  117. package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
  118. package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
  119. package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
  120. package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
  121. package/dist/ai/ui/promptInput/Root.d.ts +0 -3
  122. package/dist/ai/ui/promptInput/Root.js +0 -17
  123. package/dist/ai/ui/promptInput/Submit.d.ts +0 -2
  124. package/dist/ai/ui/promptInput/Submit.js +0 -40
  125. package/dist/ai/ui/promptInput/Textarea.d.ts +0 -2
  126. package/dist/ai/ui/promptInput/Textarea.js +0 -33
  127. package/dist/ai/ui/promptInput/index.d.ts +0 -8
  128. package/dist/ai/ui/promptInput/index.js +0 -13
  129. package/dist/ai/ui/promptInput/types.d.ts +0 -11
  130. package/dist/ai/ui/promptInput/types.js +0 -0
  131. package/dist/ai/utils/convertFileUIPartBlobToDataURL.d.ts +0 -5
  132. package/dist/ai/utils/convertFileUIPartBlobToDataURL.js +0 -21
  133. package/dist/ai/utils/parseAiMessagePart.d.ts +0 -2
  134. package/dist/ai/utils/parseAiMessagePart.js +0 -12
  135. package/dist/app/AppDefaults.d.ts +0 -3
  136. package/dist/app/AppDefaults.js +0 -27
  137. package/dist/app/DefaultApp.d.ts +0 -6
  138. package/dist/app/DefaultApp.js +0 -43
  139. package/dist/app/cookieColorSchemeManager.d.ts +0 -6
  140. package/dist/app/cookieColorSchemeManager.js +0 -46
  141. package/dist/app/defaultRequestMiddlewares.d.ts +0 -4
  142. package/dist/app/defaultRequestMiddlewares.js +0 -24
  143. package/dist/app/defaultTheme.d.ts +0 -141
  144. package/dist/app/defaultTheme.js +0 -24
  145. package/dist/functions/getCookie.d.ts +0 -3
  146. package/dist/functions/getCookie.js +0 -8
  147. package/dist/functions/setCookie.d.ts +0 -10
  148. package/dist/functions/setCookie.js +0 -19
  149. package/dist/functions/setCookies.d.ts +0 -14
  150. package/dist/functions/setCookies.js +0 -13
  151. package/dist/hooks/useMutation.d.ts +0 -4
  152. package/dist/hooks/useMutation.js +0 -8
  153. package/dist/hooks/useMutationWithInvalidate.d.ts +0 -4
  154. package/dist/hooks/useMutationWithInvalidate.js +0 -16
  155. package/dist/index.js +0 -26
  156. package/dist/surreal/connection.d.ts +0 -9
  157. package/dist/surreal/connection.js +0 -49
  158. package/dist/surreal/deafaultCrud.d.ts +0 -2
  159. package/dist/surreal/deafaultCrud.js +0 -18
  160. package/dist/surreal/deserialize.d.ts +0 -17
  161. package/dist/surreal/deserialize.js +0 -46
  162. package/dist/surreal/encryption.d.ts +0 -6
  163. package/dist/surreal/encryption.js +0 -30
  164. package/dist/ui/AnimatedChevron.d.ts +0 -6
  165. package/dist/ui/AnimatedChevron.js +0 -31
  166. package/dist/ui/JsonInput.d.ts +0 -2
  167. package/dist/ui/JsonInput.js +0 -45
  168. package/dist/ui/RouterLink.d.ts +0 -16
  169. package/dist/ui/RouterLink.js +0 -36
  170. package/dist/ui/editor/Content.d.ts +0 -3
  171. package/dist/ui/editor/Content.js +0 -13
  172. package/dist/ui/editor/Provider.d.ts +0 -17
  173. package/dist/ui/editor/Provider.js +0 -80
  174. package/dist/ui/editor/Root.d.ts +0 -2
  175. package/dist/ui/editor/Root.js +0 -18
  176. package/dist/ui/editor/Toolbar.d.ts +0 -5
  177. package/dist/ui/editor/Toolbar.js +0 -156
  178. package/dist/ui/editor/index.d.ts +0 -12
  179. package/dist/ui/editor/index.js +0 -11
  180. package/dist/ui/editor/types.d.ts +0 -7
  181. package/dist/ui/editor/types.js +0 -0
  182. package/dist/ui/error/DefaultError.d.ts +0 -2
  183. package/dist/ui/error/DefaultError.js +0 -62
  184. package/dist/ui/error/DefaultNotFound.d.ts +0 -1
  185. package/dist/ui/error/DefaultNotFound.js +0 -37
  186. package/dist/ui/error/Forbidden.d.ts +0 -1
  187. package/dist/ui/error/Forbidden.js +0 -32
  188. package/dist/ui/error/defaultErrorNotification.d.ts +0 -1
  189. package/dist/ui/error/defaultErrorNotification.js +0 -8
  190. package/dist/ui/error/index.js +0 -5
  191. package/dist/ui/form/blurOnError.d.ts +0 -4
  192. package/dist/ui/form/blurOnError.js +0 -11
  193. package/dist/ui/form/buttons/CancelButton.d.ts +0 -5
  194. package/dist/ui/form/buttons/CancelButton.js +0 -44
  195. package/dist/ui/form/buttons/SubmitButton.d.ts +0 -5
  196. package/dist/ui/form/buttons/SubmitButton.js +0 -47
  197. package/dist/ui/form/buttons/SubscribeActionIcon.d.ts +0 -4
  198. package/dist/ui/form/buttons/SubscribeActionIcon.js +0 -15
  199. package/dist/ui/form/buttons/SubscribeButton.d.ts +0 -5
  200. package/dist/ui/form/buttons/SubscribeButton.js +0 -16
  201. package/dist/ui/form/buttons/index.js +0 -4
  202. package/dist/ui/form/context.d.ts +0 -83
  203. package/dist/ui/form/context.js +0 -26
  204. package/dist/ui/form/fields/JsonField.d.ts +0 -2
  205. package/dist/ui/form/fields/JsonField.js +0 -13
  206. package/dist/ui/form/fields/MultiSelectField.d.ts +0 -2
  207. package/dist/ui/form/fields/MultiSelectField.js +0 -15
  208. package/dist/ui/form/fields/NumberField.d.ts +0 -2
  209. package/dist/ui/form/fields/NumberField.js +0 -15
  210. package/dist/ui/form/fields/PassowrdField.d.ts +0 -2
  211. package/dist/ui/form/fields/PassowrdField.js +0 -18
  212. package/dist/ui/form/fields/SelectField.d.ts +0 -2
  213. package/dist/ui/form/fields/SelectField.js +0 -15
  214. package/dist/ui/form/fields/SwitchField.d.ts +0 -2
  215. package/dist/ui/form/fields/SwitchField.js +0 -15
  216. package/dist/ui/form/fields/TextField.d.ts +0 -2
  217. package/dist/ui/form/fields/TextField.js +0 -15
  218. package/dist/ui/form/fields/TextPassowrdField.d.ts +0 -2
  219. package/dist/ui/form/fields/TextPassowrdField.js +0 -51
  220. package/dist/ui/form/fields/TextareaField.d.ts +0 -2
  221. package/dist/ui/form/fields/TextareaField.js +0 -15
  222. package/dist/ui/form/fields/index.js +0 -9
  223. package/dist/ui/form/fieldsSchema.d.ts +0 -12
  224. package/dist/ui/form/fieldsSchema.js +0 -13
  225. package/dist/ui/form/index.js +0 -4
  226. package/dist/ui/hoverPaper/HoverPaper.d.ts +0 -6
  227. package/dist/ui/hoverPaper/HoverPaper.js +0 -15
  228. package/dist/ui/hoverPaper/index.js +0 -3
  229. package/dist/ui/hoverPaper/usePaperHover.d.ts +0 -4
  230. package/dist/ui/hoverPaper/usePaperHover.js +0 -9
  231. package/dist/ui/saveInput/JsonInput.d.ts +0 -6
  232. package/dist/ui/saveInput/JsonInput.js +0 -34
  233. package/dist/ui/saveInput/NumberInput.d.ts +0 -6
  234. package/dist/ui/saveInput/NumberInput.js +0 -27
  235. package/dist/ui/saveInput/SaveInput.d.ts +0 -36
  236. package/dist/ui/saveInput/SaveInput.js +0 -15
  237. package/dist/ui/saveInput/Select.d.ts +0 -6
  238. package/dist/ui/saveInput/Select.js +0 -27
  239. package/dist/ui/saveInput/Switch.d.ts +0 -6
  240. package/dist/ui/saveInput/Switch.js +0 -30
  241. package/dist/ui/saveInput/TextInput.d.ts +0 -6
  242. package/dist/ui/saveInput/TextInput.js +0 -26
  243. package/dist/ui/saveInput/Textarea.d.ts +0 -6
  244. package/dist/ui/saveInput/Textarea.js +0 -26
  245. package/dist/ui/saveInput/index.js +0 -2
  246. package/dist/ui/scrollArea/ScrollArea.js +0 -30
  247. package/dist/ui/scrollArea/ScrollAreaButton.d.ts +0 -5
  248. package/dist/ui/scrollArea/ScrollAreaButton.js +0 -51
  249. package/dist/ui/scrollArea/ScrollAreaContent.d.ts +0 -6
  250. package/dist/ui/scrollArea/ScrollAreaContent.js +0 -29
  251. package/dist/ui/scrollArea/context.js +0 -10
  252. package/dist/ui/scrollArea/index.d.ts +0 -3
  253. package/dist/ui/scrollArea/index.js +0 -3
  254. package/dist/ui/scrollArea/types.d.ts +0 -65
  255. package/dist/ui/scrollArea/types.js +0 -0
  256. package/dist/ui/scrollArea/useScrollArea.d.ts +0 -9
  257. package/dist/ui/scrollArea/useScrollArea.js +0 -146
  258. /package/{dist/ui/error/index.d.ts → src/ui/error/index.ts} +0 -0
  259. /package/{dist/ui/form/buttons/index.d.ts → src/ui/form/buttons/index.ts} +0 -0
  260. /package/{dist/ui/form/fields/index.d.ts → src/ui/form/fields/index.ts} +0 -0
  261. /package/{dist/ui/form/index.d.ts → src/ui/form/index.ts} +0 -0
  262. /package/{dist/ui/hoverPaper/index.d.ts → src/ui/hoverPaper/index.ts} +0 -0
  263. /package/{dist/ui/saveInput/index.d.ts → src/ui/saveInput/index.ts} +0 -0
@@ -1,46 +0,0 @@
1
- import { RecordId } from "surrealdb";
2
- const extractTableName = (str)=>{
3
- const match = str.match(/^([^:]+):/);
4
- return match ? match[1] : null;
5
- };
6
- const isRecordIdFormat = (str)=>/^[^:]+:.+$/.test(str);
7
- function deserialize(dto, idPaths) {
8
- if (Array.isArray(dto)) return dto.map((item)=>convertStringsToRecordIds(item, idPaths || []));
9
- return convertStringsToRecordIds(dto, idPaths || []);
10
- }
11
- const convertStringsToRecordIds = (obj, idPaths, currentPath = '')=>{
12
- if (null == obj) return obj;
13
- if (Array.isArray(obj)) {
14
- if (idPaths.includes(currentPath)) return obj.map((item)=>{
15
- if ('string' == typeof item && isRecordIdFormat(item)) {
16
- const tableName = extractTableName(item);
17
- if (tableName) return new RecordId(tableName, item.split(':')[1]);
18
- }
19
- return item;
20
- });
21
- return obj.map((item, index)=>convertStringsToRecordIds(item, idPaths, `${currentPath}[${index}]`));
22
- }
23
- if ('object' == typeof obj && !(obj instanceof Date)) {
24
- const result = {};
25
- for (const [key, value] of Object.entries(obj)){
26
- const fieldPath = currentPath ? `${currentPath}.${key}` : key;
27
- if ('string' == typeof value) {
28
- const shouldConvert = idPaths.includes(fieldPath) && isRecordIdFormat(value);
29
- if (shouldConvert) {
30
- const tableName = extractTableName(value);
31
- if (tableName) result[key] = new RecordId(tableName, value.split(':')[1]);
32
- else result[key] = value;
33
- } else result[key] = value;
34
- } else result[key] = convertStringsToRecordIds(value, idPaths, fieldPath);
35
- }
36
- return result;
37
- }
38
- if ('string' == typeof obj) {
39
- if (0 === idPaths.length && isRecordIdFormat(obj)) {
40
- const tableName = extractTableName(obj);
41
- if (tableName) return new RecordId(tableName, obj.split(':')[1]);
42
- }
43
- }
44
- return obj;
45
- };
46
- export { deserialize };
@@ -1,6 +0,0 @@
1
- type EncryptionInstance = {
2
- encrypt(text: string): string;
3
- decrypt(encryptedText: string): string;
4
- };
5
- export declare const encryptionFn: (secretHash: string) => EncryptionInstance;
6
- export {};
@@ -1,30 +0,0 @@
1
- import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
2
- import { createServerOnlyFn } from "@tanstack/react-start";
3
- const encryptionFn = createServerOnlyFn((secretHash)=>{
4
- class Encryption {
5
- key;
6
- constructor(secretHash){
7
- this.key = Buffer.from(secretHash, 'hex');
8
- }
9
- encrypt(text) {
10
- const algorithm = 'aes-256-cbc';
11
- const iv = randomBytes(16);
12
- const cipher = createCipheriv(algorithm, this.key, iv);
13
- let encrypted = cipher.update(text, 'utf8', 'hex');
14
- encrypted += cipher.final('hex');
15
- return `${iv.toString('hex')}:${encrypted}`;
16
- }
17
- decrypt(encryptedText) {
18
- const algorithm = 'aes-256-cbc';
19
- const parts = encryptedText.split(':');
20
- const iv = Buffer.from(parts[0], 'hex');
21
- const encrypted = parts[1];
22
- const decipher = createDecipheriv(algorithm, this.key, iv);
23
- let decrypted = decipher.update(encrypted, 'hex', 'utf8');
24
- decrypted += decipher.final('utf8');
25
- return decrypted;
26
- }
27
- }
28
- return new Encryption(secretHash);
29
- });
30
- export { encryptionFn };
@@ -1,6 +0,0 @@
1
- import type { SVGProps } from 'react';
2
- interface Props extends SVGProps<SVGSVGElement> {
3
- expanded?: boolean;
4
- }
5
- export declare const AnimatedChevron: ({ expanded, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,31 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsxs("svg", {
3
- xmlns: "http://www.w3.org/2000/svg",
4
- width: "24",
5
- height: "24",
6
- viewBox: "0 0 24 24",
7
- fill: "none",
8
- stroke: "currentColor",
9
- strokeWidth: "1.5",
10
- strokeLinecap: "round",
11
- strokeLinejoin: "round",
12
- role: "img",
13
- "aria-label": "Chevron",
14
- style: {
15
- transition: 'transform 0.2s ease-in-out',
16
- transform: expanded ? 'rotate(-180deg)' : 'rotate(0deg)',
17
- ...style
18
- },
19
- ...props,
20
- children: [
21
- /*#__PURE__*/ jsx("path", {
22
- stroke: "none",
23
- d: "M0 0h24v24H0z",
24
- fill: "none"
25
- }),
26
- /*#__PURE__*/ jsx("path", {
27
- d: "M6 9l6 6l6 -6"
28
- })
29
- ]
30
- });
31
- export { AnimatedChevron };
@@ -1,2 +0,0 @@
1
- import { type ReactCodeMirrorProps } from '@uiw/react-codemirror';
2
- export declare const JsonInput: (props: ReactCodeMirrorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,45 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { indentSelection } from "@codemirror/commands";
3
- import { json, jsonParseLinter } from "@codemirror/lang-json";
4
- import { linter } from "@codemirror/lint";
5
- import { keymap } from "@codemirror/view";
6
- import { vscodeDark, vscodeLight } from "@uiw/codemirror-theme-vscode";
7
- import react_codemirror from "@uiw/react-codemirror";
8
- import { getCookie } from "../functions/getCookie.js";
9
- const formatJson = (view)=>{
10
- try {
11
- const text = view.state.doc.toString();
12
- const parsed = JSON.parse(text);
13
- const formatted = JSON.stringify(parsed, null, 2);
14
- view.dispatch({
15
- changes: {
16
- from: 0,
17
- to: view.state.doc.length,
18
- insert: formatted
19
- }
20
- });
21
- return true;
22
- } catch (_) {
23
- return indentSelection(view);
24
- }
25
- };
26
- const extensions = [
27
- json(),
28
- linter(jsonParseLinter()),
29
- keymap.of([
30
- {
31
- key: 'Mod-Shift-f',
32
- run: formatJson
33
- }
34
- ])
35
- ];
36
- const JsonInput = (props)=>{
37
- const colorScheme = getCookie('colorScheme');
38
- return /*#__PURE__*/ jsx(react_codemirror, {
39
- height: "280px",
40
- theme: 'light' === colorScheme ? vscodeLight : vscodeDark,
41
- extensions: extensions,
42
- ...props
43
- });
44
- };
45
- export { JsonInput };
@@ -1,16 +0,0 @@
1
- import { type ActionIconProps, type AnchorProps, type ButtonProps, type UnstyledButtonProps } from '@mantine/core';
2
- import { type LinkComponent } from '@tanstack/react-router';
3
- interface MantineAnchorProps extends Omit<AnchorProps, 'href'> {
4
- }
5
- interface MantineButtonProps extends Omit<ButtonProps, 'href'> {
6
- }
7
- interface MantineActionIconProps extends Omit<ActionIconProps, 'href'> {
8
- }
9
- interface MantineUnstyledButtonProps extends Omit<UnstyledButtonProps, 'href'> {
10
- }
11
- export declare const RouterLink: LinkComponent<import("react").ForwardRefExoticComponent<MantineAnchorProps & import("react").RefAttributes<HTMLAnchorElement>>> & {
12
- Button: LinkComponent<import("react").ForwardRefExoticComponent<MantineButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
13
- ActionIcon: LinkComponent<import("react").ForwardRefExoticComponent<MantineActionIconProps & import("react").RefAttributes<HTMLButtonElement>>>;
14
- UnstyledButton: LinkComponent<import("react").ForwardRefExoticComponent<MantineUnstyledButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
15
- };
16
- export {};
@@ -1,36 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { ActionIcon, Anchor, Button, UnstyledButton } from "@mantine/core";
3
- import { createLink } from "@tanstack/react-router";
4
- import { forwardRef } from "react";
5
- const MantineLinkComponent = /*#__PURE__*/ forwardRef(({ classNames, ...props }, ref)=>/*#__PURE__*/ jsx(Anchor, {
6
- ref: ref,
7
- classNames: {
8
- root: 'rolder-router-link-root',
9
- ...classNames
10
- },
11
- c: "inherit",
12
- underline: "never",
13
- ...props
14
- }));
15
- const MantineButtonComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Button, {
16
- ref: ref,
17
- ...props
18
- }));
19
- const MantineActionIconComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(ActionIcon, {
20
- ref: ref,
21
- ...props
22
- }));
23
- const MantineUnstyledButtonComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(UnstyledButton, {
24
- ref: ref,
25
- ...props
26
- }));
27
- const RouterLinkBase = createLink(MantineLinkComponent);
28
- const RouterLinkButton = createLink(MantineButtonComponent);
29
- const RouterLinkActionIcon = createLink(MantineActionIconComponent);
30
- const RouterLinkUnstyledButton = createLink(MantineUnstyledButtonComponent);
31
- const RouterLink = Object.assign(RouterLinkBase, {
32
- Button: RouterLinkButton,
33
- ActionIcon: RouterLinkActionIcon,
34
- UnstyledButton: RouterLinkUnstyledButton
35
- });
36
- export { RouterLink };
@@ -1,3 +0,0 @@
1
- export declare const Content: ({ height }: {
2
- height: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { RichTextEditor } from "@mantine/tiptap";
3
- import { ScrollArea } from "../scrollArea/index.js";
4
- const Content = ({ height })=>/*#__PURE__*/ jsxs(ScrollArea, {
5
- h: height,
6
- autoScroll: true,
7
- radius: "md",
8
- children: [
9
- /*#__PURE__*/ jsx(RichTextEditor.Content, {}),
10
- /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
11
- ]
12
- });
13
- export { Content };
@@ -1,17 +0,0 @@
1
- import type { Editor } from '@tiptap/react';
2
- import type { EditorProps } from './types';
3
- interface EditorContext {
4
- editor: Editor | null;
5
- editable?: boolean;
6
- setEditable: (value: boolean) => void;
7
- disabledToolbar: boolean;
8
- setDisabledToolbar: (value: boolean) => void;
9
- focused: boolean;
10
- setFocused: (value: boolean) => void;
11
- editedByUser: boolean;
12
- setEditedByUser: (value: boolean) => void;
13
- }
14
- declare const EditorContext: import("react").Context<EditorContext | null>;
15
- export declare const Provider: ({ children, initialContent, initialEditable, initialDisabledToolbar, onChange, }: EditorProps) => import("react/jsx-runtime").JSX.Element;
16
- export declare const useEditor: () => EditorContext;
17
- export {};
@@ -1,80 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Link, getTaskListExtension } from "@mantine/tiptap";
3
- import extension_highlight from "@tiptap/extension-highlight";
4
- import extension_placeholder from "@tiptap/extension-placeholder";
5
- import { TableKit } from "@tiptap/extension-table";
6
- import extension_task_item from "@tiptap/extension-task-item";
7
- import extension_task_list from "@tiptap/extension-task-list";
8
- import extension_text_align from "@tiptap/extension-text-align";
9
- import { useEditor } from "@tiptap/react";
10
- import starter_kit from "@tiptap/starter-kit";
11
- import { createContext, useContext, useEffect, useState } from "react";
12
- const EditorContext = /*#__PURE__*/ createContext(null);
13
- const Provider = ({ children, initialContent, initialEditable = true, initialDisabledToolbar, onChange })=>{
14
- const editor = useEditor({
15
- shouldRerenderOnTransaction: false,
16
- immediatelyRender: false,
17
- extensions: [
18
- starter_kit.configure({
19
- link: false
20
- }),
21
- extension_placeholder.configure({
22
- placeholder: 'Документ пуст'
23
- }),
24
- Link,
25
- extension_highlight,
26
- extension_text_align.configure({
27
- types: [
28
- 'heading',
29
- 'paragraph'
30
- ]
31
- }),
32
- getTaskListExtension(extension_task_list),
33
- extension_task_item.configure({
34
- nested: true
35
- }),
36
- TableKit
37
- ],
38
- content: initialContent,
39
- onUpdate: ({ editor })=>{
40
- onChange?.(editor.getHTML());
41
- },
42
- editable: initialEditable
43
- });
44
- const [editable, setEditable] = useState(initialEditable);
45
- const [disabledToolbar, setDisabledToolbar] = useState(!!initialDisabledToolbar);
46
- const [editedByUser, setEditedByUser] = useState(true);
47
- const [focused, setFocused] = useState(false);
48
- useEffect(()=>{
49
- editor?.on('focus', ()=>setFocused(true));
50
- editor?.on('blur', ()=>setFocused(false));
51
- editor?.on('update', ({ transaction })=>{
52
- if (transaction.docChanged && focused) setEditedByUser(true);
53
- if (transaction.docChanged && !focused) setEditedByUser(false);
54
- });
55
- }, [
56
- editor,
57
- focused
58
- ]);
59
- const value = {
60
- editor,
61
- editable,
62
- setEditable,
63
- disabledToolbar,
64
- setDisabledToolbar,
65
- editedByUser,
66
- setEditedByUser,
67
- focused,
68
- setFocused
69
- };
70
- return /*#__PURE__*/ jsx(EditorContext.Provider, {
71
- value: value,
72
- children: children
73
- });
74
- };
75
- const Provider_useEditor = ()=>{
76
- const context = useContext(EditorContext);
77
- if (!context) throw new Error('useEditor must be used within EditorProvider');
78
- return context;
79
- };
80
- export { Provider, Provider_useEditor as useEditor };
@@ -1,2 +0,0 @@
1
- import { type RichTextEditorProps } from '@mantine/tiptap';
2
- export declare const Root: ({ children, classNames, ...props }: Omit<RichTextEditorProps, "editor">) => import("react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { RichTextEditor } from "@mantine/tiptap";
3
- import { useEditor } from "./Provider.js";
4
- const Root = ({ children, classNames, ...props })=>{
5
- const { editor } = useEditor();
6
- return /*#__PURE__*/ jsx(RichTextEditor, {
7
- editor: editor,
8
- classNames: {
9
- root: 'rolder-editor-root',
10
- content: 'rolder-editor-content',
11
- toolbar: 'rolder-editor-toolbar',
12
- ...classNames
13
- },
14
- ...props,
15
- children: children
16
- });
17
- };
18
- export { Root };
@@ -1,5 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export declare const Toolbar: ({ saving, children, }: {
3
- saving?: boolean;
4
- children?: ReactNode;
5
- }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,156 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Loader } from "@mantine/core";
3
- import { RichTextEditor } from "@mantine/tiptap";
4
- import { useEditor } from "./Provider.js";
5
- const Toolbar = ({ saving, children })=>{
6
- const { editor, disabledToolbar } = useEditor();
7
- return disabledToolbar ? null : /*#__PURE__*/ jsxs(RichTextEditor.Toolbar, {
8
- sticky: true,
9
- children: [
10
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
11
- children: [
12
- /*#__PURE__*/ jsx(RichTextEditor.Bold, {
13
- disabled: !editor?.isEditable
14
- }),
15
- /*#__PURE__*/ jsx(RichTextEditor.Italic, {
16
- disabled: !editor?.isEditable
17
- }),
18
- /*#__PURE__*/ jsx(RichTextEditor.Underline, {
19
- disabled: !editor?.isEditable
20
- }),
21
- /*#__PURE__*/ jsx(RichTextEditor.Strikethrough, {
22
- disabled: !editor?.isEditable
23
- }),
24
- /*#__PURE__*/ jsx(RichTextEditor.ClearFormatting, {
25
- disabled: !editor?.isEditable
26
- }),
27
- /*#__PURE__*/ jsx(RichTextEditor.Highlight, {
28
- disabled: !editor?.isEditable
29
- }),
30
- /*#__PURE__*/ jsx(RichTextEditor.Code, {
31
- disabled: !editor?.isEditable
32
- })
33
- ]
34
- }),
35
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
36
- children: [
37
- /*#__PURE__*/ jsx(RichTextEditor.H1, {
38
- disabled: !editor?.isEditable
39
- }),
40
- /*#__PURE__*/ jsx(RichTextEditor.H2, {
41
- disabled: !editor?.isEditable
42
- }),
43
- /*#__PURE__*/ jsx(RichTextEditor.H3, {
44
- disabled: !editor?.isEditable
45
- }),
46
- /*#__PURE__*/ jsx(RichTextEditor.H4, {
47
- disabled: !editor?.isEditable
48
- })
49
- ]
50
- }),
51
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
52
- children: [
53
- /*#__PURE__*/ jsx(RichTextEditor.Blockquote, {
54
- disabled: !editor?.isEditable
55
- }),
56
- /*#__PURE__*/ jsx(RichTextEditor.Hr, {
57
- disabled: !editor?.isEditable
58
- }),
59
- /*#__PURE__*/ jsx(RichTextEditor.BulletList, {
60
- disabled: !editor?.isEditable
61
- }),
62
- /*#__PURE__*/ jsx(RichTextEditor.OrderedList, {
63
- disabled: !editor?.isEditable
64
- })
65
- ]
66
- }),
67
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
68
- children: [
69
- /*#__PURE__*/ jsx(RichTextEditor.TaskList, {
70
- disabled: !editor?.isEditable
71
- }),
72
- /*#__PURE__*/ jsx(RichTextEditor.TaskListLift, {
73
- disabled: !editor?.isEditable
74
- }),
75
- /*#__PURE__*/ jsx(RichTextEditor.TaskListSink, {
76
- disabled: !editor?.isEditable
77
- })
78
- ]
79
- }),
80
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
81
- children: [
82
- /*#__PURE__*/ jsx(RichTextEditor.Link, {
83
- disabled: !editor?.isEditable
84
- }),
85
- /*#__PURE__*/ jsx(RichTextEditor.Unlink, {
86
- disabled: !editor?.isEditable
87
- })
88
- ]
89
- }),
90
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
91
- children: [
92
- /*#__PURE__*/ jsx(RichTextEditor.AlignLeft, {
93
- disabled: !editor?.isEditable
94
- }),
95
- /*#__PURE__*/ jsx(RichTextEditor.AlignCenter, {
96
- disabled: !editor?.isEditable
97
- }),
98
- /*#__PURE__*/ jsx(RichTextEditor.AlignJustify, {
99
- disabled: !editor?.isEditable
100
- }),
101
- /*#__PURE__*/ jsx(RichTextEditor.AlignRight, {
102
- disabled: !editor?.isEditable
103
- })
104
- ]
105
- }),
106
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
107
- children: [
108
- /*#__PURE__*/ jsx(RichTextEditor.Undo, {
109
- disabled: !editor?.isEditable
110
- }),
111
- /*#__PURE__*/ jsx(RichTextEditor.Redo, {
112
- disabled: !editor?.isEditable
113
- })
114
- ]
115
- }),
116
- /*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
117
- ml: "auto",
118
- children: [
119
- children,
120
- /*#__PURE__*/ jsx(RichTextEditor.Control, {
121
- ml: "10px",
122
- style: {
123
- cursor: 'default'
124
- },
125
- children: saving ? /*#__PURE__*/ jsx(Loader, {
126
- size: 14
127
- }) : /*#__PURE__*/ jsxs("svg", {
128
- xmlns: "http://www.w3.org/2000/svg",
129
- width: "16",
130
- height: "16",
131
- viewBox: "0 0 16 16",
132
- fill: "none",
133
- stroke: "currentColor",
134
- strokeWidth: "1.5",
135
- strokeLinecap: "round",
136
- strokeLinejoin: "round",
137
- role: "img",
138
- "aria-label": "Saved",
139
- children: [
140
- /*#__PURE__*/ jsx("path", {
141
- stroke: "none",
142
- d: "M0 0h24v24H0z",
143
- fill: "none"
144
- }),
145
- /*#__PURE__*/ jsx("path", {
146
- d: "M5 12l5 5l10 -10"
147
- })
148
- ]
149
- })
150
- })
151
- ]
152
- })
153
- ]
154
- });
155
- };
156
- export { Toolbar };
@@ -1,12 +0,0 @@
1
- export declare const Editor: {
2
- Root: ({ children, classNames, ...props }: Omit<import("@mantine/tiptap").RichTextEditorProps, "editor">) => import("react/jsx-runtime").JSX.Element;
3
- Content: ({ height }: {
4
- height: string;
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- Toolbar: ({ saving, children, }: {
7
- saving?: boolean;
8
- children?: import("react").ReactNode;
9
- }) => import("react/jsx-runtime").JSX.Element | null;
10
- Provider: ({ children, initialContent, initialEditable, initialDisabledToolbar, onChange, }: import("./types").EditorProps) => import("react/jsx-runtime").JSX.Element;
11
- };
12
- export { useEditor } from './Provider';
@@ -1,11 +0,0 @@
1
- import { Content } from "./Content.js";
2
- import { Provider, useEditor } from "./Provider.js";
3
- import { Root } from "./Root.js";
4
- import { Toolbar } from "./Toolbar.js";
5
- const Editor = {
6
- Root: Root,
7
- Content: Content,
8
- Toolbar: Toolbar,
9
- Provider: Provider
10
- };
11
- export { Editor, useEditor };
@@ -1,7 +0,0 @@
1
- export interface EditorProps {
2
- children: React.ReactNode;
3
- initialContent?: string;
4
- initialEditable?: boolean;
5
- initialDisabledToolbar?: boolean;
6
- onChange?: (value: string) => void;
7
- }
File without changes
@@ -1,2 +0,0 @@
1
- import type { ErrorComponentProps } from '@tanstack/react-router';
2
- export declare const DefaultError: ({ error }: ErrorComponentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,62 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Button, Group, Stack, Title } from "@mantine/core";
3
- import { rootRouteId, useMatch, useRouter } from "@tanstack/react-router";
4
- import { RouterLink } from "../RouterLink.js";
5
- const DefaultError = ({ error })=>{
6
- const router = useRouter();
7
- const isRoot = useMatch({
8
- strict: false,
9
- select: (state)=>state.id === rootRouteId
10
- });
11
- return /*#__PURE__*/ jsxs(Stack, {
12
- align: "center",
13
- justify: "center",
14
- gap: 0,
15
- ta: "center",
16
- h: "100vh",
17
- children: [
18
- /*#__PURE__*/ jsx(Title, {
19
- textWrap: "balance",
20
- size: 65,
21
- children: "Произошла ошибка!"
22
- }),
23
- error.message && /*#__PURE__*/ jsx(Title, {
24
- order: 3,
25
- ml: 4,
26
- textWrap: "balance",
27
- c: "var(--mantine-color-error)",
28
- children: error.message
29
- }),
30
- /*#__PURE__*/ jsxs(Group, {
31
- children: [
32
- /*#__PURE__*/ jsx(Button, {
33
- mt: "xl",
34
- size: "lg",
35
- variant: "light",
36
- onClick: ()=>{
37
- router.invalidate();
38
- },
39
- children: "Попробовать еще раз"
40
- }),
41
- isRoot ? /*#__PURE__*/ jsx(RouterLink.Button, {
42
- to: "/",
43
- mt: "xl",
44
- size: "lg",
45
- radius: "md",
46
- children: "На главную"
47
- }) : /*#__PURE__*/ jsx(Button, {
48
- mt: "xl",
49
- radius: "md",
50
- size: "lg",
51
- onClick: (e)=>{
52
- e.preventDefault();
53
- router.history.back();
54
- },
55
- children: "Назад"
56
- })
57
- ]
58
- })
59
- ]
60
- });
61
- };
62
- export { DefaultError };
@@ -1 +0,0 @@
1
- export declare const DefaultNotFound: () => import("react/jsx-runtime").JSX.Element;