@veridid/workflow-ui 0.0.0-stage → 0.1.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 (430) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +202 -2
  3. package/build/module/WorkflowFontScaleContext.js +67 -0
  4. package/build/module/WorkflowFontScaleContext.js.map +1 -0
  5. package/build/module/adapter/WalletAdapter.js +152 -0
  6. package/build/module/adapter/WalletAdapter.js.map +1 -0
  7. package/build/module/components/FallbackVideoPlayer.js +8 -0
  8. package/build/module/components/FallbackVideoPlayer.js.map +1 -0
  9. package/build/module/components/FallbackVideoPlayer.native.js +10 -0
  10. package/build/module/components/FallbackVideoPlayer.native.js.map +1 -0
  11. package/build/module/components/FallbackVideoPlayer.web.js +35 -0
  12. package/build/module/components/FallbackVideoPlayer.web.js.map +1 -0
  13. package/build/module/components/WorkflowButtonLabel.js +32 -0
  14. package/build/module/components/WorkflowButtonLabel.js.map +1 -0
  15. package/build/module/components/WorkflowCalendarIcon.js +73 -0
  16. package/build/module/components/WorkflowCalendarIcon.js.map +1 -0
  17. package/build/module/components/WorkflowText.js +92 -0
  18. package/build/module/components/WorkflowText.js.map +1 -0
  19. package/build/module/content/BadgeContent.js +73 -0
  20. package/build/module/content/BadgeContent.js.map +1 -0
  21. package/build/module/content/BarChartContent.js +97 -0
  22. package/build/module/content/BarChartContent.js.map +1 -0
  23. package/build/module/content/BarcodeContent.js +78 -0
  24. package/build/module/content/BarcodeContent.js.map +1 -0
  25. package/build/module/content/BasicTableContent.js +145 -0
  26. package/build/module/content/BasicTableContent.js.map +1 -0
  27. package/build/module/content/ButtonContent.js +130 -0
  28. package/build/module/content/ButtonContent.js.map +1 -0
  29. package/build/module/content/CalendarContent.js +173 -0
  30. package/build/module/content/CalendarContent.js.map +1 -0
  31. package/build/module/content/CardContent.js +114 -0
  32. package/build/module/content/CardContent.js.map +1 -0
  33. package/build/module/content/CarouselContent.js +173 -0
  34. package/build/module/content/CarouselContent.js.map +1 -0
  35. package/build/module/content/ChipContent.js +214 -0
  36. package/build/module/content/ChipContent.js.map +1 -0
  37. package/build/module/content/ChipRowContent.js +127 -0
  38. package/build/module/content/ChipRowContent.js.map +1 -0
  39. package/build/module/content/CredentialOfferContent.js +312 -0
  40. package/build/module/content/CredentialOfferContent.js.map +1 -0
  41. package/build/module/content/DialContent.js +101 -0
  42. package/build/module/content/DialContent.js.map +1 -0
  43. package/build/module/content/DividerContent.js +26 -0
  44. package/build/module/content/DividerContent.js.map +1 -0
  45. package/build/module/content/DonutChartContent.js +118 -0
  46. package/build/module/content/DonutChartContent.js.map +1 -0
  47. package/build/module/content/FormContent.js +141 -0
  48. package/build/module/content/FormContent.js.map +1 -0
  49. package/build/module/content/FormFieldBridge.js +157 -0
  50. package/build/module/content/FormFieldBridge.js.map +1 -0
  51. package/build/module/content/GaugeContent.js +77 -0
  52. package/build/module/content/GaugeContent.js.map +1 -0
  53. package/build/module/content/GridLayoutContent.js +227 -0
  54. package/build/module/content/GridLayoutContent.js.map +1 -0
  55. package/build/module/content/ImageContent.js +190 -0
  56. package/build/module/content/ImageContent.js.map +1 -0
  57. package/build/module/content/ListContent.js +107 -0
  58. package/build/module/content/ListContent.js.map +1 -0
  59. package/build/module/content/LocationContent.js +148 -0
  60. package/build/module/content/LocationContent.js.map +1 -0
  61. package/build/module/content/MapContent.js +213 -0
  62. package/build/module/content/MapContent.js.map +1 -0
  63. package/build/module/content/MultipleChoiceContent.js +91 -0
  64. package/build/module/content/MultipleChoiceContent.js.map +1 -0
  65. package/build/module/content/OpenBadgePreviewContent.js +141 -0
  66. package/build/module/content/OpenBadgePreviewContent.js.map +1 -0
  67. package/build/module/content/PhotoContent.js +154 -0
  68. package/build/module/content/PhotoContent.js.map +1 -0
  69. package/build/module/content/PieChartContent.js +129 -0
  70. package/build/module/content/PieChartContent.js.map +1 -0
  71. package/build/module/content/ProofPresentationContent.js +154 -0
  72. package/build/module/content/ProofPresentationContent.js.map +1 -0
  73. package/build/module/content/RadioButtonContent.js +136 -0
  74. package/build/module/content/RadioButtonContent.js.map +1 -0
  75. package/build/module/content/RowContent.js +539 -0
  76. package/build/module/content/RowContent.js.map +1 -0
  77. package/build/module/content/SectionContent.js +123 -0
  78. package/build/module/content/SectionContent.js.map +1 -0
  79. package/build/module/content/ShareEntryContent.js +111 -0
  80. package/build/module/content/ShareEntryContent.js.map +1 -0
  81. package/build/module/content/SimulatedHint.js +33 -0
  82. package/build/module/content/SimulatedHint.js.map +1 -0
  83. package/build/module/content/SliderContent.js +46 -0
  84. package/build/module/content/SliderContent.js.map +1 -0
  85. package/build/module/content/SpacerContent.js +21 -0
  86. package/build/module/content/SpacerContent.js.map +1 -0
  87. package/build/module/content/SpinnerContent.js +33 -0
  88. package/build/module/content/SpinnerContent.js.map +1 -0
  89. package/build/module/content/SubmitButtonContent.js +281 -0
  90. package/build/module/content/SubmitButtonContent.js.map +1 -0
  91. package/build/module/content/TextContent.js +127 -0
  92. package/build/module/content/TextContent.js.map +1 -0
  93. package/build/module/content/TileContent.js +237 -0
  94. package/build/module/content/TileContent.js.map +1 -0
  95. package/build/module/content/TimelineContent.js +120 -0
  96. package/build/module/content/TimelineContent.js.map +1 -0
  97. package/build/module/content/TitleContent.js +55 -0
  98. package/build/module/content/TitleContent.js.map +1 -0
  99. package/build/module/content/VideoContent.js +142 -0
  100. package/build/module/content/VideoContent.js.map +1 -0
  101. package/build/module/content/WebLinkContent.js +95 -0
  102. package/build/module/content/WebLinkContent.js.map +1 -0
  103. package/build/module/content/index.js +48 -0
  104. package/build/module/content/index.js.map +1 -0
  105. package/build/module/form-fields/CheckboxField.js +47 -0
  106. package/build/module/form-fields/CheckboxField.js.map +1 -0
  107. package/build/module/form-fields/DateField.js +8 -0
  108. package/build/module/form-fields/DateField.js.map +1 -0
  109. package/build/module/form-fields/DateField.native.js +141 -0
  110. package/build/module/form-fields/DateField.native.js.map +1 -0
  111. package/build/module/form-fields/DateField.web.js +45 -0
  112. package/build/module/form-fields/DateField.web.js.map +1 -0
  113. package/build/module/form-fields/DropdownField.js +172 -0
  114. package/build/module/form-fields/DropdownField.js.map +1 -0
  115. package/build/module/form-fields/MCQField.js +100 -0
  116. package/build/module/form-fields/MCQField.js.map +1 -0
  117. package/build/module/form-fields/RadioField.js +56 -0
  118. package/build/module/form-fields/RadioField.js.map +1 -0
  119. package/build/module/form-fields/SliderField.js +8 -0
  120. package/build/module/form-fields/SliderField.js.map +1 -0
  121. package/build/module/form-fields/SliderField.native.js +77 -0
  122. package/build/module/form-fields/SliderField.native.js.map +1 -0
  123. package/build/module/form-fields/SliderField.web.js +82 -0
  124. package/build/module/form-fields/SliderField.web.js.map +1 -0
  125. package/build/module/form-fields/SubmitButtonField.js +42 -0
  126. package/build/module/form-fields/SubmitButtonField.js.map +1 -0
  127. package/build/module/form-fields/TextField.js +56 -0
  128. package/build/module/form-fields/TextField.js.map +1 -0
  129. package/build/module/form-fields/index.js +15 -0
  130. package/build/module/form-fields/index.js.map +1 -0
  131. package/build/module/i18n/WorkflowI18n.js +94 -0
  132. package/build/module/i18n/WorkflowI18n.js.map +1 -0
  133. package/build/module/icons/WorkflowIcon.js +50 -0
  134. package/build/module/icons/WorkflowIcon.js.map +1 -0
  135. package/build/module/imageUriCache.js +25 -0
  136. package/build/module/imageUriCache.js.map +1 -0
  137. package/build/module/index.js +49 -0
  138. package/build/module/index.js.map +1 -0
  139. package/build/module/modal/WorkflowModal.js +115 -0
  140. package/build/module/modal/WorkflowModal.js.map +1 -0
  141. package/build/module/package.json +1 -0
  142. package/build/module/platform/platformName.js +10 -0
  143. package/build/module/platform/platformName.js.map +1 -0
  144. package/build/module/platform/platformName.web.js +5 -0
  145. package/build/module/platform/platformName.web.js.map +1 -0
  146. package/build/module/protocol/controlSnapshotStore.js +19 -0
  147. package/build/module/protocol/controlSnapshotStore.js.map +1 -0
  148. package/build/module/protocol/useProtocolExchange.js +168 -0
  149. package/build/module/protocol/useProtocolExchange.js.map +1 -0
  150. package/build/module/registries/ContentRegistry.js +53 -0
  151. package/build/module/registries/ContentRegistry.js.map +1 -0
  152. package/build/module/registries/FormFieldRegistry.js +56 -0
  153. package/build/module/registries/FormFieldRegistry.js.map +1 -0
  154. package/build/module/render/NodeBoundary.js +73 -0
  155. package/build/module/render/NodeBoundary.js.map +1 -0
  156. package/build/module/render/RenderTree.js +52 -0
  157. package/build/module/render/RenderTree.js.map +1 -0
  158. package/build/module/render/WorkflowRenderContext.js +34 -0
  159. package/build/module/render/WorkflowRenderContext.js.map +1 -0
  160. package/build/module/render/nodes.js +103 -0
  161. package/build/module/render/nodes.js.map +1 -0
  162. package/build/module/responsive/ResponsiveProvider.js +63 -0
  163. package/build/module/responsive/ResponsiveProvider.js.map +1 -0
  164. package/build/module/responsive/index.js +4 -0
  165. package/build/module/responsive/index.js.map +1 -0
  166. package/build/module/responsive/responsive.js +56 -0
  167. package/build/module/responsive/responsive.js.map +1 -0
  168. package/build/module/style/resolveDisplayHintStyle.js +145 -0
  169. package/build/module/style/resolveDisplayHintStyle.js.map +1 -0
  170. package/build/module/theme/WorkflowTheme.js +200 -0
  171. package/build/module/theme/WorkflowTheme.js.map +1 -0
  172. package/build/module/utils/testable.js +12 -0
  173. package/build/module/utils/testable.js.map +1 -0
  174. package/build/typescript/WorkflowFontScaleContext.d.ts +7 -0
  175. package/build/typescript/WorkflowFontScaleContext.d.ts.map +1 -0
  176. package/build/typescript/adapter/WalletAdapter.d.ts +145 -0
  177. package/build/typescript/adapter/WalletAdapter.d.ts.map +1 -0
  178. package/build/typescript/components/FallbackVideoPlayer.d.ts +6 -0
  179. package/build/typescript/components/FallbackVideoPlayer.d.ts.map +1 -0
  180. package/build/typescript/components/FallbackVideoPlayer.native.d.ts +7 -0
  181. package/build/typescript/components/FallbackVideoPlayer.native.d.ts.map +1 -0
  182. package/build/typescript/components/FallbackVideoPlayer.web.d.ts +9 -0
  183. package/build/typescript/components/FallbackVideoPlayer.web.d.ts.map +1 -0
  184. package/build/typescript/components/WorkflowButtonLabel.d.ts +11 -0
  185. package/build/typescript/components/WorkflowButtonLabel.d.ts.map +1 -0
  186. package/build/typescript/components/WorkflowCalendarIcon.d.ts +11 -0
  187. package/build/typescript/components/WorkflowCalendarIcon.d.ts.map +1 -0
  188. package/build/typescript/components/WorkflowText.d.ts +13 -0
  189. package/build/typescript/components/WorkflowText.d.ts.map +1 -0
  190. package/build/typescript/content/BadgeContent.d.ts +5 -0
  191. package/build/typescript/content/BadgeContent.d.ts.map +1 -0
  192. package/build/typescript/content/BarChartContent.d.ts +5 -0
  193. package/build/typescript/content/BarChartContent.d.ts.map +1 -0
  194. package/build/typescript/content/BarcodeContent.d.ts +11 -0
  195. package/build/typescript/content/BarcodeContent.d.ts.map +1 -0
  196. package/build/typescript/content/BasicTableContent.d.ts +5 -0
  197. package/build/typescript/content/BasicTableContent.d.ts.map +1 -0
  198. package/build/typescript/content/ButtonContent.d.ts +5 -0
  199. package/build/typescript/content/ButtonContent.d.ts.map +1 -0
  200. package/build/typescript/content/CalendarContent.d.ts +19 -0
  201. package/build/typescript/content/CalendarContent.d.ts.map +1 -0
  202. package/build/typescript/content/CardContent.d.ts +5 -0
  203. package/build/typescript/content/CardContent.d.ts.map +1 -0
  204. package/build/typescript/content/CarouselContent.d.ts +5 -0
  205. package/build/typescript/content/CarouselContent.d.ts.map +1 -0
  206. package/build/typescript/content/ChipContent.d.ts +5 -0
  207. package/build/typescript/content/ChipContent.d.ts.map +1 -0
  208. package/build/typescript/content/ChipRowContent.d.ts +8 -0
  209. package/build/typescript/content/ChipRowContent.d.ts.map +1 -0
  210. package/build/typescript/content/CredentialOfferContent.d.ts +98 -0
  211. package/build/typescript/content/CredentialOfferContent.d.ts.map +1 -0
  212. package/build/typescript/content/DialContent.d.ts +5 -0
  213. package/build/typescript/content/DialContent.d.ts.map +1 -0
  214. package/build/typescript/content/DividerContent.d.ts +5 -0
  215. package/build/typescript/content/DividerContent.d.ts.map +1 -0
  216. package/build/typescript/content/DonutChartContent.d.ts +5 -0
  217. package/build/typescript/content/DonutChartContent.d.ts.map +1 -0
  218. package/build/typescript/content/FormContent.d.ts +19 -0
  219. package/build/typescript/content/FormContent.d.ts.map +1 -0
  220. package/build/typescript/content/FormFieldBridge.d.ts +2 -0
  221. package/build/typescript/content/FormFieldBridge.d.ts.map +1 -0
  222. package/build/typescript/content/GaugeContent.d.ts +5 -0
  223. package/build/typescript/content/GaugeContent.d.ts.map +1 -0
  224. package/build/typescript/content/GridLayoutContent.d.ts +5 -0
  225. package/build/typescript/content/GridLayoutContent.d.ts.map +1 -0
  226. package/build/typescript/content/ImageContent.d.ts +5 -0
  227. package/build/typescript/content/ImageContent.d.ts.map +1 -0
  228. package/build/typescript/content/ListContent.d.ts +5 -0
  229. package/build/typescript/content/ListContent.d.ts.map +1 -0
  230. package/build/typescript/content/LocationContent.d.ts +32 -0
  231. package/build/typescript/content/LocationContent.d.ts.map +1 -0
  232. package/build/typescript/content/MapContent.d.ts +11 -0
  233. package/build/typescript/content/MapContent.d.ts.map +1 -0
  234. package/build/typescript/content/MultipleChoiceContent.d.ts +5 -0
  235. package/build/typescript/content/MultipleChoiceContent.d.ts.map +1 -0
  236. package/build/typescript/content/OpenBadgePreviewContent.d.ts +14 -0
  237. package/build/typescript/content/OpenBadgePreviewContent.d.ts.map +1 -0
  238. package/build/typescript/content/PhotoContent.d.ts +57 -0
  239. package/build/typescript/content/PhotoContent.d.ts.map +1 -0
  240. package/build/typescript/content/PieChartContent.d.ts +5 -0
  241. package/build/typescript/content/PieChartContent.d.ts.map +1 -0
  242. package/build/typescript/content/ProofPresentationContent.d.ts +14 -0
  243. package/build/typescript/content/ProofPresentationContent.d.ts.map +1 -0
  244. package/build/typescript/content/RadioButtonContent.d.ts +5 -0
  245. package/build/typescript/content/RadioButtonContent.d.ts.map +1 -0
  246. package/build/typescript/content/RowContent.d.ts +5 -0
  247. package/build/typescript/content/RowContent.d.ts.map +1 -0
  248. package/build/typescript/content/SectionContent.d.ts +5 -0
  249. package/build/typescript/content/SectionContent.d.ts.map +1 -0
  250. package/build/typescript/content/ShareEntryContent.d.ts +15 -0
  251. package/build/typescript/content/ShareEntryContent.d.ts.map +1 -0
  252. package/build/typescript/content/SimulatedHint.d.ts +9 -0
  253. package/build/typescript/content/SimulatedHint.d.ts.map +1 -0
  254. package/build/typescript/content/SliderContent.d.ts +10 -0
  255. package/build/typescript/content/SliderContent.d.ts.map +1 -0
  256. package/build/typescript/content/SpacerContent.d.ts +5 -0
  257. package/build/typescript/content/SpacerContent.d.ts.map +1 -0
  258. package/build/typescript/content/SpinnerContent.d.ts +5 -0
  259. package/build/typescript/content/SpinnerContent.d.ts.map +1 -0
  260. package/build/typescript/content/SubmitButtonContent.d.ts +9 -0
  261. package/build/typescript/content/SubmitButtonContent.d.ts.map +1 -0
  262. package/build/typescript/content/TextContent.d.ts +5 -0
  263. package/build/typescript/content/TextContent.d.ts.map +1 -0
  264. package/build/typescript/content/TileContent.d.ts +5 -0
  265. package/build/typescript/content/TileContent.d.ts.map +1 -0
  266. package/build/typescript/content/TimelineContent.d.ts +5 -0
  267. package/build/typescript/content/TimelineContent.d.ts.map +1 -0
  268. package/build/typescript/content/TitleContent.d.ts +5 -0
  269. package/build/typescript/content/TitleContent.d.ts.map +1 -0
  270. package/build/typescript/content/VideoContent.d.ts +10 -0
  271. package/build/typescript/content/VideoContent.d.ts.map +1 -0
  272. package/build/typescript/content/WebLinkContent.d.ts +5 -0
  273. package/build/typescript/content/WebLinkContent.d.ts.map +1 -0
  274. package/build/typescript/content/index.d.ts +46 -0
  275. package/build/typescript/content/index.d.ts.map +1 -0
  276. package/build/typescript/form-fields/CheckboxField.d.ts +5 -0
  277. package/build/typescript/form-fields/CheckboxField.d.ts.map +1 -0
  278. package/build/typescript/form-fields/DateField.d.ts +6 -0
  279. package/build/typescript/form-fields/DateField.d.ts.map +1 -0
  280. package/build/typescript/form-fields/DateField.native.d.ts +5 -0
  281. package/build/typescript/form-fields/DateField.native.d.ts.map +1 -0
  282. package/build/typescript/form-fields/DateField.web.d.ts +9 -0
  283. package/build/typescript/form-fields/DateField.web.d.ts.map +1 -0
  284. package/build/typescript/form-fields/DropdownField.d.ts +5 -0
  285. package/build/typescript/form-fields/DropdownField.d.ts.map +1 -0
  286. package/build/typescript/form-fields/MCQField.d.ts +5 -0
  287. package/build/typescript/form-fields/MCQField.d.ts.map +1 -0
  288. package/build/typescript/form-fields/RadioField.d.ts +5 -0
  289. package/build/typescript/form-fields/RadioField.d.ts.map +1 -0
  290. package/build/typescript/form-fields/SliderField.d.ts +6 -0
  291. package/build/typescript/form-fields/SliderField.d.ts.map +1 -0
  292. package/build/typescript/form-fields/SliderField.native.d.ts +5 -0
  293. package/build/typescript/form-fields/SliderField.native.d.ts.map +1 -0
  294. package/build/typescript/form-fields/SliderField.web.d.ts +11 -0
  295. package/build/typescript/form-fields/SliderField.web.d.ts.map +1 -0
  296. package/build/typescript/form-fields/SubmitButtonField.d.ts +5 -0
  297. package/build/typescript/form-fields/SubmitButtonField.d.ts.map +1 -0
  298. package/build/typescript/form-fields/TextField.d.ts +5 -0
  299. package/build/typescript/form-fields/TextField.d.ts.map +1 -0
  300. package/build/typescript/form-fields/index.d.ts +13 -0
  301. package/build/typescript/form-fields/index.d.ts.map +1 -0
  302. package/build/typescript/i18n/WorkflowI18n.d.ts +75 -0
  303. package/build/typescript/i18n/WorkflowI18n.d.ts.map +1 -0
  304. package/build/typescript/icons/WorkflowIcon.d.ts +27 -0
  305. package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
  306. package/build/typescript/imageUriCache.d.ts +7 -0
  307. package/build/typescript/imageUriCache.d.ts.map +1 -0
  308. package/build/typescript/index.d.ts +47 -0
  309. package/build/typescript/index.d.ts.map +1 -0
  310. package/build/typescript/modal/WorkflowModal.d.ts +33 -0
  311. package/build/typescript/modal/WorkflowModal.d.ts.map +1 -0
  312. package/build/typescript/package.json +1 -0
  313. package/build/typescript/platform/platformName.d.ts +8 -0
  314. package/build/typescript/platform/platformName.d.ts.map +1 -0
  315. package/build/typescript/platform/platformName.web.d.ts +3 -0
  316. package/build/typescript/platform/platformName.web.d.ts.map +1 -0
  317. package/build/typescript/protocol/controlSnapshotStore.d.ts +12 -0
  318. package/build/typescript/protocol/controlSnapshotStore.d.ts.map +1 -0
  319. package/build/typescript/protocol/useProtocolExchange.d.ts +40 -0
  320. package/build/typescript/protocol/useProtocolExchange.d.ts.map +1 -0
  321. package/build/typescript/registries/ContentRegistry.d.ts +57 -0
  322. package/build/typescript/registries/ContentRegistry.d.ts.map +1 -0
  323. package/build/typescript/registries/FormFieldRegistry.d.ts +37 -0
  324. package/build/typescript/registries/FormFieldRegistry.d.ts.map +1 -0
  325. package/build/typescript/render/NodeBoundary.d.ts +25 -0
  326. package/build/typescript/render/NodeBoundary.d.ts.map +1 -0
  327. package/build/typescript/render/RenderTree.d.ts +23 -0
  328. package/build/typescript/render/RenderTree.d.ts.map +1 -0
  329. package/build/typescript/render/WorkflowRenderContext.d.ts +57 -0
  330. package/build/typescript/render/WorkflowRenderContext.d.ts.map +1 -0
  331. package/build/typescript/render/nodes.d.ts +49 -0
  332. package/build/typescript/render/nodes.d.ts.map +1 -0
  333. package/build/typescript/responsive/ResponsiveProvider.d.ts +39 -0
  334. package/build/typescript/responsive/ResponsiveProvider.d.ts.map +1 -0
  335. package/build/typescript/responsive/index.d.ts +3 -0
  336. package/build/typescript/responsive/index.d.ts.map +1 -0
  337. package/build/typescript/responsive/responsive.d.ts +24 -0
  338. package/build/typescript/responsive/responsive.d.ts.map +1 -0
  339. package/build/typescript/style/resolveDisplayHintStyle.d.ts +23 -0
  340. package/build/typescript/style/resolveDisplayHintStyle.d.ts.map +1 -0
  341. package/build/typescript/theme/WorkflowTheme.d.ts +177 -0
  342. package/build/typescript/theme/WorkflowTheme.d.ts.map +1 -0
  343. package/build/typescript/utils/testable.d.ts +8 -0
  344. package/build/typescript/utils/testable.d.ts.map +1 -0
  345. package/package.json +101 -3
  346. package/src/WorkflowFontScaleContext.tsx +74 -0
  347. package/src/adapter/WalletAdapter.tsx +225 -0
  348. package/src/components/FallbackVideoPlayer.native.tsx +9 -0
  349. package/src/components/FallbackVideoPlayer.tsx +5 -0
  350. package/src/components/FallbackVideoPlayer.web.tsx +24 -0
  351. package/src/components/WorkflowButtonLabel.tsx +41 -0
  352. package/src/components/WorkflowCalendarIcon.tsx +52 -0
  353. package/src/components/WorkflowText.tsx +121 -0
  354. package/src/content/BadgeContent.tsx +57 -0
  355. package/src/content/BarChartContent.tsx +76 -0
  356. package/src/content/BarcodeContent.tsx +59 -0
  357. package/src/content/BasicTableContent.tsx +139 -0
  358. package/src/content/ButtonContent.tsx +124 -0
  359. package/src/content/CalendarContent.tsx +178 -0
  360. package/src/content/CardContent.tsx +137 -0
  361. package/src/content/CarouselContent.tsx +197 -0
  362. package/src/content/ChipContent.tsx +209 -0
  363. package/src/content/ChipRowContent.tsx +133 -0
  364. package/src/content/CredentialOfferContent.tsx +229 -0
  365. package/src/content/DialContent.tsx +96 -0
  366. package/src/content/DividerContent.tsx +33 -0
  367. package/src/content/DonutChartContent.tsx +110 -0
  368. package/src/content/FormContent.tsx +158 -0
  369. package/src/content/FormFieldBridge.tsx +144 -0
  370. package/src/content/GaugeContent.tsx +66 -0
  371. package/src/content/GridLayoutContent.tsx +285 -0
  372. package/src/content/ImageContent.tsx +222 -0
  373. package/src/content/ListContent.tsx +98 -0
  374. package/src/content/LocationContent.tsx +135 -0
  375. package/src/content/MapContent.tsx +232 -0
  376. package/src/content/MultipleChoiceContent.tsx +74 -0
  377. package/src/content/OpenBadgePreviewContent.tsx +93 -0
  378. package/src/content/PhotoContent.tsx +110 -0
  379. package/src/content/PieChartContent.tsx +121 -0
  380. package/src/content/ProofPresentationContent.tsx +127 -0
  381. package/src/content/RadioButtonContent.tsx +129 -0
  382. package/src/content/RowContent.tsx +627 -0
  383. package/src/content/SectionContent.tsx +133 -0
  384. package/src/content/ShareEntryContent.tsx +109 -0
  385. package/src/content/SimulatedHint.tsx +20 -0
  386. package/src/content/SliderContent.tsx +56 -0
  387. package/src/content/SpacerContent.tsx +15 -0
  388. package/src/content/SpinnerContent.tsx +24 -0
  389. package/src/content/SubmitButtonContent.tsx +256 -0
  390. package/src/content/TextContent.tsx +140 -0
  391. package/src/content/TileContent.tsx +216 -0
  392. package/src/content/TimelineContent.tsx +91 -0
  393. package/src/content/TitleContent.tsx +49 -0
  394. package/src/content/VideoContent.tsx +131 -0
  395. package/src/content/WebLinkContent.tsx +87 -0
  396. package/src/content/index.ts +45 -0
  397. package/src/form-fields/CheckboxField.tsx +29 -0
  398. package/src/form-fields/DateField.native.tsx +123 -0
  399. package/src/form-fields/DateField.tsx +5 -0
  400. package/src/form-fields/DateField.web.tsx +32 -0
  401. package/src/form-fields/DropdownField.tsx +137 -0
  402. package/src/form-fields/MCQField.tsx +68 -0
  403. package/src/form-fields/RadioField.tsx +53 -0
  404. package/src/form-fields/SliderField.native.tsx +53 -0
  405. package/src/form-fields/SliderField.tsx +5 -0
  406. package/src/form-fields/SliderField.web.tsx +58 -0
  407. package/src/form-fields/SubmitButtonField.tsx +33 -0
  408. package/src/form-fields/TextField.tsx +49 -0
  409. package/src/form-fields/index.ts +12 -0
  410. package/src/i18n/WorkflowI18n.tsx +100 -0
  411. package/src/icons/WorkflowIcon.tsx +43 -0
  412. package/src/imageUriCache.ts +27 -0
  413. package/src/index.ts +96 -0
  414. package/src/modal/WorkflowModal.tsx +119 -0
  415. package/src/platform/platformName.ts +7 -0
  416. package/src/platform/platformName.web.ts +2 -0
  417. package/src/protocol/controlSnapshotStore.ts +25 -0
  418. package/src/protocol/useProtocolExchange.ts +185 -0
  419. package/src/registries/ContentRegistry.tsx +130 -0
  420. package/src/registries/FormFieldRegistry.tsx +83 -0
  421. package/src/render/NodeBoundary.tsx +69 -0
  422. package/src/render/RenderTree.tsx +63 -0
  423. package/src/render/WorkflowRenderContext.tsx +71 -0
  424. package/src/render/nodes.ts +104 -0
  425. package/src/responsive/ResponsiveProvider.tsx +103 -0
  426. package/src/responsive/index.ts +7 -0
  427. package/src/responsive/responsive.ts +67 -0
  428. package/src/style/resolveDisplayHintStyle.ts +153 -0
  429. package/src/theme/WorkflowTheme.tsx +162 -0
  430. package/src/utils/testable.ts +10 -0
