bookish-press 0.5.32 → 0.5.71

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 (168) hide show
  1. package/README.md +30 -1
  2. package/dist/components/Auth.svelte.d.ts +2 -2
  3. package/dist/components/BookPreview.svelte.d.ts +2 -2
  4. package/dist/components/Link.svelte.d.ts +2 -2
  5. package/dist/components/app/BookList.svelte.d.ts +2 -2
  6. package/dist/components/app/Button.svelte.d.ts +2 -2
  7. package/dist/components/app/Feedback.svelte.d.ts +2 -2
  8. package/dist/components/app/Head.svelte.d.ts +2 -2
  9. package/dist/components/app/Large.svelte.d.ts +2 -2
  10. package/dist/components/app/Lead.svelte.d.ts +2 -2
  11. package/dist/components/app/Link.svelte.d.ts +2 -2
  12. package/dist/components/app/Options.svelte +1 -0
  13. package/dist/components/app/Options.svelte.d.ts +2 -2
  14. package/dist/components/app/Paragraph.svelte.d.ts +2 -2
  15. package/dist/components/app/Section.svelte.d.ts +2 -2
  16. package/dist/components/app/Table.svelte +0 -1
  17. package/dist/components/app/Table.svelte.d.ts +2 -2
  18. package/dist/components/app/TextInput.svelte.d.ts +2 -2
  19. package/dist/components/chapter/Atom.svelte.d.ts +2 -2
  20. package/dist/components/chapter/Block.svelte.d.ts +2 -2
  21. package/dist/components/chapter/Callout.svelte.d.ts +2 -2
  22. package/dist/components/chapter/CaptionedCode.svelte +21 -19
  23. package/dist/components/chapter/CaptionedCode.svelte.d.ts +2 -2
  24. package/dist/components/chapter/ChapterBody.svelte +2 -0
  25. package/dist/components/chapter/ChapterBody.svelte.d.ts +2 -2
  26. package/dist/components/chapter/Citations.svelte.d.ts +2 -2
  27. package/dist/components/chapter/Code.svelte.d.ts +2 -2
  28. package/dist/components/chapter/Comment.svelte.d.ts +2 -2
  29. package/dist/components/chapter/Definition.svelte +6 -7
  30. package/dist/components/chapter/Definition.svelte.d.ts +2 -2
  31. package/dist/components/chapter/Embed.svelte +4 -3
  32. package/dist/components/chapter/Embed.svelte.d.ts +2 -2
  33. package/dist/components/chapter/ErrorMessage.svelte.d.ts +2 -2
  34. package/dist/components/chapter/Figure.svelte +9 -1
  35. package/dist/components/chapter/Figure.svelte.d.ts +3 -2
  36. package/dist/components/chapter/Footnote.svelte.d.ts +2 -2
  37. package/dist/components/chapter/Format.svelte +21 -16
  38. package/dist/components/chapter/Format.svelte.d.ts +2 -2
  39. package/dist/components/chapter/InlineCode.svelte.d.ts +2 -2
  40. package/dist/components/chapter/Label.svelte.d.ts +2 -2
  41. package/dist/components/chapter/LineBreak.svelte +6 -0
  42. package/dist/components/chapter/LineBreak.svelte.d.ts +17 -0
  43. package/dist/components/chapter/Link.svelte.d.ts +2 -2
  44. package/dist/components/chapter/List.svelte.d.ts +2 -2
  45. package/dist/components/chapter/Marginal.svelte +5 -4
  46. package/dist/components/chapter/Marginal.svelte.d.ts +2 -2
  47. package/dist/components/chapter/Paragraph.svelte.d.ts +2 -2
  48. package/dist/components/chapter/Positioned.svelte.d.ts +2 -2
  49. package/dist/components/chapter/Problem.svelte.d.ts +2 -2
  50. package/dist/components/chapter/Python.svelte.d.ts +2 -2
  51. package/dist/components/chapter/Quote.svelte.d.ts +2 -2
  52. package/dist/components/chapter/Rule.svelte +2 -2
  53. package/dist/components/chapter/Rule.svelte.d.ts +2 -2
  54. package/dist/components/chapter/Table.svelte.d.ts +2 -2
  55. package/dist/components/chapter/Text.svelte.d.ts +2 -2
  56. package/dist/components/controls/DarkToggle.svelte.d.ts +2 -2
  57. package/dist/components/editor/BookishEditor.svelte +22 -22
  58. package/dist/components/editor/BookishEditor.svelte.d.ts +2 -2
  59. package/dist/components/editor/CalloutEditor.svelte.d.ts +2 -2
  60. package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +2 -2
  61. package/dist/components/editor/CaretContext.d.ts +1 -1
  62. package/dist/components/editor/CaretView.svelte +8 -3
  63. package/dist/components/editor/CaretView.svelte.d.ts +2 -2
  64. package/dist/components/editor/CitationsEditor.svelte.d.ts +2 -2
  65. package/dist/components/editor/Commands.js +109 -43
  66. package/dist/components/editor/ConfirmButton.svelte +7 -1
  67. package/dist/components/editor/ConfirmButton.svelte.d.ts +2 -2
  68. package/dist/components/editor/DefinitionEditor.svelte.d.ts +2 -2
  69. package/dist/components/editor/EmbedEditor.svelte.d.ts +2 -2
  70. package/dist/components/editor/Icon.svelte.d.ts +2 -2
  71. package/dist/components/editor/ImageChooser.svelte +2 -1
  72. package/dist/components/editor/ImageChooser.svelte.d.ts +2 -2
  73. package/dist/components/editor/ImageThumbnail.svelte +11 -7
  74. package/dist/components/editor/ImageThumbnail.svelte.d.ts +2 -2
  75. package/dist/components/editor/InlineCodeEditor.svelte.d.ts +2 -2
  76. package/dist/components/editor/LabelEditor.svelte.d.ts +2 -2
  77. package/dist/components/editor/LanguageEditor.svelte.d.ts +2 -2
  78. package/dist/components/editor/LinkEditor.svelte +4 -3
  79. package/dist/components/editor/LinkEditor.svelte.d.ts +2 -2
  80. package/dist/components/editor/Note.svelte.d.ts +2 -2
  81. package/dist/components/editor/Permissions.svelte.d.ts +2 -2
  82. package/dist/components/editor/PositionEditor.svelte.d.ts +2 -2
  83. package/dist/components/editor/QuoteEditor.svelte.d.ts +2 -2
  84. package/dist/components/editor/Switch.svelte.d.ts +2 -2
  85. package/dist/components/editor/TableEditor.svelte.d.ts +2 -2
  86. package/dist/components/editor/TextEditor.svelte.d.ts +2 -2
  87. package/dist/components/editor/Toggle.svelte.d.ts +2 -2
  88. package/dist/components/editor/Toolbar.svelte +2 -1
  89. package/dist/components/editor/Toolbar.svelte.d.ts +2 -2
  90. package/dist/components/editor/ToolbarGroup.svelte.d.ts +2 -2
  91. package/dist/components/editor/ToolbarSpacer.svelte.d.ts +2 -2
  92. package/dist/components/editor/URLEditor.svelte.d.ts +2 -2
  93. package/dist/components/page/Acknowledgements.svelte.d.ts +2 -2
  94. package/dist/components/page/Authors.svelte.d.ts +2 -2
  95. package/dist/components/page/BookLoader.svelte.d.ts +2 -2
  96. package/dist/components/page/BulkReferenceEditor.svelte +1 -1
  97. package/dist/components/page/BulkReferenceEditor.svelte.d.ts +2 -2
  98. package/dist/components/page/Chapter.svelte +4 -5
  99. package/dist/components/page/Chapter.svelte.d.ts +2 -2
  100. package/dist/components/page/ChapterNumber.svelte.d.ts +2 -2
  101. package/dist/components/page/ChapterTitle.svelte.d.ts +2 -2
  102. package/dist/components/page/DefinitionView.svelte.d.ts +2 -2
  103. package/dist/components/page/Description.svelte.d.ts +2 -2
  104. package/dist/components/page/Edition.svelte.d.ts +2 -2
  105. package/dist/components/page/EditionLoader.svelte +9 -18
  106. package/dist/components/page/EditionLoader.svelte.d.ts +2 -2
  107. package/dist/components/page/Editions.svelte +4 -3
  108. package/dist/components/page/Editions.svelte.d.ts +2 -2
  109. package/dist/components/page/Glossary.svelte +8 -2
  110. package/dist/components/page/Glossary.svelte.d.ts +2 -2
  111. package/dist/components/page/Header.svelte.d.ts +2 -2
  112. package/dist/components/page/Index.svelte +5 -2
  113. package/dist/components/page/Index.svelte.d.ts +2 -2
  114. package/dist/components/page/Instructions.svelte.d.ts +2 -2
  115. package/dist/components/page/License.svelte.d.ts +2 -2
  116. package/dist/components/page/Loading.svelte.d.ts +2 -2
  117. package/dist/components/page/Media.svelte +5 -2
  118. package/dist/components/page/Media.svelte.d.ts +2 -2
  119. package/dist/components/page/MediaPreview.svelte.d.ts +2 -2
  120. package/dist/components/page/Muted.svelte.d.ts +2 -2
  121. package/dist/components/page/Outline.svelte.d.ts +2 -2
  122. package/dist/components/page/Page.svelte.d.ts +2 -2
  123. package/dist/components/page/PageHeader.svelte.d.ts +2 -2
  124. package/dist/components/page/PageParagraph.svelte.d.ts +2 -2
  125. package/dist/components/page/PossibleChapter.svelte.d.ts +2 -2
  126. package/dist/components/page/PossibleReference.svelte.d.ts +2 -2
  127. package/dist/components/page/Print.svelte.d.ts +2 -2
  128. package/dist/components/page/Publish.svelte.d.ts +2 -2
  129. package/dist/components/page/Reference.svelte +24 -15
  130. package/dist/components/page/Reference.svelte.d.ts +2 -2
  131. package/dist/components/page/References.svelte +6 -2
  132. package/dist/components/page/References.svelte.d.ts +2 -2
  133. package/dist/components/page/Rows.svelte.d.ts +2 -2
  134. package/dist/components/page/Search.svelte +5 -3
  135. package/dist/components/page/Search.svelte.d.ts +2 -2
  136. package/dist/components/page/Status.svelte.d.ts +2 -2
  137. package/dist/components/page/SubdomainEditor.svelte +4 -3
  138. package/dist/components/page/SubdomainEditor.svelte.d.ts +2 -2
  139. package/dist/components/page/TableOfContents.svelte +9 -3
  140. package/dist/components/page/TableOfContents.svelte.d.ts +2 -2
  141. package/dist/components/page/TableOfContentsImage.svelte.d.ts +2 -2
  142. package/dist/components/page/TableOfContentsRow.svelte +4 -2
  143. package/dist/components/page/TableOfContentsRow.svelte.d.ts +2 -2
  144. package/dist/components/page/ThemeEditor.svelte.d.ts +2 -2
  145. package/dist/components/page/ThemeEditorPreview.svelte.d.ts +2 -2
  146. package/dist/components/page/ThemeSetEditor.svelte.d.ts +2 -2
  147. package/dist/components/page/ThemeVariableEditor.svelte.d.ts +2 -2
  148. package/dist/components/page/Title.svelte.d.ts +2 -2
  149. package/dist/components/page/Unknown.svelte.d.ts +2 -2
  150. package/dist/models/CRUD.d.ts +1 -2
  151. package/dist/models/CRUD.js +3 -5
  152. package/dist/models/book/BookMedia.js +8 -3
  153. package/dist/models/book/Chapter.d.ts +1 -1
  154. package/dist/models/book/Chapter.js +2 -3
  155. package/dist/models/book/Edition.d.ts +7 -5
  156. package/dist/models/book/Edition.js +10 -15
  157. package/dist/models/chapter/Caret.d.ts +2 -1
  158. package/dist/models/chapter/Caret.js +20 -6
  159. package/dist/models/chapter/FormatNode.d.ts +4 -1
  160. package/dist/models/chapter/FormatNode.js +53 -9
  161. package/dist/models/chapter/LineBreakNode.d.ts +15 -0
  162. package/dist/models/chapter/LineBreakNode.js +37 -0
  163. package/dist/models/chapter/Parser.d.ts +2 -0
  164. package/dist/models/chapter/Parser.js +12 -2
  165. package/dist/models/chapter/Symbols.d.ts +1 -0
  166. package/dist/models/chapter/Symbols.js +1 -0
  167. package/dist/util/mineReference.js +8 -6
  168. package/package.json +22 -19
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type PossibleChapterProps = typeof __propDef.props;
10
10
  export type PossibleChapterEvents = typeof __propDef.events;
