@backgold/template-kit 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 (340) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/chunk-KOB36GSF.js +62 -0
  4. package/dist/constants-DvTNj4JI.d-Batjcj3Z.d.ts +38 -0
  5. package/dist/content-api-CYeY0vU8.d.ts +849 -0
  6. package/dist/contract/content-api-examples.d.ts +58 -0
  7. package/dist/contract/content-api-examples.js +783 -0
  8. package/dist/contract/content-api.d.ts +2 -0
  9. package/dist/contract/content-api.js +1 -0
  10. package/dist/contract/site-templates.d.ts +252 -0
  11. package/dist/contract/site-templates.js +185 -0
  12. package/package.json +70 -3
  13. package/src/components/EntryCard.astro +35 -0
  14. package/src/components/EventMap.astro +118 -0
  15. package/src/components/EventPage.astro +194 -0
  16. package/src/components/FieldValue.astro +41 -0
  17. package/src/components/LeadingHero.astro +21 -0
  18. package/src/components/NotFound.astro +20 -0
  19. package/src/components/PageSections.astro +47 -0
  20. package/src/components/Prose.astro +18 -0
  21. package/src/components/chrome/Brand.astro +54 -0
  22. package/src/components/chrome/ClosingCall.astro +94 -0
  23. package/src/components/chrome/DonateStrip.astro +61 -0
  24. package/src/components/chrome/FooterColumns.astro +32 -0
  25. package/src/components/chrome/FooterContact.astro +28 -0
  26. package/src/components/chrome/MenuList.astro +45 -0
  27. package/src/components/chrome/ModeToggle.astro +125 -0
  28. package/src/components/chrome/SignedInNotice.astro +53 -0
  29. package/src/components/chrome/SignupBand.astro +12 -0
  30. package/src/components/chrome/TakeoverBanner.astro +56 -0
  31. package/src/components/chrome/VisitorAccount.astro +82 -0
  32. package/src/components/entries/AuthorBox.astro +47 -0
  33. package/src/components/entries/EntryFields.astro +29 -0
  34. package/src/components/entries/EntryHeader.astro +77 -0
  35. package/src/components/entries/ListFrame.astro +126 -0
  36. package/src/components/entries/ListSearch.astro +24 -0
  37. package/src/components/entries/Share.astro +24 -0
  38. package/src/components/entries/course/classroom.astro +26 -0
  39. package/src/components/entries/course/lesson.astro +18 -0
  40. package/src/components/entries/course/section.ts +20 -0
  41. package/src/components/entries/course/syllabus.astro +15 -0
  42. package/src/components/entries/index.ts +77 -0
  43. package/src/components/entries/newsletter/issue.astro +41 -0
  44. package/src/components/entries/newsletter/list.astro +26 -0
  45. package/src/components/entries/podcast/episode.astro +42 -0
  46. package/src/components/entries/podcast/list.astro +36 -0
  47. package/src/components/entries/post/article.astro +31 -0
  48. package/src/components/entries/post/list.astro +85 -0
  49. package/src/components/entries/props.ts +61 -0
  50. package/src/components/entries/video/cards.astro +39 -0
  51. package/src/components/entries/video/grid.astro +15 -0
  52. package/src/components/entries/video/watch.astro +41 -0
  53. package/src/components/live/LivePage.astro +215 -0
  54. package/src/components/live/LocalTime.astro +29 -0
  55. package/src/components/sections/About/books.astro +188 -0
  56. package/src/components/sections/About/credentials.ts +90 -0
  57. package/src/components/sections/About/index.astro +57 -0
  58. package/src/components/sections/About/left.astro +54 -0
  59. package/src/components/sections/About/letter.astro +108 -0
  60. package/src/components/sections/About/portrait.astro +308 -0
  61. package/src/components/sections/Advocacy/compact.astro +14 -0
  62. package/src/components/sections/Advocacy/index.astro +14 -0
  63. package/src/components/sections/Band.astro +39 -0
  64. package/src/components/sections/Blog/feature.astro +176 -0
  65. package/src/components/sections/Blog/index.astro +37 -0
  66. package/src/components/sections/Blog/latest.ts +80 -0
  67. package/src/components/sections/Blog/list.astro +186 -0
  68. package/src/components/sections/Booking/index.astro +139 -0
  69. package/src/components/sections/Booking/list.astro +144 -0
  70. package/src/components/sections/Booking/types.ts +60 -0
  71. package/src/components/sections/Calendar/agenda.astro +14 -0
  72. package/src/components/sections/Calendar/index.astro +14 -0
  73. package/src/components/sections/CandidateRoster/ballot.astro +394 -0
  74. package/src/components/sections/CandidateRoster/candidates.ts +69 -0
  75. package/src/components/sections/CandidateRoster/compact.astro +115 -0
  76. package/src/components/sections/CandidateRoster/index.astro +57 -0
  77. package/src/components/sections/CaseStudies/beforeafter.astro +222 -0
  78. package/src/components/sections/CaseStudies/cases.ts +111 -0
  79. package/src/components/sections/CaseStudies/grid.astro +261 -0
  80. package/src/components/sections/CaseStudies/index.astro +333 -0
  81. package/src/components/sections/Classroom/CourseCard.astro +181 -0
  82. package/src/components/sections/Classroom/Courses.astro +88 -0
  83. package/src/components/sections/Classroom/classroom.ts +141 -0
  84. package/src/components/sections/Classroom/index.astro +20 -0
  85. package/src/components/sections/Classroom/list.astro +15 -0
  86. package/src/components/sections/Collection/compact.astro +7 -0
  87. package/src/components/sections/Collection/entries.ts +62 -0
  88. package/src/components/sections/Collection/feature.astro +180 -0
  89. package/src/components/sections/Collection/index.astro +46 -0
  90. package/src/components/sections/Collection/library.astro +271 -0
  91. package/src/components/sections/Collection/list.astro +7 -0
  92. package/src/components/sections/Collection/outline.astro +134 -0
  93. package/src/components/sections/Collection/shelves.astro +191 -0
  94. package/src/components/sections/Comparison/Unlisted.astro +6 -0
  95. package/src/components/sections/Comparison/cards.astro +171 -0
  96. package/src/components/sections/Comparison/index.astro +191 -0
  97. package/src/components/sections/Comparison/sides.ts +98 -0
  98. package/src/components/sections/Comparison/spectrum.astro +261 -0
  99. package/src/components/sections/ContentPost/banner.astro +152 -0
  100. package/src/components/sections/ContentPost/index.astro +35 -0
  101. package/src/components/sections/ContentPost/lesson.ts +119 -0
  102. package/src/components/sections/ContentPost/player.astro +254 -0
  103. package/src/components/sections/ContentPost/theater.astro +329 -0
  104. package/src/components/sections/Countdown/index.astro +53 -0
  105. package/src/components/sections/Course/Bar.astro +46 -0
  106. package/src/components/sections/Course/CourseHead.astro +123 -0
  107. package/src/components/sections/Course/Crumbs.astro +44 -0
  108. package/src/components/sections/Course/Icon.astro +29 -0
  109. package/src/components/sections/Course/Ring.astro +62 -0
  110. package/src/components/sections/Course/Syllabus.astro +146 -0
  111. package/src/components/sections/Course/course.ts +146 -0
  112. package/src/components/sections/Course/index.astro +143 -0
  113. package/src/components/sections/Course/outline.astro +39 -0
  114. package/src/components/sections/Cta/banner.astro +64 -0
  115. package/src/components/sections/Cta/card.astro +88 -0
  116. package/src/components/sections/Cta/index.astro +31 -0
  117. package/src/components/sections/Cta/photo.astro +114 -0
  118. package/src/components/sections/Cta/strip.astro +91 -0
  119. package/src/components/sections/Donate/index.astro +136 -0
  120. package/src/components/sections/Donate/story.astro +7 -0
  121. package/src/components/sections/Event/card.astro +14 -0
  122. package/src/components/sections/Event/index.astro +14 -0
  123. package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
  124. package/src/components/sections/EventsList/CalendarLine.astro +23 -0
  125. package/src/components/sections/EventsList/EventRows.astro +196 -0
  126. package/src/components/sections/EventsList/LiveCounts.astro +75 -0
  127. package/src/components/sections/EventsList/TypeTabs.astro +53 -0
  128. package/src/components/sections/EventsList/agenda.astro +55 -0
  129. package/src/components/sections/EventsList/calendar.astro +392 -0
  130. package/src/components/sections/EventsList/cards.astro +186 -0
  131. package/src/components/sections/EventsList/cohorts.astro +205 -0
  132. package/src/components/sections/EventsList/compact.astro +163 -0
  133. package/src/components/sections/EventsList/events.ts +168 -0
  134. package/src/components/sections/EventsList/index.astro +46 -0
  135. package/src/components/sections/EventsList/map.astro +436 -0
  136. package/src/components/sections/EventsList/shifts.astro +355 -0
  137. package/src/components/sections/EventsList/week.astro +361 -0
  138. package/src/components/sections/Faq/Contact.astro +63 -0
  139. package/src/components/sections/Faq/Questions.astro +98 -0
  140. package/src/components/sections/Faq/cards.astro +74 -0
  141. package/src/components/sections/Faq/faq.ts +101 -0
  142. package/src/components/sections/Faq/index.astro +49 -0
  143. package/src/components/sections/Faq/topics.astro +178 -0
  144. package/src/components/sections/Financials/Foot.astro +38 -0
  145. package/src/components/sections/Financials/Head.astro +47 -0
  146. package/src/components/sections/Financials/donut.astro +197 -0
  147. package/src/components/sections/Financials/financials.ts +52 -0
  148. package/src/components/sections/Financials/index.astro +148 -0
  149. package/src/components/sections/Financials/table.astro +157 -0
  150. package/src/components/sections/FormBlock/index.astro +33 -0
  151. package/src/components/sections/FormBlock/wide.astro +7 -0
  152. package/src/components/sections/Hero/cover.astro +170 -0
  153. package/src/components/sections/Hero/donate.astro +209 -0
  154. package/src/components/sections/Hero/field.astro +390 -0
  155. package/src/components/sections/Hero/index.astro +52 -0
  156. package/src/components/sections/Hero/overlap.astro +151 -0
  157. package/src/components/sections/Hero/rotating.astro +30 -0
  158. package/src/components/sections/Hero/split.astro +96 -0
  159. package/src/components/sections/Hero/statement.astro +55 -0
  160. package/src/components/sections/Hero/video.astro +399 -0
  161. package/src/components/sections/Issues/checklist.astro +204 -0
  162. package/src/components/sections/Issues/drawer.astro +237 -0
  163. package/src/components/sections/Issues/index.astro +115 -0
  164. package/src/components/sections/Issues/issues.ts +37 -0
  165. package/src/components/sections/Issues/numbered.astro +79 -0
  166. package/src/components/sections/Issues/rows.astro +137 -0
  167. package/src/components/sections/Issues/steps.astro +81 -0
  168. package/src/components/sections/Issues/tabs.astro +322 -0
  169. package/src/components/sections/Leaderboard/index.astro +29 -0
  170. package/src/components/sections/Lesson/Door.astro +121 -0
  171. package/src/components/sections/Lesson/LessonBody.astro +416 -0
  172. package/src/components/sections/Lesson/Rail.astro +182 -0
  173. package/src/components/sections/Lesson/Tracker.astro +137 -0
  174. package/src/components/sections/Lesson/index.astro +27 -0
  175. package/src/components/sections/Lesson/lesson.ts +233 -0
  176. package/src/components/sections/Lesson/reading.astro +21 -0
  177. package/src/components/sections/Map/CoverageLine.astro +19 -0
  178. package/src/components/sections/Map/RegionMap.astro +109 -0
  179. package/src/components/sections/Map/bar.astro +160 -0
  180. package/src/components/sections/Map/index.astro +192 -0
  181. package/src/components/sections/Map/map.astro +275 -0
  182. package/src/components/sections/MediaKit/BioCard.astro +108 -0
  183. package/src/components/sections/MediaKit/Downloads.astro +88 -0
  184. package/src/components/sections/MediaKit/index.astro +183 -0
  185. package/src/components/sections/MediaKit/kit.ts +140 -0
  186. package/src/components/sections/MediaKit/press.astro +189 -0
  187. package/src/components/sections/MediaKit/speaker.astro +205 -0
  188. package/src/components/sections/Membership/Benefits.astro +42 -0
  189. package/src/components/sections/Membership/Check.astro +12 -0
  190. package/src/components/sections/Membership/Price.astro +61 -0
  191. package/src/components/sections/Membership/compare.astro +312 -0
  192. package/src/components/sections/Membership/index.astro +281 -0
  193. package/src/components/sections/Membership/offers.ts +169 -0
  194. package/src/components/sections/Membership/tiers.astro +217 -0
  195. package/src/components/sections/MovementMap/index.astro +50 -0
  196. package/src/components/sections/MovementTicker/index.astro +43 -0
  197. package/src/components/sections/Pathways/Doors.astro +147 -0
  198. package/src/components/sections/Pathways/Head.astro +37 -0
  199. package/src/components/sections/Pathways/index.astro +27 -0
  200. package/src/components/sections/Pathways/pathways.ts +100 -0
  201. package/src/components/sections/Pathways/quiz.astro +286 -0
  202. package/src/components/sections/Pathways/tabs.astro +271 -0
  203. package/src/components/sections/PdfEmbed/card.astro +99 -0
  204. package/src/components/sections/PdfEmbed/index.astro +26 -0
  205. package/src/components/sections/PdfEmbed/medium.astro +7 -0
  206. package/src/components/sections/PdfEmbed/tall.astro +7 -0
  207. package/src/components/sections/Petition/coverage.astro +14 -0
  208. package/src/components/sections/Petition/image.astro +14 -0
  209. package/src/components/sections/Petition/index.astro +14 -0
  210. package/src/components/sections/Petition/map.astro +14 -0
  211. package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
  212. package/src/components/sections/PlatformPlanks/columns.astro +171 -0
  213. package/src/components/sections/PlatformPlanks/index.astro +56 -0
  214. package/src/components/sections/PlatformPlanks/longread.astro +250 -0
  215. package/src/components/sections/PollBlock/index.astro +30 -0
  216. package/src/components/sections/Portfolio/featured.astro +343 -0
  217. package/src/components/sections/Portfolio/index.astro +571 -0
  218. package/src/components/sections/Portfolio/strip.astro +173 -0
  219. package/src/components/sections/Portfolio/work.ts +100 -0
  220. package/src/components/sections/Progress/MatchClock.astro +166 -0
  221. package/src/components/sections/Progress/compact.astro +150 -0
  222. package/src/components/sections/Progress/index.astro +32 -0
  223. package/src/components/sections/Progress/match.astro +126 -0
  224. package/src/components/sections/Progress/ring.astro +179 -0
  225. package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
  226. package/src/components/sections/QuickDonate/Picker.astro +95 -0
  227. package/src/components/sections/QuickDonate/band.astro +164 -0
  228. package/src/components/sections/QuickDonate/bar.astro +208 -0
  229. package/src/components/sections/QuickDonate/donate.ts +126 -0
  230. package/src/components/sections/QuickDonate/hero.astro +143 -0
  231. package/src/components/sections/QuickDonate/index.astro +73 -0
  232. package/src/components/sections/QuickDonate/jar.astro +225 -0
  233. package/src/components/sections/QuickDonate/ladder.astro +248 -0
  234. package/src/components/sections/QuoteStrip/carousel.astro +340 -0
  235. package/src/components/sections/QuoteStrip/index.astro +58 -0
  236. package/src/components/sections/QuoteStrip/logos.astro +226 -0
  237. package/src/components/sections/QuoteStrip/quotes.ts +61 -0
  238. package/src/components/sections/QuoteStrip/single.astro +92 -0
  239. package/src/components/sections/QuoteStrip/ticker.astro +319 -0
  240. package/src/components/sections/QuoteStrip/wall.astro +113 -0
  241. package/src/components/sections/Resources/band.astro +93 -0
  242. package/src/components/sections/Resources/featured.astro +239 -0
  243. package/src/components/sections/Resources/index.astro +225 -0
  244. package/src/components/sections/Resources/resources.ts +92 -0
  245. package/src/components/sections/SampleBallot/Position.astro +39 -0
  246. package/src/components/sections/SampleBallot/ballot.ts +92 -0
  247. package/src/components/sections/SampleBallot/cards.astro +299 -0
  248. package/src/components/sections/SampleBallot/index.astro +326 -0
  249. package/src/components/sections/SampleBallot/measures.astro +172 -0
  250. package/src/components/sections/Scorecard/grades.astro +141 -0
  251. package/src/components/sections/Scorecard/index.astro +294 -0
  252. package/src/components/sections/Scorecard/promise.astro +167 -0
  253. package/src/components/sections/Scorecard/votes.ts +83 -0
  254. package/src/components/sections/SectionHead.astro +31 -0
  255. package/src/components/sections/Services/Button.astro +24 -0
  256. package/src/components/sections/Services/Check.astro +12 -0
  257. package/src/components/sections/Services/Includes.astro +42 -0
  258. package/src/components/sections/Services/compare.astro +328 -0
  259. package/src/components/sections/Services/index.astro +187 -0
  260. package/src/components/sections/Services/list.astro +181 -0
  261. package/src/components/sections/Services/services.ts +80 -0
  262. package/src/components/sections/ShareKit/Actions.astro +71 -0
  263. package/src/components/sections/ShareKit/Buttons.astro +62 -0
  264. package/src/components/sections/ShareKit/compact.astro +123 -0
  265. package/src/components/sections/ShareKit/index.astro +160 -0
  266. package/src/components/sections/ShareKit/share.ts +60 -0
  267. package/src/components/sections/ShareKit/strip.astro +173 -0
  268. package/src/components/sections/SignupCapture/band.astro +7 -0
  269. package/src/components/sections/SignupCapture/index.astro +103 -0
  270. package/src/components/sections/SignupCapture/inline.astro +7 -0
  271. package/src/components/sections/SocialFeed/index.astro +34 -0
  272. package/src/components/sections/StatCards/feature.astro +143 -0
  273. package/src/components/sections/StatCards/index.astro +51 -0
  274. package/src/components/sections/StatCards/ribbon.astro +113 -0
  275. package/src/components/sections/StatCards/wall.astro +177 -0
  276. package/src/components/sections/Store/featured.astro +14 -0
  277. package/src/components/sections/Store/index.astro +14 -0
  278. package/src/components/sections/Stories/Status.astro +42 -0
  279. package/src/components/sections/Stories/StoryCards.astro +171 -0
  280. package/src/components/sections/Stories/cards.astro +42 -0
  281. package/src/components/sections/Stories/index.astro +238 -0
  282. package/src/components/sections/Stories/stories.ts +97 -0
  283. package/src/components/sections/Stories/timeline.astro +135 -0
  284. package/src/components/sections/TeamGrid/board.astro +280 -0
  285. package/src/components/sections/TeamGrid/index.astro +71 -0
  286. package/src/components/sections/TeamGrid/list.astro +306 -0
  287. package/src/components/sections/TeamGrid/people.ts +178 -0
  288. package/src/components/sections/VideoEmbed/index.astro +52 -0
  289. package/src/components/sections/VideoEmbed/landscape.astro +7 -0
  290. package/src/components/sections/VideoEmbed/portrait.astro +7 -0
  291. package/src/components/sections/VideoEmbed/square.astro +7 -0
  292. package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
  293. package/src/components/sections/VoterTools/dates.astro +149 -0
  294. package/src/components/sections/VoterTools/index.astro +228 -0
  295. package/src/components/sections/VoterTools/polling.astro +141 -0
  296. package/src/components/sections/VoterTools/voter-tools.ts +70 -0
  297. package/src/components/sections/index.ts +370 -0
  298. package/src/components/sections/modules/Headed.astro +39 -0
  299. package/src/components/sections/modules/ModuleFrame.astro +179 -0
  300. package/src/components/volunteer/ShiftLive.astro +90 -0
  301. package/src/components/volunteer/detail.astro +247 -0
  302. package/src/components/volunteer/list.astro +298 -0
  303. package/src/components/volunteer/props.ts +21 -0
  304. package/src/env.d.ts +22 -0
  305. package/src/index.d.ts +10 -0
  306. package/src/index.js +64 -0
  307. package/src/layouts/Site.astro +371 -0
  308. package/src/lib/academy.ts +146 -0
  309. package/src/lib/brand.ts +534 -0
  310. package/src/lib/chrome.ts +119 -0
  311. package/src/lib/donate-frame.ts +64 -0
  312. package/src/lib/entries.ts +190 -0
  313. package/src/lib/env.ts +34 -0
  314. package/src/lib/event-map-draw.ts +91 -0
  315. package/src/lib/events.ts +476 -0
  316. package/src/lib/fonts.ts +116 -0
  317. package/src/lib/footer.ts +24 -0
  318. package/src/lib/format.ts +160 -0
  319. package/src/lib/geo.ts +131 -0
  320. package/src/lib/live.ts +54 -0
  321. package/src/lib/menu.ts +48 -0
  322. package/src/lib/petition-text.ts +29 -0
  323. package/src/lib/reading.ts +17 -0
  324. package/src/lib/regions.ts +215 -0
  325. package/src/lib/section.ts +94 -0
  326. package/src/lib/shifts.ts +186 -0
  327. package/src/lib/stream-time.ts +20 -0
  328. package/src/lib/stream.ts +141 -0
  329. package/src/lib/visitor.ts +54 -0
  330. package/src/routes/catch-all.astro +286 -0
  331. package/src/routes/form.astro +30 -0
  332. package/src/routes/live.astro +49 -0
  333. package/src/routes/not-found.astro +18 -0
  334. package/src/routes/preview.astro +60 -0
  335. package/src/routes/setup.astro +62 -0
  336. package/src/routes/volunteer-shift.astro +61 -0
  337. package/src/routes/volunteer.astro +37 -0
  338. package/src/styles/entries.css +784 -0
  339. package/src/styles/site.css +1839 -0
  340. package/src/template.ts +182 -0
