bookish-press 0.4.46 → 0.4.47
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/.env.example +8 -0
- package/.firebaserc +8 -0
- package/.prettierignore +8 -0
- package/.prettierrc.json +5 -0
- package/_update-notifier-last-checked +0 -0
- package/firebase.json +46 -0
- package/firestore.indexes.json +4 -0
- package/firestore.rules +59 -0
- package/functions/.eslintrc.js +28 -0
- package/functions/package-lock.json +12595 -0
- package/functions/package.json +43 -0
- package/functions/src/index.ts +345 -0
- package/functions/tsconfig.dev.json +3 -0
- package/functions/tsconfig.json +15 -0
- package/package.json +53 -270
- package/scripts/claims.cjs +99 -0
- package/src/app.d.ts +9 -0
- package/src/app.html +24 -0
- package/src/lib/components/Auth.svelte +65 -0
- package/{components/Authentication.d.ts → src/lib/components/Authentication.ts} +2 -0
- package/{components → src/lib/components}/BookPreview.svelte +27 -22
- package/{components → src/lib/components}/External.svelte +2 -1
- package/src/lib/components/Link.svelte +58 -0
- package/{components → src/lib/components}/app/BookList.svelte +6 -3
- package/{components → src/lib/components}/app/Button.svelte +5 -4
- package/{components → src/lib/components}/app/Feedback.svelte +11 -7
- package/{components → src/lib/components}/app/Head.svelte +2 -1
- package/{components → src/lib/components}/app/Large.svelte +0 -0
- package/{components → src/lib/components}/app/Lead.svelte +0 -0
- package/{components → src/lib/components}/app/Link.svelte +4 -3
- package/{components → src/lib/components}/app/Options.svelte +5 -4
- package/{components → src/lib/components}/app/Paragraph.svelte +2 -1
- package/{components → src/lib/components}/app/Section.svelte +0 -0
- package/{components → src/lib/components}/app/Table.svelte +0 -0
- package/{components → src/lib/components}/app/TextInput.svelte +12 -9
- package/{components → src/lib/components}/chapter/Atom.svelte +18 -12
- package/src/lib/components/chapter/Block.svelte +42 -0
- package/{components → src/lib/components}/chapter/Callout.svelte +6 -3
- package/{components → src/lib/components}/chapter/CaptionedCode.svelte +21 -13
- package/{components → src/lib/components}/chapter/ChapterBody.svelte +13 -9
- package/{components → src/lib/components}/chapter/Citations.svelte +34 -33
- package/{components → src/lib/components}/chapter/Code.svelte +63 -59
- package/{components → src/lib/components}/chapter/Comment.svelte +30 -18
- package/{components → src/lib/components}/chapter/Definition.svelte +23 -17
- package/{components → src/lib/components}/chapter/Embed.svelte +97 -77
- package/src/lib/components/chapter/ErrorMessage.svelte +12 -0
- package/{components → src/lib/components}/chapter/ExtendedPrism.js +0 -0
- package/{components → src/lib/components}/chapter/Figure.svelte +34 -26
- package/{components → src/lib/components}/chapter/Footnote.svelte +32 -20
- package/{components → src/lib/components}/chapter/Format.svelte +39 -34
- package/{components → src/lib/components}/chapter/InlineCode.svelte +9 -5
- package/{components → src/lib/components}/chapter/Label.svelte +23 -14
- package/{components → src/lib/components}/chapter/Link.svelte +27 -21
- package/{components → src/lib/components}/chapter/List.svelte +5 -3
- package/{components → src/lib/components}/chapter/Marginal.svelte +54 -41
- package/{components → src/lib/components}/chapter/Paragraph.svelte +25 -20
- package/{components → src/lib/components}/chapter/Positioned.svelte +4 -1
- package/{components → src/lib/components}/chapter/Problem.svelte +0 -0
- package/src/lib/components/chapter/Python.svelte +144 -0
- package/{components → src/lib/components}/chapter/Quote.svelte +9 -5
- package/{components → src/lib/components}/chapter/Rule.svelte +4 -1
- package/{components → src/lib/components}/chapter/Table.svelte +11 -7
- package/src/lib/components/chapter/Text.svelte +109 -0
- package/src/lib/components/editor/BookishEditor.svelte +1101 -0
- package/src/lib/components/editor/CalloutEditor.svelte +14 -0
- package/{components → src/lib/components}/editor/CaptionedCodeEditor.svelte +10 -6
- package/src/lib/components/editor/CaretContext.ts +55 -0
- package/{components/editor/CaretState.d.ts → src/lib/components/editor/CaretState.ts} +6 -7
- package/{components/editor/CaretUtilities.d.ts → src/lib/components/editor/CaretUtilities.ts} +1 -0
- package/{components → src/lib/components}/editor/CaretView.svelte +25 -20
- package/src/lib/components/editor/CitationsEditor.svelte +64 -0
- package/{components/editor/Clipboard.d.ts → src/lib/components/editor/Clipboard.ts} +2 -1
- package/{components/editor/Command.d.ts → src/lib/components/editor/Command.ts} +8 -2
- package/{components/editor/Commands.js → src/lib/components/editor/Commands.ts} +730 -315
- package/src/lib/components/editor/ConfirmButton.svelte +51 -0
- package/src/lib/components/editor/DefinitionEditor.svelte +44 -0
- package/src/lib/components/editor/EmbedEditor.svelte +152 -0
- package/{components → src/lib/components}/editor/Icon.svelte +2 -1
- package/{components → src/lib/components}/editor/ImageChooser.svelte +24 -19
- package/src/lib/components/editor/InlineCodeEditor.svelte +16 -0
- package/{components → src/lib/components}/editor/LabelEditor.svelte +14 -9
- package/{components → src/lib/components}/editor/LanguageEditor.svelte +8 -5
- package/src/lib/components/editor/LinkEditor.svelte +110 -0
- package/{components → src/lib/components}/editor/Note.svelte +0 -0
- package/{components → src/lib/components}/editor/Permissions.svelte +43 -36
- package/src/lib/components/editor/PositionEditor.svelte +21 -0
- package/src/lib/components/editor/QuoteEditor.svelte +14 -0
- package/{components → src/lib/components}/editor/Switch.svelte +14 -11
- package/src/lib/components/editor/TableEditor.svelte +14 -0
- package/{components → src/lib/components}/editor/TextEditor.svelte +101 -89
- package/src/lib/components/editor/Toggle.svelte +47 -0
- package/src/lib/components/editor/Toolbar.svelte +297 -0
- package/{components → src/lib/components}/editor/ToolbarGroup.svelte +5 -3
- package/{components → src/lib/components}/editor/ToolbarSpacer.svelte +0 -0
- package/src/lib/components/editor/URLEditor.svelte +15 -0
- package/{components/editor/UndoState.d.ts → src/lib/components/editor/UndoState.ts} +3 -2
- package/{components → src/lib/components}/editor/icons/annotate.svg +0 -0
- package/{components → src/lib/components}/editor/icons/block.svg +0 -0
- package/{components → src/lib/components}/editor/icons/bold.svg +0 -0
- package/{components → src/lib/components}/editor/icons/bullets.svg +0 -0
- package/{components → src/lib/components}/editor/icons/callout.svg +0 -0
- package/{components → src/lib/components}/editor/icons/citation.svg +0 -0
- package/{components → src/lib/components}/editor/icons/clear.svg +0 -0
- package/{components → src/lib/components}/editor/icons/clipboard.svg +0 -0
- package/{components → src/lib/components}/editor/icons/code.svg +0 -0
- package/{components → src/lib/components}/editor/icons/columnafter.svg +0 -0
- package/{components → src/lib/components}/editor/icons/columnbefore.svg +0 -0
- package/{components → src/lib/components}/editor/icons/comment.svg +0 -0
- package/{components → src/lib/components}/editor/icons/copy.svg +0 -0
- package/{components → src/lib/components}/editor/icons/cut.svg +0 -0
- package/{components → src/lib/components}/editor/icons/define.svg +0 -0
- package/{components → src/lib/components}/editor/icons/deletecolumn.svg +0 -0
- package/{components → src/lib/components}/editor/icons/deleterow.svg +0 -0
- package/{components → src/lib/components}/editor/icons/footnote.svg +0 -0
- package/{components → src/lib/components}/editor/icons/header1.svg +0 -0
- package/{components → src/lib/components}/editor/icons/header2.svg +0 -0
- package/{components → src/lib/components}/editor/icons/header3.svg +0 -0
- package/{components → src/lib/components}/editor/icons/home.svg +0 -0
- package/{components → src/lib/components}/editor/icons/indent.svg +0 -0
- package/{components → src/lib/components}/editor/icons/italic.svg +0 -0
- package/{components → src/lib/components}/editor/icons/label.svg +0 -0
- package/{components → src/lib/components}/editor/icons/left.svg +0 -0
- package/{components → src/lib/components}/editor/icons/level.svg +0 -0
- package/{components → src/lib/components}/editor/icons/link.svg +0 -0
- package/{components → src/lib/components}/editor/icons/list.svg +0 -0
- package/{components → src/lib/components}/editor/icons/media.svg +0 -0
- package/{components → src/lib/components}/editor/icons/middle.svg +0 -0
- package/{components → src/lib/components}/editor/icons/numbers.svg +0 -0
- package/{components → src/lib/components}/editor/icons/paragraph.svg +0 -0
- package/{components → src/lib/components}/editor/icons/paste.svg +0 -0
- package/{components → src/lib/components}/editor/icons/quote.svg +0 -0
- package/{components → src/lib/components}/editor/icons/redo.svg +0 -0
- package/{components → src/lib/components}/editor/icons/right.svg +0 -0
- package/{components → src/lib/components}/editor/icons/rowabove.svg +0 -0
- package/{components → src/lib/components}/editor/icons/rowbelow.svg +0 -0
- package/{components → src/lib/components}/editor/icons/rule.svg +0 -0
- package/{components → src/lib/components}/editor/icons/sub.svg +0 -0
- package/{components → src/lib/components}/editor/icons/super.svg +0 -0
- package/{components → src/lib/components}/editor/icons/table.svg +0 -0
- package/{components → src/lib/components}/editor/icons/text.svg +0 -0
- package/{components → src/lib/components}/editor/icons/time.svg +0 -0
- package/{components → src/lib/components}/editor/icons/undo.svg +0 -0
- package/{components → src/lib/components}/editor/icons/unindent.svg +0 -0
- package/{components → src/lib/components}/editor/icons/unlink.svg +0 -0
- package/{components → src/lib/components}/page/Acknowledgements.svelte +19 -10
- package/src/lib/components/page/Authors.svelte +92 -0
- package/src/lib/components/page/BookLoader.svelte +77 -0
- package/src/lib/components/page/BulkReferenceEditor.svelte +86 -0
- package/src/lib/components/page/Chapter.svelte +449 -0
- package/src/lib/components/page/ChapterContext.ts +13 -0
- package/{components → src/lib/components}/page/ChapterNumber.svelte +0 -0
- package/{components → src/lib/components}/page/ChapterTitle.svelte +4 -2
- package/src/lib/components/page/Contexts.ts +176 -0
- package/{components → src/lib/components}/page/DefinitionView.svelte +52 -37
- package/{components → src/lib/components}/page/Description.svelte +15 -7
- package/src/lib/components/page/Edition.svelte +189 -0
- package/src/lib/components/page/EditionLoader.svelte +123 -0
- package/{components → src/lib/components}/page/Editions.svelte +22 -18
- package/{components → src/lib/components}/page/Glossary.svelte +33 -28
- package/{components → src/lib/components}/page/Header.svelte +59 -52
- package/{components → src/lib/components}/page/Index.svelte +48 -41
- package/{components → src/lib/components}/page/Instructions.svelte +2 -1
- package/{components → src/lib/components}/page/License.svelte +17 -9
- package/{components → src/lib/components}/page/Loading.svelte +0 -0
- package/{components → src/lib/components}/page/Media.svelte +44 -27
- package/{components → src/lib/components}/page/MediaPreview.svelte +3 -2
- package/{components → src/lib/components}/page/Muted.svelte +0 -0
- package/{components → src/lib/components}/page/Outline.svelte +140 -110
- package/src/lib/components/page/Page.svelte +94 -0
- package/{components → src/lib/components}/page/PageHeader.svelte +2 -1
- package/{components → src/lib/components}/page/PageParagraph.svelte +0 -0
- package/src/lib/components/page/PossibleChapter.svelte +16 -0
- package/src/lib/components/page/PossibleReference.svelte +14 -0
- package/{components → src/lib/components}/page/Print.svelte +5 -3
- package/{components → src/lib/components}/page/Publish.svelte +59 -52
- package/{components → src/lib/components}/page/Reference.svelte +39 -30
- package/{components → src/lib/components}/page/References.svelte +18 -14
- package/{components → src/lib/components}/page/Rows.svelte +0 -0
- package/src/lib/components/page/Search.svelte +153 -0
- package/{components → src/lib/components}/page/Status.svelte +5 -3
- package/{components → src/lib/components}/page/SubdomainEditor.svelte +16 -13
- package/{components → src/lib/components}/page/TableOfContents.svelte +79 -68
- package/src/lib/components/page/TableOfContentsImage.svelte +22 -0
- package/{components → src/lib/components}/page/TableOfContentsRow.svelte +34 -24
- package/{components → src/lib/components}/page/ThemeEditor.svelte +44 -33
- package/{components → src/lib/components}/page/ThemeEditorPreview.svelte +21 -12
- package/src/lib/components/page/ThemeSetEditor.svelte +21 -0
- package/{components → src/lib/components}/page/ThemeVariableEditor.svelte +18 -14
- package/{components → src/lib/components}/page/Title.svelte +0 -0
- package/{components → src/lib/components}/page/Unknown.svelte +10 -8
- package/{components/page/margins.js → src/lib/components/page/margins.ts} +79 -46
- package/{index.js → src/lib/index.js} +0 -0
- package/src/lib/models/CRUD.ts +469 -0
- package/{models/Firebase.js → src/lib/models/Firebase.ts} +26 -16
- package/src/lib/models/book/Book.ts +283 -0
- package/src/lib/models/book/BookMedia.ts +182 -0
- package/src/lib/models/book/BookSaveStatus.ts +8 -0
- package/src/lib/models/book/Chapter.ts +462 -0
- package/{models/book/ChapterID.js → src/lib/models/book/ChapterID.ts} +1 -0
- package/src/lib/models/book/Definition.ts +2 -0
- package/src/lib/models/book/Edition.ts +1216 -0
- package/src/lib/models/book/Reference.ts +171 -0
- package/{models/book/Schema.js → src/lib/models/book/Schema.ts} +1 -0
- package/{models/book/Theme.js → src/lib/models/book/Theme.ts} +110 -6
- package/{models/book/ThemeColors.d.ts → src/lib/models/book/ThemeColors.ts} +6 -0
- package/{models/book/Words.js → src/lib/models/book/Words.ts} +1 -0
- package/{models/chapter/AtomNode.js → src/lib/models/chapter/AtomNode.ts} +30 -10
- package/{models/chapter/BlockNode.js → src/lib/models/chapter/BlockNode.ts} +80 -47
- package/src/lib/models/chapter/BlocksNode.test.ts +867 -0
- package/{models/chapter/BlocksNode.js → src/lib/models/chapter/BlocksNode.ts} +571 -359
- package/{models/chapter/Bookkeeping.d.ts → src/lib/models/chapter/Bookkeeping.ts} +0 -0
- package/src/lib/models/chapter/CalloutNode.ts +79 -0
- package/{models/chapter/Caret.js → src/lib/models/chapter/Caret.ts} +50 -26
- package/src/lib/models/chapter/ChapterNode.ts +169 -0
- package/{models/chapter/CitationsNode.js → src/lib/models/chapter/CitationsNode.ts} +17 -10
- package/{models/chapter/CodeNode.js → src/lib/models/chapter/CodeNode.ts} +125 -62
- package/src/lib/models/chapter/CommentNode.ts +61 -0
- package/{models/chapter/DefinitionNode.js → src/lib/models/chapter/DefinitionNode.ts} +14 -8
- package/src/lib/models/chapter/Edit.ts +6 -0
- package/src/lib/models/chapter/EmbedNode.ts +257 -0
- package/{models/chapter/ErrorNode.js → src/lib/models/chapter/ErrorNode.ts} +15 -8
- package/src/lib/models/chapter/FootnoteNode.ts +59 -0
- package/src/lib/models/chapter/FormatNode.test.ts +137 -0
- package/{models/chapter/FormatNode.js → src/lib/models/chapter/FormatNode.ts} +443 -262
- package/{models/chapter/InlineCodeNode.js → src/lib/models/chapter/InlineCodeNode.ts} +17 -9
- package/{models/chapter/LabelNode.js → src/lib/models/chapter/LabelNode.ts} +26 -10
- package/{models/chapter/LinkNode.js → src/lib/models/chapter/LinkNode.ts} +12 -7
- package/{models/chapter/ListNode.test.js → src/lib/models/chapter/ListNode.test.ts} +57 -20
- package/{models/chapter/ListNode.js → src/lib/models/chapter/ListNode.ts} +277 -200
- package/src/lib/models/chapter/MetadataNode.ts +44 -0
- package/{models → src/lib/models}/chapter/Node.test.js +0 -0
- package/{models/chapter/Node.js → src/lib/models/chapter/Node.ts} +155 -71
- package/src/lib/models/chapter/ParagraphNode.test.ts +54 -0
- package/{models/chapter/ParagraphNode.js → src/lib/models/chapter/ParagraphNode.ts} +95 -58
- package/{models/chapter/Parser.test.js → src/lib/models/chapter/Parser.test.ts} +7 -0
- package/{models/chapter/Parser.js → src/lib/models/chapter/Parser.ts} +369 -184
- package/{models/chapter/Position.d.ts → src/lib/models/chapter/Position.ts} +0 -0
- package/src/lib/models/chapter/QuoteNode.ts +135 -0
- package/{models/chapter/RootNode.d.ts → src/lib/models/chapter/RootNode.ts} +2 -0
- package/{models/chapter/RuleNode.js → src/lib/models/chapter/RuleNode.ts} +9 -6
- package/{models/chapter/TableNode.test.js → src/lib/models/chapter/TableNode.test.ts} +27 -10
- package/{models/chapter/TableNode.js → src/lib/models/chapter/TableNode.ts} +141 -82
- package/{models/chapter/TextNode.test.js → src/lib/models/chapter/TextNode.test.ts} +2 -0
- package/{models/chapter/TextNode.js → src/lib/models/chapter/TextNode.ts} +117 -65
- package/{util/getSubdomain.js → src/lib/util/getSubdomain.ts} +14 -8
- package/{util/isMobile.js → src/lib/util/isMobile.ts} +1 -0
- package/{util/mineReference.js → src/lib/util/mineReference.ts} +45 -25
- package/{util/scrollToEyeLevel.js → src/lib/util/scrollToEyeLevel.ts} +4 -2
- package/src/params/edition.ts +3 -0
- package/src/routes/+error.svelte +12 -0
- package/src/routes/+layout.svelte +241 -0
- package/src/routes/+page.svelte +43 -0
- package/src/routes/Footer.svelte +0 -0
- package/src/routes/Header.svelte +112 -0
- package/src/routes/[bookid]/+layout.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/+error.svelte +14 -0
- package/src/routes/[bookid]/[[editionid=edition]]/+layout.svelte +7 -0
- package/src/routes/[bookid]/[[editionid=edition]]/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/[chapterid]/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/glossary/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/index/[[letter]]/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/media/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/print/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/references/+page.svelte +5 -0
- package/src/routes/[bookid]/[[editionid=edition]]/search/+page.svelte +5 -0
- package/src/routes/[bookid]/editions/+page.svelte +20 -0
- package/src/routes/about/+page.svelte +102 -0
- package/src/routes/confirm/+page.svelte +62 -0
- package/src/routes/email/+page.svelte +99 -0
- package/src/routes/login/+page.svelte +66 -0
- package/src/routes/read/+page.svelte +38 -0
- package/src/routes/write/+error.svelte +10 -0
- package/src/routes/write/+layout.svelte +11 -0
- package/src/routes/write/+page.svelte +114 -0
- package/src/routes/write/[bookid]/+layout.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/+layout.svelte +7 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/[chapterid]/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/glossary/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/index/[[letter]]/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/media/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/print/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/references/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/search/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/theme/+page.svelte +5 -0
- package/src/routes/write/[bookid]/[[editionid=edition]]/unknown/+page.svelte +5 -0
- package/src/routes/write/[bookid]/editions/+page.svelte +20 -0
- package/src/vite-env.d.ts +1 -0
- package/static/icons/favicon.png +0 -0
- package/static/icons/icon.png +0 -0
- package/static/icons/ios-icon.png +0 -0
- package/storage.rules +9 -0
- package/svelte.config.js +19 -0
- package/tsconfig.json +18 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +8 -0
- package/vite.reader.config.ts +32 -0
- package/components/Auth.svelte +0 -55
- package/components/Auth.svelte.d.ts +0 -16
- package/components/Authentication.js +0 -1
- package/components/BookPreview.svelte.d.ts +0 -18
- package/components/External.svelte.d.ts +0 -18
- package/components/Link.svelte +0 -51
- package/components/Link.svelte.d.ts +0 -18
- package/components/app/BookList.svelte.d.ts +0 -18
- package/components/app/Button.svelte.d.ts +0 -22
- package/components/app/Feedback.svelte.d.ts +0 -18
- package/components/app/Head.svelte.d.ts +0 -18
- package/components/app/Large.svelte.d.ts +0 -27
- package/components/app/Lead.svelte.d.ts +0 -27
- package/components/app/Link.svelte.d.ts +0 -20
- package/components/app/Options.svelte.d.ts +0 -19
- package/components/app/Paragraph.svelte.d.ts +0 -18
- package/components/app/Section.svelte.d.ts +0 -27
- package/components/app/Table.svelte.d.ts +0 -27
- package/components/app/TextInput.svelte.d.ts +0 -22
- package/components/chapter/Atom.svelte.d.ts +0 -19
- package/components/chapter/Block.svelte +0 -37
- package/components/chapter/Block.svelte.d.ts +0 -17
- package/components/chapter/Callout.svelte.d.ts +0 -17
- package/components/chapter/CaptionedCode.svelte.d.ts +0 -17
- package/components/chapter/ChapterBody.svelte.d.ts +0 -19
- package/components/chapter/Citations.svelte.d.ts +0 -17
- package/components/chapter/Code.svelte.d.ts +0 -22
- package/components/chapter/Comment.svelte.d.ts +0 -17
- package/components/chapter/Definition.svelte.d.ts +0 -17
- package/components/chapter/Embed.svelte.d.ts +0 -20
- package/components/chapter/ErrorMessage.svelte +0 -9
- package/components/chapter/ErrorMessage.svelte.d.ts +0 -17
- package/components/chapter/ExtendedPrism.d.ts +0 -2
- package/components/chapter/Figure.svelte.d.ts +0 -24
- package/components/chapter/Footnote.svelte.d.ts +0 -19
- package/components/chapter/Format.svelte.d.ts +0 -19
- package/components/chapter/InlineCode.svelte.d.ts +0 -17
- package/components/chapter/Label.svelte.d.ts +0 -17
- package/components/chapter/Link.svelte.d.ts +0 -17
- package/components/chapter/List.svelte.d.ts +0 -17
- package/components/chapter/Marginal.svelte.d.ts +0 -22
- package/components/chapter/Paragraph.svelte.d.ts +0 -18
- package/components/chapter/Positioned.svelte.d.ts +0 -19
- package/components/chapter/Problem.svelte.d.ts +0 -27
- package/components/chapter/Python.svelte +0 -128
- package/components/chapter/Python.svelte.d.ts +0 -18
- package/components/chapter/Quote.svelte.d.ts +0 -17
- package/components/chapter/Rule.svelte.d.ts +0 -17
- package/components/chapter/Table.svelte.d.ts +0 -17
- package/components/chapter/Text.svelte +0 -87
- package/components/chapter/Text.svelte.d.ts +0 -18
- package/components/editor/BookishEditor.svelte +0 -884
- package/components/editor/BookishEditor.svelte.d.ts +0 -25
- package/components/editor/CalloutEditor.svelte +0 -10
- package/components/editor/CalloutEditor.svelte.d.ts +0 -17
- package/components/editor/CaptionedCodeEditor.svelte.d.ts +0 -17
- package/components/editor/CaretContext.d.ts +0 -50
- package/components/editor/CaretContext.js +0 -1
- package/components/editor/CaretState.js +0 -1
- package/components/editor/CaretUtilities.js +0 -1
- package/components/editor/CaretView.svelte.d.ts +0 -25
- package/components/editor/CitationsEditor.svelte +0 -53
- package/components/editor/CitationsEditor.svelte.d.ts +0 -17
- package/components/editor/Clipboard.js +0 -1
- package/components/editor/Command.js +0 -1
- package/components/editor/Commands.d.ts +0 -3
- package/components/editor/ConfirmButton.svelte +0 -49
- package/components/editor/ConfirmButton.svelte.d.ts +0 -19
- package/components/editor/DefinitionEditor.svelte +0 -36
- package/components/editor/DefinitionEditor.svelte.d.ts +0 -17
- package/components/editor/EmbedEditor.svelte +0 -137
- package/components/editor/EmbedEditor.svelte.d.ts +0 -17
- package/components/editor/Icon.svelte.d.ts +0 -16
- package/components/editor/ImageChooser.svelte.d.ts +0 -18
- package/components/editor/InlineCodeEditor.svelte +0 -12
- package/components/editor/InlineCodeEditor.svelte.d.ts +0 -17
- package/components/editor/LabelEditor.svelte.d.ts +0 -17
- package/components/editor/LanguageEditor.svelte.d.ts +0 -17
- package/components/editor/LinkEditor.svelte +0 -100
- package/components/editor/LinkEditor.svelte.d.ts +0 -17
- package/components/editor/Note.svelte.d.ts +0 -27
- package/components/editor/Permissions.svelte.d.ts +0 -20
- package/components/editor/PositionEditor.svelte +0 -17
- package/components/editor/PositionEditor.svelte.d.ts +0 -18
- package/components/editor/QuoteEditor.svelte +0 -10
- package/components/editor/QuoteEditor.svelte.d.ts +0 -17
- package/components/editor/Switch.svelte.d.ts +0 -20
- package/components/editor/TableEditor.svelte +0 -10
- package/components/editor/TableEditor.svelte.d.ts +0 -17
- package/components/editor/TextEditor.svelte.d.ts +0 -24
- package/components/editor/Toggle.svelte +0 -41
- package/components/editor/Toggle.svelte.d.ts +0 -19
- package/components/editor/Toolbar.svelte +0 -249
- package/components/editor/Toolbar.svelte.d.ts +0 -17
- package/components/editor/ToolbarGroup.svelte.d.ts +0 -18
- package/components/editor/ToolbarSpacer.svelte.d.ts +0 -23
- package/components/editor/URLEditor.svelte +0 -13
- package/components/editor/URLEditor.svelte.d.ts +0 -18
- package/components/editor/UndoState.js +0 -1
- package/components/page/Acknowledgements.svelte.d.ts +0 -14
- package/components/page/Authors.svelte +0 -85
- package/components/page/Authors.svelte.d.ts +0 -21
- package/components/page/BookLoader.svelte +0 -59
- package/components/page/BookLoader.svelte.d.ts +0 -16
- package/components/page/BulkReferenceEditor.svelte +0 -63
- package/components/page/BulkReferenceEditor.svelte.d.ts +0 -14
- package/components/page/Chapter.svelte +0 -392
- package/components/page/Chapter.svelte.d.ts +0 -18
- package/components/page/ChapterContext.d.ts +0 -10
- package/components/page/ChapterContext.js +0 -1
- package/components/page/ChapterNumber.svelte.d.ts +0 -27
- package/components/page/ChapterTitle.svelte.d.ts +0 -18
- package/components/page/Contexts.d.ts +0 -47
- package/components/page/Contexts.js +0 -133
- package/components/page/DefinitionView.svelte.d.ts +0 -18
- package/components/page/Description.svelte.d.ts +0 -14
- package/components/page/Edition.svelte +0 -161
- package/components/page/Edition.svelte.d.ts +0 -20
- package/components/page/EditionLoader.svelte +0 -99
- package/components/page/EditionLoader.svelte.d.ts +0 -18
- package/components/page/Editions.svelte.d.ts +0 -14
- package/components/page/Glossary.svelte.d.ts +0 -14
- package/components/page/Header.svelte.d.ts +0 -29
- package/components/page/Index.svelte.d.ts +0 -14
- package/components/page/Instructions.svelte.d.ts +0 -18
- package/components/page/License.svelte.d.ts +0 -14
- package/components/page/Loading.svelte.d.ts +0 -23
- package/components/page/Media.svelte.d.ts +0 -14
- package/components/page/MediaPreview.svelte.d.ts +0 -19
- package/components/page/Muted.svelte.d.ts +0 -27
- package/components/page/Outline.svelte.d.ts +0 -19
- package/components/page/Page.svelte +0 -84
- package/components/page/Page.svelte.d.ts +0 -19
- package/components/page/PageHeader.svelte.d.ts +0 -18
- package/components/page/PageParagraph.svelte.d.ts +0 -27
- package/components/page/PossibleChapter.svelte +0 -14
- package/components/page/PossibleChapter.svelte.d.ts +0 -14
- package/components/page/PossibleReference.svelte +0 -11
- package/components/page/PossibleReference.svelte.d.ts +0 -18
- package/components/page/Print.svelte.d.ts +0 -14
- package/components/page/Publish.svelte.d.ts +0 -14
- package/components/page/Reference.svelte.d.ts +0 -17
- package/components/page/References.svelte.d.ts +0 -14
- package/components/page/Rows.svelte.d.ts +0 -27
- package/components/page/Search.svelte +0 -133
- package/components/page/Search.svelte.d.ts +0 -14
- package/components/page/Status.svelte.d.ts +0 -14
- package/components/page/SubdomainEditor.svelte.d.ts +0 -14
- package/components/page/TableOfContents.svelte.d.ts +0 -14
- package/components/page/TableOfContentsImage.svelte +0 -18
- package/components/page/TableOfContentsImage.svelte.d.ts +0 -16
- package/components/page/TableOfContentsRow.svelte.d.ts +0 -24
- package/components/page/ThemeEditor.svelte.d.ts +0 -14
- package/components/page/ThemeEditorPreview.svelte.d.ts +0 -17
- package/components/page/ThemeSetEditor.svelte +0 -19
- package/components/page/ThemeSetEditor.svelte.d.ts +0 -18
- package/components/page/ThemeVariableEditor.svelte.d.ts +0 -18
- package/components/page/Title.svelte.d.ts +0 -27
- package/components/page/Unknown.svelte.d.ts +0 -16
- package/components/page/margins.d.ts +0 -2
- package/index.d.ts +0 -15
- package/models/CRUD.d.ts +0 -27
- package/models/CRUD.js +0 -262
- package/models/Firebase.d.ts +0 -5
- package/models/book/Book.d.ts +0 -61
- package/models/book/Book.js +0 -135
- package/models/book/BookMedia.d.ts +0 -23
- package/models/book/BookMedia.js +0 -108
- package/models/book/BookSaveStatus.d.ts +0 -7
- package/models/book/BookSaveStatus.js +0 -8
- package/models/book/Chapter.d.ts +0 -81
- package/models/book/Chapter.js +0 -212
- package/models/book/ChapterID.d.ts +0 -10
- package/models/book/Definition.d.ts +0 -6
- package/models/book/Definition.js +0 -1
- package/models/book/Edition.d.ts +0 -139
- package/models/book/Edition.js +0 -620
- package/models/book/Reference.d.ts +0 -24
- package/models/book/Reference.js +0 -78
- package/models/book/Schema.d.ts +0 -174
- package/models/book/Theme.d.ts +0 -113
- package/models/book/ThemeColors.js +0 -1
- package/models/book/Words.d.ts +0 -2
- package/models/chapter/AtomNode.d.ts +0 -18
- package/models/chapter/BlockNode.d.ts +0 -20
- package/models/chapter/BlocksNode.d.ts +0 -50
- package/models/chapter/BlocksNode.test.d.ts +0 -1
- package/models/chapter/BlocksNode.test.js +0 -568
- package/models/chapter/Bookkeeping.js +0 -1
- package/models/chapter/CalloutNode.d.ts +0 -17
- package/models/chapter/CalloutNode.js +0 -58
- package/models/chapter/Caret.d.ts +0 -23
- package/models/chapter/ChapterNode.d.ts +0 -34
- package/models/chapter/ChapterNode.js +0 -117
- package/models/chapter/CitationsNode.d.ts +0 -16
- package/models/chapter/CodeNode.d.ts +0 -35
- package/models/chapter/CommentNode.d.ts +0 -18
- package/models/chapter/CommentNode.js +0 -48
- package/models/chapter/DefinitionNode.d.ts +0 -12
- package/models/chapter/Edit.d.ts +0 -7
- package/models/chapter/Edit.js +0 -1
- package/models/chapter/EmbedNode.d.ts +0 -45
- package/models/chapter/EmbedNode.js +0 -168
- package/models/chapter/ErrorNode.d.ts +0 -17
- package/models/chapter/FootnoteNode.d.ts +0 -18
- package/models/chapter/FootnoteNode.js +0 -47
- package/models/chapter/FormatNode.d.ts +0 -60
- package/models/chapter/FormatNode.test.d.ts +0 -1
- package/models/chapter/FormatNode.test.js +0 -96
- package/models/chapter/InlineCodeNode.d.ts +0 -12
- package/models/chapter/LabelNode.d.ts +0 -17
- package/models/chapter/LinkNode.d.ts +0 -12
- package/models/chapter/ListNode.d.ts +0 -51
- package/models/chapter/ListNode.test.d.ts +0 -1
- package/models/chapter/MetadataNode.d.ts +0 -17
- package/models/chapter/MetadataNode.js +0 -32
- package/models/chapter/Node.d.ts +0 -38
- package/models/chapter/Node.test.d.ts +0 -1
- package/models/chapter/ParagraphNode.d.ts +0 -33
- package/models/chapter/ParagraphNode.test.d.ts +0 -1
- package/models/chapter/ParagraphNode.test.js +0 -30
- package/models/chapter/Parser.d.ts +0 -75
- package/models/chapter/Parser.test.d.ts +0 -1
- package/models/chapter/Position.js +0 -1
- package/models/chapter/QuoteNode.d.ts +0 -25
- package/models/chapter/QuoteNode.js +0 -99
- package/models/chapter/RootNode.js +0 -1
- package/models/chapter/RuleNode.d.ts +0 -15
- package/models/chapter/TableNode.d.ts +0 -37
- package/models/chapter/TableNode.test.d.ts +0 -1
- package/models/chapter/TextNode.d.ts +0 -36
- package/models/chapter/TextNode.test.d.ts +0 -1
- package/util/getSubdomain.d.ts +0 -3
- package/util/isMobile.d.ts +0 -2
- package/util/mineReference.d.ts +0 -4
- package/util/scrollToEyeLevel.d.ts +0 -2
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Footer from './Footer.svelte';
|
|
3
|
+
import Header from './Header.svelte';
|
|
4
|
+
import Auth from '$lib/components/Auth.svelte';
|
|
5
|
+
import { writable, type Writable } from 'svelte/store';
|
|
6
|
+
import { setContext } from 'svelte';
|
|
7
|
+
import {
|
|
8
|
+
CARET,
|
|
9
|
+
BOOK,
|
|
10
|
+
EDITION,
|
|
11
|
+
STATUS,
|
|
12
|
+
type EditionStore,
|
|
13
|
+
type StatusStore,
|
|
14
|
+
type ChapterText,
|
|
15
|
+
CHAPTERTEXT,
|
|
16
|
+
} from '$lib/components/page/Contexts';
|
|
17
|
+
import type Book from '$lib/models/book/Book';
|
|
18
|
+
import type Edition from '../lib/models/book/Edition';
|
|
19
|
+
import type CaretState from '../lib/components/editor/CaretState';
|
|
20
|
+
import BookSaveStatus from '../lib/models/book/BookSaveStatus';
|
|
21
|
+
import { updateBook, updateEdition } from '../lib/models/CRUD';
|
|
22
|
+
import { page } from '$app/stores';
|
|
23
|
+
|
|
24
|
+
// A global store context for the focused editor, used to display toolbar.
|
|
25
|
+
let caret = writable<CaretState | undefined>(undefined);
|
|
26
|
+
setContext(CARET, caret);
|
|
27
|
+
|
|
28
|
+
// A global store for the current book. It's at the root so the header can do breadcrumbs.
|
|
29
|
+
let book = writable<Book | undefined>(undefined);
|
|
30
|
+
setContext<Writable<Book | undefined>>(BOOK, book);
|
|
31
|
+
|
|
32
|
+
// A global store for the current edition. It's at the root so the header can do breadcrumbs.
|
|
33
|
+
let edition = writable<Edition>(undefined);
|
|
34
|
+
setContext<EditionStore>(EDITION, edition);
|
|
35
|
+
|
|
36
|
+
// A global store for the current chapter text. It's at the root so the header can do breadcrumbs.
|
|
37
|
+
let chapterText = writable<ChapterText | undefined>(undefined);
|
|
38
|
+
setContext<Writable<ChapterText | undefined>>(CHAPTERTEXT, chapterText);
|
|
39
|
+
|
|
40
|
+
// A global store for save feedback.
|
|
41
|
+
let status = writable<BookSaveStatus>(BookSaveStatus.Saved);
|
|
42
|
+
setContext<StatusStore>(STATUS, status);
|
|
43
|
+
|
|
44
|
+
let bookTimer: NodeJS.Timeout | undefined = undefined;
|
|
45
|
+
let editionTimer: NodeJS.Timeout | undefined = undefined;
|
|
46
|
+
function debounce(timer: NodeJS.Timeout | undefined, fun: Function) {
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
return setTimeout(() => {
|
|
49
|
+
fun();
|
|
50
|
+
}, 250);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Save whatever edition is stored. */
|
|
54
|
+
let previousSavedEdition: Edition | undefined = undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Note whether the update was due to us storing the revised edition from the
|
|
57
|
+
* database so that we don't get in an infinite loop of saving.
|
|
58
|
+
*/
|
|
59
|
+
let reflection = false;
|
|
60
|
+
async function saveEdition() {
|
|
61
|
+
if (reflection) {
|
|
62
|
+
reflection = false;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const previousDocID = previousSavedEdition?.getEditionRef()?.id;
|
|
67
|
+
const newDocID = $edition.getEditionRef()?.id;
|
|
68
|
+
|
|
69
|
+
if (
|
|
70
|
+
($book && $edition && previousDocID === undefined) ||
|
|
71
|
+
(newDocID !== undefined &&
|
|
72
|
+
previousDocID !== undefined &&
|
|
73
|
+
newDocID === previousDocID)
|
|
74
|
+
) {
|
|
75
|
+
status.set(BookSaveStatus.Saving);
|
|
76
|
+
try {
|
|
77
|
+
// Set the edition after we save it, since things like chapter refs can change for new chapters.
|
|
78
|
+
reflection = true;
|
|
79
|
+
// Get the chapter refs from the updated edition
|
|
80
|
+
const newChapterRefs = await updateEdition(
|
|
81
|
+
previousSavedEdition,
|
|
82
|
+
$edition
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// If we succeeded, update all of the chapters with the new chapter references, if there are any.
|
|
86
|
+
let revisedEdition = $edition;
|
|
87
|
+
for (const [id, ref] of newChapterRefs) {
|
|
88
|
+
const chap = revisedEdition.chapters.find(
|
|
89
|
+
(chapter) => chapter.id === id
|
|
90
|
+
);
|
|
91
|
+
if (chap && chap.ref === undefined) {
|
|
92
|
+
revisedEdition = revisedEdition.withRevisedChapter(
|
|
93
|
+
chap,
|
|
94
|
+
chap.withRef(ref)
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Update the current edition.
|
|
99
|
+
edition.set(revisedEdition);
|
|
100
|
+
|
|
101
|
+
status.set(BookSaveStatus.Saved);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error(error);
|
|
104
|
+
status.set(BookSaveStatus.Error);
|
|
105
|
+
} finally {
|
|
106
|
+
previousSavedEdition = $edition;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function saveBook() {
|
|
112
|
+
if ($book) {
|
|
113
|
+
status.set(BookSaveStatus.Saving);
|
|
114
|
+
try {
|
|
115
|
+
updateBook($book);
|
|
116
|
+
status.set(BookSaveStatus.Saved);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.log(error);
|
|
119
|
+
status.set(BookSaveStatus.Error);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function scheduleSave() {
|
|
125
|
+
// If this is the latest edition, update the book's metadata to reflect the changes.
|
|
126
|
+
if (
|
|
127
|
+
$book &&
|
|
128
|
+
$edition.isLatestEdition($book) &&
|
|
129
|
+
previousSavedEdition &&
|
|
130
|
+
previousSavedEdition.getEditionRef()?.id ===
|
|
131
|
+
$edition.getEditionRef()?.id &&
|
|
132
|
+
(previousSavedEdition.getTitle() !== $edition.getTitle() ||
|
|
133
|
+
previousSavedEdition.getImage('cover') !==
|
|
134
|
+
$edition.getImage('cover') ||
|
|
135
|
+
previousSavedEdition.getAuthors().join() !==
|
|
136
|
+
$edition.getAuthors().join() ||
|
|
137
|
+
previousSavedEdition.getDescription() !==
|
|
138
|
+
$edition.getDescription())
|
|
139
|
+
) {
|
|
140
|
+
book.set(
|
|
141
|
+
$book
|
|
142
|
+
.withTitle($edition.getTitle())
|
|
143
|
+
.withCover($edition.getImage('cover') ?? null)
|
|
144
|
+
.withAuthors($edition.getAuthors())
|
|
145
|
+
.withDescription($edition.getDescription())
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!reflection) status.set(BookSaveStatus.Changed);
|
|
150
|
+
editionTimer = debounce(editionTimer, saveEdition);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// When the edition changes, update the book and debounce a save.
|
|
154
|
+
$: {
|
|
155
|
+
if ($edition) scheduleSave();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// When the book changes, debounce a save.
|
|
159
|
+
$: {
|
|
160
|
+
if ($book) {
|
|
161
|
+
status.set(BookSaveStatus.Changed);
|
|
162
|
+
bookTimer = debounce(bookTimer, saveBook);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<div class="bookish-app">
|
|
168
|
+
<Auth>
|
|
169
|
+
{#if $page.route.id !== null && !$page.route.id.startsWith('/[bookid]/[[editionid=edition]]')}
|
|
170
|
+
<Header />
|
|
171
|
+
{/if}
|
|
172
|
+
<slot />
|
|
173
|
+
<Footer />
|
|
174
|
+
</Auth>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<style>
|
|
178
|
+
/* Custom fonts for app */
|
|
179
|
+
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700&display=swap');
|
|
180
|
+
|
|
181
|
+
:global(.bookish-app) {
|
|
182
|
+
/* Define some UI defaults not used in the Bookish theme. */
|
|
183
|
+
--app-font: 'Outfit', sans-serif;
|
|
184
|
+
--app-line-height: 1.7;
|
|
185
|
+
--app-font-size: 16pt;
|
|
186
|
+
--app-text-spacing: 2rem;
|
|
187
|
+
|
|
188
|
+
--app-interactive-color: #1b499c;
|
|
189
|
+
--app-background-color: white;
|
|
190
|
+
--app-font-color: black;
|
|
191
|
+
--app-border-color: #444444;
|
|
192
|
+
--app-font-color-inverted: #ffffff;
|
|
193
|
+
--app-muted-color: #aaaaaa;
|
|
194
|
+
--app-error-color: rgb(191, 15, 15);
|
|
195
|
+
|
|
196
|
+
--app-chrome-background: rgb(244, 244, 244);
|
|
197
|
+
--app-chrome-font-size: 12pt;
|
|
198
|
+
--app-chrome-padding: 0.5em;
|
|
199
|
+
--app-chrome-border-size: 3px;
|
|
200
|
+
--app-chrome-roundedness: 5px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:global(.dark .bookish-app) {
|
|
204
|
+
--app-interactive-color: #1455ce;
|
|
205
|
+
--app-background-color: #050505;
|
|
206
|
+
--app-font-color: white;
|
|
207
|
+
--app-border-color: #353535;
|
|
208
|
+
--app-font-color-inverted: #000000;
|
|
209
|
+
--app-muted-color: #a9a9a9;
|
|
210
|
+
--app-error-color: rgb(80, 8, 8);
|
|
211
|
+
--app-chrome-background: rgb(46, 46, 46);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.bookish-app {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
align-items: center;
|
|
218
|
+
font-weight: 300;
|
|
219
|
+
color: var(--app-font-color);
|
|
220
|
+
font-family: var(--app-font);
|
|
221
|
+
font-size: 14pt;
|
|
222
|
+
background-color: var(--app-background-color);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
:global(.firebase-emulator-warning) {
|
|
226
|
+
opacity: 0.05;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@keyframes -global-failure {
|
|
231
|
+
0% {
|
|
232
|
+
transform: translate(-2px, 0px);
|
|
233
|
+
}
|
|
234
|
+
50% {
|
|
235
|
+
transform: translate(0px, 0px);
|
|
236
|
+
}
|
|
237
|
+
100% {
|
|
238
|
+
transform: translate(2px, 0px);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Section from '$lib/components/app/Section.svelte';
|
|
3
|
+
import Paragraph from '$lib/components/app/Paragraph.svelte';
|
|
4
|
+
import Lead from '$lib/components/app/Lead.svelte';
|
|
5
|
+
import Link from '$lib/components/app/Link.svelte';
|
|
6
|
+
import Large from '$lib/components/app/Large.svelte';
|
|
7
|
+
import Head from '$lib/components/app/Head.svelte';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Section>
|
|
11
|
+
<Lead
|
|
12
|
+
><Large>Bookish</Large> is a (beta) platform for writing simple, beautiful,
|
|
13
|
+
accessible online books.</Lead
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
<Head>Simple</Head>
|
|
17
|
+
<Paragraph>
|
|
18
|
+
Print is full gatekeeping and other digital platforms have complex
|
|
19
|
+
tools. Bookish strives to be a Google Docs for books: the workflow is as
|
|
20
|
+
simple as write and share.
|
|
21
|
+
</Paragraph>
|
|
22
|
+
|
|
23
|
+
<Head>Beautiful</Head>
|
|
24
|
+
<Paragraph>
|
|
25
|
+
Typography matters. Print books can be beautiful, but are complex to
|
|
26
|
+
make. E-books can be easier to make, but are often typographically
|
|
27
|
+
messy. Bookish strives for a happy medium, making digital content
|
|
28
|
+
typographicaaly beautiful.
|
|
29
|
+
</Paragraph>
|
|
30
|
+
|
|
31
|
+
<Head>Accessible</Head>
|
|
32
|
+
<Paragraph>
|
|
33
|
+
Most platforms produce books that are incompatible with screen readers,
|
|
34
|
+
excluding readers who are blind, low vision, dyslexic, or otherwise
|
|
35
|
+
prefer to have text spoken. Bookish strives to be readable in any web
|
|
36
|
+
browser, with sight or sound.
|
|
37
|
+
</Paragraph>
|
|
38
|
+
|
|
39
|
+
<Paragraph>
|
|
40
|
+
<Link to="/about">Learn more</Link>
|
|
41
|
+
about the platform.
|
|
42
|
+
</Paragraph>
|
|
43
|
+
</Section>
|
|
File without changes
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Link from '$lib/components/app/Link.svelte';
|
|
3
|
+
import {
|
|
4
|
+
getUser,
|
|
5
|
+
getBook,
|
|
6
|
+
getEdition,
|
|
7
|
+
} from '$lib/components/page/Contexts';
|
|
8
|
+
import { getCaret } from '$lib/components/page/Contexts';
|
|
9
|
+
import Toolbar from '$lib/components/editor/Toolbar.svelte';
|
|
10
|
+
import Status from '$lib/components/page/Status.svelte';
|
|
11
|
+
import HomeIcon from '$lib/components/editor/icons/home.svg?raw';
|
|
12
|
+
import Icon from '$lib/components/editor/Icon.svelte';
|
|
13
|
+
import { page } from '$app/stores';
|
|
14
|
+
|
|
15
|
+
let auth = getUser();
|
|
16
|
+
|
|
17
|
+
let caret = getCaret();
|
|
18
|
+
$: edition = getEdition();
|
|
19
|
+
$: book = getBook();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<section class="header">
|
|
23
|
+
<nav class="navigation">
|
|
24
|
+
<Link to="/" title="Home"><Icon icon={HomeIcon} /></Link>
|
|
25
|
+
{#if $book && $edition}
|
|
26
|
+
<span class="elided"
|
|
27
|
+
><Link
|
|
28
|
+
to={`${
|
|
29
|
+
$page.route.id?.startsWith('/write') ? '/write' : ''
|
|
30
|
+
}/${$book.ref.id}`}>{$book.getTitle()}</Link
|
|
31
|
+
></span
|
|
32
|
+
>
|
|
33
|
+
{#if $page.route.id?.includes('/[bookid]/editions')}
|
|
34
|
+
<span>– Editions</span>
|
|
35
|
+
{/if}
|
|
36
|
+
<span
|
|
37
|
+
>– <Link
|
|
38
|
+
to={`${
|
|
39
|
+
$page.route.id?.startsWith('/write') ? '/write' : ''
|
|
40
|
+
}/${$book.ref.id}/editions`}
|
|
41
|
+
>{$edition.getEditionLabel()} edition</Link
|
|
42
|
+
></span
|
|
43
|
+
>
|
|
44
|
+
<span class="status">
|
|
45
|
+
{#if $auth?.user && $auth.user.email}
|
|
46
|
+
<Link to="/email">{$auth.user.email}</Link>
|
|
47
|
+
{:else}
|
|
48
|
+
<Link to="/login">Login</Link>
|
|
49
|
+
{/if}
|
|
50
|
+
<Status />
|
|
51
|
+
</span>
|
|
52
|
+
{:else}
|
|
53
|
+
<Link to="/read">Read</Link>
|
|
54
|
+
<Link to="/write">Write</Link>
|
|
55
|
+
<Link to="/about">About</Link>
|
|
56
|
+
<small>
|
|
57
|
+
{#if $auth?.user && $auth.user.email}
|
|
58
|
+
<Link to="/email">{$auth.user.email}</Link>
|
|
59
|
+
{:else}
|
|
60
|
+
<Link to="/login">Login</Link>
|
|
61
|
+
{/if}
|
|
62
|
+
</small>
|
|
63
|
+
{/if}
|
|
64
|
+
</nav>
|
|
65
|
+
{#if $caret}
|
|
66
|
+
<Toolbar caret={$caret} />
|
|
67
|
+
{/if}
|
|
68
|
+
</section>
|
|
69
|
+
|
|
70
|
+
<style>
|
|
71
|
+
.header {
|
|
72
|
+
width: 100%;
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
text-align: center;
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0;
|
|
77
|
+
z-index: 3;
|
|
78
|
+
padding: var(--app-chrome-padding);
|
|
79
|
+
background-color: var(--app-background-color);
|
|
80
|
+
border-bottom: var(--app-chrome-border-size) solid
|
|
81
|
+
var(--app-border-color);
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
gap: var(--app-chrome-padding);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.navigation {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
gap: var(--app-chrome-padding);
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
align-items: baseline;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.status {
|
|
97
|
+
/* This puts the saved status in the top right and pushes everything else left. */
|
|
98
|
+
margin-left: auto;
|
|
99
|
+
font-size: 90%;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
flex-wrap: nowrap;
|
|
103
|
+
gap: var(--app-chrome-padding);
|
|
104
|
+
align-items: baseline;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.elided {
|
|
108
|
+
overflow-x: clip;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Feeback from '$lib/components/app/Feedback.svelte';
|
|
3
|
+
import Link from '$lib/components/app/Link.svelte';
|
|
4
|
+
import Large from '$lib/components/app/Large.svelte';
|
|
5
|
+
import Lead from '$lib/components/app/Lead.svelte';
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<Lead><Large>Oops</Large>...</Lead>
|
|
9
|
+
|
|
10
|
+
<Feeback error>
|
|
11
|
+
This book doesn't exist. Want to go to your <Link to="/write"
|
|
12
|
+
>dashboard</Link
|
|
13
|
+
>?
|
|
14
|
+
</Feeback>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Editions from '$lib/components/page/Editions.svelte';
|
|
3
|
+
import { getBook } from '$lib/components/page/Contexts';
|
|
4
|
+
import Feedback from '$lib/components/app/Feedback.svelte';
|
|
5
|
+
import Section from '$lib/components/app/Section.svelte';
|
|
6
|
+
import Lead from '$lib/components/app/Lead.svelte';
|
|
7
|
+
import Large from '$lib/components/app/Large.svelte';
|
|
8
|
+
|
|
9
|
+
let book = getBook();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if $book}
|
|
13
|
+
<Section>
|
|
14
|
+
<Lead><Large>Editions</Large><br />{$book.title}</Lead>
|
|
15
|
+
|
|
16
|
+
<Editions />
|
|
17
|
+
</Section>
|
|
18
|
+
{:else}
|
|
19
|
+
<Feedback error>This book couldn't be found.</Feedback>
|
|
20
|
+
{/if}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Lead from '$lib/components/app/Lead.svelte';
|
|
3
|
+
import Large from '$lib/components/app/Large.svelte';
|
|
4
|
+
import Paragraph from '$lib/components/app/Paragraph.svelte';
|
|
5
|
+
import Link from '$lib/components/app/Link.svelte';
|
|
6
|
+
import Section from '$lib/components/app/Section.svelte';
|
|
7
|
+
import Head from '$lib/components/app/Head.svelte';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Section>
|
|
11
|
+
<Lead><Large>About</Large> Bookish.</Lead>
|
|
12
|
+
|
|
13
|
+
<Paragraph>
|
|
14
|
+
Bookish is built and maintained by <Link to="http://amyjko.com"
|
|
15
|
+
>Amy J. Ko</Link
|
|
16
|
+
>, a Professor at the <Link to="https://www.washington.edu/"
|
|
17
|
+
>University of Washington</Link
|
|
18
|
+
>
|
|
19
|
+
<Link to="https://ischool.uw.edu">Information School</Link>. She
|
|
20
|
+
originally built Bookish to write web-based books to support her
|
|
21
|
+
teaching. She decided to build a platform to make editing and
|
|
22
|
+
maintaining books easier for both herself and others. She works on it as
|
|
23
|
+
a side project and continues to use it extensively in her classes.
|
|
24
|
+
</Paragraph>
|
|
25
|
+
|
|
26
|
+
<Head id="beta">Beta</Head>
|
|
27
|
+
|
|
28
|
+
<Paragraph
|
|
29
|
+
>Bookish is currently in <em>beta</em>. That means there are likely to
|
|
30
|
+
be defects, including those that result in loss of content. We'll remove
|
|
31
|
+
this label when we're confident that the platform can reliably serve
|
|
32
|
+
both readers and writers. See our <Link
|
|
33
|
+
to="https://github.com/amyjko/bookish/issues?q=is%3Aissue+is%3Aopen+label%3Adefect"
|
|
34
|
+
>list of defects</Link
|
|
35
|
+
> to check our progress (and help, if you are able).</Paragraph
|
|
36
|
+
>
|
|
37
|
+
|
|
38
|
+
<Head id="costs">Costs</Head>
|
|
39
|
+
|
|
40
|
+
<Paragraph>
|
|
41
|
+
Using Bookish to write books will always be free. However, hosting is
|
|
42
|
+
not free and particularly widely read books can incur costs that Amy
|
|
43
|
+
can't pay alone. She is considering models for covering bandwidth costs
|
|
44
|
+
from reading such per-book fees or donations. If you have ideas, <Link
|
|
45
|
+
to="https://github.com/amyjko/bookish/issues/251"
|
|
46
|
+
>join the discussion</Link
|
|
47
|
+
>.
|
|
48
|
+
</Paragraph>
|
|
49
|
+
|
|
50
|
+
<Head id="vision">Vision</Head>
|
|
51
|
+
|
|
52
|
+
<Paragraph>
|
|
53
|
+
As with any publisher, Bookish as an editorial policy and philosophy.
|
|
54
|
+
Much like university publishers (e.g., <Link
|
|
55
|
+
to="https://mitpress.mit.edu/about/">MIT Press</Link
|
|
56
|
+
>), Amy views the mission of Bookish as <em>scholarly</em>: books on the
|
|
57
|
+
platform should advance knowledge, educate the public, and be informed
|
|
58
|
+
by other scholarly work. However, Bookish is particularly interested in
|
|
59
|
+
works that advance progress toward a society that
|
|
60
|
+
<em
|
|
61
|
+
>radically embraces the beautiful diversity of humanity and nature
|
|
62
|
+
and seeks to dismantle systems and ideas that get in the way.</em
|
|
63
|
+
> While this definitely includes works broadly explicitly about social justice
|
|
64
|
+
toopics such as diversity, equality, equity, inclusion, justice, accessibility,
|
|
65
|
+
sustainability, indigienous sovereignty, it also includes works that discuss
|
|
66
|
+
more strictly technical ideas in sociotechnical ways.
|
|
67
|
+
</Paragraph>
|
|
68
|
+
|
|
69
|
+
<Head id="editing">Editing</Head>
|
|
70
|
+
|
|
71
|
+
<Paragraph
|
|
72
|
+
>For now, anyone can create an account and write books, but publishing
|
|
73
|
+
rights are <strong>invitation only</strong>. <Link
|
|
74
|
+
to="mailto:amy@amyjko.com">Write Amy</Link
|
|
75
|
+
> to arrange a time to discuss your your vision, to ensure it aligns with
|
|
76
|
+
our editioral mission. Amy retains the right to revoke publishing rights
|
|
77
|
+
and unpublish books that do not align with the vision above; publishing on
|
|
78
|
+
the platform is a privilege, not a right.</Paragraph
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
<Paragraph>
|
|
82
|
+
That said, if your vision does not align with ours, you can still use
|
|
83
|
+
Bookish to write your book and export a version for hosting elsewhere.
|
|
84
|
+
You could even use the Bookish source to host your own press with a
|
|
85
|
+
different editorial vision.
|
|
86
|
+
</Paragraph>
|
|
87
|
+
|
|
88
|
+
<Head id="feedback">Feedback</Head>
|
|
89
|
+
|
|
90
|
+
<Paragraph>
|
|
91
|
+
Do you have feedback or want to contribute to the plaform? The project
|
|
92
|
+
is free and open source <Link to="https://github.com/amyjko/bookish"
|
|
93
|
+
>on GitHub</Link
|
|
94
|
+
>. Write <Link to="mailto:ajko@uw.edu">Amy</Link> if you'd like to collaborate,
|
|
95
|
+
or <Link to="https://github.com/amyjko/bookish/issues"
|
|
96
|
+
>submit an issue</Link
|
|
97
|
+
> or <Link to="https://github.com/amyjko/bookish/pulls"
|
|
98
|
+
>pull request</Link
|
|
99
|
+
> directly. Note that this is not a full-time project for Amy, so it will
|
|
100
|
+
progress will be leisurely; defects take priority over new features.
|
|
101
|
+
</Paragraph>
|
|
102
|
+
</Section>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isSignInWithEmailLink, signInWithEmailLink } from 'firebase/auth';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import { auth } from '$lib/models/Firebase';
|
|
5
|
+
import Link from '$lib/components/Link.svelte';
|
|
6
|
+
import { goto } from '$app/navigation';
|
|
7
|
+
import Feedback from '$lib/components/app/Feedback.svelte';
|
|
8
|
+
import Lead from '$lib/components/app/Lead.svelte';
|
|
9
|
+
import Large from '$lib/components/app/Large.svelte';
|
|
10
|
+
|
|
11
|
+
let error: string | undefined = undefined;
|
|
12
|
+
|
|
13
|
+
const messages: Record<string, string> = {
|
|
14
|
+
'auth/id-token-expired': 'This link expired.',
|
|
15
|
+
'auth/id-token-revoked': "This link isn't valid anymore.",
|
|
16
|
+
'auth/insufficient-permission':
|
|
17
|
+
"This email doesn't have permission to create an account.",
|
|
18
|
+
'auth/internal-error': "There's a problem at Google.",
|
|
19
|
+
'auth/invalid-argument': "This link isn't valid.",
|
|
20
|
+
'auth/invalid-email': "This wasn't a valid email.",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
onMount(() => {
|
|
24
|
+
if (auth && isSignInWithEmailLink(auth, window.location.href)) {
|
|
25
|
+
// If this is on the same device and browser, then the email should be in local storage.
|
|
26
|
+
let email = window.localStorage.getItem('email');
|
|
27
|
+
|
|
28
|
+
// If not, ask the user to confirm it.
|
|
29
|
+
if (!email)
|
|
30
|
+
email = window.prompt(
|
|
31
|
+
'It appears you opened your login link on a different device or browser. Can you confirm your email?'
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// If there's an email, try signing in.
|
|
35
|
+
if (email)
|
|
36
|
+
signInWithEmailLink(auth, email, window.location.href)
|
|
37
|
+
.then(() => {
|
|
38
|
+
// Clear email from storage now that the user is logged in.
|
|
39
|
+
window.localStorage.removeItem('email');
|
|
40
|
+
|
|
41
|
+
// Navigate to the home page.
|
|
42
|
+
goto('/write');
|
|
43
|
+
})
|
|
44
|
+
.catch((err: { code: string }) => {
|
|
45
|
+
error =
|
|
46
|
+
messages[err.code] ??
|
|
47
|
+
'There was a problem logging you in.';
|
|
48
|
+
});
|
|
49
|
+
// Otherwise, give some feedback.
|
|
50
|
+
else error = "Can't log in without an email address.";
|
|
51
|
+
}
|
|
52
|
+
// GIve some feedback if the email link isn't valid.
|
|
53
|
+
else error = "This isn't a valid login link.";
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<Lead><Large>Logging</Large> in…</Lead>
|
|
58
|
+
{#if error}
|
|
59
|
+
<Feedback error>{error} <Link to="/login">Try again?</Link></Feedback>
|
|
60
|
+
{:else}
|
|
61
|
+
<Feedback>Redirecting...</Feedback>
|
|
62
|
+
{/if}
|