bookish-press 0.4.232 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (433) hide show
  1. package/{components → package/components}/Auth.svelte +11 -13
  2. package/{components → package/components}/Auth.svelte.d.ts +0 -0
  3. package/{components → package/components}/Authentication.d.ts +0 -0
  4. package/{components → package/components}/Authentication.js +0 -0
  5. package/{components → package/components}/BookPreview.svelte +13 -17
  6. package/{components → package/components}/BookPreview.svelte.d.ts +0 -0
  7. package/{components → package/components}/Link.svelte +2 -1
  8. package/{components → package/components}/Link.svelte.d.ts +1 -0
  9. package/{components → package/components}/app/BookList.svelte +0 -0
  10. package/{components → package/components}/app/BookList.svelte.d.ts +0 -0
  11. package/{components → package/components}/app/Button.svelte +5 -2
  12. package/{components → package/components}/app/Button.svelte.d.ts +0 -0
  13. package/{components → package/components}/app/Feedback.svelte +4 -9
  14. package/{components → package/components}/app/Feedback.svelte.d.ts +0 -0
  15. package/{components → package/components}/app/Head.svelte +4 -1
  16. package/{components → package/components}/app/Head.svelte.d.ts +6 -15
  17. package/{components → package/components}/app/Large.svelte +0 -0
  18. package/{components → package/components}/app/Large.svelte.d.ts +0 -0
  19. package/{components → package/components}/app/Lead.svelte +0 -0
  20. package/{components → package/components}/app/Lead.svelte.d.ts +0 -0
  21. package/package/components/app/Link.svelte +36 -0
  22. package/{components → package/components}/app/Link.svelte.d.ts +1 -0
  23. package/{components → package/components}/app/Options.svelte +0 -0
  24. package/{components → package/components}/app/Options.svelte.d.ts +0 -0
  25. package/{components → package/components}/app/Paragraph.svelte +1 -0
  26. package/{components → package/components}/app/Paragraph.svelte.d.ts +0 -0
  27. package/{components/app/Writing.svelte → package/components/app/Section.svelte} +0 -1
  28. package/package/components/app/Section.svelte.d.ts +27 -0
  29. package/{components → package/components}/app/Table.svelte +0 -0
  30. package/{components → package/components}/app/Table.svelte.d.ts +0 -0
  31. package/{components → package/components}/app/TextInput.svelte +2 -0
  32. package/{components → package/components}/app/TextInput.svelte.d.ts +0 -0
  33. package/{components → package/components}/chapter/Atom.svelte +1 -8
  34. package/{components → package/components}/chapter/Atom.svelte.d.ts +0 -0
  35. package/{components → package/components}/chapter/Block.svelte +3 -1
  36. package/{components → package/components}/chapter/Block.svelte.d.ts +0 -0
  37. package/{components → package/components}/chapter/Callout.svelte +0 -0
  38. package/{components → package/components}/chapter/Callout.svelte.d.ts +0 -0
  39. package/{components → package/components}/chapter/CaptionedCode.svelte +2 -2
  40. package/{components → package/components}/chapter/CaptionedCode.svelte.d.ts +0 -0
  41. package/{components → package/components}/chapter/ChapterBody.svelte +9 -16
  42. package/{components → package/components}/chapter/ChapterBody.svelte.d.ts +1 -0
  43. package/{components → package/components}/chapter/Citations.svelte +13 -11
  44. package/{components → package/components}/chapter/Citations.svelte.d.ts +0 -0
  45. package/{components → package/components}/chapter/Code.svelte +3 -2
  46. package/{components → package/components}/chapter/Code.svelte.d.ts +0 -0
  47. package/{components → package/components}/chapter/Comment.svelte +7 -13
  48. package/{components → package/components}/chapter/Comment.svelte.d.ts +0 -0
  49. package/{components → package/components}/chapter/Definition.svelte +8 -3
  50. package/{components → package/components}/chapter/Definition.svelte.d.ts +0 -0
  51. package/{components → package/components}/chapter/Embed.svelte +6 -5
  52. package/{components → package/components}/chapter/Embed.svelte.d.ts +1 -0
  53. package/{components → package/components}/chapter/ErrorMessage.svelte +0 -0
  54. package/{components → package/components}/chapter/ErrorMessage.svelte.d.ts +0 -0
  55. package/{components → package/components}/chapter/ExtendedPrism.d.ts +0 -0
  56. package/{components → package/components}/chapter/ExtendedPrism.js +0 -0
  57. package/{components → package/components}/chapter/Figure.svelte +8 -8
  58. package/{components → package/components}/chapter/Figure.svelte.d.ts +0 -0
  59. package/{components → package/components}/chapter/Footnote.svelte +13 -24
  60. package/{components → package/components}/chapter/Footnote.svelte.d.ts +0 -2
  61. package/{components → package/components}/chapter/Format.svelte +5 -4
  62. package/{components → package/components}/chapter/Format.svelte.d.ts +0 -0
  63. package/{components → package/components}/chapter/InlineCode.svelte +2 -2
  64. package/{components → package/components}/chapter/InlineCode.svelte.d.ts +0 -0
  65. package/{components → package/components}/chapter/Label.svelte +5 -7
  66. package/{components → package/components}/chapter/Label.svelte.d.ts +0 -0
  67. package/{components → package/components}/chapter/Link.svelte +8 -6
  68. package/{components → package/components}/chapter/Link.svelte.d.ts +0 -0
  69. package/{components → package/components}/chapter/List.svelte +5 -0
  70. package/{components → package/components}/chapter/List.svelte.d.ts +0 -0
  71. package/{components → package/components}/chapter/Marginal.svelte +30 -12
  72. package/{components → package/components}/chapter/Marginal.svelte.d.ts +0 -0
  73. package/{components → package/components}/chapter/Paragraph.svelte +23 -10
  74. package/{components → package/components}/chapter/Paragraph.svelte.d.ts +0 -0
  75. package/{components → package/components}/chapter/Positioned.svelte +0 -0
  76. package/{components → package/components}/chapter/Positioned.svelte.d.ts +0 -0
  77. package/{components → package/components}/chapter/Problem.svelte +0 -0
  78. package/{components → package/components}/chapter/Problem.svelte.d.ts +0 -0
  79. package/{components → package/components}/chapter/Python.svelte +0 -0
  80. package/{components → package/components}/chapter/Python.svelte.d.ts +0 -0
  81. package/{components → package/components}/chapter/Quote.svelte +20 -10
  82. package/{components → package/components}/chapter/Quote.svelte.d.ts +0 -0
  83. package/{components → package/components}/chapter/Rule.svelte +0 -0
  84. package/{components → package/components}/chapter/Rule.svelte.d.ts +0 -0
  85. package/{components → package/components}/chapter/Table.svelte +2 -2
  86. package/{components → package/components}/chapter/Table.svelte.d.ts +0 -0
  87. package/{components → package/components}/chapter/Text.svelte +2 -2
  88. package/{components → package/components}/chapter/Text.svelte.d.ts +0 -0
  89. package/package/components/controls/DarkToggle.svelte +38 -0
  90. package/package/components/controls/DarkToggle.svelte.d.ts +17 -0
  91. package/{components → package/components}/editor/BookishEditor.svelte +57 -32
  92. package/{components → package/components}/editor/BookishEditor.svelte.d.ts +4 -1
  93. package/{components → package/components}/editor/CalloutEditor.svelte +0 -0
  94. package/{components → package/components}/editor/CalloutEditor.svelte.d.ts +0 -0
  95. package/{components → package/components}/editor/CaptionedCodeEditor.svelte +0 -0
  96. package/{components → package/components}/editor/CaptionedCodeEditor.svelte.d.ts +0 -0
  97. package/{components → package/components}/editor/CaretContext.d.ts +0 -0
  98. package/{components → package/components}/editor/CaretContext.js +0 -0
  99. package/{components → package/components}/editor/CaretState.d.ts +0 -0
  100. package/{components → package/components}/editor/CaretState.js +0 -0
  101. package/{components → package/components}/editor/CaretUtilities.d.ts +0 -0
  102. package/{components → package/components}/editor/CaretUtilities.js +0 -0
  103. package/{components → package/components}/editor/CaretView.svelte +4 -2
  104. package/{components → package/components}/editor/CaretView.svelte.d.ts +1 -0
  105. package/{components → package/components}/editor/CitationsEditor.svelte +0 -0
  106. package/{components → package/components}/editor/CitationsEditor.svelte.d.ts +0 -0
  107. package/{components → package/components}/editor/Clipboard.d.ts +0 -0
  108. package/{components → package/components}/editor/Clipboard.js +0 -0
  109. package/{components → package/components}/editor/Command.d.ts +0 -0
  110. package/{components → package/components}/editor/Command.js +0 -0
  111. package/{components → package/components}/editor/Commands.d.ts +0 -0
  112. package/{components → package/components}/editor/Commands.js +0 -0
  113. package/package/components/editor/ConfirmButton.svelte +23 -0
  114. package/{components → package/components}/editor/ConfirmButton.svelte.d.ts +4 -3
  115. package/{components → package/components}/editor/DefinitionEditor.svelte +0 -0
  116. package/{components → package/components}/editor/DefinitionEditor.svelte.d.ts +0 -0
  117. package/{components → package/components}/editor/EmbedEditor.svelte +1 -1
  118. package/{components → package/components}/editor/EmbedEditor.svelte.d.ts +0 -0
  119. package/{components → package/components}/editor/Icon.svelte +0 -0
  120. package/{components → package/components}/editor/Icon.svelte.d.ts +0 -0
  121. package/{components → package/components}/editor/ImageChooser.svelte +0 -0
  122. package/{components → package/components}/editor/ImageChooser.svelte.d.ts +0 -0
  123. package/{components → package/components}/editor/InlineCodeEditor.svelte +0 -0
  124. package/{components → package/components}/editor/InlineCodeEditor.svelte.d.ts +0 -0
  125. package/{components → package/components}/editor/LabelEditor.svelte +0 -0
  126. package/{components → package/components}/editor/LabelEditor.svelte.d.ts +0 -0
  127. package/{components → package/components}/editor/LanguageEditor.svelte +0 -0
  128. package/{components → package/components}/editor/LanguageEditor.svelte.d.ts +0 -0
  129. package/{components → package/components}/editor/LinkEditor.svelte +4 -3
  130. package/{components → package/components}/editor/LinkEditor.svelte.d.ts +0 -0
  131. package/{components → package/components}/editor/Note.svelte +1 -0
  132. package/{components → package/components}/editor/Note.svelte.d.ts +0 -0
  133. package/package/components/editor/Permissions.svelte +93 -0
  134. package/package/components/editor/Permissions.svelte.d.ts +20 -0
  135. package/{components → package/components}/editor/PositionEditor.svelte +0 -0
  136. package/{components → package/components}/editor/PositionEditor.svelte.d.ts +0 -0
  137. package/{components → package/components}/editor/QuoteEditor.svelte +0 -0
  138. package/{components → package/components}/editor/QuoteEditor.svelte.d.ts +0 -0
  139. package/{components → package/components}/editor/Switch.svelte +0 -0
  140. package/{components → package/components}/editor/Switch.svelte.d.ts +0 -0
  141. package/{components → package/components}/editor/TableEditor.svelte +0 -0
  142. package/{components → package/components}/editor/TableEditor.svelte.d.ts +0 -0
  143. package/{components → package/components}/editor/TextEditor.svelte +2 -3
  144. package/{components → package/components}/editor/TextEditor.svelte.d.ts +0 -0
  145. package/{components → package/components}/editor/Toggle.svelte +0 -0
  146. package/{components → package/components}/editor/Toggle.svelte.d.ts +0 -0
  147. package/{components → package/components}/editor/Toolbar.svelte +8 -3
  148. package/{components → package/components}/editor/Toolbar.svelte.d.ts +0 -0
  149. package/{components → package/components}/editor/ToolbarGroup.svelte +0 -1
  150. package/{components → package/components}/editor/ToolbarGroup.svelte.d.ts +0 -0
  151. package/{components → package/components}/editor/ToolbarSpacer.svelte +0 -0
  152. package/{components → package/components}/editor/ToolbarSpacer.svelte.d.ts +0 -0
  153. package/{components → package/components}/editor/URLEditor.svelte +2 -0
  154. package/{components → package/components}/editor/URLEditor.svelte.d.ts +0 -0
  155. package/{components → package/components}/editor/UndoState.d.ts +0 -0
  156. package/{components → package/components}/editor/UndoState.js +0 -0
  157. package/{components → package/components}/editor/icons/annotate.svg +0 -0
  158. package/{components → package/components}/editor/icons/block.svg +0 -0
  159. package/{components → package/components}/editor/icons/bold.svg +0 -0
  160. package/{components → package/components}/editor/icons/bullets.svg +0 -0
  161. package/{components → package/components}/editor/icons/callout.svg +0 -0
  162. package/{components → package/components}/editor/icons/citation.svg +0 -0
  163. package/{components → package/components}/editor/icons/clear.svg +0 -0
  164. package/{components → package/components}/editor/icons/clipboard.svg +0 -0
  165. package/{components → package/components}/editor/icons/code.svg +0 -0
  166. package/{components → package/components}/editor/icons/columnafter.svg +0 -0
  167. package/{components → package/components}/editor/icons/columnbefore.svg +0 -0
  168. package/{components → package/components}/editor/icons/comment.svg +0 -0
  169. package/{components → package/components}/editor/icons/copy.svg +0 -0
  170. package/{components → package/components}/editor/icons/cut.svg +0 -0
  171. package/{components → package/components}/editor/icons/define.svg +0 -0
  172. package/{components → package/components}/editor/icons/deletecolumn.svg +0 -0
  173. package/{components → package/components}/editor/icons/deleterow.svg +0 -0
  174. package/{components → package/components}/editor/icons/footnote.svg +0 -0
  175. package/{components → package/components}/editor/icons/header1.svg +0 -0
  176. package/{components → package/components}/editor/icons/header2.svg +0 -0
  177. package/{components → package/components}/editor/icons/header3.svg +0 -0
  178. package/{components → package/components}/editor/icons/home.svg +0 -0
  179. package/{components → package/components}/editor/icons/indent.svg +0 -0
  180. package/{components → package/components}/editor/icons/italic.svg +0 -0
  181. package/{components → package/components}/editor/icons/label.svg +0 -0
  182. package/{components → package/components}/editor/icons/left.svg +0 -0
  183. package/{components → package/components}/editor/icons/level.svg +0 -0
  184. package/{components → package/components}/editor/icons/link.svg +0 -0
  185. package/{components → package/components}/editor/icons/list.svg +0 -0
  186. package/{components → package/components}/editor/icons/media.svg +0 -0
  187. package/{components → package/components}/editor/icons/middle.svg +0 -0
  188. package/{components → package/components}/editor/icons/numbers.svg +0 -0
  189. package/{components → package/components}/editor/icons/paragraph.svg +0 -0
  190. package/{components → package/components}/editor/icons/paste.svg +0 -0
  191. package/{components → package/components}/editor/icons/quote.svg +0 -0
  192. package/{components → package/components}/editor/icons/redo.svg +0 -0
  193. package/{components → package/components}/editor/icons/right.svg +0 -0
  194. package/{components → package/components}/editor/icons/rowabove.svg +0 -0
  195. package/{components → package/components}/editor/icons/rowbelow.svg +0 -0
  196. package/{components → package/components}/editor/icons/rule.svg +0 -0
  197. package/{components → package/components}/editor/icons/sub.svg +0 -0
  198. package/{components → package/components}/editor/icons/super.svg +0 -0
  199. package/{components → package/components}/editor/icons/table.svg +0 -0
  200. package/{components → package/components}/editor/icons/text.svg +0 -0
  201. package/{components → package/components}/editor/icons/time.svg +0 -0
  202. package/{components → package/components}/editor/icons/undo.svg +0 -0
  203. package/{components → package/components}/editor/icons/unindent.svg +0 -0
  204. package/{components → package/components}/editor/icons/unlink.svg +0 -0
  205. package/{components → package/components}/page/Acknowledgements.svelte +13 -11
  206. package/{components → package/components}/page/Acknowledgements.svelte.d.ts +0 -0
  207. package/package/components/page/Authors.svelte +86 -0
  208. package/{components → package/components}/page/Authors.svelte.d.ts +1 -0
  209. package/package/components/page/BookLoader.svelte +59 -0
  210. package/package/components/page/BookLoader.svelte.d.ts +16 -0
  211. package/{components → package/components}/page/BulkReferenceEditor.svelte +8 -8
  212. package/{components → package/components}/page/BulkReferenceEditor.svelte.d.ts +0 -0
  213. package/{components → package/components}/page/Chapter.svelte +69 -30
  214. package/{components → package/components}/page/Chapter.svelte.d.ts +0 -0
  215. package/{components → package/components}/page/ChapterContext.d.ts +0 -0
  216. package/{components → package/components}/page/ChapterContext.js +0 -0
  217. package/{components → package/components}/page/ChapterNumber.svelte +0 -0
  218. package/{components → package/components}/page/ChapterNumber.svelte.d.ts +0 -0
  219. package/{components → package/components}/page/ChapterTitle.svelte +0 -0
  220. package/{components → package/components}/page/ChapterTitle.svelte.d.ts +0 -0
  221. package/{components → package/components}/page/Contexts.d.ts +21 -5
  222. package/package/components/page/Contexts.js +144 -0
  223. package/{components → package/components}/page/DefinitionView.svelte +23 -14
  224. package/{components → package/components}/page/DefinitionView.svelte.d.ts +0 -0
  225. package/{components → package/components}/page/Description.svelte +12 -9
  226. package/{components → package/components}/page/Description.svelte.d.ts +0 -0
  227. package/{components → package/components}/page/Edition.svelte +9 -23
  228. package/{components → package/components}/page/Edition.svelte.d.ts +1 -2
  229. package/package/components/page/EditionLoader.svelte +99 -0
  230. package/package/components/page/EditionLoader.svelte.d.ts +18 -0
  231. package/package/components/page/Editions.svelte +109 -0
  232. package/{components → package/components}/page/Editions.svelte.d.ts +3 -1
  233. package/{components → package/components}/page/Glossary.svelte +13 -6
  234. package/{components → package/components}/page/Glossary.svelte.d.ts +0 -0
  235. package/{components → package/components}/page/Header.svelte +26 -21
  236. package/{components → package/components}/page/Header.svelte.d.ts +2 -0
  237. package/{components → package/components}/page/Index.svelte +14 -8
  238. package/{components → package/components}/page/Index.svelte.d.ts +0 -0
  239. package/{components → package/components}/page/Instructions.svelte +1 -2
  240. package/{components → package/components}/page/Instructions.svelte.d.ts +3 -1
  241. package/package/components/page/License.svelte +45 -0
  242. package/{components → package/components}/page/License.svelte.d.ts +0 -0
  243. package/{components → package/components}/page/Loading.svelte +0 -0
  244. package/{components → package/components}/page/Loading.svelte.d.ts +0 -0
  245. package/{components → package/components}/page/Media.svelte +40 -36
  246. package/{components → package/components}/page/Media.svelte.d.ts +0 -0
  247. package/package/components/page/MediaPreview.svelte +55 -0
  248. package/{components → package/components}/page/MediaPreview.svelte.d.ts +0 -0
  249. package/{components → package/components}/page/Muted.svelte +0 -0
  250. package/{components → package/components}/page/Muted.svelte.d.ts +0 -0
  251. package/{components → package/components}/page/Outline.svelte +69 -96
  252. package/{components → package/components}/page/Outline.svelte.d.ts +0 -0
  253. package/{components → package/components}/page/Page.svelte +4 -4
  254. package/{components → package/components}/page/Page.svelte.d.ts +0 -0
  255. package/{components → package/components}/page/PageHeader.svelte +5 -0
  256. package/{components → package/components}/page/PageHeader.svelte.d.ts +0 -0
  257. package/{components → package/components}/page/PageParagraph.svelte +0 -0
  258. package/{components → package/components}/page/PageParagraph.svelte.d.ts +0 -0
  259. package/{components → package/components}/page/PossibleChapter.svelte +0 -0
  260. package/{components → package/components}/page/PossibleChapter.svelte.d.ts +0 -0
  261. package/{components → package/components}/page/PossibleReference.svelte +2 -1
  262. package/{components → package/components}/page/PossibleReference.svelte.d.ts +1 -0
  263. package/{components → package/components}/page/Print.svelte +0 -0
  264. package/{components → package/components}/page/Print.svelte.d.ts +0 -0
  265. package/package/components/page/Publish.svelte +135 -0
  266. package/package/components/page/Publish.svelte.d.ts +14 -0
  267. package/{components → package/components}/page/Reference.svelte +54 -51
  268. package/{components → package/components}/page/Reference.svelte.d.ts +1 -0
  269. package/{components → package/components}/page/References.svelte +9 -4
  270. package/{components → package/components}/page/References.svelte.d.ts +0 -0
  271. package/{components → package/components}/page/Rows.svelte +0 -0
  272. package/{components → package/components}/page/Rows.svelte.d.ts +0 -0
  273. package/{components → package/components}/page/Search.svelte +27 -10
  274. package/{components → package/components}/page/Search.svelte.d.ts +0 -0
  275. package/package/components/page/Status.svelte +58 -0
  276. package/{components → package/components}/page/Status.svelte.d.ts +0 -0
  277. package/{components → package/components}/page/SubdomainEditor.svelte +5 -3
  278. package/{components → package/components}/page/SubdomainEditor.svelte.d.ts +0 -0
  279. package/{components → package/components}/page/TableOfContents.svelte +83 -37
  280. package/{components → package/components}/page/TableOfContents.svelte.d.ts +0 -0
  281. package/package/components/page/TableOfContentsImage.svelte +27 -0
  282. package/{components → package/components}/page/TableOfContentsImage.svelte.d.ts +1 -0
  283. package/{components → package/components}/page/TableOfContentsRow.svelte +11 -12
  284. package/{components → package/components}/page/TableOfContentsRow.svelte.d.ts +0 -0
  285. package/{components → package/components}/page/ThemeEditor.svelte +12 -10
  286. package/{components → package/components}/page/ThemeEditor.svelte.d.ts +0 -0
  287. package/{components → package/components}/page/ThemeEditorPreview.svelte +0 -0
  288. package/{components → package/components}/page/ThemeEditorPreview.svelte.d.ts +0 -0
  289. package/{components → package/components}/page/ThemeSetEditor.svelte +0 -0
  290. package/{components → package/components}/page/ThemeSetEditor.svelte.d.ts +0 -0
  291. package/{components → package/components}/page/ThemeVariableEditor.svelte +0 -0
  292. package/{components → package/components}/page/ThemeVariableEditor.svelte.d.ts +0 -0
  293. package/{components → package/components}/page/Title.svelte +0 -0
  294. package/{components → package/components}/page/Title.svelte.d.ts +0 -0
  295. package/{components → package/components}/page/Unknown.svelte +5 -2
  296. package/{components → package/components}/page/Unknown.svelte.d.ts +0 -0
  297. package/{components → package/components}/page/margins.d.ts +0 -0
  298. package/{components → package/components}/page/margins.js +0 -0
  299. package/{index.d.ts → package/index.d.ts} +3 -1
  300. package/{index.js → package/index.js} +3 -1
  301. package/package/models/CRUD.d.ts +28 -0
  302. package/package/models/CRUD.js +263 -0
  303. package/{models → package/models}/Firebase.d.ts +0 -0
  304. package/package/models/Firebase.js +36 -0
  305. package/{models → package/models}/book/Book.d.ts +23 -18
  306. package/package/models/book/Book.js +135 -0
  307. package/{models → package/models}/book/BookMedia.d.ts +1 -1
  308. package/{models → package/models}/book/BookMedia.js +9 -10
  309. package/{models → package/models}/book/BookSaveStatus.d.ts +0 -0
  310. package/{models → package/models}/book/BookSaveStatus.js +0 -0
  311. package/{models → package/models}/book/Chapter.d.ts +5 -1
  312. package/{models → package/models}/book/Chapter.js +24 -15
  313. package/{models → package/models}/book/ChapterID.d.ts +0 -0
  314. package/{models → package/models}/book/ChapterID.js +0 -0
  315. package/{models → package/models}/book/Definition.d.ts +0 -0
  316. package/{models → package/models}/book/Definition.js +0 -0
  317. package/{models → package/models}/book/Edition.d.ts +33 -7
  318. package/{models → package/models}/book/Edition.js +104 -32
  319. package/{models → package/models}/book/Reference.d.ts +0 -0
  320. package/{models → package/models}/book/Reference.js +0 -0
  321. package/{models → package/models}/book/Schema.d.ts +20 -15
  322. package/{models → package/models}/book/Schema.js +17 -16
  323. package/{models → package/models}/book/Theme.d.ts +0 -0
  324. package/{models → package/models}/book/Theme.js +7 -6
  325. package/{models → package/models}/book/ThemeColors.d.ts +0 -0
  326. package/{models → package/models}/book/ThemeColors.js +0 -0
  327. package/{models → package/models}/book/Words.d.ts +0 -0
  328. package/{models → package/models}/book/Words.js +0 -0
  329. package/{models → package/models}/chapter/AtomNode.d.ts +0 -0
  330. package/{models → package/models}/chapter/AtomNode.js +0 -0
  331. package/{models → package/models}/chapter/BlockNode.d.ts +0 -0
  332. package/{models → package/models}/chapter/BlockNode.js +0 -0
  333. package/{models → package/models}/chapter/BlocksNode.d.ts +0 -0
  334. package/{models → package/models}/chapter/BlocksNode.js +0 -0
  335. package/{models → package/models}/chapter/BlocksNode.test.d.ts +0 -0
  336. package/{models → package/models}/chapter/BlocksNode.test.js +0 -0
  337. package/{models → package/models}/chapter/Bookkeeping.d.ts +0 -0
  338. package/{models → package/models}/chapter/Bookkeeping.js +0 -0
  339. package/{models → package/models}/chapter/CalloutNode.d.ts +0 -0
  340. package/{models → package/models}/chapter/CalloutNode.js +0 -0
  341. package/{models → package/models}/chapter/Caret.d.ts +0 -0
  342. package/{models → package/models}/chapter/Caret.js +0 -0
  343. package/{models → package/models}/chapter/ChapterNode.d.ts +0 -0
  344. package/{models → package/models}/chapter/ChapterNode.js +0 -0
  345. package/{models → package/models}/chapter/CitationsNode.d.ts +0 -0
  346. package/{models → package/models}/chapter/CitationsNode.js +0 -0
  347. package/{models → package/models}/chapter/CodeNode.d.ts +0 -0
  348. package/{models → package/models}/chapter/CodeNode.js +0 -0
  349. package/{models → package/models}/chapter/CommentNode.d.ts +0 -0
  350. package/{models → package/models}/chapter/CommentNode.js +13 -3
  351. package/{models → package/models}/chapter/DefinitionNode.d.ts +0 -0
  352. package/{models → package/models}/chapter/DefinitionNode.js +0 -0
  353. package/{models → package/models}/chapter/Edit.d.ts +0 -0
  354. package/{models → package/models}/chapter/Edit.js +0 -0
  355. package/{models → package/models}/chapter/EmbedNode.d.ts +1 -0
  356. package/{models → package/models}/chapter/EmbedNode.js +6 -0
  357. package/{models → package/models}/chapter/ErrorNode.d.ts +0 -0
  358. package/{models → package/models}/chapter/ErrorNode.js +0 -0
  359. package/{models → package/models}/chapter/FootnoteNode.d.ts +0 -0
  360. package/{models → package/models}/chapter/FootnoteNode.js +0 -0
  361. package/{models → package/models}/chapter/FormatNode.d.ts +0 -0
  362. package/{models → package/models}/chapter/FormatNode.js +1 -6
  363. package/{models → package/models}/chapter/FormatNode.test.d.ts +0 -0
  364. package/{models → package/models}/chapter/FormatNode.test.js +0 -0
  365. package/{models → package/models}/chapter/InlineCodeNode.d.ts +0 -0
  366. package/{models → package/models}/chapter/InlineCodeNode.js +0 -0
  367. package/{models → package/models}/chapter/LabelNode.d.ts +0 -0
  368. package/{models → package/models}/chapter/LabelNode.js +0 -0
  369. package/{models → package/models}/chapter/LinkNode.d.ts +0 -0
  370. package/{models → package/models}/chapter/LinkNode.js +0 -0
  371. package/{models → package/models}/chapter/ListNode.d.ts +0 -0
  372. package/{models → package/models}/chapter/ListNode.js +0 -0
  373. package/{models → package/models}/chapter/ListNode.test.d.ts +0 -0
  374. package/{models → package/models}/chapter/ListNode.test.js +0 -0
  375. package/{models → package/models}/chapter/MetadataNode.d.ts +0 -0
  376. package/{models → package/models}/chapter/MetadataNode.js +0 -0
  377. package/{models → package/models}/chapter/Node.d.ts +0 -0
  378. package/{models → package/models}/chapter/Node.js +0 -0
  379. package/{models → package/models}/chapter/Node.test.d.ts +0 -0
  380. package/{models → package/models}/chapter/Node.test.js +0 -0
  381. package/{models → package/models}/chapter/ParagraphNode.d.ts +0 -0
  382. package/{models → package/models}/chapter/ParagraphNode.js +0 -0
  383. package/{models → package/models}/chapter/ParagraphNode.test.d.ts +0 -0
  384. package/{models → package/models}/chapter/ParagraphNode.test.js +0 -0
  385. package/{models → package/models}/chapter/Parser.d.ts +2 -2
  386. package/{models → package/models}/chapter/Parser.js +26 -24
  387. package/{models → package/models}/chapter/Parser.test.d.ts +0 -0
  388. package/{models → package/models}/chapter/Parser.test.js +0 -0
  389. package/{models → package/models}/chapter/Position.d.ts +0 -0
  390. package/{models → package/models}/chapter/Position.js +0 -0
  391. package/{models → package/models}/chapter/QuoteNode.d.ts +0 -0
  392. package/{models → package/models}/chapter/QuoteNode.js +0 -0
  393. package/{models → package/models}/chapter/RootNode.d.ts +0 -0
  394. package/{models → package/models}/chapter/RootNode.js +0 -0
  395. package/{models → package/models}/chapter/RuleNode.d.ts +0 -0
  396. package/{models → package/models}/chapter/RuleNode.js +0 -0
  397. package/{models → package/models}/chapter/TableNode.d.ts +0 -0
  398. package/{models → package/models}/chapter/TableNode.js +0 -0
  399. package/{models → package/models}/chapter/TableNode.test.d.ts +0 -0
  400. package/{models → package/models}/chapter/TableNode.test.js +0 -0
  401. package/{models → package/models}/chapter/TextNode.d.ts +0 -0
  402. package/{models → package/models}/chapter/TextNode.js +0 -0
  403. package/{models → package/models}/chapter/TextNode.test.d.ts +0 -0
  404. package/{models → package/models}/chapter/TextNode.test.js +0 -0
  405. package/package/util/dark.d.ts +2 -0
  406. package/package/util/dark.js +16 -0
  407. package/{util → package/util}/getSubdomain.d.ts +0 -0
  408. package/{util → package/util}/getSubdomain.js +0 -0
  409. package/{util → package/util}/isMobile.d.ts +0 -0
  410. package/{util → package/util}/isMobile.js +0 -0
  411. package/{util → package/util}/mineReference.d.ts +0 -0
  412. package/{util → package/util}/mineReference.js +0 -0
  413. package/{util → package/util}/scrollToEyeLevel.d.ts +0 -0
  414. package/{util → package/util}/scrollToEyeLevel.js +0 -0
  415. package/package.json +955 -267
  416. package/components/External.svelte +0 -4
  417. package/components/External.svelte.d.ts +0 -18
  418. package/components/app/Link.svelte +0 -24
  419. package/components/app/Writing.svelte.d.ts +0 -27
  420. package/components/editor/ConfirmButton.svelte +0 -49
  421. package/components/page/Authors.svelte +0 -82
  422. package/components/page/Contexts.js +0 -51
  423. package/components/page/Editions.svelte +0 -158
  424. package/components/page/License.svelte +0 -37
  425. package/components/page/MediaPreview.svelte +0 -29
  426. package/components/page/Status.svelte +0 -57
  427. package/components/page/TableOfContentsImage.svelte +0 -15
  428. package/models/CRUD.d.ts +0 -17
  429. package/models/CRUD.js +0 -207
  430. package/models/Firebase.js +0 -32
  431. package/models/book/Book.js +0 -142
  432. package/models/loadEdition.d.ts +0 -5
  433. package/models/loadEdition.js +0 -20
