@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,320 @@
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 linkChips from '../../schemas/linkChips.js';
16
+ import { theme } from '../../schemas/inputProperties.js';
17
+ const actor = {
18
+ type: 'object',
19
+ description: 'Who did it. `agent: true` reads "via agent".',
20
+ properties: {
21
+ id: {
22
+ type: 'string'
23
+ },
24
+ name: {
25
+ type: 'string'
26
+ },
27
+ agent: {
28
+ type: 'boolean'
29
+ },
30
+ picture: {
31
+ type: 'string',
32
+ description: 'An avatar image url.'
33
+ }
34
+ }
35
+ };
36
+ const rule = {
37
+ type: 'object',
38
+ additionalProperties: false,
39
+ properties: {
40
+ when: {
41
+ type: 'object',
42
+ description: 'Paths into the event and the value each must hold, as `{ "what.to": "done" }`. null matches a missing value; a list matches any of its values. A rule without `when` always matches.'
43
+ },
44
+ icon: {
45
+ type: 'string',
46
+ description: 'The rail icon name.'
47
+ },
48
+ tone: {
49
+ type: 'string',
50
+ description: 'The icon colour: neutral, primary, info, success, warning, danger, a theme token name or a colour.'
51
+ },
52
+ text: {
53
+ type: 'string',
54
+ description: 'The line. `{actor}` is who did it; `{path}` is the value at a path in the event (`{what.to}`, `{subject.key}`), with filters `|humanize` ("In progress"), `|words` ("in progress") and `|lower`. Text between `**` pairs is bold. A long line shows two lines ending in an ellipsis until tapped.'
55
+ },
56
+ summary: {
57
+ type: 'string',
58
+ description: 'What the event says in a folded line of one actor’s detail events, as "recorded {n} decision{s}". Events whose summaries read the same are counted together: `{n}` is the count and `{s}` an "s" when it is not 1. Default "made {n} change{s}".'
59
+ },
60
+ note: {
61
+ type: 'string',
62
+ description: 'A template for a note drawn under the line, such as `{what.reason}`. A long note shows three lines ending in an ellipsis until its line is tapped.'
63
+ }
64
+ }
65
+ };
66
+ export default {
67
+ category: 'display',
68
+ actions: [
69
+ 'Link'
70
+ ],
71
+ operators: [
72
+ '_event'
73
+ ],
74
+ icons: [
75
+ 'ChevronDown',
76
+ 'ChevronRight',
77
+ 'CircleCheck',
78
+ 'Dot',
79
+ 'Ellipsis',
80
+ 'FaceSlightlySmilingPlus'
81
+ ],
82
+ valueType: null,
83
+ cssKeys: {
84
+ element: 'The timeline.'
85
+ },
86
+ events: {
87
+ onCopy: {
88
+ description: 'Trigger actions when Copy is picked in a comment’s menu. Use CopyToClipboard.',
89
+ event: {
90
+ comment_id: 'The comment’s id.',
91
+ body: 'The comment’s markdown.',
92
+ text: 'The comment as plain text, with mentions as @Name.'
93
+ }
94
+ },
95
+ onDelete: {
96
+ description: 'Trigger actions when Delete is confirmed in a comment’s menu.',
97
+ event: {
98
+ comment_id: 'The comment’s id.',
99
+ thread_id: 'The id of its thread’s first comment.'
100
+ }
101
+ },
102
+ onEdit: {
103
+ description: 'Trigger actions when an edited comment is saved. The edit box closes when the actions succeed.',
104
+ event: {
105
+ comment_id: 'The comment’s id.',
106
+ body: 'The new markdown, with mention tokens.'
107
+ }
108
+ },
109
+ onExpandGap: {
110
+ description: 'Trigger actions when a gap line ("14 earlier changes by …") is pressed. It reads "Loading…" while the actions run. Put the events the gap holds into `entries`.',
111
+ event: {
112
+ after: 'The gap’s `after`.',
113
+ before: 'The gap’s `before`.',
114
+ count: 'The gap’s count.',
115
+ id: 'The gap’s id.'
116
+ }
117
+ },
118
+ onLinkPress: {
119
+ description: 'Trigger actions when a link in a comment is pressed, instead of opening it. Without this event an app path (`/orders/42`) opens as a page and any other link through the system.',
120
+ event: {
121
+ href: 'The link’s href.'
122
+ }
123
+ },
124
+ onLoadReplies: {
125
+ description: 'Trigger actions when "Show N earlier replies" is pressed on a thread that has replies not in its `replies`. Add them to the thread’s `replies`.',
126
+ event: {
127
+ thread_id: 'The id of the thread’s first comment.'
128
+ }
129
+ },
130
+ onOpenRecord: {
131
+ description: 'Trigger actions when a `[[KEY]]` record link in a comment is pressed.',
132
+ event: {
133
+ key: 'The record key.'
134
+ }
135
+ },
136
+ onReact: {
137
+ description: 'Trigger actions when the viewer toggles a reaction. The pill changes at once and holds until the comment’s reactions change in `entries`; it goes back if the actions fail.',
138
+ event: {
139
+ comment_id: 'The comment’s id.',
140
+ emoji: 'The reaction.',
141
+ reacted: 'True when the viewer added the reaction, false when they took it away.'
142
+ }
143
+ },
144
+ onReply: {
145
+ description: 'Trigger actions when Reply is picked in a comment’s menu. Set the Composer’s `replyTo` to `{ id: thread_id, name }` and focus it.',
146
+ event: {
147
+ comment_id: 'The comment’s id.',
148
+ thread_id: 'The id of its thread’s first comment, which a reply is sent to.',
149
+ name: 'The comment author’s name.'
150
+ }
151
+ },
152
+ onResolve: {
153
+ description: 'Trigger actions when Resolve or Reopen is picked in a thread’s first comment’s menu.',
154
+ event: {
155
+ comment_id: 'The first comment’s id.',
156
+ resolved: 'True for Resolve, false for Reopen.'
157
+ }
158
+ },
159
+ onShowEarlier: {
160
+ description: 'Trigger actions when "Show earlier activity" is pressed, shown while `earlier` is true. Add the earlier entries to the start of `entries`.',
161
+ event: {
162
+ before: 'The time of the oldest entry shown.'
163
+ }
164
+ }
165
+ },
166
+ properties: {
167
+ type: 'object',
168
+ additionalProperties: false,
169
+ properties: {
170
+ earlier: {
171
+ type: 'boolean',
172
+ default: false,
173
+ description: 'Show "Show earlier activity" at the top, for entries before those given.'
174
+ },
175
+ emptyText: {
176
+ type: 'string',
177
+ description: 'Text shown when there are no entries. Nothing shows when not set.'
178
+ },
179
+ entries: {
180
+ type: 'array',
181
+ description: 'The activity, oldest first, drawn in the order given. An event is `{ id, at, tier, type, subject, by, what }`, or carries its own `text`, `icon`, `tone`, `summary` and `note`. A comment is `{ id, type: comment, at, by, body, edited_at, deleted, resolved: { by, at }, reactions: [{ emoji, user_ids }], replies, reply_count, mentions: [{ user_id, name, sees }] }`. A gap is `{ type: gap, id, count, actors, types, after, before }`.',
182
+ items: {
183
+ type: 'object',
184
+ properties: {
185
+ id: {
186
+ type: 'string'
187
+ },
188
+ at: {
189
+ type: [
190
+ 'string',
191
+ 'object'
192
+ ],
193
+ description: 'When it happened.'
194
+ },
195
+ type: {
196
+ type: 'string',
197
+ description: 'The event type, or `comment` or `gap`.'
198
+ },
199
+ tier: {
200
+ type: 'string',
201
+ enum: [
202
+ 'key',
203
+ 'detail'
204
+ ],
205
+ description: 'Detail events by one actor in a row fold into one line; key events always show on their own.'
206
+ },
207
+ by: actor
208
+ }
209
+ }
210
+ },
211
+ foldDetail: {
212
+ type: 'boolean',
213
+ default: true,
214
+ description: 'Fold detail events by one actor in a row into one line.'
215
+ },
216
+ formatEvent: {
217
+ type: 'object',
218
+ description: 'How each event type is drawn: a rule, or a list of rules of which the first whose `when` matches is used, by event type. `default` holds the rule under every type’s (the default: icon `Dot`, tone neutral, text "{actor} {type|words}").',
219
+ additionalProperties: {
220
+ anyOf: [
221
+ rule,
222
+ {
223
+ type: 'array',
224
+ items: rule
225
+ }
226
+ ]
227
+ }
228
+ },
229
+ gaps: {
230
+ type: 'array',
231
+ description: 'Gaps placed among the entries by time: after the entries up to `after` (a time, or a cursor `<time>~<id>`), or before the entries from `before`. Each is `{ after, before, count, actors, types }`.',
232
+ items: {
233
+ type: 'object',
234
+ properties: {
235
+ after: {
236
+ type: [
237
+ 'string',
238
+ 'null'
239
+ ]
240
+ },
241
+ before: {
242
+ type: [
243
+ 'string',
244
+ 'null'
245
+ ]
246
+ },
247
+ count: {
248
+ type: 'integer'
249
+ },
250
+ actors: {
251
+ type: 'array',
252
+ items: actor
253
+ },
254
+ text: {
255
+ type: 'string',
256
+ description: 'The line, instead of the counted one.'
257
+ }
258
+ }
259
+ }
260
+ },
261
+ linkChips: {
262
+ ...linkChips,
263
+ description: "Links in comment bodies drawn as inline chips by their address scheme or a pattern on the address, as the Markdown block's `linkChips`: a pressed chip fires onLinkPress, and without onLinkPress chips are not pressable. Mentions and `[[KEY]]` record links keep their own chips."
264
+ },
265
+ maxLength: {
266
+ type: 'integer',
267
+ default: 4000,
268
+ description: 'The longest comment the edit box saves.'
269
+ },
270
+ members: {
271
+ type: 'array',
272
+ description: 'People by id, `[{ value, label, picture }]`, to name an actor given only by id and for avatar pictures.'
273
+ },
274
+ mentionFormat: {
275
+ type: 'string',
276
+ default: '[[user:{id}]]',
277
+ description: 'How a mention is written in a comment body. `{id}` is the person’s id.'
278
+ },
279
+ mentions: {
280
+ type: 'array',
281
+ description: 'The people who can be mentioned in the edit box, `[{ value, label, sees }]`, as the Composer takes them. Also names mentions a comment’s own `mentions` does not.'
282
+ },
283
+ reactions: {
284
+ type: 'array',
285
+ items: {
286
+ type: 'string'
287
+ },
288
+ default: [
289
+ '👍',
290
+ '👎',
291
+ '❤️',
292
+ '🎉',
293
+ '😄',
294
+ '👀',
295
+ '🙏',
296
+ '✅'
297
+ ],
298
+ description: 'The reactions the picker offers.'
299
+ },
300
+ repliesShown: {
301
+ type: 'integer',
302
+ default: 3,
303
+ description: 'How many of a thread’s newest replies show before "Show N earlier replies".'
304
+ },
305
+ theme,
306
+ user: {
307
+ type: 'object',
308
+ description: 'The viewer, `{ id, admin }`. Edit shows on their own comments, Delete on their own and, for an admin, on any. Reactions need an id.',
309
+ properties: {
310
+ id: {
311
+ type: 'string'
312
+ },
313
+ admin: {
314
+ type: 'boolean'
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ };
@@ -0,0 +1,43 @@
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 { MENTION_SCHEME, RECORD_SCHEME } from './toTimelineMarkdown.js';
16
+ /**
17
+ * What a link in a comment body points at: a mention chip, a record, or a plain link.
18
+ *
19
+ * @param {string} href
20
+ * @returns {{ kind: 'mention', name: string, muted: boolean } | { kind: 'record', key: string } | { kind: 'link', href: string }}
21
+ */ function parseTimelineHref(href) {
22
+ const text = String(href ?? '');
23
+ if (text.startsWith(MENTION_SCHEME)) {
24
+ const rest = text.slice(MENTION_SCHEME.length);
25
+ const cut = rest.indexOf(':');
26
+ return {
27
+ kind: 'mention',
28
+ muted: rest.slice(0, cut) === 'muted',
29
+ name: decodeURIComponent(rest.slice(cut + 1))
30
+ };
31
+ }
32
+ if (text.startsWith(RECORD_SCHEME)) {
33
+ return {
34
+ kind: 'record',
35
+ key: decodeURIComponent(text.slice(RECORD_SCHEME.length))
36
+ };
37
+ }
38
+ return {
39
+ kind: 'link',
40
+ href: text
41
+ };
42
+ }
43
+ export default parseTimelineHref;
@@ -0,0 +1,69 @@
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 { get, type } from '@lowdefy/helpers';
16
+ export const DEFAULT_RULE = {
17
+ icon: 'Dot',
18
+ tone: 'neutral',
19
+ text: '{actor} {type|words}',
20
+ summary: 'made {n} change{s}'
21
+ };
22
+ // A rule's `when` matches when every path in it holds the value given: null matches a missing
23
+ // value, and a list matches any value in it.
24
+ function matches({ entry, when }) {
25
+ if (!type.isObject(when)) {
26
+ return true;
27
+ }
28
+ return Object.entries(when).every(([path, expected])=>{
29
+ const value = get(entry, path, {
30
+ default: null
31
+ });
32
+ if (type.isArray(expected)) {
33
+ return expected.some((option)=>type.isNone(option) ? type.isNone(value) : option === value);
34
+ }
35
+ if (type.isNone(expected)) {
36
+ return type.isNone(value);
37
+ }
38
+ return value === expected;
39
+ });
40
+ }
41
+ /**
42
+ * How an event is drawn: the first rule for its type in `formatEvent` whose `when` matches,
43
+ * over `formatEvent.default`, over the block's default rule. `formatEvent[type]` is one rule or a
44
+ * list of rules.
45
+ *
46
+ * @param {Object} params
47
+ * @param {Object} params.entry The event.
48
+ * @param {Object} [params.formatEvent] Rules by event type, and `default`.
49
+ * @returns {{ icon: string, tone: string, text: string, summary: string, note?: string }}
50
+ */ function selectEventRule({ entry, formatEvent }) {
51
+ const rules = formatEvent ?? {};
52
+ const base = {
53
+ ...DEFAULT_RULE,
54
+ ...type.isObject(rules.default) ? rules.default : {}
55
+ };
56
+ const forType = Object.hasOwn(rules, entry.type) ? rules[entry.type] : null;
57
+ const candidates = type.isArray(forType) ? forType : [
58
+ forType
59
+ ];
60
+ const rule = candidates.find((candidate)=>type.isObject(candidate) && matches({
61
+ entry,
62
+ when: candidate.when
63
+ }));
64
+ return {
65
+ ...base,
66
+ ...rule ?? {}
67
+ };
68
+ }
69
+ export default selectEventRule;
@@ -0,0 +1,51 @@
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 { type } from '@lowdefy/helpers';
16
+ import fillText from './fillText.js';
17
+ import joinList from './joinList.js';
18
+ import selectEventRule from './selectEventRule.js';
19
+ /**
20
+ * What a run of one actor's events did, said once: "edited the body and recorded 3 decisions".
21
+ * Each event's `summary` template (its own, else its rule's) is filled from the event; events
22
+ * whose summaries read the same are counted together, with `{n}` their count and `{s}` an "s"
23
+ * when it is not 1. Phrases keep the order their first event came in.
24
+ *
25
+ * @param {Object} params
26
+ * @param {Object[]} params.entries The events, oldest first.
27
+ * @param {Object} [params.formatEvent]
28
+ * @returns {string}
29
+ */ function summariseEvents({ entries, formatEvent }) {
30
+ const counts = new Map();
31
+ entries.forEach((entry)=>{
32
+ const template = type.isString(entry.summary) ? entry.summary : selectEventRule({
33
+ entry,
34
+ formatEvent
35
+ }).summary;
36
+ const phrase = fillText({
37
+ template,
38
+ entry,
39
+ keep: [
40
+ 'n',
41
+ 's'
42
+ ]
43
+ });
44
+ counts.set(phrase, (counts.get(phrase) ?? 0) + 1);
45
+ });
46
+ const phrases = [
47
+ ...counts.entries()
48
+ ].map(([phrase, count])=>phrase.replaceAll('{n}', String(count)).replaceAll('{s}', count === 1 ? '' : 's'));
49
+ return joinList(phrases);
50
+ }
51
+ export default summariseEvents;
@@ -0,0 +1,32 @@
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 { type } from '@lowdefy/helpers';
16
+ /**
17
+ * A comment body as a person copies it: each mention token as "@Name".
18
+ *
19
+ * @param {Object} params
20
+ * @param {string} params.body
21
+ * @param {Array<{ user_id: string, name: string }>} [params.mentions]
22
+ * @param {Map<string, { label: string }>} [params.people]
23
+ * @param {RegExp} params.pattern A global mention pattern (createMentionPattern).
24
+ * @returns {string}
25
+ */ function toPlainText({ body, mentions, people, pattern }) {
26
+ const named = new Map((mentions ?? []).map((mention)=>[
27
+ mention.user_id,
28
+ mention.name
29
+ ]));
30
+ return (type.isString(body) ? body : '').replace(pattern, (token, id)=>`@${named.get(id) ?? people?.get(id)?.label ?? 'Unknown'}`);
31
+ }
32
+ export default toPlainText;
@@ -0,0 +1,36 @@
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 { type } from '@lowdefy/helpers';
16
+ /**
17
+ * Milliseconds since the epoch for a Date, an ISO string or a number; for a paging cursor
18
+ * `<ISO date>~<id>`, the time of its date. Null when there is no valid time.
19
+ *
20
+ * @param {Date|string|number} value
21
+ * @returns {number|null}
22
+ */ function toTime(value) {
23
+ if (type.isNone(value)) {
24
+ return null;
25
+ }
26
+ let date = value;
27
+ if (type.isString(value)) {
28
+ const cut = value.indexOf('~');
29
+ date = new Date(cut < 0 ? value : value.slice(0, cut));
30
+ } else if (!type.isDate(value)) {
31
+ date = new Date(value);
32
+ }
33
+ const time = date.getTime();
34
+ return Number.isNaN(time) ? null : time;
35
+ }
36
+ export default toTime;
@@ -0,0 +1,57 @@
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 { type } from '@lowdefy/helpers';
16
+ // react-native-marked passes an href through as is only when its scheme is letters alone.
17
+ export const MENTION_SCHEME = 'lowdefymention:';
18
+ export const RECORD_SCHEME = 'lowdefyrecord:';
19
+ // Code spans and fenced blocks keep their text as written.
20
+ const CODE = /(```[\s\S]*?```|`[^`\n]*`)/;
21
+ const RECORD_LINK = /\[\[([^[\]\n]+)\]\]/g;
22
+ // encodeURIComponent leaves parentheses, which would end a markdown link's href.
23
+ function encode(text) {
24
+ return encodeURIComponent(text).replace(/\(/g, '%28').replace(/\)/g, '%29');
25
+ }
26
+ /**
27
+ * A comment body as the Markdown renderer takes it: each mention token becomes a link with the
28
+ * mention scheme (`lowdefymention:<seen|muted>:<name>`), drawn as an @Name chip, and each other
29
+ * `[[KEY]]` a link with the record scheme (`lowdefyrecord:<KEY>`). A mention is muted when the
30
+ * person named does not see the record. Names come from the comment's mentions, then `people`.
31
+ *
32
+ * @param {Object} params
33
+ * @param {string} params.body
34
+ * @param {Array<{ user_id: string, name: string, sees?: boolean }>} [params.mentions]
35
+ * @param {Map<string, { label: string, sees?: boolean }>} [params.people]
36
+ * @param {RegExp} params.pattern A global mention pattern (createMentionPattern).
37
+ * @returns {string}
38
+ */ function toTimelineMarkdown({ body, mentions, people, pattern }) {
39
+ const named = new Map((mentions ?? []).map((mention)=>[
40
+ mention.user_id,
41
+ mention
42
+ ]));
43
+ const linkMention = (token, id)=>{
44
+ const mention = named.get(id);
45
+ const person = people?.get(id);
46
+ const name = mention?.name ?? person?.label ?? 'Unknown';
47
+ const sees = (mention?.sees ?? person?.sees) !== false;
48
+ return `[@](${MENTION_SCHEME}${sees ? 'seen' : 'muted'}:${encode(name)})`;
49
+ };
50
+ return (type.isString(body) ? body : '').split(CODE).map((part, index)=>{
51
+ if (index % 2 === 1) {
52
+ return part;
53
+ }
54
+ return part.replace(pattern, linkMention).replace(RECORD_LINK, (token, key)=>`[${key}](${RECORD_SCHEME}${encode(key)})`);
55
+ }).join('');
56
+ }
57
+ export default toTimelineMarkdown;
@@ -0,0 +1,74 @@
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 { type } from '@lowdefy/helpers';
16
+ /**
17
+ * A comment's reactions with the viewer's own reaction of `emoji` turned on or off, as the
18
+ * server will have them once the reaction is saved, so the pill changes at once. Works on
19
+ * { emoji, user_ids } and on counted { emoji, count, mine } reactions.
20
+ *
21
+ * @param {Object} params
22
+ * @param {Object[]} [params.reactions]
23
+ * @param {string} params.emoji
24
+ * @param {string} params.userId
25
+ * @returns {{ reactions: Object[], reacted: boolean }} The reactions, and whether the viewer
26
+ * now has the reaction.
27
+ */ function toggleReaction({ reactions, emoji, userId }) {
28
+ const next = (reactions ?? []).map((reaction)=>({
29
+ ...reaction,
30
+ ...type.isArray(reaction.user_ids) ? {
31
+ user_ids: [
32
+ ...reaction.user_ids
33
+ ]
34
+ } : {}
35
+ }));
36
+ const index = next.findIndex((reaction)=>reaction.emoji === emoji);
37
+ if (index < 0) {
38
+ next.push({
39
+ emoji,
40
+ user_ids: [
41
+ userId
42
+ ]
43
+ });
44
+ return {
45
+ reactions: next,
46
+ reacted: true
47
+ };
48
+ }
49
+ const reaction = next[index];
50
+ let reacted;
51
+ if (type.isArray(reaction.user_ids)) {
52
+ const at = reaction.user_ids.indexOf(userId);
53
+ reacted = at < 0;
54
+ if (reacted) {
55
+ reaction.user_ids.push(userId);
56
+ } else {
57
+ reaction.user_ids.splice(at, 1);
58
+ }
59
+ if (reaction.user_ids.length === 0) next.splice(index, 1);
60
+ return {
61
+ reactions: next,
62
+ reacted
63
+ };
64
+ }
65
+ reacted = reaction.mine !== true;
66
+ reaction.mine = reacted;
67
+ reaction.count = Math.max(0, (reaction.count ?? 0) + (reacted ? 1 : -1));
68
+ if (reaction.count === 0) next.splice(index, 1);
69
+ return {
70
+ reactions: next,
71
+ reacted
72
+ };
73
+ }
74
+ export default toggleReaction;