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.
- package/README.md +30 -1
- package/dist/components/Auth.svelte.d.ts +2 -2
- package/dist/components/BookPreview.svelte.d.ts +2 -2
- package/dist/components/Link.svelte.d.ts +2 -2
- package/dist/components/app/BookList.svelte.d.ts +2 -2
- package/dist/components/app/Button.svelte.d.ts +2 -2
- package/dist/components/app/Feedback.svelte.d.ts +2 -2
- package/dist/components/app/Head.svelte.d.ts +2 -2
- package/dist/components/app/Large.svelte.d.ts +2 -2
- package/dist/components/app/Lead.svelte.d.ts +2 -2
- package/dist/components/app/Link.svelte.d.ts +2 -2
- package/dist/components/app/Options.svelte +1 -0
- package/dist/components/app/Options.svelte.d.ts +2 -2
- package/dist/components/app/Paragraph.svelte.d.ts +2 -2
- package/dist/components/app/Section.svelte.d.ts +2 -2
- package/dist/components/app/Table.svelte +0 -1
- package/dist/components/app/Table.svelte.d.ts +2 -2
- package/dist/components/app/TextInput.svelte.d.ts +2 -2
- package/dist/components/chapter/Atom.svelte.d.ts +2 -2
- package/dist/components/chapter/Block.svelte.d.ts +2 -2
- package/dist/components/chapter/Callout.svelte.d.ts +2 -2
- package/dist/components/chapter/CaptionedCode.svelte +21 -19
- package/dist/components/chapter/CaptionedCode.svelte.d.ts +2 -2
- package/dist/components/chapter/ChapterBody.svelte +2 -0
- package/dist/components/chapter/ChapterBody.svelte.d.ts +2 -2
- package/dist/components/chapter/Citations.svelte.d.ts +2 -2
- package/dist/components/chapter/Code.svelte.d.ts +2 -2
- package/dist/components/chapter/Comment.svelte.d.ts +2 -2
- package/dist/components/chapter/Definition.svelte +6 -7
- package/dist/components/chapter/Definition.svelte.d.ts +2 -2
- package/dist/components/chapter/Embed.svelte +4 -3
- package/dist/components/chapter/Embed.svelte.d.ts +2 -2
- package/dist/components/chapter/ErrorMessage.svelte.d.ts +2 -2
- package/dist/components/chapter/Figure.svelte +9 -1
- package/dist/components/chapter/Figure.svelte.d.ts +3 -2
- package/dist/components/chapter/Footnote.svelte.d.ts +2 -2
- package/dist/components/chapter/Format.svelte +21 -16
- package/dist/components/chapter/Format.svelte.d.ts +2 -2
- package/dist/components/chapter/InlineCode.svelte.d.ts +2 -2
- package/dist/components/chapter/Label.svelte.d.ts +2 -2
- package/dist/components/chapter/LineBreak.svelte +6 -0
- package/dist/components/chapter/LineBreak.svelte.d.ts +17 -0
- package/dist/components/chapter/Link.svelte.d.ts +2 -2
- package/dist/components/chapter/List.svelte.d.ts +2 -2
- package/dist/components/chapter/Marginal.svelte +5 -4
- package/dist/components/chapter/Marginal.svelte.d.ts +2 -2
- package/dist/components/chapter/Paragraph.svelte.d.ts +2 -2
- package/dist/components/chapter/Positioned.svelte.d.ts +2 -2
- package/dist/components/chapter/Problem.svelte.d.ts +2 -2
- package/dist/components/chapter/Python.svelte.d.ts +2 -2
- package/dist/components/chapter/Quote.svelte.d.ts +2 -2
- package/dist/components/chapter/Rule.svelte +2 -2
- package/dist/components/chapter/Rule.svelte.d.ts +2 -2
- package/dist/components/chapter/Table.svelte.d.ts +2 -2
- package/dist/components/chapter/Text.svelte.d.ts +2 -2
- package/dist/components/controls/DarkToggle.svelte.d.ts +2 -2
- package/dist/components/editor/BookishEditor.svelte +22 -22
- package/dist/components/editor/BookishEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CalloutEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +2 -2
- package/dist/components/editor/CaretContext.d.ts +1 -1
- package/dist/components/editor/CaretView.svelte +8 -3
- package/dist/components/editor/CaretView.svelte.d.ts +2 -2
- package/dist/components/editor/CitationsEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Commands.js +109 -43
- package/dist/components/editor/ConfirmButton.svelte +7 -1
- package/dist/components/editor/ConfirmButton.svelte.d.ts +2 -2
- package/dist/components/editor/DefinitionEditor.svelte.d.ts +2 -2
- package/dist/components/editor/EmbedEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Icon.svelte.d.ts +2 -2
- package/dist/components/editor/ImageChooser.svelte +2 -1
- package/dist/components/editor/ImageChooser.svelte.d.ts +2 -2
- package/dist/components/editor/ImageThumbnail.svelte +11 -7
- package/dist/components/editor/ImageThumbnail.svelte.d.ts +2 -2
- package/dist/components/editor/InlineCodeEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LabelEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LanguageEditor.svelte.d.ts +2 -2
- package/dist/components/editor/LinkEditor.svelte +4 -3
- package/dist/components/editor/LinkEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Note.svelte.d.ts +2 -2
- package/dist/components/editor/Permissions.svelte.d.ts +2 -2
- package/dist/components/editor/PositionEditor.svelte.d.ts +2 -2
- package/dist/components/editor/QuoteEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Switch.svelte.d.ts +2 -2
- package/dist/components/editor/TableEditor.svelte.d.ts +2 -2
- package/dist/components/editor/TextEditor.svelte.d.ts +2 -2
- package/dist/components/editor/Toggle.svelte.d.ts +2 -2
- package/dist/components/editor/Toolbar.svelte +2 -1
- package/dist/components/editor/Toolbar.svelte.d.ts +2 -2
- package/dist/components/editor/ToolbarGroup.svelte.d.ts +2 -2
- package/dist/components/editor/ToolbarSpacer.svelte.d.ts +2 -2
- package/dist/components/editor/URLEditor.svelte.d.ts +2 -2
- package/dist/components/page/Acknowledgements.svelte.d.ts +2 -2
- package/dist/components/page/Authors.svelte.d.ts +2 -2
- package/dist/components/page/BookLoader.svelte.d.ts +2 -2
- package/dist/components/page/BulkReferenceEditor.svelte +1 -1
- package/dist/components/page/BulkReferenceEditor.svelte.d.ts +2 -2
- package/dist/components/page/Chapter.svelte +4 -5
- package/dist/components/page/Chapter.svelte.d.ts +2 -2
- package/dist/components/page/ChapterNumber.svelte.d.ts +2 -2
- package/dist/components/page/ChapterTitle.svelte.d.ts +2 -2
- package/dist/components/page/DefinitionView.svelte.d.ts +2 -2
- package/dist/components/page/Description.svelte.d.ts +2 -2
- package/dist/components/page/Edition.svelte.d.ts +2 -2
- package/dist/components/page/EditionLoader.svelte +9 -18
- package/dist/components/page/EditionLoader.svelte.d.ts +2 -2
- package/dist/components/page/Editions.svelte +4 -3
- package/dist/components/page/Editions.svelte.d.ts +2 -2
- package/dist/components/page/Glossary.svelte +8 -2
- package/dist/components/page/Glossary.svelte.d.ts +2 -2
- package/dist/components/page/Header.svelte.d.ts +2 -2
- package/dist/components/page/Index.svelte +5 -2
- package/dist/components/page/Index.svelte.d.ts +2 -2
- package/dist/components/page/Instructions.svelte.d.ts +2 -2
- package/dist/components/page/License.svelte.d.ts +2 -2
- package/dist/components/page/Loading.svelte.d.ts +2 -2
- package/dist/components/page/Media.svelte +5 -2
- package/dist/components/page/Media.svelte.d.ts +2 -2
- package/dist/components/page/MediaPreview.svelte.d.ts +2 -2
- package/dist/components/page/Muted.svelte.d.ts +2 -2
- package/dist/components/page/Outline.svelte.d.ts +2 -2
- package/dist/components/page/Page.svelte.d.ts +2 -2
- package/dist/components/page/PageHeader.svelte.d.ts +2 -2
- package/dist/components/page/PageParagraph.svelte.d.ts +2 -2
- package/dist/components/page/PossibleChapter.svelte.d.ts +2 -2
- package/dist/components/page/PossibleReference.svelte.d.ts +2 -2
- package/dist/components/page/Print.svelte.d.ts +2 -2
- package/dist/components/page/Publish.svelte.d.ts +2 -2
- package/dist/components/page/Reference.svelte +24 -15
- package/dist/components/page/Reference.svelte.d.ts +2 -2
- package/dist/components/page/References.svelte +6 -2
- package/dist/components/page/References.svelte.d.ts +2 -2
- package/dist/components/page/Rows.svelte.d.ts +2 -2
- package/dist/components/page/Search.svelte +5 -3
- package/dist/components/page/Search.svelte.d.ts +2 -2
- package/dist/components/page/Status.svelte.d.ts +2 -2
- package/dist/components/page/SubdomainEditor.svelte +4 -3
- package/dist/components/page/SubdomainEditor.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContents.svelte +9 -3
- package/dist/components/page/TableOfContents.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContentsImage.svelte.d.ts +2 -2
- package/dist/components/page/TableOfContentsRow.svelte +4 -2
- package/dist/components/page/TableOfContentsRow.svelte.d.ts +2 -2
- package/dist/components/page/ThemeEditor.svelte.d.ts +2 -2
- package/dist/components/page/ThemeEditorPreview.svelte.d.ts +2 -2
- package/dist/components/page/ThemeSetEditor.svelte.d.ts +2 -2
- package/dist/components/page/ThemeVariableEditor.svelte.d.ts +2 -2
- package/dist/components/page/Title.svelte.d.ts +2 -2
- package/dist/components/page/Unknown.svelte.d.ts +2 -2
- package/dist/models/CRUD.d.ts +1 -2
- package/dist/models/CRUD.js +3 -5
- package/dist/models/book/BookMedia.js +8 -3
- package/dist/models/book/Chapter.d.ts +1 -1
- package/dist/models/book/Chapter.js +2 -3
- package/dist/models/book/Edition.d.ts +7 -5
- package/dist/models/book/Edition.js +10 -15
- package/dist/models/chapter/Caret.d.ts +2 -1
- package/dist/models/chapter/Caret.js +20 -6
- package/dist/models/chapter/FormatNode.d.ts +4 -1
- package/dist/models/chapter/FormatNode.js +53 -9
- package/dist/models/chapter/LineBreakNode.d.ts +15 -0
- package/dist/models/chapter/LineBreakNode.js +37 -0
- package/dist/models/chapter/Parser.d.ts +2 -0
- package/dist/models/chapter/Parser.js +12 -2
- package/dist/models/chapter/Symbols.d.ts +1 -0
- package/dist/models/chapter/Symbols.js +1 -0
- package/dist/util/mineReference.js +8 -6
- package/package.json +22 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
12
|
+
export default class PossibleChapter extends SvelteComponent<PossibleChapterProps, PossibleChapterEvents, PossibleChapterSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
17
|
+
export default class PossibleReference extends SvelteComponent<PossibleReferenceProps, PossibleReferenceEvents, PossibleReferenceSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
12
|
+
export default class Print extends SvelteComponent<PrintProps, PrintEvents, PrintSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
-
<!--
|
|
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
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
>
|
|
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-
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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 {
|
|
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(
|
|
80
|
-
|
|
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 {
|
|
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
|
|
12
|
+
export default class Search extends SvelteComponent<SearchProps, SearchEvents, SearchSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
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
|
|
25
|
+
const available = await isSubdomainAvailable(domain);
|
|
26
26
|
if (available) book.set($book.withSubdomain(domain));
|
|
27
|
-
else
|
|
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 {
|
|
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
|
|
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="
|
|
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 {
|
|
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
|
|
12
|
+
export default class TableOfContents extends SvelteComponent<TableOfContentsProps, TableOfContentsEvents, TableOfContentsSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
79
|
+
confirm="delete"
|
|
80
80
|
command={() =>
|
|
81
81
|
chapter && $edition
|
|
82
82
|
? edition.set(
|
|
83
83
|
$edition.withoutChapter(chapter.getID())
|
|
84
84
|
)
|
|
85
|
-
: undefined}
|
|
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 {
|
|
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
|
|
22
|
+
export default class TableOfContentsRow extends SvelteComponent<TableOfContentsRowProps, TableOfContentsRowEvents, TableOfContentsRowSlots> {
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
12
|
+
export default class ThemeEditor extends SvelteComponent<ThemeEditorProps, ThemeEditorEvents, ThemeEditorSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
15
|
+
export default class ThemeEditorPreview extends SvelteComponent<ThemeEditorPreviewProps, ThemeEditorPreviewEvents, ThemeEditorPreviewSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
16
|
+
export default class ThemeSetEditor extends SvelteComponent<ThemeSetEditorProps, ThemeSetEditorEvents, ThemeSetEditorSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
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 {
|
|
15
|
+
import { SvelteComponent } from "svelte";
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
18
|
[x: string]: never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
14
|
+
export default class Unknown extends SvelteComponent<UnknownProps, UnknownEvents, UnknownSlots> {
|
|
15
15
|
}
|
|
16
16
|
export {};
|
package/dist/models/CRUD.d.ts
CHANGED
|
@@ -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
|
|
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;
|
package/dist/models/CRUD.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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(() =>
|
|
94
|
+
.catch((error) => {
|
|
95
|
+
console.error(error);
|
|
96
|
+
errorHandler('Unable to get image URL.');
|
|
97
|
+
});
|
|
96
98
|
})
|
|
97
99
|
.then(() => this.cacheImages())
|
|
98
|
-
.catch(() =>
|
|
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
|
-
|
|
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(
|
|
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;
|