@rolder/kit 3.0.0-alpha.6 → 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 +3 -3
  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,21 +0,0 @@
1
- async function blobToDataURL(blobUrl) {
2
- const response = await fetch(blobUrl);
3
- const blob = await response.blob();
4
- return new Promise((resolve, reject)=>{
5
- const reader = new FileReader();
6
- reader.onload = ()=>resolve(reader.result);
7
- reader.onerror = reject;
8
- reader.readAsDataURL(blob);
9
- });
10
- }
11
- async function convertFileUIPartBlobToDataURL(file) {
12
- if (file.url.startsWith('blob:')) {
13
- const dataUrl = await blobToDataURL(file.url);
14
- return {
15
- ...file,
16
- url: dataUrl
17
- };
18
- }
19
- return file;
20
- }
21
- export { convertFileUIPartBlobToDataURL };
@@ -1,2 +0,0 @@
1
- import { type TextUIPart } from 'ai';
2
- export declare const parseAiMessagePart: <T extends TextUIPart>(part: T) => Promise<T>;
@@ -1,12 +0,0 @@
1
- import { parsePartialJson } from "ai";
2
- const parseAiMessagePart = async (part)=>{
3
- if (!part.text.startsWith('{')) return part;
4
- try {
5
- const result = await parsePartialJson(part.text);
6
- return result?.value || part;
7
- } catch (error) {
8
- console.error('Error parsing partial JSON:', error);
9
- return part;
10
- }
11
- };
12
- export { parseAiMessagePart };
@@ -1,3 +0,0 @@
1
- export declare const AppDefaults: ({ saveColorScheme, }: {
2
- saveColorScheme: boolean;
3
- }) => null;
@@ -1,27 +0,0 @@
1
- import { useComputedColorScheme } from "@mantine/core";
2
- import { useEffect } from "react";
3
- import { setCookies } from "../functions/setCookies.js";
4
- const AppDefaults = ({ saveColorScheme })=>{
5
- const colorScheme = useComputedColorScheme();
6
- useEffect(()=>{
7
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
8
- const cookies = [
9
- {
10
- name: 'tz',
11
- value: tz,
12
- expires: 365
13
- }
14
- ];
15
- if (saveColorScheme) cookies.push({
16
- name: 'colorScheme',
17
- value: colorScheme,
18
- expires: 365
19
- });
20
- setCookies(cookies);
21
- }, [
22
- colorScheme,
23
- saveColorScheme
24
- ]);
25
- return null;
26
- };
27
- export { AppDefaults };
@@ -1,6 +0,0 @@
1
- import { type MantineProviderProps } from '@mantine/core';
2
- interface Props extends MantineProviderProps {
3
- saveColorScheme?: boolean;
4
- }
5
- export declare const DefaultApp: ({ children, saveColorScheme, defaultColorScheme, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,43 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { ColorSchemeScript, MantineProvider } from "@mantine/core";
3
- import { HeadContent, Scripts } from "@tanstack/react-router";
4
- import { getCookie } from "../functions/getCookie.js";
5
- import { AppDefaults } from "./AppDefaults.js";
6
- import { cookieColorSchemeManager } from "./cookieColorSchemeManager.js";
7
- import { defaultTheme } from "./defaultTheme.js";
8
- const colorSchemeManager = cookieColorSchemeManager();
9
- const DefaultApp = ({ children, saveColorScheme = true, defaultColorScheme = 'auto', ...props })=>{
10
- const colorScheme = saveColorScheme ? getCookie('colorScheme', defaultColorScheme) : defaultColorScheme;
11
- return /*#__PURE__*/ jsxs("html", {
12
- lang: "ru",
13
- suppressHydrationWarning: true,
14
- children: [
15
- /*#__PURE__*/ jsxs("head", {
16
- children: [
17
- /*#__PURE__*/ jsx(HeadContent, {}),
18
- /*#__PURE__*/ jsx(ColorSchemeScript, {
19
- defaultColorScheme: colorScheme
20
- })
21
- ]
22
- }),
23
- /*#__PURE__*/ jsxs("body", {
24
- children: [
25
- /*#__PURE__*/ jsxs(MantineProvider, {
26
- defaultColorScheme: colorScheme,
27
- theme: defaultTheme,
28
- colorSchemeManager: colorSchemeManager,
29
- ...props,
30
- children: [
31
- /*#__PURE__*/ jsx(AppDefaults, {
32
- saveColorScheme: saveColorScheme
33
- }),
34
- children
35
- ]
36
- }),
37
- /*#__PURE__*/ jsx(Scripts, {})
38
- ]
39
- })
40
- ]
41
- });
42
- };
43
- export { DefaultApp };
@@ -1,6 +0,0 @@
1
- import { type MantineColorSchemeManager } from '@mantine/core';
2
- export interface CookieColorSchemeManager {
3
- /** Название куки, `colorScheme` по умолчанию */
4
- key?: string;
5
- }
6
- export declare const cookieColorSchemeManager: ({ key, }?: CookieColorSchemeManager) => MantineColorSchemeManager;
@@ -1,46 +0,0 @@
1
- import { isMantineColorScheme } from "@mantine/core";
2
- import { atom } from "nanostores";
3
- import { setCookie } from "../functions/setCookie.js";
4
- const $colorScheme = atom();
5
- let unsubscribeSystemTheme;
6
- const cookieColorSchemeManager = ({ key = 'colorScheme' } = {})=>({
7
- get: (defaultValue)=>{
8
- try {
9
- return $colorScheme.get() || defaultValue;
10
- } catch {
11
- return defaultValue;
12
- }
13
- },
14
- set: (value)=>{
15
- try {
16
- setCookie(key, value);
17
- $colorScheme.set(value);
18
- } catch (error) {
19
- console.warn('[cookieColorSchemeManager] Ошибка при сохранении цветовой схемы в куки.', error);
20
- }
21
- },
22
- subscribe: (onUpdate)=>{
23
- $colorScheme.listen((newValue)=>{
24
- if (isMantineColorScheme(newValue)) {
25
- setCookie(key, newValue);
26
- onUpdate(newValue);
27
- }
28
- });
29
- const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
30
- const handleSystemThemeChange = ()=>onUpdate('auto');
31
- mediaQuery.addEventListener('change', handleSystemThemeChange);
32
- unsubscribeSystemTheme = ()=>mediaQuery.removeEventListener('change', handleSystemThemeChange);
33
- },
34
- unsubscribe: ()=>{
35
- $colorScheme.off();
36
- if (unsubscribeSystemTheme) {
37
- unsubscribeSystemTheme();
38
- unsubscribeSystemTheme = void 0;
39
- }
40
- },
41
- clear: ()=>{
42
- setCookie(key);
43
- $colorScheme.set(void 0);
44
- }
45
- });
46
- export { cookieColorSchemeManager };
@@ -1,4 +0,0 @@
1
- export declare const defaultRequestMiddlewares: import("@tanstack/start-client-core").RequestMiddlewareAfterServer<{}, undefined, {
2
- locale: string;
3
- timeZone: string;
4
- }>[];
@@ -1,24 +0,0 @@
1
- import { createMiddleware } from "@tanstack/react-start";
2
- import { getCookie, getRequestHeader, setCookie } from "@tanstack/react-start/server";
3
- const defaultRequestMiddlewares_locale = createMiddleware().server(async ({ next })=>{
4
- const header = getRequestHeader('accept-language');
5
- const headerLocale = header?.split(',')[0] || 'ru-RU';
6
- const cookieLocale = getCookie('locale');
7
- const cookieTz = getCookie('tz');
8
- const locale = cookieLocale || headerLocale;
9
- const timeZone = cookieTz || 'UTC';
10
- setCookie('locale', locale, {
11
- path: '/',
12
- maxAge: 31536000
13
- });
14
- return next({
15
- context: {
16
- locale,
17
- timeZone
18
- }
19
- });
20
- });
21
- const defaultRequestMiddlewares = [
22
- defaultRequestMiddlewares_locale
23
- ];
24
- export { defaultRequestMiddlewares };
@@ -1,141 +0,0 @@
1
- export declare const defaultTheme: {
2
- focusRing?: "auto" | "always" | "never" | undefined;
3
- scale?: number | undefined;
4
- fontSmoothing?: boolean | undefined;
5
- white?: string | undefined;
6
- black?: string | undefined;
7
- colors?: {
8
- [x: string & {}]: import("@mantine/core").MantineColorsTuple | undefined;
9
- dark?: import("@mantine/core").MantineColorsTuple | undefined;
10
- gray?: import("@mantine/core").MantineColorsTuple | undefined;
11
- red?: import("@mantine/core").MantineColorsTuple | undefined;
12
- pink?: import("@mantine/core").MantineColorsTuple | undefined;
13
- grape?: import("@mantine/core").MantineColorsTuple | undefined;
14
- violet?: import("@mantine/core").MantineColorsTuple | undefined;
15
- indigo?: import("@mantine/core").MantineColorsTuple | undefined;
16
- blue?: import("@mantine/core").MantineColorsTuple | undefined;
17
- cyan?: import("@mantine/core").MantineColorsTuple | undefined;
18
- green?: import("@mantine/core").MantineColorsTuple | undefined;
19
- lime?: import("@mantine/core").MantineColorsTuple | undefined;
20
- yellow?: import("@mantine/core").MantineColorsTuple | undefined;
21
- orange?: import("@mantine/core").MantineColorsTuple | undefined;
22
- teal?: import("@mantine/core").MantineColorsTuple | undefined;
23
- } | undefined;
24
- primaryShade?: import("@mantine/core").MantineColorShade | {
25
- light?: import("@mantine/core").MantineColorShade | undefined;
26
- dark?: import("@mantine/core").MantineColorShade | undefined;
27
- } | undefined;
28
- primaryColor?: string | undefined;
29
- variantColorResolver?: import("@mantine/core").VariantColorsResolver | undefined;
30
- autoContrast?: boolean | undefined;
31
- luminanceThreshold?: number | undefined;
32
- fontFamily?: string | undefined;
33
- fontFamilyMonospace?: string | undefined;
34
- headings?: {
35
- fontFamily?: string | undefined;
36
- fontWeight?: string | undefined;
37
- textWrap?: "balance" | "nowrap" | "wrap" | "stable" | "pretty" | undefined;
38
- sizes?: {
39
- h1?: {
40
- fontSize?: string | undefined;
41
- fontWeight?: string | undefined;
42
- lineHeight?: string | undefined;
43
- } | undefined;
44
- h2?: {
45
- fontSize?: string | undefined;
46
- fontWeight?: string | undefined;
47
- lineHeight?: string | undefined;
48
- } | undefined;
49
- h3?: {
50
- fontSize?: string | undefined;
51
- fontWeight?: string | undefined;
52
- lineHeight?: string | undefined;
53
- } | undefined;
54
- h4?: {
55
- fontSize?: string | undefined;
56
- fontWeight?: string | undefined;
57
- lineHeight?: string | undefined;
58
- } | undefined;
59
- h5?: {
60
- fontSize?: string | undefined;
61
- fontWeight?: string | undefined;
62
- lineHeight?: string | undefined;
63
- } | undefined;
64
- h6?: {
65
- fontSize?: string | undefined;
66
- fontWeight?: string | undefined;
67
- lineHeight?: string | undefined;
68
- } | undefined;
69
- } | undefined;
70
- } | undefined;
71
- radius?: {
72
- [x: string & {}]: string | undefined;
73
- xs?: string | undefined;
74
- sm?: string | undefined;
75
- md?: string | undefined;
76
- lg?: string | undefined;
77
- xl?: string | undefined;
78
- } | undefined;
79
- defaultRadius?: import("@mantine/core").MantineRadius | undefined;
80
- spacing?: {
81
- [x: number]: string | undefined;
82
- [x: string & {}]: string | undefined;
83
- xs?: string | undefined;
84
- sm?: string | undefined;
85
- md?: string | undefined;
86
- lg?: string | undefined;
87
- xl?: string | undefined;
88
- } | undefined;
89
- fontSizes?: {
90
- [x: string & {}]: string | undefined;
91
- xs?: string | undefined;
92
- sm?: string | undefined;
93
- md?: string | undefined;
94
- lg?: string | undefined;
95
- xl?: string | undefined;
96
- } | undefined;
97
- lineHeights?: {
98
- [x: string & {}]: string | undefined;
99
- xs?: string | undefined;
100
- sm?: string | undefined;
101
- md?: string | undefined;
102
- lg?: string | undefined;
103
- xl?: string | undefined;
104
- } | undefined;
105
- breakpoints?: {
106
- [x: string & {}]: string | undefined;
107
- xs?: string | undefined;
108
- sm?: string | undefined;
109
- md?: string | undefined;
110
- lg?: string | undefined;
111
- xl?: string | undefined;
112
- } | undefined;
113
- shadows?: {
114
- [x: string & {}]: string | undefined;
115
- xs?: string | undefined;
116
- sm?: string | undefined;
117
- md?: string | undefined;
118
- lg?: string | undefined;
119
- xl?: string | undefined;
120
- } | undefined;
121
- respectReducedMotion?: boolean | undefined;
122
- cursorType?: "default" | "pointer" | undefined;
123
- defaultGradient?: {
124
- from?: string | undefined;
125
- to?: string | undefined;
126
- deg?: number | undefined;
127
- } | undefined;
128
- activeClassName?: string | undefined;
129
- focusClassName?: string | undefined;
130
- components?: {
131
- [x: string]: {
132
- classNames?: any;
133
- styles?: any;
134
- vars?: any;
135
- defaultProps?: any;
136
- } | undefined;
137
- } | undefined;
138
- other?: {
139
- [x: string]: any;
140
- } | undefined;
141
- };
@@ -1,24 +0,0 @@
1
- import { Modal, createTheme } from "@mantine/core";
2
- const defaultTheme = createTheme({
3
- components: {
4
- Modal: Modal.extend({
5
- defaultProps: {
6
- centered: true,
7
- padding: 'lg'
8
- }
9
- }),
10
- ModalTitle: Modal.Title.extend({
11
- defaultProps: {
12
- pr: 24
13
- }
14
- }),
15
- ModalCloseButton: Modal.CloseButton.extend({
16
- defaultProps: {
17
- pos: 'absolute',
18
- top: 4,
19
- right: 4
20
- }
21
- })
22
- }
23
- });
24
- export { defaultTheme };
@@ -1,3 +0,0 @@
1
- export declare function getCookie<T extends string>(name: string, defaultValue: T): T;
2
- export declare function getCookie(name: string, defaultValue: string): string;
3
- export declare function getCookie(name: string, defaultValue?: undefined): string | undefined;
@@ -1,8 +0,0 @@
1
- import { createIsomorphicFn } from "@tanstack/react-start";
2
- import { getCookie } from "@tanstack/react-start/server";
3
- import js_cookie from "js-cookie";
4
- const getCookieImpl = createIsomorphicFn().server((name, defaultValue)=>getCookie(name) || defaultValue).client((name, defaultValue)=>js_cookie.get(name) || defaultValue);
5
- function getCookie_getCookie(name, defaultValue) {
6
- return getCookieImpl(name, defaultValue);
7
- }
8
- export { getCookie_getCookie as getCookie };
@@ -1,10 +0,0 @@
1
- /**
2
- * Изоморфная функция для установки значения куки.
3
- * На клиенте использует библиотеку js-cookie для работы с куками.
4
- * На сервере использует функции getCookie и setCookie из tanstack start.
5
- *
6
- * @param {string} name - Имя куки
7
- * @param {string} value - Значение куки, если не указано, кука будет удалена
8
- * @param {number} [expires=7] - Количество дней до истечения срока действия куки (по умолчанию 7 дней)
9
- */
10
- export declare const setCookie: import("@tanstack/start-fn-stubs").IsomorphicFn<[name: string, value?: string | undefined, expires?: number | undefined], void, void>;
@@ -1,19 +0,0 @@
1
- import { createIsomorphicFn } from "@tanstack/react-start";
2
- import { deleteCookie, setCookie } from "@tanstack/react-start/server";
3
- import js_cookie from "js-cookie";
4
- const setCookie_setCookie = createIsomorphicFn().server((name, value, expires)=>{
5
- const expiresDate = new Date();
6
- expiresDate.setDate(expiresDate.getDate() + (expires || 7));
7
- if (value) setCookie(name, value, {
8
- expires: expiresDate
9
- });
10
- else deleteCookie(name);
11
- }).client((name, value, expires)=>{
12
- const expiresDate = new Date();
13
- expiresDate.setDate(expiresDate.getDate() + (expires || 7));
14
- if (value) js_cookie.set(name, value, {
15
- expires: expiresDate
16
- });
17
- else js_cookie.remove(name);
18
- });
19
- export { setCookie_setCookie as setCookie };
@@ -1,14 +0,0 @@
1
- interface Cookie {
2
- name: string;
3
- value?: string;
4
- expires?: number;
5
- }
6
- /**
7
- * Клиентская функция для установки значения нескольких куки.
8
- * На клиенте использует библиотеку js-cookie для работы с куками.
9
- * На сервере использует функции getCookie и setCookie из tanstack start.
10
- *
11
- * @param {Cookie[]} cookies - Массив объектов с данными куки *
12
- */
13
- export declare const setCookies: (cookies: Cookie[]) => void;
14
- export {};
@@ -1,13 +0,0 @@
1
- import { createClientOnlyFn } from "@tanstack/react-start";
2
- import js_cookie from "js-cookie";
3
- const setCookies = createClientOnlyFn((cookies)=>{
4
- cookies.forEach(({ name, value, expires })=>{
5
- const expiresDate = new Date();
6
- expiresDate.setDate(expiresDate.getDate() + (expires || 7));
7
- if (value) js_cookie.set(name, value, {
8
- expires: expiresDate
9
- });
10
- else js_cookie.remove(name);
11
- });
12
- });
13
- export { setCookies };
@@ -1,4 +0,0 @@
1
- import { type UseMutationOptions } from '@tanstack/react-query';
2
- export declare const useMutation: <T, K = void>(fn: ({ data }: {
3
- data: T;
4
- }) => Promise<K>, options?: Omit<UseMutationOptions<K, Error, T>, "mutationFn">) => import("@tanstack/react-query").UseMutationResult<K, Error, T, unknown>;
@@ -1,8 +0,0 @@
1
- import { useMutation } from "@tanstack/react-query";
2
- const useMutation_useMutation = (fn, options)=>useMutation({
3
- mutationFn: (data)=>fn({
4
- data
5
- }),
6
- ...options
7
- });
8
- export { useMutation_useMutation as useMutation };
@@ -1,4 +0,0 @@
1
- import { type UseMutationOptions } from '@tanstack/react-query';
2
- export declare const useMutationWithInvalidate: <T, K = void>(fn: ({ data }: {
3
- data: T;
4
- }) => Promise<K>, queryKey: string[], options?: Omit<UseMutationOptions<K, Error, T>, "mutationFn" | "onSettled">) => import("@tanstack/react-query").UseMutationResult<K, Error, T, unknown>;
@@ -1,16 +0,0 @@
1
- import { useMutation, useQueryClient } from "@tanstack/react-query";
2
- const useMutationWithInvalidate = (fn, queryKey, options)=>{
3
- const queryClient = useQueryClient();
4
- return useMutation({
5
- mutationFn: (data)=>fn({
6
- data
7
- }),
8
- onSettled: async (_, error)=>{
9
- if (!error && queryKey.length) await queryClient.invalidateQueries({
10
- queryKey
11
- });
12
- },
13
- ...options
14
- });
15
- };
16
- export { useMutationWithInvalidate };
package/dist/index.js DELETED
@@ -1,26 +0,0 @@
1
- import { Conversation, useChatMessage } from "./ai/ui/conversation/index.js";
2
- import { PromptInput } from "./ai/ui/promptInput/index.js";
3
- import { convertFileUIPartBlobToDataURL } from "./ai/utils/convertFileUIPartBlobToDataURL.js";
4
- import { parseAiMessagePart } from "./ai/utils/parseAiMessagePart.js";
5
- import { DefaultApp } from "./app/DefaultApp.js";
6
- import { defaultRequestMiddlewares } from "./app/defaultRequestMiddlewares.js";
7
- import { defaultTheme } from "./app/defaultTheme.js";
8
- import { getCookie } from "./functions/getCookie.js";
9
- import { setCookie } from "./functions/setCookie.js";
10
- import { setCookies } from "./functions/setCookies.js";
11
- import { useMutation } from "./hooks/useMutation.js";
12
- import { useMutationWithInvalidate } from "./hooks/useMutationWithInvalidate.js";
13
- import { getDB } from "./surreal/connection.js";
14
- import { surrealDeleteFn, surrealUnsubscribeFn } from "./surreal/deafaultCrud.js";
15
- import { deserialize } from "./surreal/deserialize.js";
16
- import { encryptionFn } from "./surreal/encryption.js";
17
- import { Editor, useEditor } from "./ui/editor/index.js";
18
- import { DefaultError, DefaultNotFound, Forbidden, defaultErrorNotification } from "./ui/error/index.js";
19
- import { AnimatedChevron } from "./ui/AnimatedChevron.js";
20
- import { blurOnError, fieldsSchema, useAppForm, useFieldContext, withForm } from "./ui/form/index.js";
21
- import { HoverPaper, usePaperHover } from "./ui/hoverPaper/index.js";
22
- import { JsonInput } from "./ui/JsonInput.js";
23
- import { RouterLink } from "./ui/RouterLink.js";
24
- import { SaveInput } from "./ui/saveInput/index.js";
25
- import { ScrollArea, useScrollArea } from "./ui/scrollArea/index.js";
26
- export { AnimatedChevron, Conversation, DefaultApp, DefaultError, DefaultNotFound, Editor, Forbidden, HoverPaper, JsonInput, PromptInput, RouterLink, SaveInput, ScrollArea, blurOnError, convertFileUIPartBlobToDataURL, defaultErrorNotification, defaultRequestMiddlewares, defaultTheme, deserialize, encryptionFn, fieldsSchema, getCookie, getDB, parseAiMessagePart, setCookie, setCookies, surrealDeleteFn, surrealUnsubscribeFn, useAppForm, useChatMessage, useEditor, useFieldContext, useMutation, useMutationWithInvalidate, usePaperHover, useScrollArea, withForm };
@@ -1,9 +0,0 @@
1
- import { type CodecOptions, Surreal } from 'surrealdb';
2
- export declare const getDB: (params?: {
3
- url?: string;
4
- namespace?: string;
5
- database?: string;
6
- username?: string;
7
- password?: string;
8
- codecOptions?: CodecOptions;
9
- } | undefined) => Promise<Surreal>;
@@ -1,49 +0,0 @@
1
- import { createServerOnlyFn } from "@tanstack/react-start";
2
- import { getCookie } from "@tanstack/react-start/server";
3
- import { DateTime, Surreal } from "surrealdb";
4
- let db = null;
5
- const getDB = createServerOnlyFn(async (params = {})=>{
6
- if (db?.isConnected) return db;
7
- const locale = getCookie('locale') || 'ru-RU';
8
- const timeZone = getCookie('tz') || 'UTC';
9
- const instance = new Surreal({
10
- codecOptions: params.codecOptions || {
11
- valueDecodeVisitor (value) {
12
- if (value instanceof DateTime) return new Date(value.toDate()).toLocaleDateString(locale, {
13
- hour: 'numeric',
14
- minute: 'numeric',
15
- timeZone
16
- });
17
- return value;
18
- }
19
- }
20
- });
21
- try {
22
- const url = params.url || process.env.SURREALDB_URL;
23
- if (!url) throw new Error('Missing required SurrealDB URL');
24
- const namespace = params.namespace || process.env.SURREALDB_NAMESPACE;
25
- if (!namespace) throw new Error('Missing required SurrealDB namespace');
26
- const database = params.database || process.env.SURREALDB_DATABASE;
27
- if (!database) throw new Error('Missing required SurrealDB database');
28
- const username = params.username || process.env.SURREALDB_USERNAME;
29
- const password = params.password || process.env.SURREALDB_PASSWORD;
30
- if (username && password) await instance.connect(url, {
31
- authentication: {
32
- username,
33
- password
34
- }
35
- });
36
- else await instance.connect(url);
37
- await instance.use({
38
- namespace,
39
- database
40
- });
41
- db = instance;
42
- return instance;
43
- } catch (error) {
44
- console.error('Failed to connect to SurrealDB:', error);
45
- db = null;
46
- throw error;
47
- }
48
- });
49
- export { getDB };
@@ -1,2 +0,0 @@
1
- export declare const surrealDeleteFn: import("@tanstack/start-client-core").RequiredFetcher<undefined, (data: string) => string, Promise<void>>;
2
- export declare const surrealUnsubscribeFn: import("@tanstack/start-client-core").RequiredFetcher<undefined, (data: string) => string, Promise<void>>;
@@ -1,18 +0,0 @@
1
- import { createServerFn } from "@tanstack/react-start";
2
- import { getDB } from "./connection.js";
3
- import { deserialize } from "./deserialize.js";
4
- const surrealDeleteFn = createServerFn({
5
- method: 'POST'
6
- }).inputValidator((data)=>data).handler(async ({ data })=>{
7
- const db = await getDB();
8
- const id = deserialize(data);
9
- await db.delete(id);
10
- });
11
- const surrealUnsubscribeFn = createServerFn({
12
- method: 'POST'
13
- }).inputValidator((data)=>data).handler(async ({ data })=>{
14
- const db = await getDB();
15
- const live = await db.liveOf(data);
16
- await live.kill();
17
- });
18
- export { surrealDeleteFn, surrealUnsubscribeFn };
@@ -1,17 +0,0 @@
1
- import { RecordId } from 'surrealdb';
2
- /**
3
- * Type that converts specified string paths to RecordId, others stay as their original types
4
- */
5
- type DeserializeResult<T, IdPaths extends string = never> = T extends string ? RecordId<string> : T extends (infer U)[] ? U extends object ? {
6
- [K in keyof U]: K extends IdPaths ? RecordId<string> : U[K];
7
- }[] : DeserializeResult<U, IdPaths>[] : T extends object ? T extends Date ? T : {
8
- [K in keyof T]: K extends IdPaths ? RecordId<string> : T[K];
9
- } : T;
10
- /**
11
- * Deserializes DTO back to SurrealDB Record recursively based on specified ID paths
12
- */
13
- export declare function deserialize<T, K extends keyof T & string>(dto: T[], idPaths: K[]): DeserializeResult<T, K>[];
14
- export declare function deserialize<T, K extends keyof T & string>(dto: T, idPaths: K[]): DeserializeResult<T, K>;
15
- export declare function deserialize<T>(dto: T[]): DeserializeResult<T>[];
16
- export declare function deserialize<T>(dto: T): DeserializeResult<T>;
17
- export {};