@cscfi/csc-ui 4.0.0-alpha.6 → 4.0.0-alpha.7
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/csc-ui.js +6929 -6700
- package/dist/custom-elements.json +55 -4
- package/dist/docs/c-checkbox/usage.md +14 -11
- package/dist/docs/c-popover/usage.md +8 -0
- package/dist/docs/c-radio/usage.md +4 -3
- package/dist/docs/c-tooltip/usage.md +3 -1
- package/dist/vscode.css-custom-data.json +2 -2
- package/dist/vscode.html-custom-data.json +17 -2
- package/dist/web-types.json +35 -5
- package/dist-types/components/c-menu/CMenu.vue.d.ts +10 -0
- package/dist-types/components/c-popover/CPopover.vue.d.ts +9 -0
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +10 -0
- package/dist-types/shared/popoverChain.d.ts +62 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +40 -0
- package/dist-types/tag-name-map.d.ts +29 -3
- package/package.json +1 -1
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"owner": "c-pagination"
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
|
-
"declaration": "export interface CPopoverProps {\n /** Distance from the trigger to the panel, in pixels. Defaults to `0`. */\n distance?: number | string;\n /**\n * Heading rendered at the top of the panel, doubling as its accessible\n * name. Without it, set `aria-label` on the host. Named `heading`, not\n * `title`: a `title` attribute on the host would trigger the browser's\n * native tooltip and collides with `HTMLElement.title`.\n * @freeform\n */\n heading?: string;\n /** Whether the popover is open. Two-way: emits `change:open`. */\n open?: boolean;\n /** Preferred placement of the panel relative to the trigger. */\n position?: CPlacement;\n}",
|
|
316
|
+
"declaration": "export interface CPopoverProps {\n /** Distance from the trigger to the panel, in pixels. Defaults to `0`. */\n distance?: number | string;\n /**\n * Heading rendered at the top of the panel, doubling as its accessible\n * name. Without it, set `aria-label` on the host. Named `heading`, not\n * `title`: a `title` attribute on the host would trigger the browser's\n * native tooltip and collides with `HTMLElement.title`.\n * @freeform\n */\n heading?: string;\n /** Whether the popover is open. Two-way: emits `change:open`. */\n open?: boolean;\n /** Preferred placement of the panel relative to the trigger. */\n position?: CPlacement;\n /**\n * Designated trigger: an element elsewhere in the document that opens the\n * popover — its document ID, or the element itself. The same trigger\n * concept as the `trigger` slot, supplied by reference: the popover wires\n * click-to-toggle, ARIA and focus return onto it and anchors the panel to\n * it. When both routes are supplied, this prop wins over the slot.\n */\n trigger?: HTMLElement | string;\n}",
|
|
317
317
|
"description": "",
|
|
318
318
|
"kind": "interface",
|
|
319
319
|
"name": "CPopoverProps",
|
|
@@ -439,7 +439,7 @@
|
|
|
439
439
|
"owner": "c-toasts"
|
|
440
440
|
},
|
|
441
441
|
{
|
|
442
|
-
"declaration": "export interface CTooltipProps {\n /**\n * Delay before the tooltip shows on hover, in milliseconds. Keyboard focus\n * shows the tooltip immediately, regardless of this value. Defaults to\n * `400`.\n */\n delay?: number | string;\n /** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */\n distance?: number | string;\n /** Whether the tooltip is open. Two-way: emits `change:open`. */\n open?: boolean;\n /** Preferred placement of the tooltip relative to the trigger. */\n position?: CPlacement;\n /**\n * The tooltip text. Overridden by the `content` slot when that is\n * populated.\n * @freeform\n */\n text?: string;\n}",
|
|
442
|
+
"declaration": "export interface CTooltipProps {\n /**\n * Delay before the tooltip shows on hover, in milliseconds. Keyboard focus\n * shows the tooltip immediately, regardless of this value. Defaults to\n * `400`.\n */\n delay?: number | string;\n /** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */\n distance?: number | string;\n /** Whether the tooltip is open. Two-way: emits `change:open`. */\n open?: boolean;\n /** Preferred placement of the tooltip relative to the trigger. */\n position?: CPlacement;\n /**\n * The tooltip text. Overridden by the `content` slot when that is\n * populated.\n * @freeform\n */\n text?: string;\n /**\n * Designated trigger: an element elsewhere in the document that the\n * tooltip describes — its document ID, or the element itself. The same\n * trigger concept as the `trigger` slot, supplied by reference: the\n * tooltip wires hover/focus, mirrors `aria-description` onto it and\n * anchors the bubble to it. When both routes are supplied, this prop wins\n * over the slot.\n */\n trigger?: HTMLElement | string;\n}",
|
|
443
443
|
"description": "",
|
|
444
444
|
"kind": "interface",
|
|
445
445
|
"name": "CTooltipProps",
|
|
@@ -2659,7 +2659,7 @@
|
|
|
2659
2659
|
},
|
|
2660
2660
|
{
|
|
2661
2661
|
"name": "indicator",
|
|
2662
|
-
"description": "The checkbox box itself — the bordered square that fills when checked"
|
|
2662
|
+
"description": "The checkbox box itself — the bordered square that fills when checked; border, fill and the keyboard focus ring (its `::before`) all draw with `currentColor`, so `color` recolours them together"
|
|
2663
2663
|
},
|
|
2664
2664
|
{
|
|
2665
2665
|
"name": "mark",
|
|
@@ -5831,6 +5831,14 @@
|
|
|
5831
5831
|
"csc": {
|
|
5832
5832
|
"typeAlias": "CPlacement"
|
|
5833
5833
|
}
|
|
5834
|
+
},
|
|
5835
|
+
{
|
|
5836
|
+
"fieldName": "trigger",
|
|
5837
|
+
"name": "trigger",
|
|
5838
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\nmenu — its document ID, or the element itself. The same trigger concept\nas the `trigger` slot, supplied by reference: the menu wires\nclick-to-toggle, arrow-key opening, ARIA and focus return onto it and\nanchors the panel to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
5839
|
+
"type": {
|
|
5840
|
+
"text": "HTMLElement | string"
|
|
5841
|
+
}
|
|
5834
5842
|
}
|
|
5835
5843
|
],
|
|
5836
5844
|
"cssParts": [
|
|
@@ -5898,6 +5906,15 @@
|
|
|
5898
5906
|
"csc": {
|
|
5899
5907
|
"typeAlias": "CPlacement"
|
|
5900
5908
|
}
|
|
5909
|
+
},
|
|
5910
|
+
{
|
|
5911
|
+
"kind": "field",
|
|
5912
|
+
"name": "trigger",
|
|
5913
|
+
"privacy": "public",
|
|
5914
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\nmenu — its document ID, or the element itself. The same trigger concept\nas the `trigger` slot, supplied by reference: the menu wires\nclick-to-toggle, arrow-key opening, ARIA and focus return onto it and\nanchors the panel to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
5915
|
+
"type": {
|
|
5916
|
+
"text": "HTMLElement | string"
|
|
5917
|
+
}
|
|
5901
5918
|
}
|
|
5902
5919
|
],
|
|
5903
5920
|
"slots": [
|
|
@@ -7313,6 +7330,14 @@
|
|
|
7313
7330
|
"csc": {
|
|
7314
7331
|
"typeAlias": "CPlacement"
|
|
7315
7332
|
}
|
|
7333
|
+
},
|
|
7334
|
+
{
|
|
7335
|
+
"fieldName": "trigger",
|
|
7336
|
+
"name": "trigger",
|
|
7337
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\npopover — its document ID, or the element itself. The same trigger\nconcept as the `trigger` slot, supplied by reference: the popover wires\nclick-to-toggle, ARIA and focus return onto it and anchors the panel to\nit. When both routes are supplied, this prop wins over the slot.",
|
|
7338
|
+
"type": {
|
|
7339
|
+
"text": "HTMLElement | string"
|
|
7340
|
+
}
|
|
7316
7341
|
}
|
|
7317
7342
|
],
|
|
7318
7343
|
"cssParts": [
|
|
@@ -7386,6 +7411,15 @@
|
|
|
7386
7411
|
"csc": {
|
|
7387
7412
|
"typeAlias": "CPlacement"
|
|
7388
7413
|
}
|
|
7414
|
+
},
|
|
7415
|
+
{
|
|
7416
|
+
"kind": "field",
|
|
7417
|
+
"name": "trigger",
|
|
7418
|
+
"privacy": "public",
|
|
7419
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\npopover — its document ID, or the element itself. The same trigger\nconcept as the `trigger` slot, supplied by reference: the popover wires\nclick-to-toggle, ARIA and focus return onto it and anchors the panel to\nit. When both routes are supplied, this prop wins over the slot.",
|
|
7420
|
+
"type": {
|
|
7421
|
+
"text": "HTMLElement | string"
|
|
7422
|
+
}
|
|
7389
7423
|
}
|
|
7390
7424
|
],
|
|
7391
7425
|
"slots": [
|
|
@@ -7741,7 +7775,7 @@
|
|
|
7741
7775
|
},
|
|
7742
7776
|
{
|
|
7743
7777
|
"name": "indicator",
|
|
7744
|
-
"description": "The radio ring itself; the selection dot is its `::after` —
|
|
7778
|
+
"description": "The radio ring itself; the selection dot is its `::after` and the keyboard focus ring its `::before` — all three follow `currentColor`, so `color` recolours the whole indicator, focus ring included"
|
|
7745
7779
|
},
|
|
7746
7780
|
{
|
|
7747
7781
|
"name": "content",
|
|
@@ -12171,6 +12205,14 @@
|
|
|
12171
12205
|
"csc": {
|
|
12172
12206
|
"freeform": true
|
|
12173
12207
|
}
|
|
12208
|
+
},
|
|
12209
|
+
{
|
|
12210
|
+
"fieldName": "trigger",
|
|
12211
|
+
"name": "trigger",
|
|
12212
|
+
"description": "Designated trigger: an element elsewhere in the document that the\ntooltip describes — its document ID, or the element itself. The same\ntrigger concept as the `trigger` slot, supplied by reference: the\ntooltip wires hover/focus, mirrors `aria-description` onto it and\nanchors the bubble to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
12213
|
+
"type": {
|
|
12214
|
+
"text": "HTMLElement | string"
|
|
12215
|
+
}
|
|
12174
12216
|
}
|
|
12175
12217
|
],
|
|
12176
12218
|
"cssParts": [
|
|
@@ -12250,6 +12292,15 @@
|
|
|
12250
12292
|
"csc": {
|
|
12251
12293
|
"freeform": true
|
|
12252
12294
|
}
|
|
12295
|
+
},
|
|
12296
|
+
{
|
|
12297
|
+
"kind": "field",
|
|
12298
|
+
"name": "trigger",
|
|
12299
|
+
"privacy": "public",
|
|
12300
|
+
"description": "Designated trigger: an element elsewhere in the document that the\ntooltip describes — its document ID, or the element itself. The same\ntrigger concept as the `trigger` slot, supplied by reference: the\ntooltip wires hover/focus, mirrors `aria-description` onto it and\nanchors the bubble to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
12301
|
+
"type": {
|
|
12302
|
+
"text": "HTMLElement | string"
|
|
12303
|
+
}
|
|
12253
12304
|
}
|
|
12254
12305
|
],
|
|
12255
12306
|
"slots": [
|
|
@@ -26,24 +26,27 @@ entirely.
|
|
|
26
26
|
## Customization
|
|
27
27
|
|
|
28
28
|
Restyle via CSS parts from your own stylesheet. The `indicator` part is the
|
|
29
|
-
checkbox box and `mark` is the check glyph inside it
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
checkbox box and `mark` is the check glyph inside it. The indicator's border,
|
|
30
|
+
its checked fill and its keyboard focus ring all draw with `currentColor`, so
|
|
31
|
+
one `color` recolours the three together; the host exposes the `checked` and
|
|
32
|
+
`indeterminate` custom states, so the box is also stylable per state:
|
|
32
33
|
|
|
33
34
|
```css
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
/* Border, checked fill and focus ring follow `color`. */
|
|
36
|
+
c-checkbox::part(indicator) {
|
|
37
|
+
color: var(--my-green);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
border-color: gray;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* The mark draws with currentColor — recolour it via `color`. */
|
|
40
|
+
/* The mark draws with currentColor too — recolour it via `color`. */
|
|
44
41
|
c-checkbox:state(checked)::part(mark) {
|
|
45
42
|
color: black;
|
|
46
43
|
}
|
|
44
|
+
|
|
45
|
+
/* Finer control still works per property and per state (the focus ring
|
|
46
|
+
keeps following `color`, not these). */
|
|
47
|
+
c-checkbox:not(:state(checked))::part(indicator) {
|
|
48
|
+
border-color: gray;
|
|
49
|
+
}
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
For app-wide recolouring prefer the design tokens (`--c-primary` seed) over
|
|
@@ -2,6 +2,10 @@ A click-opened, non-modal surface anchored to its trigger, floating in the top l
|
|
|
2
2
|
|
|
3
3
|
Put the element that opens the popover in the `trigger` slot and the content in the default slot. An optional `heading` prop renders a heading and doubles as the panel's accessible name (it is not called `title` — a `title` attribute would trigger the browser's native tooltip). The popover is deliberately minimal: compose footers, actions, or a close button from existing components (e.g. `c-button`) inside the body.
|
|
4
4
|
|
|
5
|
+
## Designated trigger
|
|
6
|
+
|
|
7
|
+
When the opener cannot be slotted — a button living elsewhere in the layout — point the `trigger` prop at it instead: the ID of the element, or the element itself via property binding. The two routes are the same concept: the popover wires click-to-toggle onto the designated element, mirrors `aria-haspopup`/`aria-expanded`, returns focus to it on Escape, anchors the panel to it, and clicking it never counts as a light dismiss. Supplying both routes is a misuse: the prop wins, the slotted element gets no wiring, and a console warning flags it.
|
|
8
|
+
|
|
5
9
|
## When to use
|
|
6
10
|
|
|
7
11
|
- Contextual, dismissable UI attached to a control: a small settings panel, a confirm-lite prompt, help content with links.
|
|
@@ -12,6 +16,10 @@ Put the element that opens the popover in the `trigger` slot and the content in
|
|
|
12
16
|
|
|
13
17
|
Clicking outside the popover or pressing Escape closes it. Escape returns focus to the trigger when focus was inside the panel; light dismiss leaves focus where the user clicked. Focus is not moved into the panel on open — Tab reaches the content naturally from the trigger.
|
|
14
18
|
|
|
19
|
+
## Nesting
|
|
20
|
+
|
|
21
|
+
Popovers nest: a control inside one popover's panel can open another. The open popovers form a popover chain — each nested in the previous one; opening a popover whose trigger is not inside the open one closes it first, so sibling popovers never coexist. Escape closes only the innermost popover, one press per layer; clicking outside closes every popover that does not contain the click (clicking in a parent panel closes just its child); closing a popover closes everything nested inside it. Nesting follows the trigger, not the markup — a popover opened from a designated trigger inside another popover's panel chains under it even though its host element lives elsewhere.
|
|
22
|
+
|
|
15
23
|
## Accessibility
|
|
16
24
|
|
|
17
25
|
The panel is a non-modal `role="dialog"` and needs an accessible name: the `heading` prop provides one, or set `aria-label` on the `c-popover` element (`aria-labelledby` cannot reference slotted content across the shadow boundary). The component warns in the console when it opens unnamed. `aria-haspopup="dialog"` and `aria-expanded` are mirrored onto the slotted trigger.
|
|
@@ -29,9 +29,10 @@ never unselected, like a native radio without siblings. Grouping behavior
|
|
|
29
29
|
## Customization
|
|
30
30
|
|
|
31
31
|
Restyle via CSS parts from your own stylesheet. The `indicator` part is the
|
|
32
|
-
radio ring; the selection dot is its `::after` pseudo-element
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
radio ring; the selection dot is its `::after` pseudo-element and the keyboard
|
|
33
|
+
focus ring its `::before`. Ring, dot and focus ring all draw with
|
|
34
|
+
`currentColor`, so `color` recolours the whole indicator, focus ring included.
|
|
35
|
+
The host exposes the `checked` and `disabled` custom states (both also cover
|
|
35
36
|
group-driven selection and disabling):
|
|
36
37
|
|
|
37
38
|
```css
|
|
@@ -4,6 +4,8 @@ Put the element the tooltip describes in the `trigger` slot and the hint in the
|
|
|
4
4
|
|
|
5
5
|
The tooltip shows after a short hover delay (configurable via the `delay` prop) and immediately on keyboard focus. The trigger must be focusable for keyboard and screen-reader users to reach the hint — a `c-icon-button` or `c-button` qualifies; a bare `<span>` does not.
|
|
6
6
|
|
|
7
|
+
When the described element cannot be slotted, point the `trigger` prop at it instead — its document ID, or the element itself via property binding. The tooltip then wires hover/focus onto that element, mirrors the `aria-description` there, and anchors the bubble to it. Supplying both routes is a misuse: the prop wins, the slotted element gets no wiring, and a console warning flags it.
|
|
8
|
+
|
|
7
9
|
## When to use
|
|
8
10
|
|
|
9
11
|
- To name an icon-only control or clarify a truncated label.
|
|
@@ -17,7 +19,7 @@ The tooltip hides when the pointer leaves the trigger and panel, when focus leav
|
|
|
17
19
|
|
|
18
20
|
The tooltip implements the WCAG 1.4.13 (Content on Hover or Focus) contract: dismissable, hoverable, persistent.
|
|
19
21
|
|
|
20
|
-
The tooltip content is mirrored onto the slotted
|
|
22
|
+
The tooltip content is mirrored onto the trigger (slotted or designated) as `aria-description`, so screen readers announce it with the trigger even while the bubble is closed. `aria-describedby` is not used because ARIA ID references cannot cross the shadow boundary between the light-DOM trigger and the shadow-DOM panel (ADR-0033).
|
|
21
23
|
|
|
22
24
|
## Layering
|
|
23
25
|
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"name": "::part(indicator)",
|
|
140
|
-
"description": "The checkbox box itself — the bordered square that fills when checked"
|
|
140
|
+
"description": "The checkbox box itself — the bordered square that fills when checked; border, fill and the keyboard focus ring (its `::before`) all draw with `currentColor`, so `color` recolours them together"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"name": "::part(mark)",
|
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
},
|
|
446
446
|
{
|
|
447
447
|
"name": "::part(indicator)",
|
|
448
|
-
"description": "The radio ring itself; the selection dot is its `::after` —
|
|
448
|
+
"description": "The radio ring itself; the selection dot is its `::after` and the keyboard focus ring its `::before` — all three follow `currentColor`, so `color` recolours the whole indicator, focus ring included"
|
|
449
449
|
},
|
|
450
450
|
{
|
|
451
451
|
"name": "::part(content)",
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
"name": "c-checkbox",
|
|
363
|
-
"description": "A form control for a single on/off choice: a native checkbox with a label, an optional hint, and validation messaging.\n---\n\n\n### **Events:**\n - **change** - Standard bubbling DOM change event, re-dispatched from the host when the\ncheckbox is toggled (the inner input's change does not cross the shadow\nboundary). No detail; read the new value from the host's `value` property.\n- **changeValue** - Fired when the checkbox is toggled, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked. Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event fired on toggle so a plain Vue `v-model`\nworks without the `v-control` directive. No detail.\n- **update:value** - v-model contract event fired on toggle, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked.\n\n### **Slots:**\n - **default** - Default slot for the label\n\n### **CSS Parts:**\n - **root** - The outer wrapper containing the checkbox, label and message\n- **label** - The `<label>` element wrapping the indicator and the label content\n- **indicator** - The checkbox box itself — the bordered square that fills when checked\n- **mark** - The SVG check / indeterminate glyph revealed inside the indicator; draws with `currentColor`, so `color` recolours it\n- **content** - Wrapper around the label text or slotted label content\n- **message** - The hint / error message area below the checkbox (always reserved unless `hide-details`)",
|
|
363
|
+
"description": "A form control for a single on/off choice: a native checkbox with a label, an optional hint, and validation messaging.\n---\n\n\n### **Events:**\n - **change** - Standard bubbling DOM change event, re-dispatched from the host when the\ncheckbox is toggled (the inner input's change does not cross the shadow\nboundary). No detail; read the new value from the host's `value` property.\n- **changeValue** - Fired when the checkbox is toggled, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked. Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event fired on toggle so a plain Vue `v-model`\nworks without the `v-control` directive. No detail.\n- **update:value** - v-model contract event fired on toggle, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked.\n\n### **Slots:**\n - **default** - Default slot for the label\n\n### **CSS Parts:**\n - **root** - The outer wrapper containing the checkbox, label and message\n- **label** - The `<label>` element wrapping the indicator and the label content\n- **indicator** - The checkbox box itself — the bordered square that fills when checked; border, fill and the keyboard focus ring (its `::before`) all draw with `currentColor`, so `color` recolours them together\n- **mark** - The SVG check / indeterminate glyph revealed inside the indicator; draws with `currentColor`, so `color` recolours it\n- **content** - Wrapper around the label text or slotted label content\n- **message** - The hint / error message area below the checkbox (always reserved unless `hide-details`)",
|
|
364
364
|
"attributes": [
|
|
365
365
|
{
|
|
366
366
|
"name": "checked",
|
|
@@ -953,6 +953,11 @@
|
|
|
953
953
|
{ "name": "top-start" },
|
|
954
954
|
{ "name": "top" }
|
|
955
955
|
]
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
"name": "trigger",
|
|
959
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\nmenu — its document ID, or the element itself. The same trigger concept\nas the `trigger` slot, supplied by reference: the menu wires\nclick-to-toggle, arrow-key opening, ARIA and focus return onto it and\nanchors the panel to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
960
|
+
"values": [{ "name": "HTMLElement" }]
|
|
956
961
|
}
|
|
957
962
|
],
|
|
958
963
|
"references": []
|
|
@@ -1209,6 +1214,11 @@
|
|
|
1209
1214
|
{ "name": "top-start" },
|
|
1210
1215
|
{ "name": "top" }
|
|
1211
1216
|
]
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
"name": "trigger",
|
|
1220
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\npopover — its document ID, or the element itself. The same trigger\nconcept as the `trigger` slot, supplied by reference: the popover wires\nclick-to-toggle, ARIA and focus return onto it and anchors the panel to\nit. When both routes are supplied, this prop wins over the slot.",
|
|
1221
|
+
"values": [{ "name": "HTMLElement" }]
|
|
1212
1222
|
}
|
|
1213
1223
|
],
|
|
1214
1224
|
"references": []
|
|
@@ -1269,7 +1279,7 @@
|
|
|
1269
1279
|
},
|
|
1270
1280
|
{
|
|
1271
1281
|
"name": "c-radio",
|
|
1272
|
-
"description": "A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label.\n---\n\n\n### **Events:**\n - **change** - Fired when the radio is selected by the user, carrying its `value`.\nBubbles composed so the parent `<c-radio-group>` — whose shadow root a\nlight-DOM event never enters — catches it on its host; a consumer\nlistening on the group hears it too, with the radio as `target`.\n\n### **Slots:**\n - **default** - The radio's label content, rendered inside the shadow `<label>` so it stays click-associated and announced\n\n### **CSS Parts:**\n - **root** - The `<label>` row wrapping the input, indicator and label content\n- **indicator** - The radio ring itself; the selection dot is its `::after` —
|
|
1282
|
+
"description": "A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label.\n---\n\n\n### **Events:**\n - **change** - Fired when the radio is selected by the user, carrying its `value`.\nBubbles composed so the parent `<c-radio-group>` — whose shadow root a\nlight-DOM event never enters — catches it on its host; a consumer\nlistening on the group hears it too, with the radio as `target`.\n\n### **Slots:**\n - **default** - The radio's label content, rendered inside the shadow `<label>` so it stays click-associated and announced\n\n### **CSS Parts:**\n - **root** - The `<label>` row wrapping the input, indicator and label content\n- **indicator** - The radio ring itself; the selection dot is its `::after` and the keyboard focus ring its `::before` — all three follow `currentColor`, so `color` recolours the whole indicator, focus ring included\n- **content** - Wrapper around the slotted label content",
|
|
1273
1283
|
"attributes": [
|
|
1274
1284
|
{
|
|
1275
1285
|
"name": "disabled",
|
|
@@ -1988,6 +1998,11 @@
|
|
|
1988
1998
|
"name": "text",
|
|
1989
1999
|
"description": "The tooltip text. Overridden by the `content` slot when that is\npopulated.",
|
|
1990
2000
|
"values": []
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
"name": "trigger",
|
|
2004
|
+
"description": "Designated trigger: an element elsewhere in the document that the\ntooltip describes — its document ID, or the element itself. The same\ntrigger concept as the `trigger` slot, supplied by reference: the\ntooltip wires hover/focus, mirrors `aria-description` onto it and\nanchors the bubble to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
2005
|
+
"values": [{ "name": "HTMLElement" }]
|
|
1991
2006
|
}
|
|
1992
2007
|
],
|
|
1993
2008
|
"references": []
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@cscfi/csc-ui",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -962,7 +962,7 @@
|
|
|
962
962
|
},
|
|
963
963
|
{
|
|
964
964
|
"name": "c-checkbox",
|
|
965
|
-
"description": "A form control for a single on/off choice: a native checkbox with a label, an optional hint, and validation messaging.\n---\n\n\n### **Events:**\n - **change** - Standard bubbling DOM change event, re-dispatched from the host when the\ncheckbox is toggled (the inner input's change does not cross the shadow\nboundary). No detail; read the new value from the host's `value` property.\n- **changeValue** - Fired when the checkbox is toggled, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked. Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event fired on toggle so a plain Vue `v-model`\nworks without the `v-control` directive. No detail.\n- **update:value** - v-model contract event fired on toggle, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked.\n\n### **Slots:**\n - **default** - Default slot for the label\n\n### **CSS Parts:**\n - **root** - The outer wrapper containing the checkbox, label and message\n- **label** - The `<label>` element wrapping the indicator and the label content\n- **indicator** - The checkbox box itself — the bordered square that fills when checked\n- **mark** - The SVG check / indeterminate glyph revealed inside the indicator; draws with `currentColor`, so `color` recolours it\n- **content** - Wrapper around the label text or slotted label content\n- **message** - The hint / error message area below the checkbox (always reserved unless `hide-details`)",
|
|
965
|
+
"description": "A form control for a single on/off choice: a native checkbox with a label, an optional hint, and validation messaging.\n---\n\n\n### **Events:**\n - **change** - Standard bubbling DOM change event, re-dispatched from the host when the\ncheckbox is toggled (the inner input's change does not cross the shadow\nboundary). No detail; read the new value from the host's `value` property.\n- **changeValue** - Fired when the checkbox is toggled, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked. Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event fired on toggle so a plain Vue `v-model`\nworks without the `v-control` directive. No detail.\n- **update:value** - v-model contract event fired on toggle, carrying the new value —\n`trueValue` when checked, `falseValue` when unchecked.\n\n### **Slots:**\n - **default** - Default slot for the label\n\n### **CSS Parts:**\n - **root** - The outer wrapper containing the checkbox, label and message\n- **label** - The `<label>` element wrapping the indicator and the label content\n- **indicator** - The checkbox box itself — the bordered square that fills when checked; border, fill and the keyboard focus ring (its `::before`) all draw with `currentColor`, so `color` recolours them together\n- **mark** - The SVG check / indeterminate glyph revealed inside the indicator; draws with `currentColor`, so `color` recolours it\n- **content** - Wrapper around the label text or slotted label content\n- **message** - The hint / error message area below the checkbox (always reserved unless `hide-details`)",
|
|
966
966
|
"doc-url": "",
|
|
967
967
|
"attributes": [
|
|
968
968
|
{
|
|
@@ -2427,6 +2427,11 @@
|
|
|
2427
2427
|
"type": "'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top'",
|
|
2428
2428
|
"default": "'bottom-start'"
|
|
2429
2429
|
}
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
"name": "trigger",
|
|
2433
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\nmenu — its document ID, or the element itself. The same trigger concept\nas the `trigger` slot, supplied by reference: the menu wires\nclick-to-toggle, arrow-key opening, ARIA and focus return onto it and\nanchors the panel to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
2434
|
+
"value": { "type": "HTMLElement | string" }
|
|
2430
2435
|
}
|
|
2431
2436
|
],
|
|
2432
2437
|
"slots": [
|
|
@@ -2467,6 +2472,11 @@
|
|
|
2467
2472
|
"name": "position",
|
|
2468
2473
|
"description": "Preferred placement of the panel relative to the trigger.",
|
|
2469
2474
|
"type": "'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top'"
|
|
2475
|
+
},
|
|
2476
|
+
{
|
|
2477
|
+
"name": "trigger",
|
|
2478
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\nmenu — its document ID, or the element itself. The same trigger concept\nas the `trigger` slot, supplied by reference: the menu wires\nclick-to-toggle, arrow-key opening, ARIA and focus return onto it and\nanchors the panel to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
2479
|
+
"type": "HTMLElement | string"
|
|
2470
2480
|
}
|
|
2471
2481
|
],
|
|
2472
2482
|
"events": [
|
|
@@ -3113,6 +3123,11 @@
|
|
|
3113
3123
|
"type": "'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top'",
|
|
3114
3124
|
"default": "'bottom'"
|
|
3115
3125
|
}
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
"name": "trigger",
|
|
3129
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\npopover — its document ID, or the element itself. The same trigger\nconcept as the `trigger` slot, supplied by reference: the popover wires\nclick-to-toggle, ARIA and focus return onto it and anchors the panel to\nit. When both routes are supplied, this prop wins over the slot.",
|
|
3130
|
+
"value": { "type": "HTMLElement | string" }
|
|
3116
3131
|
}
|
|
3117
3132
|
],
|
|
3118
3133
|
"slots": [
|
|
@@ -3153,6 +3168,11 @@
|
|
|
3153
3168
|
"name": "position",
|
|
3154
3169
|
"description": "Preferred placement of the panel relative to the trigger.",
|
|
3155
3170
|
"type": "'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top'"
|
|
3171
|
+
},
|
|
3172
|
+
{
|
|
3173
|
+
"name": "trigger",
|
|
3174
|
+
"description": "Designated trigger: an element elsewhere in the document that opens the\npopover — its document ID, or the element itself. The same trigger\nconcept as the `trigger` slot, supplied by reference: the popover wires\nclick-to-toggle, ARIA and focus return onto it and anchors the panel to\nit. When both routes are supplied, this prop wins over the slot.",
|
|
3175
|
+
"type": "HTMLElement | string"
|
|
3156
3176
|
}
|
|
3157
3177
|
],
|
|
3158
3178
|
"events": [
|
|
@@ -3279,7 +3299,7 @@
|
|
|
3279
3299
|
},
|
|
3280
3300
|
{
|
|
3281
3301
|
"name": "c-radio",
|
|
3282
|
-
"description": "A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label.\n---\n\n\n### **Events:**\n - **change** - Fired when the radio is selected by the user, carrying its `value`.\nBubbles composed so the parent `<c-radio-group>` — whose shadow root a\nlight-DOM event never enters — catches it on its host; a consumer\nlistening on the group hears it too, with the radio as `target`.\n\n### **Slots:**\n - **default** - The radio's label content, rendered inside the shadow `<label>` so it stays click-associated and announced\n\n### **CSS Parts:**\n - **root** - The `<label>` row wrapping the input, indicator and label content\n- **indicator** - The radio ring itself; the selection dot is its `::after` —
|
|
3302
|
+
"description": "A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label.\n---\n\n\n### **Events:**\n - **change** - Fired when the radio is selected by the user, carrying its `value`.\nBubbles composed so the parent `<c-radio-group>` — whose shadow root a\nlight-DOM event never enters — catches it on its host; a consumer\nlistening on the group hears it too, with the radio as `target`.\n\n### **Slots:**\n - **default** - The radio's label content, rendered inside the shadow `<label>` so it stays click-associated and announced\n\n### **CSS Parts:**\n - **root** - The `<label>` row wrapping the input, indicator and label content\n- **indicator** - The radio ring itself; the selection dot is its `::after` and the keyboard focus ring its `::before` — all three follow `currentColor`, so `color` recolours the whole indicator, focus ring included\n- **content** - Wrapper around the slotted label content",
|
|
3283
3303
|
"doc-url": "",
|
|
3284
3304
|
"attributes": [
|
|
3285
3305
|
{
|
|
@@ -5365,6 +5385,11 @@
|
|
|
5365
5385
|
"name": "text",
|
|
5366
5386
|
"description": "The tooltip text. Overridden by the `content` slot when that is\npopulated.",
|
|
5367
5387
|
"value": { "type": "string", "default": "''" }
|
|
5388
|
+
},
|
|
5389
|
+
{
|
|
5390
|
+
"name": "trigger",
|
|
5391
|
+
"description": "Designated trigger: an element elsewhere in the document that the\ntooltip describes — its document ID, or the element itself. The same\ntrigger concept as the `trigger` slot, supplied by reference: the\ntooltip wires hover/focus, mirrors `aria-description` onto it and\nanchors the bubble to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
5392
|
+
"value": { "type": "HTMLElement | string" }
|
|
5368
5393
|
}
|
|
5369
5394
|
],
|
|
5370
5395
|
"slots": [
|
|
@@ -5410,6 +5435,11 @@
|
|
|
5410
5435
|
"name": "text",
|
|
5411
5436
|
"description": "The tooltip text. Overridden by the `content` slot when that is\npopulated.",
|
|
5412
5437
|
"type": "string"
|
|
5438
|
+
},
|
|
5439
|
+
{
|
|
5440
|
+
"name": "trigger",
|
|
5441
|
+
"description": "Designated trigger: an element elsewhere in the document that the\ntooltip describes — its document ID, or the element itself. The same\ntrigger concept as the `trigger` slot, supplied by reference: the\ntooltip wires hover/focus, mirrors `aria-description` onto it and\nanchors the bubble to it. When both routes are supplied, this prop wins\nover the slot.",
|
|
5442
|
+
"type": "HTMLElement | string"
|
|
5413
5443
|
}
|
|
5414
5444
|
],
|
|
5415
5445
|
"events": [
|
|
@@ -5562,7 +5592,7 @@
|
|
|
5562
5592
|
},
|
|
5563
5593
|
{
|
|
5564
5594
|
"name": "part(indicator)",
|
|
5565
|
-
"description": "The checkbox box itself — the bordered square that fills when checked"
|
|
5595
|
+
"description": "The checkbox box itself — the bordered square that fills when checked; border, fill and the keyboard focus ring (its `::before`) all draw with `currentColor`, so `color` recolours them together"
|
|
5566
5596
|
},
|
|
5567
5597
|
{
|
|
5568
5598
|
"name": "part(mark)",
|
|
@@ -5876,7 +5906,7 @@
|
|
|
5876
5906
|
},
|
|
5877
5907
|
{
|
|
5878
5908
|
"name": "part(indicator)",
|
|
5879
|
-
"description": "The radio ring itself; the selection dot is its `::after` —
|
|
5909
|
+
"description": "The radio ring itself; the selection dot is its `::after` and the keyboard focus ring its `::before` — all three follow `currentColor`, so `color` recolours the whole indicator, focus ring included"
|
|
5880
5910
|
},
|
|
5881
5911
|
{
|
|
5882
5912
|
"name": "part(content)",
|
|
@@ -6,6 +6,15 @@ interface CMenuProps {
|
|
|
6
6
|
open?: boolean;
|
|
7
7
|
/** Preferred placement of the panel relative to the trigger. */
|
|
8
8
|
position?: CPlacement;
|
|
9
|
+
/**
|
|
10
|
+
* Designated trigger: an element elsewhere in the document that opens the
|
|
11
|
+
* menu — its document ID, or the element itself. The same trigger concept
|
|
12
|
+
* as the `trigger` slot, supplied by reference: the menu wires
|
|
13
|
+
* click-to-toggle, arrow-key opening, ARIA and focus return onto it and
|
|
14
|
+
* anchors the panel to it. When both routes are supplied, this prop wins
|
|
15
|
+
* over the slot.
|
|
16
|
+
*/
|
|
17
|
+
trigger?: HTMLElement | string;
|
|
9
18
|
}
|
|
10
19
|
declare var __VLS_1: {}, __VLS_3: {};
|
|
11
20
|
type __VLS_Slots = {} & {
|
|
@@ -17,6 +26,7 @@ declare const __VLS_base: import("vue").DefineComponent<CMenuProps, {}, {}, {},
|
|
|
17
26
|
open: boolean;
|
|
18
27
|
distance: number | string;
|
|
19
28
|
position: CPlacement;
|
|
29
|
+
trigger: HTMLElement | string;
|
|
20
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
32
|
declare const _default: typeof __VLS_export;
|
|
@@ -14,6 +14,14 @@ export interface CPopoverProps {
|
|
|
14
14
|
open?: boolean;
|
|
15
15
|
/** Preferred placement of the panel relative to the trigger. */
|
|
16
16
|
position?: CPlacement;
|
|
17
|
+
/**
|
|
18
|
+
* Designated trigger: an element elsewhere in the document that opens the
|
|
19
|
+
* popover — its document ID, or the element itself. The same trigger
|
|
20
|
+
* concept as the `trigger` slot, supplied by reference: the popover wires
|
|
21
|
+
* click-to-toggle, ARIA and focus return onto it and anchors the panel to
|
|
22
|
+
* it. When both routes are supplied, this prop wins over the slot.
|
|
23
|
+
*/
|
|
24
|
+
trigger?: HTMLElement | string;
|
|
17
25
|
}
|
|
18
26
|
declare const _default: typeof __VLS_export;
|
|
19
27
|
export default _default;
|
|
@@ -22,6 +30,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CPopov
|
|
|
22
30
|
open: boolean;
|
|
23
31
|
distance: number | string;
|
|
24
32
|
position: CPlacement;
|
|
33
|
+
trigger: HTMLElement | string;
|
|
25
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
26
35
|
trigger?: (props: {}) => any;
|
|
27
36
|
} & {
|
|
@@ -18,6 +18,15 @@ export interface CTooltipProps {
|
|
|
18
18
|
* @freeform
|
|
19
19
|
*/
|
|
20
20
|
text?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Designated trigger: an element elsewhere in the document that the
|
|
23
|
+
* tooltip describes — its document ID, or the element itself. The same
|
|
24
|
+
* trigger concept as the `trigger` slot, supplied by reference: the
|
|
25
|
+
* tooltip wires hover/focus, mirrors `aria-description` onto it and
|
|
26
|
+
* anchors the bubble to it. When both routes are supplied, this prop wins
|
|
27
|
+
* over the slot.
|
|
28
|
+
*/
|
|
29
|
+
trigger?: HTMLElement | string;
|
|
21
30
|
}
|
|
22
31
|
declare const _default: typeof __VLS_export;
|
|
23
32
|
export default _default;
|
|
@@ -26,6 +35,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CToolt
|
|
|
26
35
|
open: boolean;
|
|
27
36
|
distance: number | string;
|
|
28
37
|
position: CPlacement;
|
|
38
|
+
trigger: HTMLElement | string;
|
|
29
39
|
delay: number | string;
|
|
30
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
31
41
|
trigger?: (props: {}) => any;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popover chain controller (CONTEXT.md "Popover chain", ADR-0038).
|
|
3
|
+
*
|
|
4
|
+
* The ordered set of currently open `c-popover`s, each logically nested in
|
|
5
|
+
* the one before it. This module is the single owner of popover dismissal:
|
|
6
|
+
*
|
|
7
|
+
* - **Escape** peels the innermost popover only, one per press. The listener
|
|
8
|
+
* is capture-phase and calls `preventDefault()`, so an enclosing
|
|
9
|
+
* `c-modal`'s bubble-phase controller sees the claimed key and does not
|
|
10
|
+
* close itself (ADR-0014). Known pre-existing limitation: a `c-menu` open
|
|
11
|
+
* inside a popover listens on its own host (bubble), i.e. *after* this
|
|
12
|
+
* capture listener — that Escape closes both, exactly as it did when each
|
|
13
|
+
* popover owned its own capture listener.
|
|
14
|
+
* - **Pointerdown** closes every popover that does not *logically* contain
|
|
15
|
+
* the event: from the innermost down, everything above the deepest member
|
|
16
|
+
* whose own inside (host subtree, panel, designated trigger) contains the
|
|
17
|
+
* composed path is closed. Containment is logical, not DOM ancestry — a
|
|
18
|
+
* popover whose host lives elsewhere still shields its ancestors, because
|
|
19
|
+
* ancestry is recorded in the chain itself, not re-derived from the DOM.
|
|
20
|
+
* - **Opening** a popover whose trigger sits inside an open member joins the
|
|
21
|
+
* chain below it; one whose trigger is elsewhere replaces the chain.
|
|
22
|
+
* Siblings therefore never coexist.
|
|
23
|
+
* - **Closing** any member (Escape, light dismiss, `open` prop, unmount)
|
|
24
|
+
* closes its descendants — no orphaned floating panels.
|
|
25
|
+
*
|
|
26
|
+
* Why a shared module: each popover's Escape listener is capture-phase on
|
|
27
|
+
* `document`, and `preventDefault()` does not stop other listeners — two
|
|
28
|
+
* independent popovers cannot see each other's claim, so one press closed
|
|
29
|
+
* them all. Coordination needs a single owner, mirroring `modalStack.ts`.
|
|
30
|
+
*/
|
|
31
|
+
export interface PopoverChainEntry {
|
|
32
|
+
/** Close this popover with no focus return (light dismiss / chain cleanup). */
|
|
33
|
+
close(): void;
|
|
34
|
+
/** True when `node` is inside this popover's own logical inside. */
|
|
35
|
+
containsNode(node: Node): boolean;
|
|
36
|
+
/** True when a composed event path passes through this popover's own inside. */
|
|
37
|
+
containsPath(path: EventTarget[]): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The node that chains this popover under an open ancestor: its designated
|
|
40
|
+
* trigger, else its slotted trigger, else its host.
|
|
41
|
+
*/
|
|
42
|
+
getAnchorNode(): Node | null;
|
|
43
|
+
/** Escape routed here — this popover is the innermost. Decides focus return. */
|
|
44
|
+
onEscape(): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Shadow-piercing containment: like `Node.contains` but hopping from a shadow
|
|
48
|
+
* root to its host, so content inside a descendant component's shadow root
|
|
49
|
+
* (and slotted light DOM) counts as inside.
|
|
50
|
+
*/
|
|
51
|
+
export declare const composedContains: (ancestor: Node, node: Node | null) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Register an opening popover. Resolves its chain parent from where its
|
|
54
|
+
* anchor node sits; members that would become siblings are closed first.
|
|
55
|
+
* Idempotent.
|
|
56
|
+
*/
|
|
57
|
+
export declare const enterChain: (entry: PopoverChainEntry) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Unregister a closing popover (idempotent) and close its descendants —
|
|
60
|
+
* whatever closed it, nothing may stay floating above it.
|
|
61
|
+
*/
|
|
62
|
+
export declare const leaveChain: (entry: PopoverChainEntry) => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Designated trigger (CONTEXT.md "Trigger", ADR-0038): the `trigger` prop
|
|
3
|
+
* route of supplying an overlay component's trigger — an element elsewhere in
|
|
4
|
+
* the document, designated by ID or by reference, instead of projected into
|
|
5
|
+
* the `trigger` slot. The two routes are the same concept: the component
|
|
6
|
+
* wires its usual opening interaction and ARIA onto the designated element,
|
|
7
|
+
* exactly as it does for a slotted one.
|
|
8
|
+
*
|
|
9
|
+
* Positioning: CSS anchor names are tree-scoped, so the shadow-DOM panel
|
|
10
|
+
* cannot reference an `anchor-name` on an outer-tree element. Instead the
|
|
11
|
+
* component keeps a *proxy anchor* — an inert, fixed-position box in its own
|
|
12
|
+
* shadow root carrying the anchor name — and this composable pins it over
|
|
13
|
+
* the designated trigger's rect while the panel is open (a rAF loop, the
|
|
14
|
+
* same tracking strategy the OddBird polyfill uses). `position-area`
|
|
15
|
+
* placement and the `position-try-fallbacks` flip/shift keep working
|
|
16
|
+
* unchanged; only the measurement is JS.
|
|
17
|
+
*/
|
|
18
|
+
import { type Ref } from 'vue';
|
|
19
|
+
export interface DesignatedTriggerHandle {
|
|
20
|
+
/** The resolved designated trigger; null when the prop is unset/unresolved. */
|
|
21
|
+
element: Readonly<Ref<HTMLElement | null>>;
|
|
22
|
+
/** Re-resolve the prop (an ID may match only after later DOM insertion). */
|
|
23
|
+
resolve(): HTMLElement | null;
|
|
24
|
+
/** Pin the proxy over the trigger every frame until `stopTracking`. */
|
|
25
|
+
startTracking(): void;
|
|
26
|
+
stopTracking(): void;
|
|
27
|
+
}
|
|
28
|
+
export interface UseDesignatedTriggerOptions {
|
|
29
|
+
/** Tag name for console warnings (e.g. `c-popover`). */
|
|
30
|
+
componentName: string;
|
|
31
|
+
/** Interaction listeners kept installed on the designated element. */
|
|
32
|
+
listeners: Record<string, EventListener>;
|
|
33
|
+
/** Resolved element changed — mirror/clean ARIA here. */
|
|
34
|
+
onElementChange?: (el: HTMLElement | null, prev: HTMLElement | null) => void;
|
|
35
|
+
/** The in-shadow proxy anchor to pin over the designated trigger. */
|
|
36
|
+
proxy: Ref<HTMLElement | null>;
|
|
37
|
+
/** The raw `trigger` prop: a document ID or an element reference. */
|
|
38
|
+
source: () => HTMLElement | string | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const useDesignatedTrigger: (options: UseDesignatedTriggerOptions) => DesignatedTriggerHandle;
|