@rolder/kit 3.0.0-alpha-9 → 3.0.0-alpha-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/ai/index.js +0 -2
- package/dist/ai/ui/conversation/ConversationContext.js +0 -8
- package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
- package/dist/ai/ui/conversation/Empty.js +0 -21
- package/dist/ai/ui/conversation/File.js +0 -42
- package/dist/ai/ui/conversation/FileIcon.js +0 -43
- package/dist/ai/ui/conversation/Loader.js +0 -12
- package/dist/ai/ui/conversation/Message.js +0 -25
- package/dist/ai/ui/conversation/Root.js +0 -26
- package/dist/ai/ui/conversation/index.js +0 -15
- package/dist/ai/ui/conversation/types.js +0 -0
- package/dist/ai/ui/conversation/useChatMessage.js +0 -12
- package/dist/ai/ui/index.js +0 -2
- package/dist/ai/ui/promptInput/File.js +0 -69
- package/dist/ai/ui/promptInput/FileIcon.js +0 -43
- package/dist/ai/ui/promptInput/Footer.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
- package/dist/ai/ui/promptInput/Root.js +0 -18
- package/dist/ai/ui/promptInput/Submit.js +0 -21
- package/dist/ai/ui/promptInput/Textarea.js +0 -34
- package/dist/ai/ui/promptInput/index.js +0 -14
- package/dist/ai/ui/promptInput/styles.module.js +0 -7
- package/dist/ai/ui/promptInput/styles_module.css +0 -24
- package/dist/ai/ui/promptInput/types.js +0 -0
- package/dist/ai/utils/convertFileUIPartBlobToDataURL.js +0 -21
- package/dist/ai/utils/index.js +0 -2
- package/dist/ai/utils/parseAiMessagePart.js +0 -12
- package/dist/app/AppDefaults.js +0 -27
- package/dist/app/DefaultApp.js +0 -43
- package/dist/app/cookieColorSchemeManager.js +0 -46
- package/dist/app/defaultRequestMiddlewares.js +0 -24
- package/dist/app/defaultTheme.js +0 -24
- package/dist/app/index.js +0 -3
- package/dist/functions/cookies/getCookie.js +0 -8
- package/dist/functions/cookies/index.js +0 -3
- package/dist/functions/cookies/setCookie.js +0 -19
- package/dist/functions/cookies/setCookies.js +0 -13
- package/dist/functions/index.js +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/useMutation.js +0 -8
- package/dist/hooks/useMutationWithInvalidate.js +0 -16
- package/dist/surreal/connection.js +0 -49
- package/dist/surreal/deafaultCrud.js +0 -18
- package/dist/surreal/deserialize.js +0 -46
- package/dist/surreal/encryption.js +0 -30
- package/dist/surreal/index.js +0 -5
- package/dist/ui/AnimatedChevron.js +0 -13
- package/dist/ui/JsonInput.js +0 -45
- package/dist/ui/editor/Content.js +0 -13
- package/dist/ui/editor/Provider.js +0 -80
- package/dist/ui/editor/Root.js +0 -19
- package/dist/ui/editor/Toolbar.js +0 -138
- package/dist/ui/editor/index.js +0 -11
- package/dist/ui/editor/styles.module.js +0 -7
- package/dist/ui/editor/styles_module.css +0 -16
- package/dist/ui/editor/types.js +0 -0
- package/dist/ui/error/DefaultError.js +0 -62
- package/dist/ui/error/DefaultNotFound.js +0 -37
- package/dist/ui/error/Forbidden.js +0 -32
- package/dist/ui/error/defaultErrorNotification.js +0 -8
- package/dist/ui/error/index.js +0 -4
- package/dist/ui/form/blurOnError.js +0 -11
- package/dist/ui/form/buttons/CancelButton.js +0 -22
- package/dist/ui/form/buttons/SubmitButton.js +0 -22
- package/dist/ui/form/buttons/SubscribeActionIcon.js +0 -15
- package/dist/ui/form/buttons/SubscribeButton.js +0 -16
- package/dist/ui/form/buttons/index.js +0 -4
- package/dist/ui/form/context.js +0 -26
- package/dist/ui/form/fields/JsonField.js +0 -13
- package/dist/ui/form/fields/MultiSelectField.js +0 -15
- package/dist/ui/form/fields/NumberField.js +0 -15
- package/dist/ui/form/fields/PassowrdField.js +0 -18
- package/dist/ui/form/fields/SelectField.js +0 -15
- package/dist/ui/form/fields/SwitchField.js +0 -15
- package/dist/ui/form/fields/TextField.js +0 -15
- package/dist/ui/form/fields/TextPassowrdField.js +0 -29
- package/dist/ui/form/fields/TextareaField.js +0 -15
- package/dist/ui/form/fields/index.js +0 -9
- package/dist/ui/form/fieldsSchema.js +0 -13
- package/dist/ui/form/index.js +0 -4
- package/dist/ui/hoverPaper/HoverPaper.js +0 -16
- package/dist/ui/hoverPaper/index.js +0 -2
- package/dist/ui/hoverPaper/styles.module.js +0 -5
- package/dist/ui/hoverPaper/styles_module.css +0 -15
- package/dist/ui/hoverPaper/usePaperHover.js +0 -9
- package/dist/ui/index.js +0 -9
- package/dist/ui/routerLink/RouterLink.js +0 -37
- package/dist/ui/routerLink/index.js +0 -1
- package/dist/ui/routerLink/styles.module.js +0 -5
- package/dist/ui/routerLink/styles_module.css +0 -5
- package/dist/ui/saveInput/JsonInput.js +0 -34
- package/dist/ui/saveInput/NumberInput.js +0 -27
- package/dist/ui/saveInput/SaveInput.js +0 -15
- package/dist/ui/saveInput/Select.js +0 -27
- package/dist/ui/saveInput/Switch.js +0 -30
- package/dist/ui/saveInput/TextInput.js +0 -26
- package/dist/ui/saveInput/Textarea.js +0 -26
- package/dist/ui/saveInput/index.js +0 -2
- package/dist/ui/scrollArea/ScrollArea.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaButton.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaContent.js +0 -30
- package/dist/ui/scrollArea/context.js +0 -10
- package/dist/ui/scrollArea/index.js +0 -3
- package/dist/ui/scrollArea/styles.module.js +0 -7
- package/dist/ui/scrollArea/styles_module.css +0 -14
- package/dist/ui/scrollArea/types.js +0 -0
- package/dist/ui/scrollArea/useScrollArea.js +0 -146
package/dist/app/DefaultApp.js
DELETED
|
@@ -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/index.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,46 +0,0 @@
|
|
|
1
|
-
import { isMantineColorScheme } from "@mantine/core";
|
|
2
|
-
import { atom } from "nanostores";
|
|
3
|
-
import { setCookie } from "../functions/index.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,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 };
|
package/dist/app/defaultTheme.js
DELETED
|
@@ -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 };
|
package/dist/app/index.js
DELETED
|
@@ -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,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,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 };
|
package/dist/functions/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./cookies/index.js";
|
package/dist/hooks/index.js
DELETED
|
@@ -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 };
|
|
@@ -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,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,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,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 };
|
package/dist/surreal/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { IconChevronDown } from "@tabler/icons-react";
|
|
3
|
-
const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsx(IconChevronDown, {
|
|
4
|
-
strokeWidth: 1.5,
|
|
5
|
-
"data-expanded": expanded,
|
|
6
|
-
style: {
|
|
7
|
-
transition: 'transform 0.2s ease-in-out',
|
|
8
|
-
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
9
|
-
...style
|
|
10
|
-
},
|
|
11
|
-
...props
|
|
12
|
-
});
|
|
13
|
-
export { AnimatedChevron };
|
package/dist/ui/JsonInput.js
DELETED
|
@@ -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/index.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,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,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 };
|
package/dist/ui/editor/Root.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { RichTextEditor } from "@mantine/tiptap";
|
|
3
|
-
import { useEditor } from "./Provider.js";
|
|
4
|
-
import styles_module from "./styles.module.js";
|
|
5
|
-
const Root = ({ children, classNames, ...props })=>{
|
|
6
|
-
const { editor } = useEditor();
|
|
7
|
-
return /*#__PURE__*/ jsx(RichTextEditor, {
|
|
8
|
-
editor: editor,
|
|
9
|
-
classNames: {
|
|
10
|
-
root: styles_module.root,
|
|
11
|
-
content: styles_module.content,
|
|
12
|
-
toolbar: styles_module.toolbar,
|
|
13
|
-
...classNames
|
|
14
|
-
},
|
|
15
|
-
...props,
|
|
16
|
-
children: children
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export { Root };
|