@gntik-ai/blocks 0.11.0 → 0.13.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/dist/index.d.ts +1501 -1232
- package/dist/index.js +1891 -840
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/ai/EvaluationScorecard/EvaluationScorecard.test.tsx +10 -0
- package/src/ai/EvaluationScorecard/EvaluationScorecard.tsx +2 -1
- package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
- package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
- package/src/ai/TokenCostCard/TokenCostCard.test.tsx +10 -0
- package/src/ai/TokenCostCard/TokenCostCard.tsx +2 -1
- package/src/ai/TraceWaterfall/TraceWaterfall.tsx +2 -2
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.test.tsx +6 -0
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +4 -1
- package/src/auth/ForgotPasswordForm/block.meta.ts +1 -1
- package/src/auth/ForgotPasswordForm/examples/LargeFields.tsx +6 -0
- package/src/auth/MfaChallenge/MfaChallenge.test.tsx +9 -0
- package/src/auth/MfaChallenge/MfaChallenge.tsx +5 -2
- package/src/auth/MfaChallenge/block.meta.ts +1 -1
- package/src/auth/MfaChallenge/examples/LargeFields.tsx +6 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.test.tsx +7 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +5 -3
- package/src/auth/ResetPasswordForm/block.meta.ts +1 -1
- package/src/auth/ResetPasswordForm/examples/LargeFields.tsx +6 -0
- package/src/auth/SignInForm/SignInForm.test.tsx +7 -0
- package/src/auth/SignInForm/SignInForm.tsx +5 -1
- package/src/auth/SignInForm/block.meta.ts +1 -1
- package/src/auth/SignInForm/examples/LargeFields.tsx +6 -0
- package/src/auth/SignUpForm/SignUpForm.test.tsx +22 -0
- package/src/auth/SignUpForm/SignUpForm.tsx +7 -1
- package/src/auth/SignUpForm/block.meta.ts +1 -1
- package/src/auth/SignUpForm/examples/LargeFields.tsx +6 -0
- package/src/auth/__snapshots__/field-size.test.tsx.snap +11 -0
- package/src/auth/field-size.test.tsx +21 -0
- package/src/auth/large-examples.test.tsx +30 -0
- package/src/auth/shared.tsx +7 -2
- package/src/billing/PaymentMethodCard/PaymentMethodCard.tsx +1 -1
- package/src/billing/PlanCard/PlanCard.baseline.test.tsx +3 -2
- package/src/billing/PlanCard/__snapshots__/PlanCard.baseline.test.tsx.snap +2 -2
- package/src/billing/PlanDefinitionCard/examples/Compact.tsx +1 -4
- package/src/billing/PlanDefinitionCard/examples/Full.tsx +1 -4
- package/src/builders/CodePanel/CodePanel.test.tsx +11 -0
- package/src/builders/CodePanel/CodePanel.tsx +4 -3
- package/src/builders/FlowBuilder/FlowBuilder.tsx +4 -19
- package/src/builders/FlowBuilder/parts.tsx +4 -4
- package/src/builders/LogViewer/LogViewer.follow.test.tsx +29 -0
- package/src/builders/LogViewer/LogViewer.test.tsx +24 -0
- package/src/builders/LogViewer/LogViewer.tsx +67 -20
- package/src/builders/LogViewer/block.meta.ts +2 -1
- package/src/builders/LogViewer/examples/Spanish.tsx +2 -1
- package/src/data-display/ActivityFeed/ActivityFeed.tsx +1 -1
- package/src/data-display/ChartCard/ChartCard.tsx +2 -2
- package/src/data-display/ChartCard/examples/ContainerPanel.tsx +16 -0
- package/src/data-display/CommentThread/CommentThread.test.tsx +70 -1
- package/src/data-display/CommentThread/CommentThread.tsx +22 -6
- package/src/data-display/CommentThread/block.meta.ts +1 -1
- package/src/data-display/CommentThread/examples/RenderedBody.tsx +20 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.test.tsx +24 -1
- package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +14 -20
- package/src/data-display/DescriptionListCard/block.meta.ts +2 -1
- package/src/data-display/DescriptionListCard/examples/Spanish.tsx +2 -1
- package/src/data-display/KpiRow/KpiRow.doc.ts +14 -0
- package/src/data-display/KpiRow/KpiRow.test.tsx +11 -0
- package/src/data-display/KpiRow/KpiRow.tsx +72 -55
- package/src/data-display/KpiRow/examples/ContainerPanel.tsx +47 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.doc.ts +19 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.test.tsx +13 -0
- package/src/data-display/ResourceCardGrid/ResourceCardGrid.tsx +49 -40
- package/src/data-display/ResourceCardGrid/examples/ContainerPanel.tsx +18 -0
- package/src/data-display/StatusTimeline/StatusTimeline.tsx +1 -1
- package/src/feedback/EmptyStates/EmptyStates.test.tsx +42 -0
- package/src/feedback/EmptyStates/EmptyStates.tsx +5 -3
- package/src/feedback/EmptyStates/block.meta.ts +1 -1
- package/src/feedback/EmptyStates/examples/HiddenAction.tsx +13 -0
- package/src/feedback/ErrorPanel/ErrorPanel.tsx +13 -15
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.lifecycle.test.tsx +123 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +128 -139
- package/src/forms/CreateApiKeyDialog/block.meta.ts +12 -1
- package/src/forms/FileUploadPanel/FileUploadPanel.controlled.test.tsx +482 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.drag.test.tsx +60 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.lifecycle.test.tsx +165 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.tsx +267 -69
- package/src/forms/FileUploadPanel/block.meta.ts +5 -1
- package/src/forms/FileUploadPanel/examples/AutoCancel.tsx +38 -0
- package/src/forms/FileUploadPanel/examples/Labels.tsx +1 -1
- package/src/forms/FileUploadPanel/examples/ManualForm.tsx +36 -0
- package/src/forms/FileUploadPanel/fixtures.ts +31 -16
- package/src/forms/FileUploadPanel/simulate-upload.test.ts +24 -0
- package/src/forms/FormSection/FormSection.test.tsx +11 -0
- package/src/forms/FormSection/FormSection.tsx +20 -22
- package/src/forms/FormSection/block.meta.ts +1 -1
- package/src/forms/FormSection/examples/ContainerPanel.tsx +16 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.lifecycle.test.tsx +80 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +90 -109
- package/src/forms/InviteMembersDialog/block.meta.ts +1 -1
- package/src/forms/ValidationSummary/ValidationSummary.tsx +1 -4
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useTableData.integration.test.tsx +89 -0
- package/src/hooks/useTableData.test.tsx +613 -0
- package/src/hooks/useTableData.ts +377 -0
- package/src/index.ts +1 -0
- package/src/marketing/ComparisonTable/ComparisonTable.tsx +2 -2
- package/src/marketing/FeatureGrid/FeatureGrid.tsx +1 -1
- package/src/marketing/LogoCloud/LogoCloud.doc.ts +13 -0
- package/src/marketing/LogoCloud/LogoCloud.test.tsx +155 -0
- package/src/marketing/LogoCloud/LogoCloud.tsx +89 -0
- package/src/marketing/LogoCloud/block.meta.ts +10 -0
- package/src/marketing/LogoCloud/examples/CaptionStart.tsx +6 -0
- package/src/marketing/LogoCloud/examples/Custom.tsx +25 -0
- package/src/marketing/LogoCloud/examples/Empty.tsx +6 -0
- package/src/marketing/LogoCloud/examples/Grid.tsx +13 -0
- package/src/marketing/LogoCloud/examples/Row.tsx +6 -0
- package/src/marketing/LogoCloud/examples/UnderHero.tsx +13 -0
- package/src/marketing/LogoCloud/fixtures.ts +23 -0
- package/src/marketing/PricingTable/PricingTable.tsx +1 -1
- package/src/marketing/SiteFooter/SiteFooter.doc.ts +18 -0
- package/src/marketing/SiteFooter/SiteFooter.test.tsx +236 -0
- package/src/marketing/SiteFooter/SiteFooter.tsx +160 -0
- package/src/marketing/SiteFooter/block.meta.ts +10 -0
- package/src/marketing/SiteFooter/examples/Centered.tsx +15 -0
- package/src/marketing/SiteFooter/examples/Columns.tsx +15 -0
- package/src/marketing/SiteFooter/examples/Custom.tsx +35 -0
- package/src/marketing/SiteFooter/examples/Empty.tsx +6 -0
- package/src/marketing/SiteFooter/examples/Simple.tsx +14 -0
- package/src/marketing/SiteFooter/fixtures.ts +36 -0
- package/src/marketing/index.ts +6 -0
- package/src/page-chrome/PageHeader/EditableTitle.test.tsx +26 -0
- package/src/page-chrome/PageHeader/PageHeader.tsx +4 -4
- package/src/page-chrome/PageHeader/block.meta.ts +1 -1
- package/src/page-chrome/PageHeader/examples/ContainerPanel.tsx +16 -0
- package/src/page-chrome/PageHeader/examples/EditableTitle.tsx +23 -0
- package/src/page-chrome/PageToolbar/PageToolbar.test.tsx +3 -1
- package/src/page-chrome/PageToolbar/PageToolbar.tsx +2 -2
- package/src/page-chrome/StickyActionBar/StickyActionBar.tsx +1 -1
- package/src/scheduling/AgendaList/AgendaList.tsx +39 -15
- package/src/scheduling/AgendaList/AgendaListZone.test.tsx +38 -0
- package/src/scheduling/AgendaList/block.meta.ts +1 -1
- package/src/scheduling/AgendaList/examples/TimeZone.tsx +28 -0
- package/src/scheduling/MonthCalendar/MonthCalendar.tsx +51 -40
- package/src/scheduling/MonthCalendar/MonthCalendarZone.test.tsx +44 -0
- package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
- package/src/scheduling/MonthCalendar/examples/TimeZone.tsx +28 -0
- package/src/scheduling/WeekCalendar/WeekCalendar.tsx +37 -28
- package/src/scheduling/WeekCalendar/WeekCalendarZone.test.tsx +41 -0
- package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
- package/src/scheduling/WeekCalendar/examples/TimeZone.tsx +28 -0
- package/src/scheduling/shared/CalendarHeader.tsx +26 -1
- package/src/scheduling/shared/dates.ts +102 -58
- package/src/scheduling/shared/events.ts +2 -2
- package/src/shell/AppSidebar/AppSidebar.context.test.tsx +175 -0
- package/src/shell/AppSidebar/AppSidebar.doc.ts +29 -0
- package/src/shell/AppSidebar/AppSidebar.tsx +97 -25
- package/src/shell/AppSidebar/block.meta.ts +1 -1
- package/src/shell/GlobalSearch/GlobalSearch.test.tsx +1 -0
- package/src/shell/GlobalSearch/GlobalSearch.tsx +1 -1
- package/src/tables/DataTable/DataTable.cursor-example.test.tsx +67 -0
- package/src/tables/DataTable/DataTable.export.test.tsx +511 -0
- package/src/tables/DataTable/DataTable.inline-edit-focus.test.tsx +32 -0
- package/src/tables/DataTable/DataTable.layout.test.tsx +6 -5
- package/src/tables/DataTable/DataTable.link-actions.test.tsx +18 -0
- package/src/tables/DataTable/DataTable.server-pagination.test.tsx +328 -14
- package/src/tables/DataTable/DataTable.test.tsx +85 -1
- package/src/tables/DataTable/DataTable.tsx +108 -14
- package/src/tables/DataTable/block.meta.ts +11 -1
- package/src/tables/DataTable/column-sizing.ts +2 -2
- package/src/tables/DataTable/data-table-props.ts +29 -1
- package/src/tables/DataTable/data-table-row.tsx +2 -2
- package/src/tables/DataTable/data-table-utils.ts +4 -0
- package/src/tables/DataTable/editable-cell.tsx +20 -79
- package/src/tables/DataTable/examples/csv-export.tsx +74 -0
- package/src/tables/DataTable/examples/cursor-load-more.tsx +87 -0
- package/src/tables/DataTable/examples/server-pagination.tsx +47 -40
- package/src/tables/DataTable/export-menu.tsx +58 -0
- package/src/tables/DataTable/header-cell.tsx +1 -1
- package/src/tables/DataTable/labels.ts +7 -0
- package/src/tables/DataTable/resize-handle.tsx +2 -2
- package/src/tables/DataTable/use-table-export.ts +117 -0
- package/src/tables/FilterBar/FilterBar.test.tsx +12 -0
- package/src/tables/FilterBar/FilterBar.tsx +5 -7
- package/src/team/ProfileHeader/ProfileHeader.picker.test.tsx +34 -0
- package/src/team/ProfileHeader/ProfileHeader.test.tsx +2 -2
- package/src/team/ProfileHeader/ProfileHeader.tsx +17 -24
- package/src/team/ProfileHeader/block.meta.ts +1 -1
- package/src/test/OptInDefaults.test.tsx +10 -1
- package/src/test/clipboard-fallback.test.tsx +49 -0
- package/src/test/copy-examples.test.tsx +29 -0
- package/src/test/copy-feedback.test.tsx +166 -0
- package/src/test/fixtures/opt-in-defaults.json +5 -5
- package/src/test/without-forced-colors.test.ts +44 -0
- package/src/test/without-forced-colors.ts +14 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen, cleanup } from '@testing-library/react';
|
|
2
|
+
import { afterEach, expect, it, vi } from 'vitest';
|
|
3
|
+
import { DescriptionListCard } from '../data-display/DescriptionListCard/DescriptionListCard';
|
|
4
|
+
import { LogViewer } from '../builders/LogViewer/LogViewer';
|
|
5
|
+
import { ErrorPanel } from '../feedback/ErrorPanel/ErrorPanel';
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
vi.restoreAllMocks();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it.each([
|
|
13
|
+
[
|
|
14
|
+
'DescriptionListCard',
|
|
15
|
+
() => <DescriptionListCard items={[{ id: 'id', label: 'ID', value: 'req_123', copyable: true }]} />,
|
|
16
|
+
'Copy ID',
|
|
17
|
+
'ID copied',
|
|
18
|
+
'req_123',
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
'LogViewer',
|
|
22
|
+
() => <LogViewer lines={[{ id: 'id', timestamp: '12:00', level: 'info', message: 'Hello' }]} />,
|
|
23
|
+
'Copy line 12:00',
|
|
24
|
+
'Copied',
|
|
25
|
+
'12:00 INFO Hello',
|
|
26
|
+
],
|
|
27
|
+
['ErrorPanel', () => <ErrorPanel requestId="req_123" />, 'Copy request ID', 'Copied', 'req_123'],
|
|
28
|
+
] as const)('%s confirms only successful fallback writes', async (_, view, idle, copied, value) => {
|
|
29
|
+
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined });
|
|
30
|
+
const exec = vi.fn(() => {
|
|
31
|
+
expect(document.querySelector('textarea')?.value).toBe(value);
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(document, 'execCommand', { configurable: true, value: exec });
|
|
35
|
+
const { unmount } = render(view());
|
|
36
|
+
await act(async () => fireEvent.click(screen.getByRole('button', { name: idle })));
|
|
37
|
+
expect(exec).toHaveBeenCalledWith('copy');
|
|
38
|
+
expect(screen.getByRole('button', { name: copied })).toBeInTheDocument();
|
|
39
|
+
unmount();
|
|
40
|
+
exec.mockReturnValue(false);
|
|
41
|
+
Object.defineProperty(navigator, 'clipboard', {
|
|
42
|
+
configurable: true,
|
|
43
|
+
value: { writeText: vi.fn().mockRejectedValue(new Error('denied')) },
|
|
44
|
+
});
|
|
45
|
+
render(view());
|
|
46
|
+
await act(async () => fireEvent.click(screen.getByRole('button', { name: idle })));
|
|
47
|
+
expect(screen.queryByRole('button', { name: copied })).not.toBeInTheDocument();
|
|
48
|
+
expect(screen.queryByText('Copied to clipboard')).not.toBeInTheDocument();
|
|
49
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import DescriptionListSpanish from '../data-display/DescriptionListCard/examples/Spanish';
|
|
5
|
+
import LogViewerSpanish from '../builders/LogViewer/examples/Spanish';
|
|
6
|
+
import { expectNoAxeViolations } from './a11y';
|
|
7
|
+
|
|
8
|
+
afterEach(() => vi.restoreAllMocks());
|
|
9
|
+
|
|
10
|
+
describe.each(['dark', 'light', 'high_contrast'])('%s copy examples', (theme) => {
|
|
11
|
+
it.each([
|
|
12
|
+
['DescriptionListCard', DescriptionListSpanish, 'Copiar Deployment ID', 'Copy field Deployment ID'],
|
|
13
|
+
['LogViewer', LogViewerSpanish, 'Copiar línea 12:00:00.000', 'Copy 12:00:00.000'],
|
|
14
|
+
] as const)(
|
|
15
|
+
'%s shows catalog and overridden failure names without axe violations',
|
|
16
|
+
async (_name, Example, copyName, overrideName) => {
|
|
17
|
+
document.documentElement.className = theme;
|
|
18
|
+
const user = userEvent.setup();
|
|
19
|
+
vi.spyOn(navigator.clipboard, 'writeText').mockRejectedValue(new DOMException('Denied', 'NotAllowedError'));
|
|
20
|
+
const { container } = render(<Example />);
|
|
21
|
+
await user.click(screen.getAllByRole('button', { name: copyName })[0]!);
|
|
22
|
+
await user.click(screen.getByRole('button', { name: overrideName }));
|
|
23
|
+
expect(screen.getByRole('button', { name: 'No se pudo copiar' })).toBeInTheDocument();
|
|
24
|
+
expect(screen.getByRole('button', { name: 'Copy failed' })).toBeInTheDocument();
|
|
25
|
+
expect(container.querySelector('.lucide-check')).toBeNull();
|
|
26
|
+
await expectNoAxeViolations(container);
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { I18nProvider } from '@gntik-ai/ui';
|
|
2
|
+
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { DescriptionListCard } from '../data-display/DescriptionListCard/DescriptionListCard';
|
|
5
|
+
import { LogViewer } from '../builders/LogViewer/LogViewer';
|
|
6
|
+
|
|
7
|
+
const item = { id: 'request', label: 'Request ID', value: 'req_123', copyable: true };
|
|
8
|
+
const line = { id: 'request', timestamp: '12:00:00.000', level: 'info' as const, message: 'Request received' };
|
|
9
|
+
const cases = [
|
|
10
|
+
{
|
|
11
|
+
name: 'DescriptionListCard',
|
|
12
|
+
idle: 'Copy Request ID',
|
|
13
|
+
copied: 'Request ID copied',
|
|
14
|
+
value: 'req_123',
|
|
15
|
+
callbackValue: item,
|
|
16
|
+
view: (onCopy: () => void, labels?: { copyFailed?: string }) => (
|
|
17
|
+
<DescriptionListCard items={[item]} onCopy={onCopy} labels={labels} />
|
|
18
|
+
),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'LogViewer',
|
|
22
|
+
idle: 'Copy line 12:00:00.000',
|
|
23
|
+
copied: 'Copied',
|
|
24
|
+
value: '12:00:00.000 INFO Request received',
|
|
25
|
+
callbackValue: line,
|
|
26
|
+
view: (onCopy: () => void, labels?: { copyFailed?: string }) => (
|
|
27
|
+
<LogViewer lines={[line]} onCopyLine={onCopy} labels={labels} />
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
let clipboardDescriptor: PropertyDescriptor | undefined;
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
vi.useFakeTimers();
|
|
34
|
+
clipboardDescriptor = Object.getOwnPropertyDescriptor(navigator, 'clipboard');
|
|
35
|
+
});
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
if (clipboardDescriptor) Object.defineProperty(navigator, 'clipboard', clipboardDescriptor);
|
|
38
|
+
else Reflect.deleteProperty(navigator, 'clipboard');
|
|
39
|
+
vi.useRealTimers();
|
|
40
|
+
});
|
|
41
|
+
const setClipboard = (value: unknown) => Object.defineProperty(navigator, 'clipboard', { configurable: true, value });
|
|
42
|
+
|
|
43
|
+
describe.each(cases)('$name clipboard lifecycle', ({ name, idle, copied, value, callbackValue, view }) => {
|
|
44
|
+
it.each(['resolved', 'rejected', 'missing-writeText'] as const)(
|
|
45
|
+
'resets a %s result after 1500ms',
|
|
46
|
+
async (outcome) => {
|
|
47
|
+
const writeText =
|
|
48
|
+
outcome === 'resolved'
|
|
49
|
+
? vi.fn().mockResolvedValue(undefined)
|
|
50
|
+
: vi.fn().mockRejectedValue(new DOMException('Denied', 'NotAllowedError'));
|
|
51
|
+
setClipboard(outcome === 'missing-writeText' ? {} : { writeText });
|
|
52
|
+
const onCopy = vi.fn();
|
|
53
|
+
const { container } = render(view(onCopy));
|
|
54
|
+
await act(async () => fireEvent.click(screen.getByRole('button', { name: idle })));
|
|
55
|
+
const resultLabel = outcome === 'resolved' ? copied : 'Copy failed';
|
|
56
|
+
expect(screen.getByRole('button', { name: resultLabel })).toBeInTheDocument();
|
|
57
|
+
if (outcome === 'resolved') {
|
|
58
|
+
expect(writeText).toHaveBeenCalledWith(value);
|
|
59
|
+
expect(onCopy).toHaveBeenCalledExactlyOnceWith(callbackValue);
|
|
60
|
+
} else expect(onCopy).not.toHaveBeenCalled();
|
|
61
|
+
if (name === 'DescriptionListCard') {
|
|
62
|
+
expect(container.querySelector('[aria-live="polite"]')).toHaveTextContent(
|
|
63
|
+
outcome === 'resolved' ? 'Copied to clipboard' : 'Copy failed',
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
act(() => vi.advanceTimersByTime(1499));
|
|
67
|
+
expect(screen.getByRole('button', { name: resultLabel })).toBeInTheDocument();
|
|
68
|
+
act(() => vi.advanceTimersByTime(1));
|
|
69
|
+
expect(screen.getByRole('button', { name: idle })).toBeInTheDocument();
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
it.each(['resolved', 'rejected'] as const)(
|
|
74
|
+
'waits for the write to be %s before reporting the result',
|
|
75
|
+
async (outcome) => {
|
|
76
|
+
let finish!: () => void;
|
|
77
|
+
let deny!: (error: Error) => void;
|
|
78
|
+
setClipboard({
|
|
79
|
+
writeText: () =>
|
|
80
|
+
new Promise<void>((resolve, reject) => {
|
|
81
|
+
finish = resolve;
|
|
82
|
+
deny = reject;
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
const onCopy = vi.fn();
|
|
86
|
+
render(view(onCopy));
|
|
87
|
+
fireEvent.click(screen.getByRole('button', { name: idle }));
|
|
88
|
+
expect(screen.getByRole('button', { name: idle })).toBeInTheDocument();
|
|
89
|
+
expect(screen.queryByRole('button', { name: copied })).toBeNull();
|
|
90
|
+
expect(onCopy).not.toHaveBeenCalled();
|
|
91
|
+
await act(async () => {
|
|
92
|
+
if (outcome === 'resolved') finish();
|
|
93
|
+
else deny(new DOMException('Denied', 'NotAllowedError'));
|
|
94
|
+
});
|
|
95
|
+
expect(screen.getByRole('button', { name: outcome === 'resolved' ? copied : 'Copy failed' })).toBeInTheDocument();
|
|
96
|
+
expect(onCopy).toHaveBeenCalledTimes(outcome === 'resolved' ? 1 : 0);
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
it('clears the old reset as soon as a new write starts', async () => {
|
|
101
|
+
let finish!: () => void;
|
|
102
|
+
const writeText = vi
|
|
103
|
+
.fn()
|
|
104
|
+
.mockRejectedValueOnce(new DOMException('Denied', 'NotAllowedError'))
|
|
105
|
+
.mockImplementationOnce(
|
|
106
|
+
() =>
|
|
107
|
+
new Promise<void>((resolve) => {
|
|
108
|
+
finish = resolve;
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
setClipboard({ writeText });
|
|
112
|
+
const onCopy = vi.fn();
|
|
113
|
+
const { unmount } = render(view(onCopy));
|
|
114
|
+
await act(async () => fireEvent.click(screen.getByRole('button', { name: idle })));
|
|
115
|
+
act(() => vi.advanceTimersByTime(1000));
|
|
116
|
+
fireEvent.click(screen.getByRole('button', { name: 'Copy failed' }));
|
|
117
|
+
act(() => vi.advanceTimersByTime(500));
|
|
118
|
+
expect(screen.getByRole('button', { name: 'Copy failed' })).toBeInTheDocument();
|
|
119
|
+
await act(async () => finish());
|
|
120
|
+
expect(screen.getByRole('button', { name: copied })).toBeInTheDocument();
|
|
121
|
+
expect(onCopy).toHaveBeenCalledExactlyOnceWith(callbackValue);
|
|
122
|
+
unmount();
|
|
123
|
+
expect(vi.getTimerCount()).toBe(0);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it.each(['resolved', 'rejected'] as const)(
|
|
127
|
+
'does not schedule a reset after a pending write is %s on unmount',
|
|
128
|
+
async (outcome) => {
|
|
129
|
+
let finish!: () => void;
|
|
130
|
+
let deny!: (error: Error) => void;
|
|
131
|
+
setClipboard({
|
|
132
|
+
writeText: () =>
|
|
133
|
+
new Promise<void>((resolve, reject) => {
|
|
134
|
+
finish = resolve;
|
|
135
|
+
deny = reject;
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
const { unmount } = render(view(vi.fn()));
|
|
139
|
+
fireEvent.click(screen.getByRole('button', { name: idle }));
|
|
140
|
+
unmount();
|
|
141
|
+
await act(async () => {
|
|
142
|
+
if (outcome === 'resolved') finish();
|
|
143
|
+
else deny(new DOMException('Denied', 'NotAllowedError'));
|
|
144
|
+
});
|
|
145
|
+
expect(vi.getTimerCount()).toBe(0);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
it.each([
|
|
150
|
+
['en', undefined, 'Copy failed'],
|
|
151
|
+
['es', undefined, 'No se pudo copiar'],
|
|
152
|
+
['es', 'Custom failure', 'Custom failure'],
|
|
153
|
+
] as const)(
|
|
154
|
+
'uses the %s catalog with override %s for the failure name and announcement',
|
|
155
|
+
async (locale, override, expected) => {
|
|
156
|
+
setClipboard({ writeText: vi.fn().mockRejectedValue(new DOMException('Denied', 'NotAllowedError')) });
|
|
157
|
+
const { container } = render(
|
|
158
|
+
<I18nProvider locale={locale}>{view(vi.fn(), { copyFailed: override })}</I18nProvider>,
|
|
159
|
+
);
|
|
160
|
+
await act(async () => fireEvent.click(screen.getByRole('button', { name: /^(Copy |Copiar )/ })));
|
|
161
|
+
expect(screen.getByRole('button', { name: expected })).toBeInTheDocument();
|
|
162
|
+
if (name === 'DescriptionListCard')
|
|
163
|
+
expect(container.querySelector('[aria-live="polite"]')).toHaveTextContent(expected);
|
|
164
|
+
},
|
|
165
|
+
);
|
|
166
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "6ec08de25c3311386f7ee97fc11605f2a7c307fe",
|
|
3
3
|
"html": {
|
|
4
|
-
"description-list": "<div class=\"overflow-hidden rounded-xl border border-border text-card-foreground bg-card shadow-sm\"><div class=\"grid grid-cols-[1fr_auto] items-start gap-x-4 px-5 py-4 border-b border-border\"><h3 class=\"col-start-1 text-[15px] font-semibold tracking-tight text-foreground\">Configuration</h3><p class=\"col-start-1 mt-0.5 text-[13px] text-muted-foreground\">Settings of this deployment.</p></div><dl class=\"divide-y divide-border px-5\"><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Status</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none h-chip px-2.5 font-mono text-[10.5px] rounded-md
|
|
5
|
-
"page-header": "<header class=\"min-w-0\"><nav aria-label=\"Breadcrumb\" class=\"min-w-0 mb-2.5\"><ol class=\"flex flex-wrap items-center gap-2.5 text-[13px]\"><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#projects\" class=\"cursor-pointer underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring font-normal\">Projects</a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#acme-web\" class=\"cursor-pointer underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring font-normal\"><span class=\"font-mono\">acme-web</span></a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><span class=\"truncate font-semibold text-foreground\" aria-current=\"page\">Deployments</span></li></ol></nav><div class=\"flex flex-wrap items-end justify-between gap-4\"><div class=\"min-w-0 flex-1\"><div class=\"flex flex-wrap items-center gap-x-3 gap-y-1.5\"><h1 class=\"min-w-0 truncate text-2xl font-bold tracking-tight text-foreground\">Deployments</h1><span class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none h-chip px-2.5 font-mono text-[10.5px] rounded-md bg-muted-foreground/16 text-foreground tracking-wide\" data-status=\"active\"><span aria-hidden=\"true\" class=\"size-1.5 shrink-0 rounded-full bg-muted-foreground\"></span>active</span></div><p class=\"mt-1.5 max-w-2xl text-[13px] leading-6 text-muted-foreground\">Every build and release of this project across its environments.</p><dl class=\"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12.5px] text-muted-foreground\"><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-globe\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"></path><path d=\"M2 12h20\"></path></svg><dt class=\"sr-only\">Region</dt><dd class=\"text-foreground font-mono text-[12px]\">eu-west-1</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-git-branch\" aria-hidden=\"true\"><path d=\"M15 6a9 9 0 0 0-9 9V3\"></path><circle cx=\"18\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle></svg><dt class=\"sr-only\">Branch</dt><dd class=\"text-foreground font-mono text-[12px]\">main</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-clock\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 6v6l4 2\"></path></svg><dt class=\"sr-only\">Last deploy</dt><dd class=\"text-foreground\">12 min ago</dd></div></dl></div><div class=\"hidden shrink-0 items-center gap-2.5 sm:flex\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">View logs</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">Pause</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div><div class=\"flex shrink-0 items-center gap-2 sm:hidden\"><button type=\"button\" tabindex=\"0\" aria-label=\"More actions\" aria-haspopup=\"menu\" aria-expanded=\"false\" id=\"base-ui-_R_3ba_\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 gap-1.5 text-[13px] rounded-lg px-0 size-9\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-ellipsis lucide-more-horizontal\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"19\" cy=\"12\" r=\"1\"></circle><circle cx=\"5\" cy=\"12\" r=\"1\"></circle></svg></button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div></div><div data-orientation=\"horizontal\" data-activation-direction=\"none\" class=\"flex flex-col gap-4 mt-5\"><div data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"tablist\" aria-label=\"Page sections\" class=\"relative flex items-center gap-6 border-b border-border overflow-x-auto\"><button type=\"button\" data-active=\"\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"true\" id=\"base-ui-_R_n_\" data-composite-item-active=\"\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Overview</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_17_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Deployments<span class=\"inline-flex h-[18px] items-center rounded-full px-1.5 font-mono text-[10.5px] leading-none transition-colors bg-secondary text-muted-foreground group-data-active:bg-primary/14 group-data-active:text-primary-chip-text\">1,284</span></button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_1n_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Domains</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_27_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Settings</button><span data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"presentation\" hidden=\"\" class=\"absolute start-0 transition-[translate,width,height] duration-200 ease-out motion-reduce:transition-none top-auto -bottom-px h-0.5 w-(--active-tab-width) translate-x-(--active-tab-left) bg-primary\"></span></div></div></header>",
|
|
6
|
-
"page-header-ref": "<header class=\"min-w-0\"><nav aria-label=\"Breadcrumb\" class=\"min-w-0 mb-2.5\"><ol class=\"flex flex-wrap items-center gap-2.5 text-[13px]\"><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#projects\" class=\"cursor-pointer underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring font-normal\">Projects</a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#acme-web\" class=\"cursor-pointer underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring font-normal\"><span class=\"font-mono\">acme-web</span></a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><span class=\"truncate font-semibold text-foreground\" aria-current=\"page\">Deployments</span></li></ol></nav><div class=\"flex flex-wrap items-end justify-between gap-4\"><div class=\"min-w-0 flex-1\"><div class=\"flex flex-wrap items-center gap-x-3 gap-y-1.5\"><h1 tabindex=\"-1\" class=\"min-w-0 truncate text-2xl font-bold tracking-tight text-foreground\">Deployments</h1><span class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none h-chip px-2.5 font-mono text-[10.5px] rounded-md bg-muted-foreground/16 text-foreground tracking-wide\" data-status=\"active\"><span aria-hidden=\"true\" class=\"size-1.5 shrink-0 rounded-full bg-muted-foreground\"></span>active</span></div><p class=\"mt-1.5 max-w-2xl text-[13px] leading-6 text-muted-foreground\">Every build and release of this project across its environments.</p><dl class=\"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12.5px] text-muted-foreground\"><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-globe\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"></path><path d=\"M2 12h20\"></path></svg><dt class=\"sr-only\">Region</dt><dd class=\"text-foreground font-mono text-[12px]\">eu-west-1</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-git-branch\" aria-hidden=\"true\"><path d=\"M15 6a9 9 0 0 0-9 9V3\"></path><circle cx=\"18\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle></svg><dt class=\"sr-only\">Branch</dt><dd class=\"text-foreground font-mono text-[12px]\">main</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-clock\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 6v6l4 2\"></path></svg><dt class=\"sr-only\">Last deploy</dt><dd class=\"text-foreground\">12 min ago</dd></div></dl></div><div class=\"hidden shrink-0 items-center gap-2.5 sm:flex\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">View logs</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">Pause</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div><div class=\"flex shrink-0 items-center gap-2 sm:hidden\"><button type=\"button\" tabindex=\"0\" aria-label=\"More actions\" aria-haspopup=\"menu\" aria-expanded=\"false\" id=\"base-ui-_R_3ba_\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm hover:bg-secondary/70 gap-1.5 text-[13px] rounded-lg px-0 size-9\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-ellipsis lucide-more-horizontal\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"19\" cy=\"12\" r=\"1\"></circle><circle cx=\"5\" cy=\"12\" r=\"1\"></circle></svg></button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div></div><div data-orientation=\"horizontal\" data-activation-direction=\"none\" class=\"flex flex-col gap-4 mt-5\"><div data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"tablist\" aria-label=\"Page sections\" class=\"relative flex items-center gap-6 border-b border-border overflow-x-auto\"><button type=\"button\" data-active=\"\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"true\" id=\"base-ui-_R_n_\" data-composite-item-active=\"\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Overview</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_17_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Deployments<span class=\"inline-flex h-[18px] items-center rounded-full px-1.5 font-mono text-[10.5px] leading-none transition-colors bg-secondary text-muted-foreground group-data-active:bg-primary/14 group-data-active:text-primary-chip-text\">1,284</span></button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_1n_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Domains</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_27_\" class=\"group relative z-[1] inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Settings</button><span data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"presentation\" hidden=\"\" class=\"absolute start-0 transition-[translate,width,height] duration-200 ease-out motion-reduce:transition-none top-auto -bottom-px h-0.5 w-(--active-tab-width) translate-x-(--active-tab-left) bg-primary\"></span></div></div></header>",
|
|
7
|
-
"no-access": "<div class=\"flex w-full flex-col items-center justify-center text-center px-6 py-10 max-w-none rounded-lg border border-dashed border-border mx-auto\"><div class=\"grid place-items-center bg-secondary/70 text-muted-foreground ring-1 ring-border size-12 rounded-2xl\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-lock\" aria-hidden=\"true\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h3 class=\"font-semibold tracking-tight text-foreground mt-4 text-[15px]\">You don’t have access to Billing</h3><p class=\"text-muted-foreground mt-1.5 text-[13px] leading-6\">Ask an organization admin to grant you a role that includes billing permissions.</p><div class=\"flex flex-wrap items-center justify-center gap-2 mt-5\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none
|
|
8
|
-
"no-access-handler": "<div class=\"flex w-full flex-col items-center justify-center text-center px-6 py-10 max-w-none rounded-lg border border-dashed border-border mx-auto\"><div class=\"grid place-items-center bg-secondary/70 text-muted-foreground ring-1 ring-border size-12 rounded-2xl\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-lock\" aria-hidden=\"true\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h3 class=\"font-semibold tracking-tight text-foreground mt-4 text-[15px]\">You don’t have access to Billing</h3><p class=\"text-muted-foreground mt-1.5 text-[13px] leading-6\">Ask an organization admin to grant you a role that includes billing permissions.</p><div class=\"flex flex-wrap items-center justify-center gap-2 mt-5\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none
|
|
4
|
+
"description-list": "<div class=\"overflow-hidden rounded-xl border border-border text-card-foreground bg-card shadow-sm\"><div class=\"grid grid-cols-[1fr_auto] items-start gap-x-4 px-5 py-4 border-b border-border\"><h3 class=\"col-start-1 text-[15px] font-semibold tracking-tight text-foreground\">Configuration</h3><p class=\"col-start-1 mt-0.5 text-[13px] text-muted-foreground\">Settings of this deployment.</p></div><dl class=\"divide-y divide-border px-5\"><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Status</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span data-tone=\"success\" class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none [--badge-bg-alpha:15%] [--badge-border-alpha:45%] bg-tone/(--badge-bg-alpha) text-tone-chip-text h-chip px-2.5 font-mono text-[10.5px] rounded-md tracking-wide\" data-status=\"running\"><span aria-hidden=\"true\" class=\"size-1.5 shrink-0 rounded-full bg-tone\"></span>Running</span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Deployment ID</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate font-mono text-[12.5px]\">dep_7f3c9a21</span><button type=\"button\" tabindex=\"0\" aria-label=\"Copy Deployment ID\" class=\"inline-flex items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 text-muted-foreground not-data-[disabled]:hover:bg-secondary/70 not-data-[disabled]:hover:text-foreground gap-1.5 text-[12.5px] rounded-md px-0 size-7 shrink-0\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-copy\" aria-hidden=\"true\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"></rect><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"></path></svg></button><span class=\"sr-only\" aria-live=\"polite\"></span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Runtime</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate font-mono text-[12.5px]\">node-24</span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Region</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate font-mono text-[12.5px]\">eu-west-1</span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Endpoint</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate font-mono text-[12.5px]\">https://api.example.com/v1/orders</span><button type=\"button\" tabindex=\"0\" aria-label=\"Copy Endpoint\" class=\"inline-flex items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 text-muted-foreground not-data-[disabled]:hover:bg-secondary/70 not-data-[disabled]:hover:text-foreground gap-1.5 text-[12.5px] rounded-md px-0 size-7 shrink-0\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-copy\" aria-hidden=\"true\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"></rect><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"></path></svg></button><span class=\"sr-only\" aria-live=\"polite\"></span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Owner</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate\">Platform team</span></dd></div><div class=\"grid grid-cols-1 gap-1 py-3.5 sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4\"><dt class=\"text-[13px] text-muted-foreground\">Created</dt><dd class=\"flex min-w-0 items-center gap-2 text-[13px] text-foreground\"><span class=\"min-w-0 truncate\">Mar 12, 2026, 09:41</span></dd></div></dl></div>",
|
|
5
|
+
"page-header": "<header class=\"min-w-0\"><nav aria-label=\"Breadcrumb\" class=\"min-w-0 mb-2.5\"><ol class=\"flex flex-wrap items-center gap-2.5 text-[13px]\"><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#projects\" class=\"cursor-interactive underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-ring font-normal\">Projects</a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#acme-web\" class=\"cursor-interactive underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-ring font-normal\"><span class=\"font-mono\">acme-web</span></a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><span class=\"truncate font-semibold text-foreground\" aria-current=\"page\">Deployments</span></li></ol></nav><div class=\"flex flex-wrap items-end justify-between gap-4\"><div class=\"min-w-0 flex-1\"><div class=\"flex flex-wrap items-center gap-x-3 gap-y-1.5\"><h1 class=\"min-w-0 truncate text-2xl font-bold tracking-tight text-foreground\">Deployments</h1><span data-tone=\"neutral\" class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none [--badge-bg-alpha:16%] [--badge-border-alpha:45%] bg-tone/(--badge-bg-alpha) text-tone-chip-text h-chip px-2.5 font-mono text-[10.5px] rounded-md tracking-wide\" data-status=\"active\"><span aria-hidden=\"true\" class=\"size-1.5 shrink-0 rounded-full bg-tone\"></span>active</span></div><p class=\"mt-1.5 max-w-2xl text-[13px] leading-6 text-muted-foreground\">Every build and release of this project across its environments.</p><dl class=\"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12.5px] text-muted-foreground\"><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-globe\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"></path><path d=\"M2 12h20\"></path></svg><dt class=\"sr-only\">Region</dt><dd class=\"text-foreground font-mono text-[12px]\">eu-west-1</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-git-branch\" aria-hidden=\"true\"><path d=\"M15 6a9 9 0 0 0-9 9V3\"></path><circle cx=\"18\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle></svg><dt class=\"sr-only\">Branch</dt><dd class=\"text-foreground font-mono text-[12px]\">main</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-clock\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 6v6l4 2\"></path></svg><dt class=\"sr-only\">Last deploy</dt><dd class=\"text-foreground\">12 min ago</dd></div></dl></div><div class=\"hidden shrink-0 items-center gap-2.5 sm:flex\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">View logs</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">Pause</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div><div class=\"flex shrink-0 items-center gap-2 sm:hidden\"><button type=\"button\" tabindex=\"0\" aria-label=\"More actions\" aria-haspopup=\"menu\" aria-expanded=\"false\" id=\"base-ui-_R_3ba_\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 gap-1.5 text-[13px] rounded-lg px-0 size-9\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-ellipsis lucide-more-horizontal\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"19\" cy=\"12\" r=\"1\"></circle><circle cx=\"5\" cy=\"12\" r=\"1\"></circle></svg></button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div></div><div data-orientation=\"horizontal\" data-activation-direction=\"none\" class=\"flex flex-col gap-4 mt-5\"><div data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"tablist\" aria-label=\"Page sections\" class=\"relative flex items-center gap-6 border-b border-border overflow-x-auto\"><button type=\"button\" data-active=\"\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"true\" id=\"base-ui-_R_n_\" data-composite-item-active=\"\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Overview</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_17_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Deployments<span class=\"inline-flex h-[18px] items-center rounded-full px-1.5 font-mono text-[10.5px] leading-none transition-colors bg-secondary text-muted-foreground group-data-active:bg-primary/14 group-data-active:text-primary-chip-text\">1,284</span></button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_1n_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Domains</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_27_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Settings</button><span data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"presentation\" hidden=\"\" class=\"absolute start-0 transition-[translate,width,height] duration-200 ease-out motion-reduce:transition-none top-auto -bottom-px h-0.5 w-(--active-tab-width) translate-x-(--active-tab-left) bg-primary\"></span></div></div></header>",
|
|
6
|
+
"page-header-ref": "<header class=\"min-w-0\"><nav aria-label=\"Breadcrumb\" class=\"min-w-0 mb-2.5\"><ol class=\"flex flex-wrap items-center gap-2.5 text-[13px]\"><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#projects\" class=\"cursor-interactive underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-ring font-normal\">Projects</a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><a href=\"#acme-web\" class=\"cursor-interactive underline-offset-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 truncate rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground hover:no-underline focus-ring font-normal\"><span class=\"font-mono\">acme-web</span></a><span class=\"inline-flex shrink-0 select-none text-muted-foreground/40\" aria-hidden=\"true\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-chevron-right rtl:-scale-x-100\" aria-hidden=\"true\"><path d=\"m9 18 6-6-6-6\"></path></svg></span></li><li class=\"inline-flex min-w-0 items-center gap-2.5\"><span class=\"truncate font-semibold text-foreground\" aria-current=\"page\">Deployments</span></li></ol></nav><div class=\"flex flex-wrap items-end justify-between gap-4\"><div class=\"min-w-0 flex-1\"><div class=\"flex flex-wrap items-center gap-x-3 gap-y-1.5\"><h1 tabindex=\"-1\" class=\"min-w-0 truncate text-2xl font-bold tracking-tight text-foreground\">Deployments</h1><span data-tone=\"neutral\" class=\"inline-flex max-w-full shrink-0 items-center gap-1.5 font-semibold whitespace-nowrap select-none [--badge-bg-alpha:16%] [--badge-border-alpha:45%] bg-tone/(--badge-bg-alpha) text-tone-chip-text h-chip px-2.5 font-mono text-[10.5px] rounded-md tracking-wide\" data-status=\"active\"><span aria-hidden=\"true\" class=\"size-1.5 shrink-0 rounded-full bg-tone\"></span>active</span></div><p class=\"mt-1.5 max-w-2xl text-[13px] leading-6 text-muted-foreground\">Every build and release of this project across its environments.</p><dl class=\"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12.5px] text-muted-foreground\"><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-globe\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"></path><path d=\"M2 12h20\"></path></svg><dt class=\"sr-only\">Region</dt><dd class=\"text-foreground font-mono text-[12px]\">eu-west-1</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-git-branch\" aria-hidden=\"true\"><path d=\"M15 6a9 9 0 0 0-9 9V3\"></path><circle cx=\"18\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle></svg><dt class=\"sr-only\">Branch</dt><dd class=\"text-foreground font-mono text-[12px]\">main</dd></div><div class=\"inline-flex items-center gap-1.5\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-clock\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M12 6v6l4 2\"></path></svg><dt class=\"sr-only\">Last deploy</dt><dd class=\"text-foreground\">12 min ago</dd></div></dl></div><div class=\"hidden shrink-0 items-center gap-2.5 sm:flex\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">View logs</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 h-control gap-1.5 px-control text-[13px] rounded-lg\">Pause</button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div><div class=\"flex shrink-0 items-center gap-2 sm:hidden\"><button type=\"button\" tabindex=\"0\" aria-label=\"More actions\" aria-haspopup=\"menu\" aria-expanded=\"false\" id=\"base-ui-_R_3ba_\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 border border-border bg-card text-foreground shadow-sm not-data-[disabled]:hover:bg-secondary/70 gap-1.5 text-[13px] rounded-lg px-0 size-9\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-ellipsis lucide-more-horizontal\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"19\" cy=\"12\" r=\"1\"></circle><circle cx=\"5\" cy=\"12\" r=\"1\"></circle></svg></button><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">New deployment</button></div></div><div data-orientation=\"horizontal\" data-activation-direction=\"none\" class=\"flex flex-col gap-4 mt-5\"><div data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"tablist\" aria-label=\"Page sections\" class=\"relative flex items-center gap-6 border-b border-border overflow-x-auto\"><button type=\"button\" data-active=\"\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"true\" id=\"base-ui-_R_n_\" data-composite-item-active=\"\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Overview</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_17_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Deployments<span class=\"inline-flex h-[18px] items-center rounded-full px-1.5 font-mono text-[10.5px] leading-none transition-colors bg-secondary text-muted-foreground group-data-active:bg-primary/14 group-data-active:text-primary-chip-text\">1,284</span></button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_1n_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Domains</button><button type=\"button\" data-orientation=\"horizontal\" data-activation-direction=\"none\" aria-disabled=\"false\" tabindex=\"-1\" role=\"tab\" aria-selected=\"false\" id=\"base-ui-_R_27_\" class=\"group relative z-raised inline-flex shrink-0 cursor-interactive items-center justify-center gap-2 font-medium whitespace-nowrap select-none text-muted-foreground transition-colors hover:text-foreground data-active:text-foreground focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 h-tab -mb-px border-b-2 border-transparent text-[13px] rounded-t-sm\">Settings</button><span data-orientation=\"horizontal\" data-activation-direction=\"none\" role=\"presentation\" hidden=\"\" class=\"absolute start-0 transition-[translate,width,height] duration-200 ease-out motion-reduce:transition-none top-auto -bottom-px h-0.5 w-(--active-tab-width) translate-x-(--active-tab-left) bg-primary\"></span></div></div></header>",
|
|
7
|
+
"no-access": "<div class=\"flex w-full flex-col items-center justify-center text-center px-6 py-10 max-w-none rounded-lg border border-dashed border-border mx-auto\"><div class=\"grid place-items-center bg-secondary/70 text-muted-foreground ring-1 ring-border size-12 rounded-2xl\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-lock\" aria-hidden=\"true\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h3 class=\"font-semibold tracking-tight text-foreground mt-4 text-[15px]\">You don’t have access to Billing</h3><p class=\"text-muted-foreground mt-1.5 text-[13px] leading-6\">Ask an organization admin to grant you a role that includes billing permissions.</p><div class=\"flex flex-wrap items-center justify-center gap-2 mt-5\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">Request access</button></div><p role=\"status\" class=\"sr-only\"></p></div>",
|
|
8
|
+
"no-access-handler": "<div class=\"flex w-full flex-col items-center justify-center text-center px-6 py-10 max-w-none rounded-lg border border-dashed border-border mx-auto\"><div class=\"grid place-items-center bg-secondary/70 text-muted-foreground ring-1 ring-border size-12 rounded-2xl\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-lock\" aria-hidden=\"true\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h3 class=\"font-semibold tracking-tight text-foreground mt-4 text-[15px]\">You don’t have access to Billing</h3><p class=\"text-muted-foreground mt-1.5 text-[13px] leading-6\">Ask an organization admin to grant you a role that includes billing permissions.</p><div class=\"flex flex-wrap items-center justify-center gap-2 mt-5\"><button type=\"button\" tabindex=\"0\" class=\"inline-flex shrink-0 items-center justify-center font-semibold whitespace-nowrap transition-colors select-none cursor-interactive focus-ring data-[disabled]:cursor-disabled data-[disabled]:opacity-50 bg-primary text-primary-foreground shadow-sm not-data-[disabled]:hover:bg-primary/90 h-control gap-1.5 px-control text-[13px] rounded-lg\">Request access</button></div><p role=\"status\" class=\"sr-only\"></p></div>"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { withoutForcedColors } from './without-forced-colors';
|
|
2
|
+
|
|
3
|
+
describe('withoutForcedColors', () => {
|
|
4
|
+
it('drops an all-forced class attribute but preserves empty and ordinary attributes exactly', () => {
|
|
5
|
+
const element = document.createElement('div');
|
|
6
|
+
element.innerHTML =
|
|
7
|
+
'<i class="forced-colors:block\tforced-colors:bg-[Canvas]"></i><b class=""></b><span class=" \t "></span><em></em>';
|
|
8
|
+
|
|
9
|
+
expect(withoutForcedColors(element).innerHTML).toBe('<i></i><b class=""></b><span class=" \t "></span><em></em>');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('clones the whole DOM and removes only forced-colors class tokens', () => {
|
|
13
|
+
const element = document.createElement('section');
|
|
14
|
+
element.setAttribute('class', 'alpha\tforced-colors:bg-[Canvas]\n beta');
|
|
15
|
+
element.setAttribute('data-state', 'checked');
|
|
16
|
+
element.innerHTML =
|
|
17
|
+
'Before<!--keep--><span class="first forced-colors:text-[HighlightText] hover:forced-colors:bg-[Canvas] last" aria-label="Choice">Text <b class="bold unchanged">inside</b></span>After<svg class="icon forced-colors:fill-[CanvasText]"><path d="M0 0"></path></svg>';
|
|
18
|
+
const original = element.outerHTML;
|
|
19
|
+
|
|
20
|
+
const filtered = withoutForcedColors(element);
|
|
21
|
+
|
|
22
|
+
expect(filtered.outerHTML).toBe(
|
|
23
|
+
'<section class="alpha beta" data-state="checked">Before<!--keep--><span class="first hover:forced-colors:bg-[Canvas] last" aria-label="Choice">Text <b class="bold unchanged">inside</b></span>After<svg class="icon"><path d="M0 0"></path></svg></section>',
|
|
24
|
+
);
|
|
25
|
+
expect(filtered).not.toBe(element);
|
|
26
|
+
expect(filtered.firstElementChild).not.toBe(element.firstElementChild);
|
|
27
|
+
expect(element.outerHTML).toBe(original);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it.each(['class', 'aria-label'])('retains a %s regression in a fixture copy', (attribute) => {
|
|
31
|
+
const element = document.createElement('div');
|
|
32
|
+
element.innerHTML = '<button class="ordinary forced-colors:bg-[Highlight]" aria-label="Save">Save</button>';
|
|
33
|
+
const baseline = '<button class="ordinary" aria-label="Save">Save</button>';
|
|
34
|
+
expect(withoutForcedColors(element).innerHTML).toBe(baseline);
|
|
35
|
+
|
|
36
|
+
const changed = element.cloneNode(true) as HTMLElement;
|
|
37
|
+
changed.firstElementChild!.setAttribute(attribute, 'changed');
|
|
38
|
+
|
|
39
|
+
expect(withoutForcedColors(changed).innerHTML).not.toBe(baseline);
|
|
40
|
+
expect(element.innerHTML).toBe(
|
|
41
|
+
'<button class="ordinary forced-colors:bg-[Highlight]" aria-label="Save">Save</button>',
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Compare pinned ordinary-colour DOM without media-scoped forced-colour classes. */
|
|
2
|
+
export function withoutForcedColors(element: HTMLElement): HTMLElement {
|
|
3
|
+
const clone = element.cloneNode(true) as HTMLElement;
|
|
4
|
+
for (const node of [clone, ...clone.querySelectorAll('[class]')]) {
|
|
5
|
+
const classes = node.getAttribute('class');
|
|
6
|
+
if (classes === null) continue;
|
|
7
|
+
const tokens = classes.split(/\s+/).filter(Boolean);
|
|
8
|
+
const ordinary = tokens.filter((token) => !token.startsWith('forced-colors:'));
|
|
9
|
+
if (ordinary.length === tokens.length) continue;
|
|
10
|
+
if (ordinary.length === 0) node.removeAttribute('class');
|
|
11
|
+
else node.setAttribute('class', ordinary.join(' '));
|
|
12
|
+
}
|
|
13
|
+
return clone;
|
|
14
|
+
}
|