@mks2508/mks-ui 0.7.0 → 0.8.1
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/blocks/Terminal/TerminalDisplay.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/TerminalDisplay.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/LogLineBadges/LogLineBadges.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge/TerminalLogBadge.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/components/TerminalLogBadge/TerminalLogBadge.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalActionBar/TerminalActionBar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalActionBar/TerminalActionBar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalConnectionStatus/TerminalConnectionStatus.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalConnectionStatus/TerminalConnectionStatus.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalFontControls/TerminalFontControls.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalFontControls/TerminalFontControls.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalSplitButton/TerminalSplitButton.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalSplitButton/TerminalSplitButton.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalStatusBar/TerminalStatusBar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/controls/TerminalStatusBar/TerminalStatusBar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel/TerminalDebugPanel.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalDebugPanel/TerminalDebugPanel.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/TerminalFilterDropdown.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/TerminalFilterDropdown.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs/TerminalFilterTabs.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterTabs/TerminalFilterTabs.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.d.ts +0 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.d.ts.map +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalInteractivePanelWterm.js +56 -18
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel/TerminalLogsPanel.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalLogsPanel/TerminalLogsPanel.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter/TerminalPanelFooter.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelFooter/TerminalPanelFooter.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader/TerminalPanelHeader.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelHeader/TerminalPanelHeader.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar/TerminalPanelToolbar.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalPanelToolbar/TerminalPanelToolbar.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl/TerminalSessionControl.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionControl/TerminalSessionControl.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/TerminalSessionTabs.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/TerminalSessionTabs.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover/TerminalSettingsPopover.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalSettingsPopover/TerminalSettingsPopover.types.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector/TerminalThemeSelector.styles.d.ts +1 -1
- package/dist/react-ui/blocks/Terminal/panel/TerminalThemeSelector/TerminalThemeSelector.types.d.ts +1 -1
- package/dist/react-ui/components/MorphingPopover/MorphingPopover.types.d.ts +8 -3
- package/dist/react-ui/components/MorphingPopover/MorphingPopover.types.d.ts.map +1 -1
- package/dist/react-ui/index.js +24 -1
- package/dist/react-ui/primitives/AutoHeight/index.d.ts +1 -1
- package/dist/react-ui/primitives/CountingNumber/index.d.ts +1 -1
- package/dist/react-ui/primitives/DotMatrix/DotMatrix.types.d.ts +109 -0
- package/dist/react-ui/primitives/DotMatrix/DotMatrix.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/dot-matrix-B8DHjPGb.css +364 -0
- package/dist/react-ui/primitives/DotMatrix/dot-matrix.js +0 -0
- package/dist/react-ui/primitives/DotMatrix/index.d.ts +7 -0
- package/dist/react-ui/primitives/DotMatrix/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/index.js +185 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.d.ts +32 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.d.ts.map +1 -0
- package/dist/react-ui/primitives/DotMatrix/patterns.js +175 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.d.ts +100 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/GooeyMorphingSurface.types.js +20 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/gooey-morphing-surface-DfdjAg5U.css +112 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/gooey-morphing-surface.js +0 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.d.ts +36 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/GooeyMorphingSurface/index.js +141 -0
- package/dist/react-ui/primitives/index.d.ts +2 -0
- package/dist/react-ui/primitives/index.d.ts.map +1 -1
- package/dist/react-ui/primitives/index.js +4 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.styles.d.ts +1 -1
- package/dist/react-ui/ui/Accordion/Accordion.types.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/AlertDialog/AlertDialog.types.d.ts +1 -1
- package/dist/react-ui/ui/Badge/Badge.styles.d.ts +2 -2
- package/dist/react-ui/ui/Badge/Badge.types.d.ts +1 -1
- package/dist/react-ui/ui/Button/Button.styles.d.ts +2 -2
- package/dist/react-ui/ui/Button/Button.types.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.styles.d.ts +1 -1
- package/dist/react-ui/ui/Card/Card.types.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.styles.d.ts +1 -1
- package/dist/react-ui/ui/Combobox/Combobox.types.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.styles.d.ts +1 -1
- package/dist/react-ui/ui/CornerBracket/CornerBracket.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +2 -2
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +1 -1
- package/dist/react-ui/ui/DataCard/index.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.styles.d.ts +1 -1
- package/dist/react-ui/ui/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.styles.d.ts +1 -1
- package/dist/react-ui/ui/Field/Field.types.d.ts +1 -1
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.d.ts +25 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.styles.js +31 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.types.d.ts +89 -0
- package/dist/react-ui/ui/FileIcon/FileIcon.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/index.d.ts +46 -0
- package/dist/react-ui/ui/FileIcon/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileIcon/index.js +138 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.d.ts +47 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/FileItem.styles.js +60 -0
- package/dist/react-ui/ui/FileItem/FileItem.types.d.ts +84 -0
- package/dist/react-ui/ui/FileItem/FileItem.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/index.d.ts +48 -0
- package/dist/react-ui/ui/FileItem/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileItem/index.js +124 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.d.ts +34 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.styles.js +57 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.types.d.ts +55 -0
- package/dist/react-ui/ui/FilePanel/FilePanel.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/index.d.ts +55 -0
- package/dist/react-ui/ui/FilePanel/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FilePanel/index.js +107 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.d.ts +31 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/FileTree.styles.js +45 -0
- package/dist/react-ui/ui/FileTree/FileTree.types.d.ts +95 -0
- package/dist/react-ui/ui/FileTree/FileTree.types.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/index.d.ts +60 -0
- package/dist/react-ui/ui/FileTree/index.d.ts.map +1 -0
- package/dist/react-ui/ui/FileTree/index.js +226 -0
- package/dist/react-ui/ui/GooeyButton/GooeyButton.types.d.ts +35 -0
- package/dist/react-ui/ui/GooeyButton/GooeyButton.types.d.ts.map +1 -0
- package/dist/react-ui/ui/GooeyButton/gooey-button-8rHWiw0w.css +47 -0
- package/dist/react-ui/ui/GooeyButton/gooey-button.js +0 -0
- package/dist/react-ui/ui/GooeyButton/index.d.ts +26 -0
- package/dist/react-ui/ui/GooeyButton/index.d.ts.map +1 -0
- package/dist/react-ui/ui/GooeyButton/index.js +118 -0
- package/dist/react-ui/ui/Input/Input.styles.d.ts +1 -1
- package/dist/react-ui/ui/Input/Input.types.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.styles.d.ts +1 -1
- package/dist/react-ui/ui/InputGroup/InputGroup.types.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.styles.d.ts +1 -1
- package/dist/react-ui/ui/Label/Label.types.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.styles.d.ts +1 -1
- package/dist/react-ui/ui/Menu/Menu.types.d.ts +2 -2
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.d.ts +23 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.styles.js +32 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.types.d.ts +43 -0
- package/dist/react-ui/ui/MiddleTruncatePath/MiddleTruncatePath.types.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.d.ts +33 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.d.ts.map +1 -0
- package/dist/react-ui/ui/MiddleTruncatePath/index.js +60 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.d.ts +17 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.context.js +27 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.d.ts +19 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.styles.js +39 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.types.d.ts +188 -0
- package/dist/react-ui/ui/OperationCard/OperationCard.types.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/index.d.ts +45 -0
- package/dist/react-ui/ui/OperationCard/index.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/index.js +118 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardActions.js +86 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.d.ts +14 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardHeader.js +62 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardProgress.js +37 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardStats.js +42 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.d.ts +3 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.d.ts.map +1 -0
- package/dist/react-ui/ui/OperationCard/parts/OperationCardVisualizer.js +53 -0
- package/dist/react-ui/ui/Popover/Popover.styles.d.ts +1 -1
- package/dist/react-ui/ui/Popover/Popover.types.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.styles.d.ts +1 -1
- package/dist/react-ui/ui/Progress/Progress.types.d.ts +2 -2
- package/dist/react-ui/ui/Select/Select.styles.d.ts +1 -1
- package/dist/react-ui/ui/Select/Select.types.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.styles.d.ts +1 -1
- package/dist/react-ui/ui/Separator/Separator.types.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.styles.d.ts +1 -1
- package/dist/react-ui/ui/Switch/Switch.types.d.ts +1 -1
- package/dist/react-ui/ui/Tabs/Tabs.styles.d.ts +4 -4
- package/dist/react-ui/ui/Tabs/Tabs.types.d.ts +3 -3
- package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/react-ui/ui/Textarea/Textarea.types.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/react-ui/ui/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/react-ui/ui/index.d.ts +7 -0
- package/dist/react-ui/ui/index.d.ts.map +1 -1
- package/dist/react-ui/ui/index.js +19 -0
- package/package.json +2 -2
- package/dist/index.css +0 -1059
- package/dist/react-ui/blocks/Sidebar/animations/tooltip.css +0 -330
- package/dist/react-ui/blocks/Terminal/panel/TerminalFilterDropdown/terminal-filter-dropdown.module.css +0 -60
- package/dist/react-ui/blocks/Terminal/panel/TerminalSessionTabs/terminal-session-tabs.module.css +0 -60
- package/dist/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -154
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module.css +0 -20
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -369
- package/dist/react-ui/ui/Tabs/Tabs.css +0 -38
- /package/dist/{css/blocks-Sidebar-animations-tooltip.css → react-ui/blocks/Sidebar/animations/tooltip-keyframes-DRT9W6Xj.css} +0 -0
- /package/dist/{css/blocks-Terminal-panel-TerminalFilterDropdown-terminal-filter-dropdown.module.css → react-ui/blocks/Terminal/panel/TerminalFilterDropdown/terminal-filter-dropdown.module-G5zpw08N.css} +0 -0
- /package/dist/{css/blocks-Terminal-panel-TerminalSessionTabs-terminal-session-tabs.module.css → react-ui/blocks/Terminal/panel/TerminalSessionTabs/terminal-session-tabs.module-BAOuAeiX.css} +0 -0
- /package/dist/{css/components-MorphingPopover-morphing-popover.module.css → react-ui/components/MorphingPopover/morphing-popover.module-T3s-wJN-.css} +0 -0
- /package/dist/{css/primitives-waapi-Morph-techniques-useViewTransitions.module.css → react-ui/primitives/waapi/Morph/techniques/useViewTransitions.module-DNDWYN8q.css} +0 -0
- /package/dist/{css/ui-DynamicToggle-DynamicToggle.css → react-ui/ui/DynamicToggle/DynamicToggle-DY2Hle7P.css} +0 -0
- /package/dist/{css/ui-Tabs-Tabs.css → react-ui/ui/Tabs/Tabs-DqzZRGB3.css} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiddleTruncatePath — CSS-only middle truncation for file paths.
|
|
3
|
+
*
|
|
4
|
+
* Splits a path into a truncatable start and a fixed end
|
|
5
|
+
* (`parent/filename` by default). When space is limited, the start
|
|
6
|
+
* truncates with ellipsis while the end (the most identifiable part)
|
|
7
|
+
* always remains visible.
|
|
8
|
+
*
|
|
9
|
+
* Pure CSS flex — no JS measurement, no ResizeObserver.
|
|
10
|
+
*
|
|
11
|
+
* Ported from mks-mission-control.
|
|
12
|
+
*
|
|
13
|
+
* @module @mks2508/mks-ui/react/ui/MiddleTruncatePath
|
|
14
|
+
*/
|
|
15
|
+
import type { IMiddleTruncatePathProps } from './MiddleTruncatePath.types';
|
|
16
|
+
/**
|
|
17
|
+
* Middle-truncates a file path, keeping the end segments visible.
|
|
18
|
+
*
|
|
19
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Full width: src/components/shell/AppShell.tsx
|
|
24
|
+
* // Constrained: src/comp…/shell/AppShell.tsx
|
|
25
|
+
* // Minimum: …/shell/AppShell.tsx
|
|
26
|
+
* <MiddleTruncatePath path="src/components/shell/AppShell.tsx" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const MiddleTruncatePath: import("react").MemoExoticComponent<({ path, keepEnd, className, startClassName, endClassName, slots, }: IMiddleTruncatePathProps) => import("react/jsx-runtime").JSX.Element>;
|
|
30
|
+
export { MiddleTruncatePathStyles, middleTruncatePathVariants, } from './MiddleTruncatePath.styles';
|
|
31
|
+
export type { MiddleTruncatePathSlot } from './MiddleTruncatePath.styles';
|
|
32
|
+
export type { IMiddleTruncatePathProps } from './MiddleTruncatePath.types';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/MiddleTruncatePath/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,2GAO5B,wBAAwB,6CAqCzB,CAAC;AAEH,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,YAAY,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { MiddleTruncatePathShortRootStyles, MiddleTruncatePathStyles, middleTruncatePathVariants } from "./MiddleTruncatePath.styles.js";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-ui/ui/MiddleTruncatePath/index.tsx
|
|
9
|
+
/**
|
|
10
|
+
* MiddleTruncatePath — CSS-only middle truncation for file paths.
|
|
11
|
+
*
|
|
12
|
+
* Splits a path into a truncatable start and a fixed end
|
|
13
|
+
* (`parent/filename` by default). When space is limited, the start
|
|
14
|
+
* truncates with ellipsis while the end (the most identifiable part)
|
|
15
|
+
* always remains visible.
|
|
16
|
+
*
|
|
17
|
+
* Pure CSS flex — no JS measurement, no ResizeObserver.
|
|
18
|
+
*
|
|
19
|
+
* Ported from mks-mission-control.
|
|
20
|
+
*
|
|
21
|
+
* @module @mks2508/mks-ui/react/ui/MiddleTruncatePath
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Middle-truncates a file path, keeping the end segments visible.
|
|
25
|
+
*
|
|
26
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Full width: src/components/shell/AppShell.tsx
|
|
31
|
+
* // Constrained: src/comp…/shell/AppShell.tsx
|
|
32
|
+
* // Minimum: …/shell/AppShell.tsx
|
|
33
|
+
* <MiddleTruncatePath path="src/components/shell/AppShell.tsx" />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
const MiddleTruncatePath = memo(function MiddleTruncatePath({ path, keepEnd = 2, className, startClassName, endClassName, slots }) {
|
|
37
|
+
const segments = path.split("/");
|
|
38
|
+
if (segments.length <= keepEnd) return /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: cn(MiddleTruncatePathShortRootStyles, slots?.root, className),
|
|
40
|
+
title: path,
|
|
41
|
+
children: path
|
|
42
|
+
});
|
|
43
|
+
const endSegments = segments.slice(-keepEnd);
|
|
44
|
+
const start = segments.slice(0, -keepEnd).join("/") + "/";
|
|
45
|
+
const end = endSegments.join("/");
|
|
46
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
47
|
+
className: cn(middleTruncatePathVariants(), slots?.root, className),
|
|
48
|
+
title: path,
|
|
49
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: cn(MiddleTruncatePathStyles.start, slots?.start, startClassName),
|
|
51
|
+
children: start
|
|
52
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: cn(MiddleTruncatePathStyles.end, slots?.end, endClassName),
|
|
54
|
+
children: end
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { MiddleTruncatePath };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IOperationCardContext } from './OperationCard.types';
|
|
2
|
+
declare const OperationCardProvider: ({ value, children, }: {
|
|
3
|
+
value: IOperationCardContext<unknown>;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}) => React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Typed hook for children to access the current card state. The
|
|
8
|
+
* generic parameter should match the `TTransfer` used on the Root.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { state } = useOperationCard<ITransferProgress>();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare function useOperationCard<TTransfer = unknown>(): IOperationCardContext<TTransfer>;
|
|
16
|
+
export { OperationCardProvider, useOperationCard };
|
|
17
|
+
//# sourceMappingURL=OperationCard.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationCard.context.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/OperationCard/OperationCard.context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,QAAA,MAAO,qBAAqB;;;uBAC6C,CAAC;AAE1E;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CAAC,SAAS,GAAG,OAAO,KAAK,qBAAqB,CAAC,SAAS,CAAC,CAEjF;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
4
|
+
|
|
5
|
+
//#region src/react-ui/ui/OperationCard/OperationCard.context.ts
|
|
6
|
+
/**
|
|
7
|
+
* Strict context for OperationCard compound. Children throw if used
|
|
8
|
+
* outside a `<OperationCardRoot>`.
|
|
9
|
+
*
|
|
10
|
+
* @module @mks2508/mks-ui/react/ui/OperationCard
|
|
11
|
+
*/
|
|
12
|
+
const [OperationCardProvider, useOperationCardUntyped] = getStrictContext("OperationCardContext");
|
|
13
|
+
/**
|
|
14
|
+
* Typed hook for children to access the current card state. The
|
|
15
|
+
* generic parameter should match the `TTransfer` used on the Root.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { state } = useOperationCard<ITransferProgress>();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useOperationCard() {
|
|
23
|
+
return useOperationCardUntyped();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { OperationCardProvider, useOperationCard };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for OperationCard compound — StyleSlots + CVA root variants.
|
|
3
|
+
*
|
|
4
|
+
* Theme tokens only. Never hardcoded colors (mks-ui RULE 0).
|
|
5
|
+
*
|
|
6
|
+
* @module @mks2508/mks-ui/react/ui/OperationCard
|
|
7
|
+
*/
|
|
8
|
+
import type { StyleSlots } from '@/core/types';
|
|
9
|
+
import type { OperationCardSlot } from './OperationCard.types';
|
|
10
|
+
/** Per-slot base classes. CVA applies only to `root`. */
|
|
11
|
+
export declare const OperationCardStyles: StyleSlots<OperationCardSlot>;
|
|
12
|
+
/**
|
|
13
|
+
* Root variants — driven by the operation status. Lets consumers
|
|
14
|
+
* tweak spacing or visual emphasis per status via the CVA output.
|
|
15
|
+
*/
|
|
16
|
+
export declare const operationCardVariants: (props?: ({
|
|
17
|
+
status?: "idle" | "success" | "failed" | "cancelled" | "pending" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
+
//# sourceMappingURL=OperationCard.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationCard.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/OperationCard/OperationCard.styles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,iBAAiB,CAUpD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;8EAahC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
//#region src/react-ui/ui/OperationCard/OperationCard.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* Styles for OperationCard compound — StyleSlots + CVA root variants.
|
|
6
|
+
*
|
|
7
|
+
* Theme tokens only. Never hardcoded colors (mks-ui RULE 0).
|
|
8
|
+
*
|
|
9
|
+
* @module @mks2508/mks-ui/react/ui/OperationCard
|
|
10
|
+
*/
|
|
11
|
+
/** Per-slot base classes. CVA applies only to `root`. */
|
|
12
|
+
const OperationCardStyles = {
|
|
13
|
+
root: "flex flex-col gap-3 p-4 text-card-foreground",
|
|
14
|
+
header: "flex items-baseline justify-between gap-3",
|
|
15
|
+
title: "truncate text-sm font-semibold",
|
|
16
|
+
phase: "truncate text-[11px] text-muted-foreground",
|
|
17
|
+
percent: "shrink-0 rounded-full bg-muted px-2 py-0.5 font-mono text-[11px]",
|
|
18
|
+
visualizer: "",
|
|
19
|
+
stats: "grid grid-cols-3 gap-3 text-xs",
|
|
20
|
+
progress: "h-1 overflow-hidden rounded-full bg-muted",
|
|
21
|
+
actions: "flex items-center justify-between gap-2"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Root variants — driven by the operation status. Lets consumers
|
|
25
|
+
* tweak spacing or visual emphasis per status via the CVA output.
|
|
26
|
+
*/
|
|
27
|
+
const operationCardVariants = cva(OperationCardStyles.root, {
|
|
28
|
+
variants: { status: {
|
|
29
|
+
idle: "",
|
|
30
|
+
pending: "",
|
|
31
|
+
success: "",
|
|
32
|
+
failed: "",
|
|
33
|
+
cancelled: "opacity-70"
|
|
34
|
+
} },
|
|
35
|
+
defaultVariants: { status: "idle" }
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { OperationCardStyles, operationCardVariants };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type surface for the OperationCard compound.
|
|
3
|
+
*
|
|
4
|
+
* The card represents the lifecycle of a long-running operation (git
|
|
5
|
+
* push/pull, deploy, upload, migration, anything that ticks through
|
|
6
|
+
* discrete phases). It is **generic over the transfer payload** — the
|
|
7
|
+
* consumer defines what `transfer` looks like and wires it through
|
|
8
|
+
* `IOperationCardState<TTransfer>`.
|
|
9
|
+
*
|
|
10
|
+
* mks-ui owns this interface and knows nothing about domain types.
|
|
11
|
+
*
|
|
12
|
+
* @module @mks2508/mks-ui/react/ui/OperationCard
|
|
13
|
+
*/
|
|
14
|
+
import type { ReactNode } from 'react';
|
|
15
|
+
import type { IBaseConfig, SlotOverrides } from '@/core/types';
|
|
16
|
+
import type { DotMatrixAccentRow, DotMatrixColor, DotMatrixPattern } from '@/react-ui/primitives/DotMatrix';
|
|
17
|
+
/** Lifecycle status of the underlying operation. */
|
|
18
|
+
export type OperationCardStatus = 'idle' | 'pending' | 'success' | 'failed' | 'cancelled';
|
|
19
|
+
/**
|
|
20
|
+
* Error shape. Kept minimal on purpose — consumers surface what they
|
|
21
|
+
* want via `details`.
|
|
22
|
+
*/
|
|
23
|
+
export interface IOperationCardError {
|
|
24
|
+
/** One-liner shown in the header + error section. */
|
|
25
|
+
message: string;
|
|
26
|
+
/** Optional verbose body, shown inside the collapsible "Show details". */
|
|
27
|
+
details?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One inline action surfaced in `OperationCardActions`. Used for the
|
|
31
|
+
* follow-up buttons that replace a generic Retry in specific failure /
|
|
32
|
+
* success scenarios (e.g. "Pull & push" after a non-fast-forward push,
|
|
33
|
+
* "Pull now" after a fetch detects new commits upstream).
|
|
34
|
+
*/
|
|
35
|
+
export interface IOperationCardAction {
|
|
36
|
+
/** Button label. */
|
|
37
|
+
label: string;
|
|
38
|
+
/** Handler fired when the button is pressed. */
|
|
39
|
+
onClick: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Recommended next step — painted as the primary action. Only one
|
|
42
|
+
* recommended action should exist per state; the rest fall back to
|
|
43
|
+
* the secondary treatment.
|
|
44
|
+
*/
|
|
45
|
+
recommended?: boolean;
|
|
46
|
+
/** Visual variant. `primary` is equivalent to `recommended`. */
|
|
47
|
+
variant?: 'primary' | 'secondary' | 'ghost';
|
|
48
|
+
/** Optional icon rendered before the label. */
|
|
49
|
+
icon?: ReactNode;
|
|
50
|
+
/** Disable the button (keeps it rendered to preserve layout). */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Known meta fields read by the compound. Consumer can attach anything
|
|
55
|
+
* else — unknown keys are preserved and ignored by the card itself.
|
|
56
|
+
*/
|
|
57
|
+
export interface IOperationCardMeta extends Record<string, unknown> {
|
|
58
|
+
/** Drives the `Cancel (3s)` grace-period countdown when `pending`. */
|
|
59
|
+
remainingSeconds?: number;
|
|
60
|
+
/** DotMatrix animation pattern. Drives the visual flow per op. */
|
|
61
|
+
pattern?: DotMatrixPattern;
|
|
62
|
+
/** DotMatrix palette colour. */
|
|
63
|
+
color?: DotMatrixColor;
|
|
64
|
+
/** Bloom intensity for the DotMatrix. */
|
|
65
|
+
bloom?: boolean | number;
|
|
66
|
+
/** Number of accent cells (e.g. new commits detected). Default: 0. */
|
|
67
|
+
accentCount?: number;
|
|
68
|
+
/** Accent cells row. Default: `top`. */
|
|
69
|
+
accentRow?: DotMatrixAccentRow;
|
|
70
|
+
/** Inline actions — rendered alongside / instead of the default Retry. */
|
|
71
|
+
actions?: IOperationCardAction[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* View-model the compound reads from context. Derive it upstream (hook
|
|
75
|
+
* or adapter) and pass to `<OperationCardRoot state={...} />`.
|
|
76
|
+
*/
|
|
77
|
+
export interface IOperationCardState<TTransfer = unknown> {
|
|
78
|
+
/** Status of the operation. */
|
|
79
|
+
status: OperationCardStatus;
|
|
80
|
+
/** Progress value 0..1. Consumer derives from transfer. */
|
|
81
|
+
progress: number;
|
|
82
|
+
/** Title line (e.g. "Pull origin · main"). */
|
|
83
|
+
title: string;
|
|
84
|
+
/**
|
|
85
|
+
* Phase label (e.g. "Enumerating objects"). Swapped with SlidingText
|
|
86
|
+
* when it changes to give a continuous "work is happening" feel.
|
|
87
|
+
*/
|
|
88
|
+
phaseLabel?: string;
|
|
89
|
+
/** Opaque domain payload. Passed to the Stats render-prop children. */
|
|
90
|
+
transfer?: TTransfer;
|
|
91
|
+
/** Populated when `status === 'failed'`. */
|
|
92
|
+
error?: IOperationCardError;
|
|
93
|
+
/** Narrative + behavioural metadata. See `IOperationCardMeta`. */
|
|
94
|
+
meta?: IOperationCardMeta;
|
|
95
|
+
}
|
|
96
|
+
export type OperationCardSlot = 'root' | 'header' | 'title' | 'phase' | 'percent' | 'visualizer' | 'stats' | 'progress' | 'actions';
|
|
97
|
+
export interface IOperationCardConfig extends IBaseConfig {
|
|
98
|
+
/**
|
|
99
|
+
* Auto-close after success. If omitted, the card stays open until
|
|
100
|
+
* the consumer dismisses it.
|
|
101
|
+
*/
|
|
102
|
+
autoCloseMs?: number;
|
|
103
|
+
/** Close when Escape is pressed. Default: true. */
|
|
104
|
+
closeOnEscape?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface IOperationCardContext<TTransfer = unknown> {
|
|
107
|
+
state: IOperationCardState<TTransfer>;
|
|
108
|
+
onCancel?: () => void;
|
|
109
|
+
onRetry?: () => void;
|
|
110
|
+
onClose?: () => void;
|
|
111
|
+
}
|
|
112
|
+
export interface IOperationCardRootProps<TTransfer = unknown> {
|
|
113
|
+
/** View-model describing the operation. */
|
|
114
|
+
state: IOperationCardState<TTransfer>;
|
|
115
|
+
/** Called when the user cancels a pending operation. */
|
|
116
|
+
onCancel?: () => void;
|
|
117
|
+
/** Called when the user retries a failed operation. */
|
|
118
|
+
onRetry?: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* Called when the card wants to close itself — Esc keydown,
|
|
121
|
+
* auto-close timer on success, or consumer-triggered dismissal.
|
|
122
|
+
*/
|
|
123
|
+
onClose?: () => void;
|
|
124
|
+
/** Auto-close after success (ms). 0 / undefined = stay open. */
|
|
125
|
+
autoCloseMs?: number;
|
|
126
|
+
/** Close when Escape is pressed. Default: true. */
|
|
127
|
+
closeOnEscape?: boolean;
|
|
128
|
+
/** Per-slot className overrides. */
|
|
129
|
+
slots?: SlotOverrides<OperationCardSlot>;
|
|
130
|
+
/** Advanced config. */
|
|
131
|
+
config?: IOperationCardConfig;
|
|
132
|
+
/** Extra className for the root. */
|
|
133
|
+
className?: string;
|
|
134
|
+
/** Subcomponents (OperationCardHeader, OperationCardVisualizer, ...). */
|
|
135
|
+
children: ReactNode;
|
|
136
|
+
}
|
|
137
|
+
export interface IOperationCardHeaderProps {
|
|
138
|
+
/** Extra className appended after slot override. */
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface IOperationCardVisualizerProps {
|
|
142
|
+
/** Rows of the DotMatrix grid. Default 6. */
|
|
143
|
+
rows?: number;
|
|
144
|
+
/** Cols of the DotMatrix grid. Default 18. */
|
|
145
|
+
cols?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Pattern override. When omitted, falls back to `state.meta?.pattern`
|
|
148
|
+
* then to `wave-lr`.
|
|
149
|
+
*/
|
|
150
|
+
pattern?: DotMatrixPattern;
|
|
151
|
+
/** Palette override. Falls back to `state.meta?.color`. */
|
|
152
|
+
color?: DotMatrixColor;
|
|
153
|
+
/** Bloom override. Falls back to `state.meta?.bloom`. */
|
|
154
|
+
bloom?: boolean | number;
|
|
155
|
+
/** Accent cells row placement. Falls back to `state.meta?.accentRow`. */
|
|
156
|
+
accentRow?: DotMatrixAccentRow;
|
|
157
|
+
/** Replace the default DotMatrix with custom children. */
|
|
158
|
+
children?: ReactNode;
|
|
159
|
+
/** Extra className appended after slot override. */
|
|
160
|
+
className?: string;
|
|
161
|
+
}
|
|
162
|
+
export interface IOperationCardStatsProps<TTransfer = unknown> {
|
|
163
|
+
/**
|
|
164
|
+
* Render-prop receiving the `transfer` payload from context state.
|
|
165
|
+
* When `transfer` is undefined, children still renders with `undefined`
|
|
166
|
+
* so the consumer can decide whether to hide zero-state or show
|
|
167
|
+
* skeletons.
|
|
168
|
+
*/
|
|
169
|
+
children: (transfer: TTransfer | undefined) => ReactNode;
|
|
170
|
+
/** Extra className appended after slot override. */
|
|
171
|
+
className?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface IOperationCardProgressProps {
|
|
174
|
+
/** Extra className appended after slot override. */
|
|
175
|
+
className?: string;
|
|
176
|
+
}
|
|
177
|
+
export interface IOperationCardActionsProps {
|
|
178
|
+
/**
|
|
179
|
+
* Show the "Esc to close" hint. Default: true. Consumers who implement
|
|
180
|
+
* their own keyboard hint surface can disable this.
|
|
181
|
+
*/
|
|
182
|
+
showEscHint?: boolean;
|
|
183
|
+
/** Extra className appended after slot override. */
|
|
184
|
+
className?: string;
|
|
185
|
+
/** Extra children appended after the built-in buttons. */
|
|
186
|
+
children?: ReactNode;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=OperationCard.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationCard.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/OperationCard/OperationCard.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useOperationCard } from './OperationCard.context';
|
|
2
|
+
import { OperationCardStyles, operationCardVariants } from './OperationCard.styles';
|
|
3
|
+
import type { IOperationCardRootProps } from './OperationCard.types';
|
|
4
|
+
import { OperationCardHeader } from './parts/OperationCardHeader';
|
|
5
|
+
import { OperationCardVisualizer } from './parts/OperationCardVisualizer';
|
|
6
|
+
import { OperationCardStats } from './parts/OperationCardStats';
|
|
7
|
+
import { OperationCardProgress } from './parts/OperationCardProgress';
|
|
8
|
+
import { OperationCardActions } from './parts/OperationCardActions';
|
|
9
|
+
export * from './OperationCard.types';
|
|
10
|
+
export { OperationCardStyles, operationCardVariants };
|
|
11
|
+
export { useOperationCard };
|
|
12
|
+
export { OperationCardHeader, OperationCardVisualizer, OperationCardStats, OperationCardProgress, OperationCardActions, };
|
|
13
|
+
/**
|
|
14
|
+
* Root of the OperationCard compound. Owns the context, drives
|
|
15
|
+
* auto-close and Escape-to-close behaviour.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <OperationCardRoot
|
|
20
|
+
* state={{ status: 'pending', progress: 0.4, title: 'Pull origin · main', phaseLabel: 'Receiving objects' }}
|
|
21
|
+
* onCancel={() => cancelPull()}
|
|
22
|
+
* autoCloseMs={2000}
|
|
23
|
+
* onClose={() => setOpen(false)}
|
|
24
|
+
* >
|
|
25
|
+
* <OperationCardHeader />
|
|
26
|
+
* <OperationCardVisualizer />
|
|
27
|
+
* <OperationCardProgress />
|
|
28
|
+
* <OperationCardActions />
|
|
29
|
+
* </OperationCardRoot>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function OperationCardRoot<TTransfer = unknown>({ state, onCancel, onRetry, onClose, autoCloseMs, closeOnEscape, slots, config: _config, className, children, }: IOperationCardRootProps<TTransfer>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Namespace helper for the more-ergonomic `<OperationCard.Header />`
|
|
35
|
+
* usage. Equivalent to importing the flat `OperationCardHeader` etc.
|
|
36
|
+
*/
|
|
37
|
+
export declare const OperationCard: {
|
|
38
|
+
Root: typeof OperationCardRoot;
|
|
39
|
+
Header: typeof OperationCardHeader;
|
|
40
|
+
Visualizer: typeof OperationCardVisualizer;
|
|
41
|
+
Stats: typeof OperationCardStats;
|
|
42
|
+
Progress: typeof OperationCardProgress;
|
|
43
|
+
Actions: typeof OperationCardActions;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/OperationCard/index.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAAyB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEX,uBAAuB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAG,OAAO,EAAE,EACtD,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,aAAoB,EACpB,KAAK,EACL,MAAM,EAAE,OAAO,EACf,SAAS,EACT,QAAQ,GACR,EAAE,uBAAuB,CAAC,SAAS,CAAC,2CA0CpC;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;CAOzB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { OperationCardProvider, useOperationCard } from "./OperationCard.context.js";
|
|
5
|
+
import { OperationCardStyles, operationCardVariants } from "./OperationCard.styles.js";
|
|
6
|
+
import { OperationCardHeader } from "./parts/OperationCardHeader.js";
|
|
7
|
+
import { OperationCardVisualizer } from "./parts/OperationCardVisualizer.js";
|
|
8
|
+
import { OperationCardStats } from "./parts/OperationCardStats.js";
|
|
9
|
+
import { OperationCardProgress } from "./parts/OperationCardProgress.js";
|
|
10
|
+
import { OperationCardActions } from "./parts/OperationCardActions.js";
|
|
11
|
+
import { useEffect, useMemo } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
|
|
14
|
+
//#region src/react-ui/ui/OperationCard/index.tsx
|
|
15
|
+
/**
|
|
16
|
+
* OperationCard — compound component for visualising the lifecycle
|
|
17
|
+
* of a long-running operation.
|
|
18
|
+
*
|
|
19
|
+
* Follows the mks-ui canonical compound pattern (strict context, flat
|
|
20
|
+
* exports, `useControlledState` where applicable, slots via `StyleSlots`
|
|
21
|
+
* + per-slot className overrides). Subcomponents read the view-model
|
|
22
|
+
* from context so consumers compose whatever they want inside:
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <OperationCardRoot state={state} onCancel={...} autoCloseMs={2000}>
|
|
26
|
+
* <OperationCardHeader />
|
|
27
|
+
* <OperationCardVisualizer />
|
|
28
|
+
* <OperationCardStats>
|
|
29
|
+
* {(transfer) => (
|
|
30
|
+
* <>
|
|
31
|
+
* <StatCell label="Received" value={transfer?.receivedBytes ?? 0} />
|
|
32
|
+
* ...
|
|
33
|
+
* </>
|
|
34
|
+
* )}
|
|
35
|
+
* </OperationCardStats>
|
|
36
|
+
* <OperationCardProgress />
|
|
37
|
+
* <OperationCardActions />
|
|
38
|
+
* </OperationCardRoot>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* A namespace helper is also exported so consumers can pick the
|
|
42
|
+
* more-ergonomic `<OperationCard.Header />` style if they prefer.
|
|
43
|
+
*
|
|
44
|
+
* @module @mks2508/mks-ui/react/ui/OperationCard
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Root of the OperationCard compound. Owns the context, drives
|
|
48
|
+
* auto-close and Escape-to-close behaviour.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <OperationCardRoot
|
|
53
|
+
* state={{ status: 'pending', progress: 0.4, title: 'Pull origin · main', phaseLabel: 'Receiving objects' }}
|
|
54
|
+
* onCancel={() => cancelPull()}
|
|
55
|
+
* autoCloseMs={2000}
|
|
56
|
+
* onClose={() => setOpen(false)}
|
|
57
|
+
* >
|
|
58
|
+
* <OperationCardHeader />
|
|
59
|
+
* <OperationCardVisualizer />
|
|
60
|
+
* <OperationCardProgress />
|
|
61
|
+
* <OperationCardActions />
|
|
62
|
+
* </OperationCardRoot>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
function OperationCardRoot({ state, onCancel, onRetry, onClose, autoCloseMs, closeOnEscape = true, slots, config: _config, className, children }) {
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (state.status !== "success" || !autoCloseMs || autoCloseMs <= 0) return;
|
|
68
|
+
if (!onClose) return;
|
|
69
|
+
const id = window.setTimeout(onClose, autoCloseMs);
|
|
70
|
+
return () => window.clearTimeout(id);
|
|
71
|
+
}, [
|
|
72
|
+
state.status,
|
|
73
|
+
autoCloseMs,
|
|
74
|
+
onClose
|
|
75
|
+
]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!closeOnEscape || !onClose) return;
|
|
78
|
+
const handler = (e) => {
|
|
79
|
+
if (e.key === "Escape") onClose();
|
|
80
|
+
};
|
|
81
|
+
window.addEventListener("keydown", handler);
|
|
82
|
+
return () => window.removeEventListener("keydown", handler);
|
|
83
|
+
}, [closeOnEscape, onClose]);
|
|
84
|
+
return /* @__PURE__ */ jsx(OperationCardProvider, {
|
|
85
|
+
value: useMemo(() => ({
|
|
86
|
+
state,
|
|
87
|
+
onCancel,
|
|
88
|
+
onRetry,
|
|
89
|
+
onClose
|
|
90
|
+
}), [
|
|
91
|
+
state,
|
|
92
|
+
onCancel,
|
|
93
|
+
onRetry,
|
|
94
|
+
onClose
|
|
95
|
+
]),
|
|
96
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
97
|
+
"data-slot": "operation-card",
|
|
98
|
+
"data-status": state.status,
|
|
99
|
+
className: cn(operationCardVariants({ status: state.status }), slots?.root, className),
|
|
100
|
+
children
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Namespace helper for the more-ergonomic `<OperationCard.Header />`
|
|
106
|
+
* usage. Equivalent to importing the flat `OperationCardHeader` etc.
|
|
107
|
+
*/
|
|
108
|
+
const OperationCard = {
|
|
109
|
+
Root: OperationCardRoot,
|
|
110
|
+
Header: OperationCardHeader,
|
|
111
|
+
Visualizer: OperationCardVisualizer,
|
|
112
|
+
Stats: OperationCardStats,
|
|
113
|
+
Progress: OperationCardProgress,
|
|
114
|
+
Actions: OperationCardActions
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { OperationCard, OperationCardRoot };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IOperationCardActionsProps } from '../OperationCard.types';
|
|
2
|
+
export declare function OperationCardActions({ showEscHint, className, children, }: IOperationCardActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=OperationCardActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationCardActions.d.ts","sourceRoot":"","sources":["../../../../../src/react-ui/ui/OperationCard/parts/OperationCardActions.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAEX,0BAA0B,EAC1B,MAAM,wBAAwB,CAAC;AAqBhC,wBAAgB,oBAAoB,CAAC,EACpC,WAAkB,EAClB,SAAS,EACT,QAAQ,GACR,EAAE,0BAA0B,2CAiE5B"}
|