@pathscale/ui 0.0.151 → 0.0.153
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/index.js +27 -24
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -10512,7 +10512,7 @@ const FloatingDock_DockItem = (props)=>{
|
|
|
10512
10512
|
"function" == typeof _ref$2 ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$2, _el$3) : iconRef = _el$3;
|
|
10513
10513
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>props.item.icon);
|
|
10514
10514
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
10515
|
-
var _v$5 = twMerge("relative flex items-center justify-center rounded-full bg-base-200 transition-
|
|
10515
|
+
var _v$5 = twMerge("relative flex items-center justify-center rounded-full bg-base-200 transition-opacity duration-150 hover:opacity-100 active:opacity-60", "opacity-80", cfg.itemClass), _v$6 = `${cfg.baseSize}px`, _v$7 = `${cfg.baseSize}px`;
|
|
10516
10516
|
_v$5 !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$, _p$.e = _v$5);
|
|
10517
10517
|
_v$6 !== _p$.t && (null != (_p$.t = _v$6) ? _el$.style.setProperty("width", _v$6) : _el$.style.removeProperty("width"));
|
|
10518
10518
|
_v$7 !== _p$.a && (null != (_p$.a = _v$7) ? _el$.style.setProperty("height", _v$7) : _el$.style.removeProperty("height"));
|
|
@@ -10568,6 +10568,17 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10568
10568
|
let prevTime = 0;
|
|
10569
10569
|
let lastMousePos = 1 / 0;
|
|
10570
10570
|
let loopRunning = false;
|
|
10571
|
+
let anchorCenters = [];
|
|
10572
|
+
const captureAnchors = ()=>{
|
|
10573
|
+
anchorCenters = [];
|
|
10574
|
+
for(let i = 0; i < itemSprings.length; i++){
|
|
10575
|
+
const wrap = itemSprings[i].wrapRef;
|
|
10576
|
+
if (wrap) {
|
|
10577
|
+
const b = wrap.getBoundingClientRect();
|
|
10578
|
+
anchorCenters[i] = isH() ? b.x + b.width / 2 : b.y + b.height / 2;
|
|
10579
|
+
}
|
|
10580
|
+
}
|
|
10581
|
+
};
|
|
10571
10582
|
const startLoop = ()=>{
|
|
10572
10583
|
if (loopRunning || !cfg.magnify) return;
|
|
10573
10584
|
loopRunning = true;
|
|
@@ -10585,18 +10596,10 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10585
10596
|
const mp = mousePos();
|
|
10586
10597
|
if (mp !== lastMousePos) {
|
|
10587
10598
|
lastMousePos = mp;
|
|
10588
|
-
const centers = [];
|
|
10589
|
-
for(let i = 0; i < itemSprings.length; i++){
|
|
10590
|
-
const wrap = itemSprings[i].wrapRef;
|
|
10591
|
-
if (wrap) {
|
|
10592
|
-
const b = wrap.getBoundingClientRect();
|
|
10593
|
-
centers[i] = isH() ? b.x + b.width / 2 : b.y + b.height / 2;
|
|
10594
|
-
} else centers[i] = 0;
|
|
10595
|
-
}
|
|
10596
10599
|
for(let i = 0; i < itemSprings.length; i++){
|
|
10597
10600
|
const s = itemSprings[i];
|
|
10598
|
-
if (!s.wrapRef) continue;
|
|
10599
|
-
const dist = Math.abs(mp -
|
|
10601
|
+
if (!s.wrapRef || void 0 === anchorCenters[i]) continue;
|
|
10602
|
+
const dist = Math.abs(mp - anchorCenters[i]);
|
|
10600
10603
|
const ts = mp === 1 / 0 ? cfg.baseSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverSize, cfg.baseSize);
|
|
10601
10604
|
const ti = mp === 1 / 0 ? cfg.iconSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverIconSize, cfg.iconSize);
|
|
10602
10605
|
s.sW.set(ts);
|
|
@@ -10617,31 +10620,31 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10617
10620
|
for(let i = 0; i < itemSprings.length; i++){
|
|
10618
10621
|
const s = itemSprings[i];
|
|
10619
10622
|
if (s.wrapRef) {
|
|
10620
|
-
|
|
10621
|
-
s.wrapRef.style.
|
|
10623
|
+
const scale = s.sW.get() / cfg.baseSize;
|
|
10624
|
+
s.wrapRef.style.transform = `scale(${scale})`;
|
|
10622
10625
|
}
|
|
10623
10626
|
if (s.iconRef) {
|
|
10624
|
-
|
|
10625
|
-
s.iconRef.style.
|
|
10627
|
+
const iconScale = s.sIW.get() / cfg.iconSize;
|
|
10628
|
+
s.iconRef.style.transform = `scale(${iconScale})`;
|
|
10626
10629
|
}
|
|
10627
10630
|
}
|
|
10628
10631
|
if (allSettled) return void stopLoop();
|
|
10629
10632
|
rafId = requestAnimationFrame(tick);
|
|
10630
10633
|
};
|
|
10631
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
|
|
10632
|
-
if (!cfg.magnify) return;
|
|
10633
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
10634
|
-
mousePos();
|
|
10635
|
-
startLoop();
|
|
10636
|
-
});
|
|
10637
|
-
});
|
|
10638
10634
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
|
|
10639
10635
|
stopLoop();
|
|
10640
10636
|
});
|
|
10641
10637
|
return (()=>{
|
|
10642
10638
|
var _el$6 = FloatingDock_tmpl$5();
|
|
10643
|
-
_el$6.addEventListener("mouseleave", ()=>
|
|
10644
|
-
|
|
10639
|
+
_el$6.addEventListener("mouseleave", ()=>{
|
|
10640
|
+
setMousePos(1 / 0);
|
|
10641
|
+
startLoop();
|
|
10642
|
+
});
|
|
10643
|
+
_el$6.$$mousemove = (e)=>{
|
|
10644
|
+
setMousePos(isH() ? e.clientX : e.clientY);
|
|
10645
|
+
startLoop();
|
|
10646
|
+
};
|
|
10647
|
+
_el$6.addEventListener("mouseenter", captureAnchors);
|
|
10645
10648
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
10646
10649
|
get each () {
|
|
10647
10650
|
return props.items;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pathscale/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.153",
|
|
4
4
|
"author": "pathscale",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@iconify/tailwind4": "^1.2.1",
|
|
60
|
+
"@pathscale/ui": "0.0.152",
|
|
60
61
|
"rsbuild-plugin-iconify": "^1.0.3"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|