paginar 0.2.5 → 0.2.8

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/dist/style.css CHANGED
@@ -767,6 +767,10 @@ video {
767
767
  cursor: pointer;
768
768
  }
769
769
 
770
+ .cursor-default {
771
+ cursor: default;
772
+ }
773
+
770
774
  .grid-cols-3 {
771
775
  grid-template-columns: repeat(3, minmax(0, 1fr));
772
776
  }
@@ -967,14 +971,14 @@ video {
967
971
  opacity: 0;
968
972
  }
969
973
 
970
- .opacity-75 {
971
- opacity: 0.75;
972
- }
973
-
974
974
  .opacity-30 {
975
975
  opacity: 0.3;
976
976
  }
977
977
 
978
+ .opacity-75 {
979
+ opacity: 0.75;
980
+ }
981
+
978
982
  .shadow-2xl {
979
983
  --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
980
984
  --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
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.8",
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
@@ -750,6 +750,10 @@ video {
750
750
  cursor: pointer;
751
751
  }
752
752
 
753
+ .cursor-default {
754
+ cursor: default;
755
+ }
756
+
753
757
  .grid-cols-3 {
754
758
  grid-template-columns: repeat(3, minmax(0, 1fr));
755
759
  }
@@ -950,14 +954,14 @@ video {
950
954
  opacity: 0;
951
955
  }
952
956
 
953
- .opacity-75 {
954
- opacity: 0.75;
955
- }
956
-
957
957
  .opacity-30 {
958
958
  opacity: 0.3;
959
959
  }
960
960
 
961
+ .opacity-75 {
962
+ opacity: 0.75;
963
+ }
964
+
961
965
  .shadow-2xl {
962
966
  --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
963
967
  --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
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',