@cratis/showrunner.playbill.react 0.0.0-stage → 2.19.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 (290) hide show
  1. package/Badge/PlaybillBadge.tsx +45 -0
  2. package/Badge/index.ts +4 -0
  3. package/Client/PlaybillClient.ts +78 -0
  4. package/Client/index.ts +5 -0
  5. package/Client/models.ts +64 -0
  6. package/Configuration/PlaybillProvider.tsx +38 -0
  7. package/Configuration/index.ts +4 -0
  8. package/Dialog/PlaybillDialog.tsx +83 -0
  9. package/Dialog/index.ts +4 -0
  10. package/Icons.tsx +14 -0
  11. package/Labels/PlaybillLabels.ts +46 -0
  12. package/Labels/defaultPlaybillLabels.ts +29 -0
  13. package/Labels/index.ts +6 -0
  14. package/Labels/resolveLabels.ts +20 -0
  15. package/Markdown/PlaybillLink.tsx +14 -0
  16. package/Markdown/PlaybillMarkdown.tsx +41 -0
  17. package/Markdown/assetUrl.ts +28 -0
  18. package/Markdown/index.ts +6 -0
  19. package/Markdown/safeLink.ts +25 -0
  20. package/Playbill.tsx +121 -0
  21. package/README.md +54 -2
  22. package/Release/ReleaseNoteView.tsx +79 -0
  23. package/Release/formatReleaseDate.ts +22 -0
  24. package/Release/index.ts +6 -0
  25. package/Release/sectionPresentation.ts +35 -0
  26. package/dist/cjs/Badge/PlaybillBadge.d.ts +10 -0
  27. package/dist/cjs/Badge/PlaybillBadge.d.ts.map +1 -0
  28. package/dist/cjs/Badge/PlaybillBadge.js +38 -0
  29. package/dist/cjs/Badge/PlaybillBadge.js.map +1 -0
  30. package/dist/cjs/Badge/index.d.ts +2 -0
  31. package/dist/cjs/Badge/index.d.ts.map +1 -0
  32. package/dist/cjs/Client/PlaybillClient.d.ts +13 -0
  33. package/dist/cjs/Client/PlaybillClient.d.ts.map +1 -0
  34. package/dist/cjs/Client/PlaybillClient.js +71 -0
  35. package/dist/cjs/Client/PlaybillClient.js.map +1 -0
  36. package/dist/cjs/Client/index.d.ts +3 -0
  37. package/dist/cjs/Client/index.d.ts.map +1 -0
  38. package/dist/cjs/Client/models.d.ts +27 -0
  39. package/dist/cjs/Client/models.d.ts.map +1 -0
  40. package/dist/cjs/Configuration/PlaybillProvider.d.ts +11 -0
  41. package/dist/cjs/Configuration/PlaybillProvider.d.ts.map +1 -0
  42. package/dist/cjs/Configuration/PlaybillProvider.js +30 -0
  43. package/dist/cjs/Configuration/PlaybillProvider.js.map +1 -0
  44. package/dist/cjs/Configuration/index.d.ts +2 -0
  45. package/dist/cjs/Configuration/index.d.ts.map +1 -0
  46. package/dist/cjs/Dialog/PlaybillDialog.d.ts +13 -0
  47. package/dist/cjs/Dialog/PlaybillDialog.d.ts.map +1 -0
  48. package/dist/cjs/Dialog/PlaybillDialog.js +79 -0
  49. package/dist/cjs/Dialog/PlaybillDialog.js.map +1 -0
  50. package/dist/cjs/Dialog/index.d.ts +2 -0
  51. package/dist/cjs/Dialog/index.d.ts.map +1 -0
  52. package/dist/cjs/Examples/AppShell.d.ts +5 -0
  53. package/dist/cjs/Examples/AppShell.d.ts.map +1 -0
  54. package/dist/cjs/Examples/LocalizedPlaybill.d.ts +2 -0
  55. package/dist/cjs/Examples/LocalizedPlaybill.d.ts.map +1 -0
  56. package/dist/cjs/Examples/OwnEndpoint.d.ts +2 -0
  57. package/dist/cjs/Examples/OwnEndpoint.d.ts.map +1 -0
  58. package/dist/cjs/Examples/OwnMarkdown.d.ts +2 -0
  59. package/dist/cjs/Examples/OwnMarkdown.d.ts.map +1 -0
  60. package/dist/cjs/Examples/OwnRelease.d.ts +2 -0
  61. package/dist/cjs/Examples/OwnRelease.d.ts.map +1 -0
  62. package/dist/cjs/Examples/OwnSurface.d.ts +2 -0
  63. package/dist/cjs/Examples/OwnSurface.d.ts.map +1 -0
  64. package/dist/cjs/Examples/ReleaseNotesPage.d.ts +2 -0
  65. package/dist/cjs/Examples/ReleaseNotesPage.d.ts.map +1 -0
  66. package/dist/cjs/Icons.d.ts +2 -0
  67. package/dist/cjs/Icons.d.ts.map +1 -0
  68. package/dist/cjs/Icons.js +36 -0
  69. package/dist/cjs/Icons.js.map +1 -0
  70. package/dist/cjs/Labels/PlaybillLabels.d.ts +22 -0
  71. package/dist/cjs/Labels/PlaybillLabels.d.ts.map +1 -0
  72. package/dist/cjs/Labels/defaultPlaybillLabels.d.ts +3 -0
  73. package/dist/cjs/Labels/defaultPlaybillLabels.d.ts.map +1 -0
  74. package/dist/cjs/Labels/defaultPlaybillLabels.js +30 -0
  75. package/dist/cjs/Labels/defaultPlaybillLabels.js.map +1 -0
  76. package/dist/cjs/Labels/index.d.ts +4 -0
  77. package/dist/cjs/Labels/index.d.ts.map +1 -0
  78. package/dist/cjs/Labels/resolveLabels.d.ts +4 -0
  79. package/dist/cjs/Labels/resolveLabels.d.ts.map +1 -0
  80. package/dist/cjs/Labels/resolveLabels.js +24 -0
  81. package/dist/cjs/Labels/resolveLabels.js.map +1 -0
  82. package/dist/cjs/Markdown/PlaybillLink.d.ts +5 -0
  83. package/dist/cjs/Markdown/PlaybillLink.d.ts.map +1 -0
  84. package/dist/cjs/Markdown/PlaybillLink.js +21 -0
  85. package/dist/cjs/Markdown/PlaybillLink.js.map +1 -0
  86. package/dist/cjs/Markdown/PlaybillMarkdown.d.ts +7 -0
  87. package/dist/cjs/Markdown/PlaybillMarkdown.d.ts.map +1 -0
  88. package/dist/cjs/Markdown/PlaybillMarkdown.js +34 -0
  89. package/dist/cjs/Markdown/PlaybillMarkdown.js.map +1 -0
  90. package/dist/cjs/Markdown/assetUrl.d.ts +2 -0
  91. package/dist/cjs/Markdown/assetUrl.d.ts.map +1 -0
  92. package/dist/cjs/Markdown/assetUrl.js +29 -0
  93. package/dist/cjs/Markdown/assetUrl.js.map +1 -0
  94. package/dist/cjs/Markdown/index.d.ts +4 -0
  95. package/dist/cjs/Markdown/index.d.ts.map +1 -0
  96. package/dist/cjs/Markdown/safeLink.d.ts +3 -0
  97. package/dist/cjs/Markdown/safeLink.d.ts.map +1 -0
  98. package/dist/cjs/Markdown/safeLink.js +30 -0
  99. package/dist/cjs/Markdown/safeLink.js.map +1 -0
  100. package/dist/cjs/Playbill.d.ts +15 -0
  101. package/dist/cjs/Playbill.d.ts.map +1 -0
  102. package/dist/cjs/Playbill.js +135 -0
  103. package/dist/cjs/Playbill.js.map +1 -0
  104. package/dist/cjs/Release/ReleaseNoteView.d.ts +16 -0
  105. package/dist/cjs/Release/ReleaseNoteView.d.ts.map +1 -0
  106. package/dist/cjs/Release/ReleaseNoteView.js +75 -0
  107. package/dist/cjs/Release/ReleaseNoteView.js.map +1 -0
  108. package/dist/cjs/Release/formatReleaseDate.d.ts +2 -0
  109. package/dist/cjs/Release/formatReleaseDate.d.ts.map +1 -0
  110. package/dist/cjs/Release/formatReleaseDate.js +26 -0
  111. package/dist/cjs/Release/formatReleaseDate.js.map +1 -0
  112. package/dist/cjs/Release/index.d.ts +4 -0
  113. package/dist/cjs/Release/index.d.ts.map +1 -0
  114. package/dist/cjs/Release/sectionPresentation.d.ts +7 -0
  115. package/dist/cjs/Release/sectionPresentation.d.ts.map +1 -0
  116. package/dist/cjs/Release/sectionPresentation.js +31 -0
  117. package/dist/cjs/Release/sectionPresentation.js.map +1 -0
  118. package/dist/cjs/index.d.ts +13 -0
  119. package/dist/cjs/index.d.ts.map +1 -0
  120. package/dist/cjs/index.js +46 -0
  121. package/dist/cjs/index.js.map +1 -0
  122. package/dist/cjs/package.json +3 -0
  123. package/dist/cjs/useLoaded.d.ts +7 -0
  124. package/dist/cjs/useLoaded.d.ts.map +1 -0
  125. package/dist/cjs/useLoaded.js +45 -0
  126. package/dist/cjs/useLoaded.js.map +1 -0
  127. package/dist/cjs/usePlaybill.d.ts +5 -0
  128. package/dist/cjs/usePlaybill.d.ts.map +1 -0
  129. package/dist/cjs/usePlaybill.js +18 -0
  130. package/dist/cjs/usePlaybill.js.map +1 -0
  131. package/dist/cjs/usePlaybillStatus.d.ts +8 -0
  132. package/dist/cjs/usePlaybillStatus.d.ts.map +1 -0
  133. package/dist/cjs/usePlaybillStatus.js +34 -0
  134. package/dist/cjs/usePlaybillStatus.js.map +1 -0
  135. package/dist/cjs/useReleases.d.ts +12 -0
  136. package/dist/cjs/useReleases.d.ts.map +1 -0
  137. package/dist/cjs/useReleases.js +58 -0
  138. package/dist/cjs/useReleases.js.map +1 -0
  139. package/dist/esm/Badge/PlaybillBadge.d.ts +10 -0
  140. package/dist/esm/Badge/PlaybillBadge.d.ts.map +1 -0
  141. package/dist/esm/Badge/PlaybillBadge.js +36 -0
  142. package/dist/esm/Badge/PlaybillBadge.js.map +1 -0
  143. package/dist/esm/Badge/index.d.ts +2 -0
  144. package/dist/esm/Badge/index.d.ts.map +1 -0
  145. package/dist/esm/Badge/index.js +2 -0
  146. package/dist/esm/Badge/index.js.map +1 -0
  147. package/dist/esm/Client/PlaybillClient.d.ts +13 -0
  148. package/dist/esm/Client/PlaybillClient.d.ts.map +1 -0
  149. package/dist/esm/Client/PlaybillClient.js +68 -0
  150. package/dist/esm/Client/PlaybillClient.js.map +1 -0
  151. package/dist/esm/Client/index.d.ts +3 -0
  152. package/dist/esm/Client/index.d.ts.map +1 -0
  153. package/dist/esm/Client/index.js +3 -0
  154. package/dist/esm/Client/index.js.map +1 -0
  155. package/dist/esm/Client/models.d.ts +27 -0
  156. package/dist/esm/Client/models.d.ts.map +1 -0
  157. package/dist/esm/Client/models.js +2 -0
  158. package/dist/esm/Client/models.js.map +1 -0
  159. package/dist/esm/Configuration/PlaybillProvider.d.ts +11 -0
  160. package/dist/esm/Configuration/PlaybillProvider.d.ts.map +1 -0
  161. package/dist/esm/Configuration/PlaybillProvider.js +27 -0
  162. package/dist/esm/Configuration/PlaybillProvider.js.map +1 -0
  163. package/dist/esm/Configuration/index.d.ts +2 -0
  164. package/dist/esm/Configuration/index.d.ts.map +1 -0
  165. package/dist/esm/Configuration/index.js +2 -0
  166. package/dist/esm/Configuration/index.js.map +1 -0
  167. package/dist/esm/Dialog/PlaybillDialog.d.ts +13 -0
  168. package/dist/esm/Dialog/PlaybillDialog.d.ts.map +1 -0
  169. package/dist/esm/Dialog/PlaybillDialog.js +77 -0
  170. package/dist/esm/Dialog/PlaybillDialog.js.map +1 -0
  171. package/dist/esm/Dialog/index.d.ts +2 -0
  172. package/dist/esm/Dialog/index.d.ts.map +1 -0
  173. package/dist/esm/Dialog/index.js +2 -0
  174. package/dist/esm/Dialog/index.js.map +1 -0
  175. package/dist/esm/Examples/AppShell.d.ts +5 -0
  176. package/dist/esm/Examples/AppShell.d.ts.map +1 -0
  177. package/dist/esm/Examples/AppShell.js +6 -0
  178. package/dist/esm/Examples/AppShell.js.map +1 -0
  179. package/dist/esm/Examples/LocalizedPlaybill.d.ts +2 -0
  180. package/dist/esm/Examples/LocalizedPlaybill.d.ts.map +1 -0
  181. package/dist/esm/Examples/LocalizedPlaybill.js +13 -0
  182. package/dist/esm/Examples/LocalizedPlaybill.js.map +1 -0
  183. package/dist/esm/Examples/OwnEndpoint.d.ts +2 -0
  184. package/dist/esm/Examples/OwnEndpoint.d.ts.map +1 -0
  185. package/dist/esm/Examples/OwnEndpoint.js +8 -0
  186. package/dist/esm/Examples/OwnEndpoint.js.map +1 -0
  187. package/dist/esm/Examples/OwnMarkdown.d.ts +2 -0
  188. package/dist/esm/Examples/OwnMarkdown.d.ts.map +1 -0
  189. package/dist/esm/Examples/OwnMarkdown.js +5 -0
  190. package/dist/esm/Examples/OwnMarkdown.js.map +1 -0
  191. package/dist/esm/Examples/OwnRelease.d.ts +2 -0
  192. package/dist/esm/Examples/OwnRelease.d.ts.map +1 -0
  193. package/dist/esm/Examples/OwnRelease.js +5 -0
  194. package/dist/esm/Examples/OwnRelease.js.map +1 -0
  195. package/dist/esm/Examples/OwnSurface.d.ts +2 -0
  196. package/dist/esm/Examples/OwnSurface.d.ts.map +1 -0
  197. package/dist/esm/Examples/OwnSurface.js +8 -0
  198. package/dist/esm/Examples/OwnSurface.js.map +1 -0
  199. package/dist/esm/Examples/ReleaseNotesPage.d.ts +2 -0
  200. package/dist/esm/Examples/ReleaseNotesPage.d.ts.map +1 -0
  201. package/dist/esm/Examples/ReleaseNotesPage.js +4 -0
  202. package/dist/esm/Examples/ReleaseNotesPage.js.map +1 -0
  203. package/dist/esm/Icons.d.ts +2 -0
  204. package/dist/esm/Icons.d.ts.map +1 -0
  205. package/dist/esm/Icons.js +34 -0
  206. package/dist/esm/Icons.js.map +1 -0
  207. package/dist/esm/Labels/PlaybillLabels.d.ts +22 -0
  208. package/dist/esm/Labels/PlaybillLabels.d.ts.map +1 -0
  209. package/dist/esm/Labels/PlaybillLabels.js +2 -0
  210. package/dist/esm/Labels/PlaybillLabels.js.map +1 -0
  211. package/dist/esm/Labels/defaultPlaybillLabels.d.ts +3 -0
  212. package/dist/esm/Labels/defaultPlaybillLabels.d.ts.map +1 -0
  213. package/dist/esm/Labels/defaultPlaybillLabels.js +28 -0
  214. package/dist/esm/Labels/defaultPlaybillLabels.js.map +1 -0
  215. package/dist/esm/Labels/index.d.ts +4 -0
  216. package/dist/esm/Labels/index.d.ts.map +1 -0
  217. package/dist/esm/Labels/index.js +4 -0
  218. package/dist/esm/Labels/index.js.map +1 -0
  219. package/dist/esm/Labels/resolveLabels.d.ts +4 -0
  220. package/dist/esm/Labels/resolveLabels.d.ts.map +1 -0
  221. package/dist/esm/Labels/resolveLabels.js +21 -0
  222. package/dist/esm/Labels/resolveLabels.js.map +1 -0
  223. package/dist/esm/Markdown/PlaybillLink.d.ts +5 -0
  224. package/dist/esm/Markdown/PlaybillLink.d.ts.map +1 -0
  225. package/dist/esm/Markdown/PlaybillLink.js +19 -0
  226. package/dist/esm/Markdown/PlaybillLink.js.map +1 -0
  227. package/dist/esm/Markdown/PlaybillMarkdown.d.ts +7 -0
  228. package/dist/esm/Markdown/PlaybillMarkdown.d.ts.map +1 -0
  229. package/dist/esm/Markdown/PlaybillMarkdown.js +32 -0
  230. package/dist/esm/Markdown/PlaybillMarkdown.js.map +1 -0
  231. package/dist/esm/Markdown/assetUrl.d.ts +2 -0
  232. package/dist/esm/Markdown/assetUrl.d.ts.map +1 -0
  233. package/dist/esm/Markdown/assetUrl.js +27 -0
  234. package/dist/esm/Markdown/assetUrl.js.map +1 -0
  235. package/dist/esm/Markdown/index.d.ts +4 -0
  236. package/dist/esm/Markdown/index.d.ts.map +1 -0
  237. package/dist/esm/Markdown/index.js +4 -0
  238. package/dist/esm/Markdown/index.js.map +1 -0
  239. package/dist/esm/Markdown/safeLink.d.ts +3 -0
  240. package/dist/esm/Markdown/safeLink.d.ts.map +1 -0
  241. package/dist/esm/Markdown/safeLink.js +27 -0
  242. package/dist/esm/Markdown/safeLink.js.map +1 -0
  243. package/dist/esm/Playbill.d.ts +15 -0
  244. package/dist/esm/Playbill.d.ts.map +1 -0
  245. package/dist/esm/Playbill.js +133 -0
  246. package/dist/esm/Playbill.js.map +1 -0
  247. package/dist/esm/Release/ReleaseNoteView.d.ts +16 -0
  248. package/dist/esm/Release/ReleaseNoteView.d.ts.map +1 -0
  249. package/dist/esm/Release/ReleaseNoteView.js +73 -0
  250. package/dist/esm/Release/ReleaseNoteView.js.map +1 -0
  251. package/dist/esm/Release/formatReleaseDate.d.ts +2 -0
  252. package/dist/esm/Release/formatReleaseDate.d.ts.map +1 -0
  253. package/dist/esm/Release/formatReleaseDate.js +24 -0
  254. package/dist/esm/Release/formatReleaseDate.js.map +1 -0
  255. package/dist/esm/Release/index.d.ts +4 -0
  256. package/dist/esm/Release/index.d.ts.map +1 -0
  257. package/dist/esm/Release/index.js +4 -0
  258. package/dist/esm/Release/index.js.map +1 -0
  259. package/dist/esm/Release/sectionPresentation.d.ts +7 -0
  260. package/dist/esm/Release/sectionPresentation.d.ts.map +1 -0
  261. package/dist/esm/Release/sectionPresentation.js +29 -0
  262. package/dist/esm/Release/sectionPresentation.js.map +1 -0
  263. package/dist/esm/index.d.ts +13 -0
  264. package/dist/esm/index.d.ts.map +1 -0
  265. package/dist/esm/index.js +18 -0
  266. package/dist/esm/index.js.map +1 -0
  267. package/dist/esm/package.json +3 -0
  268. package/dist/esm/useLoaded.d.ts +7 -0
  269. package/dist/esm/useLoaded.d.ts.map +1 -0
  270. package/dist/esm/useLoaded.js +43 -0
  271. package/dist/esm/useLoaded.js.map +1 -0
  272. package/dist/esm/usePlaybill.d.ts +5 -0
  273. package/dist/esm/usePlaybill.d.ts.map +1 -0
  274. package/dist/esm/usePlaybill.js +16 -0
  275. package/dist/esm/usePlaybill.js.map +1 -0
  276. package/dist/esm/usePlaybillStatus.d.ts +8 -0
  277. package/dist/esm/usePlaybillStatus.d.ts.map +1 -0
  278. package/dist/esm/usePlaybillStatus.js +32 -0
  279. package/dist/esm/usePlaybillStatus.js.map +1 -0
  280. package/dist/esm/useReleases.d.ts +12 -0
  281. package/dist/esm/useReleases.d.ts.map +1 -0
  282. package/dist/esm/useReleases.js +54 -0
  283. package/dist/esm/useReleases.js.map +1 -0
  284. package/index.ts +15 -0
  285. package/package.json +87 -4
  286. package/styles.css +298 -0
  287. package/useLoaded.ts +45 -0
  288. package/usePlaybill.ts +17 -0
  289. package/usePlaybillStatus.ts +48 -0
  290. package/useReleases.ts +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Playbill.js","sources":["../../Playbill.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentType, useEffect, useMemo, useState } from 'react';\nimport { usePlaybillClient } from './Configuration/index.js';\nimport { PlaybillLabels, resolveLabels } from './Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from './Markdown/index.js';\nimport { formatReleaseDate, ReleaseNoteView, ReleaseNoteViewProps } from './Release/index.js';\nimport { usePlaybill } from './usePlaybill.js';\nimport { useRelease } from './useReleases.js';\n\n/**\n * Props for {@link Playbill}.\n */\nexport interface PlaybillProps {\n /** Replaces how the selected release is drawn. */\n release?: ComponentType<ReleaseNoteViewProps>;\n /** Replaces the Markdown renderer the default release view uses, and that a custom one is given. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The texts to replace; the rest stay English. */\n labels?: Partial<PlaybillLabels>;\n /** The locale to write the dates in; the browser's when not given. */\n locale?: string | string[];\n /** The version to show. Give it, with `onSelect`, to keep the selection in the address; by default the newest is selected. */\n selected?: string;\n /** Called when the person picks another release. */\n onSelect?: (version: string) => void;\n /** Records that the person has seen a release when it is shown. On by default; turn it off to leave what is unread to a dialog. */\n markSeenWhenShown?: boolean;\n}\n\n/**\n * The release notes of the application as a page: the releases newest first on one side and the selected release on the\n * other. It marks what the person has not seen with a tag, and records a release as seen when it is shown. Place it\n * where the application has room for a page, inside Arc's context. It draws no heading of its own.\n */\nexport const Playbill = ({\n release: Release = ReleaseNoteView,\n markdown,\n labels,\n locale,\n selected,\n onSelect,\n markSeenWhenShown = true\n}: PlaybillProps) => {\n const client = usePlaybillClient();\n const { releases, current, isLoading, error, unreadVersions, markSeen } = usePlaybill();\n const resolved = useMemo(() => resolveLabels(labels), [labels]);\n const [picked, setPicked] = useState<string>();\n const version = selected ?? picked ?? releases[0]?.version;\n const { data: note, isLoading: isLoadingNote, error: noteError } = useRelease(version);\n const isUnread = (candidate?: string) => candidate !== undefined && unreadVersions.includes(candidate);\n const selectedIsUnread = isUnread(version);\n\n useEffect(() => {\n if (markSeenWhenShown && note && selectedIsUnread) {\n // Failing to remember it must not keep a person from reading on.\n markSeen(note.version).catch(() => undefined);\n }\n }, [markSeenWhenShown, note, selectedIsUnread, markSeen]);\n\n const select = (next: string) => {\n setPicked(next);\n onSelect?.(next);\n };\n\n if (error || noteError) {\n return <p className='playbill-status playbill-status--failed' role='alert'>{resolved.failed}</p>;\n }\n\n if (isLoading) {\n return <p className='playbill-status' role='status'>{resolved.loading}</p>;\n }\n\n if (releases.length === 0) {\n return <p className='playbill-status'>{resolved.empty}</p>;\n }\n\n return (\n <div className='playbill'>\n <nav className='playbill__list' aria-label={resolved.releases}>\n <ul>\n {releases.map(summary => {\n const date = formatReleaseDate(summary.releasedAt, locale);\n const isSelected = summary.version === version;\n return (\n <li key={summary.version}>\n <button\n type='button'\n className={isSelected ? 'playbill-item playbill-item--selected' : 'playbill-item'}\n aria-current={isSelected ? 'true' : undefined}\n onClick={() => select(summary.version)}>\n <span className='playbill-item__heading'>\n <span className='playbill-item__version'>{summary.version}</span>\n {summary.version === current && <span className='playbill-tag playbill-tag--current'>{resolved.current}</span>}\n {isUnread(summary.version) && <span className='playbill-tag playbill-tag--unread'>{resolved.unread}</span>}\n </span>\n {date && <span className='playbill-item__date'>{date}</span>}\n {summary.summary && <span className='playbill-item__summary'>{summary.summary}</span>}\n </button>\n </li>\n );\n })}\n </ul>\n </nav>\n <div className='playbill__content'>\n {isLoadingNote && <p className='playbill-status' role='status'>{resolved.loading}</p>}\n {!isLoadingNote && note && (\n <Release\n release={note}\n assetBase={client.assetBase(note.version)}\n labels={resolved}\n markdown={markdown ?? PlaybillMarkdown}\n locale={locale}\n isUnread={selectedIsUnread}\n isCurrent={note.version === current} />\n )}\n </div>\n </div>\n );\n};\n"],"names":["Playbill","release","Release","ReleaseNoteView","markdown","labels","locale","selected","onSelect","markSeenWhenShown","client","usePlaybillClient","releases","current","isLoading","error","unreadVersions","markSeen","usePlaybill","resolved","useMemo","resolveLabels","picked","setPicked","useState","version","data","note","isLoadingNote","noteError","useRelease","isUnread","candidate","undefined","includes","selectedIsUnread","useEffect","catch","select","next","_jsx","p","className","role","failed","loading","length","empty","_jsxs","div","nav","aria-label","ul","map","summary","date","formatReleaseDate","releasedAt","isSelected","li","button","type","aria-current","onClick","span","unread","assetBase","PlaybillMarkdown","isCurrent"],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import { ComponentType } from 'react';
2
+ import { Release } from '../Client/index.js';
3
+ import { PlaybillLabels } from '../Labels/index.js';
4
+ import { PlaybillMarkdownProps } from '../Markdown/index.js';
5
+ export interface ReleaseNoteViewProps {
6
+ release: Release;
7
+ assetBase?: string;
8
+ labels: PlaybillLabels;
9
+ markdown?: ComponentType<PlaybillMarkdownProps>;
10
+ locale?: string | string[];
11
+ isUnread?: boolean;
12
+ isCurrent?: boolean;
13
+ headingLevel?: 2 | 3 | 4;
14
+ }
15
+ export declare const ReleaseNoteView: ({ release, assetBase, labels, markdown: Markdown, locale, isUnread, isCurrent, headingLevel }: ReleaseNoteViewProps) => import("react").JSX.Element;
16
+ //# sourceMappingURL=ReleaseNoteView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReleaseNoteView.d.ts","sourceRoot":"","sources":["../../../Release/ReleaseNoteView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAQ/E,MAAM,WAAW,oBAAoB;IAEjC,OAAO,EAAE,OAAO,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,cAAc,CAAC;IAEvB,QAAQ,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAEhD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC5B;AAMD,eAAO,MAAM,eAAe,GAAI,+FAS7B,oBAAoB,gCAgCtB,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { PlaybillMarkdown } from '../Markdown/PlaybillMarkdown.js';
3
+ import { formatReleaseDate } from './formatReleaseDate.js';
4
+ import { sectionPresentation } from './sectionPresentation.js';
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * One release: its version and date, what its note says before the first section, and each section under its heading.
10
+ * It draws no frame of its own, so a page, a dialog or a product's own surface can hold it.
11
+ */ const ReleaseNoteView = ({ release, assetBase, labels, markdown: Markdown = PlaybillMarkdown, locale, isUnread = false, isCurrent = false, headingLevel = 2 })=>{
12
+ const Heading = `h${headingLevel}`;
13
+ const SectionHeading = `h${headingLevel + 1}`;
14
+ const date = formatReleaseDate(release.releasedAt, locale);
15
+ return /*#__PURE__*/ jsxs("article", {
16
+ className: "playbill-release",
17
+ "data-version": release.version,
18
+ children: [
19
+ /*#__PURE__*/ jsxs("header", {
20
+ className: "playbill-release__header",
21
+ children: [
22
+ /*#__PURE__*/ jsx(Heading, {
23
+ className: "playbill-release__version",
24
+ children: release.version
25
+ }),
26
+ isCurrent && /*#__PURE__*/ jsx("span", {
27
+ className: "playbill-tag playbill-tag--current",
28
+ children: labels.current
29
+ }),
30
+ isUnread && /*#__PURE__*/ jsx("span", {
31
+ className: "playbill-tag playbill-tag--unread",
32
+ children: labels.unread
33
+ }),
34
+ date && /*#__PURE__*/ jsxs("time", {
35
+ className: "playbill-release__date",
36
+ dateTime: release.releasedAt ?? undefined,
37
+ children: [
38
+ labels.released,
39
+ " ",
40
+ date
41
+ ]
42
+ })
43
+ ]
44
+ }),
45
+ release.lead.trim() !== '' && /*#__PURE__*/ jsx("div", {
46
+ className: "playbill-release__lead",
47
+ children: /*#__PURE__*/ jsx(Markdown, {
48
+ source: release.lead,
49
+ assetBase: assetBase
50
+ })
51
+ }),
52
+ release.sections.map((section)=>{
53
+ const presentation = sectionPresentation(section.name, labels);
54
+ return /*#__PURE__*/ jsxs("section", {
55
+ className: `playbill-section playbill-section--${presentation.modifier}`,
56
+ children: [
57
+ /*#__PURE__*/ jsx(SectionHeading, {
58
+ className: "playbill-section__title",
59
+ children: presentation.title
60
+ }),
61
+ /*#__PURE__*/ jsx(Markdown, {
62
+ source: section.markdown,
63
+ assetBase: assetBase
64
+ })
65
+ ]
66
+ }, section.name);
67
+ })
68
+ ]
69
+ });
70
+ };
71
+
72
+ export { ReleaseNoteView };
73
+ //# sourceMappingURL=ReleaseNoteView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReleaseNoteView.js","sources":["../../../Release/ReleaseNoteView.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentType } from 'react';\nimport { Release } from '../Client/index.js';\nimport { PlaybillLabels } from '../Labels/index.js';\nimport { PlaybillMarkdown, PlaybillMarkdownProps } from '../Markdown/index.js';\nimport { formatReleaseDate } from './formatReleaseDate.js';\nimport { sectionPresentation } from './sectionPresentation.js';\n\n/**\n * Props for {@link ReleaseNoteView}, and for the component given to the `release` slot of {@link Playbill} and\n * {@link PlaybillDialog}.\n */\nexport interface ReleaseNoteViewProps {\n /** The release to show. */\n release: Release;\n /** Where the files of the release are served from; given to the Markdown renderer so its images load. */\n assetBase?: string;\n /** The texts to show. */\n labels: PlaybillLabels;\n /** Renders the Markdown of the note; the `markdown` slot of {@link Playbill}. */\n markdown?: ComponentType<PlaybillMarkdownProps>;\n /** The locale to write the date in; the browser's when not given. */\n locale?: string | string[];\n /** Whether the person has not seen this release yet; it is marked with the `unread` text. */\n isUnread?: boolean;\n /** Whether this is the version the application is running; it is marked with the `current` text. */\n isCurrent?: boolean;\n /** The level of the heading of the version, so the release fits under the heading of the page or dialog around it. Defaults to 2. */\n headingLevel?: 2 | 3 | 4;\n}\n\n/**\n * One release: its version and date, what its note says before the first section, and each section under its heading.\n * It draws no frame of its own, so a page, a dialog or a product's own surface can hold it.\n */\nexport const ReleaseNoteView = ({\n release,\n assetBase,\n labels,\n markdown: Markdown = PlaybillMarkdown,\n locale,\n isUnread = false,\n isCurrent = false,\n headingLevel = 2\n}: ReleaseNoteViewProps) => {\n const Heading = `h${headingLevel}` as 'h2';\n const SectionHeading = `h${headingLevel + 1}` as 'h3';\n const date = formatReleaseDate(release.releasedAt, locale);\n return (\n <article className='playbill-release' data-version={release.version}>\n <header className='playbill-release__header'>\n <Heading className='playbill-release__version'>{release.version}</Heading>\n {isCurrent && <span className='playbill-tag playbill-tag--current'>{labels.current}</span>}\n {isUnread && <span className='playbill-tag playbill-tag--unread'>{labels.unread}</span>}\n {date && (\n <time className='playbill-release__date' dateTime={release.releasedAt ?? undefined}>\n {labels.released} {date}\n </time>\n )}\n </header>\n {release.lead.trim() !== '' && (\n <div className='playbill-release__lead'>\n <Markdown source={release.lead} assetBase={assetBase} />\n </div>\n )}\n {release.sections.map(section => {\n const presentation = sectionPresentation(section.name, labels);\n return (\n <section key={section.name} className={`playbill-section playbill-section--${presentation.modifier}`}>\n <SectionHeading className='playbill-section__title'>{presentation.title}</SectionHeading>\n <Markdown source={section.markdown} assetBase={assetBase} />\n </section>\n );\n })}\n </article>\n );\n};\n"],"names":["ReleaseNoteView","release","assetBase","labels","markdown","Markdown","PlaybillMarkdown","locale","isUnread","isCurrent","headingLevel","Heading","SectionHeading","date","formatReleaseDate","releasedAt","_jsxs","article","className","data-version","version","header","_jsx","span","current","unread","time","dateTime","undefined","released","lead","trim","div","source","sections","map","section","presentation","sectionPresentation","name","modifier","title"],"mappings":";;;;;AAAA;AACA;AAgCA;;;IAIO,MAAMA,eAAAA,GAAkB,CAAC,EAC5BC,OAAO,EACPC,SAAS,EACTC,MAAM,EACNC,QAAAA,EAAUC,WAAWC,gBAAgB,EACrCC,MAAM,EACNC,QAAAA,GAAW,KAAK,EAChBC,SAAAA,GAAY,KAAK,EACjBC,YAAAA,GAAe,CAAC,EACG,GAAA;AACnB,IAAA,MAAMC,OAAAA,GAAU,CAAC,CAAC,EAAED,YAAAA,CAAAA,CAAc;AAClC,IAAA,MAAME,cAAAA,GAAiB,CAAC,CAAC,EAAEF,eAAe,CAAA,CAAA,CAAG;AAC7C,IAAA,MAAMG,IAAAA,GAAOC,iBAAAA,CAAkBb,OAAAA,CAAQc,UAAU,EAAER,MAAAA,CAAAA;AACnD,IAAA,qBACIS,IAAA,CAACC,SAAAA,EAAAA;QAAQC,SAAAA,EAAU,kBAAA;AAAmBC,QAAAA,cAAAA,EAAclB,QAAQmB,OAAO;;0BAC/DJ,IAAA,CAACK,QAAAA,EAAAA;gBAAOH,SAAAA,EAAU,0BAAA;;kCACdI,GAAA,CAACX,OAAAA,EAAAA;wBAAQO,SAAAA,EAAU,2BAAA;AAA6BjB,wBAAAA,QAAAA,EAAAA,OAAAA,CAAQmB;;AACvDX,oBAAAA,SAAAA,kBAAaa,GAAA,CAACC,MAAAA,EAAAA;wBAAKL,SAAAA,EAAU,oCAAA;AAAsCf,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOqB;;AAC1EhB,oBAAAA,QAAAA,kBAAYc,GAAA,CAACC,MAAAA,EAAAA;wBAAKL,SAAAA,EAAU,mCAAA;AAAqCf,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOsB;;AACxEZ,oBAAAA,IAAAA,kBACGG,IAAA,CAACU,MAAAA,EAAAA;wBAAKR,SAAAA,EAAU,wBAAA;wBAAyBS,QAAAA,EAAU1B,OAAAA,CAAQc,UAAU,IAAIa,SAAAA;;AACpEzB,4BAAAA,MAAAA,CAAO0B,QAAQ;AAAC,4BAAA,GAAA;AAAEhB,4BAAAA;;;;;AAI9BZ,YAAAA,OAAAA,CAAQ6B,IAAI,CAACC,IAAI,EAAA,KAAO,oBACrBT,GAAA,CAACU,KAAAA,EAAAA;gBAAId,SAAAA,EAAU,wBAAA;AACX,gBAAA,QAAA,gBAAAI,GAAA,CAACjB,QAAAA,EAAAA;AAAS4B,oBAAAA,MAAAA,EAAQhC,QAAQ6B,IAAI;oBAAE5B,SAAAA,EAAWA;;;AAGlDD,YAAAA,OAAAA,CAAQiC,QAAQ,CAACC,GAAG,CAACC,CAAAA,OAAAA,GAAAA;AAClB,gBAAA,MAAMC,YAAAA,GAAeC,mBAAAA,CAAoBF,OAAAA,CAAQG,IAAI,EAAEpC,MAAAA,CAAAA;AACvD,gBAAA,qBACIa,IAAA,CAACoB,SAAAA,EAAAA;AAA2BlB,oBAAAA,SAAAA,EAAW,CAAC,mCAAmC,EAAEmB,YAAAA,CAAaG,QAAQ,CAAA,CAAE;;sCAChGlB,GAAA,CAACV,cAAAA,EAAAA;4BAAeM,SAAAA,EAAU,yBAAA;AAA2BmB,4BAAAA,QAAAA,EAAAA,YAAAA,CAAaI;;sCAClEnB,GAAA,CAACjB,QAAAA,EAAAA;AAAS4B,4BAAAA,MAAAA,EAAQG,QAAQhC,QAAQ;4BAAEF,SAAAA,EAAWA;;;AAFrCkC,iBAAAA,EAAAA,OAAAA,CAAQG,IAAI,CAAA;AAKlC,YAAA,CAAA;;;AAGZ;;"}
@@ -0,0 +1,2 @@
1
+ export declare const formatReleaseDate: (releasedAt?: string | null, locale?: string | string[]) => string;
2
+ //# sourceMappingURL=formatReleaseDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatReleaseDate.d.ts","sourceRoot":"","sources":["../../../Release/formatReleaseDate.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,GAAG,IAAI,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,KAAG,MAW1F,CAAC"}
@@ -0,0 +1,24 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * Formats the date a release was made. The date is the one in UTC, so every person reads the same day whatever time
5
+ * zone they are in.
6
+ * @param releasedAt The ISO date the release was made; absent when it was not recorded.
7
+ * @param locale The locale to write it in; the browser's when not given.
8
+ * @returns The date, or an empty string when there is none or it cannot be read.
9
+ */ const formatReleaseDate = (releasedAt, locale)=>{
10
+ if (!releasedAt) {
11
+ return '';
12
+ }
13
+ const date = new Date(releasedAt);
14
+ if (Number.isNaN(date.getTime())) {
15
+ return '';
16
+ }
17
+ return new Intl.DateTimeFormat(locale, {
18
+ dateStyle: 'long',
19
+ timeZone: 'UTC'
20
+ }).format(date);
21
+ };
22
+
23
+ export { formatReleaseDate };
24
+ //# sourceMappingURL=formatReleaseDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatReleaseDate.js","sources":["../../../Release/formatReleaseDate.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Formats the date a release was made. The date is the one in UTC, so every person reads the same day whatever time\n * zone they are in.\n * @param releasedAt The ISO date the release was made; absent when it was not recorded.\n * @param locale The locale to write it in; the browser's when not given.\n * @returns The date, or an empty string when there is none or it cannot be read.\n */\nexport const formatReleaseDate = (releasedAt?: string | null, locale?: string | string[]): string => {\n if (!releasedAt) {\n return '';\n }\n\n const date = new Date(releasedAt);\n if (Number.isNaN(date.getTime())) {\n return '';\n }\n\n return new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }).format(date);\n};\n"],"names":["formatReleaseDate","releasedAt","locale","date","Date","Number","isNaN","getTime","Intl","DateTimeFormat","dateStyle","timeZone","format"],"mappings":"AAAA;AACA;AAEA;;;;;;AAMC,IACM,MAAMA,iBAAAA,GAAoB,CAACC,UAAAA,EAA4BC,MAAAA,GAAAA;AAC1D,IAAA,IAAI,CAACD,UAAAA,EAAY;QACb,OAAO,EAAA;AACX,IAAA;IAEA,MAAME,IAAAA,GAAO,IAAIC,IAAAA,CAAKH,UAAAA,CAAAA;AACtB,IAAA,IAAII,MAAAA,CAAOC,KAAK,CAACH,IAAAA,CAAKI,OAAO,EAAA,CAAA,EAAK;QAC9B,OAAO,EAAA;AACX,IAAA;AAEA,IAAA,OAAO,IAAIC,IAAAA,CAAKC,cAAc,CAACP,MAAAA,EAAQ;QAAEQ,SAAAA,EAAW,MAAA;QAAQC,QAAAA,EAAU;AAAM,KAAA,CAAA,CAAGC,MAAM,CAACT,IAAAA,CAAAA;AAC1F;;"}
@@ -0,0 +1,4 @@
1
+ export * from './formatReleaseDate.js';
2
+ export * from './ReleaseNoteView.js';
3
+ export * from './sectionPresentation.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Release/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './formatReleaseDate.js';
2
+ export * from './ReleaseNoteView.js';
3
+ export * from './sectionPresentation.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Release/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PlaybillLabels } from '../Labels/index.js';
2
+ export interface SectionPresentation {
3
+ title: string;
4
+ modifier: string;
5
+ }
6
+ export declare const sectionPresentation: (name: string, labels: PlaybillLabels) => SectionPresentation;
7
+ //# sourceMappingURL=sectionPresentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sectionPresentation.d.ts","sourceRoot":"","sources":["../../../Release/sectionPresentation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,MAAM,WAAW,mBAAmB;IAEhC,KAAK,EAAE,MAAM,CAAC;IAEd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAkBD,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,QAAQ,cAAc,KAAG,mBAG1E,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ const known = {
4
+ added: 'added',
5
+ changed: 'changed',
6
+ fixed: 'fixed',
7
+ removed: 'removed',
8
+ security: 'security',
9
+ deprecated: 'deprecated'
10
+ };
11
+ /**
12
+ * Works out how a section of a release note is drawn. The sections of a release note are the six the release notes of
13
+ * every Cratis repository use; a heading written any other way is shown as it was written.
14
+ * @param name The heading of the section.
15
+ * @param labels The texts to show.
16
+ * @returns The title and the style of the section.
17
+ */ const sectionPresentation = (name, labels)=>{
18
+ const key = known[name.trim().toLowerCase()];
19
+ return key ? {
20
+ title: labels[key],
21
+ modifier: key
22
+ } : {
23
+ title: name,
24
+ modifier: 'other'
25
+ };
26
+ };
27
+
28
+ export { sectionPresentation };
29
+ //# sourceMappingURL=sectionPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sectionPresentation.js","sources":["../../../Release/sectionPresentation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PlaybillLabels } from '../Labels/index.js';\n\n/**\n * How a section of a release note is drawn.\n */\nexport interface SectionPresentation {\n /** The heading to show; the text the product gave for a known section, and the heading as written for any other. */\n title: string;\n /** The modifier of the `playbill-section` class, such as `added`; `other` for a heading that is not a known one. */\n modifier: string;\n}\n\nconst known: Record<string, keyof PlaybillLabels> = {\n added: 'added',\n changed: 'changed',\n fixed: 'fixed',\n removed: 'removed',\n security: 'security',\n deprecated: 'deprecated'\n};\n\n/**\n * Works out how a section of a release note is drawn. The sections of a release note are the six the release notes of\n * every Cratis repository use; a heading written any other way is shown as it was written.\n * @param name The heading of the section.\n * @param labels The texts to show.\n * @returns The title and the style of the section.\n */\nexport const sectionPresentation = (name: string, labels: PlaybillLabels): SectionPresentation => {\n const key = known[name.trim().toLowerCase()];\n return key ? { title: labels[key], modifier: key } : { title: name, modifier: 'other' };\n};\n"],"names":["known","added","changed","fixed","removed","security","deprecated","sectionPresentation","name","labels","key","trim","toLowerCase","title","modifier"],"mappings":"AAAA;AACA;AAcA,MAAMA,KAAAA,GAA8C;IAChDC,KAAAA,EAAO,OAAA;IACPC,OAAAA,EAAS,SAAA;IACTC,KAAAA,EAAO,OAAA;IACPC,OAAAA,EAAS,SAAA;IACTC,QAAAA,EAAU,UAAA;IACVC,UAAAA,EAAY;AAChB,CAAA;AAEA;;;;;;AAMC,IACM,MAAMC,mBAAAA,GAAsB,CAACC,IAAAA,EAAcC,MAAAA,GAAAA;AAC9C,IAAA,MAAMC,MAAMV,KAAK,CAACQ,KAAKG,IAAI,EAAA,CAAGC,WAAW,EAAA,CAAG;AAC5C,IAAA,OAAOF,GAAAA,GAAM;QAAEG,KAAAA,EAAOJ,MAAM,CAACC,GAAAA,CAAI;QAAEI,QAAAA,EAAUJ;KAAI,GAAI;QAAEG,KAAAA,EAAOL,IAAAA;QAAMM,QAAAA,EAAU;AAAQ,KAAA;AAC1F;;"}
@@ -0,0 +1,13 @@
1
+ export * from './Badge/index.js';
2
+ export * from './Client/index.js';
3
+ export * from './Configuration/index.js';
4
+ export * from './Dialog/index.js';
5
+ export * from './Icons.js';
6
+ export * from './Labels/index.js';
7
+ export * from './Markdown/index.js';
8
+ export * from './Playbill.js';
9
+ export * from './Release/index.js';
10
+ export * from './usePlaybill.js';
11
+ export * from './usePlaybillStatus.js';
12
+ export * from './useReleases.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,18 @@
1
+ export { PlaybillBadge } from './Badge/PlaybillBadge.js';
2
+ export { PlaybillClient, defaultBasePath } from './Client/PlaybillClient.js';
3
+ export { PlaybillProvider, usePlaybillClient } from './Configuration/PlaybillProvider.js';
4
+ export { PlaybillDialog } from './Dialog/PlaybillDialog.js';
5
+ export { PlaybillIcon } from './Icons.js';
6
+ export { defaultPlaybillLabels } from './Labels/defaultPlaybillLabels.js';
7
+ export { resolveLabels, withCount } from './Labels/resolveLabels.js';
8
+ export { resolveAssetUrl } from './Markdown/assetUrl.js';
9
+ export { PlaybillMarkdown } from './Markdown/PlaybillMarkdown.js';
10
+ export { isSafeLink, safeLinkOrEmpty } from './Markdown/safeLink.js';
11
+ export { Playbill } from './Playbill.js';
12
+ export { formatReleaseDate } from './Release/formatReleaseDate.js';
13
+ export { ReleaseNoteView } from './Release/ReleaseNoteView.js';
14
+ export { sectionPresentation } from './Release/sectionPresentation.js';
15
+ export { usePlaybill } from './usePlaybill.js';
16
+ export { usePlaybillStatus } from './usePlaybillStatus.js';
17
+ export { useRelease, useReleaseNotes, useReleases } from './useReleases.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,7 @@
1
+ export interface Loaded<TData> {
2
+ data?: TData;
3
+ isLoading: boolean;
4
+ error?: Error;
5
+ }
6
+ export declare const useLoaded: <TData>(load: (signal: AbortSignal) => Promise<TData>) => Loaded<TData>;
7
+ //# sourceMappingURL=useLoaded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoaded.d.ts","sourceRoot":"","sources":["../../useLoaded.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,MAAM,CAAC,KAAK;IAEzB,IAAI,CAAC,EAAE,KAAK,CAAC;IAEb,SAAS,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAQD,eAAO,MAAM,SAAS,GAAI,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,KAAK,CAqB7F,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * Reads something when the component is shown and again whenever the read changes, cancelling a read that is no longer
7
+ * wanted. The read must be stable between renders, for example made with `useCallback`.
8
+ * @param load Starts the read; gets a signal that is aborted when it is no longer wanted.
9
+ * @returns What was read, whether it is still being read, and why it failed.
10
+ */ const useLoaded = (load)=>{
11
+ const [state, setState] = useState({
12
+ isLoading: true
13
+ });
14
+ useEffect(()=>{
15
+ const controller = new AbortController();
16
+ setState((previous)=>({
17
+ isLoading: true,
18
+ data: previous.data
19
+ }));
20
+ load(controller.signal).then((data)=>{
21
+ if (!controller.signal.aborted) {
22
+ setState({
23
+ isLoading: false,
24
+ data
25
+ });
26
+ }
27
+ }).catch((error)=>{
28
+ if (!controller.signal.aborted) {
29
+ setState({
30
+ isLoading: false,
31
+ error: error instanceof Error ? error : new Error(String(error))
32
+ });
33
+ }
34
+ });
35
+ return ()=>controller.abort();
36
+ }, [
37
+ load
38
+ ]);
39
+ return state;
40
+ };
41
+
42
+ export { useLoaded };
43
+ //# sourceMappingURL=useLoaded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoaded.js","sources":["../../useLoaded.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useState } from 'react';\n\n/**\n * What {@link useLoaded} gives a component.\n */\nexport interface Loaded<TData> {\n /** What was read; absent until the first read has finished, and while the read is repeated for another input. */\n data?: TData;\n /** Whether a read is in progress. */\n isLoading: boolean;\n /** Why the last read failed; absent when it did not. */\n error?: Error;\n}\n\n/**\n * Reads something when the component is shown and again whenever the read changes, cancelling a read that is no longer\n * wanted. The read must be stable between renders, for example made with `useCallback`.\n * @param load Starts the read; gets a signal that is aborted when it is no longer wanted.\n * @returns What was read, whether it is still being read, and why it failed.\n */\nexport const useLoaded = <TData,>(load: (signal: AbortSignal) => Promise<TData>): Loaded<TData> => {\n const [state, setState] = useState<Loaded<TData>>({ isLoading: true });\n\n useEffect(() => {\n const controller = new AbortController();\n setState(previous => ({ isLoading: true, data: previous.data }));\n load(controller.signal)\n .then(data => {\n if (!controller.signal.aborted) {\n setState({ isLoading: false, data });\n }\n })\n .catch((error: unknown) => {\n if (!controller.signal.aborted) {\n setState({ isLoading: false, error: error instanceof Error ? error : new Error(String(error)) });\n }\n });\n return () => controller.abort();\n }, [load]);\n\n return state;\n};\n"],"names":["useLoaded","load","state","setState","useState","isLoading","useEffect","controller","AbortController","previous","data","signal","then","aborted","catch","error","Error","String","abort"],"mappings":";;AAAA;AACA;AAgBA;;;;;IAMO,MAAMA,SAAAA,GAAY,CAASC,IAAAA,GAAAA;AAC9B,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAAwB;QAAEC,SAAAA,EAAW;AAAK,KAAA,CAAA;IAEpEC,SAAAA,CAAU,IAAA;AACN,QAAA,MAAMC,aAAa,IAAIC,eAAAA,EAAAA;QACvBL,QAAAA,CAASM,CAAAA,YAAa;gBAAEJ,SAAAA,EAAW,IAAA;AAAMK,gBAAAA,IAAAA,EAAMD,SAASC;aAAK,CAAA,CAAA;AAC7DT,QAAAA,IAAAA,CAAKM,UAAAA,CAAWI,MAAM,CAAA,CACjBC,IAAI,CAACF,CAAAA,IAAAA,GAAAA;AACF,YAAA,IAAI,CAACH,UAAAA,CAAWI,MAAM,CAACE,OAAO,EAAE;gBAC5BV,QAAAA,CAAS;oBAAEE,SAAAA,EAAW,KAAA;AAAOK,oBAAAA;AAAK,iBAAA,CAAA;AACtC,YAAA;QACJ,CAAA,CAAA,CACCI,KAAK,CAAC,CAACC,KAAAA,GAAAA;AACJ,YAAA,IAAI,CAACR,UAAAA,CAAWI,MAAM,CAACE,OAAO,EAAE;gBAC5BV,QAAAA,CAAS;oBAAEE,SAAAA,EAAW,KAAA;AAAOU,oBAAAA,KAAAA,EAAOA,KAAAA,YAAiBC,KAAAA,GAAQD,KAAAA,GAAQ,IAAIC,MAAMC,MAAAA,CAAOF,KAAAA,CAAAA;AAAQ,iBAAA,CAAA;AAClG,YAAA;AACJ,QAAA,CAAA,CAAA;QACJ,OAAO,IAAMR,WAAWW,KAAK,EAAA;IACjC,CAAA,EAAG;AAACjB,QAAAA;AAAK,KAAA,CAAA;IAET,OAAOC,KAAAA;AACX;;"}
@@ -0,0 +1,5 @@
1
+ import { UsedReleases } from './useReleases.js';
2
+ import { UsedPlaybillStatus } from './usePlaybillStatus.js';
3
+ export type UsedPlaybill = UsedReleases & UsedPlaybillStatus;
4
+ export declare const usePlaybill: () => UsedPlaybill;
5
+ //# sourceMappingURL=usePlaybill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlaybill.d.ts","sourceRoot":"","sources":["../../usePlaybill.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAqB,MAAM,wBAAwB,CAAC;AAK/E,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,kBAAkB,CAAC;AAO7D,eAAO,MAAM,WAAW,QAAO,YAA8D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { useReleases } from './useReleases.js';
2
+ import { usePlaybillStatus } from './usePlaybillStatus.js';
3
+
4
+ // Copyright (c) Cratis. All rights reserved.
5
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
6
+ /**
7
+ * Reads the release history and observes which releases the signed-in person has not been told about, so a product can
8
+ * draw its own surface instead of {@link Playbill}'s. Must be used inside Arc's context, like every generated query.
9
+ * @returns The releases, and what the person has seen.
10
+ */ const usePlaybill = ()=>({
11
+ ...useReleases(),
12
+ ...usePlaybillStatus()
13
+ });
14
+
15
+ export { usePlaybill };
16
+ //# sourceMappingURL=usePlaybill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlaybill.js","sources":["../../usePlaybill.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UsedReleases, useReleases } from './useReleases.js';\nimport { UsedPlaybillStatus, usePlaybillStatus } from './usePlaybillStatus.js';\n\n/**\n * What {@link usePlaybill} gives a component: the release history and what the person has seen of it.\n */\nexport type UsedPlaybill = UsedReleases & UsedPlaybillStatus;\n\n/**\n * Reads the release history and observes which releases the signed-in person has not been told about, so a product can\n * draw its own surface instead of {@link Playbill}'s. Must be used inside Arc's context, like every generated query.\n * @returns The releases, and what the person has seen.\n */\nexport const usePlaybill = (): UsedPlaybill => ({ ...useReleases(), ...usePlaybillStatus() });\n"],"names":["usePlaybill","useReleases","usePlaybillStatus"],"mappings":";;;AAAA;AACA;AAUA;;;;AAIC,IACM,MAAMA,WAAAA,GAAc,KAAqB;AAAE,QAAA,GAAGC,WAAAA,EAAa;AAAE,QAAA,GAAGC,iBAAAA;AAAoB,KAAA;;"}
@@ -0,0 +1,8 @@
1
+ export interface UsedPlaybillStatus {
2
+ lastSeen?: string;
3
+ unread: number;
4
+ unreadVersions: string[];
5
+ markSeen(version: string): Promise<void>;
6
+ }
7
+ export declare const usePlaybillStatus: () => UsedPlaybillStatus;
8
+ //# sourceMappingURL=usePlaybillStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlaybillStatus.d.ts","sourceRoot":"","sources":["../../usePlaybillStatus.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,kBAAkB;IAE/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc,EAAE,MAAM,EAAE,CAAC;IAOzB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAQD,eAAO,MAAM,iBAAiB,QAAO,kBAgBpC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ForMe, MarkReleaseNotesSeen } from '@cratis/showrunner.playbill';
2
+ import { useCallback } from 'react';
3
+
4
+ // Copyright (c) Cratis. All rights reserved.
5
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
6
+ /**
7
+ * Observes which releases the signed-in person has not been told about, and lets a component record that they have.
8
+ * Must be used inside Arc's context, like every generated query. It needs the backend package
9
+ * `Cratis.Showrunner.Playbill`.
10
+ * @returns What the person has seen and how to record that they have seen more.
11
+ */ const usePlaybillStatus = ()=>{
12
+ const [result] = ForMe.use();
13
+ const [mark] = MarkReleaseNotesSeen.use();
14
+ const status = result.data?.[0];
15
+ const markSeen = useCallback(async (version)=>{
16
+ mark.version = version;
17
+ await mark.execute();
18
+ }, [
19
+ mark
20
+ ]);
21
+ return {
22
+ lastSeen: status?.lastSeen || undefined,
23
+ unread: status?.unread ?? 0,
24
+ unreadVersions: [
25
+ ...status?.unreadVersions ?? []
26
+ ],
27
+ markSeen
28
+ };
29
+ };
30
+
31
+ export { usePlaybillStatus };
32
+ //# sourceMappingURL=usePlaybillStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlaybillStatus.js","sources":["../../usePlaybillStatus.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ForMe, MarkReleaseNotesSeen } from '@cratis/showrunner.playbill';\nimport { useCallback } from 'react';\n\n/**\n * What {@link usePlaybillStatus} gives a component.\n */\nexport interface UsedPlaybillStatus {\n /** The newest release the person has seen the notes of; absent when they have seen none. */\n lastSeen?: string;\n /** How many releases they have not seen the notes of. */\n unread: number;\n /** The versions of those releases, the newest first. */\n unreadVersions: string[];\n /**\n * Records that the person has seen the release notes up to a version, on every device. It only moves forward, and\n * marking a release they have seen already does nothing.\n * @param version The newest release the person has seen the notes of.\n * @returns Resolves when the command has been sent.\n */\n markSeen(version: string): Promise<void>;\n}\n\n/**\n * Observes which releases the signed-in person has not been told about, and lets a component record that they have.\n * Must be used inside Arc's context, like every generated query. It needs the backend package\n * `Cratis.Showrunner.Playbill`.\n * @returns What the person has seen and how to record that they have seen more.\n */\nexport const usePlaybillStatus = (): UsedPlaybillStatus => {\n const [result] = ForMe.use();\n const [mark] = MarkReleaseNotesSeen.use();\n const status = result.data?.[0];\n\n const markSeen = useCallback(async (version: string) => {\n mark.version = version;\n await mark.execute();\n }, [mark]);\n\n return {\n lastSeen: status?.lastSeen || undefined,\n unread: status?.unread ?? 0,\n unreadVersions: [...status?.unreadVersions ?? []],\n markSeen\n };\n};\n"],"names":["usePlaybillStatus","result","ForMe","use","mark","MarkReleaseNotesSeen","status","data","markSeen","useCallback","version","execute","lastSeen","undefined","unread","unreadVersions"],"mappings":";;;AAAA;AACA;AAwBA;;;;;UAMaA,iBAAAA,GAAoB,IAAA;AAC7B,IAAA,MAAM,CAACC,MAAAA,CAAO,GAAGC,KAAAA,CAAMC,GAAG,EAAA;AAC1B,IAAA,MAAM,CAACC,IAAAA,CAAK,GAAGC,oBAAAA,CAAqBF,GAAG,EAAA;AACvC,IAAA,MAAMG,MAAAA,GAASL,MAAAA,CAAOM,IAAI,GAAG,CAAA,CAAE;IAE/B,MAAMC,QAAAA,GAAWC,YAAY,OAAOC,OAAAA,GAAAA;AAChCN,QAAAA,IAAAA,CAAKM,OAAO,GAAGA,OAAAA;AACf,QAAA,MAAMN,KAAKO,OAAO,EAAA;IACtB,CAAA,EAAG;AAACP,QAAAA;AAAK,KAAA,CAAA;IAET,OAAO;AACHQ,QAAAA,QAAAA,EAAUN,QAAQM,QAAAA,IAAYC,SAAAA;AAC9BC,QAAAA,MAAAA,EAAQR,QAAQQ,MAAAA,IAAU,CAAA;QAC1BC,cAAAA,EAAgB;AAAIT,YAAAA,GAAAA,MAAAA,EAAQS,kBAAkB;AAAG,SAAA;AACjDP,QAAAA;AACJ,KAAA;AACJ;;"}
@@ -0,0 +1,12 @@
1
+ import { Release, ReleaseSummary } from './Client/index.js';
2
+ import { Loaded } from './useLoaded.js';
3
+ export interface UsedReleases {
4
+ releases: ReleaseSummary[];
5
+ current?: string;
6
+ isLoading: boolean;
7
+ error?: Error;
8
+ }
9
+ export declare const useReleases: () => UsedReleases;
10
+ export declare const useRelease: (version?: string) => Loaded<Release>;
11
+ export declare const useReleaseNotes: (versions: string[]) => Loaded<Release[]>;
12
+ //# sourceMappingURL=useReleases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReleases.d.ts","sourceRoot":"","sources":["../../useReleases.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAC;AAKnD,MAAM,WAAW,YAAY;IAEzB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAE3B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAOD,eAAO,MAAM,WAAW,QAAO,YAK9B,CAAC;AAOF,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,KAAG,MAAM,CAAC,OAAO,CAO3D,CAAC;AAOF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,KAAG,MAAM,CAAC,OAAO,EAAE,CAKpE,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { useCallback } from 'react';
2
+ import { usePlaybillClient } from './Configuration/PlaybillProvider.js';
3
+ import { useLoaded } from './useLoaded.js';
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /**
8
+ * Reads the list of releases the application serves. Needs nothing but the endpoints `MapPlaybill` maps, so it works
9
+ * without Arc and for a person who has not signed in when the application allows anonymous callers.
10
+ * @returns The releases, whether they are being read and why they could not be.
11
+ */ const useReleases = ()=>{
12
+ const client = usePlaybillClient();
13
+ const load = useCallback((signal)=>client.list(undefined, signal), [
14
+ client
15
+ ]);
16
+ const { data, isLoading, error } = useLoaded(load);
17
+ return {
18
+ releases: data?.releases ?? [],
19
+ current: data?.current ?? undefined,
20
+ isLoading,
21
+ error
22
+ };
23
+ };
24
+ /**
25
+ * Reads one release with its note.
26
+ * @param version The version of the release; nothing is read while it is absent.
27
+ * @returns The release, whether it is being read and why it could not be.
28
+ */ const useRelease = (version)=>{
29
+ const client = usePlaybillClient();
30
+ const load = useCallback((signal)=>version ? client.get(version, signal) : Promise.reject(new Error('No release was asked for.')), [
31
+ client,
32
+ version
33
+ ]);
34
+ const loaded = useLoaded(load);
35
+ return version ? loaded : {
36
+ isLoading: false
37
+ };
38
+ };
39
+ /**
40
+ * Reads several releases with their notes, in the order they are asked for.
41
+ * @param versions The versions of the releases.
42
+ * @returns The releases, whether they are being read and why they could not be.
43
+ */ const useReleaseNotes = (versions)=>{
44
+ const client = usePlaybillClient();
45
+ const key = versions.join('|');
46
+ const load = useCallback((signal)=>Promise.all(key === '' ? [] : key.split('|').map((version)=>client.get(version, signal))), [
47
+ client,
48
+ key
49
+ ]);
50
+ return useLoaded(load);
51
+ };
52
+
53
+ export { useRelease, useReleaseNotes, useReleases };
54
+ //# sourceMappingURL=useReleases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReleases.js","sources":["../../useReleases.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback } from 'react';\nimport { Release, ReleaseSummary } from './Client/index.js';\nimport { usePlaybillClient } from './Configuration/index.js';\nimport { Loaded, useLoaded } from './useLoaded.js';\n\n/**\n * What {@link useReleases} gives a component.\n */\nexport interface UsedReleases {\n /** The releases, the newest first; empty until they are read. */\n releases: ReleaseSummary[];\n /** The version the application is running; absent when it is not known. */\n current?: string;\n /** Whether the releases are being read. */\n isLoading: boolean;\n /** Why they could not be read; absent when they could. */\n error?: Error;\n}\n\n/**\n * Reads the list of releases the application serves. Needs nothing but the endpoints `MapPlaybill` maps, so it works\n * without Arc and for a person who has not signed in when the application allows anonymous callers.\n * @returns The releases, whether they are being read and why they could not be.\n */\nexport const useReleases = (): UsedReleases => {\n const client = usePlaybillClient();\n const load = useCallback((signal: AbortSignal) => client.list(undefined, signal), [client]);\n const { data, isLoading, error } = useLoaded(load);\n return { releases: data?.releases ?? [], current: data?.current ?? undefined, isLoading, error };\n};\n\n/**\n * Reads one release with its note.\n * @param version The version of the release; nothing is read while it is absent.\n * @returns The release, whether it is being read and why it could not be.\n */\nexport const useRelease = (version?: string): Loaded<Release> => {\n const client = usePlaybillClient();\n const load = useCallback((signal: AbortSignal) => version\n ? client.get(version, signal)\n : Promise.reject(new Error('No release was asked for.')), [client, version]);\n const loaded = useLoaded(load);\n return version ? loaded : { isLoading: false };\n};\n\n/**\n * Reads several releases with their notes, in the order they are asked for.\n * @param versions The versions of the releases.\n * @returns The releases, whether they are being read and why they could not be.\n */\nexport const useReleaseNotes = (versions: string[]): Loaded<Release[]> => {\n const client = usePlaybillClient();\n const key = versions.join('|');\n const load = useCallback((signal: AbortSignal) => Promise.all(key === '' ? [] : key.split('|').map(version => client.get(version, signal))), [client, key]);\n return useLoaded(load);\n};\n"],"names":["useReleases","client","usePlaybillClient","load","useCallback","signal","list","undefined","data","isLoading","error","useLoaded","releases","current","useRelease","version","get","Promise","reject","Error","loaded","useReleaseNotes","versions","key","join","all","split","map"],"mappings":";;;;AAAA;AACA;AAqBA;;;;UAKaA,WAAAA,GAAc,IAAA;AACvB,IAAA,MAAMC,MAAAA,GAASC,iBAAAA,EAAAA;IACf,MAAMC,IAAAA,GAAOC,YAAY,CAACC,MAAAA,GAAwBJ,OAAOK,IAAI,CAACC,WAAWF,MAAAA,CAAAA,EAAS;AAACJ,QAAAA;AAAO,KAAA,CAAA;IAC1F,MAAM,EAAEO,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,SAAAA,CAAUR,IAAAA,CAAAA;IAC7C,OAAO;QAAES,QAAAA,EAAUJ,IAAAA,EAAMI,YAAY,EAAE;AAAEC,QAAAA,OAAAA,EAASL,MAAMK,OAAAA,IAAWN,SAAAA;AAAWE,QAAAA,SAAAA;AAAWC,QAAAA;AAAM,KAAA;AACnG;AAEA;;;;IAKO,MAAMI,UAAAA,GAAa,CAACC,OAAAA,GAAAA;AACvB,IAAA,MAAMd,MAAAA,GAASC,iBAAAA,EAAAA;AACf,IAAA,MAAMC,IAAAA,GAAOC,WAAAA,CAAY,CAACC,MAAAA,GAAwBU,UAC5Cd,MAAAA,CAAOe,GAAG,CAACD,OAAAA,EAASV,UACpBY,OAAAA,CAAQC,MAAM,CAAC,IAAIC,MAAM,2BAAA,CAAA,CAAA,EAA+B;AAAClB,QAAAA,MAAAA;AAAQc,QAAAA;AAAQ,KAAA,CAAA;AAC/E,IAAA,MAAMK,SAAST,SAAAA,CAAUR,IAAAA,CAAAA;AACzB,IAAA,OAAOY,UAAUK,MAAAA,GAAS;QAAEX,SAAAA,EAAW;AAAM,KAAA;AACjD;AAEA;;;;IAKO,MAAMY,eAAAA,GAAkB,CAACC,QAAAA,GAAAA;AAC5B,IAAA,MAAMrB,MAAAA,GAASC,iBAAAA,EAAAA;IACf,MAAMqB,GAAAA,GAAMD,QAAAA,CAASE,IAAI,CAAC,GAAA,CAAA;IAC1B,MAAMrB,IAAAA,GAAOC,YAAY,CAACC,MAAAA,GAAwBY,QAAQQ,GAAG,CAACF,GAAAA,KAAQ,EAAA,GAAK,EAAE,GAAGA,IAAIG,KAAK,CAAC,GAAA,CAAA,CAAKC,GAAG,CAACZ,CAAAA,UAAWd,MAAAA,CAAOe,GAAG,CAACD,OAAAA,EAASV,MAAAA,CAAAA,CAAAA,CAAAA,EAAW;AAACJ,QAAAA,MAAAA;AAAQsB,QAAAA;AAAI,KAAA,CAAA;AAC1J,IAAA,OAAOZ,SAAAA,CAAUR,IAAAA,CAAAA;AACrB;;"}
package/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ export * from './Badge/index.js';
5
+ export * from './Client/index.js';
6
+ export * from './Configuration/index.js';
7
+ export * from './Dialog/index.js';
8
+ export * from './Icons.js';
9
+ export * from './Labels/index.js';
10
+ export * from './Markdown/index.js';
11
+ export * from './Playbill.js';
12
+ export * from './Release/index.js';
13
+ export * from './usePlaybill.js';
14
+ export * from './usePlaybillStatus.js';
15
+ export * from './useReleases.js';