paginar 0.3.0 → 0.3.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 (55) hide show
  1. package/.editorconfig +13 -13
  2. package/.env +1 -1
  3. package/.vscode/extensions.json +3 -3
  4. package/LICENSE.md +21 -21
  5. package/README.md +244 -244
  6. package/demo/slot/slot-chapter1.html +384 -384
  7. package/demo/slot/slot-chapter2.html +366 -366
  8. package/demo/slot/slot-chapter3.html +265 -265
  9. package/demo/summary/_content/1chapter.html +100 -100
  10. package/demo/summary/_content/2chapter.html +311 -311
  11. package/demo/summary/_content/3chapter.html +211 -211
  12. package/demo/summary/index.html +134 -134
  13. package/dist/index.es.js +849 -840
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/style.css +9 -9
  16. package/index.html +18 -18
  17. package/package.json +1 -1
  18. package/src/App.ce.vue +148 -148
  19. package/src/assets/main.css +392 -392
  20. package/src/components/BookContent.vue +23 -23
  21. package/src/components/FooterSlot.vue +32 -32
  22. package/src/components/FootnotesAside.vue +123 -123
  23. package/src/components/HeaderSlot/HeaderSlot.vue +30 -30
  24. package/src/components/HeaderSlot/OptionsButton/OptionsButton.vue +67 -67
  25. package/src/components/HeaderSlot/OptionsButton/OptionsColor.vue +28 -28
  26. package/src/components/HeaderSlot/OptionsButton/OptionsColumns.vue +51 -51
  27. package/src/components/HeaderSlot/OptionsButton/OptionsDropdown.vue +59 -59
  28. package/src/components/HeaderSlot/OptionsButton/OptionsFontFamily.vue +17 -17
  29. package/src/components/HeaderSlot/OptionsButton/OptionsFontSize.vue +17 -17
  30. package/src/components/HeaderSlot/SummaryButton/SummaryButton.vue +70 -70
  31. package/src/components/HeaderSlot/SummaryButton/SummaryDropdown.vue +6 -6
  32. package/src/components/ReaderWrapper.vue +37 -37
  33. package/src/components/ReferencePopup.vue +36 -36
  34. package/src/components/icons/Close.vue +6 -6
  35. package/src/components/icons/DoubleColumn.vue +15 -15
  36. package/src/components/icons/Expand.vue +7 -7
  37. package/src/components/icons/Eye.vue +9 -9
  38. package/src/components/icons/Footnote.vue +5 -5
  39. package/src/components/icons/Home.vue +6 -6
  40. package/src/components/icons/Moon.vue +5 -5
  41. package/src/components/icons/Notes.vue +5 -5
  42. package/src/components/icons/SingleColumn.vue +3 -3
  43. package/src/components/icons/Summary.vue +10 -10
  44. package/src/components/icons/Sun.vue +5 -5
  45. package/src/components/icons/ThreeDots.vue +8 -8
  46. package/src/composables/useBrowser.js +16 -16
  47. package/src/composables/useFootnotes.js +50 -50
  48. package/src/composables/usePagination.js +125 -125
  49. package/src/composables/useReaderSettings.js +174 -174
  50. package/src/composables/useReferences.js +67 -67
  51. package/src/composables/useStyles.js +60 -60
  52. package/src/composables/useTextContent.js +113 -113
  53. package/src/main.js +19 -19
  54. package/tailwind.config.js +16 -16
  55. package/vite.config.js +36 -36
