@citrusworx/juiceui 0.7.0 → 0.9.0
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 +117 -2
- package/dist/index.css +3076 -206
- package/dist/index.d.ts +22 -0
- package/dist/index.js +2353 -308
- package/dist/js/juice.d.ts +22 -0
- package/dist/js/src/banner/banner-runtime.d.ts +40 -0
- package/dist/js/src/breadcrumb/breadcrumb-runtime.d.ts +64 -0
- package/dist/js/src/checkbox/checkbox-runtime.d.ts +51 -0
- package/dist/js/src/combobox/combobox-runtime.d.ts +75 -0
- package/dist/js/src/menu/menu-runtime.d.ts +64 -0
- package/dist/js/src/popover/popover-runtime.d.ts +5 -3
- package/dist/js/src/progress/progress-runtime.d.ts +51 -0
- package/dist/js/src/radio/radio-runtime.d.ts +52 -0
- package/dist/js/src/shared/events.d.ts +7 -0
- package/dist/js/src/shared/focus.d.ts +7 -0
- package/dist/js/src/shared/ids.d.ts +7 -0
- package/dist/js/src/shared/overlays.d.ts +14 -0
- package/dist/js/src/slider/slider-runtime.d.ts +55 -0
- package/dist/js/src/switch/switch-runtime.d.ts +50 -0
- package/dist/js/src/toast/toast-runtime.d.ts +4 -1
- package/dist/js/src/tooltip/tooltip-runtime.d.ts +60 -0
- package/dist/js/src/wizard/wizard-runtime.d.ts +54 -0
- package/dist/themes/aquaflux.css +597 -0
- package/dist/themes/citrusmint.css +551 -0
- package/dist/themes/kiwipress.css +644 -28
- package/dist/themes/tide.css +599 -0
- package/package.json +1 -1
package/dist/js/juice.d.ts
CHANGED
|
@@ -12,3 +12,25 @@ export { createToast, initToast, startToastRuntime, stopToastRuntime } from "./s
|
|
|
12
12
|
export type { ToastController, ToastOptions } from "./src/toast/toast-runtime.js";
|
|
13
13
|
export { createPopover, initPopover, startPopoverRuntime, stopPopoverRuntime } from "./src/popover/popover-runtime.js";
|
|
14
14
|
export type { PopoverController, PopoverOptions, PopoverPlacement } from "./src/popover/popover-runtime.js";
|
|
15
|
+
export { createTooltip, initTooltip, startTooltipRuntime, stopTooltipRuntime } from "./src/tooltip/tooltip-runtime.js";
|
|
16
|
+
export type { TooltipController, TooltipOptions, TooltipPlacement } from "./src/tooltip/tooltip-runtime.js";
|
|
17
|
+
export { createWizard, initWizard, startWizardRuntime, stopWizardRuntime } from "./src/wizard/wizard-runtime.js";
|
|
18
|
+
export type { WizardController, WizardOptions } from "./src/wizard/wizard-runtime.js";
|
|
19
|
+
export { createCombobox, initCombobox, startComboboxRuntime, stopComboboxRuntime } from "./src/combobox/combobox-runtime.js";
|
|
20
|
+
export type { ComboboxController, ComboboxOptions } from "./src/combobox/combobox-runtime.js";
|
|
21
|
+
export { createBanner, initBanner, startBannerRuntime, stopBannerRuntime } from "./src/banner/banner-runtime.js";
|
|
22
|
+
export type { BannerController, BannerOptions } from "./src/banner/banner-runtime.js";
|
|
23
|
+
export { createMenu, initMenu, startMenuRuntime, stopMenuRuntime } from "./src/menu/menu-runtime.js";
|
|
24
|
+
export type { MenuController, MenuOptions } from "./src/menu/menu-runtime.js";
|
|
25
|
+
export { createSwitch, initSwitch, startSwitchRuntime, stopSwitchRuntime } from "./src/switch/switch-runtime.js";
|
|
26
|
+
export type { SwitchController, SwitchOptions } from "./src/switch/switch-runtime.js";
|
|
27
|
+
export { createSlider, initSlider, startSliderRuntime, stopSliderRuntime } from "./src/slider/slider-runtime.js";
|
|
28
|
+
export type { SliderController, SliderOptions } from "./src/slider/slider-runtime.js";
|
|
29
|
+
export { createCheckbox, initCheckbox, startCheckboxRuntime, stopCheckboxRuntime } from "./src/checkbox/checkbox-runtime.js";
|
|
30
|
+
export type { CheckboxController, CheckboxOptions } from "./src/checkbox/checkbox-runtime.js";
|
|
31
|
+
export { createRadio, initRadio, startRadioRuntime, stopRadioRuntime } from "./src/radio/radio-runtime.js";
|
|
32
|
+
export type { RadioController, RadioOptions } from "./src/radio/radio-runtime.js";
|
|
33
|
+
export { createBreadcrumb, initBreadcrumb, startBreadcrumbRuntime, stopBreadcrumbRuntime } from "./src/breadcrumb/breadcrumb-runtime.js";
|
|
34
|
+
export type { BreadcrumbController, BreadcrumbOptions } from "./src/breadcrumb/breadcrumb-runtime.js";
|
|
35
|
+
export { createProgress, initProgress, startProgressRuntime, stopProgressRuntime } from "./src/progress/progress-runtime.js";
|
|
36
|
+
export type { ProgressController, ProgressOptions } from "./src/progress/progress-runtime.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first banner dismiss runtime for Juice banner chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (authors place the callout — this is not a portal):
|
|
5
|
+
* [banner] / [banner="full"] + [banner-body]? + [banner-close]?
|
|
6
|
+
* Optional status: [banner-tone="info|success|warning|error"]
|
|
7
|
+
* Closed banners use native `hidden`. The node stays in the DOM.
|
|
8
|
+
*
|
|
9
|
+
* Banner is NOT a dialog and NOT a toast stack:
|
|
10
|
+
* - no focus trap, no aria-modal, no overlay, no [banner-region]
|
|
11
|
+
* - no auto-dismiss timer; the banner stays until dismiss
|
|
12
|
+
* - show() never hides siblings
|
|
13
|
+
* - do not move focus into the banner on show
|
|
14
|
+
*
|
|
15
|
+
* Escape is left to modal / drawer / popover / toast. Banner is inline
|
|
16
|
+
* and not a dialog; v1 does not steal Escape for focused banners.
|
|
17
|
+
*
|
|
18
|
+
* Persist (lean): optional banner-persist="session|local" plus a `name`
|
|
19
|
+
* or `id` key remembers dismiss in sessionStorage / localStorage.
|
|
20
|
+
* Without persist, or without a name/id, dismiss is in-memory only.
|
|
21
|
+
*
|
|
22
|
+
* Live role: sync fills role="status" for info / success / neutral, and
|
|
23
|
+
* role="alert" for error / warning. Empty close controls get
|
|
24
|
+
* aria-label="Dismiss".
|
|
25
|
+
*/
|
|
26
|
+
export type BannerOptions = {
|
|
27
|
+
root?: ParentNode;
|
|
28
|
+
bannerSelector?: string;
|
|
29
|
+
closeSelector?: string;
|
|
30
|
+
};
|
|
31
|
+
export type BannerController = {
|
|
32
|
+
destroy: () => void;
|
|
33
|
+
sync: () => void;
|
|
34
|
+
show: (target?: HTMLElement | null) => void;
|
|
35
|
+
dismiss: (target?: HTMLElement | null) => void;
|
|
36
|
+
};
|
|
37
|
+
export declare const createBanner: (options?: BannerOptions) => BannerController;
|
|
38
|
+
export declare const initBanner: (options?: BannerOptions) => BannerController;
|
|
39
|
+
export declare const startBannerRuntime: () => BannerController | null;
|
|
40
|
+
export declare const stopBannerRuntime: () => void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light DOM-first breadcrumb runtime for Juice breadcrumb chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [breadcrumb] trail root. Authors use <nav breadcrumb> or
|
|
6
|
+
* <ol breadcrumb>.
|
|
7
|
+
* [breadcrumb-item] one crumb. Separator is CSS on every item
|
|
8
|
+
* except the last.
|
|
9
|
+
* [breadcrumb-link] optional. Anchors inside the trail are enough.
|
|
10
|
+
* [breadcrumb-separator]
|
|
11
|
+
* optional explicit separator. Authors own it.
|
|
12
|
+
*
|
|
13
|
+
* This is chrome, not a router. v1 does not listen to history, clicks,
|
|
14
|
+
* or the keyboard. It claims no events (no createEventClaim). There is
|
|
15
|
+
* no Escape handler, no focus trap, and no overlay.
|
|
16
|
+
*
|
|
17
|
+
* Sync (markup-driven):
|
|
18
|
+
* 1. Make the root a navigation landmark only when that is safe.
|
|
19
|
+
* - <nav> is already a landmark. Do not add a redundant
|
|
20
|
+
* role="navigation".
|
|
21
|
+
* - An element with no role that is not a list (ol / ul / menu)
|
|
22
|
+
* gets role="navigation". role="navigation" on a list would
|
|
23
|
+
* drop the list semantics, so <ol breadcrumb> is left alone.
|
|
24
|
+
* - An author role is never overwritten.
|
|
25
|
+
* - Ancestor <nav> elements are not relabeled. A parent nav may
|
|
26
|
+
* be a larger landmark than this trail.
|
|
27
|
+
* 2. Name that landmark only when it has no accessible name.
|
|
28
|
+
* APG's breadcrumb pattern puts the trail in a navigation
|
|
29
|
+
* landmark labeled "Breadcrumb" (aria-label or aria-labelledby).
|
|
30
|
+
* When the root is a navigation landmark and aria-label,
|
|
31
|
+
* aria-labelledby, and title are all missing or blank, sync sets
|
|
32
|
+
* aria-label="Breadcrumb". A non-empty author name is kept.
|
|
33
|
+
* Lists and other non-navigation roots are not given that label.
|
|
34
|
+
* 3. Keep a single aria-current="page" inside the trail.
|
|
35
|
+
* Crumbs are owned [breadcrumb-item] elements. When a trail has
|
|
36
|
+
* none, direct-child anchors and [breadcrumb-link] elements are
|
|
37
|
+
* the crumbs (the same flat markup the chrome styles).
|
|
38
|
+
* If the author already set aria-current="page", the first one
|
|
39
|
+
* in tree order stays and any others in this trail are removed.
|
|
40
|
+
* If none is set and the trail has crumbs, the last crumb is
|
|
41
|
+
* marked. A crumb that contains a link is marked on that link
|
|
42
|
+
* (the last owned anchor or [breadcrumb-link]); otherwise the
|
|
43
|
+
* crumb element itself is marked.
|
|
44
|
+
* 4. Do not rewrite the current crumb's href, click behavior, or
|
|
45
|
+
* disabled state. Authors own whether the current page is a link.
|
|
46
|
+
*
|
|
47
|
+
* setCurrent(item | index, trail?) moves that single current. An index
|
|
48
|
+
* applies to the given trail, or the first trail when trail is omitted.
|
|
49
|
+
* It is not a navigation.
|
|
50
|
+
*/
|
|
51
|
+
export type BreadcrumbOptions = {
|
|
52
|
+
root?: ParentNode;
|
|
53
|
+
breadcrumbSelector?: string;
|
|
54
|
+
itemSelector?: string;
|
|
55
|
+
};
|
|
56
|
+
export type BreadcrumbController = {
|
|
57
|
+
destroy: () => void;
|
|
58
|
+
sync: () => void;
|
|
59
|
+
setCurrent: (itemOrIndex: HTMLElement | number, trail?: HTMLElement | null) => void;
|
|
60
|
+
};
|
|
61
|
+
export declare const createBreadcrumb: (options?: BreadcrumbOptions) => BreadcrumbController;
|
|
62
|
+
export declare const initBreadcrumb: (options?: BreadcrumbOptions) => BreadcrumbController;
|
|
63
|
+
export declare const startBreadcrumbRuntime: () => BreadcrumbController | null;
|
|
64
|
+
export declare const stopBreadcrumbRuntime: () => void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Checkbox runtime for Juice checkbox chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [checkbox] on the control host. Primary host is
|
|
6
|
+
* <button type="button" checkbox>. Visible labels live beside the
|
|
7
|
+
* control (wrapping <label>, aria-label, or aria-labelledby) — the
|
|
8
|
+
* host *is* the box. The checkmark is a CSS pseudo-element; there
|
|
9
|
+
* is no [checkbox-box] child.
|
|
10
|
+
*
|
|
11
|
+
* Hosts this runtime enhances:
|
|
12
|
+
* - HTMLButtonElement (primary). Sync fills role="checkbox",
|
|
13
|
+
* aria-checked "true"|"false", and type="button" when type is
|
|
14
|
+
* missing (so a form does not submit).
|
|
15
|
+
* - HTMLInputElement type="checkbox" (secondary). Chrome already
|
|
16
|
+
* paints :checked. Sync fills role="checkbox" and keeps
|
|
17
|
+
* aria-checked in lockstep with the native checked property
|
|
18
|
+
* (change events, and a static aria-checked="true" on an
|
|
19
|
+
* unchecked box is promoted onto .checked so :checked paint
|
|
20
|
+
* matches). This is not a form-checkbox restyle as the only
|
|
21
|
+
* story, and it is not menuitemcheckbox or [switch].
|
|
22
|
+
*
|
|
23
|
+
* Other [checkbox] hosts (div, span, text inputs, radios) are ignored.
|
|
24
|
+
* Do not invent accessible names — authors must supply aria-label,
|
|
25
|
+
* aria-labelledby, or visible text.
|
|
26
|
+
*
|
|
27
|
+
* v1 is binary. aria-checked="mixed" and any other value coerce to
|
|
28
|
+
* "false". There is no tri-state, no focus trap, and no Escape
|
|
29
|
+
* handling (not a layered overlay).
|
|
30
|
+
*
|
|
31
|
+
* Click and Enter/Space toggle. Native disabled or aria-disabled="true"
|
|
32
|
+
* is ignored. Button click preventDefault stops accidental submit when
|
|
33
|
+
* type is still the default.
|
|
34
|
+
*/
|
|
35
|
+
export type CheckboxOptions = {
|
|
36
|
+
root?: ParentNode;
|
|
37
|
+
checkboxSelector?: string;
|
|
38
|
+
};
|
|
39
|
+
export type CheckboxController = {
|
|
40
|
+
destroy: () => void;
|
|
41
|
+
sync: () => void;
|
|
42
|
+
toggle: (target?: HTMLElement | null) => void;
|
|
43
|
+
check: (target?: HTMLElement | null) => void;
|
|
44
|
+
uncheck: (target?: HTMLElement | null) => void;
|
|
45
|
+
setChecked: (checked: boolean, target?: HTMLElement | null) => void;
|
|
46
|
+
isChecked: (target?: HTMLElement | null) => boolean;
|
|
47
|
+
};
|
|
48
|
+
export declare const createCheckbox: (options?: CheckboxOptions) => CheckboxController;
|
|
49
|
+
export declare const initCheckbox: (options?: CheckboxOptions) => CheckboxController;
|
|
50
|
+
export declare const startCheckboxRuntime: () => CheckboxController | null;
|
|
51
|
+
export declare const stopCheckboxRuntime: () => void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first combobox runtime for Juice combobox chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [combobox] > [combobox-input] + [combobox-trigger]? +
|
|
6
|
+
* [combobox-list] > [combobox-option]+
|
|
7
|
+
* Closed vs open is the native `hidden` attribute on [combobox-list].
|
|
8
|
+
*
|
|
9
|
+
* This is an editable combobox with a listbox popup (APG list
|
|
10
|
+
* autocomplete, manual selection). It is not a native <select>
|
|
11
|
+
* polyfill, not a popover, not a tooltip, and not a dialog overlay.
|
|
12
|
+
* Single-select only. No async/remote fetch, no creatable options,
|
|
13
|
+
* no multi-select, no Floating UI.
|
|
14
|
+
*
|
|
15
|
+
* Accessibility (honest v1):
|
|
16
|
+
* [combobox-input] role="combobox" aria-autocomplete="list"
|
|
17
|
+
* aria-expanded aria-controls aria-activedescendant
|
|
18
|
+
* [combobox-list] role="listbox"
|
|
19
|
+
* [combobox-option] role="option" + guaranteed id on sync
|
|
20
|
+
* Focus stays on the input. Visual focus on options is
|
|
21
|
+
* `aria-activedescendant` plus `combobox-option="active"` paint.
|
|
22
|
+
* Committed choice is `aria-selected="true"`.
|
|
23
|
+
*
|
|
24
|
+
* Open on input focus, typing, or trigger click. Close on Escape
|
|
25
|
+
* (yields when an open [modal-overlay], [drawer-overlay],
|
|
26
|
+
* [popover-root], or [menu] exists — those surfaces own Escape first;
|
|
27
|
+
* menu sits with popover in the dialog-adjacent band),
|
|
28
|
+
* outside click, blur (option mousedown preventDefault so the input
|
|
29
|
+
* keeps focus through click-to-select), or after select.
|
|
30
|
+
*
|
|
31
|
+
* Filter: case-insensitive substring against option text and, when
|
|
32
|
+
* present, `data-value`. Non-matches get `hidden` on the option.
|
|
33
|
+
* An empty match set stays open with no visible options.
|
|
34
|
+
*
|
|
35
|
+
* Keyboard (list autocomplete, manual selection):
|
|
36
|
+
* ArrowDown / ArrowUp open if needed; move active among visible
|
|
37
|
+
* options (no wrap)
|
|
38
|
+
* Home / End first / last visible option while open
|
|
39
|
+
* (closed: native input cursor)
|
|
40
|
+
* Enter select the active option
|
|
41
|
+
* Escape close (yields to open dialog / popover / menu)
|
|
42
|
+
* Tab close without committing the active option
|
|
43
|
+
* (APG manual selection). Focus moves on.
|
|
44
|
+
*
|
|
45
|
+
* Select: input value becomes option text, or `data-value` when that
|
|
46
|
+
* attribute is present. Chosen option gets `aria-selected="true"`;
|
|
47
|
+
* others are cleared. Closing (including after select, Tab, or
|
|
48
|
+
* Escape) clears `combobox-option="active"` and aria-activedescendant
|
|
49
|
+
* so a later Enter cannot commit a stale option.
|
|
50
|
+
*
|
|
51
|
+
* Trigger toggles the list. `aria-expanded` is written on the input
|
|
52
|
+
* and, when present, the trigger. Opening one managed combobox closes
|
|
53
|
+
* the others. Placement stays CSS (`[combobox-list]` is absolute
|
|
54
|
+
* under the field at z-index 1050).
|
|
55
|
+
*/
|
|
56
|
+
export type ComboboxOptions = {
|
|
57
|
+
root?: ParentNode;
|
|
58
|
+
rootSelector?: string;
|
|
59
|
+
inputSelector?: string;
|
|
60
|
+
triggerSelector?: string;
|
|
61
|
+
listSelector?: string;
|
|
62
|
+
optionSelector?: string;
|
|
63
|
+
};
|
|
64
|
+
export type ComboboxController = {
|
|
65
|
+
destroy: () => void;
|
|
66
|
+
sync: () => void;
|
|
67
|
+
open: (target?: HTMLElement | null) => void;
|
|
68
|
+
close: (target?: HTMLElement | null) => void;
|
|
69
|
+
toggle: (target?: HTMLElement | null) => void;
|
|
70
|
+
select: (target?: HTMLElement | null) => void;
|
|
71
|
+
};
|
|
72
|
+
export declare const createCombobox: (options?: ComboboxOptions) => ComboboxController;
|
|
73
|
+
export declare const initCombobox: (options?: ComboboxOptions) => ComboboxController;
|
|
74
|
+
export declare const startComboboxRuntime: () => ComboboxController | null;
|
|
75
|
+
export declare const stopComboboxRuntime: () => void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Menu Button runtime for Juice menu chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [menu-root] > opener + [menu][hidden] > [menuitem]+ /
|
|
6
|
+
* [menu-separator]? / [menu-label]?
|
|
7
|
+
* Closed vs open is the native `hidden` attribute on `[menu]`, not on
|
|
8
|
+
* `[menu-root]` (hiding the root would hide the opener).
|
|
9
|
+
*
|
|
10
|
+
* Opener: prefer `[menu-button]` inside the root. Authors may omit that
|
|
11
|
+
* attr for CTA styling and use a plain button/control inside the root.
|
|
12
|
+
* Pairing: `aria-haspopup="menu"` + `aria-controls` → the `[menu]` id
|
|
13
|
+
* (runtime fills missing).
|
|
14
|
+
*
|
|
15
|
+
* This is an APG **Menu Button** (opener toggles a menu of menuitems).
|
|
16
|
+
* It is not a popover, not a combobox, not a native <select> restyle,
|
|
17
|
+
* not a menubar, and not a context menu. No submenus or typeahead in v1.
|
|
18
|
+
* Placement stays CSS-absolute on `[menu-root]` (`top|bottom|left|right`,
|
|
19
|
+
* default bottom). No Floating UI. No `aria-modal`.
|
|
20
|
+
*
|
|
21
|
+
* Keyboard focus (honest v1): **roving tabindex** on `[menuitem]`.
|
|
22
|
+
* Combobox keeps focus on the input and uses `aria-activedescendant`
|
|
23
|
+
* because the text field must remain the active element. APG Menu Button
|
|
24
|
+
* moves focus onto the menuitem itself (ArrowUp/Down, Home/End move
|
|
25
|
+
* `tabindex="0"` plus `menuitem="active"` paint). This runtime follows
|
|
26
|
+
* that pattern. Separators and labels are skipped. Disabled items
|
|
27
|
+
* (`aria-disabled="true"` or native `disabled`) are skipped.
|
|
28
|
+
*
|
|
29
|
+
* Open on opener click / Enter / Space (native buttons use click).
|
|
30
|
+
* ArrowDown on a closed opener opens and focuses the first enabled item
|
|
31
|
+
* (or the previously active item). ArrowUp opens onto the last enabled
|
|
32
|
+
* item. Close on Escape (yields when an open [modal-overlay] or
|
|
33
|
+
* [drawer-overlay] exists — menu sits with popover in the dialog-adjacent
|
|
34
|
+
* band), outside click, Tab (closes without activating; focus returns
|
|
35
|
+
* to the opener so Tab's default can move to the next/previous control),
|
|
36
|
+
* or after activating an item. Activating an item clicks it and restores
|
|
37
|
+
* focus to the opener. Disabled items are intercepted on capture so
|
|
38
|
+
* author click handlers never run. Opening one managed menu closes the
|
|
39
|
+
* others. Modal / drawer / popover are not auto-closed. ArrowUp/Down on
|
|
40
|
+
* a closed menu apply only to the opener. A controller claims opener
|
|
41
|
+
* clicks only when it can resolve a panel (custom `menuSelector` can
|
|
42
|
+
* coexist with the auto singleton).
|
|
43
|
+
*/
|
|
44
|
+
export type MenuOptions = {
|
|
45
|
+
root?: ParentNode;
|
|
46
|
+
rootSelector?: string;
|
|
47
|
+
buttonSelector?: string;
|
|
48
|
+
menuSelector?: string;
|
|
49
|
+
itemSelector?: string;
|
|
50
|
+
separatorSelector?: string;
|
|
51
|
+
labelSelector?: string;
|
|
52
|
+
};
|
|
53
|
+
export type MenuController = {
|
|
54
|
+
destroy: () => void;
|
|
55
|
+
sync: () => void;
|
|
56
|
+
open: (target?: HTMLElement | null) => void;
|
|
57
|
+
close: (target?: HTMLElement | null) => void;
|
|
58
|
+
toggle: (target?: HTMLElement | null) => void;
|
|
59
|
+
select: (target?: HTMLElement | null) => void;
|
|
60
|
+
};
|
|
61
|
+
export declare const createMenu: (options?: MenuOptions) => MenuController;
|
|
62
|
+
export declare const initMenu: (options?: MenuOptions) => MenuController;
|
|
63
|
+
export declare const startMenuRuntime: () => MenuController | null;
|
|
64
|
+
export declare const stopMenuRuntime: () => void;
|
|
@@ -31,9 +31,11 @@
|
|
|
31
31
|
*
|
|
32
32
|
* Escape closes the open popover on bubble (after modal/drawer capture),
|
|
33
33
|
* and also yields when an open [modal-overlay] or [drawer-overlay] exists
|
|
34
|
-
* or the event is already defaultPrevented (
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* or the event is already defaultPrevented (those dialogs own Escape).
|
|
35
|
+
* Menu sits in the same dialog-adjacent band as popover (peers do not
|
|
36
|
+
* yield to each other). Combobox / toast / tooltip yield to an open
|
|
37
|
+
* popover or menu. Opening one managed popover closes the others. Modal
|
|
38
|
+
* / drawer / menu are not auto-closed.
|
|
37
39
|
*/
|
|
38
40
|
export type PopoverPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
39
41
|
export type PopoverOptions = {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Progressbar runtime for Juice progress chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [progress] track host. Boolean (determinate) or
|
|
6
|
+
* progress="indeterminate". Any other value is
|
|
7
|
+
* determinate chrome; sync does not rewrite it.
|
|
8
|
+
* Authors write <div progress>, not <progress>.
|
|
9
|
+
* A native <progress> without the attribute is
|
|
10
|
+
* ignored. Native value / max are not the value hook.
|
|
11
|
+
* [progress-fill] filled portion. Optional for the runtime.
|
|
12
|
+
* [progress-label] optional visible value / status text. Authors own
|
|
13
|
+
* the accessible name. The label is not copied into
|
|
14
|
+
* aria-label, aria-labelledby, or aria-valuetext.
|
|
15
|
+
*
|
|
16
|
+
* Sync (markup-driven):
|
|
17
|
+
* 1. role="progressbar" on the host. An author role that is not
|
|
18
|
+
* progressbar is replaced. The host is not made focusable
|
|
19
|
+
* (no tabindex). There is no keyboard and no pointer handler.
|
|
20
|
+
* 2. Determinate: aria-valuemin (default 0), aria-valuemax (default
|
|
21
|
+
* 100), and aria-valuenow. A missing or non-numeric valuenow is
|
|
22
|
+
* min, which is an empty bar (ratio 0), not indeterminate.
|
|
23
|
+
* Values clamp to min/max. A max below min collapses to min.
|
|
24
|
+
* 3. The host inline custom property --juice-progress-ratio
|
|
25
|
+
* (unitless 0–1) stays in sync for every range, including ranges
|
|
26
|
+
* the 0–100 chrome selectors do not cover.
|
|
27
|
+
* 4. Indeterminate is progress="indeterminate" only. That flag wins.
|
|
28
|
+
* APG omits aria-valuenow while indeterminate; min/max stay.
|
|
29
|
+
* The last determinate value is remembered and restored when the
|
|
30
|
+
* flag clears. CSS owns the sliding fill.
|
|
31
|
+
* 5. aria-valuetext is never invented and never rewritten.
|
|
32
|
+
*
|
|
33
|
+
* Not a slider, not a spinner, and not a layered overlay: no focus
|
|
34
|
+
* trap, no Escape, no Sig Progress factory.
|
|
35
|
+
*/
|
|
36
|
+
export type ProgressOptions = {
|
|
37
|
+
root?: ParentNode;
|
|
38
|
+
progressSelector?: string;
|
|
39
|
+
};
|
|
40
|
+
export type ProgressController = {
|
|
41
|
+
destroy: () => void;
|
|
42
|
+
sync: () => void;
|
|
43
|
+
setValue: (value: number, target?: HTMLElement | null) => void;
|
|
44
|
+
getValue: (target?: HTMLElement | null) => number;
|
|
45
|
+
setIndeterminate: (indeterminate: boolean, target?: HTMLElement | null) => void;
|
|
46
|
+
isIndeterminate: (target?: HTMLElement | null) => boolean;
|
|
47
|
+
};
|
|
48
|
+
export declare const createProgress: (options?: ProgressOptions) => ProgressController;
|
|
49
|
+
export declare const initProgress: (options?: ProgressOptions) => ProgressController;
|
|
50
|
+
export declare const startProgressRuntime: () => ProgressController | null;
|
|
51
|
+
export declare const stopProgressRuntime: () => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Radio Group runtime for Juice radio chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [radiogroup] is the group root (layout only — no group chrome).
|
|
6
|
+
* [radio] is one option. Primary host is
|
|
7
|
+
* <button type="button" radio> inside the group. Visible labels live
|
|
8
|
+
* beside the control (wrapping <label>, aria-label, or
|
|
9
|
+
* aria-labelledby) — the host *is* the disc. The dot is a CSS
|
|
10
|
+
* pseudo-element; there is no [radio-dot] child.
|
|
11
|
+
*
|
|
12
|
+
* Hosts this runtime enhances:
|
|
13
|
+
* - [radiogroup] roots. Sync fills role="radiogroup". Authors supply
|
|
14
|
+
* the group's accessible name. Radios outside a [radiogroup] are
|
|
15
|
+
* ignored (no solo exclusive group).
|
|
16
|
+
* - HTMLButtonElement [radio] descendants (primary). Sync fills
|
|
17
|
+
* role="radio", aria-checked "true"|"false", type="button" when
|
|
18
|
+
* type is missing, and a roving tabindex (one tab stop per group).
|
|
19
|
+
* - HTMLInputElement type="radio" (secondary). Chrome already paints
|
|
20
|
+
* :checked. Sync keeps aria-checked in lockstep with the native
|
|
21
|
+
* checked property. Exclusivity is the [radiogroup], not only the
|
|
22
|
+
* input name.
|
|
23
|
+
*
|
|
24
|
+
* Other [radio] hosts (div, span, text inputs, checkboxes) are ignored.
|
|
25
|
+
* A radio belongs to its nearest [radiogroup]. Do not invent accessible
|
|
26
|
+
* names.
|
|
27
|
+
*
|
|
28
|
+
* v1 is exclusive and binary. aria-checked="mixed" coerces to "false".
|
|
29
|
+
* When more than one radio is checked, sync keeps the first in document
|
|
30
|
+
* order. Zero checked is allowed until something is selected. There is
|
|
31
|
+
* no focus trap and no Escape handling (not a layered overlay).
|
|
32
|
+
*
|
|
33
|
+
* Click, Enter, and Space select the targeted radio. Arrow keys move
|
|
34
|
+
* the selection among enabled radios in the group and wrap, skipping
|
|
35
|
+
* disabled / aria-disabled radios. Native disabled or aria-disabled="true"
|
|
36
|
+
* is ignored.
|
|
37
|
+
*/
|
|
38
|
+
export type RadioOptions = {
|
|
39
|
+
root?: ParentNode;
|
|
40
|
+
radiogroupSelector?: string;
|
|
41
|
+
radioSelector?: string;
|
|
42
|
+
};
|
|
43
|
+
export type RadioController = {
|
|
44
|
+
destroy: () => void;
|
|
45
|
+
sync: () => void;
|
|
46
|
+
select: (radio?: HTMLElement | null) => void;
|
|
47
|
+
getChecked: (group?: HTMLElement | null) => HTMLElement | null;
|
|
48
|
+
};
|
|
49
|
+
export declare const createRadio: (options?: RadioOptions) => RadioController;
|
|
50
|
+
export declare const initRadio: (options?: RadioOptions) => RadioController;
|
|
51
|
+
export declare const startRadioRuntime: () => RadioController | null;
|
|
52
|
+
export declare const stopRadioRuntime: () => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal per-runtime event claim. Not a public export.
|
|
3
|
+
*
|
|
4
|
+
* Call once at module scope so custom-root and auto-enhance instances
|
|
5
|
+
* of the same runtime share one WeakSet and do not double-handle.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createEventClaim: () => (event: Event) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal focus-trap helpers for modal, drawer, and popover. Not a public export.
|
|
3
|
+
*/
|
|
4
|
+
export declare const isFocusableCandidate: (element: HTMLElement) => boolean;
|
|
5
|
+
export declare const getFocusable: (container: HTMLElement) => HTMLElement[];
|
|
6
|
+
export declare const moveFocusInto: (container: HTMLElement) => void;
|
|
7
|
+
export declare const wrapTabFocus: (event: KeyboardEvent, container: HTMLElement) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Juice runtime id helpers. Not a public export.
|
|
3
|
+
*/
|
|
4
|
+
export declare const escapeId: (value: string) => string;
|
|
5
|
+
export declare const tokenIds: (value: string | null | undefined) => string[];
|
|
6
|
+
export declare const controlIds: (element: HTMLElement) => string[];
|
|
7
|
+
export declare const resolveElementById: (id: string, root: ParentNode) => HTMLElement | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal open-surface queries for Escape yield. Not a public export.
|
|
3
|
+
* Selectors match the polish A/B overlay contract.
|
|
4
|
+
*
|
|
5
|
+
* Yield order (highest owns Escape first):
|
|
6
|
+
* modal/drawer overlay → popover ≈ menu (same band) → combobox →
|
|
7
|
+
* toast / tooltip. Menu closed vs open is native `hidden` on `[menu]`,
|
|
8
|
+
* not on `[menu-root]`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const hasOpenDialogOverlay: () => boolean;
|
|
11
|
+
export declare const hasOpenPopover: () => boolean;
|
|
12
|
+
export declare const hasOpenMenu: () => boolean;
|
|
13
|
+
export declare const hasOpenComboboxList: () => boolean;
|
|
14
|
+
export declare const hasOpenTooltip: () => boolean;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Slider runtime for Juice slider chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [slider] track host. Boolean or "horizontal".
|
|
6
|
+
* [slider="vertical"] is not painted and is not enhanced.
|
|
7
|
+
* [slider-fill] completed portion. Optional.
|
|
8
|
+
* [slider-thumb] real thumb. Required. Orphan thumbs are ignored.
|
|
9
|
+
* The first thumb whose nearest [slider] is the host
|
|
10
|
+
* is the control. Extra thumbs are not a multi-thumb
|
|
11
|
+
* slider in v1.
|
|
12
|
+
*
|
|
13
|
+
* Focus model: the thumb is the APG slider. Sync sets role="slider",
|
|
14
|
+
* tabindex="0" when the thumb is not natively focusable, type="button"
|
|
15
|
+
* when a button thumb omitted type, aria-valuemin (default 0),
|
|
16
|
+
* aria-valuemax (default 100), aria-valuenow, and
|
|
17
|
+
* aria-orientation="horizontal" on the thumb. The host stays the track.
|
|
18
|
+
* An author role="slider" on the host is removed so assistive tech sees
|
|
19
|
+
* one slider. Thumb aria-valuemin / aria-valuemax / aria-valuenow win
|
|
20
|
+
* over the same attributes on the host. A missing valuenow defaults to
|
|
21
|
+
* min. aria-valuetext is never invented and is never rewritten. Authors
|
|
22
|
+
* supply the accessible name.
|
|
23
|
+
*
|
|
24
|
+
* Paint: the host inline custom property --juice-slider-ratio (unitless
|
|
25
|
+
* 0–1) stays in sync for every range. Integer aria-valuenow 0–100 on the
|
|
26
|
+
* thumb also matches the chrome attribute selectors.
|
|
27
|
+
*
|
|
28
|
+
* Keyboard (thumb only): ArrowLeft / ArrowDown decrease, ArrowRight /
|
|
29
|
+
* ArrowUp increase, Home / End jump to min / max, PageUp / PageDown move
|
|
30
|
+
* by a larger step. Step is 1. Page step is 10. Values clamp to min/max.
|
|
31
|
+
* Pointer: primary pointerdown on the track, fill, or thumb jumps to that
|
|
32
|
+
* position and starts a drag; pointermove follows until pointerup or
|
|
33
|
+
* pointercancel. The thumb captures the pointer when the platform allows
|
|
34
|
+
* it. Disabled or aria-disabled="true" on the host or thumb is ignored.
|
|
35
|
+
*
|
|
36
|
+
* v1 is horizontal Juice markup only. There is no vertical orientation,
|
|
37
|
+
* no multi-thumb, no native <input type="range"> restyle, and no Escape
|
|
38
|
+
* handling (not a layered overlay).
|
|
39
|
+
*/
|
|
40
|
+
export type SliderOptions = {
|
|
41
|
+
root?: ParentNode;
|
|
42
|
+
sliderSelector?: string;
|
|
43
|
+
};
|
|
44
|
+
export type SliderController = {
|
|
45
|
+
destroy: () => void;
|
|
46
|
+
sync: () => void;
|
|
47
|
+
setValue: (value: number, target?: HTMLElement | null) => void;
|
|
48
|
+
getValue: (target?: HTMLElement | null) => number;
|
|
49
|
+
increment: (target?: HTMLElement | null) => void;
|
|
50
|
+
decrement: (target?: HTMLElement | null) => void;
|
|
51
|
+
};
|
|
52
|
+
export declare const createSlider: (options?: SliderOptions) => SliderController;
|
|
53
|
+
export declare const initSlider: (options?: SliderOptions) => SliderController;
|
|
54
|
+
export declare const startSliderRuntime: () => SliderController | null;
|
|
55
|
+
export declare const stopSliderRuntime: () => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first APG Switch runtime for Juice switch chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (Slice A — do not rename attrs):
|
|
5
|
+
* [switch] on the control host. Primary host is
|
|
6
|
+
* <button type="button" switch>. Visible labels live beside the
|
|
7
|
+
* control (wrapping <label>, aria-label, or aria-labelledby) — the
|
|
8
|
+
* host *is* the track. Track / thumb are CSS pseudo-elements; there
|
|
9
|
+
* are no [switch-track] / [switch-thumb] children.
|
|
10
|
+
*
|
|
11
|
+
* Hosts this runtime enhances:
|
|
12
|
+
* - HTMLButtonElement (primary). Sync fills role="switch",
|
|
13
|
+
* aria-checked "true"|"false", and type="button" when type is
|
|
14
|
+
* missing (so a form does not submit).
|
|
15
|
+
* - HTMLInputElement type="checkbox" (secondary). Chrome already
|
|
16
|
+
* paints :checked. Sync fills role="switch" and keeps aria-checked
|
|
17
|
+
* in lockstep with the native checked property (change events, and
|
|
18
|
+
* a static aria-checked="true" on an unchecked box is promoted onto
|
|
19
|
+
* .checked so :checked paint matches). This is not a form-checkbox
|
|
20
|
+
* restyle as the only story, and it is not menuitemcheckbox.
|
|
21
|
+
*
|
|
22
|
+
* Other [switch] hosts (div, span, text inputs, radios) are ignored.
|
|
23
|
+
* Do not invent accessible names — authors must supply aria-label,
|
|
24
|
+
* aria-labelledby, or visible text.
|
|
25
|
+
*
|
|
26
|
+
* v1 is binary. aria-checked="mixed" and any other value coerce to
|
|
27
|
+
* "false". There is no switch="on", no tri-state, no focus trap, and
|
|
28
|
+
* no Escape handling (not a layered overlay).
|
|
29
|
+
*
|
|
30
|
+
* Click and Enter/Space toggle. Native disabled or aria-disabled="true"
|
|
31
|
+
* is ignored. Button click preventDefault stops accidental submit when
|
|
32
|
+
* type is still the default.
|
|
33
|
+
*/
|
|
34
|
+
export type SwitchOptions = {
|
|
35
|
+
root?: ParentNode;
|
|
36
|
+
switchSelector?: string;
|
|
37
|
+
};
|
|
38
|
+
export type SwitchController = {
|
|
39
|
+
destroy: () => void;
|
|
40
|
+
sync: () => void;
|
|
41
|
+
toggle: (target?: HTMLElement | null) => void;
|
|
42
|
+
check: (target?: HTMLElement | null) => void;
|
|
43
|
+
uncheck: (target?: HTMLElement | null) => void;
|
|
44
|
+
setChecked: (checked: boolean, target?: HTMLElement | null) => void;
|
|
45
|
+
isChecked: (target?: HTMLElement | null) => boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare const createSwitch: (options?: SwitchOptions) => SwitchController;
|
|
48
|
+
export declare const initSwitch: (options?: SwitchOptions) => SwitchController;
|
|
49
|
+
export declare const startSwitchRuntime: () => SwitchController | null;
|
|
50
|
+
export declare const stopSwitchRuntime: () => void;
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
* Auto-dismiss pauses while pointer or focus is inside the toast, then resumes.
|
|
20
20
|
*
|
|
21
21
|
* Escape dismisses the most recently shown visible toast, but only when no
|
|
22
|
-
* open [modal-overlay]
|
|
22
|
+
* open [modal-overlay], [drawer-overlay], [popover-root], [menu],
|
|
23
|
+
* [combobox-list], or [tooltip-root] exists (those surfaces own Escape
|
|
24
|
+
* first; menu sits with popover). An open tip hides while toasts remain
|
|
25
|
+
* — toast does not steal Escape from tooltip.
|
|
23
26
|
*
|
|
24
27
|
* Live region: sync fills missing aria-live="polite" and
|
|
25
28
|
* aria-relevant="additions" on [toast-region]. Opt into assertive with
|