@@ -11,6 +11,7 @@ export default class Chapter {
11
11
  forthcoming;
12
12
  section;
13
13
  text;
14
+ uids;
14
15
  // Derived values
15
16
  _ast = undefined;
16
17
  _index = undefined;
@@ -21,7 +22,7 @@ export default class Chapter {
21
22
  lastEdit = 0;
22
23
  // A set of listeners that are notified when the chapter text changes.
23
24
  listeners = new Set();
24
- constructor(ref, id, title, authors, image, numbered, forthcoming, section, text) {
25
+ constructor(ref, id, title, authors, image, numbered, forthcoming, section, text, uids) {
25
26
  this.ref = ref;
26
27
  this.id = id;
27
28
  this.title = title;
@@ -31,6 +32,7 @@ export default class Chapter {
31
32
  this.forthcoming = forthcoming;
32
33
  this.section = section;
33
34
  this.text = text;
35
+ this.uids = uids;
34
36
  }
35
37
  /**
36
38
  * Convert a chapter spec and it's text into a chapter object.
@@ -39,7 +41,7 @@ export default class Chapter {
39
41
  */
40
42
  static fromJSON(spec, text) {
41
43
  // Copy the spec, filling in defaults as necessary.
42
- return new Chapter(spec.ref, spec.id, spec.title, spec.authors ?? [], spec.image ?? null, spec.numbered === true || spec.numbered === undefined, spec.forthcoming === true, spec.section, spec.text ?? text);
44
+ return new Chapter(spec.ref, spec.id, spec.title, spec.authors ?? [], spec.image ?? null, spec.numbered === true || spec.numbered === undefined, spec.forthcoming === true, spec.section, spec.text ?? text, spec.uids);
43
45
  }
44
46
  toJSON() {
45
47
  // Note that we don't include the chapter text in the payload; that's stored in the chapters subcollection.
@@ -51,6 +53,7 @@ export default class Chapter {
51
53
  image: this.image,
52
54
  numbered: this.numbered,
53
55
  forthcoming: this.forthcoming,
56
+ uids: this.uids,
54
57
  };
55
58
  if (this.ref)
56
59
  json.ref = this.ref;
@@ -61,44 +64,50 @@ export default class Chapter {
61
64
  getRef() {
62
65
  return this.ref;
63
66
  }
67
+ withEditors(uids) {
68
+ return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text, uids);
69
+ }
64
70
  withRef(ref) {
65
- return new Chapter(ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text);
71
+ return new Chapter(ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
66
72
  }
67
73
  withoutRef() {
68
- return new Chapter(undefined, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text);
74
+ return new Chapter(undefined, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
69
75
  }
70
76
  getID() {
71
77
  return this.id;
72
78
  }
73
79
  withChapterID(id) {
74
- return new Chapter(this.ref, id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text);
80
+ return new Chapter(this.ref, id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
75
81
  }
76
82
  getSection() {
77
83
  return this.section;
78
84
  }
79
85
  withSection(section) {
80
- return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, section, this.text);
86
+ return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, section, this.text, this.uids);
81
87
  }
82
88
  isForthcoming() {
83
89
  return this.forthcoming;
84
90
  }
85
91
  asForthcoming(forthcoming) {
86
- return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, forthcoming, this.section, this.text);
92
+ return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, forthcoming, this.section, this.text, this.uids);
87
93
  }
88
94
  isNumbered() {
89
95
  return this.numbered;
90
96
  }
91
97
  asNumbered(numbered) {
92
- return new Chapter(this.ref, this.id, this.title, this.authors, this.image, numbered, this.forthcoming, this.section, this.text);
98
+ return new Chapter(this.ref, this.id, this.title, this.authors, this.image, numbered, this.forthcoming, this.section, this.text, this.uids);
99
+ }
100
+ isEditor(uid) {
101
+ return this.uids.includes(uid);
93
102
  }
94
103
  getText() {
95
104
  return this.text;
96
105
  }
97
106
  withText(text) {
98
- return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, text);
107
+ return new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, text, this.uids);
99
108
  }
100
109
  withAST(ast) {
101
- const newChapter = new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, ast.toBookdown());
110
+ const newChapter = new Chapter(this.ref, this.id, this.title, this.authors, this.image, this.numbered, this.forthcoming, this.section, ast.toBookdown(), this.uids);
102
111
  newChapter._ast = ast;
103
112
  return newChapter;
104
113
  }
@@ -106,7 +115,7 @@ export default class Chapter {
106
115
  return this.authors;
107
116
  }
108
117
  withAuthor(name) {
109
- return new Chapter(this.ref, this.id, this.title, [...this.authors, name], this.image, this.numbered, this.forthcoming, this.section, this.text);
118
+ return new Chapter(this.ref, this.id, this.title, [...this.authors, name], this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
110
119
  }
111
120
  withRenamedAuthor(index, name) {
112
121
  if (index < 0 || index >= this.authors.length)
@@ -115,24 +124,24 @@ export default class Chapter {
115
124
  ...this.authors.slice(0, index),
116
125
  name,
117
126
  ...this.authors.slice(index + 1),
118
- ], this.image, this.numbered, this.forthcoming, this.section, this.text);
127
+ ], this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
119
128
  }
