bookish-press 0.7.4 → 0.8.2
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 +8 -0
- package/dist/components/Auth.svelte +29 -39
- package/dist/components/Auth.svelte.d.ts +5 -17
- package/dist/components/BookPreview.svelte +14 -20
- package/dist/components/BookPreview.svelte.d.ts +6 -18
- package/dist/components/Link.svelte +19 -30
- package/dist/components/Link.svelte.d.ts +7 -20
- package/dist/components/app/BookList.svelte +2 -3
- package/dist/components/app/BookList.svelte.d.ts +6 -18
- package/dist/components/app/Button.svelte +12 -8
- package/dist/components/app/Button.svelte.d.ts +10 -23
- package/dist/components/app/Feedback.svelte +4 -4
- package/dist/components/app/Feedback.svelte.d.ts +6 -19
- package/dist/components/app/Head.svelte +2 -2
- package/dist/components/app/Head.svelte.d.ts +6 -19
- package/dist/components/app/Large.svelte +4 -1
- package/dist/components/app/Large.svelte.d.ts +5 -28
- package/dist/components/app/Lead.svelte +4 -1
- package/dist/components/app/Lead.svelte.d.ts +5 -28
- package/dist/components/app/Link.svelte +12 -9
- package/dist/components/app/Link.svelte.d.ts +9 -22
- package/dist/components/app/Options.svelte +8 -6
- package/dist/components/app/Options.svelte.d.ts +8 -20
- package/dist/components/app/Paragraph.svelte +2 -2
- package/dist/components/app/Paragraph.svelte.d.ts +6 -19
- package/dist/components/app/Section.svelte +4 -1
- package/dist/components/app/Section.svelte.d.ts +5 -28
- package/dist/components/app/Table.svelte +4 -1
- package/dist/components/app/Table.svelte.d.ts +5 -28
- package/dist/components/app/TextInput.svelte +10 -8
- package/dist/components/app/TextInput.svelte.d.ts +12 -23
- package/dist/components/chapter/Atom.svelte +4 -7
- package/dist/components/chapter/Atom.svelte.d.ts +6 -19
- package/dist/components/chapter/Block.svelte +21 -23
- package/dist/components/chapter/Block.svelte.d.ts +5 -17
- package/dist/components/chapter/Callout.svelte +3 -5
- package/dist/components/chapter/Callout.svelte.d.ts +5 -17
- package/dist/components/chapter/CaptionedCode.svelte +12 -14
- package/dist/components/chapter/CaptionedCode.svelte.d.ts +5 -17
- package/dist/components/chapter/ChapterBody.svelte +14 -17
- package/dist/components/chapter/ChapterBody.svelte.d.ts +7 -19
- package/dist/components/chapter/ChapterBody.test.d.ts +1 -0
- package/dist/components/chapter/ChapterBody.test.js +85 -0
- package/dist/components/chapter/Citations.svelte +39 -45
- package/dist/components/chapter/Citations.svelte.d.ts +5 -17
- package/dist/components/chapter/Code.svelte +158 -155
- package/dist/components/chapter/Code.svelte.d.ts +10 -23
- package/dist/components/chapter/Comment.svelte +30 -23
- package/dist/components/chapter/Comment.svelte.d.ts +5 -17
- package/dist/components/chapter/Definition.svelte +36 -34
- package/dist/components/chapter/Definition.svelte.d.ts +5 -17
- package/dist/components/chapter/Embed.svelte +78 -72
- package/dist/components/chapter/Embed.svelte.d.ts +8 -20
- package/dist/components/chapter/ErrorMessage.svelte +2 -4
- package/dist/components/chapter/ErrorMessage.svelte.d.ts +5 -17
- package/dist/components/chapter/Figure.svelte +22 -29
- package/dist/components/chapter/Figure.svelte.d.ts +9 -22
- package/dist/components/chapter/Footnote.svelte +40 -32
- package/dist/components/chapter/Footnote.svelte.d.ts +5 -17
- package/dist/components/chapter/Format.svelte +26 -41
- package/dist/components/chapter/Format.svelte.d.ts +7 -18
- package/dist/components/chapter/InlineCode.svelte +7 -8
- package/dist/components/chapter/InlineCode.svelte.d.ts +5 -17
- package/dist/components/chapter/Label.svelte +5 -11
- package/dist/components/chapter/Label.svelte.d.ts +5 -17
- package/dist/components/chapter/LineBreak.svelte +1 -3
- package/dist/components/chapter/LineBreak.svelte.d.ts +5 -17
- package/dist/components/chapter/Link.svelte +17 -23
- package/dist/components/chapter/Link.svelte.d.ts +5 -17
- package/dist/components/chapter/List.svelte +9 -9
- package/dist/components/chapter/List.svelte.d.ts +6 -17
- package/dist/components/chapter/Marginal.svelte +59 -60
- package/dist/components/chapter/Marginal.svelte.d.ts +10 -22
- package/dist/components/chapter/Paragraph.svelte +8 -23
- package/dist/components/chapter/Paragraph.svelte.d.ts +6 -18
- package/dist/components/chapter/Positioned.svelte +2 -4
- package/dist/components/chapter/Positioned.svelte.d.ts +6 -19
- package/dist/components/chapter/Problem.svelte +3 -2
- package/dist/components/chapter/Problem.svelte.d.ts +5 -28
- package/dist/components/chapter/Python.svelte +45 -58
- package/dist/components/chapter/Python.svelte.d.ts +6 -18
- package/dist/components/chapter/Quote.svelte +5 -7
- package/dist/components/chapter/Quote.svelte.d.ts +5 -17
- package/dist/components/chapter/Rule.svelte +1 -3
- package/dist/components/chapter/Rule.svelte.d.ts +5 -17
- package/dist/components/chapter/Table.svelte +6 -8
- package/dist/components/chapter/Table.svelte.d.ts +5 -17
- package/dist/components/chapter/Text.svelte +54 -69
- package/dist/components/chapter/Text.svelte.d.ts +6 -18
- package/dist/components/controls/DarkToggle.svelte +7 -8
- package/dist/components/controls/DarkToggle.svelte.d.ts +6 -18
- package/dist/components/editor/BookishEditor.svelte +583 -761
- package/dist/components/editor/BookishEditor.svelte.d.ts +14 -26
- package/dist/components/editor/CalloutEditor.svelte +3 -3
- package/dist/components/editor/CalloutEditor.svelte.d.ts +5 -17
- package/dist/components/editor/CaptionedCodeEditor.svelte +5 -5
- package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +5 -17
- package/dist/components/editor/CaretView.svelte +23 -25
- package/dist/components/editor/CaretView.svelte.d.ts +15 -27
- package/dist/components/editor/CitationsEditor.svelte +25 -28
- package/dist/components/editor/CitationsEditor.svelte.d.ts +5 -17
- package/dist/components/editor/ConfirmButton.svelte +9 -6
- package/dist/components/editor/ConfirmButton.svelte.d.ts +8 -21
- package/dist/components/editor/DefinitionEditor.svelte +11 -15
- package/dist/components/editor/DefinitionEditor.svelte.d.ts +5 -17
- package/dist/components/editor/EmbedEditor.svelte +43 -44
- package/dist/components/editor/EmbedEditor.svelte.d.ts +5 -17
- package/dist/components/editor/Icon.svelte +1 -1
- package/dist/components/editor/Icon.svelte.d.ts +5 -17
- package/dist/components/editor/ImageChooser.svelte +15 -18
- package/dist/components/editor/ImageChooser.svelte.d.ts +6 -18
- package/dist/components/editor/ImageThumbnail.svelte +29 -24
- package/dist/components/editor/ImageThumbnail.svelte.d.ts +7 -19
- package/dist/components/editor/InlineCodeEditor.svelte +3 -3
- package/dist/components/editor/InlineCodeEditor.svelte.d.ts +5 -17
- package/dist/components/editor/LabelEditor.svelte +5 -6
- package/dist/components/editor/LabelEditor.svelte.d.ts +5 -17
- package/dist/components/editor/LanguageEditor.svelte +4 -5
- package/dist/components/editor/LanguageEditor.svelte.d.ts +6 -18
- package/dist/components/editor/LinkEditor.svelte +52 -68
- package/dist/components/editor/LinkEditor.svelte.d.ts +5 -17
- package/dist/components/editor/Note.svelte +4 -1
- package/dist/components/editor/Note.svelte.d.ts +5 -28
- package/dist/components/editor/Permissions.svelte +36 -34
- package/dist/components/editor/Permissions.svelte.d.ts +9 -21
- package/dist/components/editor/PositionEditor.svelte +6 -7
- package/dist/components/editor/PositionEditor.svelte.d.ts +6 -18
- package/dist/components/editor/QuoteEditor.svelte +3 -3
- package/dist/components/editor/QuoteEditor.svelte.d.ts +5 -17
- package/dist/components/editor/Switch.svelte +16 -11
- package/dist/components/editor/Switch.svelte.d.ts +9 -21
- package/dist/components/editor/TableEditor.svelte +3 -3
- package/dist/components/editor/TableEditor.svelte.d.ts +5 -17
- package/dist/components/editor/TextEditor.svelte +74 -87
- package/dist/components/editor/TextEditor.svelte.d.ts +13 -25
- package/dist/components/editor/Toggle.svelte +18 -21
- package/dist/components/editor/Toggle.svelte.d.ts +7 -20
- package/dist/components/editor/Toolbar.svelte +140 -145
- package/dist/components/editor/Toolbar.svelte.d.ts +5 -17
- package/dist/components/editor/ToolbarGroup.svelte +4 -4
- package/dist/components/editor/ToolbarGroup.svelte.d.ts +6 -19
- package/dist/components/editor/ToolbarSpacer.svelte +1 -1
- package/dist/components/editor/ToolbarSpacer.svelte.d.ts +22 -21
- package/dist/components/editor/URLEditor.svelte +3 -5
- package/dist/components/editor/URLEditor.svelte.d.ts +7 -19
- package/dist/components/page/Acknowledgements.svelte +14 -8
- package/dist/components/page/Acknowledgements.svelte.d.ts +3 -16
- package/dist/components/page/Analytics.svelte +2 -3
- package/dist/components/page/Analytics.svelte.d.ts +6 -17
- package/dist/components/page/Authors.svelte +29 -29
- package/dist/components/page/Authors.svelte.d.ts +11 -23
- package/dist/components/page/BookLoader.svelte +47 -43
- package/dist/components/page/BookLoader.svelte.d.ts +5 -17
- package/dist/components/page/BulkReferenceEditor.svelte +43 -26
- package/dist/components/page/BulkReferenceEditor.svelte.d.ts +3 -16
- package/dist/components/page/Chapter.svelte +224 -249
- package/dist/components/page/Chapter.svelte.d.ts +6 -18
- package/dist/components/page/ChapterContext.d.ts +3 -1
- package/dist/components/page/ChapterNumber.svelte +4 -1
- package/dist/components/page/ChapterNumber.svelte.d.ts +5 -28
- package/dist/components/page/ChapterTitle.svelte +4 -4
- package/dist/components/page/ChapterTitle.svelte.d.ts +6 -19
- package/dist/components/page/Contexts.js +2 -2
- package/dist/components/page/DefinitionView.svelte +51 -44
- package/dist/components/page/DefinitionView.svelte.d.ts +6 -18
- package/dist/components/page/Description.svelte +10 -4
- package/dist/components/page/Description.svelte.d.ts +16 -14
- package/dist/components/page/EditableHeader.svelte +4 -6
- package/dist/components/page/EditableHeader.svelte.d.ts +7 -18
- package/dist/components/page/Edition.svelte +57 -71
- package/dist/components/page/Edition.svelte.d.ts +7 -20
- package/dist/components/page/EditionLoader.svelte +119 -82
- package/dist/components/page/EditionLoader.svelte.d.ts +6 -19
- package/dist/components/page/Editions.svelte +26 -31
- package/dist/components/page/Editions.svelte.d.ts +5 -17
- package/dist/components/page/Glossary.svelte +31 -35
- package/dist/components/page/Glossary.svelte.d.ts +3 -16
- package/dist/components/page/Header.svelte +43 -49
- package/dist/components/page/Header.svelte.d.ts +19 -30
- package/dist/components/page/Index.svelte +46 -46
- package/dist/components/page/Index.svelte.d.ts +3 -16
- package/dist/components/page/Instructions.svelte +2 -2
- package/dist/components/page/Instructions.svelte.d.ts +6 -19
- package/dist/components/page/License.svelte +13 -7
- package/dist/components/page/License.svelte.d.ts +16 -14
- package/dist/components/page/Loading.svelte +9 -9
- package/dist/components/page/Loading.svelte.d.ts +22 -21
- package/dist/components/page/Media.svelte +36 -27
- package/dist/components/page/Media.svelte.d.ts +3 -16
- package/dist/components/page/MediaPreview.svelte +22 -19
- package/dist/components/page/MediaPreview.svelte.d.ts +8 -21
- package/dist/components/page/Muted.svelte +4 -1
- package/dist/components/page/Muted.svelte.d.ts +5 -28
- package/dist/components/page/Outline.svelte +75 -97
- package/dist/components/page/Outline.svelte.d.ts +8 -20
- package/dist/components/page/Page.svelte +23 -33
- package/dist/components/page/Page.svelte.d.ts +7 -20
- package/dist/components/page/PageHeader.svelte +2 -2
- package/dist/components/page/PageHeader.svelte.d.ts +6 -19
- package/dist/components/page/PageParagraph.svelte +4 -1
- package/dist/components/page/PageParagraph.svelte.d.ts +5 -28
- package/dist/components/page/PossibleChapter.svelte +7 -7
- package/dist/components/page/PossibleChapter.svelte.d.ts +3 -16
- package/dist/components/page/PossibleReference.svelte +4 -5
- package/dist/components/page/PossibleReference.svelte.d.ts +6 -18
- package/dist/components/page/Print.svelte +11 -12
- package/dist/components/page/Print.svelte.d.ts +3 -16
- package/dist/components/page/Publish.svelte +47 -47
- package/dist/components/page/Publish.svelte.d.ts +3 -16
- package/dist/components/page/Reference.svelte +24 -35
- package/dist/components/page/Reference.svelte.d.ts +6 -18
- package/dist/components/page/References.svelte +21 -22
- package/dist/components/page/References.svelte.d.ts +3 -16
- package/dist/components/page/Rows.svelte +4 -1
- package/dist/components/page/Rows.svelte.d.ts +5 -28
- package/dist/components/page/Search.svelte +58 -60
- package/dist/components/page/Search.svelte.d.ts +3 -16
- package/dist/components/page/Status.svelte +2 -2
- package/dist/components/page/Status.svelte.d.ts +16 -14
- package/dist/components/page/SubdomainEditor.svelte +11 -11
- package/dist/components/page/SubdomainEditor.svelte.d.ts +16 -14
- package/dist/components/page/TableOfContents.svelte +143 -125
- package/dist/components/page/TableOfContents.svelte.d.ts +3 -16
- package/dist/components/page/TableOfContentsImage.svelte +6 -7
- package/dist/components/page/TableOfContentsImage.svelte.d.ts +6 -18
- package/dist/components/page/TableOfContentsRow.svelte +32 -32
- package/dist/components/page/TableOfContentsRow.svelte.d.ts +10 -22
- package/dist/components/page/ThemeEditor.svelte +35 -28
- package/dist/components/page/ThemeEditor.svelte.d.ts +3 -16
- package/dist/components/page/ThemeEditorPreview.svelte +11 -13
- package/dist/components/page/ThemeEditorPreview.svelte.d.ts +5 -17
- package/dist/components/page/ThemeSetEditor.svelte +4 -6
- package/dist/components/page/ThemeSetEditor.svelte.d.ts +7 -19
- package/dist/components/page/ThemeVariableEditor.svelte +9 -11
- package/dist/components/page/ThemeVariableEditor.svelte.d.ts +7 -19
- package/dist/components/page/Title.svelte +4 -1
- package/dist/components/page/Title.svelte.d.ts +5 -28
- package/dist/components/page/Unknown.svelte +11 -8
- package/dist/components/page/Unknown.svelte.d.ts +5 -17
- package/dist/models/Firebase.js +18 -4
- package/dist/models/book/Book.js +2 -1
- package/dist/models/book/BookMedia.js +1 -2
- package/dist/models/book/Chapter.js +3 -2
- package/dist/models/book/Edition.d.ts +1 -1
- package/dist/models/book/Edition.js +5 -1
- package/dist/models/chapter/BlocksNode.js +3 -1
- package/dist/models/chapter/BlocksNode.test.js +5 -1
- package/dist/models/chapter/Node.test.js +2 -2
- package/package.json +34 -22
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import PossibleReference from '../page/PossibleReference.svelte';
|
|
8
|
-
import { afterUpdate } from 'svelte';
|
|
9
|
-
export let node;
|
|
1
|
+
<script lang="ts">import Marginal from "./Marginal.svelte";
|
|
2
|
+
import Problem from "./Problem.svelte";
|
|
3
|
+
import Atom from "./Atom.svelte";
|
|
4
|
+
import { getChapter, getEdition, getRoot } from "../page/Contexts";
|
|
5
|
+
import PossibleReference from "../page/PossibleReference.svelte";
|
|
6
|
+
let { node } = $props();
|
|
10
7
|
let chapter = getChapter();
|
|
11
8
|
let edition = getEdition();
|
|
12
9
|
let root = getRoot();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if ($root ===
|
|
16
|
-
return 0;
|
|
10
|
+
let citations = $derived(
|
|
11
|
+
node.getMeta().sort((a, b) => {
|
|
12
|
+
if ($root === void 0) return 0;
|
|
17
13
|
let aNumber = $root.getCitationNumber(a);
|
|
18
14
|
let bNumber = $root.getCitationNumber(b);
|
|
19
15
|
if (aNumber === null) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
else {
|
|
26
|
-
if (bNumber === null)
|
|
27
|
-
return -1;
|
|
28
|
-
else
|
|
29
|
-
return aNumber - bNumber;
|
|
16
|
+
if (bNumber === null) return 0;
|
|
17
|
+
else return 1;
|
|
18
|
+
} else {
|
|
19
|
+
if (bNumber === null) return -1;
|
|
20
|
+
else return aNumber - bNumber;
|
|
30
21
|
}
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
$effect(() => {
|
|
25
|
+
void citations;
|
|
26
|
+
$chapter?.requestLayout();
|
|
31
27
|
});
|
|
32
|
-
// Position the marginals on every render.
|
|
33
|
-
afterUpdate(() => $chapter?.layoutMarginals());
|
|
34
28
|
</script>
|
|
35
29
|
|
|
36
30
|
<Atom {node}
|
|
@@ -41,7 +35,7 @@ afterUpdate(() => $chapter?.layoutMarginals());
|
|
|
41
35
|
label="reference {citations
|
|
42
36
|
.map((c) => $root.getCitationNumber(c))
|
|
43
37
|
.join(', ')}"
|
|
44
|
-
|
|
38
|
+
>{#snippet interactor()}
|
|
45
39
|
{#each citations as citationID, index}{@const citationNumber =
|
|
46
40
|
$root.getCitationNumber(
|
|
47
41
|
citationID,
|
|
@@ -55,26 +49,26 @@ afterUpdate(() => $chapter?.layoutMarginals());
|
|
|
55
49
|
>,</sup
|
|
56
50
|
>{/if}{:else}<sup class="bookish-citation-symbol"
|
|
57
51
|
>{'\u2014'}</sup
|
|
58
|
-
>{/each}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
>
|
|
68
|
-
<sup class="bookish-citation-symbol"
|
|
69
|
-
>{citationNumber}</sup
|
|
52
|
+
>{/each}{/snippet}{#snippet content()}<span
|
|
53
|
+
class="bookish-references"
|
|
54
|
+
>{#each citations as citationID}
|
|
55
|
+
{@const citationNumber =
|
|
56
|
+
$root.getCitationNumber(citationID)}
|
|
57
|
+
{@const ref = $edition?.getReference(citationID)}
|
|
58
|
+
{#if citationNumber && ref && $edition}<span
|
|
59
|
+
class="bookish-reference"
|
|
60
|
+
aria-hidden="true"
|
|
70
61
|
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
<sup class="bookish-citation-symbol"
|
|
63
|
+
>{citationNumber}</sup
|
|
64
|
+
>
|
|
65
|
+
<PossibleReference
|
|
66
|
+
node={ref}
|
|
67
|
+
edit={false}
|
|
68
|
+
/></span
|
|
69
|
+
>{/if}
|
|
70
|
+
{/each}</span
|
|
71
|
+
>{/snippet}</Marginal
|
|
78
72
|
></span
|
|
79
73
|
>{/if}</Atom
|
|
80
74
|
>
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type CitationsNode from '../../models/chapter/CitationsNode';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
node: CitationsNode;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
exports?: {} | undefined;
|
|
12
|
-
bindings?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
export type CitationsProps = typeof __propDef.props;
|
|
15
|
-
export type CitationsEvents = typeof __propDef.events;
|
|
16
|
-
export type CitationsSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Citations extends SvelteComponent<CitationsProps, CitationsEvents, CitationsSlots> {
|
|
2
|
+
interface Props {
|
|
3
|
+
node: CitationsNode;
|
|
18
4
|
}
|
|
19
|
-
|
|
5
|
+
declare const Citations: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type Citations = ReturnType<typeof Citations>;
|
|
7
|
+
export default Citations;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let element = null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script lang="ts">import Prism from "./ExtendedPrism";
|
|
2
|
+
let {
|
|
3
|
+
editable,
|
|
4
|
+
inline,
|
|
5
|
+
nodeID,
|
|
6
|
+
edited = void 0,
|
|
7
|
+
language = void 0,
|
|
8
|
+
code
|
|
9
|
+
} = $props();
|
|
10
|
+
let element = $state(null);
|
|
11
|
+
$effect(() => {
|
|
12
|
+
void code;
|
|
13
|
+
void language;
|
|
14
|
+
if (element) {
|
|
15
|
+
Prism.highlightElement(element);
|
|
16
|
+
}
|
|
16
17
|
});
|
|
17
18
|
function handleChange() {
|
|
18
|
-
|
|
19
|
-
edited(element.innerText);
|
|
19
|
+
if (element && edited) edited(element.innerText);
|
|
20
20
|
}
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -27,145 +27,148 @@ function handleChange() {
|
|
|
27
27
|
class={`bookish-code ${
|
|
28
28
|
inline ? 'bookish-code-inline' : 'bookish-code-block'
|
|
29
29
|
} ${language ? `language-${language}` : ''}`}
|
|
30
|
-
|
|
30
|
+
onblur={handleChange}>{code}</code
|
|
31
31
|
>
|
|
32
|
-
<slot />
|
|
33
|
-
</code>
|
|
34
|
-
|
|
35
|
-
<style global>
|
|
36
|
-
:global(.bookish-code) {
|
|
37
|
-
font-family: var(--bookish-code-font-family);
|
|
38
|
-
font-weight: var(--bookish-code-font-weight);
|
|
39
|
-
font-size: var(--bookish-code-font-size);
|
|
40
|
-
border: 1px solid var(--bookish-border-color-light);
|
|
41
|
-
color: var(--bookish-muted-color);
|
|
42
|
-
background-color: var(--bookish-block-background-color);
|
|
43
|
-
clear: both;
|
|
44
|
-
overflow-x: scroll;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:global(code) {
|
|
48
|
-
font-family: var(--bookish-code-font-family);
|
|
49
|
-
font-weight: var(--bookish-code-font-weight);
|
|
50
|
-
font-size: var(--bookish-code-font-size);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:global(.bookish-code-block) {
|
|
54
|
-
display: block;
|
|
55
|
-
padding: var(--bookish-block-padding);
|
|
56
|
-
line-height: var(--bookish-paragraph-line-height-tight);
|
|
57
|
-
border-radius: var(--bookish-roundedness);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
:global(.bookish-code-block.wrap) {
|
|
61
|
-
white-space: pre-wrap !important;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
:global(.bookish-code-inline) {
|
|
65
|
-
display: inline;
|
|
66
|
-
padding: calc(1.5 * var(--bookish-inline-padding))
|
|
67
|
-
var(--bookish-inline-padding);
|
|
68
|
-
white-space: pre-line !important;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:global(.bookish-code-inline) :global(code) {
|
|
72
|
-
display: inline;
|
|
73
|
-
padding: 0em;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/* PrismJS 1.29.0
|
|
77
|
-
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+python */
|
|
78
|
-
/**
|
|
79
|
-
* prism.js default theme for JavaScript, CSS and HTML
|
|
80
|
-
* Based on dabblet (http://dabblet.com)
|
|
81
|
-
* @author Lea Verou
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
:global(code[class*='language-']) {
|
|
85
|
-
color: var(--bookish-paragraph-color);
|
|
86
|
-
background: none;
|
|
87
|
-
font-family: var(--bookish-code-font-family);
|
|
88
|
-
font-size: var(--bookish-code-font-size);
|
|
89
|
-
text-align: left;
|
|
90
|
-
white-space: pre;
|
|
91
|
-
word-spacing: normal;
|
|
92
|
-
word-break: normal;
|
|
93
|
-
word-wrap: normal;
|
|
94
|
-
line-height: 1.5;
|
|
95
|
-
|
|
96
|
-
-moz-tab-size: 4;
|
|
97
|
-
-o-tab-size: 4;
|
|
98
|
-
tab-size: 4;
|
|
99
|
-
|
|
100
|
-
-webkit-hyphens: none;
|
|
101
|
-
-moz-hyphens: none;
|
|
102
|
-
-ms-hyphens: none;
|
|
103
|
-
hyphens: none;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
:global(.token.comment),
|
|
107
|
-
:global(.token.prolog),
|
|
108
|
-
:global(.token.doctype),
|
|
109
|
-
:global(.token.cdata) {
|
|
110
|
-
color: var(--bookish-comment-color);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
:global(.token.punctuation) {
|
|
114
|
-
color: var(--bookish-muted-color);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
:global(.token.namespace) {
|
|
118
|
-
opacity: 0.7;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
:global(.token.property),
|
|
122
|
-
:global(.token.tag),
|
|
123
|
-
:global(.token.boolean),
|
|
124
|
-
:global(.token.number),
|
|
125
|
-
:global(.token.constant),
|
|
126
|
-
:global(.token.symbol),
|
|
127
|
-
:global(.token.deleted) {
|
|
128
|
-
color: var(--bookish-error-color);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
:global(.token.selector),
|
|
132
|
-
:global(.token.attr-name),
|
|
133
|
-
:global(.token.string),
|
|
134
|
-
:global(.token.char),
|
|
135
|
-
:global(.token.builtin),
|
|
136
|
-
:global(.token.inserted) {
|
|
137
|
-
color: var(--bookish-pragraph-color);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
:global(.token.operator),
|
|
141
|
-
:global(.token.entity),
|
|
142
|
-
:global(.token.url) {
|
|
143
|
-
color: var(--bookish-bullet-color);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
:global(.token.atrule),
|
|
147
|
-
:global(.token.attr-value),
|
|
148
|
-
:global(.token.keyword) {
|
|
149
|
-
color: var(--bookish-link-color);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
:global(.token.regex),
|
|
153
|
-
:global(.token.important),
|
|
154
|
-
:global(.token.variable),
|
|
155
|
-
:global(.token.function),
|
|
156
|
-
:global(.token.class-name) {
|
|
157
|
-
color: var(--bookish-highlight-color);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
:global(.token.important),
|
|
161
|
-
:global(.token.bold) {
|
|
162
|
-
font-weight: bold;
|
|
163
|
-
}
|
|
164
|
-
:global(.token.italic) {
|
|
165
|
-
font-style: italic;
|
|
166
|
-
}
|
|
167
32
|
|
|
168
|
-
|
|
169
|
-
|
|
33
|
+
<!-- These styles are global because Prism inserts token elements at runtime
|
|
34
|
+
that the compiler cannot see, and because other components render
|
|
35
|
+
bookish-code elements of their own. -->
|
|
36
|
+
<style>
|
|
37
|
+
:global {
|
|
38
|
+
.bookish-code {
|
|
39
|
+
font-family: var(--bookish-code-font-family);
|
|
40
|
+
font-weight: var(--bookish-code-font-weight);
|
|
41
|
+
font-size: var(--bookish-code-font-size);
|
|
42
|
+
border: 1px solid var(--bookish-border-color-light);
|
|
43
|
+
color: var(--bookish-muted-color);
|
|
44
|
+
background-color: var(--bookish-block-background-color);
|
|
45
|
+
clear: both;
|
|
46
|
+
overflow-x: scroll;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
code {
|
|
50
|
+
font-family: var(--bookish-code-font-family);
|
|
51
|
+
font-weight: var(--bookish-code-font-weight);
|
|
52
|
+
font-size: var(--bookish-code-font-size);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.bookish-code-block {
|
|
56
|
+
display: block;
|
|
57
|
+
padding: var(--bookish-block-padding);
|
|
58
|
+
line-height: var(--bookish-paragraph-line-height-tight);
|
|
59
|
+
border-radius: var(--bookish-roundedness);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.bookish-code-block.wrap {
|
|
63
|
+
white-space: pre-wrap !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.bookish-code-inline {
|
|
67
|
+
display: inline;
|
|
68
|
+
padding: calc(1.5 * var(--bookish-inline-padding))
|
|
69
|
+
var(--bookish-inline-padding);
|
|
70
|
+
white-space: pre-line !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.bookish-code-inline code {
|
|
74
|
+
display: inline;
|
|
75
|
+
padding: 0em;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* PrismJS 1.29.0
|
|
79
|
+
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+python */
|
|
80
|
+
/**
|
|
81
|
+
* prism.js default theme for JavaScript, CSS and HTML
|
|
82
|
+
* Based on dabblet (http://dabblet.com)
|
|
83
|
+
* @author Lea Verou
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
code[class*='language-'] {
|
|
87
|
+
color: var(--bookish-paragraph-color);
|
|
88
|
+
background: none;
|
|
89
|
+
font-family: var(--bookish-code-font-family);
|
|
90
|
+
font-size: var(--bookish-code-font-size);
|
|
91
|
+
text-align: left;
|
|
92
|
+
white-space: pre;
|
|
93
|
+
word-spacing: normal;
|
|
94
|
+
word-break: normal;
|
|
95
|
+
word-wrap: normal;
|
|
96
|
+
line-height: 1.5;
|
|
97
|
+
|
|
98
|
+
-moz-tab-size: 4;
|
|
99
|
+
-o-tab-size: 4;
|
|
100
|
+
tab-size: 4;
|
|
101
|
+
|
|
102
|
+
-webkit-hyphens: none;
|
|
103
|
+
-moz-hyphens: none;
|
|
104
|
+
-ms-hyphens: none;
|
|
105
|
+
hyphens: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.token.comment,
|
|
109
|
+
.token.prolog,
|
|
110
|
+
.token.doctype,
|
|
111
|
+
.token.cdata {
|
|
112
|
+
color: var(--bookish-comment-color);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.token.punctuation {
|
|
116
|
+
color: var(--bookish-muted-color);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.token.namespace {
|
|
120
|
+
opacity: 0.7;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.token.property,
|
|
124
|
+
.token.tag,
|
|
125
|
+
.token.boolean,
|
|
126
|
+
.token.number,
|
|
127
|
+
.token.constant,
|
|
128
|
+
.token.symbol,
|
|
129
|
+
.token.deleted {
|
|
130
|
+
color: var(--bookish-error-color);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.token.selector,
|
|
134
|
+
.token.attr-name,
|
|
135
|
+
.token.string,
|
|
136
|
+
.token.char,
|
|
137
|
+
.token.builtin,
|
|
138
|
+
.token.inserted {
|
|
139
|
+
color: var(--bookish-pragraph-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.token.operator,
|
|
143
|
+
.token.entity,
|
|
144
|
+
.token.url {
|
|
145
|
+
color: var(--bookish-bullet-color);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.token.atrule,
|
|
149
|
+
.token.attr-value,
|
|
150
|
+
.token.keyword {
|
|
151
|
+
color: var(--bookish-link-color);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.token.regex,
|
|
155
|
+
.token.important,
|
|
156
|
+
.token.variable,
|
|
157
|
+
.token.function,
|
|
158
|
+
.token.class-name {
|
|
159
|
+
color: var(--bookish-highlight-color);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.token.important,
|
|
163
|
+
.token.bold {
|
|
164
|
+
font-weight: bold;
|
|
165
|
+
}
|
|
166
|
+
.token.italic {
|
|
167
|
+
font-style: italic;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.token.entity {
|
|
171
|
+
cursor: help;
|
|
172
|
+
}
|
|
170
173
|
}
|
|
171
174
|
</style>
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
language?: string | undefined;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {
|
|
14
|
-
default: {};
|
|
15
|
-
};
|
|
16
|
-
exports?: {} | undefined;
|
|
17
|
-
bindings?: string | undefined;
|
|
18
|
-
};
|
|
19
|
-
export type CodeProps = typeof __propDef.props;
|
|
20
|
-
export type CodeEvents = typeof __propDef.events;
|
|
21
|
-
export type CodeSlots = typeof __propDef.slots;
|
|
22
|
-
export default class Code extends SvelteComponent<CodeProps, CodeEvents, CodeSlots> {
|
|
1
|
+
interface Props {
|
|
2
|
+
editable: boolean;
|
|
3
|
+
inline: boolean;
|
|
4
|
+
nodeID: number | undefined;
|
|
5
|
+
edited?: ((text: string) => void) | undefined;
|
|
6
|
+
language?: string | undefined;
|
|
7
|
+
code: string;
|
|
23
8
|
}
|
|
24
|
-
|
|
9
|
+
declare const Code: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Code = ReturnType<typeof Code>;
|
|
11
|
+
export default Code;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">import Atom from "./Atom.svelte";
|
|
2
|
+
import Marginal from "./Marginal.svelte";
|
|
3
|
+
import Format from "./Format.svelte";
|
|
4
|
+
import {
|
|
5
|
+
getChapter,
|
|
6
|
+
isChapterEditable,
|
|
7
|
+
getCaret,
|
|
8
|
+
getRoot
|
|
9
|
+
} from "../page/Contexts";
|
|
10
|
+
import Icon from "../editor/Icon.svelte";
|
|
11
|
+
import CommentIcon from "../editor/icons/comment.svg?raw";
|
|
12
|
+
let { node } = $props();
|
|
11
13
|
let chapter = getChapter();
|
|
12
14
|
let editable = isChapterEditable();
|
|
13
15
|
let root = getRoot();
|
|
14
16
|
let caret = getCaret();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
let focused = $derived(
|
|
18
|
+
$caret && $caret.range && node.contains($caret.range.start.node)
|
|
19
|
+
);
|
|
20
|
+
$effect(() => {
|
|
21
|
+
void node;
|
|
22
|
+
void focused;
|
|
23
|
+
$chapter?.requestLayout();
|
|
24
|
+
});
|
|
19
25
|
</script>
|
|
20
26
|
|
|
21
27
|
<Atom {node}>
|
|
@@ -26,15 +32,16 @@ afterUpdate(() => $chapter?.layoutMarginals());
|
|
|
26
32
|
($root === undefined ? '?' : $root.getComments().indexOf(node))}
|
|
27
33
|
label="comment, escape to edit"
|
|
28
34
|
>
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
{#snippet interactor()}
|
|
36
|
+
<span class="bookish-comment-symbol">
|
|
37
|
+
<Icon icon={CommentIcon} />
|
|
38
|
+
</span>
|
|
39
|
+
{/snippet}
|
|
40
|
+
{#snippet content()}
|
|
41
|
+
<span class={`comment ${focused ? 'comment-focused' : ''}`}>
|
|
42
|
+
<Format node={node.getMeta()} placeholder="comment" />
|
|
43
|
+
</span>
|
|
44
|
+
{/snippet}
|
|
38
45
|
</Marginal>
|
|
39
46
|
{/if}
|
|
40
47
|
</Atom>
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type CommentNode from '../../models/chapter/CommentNode';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
node: CommentNode;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
exports?: {} | undefined;
|
|
12
|
-
bindings?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
export type CommentProps = typeof __propDef.props;
|
|
15
|
-
export type CommentEvents = typeof __propDef.events;
|
|
16
|
-
export type CommentSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Comment extends SvelteComponent<CommentProps, CommentEvents, CommentSlots> {
|
|
2
|
+
interface Props {
|
|
3
|
+
node: CommentNode;
|
|
18
4
|
}
|
|
19
|
-
|
|
5
|
+
declare const Comment: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type Comment = ReturnType<typeof Comment>;
|
|
7
|
+
export default Comment;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">import Parser from "../../models/chapter/Parser";
|
|
2
|
+
import Text from "./Text.svelte";
|
|
3
|
+
import Format from "./Format.svelte";
|
|
4
|
+
import Marginal from "./Marginal.svelte";
|
|
5
|
+
import Problem from "./Problem.svelte";
|
|
6
|
+
import {
|
|
7
|
+
getChapter,
|
|
8
|
+
getEdition,
|
|
9
|
+
isChapterEditable
|
|
10
|
+
} from "../page/Contexts";
|
|
11
|
+
let { node } = $props();
|
|
11
12
|
let editable = isChapterEditable();
|
|
12
13
|
let edition = getEdition();
|
|
13
14
|
let chapter = getChapter();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
let glossaryID = $derived(node.getMeta());
|
|
16
|
+
let phrase = $derived(node.getText());
|
|
17
|
+
let glossary = $derived($edition?.getGlossary() ?? {});
|
|
18
|
+
let entry = $derived(glossary[glossaryID]);
|
|
19
|
+
$effect(() => {
|
|
20
|
+
void phrase;
|
|
21
|
+
void entry;
|
|
22
|
+
$chapter?.requestLayout();
|
|
23
|
+
});
|
|
21
24
|
</script>
|
|
22
25
|
|
|
23
26
|
<!-- Error if there's no corresponding entry. -->
|
|
@@ -26,23 +29,22 @@ afterUpdate(() => $chapter?.layoutMarginals());
|
|
|
26
29
|
{node}
|
|
27
30
|
id={'glossary-' + glossaryID}
|
|
28
31
|
label={entry ? `definition: ${entry.phrase}` : 'undefined phrase'}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
></Marginal
|
|
32
|
+
>{#snippet interactor()}<Text node={phrase} />{/snippet}{#snippet content()}<span
|
|
33
|
+
class="bookish-definition-entry"
|
|
34
|
+
>{#if entry === undefined}<Problem
|
|
35
|
+
>{#if editable}{glossaryID.length === 0
|
|
36
|
+
? 'choose a definition'
|
|
37
|
+
: `unknown glossary ID ${glossaryID}`}{:else}<em
|
|
38
|
+
>missing definition</em
|
|
39
|
+
>{/if}</Problem
|
|
40
|
+
>{:else}<strong class="bookish-definition-entry-phrase"
|
|
41
|
+
>{entry.phrase}</strong
|
|
42
|
+
>: <Format
|
|
43
|
+
node={Parser.parseFormat($edition, entry.definition)}
|
|
44
|
+
/>{#if entry.synonyms && entry.synonyms.length > 0}<p
|
|
45
|
+
class="synonyms">{entry.synonyms.join(', ')}</p
|
|
46
|
+
>{/if}{/if}</span
|
|
47
|
+
>{/snippet}</Marginal
|
|
46
48
|
></span
|
|
47
49
|
>
|
|
48
50
|
|