@cscfi/csc-ui 4.0.0-alpha.9 → 4.0.0-rc.2
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/README.md +36 -2
- package/dist/csc-ui.js +22771 -14908
- package/dist/custom-elements.json +8943 -5632
- package/dist/docs/c-accordion/usage.md +60 -0
- package/dist/docs/c-accordion-item/usage.md +1 -0
- package/dist/docs/c-alert/usage.md +5 -5
- package/dist/docs/c-autocomplete/usage.md +156 -0
- package/dist/docs/c-badge/usage.md +50 -0
- package/dist/docs/c-breadcrumb/usage.md +104 -0
- package/dist/docs/c-breadcrumb-item/usage.md +1 -0
- package/dist/docs/c-button/usage.md +13 -0
- package/dist/docs/c-button-group/usage.md +16 -2
- package/dist/docs/c-card/usage.md +55 -0
- package/dist/docs/c-card-actions/usage.md +1 -0
- package/dist/docs/c-card-content/usage.md +1 -0
- package/dist/docs/c-card-title/usage.md +3 -0
- package/dist/docs/c-checkbox/usage.md +37 -5
- package/dist/docs/c-color-picker/usage.md +160 -0
- package/dist/docs/c-csc-logo/usage.md +25 -0
- package/dist/docs/c-data-table/usage.md +180 -0
- package/dist/docs/c-date-picker/usage.md +224 -0
- package/dist/docs/c-divider/usage.md +36 -0
- package/dist/docs/c-file-upload/usage.md +189 -0
- package/dist/docs/c-icon/usage.md +51 -0
- package/dist/docs/c-icon-button/usage.md +80 -0
- package/dist/docs/c-link/usage.md +45 -1
- package/dist/docs/c-list/usage.md +50 -0
- package/dist/docs/c-list-item/usage.md +1 -0
- package/dist/docs/c-list-item-title/usage.md +1 -0
- package/dist/docs/c-loader/usage.md +52 -1
- package/dist/docs/c-login-button/usage.md +1 -0
- package/dist/docs/c-login-buttons/usage.md +48 -0
- package/dist/docs/c-login-card/usage.md +45 -0
- package/dist/docs/c-login-card-actions/usage.md +1 -0
- package/dist/docs/c-login-card-content/usage.md +1 -0
- package/dist/docs/c-login-card-title/usage.md +3 -0
- package/dist/docs/c-main/usage.md +21 -1
- package/dist/docs/c-menu/usage.md +15 -0
- package/dist/docs/c-menu-item/usage.md +11 -0
- package/dist/docs/c-message/usage.md +56 -0
- package/dist/docs/c-modal/usage.md +18 -12
- package/dist/docs/c-navigation-button/usage.md +32 -0
- package/dist/docs/c-number-field/usage.md +114 -0
- package/dist/docs/c-option/usage.md +1 -0
- package/dist/docs/c-option-value/usage.md +1 -0
- package/dist/docs/c-otp-input/usage.md +95 -0
- package/dist/docs/c-page/usage.md +44 -0
- package/dist/docs/c-pagination/usage.md +69 -0
- package/dist/docs/c-popover/usage.md +1 -1
- package/dist/docs/c-progress-bar/usage.md +1 -1
- package/dist/docs/c-progress-circle/usage.md +1 -1
- package/dist/docs/c-radio/usage.md +9 -6
- package/dist/docs/c-radio-group/usage.md +5 -6
- package/dist/docs/c-select/usage.md +131 -0
- package/dist/docs/c-side-navigation/usage.md +70 -0
- package/dist/docs/c-side-navigation-item/usage.md +1 -0
- package/dist/docs/c-side-navigation-title/usage.md +1 -0
- package/dist/docs/c-slider/usage.md +78 -0
- package/dist/docs/c-spinner/usage.md +1 -1
- package/dist/docs/c-status/usage.md +46 -0
- package/dist/docs/c-step/usage.md +1 -0
- package/dist/docs/c-steps/usage.md +35 -0
- package/dist/docs/c-sub-navigation-item/usage.md +1 -0
- package/dist/docs/c-switch/usage.md +10 -3
- package/dist/docs/c-tab/usage.md +1 -0
- package/dist/docs/c-tab-buttons/usage.md +15 -0
- package/dist/docs/c-tab-item/usage.md +1 -0
- package/dist/docs/c-tab-items/usage.md +1 -0
- package/dist/docs/c-table/usage.md +1 -1
- package/dist/docs/c-tabs/usage.md +77 -0
- package/dist/docs/c-tag/usage.md +1 -0
- package/dist/docs/c-tags/usage.md +85 -0
- package/dist/docs/c-text-field/usage.md +109 -0
- package/dist/docs/c-time-picker/usage.md +170 -0
- package/dist/docs/c-toasts/usage.md +27 -3
- package/dist/docs/c-toolbar/usage.md +17 -0
- package/dist/docs/c-tree-select/usage.md +156 -0
- package/dist/floating-ui.dom-DvzxEaDJ.js +1292 -0
- package/dist/styles/css/tailwind-theme.css +2 -1
- package/dist/styles/css/tokens.css +609 -178
- package/dist/vscode.css-custom-data.json +556 -99
- package/dist/vscode.html-custom-data.json +1050 -480
- package/dist/web-types.json +3303 -1707
- package/dist-types/components/c-accordion/CAccordion.vue.d.ts +21 -25
- package/dist-types/components/c-accordion-item/CAccordionItem.vue.d.ts +13 -12
- package/dist-types/components/c-alert/CAlert.vue.d.ts +12 -17
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +124 -31
- package/dist-types/components/c-breadcrumb/CBreadcrumb.vue.d.ts +35 -0
- package/dist-types/components/c-breadcrumb/fit.d.ts +29 -0
- package/dist-types/components/c-breadcrumb-item/CBreadcrumbItem.vue.d.ts +31 -0
- package/dist-types/components/c-button/CButton.vue.d.ts +52 -63
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +16 -14
- package/dist-types/components/c-card/CCard.vue.d.ts +2 -3
- package/dist-types/components/c-card-actions/CCardActions.vue.d.ts +5 -7
- package/dist-types/components/c-card-title/CCardTitle.vue.d.ts +11 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +33 -52
- package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +189 -0
- package/dist-types/components/c-color-picker/colors.d.ts +66 -0
- package/dist-types/components/c-csc-logo/CCscLogo.vue.d.ts +1 -3
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +75 -51
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +277 -0
- package/dist-types/components/c-date-picker/dates.d.ts +119 -0
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +51 -8
- package/dist-types/components/c-file-upload/CFileUpload.vue.d.ts +204 -0
- package/dist-types/components/c-file-upload/files.d.ts +99 -0
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +23 -36
- package/dist-types/components/c-input/CInput.vue.d.ts +21 -43
- package/dist-types/components/c-link/CLink.vue.d.ts +6 -14
- package/dist-types/components/c-list/CList.vue.d.ts +4 -6
- package/dist-types/components/c-list-item/CListItem.vue.d.ts +14 -19
- package/dist-types/components/c-list-item-title/CListItemTitle.vue.d.ts +3 -2
- package/dist-types/components/c-loader/CLoader.vue.d.ts +13 -29
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +9 -9
- package/dist-types/components/c-login-card/CLoginCard.vue.d.ts +11 -16
- package/dist-types/components/c-login-card-actions/CLoginCardActions.vue.d.ts +5 -7
- package/dist-types/components/c-login-card-title/CLoginCardTitle.vue.d.ts +11 -1
- package/dist-types/components/c-main/CMain.vue.d.ts +12 -5
- package/dist-types/components/c-menu/CMenu.vue.d.ts +17 -16
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +27 -35
- package/dist-types/components/c-message/CMessage.vue.d.ts +5 -15
- package/dist-types/components/c-modal/CModal.vue.d.ts +3 -3
- package/dist-types/components/c-navigation-button/CNavigationButton.vue.d.ts +20 -1
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +169 -0
- package/dist-types/components/c-number-field/numbers.d.ts +58 -0
- package/dist-types/components/c-option/COption.vue.d.ts +1 -1
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +16 -30
- package/dist-types/components/c-page/CPage.vue.d.ts +2 -3
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +56 -26
- package/dist-types/components/c-popover/CPopover.vue.d.ts +11 -7
- package/dist-types/components/c-progress-bar/CProgressBar.vue.d.ts +10 -14
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +7 -7
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +11 -8
- package/dist-types/components/c-select/CSelect.vue.d.ts +119 -35
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +10 -18
- package/dist-types/components/c-side-navigation-item/CSideNavigationItem.vue.d.ts +22 -14
- package/dist-types/components/c-slider/CSlider.vue.d.ts +29 -73
- package/dist-types/components/c-spinner/CSpinner.vue.d.ts +4 -8
- package/dist-types/components/c-status/CStatus.vue.d.ts +8 -9
- package/dist-types/components/c-step/CStep.vue.d.ts +6 -4
- package/dist-types/components/c-steps/CSteps.vue.d.ts +3 -7
- package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +23 -17
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +17 -30
- package/dist-types/components/c-tab/CTab.vue.d.ts +11 -28
- package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +11 -13
- package/dist-types/components/c-tab-item/CTabItem.vue.d.ts +4 -5
- package/dist-types/components/c-tab-items/CTabItems.vue.d.ts +5 -4
- package/dist-types/components/c-table/CTable.vue.d.ts +7 -7
- package/dist-types/components/c-tabs/CTabs.vue.d.ts +13 -20
- package/dist-types/components/c-tag/CTag.vue.d.ts +22 -21
- package/dist-types/components/c-tags/CTags.vue.d.ts +9 -10
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +74 -77
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +205 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/components/c-toast/CToast.vue.d.ts +3 -4
- package/dist-types/components/c-toast/swipe.d.ts +40 -0
- package/dist-types/components/c-toasts/CToasts.vue.d.ts +14 -16
- package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +12 -8
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +257 -0
- package/dist-types/index.d.ts +41 -32
- package/dist-types/registry.d.ts +9 -0
- package/dist-types/shared/FieldMessage.vue.d.ts +8 -5
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
- package/dist-types/shared/TypedField.vue.d.ts +48 -0
- package/dist-types/shared/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -0
- package/dist-types/shared/inputMask.d.ts +106 -0
- package/dist-types/shared/lightDismiss.d.ts +35 -0
- package/dist-types/shared/modalStack.d.ts +4 -3
- package/dist-types/shared/navigationDrawer.d.ts +4 -0
- package/dist-types/shared/optionLabel.d.ts +18 -0
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/peekCap.d.ts +35 -0
- package/dist-types/shared/popoverChain.d.ts +13 -10
- package/dist-types/shared/positionArea.d.ts +9 -4
- package/dist-types/shared/reducedMotion.d.ts +10 -0
- package/dist-types/shared/selectAll.d.ts +29 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +107 -0
- package/dist-types/shared/useControlAttrs.d.ts +8 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +5 -4
- package/dist-types/shared/useFallbackPosition.d.ts +71 -0
- package/dist-types/shared/useHostEmit.d.ts +38 -0
- package/dist-types/shared/useIdReferences.d.ts +39 -0
- package/dist-types/shared/useKeyboardModality.d.ts +7 -0
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/useScrollStrip.d.ts +39 -0
- package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
- package/dist-types/shared/useTypedField.d.ts +108 -0
- package/dist-types/shared/valueEvents.d.ts +41 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +1572 -672
- package/dist-types/theme/applyTheme.d.ts +6 -6
- package/dist-types/theme/chart-data.d.ts +51 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +51 -0
- package/dist-types/types.d.ts +7 -11
- package/package.json +32 -21
- package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
- package/dist/docs/c-toast/usage.md +0 -1
- package/dist-types/shared/anchorPolyfill.d.ts +0 -24
- package/dist-types/shared/emitModelValue.d.ts +0 -37
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
import type {
|
|
1
|
+
export type { CFamily } from './ramp.js';
|
|
2
|
+
import type { CFamily } from './ramp.js';
|
|
3
3
|
/** A partial map of chromatic family → step-500 seed color. */
|
|
4
|
-
export type
|
|
4
|
+
export type CThemeSeeds = Partial<Record<CFamily, string>>;
|
|
5
5
|
/**
|
|
6
6
|
* Compute the full ramp for each supplied brand family and return them as a
|
|
7
7
|
* `:root { … }` CSS string. Pure — no DOM access — so it is safe to run on the
|
|
8
8
|
* server and inject into `<head>` for zero-flash theming. Returns `''` for an
|
|
9
9
|
* empty seed set.
|
|
10
10
|
*/
|
|
11
|
-
export declare function themeToCss(seeds:
|
|
11
|
+
export declare function themeToCss(seeds: CThemeSeeds): string;
|
|
12
12
|
/**
|
|
13
13
|
* Apply consumer brand seeds at runtime: regenerate each family's full ramp and
|
|
14
14
|
* set the `--c-*` custom properties as inline styles on `<html>`, so the
|
|
@@ -16,10 +16,10 @@ export declare function themeToCss(seeds: ThemeSeeds): string;
|
|
|
16
16
|
* shadow root. Merges with previously applied seeds. No-op outside the browser
|
|
17
17
|
* (validation still runs, so bad input throws in any environment).
|
|
18
18
|
*/
|
|
19
|
-
export declare function applyTheme(seeds:
|
|
19
|
+
export declare function applyTheme(seeds: CThemeSeeds): void;
|
|
20
20
|
/**
|
|
21
21
|
* Remove custom properties previously set by {@link applyTheme}. With no
|
|
22
22
|
* argument, clears every applied property (reverting to the tokens.css
|
|
23
23
|
* defaults); pass families to clear only those.
|
|
24
24
|
*/
|
|
25
|
-
export declare function resetTheme(families?:
|
|
25
|
+
export declare function resetTheme(families?: CFamily[]): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
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(el)` to pick the mode in effect where the
|
|
11
|
+
* chart sits, or `observeThemeMode()` to follow it.
|
|
12
|
+
*/
|
|
13
|
+
import type { CThemeMode } from './themeMode';
|
|
14
|
+
/** The twelve series slots in slot order (`chart-1` … `chart-12`). */
|
|
15
|
+
export type CChartSlots = readonly [
|
|
16
|
+
string,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string,
|
|
21
|
+
string,
|
|
22
|
+
string,
|
|
23
|
+
string,
|
|
24
|
+
string,
|
|
25
|
+
string,
|
|
26
|
+
string,
|
|
27
|
+
string
|
|
28
|
+
];
|
|
29
|
+
/** The chart anatomy roles: plot background, gridlines/axes, tick labels. */
|
|
30
|
+
export interface CChartAnatomy {
|
|
31
|
+
readonly surface: string;
|
|
32
|
+
readonly grid: string;
|
|
33
|
+
readonly axis: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Series slots per theme mode as `oklch(L C H)` strings — the palette's own
|
|
37
|
+
* colour space, ready for CSS, SVG and canvas `fillStyle`, and the exact
|
|
38
|
+
* string the `--c-chart-*` variable holds (ADR-0041). Each round-trips to
|
|
39
|
+
* the `#rrggbb` in `chartSlotsHex`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const chartSlots: Readonly<Record<CThemeMode, CChartSlots>>;
|
|
42
|
+
/**
|
|
43
|
+
* Series slots per theme mode as `#rrggbb` — for chart libraries that do
|
|
44
|
+
* their own colour maths in sRGB (ECharts, Chart.js) and cannot parse
|
|
45
|
+
* `oklch()`. Same colours and order as `chartSlots`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const chartSlotsHex: Readonly<Record<CThemeMode, CChartSlots>>;
|
|
48
|
+
/** Chart anatomy roles per theme mode as `oklch(L C H)` strings. */
|
|
49
|
+
export declare const chartAnatomy: Readonly<Record<CThemeMode, CChartAnatomy>>;
|
|
50
|
+
/** Chart anatomy roles per theme mode as `#rrggbb`. */
|
|
51
|
+
export declare const chartAnatomyHex: Readonly<Record<CThemeMode, CChartAnatomy>>;
|
|
@@ -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 CFamily =
|
|
7
|
+
| 'accent'
|
|
8
|
+
| 'error'
|
|
9
|
+
| 'info'
|
|
10
|
+
| 'link'
|
|
11
|
+
| 'primary'
|
|
12
|
+
| 'secondary'
|
|
13
|
+
| 'success'
|
|
14
|
+
| 'warning';
|
|
15
|
+
|
|
16
|
+
/** Built-in brand seed (step-500) per family. */
|
|
17
|
+
export declare const DEFAULT_SEEDS: Record<CFamily, string>;
|
|
18
|
+
|
|
19
|
+
/** The chromatic families, in canonical order. */
|
|
20
|
+
export declare const FAMILIES: readonly CFamily[];
|
|
21
|
+
|
|
22
|
+
/** Ramp steps, in ascending order (`[50, 100, …, 950]`). */
|
|
23
|
+
export declare const STEPS: readonly number[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The CSS value the library emits for a colour: a hex becomes `oklch(L C H)`
|
|
27
|
+
* at a precision that round-trips exactly; non-hex values pass through.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cssColor(value: string): string;
|
|
30
|
+
|
|
31
|
+
/** The `--c-<family>-*` custom-property map (steps + `-rgb`) for one seed. */
|
|
32
|
+
export declare function familyVars(
|
|
33
|
+
family: CFamily,
|
|
34
|
+
seedHex: string,
|
|
35
|
+
): Record<string, string>;
|
|
36
|
+
|
|
37
|
+
/** Generate a full 50–950 ramp from a single step-500 seed. */
|
|
38
|
+
export declare function ramp(seedHex: string): Record<string, string>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** The light-or-dark state that selects which palette the semantic tokens resolve to. */
|
|
2
|
+
export type CThemeMode = 'dark' | 'light';
|
|
3
|
+
/**
|
|
4
|
+
* Watch the theme mode in effect for an element and report every change.
|
|
5
|
+
*
|
|
6
|
+
* Calls `onChange` once synchronously with the current mode, then again
|
|
7
|
+
* whenever it actually changes — so wiring a chart up is the one call, with no
|
|
8
|
+
* separate initial render. Covers both paths that can change the answer: a
|
|
9
|
+
* `data-theme` or `data-theme-invert` attribute mutating anywhere in the
|
|
10
|
+
* document (the element's own **mode scope** or any ancestor's, which is why a
|
|
11
|
+
* `documentElement`-only observer is not enough), and the OS preference
|
|
12
|
+
* flipping while no scope pins a mode.
|
|
13
|
+
*
|
|
14
|
+
* Re-parenting `target` is not observed; re-subscribe if you move it. That
|
|
15
|
+
* matters more than it used to: an **inverting scope** resolves against where
|
|
16
|
+
* it sits, so moving one between a light and a dark region changes its mode,
|
|
17
|
+
* where moving a pinned scope never did.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const stop = observeThemeMode(chartEl, (mode) => {
|
|
21
|
+
* chart.setOption({ color: chartSlotsHex[mode] });
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @returns a disposer that detaches both listeners
|
|
26
|
+
*/
|
|
27
|
+
export declare function observeThemeMode(target: Element, onChange: (mode: CThemeMode) => void): () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the theme mode in effect for an element, mirroring the cascade in
|
|
30
|
+
* `tokens.css`: the nearest enclosing **mode scope** wins (an ancestor-or-self
|
|
31
|
+
* carrying `data-theme="light"` or `"dark"`, ADR-0053), an **inverting scope**
|
|
32
|
+
* (`data-theme-invert`, ADR-0054) flips whatever it sits in; otherwise the OS
|
|
33
|
+
* preference; light where neither is available (server rendering, no
|
|
34
|
+
* `matchMedia`). Any other `data-theme` value is inert, exactly as in CSS.
|
|
35
|
+
*
|
|
36
|
+
* The answer comes from the cascade itself — `--c-mode`, which every mode block
|
|
37
|
+
* declares — rather than from walking the DOM. That is the only way to resolve
|
|
38
|
+
* an inverting scope without re-implementing the style query, it cannot drift
|
|
39
|
+
* from the CSS, and unlike `closest()` it reads correctly for an element INSIDE
|
|
40
|
+
* a shadow root, since custom properties inherit across the boundary. The DOM
|
|
41
|
+
* walk remains as the fallback for when `tokens.css` has not been loaded: a
|
|
42
|
+
* detached node, a server-rendered pass, or a consumer who ships only the
|
|
43
|
+
* Tailwind theme export.
|
|
44
|
+
*
|
|
45
|
+
* Pass the element whose mode you need — a chart inside a dark panel on an
|
|
46
|
+
* otherwise light page resolves `dark` only if you ask about the chart.
|
|
47
|
+
* `observeThemeMode()` keeps that answer current.
|
|
48
|
+
*
|
|
49
|
+
* @param root the element to resolve for — defaults to `<html>`
|
|
50
|
+
*/
|
|
51
|
+
export declare function themeMode(root?: Element | null): CThemeMode;
|
package/dist-types/types.d.ts
CHANGED
|
@@ -12,13 +12,6 @@
|
|
|
12
12
|
* the wrapping control (`c-select`) into `c-input`.
|
|
13
13
|
*/
|
|
14
14
|
export type CFieldSize = 'default' | 'small';
|
|
15
|
-
/**
|
|
16
|
-
* Preferred placement of a floating panel relative to its anchor, shared by
|
|
17
|
-
* the anchor-positioned overlay components (`c-menu`, `c-tooltip`,
|
|
18
|
-
* `c-popover`). The side names the panel's position; `-start`/`-end` align
|
|
19
|
-
* the panel's edge with the anchor's on the cross axis.
|
|
20
|
-
*/
|
|
21
|
-
export type CPlacement = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
22
15
|
/**
|
|
23
16
|
* A selectable item for the value-selection components (`c-select`,
|
|
24
17
|
* `c-autocomplete`) when options are supplied via the `items` prop instead of
|
|
@@ -34,7 +27,7 @@ export interface CSelectItem {
|
|
|
34
27
|
}
|
|
35
28
|
/**
|
|
36
29
|
* A toast notification: the argument to `c-toasts`' `addToast` method,
|
|
37
|
-
* rendered by the
|
|
30
|
+
* rendered by the internal `c-toast`, and the detail of `c-toasts`' `close` event.
|
|
38
31
|
*/
|
|
39
32
|
export interface CToastMessage {
|
|
40
33
|
/** Label of the toast's close button. */
|
|
@@ -43,7 +36,12 @@ export interface CToastMessage {
|
|
|
43
36
|
custom?: boolean;
|
|
44
37
|
/** How long the toast stays visible, in milliseconds. Defaults to 6000. */
|
|
45
38
|
duration?: number;
|
|
46
|
-
/**
|
|
39
|
+
/** Optional heading rendered above the message. */
|
|
40
|
+
heading?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Identifier for `removeToast`. `addToast` generates one when it is
|
|
43
|
+
* omitted, and returns it either way.
|
|
44
|
+
*/
|
|
47
45
|
id?: string;
|
|
48
46
|
/** Show an indeterminate progress bar instead of the countdown. */
|
|
49
47
|
indeterminate?: boolean;
|
|
@@ -53,8 +51,6 @@ export interface CToastMessage {
|
|
|
53
51
|
persistent?: boolean;
|
|
54
52
|
/** Show a progress bar counting down the toast's remaining duration. */
|
|
55
53
|
progress?: boolean;
|
|
56
|
-
/** Optional title rendered above the message. */
|
|
57
|
-
title?: string;
|
|
58
54
|
/** Status type of the toast. Defaults to `info`. */
|
|
59
55
|
type?: CToastType;
|
|
60
56
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cscfi/csc-ui",
|
|
3
|
-
"version": "4.0.0-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.0-rc.2",
|
|
4
|
+
"description": "The CSC Design System's components as native custom elements: one set of c-* tags for plain HTML, Vue, React and Angular.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/csc-ui.js",
|
|
7
7
|
"module": "./dist/csc-ui.js",
|
|
@@ -20,9 +20,17 @@
|
|
|
20
20
|
"./css/*": "./dist/styles/css/*",
|
|
21
21
|
"./custom-elements.json": "./dist/custom-elements.json"
|
|
22
22
|
},
|
|
23
|
+
"browserslist": [
|
|
24
|
+
"last 2 Chrome versions",
|
|
25
|
+
"last 2 Edge versions",
|
|
26
|
+
"last 2 Firefox versions",
|
|
27
|
+
"Firefox ESR",
|
|
28
|
+
"last 2 Safari versions",
|
|
29
|
+
"last 2 iOS versions"
|
|
30
|
+
],
|
|
23
31
|
"dependencies": {
|
|
32
|
+
"@floating-ui/dom": "^1.7.6",
|
|
24
33
|
"@mdi/js": "^7.4.47",
|
|
25
|
-
"@oddbird/css-anchor-positioning": "^0.9.0",
|
|
26
34
|
"@tanstack/vue-table": "^8.21.3",
|
|
27
35
|
"culori": "^4.0.2",
|
|
28
36
|
"tailwind-merge": "^3.6.0",
|
|
@@ -30,45 +38,48 @@
|
|
|
30
38
|
"vue": "^3.5.39"
|
|
31
39
|
},
|
|
32
40
|
"devDependencies": {
|
|
33
|
-
"@eslint/js": "^9.28.0",
|
|
34
|
-
"@stylistic/eslint-plugin": "^5.7.0",
|
|
35
41
|
"@tailwindcss/vite": "^4.3.1",
|
|
36
|
-
"@types/node": "^
|
|
42
|
+
"@types/node": "^24.0.0",
|
|
37
43
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
44
|
+
"@vitest/browser-playwright": "5.0.0",
|
|
38
45
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
39
46
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
40
|
-
"
|
|
41
|
-
"eslint-config-prettier": "^10.0.0",
|
|
42
|
-
"eslint-import-resolver-typescript": "^4.4.5",
|
|
43
|
-
"eslint-plugin-perfectionist": "^5.3.1",
|
|
44
|
-
"eslint-plugin-prettier": "^5.5.6",
|
|
45
|
-
"eslint-plugin-vue": "^10.9.2",
|
|
46
|
-
"globals": "^17.7.0",
|
|
47
|
-
"prettier": "^3.8.5",
|
|
47
|
+
"playwright": "1.60.0",
|
|
48
48
|
"style-dictionary": "^3.9.0",
|
|
49
49
|
"tailwindcss": "^4.3.1",
|
|
50
50
|
"typescript": "^6.0.3",
|
|
51
|
-
"typescript-eslint": "^8.62.0",
|
|
52
51
|
"vite": "^8.1.0",
|
|
52
|
+
"vitest": "5.0.0",
|
|
53
53
|
"vue-tsc": "^3.3.5"
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"repository": "CSCfi/ui",
|
|
57
57
|
"homepage": "https://design-system.csc.fi",
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "pnpm run style-dictionary:build && pnpm run docs:tag-map && vite build &&
|
|
59
|
+
"build": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run docs:tag-map && vite build && pnpm run build:types && pnpm run docs:manifest:strict",
|
|
60
60
|
"docs:manifest": "node scripts/analyzer/index.mjs",
|
|
61
61
|
"docs:tag-map": "node scripts/analyzer/index.mjs --tag-map",
|
|
62
62
|
"docs:manifest:strict": "node scripts/analyzer/index.mjs --strict",
|
|
63
63
|
"docs:seed": "node scripts/seed-descriptions.mjs",
|
|
64
|
-
"build:types": "vue-tsc -p tsconfig.build.json",
|
|
65
|
-
"build:watch": "pnpm run style-dictionary:build &&
|
|
66
|
-
"dev": "pnpm run style-dictionary:build &&
|
|
64
|
+
"build:types": "vue-tsc -p tsconfig.build.json && node scripts/copy-declarations.mjs",
|
|
65
|
+
"build:watch": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run build:types && vite build --watch",
|
|
66
|
+
"dev": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run build:types && vite build --watch",
|
|
67
67
|
"lint:a11y": "node scripts/check-host-attr-fallthrough.mjs",
|
|
68
|
+
"lint:api": "node scripts/check-api-breaks.mjs",
|
|
68
69
|
"lint:contrast": "node scripts/audit-contrast.mjs",
|
|
69
70
|
"lint:ramp": "node scripts/check-ramp-parity.mjs",
|
|
70
|
-
"lint:tokens": "node scripts/check-palette-utilities.mjs",
|
|
71
|
+
"lint:tokens": "node scripts/check-palette-utilities.mjs --strict",
|
|
71
72
|
"style-dictionary:build": "style-dictionary build --config ./style-dictionary.config.cjs",
|
|
72
|
-
"type-check": "vue-tsc --build --force"
|
|
73
|
+
"type-check": "vue-tsc --build --force",
|
|
74
|
+
"chart:generate": "node scripts/generate-chart-data.mjs",
|
|
75
|
+
"lint:chart": "node scripts/check-chart-parity.mjs",
|
|
76
|
+
"lint:focus": "node scripts/check-focus-rings.mjs",
|
|
77
|
+
"lint:engines": "node scripts/check-engine-skips.mjs",
|
|
78
|
+
"test": "pnpm run style-dictionary:build && vitest run",
|
|
79
|
+
"test:watch": "vitest",
|
|
80
|
+
"test:browser": "vitest run --project browser",
|
|
81
|
+
"test:node": "vitest run --project node",
|
|
82
|
+
"test:update": "pnpm run style-dictionary:build && vitest run --project browser --update",
|
|
83
|
+
"lint:guards": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart && pnpm run lint:focus && pnpm run lint:engines"
|
|
73
84
|
}
|
|
74
85
|
}
|