@cscfi/csc-ui 4.0.0-alpha.30 → 4.0.0-alpha.32

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.
@@ -49,7 +49,10 @@
49
49
  * fullscreen `tv` variant (the panel paints the surface, the card sheds its
50
50
  * anchored chrome, the list takes the rest, the heading row) and the open
51
51
  * sequence (peek cap, focus, highlight seed, announcement), run from
52
- * `onOpened` synchronously inside the `toggle` handler.
52
+ * `onOpened` synchronously inside the `toggle` handler. State that must be in
53
+ * place before the first keystroke reaches the panel — a search input's
54
+ * query reset — goes in `onOpening` instead: `toggle` is a queued task, so a
55
+ * key typed into a panel focused on open can land before it.
53
56
  */
54
57
  import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
55
58
  /**
@@ -94,6 +97,8 @@ export interface UseAnchoredPanelOptions {
94
97
  onClosed?: () => void;
95
98
  /** Runs inside the native `toggle` handler once open, after the fallback positioning / page lock and the dismiss listener — the consumer's open sequence goes here. */
96
99
  onOpened?: () => void;
100
+ /** Runs inside `open()` right before `showPopover()`, only when the panel really opens — the reset of state a keystroke may already change before `toggle` fires (a search input's query). */
101
+ onOpening?: () => void;
97
102
  /** The `popover="manual"` panel element. */
98
103
  panel: Readonly<Ref<HTMLElement | null>>;
99
104
  /** Receives focus when the panel closes via `close(true)`. */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Track the host's keyboard modality for the lifetime of the current effect
3
+ * scope. Returns `focusOptions`, which adds `focusVisible: true` to a script
4
+ * focus under keyboard modality and otherwise leaves the browser to decide —
5
+ * never `focusVisible: false`.
6
+ */
7
+ export declare const useKeyboardModality: (host: HTMLElement | null | undefined) => ((options?: FocusOptions) => FocusOptions);
@@ -4,14 +4,25 @@
4
4
  * one field box under `range`. Text is masked while typed and read by the
5
5
  * codec only on Enter or blur; text that names no usable value is kept as
6
6
  * typed and flags **bad input** (CONTEXT.md). Programmatic values re-sync the
7
- * text and never emit; commits emit through `emitModelChange`.
7
+ * text and never emit; commits emit through `emitModelChange`, and a panel
8
+ * drag reports its moves through `moveValue` and one `settleValue` (ADR-0070).
8
9
  *
9
- * Generic over the value's codec, so `c-date-picker` and `c-time-picker`
10
- * share one commit model. The anatomy lives in `TypedField.vue`, which binds
10
+ * Generic over the value's codec, so `c-date-picker`, `c-time-picker` and
11
+ * `c-color-picker` share one commit model. The anatomy lives in `TypedField.vue`, which binds
11
12
  * the element refs returned here.
12
13
  */
13
14
  import { type Ref } from 'vue';
14
15
  import { type MaskSlot } from './inputMask';
16
+ export interface TypedFieldCodec {
17
+ /** The committed value shown as text under `pattern`. */
18
+ format(value: string, pattern: string): string;
19
+ /** A parsed value that can still not be committed (disabled, out of range) — bad input. */
20
+ isUsable(value: string): boolean;
21
+ /** Whether a value set from outside is one this field holds (anything else is "no value"). */
22
+ isValue(value: unknown): value is string;
23
+ /** Typed text read under `pattern`; `null` when it names no value. */
24
+ parse(text: string, pattern: string): null | string;
25
+ }
15
26
  export type TypedFieldEnd = 'end' | 'start';
