@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,160 @@
1
+ ---
2
+ // Map, 'bar' layout (Coverage bar; board A12-catalogue, Coverage map). The
3
+ // kicker over the heading, then the coverage line counted against the whole
4
+ // set as a map's is (CoverageLine.astro: "8 of 254 counties · Organized"),
5
+ // then that share as one wide bar: filled to the lit places' share of the
6
+ // set (src/lib/regions.ts coverageShare: `regionTotal` when the section
7
+ // carries one, else the rows), the rest the track. The bar is one image to
8
+ // a screen reader, read as the line and the places still dark ("8 of 254
9
+ // counties · Organized · 246 counties · Still open"); under it the two ends in words,
10
+ // the lit places and the lit label at the left, the dark ones and the dark
11
+ // label at the right, as BackGold's Map block reads its bar (hidden from
12
+ // screen readers, which the bar's label already tells). No geometry is read
13
+ // or drawn.
14
+ //
15
+ // Then the directory: a card per row, a lit place solid and any other dashed
16
+ // as open, the place's name a link when it has one, its status label under
17
+ // it (the lit, starting or dark label: a starting place counts as dark on
18
+ // the bar but keeps its own word in its card). When `regionTotal` counts
19
+ // more places than the rows name, one more dashed card stands for the
20
+ // unnamed ones, their count and the dark label ("251 counties · Still
21
+ // open"), with the section's charter link (the link whose label is
22
+ // `charterCtaText`) as its button. The section's other links follow as
23
+ // buttons, quiet when the charter button leads.
24
+ //
25
+ // Without rows there is nothing to be a share of: the kicker, the heading
26
+ // and the links only.
27
+ //
28
+ // Rows: `region`, `status` 'lit', 'starting' or anything else (dark), an
29
+ // optional `url`.
30
+ import type { ComponentProps } from 'astro/types'
31
+ import Band from '../Band.astro'
32
+ import CoverageLine from './CoverageLine.astro'
33
+ import type Default from './index.astro'
34
+ import { links, rows } from '../../../lib/section'
35
+ import { text } from '../../../lib/format'
36
+ import { coverageOf, coverageShare, mapLabels, nounFor, placesOf } from '../../../lib/regions'
37
+
38
+ type Props = ComponentProps<typeof Default>
39
+
40
+ const { section } = Astro.props
41
+ const kicker = text(section.copy.kicker)
42
+ const heading = text(section.copy.heading)
43
+ const labels = mapLabels(section)
44
+ const places = placesOf(rows(section))
45
+ const actions = links(section)
46
+
47
+ const line = coverageOf(section, places, labels)
48
+ const { lit, total } = coverageShare(section, places)
49
+ const dark = Math.max(0, total - lit)
50
+ const share = total > 0 ? Math.min(100, Math.round((lit / total) * 10000) / 100) : 0
51
+ const unnamed = Math.max(0, total - places.length)
52
+ const charterText = text(section.copy.charterCtaText)
53
+ const charter = unnamed > 0 ? (charterText && actions.find((link) => link.label === charterText)) || null : null
54
+ const below = charter ? actions.filter((link) => link !== charter) : actions
55
+ ---
56
+ <Band section={section} class="regions regions-bar">
57
+ {kicker && <p class="kicker">{kicker}</p>}
58
+ {heading && <h2>{heading}</h2>}
59
+ {places.length > 0 && (
60
+ <>
61
+ <CoverageLine coverage={line} />
62
+ <div class="coverage-bar" role="img" aria-label={`${line.count} · ${line.label} · ${dark} ${nounFor(section, dark)} · ${labels.dark}`}>
63
+ <span class="coverage-bar-fill" style={`width:${share}%`}></span>
64
+ </div>
65
+ <p class="coverage-ends" aria-hidden="true">
66
+ <span><span class="coverage-end-count">{lit} {nounFor(section, lit)}</span> · {labels.lit}</span>
67
+ <span class="coverage-end-dark"><span class="coverage-end-count">{dark} {nounFor(section, dark)}</span> · {labels.dark}</span>
68
+ </p>
69
+ <ul class="directory" role="list">
70
+ {places.map((p) => (
71
+ <li class:list={['place', p.status !== 'lit' && 'place-open']}>
72
+ <span class="place-name">{p.link ? <a href={p.link.href} rel={p.link.rel}>{p.name}</a> : p.name}</span>
73
+ <span class="place-status">{labels[p.status]}</span>
74
+ </li>
75
+ ))}
76
+ {unnamed > 0 && (
77
+ <li class="place place-open place-invite">
78
+ <span class="place-name">{unnamed} {nounFor(section, unnamed)}</span>
79
+ <span class="place-status">{labels.dark}</span>
80
+ {charter && <a class="button button-small" href={charter.href} rel={charter.rel}>{charter.label}</a>}
81
+ </li>
82
+ )}
83
+ </ul>
84
+ </>
85
+ )}
86
+ {below.length > 0 && (
87
+ <p class="actions">
88
+ {below.map((link, i) => <a class:list={['button', (charter || i > 0) && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
89
+ </p>
90
+ )}
91
+ </Band>
92
+
93
+ <style>
94
+ .coverage-bar {
95
+ height: 0.875rem;
96
+ margin-top: 1.25rem;
97
+ border-radius: var(--radius);
98
+ background: color-mix(in srgb, var(--ink) 15%, transparent);
99
+ overflow: hidden;
100
+ }
101
+ .coverage-bar-fill {
102
+ display: block;
103
+ height: 100%;
104
+ background: var(--button);
105
+ }
106
+ .coverage-ends {
107
+ display: flex;
108
+ flex-wrap: wrap;
109
+ justify-content: space-between;
110
+ gap: 0.25rem 1.25rem;
111
+ margin: 0.5rem 0 0;
112
+ color: var(--muted);
113
+ font-size: var(--text-sm);
114
+ }
115
+ .coverage-end-count {
116
+ font-weight: 700;
117
+ }
118
+ /* The dark end keeps to the right when a narrow screen wraps it under the lit end. */
119
+ .coverage-end-dark {
120
+ margin-left: auto;
121
+ text-align: right;
122
+ }
123
+ .directory {
124
+ display: grid;
125
+ grid-template-columns: 1fr;
126
+ gap: 0.625rem;
127
+ list-style: none;
128
+ margin: 1.5rem 0 0;
129
+ padding: 0;
130
+ }
131
+ @media (min-width: 40rem) {
132
+ .directory {
133
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
134
+ }
135
+ }
136
+ .place {
137
+ padding: 0.75rem 0.875rem;
138
+ border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
139
+ border-radius: var(--radius);
140
+ background: color-mix(in srgb, var(--page) 60%, transparent);
141
+ }
142
+ .place-open {
143
+ border-style: dashed;
144
+ border-color: color-mix(in srgb, var(--ink) 30%, transparent);
145
+ background: transparent;
146
+ }
147
+ .place-name {
148
+ display: block;
149
+ font-weight: 700;
150
+ }
151
+ .place-status {
152
+ display: block;
153
+ color: var(--muted);
154
+ font-size: var(--text-sm);
155
+ }
156
+ /* The places no row names, as one card with the charter link. */
157
+ .place-invite .button {
158
+ margin-top: 0.625rem;
159
+ }
160
+ </style>
@@ -0,0 +1,192 @@
1
+ ---
2
+ // Map, 'directory' layout, the default (Map and directory; board
3
+ // A11-contact, section 4). The kicker over the heading, then the coverage
4
+ // line (CoverageLine.astro: "8 of 254 counties · Organized").
5
+ //
6
+ // With the section's geometry (`media.geoUrl`, read on the server,
7
+ // src/lib/geo.ts): the map (RegionMap.astro: every place in the set
8
+ // coloured by its row's status, a lit place with a link opening it, and the
9
+ // key), then the directory: a card for each lit and starting place with its
10
+ // status, the place's name a link when it has one, and one dashed card for
11
+ // the places the map draws dark, their count and the dark label ("239
12
+ // counties", "No chapter yet"), with the section's charter link as its
13
+ // button. The section's other links follow, quiet.
14
+ //
15
+ // Without a geometry (a section that never picked a set of places, or one
16
+ // whose geometry could not be read): a compact strip of one tile per row
17
+ // coloured lit or not with a key under it, then a card per row, every place
18
+ // not lit dashed as open. The strip repeats what the cards say, so it is
19
+ // hidden from screen readers. The section's links follow as buttons.
20
+ //
21
+ // Rows: `region`, `status` 'lit', 'starting' or anything else (dark), an
22
+ // optional `url`. 'map' is its own file beside this one.
23
+ import type { Section } from '@backgold/content'
24
+ import Band from '../Band.astro'
25
+ import CoverageLine from './CoverageLine.astro'
26
+ import RegionMap from './RegionMap.astro'
27
+ import { links, media, rows } from '../../../lib/section'
28
+ import { text } from '../../../lib/format'
29
+ import { loadGeo } from '../../../lib/geo'
30
+ import { coverage, drawMap, invitation, mapLabels, placesOf } from '../../../lib/regions'
31
+
32
+ interface Props {
33
+ section: Section
34
+ variant?: string
35
+ }
36
+
37
+ const { section } = Astro.props
38
+ const kicker = text(section.copy.kicker)
39
+ const heading = text(section.copy.heading)
40
+ const labels = mapLabels(section)
41
+ const places = placesOf(rows(section))
42
+ const geo = await loadGeo(media(section, 'geoUrl')?.url ?? null, Astro.locals)
43
+ const drawn = geo ? drawMap(geo, places, text(section.options?.focusRegion)) : null
44
+ const actions = links(section)
45
+ const invite = drawn ? invitation(section, drawn, actions, labels) : null
46
+ const below = invite?.charter ? actions.filter((link) => link !== invite.charter) : actions
47
+ ---
48
+ {drawn ? (
49
+ <Band section={section} class="regions">
50
+ {kicker && <p class="kicker">{kicker}</p>}
51
+ {heading && <h2>{heading}</h2>}
52
+ <CoverageLine coverage={coverage(section, drawn, places, labels)} />
53
+ <RegionMap drawn={drawn} labels={labels} starting={places.some((p) => p.status === 'starting')} size="compact" />
54
+ {(invite || places.some((p) => p.status !== 'dark')) && (
55
+ <ul class="directory" role="list">
56
+ {places.filter((p) => p.status !== 'dark').map((p) => (
57
+ <li class="place">
58
+ <span class="place-name">{p.link ? <a href={p.link.href} rel={p.link.rel}>{p.name}</a> : p.name}</span>
59
+ <span class="place-status">{labels[p.status]}</span>
60
+ </li>
61
+ ))}
62
+ {invite && (
63
+ <li class="place place-open place-invite">
64
+ <span class="place-name">{invite.count}</span>
65
+ <span class="place-status">{invite.label}</span>
66
+ {invite.charter && <a class="button button-small" href={invite.charter.href} rel={invite.charter.rel}>{invite.charter.label}</a>}
67
+ </li>
68
+ )}
69
+ </ul>
70
+ )}
71
+ {below.length > 0 && (
72
+ <p class="actions">
73
+ {below.map((link, i) => <a class:list={['button', (invite?.charter || i > 0) && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
74
+ </p>
75
+ )}
76
+ </Band>
77
+ ) : (
78
+ <Band section={section} class="regions">
79
+ {kicker && <p class="kicker">{kicker}</p>}
80
+ {heading && <h2>{heading}</h2>}
81
+ {places.length > 0 && <CoverageLine coverage={coverage(section, null, places, labels)} />}
82
+ {places.length > 0 && (
83
+ <>
84
+ <div class="strip" aria-hidden="true">
85
+ {places.map((r) => <span class:list={['strip-tile', r.status === 'lit' && 'strip-tile-lit']}></span>)}
86
+ </div>
87
+ <p class="key" aria-hidden="true">
88
+ <span><i class="key-swatch key-swatch-lit"></i>{labels.lit}</span>
89
+ <span><i class="key-swatch"></i>{labels.dark}</span>
90
+ </p>
91
+ <ul class="directory" role="list">
92
+ {places.map((r) => (
93
+ <li class:list={['place', r.status !== 'lit' && 'place-open']}>
94
+ <span class="place-name">{r.link ? <a href={r.link.href} rel={r.link.rel}>{r.name}</a> : r.name}</span>
95
+ <span class="place-status">{r.status === 'lit' ? labels.lit : labels.dark}</span>
96
+ </li>
97
+ ))}
98
+ </ul>
99
+ </>
100
+ )}
101
+ {actions.length > 0 && (
102
+ <p class="actions">
103
+ {actions.map((link, i) => <a class:list={['button', i > 0 && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
104
+ </p>
105
+ )}
106
+ </Band>
107
+ )}
108
+
109
+ <style>
110
+ .strip {
111
+ display: grid;
112
+ grid-template-columns: repeat(auto-fill, minmax(1.25rem, 1fr));
113
+ gap: 0.25rem;
114
+ margin-top: 1.5rem;
115
+ }
116
+ .strip-tile {
117
+ aspect-ratio: 1.1;
118
+ border-radius: 0.25rem;
119
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
120
+ }
121
+ .strip-tile-lit {
122
+ background: var(--button);
123
+ }
124
+ @media (min-width: 48rem) {
125
+ .strip {
126
+ grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
127
+ gap: 0.375rem;
128
+ }
129
+ .strip-tile {
130
+ border-radius: 0.5rem;
131
+ }
132
+ }
133
+ .key {
134
+ display: flex;
135
+ flex-wrap: wrap;
136
+ gap: 0.5rem 1.25rem;
137
+ margin: 0.75rem 0 0;
138
+ color: var(--muted);
139
+ font-size: var(--text-sm);
140
+ }
141
+ .key-swatch {
142
+ display: inline-block;
143
+ width: 0.75rem;
144
+ height: 0.75rem;
145
+ margin-right: 0.375rem;
146
+ border-radius: 0.1875rem;
147
+ vertical-align: -0.0625rem;
148
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
149
+ border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
150
+ }
151
+ .key-swatch-lit {
152
+ background: var(--button);
153
+ border-color: var(--button);
154
+ }
155
+ .directory {
156
+ display: grid;
157
+ grid-template-columns: 1fr;
158
+ gap: 0.625rem;
159
+ list-style: none;
160
+ margin: 1.5rem 0 0;
161
+ padding: 0;
162
+ }
163
+ @media (min-width: 40rem) {
164
+ .directory {
165
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
166
+ }
167
+ }
168
+ .place {
169
+ padding: 0.75rem 0.875rem;
170
+ border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
171
+ border-radius: var(--radius);
172
+ background: color-mix(in srgb, var(--page) 60%, transparent);
173
+ }
174
+ .place-open {
175
+ border-style: dashed;
176
+ border-color: color-mix(in srgb, var(--ink) 30%, transparent);
177
+ background: transparent;
178
+ }
179
+ .place-name {
180
+ display: block;
181
+ font-weight: 700;
182
+ }
183
+ .place-status {
184
+ display: block;
185
+ color: var(--muted);
186
+ font-size: var(--text-sm);
187
+ }
188
+ /* The places the map draws dark, as one card with the charter link. */
189
+ .place-invite .button {
190
+ margin-top: 0.625rem;
191
+ }
192
+ </style>
@@ -0,0 +1,275 @@
1
+ ---
2
+ // Map, 'map' layout (Map only; boards A11-contact, section 4, and
3
+ // A12-catalogue). The kicker over the heading, then the coverage line
4
+ // (CoverageLine.astro: "8 of 254 counties · Organized").
5
+ //
6
+ // With the section's geometry (`media.geoUrl`, read on the server,
7
+ // src/lib/geo.ts): the map large (RegionMap.astro: every place in the set
8
+ // coloured by its row's status, a lit place with a link opening it, and the
9
+ // key), then the directory as a list on every width (in columns on a wide
10
+ // screen): the lit and starting places, each a link when it has one, with
11
+ // its status. The places the map draws dark are one dashed line under it,
12
+ // their count and the dark label ("239 counties · No chapter yet"), with
13
+ // the section's charter link as its button; the section's other links
14
+ // follow, quiet.
15
+ //
16
+ // Without a geometry (a section that never picked a set of places, or one
17
+ // whose geometry could not be read) it draws tiles instead: one tile per
18
+ // row coloured lit or not with its name in the tile (a link when the place
19
+ // has one), and a key under it. On a phone the tiles are too small to name,
20
+ // so they become a compact strip and the same places are listed under it:
21
+ // the list is the one the tiles draw, restyled, so a screen reader meets
22
+ // each place once. The section's links follow as buttons.
23
+ //
24
+ // Rows: `region`, `status` 'lit', 'starting' or anything else (dark), an
25
+ // optional `url`.
26
+ import type { ComponentProps } from 'astro/types'
27
+ import Band from '../Band.astro'
28
+ import CoverageLine from './CoverageLine.astro'
29
+ import RegionMap from './RegionMap.astro'
30
+ import type Default from './index.astro'
31
+ import { links, media, rows } from '../../../lib/section'
32
+ import { text } from '../../../lib/format'
33
+ import { loadGeo } from '../../../lib/geo'
34
+ import { coverage, drawMap, invitation, mapLabels, placesOf } from '../../../lib/regions'
35
+
36
+ type Props = ComponentProps<typeof Default>
37
+
38
+ const { section } = Astro.props
39
+ const kicker = text(section.copy.kicker)
40
+ const heading = text(section.copy.heading)
41
+ const labels = mapLabels(section)
42
+ const places = placesOf(rows(section))
43
+ const geo = await loadGeo(media(section, 'geoUrl')?.url ?? null, Astro.locals)
44
+ const drawn = geo ? drawMap(geo, places, text(section.options?.focusRegion)) : null
45
+ const actions = links(section)
46
+ const invite = drawn ? invitation(section, drawn, actions, labels) : null
47
+ const below = invite?.charter ? actions.filter((link) => link !== invite.charter) : actions
48
+ ---
49
+ {drawn ? (
50
+ <Band section={section} class="regions">
51
+ {kicker && <p class="kicker">{kicker}</p>}
52
+ {heading && <h2>{heading}</h2>}
53
+ <CoverageLine coverage={coverage(section, drawn, places, labels)} />
54
+ <RegionMap drawn={drawn} labels={labels} starting={places.some((p) => p.status === 'starting')} size="large" />
55
+ {places.some((p) => p.status !== 'dark') && (
56
+ <ul class="place-list" role="list">
57
+ {places.filter((p) => p.status !== 'dark').map((p) => (
58
+ <li class="place-row">
59
+ {p.link ? <a href={p.link.href} rel={p.link.rel}>{p.name}</a> : <span>{p.name}</span>}
60
+ <span class="place-status">{labels[p.status]}</span>
61
+ </li>
62
+ ))}
63
+ </ul>
64
+ )}
65
+ {invite && (
66
+ <div class="place-invite">
67
+ <p><span class="place-invite-count">{invite.count}</span> · {invite.label}</p>
68
+ {invite.charter && <a class="button" href={invite.charter.href} rel={invite.charter.rel}>{invite.charter.label}</a>}
69
+ </div>
70
+ )}
71
+ {below.length > 0 && (
72
+ <p class="actions">
73
+ {below.map((link, i) => <a class:list={['button', (invite?.charter || i > 0) && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
74
+ </p>
75
+ )}
76
+ </Band>
77
+ ) : (
78
+ <Band section={section} class="regions">
79
+ {kicker && <p class="kicker">{kicker}</p>}
80
+ {heading && <h2>{heading}</h2>}
81
+ {places.length > 0 && <CoverageLine coverage={coverage(section, null, places, labels)} />}
82
+ {places.length > 0 && (
83
+ <figure class="tile-map">
84
+ <div class="tile-strip" aria-hidden="true">
85
+ {places.map((r) => <span class:list={['strip-tile', r.status === 'lit' && 'strip-tile-lit']}></span>)}
86
+ </div>
87
+ <ul class="tiles" role="list">
88
+ {places.map((r) => (
89
+ <li class:list={['tile-place', r.status === 'lit' && 'tile-place-lit']}>
90
+ {r.link ? <a href={r.link.href} rel={r.link.rel}>{r.name}</a> : <span>{r.name}</span>}
91
+ <span class="tile-status">{r.status === 'lit' ? labels.lit : labels.dark}</span>
92
+ </li>
93
+ ))}
94
+ </ul>
95
+ <figcaption class="key">
96
+ <span><i class="key-swatch key-swatch-lit" aria-hidden="true"></i>{labels.lit}</span>
97
+ <span><i class="key-swatch" aria-hidden="true"></i>{labels.dark}</span>
98
+ </figcaption>
99
+ </figure>
100
+ )}
101
+ {actions.length > 0 && (
102
+ <p class="actions">
103
+ {actions.map((link, i) => <a class:list={['button', i > 0 && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
104
+ </p>
105
+ )}
106
+ </Band>
107
+ )}
108
+
109
+ <style>
110
+ /* With the map: the directory under it, a list on every width. */
111
+ .place-list {
112
+ list-style: none;
113
+ margin: 1.5rem 0 0;
114
+ padding: 0;
115
+ border-top: 1px solid var(--line);
116
+ }
117
+ .place-row {
118
+ display: flex;
119
+ justify-content: space-between;
120
+ align-items: baseline;
121
+ gap: 1rem;
122
+ padding: 0.625rem 0;
123
+ border-bottom: 1px solid var(--line);
124
+ font-weight: 700;
125
+ break-inside: avoid;
126
+ }
127
+ .place-status {
128
+ flex-shrink: 0;
129
+ color: var(--muted);
130
+ font-size: var(--text-sm);
131
+ font-weight: 400;
132
+ }
133
+ /* The places the map draws dark, as one line with the charter link. */
134
+ .place-invite {
135
+ display: flex;
136
+ flex-wrap: wrap;
137
+ align-items: center;
138
+ justify-content: space-between;
139
+ gap: 0.75rem 1.5rem;
140
+ margin-top: 1.25rem;
141
+ padding: 1rem 1.25rem;
142
+ border: 1px dashed var(--line-strong);
143
+ border-radius: var(--radius);
144
+ }
145
+ .place-invite p {
146
+ margin: 0;
147
+ color: var(--muted);
148
+ }
149
+ .place-invite-count {
150
+ color: var(--ink);
151
+ font-weight: 700;
152
+ }
153
+ /* Wider: the list runs in columns. */
154
+ @media (min-width: 48rem) {
155
+ .place-list {
156
+ columns: 3 14rem;
157
+ column-gap: 2.5rem;
158
+ border-top: 0;
159
+ }
160
+ }
161
+
162
+ /* Without the map, a phone: the strip, the key, then the places as a list. */
163
+ .tile-map {
164
+ margin: 1.5rem 0 0;
165
+ display: flex;
166
+ flex-direction: column;
167
+ }
168
+ .tile-strip {
169
+ display: grid;
170
+ grid-template-columns: repeat(auto-fill, minmax(1.25rem, 1fr));
171
+ gap: 0.25rem;
172
+ }
173
+ .strip-tile {
174
+ aspect-ratio: 1.1;
175
+ border-radius: 0.25rem;
176
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
177
+ }
178
+ .strip-tile-lit {
179
+ background: var(--button);
180
+ }
181
+ .key {
182
+ order: 1;
183
+ display: flex;
184
+ flex-wrap: wrap;
185
+ gap: 0.5rem 1.25rem;
186
+ margin-top: 0.75rem;
187
+ color: var(--muted);
188
+ font-size: var(--text-sm);
189
+ }
190
+ .key-swatch {
191
+ display: inline-block;
192
+ width: 0.75rem;
193
+ height: 0.75rem;
194
+ margin-right: 0.375rem;
195
+ border-radius: 0.1875rem;
196
+ vertical-align: -0.0625rem;
197
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
198
+ border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
199
+ }
200
+ .key-swatch-lit {
201
+ background: var(--button);
202
+ border-color: var(--button);
203
+ }
204
+ .tiles {
205
+ order: 2;
206
+ list-style: none;
207
+ margin: 1.25rem 0 0;
208
+ padding: 0;
209
+ border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
210
+ }
211
+ .tile-place {
212
+ display: flex;
213
+ justify-content: space-between;
214
+ align-items: baseline;
215
+ gap: 1rem;
216
+ padding: 0.625rem 0;
217
+ border-bottom: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
218
+ font-weight: 700;
219
+ }
220
+ .tile-status {
221
+ flex-shrink: 0;
222
+ color: var(--muted);
223
+ font-size: var(--text-sm);
224
+ font-weight: 400;
225
+ }
226
+
227
+ /* Without the map, wider: the places are the map, each a tile with its name. */
228
+ @media (min-width: 40rem) {
229
+ .tile-strip {
230
+ display: none;
231
+ }
232
+ .tiles {
233
+ order: 0;
234
+ display: grid;
235
+ grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
236
+ gap: 0.375rem;
237
+ margin: 0;
238
+ border-top: 0;
239
+ }
240
+ .tile-place {
241
+ display: grid;
242
+ place-items: center;
243
+ align-content: center;
244
+ aspect-ratio: 1.1;
245
+ padding: 0.375rem;
246
+ border: 0;
247
+ border-radius: 0.5rem;
248
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
249
+ color: var(--ink);
250
+ font-size: var(--text-xs);
251
+ line-height: 1.2;
252
+ text-align: center;
253
+ overflow-wrap: anywhere;
254
+ }
255
+ .tile-place-lit {
256
+ background: var(--button);
257
+ color: var(--button-ink);
258
+ }
259
+ .tile-place a {
260
+ color: inherit;
261
+ }
262
+ .tile-status {
263
+ position: absolute;
264
+ width: 1px;
265
+ height: 1px;
266
+ margin: -1px;
267
+ overflow: hidden;
268
+ clip: rect(0 0 0 0);
269
+ white-space: nowrap;
270
+ }
271
+ .key {
272
+ margin-top: 1rem;
273
+ }
274
+ }
275
+ </style>