Repository navigation
feat(Timestamp): the hover card's copy button resolves its glyph through the timestamp-copy icon slot - #9830
Conversation
…g with CodeBlock's copy button
defineTheme({componentIcons}) maps a component icon slot to a shared icon
name, null, a partial {icon, variant, size} request, or a pure function of
the slot's state. One shared resolution applies caller content, then the
theme's slot, then the component's fallback, field by field, and ignores a
malformed field with one development warning. CodeBlock's copy button is the
first slot, code-block-copy, with state {copied}. The static view reads back
through theme.componentIcons; theme build carries static slot values and
fails on a slot function. Component docs, the CLI, and the docsite registry
list a component's slots.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
… values DefinedTheme['componentIcons'] keeps the same shape as a Partial<Record>, so documentation that names DefinedTheme does not have to enumerate every icon name a slot may hold.
93917e9 to
2a91e0d
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on FR10, which this pull request adds to the Timestamp component contract. FR10 makes the hover card's copy glyph the timestamp-copy component icon slot: state {copied}, fallback copy then check, null hiding only the glyph while the button keeps its size, name, tooltip and copy action, and a request size changing only the glyph. The decision also covers the new ComponentIconSlotMap['timestamp-copy'] type member, because the current contract picks copy and check with no slot and the icon-slot system spec leaves that choice to the component's own contract.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner; to reject, say what should change.
- No blocking defects: the tests and a browser check show the default button unchanged and the 28px button kept under every theme value.
- Optional wording fix: the record's Compatibility/readiness row still says "no API, default, or output changes" beside the new slot.
- For the decision: with
null, each copyable row shows a blank button until it is hovered or focused.
This builds on #9828 and merges after it.
[Automated review]
| | Behavior | Relative output carries the full absolute date as its default accessible name; relative output, or configured `tooltipEntries`, attach a keyboard-reachable hover card of copyable rows. | | ||
| | End-user impact | Readers see compact or exact times in their locale; screen-reader users hear the full date and time zone; keyboard users can open and copy the exact time. | | ||
| | Builder impact | A theme may map the copy glyph through the `timestamp-copy` icon slot (FR10); otherwise none. | | ||
| | Compatibility/readiness | Released behavior recorded as current; no API, default, or output changes. Three implementation gaps are listed under Current-state impact. FR10 (the copy icon slot, additive) is current and shipped; with no theme entry, output is unchanged. | |
There was a problem hiding this comment.
Non-blocking: this cell still opens with "no API, default, or output changes", but FR10 adds the timestamp-copy slot (a new ComponentIconSlotMap member and theme key). Suggested wording: "no prop, default, or output changes; FR10 adds the opt-in timestamp-copy theme slot."
…template's componentIcons example builds The icon slot architecture record's baseline points to ComponentIconSlotMap and each owning component's docs for Core's slots. The theme template's componentIcons example is a static value, which astryx theme build carries.
…ugh the timestamp-copy icon slot
The copy button passes {copied} to the theme's componentIcons['timestamp-copy']
and keeps copy, then check while copied, as its fallback. null hides only the
glyph; the button keeps its name, tooltip, and copy action.
406976d to
0b9a03b
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on FR10, which this pull request adds to the Timestamp component contract: it makes the hover card's copy glyph the timestamp-copy component icon slot (state {copied}, fallback copy then check, null hiding only the glyph while the button keeps its size, name, tooltip and copy action, and a request size changing only the glyph) and adds the ComponentIconSlotMap['timestamp-copy'] type member, which no current clause settles. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or says what should change. There are no blocking findings, and with no theme entry the hover card is unchanged.
- Non-blocking: FR8 still says the button "switches to a check icon"; under FR10 a theme can draw another copied glyph, so FR8 could point at FR10 (see the inline note).
[Automated review]
| | FR5 | Relative output is named by the full absolute date and the long time-zone name unless a caller names the element; absolute output adds no name. A caller's explicit `aria-label` reaches the element (`architecture:public-component-api` INV5). | Current source and tests | | ||
| | FR6 | When `hasTooltip` is true and the output is relative or `tooltipEntries` is non-empty, a lazily loaded HoverCard named "Timestamp details" attaches above the timestamp, opening on hover and on keyboard focus; the `time` element gains `tabIndex={0}`. Otherwise no card renders and no tab stop is added. Focus placed on the timestamp stays there when the card attaches (`spec:AST-085` FR4). Implementation gap: while the card module loads, a fallback `time` with the tab stop renders, and attaching the card replaces it, so focus placed on it falls to the page body and no card opens (Current-state impact). | Current source and tests | | ||
| | FR7 | The card is a description list in a grid: an optional label column (present when any row has a label), the value column, and a trailing action column (present when any row is copyable). Without entries it has one copyable row with the full absolute time in the viewer's zone. Each configured entry is one row in the given order, rendered in its own time zone and format, read-only unless `isCopyable`. An unknown time zone does not crash. A description list holds only name-value groups (WCAG 2.2 1.3.1). Implementation gaps: once any row is copyable, every row carries an action-cell `div` inside its row group (empty on read-only rows), so the open card fails the `definition-list` structure check, and a card with no labelled rows, the default card included, renders each row as a lone `dd` with no `dt` (Current-state impact). | Current source and tests | | ||
| | FR8 | A copy button is a small ghost IconButton on the `timestamp-copy-button` target, named "Copy {value}" with a "Copy" tooltip; activating it writes the row's value to the clipboard, switches to a check icon and the "Copied" name and tooltip for 1.5 seconds, and announces "Copied" politely. A clipboard rejection does nothing. | Current source and tests | |
There was a problem hiding this comment.
Non-blocking: FR8 still says activating the button "switches to a check icon". Under FR10 a theme can draw another glyph while copied (the new slot-function test draws checkDouble), so this holds only with no theme entry. Suggested wording: "switches to the copied glyph (check unless a theme maps timestamp-copy, FR10)".
|
Took the FR8 wording suggestion in 583e527: activation now "switches to the copied glyph ( |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on FR10, which this pull request adds to the Timestamp component contract: it makes the hover card's copy glyph the timestamp-copy component icon slot (state {copied}, fallback copy then check, null hiding only the glyph while the button keeps its size, name, tooltip and copy action, and a request size changing only the glyph) and adds the ComponentIconSlotMap['timestamp-copy'] type member, which no current clause settles.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or says what should change.
There are no blocking findings: with no theme entry the hover card is unchanged, and FR8 now points at FR10. For the decision: with null, each copyable row shows an empty button until it is hovered or focused.
This builds on #9828 and merges after it.
[Automated review]
…de-block # Conflicts: # docs/specs/components/CodeBlock/CodeBlock.spec.md # packages/cli/test/__golden__/no-icon-set/search-icon-set.json # packages/cli/test/__golden__/no-icon-set/search-icon-set.txt
…timestamp # Conflicts: # docs/specs/components/Timestamp/Timestamp.spec.md # packages/core/src/Timestamp/Timestamp.test.tsx
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the timestamp-copy slot this pull request adds to Timestamp's hover-card copy button (state {copied}, fallback copy then check, null hiding only the glyph, a request size changing only the glyph) and on its new ComponentIconSlotMap['timestamp-copy'] type member, which no current spec settles.
- The merge from the base branch reverted
docs/specs/components/Timestamp/Timestamp.spec.mdto the base's version, so FR10, the FR8 rewording and the related rows are gone while the description still says the record gains FR10; please re-apply those edits on top of the merged file.
Once FR10 is restored, an engineering owner records the decision by commenting /approve-spec <full head SHA> on that head (the author may do so as an engineering owner), or says what should change. With no theme entry the hover card is unchanged, and the slot's tests pass. This builds on #9828 and merges after it.
[Automated review]
The merge commit's lint hook reformatted this unrelated file; it now matches main again.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the timestamp-copy slot this pull request adds to Timestamp's hover-card copy button: state {copied}, fallback copy then check, null hiding only the glyph, a request size changing only the glyph, and the new ComponentIconSlotMap['timestamp-copy'] type member. No current spec settles it yet, because the Timestamp contract still says the button switches to "a check icon" and the proposed Timestamp FR10 lives in #10045.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on #10045 (the author may do so as an engineering owner), or says what should change; once that record lands on main, this pull request matches it. No code changes are needed here: with no theme entry the hover card is unchanged, and the slot's tests, docs listing, null and size behavior check out.
[Automated review]
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the timestamp-copy slot this pull request adds to Timestamp's hover-card copy button: state {copied}, fallback copy then check, null hiding only the glyph, a request size changing only the glyph, and the new ComponentIconSlotMap['timestamp-copy'] type member. No current spec settles it yet, because the Timestamp contract still says the button switches to "a check icon" and the proposed Timestamp FR10 lives in #10045.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on #10045 (the author may do so as an engineering owner), or says what should change; once that record lands on main, this pull request matches it. No code changes are needed here: with no theme entry the hover card is unchanged, and the slot's tests, docs listing, null and size behavior check out.
[Automated review]
…de-block # Conflicts: # packages/cli/test/__golden__/no-icon-set/search-icon-set.json # packages/cli/test/__golden__/no-icon-set/search-icon-set.txt
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the timestamp-copy slot this pull request adds to Timestamp's hover-card copy button: state {copied}, fallback copy then check, null hiding only the glyph, a request size changing only the glyph, and the new ComponentIconSlotMap['timestamp-copy'] type member. No current spec settles it yet: the Timestamp contract still says the button switches to "a check icon", and the proposed Timestamp FR10 lives in #10045.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on #10045 (the author may do so as an engineering owner) or says what should change; once that record lands on main, this pull request matches it. No code changes are needed here: with no theme entry the hover card is unchanged, and the slot's tests, docs listing, null and size behavior check out.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because its workflows run only for pull requests into main or a release branch, and this one targets #9828's branch.
The timestamp-copy slot matches the Timestamp contract on main (FR10 and the FR8 wording from #10045): with no theme entry the hover card is unchanged, null hides only the glyph, and a size request changes only the glyph. The new tests and the docs listing cover each of these. This pull request merges after #9828.
[Automated review]
There was a problem hiding this comment.
Approved. The timestamp-copy slot matches the Timestamp contract on main (FR10 and the FR8 wording): with no theme entry the hover card is unchanged, null hides only the glyph, and a size request changes only the glyph. The new tests and the docs listing cover each of these, and the CI checks pass on this head.
[Automated review]
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ContextMenuItem | 26.4 kB (+442 B) · 6.1 kB CSS (0) | — | — · — · — |
| Timestamp · Storybook | 22.9 kB (+1 B) · 8.9 kB CSS (0) | 695 (+7) | ✓ · ✓ · — |
| AppShell | 80.3 kB (0) · 12.3 kB CSS (0) | — | — · — · — |
78 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Banner | 52.5 kB (0) · 9.3 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 60.9 kB (0) · 9.7 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 75.2 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| Calendar | 61.4 kB (0) · 9.3 kB CSS (0) | — | — · — · — |
| Carousel | 57.4 kB (0) · 9.5 kB CSS (0) | — | — · — · — |
| ChatComposer | 67.1 kB (0) · 10.6 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 51.1 kB (0) · 8.8 kB CSS (0) | — | — · — · — |
| ChatLayout | 53.8 kB (0) · 9.3 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 51.1 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| ChatMessageMetadata | 19.9 kB (0) · 4.1 kB CSS (0) | — | — · — · — |
| ChatSendButton | 51.0 kB (0) · 8.7 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 26.1 kB (0) · 8.3 kB CSS (0) | — | — · — · — |
| Citation | 20.2 kB (0) · 4.4 kB CSS (0) | — | — · — · — |
| CodeBlock | 65.0 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| Collapsible | 25.0 kB (0) · 4.5 kB CSS (0) | — | — · — · — |
| CommandPalette | 58.7 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 27.0 kB (0) · 7.5 kB CSS (0) | — | — · — · — |
| ComplexSelector | 61.4 kB (0) · 10.5 kB CSS (0) | — | — · — · — |
| ContextMenu | 87.9 kB (0) · 16.4 kB CSS (0) | — | — · — · — |
| DateInput | 165.8 kB (0) · 15.6 kB CSS (0) | — | — · — · — |
| DateRangeInput | 80.4 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| DateTimeInput | 188.3 kB (0) · 17.3 kB CSS (0) | — | — · — · — |
| DrawerHeader | 53.6 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| DropdownMenu | 82.6 kB (0) · 16.5 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 21.1 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 20.3 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 21.1 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 63.5 kB (0) · 9.4 kB CSS (0) | — | — · — · — |
| FileInput | 59.2 kB (0) · 9.7 kB CSS (0) | — | — · — · — |
| Icon · Storybook | 7.8 kB (0) · 681 B CSS (0) | 922 (+1) | ✓ · ✓ · — |
| Lightbox | 58.7 kB (0) · 9.2 kB CSS (0) | — | — · — · — |
| Link | 48.1 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| Markdown | 159.0 kB (0) · 19.3 kB CSS (0) | — | — · — · — |
| MobileNav | 60.4 kB (0) · 9.4 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 50.9 kB (0) · 8.7 kB CSS (0) | — | — · — · — |
| MoreMenu | 82.9 kB (0) · 16.5 kB CSS (0) | — | — · — · — |
| MultiSelector | 84.9 kB (0) · 15.7 kB CSS (0) | — | — · — · — |
| NumberInput | 61.7 kB (0) · 10.2 kB CSS (0) | — | — · — · — |
| Pagination | 97.9 kB (0) · 16.7 kB CSS (0) | — | — · — · — |
| PowerSearch | 262.5 kB (0) · 22.7 kB CSS (0) | — | — · — · — |
| Selector | 87.9 kB (0) · 16.3 kB CSS (0) | — | — · — · — |
| SelectorOption | 19.3 kB (0) · 5.8 kB CSS (0) | — | — · — · — |
| SideNav | 80.3 kB (0) · 10.2 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 51.4 kB (0) · 8.8 kB CSS (0) | — | — · — · — |
| SideNavHeading | 65.4 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| SideNavItem | 60.5 kB (0) · 9.9 kB CSS (0) | — | — · — · — |
| Step | 29.6 kB (0) · 5.6 kB CSS (0) | — | — · — · — |
| Stepper | 52.2 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| Table | 97.3 kB (0) · 17.0 kB CSS (0) | — | — · — · — |
| TableCell | 89.1 kB (0) · 16.8 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 88.7 kB (0) · 16.5 kB CSS (0) | — | — · — · — |
| TabList | 40.1 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| TabMenu | 61.9 kB (0) · 9.9 kB CSS (0) | — | — · — · — |
| TextArea | 53.3 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| Thumbnail | 54.8 kB (0) · 10.3 kB CSS (0) | — | — · — · — |
| TimeInput | 142.6 kB (0) · 14.6 kB CSS (0) | — | — · — · — |
| Toast | 64.5 kB (0) · 9.1 kB CSS (0) | — | — · — · — |
| Token | 27.2 kB (0) · 4.7 kB CSS (0) | — | — · — · — |
| Tokenizer | 79.2 kB (0) · 17.2 kB CSS (0) | — | — · — · — |
| TopNav | 62.1 kB (0) · 9.7 kB CSS (0) | — | — · — · — |
| TopNavHeading | 64.8 kB (0) · 9.9 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 59.9 kB (0) · 10.6 kB CSS (0) | — | — · — · — |
| TopNavMenu | 64.7 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| TreeList | 41.2 kB (0) · 5.4 kB CSS (0) | — | — · — · — |
| Typeahead | 68.8 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 114.2 kB (new) · 1.9 kB CSS (new) | — | — · — · — |
| lab/CommentPin | 52.2 kB (new) · 1.2 kB CSS (new) | — | — · — · — |
| lab/Comments | 278.9 kB (new) · 2.5 kB CSS (new) | — | — · — · — |
| lab/CommentThread | 273.3 kB (new) · 2.4 kB CSS (new) | — | — · — · — |
| lab/DiffViewer | 76.9 kB (new) · 2.1 kB CSS (new) | — | — · — · — |
| lab/EmojiPicker | 76.3 kB (new) · 722 B CSS (new) | — | — · — · — |
| lab/ListInput | 90.0 kB (new) · 1.6 kB CSS (new) | — | — · — · — |
| lab/Schedule | 69.0 kB (new) · 3.9 kB CSS (new) | — | — · — · — |
| lab/TransferList | 84.7 kB (new) · 1.7 kB CSS (new) | — | — · — · — |
| lab/TransferListSelector | 91.8 kB (new) · 1.9 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditor | 287.5 kB (new) · 2.6 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditorToolbar | 238.8 kB (new) · 454 B CSS (new) | — | — · — · — |
| richtext/RichTextView | 267.8 kB (new) · 2.3 kB CSS (new) | — | — · — · — |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: cli +14 · ~5 · −0 (against the merge base's committed report); core +1 · ~0 · −0
Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.
20 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type SearchResultEntry |
deprecated?: ComponentDeprecation | undefined |
import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …} |
| + | cli |
./authoring · Types · interface ComponentDeprecation |
interface ComponentDeprecation |
import type {ComponentDeprecation} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotDoc |
interface ComponentIconSlotDoc |
import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotStateDoc |
interface ComponentIconSlotStateDoc |
import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface MultiComponentDoc |
deprecated?: ComponentDeprecation |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …} |
| + | cli |
./authoring · Types · interface SingleComponentDoc |
deprecated?: ComponentDeprecation |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface ComponentBaseDoc |
deprecated?: ComponentDeprecation |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface SubComponentDoc |
deprecated?: ComponentDeprecation |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …} |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template' |
| ~ | cli |
./api · Functions · function search |
function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> |
import {search} from '@astryxdesign/cli/api'; search(…) |
| ~ | cli |
./authoring · Types · interface MultiComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …} |
| ~ | cli |
./authoring · Types · interface SingleComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface ComponentBaseDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface SubComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …} |
| + | core |
. · Types · interface ComponentIconSlotMap |
timestamp-copy: { readonly copied: boolean } |
import type {ComponentIconSlotMap} from '@astryxdesign/core'; const x: ComponentIconSlotMap = {timestamp-copy: …} |
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
Specified by #10045 (the record PR for the first component icon slots); this PR merges after it.
Stack: on #9828 (component icon slots and CodeBlock's
code-block-copy). Review and merge after it.User need
A theme that maps CodeBlock's copy glyph through
componentIcons(#9828) also needs the same control for Timestamp's hover-card copy button. Otherwise the two copy affordances in one product disagree, or the theme must remapcopyandcheckeverywhere.Problem and solution fit
timestamp-copyslot, with state{copied: boolean}, is declared inComponentIconSlotMap.TimestampHoverCard's copy button resolves its glyph through the slot with the sharedComponentIconrenderer.copy, andcheckwhile copied, as before.copiedis the stateuseClipboardalready tracks for the button (the 1.5-second feedback window).Timestamp.doc.mjsgains itstheming.componentIconsentry: slot, role, fallback, state, and whatnulldoes.astryx component Timestamplists it.Name check:
timestamp-copyis<component-kebab>-<semantic-role>. The role is the row's copy action, andcopiedis the existing state, so no rename was needed.Current specification
architecture:icon-resolution-and-component-slots: slot model, INV2, INV4–INV8, change coupling.spec:AST-087: FR11–FR17.component:TimestampFR10 (and the FR8 wording), recorded by spec: record component icon slots in CodeBlock, Timestamp, and Table #10045. This PR changes no record.Public delta and caller burden
timestamp-copy(type{readonly copied: boolean}) inComponentIconSlotMap.defineTheme({componentIcons: {'timestamp-copy': ({copied}) => ({icon: copied ? 'checkDouble' : 'copy'})}}).nullhides the glyph. The button keeps its size, its "Copy {value}" name, its tooltip, and its copy action. A requestsizechanges only the glyph.Design and alternatives
Each copy button gets its own slot rather than one shared "copy" slot, as the slot model requires: a slot names one component's role. A theme that wants them alike maps both.
Evidence
Timestamp.test.tsxhas a new copy icon slot suite. It covers:copiedreaching a slot function, before and after a copy;nullhiding only the glyph while the name and copy action remain;sm.componentIconSlots.test.tschecks that the slot is declared, rendered by Timestamp, and listed in its doc.componentIcons.test.tsxchecks the slot name type.Scope
Testing
pnpm vitest run --project ui packages/core/src/Timestamp packages/core/src/Icon packages/core/src/theme/themingTargets.test.tspnpm vitest run --project node packages/cli/test/experimental-isolation.test.mjs packages/cli/test/core-doc-quality.test.mjspnpm check:knowledge;pnpm review:pre --base icons/ast087-slots-code-block; core typecheck.