@windrun-huaiin/third-ui 29.2.1 → 30.0.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 (96) hide show
  1. package/dist/fuma/mdx/cheet-table.d.ts +13 -0
  2. package/dist/fuma/mdx/cheet-table.js +295 -0
  3. package/dist/fuma/mdx/cheet-table.mjs +293 -0
  4. package/dist/fuma/mdx/index.d.ts +1 -0
  5. package/dist/fuma/mdx/index.js +2 -0
  6. package/dist/fuma/mdx/index.mjs +1 -0
  7. package/dist/fuma/server/features/widgets.js +2 -0
  8. package/dist/fuma/server/features/widgets.mjs +2 -0
  9. package/dist/lib/fuma-schema-check-util.d.ts +1 -1
  10. package/dist/main/alert-dialog/confirm-dialog.js +1 -1
  11. package/dist/main/alert-dialog/confirm-dialog.mjs +2 -2
  12. package/dist/main/alert-dialog/dialog-loading-action.js +5 -2
  13. package/dist/main/alert-dialog/dialog-loading-action.mjs +5 -2
  14. package/dist/main/alert-dialog/dialog-styles.d.ts +4 -2
  15. package/dist/main/alert-dialog/dialog-styles.js +8 -4
  16. package/dist/main/alert-dialog/dialog-styles.mjs +7 -5
  17. package/dist/main/alert-dialog/high-priority-confirm-dialog.js +5 -5
  18. package/dist/main/alert-dialog/high-priority-confirm-dialog.mjs +6 -6
  19. package/dist/main/alert-dialog/info-dialog.js +1 -1
  20. package/dist/main/alert-dialog/info-dialog.mjs +2 -2
  21. package/dist/main/alert-dialog/undoable-confirm-dialog.js +2 -2
  22. package/dist/main/alert-dialog/undoable-confirm-dialog.mjs +3 -3
  23. package/dist/main/anime/anime-beam-frame.d.ts +3 -0
  24. package/dist/main/anime/anime-beam-frame.js +63 -0
  25. package/dist/main/anime/anime-beam-frame.mjs +61 -0
  26. package/dist/main/anime/anime-spiral-loading.d.ts +10 -0
  27. package/dist/main/anime/anime-spiral-loading.js +77 -0
  28. package/dist/main/anime/anime-spiral-loading.mjs +75 -0
  29. package/dist/main/anime/index.d.ts +2 -0
  30. package/dist/main/anime/index.js +10 -0
  31. package/dist/main/anime/index.mjs +3 -0
  32. package/dist/main/beam-frame/animate.d.ts +3 -0
  33. package/dist/main/beam-frame/animate.js +63 -0
  34. package/dist/main/beam-frame/animate.mjs +61 -0
  35. package/dist/main/beam-frame/beam-frame.d.ts +4 -0
  36. package/dist/main/beam-frame/beam-frame.js +262 -0
  37. package/dist/main/beam-frame/beam-frame.mjs +258 -0
  38. package/dist/main/beam-frame/index.d.ts +4 -0
  39. package/dist/main/beam-frame/index.js +11 -0
  40. package/dist/main/beam-frame/index.mjs +3 -0
  41. package/dist/main/beam-frame/motion.d.ts +3 -0
  42. package/dist/main/beam-frame/motion.js +61 -0
  43. package/dist/main/beam-frame/motion.mjs +59 -0
  44. package/dist/main/beam-frame/share-config.d.ts +54 -0
  45. package/dist/main/beam-frame/share-config.js +161 -0
  46. package/dist/main/beam-frame/share-config.mjs +152 -0
  47. package/dist/main/beam-frame-config.d.ts +54 -0
  48. package/dist/main/beam-frame-config.js +161 -0
  49. package/dist/main/beam-frame-config.mjs +152 -0
  50. package/dist/main/calendar/random-date-range-dialog.js +177 -51
  51. package/dist/main/calendar/random-date-range-dialog.mjs +178 -52
  52. package/dist/main/cta.js +17 -1
  53. package/dist/main/cta.mjs +18 -2
  54. package/dist/main/delayed-img.d.ts +1 -1
  55. package/dist/main/delayed-img.js +8 -5
  56. package/dist/main/delayed-img.mjs +8 -5
  57. package/dist/main/info-tooltip.js +70 -9
  58. package/dist/main/info-tooltip.mjs +70 -9
  59. package/dist/main/loading-frame/index.d.ts +1 -0
  60. package/dist/main/loading.d.ts +2 -1
  61. package/dist/main/loading.js +64 -26
  62. package/dist/main/loading.mjs +64 -26
  63. package/dist/main/motion/index.d.ts +1 -0
  64. package/dist/main/motion/index.js +9 -0
  65. package/dist/main/motion/index.mjs +2 -0
  66. package/dist/main/motion/motion-beam-frame.d.ts +3 -0
  67. package/dist/main/motion/motion-beam-frame.js +61 -0
  68. package/dist/main/motion/motion-beam-frame.mjs +59 -0
  69. package/dist/main/snake-loading-frame.d.ts +7 -3
  70. package/dist/main/snake-loading-frame.js +44 -252
  71. package/dist/main/snake-loading-frame.mjs +46 -254
  72. package/package.json +16 -5
  73. package/src/fuma/mdx/cheet-table.tsx +650 -0
  74. package/src/fuma/mdx/index.ts +1 -0
  75. package/src/fuma/server/features/widgets.tsx +2 -0
  76. package/src/main/alert-dialog/confirm-dialog.tsx +2 -1
  77. package/src/main/alert-dialog/dialog-loading-action.tsx +7 -5
  78. package/src/main/alert-dialog/dialog-styles.ts +13 -3
  79. package/src/main/alert-dialog/high-priority-confirm-dialog.tsx +26 -23
  80. package/src/main/alert-dialog/info-dialog.tsx +2 -1
  81. package/src/main/alert-dialog/undoable-confirm-dialog.tsx +18 -17
  82. package/src/main/anime/anime-beam-frame.tsx +128 -0
  83. package/src/main/anime/anime-spiral-loading.tsx +123 -0
  84. package/src/main/anime/index.ts +9 -0
  85. package/src/main/beam-frame-config.tsx +341 -0
  86. package/src/main/calendar/random-date-range-dialog.tsx +225 -69
  87. package/src/main/cta.tsx +50 -21
  88. package/src/main/delayed-img.tsx +9 -4
  89. package/src/main/info-tooltip.tsx +116 -20
  90. package/src/main/loading-frame/index.ts +4 -0
  91. package/src/main/loading.tsx +75 -24
  92. package/src/main/motion/index.ts +8 -0
  93. package/src/main/motion/motion-beam-frame.tsx +137 -0
  94. package/src/main/snake-loading-frame.tsx +95 -496
  95. package/src/styles/cta.css +21 -4
  96. package/src/styles/third-ui.css +0 -20
