@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,105 @@
1
+ ---
2
+ // The agenda's rows (board A6), as the Agenda layout draws them and the
3
+ // Calendar draws its month on a phone: the events grouped by month under the
4
+ // month's name and its count, each a row with the day, the type, the time,
5
+ // the place and an empty live-counts slot (LiveCounts fills it). A month
6
+ // between two listed months that has no event is drawn as an invitation
7
+ // ("December is open.") with the section's empty-events line, never as a
8
+ // blank. The rows are EventRows, the ones every events list shares;
9
+ // `buttons` puts the event's button on each row, otherwise the title is the
10
+ // link; `zoneless` leaves the zone's name off the times. With no events it
11
+ // draws nothing.
12
+ import EventRows from './EventRows.astro'
13
+ import { monthName, type EventRow } from './events'
14
+
15
+ interface Props {
16
+ events: EventRow[]
17
+ buttons: boolean
18
+ /** The section's empty-events line, for an empty month's invitation. */
19
+ invitation: string | null
20
+ zoneless?: boolean
21
+ }
22
+
23
+ const { events, buttons, invitation, zoneless = false } = Astro.props
24
+
25
+ interface Month {
26
+ label: string
27
+ /** The month's own name for its invitation, null for the undated group. */
28
+ name: string | null
29
+ events: EventRow[]
30
+ }
31
+
32
+ // Rows arrive soonest first. A month is year * 12 + month; every month from
33
+ // the first listed to the last gets a group, so an empty one in between shows.
34
+ // An event with no readable date goes last, under "Date to come".
35
+ const dated = events.filter((e) => e.when)
36
+ const undated = events.filter((e) => !e.when)
37
+ const keyOf = (e: EventRow) => e.when!.year * 12 + e.when!.monthIndex
38
+ const keys = dated.map(keyOf)
39
+ const first = keys.length > 0 ? Math.min(...keys) : 0
40
+ const last = keys.length > 0 ? Math.max(...keys) : -1
41
+ const years = new Set(dated.map((e) => e.when!.year))
42
+ const months: Month[] = []
43
+ for (let key = first; key <= last; key++) {
44
+ const name = monthName(key % 12)
45
+ months.push({ label: years.size > 1 ? `${name} ${Math.floor(key / 12)}` : name, name, events: dated.filter((e) => keyOf(e) === key) })
46
+ }
47
+ if (undated.length > 0) months.push({ label: 'Date to come', name: null, events: undated })
48
+ const count = (n: number) => (n === 1 ? '1 event' : `${n} events`)
49
+ ---
50
+ {months.length > 0 && (
51
+ <div class="agenda">
52
+ {months.map((month) => (
53
+ <div class="agenda-month">
54
+ <h3 class="agenda-heading">
55
+ {month.label} <span class="agenda-count">{month.events.length > 0 ? count(month.events.length) : 'nothing yet'}</span>
56
+ </h3>
57
+ {month.events.length > 0 ? (
58
+ <EventRows events={month.events} buttons={buttons} level={4} zoneless={zoneless} />
59
+ ) : (
60
+ <p class="agenda-open">
61
+ <strong>{month.name} is open.</strong>
62
+ {invitation && <span> {invitation}</span>}
63
+ </p>
64
+ )}
65
+ </div>
66
+ ))}
67
+ </div>
68
+ )}
69
+
70
+ <style>
71
+ .agenda {
72
+ margin-top: 1.5rem;
73
+ }
74
+ .agenda-month + .agenda-month {
75
+ margin-top: 2.25rem;
76
+ }
77
+ .agenda-heading {
78
+ display: flex;
79
+ flex-wrap: wrap;
80
+ align-items: baseline;
81
+ gap: 0.25rem 0.75rem;
82
+ margin: 0 0 0.875rem;
83
+ font-size: calc(var(--h3) * 1.15);
84
+ font-weight: 800;
85
+ }
86
+ .agenda-count {
87
+ color: var(--muted);
88
+ font-family: var(--font);
89
+ font-size: var(--text-sm);
90
+ font-weight: 600;
91
+ letter-spacing: 0;
92
+ }
93
+ .agenda-open {
94
+ margin: 0;
95
+ padding: 1.125rem 1.25rem;
96
+ border: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent);
97
+ border-radius: var(--radius);
98
+ color: var(--muted);
99
+ }
100
+ .agenda-open strong {
101
+ color: var(--ink);
102
+ font-family: var(--font-display);
103
+ font-size: var(--text-lg);
104
+ }
105
+ </style>
@@ -0,0 +1,23 @@
1
+ ---
2
+ // The line under the events page's list (boards A6 and C5): "Times are
3
+ // Mountain Time." when the rows share one zone (their times then leave its
4
+ // name off), then "Add every event to your calendar", every upcoming event as
5
+ // one calendar file on this site (/events.ics, src/routes/catch-all.astro).
6
+ import { EVENTS_CALENDAR_PATH } from '../../../lib/events'
7
+
8
+ interface Props {
9
+ /** The rows' one zone as a name ("Mountain Time"), or null when they share none. */
10
+ zone: string | null
11
+ }
12
+
13
+ const { zone } = Astro.props
14
+ ---
15
+ <p class="fine events-calendar-line">
16
+ {zone && <>Times are {zone}. </>}<a class="text-link" href={EVENTS_CALENDAR_PATH}>Add every event to your calendar</a>
17
+ </p>
18
+
19
+ <style>
20
+ .events-calendar-line {
21
+ margin: 1rem 0 0;
22
+ }
23
+ </style>
@@ -0,0 +1,196 @@
1
+ ---
2
+ // The rows every events list shares (boards A6, C1 and C5): each event a
3
+ // card on the band's card colour with its day as a numeral over its weekday
4
+ // at the left, then its type as a chip, its title, and its time and place on
5
+ // one line with its live counts ("142 going", "12 seats left", filled in by
6
+ // LiveCounts after the page loads; empty without scripts) and whether it
7
+ // still takes registrations. The whole card opens the event's page on this
8
+ // site, /events/<slug>: the title is its one link, stretched over the card,
9
+ // so a keyboard and a screen reader meet each event once, by its title. With
10
+ // `buttons` the event's button sits at the right in the quieter solid style
11
+ // ("Get tickets" when it sells tickets, "RSVP" otherwise, "Details" once
12
+ // registration has closed), above the card's link and clickable on its own;
13
+ // on a phone it takes the card's full width (board C9). `zoneless` drops the
14
+ // zone's name from each time, for rows under a line that names it (the
15
+ // layout's "Times are Mountain Time."). The layout that places the rows
16
+ // places LiveCounts once. `level` is the titles' heading level: 3 under a
17
+ // section's heading, 4 under the agenda's month headings.
18
+ import type { EventRow } from './events'
19
+
20
+ interface Props {
21
+ events: EventRow[]
22
+ buttons: boolean
23
+ level: 3 | 4
24
+ zoneless?: boolean
25
+ }
26
+
27
+ const { events, buttons, level, zoneless = false } = Astro.props
28
+ const Title = level === 4 ? 'h4' : 'h3'
29
+ ---
30
+ <ul class="event-rows" role="list">
31
+ {events.map((event) => (
32
+ <li class="event-row">
33
+ {event.when && event.startsAt ? (
34
+ <time class="event-day" datetime={event.startsAt}>
35
+ <b aria-hidden="true">{event.when.day}</b>
36
+ {event.when.weekday && <small aria-hidden="true">{event.when.weekday}</small>}
37
+ <span class="visually-hidden">{event.when.full}</span>
38
+ </time>
39
+ ) : (
40
+ <span class="event-day" aria-hidden="true"><b>–</b></span>
41
+ )}
42
+ <div class="event-body">
43
+ {event.type && <p class="event-chip"><span class="chip chip-wash">{event.type}</span></p>}
44
+ <Title class="event-title">{event.link ? <a class="event-link" href={event.link.href} rel={event.link.rel}>{event.title}</a> : event.title}</Title>
45
+ {(event.when?.time || event.place || event.closed || event.id) && (
46
+ <p class="event-meta">
47
+ {[zoneless ? event.when?.clock : event.when?.time, event.place].filter(Boolean).map((part) => <span>{part}</span>)}
48
+ {event.id && <span class="event-live" data-bg-live={event.id}></span>}
49
+ {event.closed && <span class="event-closed">Registration closed</span>}
50
+ </p>
51
+ )}
52
+ </div>
53
+ {event.action && buttons && (
54
+ <p class="event-action">
55
+ <a class="button button-2 button-small" href={event.action.href} rel={event.action.rel}>
56
+ {event.action.label}<span class="visually-hidden">: {event.title}</span>
57
+ </a>
58
+ </p>
59
+ )}
60
+ </li>
61
+ ))}
62
+ </ul>
63
+
64
+ <style>
65
+ .event-rows {
66
+ display: grid;
67
+ gap: 0.75rem;
68
+ margin: 0;
69
+ padding: 0;
70
+ list-style: none;
71
+ }
72
+ .event-row {
73
+ position: relative;
74
+ display: grid;
75
+ grid-template-columns: 4rem minmax(0, 1fr);
76
+ gap: 0.875rem;
77
+ align-items: center;
78
+ padding: 0.875rem 1rem;
79
+ border: 1px solid var(--line);
80
+ border-radius: var(--radius-card);
81
+ background: var(--surface);
82
+ box-shadow: var(--shadow);
83
+ }
84
+ .event-day {
85
+ display: block;
86
+ padding-right: 0.75rem;
87
+ border-right: 1px solid var(--line);
88
+ text-align: center;
89
+ }
90
+ .event-day b {
91
+ display: block;
92
+ font-family: var(--font-display);
93
+ font-size: clamp(1.75rem, 1.4rem + 1vw, 2.375rem);
94
+ font-weight: 800;
95
+ line-height: 1;
96
+ }
97
+ .event-day small {
98
+ display: block;
99
+ margin-top: 0.25rem;
100
+ color: var(--accent);
101
+ font-size: var(--text-xs);
102
+ font-weight: 700;
103
+ letter-spacing: 0.16em;
104
+ text-transform: uppercase;
105
+ }
106
+ .event-body > * {
107
+ margin: 0;
108
+ }
109
+ .event-body .event-chip {
110
+ margin-bottom: 0.375rem;
111
+ }
112
+ .event-body .event-title {
113
+ font-family: var(--font-display);
114
+ font-size: 1.3125rem;
115
+ font-weight: 600;
116
+ line-height: 1.25;
117
+ letter-spacing: -0.01em;
118
+ }
119
+ .event-title a {
120
+ color: var(--ink);
121
+ text-decoration: none;
122
+ }
123
+ /* The title's link covers the card (the kit's .card-title pattern); the button sits above it. */
124
+ .event-link::after {
125
+ content: '';
126
+ position: absolute;
127
+ inset: 0;
128
+ border-radius: inherit;
129
+ }
130
+ .event-row:hover .event-link {
131
+ text-decoration: underline;
132
+ }
133
+ @supports selector(:has(*)) {
134
+ .event-link:focus-visible {
135
+ outline: none;
136
+ }
137
+ .event-row:has(.event-link:focus-visible) {
138
+ outline: 3px solid var(--ink);
139
+ outline-offset: 3px;
140
+ }
141
+ }
142
+ .event-body .event-meta {
143
+ display: flex;
144
+ flex-wrap: wrap;
145
+ gap: 0.125rem 0.75rem;
146
+ margin-top: 0.25rem;
147
+ color: var(--muted);
148
+ font-size: var(--text-sm);
149
+ }
150
+ .event-live {
151
+ color: var(--ink);
152
+ font-weight: 700;
153
+ }
154
+ .event-live:empty {
155
+ display: none;
156
+ }
157
+ .event-closed {
158
+ font-weight: 700;
159
+ }
160
+ .event-action {
161
+ position: relative;
162
+ z-index: 1;
163
+ grid-column: 1 / -1;
164
+ margin: 0;
165
+ }
166
+ .event-action .button {
167
+ display: flex;
168
+ width: 100%;
169
+ }
170
+ @media (min-width: 40rem) {
171
+ .event-row {
172
+ grid-template-columns: 5.25rem minmax(0, 1fr) auto;
173
+ gap: 1.375rem;
174
+ padding: 1rem 1.25rem;
175
+ }
176
+ .event-action {
177
+ grid-column: auto;
178
+ }
179
+ .event-action .button {
180
+ display: inline-flex;
181
+ width: auto;
182
+ }
183
+ }
184
+ @media (prefers-reduced-motion: no-preference) {
185
+ .event-row {
186
+ transition:
187
+ transform 0.15s ease,
188
+ box-shadow 0.15s ease;
189
+ }
190
+ /* The boards' motion note: a card lifts 2px with a deeper shadow on hover. */
191
+ .event-row:hover {
192
+ transform: translateY(-2px);
193
+ box-shadow: var(--shadow), 0 14px 28px -18px color-mix(in srgb, var(--shadow-ink) 45%, transparent);
194
+ }
195
+ }
196
+ </style>
@@ -0,0 +1,75 @@
1
+ ---
2
+ // The live counts' one script (board A6 note 3, A7 note 4): an event's
3
+ // "142 going" and "12 seats left" are never part of the cached page. Each
4
+ // layout that draws events places this once; it writes the script the first
5
+ // time on a page, when the site has a live route to ask (src/lib/live.ts):
6
+ // first-party, the same-origin path with no key; with a site key, the api's
7
+ // address and the publishable key, which the script sends as its
8
+ // Authorization header (it sends none when the script carries no key).
9
+ // After the document is parsed, the script gathers every `data-bg-live` slot
10
+ // on the page, asks `GET /events/live?ids=` for their ids (50 at a time) and
11
+ // writes each event's counts into its slots as text: "N going" when anyone
12
+ // is going, "N seats left" ("Full" at none) when the event has a capacity,
13
+ // joined by " · ".
14
+ // Each slot it fills also carries the numbers, for a layout that draws them
15
+ // (the nonprofit template's spot dots): `data-going`, and `data-capacity`
16
+ // (going plus seats left) when the event has a capacity. An event the
17
+ // answer leaves out, or a failed read, leaves its slots empty and
18
+ // unnumbered, as they are with scripts off.
19
+ import { firstLiveScript, liveSource } from '../../../lib/live'
20
+
21
+ const source = firstLiveScript(Astro.request) ? await liveSource(Astro.locals.backgold.firstParty) : null
22
+ ---
23
+ {source && (
24
+ <script is:inline data-bg-live-api={source.url} data-bg-live-key={source.key ?? undefined}>
25
+ (function (script) {
26
+ var api = script.getAttribute('data-bg-live-api')
27
+ var key = script.getAttribute('data-bg-live-key')
28
+ var count = function (n, one, many) {
29
+ return n.toLocaleString('en-US') + ' ' + (n === 1 ? one : many)
30
+ }
31
+ var words = function (event) {
32
+ var parts = []
33
+ if (typeof event.going === 'number' && isFinite(event.going) && event.going > 0) parts.push(count(event.going, 'going', 'going'))
34
+ if (typeof event.seats_left === 'number' && isFinite(event.seats_left) && event.seats_left >= 0) parts.push(event.seats_left === 0 ? 'Full' : count(event.seats_left, 'seat left', 'seats left'))
35
+ return parts.join(' · ')
36
+ }
37
+ var fill = function () {
38
+ var slots = document.querySelectorAll('[data-bg-live]')
39
+ var ids = []
40
+ for (var i = 0; i < slots.length; i++) {
41
+ var id = slots[i].getAttribute('data-bg-live')
42
+ if (id && ids.indexOf(id) < 0) ids.push(id)
43
+ }
44
+ for (var start = 0; start < ids.length; start += 50) {
45
+ var batch = ids.slice(start, start + 50).map(encodeURIComponent).join(',')
46
+ var headers = { Accept: 'application/json' }
47
+ if (key) headers.Authorization = 'Bearer ' + key
48
+ fetch(api + '?ids=' + batch, { headers: headers })
49
+ .then(function (res) {
50
+ return res.ok ? res.json() : null
51
+ })
52
+ .then(function (body) {
53
+ var events = body && Array.isArray(body.events) ? body.events : []
54
+ for (var e = 0; e < events.length; e++) {
55
+ var event = events[e]
56
+ if (!event || typeof event.id !== 'string') continue
57
+ var text = words(event)
58
+ var going = typeof event.going === 'number' && isFinite(event.going) && event.going >= 0 ? event.going : null
59
+ var left = typeof event.seats_left === 'number' && isFinite(event.seats_left) && event.seats_left >= 0 ? event.seats_left : null
60
+ for (var s = 0; s < slots.length; s++) {
61
+ if (slots[s].getAttribute('data-bg-live') !== event.id) continue
62
+ slots[s].textContent = text
63
+ if (going !== null) slots[s].setAttribute('data-going', String(going))
64
+ if (going !== null && left !== null) slots[s].setAttribute('data-capacity', String(going + left))
65
+ }
66
+ }
67
+ })
68
+ .catch(function () {})
69
+ }
70
+ }
71
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fill)
72
+ else fill()
73
+ })(document.currentScript)
74
+ </script>
75
+ )}
@@ -0,0 +1,53 @@
1
+ ---
2
+ // The events page's type tabs (board A6), as the Agenda and the Calendar
3
+ // draw them, when two or more event types have an upcoming event (lib/events.ts
4
+ // tabsFor): All, then each such type, each an
5
+ // address (/events, /events/<type>) so they work with scripts off; the one
6
+ // being shown is marked current. `query` (the calendar's `?month=`) follows
7
+ // every tab, so a tab keeps the month in view.
8
+ import { EVENTS_PATH, eventTypePath, type EventType } from '../../../lib/events'
9
+
10
+ interface Props {
11
+ tabs: { tabs: EventType[]; active: string | null }
12
+ query?: string
13
+ }
14
+
15
+ const { tabs, query = '' } = Astro.props
16
+ ---
17
+ <nav class="agenda-tabs" aria-label="Event types">
18
+ <ul role="list">
19
+ <li><a href={`${EVENTS_PATH}${query}`} aria-current={tabs.active === null ? 'page' : undefined}>All</a></li>
20
+ {tabs.tabs.map((t) => (
21
+ <li><a href={`${eventTypePath(t.key)}${query}`} aria-current={tabs.active === t.key ? 'page' : undefined}>{t.label}</a></li>
22
+ ))}
23
+ </ul>
24
+ </nav>
25
+
26
+ <style>
27
+ .agenda-tabs ul {
28
+ display: flex;
29
+ flex-wrap: wrap;
30
+ gap: 0.5rem;
31
+ margin: 1.25rem 0 0;
32
+ padding: 0;
33
+ list-style: none;
34
+ }
35
+ .agenda-tabs a {
36
+ display: inline-block;
37
+ padding: 0.4375rem 0.875rem;
38
+ border: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent);
39
+ border-radius: var(--pill);
40
+ color: var(--ink);
41
+ font-size: var(--text-sm);
42
+ font-weight: 600;
43
+ text-decoration: none;
44
+ }
45
+ .agenda-tabs a:hover {
46
+ border-color: var(--ink);
47
+ }
48
+ .agenda-tabs a[aria-current='page'] {
49
+ border-color: var(--button);
50
+ background: var(--button);
51
+ color: var(--button-ink);
52
+ }
53
+ </style>
@@ -0,0 +1,55 @@
1
+ ---
2
+ // EventsList · Agenda (board A6, "Upcoming events · Agenda"; A12 shows it
3
+ // beside List and Cards): the events grouped by month under the month's name
4
+ // and its count, each a row with the day, the type, the time, the place and
5
+ // its live counts ("142 going", "12 seats left", filled in by LiveCounts
6
+ // after the page loads; empty without scripts). A month between two listed
7
+ // months that has no event is drawn as an invitation ("December is open.")
8
+ // with the section's empty-events line, never as a blank (AgendaMonths).
9
+ //
10
+ // On the events page (/events) the type tabs come first (TypeTabs): All,
11
+ // then each event type with an upcoming event, from the Content API's GET
12
+ // /events. They are addresses, /events/<type>, so they work with scripts off;
13
+ // there the rows are that type's upcoming events (src/routes/catch-all.astro
14
+ // reads them) and its tab is marked current. Anywhere else, when fewer than
15
+ // two types have an upcoming event, or when the types cannot be read, no tabs
16
+ // are drawn.
17
+ //
18
+ // Each event opens its own page on this site: `options.actions` 'buttons' adds
19
+ // a button to the row ("Get tickets" when the event sells tickets, "RSVP"
20
+ // otherwise, "Details" once registration has closed), 'link' (or none) makes
21
+ // the title the link; either way the whole row opens it. Under the months, a
22
+ // line names the rows' one zone ("Times are Mountain Time.", their times then
23
+ // leaving it off) and offers every event as one calendar file
24
+ // (CalendarLine). With no events it draws nothing.
25
+ import type { ComponentProps } from 'astro/types'
26
+ import type Default from './index.astro'
27
+ import Band from '../Band.astro'
28
+ import AgendaMonths from './AgendaMonths.astro'
29
+ import LiveCounts from './LiveCounts.astro'
30
+ import TypeTabs from './TypeTabs.astro'
31
+ import CalendarLine from './CalendarLine.astro'
32
+ import { actionsOf, eventsOf, sharedZone } from './events'
33
+ import { text } from '../../../lib/format'
34
+ import { tabsFor } from '../../../lib/events'
35
+
36
+ type Props = ComponentProps<typeof Default>
37
+
38
+ const { section } = Astro.props
39
+ const heading = text(section.copy.heading)
40
+ const invitation = text(section.copy.eventsEmptyCta)
41
+ const buttons = actionsOf(section) === 'buttons'
42
+ const events = eventsOf(section)
43
+ const bg = Astro.locals.backgold
44
+ const zone = sharedZone(events)
45
+ const tabs = events.length > 0 && bg.setup === null ? await tabsFor(bg.client, Astro.request, section, Astro.url.pathname) : null
46
+ ---
47
+ {events.length > 0 && (
48
+ <Band section={section} class="events events-agenda">
49
+ {heading && <h2>{heading}</h2>}
50
+ {tabs && <TypeTabs tabs={tabs} />}
51
+ <AgendaMonths events={events} buttons={buttons} invitation={invitation} zoneless={zone !== null} />
52
+ <CalendarLine zone={zone} />
53
+ <LiveCounts />
54
+ </Band>
55
+ )}