@bigpixelrocket/uiok 0.0.0-stage → 0.1.0
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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/NOTICE +569 -0
- package/README.md +44 -2
- package/dist/VisuallyHidden.d.ts +13 -0
- package/dist/VisuallyHidden.js +13 -0
- package/dist/activity/ActivityBar.d.ts +29 -0
- package/dist/activity/ActivityBar.js +21 -0
- package/dist/activity/activity.css +43 -0
- package/dist/activity/index.d.ts +2 -0
- package/dist/activity/index.js +2 -0
- package/dist/button/Button.d.ts +26 -0
- package/dist/button/Button.js +14 -0
- package/dist/button/IconButton.d.ts +18 -0
- package/dist/button/IconButton.js +14 -0
- package/dist/button/button.css +95 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.js +3 -0
- package/dist/charts/Drawing.d.ts +27 -0
- package/dist/charts/Drawing.js +117 -0
- package/dist/charts/Drawing.logic.d.ts +2 -0
- package/dist/charts/Drawing.logic.js +22 -0
- package/dist/charts/Line.logic.d.ts +33 -0
- package/dist/charts/Line.logic.js +72 -0
- package/dist/charts/LineChart.d.ts +34 -0
- package/dist/charts/LineChart.js +100 -0
- package/dist/charts/Pie.logic.d.ts +16 -0
- package/dist/charts/Pie.logic.js +28 -0
- package/dist/charts/PieChart.d.ts +20 -0
- package/dist/charts/PieChart.js +16 -0
- package/dist/charts/ResultChart.d.ts +47 -0
- package/dist/charts/ResultChart.js +175 -0
- package/dist/charts/ResultChart.logic.d.ts +42 -0
- package/dist/charts/ResultChart.logic.js +165 -0
- package/dist/charts/Scatter.logic.d.ts +55 -0
- package/dist/charts/Scatter.logic.js +134 -0
- package/dist/charts/ScatterChart.d.ts +36 -0
- package/dist/charts/ScatterChart.js +99 -0
- package/dist/charts/charts.css +310 -0
- package/dist/charts/index.d.ts +14 -0
- package/dist/charts/index.js +11 -0
- package/dist/charts/seriesColour.d.ts +2 -0
- package/dist/charts/seriesColour.js +8 -0
- package/dist/clock/index.d.ts +2 -0
- package/dist/clock/index.js +2 -0
- package/dist/clock/useClock.d.ts +14 -0
- package/dist/clock/useClock.js +57 -0
- package/dist/datetime/DateTimePicker.d.ts +50 -0
- package/dist/datetime/DateTimePicker.js +98 -0
- package/dist/datetime/DateTimePicker.logic.d.ts +59 -0
- package/dist/datetime/DateTimePicker.logic.js +103 -0
- package/dist/datetime/datetime.css +115 -0
- package/dist/datetime/index.d.ts +7 -0
- package/dist/datetime/index.js +7 -0
- package/dist/dialog/ConfirmDialog.d.ts +73 -0
- package/dist/dialog/ConfirmDialog.js +30 -0
- package/dist/dialog/DialogLegend.d.ts +21 -0
- package/dist/dialog/DialogLegend.js +28 -0
- package/dist/dialog/DialogLegend.logic.d.ts +145 -0
- package/dist/dialog/DialogLegend.logic.js +71 -0
- package/dist/dialog/ModalDialog.d.ts +101 -0
- package/dist/dialog/ModalDialog.js +184 -0
- package/dist/dialog/dialog.css +283 -0
- package/dist/dialog/index.d.ts +8 -0
- package/dist/dialog/index.js +8 -0
- package/dist/filter/FilterEscape.d.ts +16 -0
- package/dist/filter/FilterEscape.js +15 -0
- package/dist/filter/FilterIcon.d.ts +8 -0
- package/dist/filter/FilterIcon.js +11 -0
- package/dist/filter/filter.css +42 -0
- package/dist/filter/index.d.ts +3 -0
- package/dist/filter/index.js +3 -0
- package/dist/grid/DataGrid.d.ts +149 -0
- package/dist/grid/DataGrid.js +373 -0
- package/dist/grid/DataGrid.logic.d.ts +57 -0
- package/dist/grid/DataGrid.logic.js +121 -0
- package/dist/grid/grid.css +206 -0
- package/dist/grid/index.d.ts +7 -0
- package/dist/grid/index.js +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +32 -0
- package/dist/keyboard/BrowserKeys.d.ts +15 -0
- package/dist/keyboard/BrowserKeys.js +28 -0
- package/dist/keyboard/KeyChord.logic.d.ts +25 -0
- package/dist/keyboard/KeyChord.logic.js +50 -0
- package/dist/keyboard/Keyboard.logic.d.ts +84 -0
- package/dist/keyboard/Keyboard.logic.js +137 -0
- package/dist/keyboard/OverlayWatch.d.ts +28 -0
- package/dist/keyboard/OverlayWatch.js +119 -0
- package/dist/keyboard/PageSelectAll.d.ts +14 -0
- package/dist/keyboard/PageSelectAll.js +22 -0
- package/dist/keyboard/index.d.ts +9 -0
- package/dist/keyboard/index.js +9 -0
- package/dist/keychord/KeyChord.d.ts +16 -0
- package/dist/keychord/KeyChord.js +55 -0
- package/dist/keychord/index.d.ts +2 -0
- package/dist/keychord/index.js +2 -0
- package/dist/keychord/keychord.css +41 -0
- package/dist/labels/UiokLabels.d.ts +41 -0
- package/dist/labels/UiokLabels.js +31 -0
- package/dist/labels/UiokProvider.d.ts +44 -0
- package/dist/labels/UiokProvider.js +54 -0
- package/dist/labels/charts.d.ts +34 -0
- package/dist/labels/charts.js +15 -0
- package/dist/labels/dateTime.d.ts +32 -0
- package/dist/labels/dateTime.js +14 -0
- package/dist/labels/dialog.d.ts +18 -0
- package/dist/labels/dialog.js +6 -0
- package/dist/labels/index.d.ts +13 -0
- package/dist/labels/index.js +13 -0
- package/dist/labels/keys.d.ts +28 -0
- package/dist/labels/keys.js +53 -0
- package/dist/labels/legend.d.ts +21 -0
- package/dist/labels/legend.js +7 -0
- package/dist/labels/listing.d.ts +16 -0
- package/dist/labels/listing.js +8 -0
- package/dist/labels/pager.d.ts +32 -0
- package/dist/labels/pager.js +20 -0
- package/dist/labels/palette.d.ts +17 -0
- package/dist/labels/palette.js +6 -0
- package/dist/labels/selectAll.d.ts +15 -0
- package/dist/labels/selectAll.js +6 -0
- package/dist/labels/terminal.d.ts +25 -0
- package/dist/labels/terminal.js +9 -0
- package/dist/legend/KeyLegend.logic.d.ts +84 -0
- package/dist/legend/KeyLegend.logic.js +109 -0
- package/dist/legend/KeyLegendStrip.d.ts +36 -0
- package/dist/legend/KeyLegendStrip.js +82 -0
- package/dist/legend/index.d.ts +3 -0
- package/dist/legend/index.js +3 -0
- package/dist/legend/legend.css +148 -0
- package/dist/listing/CurrentDot.d.ts +15 -0
- package/dist/listing/CurrentDot.js +13 -0
- package/dist/listing/Listing.d.ts +230 -0
- package/dist/listing/Listing.js +265 -0
- package/dist/listing/PathParts.logic.d.ts +17 -0
- package/dist/listing/PathParts.logic.js +18 -0
- package/dist/listing/index.d.ts +10 -0
- package/dist/listing/index.js +10 -0
- package/dist/listing/listing.css +867 -0
- package/dist/menu/MenuQuery.logic.d.ts +69 -0
- package/dist/menu/MenuQuery.logic.js +75 -0
- package/dist/menu/fuzzyMatch.d.ts +31 -0
- package/dist/menu/fuzzyMatch.js +296 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +9 -0
- package/dist/menu/menu.css +203 -0
- package/dist/menu/useBellBeat.d.ts +8 -0
- package/dist/menu/useBellBeat.js +26 -0
- package/dist/namecut/NameCut.d.ts +22 -0
- package/dist/namecut/NameCut.js +28 -0
- package/dist/namecut/NameCut.logic.d.ts +51 -0
- package/dist/namecut/NameCut.logic.js +120 -0
- package/dist/namecut/index.d.ts +3 -0
- package/dist/namecut/index.js +3 -0
- package/dist/namecut/namecut.css +67 -0
- package/dist/pager/Pager.d.ts +37 -0
- package/dist/pager/Pager.js +38 -0
- package/dist/pager/Pager.logic.d.ts +13 -0
- package/dist/pager/Pager.logic.js +63 -0
- package/dist/pager/index.d.ts +7 -0
- package/dist/pager/index.js +7 -0
- package/dist/pager/pager.css +62 -0
- package/dist/palette/Palette.d.ts +79 -0
- package/dist/palette/Palette.js +60 -0
- package/dist/palette/index.d.ts +6 -0
- package/dist/palette/index.js +6 -0
- package/dist/palette/palette.css +159 -0
- package/dist/pane/PaneActions.d.ts +104 -0
- package/dist/pane/PaneActions.js +62 -0
- package/dist/pane/PaneFrame.d.ts +51 -0
- package/dist/pane/PaneFrame.js +28 -0
- package/dist/pane/PaneKeys.d.ts +41 -0
- package/dist/pane/PaneKeys.js +104 -0
- package/dist/pane/PaneKeys.logic.d.ts +95 -0
- package/dist/pane/PaneKeys.logic.js +109 -0
- package/dist/pane/index.d.ts +11 -0
- package/dist/pane/index.js +11 -0
- package/dist/pane/usePaneKeys.d.ts +141 -0
- package/dist/pane/usePaneKeys.js +313 -0
- package/dist/run/RunHeader.d.ts +50 -0
- package/dist/run/RunHeader.js +31 -0
- package/dist/run/RunProgress.logic.d.ts +29 -0
- package/dist/run/RunProgress.logic.js +34 -0
- package/dist/run/index.d.ts +3 -0
- package/dist/run/index.js +3 -0
- package/dist/run/run.css +190 -0
- package/dist/segmented/SegmentedChoice.d.ts +22 -0
- package/dist/segmented/SegmentedChoice.js +31 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.css +49 -0
- package/dist/selectall/CheckRange.logic.d.ts +8 -0
- package/dist/selectall/CheckRange.logic.js +23 -0
- package/dist/selectall/SelectAllBar.d.ts +25 -0
- package/dist/selectall/SelectAllBar.js +24 -0
- package/dist/selectall/index.d.ts +7 -0
- package/dist/selectall/index.js +7 -0
- package/dist/selectall/selectall.css +31 -0
- package/dist/store/KeepUnchanged.logic.d.ts +19 -0
- package/dist/store/KeepUnchanged.logic.js +33 -0
- package/dist/store/SameProps.d.ts +15 -0
- package/dist/store/SameProps.js +46 -0
- package/dist/store/ValueStore.d.ts +17 -0
- package/dist/store/ValueStore.js +23 -0
- package/dist/store/index.d.ts +8 -0
- package/dist/store/index.js +8 -0
- package/dist/store/useStableHandlers.d.ts +13 -0
- package/dist/store/useStableHandlers.js +22 -0
- package/dist/styles.css +85 -0
- package/dist/tabs/PageTabs.d.ts +38 -0
- package/dist/tabs/PageTabs.js +33 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.css +64 -0
- package/dist/terminal/Terminal.d.ts +104 -0
- package/dist/terminal/Terminal.js +309 -0
- package/dist/terminal/Terminal.logic.d.ts +66 -0
- package/dist/terminal/Terminal.logic.js +156 -0
- package/dist/terminal/TerminalMenu.d.ts +36 -0
- package/dist/terminal/TerminalMenu.js +87 -0
- package/dist/terminal/TerminalMenu.logic.d.ts +78 -0
- package/dist/terminal/TerminalMenu.logic.js +68 -0
- package/dist/terminal/TerminalScrollback.d.ts +10 -0
- package/dist/terminal/TerminalScrollback.js +11 -0
- package/dist/terminal/ghostty/LICENSE +21 -0
- package/dist/terminal/ghostty/core.d.ts +315 -0
- package/dist/terminal/ghostty/core.js +1189 -0
- package/dist/terminal/ghostty/fallbackColors.d.ts +12 -0
- package/dist/terminal/ghostty/fallbackColors.js +23 -0
- package/dist/terminal/ghostty/fonts/LICENSE +21 -0
- package/dist/terminal/ghostty/fonts/SymbolsNerdFontMono-Regular.woff2 +0 -0
- package/dist/terminal/ghostty/keyCodes.logic.d.ts +20 -0
- package/dist/terminal/ghostty/keyCodes.logic.js +249 -0
- package/dist/terminal/ghostty/links.logic.d.ts +39 -0
- package/dist/terminal/ghostty/links.logic.js +84 -0
- package/dist/terminal/ghostty/renderer.d.ts +98 -0
- package/dist/terminal/ghostty/renderer.js +481 -0
- package/dist/terminal/ghostty/runtime.d.ts +126 -0
- package/dist/terminal/ghostty/runtime.js +346 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.d.ts +64 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.js +546 -0
- package/dist/terminal/ghostty/surface.d.ts +285 -0
- package/dist/terminal/ghostty/surface.js +1565 -0
- package/dist/terminal/ghostty/surface.logic.d.ts +181 -0
- package/dist/terminal/ghostty/surface.logic.js +392 -0
- package/dist/terminal/ghostty/vendor/LICENSE +21 -0
- package/dist/terminal/ghostty/vendor/ghostty-effects.wasm +0 -0
- package/dist/terminal/ghostty/vendor/ghostty-vt.wasm +0 -0
- package/dist/terminal/index.d.ts +12 -0
- package/dist/terminal/index.js +12 -0
- package/dist/terminal/terminal.css +169 -0
- package/dist/text/MarkedText.d.ts +14 -0
- package/dist/text/MarkedText.js +11 -0
- package/dist/text/highlightSegments.d.ts +13 -0
- package/dist/text/highlightSegments.js +29 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +3 -0
- package/dist/text/text.css +11 -0
- package/dist/themes/attributes.d.ts +21 -0
- package/dist/themes/attributes.js +41 -0
- package/dist/themes/catalog.d.ts +125 -0
- package/dist/themes/catalog.js +940 -0
- package/dist/themes/color.d.ts +29 -0
- package/dist/themes/color.js +52 -0
- package/dist/themes/ids.d.ts +139 -0
- package/dist/themes/ids.js +59 -0
- package/dist/themes/index.d.ts +12 -0
- package/dist/themes/index.js +12 -0
- package/dist/themes/themes.generated.css +1830 -0
- package/dist/themes/tokens.d.ts +189 -0
- package/dist/themes/tokens.js +462 -0
- package/dist/tooltip/Tooltip.d.ts +21 -0
- package/dist/tooltip/Tooltip.js +105 -0
- package/dist/tooltip/Tooltip.logic.d.ts +49 -0
- package/dist/tooltip/Tooltip.logic.js +50 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/tooltip.css +45 -0
- package/package.json +91 -4
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* The terminal component. The host's class sizes and places .terminal; the
|
|
2
|
+
mount fills it and paints the terminal ground until the canvas does. Colors
|
|
3
|
+
come from the --terminal-* tokens (themes.generated.css). The engine draws
|
|
4
|
+
13px text on 19px lines (TERMINAL_FONT_SIZE, TERMINAL_LINE_HEIGHT) 4px in
|
|
5
|
+
from the mount's edges; every host pads the other 8px, so its text starts
|
|
6
|
+
12px from the host's edge, where a listing's path bar starts its own. */
|
|
7
|
+
.terminal {
|
|
8
|
+
display: flex;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.terminal-mount {
|
|
14
|
+
position: relative;
|
|
15
|
+
flex: 1;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
background: var(--terminal-bg);
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* A read-only terminal takes focus for selection and copy; say so when the
|
|
24
|
+
keyboard put it there. */
|
|
25
|
+
.terminal-mount[tabindex='0']:focus-visible {
|
|
26
|
+
box-shadow: inset 0 0 0 2px var(--accent);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.terminal-canvas {
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
cursor: text;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* The scrollback rail: a thin thumb over the right edge, tinted from the
|
|
37
|
+
terminal's own text color so it reads in both flavors. */
|
|
38
|
+
.terminal-scrollbar {
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 4px;
|
|
41
|
+
right: 1px;
|
|
42
|
+
bottom: 4px;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
width: 8px;
|
|
45
|
+
cursor: default;
|
|
46
|
+
touch-action: none;
|
|
47
|
+
outline: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.terminal-scrollbar-thumb {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
right: 1px;
|
|
54
|
+
left: 1px;
|
|
55
|
+
border-radius: 3px;
|
|
56
|
+
background: color-mix(in srgb, var(--terminal-fg) 28%, transparent);
|
|
57
|
+
transition: background-color 120ms ease-out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.terminal-scrollbar:hover .terminal-scrollbar-thumb,
|
|
61
|
+
.terminal-scrollbar:focus-visible .terminal-scrollbar-thumb {
|
|
62
|
+
background: color-mix(in srgb, var(--terminal-fg) 50%, transparent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Holds a read-only terminal's selection as DOM text, selected, so the Edit
|
|
66
|
+
menu's Copy finds it; never seen or read aloud. */
|
|
67
|
+
.terminal-copy-buffer {
|
|
68
|
+
position: absolute;
|
|
69
|
+
width: 1px;
|
|
70
|
+
height: 1px;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
clip-path: inset(50%);
|
|
73
|
+
white-space: pre;
|
|
74
|
+
user-select: text;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Set where the terminal's first line would be: the engine's 4px in, at its
|
|
78
|
+
size and pitch. */
|
|
79
|
+
.terminal-failure {
|
|
80
|
+
flex: 1;
|
|
81
|
+
margin: 0;
|
|
82
|
+
padding: 4px;
|
|
83
|
+
background: var(--terminal-bg);
|
|
84
|
+
color: var(--terminal-fg);
|
|
85
|
+
font: 13px/19px var(--font-mono);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* The terminal's menu (TerminalMenu), which a secondary click opens at the
|
|
89
|
+
point it landed: the menu look (menu.css) in surface, row metrics, and
|
|
90
|
+
chords, drawn here because a terminal sits anywhere, outside any
|
|
91
|
+
.listing-root and in dialogs. Fixed, since it is placed in window
|
|
92
|
+
coordinates over the screen it acts on. */
|
|
93
|
+
.terminal-menu {
|
|
94
|
+
position: fixed;
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
z-index: var(--z-panel);
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
min-width: 180px;
|
|
101
|
+
padding: 4px;
|
|
102
|
+
background: var(--surface);
|
|
103
|
+
border: 1px solid var(--border-strong);
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
box-shadow: var(--shadow-menu);
|
|
106
|
+
color: var(--text);
|
|
107
|
+
font: 12px var(--font-mono);
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* A row: its icon, its name, and its chord at the right edge. */
|
|
112
|
+
.terminal-menu-item {
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
115
|
+
align-items: center;
|
|
116
|
+
height: 24px;
|
|
117
|
+
padding: 0 6px;
|
|
118
|
+
border-radius: 4px;
|
|
119
|
+
cursor: default;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.terminal-menu-item.cursor {
|
|
123
|
+
background: var(--cursor-row-bg);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.terminal-menu-icon {
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
color: var(--text-dim);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.terminal-menu-item .keychord {
|
|
133
|
+
padding-left: 10px;
|
|
134
|
+
color: var(--text-dim);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* The visual bell: a veil of the terminal's own text color over the screen
|
|
138
|
+
that fades out over BELL_FLASH_MS (Terminal.logic.ts), so it reads in both
|
|
139
|
+
flavors. Under reduced motion it is a still tint at the edges instead, on
|
|
140
|
+
for the same time and off again with no fade. */
|
|
141
|
+
.terminal-mount[data-bell]::after {
|
|
142
|
+
content: '';
|
|
143
|
+
position: absolute;
|
|
144
|
+
inset: 0;
|
|
145
|
+
z-index: 2;
|
|
146
|
+
background: color-mix(in srgb, var(--terminal-fg) 12%, transparent);
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
opacity: 0;
|
|
149
|
+
animation: terminal-bell 250ms ease-out;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes terminal-bell {
|
|
153
|
+
from {
|
|
154
|
+
opacity: 1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (prefers-reduced-motion: reduce) {
|
|
159
|
+
.terminal-scrollbar-thumb {
|
|
160
|
+
transition: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.terminal-mount[data-bell]::after {
|
|
164
|
+
background: none;
|
|
165
|
+
box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--terminal-fg) 40%, transparent);
|
|
166
|
+
opacity: 1;
|
|
167
|
+
animation: none;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/** Props for {@link MarkedText}. */
|
|
3
|
+
export interface MarkedTextProps {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
/** The matched UTF-16 code unit indices, ascending (`highlightSegments`). */
|
|
6
|
+
readonly positions: readonly number[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Text with the characters a fuzzy match hit marked in place: a listing's
|
|
10
|
+
* names under a filter, a menu's or a palette's rows under a query. The marks
|
|
11
|
+
* only tint behind the text (`.name-hit`), so a name keeps the colour it
|
|
12
|
+
* already carries.
|
|
13
|
+
*/
|
|
14
|
+
export declare function MarkedText({ text, positions }: MarkedTextProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { highlightSegments } from './highlightSegments.js';
|
|
3
|
+
/**
|
|
4
|
+
* Text with the characters a fuzzy match hit marked in place: a listing's
|
|
5
|
+
* names under a filter, a menu's or a palette's rows under a query. The marks
|
|
6
|
+
* only tint behind the text (`.name-hit`), so a name keeps the colour it
|
|
7
|
+
* already carries.
|
|
8
|
+
*/
|
|
9
|
+
export function MarkedText({ text, positions }) {
|
|
10
|
+
return (_jsx(_Fragment, { children: highlightSegments(text, positions).map((segment, index) => segment.hit ? (_jsx("span", { className: "name-hit", children: segment.text }, index)) : (segment.text)) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** One run of a text's characters, either all matched or all unmatched. */
|
|
2
|
+
export interface HighlightSegment {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly hit: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Splits a text into alternating matched and unmatched runs, so a row marks
|
|
8
|
+
* whole runs instead of wrapping every character in its own element.
|
|
9
|
+
* `positions` are the matched UTF-16 code unit indices, ascending, as a
|
|
10
|
+
* fuzzy matcher reports them; a character outside the basic plane is
|
|
11
|
+
* matched by both of its code units, so it lands whole in one run.
|
|
12
|
+
*/
|
|
13
|
+
export declare const highlightSegments: (text: string, positions: readonly number[]) => readonly HighlightSegment[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a text into alternating matched and unmatched runs, so a row marks
|
|
3
|
+
* whole runs instead of wrapping every character in its own element.
|
|
4
|
+
* `positions` are the matched UTF-16 code unit indices, ascending, as a
|
|
5
|
+
* fuzzy matcher reports them; a character outside the basic plane is
|
|
6
|
+
* matched by both of its code units, so it lands whole in one run.
|
|
7
|
+
*/
|
|
8
|
+
export const highlightSegments = (text, positions) => {
|
|
9
|
+
if (positions.length === 0) {
|
|
10
|
+
return text === '' ? [] : [{ text, hit: false }];
|
|
11
|
+
}
|
|
12
|
+
const hits = new Set(positions);
|
|
13
|
+
const segments = [];
|
|
14
|
+
let run = '';
|
|
15
|
+
let runHit = hits.has(0);
|
|
16
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
17
|
+
const hit = hits.has(index);
|
|
18
|
+
if (hit !== runHit && run !== '') {
|
|
19
|
+
segments.push({ text: run, hit: runHit });
|
|
20
|
+
run = '';
|
|
21
|
+
}
|
|
22
|
+
runHit = hit;
|
|
23
|
+
run += text[index] ?? '';
|
|
24
|
+
}
|
|
25
|
+
if (run !== '') {
|
|
26
|
+
segments.push({ text: run, hit: runHit });
|
|
27
|
+
}
|
|
28
|
+
return segments;
|
|
29
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* ---- Marked text (MarkedText) ----
|
|
2
|
+
|
|
3
|
+
Matched characters are tinted, never recoloured: a row name may already
|
|
4
|
+
carry a colour of its own (a file's kind), and repainting it would trade
|
|
5
|
+
that colour for the match. The tint sits behind whatever colour the name
|
|
6
|
+
has, so it composes with names that draw their own background too. Drawn
|
|
7
|
+
inside the listing scope (.listing-root). */
|
|
8
|
+
:where(.listing-root) .name-hit {
|
|
9
|
+
border-radius: 2px;
|
|
10
|
+
background: color-mix(in srgb, var(--accent) 22%, transparent);
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The themes a page wears, as attributes on its root element
|
|
3
|
+
* (`data-light-theme`, `data-dark-theme`), and the one watch every reader of
|
|
4
|
+
* the colour tokens in script shares. The stylesheet's block for a theme
|
|
5
|
+
* takes over while its id is set, so CSS follows a change on its own; code
|
|
6
|
+
* that reads a token's value in script (a canvas, a chart) reads it again
|
|
7
|
+
* when `subscribeThemeChange` calls.
|
|
8
|
+
*
|
|
9
|
+
* Set the attributes before the first paint where you can (a server-rendered
|
|
10
|
+
* root, an inline script, or a preload), so the page never flashes the
|
|
11
|
+
* default theme; `wearThemes` sets them from script at any time after.
|
|
12
|
+
*/
|
|
13
|
+
import { type AppearanceThemes } from './ids.js';
|
|
14
|
+
/** Has `root` wear `themes`, leaving an attribute that already names its theme untouched. */
|
|
15
|
+
export declare function wearThemes(root: HTMLElement, themes: AppearanceThemes): void;
|
|
16
|
+
/**
|
|
17
|
+
* Calls `listener` whenever the colour tokens may have changed: the
|
|
18
|
+
* appearance flips (`prefers-color-scheme`), or `root` comes to wear another
|
|
19
|
+
* theme. Returns the unsubscribe.
|
|
20
|
+
*/
|
|
21
|
+
export declare function subscribeThemeChange(listener: () => void, root?: HTMLElement, view?: Window): () => void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The themes a page wears, as attributes on its root element
|
|
3
|
+
* (`data-light-theme`, `data-dark-theme`), and the one watch every reader of
|
|
4
|
+
* the colour tokens in script shares. The stylesheet's block for a theme
|
|
5
|
+
* takes over while its id is set, so CSS follows a change on its own; code
|
|
6
|
+
* that reads a token's value in script (a canvas, a chart) reads it again
|
|
7
|
+
* when `subscribeThemeChange` calls.
|
|
8
|
+
*
|
|
9
|
+
* Set the attributes before the first paint where you can (a server-rendered
|
|
10
|
+
* root, an inline script, or a preload), so the page never flashes the
|
|
11
|
+
* default theme; `wearThemes` sets them from script at any time after.
|
|
12
|
+
*/
|
|
13
|
+
import { THEME_ATTRIBUTES } from './ids.js';
|
|
14
|
+
/** Has `root` wear `themes`, leaving an attribute that already names its theme untouched. */
|
|
15
|
+
export function wearThemes(root, themes) {
|
|
16
|
+
if (root.getAttribute(THEME_ATTRIBUTES.light) !== themes.light) {
|
|
17
|
+
root.setAttribute(THEME_ATTRIBUTES.light, themes.light);
|
|
18
|
+
}
|
|
19
|
+
if (root.getAttribute(THEME_ATTRIBUTES.dark) !== themes.dark) {
|
|
20
|
+
root.setAttribute(THEME_ATTRIBUTES.dark, themes.dark);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Calls `listener` whenever the colour tokens may have changed: the
|
|
25
|
+
* appearance flips (`prefers-color-scheme`), or `root` comes to wear another
|
|
26
|
+
* theme. Returns the unsubscribe.
|
|
27
|
+
*/
|
|
28
|
+
export function subscribeThemeChange(listener, root = document.documentElement, view = window) {
|
|
29
|
+
const scheme = view.matchMedia?.('(prefers-color-scheme: dark)');
|
|
30
|
+
const notify = () => listener();
|
|
31
|
+
scheme?.addEventListener('change', notify);
|
|
32
|
+
const observer = new MutationObserver(notify);
|
|
33
|
+
observer.observe(root, {
|
|
34
|
+
attributes: true,
|
|
35
|
+
attributeFilter: [THEME_ATTRIBUTES.light, THEME_ATTRIBUTES.dark]
|
|
36
|
+
});
|
|
37
|
+
return () => {
|
|
38
|
+
scheme?.removeEventListener('change', notify);
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The theme catalog: every theme a page can wear, as a palette of named
|
|
3
|
+
* source colours keyed by the ids `ids.ts` lists. `tokens.ts` derives the
|
|
4
|
+
* colour tokens from a palette, and `themes.test.ts` writes them into
|
|
5
|
+
* `themes.generated.css`; a host process that paints a window's ground
|
|
6
|
+
* before the stylesheet loads can read it from the same entries.
|
|
7
|
+
*
|
|
8
|
+
* Pure data with no DOM or React dependency, so a generator and a host
|
|
9
|
+
* import one copy. Components name themes through `ids.ts` and paint only
|
|
10
|
+
* with the tokens, never with these colours (`test/colorLiterals.test.ts`).
|
|
11
|
+
*/
|
|
12
|
+
import { type Hex } from './color.js';
|
|
13
|
+
import { type ThemeAppearance, type ThemeId } from './ids.js';
|
|
14
|
+
import type { ThemeOverrides } from './tokens.js';
|
|
15
|
+
/**
|
|
16
|
+
* A theme's source colours, by Catppuccin's role names, which the syntax
|
|
17
|
+
* tokens (`--syntax-*`) already carry. Another
|
|
18
|
+
* family maps its colours onto the roles by what each role means here, not
|
|
19
|
+
* by its own names:
|
|
20
|
+
*
|
|
21
|
+
* - The accents, by hue: `rosewater` and `flamingo` (pale warm pinks, a
|
|
22
|
+
* cursor and string escapes), `pink`, `mauve` (purple: keywords), `red` (errors, danger), `maroon` (a softer red),
|
|
23
|
+
* `peach` (orange: numbers), `yellow` (warnings),
|
|
24
|
+
* `green` (success, strings), `teal`, `sky` and `sapphire` (two cyans),
|
|
25
|
+
* `blue` (the accent: selection, focus, links), and `lavender` (a
|
|
26
|
+
* blue-violet: the primary hue and the primary button).
|
|
27
|
+
* - The neutrals, from the foreground to the deepest ground: `text` (body
|
|
28
|
+
* text), `subtext1` and `subtext0` (secondary text, each a step quieter),
|
|
29
|
+
* `overlay2`, `overlay1`, and `overlay0` (comments, hints, and inactive
|
|
30
|
+
* marks, each quieter still), `surface2`, `surface1`, and `surface0`
|
|
31
|
+
* (strong borders, borders, and hover fills), `base` (panels), `mantle`
|
|
32
|
+
* (the window's ground), and `crust` (the header bar). In a dark theme
|
|
33
|
+
* each ground is darker than the one before it; in a light theme the
|
|
34
|
+
* header still sits a step under the ground, as `crust` does in Latte.
|
|
35
|
+
*/
|
|
36
|
+
export interface ThemePalette {
|
|
37
|
+
readonly rosewater: Hex;
|
|
38
|
+
readonly flamingo: Hex;
|
|
39
|
+
readonly pink: Hex;
|
|
40
|
+
readonly mauve: Hex;
|
|
41
|
+
readonly red: Hex;
|
|
42
|
+
readonly maroon: Hex;
|
|
43
|
+
readonly peach: Hex;
|
|
44
|
+
readonly yellow: Hex;
|
|
45
|
+
readonly green: Hex;
|
|
46
|
+
readonly teal: Hex;
|
|
47
|
+
readonly sky: Hex;
|
|
48
|
+
readonly sapphire: Hex;
|
|
49
|
+
readonly blue: Hex;
|
|
50
|
+
readonly lavender: Hex;
|
|
51
|
+
readonly text: Hex;
|
|
52
|
+
readonly subtext1: Hex;
|
|
53
|
+
readonly subtext0: Hex;
|
|
54
|
+
readonly overlay2: Hex;
|
|
55
|
+
readonly overlay1: Hex;
|
|
56
|
+
readonly overlay0: Hex;
|
|
57
|
+
readonly surface2: Hex;
|
|
58
|
+
readonly surface1: Hex;
|
|
59
|
+
readonly surface0: Hex;
|
|
60
|
+
readonly base: Hex;
|
|
61
|
+
readonly mantle: Hex;
|
|
62
|
+
readonly crust: Hex;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A theme's terminal colours: the 16 ANSI colours (SGR 30 to 37, then 90 to
|
|
66
|
+
* 97) and the cursor, as the theme's own terminal port publishes them. The
|
|
67
|
+
* terminal's ground and text are the palette's `base` and `text`, and its
|
|
68
|
+
* selection is the accent, so neither is listed here.
|
|
69
|
+
*/
|
|
70
|
+
export interface TerminalPalette {
|
|
71
|
+
/** Exactly 16, in SGR order. */
|
|
72
|
+
readonly ansi: readonly Hex[];
|
|
73
|
+
/** The terminal cursor's colour. */
|
|
74
|
+
readonly cursor: Hex;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The eight categorical hues (`--group-<hue>`), by plain name, for marks that
|
|
78
|
+
* tell items of a set apart by colour alone: a group, a tag, a label. A hue
|
|
79
|
+
* names a category, never a status.
|
|
80
|
+
*/
|
|
81
|
+
export type GroupHue = 'blue' | 'green' | 'purple' | 'orange' | 'teal' | 'pink' | 'yellow' | 'red';
|
|
82
|
+
/** A theme's colours: what the catalog holds for an id of `ids.ts`. */
|
|
83
|
+
interface ThemeColours {
|
|
84
|
+
/** The source colours every token is derived from. */
|
|
85
|
+
readonly palette: ThemePalette;
|
|
86
|
+
/** The terminal's ANSI colours and cursor. */
|
|
87
|
+
readonly terminal: TerminalPalette;
|
|
88
|
+
/**
|
|
89
|
+
* Group hues drawn in a colour other than their palette role's, where two
|
|
90
|
+
* roles share one of the theme's few hues and their marks would look
|
|
91
|
+
* alike. A group mark sits beside its item's name, so it may wear a colour
|
|
92
|
+
* the theme's text could not; the marks' hairline ring follows these too.
|
|
93
|
+
* Every other hue wears its role (`blue` the palette's blue, `purple` its
|
|
94
|
+
* mauve, `orange` its peach).
|
|
95
|
+
*/
|
|
96
|
+
readonly groups?: Readonly<Partial<Record<GroupHue, Hex>>>;
|
|
97
|
+
/**
|
|
98
|
+
* Tokens hand-tuned where no rule in `tokens.ts` gives the value the theme
|
|
99
|
+
* was designed with, each with the reason it is tuned. Every other token
|
|
100
|
+
* follows the rules, so a new theme needs no overrides to be legible; a
|
|
101
|
+
* token derived from an overridden one follows the override.
|
|
102
|
+
*/
|
|
103
|
+
readonly overrides?: ThemeOverrides;
|
|
104
|
+
}
|
|
105
|
+
/** One theme of the catalog: its entry in `ids.ts` and its colours. */
|
|
106
|
+
export interface Theme extends ThemeColours {
|
|
107
|
+
/** The theme's id in `ids.ts`. */
|
|
108
|
+
readonly id: ThemeId;
|
|
109
|
+
/** The display name a theme picker shows. */
|
|
110
|
+
readonly name: string;
|
|
111
|
+
/** The appearance the theme is worn under. */
|
|
112
|
+
readonly appearance: ThemeAppearance;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Every theme, in the order `ids.ts` lists them (light themes first, the
|
|
116
|
+
* order a theme picker lists them in).
|
|
117
|
+
*/
|
|
118
|
+
export declare const THEMES: readonly Theme[];
|
|
119
|
+
/** The theme of the catalog with `id`. */
|
|
120
|
+
export declare function themeById(id: ThemeId): Theme;
|
|
121
|
+
/** The theme a light appearance wears until the user picks another. */
|
|
122
|
+
export declare const DEFAULT_LIGHT_THEME: Theme;
|
|
123
|
+
/** The theme a dark appearance wears until the user picks another. */
|
|
124
|
+
export declare const DEFAULT_DARK_THEME: Theme;
|
|
125
|
+
export {};
|