@pathscale/ui 0.0.147 → 0.0.149

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.
@@ -1,6 +1,8 @@
1
1
  import { type JSX } from "solid-js";
2
2
  import type { IComponentBaseProps, ComponentSize, ComponentColor } from "../types";
3
+ export type GlassPanelBlur = "none" | "sm" | "md" | "lg" | "xl" | "2xl";
3
4
  export type GlassPanelProps = IComponentBaseProps & JSX.HTMLAttributes<HTMLDivElement> & {
5
+ blur?: GlassPanelBlur;
4
6
  collapsible?: boolean;
5
7
  open?: boolean;
6
8
  defaultOpen?: boolean;
@@ -1 +1 @@
1
- export { default, type GlassPanelProps } from "./GlassPanel";
1
+ export { default, type GlassPanelProps, type GlassPanelBlur } from "./GlassPanel";
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ export type { FloatingDockProps, FloatingDockItem, FloatingDockDirection } from
38
38
  export { default as Flex } from "./components/flex";
39
39
  export { default as GlassPanel } from "./components/glass-panel";
40
40
  export { GlowCard, type GlowCardProps } from "./components/glow-card";
41
- export type { GlassPanelProps } from "./components/glass-panel";
41
+ export type { GlassPanelProps, GlassPanelBlur } from "./components/glass-panel";
42
42
  export { default as Footer } from "./components/footer";
43
43
  export type { FooterProps, FooterTitleProps } from "./components/footer";
44
44
  export { FormActions, type FormActionsProps } from "./components/form-actions";
package/dist/index.js CHANGED
@@ -10431,64 +10431,8 @@ const FloatingDock_DockItem = (props)=>{
10431
10431
  let iconRef;
10432
10432
  const [hovered, setHovered] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(false);
10433
10433
  const cfg = props.cfg;
10434
- const sW = createSpring(cfg.baseSize, cfg.springOpts);
10435
- const sH = createSpring(cfg.baseSize, cfg.springOpts);
10436
- const sIW = createSpring(cfg.iconSize, cfg.springOpts);
10437
- const sIH = createSpring(cfg.iconSize, cfg.springOpts);
10438
- let rafId;
10439
- let prevTime = 0;
10440
- let lastMousePos = 1 / 0;
10441
- let loopRunning = false;
10442
- const startLoop = ()=>{
10443
- if (loopRunning || !cfg.magnify) return;
10444
- loopRunning = true;
10445
- prevTime = 0;
10446
- rafId = requestAnimationFrame(tick);
10447
- };
10448
- const stopLoop = ()=>{
10449
- if (void 0 !== rafId) cancelAnimationFrame(rafId);
10450
- rafId = void 0;
10451
- loopRunning = false;
10452
- };
10453
- const tick = (time)=>{
10454
- const dt = prevTime ? Math.min((time - prevTime) / 1000, 0.05) : 1 / 60;
10455
- prevTime = time;
10456
- const mp = props.mousePos();
10457
- if (mp !== lastMousePos) {
10458
- lastMousePos = mp;
10459
- if (wrapRef) {
10460
- const b = wrapRef.getBoundingClientRect();
10461
- const isH = "horizontal" === cfg.orientation;
10462
- const center = isH ? b.x + b.width / 2 : b.y + b.height / 2;
10463
- const dist = Math.abs(mp - center);
10464
- const ts = mp === 1 / 0 ? cfg.baseSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverSize, cfg.baseSize);
10465
- const ti = mp === 1 / 0 ? cfg.iconSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverIconSize, cfg.iconSize);
10466
- sW.set(ts);
10467
- sH.set(ts);
10468
- sIW.set(ti);
10469
- sIH.set(ti);
10470
- }
10471
- }
10472
- sW.step(dt);
10473
- sH.step(dt);
10474
- sIW.step(dt);
10475
- sIH.step(dt);
10476
- if (wrapRef) {
10477
- wrapRef.style.width = `${sW.get()}px`;
10478
- wrapRef.style.height = `${sH.get()}px`;
10479
- }
10480
- if (iconRef) {
10481
- iconRef.style.width = `${sIW.get()}px`;
10482
- iconRef.style.height = `${sIH.get()}px`;
10483
- }
10484
- if (sW.settled() && sH.settled() && sIW.settled() && sIH.settled()) return void stopLoop();
10485
- rafId = requestAnimationFrame(tick);
10486
- };
10487
10434
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
10488
- startLoop();
10489
- });
10490
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
10491
- stopLoop();
10435
+ if (wrapRef && iconRef) props.registerRefs(wrapRef, iconRef);
10492
10436
  });
