@agent-ui-kit/components 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-styles.css +8 -0
- package/dist/component-styles.css +147 -0
- package/dist/controls/_base/index.d.ts +3 -0
- package/dist/controls/_base/index.js +9 -0
- package/dist/controls/_base/indicator-element.d.ts +132 -0
- package/dist/controls/_base/indicator-element.js +158 -0
- package/dist/controls/_base/listbox-element.d.ts +70 -0
- package/dist/controls/_base/listbox-element.js +74 -0
- package/dist/controls/_base/range-element.d.ts +120 -0
- package/dist/controls/_base/range-element.js +158 -0
- package/dist/controls/_surface/container-box.css +301 -0
- package/dist/controls/_surface/container.css +156 -0
- package/dist/controls/_token-surface/token-surface.d.ts +35 -0
- package/dist/controls/_token-surface/token-surface.js +97 -0
- package/dist/controls/attachment/attachment-meta.d.ts +8 -0
- package/dist/controls/attachment/attachment-meta.js +84 -0
- package/dist/controls/attachment/attachment.css +91 -0
- package/dist/controls/attachment/attachment.d.ts +40 -0
- package/dist/controls/attachment/attachment.js +70 -0
- package/dist/controls/avatar/avatar-initials.d.ts +4 -0
- package/dist/controls/avatar/avatar-initials.js +30 -0
- package/dist/controls/avatar/avatar.css +87 -0
- package/dist/controls/avatar/avatar.d.ts +40 -0
- package/dist/controls/avatar/avatar.js +77 -0
- package/dist/controls/badge/badge.css +175 -0
- package/dist/controls/badge/badge.d.ts +36 -0
- package/dist/controls/badge/badge.js +71 -0
- package/dist/controls/bar-chart/bar-chart.css +110 -0
- package/dist/controls/bar-chart/bar-chart.d.ts +26 -0
- package/dist/controls/bar-chart/bar-chart.js +80 -0
- package/dist/controls/bar-chart/bar-math.d.ts +31 -0
- package/dist/controls/bar-chart/bar-math.js +106 -0
- package/dist/controls/button/button.css +263 -0
- package/dist/controls/button/button.d.ts +61 -0
- package/dist/controls/button/button.js +115 -0
- package/dist/controls/calendar/calendar.css +495 -0
- package/dist/controls/calendar/calendar.d.ts +161 -0
- package/dist/controls/calendar/calendar.js +1004 -0
- package/dist/controls/card/card-content.d.ts +24 -0
- package/dist/controls/card/card-content.js +133 -0
- package/dist/controls/card/card-footer.d.ts +3 -0
- package/dist/controls/card/card-footer.js +16 -0
- package/dist/controls/card/card-header.d.ts +3 -0
- package/dist/controls/card/card-header.js +18 -0
- package/dist/controls/card/card.css +445 -0
- package/dist/controls/card/card.d.ts +51 -0
- package/dist/controls/card/card.js +61 -0
- package/dist/controls/checkbox/checkbox.css +204 -0
- package/dist/controls/checkbox/checkbox.d.ts +114 -0
- package/dist/controls/checkbox/checkbox.js +130 -0
- package/dist/controls/code/code.css +72 -0
- package/dist/controls/code/code.d.ts +23 -0
- package/dist/controls/code/code.js +40 -0
- package/dist/controls/color-picker/color-picker.css +209 -0
- package/dist/controls/color-picker/color-picker.d.ts +84 -0
- package/dist/controls/color-picker/color-picker.js +545 -0
- package/dist/controls/color-picker/color.d.ts +40 -0
- package/dist/controls/color-picker/color.js +159 -0
- package/dist/controls/column/column.css +151 -0
- package/dist/controls/column/column.d.ts +107 -0
- package/dist/controls/column/column.js +57 -0
- package/dist/controls/combo-box/combo-box.css +397 -0
- package/dist/controls/combo-box/combo-box.d.ts +133 -0
- package/dist/controls/combo-box/combo-box.js +680 -0
- package/dist/controls/command-modal/command-modal.css +226 -0
- package/dist/controls/command-modal/command-modal.d.ts +42 -0
- package/dist/controls/command-modal/command-modal.js +315 -0
- package/dist/controls/disclosure/disclosure.css +162 -0
- package/dist/controls/disclosure/disclosure.d.ts +37 -0
- package/dist/controls/disclosure/disclosure.js +207 -0
- package/dist/controls/field/field.css +140 -0
- package/dist/controls/field/field.d.ts +27 -0
- package/dist/controls/field/field.js +228 -0
- package/dist/controls/form-provider/form-provider.css +40 -0
- package/dist/controls/form-provider/form-provider.d.ts +42 -0
- package/dist/controls/form-provider/form-provider.js +105 -0
- package/dist/controls/grid/grid.css +72 -0
- package/dist/controls/grid/grid.d.ts +60 -0
- package/dist/controls/grid/grid.js +56 -0
- package/dist/controls/icon/icon.css +37 -0
- package/dist/controls/icon/icon.d.ts +25 -0
- package/dist/controls/icon/icon.js +55 -0
- package/dist/controls/index.d.ts +57 -0
- package/dist/controls/index.js +136 -0
- package/dist/controls/ladder/ladder.css +89 -0
- package/dist/controls/ladder/ladder.d.ts +27 -0
- package/dist/controls/ladder/ladder.js +78 -0
- package/dist/controls/list/list.css +118 -0
- package/dist/controls/list/list.d.ts +84 -0
- package/dist/controls/list/list.js +48 -0
- package/dist/controls/menu/menu.css +195 -0
- package/dist/controls/menu/menu.d.ts +44 -0
- package/dist/controls/menu/menu.js +248 -0
- package/dist/controls/modal/modal.css +99 -0
- package/dist/controls/modal/modal.d.ts +61 -0
- package/dist/controls/modal/modal.js +155 -0
- package/dist/controls/popover/popover.css +83 -0
- package/dist/controls/popover/popover.d.ts +44 -0
- package/dist/controls/popover/popover.js +164 -0
- package/dist/controls/progress/progress.css +106 -0
- package/dist/controls/progress/progress.d.ts +28 -0
- package/dist/controls/progress/progress.js +80 -0
- package/dist/controls/radio/radio-group.css +84 -0
- package/dist/controls/radio/radio-group.d.ts +152 -0
- package/dist/controls/radio/radio-group.js +350 -0
- package/dist/controls/radio/radio.css +219 -0
- package/dist/controls/radio/radio.d.ts +19 -0
- package/dist/controls/radio/radio.js +75 -0
- package/dist/controls/ramp/ramp.css +75 -0
- package/dist/controls/ramp/ramp.d.ts +29 -0
- package/dist/controls/ramp/ramp.js +72 -0
- package/dist/controls/row/row.css +152 -0
- package/dist/controls/row/row.d.ts +95 -0
- package/dist/controls/row/row.js +45 -0
- package/dist/controls/segment/segment.css +66 -0
- package/dist/controls/segment/segment.d.ts +3 -0
- package/dist/controls/segment/segment.js +26 -0
- package/dist/controls/segmented-control/segmented-control.css +189 -0
- package/dist/controls/segmented-control/segmented-control.d.ts +20 -0
- package/dist/controls/segmented-control/segmented-control.js +64 -0
- package/dist/controls/select/select.css +467 -0
- package/dist/controls/select/select.d.ts +147 -0
- package/dist/controls/select/select.js +538 -0
- package/dist/controls/slider/slider.css +231 -0
- package/dist/controls/slider/slider.d.ts +111 -0
- package/dist/controls/slider/slider.js +60 -0
- package/dist/controls/slider-multi/slider-multi.css +197 -0
- package/dist/controls/slider-multi/slider-multi.d.ts +149 -0
- package/dist/controls/slider-multi/slider-multi.js +380 -0
- package/dist/controls/sparkline/sparkline-math.d.ts +23 -0
- package/dist/controls/sparkline/sparkline-math.js +79 -0
- package/dist/controls/sparkline/sparkline.css +61 -0
- package/dist/controls/sparkline/sparkline.d.ts +27 -0
- package/dist/controls/sparkline/sparkline.js +74 -0
- package/dist/controls/split/constrain.d.ts +44 -0
- package/dist/controls/split/constrain.js +126 -0
- package/dist/controls/split/split-pane.css +63 -0
- package/dist/controls/split/split-pane.d.ts +49 -0
- package/dist/controls/split/split-pane.js +42 -0
- package/dist/controls/split/split.css +127 -0
- package/dist/controls/split/split.d.ts +42 -0
- package/dist/controls/split/split.js +364 -0
- package/dist/controls/stat/stat-model.d.ts +22 -0
- package/dist/controls/stat/stat-model.js +69 -0
- package/dist/controls/stat/stat.css +101 -0
- package/dist/controls/stat/stat.d.ts +30 -0
- package/dist/controls/stat/stat.js +73 -0
- package/dist/controls/status-stream/status-stream.css +151 -0
- package/dist/controls/status-stream/status-stream.d.ts +108 -0
- package/dist/controls/status-stream/status-stream.js +417 -0
- package/dist/controls/swatch/swatch.css +66 -0
- package/dist/controls/swatch/swatch.d.ts +28 -0
- package/dist/controls/swatch/swatch.js +74 -0
- package/dist/controls/swiper/swiper-item.css +17 -0
- package/dist/controls/swiper/swiper-item.d.ts +31 -0
- package/dist/controls/swiper/swiper-item.js +47 -0
- package/dist/controls/swiper/swiper-label.css +10 -0
- package/dist/controls/swiper/swiper-label.d.ts +4 -0
- package/dist/controls/swiper/swiper-label.js +20 -0
- package/dist/controls/swiper/swiper-paddles.css +26 -0
- package/dist/controls/swiper/swiper-paddles.d.ts +10 -0
- package/dist/controls/swiper/swiper-paddles.js +62 -0
- package/dist/controls/swiper/swiper-pagination.css +60 -0
- package/dist/controls/swiper/swiper-pagination.d.ts +31 -0
- package/dist/controls/swiper/swiper-pagination.js +78 -0
- package/dist/controls/swiper/swiper.css +153 -0
- package/dist/controls/swiper/swiper.d.ts +158 -0
- package/dist/controls/swiper/swiper.js +659 -0
- package/dist/controls/switch/switch.css +194 -0
- package/dist/controls/switch/switch.d.ts +5 -0
- package/dist/controls/switch/switch.js +18 -0
- package/dist/controls/table/table-model.d.ts +43 -0
- package/dist/controls/table/table-model.js +124 -0
- package/dist/controls/table/table.css +90 -0
- package/dist/controls/table/table.d.ts +29 -0
- package/dist/controls/table/table.js +178 -0
- package/dist/controls/tabs/tab-panel.d.ts +10 -0
- package/dist/controls/tabs/tab-panel.js +89 -0
- package/dist/controls/tabs/tab.d.ts +26 -0
- package/dist/controls/tabs/tab.js +67 -0
- package/dist/controls/tabs/tabs.css +181 -0
- package/dist/controls/tabs/tabs.d.ts +61 -0
- package/dist/controls/tabs/tabs.js +176 -0
- package/dist/controls/text/href.d.ts +26 -0
- package/dist/controls/text/href.js +48 -0
- package/dist/controls/text/text.css +328 -0
- package/dist/controls/text/text.d.ts +85 -0
- package/dist/controls/text/text.js +273 -0
- package/dist/controls/text-field/text-field.css +498 -0
- package/dist/controls/text-field/text-field.d.ts +226 -0
- package/dist/controls/text-field/text-field.js +905 -0
- package/dist/controls/textarea/textarea.css +251 -0
- package/dist/controls/textarea/textarea.d.ts +136 -0
- package/dist/controls/textarea/textarea.js +312 -0
- package/dist/controls/theme-provider/theme-provider.css +48 -0
- package/dist/controls/theme-provider/theme-provider.d.ts +59 -0
- package/dist/controls/theme-provider/theme-provider.js +40 -0
- package/dist/controls/timeline/timeline.css +33 -0
- package/dist/controls/timeline/timeline.d.ts +39 -0
- package/dist/controls/timeline/timeline.js +52 -0
- package/dist/controls/timeline-item/timeline-item.css +495 -0
- package/dist/controls/timeline-item/timeline-item.d.ts +79 -0
- package/dist/controls/timeline-item/timeline-item.js +360 -0
- package/dist/controls/toast/toast-region.css +56 -0
- package/dist/controls/toast/toast-region.d.ts +20 -0
- package/dist/controls/toast/toast-region.js +113 -0
- package/dist/controls/toast/toast.css +96 -0
- package/dist/controls/toast/toast.d.ts +28 -0
- package/dist/controls/toast/toast.js +191 -0
- package/dist/controls/toolbar/toolbar.css +125 -0
- package/dist/controls/toolbar/toolbar.d.ts +108 -0
- package/dist/controls/toolbar/toolbar.js +68 -0
- package/dist/controls/tooltip/tooltip.css +80 -0
- package/dist/controls/tooltip/tooltip.d.ts +57 -0
- package/dist/controls/tooltip/tooltip.js +205 -0
- package/dist/descriptor/component-descriptor.d.ts +112 -0
- package/dist/descriptor/component-descriptor.js +492 -0
- package/dist/descriptor/index.d.ts +1 -0
- package/dist/descriptor/index.js +5 -0
- package/dist/dom/container.d.ts +45 -0
- package/dist/dom/container.js +60 -0
- package/dist/dom/element.d.ts +98 -0
- package/dist/dom/element.js +221 -0
- package/dist/dom/form.d.ts +240 -0
- package/dist/dom/form.js +399 -0
- package/dist/dom/index.d.ts +10 -0
- package/dist/dom/index.js +31 -0
- package/dist/dom/props.d.ts +56 -0
- package/dist/dom/props.js +231 -0
- package/dist/dom/repeat.d.ts +10 -0
- package/dist/dom/repeat.js +202 -0
- package/dist/dom/template.d.ts +161 -0
- package/dist/dom/template.js +634 -0
- package/dist/dom/watch.d.ts +11 -0
- package/dist/dom/watch.js +82 -0
- package/dist/foundation-styles.css +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/reactive/graph.d.ts +65 -0
- package/dist/reactive/graph.js +310 -0
- package/dist/reactive/index.d.ts +3 -0
- package/dist/reactive/index.js +4 -0
- package/dist/reactive/scheduler.d.ts +13 -0
- package/dist/reactive/scheduler.js +49 -0
- package/dist/traits/area-drag.d.ts +12 -0
- package/dist/traits/area-drag.js +70 -0
- package/dist/traits/form-registry.d.ts +36 -0
- package/dist/traits/form-registry.js +108 -0
- package/dist/traits/index.d.ts +24 -0
- package/dist/traits/index.js +19 -0
- package/dist/traits/overlay.d.ts +50 -0
- package/dist/traits/overlay.js +277 -0
- package/dist/traits/pane-resize.d.ts +26 -0
- package/dist/traits/pane-resize.js +103 -0
- package/dist/traits/press-activation.d.ts +11 -0
- package/dist/traits/press-activation.js +55 -0
- package/dist/traits/roving-focus.d.ts +52 -0
- package/dist/traits/roving-focus.js +214 -0
- package/dist/traits/scroll-fade.d.ts +28 -0
- package/dist/traits/scroll-fade.js +120 -0
- package/dist/traits/selection-commit.d.ts +30 -0
- package/dist/traits/selection-commit.js +146 -0
- package/dist/traits/tabbable.d.ts +12 -0
- package/dist/traits/tabbable.js +59 -0
- package/dist/traits/track-user-invalid.d.ts +36 -0
- package/dist/traits/track-user-invalid.js +52 -0
- package/dist/traits/value-codec.d.ts +120 -0
- package/dist/traits/value-codec.js +497 -0
- package/dist/traits/value-drag.d.ts +18 -0
- package/dist/traits/value-drag.js +84 -0
- package/package.json +263 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactiveProps } from '../../dom/index.js';
|
|
2
|
+
import { UIContainerElement } from '../../dom/container.js';
|
|
3
|
+
declare const props: {
|
|
4
|
+
scrollable: {
|
|
5
|
+
reflect: true;
|
|
6
|
+
type: import("../../index.js").PropType<boolean>;
|
|
7
|
+
default: boolean;
|
|
8
|
+
attribute?: string | false;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export interface UICardContentElement extends ReactiveProps<typeof props> {
|
|
12
|
+
}
|
|
13
|
+
export declare class UICardContentElement extends UIContainerElement {
|
|
14
|
+
static props: {
|
|
15
|
+
scrollable: {
|
|
16
|
+
reflect: true;
|
|
17
|
+
type: import("../../index.js").PropType<boolean>;
|
|
18
|
+
default: boolean;
|
|
19
|
+
attribute?: string | false;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
protected connected(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// card-content.ts — UICardContentElement, the card's body region (decomp g9-containers slice s7; one folder,
|
|
2
|
+
// one writer with card.ts). PROP + self-define + the scroll-fade wiring; the layout + the scroll CSS + the mask
|
|
3
|
+
// PAINT live in card.css / the shared container-box.css (traits/scroll-fade.ts).
|
|
4
|
+
//
|
|
5
|
+
// The body region SUB-ELEMENT of `ui-card` — the default-children container (NO leading/label/trailing
|
|
6
|
+
// anatomy; it is plain flow content). It extends `UIContainerElement` (NOT form-associated). It carries ONE
|
|
7
|
+
// reflected boolean prop:
|
|
8
|
+
// • `scrollable` — a SIGNAL that puts the CARD into scroll mode (Kim, 2026-07-05: "the whole container
|
|
9
|
+
// should scroll"). `<ui-card-content scrollable>` (the A2UI-mapped signal) — OR the ergonomic parent
|
|
10
|
+
// `<ui-card scrollable>` — arms it. Named `scrollable` (NOT `scroll`) deliberately: a `scroll` prop would
|
|
11
|
+
// shadow the inherited native `Element.prototype.scroll()` method — a `scroll: boolean` accessor collides
|
|
12
|
+
// with the method type (TS 2320/2416). `scrollable` has no native collision, so it is a fully-typed
|
|
13
|
+
// reflecting prop.
|
|
14
|
+
//
|
|
15
|
+
// REVISED 2026-07-07 (Kim, verbatim: "<ui-card-content> should have the mask and manage overflow, and adjust
|
|
16
|
+
// block-padding and linear gradient coordinates based on presence of the peer footer and header. it should be
|
|
17
|
+
// set to use 100% of its parent height when [scrollable]") — SUPERSEDES the short-lived WRAPPER MODEL
|
|
18
|
+
// (2026-07-06): no more author-written `[scroll-wrapper]` child, no more read-once detection, no more childList
|
|
19
|
+
// heal (all retired — nothing left to detect). THIS region is now directly the scroll viewport AND the masked
|
|
20
|
+
// element, one box: card.css gives it `overflow-y: auto` + `flex: 1 1 auto` (the mechanism realizing "100% of
|
|
21
|
+
// parent height" against a card whose own block-size is only `max-block-size`-bounded — see card.css's banner)
|
|
22
|
+
// while the card's header/footer become OVERLAID peers (`position: absolute`, no longer in flow, no longer
|
|
23
|
+
// competing for column space) — so content is the card's SOLE flex item, filling the whole column.
|
|
24
|
+
//
|
|
25
|
+
// `viewport` therefore collapses to `this` (the trait's own default — no override needed at all); only
|
|
26
|
+
// `brackets` still needs to differ, since the header/footer live on the CARD (one level up), not on `this`.
|
|
27
|
+
// `scrollFade(this, { brackets, enabled })` wires `traits/scroll-fade.ts` in `connected()` — the mask self-gates
|
|
28
|
+
// on ACTUAL overflow, so a short non-scrolling card never fades. The published `--ui-box-head`/`--ui-box-foot`
|
|
29
|
+
// bracket bands now drive BOTH the gradient offset (container-box.css, unchanged) AND this region's own
|
|
30
|
+
// block-padding (card.css) — one measured source, two consumers, per Kim's ask.
|
|
31
|
+
//
|
|
32
|
+
// The prop REFLECTS so the attribute selectors apply to JS-set values too. `render()` stays the inherited void.
|
|
33
|
+
// `controls → dom + traits` is the allowed direction.
|
|
34
|
+
//
|
|
35
|
+
// REVISED 2026-07-08 (Kim's third option, resolving the "the mask fades the scrollbar" tension — ADR-0046
|
|
36
|
+
// Amendment 6): card.css HIDES ui-card-content's native scrollbar in scroll mode (`scrollbar-width: none` +
|
|
37
|
+
// `::-webkit-scrollbar { display: none }`) — native `overflow-y: auto` scrolling is UNCHANGED, so with no
|
|
38
|
+
// visible bar left for the mask to fade, the running fade becomes the sole (and only) scroll affordance. This
|
|
39
|
+
// makes THIS region a keyboard dead-end unless it can itself take focus — connected() below gives it
|
|
40
|
+
// `tabindex="0"` (+ `role=group`, + a best-effort `ariaLabelledByElements` name off the header) whenever
|
|
41
|
+
// `inScrollMode()` is true, reactively, mirroring the fade's own gate. A focused, tabindex=0, overflow:auto DIV
|
|
42
|
+
// is NOT reliably keyboard-scrollable by the platform's own default action across engines — MEASURED
|
|
43
|
+
// (card.browser.test.ts): Chromium scrolls it once genuinely (trusted-click-)focused, WebKit does not move it
|
|
44
|
+
// AT ALL (ArrowDown/PageDown/End all no-op), confirming the exact "WebKit lags" gap flagged at design time. So
|
|
45
|
+
// connected() wires an EXPLICIT keydown handler (below) rather than depend on an inconsistent default action —
|
|
46
|
+
// deterministic scrolling on every engine, not a per-platform gamble.
|
|
47
|
+
import { prop } from "../../dom/index.js";
|
|
48
|
+
import { UIContainerElement } from "../../dom/container.js";
|
|
49
|
+
import { scrollFade } from "../../traits/scroll-fade.js";
|
|
50
|
+
const props = {
|
|
51
|
+
// presence semantics: `<ui-card-content scrollable>` → a SIGNAL that puts the parent CARD into scroll mode (this
|
|
52
|
+
// region becomes the scroll viewport). See connected() + card.css's scroll-mode block.
|
|
53
|
+
scrollable: { ...prop.boolean(false), reflect: true },
|
|
54
|
+
};
|
|
55
|
+
export class UICardContentElement extends UIContainerElement {
|
|
56
|
+
static props = props;
|
|
57
|
+
connected() {
|
|
58
|
+
// `brackets` is ALWAYS the card (its direct children are the real header/footer) — standalone (no ui-card
|
|
59
|
+
// parent) falls back to `this`, inert without a card scroll frame, which is intended. `viewport` is left at
|
|
60
|
+
// its default (`this`) — this region IS the scroll viewport now, no split.
|
|
61
|
+
const card = this.parentElement;
|
|
62
|
+
const onCard = card instanceof HTMLElement && card.tagName === 'UI-CARD';
|
|
63
|
+
const brackets = onCard ? card : this;
|
|
64
|
+
const inScrollMode = () => this.scrollable || (onCard && card.hasAttribute('scrollable'));
|
|
65
|
+
scrollFade(this, { brackets, enabled: inScrollMode });
|
|
66
|
+
// Keyboard operability (WCAG 2.1.1 Keyboard — component-review, 2026-07-08): card.css HIDES the native
|
|
67
|
+
// scrollbar in scroll mode (Kim's "keep native, but hide it" resolution, ADR-0046 Amendment 6) — the fade
|
|
68
|
+
// is now the ONLY visible scroll affordance. `tabindex="0"` makes THIS region a genuine tab stop.
|
|
69
|
+
// Reactive: tracks the SAME `inScrollMode()` the fade above gates on, so toggling the content-level
|
|
70
|
+
// `scrollable` signal live also toggles focusability (the parent-level `<ui-card scrollable>` stays the
|
|
71
|
+
// documented read-once-at-connect case — same asymmetry as the fade arming).
|
|
72
|
+
this.effect(() => {
|
|
73
|
+
if (!inScrollMode()) {
|
|
74
|
+
this.removeAttribute('tabindex');
|
|
75
|
+
this.internals.role = null;
|
|
76
|
+
if ('ariaLabelledByElements' in this.internals)
|
|
77
|
+
this.internals.ariaLabelledByElements = null;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.setAttribute('tabindex', '0');
|
|
81
|
+
this.internals.role = 'group';
|
|
82
|
+
// An accessible name for the now-focusable region, borrowed from the header — a card's header IS its
|
|
83
|
+
// content's caption. `ariaLabelledByElements` is a newer ElementInternals reflection API (unsupported in
|
|
84
|
+
// jsdom; real-engine support is flagged for Kim's on-device check, not asserted here) — feature-detected
|
|
85
|
+
// so its absence never throws. A headerless card gets no name: a documented gap (card.md), matching the
|
|
86
|
+
// family's "unnamed stays generic" ARIA posture (ADR-0014).
|
|
87
|
+
if ('ariaLabelledByElements' in this.internals) {
|
|
88
|
+
const header = onCard ? card.querySelector(':scope > ui-card-header') : null;
|
|
89
|
+
this.internals.ariaLabelledByElements = header ? [header] : null;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// The EXPLICIT scroll — the platform's own default action for arrow/Page/Home/End on a focused,
|
|
93
|
+
// tabindex=0, overflow:auto DIV is NOT reliable across engines (measured: Chromium moves it once
|
|
94
|
+
// trusted-focused; WebKit does not move it at all) — so this region scrolls itself deterministically
|
|
95
|
+
// rather than gamble on that default. `event.target === this` guards against hijacking arrow keys a
|
|
96
|
+
// focused DESCENDANT owns for its own purpose (e.g. a roving-tabindex control inside the content); only
|
|
97
|
+
// when THIS region itself is the direct key target does it act. `preventDefault()` on a handled key
|
|
98
|
+
// suppresses whatever native default action might ALSO fire (Chromium), so the increment is the same
|
|
99
|
+
// everywhere, not a double-scroll.
|
|
100
|
+
this.listen(this, 'keydown', (event) => {
|
|
101
|
+
if (event.target !== this || !inScrollMode())
|
|
102
|
+
return;
|
|
103
|
+
const key = event.key;
|
|
104
|
+
const line = 40; // px per arrow press — an ordinary reading-line increment, density-invariant on purpose
|
|
105
|
+
const page = this.clientHeight * 0.9; // near-full-page, a small overlap (the standard page-scroll convention)
|
|
106
|
+
switch (key) {
|
|
107
|
+
case 'ArrowDown':
|
|
108
|
+
this.scrollTop += line;
|
|
109
|
+
break;
|
|
110
|
+
case 'ArrowUp':
|
|
111
|
+
this.scrollTop -= line;
|
|
112
|
+
break;
|
|
113
|
+
case 'PageDown':
|
|
114
|
+
this.scrollTop += page;
|
|
115
|
+
break;
|
|
116
|
+
case 'PageUp':
|
|
117
|
+
this.scrollTop -= page;
|
|
118
|
+
break;
|
|
119
|
+
case 'Home':
|
|
120
|
+
this.scrollTop = 0;
|
|
121
|
+
break;
|
|
122
|
+
case 'End':
|
|
123
|
+
this.scrollTop = this.scrollHeight;
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (!customElements.get('ui-card-content'))
|
|
133
|
+
customElements.define('ui-card-content', UICardContentElement);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// card-footer.ts — UICardFooterElement, the card's footer region (decomp g9-containers slice s7; one folder,
|
|
2
|
+
// one writer with card.ts). BEHAVIOUR + self-define ONLY; the host-as-grid anatomy lives in card.css.
|
|
3
|
+
//
|
|
4
|
+
// The footer is `ui-card-header`'s sibling — the SAME leading/label/trailing host-as-grid anatomy (anatomy.md),
|
|
5
|
+
// in the card grid's bottom `auto` row. A region SUB-ELEMENT extending `UIContainerElement` (NOT
|
|
6
|
+
// form-associated), carrying NO props — the anatomy is presence-driven CSS (`:has()`), no observedAttributes,
|
|
7
|
+
// no JS. Common content: actions (a `slot="trailing"` button row) or a metadata line; decorative adornment
|
|
8
|
+
// glyphs are `aria-hidden`. A footer that paints a fill clips to the card's INNER radius (card.css).
|
|
9
|
+
//
|
|
10
|
+
// `render()` stays the inherited void (light-DOM children are the content). No connected() — pure layout.
|
|
11
|
+
// `controls → dom` is the allowed import direction.
|
|
12
|
+
import { UIContainerElement } from "../../dom/container.js";
|
|
13
|
+
export class UICardFooterElement extends UIContainerElement {
|
|
14
|
+
}
|
|
15
|
+
if (!customElements.get('ui-card-footer'))
|
|
16
|
+
customElements.define('ui-card-footer', UICardFooterElement);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// card-header.ts — UICardHeaderElement, the card's header region (decomp g9-containers slice s7; one folder,
|
|
2
|
+
// one writer with card.ts). BEHAVIOUR + self-define ONLY; the host-as-grid anatomy lives in card.css.
|
|
3
|
+
//
|
|
4
|
+
// A region SUB-ELEMENT of `ui-card` (the ratified "regions = sub-elements"). It extends `UIContainerElement`
|
|
5
|
+
// for the family base (NOT form-associated; the shared `internals` for any opt-in ARIA), but carries NO props
|
|
6
|
+
// of its own — the leading/label/trailing anatomy (anatomy.md host-as-grid) is purely presence-driven CSS
|
|
7
|
+
// (`:has()`), exactly like `ui-button`: position places (the `slot`), no observedAttributes, no JS. The header
|
|
8
|
+
// sits in the card grid's top `auto` row; its accessible content is the default/label children, with optional
|
|
9
|
+
// `slot="leading"` / `slot="trailing"` adornments (mark decorative glyphs `aria-hidden`). A header that paints
|
|
10
|
+
// a fill clips to the card's INNER radius (card.css publishes `--ui-card-inner-radius`).
|
|
11
|
+
//
|
|
12
|
+
// `render()` stays the inherited void (the agent's light-DOM children are the content). No connected() — there
|
|
13
|
+
// is no behaviour to wire; the region is all layout. `controls → dom` is the allowed import direction.
|
|
14
|
+
import { UIContainerElement } from "../../dom/container.js";
|
|
15
|
+
export class UICardHeaderElement extends UIContainerElement {
|
|
16
|
+
}
|
|
17
|
+
if (!customElements.get('ui-card-header'))
|
|
18
|
+
customElements.define('ui-card-header', UICardHeaderElement);
|