@backgold/template-kit 0.0.0-stage → 0.1.1

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 (349) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/chunk-RJAVFRC6.js +67 -0
  4. package/dist/constants-BAIo_Q5U.d-lQbj1e1-.d.ts +48 -0
  5. package/dist/content-api-Cox1-wz5.d.ts +1096 -0
  6. package/dist/contract/content-api-examples.d.ts +72 -0
  7. package/dist/contract/content-api-examples.js +926 -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 +253 -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 +61 -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 +80 -0
  57. package/src/components/sections/About/index.astro +60 -0
  58. package/src/components/sections/About/left.astro +57 -0
  59. package/src/components/sections/About/letter.astro +111 -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 +126 -0
  102. package/src/components/sections/ContentPost/player.astro +254 -0
  103. package/src/components/sections/ContentPost/prose.astro +80 -0
  104. package/src/components/sections/ContentPost/theater.astro +329 -0
  105. package/src/components/sections/Countdown/index.astro +53 -0
  106. package/src/components/sections/Course/Bar.astro +46 -0
  107. package/src/components/sections/Course/CourseHead.astro +123 -0
  108. package/src/components/sections/Course/Crumbs.astro +44 -0
  109. package/src/components/sections/Course/Icon.astro +29 -0
  110. package/src/components/sections/Course/Ring.astro +62 -0
  111. package/src/components/sections/Course/Syllabus.astro +146 -0
  112. package/src/components/sections/Course/course.ts +146 -0
  113. package/src/components/sections/Course/index.astro +143 -0
  114. package/src/components/sections/Course/outline.astro +39 -0
  115. package/src/components/sections/Cta/banner.astro +64 -0
  116. package/src/components/sections/Cta/card.astro +88 -0
  117. package/src/components/sections/Cta/index.astro +31 -0
  118. package/src/components/sections/Cta/photo.astro +114 -0
  119. package/src/components/sections/Cta/strip.astro +91 -0
  120. package/src/components/sections/Donate/index.astro +136 -0
  121. package/src/components/sections/Donate/story.astro +7 -0
  122. package/src/components/sections/Event/card.astro +14 -0
  123. package/src/components/sections/Event/index.astro +14 -0
  124. package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
  125. package/src/components/sections/EventsList/CalendarLine.astro +23 -0
  126. package/src/components/sections/EventsList/EventRows.astro +196 -0
  127. package/src/components/sections/EventsList/LiveCounts.astro +75 -0
  128. package/src/components/sections/EventsList/TypeTabs.astro +53 -0
  129. package/src/components/sections/EventsList/agenda.astro +55 -0
  130. package/src/components/sections/EventsList/calendar.astro +392 -0
  131. package/src/components/sections/EventsList/cards.astro +186 -0
  132. package/src/components/sections/EventsList/cohorts.astro +205 -0
  133. package/src/components/sections/EventsList/compact.astro +163 -0
  134. package/src/components/sections/EventsList/events.ts +168 -0
  135. package/src/components/sections/EventsList/index.astro +46 -0
  136. package/src/components/sections/EventsList/map.astro +436 -0
  137. package/src/components/sections/EventsList/shifts.astro +355 -0
  138. package/src/components/sections/EventsList/week.astro +361 -0
  139. package/src/components/sections/Faq/Contact.astro +63 -0
  140. package/src/components/sections/Faq/Questions.astro +98 -0
  141. package/src/components/sections/Faq/cards.astro +74 -0
  142. package/src/components/sections/Faq/faq.ts +101 -0
  143. package/src/components/sections/Faq/index.astro +49 -0
  144. package/src/components/sections/Faq/topics.astro +178 -0
  145. package/src/components/sections/Financials/Foot.astro +38 -0
  146. package/src/components/sections/Financials/Head.astro +47 -0
  147. package/src/components/sections/Financials/donut.astro +197 -0
  148. package/src/components/sections/Financials/financials.ts +52 -0
  149. package/src/components/sections/Financials/index.astro +148 -0
  150. package/src/components/sections/Financials/table.astro +157 -0
  151. package/src/components/sections/FormBlock/index.astro +33 -0
  152. package/src/components/sections/FormBlock/wide.astro +7 -0
  153. package/src/components/sections/Hero/cover.astro +176 -0
  154. package/src/components/sections/Hero/donate.astro +209 -0
  155. package/src/components/sections/Hero/field.astro +390 -0
  156. package/src/components/sections/Hero/index.astro +52 -0
  157. package/src/components/sections/Hero/overlap.astro +151 -0
  158. package/src/components/sections/Hero/rotating.astro +30 -0
  159. package/src/components/sections/Hero/split.astro +99 -0
  160. package/src/components/sections/Hero/statement.astro +55 -0
  161. package/src/components/sections/Hero/video.astro +399 -0
  162. package/src/components/sections/Issues/checklist.astro +204 -0
  163. package/src/components/sections/Issues/drawer.astro +237 -0
  164. package/src/components/sections/Issues/index.astro +115 -0
  165. package/src/components/sections/Issues/issues.ts +37 -0
  166. package/src/components/sections/Issues/numbered.astro +79 -0
  167. package/src/components/sections/Issues/rows.astro +137 -0
  168. package/src/components/sections/Issues/steps.astro +81 -0
  169. package/src/components/sections/Issues/tabs.astro +322 -0
  170. package/src/components/sections/Leaderboard/index.astro +29 -0
  171. package/src/components/sections/Lesson/Door.astro +121 -0
  172. package/src/components/sections/Lesson/LessonBody.astro +416 -0
  173. package/src/components/sections/Lesson/Rail.astro +182 -0
  174. package/src/components/sections/Lesson/Tracker.astro +137 -0
  175. package/src/components/sections/Lesson/index.astro +27 -0
  176. package/src/components/sections/Lesson/lesson.ts +233 -0
  177. package/src/components/sections/Lesson/reading.astro +21 -0
  178. package/src/components/sections/Map/CoverageLine.astro +19 -0
  179. package/src/components/sections/Map/RegionMap.astro +109 -0
  180. package/src/components/sections/Map/bar.astro +160 -0
  181. package/src/components/sections/Map/index.astro +192 -0
  182. package/src/components/sections/Map/map.astro +275 -0
  183. package/src/components/sections/MediaKit/BioCard.astro +108 -0
  184. package/src/components/sections/MediaKit/Downloads.astro +88 -0
  185. package/src/components/sections/MediaKit/index.astro +183 -0
  186. package/src/components/sections/MediaKit/kit.ts +140 -0
  187. package/src/components/sections/MediaKit/press.astro +189 -0
  188. package/src/components/sections/MediaKit/speaker.astro +205 -0
  189. package/src/components/sections/Membership/Benefits.astro +42 -0
  190. package/src/components/sections/Membership/Check.astro +12 -0
  191. package/src/components/sections/Membership/Price.astro +61 -0
  192. package/src/components/sections/Membership/compare.astro +312 -0
  193. package/src/components/sections/Membership/index.astro +281 -0
  194. package/src/components/sections/Membership/offers.ts +169 -0
  195. package/src/components/sections/Membership/tiers.astro +217 -0
  196. package/src/components/sections/MovementMap/index.astro +50 -0
  197. package/src/components/sections/MovementTicker/index.astro +43 -0
  198. package/src/components/sections/Pathways/Doors.astro +147 -0
  199. package/src/components/sections/Pathways/Head.astro +37 -0
  200. package/src/components/sections/Pathways/index.astro +27 -0
  201. package/src/components/sections/Pathways/pathways.ts +100 -0
  202. package/src/components/sections/Pathways/quiz.astro +286 -0
  203. package/src/components/sections/Pathways/tabs.astro +271 -0
  204. package/src/components/sections/PdfEmbed/card.astro +99 -0
  205. package/src/components/sections/PdfEmbed/index.astro +26 -0
  206. package/src/components/sections/PdfEmbed/medium.astro +7 -0
  207. package/src/components/sections/PdfEmbed/tall.astro +7 -0
  208. package/src/components/sections/Petition/coverage.astro +14 -0
  209. package/src/components/sections/Petition/image.astro +14 -0
  210. package/src/components/sections/Petition/index.astro +14 -0
  211. package/src/components/sections/Petition/map.astro +14 -0
  212. package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
  213. package/src/components/sections/PlatformPlanks/columns.astro +171 -0
  214. package/src/components/sections/PlatformPlanks/index.astro +56 -0
  215. package/src/components/sections/PlatformPlanks/longread.astro +250 -0
  216. package/src/components/sections/PollBlock/index.astro +30 -0
  217. package/src/components/sections/Portfolio/featured.astro +343 -0
  218. package/src/components/sections/Portfolio/index.astro +571 -0
  219. package/src/components/sections/Portfolio/strip.astro +173 -0
  220. package/src/components/sections/Portfolio/work.ts +100 -0
  221. package/src/components/sections/Progress/MatchClock.astro +166 -0
  222. package/src/components/sections/Progress/compact.astro +150 -0
  223. package/src/components/sections/Progress/index.astro +32 -0
  224. package/src/components/sections/Progress/match.astro +126 -0
  225. package/src/components/sections/Progress/ring.astro +179 -0
  226. package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
  227. package/src/components/sections/QuickDonate/Picker.astro +95 -0
  228. package/src/components/sections/QuickDonate/band.astro +164 -0
  229. package/src/components/sections/QuickDonate/bar.astro +208 -0
  230. package/src/components/sections/QuickDonate/donate.ts +126 -0
  231. package/src/components/sections/QuickDonate/hero.astro +143 -0
  232. package/src/components/sections/QuickDonate/index.astro +73 -0
  233. package/src/components/sections/QuickDonate/jar.astro +225 -0
  234. package/src/components/sections/QuickDonate/ladder.astro +248 -0
  235. package/src/components/sections/QuoteStrip/carousel.astro +340 -0
  236. package/src/components/sections/QuoteStrip/index.astro +58 -0
  237. package/src/components/sections/QuoteStrip/logos.astro +226 -0
  238. package/src/components/sections/QuoteStrip/quotes.ts +61 -0
  239. package/src/components/sections/QuoteStrip/single.astro +92 -0
  240. package/src/components/sections/QuoteStrip/ticker.astro +319 -0
  241. package/src/components/sections/QuoteStrip/wall.astro +113 -0
  242. package/src/components/sections/Resources/band.astro +93 -0
  243. package/src/components/sections/Resources/featured.astro +239 -0
  244. package/src/components/sections/Resources/index.astro +225 -0
  245. package/src/components/sections/Resources/resources.ts +92 -0
  246. package/src/components/sections/SampleBallot/Position.astro +39 -0
  247. package/src/components/sections/SampleBallot/ballot.ts +92 -0
  248. package/src/components/sections/SampleBallot/cards.astro +299 -0
  249. package/src/components/sections/SampleBallot/index.astro +326 -0
  250. package/src/components/sections/SampleBallot/measures.astro +172 -0
  251. package/src/components/sections/Scorecard/grades.astro +141 -0
  252. package/src/components/sections/Scorecard/index.astro +294 -0
  253. package/src/components/sections/Scorecard/promise.astro +167 -0
  254. package/src/components/sections/Scorecard/votes.ts +83 -0
  255. package/src/components/sections/SectionHead.astro +31 -0
  256. package/src/components/sections/Services/Button.astro +24 -0
  257. package/src/components/sections/Services/Check.astro +12 -0
  258. package/src/components/sections/Services/Includes.astro +42 -0
  259. package/src/components/sections/Services/compare.astro +328 -0
  260. package/src/components/sections/Services/index.astro +187 -0
  261. package/src/components/sections/Services/list.astro +181 -0
  262. package/src/components/sections/Services/services.ts +80 -0
  263. package/src/components/sections/ShareKit/Actions.astro +71 -0
  264. package/src/components/sections/ShareKit/Buttons.astro +62 -0
  265. package/src/components/sections/ShareKit/compact.astro +123 -0
  266. package/src/components/sections/ShareKit/index.astro +160 -0
  267. package/src/components/sections/ShareKit/share.ts +60 -0
  268. package/src/components/sections/ShareKit/strip.astro +173 -0
  269. package/src/components/sections/SignupCapture/band.astro +7 -0
  270. package/src/components/sections/SignupCapture/index.astro +103 -0
  271. package/src/components/sections/SignupCapture/inline.astro +7 -0
  272. package/src/components/sections/SocialFeed/index.astro +34 -0
  273. package/src/components/sections/StatCards/feature.astro +143 -0
  274. package/src/components/sections/StatCards/index.astro +51 -0
  275. package/src/components/sections/StatCards/ribbon.astro +113 -0
  276. package/src/components/sections/StatCards/wall.astro +177 -0
  277. package/src/components/sections/Store/featured.astro +14 -0
  278. package/src/components/sections/Store/index.astro +14 -0
  279. package/src/components/sections/Stories/Status.astro +42 -0
  280. package/src/components/sections/Stories/StoryCards.astro +171 -0
  281. package/src/components/sections/Stories/cards.astro +42 -0
  282. package/src/components/sections/Stories/index.astro +238 -0
  283. package/src/components/sections/Stories/stories.ts +97 -0
  284. package/src/components/sections/Stories/timeline.astro +135 -0
  285. package/src/components/sections/TeamGrid/board.astro +280 -0
  286. package/src/components/sections/TeamGrid/index.astro +71 -0
  287. package/src/components/sections/TeamGrid/list.astro +306 -0
  288. package/src/components/sections/TeamGrid/people.ts +178 -0
  289. package/src/components/sections/VideoEmbed/index.astro +52 -0
  290. package/src/components/sections/VideoEmbed/landscape.astro +7 -0
  291. package/src/components/sections/VideoEmbed/portrait.astro +7 -0
  292. package/src/components/sections/VideoEmbed/square.astro +7 -0
  293. package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
  294. package/src/components/sections/VoterTools/Lookup.astro +43 -0
  295. package/src/components/sections/VoterTools/dates.astro +153 -0
  296. package/src/components/sections/VoterTools/index.astro +231 -0
  297. package/src/components/sections/VoterTools/polling.astro +144 -0
  298. package/src/components/sections/VoterTools/voter-tools.ts +71 -0
  299. package/src/components/sections/index.ts +373 -0
  300. package/src/components/sections/modules/Headed.astro +39 -0
  301. package/src/components/sections/modules/ModuleFrame.astro +181 -0
  302. package/src/components/store/CollectionPage.astro +40 -0
  303. package/src/components/store/ProductCard.astro +32 -0
  304. package/src/components/store/ProductGrid.astro +16 -0
  305. package/src/components/store/ProductPage.astro +146 -0
  306. package/src/components/store/StorePage.astro +137 -0
  307. package/src/components/store/StoreScript.astro +572 -0
  308. package/src/components/volunteer/ShiftLive.astro +90 -0
  309. package/src/components/volunteer/detail.astro +247 -0
  310. package/src/components/volunteer/list.astro +298 -0
  311. package/src/components/volunteer/props.ts +21 -0
  312. package/src/env.d.ts +22 -0
  313. package/src/index.d.ts +10 -0
  314. package/src/index.js +63 -0
  315. package/src/layouts/Site.astro +387 -0
  316. package/src/lib/academy.ts +146 -0
  317. package/src/lib/brand.ts +534 -0
  318. package/src/lib/chrome.ts +121 -0
  319. package/src/lib/donate-frame.ts +104 -0
  320. package/src/lib/entries.ts +190 -0
  321. package/src/lib/env.ts +34 -0
  322. package/src/lib/event-map-draw.ts +91 -0
  323. package/src/lib/events.ts +476 -0
  324. package/src/lib/fonts.ts +116 -0
  325. package/src/lib/footer.ts +24 -0
  326. package/src/lib/format.ts +160 -0
  327. package/src/lib/geo.ts +131 -0
  328. package/src/lib/live.ts +55 -0
  329. package/src/lib/menu.ts +48 -0
  330. package/src/lib/petition-text.ts +29 -0
  331. package/src/lib/reading.ts +17 -0
  332. package/src/lib/regions.ts +215 -0
  333. package/src/lib/section.ts +105 -0
  334. package/src/lib/shifts.ts +187 -0
  335. package/src/lib/store.ts +521 -0
  336. package/src/lib/stream-time.ts +20 -0
  337. package/src/lib/stream.ts +141 -0
  338. package/src/lib/visitor.ts +54 -0
  339. package/src/routes/catch-all.astro +435 -0
  340. package/src/routes/form.astro +30 -0
  341. package/src/routes/live.astro +49 -0
  342. package/src/routes/not-found.astro +18 -0
  343. package/src/routes/preview.astro +60 -0
  344. package/src/routes/setup.astro +62 -0
  345. package/src/routes/volunteer-shift.astro +61 -0
  346. package/src/styles/entries.css +784 -0
  347. package/src/styles/site.css +1910 -0
  348. package/src/styles/store.css +634 -0
  349. package/src/template.ts +182 -0
