@pseudolux-ui/media-library 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pseudolux-ui/media-library",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Lightspeed components for browsing, describing, cropping and uploading Pseudolux pictures, over a port the host implements.",
5
5
  "license": "MIT",
6
6
  "author": "Nick Paustian",
package/src/checks.ts ADDED
@@ -0,0 +1,132 @@
1
+ /**
2
+ * What the editor says about a picture's words and how complete it is.
3
+ * Advice, never a gate: every check is something a person may overrule.
4
+ */
5
+
6
+ export interface Check {
7
+ tone: "ok" | "warn"
8
+ text: string
9
+ }
10
+
11
+ const FILE_NAME = /\.(jpe?g|png|webp|gif|avif|tiff?|heic|svg)\b/i
12
+ const SAYS_IMAGE = /^(an? |the )?(image|picture|photo(graph)?|pic|graphic) (of|showing|shows)\b/i
13
+
14
+ export const ALT_LENGTH = 150
15
+
16
+ /** The live checks under the alt text box. */
17
+ export const altChecks = (text: string): Check[] => {
18
+ const words = text.trim()
19
+ if (!words) {
20
+ return [{ tone: "warn", text: "Needs words. Say what matters on the pages it’s used on, in a sentence or two." }]
21
+ }
22
+ const out: Check[] = []
23
+ if (SAYS_IMAGE.test(words)) {
24
+ out.push({ tone: "warn", text: "No need to start with “image of”: screen readers already say it’s an image." })
25
+ }
26
+ if (FILE_NAME.test(words)) {
27
+ out.push({ tone: "warn", text: "Looks like a file name. Describe the picture instead." })
28
+ }
29
+ if (words.length > ALT_LENGTH) {
30
+ out.push({ tone: "warn", text: `${words.length} characters. Try to keep it under ${ALT_LENGTH}; put the rest in a caption.` })
31
+ }
32
+ if (!out.length) out.push({ tone: "ok", text: `${words.length} characters. Reads well.` })
33
+ return out
34
+ }
35
+
36
+ export interface Completeness {
37
+ done: number
38
+ of: number
39
+ missing: string[]
40
+ }
41
+
42
+ /** How much of a picture's record is filled in, and what is left. */
43
+ export const completeness = (item: {
44
+ altText?: string
45
+ credit?: string
46
+ labels?: unknown[]
47
+ focal?: unknown
48
+ crops?: Record<string, unknown>
49
+ }): Completeness => {
50
+ const parts: Array<[string, boolean]> = [
51
+ ["alt text", Boolean(item.altText && item.altText.trim())],
52
+ ["credit", Boolean(item.credit && item.credit.trim())],
53
+ ["labels", Boolean(item.labels && item.labels.length)],
54
+ ["focal point", Boolean(item.focal)],
55
+ ]
56
+ return {
57
+ done: parts.filter(([, ok]) => ok).length,
58
+ of: parts.length,
59
+ missing: parts.filter(([, ok]) => !ok).map(([name]) => name),
60
+ }
61
+ }
62
+
63
+ const channel = (value: number): number => {
64
+ const c = value / 255
65
+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
66
+ }
67
+
68
+ const luminance = (hex: string): number => {
69
+ const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim())
70
+ if (!match || !match[1]) return 0.5
71
+ const n = parseInt(match[1], 16)
72
+ return 0.2126 * channel((n >> 16) & 255) + 0.7152 * channel((n >> 8) & 255) + 0.0722 * channel(n & 255)
73
+ }
74
+
75
+ const contrast = (a: number, b: number): number => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05)
76
+
77
+ /** Large text needs 3:1 against what is behind it. */
78
+ const LARGE_TEXT = 3
79
+
80
+ /**
81
+ * Whether white or dark text can sit on a picture, judged by the colours it
82
+ * is mostly made of. A guide for a headline over a hero, not a measurement
83
+ * of any one spot.
84
+ */
85
+ export const textOver = (palette: Array<{ hex: string; weight: number }>): string => {
86
+ if (!palette.length) return ""
87
+ const total = palette.reduce((sum, one) => sum + one.weight, 0) || 1
88
+ const share = (text: number) =>
89
+ palette.filter((one) => contrast(luminance(one.hex), text) >= LARGE_TEXT).reduce((sum, one) => sum + one.weight, 0) / total
90
+ const white = share(1)
91
+ const dark = share(luminance("#111111"))
92
+ const say = (portion: number, name: string): string =>
93
+ portion >= 0.9 ? `${name} text is readable over it.` : portion >= 0.4 ? `${name} text is readable over parts of it.` : `${name} text isn't readable over it.`
94
+ return say(white, "White") + " " + say(dark, "Dark")
95
+ }
96
+
97
+ export interface Flag {
98
+ /** "danger" stops a picture doing its job; "warn" is worth a look. */
99
+ tone: "danger" | "warn"
100
+ label: string
101
+ detail: string
102
+ fix: string
103
+ }
104
+
105
+ /**
106
+ * What is wrong with a picture's file, judged from its size against the
107
+ * shapes the sites show it at. Too small for every shape is a problem; too
108
+ * small for some is a caution.
109
+ */
110
+ export const flagsOf = (
111
+ item: { width?: number; height?: number },
112
+ presets: Array<{ label: string; ratio: number; minWidth?: number }>,
113
+ ): Flag[] => {
114
+ if (!item.width || !item.height) return []
115
+ const sized = presets.filter((one) => one.minWidth)
116
+ if (!sized.length) return []
117
+ const aspect = item.width / item.height
118
+ // The widest cut of each shape the picture can give.
119
+ const short = sized.filter((one) => (one.ratio >= aspect ? item.width! : Math.round(item.height! * one.ratio)) < one.minWidth!)
120
+ if (!short.length) return []
121
+ const all = short.length === sized.length
122
+ return [
123
+ {
124
+ tone: all ? "danger" : "warn",
125
+ label: all ? "Too small" : "Small for " + short.map((one) => one.label.toLowerCase()).join(", "),
126
+ detail: all
127
+ ? `At ${item.width} px wide it will look soft in every shape the sites use.`
128
+ : short.map((one) => `${one.label} is shown up to ${one.minWidth} px wide`).join("; ") + ".",
129
+ fix: "Replace it with a larger file, or find a bigger one.",
130
+ },
131
+ ]
132
+ }
@@ -0,0 +1,526 @@
1
+ <view>
2
+ <div class="px-scrim scrim" $show="state.open" @click="backdrop">
3
+ <div class="px-dialog bar" role="dialog" aria-modal="true" aria-label="Find or do anything" @keydown="onKey">
4
+ <div class="ask">
5
+ <button class="px-chip ctx" type="button" $show="state.context" title="Step back: act on nothing picked" @click="dropContext">{{ state.context }} <span aria-hidden="true">×</span></button>
6
+ <input
7
+ class="q"
8
+ type="text"
9
+ role="combobox"
10
+ aria-autocomplete="list"
11
+ aria-controls="command-list"
12
+ aria-expanded="true"
13
+ $aria-activedescendant="state.activeId"
14
+ $aria-label="state.prompt"
15
+ $placeholder="state.prompt"
16
+ autocomplete="off"
17
+ spellcheck="false"
18
+ $ref="input"
19
+ @input="onInput"
20
+ />
21
+ <span class="px-kbd">Esc</span>
22
+ </div>
23
+
24
+ <div class="list" id="command-list" role="listbox" aria-label="Commands" $show="!state.keysOpen" $ref="list">
25
+ <div class="sec" role="group" $for="section in state.sections" $key="section.title" $aria-label="section.title">
26
+ <div class="sec-h" aria-hidden="true">{{ section.title }}</div>
27
+ <div
28
+ class="cmd"
29
+ role="option"
30
+ $for="one in section.items"
31
+ $key="one.id"
32
+ $id="one.id"
33
+ $aria-selected="one.id === state.activeId"
34
+ @click="runById(one.id)"
35
+ @mousemove="hover(one.id)"
36
+ >
37
+ <span class="cmd-label">{{ one.label }}</span>
38
+ <span class="px-subtle" $show="one.hint">{{ one.hint }}</span>
39
+ <span class="px-kbd" $show="one.key">{{ one.key }}</span>
40
+ </div>
41
+ </div>
42
+ <p class="px-muted none" $show="!state.sections.length">Nothing to do with that.</p>
43
+ </div>
44
+
45
+ <div class="keys" $show="state.keysOpen">
46
+ <table>
47
+ <caption>Keys</caption>
48
+ <tbody>
49
+ <tr $for="row in state.keyRows" $key="row.what"><th scope="row">{{ row.what }}</th><td>{{ row.keys }}</td></tr>
50
+ </tbody>
51
+ </table>
52
+ <label class="letters"><input type="checkbox" $checked="state.lettersOn" @change="toggleLetters" /> Single-letter keys (they only work outside text boxes)</label>
53
+ <button class="px-btn px-btn-ghost px-btn-sm" type="button" @click="closeKeys">Back to commands</button>
54
+ </div>
55
+
56
+ <div class="foot" aria-hidden="true">
57
+ <span><span class="px-kbd">↑</span> <span class="px-kbd">↓</span> move</span>
58
+ <span><span class="px-kbd">Enter</span> do it</span>
59
+ <span $show="state.context"><span class="px-kbd">⌫</span> step back</span>
60
+ </div>
61
+ <span class="sr-only" role="status">{{ state.announce }}</span>
62
+ </div>
63
+ </div>
64
+ </view>
65
+
66
+ <logic lang="ts">
67
+ import { reactive, onMounted, onUnmounted, shared, defineRefs } from '@lightspeed-js/core'
68
+ import { canWrite, letterKeys, setLetterKeys, TAB, SENTENCE, SELECTED, PICKED, SET, CAPABILITIES, COMMAND, UPLOAD, OWN_BIN } from '../config.ts'
69
+ import { BLANK, parse, said } from '../sentence.ts'
70
+
71
+ /**
72
+ * One box that finds a picture or does a thing, from anywhere in the
73
+ * library. With pictures picked it acts on them first; Backspace in the
74
+ * empty box steps back to acting on nothing.
75
+ */
76
+ const refs = defineRefs()
77
+
78
+ const SAVED_KEY = 'pseudolux:sentences'
79
+ const REASONS = ['Duplicate', 'Poor quality', 'Rights have ended', 'No longer needed']
80
+
81
+ const KEY_ROWS = [
82
+ { what: 'Find or do anything', keys: '⌘K or Ctrl K' },
83
+ { what: 'Search here', keys: '/' },
84
+ { what: 'Move between pictures', keys: 'Arrow keys, Home, End' },
85
+ { what: 'Peek, quick look, open the editor', keys: 'Click, Space, Enter' },
86
+ { what: 'Pick, pick a range, pick all', keys: 'X, Shift X, ⌘A' },
87
+ { what: 'Label the picked', keys: 'L' },
88
+ { what: 'Describe one by one', keys: 'D' },
89
+ { what: 'Get a link', keys: 'Shift L' },
90
+ { what: 'Move the picked to the bin', keys: 'Backspace' },
91
+ { what: 'Upload', keys: 'U' },
92
+ { what: 'Go to Desk, All pictures, Groups', keys: 'G then D, A, G' },
93
+ { what: 'Close, or clear picks', keys: 'Esc' },
94
+ ]
95
+
96
+ const state = reactive({
97
+ open: false,
98
+ context: '',
99
+ prompt: 'Find a picture or do something',
100
+ sections: [],
101
+ activeId: '',
102
+ keysOpen: false,
103
+ keyRows: KEY_ROWS,
104
+ lettersOn: true,
105
+ announce: '',
106
+ })
107
+
108
+ const tab = shared(TAB)
109
+ const sentence = shared(SENTENCE)
110
+ const selected = shared(SELECTED)
111
+ const picked = shared(PICKED)
112
+ const set = shared(SET)
113
+ const capabilities = shared(CAPABILITIES)
114
+ const command = shared(COMMAND)
115
+ const upload = shared(UPLOAD)
116
+ const ownBin = shared(OWN_BIN)
117
+
118
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many)
119
+
120
+ let query = ''
121
+ // A command that needs one more answer: 'label' or 'bin'.
122
+ let step = ''
123
+ let useContext = true
124
+ let actions = new Map()
125
+ let order = []
126
+ let opener = null
127
+
128
+ const pickedNow = () => (useContext ? picked.value || [] : [])
129
+
130
+ function savedSentences() {
131
+ try {
132
+ const kept = JSON.parse(localStorage.getItem(SAVED_KEY) || '[]')
133
+ return Array.isArray(kept) ? kept.filter((one) => one && one.name && one.sentence) : []
134
+ } catch {
135
+ return []
136
+ }
137
+ }
138
+
139
+ function ask(name, arg) {
140
+ command.value = { name, arg, at: Date.now() }
141
+ }
142
+
143
+ function go(where) {
144
+ tab.value = where
145
+ }
146
+
147
+ function build() {
148
+ const about = capabilities.value || {}
149
+ const groups = about.groups || []
150
+ const ids = pickedNow()
151
+ const n = ids.length
152
+ const words = query.trim().toLowerCase()
153
+ const sections = []
154
+ actions = new Map()
155
+ let serial = 0
156
+ const item = (label, run, extra = {}) => {
157
+ const id = 'command-' + ++serial
158
+ actions.set(id, run)
159
+ return { id, label, hint: '', key: '', ...extra }
160
+ }
161
+ const matches = (label) => !words || words.split(/\s+/).every((word) => label.toLowerCase().includes(word))
162
+
163
+ state.context = n ? n + ' picked' : ''
164
+
165
+ if (step === 'label') {
166
+ state.prompt = 'Label for ' + plural(n, 'picture', 'pictures')
167
+ const term = query.trim()
168
+ sections.push({ title: 'Add a label', items: term ? [item('Add label “' + term + '” to ' + plural(n, 'picture', 'pictures'), () => ask('label', term))] : [] })
169
+ } else if (step === 'bin') {
170
+ state.prompt = 'Why are they going in the bin?'
171
+ sections.push({ title: 'Move ' + plural(n, 'picture', 'pictures') + ' to the bin', items: REASONS.filter(matches).map((reason) => item(reason, () => ask('bin', reason))) })
172
+ } else {
173
+ state.prompt = n ? 'Do something with the ' + n + ' picked, or find a picture' : 'Find a picture or do something'
174
+ // "label eofy" is the whole command in one line.
175
+ const shorthand = /^label\s+(.+)$/i.exec(query.trim())
176
+
177
+ if (n && canWrite()) {
178
+ const forPicked = []
179
+ if (shorthand && about.describe) forPicked.push(item('Add label “' + shorthand[1].trim() + '” to ' + plural(n, 'picture', 'pictures'), () => ask('label', shorthand[1].trim())))
180
+ if (about.describe && matches('describe one by one')) forPicked.push(item('Describe one by one', () => ask('describe'), { key: 'D' }))
181
+ if (about.describe && matches('add a label') && !shorthand) forPicked.push(item('Add a label…', () => enter('label'), { key: 'L' }))
182
+ if (about.remove && matches('move to bin')) forPicked.push(item('Move to bin…', () => enter('bin'), { key: '⌫' }))
183
+ if (matches('clear picks')) forPicked.push(item('Clear picks', () => ask('clear')))
184
+ if (forPicked.length) sections.push({ title: 'For the ' + n + ' picked', items: forPicked })
185
+ }
186
+
187
+ const places = [
188
+ ['Desk', () => go('desk'), 'G D'],
189
+ ['All pictures', () => { sentence.value = { ...BLANK }; go('all') }, 'G A'],
190
+ ['Groups', () => go('groups'), 'G G'],
191
+ ]
192
+ if (about.remove && canWrite() && ownBin.value) places.push(['Bin', () => go('bin'), ''])
193
+ const goTo = places.filter(([label]) => matches(label)).map(([label, run, key]) => item(label, run, { key }))
194
+ for (const group of groups) {
195
+ if (matches(group)) goTo.push(item(group, () => { sentence.value = { ...BLANK, group }; go('all') }, { hint: 'Group' }))
196
+ }
197
+ for (const kept of savedSentences()) {
198
+ if (matches(kept.name)) goTo.push(item(kept.name, () => { sentence.value = { ...BLANK, ...kept.sentence }; go('all') }, { hint: 'Saved sentence' }))
199
+ }
200
+ if (goTo.length) sections.push({ title: 'Go to', items: goTo.slice(0, 9) })
201
+
202
+ const doing = []
203
+ if (about.upload && canWrite() && matches('upload pictures')) doing.push(item('Upload pictures…', () => (upload.value = (upload.value || 0) + 1), { key: 'U' }))
204
+ if (canWrite() && matches('pictures that need words')) doing.push(item('See the pictures that need words', () => { sentence.value = { ...BLANK, condition: 'needs' }; go('all') }))
205
+ if (matches('keyboard shortcuts keys')) doing.push(item('Keyboard shortcuts', () => openKeys(), {}))
206
+ if (doing.length) sections.push({ title: 'Do', items: doing })
207
+
208
+ if (words) {
209
+ const found = ((set.value && set.value.items) || []).filter((one) => matches(one.label)).slice(0, 6)
210
+ if (found.length) {
211
+ sections.push({ title: 'Pictures', items: found.map((one) => item(one.label, () => (selected.value = { id: one.id, ...(one.record || {}) }), { hint: one.noAlt ? 'Needs words' : '' })) })
212
+ }
213
+ const asked = parse(query, { groups })
214
+ const only = asked.about && !asked.shape && !asked.group && !asked.condition && !asked.when
215
+ const label = only ? 'Search pictures for “' + asked.about + '”' : 'Show: ' + said(asked).replace(/\.$/, '')
216
+ sections.push({ title: 'Search', items: [item(label, () => { sentence.value = asked; go('all') })] })
217
+ }
218
+ }
219
+
220
+ state.sections = sections.filter((one) => one.items.length)
221
+ order = state.sections.flatMap((one) => one.items.map((each) => each.id))
222
+ if (!order.includes(state.activeId)) state.activeId = order[0] || ''
223
+ }
224
+
225
+ function enter(next) {
226
+ step = next
227
+ query = ''
228
+ if (refs.input) refs.input.value = ''
229
+ build()
230
+ // Stays open for the second answer.
231
+ return true
232
+ }
233
+
234
+ function runById(id) {
235
+ const run = actions.get(id)
236
+ if (!run) return
237
+ const stay = run()
238
+ if (stay !== true) close()
239
+ }
240
+
241
+ function hover(id) {
242
+ if (state.activeId !== id) state.activeId = id
243
+ }
244
+
245
+ function onInput(event) {
246
+ query = event.target.value
247
+ state.activeId = ''
248
+ build()
249
+ }
250
+
251
+ function dropContext() {
252
+ useContext = false
253
+ step = ''
254
+ build()
255
+ if (refs.input) refs.input.focus()
256
+ }
257
+
258
+ function openKeys() {
259
+ state.lettersOn = letterKeys()
260
+ state.keysOpen = true
261
+ return true
262
+ }
263
+
264
+ function closeKeys() {
265
+ state.keysOpen = false
266
+ if (refs.input) refs.input.focus()
267
+ }
268
+
269
+ function toggleLetters(event) {
270
+ setLetterKeys(event.target.checked)
271
+ state.lettersOn = event.target.checked
272
+ }
273
+
274
+ function move(by) {
275
+ if (!order.length) return
276
+ const at = order.indexOf(state.activeId)
277
+ state.activeId = order[(at + by + order.length) % order.length]
278
+ requestAnimationFrame(() => {
279
+ const row = document.getElementById(state.activeId)
280
+ if (row && row.scrollIntoView) row.scrollIntoView({ block: 'nearest' })
281
+ })
282
+ }
283
+
284
+ function onKey(event) {
285
+ event.stopPropagation()
286
+ if (event.key === 'Escape') {
287
+ event.preventDefault()
288
+ if (state.keysOpen) return closeKeys()
289
+ if (step) {
290
+ step = ''
291
+ build()
292
+ return
293
+ }
294
+ close()
295
+ } else if (state.keysOpen) {
296
+ return
297
+ } else if (event.key === 'ArrowDown') {
298
+ event.preventDefault()
299
+ move(1)
300
+ } else if (event.key === 'ArrowUp') {
301
+ event.preventDefault()
302
+ move(-1)
303
+ } else if (event.key === 'Enter') {
304
+ event.preventDefault()
305
+ if (state.activeId) runById(state.activeId)
306
+ } else if (event.key === 'Backspace' && !query) {
307
+ if (step) {
308
+ event.preventDefault()
309
+ step = ''
310
+ build()
311
+ } else if (pickedNow().length) {
312
+ event.preventDefault()
313
+ dropContext()
314
+ }
315
+ } else if (event.key === 'Tab') {
316
+ // One box and its list; focus stays in the box.
317
+ if (!state.keysOpen) event.preventDefault()
318
+ }
319
+ }
320
+
321
+ function open() {
322
+ if (state.open) return
323
+ opener = document.activeElement
324
+ query = ''
325
+ step = ''
326
+ useContext = true
327
+ state.keysOpen = false
328
+ state.activeId = ''
329
+ state.open = true
330
+ build()
331
+ requestAnimationFrame(() => {
332
+ if (!refs.input) return
333
+ refs.input.value = ''
334
+ refs.input.focus()
335
+ })
336
+ }
337
+
338
+ function close() {
339
+ if (!state.open) return
340
+ state.open = false
341
+ // Whatever the command opened takes focus itself; otherwise it goes back.
342
+ requestAnimationFrame(() => {
343
+ const taken = document.activeElement && document.activeElement !== document.body && !document.activeElement.closest('.bar')
344
+ if (!taken && opener && document.contains(opener) && opener.focus) opener.focus()
345
+ opener = null
346
+ })
347
+ }
348
+
349
+ function backdrop(event) {
350
+ if (event.target && event.target.classList && event.target.classList.contains('scrim')) close()
351
+ }
352
+
353
+ function onShortcut(event) {
354
+ if ((event.metaKey || event.ctrlKey) && (event.key === 'k' || event.key === 'K')) {
355
+ event.preventDefault()
356
+ if (state.open) close()
357
+ else open()
358
+ }
359
+ }
360
+
361
+ onMounted(() => {
362
+ document.addEventListener('keydown', onShortcut)
363
+ })
364
+
365
+ onUnmounted(() => {
366
+ document.removeEventListener('keydown', onShortcut)
367
+ })
368
+ </logic>
369
+
370
+ <style>
371
+ .scrim {
372
+ position: fixed;
373
+ inset: 0;
374
+ z-index: 70;
375
+ display: flex;
376
+ align-items: flex-start;
377
+ justify-content: center;
378
+ padding: 12vh 16px 16px;
379
+ background: var(--px-scrim);
380
+ }
381
+
382
+ .bar {
383
+ width: min(640px, 100%);
384
+ max-height: 70vh;
385
+ color: var(--px-text);
386
+ }
387
+
388
+ .ask {
389
+ display: flex;
390
+ align-items: center;
391
+ gap: 10px;
392
+ padding: 12px 16px;
393
+ border-bottom: 1px solid var(--px-border);
394
+ }
395
+
396
+ .ctx {
397
+ flex: none;
398
+ padding: 0 10px;
399
+ background: var(--px-accent-soft);
400
+ border-color: var(--px-accent);
401
+ color: var(--px-accent-text);
402
+ font: inherit;
403
+ font-size: var(--px-fs-s);
404
+ font-weight: 600;
405
+ cursor: pointer;
406
+ }
407
+
408
+ .q {
409
+ flex: 1;
410
+ min-width: 0;
411
+ min-height: var(--px-target);
412
+ border: 0;
413
+ background: transparent;
414
+ font: inherit;
415
+ font-size: 17px;
416
+ color: var(--px-text);
417
+ outline: none;
418
+ }
419
+
420
+ .list {
421
+ overflow: auto;
422
+ padding: 6px;
423
+ }
424
+
425
+ .sec-h {
426
+ padding: 10px 10px 4px;
427
+ font-size: var(--px-fs-xs);
428
+ font-weight: 600;
429
+ letter-spacing: .06em;
430
+ text-transform: uppercase;
431
+ color: var(--px-text-3);
432
+ }
433
+
434
+ .cmd {
435
+ display: flex;
436
+ align-items: center;
437
+ gap: 10px;
438
+ min-height: var(--px-target);
439
+ padding: 0 10px;
440
+ border-radius: var(--px-r-m);
441
+ cursor: pointer;
442
+ }
443
+
444
+ .cmd[aria-selected="true"] {
445
+ background: var(--px-accent-soft);
446
+ color: var(--px-accent-text);
447
+ }
448
+
449
+ .cmd-label {
450
+ flex: 1;
451
+ min-width: 0;
452
+ overflow: hidden;
453
+ text-overflow: ellipsis;
454
+ white-space: nowrap;
455
+ }
456
+
457
+ .none {
458
+ padding: 16px 10px;
459
+ }
460
+
461
+ .keys {
462
+ display: flex;
463
+ flex-direction: column;
464
+ gap: 12px;
465
+ padding: 14px 16px;
466
+ overflow: auto;
467
+ }
468
+
469
+ .keys table {
470
+ width: 100%;
471
+ border-collapse: collapse;
472
+ font-size: var(--px-fs-s);
473
+ }
474
+
475
+ .keys caption {
476
+ text-align: left;
477
+ font-weight: 600;
478
+ font-size: var(--px-fs-m);
479
+ padding-bottom: 6px;
480
+ }
481
+
482
+ .keys th {
483
+ text-align: left;
484
+ font-weight: 400;
485
+ padding: 6px 12px 6px 0;
486
+ }
487
+
488
+ .keys td {
489
+ text-align: right;
490
+ color: var(--px-text-2);
491
+ white-space: nowrap;
492
+ }
493
+
494
+ .keys tr + tr {
495
+ border-top: 1px solid var(--px-border);
496
+ }
497
+
498
+ .letters {
499
+ display: flex;
500
+ align-items: center;
501
+ gap: 8px;
502
+ font-size: var(--px-fs-s);
503
+ }
504
+
505
+ .keys .px-btn {
506
+ align-self: flex-start;
507
+ }
508
+
509
+ .foot {
510
+ display: flex;
511
+ gap: 16px;
512
+ padding: 8px 16px;
513
+ border-top: 1px solid var(--px-border);
514
+ font-size: var(--px-fs-xs);
515
+ color: var(--px-text-3);
516
+ }
517
+
518
+ .sr-only {
519
+ position: absolute;
520
+ width: 1px;
521
+ height: 1px;
522
+ overflow: hidden;
523
+ clip-path: inset(50%);
524
+ white-space: nowrap;
525
+ }
526
+ </style>