bookish-press 0.7.4 → 0.9.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.
Files changed (276) hide show
  1. package/README.md +56 -9
  2. package/dist/components/Auth.svelte +29 -39
  3. package/dist/components/Auth.svelte.d.ts +5 -17
  4. package/dist/components/BookPreview.svelte +14 -20
  5. package/dist/components/BookPreview.svelte.d.ts +6 -18
  6. package/dist/components/Link.svelte +19 -30
  7. package/dist/components/Link.svelte.d.ts +7 -20
  8. package/dist/components/app/BookList.svelte +2 -3
  9. package/dist/components/app/BookList.svelte.d.ts +6 -18
  10. package/dist/components/app/Button.svelte +12 -8
  11. package/dist/components/app/Button.svelte.d.ts +10 -23
  12. package/dist/components/app/Feedback.svelte +4 -4
  13. package/dist/components/app/Feedback.svelte.d.ts +6 -19
  14. package/dist/components/app/Head.svelte +2 -2
  15. package/dist/components/app/Head.svelte.d.ts +6 -19
  16. package/dist/components/app/Large.svelte +4 -1
  17. package/dist/components/app/Large.svelte.d.ts +5 -28
  18. package/dist/components/app/Lead.svelte +4 -1
  19. package/dist/components/app/Lead.svelte.d.ts +5 -28
  20. package/dist/components/app/Link.svelte +12 -9
  21. package/dist/components/app/Link.svelte.d.ts +9 -22
  22. package/dist/components/app/Options.svelte +8 -6
  23. package/dist/components/app/Options.svelte.d.ts +8 -20
  24. package/dist/components/app/Paragraph.svelte +2 -2
  25. package/dist/components/app/Paragraph.svelte.d.ts +6 -19
  26. package/dist/components/app/Section.svelte +4 -1
  27. package/dist/components/app/Section.svelte.d.ts +5 -28
  28. package/dist/components/app/Table.svelte +4 -1
  29. package/dist/components/app/Table.svelte.d.ts +5 -28
  30. package/dist/components/app/TextInput.svelte +10 -8
  31. package/dist/components/app/TextInput.svelte.d.ts +12 -23
  32. package/dist/components/chapter/Atom.svelte +4 -7
  33. package/dist/components/chapter/Atom.svelte.d.ts +6 -19
  34. package/dist/components/chapter/Block.svelte +21 -23
  35. package/dist/components/chapter/Block.svelte.d.ts +5 -17
  36. package/dist/components/chapter/Callout.svelte +3 -5
  37. package/dist/components/chapter/Callout.svelte.d.ts +5 -17
  38. package/dist/components/chapter/CaptionedCode.svelte +12 -14
  39. package/dist/components/chapter/CaptionedCode.svelte.d.ts +5 -17
  40. package/dist/components/chapter/ChapterBody.svelte +14 -17
  41. package/dist/components/chapter/ChapterBody.svelte.d.ts +7 -19
  42. package/dist/components/chapter/ChapterBody.test.d.ts +1 -0
  43. package/dist/components/chapter/ChapterBody.test.js +85 -0
  44. package/dist/components/chapter/Citations.svelte +39 -45
  45. package/dist/components/chapter/Citations.svelte.d.ts +5 -17
  46. package/dist/components/chapter/Code.svelte +158 -155
  47. package/dist/components/chapter/Code.svelte.d.ts +10 -23
  48. package/dist/components/chapter/Comment.svelte +30 -23
  49. package/dist/components/chapter/Comment.svelte.d.ts +5 -17
  50. package/dist/components/chapter/Definition.svelte +36 -34
  51. package/dist/components/chapter/Definition.svelte.d.ts +5 -17
  52. package/dist/components/chapter/Embed.svelte +78 -72
  53. package/dist/components/chapter/Embed.svelte.d.ts +8 -20
  54. package/dist/components/chapter/ErrorMessage.svelte +2 -4
  55. package/dist/components/chapter/ErrorMessage.svelte.d.ts +5 -17
  56. package/dist/components/chapter/Figure.svelte +22 -29
  57. package/dist/components/chapter/Figure.svelte.d.ts +9 -22
  58. package/dist/components/chapter/Footnote.svelte +40 -32
  59. package/dist/components/chapter/Footnote.svelte.d.ts +5 -17
  60. package/dist/components/chapter/Format.svelte +26 -41
  61. package/dist/components/chapter/Format.svelte.d.ts +7 -18
  62. package/dist/components/chapter/InlineCode.svelte +7 -8
  63. package/dist/components/chapter/InlineCode.svelte.d.ts +5 -17
  64. package/dist/components/chapter/Label.svelte +5 -11
  65. package/dist/components/chapter/Label.svelte.d.ts +5 -17
  66. package/dist/components/chapter/LineBreak.svelte +1 -3
  67. package/dist/components/chapter/LineBreak.svelte.d.ts +5 -17
  68. package/dist/components/chapter/Link.svelte +17 -23
  69. package/dist/components/chapter/Link.svelte.d.ts +5 -17
  70. package/dist/components/chapter/List.svelte +9 -9
  71. package/dist/components/chapter/List.svelte.d.ts +6 -17
  72. package/dist/components/chapter/Marginal.svelte +59 -60
  73. package/dist/components/chapter/Marginal.svelte.d.ts +10 -22
  74. package/dist/components/chapter/Paragraph.svelte +8 -23
  75. package/dist/components/chapter/Paragraph.svelte.d.ts +6 -18
  76. package/dist/components/chapter/Positioned.svelte +2 -4
  77. package/dist/components/chapter/Positioned.svelte.d.ts +6 -19
  78. package/dist/components/chapter/Problem.svelte +3 -2
  79. package/dist/components/chapter/Problem.svelte.d.ts +5 -28
  80. package/dist/components/chapter/Python.svelte +45 -58
  81. package/dist/components/chapter/Python.svelte.d.ts +6 -18
  82. package/dist/components/chapter/Quote.svelte +5 -7
  83. package/dist/components/chapter/Quote.svelte.d.ts +5 -17
  84. package/dist/components/chapter/Rule.svelte +1 -3
  85. package/dist/components/chapter/Rule.svelte.d.ts +5 -17
  86. package/dist/components/chapter/Table.svelte +6 -8
  87. package/dist/components/chapter/Table.svelte.d.ts +5 -17
  88. package/dist/components/chapter/Text.svelte +54 -69
  89. package/dist/components/chapter/Text.svelte.d.ts +6 -18
  90. package/dist/components/controls/DarkToggle.svelte +7 -8
  91. package/dist/components/controls/DarkToggle.svelte.d.ts +6 -18
  92. package/dist/components/editor/BookishEditor.svelte +583 -761
  93. package/dist/components/editor/BookishEditor.svelte.d.ts +14 -26
  94. package/dist/components/editor/CalloutEditor.svelte +3 -3
  95. package/dist/components/editor/CalloutEditor.svelte.d.ts +5 -17
  96. package/dist/components/editor/CaptionedCodeEditor.svelte +5 -5
  97. package/dist/components/editor/CaptionedCodeEditor.svelte.d.ts +5 -17
  98. package/dist/components/editor/CaretView.svelte +23 -25
  99. package/dist/components/editor/CaretView.svelte.d.ts +15 -27
  100. package/dist/components/editor/CitationsEditor.svelte +25 -28
  101. package/dist/components/editor/CitationsEditor.svelte.d.ts +5 -17
  102. package/dist/components/editor/ConfirmButton.svelte +9 -6
  103. package/dist/components/editor/ConfirmButton.svelte.d.ts +8 -21
  104. package/dist/components/editor/DefinitionEditor.svelte +11 -15
  105. package/dist/components/editor/DefinitionEditor.svelte.d.ts +5 -17
  106. package/dist/components/editor/EmbedEditor.svelte +44 -45
  107. package/dist/components/editor/EmbedEditor.svelte.d.ts +5 -17
  108. package/dist/components/editor/Icon.svelte +1 -1
  109. package/dist/components/editor/Icon.svelte.d.ts +5 -17
  110. package/dist/components/editor/ImageChooser.svelte +15 -18
  111. package/dist/components/editor/ImageChooser.svelte.d.ts +6 -18
  112. package/dist/components/editor/ImageThumbnail.svelte +29 -24
  113. package/dist/components/editor/ImageThumbnail.svelte.d.ts +7 -19
  114. package/dist/components/editor/InlineCodeEditor.svelte +3 -3
  115. package/dist/components/editor/InlineCodeEditor.svelte.d.ts +5 -17
  116. package/dist/components/editor/LabelEditor.svelte +5 -6
  117. package/dist/components/editor/LabelEditor.svelte.d.ts +5 -17
  118. package/dist/components/editor/LanguageEditor.svelte +4 -5
  119. package/dist/components/editor/LanguageEditor.svelte.d.ts +6 -18
  120. package/dist/components/editor/LinkEditor.svelte +52 -68
  121. package/dist/components/editor/LinkEditor.svelte.d.ts +5 -17
  122. package/dist/components/editor/Note.svelte +4 -1
  123. package/dist/components/editor/Note.svelte.d.ts +5 -28
  124. package/dist/components/editor/Permissions.svelte +36 -34
  125. package/dist/components/editor/Permissions.svelte.d.ts +9 -21
  126. package/dist/components/editor/PositionEditor.svelte +6 -7
  127. package/dist/components/editor/PositionEditor.svelte.d.ts +6 -18
  128. package/dist/components/editor/QuoteEditor.svelte +3 -3
  129. package/dist/components/editor/QuoteEditor.svelte.d.ts +5 -17
  130. package/dist/components/editor/Switch.svelte +16 -11
  131. package/dist/components/editor/Switch.svelte.d.ts +9 -21
  132. package/dist/components/editor/TableEditor.svelte +3 -3
  133. package/dist/components/editor/TableEditor.svelte.d.ts +5 -17
  134. package/dist/components/editor/TextEditor.svelte +74 -87
  135. package/dist/components/editor/TextEditor.svelte.d.ts +13 -25
  136. package/dist/components/editor/Toggle.svelte +18 -21
  137. package/dist/components/editor/Toggle.svelte.d.ts +7 -20
  138. package/dist/components/editor/Toolbar.svelte +140 -145
  139. package/dist/components/editor/Toolbar.svelte.d.ts +5 -17
  140. package/dist/components/editor/ToolbarGroup.svelte +4 -4
  141. package/dist/components/editor/ToolbarGroup.svelte.d.ts +6 -19
  142. package/dist/components/editor/ToolbarSpacer.svelte +1 -1
  143. package/dist/components/editor/ToolbarSpacer.svelte.d.ts +22 -21
  144. package/dist/components/editor/URLEditor.svelte +3 -5
  145. package/dist/components/editor/URLEditor.svelte.d.ts +7 -19
  146. package/dist/components/page/Acknowledgements.svelte +14 -8
  147. package/dist/components/page/Acknowledgements.svelte.d.ts +3 -16
  148. package/dist/components/page/Analytics.svelte +2 -3
  149. package/dist/components/page/Analytics.svelte.d.ts +6 -17
  150. package/dist/components/page/Authors.svelte +29 -29
  151. package/dist/components/page/Authors.svelte.d.ts +11 -23
  152. package/dist/components/page/BookLoader.svelte +47 -43
  153. package/dist/components/page/BookLoader.svelte.d.ts +5 -17
  154. package/dist/components/page/BulkReferenceEditor.svelte +43 -26
  155. package/dist/components/page/BulkReferenceEditor.svelte.d.ts +3 -16
  156. package/dist/components/page/Chapter.svelte +224 -249
  157. package/dist/components/page/Chapter.svelte.d.ts +6 -18
  158. package/dist/components/page/ChapterContext.d.ts +3 -1
  159. package/dist/components/page/ChapterNumber.svelte +4 -1
  160. package/dist/components/page/ChapterNumber.svelte.d.ts +5 -28
  161. package/dist/components/page/ChapterTitle.svelte +4 -4
  162. package/dist/components/page/ChapterTitle.svelte.d.ts +6 -19
  163. package/dist/components/page/Contexts.js +2 -2
  164. package/dist/components/page/DefinitionView.svelte +51 -44
  165. package/dist/components/page/DefinitionView.svelte.d.ts +6 -18
  166. package/dist/components/page/Description.svelte +10 -4
  167. package/dist/components/page/Description.svelte.d.ts +16 -14
  168. package/dist/components/page/DownloadEPUB.svelte +234 -0
  169. package/dist/components/page/DownloadEPUB.svelte.d.ts +3 -0
  170. package/dist/components/page/EditableHeader.svelte +4 -6
  171. package/dist/components/page/EditableHeader.svelte.d.ts +7 -18
  172. package/dist/components/page/Edition.svelte +57 -71
  173. package/dist/components/page/Edition.svelte.d.ts +7 -20
  174. package/dist/components/page/EditionLoader.svelte +119 -82
  175. package/dist/components/page/EditionLoader.svelte.d.ts +6 -19
  176. package/dist/components/page/Editions.svelte +26 -31
  177. package/dist/components/page/Editions.svelte.d.ts +5 -17
  178. package/dist/components/page/Glossary.svelte +31 -35
  179. package/dist/components/page/Glossary.svelte.d.ts +3 -16
  180. package/dist/components/page/Header.svelte +43 -49
  181. package/dist/components/page/Header.svelte.d.ts +19 -30
  182. package/dist/components/page/Index.svelte +46 -46
  183. package/dist/components/page/Index.svelte.d.ts +3 -16
  184. package/dist/components/page/Instructions.svelte +2 -2
  185. package/dist/components/page/Instructions.svelte.d.ts +6 -19
  186. package/dist/components/page/License.svelte +13 -7
  187. package/dist/components/page/License.svelte.d.ts +16 -14
  188. package/dist/components/page/Loading.svelte +9 -9
  189. package/dist/components/page/Loading.svelte.d.ts +22 -21
  190. package/dist/components/page/Media.svelte +36 -27
  191. package/dist/components/page/Media.svelte.d.ts +3 -16
  192. package/dist/components/page/MediaPreview.svelte +22 -19
  193. package/dist/components/page/MediaPreview.svelte.d.ts +8 -21
  194. package/dist/components/page/Muted.svelte +4 -1
  195. package/dist/components/page/Muted.svelte.d.ts +5 -28
  196. package/dist/components/page/Outline.svelte +75 -97
  197. package/dist/components/page/Outline.svelte.d.ts +8 -20
  198. package/dist/components/page/Page.svelte +23 -33
  199. package/dist/components/page/Page.svelte.d.ts +7 -20
  200. package/dist/components/page/PageHeader.svelte +2 -2
  201. package/dist/components/page/PageHeader.svelte.d.ts +6 -19
  202. package/dist/components/page/PageParagraph.svelte +4 -1
  203. package/dist/components/page/PageParagraph.svelte.d.ts +5 -28
  204. package/dist/components/page/PossibleChapter.svelte +7 -7
  205. package/dist/components/page/PossibleChapter.svelte.d.ts +3 -16
  206. package/dist/components/page/PossibleReference.svelte +4 -5
  207. package/dist/components/page/PossibleReference.svelte.d.ts +6 -18
  208. package/dist/components/page/Print.svelte +11 -12
  209. package/dist/components/page/Print.svelte.d.ts +3 -16
  210. package/dist/components/page/Publish.svelte +47 -47
  211. package/dist/components/page/Publish.svelte.d.ts +3 -16
  212. package/dist/components/page/Reference.svelte +24 -35
  213. package/dist/components/page/Reference.svelte.d.ts +6 -18
  214. package/dist/components/page/References.svelte +21 -22
  215. package/dist/components/page/References.svelte.d.ts +3 -16
  216. package/dist/components/page/Rows.svelte +5 -2
  217. package/dist/components/page/Rows.svelte.d.ts +5 -28
  218. package/dist/components/page/Search.svelte +59 -61
  219. package/dist/components/page/Search.svelte.d.ts +3 -16
  220. package/dist/components/page/Status.svelte +2 -2
  221. package/dist/components/page/Status.svelte.d.ts +16 -14
  222. package/dist/components/page/SubdomainEditor.svelte +11 -11
  223. package/dist/components/page/SubdomainEditor.svelte.d.ts +16 -14
  224. package/dist/components/page/TableOfContents.svelte +157 -124
  225. package/dist/components/page/TableOfContents.svelte.d.ts +3 -16
  226. package/dist/components/page/TableOfContentsImage.svelte +6 -7
  227. package/dist/components/page/TableOfContentsImage.svelte.d.ts +6 -18
  228. package/dist/components/page/TableOfContentsRow.svelte +32 -32
  229. package/dist/components/page/TableOfContentsRow.svelte.d.ts +10 -22
  230. package/dist/components/page/ThemeEditor.svelte +35 -28
  231. package/dist/components/page/ThemeEditor.svelte.d.ts +3 -16
  232. package/dist/components/page/ThemeEditorPreview.svelte +11 -13
  233. package/dist/components/page/ThemeEditorPreview.svelte.d.ts +5 -17
  234. package/dist/components/page/ThemeSetEditor.svelte +4 -6
  235. package/dist/components/page/ThemeSetEditor.svelte.d.ts +7 -19
  236. package/dist/components/page/ThemeVariableEditor.svelte +9 -11
  237. package/dist/components/page/ThemeVariableEditor.svelte.d.ts +7 -19
  238. package/dist/components/page/Title.svelte +4 -1
  239. package/dist/components/page/Title.svelte.d.ts +5 -28
  240. package/dist/components/page/Unknown.svelte +11 -8
  241. package/dist/components/page/Unknown.svelte.d.ts +5 -17
  242. package/dist/epub/build.d.ts +39 -0
  243. package/dist/epub/build.js +143 -0
  244. package/dist/epub/build.test.d.ts +1 -0
  245. package/dist/epub/build.test.js +411 -0
  246. package/dist/epub/images.d.ts +79 -0
  247. package/dist/epub/images.js +260 -0
  248. package/dist/epub/images.test.d.ts +1 -0
  249. package/dist/epub/images.test.js +129 -0
  250. package/dist/epub/package.d.ts +75 -0
  251. package/dist/epub/package.js +392 -0
  252. package/dist/epub/stylesheet.test.d.ts +1 -0
  253. package/dist/epub/stylesheet.test.js +243 -0
  254. package/dist/epub/xhtml.d.ts +69 -0
  255. package/dist/epub/xhtml.js +367 -0
  256. package/dist/epub/xhtml.test.d.ts +1 -0
  257. package/dist/epub/xhtml.test.js +283 -0
  258. package/dist/epub/zip.d.ts +35 -0
  259. package/dist/epub/zip.js +202 -0
  260. package/dist/epub/zip.test.d.ts +1 -0
  261. package/dist/epub/zip.test.js +171 -0
  262. package/dist/index.d.ts +1 -0
  263. package/dist/index.js +1 -0
  264. package/dist/models/Firebase.js +18 -4
  265. package/dist/models/book/Book.js +2 -1
  266. package/dist/models/book/BookMedia.js +1 -2
  267. package/dist/models/book/Chapter.js +3 -2
  268. package/dist/models/book/ChapterID.d.ts +1 -1
  269. package/dist/models/book/Edition.d.ts +1 -1
  270. package/dist/models/book/Edition.js +6 -1
  271. package/dist/models/chapter/BlocksNode.js +3 -1
  272. package/dist/models/chapter/BlocksNode.test.js +5 -1
  273. package/dist/models/chapter/Node.test.js +2 -2
  274. package/dist/models/chapter/TextNode.js +8 -5
  275. package/dist/models/chapter/TextNode.test.js +8 -0
  276. package/package.json +36 -22
