fancy-ui-react 0.3.0 → 0.4.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.
Files changed (86) hide show
  1. package/README.md +52 -19
  2. package/dist/components/animated-beam/AnimatedBeam.d.ts +47 -11
  3. package/dist/components/animated-beam/AnimatedBeam.js +293 -118
  4. package/dist/components/animated-tooltip/AnimatedTooltip.d.ts +10 -1
  5. package/dist/components/animated-tooltip/AnimatedTooltip.js +170 -101
  6. package/dist/components/bento-grid/BentoFrame.d.ts +16 -0
  7. package/dist/components/bento-grid/BentoFrame.js +28 -0
  8. package/dist/components/bento-grid/BentoGrid.d.ts +5 -1
  9. package/dist/components/bento-grid/BentoGrid.js +71 -2
  10. package/dist/components/bento-grid/BentoGridCard.js +34 -26
  11. package/dist/components/bento-grid/BentoGridItem.js +10 -10
  12. package/dist/components/border-beam/BorderBeam.d.ts +55 -10
  13. package/dist/components/border-beam/BorderBeam.js +93 -16
  14. package/dist/components/compare/Compare.d.ts +32 -8
  15. package/dist/components/compare/Compare.js +213 -95
  16. package/dist/components/container-scroll/ContainerScroll.d.ts +26 -4
  17. package/dist/components/container-scroll/ContainerScroll.js +88 -49
  18. package/dist/components/dock/Dock.d.ts +10 -7
  19. package/dist/components/dock/Dock.js +76 -31
  20. package/dist/components/dock/DockIcon.d.ts +14 -3
  21. package/dist/components/dock/DockIcon.js +23 -19
  22. package/dist/components/dock/DockSeparator.d.ts +4 -1
  23. package/dist/components/dock/DockSeparator.js +5 -2
  24. package/dist/components/dock/types.d.ts +13 -6
  25. package/dist/components/dropdown-menu/menu-shared.d.ts +11 -8
  26. package/dist/components/editorial-engine/engine.js +1 -14
  27. package/dist/components/fireworks-hdr/webgl2-renderer.js +0 -19
  28. package/dist/components/fireworks-hdr/webgpu-renderer.js +3 -22
  29. package/dist/components/flip-card/FlipCard.d.ts +42 -1
  30. package/dist/components/flip-card/FlipCard.js +178 -25
  31. package/dist/components/flip-card/index.d.ts +1 -1
  32. package/dist/components/fluid-cursor/FluidCursor.js +5 -4
  33. package/dist/components/fluid-cursor/dev.d.ts +1 -0
  34. package/dist/components/fluid-cursor/dev.js +8 -0
  35. package/dist/components/fluid-cursor/fluid-shared.d.ts +0 -2
  36. package/dist/components/fluid-cursor/fluid-shared.js +0 -2
  37. package/dist/components/fluid-cursor/webgpu-engine.js +10 -24
  38. package/dist/components/glow-border/GlowBorder.d.ts +41 -1
  39. package/dist/components/glow-border/GlowBorder.js +96 -16
  40. package/dist/components/glow-border/index.d.ts +2 -2
  41. package/dist/components/gradient-button/GradientButton.d.ts +10 -5
  42. package/dist/components/gradient-button/GradientButton.js +25 -18
  43. package/dist/components/image-trail-cursor/ImageTrailCursor.js +1 -0
  44. package/dist/components/image-trail-cursor/trail-variants.d.ts +37 -1
  45. package/dist/components/image-trail-cursor/trail-variants.js +331 -8
  46. package/dist/components/interactive-hover-button/InteractiveHoverButton.js +30 -35
  47. package/dist/components/marquee/Marquee.d.ts +7 -3
  48. package/dist/components/marquee/Marquee.js +134 -2
  49. package/dist/components/marquee/ReviewCard.d.ts +2 -1
  50. package/dist/components/marquee/ReviewCard.js +20 -9
  51. package/dist/components/meteors/Meteors.d.ts +32 -10
  52. package/dist/components/meteors/Meteors.js +53 -20
  53. package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +98 -10
  54. package/dist/components/neon-border/NeonBorder.d.ts +24 -5
  55. package/dist/components/neon-border/NeonBorder.js +37 -7
  56. package/dist/components/pagination/Pagination.js +220 -82
  57. package/dist/components/rainbow-button/RainbowButton.js +13 -5
  58. package/dist/components/ripple-button/RippleButton.d.ts +20 -1
  59. package/dist/components/ripple-button/RippleButton.js +44 -21
  60. package/dist/components/shimmer-button/ShimmerButton.d.ts +5 -5
  61. package/dist/components/shimmer-button/ShimmerButton.js +17 -19
  62. package/dist/components/smooth-cursor/SmoothCursor.d.ts +13 -9
  63. package/dist/components/smooth-cursor/SmoothCursor.js +114 -163
  64. package/dist/components/smooth-cursor/smooth-cursor-core.d.ts +85 -0
  65. package/dist/components/smooth-cursor/smooth-cursor-core.js +327 -0
  66. package/dist/components/stepper/Step.js +32 -19
  67. package/dist/components/stepper/Stepper.js +18 -2
  68. package/dist/components/stepper/types.d.ts +13 -0
  69. package/dist/components/timeline/Timeline.d.ts +8 -1
  70. package/dist/components/timeline/Timeline.js +165 -76
  71. package/dist/index.js +2 -1
  72. package/dist/internals/markdown.d.ts +5 -0
  73. package/dist/internals/motion/haptics.d.ts +0 -4
  74. package/dist/internals/motion/presence-core.d.ts +59 -0
  75. package/dist/internals/motion/presence-core.js +162 -0
  76. package/dist/internals/motion/presence.d.ts +2 -4
  77. package/dist/internals/motion/presence.js +1 -156
  78. package/dist/internals/motion/raf.d.ts +1 -1
  79. package/dist/internals/motion/stagger.d.ts +3 -4
  80. package/dist/internals/motion/tokens.js +4 -0
  81. package/dist/internals/motion/transitions.d.ts +17 -17
  82. package/dist/internals/motion/types.d.ts +6 -7
  83. package/dist/internals/relative-time.d.ts +1 -1
  84. package/dist/styles.css +3470 -203
  85. package/package.json +18 -2
  86. package/dist/components/fireworks-hdr/webgpu-types.d.ts +0 -159