120
129
  withoutAuthor(index) {
121
130
  if (index < 0 || index >= this.authors.length)
122
131
  return this;
123
- return new Chapter(this.ref, this.id, this.title, [...this.authors.slice(0, index), ...this.authors.slice(index + 1)], this.image, this.numbered, this.forthcoming, this.section, this.text);
132
+ return new Chapter(this.ref, this.id, this.title, [...this.authors.slice(0, index), ...this.authors.slice(index + 1)], this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
124
133
  }
125
134
  getTitle() {
126
135
  return this.title;
127
136
  }
128
137
  withTitle(title) {
129
- return new Chapter(this.ref, this.id, title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text);
138
+ return new Chapter(this.ref, this.id, title, this.authors, this.image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
130
139
  }
131
140
  getImage() {
132
141
  return this.image;
133
142
  }
134
143
  withImage(image) {
135
- return new Chapter(this.ref, this.id, this.title, this.authors, image, this.numbered, this.forthcoming, this.section, this.text);
144
+ return new Chapter(this.ref, this.id, this.title, this.authors, image, this.numbered, this.forthcoming, this.section, this.text, this.uids);
136
145
  }
137
146
  getAST(edition) {
138
147
  // Compute the cache if necessary
File without changes
File without changes
File without changes
File without changes
@@ -7,9 +7,13 @@ import type Definition from './Definition.js';
7
7
  import type { DocumentReference } from 'firebase/firestore';
8
8
  import type Book from './Book';
9
9
  import type FormatNode from '../chapter/FormatNode';
10
+ import type { EditionInfo } from './Book';
10
11
  export type EditionSpecification = {
11
- bookRef?: DocumentReference;
12
+ bookRef: DocumentReference;
12
13
  title: string;
14
+ number: number;
15
+ summary: string;
16
+ published: number | null;
13
17
  authors: string[];
14
18
  images: Record<string, string | null>;
15
19
  description: string;
@@ -22,14 +26,20 @@ export type EditionSpecification = {
22
26
  symbols: Record<string, string>;
23
27
  glossary: Record<string, Definition>;
24
28
  theme: Theme | null;
29
+ base: string | null;
25
30
  uids: string[];
31
+ chapteruids: string[];
32
+ active: Record<string, string>;
26
33
  };
27
34
  export default class Edition {
28
- readonly bookRef: DocumentReference | undefined;
35
+ readonly bookRef: DocumentReference;
29
36
  readonly editionRef: DocumentReference | undefined;
30
37
  readonly uids: string[];
31
38
  readonly title: string;
32
39
  readonly authors: string[];
40
+ readonly number: number;
41
+ readonly summary: string;
42
+ readonly published: number | null;
33
43
  readonly images: Record<string, string | null>;
34
44
  readonly description: string;
35
45
  readonly chapters: Chapter[];
@@ -41,18 +51,24 @@ export default class Edition {
41
51
  readonly symbols: Record<string, string>;
42
52
  readonly glossary: Record<string, Definition>;
43
53
  readonly theme: Theme | null;
44
- constructor(bookRef: DocumentReference | undefined, editionRef: DocumentReference | undefined, uids: string[], title: string, authors: string[], images: Record<string, string | null>, description: string, chapters: Chapter[], license: string, acknowledgements: string, tags: string[], sources: Record<string, string>, references: Record<string, string | string[]> | Record<string, FormatNode | Reference>, symbols: Record<string, string>, glossary: Record<string, Definition>, theme: Theme | null);
54
+ readonly base: string | null;
55
+ readonly active: Record<string, string>;
56
+ constructor(bookRef: DocumentReference, editionRef: DocumentReference | undefined, uids: string[], title: string, authors: string[], number: number, summary: string, published: number | null, images: Record<string, string | null>, description: string, chapters: Chapter[], license: string, acknowledgements: string, tags: string[], sources: Record<string, string>, references: Record<string, string | string[]> | Record<string, FormatNode | Reference>, symbols: Record<string, string>, glossary: Record<string, Definition>, theme: Theme | null, base: string | null, active: Record<string, string>);
45
57
  static fromJSON(editionRef: DocumentReference | undefined, spec: EditionSpecification): Edition;
46
58
  static parseReference(citationID: string, ref: string | string[], edition: Edition, short?: boolean): FormatNode | Reference;
47
59
  toObject(): EditionSpecification;
48
- getRef(): DocumentReference<import("@firebase/firestore").DocumentData> | undefined;
60
+ getBookRef(): DocumentReference<import("@firebase/firestore").DocumentData>;
61
+ getEditionRef(): DocumentReference<import("@firebase/firestore").DocumentData> | undefined;
62
+ getChapterUIDS(): string[];
49
63
  withRef(editionRef: DocumentReference | undefined): Edition;
50
64
  getTitle(): string;
51
65
  withTitle(title: string): Edition;
52
66
  getDescription(): string;
53
67
  setDescription(description: string): Edition;
54
68
  getAcknowledgements(): string;
55
- setAcknowledgements(acks: string): Edition;
69
+ withAcknowledgements(acks: string): Edition;
70
+ withSummary(summary: string): Edition;
71
+ asPublished(published: boolean): Edition;
56
72
  getLicense(): string;
57
73
  setLicense(license: string): Edition;
58
74
  getChapters(): Chapter[];
@@ -62,8 +78,10 @@ export default class Edition {
62
78
  getChapterPosition(chapterID: string): number | undefined;
63
79
  getChapterCount(): number;
64
80
  withChapters(chapters: Chapter[]): Edition;
81
+ withChapterText(text: [DocumentReference, string][]): Edition;
65
82
  withRevisedChapter(previous: Chapter, edited: Chapter): Edition;
66
83
  withoutRefs(): Edition;
84
+ withIncrementedEditionNumber(): Edition;
67
85
  withNewChapter(): Edition;
68
86
  withoutChapter(chapterID: string): Edition;
69
87
  withMovedChapter(chapterID: string, increment: number): Edition;
@@ -93,9 +111,16 @@ export default class Edition {
93
111
  withAuthor(name: string): Edition;
94
112
  withAuthorName(index: number, name: string): Edition;
95
113
  withoutAuthor(index: number): Edition;
114
+ withEditors(uids: string[]): Edition;
96
115
  hasImage(id: string): boolean;
97
116
  getImage(id: string): string | null;
98
117
  withImage(id: string, embed: string | null): Edition;
118
+ isEditor(uid: string): boolean;
119
+ isChapterEditor(uid: string): boolean;
120
+ getLeasee(content: string): string | undefined;
121
+ hasLease(uid: string, content: string): boolean;
122
+ isLeased(contentID: string): boolean;
123
+ withLock(uid: string, content: string, lock: boolean): Edition;
99
124
  getBookReadingTime(): number | undefined;
100
125
  getChapterNumber(chapterID: string): undefined;
101
126
  getSource(sourceID: string): string | null;
@@ -108,6 +133,7 @@ export default class Edition {
108
133
  getEmbeds(): EmbedNode[];
109
134
  isLatestEdition(book: Book): boolean;
110
135
  isLatestPublishedEdition(book: Book): boolean;
111
- getEditionNumber(book: Book): number | undefined;
112
- getEditionLabel(book: Book): string;
136
+ getEditionNumber(): number;
137
+ getEditionLabel(): string;
138
+ getInfo(): EditionInfo | undefined;
113
139
  }
@@ -9,6 +9,9 @@ export default class Edition {
9
9
  uids;
10
10
  title;
11
11
  authors;
12
+ number;
13
+ summary;
14
+ published;
12
15
  images;
13
16
  description;
14
17
  chapters;
@@ -20,14 +23,19 @@ export default class Edition {
20
23
  symbols;
21
24
  glossary;
22
25
  theme;
26
+ base;
27
+ active;
23
28
  // Given an object with a valid specification and an object mapping chapter IDs to chapter text,
24
29
  // construct an object representing a book.
25
- constructor(bookRef, editionRef, uids, title, authors, images, description, chapters, license, acknowledgements, tags, sources, references, symbols, glossary, theme) {
30
+ constructor(bookRef, editionRef, uids, title, authors, number, summary, published, images, description, chapters, license, acknowledgements, tags, sources, references, symbols, glossary, theme, base, active) {
26
31
  this.bookRef = bookRef;
27
32
  this.editionRef = editionRef;
28
33
  this.uids = uids;
29
34
  this.title = title;
30
35
  this.authors = authors;
36
+ this.number = number;
37
+ this.summary = summary;
38
+ this.published = published;
31
39
  this.images = images;
32
40
  this.description = description;
33
41
  this.chapters = chapters.slice();
@@ -45,11 +53,13 @@ export default class Edition {
45
53
  this.symbols = Object.assign({}, symbols);
46
54
  this.glossary = Object.assign({}, glossary);
47
55
  this.theme = theme;
56
+ this.base = base;
57
+ this.active = active;
48
58
  }
49
59
  static fromJSON(editionRef, spec) {
50
60
  // Copy all of the specification metadata to fields.
51
61
  // Choose suitable defaults if the spec is lacking a field.
52
- return new Edition(spec.bookRef, editionRef, spec.uids, spec.title, spec.authors, spec.images, spec.description, spec.chapters.map((chap) => Chapter.fromJSON(chap, '')), spec.license, spec.acknowledgements, spec.tags, spec.sources, spec.references, spec.symbols, spec.glossary, spec.theme);
62
+ return new Edition(spec.bookRef, editionRef, spec.uids, spec.title, spec.authors, spec.number, spec.summary, spec.published, spec.images, spec.description, spec.chapters.map((chap) => Chapter.fromJSON(chap, '')), spec.license, spec.acknowledgements, spec.tags ?? [], spec.sources ?? {}, spec.references ?? {}, spec.symbols ?? {}, spec.glossary ?? {}, spec.theme, spec.base ?? '', spec.active);
53
63
  }
54
64
  static parseReference(citationID, ref, edition, short = false) {
55
65
  if (typeof ref === 'string')
@@ -72,8 +82,12 @@ export default class Edition {
72
82
  references[citationID] =
73
83
  ref instanceof Reference ? ref.toList() : ref.toBookdown();
74
84
  const editionJSON = {
85
+ bookRef: this.bookRef,
75
86
  title: this.title,
76
87
  authors: this.authors,
88
+ number: this.number,
89
+ summary: this.summary,
90
+ published: this.published,
77
91
  images: Object.assign({}, this.images),
78
92
  description: this.description,
79
93
  chapters: this.chapters.map((chap) => chap.toJSON()),
@@ -85,41 +99,54 @@ export default class Edition {
85
99
  symbols: Object.assign({}, this.symbols),
86
100
  glossary: Object.assign({}, this.glossary),
87
101
  theme: this.theme,
102
+ base: this.base,
88
103
  uids: this.uids.slice(),
104
+ chapteruids: this.getChapterUIDS(),
105
+ active: this.active,
89
106
  };
90
- if (this.bookRef)
91
- editionJSON.bookRef = this.bookRef;
92
107
  return editionJSON;
93
108
  }
94
- getRef() {
109
+ getBookRef() {
110
+ return this.bookRef;
111
+ }
112
+ getEditionRef() {
95
113
  return this.editionRef;
96
114
  }
115
+ getChapterUIDS() {
116
+ return Array.from(new Set(this.chapters.map((chapter) => chapter.uids).flat()));
117
+ }
97
118
  withRef(editionRef) {
98
- return new Edition(this.bookRef, editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
119
+ return new Edition(this.bookRef, editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
99
120
  }
100
121
  getTitle() {
101
122
  return this.title;
102
123
  }
103
124
  withTitle(title) {
104
- return new Edition(this.bookRef, this.editionRef, this.uids, title, this.authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
125
+ return new Edition(this.bookRef, this.editionRef, this.uids, title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
105
126
  }
106
127
  getDescription() {
107
128
  return this.description;
108
129
  }
109
130
  setDescription(description) {
110
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
131
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
111
132
  }
112
133
  getAcknowledgements() {
113
134
  return this.acknowledgements;
114
135
  }
115
- setAcknowledgements(acks) {
116
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, this.license, acks, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
136
+ withAcknowledgements(acks) {
137
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, acks, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
138
+ }
139
+ withSummary(summary) {
140
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
141
+ }
142
+ asPublished(published) {
143
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, published ? Date.now() : null, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
117
144
  }
118
145
  getLicense() {
119
146
  return this.license;
120
147
  }
121
148
  setLicense(license) {
122
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
149
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
123
150
  }
124
151
  getChapters() {
125
152
  return this.chapters.slice();
@@ -145,7 +172,18 @@ export default class Edition {
145
172
  return this.chapters.length;
146
173
  }
147
174
  withChapters(chapters) {
148
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
175
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
176
+ }
177
+ withChapterText(text) {
178
+ return this.withChapters(this.chapters.map((chapter) => {
179
+ if (chapter.ref === undefined)
180
+ return chapter;
181
+ const match = text.find(([ref, text]) => chapter.ref !== undefined &&
182
+ chapter.ref.id === ref.id &&
183
+ chapter.text !== text &&
184
+ text !== undefined);
185
+ return match ? chapter.withText(match[1]) : chapter;
186
+ }));
149
187
  }
150
188
  withRevisedChapter(previous, edited) {
151
189
  const index = this.chapters.indexOf(previous);
@@ -160,13 +198,16 @@ export default class Edition {
160
198
  withoutRefs() {
161
199
  return this.withRef(undefined).withChapters(this.chapters.map((chap) => chap.withoutRef()));
162
200
  }
201
+ withIncrementedEditionNumber() {
202
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number + 1, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
203
+ }
163
204
  withNewChapter() {
164
205
  // Synthesize a chapter ID placeholder that doesn't overlap with existing chapter names
165
206
  let number = 1;
166
207
  while (this.hasChapter('chapter' + number))
167
208
  number++;
168
209
  // Create a default chapter on this model. Remember the document reference so we can modify it later.
169
- const newChapter = new Chapter(undefined, `chapter${number}`, 'Untitled Chapter', [], null, true, false, undefined, '');
210
+ const newChapter = new Chapter(undefined, `chapter${number}`, 'Untitled Chapter', [], null, true, false, undefined, '', []);
170
211
  return this.withChapters([...this.chapters, newChapter]);
171
212
  }
172
213
  withoutChapter(chapterID) {
@@ -187,7 +228,7 @@ export default class Edition {
187
228
  const temp = newChapters[index + increment];
188
229
  newChapters[index + increment] = newChapters[index];
189
230
  newChapters[index] = temp;
190
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, newChapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
231
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, newChapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
191
232
  }
192
233
  getSymbols() {
193
234
  return this.symbols;
@@ -204,7 +245,7 @@ export default class Edition {
204
245
  : undefined;
205
246
  }
206
247
  withReferences(newReferences) {
207
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, newReferences, this.symbols, this.glossary, this.theme);
248
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, newReferences, this.symbols, this.glossary, this.theme, this.base, this.active);
208
249
  }
209
250
  withNewReferences(references) {
210
251
  const newReferences = Object.assign({}, this.references);
@@ -245,7 +286,7 @@ export default class Edition {
245
286
  return id in this.glossary;
246
287
  }
247
288
  withGlossary(glossary) {
248
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, glossary, this.theme);
289
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, glossary, this.theme, this.base, this.active);
249
290
  }
250
291
  withDefinition(id, phrase, definition, synonyms) {
251
292
  const newGlossary = Object.assign({}, this.glossary);
@@ -282,7 +323,7 @@ export default class Edition {
282
323
  return this.theme;
283
324
  }
284
325
  withTheme(theme) {
285
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, theme);
326
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, theme, this.base, this.active);
286
327
  }
287
328
  withThemeValue(group, name, value) {
288
329
  if (this.theme === null)
@@ -300,7 +341,7 @@ export default class Edition {
300
341
  return [...this.authors];
301
342
  }
302
343
  withAuthors(authors) {
303
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, authors, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
344
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
304
345
  }
305
346
  withAuthor(name) {
306
347
  return this.withAuthors([...this.authors, name]);
@@ -322,6 +363,9 @@ export default class Edition {
322
363
  ...this.authors.slice(index + 1),
323
364
  ]);
324
365
  }
366
+ withEditors(uids) {
367
+ return new Edition(this.bookRef, this.editionRef, uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
368
+ }
325
369
  hasImage(id) {
326
370
  return this.images[id] !== null;
327
371
  }
@@ -331,7 +375,30 @@ export default class Edition {
331
375
  withImage(id, embed) {
332
376
  const newImages = Object.assign({}, this.images);
333
377
  newImages[id] = embed;
334
- return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, newImages, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme);
378
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, newImages, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, this.active);
379
+ }
380
+ isEditor(uid) {
381
+ return this.uids.includes(uid);
382
+ }
383
+ isChapterEditor(uid) {
384
+ return this.getChapterUIDS().includes(uid);
385
+ }
386
+ getLeasee(content) {
387
+ return this.active[content];
388
+ }
389
+ hasLease(uid, content) {
390
+ return this.active[content] === uid;
391
+ }
392
+ isLeased(contentID) {
393
+ return contentID in this.active;
394
+ }
395
+ withLock(uid, content, lock) {
396
+ const newActive = Object.assign({}, this.active);
397
+ if (lock)
398
+ newActive[content] = uid;
399
+ else
400
+ delete newActive[content];
401
+ return new Edition(this.bookRef, this.editionRef, this.uids, this.title, this.authors, this.number, this.summary, this.published, this.images, this.description, this.chapters, this.license, this.acknowledgements, this.tags, this.sources, this.references, this.symbols, this.glossary, this.theme, this.base, newActive);
335
402
  }
336
403
  getBookReadingTime() {
337
404
  return this.chapters
@@ -531,18 +598,23 @@ export default class Edition {
531
598
  return (latestEditionID !== undefined &&
532
599
  latestEditionID === this.editionRef?.id);
533
600
  }
534
- /* Edition numbers are 1 to N */
535
- getEditionNumber(book) {
536
- const revisions = book.getEditions();
537
- if (revisions === undefined)
538
- return undefined;
539
- for (let i = 0; i < revisions.length; i++)
540
- if (revisions[i].ref.id === this.editionRef?.id)
541
- return revisions.length - i;
542
- return undefined;
543
- }
544
- getEditionLabel(book) {
545
- const num = this.getEditionNumber(book);
546
- return `${num}${num === 1 ? 'st' : num === 2 ? 'nd' : num === 3 ? 'rd' : 'th'}`;
601
+ getEditionNumber() {
602
+ return this.number;
603
+ }
604
+ getEditionLabel() {
605
+ const num = this.number;
606
+ return `${num}${num === 1 ? 'st' : num === 2 ? 'nd' : num === 3 ? 'rd' : ''}`;
607
+ }
608
+ getInfo() {
609
+ return this.editionRef === undefined
610
+ ? undefined
611
+ : {
612
+ ref: this.editionRef,
613
+ summary: this.summary,
614
+ number: this.number,
615
+ published: this.published,
616
+ editionuids: this.uids,
617
+ chapteruids: Array.from(new Set(this.chapters.map((chapter) => chapter.uids).flat())),
618
+ };
547
619
  }
548
620
  }
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- export declare const Schema: {
1
+ declare const Schema: {
2
2
  $schema: string;
3
3
  title: string;
4
4
  type: string;
@@ -14,6 +14,15 @@ export declare const Schema: {
14
14
  title: {
15
15
  type: string;
16
16
  };
17
+ number: {
18
+ type: string;
19
+ };
20
+ summary: {
21
+ type: string;
22
+ };
23
+ published: {
24
+ type: string[];
25
+ };
17
26
  authors: {
18
27
  type: string;
19
28
  items: {
@@ -84,17 +93,6 @@ export declare const Schema: {
84
93
  };
85
94
  };
86
95
  };
87
- revisions: {
88
- type: string;
89
- items: {
90
- type: string;
91
- minItems: number;
92
- maxItems: number;
93
- items: {
94
- type: string;
95
- };
96
- };
97
- };
98
96
  tags: {
99
97
  type: string;
100
98
  items: {
@@ -115,15 +113,18 @@ export declare const Schema: {
115
113
  additionalProperties: {
116
114
  oneOf: ({
117
115
  type: string;
118
- maxItems?: undefined;
116
+ minItems?: undefined;
119
117
  items?: undefined;
120
118
  additionalItems?: undefined;
121
119
  } | {
122
120
  type: string;
123
- maxItems: number;
121
+ minItems: number;
124
122
  items: ({
125
123
  type: string;
126
124
  format?: undefined;
125
+ } | {
126
+ type: string[];
127
+ format?: undefined;
127
128
  } | {
128
129
  type: string[];
129
130
  format: string;
@@ -163,7 +164,11 @@ export declare const Schema: {
163
164
  };
164
165
  };
165
166
  theme: {
166
- type: string;
167
+ type: string[];
168
+ };
169
+ base: {
170
+ type: string[];
167
171
  };
168
172
  };
169
173
  };
174
+ export default Schema;