11
11
  export type PossibleChapterSlots = typeof __propDef.slots;
12
- export default class PossibleChapter extends SvelteComponentTyped<PossibleChapterProps, PossibleChapterEvents, PossibleChapterSlots> {
12
+ export default class PossibleChapter extends SvelteComponent<PossibleChapterProps, PossibleChapterEvents, PossibleChapterSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  import FormatNode from '../../models/chapter/FormatNode';
3
3
  import type Ref from '../../models/book/Reference';
4
4
  declare const __propDef: {
@@ -14,6 +14,6 @@ declare const __propDef: {
14
14
  export type PossibleReferenceProps = typeof __propDef.props;
15
15
  export type PossibleReferenceEvents = typeof __propDef.events;
16
16
  export type PossibleReferenceSlots = typeof __propDef.slots;
17
- export default class PossibleReference extends SvelteComponentTyped<PossibleReferenceProps, PossibleReferenceEvents, PossibleReferenceSlots> {
17
+ export default class PossibleReference extends SvelteComponent<PossibleReferenceProps, PossibleReferenceEvents, PossibleReferenceSlots> {
18
18
  }
19
19
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type PrintProps = typeof __propDef.props;
10
10
  export type PrintEvents = typeof __propDef.events;
11
11
  export type PrintSlots = typeof __propDef.slots;
12
- export default class Print extends SvelteComponentTyped<PrintProps, PrintEvents, PrintSlots> {
12
+ export default class Print extends SvelteComponent<PrintProps, PrintEvents, PrintSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type PublishProps = typeof __propDef.props;
10
10
  export type PublishEvents = typeof __propDef.events;
11
11
  export type PublishSlots = typeof __propDef.slots;
12
- export default class Publish extends SvelteComponentTyped<PublishProps, PublishEvents, PublishSlots> {
12
+ export default class Publish extends SvelteComponent<PublishProps, PublishEvents, PublishSlots> {
13
13
  }
14
14
  export {};
@@ -231,7 +231,7 @@ function move(field, direction) {
231
231
  </tr>
232
232
  </Table>
233
233
  {:else}
234
- <!-- If not editable, just render the reference. -->
234
+ <!-- Otherwise, just render the reference. -->
235
235
  <p class="reference">
236
236
  {#if reference.authors}{reference.authors}{:else}<em>Authors</em>{/if}
237
237
  {#if reference.year}({reference.year}){:else}<em>Year</em>{/if}. {#if reference.url === null || reference.url.length === 0}{#if reference.title}{reference.title}{:else}<em
@@ -247,26 +247,31 @@ function move(field, direction) {
247
247
  </p>
248
248
  {/if}
249
249
  {#if edit && editable && !reference.short}
250
- <ConfirmButton
251
- tooltip="delete reference {reference.title}"
252
- confirm="delete reference"
253
- command={() =>
254
- $edition
255
- ? edition.set($edition.withoutReference(reference.citationID))
256
- : undefined}>⨉</ConfirmButton
257
- >
258
- <Button
259
- tooltip="stop editing reference"
260
- command={() => (editing ? stopEditing() : startEditing())}
261
- >{editing ? 'done' : 'edit'}</Button
262
- >
250
+ <div class="controls">
251
+ {#if editable}<Note>{reference.citationID}</Note>{/if}
252
+ <ConfirmButton
253
+ tooltip="delete reference {reference.title}"
254
+ confirm="delete reference"
255
+ command={() =>
256
+ $edition
257
+ ? edition.set(
258
+ $edition.withoutReference(reference.citationID)
259
+ )
260
+ : undefined}>⨉</ConfirmButton
261
+ >
262
+ <Button
263
+ tooltip="stop editing reference"
264
+ command={() => (editing ? stopEditing() : startEditing())}
265
+ >{editing ? 'done' : 'edit'}</Button
266
+ >
267
+ </div>
263
268
  {/if}
264
269
 
265
270
  <style>
266
271
  .reference {
267
272
  line-height: var(--bookish-paragraph-line-height-tight);
268
273
  margin-top: 0;
269
- margin-bottom: var(--bookish-block-padding);
274
+ margin-top: var(--bookish-block-padding);
270
275
  }
271
276
 
272
277
  p {
@@ -289,4 +294,8 @@ function move(field, direction) {
289
294
  td {
290
295
  line-height: 1;
291
296
  }
297
+
298
+ .controls {
299
+ margin-top: calc(var(--bookish-block-padding) / 2);
300
+ }
292
301
  </style>
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  import Reference from '../../models/book/Reference';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -13,6 +13,6 @@ declare const __propDef: {
13
13
  export type ReferenceProps = typeof __propDef.props;
14
14
  export type ReferenceEvents = typeof __propDef.events;
15
15
  export type ReferenceSlots = typeof __propDef.slots;
16
- export default class Reference extends SvelteComponentTyped<ReferenceProps, ReferenceEvents, ReferenceSlots> {
16
+ export default class Reference extends SvelteComponent<ReferenceProps, ReferenceEvents, ReferenceSlots> {
17
17
  }
18
18
  export {};
@@ -36,9 +36,13 @@ if (references !== null) {
36
36
  <Outline
37
37
  slot="outline"
38
38
  previous={$edition.getPreviousChapterID(
39
- ChapterIDs.ReferencesID
39
+ ChapterIDs.ReferencesID,
40
+ editable
41
+ )}
42
+ next={$edition.getNextChapterID(
43
+ ChapterIDs.ReferencesID,
44
+ editable
40
45
  )}
41
- next={$edition.getNextChapterID(ChapterIDs.ReferencesID)}
42
46
  />
43
47
  </Header>
44
48
  {#if editable}<BulkReferenceEditor />{/if}
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type ReferencesProps = typeof __propDef.props;
10
10
  export type ReferencesEvents = typeof __propDef.events;
11
11
  export type ReferencesSlots = typeof __propDef.slots;
12
- export default class References extends SvelteComponentTyped<ReferencesProps, ReferencesEvents, ReferencesSlots> {
12
+ export default class References extends SvelteComponent<ReferencesProps, ReferencesEvents, ReferencesSlots> {
13
13
  }
14
14
  export {};
@@ -1,7 +1,7 @@
1
1
  /** @typedef {typeof __propDef.props} RowsProps */
2
2
  /** @typedef {typeof __propDef.events} RowsEvents */
3
3
  /** @typedef {typeof __propDef.slots} RowsSlots */
4
- export default class Rows extends SvelteComponentTyped<{
4
+ export default class Rows extends SvelteComponent<{
5
5
  [x: string]: never;
6
6
  }, {
7
7
  [evt: string]: CustomEvent<any>;
@@ -12,7 +12,7 @@ export default class Rows extends SvelteComponentTyped<{
12
12
  export type RowsProps = typeof __propDef.props;
13
13
  export type RowsEvents = typeof __propDef.events;
14
14
  export type RowsSlots = typeof __propDef.slots;
15
- import { SvelteComponentTyped } from "svelte";
15
+ import { SvelteComponent } from "svelte";
16
16
  declare const __propDef: {
17
17
  props: {
18
18
  [x: string]: never;
@@ -5,7 +5,6 @@ import Link from '../Link.svelte';
5
5
  import Chapter from '../../models/book/Chapter';
6
6
  import ChapterIDs from '../../models/book/ChapterID';
7
7
  import { getBase, getEdition, isEditionEditable } from './Contexts';
8
- import TextInput from '../app/TextInput.svelte';
9
8
  import ChapterTitle from './ChapterTitle.svelte';
10
9
  import ChapterNumber from './ChapterNumber.svelte';
11
10
  import PageHeader from './PageHeader.svelte';
@@ -76,8 +75,11 @@ $: {
76
75
  >
77
76
  <Outline
78
77
  slot="outline"
79
- previous={$edition.getPreviousChapterID(ChapterIDs.SearchID)}
80
- next={$edition.getNextChapterID(ChapterIDs.SearchID)}
78
+ previous={$edition.getPreviousChapterID(
79
+ ChapterIDs.SearchID,
80
+ false
81
+ )}
82
+ next={$edition.getNextChapterID(ChapterIDs.SearchID, false)}
81
83
  />
82
84
  </Header>
83
85
 
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type SearchProps = typeof __propDef.props;
10
10
  export type SearchEvents = typeof __propDef.events;
11
11
  export type SearchSlots = typeof __propDef.slots;
12
- export default class Search extends SvelteComponentTyped<SearchProps, SearchEvents, SearchSlots> {
12
+ export default class Search extends SvelteComponent<SearchProps, SearchEvents, SearchSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type StatusProps = typeof __propDef.props;
10
10
  export type StatusEvents = typeof __propDef.events;
11
11
  export type StatusSlots = typeof __propDef.slots;
12
- export default class Status extends SvelteComponentTyped<StatusProps, StatusEvents, StatusSlots> {
12
+ export default class Status extends SvelteComponent<StatusProps, StatusEvents, StatusSlots> {
13
13
  }
14
14
  export {};
@@ -1,6 +1,6 @@
1
1
  <script>import TextEditor from '../editor/TextEditor.svelte';
2
2
  import { isSubdomainAvailable } from '../../models/CRUD';
3
- import Note from '../editor/Note.svelte';
3
+ import { getSubdomain } from '../../util/getSubdomain';
4
4
  import { getBook } from './Contexts';
5
5
  import Muted from './Muted.svelte';
6
6
  let book = getBook();
@@ -22,9 +22,10 @@ const invalidNames = [
22
22
  save={// Save the new domain
23
23
  async (domain) => {
24
24
  if ($book) {
25
- const available = await isSubdomainAvailable(domain, $book);
25
+ const available = await isSubdomainAvailable(domain);
26
26
  if (available) book.set($book.withSubdomain(domain));
27
- else throw Error("Domain isn't available");
27
+ else if ($book.getSubdomain() !== domain)
28
+ throw Error("Domain isn't available");
28
29
  }
29
30
  }}
30
31
  placeholder="book name"
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type SubdomainEditorProps = typeof __propDef.props;
10
10
  export type SubdomainEditorEvents = typeof __propDef.events;
11
11
  export type SubdomainEditorSlots = typeof __propDef.slots;
12
- export default class SubdomainEditor extends SvelteComponentTyped<SubdomainEditorProps, SubdomainEditorEvents, SubdomainEditorSlots> {
12
+ export default class SubdomainEditor extends SvelteComponent<SubdomainEditorProps, SubdomainEditorEvents, SubdomainEditorSlots> {
13
13
  }
14
14
  export {};
@@ -95,7 +95,7 @@ onMount(() => {
95
95
  <Outline
96
96
  slot="outline"
97
97
  previous={null}
98
- next={$edition.getNextChapterID('')}
98
+ next={$edition.getNextChapterID('', editable)}
99
99
  />
100
100
  <div slot="after">
101
101
  <Authors
@@ -126,7 +126,7 @@ onMount(() => {
126
126
  <Description />
127
127
 
128
128
  <Instructions {editable}>
129
- This will appear on the <Link to="{$base}/read">book browsing</Link>
129
+ This will appear on the <Link to="/read">book browsing</Link>
130
130
  page and in your table of contents. Write an informative description
131
131
  of what your book is about.
132
132
  </Instructions>
@@ -192,7 +192,7 @@ onMount(() => {
192
192
  You can edit this chapter.
193
193
  {/if}
194
194
  </span>
195
- <span slot="etc">
195
+ <span class="etc" slot="etc">
196
196
  <Muted>
197
197
  {#if editable}
198
198
  <Toggle
@@ -310,3 +310,9 @@ onMount(() => {
310
310
  {/if}
311
311
  </Page>
312
312
  {/if}
313
+
314
+ <style>
315
+ .etc {
316
+ white-space: nowrap;
317
+ }
318
+ </style>
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type TableOfContentsProps = typeof __propDef.props;
10
10
  export type TableOfContentsEvents = typeof __propDef.events;
11
11
  export type TableOfContentsSlots = typeof __propDef.slots;
12
- export default class TableOfContents extends SvelteComponentTyped<TableOfContentsProps, TableOfContentsEvents, TableOfContentsSlots> {
12
+ export default class TableOfContents extends SvelteComponent<TableOfContentsProps, TableOfContentsEvents, TableOfContentsSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  embed: string | null;
@@ -12,6 +12,6 @@ declare const __propDef: {
12
12
  export type TableOfContentsImageProps = typeof __propDef.props;
13
13
  export type TableOfContentsImageEvents = typeof __propDef.events;
14
14
  export type TableOfContentsImageSlots = typeof __propDef.slots;
15
- export default class TableOfContentsImage extends SvelteComponentTyped<TableOfContentsImageProps, TableOfContentsImageEvents, TableOfContentsImageSlots> {
15
+ export default class TableOfContentsImage extends SvelteComponent<TableOfContentsImageProps, TableOfContentsImageEvents, TableOfContentsImageSlots> {
16
16
  }
17
17
  export {};
@@ -76,13 +76,13 @@ $: chapterURL =
76
76
  >
77
77
  <ConfirmButton
78
78
  tooltip="delete chapter {title}"
79
- confirm="delete chapter"
79
+ confirm="delete"
80
80
  command={() =>
81
81
  chapter && $edition
82
82
  ? edition.set(
83
83
  $edition.withoutChapter(chapter.getID())
84
84
  )
85
- : undefined}>- chapter</ConfirmButton
85
+ : undefined}>⨉</ConfirmButton
86
86
  >
87
87
  {/if}
88
88
  </td>
@@ -102,6 +102,8 @@ $: chapterURL =
102
102
  display: flex;
103
103
  flex-direction: row;
104
104
  flex-wrap: nowrap;
105
+ justify-content: end;
106
+ margin-inline-end: var(--app-chrome-padding);
105
107
  gap: var(--app-chrome-padding);
106
108
  }
107
109
 
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  import type Chapter from '../../models/book/Chapter';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -19,6 +19,6 @@ declare const __propDef: {
19
19
  export type TableOfContentsRowProps = typeof __propDef.props;
20
20
  export type TableOfContentsRowEvents = typeof __propDef.events;
21
21
  export type TableOfContentsRowSlots = typeof __propDef.slots;
22
- export default class TableOfContentsRow extends SvelteComponentTyped<TableOfContentsRowProps, TableOfContentsRowEvents, TableOfContentsRowSlots> {
22
+ export default class TableOfContentsRow extends SvelteComponent<TableOfContentsRowProps, TableOfContentsRowEvents, TableOfContentsRowSlots> {
23
23
  }
24
24
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -9,6 +9,6 @@ declare const __propDef: {
9
9
  export type ThemeEditorProps = typeof __propDef.props;
10
10
  export type ThemeEditorEvents = typeof __propDef.events;
11
11
  export type ThemeEditorSlots = typeof __propDef.slots;
12
- export default class ThemeEditor extends SvelteComponentTyped<ThemeEditorProps, ThemeEditorEvents, ThemeEditorSlots> {
12
+ export default class ThemeEditor extends SvelteComponent<ThemeEditorProps, ThemeEditorEvents, ThemeEditorSlots> {
13
13
  }
14
14
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  import type Theme from '../../models/book/Theme';
3
3
  declare const __propDef: {
4
4
  props: {
@@ -12,6 +12,6 @@ declare const __propDef: {
12
12
  export type ThemeEditorPreviewProps = typeof __propDef.props;
13
13
  export type ThemeEditorPreviewEvents = typeof __propDef.events;
14
14
  export type ThemeEditorPreviewSlots = typeof __propDef.slots;
15
- export default class ThemeEditorPreview extends SvelteComponentTyped<ThemeEditorPreviewProps, ThemeEditorPreviewEvents, ThemeEditorPreviewSlots> {
15
+ export default class ThemeEditorPreview extends SvelteComponent<ThemeEditorPreviewProps, ThemeEditorPreviewEvents, ThemeEditorPreviewSlots> {
16
16
  }
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  header: string;
@@ -13,6 +13,6 @@ declare const __propDef: {
13
13
  export type ThemeSetEditorProps = typeof __propDef.props;
14
14
  export type ThemeSetEditorEvents = typeof __propDef.events;
15
15
  export type ThemeSetEditorSlots = typeof __propDef.slots;
16
- export default class ThemeSetEditor extends SvelteComponentTyped<ThemeSetEditorProps, ThemeSetEditorEvents, ThemeSetEditorSlots> {
16
+ export default class ThemeSetEditor extends SvelteComponent<ThemeSetEditorProps, ThemeSetEditorEvents, ThemeSetEditorSlots> {
17
17
  }
18
18
  export {};
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  group: string;
@@ -13,6 +13,6 @@ declare const __propDef: {
13
13
  export type ThemeVariableEditorProps = typeof __propDef.props;
14
14
  export type ThemeVariableEditorEvents = typeof __propDef.events;
15
15
  export type ThemeVariableEditorSlots = typeof __propDef.slots;
16
- export default class ThemeVariableEditor extends SvelteComponentTyped<ThemeVariableEditorProps, ThemeVariableEditorEvents, ThemeVariableEditorSlots> {
16
+ export default class ThemeVariableEditor extends SvelteComponent<ThemeVariableEditorProps, ThemeVariableEditorEvents, ThemeVariableEditorSlots> {
17
17
  }
18
18
  export {};
@@ -1,7 +1,7 @@
1
1
  /** @typedef {typeof __propDef.props} TitleProps */
2
2
  /** @typedef {typeof __propDef.events} TitleEvents */
3
3
  /** @typedef {typeof __propDef.slots} TitleSlots */
4
- export default class Title extends SvelteComponentTyped<{
4
+ export default class Title extends SvelteComponent<{
5
5
  [x: string]: never;
6
6
  }, {
7
7
  [evt: string]: CustomEvent<any>;
@@ -12,7 +12,7 @@ export default class Title extends SvelteComponentTyped<{
12
12
  export type TitleProps = typeof __propDef.props;
13
13
  export type TitleEvents = typeof __propDef.events;
14
14
  export type TitleSlots = typeof __propDef.slots;
15
- import { SvelteComponentTyped } from "svelte";
15
+ import { SvelteComponent } from "svelte";
16
16
  declare const __propDef: {
17
17
  props: {
18
18
  [x: string]: never;
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: Record<string, never>;
4
4
  events: {
@@ -11,6 +11,6 @@ declare const __propDef: {
11
11
  export type UnknownProps = typeof __propDef.props;
12
12
  export type UnknownEvents = typeof __propDef.events;
13
13
  export type UnknownSlots = typeof __propDef.slots;
14
- export default class Unknown extends SvelteComponentTyped<UnknownProps, UnknownEvents, UnknownSlots> {
14
+ export default class Unknown extends SvelteComponent<UnknownProps, UnknownEvents, UnknownSlots> {
15
15
  }
16
16
  export {};
@@ -20,9 +20,8 @@ export declare function updateLock(edition: Edition, uid: string, content: strin
20
20
  * returns a map of DocumentReferences for new chapters so they can be persisted client side.
21
21
  */
22
22
  export declare function updateEdition(book: Book, previousEdition: Edition | undefined, newEdition: Edition): Promise<Map<string, DocumentReference>>;
23
- export declare function deleteChapterText(ref: DocumentReference): Promise<void>;
24
23
  export declare function updateBook(book: Book): Promise<void>;
25
- export declare function isSubdomainAvailable(subdomain: string, book: Book): Promise<boolean>;
24
+ export declare function isSubdomainAvailable(subdomain: string): Promise<boolean>;
26
25
  export declare function getBookIDWithSubdomain(subdomain: string): Promise<string | null>;
27
26
  export declare function publish(edition: Edition): Promise<string | {
28
27
  url: string;
@@ -62,7 +62,8 @@ export function listenToChapters(bookID, editionID, react) {
62
62
  const chapters = [];
63
63
  // For each chapter in the book, if the doc exists and it's not a pending local write, send updated chapters to the front end.
64
64
  docs.forEach((doc) => {
65
- if (doc.exists() && !doc.metadata.hasPendingWrites)
65
+ // We propagate pending writes to cycle back local edits to the client.
66
+ if (doc.exists())
66
67
  // If the chapter text is somehow null, set it to an empty string.
67
68
  // This accounts for previous defects that could lead to null.
68
69
  chapters.push([doc.ref, doc.data().text ?? '']);
@@ -235,15 +236,12 @@ export async function updateEdition(book, previousEdition, newEdition) {
235
236
  await setDoc(doc(db, editionPath(newEdition.bookRef.id, editionRef.id)), newEdition.toObject());
236
237
  return newChapterRefs;
237
238
  }
238
- export async function deleteChapterText(ref) {
239
- deleteDoc(ref);
240
- }
241
239
  export async function updateBook(book) {
242
240
  if (!db)
243
241
  throw Error("Can't update book, not connected to Firebase.");
244
242
  await setDoc(doc(db, 'books', book.getID()), book.toJSON());
245
243
  }
246
- export async function isSubdomainAvailable(subdomain, book) {
244
+ export async function isSubdomainAvailable(subdomain) {
247
245
  if (!db)
248
246
  throw Error('Not connected to Firebase.');
249
247
  return (await getBookIDWithSubdomain(subdomain)) === null;
@@ -85,17 +85,22 @@ export default class BookMedia {
85
85
  // The canonical path format for Bookish images in the store is image/{bookid}/{imageid}
86
86
  // where {bookid} is the Firestore document ID of the book being edited and {imageid} is just a random id.
87
87
  const imageRef = ref(storage, `${this.getImagePath()}/${imageName}`);
88
- const thumbnailRef = ref(storage, `${this.getImagePath()}/thumbnails/${imageName}`);
89
88
  uploadBytes(imageRef, file)
90
89
  .then((snapshot) => {
91
90
  getDownloadURL(snapshot.ref)
92
91
  // After we get the download URL for the uploaded image,
93
92
  // try to get the thumbnail URL for the resized image on the server.
94
93
  .then((url) => finishedHandler(this.stripTokenFromURL(url), this.makeThumbnailURL(this.stripTokenFromURL(url))))
95
- .catch(() => errorHandler('Unable to get image URL.'));
94
+ .catch((error) => {
95
+ console.error(error);
96
+ errorHandler('Unable to get image URL.');
97
+ });
96
98
  })
97
99
  .then(() => this.cacheImages())
98
- .catch(() => errorHandler('Unable to upload image.'));
100
+ .catch((error) => {
101
+ console.error(error);
102
+ errorHandler('Unable to upload image.');
103
+ });
99
104
  // This seems to be broken in Firebase right now. Switched above to a no-feedback approach.
100
105
  // const uploadTask = uploadBytesResumable(imageRef, file);
101
106
  // uploadTask.on("state_changed",
@@ -50,7 +50,7 @@ export default class Chapter {
50
50
  */
51
51
  static fromJSON(spec: ChapterSpecification): Chapter;
52
52
  toJSON(): ChapterSpecification;
53
- getRef(): DocumentReference<import("@firebase/firestore").DocumentData> | undefined;
53
+ getRef(): DocumentReference<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData> | undefined;
54
54
  hasRefID(id: string): boolean;
55
55
  withEditors(uids: string[]): Chapter;
56
56
  withRef(ref: DocumentReference): Chapter;
@@ -156,9 +156,8 @@ export default class Chapter {
156
156
  }
157
157
  getWordCount(edition) {
158
158
  if (this._wordCount === undefined)
159
- this._wordCount = this.getAST(edition)
160
- ?.toText()
161
- .split(/\s+/).length;
159
+ this._wordCount = this.getAST(edition)?.toText().split(/\s+/)
160
+ .length;
162
161
  return this._wordCount;
163
162
  }
164
163
  // Utility function
@@ -27,7 +27,9 @@ export type EditionSpecification = {
27
27
  glossary: Record<string, Definition>;
28
28
  theme: Theme | null;
29
29
  base: string | null;
30
+ /** People who have edit access to this edition */
30
31
  uids: string[];
32
+ /** All uids who have edit access to at least one chapter. Used in firestore rules to give permission to update book. */
31
33
  chapteruids: string[];
32
34
  active: Record<string, string>;
33
35
  };
@@ -57,8 +59,8 @@ export default class Edition {
57
59
  static fromJSON(editionRef: DocumentReference | undefined, spec: EditionSpecification): Edition;
58
60
  static parseReference(citationID: string, ref: string | string[], edition: Edition, short?: boolean): FormatNode | Reference;
59
61
  toObject(): EditionSpecification;
60
- getBookRef(): DocumentReference<import("@firebase/firestore").DocumentData>;
61
- getEditionRef(): DocumentReference<import("@firebase/firestore").DocumentData> | undefined;
62
+ getBookRef(): DocumentReference<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData>;
63
+ getEditionRef(): DocumentReference<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData> | undefined;
62
64
  getChapterUIDS(): string[];
63
65
  withRef(editionRef: DocumentReference | undefined): Edition;
64
66
  getTitle(): string;
@@ -78,7 +80,7 @@ export default class Edition {
78
80
  getChapterPosition(chapterID: string): number | undefined;
79
81
  getChapterCount(): number;
80
82
  withChapters(chapters: Chapter[]): Edition;
81
- withChapterText(text: [DocumentReference, string][]): Edition;
83
+ withChapterText(textByID: Map<string, string>): Edition;
82
84
  withRevisedChapter(previous: Chapter, edited: Chapter): Edition;
83
85
  withoutRefs(): Edition;
84
86
  withIncrementedEditionNumber(): Edition;
@@ -130,8 +132,8 @@ export default class Edition {
130
132
  getChapterSection(chapterID: string): string | undefined;
131
133
  getFootnoteSymbol(number: number): string;
132
134
  getBookIndex(): Record<string, Set<string>>;
133
- getNextChapterID(chapterID: string): string | null;
134
- getPreviousChapterID(chapterID: string): string | null;
135
+ getNextChapterID(chapterID: string, editable: boolean): string | null;
136
+ getPreviousChapterID(chapterID: string, editable: boolean): string | null;
135
137
  getEmbeds(): {
136
138
  embed: EmbedNode;
137
139
  chapterID: string | undefined;