@@ -1,39 +1,119 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { cn } from "../../utils.js";
4
4
  /* empty css */
5
+ const GLOW_BORDER_PRESETS = {
6
+ chromatic: {
7
+ dark: {
8
+ tints: ["#ffffff", "#f5b8d0", "#8fe3d9", "#b9a8ff", "#f3d58a"],
9
+ body: "#8a9099",
10
+ shadow: "#2a2d33"
11
+ },
12
+ light: {
13
+ tints: ["#5b636d", "#d9669a", "#2fa89a", "#7a62e6", "#c99a2e"],
14
+ body: "#9aa3ad",
15
+ shadow: "#e3e6ea"
16
+ }
17
+ },
18
+ silver: {
19
+ dark: {
20
+ tints: ["#ffffff", "#dfe4ea", "#b8c2cf", "#f2f5f8"],
21
+ body: "#7d848f",
22
+ shadow: "#2b2f35"
23
+ },
24
+ light: {
25
+ tints: ["#4b525c", "#7d8793", "#5f6975", "#2f353d"],
26
+ body: "#aab2bc",
27
+ shadow: "#e6e9ed"
28
+ }
29
+ },
30
+ gold: {
31
+ dark: {
32
+ tints: ["#fff4cf", "#f7d98b", "#ffe7a3", "#e9b95c"],
33
+ body: "#c8973f",
34
+ shadow: "#4a3616"
35
+ },
36
+ light: {
37
+ tints: ["#8a6424", "#b8862f", "#6e4d17", "#c99a2e"],
38
+ body: "#d9b56a",
39
+ shadow: "#f3e8cf"
40
+ }
41
+ }
42
+ };
43
+ function customPalette(color, theme) {
44
+ const list = (Array.isArray(color) ? color : [color]).filter(Boolean);
45
+ const tints = list.length ? list : ["#ffffff"];
46
+ return theme === "dark" ? { tints: ["#ffffff", ...tints], body: "#7d848f", shadow: "#2a2d33" } : { tints, body: "#9aa3ad", shadow: "#e3e6ea" };
47
+ }
48
+ function metalField(p, angleVar, at, offset = 0) {
49
+ const stops = [];
50
+ const n = p.tints.length;
51
+ const step = 100 / n;
52
+ for (let i = 0; i < n; i++) {
53
+ const base = i * step;
54
+ const tint = p.tints[(i + offset) % n];
55
+ stops.push(`${p.shadow} ${base.toFixed(1)}%`);
56
+ stops.push(`${p.shadow} ${(base + step * 0.22).toFixed(1)}%`);
57
+ stops.push(`${p.body} ${(base + step * 0.4).toFixed(1)}%`);
58
+ stops.push(`${tint} ${(base + step * 0.5).toFixed(1)}%`);
59
+ stops.push(`${p.body} ${(base + step * 0.6).toFixed(1)}%`);
60
+ stops.push(`${p.shadow} ${(base + step * 0.8).toFixed(1)}%`);
61
+ }
62
+ stops.push(`${p.shadow} 100%`);
63
+ return `conic-gradient(from var(${angleVar}) at ${at}, ${stops.join(", ")})`;
64
+ }
65
+ function metalBackground(p) {
66
+ return `${metalField(p, "--gb-a1", "30% 40%")}, ${metalField(p, "--gb-a2", "72% 65%", 2)}`;
67
+ }
68
+ function glintArc(p) {
69
+ const lead = p.tints[1] ?? p.tints[0];
70
+ const tail = p.tints[2] ?? p.tints[p.tints.length - 1];
71
+ return `conic-gradient(from var(--gb-a3), transparent 0%, transparent 72%, ${tail} 84%, #ffffff 90%, ${lead} 94%, transparent 99%)`;
72
+ }
5
73
  function GlowBorder({
6
74
  className = "",
7
75
  borderRadius = 10,
8
- color = "#FFF",
9
- borderWidth = 2,
10
- duration = 10
76
+ color,
77
+ borderWidth = 1.5,
78
+ duration = 10,
79
+ preset = "chromatic",
80
+ strength = 0.8
11
81
  }) {
12
- const colorString = Array.isArray(color) ? color.join(",") : color;
82
+ const palettes = color !== void 0 ? { dark: customPalette(color, "dark"), light: customPalette(color, "light") } : GLOW_BORDER_PRESETS[preset] ?? GLOW_BORDER_PRESETS.chromatic;
83
+ const strengthC = Math.min(1, Math.max(0, Number.isFinite(strength) ? strength : 0.8));
13
84
  const styles = {
14
85
  "--glow-border-radius": `${borderRadius}px`,
15
86
  "--glow-border-width": `${borderWidth}px`,
16
87
  "--glow-duration": `${duration}s`,
17
- backgroundImage: `radial-gradient(transparent, transparent, ${colorString}, transparent, transparent)`,
18
- backgroundSize: "300% 300%",
19
- mask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
20
- WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
21
- WebkitMaskComposite: "xor",
22
- maskComposite: "exclude",
23
- padding: "var(--glow-border-width)",
88
+ "--glow-strength": `${strengthC}`,
89
+ "--gb-metal-dark": metalBackground(palettes.dark),
90
+ "--gb-metal-light": metalBackground(palettes.light),
91
+ "--gb-glint-dark": glintArc(palettes.dark),
92
+ "--gb-glint-light": glintArc(palettes.light),
24
93
  borderRadius: "var(--glow-border-radius)"
25
94
  };
26
- return /* @__PURE__ */ jsx(
95
+ return /* @__PURE__ */ jsxs(
27
96
  "div",
28
97
  {
29
98
  className: cn(
30
- "animate-glow pointer-events-none absolute inset-0 size-full rounded-[inherit] will-change-[background-position]",
99
+ "glow-border animate-glow pointer-events-none absolute inset-0 size-full rounded-[inherit]",
31
100
  className
32
101
  ),
33
- style: styles
102
+ style: styles,
103
+ "aria-hidden": "true",
104
+ children: [
105
+ /* @__PURE__ */ jsx("span", { className: "glow-border__halo", children: /* @__PURE__ */ jsx("span", {}) }),
106
+ /* @__PURE__ */ jsx("span", { className: "glow-border__metal" }),
107
+ /* @__PURE__ */ jsx("span", { className: "glow-border__glint" })
108
+ ]
34
109
  }
35
110
  );
36
111
  }
37
112
  export {
38
- GlowBorder
113
+ GLOW_BORDER_PRESETS,
114
+ GlowBorder,
115
+ customPalette,
116
+ glintArc,
117
+ metalBackground,
118
+ metalField
39
119
  };
@@ -1,2 +1,2 @@
1
- export { GlowBorder } from "./GlowBorder.js";
2
- export type { GlowBorderProps } from "./GlowBorder.js";
1
+ export { GlowBorder, GLOW_BORDER_PRESETS } from "./GlowBorder.js";
2
+ export type { GlowBorderPreset, GlowBorderProps } from "./GlowBorder.js";
@@ -1,16 +1,16 @@
1
1
  import type { ButtonHTMLAttributes, ReactNode } from "react";
2
2
  type BaseProps = {
3
- /** Gradient colors for the conic-gradient border */
3
+ /** Colours of the beam, spread along its arc */
4
4
  colors?: string[];
5
- /** Animation duration in milliseconds */
5
+ /** Time for the beam to travel once around the button, in milliseconds */
6
6
  duration?: number;
7
- /** Border width in pixels */
7
+ /** Width of the lit border in pixels */
8
8
  borderWidth?: number;
9
9
  /** Border radius in pixels */
10
10
  borderRadius?: number;
11
- /** Blur amount for the gradient in pixels */
11
+ /** Softness of the glow the beam casts inside the button, in pixels */
12
12
  blur?: number;
13
- /** Background color of the button content area */
13
+ /** Background color of the button face */
14
14
  bgColor?: string;
15
15
  /** Custom CSS class */
16
16
  className?: string;
@@ -24,5 +24,10 @@ type BaseProps = {
24
24
  };
25
25
  export interface GradientButtonProps extends BaseProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof BaseProps> {
26
26
  }
27
+ /**
28
+ * The beam as a conic gradient: a main arc carrying every colour over ~40%
29
+ * of the turn, and a fainter echo opposite it. Turned by `--gb-angle`.
30
+ */
31
+ export declare function beamGradient(colors: string[]): string;
27
32
  export declare const GradientButton: import("react").ForwardRefExoticComponent<GradientButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
28
33
  export {};
@@ -4,25 +4,29 @@ import { forwardRef } from "react";
4
4
  import { cn } from "../../utils.js";
5
5
  import { useSoundCue } from "../../sound/use-sound.js";
6
6
  /* empty css */
7
- const DEFAULT_COLORS = [
8
- "#FF0000",
9
- "#FFA500",
10
- "#FFFF00",
11
- "#008000",
12
- "#0000FF",
13
- "#4B0082",
14
- "#EE82EE",
15
- "#FF0000"
16
- ];
7
+ function beamGradient(colors) {
8
+ const list = colors.length ? colors : ["#ffffff"];
9
+ const arc = (from, to, strength) => {
10
+ const span = to - from;
11
+ const stops = list.map((c, i) => {
12
+ const at = from + span * ((i + 1) / (list.length + 1));
13
+ const color = strength < 100 ? `color-mix(in srgb, ${c} ${strength}%, transparent)` : c;
14
+ return `${color} ${at.toFixed(1)}%`;
15
+ });
16
+ return [`transparent ${from}%`, ...stops, `transparent ${to}%`].join(", ");
17
+ };
18
+ return `conic-gradient(from var(--gb-angle), ${arc(0, 42, 100)}, ${arc(50, 78, 45)}, transparent 100%)`;
19
+ }
20
+ const DEFAULT_COLORS = ["#34d399", "#22d3ee", "#6366f1", "#d946ef", "#f43f5e", "#f59e0b"];
17
21
  const GradientButton = forwardRef(
18
22
  ({
19
23
  className,
20
24
  colors = DEFAULT_COLORS,
21
- duration = 2500,
22
- borderWidth = 2,
23
- borderRadius = 8,
25
+ duration = 3e3,
26
+ borderWidth = 1.5,
27
+ borderRadius = 12,
24
28
  blur = 4,
25
- bgColor = "#000",
29
+ bgColor = "#161616",
26
30
  children,
27
31
  onClick,
28
32
  sound = false,
@@ -35,6 +39,7 @@ const GradientButton = forwardRef(
35
39
  }
36
40
  const styleVars = {
37
41
  "--gb-colors": colors.join(", "),
42
+ "--gb-beam": beamGradient(colors),
38
43
  "--gb-duration": `${duration}ms`,
39
44
  "--gb-border-width": `${borderWidth}px`,
40
45
  "--gb-border-radius": `${borderRadius}px`,
@@ -46,15 +51,16 @@ const GradientButton = forwardRef(
46
51
  {
47
52
  ref,
48
53
  className: cn(
49
- "gradient-button relative flex min-h-10 min-w-28 cursor-pointer items-center justify-center overflow-hidden",
54
+ "gradient-button relative flex min-h-10 min-w-28 cursor-pointer items-center justify-center overflow-hidden text-white",
50
55
  className
51
56
  ),
52
57
  style: styleVars,
53
58
  onClick: handleClick,
54
59
  ...restProps,
55
60
  children: [
56
- /* @__PURE__ */ jsx("span", { className: "gradient-border", "aria-hidden": "true" }),
57
- /* @__PURE__ */ jsx("span", { className: "gradient-content inline-flex size-full items-center justify-center px-4 py-2", children })
61
+ /* @__PURE__ */ jsx("span", { className: "gradient-content inline-flex size-full items-center justify-center px-5 py-2.5", children }),
62
+ /* @__PURE__ */ jsx("span", { className: "gradient-glow", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", {}) }),
63
+ /* @__PURE__ */ jsx("span", { className: "gradient-border", "aria-hidden": "true" })
58
64
  ]
59
65
  }
60
66
  );
@@ -62,5 +68,6 @@ const GradientButton = forwardRef(
62
68
  );
63
69
  GradientButton.displayName = "GradientButton";
64
70
  export {
65
- GradientButton
71
+ GradientButton,
72
+ beamGradient
66
73
  };
@@ -7,6 +7,7 @@ function resetImageStyles(container) {
7
7
  const imgEls = container.querySelectorAll(".content__img");
8
8
  for (const el of imgEls) {
9
9
  el.style.cssText = "";
10
+ for (const frag of el.querySelectorAll(".content__img-frag")) frag.remove();
10
11
  const inner = el.querySelector(".content__img-inner");
11
12
  if (inner) {
12
13
  const bgImage = inner.style.backgroundImage;
@@ -1,4 +1,4 @@
1
- export type VariantType = "type1" | "type2" | "type3" | "type4" | "type5" | "type6" | "type7" | "type8" | "pixelated";
1
+ export type VariantType = "type1" | "type2" | "type3" | "type4" | "type5" | "type6" | "type7" | "type8" | "pixelated" | "scale" | "fall" | "gravity" | "flame" | "venetian" | "curtain" | "hexagon" | "liquid" | "zoom-split";
2
2
  export interface ImageTrailVariant {
3
3
  destroy(): void;
4
4
  }
@@ -60,6 +60,8 @@ declare abstract class BaseVariant implements ImageTrailVariant {
60
60
  protected render(): void;
61
61
  protected updateCache(): void;
62
62
  protected abstract showNextImage(): void;
63
+ /** Advance to the next image in the ring. */
64
+ protected nextImage(): ImageItem | undefined;
63
65
  protected onImageActivated(): void;
64
66
  protected onImageDeactivated(): void;
65
67
  destroy(): void;
@@ -108,5 +110,39 @@ export declare class ImageTrailVariantPixelated extends BaseVariant {
108
110
  constructor(container: HTMLDivElement);
109
111
  protected showNextImage(): void;
110
112
  }
113
+ export declare class ImageTrailVariantScale extends BaseVariant {
114
+ protected showNextImage(): void;
115
+ }
116
+ export declare class ImageTrailVariantFall extends BaseVariant {
117
+ protected showNextImage(): void;
118
+ }
119
+ export declare class ImageTrailVariantGravity extends BaseVariant {
120
+ protected showNextImage(): void;
121
+ }
122
+ export declare class ImageTrailVariantFlame extends BaseVariant {
123
+ protected showNextImage(): void;
124
+ }
125
+ export type RevealPattern = "venetian" | "curtain" | "hexagon" | "liquid" | "zoom-split";
126
+ export interface RevealFragment {
127
+ /** clip-path while hidden */
128
+ closed: string;
129
+ /** clip-path once revealed */
130
+ open: string;
131
+ /** 0 (first) … 1 (last): when the fragment opens within the stagger */
132
+ order: number;
133
+ }
134
+ /**
135
+ * The fragments of each reveal, as clip-paths in the image's own box.
136
+ * `closed` and `open` always have the same shape and point count, so the
137
+ * tween between them is a straight interpolation.
138
+ */
139
+ export declare function revealFragments(pattern: RevealPattern): RevealFragment[];
140
+ export declare class ImageTrailVariantReveal extends BaseVariant {
141
+ private static readonly STAGGER;
142
+ private readonly fragments;
143
+ constructor(container: HTMLDivElement, pattern: RevealPattern);
144
+ protected showNextImage(): void;
145
+ destroy(): void;
146
+ }
111
147
  export declare const variantMap: Record<VariantType, new (container: HTMLDivElement) => ImageTrailVariant>;
112
148
  export {};