@bagelink/vue 1.9.75 → 1.9.79
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/lightbox/index.d.ts.map +1 -1
- package/dist/composables/useLocalStore.d.ts.map +1 -1
- package/dist/composables/useTheme.d.ts.map +1 -1
- package/dist/directives/pattern.d.ts +1 -0
- package/dist/directives/pattern.d.ts.map +1 -1
- package/dist/directives/ripple.d.ts.map +1 -1
- package/dist/directives/vResize.d.ts.map +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.mjs +3430 -3415
- package/package.json +1 -1
- package/src/components/lightbox/index.ts +6 -2
- package/src/composables/useDevice.ts +7 -7
- package/src/composables/useLocalStore.ts +5 -3
- package/src/composables/useTheme.ts +5 -2
- package/src/directives/pattern.ts +3 -0
- package/src/directives/ripple.ts +3 -0
- package/src/directives/vResize.ts +4 -1
- package/src/utils/showdown.ts +1 -1
package/package.json
CHANGED
|
@@ -27,7 +27,10 @@ const lightboxDirective: Directive = {
|
|
|
27
27
|
},
|
|
28
28
|
unmounted(el: HTMLElement) {
|
|
29
29
|
el.removeEventListener('click', clickHandler)
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
getSSRProps() {
|
|
32
|
+
return {}
|
|
33
|
+
},
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
function groupHandler(item: LightboxItem) {
|
|
@@ -77,7 +80,8 @@ function determineFileType(url: any): string {
|
|
|
77
80
|
|
|
78
81
|
let lightboxInstance: InstanceType<typeof Lightbox> | undefined
|
|
79
82
|
|
|
80
|
-
function getLightboxInstance(): InstanceType<typeof Lightbox> {
|
|
83
|
+
function getLightboxInstance(): InstanceType<typeof Lightbox> | undefined {
|
|
84
|
+
if (typeof document === 'undefined') { return undefined }
|
|
81
85
|
if (!lightboxInstance) {
|
|
82
86
|
const lightboxEl = document.createElement('div')
|
|
83
87
|
document.body.prepend(lightboxEl)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { onMounted, onUnmounted, ref } from 'vue'
|
|
2
2
|
|
|
3
3
|
export function useDevice() {
|
|
4
|
-
const innerWidth = ref(
|
|
5
|
-
const isMobile = ref(
|
|
6
|
-
const scrollY = ref(
|
|
7
|
-
const scrollX = ref(
|
|
8
|
-
const innerHeight = ref(
|
|
4
|
+
const innerWidth = ref(0)
|
|
5
|
+
const isMobile = ref(false)
|
|
6
|
+
const scrollY = ref(0)
|
|
7
|
+
const scrollX = ref(0)
|
|
8
|
+
const innerHeight = ref(0)
|
|
9
9
|
|
|
10
10
|
// Scroll direction tracking
|
|
11
11
|
const scrollDirY = ref<'up' | 'down' | null>(null)
|
|
12
12
|
const scrollDirX = ref<'left' | 'right' | null>(null)
|
|
13
|
-
const prevScrollY = ref(
|
|
14
|
-
const prevScrollX = ref(
|
|
13
|
+
const prevScrollY = ref(0)
|
|
14
|
+
const prevScrollX = ref(0)
|
|
15
15
|
|
|
16
16
|
function updateDeviceInfo() {
|
|
17
17
|
// Store previous scroll positions
|
|
@@ -8,8 +8,10 @@ type LocalStoreTyped<T extends LocalStoreDefaults> = { [K in keyof T]: Ref<T[K]
|
|
|
8
8
|
const _localStoreCache: Record<string, Ref> = {}
|
|
9
9
|
let _storageListenerRegistered = false
|
|
10
10
|
|
|
11
|
+
const isBrowser = typeof window !== 'undefined'
|
|
12
|
+
|
|
11
13
|
function _ensureListener() {
|
|
12
|
-
if (_storageListenerRegistered) return
|
|
14
|
+
if (!isBrowser || _storageListenerRegistered) return
|
|
13
15
|
_storageListenerRegistered = true
|
|
14
16
|
window.addEventListener('storage', (e) => {
|
|
15
17
|
if (e.key !== null && e.key in _localStoreCache) {
|
|
@@ -20,10 +22,10 @@ function _ensureListener() {
|
|
|
20
22
|
|
|
21
23
|
function _getRef<T>(key: string, defaultValue: T | null = null): Ref<T | null> {
|
|
22
24
|
if (!(key in _localStoreCache)) {
|
|
23
|
-
const stored = localStorage.getItem(key)
|
|
25
|
+
const stored = isBrowser ? localStorage.getItem(key) : null
|
|
24
26
|
_localStoreCache[key] = ref(stored !== null ? JSON.parse(stored) : defaultValue)
|
|
25
27
|
watch(_localStoreCache[key], (val) => {
|
|
26
|
-
localStorage.setItem(key, JSON.stringify(val))
|
|
28
|
+
if (isBrowser) localStorage.setItem(key, JSON.stringify(val))
|
|
27
29
|
})
|
|
28
30
|
}
|
|
29
31
|
return _localStoreCache[key] as Ref<T | null>
|
|
@@ -37,8 +37,10 @@ const STORAGE_KEY = 'color-mode'
|
|
|
37
37
|
const colorMode = ref<string>('system')
|
|
38
38
|
const isDark = ref(false)
|
|
39
39
|
|
|
40
|
+
const isBrowser = typeof window !== 'undefined'
|
|
41
|
+
|
|
40
42
|
function getSystemPrefersDark() {
|
|
41
|
-
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
43
|
+
return isBrowser && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
function findTheme(value: string) {
|
|
@@ -46,6 +48,7 @@ function findTheme(value: string) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
function applyTheme(themeValue: string) {
|
|
51
|
+
if (!isBrowser) return
|
|
49
52
|
const root = document.documentElement
|
|
50
53
|
|
|
51
54
|
// Remove all theme classes
|
|
@@ -139,7 +142,7 @@ export function useTheme() {
|
|
|
139
142
|
|
|
140
143
|
// Watch for mode changes
|
|
141
144
|
watch(colorMode, (newMode) => {
|
|
142
|
-
|
|
145
|
+
if (isBrowser) localStorage.setItem(STORAGE_KEY, newMode)
|
|
143
146
|
applyTheme(newMode)
|
|
144
147
|
})
|
|
145
148
|
|
package/src/directives/ripple.ts
CHANGED
package/src/utils/showdown.ts
CHANGED
|
@@ -675,7 +675,7 @@ showdown.Converter = function (this: any, converterOptions?: ShowdownOptions) {
|
|
|
675
675
|
src = src.replace(/>[ \t]+</, '>¨NBSP;<')
|
|
676
676
|
|
|
677
677
|
if (!HTMLParser) {
|
|
678
|
-
if (window && window.document) {
|
|
678
|
+
if (typeof window !== 'undefined' && window.document) {
|
|
679
679
|
HTMLParser = window.document
|
|
680
680
|
} else {
|
|
681
681
|
throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM')
|