@@ -1,51 +1,51 @@
1
- <script setup>
2
- import { computed } from 'vue'
3
- import { useWindowSize } from '@vueuse/core'
4
-
5
- import SingleColumn from '../../icons/SingleColumn.vue'
6
- import DoubleColumn from '../../icons/DoubleColumn.vue'
7
-
8
- import useReaderSettings from '../../../composables/useReaderSettings'
9
- const { columns, setColumns } = useReaderSettings
10
- const { width } = useWindowSize()
11
-
12
- const isSafari = computed(() => {
13
- const ua = navigator.userAgent.toLowerCase()
14
- return ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1
15
- })
16
-
17
- </script>
18
-
19
- <template>
20
- <div id="columns-menu" class="w-full hidden md:grid grid-cols-3 gap-2 mt-3">
21
- <button
22
- id="single-column-button"
23
- class="col-span-1 text-primary text-center cursor-pointer py-3 rounded-sm border"
24
- :class="{
25
- 'border-gray-300': columns !== 'single',
26
- 'bg-primary-extralight border-2 border-primary': columns === 'single',
27
- 'opacity-30 cursor-default': isSafari
28
- }"
29
- @click.prevent="!isSafari ? setColumns('single') : null"
30
- aria-label="Coluna única"
31
- :title="isSafari ? 'O navegador Safari não aceita visualização de coluna única.' : 'Coluna única'"
32
- >
33
- <SingleColumn class="mx-auto h-10 opacity-75" />
34
- </button>
35
-
36
- <button
37
- id="double-column-button"
38
- class="col-span-2 text-primary text-center cursor-pointer py-3 rounded-sm border"
39
- :class="{
40
- 'border-gray-300': columns !== 'double',
41
- 'bg-primary-extralight border-2 border-primary': columns === 'double',
42
- 'opacity-30': width < 1024
43
- }"
44
- @click.prevent="width >= 1024 && setColumns('double')"
45
- aria-label="Coluna dupla"
46
- title="Coluna dupla"
47
- >
48
- <DoubleColumn name="DoubleColumn" class="mx-auto h-10 divide-opacity-75" />
49
- </button>
50
- </div>
51
- </template>
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import { useWindowSize } from '@vueuse/core'
4
+
5
+ import SingleColumn from '../../icons/SingleColumn.vue'
6
+ import DoubleColumn from '../../icons/DoubleColumn.vue'
7
+
8
+ import useReaderSettings from '../../../composables/useReaderSettings'
9
+ const { columns, setColumns } = useReaderSettings
10
+ const { width } = useWindowSize()
11
+
12
+ const isSafari = computed(() => {
13
+ const ua = navigator.userAgent.toLowerCase()
14
+ return ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1
15
+ })
16
+
17
+ </script>
18
+
19
+ <template>
20
+ <div id="columns-menu" class="w-full hidden md:grid grid-cols-3 gap-2 mt-3">
21
+ <button
22
+ id="single-column-button"
23
+ class="col-span-1 text-primary text-center cursor-pointer py-3 rounded-sm border"
24
+ :class="{
25
+ 'border-gray-300': columns !== 'single',
26
+ 'bg-primary-extralight border-2 border-primary': columns === 'single',
27
+ 'opacity-30 cursor-default': isSafari
28
+ }"
29
+ @click.prevent="!isSafari ? setColumns('single') : null"
30
+ aria-label="Coluna única"
31
+ :title="isSafari ? 'O navegador Safari não aceita visualização de coluna única.' : 'Coluna única'"
32
+ >
33
+ <SingleColumn class="mx-auto h-10 opacity-75" />
34
+ </button>
35
+
36
+ <button
37
+ id="double-column-button"
38
+ class="col-span-2 text-primary text-center cursor-pointer py-3 rounded-sm border"
39
+ :class="{
40
+ 'border-gray-300': columns !== 'double',
41
+ 'bg-primary-extralight border-2 border-primary': columns === 'double',
42
+ 'opacity-30': width < 1024
43
+ }"
44
+ @click.prevent="width >= 1024 && setColumns('double')"
45
+ aria-label="Coluna dupla"
46
+ title="Coluna dupla"
47
+ >
48
+ <DoubleColumn name="DoubleColumn" class="mx-auto h-10 divide-opacity-75" />
49
+ </button>
50
+ </div>
51
+ </template>
@@ -1,59 +1,59 @@
1
- <script setup>
2
- import IconEye from '../../icons/Eye.vue'
3
- import IconFootnote from '../../icons/Footnote.vue'
4
-
5
- import OptionsColumns from './OptionsColumns.vue';
6
- import OptionsFontFamily from './OptionsFontFamily.vue';
7
- import OptionsFontSize from './OptionsFontSize.vue';
8
- import OptionsColor from './OptionsColor.vue'
9
-
10
- import useFootnotes from '../../../composables/useFootnotes'
11
-
12
- </script>
13
-
14
- <template>
15
- <div class="absolute top-14 py-4 px-3 shadow-lg w-60 md:w-104
16
- text-areia -right-2 md:right-16 z-10 bg-white
17
- "
18
- role="Opções"
19
- aria-orientation="vertical"
20
- aria-labelledby="options-menu"
21
- >
22
- <div>
23
-
24
- <slot name="optionsTop" />
25
-
26
- <div id="footnotes-button">
27
- <button @click.prevent="useFootnotes.setShowFootnotes(true)"
28
- class="w-full flex justify-center items-center py-3 lowercase"
29
- >
30
- <IconFootnote class="w-6 h-6" />
31
- <span class="ml-4">Notas de rodapé</span>
32
- </button>
33
-
34
- <div class="w-full border-b border-areia my-3"></div>
35
- </div>
36
-
37
-
38
- <div class="w-full flex justify-center items-center py-3 lowercase"
39
- id="visualize-title"
40
- >
41
- <IconEye class="w-6 h-6" />
42
- <span class="ml-4">Visualização</span>
43
- </div>
44
-
45
- <OptionsColumns />
46
- <OptionsFontFamily />
47
-
48
- <div class="w-full grid grid-cols-4 gap-2 my-3">
49
-
50
- <OptionsFontSize />
51
- <OptionsColor />
52
- </div>
53
-
54
- <div class="hidden w-full border-b border-areia my-8"></div>
55
-
56
- <slot name="optionsBottom" />
57
- </div>
58
- </div>
59
- </template>
1
+ <script setup>
2
+ import IconEye from '../../icons/Eye.vue'
3
+ import IconFootnote from '../../icons/Footnote.vue'
4
+
5
+ import OptionsColumns from './OptionsColumns.vue';
6
+ import OptionsFontFamily from './OptionsFontFamily.vue';
7
+ import OptionsFontSize from './OptionsFontSize.vue';
8
+ import OptionsColor from './OptionsColor.vue'
9
+
10
+ import useFootnotes from '../../../composables/useFootnotes'
11
+
12
+ </script>
13
+
14
+ <template>
15
+ <div class="absolute top-14 py-4 px-3 shadow-lg w-60 md:w-104
16
+ text-areia -right-2 md:right-16 z-10 bg-white
17
+ "
18
+ role="Opções"
19
+ aria-orientation="vertical"
20
+ aria-labelledby="options-menu"
21
+ >
22
+ <div>
23
+
24
+ <slot name="optionsTop" />
25
+
26
+ <div id="footnotes-button">
27
+ <button @click.prevent="useFootnotes.setShowFootnotes(true)"
28
+ class="w-full flex justify-center items-center py-3 lowercase"
29
+ >
30
+ <IconFootnote class="w-6 h-6" />
31
+ <span class="ml-4">Notas de rodapé</span>
32
+ </button>
33
+
34
+ <div class="w-full border-b border-areia my-3"></div>
35
+ </div>
36
+
37
+
38
+ <div class="w-full flex justify-center items-center py-3 lowercase"
39
+ id="visualize-title"
40
+ >
41
+ <IconEye class="w-6 h-6" />
42
+ <span class="ml-4">Visualização</span>
43
+ </div>
44
+
45
+ <OptionsColumns />
46
+ <OptionsFontFamily />
47
+
48
+ <div class="w-full grid grid-cols-4 gap-2 my-3">
49
+
50
+ <OptionsFontSize />
51
+ <OptionsColor />
52
+ </div>
53
+
54
+ <div class="hidden w-full border-b border-areia my-8"></div>
55
+
56
+ <slot name="optionsBottom" />
57
+ </div>
58
+ </div>
59
+ </template>
@@ -1,17 +1,17 @@
1
- <script setup>
2
- import useReaderSettings from '../../../composables/useReaderSettings'
3
- const { textFont, fontsOptions, setTextFont } = useReaderSettings
4
-
5
- </script>
6
-
7
- <template>
8
- <div id="font-family-menu" class="w-full grid grid-cols-4 gap-2 my-3">
9
- <button v-for="font in fontsOptions" :key="font.name" @click.prevent="setTextFont(font.name)"
10
- class="font-light text-lg text-primary tracking-wide border border-urucum w-full h-10 flex justify-center items-center"
11
- :class="{
12
- 'bg-primary-extralight border-2 border-primary': textFont === font.name
13
- }" :style="`font-family: ${font.name}`" :title="font.label ?? font.name">
14
- Ff
15
- </button>
16
- </div>
17
- </template>
1
+ <script setup>
2
+ import useReaderSettings from '../../../composables/useReaderSettings'
3
+ const { textFont, fontsOptions, setTextFont } = useReaderSettings
4
+
5
+ </script>
6
+
7
+ <template>
8
+ <div id="font-family-menu" class="w-full grid grid-cols-4 gap-2 my-3">
9
+ <button v-for="font in fontsOptions" :key="font.name" @click.prevent="setTextFont(font.name)"
10
+ class="font-light text-lg text-primary tracking-wide border border-urucum w-full h-10 flex justify-center items-center"
11
+ :class="{
12
+ 'bg-primary-extralight border-2 border-primary': textFont === font.name
13
+ }" :style="`font-family: ${font.name}`" :title="font.label ?? font.name">
14
+ Ff
15
+ </button>
16
+ </div>
17
+ </template>
@@ -1,17 +1,17 @@
1
- <script setup>
2
- import useReaderSettings from '../../../composables/useReaderSettings'
3
- const { fontSize, setFontSize } = useReaderSettings
4
-
5
- </script>
6
-
7
- <template>
8
- <button id="fontsize-add-button" @click.prevent="setFontSize(fontSize + 1)"
9
- class="font-light text-base border border-urucum w-full h-10 flex justify-center items-center">
10
- + A
11
- </button>
12
-
13
- <button id="fontsize-subtr-button" @click.prevent="setFontSize(fontSize - 1)"
14
- class="font-light text-base border border-urucum w-full h-10 flex justify-center items-center">
15
- - A
16
- </button>
17
- </template>
1
+ <script setup>
2
+ import useReaderSettings from '../../../composables/useReaderSettings'
3
+ const { fontSize, setFontSize } = useReaderSettings
4
+
5
+ </script>
6
+
7
+ <template>
8
+ <button id="fontsize-add-button" @click.prevent="setFontSize(fontSize + 1)"
9
+ class="font-light text-base border border-urucum w-full h-10 flex justify-center items-center">
10
+ + A
11
+ </button>
12
+
13
+ <button id="fontsize-subtr-button" @click.prevent="setFontSize(fontSize - 1)"
14
+ class="font-light text-base border border-urucum w-full h-10 flex justify-center items-center">
15
+ - A
16
+ </button>
17
+ </template>
@@ -1,70 +1,70 @@
1
- <script setup>
2
- import { ref } from 'vue'
3
- import { onClickOutside, onKeyStroke } from '@vueuse/core'
4
-
5
- import useReaderSettings from '../../../composables/useReaderSettings'
6
-
7
- import IconHome from '../../icons/Home.vue'
8
- import IconClose from '../../icons/Close.vue'
9
- import IconSummary from '../../icons/Summary.vue'
10
- import SummaryDropdown from './SummaryDropdown.vue'
11
-
12
- const show = ref(false)
13
- const button = ref(null)
14
-
15
- const { homeUrl } = useReaderSettings
16
-
17
- const toggleSummary = () => show.value = !show.value
18
- const hide = () => {
19
- if (!useReaderSettings.blocked.value) {
20
- show.value = false
21
- }
22
- }
23
-
24
- onClickOutside(button, () => hide())
25
- onKeyStroke('Escape', () => hide())
26
- </script>
27
-
28
- <template>
29
- <div id="summary-menu" ref="button" class="relative">
30
- <div class="flex">
31
- <a v-if="homeUrl"
32
- :href="homeUrl" title="Homepage" id="home-button"
33
- class="hidden md:flex items-center border p-3 shadow mr-3
34
- border-white text-white"
35
- >
36
- <IconHome class="w-6 h-6"/>
37
- </a>
38
-
39
- <div class="position-relative">
40
- <button
41
- @click.prevent="toggleSummary()"
42
- class="border p-3 shadow flex items-center border-white text-white"
43
- id="summary-button" aria-haspopup="true" :aria-expanded="show"
44
- >
45
- <IconSummary v-if="!show" />
46
- <IconClose v-else class="w-6 h-6" />
47
-
48
- <span class="block ml-3">
49
- Sumário
50
- </span>
51
- </button>
52
-
53
- <transition enter-active-class="transition ease-out duration-100 transform" enter-class="opacity-0 scale-95"
54
- enter-to-class="opacity-100 scale-100" leave-active-class="transition ease-in duration-75 transform"
55
- leave-class="opacity-100 scale-100" leave-to-class="opacity-0 scale-95"
56
- >
57
- <SummaryDropdown v-if="show">
58
- <template #summaryTop>
59
- <slot name="summaryTop"/>
60
- </template>
61
-
62
- <template #summaryBottom>
63
- <slot name="summaryBottom"/>
64
- </template>
65
- </SummaryDropdown>
66
- </transition>
67
- </div>
68
- </div>
69
- </div>
70
- </template>
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import { onClickOutside, onKeyStroke } from '@vueuse/core'
4
+
5
+ import useReaderSettings from '../../../composables/useReaderSettings'
6
+
7
+ import IconHome from '../../icons/Home.vue'
8
+ import IconClose from '../../icons/Close.vue'
9
+ import IconSummary from '../../icons/Summary.vue'
10
+ import SummaryDropdown from './SummaryDropdown.vue'
11
+
12
+ const show = ref(false)
13
+ const button = ref(null)
14
+
15
+ const { homeUrl } = useReaderSettings
16
+
17
+ const toggleSummary = () => show.value = !show.value
18
+ const hide = () => {
19
+ if (!useReaderSettings.blocked.value) {
20
+ show.value = false
21
+ }
22
+ }
23
+
24
+ onClickOutside(button, () => hide())
25
+ onKeyStroke('Escape', () => hide())
26
+ </script>
27
+
28
+ <template>
29
+ <div id="summary-menu" ref="button" class="relative">
30
+ <div class="flex">
31
+ <a v-if="homeUrl"
32
+ :href="homeUrl" title="Homepage" id="home-button"
33
+ class="hidden md:flex items-center border p-3 shadow mr-3
34
+ border-white text-white"
35
+ >
36
+ <IconHome class="w-6 h-6"/>
37
+ </a>
38
+
39
+ <div class="position-relative">
40
+ <button
41
+ @click.prevent="toggleSummary()"
42
+ class="border p-3 shadow flex items-center border-white text-white"
43
+ id="summary-button" aria-haspopup="true" :aria-expanded="show"
44
+ >
45
+ <IconSummary v-if="!show" />
46
+ <IconClose v-else class="w-6 h-6" />
47
+
48
+ <span class="block ml-3">
49
+ Sumário
50
+ </span>
51
+ </button>
52
+
53
+ <transition enter-active-class="transition ease-out duration-100 transform" enter-class="opacity-0 scale-95"
54
+ enter-to-class="opacity-100 scale-100" leave-active-class="transition ease-in duration-75 transform"
55
+ leave-class="opacity-100 scale-100" leave-to-class="opacity-0 scale-95"
56
+ >
57
+ <SummaryDropdown v-if="show">
58
+ <template #summaryTop>
59
+ <slot name="summaryTop"/>
60
+ </template>
61
+
62
+ <template #summaryBottom>
63
+ <slot name="summaryBottom"/>
64
+ </template>
65
+ </SummaryDropdown>
66
+ </transition>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </template>
@@ -11,17 +11,17 @@ async function getChapter(item) {
11
11
  </script>
12
12
 
13
13
  <template>
14
- <div class="absolute top-14 py-4 px-3 shadow-lg w-60 md:w-104
15
- text-areia z-10 bg-white" :role="Sumário" aria-orientation="vertical"
16
- aria-labelledby="summary-menu">
14
+ <div id="summary-menu-dropdown" class="absolute top-14 py-4 px-3 shadow-lg w-60 md:w-104
15
+ text-areia z-10 bg-white" :role="Sumário" aria-orientation="vertical" aria-labelledby="summary-menu">
17
16
  <nav>
18
17
  <slot name="summaryTop" />
19
18
 
20
- <component v-for="item in summary" :is="item.link ? 'a' : 'button'" :key="item.link"
21
- :href="item.link" :title="`Navegar para capítulo ${item.title}`"
19
+ <component v-for="item in summary" :is="item.link ? 'a' : 'button'" :key="item.link" :href="item.link"
20
+ :title="`Navegar para capítulo ${item.title}`"
22
21
  class="w-full text-left block text-black py-2 px-3 hover:bg-gray-100 rounded mb-2"
23
22
  @click="item.file ? getChapter(item) : null">
24
- {{ item.title }}
23
+ <span class="summary-menu-dropdown-item-title">{{ item.title }}</span>
24
+ <span v-if="item.author" class="summary-menu-dropdown-item-author">{{ item.author }}</span>
25
25
  </component>
26
26
 
27
27
  <slot name="summaryBottom" />
@@ -1,37 +1,37 @@
1
- <script setup>
2
- import { ref } from 'vue'
3
- import { usePointerSwipe, useWindowSize } from '@vueuse/core'
4
-
5
- import usePagination from '../composables/usePagination'
6
- import useReaderSettings from '../composables/useReaderSettings'
7
-
8
- const { columns } = useReaderSettings
9
- const { currentPage } = usePagination
10
-
11
- const el = ref(null)
12
-
13
- const { width } = useWindowSize()
14
- const { distanceX } = usePointerSwipe(el, {
15
- onSwipeEnd() {
16
- if (width.value < 600) {
17
- if (distanceX.value > 100) {
18
- usePagination.next()
19
- }
20
- if (distanceX.value < -100) {
21
- usePagination.prev()
22
- }
23
- }
24
- }
25
- })
26
-
27
- </script>
28
-
29
- <template>
30
- <div ref="el" class="columnsArea" :style="`margin-left: -${100 * (currentPage - 1)}%`">
31
- <div class="[ typeArea ] h-full relative
32
- transition-opacity duration-100 opacity-100 px-2 md:px-24
33
- ">
34
- <slot></slot>
35
- </div>
36
- </div>
37
- </template>
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import { usePointerSwipe, useWindowSize } from '@vueuse/core'
4
+
5
+ import usePagination from '../composables/usePagination'
6
+ import useReaderSettings from '../composables/useReaderSettings'
7
+
8
+ const { columns } = useReaderSettings
9
+ const { currentPage } = usePagination
10
+
11
+ const el = ref(null)
12
+
13
+ const { width } = useWindowSize()
14
+ const { distanceX } = usePointerSwipe(el, {
15
+ onSwipeEnd() {
16
+ if (width.value < 600) {
17
+ if (distanceX.value > 100) {
18
+ usePagination.next()
19
+ }
20
+ if (distanceX.value < -100) {
21
+ usePagination.prev()
22
+ }
23
+ }
24
+ }
25
+ })
26
+
27
+ </script>
28
+
29
+ <template>
30
+ <div ref="el" class="columnsArea" :style="`margin-left: -${100 * (currentPage - 1)}%`">
31
+ <div class="[ typeArea ] h-full relative
32
+ transition-opacity duration-100 opacity-100 px-2 md:px-24
33
+ ">
34
+ <slot></slot>
35
+ </div>
36
+ </div>
37
+ </template>
@@ -1,36 +1,36 @@
1
- <script setup>
2
- import { onKeyStroke } from '@vueuse/core'
3
-
4
- import useReaderSettings from '../composables/useReaderSettings'
5
- import useReferences from '../composables/useReferences'
6
-
7
- const { reference, setHighlightedReference } = useReferences
8
-
9
- function closeRef() {
10
- setHighlightedReference(null)
11
- }
12
-
13
- onKeyStroke('Escape', () => {
14
- if (!useReaderSettings.blocked.value) {
15
- setHighlightedReference(null)
16
- }
17
- })
18
-
19
- </script>
20
-
21
- <template>
22
- <transition enter-active-class="transition ease-out duration-200" enter-from-class="transform opacity-0 scale-95"
23
- enter-to-class="transform opacity-100 scale-100" leave-active-class="transition ease-in duration-200"
24
- leave-from-class="transform opacity-100 scale-100" leave-to-class="transform opacity-0 scale-95">
25
- <div v-if="reference" tabindex="0" class="[ reference-popup ] bg-gray-800 text-white fixed z-40 bottom-0 md:bottom-14 right-0 md:right-3
26
- rounded flex justify-between
27
- p-4 shadow w-full md:w-2/5
28
- ">
29
- <p class="w-4/5" v-html="reference.ref"></p>
30
-
31
- <div class="mt-3 flex self-end">
32
- <button @click.prevent="closeRef()" class="button button-negative">OK</button>
33
- </div>
34
- </div>
35
- </transition>
36
- </template>
1
+ <script setup>
2
+ import { onKeyStroke } from '@vueuse/core'
3
+
4
+ import useReaderSettings from '../composables/useReaderSettings'
5
+ import useReferences from '../composables/useReferences'
6
+
7
+ const { reference, setHighlightedReference } = useReferences
8
+
9
+ function closeRef() {
10
+ setHighlightedReference(null)
11
+ }
12
+
13
+ onKeyStroke('Escape', () => {
14
+ if (!useReaderSettings.blocked.value) {
15
+ setHighlightedReference(null)
16
+ }
17
+ })
18
+
19
+ </script>
20
+
21
+ <template>
22
+ <transition enter-active-class="transition ease-out duration-200" enter-from-class="transform opacity-0 scale-95"
23
+ enter-to-class="transform opacity-100 scale-100" leave-active-class="transition ease-in duration-200"
24
+ leave-from-class="transform opacity-100 scale-100" leave-to-class="transform opacity-0 scale-95">
25
+ <div v-if="reference" tabindex="0" class="[ reference-popup ] bg-gray-800 text-white fixed z-40 bottom-0 md:bottom-14 right-0 md:right-3
26
+ rounded flex justify-between
27
+ p-4 shadow w-full md:w-2/5
28
+ ">
29
+ <p class="w-4/5" v-html="reference.ref"></p>
30
+
31
+ <div class="mt-3 flex self-end">
32
+ <button @click.prevent="closeRef()" class="button button-negative">OK</button>
33
+ </div>
34
+ </div>
35
+ </transition>
36
+ </template>
@@ -1,6 +1,6 @@
1
- <script setup></script>
2
- <template>
3
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
4
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
5
- </svg>
6
- </template>
1
+ <script setup></script>
2
+ <template>
3
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
4
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
5
+ </svg>
6
+ </template>
@@ -1,15 +1,15 @@
1
- <template>
2
- <svg viewBox="0 0 653 441.2" fill="currentColor">
3
- <rect x="73.2" y="143.7" width="195.2" height="20"></rect>
4
- <rect x="73.2" y="82.7" width="195.2" height="20"></rect>
5
- <rect x="73.2" y="203.7" width="195.2" height="20"></rect>
6
- <rect x="73.2" y="263.7" width="195.2" height="20"></rect>
7
- <rect x="73.2" y="319" width="195.2" height="20"></rect>
8
- <rect x="384.7" y="143.7" width="195.2" height="20"></rect>
9
- <rect x="384.7" y="82.7" width="195.2" height="20"></rect>
10
- <rect x="384.7" y="203.7" width="195.2" height="20"></rect>
11
- <rect x="384.7" y="263.7" width="195.2" height="20"></rect>
12
- <rect x="384.7" y="319" width="195.2" height="20"></rect>
13
- <path d="M0-0.6v7.5v7.5v411.8v14.4v0.6h653v-5v-10V14.4V2.5v-3.1H0z M638,426.2H15V14.4h623V426.2z"></path>
14
- </svg>
15
- </template>
1
+ <template>
2
+ <svg viewBox="0 0 653 441.2" fill="currentColor">
3
+ <rect x="73.2" y="143.7" width="195.2" height="20"></rect>
4
+ <rect x="73.2" y="82.7" width="195.2" height="20"></rect>
5
+ <rect x="73.2" y="203.7" width="195.2" height="20"></rect>
6
+ <rect x="73.2" y="263.7" width="195.2" height="20"></rect>
7
+ <rect x="73.2" y="319" width="195.2" height="20"></rect>
8
+ <rect x="384.7" y="143.7" width="195.2" height="20"></rect>
9
+ <rect x="384.7" y="82.7" width="195.2" height="20"></rect>
10
+ <rect x="384.7" y="203.7" width="195.2" height="20"></rect>
11
+ <rect x="384.7" y="263.7" width="195.2" height="20"></rect>
12
+ <rect x="384.7" y="319" width="195.2" height="20"></rect>
13
+ <path d="M0-0.6v7.5v7.5v411.8v14.4v0.6h653v-5v-10V14.4V2.5v-3.1H0z M638,426.2H15V14.4h623V426.2z"></path>
14
+ </svg>
15
+ </template>