@vanduo-oss/framework 1.3.4 → 1.3.5
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/LICENSE +0 -14
- package/README.md +33 -176
- package/css/components/tooltips.css +8 -8
- package/css/effects/morph.css +259 -0
- package/css/vanduo.css +1 -0
- package/dist/build-info.json +3 -3
- package/dist/vanduo.cjs.js +113 -2
- 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 +241 -9
- package/dist/vanduo.css.map +1 -1
- package/dist/vanduo.esm.js +113 -2
- 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 +113 -2
- 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/morph.js +137 -0
- package/js/index.js +2 -1
- package/package.json +1 -1
package/dist/vanduo.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Vanduo v1.3.
|
|
1
|
+
/*! Vanduo v1.3.5 | Built: 2026-04-15T18:39:53.955Z | git:3ca4f62 | 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.5" : "0.0.0-dev";
|
|
111
111
|
const Vanduo2 = {
|
|
112
112
|
version: VANDUO_VERSION,
|
|
113
113
|
components: {},
|
|
@@ -6572,6 +6572,117 @@
|
|
|
6572
6572
|
window.VanduoGlassScroll = GlassScroll;
|
|
6573
6573
|
})();
|
|
6574
6574
|
|
|
6575
|
+
// js/components/morph.js
|
|
6576
|
+
(function() {
|
|
6577
|
+
"use strict";
|
|
6578
|
+
const MORPH_DURATION_MS = 750;
|
|
6579
|
+
const Morph = {
|
|
6580
|
+
instances: /* @__PURE__ */ new Map(),
|
|
6581
|
+
init: function() {
|
|
6582
|
+
const elements = document.querySelectorAll(".vd-morph, [data-vd-morph]");
|
|
6583
|
+
elements.forEach(function(el) {
|
|
6584
|
+
if (Morph.instances.has(el)) return;
|
|
6585
|
+
if (el.getAttribute("data-vd-morph") === "manual") return;
|
|
6586
|
+
Morph.initInstance(el);
|
|
6587
|
+
});
|
|
6588
|
+
},
|
|
6589
|
+
initInstance: function(el) {
|
|
6590
|
+
Morph._ensureLayers(el);
|
|
6591
|
+
const cleanup = [];
|
|
6592
|
+
let morphing = false;
|
|
6593
|
+
const handleClick = function(e) {
|
|
6594
|
+
if (morphing) return;
|
|
6595
|
+
Morph._runMorph(el, e, function() {
|
|
6596
|
+
morphing = false;
|
|
6597
|
+
});
|
|
6598
|
+
morphing = true;
|
|
6599
|
+
};
|
|
6600
|
+
el.addEventListener("click", handleClick);
|
|
6601
|
+
cleanup.push(function() {
|
|
6602
|
+
el.removeEventListener("click", handleClick);
|
|
6603
|
+
});
|
|
6604
|
+
this.instances.set(el, { cleanup });
|
|
6605
|
+
},
|
|
6606
|
+
morph: function(el) {
|
|
6607
|
+
if (!el) return;
|
|
6608
|
+
if (!this.instances.has(el)) this.initInstance(el);
|
|
6609
|
+
this._runMorph(el, null, null);
|
|
6610
|
+
},
|
|
6611
|
+
destroy: function(el) {
|
|
6612
|
+
const instance = this.instances.get(el);
|
|
6613
|
+
if (!instance) return;
|
|
6614
|
+
instance.cleanup.forEach(function(fn) {
|
|
6615
|
+
fn();
|
|
6616
|
+
});
|
|
6617
|
+
this.instances.delete(el);
|
|
6618
|
+
},
|
|
6619
|
+
destroyAll: function() {
|
|
6620
|
+
this.instances.forEach(function(_, el) {
|
|
6621
|
+
Morph.destroy(el);
|
|
6622
|
+
});
|
|
6623
|
+
},
|
|
6624
|
+
/* ── Internal helpers ── */
|
|
6625
|
+
_ensureLayers: function(el) {
|
|
6626
|
+
if (!el.querySelector(".vd-morph-wave")) {
|
|
6627
|
+
const wave = document.createElement("span");
|
|
6628
|
+
wave.className = "vd-morph-wave";
|
|
6629
|
+
wave.setAttribute("aria-hidden", "true");
|
|
6630
|
+
el.insertBefore(wave, el.firstChild);
|
|
6631
|
+
}
|
|
6632
|
+
if (!el.querySelector(".vd-morph-shine")) {
|
|
6633
|
+
const shine = document.createElement("span");
|
|
6634
|
+
shine.className = "vd-morph-shine";
|
|
6635
|
+
shine.setAttribute("aria-hidden", "true");
|
|
6636
|
+
const waveEl = el.querySelector(".vd-morph-wave");
|
|
6637
|
+
if (waveEl && waveEl.nextSibling) {
|
|
6638
|
+
el.insertBefore(shine, waveEl.nextSibling);
|
|
6639
|
+
} else {
|
|
6640
|
+
el.insertBefore(shine, el.firstChild);
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
},
|
|
6644
|
+
_runMorph: function(el, pointerEvent, onComplete) {
|
|
6645
|
+
const wave = el.querySelector(".vd-morph-wave");
|
|
6646
|
+
if (wave) {
|
|
6647
|
+
const rect = el.getBoundingClientRect();
|
|
6648
|
+
const cx = rect.left + rect.width / 2;
|
|
6649
|
+
const cy = rect.top + rect.height / 2;
|
|
6650
|
+
const px = pointerEvent ? pointerEvent.clientX || cx : cx;
|
|
6651
|
+
const py = pointerEvent ? pointerEvent.clientY || cy : cy;
|
|
6652
|
+
wave.style.left = px - rect.left + "px";
|
|
6653
|
+
wave.style.top = py - rect.top + "px";
|
|
6654
|
+
}
|
|
6655
|
+
el.classList.add("is-morphing");
|
|
6656
|
+
let duration = MORPH_DURATION_MS;
|
|
6657
|
+
const custom = getComputedStyle(el).getPropertyValue("--morph-duration");
|
|
6658
|
+
if (custom) {
|
|
6659
|
+
const parsed = parseFloat(custom);
|
|
6660
|
+
if (!isNaN(parsed)) duration = parsed * (custom.indexOf("ms") !== -1 ? 1 : 1e3);
|
|
6661
|
+
}
|
|
6662
|
+
setTimeout(function() {
|
|
6663
|
+
el.classList.remove("is-morphing");
|
|
6664
|
+
const current = el.querySelector(".vd-morph-current");
|
|
6665
|
+
const next = el.querySelector(".vd-morph-next");
|
|
6666
|
+
if (current && next) {
|
|
6667
|
+
current.classList.remove("vd-morph-current");
|
|
6668
|
+
current.classList.add("vd-morph-next");
|
|
6669
|
+
next.classList.remove("vd-morph-next");
|
|
6670
|
+
next.classList.add("vd-morph-current");
|
|
6671
|
+
}
|
|
6672
|
+
el.classList.add("morph-done");
|
|
6673
|
+
setTimeout(function() {
|
|
6674
|
+
el.classList.remove("morph-done");
|
|
6675
|
+
}, 350);
|
|
6676
|
+
if (typeof onComplete === "function") onComplete();
|
|
6677
|
+
}, duration);
|
|
6678
|
+
}
|
|
6679
|
+
};
|
|
6680
|
+
if (typeof window.Vanduo !== "undefined") {
|
|
6681
|
+
window.Vanduo.register("morph", Morph);
|
|
6682
|
+
}
|
|
6683
|
+
window.VanduoMorph = Morph;
|
|
6684
|
+
})();
|
|
6685
|
+
|
|
6575
6686
|
// js/components/flow.js
|
|
6576
6687
|
(function() {
|
|
6577
6688
|
"use strict";
|