@antadesign/anta 0.3.11 → 0.3.12

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.
@@ -1 +1 @@
1
- @layer anta{a-button,a[role=button][data-anta],button[data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand],.dark button[data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical],.dark button[data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info],.dark button[data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success],.dark button[data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning],.dark button[data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}button[data-anta]{box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
1
+ @layer anta{a-button,a[role=button][data-anta],button[data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand],.dark button[data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical],.dark button[data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info],.dark button[data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success],.dark button[data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning],.dark button[data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}button[data-anta]{box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;&:has(>a-copy):not(:has(>a-icon)){cursor:copy}flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip):not(a-copy))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
@@ -63,12 +63,5 @@ declare global {
63
63
  */
64
64
  export declare class AButtonElement extends HTMLElementBase {
65
65
  connectedCallback(): void;
66
- /** Perform a copy if this button is a copy control (`copy` / `copy-node` /
67
- * `copy-url`). Called from the delegated click handler on activation. The
68
- * outcome is announced via a `copydone` event the wrapper reflects. */
69
- performCopy(): boolean;
70
- /** Ask a lazy consumer to refresh the `copy` value on pointerdown (fires a
71
- * `copyrequest` event); the click then copies whatever `copy` holds. */
72
- requestCopy(): void;
73
66
  }
74
67
  export declare function register_a_button(): void;
@@ -1,5 +1,4 @@
1
1
  import { HTMLElementBase } from "../anta_helpers";
2
- import { emitCopyRequest, runCopy } from "./copy-behavior";
3
2
  import { installKeyActivation } from "./key-activation";
4
3
  import "./a-button.css";
5
4
  function installDocumentHandlers(doc) {
@@ -8,10 +7,8 @@ function installDocumentHandlers(doc) {
8
7
  keys: ["Enter", " "],
9
8
  resolve: (t) => t?.closest?.("a-button"),
10
9
  blocked: (el) => el.hasAttribute("disabled") || el.hasAttribute("loading"),
11
- preflight: (el) => el.requestCopy(),
12
10
  activate: (el) => el.click()
13
11
  });
14
- doc.addEventListener("pointerdown", handlePointerDown, true);
15
12
  doc.addEventListener("click", handleClick, true);
16
13
  doc.hasKeyListenerForAButton = true;
17
14
  }
@@ -19,17 +16,6 @@ class AButtonElement extends HTMLElementBase {
19
16
  connectedCallback() {
20
17
  installDocumentHandlers(this.doc);
21
18
  }
22
- /** Perform a copy if this button is a copy control (`copy` / `copy-node` /
23
- * `copy-url`). Called from the delegated click handler on activation. The
24
- * outcome is announced via a `copydone` event the wrapper reflects. */
25
- performCopy() {
26
- return runCopy(this);
27
- }
28
- /** Ask a lazy consumer to refresh the `copy` value on pointerdown (fires a
29
- * `copyrequest` event); the click then copies whatever `copy` holds. */
30
- requestCopy() {
31
- emitCopyRequest(this);
32
- }
33
19
  }
34
20
  function findForm(el) {
35
21
  const formId = el.getAttribute("form");
@@ -38,14 +24,6 @@ function findForm(el) {
38
24
  }
39
25
  return el.closest("form");
40
26
  }
41
- function handlePointerDown(e) {
42
- const el = e.target.closest(
43
- "a-button"
44
- );
45
- if (!el) return;
46
- if (el.hasAttribute("disabled") || el.hasAttribute("loading")) return;
47
- el.requestCopy();
48
- }
49
27
  function handleClick(e) {
50
28
  const el = e.target.closest(
51
29
  "a-button"
@@ -58,7 +36,6 @@ function handleClick(e) {
58
36
  new CustomEvent(customEvent, { bubbles: true, cancelable: true })
59
37
  );
60
38
  }
61
- el.performCopy();
62
39
  const type = el.getAttribute("type") || "button";
63
40
  const form = findForm(el);
64
41
  if (!form) return;
@@ -0,0 +1 @@
1
+ @layer anta{a-copy,a-copy:not(:defined){display:contents}}
@@ -0,0 +1,16 @@
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ import "./a-copy.css";
3
+ declare global {
4
+ interface Document {
5
+ hasCopyDelegation?: boolean;
6
+ }
7
+ }
8
+ export declare class ACopyElement extends HTMLElementBase {
9
+ #private;
10
+ connectedCallback(): void;
11
+ /** Run the copy for the activated host. Called from the delegated click /
12
+ * menuselect handlers; the ghost (if any) follows on `copydone`. */
13
+ activate(): void;
14
+ disconnectedCallback(): void;
15
+ }
16
+ export declare function register_a_copy(): void;
@@ -0,0 +1,148 @@
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ import { emitCopyRequest, runCopy } from "./copy-behavior";
3
+ import "./a-copy.css";
4
+ const BUTTON_HOST = "a-button, button, [role=button]";
5
+ const MENU_HOST = "a-menu-item, [role=menuitem]";
6
+ const ANY_HOST = `${BUTTON_HOST}, ${MENU_HOST}`;
7
+ function copyChild(host) {
8
+ return host?.querySelector(":scope > a-copy") ?? null;
9
+ }
10
+ function hostBlocked(host) {
11
+ return host.hasAttribute("disabled") || host.hasAttribute("loading") || host.getAttribute("aria-disabled") === "true";
12
+ }
13
+ function installCopyDelegation(doc) {
14
+ if (!doc || doc.hasCopyDelegation) return;
15
+ const preRequest = (target) => {
16
+ const host = target?.closest?.(ANY_HOST);
17
+ if (!host || hostBlocked(host)) return;
18
+ const el = copyChild(host);
19
+ if (el) emitCopyRequest(el);
20
+ };
21
+ doc.addEventListener("pointerdown", (e) => preRequest(e.target), true);
22
+ doc.addEventListener(
23
+ "keydown",
24
+ (e) => {
25
+ if (e.key === "Enter" || e.key === " ")
26
+ preRequest(e.target);
27
+ },
28
+ true
29
+ );
30
+ doc.addEventListener(
31
+ "click",
32
+ (e) => {
33
+ const host = e.target?.closest?.(BUTTON_HOST);
34
+ if (!host || hostBlocked(host)) return;
35
+ copyChild(host)?.activate();
36
+ },
37
+ true
38
+ );
39
+ doc.addEventListener(
40
+ "menuselect",
41
+ (e) => {
42
+ const host = e.target?.closest?.(MENU_HOST);
43
+ if (!host || hostBlocked(host)) return;
44
+ copyChild(host)?.activate();
45
+ },
46
+ true
47
+ );
48
+ doc.hasCopyDelegation = true;
49
+ }
50
+ const GHOST_MS = 650;
51
+ class ACopyElement extends HTMLElementBase {
52
+ #ghost;
53
+ #ghostTimer;
54
+ connectedCallback() {
55
+ installCopyDelegation(this.doc);
56
+ this.addEventListener("copydone", this.#onCopyDone);
57
+ }
58
+ /** Run the copy for the activated host. Called from the delegated click /
59
+ * menuselect handlers; the ghost (if any) follows on `copydone`. */
60
+ activate() {
61
+ runCopy(this);
62
+ }
63
+ #onCopyDone = (e) => {
64
+ if (!this.hasAttribute("toast")) return;
65
+ if (!e.detail?.ok) return;
66
+ const host = this.closest(ANY_HOST);
67
+ if (host) this.#showGhost(host);
68
+ };
69
+ #buildShadow() {
70
+ const root = this.attachShadow({ mode: "open" });
71
+ root.innerHTML = `<style>
72
+ .ghost {
73
+ position: fixed;
74
+ margin: 0;
75
+ padding: 0;
76
+ border: 0;
77
+ inset: auto;
78
+ background: none;
79
+ overflow: visible;
80
+ pointer-events: none;
81
+ display: grid;
82
+ place-items: center;
83
+ font: inherit;
84
+ color: inherit;
85
+ white-space: nowrap;
86
+ }
87
+ .ghost:not(:popover-open) { display: none; }
88
+ .ghost[data-show] { animation: a-copy-rise ${GHOST_MS - 50}ms ease-out forwards; }
89
+ @keyframes a-copy-rise {
90
+ from { opacity: 1; transform: translateY(0); }
91
+ to { opacity: 0; transform: translateY(-1.5em); }
92
+ }
93
+ </style><div class="ghost" part="ghost" popover="manual"></div>`;
94
+ this.#ghost = root.querySelector(".ghost");
95
+ }
96
+ #showGhost(host) {
97
+ if (!this.#ghost) this.#buildShadow();
98
+ const ghost = this.#ghost;
99
+ if (!ghost || typeof ghost.showPopover !== "function") return;
100
+ const text = (host.textContent ?? "").trim();
101
+ if (!text) return;
102
+ const r = host.getBoundingClientRect();
103
+ ghost.textContent = text;
104
+ ghost.style.left = `${r.left}px`;
105
+ ghost.style.top = `${r.top}px`;
106
+ ghost.style.width = `${r.width}px`;
107
+ ghost.style.height = `${r.height}px`;
108
+ clearTimeout(this.#ghostTimer);
109
+ ghost.removeAttribute("data-show");
110
+ if (ghost.matches(":popover-open")) {
111
+ try {
112
+ ghost.hidePopover();
113
+ } catch {
114
+ }
115
+ }
116
+ try {
117
+ ghost.showPopover();
118
+ } catch {
119
+ return;
120
+ }
121
+ void ghost.offsetWidth;
122
+ ghost.setAttribute("data-show", "");
123
+ this.#ghostTimer = setTimeout(() => {
124
+ ghost.removeAttribute("data-show");
125
+ if (ghost.matches(":popover-open")) {
126
+ try {
127
+ ghost.hidePopover();
128
+ } catch {
129
+ }
130
+ }
131
+ }, GHOST_MS);
132
+ }
133
+ disconnectedCallback() {
134
+ clearTimeout(this.#ghostTimer);
135
+ this.removeEventListener("copydone", this.#onCopyDone);
136
+ }
137
+ }
138
+ function register_a_copy() {
139
+ if (typeof customElements === "undefined") return;
140
+ if (!customElements.get("a-copy")) {
141
+ customElements.define("a-copy", ACopyElement);
142
+ }
143
+ }
144
+ register_a_copy();
145
+ export {
146
+ ACopyElement,
147
+ register_a_copy
148
+ };
@@ -1 +1 @@
1
- @layer anta{a-expander{--expander-text: var(--text-2);--expander-text-hover: var(--text-1);--expander-bg-secondary: var(--bg-2);--expander-border-secondary: var(--border-5);--expander-bg-primary: var(--bg-4);--expander-border-primary: var(--border-4);--expander-bg: var(--expander-bg-secondary);--expander-border: var(--expander-border-secondary);--expander-bg-hover-lift: .01;--expander-bg-hover: oklch(from var(--expander-bg) calc(l + var(--expander-bg-hover-lift)) c h);--expander-gutter: 24px;--_expander-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 18 6-6-6-6'/%3e%3c/svg%3e");display:block;width:100%;box-sizing:border-box;border:1px solid var(--expander-border);border-radius:4px;color:var(--expander-text);background:var(--expander-bg);transition:background-color .1s ease}a-expander[round]{--expander-round: attr(round type(<length>));border-radius:var(--expander-round, var(--_expander-round-radius, 999px))}a-expander:not(:defined) a-expander-details{display:none}a-expander:not(:defined)[state=open] a-expander-details,a-expander:not(:defined)[default-state=open] a-expander-details{display:block}a-expander:not(:defined) a-expander-summary{position:relative;padding:6px 4px 6px var(--expander-gutter)}a-expander:not(:defined) a-expander-summary:before{content:"";position:absolute;left:calc(var(--expander-gutter) - 16px - 2px);top:50%;width:16px;height:16px;transform:translateY(-50%);background-color:currentColor;-webkit-mask:var(--_expander-chevron) center / contain no-repeat;mask:var(--_expander-chevron) center / contain no-repeat;opacity:.6}a-expander-summary{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration-line:var(--_summary-underline, none);text-decoration-style:dotted;text-decoration-color:color-mix(in oklch,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;transition:color .15s ease}a-expander-details{display:block;padding:2px 4px 6px var(--expander-gutter);line-height:20px}a-expander[priority=primary]{--expander-bg: var(--expander-bg-primary);--expander-border: var(--expander-border-primary)}a-expander[priority=tertiary]{--expander-bg: transparent;--expander-border: transparent}a-expander:not([disabled]):not(:state(open)):hover{background:var(--expander-bg-hover)}a-expander:not([disabled]):not(:state(open)):active{background:var(--expander-bg)}a-expander[priority=tertiary][outdent]{--expander-gutter: 0px}a-expander[tone=brand]{--expander-text: var(--text-2-brand);--expander-text-hover: var(--text-1-brand);--expander-bg-secondary: var(--bg-2-brand);--expander-border-secondary: var(--border-5-brand);--expander-bg-primary: var(--bg-4-brand);--expander-border-primary: var(--border-4-brand)}a-expander[tone=info]{--expander-text: var(--text-2-info);--expander-text-hover: var(--text-1-info);--expander-bg-secondary: var(--bg-2-info);--expander-border-secondary: var(--border-5-info);--expander-bg-primary: var(--bg-4-info);--expander-border-primary: var(--border-4-info)}a-expander[tone=success]{--expander-text: var(--text-2-success);--expander-text-hover: var(--text-1-success);--expander-bg-secondary: var(--bg-2-success);--expander-border-secondary: var(--border-5-success);--expander-bg-primary: var(--bg-4-success);--expander-border-primary: var(--border-4-success)}a-expander[tone=warning]{--expander-text: var(--text-2-warning);--expander-text-hover: var(--text-1-warning);--expander-bg-secondary: var(--bg-2-warning);--expander-border-secondary: var(--border-5-warning);--expander-bg-primary: var(--bg-4-warning);--expander-border-primary: var(--border-4-warning)}a-expander[tone=critical]{--expander-text: var(--text-2-critical);--expander-text-hover: var(--text-1-critical);--expander-bg-secondary: var(--bg-2-critical);--expander-border-secondary: var(--border-5-critical);--expander-bg-primary: var(--bg-4-critical);--expander-border-primary: var(--border-4-critical)}a-expander[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--expander-tone-source: attr(tone type(<color>), currentColor);--expander-text: oklch(from var(--expander-tone-source) .41 .15 h);--expander-text-hover: oklch(from var(--expander-tone-source) .33 .15 h);--expander-bg-secondary: oklch(from var(--expander-tone-source) .99 .006 h);--expander-border-secondary: oklch(from var(--expander-tone-source) .93 .03 h);--expander-bg-primary: oklch(from var(--expander-tone-source) .955 .02 h);--expander-border-primary: oklch(from var(--expander-tone-source) .895 .045 h)}.dark a-expander[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--expander-text: oklch(from var(--expander-tone-source) .75 .11 h);--expander-text-hover: oklch(from var(--expander-tone-source) .82 .1 h);--expander-bg-secondary: oklch(from var(--expander-tone-source) .13 .02 h);--expander-border-secondary: oklch(from var(--expander-tone-source) .22 .05 h);--expander-bg-primary: oklch(from var(--expander-tone-source) .19 .04 h);--expander-border-primary: oklch(from var(--expander-tone-source) .26 .07 h)}a-expander[disabled],a-expander[disabled][tone]{--expander-text: #afa9b1}.dark a-expander[disabled],.dark a-expander[disabled][tone]{--expander-text: #635b65}}
1
+ @layer anta{a-expander{--expander-text: var(--text-2);--expander-text-hover: var(--text-1);--expander-bg-secondary: var(--bg-2);--expander-border-secondary: var(--border-5);--expander-bg-primary: var(--bg-4);--expander-border-primary: var(--border-4);--expander-bg: var(--expander-bg-secondary);--expander-border: var(--expander-border-secondary);--expander-bg-hover-lift: .01;--expander-bg-hover: oklch(from var(--expander-bg) calc(l + var(--expander-bg-hover-lift)) c h);--expander-gutter: 24px;--_expander-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 18 6-6-6-6'/%3e%3c/svg%3e");display:block;width:100%;box-sizing:border-box;border:1px solid var(--expander-border);border-radius:4px;color:var(--expander-text);background:var(--expander-bg);transition:background-color .1s ease}a-expander[round]{--expander-round: attr(round type(<length>));border-radius:var(--expander-round, var(--_expander-round-radius, 999px))}a-expander>[slot=actions]{display:contents}a-expander:not(:defined) a-expander-details{display:none}a-expander:not(:defined)[state=open] a-expander-details,a-expander:not(:defined)[default-state=open] a-expander-details{display:block}a-expander:not(:defined) a-expander-summary{position:relative;padding:6px 4px 6px var(--expander-gutter)}a-expander:not(:defined) a-expander-summary:before{content:"";position:absolute;left:calc(var(--expander-gutter) - 16px - 2px);top:50%;width:16px;height:16px;transform:translateY(-50%);background-color:currentColor;-webkit-mask:var(--_expander-chevron) center / contain no-repeat;mask:var(--_expander-chevron) center / contain no-repeat;opacity:.6}a-expander:not(:defined){display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}a-expander:not(:defined) a-expander-summary{grid-column:1}a-expander:not(:defined)>[slot=actions]{grid-column:2;display:flex;align-items:center;gap:2px;flex-shrink:0;margin-inline-start:8px;margin-inline-end:4px}a-expander:not(:defined) a-expander-details{grid-column:1 / -1}a-expander-summary{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;line-height:20px;font-weight:584.62;letter-spacing:0;text-decoration-line:var(--_summary-underline, none);text-decoration-style:dotted;text-decoration-color:color-mix(in oklch,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;transition:color .15s ease}a-expander[level="1"] a-expander-summary{font-size:28px;line-height:32px}a-expander[level="2"] a-expander-summary{font-size:24px;line-height:28px}a-expander[level="3"] a-expander-summary{font-size:20px;line-height:24px}a-expander[level="4"] a-expander-summary{font-size:17px;line-height:20px}a-expander[level="6"] a-expander-summary{font-size:13px;line-height:16px}a-expander-details{display:block;padding:2px 4px 6px var(--expander-gutter);line-height:20px}a-expander[priority=tertiary][outdent] a-expander-details{padding-inline-start:4px;margin-inline-start:-4px}a-expander[priority=primary]{--expander-bg: var(--expander-bg-primary);--expander-border: var(--expander-border-primary)}a-expander[priority=tertiary]{--expander-bg: transparent;--expander-border: transparent}a-expander:not([disabled]):not(:state(open)):hover{background:var(--expander-bg-hover)}a-expander:not([disabled]):not(:state(open)):active{background:var(--expander-bg)}a-expander[priority=tertiary][outdent]{--expander-gutter: 0px}a-expander[tone=brand]{--expander-text: var(--text-2-brand);--expander-text-hover: var(--text-1-brand);--expander-bg-secondary: var(--bg-2-brand);--expander-border-secondary: var(--border-5-brand);--expander-bg-primary: var(--bg-4-brand);--expander-border-primary: var(--border-4-brand)}a-expander[tone=info]{--expander-text: var(--text-2-info);--expander-text-hover: var(--text-1-info);--expander-bg-secondary: var(--bg-2-info);--expander-border-secondary: var(--border-5-info);--expander-bg-primary: var(--bg-4-info);--expander-border-primary: var(--border-4-info)}a-expander[tone=success]{--expander-text: var(--text-2-success);--expander-text-hover: var(--text-1-success);--expander-bg-secondary: var(--bg-2-success);--expander-border-secondary: var(--border-5-success);--expander-bg-primary: var(--bg-4-success);--expander-border-primary: var(--border-4-success)}a-expander[tone=warning]{--expander-text: var(--text-2-warning);--expander-text-hover: var(--text-1-warning);--expander-bg-secondary: var(--bg-2-warning);--expander-border-secondary: var(--border-5-warning);--expander-bg-primary: var(--bg-4-warning);--expander-border-primary: var(--border-4-warning)}a-expander[tone=critical]{--expander-text: var(--text-2-critical);--expander-text-hover: var(--text-1-critical);--expander-bg-secondary: var(--bg-2-critical);--expander-border-secondary: var(--border-5-critical);--expander-bg-primary: var(--bg-4-critical);--expander-border-primary: var(--border-4-critical)}a-expander[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--expander-tone-source: attr(tone type(<color>), currentColor);--expander-text: oklch(from var(--expander-tone-source) .41 .15 h);--expander-text-hover: oklch(from var(--expander-tone-source) .33 .15 h);--expander-bg-secondary: oklch(from var(--expander-tone-source) .99 .006 h);--expander-border-secondary: oklch(from var(--expander-tone-source) .93 .03 h);--expander-bg-primary: oklch(from var(--expander-tone-source) .955 .02 h);--expander-border-primary: oklch(from var(--expander-tone-source) .895 .045 h)}.dark a-expander[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--expander-text: oklch(from var(--expander-tone-source) .75 .11 h);--expander-text-hover: oklch(from var(--expander-tone-source) .82 .1 h);--expander-bg-secondary: oklch(from var(--expander-tone-source) .13 .02 h);--expander-border-secondary: oklch(from var(--expander-tone-source) .22 .05 h);--expander-bg-primary: oklch(from var(--expander-tone-source) .19 .04 h);--expander-border-primary: oklch(from var(--expander-tone-source) .26 .07 h)}a-expander[disabled],a-expander[disabled][tone]{--expander-text: #afa9b1}.dark a-expander[disabled],.dark a-expander[disabled][tone]{--expander-text: #635b65}}
@@ -7,18 +7,6 @@ function ignoresToggle(el) {
7
7
  if (el.matches("[data-expander-ignore]")) return true;
8
8
  return el.matches(INTERACTIVE_SELECTOR) && !el.matches(DISABLED_SELECTOR);
9
9
  }
10
- const SUMMARY_TYPE_SCALE = {
11
- "1": [28, 32],
12
- "2": [24, 28],
13
- "3": [20, 24],
14
- "4": [17, 20],
15
- "5": [15, 20],
16
- "6": [13, 16]
17
- };
18
- const SUMMARY_FONT_WEIGHT = 584.62;
19
- const SUMMARY_LEVEL_RULES = Object.entries(SUMMARY_TYPE_SCALE).map(
20
- ([level, [size, line]]) => `:host([level="${level}"]) button { font-size: ${size}px; line-height: ${line}px; }`
21
- ).join("\n ");
22
10
  const SHADOW_STYLE = `
23
11
  :host { display: block; }
24
12
 
@@ -67,10 +55,6 @@ const SHADOW_STYLE = `
67
55
  user-select: none;
68
56
  border-radius: 2px;
69
57
  outline: none;
70
- font-size: ${SUMMARY_TYPE_SCALE["5"][0]}px;
71
- line-height: ${SUMMARY_TYPE_SCALE["5"][1]}px;
72
- font-weight: ${SUMMARY_FONT_WEIGHT};
73
- letter-spacing: 0;
74
58
  }
75
59
 
76
60
  button:focus-visible {
@@ -78,8 +62,6 @@ const SHADOW_STYLE = `
78
62
  outline-offset: 0px;
79
63
  }
80
64
 
81
- ${SUMMARY_LEVEL_RULES}
82
-
83
65
  /* The chevron sits absolutely INSIDE the gutter \u2014 out of flow, so it never
84
66
  pushes the title. Its right edge lands 2px before the gutter (left = gutter
85
67
  - 16px - 2px), leaving a 2px gap before the title; at the default 24px
@@ -69,11 +69,11 @@ export declare function isMenuItemEl(el: EventTarget | null | undefined): el is
69
69
  * from link items (no `<a-menu-item>` ever upgrades) still gets keyboard
70
70
  * activation. Idempotent per document.
71
71
  *
72
- * Shares `installKeyActivation` with `<a-button>`: activation is on keyup, with
73
- * a keydown pre-request (`emitCopyRequest`) so a lazy copy row can refresh its
74
- * `copy` during the hold. `.click()` on a link item navigates natively (honoring
75
- * download / target); on the custom element it routes through the menu's click
76
- * delegation — one path for both. (The combobox-filter Enter is a separate path
77
- * handled by `a-menu`, which uses the same keyup pre-request.) */
72
+ * Shares `installKeyActivation` with `<a-button>`: activation is on keyup.
73
+ * `.click()` on a link item navigates natively (honoring download / target);
74
+ * on the custom element it routes through the menu's click delegation — one
75
+ * path for both. (The combobox-filter Enter is a separate path handled by
76
+ * `a-menu`.) A slotted `<a-copy>` adds its own keydown pre-request when a row
77
+ * is a copy control — the menu item itself no longer carries copy behavior. */
78
78
  export declare function ensureMenuItemKeyListener(doc: Document): void;
79
79
  export declare function register_a_menu_item(): void;
@@ -1,5 +1,4 @@
1
1
  import { HTMLElementBase } from "../anta_helpers";
2
- import { emitCopyRequest, runCopy } from "./copy-behavior";
3
2
  import { installKeyActivation } from "./key-activation";
4
3
  import "./a-menu-item.css";
5
4
  class AMenuItemElement extends HTMLElementBase {
@@ -7,8 +6,6 @@ class AMenuItemElement extends HTMLElementBase {
7
6
  constructor() {
8
7
  super();
9
8
  this.internals = this.attachInternals?.();
10
- this.addEventListener("menuselect", () => runCopy(this));
11
- this.addEventListener("pointerdown", () => emitCopyRequest(this));
12
9
  }
13
10
  /** The active (combobox) cursor. `a-menu` sets this **property** (never an
14
11
  * attribute — no DOM mutation, same rule as `a-radio.selected`) as ArrowUp/Down
@@ -36,7 +33,6 @@ function ensureMenuItemKeyListener(doc) {
36
33
  keys: ["Enter", " "],
37
34
  resolve: (t) => t?.closest?.(MENU_ITEM_SELECTOR),
38
35
  blocked: (el) => el.hasAttribute("disabled"),
39
- preflight: (el) => emitCopyRequest(el),
40
36
  activate: (el) => el.click()
41
37
  });
42
38
  doc.hasKeyListenerForAMenuItem = true;
@@ -80,8 +80,6 @@ function pathCrossesTopLayerBeforeAnchor(e, anchor) {
80
80
  function nodeHitsMenus(node) {
81
81
  for (const m of openStack) {
82
82
  if (m.contains(node) || m.surface.contains(node)) return true;
83
- const anchor = m.triggerAnchor;
84
- if (anchor && anchor.contains(node)) return true;
85
83
  }
86
84
  return false;
87
85
  }
@@ -551,7 +549,8 @@ class AMenuElement extends HTMLElementBase {
551
549
  case "Enter":
552
550
  if (this.activeItem) {
553
551
  e.preventDefault();
554
- emitCopyRequest(this.activeItem);
552
+ const copyEl = this.activeItem.querySelector(":scope > a-copy");
553
+ if (copyEl) emitCopyRequest(copyEl);
555
554
  this.#pendingComboActivate = this.activeItem;
556
555
  }
557
556
  return true;
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Shared copy-to-clipboard behavior for `<a-button>` and `<a-menu-item>` — the
3
- * write half of the productized "copy button" / "copying menu item". The element
4
- * performs the clipboard write itself (rather than a UI-thread callback) and
5
- * reports the outcome with a `copydone` event; the JSX wrapper listens and
6
- * orchestrates the visual feedback (icon + tone swap). Nothing here touches the
2
+ * Copy-to-clipboard behavior for the `<a-copy>` element — the write half of the
3
+ * productized "copy button" / "copying menu item". `<a-copy>` (slotted inside a
4
+ * button or menu row) calls these on the host's activation: it performs the
5
+ * clipboard write itself (rather than a UI-thread callback) and reports the
6
+ * outcome with a `copydone` event; the JSX wrapper (`ButtonCopy` / `MenuItemCopy`)
7
+ * listens and orchestrates the visual feedback (icon + tone swap). Nothing here touches the
7
8
  * DOM — no light-DOM mutation, no host attributes, no ElementInternals.
8
9
  *
9
10
  * Events are dispatched non-bubbling (`bubbles: false`): the wrapper binds on the
@@ -17,6 +17,7 @@ export { AProgressElement, register_a_progress } from './a-progress';
17
17
  export { ATextElement, register_a_text } from './a-text';
18
18
  export { AIconElement, register_a_icon } from './a-icon';
19
19
  export { AButtonElement, register_a_button } from './a-button';
20
+ export { ACopyElement, register_a_copy } from './a-copy';
20
21
  export { ACheckboxElement, register_a_checkbox } from './a-checkbox';
21
22
  export { AExpanderElement, register_a_expander } from './a-expander';
22
23
  export { ATooltipElement, register_a_tooltip } from './a-tooltip';
@@ -2,6 +2,7 @@ import { AProgressElement, register_a_progress } from "./a-progress";
2
2
  import { ATextElement, register_a_text } from "./a-text";
3
3
  import { AIconElement, register_a_icon } from "./a-icon";
4
4
  import { AButtonElement, register_a_button } from "./a-button";
5
+ import { ACopyElement, register_a_copy } from "./a-copy";
5
6
  import { ACheckboxElement, register_a_checkbox } from "./a-checkbox";
6
7
  import { AExpanderElement, register_a_expander } from "./a-expander";
7
8
  import { ATooltipElement, register_a_tooltip } from "./a-tooltip";
@@ -26,6 +27,7 @@ export {
26
27
  ACalendarElement,
27
28
  ACardElement,
28
29
  ACheckboxElement,
30
+ ACopyElement,
29
31
  ADialogElement,
30
32
  AExpanderElement,
31
33
  AIconElement,
@@ -47,6 +49,7 @@ export {
47
49
  register_a_calendar,
48
50
  register_a_card,
49
51
  register_a_checkbox,
52
+ register_a_copy,
50
53
  register_a_dialog,
51
54
  register_a_expander,
52
55
  register_a_icon,
@@ -4,15 +4,13 @@
4
4
  *
5
5
  * Activation fires on **keyup**, not keydown. This matches the native `<button>`
6
6
  * (Space already activates on release), makes activation **cancelable** (move
7
- * focus between press and release → no fire), and — the reason it's uniform
8
- * across Enter and Space here — opens a **keydown→keyup gap** so a lazy copy
9
- * control can refresh its `copy` value between press and release before the write
10
- * (the keyboard analog of the pointerdown→click gap; see copy-behavior's "Lazy
11
- * content" note).
7
+ * focus between press and release → no fire), and opens a **keydown→keyup gap**.
8
+ * A slotted `<a-copy>` uses that gap for its own lazy pre-request (it runs its
9
+ * own keydown listener); this module just synthesizes the click on release.
12
10
  *
13
11
  * keydown: `preventDefault()` (stop Space scrolling the page and a link's own
14
- * native Enter→click), run `preflight(el)` — the copy pre-request — and arm the
15
- * release. keyup: `activate(el)` only if the same element is still armed.
12
+ * native Enter→click) and arm the release. keyup: `activate(el)` only if the
13
+ * same element is still armed.
16
14
  *
17
15
  * Idempotency is the caller's job (each guards with its own per-document flag);
18
16
  * this just wires one keydown/keyup pair.
@@ -24,8 +22,6 @@ export interface KeyActivation {
24
22
  resolve(target: EventTarget | null): HTMLElement | null;
25
23
  /** Blocked (disabled / loading) — swallow the key without activating. */
26
24
  blocked?(el: HTMLElement): boolean;
27
- /** Runs on keydown, before the release: the lazy copy pre-request. */
28
- preflight?(el: HTMLElement): void;
29
25
  /** Runs on keyup: the actual activation (a synthesized `click()`). */
30
26
  activate(el: HTMLElement): void;
31
27
  }
@@ -8,7 +8,6 @@ function installKeyActivation(doc, config) {
8
8
  if (!el) return;
9
9
  e.preventDefault();
10
10
  armed = config.blocked?.(el) ? null : el;
11
- if (armed) config.preflight?.(armed);
12
11
  },
13
12
  true
14
13
  );
@@ -727,28 +727,6 @@ export interface AMenuItemAttributes extends BaseAttributes {
727
727
  * a `MouseEvent`, carrying the modifier keys (e.g. `altKey`). All-lowercase so
728
728
  * React/Preact bind it to the CustomEvent. */
729
729
  onmenuselect?: (e: MouseEvent) => void;
730
- /** Text copied to the clipboard when the row is chosen (a "copying menu item").
731
- * The element performs the write itself on `menuselect`. */
732
- copy?: string;
733
- /** Copy a DOM node instead of a string (rich `text/html` + plain text). Bare
734
- * `copy-node` copies the nearest ancestor marked `[data-copy-source]`; a value
735
- * is a CSS selector resolved with `closest()`. Presence-based for the boolean
736
- * form. */
737
- 'copy-node'?: boolean | string;
738
- /** Copy the current page URL (`location.href`) instead of a `copy` string.
739
- * Presence-based. */
740
- 'copy-url'?: boolean | '';
741
- /** Prefix the copied `copy` string with `// URL: <href>`. Presence-based. */
742
- 'copy-with-url'?: boolean | '';
743
- /** Fired after a copy attempt (bubbling `copydone`, `detail: { ok }`).
744
- * All-lowercase so it binds in React *and* Preact. */
745
- oncopydone?: (e: CustomEvent<{
746
- ok: boolean;
747
- }>) => void;
748
- /** Fired on **pointerdown** for a string-copy row (`copyrequest`, non-bubbling).
749
- * Answer by setting the `copy` attribute to the freshly-computed value; the
750
- * chosen row copies it. All-lowercase. */
751
- oncopyrequest?: (e: CustomEvent) => void;
752
730
  }
753
731
  /**
754
732
  * Attributes for the `<a-menu-group>` styled element. For the typed JSX
@@ -792,32 +770,42 @@ export interface AButtonAttributes extends BaseAttributes {
792
770
  form?: string;
793
771
  /** Custom event name dispatched (bubbling) on click. */
794
772
  'data-custom-event'?: string;
795
- /** Text copied to the clipboard on activation (the "copy button"). The element
796
- * performs the write itself and flashes a success / failure state. */
773
+ 'aria-disabled'?: 'true' | 'false' | boolean;
774
+ 'aria-busy'?: 'true' | 'false' | boolean;
775
+ }
776
+ /** `<a-copy>` — the copy-to-clipboard behavior, slotted inside an activatable
777
+ * control (`<a-button>`, `<a-menu-item>`, native `button`/`[role]`). It owns
778
+ * the whole feature; the base controls carry no copy knowledge. `ButtonCopy` /
779
+ * `MenuItemCopy` are the presets that drop it in. */
780
+ export interface ACopyAttributes extends BaseAttributes {
781
+ /** Text copied to the clipboard when the host control is activated. */
797
782
  copy?: string;
798
783
  /** Copy a DOM node instead of a string (rich `text/html` + plain text). Bare
799
784
  * `copy-node` copies the nearest ancestor marked `[data-copy-source]`; a value
800
- * is a CSS selector resolved with `closest()` (an ancestor region). Presence-
801
- * based for the boolean form. */
785
+ * is a CSS selector resolved with `closest()` (an ancestor region). The copy
786
+ * control is stripped from the serialized output. Presence-based for the
787
+ * boolean form. */
802
788
  'copy-node'?: boolean | string;
803
789
  /** Copy the current page URL (`location.href`) instead of a `copy` string; no
804
790
  * `copy` needed. Presence-based. */
805
791
  'copy-url'?: boolean | '';
806
792
  /** Prefix the copied `copy` string with `// URL: <href>`. Presence-based. */
807
793
  'copy-with-url'?: boolean | '';
794
+ /** Float a ghost of the host's content upward as visual feedback on a
795
+ * successful copy (rendered in the top layer so the host's overflow can't clip
796
+ * it). Presence-based. Opt-in — `ButtonCopy` sets it. */
797
+ toast?: boolean | '';
808
798
  /** Fired after a copy attempt (`copydone`, `detail: { ok }`, non-bubbling so a
809
- * nested copy row can't flip an ancestor's feedback). All-lowercase so it
799
+ * nested copy control can't flip an ancestor's feedback). All-lowercase so it
810
800
  * binds in React *and* Preact. */
811
801
  oncopydone?: (e: CustomEvent<{
812
802
  ok: boolean;
813
803
  }>) => void;
814
- /** Fired on **pointerdown** for a string-copy button (`copyrequest`,
804
+ /** Fired on **pointerdown** / keydown for a string-copy control (`copyrequest`,
815
805
  * non-bubbling). Answer by setting the `copy` attribute to the freshly-computed
816
- * value; the click then copies it. The pointerdown→click gap lets an
817
- * off-UI-thread handler set `copy` in time. All-lowercase. */
806
+ * value; the activation then copies it. The gap lets an off-UI-thread handler
807
+ * set `copy` in time. All-lowercase. */
818
808
  oncopyrequest?: (e: CustomEvent) => void;
819
- 'aria-disabled'?: 'true' | 'false' | boolean;
820
- 'aria-busy'?: 'true' | 'false' | boolean;
821
809
  }
822
810
  /**
823
811
  * Attributes for the `<a-radio>` custom element — one option in a radio set.
package/dist/index.d.ts CHANGED
@@ -27,9 +27,10 @@ export type { TagProps } from './components/Tag';
27
27
  export { Icon } from './components/Icon';
28
28
  export type { IconProps } from './components/Icon';
29
29
  export { Button } from './components/Button';
30
- export type { ButtonProps, BaseButtonProps, ContentMode, SubmitMode, PriorityMode, CopyMode, } from './components/Button';
30
+ export type { ButtonProps, BaseButtonProps, ContentMode, SubmitMode, PriorityMode, } from './components/Button';
31
31
  export { ButtonCopy } from './components/ButtonCopy';
32
32
  export type { ButtonCopyProps } from './components/ButtonCopy';
33
+ export type { CopyTarget } from './components/copy-props';
33
34
  export { ICON_SHAPES, ICON_SYNONYMS } from './elements/a-icon.shapes';
34
35
  export { Tooltip } from './components/Tooltip';
35
36
  export type { TooltipProps } from './components/Tooltip';