@@ -1,20 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { Image } from '../../models/book/BookMedia';
3
- declare const __propDef: {
4
- props: {
5
- select: (image: Image) => void;
6
- selection: string;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type ImageChooserProps = typeof __propDef.props;
16
- export type ImageChooserEvents = typeof __propDef.events;
17
- export type ImageChooserSlots = typeof __propDef.slots;
18
- export default class ImageChooser extends SvelteComponent<ImageChooserProps, ImageChooserEvents, ImageChooserSlots> {
2
+ interface Props {
3
+ select: (image: Image) => void;
4
+ selection: string;
19
5
  }
20
- export {};
6
+ declare const ImageChooser: import("svelte").Component<Props, {}, "">;
7
+ type ImageChooser = ReturnType<typeof ImageChooser>;
8
+ export default ImageChooser;
@@ -1,37 +1,42 @@
1
- <script>export let image;
2
- export let selected;
3
- export let select;
1
+ <script lang="ts">let { image, selected, select } = $props();
4
2
  let retries = 3;
5
- let error = false;
6
- let loading = true;
3
+ let error = $state(false);
4
+ let loading = $state(true);
7
5
  function loadImage(url) {
8
- retries--;
9
- let img = new Image();
10
- img.onerror = () => {
11
- if (retries > 0) {
12
- setTimeout(() => loadImage(url), 1000);
13
- }
14
- else {
15
- loading = false;
16
- error = true;
17
- }
18
- };
19
- img.onload = () => {
20
- loading = false;
21
- };
22
- img.src = url;
6
+ retries--;
7
+ let img = new Image();
8
+ img.onerror = () => {
9
+ if (retries > 0) {
10
+ setTimeout(() => loadImage(url), 1e3);
11
+ } else {
12
+ loading = false;
13
+ error = true;
14
+ }
15
+ };
16
+ img.onload = () => {
17
+ loading = false;
18
+ };
19
+ img.src = url;
23
20
  }
24
- loadImage(image.thumb);
21
+ $effect(() => {
22
+ retries = 3;
23
+ loading = true;
24
+ error = false;
25
+ loadImage(image.thumb);
26
+ });
25
27
  </script>
26
28
 
27
29
  {#if loading}
28
- <div class="thumbnail loading" />
30
+ <div class="thumbnail loading"></div>
29
31
  {:else}
30
32
  <div
31
33
  tabindex="0"
32
34
  role="button"
33
- on:click|stopPropagation={() => select(image)}
34
- on:keydown={(event) =>
35
+ onclick={(event) => {
36
+ event.stopPropagation();
37
+ select(image);
38
+ }}
39
+ onkeydown={(event) =>
35
40
  event.key === 'Enter' || event.key === ' '
36
41
  ? select(image)
37
42
  : undefined}
@@ -1,21 +1,9 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { Image } from '../../models/book/BookMedia';
3
- declare const __propDef: {
4
- props: {
5
- image: Image;
6
- selected: boolean;
7
- select: (image: Image) => void;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
13
- exports?: {} | undefined;
14
- bindings?: string | undefined;
15
- };
16
- export type ImageThumbnailProps = typeof __propDef.props;
17
- export type ImageThumbnailEvents = typeof __propDef.events;
18
- export type ImageThumbnailSlots = typeof __propDef.slots;
19
- export default class ImageThumbnail extends SvelteComponent<ImageThumbnailProps, ImageThumbnailEvents, ImageThumbnailSlots> {
2
+ interface Props {
3
+ image: Image;
4
+ selected: boolean;
5
+ select: (image: Image) => void;
20
6
  }
21
- export {};
7
+ declare const ImageThumbnail: import("svelte").Component<Props, {}, "">;
8
+ type ImageThumbnail = ReturnType<typeof ImageThumbnail>;
9
+ export default ImageThumbnail;
@@ -1,6 +1,6 @@
1
- <script>import LanguageEditor from './LanguageEditor.svelte';
2
- import { getCaret } from '../page/Contexts';
3
- export let code;
1
+ <script lang="ts">import LanguageEditor from "./LanguageEditor.svelte";
2
+ import { getCaret } from "../page/Contexts";
3
+ let { code } = $props();
4
4
  let caret = getCaret();
5
5
  </script>
6
6
 
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type InlineCodeNode from '../../models/chapter/InlineCodeNode';
3
- declare const __propDef: {
4
- props: {
5
- code: InlineCodeNode;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type InlineCodeEditorProps = typeof __propDef.props;
15
- export type InlineCodeEditorEvents = typeof __propDef.events;
16
- export type InlineCodeEditorSlots = typeof __propDef.slots;
17
- export default class InlineCodeEditor extends SvelteComponent<InlineCodeEditorProps, InlineCodeEditorEvents, InlineCodeEditorSlots> {
2
+ interface Props {
3
+ code: InlineCodeNode;
18
4
  }
19
- export {};
5
+ declare const InlineCodeEditor: import("svelte").Component<Props, {}, "">;
6
+ type InlineCodeEditor = ReturnType<typeof InlineCodeEditor>;
7
+ export default InlineCodeEditor;
@@ -1,12 +1,11 @@
1
- <script>import TextEditor from './TextEditor.svelte';
2
- import { getChapter, getEdition } from '../page/Contexts';
3
- import { getCaret } from '../page/Contexts';
4
- export let label;
1
+ <script lang="ts">import TextEditor from "./TextEditor.svelte";
2
+ import { getChapter, getEdition } from "../page/Contexts";
3
+ import { getCaret } from "../page/Contexts";
4
+ let { label } = $props();
5
5
  let edition = getEdition();
6
6
  let chapter = getChapter();
7
7
  let caret = getCaret();
8
- $: ast =
9
- $edition && $chapter ? $chapter.chapter.getAST($edition) : undefined;
8
+ let ast = $derived($edition && $chapter ? $chapter.chapter.getAST($edition) : void 0);
10
9
  </script>
11
10
 
12
11
  <code>
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type LabelNode from '../../models/chapter/LabelNode';
3
- declare const __propDef: {
4
- props: {
5
- label: LabelNode;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type LabelEditorProps = typeof __propDef.props;
15
- export type LabelEditorEvents = typeof __propDef.events;
16
- export type LabelEditorSlots = typeof __propDef.slots;
17
- export default class LabelEditor extends SvelteComponent<LabelEditorProps, LabelEditorEvents, LabelEditorSlots> {
2
+ interface Props {
3
+ label: LabelNode;
18
4
  }
19
- export {};
5
+ declare const LabelEditor: import("svelte").Component<Props, {}, "">;
6
+ type LabelEditor = ReturnType<typeof LabelEditor>;
7
+ export default LabelEditor;
@@ -1,8 +1,7 @@
1
- <script>import Options from '../app/Options.svelte';
2
- import Note from './Note.svelte';
3
- export let language;
4
- export let edit;
5
- const languages = ['', 'html', 'css', 'javascript', 'python', 'java'];
1
+ <script lang="ts">import Options from "../app/Options.svelte";
2
+ import Note from "./Note.svelte";
3
+ let { language, edit } = $props();
4
+ const languages = ["", "html", "css", "javascript", "python", "java"];
6
5
  </script>
7
6
 
8
7
  <Options
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- language: string;
5
- edit: (newValue: string) => void;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type LanguageEditorProps = typeof __propDef.props;
15
- export type LanguageEditorEvents = typeof __propDef.events;
16
- export type LanguageEditorSlots = typeof __propDef.slots;
17
- export default class LanguageEditor extends SvelteComponent<LanguageEditorProps, LanguageEditorEvents, LanguageEditorSlots> {
1
+ interface Props {
2
+ language: string;
3
+ edit: (newValue: string) => void;
18
4
  }
19
- export {};
5
+ declare const LanguageEditor: import("svelte").Component<Props, {}, "">;
6
+ type LanguageEditor = ReturnType<typeof LanguageEditor>;
7
+ export default LanguageEditor;
@@ -1,82 +1,66 @@
1
- <script>import URLEditor from './URLEditor.svelte';
2
- import { getChapter, getEdition, getRoot } from '../page/Contexts';
3
- import Icon from './Icon.svelte';
4
- import Button from '../app/Button.svelte';
5
- import UnlinkIcon from './icons/unlink.svg?raw';
6
- import Options from '../app/Options.svelte';
7
- import { getCaret } from '../page/Contexts';
8
- export let link;
1
+ <script lang="ts">import URLEditor from "./URLEditor.svelte";
2
+ import { getChapter, getEdition, getRoot } from "../page/Contexts";
3
+ import Icon from "./Icon.svelte";
4
+ import Button from "../app/Button.svelte";
5
+ import UnlinkIcon from "./icons/unlink.svg?raw";
6
+ import Options from "../app/Options.svelte";
7
+ import { getCaret } from "../page/Contexts";
8
+ let { link } = $props();
9
9
  let caret = getCaret();
10
10
  let edition = getEdition();
11
11
  let chapter = getChapter();
12
12
  let root = getRoot();
13
- $: url = link.getMeta();
13
+ let url = $derived(link.getMeta());
14
14
  function saveEdit(value) {
15
- $caret?.edit(link, link.withMeta(value));
15
+ $caret?.edit(link, link.withMeta(value));
16
16
  }
17
- function isValidURL(url) {
18
- // Is it a valid URL?
19
- try {
20
- let test = new URL(url);
21
- if (test.protocol === 'http:' || test.protocol === 'https:')
22
- return true;
23
- }
24
- catch (_) { }
25
- return false;
17
+ function isValidURL(url2) {
18
+ try {
19
+ let test = new URL(url2);
20
+ if (test.protocol === "http:" || test.protocol === "https:")
21
+ return true;
22
+ } catch (_) {
23
+ }
24
+ return false;
26
25
  }
27
26
  function validate(urlOrChapter) {
28
- if (urlOrChapter.length === 0)
29
- return "link URL can't be empty";
30
- if ($edition === undefined)
31
- return;
32
- if (isValidURL(urlOrChapter))
33
- return;
34
- // If not, is it a valid chapterID?
35
- if ($edition.hasChapter(urlOrChapter))
36
- return;
37
- // If not, is it a valid chapterID:label?
38
- const [chapterID, labelID] = urlOrChapter.split(':');
39
- if (chapterID === undefined || labelID === undefined)
40
- return;
41
- // The chapter ID is optional; if it's missing, it refers to this chapter.
42
- const correspondingChapter = chapterID === ''
43
- ? $root
44
- : $edition?.getChapter(chapterID)?.getAST($edition);
45
- if (correspondingChapter === undefined)
46
- return 'Not a valid URL or chapter.';
47
- if (!correspondingChapter.hasLabel(labelID))
48
- return 'Not a valid chapter label.';
27
+ if (urlOrChapter.length === 0) return "link URL can't be empty";
28
+ if ($edition === void 0) return;
29
+ if (isValidURL(urlOrChapter)) return;
30
+ if ($edition.hasChapter(urlOrChapter)) return;
31
+ const [chapterID, labelID] = urlOrChapter.split(":");
32
+ if (chapterID === void 0 || labelID === void 0) return;
33
+ const correspondingChapter = chapterID === "" ? $root : $edition?.getChapter(chapterID)?.getAST($edition);
34
+ if (correspondingChapter === void 0)
35
+ return "Not a valid URL or chapter.";
36
+ if (!correspondingChapter.hasLabel(labelID))
37
+ return "Not a valid chapter label.";
49
38
  }
50
- let options = [];
51
- $: {
52
- options = [];
53
- // Add an empty option.
54
- options.push(['External link', url.startsWith('http') ? url : '']);
55
- // Add an option for each chapter and it's labels.
56
- if ($edition) {
57
- for (const chap of $edition?.getChapters() ?? []) {
58
- // Include the chapter itself
59
- options.push([`Chapter: ${chap.getTitle()}`, chap.getID()]);
60
- const root = chap.getAST($edition);
61
- if (root) {
62
- // Include the chapter's headers
63
- const headers = root.getHeaders();
64
- for (let number = 0; number < headers.length; number++) {
65
- options.push([
66
- chap.getTitle() + ': ' + headers[number].toText(),
67
- `${chap.getID()}#header-${number}`,
68
- ]);
69
- }
70
- // Include all of the labels in the chapter
71
- for (const label of root.getLabels())
72
- options.push([
73
- chap.getTitle() + ': ' + label.getMeta(),
74
- `${chap.getID()}:${label.getMeta()}`,
75
- ]);
76
- }
39
+ let options = $derived.by(() => {
40
+ const list = [];
41
+ list.push(["External link", url.startsWith("http") ? url : ""]);
42
+ if ($edition) {
43
+ for (const chap of $edition?.getChapters() ?? []) {
44
+ list.push([`Chapter: ${chap.getTitle()}`, chap.getID()]);
45
+ const root2 = chap.getAST($edition);
46
+ if (root2) {
47
+ const headers = root2.getHeaders();
48
+ for (let number = 0; number < headers.length; number++) {
49
+ list.push([
50
+ chap.getTitle() + ": " + headers[number].toText(),
51
+ `${chap.getID()}#header-${number}`
52
+ ]);
77
53
  }
54
+ for (const label of root2.getLabels())
55
+ list.push([
56
+ chap.getTitle() + ": " + label.getMeta(),
57
+ `${chap.getID()}:${label.getMeta()}`
58
+ ]);
59
+ }
78
60
  }
79
- }
61
+ }
62
+ return list;
63
+ });
80
64
  </script>
81
65
 
82
66
  <span>
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type LinkNode from '../../models/chapter/LinkNode';
3
- declare const __propDef: {
4
- props: {
5
- link: LinkNode;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type LinkEditorProps = typeof __propDef.props;
15
- export type LinkEditorEvents = typeof __propDef.events;
16
- export type LinkEditorSlots = typeof __propDef.slots;
17
- export default class LinkEditor extends SvelteComponent<LinkEditorProps, LinkEditorEvents, LinkEditorSlots> {
2
+ interface Props {
3
+ link: LinkNode;
18
4
  }
19
- export {};
5
+ declare const LinkEditor: import("svelte").Component<Props, {}, "">;
6
+ type LinkEditor = ReturnType<typeof LinkEditor>;
7
+ export default LinkEditor;
@@ -1,4 +1,7 @@
1
- <span><slot /></span>
1
+ <script lang="ts">let { children } = $props();
2
+ </script>
3
+
4
+ <span>{@render children?.()}</span>
2
5
 
3
6
  <style>
4
7
  span {
@@ -1,29 +1,6 @@
1
- /** @typedef {typeof __propDef.props} NoteProps */
2
- /** @typedef {typeof __propDef.events} NoteEvents */
3
- /** @typedef {typeof __propDef.slots} NoteSlots */
4
- export default class Note extends SvelteComponent<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
1
+ interface Props {
2
+ children?: import('svelte').Snippet;
11
3
  }
12
- export type NoteProps = typeof __propDef.props;
13
- export type NoteEvents = typeof __propDef.events;
14
- export type NoteSlots = typeof __propDef.slots;
15
- import { SvelteComponent } 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
- exports?: undefined;
27
- bindings?: undefined;
28
- };
29
- export {};
4
+ declare const Note: import("svelte").Component<Props, {}, "">;
5
+ type Note = ReturnType<typeof Note>;
6
+ export default Note;
@@ -1,40 +1,39 @@
1
- <script>import { createUser } from '../../models/CRUD';
2
- import Button from '../app/Button.svelte';
3
- import TextInput from '../app/TextInput.svelte';
4
- import { getEditors } from '../page/Contexts';
5
- import Note from './Note.svelte';
6
- export let uids;
7
- export let inheriteduids;
8
- export let writable;
9
- export let atleastone;
10
- export let change;
1
+ <script lang="ts">import { createUser } from "../../models/CRUD";
2
+ import Button from "../app/Button.svelte";
3
+ import TextInput from "../app/TextInput.svelte";
4
+ import { getEditors } from "../page/Contexts";
5
+ import Note from "./Note.svelte";
6
+ let {
7
+ uids,
8
+ inheriteduids,
9
+ writable,
10
+ atleastone,
11
+ change
12
+ } = $props();
11
13
  let emails = getEditors();
12
- let newEditor = '';
13
- let newEditorError = null;
14
- let loading = undefined;
14
+ let newEditor = $state("");
15
+ let newEditorError = $state(null);
16
+ let loading = $state(void 0);
15
17
  async function addEditor() {
16
- const email = newEditor;
17
- newEditor = '';
18
- loading = email;
19
- try {
20
- const uid = await createUser(email);
21
- if (uid === null)
22
- newEditorError = "couldn't add editor";
23
- else
24
- change([...uids, uid]);
25
- }
26
- finally {
27
- loading = undefined;
28
- }
18
+ const email = newEditor;
19
+ newEditor = "";
20
+ loading = email;
21
+ try {
22
+ const uid = await createUser(email);
23
+ if (uid === null) newEditorError = "couldn't add editor";
24
+ else change([...uids, uid]);
25
+ } finally {
26
+ loading = void 0;
27
+ }
29
28
  }
30
29
  function hasEditor(email) {
31
- if (email.length === 0)
32
- return false;
33
- const match = Array.from($emails.entries()).find(([, e]) => e === email);
34
- if (match === undefined)
35
- return false;
36
- const uid = match[0];
37
- return uids.includes(uid) || inheriteduids.includes(uid);
30
+ if (email.length === 0) return false;
31
+ const match = Array.from($emails.entries()).find(
32
+ ([, e]) => e === email
33
+ );
34
+ if (match === void 0) return false;
35
+ const uid = match[0];
36
+ return uids.includes(uid) || inheriteduids.includes(uid);
38
37
  }
39
38
  </script>
40
39
 
@@ -43,7 +42,10 @@ function hasEditor(email) {
43
42
  {:else}
44
43
  <section class="emails">
45
44
  {#if writable}
46
- <form on:submit|preventDefault={addEditor}>
45
+ <form onsubmit={(event) => {
46
+ event.preventDefault();
47
+ addEditor();
48
+ }}>
47
49
  <TextInput
48
50
  type="email"
49
51
  placeholder="email"
@@ -1,22 +1,10 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- uids: string[];
5
- inheriteduids: string[];
6
- writable: boolean;
7
- atleastone: boolean;
8
- change: (uids: string[]) => void;
9
- };
10
- events: {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {};
14
- exports?: {} | undefined;
15
- bindings?: string | undefined;
16
- };
17
- export type PermissionsProps = typeof __propDef.props;
18
- export type PermissionsEvents = typeof __propDef.events;
19
- export type PermissionsSlots = typeof __propDef.slots;
20
- export default class Permissions extends SvelteComponent<PermissionsProps, PermissionsEvents, PermissionsSlots> {
1
+ interface Props {
2
+ uids: string[];
3
+ inheriteduids: string[];
4
+ writable: boolean;
5
+ atleastone: boolean;
6
+ change: (uids: string[]) => void;
21
7
  }
22
- export {};
8
+ declare const Permissions: import("svelte").Component<Props, {}, "">;
9
+ type Permissions = ReturnType<typeof Permissions>;
10
+ export default Permissions;
@@ -1,11 +1,10 @@
1
- <script>import Switch from './Switch.svelte';
2
- import LeftIcon from './icons/left.svg?raw';
3
- import MiddleIcon from './icons/middle.svg?raw';
4
- import RightIcon from './icons/right.svg?raw';
5
- export let value;
6
- export let edit;
1
+ <script lang="ts">import Switch from "./Switch.svelte";
2
+ import LeftIcon from "./icons/left.svg?raw";
3
+ import MiddleIcon from "./icons/middle.svg?raw";
4
+ import RightIcon from "./icons/right.svg?raw";
5
+ let { value, edit } = $props();
7
6
  function editAsString(newValue) {
8
- edit(newValue);
7
+ edit(newValue);
9
8
  }
10
9
  </script>
11
10
 
@@ -1,20 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type Position from '../../models/chapter/Position';
3
- declare const __propDef: {
4
- props: {
5
- value: string;
6
- edit: (newValue: Position) => void;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type PositionEditorProps = typeof __propDef.props;
16
- export type PositionEditorEvents = typeof __propDef.events;
17
- export type PositionEditorSlots = typeof __propDef.slots;
18
- export default class PositionEditor extends SvelteComponent<PositionEditorProps, PositionEditorEvents, PositionEditorSlots> {
2
+ interface Props {
3
+ value: string;
4
+ edit: (newValue: Position) => void;
19
5
  }
20
- export {};
6
+ declare const PositionEditor: import("svelte").Component<Props, {}, "">;
7
+ type PositionEditor = ReturnType<typeof PositionEditor>;
8
+ export default PositionEditor;
@@ -1,6 +1,6 @@
1
- <script>import { getCaret } from '../page/Contexts';
2
- import PositionEditor from './PositionEditor.svelte';
3
- export let quote;
1
+ <script lang="ts">import { getCaret } from "../page/Contexts";
2
+ import PositionEditor from "./PositionEditor.svelte";
3
+ let { quote } = $props();
4
4
  let caret = getCaret();
5
5
  </script>
6
6