10493
10437
  const handleClick = (e)=>{
10494
10438
  if (props.item.onClick) {
@@ -10499,10 +10443,7 @@ const FloatingDock_DockItem = (props)=>{
10499
10443
  const inner = (()=>{
10500
10444
  var _el$ = FloatingDock_tmpl$2(), _el$3 = _el$.firstChild;
10501
10445
  _el$.addEventListener("mouseleave", ()=>setHovered(false));
10502
- _el$.addEventListener("mouseenter", ()=>{
10503
- setHovered(true);
10504
- startLoop();
10505
- });
10446
+ _el$.addEventListener("mouseenter", ()=>setHovered(true));
10506
10447
  var _ref$ = wrapRef;
10507
10448
  "function" == typeof _ref$ ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$, _el$) : wrapRef = _el$;
10508
10449
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
@@ -10570,6 +10511,82 @@ const FloatingDock_DockItem = (props)=>{
10570
10511
  const FloatingDockDesktop = (props)=>{
10571
10512
  const [mousePos, setMousePos] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(1 / 0);
10572
10513
  const isH = ()=>"horizontal" === props.cfg.orientation;
10514
+ const cfg = props.cfg;
10515
+ const itemSprings = [];
10516
+ let rafId;
10517
+ let prevTime = 0;
10518
+ let lastMousePos = 1 / 0;
10519
+ let loopRunning = false;
10520
+ const startLoop = ()=>{
10521
+ if (loopRunning || !cfg.magnify) return;
10522
+ loopRunning = true;
10523
+ prevTime = 0;
10524
+ rafId = requestAnimationFrame(tick);
10525
+ };
10526
+ const stopLoop = ()=>{
10527
+ if (void 0 !== rafId) cancelAnimationFrame(rafId);
10528
+ rafId = void 0;
10529
+ loopRunning = false;
10530
+ };
10531
+ const tick = (time)=>{
10532
+ const dt = prevTime ? Math.min((time - prevTime) / 1000, 0.05) : 1 / 60;
10533
+ prevTime = time;
10534
+ const mp = mousePos();
10535
+ if (mp !== lastMousePos) {
10536
+ lastMousePos = mp;
10537
+ const centers = [];
10538
+ for(let i = 0; i < itemSprings.length; i++){
10539
+ const wrap = itemSprings[i].wrapRef;
10540
+ if (wrap) {
10541
+ const b = wrap.getBoundingClientRect();
10542
+ centers[i] = isH() ? b.x + b.width / 2 : b.y + b.height / 2;
10543
+ } else centers[i] = 0;
10544
+ }
10545
+ for(let i = 0; i < itemSprings.length; i++){
10546
+ const s = itemSprings[i];
10547
+ if (!s.wrapRef) continue;
10548
+ const dist = Math.abs(mp - centers[i]);
10549
+ const ts = mp === 1 / 0 ? cfg.baseSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverSize, cfg.baseSize);
10550
+ const ti = mp === 1 / 0 ? cfg.iconSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverIconSize, cfg.iconSize);
10551
+ s.sW.set(ts);
10552
+ s.sH.set(ts);
10553
+ s.sIW.set(ti);
10554
+ s.sIH.set(ti);
10555
+ }
10556
+ }
10557
+ let allSettled = true;
10558
+ for(let i = 0; i < itemSprings.length; i++){
10559
+ const s = itemSprings[i];
10560
+ s.sW.step(dt);
10561
+ s.sH.step(dt);
10562
+ s.sIW.step(dt);
10563
+ s.sIH.step(dt);
10564
+ if (allSettled && !(s.sW.settled() && s.sH.settled() && s.sIW.settled() && s.sIH.settled())) allSettled = false;
10565
+ }
10566
+ for(let i = 0; i < itemSprings.length; i++){
10567
+ const s = itemSprings[i];
10568
+ if (s.wrapRef) {
10569
+ s.wrapRef.style.width = `${s.sW.get()}px`;
10570
+ s.wrapRef.style.height = `${s.sH.get()}px`;
10571
+ }
10572
+ if (s.iconRef) {
10573
+ s.iconRef.style.width = `${s.sIW.get()}px`;
10574
+ s.iconRef.style.height = `${s.sIH.get()}px`;
10575
+ }
10576
+ }
10577
+ if (allSettled) return void stopLoop();
10578
+ rafId = requestAnimationFrame(tick);
10579
+ };
10580
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
10581
+ if (!cfg.magnify) return;
10582
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
10583
+ mousePos();
10584
+ startLoop();
10585
+ });
10586
+ });
10587
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
10588
+ stopLoop();
10589
+ });
10573
10590
  return (()=>{
10574
10591
  var _el$6 = FloatingDock_tmpl$5();
10575
10592
  _el$6.addEventListener("mouseleave", ()=>setMousePos(1 / 0));
@@ -10578,23 +10595,33 @@ const FloatingDockDesktop = (props)=>{
10578
10595
  get each () {
10579
10596
  return props.items;
10580
10597
  },
10581
- children: (item)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(FloatingDock_DockItem, {
10598
+ children: (item, idx)=>{
10599
+ const springs = {
10600
+ sW: createSpring(cfg.baseSize, cfg.springOpts),
10601
+ sH: createSpring(cfg.baseSize, cfg.springOpts),
10602
+ sIW: createSpring(cfg.iconSize, cfg.springOpts),
10603
+ sIH: createSpring(cfg.iconSize, cfg.springOpts)
10604
+ };
10605
+ itemSprings[idx()] = springs;
10606
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(FloatingDock_DockItem, {
10582
10607
  item: item,
10583
- mousePos: mousePos,
10584
- get cfg () {
10585
- return props.cfg;
10608
+ cfg: cfg,
10609
+ registerRefs: (wrap, icon)=>{
10610
+ springs.wrapRef = wrap;
10611
+ springs.iconRef = icon;
10586
10612
  }
10587
- })
10613
+ });
10614
+ }
10588
10615
  }));
10589
10616
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
10590
10617
  var _v$6 = twMerge("mx-auto", "items-center", props.showContainer && "rounded-2xl bg-base-100 shadow-[0px_1px_0px_0px_var(--color-base-300)_inset,0px_1px_0px_0px_var(--color-base-100)]", isH() && props.showContainer && "px-4 py-2", !isH() && props.showContainer && "py-4 px-2", props.class), _v$7 = {
10591
10618
  display: "flex",
10592
10619
  "flex-direction": isH() ? "row" : "column",
10593
- gap: `${props.cfg.gap}px`,
10620
+ gap: `${cfg.gap}px`,
10594
10621
  ...isH() ? {
10595
- height: `${props.cfg.baseSize + 16}px`
10622
+ height: `${cfg.baseSize + 16}px`
10596
10623
  } : {
10597
- width: `${props.cfg.baseSize + 16}px`
10624
+ width: `${cfg.baseSize + 16}px`
10598
10625
  },
10599
10626
  overflow: "visible"
10600
10627
  };
@@ -10838,6 +10865,14 @@ const floating_dock_FloatingDock = FloatingDock;
10838
10865
  "mousemove"
10839
10866
  ]);
