@mks2508/mks-ui 0.5.4 → 0.5.8
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/primitives/waapi/Gooey/Gooey.types.d.ts +23 -4
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +2 -2
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +292 -31
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.js +6 -1
- package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-Cm6-VceQ.css → DynamicToggle-DJLwEkHr.css} +116 -51
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +116 -51
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +9 -3
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +61 -31
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.d.ts +9 -3
- package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.js +68 -37
- package/package.json +52 -13
- package/src/assets/react.svg +0 -1
- package/src/core/index.ts +0 -7
- package/src/core/types.ts +0 -82
- package/src/css.d.ts +0 -7
- package/src/index.css +0 -129
- package/src/index.ts +0 -29
- package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +0 -278
- package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +0 -97
- package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +0 -155
- package/src/react-ui/blocks/Terminal/Terminal.theme.ts +0 -80
- package/src/react-ui/blocks/Terminal/Terminal.types.ts +0 -438
- package/src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts +0 -38
- package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +0 -254
- package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +0 -73
- package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +0 -269
- package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +0 -326
- package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +0 -230
- package/src/react-ui/blocks/Terminal/XTermAdapter.ts +0 -163
- package/src/react-ui/blocks/Terminal/chrome.ts +0 -25
- package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +0 -316
- package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +0 -218
- package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +0 -386
- package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +0 -67
- package/src/react-ui/blocks/Terminal/components/index.ts +0 -10
- package/src/react-ui/blocks/Terminal/display.ts +0 -46
- package/src/react-ui/blocks/Terminal/hooks/index.ts +0 -22
- package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +0 -229
- package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +0 -292
- package/src/react-ui/blocks/Terminal/index.ts +0 -111
- package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +0 -330
- package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +0 -242
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +0 -202
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +0 -140
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +0 -68
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +0 -85
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +0 -383
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +0 -439
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +0 -550
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +0 -259
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.ts +0 -75
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +0 -266
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +0 -82
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +0 -112
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +0 -178
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +0 -203
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +0 -252
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +0 -334
- package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +0 -261
- package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +0 -248
- package/src/react-ui/blocks/Terminal/panel/index.ts +0 -72
- package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +0 -59
- package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +0 -59
- package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +0 -180
- package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +0 -248
- package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +0 -283
- package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +0 -686
- package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +0 -466
- package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +0 -343
- package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +0 -167
- package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +0 -348
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +0 -251
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +0 -390
- package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +0 -320
- package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +0 -20
- package/src/react-ui/blocks/Terminal/parsing/index.ts +0 -69
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +0 -68
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +0 -436
- package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +0 -14
- package/src/react-ui/blocks/index.ts +0 -11
- package/src/react-ui/components/MorphingPopover/MorphingPopover.types.ts +0 -49
- package/src/react-ui/components/MorphingPopover/index.tsx +0 -186
- package/src/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -153
- package/src/react-ui/components/index.ts +0 -9
- package/src/react-ui/hooks/Animation/UseAutoHeight.tsx +0 -123
- package/src/react-ui/hooks/DOM/UseIsInView.tsx +0 -44
- package/src/react-ui/hooks/Formatting/UseListFormat.ts +0 -134
- package/src/react-ui/hooks/State/UseControlledState.tsx +0 -57
- package/src/react-ui/hooks/State/UseDataState.tsx +0 -76
- package/src/react-ui/hooks/index.ts +0 -20
- package/src/react-ui/icons/index.ts +0 -12
- package/src/react-ui/icons/lucide-animated/activity.tsx +0 -109
- package/src/react-ui/icons/lucide-animated/arrow-down-to-line.tsx +0 -51
- package/src/react-ui/icons/lucide-animated/arrow-up.tsx +0 -50
- package/src/react-ui/icons/lucide-animated/bell-electric.tsx +0 -124
- package/src/react-ui/icons/lucide-animated/bell.tsx +0 -93
- package/src/react-ui/icons/lucide-animated/bot.tsx +0 -122
- package/src/react-ui/icons/lucide-animated/box.tsx +0 -117
- package/src/react-ui/icons/lucide-animated/check.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/circle-check.tsx +0 -107
- package/src/react-ui/icons/lucide-animated/delete.tsx +0 -133
- package/src/react-ui/icons/lucide-animated/download.tsx +0 -99
- package/src/react-ui/icons/lucide-animated/edit-2.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/globe.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/home.tsx +0 -103
- package/src/react-ui/icons/lucide-animated/index.ts +0 -38
- package/src/react-ui/icons/lucide-animated/layers.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +0 -143
- package/src/react-ui/icons/lucide-animated/list.tsx +0 -54
- package/src/react-ui/icons/lucide-animated/package.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/palette.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/plus.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/refresh-cw.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/rocket.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/save.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/search.tsx +0 -94
- package/src/react-ui/icons/lucide-animated/settings.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/terminal.tsx +0 -46
- package/src/react-ui/icons/lucide-animated/trash-2.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/trending-down.tsx +0 -151
- package/src/react-ui/icons/lucide-animated/trending-up.tsx +0 -150
- package/src/react-ui/icons/lucide-animated/type.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/upload.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/x.tsx +0 -102
- package/src/react-ui/index.ts +0 -30
- package/src/react-ui/lib/get-strict-context.tsx +0 -56
- package/src/react-ui/lib/icon-wrapper.tsx +0 -70
- package/src/react-ui/lib/index.ts +0 -9
- package/src/react-ui/lib/utils.ts +0 -24
- package/src/react-ui/primitives/AutoHeight/index.tsx +0 -74
- package/src/react-ui/primitives/CountingNumber/index.tsx +0 -147
- package/src/react-ui/primitives/Highlight/Highlight.types.ts +0 -136
- package/src/react-ui/primitives/Highlight/index.tsx +0 -577
- package/src/react-ui/primitives/Slot/index.tsx +0 -128
- package/src/react-ui/primitives/index.ts +0 -16
- package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +0 -123
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -80
- package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +0 -77
- package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +0 -58
- package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +0 -244
- package/src/react-ui/primitives/waapi/Gooey/index.ts +0 -50
- package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +0 -48
- package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +0 -106
- package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +0 -21
- package/src/react-ui/primitives/waapi/Morph/index.tsx +0 -56
- package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +0 -12
- package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +0 -89
- package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +0 -176
- package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +0 -87
- package/src/react-ui/primitives/waapi/Morph/useMorph.ts +0 -101
- package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +0 -177
- package/src/react-ui/primitives/waapi/Reorder/index.tsx +0 -260
- package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +0 -47
- package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +0 -209
- package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +0 -104
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +0 -14
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +0 -84
- package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +0 -474
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +0 -32
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +0 -69
- package/src/react-ui/primitives/waapi/SlidingText/index.tsx +0 -140
- package/src/react-ui/primitives/waapi/core/animationConstants.ts +0 -215
- package/src/react-ui/primitives/waapi/core/index.ts +0 -53
- package/src/react-ui/primitives/waapi/core/types.ts +0 -200
- package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +0 -430
- package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +0 -81
- package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +0 -138
- package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +0 -106
- package/src/react-ui/primitives/waapi/index.ts +0 -139
- package/src/react-ui/styles/animations.css +0 -369
- package/src/react-ui/ui/Accordion/Accordion.styles.ts +0 -72
- package/src/react-ui/ui/Accordion/Accordion.types.ts +0 -199
- package/src/react-ui/ui/Accordion/index.tsx +0 -362
- package/src/react-ui/ui/AlertDialog/AlertDialog.styles.ts +0 -38
- package/src/react-ui/ui/AlertDialog/AlertDialog.types.ts +0 -296
- package/src/react-ui/ui/AlertDialog/index.tsx +0 -540
- package/src/react-ui/ui/Badge/Badge.styles.ts +0 -43
- package/src/react-ui/ui/Badge/Badge.types.ts +0 -26
- package/src/react-ui/ui/Badge/index.tsx +0 -34
- package/src/react-ui/ui/Button/Button.styles.ts +0 -57
- package/src/react-ui/ui/Button/Button.types.ts +0 -63
- package/src/react-ui/ui/Button/index.tsx +0 -155
- package/src/react-ui/ui/Card/Card.styles.ts +0 -32
- package/src/react-ui/ui/Card/Card.types.ts +0 -39
- package/src/react-ui/ui/Card/index.tsx +0 -130
- package/src/react-ui/ui/Checkbox/Checkbox.styles.ts +0 -40
- package/src/react-ui/ui/Checkbox/Checkbox.types.ts +0 -98
- package/src/react-ui/ui/Checkbox/index.tsx +0 -233
- package/src/react-ui/ui/Combobox/Combobox.styles.ts +0 -34
- package/src/react-ui/ui/Combobox/Combobox.types.ts +0 -89
- package/src/react-ui/ui/Combobox/index.tsx +0 -331
- package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +0 -38
- package/src/react-ui/ui/CornerBracket/CornerBracket.types.ts +0 -15
- package/src/react-ui/ui/CornerBracket/index.tsx +0 -49
- package/src/react-ui/ui/DataCard/DataCard.styles.ts +0 -94
- package/src/react-ui/ui/DataCard/DataCard.types.ts +0 -125
- package/src/react-ui/ui/DataCard/index.tsx +0 -340
- package/src/react-ui/ui/Dialog/Dialog.styles.ts +0 -59
- package/src/react-ui/ui/Dialog/Dialog.types.ts +0 -284
- package/src/react-ui/ui/Dialog/index.tsx +0 -452
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.styles.ts +0 -35
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.types.ts +0 -81
- package/src/react-ui/ui/DropdownMenu/index.tsx +0 -300
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -303
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -174
- package/src/react-ui/ui/DynamicToggle/index.tsx +0 -294
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
- package/src/react-ui/ui/DynamicToggle/prototype.html +0 -419
- package/src/react-ui/ui/Field/Field.styles.ts +0 -47
- package/src/react-ui/ui/Field/Field.types.ts +0 -60
- package/src/react-ui/ui/Field/index.tsx +0 -254
- package/src/react-ui/ui/Input/Input.styles.ts +0 -11
- package/src/react-ui/ui/Input/Input.types.ts +0 -10
- package/src/react-ui/ui/Input/index.tsx +0 -32
- package/src/react-ui/ui/InputGroup/InputGroup.styles.ts +0 -53
- package/src/react-ui/ui/InputGroup/InputGroup.types.ts +0 -44
- package/src/react-ui/ui/InputGroup/index.tsx +0 -149
- package/src/react-ui/ui/Label/Label.styles.ts +0 -10
- package/src/react-ui/ui/Label/Label.types.ts +0 -9
- package/src/react-ui/ui/Label/index.tsx +0 -27
- package/src/react-ui/ui/Menu/Menu.styles.ts +0 -71
- package/src/react-ui/ui/Menu/Menu.types.ts +0 -425
- package/src/react-ui/ui/Menu/index.tsx +0 -900
- package/src/react-ui/ui/Popover/Popover.styles.ts +0 -55
- package/src/react-ui/ui/Popover/Popover.types.ts +0 -261
- package/src/react-ui/ui/Popover/index.tsx +0 -422
- package/src/react-ui/ui/Progress/Progress.styles.ts +0 -36
- package/src/react-ui/ui/Progress/Progress.types.ts +0 -162
- package/src/react-ui/ui/Progress/index.tsx +0 -254
- package/src/react-ui/ui/Select/Select.styles.ts +0 -30
- package/src/react-ui/ui/Select/Select.types.ts +0 -51
- package/src/react-ui/ui/Select/index.tsx +0 -225
- package/src/react-ui/ui/Separator/Separator.styles.ts +0 -10
- package/src/react-ui/ui/Separator/Separator.types.ts +0 -10
- package/src/react-ui/ui/Separator/index.tsx +0 -37
- package/src/react-ui/ui/Switch/Switch.styles.ts +0 -50
- package/src/react-ui/ui/Switch/Switch.types.ts +0 -155
- package/src/react-ui/ui/Switch/index.tsx +0 -253
- package/src/react-ui/ui/Tabs/Tabs.css +0 -39
- package/src/react-ui/ui/Tabs/Tabs.styles.ts +0 -148
- package/src/react-ui/ui/Tabs/Tabs.types.ts +0 -255
- package/src/react-ui/ui/Tabs/index.tsx +0 -529
- package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +0 -36
- package/src/react-ui/ui/TextFlow/TextFlow.types.ts +0 -118
- package/src/react-ui/ui/TextFlow/index.tsx +0 -276
- package/src/react-ui/ui/Textarea/Textarea.styles.ts +0 -10
- package/src/react-ui/ui/Textarea/Textarea.types.ts +0 -9
- package/src/react-ui/ui/Textarea/index.tsx +0 -27
- package/src/react-ui/ui/Tooltip/Tooltip.styles.ts +0 -43
- package/src/react-ui/ui/Tooltip/Tooltip.types.ts +0 -253
- package/src/react-ui/ui/Tooltip/index.tsx +0 -394
- package/src/react-ui/ui/index.ts +0 -41
- package/src/types/css-modules.d.ts +0 -18
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gooey morphing primitive types.
|
|
3
|
-
*
|
|
4
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ReactNode } from 'react';
|
|
8
|
-
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// GooeyFilter
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Props for the GooeyFilter SVG filter definition.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <GooeyFilter id="my-goo" blur={8} />
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export interface IGooeyFilterProps {
|
|
22
|
-
/** Unique filter ID — referenced via `filter: url(#id)` */
|
|
23
|
-
id: string;
|
|
24
|
-
/** Gaussian blur stdDeviation (default: 8) */
|
|
25
|
-
blur?: number;
|
|
26
|
-
/** Alpha channel multiplier in feColorMatrix (default: 20) */
|
|
27
|
-
alphaGain?: number;
|
|
28
|
-
/** Alpha channel offset in feColorMatrix (default: -10) */
|
|
29
|
-
alphaOffset?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
// GooeyCanvas
|
|
34
|
-
// ---------------------------------------------------------------------------
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Props for the GooeyCanvas container.
|
|
38
|
-
*
|
|
39
|
-
* Wraps children with an SVG gooey filter. All same-colored children
|
|
40
|
-
* inside automatically merge visually into an organic blob.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* <GooeyCanvas height={40}>
|
|
45
|
-
* <div className="bg-card rounded-full h-10 w-64" />
|
|
46
|
-
* <div className="bg-card absolute bottom-full w-32 h-6" />
|
|
47
|
-
* </GooeyCanvas>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export interface IGooeyCanvasProps {
|
|
51
|
-
/** Blur radius override. If omitted, auto-calculated from `height`. */
|
|
52
|
-
blur?: number;
|
|
53
|
-
/** Element height — used to auto-calculate blur (default: 32) */
|
|
54
|
-
height?: number;
|
|
55
|
-
/** Drop-shadow outline blur in px (default: 0.5) */
|
|
56
|
-
outlineBlur?: number;
|
|
57
|
-
/** Drop-shadow outline color (default: 'var(--border)') */
|
|
58
|
-
outlineColor?: string;
|
|
59
|
-
/** Number of stacked drop-shadows for outline thickness (default: 2) */
|
|
60
|
-
outlineLayers?: number;
|
|
61
|
-
/** Alpha gain override */
|
|
62
|
-
alphaGain?: number;
|
|
63
|
-
/** Alpha offset override */
|
|
64
|
-
alphaOffset?: number;
|
|
65
|
-
/** Extra className on the filter container */
|
|
66
|
-
className?: string;
|
|
67
|
-
/** Content to merge with the gooey filter */
|
|
68
|
-
children: ReactNode;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
// MorphPath
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Props for the MorphPath SVG path component.
|
|
77
|
-
*
|
|
78
|
-
* Renders a parametric `<path>` that morphs from a pill shape to a
|
|
79
|
-
* pill+body blob based on the `progress` value.
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```tsx
|
|
83
|
-
* <svg>
|
|
84
|
-
* <MorphPath pillWidth={260} bodyWidth={180} totalHeight={60} progress={0.5} fill="var(--card)" />
|
|
85
|
-
* </svg>
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
export interface IMorphPathProps extends React.SVGProps<SVGPathElement> {
|
|
89
|
-
/** Pill width in px */
|
|
90
|
-
pillWidth: number;
|
|
91
|
-
/** Body (expanded area) width in px */
|
|
92
|
-
bodyWidth: number;
|
|
93
|
-
/** Total height (pill + body) in px */
|
|
94
|
-
totalHeight: number;
|
|
95
|
-
/** Morph progress: 0 = pill only, 1 = fully expanded */
|
|
96
|
-
progress: number;
|
|
97
|
-
/** Pill height (default: 34) */
|
|
98
|
-
pillHeight?: number;
|
|
99
|
-
/** Body expansion direction relative to pill */
|
|
100
|
-
direction?: 'down' | 'up';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
// useMorphPath
|
|
105
|
-
// ---------------------------------------------------------------------------
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Options for the useMorphPath hook.
|
|
109
|
-
*/
|
|
110
|
-
export interface IUseMorphPathOptions {
|
|
111
|
-
/** Pill width in px */
|
|
112
|
-
pillWidth: number;
|
|
113
|
-
/** Body width in px */
|
|
114
|
-
bodyWidth: number;
|
|
115
|
-
/** Total height in px */
|
|
116
|
-
totalHeight: number;
|
|
117
|
-
/** Morph progress 0→1 */
|
|
118
|
-
progress: number;
|
|
119
|
-
/** Pill height (default: 34) */
|
|
120
|
-
pillHeight?: number;
|
|
121
|
-
/** Body direction */
|
|
122
|
-
direction?: 'down' | 'up';
|
|
123
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GooeyCanvas — container that applies gooey SVG filter to children.
|
|
5
|
-
*
|
|
6
|
-
* Renders a GooeyFilter + a wrapper div with `filter: url(#id)`.
|
|
7
|
-
* All same-colored children inside merge organically. Optional drop-shadow
|
|
8
|
-
* outline traces the merged shape's edge.
|
|
9
|
-
*
|
|
10
|
-
* Blur auto-scales with height: `blur = Math.round(height * 0.15)`.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <div style={{ position: 'relative' }}>
|
|
15
|
-
* <GooeyCanvas height={40}>
|
|
16
|
-
* <div className="absolute inset-0 bg-card rounded-full" />
|
|
17
|
-
* <div className="absolute bottom-full bg-card w-32 h-6 rounded-lg" />
|
|
18
|
-
* </GooeyCanvas>
|
|
19
|
-
* <div className="relative z-10">Content on top (not filtered)</div>
|
|
20
|
-
* </div>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import * as React from 'react';
|
|
27
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
28
|
-
import { GooeyFilter } from './GooeyFilter';
|
|
29
|
-
import { computeBlur, buildFilterString, GOOEY_DEFAULTS } from './gooey-utils';
|
|
30
|
-
import type { IGooeyCanvasProps } from './Gooey.types';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* GooeyCanvas — container with gooey SVG filter applied.
|
|
34
|
-
*/
|
|
35
|
-
function GooeyCanvas({
|
|
36
|
-
blur,
|
|
37
|
-
height = 32,
|
|
38
|
-
outlineBlur = 0.5,
|
|
39
|
-
outlineColor = 'var(--border)',
|
|
40
|
-
outlineLayers = 2,
|
|
41
|
-
alphaGain,
|
|
42
|
-
alphaOffset,
|
|
43
|
-
className,
|
|
44
|
-
children,
|
|
45
|
-
}: IGooeyCanvasProps) {
|
|
46
|
-
const filterId = React.useId().replace(/:/g, '') + '-goo';
|
|
47
|
-
const computedBlur = blur ?? computeBlur(height);
|
|
48
|
-
|
|
49
|
-
const filterStyle = React.useMemo(
|
|
50
|
-
() => ({
|
|
51
|
-
filter: buildFilterString(filterId, outlineBlur, outlineColor, outlineLayers),
|
|
52
|
-
}),
|
|
53
|
-
[filterId, outlineBlur, outlineColor, outlineLayers],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<>
|
|
58
|
-
<GooeyFilter
|
|
59
|
-
id={filterId}
|
|
60
|
-
blur={computedBlur}
|
|
61
|
-
alphaGain={alphaGain}
|
|
62
|
-
alphaOffset={alphaOffset}
|
|
63
|
-
/>
|
|
64
|
-
<div
|
|
65
|
-
data-slot="gooey-canvas"
|
|
66
|
-
style={filterStyle}
|
|
67
|
-
className={cn(
|
|
68
|
-
'absolute inset-0 rounded-[inherit] pointer-events-none z-0 overflow-visible',
|
|
69
|
-
className,
|
|
70
|
-
)}
|
|
71
|
-
>
|
|
72
|
-
{children}
|
|
73
|
-
</div>
|
|
74
|
-
</>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
GooeyCanvas.displayName = 'GooeyCanvas';
|
|
79
|
-
|
|
80
|
-
export { GooeyCanvas };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GooeyFilter — SVG filter definition for gooey morphing effects.
|
|
5
|
-
*
|
|
6
|
-
* Renders a hidden `<svg>` with a `<filter>` that uses `feGaussianBlur` +
|
|
7
|
-
* `feColorMatrix` + `feComposite` to merge same-colored shapes organically.
|
|
8
|
-
*
|
|
9
|
-
* Apply via `filter: url(#id)` on a container. All same-colored children merge.
|
|
10
|
-
* `feComposite operator="atop"` preserves sharp text/content on top.
|
|
11
|
-
*
|
|
12
|
-
* @param id - Unique filter ID
|
|
13
|
-
* @param blur - Gaussian blur stdDeviation (default: 8)
|
|
14
|
-
* @param alphaGain - Alpha multiplier for merge threshold (default: 20)
|
|
15
|
-
* @param alphaOffset - Alpha offset for edge sharpness (default: -10)
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <GooeyFilter id="my-goo" blur={6} />
|
|
20
|
-
* <div style={{ filter: 'url(#my-goo)' }}>
|
|
21
|
-
* <div className="bg-card" /> // these merge
|
|
22
|
-
* <div className="bg-card" /> // organically
|
|
23
|
-
* </div>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import { memo } from 'react';
|
|
30
|
-
import { GOOEY_DEFAULTS, buildColorMatrixValues } from './gooey-utils';
|
|
31
|
-
import type { IGooeyFilterProps } from './Gooey.types';
|
|
32
|
-
|
|
33
|
-
const HIDDEN_SVG_STYLE = {
|
|
34
|
-
position: 'absolute' as const,
|
|
35
|
-
width: 0,
|
|
36
|
-
height: 0,
|
|
37
|
-
overflow: 'hidden' as const,
|
|
38
|
-
pointerEvents: 'none' as const,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* GooeyFilter — renders an SVG filter definition for gooey morphing.
|
|
43
|
-
*/
|
|
44
|
-
const GooeyFilter = memo(function GooeyFilter({
|
|
45
|
-
id,
|
|
46
|
-
blur = 8,
|
|
47
|
-
alphaGain = GOOEY_DEFAULTS.ALPHA_GAIN,
|
|
48
|
-
alphaOffset = GOOEY_DEFAULTS.ALPHA_OFFSET,
|
|
49
|
-
}: IGooeyFilterProps) {
|
|
50
|
-
return (
|
|
51
|
-
<svg aria-hidden="true" style={HIDDEN_SVG_STYLE}>
|
|
52
|
-
<defs>
|
|
53
|
-
<filter
|
|
54
|
-
id={id}
|
|
55
|
-
x="-20%"
|
|
56
|
-
y="-20%"
|
|
57
|
-
width="140%"
|
|
58
|
-
height="140%"
|
|
59
|
-
colorInterpolationFilters="sRGB"
|
|
60
|
-
>
|
|
61
|
-
<feGaussianBlur in="SourceGraphic" stdDeviation={blur} result="blur" />
|
|
62
|
-
<feColorMatrix
|
|
63
|
-
in="blur"
|
|
64
|
-
mode="matrix"
|
|
65
|
-
values={buildColorMatrixValues(alphaGain, alphaOffset)}
|
|
66
|
-
result="goo"
|
|
67
|
-
/>
|
|
68
|
-
<feComposite in="SourceGraphic" in2="goo" operator="atop" />
|
|
69
|
-
</filter>
|
|
70
|
-
</defs>
|
|
71
|
-
</svg>
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
GooeyFilter.displayName = 'GooeyFilter';
|
|
76
|
-
|
|
77
|
-
export { GooeyFilter };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MorphPath — SVG `<path>` component with parametric pill-to-blob morphing.
|
|
5
|
-
*
|
|
6
|
-
* Generates a `<path d="...">` that transitions from a pill shape to an
|
|
7
|
-
* expanded blob based on the `progress` value (0→1). Uses quadratic Bezier
|
|
8
|
-
* curves at the junction for organic concave connections.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <svg width={300} height={80} style={{ position: 'absolute' }}>
|
|
13
|
-
* <MorphPath
|
|
14
|
-
* pillWidth={260}
|
|
15
|
-
* bodyWidth={180}
|
|
16
|
-
* totalHeight={80}
|
|
17
|
-
* progress={expanded ? 1 : 0}
|
|
18
|
-
* direction="up"
|
|
19
|
-
* fill="var(--card)"
|
|
20
|
-
* />
|
|
21
|
-
* </svg>
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { memo } from 'react';
|
|
28
|
-
import { useMorphPath } from './useMorphPath';
|
|
29
|
-
import type { IMorphPathProps } from './Gooey.types';
|
|
30
|
-
import { GOOEY_DEFAULTS } from './gooey-utils';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* MorphPath — parametric SVG path for pill→blob morphing.
|
|
34
|
-
*/
|
|
35
|
-
const MorphPath = memo(function MorphPath({
|
|
36
|
-
pillWidth,
|
|
37
|
-
bodyWidth,
|
|
38
|
-
totalHeight,
|
|
39
|
-
progress,
|
|
40
|
-
pillHeight = GOOEY_DEFAULTS.PILL_HEIGHT,
|
|
41
|
-
direction = 'down',
|
|
42
|
-
...pathProps
|
|
43
|
-
}: IMorphPathProps) {
|
|
44
|
-
const d = useMorphPath({
|
|
45
|
-
pillWidth,
|
|
46
|
-
bodyWidth,
|
|
47
|
-
totalHeight,
|
|
48
|
-
progress,
|
|
49
|
-
pillHeight,
|
|
50
|
-
direction,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return <path d={d} {...pathProps} />;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
MorphPath.displayName = 'MorphPath';
|
|
57
|
-
|
|
58
|
-
export { MorphPath };
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gooey morphing utilities — pure functions for SVG filter and path generation.
|
|
3
|
-
*
|
|
4
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
// Constants
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
|
|
11
|
-
/** Default gooey filter parameters. */
|
|
12
|
-
export const GOOEY_DEFAULTS = {
|
|
13
|
-
/** Blur = height * BLUR_RATIO */
|
|
14
|
-
BLUR_RATIO: 0.15,
|
|
15
|
-
/** feColorMatrix alpha channel multiplier */
|
|
16
|
-
ALPHA_GAIN: 20,
|
|
17
|
-
/** feColorMatrix alpha channel offset */
|
|
18
|
-
ALPHA_OFFSET: -10,
|
|
19
|
-
/** Default pill height (px) */
|
|
20
|
-
PILL_HEIGHT: 34,
|
|
21
|
-
/** Quadratic bezier curve factor at full expansion */
|
|
22
|
-
CURVE_FACTOR: 14,
|
|
23
|
-
/** Max body corner radius (px) */
|
|
24
|
-
MAX_CORNER_RADIUS: 16,
|
|
25
|
-
/** Corner radius to body-height ratio */
|
|
26
|
-
CORNER_RATIO: 0.45,
|
|
27
|
-
/** Minimum body height delta to show rounded corners */
|
|
28
|
-
MIN_BODY_DELTA: 8,
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
// Blur computation
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Compute the optimal Gaussian blur for a gooey filter based on element height.
|
|
37
|
-
*
|
|
38
|
-
* @param height - Element height in pixels
|
|
39
|
-
* @returns Blur stdDeviation value
|
|
40
|
-
*/
|
|
41
|
-
export function computeBlur(height: number): number {
|
|
42
|
-
return Math.round(height * GOOEY_DEFAULTS.BLUR_RATIO);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Build the feColorMatrix `values` string.
|
|
47
|
-
*
|
|
48
|
-
* @param gain - Alpha multiplier (default: 20)
|
|
49
|
-
* @param offset - Alpha offset (default: -10)
|
|
50
|
-
* @returns Matrix values string for feColorMatrix
|
|
51
|
-
*/
|
|
52
|
-
export function buildColorMatrixValues(
|
|
53
|
-
gain: number = GOOEY_DEFAULTS.ALPHA_GAIN,
|
|
54
|
-
offset: number = GOOEY_DEFAULTS.ALPHA_OFFSET,
|
|
55
|
-
): string {
|
|
56
|
-
return `1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ${gain} ${offset}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Build the CSS filter string with gooey + optional drop-shadow outline.
|
|
61
|
-
*
|
|
62
|
-
* @param filterId - SVG filter ID to reference
|
|
63
|
-
* @param outlineBlur - Drop-shadow blur (px)
|
|
64
|
-
* @param outlineColor - Drop-shadow color
|
|
65
|
-
* @param outlineLayers - Number of stacked drop-shadows for thickness
|
|
66
|
-
* @returns CSS filter property value
|
|
67
|
-
*/
|
|
68
|
-
export function buildFilterString(
|
|
69
|
-
filterId: string,
|
|
70
|
-
outlineBlur: number = 0.5,
|
|
71
|
-
outlineColor: string = 'var(--border)',
|
|
72
|
-
outlineLayers: number = 2,
|
|
73
|
-
): string {
|
|
74
|
-
const goo = `url(#${filterId})`;
|
|
75
|
-
const shadow = `drop-shadow(0 0 ${outlineBlur}px ${outlineColor})`;
|
|
76
|
-
const shadows = Array(outlineLayers).fill(shadow).join(' ');
|
|
77
|
-
return `${goo} ${shadows}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
// Path memoization
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
|
|
84
|
-
type PathFn = (pw: number, bw: number, th: number, t: number, ph: number) => string;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Memoize a path generation function — caches last result to avoid
|
|
88
|
-
* recomputing identical paths on consecutive animation frames.
|
|
89
|
-
*
|
|
90
|
-
* @param fn - Path generation function
|
|
91
|
-
* @returns Memoized function
|
|
92
|
-
*/
|
|
93
|
-
export function memoizePath(fn: PathFn): PathFn {
|
|
94
|
-
let lastArgs: [number, number, number, number, number] | null = null;
|
|
95
|
-
let lastResult = '';
|
|
96
|
-
return (pw, bw, th, t, ph) => {
|
|
97
|
-
if (lastArgs && lastArgs[0] === pw && lastArgs[1] === bw && lastArgs[2] === th && lastArgs[3] === t && lastArgs[4] === ph) {
|
|
98
|
-
return lastResult;
|
|
99
|
-
}
|
|
100
|
-
lastResult = fn(pw, bw, th, t, ph);
|
|
101
|
-
lastArgs = [pw, bw, th, t, ph];
|
|
102
|
-
return lastResult;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// Parametric SVG path generation
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Generate an SVG path for a pill that morphs downward into a body blob.
|
|
112
|
-
* Adapted from goey-toast's morphPathRaw.
|
|
113
|
-
*
|
|
114
|
-
* @param pw - Pill width
|
|
115
|
-
* @param bw - Body width (expanded)
|
|
116
|
-
* @param th - Total height (pill + body)
|
|
117
|
-
* @param t - Transition progress 0 (pill only) → 1 (full blob)
|
|
118
|
-
* @param ph - Pill height (default: PILL_HEIGHT)
|
|
119
|
-
* @returns SVG path d-string
|
|
120
|
-
*/
|
|
121
|
-
export function morphPathDown(
|
|
122
|
-
pw: number,
|
|
123
|
-
bw: number,
|
|
124
|
-
th: number,
|
|
125
|
-
t: number,
|
|
126
|
-
ph: number = GOOEY_DEFAULTS.PILL_HEIGHT,
|
|
127
|
-
): string {
|
|
128
|
-
const pr = ph / 2;
|
|
129
|
-
const pillW = Math.min(pw, bw);
|
|
130
|
-
const bodyH = ph + (th - ph) * t;
|
|
131
|
-
|
|
132
|
-
// Pure pill when t ≤ 0 or body too small
|
|
133
|
-
if (t <= 0 || bodyH - ph < GOOEY_DEFAULTS.MIN_BODY_DELTA) {
|
|
134
|
-
return [
|
|
135
|
-
`M 0,${pr}`,
|
|
136
|
-
`A ${pr},${pr} 0 0 1 ${pr},0`,
|
|
137
|
-
`H ${pillW - pr}`,
|
|
138
|
-
`A ${pr},${pr} 0 0 1 ${pillW},${pr}`,
|
|
139
|
-
`A ${pr},${pr} 0 0 1 ${pillW - pr},${ph}`,
|
|
140
|
-
`H ${pr}`,
|
|
141
|
-
`A ${pr},${pr} 0 0 1 0,${pr}`,
|
|
142
|
-
`Z`,
|
|
143
|
-
].join(' ');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const curve = GOOEY_DEFAULTS.CURVE_FACTOR * t;
|
|
147
|
-
const cr = Math.min(GOOEY_DEFAULTS.MAX_CORNER_RADIUS, (bodyH - ph) * GOOEY_DEFAULTS.CORNER_RATIO);
|
|
148
|
-
const bodyW = pillW + (bw - pillW) * t;
|
|
149
|
-
const bodyTop = ph - curve;
|
|
150
|
-
const qEndX = Math.min(pillW + curve, bodyW - cr);
|
|
151
|
-
|
|
152
|
-
return [
|
|
153
|
-
`M 0,${pr}`,
|
|
154
|
-
`A ${pr},${pr} 0 0 1 ${pr},0`,
|
|
155
|
-
`H ${pillW - pr}`,
|
|
156
|
-
`A ${pr},${pr} 0 0 1 ${pillW},${pr}`,
|
|
157
|
-
`L ${pillW},${bodyTop}`,
|
|
158
|
-
`Q ${pillW},${bodyTop + curve} ${qEndX},${bodyTop + curve}`,
|
|
159
|
-
`H ${bodyW - cr}`,
|
|
160
|
-
`A ${cr},${cr} 0 0 1 ${bodyW},${bodyTop + curve + cr}`,
|
|
161
|
-
`L ${bodyW},${bodyH - cr}`,
|
|
162
|
-
`A ${cr},${cr} 0 0 1 ${bodyW - cr},${bodyH}`,
|
|
163
|
-
`H ${cr}`,
|
|
164
|
-
`A ${cr},${cr} 0 0 1 0,${bodyH - cr}`,
|
|
165
|
-
`Z`,
|
|
166
|
-
].join(' ');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Generate an SVG path for a pill that morphs UPWARD into a body blob.
|
|
171
|
-
* Used for DynamicToggle's bubble-above-pill layout.
|
|
172
|
-
*
|
|
173
|
-
* @param pw - Pill width
|
|
174
|
-
* @param bw - Body (bubble) width
|
|
175
|
-
* @param th - Total height (bubble + pill)
|
|
176
|
-
* @param t - Transition progress 0 (pill only) → 1 (full blob with bubble)
|
|
177
|
-
* @param ph - Pill height
|
|
178
|
-
* @returns SVG path d-string
|
|
179
|
-
*/
|
|
180
|
-
export function morphPathUp(
|
|
181
|
-
pw: number,
|
|
182
|
-
bw: number,
|
|
183
|
-
th: number,
|
|
184
|
-
t: number,
|
|
185
|
-
ph: number = GOOEY_DEFAULTS.PILL_HEIGHT,
|
|
186
|
-
): string {
|
|
187
|
-
const pr = ph / 2;
|
|
188
|
-
const pillW = Math.min(pw, bw);
|
|
189
|
-
const bubbleH = (th - ph) * t;
|
|
190
|
-
|
|
191
|
-
// Pure pill when t ≤ 0 or bubble too small
|
|
192
|
-
if (t <= 0 || bubbleH < GOOEY_DEFAULTS.MIN_BODY_DELTA) {
|
|
193
|
-
const y0 = th - ph;
|
|
194
|
-
return [
|
|
195
|
-
`M 0,${y0 + pr}`,
|
|
196
|
-
`A ${pr},${pr} 0 0 1 ${pr},${y0}`,
|
|
197
|
-
`H ${pillW - pr}`,
|
|
198
|
-
`A ${pr},${pr} 0 0 1 ${pillW},${y0 + pr}`,
|
|
199
|
-
`A ${pr},${pr} 0 0 1 ${pillW - pr},${y0 + ph}`,
|
|
200
|
-
`H ${pr}`,
|
|
201
|
-
`A ${pr},${pr} 0 0 1 0,${y0 + pr}`,
|
|
202
|
-
`Z`,
|
|
203
|
-
].join(' ');
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const curve = GOOEY_DEFAULTS.CURVE_FACTOR * t;
|
|
207
|
-
const cr = Math.min(GOOEY_DEFAULTS.MAX_CORNER_RADIUS, bubbleH * GOOEY_DEFAULTS.CORNER_RATIO);
|
|
208
|
-
const bubbleW = pillW + (bw - pillW) * t;
|
|
209
|
-
const pillTop = th - ph;
|
|
210
|
-
const bubbleBottom = pillTop + curve;
|
|
211
|
-
const bubbleTop = pillTop - bubbleH + curve;
|
|
212
|
-
const qEndX = Math.min(pillW + curve, bubbleW - cr);
|
|
213
|
-
|
|
214
|
-
return [
|
|
215
|
-
// Pill bottom-left
|
|
216
|
-
`M 0,${pillTop + pr}`,
|
|
217
|
-
`A ${pr},${pr} 0 0 1 0,${pillTop + ph - pr}`,
|
|
218
|
-
// Pill bottom
|
|
219
|
-
`A ${pr},${pr} 0 0 1 ${pr},${pillTop + ph}`,
|
|
220
|
-
`H ${pillW - pr}`,
|
|
221
|
-
`A ${pr},${pr} 0 0 1 ${pillW},${pillTop + ph - pr}`,
|
|
222
|
-
// Pill right up to junction
|
|
223
|
-
`L ${pillW},${bubbleBottom}`,
|
|
224
|
-
// Right organic curve: pill to bubble
|
|
225
|
-
`Q ${pillW},${bubbleBottom - curve} ${qEndX},${bubbleBottom - curve}`,
|
|
226
|
-
// Bubble right side
|
|
227
|
-
`H ${bubbleW - cr}`,
|
|
228
|
-
`A ${cr},${cr} 0 0 0 ${bubbleW},${bubbleBottom - curve - cr}`,
|
|
229
|
-
// Bubble right edge up
|
|
230
|
-
`L ${bubbleW},${bubbleTop + cr}`,
|
|
231
|
-
// Bubble top-right corner
|
|
232
|
-
`A ${cr},${cr} 0 0 0 ${bubbleW - cr},${bubbleTop}`,
|
|
233
|
-
// Bubble top
|
|
234
|
-
`H ${cr}`,
|
|
235
|
-
// Bubble top-left corner
|
|
236
|
-
`A ${cr},${cr} 0 0 0 0,${bubbleTop + cr}`,
|
|
237
|
-
// Left edge down to pill
|
|
238
|
-
`Z`,
|
|
239
|
-
].join(' ');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/** Memoized versions for animation performance. */
|
|
243
|
-
export const morphPathDownMemo = memoizePath(morphPathDown);
|
|
244
|
-
export const morphPathUpMemo = memoizePath(morphPathUp);
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
|
|
23
|
-
// Components
|
|
24
|
-
export { GooeyFilter } from './GooeyFilter';
|
|
25
|
-
export { GooeyCanvas } from './GooeyCanvas';
|
|
26
|
-
export { MorphPath } from './MorphPath';
|
|
27
|
-
|
|
28
|
-
// Hooks
|
|
29
|
-
export { useMorphPath } from './useMorphPath';
|
|
30
|
-
|
|
31
|
-
// Utilities
|
|
32
|
-
export {
|
|
33
|
-
GOOEY_DEFAULTS,
|
|
34
|
-
computeBlur,
|
|
35
|
-
buildColorMatrixValues,
|
|
36
|
-
buildFilterString,
|
|
37
|
-
memoizePath,
|
|
38
|
-
morphPathDown,
|
|
39
|
-
morphPathUp,
|
|
40
|
-
morphPathDownMemo,
|
|
41
|
-
morphPathUpMemo,
|
|
42
|
-
} from './gooey-utils';
|
|
43
|
-
|
|
44
|
-
// Types
|
|
45
|
-
export type {
|
|
46
|
-
IGooeyFilterProps,
|
|
47
|
-
IGooeyCanvasProps,
|
|
48
|
-
IMorphPathProps,
|
|
49
|
-
IUseMorphPathOptions,
|
|
50
|
-
} from './Gooey.types';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* useMorphPath — hook that generates a parametric SVG path d-string.
|
|
5
|
-
*
|
|
6
|
-
* Returns a memoized path for a pill shape morphing into a blob.
|
|
7
|
-
* Use with `<path d={path} />` in an SVG element.
|
|
8
|
-
*
|
|
9
|
-
* @param opts - Dimensions and progress
|
|
10
|
-
* @returns SVG path d-string
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* const path = useMorphPath({
|
|
15
|
-
* pillWidth: 260,
|
|
16
|
-
* bodyWidth: 180,
|
|
17
|
-
* totalHeight: 60,
|
|
18
|
-
* progress: expanded ? 1 : 0,
|
|
19
|
-
* direction: 'up',
|
|
20
|
-
* });
|
|
21
|
-
* return <svg><path d={path} fill="var(--card)" /></svg>;
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @module @mks2508/mks-ui/react/primitives/waapi/Gooey
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { useMemo } from 'react';
|
|
28
|
-
import { morphPathDown, morphPathUp, GOOEY_DEFAULTS } from './gooey-utils';
|
|
29
|
-
import type { IUseMorphPathOptions } from './Gooey.types';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Generate a parametric SVG morph path from dimensions and progress.
|
|
33
|
-
*/
|
|
34
|
-
function useMorphPath({
|
|
35
|
-
pillWidth,
|
|
36
|
-
bodyWidth,
|
|
37
|
-
totalHeight,
|
|
38
|
-
progress,
|
|
39
|
-
pillHeight = GOOEY_DEFAULTS.PILL_HEIGHT,
|
|
40
|
-
direction = 'down',
|
|
41
|
-
}: IUseMorphPathOptions): string {
|
|
42
|
-
return useMemo(() => {
|
|
43
|
-
const fn = direction === 'up' ? morphPathUp : morphPathDown;
|
|
44
|
-
return fn(pillWidth, bodyWidth, totalHeight, progress, pillHeight);
|
|
45
|
-
}, [pillWidth, bodyWidth, totalHeight, progress, pillHeight, direction]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { useMorphPath };
|