@vanduo-oss/framework 1.4.5 → 1.5.0
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/CHANGELOG.md +82 -0
- package/README.md +23 -9
- package/css/primitives/primitives.css +257 -0
- package/css/utilities/print.css +19 -17
- package/css/vanduo.css +9 -3
- package/dist/build-info.json +3 -3
- package/dist/vanduo-core.css +19701 -0
- package/dist/vanduo-core.css.map +1 -0
- package/dist/vanduo-core.min.css +2 -0
- package/dist/vanduo-core.min.css.map +1 -0
- package/dist/vanduo.cjs.js +39 -19
- package/dist/vanduo.cjs.js.map +2 -2
- package/dist/vanduo.cjs.min.js +5 -5
- package/dist/vanduo.cjs.min.js.map +3 -3
- package/dist/vanduo.css +628 -33585
- package/dist/vanduo.css.map +1 -1
- package/dist/vanduo.d.ts +77 -0
- package/dist/vanduo.esm.js +39 -19
- package/dist/vanduo.esm.js.map +2 -2
- package/dist/vanduo.esm.min.js +5 -5
- package/dist/vanduo.esm.min.js.map +3 -3
- package/dist/vanduo.js +39 -19
- package/dist/vanduo.js.map +2 -2
- package/dist/vanduo.min.css +2 -2
- package/dist/vanduo.min.css.map +1 -1
- package/dist/vanduo.min.js +5 -5
- package/dist/vanduo.min.js.map +3 -3
- package/js/components/parallax.js +13 -7
- package/js/components/spotlight.js +46 -16
- package/package.json +7 -3
- package/css/components/doc-tabs.css +0 -38
- package/dist/icons/phosphor/bold/Phosphor-Bold.svg +0 -3057
- package/dist/icons/phosphor/bold/Phosphor-Bold.ttf +0 -0
- package/dist/icons/phosphor/bold/Phosphor-Bold.woff +0 -0
- package/dist/icons/phosphor/bold/Phosphor-Bold.woff2 +0 -0
- package/dist/icons/phosphor/bold/style.css +0 -4627
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.svg +0 -3054
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.ttf +0 -0
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.woff +0 -0
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.woff2 +0 -0
- package/dist/icons/phosphor/duotone/style.css +0 -12115
- package/dist/icons/phosphor/light/Phosphor-Light.svg +0 -3057
- package/dist/icons/phosphor/light/Phosphor-Light.ttf +0 -0
- package/dist/icons/phosphor/light/Phosphor-Light.woff +0 -0
- package/dist/icons/phosphor/light/Phosphor-Light.woff2 +0 -0
- package/dist/icons/phosphor/light/style.css +0 -4627
- package/dist/icons/phosphor/thin/Phosphor-Thin.svg +0 -3057
- package/dist/icons/phosphor/thin/Phosphor-Thin.ttf +0 -0
- package/dist/icons/phosphor/thin/Phosphor-Thin.woff +0 -0
- package/dist/icons/phosphor/thin/Phosphor-Thin.woff2 +0 -0
- package/dist/icons/phosphor/thin/style.css +0 -4627
- package/js/components/vd-hex.js +0 -838
- package/js/utils/hex-math.js +0 -233
package/dist/vanduo.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vanduo Framework — TypeScript declarations for the runtime object.
|
|
3
|
+
*
|
|
4
|
+
* These cover the `Vanduo` runtime surface (init / lifecycle / registry).
|
|
5
|
+
* Per-component option and instance types are intentionally out of scope for
|
|
6
|
+
* now; component objects are typed loosely as `VanduoComponent`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** A node that can scope component initialization. */
|
|
10
|
+
export type VanduoRoot = Document | Element | DocumentFragment;
|
|
11
|
+
|
|
12
|
+
/** Options accepted when registering a component. */
|
|
13
|
+
export interface VanduoRegisterOptions {
|
|
14
|
+
/** Alternate names that resolve to this component. */
|
|
15
|
+
aliases?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A registered component. Components self-register via `Vanduo.register` and
|
|
20
|
+
* typically expose `init` / `destroyAll`. Additional members vary per component
|
|
21
|
+
* and are intentionally untyped here.
|
|
22
|
+
*/
|
|
23
|
+
export interface VanduoComponent {
|
|
24
|
+
init?(root?: VanduoRoot): void;
|
|
25
|
+
destroyAll?(root?: VanduoRoot): void;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The Vanduo framework runtime object (also available as `window.Vanduo`). */
|
|
30
|
+
export interface VanduoStatic {
|
|
31
|
+
/** Framework version (matches package.json). */
|
|
32
|
+
readonly version: string;
|
|
33
|
+
/** Registered components keyed by canonical name. */
|
|
34
|
+
readonly components: Record<string, VanduoComponent>;
|
|
35
|
+
/** Alias → canonical-name map. */
|
|
36
|
+
readonly aliases: Record<string, string>;
|
|
37
|
+
|
|
38
|
+
/** Resolve an alias to its canonical component name. */
|
|
39
|
+
resolveComponentName(name: string): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Initialize the framework. With no argument (or `document`) it waits for DOM
|
|
43
|
+
* ready and initializes every component; with an element/fragment it
|
|
44
|
+
* initializes components within that scope immediately.
|
|
45
|
+
*/
|
|
46
|
+
init(root?: VanduoRoot): void;
|
|
47
|
+
|
|
48
|
+
/** Initialize all registered components within `root` (defaults to document). */
|
|
49
|
+
initComponents(root?: VanduoRoot): void;
|
|
50
|
+
|
|
51
|
+
/** Register a component under `name`, optionally with aliases. */
|
|
52
|
+
register(name: string, component: VanduoComponent, options?: VanduoRegisterOptions): void;
|
|
53
|
+
|
|
54
|
+
/** Register an additional alias for an existing component. */
|
|
55
|
+
registerAlias(alias: string, name: string): void;
|
|
56
|
+
|
|
57
|
+
/** Destroy then re-initialize a single component within `root`. */
|
|
58
|
+
reinit(name: string, root?: VanduoRoot): void;
|
|
59
|
+
|
|
60
|
+
/** Destroy component instances within `root` (defaults to document). */
|
|
61
|
+
destroy(root?: VanduoRoot): void;
|
|
62
|
+
|
|
63
|
+
/** Destroy all component instances across the document. */
|
|
64
|
+
destroyAll(): void;
|
|
65
|
+
|
|
66
|
+
/** Get a registered component by (canonical or alias) name, or `null`. */
|
|
67
|
+
getComponent(name: string): VanduoComponent | null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const Vanduo: VanduoStatic;
|
|
71
|
+
export default Vanduo;
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
interface Window {
|
|
75
|
+
Vanduo: VanduoStatic;
|
|
76
|
+
}
|
|
77
|
+
}
|
package/dist/vanduo.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Vanduo v1.
|
|
1
|
+
/*! Vanduo v1.5.0 | Built: 2026-06-18T19:13:58.613Z | git:8f0e1b5 | development */
|
|
2
2
|
|
|
3
3
|
// js/utils/lifecycle.js
|
|
4
4
|
(function() {
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
// js/vanduo.js
|
|
177
177
|
(function() {
|
|
178
178
|
"use strict";
|
|
179
|
-
const VANDUO_VERSION = true ? "1.
|
|
179
|
+
const VANDUO_VERSION = true ? "1.5.0" : "0.0.0-dev";
|
|
180
180
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
181
181
|
const Vanduo2 = {
|
|
182
182
|
version: VANDUO_VERSION,
|
|
@@ -3079,13 +3079,13 @@
|
|
|
3079
3079
|
*/
|
|
3080
3080
|
initParallax: function(element) {
|
|
3081
3081
|
element.dataset.parallaxInitialized = "true";
|
|
3082
|
-
const disableMobile = element.classList.contains("parallax-disable-mobile");
|
|
3082
|
+
const disableMobile = element.classList.contains("vd-parallax-disable-mobile") || element.classList.contains("parallax-disable-mobile");
|
|
3083
3083
|
if (disableMobile && this.isMobile) {
|
|
3084
3084
|
return;
|
|
3085
3085
|
}
|
|
3086
3086
|
const layers = element.querySelectorAll(".vd-parallax-layer, .vd-parallax-bg");
|
|
3087
3087
|
const speed = this.getSpeed(element);
|
|
3088
|
-
const direction = element.classList.contains("parallax-horizontal") ? "horizontal" : "vertical";
|
|
3088
|
+
const direction = element.classList.contains("vd-parallax-horizontal") || element.classList.contains("parallax-horizontal") ? "horizontal" : "vertical";
|
|
3089
3089
|
this.parallaxElements.set(element, {
|
|
3090
3090
|
layers: Array.from(layers),
|
|
3091
3091
|
speed,
|
|
@@ -3100,9 +3100,9 @@
|
|
|
3100
3100
|
* @returns {number} Speed multiplier
|
|
3101
3101
|
*/
|
|
3102
3102
|
getSpeed: function(element) {
|
|
3103
|
-
if (element.classList.contains("parallax-slow")) {
|
|
3103
|
+
if (element.classList.contains("vd-parallax-slow") || element.classList.contains("parallax-slow")) {
|
|
3104
3104
|
return 0.5;
|
|
3105
|
-
} else if (element.classList.contains("parallax-fast")) {
|
|
3105
|
+
} else if (element.classList.contains("vd-parallax-fast") || element.classList.contains("parallax-fast")) {
|
|
3106
3106
|
return 1.5;
|
|
3107
3107
|
}
|
|
3108
3108
|
return 1;
|
|
@@ -3149,7 +3149,8 @@
|
|
|
3149
3149
|
));
|
|
3150
3150
|
const offset = (scrollProgress - 0.5) * config.speed * 100;
|
|
3151
3151
|
config.layers.forEach((layer, _index) => {
|
|
3152
|
-
const
|
|
3152
|
+
const layerSpeedAttr = layer.dataset.parallaxSpeed || layer.dataset.speed;
|
|
3153
|
+
const layerSpeed = layerSpeedAttr ? parseFloat(layerSpeedAttr) : 1;
|
|
3153
3154
|
const layerOffset = offset * layerSpeed;
|
|
3154
3155
|
if (config.direction === "horizontal") {
|
|
3155
3156
|
layer.style.transform = `translateX(${layerOffset}px)`;
|
|
@@ -10415,6 +10416,7 @@
|
|
|
10415
10416
|
_cleanup: [],
|
|
10416
10417
|
_boundTriggers: /* @__PURE__ */ new WeakMap(),
|
|
10417
10418
|
_triggerElement: null,
|
|
10419
|
+
_currentTarget: null,
|
|
10418
10420
|
init: function(root) {
|
|
10419
10421
|
const triggers = window.Vanduo.queryAll(root, "[data-vd-spotlight]");
|
|
10420
10422
|
triggers.forEach((trigger) => {
|
|
@@ -10483,8 +10485,29 @@
|
|
|
10483
10485
|
document.addEventListener("keydown", escHandler);
|
|
10484
10486
|
this._cleanup.push(() => document.removeEventListener("keydown", escHandler));
|
|
10485
10487
|
overlay.addEventListener("click", () => this.stop());
|
|
10488
|
+
const reposition = () => {
|
|
10489
|
+
if (this._active && this._currentTarget) this._positionTooltip(this._currentTarget);
|
|
10490
|
+
};
|
|
10491
|
+
window.addEventListener("scroll", reposition, { passive: true });
|
|
10492
|
+
window.addEventListener("resize", reposition);
|
|
10493
|
+
this._cleanup.push(() => window.removeEventListener("scroll", reposition));
|
|
10494
|
+
this._cleanup.push(() => window.removeEventListener("resize", reposition));
|
|
10486
10495
|
this._showStep(this._currentStep);
|
|
10487
10496
|
},
|
|
10497
|
+
_positionTooltip: function(target) {
|
|
10498
|
+
const tooltip = this._elements.tooltip;
|
|
10499
|
+
if (!tooltip || !target || !target.isConnected) return;
|
|
10500
|
+
const rect = target.getBoundingClientRect();
|
|
10501
|
+
const tRect = tooltip.getBoundingClientRect();
|
|
10502
|
+
let top = rect.bottom + 12 + window.scrollY;
|
|
10503
|
+
let left = rect.left + (rect.width - tRect.width) / 2 + window.scrollX;
|
|
10504
|
+
left = Math.max(8, Math.min(left, window.innerWidth - tRect.width - 8));
|
|
10505
|
+
if (top + tRect.height > window.innerHeight + window.scrollY) {
|
|
10506
|
+
top = rect.top - tRect.height - 12 + window.scrollY;
|
|
10507
|
+
}
|
|
10508
|
+
tooltip.style.top = top + "px";
|
|
10509
|
+
tooltip.style.left = left + "px";
|
|
10510
|
+
},
|
|
10488
10511
|
_showStep: function(index) {
|
|
10489
10512
|
const step = this._steps[index];
|
|
10490
10513
|
if (!step) return;
|
|
@@ -10557,19 +10580,15 @@
|
|
|
10557
10580
|
footer.appendChild(counter);
|
|
10558
10581
|
footer.appendChild(actions);
|
|
10559
10582
|
tooltip.appendChild(footer);
|
|
10583
|
+
this._currentTarget = target || null;
|
|
10560
10584
|
if (target) {
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
top = rect.top - tRect.height - 12 + window.scrollY;
|
|
10569
|
-
}
|
|
10570
|
-
tooltip.style.top = top + "px";
|
|
10571
|
-
tooltip.style.left = left + "px";
|
|
10572
|
-
});
|
|
10585
|
+
let frames = 0;
|
|
10586
|
+
const settle = () => {
|
|
10587
|
+
if (!this._active || this._currentTarget !== target) return;
|
|
10588
|
+
this._positionTooltip(target);
|
|
10589
|
+
if (frames++ < 30) requestAnimationFrame(settle);
|
|
10590
|
+
};
|
|
10591
|
+
requestAnimationFrame(settle);
|
|
10573
10592
|
}
|
|
10574
10593
|
document.dispatchEvent(new CustomEvent("spotlight:step", {
|
|
10575
10594
|
detail: { index, step: index, total, data: step }
|
|
@@ -10610,6 +10629,7 @@
|
|
|
10610
10629
|
this._elements = {};
|
|
10611
10630
|
this._steps = [];
|
|
10612
10631
|
this._currentStep = 0;
|
|
10632
|
+
this._currentTarget = null;
|
|
10613
10633
|
if (this._triggerElement && this._triggerElement.isConnected && typeof this._triggerElement.focus === "function") {
|
|
10614
10634
|
this._triggerElement.focus();
|
|
10615
10635
|
}
|