winduum 2.2.26 → 2.2.27
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 +19 -15
- package/src/polyfills/timelineTrigger.js +54 -0
- package/src/supports.js +4 -0
- package/types/index.d.ts +6 -0
- package/types/index.d.ts.map +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "winduum",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"main": "plugin/index.cjs",
|
|
@@ -21,26 +21,26 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@eslint/js": "^10.0.1",
|
|
23
23
|
"@floating-ui/dom": "^1.7.6",
|
|
24
|
-
"@stylistic/eslint-plugin": "^5.
|
|
25
|
-
"@stylistic/stylelint-config": "^
|
|
26
|
-
"@tailwindcss/vite": "^4.
|
|
27
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
28
|
-
"autoprefixer": "^10.
|
|
29
|
-
"dts-buddy": "^0.
|
|
30
|
-
"eslint": "^10.0
|
|
24
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
25
|
+
"@stylistic/stylelint-config": "^5.0.0",
|
|
26
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
27
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
28
|
+
"autoprefixer": "^10.5.0",
|
|
29
|
+
"dts-buddy": "^0.8.0",
|
|
30
|
+
"eslint": "^10.4.0",
|
|
31
31
|
"fast-glob": "^3.3.3",
|
|
32
|
-
"globals": "^17.
|
|
33
|
-
"postcss": "^8.5.
|
|
32
|
+
"globals": "^17.6.0",
|
|
33
|
+
"postcss": "^8.5.15",
|
|
34
34
|
"postcss-custom-media": "^12.0.1",
|
|
35
35
|
"postcss-import": "^16.1.1",
|
|
36
36
|
"postcss-nesting": "^14.0.0",
|
|
37
37
|
"slide-element": "^2.3.1",
|
|
38
|
-
"stylelint": "^17.
|
|
38
|
+
"stylelint": "^17.12.0",
|
|
39
39
|
"stylelint-config-standard": "^40.0.0",
|
|
40
|
-
"tailwindcss": "^4.
|
|
41
|
-
"typescript": "^
|
|
42
|
-
"vite": "^
|
|
43
|
-
"vue": "^3.5.
|
|
40
|
+
"tailwindcss": "^4.3.0",
|
|
41
|
+
"typescript": "^6",
|
|
42
|
+
"vite": "^8.0.14",
|
|
43
|
+
"vue": "^3.5.34"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"index.js",
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"import": "./plugin/index.js",
|
|
59
59
|
"default": "./plugin/index.js"
|
|
60
60
|
},
|
|
61
|
+
"./supports": {
|
|
62
|
+
"types": "./types/index.d.ts",
|
|
63
|
+
"default": "./src/supports.js"
|
|
64
|
+
},
|
|
61
65
|
"./src/*": "./src/*",
|
|
62
66
|
"./tailwindcss/*": "./tailwindcss/*",
|
|
63
67
|
"./dist/*": "./dist/*",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const selector = '[class*="timeline-trigger-"]'
|
|
2
|
+
|
|
3
|
+
const getThreshold = (style, property, fallback) => {
|
|
4
|
+
const value = parseFloat(style.getPropertyValue(property))
|
|
5
|
+
|
|
6
|
+
return Number.isNaN(value) ? fallback : value / 100
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const observeElement = (element) => {
|
|
10
|
+
if (element._timelineTriggerObserver) return
|
|
11
|
+
|
|
12
|
+
const style = getComputedStyle(element)
|
|
13
|
+
const enter = getThreshold(style, '--tw-timeline-trigger-entry', 0.2)
|
|
14
|
+
const exit = getThreshold(style, '--tw-timeline-trigger-exit', 0)
|
|
15
|
+
|
|
16
|
+
element._timelineTriggerObserver = new IntersectionObserver(([entry]) => {
|
|
17
|
+
if (entry.isIntersecting && entry.intersectionRatio >= enter) {
|
|
18
|
+
element.setAttribute('data-enter', '')
|
|
19
|
+
}
|
|
20
|
+
else if (entry.intersectionRatio <= exit) {
|
|
21
|
+
element.removeAttribute('data-enter')
|
|
22
|
+
}
|
|
23
|
+
}, { threshold: [exit, enter] })
|
|
24
|
+
|
|
25
|
+
element._timelineTriggerObserver.observe(element)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const unobserveElement = (element) => {
|
|
29
|
+
element._timelineTriggerObserver?.disconnect()
|
|
30
|
+
delete element._timelineTriggerObserver
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const observe = (node) => {
|
|
34
|
+
if (node.nodeType !== 1) return
|
|
35
|
+
|
|
36
|
+
if (node.matches(selector)) observeElement(node)
|
|
37
|
+
|
|
38
|
+
node.querySelectorAll(selector).forEach(observeElement)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const unobserve = (node) => {
|
|
42
|
+
if (node.nodeType !== 1) return
|
|
43
|
+
|
|
44
|
+
if (node.matches(selector)) unobserveElement(node)
|
|
45
|
+
|
|
46
|
+
node.querySelectorAll(selector).forEach(unobserveElement)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
document.querySelectorAll(selector).forEach(observeElement)
|
|
50
|
+
|
|
51
|
+
new MutationObserver(mutations => mutations.forEach(({ addedNodes, removedNodes }) => {
|
|
52
|
+
addedNodes.forEach(observe)
|
|
53
|
+
removedNodes.forEach(unobserve)
|
|
54
|
+
})).observe(document.documentElement, { childList: true, subtree: true })
|
package/src/supports.js
ADDED
package/types/index.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ declare module 'winduum' {
|
|
|
27
27
|
export {};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
declare module 'winduum/supports' {
|
|
31
|
+
export const supportsTimelineTrigger: boolean;
|
|
32
|
+
|
|
33
|
+
export {};
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
declare module 'winduum/src/components/carousel' {
|
|
31
37
|
export interface ObserveCarouselOptions {
|
|
32
38
|
visibleAttribute?: string
|
package/types/index.d.ts.map
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"PluginOptions",
|
|
6
6
|
"defaultConfig",
|
|
7
7
|
"createPlugin",
|
|
8
|
+
"supportsTimelineTrigger",
|
|
8
9
|
"ObserveCarouselOptions",
|
|
9
10
|
"PaginationCarouselOptions",
|
|
10
11
|
"ScrollCarouselOptions",
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
],
|
|
66
67
|
"sources": [
|
|
67
68
|
"../plugin/index.d.ts",
|
|
69
|
+
"../src/supports.js",
|
|
68
70
|
"../src/components/carousel/index.d.ts",
|
|
69
71
|
"../src/components/compare/index.d.ts",
|
|
70
72
|
"../src/components/details/index.d.ts",
|
|
@@ -93,8 +95,9 @@
|
|
|
93
95
|
null,
|
|
94
96
|
null,
|
|
95
97
|
null,
|
|
98
|
+
null,
|
|
96
99
|
null
|
|
97
100
|
],
|
|
98
|
-
"mappings": ";;kBAEiBA,aAAaA;;;;;;;;;;;;;;;;;;;;cAoBjBC,aAAaA;;yBAEFC,YAAYA;;;;;;
|
|
101
|
+
"mappings": ";;kBAEiBA,aAAaA;;;;;;;;;;;;;;;;;;;;cAoBjBC,aAAaA;;yBAEFC,YAAYA;;;;;;cCrBvBC,uBAAuBA;;;;;;kBCHnBC,sBAAsBA;;;;;;;;kBAQtBC,yBAAyBA;;;;;;kBAMzBC,qBAAqBA;;;;;;;;kBAQrBC,uBAAuBA;;;;;kBAKvBC,mBAAmBA;;;;iBAIpBC,UAAUA;iBACVC,UAAUA;iBACVC,QAAQA;iBACRC,YAAYA;iBACZC,eAAeA;iBACfC,cAAcA;iBACdC,kBAAkBA;iBAClBC,gBAAgBA;iBAChBC,YAAYA;;;;;;kBCvCXC,kBAAkBA;;;;;iBAKnBC,WAAWA;iBACXC,eAAeA;iBACfC,YAAYA;;;;;;kBCPXC,cAAcA;;;;;cAKlBC,cAAcA;iBACXC,WAAWA;iBACXC,YAAYA;iBACZC,aAAaA;;;;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