cursedbelt 5.104.0 → 5.104.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/react/components/DataTable/DataTable.js +21 -6
- package/dist/react/components/DataTable/DataTable.js.map +1 -1
- package/dist/react/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/react/components/DataTable/RowActions.js +26 -3
- package/dist/react/components/DataTable/RowActions.js.map +1 -1
- package/dist/react/components/DataTable/lazyPart.d.ts +16 -1
- package/dist/react/components/DataTable/lazyPart.d.ts.map +1 -1
- package/dist/react/components/DataTable/lazyPart.js +21 -1
- package/dist/react/components/DataTable/lazyPart.js.map +1 -1
- package/dist/react/components/DropdownMenu.d.ts.map +1 -1
- package/dist/react/components/DropdownMenu.js +22 -3
- package/dist/react/components/DropdownMenu.js.map +1 -1
- package/dist/react/lib/fingerPress.d.ts +9 -0
- package/dist/react/lib/fingerPress.d.ts.map +1 -0
- package/dist/react/lib/fingerPress.js +9 -0
- package/dist/react/lib/fingerPress.js.map +1 -0
- package/dist/react/media/PlayerStrip.d.ts.map +1 -1
- package/dist/react/media/PlayerStrip.js +6 -6
- package/dist/react/media/PlayerStrip.js.map +1 -1
- package/dist/styles-areas/core.css +8 -8
- package/package.json +2 -2
- package/src/react/components/DataTable/DataTable.tsx +22 -5
- package/src/react/components/DataTable/RowActions.spec.tsx +191 -0
- package/src/react/components/DataTable/RowActions.tsx +32 -9
- package/src/react/components/DataTable/columnPriorityTiers.spec.tsx +41 -0
- package/src/react/components/DataTable/lazyPart.tsx +33 -1
- package/src/react/components/DataTable/rowMenuOpen.spec.tsx +79 -0
- package/src/react/components/DropdownMenu.spec.tsx +57 -0
- package/src/react/components/DropdownMenu.tsx +25 -3
- package/src/react/lib/fingerPress.ts +8 -0
- package/src/react/media/PlayerStrip.tsx +8 -7
- package/src/react/media/playerStrip.spec.tsx +26 -0
- package/src/styles-areas/core.css +8 -8
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { cleanup, render } from '@testing-library/react';
|
|
3
|
+
import { DataTable, preloadDataTableParts } from './DataTable.js';
|
|
4
|
+
import type { ColDef } from './types.js';
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup);
|
|
7
|
+
beforeAll(preloadDataTableParts);
|
|
8
|
+
|
|
9
|
+
type Row = { id: string; title: string; folder: string; status: string } & Record<string, unknown>;
|
|
10
|
+
|
|
11
|
+
const COLUMNS: ColDef<Row>[] = [
|
|
12
|
+
{ key: 'title', label: 'Video', type: 'text', minWidth: 220 },
|
|
13
|
+
{ key: 'folder', label: 'Folder', type: 'text', width: 160, priority: 1 },
|
|
14
|
+
{ key: 'status', label: 'Download', type: 'text', width: 320 },
|
|
15
|
+
];
|
|
16
|
+
const ROWS: Row[] = [{ id: 'a', title: 'Alien', folder: 'Films', status: 'Failed' }];
|
|
17
|
+
|
|
18
|
+
/** Draw the table in a container `width` px wide. happy-dom lays nothing out, so the width is stated. */
|
|
19
|
+
function renderAt(width: number) {
|
|
20
|
+
const clientWidth = Object.getOwnPropertyDescriptor(Element.prototype, 'clientWidth');
|
|
21
|
+
Object.defineProperty(HTMLElement.prototype, 'clientWidth', { configurable: true, get: () => width });
|
|
22
|
+
const { container } = render(<DataTable<Row> columns={COLUMNS} data={ROWS} hidePagination getRowId={(row) => row.id} />);
|
|
23
|
+
delete (HTMLElement.prototype as { clientWidth?: number }).clientWidth;
|
|
24
|
+
expect(Object.getOwnPropertyDescriptor(Element.prototype, 'clientWidth')).toEqual(clientWidth);
|
|
25
|
+
return container.querySelector('[data-cb-table-list]') as HTMLElement;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('ColDef.priority in the tablet list (forge task 4182)', () => {
|
|
29
|
+
test('🔴 a column the width dropped is not a track in the list, header or row', () => {
|
|
30
|
+
const list = renderAt(600);
|
|
31
|
+
expect(list.textContent).toContain('Download');
|
|
32
|
+
expect(list.textContent).not.toContain('Folder');
|
|
33
|
+
expect(list.textContent).not.toContain('Films');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('a width that fits keeps every column', () => {
|
|
37
|
+
const list = renderAt(760);
|
|
38
|
+
expect(list.textContent).toContain('Folder');
|
|
39
|
+
expect(list.textContent).toContain('Films');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
* the moment the chunk lands, and React would REMOUNT the part — a half-typed search,
|
|
16
16
|
* an open menu, gone.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
type Attributes,
|
|
20
|
+
type ComponentType,
|
|
21
|
+
type PointerEvent,
|
|
22
|
+
type ReactNode,
|
|
23
|
+
Suspense,
|
|
24
|
+
useState,
|
|
25
|
+
} from 'react';
|
|
19
26
|
import { lazyWithReload } from '../../lazy/staleChunk.js';
|
|
27
|
+
import { isFingerPress } from '../../lib/fingerPress.js';
|
|
20
28
|
|
|
21
29
|
export interface LazyPart<P> {
|
|
22
30
|
(props: P & { fallback?: ReactNode }): ReactNode;
|
|
@@ -24,6 +32,30 @@ export interface LazyPart<P> {
|
|
|
24
32
|
preload: () => Promise<void>;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
export interface StandInPress {
|
|
36
|
+
onPointerDown: (event: PointerEvent) => void;
|
|
37
|
+
onClick: () => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 🔴 What a lazy trigger's stand-in (the `fallback` drawn as the trigger) listens to, so a press
|
|
42
|
+
* before the chunk lands is not lost (forge task 4172). `press` records it in the state the part
|
|
43
|
+
* is controlled by, and the part mounts already open.
|
|
44
|
+
*
|
|
45
|
+
* Radix's rule for a press, because the landing replaces the button: one that lands between the
|
|
46
|
+
* pointerdown and the release leaves the browser's `click` with neither button. The `click` is
|
|
47
|
+
* still heard, for the keyboard, and it is a finger's only press (`isFingerPress`): one landing
|
|
48
|
+
* under a held finger would be pressed by its release, so that rare tap is asked again instead.
|
|
49
|
+
*/
|
|
50
|
+
export function standInPress(press: () => void): StandInPress {
|
|
51
|
+
return {
|
|
52
|
+
onPointerDown: (event) => {
|
|
53
|
+
if (event.button === 0 && !event.ctrlKey && !isFingerPress(event)) press();
|
|
54
|
+
},
|
|
55
|
+
onClick: press,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
27
59
|
export function lazyPart<P extends object>(load: () => Promise<ComponentType<P>>): LazyPart<P> {
|
|
28
60
|
let loaded: ComponentType<P> | null = null;
|
|
29
61
|
let pending: Promise<ComponentType<P>> | null = null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import type { ColDef } from './types.js';
|
|
4
|
+
import { DataTable } from './DataTable.js';
|
|
5
|
+
import { preloadRowMenu } from './RowActions.js';
|
|
6
|
+
|
|
7
|
+
afterEach(cleanup);
|
|
8
|
+
|
|
9
|
+
type Row = { id: string; title: string } & Record<string, unknown>;
|
|
10
|
+
|
|
11
|
+
const ROWS: Row[] = [
|
|
12
|
+
{ id: 'a', title: 'Alien' },
|
|
13
|
+
{ id: 'b', title: 'Brazil' },
|
|
14
|
+
];
|
|
15
|
+
const COLUMNS: ColDef<Row>[] = [{ key: 'title', label: 'Title', type: 'text' }];
|
|
16
|
+
|
|
17
|
+
function table() {
|
|
18
|
+
return (
|
|
19
|
+
<DataTable<Row>
|
|
20
|
+
columns={COLUMNS}
|
|
21
|
+
data={ROWS}
|
|
22
|
+
getRowId={(row) => row.id}
|
|
23
|
+
hidePagination
|
|
24
|
+
rowMenu={() => [{ key: 'remove', label: 'Remove' }]}
|
|
25
|
+
rowMenuLabel={(row) => `More for ${row.title}`}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Each row's three kebabs, in the order the tiers are drawn: happy-dom has no container queries, so
|
|
32
|
+
* all of them are in the DOM, as they are for a table that does not virtualize. `hidden`, because
|
|
33
|
+
* an open modal menu hides the page from a role query.
|
|
34
|
+
*/
|
|
35
|
+
const kebabs = (title: string) => screen.getAllByRole('button', { name: `More for ${title}`, hidden: true });
|
|
36
|
+
const TIERS = ['the phone cards', 'the tablet list', 'the grid'] as const;
|
|
37
|
+
|
|
38
|
+
describe('DataTable — one row ⋯ at a time (forge task 4180)', () => {
|
|
39
|
+
// A stand-in press and Radix's trigger set the same state, and this reads the state: bun keeps
|
|
40
|
+
// one module registry for a run, so a spec cannot hold this table's chunk cold. That a stand-in
|
|
41
|
+
// reaches the table is `RowActions.spec.tsx`'s 'a table that controls the menu hears the press'.
|
|
42
|
+
test('🔴 two ⋯ pressed in one tick open one menu, the last one pressed', async () => {
|
|
43
|
+
await preloadRowMenu();
|
|
44
|
+
render(table());
|
|
45
|
+
fireEvent.pointerDown(kebabs('Alien')[0] as HTMLElement, { button: 0 });
|
|
46
|
+
fireEvent.pointerDown(kebabs('Brazil')[0] as HTMLElement, { button: 0 });
|
|
47
|
+
await screen.findByRole('menu');
|
|
48
|
+
expect(screen.getAllByRole('menu')).toHaveLength(1);
|
|
49
|
+
expect(kebabs('Brazil')[0]?.getAttribute('aria-expanded')).toBe('true');
|
|
50
|
+
expect(kebabs('Alien')[0]?.getAttribute('aria-expanded')).toBe('false');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test.each([...TIERS.keys()])('🔴 a press opens the row in its own tier and not in the two hidden ones (tier %d)', async (tier) => {
|
|
54
|
+
await preloadRowMenu();
|
|
55
|
+
render(table());
|
|
56
|
+
fireEvent.pointerDown(kebabs('Alien')[tier] as HTMLElement, { button: 0 });
|
|
57
|
+
await screen.findByRole('menu');
|
|
58
|
+
expect(screen.getAllByRole('menu')).toHaveLength(1);
|
|
59
|
+
expect(kebabs('Alien').map((k) => k.getAttribute('aria-expanded') === 'true')).toEqual(TIERS.map((_, i) => i === tier));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('a right-click on a grid row opens that row\'s menu, once', async () => {
|
|
63
|
+
await preloadRowMenu();
|
|
64
|
+
render(table());
|
|
65
|
+
const grid = screen.getAllByRole('table').at(-1) as HTMLElement;
|
|
66
|
+
fireEvent.contextMenu(grid.querySelector('tbody tr') as HTMLElement);
|
|
67
|
+
await screen.findByRole('menu');
|
|
68
|
+
expect(screen.getAllByRole('menu')).toHaveLength(1);
|
|
69
|
+
expect(kebabs('Alien')[2]?.getAttribute('aria-expanded')).toBe('true');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('a menu that closes leaves the table with nothing open', async () => {
|
|
73
|
+
await preloadRowMenu();
|
|
74
|
+
render(table());
|
|
75
|
+
fireEvent.pointerDown(kebabs('Alien')[0] as HTMLElement, { button: 0 });
|
|
76
|
+
fireEvent.click(await screen.findByRole('menuitem', { name: 'Remove' }));
|
|
77
|
+
await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -39,6 +39,63 @@ describe('DropdownMenu closes on a press anywhere else', () => {
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
describe('DropdownMenu — a finger opens it on the click, not the press (forge task 4184)', () => {
|
|
43
|
+
const tap = (el: Element) => fireEvent.pointerDown(el, { button: 0, pointerType: 'touch' });
|
|
44
|
+
|
|
45
|
+
test('🔴 the press opens nothing, so nothing is under the finger when it lifts', () => {
|
|
46
|
+
render(<DropdownMenu items={[{ key: 'a', label: 'Remove' }]} trigger={<B>actions</B>} />);
|
|
47
|
+
tap(screen.getByText('actions'));
|
|
48
|
+
expect(menu()).toBeNull();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('🔴 the click that ends the tap opens it', () => {
|
|
52
|
+
render(<DropdownMenu items={[{ key: 'a', label: 'Remove' }]} trigger={<B>actions</B>} />);
|
|
53
|
+
tap(screen.getByText('actions'));
|
|
54
|
+
fireEvent.click(screen.getByText('actions'));
|
|
55
|
+
expect(menu()).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('a pen is a finger', () => {
|
|
59
|
+
render(<DropdownMenu items={[{ key: 'a', label: 'Remove' }]} trigger={<B>actions</B>} />);
|
|
60
|
+
fireEvent.pointerDown(screen.getByText('actions'), { button: 0, pointerType: 'pen' });
|
|
61
|
+
expect(menu()).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('a click whose press never reached the trigger opens nothing: it is the tap that closed the menu', () => {
|
|
65
|
+
render(<DropdownMenu items={[{ key: 'a', label: 'Remove' }]} trigger={<B>actions</B>} />);
|
|
66
|
+
fireEvent.click(screen.getByText('actions'));
|
|
67
|
+
expect(menu()).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('the mouse still opens on the press, and its click does not close it again', () => {
|
|
71
|
+
render(<DropdownMenu items={[{ key: 'a', label: 'Remove' }]} trigger={<B>actions</B>} />);
|
|
72
|
+
fireEvent.pointerDown(screen.getByText('actions'), { button: 0, pointerType: 'mouse' });
|
|
73
|
+
fireEvent.click(screen.getByText('actions'));
|
|
74
|
+
expect(menu()).toBeTruthy();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('DropdownMenu — a short label beside a long description (forge task 4183)', () => {
|
|
79
|
+
const labelOf = (text: string) => screen.getByText(text);
|
|
80
|
+
|
|
81
|
+
test('🔴 the label keeps its words whole: `anywhere` would shrink it to a letter a line', () => {
|
|
82
|
+
render(
|
|
83
|
+
<DropdownMenu
|
|
84
|
+
open
|
|
85
|
+
items={[{ key: 'a', label: 'Retry', description: 'Ask the Mac to fetch this one again from the start' }]}
|
|
86
|
+
trigger={<B>actions</B>}
|
|
87
|
+
/>,
|
|
88
|
+
);
|
|
89
|
+
expect(labelOf('Retry').className).toContain('wrap-break-word');
|
|
90
|
+
expect(labelOf('Retry').className).not.toContain('anywhere');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('a label with nothing beside it may break anywhere: the panel is what caps it', () => {
|
|
94
|
+
render(<DropdownMenu open items={[{ key: 'a', label: 'Retry' }]} trigger={<B>actions</B>} />);
|
|
95
|
+
expect(labelOf('Retry').className).toContain('anywhere');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
42
99
|
describe('DropdownMenu — a list of verbs in groups, destructive last (OVL-7)', () => {
|
|
43
100
|
const keys = (sections: { key: string }[][]) => sections.map((s) => s.map((i) => i.key));
|
|
44
101
|
|
|
@@ -4,6 +4,7 @@ import { Check, ChevronRight } from 'lucide-react';
|
|
|
4
4
|
import { Fragment, type ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { useOutsidePress } from '../hooks/useOutsidePress.js';
|
|
6
6
|
import { cn } from '../lib/cn.js';
|
|
7
|
+
import { isFingerPress } from '../lib/fingerPress.js';
|
|
7
8
|
import { useFloatingContainer } from '../lib/floatingContainer.js';
|
|
8
9
|
import { arrangeMenuItems } from '../lib/menuSections.js';
|
|
9
10
|
import {
|
|
@@ -131,9 +132,27 @@ export function DropdownMenu({
|
|
|
131
132
|
escape: false,
|
|
132
133
|
decideOn: 'pointerdown',
|
|
133
134
|
});
|
|
135
|
+
/*
|
|
136
|
+
* 🔴 Radix's Select makes this split and its menu does not: a menu opened by a finger's press
|
|
137
|
+
* lands under the finger, and the release picks what is there — one tap on a phone's row `⋯`
|
|
138
|
+
* pressed Remove (forge task 4184). `preventDefault` is how Radix is told to leave the press alone.
|
|
139
|
+
* A click whose press never reached the trigger is the tap that closed this modal menu: it stays closed.
|
|
140
|
+
*/
|
|
141
|
+
const fingerPressed = useRef(false);
|
|
134
142
|
return (
|
|
135
143
|
<RDrop.Root open={isOpen} onOpenChange={setOpen}>
|
|
136
|
-
<RDrop.Trigger
|
|
144
|
+
<RDrop.Trigger
|
|
145
|
+
asChild
|
|
146
|
+
ref={triggerRef}
|
|
147
|
+
onPointerDown={(event) => {
|
|
148
|
+
fingerPressed.current = isFingerPress(event);
|
|
149
|
+
if (fingerPressed.current) event.preventDefault();
|
|
150
|
+
}}
|
|
151
|
+
onClick={() => {
|
|
152
|
+
if (fingerPressed.current) setOpen(!isOpen);
|
|
153
|
+
fingerPressed.current = false;
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
137
156
|
{trigger}
|
|
138
157
|
</RDrop.Trigger>
|
|
139
158
|
<RDrop.Portal container={container}>
|
|
@@ -176,9 +195,12 @@ function MenuSections({ items }: { items: readonly DropdownMenuItem[] }) {
|
|
|
176
195
|
/** The label, with the disabled reason under it when there is one. */
|
|
177
196
|
function ItemLabel({ item }: { item: DropdownMenuAction }) {
|
|
178
197
|
// `min-w-0` + `anywhere`: inside the viewport-capped panel a long label wraps, never overflows.
|
|
179
|
-
|
|
198
|
+
// Beside a description that lets both shrink to a letter, and "Retry" came out as "Ret / ry" on
|
|
199
|
+
// a phone (forge task 4183): `break-word` keeps a word whole, so the description gives way.
|
|
200
|
+
const wrap = item.description ? 'wrap-break-word' : 'min-w-0 [overflow-wrap:anywhere]';
|
|
201
|
+
if (!item.disabledReason) return <span className={wrap}>{item.label}</span>;
|
|
180
202
|
return (
|
|
181
|
-
<span className='flex
|
|
203
|
+
<span className={cn(wrap, 'flex flex-col')}>
|
|
182
204
|
<span>{item.label}</span>
|
|
183
205
|
<span data-cb-menu-reason='' className='text-caption text-muted-foreground'>
|
|
184
206
|
{item.disabledReason}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔴 A finger or a pen, whose press must not open anything: what opens on the pointerdown is under
|
|
3
|
+
* the finger when it lifts, and the release presses it (forge task 4184). So these open on the
|
|
4
|
+
* `click`, which is also how a scroll that starts on a control is not a press.
|
|
5
|
+
*/
|
|
6
|
+
export function isFingerPress(event: { pointerType: string }): boolean {
|
|
7
|
+
return event.pointerType === 'touch' || event.pointerType === 'pen';
|
|
8
|
+
}
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
import type { ActionsHelpProps } from "../components/ActionsHelp.js";
|
|
54
54
|
import type { DropdownMenuProps } from "../components/DropdownMenu.js";
|
|
55
55
|
import { IconButton } from "../components/IconButton.js";
|
|
56
|
-
import { lazyPart } from "../components/DataTable/lazyPart.js";
|
|
56
|
+
import { lazyPart, type StandInPress, standInPress } from "../components/DataTable/lazyPart.js";
|
|
57
57
|
import type { PopoverProps } from "../components/Popover.js";
|
|
58
58
|
import { Tooltip } from "../components/Tooltip.js";
|
|
59
59
|
import { cn } from "../lib/cn.js";
|
|
@@ -268,8 +268,8 @@ function OverflowMenu({ actions }: { actions: PlayerStripAction[] }): React.Reac
|
|
|
268
268
|
const [help, setHelp] = useState(false);
|
|
269
269
|
if (actions.length === 0) return null;
|
|
270
270
|
const explained = actions.filter((action) => action.hint);
|
|
271
|
-
const trigger = (
|
|
272
|
-
<IconButton className="cbps__icon" label="More actions for this track"
|
|
271
|
+
const trigger = (press?: StandInPress) => (
|
|
272
|
+
<IconButton {...press} className="cbps__icon" label="More actions for this track" size="lg">
|
|
273
273
|
<MoreHorizontal />
|
|
274
274
|
</IconButton>
|
|
275
275
|
);
|
|
@@ -277,7 +277,7 @@ function OverflowMenu({ actions }: { actions: PlayerStripAction[] }): React.Reac
|
|
|
277
277
|
<>
|
|
278
278
|
<LazyMenu
|
|
279
279
|
align="end"
|
|
280
|
-
fallback={trigger(() => setOpen(true))}
|
|
280
|
+
fallback={trigger(standInPress(() => setOpen(true)))}
|
|
281
281
|
onOpenChange={setOpen}
|
|
282
282
|
open={open}
|
|
283
283
|
items={[
|
|
@@ -309,7 +309,7 @@ function OverflowMenu({ actions }: { actions: PlayerStripAction[] }): React.Reac
|
|
|
309
309
|
);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
function ActionButton({ action,
|
|
312
|
+
function ActionButton({ action, ...press }: { action: PlayerStripAction } & Partial<StandInPress>): React.ReactNode {
|
|
313
313
|
return (
|
|
314
314
|
<IconButton
|
|
315
315
|
// A popover trigger is not a toggle: its state is the panel's, which Radix announces.
|
|
@@ -317,7 +317,8 @@ function ActionButton({ action, onClick }: { action: PlayerStripAction; onClick?
|
|
|
317
317
|
className={cn("cbps__icon", action.active ? "is-active" : "", action.danger ? "is-danger" : "")}
|
|
318
318
|
disabled={action.disabled ?? false}
|
|
319
319
|
label={action.label}
|
|
320
|
-
onClick={onClick ?? action.onClick}
|
|
320
|
+
onClick={press.onClick ?? action.onClick}
|
|
321
|
+
onPointerDown={press.onPointerDown}
|
|
321
322
|
size="lg"
|
|
322
323
|
tooltip={action.hint ?? action.label}
|
|
323
324
|
>
|
|
@@ -335,7 +336,7 @@ function PopoverAction({ action }: { action: PlayerStripAction }): React.ReactNo
|
|
|
335
336
|
return (
|
|
336
337
|
<LazyPopover
|
|
337
338
|
align="center"
|
|
338
|
-
fallback={<ActionButton action={action}
|
|
339
|
+
fallback={<ActionButton action={action} {...standInPress(() => setOpen(true))} />}
|
|
339
340
|
onOpenChange={setOpen}
|
|
340
341
|
open={open}
|
|
341
342
|
side="top"
|
|
@@ -358,6 +358,32 @@ describe("playerStrip.css — the layout the owner specified", () => {
|
|
|
358
358
|
});
|
|
359
359
|
});
|
|
360
360
|
|
|
361
|
+
describe("a press still held as a lazy chunk lands (forge task 4172)", () => {
|
|
362
|
+
/** A copy with its own lazy parts: nothing can land before the test's first `await` after `render`. */
|
|
363
|
+
const coldStrip = async () => ((await import(`./PlayerStrip.tsx?cold=${Math.random()}`)) as { PlayerStrip: typeof PlayerStrip }).PlayerStrip;
|
|
364
|
+
|
|
365
|
+
test("🔴 the ⋯ opens — the landing replaces the button, so no click ever comes", async () => {
|
|
366
|
+
const Cold = await coldStrip();
|
|
367
|
+
const three = ["share", "keep", "tag"].map((key) => ({ key, label: key, icon: null }));
|
|
368
|
+
render(<Cold {...base} inlineActions={1} trackActions={three} />);
|
|
369
|
+
fireEvent.pointerDown(screen.getByRole("button", { name: "More actions for this track" }), { button: 0 });
|
|
370
|
+
const menu = await screen.findByRole("menu", { hidden: true });
|
|
371
|
+
expect(await within(menu).findByText("keep")).toBeDefined();
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
test("🔴 a panel opens the same way", async () => {
|
|
375
|
+
const Cold = await coldStrip();
|
|
376
|
+
render(
|
|
377
|
+
<Cold
|
|
378
|
+
{...base}
|
|
379
|
+
trackActions={[{ key: "rate", label: "Rate this track", icon: <span>★</span>, popover: <p>five stars here</p> }]}
|
|
380
|
+
/>,
|
|
381
|
+
);
|
|
382
|
+
fireEvent.pointerDown(screen.getByRole("button", { name: "Rate this track" }), { button: 0 });
|
|
383
|
+
expect(await screen.findByText("five stars here")).not.toBeNull();
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
|
|
361
387
|
describe("a track action that opens a panel", () => {
|
|
362
388
|
test("🔴 a press opens the popover's content instead of acting, and it is reachable from the strip", async () => {
|
|
363
389
|
render(
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* after an app's responsive variant (task 2124). An app that imports every area gets exactly
|
|
16
16
|
* what `cursedbelt/styles-utilities.css` emits — proved rule by rule in
|
|
17
17
|
* src/stylesAreas.spec.ts, which is also what fails when this file is stale.
|
|
18
|
-
*
|
|
18
|
+
* 947 candidate(s).
|
|
19
19
|
*
|
|
20
20
|
* Written by scripts/generateAreaStyles.ts (`bun run styles:areas`), which
|
|
21
21
|
* `bun run build` runs. The map of what is in which area, and why the areas are
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
@source inline("border-field-border border-l border-r border-rule border-success/30 border-success/40");
|
|
68
68
|
@source inline("border-success/50 border-t border-tone-sky-fg/30 border-tone-slate-fg/30 border-transparent");
|
|
69
69
|
@source inline("border-warning/30 border-warning/40 border-warning/50 border-x-4 border-x-transparent bot bottom");
|
|
70
|
-
@source inline("bottom-0 break break-all break-words c ca cap capitalize co col-span-full com contain
|
|
71
|
-
@source inline("content contents cursor cursor-col-resize cursor-default cursor-ew-resize
|
|
72
|
-
@source inline("cursor-pointer cursor-row-resize d dark dark:bg-card-overlay
|
|
73
|
-
@source inline("dark:bg-gray-800 data data-[disabled]:hover:bg-border
|
|
74
|
-
@source inline("data-[disabled]:
|
|
75
|
-
@source inline("data-[
|
|
76
|
-
@source inline("data-[interactive=true]:duration-[var(--duration-base)]");
|
|
70
|
+
@source inline("bottom-0 break break-all break-word break-words c ca cap capitalize co col-span-full com contain");
|
|
71
|
+
@source inline("container content contents cursor cursor-col-resize cursor-default cursor-ew-resize");
|
|
72
|
+
@source inline("cursor-not-allowed cursor-pointer cursor-row-resize d dark dark:bg-card-overlay");
|
|
73
|
+
@source inline("dark:bg-card-raised dark:bg-gray-800 data data-[disabled]:hover:bg-border");
|
|
74
|
+
@source inline("data-[disabled]:opacity-50 data-[disabled]:pointer-events-none data-[ending-style]:opacity-0");
|
|
75
|
+
@source inline("data-[ending-style]:scale-95 data-[highlighted]:bg-accent/10");
|
|
76
|
+
@source inline("data-[highlighted]:text-accent-strong data-[interactive=true]:duration-[var(--duration-base)]");
|
|
77
77
|
@source inline("data-[interactive=true]:ease-[var(--ease-out)] data-[interactive=true]:hover:-translate-y-0.5");
|
|
78
78
|
@source inline("data-[interactive=true]:hover:border-border-strong data-[interactive=true]:transition-all");
|
|
79
79
|
@source inline("data-[interactive=true]:transition-colors data-[placeholder]:text-muted-foreground");
|