bookish-press 0.4.1 → 0.4.16
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 +3 -1
- package/components/Auth.svelte +19 -14
- package/components/Auth.svelte.d.ts +4 -4
- package/components/Authentication.d.ts +2 -2
- package/components/BookPreview.svelte +77 -59
- package/components/BookPreview.svelte.d.ts +5 -5
- package/components/External.svelte +1 -1
- package/components/External.svelte.d.ts +3 -3
- package/components/Link.svelte +49 -3
- package/components/Link.svelte.d.ts +3 -4
- package/components/app/BookList.svelte +19 -0
- package/components/app/BookList.svelte.d.ts +18 -0
- package/components/app/Button.svelte +49 -0
- package/components/app/Button.svelte.d.ts +22 -0
- package/components/app/Feedback.svelte +45 -0
- package/components/app/Feedback.svelte.d.ts +18 -0
- package/components/app/Head.svelte +12 -0
- package/components/app/Head.svelte.d.ts +27 -0
- package/components/app/Large.svelte +8 -0
- package/components/app/Large.svelte.d.ts +27 -0
- package/components/app/Lead.svelte +12 -0
- package/components/app/Lead.svelte.d.ts +27 -0
- package/components/app/Link.svelte +24 -0
- package/components/app/Link.svelte.d.ts +20 -0
- package/components/app/Options.svelte +24 -0
- package/components/app/Options.svelte.d.ts +19 -0
- package/components/app/Paragraph.svelte +19 -0
- package/components/app/Paragraph.svelte.d.ts +18 -0
- package/components/app/Table.svelte +32 -0
- package/components/app/Table.svelte.d.ts +27 -0
- package/components/app/TextInput.svelte +37 -0
- package/components/app/TextInput.svelte.d.ts +22 -0
- package/components/app/Writing.svelte +13 -0
- package/components/app/Writing.svelte.d.ts +27 -0
- package/components/chapter/Atom.svelte +20 -6
- package/components/chapter/Atom.svelte.d.ts +3 -3
- package/components/chapter/Block.svelte +23 -20
- package/components/chapter/Block.svelte.d.ts +4 -4
- package/components/chapter/Callout.svelte +38 -7
- package/components/chapter/Callout.svelte.d.ts +4 -4
- package/components/chapter/CaptionedCode.svelte +66 -23
- package/components/chapter/CaptionedCode.svelte.d.ts +4 -4
- package/components/chapter/ChapterBody.svelte +61 -9
- package/components/chapter/ChapterBody.svelte.d.ts +4 -4
- package/components/chapter/Citations.svelte +86 -20
- package/components/chapter/Citations.svelte.d.ts +4 -4
- package/components/chapter/Code.svelte +152 -21
- package/components/chapter/Code.svelte.d.ts +3 -3
- package/components/chapter/Comment.svelte +38 -16
- package/components/chapter/Comment.svelte.d.ts +3 -3
- package/components/chapter/Definition.svelte +52 -18
- package/components/chapter/Definition.svelte.d.ts +5 -8
- package/components/chapter/Embed.svelte +154 -66
- package/components/chapter/Embed.svelte.d.ts +5 -4
- package/components/chapter/ErrorMessage.svelte +7 -2
- package/components/chapter/ErrorMessage.svelte.d.ts +4 -4
- package/components/chapter/ExtendedPrism.d.ts +2 -0
- package/components/chapter/ExtendedPrism.js +69 -0
- package/components/chapter/Figure.svelte +90 -0
- package/components/chapter/Figure.svelte.d.ts +24 -0
- package/components/chapter/Footnote.svelte +75 -12
- package/components/chapter/Footnote.svelte.d.ts +4 -4
- package/components/chapter/Format.svelte +60 -37
- package/components/chapter/Format.svelte.d.ts +4 -4
- package/components/chapter/InlineCode.svelte +15 -5
- package/components/chapter/InlineCode.svelte.d.ts +4 -4
- package/components/chapter/Label.svelte +37 -8
- package/components/chapter/Label.svelte.d.ts +4 -4
- package/components/chapter/Link.svelte +23 -18
- package/components/chapter/Link.svelte.d.ts +4 -4
- package/components/chapter/List.svelte +75 -8
- package/components/chapter/List.svelte.d.ts +4 -4
- package/components/chapter/Marginal.svelte +169 -27
- package/components/chapter/Marginal.svelte.d.ts +6 -3
- package/components/chapter/Paragraph.svelte +74 -6
- package/components/chapter/Paragraph.svelte.d.ts +4 -4
- package/components/chapter/Positioned.svelte +33 -0
- package/components/chapter/Positioned.svelte.d.ts +19 -0
- package/components/chapter/Problem.svelte +15 -0
- package/components/chapter/Problem.svelte.d.ts +27 -0
- package/components/chapter/Python.svelte +68 -21
- package/components/chapter/Python.svelte.d.ts +4 -4
- package/components/chapter/Quote.svelte +64 -11
- package/components/chapter/Quote.svelte.d.ts +4 -4
- package/components/chapter/Rule.svelte +12 -1
- package/components/chapter/Rule.svelte.d.ts +4 -4
- package/components/chapter/Table.svelte +36 -25
- package/components/chapter/Table.svelte.d.ts +4 -4
- package/components/chapter/Text.svelte +61 -36
- package/components/chapter/Text.svelte.d.ts +5 -4
- package/components/editor/BookishEditor.svelte +343 -237
- package/components/editor/BookishEditor.svelte.d.ts +5 -5
- package/components/editor/CalloutEditor.svelte +5 -5
- package/components/editor/CalloutEditor.svelte.d.ts +4 -4
- package/components/editor/CaptionedCodeEditor.svelte +16 -12
- package/components/editor/CaptionedCodeEditor.svelte.d.ts +4 -4
- package/components/editor/CaretContext.d.ts +48 -16
- package/components/editor/CaretState.d.ts +16 -44
- package/components/editor/CaretUtilities.d.ts +2 -2
- package/components/editor/CaretView.svelte +80 -0
- package/components/editor/CaretView.svelte.d.ts +24 -0
- package/components/editor/CitationsEditor.svelte +36 -25
- package/components/editor/CitationsEditor.svelte.d.ts +4 -4
- package/components/editor/Clipboard.d.ts +2 -2
- package/components/editor/Command.d.ts +13 -12
- package/components/editor/Commands.d.ts +1 -1
- package/components/editor/Commands.js +1114 -571
- package/components/editor/ConfirmButton.svelte +18 -12
- package/components/editor/ConfirmButton.svelte.d.ts +5 -4
- package/components/editor/DefinitionEditor.svelte +29 -21
- package/components/editor/DefinitionEditor.svelte.d.ts +4 -4
- package/components/editor/EmbedEditor.svelte +93 -43
- package/components/editor/EmbedEditor.svelte.d.ts +3 -3
- package/components/editor/Icon.svelte +17 -0
- package/components/editor/Icon.svelte.d.ts +16 -0
- package/components/editor/ImageChooser.svelte +53 -34
- package/components/editor/ImageChooser.svelte.d.ts +3 -3
- package/components/editor/InlineCodeEditor.svelte +7 -4
- package/components/editor/InlineCodeEditor.svelte.d.ts +4 -4
- package/components/editor/LabelEditor.svelte +20 -11
- package/components/editor/LabelEditor.svelte.d.ts +4 -4
- package/components/editor/LanguageEditor.svelte +10 -7
- package/components/editor/LanguageEditor.svelte.d.ts +3 -3
- package/components/editor/LinkEditor.svelte +64 -39
- package/components/editor/LinkEditor.svelte.d.ts +4 -4
- package/components/editor/Note.svelte +3 -3
- package/components/editor/Note.svelte.d.ts +6 -2
- package/components/editor/PositionEditor.svelte +9 -6
- package/components/editor/PositionEditor.svelte.d.ts +4 -4
- package/components/editor/QuoteEditor.svelte +7 -2
- package/components/editor/QuoteEditor.svelte.d.ts +4 -4
- package/components/editor/Switch.svelte +55 -28
- package/components/editor/Switch.svelte.d.ts +4 -4
- package/components/editor/TableEditor.svelte +10 -0
- package/components/editor/TableEditor.svelte.d.ts +17 -0
- package/components/editor/TextEditor.svelte +83 -45
- package/components/editor/TextEditor.svelte.d.ts +5 -4
- package/components/editor/Toggle.svelte +11 -8
- package/components/editor/Toggle.svelte.d.ts +4 -4
- package/components/editor/Toolbar.svelte +192 -144
- package/components/editor/Toolbar.svelte.d.ts +5 -8
- package/components/editor/ToolbarGroup.svelte +18 -23
- package/components/editor/ToolbarGroup.svelte.d.ts +3 -4
- package/components/editor/ToolbarSpacer.svelte +8 -1
- package/components/editor/ToolbarSpacer.svelte.d.ts +6 -2
- package/components/editor/URLEditor.svelte +6 -8
- package/components/editor/URLEditor.svelte.d.ts +3 -3
- package/components/editor/UndoState.d.ts +3 -3
- package/components/editor/icons/annotate.svg +1 -0
- package/components/editor/icons/block.svg +1 -0
- package/components/editor/icons/bold.svg +1 -0
- package/components/editor/icons/bullets.svg +1 -0
- package/components/editor/icons/callout.svg +1 -0
- package/components/editor/icons/citation.svg +8 -0
- package/components/editor/icons/clear.svg +1 -0
- package/components/editor/icons/clipboard.svg +1 -0
- package/components/editor/icons/code.svg +1 -0
- package/components/editor/icons/columnafter.svg +1 -0
- package/components/editor/icons/columnbefore.svg +1 -0
- package/components/editor/icons/comment.svg +1 -0
- package/components/editor/icons/copy.svg +1 -0
- package/components/editor/icons/cut.svg +1 -0
- package/components/editor/icons/define.svg +7 -0
- package/components/editor/icons/deletecolumn.svg +1 -0
- package/components/editor/icons/deleterow.svg +1 -0
- package/components/editor/icons/footnote.svg +8 -0
- package/components/editor/icons/header1.svg +7 -0
- package/components/editor/icons/header2.svg +7 -0
- package/components/editor/icons/header3.svg +7 -0
- package/components/editor/icons/home.svg +1 -0
- package/components/editor/icons/indent.svg +1 -0
- package/components/editor/icons/italic.svg +1 -0
- package/components/editor/icons/label.svg +1 -0
- package/components/editor/icons/left.svg +1 -0
- package/components/editor/icons/level.svg +1 -0
- package/components/editor/icons/link.svg +1 -0
- package/components/editor/icons/list.svg +1 -0
- package/components/editor/icons/media.svg +1 -0
- package/components/editor/icons/middle.svg +1 -0
- package/components/editor/icons/numbers.svg +10 -0
- package/components/editor/icons/paragraph.svg +1 -0
- package/components/editor/icons/paste.svg +10 -0
- package/components/editor/icons/quote.svg +1 -0
- package/components/editor/icons/redo.svg +1 -0
- package/components/editor/icons/right.svg +1 -0
- package/components/editor/icons/rowabove.svg +1 -0
- package/components/editor/icons/rowbelow.svg +1 -0
- package/components/editor/icons/rule.svg +1 -0
- package/components/editor/icons/sub.svg +1 -0
- package/components/editor/icons/super.svg +1 -0
- package/components/editor/icons/table.svg +1 -0
- package/components/editor/icons/text.svg +1 -0
- package/components/editor/icons/time.svg +1 -0
- package/components/editor/icons/undo.svg +1 -0
- package/components/editor/icons/unindent.svg +1 -0
- package/components/editor/icons/unlink.svg +1 -0
- package/components/page/Acknowledgements.svelte +31 -22
- package/components/page/Acknowledgements.svelte.d.ts +4 -4
- package/components/page/Authors.svelte +34 -14
- package/components/page/Authors.svelte.d.ts +6 -6
- package/components/page/BulkReferenceEditor.svelte +53 -22
- package/components/page/BulkReferenceEditor.svelte.d.ts +4 -4
- package/components/page/Chapter.svelte +196 -141
- package/components/page/Chapter.svelte.d.ts +3 -3
- package/components/page/ChapterContext.d.ts +4 -4
- package/components/page/ChapterNumber.svelte +9 -0
- package/components/page/ChapterNumber.svelte.d.ts +27 -0
- package/components/page/ChapterTitle.svelte +16 -0
- package/components/page/ChapterTitle.svelte.d.ts +18 -0
- package/components/page/Contexts.d.ts +31 -20
- package/components/page/Contexts.js +47 -17
- package/components/page/DefinitionView.svelte +115 -86
- package/components/page/DefinitionView.svelte.d.ts +3 -3
- package/components/page/Description.svelte +27 -18
- package/components/page/Description.svelte.d.ts +4 -4
- package/components/page/Edition.svelte +127 -75
- package/components/page/Edition.svelte.d.ts +4 -4
- package/components/page/Editions.svelte +144 -0
- package/components/page/Editions.svelte.d.ts +14 -0
- package/components/page/Glossary.svelte +57 -48
- package/components/page/Glossary.svelte.d.ts +4 -4
- package/components/page/Header.svelte +129 -44
- package/components/page/Header.svelte.d.ts +6 -6
- package/components/page/Index.svelte +114 -80
- package/components/page/Index.svelte.d.ts +4 -4
- package/components/page/Instructions.svelte +18 -16
- package/components/page/Instructions.svelte.d.ts +4 -4
- package/components/page/License.svelte +29 -21
- package/components/page/License.svelte.d.ts +4 -4
- package/components/page/Loading.svelte +102 -12
- package/components/page/Loading.svelte.d.ts +6 -2
- package/components/page/Media.svelte +77 -51
- package/components/page/Media.svelte.d.ts +4 -4
- package/components/page/MediaPreview.svelte +26 -8
- package/components/page/MediaPreview.svelte.d.ts +3 -3
- package/components/page/Muted.svelte +10 -0
- package/components/page/Muted.svelte.d.ts +27 -0
- package/components/page/Outline.svelte +279 -59
- package/components/page/Outline.svelte.d.ts +3 -3
- package/components/page/Page.svelte +40 -9
- package/components/page/Page.svelte.d.ts +3 -3
- package/components/page/PageHeader.svelte +14 -0
- package/components/page/PageHeader.svelte.d.ts +18 -0
- package/components/page/PageParagraph.svelte +18 -0
- package/components/page/PageParagraph.svelte.d.ts +27 -0
- package/components/page/PossibleChapter.svelte +7 -7
- package/components/page/PossibleChapter.svelte.d.ts +4 -4
- package/components/page/PossibleReference.svelte +6 -11
- package/components/page/PossibleReference.svelte.d.ts +6 -7
- package/components/page/Print.svelte +27 -3
- package/components/page/Print.svelte.d.ts +4 -4
- package/components/page/Reference.svelte +256 -113
- package/components/page/Reference.svelte.d.ts +5 -5
- package/components/page/References.svelte +39 -47
- package/components/page/References.svelte.d.ts +4 -4
- package/components/page/Rows.svelte +54 -0
- package/components/page/Rows.svelte.d.ts +27 -0
- package/components/page/Search.svelte +86 -63
- package/components/page/Search.svelte.d.ts +4 -4
- package/components/page/Status.svelte +43 -35
- package/components/page/Status.svelte.d.ts +4 -9
- package/components/page/SubdomainEditor.svelte +40 -27
- package/components/page/SubdomainEditor.svelte.d.ts +4 -4
- package/components/page/TableOfContents.svelte +225 -190
- package/components/page/TableOfContents.svelte.d.ts +4 -4
- package/components/page/TableOfContentsImage.svelte +8 -8
- package/components/page/TableOfContentsImage.svelte.d.ts +3 -3
- package/components/page/TableOfContentsRow.svelte +96 -33
- package/components/page/TableOfContentsRow.svelte.d.ts +4 -4
- package/components/page/ThemeEditor.svelte +174 -39
- package/components/page/ThemeEditor.svelte.d.ts +4 -4
- package/components/page/ThemeEditorPreview.svelte +35 -23
- package/components/page/ThemeEditorPreview.svelte.d.ts +5 -5
- package/components/page/ThemeSetEditor.svelte +15 -13
- package/components/page/ThemeSetEditor.svelte.d.ts +4 -4
- package/components/page/ThemeVariableEditor.svelte +24 -15
- package/components/page/ThemeVariableEditor.svelte.d.ts +3 -3
- package/components/page/Title.svelte +12 -0
- package/components/page/Title.svelte.d.ts +27 -0
- package/components/page/Unknown.svelte +25 -21
- package/components/page/Unknown.svelte.d.ts +4 -4
- package/components/page/margins.js +50 -33
- package/index.d.ts +14 -0
- package/index.js +14 -0
- package/models/CRUD.d.ts +17 -0
- package/models/CRUD.js +194 -0
- package/models/Firebase.js +17 -15
- package/models/book/Book.d.ts +24 -28
- package/models/book/Book.js +120 -113
- package/models/book/BookMedia.d.ts +3 -3
- package/models/book/BookMedia.js +22 -16
- package/models/book/BookSaveStatus.d.ts +7 -0
- package/models/book/BookSaveStatus.js +8 -0
- package/models/book/Chapter.d.ts +46 -39
- package/models/book/Chapter.js +180 -198
- package/models/book/ChapterID.js +7 -7
- package/models/book/Definition.d.ts +1 -1
- package/models/book/Edition.d.ts +62 -60
- package/models/book/Edition.js +385 -303
- package/models/book/Reference.d.ts +24 -0
- package/models/book/Reference.js +78 -0
- package/models/book/Schema.d.ts +169 -0
- package/models/book/Schema.js +114 -0
- package/models/book/Theme.d.ts +44 -37
- package/models/book/Theme.js +452 -52
- package/models/book/ThemeColors.d.ts +1 -1
- package/models/book/Words.d.ts +2 -0
- package/models/book/Words.js +110 -0
- package/models/chapter/AtomNode.d.ts +4 -4
- package/models/chapter/AtomNode.js +20 -13
- package/models/chapter/BlockNode.d.ts +9 -10
- package/models/chapter/BlockNode.js +32 -13
- package/models/chapter/BlocksNode.d.ts +10 -10
- package/models/chapter/BlocksNode.js +315 -120
- package/models/chapter/BlocksNode.test.js +494 -228
- package/models/chapter/Bookkeeping.d.ts +1 -1
- package/models/chapter/CalloutNode.d.ts +3 -3
- package/models/chapter/CalloutNode.js +34 -12
- package/models/chapter/Caret.d.ts +9 -7
- package/models/chapter/Caret.js +11 -6
- package/models/chapter/ChapterNode.d.ts +11 -11
- package/models/chapter/ChapterNode.js +70 -33
- package/models/chapter/CitationsNode.d.ts +3 -3
- package/models/chapter/CitationsNode.js +31 -12
- package/models/chapter/CodeNode.d.ts +11 -6
- package/models/chapter/CodeNode.js +143 -34
- package/models/chapter/CommentNode.d.ts +5 -5
- package/models/chapter/CommentNode.js +29 -13
- package/models/chapter/DefinitionNode.d.ts +2 -2
- package/models/chapter/DefinitionNode.js +15 -7
- package/models/chapter/Edit.d.ts +3 -3
- package/models/chapter/EmbedNode.d.ts +9 -5
- package/models/chapter/EmbedNode.js +108 -35
- package/models/chapter/ErrorNode.d.ts +2 -2
- package/models/chapter/ErrorNode.js +34 -12
- package/models/chapter/FootnoteNode.d.ts +5 -5
- package/models/chapter/FootnoteNode.js +34 -16
- package/models/chapter/FormatNode.d.ts +10 -10
- package/models/chapter/FormatNode.js +237 -106
- package/models/chapter/FormatNode.test.js +87 -45
- package/models/chapter/InlineCodeNode.d.ts +2 -2
- package/models/chapter/InlineCodeNode.js +22 -9
- package/models/chapter/LabelNode.d.ts +4 -4
- package/models/chapter/LabelNode.js +31 -13
- package/models/chapter/LinkNode.d.ts +2 -2
- package/models/chapter/LinkNode.js +21 -9
- package/models/chapter/ListNode.d.ts +8 -8
- package/models/chapter/ListNode.js +99 -38
- package/models/chapter/ListNode.test.js +29 -24
- package/models/chapter/MetadataNode.d.ts +3 -3
- package/models/chapter/MetadataNode.js +13 -5
- package/models/chapter/Node.d.ts +5 -3
- package/models/chapter/Node.js +76 -29
- package/models/chapter/Node.test.js +20 -18
- package/models/chapter/ParagraphNode.d.ts +6 -6
- package/models/chapter/ParagraphNode.js +84 -29
- package/models/chapter/ParagraphNode.test.js +22 -13
- package/models/chapter/Parser.d.ts +25 -25
- package/models/chapter/Parser.js +201 -189
- package/models/chapter/Parser.test.js +16 -16
- package/models/chapter/Position.d.ts +1 -1
- package/models/chapter/QuoteNode.d.ts +6 -6
- package/models/chapter/QuoteNode.js +61 -23
- package/models/chapter/RootNode.d.ts +4 -4
- package/models/chapter/RuleNode.d.ts +2 -2
- package/models/chapter/RuleNode.js +31 -11
- package/models/chapter/TableNode.d.ts +8 -6
- package/models/chapter/TableNode.js +89 -34
- package/models/chapter/TableNode.test.js +22 -24
- package/models/chapter/TextNode.d.ts +6 -6
- package/models/chapter/TextNode.js +72 -32
- package/models/chapter/TextNode.test.js +4 -4
- package/models/loadEdition.d.ts +1 -1
- package/models/loadEdition.js +10 -6
- package/package.json +104 -25
- package/util/getSubdomain.js +8 -6
- package/util/isMobile.js +1 -1
- package/util/mineReference.d.ts +3 -2
- package/util/mineReference.js +67 -29
- package/util/scrollToEyeLevel.js +6 -1
- package/components/chapter/renderPosition.d.ts +0 -3
- package/components/chapter/renderPosition.js +0 -4
- package/components/editor/ToolbarIcon.svelte +0 -22
- package/components/editor/ToolbarIcon.svelte.d.ts +0 -16
- package/components/page/Alert.svelte +0 -11
- package/components/page/Alert.svelte.d.ts +0 -23
- package/components/page/Revisions.svelte +0 -124
- package/components/page/Revisions.svelte.d.ts +0 -14
- package/models/BookLoader.d.ts +0 -2
- package/models/BookLoader.js +0 -67
- package/models/Firestore.d.ts +0 -22
- package/models/Firestore.js +0 -194
- package/models/chapter/ReferenceNode.d.ts +0 -29
- package/models/chapter/ReferenceNode.js +0 -48
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<script>import Parser from
|
|
1
|
+
<script>import Parser from '../../models/chapter/Parser';
|
|
2
2
|
import Header from './Header.svelte';
|
|
3
|
-
import Authors from
|
|
3
|
+
import Authors from './Authors.svelte';
|
|
4
4
|
import Outline from './Outline.svelte';
|
|
5
5
|
import Page from './Page.svelte';
|
|
6
6
|
import TextEditor from '../editor/TextEditor.svelte';
|
|
@@ -8,25 +8,34 @@ import BookishEditor from '../editor/BookishEditor.svelte';
|
|
|
8
8
|
import Toggle from '../editor/Toggle.svelte';
|
|
9
9
|
import Instructions from './Instructions.svelte';
|
|
10
10
|
import ChapterBody from '../chapter/ChapterBody.svelte';
|
|
11
|
-
import PossibleReference from
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
11
|
+
import PossibleReference from './PossibleReference.svelte';
|
|
12
|
+
import ChapterNumber from './ChapterNumber.svelte';
|
|
13
|
+
import Problem from '../chapter/Problem.svelte';
|
|
14
|
+
import { CHAPTER, getBook, getEdition, isEditable, setChapter, } from './Contexts';
|
|
15
|
+
import { writable } from 'svelte/store';
|
|
16
|
+
import { onMount, setContext } from 'svelte';
|
|
17
|
+
import { hideOutlineIfObscured, layoutMarginals } from './margins';
|
|
18
|
+
import scrollToEyeLevel from '../../util/scrollToEyeLevel';
|
|
19
|
+
import { goto } from '$app/navigation';
|
|
20
|
+
import ChapterNode from '../../models/chapter/ChapterNode';
|
|
21
|
+
import Muted from './Muted.svelte';
|
|
22
|
+
import Title from './Title.svelte';
|
|
19
23
|
export let chapter;
|
|
20
24
|
export let print = false;
|
|
25
|
+
let book = getBook();
|
|
21
26
|
let edition = getEdition();
|
|
22
27
|
let editable = isEditable();
|
|
23
28
|
// Keep track of the scroll position to facilitate reading during reloads.
|
|
24
|
-
function rememberPosition() {
|
|
29
|
+
function rememberPosition() {
|
|
30
|
+
localStorage.setItem('scrollposition', '' + window.scrollY);
|
|
31
|
+
}
|
|
25
32
|
// When the window resizes, the responsive layout might cause the marginals to move to the footer.
|
|
26
33
|
// when this happens, we want to immediately remove all of the explicit positioning.
|
|
27
|
-
function handleResize() {
|
|
34
|
+
function handleResize() {
|
|
35
|
+
layoutMarginals();
|
|
36
|
+
}
|
|
28
37
|
// The currently selected marginal; we only do one at a time.
|
|
29
|
-
let marginal = undefined;
|
|
38
|
+
let marginal = writable(undefined);
|
|
30
39
|
// Keep track of which hash mark is scrolled to
|
|
31
40
|
let highlightedID = undefined;
|
|
32
41
|
// When this component is mounted...
|
|
@@ -40,7 +49,9 @@ onMount(() => {
|
|
|
40
49
|
const observeHash = () => {
|
|
41
50
|
// Get the ID without the hash and the corresponding element
|
|
42
51
|
const elementID = window.location.hash.substring(1);
|
|
43
|
-
const element = elementID
|
|
52
|
+
const element = elementID
|
|
53
|
+
? document.getElementById(elementID)
|
|
54
|
+
: null;
|
|
44
55
|
// If it's not empty, observe it, and remember what we're observing for highlighting
|
|
45
56
|
if (element) {
|
|
46
57
|
highlightedID = elementID;
|
|
@@ -61,75 +72,62 @@ onMount(() => {
|
|
|
61
72
|
window.addEventListener('resize', handleResize);
|
|
62
73
|
// Remember the scroll position before a refresh.
|
|
63
74
|
// We have to do all of these because browser support varies.
|
|
64
|
-
window.addEventListener(
|
|
65
|
-
window.addEventListener(
|
|
66
|
-
window.addEventListener(
|
|
75
|
+
window.addEventListener('beforeunload', rememberPosition);
|
|
76
|
+
window.addEventListener('visibilitychange', rememberPosition);
|
|
77
|
+
window.addEventListener('pagehide', rememberPosition);
|
|
67
78
|
// Start listening for hash changes, since we want to remove them upon scrolling away from them.
|
|
68
|
-
window.addEventListener(
|
|
69
|
-
window.addEventListener(
|
|
70
|
-
window.addEventListener(
|
|
79
|
+
window.addEventListener('pushstate', observeHash);
|
|
80
|
+
window.addEventListener('popstate', observeHash);
|
|
81
|
+
window.addEventListener('hashchange', observeHash);
|
|
71
82
|
// Make an intersection observer to monitor the location of elements selected by the URL hash ID.
|
|
72
|
-
const observer = new IntersectionObserver((entries => {
|
|
83
|
+
const observer = new IntersectionObserver((entries) => {
|
|
73
84
|
// Go through all of the monitored elements
|
|
74
|
-
entries.forEach(entry => {
|
|
75
|
-
// If the observed element is out of view and in the hash, remove the hash
|
|
76
|
-
if (entry.intersectionRatio === 0 &&
|
|
77
|
-
|
|
85
|
+
entries.forEach((entry) => {
|
|
86
|
+
// If the observed element is out of view and in the hash, remove the hash
|
|
87
|
+
if (entry.intersectionRatio === 0 &&
|
|
88
|
+
entry.target.id === window.location.hash.substring(1)) {
|
|
89
|
+
history.pushState('', document.title, window.location.pathname + window.location.search);
|
|
78
90
|
observer.unobserve(entry.target);
|
|
79
91
|
highlightedID = undefined;
|
|
80
92
|
}
|
|
81
93
|
});
|
|
82
|
-
})
|
|
94
|
+
});
|
|
83
95
|
// Do an initial check the hash to see if there's an ID to scroll to
|
|
84
96
|
observeHash();
|
|
85
97
|
// Position the marginals, since there's new content.
|
|
86
98
|
layoutMarginals();
|
|
87
|
-
// Periodically save the chapter's edits.
|
|
88
|
-
const chapterSaverID = setInterval(() => {
|
|
89
|
-
$currentChapter.saveEdits();
|
|
90
|
-
}, 500);
|
|
91
99
|
// On cleanup, unsubscribe from everything above.
|
|
92
100
|
return () => {
|
|
93
101
|
window.removeEventListener('scroll', handleScroll);
|
|
94
102
|
window.removeEventListener('resize', handleResize);
|
|
95
103
|
// Stop listening to page visibility changes.
|
|
96
|
-
window.removeEventListener(
|
|
97
|
-
window.removeEventListener(
|
|
98
|
-
window.removeEventListener(
|
|
104
|
+
window.removeEventListener('beforeunload', rememberPosition);
|
|
105
|
+
window.removeEventListener('visibilitychange', rememberPosition);
|
|
106
|
+
window.removeEventListener('pagehide', rememberPosition);
|
|
99
107
|
// Delete the remembered position so that the next page scrolls to top.
|
|
100
|
-
localStorage.removeItem(
|
|
108
|
+
localStorage.removeItem('scrollposition');
|
|
101
109
|
// Stop listening for hash changes
|
|
102
|
-
window.removeEventListener(
|
|
103
|
-
window.removeEventListener(
|
|
104
|
-
window.removeEventListener(
|
|
110
|
+
window.removeEventListener('pushstate', observeHash);
|
|
111
|
+
window.removeEventListener('popstate', observeHash);
|
|
112
|
+
window.removeEventListener('hashchange', observeHash);
|
|
105
113
|
// Stop observing everything on unmount
|
|
106
114
|
observer.disconnect();
|
|
107
|
-
// Stop saving.
|
|
108
|
-
clearInterval(chapterSaverID);
|
|
109
115
|
};
|
|
110
116
|
});
|
|
111
117
|
// Position the marginals on mount.
|
|
112
118
|
onMount(() => layoutMarginals());
|
|
113
|
-
// Keep track of the current chapter in a store to manage listeners on the chapter.
|
|
114
|
-
let currentChapter = writable(chapter);
|
|
115
|
-
let chapterChanged = () => currentChapter.set(chapter);
|
|
116
|
-
$: {
|
|
117
|
-
// Listen to the new edition
|
|
118
|
-
$currentChapter.removeListener(chapterChanged);
|
|
119
|
-
// Update the current edition.
|
|
120
|
-
currentChapter.set(chapter);
|
|
121
|
-
// Listen to changes on the book and chapter.
|
|
122
|
-
$currentChapter.addListener(chapterChanged);
|
|
123
|
-
}
|
|
124
119
|
// This gets called after the page is done loading. There are various things we scroll to.
|
|
125
120
|
function scrollToLastLocation() {
|
|
126
121
|
// In case loading changed marginal positions
|
|
127
122
|
layoutMarginals();
|
|
128
123
|
// If there's a word we're trying to highlight in the URL path, scroll to the corresponding match.
|
|
129
124
|
if (location.search) {
|
|
130
|
-
const highlights = document.getElementsByClassName(
|
|
125
|
+
const highlights = document.getElementsByClassName('bookish-text bookish-content-highlight');
|
|
131
126
|
const num = getHighlightedNumber();
|
|
132
|
-
if (num &&
|
|
127
|
+
if (num &&
|
|
128
|
+
highlights.length > 0 &&
|
|
129
|
+
num < highlights.length &&
|
|
130
|
+
num >= 0) {
|
|
133
131
|
scrollToEyeLevel(highlights[num]);
|
|
134
132
|
}
|
|
135
133
|
}
|
|
@@ -142,10 +140,13 @@ function scrollToLastLocation() {
|
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
142
|
else {
|
|
145
|
-
// If we got to this page through a refresh, scroll to
|
|
146
|
-
const entries = performance.getEntriesByType(
|
|
143
|
+
// If we got to this page through a refresh, scroll to
|
|
144
|
+
const entries = performance.getEntriesByType('navigation');
|
|
147
145
|
const position = localStorage.getItem('scrollposition');
|
|
148
|
-
if (position !== null &&
|
|
146
|
+
if (position !== null &&
|
|
147
|
+
entries.length > 0 &&
|
|
148
|
+
entries[entries.length - 1]
|
|
149
|
+
.type === 'reload') {
|
|
149
150
|
// Scroll to the previous position, if there was one, so that refresh preserves position.
|
|
150
151
|
window.scrollTo(0, parseInt(position));
|
|
151
152
|
}
|
|
@@ -155,39 +156,47 @@ function scrollToLastLocation() {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
function getHighlightedWord() {
|
|
159
|
+
function getHighlightedWord() {
|
|
160
|
+
return location.search.split('&')[0]?.split('=')[1] ?? undefined;
|
|
161
|
+
}
|
|
159
162
|
function getHighlightedNumber() {
|
|
160
|
-
const number = location.search.split(
|
|
163
|
+
const number = location.search.split('&')[1]?.split('=')[1];
|
|
161
164
|
return number === undefined ? undefined : parseInt(number);
|
|
162
165
|
}
|
|
163
166
|
// Prepare to render the chapter by getting some data from the chapter and book.
|
|
164
|
-
$: chapterID =
|
|
165
|
-
$: chapterNumber = $edition
|
|
166
|
-
$: chapterSection = $edition
|
|
167
|
-
$: chapterAST = $
|
|
167
|
+
$: chapterID = chapter.getID();
|
|
168
|
+
$: chapterNumber = $edition?.getChapterNumber(chapterID);
|
|
169
|
+
$: chapterSection = $edition?.getChapterSection(chapterID);
|
|
170
|
+
$: chapterAST = $edition ? chapter.getAST($edition) : undefined;
|
|
168
171
|
$: citations = chapterAST ? chapterAST.getCitations() : undefined;
|
|
172
|
+
$: editionNumber =
|
|
173
|
+
$book && $edition ? $edition.getEditionNumber($book) : undefined;
|
|
169
174
|
let chapterStore = writable();
|
|
170
175
|
setContext(CHAPTER, chapterStore);
|
|
171
176
|
$: chapterStore.set({
|
|
172
177
|
chapter: chapter,
|
|
173
178
|
highlightedWord: getHighlightedWord(),
|
|
174
179
|
highlightedID: highlightedID,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
layoutMarginals: layoutMarginals
|
|
180
|
+
marginal: marginal,
|
|
181
|
+
layoutMarginals: layoutMarginals,
|
|
178
182
|
});
|
|
179
183
|
</script>
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
<
|
|
183
|
-
|
|
185
|
+
{#if $edition}
|
|
186
|
+
<Page
|
|
187
|
+
afterLoaded={scrollToLastLocation}
|
|
188
|
+
title={`${$edition.getTitle()} - ${chapter.getTitle()}`}
|
|
189
|
+
>
|
|
190
|
+
<Header
|
|
184
191
|
header={chapter.getTitle()}
|
|
185
192
|
label="Chapter title"
|
|
186
193
|
tags={$edition.getTags()}
|
|
187
|
-
save={
|
|
194
|
+
save={(text) =>
|
|
195
|
+
setChapter(edition, chapter, chapter.withTitle(text))}
|
|
188
196
|
getImage={() => chapter.getImage()}
|
|
189
|
-
setImage={embed =>
|
|
190
|
-
|
|
197
|
+
setImage={(embed) =>
|
|
198
|
+
setChapter(edition, chapter, chapter.withImage(embed))}
|
|
199
|
+
{print}
|
|
191
200
|
>
|
|
192
201
|
<!-- Collapse the outline if a marginal is selected. -->
|
|
193
202
|
<Outline
|
|
@@ -195,10 +204,9 @@ $: chapterStore.set({
|
|
|
195
204
|
collapse={marginal !== undefined}
|
|
196
205
|
previous={$edition.getPreviousChapterID(chapterID)}
|
|
197
206
|
next={$edition.getNextChapterID(chapterID)}
|
|
198
|
-
listener={
|
|
207
|
+
listener={(expanded) => {
|
|
199
208
|
// If the outline is being expanded, hide the marginal, otherwise leave it alone.
|
|
200
|
-
if(expanded)
|
|
201
|
-
marginal = undefined;
|
|
209
|
+
if (expanded) marginal.set(undefined);
|
|
202
210
|
|
|
203
211
|
// Check if we need to hide the outline after positioning.
|
|
204
212
|
hideOutlineIfObscured();
|
|
@@ -206,96 +214,143 @@ $: chapterStore.set({
|
|
|
206
214
|
/>
|
|
207
215
|
<!-- Add an editable chapter ID if in editor mode -->
|
|
208
216
|
<svelte:fragment slot="before">
|
|
209
|
-
{#if editable }
|
|
210
|
-
<
|
|
211
|
-
<TextEditor
|
|
212
|
-
|
|
217
|
+
{#if editable && $book}
|
|
218
|
+
<Muted>
|
|
219
|
+
<TextEditor
|
|
220
|
+
text={chapter.getID()}
|
|
213
221
|
label="Chapter URL ID editor"
|
|
214
|
-
save={
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
save={// After the ID is edited, reload the page with the new URL.
|
|
223
|
+
(newChapterID) => {
|
|
224
|
+
if ($book) {
|
|
225
|
+
chapter.withChapterID(newChapterID);
|
|
226
|
+
// Navigate to the new ID
|
|
227
|
+
goto(
|
|
228
|
+
`/write/${$book.ref.id}/${editionNumber}/${newChapterID}`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
}}
|
|
222
232
|
placeholder="chapter ID"
|
|
223
|
-
valid={(newChapterID) =>
|
|
224
|
-
!/^[a-zA-Z0-9]+$/.test(newChapterID)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
233
|
+
valid={(newChapterID) =>
|
|
234
|
+
!/^[a-zA-Z0-9]+$/.test(newChapterID)
|
|
235
|
+
? 'Chapter IDs must be one or more letters or numbers'
|
|
236
|
+
: chapter.getID() !== newChapterID &&
|
|
237
|
+
$edition?.hasChapter(newChapterID)
|
|
238
|
+
? "There's already a chapter that has this ID."
|
|
239
|
+
: undefined}
|
|
228
240
|
saveOnExit={true}
|
|
229
241
|
/>
|
|
230
|
-
|
|
231
|
-
</span>
|
|
242
|
+
</Muted>
|
|
232
243
|
{/if}
|
|
233
|
-
{#if editable
|
|
234
|
-
<Toggle
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
244
|
+
{#if editable}
|
|
245
|
+
<Toggle
|
|
246
|
+
on={chapter.isNumbered()}
|
|
247
|
+
save={(on) =>
|
|
248
|
+
setChapter(
|
|
249
|
+
edition,
|
|
250
|
+
chapter,
|
|
251
|
+
chapter.asNumbered(on)
|
|
252
|
+
)}
|
|
253
|
+
>
|
|
254
|
+
<ChapterNumber
|
|
255
|
+
>{#if chapterNumber !== undefined}Chapter {chapterNumber}{:else}<Muted
|
|
256
|
+
>Unnumbered</Muted
|
|
257
|
+
>{/if}</ChapterNumber
|
|
258
|
+
>
|
|
240
259
|
</Toggle>
|
|
241
|
-
{:else if chapterNumber !== undefined
|
|
242
|
-
<
|
|
260
|
+
{:else if chapterNumber !== undefined}
|
|
261
|
+
<ChapterNumber>Chapter {chapterNumber}</ChapterNumber>
|
|
243
262
|
{/if}
|
|
244
|
-
{#if chapterSection !== undefined }
|
|
245
|
-
<span class="
|
|
263
|
+
{#if chapterSection !== undefined && chapterSection.length > 0}
|
|
264
|
+
<span class="section-name">{chapterSection}</span>
|
|
246
265
|
{/if}
|
|
247
|
-
</svelte:fragment>
|
|
266
|
+
</svelte:fragment>
|
|
248
267
|
<!-- If there are chapter authors, render those, otherwise use the book authors -->
|
|
249
|
-
<Authors
|
|
268
|
+
<Authors
|
|
250
269
|
slot="after"
|
|
251
|
-
authors={
|
|
252
|
-
inheritedAuthors={
|
|
253
|
-
add={
|
|
254
|
-
edit={(index, text) =>
|
|
255
|
-
|
|
270
|
+
authors={chapter.getAuthors()}
|
|
271
|
+
inheritedAuthors={$edition.getAuthors()}
|
|
272
|
+
add={() => setChapter(edition, chapter, chapter.withAuthor(''))}
|
|
273
|
+
edit={(index, text) =>
|
|
274
|
+
setChapter(
|
|
275
|
+
edition,
|
|
276
|
+
chapter,
|
|
277
|
+
chapter.withRenamedAuthor(index, text)
|
|
278
|
+
)}
|
|
279
|
+
remove={(index) =>
|
|
280
|
+
setChapter(edition, chapter, chapter.withoutAuthor(index))}
|
|
256
281
|
/>
|
|
257
282
|
</Header>
|
|
258
|
-
|
|
259
|
-
<img src={"/svg/marker.svg"} alt="highlight mark" style="display: none"/>
|
|
283
|
+
|
|
260
284
|
<Instructions>
|
|
261
|
-
Edit your chapter's title, authors, and cover image above.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
285
|
+
Edit your chapter's title, authors, and cover image above. You can
|
|
286
|
+
also change the ID of the chapter, which appears in it's URL. Write
|
|
287
|
+
your chapter text below, using the many formatting options in the
|
|
288
|
+
toolbar above to format text, add headers, lists, tables, comments,
|
|
289
|
+
citations, footnotes, and more. It's okay to try things, you can
|
|
290
|
+
always undo! Saves are automatic, each time you stop typing.
|
|
266
291
|
</Instructions>
|
|
267
292
|
|
|
268
293
|
<!-- Render the chapter body, passing some context -->
|
|
269
|
-
|
|
270
|
-
{#if
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
294
|
+
<section class="chapter-content">
|
|
295
|
+
{#if chapterAST}
|
|
296
|
+
{#if editable}
|
|
297
|
+
<BookishEditor
|
|
298
|
+
ast={chapterAST}
|
|
299
|
+
save={(ast) =>
|
|
300
|
+
ast instanceof ChapterNode
|
|
301
|
+
? setChapter(
|
|
302
|
+
edition,
|
|
303
|
+
chapter,
|
|
304
|
+
chapter.withAST(ast)
|
|
305
|
+
)
|
|
306
|
+
: undefined}
|
|
307
|
+
chapter={true}
|
|
308
|
+
autofocus
|
|
309
|
+
component={ChapterBody}
|
|
310
|
+
placeholder="Type here"
|
|
311
|
+
/>
|
|
312
|
+
{:else}
|
|
313
|
+
<ChapterBody node={chapterAST} />
|
|
314
|
+
{/if}
|
|
279
315
|
{:else}
|
|
280
|
-
<
|
|
316
|
+
<span>Loading...</span>
|
|
281
317
|
{/if}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
<h1 id="references" class="bookish-header">References</h1>
|
|
318
|
+
</section>
|
|
319
|
+
|
|
320
|
+
{#if citations && citations.size > 0}
|
|
321
|
+
{@const refs = $edition.getReferences()}
|
|
322
|
+
<Title>References</Title>
|
|
288
323
|
<ol>
|
|
289
|
-
{#each [...citations].sort() as citationID
|
|
290
|
-
{#if citationID in refs
|
|
291
|
-
<li
|
|
292
|
-
|
|
324
|
+
{#each [...citations].sort() as citationID}
|
|
325
|
+
{#if citationID in refs}
|
|
326
|
+
<li
|
|
327
|
+
class={'bookish-reference'}
|
|
328
|
+
id={'ref-' + citationID}
|
|
329
|
+
>
|
|
330
|
+
<PossibleReference node={refs[citationID]} />
|
|
293
331
|
</li>
|
|
294
332
|
{:else}
|
|
295
|
-
<li
|
|
333
|
+
<li
|
|
334
|
+
><Problem
|
|
335
|
+
>Unknown reference: <code>{citationID}</code
|
|
336
|
+
></Problem
|
|
337
|
+
></li
|
|
338
|
+
>
|
|
296
339
|
{/if}
|
|
297
340
|
{/each}
|
|
298
341
|
</ol>
|
|
299
342
|
{/if}
|
|
300
|
-
</
|
|
301
|
-
|
|
343
|
+
</Page>
|
|
344
|
+
{/if}
|
|
345
|
+
|
|
346
|
+
<style>
|
|
347
|
+
.section-name {
|
|
348
|
+
display: inline-block;
|
|
349
|
+
font-family: var(--bookish-paragraph-font-family);
|
|
350
|
+
font-size: var(--bookish-small-font-size);
|
|
351
|
+
font-weight: normal;
|
|
352
|
+
font-style: normal;
|
|
353
|
+
color: var(--bookish-muted-color);
|
|
354
|
+
line-height: 1em;
|
|
355
|
+
}
|
|
356
|
+
</style>
|
|
@@ -10,9 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export type ChapterProps = typeof __propDef.props;
|
|
14
|
+
export type ChapterEvents = typeof __propDef.events;
|
|
15
|
+
export type ChapterSlots = typeof __propDef.slots;
|
|
16
16
|
export default class Chapter extends SvelteComponentTyped<ChapterProps, ChapterEvents, ChapterSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import type { Writable } from 'svelte/store';
|
|
2
|
+
import type Chapter from '../../models/book/Chapter';
|
|
3
|
+
type ChapterContext = {
|
|
3
4
|
chapter: Chapter;
|
|
4
5
|
highlightedWord?: string;
|
|
5
6
|
highlightedID?: string;
|
|
6
|
-
|
|
7
|
-
setMarginal: (id: string | undefined) => void;
|
|
7
|
+
marginal: Writable<string | undefined>;
|
|
8
8
|
layoutMarginals: () => void;
|
|
9
9
|
} | undefined;
|
|
10
10
|
export default ChapterContext;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ChapterNumberProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ChapterNumberEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ChapterNumberSlots */
|
|
4
|
+
export default class ChapterNumber extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type ChapterNumberProps = typeof __propDef.props;
|
|
13
|
+
export type ChapterNumberEvents = typeof __propDef.events;
|
|
14
|
+
export type ChapterNumberSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script>import Link from '../Link.svelte';
|
|
2
|
+
export let link = undefined;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{#if link}
|
|
6
|
+
<Link to={link}><h3> <slot /></h3></Link>
|
|
7
|
+
{:else}
|
|
8
|
+
<h3><slot /></h3>
|
|
9
|
+
{/if}
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
h3 {
|
|
13
|
+
font-family: var(--bookish-header-font-family);
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
link?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
default: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type ChapterTitleProps = typeof __propDef.props;
|
|
14
|
+
export type ChapterTitleEvents = typeof __propDef.events;
|
|
15
|
+
export type ChapterTitleSlots = typeof __propDef.slots;
|
|
16
|
+
export default class ChapterTitle extends SvelteComponentTyped<ChapterTitleProps, ChapterTitleEvents, ChapterTitleSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type Book from
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
|
|
1
|
+
import { type Writable } from 'svelte/store';
|
|
2
|
+
import type Book from '../../models/book/Book';
|
|
3
|
+
import type Chapter from '../../models/book/Chapter';
|
|
4
|
+
import type BookSaveStatus from '../../models/book/BookSaveStatus';
|
|
5
|
+
import type Edition from '../../models/book/Edition';
|
|
6
|
+
import type Authentication from '../Authentication';
|
|
7
|
+
import type CaretState from '../editor/CaretState';
|
|
8
|
+
import type ChapterContext from './ChapterContext';
|
|
9
|
+
export type DarkModeStore = Writable<boolean>;
|
|
10
|
+
export declare const DARK_MODE: unique symbol;
|
|
11
|
+
export declare function getDarkMode(): DarkModeStore;
|
|
12
|
+
export type AuthStore = Writable<Authentication | undefined>;
|
|
8
13
|
export declare const AUTH: unique symbol;
|
|
9
|
-
export declare function getAuth():
|
|
10
|
-
export
|
|
14
|
+
export declare function getAuth(): AuthStore;
|
|
15
|
+
export type BookStore = Writable<Book | undefined>;
|
|
16
|
+
export declare const BOOK: unique symbol;
|
|
17
|
+
export declare function getBook(): BookStore;
|
|
18
|
+
export type EditionStore = Writable<Edition | undefined>;
|
|
11
19
|
export declare const EDITION: unique symbol;
|
|
12
20
|
export declare function getEdition(): EditionStore;
|
|
13
|
-
export
|
|
14
|
-
export declare const CARET: unique symbol;
|
|
15
|
-
export declare function getCaret(): CaretStore;
|
|
16
|
-
export declare type DarkModeStore = Writable<boolean>;
|
|
17
|
-
export declare const DARK_MODE: unique symbol;
|
|
18
|
-
export declare function getDarkMode(): DarkModeStore;
|
|
19
|
-
export declare type ChapterStore = Writable<ChapterContext>;
|
|
21
|
+
export type ChapterStore = Writable<ChapterContext>;
|
|
20
22
|
export declare const CHAPTER: unique symbol;
|
|
21
23
|
export declare function getChapter(): ChapterStore;
|
|
24
|
+
/**
|
|
25
|
+
* Update the edition that contains the chapter, then update the
|
|
26
|
+
* global edition store with the new edition, propogating the changes everywhere.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setChapter(store: EditionStore, previous: Chapter, chapter: Chapter): void;
|
|
22
29
|
export declare const EDITABLE: unique symbol;
|
|
23
|
-
export declare function isEditable():
|
|
30
|
+
export declare function isEditable(): boolean;
|
|
24
31
|
export declare const BASE: unique symbol;
|
|
25
|
-
export
|
|
26
|
-
export declare
|
|
27
|
-
export declare
|
|
32
|
+
export type BaseStore = Writable<string>;
|
|
33
|
+
export declare function getBase(): BaseStore;
|
|
34
|
+
export declare const CARET: unique symbol;
|
|
35
|
+
export declare function getCaret(): Writable<CaretState | undefined>;
|
|
36
|
+
export declare const STATUS: unique symbol;
|
|
37
|
+
export type StatusStore = Writable<BookSaveStatus>;
|
|
38
|
+
export declare function getStatus(): StatusStore;
|