@bagelink/vue 1.6.7 → 1.6.17
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/components/Swiper.vue.d.ts +2322 -2
- package/dist/components/Swiper.vue.d.ts.map +1 -1
- package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
- package/dist/index.cjs +16 -38
- package/dist/index.mjs +5893 -6969
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Carousel.vue +43 -43
- package/src/components/ListItem.vue +2 -2
- package/src/components/Swiper.vue +85 -79
- package/src/components/form/FieldArray.vue +56 -50
- package/src/components/form/inputs/CodeEditor/Index.vue +1 -1
- package/src/composables/useExcel.ts +6 -6
- package/src/styles/colors.css +176 -0
- package/src/styles/layout.css +231 -0
- package/src/styles/mobilLayout.css +232 -0
- package/src/styles/mobileColors.css +176 -0
- package/src/utils/index.ts +46 -25
- package/vite.config.ts +1 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -29,5 +29,6 @@ export { formatString } from './strings';
|
|
|
29
29
|
export { useDebounceFn } from '@vueuse/core';
|
|
30
30
|
export declare function pathKeyToURL(pathKey?: string): string | undefined;
|
|
31
31
|
export declare function getNestedValue(obj: any, path?: string, defaultValue?: any): any;
|
|
32
|
+
export declare function tryRun<T>(func: () => T, callback?: (error: Error) => void): T | undefined;
|
|
32
33
|
export declare function downloadFile(source: string | Blob, fileName?: string): void;
|
|
33
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MA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GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAatD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAIvC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,aAAa,SAAO,GAAG,MAAM,GAAG,SAAS,CAG/G;AAED,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAM5C,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,sBAkB5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG,CAa1F;AAID,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,SAAS,CAQzF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,QA6BpE"}
|
package/package.json
CHANGED
|
@@ -69,51 +69,51 @@ let velocityTracker = $ref<VelocitySample[]>([])
|
|
|
69
69
|
const VELOCITY_SAMPLE_DURATION = 100 // ms to track velocity
|
|
70
70
|
|
|
71
71
|
function getAverageVelocity(): number {
|
|
72
|
-
if (
|
|
72
|
+
if (velocityTracker.length < 2) { return 0 }
|
|
73
73
|
|
|
74
74
|
const now = Date.now()
|
|
75
75
|
// Only consider samples within our sample duration
|
|
76
76
|
const recentSamples = velocityTracker.filter((sample: VelocitySample) => now - sample.time < VELOCITY_SAMPLE_DURATION)
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (recentSamples.length < 2) { return 0 }
|
|
79
79
|
|
|
80
80
|
const first = recentSamples[0]
|
|
81
81
|
const last = recentSamples[recentSamples.length - 1]
|
|
82
82
|
const timeDelta = last.time - first.time
|
|
83
83
|
|
|
84
|
-
if (
|
|
84
|
+
if (timeDelta === 0) { return 0 }
|
|
85
85
|
|
|
86
86
|
return (last.position - first.position) / timeDelta
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Transform helpers
|
|
90
90
|
function getCurrentTransform(): number {
|
|
91
|
-
if (!bglSlider) {return 0}
|
|
91
|
+
if (!bglSlider) { return 0 }
|
|
92
92
|
const { transform } = bglSlider.style
|
|
93
93
|
const value = transform ? Number.parseInt(transform.replace(/[^-\d.]/g, '')) : 0
|
|
94
94
|
return props.rtl ? -value : value
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function setTransform(value: number) {
|
|
98
|
-
if (!bglSlider) {return}
|
|
98
|
+
if (!bglSlider) { return }
|
|
99
99
|
const rtlValue = props.rtl ? -value : value
|
|
100
100
|
bglSlider.style.transform = `translateX(${rtlValue}px)`
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function easeInOutQuad(t: number) {
|
|
104
|
-
return 0.5
|
|
104
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
function animateTransform(start: number, end: number, duration: number) {
|
|
108
108
|
const startTime = performance.now()
|
|
109
109
|
|
|
110
110
|
function animate(currentTime: number) {
|
|
111
|
-
if (!isSliderAvailable) {return}
|
|
111
|
+
if (!isSliderAvailable) { return }
|
|
112
112
|
const timeElapsed = currentTime - startTime
|
|
113
113
|
const progress = Math.min(timeElapsed / duration, 1)
|
|
114
114
|
const currentTransform = start + (end - start) * easeInOutQuad(progress)
|
|
115
115
|
setTransform(currentTransform)
|
|
116
|
-
if (
|
|
116
|
+
if (progress < 1) { requestAnimationFrame(animate) }
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
requestAnimationFrame(animate)
|
|
@@ -122,7 +122,7 @@ function animateTransform(start: number, end: number, duration: number) {
|
|
|
122
122
|
// Navigation
|
|
123
123
|
function goToSlide(index: number, isTouchNav = false) {
|
|
124
124
|
countSlides()
|
|
125
|
-
if (!isSliderAvailable || !bglSlider ||
|
|
125
|
+
if (!isSliderAvailable || !bglSlider || index < 0 || index >= slideCount) { return }
|
|
126
126
|
|
|
127
127
|
const containerWidth = bglSlider.offsetWidth
|
|
128
128
|
const gapWidth = (containerWidth * GAP_PERCENT) / 100
|
|
@@ -136,7 +136,7 @@ function goToSlide(index: number, isTouchNav = false) {
|
|
|
136
136
|
const currentTransform = getCurrentTransform()
|
|
137
137
|
const duration = isTouchNav
|
|
138
138
|
? ANIMATION_TIMINGS.TOUCH
|
|
139
|
-
:
|
|
139
|
+
: window.innerWidth < 600
|
|
140
140
|
? ANIMATION_TIMINGS.MOBILE
|
|
141
141
|
: ANIMATION_TIMINGS.DESKTOP
|
|
142
142
|
|
|
@@ -146,7 +146,7 @@ function goToSlide(index: number, isTouchNav = false) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
function next() {
|
|
149
|
-
if (!isSliderAvailable) {return}
|
|
149
|
+
if (!isSliderAvailable) { return }
|
|
150
150
|
countSlides()
|
|
151
151
|
// In RTL, next and prev are reversed
|
|
152
152
|
const nextIndex = props.rtl
|
|
@@ -156,7 +156,7 @@ function next() {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
function prev() {
|
|
159
|
-
if (!isSliderAvailable) {return}
|
|
159
|
+
if (!isSliderAvailable) { return }
|
|
160
160
|
countSlides()
|
|
161
161
|
// In RTL, next and prev are reversed
|
|
162
162
|
const prevIndex = props.rtl
|
|
@@ -167,10 +167,10 @@ function prev() {
|
|
|
167
167
|
|
|
168
168
|
// Height management
|
|
169
169
|
function calcHeight() {
|
|
170
|
-
if (!isSliderAvailable || !bglSlider) {return}
|
|
170
|
+
if (!isSliderAvailable || !bglSlider) { return }
|
|
171
171
|
try {
|
|
172
172
|
const activeSlide = bglSlider.children[activeSlideIndex]
|
|
173
|
-
if (!activeSlide) {return}
|
|
173
|
+
if (!activeSlide) { return }
|
|
174
174
|
const children = Array.from(activeSlide.children) as HTMLElement[]
|
|
175
175
|
const totalHeight = children.reduce((sum, el) => sum + el.clientHeight, 0)
|
|
176
176
|
yHeight = `${totalHeight}px`
|
|
@@ -180,13 +180,13 @@ function calcHeight() {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function updateHeight() {
|
|
183
|
-
if (!props.autoHeight) {return}
|
|
183
|
+
if (!props.autoHeight) { return }
|
|
184
184
|
setTimeout(calcHeight, 200)
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// Slide management
|
|
188
188
|
function countSlides() {
|
|
189
|
-
if (!isSliderAvailable || !bglSlider) {return}
|
|
189
|
+
if (!isSliderAvailable || !bglSlider) { return }
|
|
190
190
|
slideCount = bglSlider.children.length
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -198,10 +198,10 @@ function handleSlideChange() {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
function handleResize() {
|
|
201
|
-
if (!isSliderAvailable || !bglSlider) {return}
|
|
202
|
-
itemCount =
|
|
201
|
+
if (!isSliderAvailable || !bglSlider) { return }
|
|
202
|
+
itemCount = window.innerWidth < 600
|
|
203
203
|
? 1
|
|
204
|
-
:
|
|
204
|
+
: window.innerWidth < 991
|
|
205
205
|
? Math.min(props.items, 2)
|
|
206
206
|
: props.items
|
|
207
207
|
|
|
@@ -217,7 +217,7 @@ function handleResize() {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
function clearAutoplay() {
|
|
220
|
-
if (autoPlayInterval) {clearInterval(autoPlayInterval)}
|
|
220
|
+
if (autoPlayInterval) { clearInterval(autoPlayInterval) }
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// Mouse events
|
|
@@ -230,7 +230,7 @@ function preventDefaultClick(e: MouseEvent) {
|
|
|
230
230
|
|
|
231
231
|
async function disableDrag() {
|
|
232
232
|
await nextTick()
|
|
233
|
-
if (!isSliderAvailable || !bglSlider) {return}
|
|
233
|
+
if (!isSliderAvailable || !bglSlider) { return }
|
|
234
234
|
|
|
235
235
|
const elements = Array.from(bglSlider.querySelectorAll('img, a')) as HTMLElement[]
|
|
236
236
|
elements.forEach((el) => {
|
|
@@ -252,7 +252,7 @@ async function disableDrag() {
|
|
|
252
252
|
|
|
253
253
|
function startDrag(e: MouseEvent) {
|
|
254
254
|
e.stopPropagation()
|
|
255
|
-
if (
|
|
255
|
+
if (e.button !== 0 || !props.freeDrag || !isSliderAvailable) { return }
|
|
256
256
|
|
|
257
257
|
clearAutoplay()
|
|
258
258
|
startX = e.pageX
|
|
@@ -265,12 +265,12 @@ function startDrag(e: MouseEvent) {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
function onDrag(e: MouseEvent) {
|
|
268
|
-
if (!isSliderAvailable || !bglSlider || !isPressed) {return}
|
|
268
|
+
if (!isSliderAvailable || !bglSlider || !isPressed) { return }
|
|
269
269
|
|
|
270
270
|
const x = e.pageX
|
|
271
271
|
const distance = x - startX
|
|
272
272
|
|
|
273
|
-
if (Math.abs(distance) > THRESHOLDS.DRAG) {isDragging = true}
|
|
273
|
+
if (Math.abs(distance) > THRESHOLDS.DRAG) { isDragging = true }
|
|
274
274
|
if (isDragging) {
|
|
275
275
|
const newTranslate = translateX + (props.rtl ? -distance : distance)
|
|
276
276
|
const maxTranslate = 0
|
|
@@ -291,7 +291,7 @@ function endDrag() {
|
|
|
291
291
|
document.removeEventListener('mousemove', onDrag)
|
|
292
292
|
document.removeEventListener('mouseup', endDrag)
|
|
293
293
|
|
|
294
|
-
if (!isSliderAvailable || !bglSlider) {return}
|
|
294
|
+
if (!isSliderAvailable || !bglSlider) { return }
|
|
295
295
|
|
|
296
296
|
const currentTransform = getCurrentTransform()
|
|
297
297
|
const singleItemWidth = bglSlider.offsetWidth / itemCount
|
|
@@ -302,8 +302,8 @@ function endDrag() {
|
|
|
302
302
|
|
|
303
303
|
let targetPanel = currentPanel
|
|
304
304
|
if (dragPercentage > THRESHOLDS.SWIPE_PERCENT) {
|
|
305
|
-
const distnace =
|
|
306
|
-
targetPanel = Math.floor(currentPanel) + (
|
|
305
|
+
const distnace = totalDragDistance > 0 ? -1 : 1
|
|
306
|
+
targetPanel = Math.floor(currentPanel) + (distnace < 0 ? 0 : 1)
|
|
307
307
|
} else {
|
|
308
308
|
targetPanel = Math.round(currentPanel)
|
|
309
309
|
}
|
|
@@ -324,7 +324,7 @@ let hasScrollDirectionLock = $ref(false)
|
|
|
324
324
|
let isHorizontalScroll = $ref(false)
|
|
325
325
|
|
|
326
326
|
function onTouchStart(e: TouchEvent) {
|
|
327
|
-
if (!props.freeDrag || !isSliderAvailable) {return}
|
|
327
|
+
if (!props.freeDrag || !isSliderAvailable) { return }
|
|
328
328
|
|
|
329
329
|
const target = e.target as HTMLElement
|
|
330
330
|
const isInteractive = target.matches('button, a, input, select, textarea, [role="button"]')
|
|
@@ -351,7 +351,7 @@ function onTouchStart(e: TouchEvent) {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
function onTouchMove(e: TouchEvent) {
|
|
354
|
-
if (!isSliderAvailable || !bglSlider || !isPressed) {return}
|
|
354
|
+
if (!isSliderAvailable || !bglSlider || !isPressed) { return }
|
|
355
355
|
|
|
356
356
|
const touch = e.touches[0]
|
|
357
357
|
const x = touch.pageX
|
|
@@ -362,7 +362,7 @@ function onTouchMove(e: TouchEvent) {
|
|
|
362
362
|
// Determine scroll direction if we haven't already
|
|
363
363
|
if (!hasScrollDirectionLock) {
|
|
364
364
|
// Only lock in a direction if there's significant movement
|
|
365
|
-
if (
|
|
365
|
+
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
|
|
366
366
|
isHorizontalScroll = Math.abs(deltaX) > Math.abs(deltaY)
|
|
367
367
|
hasScrollDirectionLock = true
|
|
368
368
|
|
|
@@ -377,7 +377,7 @@ function onTouchMove(e: TouchEvent) {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
// If we've determined this is a vertical scroll, don't handle the touch
|
|
380
|
-
if (!isHorizontalScroll) {return}
|
|
380
|
+
if (!isHorizontalScroll) { return }
|
|
381
381
|
|
|
382
382
|
// Update velocity tracking
|
|
383
383
|
const now = Date.now()
|
|
@@ -404,7 +404,7 @@ function onTouchMove(e: TouchEvent) {
|
|
|
404
404
|
let newTranslate = translateX + (props.rtl ? -deltaX : deltaX)
|
|
405
405
|
|
|
406
406
|
// Add smooth resistance when pulling beyond bounds
|
|
407
|
-
if (
|
|
407
|
+
if (newTranslate > 0) {
|
|
408
408
|
newTranslate *= 0.5 // Softer resistance at start
|
|
409
409
|
} else if (newTranslate < -totalWidth + containerWidth) {
|
|
410
410
|
const overDrag = -totalWidth + containerWidth - newTranslate
|
|
@@ -433,7 +433,7 @@ function onTouchEnd() {
|
|
|
433
433
|
|
|
434
434
|
// Normalize the transform value to handle overscroll
|
|
435
435
|
let normalizedTransform = currentTransform
|
|
436
|
-
if (
|
|
436
|
+
if (currentTransform > 0) {
|
|
437
437
|
normalizedTransform = 0
|
|
438
438
|
} else {
|
|
439
439
|
const minTransform = -(singleItemWidth * (slideCount - 1) + gapWidth * (slideCount - 1))
|
|
@@ -455,14 +455,14 @@ function onTouchEnd() {
|
|
|
455
455
|
|
|
456
456
|
// Determine direction based on velocity and distance
|
|
457
457
|
if (Math.abs(finalVelocity) > THRESHOLDS.VELOCITY) {
|
|
458
|
-
velocityDirection =
|
|
458
|
+
velocityDirection = finalVelocity < 0 ? 1 : -1
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
-
const isMobile =
|
|
461
|
+
const isMobile = window.innerWidth < 600
|
|
462
462
|
|
|
463
463
|
if (swipePercentage > THRESHOLDS.SWIPE_PERCENT || Math.abs(finalVelocity) > THRESHOLDS.VELOCITY) {
|
|
464
464
|
const direction = swipePercentage > THRESHOLDS.SWIPE_PERCENT
|
|
465
|
-
? (
|
|
465
|
+
? (totalSwipeDistance > 0 ? -1 : 1)
|
|
466
466
|
: velocityDirection
|
|
467
467
|
|
|
468
468
|
// Apply RTL correction to direction
|
|
@@ -500,7 +500,7 @@ function onTouchEnd() {
|
|
|
500
500
|
|
|
501
501
|
// Clear transition after animation
|
|
502
502
|
setTimeout(() => {
|
|
503
|
-
if (bglSlider) {bglSlider.style.transition = 'none'}
|
|
503
|
+
if (bglSlider) { bglSlider.style.transition = 'none' }
|
|
504
504
|
}, duration)
|
|
505
505
|
|
|
506
506
|
velocityTracker = []
|
|
@@ -510,13 +510,13 @@ function onTouchEnd() {
|
|
|
510
510
|
|
|
511
511
|
// Wheel events
|
|
512
512
|
function onWheel(e: WheelEvent) {
|
|
513
|
-
if (!props.allowScroll || !isSliderAvailable || !bglSlider || isPressed || isDragging) {return}
|
|
513
|
+
if (!props.allowScroll || !isSliderAvailable || !bglSlider || isPressed || isDragging) { return }
|
|
514
514
|
|
|
515
515
|
const isHorizontal = Math.abs(e.deltaX) > Math.abs(e.deltaY)
|
|
516
|
-
if (!isHorizontal) {return}
|
|
516
|
+
if (!isHorizontal) { return }
|
|
517
517
|
|
|
518
518
|
clearAutoplay()
|
|
519
|
-
if (wheelTimeout) {clearTimeout(wheelTimeout)}
|
|
519
|
+
if (wheelTimeout) { clearTimeout(wheelTimeout) }
|
|
520
520
|
|
|
521
521
|
// Reverse the delta direction for RTL mode
|
|
522
522
|
accumulatedDeltaX += props.rtl ? -e.deltaX : e.deltaX
|
|
@@ -529,7 +529,7 @@ function onWheel(e: WheelEvent) {
|
|
|
529
529
|
const moveThreshold = singleItemWidth * THRESHOLDS.WHEEL_PERCENT
|
|
530
530
|
|
|
531
531
|
if (Math.abs(accumulatedDeltaX) > moveThreshold) {
|
|
532
|
-
const direction =
|
|
532
|
+
const direction = accumulatedDeltaX > 0 ? 1 : -1
|
|
533
533
|
const nextPanel = Math.max(0, Math.min(activeSlideIndex + direction, slideCount - 1))
|
|
534
534
|
|
|
535
535
|
if (nextPanel !== activeSlideIndex) {
|
|
@@ -567,8 +567,8 @@ onUnmounted(() => {
|
|
|
567
567
|
document.removeEventListener('mousemove', onDrag)
|
|
568
568
|
document.removeEventListener('mouseup', endDrag)
|
|
569
569
|
clearAutoplay()
|
|
570
|
-
if (timeout) {clearTimeout(timeout)}
|
|
571
|
-
if (wheelTimeout) {clearTimeout(wheelTimeout)}
|
|
570
|
+
if (timeout) { clearTimeout(timeout) }
|
|
571
|
+
if (wheelTimeout) { clearTimeout(wheelTimeout) }
|
|
572
572
|
})
|
|
573
573
|
|
|
574
574
|
// Watchers
|
|
@@ -80,7 +80,7 @@ const bind = $computed(() => {
|
|
|
80
80
|
{{ title }}
|
|
81
81
|
<slot />
|
|
82
82
|
</p>
|
|
83
|
-
<p v-if="subtitle" class="txt12 m-0
|
|
83
|
+
<p v-if="subtitle" class="txt12 m-0 m-0 py-0 ps-0 pe-1-5 opacity-7 me-2" :class="{ 'ellipsis-1': ellipsis }">
|
|
84
84
|
{{ subtitle }}
|
|
85
85
|
<slot name="subtitle" />
|
|
86
86
|
</p>
|
|
@@ -89,7 +89,7 @@ const bind = $computed(() => {
|
|
|
89
89
|
</component>
|
|
90
90
|
<slot name="end">
|
|
91
91
|
<Icon v-if="iconEnd" :icon="iconEnd" class="transition-400" />
|
|
92
|
-
<p v-if="end" class="txt12 m-0
|
|
92
|
+
<p v-if="end" class="txt12 m-0 py-0 ps-0 pe-1-5 opacity-7 " :class="{ 'ellipsis-1': ellipsis }" v-text="end" />
|
|
93
93
|
</slot>
|
|
94
94
|
</div>
|
|
95
95
|
</template>
|