@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,131 @@
|
|
|
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, { useEffect, useRef } from 'react';
|
|
16
|
+
import { Animated, Easing, View } from 'react-native';
|
|
17
|
+
import { resolveColor, useTheme } from '@lowdefy/client-native';
|
|
18
|
+
import meta from './meta.js';
|
|
19
|
+
// iOS's page control: 7pt dots, 9pt apart, the other pages' dots faint.
|
|
20
|
+
const DOT = 7;
|
|
21
|
+
const GAP = 9;
|
|
22
|
+
const STEP = DOT + GAP;
|
|
23
|
+
const INACTIVE_OPACITY = 0.3;
|
|
24
|
+
const PADDING = 4;
|
|
25
|
+
// The active dot slides to its page on a spring, stretching across as it leaves and settling
|
|
26
|
+
// round as it lands. Both run on the native driver.
|
|
27
|
+
function useActiveDotMotion(index) {
|
|
28
|
+
const position = useRef(new Animated.Value(index * STEP)).current;
|
|
29
|
+
const stretch = useRef(new Animated.Value(1)).current;
|
|
30
|
+
const shown = useRef(index);
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
if (shown.current === index) return;
|
|
33
|
+
shown.current = index;
|
|
34
|
+
Animated.parallel([
|
|
35
|
+
Animated.spring(position, {
|
|
36
|
+
bounciness: 6,
|
|
37
|
+
speed: 14,
|
|
38
|
+
toValue: index * STEP,
|
|
39
|
+
useNativeDriver: true
|
|
40
|
+
}),
|
|
41
|
+
Animated.sequence([
|
|
42
|
+
Animated.timing(stretch, {
|
|
43
|
+
duration: 90,
|
|
44
|
+
easing: Easing.out(Easing.quad),
|
|
45
|
+
toValue: 1.7,
|
|
46
|
+
useNativeDriver: true
|
|
47
|
+
}),
|
|
48
|
+
Animated.spring(stretch, {
|
|
49
|
+
bounciness: 8,
|
|
50
|
+
speed: 16,
|
|
51
|
+
toValue: 1,
|
|
52
|
+
useNativeDriver: true
|
|
53
|
+
})
|
|
54
|
+
])
|
|
55
|
+
]).start();
|
|
56
|
+
}, [
|
|
57
|
+
index,
|
|
58
|
+
position,
|
|
59
|
+
stretch
|
|
60
|
+
]);
|
|
61
|
+
return {
|
|
62
|
+
position,
|
|
63
|
+
stretch
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A row of page dots, as iOS's page control: where the page shown is among `count`, such as a
|
|
68
|
+
* record among recents swiped through. The active dot is drawn in `color` and slides to its
|
|
69
|
+
* page when `index` changes; the others are drawn in it at 30%.
|
|
70
|
+
*/ function PageDots({ blockId, properties, styles = {} }) {
|
|
71
|
+
const { tokens } = useTheme();
|
|
72
|
+
const count = properties.count ?? 0;
|
|
73
|
+
const index = Math.min(Math.max(properties.index ?? 0, 0), Math.max(count - 1, 0));
|
|
74
|
+
const color = resolveColor({
|
|
75
|
+
color: properties.color ?? 'colorLabel',
|
|
76
|
+
tokens
|
|
77
|
+
});
|
|
78
|
+
const motion = useActiveDotMotion(index);
|
|
79
|
+
if (count === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const dot = {
|
|
83
|
+
backgroundColor: color,
|
|
84
|
+
borderRadius: DOT / 2,
|
|
85
|
+
height: DOT,
|
|
86
|
+
width: DOT
|
|
87
|
+
};
|
|
88
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
89
|
+
accessible: true,
|
|
90
|
+
accessibilityLabel: `Page ${index + 1} of ${count}`,
|
|
91
|
+
style: [
|
|
92
|
+
{
|
|
93
|
+
alignSelf: 'center',
|
|
94
|
+
columnGap: GAP,
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
paddingVertical: PADDING
|
|
97
|
+
},
|
|
98
|
+
styles.element
|
|
99
|
+
]
|
|
100
|
+
}, Array.from({
|
|
101
|
+
length: count
|
|
102
|
+
}, (_, page)=>/*#__PURE__*/ React.createElement(View, {
|
|
103
|
+
key: page,
|
|
104
|
+
style: [
|
|
105
|
+
dot,
|
|
106
|
+
{
|
|
107
|
+
opacity: INACTIVE_OPACITY
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
})), /*#__PURE__*/ React.createElement(Animated.View, {
|
|
111
|
+
style: [
|
|
112
|
+
dot,
|
|
113
|
+
{
|
|
114
|
+
left: 0,
|
|
115
|
+
position: 'absolute',
|
|
116
|
+
top: PADDING,
|
|
117
|
+
transform: [
|
|
118
|
+
{
|
|
119
|
+
translateX: motion.position
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
scaleX: motion.stretch
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
testID: `${blockId}_active`
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
PageDots.meta = meta;
|
|
131
|
+
export default PageDots;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
*/ // A mobile-only block: iOS page control dots.
|
|
16
|
+
export default {
|
|
17
|
+
category: 'display',
|
|
18
|
+
icons: [],
|
|
19
|
+
valueType: null,
|
|
20
|
+
cssKeys: {
|
|
21
|
+
element: 'The row of dots.'
|
|
22
|
+
},
|
|
23
|
+
events: {},
|
|
24
|
+
properties: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
required: [
|
|
28
|
+
'count'
|
|
29
|
+
],
|
|
30
|
+
properties: {
|
|
31
|
+
count: {
|
|
32
|
+
type: 'integer',
|
|
33
|
+
minimum: 0,
|
|
34
|
+
description: 'The number of pages, one dot each. No dots are drawn for 0.'
|
|
35
|
+
},
|
|
36
|
+
index: {
|
|
37
|
+
type: 'integer',
|
|
38
|
+
minimum: 0,
|
|
39
|
+
default: 0,
|
|
40
|
+
description: 'The page shown, from 0. Its dot is drawn in full colour, and slides to its place when the index changes.'
|
|
41
|
+
},
|
|
42
|
+
color: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'The colour of the dots: a palette hue (`blue`), a theme token (`colorPrimary`) or a hex colour. The active dot takes it in full, the others at 30%. Defaults to the label colour.'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 from 'react';
|
|
16
|
+
import getIosTextStyle from '../../typography/getIosTextStyle.js';
|
|
17
|
+
import getTextStyle from '../../typography/getTextStyle.js';
|
|
18
|
+
import meta from './meta.js';
|
|
19
|
+
import TypographyText from '../../typography/TypographyText.js';
|
|
20
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
21
|
+
// A paragraph in the iOS body style (or its own textStyle) and label colour. It has no outer
|
|
22
|
+
// margin: on a phone the layout's gap spaces blocks, as UIKit stacks do.
|
|
23
|
+
function Paragraph({ blockId, methods, properties, styles = {} }) {
|
|
24
|
+
const { tokens } = useComponentTokens(properties.theme);
|
|
25
|
+
const textStyle = getIosTextStyle({
|
|
26
|
+
textStyle: properties.textStyle ?? 'body',
|
|
27
|
+
tokens
|
|
28
|
+
});
|
|
29
|
+
const baseStyle = textStyle;
|
|
30
|
+
return /*#__PURE__*/ React.createElement(TypographyText, {
|
|
31
|
+
blockId: blockId,
|
|
32
|
+
linkStyle: [
|
|
33
|
+
{
|
|
34
|
+
...textStyle,
|
|
35
|
+
color: tokens.colorTint
|
|
36
|
+
},
|
|
37
|
+
styles.actions
|
|
38
|
+
],
|
|
39
|
+
methods: methods,
|
|
40
|
+
properties: properties,
|
|
41
|
+
style: [
|
|
42
|
+
getTextStyle({
|
|
43
|
+
baseStyle,
|
|
44
|
+
properties,
|
|
45
|
+
tokens
|
|
46
|
+
}),
|
|
47
|
+
styles.element
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
Paragraph.meta = meta;
|
|
52
|
+
export default Paragraph;
|
|
@@ -0,0 +1,295 @@
|
|
|
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 textStyle from '../../schemas/textStyle.js';
|
|
16
|
+
export default {
|
|
17
|
+
category: 'display',
|
|
18
|
+
icons: [],
|
|
19
|
+
valueType: null,
|
|
20
|
+
cssKeys: {
|
|
21
|
+
element: 'The Paragraph element.',
|
|
22
|
+
copyableIcon: 'The copyable icon in the Paragraph. Not drawn on mobile.',
|
|
23
|
+
actions: 'The expand button next to the text.'
|
|
24
|
+
},
|
|
25
|
+
events: {
|
|
26
|
+
onExpand: {
|
|
27
|
+
description: 'Trigger action when the ellipsis expand or collapse button is clicked.',
|
|
28
|
+
event: {
|
|
29
|
+
expanded: 'True when the text was expanded, false when it was collapsed.'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onCopy: 'Trigger action when copy text is clicked. Never fires on mobile.',
|
|
33
|
+
onTextSelection: 'Trigger action when text is selected and pass selected text to the event object. Never fires on mobile.'
|
|
34
|
+
},
|
|
35
|
+
properties: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
properties: {
|
|
39
|
+
actions: {
|
|
40
|
+
nativeIgnored: true,
|
|
41
|
+
type: 'object',
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
description: 'Configure the bar of action buttons, such as copy and expand. Ignored on mobile.',
|
|
44
|
+
properties: {
|
|
45
|
+
placement: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
enum: [
|
|
48
|
+
'start',
|
|
49
|
+
'end'
|
|
50
|
+
],
|
|
51
|
+
default: 'end',
|
|
52
|
+
description: 'Place the action buttons before or after the text.'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
code: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
description: 'Apply code style.'
|
|
60
|
+
},
|
|
61
|
+
content: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'Paragraph text content - supports html. On mobile, tags are removed and the text is shown plain.',
|
|
64
|
+
docs: {
|
|
65
|
+
displayType: 'text-area'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
copyable: {
|
|
69
|
+
nativeIgnored: true,
|
|
70
|
+
description: 'Provide copy text button. Ignored on mobile.',
|
|
71
|
+
default: false,
|
|
72
|
+
oneOf: [
|
|
73
|
+
{
|
|
74
|
+
type: 'boolean'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'object',
|
|
78
|
+
additionalProperties: false,
|
|
79
|
+
properties: {
|
|
80
|
+
text: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'Paragraph text to copy when clicked.'
|
|
83
|
+
},
|
|
84
|
+
icon: {
|
|
85
|
+
type: [
|
|
86
|
+
'string',
|
|
87
|
+
'object',
|
|
88
|
+
'array'
|
|
89
|
+
],
|
|
90
|
+
description: 'Copy icon, can be an array or two icons for before and after clicked.',
|
|
91
|
+
docs: {
|
|
92
|
+
displayType: 'icon'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
tooltips: {
|
|
96
|
+
type: [
|
|
97
|
+
'string',
|
|
98
|
+
'array'
|
|
99
|
+
],
|
|
100
|
+
description: 'Tooltip text, can be an array or two strings for before and after clicked.',
|
|
101
|
+
docs: {
|
|
102
|
+
displayType: 'string'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
delete: {
|
|
110
|
+
type: 'boolean',
|
|
111
|
+
default: false,
|
|
112
|
+
description: 'Apply deleted (strikethrough) style.'
|
|
113
|
+
},
|
|
114
|
+
disabled: {
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
default: false,
|
|
117
|
+
description: 'Apply disabled style.'
|
|
118
|
+
},
|
|
119
|
+
ellipsis: {
|
|
120
|
+
default: false,
|
|
121
|
+
oneOf: [
|
|
122
|
+
{
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
description: 'Display ellipsis when text overflows a single line.'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'object',
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
properties: {
|
|
130
|
+
rows: {
|
|
131
|
+
type: 'number',
|
|
132
|
+
description: 'Max rows of content.'
|
|
133
|
+
},
|
|
134
|
+
expandable: {
|
|
135
|
+
type: [
|
|
136
|
+
'boolean',
|
|
137
|
+
'string'
|
|
138
|
+
],
|
|
139
|
+
enum: [
|
|
140
|
+
true,
|
|
141
|
+
false,
|
|
142
|
+
'collapsible'
|
|
143
|
+
],
|
|
144
|
+
description: "Show a button that expands the hidden content. Set to 'collapsible' to also allow collapsing it again."
|
|
145
|
+
},
|
|
146
|
+
defaultExpanded: {
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
default: false,
|
|
149
|
+
description: 'Start with the content expanded.'
|
|
150
|
+
},
|
|
151
|
+
suffix: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
description: 'Suffix of ellipses content.'
|
|
154
|
+
},
|
|
155
|
+
symbol: {
|
|
156
|
+
type: [
|
|
157
|
+
'string',
|
|
158
|
+
'array'
|
|
159
|
+
],
|
|
160
|
+
items: {
|
|
161
|
+
type: 'string'
|
|
162
|
+
},
|
|
163
|
+
description: 'Text of the expand button, or an array of two strings for the expand and collapse buttons.',
|
|
164
|
+
docs: {
|
|
165
|
+
displayType: 'string'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
tooltip: {
|
|
169
|
+
type: [
|
|
170
|
+
'boolean',
|
|
171
|
+
'string'
|
|
172
|
+
],
|
|
173
|
+
nativeIgnored: true,
|
|
174
|
+
description: 'Show a tooltip when the text is truncated. true shows the full text, a string shows that text. Ignored on mobile.',
|
|
175
|
+
docs: {
|
|
176
|
+
displayType: 'string'
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
italic: {
|
|
184
|
+
type: 'boolean',
|
|
185
|
+
default: false,
|
|
186
|
+
description: 'Apply italic style.'
|
|
187
|
+
},
|
|
188
|
+
keyboard: {
|
|
189
|
+
type: 'boolean',
|
|
190
|
+
default: false,
|
|
191
|
+
description: 'Apply keyboard key style.'
|
|
192
|
+
},
|
|
193
|
+
mark: {
|
|
194
|
+
type: 'boolean',
|
|
195
|
+
default: false,
|
|
196
|
+
description: 'Apply marked (highlighted) style.'
|
|
197
|
+
},
|
|
198
|
+
strong: {
|
|
199
|
+
type: 'boolean',
|
|
200
|
+
default: false,
|
|
201
|
+
description: 'Apply strong (bold) style.'
|
|
202
|
+
},
|
|
203
|
+
type: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
default: 'default',
|
|
206
|
+
enum: [
|
|
207
|
+
'success',
|
|
208
|
+
'default',
|
|
209
|
+
'secondary',
|
|
210
|
+
'warning',
|
|
211
|
+
'danger'
|
|
212
|
+
],
|
|
213
|
+
description: "Additional types. Don't specify for default."
|
|
214
|
+
},
|
|
215
|
+
underline: {
|
|
216
|
+
type: 'boolean',
|
|
217
|
+
default: false,
|
|
218
|
+
description: 'Apply underline style.'
|
|
219
|
+
},
|
|
220
|
+
textStyle: {
|
|
221
|
+
...textStyle,
|
|
222
|
+
default: 'body'
|
|
223
|
+
},
|
|
224
|
+
theme: {
|
|
225
|
+
type: 'object',
|
|
226
|
+
description: 'Antd design token overrides for this block. See <a href="https://ant.design/components/overview#design-token">antd design tokens</a>.',
|
|
227
|
+
docs: {
|
|
228
|
+
displayType: 'yaml',
|
|
229
|
+
link: 'https://ant.design/components/typography#design-token'
|
|
230
|
+
},
|
|
231
|
+
properties: {
|
|
232
|
+
titleMarginBottom: {
|
|
233
|
+
type: [
|
|
234
|
+
'string',
|
|
235
|
+
'number'
|
|
236
|
+
],
|
|
237
|
+
default: '0.5em',
|
|
238
|
+
description: 'Margin bottom of title, as a CSS length or a number of pixels.',
|
|
239
|
+
docs: {
|
|
240
|
+
displayType: 'string'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
titleMarginTop: {
|
|
244
|
+
type: [
|
|
245
|
+
'string',
|
|
246
|
+
'number'
|
|
247
|
+
],
|
|
248
|
+
default: '1.2em',
|
|
249
|
+
description: 'Margin top of title, as a CSS length or a number of pixels.',
|
|
250
|
+
docs: {
|
|
251
|
+
displayType: 'string'
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
fontWeightStrong: {
|
|
255
|
+
type: 'number',
|
|
256
|
+
default: 600,
|
|
257
|
+
description: 'Font weight for strong text.'
|
|
258
|
+
},
|
|
259
|
+
fontFamilyCode: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
description: 'Font family for code style text.'
|
|
262
|
+
},
|
|
263
|
+
colorText: {
|
|
264
|
+
type: 'string',
|
|
265
|
+
description: 'Default text color.'
|
|
266
|
+
},
|
|
267
|
+
colorTextSecondary: {
|
|
268
|
+
type: 'string',
|
|
269
|
+
description: 'Secondary text color.'
|
|
270
|
+
},
|
|
271
|
+
colorSuccess: {
|
|
272
|
+
type: 'string',
|
|
273
|
+
description: 'Success text color.'
|
|
274
|
+
},
|
|
275
|
+
colorWarning: {
|
|
276
|
+
type: 'string',
|
|
277
|
+
description: 'Warning text color.'
|
|
278
|
+
},
|
|
279
|
+
colorError: {
|
|
280
|
+
type: 'string',
|
|
281
|
+
description: 'Danger/error text color.'
|
|
282
|
+
},
|
|
283
|
+
colorTextDisabled: {
|
|
284
|
+
type: 'string',
|
|
285
|
+
description: 'Disabled text color.'
|
|
286
|
+
},
|
|
287
|
+
colorLink: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
description: 'Link color.'
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
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, { useEffect, useState } from 'react';
|
|
16
|
+
import { Text, View } from 'react-native';
|
|
17
|
+
import createScanFilter from './createScanFilter.js';
|
|
18
|
+
import getDeviceFeature, { hasDeviceFeature } from '../../device/getDeviceFeature.js';
|
|
19
|
+
import meta from './meta.js';
|
|
20
|
+
import MissingFeature from '../../shared/MissingFeature.js';
|
|
21
|
+
import playFeedback from '../../device/playFeedback.js';
|
|
22
|
+
// A live camera that reads QR codes and barcodes (expo-camera's scanner, which the shell installs
|
|
23
|
+
// as the camera feature's ScannerView). Each kept read fires onScan; `reset` starts a single-scan
|
|
24
|
+
// scanner again.
|
|
25
|
+
function QRScanner({ blockId, methods, properties, styles = {} }) {
|
|
26
|
+
const height = properties.height ?? 300;
|
|
27
|
+
const continuous = properties.continuous === true;
|
|
28
|
+
const [filter, setFilter] = useState(()=>createScanFilter({
|
|
29
|
+
continuous
|
|
30
|
+
}));
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
setFilter(()=>createScanFilter({
|
|
33
|
+
continuous
|
|
34
|
+
}));
|
|
35
|
+
methods.registerMethod('reset', ()=>setFilter(()=>createScanFilter({
|
|
36
|
+
continuous
|
|
37
|
+
})));
|
|
38
|
+
}, [
|
|
39
|
+
continuous,
|
|
40
|
+
methods
|
|
41
|
+
]);
|
|
42
|
+
if (!hasDeviceFeature('camera')) {
|
|
43
|
+
return /*#__PURE__*/ React.createElement(MissingFeature, {
|
|
44
|
+
blockId: blockId,
|
|
45
|
+
feature: "camera",
|
|
46
|
+
height: height,
|
|
47
|
+
style: styles.element,
|
|
48
|
+
title: "The scanner"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const { ScannerView } = getDeviceFeature({
|
|
52
|
+
feature: 'camera',
|
|
53
|
+
action: 'QRScanner'
|
|
54
|
+
});
|
|
55
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
56
|
+
style: [
|
|
57
|
+
{
|
|
58
|
+
borderRadius: 12,
|
|
59
|
+
height,
|
|
60
|
+
overflow: 'hidden'
|
|
61
|
+
},
|
|
62
|
+
styles.element
|
|
63
|
+
],
|
|
64
|
+
testID: blockId
|
|
65
|
+
}, /*#__PURE__*/ React.createElement(ScannerView, {
|
|
66
|
+
onScan: (read)=>{
|
|
67
|
+
if (!filter(read)) return;
|
|
68
|
+
playFeedback('success');
|
|
69
|
+
methods.triggerEvent({
|
|
70
|
+
name: 'onScan',
|
|
71
|
+
event: read
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
style: {
|
|
75
|
+
flex: 1
|
|
76
|
+
},
|
|
77
|
+
torch: properties.torch === true,
|
|
78
|
+
types: properties.types
|
|
79
|
+
}), properties.prompt ? /*#__PURE__*/ React.createElement(Text, {
|
|
80
|
+
pointerEvents: "none",
|
|
81
|
+
style: {
|
|
82
|
+
bottom: 16,
|
|
83
|
+
color: '#FFFFFF',
|
|
84
|
+
left: 16,
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
right: 16,
|
|
87
|
+
textAlign: 'center',
|
|
88
|
+
textShadowColor: 'rgba(0,0,0,0.6)',
|
|
89
|
+
textShadowRadius: 4
|
|
90
|
+
}
|
|
91
|
+
}, properties.prompt) : null);
|
|
92
|
+
}
|
|
93
|
+
QRScanner.meta = meta;
|
|
94
|
+
export default QRScanner;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
*/ /**
|
|
16
|
+
* Decides which camera reads become onScan events. A camera reports the same code many times a
|
|
17
|
+
* second while it is in view: one read per code is kept, and the same code again only after
|
|
18
|
+
* `repeatAfter` milliseconds. A single-scan scanner keeps only its first read.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} params
|
|
21
|
+
* @param {boolean} params.continuous
|
|
22
|
+
* @param {number} [params.repeatAfter]
|
|
23
|
+
* @param {() => number} [params.now]
|
|
24
|
+
* @returns {(read: { data: string, type: string }) => boolean}
|
|
25
|
+
*/ function createScanFilter({ continuous, repeatAfter = 2000, now = Date.now }) {
|
|
26
|
+
let done = false;
|
|
27
|
+
const seen = new Map();
|
|
28
|
+
return function keep({ data }) {
|
|
29
|
+
if (done) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const time = now();
|
|
33
|
+
const last = seen.get(data);
|
|
34
|
+
if (last !== undefined && time - last < repeatAfter) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
seen.set(data, time);
|
|
38
|
+
if (!continuous) {
|
|
39
|
+
done = true;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export default createScanFilter;
|