16
27
  export interface TypedFieldEnds {
17
28
  end: null | string;
@@ -22,16 +33,6 @@ export type TypedFieldText = {
22
33
  end: string;
23
34
  start: string;
24
35
  } | string;
25
- export interface TypedFieldCodec {
26
- /** The committed value shown as text under `pattern`. */
27
- format(value: string, pattern: string): string;
28
- /** Whether a value set from outside is one this field holds (anything else is "no value"). */
29
- isValue(value: unknown): value is string;
30
- /** A parsed value that can still not be committed (disabled, out of range) — bad input. */
31
- isUsable(value: string): boolean;
32
- /** Typed text read under `pattern`; `null` when it names no value. */
33
- parse(text: string, pattern: string): null | string;
34
- }
35
36
  export interface UseTypedFieldOptions {
36
37
  codec: TypedFieldCodec;
37
38
  /** The custom element host: the model events dispatch from it. */
@@ -40,17 +41,17 @@ export interface UseTypedFieldOptions {
40
41
  label: () => string;
41
42
  /** Whether the label rests on top of the field (the resolved app default). */
42
43
  labelOnTop: Readonly<Ref<boolean>>;
43
- /** The typing mask derived from `pattern`. */
44
- mask: Readonly<Ref<MaskSlot[]>>;
44
+ /** The typing mask derived from `pattern`; without one, typing is free. */
45
+ mask?: Readonly<Ref<MaskSlot[]>>;
45
46
  /** The end inputs' accessible names under `range`. */
46
47
  names: () => {
47
48
  end: string;
48
49
  start: string;
49
50
  };
50
- /** Fired on every commit of typed text, as typed — the host's `change:text`. */
51
- onTextCommit: (text: TypedFieldText) => void;
52
51
  /** Alt+↓ in an input, after committing its text: open the panel. */
53
52
  onOpenRequest: () => void;
53
+ /** Fired on every commit of typed text, as typed — the host's `change:text`. */
54
+ onTextCommit: (text: TypedFieldText) => void;
54
55
  /** The display and parse pattern. */
55
56
  pattern: Readonly<Ref<string>>;
56
57
  /** The consumer's placeholder (props.placeholder). */
@@ -71,7 +72,6 @@ export declare const useTypedField: (options: UseTypedFieldOptions) => {
71
72
  commitText: (end: TypedFieldEnd) => void;
72
73
  commitValue: (next: TypedFieldEnds) => void;
73
74
  endInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
74
- endText: Ref<string, string>;
75
75
  ends: Ref<{
76
76
  end: null | string;
77
77
  start: null | string;
@@ -79,6 +79,7 @@ export declare const useTypedField: (options: UseTypedFieldOptions) => {
79
79
  end: null | string;
80
80
  start: null | string;
81
81
  }>;
82
+ endText: Ref<string, string>;
82
83
  field: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
83
84
  focused: Ref<boolean, boolean>;
84
85
  hasContent: import("vue").ComputedRef<boolean>;
@@ -86,12 +87,14 @@ export declare const useTypedField: (options: UseTypedFieldOptions) => {
86
87
  inputLabel: (end: TypedFieldEnd) => string | undefined;
87
88
  inputOf: (end: TypedFieldEnd) => HTMLInputElement | null;
88
89
  lastInput: Ref<TypedFieldEnd, TypedFieldEnd>;
90
+ moveValue: (next: TypedFieldEnds) => void;
89
91
  onClear: (event?: Event) => void;
90
92
  onFocusOut: (event: FocusEvent) => void;
91
93
  onKeyDown: (end: TypedFieldEnd, event: KeyboardEvent) => void;
92
94
  onTextInput: (end: TypedFieldEnd, event: Event) => void;
93
95
  placeholder: import("vue").ComputedRef<string | undefined>;
94
96
  range: Readonly<Ref<boolean, boolean>>;
97
+ settleValue: () => void;
95
98
  showSeparator: import("vue").ComputedRef<boolean>;
96
99
  startInput: import("vue").ShallowRef<HTMLInputElement | null, HTMLInputElement | null>;
97
100
  startText: Ref<string, string>;
@@ -12,8 +12,10 @@
12
12
  import type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteTexts, CAutocompleteValue } from './components/c-autocomplete/CAutocomplete.vue';
13
13
  import type { CBreadcrumbTexts } from './components/c-breadcrumb/CBreadcrumb.vue';
14
14
  import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup.vue';
15
+ import type { CColorPickerSwatch, CColorPickerTexts, CColorPickerValue } from './components/c-color-picker/CColorPicker.vue';
15
16
  import type { CDataTableCellContent, CDataTableColumn, CDataTableExpandedContext, CDataTableRow, CDataTableSort, CDataTableTexts } from './components/c-data-table/CDataTable.vue';
16
17
  import type { CDatePickerDisabledDate, CDatePickerText, CDatePickerTexts, CDatePickerValue } from './components/c-date-picker/CDatePicker.vue';
18
+ import type { CFileUploadEntry, CFileUploadFunction, CFileUploadRejection, CFileUploadTexts } from './components/c-file-upload/CFileUpload.vue';
17
19
  import type { CNumberFieldTexts } from './components/c-number-field/CNumberField.vue';
18
20
  import type { CPaginationOptions } from './components/c-pagination/CPagination.vue';
19
21
  import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.vue';
@@ -446,6 +448,100 @@ export interface CCheckboxElement extends Omit<HTMLElement, 'checked' | 'disable
446
448
  removeEventListener<K extends keyof CCheckboxElementEventMap>(type: K, listener: (this: CCheckboxElement, ev: CCheckboxElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
447
449
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
448
450
  }
451
+ /** Events dispatched by `<c-color-picker>`. */
452
+ export interface CColorPickerElementEventMap {
453
+ /**
454
+ * Fired when the value changes — a pick in the panel, typed text
455
+ * committed, the field cleared — carrying the colour in the `format`
456
+ * notation, or `null`. A drag on the area or a slider fires it once, on
457
+ * release.
458
+ */
459
+ change: CustomEvent<CColorPickerValue>;
460
+ /**
461
+ * Fired on every commit of typed text (Enter or leaving the input) with the
462
+ * text as typed. Read `badInput` to tell whether it named a colour.
463
+ */
464
+ 'change:text': CustomEvent<string>;
465
+ /**
466
+ * Native bubbling input event dispatched alongside every value change —
467
+ * each move of a drag included — so a plain `v-model` stays in sync.
468
+ * Carries no detail.
469
+ */
470
+ input: CustomEvent<void>;
471
+ /**
472
+ * Fired with every value change, each move of a drag included — the
473
+ * `v-model` contract.
474
+ */
475
+ 'update:value': CustomEvent<CColorPickerValue>;
476
+ }
477
+ /** A colour field that takes any typed CSS colour, or opens a panel for picking one: a colour area, hue and alpha sliders, per-channel inputs and swatches — or swatches alone under `swatches-only`. */
478
+ export interface CColorPickerElement extends Omit<HTMLElement, 'alpha' | 'clearable' | 'disabled' | 'errorMessage' | 'format' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'name' | 'placeholder' | 'required' | 'shadow' | 'size' | 'swatches' | 'swatchesOnly' | 'texts' | 'valid' | 'value'> {
479
+ /**
480
+ * Let the colour carry transparency: an alpha slider and an A channel join
481
+ * the panel. Without it typed alpha is dropped
482
+ */
483
+ alpha?: boolean;
484
+ /** Make the value clearable */
485
+ clearable?: boolean;
486
+ /** Disable the field */
487
+ disabled?: boolean;
488
+ /** Error message shown in place of the hint while the field is invalid */
489
+ errorMessage?: string;
490
+ /**
491
+ * The notation the value is written in — and every emission with it:
492
+ * `#rrggbb`, `rgb(r g b)` or `oklch(l c h)`
493
+ */
494
+ format?: 'hex' | 'oklch' | 'rgb';
495
+ /** Hide the hint and error messages */
496
+ hideDetails?: boolean;
497
+ /** Hint text for the field */
498
+ hint?: string;
499
+ /** Id of the element */
500
+ hostId?: string;
501
+ /** Element label */
502
+ label?: string;
503
+ /** Label on top of the field */
504
+ labelOnTop?: boolean;
505
+ /** Input field name */
506
+ name?: string;
507
+ /** Placeholder of the input; an example of the notation when empty */
508
+ placeholder?: string;
509
+ /** Set the field as required */
510
+ required?: boolean;
511
+ /** Shadow variant */
512
+ shadow?: boolean;
513
+ /** Field height: the 52px default (the shared control height) or the 36px `small` box */
514
+ size?: 'default' | 'small';
515
+ /**
516
+ * Predefined colours offered under the picker — CSS colours, or
517
+ * `{ value, name }` objects whose name is read out and shown. Arrays have
518
+ * no attribute form — bind as a DOM property
519
+ */
520
+ swatches?: CColorPickerSwatch[];
521
+ /**
522
+ * Limit the choice to the swatches: the field becomes readonly and opens
523
+ * a panel of the swatches alone
524
+ */
525
+ swatchesOnly?: boolean;
526
+ /**
527
+ * UI text overrides (i18n), merged over the English defaults. Objects have
528
+ * no attribute form — bind as a DOM property
529
+ */
530
+ texts?: CColorPickerTexts;
531
+ /** Set the validity of the field */
532
+ valid?: boolean;
533
+ /**
534
+ * The colour in the `format` notation, or `null` when empty. Any CSS
535
+ * colour is accepted and shown in the notation
536
+ */
537
+ value?: CColorPickerValue;
538
+ /** Whether the committed text names no colour — the value is then `null` (CONTEXT.md "Bad input"). */
539
+ readonly badInput: boolean;
540
+ addEventListener<K extends keyof CColorPickerElementEventMap>(type: K, listener: (this: CColorPickerElement, ev: CColorPickerElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
541
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
542
+ removeEventListener<K extends keyof CColorPickerElementEventMap>(type: K, listener: (this: CColorPickerElement, ev: CColorPickerElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
543
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
544
+ }
449
545
  export interface CCscLogoElement extends Omit<HTMLElement, 'width'> {
450
546
  /** Logo width in pixels */
451
547
  width?: number;
@@ -737,6 +833,72 @@ export interface CDropdownElement extends Omit<HTMLElement, 'closeLabel' | 'drop
737
833
  removeEventListener<K extends keyof CDropdownElementEventMap>(type: K, listener: (this: CDropdownElement, ev: CDropdownElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
738
834
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
739
835
  }
836
+ /** Events dispatched by `<c-file-upload>`. */
837
+ export interface CFileUploadElementEventMap {
838
+ /** Fired with the new list of file entries. */
839
+ change: CustomEvent<CFileUploadEntry[]>;
840
+ /**
841
+ * Native bubbling input event fired with every value change so a plain Vue
842
+ * `v-model` works. No detail.
843
+ */
844
+ input: CustomEvent<void>;
845
+ /**
846
+ * Fired after an add that refused files, listing each with its reason —
847
+ * a type outside `accept`, a file over `max-size`, a file already held,
848
+ * one beyond `max-files`, or a folder. The refused files never join the
849
+ * value.
850
+ */
851
+ reject: CustomEvent<CFileUploadRejection[]>;
852
+ /** v-model contract event, fired with `change`. */
853
+ 'update:value': CustomEvent<CFileUploadEntry[]>;
854
+ }
855
+ /** A field the user adds files to by dropping them on it or choosing them from a file dialog — and, given an upload function, the place each file's upload shows its progress. */
856
+ export interface CFileUploadElement extends Omit<HTMLElement, 'accept' | 'compact' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'label' | 'manual' | 'maxFiles' | 'maxSize' | 'multiple' | 'required' | 'size' | 'texts' | 'upload' | 'valid' | 'value'> {
857
+ /** The file types the field takes, in the native `accept` syntax: extensions (`.pdf`) and media types (`image/*`, `application/json`), comma separated. It filters the file dialog and is checked again on a drop */
858
+ accept?: string;
859
+ /** Show the drop zone as a control-height row — a "Choose files" button and a drop prompt — that lines up with the fields beside it */
860
+ compact?: boolean;
861
+ /** Disable the field. Uploads already running continue */
862
+ disabled?: boolean;
863
+ /** Error message shown in place of the hint while the field is invalid */
864
+ errorMessage?: string;
865
+ /** Hide the hint and error messages */
866
+ hideDetails?: boolean;
867
+ /** Hint text under the drop zone — the place to name the accepted types and limits */
868
+ hint?: string;
869
+ /** Label of the field */
870
+ label?: string;
871
+ /** Hold added files as `local` even with an upload function, until `startUploads()` queues them — for a form that uploads on its own button. Files added after the call wait for the next one */
872
+ manual?: boolean;
873
+ /** The most file entries a `multiple` field holds; files beyond it are rejected */
874
+ maxFiles?: null | number;
875
+ /** The largest file in bytes; a larger one is rejected. Sizes are shown in decimal units, so write the limit in decimal bytes (`10000000` reads "10 MB") */
876
+ maxSize?: null | number;
877
+ /** Let a pick or a drop add several files. Without it the field holds one file and a new pick replaces it; the value is a list either way */
878
+ multiple?: boolean;
879
+ /** Set the field as required */
880
+ required?: boolean;
881
+ /** Height of the `compact` row: the 52px default (the shared control height) or the 36px `small` row. The large drop zone has one size */
882
+ size?: 'default' | 'small';
883
+ /** UI text overrides (i18n), merged over the English defaults. Objects have no attribute form — bind as a DOM property */
884
+ texts?: CFileUploadTexts;
885
+ /** The upload function: called once per added file with an abort signal and a progress callback taking a fraction from 0 to 1; what it resolves to becomes the entry's `result`, an `Error` it rejects with becomes the entry's `error` text. Without one the field only holds the files. A function — bind as a DOM property */
886
+ upload?: CFileUploadFunction;
887
+ /** Set the validity of the field */
888
+ valid?: boolean;
889
+ /** The file entries — always a list. A picked file's entry carries the browser `File`; a server file's entry is `{ id, name, size, status: 'done' }`. `''` reads as empty — what a plain `v-model` holding `null` writes. An array — bind as a DOM property */
890
+ value?: CFileUploadEntry[] | null | string;
891
+ /**
892
+ * Queue every `local` file entry for the upload function — how a `manual`
893
+ * field starts; files added after the call wait for the next one. Fires the
894
+ * value events once when it starts any. Does nothing without an upload function
895
+ */
896
+ startUploads(): void;
897
+ addEventListener<K extends keyof CFileUploadElementEventMap>(type: K, listener: (this: CFileUploadElement, ev: CFileUploadElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
898
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
899
+ removeEventListener<K extends keyof CFileUploadElementEventMap>(type: K, listener: (this: CFileUploadElement, ev: CFileUploadElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
900
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
901
+ }
740
902
  export interface CIconElement extends Omit<HTMLElement, 'color' | 'path' | 'size'> {
741
903
  /** Fill color. */
742
904
  color?: string;
@@ -2150,8 +2312,10 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
2150
2312
  export interface AppDefaults {
2151
2313
  'c-autocomplete'?: Partial<Pick<CAutocompleteElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2152
2314
  'c-breadcrumb'?: Partial<Pick<CBreadcrumbElement, 'texts'>>;
2315
+ 'c-color-picker'?: Partial<Pick<CColorPickerElement, 'alpha' | 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2153
2316
  'c-data-table'?: Partial<Pick<CDataTableElement, 'texts'>>;
2154
2317
  'c-date-picker'?: Partial<Pick<CDatePickerElement, 'firstDayOfWeek' | 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'showToday' | 'showWeekNumbers' | 'size' | 'texts'>>;
2318
+ 'c-file-upload'?: Partial<Pick<CFileUploadElement, 'compact' | 'hideDetails' | 'size' | 'texts'>>;
2155
2319
  'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'size' | 'step' | 'texts'>>;
2156
2320
  'c-select'?: Partial<Pick<CSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
2157
2321
  'c-text-field'?: Partial<Pick<CTextFieldElement, 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
@@ -2162,8 +2326,10 @@ export interface AppDefaults {
2162
2326
  export declare const DEFAULTABLE_PROPS: {
2163
2327
  readonly 'c-autocomplete': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
2164
2328
  readonly 'c-breadcrumb': readonly ["texts"];
2329
+ readonly 'c-color-picker': readonly ["alpha", "format", "hideDetails", "labelOnTop", "shadow", "size", "texts"];
2165
2330
  readonly 'c-data-table': readonly ["texts"];
2166
2331
  readonly 'c-date-picker': readonly ["firstDayOfWeek", "format", "hideDetails", "labelOnTop", "shadow", "showToday", "showWeekNumbers", "size", "texts"];
2332
+ readonly 'c-file-upload': readonly ["compact", "hideDetails", "size", "texts"];
2167
2333
  readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "labelOnTop", "shadow", "size", "step", "texts"];
2168
2334
  readonly 'c-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
2169
2335
  readonly 'c-text-field': readonly ["hideDetails", "labelOnTop", "shadow", "size"];
@@ -2171,7 +2337,7 @@ export declare const DEFAULTABLE_PROPS: {
2171
2337
  readonly 'c-tree-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
2172
2338
  };
2173
2339
  /** Tags dispatching the v-model contract event `update:value` — the value controls (CONTEXT.md). */
2174
- export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-date-picker", "c-modal", "c-number-field", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-time-picker", "c-tree-select"];
2340
+ export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-color-picker", "c-date-picker", "c-file-upload", "c-modal", "c-number-field", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-time-picker", "c-tree-select"];
2175
2341
  declare global {
2176
2342
  interface HTMLElementTagNameMap {
2177
2343
  'c-accordion': CAccordionElement;
@@ -2188,11 +2354,13 @@ declare global {
2188
2354
  'c-card-content': CCardContentElement;
2189
2355
  'c-card-title': CCardTitleElement;
2190
2356
  'c-checkbox': CCheckboxElement;
2357
+ 'c-color-picker': CColorPickerElement;
2191
2358
  'c-csc-logo': CCscLogoElement;
2192
2359
  'c-data-table': CDataTableElement;
2193
2360
  'c-date-picker': CDatePickerElement;
2194
2361
  'c-divider': CDividerElement;
2195
2362
  'c-dropdown': CDropdownElement;
2363
+ 'c-file-upload': CFileUploadElement;
2196
2364
  'c-icon': CIconElement;
2197
2365
  'c-icon-button': CIconButtonElement;
2198
2366
  'c-input': CInputElement;
@@ -4,14 +4,14 @@
4
4
 
5
5
  /** One of the chromatic brand/status families a consumer may re-seed. */
6
6
  export type Family =
7
+ | 'accent'
8
+ | 'error'
9
+ | 'info'
10
+ | 'link'
7
11
  | 'primary'
8
12
  | 'secondary'
9
- | 'accent'
10
13
  | 'success'
11
- | 'info'
12
- | 'warning'
13
- | 'error'
14
- | 'link';
14
+ | 'warning';
15
15
 
16
16
  /** Built-in brand seed (step-500) per family. */
17
17
  export declare const DEFAULT_SEEDS: Record<Family, string>;
@@ -22,8 +22,11 @@ export declare const FAMILIES: readonly Family[];
22
22
  /** Ramp steps, in ascending order (`[50, 100, …, 950]`). */
23
23
  export declare const STEPS: readonly number[];
24
24
 
25
- /** Generate a full 50–950 ramp from a single step-500 seed. */
26
- export declare function ramp(seedHex: string): Record<string, string>;
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;
27
30
 
28
31
  /** The `--c-<family>-*` custom-property map (steps + `-rgb`) for one seed. */
29
32
  export declare function familyVars(
@@ -31,8 +34,5 @@ export declare function familyVars(
31
34
  seedHex: string,
32
35
  ): Record<string, string>;
33
36
 
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;
37
+ /** Generate a full 50–950 ramp from a single step-500 seed. */
38
+ export declare function ramp(seedHex: string): Record<string, string>;
@@ -1,29 +1,5 @@
1
1
  /** The light-or-dark state that selects which palette the semantic tokens resolve to. */
2
2
  export type ThemeMode = 'dark' | 'light';
3
- /**
4
- * Resolve the theme mode in effect for an element, mirroring the cascade in
5
- * `tokens.css`: the nearest enclosing **mode scope** wins (an ancestor-or-self
6
- * carrying `data-theme="light"` or `"dark"`, ADR-0053), an **inverting scope**
7
- * (`data-theme-invert`, ADR-0054) flips whatever it sits in; otherwise the OS
8
- * preference; light where neither is available (server rendering, no
9
- * `matchMedia`). Any other `data-theme` value is inert, exactly as in CSS.
10
- *
11
- * The answer comes from the cascade itself — `--c-mode`, which every mode block
12
- * declares — rather than from walking the DOM. That is the only way to resolve
13
- * an inverting scope without re-implementing the style query, it cannot drift
14
- * from the CSS, and unlike `closest()` it reads correctly for an element INSIDE
15
- * a shadow root, since custom properties inherit across the boundary. The DOM
16
- * walk remains as the fallback for when `tokens.css` has not been loaded: a
17
- * detached node, a server-rendered pass, or a consumer who ships only the
18
- * Tailwind theme export.
19
- *
20
- * Pass the element whose mode you need — a chart inside a dark panel on an
21
- * otherwise light page resolves `dark` only if you ask about the chart.
22
- * `observeThemeMode()` keeps that answer current.
23
- *
24
- * @param root the element to resolve for — defaults to `<html>`
25
- */
26
- export declare function themeMode(root?: Element | null): ThemeMode;
27
3
  /**
28
4
  * Watch the theme mode in effect for an element and report every change.
29
5
  *
@@ -49,3 +25,27 @@ export declare function themeMode(root?: Element | null): ThemeMode;
49
25
  * @returns a disposer that detaches both listeners
50
26
  */
51
27
  export declare function observeThemeMode(target: Element, onChange: (mode: ThemeMode) => 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): ThemeMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-alpha.30",
3
+ "version": "4.0.0-alpha.32",
4
4
  "description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/csc-ui.js",
@@ -30,27 +30,16 @@
30
30
  "vue": "^3.5.39"
31
31
  },
32
32
  "devDependencies": {
33
- "@eslint/js": "^9.28.0",
34
- "@stylistic/eslint-plugin": "^5.7.0",
35
33
  "@tailwindcss/vite": "^4.3.1",
36
34
  "@types/node": "^24.0.0",
37
35
  "@vitejs/plugin-vue": "^6.0.7",
38
36
  "@vitest/browser-playwright": "5.0.0",
39
37
  "custom-element-jet-brains-integration": "^1.7.0",
40
38
  "custom-element-vs-code-integration": "^1.5.0",
41
- "eslint": "^9.28.0",
42
- "eslint-config-prettier": "^10.0.0",
43
- "eslint-import-resolver-typescript": "^4.4.5",
44
- "eslint-plugin-perfectionist": "^5.3.1",
45
- "eslint-plugin-prettier": "^5.5.6",
46
- "eslint-plugin-vue": "^10.9.2",
47
- "globals": "^17.7.0",
48
39
  "playwright": "1.60.0",
49
- "prettier": "^3.8.5",
50
40
  "style-dictionary": "^3.9.0",
51
41
  "tailwindcss": "^4.3.1",
52
42
  "typescript": "^6.0.3",
53
- "typescript-eslint": "^8.62.0",
54
43
  "vite": "^8.1.0",
55
44
  "vitest": "5.0.0",
56
45
  "vue-tsc": "^3.3.5"
@@ -76,11 +65,11 @@
76
65
  "chart:generate": "node scripts/generate-chart-data.mjs",
77
66
  "lint:chart": "node scripts/check-chart-parity.mjs",
78
67
  "lint:focus": "node scripts/check-focus-rings.mjs",
79
- "lint": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart && pnpm run lint:focus",
80
68
  "test": "pnpm run style-dictionary:build && vitest run",
81
69
  "test:watch": "vitest",
82
70
  "test:browser": "vitest run --project browser",
83
71
  "test:node": "vitest run --project node",
84
- "test:update": "pnpm run style-dictionary:build && vitest run --project browser --update"
72
+ "test:update": "pnpm run style-dictionary:build && vitest run --project browser --update",
73
+ "lint:guards": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart && pnpm run lint:focus"
85
74
  }
86
75
  }