@weavy/uikit-react 13.0.0 → 14.0.1
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/changelog.md +30 -0
- package/dist/cjs/{types/client → client}/WeavyClient.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Attachment.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Avatar.d.ts +0 -0
- package/dist/{esm/types → cjs}/components/Chat.d.ts +1 -1
- package/dist/cjs/{types/components → components}/Conversation.d.ts +0 -0
- package/dist/cjs/{types/components → components}/ConversationBadge.d.ts +0 -0
- package/dist/cjs/{types/components → components}/ConversationForm.d.ts +0 -0
- package/dist/cjs/{types/components → components}/ConversationList.d.ts +0 -0
- package/dist/cjs/{types/components → components}/ConversationListItem.d.ts +0 -0
- package/dist/cjs/{types/components → components}/File.d.ts +0 -0
- package/dist/cjs/{types/components → components}/FileBrowser.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Image.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Meeting.d.ts +0 -0
- package/dist/cjs/{types/components → components}/MeetingCard.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Meetings.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Message.d.ts +0 -0
- package/dist/{esm/types → cjs}/components/Messages.d.ts +3 -1
- package/dist/cjs/{types/components → components}/Messenger.d.ts +0 -0
- package/dist/cjs/{types/components → components}/NewConversation.d.ts +0 -0
- package/dist/cjs/{types/components → components}/PdfViewer.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Presence.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Preview.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Reactions.d.ts +0 -0
- package/dist/cjs/{types/components → components}/SearchUsers.d.ts +0 -0
- package/dist/cjs/{types/components → components}/SeenBy.d.ts +0 -0
- package/dist/cjs/{types/components → components}/Typing.d.ts +0 -0
- package/dist/cjs/{types/contexts → contexts}/MessengerContext.d.ts +0 -0
- package/dist/cjs/{types/contexts → contexts}/PreviewContext.d.ts +0 -0
- package/dist/cjs/{types/contexts → contexts}/UserContext.d.ts +0 -0
- package/dist/cjs/{types/contexts → contexts}/WeavyContext.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useBadge.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useChat.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useConversation.d.ts +0 -0
- package/dist/cjs/hooks/useConversations.d.ts +1 -0
- package/dist/cjs/{types/hooks → hooks}/useDebounce.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useEvents.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useFileUploader.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMembers.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMessages.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateChat.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateConversation.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateConversationName.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateDeleteReaction.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateExternalBlobs.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateMeeting.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateMembers.d.ts +0 -0
- package/dist/{esm/types → cjs}/hooks/useMutateMessage.d.ts +1 -1
- package/dist/cjs/{types/hooks → hooks}/useMutatePinned.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateReaction.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateRead.d.ts +1 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateRemoveMembers.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useMutateTyping.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/usePresence.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/usePreview.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useReactions.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useSearchUsers.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useThrottle.d.ts +0 -0
- package/dist/cjs/{types/hooks → hooks}/useUser.d.ts +0 -0
- package/dist/cjs/{types/index.d.ts → index.d.ts} +0 -0
- package/dist/cjs/index.js +6 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/{types/Chat.d.ts → Chat.d.ts} +1 -0
- package/dist/cjs/types/{types/Conversation.d.ts → Conversation.d.ts} +0 -0
- package/dist/cjs/types/{types/ConversationListItem.d.ts → ConversationListItem.d.ts} +0 -0
- package/dist/{esm/types → cjs}/types/Message.d.ts +2 -0
- package/dist/cjs/types/{types/Messenger.d.ts → Messenger.d.ts} +0 -0
- package/dist/cjs/types/{types/types.d.ts → types.d.ts} +47 -4
- package/dist/cjs/{types/ui → ui}/Button.d.ts +0 -0
- package/dist/cjs/{types/ui → ui}/Dropdown.d.ts +0 -0
- package/dist/cjs/{types/ui → ui}/Icon.d.ts +0 -0
- package/dist/cjs/{types/ui → ui}/Overlay.d.ts +0 -0
- package/dist/cjs/{types/ui → ui}/Spinner.d.ts +2 -1
- package/dist/cjs/{types/utils → utils}/fileUtilities.d.ts +0 -0
- package/dist/css/weavy-chat.css +1543 -959
- package/dist/css/weavy-messenger.css +1903 -1302
- package/dist/css/weavy.css +1703 -1102
- package/dist/esm/{types/client → client}/WeavyClient.d.ts +0 -0
- package/dist/esm/{types/components → components}/Attachment.d.ts +0 -0
- package/dist/esm/{types/components → components}/Avatar.d.ts +0 -0
- package/dist/{cjs/types → esm}/components/Chat.d.ts +1 -1
- package/dist/esm/{types/components → components}/Conversation.d.ts +0 -0
- package/dist/esm/{types/components → components}/ConversationBadge.d.ts +0 -0
- package/dist/esm/{types/components → components}/ConversationForm.d.ts +0 -0
- package/dist/esm/{types/components → components}/ConversationList.d.ts +0 -0
- package/dist/esm/{types/components → components}/ConversationListItem.d.ts +0 -0
- package/dist/esm/{types/components → components}/File.d.ts +0 -0
- package/dist/esm/{types/components → components}/FileBrowser.d.ts +0 -0
- package/dist/esm/{types/components → components}/Image.d.ts +0 -0
- package/dist/esm/{types/components → components}/Meeting.d.ts +0 -0
- package/dist/esm/{types/components → components}/MeetingCard.d.ts +0 -0
- package/dist/esm/{types/components → components}/Meetings.d.ts +0 -0
- package/dist/esm/{types/components → components}/Message.d.ts +0 -0
- package/dist/{cjs/types → esm}/components/Messages.d.ts +3 -1
- package/dist/esm/{types/components → components}/Messenger.d.ts +0 -0
- package/dist/esm/{types/components → components}/NewConversation.d.ts +0 -0
- package/dist/esm/{types/components → components}/PdfViewer.d.ts +0 -0
- package/dist/esm/{types/components → components}/Presence.d.ts +0 -0
- package/dist/esm/{types/components → components}/Preview.d.ts +0 -0
- package/dist/esm/{types/components → components}/Reactions.d.ts +0 -0
- package/dist/esm/{types/components → components}/SearchUsers.d.ts +0 -0
- package/dist/esm/{types/components → components}/SeenBy.d.ts +0 -0
- package/dist/esm/{types/components → components}/Typing.d.ts +0 -0
- package/dist/esm/{types/contexts → contexts}/MessengerContext.d.ts +0 -0
- package/dist/esm/{types/contexts → contexts}/PreviewContext.d.ts +0 -0
- package/dist/esm/{types/contexts → contexts}/UserContext.d.ts +0 -0
- package/dist/esm/{types/contexts → contexts}/WeavyContext.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useBadge.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useChat.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useConversation.d.ts +0 -0
- package/dist/esm/hooks/useConversations.d.ts +1 -0
- package/dist/esm/{types/hooks → hooks}/useDebounce.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useEvents.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useFileUploader.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMembers.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMessages.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateChat.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateConversation.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateConversationName.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateDeleteReaction.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateExternalBlobs.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateMeeting.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateMembers.d.ts +0 -0
- package/dist/{cjs/types → esm}/hooks/useMutateMessage.d.ts +1 -1
- package/dist/esm/{types/hooks → hooks}/useMutatePinned.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateReaction.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateRead.d.ts +1 -0
- package/dist/esm/{types/hooks → hooks}/useMutateRemoveMembers.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useMutateTyping.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/usePresence.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/usePreview.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useReactions.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useSearchUsers.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useThrottle.d.ts +0 -0
- package/dist/esm/{types/hooks → hooks}/useUser.d.ts +0 -0
- package/dist/esm/{types/index.d.ts → index.d.ts} +0 -0
- package/dist/esm/index.js +6 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/{types/Chat.d.ts → Chat.d.ts} +1 -0
- package/dist/esm/types/{types/Conversation.d.ts → Conversation.d.ts} +0 -0
- package/dist/esm/types/{types/ConversationListItem.d.ts → ConversationListItem.d.ts} +0 -0
- package/dist/{cjs/types → esm}/types/Message.d.ts +2 -0
- package/dist/esm/types/{types/Messenger.d.ts → Messenger.d.ts} +0 -0
- package/dist/esm/types/{types/types.d.ts → types.d.ts} +47 -4
- package/dist/esm/{types/ui → ui}/Button.d.ts +0 -0
- package/dist/esm/{types/ui → ui}/Dropdown.d.ts +0 -0
- package/dist/esm/{types/ui → ui}/Icon.d.ts +0 -0
- package/dist/esm/{types/ui → ui}/Overlay.d.ts +0 -0
- package/dist/esm/{types/ui → ui}/Spinner.d.ts +2 -1
- package/dist/esm/{types/utils → utils}/fileUtilities.d.ts +0 -0
- package/dist/index.d.ts +2 -1
- package/package.json +18 -15
- package/{rollup.config.js → rollup.config.mjs} +10 -3
- package/src/client/WeavyClient.ts +12 -17
- package/src/components/Attachment.tsx +5 -5
- package/src/components/Chat.tsx +6 -5
- package/src/components/Conversation.tsx +26 -20
- package/src/components/ConversationBadge.tsx +7 -5
- package/src/components/ConversationForm.tsx +1 -1
- package/src/components/ConversationList.tsx +59 -11
- package/src/components/ConversationListItem.tsx +94 -58
- package/src/components/FileBrowser.tsx +53 -50
- package/src/components/Image.tsx +2 -1
- package/src/components/MeetingCard.tsx +35 -13
- package/src/components/Meetings.tsx +1 -1
- package/src/components/Message.tsx +41 -42
- package/src/components/Messages.tsx +61 -60
- package/src/components/Messenger.tsx +7 -2
- package/src/components/NewConversation.tsx +1 -1
- package/src/components/PdfViewer.tsx +5 -5
- package/src/components/Preview.tsx +2 -2
- package/src/components/Reactions.tsx +11 -5
- package/src/components/SearchUsers.tsx +19 -9
- package/src/components/SeenBy.tsx +13 -7
- package/src/components/Typing.tsx +11 -12
- package/src/contexts/UserContext.tsx +1 -1
- package/src/contexts/WeavyContext.tsx +3 -3
- package/src/hooks/useConversations.ts +15 -5
- package/src/hooks/useMutateMessage.ts +1 -5
- package/src/hooks/useMutateRead.ts +5 -3
- package/src/hooks/usePresence.ts +2 -3
- package/src/hooks/useReactions.ts +11 -12
- package/src/scss/theme/_alert.scss +61 -63
- package/src/scss/theme/_appbar.scss +105 -30
- package/src/scss/theme/_avatar.scss +23 -28
- package/src/scss/theme/_badge.scss +26 -18
- package/src/scss/theme/_buttons.scss +107 -52
- package/src/scss/theme/_card.scss +102 -4
- package/src/scss/theme/_checkbox.scss +16 -20
- package/src/scss/theme/_code-vscode-dark.scss +3 -3
- package/src/scss/theme/_code-vscode-light.scss +3 -3
- package/src/scss/theme/_code.scss +0 -2
- package/src/scss/theme/_comment-editor-cm.scss +97 -0
- package/src/scss/theme/_comment-editor.scss +129 -0
- package/src/scss/theme/_comments.scss +66 -0
- package/src/scss/theme/_content.scss +33 -5
- package/src/scss/theme/_conversations.scss +19 -78
- package/src/scss/theme/_dropdown.scss +102 -15
- package/src/scss/theme/_embed.scss +135 -0
- package/src/scss/theme/_facepile.scss +11 -0
- package/src/scss/theme/_filebrowser.scss +1 -1
- package/src/scss/theme/_files.scss +76 -47
- package/src/scss/theme/_grid.scss +8 -0
- package/src/scss/theme/_icons.scss +155 -19
- package/src/scss/theme/_image-grid.scss +7 -12
- package/src/scss/theme/_input.scss +160 -0
- package/src/scss/theme/_item.scss +169 -0
- package/src/scss/theme/_list.scss +57 -0
- package/src/scss/theme/_meeting.scss +11 -0
- package/src/scss/theme/_message-editor-cm.scss +95 -0
- package/src/scss/theme/_message-editor.scss +65 -19
- package/src/scss/theme/_messages.scss +51 -105
- package/src/scss/theme/_meta.scss +12 -0
- package/src/scss/theme/_overlays.scss +31 -76
- package/src/scss/theme/_pager.scss +5 -1
- package/src/scss/theme/_pane.scss +13 -2
- package/src/scss/theme/_panels.scss +33 -28
- package/src/scss/theme/_picker-list.scss +5 -3
- package/src/scss/theme/_placeholder.scss +19 -0
- package/src/scss/theme/_poll.scss +49 -0
- package/src/scss/theme/_post-editor-cm.scss +100 -0
- package/src/scss/theme/_post-editor.scss +127 -0
- package/src/scss/theme/_post.scss +83 -0
- package/src/scss/theme/_preview-code.scss +11 -2
- package/src/scss/theme/_preview-embed.scss +8 -2
- package/src/scss/theme/_preview-image.scss +8 -26
- package/src/scss/theme/_preview-media.scss +1 -0
- package/src/scss/theme/_preview-pdf.scss +10 -15
- package/src/scss/theme/_preview.scss +57 -79
- package/src/scss/theme/_reactions.scss +48 -17
- package/src/scss/theme/_sheet.scss +59 -0
- package/src/scss/theme/_sidebar.scss +86 -0
- package/src/scss/theme/_spinner.scss +11 -7
- package/src/scss/theme/_tab.scss +72 -0
- package/src/scss/theme/_tables.scss +70 -23
- package/src/scss/theme/_toasts.scss +56 -26
- package/src/scss/theme/_type.scss +41 -0
- package/src/scss/theme/{mixins → base}/_backdrop.scss +0 -0
- package/src/scss/theme/{bootstrap/mixins → base}/_breakpoints.scss +9 -0
- package/src/scss/theme/base/_colors.scss +315 -0
- package/src/scss/theme/base/_md.scss +19 -0
- package/src/scss/theme/base/_palette.scss +130 -0
- package/src/scss/theme/{mixins → base}/_position.scss +5 -5
- package/src/scss/theme/base/_reboot.scss +51 -0
- package/src/scss/theme/base/_scroll.scss +180 -0
- package/src/scss/theme/base/_svg.scss +49 -0
- package/src/scss/theme/base/_text.scss +23 -0
- package/src/scss/theme/base/_vars.scss +203 -0
- package/src/scss/theme/{fonts → base/fonts}/_fontmapping-roboto.scss +0 -0
- package/src/scss/theme/{fonts → base/fonts}/_fontmapping-segoe-ui.scss +0 -0
- package/src/scss/theme/base/fonts/_index.scss +2 -0
- package/src/scss/weavy-chat.scss +10 -4
- package/src/scss/weavy-messenger.scss +37 -21
- package/src/types/Chat.ts +2 -1
- package/src/types/Message.ts +3 -1
- package/src/types/types.ts +56 -5
- package/src/ui/Icon.tsx +1 -1
- package/src/ui/Spinner.tsx +3 -2
- package/src/utils/infiniteScroll.js +12 -3
- package/src/utils/postal-parent.js +398 -0
- package/src/utils/promise.js +187 -0
- package/src/utils/scrollbarDetection.js +71 -9
- package/src/utils/utils.js +547 -0
- package/dist/cjs/types/hooks/useConversations.d.ts +0 -1
- package/dist/esm/types/hooks/useConversations.d.ts +0 -1
- package/src/scss/theme/_attachments.scss +0 -74
- package/src/scss/theme/_cm-editor.scss +0 -42
- package/src/scss/theme/_colors.scss +0 -520
- package/src/scss/theme/_config.scss +0 -6
- package/src/scss/theme/_inputs.scss +0 -28
- package/src/scss/theme/_nav.scss +0 -52
- package/src/scss/theme/_palette.scss +0 -165
- package/src/scss/theme/_preview-icon.scss +0 -41
- package/src/scss/theme/_reboot.scss +0 -41
- package/src/scss/theme/_root.scss +0 -2
- package/src/scss/theme/_scroll.scss +0 -55
- package/src/scss/theme/_search.scss +0 -68
- package/src/scss/theme/_turbo.scss +0 -17
- package/src/scss/theme/_variables.scss +0 -139
- package/src/scss/theme/bootstrap/_accordion.scss +0 -146
- package/src/scss/theme/bootstrap/_alert.scss +0 -71
- package/src/scss/theme/bootstrap/_badge.scss +0 -38
- package/src/scss/theme/bootstrap/_breadcrumb.scss +0 -40
- package/src/scss/theme/bootstrap/_button-group.scss +0 -142
- package/src/scss/theme/bootstrap/_buttons.scss +0 -186
- package/src/scss/theme/bootstrap/_card.scss +0 -234
- package/src/scss/theme/bootstrap/_carousel.scss +0 -229
- package/src/scss/theme/bootstrap/_close.scss +0 -40
- package/src/scss/theme/bootstrap/_containers.scss +0 -41
- package/src/scss/theme/bootstrap/_dropdown.scss +0 -248
- package/src/scss/theme/bootstrap/_forms.scss +0 -9
- package/src/scss/theme/bootstrap/_functions.scss +0 -302
- package/src/scss/theme/bootstrap/_grid.scss +0 -33
- package/src/scss/theme/bootstrap/_helpers.scss +0 -10
- package/src/scss/theme/bootstrap/_images.scss +0 -42
- package/src/scss/theme/bootstrap/_list-group.scss +0 -191
- package/src/scss/theme/bootstrap/_maps.scss +0 -54
- package/src/scss/theme/bootstrap/_mixins.scss +0 -43
- package/src/scss/theme/bootstrap/_modal.scss +0 -237
- package/src/scss/theme/bootstrap/_nav.scss +0 -172
- package/src/scss/theme/bootstrap/_navbar.scss +0 -276
- package/src/scss/theme/bootstrap/_offcanvas.scss +0 -143
- package/src/scss/theme/bootstrap/_pagination.scss +0 -109
- package/src/scss/theme/bootstrap/_placeholders.scss +0 -51
- package/src/scss/theme/bootstrap/_popover.scss +0 -196
- package/src/scss/theme/bootstrap/_progress.scss +0 -59
- package/src/scss/theme/bootstrap/_reboot.scss +0 -610
- package/src/scss/theme/bootstrap/_root.scss +0 -73
- package/src/scss/theme/bootstrap/_spinners.scss +0 -85
- package/src/scss/theme/bootstrap/_tables.scss +0 -164
- package/src/scss/theme/bootstrap/_toasts.scss +0 -70
- package/src/scss/theme/bootstrap/_tooltip.scss +0 -120
- package/src/scss/theme/bootstrap/_transitions.scss +0 -27
- package/src/scss/theme/bootstrap/_type.scss +0 -106
- package/src/scss/theme/bootstrap/_utilities.scss +0 -647
- package/src/scss/theme/bootstrap/_variables.scss +0 -1633
- package/src/scss/theme/bootstrap/forms/_floating-labels.scss +0 -74
- package/src/scss/theme/bootstrap/forms/_form-check.scss +0 -175
- package/src/scss/theme/bootstrap/forms/_form-control.scss +0 -194
- package/src/scss/theme/bootstrap/forms/_form-range.scss +0 -91
- package/src/scss/theme/bootstrap/forms/_form-select.scss +0 -71
- package/src/scss/theme/bootstrap/forms/_form-text.scss +0 -11
- package/src/scss/theme/bootstrap/forms/_input-group.scss +0 -129
- package/src/scss/theme/bootstrap/forms/_labels.scss +0 -36
- package/src/scss/theme/bootstrap/forms/_validation.scss +0 -12
- package/src/scss/theme/bootstrap/helpers/_clearfix.scss +0 -3
- package/src/scss/theme/bootstrap/helpers/_color-bg.scss +0 -10
- package/src/scss/theme/bootstrap/helpers/_colored-links.scss +0 -12
- package/src/scss/theme/bootstrap/helpers/_position.scss +0 -36
- package/src/scss/theme/bootstrap/helpers/_ratio.scss +0 -26
- package/src/scss/theme/bootstrap/helpers/_stacks.scss +0 -15
- package/src/scss/theme/bootstrap/helpers/_stretched-link.scss +0 -15
- package/src/scss/theme/bootstrap/helpers/_text-truncation.scss +0 -7
- package/src/scss/theme/bootstrap/helpers/_visually-hidden.scss +0 -8
- package/src/scss/theme/bootstrap/helpers/_vr.scss +0 -8
- package/src/scss/theme/bootstrap/mixins/_alert.scss +0 -15
- package/src/scss/theme/bootstrap/mixins/_backdrop.scss +0 -14
- package/src/scss/theme/bootstrap/mixins/_banner.scss +0 -9
- package/src/scss/theme/bootstrap/mixins/_border-radius.scss +0 -78
- package/src/scss/theme/bootstrap/mixins/_box-shadow.scss +0 -18
- package/src/scss/theme/bootstrap/mixins/_buttons.scss +0 -70
- package/src/scss/theme/bootstrap/mixins/_caret.scss +0 -64
- package/src/scss/theme/bootstrap/mixins/_clearfix.scss +0 -9
- package/src/scss/theme/bootstrap/mixins/_color-scheme.scss +0 -7
- package/src/scss/theme/bootstrap/mixins/_container.scss +0 -11
- package/src/scss/theme/bootstrap/mixins/_deprecate.scss +0 -10
- package/src/scss/theme/bootstrap/mixins/_forms.scss +0 -152
- package/src/scss/theme/bootstrap/mixins/_gradients.scss +0 -47
- package/src/scss/theme/bootstrap/mixins/_grid.scss +0 -151
- package/src/scss/theme/bootstrap/mixins/_image.scss +0 -16
- package/src/scss/theme/bootstrap/mixins/_list-group.scss +0 -24
- package/src/scss/theme/bootstrap/mixins/_lists.scss +0 -7
- package/src/scss/theme/bootstrap/mixins/_pagination.scss +0 -10
- package/src/scss/theme/bootstrap/mixins/_reset-text.scss +0 -17
- package/src/scss/theme/bootstrap/mixins/_resize.scss +0 -6
- package/src/scss/theme/bootstrap/mixins/_table-variants.scss +0 -24
- package/src/scss/theme/bootstrap/mixins/_text-truncate.scss +0 -8
- package/src/scss/theme/bootstrap/mixins/_transition.scss +0 -26
- package/src/scss/theme/bootstrap/mixins/_utilities.scss +0 -97
- package/src/scss/theme/bootstrap/mixins/_visually-hidden.scss +0 -29
- package/src/scss/theme/bootstrap/utilities/_api.scss +0 -47
- package/src/scss/theme/bootstrap/vendor/_rfs.scss +0 -354
- package/src/scss/theme/bs/_badge.scss +0 -20
- package/src/scss/theme/bs/_buttons.scss +0 -185
- package/src/scss/theme/bs/_dropdown.scss +0 -86
- package/src/scss/theme/bs/_forms.scss +0 -161
- package/src/scss/theme/bs/_list-group.scss +0 -73
- package/src/scss/theme/bs/_tables.scss +0 -46
- package/src/scss/theme/fonts/_index.scss +0 -2
- package/src/scss/theme/mixins/_palette.scss +0 -165
- package/src/scss/theme/mixins/_scrollbar.scss +0 -110
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
//console.debug("utils.js", window.name);
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate a S4 alphanumeric 4 character sequence suitable for non-sensitive GUID generation etc.
|
|
5
|
+
*/
|
|
6
|
+
export function S4() {
|
|
7
|
+
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Parse any HTML string into a HTMLCollection. Use parseHTML(html)[0] to get the first HTMLElement.
|
|
12
|
+
*
|
|
13
|
+
* @param {any} html
|
|
14
|
+
* @returns {HTMLCollection} List of all parsed HTMLElements
|
|
15
|
+
*/
|
|
16
|
+
export function parseHTML(html) {
|
|
17
|
+
if ('content' in document.createElement('template')) {
|
|
18
|
+
var template = document.createElement('template');
|
|
19
|
+
template.innerHTML = html.trim();
|
|
20
|
+
return template.content.children;
|
|
21
|
+
} else {
|
|
22
|
+
// IE etc
|
|
23
|
+
var parseDoc = document.implementation.createHTMLDocument();
|
|
24
|
+
parseDoc.body.innerHTML = html.trim();
|
|
25
|
+
return parseDoc.body.children;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
33
|
+
* Released under the MIT License.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks if an object is an object.
|
|
38
|
+
*
|
|
39
|
+
* @param {any} maybeObject - The object to check
|
|
40
|
+
* @returns {boolean} True if the object is an object
|
|
41
|
+
*/
|
|
42
|
+
export function isObject(maybeObject) {
|
|
43
|
+
return Object.prototype.toString.call(maybeObject) === '[object Object]';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if an object is a plain object {}, similar to jQuery.isPlainObject()
|
|
48
|
+
*
|
|
49
|
+
* @param {any} maybePlainObject - The object to check
|
|
50
|
+
* @returns {boolean} True if the object is plain
|
|
51
|
+
*/
|
|
52
|
+
export function isPlainObject(maybePlainObject) {
|
|
53
|
+
var ctor, prot;
|
|
54
|
+
|
|
55
|
+
if (isObject(maybePlainObject) === false) return false;
|
|
56
|
+
|
|
57
|
+
// If has modified constructor
|
|
58
|
+
ctor = maybePlainObject.constructor;
|
|
59
|
+
if (ctor === undefined) return true;
|
|
60
|
+
|
|
61
|
+
// If has modified prototype
|
|
62
|
+
prot = ctor.prototype;
|
|
63
|
+
if (isObject(prot) === false) return false;
|
|
64
|
+
|
|
65
|
+
// If constructor does not have an Object-specific method
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Most likely a plain Object
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Check if an object is a jquery collection containing at least one item.
|
|
76
|
+
*
|
|
77
|
+
* @param {any} maybeJQuery
|
|
78
|
+
* @returns {boolean} True if object is jQuery containing at least one item
|
|
79
|
+
*/
|
|
80
|
+
export function isJQuery(maybeJQuery) {
|
|
81
|
+
return !!(maybeJQuery && maybeJQuery.jquery && maybeJQuery.length)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Method for extending plainObjects/options, similar to Object.assign() but with deep/recursive merging. If the recursive setting is applied it will merge any plain object children. Note that Arrays are treated as data and not as tree structure when merging.
|
|
86
|
+
*
|
|
87
|
+
* The original options passed are left untouched.
|
|
88
|
+
*
|
|
89
|
+
* @param {Object} source - Original options.
|
|
90
|
+
* @param {Object} properties - Merged options that will replace options from the source.
|
|
91
|
+
* @param {boolean} [recursive=false] True will merge any sub-objects of the options recursively. Otherwise sub-objects are treated as data.
|
|
92
|
+
* @returns {Object} A new object containing the merged options.
|
|
93
|
+
*/
|
|
94
|
+
export function assign(source, properties, recursive) {
|
|
95
|
+
source = source || {};
|
|
96
|
+
properties = properties || {};
|
|
97
|
+
|
|
98
|
+
var property;
|
|
99
|
+
|
|
100
|
+
// Make a copy
|
|
101
|
+
var copy = {};
|
|
102
|
+
for (property in source) {
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(source, property)) {
|
|
104
|
+
copy[property] = source[property];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Apply properties to copy
|
|
109
|
+
for (property in properties) {
|
|
110
|
+
if (Object.prototype.hasOwnProperty.call(properties, property)) {
|
|
111
|
+
if (recursive && copy[property] && isPlainObject(copy[property]) && isPlainObject(properties[property])) {
|
|
112
|
+
copy[property] = assign(copy[property], properties[property], recursive);
|
|
113
|
+
} else {
|
|
114
|
+
copy[property] = properties[property];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return copy;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Always returns an Array.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* asArray(1); // [1]
|
|
126
|
+
* asArray([1]); // [1]
|
|
127
|
+
*
|
|
128
|
+
* @param {any} maybeArray
|
|
129
|
+
* @returns {Array}
|
|
130
|
+
*/
|
|
131
|
+
export function asArray(maybeArray) {
|
|
132
|
+
return maybeArray && (Array.isArray(maybeArray) ? maybeArray : [maybeArray]) || [];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Returns an element from an HTMLElement, string query selector, html string or jquery element
|
|
137
|
+
*
|
|
138
|
+
* @param {any} elementOrSelector
|
|
139
|
+
* @returns {HTMLElement}
|
|
140
|
+
*/
|
|
141
|
+
export function asElement(elementOrSelector) {
|
|
142
|
+
if (elementOrSelector) {
|
|
143
|
+
if (elementOrSelector instanceof HTMLElement) {
|
|
144
|
+
return elementOrSelector;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (typeof elementOrSelector === "string") {
|
|
148
|
+
if (elementOrSelector.indexOf("<") === 0) {
|
|
149
|
+
return parseHTML(elementOrSelector)[0];
|
|
150
|
+
} else {
|
|
151
|
+
return document.querySelector(elementOrSelector);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (isJQuery(elementOrSelector)) {
|
|
156
|
+
console.warn("Weavy: providing jQuery elements is deprecated, please provide a HTMLElement or selector query instead.")
|
|
157
|
+
return elementOrSelector[0];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Case insensitive string comparison
|
|
164
|
+
*
|
|
165
|
+
* @param {any} str1 - The first string to compare
|
|
166
|
+
* @param {any} str2 - The second string to compare
|
|
167
|
+
* @param {boolean} ignoreType - Skipe type check and use any stringified value
|
|
168
|
+
* @returns {boolean}
|
|
169
|
+
*/
|
|
170
|
+
export function eqString(str1, str2, ignoreType) {
|
|
171
|
+
return (ignoreType || typeof str1 === "string" && typeof str2 === "string") && String(str1).toUpperCase() === String(str2).toUpperCase();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Compares two jQuery objects.
|
|
176
|
+
*
|
|
177
|
+
* @param {any} a - The first jQuery object to compare
|
|
178
|
+
* @param {any} b - The second jQuery object to compare
|
|
179
|
+
* @returns {boolean}
|
|
180
|
+
*/
|
|
181
|
+
export function eqJQuery(a, b) {
|
|
182
|
+
return a && b && a.jquery && b.jquery && a.jquery === b.jquery && a.length === b.length && a.length === a.filter(b).length;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Compares two plain objects. Compares all the properties in a to any properties in b.
|
|
187
|
+
*
|
|
188
|
+
* @param {any} a - The plain object to compare with b
|
|
189
|
+
* @param {any} b - The plain object to compare properties from a to
|
|
190
|
+
* @param {any} skipLength - Do not compare the number of properties
|
|
191
|
+
* @returns {boolean}
|
|
192
|
+
*/
|
|
193
|
+
export function eqObjects(a, b, skipLength) {
|
|
194
|
+
if (!isPlainObject(a) || !isPlainObject(b)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
var aProps = Object.getOwnPropertyNames(a);
|
|
199
|
+
var bProps = Object.getOwnPropertyNames(b);
|
|
200
|
+
|
|
201
|
+
if (!skipLength && aProps.length !== bProps.length) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
for (var i = 0; i < aProps.length; i++) {
|
|
206
|
+
var propName = aProps[i];
|
|
207
|
+
var propA = a[propName];
|
|
208
|
+
var propB = b[propName];
|
|
209
|
+
|
|
210
|
+
if (propA !== propB && !eqJQuery(propA, propB) && !eqObjects(propA, propB, skipLength)) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
// JSON HELPERS
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Removes HTMLElement and Node from object before serializing. Used with JSON.stringify().
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* var jsonString = JSON.stringify(data, sanitizeJSON);
|
|
226
|
+
*
|
|
227
|
+
* @param {string} key
|
|
228
|
+
* @param {any} value
|
|
229
|
+
* @returns {any} - Returns the value or undefined if removed.
|
|
230
|
+
*/
|
|
231
|
+
export function sanitizeJSON(key, value) {
|
|
232
|
+
// Filtering out DOM Elements and nodes
|
|
233
|
+
if (value instanceof HTMLElement || value instanceof Node) {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
return value;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Changes a string to snake_case from camelCase, PascalCase and spinal-case.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} str - The string to change to snake case
|
|
243
|
+
* @returns {string} The processed string as snake_case
|
|
244
|
+
*/
|
|
245
|
+
export function toSnakeCase(str) {
|
|
246
|
+
if (str.length > 0) {
|
|
247
|
+
return str.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/-|\s+/g, '_').toLowerCase();
|
|
248
|
+
} else {
|
|
249
|
+
return str;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Changes a string to camelCase from PascalCase, spinal-case and snake_case.
|
|
255
|
+
*
|
|
256
|
+
* @param {string} str - The string to change to camel case
|
|
257
|
+
* @param {boolean} pascal - Make ste string PascalCase
|
|
258
|
+
* @returns {string} The processed string as camelCase or PascalCase
|
|
259
|
+
*/
|
|
260
|
+
export function toCamelCase(str, pascal) {
|
|
261
|
+
if (pascal) {
|
|
262
|
+
// to PascalCase
|
|
263
|
+
str = str[0].toUpperCase() + str.substring(1);
|
|
264
|
+
} else {
|
|
265
|
+
// from PascalCase
|
|
266
|
+
str = str[0].toLowerCase() + str.substring(1);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// from snake_case and spinal-case
|
|
270
|
+
return str.replace(/([-_][a-z])/ig, function ($1) {
|
|
271
|
+
return $1.toUpperCase()
|
|
272
|
+
.replace('-', '')
|
|
273
|
+
.replace('_', '');
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Changes all object keys recursively to camelCase from PascalCase, spinal-case and snake_case.
|
|
279
|
+
*
|
|
280
|
+
* @param {Object} obj - The object containing keys to process
|
|
281
|
+
* @param {boolean} pascal - Make keys PascalCase
|
|
282
|
+
* @returns {Object} The processed object with any camelCase or PascalCase keys
|
|
283
|
+
*/
|
|
284
|
+
export function keysToCamelCase(obj, pascal) {
|
|
285
|
+
if (isPlainObject(obj)) {
|
|
286
|
+
const n = {};
|
|
287
|
+
|
|
288
|
+
Object.keys(obj)
|
|
289
|
+
.forEach(function (k) {
|
|
290
|
+
n[toCamelCase(k, pascal)] = keysToCamelCase(obj[k], pascal);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
return n;
|
|
294
|
+
} else if (Array.isArray(obj)) {
|
|
295
|
+
return obj.map(function (i) {
|
|
296
|
+
return keysToCamelCase(i, pascal);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return obj;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Changes all object keys recursively to PascalCase from camelCase, spinal-case and snake_case.
|
|
305
|
+
*
|
|
306
|
+
* @param {Object} obj - The object containing keys to process
|
|
307
|
+
* @returns {Object} The processed object with any PascalCase keys
|
|
308
|
+
*/
|
|
309
|
+
export function keysToPascalCase(obj) {
|
|
310
|
+
return keysToCamelCase(obj, true);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Serializes a form to an object with data.
|
|
315
|
+
*
|
|
316
|
+
* @param {HTMLFormElement} form - The form to serialize
|
|
317
|
+
* @param {boolean} snake_case - Use snake case for property names
|
|
318
|
+
* @returns {Object}
|
|
319
|
+
*/
|
|
320
|
+
export function serializeObject(form, snake_case) {
|
|
321
|
+
snake_case = snake_case || false;
|
|
322
|
+
var o = {};
|
|
323
|
+
var d = new FormData(form);
|
|
324
|
+
|
|
325
|
+
d.forEach((value, name) => {
|
|
326
|
+
var n = snake_case ? toSnakeCase(name) : name;
|
|
327
|
+
if (o[n] !== undefined) {
|
|
328
|
+
if (!o[n].push) {
|
|
329
|
+
o[n] = [o[n]];
|
|
330
|
+
}
|
|
331
|
+
o[n].push(value || '');
|
|
332
|
+
} else {
|
|
333
|
+
o[n] = value || '';
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
return o;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Processing of JSON in a fetch response
|
|
342
|
+
*
|
|
343
|
+
* @param {external:Response} response - The fetch response to parse
|
|
344
|
+
* @returns {Object|Response} The data if sucessful parsing, otherwise the response or an rejected error
|
|
345
|
+
*/
|
|
346
|
+
export function processJSONResponse(response) {
|
|
347
|
+
if (response) {
|
|
348
|
+
let contentType = (response.headers.has("content-type") ? response.headers.get("content-type") : "").split(";")[0];
|
|
349
|
+
|
|
350
|
+
if (response.ok) {
|
|
351
|
+
if (contentType === "application/json") {
|
|
352
|
+
try {
|
|
353
|
+
return response.json().then(function (jsonResponse) {
|
|
354
|
+
return keysToCamelCase(jsonResponse);
|
|
355
|
+
}).catch(function () {
|
|
356
|
+
return null;
|
|
357
|
+
});
|
|
358
|
+
} catch (e) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return response;
|
|
363
|
+
} else {
|
|
364
|
+
if (contentType.match(/json$/i)) {
|
|
365
|
+
try {
|
|
366
|
+
return response.json().then(function (jsonResponse) {
|
|
367
|
+
return keysToCamelCase(jsonResponse);
|
|
368
|
+
}).then(function (responseError) {
|
|
369
|
+
return Promise.reject(new Error(responseError.detail || responseError.title || responseError.message || response.statusText || responseError.status));
|
|
370
|
+
}, function () {
|
|
371
|
+
return Promise.reject(new Error(response.statusText));
|
|
372
|
+
});
|
|
373
|
+
} catch (e) {
|
|
374
|
+
/* Could not extract any details */ }
|
|
375
|
+
}
|
|
376
|
+
return Promise.reject(new Error(response.statusText));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// OTHER HELPERS
|
|
382
|
+
var _storageAvailable = [];
|
|
383
|
+
|
|
384
|
+
export function storageAvailable(type) {
|
|
385
|
+
if (!(type in _storageAvailable)) {
|
|
386
|
+
var storage;
|
|
387
|
+
try {
|
|
388
|
+
storage = window[type];
|
|
389
|
+
var x = '__storage_test__';
|
|
390
|
+
storage.setItem(x, x);
|
|
391
|
+
if (storage.getItem(x) !== x) {
|
|
392
|
+
var er = new Error("Mismatching storage items.");
|
|
393
|
+
er.name = "StorageMismatchError"
|
|
394
|
+
}
|
|
395
|
+
storage.removeItem(x);
|
|
396
|
+
_storageAvailable[type] = true;
|
|
397
|
+
} catch (e) {
|
|
398
|
+
return e instanceof DOMException && (
|
|
399
|
+
// everything except Firefox
|
|
400
|
+
e.code === 22 ||
|
|
401
|
+
// Firefox
|
|
402
|
+
e.code === 1014 ||
|
|
403
|
+
// test name field too, because code might not be present
|
|
404
|
+
e.name === 'StorageMismatchError' ||
|
|
405
|
+
// everything except Firefox
|
|
406
|
+
e.name === 'QuotaExceededError' ||
|
|
407
|
+
// Firefox
|
|
408
|
+
e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
|
|
409
|
+
// acknowledge QuotaExceededError only if there's something already stored
|
|
410
|
+
(storage && storage.length !== 0);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return !!_storageAvailable[type];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Fallback storage;
|
|
417
|
+
var _storage = new Map();
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Stores data for the current domain in the weavy namespace.
|
|
421
|
+
*
|
|
422
|
+
* @category options
|
|
423
|
+
* @param {string} key - The name of the data
|
|
424
|
+
* @param {data} value - Data to store
|
|
425
|
+
* @param {boolean} [asJson=false] - True if the data in value should be stored as JSON
|
|
426
|
+
*/
|
|
427
|
+
export function storeItem(key, value, asJson, type) {
|
|
428
|
+
var keyName = 'weavy_' + window.location.hostname + "_" + key;
|
|
429
|
+
type = type || 'localStorage';
|
|
430
|
+
|
|
431
|
+
try {
|
|
432
|
+
value = asJson ? JSON.stringify(value, sanitizeJSON) : value;
|
|
433
|
+
|
|
434
|
+
if (storageAvailable(type)) {
|
|
435
|
+
window[type].setItem(keyName, value);
|
|
436
|
+
} else {
|
|
437
|
+
throw new Error();
|
|
438
|
+
}
|
|
439
|
+
} catch (e) {
|
|
440
|
+
console.warning("Using fallback storage:", key);
|
|
441
|
+
_storage.set(keyName, value);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Retrieves data for the current domain from the weavy namespace.
|
|
447
|
+
*
|
|
448
|
+
* @category options
|
|
449
|
+
* @param {string} key - The name of the data to retrieve
|
|
450
|
+
* @param {boolean} [isJson=false] - True if the data shoul be decoded from JSON
|
|
451
|
+
* @returns {any}
|
|
452
|
+
*/
|
|
453
|
+
export function retrieveItem(key, isJson, type) {
|
|
454
|
+
var value;
|
|
455
|
+
var keyName = 'weavy_' + window.location.hostname + "_" + key;
|
|
456
|
+
type = type || 'localStorage';
|
|
457
|
+
|
|
458
|
+
try {
|
|
459
|
+
if (storageAvailable(type)) {
|
|
460
|
+
value = window[type].getItem(keyName);
|
|
461
|
+
} else {
|
|
462
|
+
throw new Error();
|
|
463
|
+
}
|
|
464
|
+
} catch (e) {
|
|
465
|
+
console.warning("Retrieving fallback storage:", key);
|
|
466
|
+
value = _storage.get(keyName);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (value && isJson) {
|
|
470
|
+
try {
|
|
471
|
+
return JSON.parse(value);
|
|
472
|
+
} catch (e) {
|
|
473
|
+
/* value was not JSON */ }
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return value;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Same as jQuery.ready()
|
|
481
|
+
*
|
|
482
|
+
* @param {Function} fn
|
|
483
|
+
*/
|
|
484
|
+
export function ready(fn) {
|
|
485
|
+
if (document.readyState !== 'loading') {
|
|
486
|
+
fn();
|
|
487
|
+
} else {
|
|
488
|
+
document.addEventListener('DOMContentLoaded', fn, {
|
|
489
|
+
once: true
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Parses a hex color to rgb
|
|
496
|
+
*
|
|
497
|
+
* @param {string} hex - Hex color string #112233
|
|
498
|
+
* @returns Array<number>
|
|
499
|
+
*/
|
|
500
|
+
export function HEXToRGB(hex) {
|
|
501
|
+
return hex.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).slice(1).map((n) => parseInt(n, 16));
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Convert rgb color to hsl
|
|
506
|
+
*
|
|
507
|
+
* @param {number} r
|
|
508
|
+
* @param {number} g
|
|
509
|
+
* @param {number} b
|
|
510
|
+
* @returns Array<number>
|
|
511
|
+
*/
|
|
512
|
+
export function RGBToHSL (r, g, b) {
|
|
513
|
+
r /= 255;
|
|
514
|
+
g /= 255;
|
|
515
|
+
b /= 255;
|
|
516
|
+
const l = Math.max(r, g, b);
|
|
517
|
+
const s = l - Math.min(r, g, b);
|
|
518
|
+
const h = s
|
|
519
|
+
? l === r
|
|
520
|
+
? (g - b) / s
|
|
521
|
+
: l === g
|
|
522
|
+
? 2 + (b - r) / s
|
|
523
|
+
: 4 + (r - g) / s
|
|
524
|
+
: 0;
|
|
525
|
+
return [
|
|
526
|
+
60 * h < 0 ? 60 * h + 360 : 60 * h,
|
|
527
|
+
100 * (s ? (l <= 0.5 ? s / (2 * l - s) : s / (2 - (2 * l - s))) : 0),
|
|
528
|
+
(100 * (2 * l - s)) / 2,
|
|
529
|
+
];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Concatenate className strings
|
|
534
|
+
*
|
|
535
|
+
* @param {string} classNames - Strings with space-separeated classNames
|
|
536
|
+
* @returns string
|
|
537
|
+
*/
|
|
538
|
+
export function classNamesConcat(...classNames) {
|
|
539
|
+
let classList = new Set();
|
|
540
|
+
classNames.forEach((s) => s && s.split(" ").filter((x) => x).forEach((c) => classList.add(c)));
|
|
541
|
+
return Array.from(classList).join(" ");
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @external Response
|
|
546
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
547
|
+
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useConversations(): import("react-query").UseQueryResult<ConversationsResult, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useConversations(): import("react-query").UseQueryResult<ConversationsResult, unknown>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
@use "config" as *;
|
|
2
|
-
@use "bs/list-group";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.wy-attachments,
|
|
6
|
-
.wy-meetings {
|
|
7
|
-
border: none;
|
|
8
|
-
border-radius: $border-radius-sm;
|
|
9
|
-
flex: 1 1 100%;
|
|
10
|
-
min-width: 0;
|
|
11
|
-
|
|
12
|
-
.wy-attachment,
|
|
13
|
-
.wy-meeting {
|
|
14
|
-
border-left: none;
|
|
15
|
-
border-right: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
> * {
|
|
19
|
-
padding: .25rem .5rem;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
> :first-child {
|
|
23
|
-
border-top: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
> :last-child {
|
|
27
|
-
//border-top: variables.$border-width solid variables.$border-color;
|
|
28
|
-
border-bottom: none;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.wy-attachment,
|
|
33
|
-
.wy-meeting {
|
|
34
|
-
@extend
|
|
35
|
-
%list-group-item,
|
|
36
|
-
%list-group-item-action;
|
|
37
|
-
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.wy-attachment-icon {
|
|
44
|
-
flex: 0 0 auto;
|
|
45
|
-
display: flex;
|
|
46
|
-
|
|
47
|
-
.wy-icon, .wy-icon-stack {
|
|
48
|
-
width: 3rem;
|
|
49
|
-
height: 3rem;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.wy-attachment-content {
|
|
54
|
-
flex: 1 1 100%;
|
|
55
|
-
min-width: 0;
|
|
56
|
-
margin-left: .5rem;
|
|
57
|
-
margin-right: .5rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.wy-attachment-title {
|
|
61
|
-
font-family: $headings-font-family;
|
|
62
|
-
font-style: $headings-font-style;
|
|
63
|
-
font-weight: $headings-font-weight;
|
|
64
|
-
color: $headings-color;
|
|
65
|
-
@include text-truncate();
|
|
66
|
-
@include font-size($h6-font-size);
|
|
67
|
-
margin: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.wy-attachment-meta {
|
|
71
|
-
@include text-truncate();
|
|
72
|
-
@include font-size($small-font-size);
|
|
73
|
-
color: $text-muted;
|
|
74
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
@use "config" as *;
|
|
2
|
-
@use "mixins/scrollbar";
|
|
3
|
-
@use "message-editor";
|
|
4
|
-
|
|
5
|
-
.ͼ1 .cm-scroller {
|
|
6
|
-
font-family: unset;
|
|
7
|
-
line-height: 1.25;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.ͼ1 .cm-widgetBuffer {
|
|
11
|
-
vertical-align: unset;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.cm-editor {
|
|
15
|
-
@extend %message-editor-textfield;
|
|
16
|
-
|
|
17
|
-
&.cm-focused {
|
|
18
|
-
/* default theme in codemirror seems difficult to override */
|
|
19
|
-
outline: $light solid 1px !important;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.cm-content {
|
|
23
|
-
@extend %message-editor-textcontent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cm-scroller {
|
|
27
|
-
overflow: auto;
|
|
28
|
-
|
|
29
|
-
.wy-scrollbars & {
|
|
30
|
-
@include scrollbar.custom-scrollbar;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.wy-is-invalid + [data-editor-target] .cm-editor {
|
|
36
|
-
padding-right: $input-height-inner;
|
|
37
|
-
background-image: escape-svg($form-feedback-icon-invalid);
|
|
38
|
-
background-repeat: no-repeat;
|
|
39
|
-
background-position: right $input-height-inner-quarter top $input-height-inner-quarter;
|
|
40
|
-
background-size: $input-height-inner-half $input-height-inner-half;
|
|
41
|
-
outline-color: $form-feedback-invalid-color !important;
|
|
42
|
-
}
|