@cscfi/csc-ui 4.0.0-alpha.1 → 4.0.0-alpha.10
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 +7675 -6821
- package/dist/custom-elements.json +1036 -143
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-checkbox/usage.md +53 -0
- package/dist/docs/c-popover/usage.md +33 -0
- package/dist/docs/c-progress-bar/usage.md +23 -0
- package/dist/docs/c-progress-circle/usage.md +25 -0
- package/dist/docs/c-radio/usage.md +45 -0
- package/dist/docs/c-radio-group/usage.md +67 -0
- package/dist/docs/c-spinner/usage.md +21 -0
- package/dist/docs/c-switch/usage.md +36 -0
- package/dist/docs/c-table/usage.md +14 -0
- package/dist/docs/c-tooltip/usage.md +30 -0
- package/dist/styles/css/tailwind-theme.css +31 -0
- package/dist/styles/css/tokens.css +282 -201
- package/dist/vscode.css-custom-data.json +103 -14
- package/dist/vscode.html-custom-data.json +181 -25
- package/dist/web-types.json +524 -87
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +4 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- package/dist-types/components/c-icon/CIcon.vue.d.ts +1 -1
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +4 -0
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +4 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +13 -3
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +29 -3
- package/dist-types/components/c-popover/CPopover.vue.d.ts +43 -0
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
- package/dist-types/components/c-radio/CRadio.vue.d.ts +7 -11
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +8 -46
- package/dist-types/components/c-select/CSelect.vue.d.ts +4 -1
- package/dist-types/components/c-spinner/CSpinner.vue.d.ts +1 -1
- package/dist-types/components/c-table/CTable.vue.d.ts +11 -1
- package/dist-types/components/c-table/injectTableStyles.d.ts +1 -0
- package/dist-types/components/c-tag/CTag.vue.d.ts +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +4 -0
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
- package/dist-types/index.d.ts +9 -1
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- package/dist-types/shared/popoverChain.d.ts +62 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +40 -0
- package/dist-types/shared/useHostStates.d.ts +25 -0
- package/dist-types/tag-name-map.d.ts +193 -32
- package/dist-types/theme/chart-data.d.ts +50 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +13 -0
- package/dist-types/types.d.ts +13 -0
- package/package.json +8 -6
|
@@ -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,13 @@
|
|
|
1
|
+
import type { CPlacement } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* `CPlacement` → CSS `position-area`, shared by the anchor-positioned overlay
|
|
4
|
+
* components (`c-menu`, `c-tooltip`, `c-popover`; ADR-0008). Native flip/shift
|
|
5
|
+
* comes from each component's `position-try-fallbacks` escape-hatch rule.
|
|
6
|
+
*/
|
|
7
|
+
export declare const POSITION_AREA: Record<CPlacement, string>;
|
|
8
|
+
/**
|
|
9
|
+
* The logical axis of a placement's side — the axis the trigger→panel gap
|
|
10
|
+
* margin is applied on (both sides, so the gap survives the position-try
|
|
11
|
+
* flip fallbacks).
|
|
12
|
+
*/
|
|
13
|
+
export declare const placementAxis: (position: CPlacement) => "block" | "inline";
|
|
@@ -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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host custom-state exposure — the single path for publishing a component's
|
|
3
|
+
* internal state to consumer CSS as `:state(<name>)` selectors (ADR-0035).
|
|
4
|
+
*
|
|
5
|
+
* Selection controls keep their live state (checked, indeterminate, …) on a
|
|
6
|
+
* hidden `<input>` inside the shadow root, where no consumer selector can see
|
|
7
|
+
* it. `ElementInternals.states` republishes it on the host, so a consumer can
|
|
8
|
+
* write per-state `::part()` rules:
|
|
9
|
+
*
|
|
10
|
+
* c-checkbox:state(checked)::part(indicator) { background: green; }
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
*
|
|
14
|
+
* const setState = useHostStates();
|
|
15
|
+
* watch(isChecked, (on) => setState('checked', on), { immediate: true });
|
|
16
|
+
*
|
|
17
|
+
* Each exposed state name is public API — curated like parts, documented with
|
|
18
|
+
* a `@cssstate` docblock tag so it lands in the manifest.
|
|
19
|
+
*
|
|
20
|
+
* `attachInternals()` may be called only once per element; this composable
|
|
21
|
+
* owns that call. Everything degrades to a silent no-op where internals or
|
|
22
|
+
* `states` are unavailable (SSR, tests, an ancient browser) — the component
|
|
23
|
+
* still renders and behaves, only the `:state()` selector surface is absent.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useHostStates: () => ((name: string, on: boolean) => void);
|
|
@@ -21,11 +21,6 @@ type DropdownItem = {
|
|
|
21
21
|
selected?: boolean;
|
|
22
22
|
value: number | string;
|
|
23
23
|
};
|
|
24
|
-
interface RadioItem {
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
name: string;
|
|
27
|
-
value: number | string;
|
|
28
|
-
}
|
|
29
24
|
/** Events dispatched by `<c-accordion>`. */
|
|
30
25
|
export interface CAccordionElementEventMap {
|
|
31
26
|
/**
|
|
@@ -92,9 +87,32 @@ export interface CAccordionItemElement extends Omit<HTMLElement, 'collapsable' |
|
|
|
92
87
|
removeEventListener<K extends keyof CAccordionItemElementEventMap>(type: K, listener: (this: CAccordionItemElement, ev: CAccordionItemElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
93
88
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
94
89
|
}
|
|
95
|
-
|
|
90
|
+
/** Events dispatched by `<c-alert>`. */
|
|
91
|
+
export interface CAlertElementEventMap {
|
|
92
|
+
/**
|
|
93
|
+
* Fired when the dismiss button is pressed. The alert does not hide
|
|
94
|
+
* itself — the consumer owns removal.
|
|
95
|
+
*/
|
|
96
|
+
dismiss: CustomEvent<void>;
|
|
97
|
+
}
|
|
98
|
+
/** A persistent, in-flow status message: a tinted box whose type carries a status family's colours through the icon, heading and accent edge, while the body copy stays neutral. */
|
|
99
|
+
export interface CAlertElement extends Omit<HTMLElement, 'dismissible' | 'heading' | 'type'> {
|
|
100
|
+
/**
|
|
101
|
+
* Show a dismiss button. The alert only emits `dismiss` — removing it from
|
|
102
|
+
* the page stays the consumer's job.
|
|
103
|
+
*/
|
|
104
|
+
dismissible?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Heading rendered above the message. The `heading` slot overrides it for
|
|
107
|
+
* rich content.
|
|
108
|
+
*/
|
|
109
|
+
heading?: string;
|
|
96
110
|
/** Type of the alert */
|
|
97
111
|
type?: 'default' | 'error' | 'info' | 'success' | 'warning';
|
|
112
|
+
addEventListener<K extends keyof CAlertElementEventMap>(type: K, listener: (this: CAlertElement, ev: CAlertElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
113
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
114
|
+
removeEventListener<K extends keyof CAlertElementEventMap>(type: K, listener: (this: CAlertElement, ev: CAlertElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
115
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
98
116
|
}
|
|
99
117
|
/** Events dispatched by `<c-autocomplete>`. */
|
|
100
118
|
export interface CAutocompleteElementEventMap {
|
|
@@ -130,7 +148,7 @@ export interface CAutocompleteElementEventMap {
|
|
|
130
148
|
'update:value': CustomEvent<CAutocompleteItem | null | number | string>;
|
|
131
149
|
}
|
|
132
150
|
/** A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options. */
|
|
133
|
-
export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'name' | 'noResultsText' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'valid' | 'value'> {
|
|
151
|
+
export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'name' | 'noResultsText' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'valid' | 'value'> {
|
|
134
152
|
/** Make the selected value clearable */
|
|
135
153
|
clearable?: boolean;
|
|
136
154
|
/** Disable the input */
|
|
@@ -173,6 +191,8 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
|
|
|
173
191
|
returnObject?: boolean;
|
|
174
192
|
/** Shadow variant */
|
|
175
193
|
shadow?: boolean;
|
|
194
|
+
/** Field height: the 44px default or the 36px `small` box */
|
|
195
|
+
size?: 'default' | 'small';
|
|
176
196
|
/** Set the validity of the input */
|
|
177
197
|
valid?: boolean;
|
|
178
198
|
/** Selected value (scalar, or object when return-object is set) */
|
|
@@ -323,6 +343,7 @@ export interface CCheckboxElementEventMap {
|
|
|
323
343
|
*/
|
|
324
344
|
'update:value': CustomEvent<boolean | number | string>;
|
|
325
345
|
}
|
|
346
|
+
/** A form control for a single on/off choice: a native checkbox with a label, an optional hint, and validation messaging. */
|
|
326
347
|
export interface CCheckboxElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'errorMessage' | 'falseValue' | 'hideDetails' | 'hint' | 'hostId' | 'hostName' | 'indeterminate' | 'label' | 'required' | 'trueValue' | 'valid' | 'value'> {
|
|
327
348
|
/** If `true`, the checkbox is selected. */
|
|
328
349
|
checked?: boolean;
|
|
@@ -534,7 +555,7 @@ export interface CIconButtonElement extends Omit<HTMLElement, 'badge' | 'danger'
|
|
|
534
555
|
/** Text variant of the button */
|
|
535
556
|
text?: boolean;
|
|
536
557
|
}
|
|
537
|
-
export interface CInputElement extends Omit<HTMLElement, 'active' | 'disabled' | 'errorMessage' | 'filled' | 'hideDetails' | 'hint' | 'inputId' | 'isTextarea' | 'label' | 'labelOnTop' | 'required' | 'shadow' | 'valid'> {
|
|
558
|
+
export interface CInputElement extends Omit<HTMLElement, 'active' | 'disabled' | 'errorMessage' | 'filled' | 'hideDetails' | 'hint' | 'inputId' | 'isTextarea' | 'label' | 'labelOnTop' | 'required' | 'shadow' | 'size' | 'valid'> {
|
|
538
559
|
/** Set by the wrapping form component when its input has focus or holds a value. */
|
|
539
560
|
active?: boolean;
|
|
540
561
|
/** Disable the input */
|
|
@@ -559,6 +580,8 @@ export interface CInputElement extends Omit<HTMLElement, 'active' | 'disabled' |
|
|
|
559
580
|
required?: boolean;
|
|
560
581
|
/** Shadow variant of the input */
|
|
561
582
|
shadow?: boolean;
|
|
583
|
+
/** Field height: the 44px default or the 36px `small` box */
|
|
584
|
+
size?: 'default' | 'small';
|
|
562
585
|
/** Set the validíty of the input */
|
|
563
586
|
valid?: boolean;
|
|
564
587
|
}
|
|
@@ -680,24 +703,50 @@ export interface CMenuElementEventMap {
|
|
|
680
703
|
value: unknown;
|
|
681
704
|
}>;
|
|
682
705
|
}
|
|
683
|
-
export interface CMenuElement extends Omit<HTMLElement, 'distance' | 'open' | 'position'> {
|
|
706
|
+
export interface CMenuElement extends Omit<HTMLElement, 'distance' | 'open' | 'position' | 'trigger'> {
|
|
684
707
|
/** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
|
|
685
708
|
distance?: number | string;
|
|
686
709
|
/** Whether the menu is open. Two-way: emits `change:open`. */
|
|
687
710
|
open?: boolean;
|
|
688
711
|
/** Preferred placement of the panel relative to the trigger. */
|
|
689
712
|
position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
713
|
+
/**
|
|
714
|
+
* Designated trigger: an element elsewhere in the document that opens the
|
|
715
|
+
* menu — its document ID, or the element itself. The same trigger concept
|
|
716
|
+
* as the `trigger` slot, supplied by reference: the menu wires
|
|
717
|
+
* click-to-toggle, arrow-key opening, ARIA and focus return onto it and
|
|
718
|
+
* anchors the panel to it. When both routes are supplied, this prop wins
|
|
719
|
+
* over the slot.
|
|
720
|
+
*/
|
|
721
|
+
trigger?: HTMLElement | string;
|
|
690
722
|
addEventListener<K extends keyof CMenuElementEventMap>(type: K, listener: (this: CMenuElement, ev: CMenuElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
691
723
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
692
724
|
removeEventListener<K extends keyof CMenuElementEventMap>(type: K, listener: (this: CMenuElement, ev: CMenuElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
693
725
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
694
726
|
}
|
|
695
727
|
/** A single command in a `c-menu`. */
|
|
696
|
-
export interface CMenuItemElement extends Omit<HTMLElement, 'danger' | 'disabled' | 'value'> {
|
|
728
|
+
export interface CMenuItemElement extends Omit<HTMLElement, 'active' | 'activeIcon' | 'danger' | 'disabled' | 'icon' | 'value'> {
|
|
729
|
+
/**
|
|
730
|
+
* Marks the item as the currently selected choice: renders the trailing
|
|
731
|
+
* indicator icon and stamps `role="menuitemradio"` + `aria-checked`. Leave
|
|
732
|
+
* unset for regular command items — only a true/false value marks the item
|
|
733
|
+
* as a selectable choice. The state is consumer-owned: the menu emits
|
|
734
|
+
* `select` as usual and never toggles this itself. Distinct from the
|
|
735
|
+
* keyboard highlight (the `data-active` attribute the controlling menu
|
|
736
|
+
* moves between rows).
|
|
737
|
+
*/
|
|
738
|
+
active?: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* SVG path for the trailing indicator shown while `active`; defaults to a
|
|
741
|
+
* check mark.
|
|
742
|
+
*/
|
|
743
|
+
activeIcon?: string;
|
|
697
744
|
/** Marks the action as destructive (renders in the error colour). */
|
|
698
745
|
danger?: boolean;
|
|
699
746
|
/** Disables the item — it is skipped by keyboard nav and emits no select. */
|
|
700
747
|
disabled?: boolean;
|
|
748
|
+
/** SVG path for a leading icon rendered before the item's content. */
|
|
749
|
+
icon?: string;
|
|
701
750
|
/** Value reported in the menu's `select` event when this item is chosen. */
|
|
702
751
|
value?: string;
|
|
703
752
|
closeSubmenu(): void;
|
|
@@ -859,6 +908,45 @@ export interface CPaginationElement extends Omit<HTMLElement, 'hideDetails' | 'h
|
|
|
859
908
|
removeEventListener<K extends keyof CPaginationElementEventMap>(type: K, listener: (this: CPaginationElement, ev: CPaginationElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
860
909
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
861
910
|
}
|
|
911
|
+
/** Events dispatched by `<c-popover>`. */
|
|
912
|
+
export interface CPopoverElementEventMap {
|
|
913
|
+
/**
|
|
914
|
+
* Fired whenever the popover opens or closes, carrying the new open state.
|
|
915
|
+
* Named `change:open`, not `update:open`: Vue's runtime silently drops
|
|
916
|
+
* `onUpdate:*` listeners on custom elements (`isModelListener`), so a
|
|
917
|
+
* template `@update:open` would never be attached.
|
|
918
|
+
*/
|
|
919
|
+
'change:open': CustomEvent<boolean>;
|
|
920
|
+
}
|
|
921
|
+
/** A click-opened, non-modal surface anchored to its trigger, floating in the top layer; its content may be interactive. */
|
|
922
|
+
export interface CPopoverElement extends Omit<HTMLElement, 'distance' | 'heading' | 'open' | 'position' | 'trigger'> {
|
|
923
|
+
/** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
|
|
924
|
+
distance?: number | string;
|
|
925
|
+
/**
|
|
926
|
+
* Heading rendered at the top of the panel, doubling as its accessible
|
|
927
|
+
* name. Without it, set `aria-label` on the host. Named `heading`, not
|
|
928
|
+
* `title`: a `title` attribute on the host would trigger the browser's
|
|
929
|
+
* native tooltip and collides with `HTMLElement.title`.
|
|
930
|
+
*/
|
|
931
|
+
heading?: string;
|
|
932
|
+
/** Whether the popover is open. Two-way: emits `change:open`. */
|
|
933
|
+
open?: boolean;
|
|
934
|
+
/** Preferred placement of the panel relative to the trigger. */
|
|
935
|
+
position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
936
|
+
/**
|
|
937
|
+
* Designated trigger: an element elsewhere in the document that opens the
|
|
938
|
+
* popover — its document ID, or the element itself. The same trigger
|
|
939
|
+
* concept as the `trigger` slot, supplied by reference: the popover wires
|
|
940
|
+
* click-to-toggle, ARIA and focus return onto it and anchors the panel to
|
|
941
|
+
* it. When both routes are supplied, this prop wins over the slot.
|
|
942
|
+
*/
|
|
943
|
+
trigger?: HTMLElement | string;
|
|
944
|
+
addEventListener<K extends keyof CPopoverElementEventMap>(type: K, listener: (this: CPopoverElement, ev: CPopoverElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
945
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
946
|
+
removeEventListener<K extends keyof CPopoverElementEventMap>(type: K, listener: (this: CPopoverElement, ev: CPopoverElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
947
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
948
|
+
}
|
|
949
|
+
/** A horizontal progress bar that fills a track to a known completion percentage, with an optional details line showing the value and a label. */
|
|
862
950
|
export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | 'indeterminate' | 'label' | 'singleLine' | 'value'> {
|
|
863
951
|
/** Hide the percentage display */
|
|
864
952
|
hideDetails?: boolean;
|
|
@@ -871,33 +959,56 @@ export interface CProgressBarElement extends Omit<HTMLElement, 'hideDetails' | '
|
|
|
871
959
|
/** Progress bar value in percentage (0 to 100) */
|
|
872
960
|
value?: number;
|
|
873
961
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
962
|
+
/** A circular progress indicator that draws a known completion percentage as an arc around a track — the circular counterpart of `c-progress-bar`. */
|
|
963
|
+
export interface CProgressCircleElement extends Omit<HTMLElement, 'size' | 'value' | 'width'> {
|
|
964
|
+
/** Diameter of the circle in pixels */
|
|
965
|
+
size?: number;
|
|
966
|
+
/** Progress value in percentage (0 to 100) */
|
|
967
|
+
value?: number;
|
|
968
|
+
/**
|
|
969
|
+
* Stroke width of the track in pixels; the value arc draws at half this
|
|
970
|
+
* width, inset within the track
|
|
971
|
+
*/
|
|
972
|
+
width?: number;
|
|
973
|
+
}
|
|
974
|
+
/** Events dispatched by `<c-radio>`. */
|
|
975
|
+
export interface CRadioElementEventMap {
|
|
976
|
+
/**
|
|
977
|
+
* Fired when the radio is selected by the user, carrying its `value`.
|
|
978
|
+
* Bubbles composed so the parent `<c-radio-group>` — whose shadow root a
|
|
979
|
+
* light-DOM event never enters — catches it on its host; a consumer
|
|
980
|
+
* listening on the group hears it too, with the radio as `target`.
|
|
981
|
+
*/
|
|
982
|
+
change: CustomEvent<string>;
|
|
983
|
+
}
|
|
984
|
+
/** A single radio option inside a `c-radio-group`: a native radio input whose default slot is its clickable, announced label. */
|
|
985
|
+
export interface CRadioElement extends Omit<HTMLElement, 'disabled' | 'value'> {
|
|
877
986
|
/** Disable the radio button */
|
|
878
987
|
disabled?: boolean;
|
|
879
988
|
/** Radio button value */
|
|
880
989
|
value?: string;
|
|
990
|
+
addEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
991
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
992
|
+
removeEventListener<K extends keyof CRadioElementEventMap>(type: K, listener: (this: CRadioElement, ev: CRadioElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
993
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
881
994
|
}
|
|
882
995
|
/** Events dispatched by `<c-radio-group>`. */
|
|
883
996
|
export interface CRadioGroupElementEventMap {
|
|
884
|
-
/**
|
|
885
|
-
|
|
886
|
-
* value — or the whole item object when `return-object` is set.
|
|
887
|
-
*/
|
|
888
|
-
changeValue: CustomEvent<number | RadioItem | string>;
|
|
997
|
+
/** Fired when a radio is selected, carrying the selected radio's value. */
|
|
998
|
+
changeValue: CustomEvent<string>;
|
|
889
999
|
/**
|
|
890
1000
|
* Native bubbling input event fired on selection so a plain Vue `v-model`
|
|
891
1001
|
* works without the `v-control` directive. No detail.
|
|
892
1002
|
*/
|
|
893
1003
|
input: CustomEvent<void>;
|
|
894
1004
|
/**
|
|
895
|
-
* v-model contract event fired on selection, carrying the selected
|
|
896
|
-
* value
|
|
1005
|
+
* v-model contract event fired on selection, carrying the selected radio's
|
|
1006
|
+
* value.
|
|
897
1007
|
*/
|
|
898
|
-
'update:value': CustomEvent<
|
|
1008
|
+
'update:value': CustomEvent<string>;
|
|
899
1009
|
}
|
|
900
|
-
|
|
1010
|
+
/** A radio group is a set of mutually exclusive choices where exactly one can be selected, authored as slotted `c-radio` children. Give the group a `label` so the choice it represents is named for every user, and a `hint` describing how to answer. */
|
|
1011
|
+
export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'inline' | 'label' | 'required' | 'valid' | 'value'> {
|
|
901
1012
|
/** Disable the radio group */
|
|
902
1013
|
disabled?: boolean;
|
|
903
1014
|
/** Error message shown in place of the hint while the group is invalid */
|
|
@@ -906,22 +1017,19 @@ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'erro
|
|
|
906
1017
|
hideDetails?: boolean;
|
|
907
1018
|
/** Hint text for the input */
|
|
908
1019
|
hint?: string;
|
|
909
|
-
/** Id of the element */
|
|
910
|
-
hostId?: string;
|
|
911
1020
|
/** Display radio buttons inline */
|
|
912
1021
|
inline?: boolean;
|
|
913
|
-
/** Radio group items */
|
|
914
|
-
items?: RadioItem[];
|
|
915
1022
|
/** Label of the radio group */
|
|
916
1023
|
label?: string;
|
|
917
1024
|
/** Set as required */
|
|
918
1025
|
required?: boolean;
|
|
919
|
-
/** Return the whole item object */
|
|
920
|
-
returnObject?: boolean;
|
|
921
1026
|
/** Set the validity of the input */
|
|
922
1027
|
valid?: boolean;
|
|
923
|
-
/**
|
|
924
|
-
|
|
1028
|
+
/**
|
|
1029
|
+
* Value of the radio group; matched against each radio's `value` by strict
|
|
1030
|
+
* string equality
|
|
1031
|
+
*/
|
|
1032
|
+
value?: null | string;
|
|
925
1033
|
addEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
926
1034
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
927
1035
|
removeEventListener<K extends keyof CRadioGroupElementEventMap>(type: K, listener: (this: CRadioGroupElement, ev: CRadioGroupElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
@@ -946,7 +1054,7 @@ export interface CSelectElementEventMap {
|
|
|
946
1054
|
*/
|
|
947
1055
|
'update:value': CustomEvent<CSelectItem | null | number | string>;
|
|
948
1056
|
}
|
|
949
|
-
export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'valid' | 'value'> {
|
|
1057
|
+
export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'valid' | 'value'> {
|
|
950
1058
|
/** Make the selected value clearable */
|
|
951
1059
|
clearable?: boolean;
|
|
952
1060
|
/** Disable the input */
|
|
@@ -981,6 +1089,8 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
981
1089
|
returnObject?: boolean;
|
|
982
1090
|
/** Shadow variant */
|
|
983
1091
|
shadow?: boolean;
|
|
1092
|
+
/** Field height: the 44px default or the 36px `small` box */
|
|
1093
|
+
size?: 'default' | 'small';
|
|
984
1094
|
/** Set the validity of the input */
|
|
985
1095
|
valid?: boolean;
|
|
986
1096
|
/** Selected value (scalar, or object when return-object is set) */
|
|
@@ -1096,6 +1206,7 @@ export interface CSliderElement extends Omit<HTMLElement, 'ariaLabelInternal' |
|
|
|
1096
1206
|
removeEventListener<K extends keyof CSliderElementEventMap>(type: K, listener: (this: CSliderElement, ev: CSliderElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1097
1207
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1098
1208
|
}
|
|
1209
|
+
/** A circular indeterminate activity indicator — pure motion with no value, for waits of unknown duration. */
|
|
1099
1210
|
export interface CSpinnerElement extends Omit<HTMLElement, 'color' | 'size' | 'width'> {
|
|
1100
1211
|
/** Color of the spinner */
|
|
1101
1212
|
color?: string;
|
|
@@ -1154,6 +1265,7 @@ export interface CSwitchElementEventMap {
|
|
|
1154
1265
|
*/
|
|
1155
1266
|
'update:value': CustomEvent<boolean | number | string>;
|
|
1156
1267
|
}
|
|
1268
|
+
/** A toggle for a binary setting that takes effect immediately: a native switch control with a label, an optional hint, and validation messaging. */
|
|
1157
1269
|
export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'falseValue' | 'hostId' | 'label' | 'loading' | 'required' | 'trueValue' | 'value'> {
|
|
1158
1270
|
/** If `true`, the checkbox is selected. */
|
|
1159
1271
|
checked?: boolean;
|
|
@@ -1271,6 +1383,7 @@ export interface CTabItemsElement extends Omit<HTMLElement, 'disableAnimation' |
|
|
|
1271
1383
|
/** Currently active tab */
|
|
1272
1384
|
value?: number | string;
|
|
1273
1385
|
}
|
|
1386
|
+
/** A styled wrapper for a table you author yourself: slot in a plain `<table>` and c-table gives it the CSC look plus an optional responsive card layout on narrow screens. The table stays in your own DOM — your stylesheets, your framework's rendering, and `::part()` selectors on components nested in cells (a `c-tag` status chip, a `c-pagination` footer) all keep working. */
|
|
1274
1387
|
export interface CTableElement extends Omit<HTMLElement, 'mobileBreakpoint' | 'responsive'> {
|
|
1275
1388
|
/** Mobile breakpoint in pixels */
|
|
1276
1389
|
mobileBreakpoint?: number;
|
|
@@ -1367,7 +1480,7 @@ export interface CTextFieldElementEventMap {
|
|
|
1367
1480
|
*/
|
|
1368
1481
|
'update:value': CustomEvent<string>;
|
|
1369
1482
|
}
|
|
1370
|
-
export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'autocorrect' | 'automaticCapitalize' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'rows' | 'shadow' | 'step' | 'trimWhitespace' | 'type' | 'valid' | 'value'> {
|
|
1483
|
+
export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'autocorrect' | 'automaticCapitalize' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'rows' | 'shadow' | 'size' | 'step' | 'trimWhitespace' | 'type' | 'valid' | 'value'> {
|
|
1371
1484
|
/** HTML input autocomplete */
|
|
1372
1485
|
autocomplete?: string;
|
|
1373
1486
|
/**
|
|
@@ -1409,6 +1522,8 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'a
|
|
|
1409
1522
|
rows?: number;
|
|
1410
1523
|
/** Shadow variant of the input */
|
|
1411
1524
|
shadow?: boolean;
|
|
1525
|
+
/** Field height: the 44px default or the 36px `small` box (single-line fields) */
|
|
1526
|
+
size?: 'default' | 'small';
|
|
1412
1527
|
/** Step size on a numeric input */
|
|
1413
1528
|
step?: null | number;
|
|
1414
1529
|
/** Trim whitespace from the return value */
|
|
@@ -1458,6 +1573,49 @@ export interface CToastsElement extends Omit<HTMLElement, 'absolute' | 'horizont
|
|
|
1458
1573
|
}
|
|
1459
1574
|
export interface CToolbarElement extends HTMLElement {
|
|
1460
1575
|
}
|
|
1576
|
+
/** Events dispatched by `<c-tooltip>`. */
|
|
1577
|
+
export interface CTooltipElementEventMap {
|
|
1578
|
+
/**
|
|
1579
|
+
* Fired whenever the tooltip shows or hides, carrying the new open state.
|
|
1580
|
+
* Named `change:open`, not `update:open`: Vue's runtime silently drops
|
|
1581
|
+
* `onUpdate:*` listeners on custom elements (`isModelListener`), so a
|
|
1582
|
+
* template `@update:open` would never be attached.
|
|
1583
|
+
*/
|
|
1584
|
+
'change:open': CustomEvent<boolean>;
|
|
1585
|
+
}
|
|
1586
|
+
/** A non-interactive text hint shown when its trigger is hovered or keyboard-focused, floating in the top layer on the inverted surface tier. */
|
|
1587
|
+
export interface CTooltipElement extends Omit<HTMLElement, 'delay' | 'distance' | 'open' | 'position' | 'text' | 'trigger'> {
|
|
1588
|
+
/**
|
|
1589
|
+
* Delay before the tooltip shows on hover, in milliseconds. Keyboard focus
|
|
1590
|
+
* shows the tooltip immediately, regardless of this value. Defaults to
|
|
1591
|
+
* `400`.
|
|
1592
|
+
*/
|
|
1593
|
+
delay?: number | string;
|
|
1594
|
+
/** Distance from the trigger to the tooltip, in pixels. Defaults to `4`. */
|
|
1595
|
+
distance?: number | string;
|
|
1596
|
+
/** Whether the tooltip is open. Two-way: emits `change:open`. */
|
|
1597
|
+
open?: boolean;
|
|
1598
|
+
/** Preferred placement of the tooltip relative to the trigger. */
|
|
1599
|
+
position?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
1600
|
+
/**
|
|
1601
|
+
* The tooltip text. Overridden by the `content` slot when that is
|
|
1602
|
+
* populated.
|
|
1603
|
+
*/
|
|
1604
|
+
text?: string;
|
|
1605
|
+
/**
|
|
1606
|
+
* Designated trigger: an element elsewhere in the document that the
|
|
1607
|
+
* tooltip describes — its document ID, or the element itself. The same
|
|
1608
|
+
* trigger concept as the `trigger` slot, supplied by reference: the
|
|
1609
|
+
* tooltip wires hover/focus, mirrors `aria-description` onto it and
|
|
1610
|
+
* anchors the bubble to it. When both routes are supplied, this prop wins
|
|
1611
|
+
* over the slot.
|
|
1612
|
+
*/
|
|
1613
|
+
trigger?: HTMLElement | string;
|
|
1614
|
+
addEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1615
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1616
|
+
removeEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1617
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1618
|
+
}
|
|
1461
1619
|
declare global {
|
|
1462
1620
|
interface HTMLElementTagNameMap {
|
|
1463
1621
|
'c-accordion': CAccordionElement;
|
|
@@ -1502,7 +1660,9 @@ declare global {
|
|
|
1502
1660
|
'c-otp-input': COtpInputElement;
|
|
1503
1661
|
'c-page': CPageElement;
|
|
1504
1662
|
'c-pagination': CPaginationElement;
|
|
1663
|
+
'c-popover': CPopoverElement;
|
|
1505
1664
|
'c-progress-bar': CProgressBarElement;
|
|
1665
|
+
'c-progress-circle': CProgressCircleElement;
|
|
1506
1666
|
'c-radio': CRadioElement;
|
|
1507
1667
|
'c-radio-group': CRadioGroupElement;
|
|
1508
1668
|
'c-select': CSelectElement;
|
|
@@ -1528,6 +1688,7 @@ declare global {
|
|
|
1528
1688
|
'c-toast': CToastElement;
|
|
1529
1689
|
'c-toasts': CToastsElement;
|
|
1530
1690
|
'c-toolbar': CToolbarElement;
|
|
1691
|
+
'c-tooltip': CTooltipElement;
|
|
1531
1692
|
}
|
|
1532
1693
|
}
|
|
1533
1694
|
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/generate-chart-data.mjs from
|
|
3
|
+
* tokens/semantic/{light,dark}.json — do not edit.
|
|
4
|
+
* Regenerate with `pnpm run chart:generate`; `pnpm run lint:chart` fails
|
|
5
|
+
* the build when this file is stale.
|
|
6
|
+
*
|
|
7
|
+
* The chart tokens (ADR-0030) as importable data (ADR-0040): the twelve
|
|
8
|
+
* series slots and the chart anatomy roles per theme mode. Values are the
|
|
9
|
+
* frozen, validated set — they never follow a consumer's `--c-chart-*`
|
|
10
|
+
* overrides. Pair with `themeMode()` to pick the mode on screen.
|
|
11
|
+
*/
|
|
12
|
+
import type { ThemeMode } from './themeMode';
|
|
13
|
+
/** The twelve series slots in slot order (`chart-1` … `chart-12`). */
|
|
14
|
+
export type ChartSlots = readonly [
|
|
15
|
+
string,
|
|
16
|
+
string,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string,
|
|
21
|
+
string,
|
|
22
|
+
string,
|
|
23
|
+
string,
|
|
24
|
+
string,
|
|
25
|
+
string,
|
|
26
|
+
string
|
|
27
|
+
];
|
|
28
|
+
/** The chart anatomy roles: plot background, gridlines/axes, tick labels. */
|
|
29
|
+
export interface ChartAnatomy {
|
|
30
|
+
readonly surface: string;
|
|
31
|
+
readonly grid: string;
|
|
32
|
+
readonly axis: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Series slots per theme mode as `oklch(L C H)` strings — the palette's own
|
|
36
|
+
* colour space, ready for CSS, SVG and canvas `fillStyle`, and the exact
|
|
37
|
+
* string the `--c-chart-*` variable holds (ADR-0041). Each round-trips to
|
|
38
|
+
* the `#rrggbb` in `chartSlotsHex`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const chartSlots: Readonly<Record<ThemeMode, ChartSlots>>;
|
|
41
|
+
/**
|
|
42
|
+
* Series slots per theme mode as `#rrggbb` — for chart libraries that do
|
|
43
|
+
* their own colour maths in sRGB (ECharts, Chart.js) and cannot parse
|
|
44
|
+
* `oklch()`. Same colours and order as `chartSlots`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const chartSlotsHex: Readonly<Record<ThemeMode, ChartSlots>>;
|
|
47
|
+
/** Chart anatomy roles per theme mode as `oklch(L C H)` strings. */
|
|
48
|
+
export declare const chartAnatomy: Readonly<Record<ThemeMode, ChartAnatomy>>;
|
|
49
|
+
/** Chart anatomy roles per theme mode as `#rrggbb`. */
|
|
50
|
+
export declare const chartAnatomyHex: Readonly<Record<ThemeMode, ChartAnatomy>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Type surface for the plain-JS shared ramp core (ramp.js). Authored by hand
|
|
2
|
+
// because the core is JS (so the Node build script can import it without a TS
|
|
3
|
+
// loader) while consumers and the runtime API need types.
|
|
4
|
+
|
|
5
|
+
/** One of the chromatic brand/status families a consumer may re-seed. */
|
|
6
|
+
export type Family =
|
|
7
|
+
| 'primary'
|
|
8
|
+
| 'secondary'
|
|
9
|
+
| 'accent'
|
|
10
|
+
| 'success'
|
|
11
|
+
| 'info'
|
|
12
|
+
| 'warning'
|
|
13
|
+
| 'error'
|
|
14
|
+
| 'link';
|
|
15
|
+
|
|
16
|
+
/** Built-in brand seed (step-500) per family. */
|
|
17
|
+
export declare const DEFAULT_SEEDS: Record<Family, string>;
|
|
18
|
+
|
|
19
|
+
/** The chromatic families, in canonical order. */
|
|
20
|
+
export declare const FAMILIES: readonly Family[];
|
|
21
|
+
|
|
22
|
+
/** Ramp steps, in ascending order (`[50, 100, …, 950]`). */
|
|
23
|
+
export declare const STEPS: readonly number[];
|
|
24
|
+
|
|
25
|
+
/** Generate a full 50–950 ramp from a single step-500 seed. */
|
|
26
|
+
export declare function ramp(seedHex: string): Record<string, string>;
|
|
27
|
+
|
|
28
|
+
/** The `--c-<family>-*` custom-property map (steps + `-rgb`) for one seed. */
|
|
29
|
+
export declare function familyVars(
|
|
30
|
+
family: Family,
|
|
31
|
+
seedHex: string,
|
|
32
|
+
): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The CSS value the library emits for a colour: a hex becomes `oklch(L C H)`
|
|
36
|
+
* at a precision that round-trips exactly; non-hex values pass through.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cssColor(value: string): string;
|