@@ -0,0 +1,179 @@
1
+ ---
2
+ // BackGold's own module (donate, a form, a sign-up, a petition, an event's
3
+ // RSVP and tickets, the store, the calendar, a poll, contacting legislators)
4
+ // as the boards draw it "first-party, in the site's tokens" (A7–A12): the
5
+ // module's frame, asked to wear this site (BackGold's embed look: the section's
6
+ // layout, the colours where it sits, light and dark, the radius and the type)
7
+ // so it draws no ground, card, heading or platform footer of its own. The
8
+ // face is the template's `frameFont` when it is one the embed look accepts
9
+ // (FRAME_FONTS), read from `Astro.locals.template` (the routes set it);
10
+ // where that is unset, Public Sans, as it is for a template that names none.
11
+ // An unknown value is never sent:
12
+ // the api drops a look with a malformed `font` as a whole. The corners are
13
+ // the template's `frameRadius` (a whole number of pixels, 0 to 40, the embed look's bounds), else 12,
14
+ // read the same way. The colours are the band's through the template's
15
+ // `frameColors` when it has one, and a template with `frameSkin` asks the
16
+ // frame to load its stylesheet (`skin`, the site's own https origin, where the
17
+ // template serves /_backgold/frame.css), read the same way. The
18
+ // site credits BackGold once, as "Powered by BackGold" in the footer's bottom
19
+ // row, never per module.
20
+ //
21
+ // The fields, limits, receipts, consent and every write stay BackGold's, in
22
+ // its frame: nothing here builds, covers or imitates a field. `card` sets the
23
+ // module on a raised card (its frame then sits on the card colour, the panel
24
+ // band's); without it the module sits straight on the section's band. The
25
+ // default slot is drawn inside the card above the module (a form's title).
26
+ // Advocacy has no frame, only a container its script fills: it is placed as
27
+ // BackGold sends it.
28
+ //
29
+ // `params` adds the frame's own options to its address beside the look, the
30
+ // allowlisted keys only (FRAME_PARAMS: `text`, `full` or `collapsed`, a
31
+ // petition sheet's text drawn whole or as a closed disclosure); any other key
32
+ // or value is never sent.
33
+ //
34
+ // A Donate frame also carries the page address's donate names (an ask
35
+ // amount, a donate place, `utm_*`, lib/donate-frame.ts) that its address from
36
+ // BackGold does not already name.
37
+ //
38
+ // A section BackGold sends with no embed has nothing to frame (no donation
39
+ // form for the organization, no petition picked, an event no longer public):
40
+ // it draws one line saying the module is not available, where the module
41
+ // would be, never nothing, in the words a hosted BackGold page uses for a
42
+ // donate module with no form.
43
+ import type { SectionEmbed } from '@backgold/content'
44
+ import { Embed } from '@backgold/astro/components'
45
+ import { SECTION_BANDS, appearanceOf, moduleLook, type SectionBand } from '../../../lib/brand'
46
+ import { isDonateFrame, withDonateQuery } from '../../../lib/donate-frame'
47
+
48
+ interface Props {
49
+ /** The section's (or the event page's) embed, as BackGold sends it. */
50
+ embed: SectionEmbed | null | undefined
51
+ /** The ground the module sits on when it has no card: the section's band. */
52
+ band: string
53
+ /** The module's type, kept as `data-module`. */
54
+ type: string
55
+ /** The layout the frame arranges itself for (the section's, else the type's default). */
56
+ layout: string
57
+ card?: boolean
58
+ /** The frame's accessible name. */
59
+ title: string
60
+ /** How tall the frame starts before it reports its own height. */
61
+ height?: string
62
+ class?: string
63
+ /** The frame's own options, appended to its address (FRAME_PARAMS keys and values only). */
64
+ params?: Record<string, string>
65
+ }
66
+
67
+ const { embed: sent, band: sectionBand, type, layout, card = false, title, height = '32rem', class: className, params = {} } = Astro.props
68
+ /** The frame options a template may send, each with the values the frame takes. */
69
+ const FRAME_PARAMS: Record<string, readonly string[]> = { text: ['full', 'collapsed'] }
70
+ const bg = Astro.locals.backgold
71
+ const brand = bg.setup === null ? bg.site.brand : null
72
+ const theme = bg.setup === null ? bg.site.theme : null
73
+ const appearance = bg.setup === null ? appearanceOf(bg.site.style) : 'auto'
74
+ /** The faces BackGold's embed look accepts (the api's EMBED_LOOK_FONTS). */
75
+ const FRAME_FONTS = ['public-sans', 'inter', 'system-sans', 'system-serif', 'ubuntu-sans-mono', 'jetbrains-mono']
76
+ const frameFont = Astro.locals.template?.frameFont
77
+ const font = frameFont && FRAME_FONTS.includes(frameFont) ? frameFont : 'public-sans'
78
+ const frameRadius = Astro.locals.template?.frameRadius
79
+ const radius = typeof frameRadius === 'number' && Number.isInteger(frameRadius) && frameRadius >= 0 && frameRadius <= 40 ? frameRadius : 12
80
+ /** The site's own https origin for a template that serves the frames its stylesheet; null otherwise (an http dev server cannot be one). */
81
+ function skinOrigin(): string | null {
82
+ if (!Astro.locals.template?.frameSkin) return null
83
+ const site = bg.setup === null && bg.siteUrl ? bg.siteUrl : Astro.url.origin
84
+ try {
85
+ const url = new URL(site)
86
+ return url.protocol === 'https:' ? url.origin : null
87
+ } catch {
88
+ return null
89
+ }
90
+ }
91
+ const skin = skinOrigin()
92
+ const band: SectionBand = card ? 'panel' : SECTION_BANDS.includes(sectionBand as SectionBand) ? (sectionBand as SectionBand) : 'plain'
93
+
94
+ /** The module's address with the look query (and a Donate frame's donate names), or as sent when it is not one we can read. */
95
+ function framed(iframe: string | null): string | null {
96
+ if (!iframe) return iframe
97
+ let url: URL
98
+ try {
99
+ url = new URL(iframe)
100
+ } catch {
101
+ return iframe
102
+ }
103
+ if (isDonateFrame(type)) withDonateQuery(url, Astro.url.searchParams)
104
+ url.searchParams.set('layout', layout)
105
+ for (const [key, value] of Object.entries(moduleLook(brand, band, appearance, theme, Astro.locals.template?.frameColors ?? null))) url.searchParams.set(key, value)
106
+ url.searchParams.set('radius', String(radius))
107
+ url.searchParams.set('font', font)
108
+ if (skin) url.searchParams.set('skin', skin)
109
+ for (const [key, value] of Object.entries(params)) if (Object.hasOwn(FRAME_PARAMS, key) && FRAME_PARAMS[key]!.includes(value)) url.searchParams.set(key, value)
110
+ return url.toString()
111
+ }
112
+
113
+ const embed = sent ? { ...sent, iframe: framed(sent.iframe) } : null
114
+ /** The frame's name as words: a heading's starred word (`*helps*`, a template's marked word) without its stars. */
115
+ const name = title.replace(/\*([^*\n]+)\*/g, '$1')
116
+ const hasHead = Astro.slots.has('default')
117
+
118
+ /** What a visitor reads where a module with nothing to frame would be. */
119
+ const UNAVAILABLE: Record<string, string> = {
120
+ Donate: 'Online donations are not available right now.',
121
+ FormBlock: 'This form is not available right now.',
122
+ PollBlock: 'This poll is not available right now.',
123
+ SignupCapture: 'Signing up is not available right now.',
124
+ Petition: 'This petition is not available right now.',
125
+ Store: 'The store is not available right now.',
126
+ Event: 'This event is not available right now.',
127
+ Calendar: 'The calendar is not available right now.',
128
+ Advocacy: 'Contacting your legislators is not available right now.',
129
+ }
130
+ const unavailable = UNAVAILABLE[type] ?? 'This is not available right now.'
131
+ ---
132
+ {embed ? (
133
+ <div class:list={['module', card && 'module-card', className]} data-module={type} style={`--bg-embed-height:${height}`}>
134
+ {hasHead && <div class="module-head"><slot /></div>}
135
+ <Embed embed={embed} title={name} />
136
+ </div>
137
+ ) : (
138
+ <div class:list={['module', 'module-unavailable', card && 'module-card', className]} data-module={type} data-module-unavailable>
139
+ {hasHead && <div class="module-head"><slot /></div>}
140
+ <p class="module-unavailable-line">{unavailable}</p>
141
+ </div>
142
+ )}
143
+
144
+ <style>
145
+ .module {
146
+ min-width: 0;
147
+ }
148
+ .module-card {
149
+ padding: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
150
+ border: 1px solid var(--band-panel-line);
151
+ border-radius: var(--radius-card);
152
+ background: var(--band-panel);
153
+ color: var(--band-panel-ink);
154
+ box-shadow: var(--shadow);
155
+ }
156
+ .module-head :global(h3) {
157
+ margin: 0 0 0.875rem;
158
+ font-size: var(--h3);
159
+ font-weight: 600;
160
+ }
161
+ .module-unavailable-line {
162
+ margin: 0;
163
+ padding: 1rem 1.125rem;
164
+ border: 1px dashed var(--line-strong);
165
+ border-radius: var(--radius-card);
166
+ color: var(--muted);
167
+ font-size: var(--text-sm);
168
+ }
169
+ .module-card .module-unavailable-line {
170
+ padding: 0;
171
+ border: 0;
172
+ }
173
+ .module :global(.bg-embed) {
174
+ display: block;
175
+ width: 100%;
176
+ background: transparent;
177
+ color-scheme: light dark;
178
+ }
179
+ </style>
@@ -0,0 +1,90 @@
1
+ ---
2
+ // The volunteer pages' live counts: a shift's "6 of 10 filled · 4 spots
3
+ // left" and its state are never only the cached page's. Each volunteer
4
+ // layout places this once; it writes the script the first time on a page,
5
+ // when the site has a live route to ask (src/lib/live.ts, the shifts' feed:
6
+ // first-party the same-origin path with no key, with a site key the api's
7
+ // address and the publishable key). After the document is parsed the script
8
+ // reads `GET /shifts/live?ids=` for every `data-bg-shift` slot on the page
9
+ // (50 at a time) and, for each shift the answer names: writes its counts
10
+ // into its slots as words (lib/shifts.ts countWords' words), redraws its
11
+ // dots (`data-bg-shift-dots`, one per spot up to 24, `data-taken` on each
12
+ // one taken), and moves its buttons (`data-bg-shift-action`) to its state's
13
+ // words, quiet when there is nothing to sign up for. A shift the answer
14
+ // leaves out, or a failed read, keeps what the page was built with, as it
15
+ // does with scripts off.
16
+ import { liveSource } from '../../lib/live'
17
+ import { MOST_DOTS, SHIFT_ACTION_LABELS, firstShiftScript } from '../../lib/shifts'
18
+
19
+ const bg = Astro.locals.backgold
20
+ const source = firstShiftScript(Astro.request) ? await liveSource(bg.setup === null && bg.firstParty, 'shifts') : null
21
+ ---
22
+ {source && (
23
+ <script is:inline data-bg-shifts-api={source.url} data-bg-shifts-key={source.key ?? undefined} data-bg-shifts-labels={SHIFT_ACTION_LABELS} data-bg-shifts-most={String(MOST_DOTS)}>
24
+ (function (script) {
25
+ var api = script.getAttribute('data-bg-shifts-api')
26
+ var key = script.getAttribute('data-bg-shifts-key')
27
+ var labels = JSON.parse(script.getAttribute('data-bg-shifts-labels') || '{}')
28
+ var most = Number(script.getAttribute('data-bg-shifts-most'))
29
+ var words = function (going, capacity) {
30
+ if (capacity > 0) {
31
+ var left = capacity - going
32
+ return going + ' of ' + capacity + ' filled · ' + (left > 0 ? left + (left === 1 ? ' spot left' : ' spots left') : 'Full')
33
+ }
34
+ return going > 0 ? going + ' signed up' : ''
35
+ }
36
+ var each = function (selector, id, fn) {
37
+ var found = document.querySelectorAll(selector)
38
+ for (var i = 0; i < found.length; i++) if (found[i].getAttribute(selector.slice(1, -1)) === id) fn(found[i])
39
+ }
40
+ var fill = function () {
41
+ var slots = document.querySelectorAll('[data-bg-shift]')
42
+ var ids = []
43
+ for (var i = 0; i < slots.length; i++) {
44
+ var id = slots[i].getAttribute('data-bg-shift')
45
+ if (id && ids.indexOf(id) < 0) ids.push(id)
46
+ }
47
+ for (var start = 0; start < ids.length; start += 50) {
48
+ var headers = { Accept: 'application/json' }
49
+ if (key) headers.Authorization = 'Bearer ' + key
50
+ fetch(api + '?ids=' + ids.slice(start, start + 50).map(encodeURIComponent).join(','), { headers: headers })
51
+ .then(function (res) {
52
+ return res.ok ? res.json() : null
53
+ })
54
+ .then(function (body) {
55
+ var live = body && Array.isArray(body.shifts) ? body.shifts : []
56
+ for (var l = 0; l < live.length; l++) {
57
+ var one = live[l]
58
+ if (!one || typeof one.id !== 'string' || typeof one.signed_up !== 'number' || !isFinite(one.signed_up)) continue
59
+ var going = Math.max(0, one.signed_up)
60
+ each('[data-bg-shift]', one.id, function (slot) {
61
+ var capacity = Number(slot.getAttribute('data-capacity'))
62
+ slot.setAttribute('data-going', String(going))
63
+ slot.textContent = words(going, capacity)
64
+ each('[data-bg-shift-dots]', one.id, function (dots) {
65
+ dots.textContent = ''
66
+ if (!(capacity > 0) || capacity > most) return
67
+ for (var d = 0; d < capacity; d++) {
68
+ var dot = document.createElement('i')
69
+ if (d < going) dot.setAttribute('data-taken', '')
70
+ dots.appendChild(dot)
71
+ }
72
+ })
73
+ })
74
+ if (!labels[one.state]) continue
75
+ each('[data-bg-shift-action]', one.id, function (button) {
76
+ var label = button.querySelector('[data-bg-shift-label]')
77
+ if (label) label.textContent = labels[one.state]
78
+ button.classList.toggle('button-quiet', one.state === 'full' || one.state === 'closed')
79
+ button.setAttribute('data-state', one.state)
80
+ })
81
+ }
82
+ })
83
+ .catch(function () {})
84
+ }
85
+ }
86
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fill)
87
+ else fill()
88
+ })(document.currentScript)
89
+ </script>
90
+ )}
@@ -0,0 +1,247 @@
1
+ ---
2
+ // `/volunteer/<slug>`, one shift's own page (the kit's 'volunteer:detail'),
3
+ // laid out like an event's (components/EventPage.astro). At the left: a
4
+ // breadcrumb back to Volunteer and the shift's month, the title as the
5
+ // page's one <h1>, its facts (the day, and the time span in the
6
+ // organization's zone named as a reader knows it, "6:00 PM to 8:00 PM
7
+ // Central Time"; the place with a maps link; "Part of" the public event it
8
+ // belongs to, linking to the event's page; the spots as dots beside the
9
+ // counts in words, read again after load by ShiftLive), and the organizer's
10
+ // notes as plain paragraphs. At the right (under it on a phone), BackGold's
11
+ // sign-up card for the shift on a raised card (ModuleFrame, layout `card`,
12
+ // so the site's look, the template's `frameRadius`, `frameColors` and frame
13
+ // skin apply), whose fields, consent and every write stay BackGold's. When
14
+ // the api sends no frame for the shift (an api older than the frame), the
15
+ // card holds the counts and one button to the shift's sign-up page on
16
+ // BackGold (its `signup_url`) instead, by the shift's state: never a blank.
17
+ import ModuleFrame from '../sections/modules/ModuleFrame.astro'
18
+ import ShiftLive from './ShiftLive.astro'
19
+ import type { VolunteerDetailProps } from './props'
20
+ import { VOLUNTEER_PATH, mapLinkOf, shiftView, signupEmbedOf } from '../../lib/shifts'
21
+ import { formatWhen, zoneName } from '../../lib/format'
22
+ import { safeHref } from '@backgold/astro/server'
23
+
24
+ type Props = VolunteerDetailProps
25
+
26
+ const { shift, partOf } = Astro.props
27
+ const view = shiftView(shift)
28
+ const zone = zoneName(shift.timezone)
29
+
30
+ /** formatWhen's "Saturday, November 1, 2026 at 6:00 PM" as its day and its time ("6:00 PM CDT" without a zone name). */
31
+ function split(value: string | null): { day: string; time: string | null } | null {
32
+ const full = formatWhen(value, shift.timezone, zone === null)
33
+ if (!full) return null
34
+ const at = full.lastIndexOf(' at ')
35
+ return at < 0 ? { day: full, time: null } : { day: full.slice(0, at), time: full.slice(at + 4) }
36
+ }
37
+ const start = split(shift.starts_at)
38
+ const end = split(shift.ends_at)
39
+ // "6:00 PM to 8:00 PM Central Time" on one day; the end's own day when it ends on another.
40
+ const span = start?.time && end?.time ? (end.day === start.day ? `${start.time} to ${end.time}` : `${start.time} to ${end.day}, ${end.time}`) : (start?.time ?? null)
41
+ const time = span && zone ? `${span} ${zone}` : span
42
+ const map = mapLinkOf(view.place)
43
+ const notes = (shift.notes ?? '').split(/\n{2,}/).map((p) => p.trim()).filter(Boolean)
44
+ const embed = signupEmbedOf(shift)
45
+ const signup = embed ? null : safeHref(shift.signup_url)
46
+ /** The fallback card's button, by the shift's state. */
47
+ const FALLBACK: Record<typeof view.state, string> = {
48
+ open: 'Sign up for this shift',
49
+ waitlist: 'Join the waitlist',
50
+ full: 'See the shift',
51
+ closed: 'See the shift',
52
+ }
53
+ ---
54
+ <div class="shift-page">
55
+ <nav class="crumbs" aria-label="Breadcrumb">
56
+ <a href={VOLUNTEER_PATH}>Volunteer</a>
57
+ {view.when && <><span aria-hidden="true"> › </span><span>{view.when.month}</span></>}
58
+ </nav>
59
+ <div class="shift-grid">
60
+ <div class="shift-words">
61
+ <p class="shift-chips">
62
+ <span class="chip chip-accent">Volunteer shift</span>
63
+ {(view.state === 'full' || view.state === 'waitlist') && <span class="chip chip-wash">Full</span>}
64
+ {view.state === 'closed' && <span class="chip chip-wash">Closed</span>}
65
+ </p>
66
+ <h1>{shift.title}</h1>
67
+ <ul class="shift-facts" role="list">
68
+ {start && (
69
+ <li>
70
+ <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2" /><path d="M3 10h18M8 3v4M16 3v4" /></svg>
71
+ <div>
72
+ <time datetime={shift.starts_at}><b>{start.day}</b></time>
73
+ {time && <span>{time}</span>}
74
+ </div>
75
+ </li>
76
+ )}
77
+ {view.place && (
78
+ <li>
79
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z" /><circle cx="12" cy="9.5" r="2.5" /></svg>
80
+ <div>
81
+ <b>{view.place}</b>
82
+ {map && <span><a href={map} rel="noopener">Open in maps</a></span>}
83
+ </div>
84
+ </li>
85
+ )}
86
+ {partOf && (
87
+ <li>
88
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h10" /></svg>
89
+ <div><span>Part of <a href={partOf.href}>{partOf.label}</a></span></div>
90
+ </li>
91
+ )}
92
+ <li class="shift-live-row">
93
+ <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="3.5" /><path d="M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 7M18 14a6 6 0 0 1 3.5 6" /></svg>
94
+ <div>
95
+ {view.dots.length > 0 && (
96
+ <span class="sh-dots" aria-hidden="true" data-bg-shift-dots={view.id}>
97
+ {view.dots.map((taken) => <i data-taken={taken ? '' : undefined}></i>)}
98
+ </span>
99
+ )}
100
+ <b class="shift-live" data-bg-shift={view.id} data-going={view.signedUp} data-capacity={view.capacity ?? undefined}>{view.words}</b>
101
+ </div>
102
+ </li>
103
+ </ul>
104
+ {notes.length > 0 && (
105
+ <div class="shift-notes">
106
+ <h2>What to know</h2>
107
+ <div class="prose">{notes.map((p) => <p>{p}</p>)}</div>
108
+ </div>
109
+ )}
110
+ </div>
111
+ {embed ? (
112
+ <ModuleFrame embed={embed} band="plain" type="Shift" layout="card" card title={`Sign up: ${shift.title}`} height="34rem" class="shift-signup" />
113
+ ) : (
114
+ <div class="module module-card shift-signup shift-signup-link" data-module="Shift">
115
+ <h2>Sign up</h2>
116
+ {view.words && <p class="shift-signup-count">{view.words}</p>}
117
+ {signup && (
118
+ <a class:list={['button', view.action.quiet && 'button-quiet']} href={signup} rel={/^https?:/i.test(signup) ? 'noopener' : undefined} data-bg-shift-action={view.id} data-state={view.state}>
119
+ <span data-bg-shift-label>{FALLBACK[view.state]}</span><span class="visually-hidden">: {shift.title}</span>
120
+ </a>
121
+ )}
122
+ </div>
123
+ )}
124
+ </div>
125
+ <ShiftLive />
126
+ </div>
127
+
128
+ <style>
129
+ .shift-page {
130
+ max-width: var(--content);
131
+ margin: 0 auto;
132
+ padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem) var(--gutter) var(--space);
133
+ }
134
+ .shift-page .crumbs {
135
+ margin-bottom: 1.125rem;
136
+ }
137
+ .shift-grid {
138
+ display: grid;
139
+ gap: 1.75rem;
140
+ align-items: start;
141
+ }
142
+ .shift-chips {
143
+ display: flex;
144
+ flex-wrap: wrap;
145
+ gap: 0.5rem;
146
+ margin: 0;
147
+ }
148
+ .shift-words h1 {
149
+ margin: 0.875rem 0 1rem;
150
+ font-size: clamp(2.25rem, 1.6rem + 2.2vw, 3.25rem);
151
+ line-height: 1.04;
152
+ font-weight: 800;
153
+ }
154
+ .shift-facts {
155
+ display: grid;
156
+ gap: 0.875rem;
157
+ margin: 1.375rem 0 0;
158
+ padding: 0;
159
+ list-style: none;
160
+ }
161
+ .shift-facts li {
162
+ display: grid;
163
+ grid-template-columns: 1.75rem 1fr;
164
+ gap: 0.625rem;
165
+ }
166
+ .shift-facts svg {
167
+ width: 1.25rem;
168
+ height: 1.25rem;
169
+ fill: none;
170
+ stroke: var(--accent);
171
+ stroke-width: 1.9;
172
+ stroke-linecap: round;
173
+ stroke-linejoin: round;
174
+ }
175
+ .shift-facts b {
176
+ display: block;
177
+ }
178
+ .shift-facts span {
179
+ color: var(--muted);
180
+ font-size: var(--text-sm);
181
+ }
182
+ .shift-facts a {
183
+ color: var(--link);
184
+ font-weight: 700;
185
+ text-decoration: underline;
186
+ text-underline-offset: 3px;
187
+ }
188
+ .shift-live-row div {
189
+ display: flex;
190
+ flex-wrap: wrap;
191
+ align-items: center;
192
+ gap: 0.375rem 0.75rem;
193
+ }
194
+ /* No counts to say (no capacity, no one yet): no row. */
195
+ .shift-live-row:has(.shift-live:empty) {
196
+ display: none;
197
+ }
198
+ .sh-dots {
199
+ display: inline-flex;
200
+ flex-wrap: wrap;
201
+ gap: 0.25rem;
202
+ max-width: 14rem;
203
+ }
204
+ .sh-dots :global(i) {
205
+ width: 0.75rem;
206
+ height: 0.75rem;
207
+ border: 1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent);
208
+ border-radius: 50%;
209
+ }
210
+ .sh-dots :global(i[data-taken]) {
211
+ border: 1.5px solid var(--button);
212
+ background: var(--button);
213
+ }
214
+ .shift-notes {
215
+ margin-top: 2rem;
216
+ }
217
+ .shift-notes h2 {
218
+ margin: 0 0 0.5rem;
219
+ font-size: var(--h3);
220
+ }
221
+ /* The card the frame would sit on (ModuleFrame's module-card), holding the link instead. */
222
+ .shift-signup-link {
223
+ display: grid;
224
+ gap: 0.875rem;
225
+ justify-items: start;
226
+ padding: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
227
+ border: 1px solid var(--band-panel-line);
228
+ border-radius: var(--radius-card);
229
+ background: var(--band-panel);
230
+ color: var(--band-panel-ink);
231
+ box-shadow: var(--shadow);
232
+ }
233
+ .shift-signup-link h2 {
234
+ margin: 0;
235
+ font-size: var(--h3);
236
+ }
237
+ .shift-signup-count {
238
+ margin: 0;
239
+ font-weight: 700;
240
+ }
241
+ @media (min-width: 56rem) {
242
+ .shift-grid {
243
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
244
+ gap: 3rem;
245
+ }
246
+ }
247
+ </style>