@mixd-id/web-scaffold 0.1.230406202 → 0.1.230406204

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.230406202",
4
+ "version": "0.1.230406204",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -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
  }
@@ -160,7 +160,7 @@ export default{
160
160
  .size-sm textarea{ @apply text-sm; }
161
161
 
162
162
  .size-lg{ @apply min-h-[var(--h-cp-lg)]; }
163
- .size-lg textarea{ @apply text-lg p-3; }
163
+ .size-lg textarea{ @apply text-lg p-2; }
164
164
 
165
165
 
166
166
  .active{
@@ -187,7 +187,7 @@ export default{
187
187
 
188
188
 
189
189
  .textbox>input{
190
- @apply flex-1 outline-none p-3 bg-transparent;
190
+ @apply flex-1 outline-none p-2 bg-transparent;
191
191
  font-size: inherit;
192
192
  }
193
193
 
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