@@ -0,0 +1,392 @@
1
+ ---
2
+ // EventsList · Calendar (ruling 32: beside the Agenda, never in its place; the
3
+ // events page's default): one month at a time. On a desktop (48rem and wider)
4
+ // a month grid, Sunday to Saturday, each event a chip in its day — its type
5
+ // and time over its title, both in the event's own time zone, and an empty
6
+ // live-counts slot (LiveCounts fills it) — linking to the event's page on this
7
+ // site (/events/<slug>). Today is ringed and marked aria-current="date"; days
8
+ // before it are muted, their events still there; the days of the months
9
+ // either side are faint and empty. On a phone the same month's events are
10
+ // the Agenda's rows (AgendaMonths), with the event's button when
11
+ // `options.actions` is 'buttons'.
12
+ //
13
+ // The month is `?month=YYYY-MM`, else the month it is today in the events'
14
+ // time zone. The arrows are addresses (`?month=` on this page's own path), so
15
+ // they work with scripts off; they reach a year back and two years ahead, and
16
+ // "This month" returns to the bare address. The rows are the month's own,
17
+ // past days included, from the Content API's `GET /events?from=&to=`
18
+ // (src/lib/events.ts monthEvents); if that cannot be read the section's own
19
+ // rows that fall in the month are drawn. A month with no event says so with
20
+ // the section's empty-events line.
21
+ //
22
+ // On the events page the type tabs come first, as the Agenda draws them
23
+ // (TypeTabs), each keeping the month in view; on /events/<type> the month is
24
+ // that type's events. src/routes/catch-all.astro never lets the edge store a
25
+ // page with a calendar on it: the month in view and today move with the
26
+ // clock and `?month=`, neither of which is in the edge cache's key.
27
+ import type { ComponentProps } from 'astro/types'
28
+ import type Default from './index.astro'
29
+ import Band from '../Band.astro'
30
+ import AgendaMonths from './AgendaMonths.astro'
31
+ import LiveCounts from './LiveCounts.astro'
32
+ import TypeTabs from './TypeTabs.astro'
33
+ import { actionsOf, eventsOf, monthName, type EventRow } from './events'
34
+ import { text } from '../../../lib/format'
35
+ import { rows as rowsOf } from '../../../lib/section'
36
+ import {
37
+ MONTH_PARAM,
38
+ monthEvents,
39
+ monthInReach,
40
+ monthOf,
41
+ monthParam,
42
+ shiftMonth,
43
+ tabsFor,
44
+ todayIn,
45
+ type CalendarMonth,
46
+ } from '../../../lib/events'
47
+
48
+ type Props = ComponentProps<typeof Default>
49
+
50
+ const { section } = Astro.props
51
+ const heading = text(section.copy.heading)
52
+ const invitation = text(section.copy.eventsEmptyCta)
53
+ const buttons = actionsOf(section) === 'buttons'
54
+ const bg = Astro.locals.backgold
55
+ const pathname = Astro.url.pathname
56
+
57
+ // Today, in the time zone of the section's own events (UTC without one).
58
+ const baked = rowsOf(section)
59
+ const zone = baked.map((row) => text(row.timezone)).find((z): z is string => !!z) ?? null
60
+ const today = todayIn(zone)
61
+ const current: CalendarMonth = { year: today.year, monthIndex: today.monthIndex }
62
+ const month = monthOf(Astro.url.searchParams.get(MONTH_PARAM), current) ?? current
63
+ const isCurrent = month.year === current.year && month.monthIndex === current.monthIndex
64
+
65
+ const tabs = bg.setup === null ? await tabsFor(bg.client, Astro.request, section, pathname) : null
66
+ let read: Record<string, unknown>[] | null = null
67
+ if (bg.setup === null) {
68
+ try {
69
+ read = await monthEvents(bg.client, Astro.request, month, tabs?.active ?? null)
70
+ } catch {
71
+ read = null
72
+ }
73
+ }
74
+ // Every row of the month, whatever the section's `max`.
75
+ const { max: _max, ...options } = section.options ?? {}
76
+ const all = eventsOf({ ...section, options, data: { source: section.data?.source ?? 'events', items: read ?? baked } })
77
+ const events = all.filter((e) => e.when && e.when.year === month.year && e.when.monthIndex === month.monthIndex)
78
+
79
+ const byDay = new Map<number, EventRow[]>()
80
+ for (const e of events) {
81
+ const day = Number(e.when!.day)
82
+ byDay.set(day, [...(byDay.get(day) ?? []), e])
83
+ }
84
+
85
+ // The grid: the weeks that hold the month, Sunday first, with the days of
86
+ // the months either side filling the first and last week.
87
+ const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
88
+ const firstWeekday = new Date(Date.UTC(month.year, month.monthIndex, 1)).getUTCDay()
89
+ const length = new Date(Date.UTC(month.year, month.monthIndex + 1, 0)).getUTCDate()
90
+ const previousLength = new Date(Date.UTC(month.year, month.monthIndex, 0)).getUTCDate()
91
+ interface Cell {
92
+ day: number
93
+ /** In the month shown; the others are the months either side. */
94
+ inMonth: boolean
95
+ }
96
+ const cells: Cell[] = []
97
+ for (let i = firstWeekday - 1; i >= 0; i--) cells.push({ day: previousLength - i, inMonth: false })
98
+ for (let d = 1; d <= length; d++) cells.push({ day: d, inMonth: true })
99
+ for (let d = 1; cells.length % 7 !== 0; d++) cells.push({ day: d, inMonth: false })
100
+ const weeks = Array.from({ length: cells.length / 7 }, (_, w) => cells.slice(w * 7, w * 7 + 7))
101
+
102
+ const monthOrder = month.year * 12 + month.monthIndex
103
+ const currentOrder = current.year * 12 + current.monthIndex
104
+ const isPast = (day: number) => monthOrder < currentOrder || (monthOrder === currentOrder && day < today.day)
105
+ const isToday = (day: number) => isCurrent && day === today.day
106
+ const label = (m: CalendarMonth) => `${monthName(m.monthIndex)} ${m.year}`
107
+ const title = label(month)
108
+ const dayLabel = (day: number, n: number) =>
109
+ `${WEEKDAYS[new Date(Date.UTC(month.year, month.monthIndex, day)).getUTCDay()]}, ${monthName(month.monthIndex)} ${day}${isToday(day) ? ', today' : ''}, ${n === 0 ? 'no events' : n === 1 ? '1 event' : `${n} events`}`
110
+
111
+ // The arrows and the tabs: `?month=` on this page's own path.
112
+ const href = (m: CalendarMonth) => `${pathname}?${MONTH_PARAM}=${monthParam(m)}`
113
+ const previous = shiftMonth(month, -1)
114
+ const next = shiftMonth(month, 1)
115
+ const query = isCurrent ? '' : `?${MONTH_PARAM}=${monthParam(month)}`
116
+ const count = (n: number) => (n === 1 ? '1 event' : `${n} events`)
117
+ ---
118
+ <Band section={section} class="events events-calendar">
119
+ {heading && <h2>{heading}</h2>}
120
+ {tabs && <TypeTabs tabs={tabs} query={query} />}
121
+ <div class="cal">
122
+ <div class="cal-bar">
123
+ <h3 class="cal-label" id={`${section.id}-month`}>
124
+ {title} <span class="cal-count">{events.length > 0 ? count(events.length) : 'nothing yet'}</span>
125
+ </h3>
126
+ <nav class="cal-nav" aria-label="Months">
127
+ {monthInReach(previous, current) && (
128
+ <a class="cal-arrow" href={href(previous)} rel="nofollow"><span aria-hidden="true">‹</span> {monthName(previous.monthIndex)}</a>
129
+ )}
130
+ {!isCurrent && <a class="cal-arrow cal-now" href={pathname}>This month</a>}
131
+ {monthInReach(next, current) && (
132
+ <a class="cal-arrow" href={href(next)} rel="nofollow">{monthName(next.monthIndex)} <span aria-hidden="true">›</span></a>
133
+ )}
134
+ </nav>
135
+ </div>
136
+
137
+ <div class="cal-grid-wrap">
138
+ <table class="cal-grid" aria-labelledby={`${section.id}-month`}>
139
+ <thead>
140
+ <tr>{WEEKDAYS.map((d) => <th scope="col" abbr={d}>{d.slice(0, 3)}</th>)}</tr>
141
+ </thead>
142
+ <tbody>
143
+ {weeks.map((week) => (
144
+ <tr>
145
+ {week.map((cell) =>
146
+ cell.inMonth ? (
147
+ <td
148
+ class:list={['cal-day', isPast(cell.day) && 'cal-past', isToday(cell.day) && 'cal-today']}
149
+ aria-current={isToday(cell.day) ? 'date' : undefined}
150
+ >
151
+ <span class="cal-dn" aria-hidden="true">{cell.day}</span>
152
+ <span class="visually-hidden">{dayLabel(cell.day, byDay.get(cell.day)?.length ?? 0)}</span>
153
+ {(byDay.get(cell.day) ?? []).length > 0 && (
154
+ <ul class="cal-chips" role="list">
155
+ {(byDay.get(cell.day) ?? []).map((event) => (
156
+ <li>
157
+ {event.link ? (
158
+ <a class="cal-chip" href={event.link.href} rel={event.link.rel}>
159
+ {(event.type || event.when?.time) && (
160
+ <span class="cal-kind">{[event.type, event.when?.time].filter(Boolean).join(' · ')}</span>
161
+ )}
162
+ <span class="cal-title">{event.title}</span>
163
+ {event.id && <span class="cal-live" data-bg-live={event.id}></span>}
164
+ </a>
165
+ ) : (
166
+ <span class="cal-chip">
167
+ {(event.type || event.when?.time) && (
168
+ <span class="cal-kind">{[event.type, event.when?.time].filter(Boolean).join(' · ')}</span>
169
+ )}
170
+ <span class="cal-title">{event.title}</span>
171
+ </span>
172
+ )}
173
+ </li>
174
+ ))}
175
+ </ul>
176
+ )}
177
+ </td>
178
+ ) : (
179
+ <td class="cal-out" aria-hidden="true"><span class="cal-dn">{cell.day}</span></td>
180
+ ),
181
+ )}
182
+ </tr>
183
+ ))}
184
+ </tbody>
185
+ </table>
186
+ </div>
187
+
188
+ <div class="cal-phone">
189
+ <AgendaMonths events={events} buttons={buttons} invitation={invitation} />
190
+ </div>
191
+
192
+ {events.length === 0 && (
193
+ <p class="cal-empty">
194
+ <strong>Nothing on the calendar in {monthName(month.monthIndex)}.</strong>
195
+ {invitation && <span> {invitation}</span>}
196
+ </p>
197
+ )}
198
+ </div>
199
+ <LiveCounts />
200
+ </Band>
201
+
202
+ <style>
203
+ .cal {
204
+ margin-top: 1.5rem;
205
+ }
206
+ .cal-bar {
207
+ display: flex;
208
+ flex-wrap: wrap;
209
+ align-items: baseline;
210
+ justify-content: space-between;
211
+ gap: 0.75rem 1.25rem;
212
+ margin-bottom: 1rem;
213
+ }
214
+ .cal-label {
215
+ display: flex;
216
+ flex-wrap: wrap;
217
+ align-items: baseline;
218
+ gap: 0.25rem 0.75rem;
219
+ margin: 0;
220
+ font-size: calc(var(--h3) * 1.15);
221
+ font-weight: 800;
222
+ }
223
+ .cal-count {
224
+ color: var(--muted);
225
+ font-family: var(--font);
226
+ font-size: var(--text-sm);
227
+ font-weight: 600;
228
+ letter-spacing: 0;
229
+ }
230
+ .cal-nav {
231
+ display: flex;
232
+ flex-wrap: wrap;
233
+ gap: 0.5rem;
234
+ }
235
+ .cal-arrow {
236
+ display: inline-block;
237
+ padding: 0.4375rem 0.875rem;
238
+ border: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent);
239
+ border-radius: var(--pill);
240
+ color: var(--ink);
241
+ font-size: var(--text-sm);
242
+ font-weight: 600;
243
+ text-decoration: none;
244
+ }
245
+ .cal-arrow:hover {
246
+ border-color: var(--ink);
247
+ }
248
+ /* A phone draws the month as the agenda's rows; the grid is the desktop's. */
249
+ .cal-grid-wrap {
250
+ display: none;
251
+ }
252
+ .cal-phone :global(.agenda) {
253
+ margin-top: 0;
254
+ }
255
+ .cal-phone :global(.agenda-heading) {
256
+ display: none;
257
+ }
258
+ .cal-grid {
259
+ width: 100%;
260
+ border-collapse: collapse;
261
+ table-layout: fixed;
262
+ }
263
+ .cal-grid th {
264
+ padding: 0.5625rem 0.625rem 0.5rem;
265
+ border-bottom: 1px solid var(--line);
266
+ color: var(--muted);
267
+ font-size: var(--text-xs);
268
+ font-weight: 700;
269
+ letter-spacing: 0.08em;
270
+ text-align: left;
271
+ text-transform: uppercase;
272
+ }
273
+ .cal-grid td {
274
+ height: 6.625rem;
275
+ padding: 0.375rem 0.375rem 0.4375rem;
276
+ border-right: 1px solid var(--line);
277
+ border-bottom: 1px solid var(--line);
278
+ vertical-align: top;
279
+ }
280
+ .cal-grid td:last-child {
281
+ border-right: 0;
282
+ }
283
+ .cal-grid tr:last-child td {
284
+ border-bottom: 0;
285
+ }
286
+ .cal-dn {
287
+ display: inline-block;
288
+ min-width: 1.5rem;
289
+ height: 1.5rem;
290
+ padding: 0 0.375rem;
291
+ border-radius: var(--pill);
292
+ font-family: var(--font-display);
293
+ font-size: var(--text-sm);
294
+ font-weight: 800;
295
+ line-height: 1.5rem;
296
+ text-align: center;
297
+ }
298
+ .cal-chips {
299
+ display: grid;
300
+ /* One column no wider than the day: a long title is cut with an ellipsis, never spilt into the next day. */
301
+ grid-template-columns: minmax(0, 1fr);
302
+ gap: 0.1875rem;
303
+ margin: 0.25rem 0 0;
304
+ padding: 0;
305
+ list-style: none;
306
+ }
307
+ .cal-chip {
308
+ display: block;
309
+ min-width: 0;
310
+ padding: 0.1875rem 0.375rem 0.25rem;
311
+ border-radius: min(var(--radius), 6px);
312
+ background: color-mix(in srgb, var(--link) 12%, transparent);
313
+ color: var(--ink);
314
+ line-height: 1.25;
315
+ text-decoration: none;
316
+ }
317
+ a.cal-chip:hover {
318
+ box-shadow: inset 0 0 0 1px var(--link);
319
+ }
320
+ .cal-kind,
321
+ .cal-title,
322
+ .cal-live {
323
+ display: block;
324
+ overflow: hidden;
325
+ text-overflow: ellipsis;
326
+ white-space: nowrap;
327
+ }
328
+ .cal-kind {
329
+ color: var(--link);
330
+ font-size: 0.625rem;
331
+ font-weight: 700;
332
+ letter-spacing: 0.05em;
333
+ text-transform: uppercase;
334
+ }
335
+ .cal-title {
336
+ font-size: var(--text-xs);
337
+ font-weight: 600;
338
+ }
339
+ .cal-live {
340
+ color: var(--muted);
341
+ font-size: 0.625rem;
342
+ font-weight: 700;
343
+ }
344
+ .cal-live:empty {
345
+ display: none;
346
+ }
347
+ .cal-past {
348
+ background: color-mix(in srgb, var(--ink) 4%, transparent);
349
+ }
350
+ .cal-past .cal-dn {
351
+ color: var(--muted);
352
+ }
353
+ .cal-past .cal-chip {
354
+ opacity: 0.62;
355
+ }
356
+ .cal-out {
357
+ background: color-mix(in srgb, var(--ink) 4%, transparent);
358
+ }
359
+ .cal-out .cal-dn {
360
+ color: var(--muted);
361
+ font-weight: 600;
362
+ opacity: 0.55;
363
+ }
364
+ .cal-today .cal-dn {
365
+ box-shadow: inset 0 0 0 2px var(--button);
366
+ color: var(--ink);
367
+ }
368
+ .cal-empty {
369
+ margin: 1rem 0 0;
370
+ padding: 1.125rem 1.25rem;
371
+ border: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent);
372
+ border-radius: var(--radius);
373
+ color: var(--muted);
374
+ }
375
+ .cal-empty strong {
376
+ color: var(--ink);
377
+ font-family: var(--font-display);
378
+ font-size: var(--text-lg);
379
+ }
380
+ @media (min-width: 48rem) {
381
+ .cal-grid-wrap {
382
+ display: block;
383
+ overflow: hidden;
384
+ border: 1px solid var(--line);
385
+ border-radius: var(--radius-card);
386
+ background: var(--surface);
387
+ }
388
+ .cal-phone {
389
+ display: none;
390
+ }
391
+ }
392
+ </style>
@@ -0,0 +1,186 @@
1
+ ---
2
+ // EventsList · Cards (board A1, "Upcoming events · Cards"; A12 shows it beside
3
+ // List and Agenda): the section head (the kicker, the heading and the "All
4
+ // events" link), then a raised card per event with its date line in the
5
+ // accent ("TUE · OCT 14"), its type as a chip, the time and the place with
6
+ // a quiet "Add to calendar" link to the event's calendar file beside them, its
7
+ // live counts ("142 going", "12 seats left", filled in by LiveCounts after
8
+ // the page loads; empty without scripts), and whether it still takes
9
+ // registrations. Each card opens the event's own page on this site, which
10
+ // frames BackGold's RSVP and tickets: `options.actions` 'buttons' puts a button on the
11
+ // card in the quieter solid style ("Get tickets" when the event sells
12
+ // tickets, "RSVP" otherwise, "Details" once registration has closed), 'link'
13
+ // (or none) makes the whole card the link. With no events it draws nothing.
14
+ import type { ComponentProps } from 'astro/types'
15
+ import type Default from './index.astro'
16
+ import Band from '../Band.astro'
17
+ import LiveCounts from './LiveCounts.astro'
18
+ import SectionHead from '../SectionHead.astro'
19
+ import { actionsOf, eventsOf } from './events'
20
+ import { links } from '../../../lib/section'
21
+ import { text } from '../../../lib/format'
22
+
23
+ type Props = ComponentProps<typeof Default>
24
+
25
+ const { section } = Astro.props
26
+ const buttons = actionsOf(section) === 'buttons'
27
+ const events = eventsOf(section)
28
+ ---
29
+ {events.length > 0 && (
30
+ <Band section={section} class="events events-cards">
31
+ <SectionHead kicker={text(section.copy.kicker)} heading={text(section.copy.heading)} more={links(section)} />
32
+ <ul class="ev-cards" role="list">
33
+ {events.map((event) => (
34
+ <li class:list={['ev-card', { 'ev-card-linked': event.link && !buttons }]}>
35
+ {(event.when || event.type) && (
36
+ <p class="ev-top">
37
+ {event.when && event.startsAt && (
38
+ <time class="ev-date" datetime={event.startsAt}>
39
+ <span aria-hidden="true">{[event.when.weekday, `${event.when.monthShort} ${event.when.day}`].filter(Boolean).join(' · ')}</span>
40
+ <span class="visually-hidden">{event.when.full}</span>
41
+ </time>
42
+ )}
43
+ {event.type && <span class="chip chip-wash">{event.type}</span>}
44
+ </p>
45
+ )}
46
+ <h3 class="ev-title">{event.link && !buttons ? <a href={event.link.href} rel={event.link.rel}>{event.title}</a> : event.title}</h3>
47
+ {(event.when?.time || event.place || event.calendar) && (
48
+ <p class="ev-meta">
49
+ {[event.when?.time, event.place].filter(Boolean).join(' · ')}
50
+ {event.calendar && (
51
+ <>
52
+ {(event.when?.time || event.place) && ' · '}
53
+ <a class="ev-calendar" href={event.calendar.href} rel={event.calendar.rel}>{event.calendar.label}<span class="visually-hidden">: {event.title}</span></a>
54
+ </>
55
+ )}
56
+ </p>
57
+ )}
58
+ {event.id && <p class="ev-live" data-bg-live={event.id}></p>}
59
+ {event.closed && <p class="ev-closed">Registration closed</p>}
60
+ {event.action && buttons && (
61
+ <p class="ev-action">
62
+ <a class="button" href={event.action.href} rel={event.action.rel}>
63
+ {event.action.label}<span class="visually-hidden">: {event.title}</span>
64
+ </a>
65
+ </p>
66
+ )}
67
+ </li>
68
+ ))}
69
+ </ul>
70
+ <LiveCounts />
71
+ </Band>
72
+ )}
73
+
74
+ <style>
75
+ .ev-cards {
76
+ display: grid;
77
+ gap: 1.25rem;
78
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
79
+ margin: 0;
80
+ padding: 0;
81
+ list-style: none;
82
+ }
83
+ .ev-card {
84
+ position: relative;
85
+ display: flex;
86
+ flex-direction: column;
87
+ gap: 0.625rem;
88
+ min-width: 0;
89
+ padding: 1.375rem;
90
+ border: 1px solid var(--line);
91
+ border-radius: var(--radius-card);
92
+ background: var(--surface);
93
+ box-shadow: var(--shadow);
94
+ }
95
+ .ev-card > * {
96
+ margin: 0;
97
+ }
98
+ .ev-top {
99
+ display: flex;
100
+ flex-wrap: wrap;
101
+ justify-content: space-between;
102
+ align-items: flex-start;
103
+ gap: 0.5rem;
104
+ }
105
+ .ev-date {
106
+ color: var(--accent);
107
+ font-family: var(--font-display);
108
+ font-size: 0.9375rem;
109
+ font-weight: 800;
110
+ letter-spacing: 0.02em;
111
+ text-transform: uppercase;
112
+ }
113
+ .ev-title {
114
+ font-size: 1.375rem;
115
+ font-weight: 600;
116
+ line-height: 1.2;
117
+ }
118
+ .ev-title a {
119
+ color: var(--ink);
120
+ text-decoration: none;
121
+ }
122
+ .ev-card-linked .ev-title a::after {
123
+ content: '';
124
+ position: absolute;
125
+ inset: 0;
126
+ border-radius: inherit;
127
+ }
128
+ .ev-card-linked:hover .ev-title a {
129
+ text-decoration: underline;
130
+ }
131
+ .ev-card-linked:focus-within {
132
+ outline: 3px solid var(--ink);
133
+ outline-offset: 3px;
134
+ }
135
+ .ev-card-linked .ev-title a:focus-visible {
136
+ outline: none;
137
+ }
138
+ .ev-meta {
139
+ color: var(--muted);
140
+ font-size: var(--text-sm);
141
+ }
142
+ /* Over the linked card's cover, so it opens the calendar file, not the page; on one line. */
143
+ .ev-calendar {
144
+ position: relative;
145
+ z-index: 1;
146
+ white-space: nowrap;
147
+ }
148
+ .ev-live {
149
+ color: var(--ink);
150
+ font-size: var(--text-sm);
151
+ font-weight: 700;
152
+ }
153
+ .ev-live:empty {
154
+ display: none;
155
+ }
156
+ .ev-closed {
157
+ color: var(--muted);
158
+ font-size: var(--text-sm);
159
+ font-weight: 700;
160
+ }
161
+ .ev-card .ev-action {
162
+ margin-top: auto;
163
+ padding-top: 0.25rem;
164
+ }
165
+ /* A1's RSVP: the quieter solid button, small. */
166
+ .ev-action .button {
167
+ min-height: 2.375rem;
168
+ padding: 0 1rem;
169
+ border-color: var(--button-2);
170
+ background: var(--button-2);
171
+ color: var(--button-2-ink);
172
+ font-size: var(--text-sm);
173
+ }
174
+ @media (prefers-reduced-motion: no-preference) {
175
+ .ev-card {
176
+ transition:
177
+ transform 0.15s ease,
178
+ box-shadow 0.15s ease;
179
+ }
180
+ /* A1's motion note: a card lifts 2px with a deeper shadow on hover. */
181
+ .ev-card:hover {
182
+ transform: translateY(-2px);
183
+ box-shadow: var(--shadow), 0 14px 28px -18px color-mix(in srgb, var(--shadow-ink) 45%, transparent);
184
+ }
185
+ }
186
+ </style>