10840
10867
  var GlassPanel_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<button type=button class="flex w-full items-center justify-between gap-2 px-4 py-3 text-sm font-medium cursor-pointer select-none transition-colors duration-150 text-base-content/50 hover:text-base-content/80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"><span class="flex items-center gap-2"></span><svg fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=1.5><path stroke-linecap=round stroke-linejoin=round d="M19 9l-7 7-7-7">'), GlassPanel_tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="grid transition-[grid-template-rows] duration-200 ease-in-out"><div>');
10868
+ const BLUR_MAP = {
10869
+ none: "",
10870
+ sm: "backdrop-blur-sm",
10871
+ md: "backdrop-blur-md",
10872
+ lg: "backdrop-blur-lg",
10873
+ xl: "backdrop-blur-xl",
10874
+ "2xl": "backdrop-blur-2xl"
10875
+ };
10841
10876
  const SIZE_PADDING = {
10842
10877
  xs: "p-2",
10843
10878
  sm: "p-3",
@@ -10858,6 +10893,7 @@ const ACCENT_BORDER = {
10858
10893
  };
10859
10894
  const GlassPanel = (props)=>{
10860
10895
  const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
10896
+ "blur",
10861
10897
  "collapsible",
10862
10898
  "open",
10863
10899
  "defaultOpen",
@@ -10875,6 +10911,7 @@ const GlassPanel = (props)=>{
10875
10911
  "style"
10876
10912
  ]);
10877
10913
  const contentId = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createUniqueId)();
10914
+ const blur = ()=>local.blur ?? "none";
10878
10915
  const size = ()=>local.size ?? "md";
10879
10916
  const isControlled = ()=>void 0 !== local.open;
10880
10917
  const [internalOpen, setInternalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(local.defaultOpen ?? true);
@@ -10884,7 +10921,9 @@ const GlassPanel = (props)=>{
10884
10921
  if (!isControlled()) setInternalOpen(next);
10885
10922
  local.onToggle?.(next);
10886
10923
  };
10887
- const containerClasses = ()=>twMerge("glass-panel", "rounded-xl", "backdrop-blur-sm", "transition-all duration-200 ease-in-out", clsx({
10924
+ const containerClasses = ()=>twMerge("glass-panel", "rounded-xl", "transition-all duration-200 ease-in-out", clsx({
10925
+ "bg-transparent": local.transparent,
10926
+ [BLUR_MAP[blur()]]: !local.transparent && "none" !== blur(),
10888
10927
  "border-l-2": !!local.accent,
10889
10928
  [ACCENT_BORDER[local.accent ?? ""]]: !!local.accent
10890
10929
  }), local.class, local.className);
@@ -10893,7 +10932,7 @@ const GlassPanel = (props)=>{
10893
10932
  ...local.style || {}
10894
10933
  };
10895
10934
  if (!local.transparent) {
10896
- base.background = "color-mix(in srgb, var(--color-base-200) 80%, transparent)";
10935
+ base.background = "color-mix(in srgb, var(--color-base-200) 85%, transparent)";
10897
10936
  base.border = "1px solid color-mix(in srgb, var(--color-base-content) 8%, transparent)";
10898
10937
  }
10899
10938
  if (local.glow) base["box-shadow"] = "inset 0 1px 0 color-mix(in srgb, var(--color-base-content) 5%, transparent)";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "0.0.147",
3
+ "version": "0.0.149",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",