paginar 0.1.0 → 0.1.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 (33) hide show
  1. package/README.md +5 -5
  2. package/demo/slot/slot-chapter1.html +40 -5
  3. package/demo/slot/slot-chapter2.html +7 -0
  4. package/demo/slot/slot-chapter3.html +6 -0
  5. package/demo/summary/_content/1chapter.html +5 -5
  6. package/demo/summary/_content/2chapter.html +2 -2
  7. package/demo/summary/index.html +25 -1
  8. package/dist/index.es.js +470 -268
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/style.css +63 -46
  11. package/package.json +4 -2
  12. package/src/App.ce.vue +62 -52
  13. package/src/assets/main.css +279 -13
  14. package/src/components/BookContent.vue +23 -0
  15. package/src/components/EngineWrapper.vue +2 -10
  16. package/src/components/FooterSlot.vue +32 -0
  17. package/src/components/HeaderSlot/{HeaderSlot.ce.vue → HeaderSlot.vue} +30 -37
  18. package/src/components/HeaderSlot/OptionsButton/{OptionsButton.ce.vue → OptionsButton.vue} +7 -9
  19. package/src/components/HeaderSlot/OptionsButton/OptionsColor.vue +2 -2
  20. package/src/components/HeaderSlot/OptionsButton/OptionsColumns.vue +5 -5
  21. package/src/components/HeaderSlot/OptionsButton/OptionsFontFamily.vue +2 -2
  22. package/src/components/HeaderSlot/SummaryButton/{SummaryButton.ce.vue → SummaryButton.vue} +2 -7
  23. package/src/components/HeaderSlot/SummaryButton/SummaryDropdown.vue +30 -29
  24. package/src/components/{NavigationButton.ce.vue → NavigationButton.vue} +0 -0
  25. package/src/components/ReferencePopup.vue +31 -0
  26. package/src/composables/useFootnotes.js +27 -0
  27. package/src/composables/usePagination.js +9 -0
  28. package/src/composables/useReferences.js +63 -0
  29. package/src/composables/useTextContent.js +35 -4
  30. package/src/main.js +1 -3
  31. package/src/tailwind.css +63 -46
  32. package/src/components/FileContent.ce.vue +0 -20
  33. package/src/components/FooterSlot.ce.vue +0 -22
package/dist/style.css CHANGED
@@ -551,6 +551,10 @@ video {
551
551
  --tw-backdrop-sepia: ;
552
552
  }
553
553
 
554
+ .fixed {
555
+ position: fixed;
556
+ }
557
+
554
558
  .absolute {
555
559
  position: absolute;
556
560
  }
@@ -563,6 +567,10 @@ video {
563
567
  right: 0px;
564
568
  }
565
569
 
570
+ .bottom-0 {
571
+ bottom: 0px;
572
+ }
573
+
566
574
  .top-14 {
567
575
  top: 3.5rem;
568
576
  }
@@ -575,6 +583,10 @@ video {
575
583
  left: -0.5rem;
576
584
  }
577
585
 
586
+ .z-40 {
587
+ z-index: 40;
588
+ }
589
+
578
590
  .z-10 {
579
591
  z-index: 10;
580
592
  }
@@ -602,6 +614,10 @@ video {
602
614
  margin-bottom: 2rem;
603
615
  }
604
616
 
617
+ .mt-3 {
618
+ margin-top: 0.75rem;
619
+ }
620
+
605
621
  .mr-3 {
606
622
  margin-right: 0.75rem;
607
623
  }
@@ -610,10 +626,6 @@ video {
610
626
  margin-left: 0.75rem;
611
627
  }
612
628
 
613
- .mt-3 {
614
- margin-top: 0.75rem;
615
- }
616
-
617
629
  .ml-4 {
618
630
  margin-left: 1rem;
619
631
  }
@@ -654,14 +666,18 @@ video {
654
666
  height: 1.25rem;
655
667
  }
656
668
 
