@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,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileIcon / FolderIcon — Material Icon Theme-powered file/folder glyphs.
|
|
3
|
+
*
|
|
4
|
+
* Thin React wrapper over a configurable icon resolver. By default it
|
|
5
|
+
* consumes `vscode-material-icon-theme-js` (optional peer) to map a
|
|
6
|
+
* filename to an SVG basename, then renders an `<img>` pointing at
|
|
7
|
+
* `${basePath}${basename}`. Consumers are responsible for hosting the
|
|
8
|
+
* SVGs under `basePath` (defaults to `/file-icons/`).
|
|
9
|
+
*
|
|
10
|
+
* Ported from mks-mission-control with MC-specific plumbing stripped.
|
|
11
|
+
*
|
|
12
|
+
* @module @mks2508/mks-ui/react/ui/FileIcon
|
|
13
|
+
*/
|
|
14
|
+
import type { IFileIconProps, IFolderIconProps } from './FileIcon.types';
|
|
15
|
+
/**
|
|
16
|
+
* FileIcon — renders an icon for a given filename.
|
|
17
|
+
*
|
|
18
|
+
* @param filename - Filename used to resolve the icon asset
|
|
19
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <FileIcon filename="App.tsx" /> // react_ts.svg
|
|
24
|
+
* <FileIcon filename="package.json" /> // json.svg
|
|
25
|
+
* <FileIcon filename=".gitignore" size={20} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const FileIcon: import("react").MemoExoticComponent<({ filename, size, className, isSubmodule, basePath, resolve, slots, }: IFileIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
/**
|
|
30
|
+
* FolderIcon — renders an icon for a given folder (supports open/closed state).
|
|
31
|
+
*
|
|
32
|
+
* @param name - Folder name used to resolve the icon asset
|
|
33
|
+
* @param open - Whether the folder is visually open
|
|
34
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <FolderIcon name="src" /> // folder-src.svg
|
|
39
|
+
* <FolderIcon name="src" open /> // folder-src-open.svg
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const FolderIcon: import("react").MemoExoticComponent<({ name, open, size, className, basePath, resolve, slots, }: IFolderIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
43
|
+
export { FileIconStyles, fileIconVariants, FolderIconStyles, folderIconVariants, } from './FileIcon.styles';
|
|
44
|
+
export type { FileIconSlot, FolderIconSlot } from './FileIcon.styles';
|
|
45
|
+
export type { IFileIconProps, IFolderIconProps, FileIconResolver, FolderIconResolver, } from './FileIcon.types';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/FileIcon/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAGjB,MAAM,kBAAkB,CAAC;AAwE1B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,8GAQlB,cAAc,6CAuBf,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,mGAQpB,gBAAgB,6CAajB,CAAC;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { FileIconStyles, FolderIconStyles, fileIconVariants, folderIconVariants } from "./FileIcon.styles.js";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react-ui/ui/FileIcon/index.tsx
|
|
9
|
+
/**
|
|
10
|
+
* FileIcon / FolderIcon — Material Icon Theme-powered file/folder glyphs.
|
|
11
|
+
*
|
|
12
|
+
* Thin React wrapper over a configurable icon resolver. By default it
|
|
13
|
+
* consumes `vscode-material-icon-theme-js` (optional peer) to map a
|
|
14
|
+
* filename to an SVG basename, then renders an `<img>` pointing at
|
|
15
|
+
* `${basePath}${basename}`. Consumers are responsible for hosting the
|
|
16
|
+
* SVGs under `basePath` (defaults to `/file-icons/`).
|
|
17
|
+
*
|
|
18
|
+
* Ported from mks-mission-control with MC-specific plumbing stripped.
|
|
19
|
+
*
|
|
20
|
+
* @module @mks2508/mks-ui/react/ui/FileIcon
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Try to load the Material Icon Theme resolver lazily.
|
|
24
|
+
*
|
|
25
|
+
* Uses a runtime require via dynamic lookup so that consumers who do
|
|
26
|
+
* not install `vscode-material-icon-theme-js` simply get a `file.svg`
|
|
27
|
+
* fallback instead of a bundler error.
|
|
28
|
+
*/
|
|
29
|
+
function tryLoadMaterialResolvers() {
|
|
30
|
+
try {
|
|
31
|
+
const mod = globalThis.require?.("vscode-material-icon-theme-js");
|
|
32
|
+
if (!mod) return {};
|
|
33
|
+
return {
|
|
34
|
+
file: mod.getIconForFile,
|
|
35
|
+
folder: mod.getIconForFolder,
|
|
36
|
+
folderOpen: mod.getIconForOpenFolder
|
|
37
|
+
};
|
|
38
|
+
} catch {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const MATERIAL = /* @__PURE__ */ tryLoadMaterialResolvers();
|
|
43
|
+
/** Default filename → svg-basename resolver. */
|
|
44
|
+
const defaultFileResolver = (filename) => MATERIAL.file?.(filename) ?? "file.svg";
|
|
45
|
+
/** Default foldername → svg-basename resolver. */
|
|
46
|
+
const defaultFolderResolver = (name, open) => {
|
|
47
|
+
if (open) return MATERIAL.folderOpen?.(name) ?? "folder-open.svg";
|
|
48
|
+
return MATERIAL.folder?.(name) ?? "folder.svg";
|
|
49
|
+
};
|
|
50
|
+
/** Minimal inline git-fork glyph used for submodules (no external icon dep). */
|
|
51
|
+
function GitForkGlyph({ size, className }) {
|
|
52
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
53
|
+
width: size,
|
|
54
|
+
height: size,
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
fill: "none",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
strokeWidth: 1.5,
|
|
59
|
+
strokeLinecap: "round",
|
|
60
|
+
strokeLinejoin: "round",
|
|
61
|
+
className: cn("shrink-0 text-primary", className),
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx("circle", {
|
|
65
|
+
cx: "12",
|
|
66
|
+
cy: "18",
|
|
67
|
+
r: "3"
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx("circle", {
|
|
70
|
+
cx: "6",
|
|
71
|
+
cy: "6",
|
|
72
|
+
r: "3"
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx("circle", {
|
|
75
|
+
cx: "18",
|
|
76
|
+
cy: "6",
|
|
77
|
+
r: "3"
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("path", { d: "M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9" }),
|
|
80
|
+
/* @__PURE__ */ jsx("path", { d: "M12 12v3" })
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* FileIcon — renders an icon for a given filename.
|
|
86
|
+
*
|
|
87
|
+
* @param filename - Filename used to resolve the icon asset
|
|
88
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <FileIcon filename="App.tsx" /> // react_ts.svg
|
|
93
|
+
* <FileIcon filename="package.json" /> // json.svg
|
|
94
|
+
* <FileIcon filename=".gitignore" size={20} />
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
const FileIcon = memo(function FileIcon({ filename, size = 16, className, isSubmodule, basePath = "/file-icons/", resolve = defaultFileResolver, slots }) {
|
|
98
|
+
if (isSubmodule) return /* @__PURE__ */ jsx(GitForkGlyph, {
|
|
99
|
+
size,
|
|
100
|
+
className: cn(fileIconVariants(), slots?.root, className)
|
|
101
|
+
});
|
|
102
|
+
return /* @__PURE__ */ jsx("img", {
|
|
103
|
+
src: `${basePath}${resolve(filename)}`,
|
|
104
|
+
alt: "",
|
|
105
|
+
width: size,
|
|
106
|
+
height: size,
|
|
107
|
+
className: cn(fileIconVariants(), slots?.root, className),
|
|
108
|
+
loading: "lazy",
|
|
109
|
+
decoding: "async"
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* FolderIcon — renders an icon for a given folder (supports open/closed state).
|
|
114
|
+
*
|
|
115
|
+
* @param name - Folder name used to resolve the icon asset
|
|
116
|
+
* @param open - Whether the folder is visually open
|
|
117
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <FolderIcon name="src" /> // folder-src.svg
|
|
122
|
+
* <FolderIcon name="src" open /> // folder-src-open.svg
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
const FolderIcon = memo(function FolderIcon({ name, open = false, size = 16, className, basePath = "/file-icons/", resolve = defaultFolderResolver, slots }) {
|
|
126
|
+
return /* @__PURE__ */ jsx("img", {
|
|
127
|
+
src: `${basePath}${resolve(name, open)}`,
|
|
128
|
+
alt: "",
|
|
129
|
+
width: size,
|
|
130
|
+
height: size,
|
|
131
|
+
className: cn(folderIconVariants(), slots?.root, className),
|
|
132
|
+
loading: "lazy",
|
|
133
|
+
decoding: "async"
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
export { FileIcon, FolderIcon };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for FileItem.
|
|
3
|
+
*
|
|
4
|
+
* @module @mks2508/mks-ui/react/ui/FileItem
|
|
5
|
+
*/
|
|
6
|
+
import type { StyleSlots } from '@/core/types';
|
|
7
|
+
/** Visual regions of the FileItem component. */
|
|
8
|
+
export type FileItemSlot = 'root' | 'icon' | 'path' | 'modifiedChip' | 'boost' | 'gitStatus';
|
|
9
|
+
/**
|
|
10
|
+
* Tailwind utility classes per git change status. All values resolve to
|
|
11
|
+
* theme design tokens (CSS variables) so the dot colours adapt across
|
|
12
|
+
* light/dark and custom themes without hardcoded hex.
|
|
13
|
+
*
|
|
14
|
+
* Consumers can override via `slots.gitStatus` when a view needs a
|
|
15
|
+
* different palette (e.g. VSCode-style gutter).
|
|
16
|
+
*/
|
|
17
|
+
export declare const FileItemGitStatusClasses: {
|
|
18
|
+
readonly modified: "bg-primary";
|
|
19
|
+
readonly added: "bg-accent-foreground";
|
|
20
|
+
readonly deleted: "bg-destructive";
|
|
21
|
+
readonly untracked: "bg-ring";
|
|
22
|
+
readonly renamed: "bg-secondary-foreground";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Default Tailwind classes for each FileItem slot.
|
|
26
|
+
*
|
|
27
|
+
* | Slot | Region |
|
|
28
|
+
* |------|--------|
|
|
29
|
+
* | `root` | Row container |
|
|
30
|
+
* | `icon` | Leading file/folder icon |
|
|
31
|
+
* | `path` | Middle-truncated path |
|
|
32
|
+
* | `modifiedChip` | Trailing "Xh ago" chip |
|
|
33
|
+
* | `boost` | Trailing boost (⭐) glyph |
|
|
34
|
+
* | `gitStatus` | Leading git change-status dot (only rendered when `changeStatus` is set to a non-null value) |
|
|
35
|
+
*/
|
|
36
|
+
export declare const FileItemStyles: StyleSlots<FileItemSlot>;
|
|
37
|
+
/**
|
|
38
|
+
* CVA variants for the FileItem root.
|
|
39
|
+
*
|
|
40
|
+
* Density variants:
|
|
41
|
+
* - `compact` — 28px row (h-7), smaller icon
|
|
42
|
+
* - `comfortable` — 32px row (h-8), default icon size
|
|
43
|
+
*/
|
|
44
|
+
export declare const fileItemVariants: (props?: ({
|
|
45
|
+
density?: "compact" | "comfortable" | null | undefined;
|
|
46
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
47
|
+
//# sourceMappingURL=FileItem.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileItem.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/FileItem/FileItem.styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,gDAAgD;AAChD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,GACP,WAAW,CAAC;AAEhB;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;;;;CAM3B,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,YAAY,CAO1C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;8EAU3B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
//#region src/react-ui/ui/FileItem/FileItem.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* Styles for FileItem.
|
|
6
|
+
*
|
|
7
|
+
* @module @mks2508/mks-ui/react/ui/FileItem
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Tailwind utility classes per git change status. All values resolve to
|
|
11
|
+
* theme design tokens (CSS variables) so the dot colours adapt across
|
|
12
|
+
* light/dark and custom themes without hardcoded hex.
|
|
13
|
+
*
|
|
14
|
+
* Consumers can override via `slots.gitStatus` when a view needs a
|
|
15
|
+
* different palette (e.g. VSCode-style gutter).
|
|
16
|
+
*/
|
|
17
|
+
const FileItemGitStatusClasses = {
|
|
18
|
+
modified: "bg-primary",
|
|
19
|
+
added: "bg-accent-foreground",
|
|
20
|
+
deleted: "bg-destructive",
|
|
21
|
+
untracked: "bg-ring",
|
|
22
|
+
renamed: "bg-secondary-foreground"
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Default Tailwind classes for each FileItem slot.
|
|
26
|
+
*
|
|
27
|
+
* | Slot | Region |
|
|
28
|
+
* |------|--------|
|
|
29
|
+
* | `root` | Row container |
|
|
30
|
+
* | `icon` | Leading file/folder icon |
|
|
31
|
+
* | `path` | Middle-truncated path |
|
|
32
|
+
* | `modifiedChip` | Trailing "Xh ago" chip |
|
|
33
|
+
* | `boost` | Trailing boost (⭐) glyph |
|
|
34
|
+
* | `gitStatus` | Leading git change-status dot (only rendered when `changeStatus` is set to a non-null value) |
|
|
35
|
+
*/
|
|
36
|
+
const FileItemStyles = {
|
|
37
|
+
root: "file-list-item group flex items-center gap-1.5 px-2 cursor-pointer select-none transition-colors duration-100 hover:bg-accent/40 focus:bg-accent/50 focus:outline-none data-[active]:bg-accent/60",
|
|
38
|
+
icon: "",
|
|
39
|
+
path: "flex-1 min-w-0 text-xs font-mono text-foreground",
|
|
40
|
+
modifiedChip: "shrink-0 text-[10px] font-mono text-muted-foreground/60",
|
|
41
|
+
boost: "shrink-0 text-[11px] text-primary",
|
|
42
|
+
gitStatus: "shrink-0 inline-block size-1.5 rounded-full"
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* CVA variants for the FileItem root.
|
|
46
|
+
*
|
|
47
|
+
* Density variants:
|
|
48
|
+
* - `compact` — 28px row (h-7), smaller icon
|
|
49
|
+
* - `comfortable` — 32px row (h-8), default icon size
|
|
50
|
+
*/
|
|
51
|
+
const fileItemVariants = cva(FileItemStyles.root, {
|
|
52
|
+
variants: { density: {
|
|
53
|
+
compact: "h-7",
|
|
54
|
+
comfortable: "h-8"
|
|
55
|
+
} },
|
|
56
|
+
defaultVariants: { density: "compact" }
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { FileItemGitStatusClasses, FileItemStyles, fileItemVariants };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for FileItem.
|
|
3
|
+
*
|
|
4
|
+
* @module @mks2508/mks-ui/react/ui/FileItem
|
|
5
|
+
*/
|
|
6
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
7
|
+
import type { SlotOverrides } from '@/core/types';
|
|
8
|
+
import type { FileIconResolver } from '../FileIcon/FileIcon.types';
|
|
9
|
+
import type { FileItemSlot, fileItemVariants } from './FileItem.styles';
|
|
10
|
+
/** What kind of filesystem entry this row represents. */
|
|
11
|
+
export type FileItemKind = 'file' | 'dir';
|
|
12
|
+
/**
|
|
13
|
+
* Git change status for a file, rendered as a small dot in the `gitStatus`
|
|
14
|
+
* slot when set. Colours resolve to theme design tokens (see
|
|
15
|
+
* {@link FileItemGitStatusClasses}) so the dot reads correctly under any
|
|
16
|
+
* theme without hardcoded hex.
|
|
17
|
+
*
|
|
18
|
+
* | Status | Token | Meaning |
|
|
19
|
+
* |--------|-------|---------|
|
|
20
|
+
* | `modified` | `bg-primary` | Tracked file with unstaged or staged modifications |
|
|
21
|
+
* | `added` | `bg-accent-foreground` | New file staged |
|
|
22
|
+
* | `deleted` | `bg-destructive` | Tracked file removed from the working tree |
|
|
23
|
+
* | `untracked` | `bg-ring` | New file not yet tracked by git |
|
|
24
|
+
* | `renamed` | `bg-secondary-foreground` | File renamed/moved (porcelain `R`) |
|
|
25
|
+
*/
|
|
26
|
+
export type FileItemChangeStatus = 'modified' | 'added' | 'deleted' | 'untracked' | 'renamed';
|
|
27
|
+
/**
|
|
28
|
+
* Visual density of the row.
|
|
29
|
+
*
|
|
30
|
+
* Maps 1:1 to the `density` CVA variant in `fileItemVariants`.
|
|
31
|
+
*/
|
|
32
|
+
export type FileItemDensity = NonNullable<VariantProps<typeof fileItemVariants>['density']>;
|
|
33
|
+
/**
|
|
34
|
+
* Props for FileItem.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link FileItemSlot} for available slot names
|
|
37
|
+
*/
|
|
38
|
+
export interface IFileItemProps extends Omit<VariantProps<typeof fileItemVariants>, 'density'> {
|
|
39
|
+
/** Full path relative to some root (e.g. `"src/components/Button/index.tsx"`). */
|
|
40
|
+
path: string;
|
|
41
|
+
/** Whether this is a file or a directory. */
|
|
42
|
+
kind: FileItemKind;
|
|
43
|
+
/** Last-modified timestamp; when present renders a "Xh ago"-style chip. */
|
|
44
|
+
modifiedAt?: Date;
|
|
45
|
+
/** Mark this row with a boost glyph (e.g. ⭐ recents/pinned). */
|
|
46
|
+
isBoosted?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Git change status — when set to a non-null value, renders a small
|
|
49
|
+
* coloured dot in the `gitStatus` slot before the path. Accepts `null`
|
|
50
|
+
* explicitly so consumers that receive optional data from a backend
|
|
51
|
+
* (e.g. `?withGitStatus=true`) can pass through cleanly.
|
|
52
|
+
*/
|
|
53
|
+
changeStatus?: FileItemChangeStatus | null;
|
|
54
|
+
/** Whether this row is currently selected (for highlighting). */
|
|
55
|
+
selected?: boolean;
|
|
56
|
+
/** Click / activate handler. */
|
|
57
|
+
onSelect?: () => void;
|
|
58
|
+
/** Row density. Default `"compact"` (28px, matches MC). */
|
|
59
|
+
density?: FileItemDensity;
|
|
60
|
+
/**
|
|
61
|
+
* Icon base path passed to FileIcon. Default `"/file-icons/"`.
|
|
62
|
+
*/
|
|
63
|
+
iconBasePath?: string;
|
|
64
|
+
/** Custom file-icon resolver. */
|
|
65
|
+
iconResolve?: FileIconResolver;
|
|
66
|
+
/** Optional CSS class merged onto the root. */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Native tab index. Default 0 so rows are keyboard-reachable. */
|
|
69
|
+
tabIndex?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Override default Tailwind classes for specific visual regions.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <FileItem
|
|
76
|
+
* path="src/App.tsx"
|
|
77
|
+
* kind="file"
|
|
78
|
+
* slots={{ root: 'rounded-md', boost: 'text-warning' }}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
slots?: SlotOverrides<FileItemSlot>;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=FileItem.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileItem.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/FileItem/FileItem.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,OAAO,GACP,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,SAAS,CAAC,CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC9D,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,EAAE,YAAY,CAAC;IACnB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC3C,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileItem — compact file-row primitive (icon + path + modified-chip + boost).
|
|
3
|
+
*
|
|
4
|
+
* Trimmed port of `mks-mission-control`'s FileItem: git-status dots,
|
|
5
|
+
* staging, discard flow, context menu and multi-select were all stripped.
|
|
6
|
+
* This is the row shape expected by mention menus, file pickers and
|
|
7
|
+
* simple file lists.
|
|
8
|
+
*
|
|
9
|
+
* Layout (compact, 28px row):
|
|
10
|
+
* [icon] [path — middle truncated] [modified-chip?] [⭐?]
|
|
11
|
+
*
|
|
12
|
+
* Keyboard: `role="option"`, `tabIndex=0`, Enter/Space fires `onSelect`.
|
|
13
|
+
*
|
|
14
|
+
* @module @mks2508/mks-ui/react/ui/FileItem
|
|
15
|
+
*/
|
|
16
|
+
import type { IFileItemProps } from './FileItem.types';
|
|
17
|
+
/**
|
|
18
|
+
* FileItem — single row rendering an icon, path, optional modified chip and boost star.
|
|
19
|
+
*
|
|
20
|
+
* @param density - Row density (`compact` 28px vs `comfortable` 32px)
|
|
21
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <FileItem
|
|
26
|
+
* path="src/components/Button/index.tsx"
|
|
27
|
+
* kind="file"
|
|
28
|
+
* modifiedAt={new Date()}
|
|
29
|
+
* isBoosted
|
|
30
|
+
* onSelect={() => console.log('picked')}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // With slot overrides
|
|
37
|
+
* <FileItem
|
|
38
|
+
* path="src/App.tsx"
|
|
39
|
+
* kind="file"
|
|
40
|
+
* slots={{ root: 'rounded-md', boost: 'text-destructive' }}
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const FileItem: import("react").MemoExoticComponent<({ path, kind, modifiedAt, isBoosted, changeStatus, selected, onSelect, density, iconBasePath, iconResolve, className, tabIndex, slots, }: IFileItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
45
|
+
export { FileItemGitStatusClasses, FileItemStyles, fileItemVariants, } from './FileItem.styles';
|
|
46
|
+
export type { FileItemSlot } from './FileItem.styles';
|
|
47
|
+
export type { IFileItemProps, FileItemKind, FileItemDensity, FileItemChangeStatus, } from './FileItem.types';
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/FileItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBvD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,QAAQ,iLAclB,cAAc,6CA6Ef,CAAC;AAEH,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,oBAAoB,GACrB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { FileIcon } from "../FileIcon/index.js";
|
|
5
|
+
import { MiddleTruncatePath } from "../MiddleTruncatePath/index.js";
|
|
6
|
+
import { FileItemGitStatusClasses, FileItemStyles, fileItemVariants } from "./FileItem.styles.js";
|
|
7
|
+
import { memo, useCallback } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/react-ui/ui/FileItem/index.tsx
|
|
11
|
+
/**
|
|
12
|
+
* FileItem — compact file-row primitive (icon + path + modified-chip + boost).
|
|
13
|
+
*
|
|
14
|
+
* Trimmed port of `mks-mission-control`'s FileItem: git-status dots,
|
|
15
|
+
* staging, discard flow, context menu and multi-select were all stripped.
|
|
16
|
+
* This is the row shape expected by mention menus, file pickers and
|
|
17
|
+
* simple file lists.
|
|
18
|
+
*
|
|
19
|
+
* Layout (compact, 28px row):
|
|
20
|
+
* [icon] [path — middle truncated] [modified-chip?] [⭐?]
|
|
21
|
+
*
|
|
22
|
+
* Keyboard: `role="option"`, `tabIndex=0`, Enter/Space fires `onSelect`.
|
|
23
|
+
*
|
|
24
|
+
* @module @mks2508/mks-ui/react/ui/FileItem
|
|
25
|
+
*/
|
|
26
|
+
/** Very small relative-time formatter ("3m ago", "4h ago", "2d ago"). */
|
|
27
|
+
function formatRelative(now, then) {
|
|
28
|
+
const diff = Math.max(0, now - then);
|
|
29
|
+
const s = Math.floor(diff / 1e3);
|
|
30
|
+
if (s < 60) return `${s}s ago`;
|
|
31
|
+
const m = Math.floor(s / 60);
|
|
32
|
+
if (m < 60) return `${m}m ago`;
|
|
33
|
+
const h = Math.floor(m / 60);
|
|
34
|
+
if (h < 24) return `${h}h ago`;
|
|
35
|
+
const d = Math.floor(h / 24);
|
|
36
|
+
if (d < 30) return `${d}d ago`;
|
|
37
|
+
const mo = Math.floor(d / 30);
|
|
38
|
+
if (mo < 12) return `${mo}mo ago`;
|
|
39
|
+
return `${Math.floor(mo / 12)}y ago`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* FileItem — single row rendering an icon, path, optional modified chip and boost star.
|
|
43
|
+
*
|
|
44
|
+
* @param density - Row density (`compact` 28px vs `comfortable` 32px)
|
|
45
|
+
* @param slots - Override Tailwind classes per visual slot
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <FileItem
|
|
50
|
+
* path="src/components/Button/index.tsx"
|
|
51
|
+
* kind="file"
|
|
52
|
+
* modifiedAt={new Date()}
|
|
53
|
+
* isBoosted
|
|
54
|
+
* onSelect={() => console.log('picked')}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // With slot overrides
|
|
61
|
+
* <FileItem
|
|
62
|
+
* path="src/App.tsx"
|
|
63
|
+
* kind="file"
|
|
64
|
+
* slots={{ root: 'rounded-md', boost: 'text-destructive' }}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
const FileItem = memo(function FileItem({ path, kind, modifiedAt, isBoosted = false, changeStatus, selected = false, onSelect, density = "compact", iconBasePath, iconResolve, className, tabIndex = 0, slots }) {
|
|
69
|
+
const filename = path.split("/").pop() ?? path;
|
|
70
|
+
const handleKeyDown = useCallback((e) => {
|
|
71
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
onSelect?.();
|
|
74
|
+
}
|
|
75
|
+
}, [onSelect]);
|
|
76
|
+
const handleClick = useCallback(() => {
|
|
77
|
+
onSelect?.();
|
|
78
|
+
}, [onSelect]);
|
|
79
|
+
const iconSize = density === "comfortable" ? 16 : 15;
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
role: "option",
|
|
82
|
+
"aria-selected": selected,
|
|
83
|
+
tabIndex,
|
|
84
|
+
"data-active": selected || void 0,
|
|
85
|
+
"data-kind": kind,
|
|
86
|
+
onClick: handleClick,
|
|
87
|
+
onKeyDown: handleKeyDown,
|
|
88
|
+
className: cn(fileItemVariants({ density }), slots?.root, className),
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(FileIcon, {
|
|
91
|
+
filename,
|
|
92
|
+
size: iconSize,
|
|
93
|
+
basePath: iconBasePath,
|
|
94
|
+
resolve: iconResolve,
|
|
95
|
+
className: cn(FileItemStyles.icon, slots?.icon)
|
|
96
|
+
}),
|
|
97
|
+
changeStatus && /* @__PURE__ */ jsx("span", {
|
|
98
|
+
"aria-label": `git: ${changeStatus}`,
|
|
99
|
+
title: `git: ${changeStatus}`,
|
|
100
|
+
"data-git-status": changeStatus,
|
|
101
|
+
className: cn(FileItemStyles.gitStatus, FileItemGitStatusClasses[changeStatus], slots?.gitStatus)
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx(MiddleTruncatePath, {
|
|
104
|
+
path,
|
|
105
|
+
className: cn(FileItemStyles.path, slots?.path),
|
|
106
|
+
startClassName: "text-muted-foreground/60"
|
|
107
|
+
}),
|
|
108
|
+
modifiedAt && /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: cn(FileItemStyles.modifiedChip, slots?.modifiedChip),
|
|
110
|
+
title: modifiedAt.toISOString(),
|
|
111
|
+
children: formatRelative(Date.now(), modifiedAt.getTime())
|
|
112
|
+
}),
|
|
113
|
+
isBoosted && /* @__PURE__ */ jsx("span", {
|
|
114
|
+
"aria-label": "boosted",
|
|
115
|
+
title: "Boosted",
|
|
116
|
+
className: cn(FileItemStyles.boost, slots?.boost),
|
|
117
|
+
children: "★"
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { FileItem };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for FilePanel.
|
|
3
|
+
*
|
|
4
|
+
* @module @mks2508/mks-ui/react/ui/FilePanel
|
|
5
|
+
*/
|
|
6
|
+
import type { StyleSlots } from '@/core/types';
|
|
7
|
+
/** Visual regions of the FilePanel component. */
|
|
8
|
+
export type FilePanelSlot = 'root' | 'header' | 'title' | 'toolbar' | 'search' | 'body' | 'footer' | 'status';
|
|
9
|
+
/**
|
|
10
|
+
* Default Tailwind classes for each FilePanel slot.
|
|
11
|
+
*
|
|
12
|
+
* | Slot | Region |
|
|
13
|
+
* |------|--------|
|
|
14
|
+
* | `root` | Outer panel frame |
|
|
15
|
+
* | `header` | Sticky header row (title + actions) |
|
|
16
|
+
* | `title` | Panel title text |
|
|
17
|
+
* | `toolbar` | Toolbar strip under the header (search input + chips) |
|
|
18
|
+
* | `search` | Search input slot wrapper |
|
|
19
|
+
* | `body` | Scrollable body that hosts the tree / children |
|
|
20
|
+
* | `footer` | Footer row |
|
|
21
|
+
* | `status` | Status text in the footer |
|
|
22
|
+
*/
|
|
23
|
+
export declare const FilePanelStyles: StyleSlots<FilePanelSlot>;
|
|
24
|
+
/**
|
|
25
|
+
* CVA variants for the FilePanel root.
|
|
26
|
+
*
|
|
27
|
+
* Density variants adjust only padding; children (tree, search) pass
|
|
28
|
+
* their own density through their own props.
|
|
29
|
+
*/
|
|
30
|
+
export declare const filePanelVariants: (props?: ({
|
|
31
|
+
density?: "compact" | "comfortable" | null | undefined;
|
|
32
|
+
bordered?: boolean | null | undefined;
|
|
33
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
34
|
+
//# sourceMappingURL=FilePanel.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePanel.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/FilePanel/FilePanel.styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,iDAAiD;AACjD,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,QAAQ,GACR,OAAO,GACP,SAAS,GACT,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,QAAQ,CAAC;AAEb;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,aAAa,CAY5C,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;8EAe5B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
//#region src/react-ui/ui/FilePanel/FilePanel.styles.ts
|
|
4
|
+
/**
|
|
5
|
+
* Styles for FilePanel.
|
|
6
|
+
*
|
|
7
|
+
* @module @mks2508/mks-ui/react/ui/FilePanel
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default Tailwind classes for each FilePanel slot.
|
|
11
|
+
*
|
|
12
|
+
* | Slot | Region |
|
|
13
|
+
* |------|--------|
|
|
14
|
+
* | `root` | Outer panel frame |
|
|
15
|
+
* | `header` | Sticky header row (title + actions) |
|
|
16
|
+
* | `title` | Panel title text |
|
|
17
|
+
* | `toolbar` | Toolbar strip under the header (search input + chips) |
|
|
18
|
+
* | `search` | Search input slot wrapper |
|
|
19
|
+
* | `body` | Scrollable body that hosts the tree / children |
|
|
20
|
+
* | `footer` | Footer row |
|
|
21
|
+
* | `status` | Status text in the footer |
|
|
22
|
+
*/
|
|
23
|
+
const FilePanelStyles = {
|
|
24
|
+
root: "file-panel flex flex-col h-full w-full bg-card text-card-foreground border border-border rounded-lg overflow-hidden",
|
|
25
|
+
header: "shrink-0 flex items-center justify-between gap-2 px-3 h-9 border-b border-border bg-muted/30",
|
|
26
|
+
title: "text-xs font-semibold text-foreground truncate",
|
|
27
|
+
toolbar: "shrink-0 flex items-center gap-2 px-2 py-1.5 border-b border-border bg-background/40",
|
|
28
|
+
search: "flex-1 min-w-0",
|
|
29
|
+
body: "flex-1 min-h-0 overflow-y-auto",
|
|
30
|
+
footer: "shrink-0 flex items-center gap-2 px-3 h-7 border-t border-border bg-muted/20",
|
|
31
|
+
status: "text-[10px] font-mono text-muted-foreground/70 truncate"
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* CVA variants for the FilePanel root.
|
|
35
|
+
*
|
|
36
|
+
* Density variants adjust only padding; children (tree, search) pass
|
|
37
|
+
* their own density through their own props.
|
|
38
|
+
*/
|
|
39
|
+
const filePanelVariants = cva(FilePanelStyles.root, {
|
|
40
|
+
variants: {
|
|
41
|
+
density: {
|
|
42
|
+
compact: "",
|
|
43
|
+
comfortable: ""
|
|
44
|
+
},
|
|
45
|
+
bordered: {
|
|
46
|
+
true: "",
|
|
47
|
+
false: "border-0 rounded-none"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
density: "compact",
|
|
52
|
+
bordered: true
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { FilePanelStyles, filePanelVariants };
|