@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.
Files changed (419) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +9 -2
  3. package/dist/actions/AddCalendarEvent/AddCalendarEvent.js +31 -0
  4. package/dist/actions/AddCalendarEvent/schema.js +55 -0
  5. package/dist/actions/AddContact/AddContact.js +24 -0
  6. package/dist/actions/AddContact/schema.js +49 -0
  7. package/dist/actions/CancelNotification/CancelNotification.js +23 -0
  8. package/dist/actions/CancelNotification/schema.js +31 -0
  9. package/dist/actions/DiscardQueuedRequest/DiscardQueuedRequest.js +23 -0
  10. package/dist/actions/DiscardQueuedRequest/schema.js +31 -0
  11. package/dist/actions/GetCalendarEvents/GetCalendarEvents.js +32 -0
  12. package/dist/actions/GetCalendarEvents/schema.js +35 -0
  13. package/dist/actions/GetRequestQueue/GetRequestQueue.js +24 -0
  14. package/dist/actions/GetRequestQueue/schema.js +22 -0
  15. package/dist/actions/Haptic/Haptic.js +38 -0
  16. package/dist/actions/Haptic/schema.js +37 -0
  17. package/dist/actions/KeepAwake/KeepAwake.js +23 -0
  18. package/dist/actions/KeepAwake/schema.js +28 -0
  19. package/dist/actions/PickContact/PickContact.js +24 -0
  20. package/dist/actions/PickContact/schema.js +22 -0
  21. package/dist/actions/PickFile/PickFile.js +32 -0
  22. package/dist/actions/PickFile/schema.js +58 -0
  23. package/dist/actions/PickImage/PickImage.js +32 -0
  24. package/dist/actions/PickImage/schema.js +76 -0
  25. package/dist/actions/ReadNfc/ReadNfc.js +24 -0
  26. package/dist/actions/ReadNfc/schema.js +27 -0
  27. package/dist/actions/RefreshWidgets/RefreshWidgets.js +24 -0
  28. package/dist/actions/RefreshWidgets/schema.js +22 -0
  29. package/dist/actions/RequestNotificationPermission/RequestNotificationPermission.js +24 -0
  30. package/dist/actions/RequestNotificationPermission/schema.js +22 -0
  31. package/dist/actions/RetryRequestQueue/RetryRequestQueue.js +24 -0
  32. package/dist/actions/RetryRequestQueue/schema.js +27 -0
  33. package/dist/actions/ScanCode/ScanCode.js +24 -0
  34. package/dist/actions/ScanCode/schema.js +54 -0
  35. package/dist/actions/ScanDocument/ScanDocument.js +32 -0
  36. package/dist/actions/ScanDocument/schema.js +57 -0
  37. package/dist/actions/ScheduleNotification/ScheduleNotification.js +27 -0
  38. package/dist/actions/ScheduleNotification/schema.js +67 -0
  39. package/dist/actions/SetBadgeCount/SetBadgeCount.js +27 -0
  40. package/dist/actions/SetBadgeCount/schema.js +31 -0
  41. package/dist/actions/SetBrightness/SetBrightness.js +24 -0
  42. package/dist/actions/SetBrightness/schema.js +33 -0
  43. package/dist/actions/Share/Share.js +50 -0
  44. package/dist/actions/Share/schema.js +51 -0
  45. package/dist/actions/Speak/Speak.js +27 -0
  46. package/dist/actions/Speak/schema.js +44 -0
  47. package/dist/actions/StartGeofencing/StartGeofencing.js +29 -0
  48. package/dist/actions/StartGeofencing/schema.js +63 -0
  49. package/dist/actions/StartLocationTracking/StartLocationTracking.js +29 -0
  50. package/dist/actions/StartLocationTracking/schema.js +59 -0
  51. package/dist/actions/StartRecording/StartRecording.js +23 -0
  52. package/dist/actions/StartRecording/schema.js +32 -0
  53. package/dist/actions/StopGeofencing/StopGeofencing.js +23 -0
  54. package/dist/actions/StopGeofencing/schema.js +22 -0
  55. package/dist/actions/StopLocationTracking/StopLocationTracking.js +23 -0
  56. package/dist/actions/StopLocationTracking/schema.js +22 -0
  57. package/dist/actions/StopRecording/StopRecording.js +37 -0
  58. package/dist/actions/StopRecording/schema.js +46 -0
  59. package/dist/actions/StopSpeaking/StopSpeaking.js +23 -0
  60. package/dist/actions/StopSpeaking/schema.js +22 -0
  61. package/dist/actions/TakePhoto/TakePhoto.js +31 -0
  62. package/dist/actions/TakePhoto/schema.js +67 -0
  63. package/dist/actions/WriteNfc/WriteNfc.js +28 -0
  64. package/dist/actions/WriteNfc/schema.js +61 -0
  65. package/dist/actions/uploadFiles.js +51 -0
  66. package/dist/actions.js +47 -0
  67. package/dist/blocks/ActivityTimeline/ActivityTimeline.js +507 -0
  68. package/dist/blocks/ActivityTimeline/CommentBody.js +176 -0
  69. package/dist/blocks/ActivityTimeline/CommentItem.js +302 -0
  70. package/dist/blocks/ActivityTimeline/EditBox.js +143 -0
  71. package/dist/blocks/ActivityTimeline/LineText.js +71 -0
  72. package/dist/blocks/ActivityTimeline/RailIcon.js +41 -0
  73. package/dist/blocks/ActivityTimeline/RailRow.js +74 -0
  74. package/dist/blocks/ActivityTimeline/ReactionPicker.js +68 -0
  75. package/dist/blocks/ActivityTimeline/ReactionPills.js +112 -0
  76. package/dist/blocks/ActivityTimeline/ThreadCard.js +160 -0
  77. package/dist/blocks/ActivityTimeline/TimelineMarkdownRenderer.js +48 -0
  78. package/dist/blocks/ActivityTimeline/buildTimelineRows.js +194 -0
  79. package/dist/blocks/ActivityTimeline/describeEvent.js +61 -0
  80. package/dist/blocks/ActivityTimeline/describeGap.js +71 -0
  81. package/dist/blocks/ActivityTimeline/fillTemplate.js +84 -0
  82. package/dist/blocks/ActivityTimeline/fillText.js +38 -0
  83. package/dist/blocks/ActivityTimeline/formatRelativeTime.js +68 -0
  84. package/dist/blocks/ActivityTimeline/getActor.js +41 -0
  85. package/dist/blocks/ActivityTimeline/getCommentMenuActions.js +85 -0
  86. package/dist/blocks/ActivityTimeline/getCommentView.js +72 -0
  87. package/dist/blocks/ActivityTimeline/getTimelineColors.js +71 -0
  88. package/dist/blocks/ActivityTimeline/getToneColor.js +49 -0
  89. package/dist/blocks/ActivityTimeline/getVisibleReplies.js +36 -0
  90. package/dist/blocks/ActivityTimeline/isThreadShown.js +28 -0
  91. package/dist/blocks/ActivityTimeline/joinList.js +21 -0
  92. package/dist/blocks/ActivityTimeline/meta.js +320 -0
  93. package/dist/blocks/ActivityTimeline/parseTimelineHref.js +43 -0
  94. package/dist/blocks/ActivityTimeline/selectEventRule.js +69 -0
  95. package/dist/blocks/ActivityTimeline/summariseEvents.js +51 -0
  96. package/dist/blocks/ActivityTimeline/toPlainText.js +32 -0
  97. package/dist/blocks/ActivityTimeline/toTime.js +36 -0
  98. package/dist/blocks/ActivityTimeline/toTimelineMarkdown.js +57 -0
  99. package/dist/blocks/ActivityTimeline/toggleReaction.js +74 -0
  100. package/dist/blocks/ActivityTimeline/useNow.js +24 -0
  101. package/dist/blocks/AgentChat/AgentChat.js +726 -0
  102. package/dist/blocks/AgentChat/AssistantMessage.js +243 -0
  103. package/dist/blocks/AgentChat/ChatComposer.js +401 -0
  104. package/dist/blocks/AgentChat/ChatError.js +129 -0
  105. package/dist/blocks/AgentChat/ChatSkeleton.js +97 -0
  106. package/dist/blocks/AgentChat/ReasoningDisclosure.js +125 -0
  107. package/dist/blocks/AgentChat/ThinkingIndicator.js +103 -0
  108. package/dist/blocks/AgentChat/ThreadsSheet.js +347 -0
  109. package/dist/blocks/AgentChat/ToolApprovalCard.js +190 -0
  110. package/dist/blocks/AgentChat/ToolCallRow.js +187 -0
  111. package/dist/blocks/AgentChat/ToolDetail.js +137 -0
  112. package/dist/blocks/AgentChat/UserMessage.js +84 -0
  113. package/dist/blocks/AgentChat/WelcomeView.js +100 -0
  114. package/dist/blocks/AgentChat/createAgentTransport.js +74 -0
  115. package/dist/blocks/AgentChat/describeToolPart.js +133 -0
  116. package/dist/blocks/AgentChat/getChatSeed.js +44 -0
  117. package/dist/blocks/AgentChat/getFirstExchange.js +43 -0
  118. package/dist/blocks/AgentChat/getMessageSegments.js +73 -0
  119. package/dist/blocks/AgentChat/getMessageText.js +25 -0
  120. package/dist/blocks/AgentChat/getPageStateUpdates.js +47 -0
  121. package/dist/blocks/AgentChat/getProvisionalTitle.js +32 -0
  122. package/dist/blocks/AgentChat/getReadableRows.js +157 -0
  123. package/dist/blocks/AgentChat/getThreadEndpoints.js +54 -0
  124. package/dist/blocks/AgentChat/getToolIcon.js +110 -0
  125. package/dist/blocks/AgentChat/humanizeToolName.js +30 -0
  126. package/dist/blocks/AgentChat/messageParts.js +86 -0
  127. package/dist/blocks/AgentChat/meta.js +530 -0
  128. package/dist/blocks/AgentChat/mintConversationId.js +29 -0
  129. package/dist/blocks/AgentChat/replayableMessages.js +62 -0
  130. package/dist/blocks/AgentChat/showMessageMenu.js +49 -0
  131. package/dist/blocks/AgentChat/summarizeToolInput.js +36 -0
  132. package/dist/blocks/AgentChat/summarizeToolOutput.js +49 -0
  133. package/dist/blocks/AgentChat/useAgentEvents.js +218 -0
  134. package/dist/blocks/AgentChat/useChatDictation.js +151 -0
  135. package/dist/blocks/AgentChat/useChatThreads.js +450 -0
  136. package/dist/blocks/AgentChat/useFollowScroll.js +80 -0
  137. package/dist/blocks/AgentChat/useThinkingMessage.js +77 -0
  138. package/dist/blocks/Alert/Alert.js +167 -0
  139. package/dist/blocks/Alert/meta.js +200 -0
  140. package/dist/blocks/Avatar/Avatar.js +51 -0
  141. package/dist/blocks/Avatar/AvatarCircle.js +114 -0
  142. package/dist/blocks/Avatar/AvatarPhoto.js +68 -0
  143. package/dist/blocks/Avatar/AvatarStack.js +89 -0
  144. package/dist/blocks/Avatar/getAvatarColor.js +84 -0
  145. package/dist/blocks/Avatar/getAvatarImage.js +97 -0
  146. package/dist/blocks/Avatar/getInitials.js +51 -0
  147. package/dist/blocks/Avatar/meta.js +57 -0
  148. package/dist/blocks/Box/Box.js +118 -0
  149. package/dist/blocks/Box/getRubberBand.js +29 -0
  150. package/dist/blocks/Box/getSwipeDirection.js +45 -0
  151. package/dist/blocks/Box/isSwipeGesture.js +41 -0
  152. package/dist/blocks/Box/meta.js +46 -0
  153. package/dist/blocks/Box/useSwipeGesture.js +113 -0
  154. package/dist/blocks/Button/Button.js +136 -0
  155. package/dist/blocks/Button/getButtonColors.js +216 -0
  156. package/dist/blocks/Button/meta.js +137 -0
  157. package/dist/blocks/Card/Card.js +185 -0
  158. package/dist/blocks/Card/meta.js +203 -0
  159. package/dist/blocks/ChipSelector/Chip.js +178 -0
  160. package/dist/blocks/ChipSelector/ChipSelector.js +313 -0
  161. package/dist/blocks/ChipSelector/EdgeFade.js +68 -0
  162. package/dist/blocks/ChipSelector/getChipColors.js +88 -0
  163. package/dist/blocks/ChipSelector/getFadeRanges.js +55 -0
  164. package/dist/blocks/ChipSelector/getOverscrollSwipe.js +44 -0
  165. package/dist/blocks/ChipSelector/getScrollTarget.js +41 -0
  166. package/dist/blocks/ChipSelector/meta.js +156 -0
  167. package/dist/blocks/Composer/Composer.js +511 -0
  168. package/dist/blocks/Composer/MentionTextInput.js +91 -0
  169. package/dist/blocks/Composer/SuggestionList.js +165 -0
  170. package/dist/blocks/Composer/applyDisplayEdit.js +81 -0
  171. package/dist/blocks/Composer/convertSpokenMentions.js +234 -0
  172. package/dist/blocks/Composer/createMentionPattern.js +40 -0
  173. package/dist/blocks/Composer/findTrigger.js +51 -0
  174. package/dist/blocks/Composer/getSendState.js +38 -0
  175. package/dist/blocks/Composer/getSpokenMentionWords.js +35 -0
  176. package/dist/blocks/Composer/indexSpokenNames.js +50 -0
  177. package/dist/blocks/Composer/insertLink.js +36 -0
  178. package/dist/blocks/Composer/insertMention.js +43 -0
  179. package/dist/blocks/Composer/matchSpokenName.js +88 -0
  180. package/dist/blocks/Composer/meta.js +212 -0
  181. package/dist/blocks/Composer/parseMentionValue.js +55 -0
  182. package/dist/blocks/Composer/placeDictation.js +51 -0
  183. package/dist/blocks/Composer/rankMentions.js +51 -0
  184. package/dist/blocks/Composer/replaceRange.js +48 -0
  185. package/dist/blocks/Composer/segmentText.js +78 -0
  186. package/dist/blocks/Composer/shiftOffset.js +37 -0
  187. package/dist/blocks/Composer/snapSelection.js +37 -0
  188. package/dist/blocks/Composer/useMentionEditor.js +381 -0
  189. package/dist/blocks/Composer/withPartial.js +50 -0
  190. package/dist/blocks/DateSelector/DateSelector.js +250 -0
  191. package/dist/blocks/DateSelector/formatDateValue.js +34 -0
  192. package/dist/blocks/DateSelector/getDateMenuActions.js +96 -0
  193. package/dist/blocks/DateSelector/meta.js +109 -0
  194. package/dist/blocks/DateSelector/toBoundDate.js +40 -0
  195. package/dist/blocks/DateSelector/toPickerDate.js +31 -0
  196. package/dist/blocks/DateSelector/toUtcDay.js +25 -0
  197. package/dist/blocks/Divider/Divider.js +159 -0
  198. package/dist/blocks/Divider/meta.js +108 -0
  199. package/dist/blocks/Empty/Empty.js +107 -0
  200. package/dist/blocks/Empty/meta.js +61 -0
  201. package/dist/blocks/FileInput/FileInput.js +253 -0
  202. package/dist/blocks/FileInput/formatFileSize.js +28 -0
  203. package/dist/blocks/FileInput/getFileSources.js +48 -0
  204. package/dist/blocks/FileInput/meta.js +123 -0
  205. package/dist/blocks/Icon/Icon.js +41 -0
  206. package/dist/blocks/Icon/meta.js +80 -0
  207. package/dist/blocks/Illustration/Illustration.js +154 -0
  208. package/dist/blocks/Illustration/IllustrationLayer.js +105 -0
  209. package/dist/blocks/Illustration/colorNodes.js +72 -0
  210. package/dist/blocks/Illustration/createIllustrationMotion.js +172 -0
  211. package/dist/blocks/Illustration/getIllustrationBox.js +54 -0
  212. package/dist/blocks/Illustration/getIllustrationColors.js +48 -0
  213. package/dist/blocks/Illustration/getKeyframeRange.js +99 -0
  214. package/dist/blocks/Illustration/getLayerBounds.js +74 -0
  215. package/dist/blocks/Illustration/getLayers.js +113 -0
  216. package/dist/blocks/Illustration/getNodePoints.js +210 -0
  217. package/dist/blocks/Illustration/meta.js +196 -0
  218. package/dist/blocks/Illustration/parseIllustration.js +84 -0
  219. package/dist/blocks/Illustration/toBoundingBoxGradients.js +188 -0
  220. package/dist/blocks/Illustration/useIllustrationMotion.js +75 -0
  221. package/dist/blocks/Label/Label.js +111 -0
  222. package/dist/blocks/Label/getLabelProperties.js +38 -0
  223. package/dist/blocks/Label/getLabelState.js +59 -0
  224. package/dist/blocks/List/List.js +159 -0
  225. package/dist/blocks/List/ListRow.js +74 -0
  226. package/dist/blocks/List/ListRowContext.js +20 -0
  227. package/dist/blocks/List/SectionHeader.js +119 -0
  228. package/dist/blocks/List/getSections.js +161 -0
  229. package/dist/blocks/List/meta.js +190 -0
  230. package/dist/blocks/ListItem/ListItem.js +440 -0
  231. package/dist/blocks/ListItem/ListItemContextMenu.js +58 -0
  232. package/dist/blocks/ListItem/getListItemParts.js +101 -0
  233. package/dist/blocks/ListItem/getSfSymbol.js +33 -0
  234. package/dist/blocks/ListItem/meta.js +284 -0
  235. package/dist/blocks/Map/Map.js +78 -0
  236. package/dist/blocks/Map/meta.js +153 -0
  237. package/dist/blocks/Markdown/ChipWidthContext.js +20 -0
  238. package/dist/blocks/Markdown/ChipWidthView.js +40 -0
  239. package/dist/blocks/Markdown/LinkChip.js +151 -0
  240. package/dist/blocks/Markdown/Markdown.js +70 -0
  241. package/dist/blocks/Markdown/MarkdownCode.js +67 -0
  242. package/dist/blocks/Markdown/MarkdownContent.js +119 -0
  243. package/dist/blocks/Markdown/MarkdownImage.js +77 -0
  244. package/dist/blocks/Markdown/MarkdownList.js +97 -0
  245. package/dist/blocks/Markdown/MarkdownListContext.js +22 -0
  246. package/dist/blocks/Markdown/MarkdownRenderer.js +231 -0
  247. package/dist/blocks/Markdown/MarkdownTable.js +96 -0
  248. package/dist/blocks/Markdown/MarkdownTokenizer.js +43 -0
  249. package/dist/blocks/Markdown/TaskBox.js +58 -0
  250. package/dist/blocks/Markdown/TaskMark.js +37 -0
  251. package/dist/blocks/Markdown/getChipMaxWidth.js +33 -0
  252. package/dist/blocks/Markdown/getLinkChip.js +95 -0
  253. package/dist/blocks/Markdown/getLinkChipColors.js +51 -0
  254. package/dist/blocks/Markdown/getListMarker.js +116 -0
  255. package/dist/blocks/Markdown/getMarkdownStyles.js +206 -0
  256. package/dist/blocks/Markdown/getNodeText.js +37 -0
  257. package/dist/blocks/Markdown/layoutLinkChips.js +209 -0
  258. package/dist/blocks/Markdown/matchLinkChip.js +82 -0
  259. package/dist/blocks/Markdown/meta.js +56 -0
  260. package/dist/blocks/Markdown/restyleText.js +40 -0
  261. package/dist/blocks/Markdown/trimOuterSpace.js +42 -0
  262. package/dist/blocks/Menu/Menu.js +96 -0
  263. package/dist/blocks/Menu/getMenuActions.js +66 -0
  264. package/dist/blocks/Menu/meta.js +159 -0
  265. package/dist/blocks/MultipleSelector/MultipleSelector.js +290 -0
  266. package/dist/blocks/MultipleSelector/MultipleSelectorRow.js +71 -0
  267. package/dist/blocks/MultipleSelector/ValueSummary.js +130 -0
  268. package/dist/blocks/MultipleSelector/getOptionIndices.js +30 -0
  269. package/dist/blocks/MultipleSelector/getSessionOptions.js +38 -0
  270. package/dist/blocks/MultipleSelector/getSummaryCount.js +35 -0
  271. package/dist/blocks/MultipleSelector/meta.js +284 -0
  272. package/dist/blocks/MultipleSelector/toggleValue.js +50 -0
  273. package/dist/blocks/NumberInput/NumberInput.js +251 -0
  274. package/dist/blocks/NumberInput/StepButton.js +46 -0
  275. package/dist/blocks/NumberInput/formatNumber.js +35 -0
  276. package/dist/blocks/NumberInput/getNumberKeyboardType.js +32 -0
  277. package/dist/blocks/NumberInput/meta.js +123 -0
  278. package/dist/blocks/NumberInput/normalizeNumber.js +38 -0
  279. package/dist/blocks/NumberInput/parseNumberText.js +46 -0
  280. package/dist/blocks/PageDots/PageDots.js +131 -0
  281. package/dist/blocks/PageDots/meta.js +48 -0
  282. package/dist/blocks/Paragraph/Paragraph.js +52 -0
  283. package/dist/blocks/Paragraph/meta.js +295 -0
  284. package/dist/blocks/QRScanner/QRScanner.js +94 -0
  285. package/dist/blocks/QRScanner/createScanFilter.js +44 -0
  286. package/dist/blocks/QRScanner/meta.js +80 -0
  287. package/dist/blocks/Screen/meta.js +197 -0
  288. package/dist/blocks/SegmentedControl/SegmentedControl.js +77 -0
  289. package/dist/blocks/SegmentedControl/meta.js +78 -0
  290. package/dist/blocks/Selector/NoValueAvatar.js +42 -0
  291. package/dist/blocks/Selector/PickerOptionRow.js +130 -0
  292. package/dist/blocks/Selector/PickerRowLeading.js +57 -0
  293. package/dist/blocks/Selector/PickerSearchField.js +85 -0
  294. package/dist/blocks/Selector/PickerSheet.js +239 -0
  295. package/dist/blocks/Selector/Selector.js +122 -0
  296. package/dist/blocks/Selector/SelectorMenu.js +97 -0
  297. package/dist/blocks/Selector/SelectorRow.js +86 -0
  298. package/dist/blocks/Selector/SelectorSheet.js +131 -0
  299. package/dist/blocks/Selector/getOptionIndex.js +39 -0
  300. package/dist/blocks/Selector/getOptionLabel.js +32 -0
  301. package/dist/blocks/Selector/getOptionValue.js +20 -0
  302. package/dist/blocks/Selector/getPickerSheetDetents.js +45 -0
  303. package/dist/blocks/Selector/getPickerSheetRows.js +174 -0
  304. package/dist/blocks/Selector/getPickerSheetScrollIndex.js +35 -0
  305. package/dist/blocks/Selector/getSelectorMenuActions.js +61 -0
  306. package/dist/blocks/Selector/meta.js +195 -0
  307. package/dist/blocks/Selector/normalizeSearchText.js +27 -0
  308. package/dist/blocks/Selector/setSelectorValue.js +54 -0
  309. package/dist/blocks/Sheet/Sheet.js +174 -0
  310. package/dist/blocks/Sheet/getSheetDetents.js +56 -0
  311. package/dist/blocks/Sheet/meta.js +72 -0
  312. package/dist/blocks/SignaturePad/SignaturePad.js +182 -0
  313. package/dist/blocks/SignaturePad/meta.js +74 -0
  314. package/dist/blocks/SignaturePad/toSignatureValue.js +52 -0
  315. package/dist/blocks/Skeleton/Skeleton.js +131 -0
  316. package/dist/blocks/Skeleton/SkeletonCard.js +42 -0
  317. package/dist/blocks/Skeleton/SkeletonHero.js +72 -0
  318. package/dist/blocks/Skeleton/SkeletonInsetGroup.js +82 -0
  319. package/dist/blocks/Skeleton/SkeletonListRow.js +90 -0
  320. package/dist/blocks/Skeleton/SkeletonParagraph.js +36 -0
  321. package/dist/blocks/Skeleton/SkeletonRows.js +58 -0
  322. package/dist/blocks/Skeleton/SkeletonTimeline.js +88 -0
  323. package/dist/blocks/Skeleton/getBarWidth.js +45 -0
  324. package/dist/blocks/Skeleton/getParagraphWidths.js +56 -0
  325. package/dist/blocks/Skeleton/getSectionCounts.js +33 -0
  326. package/dist/blocks/Skeleton/getSkeletonVariant.js +27 -0
  327. package/dist/blocks/Skeleton/meta.js +98 -0
  328. package/dist/blocks/Spinner/Spinner.js +68 -0
  329. package/dist/blocks/Spinner/meta.js +35 -0
  330. package/dist/blocks/StatusIcon/StatusGlyph.js +247 -0
  331. package/dist/blocks/StatusIcon/StatusIcon.js +34 -0
  332. package/dist/blocks/StatusIcon/StatusMark.js +87 -0
  333. package/dist/blocks/StatusIcon/getPiePath.js +41 -0
  334. package/dist/blocks/StatusIcon/getStatusColor.js +61 -0
  335. package/dist/blocks/StatusIcon/meta.js +38 -0
  336. package/dist/blocks/StatusIcon/statusLabels.js +33 -0
  337. package/dist/blocks/Switch/Switch.js +85 -0
  338. package/dist/blocks/Switch/meta.js +78 -0
  339. package/dist/blocks/Tabs/Tabs.js +269 -0
  340. package/dist/blocks/Tabs/meta.js +305 -0
  341. package/dist/blocks/Tag/TONE_PALETTES.js +34 -0
  342. package/dist/blocks/Tag/Tag.js +173 -0
  343. package/dist/blocks/Tag/getTagColors.js +120 -0
  344. package/dist/blocks/Tag/getTagDotColor.js +32 -0
  345. package/dist/blocks/Tag/meta.js +131 -0
  346. package/dist/blocks/TextArea/ComposerSendButton.js +69 -0
  347. package/dist/blocks/TextArea/TextArea.js +167 -0
  348. package/dist/blocks/TextArea/meta.js +96 -0
  349. package/dist/blocks/TextInput/TextInput.js +253 -0
  350. package/dist/blocks/TextInput/applyReplaceInput.js +30 -0
  351. package/dist/blocks/TextInput/getKeyboardProps.js +64 -0
  352. package/dist/blocks/TextInput/getSearchBoxStyle.js +39 -0
  353. package/dist/blocks/TextInput/meta.js +113 -0
  354. package/dist/blocks/Title/Title.js +62 -0
  355. package/dist/blocks/Title/meta.js +355 -0
  356. package/dist/blocks.js +52 -0
  357. package/dist/device/getDeviceFeature.js +81 -0
  358. package/dist/device/playFeedback.js +32 -0
  359. package/dist/device.js +18 -0
  360. package/dist/dictation.js +17 -0
  361. package/dist/htmlToText.js +32 -0
  362. package/dist/metas.js +53 -0
  363. package/dist/schemas/avatar.js +40 -0
  364. package/dist/schemas/icon.js +65 -0
  365. package/dist/schemas/inputLabel.js +96 -0
  366. package/dist/schemas/inputProperties.js +92 -0
  367. package/dist/schemas/linkChips.js +85 -0
  368. package/dist/schemas/status.js +75 -0
  369. package/dist/schemas/textStyle.js +33 -0
  370. package/dist/schemas/tone.js +28 -0
  371. package/dist/schemas.js +47 -0
  372. package/dist/shared/ClearButton.js +53 -0
  373. package/dist/shared/CountText.js +38 -0
  374. package/dist/shared/MissingFeature.js +43 -0
  375. package/dist/shared/NativeMenu.js +69 -0
  376. package/dist/shared/OptionGlyph.js +59 -0
  377. package/dist/shared/PropertyRow.js +89 -0
  378. package/dist/shared/SheetCloseButton.js +51 -0
  379. package/dist/shared/SheetDoneButton.js +44 -0
  380. package/dist/shared/SwipeContext.js +20 -0
  381. package/dist/shared/SwipeableRow.js +294 -0
  382. package/dist/shared/SystemIcon.js +72 -0
  383. package/dist/shared/dictation/DictationButton.js +77 -0
  384. package/dist/shared/dictation/DictationWarning.js +89 -0
  385. package/dist/shared/dictation/LevelMeter.js +57 -0
  386. package/dist/shared/dictation/ListeningRow.js +100 -0
  387. package/dist/shared/dictation/PartialSpans.js +50 -0
  388. package/dist/shared/dictation/checkDictationAvailable.js +65 -0
  389. package/dist/shared/dictation/claimMic.js +68 -0
  390. package/dist/shared/dictation/createQueuedRecognizer.js +213 -0
  391. package/dist/shared/dictation/getDictationLevel.js +30 -0
  392. package/dist/shared/dictation/getDictationWarning.js +40 -0
  393. package/dist/shared/dictation/getLevelBars.js +38 -0
  394. package/dist/shared/dictation/getRecognizer.js +46 -0
  395. package/dist/shared/dictation/getStartOptions.js +42 -0
  396. package/dist/shared/dictation/insertAtSelection.js +48 -0
  397. package/dist/shared/dictation/pickRecognitionLocale.js +37 -0
  398. package/dist/shared/dictation/useDictation.js +299 -0
  399. package/dist/shared/getControlSize.js +50 -0
  400. package/dist/shared/getInputBoxStyle.js +93 -0
  401. package/dist/shared/getPropertyRowTextStyles.js +40 -0
  402. package/dist/shared/getSemanticColors.js +96 -0
  403. package/dist/shared/getToneColor.js +51 -0
  404. package/dist/shared/iosTextStyles.js +49 -0
  405. package/dist/shared/useBlockTokens.js +41 -0
  406. package/dist/skeleton/SkeletonFrameContext.js +21 -0
  407. package/dist/skeleton/SkeletonLine.js +46 -0
  408. package/dist/skeleton/SkeletonShape.js +140 -0
  409. package/dist/skeleton/createShimmerClock.js +57 -0
  410. package/dist/skeleton/shimmerClock.js +20 -0
  411. package/dist/skeleton/skeletonText.js +44 -0
  412. package/dist/skeleton/useShimmer.js +34 -0
  413. package/dist/types.js +23 -0
  414. package/dist/typography/TITLE_LEVEL_STYLES.js +24 -0
  415. package/dist/typography/TypographyText.js +78 -0
  416. package/dist/typography/getIosTextStyle.js +33 -0
  417. package/dist/typography/getTextStyle.js +94 -0
  418. package/dist/useComponentTokens.js +38 -0
  419. package/package.json +94 -3
