@mixd-id/web-scaffold 0.1.230406203 → 0.1.230406205

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406203",
4
+ "version": "0.1.230406205",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -205,10 +205,10 @@ export default{
205
205
  const ix = parseInt(this._props['ix'] + dx)
206
206
 
207
207
  if(!this._props['direction']){
208
- if(Math.abs(dy) > 10){
208
+ if(Math.abs(dy) > 3){
209
209
  this._props['direction'] = 'vertical'
210
210
  }
211
- else if(Math.abs(dx) > 15){
211
+ else if(Math.abs(dx) > 3){
212
212
  this._props['direction'] = 'horizontal'
213
213
  this.disableBodyScroll()
214
214
  }
@@ -251,17 +251,21 @@ export default{
251
251
  },
252
252
 
253
253
  disableBodyScroll(){
254
- this.scrollPosition = window.pageYOffset || document.documentElement.offsetTop
255
- document.body.classList.add(this.$style.htmlNoScroll)
256
- document.body.classList.add(this.$style.bodyNoScroll)
257
- document.body.style.top = `-${this.scrollPosition}px`;
254
+ if(this.$isTouchSupported()){
255
+ this.scrollPosition = window.pageYOffset || document.documentElement.offsetTop
256
+ document.body.classList.add(this.$style.htmlNoScroll)
257
+ document.body.classList.add(this.$style.bodyNoScroll)
258
+ document.body.style.top = `-${this.scrollPosition}px`;
259
+ }
258
260
  },
259
261
 
260
262
  enableBodyScroll(){
261
- document.body.style.removeProperty('top');
262
- document.body.classList.remove(this.$style.bodyNoScroll)
263
- document.body.classList.remove(this.$style.htmlNoScroll)
264
- window.scrollTo(0, this.scrollPosition);
263
+ if(this.$isTouchSupported()){
264
+ document.body.style.removeProperty('top');
265
+ document.body.classList.remove(this.$style.bodyNoScroll)
266
+ document.body.classList.remove(this.$style.htmlNoScroll)
267
+ window.scrollTo(0, this.scrollPosition);
268
+ }
265
269
  },
266
270
 
267
271
  mouseDown(e){
@@ -360,23 +364,21 @@ export default{
360
364
  @apply bg-primary-500;
361
365
  }
362
366
 
363
- @media screen and (max-width: 768px){
364
- .htmlNoScroll{
365
- min-height: 100.3%;
366
- overscroll-behavior-y: none;
367
- height: 100%;
368
- overflow: hidden;
369
- }
370
- .bodyNoScroll{
371
- overscroll-behavior: none;
372
- overscroll-behavior-y: none;
373
- overflow: hidden;
374
- position: fixed;
375
- width: 100%;
376
- margin: 0;
377
- max-height: 100%;
378
- -webkit-overflow-scrolling: touch;
379
- }
367
+ .htmlNoScroll{
368
+ min-height: 100.3%;
369
+ overscroll-behavior-y: none;
370
+ height: 100%;
371
+ overflow: hidden;
372
+ }
373
+ .bodyNoScroll{
374
+ overscroll-behavior: none;
375
+ overscroll-behavior-y: none;
376
+ overflow: hidden;
377
+ position: fixed;
378
+ width: 100%;
379
+ margin: 0;
380
+ max-height: 100%;
381
+ -webkit-overflow-scrolling: touch;
380
382
  }
381
383
 
382
384
 
@@ -94,8 +94,8 @@ export default{
94
94
 
95
95
  mounted(){
96
96
  this.$observe.once(this.$el, () => {
97
- this.isVisible = true
98
- this.loadSrc()
97
+ this.isVisible = true
98
+ this.loadSrc()
99
99
  })
100
100
 
101
101
  this.$resize(this.onResize)
@@ -168,7 +168,7 @@ export default{
168
168
 
169
169
  let imgSrc
170
170
  for(const b in screens){
171
- if(window.innerWidth > b && screens[b] in src){
171
+ if(document.documentElement.clientWidth > b && screens[b] in src){
172
172
  imgSrc = src[screens[b]]
173
173
  }
174
174
  }
@@ -201,7 +201,7 @@ export default{
201
201
 
202
202
  let imgSrc
203
203
  for(const b in screens){
204
- if(window.innerWidth > b && screens[b] in src){
204
+ if(document.documentElement.clientWidth > b && screens[b] in src){
205
205
  imgSrc = src[screens[b]]
206
206
  }
207
207
  }
@@ -260,7 +260,7 @@ export default{
260
260
  watch:{
261
261
 
262
262
  src(to, from){
263
- this.loadSrc()
263
+ this.loadSrc()
264
264
  },
265
265
 
266
266
  }
package/src/index.js CHANGED
@@ -266,6 +266,10 @@ const util = {
266
266
 
267
267
  }
268
268
 
269
+ const isTouchSupported = () => {
270
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
271
+ }
272
+
269
273
  export default{
270
274
 
271
275
  install: (app, options) => {
@@ -339,6 +343,7 @@ export default{
339
343
  app.config.globalProperties.time = consoleTime
340
344
  app.config.globalProperties.timeLog = consoleTimeLog
341
345
  app.config.globalProperties.timeEnd = consoleTimeEnd
346
+ app.config.globalProperties.$isTouchSupported = isTouchSupported
342
347
 
343
348
  app.config.globalProperties.$isDev = () => import.meta.env.DEV
344
349
 
@@ -3,8 +3,8 @@
3
3
  <h3>{{ title }}</h3>
4
4
  <div :class="$style.items">
5
5
  <div v-for="(item, idx) in items" :class="$style.item">
6
- <input type="checkbox" :name="$style.comp" :id="`${$style.comp}${idx}`" />
7
- <label :for="`${$style.comp}${idx}`" class="text-lg">{{ item.question }}</label>
6
+ <input type="checkbox" :name="$style.comp" :id="`${$style.comp}${id}${idx}`" />
7
+ <label :for="`${$style.comp}${id}${idx}`" class="text-lg">{{ item.question }}</label>
8
8
  <div>
9
9
  <div class="p-4 pt-0 pb-8 text-lg" v-html="item.answer"></div>
10
10
  </div>
@@ -29,7 +29,13 @@ export default{
29
29
  props:{
30
30
  title: String,
31
31
  items: Array
32
- }
32
+ },
33
+
34
+ data(){
35
+ return {
36
+ id: this.uniqid()
37
+ }
38
+ }
33
39
 
34
40
  }
35
41