@vanduo-oss/framework 1.3.3 → 1.3.4
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/README.md +14 -4
- package/css/components/cards.css +8 -0
- package/css/components/dropdown.css +8 -0
- package/css/components/fab.css +14 -0
- package/css/components/modals.css +13 -0
- package/css/components/navbar.css +30 -0
- package/css/components/toast.css +8 -0
- package/css/components/tooltips.css +29 -0
- package/css/core/tokens.css +37 -0
- package/css/core/vd-aliases.css +13 -0
- package/css/effects/glass.css +154 -0
- package/css/vanduo.css +1 -0
- package/dist/build-info.json +3 -3
- package/dist/vanduo.cjs.js +96 -3
- package/dist/vanduo.cjs.js.map +3 -3
- package/dist/vanduo.cjs.min.js +4 -4
- package/dist/vanduo.cjs.min.js.map +4 -4
- package/dist/vanduo.css +261 -1
- package/dist/vanduo.css.map +1 -1
- package/dist/vanduo.esm.js +96 -3
- package/dist/vanduo.esm.js.map +3 -3
- package/dist/vanduo.esm.min.js +4 -4
- package/dist/vanduo.esm.min.js.map +4 -4
- package/dist/vanduo.js +96 -3
- package/dist/vanduo.js.map +3 -3
- package/dist/vanduo.min.css +2 -2
- package/dist/vanduo.min.css.map +1 -1
- package/dist/vanduo.min.js +4 -4
- package/dist/vanduo.min.js.map +4 -4
- package/js/components/glass.js +87 -0
- package/js/components/navbar.js +44 -3
- package/js/index.js +3 -0
- package/package.json +1 -1
package/dist/vanduo.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Vanduo v1.3.
|
|
1
|
+
/*! Vanduo v1.3.4 | Built: 2026-04-14T21:21:55.517Z | git:73e3db5 | development */
|
|
2
2
|
|
|
3
3
|
// js/utils/lifecycle.js
|
|
4
4
|
(function() {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
// js/vanduo.js
|
|
108
108
|
(function() {
|
|
109
109
|
"use strict";
|
|
110
|
-
const VANDUO_VERSION = true ? "1.3.
|
|
110
|
+
const VANDUO_VERSION = true ? "1.3.4" : "0.0.0-dev";
|
|
111
111
|
const Vanduo2 = {
|
|
112
112
|
version: VANDUO_VERSION,
|
|
113
113
|
components: {},
|
|
@@ -2157,6 +2157,31 @@
|
|
|
2157
2157
|
this.initNavbar(navbar);
|
|
2158
2158
|
});
|
|
2159
2159
|
},
|
|
2160
|
+
/**
|
|
2161
|
+
* Initialize scroll-aware glass/transparent behaviour for a navbar.
|
|
2162
|
+
* Adds/removes `.vd-navbar-scrolled` when the page scrolls past a threshold.
|
|
2163
|
+
* Threshold: `data-scroll-threshold` attribute (px) or the navbar's own height.
|
|
2164
|
+
* @param {HTMLElement} navbar - Navbar element
|
|
2165
|
+
* @returns {Function|null} Cleanup function, or null if not applicable
|
|
2166
|
+
*/
|
|
2167
|
+
initScrollWatcher: function(navbar) {
|
|
2168
|
+
const isGlass = navbar.classList.contains("vd-navbar-glass");
|
|
2169
|
+
const isTransparent = navbar.classList.contains("vd-navbar-transparent");
|
|
2170
|
+
if (!isGlass && !isTransparent) {
|
|
2171
|
+
return null;
|
|
2172
|
+
}
|
|
2173
|
+
const getThreshold = () => {
|
|
2174
|
+
const attr = parseInt(navbar.dataset.scrollThreshold, 10);
|
|
2175
|
+
return isNaN(attr) ? navbar.offsetHeight || 60 : attr;
|
|
2176
|
+
};
|
|
2177
|
+
const onScroll = () => {
|
|
2178
|
+
const scrolled = window.scrollY > getThreshold();
|
|
2179
|
+
navbar.classList.toggle("vd-navbar-scrolled", scrolled);
|
|
2180
|
+
};
|
|
2181
|
+
onScroll();
|
|
2182
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
2183
|
+
return () => window.removeEventListener("scroll", onScroll);
|
|
2184
|
+
},
|
|
2160
2185
|
/**
|
|
2161
2186
|
* Initialize a single navbar
|
|
2162
2187
|
* @param {HTMLElement} navbar - Navbar element
|
|
@@ -2165,10 +2190,17 @@
|
|
|
2165
2190
|
const toggle = navbar.querySelector(".vd-navbar-toggle, .vd-navbar-burger");
|
|
2166
2191
|
const menu = navbar.querySelector(".vd-navbar-menu");
|
|
2167
2192
|
const overlay = navbar.querySelector(".vd-navbar-overlay") || this.createOverlay(navbar);
|
|
2193
|
+
const cleanupFunctions = [];
|
|
2194
|
+
const scrollWatcherCleanup = this.initScrollWatcher(navbar);
|
|
2195
|
+
if (scrollWatcherCleanup) {
|
|
2196
|
+
cleanupFunctions.push(scrollWatcherCleanup);
|
|
2197
|
+
}
|
|
2168
2198
|
if (!toggle || !menu) {
|
|
2199
|
+
if (cleanupFunctions.length) {
|
|
2200
|
+
this.instances.set(navbar, { toggle: null, menu: null, overlay: null, cleanup: cleanupFunctions });
|
|
2201
|
+
}
|
|
2169
2202
|
return;
|
|
2170
2203
|
}
|
|
2171
|
-
const cleanupFunctions = [];
|
|
2172
2204
|
const toggleClickHandler = (e) => {
|
|
2173
2205
|
e.preventDefault();
|
|
2174
2206
|
e.stopPropagation();
|
|
@@ -6479,6 +6511,67 @@
|
|
|
6479
6511
|
window.VanduoLazyLoad = VanduoLazyLoad;
|
|
6480
6512
|
})();
|
|
6481
6513
|
|
|
6514
|
+
// js/components/glass.js
|
|
6515
|
+
(function() {
|
|
6516
|
+
"use strict";
|
|
6517
|
+
const GlassScroll = {
|
|
6518
|
+
/** @type {Map<Element, IntersectionObserver>} */
|
|
6519
|
+
observers: /* @__PURE__ */ new Map(),
|
|
6520
|
+
init: function() {
|
|
6521
|
+
document.querySelectorAll("[data-glass-scroll]").forEach((el) => {
|
|
6522
|
+
if (this.observers.has(el)) return;
|
|
6523
|
+
this.initElement(el);
|
|
6524
|
+
});
|
|
6525
|
+
},
|
|
6526
|
+
/**
|
|
6527
|
+
* Wire up a single scroll-activated glass element.
|
|
6528
|
+
* @param {HTMLElement} el
|
|
6529
|
+
*/
|
|
6530
|
+
initElement: function(el) {
|
|
6531
|
+
const sentinelSelector = el.dataset.glassSentinel;
|
|
6532
|
+
let sentinel;
|
|
6533
|
+
if (sentinelSelector) {
|
|
6534
|
+
sentinel = document.querySelector(sentinelSelector);
|
|
6535
|
+
}
|
|
6536
|
+
if (!sentinel) {
|
|
6537
|
+
sentinel = el.previousElementSibling;
|
|
6538
|
+
}
|
|
6539
|
+
if (!sentinel) {
|
|
6540
|
+
el.classList.add("is-glass-active");
|
|
6541
|
+
return;
|
|
6542
|
+
}
|
|
6543
|
+
const observer = new IntersectionObserver(
|
|
6544
|
+
(entries) => {
|
|
6545
|
+
entries.forEach((entry) => {
|
|
6546
|
+
el.classList.toggle("is-glass-active", !entry.isIntersecting);
|
|
6547
|
+
});
|
|
6548
|
+
},
|
|
6549
|
+
{ threshold: 0, rootMargin: "0px" }
|
|
6550
|
+
);
|
|
6551
|
+
observer.observe(sentinel);
|
|
6552
|
+
this.observers.set(el, observer);
|
|
6553
|
+
},
|
|
6554
|
+
/**
|
|
6555
|
+
* Disconnect and remove a single element's observer.
|
|
6556
|
+
* @param {HTMLElement} el
|
|
6557
|
+
*/
|
|
6558
|
+
destroy: function(el) {
|
|
6559
|
+
const observer = this.observers.get(el);
|
|
6560
|
+
if (observer) {
|
|
6561
|
+
observer.disconnect();
|
|
6562
|
+
this.observers.delete(el);
|
|
6563
|
+
}
|
|
6564
|
+
},
|
|
6565
|
+
destroyAll: function() {
|
|
6566
|
+
this.observers.forEach((observer, el) => this.destroy(el));
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
if (typeof window.Vanduo !== "undefined") {
|
|
6570
|
+
window.Vanduo.register("glassScroll", GlassScroll);
|
|
6571
|
+
}
|
|
6572
|
+
window.VanduoGlassScroll = GlassScroll;
|
|
6573
|
+
})();
|
|
6574
|
+
|
|
6482
6575
|
// js/components/flow.js
|
|
6483
6576
|
(function() {
|
|
6484
6577
|
"use strict";
|