@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,322 @@
1
+ ---
2
+ // Issues, 'tabs' layout (REPORT §3, "Issue tabs"): the kicker, the heading
3
+ // and the lead, then one tab per issue over the issue's panel. A tab reads
4
+ // the issue's two-digit number in the accent and its title; the chosen tab is
5
+ // filled in the band's second button colour. The panel is a card on the
6
+ // band's surface: the issue's picture (16:10) beside its words on a wide
7
+ // screen and over them on a phone, then its title, its line, its note as a
8
+ // chip and what it includes as a checked list. The section's links follow as
9
+ // buttons, the first the main one.
10
+ //
11
+ // Every panel has its own address, `#<anchor>-<the title's words>`
12
+ // ("#platform-freeze-the-levy"), the anchor being the section's anchor id or,
13
+ // without one, its block id; an issue whose title has no words takes its
14
+ // number. The tabs are drawn hidden and shown by the section's script, so with
15
+ // scripts off (and with a single issue) every panel shows, one under the
16
+ // other, each under its own heading, and a link to a panel's address scrolls
17
+ // to it. With the script: the arrow keys move between the tabs (Home and End
18
+ // to the first and last), choosing a tab writes its panel's address into the
19
+ // page's address without adding a step to the history, an address that names
20
+ // a panel opens that tab when the page loads or the address changes. With no
21
+ // issue, heading, kicker or lead nothing is drawn.
22
+ import type { ComponentProps } from 'astro/types'
23
+ import Band from '../Band.astro'
24
+ import Prose from '../../Prose.astro'
25
+ import type Default from './index.astro'
26
+ import { issuesOf, numeral } from './issues'
27
+ import { links } from '../../../lib/section'
28
+ import { prose, text } from '../../../lib/format'
29
+
30
+ type Props = ComponentProps<typeof Default>
31
+
32
+ const { section } = Astro.props
33
+ const heading = text(section.copy.heading)
34
+ const kicker = text(section.copy.kicker)
35
+ const issues = issuesOf(section)
36
+ const ctas = links(section)
37
+ const drawn = heading || kicker || prose(section.copy.lead) || issues.length > 0
38
+
39
+ // The renderer's rule for an anchor id; a block id is made safe the way the
40
+ // other islands make theirs.
41
+ const SAFE_ANCHOR = /^[A-Za-z][A-Za-z0-9_-]{0,40}$/
42
+ const anchorId = section.options?.anchorId
43
+ const base = typeof anchorId === 'string' && SAFE_ANCHOR.test(anchorId) ? anchorId : section.id.replace(/[^A-Za-z0-9_-]/g, '-')
44
+ // Addresses read as words so a shared link says what it opens; a repeat gets a number.
45
+ const taken = new Set<string>()
46
+ const panelId = (title: string | null, i: number) => {
47
+ const slug =
48
+ (title ?? '')
49
+ .toLowerCase()
50
+ .normalize('NFKD')
51
+ .replace(/[^a-z0-9]+/g, '-')
52
+ .replace(/^-+|-+$/g, '')
53
+ .slice(0, 60) || numeral(i)
54
+ let id = `${base}-${slug}`
55
+ for (let n = 2; taken.has(id); n++) id = `${base}-${slug}-${n}`
56
+ taken.add(id)
57
+ return id
58
+ }
59
+ const panels = issues.map((issue, i) => ({ ...issue, id: panelId(issue.title, i), name: issue.title ?? numeral(i) }))
60
+ ---
61
+ {drawn && (
62
+ <Band section={section} class="issues issues-tabs">
63
+ {kicker && <p class="kicker">{kicker}</p>}
64
+ {heading && <h2>{heading}</h2>}
65
+ <Prose value={section.copy.lead} class="lede" />
66
+ {panels.length > 0 && (
67
+ <div class="it" data-issue-tabs>
68
+ <div class="it-list" role="tablist" aria-label={heading ?? 'Issues'} data-it-list hidden>
69
+ {panels.map((p, i) => (
70
+ <button
71
+ type="button"
72
+ role="tab"
73
+ id={`${p.id}-tab`}
74
+ aria-controls={p.id}
75
+ aria-selected={i === 0 ? 'true' : 'false'}
76
+ tabindex={i === 0 ? 0 : -1}
77
+ data-it-tab
78
+ >
79
+ <span class="it-tab-number" aria-hidden="true">{numeral(i)}</span>
80
+ <span>{p.name}</span>
81
+ </button>
82
+ ))}
83
+ </div>
84
+ <div class="it-panels">
85
+ {panels.map((p, i) => (
86
+ <div class:list={['it-panel', p.picture && 'it-panel-pictured']} id={p.id} data-it-panel>
87
+ {p.picture && <img class="it-picture" src={p.picture} alt="" loading="lazy" decoding="async" />}
88
+ <div class="it-words">
89
+ <p class="it-number" aria-hidden="true">{numeral(i)}</p>
90
+ <h3>{p.name}</h3>
91
+ <Prose value={p.body} class="it-body" />
92
+ {p.includes.length > 0 && (
93
+ <ul class="it-includes" role="list">
94
+ {p.includes.map((line) => (
95
+ <li>
96
+ <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M3 8.5l3.2 3.2L13 4.8" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" /></svg>
97
+ <span>{line}</span>
98
+ </li>
99
+ ))}
100
+ </ul>
101
+ )}
102
+ {p.note && <p class="it-note"><span class="chip">{p.note}</span></p>}
103
+ </div>
104
+ </div>
105
+ ))}
106
+ </div>
107
+ <script is:inline>
108
+ (function (root) {
109
+ if (!root) return
110
+ var list = root.querySelector('[data-it-list]')
111
+ var tabs = list.querySelectorAll('[data-it-tab]')
112
+ var panels = root.querySelectorAll('[data-it-panel]')
113
+ // One issue needs no tabs: its panel stands as it is drawn.
114
+ if (tabs.length < 2) return
115
+ var chosen = 0
116
+ var choose = function (i, how) {
117
+ chosen = i
118
+ for (var t = 0; t < tabs.length; t++) {
119
+ tabs[t].setAttribute('aria-selected', t === i ? 'true' : 'false')
120
+ tabs[t].tabIndex = t === i ? 0 : -1
121
+ panels[t].hidden = t !== i
122
+ }
123
+ if (how.focus) tabs[i].focus()
124
+ if (how.write && window.history && history.replaceState) history.replaceState(history.state, '', '#' + panels[i].id)
125
+ if (how.scroll) root.scrollIntoView({ block: 'start' })
126
+ }
127
+ // The panel the address names, or -1.
128
+ var named = function () {
129
+ var id = location.hash.slice(1)
130
+ try {
131
+ id = decodeURIComponent(id)
132
+ } catch (e) {}
133
+ for (var p = 0; p < panels.length; p++) if (panels[p].id === id) return p
134
+ return -1
135
+ }
136
+ for (var p = 0; p < panels.length; p++) {
137
+ panels[p].setAttribute('role', 'tabpanel')
138
+ panels[p].setAttribute('aria-labelledby', tabs[p].id)
139
+ panels[p].tabIndex = 0
140
+ }
141
+ for (var t = 0; t < tabs.length; t++) {
142
+ tabs[t].addEventListener('click', function (event) {
143
+ for (var t = 0; t < tabs.length; t++) if (tabs[t] === event.currentTarget) choose(t, { write: true })
144
+ })
145
+ }
146
+ list.addEventListener('keydown', function (event) {
147
+ var last = tabs.length - 1
148
+ var next = { ArrowLeft: chosen === 0 ? last : chosen - 1, ArrowRight: chosen === last ? 0 : chosen + 1, Home: 0, End: last }[event.key]
149
+ if (next === undefined) return
150
+ event.preventDefault()
151
+ choose(next, { focus: true, write: true })
152
+ })
153
+ window.addEventListener('hashchange', function () {
154
+ var p = named()
155
+ if (p >= 0) choose(p, { scroll: true })
156
+ })
157
+ list.hidden = false
158
+ root.setAttribute('data-it-live', '')
159
+ // An address that names a panel: the browser scrolls to the panel as the page
160
+ // loads, so once it has, the tabs are brought back into view over it.
161
+ var start = named()
162
+ choose(start >= 0 ? start : 0, {})
163
+ if (start >= 0)
164
+ window.addEventListener('load', function () {
165
+ if (named() === start) root.scrollIntoView({ block: 'start' })
166
+ })
167
+ })(document.currentScript.closest('[data-issue-tabs]'))
168
+ </script>
169
+ </div>
170
+ )}
171
+ {ctas.length > 0 && (
172
+ <p class="actions">
173
+ {ctas.map((link, i) => <a class:list={['button', i > 0 && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
174
+ </p>
175
+ )}
176
+ </Band>
177
+ )}
178
+
179
+ <style>
180
+ .it {
181
+ margin-top: 2rem;
182
+ }
183
+ .it-list[hidden],
184
+ .it-panel[hidden] {
185
+ display: none;
186
+ }
187
+
188
+ /* The tabs: a wrapped row of pills, the chosen one filled. */
189
+ .it-list {
190
+ display: flex;
191
+ flex-wrap: wrap;
192
+ gap: 0.5rem;
193
+ margin-bottom: 1.25rem;
194
+ }
195
+ .it-list button {
196
+ display: inline-flex;
197
+ align-items: center;
198
+ gap: 0.5rem;
199
+ min-height: 2.75rem;
200
+ padding: 0.375rem 1.125rem 0.375rem 0.875rem;
201
+ border: 1.5px solid var(--line-strong);
202
+ border-radius: var(--pill);
203
+ background: transparent;
204
+ color: var(--ink);
205
+ font: inherit;
206
+ font-size: var(--text-sm);
207
+ font-weight: 700;
208
+ line-height: 1.25;
209
+ text-align: left;
210
+ cursor: pointer;
211
+ }
212
+ .it-list button:hover {
213
+ border-color: var(--ink);
214
+ }
215
+ .it-tab-number {
216
+ color: var(--accent);
217
+ font-family: var(--font-display);
218
+ font-weight: 800;
219
+ }
220
+ .it-list button[aria-selected='true'] {
221
+ border-color: var(--button-2);
222
+ background: var(--button-2);
223
+ color: var(--button-2-ink);
224
+ }
225
+ .it-list button[aria-selected='true'] .it-tab-number {
226
+ color: inherit;
227
+ }
228
+
229
+ /* The panels: cards on the band's surface, one under the other until the script makes them tabs. */
230
+ .it-panels {
231
+ display: grid;
232
+ gap: 1.25rem;
233
+ }
234
+ .it-panel {
235
+ display: grid;
236
+ gap: 1.5rem;
237
+ min-width: 0;
238
+ padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
239
+ border: 1px solid var(--line);
240
+ border-radius: var(--radius-card);
241
+ background: var(--surface);
242
+ box-shadow: var(--shadow);
243
+ }
244
+ .it-picture {
245
+ display: block;
246
+ width: 100%;
247
+ aspect-ratio: 16 / 10;
248
+ object-fit: cover;
249
+ border-radius: var(--radius);
250
+ background: var(--line);
251
+ }
252
+ .it-words {
253
+ min-width: 0;
254
+ }
255
+ .it-words > * {
256
+ margin: 0;
257
+ }
258
+ .it-number {
259
+ color: var(--accent);
260
+ font-family: var(--font-display);
261
+ font-size: clamp(1.75rem, 1.5rem + 0.8vw, 2.25rem);
262
+ font-weight: 800;
263
+ line-height: 1;
264
+ }
265
+ .it-words h3 {
266
+ margin-top: 0.5rem;
267
+ }
268
+ .it-words :global(.it-body) {
269
+ margin-top: 0.5rem;
270
+ color: var(--muted);
271
+ }
272
+ .it-words :global(.it-body) > :global(:last-child) {
273
+ margin-bottom: 0;
274
+ }
275
+ .it-words .it-includes {
276
+ display: grid;
277
+ gap: 0.375rem;
278
+ margin-top: 1rem;
279
+ padding: 0;
280
+ list-style: none;
281
+ font-size: var(--text-sm);
282
+ }
283
+ .it-includes li {
284
+ display: flex;
285
+ align-items: flex-start;
286
+ gap: 0.5rem;
287
+ line-height: 1.45;
288
+ }
289
+ .it-includes svg {
290
+ flex: 0 0 auto;
291
+ margin-top: 0.15em;
292
+ color: var(--accent);
293
+ }
294
+ .it-words .it-note {
295
+ margin-top: 1rem;
296
+ }
297
+ /* Tabs live: the panel's number is already on its tab. */
298
+ [data-it-live] .it-number {
299
+ display: none;
300
+ }
301
+ [data-it-live] .it-words h3 {
302
+ margin-top: 0;
303
+ }
304
+ @media (min-width: 48rem) {
305
+ .it-panel-pictured {
306
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
307
+ gap: clamp(1.75rem, 4vw, 3rem);
308
+ align-items: center;
309
+ }
310
+ }
311
+ @media (prefers-reduced-motion: no-preference) {
312
+ [data-it-live] .it-panel {
313
+ animation: it-panel-in 0.2s ease-out;
314
+ }
315
+ }
316
+ @keyframes it-panel-in {
317
+ from {
318
+ opacity: 0;
319
+ transform: translateY(0.375rem);
320
+ }
321
+ }
322
+ </style>
@@ -0,0 +1,29 @@
1
+ ---
2
+ // Leaderboard: BackGold's hosted pages fill a leaderboard live, and the
3
+ // Content API does not hand out its rows (supporters' names stay in
4
+ // BackGold), so today this section renders nothing. Should rows arrive, it
5
+ // lists them with a name and a figure.
6
+ import type { Section } from '@backgold/content'
7
+ import Band from '../Band.astro'
8
+ import { rows } from '../../../lib/section'
9
+ import { text } from '../../../lib/format'
10
+
11
+ interface Props {
12
+ section: Section
13
+ variant?: string
14
+ }
15
+
16
+ const { section } = Astro.props
17
+ const heading = text(section.copy.heading)
18
+ const entries = rows(section)
19
+ .map((row) => ({ name: text(row.name) ?? text(row.label), value: text(row.value) ?? text(row.total) }))
20
+ .filter((e) => e.name)
21
+ ---
22
+ {entries.length > 0 && (
23
+ <Band section={section} class="leaderboard">
24
+ {heading && <h2>{heading}</h2>}
25
+ <ol class="ranked">
26
+ {entries.map((e) => <li><span>{e.name}</span>{e.value && <strong>{e.value}</strong>}</li>)}
27
+ </ol>
28
+ </Band>
29
+ )}
@@ -0,0 +1,121 @@
1
+ ---
2
+ // A locked lesson's door (board D3, "The door, three states"), under the
3
+ // teaser and the lesson's head. The lock's reason picks it (lesson.ts):
4
+ // sign-in "Sign in with your email to watch": a real form to the site's
5
+ // sign-in door, coming back here and naming the lesson
6
+ // ("Lesson 3: Read a budget, in Foundations"), with the box for the
7
+ // site's letter, by its name ("Also send me the Academy letter"),
8
+ // unticked; ticked, it rides along as `newsletter=1`.
9
+ // join "Join to watch": See how to join (the site's Join page, which
10
+ // says what joining costs), and for a member under another email
11
+ // the way to sign out and back in.
12
+ // tag "This lesson is for <tag> members": nobody can give themselves
13
+ // a tag, so it says to ask and links the Contact page.
14
+ import { VISITOR_SIGN_IN_PATH } from '#contract/content-api'
15
+ import type { Door } from './lesson'
16
+ import { CONTACT_PATH, JOIN_PATH } from '../../../lib/academy'
17
+ import { idFor } from '../SampleBallot/ballot'
18
+ import type { Section } from '@backgold/content'
19
+
20
+ interface Props {
21
+ door: Door
22
+ section: Section
23
+ level: 2 | 3
24
+ }
25
+
26
+ const { door, section, level } = Astro.props
27
+ const Title = level === 2 ? 'h2' : 'h3'
28
+ const id = idFor(section, 'lesson-door')
29
+ const tagName = door.kind === 'tag' ? door.tag : null
30
+ ---
31
+ <section class="ls-door" aria-labelledby={id}>
32
+ {door.kind === 'sign-in' && (
33
+ <>
34
+ <Title id={id} class="ls-door-title">Sign in with your email to watch</Title>
35
+ <p>This lesson is free. Sign in with your email and we bring you straight back here.</p>
36
+ <form class="ls-door-form" method="get" action={VISITOR_SIGN_IN_PATH}>
37
+ <input type="hidden" name="return" value={door.returnPath} />
38
+ <input type="hidden" name="title" value={door.title} />
39
+ <button class="button" type="submit">Sign in with your email</button>
40
+ <label class="ls-check">
41
+ <input type="checkbox" name="newsletter" value="1" />
42
+ <span>Also send me {door.newsletter}</span>
43
+ </label>
44
+ <p class="fine">Signing in does not sign you up for any email. Unsubscribe from {door.newsletter} in one click, any time.</p>
45
+ </form>
46
+ </>
47
+ )}
48
+ {door.kind === 'join' && (
49
+ <>
50
+ <Title id={id} class="ls-door-title">Join to watch</Title>
51
+ <p>
52
+ {door.orgName ? `Lesson ${door.n} is for members of ${door.orgName}.` : `Lesson ${door.n} is for members.`}
53
+ {door.name && ` You are signed in as ${door.name}, and we have no active membership for you.`}
54
+ </p>
55
+ <p class="ls-door-actions"><a class="button" href={JOIN_PATH}>See how to join</a></p>
56
+ {door.name ? (
57
+ <p class="fine">A member already, under another email? <a href={door.signOut}>Sign out</a> and sign in with that one.</p>
58
+ ) : (
59
+ <p class="fine">A member already? <a href={door.signIn}>Sign in</a> with the email you joined with.</p>
60
+ )}
61
+ </>
62
+ )}
63
+ {door.kind === 'tag' && (
64
+ <>
65
+ <Title id={id} class="ls-door-title">{tagName ? `This lesson is for ${tagName} members` : 'This lesson is by invitation'}</Title>
66
+ <p>
67
+ {door.orgName ?? 'The organization'} adds people to {tagName ?? 'this group'}. If you think you should be in it, ask them.
68
+ </p>
69
+ <p class="ls-door-actions"><a class="button" href={CONTACT_PATH}>Contact the Academy</a></p>
70
+ </>
71
+ )}
72
+ </section>
73
+
74
+ <style>
75
+ .ls-door {
76
+ display: grid;
77
+ gap: 0.75rem;
78
+ padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
79
+ border: 1px solid var(--line-strong);
80
+ border-radius: var(--radius-card);
81
+ background: var(--surface);
82
+ }
83
+ .ls-door > *,
84
+ .ls-door-form > * {
85
+ margin: 0;
86
+ }
87
+ .ls-door .ls-door-title {
88
+ font-size: calc(var(--h3) * 1.05);
89
+ }
90
+ .ls-door-form {
91
+ display: grid;
92
+ justify-items: start;
93
+ gap: 0.875rem;
94
+ margin-top: 0.25rem;
95
+ }
96
+ .ls-door .button:focus-visible {
97
+ outline: 3px solid var(--link);
98
+ outline-offset: 3px;
99
+ }
100
+ .ls-check {
101
+ display: inline-flex;
102
+ align-items: center;
103
+ gap: 0.625rem;
104
+ min-height: 2.75rem;
105
+ font-weight: 600;
106
+ cursor: pointer;
107
+ }
108
+ .ls-check input {
109
+ width: 1.25rem;
110
+ height: 1.25rem;
111
+ margin: 0;
112
+ accent-color: var(--button);
113
+ }
114
+ .ls-check input:focus-visible {
115
+ outline: 3px solid var(--link);
116
+ outline-offset: 3px;
117
+ }
118
+ .ls-door-actions {
119
+ margin-top: 0.25rem;
120
+ }
121
+ </style>