@citrusworx/juiceui 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +59 -6
  2. package/dist/components/accordion/accordion.d.ts +2 -1
  3. package/dist/index.css +2767 -328
  4. package/dist/index.d.ts +41 -19
  5. package/dist/index.js +3804 -1967
  6. package/dist/js/juice.d.ts +41 -19
  7. package/dist/js/src/accordion/accordion-runtime.d.ts +6 -0
  8. package/dist/js/src/avatar/avatar-runtime.d.ts +74 -0
  9. package/dist/js/src/banner/banner-runtime.d.ts +5 -0
  10. package/dist/js/src/breadcrumb/breadcrumb-runtime.d.ts +6 -0
  11. package/dist/js/src/checkbox/checkbox-runtime.d.ts +4 -0
  12. package/dist/js/src/combobox/combobox-runtime.d.ts +6 -0
  13. package/dist/js/src/disclosure/disclosure-runtime.d.ts +56 -0
  14. package/dist/js/src/drawer/drawer-runtime.d.ts +11 -0
  15. package/dist/js/src/field/field-runtime.d.ts +58 -0
  16. package/dist/js/src/icon-button/icon-button-runtime.d.ts +67 -0
  17. package/dist/js/src/input/input-runtime.d.ts +63 -0
  18. package/dist/js/src/menu/menu-runtime.d.ts +5 -0
  19. package/dist/js/src/modal/modal-runtime.d.ts +11 -0
  20. package/dist/js/src/nav/navigation.d.ts +5 -0
  21. package/dist/js/src/pagination/pagination-runtime.d.ts +6 -0
  22. package/dist/js/src/popover/popover-runtime.d.ts +10 -0
  23. package/dist/js/src/progress/progress-runtime.d.ts +5 -0
  24. package/dist/js/src/radio/radio-runtime.d.ts +7 -0
  25. package/dist/js/src/select/select-runtime.d.ts +61 -0
  26. package/dist/js/src/shared/change.d.ts +32 -0
  27. package/dist/js/src/shared/motion.d.ts +48 -0
  28. package/dist/js/src/slider/slider-runtime.d.ts +4 -0
  29. package/dist/js/src/spinner/spinner-runtime.d.ts +55 -0
  30. package/dist/js/src/switch/switch-runtime.d.ts +4 -0
  31. package/dist/js/src/table/table-runtime.d.ts +99 -0
  32. package/dist/js/src/tabs/tabs-runtime.d.ts +6 -0
  33. package/dist/js/src/textarea/textarea-runtime.d.ts +59 -0
  34. package/dist/js/src/toast/toast-runtime.d.ts +10 -0
  35. package/dist/js/src/tooltip/tooltip-runtime.d.ts +5 -0
  36. package/dist/js/src/wizard/wizard-runtime.d.ts +4 -0
  37. package/dist/themes/aquaflux.css +318 -0
  38. package/dist/themes/citrusmint.css +317 -0
  39. package/dist/themes/kiwipress.css +317 -0
  40. package/dist/themes/retro-afterburn.css +318 -0
  41. package/dist/themes/retro-arcade-glow.css +318 -0
  42. package/dist/themes/retro-boardwalk.css +585 -56
  43. package/dist/themes/retro-denim-dial.css +318 -0
  44. package/dist/themes/retro-forest-radio.css +318 -0
  45. package/dist/themes/retro-orchard-club.css +318 -0
  46. package/dist/themes/retro-poolside-pop.css +318 -0
  47. package/dist/themes/retro-signal-garden.css +318 -0
  48. package/dist/themes/retro-sunset-motel.css +318 -0
  49. package/dist/themes/retro-violet-parlor.css +318 -0
  50. package/dist/themes/tide.css +318 -0
  51. package/package.json +2 -2
@@ -37,6 +37,10 @@ export type ProgressOptions = {
37
37
  root?: ParentNode;
38
38
  progressSelector?: string;
39
39
  };