657
- .w-6 {
658
- width: 1.5rem;
659
- }
660
-
661
669
  .w-full {
662
670
  width: 100%;
663
671
  }
664
672
 
673
+ .w-4\/5 {
674
+ width: 80%;
675
+ }
676
+
677
+ .w-6 {
678
+ width: 1.5rem;
679
+ }
680
+
665
681
  .w-5 {
666
682
  width: 1.25rem;
667
683
  }
@@ -718,18 +734,22 @@ video {
718
734
  --tw-divide-opacity: 0.75;
719
735
  }
720
736
 
721
- .overflow-hidden {
722
- overflow: hidden;
737
+ .self-end {
738
+ align-self: flex-end;
723
739
  }
724
740
 
725
- .rounded-sm {
726
- border-radius: 0.125rem;
741
+ .overflow-hidden {
742
+ overflow: hidden;
727
743
  }
728
744
 
729
745
  .rounded {
730
746
  border-radius: 0.25rem;
731
747
  }
732
748
 
749
+ .rounded-sm {
750
+ border-radius: 0.125rem;
751
+ }
752
+
733
753
  .border {
734
754
  border-width: 1px;
735
755
  }
@@ -747,16 +767,6 @@ video {
747
767
  border-color: rgb(255 255 255 / var(--tw-border-opacity));
748
768
  }
749
769
 
750
- .border-gray-800 {
751
- --tw-border-opacity: 1;
752
- border-color: rgb(31 41 55 / var(--tw-border-opacity));
753
- }
754
-
755
- .border-gray-500 {
756
- --tw-border-opacity: 1;
757
- border-color: rgb(107 114 128 / var(--tw-border-opacity));
758
- }
759
-
760
770
  .border-gray-300 {
761
771
  --tw-border-opacity: 1;
762
772
  border-color: rgb(209 213 219 / var(--tw-border-opacity));
@@ -767,25 +777,11 @@ video {
767
777
  background-color: rgb(31 41 55 / var(--tw-bg-opacity));
768
778
  }
769
779
 
770
- .bg-gray-100 {
771
- --tw-bg-opacity: 1;
772
- background-color: rgb(243 244 246 / var(--tw-bg-opacity));
773
- }
774
-
775
- .bg-gray-300 {
776
- --tw-bg-opacity: 1;
777
- background-color: rgb(209 213 219 / var(--tw-bg-opacity));
778
- }
779
-
780
780
  .bg-white {
781
781
  --tw-bg-opacity: 1;
782
782
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
783
783
  }
784
784
 
785
- .p-2 {
786
- padding: 0.5rem;
787
- }
788
-
789
785
  .p-4 {
790
786
  padding: 1rem;
791
787
  }
@@ -794,6 +790,16 @@ video {
794
790
  padding: 0.75rem;
795
791
  }
796
792
 
793
+ .py-2 {
794
+ padding-top: 0.5rem;
795
+ padding-bottom: 0.5rem;
796
+ }
797
+
798
+ .px-10 {
799
+ padding-left: 2.5rem;
800
+ padding-right: 2.5rem;
801
+ }
802
+
797
803
  .px-24 {
798
804
  padding-left: 6rem;
799
805
  padding-right: 6rem;
@@ -814,11 +820,6 @@ video {
814
820
  padding-right: 0.75rem;
815
821
  }
816
822
 
817
- .py-2 {
818
- padding-top: 0.5rem;
819
- padding-bottom: 0.5rem;
820
- }
821
-
822
823
  .pt-10 {
823
824
  padding-top: 2.5rem;
824
825
  }
@@ -859,6 +860,11 @@ video {
859
860
  color: rgb(255 255 255 / var(--tw-text-opacity));
860
861
  }
861
862
 
863
+ .text-gray-700 {
864
+ --tw-text-opacity: 1;
865
+ color: rgb(55 65 81 / var(--tw-text-opacity));
866
+ }
867
+
862
868
  .text-gray-800 {
863
869
  --tw-text-opacity: 1;
864
870
  color: rgb(31 41 55 / var(--tw-text-opacity));
@@ -927,6 +933,10 @@ video {
927
933
  transition-duration: 100ms;
928
934
  }
929
935
 
936
+ .duration-200 {
937
+ transition-duration: 200ms;
938
+ }
939
+
930
940
  .duration-75 {
931
941
  transition-duration: 75ms;
932
942
  }
@@ -945,11 +955,6 @@ video {
945
955
  }
946
956
 
947
957
  @media (prefers-color-scheme: dark) {
948
- .dark\:border-white {
949
- --tw-border-opacity: 1;
950
- border-color: rgb(255 255 255 / var(--tw-border-opacity));
951
- }
952
-
953
958
  .dark\:text-white {
954
959
  --tw-text-opacity: 1;
955
960
  color: rgb(255 255 255 / var(--tw-text-opacity));
@@ -957,6 +962,14 @@ video {
957
962
  }
958
963
 
959
964
  @media (min-width: 768px) {
965
+ .md\:bottom-14 {
966
+ bottom: 3.5rem;
967
+ }
968
+
969
+ .md\:right-3 {
970
+ right: 0.75rem;
971
+ }
972
+
960
973
  .md\:right-16 {
961
974
  right: 4rem;
962
975
  }
@@ -972,4 +985,8 @@ video {
972
985
  .md\:grid {
973
986
  display: grid;
974
987
  }
988
+
989
+ .md\:w-2\/5 {
990
+ width: 40%;
991
+ }
975
992
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "A flipping page web component for reading long texts on the brower",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
7
- "version": "0.1.0",
7
+ "version": "0.1.2",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/educkf/paginar.git"
@@ -20,8 +20,10 @@
20
20
  "preview": "vite preview --port 4173"
21
21
  },
22
22
  "dependencies": {
23
+ "@vueform/slider": "^2.1.5",
23
24
  "@vueuse/core": "^9.2.0",
24
- "vue": "^3.2.37"
25
+ "vue": "^3.2.37",
26
+ "vue-slider-component": "^4.1.0-beta.2"
25
27
  },
26
28
  "devDependencies": {
27
29
  "@vitejs/plugin-vue": "^3.0.1",
package/src/App.ce.vue CHANGED
@@ -1,17 +1,19 @@
1
1
  <script setup>
2
- import { ref, onMounted, defineProps } from 'vue'
2
+ import { ref, onMounted, defineProps, onBeforeUnmount } from 'vue'
3
3
  import { useWindowSize, watchDebounced } from '@vueuse/core'
4
4
 
5
- import HeaderSlot from './components/HeaderSlot/HeaderSlot.ce.vue'
6
- import FileContent from './components/FileContent.ce.vue'
5
+ import HeaderSlot from './components/HeaderSlot/HeaderSlot.vue'
6
+ import BookContent from './components/BookContent.vue'
7
7
  import EngineWrapper from './components/EngineWrapper.vue'
8
8
  import ReaderWrapper from './components/ReaderWrapper.vue'
9
- import FooterSlot from './components/FooterSlot.ce.vue'
9
+ import ReferencePopup from './components/ReferencePopup.vue'
10
+ import FooterSlot from './components/FooterSlot.vue'
10
11
 
11
12
  import usePagination from './composables/usePagination'
12
13
  import useEstimatePages from './composables/useEstimatePages'
13
14
  import useTextContent from './composables/useTextContent'
14
15
  import useReaderSettings from './composables/useReaderSettings'
16
+ import useReferences from './composables/useReferences'
15
17
  import useStyles from './composables/useStyles'
16
18
 
17
19
  const props = defineProps({
@@ -21,9 +23,10 @@ const props = defineProps({
21
23
  cssFile: String
22
24
  })
23
25
 
24
- const { initSettings, baseFont, textFont, fontSize, columns, setColumns } = useReaderSettings
26
+ const { initSettings, baseFont, textFont, fontSize, columns, setColumns, mode } = useReaderSettings
25
27
  const { currentPage, totalPages, init } = usePagination
26
28
  const { content } = useTextContent
29
+ const { listenToReferencesClick } = useReferences
27
30
  const { width, height } = useWindowSize()
28
31
 
29
32
  const readerComponent = ref(null)
@@ -49,56 +52,63 @@ watchDebounced(
49
52
  },
50
53
  { debounce: 125, maxWait: 250 }
51
54
  )
55
+
56
+ watchDebounced(content,
57
+ () => listenToReferencesClick(contentArea),
58
+ { debounce: 125, maxWait: 250 }
59
+ )
60
+
52
61
  </script>
53
62
 
54
63
  <template>
55
- <main ref="rootComponent" :style="`font-family: ${baseFont}`">
56
- <HeaderSlot>
57
- <template #header>
58
- <slot name="header">
59
- <p class="text-white text-center text-xs">
60
- {{ props.bookTitle }}
61
- </p>
62
- </slot>
63
- </template>
64
-
65
- <template #summaryTop>
66
- <slot name="summaryTop"></slot>
67
- </template>
68
-
69
- <template #summaryBottom>
70
- <slot name="summaryBottom"></slot>
71
- </template>
72
-
73
- <template #optionsTop>
74
- <slot name="optionsTop"></slot>
75
- </template>
76
-
77
- <template #optionsBottom>
78
- <slot name="optionsBottom"></slot>
79
- </template>
80
- </HeaderSlot>
81
-
82
- <EngineWrapper>
83
- <div id="reader-component" ref="readerComponent">
84
- <ReaderWrapper>
85
- <section id="content-area" ref="contentArea"
86
- :style="`font-family: ${textFont}; font-size: ${fontSize}px`"
87
- >
88
- <slot name="content">
89
- <!-- default when no content slot, and there is a summary -->
90
- <FileContent :bookContent="bookContent" />
91
- </slot>
92
- </section>
93
- </ReaderWrapper>
94
- </div>
95
- </EngineWrapper>
96
-
97
- <FooterSlot
98
- :currPage="currentPage"
99
- :totalPages="totalPages"
100
- />
101
- </main>
64
+ <div class="rootWrapper">
65
+ <main id="rootComponent" ref="rootComponent" :class="mode" :style="`font-family: ${baseFont}`">
66
+ <HeaderSlot>
67
+ <template #header>
68
+ <slot name="header">
69
+ <p class="text-white text-center text-xs">
70
+ {{ props.bookTitle }}
71
+ </p>
72
+ </slot>
73
+ </template>
74
+
75
+ <template #summaryTop>
76
+ <slot name="summaryTop"></slot>
77
+ </template>
78
+
79
+ <template #summaryBottom>
80
+ <slot name="summaryBottom"></slot>
81
+ </template>
82
+
83
+ <template #optionsTop>
84
+ <slot name="optionsTop"></slot>
85
+ </template>
86
+
87
+ <template #optionsBottom>
88
+ <slot name="optionsBottom"></slot>
89
+ </template>
90
+ </HeaderSlot>
91
+
92
+ <EngineWrapper>
93
+ <div id="reader-component" ref="readerComponent">
94
+ <ReaderWrapper>
95
+ <section id="content-area" ref="contentArea"
96
+ :style="`font-family: ${textFont}; font-size: ${fontSize}px`">
97
+ <BookContent :bookContent="bookContent">
98
+ <template #content>
99
+ <slot name="content"></slot>
100
+ </template>
101
+ </BookContent>
102
+ </section>
103
+ </ReaderWrapper>
104
+ </div>
105
+ </EngineWrapper>
106
+
107
+ <FooterSlot :currPage="currentPage" :totalPages="totalPages" />
108
+
109
+ <ReferencePopup />
110
+ </main>
111
+ </div>
102
112
  </template>
103
113
 
104
114
  <style lang="scss" src="./assets/main.css"></style>