bookish-press 0.6.53 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Auth.svelte.d.ts +2 -0
- package/dist/components/BookPreview.svelte.d.ts +3 -1
- package/dist/components/Link.svelte.d.ts +3 -1
- package/dist/components/app/BookList.svelte.d.ts +2 -0
- package/dist/components/app/Button.svelte.d.ts +2 -0
- package/dist/components/app/Feedback.svelte.d.ts +3 -1
- package/dist/components/app/Head.svelte.d.ts +3 -1
- package/dist/components/app/Large.svelte.d.ts +2 -0
- package/dist/components/app/Lead.svelte.d.ts +2 -0
- package/dist/components/app/Link.svelte.d.ts +3 -1
- package/dist/components/app/Options.svelte.d.ts +2 -0
- package/dist/components/app/Paragraph.svelte.d.ts +3 -1
- package/dist/components/app/Section.svelte.d.ts +2 -0
- package/dist/components/app/Table.svelte.d.ts +2 -0
- package/dist/components/app/TextInput.svelte.d.ts +5 -3
- package/dist/components/chapter/Atom.svelte.d.ts +2 -0
- package/dist/components/chapter/Block.svelte.d.ts +2 -0
- package/dist/components/chapter/Callout.svelte.d.ts +2 -0
- package/dist/components/chapter/CaptionedCode.svelte.d.ts +2 -0
- package/dist/components/chapter/ChapterBody.svelte.d.ts +4 -2
- package/dist/components/chapter/Citations.svelte.d.ts +2 -0
- package/dist/components/chapter/Code.svelte.d.ts +2 -0
- package/dist/components/chapter/Comment.svelte.d.ts +2 -0
- package/dist/components/chapter/Definition.svelte.d.ts +2 -0
- package/dist/components/chapter/Embed.svelte.d.ts +5 -3
- package/dist/components/chapter/ErrorMessage.svelte.d.ts +2 -0
- package/dist/components/chapter/Figure.svelte.d.ts +3 -1
- package/dist/components/chapter/Footnote.svelte.d.ts +2 -0
- package/dist/components/chapter/Format.svelte.d.ts +2 -0
- package/dist/components/chapter/InlineCode.svelte.d.ts +2 -0
- package/dist/components/chapter/Label.svelte.d.ts +2 -0
- package/dist/components/chapter/LineBreak.svelte.d.ts +2 -0
- package/dist/components/chapter/Link.svelte.d.ts +2 -0
- package/dist/components/chapter/List.svelte.d.ts +2 -0
- package/dist/components/chapter/Marginal.svelte.d.ts +2 -0
- package/dist/components/chapter/Paragraph.svelte.d.ts +2 -0
- package/dist/components/chapter/Positioned.svelte.d.ts +2 -0
- package/dist/components/chapter/Problem.svelte.d.ts +2 -0
- package/dist/components/chapter/Python.svelte.d.ts +2 -0
- package/dist/components/chapter/Quote.svelte.d.ts +2 -0
- package/dist/components/chapter/Rule.svelte.d.ts +2 -0
- package/dist/components/chapter/Table.svelte.d.ts +2 -0
- package/dist/components/chapter/Text.svelte.d.ts +2 -0
- package/dist/components/controls/DarkToggle.svelte.d.ts +2 -0
- package/dist/components/editor/BookishEditor.svelte.d.ts +4 -2
- package/dist/components/editor/CalloutEditor.svelte.d.ts +2 -0
- package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +2 -0
- package/dist/components/editor/CaretView.svelte.d.ts +2 -0
- package/dist/components/editor/CitationsEditor.svelte.d.ts +2 -0
- package/dist/components/editor/ConfirmButton.svelte.d.ts +2 -0
- package/dist/components/editor/DefinitionEditor.svelte.d.ts +2 -0
- package/dist/components/editor/EmbedEditor.svelte.d.ts +2 -0
- package/dist/components/editor/Icon.svelte.d.ts +2 -0
- package/dist/components/editor/ImageChooser.svelte.d.ts +2 -0
- package/dist/components/editor/ImageThumbnail.svelte.d.ts +2 -0
- package/dist/components/editor/InlineCodeEditor.svelte.d.ts +2 -0
- package/dist/components/editor/LabelEditor.svelte.d.ts +2 -0
- package/dist/components/editor/LanguageEditor.svelte.d.ts +2 -0
- package/dist/components/editor/LinkEditor.svelte.d.ts +2 -0
- package/dist/components/editor/Note.svelte.d.ts +2 -0
- package/dist/components/editor/Permissions.svelte.d.ts +2 -0
- package/dist/components/editor/PositionEditor.svelte.d.ts +2 -0
- package/dist/components/editor/QuoteEditor.svelte.d.ts +2 -0
- package/dist/components/editor/Switch.svelte.d.ts +2 -0
- package/dist/components/editor/TableEditor.svelte.d.ts +2 -0
- package/dist/components/editor/TextEditor.svelte +1 -0
- package/dist/components/editor/TextEditor.svelte.d.ts +4 -2
- package/dist/components/editor/Toggle.svelte.d.ts +2 -0
- package/dist/components/editor/Toolbar.svelte.d.ts +2 -0
- package/dist/components/editor/ToolbarGroup.svelte.d.ts +2 -0
- package/dist/components/editor/ToolbarSpacer.svelte.d.ts +2 -0
- package/dist/components/editor/URLEditor.svelte.d.ts +2 -0
- package/dist/components/page/Acknowledgements.svelte +12 -5
- package/dist/components/page/Acknowledgements.svelte.d.ts +2 -0
- package/dist/components/page/Analytics.svelte.d.ts +3 -1
- package/dist/components/page/Authors.svelte.d.ts +3 -1
- package/dist/components/page/BookLoader.svelte.d.ts +2 -0
- package/dist/components/page/BulkReferenceEditor.svelte.d.ts +2 -0
- package/dist/components/page/Chapter.svelte.d.ts +3 -1
- package/dist/components/page/ChapterNumber.svelte.d.ts +2 -0
- package/dist/components/page/ChapterTitle.svelte.d.ts +2 -0
- package/dist/components/page/DefinitionView.svelte.d.ts +2 -0
- package/dist/components/page/Description.svelte.d.ts +2 -0
- package/dist/components/page/EditableHeader.svelte +25 -0
- package/dist/components/page/EditableHeader.svelte.d.ts +20 -0
- package/dist/components/page/Edition.svelte.d.ts +3 -1
- package/dist/components/page/EditionLoader.svelte.d.ts +2 -0
- package/dist/components/page/Editions.svelte.d.ts +3 -1
- package/dist/components/page/Glossary.svelte +10 -4
- package/dist/components/page/Glossary.svelte.d.ts +2 -0
- package/dist/components/page/Header.svelte +1 -0
- package/dist/components/page/Header.svelte.d.ts +5 -3
- package/dist/components/page/Index.svelte +9 -5
- package/dist/components/page/Index.svelte.d.ts +2 -0
- package/dist/components/page/Instructions.svelte.d.ts +2 -0
- package/dist/components/page/License.svelte +3 -3
- package/dist/components/page/License.svelte.d.ts +2 -0
- package/dist/components/page/Loading.svelte.d.ts +2 -0
- package/dist/components/page/Media.svelte +6 -2
- package/dist/components/page/Media.svelte.d.ts +2 -0
- package/dist/components/page/MediaPreview.svelte.d.ts +2 -0
- package/dist/components/page/Muted.svelte.d.ts +2 -0
- package/dist/components/page/Outline.svelte.d.ts +3 -1
- package/dist/components/page/Page.svelte.d.ts +2 -0
- package/dist/components/page/PageHeader.svelte.d.ts +3 -1
- package/dist/components/page/PageParagraph.svelte.d.ts +2 -0
- package/dist/components/page/PossibleChapter.svelte.d.ts +2 -0
- package/dist/components/page/PossibleReference.svelte.d.ts +2 -0
- package/dist/components/page/Print.svelte.d.ts +2 -0
- package/dist/components/page/Publish.svelte.d.ts +2 -0
- package/dist/components/page/Reference.svelte.d.ts +3 -1
- package/dist/components/page/References.svelte +7 -1
- package/dist/components/page/References.svelte.d.ts +2 -0
- package/dist/components/page/Rows.svelte.d.ts +2 -0
- package/dist/components/page/Search.svelte +11 -5
- package/dist/components/page/Search.svelte.d.ts +2 -0
- package/dist/components/page/Status.svelte.d.ts +2 -0
- package/dist/components/page/SubdomainEditor.svelte.d.ts +2 -0
- package/dist/components/page/TableOfContents.svelte +9 -16
- package/dist/components/page/TableOfContents.svelte.d.ts +2 -0
- package/dist/components/page/TableOfContentsImage.svelte.d.ts +2 -0
- package/dist/components/page/TableOfContentsRow.svelte +25 -13
- package/dist/components/page/TableOfContentsRow.svelte.d.ts +6 -5
- package/dist/components/page/ThemeEditor.svelte.d.ts +2 -0
- package/dist/components/page/ThemeEditorPreview.svelte.d.ts +2 -0
- package/dist/components/page/ThemeSetEditor.svelte.d.ts +2 -0
- package/dist/components/page/ThemeVariableEditor.svelte.d.ts +2 -0
- package/dist/components/page/Title.svelte.d.ts +2 -0
- package/dist/components/page/Unknown.svelte +2 -2
- package/dist/components/page/Unknown.svelte.d.ts +2 -0
- package/dist/models/CRUD.js +3 -3
- package/dist/models/book/ChapterID.d.ts +3 -9
- package/dist/models/book/ChapterID.js +1 -1
- package/dist/models/book/Edition.d.ts +12 -4
- package/dist/models/book/Edition.js +56 -22
- package/dist/models/chapter/AtomNode.d.ts +2 -2
- package/dist/models/chapter/FormatNode.d.ts +5 -5
- package/dist/models/chapter/FormatNode.js +10 -5
- package/dist/models/chapter/MetadataNode.d.ts +3 -3
- package/package.json +22 -17
|
@@ -3,13 +3,15 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
previous: string | null;
|
|
5
5
|
next: string | null;
|
|
6
|
-
collapse?: boolean
|
|
6
|
+
collapse?: boolean;
|
|
7
7
|
listener?: ((expanded: boolean, layout: Function) => void) | undefined;
|
|
8
8
|
};
|
|
9
9
|
events: {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type OutlineProps = typeof __propDef.props;
|
|
15
17
|
export type OutlineEvents = typeof __propDef.events;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
id?: string | null
|
|
4
|
+
id?: string | null;
|
|
5
5
|
};
|
|
6
6
|
events: {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
slots: {
|
|
10
10
|
default: {};
|
|
11
11
|
};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type PageHeaderProps = typeof __propDef.props;
|
|
14
16
|
export type PageHeaderEvents = typeof __propDef.events;
|
|
@@ -5,6 +5,8 @@ declare const __propDef: {
|
|
|
5
5
|
[evt: string]: CustomEvent<any>;
|
|
6
6
|
};
|
|
7
7
|
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
export type PossibleChapterProps = typeof __propDef.props;
|
|
10
12
|
export type PossibleChapterEvents = typeof __propDef.events;
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type PossibleReferenceProps = typeof __propDef.props;
|
|
15
17
|
export type PossibleReferenceEvents = typeof __propDef.events;
|
|
@@ -3,12 +3,14 @@ import Reference from '../../models/book/Reference';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
reference: Reference;
|
|
6
|
-
edit?: boolean
|
|
6
|
+
edit?: boolean;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type ReferenceProps = typeof __propDef.props;
|
|
14
16
|
export type ReferenceEvents = typeof __propDef.events;
|
|
@@ -30,8 +30,14 @@ if (references !== null) {
|
|
|
30
30
|
$edition.withImage(ChapterIDs.ReferencesID, embed),
|
|
31
31
|
)
|
|
32
32
|
: undefined}
|
|
33
|
-
header=
|
|
33
|
+
header={$edition.getHeader(ChapterIDs.ReferencesID)}
|
|
34
34
|
tags={$edition.getTags()}
|
|
35
|
+
save={(text) =>
|
|
36
|
+
$edition
|
|
37
|
+
? edition.set(
|
|
38
|
+
$edition.withHeader(ChapterIDs.ReferencesID, text),
|
|
39
|
+
)
|
|
40
|
+
: undefined}
|
|
35
41
|
>
|
|
36
42
|
<Outline
|
|
37
43
|
slot="outline"
|
|
@@ -66,18 +66,24 @@ $: {
|
|
|
66
66
|
setImage={(embed) =>
|
|
67
67
|
$edition
|
|
68
68
|
? edition.set(
|
|
69
|
-
$edition.withImage(ChapterIDs.SearchID, embed)
|
|
69
|
+
$edition.withImage(ChapterIDs.SearchID, embed),
|
|
70
70
|
)
|
|
71
71
|
: undefined}
|
|
72
|
-
header=
|
|
72
|
+
header={$edition.getHeader(ChapterIDs.SearchID)}
|
|
73
73
|
id="search"
|
|
74
74
|
tags={$edition.getTags()}
|
|
75
|
+
save={(text) =>
|
|
76
|
+
$edition
|
|
77
|
+
? edition.set(
|
|
78
|
+
$edition.withHeader(ChapterIDs.SearchID, text),
|
|
79
|
+
)
|
|
80
|
+
: undefined}
|
|
75
81
|
>
|
|
76
82
|
<Outline
|
|
77
83
|
slot="outline"
|
|
78
84
|
previous={$edition.getPreviousChapterID(
|
|
79
85
|
ChapterIDs.SearchID,
|
|
80
|
-
false
|
|
86
|
+
false,
|
|
81
87
|
)}
|
|
82
88
|
next={$edition.getNextChapterID(ChapterIDs.SearchID, false)}
|
|
83
89
|
/>
|
|
@@ -103,7 +109,7 @@ $: {
|
|
|
103
109
|
{:else}
|
|
104
110
|
<p
|
|
105
111
|
>Found {results.filter(
|
|
106
|
-
(result) => !(result instanceof Chapter)
|
|
112
|
+
(result) => !(result instanceof Chapter),
|
|
107
113
|
).length} occurrences of <em>{query}</em>...</p
|
|
108
114
|
>
|
|
109
115
|
{#each results as result}
|
|
@@ -111,7 +117,7 @@ $: {
|
|
|
111
117
|
<PageHeader id={'header-' + result.getID()}
|
|
112
118
|
><ChapterNumber
|
|
113
119
|
>Chapter{#if $edition.getChapterNumber(result.getID()) !== undefined} {$edition.getChapterNumber(
|
|
114
|
-
result.getID()
|
|
120
|
+
result.getID(),
|
|
115
121
|
)}{/if}</ChapterNumber
|
|
116
122
|
> - <ChapterTitle>{result.getTitle()}</ChapterTitle
|
|
117
123
|
></PageHeader
|
|
@@ -5,6 +5,8 @@ declare const __propDef: {
|
|
|
5
5
|
[evt: string]: CustomEvent<any>;
|
|
6
6
|
};
|
|
7
7
|
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
export type SubdomainEditorProps = typeof __propDef.props;
|
|
10
12
|
export type SubdomainEditorEvents = typeof __propDef.events;
|
|
@@ -23,6 +23,7 @@ import Permissions from '../editor/Permissions.svelte';
|
|
|
23
23
|
import Publish from './Publish.svelte';
|
|
24
24
|
import { onMount } from 'svelte';
|
|
25
25
|
import Editions from './Editions.svelte';
|
|
26
|
+
import EditableHeader from './EditableHeader.svelte';
|
|
26
27
|
let auth = getUser();
|
|
27
28
|
let book = getBook();
|
|
28
29
|
let edition = getEdition();
|
|
@@ -176,9 +177,7 @@ onMount(() => {
|
|
|
176
177
|
|
|
177
178
|
<TableOfContentsRow
|
|
178
179
|
{chapter}
|
|
179
|
-
{chapterID}
|
|
180
180
|
number={$edition.getChapterNumber(chapterID)}
|
|
181
|
-
title={chapter.getTitle()}
|
|
182
181
|
forthcoming={chapter.isForthcoming()}
|
|
183
182
|
>
|
|
184
183
|
<span slot="annotation">
|
|
@@ -222,33 +221,27 @@ onMount(() => {
|
|
|
222
221
|
</TableOfContentsRow>
|
|
223
222
|
{/each}
|
|
224
223
|
{#if $edition.hasReferences() || editable}
|
|
225
|
-
<TableOfContentsRow
|
|
226
|
-
chapterID={ChapterIDs.ReferencesID}
|
|
227
|
-
title="References"
|
|
228
|
-
>
|
|
224
|
+
<TableOfContentsRow chapter={ChapterIDs.ReferencesID}>
|
|
229
225
|
<span slot="annotation">Everything cited</span>
|
|
230
226
|
</TableOfContentsRow>
|
|
231
227
|
{/if}
|
|
232
228
|
{#if ($edition.getGlossary() && Object.keys($edition.getGlossary()).length > 0) || editable}
|
|
233
|
-
<TableOfContentsRow
|
|
234
|
-
chapterID={ChapterIDs.GlossaryID}
|
|
235
|
-
title="Glossary"
|
|
236
|
-
>
|
|
229
|
+
<TableOfContentsRow chapter={ChapterIDs.GlossaryID}>
|
|
237
230
|
<span slot="annotation">Definitions</span>
|
|
238
231
|
</TableOfContentsRow>
|
|
239
232
|
{/if}
|
|
240
|
-
<TableOfContentsRow
|
|
233
|
+
<TableOfContentsRow chapter={ChapterIDs.IndexID}>
|
|
241
234
|
<span slot="annotation">Common words and where they are</span>
|
|
242
235
|
</TableOfContentsRow>
|
|
243
|
-
<TableOfContentsRow
|
|
236
|
+
<TableOfContentsRow chapter={ChapterIDs.SearchID}>
|
|
244
237
|
<span slot="annotation">Find where words occur</span>
|
|
245
238
|
</TableOfContentsRow>
|
|
246
239
|
|
|
247
|
-
<TableOfContentsRow
|
|
240
|
+
<TableOfContentsRow chapter={ChapterIDs.MediaID}>
|
|
248
241
|
<span slot="annotation">Images and video in the book</span>
|
|
249
242
|
</TableOfContentsRow>
|
|
250
243
|
{#if editable}
|
|
251
|
-
<TableOfContentsRow
|
|
244
|
+
<TableOfContentsRow chapter={ChapterIDs.UnknownID}>
|
|
252
245
|
<span slot="annotation">Customize bad links</span>
|
|
253
246
|
</TableOfContentsRow>
|
|
254
247
|
{/if}
|
|
@@ -257,7 +250,7 @@ onMount(() => {
|
|
|
257
250
|
<Acknowledgements />
|
|
258
251
|
<License />
|
|
259
252
|
|
|
260
|
-
<
|
|
253
|
+
<EditableHeader id="print" label="Edit print header" />
|
|
261
254
|
|
|
262
255
|
<Instructions {editable}>
|
|
263
256
|
This link will generate the entire book on a single page, suitable
|
|
@@ -270,7 +263,7 @@ onMount(() => {
|
|
|
270
263
|
> and then print or export. Long books can take some time to render.
|
|
271
264
|
</PageParagraph>
|
|
272
265
|
|
|
273
|
-
<
|
|
266
|
+
<EditableHeader id="citation" label="Edit citation header" />
|
|
274
267
|
|
|
275
268
|
<Instructions {editable}>
|
|
276
269
|
This citation is created from the current authors, title, and date.
|
|
@@ -5,6 +5,8 @@ declare const __propDef: {
|
|
|
5
5
|
[evt: string]: CustomEvent<any>;
|
|
6
6
|
};
|
|
7
7
|
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
export type TableOfContentsProps = typeof __propDef.props;
|
|
10
12
|
export type TableOfContentsEvents = typeof __propDef.events;
|
|
@@ -8,6 +8,8 @@ declare const __propDef: {
|
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
11
13
|
};
|
|
12
14
|
export type TableOfContentsImageProps = typeof __propDef.props;
|
|
13
15
|
export type TableOfContentsImageEvents = typeof __propDef.events;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import TableOfContentsImage from './TableOfContentsImage.svelte';
|
|
2
|
+
import Chapter from '../../models/book/Chapter';
|
|
2
3
|
import Toggle from '../editor/Toggle.svelte';
|
|
3
4
|
import ConfirmButton from '../editor/ConfirmButton.svelte';
|
|
4
5
|
import { getBase, getEdition, isEditionEditable, setChapter, } from './Contexts';
|
|
@@ -7,32 +8,43 @@ import ChapterNumber from './ChapterNumber.svelte';
|
|
|
7
8
|
import Button from '../app/Button.svelte';
|
|
8
9
|
import ChapterTitle from './ChapterTitle.svelte';
|
|
9
10
|
import Authors from './Authors.svelte';
|
|
10
|
-
|
|
11
|
-
export let chapter
|
|
12
|
-
export let title;
|
|
11
|
+
/** Either the chapter or a built in chapter ID */
|
|
12
|
+
export let chapter;
|
|
13
13
|
export let number = undefined;
|
|
14
14
|
export let forthcoming = false;
|
|
15
15
|
let edition = getEdition();
|
|
16
16
|
let base = getBase();
|
|
17
17
|
let editable = isEditionEditable();
|
|
18
|
+
$: title =
|
|
19
|
+
chapter instanceof Chapter
|
|
20
|
+
? chapter.getTitle()
|
|
21
|
+
: $edition
|
|
22
|
+
? $edition.getHeader(chapter)
|
|
23
|
+
: '—';
|
|
18
24
|
function moveUp() {
|
|
19
|
-
if ($edition && chapter)
|
|
20
|
-
edition.set($edition.withMovedChapter(
|
|
25
|
+
if ($edition && chapter instanceof Chapter)
|
|
26
|
+
edition.set($edition.withMovedChapter(getChapterID(), -1));
|
|
21
27
|
}
|
|
22
28
|
function moveDown() {
|
|
23
|
-
if ($edition && chapter)
|
|
24
|
-
edition.set($edition.withMovedChapter(
|
|
29
|
+
if ($edition && chapter instanceof Chapter)
|
|
30
|
+
edition.set($edition.withMovedChapter(getChapterID(), 1));
|
|
31
|
+
}
|
|
32
|
+
function getChapterID() {
|
|
33
|
+
if (chapter instanceof Chapter)
|
|
34
|
+
return chapter.getID();
|
|
35
|
+
else
|
|
36
|
+
return chapter;
|
|
25
37
|
}
|
|
26
38
|
$: chapterURL =
|
|
27
|
-
forthcoming && !editable ? undefined : `${$base}/${
|
|
39
|
+
forthcoming && !editable ? undefined : `${$base}/${getChapterID()}`;
|
|
28
40
|
</script>
|
|
29
41
|
|
|
30
42
|
<tr class="toc-row" class:forthcoming>
|
|
31
43
|
<td
|
|
32
44
|
><TableOfContentsImage
|
|
33
|
-
embed={chapter
|
|
45
|
+
embed={chapter instanceof Chapter
|
|
34
46
|
? chapter.getImage()
|
|
35
|
-
: $edition?.getImage(
|
|
47
|
+
: ($edition?.getImage(chapter) ?? null)}
|
|
36
48
|
url={chapterURL}
|
|
37
49
|
/></td
|
|
38
50
|
>
|
|
@@ -41,7 +53,7 @@ $: chapterURL =
|
|
|
41
53
|
<Toggle
|
|
42
54
|
on={number !== undefined}
|
|
43
55
|
save={(on) =>
|
|
44
|
-
chapter
|
|
56
|
+
chapter instanceof Chapter
|
|
45
57
|
? setChapter(edition, chapter, chapter.asNumbered(on))
|
|
46
58
|
: undefined}
|
|
47
59
|
>
|
|
@@ -57,7 +69,7 @@ $: chapterURL =
|
|
|
57
69
|
<ChapterNumber>{'Chapter ' + number}</ChapterNumber>
|
|
58
70
|
{/if}
|
|
59
71
|
<ChapterTitle link={chapterURL}>{title}</ChapterTitle>
|
|
60
|
-
{#if chapter && chapter.getAuthors().length > 0}
|
|
72
|
+
{#if chapter instanceof Chapter && chapter.getAuthors().length > 0}
|
|
61
73
|
<Authors
|
|
62
74
|
editable={false}
|
|
63
75
|
authors={chapter.getAuthors()}
|
|
@@ -70,7 +82,7 @@ $: chapterURL =
|
|
|
70
82
|
<td><slot name="etc" /></td>
|
|
71
83
|
{#if editable && $edition}
|
|
72
84
|
<td class="controls">
|
|
73
|
-
{#if chapter}
|
|
85
|
+
{#if chapter instanceof Chapter}
|
|
74
86
|
<Button
|
|
75
87
|
tooltip="move chapter {title} up"
|
|
76
88
|
disabled={$edition.getChapterPosition(chapter.getID()) ===
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import
|
|
2
|
+
import Chapter from '../../models/book/Chapter';
|
|
3
|
+
import type { ChapterIDKey } from '../../models/book/ChapterID';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
|
-
|
|
6
|
-
chapter?: Chapter | undefined;
|
|
7
|
-
title: string;
|
|
6
|
+
/** Either the chapter or a built in chapter ID */ chapter: Chapter | ChapterIDKey;
|
|
8
7
|
number?: number | undefined;
|
|
9
|
-
forthcoming?: boolean
|
|
8
|
+
forthcoming?: boolean;
|
|
10
9
|
};
|
|
11
10
|
events: {
|
|
12
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -15,6 +14,8 @@ declare const __propDef: {
|
|
|
15
14
|
annotation: {};
|
|
16
15
|
etc: {};
|
|
17
16
|
};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
18
19
|
};
|
|
19
20
|
export type TableOfContentsRowProps = typeof __propDef.props;
|
|
20
21
|
export type TableOfContentsRowEvents = typeof __propDef.events;
|
|
@@ -8,6 +8,8 @@ declare const __propDef: {
|
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
11
13
|
};
|
|
12
14
|
export type ThemeEditorPreviewProps = typeof __propDef.props;
|
|
13
15
|
export type ThemeEditorPreviewEvents = typeof __propDef.events;
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type ThemeSetEditorProps = typeof __propDef.props;
|
|
14
16
|
export type ThemeSetEditorEvents = typeof __propDef.events;
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type ThemeVariableEditorProps = typeof __propDef.props;
|
|
14
16
|
export type ThemeVariableEditorEvents = typeof __propDef.events;
|
|
@@ -18,10 +18,10 @@ let edition = getEdition();
|
|
|
18
18
|
setImage={(embed) =>
|
|
19
19
|
$edition
|
|
20
20
|
? edition.set(
|
|
21
|
-
$edition.withImage(ChapterIDs.UnknownID, embed)
|
|
21
|
+
$edition.withImage(ChapterIDs.UnknownID, embed),
|
|
22
22
|
)
|
|
23
23
|
: undefined}
|
|
24
|
-
header=
|
|
24
|
+
header={$edition.getHeader(ChapterIDs.UnknownID)}
|
|
25
25
|
>
|
|
26
26
|
<Outline slot="outline" previous={null} next={null} />
|
|
27
27
|
</Header>
|
package/dist/models/CRUD.js
CHANGED
|
@@ -78,7 +78,7 @@ export function listenToChapters(bookID, editionID, react) {
|
|
|
78
78
|
export async function getUserEmails(uids) {
|
|
79
79
|
if (!functions)
|
|
80
80
|
throw Error("Can't publish, no connection to Firebase functions.");
|
|
81
|
-
const getUserEmails = httpsCallable(functions, '
|
|
81
|
+
const getUserEmails = httpsCallable(functions, 'getUserEmailsGen2');
|
|
82
82
|
const result = await getUserEmails({
|
|
83
83
|
uids,
|
|
84
84
|
});
|
|
@@ -87,7 +87,7 @@ export async function getUserEmails(uids) {
|
|
|
87
87
|
export async function createUser(email) {
|
|
88
88
|
if (!functions)
|
|
89
89
|
throw Error("Can't publish, no connection to Firebase functions.");
|
|
90
|
-
const createUserWithEmail = httpsCallable(functions, '
|
|
90
|
+
const createUserWithEmail = httpsCallable(functions, 'createUserWithEmailGen2');
|
|
91
91
|
const result = await createUserWithEmail({
|
|
92
92
|
email,
|
|
93
93
|
});
|
|
@@ -113,7 +113,7 @@ export async function createBook(userID) {
|
|
|
113
113
|
// Create a model to store it.
|
|
114
114
|
let book = Book.fromJSON(bookRef.id, newBookData);
|
|
115
115
|
// Make a new default edition with a single chapter with this user id.
|
|
116
|
-
let newEdition = new Edition(bookRef, undefined, [], 'Untitled', [], 1, '', null, {}, '', [], 'All rights reserved.', '', [], {}, {}, {}, {}, null, null, {}, null).withNewChapter();
|
|
116
|
+
let newEdition = new Edition(bookRef, undefined, [], 'Untitled', [], 1, '', null, {}, undefined, '', [], 'All rights reserved.', '', [], {}, {}, {}, {}, null, null, {}, null).withNewChapter();
|
|
117
117
|
// Add the edition to the editions collection in the database so we can get an edition ref.
|
|
118
118
|
const editionRef = await addDoc(collection(db, 'books', bookRef.id, 'editions'), newEdition.toObject());
|
|
119
119
|
// Remember the ref.
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SearchID: string;
|
|
5
|
-
MediaID: string;
|
|
6
|
-
IndexID: string;
|
|
7
|
-
GlossaryID: string;
|
|
8
|
-
UnknownID: string;
|
|
9
|
-
};
|
|
1
|
+
export type ChapterIDKey = 'references' | 'search' | 'media' | 'index' | 'glossary' | 'unknown' | 'cover';
|
|
2
|
+
export type TOCHeaderKey = 'chapters' | 'acknowledgements' | 'license' | 'print' | 'citation';
|
|
3
|
+
declare const ChapterIDs: Record<string, ChapterIDKey>;
|
|
10
4
|
export default ChapterIDs;
|
|
@@ -4,6 +4,7 @@ import EmbedNode from '../chapter/EmbedNode';
|
|
|
4
4
|
import Reference from './Reference';
|
|
5
5
|
import type Theme from './Theme';
|
|
6
6
|
import type Definition from './Definition.js';
|
|
7
|
+
import { type ChapterIDKey, type TOCHeaderKey } from './ChapterID.js';
|
|
7
8
|
import type { DocumentReference } from 'firebase/firestore';
|
|
8
9
|
import type Book from './Book';
|
|
9
10
|
import type FormatNode from '../chapter/FormatNode';
|
|
@@ -15,7 +16,10 @@ export type EditionSpecification = {
|
|
|
15
16
|
summary: string;
|
|
16
17
|
published: number | null;
|
|
17
18
|
authors: string[];
|
|
18
|
-
images
|
|
19
|
+
/** Custom images for built-in chapters */
|
|
20
|
+
images: Record<ChapterIDKey, string | null>;
|
|
21
|
+
/** Optional custom names for built-in chapters */
|
|
22
|
+
headers?: Record<ChapterIDKey | TOCHeaderKey, string> | undefined;
|
|
19
23
|
description: string;
|
|
20
24
|
chapters: ChapterSpecification[];
|
|
21
25
|
license: string;
|
|
@@ -45,6 +49,7 @@ export default class Edition {
|
|
|
45
49
|
readonly summary: string;
|
|
46
50
|
readonly published: number | null;
|
|
47
51
|
readonly images: Record<string, string | null>;
|
|
52
|
+
readonly headers: Record<ChapterIDKey | TOCHeaderKey, string> | undefined;
|
|
48
53
|
readonly description: string;
|
|
49
54
|
readonly chapters: Chapter[];
|
|
50
55
|
readonly license: string;
|
|
@@ -58,7 +63,7 @@ export default class Edition {
|
|
|
58
63
|
readonly base: string | null;
|
|
59
64
|
readonly active: Record<string, string>;
|
|
60
65
|
readonly gtagid: string | null;
|
|
61
|
-
constructor(bookRef: DocumentReference, editionRef: DocumentReference | undefined, uids: string[], title: string, authors: string[], number: number, summary: string, published: number | null, images: Record<string, string | null>, description: string, chapters: Chapter[], license: string, acknowledgements: string, tags: string[], sources: Record<string, string>, references: Record<string, string | string[]> | Record<string, FormatNode | Reference>, symbols: Record<string, string>, glossary: Record<string, Definition>, theme: Theme | null, base: string | null, active: Record<string, string>, gtagid: string | null);
|
|
66
|
+
constructor(bookRef: DocumentReference, editionRef: DocumentReference | undefined, uids: string[], title: string, authors: string[], number: number, summary: string, published: number | null, images: Record<string, string | null>, headers: Record<ChapterIDKey | TOCHeaderKey, string> | undefined, description: string, chapters: Chapter[], license: string, acknowledgements: string, tags: string[], sources: Record<string, string>, references: Record<string, string | string[]> | Record<string, FormatNode | Reference>, symbols: Record<string, string>, glossary: Record<string, Definition>, theme: Theme | null, base: string | null, active: Record<string, string>, gtagid: string | null);
|
|
62
67
|
static fromJSON(editionRef: DocumentReference | undefined, spec: EditionSpecification): Edition;
|
|
63
68
|
static parseReference(citationID: string, ref: string | string[], edition: Edition, short?: boolean): FormatNode | Reference;
|
|
64
69
|
toObject(): EditionSpecification;
|
|
@@ -120,8 +125,8 @@ export default class Edition {
|
|
|
120
125
|
withAuthorName(index: number, name: string): Edition;
|
|
121
126
|
withoutAuthor(index: number): Edition;
|
|
122
127
|
withEditors(uids: string[]): Edition;
|
|
123
|
-
hasImage(id:
|
|
124
|
-
getImage(id: string): string | null;
|
|
128
|
+
hasImage(id: ChapterIDKey): boolean;
|
|
129
|
+
getImage(id: ChapterIDKey | string): string | null;
|
|
125
130
|
withImage(id: string, embed: string | null): Edition;
|
|
126
131
|
isEditor(uid: string): boolean;
|
|
127
132
|
isChapterEditor(uid: string): boolean;
|
|
@@ -145,6 +150,9 @@ export default class Edition {
|
|
|
145
150
|
}[];
|
|
146
151
|
isLatestEdition(book: Book): boolean;
|
|
147
152
|
isLatestPublishedEdition(book: Book): boolean;
|
|
153
|
+
/** Get the custom header, if there is one */
|
|
154
|
+
getHeader(id: ChapterIDKey | TOCHeaderKey): string;
|
|
155
|
+
withHeader(id: ChapterIDKey | TOCHeaderKey, header: string): Edition;
|
|
148
156
|
getEditionNumber(): number;
|
|
149
157
|
getEditionLabel(): string;
|
|
150
158
|
getInfo(): EditionInfo | undefined;
|