@bigpixelrocket/uiok 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -1
- package/README.md +1 -1
- package/dist/activity/ActivityBar.d.ts +21 -8
- package/dist/activity/ActivityBar.js +15 -5
- package/dist/activity/activity.css +53 -6
- package/dist/button/Button.d.ts +10 -6
- package/dist/button/Button.js +6 -1
- package/dist/button/button.css +201 -33
- package/dist/charts/Line.logic.d.ts +6 -0
- package/dist/charts/Line.logic.js +9 -0
- package/dist/charts/LineChart.js +11 -4
- package/dist/charts/Pie.logic.d.ts +89 -1
- package/dist/charts/Pie.logic.js +272 -2
- package/dist/charts/PieChart.d.ts +2 -1
- package/dist/charts/PieChart.js +12 -5
- package/dist/charts/PieFill.d.ts +15 -0
- package/dist/charts/PieFill.js +33 -0
- package/dist/charts/ResultChart.d.ts +2 -2
- package/dist/charts/ResultChart.js +173 -47
- package/dist/charts/ResultChart.logic.d.ts +60 -4
- package/dist/charts/ResultChart.logic.js +105 -6
- package/dist/charts/Scatter.logic.d.ts +18 -4
- package/dist/charts/Scatter.logic.js +98 -22
- package/dist/charts/ScatterChart.js +19 -5
- package/dist/charts/charts.css +233 -116
- package/dist/charts/seriesColour.d.ts +2 -0
- package/dist/charts/seriesColour.js +1 -1
- package/dist/datetime/DateTimePicker.d.ts +12 -2
- package/dist/datetime/DateTimePicker.js +61 -16
- package/dist/datetime/DateTimePicker.logic.d.ts +29 -0
- package/dist/datetime/DateTimePicker.logic.js +25 -0
- package/dist/datetime/datetime.css +89 -49
- package/dist/dialog/ConfirmDialog.d.ts +69 -20
- package/dist/dialog/ConfirmDialog.js +39 -12
- package/dist/dialog/DialogLayer.d.ts +25 -0
- package/dist/dialog/DialogLayer.js +24 -0
- package/dist/dialog/DialogLegend.d.ts +2 -1
- package/dist/dialog/DialogLegend.js +10 -5
- package/dist/dialog/DialogLegend.logic.d.ts +15 -3
- package/dist/dialog/DialogLegend.logic.js +8 -4
- package/dist/dialog/DialogLists.d.ts +157 -0
- package/dist/dialog/DialogLists.js +137 -0
- package/dist/dialog/ModalDialog.d.ts +20 -15
- package/dist/dialog/ModalDialog.js +22 -7
- package/dist/dialog/dialog.css +570 -127
- package/dist/dialog/index.d.ts +7 -1
- package/dist/dialog/index.js +7 -1
- package/dist/field/Check.d.ts +15 -0
- package/dist/field/Check.js +23 -0
- package/dist/field/field.css +812 -0
- package/dist/field/index.d.ts +10 -0
- package/dist/field/index.js +10 -0
- package/dist/field/labelHelp.d.ts +33 -0
- package/dist/field/labelHelp.js +22 -0
- package/dist/filter/FilterIcon.js +2 -1
- package/dist/filter/filter.css +72 -20
- package/dist/grid/DataGrid.d.ts +19 -2
- package/dist/grid/DataGrid.js +122 -41
- package/dist/grid/DataGrid.logic.d.ts +15 -3
- package/dist/grid/DataGrid.logic.js +18 -5
- package/dist/grid/grid.css +481 -56
- package/dist/icon/Spinner.d.ts +16 -0
- package/dist/icon/Spinner.js +13 -0
- package/dist/icon/index.d.ts +5 -0
- package/dist/icon/index.js +5 -0
- package/dist/icon/sizes.d.ts +19 -0
- package/dist/icon/sizes.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/keychord/KeyChord.d.ts +12 -1
- package/dist/keychord/KeyChord.js +2 -2
- package/dist/keychord/index.d.ts +1 -1
- package/dist/keychord/keychord.css +87 -9
- package/dist/labels/dialog.d.ts +12 -1
- package/dist/labels/dialog.js +3 -1
- package/dist/labels/selectAll.d.ts +4 -4
- package/dist/labels/selectAll.js +1 -1
- package/dist/legend/KeyLegendStrip.js +1 -1
- package/dist/legend/legend.css +82 -57
- package/dist/listing/Listing.d.ts +17 -10
- package/dist/listing/Listing.js +33 -26
- package/dist/listing/listing.css +1665 -237
- package/dist/menu/menu.css +227 -67
- package/dist/menu/useBellBeat.js +2 -2
- package/dist/namecut/NameCut.d.ts +3 -1
- package/dist/namecut/NameCut.js +152 -5
- package/dist/namecut/NameCut.logic.d.ts +5 -3
- package/dist/namecut/NameCut.logic.js +20 -5
- package/dist/namecut/namecut.css +27 -7
- package/dist/pager/Pager.d.ts +12 -4
- package/dist/pager/Pager.js +21 -7
- package/dist/pager/pager.css +41 -30
- package/dist/palette/Palette.js +2 -1
- package/dist/palette/palette.css +121 -60
- package/dist/pane/PaneActions.d.ts +56 -14
- package/dist/pane/PaneActions.js +64 -16
- package/dist/pane/PaneFrame.d.ts +37 -5
- package/dist/pane/PaneFrame.js +246 -11
- package/dist/pane/index.d.ts +4 -2
- package/dist/pane/index.js +4 -2
- package/dist/pane/toolWords.d.ts +14 -0
- package/dist/pane/toolWords.js +26 -0
- package/dist/pane/useToolbarFit.d.ts +25 -0
- package/dist/pane/useToolbarFit.js +95 -0
- package/dist/run/RunHeader.d.ts +5 -3
- package/dist/run/RunHeader.js +11 -8
- package/dist/run/run.css +64 -79
- package/dist/segmented/SegmentedChoice.d.ts +18 -2
- package/dist/segmented/SegmentedChoice.js +18 -7
- package/dist/segmented/segmented.css +62 -22
- package/dist/selectall/SelectAllBar.d.ts +4 -3
- package/dist/selectall/SelectAllBar.js +4 -3
- package/dist/selectall/selectall.css +17 -12
- package/dist/shell/shell.css +1073 -0
- package/dist/styles.css +620 -22
- package/dist/surface/surface.css +154 -0
- package/dist/tabs/PageTabs.d.ts +10 -5
- package/dist/tabs/PageTabs.js +126 -37
- package/dist/tabs/tabs.css +131 -51
- package/dist/terminal/Terminal.js +3 -1
- package/dist/terminal/Terminal.logic.d.ts +5 -4
- package/dist/terminal/Terminal.logic.js +9 -4
- package/dist/terminal/TerminalMenu.d.ts +4 -1
- package/dist/terminal/TerminalMenu.js +12 -5
- package/dist/terminal/ghostty/contrast.logic.d.ts +45 -0
- package/dist/terminal/ghostty/contrast.logic.js +130 -0
- package/dist/terminal/ghostty/core.d.ts +6 -0
- package/dist/terminal/ghostty/renderer.d.ts +9 -2
- package/dist/terminal/ghostty/renderer.js +91 -14
- package/dist/terminal/ghostty/surface.d.ts +8 -0
- package/dist/terminal/ghostty/surface.js +27 -1
- package/dist/terminal/terminal.css +87 -61
- package/dist/text/text.css +16 -7
- package/dist/themes/catalog.js +4 -3
- package/dist/themes/themes.generated.css +1307 -264
- package/dist/themes/tokens.d.ts +69 -14
- package/dist/themes/tokens.js +920 -97
- package/dist/tokens.css +239 -0
- package/dist/tooltip/Tooltip.d.ts +6 -0
- package/dist/tooltip/Tooltip.js +48 -6
- package/dist/tooltip/Tooltip.logic.d.ts +89 -12
- package/dist/tooltip/Tooltip.logic.js +142 -20
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip/tooltip.css +39 -9
- package/package.json +3 -3
package/dist/menu/menu.css
CHANGED
|
@@ -2,122 +2,280 @@
|
|
|
2
2
|
|
|
3
3
|
A filtered menu: the floating surface, the query row with its count and
|
|
4
4
|
its visual bell, the options with the cursor row, headings, and notes. A
|
|
5
|
-
palette (palette.css) is the same surface over a backdrop
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.
|
|
5
|
+
palette (palette.css) is the same surface over a backdrop, and the
|
|
6
|
+
terminal's menu (terminal.css) the same surface placed at a click. The
|
|
7
|
+
rules carry one class's weight and no scope, so a menu reads the same
|
|
8
|
+
inside a listing, in a dialog, or anywhere else, and an app adjusts a
|
|
9
|
+
piece with one scoped selector (.listing-root .folder-menu) whatever
|
|
10
|
+
order the stylesheets load in. The field's mark is .filter-icon
|
|
11
|
+
(filter.css) and a matched character is .name-hit (text.css). */
|
|
10
12
|
|
|
11
13
|
/* A menu that drops below what opened it (a crumb, a field). It floats over
|
|
12
|
-
a listing's sticky column header (z-
|
|
13
|
-
pane (
|
|
14
|
-
|
|
14
|
+
a listing's sticky column header (--z-raised) and an overlay inside the
|
|
15
|
+
pane (--z-local-overlay). Like every floating surface it wears the lit
|
|
16
|
+
top edge, which separates it in a dark theme where a shadow cannot. Its
|
|
17
|
+
rows are in the listing's face, whatever face the app's root sets, at
|
|
18
|
+
--menu-font-size: the body size, or the small size on a compact menu
|
|
19
|
+
(.folder-menu-compact), so a host sizes a menu by class, never by
|
|
20
|
+
restating the face or the size. */
|
|
21
|
+
.folder-menu {
|
|
22
|
+
--menu-font-size: var(--font-size-body);
|
|
23
|
+
|
|
15
24
|
position: absolute;
|
|
16
|
-
top: calc(100% +
|
|
25
|
+
top: calc(100% + var(--space-2));
|
|
17
26
|
left: 0;
|
|
18
|
-
z-index:
|
|
27
|
+
z-index: var(--z-menu);
|
|
19
28
|
/* A completion menu's width; a menu that needs more sets its own. */
|
|
20
29
|
width: 300px;
|
|
21
30
|
display: flex;
|
|
22
31
|
flex-direction: column;
|
|
23
|
-
padding:
|
|
32
|
+
padding: var(--space-2);
|
|
24
33
|
background: var(--surface);
|
|
25
|
-
border:
|
|
26
|
-
border-radius:
|
|
27
|
-
box-shadow:
|
|
28
|
-
|
|
34
|
+
border: var(--line) solid var(--border-strong);
|
|
35
|
+
border-radius: var(--radius-lg);
|
|
36
|
+
box-shadow:
|
|
37
|
+
inset 0 1px 0 var(--glass-edge),
|
|
38
|
+
var(--shadow-popover);
|
|
39
|
+
color: var(--text);
|
|
40
|
+
font-family: var(--font-mono);
|
|
41
|
+
font-size: var(--menu-font-size);
|
|
42
|
+
font-weight: var(--font-weight-regular);
|
|
43
|
+
line-height: var(--line-height-body);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* A compact menu: the small size, for a menu of short commands opened from
|
|
47
|
+
a tool (a column chooser, a row's actions, a legend's overflow). */
|
|
48
|
+
.folder-menu-compact {
|
|
49
|
+
--menu-font-size: var(--font-size-small);
|
|
29
50
|
}
|
|
30
51
|
|
|
31
52
|
/* A menu's query row is a filter field: the icon stands over the rows'
|
|
32
53
|
icons (the menu's padding plus a row's put both 10px in), and the rule
|
|
33
54
|
under it is the accent a focused field wears, which a menu's always is. */
|
|
34
|
-
|
|
55
|
+
.folder-menu-query {
|
|
35
56
|
display: flex;
|
|
36
57
|
align-items: center;
|
|
37
|
-
height:
|
|
38
|
-
margin: -
|
|
39
|
-
padding: 0
|
|
40
|
-
border-bottom:
|
|
41
|
-
font-size:
|
|
58
|
+
height: var(--bar-height);
|
|
59
|
+
margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) var(--space-2);
|
|
60
|
+
padding: 0 var(--space-5);
|
|
61
|
+
border-bottom: var(--line) solid var(--accent);
|
|
62
|
+
font-size: var(--font-size-small);
|
|
42
63
|
}
|
|
43
64
|
|
|
44
65
|
/* The field keeps room for its placeholder, so a long target name gives way
|
|
45
|
-
before the words that say the field filters.
|
|
46
|
-
|
|
66
|
+
before the words that say the field filters. The typed words are the
|
|
67
|
+
accent as words; the caret keeps the accent itself. The placeholder is the
|
|
68
|
+
base sheet's. */
|
|
69
|
+
.folder-menu-query input {
|
|
47
70
|
flex: 1;
|
|
48
71
|
min-width: 14ch;
|
|
49
72
|
height: 100%;
|
|
73
|
+
padding: 0;
|
|
50
74
|
border: none;
|
|
51
75
|
background: transparent;
|
|
52
|
-
color: var(--accent);
|
|
76
|
+
color: var(--accent-text);
|
|
53
77
|
font: inherit;
|
|
54
78
|
caret-color: var(--accent);
|
|
55
79
|
}
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
/* A menu's focus mark is its cursor row: the menu, or the list a script
|
|
82
|
+
focuses to take the keys, draws no ring, as a desktop menu has none. */
|
|
83
|
+
.folder-menu:focus-visible,
|
|
84
|
+
.folder-menu :is(.folder-menu-options, [role='listbox'], [role='menu']):focus-visible {
|
|
58
85
|
outline: none;
|
|
59
86
|
}
|
|
60
87
|
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
/* The field's focus is the accent rule under the row, always on. */
|
|
89
|
+
.folder-menu-query input:focus {
|
|
90
|
+
outline: none;
|
|
63
91
|
}
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
.folder-menu-count {
|
|
66
94
|
margin-left: 1ch;
|
|
67
95
|
color: var(--text-dim);
|
|
68
96
|
font-family: var(--font-ui);
|
|
69
|
-
font-size:
|
|
97
|
+
font-size: var(--font-size-caption);
|
|
70
98
|
font-variant-numeric: tabular-nums;
|
|
71
99
|
white-space: nowrap;
|
|
72
100
|
}
|
|
73
101
|
|
|
74
|
-
|
|
102
|
+
/* Nine whole rows, so the list never ends on half of one (a group heading
|
|
103
|
+
is one row tall too, so any mix of headings and rows ends whole); a list
|
|
104
|
+
that scrolls says so with a thin bar in the base sheet's scrollbar
|
|
105
|
+
colours and fades the edge that has more rows (below). The menu's frame
|
|
106
|
+
is outside the list, so the fade never erases it. */
|
|
107
|
+
.folder-menu-options {
|
|
75
108
|
/* The options' offset parent, so the cursor row scrolls into view here. */
|
|
76
109
|
position: relative;
|
|
77
|
-
max-height:
|
|
110
|
+
max-height: calc(9 * var(--row-height));
|
|
78
111
|
overflow-y: auto;
|
|
112
|
+
scrollbar-width: thin;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The base sheet's block fade (.scroll-fade), on every menu list: its
|
|
116
|
+
keyframes and lengths, so an edge with nothing past it stays sharp, and
|
|
117
|
+
its padding-box mask, so the list's scrollbar stays solid. The fade is
|
|
118
|
+
one row deep, not the base sheet's 12px: a row's glyphs sit in its middle
|
|
119
|
+
12px, so a 12px fade would dim only a row's empty edge, where a whole
|
|
120
|
+
row fading through its words says "more" at a glance. */
|
|
121
|
+
@supports (animation-timeline: scroll()) {
|
|
122
|
+
.folder-menu-options {
|
|
123
|
+
--scroll-fade-size: var(--row-height);
|
|
124
|
+
|
|
125
|
+
mask-image:
|
|
126
|
+
linear-gradient(var(--ground), var(--ground)), linear-gradient(var(--ground), var(--ground)),
|
|
127
|
+
linear-gradient(
|
|
128
|
+
to bottom,
|
|
129
|
+
transparent,
|
|
130
|
+
var(--ground) var(--scroll-fade-start),
|
|
131
|
+
var(--ground) calc(100% - var(--scroll-fade-end)),
|
|
132
|
+
transparent
|
|
133
|
+
);
|
|
134
|
+
mask-clip: padding-box, border-box, padding-box;
|
|
135
|
+
mask-origin: padding-box, border-box, padding-box;
|
|
136
|
+
mask-repeat: no-repeat;
|
|
137
|
+
mask-composite: exclude, exclude, add;
|
|
138
|
+
animation: uiok-scroll-fade-block linear both;
|
|
139
|
+
animation-timeline: scroll(self block);
|
|
140
|
+
}
|
|
79
141
|
}
|
|
80
142
|
|
|
81
|
-
:
|
|
143
|
+
/* An option: its icon, its name, and a trailing column (a chord, a count).
|
|
144
|
+
Rows change at once, as a native menu's do: the cursor row follows the
|
|
145
|
+
keys and the pointer with no fade. */
|
|
146
|
+
.folder-menu-option {
|
|
82
147
|
display: grid;
|
|
83
|
-
grid-template-columns:
|
|
148
|
+
grid-template-columns: var(--icon-column) minmax(0, 1fr) auto;
|
|
149
|
+
column-gap: 0;
|
|
84
150
|
align-items: center;
|
|
85
|
-
height:
|
|
86
|
-
padding: 0
|
|
87
|
-
border-radius:
|
|
151
|
+
height: var(--row-height);
|
|
152
|
+
padding: 0 var(--space-4) 0 var(--space-3);
|
|
153
|
+
border-radius: var(--radius-sm);
|
|
88
154
|
cursor: default;
|
|
89
155
|
}
|
|
90
156
|
|
|
91
|
-
|
|
92
|
-
|
|
157
|
+
/* A chord in the trailing column keeps its distance from the name. It is
|
|
158
|
+
drawn as key caps, as every chord in a menu or a palette is (keychord.css
|
|
159
|
+
lists the menu row), so it keeps the cap's own text on the cap's ground
|
|
160
|
+
on every row, the cursor row included. */
|
|
161
|
+
/* A row drawn on a native button (a context menu's command) is the same
|
|
162
|
+
row: a zero-weight reset takes away the button's bezel, ground, and
|
|
163
|
+
face, so every rule above and below still wins. */
|
|
164
|
+
:where(button.folder-menu-option) {
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
width: 100%;
|
|
167
|
+
margin: 0;
|
|
168
|
+
border: 0;
|
|
169
|
+
background: none;
|
|
170
|
+
color: inherit;
|
|
171
|
+
font: inherit;
|
|
172
|
+
text-align: start;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.folder-menu-option > .keychord {
|
|
176
|
+
margin-left: var(--space-5);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* The cursor row: the cursor fill and, at its leading edge, the 2px accent
|
|
180
|
+
bar a listing's cursor row wears, so the row is found at a glance. A
|
|
181
|
+
disabled row never takes it. Quiet words on it switch to the tone made
|
|
182
|
+
for that fill. */
|
|
183
|
+
.folder-menu-option.cursor:not([aria-disabled='true']) {
|
|
184
|
+
background: var(--cursor-row);
|
|
185
|
+
box-shadow: inset var(--line-strong) 0 0 var(--cursor-bar);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.folder-menu-option.cursor:not([aria-disabled='true']) :is(.row-icon, .row-meta) {
|
|
189
|
+
color: var(--text-on-surface);
|
|
93
190
|
}
|
|
94
191
|
|
|
95
|
-
|
|
96
|
-
|
|
192
|
+
/* A destructive command (Delete, Drop) says so in the danger tone, its
|
|
193
|
+
icon with it, at rest and on the cursor row, as a row's destructive
|
|
194
|
+
action does. --danger-text keeps 4.5:1 on the menu and the cursor row. */
|
|
195
|
+
.folder-menu-option.danger,
|
|
196
|
+
.folder-menu-option.danger .row-icon,
|
|
197
|
+
.folder-menu-option.danger.cursor:not([aria-disabled='true']) .row-icon {
|
|
198
|
+
color: var(--danger-text);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* A note under the rows (why a list is short, what a key does), in the
|
|
202
|
+
interface face, its text over the rows' names. It explains a state, so
|
|
203
|
+
it wraps to two lines before it is cut; past two lines it is cut with an
|
|
204
|
+
ellipsis, its whole text in the host's tooltip. Why one row cannot be picked goes in that row's own tooltip,
|
|
205
|
+
not here. */
|
|
206
|
+
.folder-menu-note {
|
|
207
|
+
display: -webkit-box;
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
padding: var(--space-2) var(--space-4) var(--space-2) calc(var(--space-3) + var(--icon-column));
|
|
97
210
|
color: var(--text-dim);
|
|
98
211
|
font-family: var(--font-ui);
|
|
99
|
-
font-size:
|
|
212
|
+
font-size: var(--font-size-small);
|
|
213
|
+
line-height: var(--line-height-compact);
|
|
214
|
+
-webkit-box-orient: vertical;
|
|
215
|
+
-webkit-line-clamp: 2;
|
|
216
|
+
line-clamp: 2;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* A checked row (aria-checked='true': a setting the row turns on and off,
|
|
220
|
+
or the one chosen of a group) shows a check mark in its icon column
|
|
221
|
+
in the text colour, as a desktop menu does. A checked row's own icon gives way to the mark. */
|
|
222
|
+
.folder-menu-option[aria-checked='true'] > .row-icon > * {
|
|
223
|
+
display: none;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.folder-menu-option[aria-checked='true'] > .row-icon::before {
|
|
227
|
+
content: '';
|
|
228
|
+
width: var(--icon-md);
|
|
229
|
+
height: var(--icon-md);
|
|
230
|
+
background: var(--text);
|
|
231
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
|
|
232
|
+
center / contain no-repeat;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* A row that opens a submenu (aria-haspopup='menu') ends in a chevron at
|
|
236
|
+
its trailing edge, in place of a chord, as a desktop menu's does. */
|
|
237
|
+
.folder-menu-option[aria-haspopup='menu']::after {
|
|
238
|
+
content: '';
|
|
239
|
+
grid-column: 3;
|
|
240
|
+
justify-self: end;
|
|
241
|
+
width: var(--icon-sm);
|
|
242
|
+
height: var(--icon-sm);
|
|
243
|
+
margin-left: var(--space-5);
|
|
244
|
+
background: var(--text-dim);
|
|
245
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")
|
|
246
|
+
center / contain no-repeat;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.folder-menu-option.cursor[aria-haspopup='menu']:not([aria-disabled='true'])::after {
|
|
250
|
+
background: var(--text-on-surface);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* A plain separator between groups of rows that need no name: a hairline
|
|
254
|
+
in the border colour with a small space above and below, as a desktop
|
|
255
|
+
menu draws one. */
|
|
256
|
+
.folder-menu-separator {
|
|
257
|
+
height: var(--line);
|
|
258
|
+
margin: var(--space-2) var(--space-3);
|
|
259
|
+
background: var(--border);
|
|
100
260
|
}
|
|
101
261
|
|
|
102
262
|
/* A group's name with a hairline running out from it on the same line, so a
|
|
103
|
-
group costs one
|
|
104
|
-
|
|
263
|
+
group costs one row and still reads as a break. It is exactly one row
|
|
264
|
+
tall, so a list's height in rows holds whatever headings it has. The name
|
|
265
|
+
wears the library's small uppercase heading, which the base sheet writes
|
|
266
|
+
once for .overline and this class together; here is only its layout. */
|
|
267
|
+
.entry-menu-heading {
|
|
105
268
|
display: flex;
|
|
106
269
|
align-items: center;
|
|
107
|
-
gap:
|
|
108
|
-
height:
|
|
109
|
-
padding:
|
|
110
|
-
color: var(--text-dim);
|
|
111
|
-
font-family: var(--font-ui);
|
|
112
|
-
font-size: 10.5px;
|
|
113
|
-
font-weight: 600;
|
|
114
|
-
letter-spacing: 0.04em;
|
|
270
|
+
gap: var(--space-4);
|
|
271
|
+
height: var(--row-height);
|
|
272
|
+
padding: var(--space-1) var(--space-3) 0 var(--space-4);
|
|
115
273
|
}
|
|
116
274
|
|
|
117
|
-
|
|
275
|
+
.entry-menu-heading::after {
|
|
118
276
|
content: '';
|
|
119
277
|
flex: 1;
|
|
120
|
-
height:
|
|
278
|
+
height: var(--line);
|
|
121
279
|
background: var(--border);
|
|
122
280
|
}
|
|
123
281
|
|
|
@@ -126,41 +284,43 @@
|
|
|
126
284
|
`bell-0` and `bell-1` on consecutive rings (useBellBeat), and the paired
|
|
127
285
|
keyframe names are identical on purpose: a changed animation-name is what
|
|
128
286
|
restarts a CSS animation, so every refused key shoves again. An app's own
|
|
129
|
-
filter field or cursor row may ring on the same keyframes.
|
|
130
|
-
|
|
287
|
+
filter field or cursor row may ring on the same keyframes. The shake and
|
|
288
|
+
the red share --duration-slow, so they end together. */
|
|
289
|
+
.folder-menu-query.bell-0 input {
|
|
131
290
|
animation:
|
|
132
|
-
row-nudge-a
|
|
133
|
-
query-refused-a
|
|
291
|
+
row-nudge-a var(--duration-slow) var(--ease-in-out),
|
|
292
|
+
query-refused-a var(--duration-slow) var(--ease-out);
|
|
134
293
|
}
|
|
135
294
|
|
|
136
|
-
|
|
295
|
+
.folder-menu-query.bell-1 input {
|
|
137
296
|
animation:
|
|
138
|
-
row-nudge-b
|
|
139
|
-
query-refused-b
|
|
297
|
+
row-nudge-b var(--duration-slow) var(--ease-in-out),
|
|
298
|
+
query-refused-b var(--duration-slow) var(--ease-out);
|
|
140
299
|
}
|
|
141
300
|
|
|
142
|
-
/* Without motion a query keeps only its red
|
|
301
|
+
/* Without motion a query keeps only its red, for --duration-signal, which
|
|
302
|
+
reduced motion leaves running (--duration-slow is 0 there). */
|
|
143
303
|
@media (prefers-reduced-motion: reduce) {
|
|
144
|
-
|
|
145
|
-
animation: query-refused-a
|
|
304
|
+
.folder-menu-query.bell-0 input {
|
|
305
|
+
animation: query-refused-a var(--duration-signal) var(--ease-out);
|
|
146
306
|
}
|
|
147
307
|
|
|
148
|
-
|
|
149
|
-
animation: query-refused-b
|
|
308
|
+
.folder-menu-query.bell-1 input {
|
|
309
|
+
animation: query-refused-b var(--duration-signal) var(--ease-out);
|
|
150
310
|
}
|
|
151
311
|
}
|
|
152
312
|
|
|
153
313
|
@keyframes query-refused-a {
|
|
154
314
|
0%,
|
|
155
315
|
70% {
|
|
156
|
-
color: var(--danger);
|
|
316
|
+
color: var(--danger-text);
|
|
157
317
|
}
|
|
158
318
|
}
|
|
159
319
|
|
|
160
320
|
@keyframes query-refused-b {
|
|
161
321
|
0%,
|
|
162
322
|
70% {
|
|
163
|
-
color: var(--danger);
|
|
323
|
+
color: var(--danger-text);
|
|
164
324
|
}
|
|
165
325
|
}
|
|
166
326
|
|
package/dist/menu/useBellBeat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* How long a refusal's classes stay on, in milliseconds. Longer than the
|
|
4
|
-
*
|
|
5
|
-
* class is taken away.
|
|
4
|
+
* nudge and the red flash in menu.css, which both run for `--duration-slow`
|
|
5
|
+
* (280 ms), so both finish before their class is taken away.
|
|
6
6
|
*/
|
|
7
7
|
const BELL_BEAT_MS = 300;
|
|
8
8
|
/**
|
|
@@ -13,7 +13,9 @@ export interface NameCutProps {
|
|
|
13
13
|
* after the name give way at their end alongside it, the words before it
|
|
14
14
|
* give way at their end only once both have gone as far as they go, and
|
|
15
15
|
* the name's tail, at its front, only once those words have too, so the
|
|
16
|
-
* line always ends in view. A
|
|
16
|
+
* line always ends in view. A cut head, and cut words around the name, are
|
|
17
|
+
* snapped to whole characters, so an ellipsis meets the next part with no
|
|
18
|
+
* blank between them. A line with a cut name is drawn in parts for
|
|
17
19
|
* sight only, and assistive technology reads it whole once; a line of words
|
|
18
20
|
* alone is drawn and read as it is. The tooltip carries the complete line,
|
|
19
21
|
* including the words around the name. Styled by the `.name-cut` rules;
|
package/dist/namecut/NameCut.js
CHANGED
|
@@ -1,14 +1,159 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useLayoutEffect, useRef } from 'react';
|
|
3
3
|
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
4
4
|
import { partsText } from './NameCut.logic.js';
|
|
5
|
+
/** A name whose first letter is in a right-to-left script reads right to left. */
|
|
6
|
+
const RIGHT_TO_LEFT = /^[^\p{L}]*[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u;
|
|
7
|
+
/** The closing quote `nameParts` keeps at a cut name's end. */
|
|
8
|
+
const CLOSING_QUOTE = /["”“»«]$/u;
|
|
9
|
+
/** The opening quote `nameParts` keeps at a cut name's start. */
|
|
10
|
+
const OPENING_QUOTE = /^["“„«»”]/u;
|
|
11
|
+
/** The ellipsis a cut head ends in, as the browser draws it for `text-overflow`. */
|
|
12
|
+
const ELLIPSIS = '\u2026';
|
|
13
|
+
/** A canvas context to measure the ellipsis in a head's own face; created once. */
|
|
14
|
+
let measurer;
|
|
15
|
+
/** The width of `text` in `box`'s face, or null where nothing measures text. */
|
|
16
|
+
function textWidth(box, text) {
|
|
17
|
+
if (measurer === undefined) {
|
|
18
|
+
try {
|
|
19
|
+
measurer = document.createElement('canvas').getContext('2d');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
measurer = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (measurer === null)
|
|
26
|
+
return null;
|
|
27
|
+
// The `font` shorthand reads back empty in some engines; build it.
|
|
28
|
+
const face = getComputedStyle(box);
|
|
29
|
+
measurer.font = `${face.fontStyle} ${face.fontWeight} ${face.fontSize} ${face.fontFamily}`;
|
|
30
|
+
return measurer.measureText(text).width;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The parts of a line that cut their words with an ellipsis, in the order
|
|
34
|
+
* they give way: a name's head and the words after it first, the words
|
|
35
|
+
* before the name only once those have gone as far as they go.
|
|
36
|
+
*/
|
|
37
|
+
const CUT_TIERS = ['.name-cut-head, .name-cut-rest', '.name-cut-text'];
|
|
38
|
+
/**
|
|
39
|
+
* Narrows a cut box (a name's head, or the words around the name) to the
|
|
40
|
+
* whole characters that fit before its ellipsis, and the ellipsis: the box
|
|
41
|
+
* the line's flex gives it is no whole number of characters, and a box
|
|
42
|
+
* squeezed to its floor is wider than the one character and ellipsis it
|
|
43
|
+
* shows, so a blank would stand after the ellipsis, which reads as a space
|
|
44
|
+
* before the next part. The blank goes to the line's end instead. A box
|
|
45
|
+
* shown whole, or one with nothing to measure, keeps the width the line
|
|
46
|
+
* gives it. Each box is measured with the snap of every earlier tier
|
|
47
|
+
* already held (`useSnappedCuts`).
|
|
48
|
+
*/
|
|
49
|
+
function snapCut(box) {
|
|
50
|
+
const text = box.firstChild;
|
|
51
|
+
const room = box.clientWidth;
|
|
52
|
+
if (!(text instanceof Text) || box.scrollWidth <= room)
|
|
53
|
+
return;
|
|
54
|
+
const dots = textWidth(box, ELLIPSIS);
|
|
55
|
+
if (dots === null)
|
|
56
|
+
return;
|
|
57
|
+
// Words that end in a space before the name (the name's opening quote
|
|
58
|
+
// starts the name's own head) keep a space after their ellipsis, so the
|
|
59
|
+
// cut words do not run into the name. The space comes out of their own
|
|
60
|
+
// room, never out of the parts that give way after them.
|
|
61
|
+
const space = box.classList.contains('name-cut-text') && /\s\p{P}?$/u.test(text.data)
|
|
62
|
+
? (textWidth(box, ' ') ?? 0)
|
|
63
|
+
: 0;
|
|
64
|
+
const fitsIn = room - space;
|
|
65
|
+
const range = document.createRange();
|
|
66
|
+
const prefix = (count) => {
|
|
67
|
+
range.setStart(text, 0);
|
|
68
|
+
range.setEnd(text, count);
|
|
69
|
+
return range.getBoundingClientRect().width;
|
|
70
|
+
};
|
|
71
|
+
// The most characters that, with the ellipsis, fit the room.
|
|
72
|
+
let fits = 0;
|
|
73
|
+
let over = text.length;
|
|
74
|
+
while (over - fits > 1) {
|
|
75
|
+
const middle = Math.floor((fits + over) / 2);
|
|
76
|
+
if (prefix(middle) + dots <= fitsIn)
|
|
77
|
+
fits = middle;
|
|
78
|
+
else
|
|
79
|
+
over = middle;
|
|
80
|
+
}
|
|
81
|
+
// Squeezed to its floor, the box still keeps its space before the name.
|
|
82
|
+
if (fits === 0) {
|
|
83
|
+
if (space > 0)
|
|
84
|
+
box.style.marginInlineEnd = `${space}px`;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Half a pixel more than the characters and the ellipsis: the engine
|
|
88
|
+
// lays boxes out in fractions of a pixel and would round a width set to
|
|
89
|
+
// the exact sum below it, then drop one more character.
|
|
90
|
+
const width = Math.min(prefix(fits) + dots + 0.5, fitsIn);
|
|
91
|
+
if (width === room)
|
|
92
|
+
return;
|
|
93
|
+
// Held at that width, under the floor the stylesheet keeps for any face:
|
|
94
|
+
// nothing on the line grows, so the room it gives up stands at the
|
|
95
|
+
// line's end.
|
|
96
|
+
box.style.width = `${width}px`;
|
|
97
|
+
box.style.minWidth = `${width}px`;
|
|
98
|
+
box.style.flexShrink = '0';
|
|
99
|
+
if (space > 0)
|
|
100
|
+
box.style.marginInlineEnd = `${space}px`;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Keeps each cut box in `line` a whole number of characters wide
|
|
104
|
+
* (`snapCut`) as its box resizes and its parts change. Nothing to do
|
|
105
|
+
* where the engine has no ResizeObserver (jsdom).
|
|
106
|
+
*/
|
|
107
|
+
function useSnappedCuts(line, parts) {
|
|
108
|
+
useLayoutEffect(() => {
|
|
109
|
+
const element = line.current;
|
|
110
|
+
if (element === null || typeof ResizeObserver === 'undefined')
|
|
111
|
+
return;
|
|
112
|
+
// Every box is let go first, so each is measured against the line as
|
|
113
|
+
// the stylesheet lays it out; then a tier is snapped only once the
|
|
114
|
+
// tier before it holds, since a held box hands back room to the next.
|
|
115
|
+
const snap = () => {
|
|
116
|
+
const tiers = CUT_TIERS.map((tier) => [...element.querySelectorAll(tier)]);
|
|
117
|
+
for (const box of tiers.flat()) {
|
|
118
|
+
for (const property of ['width', 'min-width', 'flex-shrink', 'margin-inline-end']) {
|
|
119
|
+
box.style.removeProperty(property);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const box of tiers.flat())
|
|
123
|
+
snapCut(box);
|
|
124
|
+
};
|
|
125
|
+
const observer = new ResizeObserver(snap);
|
|
126
|
+
observer.observe(element);
|
|
127
|
+
return () => observer.disconnect();
|
|
128
|
+
}, [line, parts]);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A cut name's head and tail, in the order they are seen. A left-to-right
|
|
132
|
+
* name shows its head, then its tail. A right-to-left name is seen the
|
|
133
|
+
* other way round inside the line: its tail (its end) on the left, its
|
|
134
|
+
* head (its start) on the right, between its opening quote on the left
|
|
135
|
+
* and its closing quote on the right, so the quotes still close around
|
|
136
|
+
* it; each box cuts on the side that gives way.
|
|
137
|
+
*/
|
|
138
|
+
function cutName(head, tail) {
|
|
139
|
+
if (!RIGHT_TO_LEFT.test(head + tail)) {
|
|
140
|
+
return (_jsxs(_Fragment, { children: [head !== '' && _jsx("span", { className: "name-cut-head", children: head }), _jsx("span", { className: "name-cut-tail", children: _jsx("bdi", { dir: "ltr", children: tail }) })] }));
|
|
141
|
+
}
|
|
142
|
+
const opening = OPENING_QUOTE.exec(head)?.[0] ?? '';
|
|
143
|
+
const start = head.slice(opening.length);
|
|
144
|
+
const quote = CLOSING_QUOTE.exec(tail)?.[0] ?? '';
|
|
145
|
+
const end = tail.slice(0, tail.length - quote.length);
|
|
146
|
+
return (_jsxs(_Fragment, { children: [opening !== '' && _jsx("span", { className: "name-cut-quote", children: opening }), _jsx("span", { className: "name-cut-tail rtl", children: _jsx("bdi", { dir: "rtl", children: end }) }), start !== '' && (_jsx("span", { className: "name-cut-head rtl", dir: "rtl", children: start })), quote !== '' && _jsx("span", { className: "name-cut-quote", children: quote })] }));
|
|
147
|
+
}
|
|
5
148
|
/**
|
|
6
149
|
* A line that names a file, cut so the name keeps its end (`labelParts`,
|
|
7
150
|
* `nameParts`): a long name's head gives way with an ellipsis, the words
|
|
8
151
|
* after the name give way at their end alongside it, the words before it
|
|
9
152
|
* give way at their end only once both have gone as far as they go, and
|
|
10
153
|
* the name's tail, at its front, only once those words have too, so the
|
|
11
|
-
* line always ends in view. A
|
|
154
|
+
* line always ends in view. A cut head, and cut words around the name, are
|
|
155
|
+
* snapped to whole characters, so an ellipsis meets the next part with no
|
|
156
|
+
* blank between them. A line with a cut name is drawn in parts for
|
|
12
157
|
* sight only, and assistive technology reads it whole once; a line of words
|
|
13
158
|
* alone is drawn and read as it is. The tooltip carries the complete line,
|
|
14
159
|
* including the words around the name. Styled by the `.name-cut` rules;
|
|
@@ -19,10 +164,12 @@ export function NameCut({ parts, className }) {
|
|
|
19
164
|
// one hidden copy; words alone are one span already.
|
|
20
165
|
const cut = parts.some((part) => part.kind === 'name');
|
|
21
166
|
const text = partsText(parts);
|
|
22
|
-
|
|
167
|
+
const box = useRef(null);
|
|
168
|
+
useSnappedCuts(box, parts);
|
|
169
|
+
return (_jsxs("span", { className: className ? `name-cut ${className}` : 'name-cut', ref: box, ...tooltip(text), children: [cut && _jsx("span", { className: "visually-hidden", children: text }), _jsx("span", { "aria-hidden": cut || undefined, className: "name-cut-line", children: parts.map((part, index) =>
|
|
23
170
|
// A line's parts are fixed in order; their place is their identity.
|
|
24
171
|
part.kind === 'text' ? (_jsx("span", {
|
|
25
172
|
// The words that end the line give way alongside a name's
|
|
26
173
|
// head; the words before a name only after both have.
|
|
27
|
-
className: index === parts.length - 1 ? 'name-cut-rest' : 'name-cut-text', children: part.text }, index)) : (
|
|
174
|
+
className: index === parts.length - 1 ? 'name-cut-rest' : 'name-cut-text', children: part.text }, index)) : (_jsx(Fragment, { children: cutName(part.head, part.tail) }, index))) })] }));
|
|
28
175
|
}
|
|
@@ -29,7 +29,9 @@ export declare function middleCut(name: string): {
|
|
|
29
29
|
/**
|
|
30
30
|
* A line built from words and names, each `{ name }` cut in its middle:
|
|
31
31
|
* `nameParts(['"', { name }, '" already exists'])`. A cut name keeps its
|
|
32
|
-
*
|
|
32
|
+
* opening quote in its head and its closing quote in its tail, so the words
|
|
33
|
+
* before the name never take its opening quote away with their cut, and
|
|
34
|
+
* both quotes stay in view however far the line gives way. A short
|
|
33
35
|
* name, which is never cut in its middle, joins the words around it, so a
|
|
34
36
|
* line that names only short names is words that give way at their end:
|
|
35
37
|
* the words after the name go first, and the name itself only once they
|
|
@@ -40,8 +42,8 @@ export declare function nameParts(segments: readonly (string | {
|
|
|
40
42
|
})[]): CutPart[];
|
|
41
43
|
/**
|
|
42
44
|
* A line that quotes a name (an operation's label, `"name" already
|
|
43
|
-
* exists`), its first quoted name cut in its middle, its
|
|
44
|
-
*
|
|
45
|
+
* exists`), its first quoted name cut in its middle, its opening quote
|
|
46
|
+
* kept with the name's head and its closing quote with its tail, and the rest of the line, later names
|
|
45
47
|
* included, after it as words that give way at their end:
|
|
46
48
|
* `Copying "Better.Call.Saul…CtrlHD.mkv" to "Seed…`. A
|
|
47
49
|
* line that quotes no name gives way at its end, as plain text does.
|