bookish-press 0.4.46 → 0.4.47

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 (533) hide show
  1. package/.env.example +8 -0
  2. package/.firebaserc +8 -0
  3. package/.prettierignore +8 -0
  4. package/.prettierrc.json +5 -0
  5. package/_update-notifier-last-checked +0 -0
  6. package/firebase.json +46 -0
  7. package/firestore.indexes.json +4 -0
  8. package/firestore.rules +59 -0
  9. package/functions/.eslintrc.js +28 -0
  10. package/functions/package-lock.json +12595 -0
  11. package/functions/package.json +43 -0
  12. package/functions/src/index.ts +345 -0
  13. package/functions/tsconfig.dev.json +3 -0
  14. package/functions/tsconfig.json +15 -0
  15. package/package.json +53 -270
  16. package/scripts/claims.cjs +99 -0
  17. package/src/app.d.ts +9 -0
  18. package/src/app.html +24 -0
  19. package/src/lib/components/Auth.svelte +65 -0
  20. package/{components/Authentication.d.ts → src/lib/components/Authentication.ts} +2 -0
  21. package/{components → src/lib/components}/BookPreview.svelte +27 -22
  22. package/{components → src/lib/components}/External.svelte +2 -1
  23. package/src/lib/components/Link.svelte +58 -0
  24. package/{components → src/lib/components}/app/BookList.svelte +6 -3
  25. package/{components → src/lib/components}/app/Button.svelte +5 -4
  26. package/{components → src/lib/components}/app/Feedback.svelte +11 -7
  27. package/{components → src/lib/components}/app/Head.svelte +2 -1
  28. package/{components → src/lib/components}/app/Large.svelte +0 -0
  29. package/{components → src/lib/components}/app/Lead.svelte +0 -0
  30. package/{components → src/lib/components}/app/Link.svelte +4 -3
  31. package/{components → src/lib/components}/app/Options.svelte +5 -4
  32. package/{components → src/lib/components}/app/Paragraph.svelte +2 -1
  33. package/{components → src/lib/components}/app/Section.svelte +0 -0
  34. package/{components → src/lib/components}/app/Table.svelte +0 -0
  35. package/{components → src/lib/components}/app/TextInput.svelte +12 -9
  36. package/{components → src/lib/components}/chapter/Atom.svelte +18 -12
  37. package/src/lib/components/chapter/Block.svelte +42 -0
  38. package/{components → src/lib/components}/chapter/Callout.svelte +6 -3
  39. package/{components → src/lib/components}/chapter/CaptionedCode.svelte +21 -13
  40. package/{components → src/lib/components}/chapter/ChapterBody.svelte +13 -9
  41. package/{components → src/lib/components}/chapter/Citations.svelte +34 -33
  42. package/{components → src/lib/components}/chapter/Code.svelte +63 -59
  43. package/{components → src/lib/components}/chapter/Comment.svelte +30 -18
  44. package/{components → src/lib/components}/chapter/Definition.svelte +23 -17
  45. package/{components → src/lib/components}/chapter/Embed.svelte +97 -77
  46. package/src/lib/components/chapter/ErrorMessage.svelte +12 -0
  47. package/{components → src/lib/components}/chapter/ExtendedPrism.js +0 -0
  48. package/{components → src/lib/components}/chapter/Figure.svelte +34 -26
  49. package/{components → src/lib/components}/chapter/Footnote.svelte +32 -20
  50. package/{components → src/lib/components}/chapter/Format.svelte +39 -34
  51. package/{components → src/lib/components}/chapter/InlineCode.svelte +9 -5
  52. package/{components → src/lib/components}/chapter/Label.svelte +23 -14
  53. package/{components → src/lib/components}/chapter/Link.svelte +27 -21
  54. package/{components → src/lib/components}/chapter/List.svelte +5 -3
  55. package/{components → src/lib/components}/chapter/Marginal.svelte +54 -41
  56. package/{components → src/lib/components}/chapter/Paragraph.svelte +25 -20
  57. package/{components → src/lib/components}/chapter/Positioned.svelte +4 -1
  58. package/{components → src/lib/components}/chapter/Problem.svelte +0 -0
  59. package/src/lib/components/chapter/Python.svelte +144 -0
  60. package/{components → src/lib/components}/chapter/Quote.svelte +9 -5
  61. package/{components → src/lib/components}/chapter/Rule.svelte +4 -1
  62. package/{components → src/lib/components}/chapter/Table.svelte +11 -7
  63. package/src/lib/components/chapter/Text.svelte +109 -0
  64. package/src/lib/components/editor/BookishEditor.svelte +1101 -0
  65. package/src/lib/components/editor/CalloutEditor.svelte +14 -0
  66. package/{components → src/lib/components}/editor/CaptionedCodeEditor.svelte +10 -6
  67. package/src/lib/components/editor/CaretContext.ts +55 -0
  68. package/{components/editor/CaretState.d.ts → src/lib/components/editor/CaretState.ts} +6 -7
  69. package/{components/editor/CaretUtilities.d.ts → src/lib/components/editor/CaretUtilities.ts} +1 -0
  70. package/{components → src/lib/components}/editor/CaretView.svelte +25 -20
  71. package/src/lib/components/editor/CitationsEditor.svelte +64 -0
  72. package/{components/editor/Clipboard.d.ts → src/lib/components/editor/Clipboard.ts} +2 -1
  73. package/{components/editor/Command.d.ts → src/lib/components/editor/Command.ts} +8 -2
  74. package/{components/editor/Commands.js → src/lib/components/editor/Commands.ts} +730 -315
  75. package/src/lib/components/editor/ConfirmButton.svelte +51 -0
  76. package/src/lib/components/editor/DefinitionEditor.svelte +44 -0
  77. package/src/lib/components/editor/EmbedEditor.svelte +152 -0
  78. package/{components → src/lib/components}/editor/Icon.svelte +2 -1
  79. package/{components → src/lib/components}/editor/ImageChooser.svelte +24 -19
  80. package/src/lib/components/editor/InlineCodeEditor.svelte +16 -0
  81. package/{components → src/lib/components}/editor/LabelEditor.svelte +14 -9
  82. package/{components → src/lib/components}/editor/LanguageEditor.svelte +8 -5
  83. package/src/lib/components/editor/LinkEditor.svelte +110 -0
  84. package/{components → src/lib/components}/editor/Note.svelte +0 -0
  85. package/{components → src/lib/components}/editor/Permissions.svelte +43 -36
  86. package/src/lib/components/editor/PositionEditor.svelte +21 -0
  87. package/src/lib/components/editor/QuoteEditor.svelte +14 -0
  88. package/{components → src/lib/components}/editor/Switch.svelte +14 -11
  89. package/src/lib/components/editor/TableEditor.svelte +14 -0
  90. package/{components → src/lib/components}/editor/TextEditor.svelte +101 -89
  91. package/src/lib/components/editor/Toggle.svelte +47 -0
  92. package/src/lib/components/editor/Toolbar.svelte +297 -0
  93. package/{components → src/lib/components}/editor/ToolbarGroup.svelte +5 -3
  94. package/{components → src/lib/components}/editor/ToolbarSpacer.svelte +0 -0
  95. package/src/lib/components/editor/URLEditor.svelte +15 -0
  96. package/{components/editor/UndoState.d.ts → src/lib/components/editor/UndoState.ts} +3 -2
  97. package/{components → src/lib/components}/editor/icons/annotate.svg +0 -0
  98. package/{components → src/lib/components}/editor/icons/block.svg +0 -0
  99. package/{components → src/lib/components}/editor/icons/bold.svg +0 -0
  100. package/{components → src/lib/components}/editor/icons/bullets.svg +0 -0
  101. package/{components → src/lib/components}/editor/icons/callout.svg +0 -0
  102. package/{components → src/lib/components}/editor/icons/citation.svg +0 -0
  103. package/{components → src/lib/components}/editor/icons/clear.svg +0 -0
  104. package/{components → src/lib/components}/editor/icons/clipboard.svg +0 -0
  105. package/{components → src/lib/components}/editor/icons/code.svg +0 -0
  106. package/{components → src/lib/components}/editor/icons/columnafter.svg +0 -0
  107. package/{components → src/lib/components}/editor/icons/columnbefore.svg +0 -0
  108. package/{components → src/lib/components}/editor/icons/comment.svg +0 -0
  109. package/{components → src/lib/components}/editor/icons/copy.svg +0 -0
  110. package/{components → src/lib/components}/editor/icons/cut.svg +0 -0
  111. package/{components → src/lib/components}/editor/icons/define.svg +0 -0
  112. package/{components → src/lib/components}/editor/icons/deletecolumn.svg +0 -0
  113. package/{components → src/lib/components}/editor/icons/deleterow.svg +0 -0
  114. package/{components → src/lib/components}/editor/icons/footnote.svg +0 -0
  115. package/{components → src/lib/components}/editor/icons/header1.svg +0 -0
  116. package/{components → src/lib/components}/editor/icons/header2.svg +0 -0
  117. package/{components → src/lib/components}/editor/icons/header3.svg +0 -0
  118. package/{components → src/lib/components}/editor/icons/home.svg +0 -0
  119. package/{components → src/lib/components}/editor/icons/indent.svg +0 -0
  120. package/{components → src/lib/components}/editor/icons/italic.svg +0 -0
  121. package/{components → src/lib/components}/editor/icons/label.svg +0 -0
  122. package/{components → src/lib/components}/editor/icons/left.svg +0 -0
  123. package/{components → src/lib/components}/editor/icons/level.svg +0 -0
  124. package/{components → src/lib/components}/editor/icons/link.svg +0 -0
  125. package/{components → src/lib/components}/editor/icons/list.svg +0 -0
  126. package/{components → src/lib/components}/editor/icons/media.svg +0 -0
  127. package/{components → src/lib/components}/editor/icons/middle.svg +0 -0
  128. package/{components → src/lib/components}/editor/icons/numbers.svg +0 -0
  129. package/{components → src/lib/components}/editor/icons/paragraph.svg +0 -0
  130. package/{components → src/lib/components}/editor/icons/paste.svg +0 -0
  131. package/{components → src/lib/components}/editor/icons/quote.svg +0 -0
  132. package/{components → src/lib/components}/editor/icons/redo.svg +0 -0
  133. package/{components → src/lib/components}/editor/icons/right.svg +0 -0
  134. package/{components → src/lib/components}/editor/icons/rowabove.svg +0 -0
  135. package/{components → src/lib/components}/editor/icons/rowbelow.svg +0 -0
  136. package/{components → src/lib/components}/editor/icons/rule.svg +0 -0
  137. package/{components → src/lib/components}/editor/icons/sub.svg +0 -0
  138. package/{components → src/lib/components}/editor/icons/super.svg +0 -0
  139. package/{components → src/lib/components}/editor/icons/table.svg +0 -0
  140. package/{components → src/lib/components}/editor/icons/text.svg +0 -0
  141. package/{components → src/lib/components}/editor/icons/time.svg +0 -0
  142. package/{components → src/lib/components}/editor/icons/undo.svg +0 -0
  143. package/{components → src/lib/components}/editor/icons/unindent.svg +0 -0
  144. package/{components → src/lib/components}/editor/icons/unlink.svg +0 -0
  145. package/{components → src/lib/components}/page/Acknowledgements.svelte +19 -10
  146. package/src/lib/components/page/Authors.svelte +92 -0
  147. package/src/lib/components/page/BookLoader.svelte +77 -0
  148. package/src/lib/components/page/BulkReferenceEditor.svelte +86 -0
  149. package/src/lib/components/page/Chapter.svelte +449 -0
  150. package/src/lib/components/page/ChapterContext.ts +13 -0
  151. package/{components → src/lib/components}/page/ChapterNumber.svelte +0 -0
  152. package/{components → src/lib/components}/page/ChapterTitle.svelte +4 -2
  153. package/src/lib/components/page/Contexts.ts +176 -0
  154. package/{components → src/lib/components}/page/DefinitionView.svelte +52 -37
  155. package/{components → src/lib/components}/page/Description.svelte +15 -7
  156. package/src/lib/components/page/Edition.svelte +189 -0
  157. package/src/lib/components/page/EditionLoader.svelte +123 -0
  158. package/{components → src/lib/components}/page/Editions.svelte +22 -18
  159. package/{components → src/lib/components}/page/Glossary.svelte +33 -28
  160. package/{components → src/lib/components}/page/Header.svelte +59 -52
  161. package/{components → src/lib/components}/page/Index.svelte +48 -41
  162. package/{components → src/lib/components}/page/Instructions.svelte +2 -1
  163. package/{components → src/lib/components}/page/License.svelte +17 -9
  164. package/{components → src/lib/components}/page/Loading.svelte +0 -0
  165. package/{components → src/lib/components}/page/Media.svelte +44 -27
  166. package/{components → src/lib/components}/page/MediaPreview.svelte +3 -2
  167. package/{components → src/lib/components}/page/Muted.svelte +0 -0
  168. package/{components → src/lib/components}/page/Outline.svelte +140 -110
  169. package/src/lib/components/page/Page.svelte +94 -0
  170. package/{components → src/lib/components}/page/PageHeader.svelte +2 -1
  171. package/{components → src/lib/components}/page/PageParagraph.svelte +0 -0
  172. package/src/lib/components/page/PossibleChapter.svelte +16 -0
  173. package/src/lib/components/page/PossibleReference.svelte +14 -0
  174. package/{components → src/lib/components}/page/Print.svelte +5 -3
  175. package/{components → src/lib/components}/page/Publish.svelte +59 -52
  176. package/{components → src/lib/components}/page/Reference.svelte +39 -30
  177. package/{components → src/lib/components}/page/References.svelte +18 -14
  178. package/{components → src/lib/components}/page/Rows.svelte +0 -0
  179. package/src/lib/components/page/Search.svelte +153 -0
  180. package/{components → src/lib/components}/page/Status.svelte +5 -3
  181. package/{components → src/lib/components}/page/SubdomainEditor.svelte +16 -13
  182. package/{components → src/lib/components}/page/TableOfContents.svelte +79 -68
  183. package/src/lib/components/page/TableOfContentsImage.svelte +22 -0
  184. package/{components → src/lib/components}/page/TableOfContentsRow.svelte +34 -24
  185. package/{components → src/lib/components}/page/ThemeEditor.svelte +44 -33
  186. package/{components → src/lib/components}/page/ThemeEditorPreview.svelte +21 -12
  187. package/src/lib/components/page/ThemeSetEditor.svelte +21 -0
  188. package/{components → src/lib/components}/page/ThemeVariableEditor.svelte +18 -14
  189. package/{components → src/lib/components}/page/Title.svelte +0 -0
  190. package/{components → src/lib/components}/page/Unknown.svelte +10 -8
  191. package/{components/page/margins.js → src/lib/components/page/margins.ts} +79 -46
  192. package/{index.js → src/lib/index.js} +0 -0
  193. package/src/lib/models/CRUD.ts +469 -0
  194. package/{models/Firebase.js → src/lib/models/Firebase.ts} +26 -16
  195. package/src/lib/models/book/Book.ts +283 -0
  196. package/src/lib/models/book/BookMedia.ts +182 -0
  197. package/src/lib/models/book/BookSaveStatus.ts +8 -0
  198. package/src/lib/models/book/Chapter.ts +462 -0
  199. package/{models/book/ChapterID.js → src/lib/models/book/ChapterID.ts} +1 -0
  200. package/src/lib/models/book/Definition.ts +2 -0
  201. package/src/lib/models/book/Edition.ts +1216 -0
  202. package/src/lib/models/book/Reference.ts +171 -0
  203. package/{models/book/Schema.js → src/lib/models/book/Schema.ts} +1 -0
  204. package/{models/book/Theme.js → src/lib/models/book/Theme.ts} +110 -6
  205. package/{models/book/ThemeColors.d.ts → src/lib/models/book/ThemeColors.ts} +6 -0
  206. package/{models/book/Words.js → src/lib/models/book/Words.ts} +1 -0
  207. package/{models/chapter/AtomNode.js → src/lib/models/chapter/AtomNode.ts} +30 -10
  208. package/{models/chapter/BlockNode.js → src/lib/models/chapter/BlockNode.ts} +80 -47
  209. package/src/lib/models/chapter/BlocksNode.test.ts +867 -0
  210. package/{models/chapter/BlocksNode.js → src/lib/models/chapter/BlocksNode.ts} +571 -359
  211. package/{models/chapter/Bookkeeping.d.ts → src/lib/models/chapter/Bookkeeping.ts} +0 -0
  212. package/src/lib/models/chapter/CalloutNode.ts +79 -0
  213. package/{models/chapter/Caret.js → src/lib/models/chapter/Caret.ts} +50 -26
  214. package/src/lib/models/chapter/ChapterNode.ts +169 -0
  215. package/{models/chapter/CitationsNode.js → src/lib/models/chapter/CitationsNode.ts} +17 -10
  216. package/{models/chapter/CodeNode.js → src/lib/models/chapter/CodeNode.ts} +125 -62
  217. package/src/lib/models/chapter/CommentNode.ts +61 -0
  218. package/{models/chapter/DefinitionNode.js → src/lib/models/chapter/DefinitionNode.ts} +14 -8
  219. package/src/lib/models/chapter/Edit.ts +6 -0
  220. package/src/lib/models/chapter/EmbedNode.ts +257 -0
  221. package/{models/chapter/ErrorNode.js → src/lib/models/chapter/ErrorNode.ts} +15 -8
  222. package/src/lib/models/chapter/FootnoteNode.ts +59 -0
  223. package/src/lib/models/chapter/FormatNode.test.ts +137 -0
  224. package/{models/chapter/FormatNode.js → src/lib/models/chapter/FormatNode.ts} +443 -262
  225. package/{models/chapter/InlineCodeNode.js → src/lib/models/chapter/InlineCodeNode.ts} +17 -9
  226. package/{models/chapter/LabelNode.js → src/lib/models/chapter/LabelNode.ts} +26 -10
  227. package/{models/chapter/LinkNode.js → src/lib/models/chapter/LinkNode.ts} +12 -7
  228. package/{models/chapter/ListNode.test.js → src/lib/models/chapter/ListNode.test.ts} +57 -20
  229. package/{models/chapter/ListNode.js → src/lib/models/chapter/ListNode.ts} +277 -200
  230. package/src/lib/models/chapter/MetadataNode.ts +44 -0
  231. package/{models → src/lib/models}/chapter/Node.test.js +0 -0
  232. package/{models/chapter/Node.js → src/lib/models/chapter/Node.ts} +155 -71
  233. package/src/lib/models/chapter/ParagraphNode.test.ts +54 -0
  234. package/{models/chapter/ParagraphNode.js → src/lib/models/chapter/ParagraphNode.ts} +95 -58
  235. package/{models/chapter/Parser.test.js → src/lib/models/chapter/Parser.test.ts} +7 -0
  236. package/{models/chapter/Parser.js → src/lib/models/chapter/Parser.ts} +369 -184
  237. package/{models/chapter/Position.d.ts → src/lib/models/chapter/Position.ts} +0 -0
  238. package/src/lib/models/chapter/QuoteNode.ts +135 -0
  239. package/{models/chapter/RootNode.d.ts → src/lib/models/chapter/RootNode.ts} +2 -0
  240. package/{models/chapter/RuleNode.js → src/lib/models/chapter/RuleNode.ts} +9 -6
  241. package/{models/chapter/TableNode.test.js → src/lib/models/chapter/TableNode.test.ts} +27 -10
  242. package/{models/chapter/TableNode.js → src/lib/models/chapter/TableNode.ts} +141 -82
  243. package/{models/chapter/TextNode.test.js → src/lib/models/chapter/TextNode.test.ts} +2 -0
  244. package/{models/chapter/TextNode.js → src/lib/models/chapter/TextNode.ts} +117 -65
  245. package/{util/getSubdomain.js → src/lib/util/getSubdomain.ts} +14 -8
  246. package/{util/isMobile.js → src/lib/util/isMobile.ts} +1 -0
  247. package/{util/mineReference.js → src/lib/util/mineReference.ts} +45 -25
  248. package/{util/scrollToEyeLevel.js → src/lib/util/scrollToEyeLevel.ts} +4 -2
  249. package/src/params/edition.ts +3 -0
  250. package/src/routes/+error.svelte +12 -0
  251. package/src/routes/+layout.svelte +241 -0
  252. package/src/routes/+page.svelte +43 -0
  253. package/src/routes/Footer.svelte +0 -0
  254. package/src/routes/Header.svelte +112 -0
  255. package/src/routes/[bookid]/+layout.svelte +5 -0
  256. package/src/routes/[bookid]/[[editionid=edition]]/+error.svelte +14 -0
  257. package/src/routes/[bookid]/[[editionid=edition]]/+layout.svelte +7 -0
  258. package/src/routes/[bookid]/[[editionid=edition]]/+page.svelte +5 -0
  259. package/src/routes/[bookid]/[[editionid=edition]]/[chapterid]/+page.svelte +5 -0
  260. package/src/routes/[bookid]/[[editionid=edition]]/glossary/+page.svelte +5 -0
  261. package/src/routes/[bookid]/[[editionid=edition]]/index/[[letter]]/+page.svelte +5 -0
  262. package/src/routes/[bookid]/[[editionid=edition]]/media/+page.svelte +5 -0
  263. package/src/routes/[bookid]/[[editionid=edition]]/print/+page.svelte +5 -0
  264. package/src/routes/[bookid]/[[editionid=edition]]/references/+page.svelte +5 -0
  265. package/src/routes/[bookid]/[[editionid=edition]]/search/+page.svelte +5 -0
  266. package/src/routes/[bookid]/editions/+page.svelte +20 -0
  267. package/src/routes/about/+page.svelte +102 -0
  268. package/src/routes/confirm/+page.svelte +62 -0
  269. package/src/routes/email/+page.svelte +99 -0
  270. package/src/routes/login/+page.svelte +66 -0
  271. package/src/routes/read/+page.svelte +38 -0
  272. package/src/routes/write/+error.svelte +10 -0
  273. package/src/routes/write/+layout.svelte +11 -0
  274. package/src/routes/write/+page.svelte +114 -0
  275. package/src/routes/write/[bookid]/+layout.svelte +5 -0
  276. package/src/routes/write/[bookid]/[[editionid=edition]]/+layout.svelte +7 -0
  277. package/src/routes/write/[bookid]/[[editionid=edition]]/+page.svelte +5 -0
  278. package/src/routes/write/[bookid]/[[editionid=edition]]/[chapterid]/+page.svelte +5 -0
  279. package/src/routes/write/[bookid]/[[editionid=edition]]/glossary/+page.svelte +5 -0
  280. package/src/routes/write/[bookid]/[[editionid=edition]]/index/[[letter]]/+page.svelte +5 -0
  281. package/src/routes/write/[bookid]/[[editionid=edition]]/media/+page.svelte +5 -0
  282. package/src/routes/write/[bookid]/[[editionid=edition]]/print/+page.svelte +5 -0
  283. package/src/routes/write/[bookid]/[[editionid=edition]]/references/+page.svelte +5 -0
  284. package/src/routes/write/[bookid]/[[editionid=edition]]/search/+page.svelte +5 -0
  285. package/src/routes/write/[bookid]/[[editionid=edition]]/theme/+page.svelte +5 -0
  286. package/src/routes/write/[bookid]/[[editionid=edition]]/unknown/+page.svelte +5 -0
  287. package/src/routes/write/[bookid]/editions/+page.svelte +20 -0
  288. package/src/vite-env.d.ts +1 -0
  289. package/static/icons/favicon.png +0 -0
  290. package/static/icons/icon.png +0 -0
  291. package/static/icons/ios-icon.png +0 -0
  292. package/storage.rules +9 -0
  293. package/svelte.config.js +19 -0
  294. package/tsconfig.json +18 -0
  295. package/tsconfig.node.json +9 -0
  296. package/vite.config.ts +8 -0
  297. package/vite.reader.config.ts +32 -0
  298. package/components/Auth.svelte +0 -55
  299. package/components/Auth.svelte.d.ts +0 -16
  300. package/components/Authentication.js +0 -1
  301. package/components/BookPreview.svelte.d.ts +0 -18
  302. package/components/External.svelte.d.ts +0 -18
  303. package/components/Link.svelte +0 -51
  304. package/components/Link.svelte.d.ts +0 -18
  305. package/components/app/BookList.svelte.d.ts +0 -18
  306. package/components/app/Button.svelte.d.ts +0 -22
  307. package/components/app/Feedback.svelte.d.ts +0 -18
  308. package/components/app/Head.svelte.d.ts +0 -18
  309. package/components/app/Large.svelte.d.ts +0 -27
  310. package/components/app/Lead.svelte.d.ts +0 -27
  311. package/components/app/Link.svelte.d.ts +0 -20
  312. package/components/app/Options.svelte.d.ts +0 -19
  313. package/components/app/Paragraph.svelte.d.ts +0 -18
  314. package/components/app/Section.svelte.d.ts +0 -27
  315. package/components/app/Table.svelte.d.ts +0 -27
  316. package/components/app/TextInput.svelte.d.ts +0 -22
  317. package/components/chapter/Atom.svelte.d.ts +0 -19
  318. package/components/chapter/Block.svelte +0 -37
  319. package/components/chapter/Block.svelte.d.ts +0 -17
  320. package/components/chapter/Callout.svelte.d.ts +0 -17
  321. package/components/chapter/CaptionedCode.svelte.d.ts +0 -17
  322. package/components/chapter/ChapterBody.svelte.d.ts +0 -19
  323. package/components/chapter/Citations.svelte.d.ts +0 -17
  324. package/components/chapter/Code.svelte.d.ts +0 -22
  325. package/components/chapter/Comment.svelte.d.ts +0 -17
  326. package/components/chapter/Definition.svelte.d.ts +0 -17
  327. package/components/chapter/Embed.svelte.d.ts +0 -20
  328. package/components/chapter/ErrorMessage.svelte +0 -9
  329. package/components/chapter/ErrorMessage.svelte.d.ts +0 -17
  330. package/components/chapter/ExtendedPrism.d.ts +0 -2
  331. package/components/chapter/Figure.svelte.d.ts +0 -24
  332. package/components/chapter/Footnote.svelte.d.ts +0 -19
  333. package/components/chapter/Format.svelte.d.ts +0 -19
  334. package/components/chapter/InlineCode.svelte.d.ts +0 -17
  335. package/components/chapter/Label.svelte.d.ts +0 -17
  336. package/components/chapter/Link.svelte.d.ts +0 -17
  337. package/components/chapter/List.svelte.d.ts +0 -17
  338. package/components/chapter/Marginal.svelte.d.ts +0 -22
  339. package/components/chapter/Paragraph.svelte.d.ts +0 -18
  340. package/components/chapter/Positioned.svelte.d.ts +0 -19
  341. package/components/chapter/Problem.svelte.d.ts +0 -27
  342. package/components/chapter/Python.svelte +0 -128
  343. package/components/chapter/Python.svelte.d.ts +0 -18
  344. package/components/chapter/Quote.svelte.d.ts +0 -17
  345. package/components/chapter/Rule.svelte.d.ts +0 -17
  346. package/components/chapter/Table.svelte.d.ts +0 -17
  347. package/components/chapter/Text.svelte +0 -87
  348. package/components/chapter/Text.svelte.d.ts +0 -18
  349. package/components/editor/BookishEditor.svelte +0 -884
  350. package/components/editor/BookishEditor.svelte.d.ts +0 -25
  351. package/components/editor/CalloutEditor.svelte +0 -10
  352. package/components/editor/CalloutEditor.svelte.d.ts +0 -17
  353. package/components/editor/CaptionedCodeEditor.svelte.d.ts +0 -17
  354. package/components/editor/CaretContext.d.ts +0 -50
  355. package/components/editor/CaretContext.js +0 -1
  356. package/components/editor/CaretState.js +0 -1
  357. package/components/editor/CaretUtilities.js +0 -1
  358. package/components/editor/CaretView.svelte.d.ts +0 -25
  359. package/components/editor/CitationsEditor.svelte +0 -53
  360. package/components/editor/CitationsEditor.svelte.d.ts +0 -17
  361. package/components/editor/Clipboard.js +0 -1
  362. package/components/editor/Command.js +0 -1
  363. package/components/editor/Commands.d.ts +0 -3
  364. package/components/editor/ConfirmButton.svelte +0 -49
  365. package/components/editor/ConfirmButton.svelte.d.ts +0 -19
  366. package/components/editor/DefinitionEditor.svelte +0 -36
  367. package/components/editor/DefinitionEditor.svelte.d.ts +0 -17
  368. package/components/editor/EmbedEditor.svelte +0 -137
  369. package/components/editor/EmbedEditor.svelte.d.ts +0 -17
  370. package/components/editor/Icon.svelte.d.ts +0 -16
  371. package/components/editor/ImageChooser.svelte.d.ts +0 -18
  372. package/components/editor/InlineCodeEditor.svelte +0 -12
  373. package/components/editor/InlineCodeEditor.svelte.d.ts +0 -17
  374. package/components/editor/LabelEditor.svelte.d.ts +0 -17
  375. package/components/editor/LanguageEditor.svelte.d.ts +0 -17
  376. package/components/editor/LinkEditor.svelte +0 -100
  377. package/components/editor/LinkEditor.svelte.d.ts +0 -17
  378. package/components/editor/Note.svelte.d.ts +0 -27
  379. package/components/editor/Permissions.svelte.d.ts +0 -20
  380. package/components/editor/PositionEditor.svelte +0 -17
  381. package/components/editor/PositionEditor.svelte.d.ts +0 -18
  382. package/components/editor/QuoteEditor.svelte +0 -10
  383. package/components/editor/QuoteEditor.svelte.d.ts +0 -17
  384. package/components/editor/Switch.svelte.d.ts +0 -20
  385. package/components/editor/TableEditor.svelte +0 -10
  386. package/components/editor/TableEditor.svelte.d.ts +0 -17
  387. package/components/editor/TextEditor.svelte.d.ts +0 -24
  388. package/components/editor/Toggle.svelte +0 -41
  389. package/components/editor/Toggle.svelte.d.ts +0 -19
  390. package/components/editor/Toolbar.svelte +0 -249
  391. package/components/editor/Toolbar.svelte.d.ts +0 -17
  392. package/components/editor/ToolbarGroup.svelte.d.ts +0 -18
  393. package/components/editor/ToolbarSpacer.svelte.d.ts +0 -23
  394. package/components/editor/URLEditor.svelte +0 -13
  395. package/components/editor/URLEditor.svelte.d.ts +0 -18
  396. package/components/editor/UndoState.js +0 -1
  397. package/components/page/Acknowledgements.svelte.d.ts +0 -14
  398. package/components/page/Authors.svelte +0 -85
  399. package/components/page/Authors.svelte.d.ts +0 -21
  400. package/components/page/BookLoader.svelte +0 -59
  401. package/components/page/BookLoader.svelte.d.ts +0 -16
  402. package/components/page/BulkReferenceEditor.svelte +0 -63
  403. package/components/page/BulkReferenceEditor.svelte.d.ts +0 -14
  404. package/components/page/Chapter.svelte +0 -392
  405. package/components/page/Chapter.svelte.d.ts +0 -18
  406. package/components/page/ChapterContext.d.ts +0 -10
  407. package/components/page/ChapterContext.js +0 -1
  408. package/components/page/ChapterNumber.svelte.d.ts +0 -27
  409. package/components/page/ChapterTitle.svelte.d.ts +0 -18
  410. package/components/page/Contexts.d.ts +0 -47
  411. package/components/page/Contexts.js +0 -133
  412. package/components/page/DefinitionView.svelte.d.ts +0 -18
  413. package/components/page/Description.svelte.d.ts +0 -14
  414. package/components/page/Edition.svelte +0 -161
  415. package/components/page/Edition.svelte.d.ts +0 -20
  416. package/components/page/EditionLoader.svelte +0 -99
  417. package/components/page/EditionLoader.svelte.d.ts +0 -18
  418. package/components/page/Editions.svelte.d.ts +0 -14
  419. package/components/page/Glossary.svelte.d.ts +0 -14
  420. package/components/page/Header.svelte.d.ts +0 -29
  421. package/components/page/Index.svelte.d.ts +0 -14
  422. package/components/page/Instructions.svelte.d.ts +0 -18
  423. package/components/page/License.svelte.d.ts +0 -14
  424. package/components/page/Loading.svelte.d.ts +0 -23
  425. package/components/page/Media.svelte.d.ts +0 -14
  426. package/components/page/MediaPreview.svelte.d.ts +0 -19
  427. package/components/page/Muted.svelte.d.ts +0 -27
  428. package/components/page/Outline.svelte.d.ts +0 -19
  429. package/components/page/Page.svelte +0 -84
  430. package/components/page/Page.svelte.d.ts +0 -19
  431. package/components/page/PageHeader.svelte.d.ts +0 -18
  432. package/components/page/PageParagraph.svelte.d.ts +0 -27
  433. package/components/page/PossibleChapter.svelte +0 -14
  434. package/components/page/PossibleChapter.svelte.d.ts +0 -14
  435. package/components/page/PossibleReference.svelte +0 -11
  436. package/components/page/PossibleReference.svelte.d.ts +0 -18
  437. package/components/page/Print.svelte.d.ts +0 -14
  438. package/components/page/Publish.svelte.d.ts +0 -14
  439. package/components/page/Reference.svelte.d.ts +0 -17
  440. package/components/page/References.svelte.d.ts +0 -14
  441. package/components/page/Rows.svelte.d.ts +0 -27
  442. package/components/page/Search.svelte +0 -133
  443. package/components/page/Search.svelte.d.ts +0 -14
  444. package/components/page/Status.svelte.d.ts +0 -14
  445. package/components/page/SubdomainEditor.svelte.d.ts +0 -14
  446. package/components/page/TableOfContents.svelte.d.ts +0 -14
  447. package/components/page/TableOfContentsImage.svelte +0 -18
  448. package/components/page/TableOfContentsImage.svelte.d.ts +0 -16
  449. package/components/page/TableOfContentsRow.svelte.d.ts +0 -24
  450. package/components/page/ThemeEditor.svelte.d.ts +0 -14
  451. package/components/page/ThemeEditorPreview.svelte.d.ts +0 -17
  452. package/components/page/ThemeSetEditor.svelte +0 -19
  453. package/components/page/ThemeSetEditor.svelte.d.ts +0 -18
  454. package/components/page/ThemeVariableEditor.svelte.d.ts +0 -18
  455. package/components/page/Title.svelte.d.ts +0 -27
  456. package/components/page/Unknown.svelte.d.ts +0 -16
  457. package/components/page/margins.d.ts +0 -2
  458. package/index.d.ts +0 -15
  459. package/models/CRUD.d.ts +0 -27
  460. package/models/CRUD.js +0 -262
  461. package/models/Firebase.d.ts +0 -5
  462. package/models/book/Book.d.ts +0 -61
  463. package/models/book/Book.js +0 -135
  464. package/models/book/BookMedia.d.ts +0 -23
  465. package/models/book/BookMedia.js +0 -108
  466. package/models/book/BookSaveStatus.d.ts +0 -7
  467. package/models/book/BookSaveStatus.js +0 -8
  468. package/models/book/Chapter.d.ts +0 -81
  469. package/models/book/Chapter.js +0 -212
  470. package/models/book/ChapterID.d.ts +0 -10
  471. package/models/book/Definition.d.ts +0 -6
  472. package/models/book/Definition.js +0 -1
  473. package/models/book/Edition.d.ts +0 -139
  474. package/models/book/Edition.js +0 -620
  475. package/models/book/Reference.d.ts +0 -24
  476. package/models/book/Reference.js +0 -78
  477. package/models/book/Schema.d.ts +0 -174
  478. package/models/book/Theme.d.ts +0 -113
  479. package/models/book/ThemeColors.js +0 -1
  480. package/models/book/Words.d.ts +0 -2
  481. package/models/chapter/AtomNode.d.ts +0 -18
  482. package/models/chapter/BlockNode.d.ts +0 -20
  483. package/models/chapter/BlocksNode.d.ts +0 -50
  484. package/models/chapter/BlocksNode.test.d.ts +0 -1
  485. package/models/chapter/BlocksNode.test.js +0 -568
  486. package/models/chapter/Bookkeeping.js +0 -1
  487. package/models/chapter/CalloutNode.d.ts +0 -17
  488. package/models/chapter/CalloutNode.js +0 -58
  489. package/models/chapter/Caret.d.ts +0 -23
  490. package/models/chapter/ChapterNode.d.ts +0 -34
  491. package/models/chapter/ChapterNode.js +0 -117
  492. package/models/chapter/CitationsNode.d.ts +0 -16
  493. package/models/chapter/CodeNode.d.ts +0 -35
  494. package/models/chapter/CommentNode.d.ts +0 -18
  495. package/models/chapter/CommentNode.js +0 -48
  496. package/models/chapter/DefinitionNode.d.ts +0 -12
  497. package/models/chapter/Edit.d.ts +0 -7
  498. package/models/chapter/Edit.js +0 -1
  499. package/models/chapter/EmbedNode.d.ts +0 -45
  500. package/models/chapter/EmbedNode.js +0 -168
  501. package/models/chapter/ErrorNode.d.ts +0 -17
  502. package/models/chapter/FootnoteNode.d.ts +0 -18
  503. package/models/chapter/FootnoteNode.js +0 -47
  504. package/models/chapter/FormatNode.d.ts +0 -60
  505. package/models/chapter/FormatNode.test.d.ts +0 -1
  506. package/models/chapter/FormatNode.test.js +0 -96
  507. package/models/chapter/InlineCodeNode.d.ts +0 -12
  508. package/models/chapter/LabelNode.d.ts +0 -17
  509. package/models/chapter/LinkNode.d.ts +0 -12
  510. package/models/chapter/ListNode.d.ts +0 -51
  511. package/models/chapter/ListNode.test.d.ts +0 -1
  512. package/models/chapter/MetadataNode.d.ts +0 -17
  513. package/models/chapter/MetadataNode.js +0 -32
  514. package/models/chapter/Node.d.ts +0 -38
  515. package/models/chapter/Node.test.d.ts +0 -1
  516. package/models/chapter/ParagraphNode.d.ts +0 -33
  517. package/models/chapter/ParagraphNode.test.d.ts +0 -1
  518. package/models/chapter/ParagraphNode.test.js +0 -30
  519. package/models/chapter/Parser.d.ts +0 -75
  520. package/models/chapter/Parser.test.d.ts +0 -1
  521. package/models/chapter/Position.js +0 -1
  522. package/models/chapter/QuoteNode.d.ts +0 -25
  523. package/models/chapter/QuoteNode.js +0 -99
  524. package/models/chapter/RootNode.js +0 -1
  525. package/models/chapter/RuleNode.d.ts +0 -15
  526. package/models/chapter/TableNode.d.ts +0 -37
  527. package/models/chapter/TableNode.test.d.ts +0 -1
  528. package/models/chapter/TextNode.d.ts +0 -36
  529. package/models/chapter/TextNode.test.d.ts +0 -1
  530. package/util/getSubdomain.d.ts +0 -3
  531. package/util/isMobile.d.ts +0 -2
  532. package/util/mineReference.d.ts +0 -4
  533. package/util/scrollToEyeLevel.d.ts +0 -2