@@ -0,0 +1,151 @@
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, { useContext } from 'react';
16
+ import { Platform, Pressable, Text, View } from 'react-native';
17
+ import { type } from '@lowdefy/helpers';
18
+ import ChipWidthContext from './ChipWidthContext.js';
19
+ import getChipMaxWidth from './getChipMaxWidth.js';
20
+ import getLinkChipColors from './getLinkChipColors.js';
21
+ const HEIGHT = 22;
22
+ // An inline view sits on the text's baseline; this lowers the chip so it centres on the line.
23
+ // Body text (17pt on a 22pt line) drawn in the chip's 22pt row then sits on the line's baseline.
24
+ const BASELINE_SHIFT = Platform.select({
25
+ ios: 5,
26
+ default: 3
27
+ });
28
+ /**
29
+ * A link drawn as a chip inside the text: a pill with the chip's icon (or its prefix, as `@` on
30
+ * a mention), the key in medium weight in the tone and the title after it. It is pressable when
31
+ * the Markdown has a press handler for chips.
32
+ *
33
+ * The chip lays out as a word of the text: it is as wide as its content, at most the line's
34
+ * width, or three quarters of it when text follows (getChipMaxWidth); past that the title is cut
35
+ * short with an ellipsis and the key never is. Closing punctuation after the link is drawn inside
36
+ * the chip's inline view (layoutLinkChips), so the two wrap together and a line never starts
37
+ * with it; a chip that does not fit on a line moves to the next one whole.
38
+ *
39
+ * @param {Object} props
40
+ * @param {Object} props.chip The chip's config (one of `linkChips`).
41
+ * @param {boolean} [props.followed] Text follows the chip on its line (layoutLinkChips).
42
+ * @param {string} props.href
43
+ * @param {Function} props.Icon The icon renderer (components.Icon).
44
+ * @param {string} props.linkKey The key (getLinkChip).
45
+ * @param {Function} [props.onPress] Called with the href.
46
+ * @param {Object} props.palette The Markdown's palette (getMarkdownStyles).
47
+ * @param {string|null} props.title
48
+ * @param {{ style: Object[], text: string }} [props.trailing] Punctuation drawn after the chip,
49
+ * in the styles of the text it came from (layoutLinkChips).
50
+ */ function LinkChip({ chip, followed = false, href, Icon, linkKey, onPress, palette, title, trailing = null }) {
51
+ const width = useContext(ChipWidthContext);
52
+ const colors = getLinkChipColors({
53
+ chip,
54
+ isDark: palette.isDark,
55
+ tokens: palette.tokens
56
+ });
57
+ const hasIcon = !type.isNone(chip.icon) && !type.isNone(Icon);
58
+ const label = title === null ? linkKey : `${linkKey} ${title}`;
59
+ const textStyle = {
60
+ fontSize: 15,
61
+ letterSpacing: -0.24,
62
+ lineHeight: 20
63
+ };
64
+ const pillStyle = {
65
+ alignItems: 'center',
66
+ backgroundColor: colors.background,
67
+ borderRadius: HEIGHT / 2,
68
+ flexDirection: 'row',
69
+ flexShrink: 1,
70
+ gap: 4,
71
+ height: HEIGHT,
72
+ minWidth: 0,
73
+ paddingLeft: hasIcon ? 6 : 8,
74
+ paddingRight: 8
75
+ };
76
+ const content = /*#__PURE__*/ React.createElement(React.Fragment, null, hasIcon ? /*#__PURE__*/ React.createElement(Icon, {
77
+ properties: chip.icon,
78
+ styles: {
79
+ element: {
80
+ color: colors.icon,
81
+ fontSize: 14
82
+ }
83
+ },
84
+ testID: `markdown-chip-icon-${linkKey}`
85
+ }) : null, /*#__PURE__*/ React.createElement(Text, {
86
+ numberOfLines: 1,
87
+ style: {
88
+ ...textStyle,
89
+ color: colors.key,
90
+ flexShrink: 0,
91
+ fontVariant: [
92
+ 'tabular-nums'
93
+ ],
94
+ fontWeight: '500'
95
+ }
96
+ }, linkKey), title === null ? null : /*#__PURE__*/ React.createElement(Text, {
97
+ ellipsizeMode: "tail",
98
+ numberOfLines: 1,
99
+ style: {
100
+ ...textStyle,
101
+ color: colors.title,
102
+ flexShrink: 1,
103
+ minWidth: 0
104
+ }
105
+ }, title));
106
+ const pill = type.isNone(onPress) ? /*#__PURE__*/ React.createElement(View, {
107
+ accessibilityLabel: label,
108
+ style: pillStyle,
109
+ testID: "markdown-chip"
110
+ }, content) : /*#__PURE__*/ React.createElement(Pressable, {
111
+ accessibilityLabel: label,
112
+ accessibilityRole: "link",
113
+ hitSlop: {
114
+ bottom: 6,
115
+ top: 6
116
+ },
117
+ onPress: ()=>onPress(href),
118
+ style: ({ pressed })=>[
119
+ pillStyle,
120
+ {
121
+ opacity: pressed ? 0.55 : 1
122
+ }
123
+ ],
124
+ testID: "markdown-chip"
125
+ }, content);
126
+ return /*#__PURE__*/ React.createElement(View, {
127
+ style: {
128
+ alignItems: 'center',
129
+ flexDirection: 'row',
130
+ maxWidth: getChipMaxWidth({
131
+ followed,
132
+ width
133
+ }),
134
+ transform: [
135
+ {
136
+ translateY: BASELINE_SHIFT
137
+ }
138
+ ]
139
+ },
140
+ testID: "markdown-chip-inline"
141
+ }, pill, trailing === null ? null : /*#__PURE__*/ React.createElement(Text, {
142
+ style: [
143
+ ...trailing.style,
144
+ {
145
+ flexShrink: 0
146
+ }
147
+ ],
148
+ testID: "markdown-chip-trailing"
149
+ }, trailing.text));
150
+ }
151
+ export default LinkChip;
@@ -0,0 +1,70 @@
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 } from 'react';
16
+ import MarkdownContent from './MarkdownContent.js';
17
+ import meta from './meta.js';
18
+ // GitHub-flavoured markdown drawn with React Native views in the iOS typography (MarkdownContent).
19
+ // Every pressed link, chips included, runs onLinkPress when the block has it. Without it an app
20
+ // path (`/orders/42`) opens as a page through the Link action, as a web page's link stays in the
21
+ // app, a web link opens in the in-app browser and any other link (mail, phone) through the
22
+ // system; a chip is not pressable.
23
+ function Markdown({ components, events, methods, properties, styles = {} }) {
24
+ const hasOnLinkPress = Boolean(events.onLinkPress);
25
+ const triggerLinkPress = useCallback((href)=>methods.triggerEvent({
26
+ name: 'onLinkPress',
27
+ event: {
28
+ href
29
+ }
30
+ }), [
31
+ methods
32
+ ]);
33
+ useEffect(()=>{
34
+ methods.registerEvent({
35
+ name: '__link',
36
+ actions: [
37
+ {
38
+ id: 'link',
39
+ type: 'Link',
40
+ params: {
41
+ url: {
42
+ _event: 'href'
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ });
48
+ }, [
49
+ methods
50
+ ]);
51
+ const openPath = useCallback((href)=>methods.triggerEvent({
52
+ name: '__link',
53
+ event: {
54
+ href
55
+ }
56
+ }), [
57
+ methods
58
+ ]);
59
+ return /*#__PURE__*/ React.createElement(MarkdownContent, {
60
+ components: components,
61
+ content: properties.content,
62
+ linkChips: properties.linkChips,
63
+ onLinkPress: hasOnLinkPress ? triggerLinkPress : null,
64
+ onPathPress: openPath,
65
+ skipHtml: properties.skipHtml === true,
66
+ style: styles.element
67
+ });
68
+ }
69
+ Markdown.meta = meta;
70
+ export default Markdown;
@@ -0,0 +1,67 @@
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 { ScrollView, Text, View } from 'react-native';
17
+ import getIosTextStyle from '../../typography/getIosTextStyle.js';
18
+ /**
19
+ * A fenced code block as a rounded card in the monospace font, its language (when the fence
20
+ * names one) above the code. Long lines scroll sideways rather than wrap, so code keeps its
21
+ * shape.
22
+ *
23
+ * @param {Object} props
24
+ * @param {string} [props.language]
25
+ * @param {Object} props.palette The Markdown's palette (getMarkdownStyles).
26
+ * @param {Object} [props.style] The card's style: its space below.
27
+ * @param {string} props.text
28
+ * @param {Object} props.textStyle The code's text style.
29
+ */ function MarkdownCode({ language, palette, style, text, textStyle }) {
30
+ const hasLanguage = typeof language === 'string' && language.trim() !== '';
31
+ return /*#__PURE__*/ React.createElement(View, {
32
+ style: [
33
+ {
34
+ backgroundColor: palette.codeBackground,
35
+ borderRadius: 12,
36
+ overflow: 'hidden'
37
+ },
38
+ style
39
+ ],
40
+ testID: "markdown-code"
41
+ }, hasLanguage ? /*#__PURE__*/ React.createElement(Text, {
42
+ style: [
43
+ getIosTextStyle({
44
+ color: palette.secondaryLabel,
45
+ textStyle: 'caption1',
46
+ tokens: palette.tokens
47
+ }),
48
+ {
49
+ fontWeight: '500',
50
+ paddingHorizontal: 14,
51
+ paddingTop: 10
52
+ }
53
+ ]
54
+ }, language.trim()) : null, /*#__PURE__*/ React.createElement(ScrollView, {
55
+ contentContainerStyle: {
56
+ paddingBottom: 12,
57
+ paddingHorizontal: 14,
58
+ paddingTop: hasLanguage ? 6 : 12
59
+ },
60
+ horizontal: true,
61
+ showsHorizontalScrollIndicator: false
62
+ }, /*#__PURE__*/ React.createElement(View, null, /*#__PURE__*/ React.createElement(Text, {
63
+ selectable: true,
64
+ style: textStyle
65
+ }, text))));
66
+ }
67
+ export default MarkdownCode;
@@ -0,0 +1,119 @@
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, useMemo, useState } from 'react';
16
+ import { Dimensions, Linking, View } from 'react-native';
17
+ import * as WebBrowser from 'expo-web-browser';
18
+ import { useMarkdown } from 'react-native-marked';
19
+ import ChipWidthContext from './ChipWidthContext.js';
20
+ import getMarkdownStyles from './getMarkdownStyles.js';
21
+ import MarkdownRenderer from './MarkdownRenderer.js';
22
+ import MarkdownTokenizer from './MarkdownTokenizer.js';
23
+ import trimOuterSpace from './trimOuterSpace.js';
24
+ import useComponentTokens from '../../useComponentTokens.js';
25
+ const webPattern = /^https?:\/\//i;
26
+ const appPathPattern = /^\/(?!\/)/;
27
+ /**
28
+ * GitHub-flavoured markdown drawn with React Native views in the iOS typography and the theme's
29
+ * semantic colours: the Markdown block's renderer, which AgentChat draws its replies with, so the
30
+ * two read the same. useMarkdown gives the elements rather than react-native-marked's FlatList,
31
+ * since the markdown sits in the page's scroll view; the space above the first element and below
32
+ * the last is trimmed (trimOuterSpace).
33
+ *
34
+ * Every pressed link, link chips included, runs `onLinkPress` when the host block gives one.
35
+ * Without it a web link opens in the in-app browser (expo-web-browser, its controls in the tint)
36
+ * and any other link (mail, phone) through the system, and a chip is not pressable. An app path
37
+ * (`/orders/42`) goes to `onPathPress` when the host gives one, which opens it as a page. Any
38
+ * other path in a link is taken against the app server as a browser on the app's page would
39
+ * (components.resolveUrl). An image loads through components.imageSource, which takes a path the
40
+ * same way and sends the session token to the app server's own origin alone.
41
+ *
42
+ * @param {Object} props
43
+ * @param {Object} props.components The host block's components (components.Icon for chip icons,
44
+ * components.resolveUrl for link paths, components.imageSource for images).
45
+ * @param {string} props.content
46
+ * @param {Object[]} [props.linkChips] Links drawn as inline chips, by scheme or pattern
47
+ * (schemas/linkChips).
48
+ * @param {((href: string) => void)|null} [props.onLinkPress]
49
+ * @param {((href: string) => void)|null} [props.onPathPress] Opens an app path in the app.
50
+ * @param {boolean} [props.skipHtml] Leave raw html out rather than drawing its source.
51
+ * @param {Object} [props.style]
52
+ */ function MarkdownContent({ components, content, linkChips, onLinkPress = null, onPathPress = null, skipHtml = false, style }) {
53
+ const { isDark, tokens } = useComponentTokens();
54
+ const [width, setWidth] = useState(()=>Dimensions.get('window').width - 32);
55
+ const { palette, styles: markdownStyles, theme } = useMemo(()=>getMarkdownStyles({
56
+ isDark,
57
+ tokens
58
+ }), [
59
+ isDark,
60
+ tokens
61
+ ]);
62
+ const tokenizer = useMemo(()=>new MarkdownTokenizer(), []);
63
+ const { resolveUrl } = components;
64
+ const openLink = useCallback((href)=>{
65
+ if (onLinkPress !== null) {
66
+ onLinkPress(href);
67
+ return;
68
+ }
69
+ if (onPathPress !== null && appPathPattern.test(href)) {
70
+ onPathPress(href);
71
+ return;
72
+ }
73
+ const url = resolveUrl(href);
74
+ if (webPattern.test(url)) {
75
+ WebBrowser.openBrowserAsync(url, {
76
+ controlsColor: tokens.colorTint
77
+ });
78
+ return;
79
+ }
80
+ // A scheme no app on the phone opens (an unknown `slack:`) rejects; the press does nothing.
81
+ Linking.openURL(url).catch(()=>{});
82
+ }, [
83
+ onLinkPress,
84
+ onPathPress,
85
+ resolveUrl,
86
+ tokens.colorTint
87
+ ]);
88
+ const renderer = useMemo(()=>new MarkdownRenderer({
89
+ Icon: components.Icon,
90
+ linkChips,
91
+ onChipPress: onLinkPress === null ? null : openLink,
92
+ onLinkPress: openLink,
93
+ imageSource: components.imageSource,
94
+ palette,
95
+ skipHtml
96
+ }), [
97
+ components.Icon,
98
+ components.imageSource,
99
+ linkChips,
100
+ onLinkPress,
101
+ openLink,
102
+ palette,
103
+ skipHtml
104
+ ]);
105
+ const elements = useMarkdown(content ?? '', {
106
+ colorScheme: isDark ? 'dark' : 'light',
107
+ renderer,
108
+ styles: markdownStyles,
109
+ theme,
110
+ tokenizer
111
+ });
112
+ return /*#__PURE__*/ React.createElement(View, {
113
+ onLayout: (event)=>setWidth(event.nativeEvent.layout.width),
114
+ style: style
115
+ }, /*#__PURE__*/ React.createElement(ChipWidthContext.Provider, {
116
+ value: width
117
+ }, trimOuterSpace(elements)));
118
+ }
119
+ export default MarkdownContent;
@@ -0,0 +1,77 @@
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, { useState } from 'react';
16
+ import { Text } from 'react-native';
17
+ import { Image } from 'expo-image';
18
+ const PLACEHOLDER_HEIGHT = 160;
19
+ /**
20
+ * A markdown image, loaded and cached by expo-image (svg included), in place of
21
+ * react-native-marked's MDImage: that one sized itself with Image.getSize in an effect with no
22
+ * dependencies, so it asked again on every render, and had no height when the size could not be
23
+ * read, so the image never showed. Until it loads the image holds a rounded fill; then it takes
24
+ * its own aspect ratio, as wide as it is or the width of the text, whichever is less, as a web
25
+ * page draws it. An image that fails draws its alt text, as a browser does. Give it a `key` of
26
+ * its url, so a new picture starts over.
27
+ *
28
+ * @param {Object} props
29
+ * @param {string} [props.alt]
30
+ * @param {Object} props.palette The Markdown palette (getMarkdownStyles).
31
+ * @param {{ uri: string, headers?: Object }} props.source
32
+ */ function MarkdownImage({ alt, palette, source }) {
33
+ const [size, setSize] = useState(null);
34
+ const [failed, setFailed] = useState(false);
35
+ if (failed) {
36
+ if (!alt) {
37
+ return null;
38
+ }
39
+ return /*#__PURE__*/ React.createElement(Text, {
40
+ style: [
41
+ palette.text,
42
+ {
43
+ color: palette.secondaryLabel
44
+ }
45
+ ]
46
+ }, alt);
47
+ }
48
+ const sizeStyle = size === null ? {
49
+ backgroundColor: palette.codeBackground,
50
+ height: PLACEHOLDER_HEIGHT
51
+ } : {
52
+ aspectRatio: size.width / size.height,
53
+ maxWidth: size.width
54
+ };
55
+ return /*#__PURE__*/ React.createElement(Image, {
56
+ accessibilityLabel: alt,
57
+ accessible: Boolean(alt),
58
+ cachePolicy: "memory-disk",
59
+ contentFit: "contain",
60
+ onError: ()=>setFailed(true),
61
+ onLoad: ({ source })=>setSize({
62
+ height: source.height,
63
+ width: source.width
64
+ }),
65
+ recyclingKey: source.uri,
66
+ source: source,
67
+ style: [
68
+ {
69
+ borderRadius: 10,
70
+ width: '100%'
71
+ },
72
+ sizeStyle
73
+ ],
74
+ testID: "markdown-image"
75
+ });
76
+ }
77
+ export default MarkdownImage;
@@ -0,0 +1,97 @@
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, { useContext, useMemo, useState } from 'react';
16
+ import { Text, View } from 'react-native';
17
+ import ChipWidthView from './ChipWidthView.js';
18
+ import getListMarker from './getListMarker.js';
19
+ import { ListDepthContext, ListItemContext } from './MarkdownListContext.js';
20
+ import TaskBox from './TaskBox.js';
21
+ const ITEM_GAP = 6;
22
+ function ListItem({ children, first, marker, markerWidth, palette }) {
23
+ const [task, setTask] = useState(null);
24
+ const item = useMemo(()=>({
25
+ setTask
26
+ }), []);
27
+ return /*#__PURE__*/ React.createElement(View, {
28
+ style: {
29
+ flexDirection: 'row',
30
+ marginTop: first ? 0 : ITEM_GAP
31
+ }
32
+ }, /*#__PURE__*/ React.createElement(View, {
33
+ style: {
34
+ alignItems: task === null ? 'flex-end' : 'flex-start',
35
+ width: markerWidth
36
+ }
37
+ }, task === null ? /*#__PURE__*/ React.createElement(Text, {
38
+ style: {
39
+ ...palette.text,
40
+ color: palette.secondaryLabel,
41
+ fontVariant: [
42
+ 'tabular-nums'
43
+ ],
44
+ paddingRight: 8
45
+ }
46
+ }, marker) : /*#__PURE__*/ React.createElement(TaskBox, {
47
+ checked: task.checked,
48
+ palette: palette
49
+ })), /*#__PURE__*/ React.createElement(ChipWidthView, {
50
+ style: {
51
+ flex: 1,
52
+ minWidth: 0
53
+ }
54
+ }, /*#__PURE__*/ React.createElement(ListItemContext.Provider, {
55
+ value: item
56
+ }, children)));
57
+ }
58
+ /**
59
+ * A markdown list drawn as iOS lays out text lists: each item's marker in a column of its own, so
60
+ * wrapped lines line up under the text, bullets and numbers by how deep the list sits
61
+ * (getListMarker), and a task item's box in its marker's place. A nested list sits close under
62
+ * its item; a top-level one keeps the block's space below it.
63
+ *
64
+ * @param {Object} props
65
+ * @param {React.ReactNode[]} props.items The items, as the renderer drew them.
66
+ * @param {boolean} props.ordered
67
+ * @param {Object} props.palette The Markdown's palette (getMarkdownStyles).
68
+ * @param {number} [props.start] The first item's number in an ordered list.
69
+ * @param {Object} [props.style] The list's style: its space below.
70
+ */ function MarkdownList({ items, ordered, palette, start = 1, style }) {
71
+ const depth = useContext(ListDepthContext);
72
+ const markers = items.map((_, index)=>getListMarker({
73
+ depth,
74
+ number: start + index,
75
+ ordered
76
+ }));
77
+ const longest = Math.max(...markers.map((marker)=>marker.length));
78
+ const markerWidth = ordered ? Math.max(24, 9 * longest + 8) : 22;
79
+ return /*#__PURE__*/ React.createElement(View, {
80
+ style: depth === 0 ? style : [
81
+ style,
82
+ {
83
+ marginBottom: 0,
84
+ marginTop: ITEM_GAP
85
+ }
86
+ ]
87
+ }, /*#__PURE__*/ React.createElement(ListDepthContext.Provider, {
88
+ value: depth + 1
89
+ }, items.map((item, index)=>/*#__PURE__*/ React.createElement(ListItem, {
90
+ first: index === 0,
91
+ key: index,
92
+ marker: markers[index],
93
+ markerWidth: markerWidth,
94
+ palette: palette
95
+ }, item))));
96
+ }
97
+ export default MarkdownList;
@@ -0,0 +1,22 @@
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 { createContext } from 'react';
16
+ // How deep the list being drawn sits: 0 at the top, 1 in a list item, and so on. A list reads it
17
+ // to pick its markers and gives its items one more.
18
+ const ListDepthContext = /*#__PURE__*/ createContext(0);
19
+ // The list item being drawn, which a task box in its text tells that it is a task, so the item
20
+ // draws the box where its marker goes. Null outside a list.
21
+ const ListItemContext = /*#__PURE__*/ createContext(null);
22
+ export { ListDepthContext, ListItemContext };