@@ -0,0 +1,152 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState, useRef, useEffect } from 'react';
4
+ import { themeName } from '@windrun-huaiin/base-ui/lib';
5
+ import { cn } from '@windrun-huaiin/lib/utils';
6
+
7
+ const THEME_PALETTES = {
8
+ purple: { a: '#AC62FD', b: '#EC4899', c: '#6366F1' },
9
+ orange: { a: '#F97316', b: '#F59E0B', c: '#EF4444' },
10
+ indigo: { a: '#6366F1', b: '#3B82F6', c: '#06B6D4' },
11
+ emerald: { a: '#10B981', b: '#14B8A6', c: '#22C55E' },
12
+ rose: { a: '#F43F5E', b: '#EC4899', c: '#FB7185' },
13
+ };
14
+ const TONE_PALETTES = {
15
+ rainbow: { a: '#FF3D77', b: '#3388FF', c: '#00FF88' },
16
+ mono: { a: '#E5E7EB', b: '#94A3B8', c: '#FFFFFF' },
17
+ warm: { a: '#F97316', b: '#FBBF24', c: '#EF4444' },
18
+ cool: { a: '#06B6D4', b: '#6366F1', c: '#14B8A6' },
19
+ };
20
+ const BEAM_FRAME_STYLE = {
21
+ ambientGlowOpacity: 0.24,
22
+ beamOpacity: 1.0,
23
+ auraOpacity: 0.86,
24
+ auraLength: 0.08,
25
+ traceLength: 0.42,
26
+ traceWidth: 1.15,
27
+ ambientGlowWidth: 7,
28
+ auraWidth: 8.5,
29
+ };
30
+ const BASE_BORDER_OPACITY = 0.18;
31
+ const BASE_DURATION_SECONDS = 3.6;
32
+ const DEFAULT_RADIUS = 24;
33
+ function getPalette(tone) {
34
+ var _a;
35
+ if (tone !== 'theme') {
36
+ return TONE_PALETTES[tone];
37
+ }
38
+ return (_a = THEME_PALETTES[themeName]) !== null && _a !== void 0 ? _a : THEME_PALETTES.purple;
39
+ }
40
+ function normalizeDuration(duration) {
41
+ if (!Number.isFinite(duration)) {
42
+ return BASE_DURATION_SECONDS;
43
+ }
44
+ return Math.max(0.4, duration);
45
+ }
46
+ function useMeasuredFrameSize() {
47
+ const ref = useRef(null);
48
+ const [size, setSize] = useState({ width: 0, height: 0 });
49
+ useEffect(() => {
50
+ const node = ref.current;
51
+ if (!node) {
52
+ return undefined;
53
+ }
54
+ const updateSize = () => {
55
+ const rect = node.getBoundingClientRect();
56
+ setSize({
57
+ width: Math.max(0, rect.width),
58
+ height: Math.max(0, rect.height),
59
+ });
60
+ };
61
+ updateSize();
62
+ const observer = new ResizeObserver(updateSize);
63
+ observer.observe(node);
64
+ return () => observer.disconnect();
65
+ }, []);
66
+ return { ref, size };
67
+ }
68
+ function useInteractiveRunning(active, interactive) {
69
+ const [isInteractiveRunning, setIsInteractiveRunning] = useState(false);
70
+ const interactionProps = interactive
71
+ ? {
72
+ onMouseEnter: () => setIsInteractiveRunning(true),
73
+ onMouseLeave: () => setIsInteractiveRunning(false),
74
+ onFocus: () => setIsInteractiveRunning(true),
75
+ onBlur: () => setIsInteractiveRunning(false),
76
+ }
77
+ : {};
78
+ return {
79
+ isRunning: active || isInteractiveRunning,
80
+ interactionProps,
81
+ };
82
+ }
83
+ function createRootStyle({ tone, radius, }) {
84
+ const palette = getPalette(tone);
85
+ const frameRadius = radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS;
86
+ return {
87
+ '--beam-frame-radius': `${frameRadius}px`,
88
+ '--beam-frame-color-a': palette.a,
89
+ '--beam-frame-color-b': palette.b,
90
+ '--beam-frame-color-c': palette.c,
91
+ '--beam-frame-border-opacity': BASE_BORDER_OPACITY,
92
+ '--beam-frame-ambient-glow-opacity': BEAM_FRAME_STYLE.ambientGlowOpacity,
93
+ '--beam-frame-beam-opacity': BEAM_FRAME_STYLE.beamOpacity,
94
+ '--beam-frame-aura-opacity': BEAM_FRAME_STYLE.auraOpacity,
95
+ '--beam-frame-aura-length': BEAM_FRAME_STYLE.auraLength,
96
+ '--beam-frame-aura-dash-pattern': 'var(--beam-frame-aura-length) calc(1 - var(--beam-frame-aura-length))',
97
+ '--beam-frame-trace-length': BEAM_FRAME_STYLE.traceLength,
98
+ '--beam-frame-trace-dash-pattern': 'var(--beam-frame-trace-length) calc(1 - var(--beam-frame-trace-length))',
99
+ '--beam-frame-trace-width': BEAM_FRAME_STYLE.traceWidth,
100
+ '--beam-frame-ambient-glow-width': BEAM_FRAME_STYLE.ambientGlowWidth,
101
+ '--beam-frame-aura-width': BEAM_FRAME_STYLE.auraWidth,
102
+ };
103
+ }
104
+ function BeamFrameShell({ children, className, tone, radius, isRunning, interactionProps, renderBeam, rootRef, }) {
105
+ return (jsxs("div", Object.assign({ ref: rootRef, className: cn('group/beam-frame relative isolate overflow-hidden rounded-(--beam-frame-radius) p-px', className), "data-beam-running": isRunning ? 'true' : 'false', style: createRootStyle({ tone, radius }) }, interactionProps, { children: [renderBeam(), jsx("div", { className: "relative z-10 rounded-[calc(var(--beam-frame-radius)-1px)]", children: children })] })));
106
+ }
107
+ function createBeamGeometry({ radius, size, }) {
108
+ const strokeWidth = 3;
109
+ const width = Math.max(1, size.width);
110
+ const height = Math.max(1, size.height);
111
+ const rectOffset = strokeWidth / 2;
112
+ const rectWidth = Math.max(1, width - strokeWidth);
113
+ const rectHeight = Math.max(1, height - strokeWidth);
114
+ const rectRadius = Math.max(0, Math.min(radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS, rectWidth / 2, rectHeight / 2));
115
+ const rectRight = rectOffset + rectWidth;
116
+ const rectBottom = rectOffset + rectHeight;
117
+ const roundedPathLap = [
118
+ `H ${rectRight - rectRadius}`,
119
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight} ${rectOffset + rectRadius}`,
120
+ `V ${rectBottom - rectRadius}`,
121
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight - rectRadius} ${rectBottom}`,
122
+ `H ${rectOffset + rectRadius}`,
123
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset} ${rectBottom - rectRadius}`,
124
+ `V ${rectOffset + rectRadius}`,
125
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset + rectRadius} ${rectOffset}`,
126
+ ].join(' ');
127
+ const extendedRoundedPath = `M ${rectOffset + rectRadius} ${rectOffset} ${roundedPathLap} ${roundedPathLap}`;
128
+ return {
129
+ width,
130
+ height,
131
+ rectOffset,
132
+ rectWidth,
133
+ rectHeight,
134
+ rectRadius,
135
+ rectRight,
136
+ rectBottom,
137
+ extendedRoundedPath,
138
+ };
139
+ }
140
+ function BeamSvgLayer({ beamRef, auraGradientId, softGlowFilterId, radius, size, }) {
141
+ const { width, height, rectOffset, rectWidth, rectHeight, rectRadius, rectRight, rectBottom, extendedRoundedPath, } = createBeamGeometry({
142
+ radius,
143
+ size,
144
+ });
145
+ return (jsxs("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-20 h-full w-full overflow-visible", preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, children: [jsxs("g", { ref: beamRef, opacity: "0", style: { mixBlendMode: 'plus-lighter' }, children: [jsx("rect", { x: rectOffset, y: rectOffset, width: rectWidth, height: rectHeight, rx: rectRadius, ry: rectRadius, pathLength: "1", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-ambient-glow-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, opacity: "var(--beam-frame-ambient-glow-opacity)" }), jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-aura-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, style: {
146
+ strokeDasharray: 'var(--beam-frame-aura-dash-pattern)',
147
+ }, opacity: "var(--beam-frame-aura-opacity)" }), jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-trace-width)", vectorEffect: "non-scaling-stroke", style: {
148
+ strokeDasharray: 'var(--beam-frame-trace-dash-pattern)',
149
+ }, opacity: "var(--beam-frame-beam-opacity)" })] }), jsxs("defs", { children: [jsx("filter", { id: softGlowFilterId, x: "-40%", y: "-40%", width: "180%", height: "180%", children: jsx("feGaussianBlur", { stdDeviation: "8" }) }), jsxs("linearGradient", { id: auraGradientId, x1: rectOffset, x2: rectRight, y1: rectOffset, y2: rectBottom, gradientUnits: "userSpaceOnUse", children: [jsx("stop", { offset: "0%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.58" }), jsx("stop", { offset: "22%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "0.78" }), jsx("stop", { offset: "44%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.96" }), jsx("stop", { offset: "58%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "1" }), jsx("stop", { offset: "78%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.82" }), jsx("stop", { offset: "100%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.58" })] })] })] }));
150
+ }
151
+
152
+ export { BASE_DURATION_SECONDS, BeamFrameShell, BeamSvgLayer, DEFAULT_RADIUS, createBeamGeometry, normalizeDuration, useInteractiveRunning, useMeasuredFrameSize };
@@ -0,0 +1,54 @@
1
+ import type { DOMAttributes, ReactNode, RefObject } from 'react';
2
+ export type BeamFrameTone = 'theme' | 'rainbow' | 'mono' | 'warm' | 'cool';
3
+ export type BeamFrameProps = {
4
+ children: ReactNode;
5
+ active?: boolean;
6
+ interactive?: boolean;
7
+ tone?: BeamFrameTone;
8
+ duration?: number;
9
+ radius?: number;
10
+ className?: string;
11
+ };
12
+ export type BeamFrameRenderProps = Required<Pick<BeamFrameProps, 'active' | 'interactive' | 'tone' | 'duration'>> & Pick<BeamFrameProps, 'children' | 'className' | 'radius'>;
13
+ export type FrameSize = {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ export declare const BASE_DURATION_SECONDS = 3.6;
18
+ export declare const DEFAULT_RADIUS = 24;
19
+ export declare function normalizeDuration(duration: number): number;
20
+ export declare function useMeasuredFrameSize<T extends HTMLElement>(): {
21
+ ref: RefObject<T | null>;
22
+ size: FrameSize;
23
+ };
24
+ export declare function useInteractiveRunning(active: boolean, interactive: boolean): {
25
+ isRunning: boolean;
26
+ interactionProps: Pick<DOMAttributes<HTMLDivElement>, "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave">;
27
+ };
28
+ export declare function BeamFrameShell({ children, className, tone, radius, isRunning, interactionProps, renderBeam, rootRef, }: BeamFrameRenderProps & {
29
+ isRunning: boolean;
30
+ interactionProps: Pick<DOMAttributes<HTMLDivElement>, 'onBlur' | 'onFocus' | 'onMouseEnter' | 'onMouseLeave'>;
31
+ renderBeam: () => ReactNode;
32
+ rootRef: RefObject<HTMLDivElement | null>;
33
+ }): import("react/jsx-runtime").JSX.Element;
34
+ export declare function createBeamGeometry({ radius, size, }: {
35
+ radius?: number;
36
+ size: FrameSize;
37
+ }): {
38
+ width: number;
39
+ height: number;
40
+ rectOffset: number;
41
+ rectWidth: number;
42
+ rectHeight: number;
43
+ rectRadius: number;
44
+ rectRight: number;
45
+ rectBottom: number;
46
+ extendedRoundedPath: string;
47
+ };
48
+ export declare function BeamSvgLayer({ beamRef, auraGradientId, softGlowFilterId, radius, size, }: {
49
+ beamRef: RefObject<SVGGElement | null>;
50
+ auraGradientId: string;
51
+ softGlowFilterId: string;
52
+ radius?: number;
53
+ size: FrameSize;
54
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,161 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var lib = require('@windrun-huaiin/base-ui/lib');
7
+ var utils = require('@windrun-huaiin/lib/utils');
8
+
9
+ const THEME_PALETTES = {
10
+ purple: { a: '#AC62FD', b: '#EC4899', c: '#6366F1' },
11
+ orange: { a: '#F97316', b: '#F59E0B', c: '#EF4444' },
12
+ indigo: { a: '#6366F1', b: '#3B82F6', c: '#06B6D4' },
13
+ emerald: { a: '#10B981', b: '#14B8A6', c: '#22C55E' },
14
+ rose: { a: '#F43F5E', b: '#EC4899', c: '#FB7185' },
15
+ };
16
+ const TONE_PALETTES = {
17
+ rainbow: { a: '#FF3D77', b: '#3388FF', c: '#00FF88' },
18
+ mono: { a: '#E5E7EB', b: '#94A3B8', c: '#FFFFFF' },
19
+ warm: { a: '#F97316', b: '#FBBF24', c: '#EF4444' },
20
+ cool: { a: '#06B6D4', b: '#6366F1', c: '#14B8A6' },
21
+ };
22
+ const BEAM_FRAME_STYLE = {
23
+ ambientGlowOpacity: 0.24,
24
+ beamOpacity: 1.0,
25
+ auraOpacity: 0.86,
26
+ auraLength: 0.08,
27
+ traceLength: 0.42,
28
+ traceWidth: 1.15,
29
+ ambientGlowWidth: 7,
30
+ auraWidth: 8.5,
31
+ };
32
+ const BASE_BORDER_OPACITY = 0.18;
33
+ const BASE_DURATION_SECONDS = 3.6;
34
+ const DEFAULT_RADIUS = 24;
35
+ function getPalette(tone) {
36
+ var _a;
37
+ if (tone !== 'theme') {
38
+ return TONE_PALETTES[tone];
39
+ }
40
+ return (_a = THEME_PALETTES[lib.themeName]) !== null && _a !== void 0 ? _a : THEME_PALETTES.purple;
41
+ }
42
+ function normalizeDuration(duration) {
43
+ if (!Number.isFinite(duration)) {
44
+ return BASE_DURATION_SECONDS;
45
+ }
46
+ return Math.max(0.4, duration);
47
+ }
48
+ function useMeasuredFrameSize() {
49
+ const ref = React.useRef(null);
50
+ const [size, setSize] = React.useState({ width: 0, height: 0 });
51
+ React.useEffect(() => {
52
+ const node = ref.current;
53
+ if (!node) {
54
+ return undefined;
55
+ }
56
+ const updateSize = () => {
57
+ const rect = node.getBoundingClientRect();
58
+ setSize({
59
+ width: Math.max(0, rect.width),
60
+ height: Math.max(0, rect.height),
61
+ });
62
+ };
63
+ updateSize();
64
+ const observer = new ResizeObserver(updateSize);
65
+ observer.observe(node);
66
+ return () => observer.disconnect();
67
+ }, []);
68
+ return { ref, size };
69
+ }
70
+ function useInteractiveRunning(active, interactive) {
71
+ const [isInteractiveRunning, setIsInteractiveRunning] = React.useState(false);
72
+ const interactionProps = interactive
73
+ ? {
74
+ onMouseEnter: () => setIsInteractiveRunning(true),
75
+ onMouseLeave: () => setIsInteractiveRunning(false),
76
+ onFocus: () => setIsInteractiveRunning(true),
77
+ onBlur: () => setIsInteractiveRunning(false),
78
+ }
79
+ : {};
80
+ return {
81
+ isRunning: active || isInteractiveRunning,
82
+ interactionProps,
83
+ };
84
+ }
85
+ function createRootStyle({ tone, radius, }) {
86
+ const palette = getPalette(tone);
87
+ const frameRadius = radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS;
88
+ return {
89
+ '--beam-frame-radius': `${frameRadius}px`,
90
+ '--beam-frame-color-a': palette.a,
91
+ '--beam-frame-color-b': palette.b,
92
+ '--beam-frame-color-c': palette.c,
93
+ '--beam-frame-border-opacity': BASE_BORDER_OPACITY,
94
+ '--beam-frame-ambient-glow-opacity': BEAM_FRAME_STYLE.ambientGlowOpacity,
95
+ '--beam-frame-beam-opacity': BEAM_FRAME_STYLE.beamOpacity,
96
+ '--beam-frame-aura-opacity': BEAM_FRAME_STYLE.auraOpacity,
97
+ '--beam-frame-aura-length': BEAM_FRAME_STYLE.auraLength,
98
+ '--beam-frame-aura-dash-pattern': 'var(--beam-frame-aura-length) calc(1 - var(--beam-frame-aura-length))',
99
+ '--beam-frame-trace-length': BEAM_FRAME_STYLE.traceLength,
100
+ '--beam-frame-trace-dash-pattern': 'var(--beam-frame-trace-length) calc(1 - var(--beam-frame-trace-length))',
101
+ '--beam-frame-trace-width': BEAM_FRAME_STYLE.traceWidth,
102
+ '--beam-frame-ambient-glow-width': BEAM_FRAME_STYLE.ambientGlowWidth,
103
+ '--beam-frame-aura-width': BEAM_FRAME_STYLE.auraWidth,
104
+ };
105
+ }
106
+ function BeamFrameShell({ children, className, tone, radius, isRunning, interactionProps, renderBeam, rootRef, }) {
107
+ return (jsxRuntime.jsxs("div", Object.assign({ ref: rootRef, className: utils.cn('group/beam-frame relative isolate overflow-hidden rounded-(--beam-frame-radius) p-px', className), "data-beam-running": isRunning ? 'true' : 'false', style: createRootStyle({ tone, radius }) }, interactionProps, { children: [renderBeam(), jsxRuntime.jsx("div", { className: "relative z-10 rounded-[calc(var(--beam-frame-radius)-1px)]", children: children })] })));
108
+ }
109
+ function createBeamGeometry({ radius, size, }) {
110
+ const strokeWidth = 3;
111
+ const width = Math.max(1, size.width);
112
+ const height = Math.max(1, size.height);
113
+ const rectOffset = strokeWidth / 2;
114
+ const rectWidth = Math.max(1, width - strokeWidth);
115
+ const rectHeight = Math.max(1, height - strokeWidth);
116
+ const rectRadius = Math.max(0, Math.min(radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS, rectWidth / 2, rectHeight / 2));
117
+ const rectRight = rectOffset + rectWidth;
118
+ const rectBottom = rectOffset + rectHeight;
119
+ const roundedPathLap = [
120
+ `H ${rectRight - rectRadius}`,
121
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight} ${rectOffset + rectRadius}`,
122
+ `V ${rectBottom - rectRadius}`,
123
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight - rectRadius} ${rectBottom}`,
124
+ `H ${rectOffset + rectRadius}`,
125
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset} ${rectBottom - rectRadius}`,
126
+ `V ${rectOffset + rectRadius}`,
127
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset + rectRadius} ${rectOffset}`,
128
+ ].join(' ');
129
+ const extendedRoundedPath = `M ${rectOffset + rectRadius} ${rectOffset} ${roundedPathLap} ${roundedPathLap}`;
130
+ return {
131
+ width,
132
+ height,
133
+ rectOffset,
134
+ rectWidth,
135
+ rectHeight,
136
+ rectRadius,
137
+ rectRight,
138
+ rectBottom,
139
+ extendedRoundedPath,
140
+ };
141
+ }
142
+ function BeamSvgLayer({ beamRef, auraGradientId, softGlowFilterId, radius, size, }) {
143
+ const { width, height, rectOffset, rectWidth, rectHeight, rectRadius, rectRight, rectBottom, extendedRoundedPath, } = createBeamGeometry({
144
+ radius,
145
+ size,
146
+ });
147
+ return (jsxRuntime.jsxs("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-20 h-full w-full overflow-visible", preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, children: [jsxRuntime.jsxs("g", { ref: beamRef, opacity: "0", style: { mixBlendMode: 'plus-lighter' }, children: [jsxRuntime.jsx("rect", { x: rectOffset, y: rectOffset, width: rectWidth, height: rectHeight, rx: rectRadius, ry: rectRadius, pathLength: "1", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-ambient-glow-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, opacity: "var(--beam-frame-ambient-glow-opacity)" }), jsxRuntime.jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-aura-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, style: {
148
+ strokeDasharray: 'var(--beam-frame-aura-dash-pattern)',
149
+ }, opacity: "var(--beam-frame-aura-opacity)" }), jsxRuntime.jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-trace-width)", vectorEffect: "non-scaling-stroke", style: {
150
+ strokeDasharray: 'var(--beam-frame-trace-dash-pattern)',
151
+ }, opacity: "var(--beam-frame-beam-opacity)" })] }), jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsx("filter", { id: softGlowFilterId, x: "-40%", y: "-40%", width: "180%", height: "180%", children: jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "8" }) }), jsxRuntime.jsxs("linearGradient", { id: auraGradientId, x1: rectOffset, x2: rectRight, y1: rectOffset, y2: rectBottom, gradientUnits: "userSpaceOnUse", children: [jsxRuntime.jsx("stop", { offset: "0%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.58" }), jsxRuntime.jsx("stop", { offset: "22%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "0.78" }), jsxRuntime.jsx("stop", { offset: "44%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.96" }), jsxRuntime.jsx("stop", { offset: "58%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "1" }), jsxRuntime.jsx("stop", { offset: "78%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.82" }), jsxRuntime.jsx("stop", { offset: "100%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.58" })] })] })] }));
152
+ }
153
+
154
+ exports.BASE_DURATION_SECONDS = BASE_DURATION_SECONDS;
155
+ exports.BeamFrameShell = BeamFrameShell;
156
+ exports.BeamSvgLayer = BeamSvgLayer;
157
+ exports.DEFAULT_RADIUS = DEFAULT_RADIUS;
158
+ exports.createBeamGeometry = createBeamGeometry;
159
+ exports.normalizeDuration = normalizeDuration;
160
+ exports.useInteractiveRunning = useInteractiveRunning;
161
+ exports.useMeasuredFrameSize = useMeasuredFrameSize;
@@ -0,0 +1,152 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState, useRef, useEffect } from 'react';
4
+ import { themeName } from '@windrun-huaiin/base-ui/lib';
5
+ import { cn } from '@windrun-huaiin/lib/utils';
6
+
7
+ const THEME_PALETTES = {
8
+ purple: { a: '#AC62FD', b: '#EC4899', c: '#6366F1' },
9
+ orange: { a: '#F97316', b: '#F59E0B', c: '#EF4444' },
10
+ indigo: { a: '#6366F1', b: '#3B82F6', c: '#06B6D4' },
11
+ emerald: { a: '#10B981', b: '#14B8A6', c: '#22C55E' },
12
+ rose: { a: '#F43F5E', b: '#EC4899', c: '#FB7185' },
13
+ };
14
+ const TONE_PALETTES = {
15
+ rainbow: { a: '#FF3D77', b: '#3388FF', c: '#00FF88' },
16
+ mono: { a: '#E5E7EB', b: '#94A3B8', c: '#FFFFFF' },
17
+ warm: { a: '#F97316', b: '#FBBF24', c: '#EF4444' },
18
+ cool: { a: '#06B6D4', b: '#6366F1', c: '#14B8A6' },
19
+ };
20
+ const BEAM_FRAME_STYLE = {
21
+ ambientGlowOpacity: 0.24,
22
+ beamOpacity: 1.0,
23
+ auraOpacity: 0.86,
24
+ auraLength: 0.08,
25
+ traceLength: 0.42,
26
+ traceWidth: 1.15,
27
+ ambientGlowWidth: 7,
28
+ auraWidth: 8.5,
29
+ };
30
+ const BASE_BORDER_OPACITY = 0.18;
31
+ const BASE_DURATION_SECONDS = 3.6;
32
+ const DEFAULT_RADIUS = 24;
33
+ function getPalette(tone) {
34
+ var _a;
35
+ if (tone !== 'theme') {
36
+ return TONE_PALETTES[tone];
37
+ }
38
+ return (_a = THEME_PALETTES[themeName]) !== null && _a !== void 0 ? _a : THEME_PALETTES.purple;
39
+ }
40
+ function normalizeDuration(duration) {
41
+ if (!Number.isFinite(duration)) {
42
+ return BASE_DURATION_SECONDS;
43
+ }
44
+ return Math.max(0.4, duration);
45
+ }
46
+ function useMeasuredFrameSize() {
47
+ const ref = useRef(null);
48
+ const [size, setSize] = useState({ width: 0, height: 0 });
49
+ useEffect(() => {
50
+ const node = ref.current;
51
+ if (!node) {
52
+ return undefined;
53
+ }
54
+ const updateSize = () => {
55
+ const rect = node.getBoundingClientRect();
56
+ setSize({
57
+ width: Math.max(0, rect.width),
58
+ height: Math.max(0, rect.height),
59
+ });
60
+ };
61
+ updateSize();
62
+ const observer = new ResizeObserver(updateSize);
63
+ observer.observe(node);
64
+ return () => observer.disconnect();
65
+ }, []);
66
+ return { ref, size };
67
+ }
68
+ function useInteractiveRunning(active, interactive) {
69
+ const [isInteractiveRunning, setIsInteractiveRunning] = useState(false);
70
+ const interactionProps = interactive
71
+ ? {
72
+ onMouseEnter: () => setIsInteractiveRunning(true),
73
+ onMouseLeave: () => setIsInteractiveRunning(false),
74
+ onFocus: () => setIsInteractiveRunning(true),
75
+ onBlur: () => setIsInteractiveRunning(false),
76
+ }
77
+ : {};
78
+ return {
79
+ isRunning: active || isInteractiveRunning,
80
+ interactionProps,
81
+ };
82
+ }
83
+ function createRootStyle({ tone, radius, }) {
84
+ const palette = getPalette(tone);
85
+ const frameRadius = radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS;
86
+ return {
87
+ '--beam-frame-radius': `${frameRadius}px`,
88
+ '--beam-frame-color-a': palette.a,
89
+ '--beam-frame-color-b': palette.b,
90
+ '--beam-frame-color-c': palette.c,
91
+ '--beam-frame-border-opacity': BASE_BORDER_OPACITY,
92
+ '--beam-frame-ambient-glow-opacity': BEAM_FRAME_STYLE.ambientGlowOpacity,
93
+ '--beam-frame-beam-opacity': BEAM_FRAME_STYLE.beamOpacity,
94
+ '--beam-frame-aura-opacity': BEAM_FRAME_STYLE.auraOpacity,
95
+ '--beam-frame-aura-length': BEAM_FRAME_STYLE.auraLength,
96
+ '--beam-frame-aura-dash-pattern': 'var(--beam-frame-aura-length) calc(1 - var(--beam-frame-aura-length))',
97
+ '--beam-frame-trace-length': BEAM_FRAME_STYLE.traceLength,
98
+ '--beam-frame-trace-dash-pattern': 'var(--beam-frame-trace-length) calc(1 - var(--beam-frame-trace-length))',
99
+ '--beam-frame-trace-width': BEAM_FRAME_STYLE.traceWidth,
100
+ '--beam-frame-ambient-glow-width': BEAM_FRAME_STYLE.ambientGlowWidth,
101
+ '--beam-frame-aura-width': BEAM_FRAME_STYLE.auraWidth,
102
+ };
103
+ }
104
+ function BeamFrameShell({ children, className, tone, radius, isRunning, interactionProps, renderBeam, rootRef, }) {
105
+ return (jsxs("div", Object.assign({ ref: rootRef, className: cn('group/beam-frame relative isolate overflow-hidden rounded-(--beam-frame-radius) p-px', className), "data-beam-running": isRunning ? 'true' : 'false', style: createRootStyle({ tone, radius }) }, interactionProps, { children: [renderBeam(), jsx("div", { className: "relative z-10 rounded-[calc(var(--beam-frame-radius)-1px)]", children: children })] })));
106
+ }
107
+ function createBeamGeometry({ radius, size, }) {
108
+ const strokeWidth = 3;
109
+ const width = Math.max(1, size.width);
110
+ const height = Math.max(1, size.height);
111
+ const rectOffset = strokeWidth / 2;
112
+ const rectWidth = Math.max(1, width - strokeWidth);
113
+ const rectHeight = Math.max(1, height - strokeWidth);
114
+ const rectRadius = Math.max(0, Math.min(radius !== null && radius !== void 0 ? radius : DEFAULT_RADIUS, rectWidth / 2, rectHeight / 2));
115
+ const rectRight = rectOffset + rectWidth;
116
+ const rectBottom = rectOffset + rectHeight;
117
+ const roundedPathLap = [
118
+ `H ${rectRight - rectRadius}`,
119
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight} ${rectOffset + rectRadius}`,
120
+ `V ${rectBottom - rectRadius}`,
121
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectRight - rectRadius} ${rectBottom}`,
122
+ `H ${rectOffset + rectRadius}`,
123
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset} ${rectBottom - rectRadius}`,
124
+ `V ${rectOffset + rectRadius}`,
125
+ `A ${rectRadius} ${rectRadius} 0 0 1 ${rectOffset + rectRadius} ${rectOffset}`,
126
+ ].join(' ');
127
+ const extendedRoundedPath = `M ${rectOffset + rectRadius} ${rectOffset} ${roundedPathLap} ${roundedPathLap}`;
128
+ return {
129
+ width,
130
+ height,
131
+ rectOffset,
132
+ rectWidth,
133
+ rectHeight,
134
+ rectRadius,
135
+ rectRight,
136
+ rectBottom,
137
+ extendedRoundedPath,
138
+ };
139
+ }
140
+ function BeamSvgLayer({ beamRef, auraGradientId, softGlowFilterId, radius, size, }) {
141
+ const { width, height, rectOffset, rectWidth, rectHeight, rectRadius, rectRight, rectBottom, extendedRoundedPath, } = createBeamGeometry({
142
+ radius,
143
+ size,
144
+ });
145
+ return (jsxs("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-20 h-full w-full overflow-visible", preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, children: [jsxs("g", { ref: beamRef, opacity: "0", style: { mixBlendMode: 'plus-lighter' }, children: [jsx("rect", { x: rectOffset, y: rectOffset, width: rectWidth, height: rectHeight, rx: rectRadius, ry: rectRadius, pathLength: "1", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-ambient-glow-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, opacity: "var(--beam-frame-ambient-glow-opacity)" }), jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-aura-width)", vectorEffect: "non-scaling-stroke", filter: `url(#${softGlowFilterId})`, style: {
146
+ strokeDasharray: 'var(--beam-frame-aura-dash-pattern)',
147
+ }, opacity: "var(--beam-frame-aura-opacity)" }), jsx("path", { d: extendedRoundedPath, pathLength: "2", fill: "none", stroke: `url(#${auraGradientId})`, strokeLinecap: "round", strokeWidth: "var(--beam-frame-trace-width)", vectorEffect: "non-scaling-stroke", style: {
148
+ strokeDasharray: 'var(--beam-frame-trace-dash-pattern)',
149
+ }, opacity: "var(--beam-frame-beam-opacity)" })] }), jsxs("defs", { children: [jsx("filter", { id: softGlowFilterId, x: "-40%", y: "-40%", width: "180%", height: "180%", children: jsx("feGaussianBlur", { stdDeviation: "8" }) }), jsxs("linearGradient", { id: auraGradientId, x1: rectOffset, x2: rectRight, y1: rectOffset, y2: rectBottom, gradientUnits: "userSpaceOnUse", children: [jsx("stop", { offset: "0%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.58" }), jsx("stop", { offset: "22%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "0.78" }), jsx("stop", { offset: "44%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.96" }), jsx("stop", { offset: "58%", stopColor: "var(--beam-frame-color-b)", stopOpacity: "1" }), jsx("stop", { offset: "78%", stopColor: "var(--beam-frame-color-a)", stopOpacity: "0.82" }), jsx("stop", { offset: "100%", stopColor: "var(--beam-frame-color-c)", stopOpacity: "0.58" })] })] })] }));
150
+ }
151
+
152
+ export { BASE_DURATION_SECONDS, BeamFrameShell, BeamSvgLayer, DEFAULT_RADIUS, createBeamGeometry, normalizeDuration, useInteractiveRunning, useMeasuredFrameSize };