@lowdefy/blocks-native 0.0.0-stage → 7.3.0
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/LICENSE +201 -0
- package/README.md +9 -2
- package/dist/actions/AddCalendarEvent/AddCalendarEvent.js +31 -0
- package/dist/actions/AddCalendarEvent/schema.js +55 -0
- package/dist/actions/AddContact/AddContact.js +24 -0
- package/dist/actions/AddContact/schema.js +49 -0
- package/dist/actions/CancelNotification/CancelNotification.js +23 -0
- package/dist/actions/CancelNotification/schema.js +31 -0
- package/dist/actions/DiscardQueuedRequest/DiscardQueuedRequest.js +23 -0
- package/dist/actions/DiscardQueuedRequest/schema.js +31 -0
- package/dist/actions/GetCalendarEvents/GetCalendarEvents.js +32 -0
- package/dist/actions/GetCalendarEvents/schema.js +35 -0
- package/dist/actions/GetRequestQueue/GetRequestQueue.js +24 -0
- package/dist/actions/GetRequestQueue/schema.js +22 -0
- package/dist/actions/Haptic/Haptic.js +38 -0
- package/dist/actions/Haptic/schema.js +37 -0
- package/dist/actions/KeepAwake/KeepAwake.js +23 -0
- package/dist/actions/KeepAwake/schema.js +28 -0
- package/dist/actions/PickContact/PickContact.js +24 -0
- package/dist/actions/PickContact/schema.js +22 -0
- package/dist/actions/PickFile/PickFile.js +32 -0
- package/dist/actions/PickFile/schema.js +58 -0
- package/dist/actions/PickImage/PickImage.js +32 -0
- package/dist/actions/PickImage/schema.js +76 -0
- package/dist/actions/ReadNfc/ReadNfc.js +24 -0
- package/dist/actions/ReadNfc/schema.js +27 -0
- package/dist/actions/RefreshWidgets/RefreshWidgets.js +24 -0
- package/dist/actions/RefreshWidgets/schema.js +22 -0
- package/dist/actions/RequestNotificationPermission/RequestNotificationPermission.js +24 -0
- package/dist/actions/RequestNotificationPermission/schema.js +22 -0
- package/dist/actions/RetryRequestQueue/RetryRequestQueue.js +24 -0
- package/dist/actions/RetryRequestQueue/schema.js +27 -0
- package/dist/actions/ScanCode/ScanCode.js +24 -0
- package/dist/actions/ScanCode/schema.js +54 -0
- package/dist/actions/ScanDocument/ScanDocument.js +32 -0
- package/dist/actions/ScanDocument/schema.js +57 -0
- package/dist/actions/ScheduleNotification/ScheduleNotification.js +27 -0
- package/dist/actions/ScheduleNotification/schema.js +67 -0
- package/dist/actions/SetBadgeCount/SetBadgeCount.js +27 -0
- package/dist/actions/SetBadgeCount/schema.js +31 -0
- package/dist/actions/SetBrightness/SetBrightness.js +24 -0
- package/dist/actions/SetBrightness/schema.js +33 -0
- package/dist/actions/Share/Share.js +50 -0
- package/dist/actions/Share/schema.js +51 -0
- package/dist/actions/Speak/Speak.js +27 -0
- package/dist/actions/Speak/schema.js +44 -0
- package/dist/actions/StartGeofencing/StartGeofencing.js +29 -0
- package/dist/actions/StartGeofencing/schema.js +63 -0
- package/dist/actions/StartLocationTracking/StartLocationTracking.js +29 -0
- package/dist/actions/StartLocationTracking/schema.js +59 -0
- package/dist/actions/StartRecording/StartRecording.js +23 -0
- package/dist/actions/StartRecording/schema.js +32 -0
- package/dist/actions/StopGeofencing/StopGeofencing.js +23 -0
- package/dist/actions/StopGeofencing/schema.js +22 -0
- package/dist/actions/StopLocationTracking/StopLocationTracking.js +23 -0
- package/dist/actions/StopLocationTracking/schema.js +22 -0
- package/dist/actions/StopRecording/StopRecording.js +37 -0
- package/dist/actions/StopRecording/schema.js +46 -0
- package/dist/actions/StopSpeaking/StopSpeaking.js +23 -0
- package/dist/actions/StopSpeaking/schema.js +22 -0
- package/dist/actions/TakePhoto/TakePhoto.js +31 -0
- package/dist/actions/TakePhoto/schema.js +67 -0
- package/dist/actions/WriteNfc/WriteNfc.js +28 -0
- package/dist/actions/WriteNfc/schema.js +61 -0
- package/dist/actions/uploadFiles.js +51 -0
- package/dist/actions.js +47 -0
- package/dist/blocks/ActivityTimeline/ActivityTimeline.js +507 -0
- package/dist/blocks/ActivityTimeline/CommentBody.js +176 -0
- package/dist/blocks/ActivityTimeline/CommentItem.js +302 -0
- package/dist/blocks/ActivityTimeline/EditBox.js +143 -0
- package/dist/blocks/ActivityTimeline/LineText.js +71 -0
- package/dist/blocks/ActivityTimeline/RailIcon.js +41 -0
- package/dist/blocks/ActivityTimeline/RailRow.js +74 -0
- package/dist/blocks/ActivityTimeline/ReactionPicker.js +68 -0
- package/dist/blocks/ActivityTimeline/ReactionPills.js +112 -0
- package/dist/blocks/ActivityTimeline/ThreadCard.js +160 -0
- package/dist/blocks/ActivityTimeline/TimelineMarkdownRenderer.js +48 -0
- package/dist/blocks/ActivityTimeline/buildTimelineRows.js +194 -0
- package/dist/blocks/ActivityTimeline/describeEvent.js +61 -0
- package/dist/blocks/ActivityTimeline/describeGap.js +71 -0
- package/dist/blocks/ActivityTimeline/fillTemplate.js +84 -0
- package/dist/blocks/ActivityTimeline/fillText.js +38 -0
- package/dist/blocks/ActivityTimeline/formatRelativeTime.js +68 -0
- package/dist/blocks/ActivityTimeline/getActor.js +41 -0
- package/dist/blocks/ActivityTimeline/getCommentMenuActions.js +85 -0
- package/dist/blocks/ActivityTimeline/getCommentView.js +72 -0
- package/dist/blocks/ActivityTimeline/getTimelineColors.js +71 -0
- package/dist/blocks/ActivityTimeline/getToneColor.js +49 -0
- package/dist/blocks/ActivityTimeline/getVisibleReplies.js +36 -0
- package/dist/blocks/ActivityTimeline/isThreadShown.js +28 -0
- package/dist/blocks/ActivityTimeline/joinList.js +21 -0
- package/dist/blocks/ActivityTimeline/meta.js +320 -0
- package/dist/blocks/ActivityTimeline/parseTimelineHref.js +43 -0
- package/dist/blocks/ActivityTimeline/selectEventRule.js +69 -0
- package/dist/blocks/ActivityTimeline/summariseEvents.js +51 -0
- package/dist/blocks/ActivityTimeline/toPlainText.js +32 -0
- package/dist/blocks/ActivityTimeline/toTime.js +36 -0
- package/dist/blocks/ActivityTimeline/toTimelineMarkdown.js +57 -0
- package/dist/blocks/ActivityTimeline/toggleReaction.js +74 -0
- package/dist/blocks/ActivityTimeline/useNow.js +24 -0
- package/dist/blocks/AgentChat/AgentChat.js +726 -0
- package/dist/blocks/AgentChat/AssistantMessage.js +243 -0
- package/dist/blocks/AgentChat/ChatComposer.js +401 -0
- package/dist/blocks/AgentChat/ChatError.js +129 -0
- package/dist/blocks/AgentChat/ChatSkeleton.js +97 -0
- package/dist/blocks/AgentChat/ReasoningDisclosure.js +125 -0
- package/dist/blocks/AgentChat/ThinkingIndicator.js +103 -0
- package/dist/blocks/AgentChat/ThreadsSheet.js +347 -0
- package/dist/blocks/AgentChat/ToolApprovalCard.js +190 -0
- package/dist/blocks/AgentChat/ToolCallRow.js +187 -0
- package/dist/blocks/AgentChat/ToolDetail.js +137 -0
- package/dist/blocks/AgentChat/UserMessage.js +84 -0
- package/dist/blocks/AgentChat/WelcomeView.js +100 -0
- package/dist/blocks/AgentChat/createAgentTransport.js +74 -0
- package/dist/blocks/AgentChat/describeToolPart.js +133 -0
- package/dist/blocks/AgentChat/getChatSeed.js +44 -0
- package/dist/blocks/AgentChat/getFirstExchange.js +43 -0
- package/dist/blocks/AgentChat/getMessageSegments.js +73 -0
- package/dist/blocks/AgentChat/getMessageText.js +25 -0
- package/dist/blocks/AgentChat/getPageStateUpdates.js +47 -0
- package/dist/blocks/AgentChat/getProvisionalTitle.js +32 -0
- package/dist/blocks/AgentChat/getReadableRows.js +157 -0
- package/dist/blocks/AgentChat/getThreadEndpoints.js +54 -0
- package/dist/blocks/AgentChat/getToolIcon.js +110 -0
- package/dist/blocks/AgentChat/humanizeToolName.js +30 -0
- package/dist/blocks/AgentChat/messageParts.js +86 -0
- package/dist/blocks/AgentChat/meta.js +530 -0
- package/dist/blocks/AgentChat/mintConversationId.js +29 -0
- package/dist/blocks/AgentChat/replayableMessages.js +62 -0
- package/dist/blocks/AgentChat/showMessageMenu.js +49 -0
- package/dist/blocks/AgentChat/summarizeToolInput.js +36 -0
- package/dist/blocks/AgentChat/summarizeToolOutput.js +49 -0
- package/dist/blocks/AgentChat/useAgentEvents.js +218 -0
- package/dist/blocks/AgentChat/useChatDictation.js +151 -0
- package/dist/blocks/AgentChat/useChatThreads.js +450 -0
- package/dist/blocks/AgentChat/useFollowScroll.js +80 -0
- package/dist/blocks/AgentChat/useThinkingMessage.js +77 -0
- package/dist/blocks/Alert/Alert.js +167 -0
- package/dist/blocks/Alert/meta.js +200 -0
- package/dist/blocks/Avatar/Avatar.js +51 -0
- package/dist/blocks/Avatar/AvatarCircle.js +114 -0
- package/dist/blocks/Avatar/AvatarPhoto.js +68 -0
- package/dist/blocks/Avatar/AvatarStack.js +89 -0
- package/dist/blocks/Avatar/getAvatarColor.js +84 -0
- package/dist/blocks/Avatar/getAvatarImage.js +97 -0
- package/dist/blocks/Avatar/getInitials.js +51 -0
- package/dist/blocks/Avatar/meta.js +57 -0
- package/dist/blocks/Box/Box.js +118 -0
- package/dist/blocks/Box/getRubberBand.js +29 -0
- package/dist/blocks/Box/getSwipeDirection.js +45 -0
- package/dist/blocks/Box/isSwipeGesture.js +41 -0
- package/dist/blocks/Box/meta.js +46 -0
- package/dist/blocks/Box/useSwipeGesture.js +113 -0
- package/dist/blocks/Button/Button.js +136 -0
- package/dist/blocks/Button/getButtonColors.js +216 -0
- package/dist/blocks/Button/meta.js +137 -0
- package/dist/blocks/Card/Card.js +185 -0
- package/dist/blocks/Card/meta.js +203 -0
- package/dist/blocks/ChipSelector/Chip.js +178 -0
- package/dist/blocks/ChipSelector/ChipSelector.js +313 -0
- package/dist/blocks/ChipSelector/EdgeFade.js +68 -0
- package/dist/blocks/ChipSelector/getChipColors.js +88 -0
- package/dist/blocks/ChipSelector/getFadeRanges.js +55 -0
- package/dist/blocks/ChipSelector/getOverscrollSwipe.js +44 -0
- package/dist/blocks/ChipSelector/getScrollTarget.js +41 -0
- package/dist/blocks/ChipSelector/meta.js +156 -0
- package/dist/blocks/Composer/Composer.js +511 -0
- package/dist/blocks/Composer/MentionTextInput.js +91 -0
- package/dist/blocks/Composer/SuggestionList.js +165 -0
- package/dist/blocks/Composer/applyDisplayEdit.js +81 -0
- package/dist/blocks/Composer/convertSpokenMentions.js +234 -0
- package/dist/blocks/Composer/createMentionPattern.js +40 -0
- package/dist/blocks/Composer/findTrigger.js +51 -0
- package/dist/blocks/Composer/getSendState.js +38 -0
- package/dist/blocks/Composer/getSpokenMentionWords.js +35 -0
- package/dist/blocks/Composer/indexSpokenNames.js +50 -0
- package/dist/blocks/Composer/insertLink.js +36 -0
- package/dist/blocks/Composer/insertMention.js +43 -0
- package/dist/blocks/Composer/matchSpokenName.js +88 -0
- package/dist/blocks/Composer/meta.js +212 -0
- package/dist/blocks/Composer/parseMentionValue.js +55 -0
- package/dist/blocks/Composer/placeDictation.js +51 -0
- package/dist/blocks/Composer/rankMentions.js +51 -0
- package/dist/blocks/Composer/replaceRange.js +48 -0
- package/dist/blocks/Composer/segmentText.js +78 -0
- package/dist/blocks/Composer/shiftOffset.js +37 -0
- package/dist/blocks/Composer/snapSelection.js +37 -0
- package/dist/blocks/Composer/useMentionEditor.js +381 -0
- package/dist/blocks/Composer/withPartial.js +50 -0
- package/dist/blocks/DateSelector/DateSelector.js +250 -0
- package/dist/blocks/DateSelector/formatDateValue.js +34 -0
- package/dist/blocks/DateSelector/getDateMenuActions.js +96 -0
- package/dist/blocks/DateSelector/meta.js +109 -0
- package/dist/blocks/DateSelector/toBoundDate.js +40 -0
- package/dist/blocks/DateSelector/toPickerDate.js +31 -0
- package/dist/blocks/DateSelector/toUtcDay.js +25 -0
- package/dist/blocks/Divider/Divider.js +159 -0
- package/dist/blocks/Divider/meta.js +108 -0
- package/dist/blocks/Empty/Empty.js +107 -0
- package/dist/blocks/Empty/meta.js +61 -0
- package/dist/blocks/FileInput/FileInput.js +253 -0
- package/dist/blocks/FileInput/formatFileSize.js +28 -0
- package/dist/blocks/FileInput/getFileSources.js +48 -0
- package/dist/blocks/FileInput/meta.js +123 -0
- package/dist/blocks/Icon/Icon.js +41 -0
- package/dist/blocks/Icon/meta.js +80 -0
- package/dist/blocks/Illustration/Illustration.js +154 -0
- package/dist/blocks/Illustration/IllustrationLayer.js +105 -0
- package/dist/blocks/Illustration/colorNodes.js +72 -0
- package/dist/blocks/Illustration/createIllustrationMotion.js +172 -0
- package/dist/blocks/Illustration/getIllustrationBox.js +54 -0
- package/dist/blocks/Illustration/getIllustrationColors.js +48 -0
- package/dist/blocks/Illustration/getKeyframeRange.js +99 -0
- package/dist/blocks/Illustration/getLayerBounds.js +74 -0
- package/dist/blocks/Illustration/getLayers.js +113 -0
- package/dist/blocks/Illustration/getNodePoints.js +210 -0
- package/dist/blocks/Illustration/meta.js +196 -0
- package/dist/blocks/Illustration/parseIllustration.js +84 -0
- package/dist/blocks/Illustration/toBoundingBoxGradients.js +188 -0
- package/dist/blocks/Illustration/useIllustrationMotion.js +75 -0
- package/dist/blocks/Label/Label.js +111 -0
- package/dist/blocks/Label/getLabelProperties.js +38 -0
- package/dist/blocks/Label/getLabelState.js +59 -0
- package/dist/blocks/List/List.js +159 -0
- package/dist/blocks/List/ListRow.js +74 -0
- package/dist/blocks/List/ListRowContext.js +20 -0
- package/dist/blocks/List/SectionHeader.js +119 -0
- package/dist/blocks/List/getSections.js +161 -0
- package/dist/blocks/List/meta.js +190 -0
- package/dist/blocks/ListItem/ListItem.js +440 -0
- package/dist/blocks/ListItem/ListItemContextMenu.js +58 -0
- package/dist/blocks/ListItem/getListItemParts.js +101 -0
- package/dist/blocks/ListItem/getSfSymbol.js +33 -0
- package/dist/blocks/ListItem/meta.js +284 -0
- package/dist/blocks/Map/Map.js +78 -0
- package/dist/blocks/Map/meta.js +153 -0
- package/dist/blocks/Markdown/ChipWidthContext.js +20 -0
- package/dist/blocks/Markdown/ChipWidthView.js +40 -0
- package/dist/blocks/Markdown/LinkChip.js +151 -0
- package/dist/blocks/Markdown/Markdown.js +70 -0
- package/dist/blocks/Markdown/MarkdownCode.js +67 -0
- package/dist/blocks/Markdown/MarkdownContent.js +119 -0
- package/dist/blocks/Markdown/MarkdownImage.js +77 -0
- package/dist/blocks/Markdown/MarkdownList.js +97 -0
- package/dist/blocks/Markdown/MarkdownListContext.js +22 -0
- package/dist/blocks/Markdown/MarkdownRenderer.js +231 -0
- package/dist/blocks/Markdown/MarkdownTable.js +96 -0
- package/dist/blocks/Markdown/MarkdownTokenizer.js +43 -0
- package/dist/blocks/Markdown/TaskBox.js +58 -0
- package/dist/blocks/Markdown/TaskMark.js +37 -0
- package/dist/blocks/Markdown/getChipMaxWidth.js +33 -0
- package/dist/blocks/Markdown/getLinkChip.js +95 -0
- package/dist/blocks/Markdown/getLinkChipColors.js +51 -0
- package/dist/blocks/Markdown/getListMarker.js +116 -0
- package/dist/blocks/Markdown/getMarkdownStyles.js +206 -0
- package/dist/blocks/Markdown/getNodeText.js +37 -0
- package/dist/blocks/Markdown/layoutLinkChips.js +209 -0
- package/dist/blocks/Markdown/matchLinkChip.js +82 -0
- package/dist/blocks/Markdown/meta.js +56 -0
- package/dist/blocks/Markdown/restyleText.js +40 -0
- package/dist/blocks/Markdown/trimOuterSpace.js +42 -0
- package/dist/blocks/Menu/Menu.js +96 -0
- package/dist/blocks/Menu/getMenuActions.js +66 -0
- package/dist/blocks/Menu/meta.js +159 -0
- package/dist/blocks/MultipleSelector/MultipleSelector.js +290 -0
- package/dist/blocks/MultipleSelector/MultipleSelectorRow.js +71 -0
- package/dist/blocks/MultipleSelector/ValueSummary.js +130 -0
- package/dist/blocks/MultipleSelector/getOptionIndices.js +30 -0
- package/dist/blocks/MultipleSelector/getSessionOptions.js +38 -0
- package/dist/blocks/MultipleSelector/getSummaryCount.js +35 -0
- package/dist/blocks/MultipleSelector/meta.js +284 -0
- package/dist/blocks/MultipleSelector/toggleValue.js +50 -0
- package/dist/blocks/NumberInput/NumberInput.js +251 -0
- package/dist/blocks/NumberInput/StepButton.js +46 -0
- package/dist/blocks/NumberInput/formatNumber.js +35 -0
- package/dist/blocks/NumberInput/getNumberKeyboardType.js +32 -0
- package/dist/blocks/NumberInput/meta.js +123 -0
- package/dist/blocks/NumberInput/normalizeNumber.js +38 -0
- package/dist/blocks/NumberInput/parseNumberText.js +46 -0
- package/dist/blocks/PageDots/PageDots.js +131 -0
- package/dist/blocks/PageDots/meta.js +48 -0
- package/dist/blocks/Paragraph/Paragraph.js +52 -0
- package/dist/blocks/Paragraph/meta.js +295 -0
- package/dist/blocks/QRScanner/QRScanner.js +94 -0
- package/dist/blocks/QRScanner/createScanFilter.js +44 -0
- package/dist/blocks/QRScanner/meta.js +80 -0
- package/dist/blocks/Screen/meta.js +197 -0
- package/dist/blocks/SegmentedControl/SegmentedControl.js +77 -0
- package/dist/blocks/SegmentedControl/meta.js +78 -0
- package/dist/blocks/Selector/NoValueAvatar.js +42 -0
- package/dist/blocks/Selector/PickerOptionRow.js +130 -0
- package/dist/blocks/Selector/PickerRowLeading.js +57 -0
- package/dist/blocks/Selector/PickerSearchField.js +85 -0
- package/dist/blocks/Selector/PickerSheet.js +239 -0
- package/dist/blocks/Selector/Selector.js +122 -0
- package/dist/blocks/Selector/SelectorMenu.js +97 -0
- package/dist/blocks/Selector/SelectorRow.js +86 -0
- package/dist/blocks/Selector/SelectorSheet.js +131 -0
- package/dist/blocks/Selector/getOptionIndex.js +39 -0
- package/dist/blocks/Selector/getOptionLabel.js +32 -0
- package/dist/blocks/Selector/getOptionValue.js +20 -0
- package/dist/blocks/Selector/getPickerSheetDetents.js +45 -0
- package/dist/blocks/Selector/getPickerSheetRows.js +174 -0
- package/dist/blocks/Selector/getPickerSheetScrollIndex.js +35 -0
- package/dist/blocks/Selector/getSelectorMenuActions.js +61 -0
- package/dist/blocks/Selector/meta.js +195 -0
- package/dist/blocks/Selector/normalizeSearchText.js +27 -0
- package/dist/blocks/Selector/setSelectorValue.js +54 -0
- package/dist/blocks/Sheet/Sheet.js +174 -0
- package/dist/blocks/Sheet/getSheetDetents.js +56 -0
- package/dist/blocks/Sheet/meta.js +72 -0
- package/dist/blocks/SignaturePad/SignaturePad.js +182 -0
- package/dist/blocks/SignaturePad/meta.js +74 -0
- package/dist/blocks/SignaturePad/toSignatureValue.js +52 -0
- package/dist/blocks/Skeleton/Skeleton.js +131 -0
- package/dist/blocks/Skeleton/SkeletonCard.js +42 -0
- package/dist/blocks/Skeleton/SkeletonHero.js +72 -0
- package/dist/blocks/Skeleton/SkeletonInsetGroup.js +82 -0
- package/dist/blocks/Skeleton/SkeletonListRow.js +90 -0
- package/dist/blocks/Skeleton/SkeletonParagraph.js +36 -0
- package/dist/blocks/Skeleton/SkeletonRows.js +58 -0
- package/dist/blocks/Skeleton/SkeletonTimeline.js +88 -0
- package/dist/blocks/Skeleton/getBarWidth.js +45 -0
- package/dist/blocks/Skeleton/getParagraphWidths.js +56 -0
- package/dist/blocks/Skeleton/getSectionCounts.js +33 -0
- package/dist/blocks/Skeleton/getSkeletonVariant.js +27 -0
- package/dist/blocks/Skeleton/meta.js +98 -0
- package/dist/blocks/Spinner/Spinner.js +68 -0
- package/dist/blocks/Spinner/meta.js +35 -0
- package/dist/blocks/StatusIcon/StatusGlyph.js +247 -0
- package/dist/blocks/StatusIcon/StatusIcon.js +34 -0
- package/dist/blocks/StatusIcon/StatusMark.js +87 -0
- package/dist/blocks/StatusIcon/getPiePath.js +41 -0
- package/dist/blocks/StatusIcon/getStatusColor.js +61 -0
- package/dist/blocks/StatusIcon/meta.js +38 -0
- package/dist/blocks/StatusIcon/statusLabels.js +33 -0
- package/dist/blocks/Switch/Switch.js +85 -0
- package/dist/blocks/Switch/meta.js +78 -0
- package/dist/blocks/Tabs/Tabs.js +269 -0
- package/dist/blocks/Tabs/meta.js +305 -0
- package/dist/blocks/Tag/TONE_PALETTES.js +34 -0
- package/dist/blocks/Tag/Tag.js +173 -0
- package/dist/blocks/Tag/getTagColors.js +120 -0
- package/dist/blocks/Tag/getTagDotColor.js +32 -0
- package/dist/blocks/Tag/meta.js +131 -0
- package/dist/blocks/TextArea/ComposerSendButton.js +69 -0
- package/dist/blocks/TextArea/TextArea.js +167 -0
- package/dist/blocks/TextArea/meta.js +96 -0
- package/dist/blocks/TextInput/TextInput.js +253 -0
- package/dist/blocks/TextInput/applyReplaceInput.js +30 -0
- package/dist/blocks/TextInput/getKeyboardProps.js +64 -0
- package/dist/blocks/TextInput/getSearchBoxStyle.js +39 -0
- package/dist/blocks/TextInput/meta.js +113 -0
- package/dist/blocks/Title/Title.js +62 -0
- package/dist/blocks/Title/meta.js +355 -0
- package/dist/blocks.js +52 -0
- package/dist/device/getDeviceFeature.js +81 -0
- package/dist/device/playFeedback.js +32 -0
- package/dist/device.js +18 -0
- package/dist/dictation.js +17 -0
- package/dist/htmlToText.js +32 -0
- package/dist/metas.js +53 -0
- package/dist/schemas/avatar.js +40 -0
- package/dist/schemas/icon.js +65 -0
- package/dist/schemas/inputLabel.js +96 -0
- package/dist/schemas/inputProperties.js +92 -0
- package/dist/schemas/linkChips.js +85 -0
- package/dist/schemas/status.js +75 -0
- package/dist/schemas/textStyle.js +33 -0
- package/dist/schemas/tone.js +28 -0
- package/dist/schemas.js +47 -0
- package/dist/shared/ClearButton.js +53 -0
- package/dist/shared/CountText.js +38 -0
- package/dist/shared/MissingFeature.js +43 -0
- package/dist/shared/NativeMenu.js +69 -0
- package/dist/shared/OptionGlyph.js +59 -0
- package/dist/shared/PropertyRow.js +89 -0
- package/dist/shared/SheetCloseButton.js +51 -0
- package/dist/shared/SheetDoneButton.js +44 -0
- package/dist/shared/SwipeContext.js +20 -0
- package/dist/shared/SwipeableRow.js +294 -0
- package/dist/shared/SystemIcon.js +72 -0
- package/dist/shared/dictation/DictationButton.js +77 -0
- package/dist/shared/dictation/DictationWarning.js +89 -0
- package/dist/shared/dictation/LevelMeter.js +57 -0
- package/dist/shared/dictation/ListeningRow.js +100 -0
- package/dist/shared/dictation/PartialSpans.js +50 -0
- package/dist/shared/dictation/checkDictationAvailable.js +65 -0
- package/dist/shared/dictation/claimMic.js +68 -0
- package/dist/shared/dictation/createQueuedRecognizer.js +213 -0
- package/dist/shared/dictation/getDictationLevel.js +30 -0
- package/dist/shared/dictation/getDictationWarning.js +40 -0
- package/dist/shared/dictation/getLevelBars.js +38 -0
- package/dist/shared/dictation/getRecognizer.js +46 -0
- package/dist/shared/dictation/getStartOptions.js +42 -0
- package/dist/shared/dictation/insertAtSelection.js +48 -0
- package/dist/shared/dictation/pickRecognitionLocale.js +37 -0
- package/dist/shared/dictation/useDictation.js +299 -0
- package/dist/shared/getControlSize.js +50 -0
- package/dist/shared/getInputBoxStyle.js +93 -0
- package/dist/shared/getPropertyRowTextStyles.js +40 -0
- package/dist/shared/getSemanticColors.js +96 -0
- package/dist/shared/getToneColor.js +51 -0
- package/dist/shared/iosTextStyles.js +49 -0
- package/dist/shared/useBlockTokens.js +41 -0
- package/dist/skeleton/SkeletonFrameContext.js +21 -0
- package/dist/skeleton/SkeletonLine.js +46 -0
- package/dist/skeleton/SkeletonShape.js +140 -0
- package/dist/skeleton/createShimmerClock.js +57 -0
- package/dist/skeleton/shimmerClock.js +20 -0
- package/dist/skeleton/skeletonText.js +44 -0
- package/dist/skeleton/useShimmer.js +34 -0
- package/dist/types.js +23 -0
- package/dist/typography/TITLE_LEVEL_STYLES.js +24 -0
- package/dist/typography/TypographyText.js +78 -0
- package/dist/typography/getIosTextStyle.js +33 -0
- package/dist/typography/getTextStyle.js +94 -0
- package/dist/useComponentTokens.js +38 -0
- package/package.json +94 -3
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import { Linking, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
17
|
+
import { type } from '@lowdefy/helpers';
|
|
18
|
+
import buildTimelineRows from './buildTimelineRows.js';
|
|
19
|
+
import createMentionPattern, { DEFAULT_MENTION_FORMAT } from '../Composer/createMentionPattern.js';
|
|
20
|
+
import formatRelativeTime from './formatRelativeTime.js';
|
|
21
|
+
import getActor from './getActor.js';
|
|
22
|
+
import getTimelineColors from './getTimelineColors.js';
|
|
23
|
+
import getToneColor from './getToneColor.js';
|
|
24
|
+
import LineText from './LineText.js';
|
|
25
|
+
import meta from './meta.js';
|
|
26
|
+
import RailIcon from './RailIcon.js';
|
|
27
|
+
import RailRow from './RailRow.js';
|
|
28
|
+
import ThreadCard from './ThreadCard.js';
|
|
29
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
30
|
+
import useNow from './useNow.js';
|
|
31
|
+
const appPathPattern = /^\/(?!\/)/;
|
|
32
|
+
const REACTIONS = [
|
|
33
|
+
'👍',
|
|
34
|
+
'👎',
|
|
35
|
+
'❤️',
|
|
36
|
+
'🎉',
|
|
37
|
+
'😄',
|
|
38
|
+
'👀',
|
|
39
|
+
'🙏',
|
|
40
|
+
'✅'
|
|
41
|
+
];
|
|
42
|
+
const LINE_MARKER_TOP = 6;
|
|
43
|
+
function Chevron({ colors, Icon, open }) {
|
|
44
|
+
return /*#__PURE__*/ React.createElement(Icon, {
|
|
45
|
+
properties: {
|
|
46
|
+
name: open ? 'ChevronDown' : 'ChevronRight',
|
|
47
|
+
size: 14,
|
|
48
|
+
title: ''
|
|
49
|
+
},
|
|
50
|
+
styles: {
|
|
51
|
+
element: {
|
|
52
|
+
color: colors.tertiary,
|
|
53
|
+
marginTop: 3
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// An event, gap or fold line on the rail. With onPress it is a button with a press highlight.
|
|
59
|
+
function LineRow({ children, ctx, expanded, first, icon, last, onPress, open, tone }) {
|
|
60
|
+
const { colors, Icon, tokens } = ctx;
|
|
61
|
+
const content = /*#__PURE__*/ React.createElement(View, {
|
|
62
|
+
style: styles.lineContent
|
|
63
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
64
|
+
style: styles.lineText
|
|
65
|
+
}, children), onPress && open !== undefined ? /*#__PURE__*/ React.createElement(Chevron, {
|
|
66
|
+
colors: colors,
|
|
67
|
+
Icon: Icon,
|
|
68
|
+
open: open
|
|
69
|
+
}) : null);
|
|
70
|
+
return /*#__PURE__*/ React.createElement(RailRow, {
|
|
71
|
+
colors: colors,
|
|
72
|
+
first: first,
|
|
73
|
+
last: last,
|
|
74
|
+
marker: /*#__PURE__*/ React.createElement(RailIcon, {
|
|
75
|
+
color: getToneColor({
|
|
76
|
+
tone,
|
|
77
|
+
colors,
|
|
78
|
+
tokens
|
|
79
|
+
}),
|
|
80
|
+
colors: colors,
|
|
81
|
+
Icon: Icon,
|
|
82
|
+
name: icon
|
|
83
|
+
}),
|
|
84
|
+
markerTop: LINE_MARKER_TOP
|
|
85
|
+
}, onPress ? /*#__PURE__*/ React.createElement(Pressable, {
|
|
86
|
+
accessibilityRole: "button",
|
|
87
|
+
accessibilityState: open === undefined && expanded === undefined ? undefined : {
|
|
88
|
+
expanded: open ?? expanded
|
|
89
|
+
},
|
|
90
|
+
onPress: onPress,
|
|
91
|
+
style: ({ pressed })=>[
|
|
92
|
+
styles.pressable,
|
|
93
|
+
pressed ? {
|
|
94
|
+
backgroundColor: colors.fill
|
|
95
|
+
} : null
|
|
96
|
+
]
|
|
97
|
+
}, content) : content);
|
|
98
|
+
}
|
|
99
|
+
// A long event sentence shows two lines and a note three, each ending in an ellipsis, until the
|
|
100
|
+
// line is tapped open. Comment bodies always show in full.
|
|
101
|
+
const EVENT_LINES = 2;
|
|
102
|
+
const NOTE_LINES = 3;
|
|
103
|
+
function Note({ colors, expanded, text }) {
|
|
104
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
105
|
+
style: [
|
|
106
|
+
styles.note,
|
|
107
|
+
{
|
|
108
|
+
backgroundColor: colors.fill
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
112
|
+
ellipsizeMode: "tail",
|
|
113
|
+
numberOfLines: expanded ? undefined : NOTE_LINES,
|
|
114
|
+
style: [
|
|
115
|
+
styles.noteText,
|
|
116
|
+
{
|
|
117
|
+
color: colors.secondary
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}, text));
|
|
121
|
+
}
|
|
122
|
+
// One event on the rail, its sentence and note cut short until it is tapped, and full after.
|
|
123
|
+
function EventLine({ colors, ctx, event, expanded, first, hideActor, last, onToggle, time }) {
|
|
124
|
+
return /*#__PURE__*/ React.createElement(LineRow, {
|
|
125
|
+
ctx: ctx,
|
|
126
|
+
expanded: expanded,
|
|
127
|
+
first: first,
|
|
128
|
+
icon: event.line.icon,
|
|
129
|
+
last: last,
|
|
130
|
+
onPress: onToggle,
|
|
131
|
+
tone: event.line.tone
|
|
132
|
+
}, /*#__PURE__*/ React.createElement(LineText, {
|
|
133
|
+
colors: colors,
|
|
134
|
+
hideActor: hideActor,
|
|
135
|
+
numberOfLines: expanded ? undefined : EVENT_LINES,
|
|
136
|
+
segments: event.line.segments,
|
|
137
|
+
time: time
|
|
138
|
+
}), event.line.note ? /*#__PURE__*/ React.createElement(Note, {
|
|
139
|
+
colors: colors,
|
|
140
|
+
expanded: expanded,
|
|
141
|
+
text: event.line.note
|
|
142
|
+
}) : null);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A record's activity as a timeline on a thin rail, as GitHub's iOS app draws an issue's: events
|
|
146
|
+
* on their own lines with an icon, the actor and a relative time; detail events by one actor in
|
|
147
|
+
* a row folded into one line that opens; gaps of events not loaded as a count to load; comment
|
|
148
|
+
* threads as cards with avatars, markdown, mentions, reactions and a menu; resolved threads
|
|
149
|
+
* folded to one line. Data comes in through properties and every action goes out as an event.
|
|
150
|
+
*/ function ActivityTimeline({ blockId, components, events, methods, properties, styles: blockStyles = {} }) {
|
|
151
|
+
const { isDark, tokens } = useComponentTokens(properties.theme);
|
|
152
|
+
const colors = useMemo(()=>getTimelineColors({
|
|
153
|
+
isDark,
|
|
154
|
+
tokens
|
|
155
|
+
}), [
|
|
156
|
+
isDark,
|
|
157
|
+
tokens
|
|
158
|
+
]);
|
|
159
|
+
const now = useNow();
|
|
160
|
+
const [open, setOpen] = useState(()=>new Set());
|
|
161
|
+
const [busy, setBusy] = useState(()=>new Set());
|
|
162
|
+
const mentionFormat = type.isString(properties.mentionFormat) ? properties.mentionFormat : DEFAULT_MENTION_FORMAT;
|
|
163
|
+
const pattern = useMemo(()=>createMentionPattern(mentionFormat), [
|
|
164
|
+
mentionFormat
|
|
165
|
+
]);
|
|
166
|
+
const people = useMemo(()=>new Map((properties.mentions ?? []).map((person)=>[
|
|
167
|
+
String(person.value),
|
|
168
|
+
person
|
|
169
|
+
])), [
|
|
170
|
+
properties.mentions
|
|
171
|
+
]);
|
|
172
|
+
const hasLinkPress = !type.isNone(events.onLinkPress);
|
|
173
|
+
const trigger = useCallback((name, event)=>methods.triggerEvent({
|
|
174
|
+
name,
|
|
175
|
+
event
|
|
176
|
+
}), [
|
|
177
|
+
methods
|
|
178
|
+
]);
|
|
179
|
+
// An app path in a comment opens as a page through the Link action, as the Markdown block's do.
|
|
180
|
+
useEffect(()=>{
|
|
181
|
+
methods.registerEvent({
|
|
182
|
+
name: '__link',
|
|
183
|
+
actions: [
|
|
184
|
+
{
|
|
185
|
+
id: 'link',
|
|
186
|
+
type: 'Link',
|
|
187
|
+
params: {
|
|
188
|
+
url: {
|
|
189
|
+
_event: 'href'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
});
|
|
195
|
+
}, [
|
|
196
|
+
methods
|
|
197
|
+
]);
|
|
198
|
+
const ctx = useMemo(()=>({
|
|
199
|
+
colors,
|
|
200
|
+
hasLinkPress,
|
|
201
|
+
Icon: components.Icon,
|
|
202
|
+
isDark,
|
|
203
|
+
linkChips: properties.linkChips,
|
|
204
|
+
maxLength: properties.maxLength ?? 4000,
|
|
205
|
+
members: properties.members,
|
|
206
|
+
mentionFormat,
|
|
207
|
+
mentions: properties.mentions,
|
|
208
|
+
now,
|
|
209
|
+
onLinkPress: (href)=>{
|
|
210
|
+
if (hasLinkPress) {
|
|
211
|
+
trigger('onLinkPress', {
|
|
212
|
+
href
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (appPathPattern.test(href)) {
|
|
217
|
+
trigger('__link', {
|
|
218
|
+
href
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
Linking.openURL(components.resolveUrl(href)).catch(()=>{});
|
|
223
|
+
},
|
|
224
|
+
onRecordPress: (key)=>trigger('onOpenRecord', {
|
|
225
|
+
key
|
|
226
|
+
}),
|
|
227
|
+
pattern,
|
|
228
|
+
people,
|
|
229
|
+
reactions: properties.reactions ?? REACTIONS,
|
|
230
|
+
repliesShown: properties.repliesShown ?? 3,
|
|
231
|
+
resolveUrl: components.resolveUrl,
|
|
232
|
+
imageSource: components.imageSource,
|
|
233
|
+
tokens,
|
|
234
|
+
trigger,
|
|
235
|
+
user: properties.user
|
|
236
|
+
}), [
|
|
237
|
+
colors,
|
|
238
|
+
components.Icon,
|
|
239
|
+
components.imageSource,
|
|
240
|
+
components.resolveUrl,
|
|
241
|
+
hasLinkPress,
|
|
242
|
+
isDark,
|
|
243
|
+
mentionFormat,
|
|
244
|
+
now,
|
|
245
|
+
pattern,
|
|
246
|
+
people,
|
|
247
|
+
properties,
|
|
248
|
+
tokens,
|
|
249
|
+
trigger
|
|
250
|
+
]);
|
|
251
|
+
const rows = useMemo(()=>buildTimelineRows({
|
|
252
|
+
entries: properties.entries,
|
|
253
|
+
gaps: properties.gaps,
|
|
254
|
+
earlier: properties.earlier,
|
|
255
|
+
foldDetail: properties.foldDetail !== false,
|
|
256
|
+
formatEvent: properties.formatEvent,
|
|
257
|
+
members: properties.members
|
|
258
|
+
}), [
|
|
259
|
+
properties.entries,
|
|
260
|
+
properties.gaps,
|
|
261
|
+
properties.earlier,
|
|
262
|
+
properties.foldDetail,
|
|
263
|
+
properties.formatEvent,
|
|
264
|
+
properties.members
|
|
265
|
+
]);
|
|
266
|
+
const toggle = (id)=>{
|
|
267
|
+
setOpen((current)=>{
|
|
268
|
+
const next = new Set(current);
|
|
269
|
+
if (next.has(id)) next.delete(id);
|
|
270
|
+
else next.add(id);
|
|
271
|
+
return next;
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
const runBusy = async (id, name, event)=>{
|
|
275
|
+
if (busy.has(id)) return;
|
|
276
|
+
setBusy((current)=>new Set([
|
|
277
|
+
...current,
|
|
278
|
+
id
|
|
279
|
+
]));
|
|
280
|
+
try {
|
|
281
|
+
await trigger(name, event);
|
|
282
|
+
} finally{
|
|
283
|
+
setBusy((current)=>{
|
|
284
|
+
const next = new Set(current);
|
|
285
|
+
next.delete(id);
|
|
286
|
+
return next;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
if (rows.length === 0) {
|
|
291
|
+
if (!type.isString(properties.emptyText)) return null;
|
|
292
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
293
|
+
style: [
|
|
294
|
+
styles.empty,
|
|
295
|
+
blockStyles.element
|
|
296
|
+
]
|
|
297
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
298
|
+
style: [
|
|
299
|
+
styles.emptyText,
|
|
300
|
+
{
|
|
301
|
+
color: colors.secondary
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
}, properties.emptyText));
|
|
305
|
+
}
|
|
306
|
+
const time = (at)=>formatRelativeTime({
|
|
307
|
+
at,
|
|
308
|
+
now
|
|
309
|
+
});
|
|
310
|
+
const linkText = (text)=>/*#__PURE__*/ React.createElement(Text, {
|
|
311
|
+
style: {
|
|
312
|
+
color: colors.tint,
|
|
313
|
+
fontWeight: '500'
|
|
314
|
+
}
|
|
315
|
+
}, text);
|
|
316
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
317
|
+
accessibilityLabel: "Activity",
|
|
318
|
+
style: blockStyles.element,
|
|
319
|
+
testID: blockId
|
|
320
|
+
}, rows.map((row, index)=>{
|
|
321
|
+
const first = index === 0;
|
|
322
|
+
const last = index === rows.length - 1;
|
|
323
|
+
switch(row.type){
|
|
324
|
+
case 'earlier':
|
|
325
|
+
return /*#__PURE__*/ React.createElement(LineRow, {
|
|
326
|
+
first: first,
|
|
327
|
+
last: last,
|
|
328
|
+
ctx: ctx,
|
|
329
|
+
icon: "Ellipsis",
|
|
330
|
+
key: row.id,
|
|
331
|
+
onPress: ()=>runBusy(row.id, 'onShowEarlier', {
|
|
332
|
+
before: row.before ?? null
|
|
333
|
+
}),
|
|
334
|
+
tone: "primary"
|
|
335
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
336
|
+
style: styles.lineFont
|
|
337
|
+
}, busy.has(row.id) ? /*#__PURE__*/ React.createElement(Text, {
|
|
338
|
+
style: {
|
|
339
|
+
color: colors.tertiary
|
|
340
|
+
}
|
|
341
|
+
}, "Loading…") : linkText('Show earlier activity')));
|
|
342
|
+
case 'gap':
|
|
343
|
+
return /*#__PURE__*/ React.createElement(LineRow, {
|
|
344
|
+
first: first,
|
|
345
|
+
last: last,
|
|
346
|
+
ctx: ctx,
|
|
347
|
+
icon: "Ellipsis",
|
|
348
|
+
key: row.id,
|
|
349
|
+
onPress: ()=>runBusy(row.id, 'onExpandGap', {
|
|
350
|
+
after: row.gap.after ?? null,
|
|
351
|
+
before: row.gap.before ?? null,
|
|
352
|
+
count: row.gap.count,
|
|
353
|
+
id: row.gap.id ?? null
|
|
354
|
+
}),
|
|
355
|
+
tone: "primary"
|
|
356
|
+
}, busy.has(row.id) ? /*#__PURE__*/ React.createElement(Text, {
|
|
357
|
+
style: [
|
|
358
|
+
styles.lineFont,
|
|
359
|
+
{
|
|
360
|
+
color: colors.tertiary
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}, "Loading…") : /*#__PURE__*/ React.createElement(LineText, {
|
|
364
|
+
colors: {
|
|
365
|
+
...colors,
|
|
366
|
+
label: colors.tint,
|
|
367
|
+
secondary: colors.tint
|
|
368
|
+
},
|
|
369
|
+
segments: row.segments
|
|
370
|
+
}));
|
|
371
|
+
case 'event':
|
|
372
|
+
return /*#__PURE__*/ React.createElement(EventLine, {
|
|
373
|
+
colors: colors,
|
|
374
|
+
ctx: ctx,
|
|
375
|
+
event: row,
|
|
376
|
+
expanded: open.has(`full:${row.id}`),
|
|
377
|
+
first: first,
|
|
378
|
+
key: row.id,
|
|
379
|
+
last: last,
|
|
380
|
+
onToggle: ()=>toggle(`full:${row.id}`),
|
|
381
|
+
time: time(row.entry.at)
|
|
382
|
+
});
|
|
383
|
+
case 'group':
|
|
384
|
+
{
|
|
385
|
+
const isOpen = open.has(row.id);
|
|
386
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
387
|
+
key: row.id
|
|
388
|
+
}, /*#__PURE__*/ React.createElement(LineRow, {
|
|
389
|
+
first: first,
|
|
390
|
+
last: last && !isOpen,
|
|
391
|
+
ctx: ctx,
|
|
392
|
+
icon: row.line.icon,
|
|
393
|
+
onPress: ()=>toggle(row.id),
|
|
394
|
+
open: isOpen,
|
|
395
|
+
tone: row.line.tone
|
|
396
|
+
}, /*#__PURE__*/ React.createElement(LineText, {
|
|
397
|
+
colors: colors,
|
|
398
|
+
segments: row.line.segments,
|
|
399
|
+
time: time(row.at)
|
|
400
|
+
})), isOpen ? row.events.map((event, eventIndex)=>/*#__PURE__*/ React.createElement(EventLine, {
|
|
401
|
+
colors: colors,
|
|
402
|
+
ctx: ctx,
|
|
403
|
+
event: event,
|
|
404
|
+
expanded: open.has(`full:${event.id}`),
|
|
405
|
+
first: false,
|
|
406
|
+
hideActor: true,
|
|
407
|
+
key: event.id,
|
|
408
|
+
last: last && eventIndex === row.events.length - 1,
|
|
409
|
+
onToggle: ()=>toggle(`full:${event.id}`),
|
|
410
|
+
time: time(event.entry.at)
|
|
411
|
+
})) : null);
|
|
412
|
+
}
|
|
413
|
+
case 'resolved':
|
|
414
|
+
{
|
|
415
|
+
const isOpen = open.has(row.id);
|
|
416
|
+
const resolver = getActor({
|
|
417
|
+
by: row.thread.resolved?.by,
|
|
418
|
+
members: properties.members
|
|
419
|
+
});
|
|
420
|
+
const count = row.thread.reply_count ?? (row.thread.replies ?? []).length;
|
|
421
|
+
const segments = [
|
|
422
|
+
{
|
|
423
|
+
kind: 'text',
|
|
424
|
+
text: 'Thread resolved by '
|
|
425
|
+
},
|
|
426
|
+
resolver
|
|
427
|
+
];
|
|
428
|
+
if (count > 0) {
|
|
429
|
+
segments.push({
|
|
430
|
+
kind: 'text',
|
|
431
|
+
text: ` · ${count === 1 ? '1 reply' : `${count} replies`}`
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
435
|
+
key: row.id
|
|
436
|
+
}, /*#__PURE__*/ React.createElement(LineRow, {
|
|
437
|
+
first: first,
|
|
438
|
+
last: last && !isOpen,
|
|
439
|
+
ctx: ctx,
|
|
440
|
+
icon: "CircleCheck",
|
|
441
|
+
onPress: ()=>toggle(row.id),
|
|
442
|
+
open: isOpen,
|
|
443
|
+
tone: "success"
|
|
444
|
+
}, /*#__PURE__*/ React.createElement(LineText, {
|
|
445
|
+
colors: colors,
|
|
446
|
+
segments: segments,
|
|
447
|
+
time: time(row.thread.resolved?.at)
|
|
448
|
+
})), isOpen ? /*#__PURE__*/ React.createElement(ThreadCard, {
|
|
449
|
+
ctx: ctx,
|
|
450
|
+
first: false,
|
|
451
|
+
last: last,
|
|
452
|
+
thread: row.thread
|
|
453
|
+
}) : null);
|
|
454
|
+
}
|
|
455
|
+
default:
|
|
456
|
+
return /*#__PURE__*/ React.createElement(ThreadCard, {
|
|
457
|
+
first: first,
|
|
458
|
+
last: last,
|
|
459
|
+
ctx: ctx,
|
|
460
|
+
key: row.id,
|
|
461
|
+
thread: row.thread
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}));
|
|
465
|
+
}
|
|
466
|
+
const styles = StyleSheet.create({
|
|
467
|
+
pressable: {
|
|
468
|
+
borderRadius: 8,
|
|
469
|
+
marginHorizontal: -6,
|
|
470
|
+
paddingHorizontal: 6
|
|
471
|
+
},
|
|
472
|
+
lineContent: {
|
|
473
|
+
alignItems: 'flex-start',
|
|
474
|
+
flexDirection: 'row',
|
|
475
|
+
gap: 6,
|
|
476
|
+
paddingVertical: 8
|
|
477
|
+
},
|
|
478
|
+
lineText: {
|
|
479
|
+
flexBasis: 0,
|
|
480
|
+
flexGrow: 1,
|
|
481
|
+
flexShrink: 1,
|
|
482
|
+
minWidth: 0
|
|
483
|
+
},
|
|
484
|
+
lineFont: {
|
|
485
|
+
fontSize: 15,
|
|
486
|
+
lineHeight: 20
|
|
487
|
+
},
|
|
488
|
+
note: {
|
|
489
|
+
borderRadius: 8,
|
|
490
|
+
marginTop: 6,
|
|
491
|
+
paddingHorizontal: 10,
|
|
492
|
+
paddingVertical: 7
|
|
493
|
+
},
|
|
494
|
+
noteText: {
|
|
495
|
+
fontSize: 14,
|
|
496
|
+
lineHeight: 19
|
|
497
|
+
},
|
|
498
|
+
empty: {
|
|
499
|
+
alignItems: 'center',
|
|
500
|
+
paddingVertical: 24
|
|
501
|
+
},
|
|
502
|
+
emptyText: {
|
|
503
|
+
fontSize: 15
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
ActivityTimeline.meta = meta;
|
|
507
|
+
export default ActivityTimeline;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React, { useMemo, useState } from 'react';
|
|
16
|
+
import { Dimensions, Platform, View } from 'react-native';
|
|
17
|
+
import { useMarkdown } from 'react-native-marked';
|
|
18
|
+
import ChipWidthContext from '../Markdown/ChipWidthContext.js';
|
|
19
|
+
import getMarkdownStyles from '../Markdown/getMarkdownStyles.js';
|
|
20
|
+
import MarkdownTokenizer from '../Markdown/MarkdownTokenizer.js';
|
|
21
|
+
import TimelineMarkdownRenderer from './TimelineMarkdownRenderer.js';
|
|
22
|
+
import toTimelineMarkdown from './toTimelineMarkdown.js';
|
|
23
|
+
const BODY_SIZE = 15;
|
|
24
|
+
const BODY_LINE = 21;
|
|
25
|
+
const PARAGRAPH_GAP = 8;
|
|
26
|
+
const monospace = Platform.select({
|
|
27
|
+
ios: 'Menlo',
|
|
28
|
+
default: 'monospace'
|
|
29
|
+
});
|
|
30
|
+
// The Markdown block's styles at the comment body size, in the label colours, with paragraphs
|
|
31
|
+
// spaced for a card rather than a page.
|
|
32
|
+
function getBodyStyles({ colors, isDark, tokens }) {
|
|
33
|
+
const { palette, styles, theme } = getMarkdownStyles({
|
|
34
|
+
blockSpace: PARAGRAPH_GAP,
|
|
35
|
+
isDark,
|
|
36
|
+
tokens: {
|
|
37
|
+
...tokens,
|
|
38
|
+
colorText: colors.label,
|
|
39
|
+
colorTextHeading: colors.label,
|
|
40
|
+
fontSize: BODY_SIZE,
|
|
41
|
+
fontSizeHeading1: 20,
|
|
42
|
+
fontSizeHeading2: 18,
|
|
43
|
+
fontSizeHeading3: 17,
|
|
44
|
+
fontSizeHeading4: 16,
|
|
45
|
+
fontSizeHeading5: 15,
|
|
46
|
+
lineHeight: BODY_LINE / BODY_SIZE,
|
|
47
|
+
lineHeightHeading1: 1.3,
|
|
48
|
+
lineHeightHeading2: 1.3,
|
|
49
|
+
lineHeightHeading3: 1.3,
|
|
50
|
+
lineHeightHeading4: 1.3,
|
|
51
|
+
lineHeightHeading5: 1.3
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
palette: {
|
|
56
|
+
...palette,
|
|
57
|
+
codeBackground: colors.fill,
|
|
58
|
+
label: colors.label,
|
|
59
|
+
separator: colors.separator,
|
|
60
|
+
tint: colors.tint
|
|
61
|
+
},
|
|
62
|
+
theme: {
|
|
63
|
+
...theme,
|
|
64
|
+
colors: {
|
|
65
|
+
...theme.colors,
|
|
66
|
+
link: colors.tint,
|
|
67
|
+
text: colors.label
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
styles: {
|
|
71
|
+
...styles,
|
|
72
|
+
paragraph: {
|
|
73
|
+
...styles.paragraph,
|
|
74
|
+
marginBottom: PARAGRAPH_GAP
|
|
75
|
+
},
|
|
76
|
+
code: {
|
|
77
|
+
...styles.code,
|
|
78
|
+
backgroundColor: colors.fill,
|
|
79
|
+
marginBottom: PARAGRAPH_GAP
|
|
80
|
+
},
|
|
81
|
+
codespan: {
|
|
82
|
+
...styles.codespan,
|
|
83
|
+
backgroundColor: colors.fill
|
|
84
|
+
},
|
|
85
|
+
blockquote: {
|
|
86
|
+
...styles.blockquote,
|
|
87
|
+
marginBottom: PARAGRAPH_GAP
|
|
88
|
+
},
|
|
89
|
+
link: {
|
|
90
|
+
...styles.link,
|
|
91
|
+
color: colors.tint
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A comment's markdown, drawn with the Markdown block's renderer: mentions as @Name chips,
|
|
98
|
+
* `[[KEY]]` record links in the tint, and links that match a `linkChips` entry as the Markdown
|
|
99
|
+
* block's link chips, pressable when the timeline has onLinkPress. The space under the last paragraph is
|
|
100
|
+
* taken back, so the card's padding holds.
|
|
101
|
+
*/ function CommentBody({ body, colors, hasLinkPress, Icon, isDark, linkChips, mentions, onLinkPress, onRecordPress, pattern, imageSource, people, tokens }) {
|
|
102
|
+
const { palette, styles, theme } = useMemo(()=>getBodyStyles({
|
|
103
|
+
colors,
|
|
104
|
+
isDark,
|
|
105
|
+
tokens
|
|
106
|
+
}), [
|
|
107
|
+
colors,
|
|
108
|
+
isDark,
|
|
109
|
+
tokens
|
|
110
|
+
]);
|
|
111
|
+
const [width, setWidth] = useState(()=>Dimensions.get('window').width - 64);
|
|
112
|
+
const tokenizer = useMemo(()=>new MarkdownTokenizer(), []);
|
|
113
|
+
const renderer = useMemo(()=>new TimelineMarkdownRenderer({
|
|
114
|
+
chipStyles: {
|
|
115
|
+
mention: {
|
|
116
|
+
backgroundColor: colors.tintFill,
|
|
117
|
+
color: colors.tint,
|
|
118
|
+
fontWeight: '600'
|
|
119
|
+
},
|
|
120
|
+
muted: {
|
|
121
|
+
backgroundColor: colors.fill,
|
|
122
|
+
color: colors.secondary,
|
|
123
|
+
fontWeight: '600'
|
|
124
|
+
},
|
|
125
|
+
record: {
|
|
126
|
+
color: colors.tint,
|
|
127
|
+
fontFamily: monospace,
|
|
128
|
+
fontSize: BODY_SIZE - 1
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
Icon,
|
|
132
|
+
linkChips,
|
|
133
|
+
onChipPress: hasLinkPress ? onLinkPress : null,
|
|
134
|
+
onLinkPress,
|
|
135
|
+
onRecordPress,
|
|
136
|
+
imageSource,
|
|
137
|
+
palette,
|
|
138
|
+
skipHtml: false
|
|
139
|
+
}), [
|
|
140
|
+
colors,
|
|
141
|
+
hasLinkPress,
|
|
142
|
+
Icon,
|
|
143
|
+
imageSource,
|
|
144
|
+
linkChips,
|
|
145
|
+
onLinkPress,
|
|
146
|
+
onRecordPress,
|
|
147
|
+
palette
|
|
148
|
+
]);
|
|
149
|
+
const markdown = useMemo(()=>toTimelineMarkdown({
|
|
150
|
+
body,
|
|
151
|
+
mentions,
|
|
152
|
+
people,
|
|
153
|
+
pattern
|
|
154
|
+
}), [
|
|
155
|
+
body,
|
|
156
|
+
mentions,
|
|
157
|
+
people,
|
|
158
|
+
pattern
|
|
159
|
+
]);
|
|
160
|
+
const elements = useMarkdown(markdown, {
|
|
161
|
+
colorScheme: isDark ? 'dark' : 'light',
|
|
162
|
+
renderer,
|
|
163
|
+
styles,
|
|
164
|
+
theme,
|
|
165
|
+
tokenizer
|
|
166
|
+
});
|
|
167
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
168
|
+
onLayout: (event)=>setWidth(event.nativeEvent.layout.width),
|
|
169
|
+
style: {
|
|
170
|
+
marginBottom: -PARAGRAPH_GAP
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/ React.createElement(ChipWidthContext.Provider, {
|
|
173
|
+
value: width
|
|
174
|
+
}, elements));
|
|
175
|
+
}
|
|
176
|
+
export default CommentBody;
|