@rolder/kit 3.0.0-alpha.11 → 3.0.0-alpha.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/ui/chat/Root.d.ts +55 -0
- package/dist/ai/ui/chat/Root.js +18 -0
- package/dist/ai/ui/chat/chatInput/File.js +71 -0
- package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
- package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
- package/dist/ai/ui/chat/chatInput/Root.js +24 -0
- package/dist/ai/ui/chat/chatInput/Submit.js +23 -0
- package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.js +8 -7
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.d.ts +2 -3
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.js +2 -2
- package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
- package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
- package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
- package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
- package/dist/ai/ui/chat/chatInput/store/input.js +81 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
- package/dist/ai/ui/chat/index.d.ts +12 -0
- package/dist/ai/ui/chat/index.js +15 -0
- package/dist/ai/ui/chat/messages/Empty.d.ts +4 -0
- package/dist/ai/ui/chat/messages/Empty.js +11 -0
- package/dist/ai/ui/chat/messages/Loader.d.ts +5 -0
- package/dist/ai/ui/chat/messages/Loader.js +12 -0
- package/dist/ai/ui/chat/messages/Message.d.ts +8 -0
- package/dist/ai/ui/chat/messages/Message.js +22 -0
- package/dist/ai/ui/chat/messages/Messages.d.ts +3 -0
- package/dist/ai/ui/chat/messages/Messages.js +40 -0
- package/dist/ai/ui/chat/messages/index.d.ts +2 -0
- package/dist/ai/ui/chat/messages/index.js +2 -0
- package/dist/ai/ui/chat/parts/File.d.ts +6 -0
- package/dist/ai/ui/{conversation → chat/parts}/File.js +10 -10
- package/dist/ai/ui/chat/parts/FileIcon.js +43 -0
- package/dist/ai/ui/chat/parts/PartPaper.d.ts +8 -0
- package/dist/ai/ui/chat/parts/PartPaper.js +14 -0
- package/dist/ai/ui/chat/parts/TextPart.d.ts +6 -0
- package/dist/ai/ui/chat/parts/TextPart.js +15 -0
- package/dist/ai/ui/chat/parts/ToolExecution.d.ts +7 -0
- package/dist/ai/ui/chat/parts/ToolExecution.js +56 -0
- package/dist/ai/ui/chat/parts/ToolPart.d.ts +10 -0
- package/dist/ai/ui/chat/parts/ToolPart.js +24 -0
- package/dist/ai/ui/chat/parts/index.d.ts +3 -0
- package/dist/ai/ui/chat/parts/index.js +3 -0
- package/dist/ai/ui/chat/store/index.d.ts +4 -0
- package/dist/ai/ui/chat/store/index.js +4 -0
- package/dist/ai/ui/chat/store/messages.d.ts +12 -0
- package/dist/ai/ui/chat/store/messages.js +40 -0
- package/dist/ai/ui/chat/store/send.d.ts +14 -0
- package/dist/ai/ui/chat/store/send.js +16 -0
- package/dist/ai/ui/chat/store/states.d.ts +11 -0
- package/dist/ai/ui/chat/store/states.js +20 -0
- package/dist/ai/ui/chat/store/useInitChat.d.ts +3 -0
- package/dist/ai/ui/chat/store/useInitChat.js +40 -0
- package/dist/ai/ui/index.d.ts +1 -0
- package/dist/ai/ui/index.js +1 -0
- package/dist/ai/utils/index.d.ts +2 -0
- package/dist/ai/utils/index.js +2 -0
- package/dist/app/AppDefaults.js +1 -1
- package/dist/app/DefaultApp.js +1 -1
- package/dist/app/cookieColorSchemeManager.js +1 -1
- package/dist/app/defaultTheme.d.ts +7 -7
- package/dist/app/index.d.ts +3 -0
- package/dist/app/index.js +3 -0
- package/dist/betterAuth/client/getAuthClient.d.ts +3050 -0
- package/dist/betterAuth/client/getAuthClient.js +18 -0
- package/dist/betterAuth/client/index.d.ts +1 -0
- package/dist/betterAuth/client/index.js +1 -0
- package/dist/betterAuth/index.d.ts +3 -0
- package/dist/betterAuth/index.js +3 -0
- package/dist/betterAuth/server/defaultAuthServerConfig.d.ts +1243 -0
- package/dist/betterAuth/server/defaultAuthServerConfig.js +50 -0
- package/dist/betterAuth/server/env.d.ts +1 -0
- package/dist/betterAuth/server/env.js +8 -0
- package/dist/betterAuth/server/getDBSession.d.ts +2 -0
- package/dist/betterAuth/server/getDBSession.js +85 -0
- package/dist/betterAuth/server/getSessionToken.d.ts +1 -0
- package/dist/betterAuth/server/getSessionToken.js +15 -0
- package/dist/betterAuth/server/getSessionUser.d.ts +1 -0
- package/dist/betterAuth/server/getSessionUser.js +22 -0
- package/dist/betterAuth/server/index.d.ts +10 -0
- package/dist/betterAuth/server/index.js +11 -0
- package/dist/betterAuth/server/surrealDbAdapter/adapter.d.ts +8 -0
- package/dist/betterAuth/server/surrealDbAdapter/adapter.js +64 -0
- package/dist/betterAuth/server/surrealDbAdapter/adapter.test.d.ts +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/adapter.test.js +84 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/getDB.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/getDB.js +26 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/index.d.ts +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/index.js +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/schema.d.ts +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/db/schema.js +97 -0
- package/dist/betterAuth/server/surrealDbAdapter/index.d.ts +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/index.js +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/count.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/count.js +17 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/create.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/create.js +21 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/delete.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/delete.js +18 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/deleteMany.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/deleteMany.js +19 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/findMany.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/findMany.js +51 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/findOne.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/findOne.js +42 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/index.d.ts +8 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/index.js +8 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/types.d.ts +56 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/update.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/update.js +25 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/updateMany.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/methods/updateMany.js +21 -0
- package/dist/betterAuth/server/surrealDbAdapter/types.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/applyJoinMappings.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/applyJoinMappings.js +31 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildExpression.d.ts +3 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildExpression.js +58 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildJoinPlan.d.ts +9 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildJoinPlan.js +46 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildSelectFields.d.ts +1 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/buildSelectFields.js +5 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/index.d.ts +6 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/index.js +6 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeOutputRecordIds.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeOutputRecordIds.js +43 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeRecordIds.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeRecordIds.js +38 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeWhereValue.d.ts +2 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/normalizeWhereValue.js +33 -0
- package/dist/betterAuth/server/surrealDbAdapter/utils/types.d.ts +34 -0
- package/dist/betterAuth/server/types.d.ts +8 -0
- package/dist/betterAuth/useSessionUser.d.ts +1 -0
- package/dist/betterAuth/useSessionUser.js +8 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/styles.css +3 -8
- package/dist/surrealDB/deafaultCrud.d.ts +2 -0
- package/dist/{surreal → surrealDB}/deafaultCrud.js +6 -5
- package/dist/surrealDB/getDBInstance.d.ts +3 -0
- package/dist/surrealDB/getDBInstance.js +34 -0
- package/dist/surrealDB/getDBInstanceTanstack.d.ts +3 -0
- package/dist/{surreal/connection.js → surrealDB/getDBInstanceTanstack.js} +2 -2
- package/dist/surrealDB/index.d.ts +6 -0
- package/dist/surrealDB/index.js +6 -0
- package/dist/{surreal/connection.d.ts → surrealDB/types.d.ts} +3 -3
- package/dist/surrealDB/types.js +0 -0
- package/dist/tanstack/cookie/index.d.ts +3 -0
- package/dist/tanstack/cookie/index.js +4 -0
- package/dist/{functions → tanstack/cookie}/setCookie.d.ts +1 -1
- package/dist/tanstack/index.d.ts +3 -0
- package/dist/tanstack/index.js +3 -0
- package/dist/tanstack/middlewares/index.d.ts +6 -0
- package/dist/tanstack/middlewares/index.js +5 -0
- package/dist/tanstack/middlewares/locale.d.ts +4 -0
- package/dist/{app/defaultRequestMiddlewares.js → tanstack/middlewares/locale.js} +2 -5
- package/dist/tanstack/s3/getS3Client.d.ts +2 -0
- package/dist/tanstack/s3/getS3Client.js +18 -0
- package/dist/tanstack/s3/getSignedFileUrlFn.d.ts +4 -0
- package/dist/tanstack/s3/getSignedFileUrlFn.js +21 -0
- package/dist/tanstack/s3/index.d.ts +2 -0
- package/dist/tanstack/s3/index.js +2 -0
- package/dist/tanstack/s3/uploadRequest.d.ts +3 -0
- package/dist/tanstack/s3/uploadRequest.js +21 -0
- package/dist/ui/AnimatedChevron.d.ts +3 -4
- package/dist/ui/AnimatedChevron.js +6 -25
- package/dist/ui/JsonInput.d.ts +1 -1
- package/dist/ui/JsonInput.js +1 -1
- package/dist/ui/editor/Content.d.ts +2 -2
- package/dist/ui/editor/Content.js +2 -2
- package/dist/ui/editor/Root.d.ts +7 -1
- package/dist/ui/editor/Root.js +42 -5
- package/dist/ui/editor/Toolbar.d.ts +3 -2
- package/dist/ui/editor/Toolbar.js +7 -25
- package/dist/ui/editor/index.d.ts +5 -9
- package/dist/ui/editor/index.js +3 -4
- package/dist/ui/editor/store.d.ts +6 -0
- package/dist/ui/editor/store.js +10 -0
- package/dist/ui/error/DefaultError.d.ts +1 -1
- package/dist/ui/error/DefaultNotFound.d.ts +1 -1
- package/dist/ui/error/Forbidden.d.ts +1 -1
- package/dist/ui/form/buttons/CancelButton.d.ts +2 -2
- package/dist/ui/form/buttons/CancelButton.js +4 -26
- package/dist/ui/form/buttons/SubmitButton.d.ts +2 -2
- package/dist/ui/form/buttons/SubmitButton.js +4 -29
- package/dist/ui/form/buttons/SubscribeActionIcon.d.ts +2 -2
- package/dist/ui/form/buttons/SubscribeButton.d.ts +2 -2
- package/dist/ui/form/context.d.ts +55 -55
- package/dist/ui/form/context.js +3 -3
- package/dist/ui/form/fields/JsonField.d.ts +1 -1
- package/dist/ui/form/fields/MultiSelectField.d.ts +1 -1
- package/dist/ui/form/fields/NumberField.d.ts +1 -1
- package/dist/ui/form/fields/PasswordField.d.ts +2 -0
- package/dist/ui/form/fields/{PassowrdField.js → PasswordField.js} +2 -2
- package/dist/ui/form/fields/SelectField.d.ts +1 -1
- package/dist/ui/form/fields/SwitchField.d.ts +1 -1
- package/dist/ui/form/fields/TextField.d.ts +1 -1
- package/dist/ui/form/fields/TextPasswordField.d.ts +2 -0
- package/dist/ui/form/fields/TextPasswordField.js +29 -0
- package/dist/ui/form/fields/TextareaField.d.ts +1 -1
- package/dist/ui/form/fields/index.d.ts +2 -2
- package/dist/ui/form/fields/index.js +2 -2
- package/dist/ui/form/index.d.ts +0 -1
- package/dist/ui/form/index.js +1 -2
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/saveInput/JsonInput.d.ts +2 -2
- package/dist/ui/saveInput/NumberInput.d.ts +2 -2
- package/dist/ui/saveInput/SaveInput.d.ts +14 -14
- package/dist/ui/saveInput/Select.d.ts +2 -2
- package/dist/ui/saveInput/Switch.d.ts +2 -2
- package/dist/ui/saveInput/TextInput.d.ts +2 -2
- package/dist/ui/saveInput/Textarea.d.ts +2 -2
- package/dist/ui/scrollArea/Root.d.ts +7 -0
- package/dist/ui/scrollArea/Root.js +42 -0
- package/dist/ui/scrollArea/ScrollButton.d.ts +7 -0
- package/dist/ui/scrollArea/ScrollButton.js +30 -0
- package/dist/ui/scrollArea/index.d.ts +6 -3
- package/dist/ui/scrollArea/index.js +7 -3
- package/dist/ui/scrollArea/methods.d.ts +4 -0
- package/dist/ui/scrollArea/methods.js +32 -0
- package/dist/ui/scrollArea/store.d.ts +12 -0
- package/dist/ui/scrollArea/store.js +25 -0
- package/dist/{ui/form/fieldsSchema.d.ts → zodSchemas.d.ts} +1 -1
- package/dist/{ui/form/fieldsSchema.js → zodSchemas.js} +2 -2
- package/package.json +103 -71
- package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
- package/dist/ai/ui/conversation/ConversationContext.js +0 -8
- package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
- package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
- package/dist/ai/ui/conversation/Empty.d.ts +0 -1
- package/dist/ai/ui/conversation/Empty.js +0 -21
- package/dist/ai/ui/conversation/File.d.ts +0 -4
- package/dist/ai/ui/conversation/FileIcon.js +0 -225
- package/dist/ai/ui/conversation/Loader.d.ts +0 -2
- package/dist/ai/ui/conversation/Loader.js +0 -12
- package/dist/ai/ui/conversation/Message.d.ts +0 -4
- package/dist/ai/ui/conversation/Message.js +0 -25
- package/dist/ai/ui/conversation/Root.d.ts +0 -2
- package/dist/ai/ui/conversation/Root.js +0 -26
- package/dist/ai/ui/conversation/index.d.ts +0 -13
- package/dist/ai/ui/conversation/index.js +0 -14
- package/dist/ai/ui/conversation/types.d.ts +0 -7
- package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
- package/dist/ai/ui/conversation/useChatMessage.js +0 -12
- package/dist/ai/ui/promptInput/File.js +0 -117
- package/dist/ai/ui/promptInput/FileIcon.js +0 -225
- package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
- package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
- package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
- package/dist/ai/ui/promptInput/Root.d.ts +0 -3
- package/dist/ai/ui/promptInput/Root.js +0 -17
- package/dist/ai/ui/promptInput/Submit.js +0 -40
- package/dist/ai/ui/promptInput/types.d.ts +0 -11
- package/dist/app/defaultRequestMiddlewares.d.ts +0 -4
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -26
- package/dist/surreal/deafaultCrud.d.ts +0 -2
- package/dist/ui/editor/Provider.d.ts +0 -17
- package/dist/ui/editor/Provider.js +0 -80
- package/dist/ui/editor/types.d.ts +0 -7
- package/dist/ui/form/fields/PassowrdField.d.ts +0 -2
- package/dist/ui/form/fields/TextPassowrdField.d.ts +0 -2
- package/dist/ui/form/fields/TextPassowrdField.js +0 -51
- package/dist/ui/scrollArea/ScrollArea.d.ts +0 -62
- package/dist/ui/scrollArea/ScrollArea.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaButton.d.ts +0 -5
- package/dist/ui/scrollArea/ScrollAreaButton.js +0 -51
- package/dist/ui/scrollArea/ScrollAreaContent.d.ts +0 -6
- package/dist/ui/scrollArea/ScrollAreaContent.js +0 -29
- package/dist/ui/scrollArea/context.d.ts +0 -28
- package/dist/ui/scrollArea/context.js +0 -10
- package/dist/ui/scrollArea/types.d.ts +0 -65
- package/dist/ui/scrollArea/useScrollArea.d.ts +0 -9
- package/dist/ui/scrollArea/useScrollArea.js +0 -146
- /package/dist/ai/ui/{promptInput → chat/chatInput}/File.d.ts +0 -0
- /package/dist/ai/ui/{conversation → chat/chatInput}/FileIcon.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.js +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Submit.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/parts}/FileIcon.d.ts +0 -0
- /package/dist/{ai/ui/conversation → betterAuth/server/surrealDbAdapter/methods}/types.js +0 -0
- /package/dist/{ai/ui/promptInput → betterAuth/server/surrealDbAdapter}/types.js +0 -0
- /package/dist/{ui/editor → betterAuth/server/surrealDbAdapter/utils}/types.js +0 -0
- /package/dist/{ui/scrollArea → betterAuth/server}/types.js +0 -0
- /package/dist/{surreal → surrealDB}/deserialize.d.ts +0 -0
- /package/dist/{surreal → surrealDB}/deserialize.js +0 -0
- /package/dist/{surreal → surrealDB}/encryption.d.ts +0 -0
- /package/dist/{surreal → surrealDB}/encryption.js +0 -0
- /package/dist/{functions → tanstack/cookie}/getCookie.d.ts +0 -0
- /package/dist/{functions → tanstack/cookie}/getCookie.js +0 -0
- /package/dist/{functions → tanstack/cookie}/setCookie.js +0 -0
- /package/dist/{functions → tanstack/cookie}/setCookies.d.ts +0 -0
- /package/dist/{functions → tanstack/cookie}/setCookies.js +0 -0
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,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,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,51 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ActionIcon, TextInput } from "@mantine/core";
|
|
3
|
-
import omgopass from "omgopass";
|
|
4
|
-
import { useFieldContext } from "../context.js";
|
|
5
|
-
const TextPassowrdField = (props)=>{
|
|
6
|
-
const field = useFieldContext();
|
|
7
|
-
return /*#__PURE__*/ jsx(TextInput, {
|
|
8
|
-
label: "Пароль",
|
|
9
|
-
placeholder: "Введите пароль",
|
|
10
|
-
rightSection: /*#__PURE__*/ jsx(ActionIcon, {
|
|
11
|
-
variant: "light",
|
|
12
|
-
onClick: ()=>field.setValue(omgopass({
|
|
13
|
-
minSyllableLength: 2,
|
|
14
|
-
maxSyllableLength: 2
|
|
15
|
-
})),
|
|
16
|
-
children: /*#__PURE__*/ jsxs("svg", {
|
|
17
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
-
width: "16",
|
|
19
|
-
height: "16",
|
|
20
|
-
viewBox: "0 0 16 16",
|
|
21
|
-
fill: "none",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
strokeWidth: "2",
|
|
24
|
-
strokeLinecap: "round",
|
|
25
|
-
strokeLinejoin: "round",
|
|
26
|
-
role: "img",
|
|
27
|
-
"aria-label": "Refresh",
|
|
28
|
-
children: [
|
|
29
|
-
/*#__PURE__*/ jsx("path", {
|
|
30
|
-
stroke: "none",
|
|
31
|
-
d: "M0 0h24v24H0z",
|
|
32
|
-
fill: "none"
|
|
33
|
-
}),
|
|
34
|
-
/*#__PURE__*/ jsx("path", {
|
|
35
|
-
d: "M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ jsx("path", {
|
|
38
|
-
d: "M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"
|
|
39
|
-
})
|
|
40
|
-
]
|
|
41
|
-
})
|
|
42
|
-
}),
|
|
43
|
-
name: field.name,
|
|
44
|
-
value: field.state.value || '',
|
|
45
|
-
onChange: (e)=>field.handleChange(e.target.value),
|
|
46
|
-
onBlur: field.handleBlur,
|
|
47
|
-
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
48
|
-
...props
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
export { TextPassowrdField };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ScrollAreaContextValue, ScrollAreaProps } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* ScrollArea Component - Расширенная область прокрутки с автоскроллом
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* // Базовое использование
|
|
7
|
-
* <ScrollArea h={300}>
|
|
8
|
-
* <div>Контент для прокрутки</div>
|
|
9
|
-
* </ScrollArea>
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // С автоскроллом и кнопкой
|
|
13
|
-
* <ScrollArea autoScroll scrollToBottomOnInit h={400}>
|
|
14
|
-
* <div>Чат сообщения...</div>
|
|
15
|
-
* <ScrollArea.ScrollButton className="absolute bottom-4 right-4" />
|
|
16
|
-
* </ScrollArea>
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // С кастомными настройками
|
|
20
|
-
* <ScrollArea
|
|
21
|
-
* autoScroll={true}
|
|
22
|
-
* animated={true}
|
|
23
|
-
* nearThreshold={50}
|
|
24
|
-
* h={300}
|
|
25
|
-
* scrollbarSize={6}
|
|
26
|
-
* type="hover"
|
|
27
|
-
* >
|
|
28
|
-
* {messages.map(msg => <div key={msg.id}>{msg.text}</div>)}
|
|
29
|
-
* <ScrollArea.ScrollButton
|
|
30
|
-
* className="absolute bottom-4 right-4"
|
|
31
|
-
* upIcon={<CustomUpIcon />}
|
|
32
|
-
* downIcon={<CustomDownIcon />}
|
|
33
|
-
* />
|
|
34
|
-
* </ScrollArea>
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // Использование хука для доступа к viewport
|
|
38
|
-
* function CustomControl() {
|
|
39
|
-
* const { isAtBottom, scrollToBottom, viewportRef } = useScrollArea();
|
|
40
|
-
*
|
|
41
|
-
* const scrollToElement = () => {
|
|
42
|
-
* const target = viewportRef.current?.querySelector('[data-target]');
|
|
43
|
-
* target?.scrollIntoView();
|
|
44
|
-
* };
|
|
45
|
-
*
|
|
46
|
-
* return (
|
|
47
|
-
* <button onClick={scrollToBottom} disabled={isAtBottom}>
|
|
48
|
-
* Прокрутить вниз
|
|
49
|
-
* </button>
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
*/
|
|
53
|
-
export declare const ScrollArea: {
|
|
54
|
-
({ children, autoScroll, scrollToBottomOnInit, animated, nearThreshold, radius, ...mantineProps }: ScrollAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
displayName: string;
|
|
56
|
-
} & {
|
|
57
|
-
ScrollButton: {
|
|
58
|
-
({ className }: import("./types").ScrollButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
-
displayName: string;
|
|
60
|
-
};
|
|
61
|
-
Provider: import("react").Provider<ScrollAreaContextValue | null>;
|
|
62
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ScrollAreaProvider } from "./context.js";
|
|
3
|
-
import { ScrollAreaButton } from "./ScrollAreaButton.js";
|
|
4
|
-
import { ScrollAreaContent } from "./ScrollAreaContent.js";
|
|
5
|
-
import { useScrollAreaState } from "./useScrollArea.js";
|
|
6
|
-
const ScrollAreaRoot = ({ children, autoScroll = false, scrollToBottomOnInit = false, animated = true, nearThreshold = 100, radius, ...mantineProps })=>{
|
|
7
|
-
const scrollAreaValue = useScrollAreaState({
|
|
8
|
-
autoScroll,
|
|
9
|
-
scrollToBottomOnInit,
|
|
10
|
-
animated,
|
|
11
|
-
nearThreshold
|
|
12
|
-
});
|
|
13
|
-
const contextValue = {
|
|
14
|
-
...scrollAreaValue,
|
|
15
|
-
radius,
|
|
16
|
-
mantineProps
|
|
17
|
-
};
|
|
18
|
-
return /*#__PURE__*/ jsx(ScrollAreaProvider, {
|
|
19
|
-
value: contextValue,
|
|
20
|
-
children: /*#__PURE__*/ jsx(ScrollAreaContent, {
|
|
21
|
-
children: children
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
ScrollAreaRoot.displayName = 'ScrollArea';
|
|
26
|
-
const ScrollArea = Object.assign(ScrollAreaRoot, {
|
|
27
|
-
ScrollButton: ScrollAreaButton,
|
|
28
|
-
Provider: ScrollAreaProvider
|
|
29
|
-
});
|
|
30
|
-
export { ScrollArea };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ActionIcon } from "@mantine/core";
|
|
3
|
-
import { useScrollArea } from "./context.js";
|
|
4
|
-
const ScrollAreaButton = ({ className })=>{
|
|
5
|
-
const { hasScrollableContent, isAboveCenter, scrollToTop, scrollToBottom } = useScrollArea();
|
|
6
|
-
if (!hasScrollableContent) return null;
|
|
7
|
-
const isScrollingDown = isAboveCenter;
|
|
8
|
-
const icon = /*#__PURE__*/ jsxs("svg", {
|
|
9
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
-
width: "24",
|
|
11
|
-
height: "24",
|
|
12
|
-
viewBox: "0 0 24 24",
|
|
13
|
-
fill: "none",
|
|
14
|
-
stroke: "currentColor",
|
|
15
|
-
strokeWidth: "1.5",
|
|
16
|
-
strokeLinecap: "round",
|
|
17
|
-
strokeLinejoin: "round",
|
|
18
|
-
role: "img",
|
|
19
|
-
"aria-label": "Chevron",
|
|
20
|
-
style: {
|
|
21
|
-
transition: 'transform 0.2s ease-in-out',
|
|
22
|
-
transform: isScrollingDown ? 'rotate(-180deg)' : 'rotate(0deg)'
|
|
23
|
-
},
|
|
24
|
-
children: [
|
|
25
|
-
/*#__PURE__*/ jsx("path", {
|
|
26
|
-
stroke: "none",
|
|
27
|
-
d: "M0 0h24v24H0z",
|
|
28
|
-
fill: "none"
|
|
29
|
-
}),
|
|
30
|
-
/*#__PURE__*/ jsx("path", {
|
|
31
|
-
d: "M6 9l6 6l6 -6"
|
|
32
|
-
})
|
|
33
|
-
]
|
|
34
|
-
});
|
|
35
|
-
const handleClick = ()=>{
|
|
36
|
-
if (isScrollingDown) scrollToBottom();
|
|
37
|
-
else scrollToTop();
|
|
38
|
-
};
|
|
39
|
-
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
40
|
-
pos: "absolute",
|
|
41
|
-
bottom: 16,
|
|
42
|
-
right: 16,
|
|
43
|
-
variant: "light",
|
|
44
|
-
onClick: handleClick,
|
|
45
|
-
className: className,
|
|
46
|
-
"aria-label": isScrollingDown ? 'Scroll to bottom' : 'Scroll to top',
|
|
47
|
-
children: icon
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
ScrollAreaButton.displayName = 'ScrollArea.ScrollButton';
|
|
51
|
-
export { ScrollAreaButton };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, ScrollArea, getRadius } from "@mantine/core";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import { ScrollAreaContext } from "./context.js";
|
|
5
|
-
const ScrollAreaContent = ({ children })=>{
|
|
6
|
-
const fullContext = useContext(ScrollAreaContext);
|
|
7
|
-
if (!fullContext) throw new Error('ScrollAreaContent must be used within ScrollArea');
|
|
8
|
-
const { _callbackRef, mantineProps, radius, _contentResizeRef } = fullContext;
|
|
9
|
-
return /*#__PURE__*/ jsx(ScrollArea, {
|
|
10
|
-
classNames: {
|
|
11
|
-
viewport: 'rolder-scroll-area-viewport',
|
|
12
|
-
content: 'rolder-scroll-area-content',
|
|
13
|
-
scrollbar: 'rolder-scroll-area-scrollbar'
|
|
14
|
-
},
|
|
15
|
-
style: {
|
|
16
|
-
'--radius': radius ? getRadius(radius) : void 0
|
|
17
|
-
},
|
|
18
|
-
...mantineProps,
|
|
19
|
-
viewportRef: _callbackRef,
|
|
20
|
-
children: /*#__PURE__*/ jsx(Box, {
|
|
21
|
-
h: "100%",
|
|
22
|
-
w: "100%",
|
|
23
|
-
ref: _contentResizeRef,
|
|
24
|
-
children: children
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
ScrollAreaContent.displayName = 'ScrollArea.Content';
|
|
29
|
-
export { ScrollAreaContent };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ScrollAreaContextValue, ScrollAreaHook } from './types';
|
|
2
|
-
/** Внутренний контекст для передачи состояния ScrollArea */
|
|
3
|
-
export declare const ScrollAreaContext: import("react").Context<ScrollAreaContextValue | null>;
|
|
4
|
-
export declare const ScrollAreaProvider: import("react").Provider<ScrollAreaContextValue | null>;
|
|
5
|
-
/**
|
|
6
|
-
* Хук для доступа к состоянию и методам ScrollArea
|
|
7
|
-
*
|
|
8
|
-
* @returns Объект с индикаторами позиции, методами управления и ref на viewport
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* function MyComponent() {
|
|
13
|
-
* const { isAtBottom, scrollToTop, viewportRef } = useScrollArea();
|
|
14
|
-
*
|
|
15
|
-
* const scrollToElement = () => {
|
|
16
|
-
* const target = viewportRef.current?.querySelector('[data-target]');
|
|
17
|
-
* target?.scrollIntoView();
|
|
18
|
-
* };
|
|
19
|
-
*
|
|
20
|
-
* return (
|
|
21
|
-
* <button onClick={scrollToTop} disabled={isAtTop}>
|
|
22
|
-
* В начало
|
|
23
|
-
* </button>
|
|
24
|
-
* );
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const useScrollArea: () => ScrollAreaHook;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
const ScrollAreaContext = /*#__PURE__*/ createContext(null);
|
|
3
|
-
const ScrollAreaProvider = ScrollAreaContext.Provider;
|
|
4
|
-
const useScrollArea = ()=>{
|
|
5
|
-
const context = useContext(ScrollAreaContext);
|
|
6
|
-
if (!context) throw new Error('useScrollArea must be used within ScrollArea');
|
|
7
|
-
const { _callbackRef, mantineProps: _, radius: __, ...publicAPI } = context;
|
|
8
|
-
return publicAPI;
|
|
9
|
-
};
|
|
10
|
-
export { ScrollAreaContext, ScrollAreaProvider, useScrollArea };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { MantineRadius, ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
export interface ScrollAreaProps extends Omit<MantineScrollAreaProps, 'children'> {
|
|
4
|
-
/** Включение автоскролла при добавлении контента (по умолчанию false) */
|
|
5
|
-
autoScroll?: boolean;
|
|
6
|
-
/** Прокрутить к концу при инициализации компонента (по умолчанию false) */
|
|
7
|
-
scrollToBottomOnInit?: boolean;
|
|
8
|
-
/** Анимированная прокрутка (по умолчанию true) */
|
|
9
|
-
animated?: boolean;
|
|
10
|
-
/** Отступ для near-зон в пикселях (по умолчанию 100) */
|
|
11
|
-
nearThreshold?: number;
|
|
12
|
-
/** Радиус для viewport и scrollbar на тот случай, когда они "торчат" углами*/
|
|
13
|
-
radius?: MantineRadius;
|
|
14
|
-
/** Дочерние элементы - автоматически оборачиваются в ScrollArea.Content */
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
export interface ScrollAreaHook {
|
|
18
|
-
/** Точно в начале (scrollTop === 0) */
|
|
19
|
-
isAtTop: boolean;
|
|
20
|
-
/** В пределах nearThreshold от начала */
|
|
21
|
-
isNearTop: boolean;
|
|
22
|
-
/** Точно в конце (scrollTop + clientHeight >= scrollHeight) */
|
|
23
|
-
isAtBottom: boolean;
|
|
24
|
-
/** В пределах nearThreshold от конца */
|
|
25
|
-
isNearBottom: boolean;
|
|
26
|
-
/** Выше центральной точки области прокрутки */
|
|
27
|
-
isAboveCenter: boolean;
|
|
28
|
-
/** Есть контент требующий прокрутки */
|
|
29
|
-
hasScrollableContent: boolean;
|
|
30
|
-
/** Прокрутить к началу области */
|
|
31
|
-
scrollToTop: (animated?: boolean) => void;
|
|
32
|
-
/** Прокрутить к концу области */
|
|
33
|
-
scrollToBottom: (animated?: boolean) => void;
|
|
34
|
-
/** React ref на viewport элемент для прямого доступа к DOM */
|
|
35
|
-
viewportRef: React.RefObject<HTMLDivElement | null>;
|
|
36
|
-
}
|
|
37
|
-
export interface ScrollAreaState extends ScrollAreaHook {
|
|
38
|
-
/** Внутренний callback ref для подключения к Mantine ScrollArea */
|
|
39
|
-
_callbackRef: (node: HTMLDivElement | null) => void;
|
|
40
|
-
/** Внутренний ref для наблюдения за изменениями контента */
|
|
41
|
-
_contentResizeRef: (node: HTMLDivElement | null) => void;
|
|
42
|
-
}
|
|
43
|
-
export interface ScrollAreaContextValue extends ScrollAreaState {
|
|
44
|
-
/** Радиус для viewport и scrollbar на тот случай, когда они "торчат" углами*/
|
|
45
|
-
radius?: MantineRadius;
|
|
46
|
-
/** Пропсы Mantine ScrollArea, переданные в корневой компонент */
|
|
47
|
-
mantineProps: Omit<MantineScrollAreaProps, 'children'>;
|
|
48
|
-
}
|
|
49
|
-
export interface ScrollButtonProps {
|
|
50
|
-
/** CSS классы для стилизации кнопки */
|
|
51
|
-
className?: string;
|
|
52
|
-
/** Иконка для прокрутки вверх (по умолчанию IconChevronUp) */
|
|
53
|
-
upIcon?: ReactNode;
|
|
54
|
-
/** Иконка для прокрутки вниз (по умолчанию IconChevronDown) */
|
|
55
|
-
downIcon?: ReactNode;
|
|
56
|
-
}
|
|
57
|
-
/** Внутренний тип для отслеживания позиции скролла */
|
|
58
|
-
export interface ScrollPosition {
|
|
59
|
-
/** Текущая позиция скролла сверху */
|
|
60
|
-
scrollTop: number;
|
|
61
|
-
/** Высота видимой области */
|
|
62
|
-
clientHeight: number;
|
|
63
|
-
/** Общая высота прокручиваемого контента */
|
|
64
|
-
scrollHeight: number;
|
|
65
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ScrollAreaState } from './types';
|
|
2
|
-
interface UseScrollAreaOptions {
|
|
3
|
-
autoScroll?: boolean;
|
|
4
|
-
scrollToBottomOnInit?: boolean;
|
|
5
|
-
animated?: boolean;
|
|
6
|
-
nearThreshold?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const useScrollAreaState: (options?: UseScrollAreaOptions) => ScrollAreaState;
|
|
9
|
-
export {};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { useDebouncedCallback, useMergedRef, useResizeObserver } from "@mantine/hooks";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
const useScrollAreaState = (options = {})=>{
|
|
4
|
-
const { autoScroll = false, scrollToBottomOnInit = false, animated = true, nearThreshold = 32 } = options;
|
|
5
|
-
const scrollAreaRef = useRef(null);
|
|
6
|
-
const isUserInteractingRef = useRef(false);
|
|
7
|
-
const userInteractionTimeoutRef = useRef(void 0);
|
|
8
|
-
const isInitializedRef = useRef(false);
|
|
9
|
-
const [contentResizeRef, contentRect] = useResizeObserver();
|
|
10
|
-
const [scrollPosition, setScrollPosition] = useState({
|
|
11
|
-
scrollTop: 0,
|
|
12
|
-
clientHeight: 0,
|
|
13
|
-
scrollHeight: 0
|
|
14
|
-
});
|
|
15
|
-
const isAtTop = 0 === scrollPosition.scrollTop;
|
|
16
|
-
const isAtBottom = scrollPosition.scrollTop + scrollPosition.clientHeight >= scrollPosition.scrollHeight;
|
|
17
|
-
const isNearTop = scrollPosition.scrollTop <= nearThreshold;
|
|
18
|
-
const isNearBottom = scrollPosition.scrollTop + scrollPosition.clientHeight >= scrollPosition.scrollHeight - nearThreshold;
|
|
19
|
-
const isAboveCenter = scrollPosition.scrollTop < (scrollPosition.scrollHeight - scrollPosition.clientHeight) / 2;
|
|
20
|
-
const hasScrollableContent = scrollPosition.scrollHeight > scrollPosition.clientHeight;
|
|
21
|
-
const debouncedUpdatePosition = useDebouncedCallback((element)=>{
|
|
22
|
-
const newPosition = {
|
|
23
|
-
scrollTop: element.scrollTop,
|
|
24
|
-
clientHeight: element.clientHeight,
|
|
25
|
-
scrollHeight: element.scrollHeight
|
|
26
|
-
};
|
|
27
|
-
setScrollPosition(newPosition);
|
|
28
|
-
}, {
|
|
29
|
-
delay: 16
|
|
30
|
-
});
|
|
31
|
-
const scrollToTop = useCallback((isAnimated)=>{
|
|
32
|
-
const element = scrollAreaRef.current;
|
|
33
|
-
if (!element) return;
|
|
34
|
-
const shouldAnimate = isAnimated ?? animated;
|
|
35
|
-
if (shouldAnimate) element.scrollTo({
|
|
36
|
-
top: 0,
|
|
37
|
-
behavior: 'smooth'
|
|
38
|
-
});
|
|
39
|
-
else element.scrollTop = 0;
|
|
40
|
-
}, [
|
|
41
|
-
animated
|
|
42
|
-
]);
|
|
43
|
-
const scrollToBottom = useCallback((isAnimated)=>{
|
|
44
|
-
const element = scrollAreaRef.current;
|
|
45
|
-
if (!element) return;
|
|
46
|
-
const shouldAnimate = isAnimated ?? animated;
|
|
47
|
-
if (shouldAnimate) element.scrollTo({
|
|
48
|
-
top: element.scrollHeight,
|
|
49
|
-
behavior: 'smooth'
|
|
50
|
-
});
|
|
51
|
-
else element.scrollTop = element.scrollHeight;
|
|
52
|
-
const scrollHeightBefore = element.scrollHeight;
|
|
53
|
-
setTimeout(()=>{
|
|
54
|
-
const scrollHeightAfter = element.scrollHeight;
|
|
55
|
-
const diff = element.scrollHeight - (element.scrollTop + element.clientHeight);
|
|
56
|
-
if (diff > 1 && scrollHeightAfter !== scrollHeightBefore) element.scrollTop = element.scrollHeight;
|
|
57
|
-
}, 50);
|
|
58
|
-
}, [
|
|
59
|
-
animated
|
|
60
|
-
]);
|
|
61
|
-
const performAutoScroll = useCallback(()=>{
|
|
62
|
-
if (!autoScroll || isUserInteractingRef.current || !scrollAreaRef.current) return;
|
|
63
|
-
if (isAtBottom) scrollToBottom(false);
|
|
64
|
-
}, [
|
|
65
|
-
autoScroll,
|
|
66
|
-
isAtBottom,
|
|
67
|
-
scrollToBottom
|
|
68
|
-
]);
|
|
69
|
-
const handleUserInteraction = useCallback(()=>{
|
|
70
|
-
isUserInteractingRef.current = true;
|
|
71
|
-
if (userInteractionTimeoutRef.current) clearTimeout(userInteractionTimeoutRef.current);
|
|
72
|
-
userInteractionTimeoutRef.current = setTimeout(()=>{
|
|
73
|
-
isUserInteractingRef.current = false;
|
|
74
|
-
}, 150);
|
|
75
|
-
}, []);
|
|
76
|
-
const handleScroll = useCallback((event)=>{
|
|
77
|
-
const element = event.target;
|
|
78
|
-
debouncedUpdatePosition(element);
|
|
79
|
-
}, [
|
|
80
|
-
debouncedUpdatePosition
|
|
81
|
-
]);
|
|
82
|
-
useEffect(()=>{
|
|
83
|
-
if (!scrollToBottomOnInit || isInitializedRef.current) return;
|
|
84
|
-
if (hasScrollableContent) {
|
|
85
|
-
scrollToBottom(animated);
|
|
86
|
-
isInitializedRef.current = true;
|
|
87
|
-
}
|
|
88
|
-
}, [
|
|
89
|
-
scrollToBottomOnInit,
|
|
90
|
-
hasScrollableContent,
|
|
91
|
-
scrollToBottom,
|
|
92
|
-
animated
|
|
93
|
-
]);
|
|
94
|
-
useEffect(()=>{
|
|
95
|
-
const element = scrollAreaRef.current;
|
|
96
|
-
if (!element || 0 === contentRect.height) return;
|
|
97
|
-
debouncedUpdatePosition(element);
|
|
98
|
-
const timeoutId = setTimeout(performAutoScroll, 10);
|
|
99
|
-
return ()=>clearTimeout(timeoutId);
|
|
100
|
-
}, [
|
|
101
|
-
contentRect.height,
|
|
102
|
-
debouncedUpdatePosition,
|
|
103
|
-
performAutoScroll
|
|
104
|
-
]);
|
|
105
|
-
useEffect(()=>{
|
|
106
|
-
const element = scrollAreaRef.current;
|
|
107
|
-
if (!element) return;
|
|
108
|
-
const events = [
|
|
109
|
-
'wheel',
|
|
110
|
-
'touchstart',
|
|
111
|
-
'touchmove',
|
|
112
|
-
'mousedown'
|
|
113
|
-
];
|
|
114
|
-
element.addEventListener('scroll', handleScroll);
|
|
115
|
-
events.forEach((event)=>{
|
|
116
|
-
element.addEventListener(event, handleUserInteraction);
|
|
117
|
-
});
|
|
118
|
-
debouncedUpdatePosition(element);
|
|
119
|
-
return ()=>{
|
|
120
|
-
element.removeEventListener('scroll', handleScroll);
|
|
121
|
-
events.forEach((event)=>{
|
|
122
|
-
element.removeEventListener(event, handleUserInteraction);
|
|
123
|
-
});
|
|
124
|
-
if (userInteractionTimeoutRef.current) clearTimeout(userInteractionTimeoutRef.current);
|
|
125
|
-
};
|
|
126
|
-
}, [
|
|
127
|
-
handleScroll,
|
|
128
|
-
handleUserInteraction,
|
|
129
|
-
debouncedUpdatePosition
|
|
130
|
-
]);
|
|
131
|
-
const callbackRef = useMergedRef(scrollAreaRef);
|
|
132
|
-
return {
|
|
133
|
-
isAtTop,
|
|
134
|
-
isNearTop,
|
|
135
|
-
isAtBottom,
|
|
136
|
-
isNearBottom,
|
|
137
|
-
isAboveCenter,
|
|
138
|
-
hasScrollableContent,
|
|
139
|
-
scrollToTop,
|
|
140
|
-
scrollToBottom,
|
|
141
|
-
viewportRef: scrollAreaRef,
|
|
142
|
-
_callbackRef: callbackRef,
|
|
143
|
-
_contentResizeRef: contentResizeRef
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
export { useScrollAreaState };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|