@mks2508/mks-ui 0.5.2 → 0.5.7
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/react-ui/index.js +8 -3
- package/dist/react-ui/primitives/index.js +5 -0
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +120 -0
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +10 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +190 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyFilter.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyFilter.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/GooeyFilter.js +78 -0
- package/dist/react-ui/primitives/waapi/Gooey/MorphPath.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/MorphPath.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/MorphPath.js +51 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts +94 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.js +182 -0
- package/dist/react-ui/primitives/waapi/Gooey/index.d.ts +28 -0
- package/dist/react-ui/primitives/waapi/Gooey/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/index.js +5 -0
- package/dist/react-ui/primitives/waapi/Gooey/useMorphPath.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/useMorphPath.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Gooey/useMorphPath.js +47 -0
- package/dist/react-ui/primitives/waapi/index.d.ts +2 -0
- package/dist/react-ui/primitives/waapi/index.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/index.js +6 -0
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +26 -16
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/DataCard/DataCard.styles.js +36 -74
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +50 -70
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts.map +1 -1
- package/dist/react-ui/ui/DataCard/index.d.ts +24 -93
- package/dist/react-ui/ui/DataCard/index.d.ts.map +1 -1
- package/dist/react-ui/ui/DataCard/index.js +76 -118
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle-DOR3Ld-k.css +376 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +376 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.js +0 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +20 -8
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +55 -27
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +69 -14
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.d.ts +22 -20
- package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.js +133 -96
- package/dist/react-ui/ui/Switch/index.js +1 -1
- package/dist/react-ui/ui/index.js +2 -2
- package/package.json +2 -2
- package/src/css.d.ts +1 -0
- package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +141 -0
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +217 -0
- package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +77 -0
- package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +58 -0
- package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +253 -0
- package/src/react-ui/primitives/waapi/Gooey/index.ts +50 -0
- package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +48 -0
- package/src/react-ui/primitives/waapi/index.ts +23 -0
- package/src/react-ui/ui/DataCard/DataCard.styles.ts +45 -101
- package/src/react-ui/ui/DataCard/DataCard.types.ts +52 -73
- package/src/react-ui/ui/DataCard/index.tsx +118 -184
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +320 -94
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +60 -40
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +101 -14
- package/src/react-ui/ui/DynamicToggle/index.tsx +172 -96
- package/src/react-ui/ui/DynamicToggle/prototype-v7-ios.html +413 -0
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +615 -0
- package/src/react-ui/ui/DynamicToggle/prototype-v8-gooey-safari.html +560 -0
- package/src/react-ui/ui/DynamicToggle/prototype-v8b-react-structure.html +227 -0
- package/src/react-ui/ui/DynamicToggle/prototype.html +419 -0
- package/src/react-ui/ui/Switch/index.tsx +1 -1
- /package/dist/react-ui/blocks/Terminal/panel/{terminal-filter-dropdown.module-DAcl_XQZ.css → terminal-filter-dropdown.module-C6oDcFBS.css} +0 -0
- /package/dist/react-ui/blocks/Terminal/panel/{terminal-session-tabs.module-DNAop5e3.css → terminal-session-tabs.module-D_-sgyza.css} +0 -0
- /package/dist/react-ui/components/MorphingPopover/{morphing-popover.module-BJrjXisF.css → morphing-popover.module-B1ftlaYj.css} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//#region src/react-ui/primitives/waapi/Gooey/gooey-utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Gooey morphing utilities — pure functions for SVG filter and path generation.
|
|
4
|
+
*
|
|
5
|
+
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
6
|
+
*/
|
|
7
|
+
/** Gooey animation timing constants. */
|
|
8
|
+
const GOOEY_TIMING = {
|
|
9
|
+
EXPAND_DURATION: 550,
|
|
10
|
+
COLLAPSE_DURATION: 400
|
|
11
|
+
};
|
|
12
|
+
/** Default gooey filter parameters. */
|
|
13
|
+
const GOOEY_DEFAULTS = {
|
|
14
|
+
BLUR_RATIO: .15,
|
|
15
|
+
ALPHA_GAIN: 20,
|
|
16
|
+
ALPHA_OFFSET: -10,
|
|
17
|
+
PILL_HEIGHT: 34,
|
|
18
|
+
CURVE_FACTOR: 14,
|
|
19
|
+
MAX_CORNER_RADIUS: 16,
|
|
20
|
+
CORNER_RATIO: .45,
|
|
21
|
+
MIN_BODY_DELTA: 8
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Compute the optimal Gaussian blur for a gooey filter based on element height.
|
|
25
|
+
*
|
|
26
|
+
* @param height - Element height in pixels
|
|
27
|
+
* @returns Blur stdDeviation value
|
|
28
|
+
*/
|
|
29
|
+
function computeBlur(height) {
|
|
30
|
+
return Math.round(height * GOOEY_DEFAULTS.BLUR_RATIO);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build the feColorMatrix `values` string.
|
|
34
|
+
*
|
|
35
|
+
* @param gain - Alpha multiplier (default: 20)
|
|
36
|
+
* @param offset - Alpha offset (default: -10)
|
|
37
|
+
* @returns Matrix values string for feColorMatrix
|
|
38
|
+
*/
|
|
39
|
+
function buildColorMatrixValues(gain = GOOEY_DEFAULTS.ALPHA_GAIN, offset = GOOEY_DEFAULTS.ALPHA_OFFSET) {
|
|
40
|
+
return `1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${gain} ${offset}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build the CSS filter string with gooey + optional drop-shadow outline.
|
|
44
|
+
*
|
|
45
|
+
* @param filterId - SVG filter ID to reference
|
|
46
|
+
* @param outlineBlur - Drop-shadow blur (px)
|
|
47
|
+
* @param outlineColor - Drop-shadow color
|
|
48
|
+
* @param outlineLayers - Number of stacked drop-shadows for thickness
|
|
49
|
+
* @returns CSS filter property value
|
|
50
|
+
*/
|
|
51
|
+
function buildFilterString(filterId, outlineBlur = .5, outlineColor = "var(--border)", outlineLayers = 2) {
|
|
52
|
+
const goo = `url(#${filterId})`;
|
|
53
|
+
const shadow = `drop-shadow(0 0 ${outlineBlur}px ${outlineColor})`;
|
|
54
|
+
return `${goo} ${Array(outlineLayers).fill(shadow).join(" ")}`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Memoize a path generation function — caches last result to avoid
|
|
58
|
+
* recomputing identical paths on consecutive animation frames.
|
|
59
|
+
*
|
|
60
|
+
* @param fn - Path generation function
|
|
61
|
+
* @returns Memoized function
|
|
62
|
+
*/
|
|
63
|
+
function memoizePath(fn) {
|
|
64
|
+
let lastArgs = null;
|
|
65
|
+
let lastResult = "";
|
|
66
|
+
return (pw, bw, th, t, ph) => {
|
|
67
|
+
if (lastArgs && lastArgs[0] === pw && lastArgs[1] === bw && lastArgs[2] === th && lastArgs[3] === t && lastArgs[4] === ph) return lastResult;
|
|
68
|
+
lastResult = fn(pw, bw, th, t, ph);
|
|
69
|
+
lastArgs = [
|
|
70
|
+
pw,
|
|
71
|
+
bw,
|
|
72
|
+
th,
|
|
73
|
+
t,
|
|
74
|
+
ph
|
|
75
|
+
];
|
|
76
|
+
return lastResult;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Generate an SVG path for a pill that morphs downward into a body blob.
|
|
81
|
+
* Adapted from goey-toast's morphPathRaw.
|
|
82
|
+
*
|
|
83
|
+
* @param pw - Pill width
|
|
84
|
+
* @param bw - Body width (expanded)
|
|
85
|
+
* @param th - Total height (pill + body)
|
|
86
|
+
* @param t - Transition progress 0 (pill only) → 1 (full blob)
|
|
87
|
+
* @param ph - Pill height (default: PILL_HEIGHT)
|
|
88
|
+
* @returns SVG path d-string
|
|
89
|
+
*/
|
|
90
|
+
function morphPathDown(pw, bw, th, t, ph = GOOEY_DEFAULTS.PILL_HEIGHT) {
|
|
91
|
+
const pr = ph / 2;
|
|
92
|
+
const pillW = Math.min(pw, bw);
|
|
93
|
+
const bodyH = ph + (th - ph) * t;
|
|
94
|
+
if (t <= 0 || bodyH - ph < GOOEY_DEFAULTS.MIN_BODY_DELTA) return [
|
|
95
|
+
`M 0,${pr}`,
|
|
96
|
+
`A ${pr},${pr} 0 0 1 ${pr},0`,
|
|
97
|
+
`H ${pillW - pr}`,
|
|
98
|
+
`A ${pr},${pr} 0 0 1 ${pillW},${pr}`,
|
|
99
|
+
`A ${pr},${pr} 0 0 1 ${pillW - pr},${ph}`,
|
|
100
|
+
`H ${pr}`,
|
|
101
|
+
`A ${pr},${pr} 0 0 1 0,${pr}`,
|
|
102
|
+
`Z`
|
|
103
|
+
].join(" ");
|
|
104
|
+
const curve = GOOEY_DEFAULTS.CURVE_FACTOR * t;
|
|
105
|
+
const cr = Math.min(GOOEY_DEFAULTS.MAX_CORNER_RADIUS, (bodyH - ph) * GOOEY_DEFAULTS.CORNER_RATIO);
|
|
106
|
+
const bodyW = pillW + (bw - pillW) * t;
|
|
107
|
+
const bodyTop = ph - curve;
|
|
108
|
+
const qEndX = Math.min(pillW + curve, bodyW - cr);
|
|
109
|
+
return [
|
|
110
|
+
`M 0,${pr}`,
|
|
111
|
+
`A ${pr},${pr} 0 0 1 ${pr},0`,
|
|
112
|
+
`H ${pillW - pr}`,
|
|
113
|
+
`A ${pr},${pr} 0 0 1 ${pillW},${pr}`,
|
|
114
|
+
`L ${pillW},${bodyTop}`,
|
|
115
|
+
`Q ${pillW},${bodyTop + curve} ${qEndX},${bodyTop + curve}`,
|
|
116
|
+
`H ${bodyW - cr}`,
|
|
117
|
+
`A ${cr},${cr} 0 0 1 ${bodyW},${bodyTop + curve + cr}`,
|
|
118
|
+
`L ${bodyW},${bodyH - cr}`,
|
|
119
|
+
`A ${cr},${cr} 0 0 1 ${bodyW - cr},${bodyH}`,
|
|
120
|
+
`H ${cr}`,
|
|
121
|
+
`A ${cr},${cr} 0 0 1 0,${bodyH - cr}`,
|
|
122
|
+
`Z`
|
|
123
|
+
].join(" ");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Generate an SVG path for a pill that morphs UPWARD into a body blob.
|
|
127
|
+
* Used for DynamicToggle's bubble-above-pill layout.
|
|
128
|
+
*
|
|
129
|
+
* @param pw - Pill width
|
|
130
|
+
* @param bw - Body (bubble) width
|
|
131
|
+
* @param th - Total height (bubble + pill)
|
|
132
|
+
* @param t - Transition progress 0 (pill only) → 1 (full blob with bubble)
|
|
133
|
+
* @param ph - Pill height
|
|
134
|
+
* @returns SVG path d-string
|
|
135
|
+
*/
|
|
136
|
+
function morphPathUp(pw, bw, th, t, ph = GOOEY_DEFAULTS.PILL_HEIGHT) {
|
|
137
|
+
const pr = ph / 2;
|
|
138
|
+
const pillW = Math.min(pw, bw);
|
|
139
|
+
const bubbleH = (th - ph) * t;
|
|
140
|
+
if (t <= 0 || bubbleH < GOOEY_DEFAULTS.MIN_BODY_DELTA) {
|
|
141
|
+
const y0 = th - ph;
|
|
142
|
+
return [
|
|
143
|
+
`M 0,${y0 + pr}`,
|
|
144
|
+
`A ${pr},${pr} 0 0 1 ${pr},${y0}`,
|
|
145
|
+
`H ${pillW - pr}`,
|
|
146
|
+
`A ${pr},${pr} 0 0 1 ${pillW},${y0 + pr}`,
|
|
147
|
+
`A ${pr},${pr} 0 0 1 ${pillW - pr},${y0 + ph}`,
|
|
148
|
+
`H ${pr}`,
|
|
149
|
+
`A ${pr},${pr} 0 0 1 0,${y0 + pr}`,
|
|
150
|
+
`Z`
|
|
151
|
+
].join(" ");
|
|
152
|
+
}
|
|
153
|
+
const curve = GOOEY_DEFAULTS.CURVE_FACTOR * t;
|
|
154
|
+
const cr = Math.min(GOOEY_DEFAULTS.MAX_CORNER_RADIUS, bubbleH * GOOEY_DEFAULTS.CORNER_RATIO);
|
|
155
|
+
const bubbleW = pillW + (bw - pillW) * t;
|
|
156
|
+
const pillTop = th - ph;
|
|
157
|
+
const bubbleBottom = pillTop + curve;
|
|
158
|
+
const bubbleTop = pillTop - bubbleH + curve;
|
|
159
|
+
const qEndX = Math.min(pillW + curve, bubbleW - cr);
|
|
160
|
+
return [
|
|
161
|
+
`M 0,${pillTop + pr}`,
|
|
162
|
+
`A ${pr},${pr} 0 0 1 0,${pillTop + ph - pr}`,
|
|
163
|
+
`A ${pr},${pr} 0 0 1 ${pr},${pillTop + ph}`,
|
|
164
|
+
`H ${pillW - pr}`,
|
|
165
|
+
`A ${pr},${pr} 0 0 1 ${pillW},${pillTop + ph - pr}`,
|
|
166
|
+
`L ${pillW},${bubbleBottom}`,
|
|
167
|
+
`Q ${pillW},${bubbleBottom - curve} ${qEndX},${bubbleBottom - curve}`,
|
|
168
|
+
`H ${bubbleW - cr}`,
|
|
169
|
+
`A ${cr},${cr} 0 0 0 ${bubbleW},${bubbleBottom - curve - cr}`,
|
|
170
|
+
`L ${bubbleW},${bubbleTop + cr}`,
|
|
171
|
+
`A ${cr},${cr} 0 0 0 ${bubbleW - cr},${bubbleTop}`,
|
|
172
|
+
`H ${cr}`,
|
|
173
|
+
`A ${cr},${cr} 0 0 0 0,${bubbleTop + cr}`,
|
|
174
|
+
`Z`
|
|
175
|
+
].join(" ");
|
|
176
|
+
}
|
|
177
|
+
/** Memoized versions for animation performance. */
|
|
178
|
+
const morphPathDownMemo = memoizePath(morphPathDown);
|
|
179
|
+
const morphPathUpMemo = memoizePath(morphPathUp);
|
|
180
|
+
|
|
181
|
+
//#endregion
|
|
182
|
+
export { GOOEY_DEFAULTS, GOOEY_TIMING, buildColorMatrixValues, buildFilterString, computeBlur, memoizePath, morphPathDown, morphPathUp };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gooey — SVG-based morphing primitives for organic shape merging.
|
|
3
|
+
*
|
|
4
|
+
* Two techniques:
|
|
5
|
+
* - **Filter**: `GooeyCanvas` / `GooeyFilter` — SVG filter merges same-colored shapes
|
|
6
|
+
* - **Path**: `MorphPath` / `useMorphPath` — parametric SVG path with Bezier junctions
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // Filter approach — automatic merge
|
|
11
|
+
* <GooeyCanvas height={40}>
|
|
12
|
+
* <div className="bg-card rounded-full h-10 w-64" />
|
|
13
|
+
* <div className="bg-card absolute bottom-full rounded-lg h-6 w-32" />
|
|
14
|
+
* </GooeyCanvas>
|
|
15
|
+
*
|
|
16
|
+
* // Path approach — precise control
|
|
17
|
+
* <svg><MorphPath pillWidth={260} bodyWidth={180} totalHeight={60} progress={0.5} fill="var(--card)" /></svg>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
21
|
+
*/
|
|
22
|
+
export { GooeyFilter } from './GooeyFilter';
|
|
23
|
+
export { GooeyCanvas } from './GooeyCanvas';
|
|
24
|
+
export { MorphPath } from './MorphPath';
|
|
25
|
+
export { useMorphPath } from './useMorphPath';
|
|
26
|
+
export { GOOEY_DEFAULTS, computeBlur, buildColorMatrixValues, buildFilterString, memoizePath, morphPathDown, morphPathUp, morphPathDownMemo, morphPathUpMemo, } from './gooey-utils';
|
|
27
|
+
export type { IGooeyFilterProps, IGooeyCanvasProps, IMorphPathProps, IUseMorphPathOptions, } from './Gooey.types';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/react-ui/primitives/waapi/Gooey/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EACL,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GOOEY_DEFAULTS, buildColorMatrixValues, buildFilterString, computeBlur, memoizePath, morphPathDown, morphPathUp } from "./gooey-utils.js";
|
|
2
|
+
import { GooeyFilter } from "./GooeyFilter.js";
|
|
3
|
+
import { GooeyCanvas } from "./GooeyCanvas.js";
|
|
4
|
+
import { useMorphPath } from "./useMorphPath.js";
|
|
5
|
+
import { MorphPath } from "./MorphPath.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IUseMorphPathOptions } from './Gooey.types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a parametric SVG morph path from dimensions and progress.
|
|
4
|
+
*/
|
|
5
|
+
declare function useMorphPath({ pillWidth, bodyWidth, totalHeight, progress, pillHeight, direction, }: IUseMorphPathOptions): string;
|
|
6
|
+
export { useMorphPath };
|
|
7
|
+
//# sourceMappingURL=useMorphPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMorphPath.d.ts","sourceRoot":"","sources":["../../../../../src/react-ui/primitives/waapi/Gooey/useMorphPath.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;GAEG;AACH,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAuC,EACvC,SAAkB,GACnB,EAAE,oBAAoB,GAAG,MAAM,CAK/B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { GOOEY_DEFAULTS, morphPathDown, morphPathUp } from "./gooey-utils.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/react-ui/primitives/waapi/Gooey/useMorphPath.ts
|
|
7
|
+
/**
|
|
8
|
+
* useMorphPath — hook that generates a parametric SVG path d-string.
|
|
9
|
+
*
|
|
10
|
+
* Returns a memoized path for a pill shape morphing into a blob.
|
|
11
|
+
* Use with `<path d={path} />` in an SVG element.
|
|
12
|
+
*
|
|
13
|
+
* @param opts - Dimensions and progress
|
|
14
|
+
* @returns SVG path d-string
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const path = useMorphPath({
|
|
19
|
+
* pillWidth: 260,
|
|
20
|
+
* bodyWidth: 180,
|
|
21
|
+
* totalHeight: 60,
|
|
22
|
+
* progress: expanded ? 1 : 0,
|
|
23
|
+
* direction: 'up',
|
|
24
|
+
* });
|
|
25
|
+
* return <svg><path d={path} fill="var(--card)" /></svg>;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Generate a parametric SVG morph path from dimensions and progress.
|
|
32
|
+
*/
|
|
33
|
+
function useMorphPath({ pillWidth, bodyWidth, totalHeight, progress, pillHeight = GOOEY_DEFAULTS.PILL_HEIGHT, direction = "down" }) {
|
|
34
|
+
return useMemo(() => {
|
|
35
|
+
return (direction === "up" ? morphPathUp : morphPathDown)(pillWidth, bodyWidth, totalHeight, progress, pillHeight);
|
|
36
|
+
}, [
|
|
37
|
+
pillWidth,
|
|
38
|
+
bodyWidth,
|
|
39
|
+
totalHeight,
|
|
40
|
+
progress,
|
|
41
|
+
pillHeight,
|
|
42
|
+
direction
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { useMorphPath };
|
|
@@ -30,4 +30,6 @@ export { useMorphContext } from './Morph/MorphContext';
|
|
|
30
30
|
export { useFLIPClipPath } from './Morph/techniques/useFLIPClipPath';
|
|
31
31
|
export { useCSSGridMorph } from './Morph/techniques/useCSSGridMorph';
|
|
32
32
|
export { useViewTransitions } from './Morph/techniques/useViewTransitions';
|
|
33
|
+
export { GooeyFilter, GooeyCanvas, MorphPath, useMorphPath, GOOEY_DEFAULTS, computeBlur, buildColorMatrixValues, buildFilterString, morphPathDown, morphPathUp, } from './Gooey';
|
|
34
|
+
export type { IGooeyFilterProps, IGooeyCanvasProps, IMorphPathProps, IUseMorphPathOptions, } from './Gooey';
|
|
33
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/primitives/waapi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAGlD,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,cAAc,GACf,MAAM,QAAQ,CAAC;AAKhB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAK5G,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/primitives/waapi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAGlD,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,cAAc,GACf,MAAM,QAAQ,CAAC;AAKhB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAK5G,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAM3E,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -16,3 +16,9 @@ import { useCSSGridMorph } from "./Morph/techniques/useCSSGridMorph.js";
|
|
|
16
16
|
import { useViewTransitions } from "./Morph/techniques/useViewTransitions.js";
|
|
17
17
|
import { useMorph } from "./Morph/useMorph.js";
|
|
18
18
|
import { Morph } from "./Morph/index.js";
|
|
19
|
+
import { GOOEY_DEFAULTS, buildColorMatrixValues, buildFilterString, computeBlur, morphPathDown, morphPathUp } from "./Gooey/gooey-utils.js";
|
|
20
|
+
import { GooeyFilter } from "./Gooey/GooeyFilter.js";
|
|
21
|
+
import { GooeyCanvas } from "./Gooey/GooeyCanvas.js";
|
|
22
|
+
import { useMorphPath } from "./Gooey/useMorphPath.js";
|
|
23
|
+
import { MorphPath } from "./Gooey/MorphPath.js";
|
|
24
|
+
import "./Gooey/index.js";
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataCard style slots + CVA variants.
|
|
3
|
+
*
|
|
4
|
+
* Glassmorphism card for dashboard metrics/stats.
|
|
5
|
+
* Uses semantic CSS variables — theme-adaptive.
|
|
6
|
+
*
|
|
7
|
+
* @module @mks2508/mks-ui/react/ui/DataCard
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <DataCard variant="accent" size="default">
|
|
12
|
+
* <DataCardLabel title="Revenue" />
|
|
13
|
+
* <DataCardValue number={45678} unit="$" />
|
|
14
|
+
* </DataCard>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
1
17
|
import type { StyleSlots } from '../../../core/types';
|
|
2
18
|
/**
|
|
3
|
-
* Visual
|
|
4
|
-
* Each slot maps to: customizable visual region.
|
|
19
|
+
* Visual slots for DataCard component family.
|
|
5
20
|
*/
|
|
6
|
-
export type DataCardSlot = 'root' | 'bracket' | '
|
|
21
|
+
export type DataCardSlot = 'root' | 'bracket' | 'value' | 'label' | 'toggle' | 'actions';
|
|
7
22
|
/**
|
|
8
|
-
* Base style slots for
|
|
9
|
-
* Uses glassmorphism pattern from: Synthwave Dark design system.
|
|
23
|
+
* Base style slots for DataCard.
|
|
10
24
|
*/
|
|
11
25
|
export declare const dataCardStyles: StyleSlots<DataCardSlot>;
|
|
12
26
|
/**
|
|
13
|
-
* CVA variants for
|
|
14
|
-
*
|
|
27
|
+
* CVA variants for DataCard root.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <DataCard variant="accent" size="compact" glass>...</DataCard>
|
|
32
|
+
* ```
|
|
15
33
|
*/
|
|
16
34
|
export declare const dataCardVariants: (props?: ({
|
|
17
35
|
size?: "default" | "compact" | "spacious" | null | undefined;
|
|
@@ -19,17 +37,9 @@ export declare const dataCardVariants: (props?: ({
|
|
|
19
37
|
glass?: boolean | null | undefined;
|
|
20
38
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
39
|
/**
|
|
22
|
-
*
|
|
40
|
+
* Bracket visibility animation CVA.
|
|
23
41
|
*/
|
|
24
42
|
export declare const bracketVariants: (props?: ({
|
|
25
43
|
animate?: boolean | null | undefined;
|
|
26
44
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
-
/**
|
|
28
|
-
* State-specific styles for DataCard interactions.
|
|
29
|
-
*/
|
|
30
|
-
export declare const dataCardStateStyles: {
|
|
31
|
-
hovered: string;
|
|
32
|
-
pressed: string;
|
|
33
|
-
disabled: string;
|
|
34
|
-
};
|
|
35
45
|
//# sourceMappingURL=DataCard.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataCard.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DataCard/DataCard.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DataCard.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DataCard/DataCard.styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,SAAS,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,YAAY,CAOnD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;8EA2B3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;8EAU1B,CAAC"}
|
|
@@ -2,86 +2,56 @@ import { cva } from "class-variance-authority";
|
|
|
2
2
|
|
|
3
3
|
//#region src/react-ui/ui/DataCard/DataCard.styles.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* DataCard style slots + CVA variants.
|
|
6
|
+
*
|
|
7
|
+
* Glassmorphism card for dashboard metrics/stats.
|
|
8
|
+
* Uses semantic CSS variables — theme-adaptive.
|
|
9
|
+
*
|
|
10
|
+
* @module @mks2508/mks-ui/react/ui/DataCard
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <DataCard variant="accent" size="default">
|
|
15
|
+
* <DataCardLabel title="Revenue" />
|
|
16
|
+
* <DataCardValue number={45678} unit="$" />
|
|
17
|
+
* </DataCard>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Base style slots for DataCard.
|
|
7
22
|
*/
|
|
8
23
|
const dataCardStyles = {
|
|
9
24
|
root: "group/data-card relative isolate rounded-xl transition-all duration-300",
|
|
10
|
-
bracket: "absolute pointer-events-none transition-opacity duration-300",
|
|
11
|
-
header: "flex flex-col gap-1.5 px-5 pt-5 pb-2",
|
|
25
|
+
bracket: "absolute inset-0 pointer-events-none transition-opacity duration-300",
|
|
12
26
|
value: "flex items-baseline gap-1 tabular-nums tracking-tight",
|
|
13
27
|
label: "text-sm font-medium",
|
|
14
28
|
toggle: "flex items-center justify-between gap-3",
|
|
15
|
-
actions: "flex items-center gap-2"
|
|
16
|
-
footer: "mt-auto px-5 pb-4 pt-2"
|
|
29
|
+
actions: "flex items-center gap-2"
|
|
17
30
|
};
|
|
18
31
|
/**
|
|
19
|
-
* CVA variants for
|
|
20
|
-
*
|
|
32
|
+
* CVA variants for DataCard root.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <DataCard variant="accent" size="compact" glass>...</DataCard>
|
|
37
|
+
* ```
|
|
21
38
|
*/
|
|
22
39
|
const dataCardVariants = cva(dataCardStyles.root, {
|
|
23
40
|
variants: {
|
|
24
41
|
size: {
|
|
25
|
-
compact:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
footer: "px-3 pb-1.5 pt-1"
|
|
29
|
-
},
|
|
30
|
-
default: {
|
|
31
|
-
root: "p-4",
|
|
32
|
-
header: "gap-1.5 px-4 pt-4 pb-2",
|
|
33
|
-
footer: "px-4 pb-2 pt-2"
|
|
34
|
-
},
|
|
35
|
-
spacious: {
|
|
36
|
-
root: "p-6",
|
|
37
|
-
header: "gap-2 px-6 pt-6 pb-3",
|
|
38
|
-
footer: "px-6 pb-3 pt-2"
|
|
39
|
-
}
|
|
42
|
+
compact: "p-3",
|
|
43
|
+
default: "p-4",
|
|
44
|
+
spacious: "p-6"
|
|
40
45
|
},
|
|
41
46
|
variant: {
|
|
42
|
-
default:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"shadow-lg shadow-black/20"
|
|
48
|
-
].join(" "),
|
|
49
|
-
accent: [
|
|
50
|
-
"bg-cyan-500/10",
|
|
51
|
-
"backdrop-blur-lg",
|
|
52
|
-
"border border-cyan-400/30",
|
|
53
|
-
"hover:bg-cyan-500/20",
|
|
54
|
-
"shadow-cyan-500/20 shadow-lg"
|
|
55
|
-
].join(" "),
|
|
56
|
-
success: [
|
|
57
|
-
"bg-emerald-500/10",
|
|
58
|
-
"backdrop-blur-lg",
|
|
59
|
-
"border border-emerald-400/30",
|
|
60
|
-
"hover:bg-emerald-500/20",
|
|
61
|
-
"shadow-emerald-500/20 shadow-lg"
|
|
62
|
-
].join(" "),
|
|
63
|
-
warning: [
|
|
64
|
-
"bg-amber-500/10",
|
|
65
|
-
"backdrop-blur-lg",
|
|
66
|
-
"border border-amber-400/30",
|
|
67
|
-
"hover:bg-amber-500/20",
|
|
68
|
-
"shadow-amber-500/20 shadow-lg"
|
|
69
|
-
].join(" "),
|
|
70
|
-
destructive: [
|
|
71
|
-
"bg-red-500/10",
|
|
72
|
-
"backdrop-blur-lg",
|
|
73
|
-
"border border-red-400/30",
|
|
74
|
-
"hover:bg-red-500/20",
|
|
75
|
-
"shadow-red-500/20 shadow-lg"
|
|
76
|
-
].join(" ")
|
|
47
|
+
default: "bg-card/80 border border-border/50 shadow-lg shadow-black/10",
|
|
48
|
+
accent: "bg-accent/20 border border-accent/30 shadow-lg shadow-accent/10",
|
|
49
|
+
success: "bg-green-500/10 dark:bg-green-400/10 border border-green-500/30 dark:border-green-400/30 shadow-lg shadow-green-500/10",
|
|
50
|
+
warning: "bg-amber-500/10 dark:bg-amber-400/10 border border-amber-500/30 dark:border-amber-400/30 shadow-lg shadow-amber-500/10",
|
|
51
|
+
destructive: "bg-destructive/10 border border-destructive/30 shadow-lg shadow-destructive/10"
|
|
77
52
|
},
|
|
78
53
|
glass: {
|
|
79
|
-
true:
|
|
80
|
-
"backdrop-blur-lg",
|
|
81
|
-
"bg-white/10",
|
|
82
|
-
"border border-white/20",
|
|
83
|
-
"shadow-xl"
|
|
84
|
-
].join(" "),
|
|
54
|
+
true: "backdrop-blur-lg",
|
|
85
55
|
false: ""
|
|
86
56
|
}
|
|
87
57
|
},
|
|
@@ -92,7 +62,7 @@ const dataCardVariants = cva(dataCardStyles.root, {
|
|
|
92
62
|
}
|
|
93
63
|
});
|
|
94
64
|
/**
|
|
95
|
-
*
|
|
65
|
+
* Bracket visibility animation CVA.
|
|
96
66
|
*/
|
|
97
67
|
const bracketVariants = cva(dataCardStyles.bracket, {
|
|
98
68
|
variants: { animate: {
|
|
@@ -101,14 +71,6 @@ const bracketVariants = cva(dataCardStyles.bracket, {
|
|
|
101
71
|
} },
|
|
102
72
|
defaultVariants: { animate: true }
|
|
103
73
|
});
|
|
104
|
-
/**
|
|
105
|
-
* State-specific styles for DataCard interactions.
|
|
106
|
-
*/
|
|
107
|
-
const dataCardStateStyles = {
|
|
108
|
-
hovered: "scale-[1.02]",
|
|
109
|
-
pressed: "scale-[0.98]",
|
|
110
|
-
disabled: "opacity-50 pointer-events-none"
|
|
111
|
-
};
|
|
112
74
|
|
|
113
75
|
//#endregion
|
|
114
|
-
export {
|
|
76
|
+
export { dataCardStyles, dataCardVariants };
|