@@ -0,0 +1,171 @@
1
+ export default class Reference {
2
+ readonly citationID: string;
3
+ readonly authors: string;
4
+ readonly year: string;
5
+ readonly title: string;
6
+ readonly source: string;
7
+ readonly url: string;
8
+ readonly summary: string;
9
+ readonly short: boolean;
10
+
11
+ constructor(
12
+ citationID: string,
13
+ authors: string = '',
14
+ year: string = '',
15
+ title: string = '',
16
+ source: string = '',
17
+ url: string = '',
18
+ summary: string = '',
19
+ short: boolean = false
20
+ ) {
21
+ this.citationID = citationID;
22
+ this.authors = authors;
23
+ this.year = year;
24
+ this.title = title;
25
+ this.source = source;
26
+ this.url = url;
27
+ this.summary = summary;
28
+ this.short = short;
29
+ }
30
+
31
+ toText() {
32
+ return (
33
+ this.authors +
34
+ ' ' +
35
+ this.year +
36
+ ' ' +
37
+ this.title +
38
+ ' ' +
39
+ this.source +
40
+ (this.summary ? this.summary : '')
41
+ );
42
+ }
43
+
44
+ toList() {
45
+ return [
46
+ this.authors,
47
+ this.year,
48
+ this.title,
49
+ this.source,
50
+ this.url,
51
+ this.summary,
52
+ ];
53
+ }
54
+
55
+ copy() {
56
+ return new Reference(
57
+ this.citationID,
58
+ this.authors,
59
+ this.year,
60
+ this.title,
61
+ this.source,
62
+ this.url,
63
+ this.summary,
64
+ this.short
65
+ ) as this;
66
+ }
67
+
68
+ withChildReplaced() {
69
+ return undefined;
70
+ }
71
+
72
+ withContentInRange(): this | undefined {
73
+ return this.copy();
74
+ }
75
+
76
+ withCitationID(id: string) {
77
+ return new Reference(
78
+ id,
79
+ this.authors,
80
+ this.year,
81
+ this.title,
82
+ this.source,
83
+ this.url,
84
+ this.summary,
85
+ this.short
86
+ );
87
+ }
88
+ withAuthors(authors: string) {
89
+ return new Reference(
90
+ this.citationID,
91
+ authors,
92
+ this.year,
93
+ this.title,
94
+ this.source,
95
+ this.url,
96
+ this.summary,
97
+ this.short
98
+ );
99
+ }
100
+ withYear(year: string) {
101
+ return new Reference(
102
+ this.citationID,
103
+ this.authors,
104
+ year,
105
+ this.title,
106
+ this.source,
107
+ this.url,
108
+ this.summary,
109
+ this.short
110
+ );
111
+ }
112
+ withTitle(title: string) {
113
+ return new Reference(
114
+ this.citationID,
115
+ this.authors,
116
+ this.year,
117
+ title,
118
+ this.source,
119
+ this.url,
120
+ this.summary,
121
+ this.short
122
+ );
123
+ }
124
+ withSource(source: string) {
125
+ return new Reference(
126
+ this.citationID,
127
+ this.authors,
128
+ this.year,
129
+ this.title,
130
+ source,
131
+ this.url,
132
+ this.summary,
133
+ this.short
134
+ );
135
+ }
136
+ withURL(url: string) {
137
+ return new Reference(
138
+ this.citationID,
139
+ this.authors,
140
+ this.year,
141
+ this.title,
142
+ this.source,
143
+ url,
144
+ this.summary,
145
+ this.short
146
+ );
147
+ }
148
+ withSummary(summary: string) {
149
+ return new Reference(
150
+ this.citationID,
151
+ this.authors,
152
+ this.year,
153
+ this.title,
154
+ this.source,
155
+ this.url,
156
+ summary,
157
+ this.short
158
+ );
159
+ }
160
+
161
+ equals(ref: Reference) {
162
+ return (
163
+ this.authors === ref.authors &&
164
+ this.year === ref.year &&
165
+ this.title === ref.title &&
166
+ this.source === ref.source &&
167
+ this.summary == ref.summary &&
168
+ this.short === ref.short
169
+ );
170
+ }
171
+ }
@@ -112,4 +112,5 @@ const Schema = {
112
112
  },
