paginar 0.2.5 → 0.2.7

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/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.2.5",
7
+ "version": "0.2.7",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/educkf/paginar.git"
@@ -12,7 +12,7 @@
12
12
  "license": "Apache-2.0",
13
13
  "homepage": "https://github.com/educkf/paginar",
14
14
  "scripts": {
15
- "dev": "concurrently \"npm run start:css\" \"npm run start\"",
15
+ "dev": "concurrently \"npm run start:css\" \"npm run start --host\"",
16
16
  "start": "vite",
17
17
  "start:css": "tailwindcss -o src/tailwind.css --watch",
18
18
  "build": "npm run build:css && vite build",
package/src/App.ce.vue CHANGED
@@ -15,6 +15,7 @@ import useEstimatePages from './composables/useEstimatePages'
15
15
  import useTextContent from './composables/useTextContent'
16
16
  import useReaderSettings from './composables/useReaderSettings'
17
17
  import useStyles from './composables/useStyles'
18
+ import useBrowser from './composables/useBrowser'
18
19
 
19
20
  const props = defineProps({
20
21
  bookTitle: String,
@@ -88,7 +89,7 @@ watchDebounced(content,
88
89
  </script>
89
90
 
90
91
  <template>
91
- <div class="rootWrapper">
92
+ <div class="rootWrapper" :class="useBrowser.isSafari ? 'safari' : ''">
92
93
  <main id="rootComponent"
93
94
  ref="rootComponent"
94
95
  :class="mode
@@ -46,6 +46,15 @@ header.wrapper {
46
46
  width: 100%;
47
47
  }
48
48
 
49
+ .rootWrapper.safari {
50
+ max-height: initial;
51
+ height: initial;
52
+ }
53
+
54
+ .rootWrapper.safari #engine {
55
+ height: auto !important;
56
+ }
57
+
49
58
  #reader-component {
50
59
  width: 100%;
51
60
  }
@@ -65,7 +74,7 @@ header.wrapper {
65
74
  width: 100%;
66
75
  }
67
76
 
68
- .columns-double .columnsArea {
77
+ .rootWrapper:not(.safari) .columns-double .columnsArea {
69
78
  -moz-column-count: 2;
70
79
  column-count: 2;
71
80
  grid-column-gap: 0;
@@ -81,7 +90,7 @@ header.wrapper {
81
90
  }
82
91
  }
83
92
 
84
- .columns-single .columnsArea {
93
+ .rootWrapper:not(.safari) .columns-single .columnsArea {
85
94
  column-count: 1;
86
95
  column-gap: 0;
87
96
  height: 100%;
@@ -139,6 +148,11 @@ header.wrapper {
139
148
 
140
149
  /* slider */
141
150
 
151
+ .rootWrapper.safari .slider-target,
152
+ .rootWrapper.safari .slider-target *{
153
+ display: none !important;
154
+ }
155
+
142
156
  .slider-target,.slider-target *{
143
157
  -webkit-touch-callout:none;
144
158
  -webkit-tap-highlight-color:rgba(0,0,0,0);
@@ -1,15 +1,15 @@
1
- <script setup>
2
- import NavigationButton from './NavigationButton.vue'
3
- import usePagination from '../composables/usePagination'
4
- const { next, prev } = usePagination
5
- </script>
6
-
7
- <template>
8
- <div id="engine" class="pt-10 transition-colors">
9
- <div class="engineWrapper overflow-hidden">
10
- <NavigationButton target="prev" @clicked="prev()" />
11
- <slot></slot>
12
- <NavigationButton target="next" @clicked="next()" />
13
- </div>
14
- </div>
15
- </template>
1
+ <script setup>
2
+ import NavigationButton from './NavigationButton.vue'
3
+ import usePagination from '../composables/usePagination'
4
+ const { next, prev } = usePagination
5
+ </script>
6
+
7
+ <template>
8
+ <div id="engine" class="pt-10 transition-colors">
9
+ <div class="engineWrapper overflow-hidden">
10
+ <NavigationButton target="prev" @clicked="prev()" />
11
+ <slot></slot>
12
+ <NavigationButton target="next" @clicked="next()" />
13
+ </div>
14
+ </div>
15
+ </template>
@@ -1,5 +1,7 @@
1
1
  <script setup>
2
+ import { computed } from 'vue'
2
3
  import { useWindowSize } from '@vueuse/core'
4
+
3
5
  import SingleColumn from '../../icons/SingleColumn.vue'
4
6
  import DoubleColumn from '../../icons/DoubleColumn.vue'
5
7
 
@@ -7,6 +9,11 @@ import useReaderSettings from '../../../composables/useReaderSettings'
7
9
  const { columns, setColumns } = useReaderSettings
8
10
  const { width } = useWindowSize()
9
11
 
12
+ const isSafari = computed(() => {
13
+ const ua = navigator.userAgent.toLowerCase()
14
+ return ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1
15
+ })
16
+
10
17
  </script>
11
18
 
12
19
  <template>
@@ -15,11 +22,12 @@ const { width } = useWindowSize()
15
22
  class="col-span-1 text-primary text-center cursor-pointer py-3 rounded-sm border"
16
23
  :class="{
17
24
  'border-gray-300': columns !== 'single',
18
- 'bg-primary-extralight border-2 border-primary': columns === 'single'
25
+ 'bg-primary-extralight border-2 border-primary': columns === 'single',
26
+ 'opacity-30 cursor-default': isSafari
19
27
  }"
20
- @click.prevent="setColumns('single')"
28
+ @click.prevent="!isSafari ? setColumns('single') : null"
21
29
  aria-label="Coluna única"
22
- title="Coluna única"
30
+ :title="isSafari ? 'O navegador Safari não aceita visualização de coluna única.' : 'Coluna única'"
23
31
  >
24
32
  <SingleColumn class="mx-auto h-10 opacity-75" />
25
33
  </button>
@@ -0,0 +1,16 @@
1
+ const isSafari = [
2
+ 'iPad Simulator',
3
+ 'iPhone Simulator',
4
+ 'iPod Simulator',
5
+ 'iPad',
6
+ 'iPhone',
7
+ 'iPod'
8
+ ].includes(navigator.platform)
9
+ || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
10
+
11
+ const isApple = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
12
+
13
+ export default {
14
+ isSafari,
15
+ isApple
16
+ }
@@ -1,31 +1,31 @@
1
- import { computed, reactive } from 'vue'
2
-
3
- const state = reactive({
4
- totalPages: 1
5
- })
6
-
7
- function estimate(viewport, content) {
8
- if (viewport && content) {
9
- const { width: viewportWidth } = viewport.value.getBoundingClientRect()
10
- const { width: contentWidth } = content.value.getBoundingClientRect()
11
-
12
- if (contentWidth > viewportWidth) {
13
- state.totalPages = Math.ceil(contentWidth / viewportWidth)
14
- return Math.ceil(contentWidth / viewportWidth)
15
-
16
- } else {
17
- state.totalPages = 1
18
- return 1
19
- }
20
- } else {
21
- state.totalPages = 1
22
- return 1
23
- }
24
- }
25
-
26
- const totalPages = computed(() => state.totalPages)
27
-
28
- export default {
29
- totalPages,
30
- estimate
31
- }
1
+ import { computed, reactive } from 'vue'
2
+
3
+ const state = reactive({
4
+ totalPages: 1
5
+ })
6
+
7
+ function estimate(viewport, content) {
8
+ if (viewport && content) {
9
+ const { width: viewportWidth } = viewport.value.getBoundingClientRect()
10
+ const { width: contentWidth } = content.value.getBoundingClientRect()
11
+
12
+ if (contentWidth > viewportWidth) {
13
+ state.totalPages = Math.ceil(contentWidth / viewportWidth)
14
+ return Math.ceil(contentWidth / viewportWidth)
15
+
16
+ } else {
17
+ state.totalPages = 1
18
+ return 1
19
+ }
20
+ } else {
21
+ state.totalPages = 1
22
+ return 1
23
+ }
24
+ }
25
+
26
+ const totalPages = computed(() => state.totalPages)
27
+
28
+ export default {
29
+ totalPages,
30
+ estimate
31
+ }
@@ -4,6 +4,7 @@ import { onKeyStroke } from '@vueuse/core'
4
4
  import useReaderSettings from './useReaderSettings'
5
5
  import useEstimatePages from './useEstimatePages'
6
6
  import useTextContent from './useTextContent'
7
+ import useBrowser from './useBrowser'
7
8
 
8
9
  const state = reactive({
9
10
  currentPage: 1,
@@ -29,7 +30,9 @@ function init(viewport, content) {
29
30
  }, 200)
30
31
  }
31
32
 
32
- addEventListener('wheel', onWheel)
33
+ if (!useBrowser.isApple && !useBrowser.isSafari) {
34
+ addEventListener('wheel', onWheel)
35
+ }
33
36
 
34
37
  setInterval(() => {
35
38
  useEstimatePages.estimate(viewport, content)
@@ -11,7 +11,7 @@ const state = reactive({
11
11
  { name: 'Verdana, sans-serif' },
12
12
  ],
13
13
  fontSize: 16,
14
- columns: 'single',
14
+ columns: 'double',
15
15
  mode: 'light',
16
16
  blocked: false
17
17
  })
package/src/tailwind.css CHANGED
@@ -658,6 +658,10 @@ video {
658
658
  margin-bottom: 0.5rem;
659
659
  }
660
660
 
661
+ .mb-5 {
662
+ margin-bottom: 1.25rem;
663
+ }
664
+
661
665
  .block {
662
666
  display: block;
663
667
  }
@@ -750,6 +754,10 @@ video {
750
754
  cursor: pointer;
751
755
  }
752
756
 
757
+ .cursor-default {
758
+ cursor: default;
759
+ }
760
+
753
761
  .grid-cols-3 {
754
762
  grid-template-columns: repeat(3, minmax(0, 1fr));
755
763
  }
@@ -838,6 +846,11 @@ video {
838
846
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
839
847
  }
840
848
 
849
+ .bg-red-700 {
850
+ --tw-bg-opacity: 1;
851
+ background-color: rgb(185 28 28 / var(--tw-bg-opacity));
852
+ }
853
+
841
854
  .p-4 {
842
855
  padding: 1rem;
843
856
  }
@@ -850,6 +863,10 @@ video {
850
863
  padding: 0.75rem;
851
864
  }
852
865
 
866
+ .p-1 {
867
+ padding: 0.25rem;
868
+ }
869
+
853
870
  .py-2 {
854
871
  padding-top: 0.5rem;
855
872
  padding-bottom: 0.5rem;
@@ -888,6 +905,10 @@ video {
888
905
  padding-left: 1rem;
889
906
  }
890
907
 
908
+ .pt-5 {
909
+ padding-top: 1.25rem;
910
+ }
911
+
891
912
  .text-left {
892
913
  text-align: left;
893
914
  }
package/vite.config.js CHANGED
@@ -16,6 +16,10 @@ export default defineConfig({
16
16
  'process.env': {}
17
17
  },
18
18
 
19
+ server: {
20
+ host: true
21
+ },
22
+
19
23
  build: {
20
24
  lib: {
21
25
  entry: 'src/main.js',