40
+ export type ProgressState = {
41
+ value: number;
42
+ indeterminate: boolean;
43
+ };
40
44
  export type ProgressController = {
41
45
  destroy: () => void;
42
46
  sync: () => void;
@@ -44,6 +48,7 @@ export type ProgressController = {
44
48
  getValue: (target?: HTMLElement | null) => number;
45
49
  setIndeterminate: (indeterminate: boolean, target?: HTMLElement | null) => void;
46
50
  isIndeterminate: (target?: HTMLElement | null) => boolean;
51
+ getState: (target?: HTMLElement | null) => ProgressState | null;
47
52
  };
48
53
  export declare const createProgress: (options?: ProgressOptions) => ProgressController;
49
54
  export declare const initProgress: (options?: ProgressOptions) => ProgressController;
@@ -40,11 +40,18 @@ export type RadioOptions = {
40
40
  radiogroupSelector?: string;
41
41
  radioSelector?: string;
42
42
  };
43
+ export type RadioState = {
44
+ /** `value` attribute of the checked radio, or the native value. */
45
+ value: string | null;
46
+ /** Index of the checked radio in the group. `-1` when none are checked. */
47
+ index: number;
48
+ };
43
49
  export type RadioController = {
44
50
  destroy: () => void;
45
51
  sync: () => void;
46
52
  select: (radio?: HTMLElement | null) => void;
47
53
  getChecked: (group?: HTMLElement | null) => HTMLElement | null;
54
+ getState: (target?: HTMLElement | null) => RadioState | null;
48
55
  };
49
56
  export declare const createRadio: (options?: RadioOptions) => RadioController;
50
57
  export declare const initRadio: (options?: RadioOptions) => RadioController;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * DOM-first runtime for Juice native select chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [select] host, on the native element: <select select>.
6
+ * Any attribute value is still a select. Sync does
7
+ * not rewrite the attribute. A node that is not a
8
+ * <select>, including [combobox], is ignored. A
9
+ * <select> without [select] is ignored.
10
+ * [select-label] optional visible label. Pair it with the control
11
+ * (wrapping element, or for/id).
12
+ *
13
+ * The open list stays the platform popup. There is no [select-list]
14
+ * and no [select-option]. [multiple] and size listboxes stay native
15
+ * <select> elements. Sync does not set role, aria-expanded,
16
+ * aria-multiselectable, or tabindex, and it does not build a listbox.
17
+ *
18
+ * Sync (markup-driven):
19
+ * 1. Name the control from a visible label when the author has not
20
+ * set an accessible name. Sources, in order: an associated
21
+ * <label for>, a wrapping <label>, then [select-label] (for/id,
22
+ * a wrapping element, or the nearest preceding sibling).
23
+ * 2. An author aria-label or aria-labelledby is kept. A blank value
24
+ * is not a name. title is left untouched and does not block a
25
+ * visible label.
26
+ * 3. A label that does not contain the control is referenced with
27
+ * aria-labelledby (an id is added only when that label has none).
28
+ * A wrapping label is copied into aria-label as its visible text,
29
+ * excluding the control, so the selected option is not part of
30
+ * the name. Hidden labels and empty text are skipped.
31
+ * 4. When no visible label exists, sync does not invent a name.
32
+ * A name this runtime wrote is removed if that label goes away.
33
+ *
34
+ * Change and keys stay on the native control. There is no keyboard
35
+ * handler, no Escape handler, no focus trap, and no Sig Select factory.
36
+ *
37
+ * Limitations: a custom listbox, keyboard handling, Escape, a focus
38
+ * trap, and a Sig Select factory are out of scope. See
39
+ * docs/juice/juice-select-runtime.md.
40
+ */
41
+ export type SelectOptions = {
42
+ root?: ParentNode;
43
+ selectSelector?: string;
44
+ };
45
+ /**
46
+ * Value changes stay on the native `input` and `change` events.
47
+ * This runtime does not dispatch `juice:change`.
48
+ * `value` is `HTMLSelectElement.value` (the first selected option).
49
+ */
50
+ export type SelectState = {
51
+ value: string;
52
+ };
53
+ export type SelectController = {
54
+ destroy: () => void;
55
+ sync: () => void;
56
+ getState: (target?: HTMLElement | null) => SelectState | null;
57
+ };
58
+ export declare const createSelect: (options?: SelectOptions) => SelectController;
59
+ export declare const initSelect: (options?: SelectOptions) => SelectController;
60
+ export declare const startSelectRuntime: () => SelectController | null;
61
+ export declare const stopSelectRuntime: () => void;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Observable state for Juice runtimes.
3
+ *
4
+ * A runtime dispatches `juice:change` from the widget host when its
5
+ * observable state actually changes. The event bubbles. Detail is
6
+ * `{ runtime, state }`. The first observation of a host is recorded
7
+ * and does not dispatch, so init can normalize ARIA without looking
8
+ * like a change. Pass `baseline` when this note is the first look and
9
+ * it follows a real mutation.
10
+ *
11
+ * Select, input, and textarea do not use this event. Their value
12
+ * changes stay on the native `input` and `change` events.
13
+ */
14
+ export declare const JUICE_CHANGE_EVENT = "juice:change";
15
+ export type JuiceChangeDetail<TState> = {
16
+ runtime: string;
17
+ state: TState;
18
+ };
19
+ export declare const juiceStatesEqual: (left: unknown, right: unknown) => boolean;
20
+ export declare const dispatchJuiceChange: <TState>(host: EventTarget, runtime: string, state: TState) => void;
21
+ export type JuiceChangeNoteOptions<TState> = {
22
+ /**
23
+ * State from before this mutation. Used only when the host has not
24
+ * been observed yet, so the first real change still dispatches.
25
+ */
26
+ baseline?: TState;
27
+ };
28
+ export declare const createJuiceChanges: <TState>(runtime: string) => {
29
+ has: (host: EventTarget) => boolean;
30
+ prime: (host: EventTarget, state: TState) => void;
31
+ note: (host: EventTarget, state: TState, options?: JuiceChangeNoteOptions<TState>) => void;
32
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Shared enter/exit motion for Juice runtimes.
3
+ *
4
+ * `prefersReducedMotion` reads `matchMedia('(prefers-reduced-motion: reduce)')`.
5
+ * It returns false when `matchMedia` is missing (SSR, jsdom) or throws.
6
+ * `subscribeReducedMotion` reports later changes and returns an unsubscribe
7
+ * function. The unsubscribe is a no-op in those same environments.
8
+ *
9
+ * `runMotion` drives one element:
10
+ * enter → data-motion-state="entering", then "entered"
11
+ * exit → data-motion-state="exiting", then "exited"
12
+ * It resolves on `transitionend` or `animationend` whose target is that
13
+ * element. Events that bubble from children are ignored. If the event never
14
+ * arrives, a timeout fires after the computed transition and animation
15
+ * duration plus delay (the longer of the two). Duration 0, or reduced
16
+ * motion, finishes in the same turn (`immediate: true`) so callers can set
17
+ * `hidden` or restore focus before they return. A resolved promise alone
18
+ * would wait a microtask and miss that contract.
19
+ *
20
+ * Pass a `MotionCancelToken` to abandon an in-flight enter or exit. Cancelling
21
+ * does not apply the terminal state. `createElementMotion` keeps one token
22
+ * per element so a later enter or exit replaces the previous one.
23
+ */
24
+ export type MotionState = 'entering' | 'entered' | 'exiting' | 'exited';
25
+ export type MotionDirection = 'enter' | 'exit';
26
+ export type MotionCancelToken = {
27
+ readonly cancelled: boolean;
28
+ cancel: () => void;
29
+ };
30
+ export type MotionResult = {
31
+ /** True when the terminal state was applied before `runMotion` returned. */
32
+ immediate: boolean;
33
+ /** Resolves when the motion finishes or is cancelled. */
34
+ finished: Promise<{
35
+ completed: boolean;
36
+ }>;
37
+ };
38
+ export type MotionPlayer = {
39
+ enter: (element: HTMLElement, onComplete?: () => void, afterStart?: () => void) => void;
40
+ exit: (element: HTMLElement, onComplete?: () => void, afterStart?: () => void) => void;
41
+ cancel: (element: HTMLElement) => void;
42
+ destroy: () => void;
43
+ };
44
+ export declare const prefersReducedMotion: () => boolean;
45
+ export declare const subscribeReducedMotion: (listener: (reduced: boolean) => void) => (() => void);
46
+ export declare const createMotionCancelToken: () => MotionCancelToken;
47
+ export declare const runMotion: (element: HTMLElement, direction: MotionDirection, token?: MotionCancelToken) => MotionResult;
48
+ export declare const createElementMotion: () => MotionPlayer;
@@ -41,6 +41,9 @@ export type SliderOptions = {
41
41
  root?: ParentNode;
42
42
  sliderSelector?: string;
43
43
  };
44
+ export type SliderState = {
45
+ value: number;
46
+ };
44
47
  export type SliderController = {
45
48
  destroy: () => void;
46
49
  sync: () => void;
@@ -48,6 +51,7 @@ export type SliderController = {
48
51
  getValue: (target?: HTMLElement | null) => number;
49
52
  increment: (target?: HTMLElement | null) => void;
50
53
  decrement: (target?: HTMLElement | null) => void;
54
+ getState: (target?: HTMLElement | null) => SliderState | null;
51
55
  };
52
56
  export declare const createSlider: (options?: SliderOptions) => SliderController;
53
57
  export declare const initSlider: (options?: SliderOptions) => SliderController;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * DOM-first indeterminate busy-indicator runtime for Juice spinner chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [spinner] host. The ring is ::before. CSS owns the spin
6
+ * (juice-spinner-spin). prefers-reduced-motion already
7
+ * stops that animation. Any attribute value, including
8
+ * spinner="busy", is still a spinner. Sync does not
9
+ * rewrite the attribute. There is no <spinner> element.
10
+ * A node without [spinner] is ignored.
11
+ * [spinner-label] optional visible text, usually inside the host.
12
+ * Authors own the accessible name. The label is not
13
+ * copied into aria-label or aria-labelledby.
14
+ *
15
+ * Sync (markup-driven):
16
+ * 1. Shown means the host does not have the native hidden attribute.
17
+ * While shown, role="status" and aria-busy="true". An author role
18
+ * that is not status is replaced. The host is not made focusable
19
+ * (no tabindex). There is no keyboard and no pointer handler.
20
+ * 2. Hidden means native hidden. hide() sets that attribute and clears
21
+ * role="status" and aria-busy so the spinner does not announce as
22
+ * busy. show() removes hidden and restores the shown state.
23
+ * Siblings are left alone.
24
+ * 3. When there is no visible [spinner-label], authors supply the
25
+ * accessible name (aria-label or aria-labelledby). This runtime
26
+ * does not invent label text, and it does not rewrite a name the
27
+ * author already set.
28
+ *
29
+ * Not a progress bar: no value, no aria-valuenow, no
30
+ * --juice-progress-ratio. Not a layered overlay: no focus trap, no
31
+ * Escape, no Sig Spinner factory.
32
+ *
33
+ * Limitations: a value, keyboard handling, Escape, a focus trap, and a
34
+ * Sig Spinner factory are out of scope. See
35
+ * docs/juice/juice-spinner-runtime.md.
36
+ */
37
+ export type SpinnerOptions = {
38
+ root?: ParentNode;
39
+ spinnerSelector?: string;
40
+ };
41
+ export type SpinnerState = {
42
+ shown: boolean;
43
+ };
44
+ export type SpinnerController = {
45
+ destroy: () => void;
46
+ sync: () => void;
47
+ show: (target?: HTMLElement | null) => void;
48
+ hide: (target?: HTMLElement | null) => void;
49
+ isShown: (target?: HTMLElement | null) => boolean;
50
+ getState: (target?: HTMLElement | null) => SpinnerState | null;
51
+ };
52
+ export declare const createSpinner: (options?: SpinnerOptions) => SpinnerController;
53
+ export declare const initSpinner: (options?: SpinnerOptions) => SpinnerController;
54
+ export declare const startSpinnerRuntime: () => SpinnerController | null;
55
+ export declare const stopSpinnerRuntime: () => void;
@@ -35,6 +35,9 @@ export type SwitchOptions = {
35
35
  root?: ParentNode;
36
36
  switchSelector?: string;
37
37
  };
38
+ export type SwitchState = {
39
+ checked: boolean;
40
+ };
38
41
  export type SwitchController = {
39
42
  destroy: () => void;
40
43
  sync: () => void;
@@ -43,6 +46,7 @@ export type SwitchController = {
43
46
  uncheck: (target?: HTMLElement | null) => void;
44
47
  setChecked: (checked: boolean, target?: HTMLElement | null) => void;
45
48
  isChecked: (target?: HTMLElement | null) => boolean;
49
+ getState: (target?: HTMLElement | null) => SwitchState | null;
46
50
  };
47
51
  export declare const createSwitch: (options?: SwitchOptions) => SwitchController;
48
52
  export declare const initSwitch: (options?: SwitchOptions) => SwitchController;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * DOM-first sortable headers for Juice table chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [table] host. A real <table>. <div table> is not a
6
+ * host. Sync does not rewrite [table].
7
+ * th[sortable] opt-in header inside that table. [sortable]
8
+ * was free (no other Juice attribute uses it),
9
+ * so the name did not need a [table-sortable]
10
+ * fallback. A sortable cell outside [table] is
11
+ * left alone.
12
+ * [numeric] on the th or on a cell in that column. The
13
+ * column compares as numbers. One numeric cell
14
+ * makes the whole column numeric, including
15
+ * every tbody. Slice A still owns tabular nums.
16
+ * [data-sort-value] on a body cell. Compared instead of the
17
+ * visible text. Parsed as a number when the
18
+ * column is numeric.
19
+ *
20
+ * The runtime wraps each sortable header's contents in
21
+ * <button type="button"> so the header is keyboard and screen-reader
22
+ * operable. Enter and Space stay with the browser: a native button
23
+ * turns them into a click, and a key handler here would sort twice.
24
+ * Wrapping is idempotent. destroy moves the original nodes back out
25
+ * and removes that button. An accessible name is the header text.
26
+ * This runtime does not invent one.
27
+ *
28
+ * Activation cycles that column ascending -> descending -> none.
29
+ * Single-column sort. The active th gets aria-sort="ascending" or
30
+ * "descending". Every other sortable th in the table gets
31
+ * aria-sort="none". An author aria-sort of ascending or descending is
32
+ * adopted as the initial state and is not a client reorder (server
33
+ * HTML can already be sorted). The next activation continues the cycle.
34
+ *
35
+ * Each tbody is reordered on its own. The original row order is the
36
+ * DOM order first observed while this runtime is not itself holding a
37
+ * client sort. Rows first seen during a client sort are appended to
38
+ * that memory. direction "none" puts the memory back. Sort is stable:
39
+ * equal keys keep original order.
40
+ *
41
+ * Comparison, in order:
42
+ * 1. data-sort-value when that attribute is present (trimmed).
43
+ * 2. Otherwise the cell's text, whitespace collapsed and trimmed.
44
+ * 3. Numeric columns use a finite decimal parse (commas removed).
45
+ * Values that do not parse sort after every number, in both
46
+ * directions, and tie with each other.
47
+ * 4. Text columns use Intl.Collator numeric: true, sensitivity:
48
+ * "base" (case-insensitive, natural numeric).
49
+ *
50
+ * Column identity is the header's cellIndex. Colspan and rowspan are
51
+ * not expanded into a visual grid. A body cell is the cell at that
52
+ * same cellIndex, or empty when the row has no cell there. A colspan
53
+ * on an earlier cell shifts later cellIndexes, so the sorted value can
54
+ * disagree with the painted column. Put one cell per column in each
55
+ * body row when the sort must follow the painted grid. Sortable
56
+ * headers belong in thead. A th[sortable] inside tbody is not special:
57
+ * its row is sorted with the other rows of that tbody.
58
+ *
59
+ * Before a reorder, the table dispatches a bubbling cancelable
60
+ * juice:sort CustomEvent. detail is { column, direction } where column
61
+ * is the activated header's cellIndex even when direction is "none".
62
+ * If defaultPrevented, aria-sort and state still update and rows stay
63
+ * put (server-side sort). sync() while that canceled sort is current
64
+ * refreshes the remembered order from the DOM and still does not
65
+ * reorder. The next activation that is not canceled sorts from the
66
+ * DOM order at that moment.
67
+ *
68
+ * State is { column: number | null, direction }. column is null when
69
+ * direction is "none", and is the header cellIndex otherwise. The
70
+ * first observation does not dispatch. Later changes dispatch a
71
+ * bubbling juice:change CustomEvent with detail
72
+ * { runtime: "table", state }. sync() re-reads headers and rows,
73
+ * wraps new sortable headers, and re-applies a client sort so rows
74
+ * added later join it.
75
+ *
76
+ * destroy restores original contents, restores row order when this
77
+ * runtime had reordered them, and puts author aria-sort back. Shared
78
+ * sort memory is cleared, so a second live controller re-reads the
79
+ * restored DOM on its next sync. No Sig Table factory.
80
+ */
81
+ export type TableOptions = {
82
+ root?: ParentNode;
83
+ tableSelector?: string;
84
+ sortableSelector?: string;
85
+ };
86
+ export type TableSortDirection = 'ascending' | 'descending' | 'none';
87
+ export type TableState = {
88
+ column: number | null;
89
+ direction: TableSortDirection;
90
+ };
91
+ export type TableController = {
92
+ destroy: () => void;
93
+ sync: () => void;
94
+ getState: (target?: HTMLElement | null) => TableState | null;
95
+ };
96
+ export declare const createTable: (options?: TableOptions) => TableController;
97
+ export declare const initTable: (options?: TableOptions) => TableController;
98
+ export declare const startTableRuntime: () => TableController | null;
99
+ export declare const stopTableRuntime: () => void;
@@ -5,10 +5,16 @@ export type TabsOptions = {
5
5
  triggerSelector?: string;
6
6
  panelSelector?: string;
7
7
  };
8
+ /** `selected` is the trigger index. `-1` when the tab list is empty. */
9
+ export type TabsState = {
10
+ selected: number;
11
+ };
8
12
  export type TabsController = {
9
13
  destroy: () => void;
10
14
  sync: () => void;
11
15
  select: (trigger?: HTMLElement | null) => void;
16
+ selected: (target?: HTMLElement | null) => HTMLElement | null;
17
+ getState: (target?: HTMLElement | null) => TabsState | null;
12
18
  };
13
19
  export declare const createTabs: (options?: TabsOptions) => TabsController;
14
20
  export declare const initTabs: (options?: TabsOptions) => TabsController;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * DOM-first runtime for Juice native textarea chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [textarea] host, on the native element: <textarea textarea>.
6
+ * Any attribute value is still a textarea. Sync does
7
+ * not rewrite the attribute. A node that is not a
8
+ * <textarea> is ignored. A <textarea> without
9
+ * [textarea] is ignored. A textarea inside [combobox],
10
+ * including [combobox-input], is ignored.
11
+ * [textarea-label] optional visible label. Pair it with the control
12
+ * (wrapping element, or for/id).
13
+ *
14
+ * Sync (markup-driven):
15
+ * 1. Name the control from a visible label when the author has not
16
+ * set an accessible name. Sources, in order: an associated
17
+ * <label for>, a wrapping <label>, then [textarea-label] (for/id,
18
+ * a wrapping element, or the nearest preceding sibling).
19
+ * 2. An author aria-label or aria-labelledby is kept. A blank value
20
+ * is not a name. title is left untouched and does not block a
21
+ * visible label.
22
+ * 3. A label that does not contain the control is referenced with
23
+ * aria-labelledby (an id is added only when that label has none).
24
+ * A wrapping label is copied into aria-label as its visible text,
25
+ * excluding the control, so the textarea's own value is not part
26
+ * of the name. Hidden labels and empty text are skipped.
27
+ * 4. When no visible label exists, sync does not invent a name.
28
+ * A name this runtime wrote is removed if that label goes away
29
+ * or the host stops being a [textarea] textarea.
30
+ *
31
+ * Typing, change, and keys stay on the native control. There is no
32
+ * auto-grow, no character count, no validation engine, no floating
33
+ * label, no keyboard handler, no Escape handler, no focus trap, and
34
+ * no Sig Textarea factory.
35
+ *
36
+ * Limitations: auto-grow, a character count, validation, a floating
37
+ * label, keyboard handling, Escape, a focus trap, and a Sig Textarea
38
+ * factory are out of scope. See docs/juice/juice-textarea-runtime.md.
39
+ */
40
+ export type TextareaOptions = {
41
+ root?: ParentNode;
42
+ textareaSelector?: string;
43
+ };
44
+ /**
45
+ * Value changes stay on the native `input` and `change` events.
46
+ * This runtime does not dispatch `juice:change`.
47
+ */
48
+ export type TextareaState = {
49
+ value: string;
50
+ };
51
+ export type TextareaController = {
52
+ destroy: () => void;
53
+ sync: () => void;
54
+ getState: (target?: HTMLElement | null) => TextareaState | null;
55
+ };
56
+ export declare const createTextarea: (options?: TextareaOptions) => TextareaController;
57
+ export declare const initTextarea: (options?: TextareaOptions) => TextareaController;
58
+ export declare const startTextareaRuntime: () => TextareaController | null;
59
+ export declare const stopTextareaRuntime: () => void;
@@ -4,6 +4,11 @@
4
4
  * Markup contract (authors place the region — this is not a portal):
5
5
  * [toast-region] > [toast] + [toast-title]? + [toast-body]? + [toast-close]?
6
6
  * Individual toasts use native `hidden` when dismissed. The region stays in the DOM.
7
+ * Enter removes `hidden`, then plays. Exit plays first; `hidden` is set
8
+ * only after it finishes. Reduced motion (or a zero computed duration)
9
+ * does both in the same turn. Showing a toast that is exiting cancels
10
+ * the exit and leaves it open. Auto-dismiss duration is reading time,
11
+ * not motion: reduced motion does not shorten `toast-duration`.
7
12
  *
8
13
  * Toast is NOT a dialog:
9
14
  * - no focus trap, no aria-modal, no exclusive "one toast only"
@@ -36,11 +41,16 @@ export type ToastOptions = {
36
41
  closeSelector?: string;
37
42
  defaultDuration?: number;
38
43
  };
44
+ export type ToastState = {
45
+ shown: boolean;
46
+ };
39
47
  export type ToastController = {
40
48
  destroy: () => void;
41
49
  sync: () => void;
42
50
  show: (target?: HTMLElement | null) => void;
43
51
  dismiss: (target?: HTMLElement | null) => void;
52
+ isShown: (target?: HTMLElement | null) => boolean;
53
+ getState: (target?: HTMLElement | null) => ToastState | null;
44
54
  };
45
55
  export declare const createToast: (options?: ToastOptions) => ToastController;
46
56
  export declare const initToast: (options?: ToastOptions) => ToastController;
@@ -48,11 +48,16 @@ export type TooltipOptions = {
48
48
  gap?: number;
49
49
  hideDelay?: number;
50
50
  };
51
+ export type TooltipState = {
52
+ shown: boolean;
53
+ };
51
54
  export type TooltipController = {
52
55
  destroy: () => void;
53
56
  sync: () => void;
54
57
  show: (target?: HTMLElement | null) => void;
55
58
  hide: (target?: HTMLElement | null) => void;
59
+ isShown: (target?: HTMLElement | null) => boolean;
60
+ getState: (target?: HTMLElement | null) => TooltipState | null;
56
61
  };
57
62
  export declare const createTooltip: (options?: TooltipOptions) => TooltipController;
58
63
  export declare const initTooltip: (options?: TooltipOptions) => TooltipController;
@@ -40,6 +40,9 @@ export type WizardOptions = {
40
40
  prevSelector?: string;
41
41
  completeSelector?: string;
42
42
  };
43
+ export type WizardState = {
44
+ current: number;
45
+ };
43
46
  export type WizardController = {
44
47
  destroy: () => void;
45
48
  sync: () => void;
@@ -47,6 +50,7 @@ export type WizardController = {
47
50
  prev: (target?: HTMLElement | null) => void;
48
51
  goTo: (step: number | string, target?: HTMLElement | null) => void;
49
52
  current: (target?: HTMLElement | null) => number;
53
+ getState: (target?: HTMLElement | null) => WizardState | null;
50
54
  };
51
55
  export declare const createWizard: (options?: WizardOptions) => WizardController;
52
56
  export declare const initWizard: (options?: WizardOptions) => WizardController;