113
113
  },
114
114
  };
115
+
115
116
  export default Schema;
@@ -1,3 +1,53 @@
1
+ import type ThemeColors from './ThemeColors';
2
+
3
+ type Theme = {
4
+ // A list of URLs to CSS files (for including @font-face declarations other other custom style).
5
+ imports?: string[];
6
+ // Background colors
7
+ light?: ThemeColors;
8
+ dark?: ThemeColors;
9
+ // Fonts
10
+ fonts?: {
11
+ paragraphFontFamily?: string;
12
+ headerFontFamily?: string;
13
+ codeFontFamily?: string;
14
+ bulletFontFamily?: string;
15
+ };
16
+ // Fonts
17
+ sizes?: {
18
+ paragraphFontSize?: string;
19
+ blockFontSize?: string;
20
+ smallFontSize?: string;
21
+ titleFontSize?: string;
22
+ header1FontSize?: string;
23
+ header2FontSize?: string;
24
+ header3FontSize?: string;
25
+ codeFontSize?: string;
26
+ };
27
+ weights?: {
28
+ headerFontWeight?: string;
29
+ paragraphFontWeight?: string;
30
+ boldFontWeight?: string;
31
+ linkFontWeight?: string;
32
+ codeFontWeight?: string;
33
+ bulletFontWeight?: string;
34
+ };
35
+ // Spacing
36
+ spacing?: {
37
+ paragraphLineHeight?: string;
38
+ paragraphLineHeightTight?: string;
39
+ headerLineHeight?: string;
40
+ paragraphSpacing?: string;
41
+ headerSpacing?: string;
42
+ indent?: string;
43
+ inlinePadding?: string;
44
+ blockPadding?: string;
45
+ roundedness?: string;
46
+ };
47
+ };
48
+
49
+ export default Theme;
50
+
1
51
  export const BookishTheme = {
2
52
  imports: [
3
53
  'https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Outfit:wght@300;700&display=swap',
@@ -8,9 +58,11 @@ export const BookishTheme = {
8
58
  backgroundColor: '#FFFFFF',
9
59
  blockBackgroundColor: '#FCFAFA',
10
60
  errorBackgroundColor: '#F8D7DA',
61
+
11
62
  // Border colors
12
63
  borderColorLight: '#E0E0E0',
13
64
  borderColorBold: '#000000',
65
+
14
66
  // Foreground colors
15
67
  paragraphColor: '#000000',
16
68
  mutedColor: '#9AA1A7',
@@ -25,9 +77,11 @@ export const BookishTheme = {
25
77
  backgroundColor: '#1C1C1C',
26
78
  blockBackgroundColor: '#333333',
27
79
  errorBackgroundColor: '#721C24',
80
+
28
81
  // Border colors
29
82
  borderColorLight: '#444444',
30
83
  borderColorBold: '#DADADA',
84
+
31
85
  // Foreground colors
32
86
  paragraphColor: '#DADADA',
33
87
  mutedColor: '#666666',
@@ -37,6 +91,7 @@ export const BookishTheme = {
37
91
  linkColor: '#73a3fa',
38
92
  bulletColor: '#721C24',
39
93
  },
94
+
40
95
  // Fonts
41
96
  fonts: {
42
97
  paragraphFontFamily: '"Noto Serif", serif',
@@ -44,6 +99,7 @@ export const BookishTheme = {
44
99
  codeFontFamily: '"Courier New", monospace',
45
100
  bulletFontFamily: '"Outfit", serif',
46
101
  },
102
+
47
103
  // Font sizes
48
104
  sizes: {
49
105
  paragraphFontSize: '14pt',
@@ -55,6 +111,7 @@ export const BookishTheme = {
55
111
  header3FontSize: '14pt',
56
112
  codeFontSize: '12pt',
57
113
  },
114
+
58
115
  // Font weights
59
116
  weights: {
60
117
  headerFontWeight: '700',
@@ -64,6 +121,7 @@ export const BookishTheme = {
64
121
  codeFontWeight: '400',
65
122
  bulletFontWeight: '500',
66
123
  },
124
+
67
125
  // Spacing
68
126
  spacing: {
69
127
  paragraphLineHeight: '1.8em',
@@ -77,7 +135,8 @@ export const BookishTheme = {
77
135
  roundedness: '5px',
78
136
  },
79
137
  };
80
- export const SeriousTheme = {
138
+
139
+ export const SeriousTheme: Theme = {
81
140
  imports: [
82
141
  'https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Roboto:ital,wght@0,300;0,500;1,300&display=swap',
83
142
  ],
@@ -87,9 +146,11 @@ export const SeriousTheme = {
87
146
  backgroundColor: '#FFFFFF',
88
147
  blockBackgroundColor: '#FCFAFA',
89
148
  errorBackgroundColor: '#F8D7DA',
149
+
90
150
  // Border colors
91
151
  borderColorLight: '#E0E0E0',
92
152
  borderColorBold: '#000000',
153
+
93
154
  // Foreground colors
94
155
  paragraphColor: '#000000',
95
156
  mutedColor: '#9AA1A7',
@@ -104,9 +165,11 @@ export const SeriousTheme = {
104
165
  backgroundColor: '#010101',
105
166
  blockBackgroundColor: '#333333',
106
167
  errorBackgroundColor: '#721C24',
168
+
107
169
  // Border colors
108
170
  borderColorLight: '#444444',
109
171
  borderColorBold: '#DADADA',
172
+
110
173
  // Foreground colors
111
174
  paragraphColor: '#DADADA',
112
175
  mutedColor: '#666666',
@@ -116,6 +179,7 @@ export const SeriousTheme = {
116
179
  linkColor: '#b36363',
117
180
  bulletColor: '#b36363',
118
181
  },
182
+
119
183
  // Fonts
120
184
  fonts: {
121
185
  paragraphFontFamily: '"Roboto", serif',
@@ -123,6 +187,7 @@ export const SeriousTheme = {
123
187
  codeFontFamily: '"Courier New", monospace',
124
188
  bulletFontFamily: '"Roboto"',
125
189
  },
190
+
126
191
  // Font sizes
127
192
  sizes: {
128
193
  paragraphFontSize: '14pt',
@@ -134,6 +199,7 @@ export const SeriousTheme = {
134
199
  header3FontSize: '14pt',
135
200
  codeFontSize: '12pt',
136
201
  },
202
+
137
203
  // Font weights
138
204
  weights: {
139
205
  headerFontWeight: '700',
@@ -143,6 +209,7 @@ export const SeriousTheme = {
143
209
  codeFontWeight: '400',
144
210
  bulletFontWeight: '500',
145
211
  },
212
+
146
213
  // Spacing
147
214
  spacing: {
148
215
  paragraphLineHeight: '2rem',
@@ -156,7 +223,8 @@ export const SeriousTheme = {
156
223
  roundedness: '5px',
157
224
  },
158
225
  };
159
- export const TechTheme = {
226
+
227
+ export const TechTheme: Theme = {
160
228
  imports: [
161
229
  'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,500;1,300&family=Russo+One&display=swap',
162
230
  ],
@@ -166,9 +234,11 @@ export const TechTheme = {
166
234
  backgroundColor: '#FFFFFF',
167
235
  blockBackgroundColor: '#FCFAFA',
168
236
  errorBackgroundColor: '#F8D7DA',
237
+
169
238
  // Border colors
170
239
  borderColorLight: '#E0E0E0',
171
240
  borderColorBold: '#000000',
241
+
172
242
  // Foreground colors
173
243
  paragraphColor: '#000000',
174
244
  mutedColor: '#9AA1A7',
@@ -183,9 +253,11 @@ export const TechTheme = {
183
253
  backgroundColor: '#000000',
184
254
  blockBackgroundColor: '#333333',
185
255
  errorBackgroundColor: '#721C24',
256
+
186
257
  // Border colors
187
258
  borderColorLight: '#444444',
188
259
  borderColorBold: '#DADADA',
260
+
189
261
  // Foreground colors
190
262
  paragraphColor: '#DADADA',
191
263
  mutedColor: '#959595',
@@ -195,6 +267,7 @@ export const TechTheme = {
195
267
  linkColor: '#7589e6',
196
268
  bulletColor: '#7589e6',
197
269
  },
270
+
198
271
  // Fonts
199
272
  fonts: {
200
273
  paragraphFontFamily: '"Roboto", serif',
@@ -202,6 +275,7 @@ export const TechTheme = {
202
275
  bulletFontFamily: '"Roboto"',
203
276
  codeFontFamily: '"Courier New", monospace',
204
277
  },
278
+
205
279
  // Font sizes
206
280
  sizes: {
207
281
  paragraphFontSize: '14pt',
@@ -213,6 +287,7 @@ export const TechTheme = {
213
287
  header3FontSize: '14pt',
214
288
  codeFontSize: '12pt',
215
289
  },
290
+
216
291
  // Font weights
217
292
  weights: {
218
293
  headerFontWeight: '300',
@@ -222,20 +297,22 @@ export const TechTheme = {
222
297
  codeFontWeight: '400',
223
298
  bulletFontWeight: '500',
224
299
  },
300
+
225
301
  // Spacing
226
302
  spacing: {
227
303
  paragraphLineHeight: '2rem',
228
304
  paragraphLineHeightTight: '1.4em',
229
305
  headerLineHeight: '3em',
230
306
  paragraphSpacing: '1.8rem',
231
- headerSpacing: '2rem',
307
+ headerSpacing: '1.4rem',
232
308
  indent: '10%',
233
309
  inlinePadding: '0.25rem',
234
310
  blockPadding: '1rem',
235
311
  roundedness: '5px',
236
312
  },
237
313
  };
238
- export const HumanTheme = {
314
+
315
+ export const HumanTheme: Theme = {
239
316
  imports: [
240
317
  'https://fonts.googleapis.com/css2?family=Caveat&family=Piazzolla:ital,wght@0,300;0,700;1,300&display=swap',
241
318
  ],
@@ -245,9 +322,11 @@ export const HumanTheme = {
245
322
  backgroundColor: '#FFFFFF',
246
323
  blockBackgroundColor: '#FCFAFA',
247
324
  errorBackgroundColor: '#F8D7DA',
325
+
248
326
  // Border colors
249
327
  borderColorLight: '#E0E0E0',
250
328
  borderColorBold: '#000000',
329
+
251
330
  // Foreground colors
252
331
  paragraphColor: '#000000',
253
332
  mutedColor: '#9AA1A7',
@@ -262,9 +341,11 @@ export const HumanTheme = {
262
341
  backgroundColor: '#141421',
263
342
  blockBackgroundColor: '#333333',
264
343
  errorBackgroundColor: '#721C24',
344
+
265
345
  // Border colors
266
346
  borderColorLight: '#444444',
267
347
  borderColorBold: '#DADADA',
348
+
268
349
  // Foreground colors
269
350
  paragraphColor: '#DADADA',
270
351
  mutedColor: '#666666',
@@ -274,6 +355,7 @@ export const HumanTheme = {
274
355
  linkColor: '#2b8ae3',
275
356
  bulletColor: '#2b8ae3',
276
357
  },
358
+
277
359
  // Fonts
278
360
  fonts: {
279
361
  paragraphFontFamily: '"Piazzolla", serif',
@@ -281,6 +363,7 @@ export const HumanTheme = {
281
363
  codeFontFamily: '"Courier New", monospace',
282
364
  bulletFontFamily: '"Caveat", serif',
283
365
  },
366
+
284
367
  // Font sizes
285
368
  sizes: {
286
369
  paragraphFontSize: '14pt',
@@ -292,6 +375,7 @@ export const HumanTheme = {
292
375
  header3FontSize: '20pt',
293
376
  codeFontSize: '11pt',
294
377
  },
378
+
295
379
  // Font weights
296
380
  weights: {
297
381
  headerFontWeight: '700',
@@ -301,6 +385,7 @@ export const HumanTheme = {
301
385
  codeFontWeight: '400',
302
386
  bulletFontWeight: '300',
303
387
  },
388
+
304
389
  // Spacing
305
390
  spacing: {
306
391
  paragraphLineHeight: '2.2rem',
@@ -314,7 +399,8 @@ export const HumanTheme = {
314
399
  roundedness: '5px',
315
400
  },
316
401
  };
317
- export const SketchyTheme = {
402
+
403
+ export const SketchyTheme: Theme = {
318
404
  imports: [
319
405
  'https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,300;0,500;1,300&family=Cabin+Sketch&display=swap',
320
406
  ],
@@ -324,9 +410,11 @@ export const SketchyTheme = {
324
410
  backgroundColor: '#FFFFFF',
325
411
  blockBackgroundColor: '#FCFAFA',
326
412
  errorBackgroundColor: '#F8D7DA',
413
+
327
414
  // Border colors
328
415
  borderColorLight: '#E0E0E0',
329
416
  borderColorBold: '#000000',
417
+
330
418
  // Foreground colors
331
419
  paragraphColor: '#000000',
332
420
  mutedColor: '#9AA1A7',
@@ -341,9 +429,11 @@ export const SketchyTheme = {
341
429
  backgroundColor: '#1C1C1C',
342
430
  blockBackgroundColor: '#333333',
343
431
  errorBackgroundColor: '#721C24',
432
+
344
433
  // Border colors
345
434
  borderColorLight: '#444444',
346
435
  borderColorBold: '#DADADA',
436
+
347
437
  // Foreground colors
348
438
  paragraphColor: '#DADADA',
349
439
  mutedColor: '#666666',
@@ -353,6 +443,7 @@ export const SketchyTheme = {
353
443
  linkColor: '#9c7e2c',
354
444
  bulletColor: '#9c7e2c',
355
445
  },
446
+
356
447
  // Fonts
357
448
  fonts: {
358
449
  paragraphFontFamily: '"Bitter", serif',
@@ -360,6 +451,7 @@ export const SketchyTheme = {
360
451
  codeFontFamily: '"Courier New", monospace',
361
452
  bulletFontFamily: '"Verdana"',
362
453
  },
454
+
363
455
  // Font sizes
364
456
  sizes: {
365
457
  paragraphFontSize: '14pt',
@@ -371,6 +463,7 @@ export const SketchyTheme = {
371
463
  header3FontSize: '16pt',
372
464
  codeFontSize: '12pt',
373
465
  },
466
+
374
467
  // Font weights
375
468
  weights: {
376
469
  headerFontWeight: '500',
@@ -380,6 +473,7 @@ export const SketchyTheme = {
380
473
  codeFontWeight: '400',
381
474
  bulletFontWeight: '500',
382
475
  },
476
+
383
477
  // Spacing
384
478
  spacing: {
385
479
  paragraphLineHeight: '2.4em',
@@ -393,22 +487,26 @@ export const SketchyTheme = {
393
487
  roundedness: '5px',
394
488
  },
395
489
  };
396
- export const CriticalTheme = {
490
+
491
+ export const CriticalTheme: Theme = {
397
492
  imports: [
398
493
  'https://fonts.googleapis.com/css2?family=Arvo:ital,wght@0,400;0,700;1,400;1,700&display=block',
399
494
  'https://fonts.googleapis.com/css2?family=DM+Mono&display=block',
400
495
  'https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@500&display=block',
401
496
  'https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,400;0,700;1,400;1,700&display=swap',
402
497
  ],
498
+
403
499
  // Background colors
404
500
  light: {
405
501
  // Background colors;
406
502
  backgroundColor: '#FFFFFF',
407
503
  blockBackgroundColor: '#FCFAFA',
408
504
  errorBackgroundColor: '#F8D7DA',
505
+
409
506
  // Border colors
410
507
  borderColorLight: '#E0E0E0',
411
508
  borderColorBold: '#000000',
509
+
412
510
  // Foreground colors
413
511
  paragraphColor: '#000000',
414
512
  mutedColor: '#9AA1A7',
@@ -423,9 +521,11 @@ export const CriticalTheme = {
423
521
  backgroundColor: '#1C1C1C',
424
522
  blockBackgroundColor: '#333333',
425
523
  errorBackgroundColor: '#721C24',
524
+
426
525
  // Border colors
427
526
  borderColorLight: '#444444',
428
527
  borderColorBold: '#DADADA',
528
+
429
529
  // Foreground colors
430
530
  paragraphColor: '#DADADA',
431
531
  mutedColor: '#CCCCCC',
@@ -435,6 +535,7 @@ export const CriticalTheme = {
435
535
  linkColor: '#73a3fa',
436
536
  bulletColor: '#721C24',
437
537
  },
538
+
438
539
  // Fonts
439
540
  fonts: {
440
541
  paragraphFontFamily: '"Bitter", serif',
@@ -442,6 +543,7 @@ export const CriticalTheme = {
442
543
  codeFontFamily: '"DM Mono", monospace',
443
544
  bulletFontFamily: '"M Plus Rounded 1c", serif',
444
545
  },
546
+
445
547
  // Font sizes
446
548
  sizes: {
447
549
  paragraphFontSize: '14pt',
@@ -453,6 +555,7 @@ export const CriticalTheme = {
453
555
  header3FontSize: '14pt',
454
556
  codeFontSize: '12pt',
455
557
  },
558
+
456
559
  // Font weights
457
560
  weights: {
458
561
  headerFontWeight: '700',
@@ -462,6 +565,7 @@ export const CriticalTheme = {
462
565
  codeFontWeight: '400',
463
566
  bulletFontWeight: '400',
464
567
  },
568
+
465
569
  // Spacing
466
570
  spacing: {
467
571
  paragraphLineHeight: '2.2em',
@@ -1,9 +1,14 @@
1
1
  type ThemeColors = {
2
+ // Background colors;
2
3
  backgroundColor: string;
3
4
  blockBackgroundColor: string;
4
5
  errorBackgroundColor: string;
6
+
7
+ // Border colors
5
8
  borderColorLight: string;
6
9
  borderColorBold: string;
10
+
11
+ // Foreground colors
7
12
  paragraphColor: string;
8
13
  mutedColor: string;
9
14
  highlightColor: string;
@@ -12,4 +17,5 @@ type ThemeColors = {
12
17
  linkColor: string;
13
18
  bulletColor: string;
14
19
  };
20
+
15
21
  export default ThemeColors;
@@ -107,4 +107,5 @@ const CommonWords = [
107
107
  'you',
108
108
  'your',
109
109
  ];
110
+
110
111
  export default CommonWords;
@@ -1,38 +1,58 @@
1
+ import type Caret from './Caret';
1
2
  import FormatNode from './FormatNode';
2
3
  import Node from './Node';
3
4
  import TextNode from './TextNode';
4
- export default class AtomNode extends Node {
5
- #meta;
6
- constructor(meta) {
5
+ import type RootNode from './RootNode';
6
+
7
+ export default abstract class AtomNode<MetadataType> extends Node {
8
+ readonly #meta: MetadataType;
9
+
10
+ constructor(meta: MetadataType) {
7
11
  super();
8
12
  this.#meta = meta;
9
13
  }
14
+
10
15
  getMeta() {
11
16
  return this.#meta;
12
17
  }
18
+
19
+ abstract getDefaultCaret(): Caret | undefined;
20
+
13
21
  // Include the meta node if it's a node, to include it in normal operations.
14
22
  // We special case it in other places to avoid breaking other conventions (such as formatting changes, which
15
23
  // the atom node should be isolated from).
16
24
  getChildren() {
17
25
  return this.#meta instanceof Node ? [this.#meta] : [];
18
26
  }
19
- nextWord(root) {
27
+
28
+ nextWord(root: RootNode): Caret {
20
29
  const next = root.getNextTextOrAtom(this);
21
30
  return next ? { node: next, index: 0 } : { node: this, index: 0 };
22
31
  }
23
- previousWord(root) {
32
+
33
+ previousWord(root: RootNode): Caret {
24
34
  const previous = root.getPreviousTextOrAtom(this);
25
35
  return previous
26
36
  ? {
27
- node: previous,
28
- index: previous instanceof TextNode ? previous.getLength() : 0,
29
- }
37
+ node: previous,
38
+ index:
39
+ previous instanceof TextNode ? previous.getLength() : 0,
40
+ }
30
41
  : { node: this, index: 0 };
31
42
  }
32
- getFormatRoot(root) {
33
- return this.getFarthestParentMatching(root, (p) => p instanceof FormatNode);
43
+
44
+ getFormatRoot(root: Node): FormatNode | undefined {
45
+ return this.getFarthestParentMatching(
46
+ root,
47
+ (p) => p instanceof FormatNode
48
+ ) as FormatNode;
34
49
  }
50
+
35
51
  getCaretPositionCount() {
36
52
  return 1;
37
53
  }
54
+
55
+ abstract toBookdown(format?: FormatNode): string;
56
+ abstract toText(): string;
57
+ abstract withMeta(meta: MetadataType): AtomNode<MetadataType>;
38
58
  }