@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,416 @@
1
+ ---
2
+ // One lesson (board D3), for both layouts. The breadcrumb, then:
3
+ // the player an uploaded file in the browser's own <video>
4
+ // (preload="metadata", the cover as its poster) over the api's
5
+ // Range-served file: the 1080p copy, which the lesson's script
6
+ // trades for the 720p one on a viewport 768px wide or narrower,
7
+ // before it plays; the original until the copies are ready, and
8
+ // always behind the fallback link. An imported YouTube or Vimeo
9
+ // video in that player's own frame (YouTube's privacy-enhanced
10
+ // embed). For a visitor it picks up at the place they stopped
11
+ // ("Picks up at 1:12, where you stopped."): the file by seeking,
12
+ // YouTube by its `start`. Locked: the teaser, the cover under a
13
+ // lock and the lock's word, the length still on it.
14
+ // the head "Lesson 5: Decide what you want", "Lesson 5 of 12 in
15
+ // <course> · 4:50".
16
+ // the door a locked lesson's (Door.astro), and "The notes for this
17
+ // lesson open with the video." in place of the notes.
18
+ // completion for a visitor: Mark complete, a real form posting to the
19
+ // site's progress path, with "Or watch to the end and the
20
+ // Academy marks it for you."; once done, "Completed" and Mark
21
+ // as not done. The lesson's script (Tracker.astro) sends both
22
+ // through fetch and swaps them in place, saves the place on
23
+ // pause and every 15 seconds of play, and marks the lesson at
24
+ // the video's end: the file through the <video> events,
25
+ // YouTube through its player API (loaded only for a visitor on
26
+ // a YouTube lesson). Vimeo's player says nothing back, so a
27
+ // Vimeo lesson is marked by the button alone and the "watch to
28
+ // the end" line is left off. Without the script the forms post
29
+ // and the page comes back.
30
+ // the notes the lesson's body under "Notes".
31
+ // Previous and Next, then the course's rail (Rail.astro).
32
+ // `layout` is the section's: `player` puts the rail at the right on a wide
33
+ // screen; `reading` holds everything to the reading column, the rail last.
34
+ import type { Section } from '@backgold/content'
35
+ import { VISITOR_PROGRESS_PATH } from '#contract/content-api'
36
+ import Crumbs from '../Course/Crumbs.astro'
37
+ import Icon from '../Course/Icon.astro'
38
+ import Door from './Door.astro'
39
+ import Rail from './Rail.astro'
40
+ import Tracker from './Tracker.astro'
41
+ import type { LessonView } from './lesson'
42
+ import { clockOf, lessonTitle } from '../../../lib/academy'
43
+
44
+ interface Props {
45
+ view: LessonView
46
+ section: Section
47
+ layout: 'player' | 'reading'
48
+ /** Drawn as the lesson's own page: its title is the <h1>. */
49
+ lead: boolean
50
+ }
51
+
52
+ const { view, section, layout, lead } = Astro.props
53
+ const Title = lead ? 'h1' : 'h2'
54
+ const sub: 2 | 3 = lead ? 2 : 3
55
+ const Sub = lead ? 'h2' : 'h3'
56
+ const length = clockOf(view.seconds)
57
+ const resume = view.resumeAt !== null ? clockOf(view.resumeAt) : null
58
+ const tracks = view.visitor !== null && !view.locked
59
+ const file = view.video?.kind === 'file' ? view.video : null
60
+ const embed = view.video?.kind === 'embed' ? view.video : null
61
+ const narrow = file?.sources?.['720'] ?? null
62
+ // YouTube: no related videos from elsewhere, the player API for a visitor's progress, the saved place as `start`.
63
+ const embedSrc = !embed
64
+ ? null
65
+ : embed.provider === 'youtube'
66
+ ? `${embed.src}?rel=0${tracks ? `&enablejsapi=1&origin=${encodeURIComponent(Astro.url.origin)}` : ''}${view.resumeAt !== null ? `&start=${Math.floor(view.resumeAt)}` : ''}`
67
+ : `${embed.src}?dnt=1`
68
+ // The player reports the end of the video, so the Academy can mark it: the file's, or YouTube's.
69
+ const marksAtEnd = file !== null || embed?.provider === 'youtube'
70
+ // The body's headings move under the notes' own heading: h2 becomes the level below "Notes".
71
+ const shift = lead ? 1 : 2
72
+ const notes = view.notes?.replace(/<(\/?)h([2-5])>/g, (_, slash: string, level: string) => `<${slash}h${Math.min(Number(level) + shift, 6)}>`) ?? null
73
+ ---
74
+ <div
75
+ class:list={['ls', `ls-${layout}`]}
76
+ data-lesson={tracks ? '' : undefined}
77
+ data-course-slug={tracks ? view.courseSlug : undefined}
78
+ data-lesson-slug={tracks ? view.slug : undefined}
79
+ data-progress={tracks ? VISITOR_PROGRESS_PATH : undefined}
80
+ data-resume={tracks && view.resumeAt !== null ? String(Math.floor(view.resumeAt)) : undefined}
81
+ >
82
+ <Crumbs steps={[{ label: 'Courses', href: view.coursesHref }, { label: view.courseTitle, href: view.courseHref }, { label: `Lesson ${view.n}`, href: null }]} />
83
+ <div class="ls-grid">
84
+ <div class="ls-main">
85
+ {file && (
86
+ <div class="ls-frame">
87
+ <video
88
+ src={file.sources?.['1080'] ?? file.src}
89
+ poster={file.poster ?? undefined}
90
+ data-src-720={narrow ?? undefined}
91
+ data-src-1080={file.sources?.['1080'] ?? undefined}
92
+ data-src-original={file.src}
93
+ controls
94
+ playsinline
95
+ preload="metadata"
96
+ >
97
+ <a href={file.src}>Watch the video</a>
98
+ </video>
99
+ </div>
100
+ )}
101
+ {embed && embedSrc && (
102
+ <div class="ls-frame">
103
+ <iframe
104
+ src={embedSrc}
105
+ title={view.name}
106
+ data-provider={embed.provider}
107
+ allow="encrypted-media; picture-in-picture; fullscreen"
108
+ allowfullscreen
109
+ ></iframe>
110
+ </div>
111
+ )}
112
+ {view.locked && (
113
+ <div class="ls-frame ls-teaser on-photo">
114
+ {view.cover && <img src={view.cover} alt="" decoding="async" />}
115
+ <div class="ls-veil">
116
+ <span class="ls-ring"><Icon name="lock" /></span>
117
+ {view.lockWord && <p>{view.lockWord}</p>}
118
+ </div>
119
+ {length && <span class="chip ls-length">{length}</span>}
120
+ </div>
121
+ )}
122
+ {!view.video && !view.locked && (
123
+ <div class="ls-frame ls-missing"><p>The video for this lesson is not up yet.</p></div>
124
+ )}
125
+ <header class="ls-head">
126
+ <Title class="ls-title">{lessonTitle(view.n, view.name)}</Title>
127
+ <p class="fine">
128
+ Lesson {view.n} of {view.total} in {view.courseHref ? <a href={view.courseHref}>{view.courseTitle}</a> : view.courseTitle}
129
+ {length && <> · {length}</>}
130
+ </p>
131
+ {resume && <p class="ls-resume">Picks up at {resume}, where you stopped.</p>}
132
+ </header>
133
+ {view.door && <Door door={view.door} section={section} level={sub} />}
134
+ {tracks && (
135
+ <div class="ls-complete">
136
+ <form method="post" action={VISITOR_PROGRESS_PATH} data-complete="true" hidden={view.completed}>
137
+ <input type="hidden" name="course" value={view.courseSlug} />
138
+ <input type="hidden" name="lesson" value={view.slug} />
139
+ <input type="hidden" name="completed" value="true" />
140
+ <input type="hidden" name="return" value={view.path} />
141
+ <button class="button" type="submit">Mark complete</button>
142
+ {marksAtEnd && <p class="fine">Or watch to the end and the Academy marks it for you.</p>}
143
+ </form>
144
+ <form method="post" action={VISITOR_PROGRESS_PATH} data-complete="false" hidden={!view.completed}>
145
+ <input type="hidden" name="course" value={view.courseSlug} />
146
+ <input type="hidden" name="lesson" value={view.slug} />
147
+ <input type="hidden" name="completed" value="false" />
148
+ <input type="hidden" name="return" value={view.path} />
149
+ <p class="ls-completed"><Icon name="check" /> Completed</p>
150
+ <button class="button button-quiet button-small" type="submit">Mark as not done</button>
151
+ </form>
152
+ </div>
153
+ )}
154
+ {notes && (
155
+ <section class="ls-notes">
156
+ <Sub class="ls-label">Notes</Sub>
157
+ <div class="prose" set:html={notes} />
158
+ </section>
159
+ )}
160
+ {view.locked && <p class="ls-notes-locked">The notes for this lesson open with the video.</p>}
161
+ {(view.previous || view.next) && (
162
+ <nav class="ls-pn" aria-label="Other lessons in this course">
163
+ {view.previous && view.previous.href && (
164
+ <a class="ls-pn-card" href={view.previous.href} rel="prev">
165
+ <span class="ls-pn-arrow" aria-hidden="true">←</span>
166
+ <span class="ls-pn-text">
167
+ <span class="ls-pn-dir">Previous</span>
168
+ <span class="ls-pn-name">{lessonTitle(view.previous.n, view.previous.name)}</span>
169
+ </span>
170
+ </a>
171
+ )}
172
+ {view.next && view.next.href && (
173
+ <a class="ls-pn-card ls-pn-next" href={view.next.href} rel="next">
174
+ <span class="ls-pn-text">
175
+ <span class="ls-pn-dir">Next</span>
176
+ <span class="ls-pn-name">{lessonTitle(view.next.n, view.next.name)}</span>
177
+ </span>
178
+ <span class="ls-pn-arrow" aria-hidden="true">→</span>
179
+ </a>
180
+ )}
181
+ </nav>
182
+ )}
183
+ </div>
184
+ <Rail view={view} section={section} level={sub} />
185
+ </div>
186
+ {(tracks || narrow) && <Tracker />}
187
+ </div>
188
+
189
+ <style>
190
+ .ls-grid {
191
+ display: grid;
192
+ gap: 2rem;
193
+ }
194
+ .ls-main {
195
+ display: grid;
196
+ gap: 1.25rem;
197
+ align-content: start;
198
+ min-width: 0;
199
+ }
200
+ .ls-main > * {
201
+ margin: 0;
202
+ }
203
+ .ls-frame {
204
+ position: relative;
205
+ aspect-ratio: 16 / 9;
206
+ overflow: hidden;
207
+ border-radius: var(--radius-card);
208
+ background: color-mix(in srgb, var(--ink) 88%, var(--surface));
209
+ }
210
+ .ls-frame video,
211
+ .ls-frame iframe,
212
+ .ls-frame img {
213
+ display: block;
214
+ width: 100%;
215
+ height: 100%;
216
+ border: 0;
217
+ object-fit: cover;
218
+ }
219
+ .ls-frame video,
220
+ .ls-frame iframe {
221
+ object-fit: contain;
222
+ background: #000;
223
+ }
224
+ /* The photo band's pair, the same in both themes: its ink reads at AA on its ground, and on its scrim over the cover. */
225
+ .ls-teaser {
226
+ background: var(--band-photo);
227
+ }
228
+ .ls-teaser img {
229
+ filter: saturate(0.6) brightness(0.55);
230
+ }
231
+ .ls-veil {
232
+ position: absolute;
233
+ inset: 0;
234
+ display: grid;
235
+ place-content: center;
236
+ justify-items: center;
237
+ gap: 0.75rem;
238
+ padding: 1rem;
239
+ background: color-mix(in srgb, var(--band-photo) 60%, transparent);
240
+ color: var(--ink);
241
+ text-align: center;
242
+ }
243
+ .ls-veil p {
244
+ margin: 0;
245
+ font-size: var(--text-lg);
246
+ font-weight: 700;
247
+ }
248
+ .ls-ring {
249
+ display: inline-grid;
250
+ place-items: center;
251
+ width: 3.5rem;
252
+ height: 3.5rem;
253
+ border: 2px solid currentColor;
254
+ border-radius: 50%;
255
+ font-size: 1.5rem;
256
+ }
257
+ .ls-length {
258
+ position: absolute;
259
+ right: 0.75rem;
260
+ bottom: 0.75rem;
261
+ background: #fff;
262
+ color: #16191f;
263
+ }
264
+ .ls-missing {
265
+ display: grid;
266
+ place-items: center;
267
+ background: var(--surface);
268
+ border: 1px dashed var(--line-strong);
269
+ }
270
+ .ls-missing p {
271
+ margin: 0;
272
+ padding: 1rem;
273
+ color: var(--muted);
274
+ text-align: center;
275
+ }
276
+ .ls-head {
277
+ display: grid;
278
+ gap: 0.375rem;
279
+ }
280
+ .ls-head > * {
281
+ margin: 0;
282
+ }
283
+ .ls-head .ls-title {
284
+ font-size: calc(var(--h2) * 0.85);
285
+ line-height: 1.12;
286
+ }
287
+ .ls-resume {
288
+ color: var(--muted);
289
+ font-size: var(--text-sm);
290
+ }
291
+ .ls-complete form {
292
+ display: flex;
293
+ flex-wrap: wrap;
294
+ align-items: center;
295
+ gap: 0.75rem 1.25rem;
296
+ }
297
+ .ls-complete form[hidden] {
298
+ display: none;
299
+ }
300
+ .ls-complete p {
301
+ margin: 0;
302
+ }
303
+ .ls-complete .button:focus-visible {
304
+ outline: 3px solid var(--link);
305
+ outline-offset: 3px;
306
+ }
307
+ .ls-completed {
308
+ display: inline-flex;
309
+ align-items: center;
310
+ gap: 0.5rem;
311
+ font-weight: 700;
312
+ }
313
+ .ls-label {
314
+ margin: 0 0 0.625rem;
315
+ color: var(--muted);
316
+ font-family: var(--font);
317
+ font-size: var(--text-xs);
318
+ font-weight: 700;
319
+ letter-spacing: 0.14em;
320
+ line-height: 1.4;
321
+ text-transform: uppercase;
322
+ }
323
+ .ls-notes .prose > :global(:first-child) {
324
+ margin-top: 0;
325
+ }
326
+ .ls-notes .prose > :global(:last-child) {
327
+ margin-bottom: 0;
328
+ }
329
+ .ls-notes .prose :global(:is(h3, h4, h5, h6)) {
330
+ margin: 1.5rem 0 0.5rem;
331
+ font-family: var(--font-display);
332
+ font-size: var(--text-lg);
333
+ font-weight: 700;
334
+ line-height: 1.25;
335
+ }
336
+ .ls-notes-locked {
337
+ color: var(--muted);
338
+ font-style: italic;
339
+ }
340
+ .ls-pn {
341
+ display: grid;
342
+ gap: 0.75rem;
343
+ }
344
+ .ls-pn-card {
345
+ display: flex;
346
+ align-items: center;
347
+ gap: 0.875rem;
348
+ padding: 0.875rem 1.125rem;
349
+ border: 1.5px solid var(--line-strong);
350
+ border-radius: var(--radius);
351
+ color: var(--ink);
352
+ text-decoration: none;
353
+ }
354
+ .ls-pn-card:hover {
355
+ border-color: var(--ink);
356
+ }
357
+ .ls-pn-card:hover .ls-pn-name {
358
+ text-decoration: underline;
359
+ }
360
+ .ls-pn-card:focus-visible {
361
+ outline: 3px solid var(--link);
362
+ outline-offset: 3px;
363
+ }
364
+ .ls-pn-text {
365
+ display: grid;
366
+ flex: 1;
367
+ gap: 0.25rem;
368
+ min-width: 0;
369
+ }
370
+ .ls-pn-arrow {
371
+ flex-shrink: 0;
372
+ color: var(--muted);
373
+ font-size: var(--text-lg);
374
+ font-weight: 700;
375
+ line-height: 1;
376
+ }
377
+ .ls-pn-card:hover .ls-pn-arrow {
378
+ color: var(--ink);
379
+ }
380
+ .ls-pn-dir {
381
+ color: var(--muted);
382
+ font-size: var(--text-xs);
383
+ font-weight: 700;
384
+ letter-spacing: 0.12em;
385
+ text-transform: uppercase;
386
+ }
387
+ .ls-pn-name {
388
+ font-weight: 700;
389
+ line-height: 1.35;
390
+ }
391
+ .ls-pn-next {
392
+ text-align: right;
393
+ }
394
+ @media (min-width: 40rem) {
395
+ .ls-pn {
396
+ grid-template-columns: repeat(2, minmax(0, 1fr));
397
+ }
398
+ .ls-pn-next:only-child {
399
+ grid-column: 2;
400
+ }
401
+ }
402
+ @media (min-width: 56rem) {
403
+ .ls-player .ls-grid {
404
+ grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
405
+ gap: 2.5rem;
406
+ align-items: start;
407
+ }
408
+ .ls-player :global(.ls-rail) {
409
+ position: sticky;
410
+ top: 1.5rem;
411
+ }
412
+ }
413
+ .ls-reading .ls-grid {
414
+ max-width: calc(var(--measure) + 4rem);
415
+ }
416
+ </style>
@@ -0,0 +1,182 @@
1
+ ---
2
+ // The course's lessons beside a lesson (board D3's rail): the kicker
3
+ // "Course" over the course's title, then for a visitor the course's bar with
4
+ // "4 of 12" and "38 min left", signed out "12 lessons · 1 h 1 min" and
5
+ // "Lesson 1 is free". Each row is the lesson's mark (number, check or lock),
6
+ // its title (a link, but for this lesson's) and its word (Done, Now,
7
+ // Members, Free, Sign in) or its length. On a phone (and up to 56rem) only
8
+ // the lessons either side of this one show, with "All 12 lessons" to the
9
+ // course under them, as on every width.
10
+ import Bar from '../Course/Bar.astro'
11
+ import Icon from '../Course/Icon.astro'
12
+ import type { LessonView } from './lesson'
13
+ import { clockOf, leftOf, lessonsOf } from '../../../lib/academy'
14
+ import { idFor } from '../SampleBallot/ballot'
15
+ import type { Section } from '@backgold/content'
16
+
17
+ interface Props {
18
+ view: LessonView
19
+ section: Section
20
+ level: 2 | 3
21
+ }
22
+
23
+ const { view, section, level } = Astro.props
24
+ const Title = level === 2 ? 'h2' : 'h3'
25
+ const id = idFor(section, 'lesson-rail')
26
+ const { rail } = view
27
+ const left = rail.progress ? leftOf(rail.progress) : null
28
+ ---
29
+ <aside class="ls-rail" aria-labelledby={id}>
30
+ <p class="kicker">Course</p>
31
+ <Title id={id} class="ls-rail-title">{view.courseHref ? <a href={view.courseHref}>{view.courseTitle}</a> : view.courseTitle}</Title>
32
+ {rail.progress ? (
33
+ <div class="ls-rail-progress">
34
+ <Bar completed={rail.progress.completed} total={rail.progress.total} label={`${view.courseTitle}: ${rail.progress.completed} of ${rail.progress.total} lessons`} />
35
+ <p class="ls-rail-figures">
36
+ <strong>{rail.progress.completed} of {rail.progress.total}</strong>
37
+ {left && <span>{left}</span>}
38
+ </p>
39
+ </div>
40
+ ) : (
41
+ <p class="ls-rail-figures ls-rail-out">
42
+ <span>{rail.count}</span>
43
+ {rail.free && <span>{rail.free}</span>}
44
+ </p>
45
+ )}
46
+ <ol class="ls-rail-rows" role="list">
47
+ {rail.rows.map((row) => (
48
+ <li class:list={['ls-rail-row', row.now && 'ls-rail-now', row.done && 'ls-rail-done', row.locked && 'ls-rail-locked', Math.abs(row.n - view.n) > 2 && 'ls-rail-far']}>
49
+ <span class="ls-rail-mark" aria-hidden="true">{row.done ? <Icon name="check" /> : row.locked ? <Icon name="lock" /> : row.n}</span>
50
+ <span class="ls-rail-name">
51
+ {row.now || !row.href ? <span aria-current={row.now ? 'page' : undefined}>{row.name}</span> : <a href={row.href}>{row.name}</a>}
52
+ </span>
53
+ <span class="ls-rail-word">{row.word ?? clockOf(row.seconds)}</span>
54
+ </li>
55
+ ))}
56
+ </ol>
57
+ {view.courseHref && <a class="text-link ls-rail-all" href={view.courseHref}>All {lessonsOf(view.total)}</a>}
58
+ </aside>
59
+
60
+ <style>
61
+ .ls-rail {
62
+ display: grid;
63
+ gap: 0.75rem;
64
+ align-content: start;
65
+ min-width: 0;
66
+ padding: 1.25rem;
67
+ border: 1px solid var(--line);
68
+ border-radius: var(--radius-card);
69
+ background: var(--surface);
70
+ }
71
+ .ls-rail > * {
72
+ margin: 0;
73
+ }
74
+ .ls-rail .kicker {
75
+ margin-bottom: -0.25rem;
76
+ }
77
+ .ls-rail .ls-rail-title {
78
+ font-family: var(--font);
79
+ font-size: var(--text-lg);
80
+ font-weight: 700;
81
+ letter-spacing: 0;
82
+ line-height: 1.3;
83
+ }
84
+ .ls-rail-title a {
85
+ color: var(--ink);
86
+ }
87
+ .ls-rail-progress {
88
+ display: grid;
89
+ gap: 0.5rem;
90
+ }
91
+ .ls-rail-progress > * {
92
+ margin: 0;
93
+ }
94
+ .ls-rail-figures {
95
+ display: flex;
96
+ flex-wrap: wrap;
97
+ justify-content: space-between;
98
+ gap: 0.25rem 1rem;
99
+ color: var(--muted);
100
+ font-size: var(--text-sm);
101
+ font-variant-numeric: tabular-nums;
102
+ }
103
+ .ls-rail-figures strong {
104
+ color: var(--ink);
105
+ }
106
+ .ls-rail-out {
107
+ flex-direction: column;
108
+ }
109
+ .ls-rail-rows {
110
+ display: grid;
111
+ gap: 0.125rem;
112
+ margin: 0;
113
+ padding: 0;
114
+ list-style: none;
115
+ }
116
+ .ls-rail-row {
117
+ display: grid;
118
+ grid-template-columns: 1.75rem minmax(0, 1fr) auto;
119
+ gap: 0.625rem;
120
+ align-items: center;
121
+ min-height: 2.75rem;
122
+ padding: 0.375rem 0.5rem;
123
+ border-radius: var(--radius);
124
+ font-size: var(--text-sm);
125
+ line-height: 1.35;
126
+ }
127
+ .ls-rail-now {
128
+ background: color-mix(in srgb, var(--accent) 14%, transparent);
129
+ font-weight: 700;
130
+ }
131
+ .ls-rail-mark {
132
+ display: inline-grid;
133
+ place-items: center;
134
+ width: 1.75rem;
135
+ height: 1.75rem;
136
+ border: 1.5px solid var(--line-strong);
137
+ border-radius: 50%;
138
+ color: var(--muted);
139
+ font-size: var(--text-xs);
140
+ font-weight: 700;
141
+ font-variant-numeric: tabular-nums;
142
+ }
143
+ .ls-rail-done .ls-rail-mark {
144
+ border-color: var(--button);
145
+ background: var(--button);
146
+ color: var(--button-ink);
147
+ }
148
+ .ls-rail-now .ls-rail-mark {
149
+ border-color: var(--accent);
150
+ color: var(--ink);
151
+ }
152
+ .ls-rail-name {
153
+ min-width: 0;
154
+ }
155
+ .ls-rail-name a {
156
+ color: var(--ink);
157
+ text-decoration: none;
158
+ }
159
+ .ls-rail-name a:hover {
160
+ text-decoration: underline;
161
+ }
162
+ .ls-rail-name a:focus-visible {
163
+ outline: 3px solid var(--link);
164
+ outline-offset: 2px;
165
+ }
166
+ .ls-rail-word {
167
+ color: var(--muted);
168
+ font-size: var(--text-xs);
169
+ font-weight: 600;
170
+ font-variant-numeric: tabular-nums;
171
+ white-space: nowrap;
172
+ }
173
+ .ls-rail-now .ls-rail-word,
174
+ .ls-rail-done .ls-rail-word {
175
+ color: var(--ink);
176
+ }
177
+ @media (max-width: 55.99rem) {
178
+ .ls-rail-far {
179
+ display: none;
180
+ }
181
+ }
182
+ </style>