tuiuiu.js 1.0.4 → 1.0.6-next.4ff3fbc
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/app/render-loop.d.ts +2 -0
- package/dist/app/render-loop.d.ts.map +1 -1
- package/dist/app/render-loop.js +14 -3
- package/dist/app/render-loop.js.map +1 -1
- package/dist/atoms/button.d.ts +1 -1
- package/dist/atoms/button.d.ts.map +1 -1
- package/dist/atoms/button.js +13 -11
- package/dist/atoms/button.js.map +1 -1
- package/dist/atoms/progress-bar.d.ts.map +1 -1
- package/dist/atoms/progress-bar.js +15 -12
- package/dist/atoms/progress-bar.js.map +1 -1
- package/dist/atoms/scrollbar.d.ts +30 -0
- package/dist/atoms/scrollbar.d.ts.map +1 -0
- package/dist/atoms/scrollbar.js +46 -0
- package/dist/atoms/scrollbar.js.map +1 -0
- package/dist/atoms/slider.js +6 -6
- package/dist/atoms/slider.js.map +1 -1
- package/dist/atoms/spinner.d.ts.map +1 -1
- package/dist/atoms/spinner.js +3 -2
- package/dist/atoms/spinner.js.map +1 -1
- package/dist/atoms/switch.d.ts.map +1 -1
- package/dist/atoms/switch.js +3 -2
- package/dist/atoms/switch.js.map +1 -1
- package/dist/atoms/text-input.d.ts.map +1 -1
- package/dist/atoms/text-input.js +6 -5
- package/dist/atoms/text-input.js.map +1 -1
- package/dist/atoms/timer.d.ts +1 -1
- package/dist/atoms/timer.js +4 -4
- package/dist/atoms/timer.js.map +1 -1
- package/dist/atoms/tooltip.d.ts +4 -4
- package/dist/atoms/tooltip.js +19 -19
- package/dist/atoms/tooltip.js.map +1 -1
- package/dist/core/delta-render.d.ts.map +1 -1
- package/dist/core/delta-render.js +17 -12
- package/dist/core/delta-render.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +15 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/renderer.d.ts +4 -2
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/core/renderer.js +70 -43
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/theme-loader.d.ts +89 -0
- package/dist/core/theme-loader.d.ts.map +1 -0
- package/dist/core/theme-loader.js +228 -0
- package/dist/core/theme-loader.js.map +1 -0
- package/dist/core/theme-types.d.ts +577 -0
- package/dist/core/theme-types.d.ts.map +1 -0
- package/dist/core/theme-types.js +13 -0
- package/dist/core/theme-types.js.map +1 -0
- package/dist/core/theme.d.ts +155 -236
- package/dist/core/theme.d.ts.map +1 -1
- package/dist/core/theme.js +418 -709
- package/dist/core/theme.js.map +1 -1
- package/dist/design-system/core/renderer.d.ts +14 -3
- package/dist/design-system/core/renderer.d.ts.map +1 -1
- package/dist/design-system/core/renderer.js +77 -38
- package/dist/design-system/core/renderer.js.map +1 -1
- package/dist/design-system/feedback/badge.d.ts +2 -8
- package/dist/design-system/feedback/badge.d.ts.map +1 -1
- package/dist/design-system/feedback/badge.js +32 -8
- package/dist/design-system/feedback/badge.js.map +1 -1
- package/dist/design-system/feedback/progress-bar.d.ts.map +1 -1
- package/dist/design-system/feedback/progress-bar.js +15 -12
- package/dist/design-system/feedback/progress-bar.js.map +1 -1
- package/dist/design-system/feedback/spinner.d.ts.map +1 -1
- package/dist/design-system/feedback/spinner.js +4 -3
- package/dist/design-system/feedback/spinner.js.map +1 -1
- package/dist/design-system/feedback/timer.js +3 -3
- package/dist/design-system/feedback/timer.js.map +1 -1
- package/dist/design-system/layout/app.js +6 -6
- package/dist/design-system/layout/app.js.map +1 -1
- package/dist/design-system/navigation/file-manager.js +15 -15
- package/dist/design-system/navigation/file-manager.js.map +1 -1
- package/dist/design-system/visual/big-text.js +6 -6
- package/dist/design-system/visual/big-text.js.map +1 -1
- package/dist/design-system/visual/digits.js +7 -7
- package/dist/design-system/visual/digits.js.map +1 -1
- package/dist/design-system/visual/splash-screen.d.ts.map +1 -1
- package/dist/design-system/visual/splash-screen.js +23 -17
- package/dist/design-system/visual/splash-screen.js.map +1 -1
- package/dist/design-system/visual/tooltip.js +16 -16
- package/dist/design-system/visual/tooltip.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/types.d.ts +2 -0
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/hooks/use-app.d.ts +5 -0
- package/dist/hooks/use-app.d.ts.map +1 -1
- package/dist/hooks/use-app.js +10 -0
- package/dist/hooks/use-app.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/docs-data.d.ts.map +1 -1
- package/dist/mcp/docs-data.js +625 -28
- package/dist/mcp/docs-data.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/molecules/autocomplete.js +10 -10
- package/dist/molecules/autocomplete.js.map +1 -1
- package/dist/molecules/calendar.d.ts.map +1 -1
- package/dist/molecules/calendar.js +13 -12
- package/dist/molecules/calendar.js.map +1 -1
- package/dist/molecules/code-block.js +21 -21
- package/dist/molecules/code-block.js.map +1 -1
- package/dist/molecules/collapsible.d.ts +9 -5
- package/dist/molecules/collapsible.d.ts.map +1 -1
- package/dist/molecules/collapsible.js +39 -7
- package/dist/molecules/collapsible.js.map +1 -1
- package/dist/molecules/data-viz/bar-chart.js +8 -8
- package/dist/molecules/data-viz/bar-chart.js.map +1 -1
- package/dist/molecules/data-viz/gauge.d.ts.map +1 -1
- package/dist/molecules/data-viz/gauge.js +17 -17
- package/dist/molecules/data-viz/gauge.js.map +1 -1
- package/dist/molecules/data-viz/heatmap.js +11 -11
- package/dist/molecules/data-viz/heatmap.js.map +1 -1
- package/dist/molecules/data-viz/legend.js +3 -3
- package/dist/molecules/data-viz/legend.js.map +1 -1
- package/dist/molecules/data-viz/line-chart.js +4 -4
- package/dist/molecules/data-viz/line-chart.js.map +1 -1
- package/dist/molecules/data-viz/sparkline.js +1 -1
- package/dist/molecules/data-viz/sparkline.js.map +1 -1
- package/dist/molecules/markdown.js +23 -23
- package/dist/molecules/markdown.js.map +1 -1
- package/dist/molecules/multi-select.js +9 -9
- package/dist/molecules/multi-select.js.map +1 -1
- package/dist/molecules/radio-group.js +8 -8
- package/dist/molecules/radio-group.js.map +1 -1
- package/dist/molecules/select.d.ts.map +1 -1
- package/dist/molecules/select.js +15 -13
- package/dist/molecules/select.js.map +1 -1
- package/dist/molecules/table.js +3 -3
- package/dist/molecules/table.js.map +1 -1
- package/dist/molecules/tabs.d.ts +6 -2
- package/dist/molecules/tabs.d.ts.map +1 -1
- package/dist/molecules/tabs.js +25 -13
- package/dist/molecules/tabs.js.map +1 -1
- package/dist/molecules/tree.js +5 -5
- package/dist/molecules/tree.js.map +1 -1
- package/dist/organisms/command-palette.d.ts.map +1 -1
- package/dist/organisms/command-palette.js +19 -17
- package/dist/organisms/command-palette.js.map +1 -1
- package/dist/organisms/data-table.js +5 -5
- package/dist/organisms/data-table.js.map +1 -1
- package/dist/organisms/file-browser.js +15 -15
- package/dist/organisms/file-browser.js.map +1 -1
- package/dist/organisms/index.d.ts +2 -1
- package/dist/organisms/index.d.ts.map +1 -1
- package/dist/organisms/index.js +13 -1
- package/dist/organisms/index.js.map +1 -1
- package/dist/organisms/modal.d.ts +46 -0
- package/dist/organisms/modal.d.ts.map +1 -1
- package/dist/organisms/modal.js +110 -29
- package/dist/organisms/modal.js.map +1 -1
- package/dist/organisms/scroll-area.js +6 -6
- package/dist/organisms/scroll-area.js.map +1 -1
- package/dist/organisms/scroll-list.d.ts +168 -0
- package/dist/organisms/scroll-list.d.ts.map +1 -0
- package/dist/organisms/scroll-list.js +338 -0
- package/dist/organisms/scroll-list.js.map +1 -0
- package/dist/organisms/split-panel.d.ts.map +1 -1
- package/dist/organisms/split-panel.js +7 -4
- package/dist/organisms/split-panel.js.map +1 -1
- package/dist/primitives/divider.d.ts.map +1 -1
- package/dist/primitives/divider.js +4 -3
- package/dist/primitives/divider.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/nodes.d.ts.map +1 -1
- package/dist/primitives/nodes.js +5 -3
- package/dist/primitives/nodes.js.map +1 -1
- package/dist/primitives/scroll.d.ts +127 -0
- package/dist/primitives/scroll.d.ts.map +1 -0
- package/dist/primitives/scroll.js +202 -0
- package/dist/primitives/scroll.js.map +1 -0
- package/dist/storybook/app.d.ts.map +1 -1
- package/dist/storybook/app.js +218 -84
- package/dist/storybook/app.js.map +1 -1
- package/dist/storybook/components/compare-view.d.ts.map +1 -1
- package/dist/storybook/components/compare-view.js +25 -19
- package/dist/storybook/components/compare-view.js.map +1 -1
- package/dist/storybook/components/hotkeys-panel.d.ts +12 -0
- package/dist/storybook/components/hotkeys-panel.d.ts.map +1 -0
- package/dist/storybook/components/hotkeys-panel.js +44 -0
- package/dist/storybook/components/hotkeys-panel.js.map +1 -0
- package/dist/storybook/components/index.d.ts +6 -0
- package/dist/storybook/components/index.d.ts.map +1 -1
- package/dist/storybook/components/index.js +9 -0
- package/dist/storybook/components/index.js.map +1 -1
- package/dist/storybook/components/log-viewer.d.ts +9 -4
- package/dist/storybook/components/log-viewer.d.ts.map +1 -1
- package/dist/storybook/components/log-viewer.js +97 -35
- package/dist/storybook/components/log-viewer.js.map +1 -1
- package/dist/storybook/components/navbar.d.ts +17 -0
- package/dist/storybook/components/navbar.d.ts.map +1 -0
- package/dist/storybook/components/navbar.js +52 -0
- package/dist/storybook/components/navbar.js.map +1 -0
- package/dist/storybook/components/pressed-keys.d.ts +29 -0
- package/dist/storybook/components/pressed-keys.d.ts.map +1 -0
- package/dist/storybook/components/pressed-keys.js +148 -0
- package/dist/storybook/components/pressed-keys.js.map +1 -0
- package/dist/storybook/components/preview.d.ts.map +1 -1
- package/dist/storybook/components/preview.js +44 -34
- package/dist/storybook/components/preview.js.map +1 -1
- package/dist/storybook/components/search-bar.d.ts +29 -0
- package/dist/storybook/components/search-bar.d.ts.map +1 -0
- package/dist/storybook/components/search-bar.js +101 -0
- package/dist/storybook/components/search-bar.js.map +1 -0
- package/dist/storybook/components/sidebar.d.ts.map +1 -1
- package/dist/storybook/components/sidebar.js +27 -21
- package/dist/storybook/components/sidebar.js.map +1 -1
- package/dist/storybook/components/status-bar.d.ts +22 -0
- package/dist/storybook/components/status-bar.d.ts.map +1 -0
- package/dist/storybook/components/status-bar.js +64 -0
- package/dist/storybook/components/status-bar.js.map +1 -0
- package/dist/storybook/store.d.ts +13 -1
- package/dist/storybook/store.d.ts.map +1 -1
- package/dist/storybook/store.js +21 -1
- package/dist/storybook/store.js.map +1 -1
- package/dist/storybook/stories/apps/index.d.ts.map +1 -1
- package/dist/storybook/stories/apps/index.js +82 -147
- package/dist/storybook/stories/apps/index.js.map +1 -1
- package/dist/storybook/stories/atoms/index.d.ts.map +1 -1
- package/dist/storybook/stories/atoms/index.js +57 -52
- package/dist/storybook/stories/atoms/index.js.map +1 -1
- package/dist/storybook/stories/molecules/index.d.ts +16 -0
- package/dist/storybook/stories/molecules/index.d.ts.map +1 -1
- package/dist/storybook/stories/molecules/index.js +299 -91
- package/dist/storybook/stories/molecules/index.js.map +1 -1
- package/dist/storybook/stories/organisms/index.d.ts.map +1 -1
- package/dist/storybook/stories/organisms/index.js +207 -120
- package/dist/storybook/stories/organisms/index.js.map +1 -1
- package/dist/templates/app.d.ts +28 -23
- package/dist/templates/app.d.ts.map +1 -1
- package/dist/templates/app.js +104 -17
- package/dist/templates/app.js.map +1 -1
- package/dist/themes/catppuccin.theme.d.ts +8 -0
- package/dist/themes/catppuccin.theme.d.ts.map +1 -0
- package/dist/themes/catppuccin.theme.js +538 -0
- package/dist/themes/catppuccin.theme.js.map +1 -0
- package/dist/themes/dark.theme.d.ts +8 -0
- package/dist/themes/dark.theme.d.ts.map +1 -0
- package/dist/themes/dark.theme.js +502 -0
- package/dist/themes/dark.theme.js.map +1 -0
- package/dist/themes/dracula.theme.d.ts +8 -0
- package/dist/themes/dracula.theme.d.ts.map +1 -0
- package/dist/themes/dracula.theme.js +518 -0
- package/dist/themes/dracula.theme.js.map +1 -0
- package/dist/themes/gruvbox.theme.d.ts +8 -0
- package/dist/themes/gruvbox.theme.d.ts.map +1 -0
- package/dist/themes/gruvbox.theme.js +529 -0
- package/dist/themes/gruvbox.theme.js.map +1 -0
- package/dist/themes/high-contrast-dark.theme.d.ts +8 -0
- package/dist/themes/high-contrast-dark.theme.d.ts.map +1 -0
- package/dist/themes/high-contrast-dark.theme.js +503 -0
- package/dist/themes/high-contrast-dark.theme.js.map +1 -0
- package/dist/themes/index.d.ts +58 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +75 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/light.theme.d.ts +8 -0
- package/dist/themes/light.theme.d.ts.map +1 -0
- package/dist/themes/light.theme.js +502 -0
- package/dist/themes/light.theme.js.map +1 -0
- package/dist/themes/monochrome.theme.d.ts +8 -0
- package/dist/themes/monochrome.theme.d.ts.map +1 -0
- package/dist/themes/monochrome.theme.js +503 -0
- package/dist/themes/monochrome.theme.js.map +1 -0
- package/dist/themes/monokai.theme.d.ts +8 -0
- package/dist/themes/monokai.theme.d.ts.map +1 -0
- package/dist/themes/monokai.theme.js +518 -0
- package/dist/themes/monokai.theme.js.map +1 -0
- package/dist/themes/nord.theme.d.ts +8 -0
- package/dist/themes/nord.theme.d.ts.map +1 -0
- package/dist/themes/nord.theme.js +527 -0
- package/dist/themes/nord.theme.js.map +1 -0
- package/dist/themes/solarized-dark.theme.d.ts +8 -0
- package/dist/themes/solarized-dark.theme.d.ts.map +1 -0
- package/dist/themes/solarized-dark.theme.js +525 -0
- package/dist/themes/solarized-dark.theme.js.map +1 -0
- package/dist/themes/tokyo-night.theme.d.ts +8 -0
- package/dist/themes/tokyo-night.theme.d.ts.map +1 -0
- package/dist/themes/tokyo-night.theme.js +529 -0
- package/dist/themes/tokyo-night.theme.js.map +1 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { Box, Text, Spacer } from '../../../primitives/nodes.js';
|
|
12
12
|
import { Divider } from '../../../primitives/divider.js';
|
|
13
13
|
import { story, defaultControls } from '../../core/registry.js';
|
|
14
|
+
import { StatusBar, Header } from '../../../templates/app.js';
|
|
14
15
|
// Chart helper
|
|
15
16
|
function textBar(value, max, width, filled = '█', empty = '░') {
|
|
16
17
|
const filledWidth = Math.round((value / max) * width);
|
|
@@ -26,20 +27,20 @@ export const formPatternStories = [
|
|
|
26
27
|
.render(() => Box({
|
|
27
28
|
flexDirection: 'column',
|
|
28
29
|
borderStyle: 'round',
|
|
29
|
-
borderColor: '
|
|
30
|
+
borderColor: 'primary',
|
|
30
31
|
padding: 2,
|
|
31
32
|
width: 40,
|
|
32
|
-
}, Box({ marginBottom: 1 }, Text({ color: '
|
|
33
|
+
}, Box({ marginBottom: 1 }, Text({ color: 'primary', bold: true }, 'Login')), Box({ flexDirection: 'column', marginBottom: 1 }, Text({ color: 'muted' }, 'Username:'), Box({ borderStyle: 'single', borderColor: 'border', paddingX: 1 }, Text({}, 'user@example.com'))), Box({ flexDirection: 'column', marginBottom: 1 }, Text({ color: 'muted' }, 'Password:'), Box({ borderStyle: 'single', borderColor: 'border', paddingX: 1 }, Text({}, '********'))), Box({ flexDirection: 'row', gap: 2 }, Box({ backgroundColor: 'primary', paddingX: 2 }, Text({ color: 'primaryForeground', bold: true }, 'Login')), Text({ color: 'muted', dim: true }, 'Forgot password?')))),
|
|
33
34
|
story('Form - Settings')
|
|
34
35
|
.category('Organisms')
|
|
35
36
|
.description('Settings form pattern')
|
|
36
37
|
.render(() => Box({
|
|
37
38
|
flexDirection: 'column',
|
|
38
39
|
borderStyle: 'single',
|
|
39
|
-
borderColor: '
|
|
40
|
+
borderColor: 'border',
|
|
40
41
|
padding: 1,
|
|
41
42
|
width: 50,
|
|
42
|
-
}, Box({ marginBottom: 1 }, Text({ color: '
|
|
43
|
+
}, Box({ marginBottom: 1 }, Text({ color: 'foreground', bold: true }, 'Settings')), Box({ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 1 }, Text({}, 'Dark Mode'), Text({ color: 'success' }, '[ON]')), Box({ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 1 }, Text({}, 'Notifications'), Text({ color: 'error' }, '[OFF]')), Box({ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 1 }, Text({}, 'Language'), Text({ color: 'primary' }, 'English ▼')), Box({ flexDirection: 'row', justifyContent: 'space-between' }, Text({}, 'Volume'), Text({ color: 'warning' }, '████████░░ 80%')))),
|
|
43
44
|
];
|
|
44
45
|
// ============================================================================
|
|
45
46
|
// Layout Components
|
|
@@ -54,7 +55,7 @@ export const splitPanelStories = [
|
|
|
54
55
|
.render((props) => {
|
|
55
56
|
const leftWidth = Math.floor(58 * (props.ratio / 100));
|
|
56
57
|
const rightWidth = 58 - leftWidth - 1;
|
|
57
|
-
return Box({ width: 60, height: 10, flexDirection: 'row', borderStyle: 'single', borderColor: '
|
|
58
|
+
return Box({ width: 60, height: 10, flexDirection: 'row', borderStyle: 'single', borderColor: 'border' }, Box({ width: leftWidth, height: '100%', backgroundColor: 'info', padding: 1 }, Text({ color: 'foreground' }, 'Left Panel')), Box({ width: 1, height: '100%', backgroundColor: 'muted' }, Text({ color: 'foreground' }, '│')), Box({ width: rightWidth, height: '100%', backgroundColor: 'success', padding: 1 }, Text({ color: 'foreground' }, 'Right Panel')));
|
|
58
59
|
}),
|
|
59
60
|
story('SplitPanel - Vertical')
|
|
60
61
|
.category('Organisms')
|
|
@@ -70,13 +71,13 @@ export const splitPanelStories = [
|
|
|
70
71
|
height: 15,
|
|
71
72
|
flexDirection: 'column',
|
|
72
73
|
borderStyle: 'single',
|
|
73
|
-
borderColor: '
|
|
74
|
-
}, Box({ height: topHeight, width: '100%', backgroundColor: '
|
|
74
|
+
borderColor: 'border',
|
|
75
|
+
}, Box({ height: topHeight, width: '100%', backgroundColor: 'info', padding: 1 }, Text({ color: 'foreground' }, 'Top Panel')), Box({ width: '100%' }, Text({ color: 'muted' }, '─'.repeat(38))), Box({ height: bottomHeight, width: '100%', backgroundColor: 'success', padding: 1 }, Text({ color: 'foreground' }, 'Bottom Panel')));
|
|
75
76
|
}),
|
|
76
77
|
story('SplitPanel - Nested')
|
|
77
78
|
.category('Organisms')
|
|
78
79
|
.description('Nested split panels')
|
|
79
|
-
.render(() => Box({ width: 60, height: 15, borderStyle: 'single', borderColor: '
|
|
80
|
+
.render(() => Box({ width: 60, height: 15, borderStyle: 'single', borderColor: 'border' }, Box({ width: 17, height: '100%', backgroundColor: 'info', padding: 1 }, Text({ color: 'foreground' }, 'Sidebar')), Box({ width: 1, height: '100%' }, Text({ color: 'muted' }, '│')), Box({ flexGrow: 1, height: '100%', flexDirection: 'column' }, Box({ height: 9, width: '100%', backgroundColor: 'success', padding: 1 }, Text({ color: 'foreground' }, 'Main Content')), Box({ width: '100%' }, Text({ color: 'muted' }, '─'.repeat(40))), Box({ height: 3, width: '100%', backgroundColor: 'secondary', padding: 1 }, Text({ color: 'foreground' }, 'Footer'))))),
|
|
80
81
|
];
|
|
81
82
|
export const gridStories = [
|
|
82
83
|
story('Grid - Basic')
|
|
@@ -89,19 +90,19 @@ export const gridStories = [
|
|
|
89
90
|
.render((props) => {
|
|
90
91
|
const cellWidth = Math.floor((50 - (props.columns - 1) * props.gap) / props.columns);
|
|
91
92
|
const cells = Array.from({ length: 9 }, (_, i) => i + 1);
|
|
92
|
-
const colors = ['
|
|
93
|
+
const colors = ['info', 'success', 'secondary'];
|
|
93
94
|
return Box({ flexDirection: 'column', gap: props.gap, width: 50 }, ...Array.from({ length: Math.ceil(cells.length / props.columns) }, (_, rowIdx) => Box({ flexDirection: 'row', gap: props.gap }, ...cells
|
|
94
95
|
.slice(rowIdx * props.columns, (rowIdx + 1) * props.columns)
|
|
95
96
|
.map((cell, colIdx) => Box({
|
|
96
97
|
width: cellWidth,
|
|
97
98
|
backgroundColor: colors[(rowIdx * props.columns + colIdx) % 3],
|
|
98
99
|
padding: 1,
|
|
99
|
-
}, Text({ color: '
|
|
100
|
+
}, Text({ color: 'foreground' }, `Cell ${cell}`))))));
|
|
100
101
|
}),
|
|
101
102
|
story('Grid - Dashboard Layout')
|
|
102
103
|
.category('Organisms')
|
|
103
104
|
.description('Dashboard-style grid layout')
|
|
104
|
-
.render(() => Box({ flexDirection: 'column', gap: 1, width: 60 }, Box({ flexDirection: 'row', gap: 1 }, Box({ backgroundColor: '
|
|
105
|
+
.render(() => Box({ flexDirection: 'column', gap: 1, width: 60 }, Box({ flexDirection: 'row', gap: 1 }, Box({ backgroundColor: 'info', padding: 1, flexGrow: 1 }, Text({ color: 'foreground', bold: true }, 'Users: 1.2k')), Box({ backgroundColor: 'success', padding: 1, flexGrow: 1 }, Text({ color: 'foreground', bold: true }, 'Revenue: $45k')), Box({ backgroundColor: 'secondary', padding: 1, flexGrow: 1 }, Text({ color: 'foreground', bold: true }, 'Orders: 892'))), Box({ flexDirection: 'row', gap: 1 }, Box({ backgroundColor: 'muted', padding: 1, width: 38 }, Text({ color: 'foreground' }, 'Chart Area\n▂▃▅▇█▇▅▃▂▃▅▇')), Box({ backgroundColor: 'primary', padding: 1, flexGrow: 1 }, Text({ color: 'primaryForeground' }, 'Activity\n• New user\n• Sale\n• Comment'))))),
|
|
105
106
|
];
|
|
106
107
|
export const stackStories = [
|
|
107
108
|
story('VStack - Basic')
|
|
@@ -110,7 +111,7 @@ export const stackStories = [
|
|
|
110
111
|
.controls({
|
|
111
112
|
gap: defaultControls.range('Gap', 1, 0, 5),
|
|
112
113
|
})
|
|
113
|
-
.render((props) => Box({ flexDirection: 'column', gap: props.gap }, Box({ backgroundColor: '
|
|
114
|
+
.render((props) => Box({ flexDirection: 'column', gap: props.gap }, Box({ backgroundColor: 'info', padding: 1 }, Text({ color: 'foreground' }, 'Item 1')), Box({ backgroundColor: 'success', padding: 1 }, Text({ color: 'foreground' }, 'Item 2')), Box({ backgroundColor: 'secondary', padding: 1 }, Text({ color: 'foreground' }, 'Item 3')))),
|
|
114
115
|
story('HStack - Basic')
|
|
115
116
|
.category('Organisms')
|
|
116
117
|
.description('Horizontal stack layout')
|
|
@@ -118,17 +119,17 @@ export const stackStories = [
|
|
|
118
119
|
gap: defaultControls.range('Gap', 2, 0, 5),
|
|
119
120
|
justify: defaultControls.select('Justify', ['flex-start', 'center', 'flex-end', 'space-between'], 'flex-start'),
|
|
120
121
|
})
|
|
121
|
-
.render((props) => Box({ flexDirection: 'row', gap: props.gap, justifyContent: props.justify, width: 50 }, Box({ backgroundColor: '
|
|
122
|
+
.render((props) => Box({ flexDirection: 'row', gap: props.gap, justifyContent: props.justify, width: 50 }, Box({ backgroundColor: 'info', padding: 1 }, Text({ color: 'foreground' }, 'A')), Box({ backgroundColor: 'success', padding: 1 }, Text({ color: 'foreground' }, 'B')), Box({ backgroundColor: 'secondary', padding: 1 }, Text({ color: 'foreground' }, 'C')))),
|
|
122
123
|
story('Stack - Nested')
|
|
123
124
|
.category('Organisms')
|
|
124
125
|
.description('Nested stacks for complex layouts')
|
|
125
|
-
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 2, justifyContent: 'space-between', width: 50 }, Text({ color: '
|
|
126
|
+
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 2, justifyContent: 'space-between', width: 50 }, Text({ color: 'primary', bold: true }, 'App Title'), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'muted' }, 'Home'), Text({ color: 'muted' }, 'About'), Text({ color: 'muted' }, 'Contact'))), Divider({}), Box({ flexDirection: 'row', gap: 2 }, Box({ flexDirection: 'column', gap: 1, width: 15 }, Text({ color: 'primary' }, '> Dashboard'), Text({ color: 'muted' }, ' Users'), Text({ color: 'muted' }, ' Settings')), Box({ flexDirection: 'column', gap: 1 }, Text({ bold: true }, 'Dashboard'), Text({ color: 'muted' }, 'Welcome to your dashboard.'))))),
|
|
126
127
|
];
|
|
127
128
|
export const layoutPatternStories = [
|
|
128
129
|
story('Layout - Holy Grail')
|
|
129
130
|
.category('Organisms')
|
|
130
131
|
.description('Classic header-sidebar-main-footer layout')
|
|
131
|
-
.render(() => Box({ flexDirection: 'column', width: 60, height: 15 }, Box({ backgroundColor: '
|
|
132
|
+
.render(() => Box({ flexDirection: 'column', width: 60, height: 15 }, Box({ backgroundColor: 'info', paddingX: 1, width: '100%' }, Text({ color: 'foreground', bold: true }, 'Header')), Box({ flexDirection: 'row', flexGrow: 1 }, Box({ backgroundColor: 'success', width: 12, padding: 1 }, Text({ color: 'foreground' }, 'Sidebar')), Box({ flexGrow: 1, padding: 1 }, Text({}, 'Main Content Area')), Box({ backgroundColor: 'secondary', width: 12, padding: 1 }, Text({ color: 'secondaryForeground' }, 'Aside'))), Box({ backgroundColor: 'primary', paddingX: 1, width: '100%' }, Text({ color: 'primaryForeground' }, 'Footer')))),
|
|
132
133
|
story('Layout - Sidebar Toggle')
|
|
133
134
|
.category('Organisms')
|
|
134
135
|
.description('Layout with collapsible sidebar')
|
|
@@ -137,22 +138,22 @@ export const layoutPatternStories = [
|
|
|
137
138
|
})
|
|
138
139
|
.render((props) => Box({ flexDirection: 'row', width: 60, height: 12 }, props.sidebarOpen
|
|
139
140
|
? Box({
|
|
140
|
-
backgroundColor: '
|
|
141
|
+
backgroundColor: 'info',
|
|
141
142
|
width: 20,
|
|
142
143
|
padding: 1,
|
|
143
144
|
flexDirection: 'column',
|
|
144
|
-
}, Text({ color: '
|
|
145
|
-
: null, Box({ flexGrow: 1, padding: 1, flexDirection: 'column' }, Text({ bold: true }, 'Content'), Text({ color: '
|
|
145
|
+
}, Text({ color: 'foreground', bold: true }, 'Navigation'), Text({ color: 'primary' }, '> Home'), Text({ color: 'muted' }, ' Files'), Text({ color: 'muted' }, ' Settings'))
|
|
146
|
+
: null, Box({ flexGrow: 1, padding: 1, flexDirection: 'column' }, Text({ bold: true }, 'Content'), Text({ color: 'muted' }, props.sidebarOpen ? 'Sidebar is open' : 'Sidebar is closed'), Box({ marginTop: 1 }, Text({ color: 'muted', dim: true }, '[Toggle sidebar with control]'))))),
|
|
146
147
|
story('Layout - Card Grid')
|
|
147
148
|
.category('Organisms')
|
|
148
149
|
.description('Responsive card grid layout')
|
|
149
150
|
.render(() => Box({ flexDirection: 'row', flexWrap: 'wrap', gap: 1, width: 60 }, ...Array.from({ length: 6 }, (_, i) => Box({
|
|
150
151
|
width: 18,
|
|
151
152
|
borderStyle: 'round',
|
|
152
|
-
borderColor: ['
|
|
153
|
+
borderColor: ['primary', 'success', 'secondary', 'warning', 'info', 'error'][i],
|
|
153
154
|
padding: 1,
|
|
154
155
|
flexDirection: 'column',
|
|
155
|
-
}, Text({ bold: true }, `Card ${i + 1}`), Text({ color: '
|
|
156
|
+
}, Text({ bold: true }, `Card ${i + 1}`), Text({ color: 'muted', dim: true }, 'Card content...'))))),
|
|
156
157
|
];
|
|
157
158
|
// ============================================================================
|
|
158
159
|
// Complex Charts
|
|
@@ -173,25 +174,25 @@ export const barChartStories = [
|
|
|
173
174
|
{ label: 'Go', value: 38 },
|
|
174
175
|
];
|
|
175
176
|
const max = Math.max(...data.map((d) => d.value));
|
|
176
|
-
return Box({ flexDirection: 'column', gap: 1 }, ...data.map((item) => Box({ flexDirection: 'row', gap: 1 }, Box({ width: 12 }, Text({ color: '
|
|
177
|
+
return Box({ flexDirection: 'column', gap: 1 }, ...data.map((item) => Box({ flexDirection: 'row', gap: 1 }, Box({ width: 12 }, Text({ color: 'muted' }, item.label)), Text({ color: 'primary' }, textBar(item.value, max, props.width)), Text({ color: 'muted', dim: true }, ` ${item.value}%`))));
|
|
177
178
|
}),
|
|
178
179
|
story('BarChart - Colored')
|
|
179
180
|
.category('Organisms')
|
|
180
181
|
.description('Bar chart with colors')
|
|
181
182
|
.render(() => {
|
|
182
183
|
const data = [
|
|
183
|
-
{ label: 'Success', value: 85, color: '
|
|
184
|
-
{ label: 'Warning', value: 45, color: '
|
|
185
|
-
{ label: 'Error', value: 12, color: '
|
|
186
|
-
{ label: 'Info', value: 30, color: '
|
|
184
|
+
{ label: 'Success', value: 85, color: 'success' },
|
|
185
|
+
{ label: 'Warning', value: 45, color: 'warning' },
|
|
186
|
+
{ label: 'Error', value: 12, color: 'error' },
|
|
187
|
+
{ label: 'Info', value: 30, color: 'info' },
|
|
187
188
|
];
|
|
188
189
|
const max = 100;
|
|
189
|
-
return Box({ flexDirection: 'column', gap: 1 }, ...data.map((item) => Box({ flexDirection: 'row', gap: 1 }, Box({ width: 10 }, Text({ color: '
|
|
190
|
+
return Box({ flexDirection: 'column', gap: 1 }, ...data.map((item) => Box({ flexDirection: 'row', gap: 1 }, Box({ width: 10 }, Text({ color: 'muted' }, item.label)), Text({ color: item.color }, textBar(item.value, max, 25)), Text({ color: item.color }, ` ${item.value}%`))));
|
|
190
191
|
}),
|
|
191
192
|
story('BarChart - Stacked')
|
|
192
193
|
.category('Organisms')
|
|
193
194
|
.description('Stacked bar chart representation')
|
|
194
|
-
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 1 }, Box({ width: 6 }, Text({ color: '
|
|
195
|
+
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 1 }, Box({ width: 6 }, Text({ color: 'muted' }, 'Q1:')), Text({ backgroundColor: 'info', color: 'foreground' }, '████████'), Text({ backgroundColor: 'success', color: 'foreground' }, '████'), Text({ backgroundColor: 'warning', color: 'background' }, '██')), Box({ flexDirection: 'row', gap: 1 }, Box({ width: 6 }, Text({ color: 'muted' }, 'Q2:')), Text({ backgroundColor: 'info', color: 'foreground' }, '██████████'), Text({ backgroundColor: 'success', color: 'foreground' }, '██████'), Text({ backgroundColor: 'warning', color: 'background' }, '███')), Box({ flexDirection: 'row', gap: 1 }, Box({ width: 6 }, Text({ color: 'muted' }, 'Q3:')), Text({ backgroundColor: 'info', color: 'foreground' }, '████████████'), Text({ backgroundColor: 'success', color: 'foreground' }, '████████'), Text({ backgroundColor: 'warning', color: 'background' }, '████')), Box({ marginTop: 1, flexDirection: 'row', gap: 2 }, Box({}, Text({ color: 'info' }, '■'), Text({ color: 'muted' }, ' Sales')), Box({}, Text({ color: 'success' }, '■'), Text({ color: 'muted' }, ' Marketing')), Box({}, Text({ color: 'warning' }, '■'), Text({ color: 'muted' }, ' Support'))))),
|
|
195
196
|
];
|
|
196
197
|
export const heatmapStories = [
|
|
197
198
|
story('Heatmap - Basic')
|
|
@@ -206,28 +207,28 @@ export const heatmapStories = [
|
|
|
206
207
|
];
|
|
207
208
|
const getColor = (value) => {
|
|
208
209
|
if (value > 9)
|
|
209
|
-
return '
|
|
210
|
+
return 'error';
|
|
210
211
|
if (value > 6)
|
|
211
|
-
return '
|
|
212
|
+
return 'warning';
|
|
212
213
|
if (value > 3)
|
|
213
|
-
return '
|
|
214
|
-
return '
|
|
214
|
+
return 'success';
|
|
215
|
+
return 'primary';
|
|
215
216
|
};
|
|
216
|
-
return Box({ flexDirection: 'column' }, ...data.map((row) => Box({ flexDirection: 'row' }, ...row.map((value) => Text({ backgroundColor: getColor(value), color: '
|
|
217
|
+
return Box({ flexDirection: 'column' }, ...data.map((row) => Box({ flexDirection: 'row' }, ...row.map((value) => Text({ backgroundColor: getColor(value), color: 'foreground' }, ` ${value.toString().padStart(2)} `)))));
|
|
217
218
|
}),
|
|
218
219
|
story('Heatmap - Activity Grid')
|
|
219
220
|
.category('Organisms')
|
|
220
221
|
.description('GitHub-style activity heatmap')
|
|
221
222
|
.render(() => {
|
|
222
223
|
const blocks = ['░', '▒', '▓', '█'];
|
|
223
|
-
const colors = ['
|
|
224
|
+
const colors = ['muted', 'success', 'success', 'success'];
|
|
224
225
|
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
225
226
|
const weeks = 5;
|
|
226
227
|
const getRandomIntensity = () => Math.floor(Math.random() * 4);
|
|
227
|
-
return Box({ flexDirection: 'column' }, Box({ marginBottom: 1 }, Text({ color: '
|
|
228
|
+
return Box({ flexDirection: 'column' }, Box({ marginBottom: 1 }, Text({ color: 'muted' }, 'Activity (last 5 weeks)')), ...days.map((day) => Box({ flexDirection: 'row' }, Box({ width: 4 }, Text({ color: 'muted' }, day)), ...Array.from({ length: weeks }, () => {
|
|
228
229
|
const intensity = getRandomIntensity();
|
|
229
230
|
return Text({ color: colors[intensity] }, blocks[intensity] + ' ');
|
|
230
|
-
}))), Box({ marginTop: 1, flexDirection: 'row', gap: 1 }, Text({ color: '
|
|
231
|
+
}))), Box({ marginTop: 1, flexDirection: 'row', gap: 1 }, Text({ color: 'muted', dim: true }, 'Less'), Text({ color: 'muted' }, '░'), Text({ color: 'success' }, '▒'), Text({ color: 'success' }, '▓'), Text({ color: 'success' }, '█'), Text({ color: 'muted', dim: true }, 'More')));
|
|
231
232
|
}),
|
|
232
233
|
];
|
|
233
234
|
// ============================================================================
|
|
@@ -239,39 +240,39 @@ export const dashboardStories = [
|
|
|
239
240
|
.description('Dashboard stats cards layout')
|
|
240
241
|
.render(() => Box({ flexDirection: 'row', gap: 2 }, Box({
|
|
241
242
|
borderStyle: 'round',
|
|
242
|
-
borderColor: '
|
|
243
|
+
borderColor: 'primary',
|
|
243
244
|
padding: 1,
|
|
244
245
|
width: 18,
|
|
245
|
-
}, Box({ flexDirection: 'column' }, Text({ color: '
|
|
246
|
+
}, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'Total Users'), Text({ color: 'primary', bold: true }, '12,543'), Text({ color: 'success', dim: true }, '↑ 12.5%'))), Box({
|
|
246
247
|
borderStyle: 'round',
|
|
247
|
-
borderColor: '
|
|
248
|
+
borderColor: 'success',
|
|
248
249
|
padding: 1,
|
|
249
250
|
width: 18,
|
|
250
|
-
}, Box({ flexDirection: 'column' }, Text({ color: '
|
|
251
|
+
}, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'Revenue'), Text({ color: 'success', bold: true }, '$45,231'), Text({ color: 'success', dim: true }, '↑ 8.2%'))), Box({
|
|
251
252
|
borderStyle: 'round',
|
|
252
|
-
borderColor: '
|
|
253
|
+
borderColor: 'warning',
|
|
253
254
|
padding: 1,
|
|
254
255
|
width: 18,
|
|
255
|
-
}, Box({ flexDirection: 'column' }, Text({ color: '
|
|
256
|
+
}, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'Orders'), Text({ color: 'warning', bold: true }, '892'), Text({ color: 'error', dim: true }, '↓ 3.1%'))))),
|
|
256
257
|
story('Pattern - Table')
|
|
257
258
|
.category('Organisms')
|
|
258
259
|
.description('Data table pattern')
|
|
259
260
|
.render(() => Box({
|
|
260
261
|
flexDirection: 'column',
|
|
261
262
|
borderStyle: 'single',
|
|
262
|
-
borderColor: '
|
|
263
|
+
borderColor: 'border',
|
|
263
264
|
width: 60,
|
|
264
|
-
}, Box({ flexDirection: 'row', backgroundColor: '
|
|
265
|
+
}, Box({ flexDirection: 'row', backgroundColor: 'info', paddingX: 1 }, Box({ width: 20 }, Text({ color: 'foreground', bold: true }, 'Name')), Box({ width: 15 }, Text({ color: 'foreground', bold: true }, 'Status')), Box({ width: 10 }, Text({ color: 'foreground', bold: true }, 'Role')), Text({ color: 'foreground', bold: true }, 'Actions')), Box({ flexDirection: 'row', paddingX: 1 }, Box({ width: 20 }, Text({}, 'Alice Johnson')), Box({ width: 15 }, Text({ color: 'success' }, '● Active')), Box({ width: 10 }, Text({}, 'Admin')), Text({ color: 'primary' }, 'Edit | Del')), Box({ flexDirection: 'row', paddingX: 1, backgroundColor: 'muted' }, Box({ width: 20 }, Text({}, 'Bob Smith')), Box({ width: 15 }, Text({ color: 'success' }, '● Active')), Box({ width: 10 }, Text({}, 'User')), Text({ color: 'primary' }, 'Edit | Del')), Box({ flexDirection: 'row', paddingX: 1 }, Box({ width: 20 }, Text({}, 'Carol White')), Box({ width: 15 }, Text({ color: 'warning' }, '○ Pending')), Box({ width: 10 }, Text({}, 'User')), Text({ color: 'primary' }, 'Edit | Del')), Box({ flexDirection: 'row', paddingX: 1, backgroundColor: 'muted' }, Box({ width: 20 }, Text({}, 'David Brown')), Box({ width: 15 }, Text({ color: 'error' }, '○ Inactive')), Box({ width: 10 }, Text({}, 'User')), Text({ color: 'primary' }, 'Edit | Del')))),
|
|
265
266
|
story('Pattern - Activity Feed')
|
|
266
267
|
.category('Organisms')
|
|
267
268
|
.description('Activity feed pattern')
|
|
268
269
|
.render(() => Box({
|
|
269
270
|
flexDirection: 'column',
|
|
270
271
|
borderStyle: 'single',
|
|
271
|
-
borderColor: '
|
|
272
|
+
borderColor: 'border',
|
|
272
273
|
padding: 1,
|
|
273
274
|
width: 45,
|
|
274
|
-
}, Text({ color: '
|
|
275
|
+
}, Text({ color: 'foreground', bold: true }, 'Recent Activity'), Box({ marginTop: 1 }), Box({ flexDirection: 'row', gap: 1, marginBottom: 1 }, Text({ color: 'primary' }, '●'), Box({ flexDirection: 'column' }, Text({}, 'Alice uploaded a file'), Text({ color: 'muted', dim: true }, '2 minutes ago'))), Box({ flexDirection: 'row', gap: 1, marginBottom: 1 }, Text({ color: 'success' }, '●'), Box({ flexDirection: 'column' }, Text({}, 'Bob completed a task'), Text({ color: 'muted', dim: true }, '15 minutes ago'))), Box({ flexDirection: 'row', gap: 1, marginBottom: 1 }, Text({ color: 'warning' }, '●'), Box({ flexDirection: 'column' }, Text({}, 'Carol added a comment'), Text({ color: 'muted', dim: true }, '1 hour ago'))), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'secondary' }, '●'), Box({ flexDirection: 'column' }, Text({}, 'David joined the team'), Text({ color: 'muted', dim: true }, '3 hours ago'))))),
|
|
275
276
|
];
|
|
276
277
|
export const fileBrowserStories = [
|
|
277
278
|
story('Pattern - File Tree')
|
|
@@ -280,28 +281,28 @@ export const fileBrowserStories = [
|
|
|
280
281
|
.render(() => Box({
|
|
281
282
|
flexDirection: 'column',
|
|
282
283
|
borderStyle: 'single',
|
|
283
|
-
borderColor: '
|
|
284
|
+
borderColor: 'border',
|
|
284
285
|
padding: 1,
|
|
285
286
|
width: 40,
|
|
286
|
-
}, Text({ color: '
|
|
287
|
+
}, Text({ color: 'foreground', bold: true }, 'Files'), Box({ marginTop: 1 }), Text({ color: 'warning' }, '▼ 📁 src'), Text({ color: 'muted' }, ' ▼ 📁 components'), Text({ color: 'primary' }, ' ▶ 📁 ui'), Text({}, ' 📄 button.ts'), Text({ inverse: true }, ' 📄 input.ts'), Text({}, ' 📄 modal.ts'), Text({ color: 'primary' }, ' ▶ 📁 layout'), Text({ color: 'muted' }, ' ▼ 📁 utils'), Text({}, ' 📄 helpers.ts'), Text({ color: 'primary' }, '▶ 📁 tests'), Text({}, '📄 package.json'), Text({}, '📄 README.md'))),
|
|
287
288
|
story('Pattern - File Preview')
|
|
288
289
|
.category('Organisms')
|
|
289
290
|
.description('File browser with preview pane')
|
|
290
291
|
.render(() => Box({ flexDirection: 'row', width: 70, height: 15 }, Box({
|
|
291
292
|
width: 25,
|
|
292
293
|
borderStyle: 'single',
|
|
293
|
-
borderColor: '
|
|
294
|
+
borderColor: 'border',
|
|
294
295
|
flexDirection: 'column',
|
|
295
|
-
}, Box({ paddingX: 1, backgroundColor: '
|
|
296
|
+
}, Box({ paddingX: 1, backgroundColor: 'info' }, Text({ color: 'foreground', bold: true }, 'Files')), Box({ padding: 1, flexDirection: 'column' }, Text({ color: 'warning' }, '📁 src'), Text({ color: 'warning' }, '📁 tests'), Text({ inverse: true }, '📄 package.json'), Text({}, '📄 README.md'), Text({}, '📄 tsconfig.json'))), Box({
|
|
296
297
|
flexGrow: 1,
|
|
297
298
|
borderStyle: 'single',
|
|
298
|
-
borderColor: '
|
|
299
|
+
borderColor: 'primary',
|
|
299
300
|
flexDirection: 'column',
|
|
300
|
-
}, Box({ paddingX: 1, backgroundColor: '
|
|
301
|
+
}, Box({ paddingX: 1, backgroundColor: 'primary' }, Text({ color: 'primaryForeground', bold: true }, 'package.json')), Box({ padding: 1, flexDirection: 'column' }, Text({ color: 'muted' }, '{'), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, ' "name": '), Text({ color: 'success' }, '"tuiuiu"')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, ' "version": '), Text({ color: 'success' }, '"0.1.0"')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, ' "type": '), Text({ color: 'success' }, '"module"')), Text({ color: 'muted' }, ' ...'))))),
|
|
301
302
|
story('Pattern - Breadcrumbs')
|
|
302
303
|
.category('Organisms')
|
|
303
304
|
.description('Breadcrumb navigation pattern')
|
|
304
|
-
.render(() => Box({ flexDirection: 'column', gap: 2 }, Box({ flexDirection: 'row' }, Text({ color: '
|
|
305
|
+
.render(() => Box({ flexDirection: 'column', gap: 2 }, Box({ flexDirection: 'row' }, Text({ color: 'primary' }, 'Home'), Text({ color: 'muted' }, ' > '), Text({ color: 'primary' }, 'Documents'), Text({ color: 'muted' }, ' > '), Text({ color: 'primary' }, 'Projects'), Text({ color: 'muted' }, ' > '), Text({ color: 'foreground', bold: true }, 'Report.pdf')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '🏠'), Text({ color: 'muted' }, ' / '), Text({ color: 'primary' }, '📁 src'), Text({ color: 'muted' }, ' / '), Text({ color: 'primary' }, '📁 components'), Text({ color: 'muted' }, ' / '), Text({ color: 'foreground', bold: true }, '📄 button.ts')))),
|
|
305
306
|
];
|
|
306
307
|
export const chatStories = [
|
|
307
308
|
story('Pattern - Chat Messages')
|
|
@@ -310,40 +311,40 @@ export const chatStories = [
|
|
|
310
311
|
.render(() => Box({
|
|
311
312
|
flexDirection: 'column',
|
|
312
313
|
borderStyle: 'single',
|
|
313
|
-
borderColor: '
|
|
314
|
+
borderColor: 'border',
|
|
314
315
|
padding: 1,
|
|
315
316
|
width: 50,
|
|
316
|
-
}, Box({ flexDirection: 'column', marginBottom: 1 }, Text({ color: '
|
|
317
|
+
}, Box({ flexDirection: 'column', marginBottom: 1 }, Text({ color: 'primary', bold: true }, 'Alice'), Box({
|
|
317
318
|
borderStyle: 'round',
|
|
318
|
-
borderColor: '
|
|
319
|
+
borderColor: 'border',
|
|
319
320
|
paddingX: 1,
|
|
320
321
|
marginLeft: 2,
|
|
321
|
-
}, Text({}, 'Hey, how are you?')), Text({ color: '
|
|
322
|
+
}, Text({}, 'Hey, how are you?')), Text({ color: 'muted', dim: true }, ' 10:30 AM')), Box({ flexDirection: 'column', alignItems: 'flex-end', marginBottom: 1 }, Text({ color: 'success', bold: true }, 'You'), Box({
|
|
322
323
|
borderStyle: 'round',
|
|
323
|
-
borderColor: '
|
|
324
|
+
borderColor: 'success',
|
|
324
325
|
paddingX: 1,
|
|
325
326
|
marginRight: 2,
|
|
326
|
-
}, Text({}, "I'm good, thanks! Working on the TUI.")), Text({ color: '
|
|
327
|
+
}, Text({}, "I'm good, thanks! Working on the TUI.")), Text({ color: 'muted', dim: true }, '10:32 AM ')), Box({ flexDirection: 'column' }, Text({ color: 'primary', bold: true }, 'Alice'), Box({
|
|
327
328
|
borderStyle: 'round',
|
|
328
|
-
borderColor: '
|
|
329
|
+
borderColor: 'border',
|
|
329
330
|
paddingX: 1,
|
|
330
331
|
marginLeft: 2,
|
|
331
|
-
}, Text({}, "That sounds interesting! Can't wait to see it.")), Text({ color: '
|
|
332
|
+
}, Text({}, "That sounds interesting! Can't wait to see it.")), Text({ color: 'muted', dim: true }, ' 10:33 AM')))),
|
|
332
333
|
story('Pattern - Chat Input')
|
|
333
334
|
.category('Organisms')
|
|
334
335
|
.description('Chat input with actions')
|
|
335
336
|
.render(() => Box({
|
|
336
337
|
flexDirection: 'row',
|
|
337
338
|
borderStyle: 'single',
|
|
338
|
-
borderColor: '
|
|
339
|
+
borderColor: 'primary',
|
|
339
340
|
padding: 1,
|
|
340
341
|
width: 50,
|
|
341
342
|
gap: 1,
|
|
342
|
-
}, Text({ color: '
|
|
343
|
+
}, Text({ color: 'muted' }, '📎'), Box({ flexGrow: 1 }, Text({ color: 'muted', dim: true }, 'Type a message...')), Text({ color: 'muted' }, '😊'), Text({ color: 'primary' }, '➤'))),
|
|
343
344
|
story('Pattern - Typing Indicator')
|
|
344
345
|
.category('Organisms')
|
|
345
346
|
.description('Typing indicator pattern')
|
|
346
|
-
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 1 }, Text({ color: '
|
|
347
|
+
.render(() => Box({ flexDirection: 'column', gap: 1 }, Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'muted', dim: true }, 'Alice is typing'), Text({ color: 'muted' }, '...')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'primary' }, '●'), Text({ color: 'primary', dim: true }, '●'), Text({ color: 'muted', dim: true }, '●')))),
|
|
347
348
|
];
|
|
348
349
|
export const commandPaletteStories = [
|
|
349
350
|
story('Pattern - Command Palette')
|
|
@@ -352,23 +353,23 @@ export const commandPaletteStories = [
|
|
|
352
353
|
.render(() => Box({
|
|
353
354
|
flexDirection: 'column',
|
|
354
355
|
borderStyle: 'round',
|
|
355
|
-
borderColor: '
|
|
356
|
+
borderColor: 'primary',
|
|
356
357
|
width: 50,
|
|
357
358
|
}, Box({
|
|
358
359
|
paddingX: 1,
|
|
359
360
|
paddingY: 1,
|
|
360
361
|
borderStyle: 'single',
|
|
361
|
-
borderColor: '
|
|
362
|
-
}, Text({ color: '
|
|
362
|
+
borderColor: 'border',
|
|
363
|
+
}, Text({ color: 'muted' }, '> '), Text({ color: 'foreground' }, 'open file'), Text({ color: 'muted', dim: true }, '...')), Box({ flexDirection: 'column', padding: 1 }, Box({ backgroundColor: 'info', paddingX: 1, flexDirection: 'row' }, Text({ color: 'foreground' }, '📄 Open File'), Spacer({}), Text({ color: 'muted' }, 'Ctrl+O')), Box({ paddingX: 1, flexDirection: 'row' }, Text({}, '📁 Open Folder'), Spacer({}), Text({ color: 'muted' }, 'Ctrl+K O')), Box({ paddingX: 1, flexDirection: 'row' }, Text({}, '📝 Open Recent'), Spacer({}), Text({ color: 'muted' }, 'Ctrl+R')), Box({ paddingX: 1, flexDirection: 'row' }, Text({}, '🔍 Open in Explorer'), Spacer({}), Text({ color: 'muted' }, 'Ctrl+Shift+E'))), Box({ paddingX: 1, borderStyle: 'single', borderColor: 'border' }, Text({ color: 'muted', dim: true }, '↑↓ Navigate '), Text({ color: 'muted', dim: true }, '↵ Select '), Text({ color: 'muted', dim: true }, 'Esc Close')))),
|
|
363
364
|
story('Pattern - Quick Actions')
|
|
364
365
|
.category('Organisms')
|
|
365
366
|
.description('Quick action menu pattern')
|
|
366
367
|
.render(() => Box({
|
|
367
368
|
flexDirection: 'column',
|
|
368
369
|
borderStyle: 'single',
|
|
369
|
-
borderColor: '
|
|
370
|
+
borderColor: 'border',
|
|
370
371
|
width: 35,
|
|
371
|
-
}, Box({ paddingX: 1, backgroundColor: '
|
|
372
|
+
}, Box({ paddingX: 1, backgroundColor: 'info' }, Text({ color: 'foreground', bold: true }, 'Quick Actions')), Box({ flexDirection: 'column', padding: 1 }, Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '[N] '), Text({}, 'New File')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '[S] '), Text({}, 'Save')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '[F] '), Text({}, 'Find')), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '[R] '), Text({}, 'Replace')), Divider({}), Box({ flexDirection: 'row' }, Text({ color: 'primary' }, '[Q] '), Text({ color: 'muted' }, 'Quit'))))),
|
|
372
373
|
];
|
|
373
374
|
export const navigationStories = [
|
|
374
375
|
story('Pattern - Sidebar Nav')
|
|
@@ -377,23 +378,23 @@ export const navigationStories = [
|
|
|
377
378
|
.render(() => Box({
|
|
378
379
|
flexDirection: 'column',
|
|
379
380
|
borderStyle: 'single',
|
|
380
|
-
borderColor: '
|
|
381
|
+
borderColor: 'border',
|
|
381
382
|
width: 25,
|
|
382
383
|
height: 15,
|
|
383
|
-
}, Box({ paddingX: 1, backgroundColor: '
|
|
384
|
+
}, Box({ paddingX: 1, backgroundColor: 'info' }, Text({ color: 'foreground', bold: true }, '🚀 AppName')), Box({ flexDirection: 'column', padding: 1, flexGrow: 1 }, Box({ backgroundColor: 'primary', paddingX: 1 }, Text({ color: 'primaryForeground' }, '🏠 Dashboard')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '📊 Analytics')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '👥 Users')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '📁 Files')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '⚙️ Settings')), Spacer({})), Box({ paddingX: 1, borderStyle: 'single', borderColor: 'border' }, Text({ color: 'muted', dim: true }, '? Help')))),
|
|
384
385
|
story('Pattern - Tab Bar')
|
|
385
386
|
.category('Organisms')
|
|
386
387
|
.description('Tab bar navigation pattern')
|
|
387
|
-
.render(() => Box({ flexDirection: 'column', width: 50 }, Box({ flexDirection: 'row', borderStyle: 'single', borderColor: '
|
|
388
|
+
.render(() => Box({ flexDirection: 'column', width: 50 }, Box({ flexDirection: 'row', borderStyle: 'single', borderColor: 'border' }, Box({ backgroundColor: 'info', paddingX: 2 }, Text({ color: 'foreground', bold: true }, 'Overview')), Box({ paddingX: 2 }, Text({ color: 'muted' }, 'Details')), Box({ paddingX: 2 }, Text({ color: 'muted' }, 'Settings')), Box({ paddingX: 2 }, Text({ color: 'muted' }, 'Logs'))), Box({
|
|
388
389
|
borderStyle: 'single',
|
|
389
|
-
borderColor: '
|
|
390
|
+
borderColor: 'info',
|
|
390
391
|
padding: 1,
|
|
391
392
|
height: 8,
|
|
392
393
|
}, Text({}, 'Overview content goes here...')))),
|
|
393
394
|
story('Pattern - Pagination')
|
|
394
395
|
.category('Organisms')
|
|
395
396
|
.description('Pagination controls pattern')
|
|
396
|
-
.render(() => Box({ flexDirection: 'row', gap: 1, justifyContent: 'center', width: 50 }, Text({ color: '
|
|
397
|
+
.render(() => Box({ flexDirection: 'row', gap: 1, justifyContent: 'center', width: 50 }, Text({ color: 'muted' }, '« First'), Text({ color: 'primary' }, '‹ Prev'), Text({ color: 'muted' }, '1'), Text({ color: 'foreground', inverse: true }, ' 2 '), Text({ color: 'muted' }, '3'), Text({ color: 'muted' }, '4'), Text({ color: 'muted' }, '...'), Text({ color: 'muted' }, '10'), Text({ color: 'primary' }, 'Next ›'), Text({ color: 'muted' }, 'Last »'))),
|
|
397
398
|
];
|
|
398
399
|
/**
|
|
399
400
|
* Overlay stories - Modal, Popup, Tooltip, Toast
|
|
@@ -410,7 +411,7 @@ const overlayStories = [
|
|
|
410
411
|
// Backdrop simulation
|
|
411
412
|
Box({
|
|
412
413
|
flexGrow: 1,
|
|
413
|
-
backgroundColor: '
|
|
414
|
+
backgroundColor: 'muted',
|
|
414
415
|
justifyContent: 'center',
|
|
415
416
|
alignItems: 'center',
|
|
416
417
|
},
|
|
@@ -419,15 +420,15 @@ const overlayStories = [
|
|
|
419
420
|
flexDirection: 'column',
|
|
420
421
|
width: 40,
|
|
421
422
|
borderStyle: 'double',
|
|
422
|
-
borderColor: '
|
|
423
|
-
backgroundColor: '
|
|
423
|
+
borderColor: 'primary',
|
|
424
|
+
backgroundColor: 'background',
|
|
424
425
|
},
|
|
425
426
|
// Header
|
|
426
|
-
Box({ paddingX: 1, justifyContent: 'space-between', borderStyle: 'single', borderColor: '
|
|
427
|
+
Box({ paddingX: 1, justifyContent: 'space-between', borderStyle: 'single', borderColor: 'border' }, Text({ color: 'primary', bold: true }, props.title), props.showClose && Text({ color: 'muted' }, '[×]')),
|
|
427
428
|
// Body
|
|
428
429
|
Box({ padding: 1, flexGrow: 1 }, Text({}, 'Are you sure you want to proceed with this action?')),
|
|
429
430
|
// Footer
|
|
430
|
-
Box({ paddingX: 1, paddingY: 1, gap: 2, justifyContent: 'flex-end', borderStyle: 'single', borderColor: '
|
|
431
|
+
Box({ paddingX: 1, paddingY: 1, gap: 2, justifyContent: 'flex-end', borderStyle: 'single', borderColor: 'border' }, Text({ color: 'muted', inverse: true }, ' Cancel '), Text({ color: 'primary', inverse: true }, ' Confirm ')))))),
|
|
431
432
|
story('Modal - Alert')
|
|
432
433
|
.category('Organisms')
|
|
433
434
|
.description('Alert modal with icon')
|
|
@@ -437,9 +438,9 @@ const overlayStories = [
|
|
|
437
438
|
.render((props) => {
|
|
438
439
|
const alertType = props.type || 'warning';
|
|
439
440
|
const icons = { info: 'ℹ', warning: '⚠', error: '✗', success: '✓' };
|
|
440
|
-
const colors = { info: '
|
|
441
|
+
const colors = { info: 'info', warning: 'warning', error: 'error', success: 'success' };
|
|
441
442
|
const icon = icons[alertType] || '⚠';
|
|
442
|
-
const color = colors[alertType] || '
|
|
443
|
+
const color = colors[alertType] || 'warning';
|
|
443
444
|
return Box({
|
|
444
445
|
flexDirection: 'column',
|
|
445
446
|
width: 45,
|
|
@@ -456,11 +457,11 @@ const overlayStories = [
|
|
|
456
457
|
.render((props) => {
|
|
457
458
|
const renderTooltip = () => Box({
|
|
458
459
|
borderStyle: 'single',
|
|
459
|
-
borderColor: '
|
|
460
|
-
backgroundColor: '
|
|
460
|
+
borderColor: 'warning',
|
|
461
|
+
backgroundColor: 'warning',
|
|
461
462
|
paddingX: 1,
|
|
462
|
-
}, Text({ color: '
|
|
463
|
-
return Box({ flexDirection: 'column', alignItems: 'center', gap: 1, padding: 2 }, props.position === 'top' && renderTooltip(), Box({ flexDirection: 'row', gap: 1 }, props.position === 'left' && renderTooltip(), Box({ borderStyle: 'single', borderColor: '
|
|
463
|
+
}, Text({ color: 'background' }, 'Helpful tooltip text'));
|
|
464
|
+
return Box({ flexDirection: 'column', alignItems: 'center', gap: 1, padding: 2 }, props.position === 'top' && renderTooltip(), Box({ flexDirection: 'row', gap: 1 }, props.position === 'left' && renderTooltip(), Box({ borderStyle: 'single', borderColor: 'primary', paddingX: 2, paddingY: 1 }, Text({ color: 'primary' }, 'Hover me')), props.position === 'right' && renderTooltip()), props.position === 'bottom' && renderTooltip());
|
|
464
465
|
}),
|
|
465
466
|
story('Toast - Notification')
|
|
466
467
|
.category('Organisms')
|
|
@@ -470,7 +471,7 @@ const overlayStories = [
|
|
|
470
471
|
})
|
|
471
472
|
.render((props) => {
|
|
472
473
|
const icons = { info: 'ℹ', success: '✓', warning: '⚠', error: '✗' };
|
|
473
|
-
const colors = { info: '
|
|
474
|
+
const colors = { info: 'info', success: 'success', warning: 'warning', error: 'error' };
|
|
474
475
|
const messages = {
|
|
475
476
|
info: 'New update available',
|
|
476
477
|
success: 'Changes saved successfully!',
|
|
@@ -485,36 +486,36 @@ const overlayStories = [
|
|
|
485
486
|
borderColor: color,
|
|
486
487
|
paddingX: 1,
|
|
487
488
|
width: 35,
|
|
488
|
-
}, Text({ color: color }, `${icon} `), Text({}, message), Text({ color: '
|
|
489
|
+
}, Text({ color: color }, `${icon} `), Text({}, message), Text({ color: 'muted', dim: true }, ' ×')));
|
|
489
490
|
}),
|
|
490
491
|
story('Toast - Stack')
|
|
491
492
|
.category('Organisms')
|
|
492
493
|
.description('Multiple stacked toasts')
|
|
493
|
-
.render(() => Box({ flexDirection: 'column', alignItems: 'flex-end', gap: 1, width: 50 }, Box({ borderStyle: 'round', borderColor: '
|
|
494
|
+
.render(() => Box({ flexDirection: 'column', alignItems: 'flex-end', gap: 1, width: 50 }, Box({ borderStyle: 'round', borderColor: 'success', paddingX: 1, width: 35 }, Text({ color: 'success' }, '✓ '), Text({}, 'File uploaded'), Text({ color: 'muted' }, ' ×')), Box({ borderStyle: 'round', borderColor: 'info', paddingX: 1, width: 35 }, Text({ color: 'info' }, 'ℹ '), Text({}, '2 new messages'), Text({ color: 'muted' }, ' ×')), Box({ borderStyle: 'round', borderColor: 'warning', paddingX: 1, width: 35 }, Text({ color: 'warning' }, '⚠ '), Text({}, 'Low disk space'), Text({ color: 'muted' }, ' ×')))),
|
|
494
495
|
story('Popup - Dropdown Menu')
|
|
495
496
|
.category('Organisms')
|
|
496
497
|
.description('Dropdown popup menu')
|
|
497
498
|
.render(() => Box({ flexDirection: 'column', width: 40 },
|
|
498
499
|
// Trigger
|
|
499
|
-
Box({ borderStyle: 'single', borderColor: '
|
|
500
|
+
Box({ borderStyle: 'single', borderColor: 'primary', paddingX: 1 }, Text({ color: 'primary' }, '⚙ Settings ▼')),
|
|
500
501
|
// Dropdown
|
|
501
502
|
Box({
|
|
502
503
|
flexDirection: 'column',
|
|
503
504
|
borderStyle: 'single',
|
|
504
|
-
borderColor: '
|
|
505
|
+
borderColor: 'border',
|
|
505
506
|
marginLeft: 2,
|
|
506
507
|
width: 25,
|
|
507
|
-
}, Box({ paddingX: 1, backgroundColor: '
|
|
508
|
+
}, Box({ paddingX: 1, backgroundColor: 'info' }, Text({ color: 'foreground' }, '👤 Profile')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '🔔 Notifications')), Box({ paddingX: 1 }, Text({ color: 'muted' }, '🎨 Appearance')), Divider({ color: 'border' }), Box({ paddingX: 1 }, Text({ color: 'error' }, '🚪 Logout'))))),
|
|
508
509
|
story('Popup - Context Menu')
|
|
509
510
|
.category('Organisms')
|
|
510
511
|
.description('Right-click context menu')
|
|
511
|
-
.render(() => Box({ flexDirection: 'column', width: 50, height: 12 }, Text({ color: '
|
|
512
|
+
.render(() => Box({ flexDirection: 'column', width: 50, height: 12 }, Text({ color: 'muted', dim: true }, 'Right-click area simulation:'), Box({ flexDirection: 'row', marginTop: 1 }, Box({ width: 20, height: 8, borderStyle: 'single', borderColor: 'border' }, Text({ color: 'muted', dim: true }, 'Content...')), Box({
|
|
512
513
|
flexDirection: 'column',
|
|
513
514
|
borderStyle: 'single',
|
|
514
|
-
borderColor: '
|
|
515
|
+
borderColor: 'primary',
|
|
515
516
|
marginLeft: 2,
|
|
516
517
|
width: 20,
|
|
517
|
-
}, Box({ paddingX: 1 }, Text({}, '📋 Copy')), Box({ paddingX: 1 }, Text({}, '✂️ Cut')), Box({ paddingX: 1 }, Text({}, '📄 Paste')), Divider({ color: '
|
|
518
|
+
}, Box({ paddingX: 1 }, Text({}, '📋 Copy')), Box({ paddingX: 1 }, Text({}, '✂️ Cut')), Box({ paddingX: 1 }, Text({}, '📄 Paste')), Divider({ color: 'border' }), Box({ paddingX: 1 }, Text({}, '🗑️ Delete')), Box({ paddingX: 1 }, Text({}, 'ℹ️ Properties')))))),
|
|
518
519
|
];
|
|
519
520
|
/**
|
|
520
521
|
* Status bar stories
|
|
@@ -525,18 +526,18 @@ const statusBarStories = [
|
|
|
525
526
|
.description('Application status bar')
|
|
526
527
|
.render(() => Box({ flexDirection: 'column', width: 60 },
|
|
527
528
|
// Content area
|
|
528
|
-
Box({ height: 5, borderStyle: 'single', borderColor: '
|
|
529
|
+
Box({ height: 5, borderStyle: 'single', borderColor: 'border', padding: 1 }, Text({ color: 'muted' }, 'Main content area...')),
|
|
529
530
|
// Status bar
|
|
530
|
-
Box({ backgroundColor: '
|
|
531
|
+
Box({ backgroundColor: 'info', paddingX: 1, justifyContent: 'space-between' }, Box({ gap: 2 }, Text({ color: 'foreground' }, 'NORMAL'), Text({ color: 'foreground' }, 'main.ts'), Text({ color: 'foreground' }, 'TypeScript')), Box({ gap: 2 }, Text({ color: 'foreground' }, 'Ln 42, Col 15'), Text({ color: 'foreground' }, 'UTF-8'), Text({ color: 'foreground' }, 'LF'))))),
|
|
531
532
|
story('StatusBar - With Icons')
|
|
532
533
|
.category('Organisms')
|
|
533
534
|
.description('Status bar with status icons')
|
|
534
535
|
.render(() => Box({
|
|
535
|
-
backgroundColor: '
|
|
536
|
+
backgroundColor: 'muted',
|
|
536
537
|
paddingX: 1,
|
|
537
538
|
width: 60,
|
|
538
539
|
justifyContent: 'space-between',
|
|
539
|
-
}, Box({ gap: 2 }, Text({ color: '
|
|
540
|
+
}, Box({ gap: 2 }, Text({ color: 'success' }, '✓ Connected'), Text({ color: 'primary' }, '↻ Syncing...'), Text({ color: 'warning' }, '⚠ 2 warnings')), Box({ gap: 2 }, Text({ color: 'foreground' }, '🔋 85%'), Text({ color: 'foreground' }, '📶 Strong'), Text({ color: 'foreground' }, '14:32')))),
|
|
540
541
|
story('StatusBar - Progress')
|
|
541
542
|
.category('Organisms')
|
|
542
543
|
.description('Status bar with progress indicator')
|
|
@@ -548,12 +549,98 @@ const statusBarStories = [
|
|
|
548
549
|
const filled = Math.floor((props.progress / 100) * width);
|
|
549
550
|
const bar = '█'.repeat(filled) + '░'.repeat(width - filled);
|
|
550
551
|
return Box({
|
|
551
|
-
backgroundColor: '
|
|
552
|
+
backgroundColor: 'info',
|
|
552
553
|
paddingX: 1,
|
|
553
554
|
width: 60,
|
|
554
555
|
justifyContent: 'space-between',
|
|
555
|
-
}, Box({ gap: 1 }, Text({ color: '
|
|
556
|
+
}, Box({ gap: 1 }, Text({ color: 'foreground' }, 'Building...'), Text({ color: 'primary' }, `[${bar}]`), Text({ color: 'foreground' }, `${props.progress}%`)), Text({ color: 'warning' }, 'Press Ctrl+C to cancel'));
|
|
556
557
|
}),
|
|
558
|
+
story('StatusBar - Interactive')
|
|
559
|
+
.category('Organisms')
|
|
560
|
+
.description('StatusBar with selectable variant and custom color')
|
|
561
|
+
.controls({
|
|
562
|
+
variant: defaultControls.select('Variant', ['default', 'primary', 'info', 'success', 'warning', 'danger'], 'primary'),
|
|
563
|
+
customColor: defaultControls.color('Custom Color', ''),
|
|
564
|
+
leftText: defaultControls.text('Left Text', 'Ready'),
|
|
565
|
+
centerText: defaultControls.text('Center Text', 'file.ts'),
|
|
566
|
+
rightText: defaultControls.text('Right Text', 'Ln 42, Col 8'),
|
|
567
|
+
})
|
|
568
|
+
.render((props) => StatusBar({
|
|
569
|
+
variant: props.customColor ? undefined : props.variant,
|
|
570
|
+
color: props.customColor || undefined,
|
|
571
|
+
left: props.leftText, // String → auto-colored!
|
|
572
|
+
center: props.centerText || undefined,
|
|
573
|
+
right: props.rightText,
|
|
574
|
+
})),
|
|
575
|
+
story('StatusBar - All Variants')
|
|
576
|
+
.category('Organisms')
|
|
577
|
+
.description('StatusBar component showing all semantic variants')
|
|
578
|
+
.render(() => Box({ flexDirection: 'column', gap: 1, width: 60 }, Text({ bold: true, color: 'primary' }, 'StatusBar Variants:'), StatusBar({
|
|
579
|
+
variant: 'default',
|
|
580
|
+
left: '● Default', // Strings are auto-colored based on variant!
|
|
581
|
+
right: 'Ready',
|
|
582
|
+
}), StatusBar({
|
|
583
|
+
variant: 'primary',
|
|
584
|
+
left: '● Primary',
|
|
585
|
+
right: 'Active',
|
|
586
|
+
}), StatusBar({
|
|
587
|
+
variant: 'success',
|
|
588
|
+
left: '✓ Success',
|
|
589
|
+
right: 'Connected',
|
|
590
|
+
}), StatusBar({
|
|
591
|
+
variant: 'warning',
|
|
592
|
+
left: '⚠ Warning',
|
|
593
|
+
right: '2 issues',
|
|
594
|
+
}), StatusBar({
|
|
595
|
+
variant: 'danger',
|
|
596
|
+
left: '✗ Danger',
|
|
597
|
+
right: 'Error!',
|
|
598
|
+
}), StatusBar({
|
|
599
|
+
variant: 'info',
|
|
600
|
+
left: 'ℹ Info',
|
|
601
|
+
right: 'Building...',
|
|
602
|
+
}))),
|
|
603
|
+
story('Header - Interactive')
|
|
604
|
+
.category('Organisms')
|
|
605
|
+
.description('Header with selectable variant and custom color')
|
|
606
|
+
.controls({
|
|
607
|
+
variant: defaultControls.select('Variant', ['default', 'primary', 'secondary', 'success', 'warning', 'danger'], 'primary'),
|
|
608
|
+
customColor: defaultControls.color('Custom Color', ''),
|
|
609
|
+
title: defaultControls.text('Title', 'My Application'),
|
|
610
|
+
subtitle: defaultControls.text('Subtitle', 'v1.0.0'),
|
|
611
|
+
border: defaultControls.boolean('Show Border', false),
|
|
612
|
+
})
|
|
613
|
+
.render((props) => Header({
|
|
614
|
+
title: props.title,
|
|
615
|
+
subtitle: props.subtitle || undefined,
|
|
616
|
+
variant: props.customColor ? undefined : props.variant,
|
|
617
|
+
color: props.customColor || undefined,
|
|
618
|
+
border: props.border,
|
|
619
|
+
})),
|
|
620
|
+
story('Header - All Variants')
|
|
621
|
+
.category('Organisms')
|
|
622
|
+
.description('Header component showing all semantic variants')
|
|
623
|
+
.render(() => Box({ flexDirection: 'column', gap: 1, width: 60 }, Header({
|
|
624
|
+
title: 'Default Header',
|
|
625
|
+
subtitle: 'v1.0.0',
|
|
626
|
+
variant: 'default',
|
|
627
|
+
}), Header({
|
|
628
|
+
title: 'Primary Header',
|
|
629
|
+
subtitle: 'v1.0.0',
|
|
630
|
+
variant: 'primary',
|
|
631
|
+
}), Header({
|
|
632
|
+
title: 'Success Header',
|
|
633
|
+
subtitle: 'All systems go',
|
|
634
|
+
variant: 'success',
|
|
635
|
+
}), Header({
|
|
636
|
+
title: 'Warning Header',
|
|
637
|
+
subtitle: 'Attention required',
|
|
638
|
+
variant: 'warning',
|
|
639
|
+
}), Header({
|
|
640
|
+
title: 'Danger Header',
|
|
641
|
+
subtitle: 'Critical error',
|
|
642
|
+
variant: 'danger',
|
|
643
|
+
}))),
|
|
557
644
|
story('Window - Basic')
|
|
558
645
|
.category('Organisms')
|
|
559
646
|
.description('Window with title bar')
|
|
@@ -566,16 +653,16 @@ const statusBarStories = [
|
|
|
566
653
|
width: 45,
|
|
567
654
|
height: 12,
|
|
568
655
|
borderStyle: 'double',
|
|
569
|
-
borderColor: props.focused ? '
|
|
656
|
+
borderColor: props.focused ? 'primary' : 'border',
|
|
570
657
|
},
|
|
571
658
|
// Title bar
|
|
572
659
|
Box({
|
|
573
|
-
backgroundColor: props.focused ? '
|
|
660
|
+
backgroundColor: props.focused ? 'info' : 'muted',
|
|
574
661
|
paddingX: 1,
|
|
575
662
|
justifyContent: 'space-between',
|
|
576
|
-
}, Text({ color: '
|
|
663
|
+
}, Text({ color: 'foreground', bold: props.focused }, props.title), Box({ gap: 1 }, Text({ color: 'foreground' }, '─'), Text({ color: 'foreground' }, '□'), Text({ color: 'error' }, '×'))),
|
|
577
664
|
// Content
|
|
578
|
-
Box({ padding: 1, flexGrow: 1 }, Text({ color: '
|
|
665
|
+
Box({ padding: 1, flexGrow: 1 }, Text({ color: 'muted' }, 'Window content goes here...')))),
|
|
579
666
|
story('Window - With Menu')
|
|
580
667
|
.category('Organisms')
|
|
581
668
|
.description('Window with menu bar')
|
|
@@ -584,16 +671,16 @@ const statusBarStories = [
|
|
|
584
671
|
width: 50,
|
|
585
672
|
height: 15,
|
|
586
673
|
borderStyle: 'double',
|
|
587
|
-
borderColor: '
|
|
674
|
+
borderColor: 'primary',
|
|
588
675
|
},
|
|
589
676
|
// Title bar
|
|
590
|
-
Box({ backgroundColor: '
|
|
677
|
+
Box({ backgroundColor: 'info', paddingX: 1, justifyContent: 'space-between' }, Text({ color: 'foreground', bold: true }, 'Text Editor'), Box({ gap: 1 }, Text({ color: 'foreground' }, '─ □ ×'))),
|
|
591
678
|
// Menu bar
|
|
592
|
-
Box({ borderStyle: 'single', borderColor: '
|
|
679
|
+
Box({ borderStyle: 'single', borderColor: 'border', paddingX: 1, gap: 2 }, Text({ color: 'foreground', underline: true }, 'F'), Text({ color: 'muted' }, 'ile'), Text({ color: 'foreground', underline: true }, 'E'), Text({ color: 'muted' }, 'dit'), Text({ color: 'foreground', underline: true }, 'V'), Text({ color: 'muted' }, 'iew'), Text({ color: 'foreground', underline: true }, 'H'), Text({ color: 'muted' }, 'elp')),
|
|
593
680
|
// Content
|
|
594
|
-
Box({ padding: 1, flexGrow: 1 }, Text({ color: '
|
|
681
|
+
Box({ padding: 1, flexGrow: 1 }, Text({ color: 'muted' }, 'Document content...')),
|
|
595
682
|
// Status bar
|
|
596
|
-
Box({ backgroundColor: '
|
|
683
|
+
Box({ backgroundColor: 'muted', paddingX: 1, justifyContent: 'space-between' }, Text({ color: 'foreground' }, 'Ready'), Text({ color: 'foreground' }, 'Ln 1, Col 1')))),
|
|
597
684
|
story('Window - Dialog')
|
|
598
685
|
.category('Organisms')
|
|
599
686
|
.description('Dialog window with buttons')
|
|
@@ -601,14 +688,14 @@ const statusBarStories = [
|
|
|
601
688
|
flexDirection: 'column',
|
|
602
689
|
width: 40,
|
|
603
690
|
borderStyle: 'double',
|
|
604
|
-
borderColor: '
|
|
691
|
+
borderColor: 'warning',
|
|
605
692
|
},
|
|
606
693
|
// Title bar
|
|
607
|
-
Box({ backgroundColor: '
|
|
694
|
+
Box({ backgroundColor: 'warning', paddingX: 1 }, Text({ color: 'background', bold: true }, '⚠ Warning')),
|
|
608
695
|
// Content
|
|
609
696
|
Box({ padding: 1 }, Text({}, 'Are you sure you want to delete this file? This action cannot be undone.')),
|
|
610
697
|
// Buttons
|
|
611
|
-
Box({ paddingX: 1, paddingBottom: 1, gap: 2, justifyContent: 'flex-end' }, Text({ color: '
|
|
698
|
+
Box({ paddingX: 1, paddingBottom: 1, gap: 2, justifyContent: 'flex-end' }, Text({ color: 'muted', inverse: true }, ' No '), Text({ color: 'error', inverse: true }, ' Yes ')))),
|
|
612
699
|
];
|
|
613
700
|
/**
|
|
614
701
|
* Real-time Dashboard stories
|
|
@@ -623,35 +710,35 @@ const realtimeDashboardStories = [
|
|
|
623
710
|
const randomSparkline = (len) => Array.from({ length: len }, () => sparkChars[Math.floor(Math.random() * 8)]).join('');
|
|
624
711
|
return Box({ flexDirection: 'column', gap: 1 },
|
|
625
712
|
// Header
|
|
626
|
-
Box({ borderStyle: 'double', borderColor: '
|
|
713
|
+
Box({ borderStyle: 'double', borderColor: 'primary', paddingX: 1 }, Text({ color: 'primary', bold: true }, '🖥️ Real-time Dashboard'), Spacer({}), Text({ color: 'success' }, '● Live'), Text({ color: 'muted' }, ' | '), Text({ color: 'muted', dim: true }, 'Uptime: 02:34:56')),
|
|
627
714
|
// Row 1
|
|
628
|
-
Box({ flexDirection: 'row', gap: 1 }, Box({ borderStyle: 'round', borderColor: '
|
|
715
|
+
Box({ flexDirection: 'row', gap: 1 }, Box({ borderStyle: 'round', borderColor: 'success', padding: 1, width: 28 }, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'CPU Usage'), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'success' }, '[████████████░░░░░░░░]'), Text({ color: 'success', bold: true }, '58.3%')), Text({ color: 'success', dim: true }, randomSparkline(25)))), Box({ borderStyle: 'round', borderColor: 'primary', padding: 1, width: 28 }, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'Memory'), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'primary' }, '[██████████░░░░░░░░░░]'), Text({ color: 'primary', bold: true }, '52.1%')), Text({ color: 'muted' }, '8.3 GB / 16.0 GB')))),
|
|
629
716
|
// Row 2
|
|
630
|
-
Box({ flexDirection: 'row', gap: 1 }, Box({ borderStyle: 'round', borderColor: '
|
|
717
|
+
Box({ flexDirection: 'row', gap: 1 }, Box({ borderStyle: 'round', borderColor: 'info', padding: 1, width: 40 }, Box({ flexDirection: 'column' }, Box({ flexDirection: 'row' }, Text({ color: 'muted', dim: true }, 'Requests/sec'), Spacer({}), Text({ color: 'muted', dim: true }, 'Total: 1.2M')), Text({ color: 'info', bold: true }, '892 req/s'), Text({ color: 'info' }, randomSparkline(35)))), Box({ borderStyle: 'round', borderColor: 'warning', padding: 1, width: 18 }, Box({ flexDirection: 'column' }, Text({ color: 'muted', dim: true }, 'Active Spinners'), Text({ color: 'primary' }, '⠋ Fetching...'), Text({ color: 'success' }, '◜ Processing...'), Text({ color: 'warning' }, '🕐 Syncing...')))),
|
|
631
718
|
// Footer
|
|
632
|
-
Box({ backgroundColor: '
|
|
719
|
+
Box({ backgroundColor: 'info', paddingX: 1 }, Text({ color: 'foreground' }, '● 234 connections'), Spacer({}), Text({ color: 'foreground' }, 'Render: 30 FPS'), Text({ color: 'muted' }, ' | '), Text({ color: 'foreground' }, '14:32:45')));
|
|
633
720
|
}),
|
|
634
721
|
story('Dashboard - Gauges')
|
|
635
722
|
.category('Organisms')
|
|
636
723
|
.description('Gauge widgets for metrics')
|
|
637
724
|
.render(() => Box({ flexDirection: 'row', gap: 2 },
|
|
638
725
|
// CPU Gauge
|
|
639
|
-
Box({ borderStyle: 'round', borderColor: '
|
|
726
|
+
Box({ borderStyle: 'round', borderColor: 'success', padding: 1, width: 20 }, Box({ flexDirection: 'column', alignItems: 'center' }, Text({ color: 'muted', dim: true }, 'CPU'), Text({ color: 'success', bold: true }, '58%'), Text({ color: 'success' }, '▁▂▃▄▅▆▇█▇▆▅▄▃▂▁'))),
|
|
640
727
|
// Memory Gauge
|
|
641
|
-
Box({ borderStyle: 'round', borderColor: '
|
|
728
|
+
Box({ borderStyle: 'round', borderColor: 'primary', padding: 1, width: 20 }, Box({ flexDirection: 'column', alignItems: 'center' }, Text({ color: 'muted', dim: true }, 'Memory'), Text({ color: 'primary', bold: true }, '8.3GB'), Text({ color: 'primary' }, '████████░░░░░░░░'))),
|
|
642
729
|
// Disk Gauge
|
|
643
|
-
Box({ borderStyle: 'round', borderColor: '
|
|
730
|
+
Box({ borderStyle: 'round', borderColor: 'warning', padding: 1, width: 20 }, Box({ flexDirection: 'column', alignItems: 'center' }, Text({ color: 'muted', dim: true }, 'Disk'), Text({ color: 'warning', bold: true }, '78%'), Text({ color: 'warning' }, '████████████░░░░'))))),
|
|
644
731
|
story('Dashboard - Sparklines')
|
|
645
732
|
.category('Organisms')
|
|
646
733
|
.description('Sparkline charts for time series')
|
|
647
734
|
.controls({
|
|
648
735
|
showLabels: defaultControls.boolean('Show Labels', true),
|
|
649
736
|
})
|
|
650
|
-
.render((props) => Box({ flexDirection: 'column', gap: 1, width: 50 }, Box({ flexDirection: 'row', gap: 1 }, props.showLabels && Box({ width: 10 }, Text({ color: '
|
|
737
|
+
.render((props) => Box({ flexDirection: 'column', gap: 1, width: 50 }, Box({ flexDirection: 'row', gap: 1 }, props.showLabels && Box({ width: 10 }, Text({ color: 'muted' }, 'CPU:')), Text({ color: 'success' }, '▁▂▃▄▅▆▇█▇▆▅▄▃▂▁▂▃▄▅▆▇█▇▆▅▄▃▂▁▂▃'), Text({ color: 'success', bold: true }, ' 58%')), Box({ flexDirection: 'row', gap: 1 }, props.showLabels && Box({ width: 10 }, Text({ color: 'muted' }, 'Memory:')), Text({ color: 'primary' }, '▄▄▄▄▅▅▅▅▅▅▆▆▆▆▆▆▅▅▅▅▅▅▄▄▄▄▄▄▄▄▄'), Text({ color: 'primary', bold: true }, ' 52%')), Box({ flexDirection: 'row', gap: 1 }, props.showLabels && Box({ width: 10 }, Text({ color: 'muted' }, 'Network:')), Text({ color: 'secondary' }, '▂▃▅▇█▆▄▂▁▂▃▅▇█▆▄▂▁▂▃▅▇█▆▄▂▁▂▃▅'), Text({ color: 'secondary', bold: true }, ' 45MB/s')), Box({ flexDirection: 'row', gap: 1 }, props.showLabels && Box({ width: 10 }, Text({ color: 'muted' }, 'Errors:')), Text({ color: 'error' }, '▁▁▁▁▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁▃▁▁▁▁▁▁▁▁▁▁▁'), Text({ color: 'success', bold: true }, ' 0.1%')))),
|
|
651
738
|
story('Spinner - Animated')
|
|
652
739
|
.category('Organisms')
|
|
653
740
|
.description('Spinner styles (run real example for animation)')
|
|
654
|
-
.render(() => Box({ flexDirection: 'column', gap: 1 }, Text({ color: '
|
|
741
|
+
.render(() => Box({ flexDirection: 'column', gap: 1 }, Text({ color: 'muted', dim: true }, 'Note: For real animation, run: pnpm tsx examples/realtime-dashboard.ts'), Box({ marginTop: 1 }), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'primary' }, '⠋'), Text({}, 'dots - Braille dots')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'success' }, '◜'), Text({}, 'arc - Arc spinner')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'warning' }, '◐'), Text({}, 'circle - Circle')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'secondary' }, '🕐'), Text({}, 'clock - Clock emoji')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'info' }, '🌍'), Text({}, 'earth - Globe')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'error' }, '←'), Text({}, 'arrow - Directional')), Box({ flexDirection: 'row', gap: 1 }, Text({ color: 'primary' }, '[=== ]'), Text({}, 'bouncingBar - Progress bar')))),
|
|
655
742
|
];
|
|
656
743
|
/**
|
|
657
744
|
* All organism stories
|