@@ -0,0 +1,185 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+ import type { ExchangeKind, ExchangeRecord, WalletAdapter } from '../adapter/WalletAdapter'
3
+ import type { ContentProps } from '../registries/ContentRegistry'
4
+ import { getControlSnapshot, saveControlSnapshot } from './controlSnapshotStore'
5
+
6
+ /**
7
+ * - `ready`: the action buttons show (credential offer / proof request card).
8
+ * - `awaiting`: the user consented; waiting for the offer or request to arrive.
9
+ * - `working`: accepting the offer / presenting the proof.
10
+ * - `done`, `declined`, `error`: final.
11
+ */
12
+ export type ExchangePhase = 'ready' | 'awaiting' | 'working' | 'done' | 'declined' | 'error'
13
+
14
+ // Grace window when matching an arriving record to this control: records
15
+ // created more than this long before the control mounted belong to some other
16
+ // flow and must not be silently consumed here.
17
+ const ARM_SKEW_MS = 60 * 1000
18
+
19
+ type Options = Pick<
20
+ ContentProps,
21
+ 'item' | 'onAction' | 'onOutcome' | 'connectionId' | 'persistKey' | 'autoFireCheck'
22
+ > & {
23
+ kind: ExchangeKind
24
+ adapter: WalletAdapter
25
+ /** Default for `item.event` (`accept` for offers, `present` for proofs). */
26
+ defaultEvent: string
27
+ }
28
+
29
+ const pick = (value: unknown, fallback: string) => (typeof value === 'string' && value.trim()) || fallback
30
+
31
+ /**
32
+ * The shared lifecycle of the credential-offer and proof-presentation
33
+ * controls, moved from the wallet with credo replaced by the adapter.
34
+ *
35
+ * The watcher is armed from mount because the CrMS coordinator usually sends
36
+ * the offer / request as soon as the state is entered (before any tap).
37
+ * Pressing the primary button consents: an arrived record is accepted
38
+ * directly; otherwise the control waits for it and, for event-driven
39
+ * templates only, fires the workflow event to request it. Firing the event
40
+ * when the coordinator also auto-fires would duplicate the exchange, which
41
+ * this control must never do. Outcomes (`accepted`, `error`, decline) go back
42
+ * through `onOutcome` when the host provides it.
43
+ *
44
+ * The phase is kept in the snapshot store under `persistKey`, so leaving and
45
+ * re-entering the screen cannot bring the buttons back.
46
+ */
47
+ export function useProtocolExchange({
48
+ kind,
49
+ adapter,
50
+ item,
51
+ onAction,
52
+ onOutcome,
53
+ connectionId,
54
+ persistKey,
55
+ autoFireCheck,
56
+ defaultEvent,
57
+ }: Options) {
58
+ const primaryEvent = pick(item.event, defaultEvent)
59
+ const declineEvent = pick(item['decline-event'], 'decline')
60
+ const acceptedEvent = pick(item['accepted-event'], 'accepted')
61
+ const errorEvent = pick(item['error-event'], 'error')
62
+ const idKey = kind === 'credential' ? 'credentialId' : 'proofId'
63
+
64
+ const snapshot = getControlSnapshot(persistKey)
65
+ const [phase, setPhase] = useState<ExchangePhase>(snapshot ? toPhase(snapshot.phase) : 'ready')
66
+ const [recordId, setRecordId] = useState<string | null>(snapshot?.recordId ?? null)
67
+ const armedAtRef = useRef<number | null>(snapshot?.armedAt ?? Date.now())
68
+ const handledIdsRef = useRef<Set<string>>(new Set(snapshot?.handledIds ?? []))
69
+ const outcomeSentRef = useRef(snapshot?.outcomeSent ?? false)
70
+
71
+ useEffect(() => {
72
+ saveControlSnapshot(persistKey, {
73
+ phase,
74
+ recordId,
75
+ armedAt: armedAtRef.current,
76
+ handledIds: [...handledIdsRef.current],
77
+ outcomeSent: outcomeSentRef.current,
78
+ })
79
+ }, [persistKey, phase, recordId])
80
+
81
+ const records = adapter.useExchanges(kind)
82
+ // The wallet always knows the connection; the simulated adapter may not.
83
+ const canWatch = Boolean(connectionId) || adapter.simulated
84
+
85
+ const fireOutcome = useCallback(
86
+ (event: string, data?: Record<string, unknown>) => {
87
+ if (outcomeSentRef.current) return
88
+ outcomeSentRef.current = true
89
+ ;(onOutcome ?? onAction)(event, data)
90
+ },
91
+ [onAction, onOutcome]
92
+ )
93
+
94
+ const acceptRecord = useCallback(
95
+ (id: string) => {
96
+ handledIdsRef.current.add(id)
97
+ setRecordId(id)
98
+ setPhase('working')
99
+ adapter.acceptExchange(kind, id).catch((error: unknown) => {
100
+ setPhase('error')
101
+ fireOutcome(errorEvent, { message: error instanceof Error ? error.message : String(error) })
102
+ })
103
+ },
104
+ [adapter, kind, errorEvent, fireOutcome]
105
+ )
106
+
107
+ // Watch for the record on this workflow's connection. Before consent it is
108
+ // only remembered; after consent it is accepted immediately.
109
+ useEffect(() => {
110
+ if ((phase !== 'ready' && phase !== 'awaiting') || !canWatch) return
111
+ const armedAt = armedAtRef.current ?? 0
112
+ const pending = records.find(
113
+ (r) =>
114
+ r.status === 'pending' &&
115
+ r.connectionId === connectionId &&
116
+ !handledIdsRef.current.has(r.id) &&
117
+ r.createdAt >= armedAt - ARM_SKEW_MS
118
+ )
119
+ if (!pending) return
120
+ if (phase === 'awaiting') acceptRecord(pending.id)
121
+ else if (recordId !== pending.id) setRecordId(pending.id)
122
+ }, [phase, canWatch, connectionId, records, recordId, acceptRecord])
123
+
124
+ // Final states of the accepted record → workflow outcome events.
125
+ useEffect(() => {
126
+ if (!recordId || phase !== 'working') return
127
+ const record = records.find((r) => r.id === recordId)
128
+ if (record?.status === 'success') {
129
+ setPhase('done')
130
+ fireOutcome(acceptedEvent, { [idKey]: recordId })
131
+ } else if (record?.status === 'declined') {
132
+ setPhase('declined')
133
+ fireOutcome(declineEvent, { [idKey]: recordId })
134
+ } else if (record?.status === 'failed') {
135
+ setPhase('error')
136
+ fireOutcome(errorEvent, { [idKey]: recordId })
137
+ }
138
+ }, [recordId, phase, records, acceptedEvent, declineEvent, errorEvent, idKey, fireOutcome])
139
+
140
+ const consent = () => {
141
+ if (recordId && !handledIdsRef.current.has(recordId)) {
142
+ // Already arrived (the coordinator sent it): accept directly.
143
+ acceptRecord(recordId)
144
+ return
145
+ }
146
+ setPhase('awaiting')
147
+ adapter.expectExchange?.(kind, connectionId)
148
+ if (!autoFireCheck?.(primaryEvent)) onAction(primaryEvent)
149
+ }
150
+
151
+ const decline = () => {
152
+ setPhase('declined')
153
+ if (recordId && !handledIdsRef.current.has(recordId)) {
154
+ handledIdsRef.current.add(recordId)
155
+ adapter.declineExchange(kind, recordId).catch(() => undefined)
156
+ }
157
+ // Many templates have no decline transition: the outcome channel keeps
158
+ // that from surfacing as an error.
159
+ ;(onOutcome ?? onAction)(declineEvent)
160
+ }
161
+
162
+ const record: ExchangeRecord | undefined = recordId ? records.find((r) => r.id === recordId) : undefined
163
+ return { phase, recordId, record, consent, decline }
164
+ }
165
+
166
+ // Snapshots written by the wallet's own controls used their phase names.
167
+ const toPhase = (saved: string): ExchangePhase => {
168
+ switch (saved) {
169
+ case 'offer':
170
+ case 'request':
171
+ return 'ready'
172
+ case 'accepting':
173
+ case 'presenting':
174
+ return 'working'
175
+ case 'awaiting':
176
+ case 'done':
177
+ case 'declined':
178
+ case 'error':
179
+ case 'ready':
180
+ case 'working':
181
+ return saved
182
+ default:
183
+ return 'ready'
184
+ }
185
+ }
@@ -0,0 +1,130 @@
1
+ /* eslint-disable no-console */
2
+ import React from 'react'
3
+ import { NodeBoundary } from '../render/NodeBoundary'
4
+
5
+ // Base props all content types receive
6
+ export interface ContentProps {
7
+ item: {
8
+ type: string
9
+ text?: string
10
+ url?: string
11
+ label?: string
12
+ actionID?: string
13
+ fields?: any[]
14
+ [key: string]: any // Allow custom properties
15
+ }
16
+ // May return the underlying advance() promise (WorkflowDetails.tsx does) so
17
+ // a control can react to its OWN tap failing — e.g. flash a brief error
18
+ // state — on top of whatever generic failure handling the host screen
19
+ // already does. Fire-and-forget callers are still fine; nothing requires
20
+ // awaiting the return value.
21
+ onAction: (actionId: string, data?: any) => void | Promise<unknown>
22
+ // Optional channel for AUTOMATIC outcome events (accepted/declined/error)
23
+ // emitted by protocol-aware controls. Unlike onAction (user taps — loud
24
+ // errors), outcomes are best-effort: the host screen only forwards them
25
+ // when the template has a matching transition and never surfaces failures.
26
+ onOutcome?: (event: string, data?: any) => void
27
+ // Stable identity for this control across screen remounts (instance:state:index).
28
+ // Protocol-aware controls persist their phase under this key (see
29
+ // controlSnapshotStore) so leaving and re-entering the screen cannot
30
+ // resurrect already-used action buttons.
31
+ persistKey?: string
32
+ // Answers "will the coordinator auto-fire this event on the current state?"
33
+ // (see coordinatorAutoFire.ts). When true, the protocol exchange is already
34
+ // in flight and a control's primary tap must only consent — never advance.
35
+ autoFireCheck?: (event: string) => boolean
36
+ styles: Record<string, any>
37
+ colors: {
38
+ primary: string
39
+ text: string
40
+ background: string
41
+ border: string
42
+ buttonText?: string
43
+ workflowButton?: string
44
+ workflowButtonText?: string
45
+ }
46
+ formData?: Record<string, any>
47
+ onFieldChange?: (name: string, value: any) => void
48
+ FormFieldRegistry?: any
49
+ content?: any[]
50
+ buttonVariant?: 'workflow' | 'primary'
51
+ mediaFrame?: {
52
+ width: number
53
+ height: number
54
+ mode?: 'cover' | 'contain'
55
+ }
56
+ fillContainer?: boolean
57
+ // Shared font scale (0-1) computed across sibling buttons or titles in the
58
+ // same group (workflow action row, carousel of cards/tiles, etc.), so one
59
+ // long label/title doesn't shrink on its own while shorter siblings stay at
60
+ // full size. See estimateGroupButtonScale.
61
+ groupFontScale?: number
62
+ // The DIDComm connection the surrounding workflow instance runs over.
63
+ // Protocol-aware controls (credential-offer, proof-presentation) need it to
64
+ // match incoming credential/proof exchange records to this workflow.
65
+ connectionId?: string
66
+ // Workflow instance context/artifacts and the template's `catalog` block —
67
+ // for controls that resolve bindings against them (vs `formData`, which only
68
+ // holds this screen's collected form input).
69
+ context?: Record<string, unknown>
70
+ artifacts?: Record<string, unknown>
71
+ catalog?: Record<string, any>
72
+ /** Merged into chip selection while a filter tap is in flight (browse_programs). */
73
+ optimisticContext?: Record<string, unknown>
74
+ // Screen-wide "an action is in flight" flag — true for every interactive
75
+ // control the instant ANY submit-button/tile/chip on this screen fires
76
+ // onAction, cleared once advance() settles (see WorkflowDetails.tsx's
77
+ // actionLoading). Disables SIBLINGS while one control is busy.
78
+ disabled?: boolean
79
+ }
80
+
81
+ export type ContentRenderer = React.FC<ContentProps>
82
+
83
+ class ContentRegistryClass {
84
+ private renderers = new Map<string, ContentRenderer>()
85
+
86
+ register(type: string, renderer: ContentRenderer) {
87
+ this.renderers.set(type, renderer)
88
+ }
89
+
90
+ get(type: string): ContentRenderer | undefined {
91
+ return this.renderers.get(type)
92
+ }
93
+
94
+ has(type: string): boolean {
95
+ return this.renderers.has(type)
96
+ }
97
+
98
+ render(type: string, props: ContentProps): React.ReactNode {
99
+ const Renderer = this.renderers.get(type)
100
+ if (!Renderer || !props.item) {
101
+ return null
102
+ }
103
+
104
+ // Every node passes through NodeBoundary: `disabled` from the item,
105
+ // client-side expressions and the designer wrapper (see render/).
106
+ return (
107
+ <NodeBoundary
108
+ node={props.item}
109
+ kind="content"
110
+ formData={props.formData}
111
+ disabled={props.disabled}
112
+ render={(item, disabled, theme) => (
113
+ <Renderer
114
+ {...props}
115
+ item={item as ContentProps['item']}
116
+ disabled={disabled}
117
+ colors={props.colors ? { ...theme.colors, ...props.colors } : theme.colors}
118
+ styles={props.styles ? { ...theme.styles, ...props.styles } : theme.styles}
119
+ />
120
+ )}
121
+ />
122
+ )
123
+ }
124
+
125
+ getTypes(): string[] {
126
+ return Array.from(this.renderers.keys())
127
+ }
128
+ }
129
+
130
+ export const ContentRegistry = new ContentRegistryClass()
@@ -0,0 +1,83 @@
1
+ /* eslint-disable no-console */
2
+ import React from 'react'
3
+ import { NodeBoundary } from '../render/NodeBoundary'
4
+
5
+ // Base props all form fields receive
6
+ export interface FormFieldProps {
7
+ field: {
8
+ type: string
9
+ name: string
10
+ label: string
11
+ options?: string[]
12
+ min?: number
13
+ max?: number
14
+ placeholder?: string
15
+ required?: boolean
16
+ [key: string]: any // Allow custom properties
17
+ }
18
+ value: any
19
+ onChange: (value: any) => void
20
+ styles: Record<string, any>
21
+ colors: {
22
+ primary: string
23
+ text: string
24
+ background: string
25
+ border: string
26
+ buttonText?: string
27
+ }
28
+ // Shared font scale (0-1) computed across all sibling buttons in the same
29
+ // workflow group; forwarded to submit-button style fields.
30
+ groupFontScale?: number
31
+ }
32
+
33
+ // Renderer function type
34
+ export type FormFieldRenderer = React.FC<FormFieldProps>
35
+
36
+ // The registry
37
+ class FormFieldRegistryClass {
38
+ private renderers = new Map<string, FormFieldRenderer>()
39
+
40
+ register(type: string, renderer: FormFieldRenderer) {
41
+ this.renderers.set(type, renderer)
42
+ }
43
+
44
+ get(type: string): FormFieldRenderer | undefined {
45
+ return this.renderers.get(type)
46
+ }
47
+
48
+ has(type: string): boolean {
49
+ return this.renderers.has(type)
50
+ }
51
+
52
+ render(type: string, props: FormFieldProps): React.ReactNode {
53
+ const Renderer = this.renderers.get(type)
54
+ if (!Renderer) {
55
+ // biome-ignore lint/suspicious/noConsole: developer warning for a template using an unregistered form field type
56
+ console.warn(`Unknown form field type: ${type}`)
57
+ return null
58
+ }
59
+
60
+ // Same boundary as content: `showWhen` / `{{ }}` against the form's live values, designer wrapper.
61
+ return (
62
+ <NodeBoundary
63
+ node={props.field}
64
+ kind="field"
65
+ render={(field, _disabled, theme) => (
66
+ <Renderer
67
+ {...props}
68
+ field={field as FormFieldProps['field']}
69
+ colors={props.colors ? { ...theme.colors, ...props.colors } : theme.colors}
70
+ styles={props.styles ? { ...theme.styles, ...props.styles } : theme.styles}
71
+ />
72
+ )}
73
+ />
74
+ )
75
+ }
76
+
77
+ // Get all registered types (useful for validation)
78
+ getTypes(): string[] {
79
+ return Array.from(this.renderers.keys())
80
+ }
81
+ }
82
+
83
+ export const FormFieldRegistry = new FormFieldRegistryClass()
@@ -0,0 +1,69 @@
1
+ import type { UiEnv } from '@veridid/workflow-core'
2
+ import { type ReactNode, useContext, useMemo } from 'react'
3
+ import { useWorkflowTheme, type WorkflowTheme } from '../theme/WorkflowTheme'
4
+ import { lookupPath, type ResolvedNode, resolveNode, sourceNode, type WorkflowNode } from './nodes'
5
+ import { LiveInputContext, PathMapContext, RenderOptionsContext } from './WorkflowRenderContext'
6
+
7
+ export type NodeBoundaryProps = {
8
+ node: WorkflowNode
9
+ kind: 'content' | 'field'
10
+ /** The control's form values (`ContentProps.formData`); fields read them from context. */
11
+ formData?: Record<string, unknown>
12
+ /** The screen-busy flag passed to the control. */
13
+ disabled?: boolean
14
+ render: (item: WorkflowNode, disabled: boolean | undefined, theme: WorkflowTheme) => ReactNode
15
+ }
16
+
17
+ /**
18
+ * Sits around every control the registries render, so each node gets the same
19
+ * treatment wherever it appears (top level, inside a card, a row, a form…):
20
+ *
21
+ * - `disabled: true` on the item disables the control. The engine sets it from
22
+ * `enabledWhen`; before, only chips read it.
23
+ * - Under a `WorkflowRenderProvider` with an `env`: `showWhen`, `enabledWhen`
24
+ * and `{{ }}` are evaluated with workflow-core, with form values as `input`.
25
+ * - Under a `RenderTree` with `renderNodeWrapper`: the designer's wrapper.
26
+ * - `colors` and `styles` default to the `WorkflowThemeProvider` theme.
27
+ */
28
+ export function NodeBoundary({ node, kind, formData, disabled, render }: NodeBoundaryProps) {
29
+ const options = useContext(RenderOptionsContext)
30
+ const paths = useContext(PathMapContext)
31
+ const contextInput = useContext(LiveInputContext)
32
+ const theme = useWorkflowTheme()
33
+ const input = formData ?? contextInput
34
+ const baseEnv = options?.env
35
+
36
+ const env = useMemo<UiEnv | undefined>(
37
+ () => (baseEnv && input ? { ...baseEnv, input: { ...baseEnv.input, ...input } } : baseEnv),
38
+ [baseEnv, input]
39
+ )
40
+ const resolved = useMemo<ResolvedNode>(
41
+ () => (env ? resolveNode(node, env) : { item: node, hidden: false }),
42
+ [node, env]
43
+ )
44
+
45
+ if (resolved.hidden && !options?.keepHidden) return null
46
+
47
+ const { item } = resolved
48
+ const isDisabled = disabled || item.disabled === true ? true : disabled
49
+ let element = render(item, isDisabled, theme)
50
+
51
+ // Fields inside a form read the form's values from here.
52
+ if (kind === 'content' && formData && formData !== contextInput) {
53
+ element = <LiveInputContext.Provider value={formData}>{element}</LiveInputContext.Provider>
54
+ }
55
+
56
+ const path = options?.renderNodeWrapper ? lookupPath(paths, node) : undefined
57
+ if (options?.renderNodeWrapper && path) {
58
+ element = options.renderNodeWrapper(element, {
59
+ type: node.type,
60
+ kind,
61
+ path,
62
+ item,
63
+ source: sourceNode(node),
64
+ hidden: resolved.hidden,
65
+ disabled: isDisabled === true,
66
+ })
67
+ }
68
+ return <>{element}</>
69
+ }
@@ -0,0 +1,63 @@
1
+ import { Fragment, useContext, useMemo } from 'react'
2
+ import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
3
+ import { NodeBoundary } from './NodeBoundary'
4
+ import { buildPathMap, isNode, type WorkflowNodePath } from './nodes'
5
+ import { PathMapContext, RenderOptionsContext } from './WorkflowRenderContext'
6
+
7
+ export type RenderTreeProps = Omit<ContentProps, 'item' | 'colors' | 'styles'> & {
8
+ /** Default: the `WorkflowThemeProvider` theme. */
9
+ colors?: ContentProps['colors']
10
+ /** Host styles; merged over the theme's. */
11
+ styles?: ContentProps['styles']
12
+ /** Display-hint items for one screen (e.g. the result of `resolveView`). */
13
+ items: readonly unknown[] | undefined
14
+ /** Prefix for every node path, when this tree is part of a larger document. */
15
+ basePath?: WorkflowNodePath
16
+ }
17
+
18
+ /**
19
+ * Renders a list of display-hint items through the content registry, giving
20
+ * every node (including nested children) a path for `renderNodeWrapper`.
21
+ * Adds no layout of its own: each item renders as a sibling in the host's
22
+ * container.
23
+ *
24
+ * Items whose type has no component render nothing, or `renderUnknown` from
25
+ * the `WorkflowRenderProvider` (the designer shows a placeholder).
26
+ */
27
+ export function RenderTree({ items, basePath, ...shared }: RenderTreeProps) {
28
+ const options = useContext(RenderOptionsContext)
29
+ const baseKey = basePath?.join('.') ?? ''
30
+ // biome-ignore lint/correctness/useExhaustiveDependencies: basePath is compared by value (baseKey)
31
+ const paths = useMemo(() => buildPathMap(items, basePath), [items, baseKey])
32
+
33
+ if (!items?.length) return null
34
+ return (
35
+ <PathMapContext.Provider value={paths}>
36
+ {items.map((item, index) => {
37
+ if (!isNode(item)) return null
38
+ if (ContentRegistry.has(item.type)) {
39
+ return (
40
+ <Fragment key={`${index}-${item.type}`}>
41
+ {ContentRegistry.render(item.type, {
42
+ ...(shared as Omit<ContentProps, 'item'>),
43
+ item: item as ContentProps['item'],
44
+ })}
45
+ </Fragment>
46
+ )
47
+ }
48
+ const renderUnknown = options?.renderUnknown
49
+ if (!renderUnknown) return null
50
+ return (
51
+ <NodeBoundary
52
+ key={`${index}-${item.type}`}
53
+ node={item}
54
+ kind="content"
55
+ formData={shared.formData}
56
+ disabled={shared.disabled}
57
+ render={(resolved) => renderUnknown(resolved)}
58
+ />
59
+ )
60
+ })}
61
+ </PathMapContext.Provider>
62
+ )
63
+ }
@@ -0,0 +1,71 @@
1
+ import type { UiEnv } from '@veridid/workflow-core'
2
+ import { createContext, type ReactNode, useMemo } from 'react'
3
+ import type { NodePathMap, WorkflowNode, WorkflowNodePath } from './nodes'
4
+
5
+ /** What a `renderNodeWrapper` gets to know about the node it wraps. */
6
+ export type WorkflowNodeInfo = {
7
+ type: string
8
+ /** `content` for registry components, `field` for inputs inside a form. */
9
+ kind: 'content' | 'field'
10
+ /** Position in the items given to `RenderTree`. */
11
+ path: WorkflowNodePath
12
+ /** The node as rendered (`{{ }}` resolved, `disabled` from `enabledWhen`). */
13
+ item: WorkflowNode
14
+ /** The node as written in the items, before resolution. */
15
+ source: WorkflowNode
16
+ /** `showWhen` failed; only seen with `keepHidden`. */
17
+ hidden: boolean
18
+ /** The control renders disabled (`enabledWhen`, `disabled: true`, or the screen is busy). */
19
+ disabled: boolean
20
+ }
21
+
22
+ export type WorkflowRenderOptions = {
23
+ /**
24
+ * Data for `showWhen`, `enabledWhen` and `{{ }}`, the same env the engine
25
+ * uses (`context`, `artifacts`, `participants`, `viewer`). When set, every
26
+ * node is checked as it renders, and form values are added under `input`
27
+ * so conditions update as the user types. Leave it out when items come
28
+ * already resolved (the engine's status messages) and need no re-check.
29
+ */
30
+ env?: UiEnv
31
+ /**
32
+ * Wraps every node that has a path (anything inside `RenderTree`, not the
33
+ * pieces a component makes for itself). The designer uses it for selection
34
+ * outlines and drag handles, so editing tools never live in the shared
35
+ * components.
36
+ */
37
+ renderNodeWrapper?: (element: ReactNode, info: WorkflowNodeInfo) => ReactNode
38
+ /** Renders a top-level item whose type has no component (default: nothing). */
39
+ renderUnknown?: (item: WorkflowNode) => ReactNode
40
+ /**
41
+ * Render nodes whose `showWhen` fails instead of dropping them; the wrapper
42
+ * sees `hidden: true` and can dim them. For the designer.
43
+ */
44
+ keepHidden?: boolean
45
+ }
46
+
47
+ export const RenderOptionsContext = createContext<WorkflowRenderOptions | null>(null)
48
+ export const PathMapContext = createContext<NodePathMap | null>(null)
49
+ /** Form values of the nearest enclosing control, for fields inside a form. */
50
+ export const LiveInputContext = createContext<Record<string, unknown> | undefined>(undefined)
51
+
52
+ export type WorkflowRenderProviderProps = WorkflowRenderOptions & { children?: ReactNode }
53
+
54
+ /**
55
+ * Optional. Turns on client-side expression checks and the designer hooks for
56
+ * every workflow component below it. Without it, components render exactly the
57
+ * items they are given.
58
+ */
59
+ export function WorkflowRenderProvider({
60
+ env,
61
+ renderNodeWrapper,
62
+ renderUnknown,
63
+ keepHidden,
64
+ children,
65
+ }: WorkflowRenderProviderProps) {
66
+ const value = useMemo(
67
+ () => ({ env, renderNodeWrapper, renderUnknown, keepHidden }),
68
+ [env, renderNodeWrapper, renderUnknown, keepHidden]
69
+ )
70
+ return <RenderOptionsContext.Provider value={value}>{children}</RenderOptionsContext.Provider>
71
+ }