bookish-press 0.7.4 → 0.8.2

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 (249) hide show
  1. package/README.md +8 -0
  2. package/dist/components/Auth.svelte +29 -39
  3. package/dist/components/Auth.svelte.d.ts +5 -17
  4. package/dist/components/BookPreview.svelte +14 -20
  5. package/dist/components/BookPreview.svelte.d.ts +6 -18
  6. package/dist/components/Link.svelte +19 -30
  7. package/dist/components/Link.svelte.d.ts +7 -20
  8. package/dist/components/app/BookList.svelte +2 -3
  9. package/dist/components/app/BookList.svelte.d.ts +6 -18
  10. package/dist/components/app/Button.svelte +12 -8
  11. package/dist/components/app/Button.svelte.d.ts +10 -23
  12. package/dist/components/app/Feedback.svelte +4 -4
  13. package/dist/components/app/Feedback.svelte.d.ts +6 -19
  14. package/dist/components/app/Head.svelte +2 -2
  15. package/dist/components/app/Head.svelte.d.ts +6 -19
  16. package/dist/components/app/Large.svelte +4 -1
  17. package/dist/components/app/Large.svelte.d.ts +5 -28
  18. package/dist/components/app/Lead.svelte +4 -1
  19. package/dist/components/app/Lead.svelte.d.ts +5 -28
  20. package/dist/components/app/Link.svelte +12 -9
  21. package/dist/components/app/Link.svelte.d.ts +9 -22
  22. package/dist/components/app/Options.svelte +8 -6
  23. package/dist/components/app/Options.svelte.d.ts +8 -20
  24. package/dist/components/app/Paragraph.svelte +2 -2
  25. package/dist/components/app/Paragraph.svelte.d.ts +6 -19
  26. package/dist/components/app/Section.svelte +4 -1
  27. package/dist/components/app/Section.svelte.d.ts +5 -28
  28. package/dist/components/app/Table.svelte +4 -1
  29. package/dist/components/app/Table.svelte.d.ts +5 -28
  30. package/dist/components/app/TextInput.svelte +10 -8
  31. package/dist/components/app/TextInput.svelte.d.ts +12 -23
  32. package/dist/components/chapter/Atom.svelte +4 -7
  33. package/dist/components/chapter/Atom.svelte.d.ts +6 -19
  34. package/dist/components/chapter/Block.svelte +21 -23
  35. package/dist/components/chapter/Block.svelte.d.ts +5 -17
  36. package/dist/components/chapter/Callout.svelte +3 -5
  37. package/dist/components/chapter/Callout.svelte.d.ts +5 -17
  38. package/dist/components/chapter/CaptionedCode.svelte +12 -14
  39. package/dist/components/chapter/CaptionedCode.svelte.d.ts +5 -17
  40. package/dist/components/chapter/ChapterBody.svelte +14 -17
  41. package/dist/components/chapter/ChapterBody.svelte.d.ts +7 -19
  42. package/dist/components/chapter/ChapterBody.test.d.ts +1 -0
  43. package/dist/components/chapter/ChapterBody.test.js +85 -0
  44. package/dist/components/chapter/Citations.svelte +39 -45
  45. package/dist/components/chapter/Citations.svelte.d.ts +5 -17
  46. package/dist/components/chapter/Code.svelte +158 -155
  47. package/dist/components/chapter/Code.svelte.d.ts +10 -23
  48. package/dist/components/chapter/Comment.svelte +30 -23
  49. package/dist/components/chapter/Comment.svelte.d.ts +5 -17
  50. package/dist/components/chapter/Definition.svelte +36 -34
  51. package/dist/components/chapter/Definition.svelte.d.ts +5 -17
  52. package/dist/components/chapter/Embed.svelte +78 -72
  53. package/dist/components/chapter/Embed.svelte.d.ts +8 -20
  54. package/dist/components/chapter/ErrorMessage.svelte +2 -4
  55. package/dist/components/chapter/ErrorMessage.svelte.d.ts +5 -17
  56. package/dist/components/chapter/Figure.svelte +22 -29
  57. package/dist/components/chapter/Figure.svelte.d.ts +9 -22
  58. package/dist/components/chapter/Footnote.svelte +40 -32
  59. package/dist/components/chapter/Footnote.svelte.d.ts +5 -17
  60. package/dist/components/chapter/Format.svelte +26 -41
  61. package/dist/components/chapter/Format.svelte.d.ts +7 -18
  62. package/dist/components/chapter/InlineCode.svelte +7 -8
  63. package/dist/components/chapter/InlineCode.svelte.d.ts +5 -17
  64. package/dist/components/chapter/Label.svelte +5 -11
  65. package/dist/components/chapter/Label.svelte.d.ts +5 -17
  66. package/dist/components/chapter/LineBreak.svelte +1 -3
  67. package/dist/components/chapter/LineBreak.svelte.d.ts +5 -17
  68. package/dist/components/chapter/Link.svelte +17 -23
  69. package/dist/components/chapter/Link.svelte.d.ts +5 -17
  70. package/dist/components/chapter/List.svelte +9 -9
  71. package/dist/components/chapter/List.svelte.d.ts +6 -17
  72. package/dist/components/chapter/Marginal.svelte +59 -60
  73. package/dist/components/chapter/Marginal.svelte.d.ts +10 -22
  74. package/dist/components/chapter/Paragraph.svelte +8 -23
  75. package/dist/components/chapter/Paragraph.svelte.d.ts +6 -18
  76. package/dist/components/chapter/Positioned.svelte +2 -4
  77. package/dist/components/chapter/Positioned.svelte.d.ts +6 -19
  78. package/dist/components/chapter/Problem.svelte +3 -2
  79. package/dist/components/chapter/Problem.svelte.d.ts +5 -28
  80. package/dist/components/chapter/Python.svelte +45 -58
  81. package/dist/components/chapter/Python.svelte.d.ts +6 -18
  82. package/dist/components/chapter/Quote.svelte +5 -7
  83. package/dist/components/chapter/Quote.svelte.d.ts +5 -17
  84. package/dist/components/chapter/Rule.svelte +1 -3
  85. package/dist/components/chapter/Rule.svelte.d.ts +5 -17
  86. package/dist/components/chapter/Table.svelte +6 -8
  87. package/dist/components/chapter/Table.svelte.d.ts +5 -17
  88. package/dist/components/chapter/Text.svelte +54 -69
  89. package/dist/components/chapter/Text.svelte.d.ts +6 -18
  90. package/dist/components/controls/DarkToggle.svelte +7 -8
  91. package/dist/components/controls/DarkToggle.svelte.d.ts +6 -18
  92. package/dist/components/editor/BookishEditor.svelte +583 -761
  93. package/dist/components/editor/BookishEditor.svelte.d.ts +14 -26
  94. package/dist/components/editor/CalloutEditor.svelte +3 -3
  95. package/dist/components/editor/CalloutEditor.svelte.d.ts +5 -17
  96. package/dist/components/editor/CaptionedCodeEditor.svelte +5 -5
  97. package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +5 -17
  98. package/dist/components/editor/CaretView.svelte +23 -25
  99. package/dist/components/editor/CaretView.svelte.d.ts +15 -27
  100. package/dist/components/editor/CitationsEditor.svelte +25 -28
  101. package/dist/components/editor/CitationsEditor.svelte.d.ts +5 -17
  102. package/dist/components/editor/ConfirmButton.svelte +9 -6
  103. package/dist/components/editor/ConfirmButton.svelte.d.ts +8 -21
  104. package/dist/components/editor/DefinitionEditor.svelte +11 -15
  105. package/dist/components/editor/DefinitionEditor.svelte.d.ts +5 -17
  106. package/dist/components/editor/EmbedEditor.svelte +43 -44
  107. package/dist/components/editor/EmbedEditor.svelte.d.ts +5 -17
  108. package/dist/components/editor/Icon.svelte +1 -1
  109. package/dist/components/editor/Icon.svelte.d.ts +5 -17
  110. package/dist/components/editor/ImageChooser.svelte +15 -18
  111. package/dist/components/editor/ImageChooser.svelte.d.ts +6 -18
  112. package/dist/components/editor/ImageThumbnail.svelte +29 -24
  113. package/dist/components/editor/ImageThumbnail.svelte.d.ts +7 -19
  114. package/dist/components/editor/InlineCodeEditor.svelte +3 -3
  115. package/dist/components/editor/InlineCodeEditor.svelte.d.ts +5 -17
  116. package/dist/components/editor/LabelEditor.svelte +5 -6
  117. package/dist/components/editor/LabelEditor.svelte.d.ts +5 -17
  118. package/dist/components/editor/LanguageEditor.svelte +4 -5
  119. package/dist/components/editor/LanguageEditor.svelte.d.ts +6 -18
  120. package/dist/components/editor/LinkEditor.svelte +52 -68
  121. package/dist/components/editor/LinkEditor.svelte.d.ts +5 -17
  122. package/dist/components/editor/Note.svelte +4 -1
  123. package/dist/components/editor/Note.svelte.d.ts +5 -28
  124. package/dist/components/editor/Permissions.svelte +36 -34
  125. package/dist/components/editor/Permissions.svelte.d.ts +9 -21
  126. package/dist/components/editor/PositionEditor.svelte +6 -7
  127. package/dist/components/editor/PositionEditor.svelte.d.ts +6 -18
  128. package/dist/components/editor/QuoteEditor.svelte +3 -3
  129. package/dist/components/editor/QuoteEditor.svelte.d.ts +5 -17
  130. package/dist/components/editor/Switch.svelte +16 -11
  131. package/dist/components/editor/Switch.svelte.d.ts +9 -21
  132. package/dist/components/editor/TableEditor.svelte +3 -3
  133. package/dist/components/editor/TableEditor.svelte.d.ts +5 -17
  134. package/dist/components/editor/TextEditor.svelte +74 -87
  135. package/dist/components/editor/TextEditor.svelte.d.ts +13 -25
  136. package/dist/components/editor/Toggle.svelte +18 -21
  137. package/dist/components/editor/Toggle.svelte.d.ts +7 -20
  138. package/dist/components/editor/Toolbar.svelte +140 -145
  139. package/dist/components/editor/Toolbar.svelte.d.ts +5 -17
  140. package/dist/components/editor/ToolbarGroup.svelte +4 -4
  141. package/dist/components/editor/ToolbarGroup.svelte.d.ts +6 -19
  142. package/dist/components/editor/ToolbarSpacer.svelte +1 -1
  143. package/dist/components/editor/ToolbarSpacer.svelte.d.ts +22 -21
  144. package/dist/components/editor/URLEditor.svelte +3 -5
  145. package/dist/components/editor/URLEditor.svelte.d.ts +7 -19
  146. package/dist/components/page/Acknowledgements.svelte +14 -8
  147. package/dist/components/page/Acknowledgements.svelte.d.ts +3 -16
  148. package/dist/components/page/Analytics.svelte +2 -3
  149. package/dist/components/page/Analytics.svelte.d.ts +6 -17
  150. package/dist/components/page/Authors.svelte +29 -29
  151. package/dist/components/page/Authors.svelte.d.ts +11 -23
  152. package/dist/components/page/BookLoader.svelte +47 -43
  153. package/dist/components/page/BookLoader.svelte.d.ts +5 -17
  154. package/dist/components/page/BulkReferenceEditor.svelte +43 -26
  155. package/dist/components/page/BulkReferenceEditor.svelte.d.ts +3 -16
  156. package/dist/components/page/Chapter.svelte +224 -249
  157. package/dist/components/page/Chapter.svelte.d.ts +6 -18
  158. package/dist/components/page/ChapterContext.d.ts +3 -1
  159. package/dist/components/page/ChapterNumber.svelte +4 -1
  160. package/dist/components/page/ChapterNumber.svelte.d.ts +5 -28
  161. package/dist/components/page/ChapterTitle.svelte +4 -4
  162. package/dist/components/page/ChapterTitle.svelte.d.ts +6 -19
  163. package/dist/components/page/Contexts.js +2 -2
  164. package/dist/components/page/DefinitionView.svelte +51 -44
  165. package/dist/components/page/DefinitionView.svelte.d.ts +6 -18
  166. package/dist/components/page/Description.svelte +10 -4
  167. package/dist/components/page/Description.svelte.d.ts +16 -14
  168. package/dist/components/page/EditableHeader.svelte +4 -6
  169. package/dist/components/page/EditableHeader.svelte.d.ts +7 -18
  170. package/dist/components/page/Edition.svelte +57 -71
  171. package/dist/components/page/Edition.svelte.d.ts +7 -20
  172. package/dist/components/page/EditionLoader.svelte +119 -82
  173. package/dist/components/page/EditionLoader.svelte.d.ts +6 -19
  174. package/dist/components/page/Editions.svelte +26 -31
  175. package/dist/components/page/Editions.svelte.d.ts +5 -17
  176. package/dist/components/page/Glossary.svelte +31 -35
  177. package/dist/components/page/Glossary.svelte.d.ts +3 -16
  178. package/dist/components/page/Header.svelte +43 -49
  179. package/dist/components/page/Header.svelte.d.ts +19 -30
  180. package/dist/components/page/Index.svelte +46 -46
  181. package/dist/components/page/Index.svelte.d.ts +3 -16
  182. package/dist/components/page/Instructions.svelte +2 -2
  183. package/dist/components/page/Instructions.svelte.d.ts +6 -19
  184. package/dist/components/page/License.svelte +13 -7
  185. package/dist/components/page/License.svelte.d.ts +16 -14
  186. package/dist/components/page/Loading.svelte +9 -9
  187. package/dist/components/page/Loading.svelte.d.ts +22 -21
  188. package/dist/components/page/Media.svelte +36 -27
  189. package/dist/components/page/Media.svelte.d.ts +3 -16
  190. package/dist/components/page/MediaPreview.svelte +22 -19
  191. package/dist/components/page/MediaPreview.svelte.d.ts +8 -21
  192. package/dist/components/page/Muted.svelte +4 -1
  193. package/dist/components/page/Muted.svelte.d.ts +5 -28
  194. package/dist/components/page/Outline.svelte +75 -97
  195. package/dist/components/page/Outline.svelte.d.ts +8 -20
  196. package/dist/components/page/Page.svelte +23 -33
  197. package/dist/components/page/Page.svelte.d.ts +7 -20
  198. package/dist/components/page/PageHeader.svelte +2 -2
  199. package/dist/components/page/PageHeader.svelte.d.ts +6 -19
  200. package/dist/components/page/PageParagraph.svelte +4 -1
  201. package/dist/components/page/PageParagraph.svelte.d.ts +5 -28
  202. package/dist/components/page/PossibleChapter.svelte +7 -7
  203. package/dist/components/page/PossibleChapter.svelte.d.ts +3 -16
  204. package/dist/components/page/PossibleReference.svelte +4 -5
  205. package/dist/components/page/PossibleReference.svelte.d.ts +6 -18
  206. package/dist/components/page/Print.svelte +11 -12
  207. package/dist/components/page/Print.svelte.d.ts +3 -16
  208. package/dist/components/page/Publish.svelte +47 -47
  209. package/dist/components/page/Publish.svelte.d.ts +3 -16
  210. package/dist/components/page/Reference.svelte +24 -35
  211. package/dist/components/page/Reference.svelte.d.ts +6 -18
  212. package/dist/components/page/References.svelte +21 -22
  213. package/dist/components/page/References.svelte.d.ts +3 -16
  214. package/dist/components/page/Rows.svelte +4 -1
  215. package/dist/components/page/Rows.svelte.d.ts +5 -28
  216. package/dist/components/page/Search.svelte +58 -60
  217. package/dist/components/page/Search.svelte.d.ts +3 -16
  218. package/dist/components/page/Status.svelte +2 -2
  219. package/dist/components/page/Status.svelte.d.ts +16 -14
  220. package/dist/components/page/SubdomainEditor.svelte +11 -11
  221. package/dist/components/page/SubdomainEditor.svelte.d.ts +16 -14
  222. package/dist/components/page/TableOfContents.svelte +143 -125
  223. package/dist/components/page/TableOfContents.svelte.d.ts +3 -16
  224. package/dist/components/page/TableOfContentsImage.svelte +6 -7
  225. package/dist/components/page/TableOfContentsImage.svelte.d.ts +6 -18
  226. package/dist/components/page/TableOfContentsRow.svelte +32 -32
  227. package/dist/components/page/TableOfContentsRow.svelte.d.ts +10 -22
  228. package/dist/components/page/ThemeEditor.svelte +35 -28
  229. package/dist/components/page/ThemeEditor.svelte.d.ts +3 -16
  230. package/dist/components/page/ThemeEditorPreview.svelte +11 -13
  231. package/dist/components/page/ThemeEditorPreview.svelte.d.ts +5 -17
  232. package/dist/components/page/ThemeSetEditor.svelte +4 -6
  233. package/dist/components/page/ThemeSetEditor.svelte.d.ts +7 -19
  234. package/dist/components/page/ThemeVariableEditor.svelte +9 -11
  235. package/dist/components/page/ThemeVariableEditor.svelte.d.ts +7 -19
  236. package/dist/components/page/Title.svelte +4 -1
  237. package/dist/components/page/Title.svelte.d.ts +5 -28
  238. package/dist/components/page/Unknown.svelte +11 -8
  239. package/dist/components/page/Unknown.svelte.d.ts +5 -17
  240. package/dist/models/Firebase.js +18 -4
  241. package/dist/models/book/Book.js +2 -1
  242. package/dist/models/book/BookMedia.js +1 -2
  243. package/dist/models/book/Chapter.js +3 -2
  244. package/dist/models/book/Edition.d.ts +1 -1
  245. package/dist/models/book/Edition.js +5 -1
  246. package/dist/models/chapter/BlocksNode.js +3 -1
  247. package/dist/models/chapter/BlocksNode.test.js +5 -1
  248. package/dist/models/chapter/Node.test.js +2 -2
  249. package/package.json +34 -22
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type Theme from '../../models/book/Theme';
3
- declare const __propDef: {
4
- props: {
5
- theme: Theme | null;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type ThemeEditorPreviewProps = typeof __propDef.props;
15
- export type ThemeEditorPreviewEvents = typeof __propDef.events;
16
- export type ThemeEditorPreviewSlots = typeof __propDef.slots;
17
- export default class ThemeEditorPreview extends SvelteComponent<ThemeEditorPreviewProps, ThemeEditorPreviewEvents, ThemeEditorPreviewSlots> {
2
+ interface Props {
3
+ theme: Theme | null;
18
4
  }
19
- export {};
5
+ declare const ThemeEditorPreview: import("svelte").Component<Props, {}, "">;
6
+ type ThemeEditorPreview = ReturnType<typeof ThemeEditorPreview>;
7
+ export default ThemeEditorPreview;
@@ -1,9 +1,7 @@
1
- <script>import PageHeader from './PageHeader.svelte';
2
- import Rows from './Rows.svelte';
3
- import ThemeVariableEditor from './ThemeVariableEditor.svelte';
4
- export let header;
5
- export let group;
6
- export let properties;
1
+ <script lang="ts">import PageHeader from "./PageHeader.svelte";
2
+ import Rows from "./Rows.svelte";
3
+ import ThemeVariableEditor from "./ThemeVariableEditor.svelte";
4
+ let { header, group, properties } = $props();
7
5
  </script>
8
6
 
9
7
  <PageHeader>{header}</PageHeader>
@@ -1,20 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- header: string;
5
- group: string;
6
- properties: Record<string, string>;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type ThemeSetEditorProps = typeof __propDef.props;
16
- export type ThemeSetEditorEvents = typeof __propDef.events;
17
- export type ThemeSetEditorSlots = typeof __propDef.slots;
18
- export default class ThemeSetEditor extends SvelteComponent<ThemeSetEditorProps, ThemeSetEditorEvents, ThemeSetEditorSlots> {
1
+ interface Props {
2
+ header: string;
3
+ group: string;
4
+ properties: Record<string, string>;
19
5
  }
20
- export {};
6
+ declare const ThemeSetEditor: import("svelte").Component<Props, {}, "">;
7
+ type ThemeSetEditor = ReturnType<typeof ThemeSetEditor>;
8
+ export default ThemeSetEditor;
@@ -1,16 +1,14 @@
1
- <script>import TextEditor from '../editor/TextEditor.svelte';
2
- import { getEdition } from './Contexts';
1
+ <script lang="ts">import TextEditor from "../editor/TextEditor.svelte";
2
+ import { getEdition } from "./Contexts";
3
3
  const placeholders = {
4
- light: 'CSS color',
5
- dark: 'CSS color',
6
- fonts: 'CSS font name',
7
- sizes: 'CSS font size',
8
- weights: 'CSS font weights',
9
- spacing: 'CSS length',
4
+ light: "CSS color",
5
+ dark: "CSS color",
6
+ fonts: "CSS font name",
7
+ sizes: "CSS font size",
8
+ weights: "CSS font weights",
9
+ spacing: "CSS length"
10
10
  };
11
- export let group;
12
- export let name;
13
- export let value;
11
+ let { group, name, value } = $props();
14
12
  let edition = getEdition();
15
13
  </script>
16
14
 
@@ -1,20 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- group: string;
5
- name: string;
6
- value: string;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type ThemeVariableEditorProps = typeof __propDef.props;
16
- export type ThemeVariableEditorEvents = typeof __propDef.events;
17
- export type ThemeVariableEditorSlots = typeof __propDef.slots;
18
- export default class ThemeVariableEditor extends SvelteComponent<ThemeVariableEditorProps, ThemeVariableEditorEvents, ThemeVariableEditorSlots> {
1
+ interface Props {
2
+ group: string;
3
+ name: string;
4
+ value: string;
19
5
  }
20
- export {};
6
+ declare const ThemeVariableEditor: import("svelte").Component<Props, {}, "">;
7
+ type ThemeVariableEditor = ReturnType<typeof ThemeVariableEditor>;
8
+ export default ThemeVariableEditor;
@@ -1,4 +1,7 @@
1
- <h1><slot /></h1>
1
+ <script lang="ts">let { children } = $props();
2
+ </script>
3
+
4
+ <h1>{@render children?.()}</h1>
2
5
 
3
6
  <style>
4
7
  h1 {
@@ -1,29 +1,6 @@
1
- /** @typedef {typeof __propDef.props} TitleProps */
2
- /** @typedef {typeof __propDef.events} TitleEvents */
3
- /** @typedef {typeof __propDef.slots} TitleSlots */
4
- export default class Title extends SvelteComponent<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
1
+ interface Props {
2
+ children?: import('svelte').Snippet;
11
3
  }
12
- export type TitleProps = typeof __propDef.props;
13
- export type TitleEvents = typeof __propDef.events;
14
- export type TitleSlots = typeof __propDef.slots;
15
- import { SvelteComponent } from "svelte";
16
- declare const __propDef: {
17
- props: {
18
- [x: string]: never;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {
24
- default: {};
25
- };
26
- exports?: undefined;
27
- bindings?: undefined;
28
- };
29
- export {};
4
+ declare const Title: import("svelte").Component<Props, {}, "">;
5
+ type Title = ReturnType<typeof Title>;
6
+ export default Title;
@@ -1,9 +1,10 @@
1
- <script>import Header from './Header.svelte';
2
- import Outline from './Outline.svelte';
3
- import Page from './Page.svelte';
4
- import Instructions from './Instructions.svelte';
5
- import ChapterIDs from '../../models/book/ChapterID';
6
- import { getEdition, isEditionEditable } from './Contexts';
1
+ <script lang="ts">import Header from "./Header.svelte";
2
+ import Outline from "./Outline.svelte";
3
+ import Page from "./Page.svelte";
4
+ import Instructions from "./Instructions.svelte";
5
+ import ChapterIDs from "../../models/book/ChapterID";
6
+ import { getEdition, isEditionEditable } from "./Contexts";
7
+ let { children } = $props();
7
8
  let editable = isEditionEditable();
8
9
  let edition = getEdition();
9
10
  </script>
@@ -23,7 +24,9 @@ let edition = getEdition();
23
24
  : undefined}
24
25
  header={$edition.getHeader(ChapterIDs.UnknownID)}
25
26
  >
26
- <Outline slot="outline" previous={null} next={null} />
27
+ {#snippet outline()}
28
+ <Outline previous={null} next={null} />
29
+ {/snippet}
27
30
  </Header>
28
31
 
29
32
  <Instructions {editable}>
@@ -31,6 +34,6 @@ let edition = getEdition();
31
34
  doesn't exist. You can customize the image shown.
32
35
  </Instructions>
33
36
 
34
- <slot />
37
+ {@render children?.()}
35
38
  </Page>
36
39
  {/if}
@@ -1,18 +1,6 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {
8
- default: {};
9
- };
10
- exports?: {} | undefined;
11
- bindings?: string | undefined;
12
- };
13
- export type UnknownProps = typeof __propDef.props;
14
- export type UnknownEvents = typeof __propDef.events;
15
- export type UnknownSlots = typeof __propDef.slots;
16
- export default class Unknown extends SvelteComponent<UnknownProps, UnknownEvents, UnknownSlots> {
1
+ interface Props {
2
+ children?: import('svelte').Snippet;
17
3
  }
18
- export {};
4
+ declare const Unknown: import("svelte").Component<Props, {}, "">;
5
+ type Unknown = ReturnType<typeof Unknown>;
6
+ export default Unknown;
@@ -4,6 +4,7 @@ import { connectFirestoreEmulator, getFirestore } from 'firebase/firestore';
4
4
  import { connectFunctionsEmulator, getFunctions } from 'firebase/functions';
5
5
  import { connectStorageEmulator, getStorage } from 'firebase/storage';
6
6
  import { PUBLIC_READER, PUBLIC_CONTEXT, PUBLIC_FIREBASE_API_KEY, PUBLIC_FIREBASE_AUTH_DOMAIN, PUBLIC_FIREBASE_PROJECT_ID, PUBLIC_FIREBASE_STORAGE_BUCKET, PUBLIC_FIREBASE_MESSAGING_SENDER_ID, PUBLIC_FIREBASE_APP_ID, } from '$env/static/public';
7
+ import { env } from '$env/dynamic/public';
7
8
  const isReader = PUBLIC_READER === 'true';
8
9
  // Some feedback about context
9
10
  if (!isReader && PUBLIC_CONTEXT !== 'prod')
@@ -24,13 +25,26 @@ export const auth = isReader ? undefined : getAuth(app);
24
25
  export const db = isReader ? undefined : getFirestore();
25
26
  export const storage = isReader ? undefined : getStorage(app);
26
27
  export const functions = isReader ? undefined : getFunctions(app);
28
+ /** Emulator ports default to the firebase.json values but can be overridden
29
+ * by env vars so test runs (see firebase.test.json) can use dedicated ports
30
+ * that don't collide with other running emulator suites. Dynamic env isn't
31
+ * available in every context (e.g. unit tests), hence the guard. */
32
+ function emulatorPort(name, fallback) {
33
+ try {
34
+ return (env?.[name] ??
35
+ fallback);
36
+ }
37
+ catch {
38
+ return fallback;
39
+ }
40
+ }
27
41
  if (!isReader && PUBLIC_CONTEXT === 'local') {
28
42
  if (db)
29
- connectFirestoreEmulator(db, 'localhost', 8080);
43
+ connectFirestoreEmulator(db, 'localhost', parseInt(emulatorPort('PUBLIC_EMULATOR_FIRESTORE', '8080')));
30
44
  if (auth)
31
- connectAuthEmulator(auth, 'http://localhost:9099');
45
+ connectAuthEmulator(auth, `http://localhost:${emulatorPort('PUBLIC_EMULATOR_AUTH', '9099')}`);
32
46
  if (storage)
33
- connectStorageEmulator(storage, 'localhost', 9199);
47
+ connectStorageEmulator(storage, 'localhost', parseInt(emulatorPort('PUBLIC_EMULATOR_STORAGE', '9199')));
34
48
  if (functions)
35
- connectFunctionsEmulator(functions, 'localhost', 5001);
49
+ connectFunctionsEmulator(functions, 'localhost', parseInt(emulatorPort('PUBLIC_EMULATOR_FUNCTIONS', '5001')));
36
50
  }
@@ -91,7 +91,8 @@ export default class Book {
91
91
  return edition ? edition.ref.id : undefined;
92
92
  }
93
93
  getLatestPublishedEditionID() {
94
- return this.editions.filter((ed) => ed.published !== null).at(-1)?.ref.id;
94
+ return this.editions.filter((ed) => ed.published !== null).at(-1)?.ref
95
+ .id;
95
96
  }
96
97
  getLatestEditionID() {
97
98
  return this.editions.toSorted((a, b) => b.number - a.number)[0]?.ref.id;
@@ -1,6 +1,5 @@
1
1
  import { deleteObject, getDownloadURL, listAll, ref, uploadBytes, } from 'firebase/storage';
2
2
  import { storage } from '../Firebase';
3
- import { v4 as uuidv4 } from 'uuid';
4
3
  export default class BookMedia {
5
4
  book;
6
5
  _images;
@@ -84,7 +83,7 @@ export default class BookMedia {
84
83
  // Get the extension if there is one.
85
84
  const [name, extension] = file.name.split('.');
86
85
  // We use the file name given, but append a unique string to avoid collisions.
87
- const imageName = `${name}-${uuidv4()}.${extension ?? ''}`;
86
+ const imageName = `${name}-${crypto.randomUUID()}.${extension ?? ''}`;
88
87
  // The canonical path format for Bookish images in the store is image/{bookid}/{imageid}
89
88
  // where {bookid} is the Firestore document ID of the book being edited and {imageid} is just a random id.
90
89
  const imageRef = ref(storage, `${this.getImagePath()}/${imageName}`);
@@ -161,8 +161,9 @@ export default class Chapter {
161
161
  }
162
162
  getWordCount(edition) {
163
163
  if (this._wordCount === undefined)
164
- this._wordCount = this.getAST(edition)?.toText().split(/\s+/)
165
- .length;
164
+ this._wordCount = this.getAST(edition)
165
+ ?.toText()
166
+ .split(/\s+/).length;
166
167
  return this._wordCount;
167
168
  }
168
169
  /** Either a number of minutes, or undefined if there's no text yet, or null if forthcoming. */
@@ -7,7 +7,7 @@ import type Definition from './Definition.js';
7
7
  import { type ChapterIDKey, type TOCHeaderKey } from './ChapterID.js';
8
8
  import type { DocumentReference } from 'firebase/firestore';
9
9
  import type Book from './Book';
10
- import type FormatNode from '../chapter/FormatNode';
10
+ import FormatNode from '../chapter/FormatNode';
11
11
  import type { EditionInfo } from './Book';
12
12
  export type EditionSpecification = {
13
13
  bookRef: DocumentReference;
@@ -3,6 +3,7 @@ import Parser from '../chapter/Parser';
3
3
  import EmbedNode from '../chapter/EmbedNode';
4
4
  import Reference from './Reference';
5
5
  import ChapterIDs, {} from './ChapterID.js';
6
+ import FormatNode from '../chapter/FormatNode';
6
7
  export default class Edition {
7
8
  bookRef;
8
9
  editionRef;
@@ -48,8 +49,11 @@ export default class Edition {
48
49
  this.sources = Object.assign({}, sources);
49
50
  this.references = {};
50
51
  for (const [citationID, ref] of Object.entries(references)) {
52
+ // Pass through already-parsed references: strings parse to
53
+ // FormatNodes, and every copy-on-write constructor call re-runs
54
+ // this normalization, so FormatNodes must survive it too.
51
55
  this.references[citationID] =
52
- ref instanceof Reference
56
+ ref instanceof Reference || ref instanceof FormatNode
53
57
  ? ref
54
58
  : Edition.parseReference(citationID, ref, this);
55
59
  }
@@ -474,7 +474,9 @@ export default class BlocksNode extends BlockNode {
474
474
  if (first instanceof ParagraphNode &&
475
475
  last instanceof ParagraphNode) {
476
476
  // Replace the first paragraph with the second merged.
477
- newBlocks = newBlocks.withNodeReplaced(first, first.withContent(first.getFormat().withSegmentsAppended(last.getFormat())));
477
+ newBlocks = newBlocks.withNodeReplaced(first, first.withContent(first
478
+ .getFormat()
479
+ .withSegmentsAppended(last.getFormat())));
478
480
  if (newBlocks === undefined)
479
481
  return;
480
482
  // Remove the last paragraph.
@@ -29,7 +29,11 @@ const beforeBold = new TextNode('I am a ');
29
29
  const bold = new TextNode('bold');
30
30
  const afterBold = new TextNode(' word.');
31
31
  const boldChapter = new ChapterNode([
32
- new ParagraphNode(0, new FormatNode('', [beforeBold, new FormatNode('*', [bold]), afterBold])),
32
+ new ParagraphNode(0, new FormatNode('', [
33
+ beforeBold,
34
+ new FormatNode('*', [bold]),
35
+ afterBold,
36
+ ])),
33
37
  ]);
34
38
  const itemOneTextNode = new TextNode('one');
35
39
  const itemOneFormat = new FormatNode('', [itemOneTextNode]);
@@ -13,11 +13,11 @@ const format = new FormatNode('', [textOne, textTwo, bold, textFive]);
13
13
 
14
14
  test('Replace descendants', () => {
15
15
  expect(
16
- format.withNodeReplaced(textThree, new TextNode('hi'))?.toBookdown()
16
+ format.withNodeReplaced(textThree, new TextNode('hi'))?.toBookdown(),
17
17
  ).toBe('onetwo*hifour*five');
18
18
 
19
19
  expect(
20
- format.withNodeReplaced(textFive, new TextNode('yo'))?.toBookdown()
20
+ format.withNodeReplaced(textFive, new TextNode('yo'))?.toBookdown(),
21
21
  ).toBe('onetwo*threefour*yo');
22
22
  });
23
23
 
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.7.4",
4
+ "version": "0.8.2",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",
8
- "repository": "https://github.com/amyjko/bookish.git",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/amyjko/bookish.git"
11
+ },
9
12
  "scripts": {
10
13
  "prepare": "svelte-kit sync",
11
14
  "//dev": "echo 'Run the Svelte/Vite local server to test locally. Use in combination with run emu to run locally.'",
@@ -15,47 +18,56 @@
15
18
  "//emu": "echo 'This copies the local .env file and starts the emulator'",
16
19
  "emu": "firebase use dev && npm run env && firebase emulators:start",
17
20
  "package": "svelte-package --watch",
21
+ "package:build": "svelte-package",
18
22
  "test": "vitest",
23
+ "test:ci": "vitest run",
24
+ "//test:e2e": "echo 'Build the app and run the Playwright smoke tests against a preview server.'",
25
+ "test:e2e": "npm run build && playwright test",
26
+ "//test:e2e:emu": "echo 'Build the app and run the Playwright suite that signs in and edits against dedicated Firebase emulators (see firebase.test.json).'",
27
+ "test:e2e:emu": "PUBLIC_FIREBASE_PROJECT_ID=demo-bookish PUBLIC_FIREBASE_STORAGE_BUCKET=demo-bookish.appspot.com npm run build && bash scripts/test-emulators.sh 'npx playwright test --config playwright.emulator.config.ts'",
19
28
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
29
+ "check:ci": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
20
30
  "//env": "echo 'This copies the .env file corresponding to the current Firebase project specified with firebase use, defaulting to local'",
21
31
  "env": "cp .env.${GCLOUD_PROJECT:-example} .env",
22
- "//stage": "echo 'switch to the dev project, deploy, relying on Firebase's predeploy hook to run the build script above before release'",
23
- "stage": "firebase use dev && cp .env.bookish-dev-21ac3 .env && firebase deploy",
24
- "//release": "echo 'switch to the prod project, deploy, relying on Firebase's predeploy hook to run the build script above before release'",
25
- "release": "firebase use prod && cp .env.bookish-prod .env && firebase deploy",
32
+ "//deploy:ssr": "echo 'Build the app with the current .env, then deploy the SSR server in build/ to Cloud Run for the given project. Used by stage and release.'",
33
+ "deploy:ssr": "vite build && gcloud run deploy bookish-ssr --source . --region us-central1 --allow-unauthenticated --quiet --project",
34
+ "//stage": "echo 'Switch to the dev project, build with the dev .env, deploy the SSR server to Cloud Run, then deploy hosting, rules, and functions.'",
35
+ "stage": "firebase use dev && cp .env.bookish-dev-21ac3 .env && npm run deploy:ssr -- bookish-dev-21ac3 && firebase deploy",
36
+ "//release": "echo 'Switch to the prod project, build with the prod .env, deploy the SSR server to Cloud Run, then deploy hosting, rules, and functions.'",
37
+ "release": "firebase use prod && cp .env.bookish-prod .env && npm run deploy:ssr -- bookish-prod && firebase deploy",
26
38
  "//merge": "merge dev into main, push to remote",
27
39
  "merge": "git checkout main && git merge dev && git push origin main && git checkout dev"
28
40
  },
29
41
  "devDependencies": {
42
+ "@playwright/test": "^1",
30
43
  "@sveltejs/adapter-node": "^5",
31
- "@sveltejs/kit": "^2",
32
44
  "@sveltejs/package": "^2",
33
- "@sveltejs/vite-plugin-svelte": "^3",
45
+ "@sveltejs/vite-plugin-svelte": "^6",
46
+ "@testing-library/svelte": "^5",
34
47
  "@types/prismjs": "^1.26",
35
48
  "@types/smoothscroll-polyfill": "^0",
36
- "chalk": "^5.3.0",
37
- "globals": "^16",
49
+ "firebase-tools": "^15.28.2",
50
+ "jsdom": "^29",
38
51
  "prettier": "^3",
39
- "prettier-plugin-svelte": "^3",
40
- "svelte-check": "^3",
41
- "svelte-preprocess": "^5",
52
+ "prettier-plugin-svelte": "^4",
53
+ "svelte": "^5.57",
54
+ "svelte-check": "^4.7",
42
55
  "tslib": "^2",
43
56
  "typescript": "^5",
44
- "uuid": "^11.1.0",
45
- "vite": "^5",
46
- "vitest": "^3"
57
+ "vite": "^7",
58
+ "vitest": "^4"
47
59
  },
48
60
  "dependencies": {
49
61
  "@sveltejs/kit": "^2",
50
62
  "ajv": "^8",
51
63
  "ajv-formats": "^3",
52
- "firebase": "^11",
53
- "firebase-admin": "^12.7.0",
54
- "firebase-functions": "^6",
64
+ "firebase": "^12",
65
+ "firebase-admin": "^14",
55
66
  "prismjs": "^1.29",
56
- "smoothscroll-polyfill": "^0.4",
57
- "svelte": "^4",
58
- "uuid": "^11"
67
+ "smoothscroll-polyfill": "^0.4"
68
+ },
69
+ "peerDependencies": {
70
+ "svelte": "^5.0.0"
59
71
  },
60
72
  "engines": {
61
73
  "node": "22"