@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.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * DOM-first tooltip runtime for Juice tooltip chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [tooltip-root][hidden] > [tooltip-panel role="tooltip"]
6
+ * Closed vs open is the native `hidden` attribute on [tooltip-root].
7
+ *
8
+ * Never use a bare `tooltip` attribute. Juice chrome is not the native
9
+ * HTML `title` attribute — do not restyle or replace `title`.
10
+ *
11
+ * Tooltip is a thin cousin of popover: hover/focus only, no interactive
12
+ * content, no close button, no focus trap, no status variants. Do not
13
+ * move focus into the tip. It is not a popover, not a modal, not a
14
+ * drawer, and not a toast stack.
15
+ *
16
+ * Pairing: prefer `aria-describedby` pointing at the tooltip-root id
17
+ * (APG). `aria-controls` is also accepted for consistency with other
18
+ * Juice runtimes. Sync fills a missing root id and ensures the trigger
19
+ * `aria-describedby` token list includes that id.
20
+ *
21
+ * Show on pointer enter / focus of the trigger; hide on pointer leave /
22
+ * blur after a short grace (default 150ms) so a brief leave does not
23
+ * flicker. The tip has `pointer-events: none` in chrome, so the delay
24
+ * is not a bridge onto the tip. Touch / first-tap is later — v1 is
25
+ * hover and keyboard focus only.
26
+ *
27
+ * Placement (honest v1, no Floating UI): read `tooltip-root` (`top` /
28
+ * `bottom` / `left` / `right`, default `top`), position `fixed` near
29
+ * the trigger from getBoundingClientRect, with a small gap. If a
30
+ * transformed / filtered ancestor is the fixed containing block,
31
+ * subtract that origin. If the preferred side overflows the viewport,
32
+ * flip once to the opposite side. Repositions on open, window resize,
33
+ * and capture scroll (rAF-throttled).
34
+ *
35
+ * Escape hides the open tip on bubble, but yields when an open
36
+ * [modal-overlay], [drawer-overlay], [popover-root], [menu], or
37
+ * [combobox-list] exists, or the event is already defaultPrevented
38
+ * (same courtesy as toast / popover). Menu sits with popover in the
39
+ * dialog-adjacent band. Toast does not block tooltip Escape — the tip
40
+ * can hide while toasts remain. Opening one managed tooltip closes the
41
+ * others.
42
+ */
43
+ export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
44
+ export type TooltipOptions = {
45
+ root?: ParentNode;
46
+ rootSelector?: string;
47
+ panelSelector?: string;
48
+ gap?: number;
49
+ hideDelay?: number;
50
+ };
51
+ export type TooltipController = {
52
+ destroy: () => void;
53
+ sync: () => void;
54
+ show: (target?: HTMLElement | null) => void;
55
+ hide: (target?: HTMLElement | null) => void;
56
+ };
57
+ export declare const createTooltip: (options?: TooltipOptions) => TooltipController;
58
+ export declare const initTooltip: (options?: TooltipOptions) => TooltipController;
59
+ export declare const startTooltipRuntime: () => TooltipController | null;
60
+ export declare const stopTooltipRuntime: () => void;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * DOM-first multi-step wizard runtime for Juice wizard chrome.
3
+ *
4
+ * Markup contract (authors place the shell — this is not a form engine):
5
+ * [wizard-shell] > [step-tracker] [steps] > [step]
6
+ * > [wizard-content] > [step-page] + [step-nav]
7
+ *
8
+ * Pairing (first match wins, then document order):
9
+ * aria-controls → page id
10
+ * data-step / name / [step-page="…"] / id
11
+ *
12
+ * KiwiPress templates in this repo do not ship live wizard HTML. The pairing
13
+ * tokens follow wizard.scss: named pages (`[step-page="welcome"]`) and
14
+ * `[wizard-content][data-step="…"]`. Tracker items typically use the same
15
+ * `data-step` / `name` token, or rely on index order.
16
+ *
17
+ * Navigation (honest default — documented here, not a second API):
18
+ * bare [wizard-shell] jump to completed + current; no skip ahead
19
+ * wizard-shell="linear" prev/next only; tracker clicks do nothing
20
+ * wizard-shell="free" jump to any step
21
+ * Programmatic next / prev / goTo always work. Linear / default only
22
+ * constrain tracker clicks. Form validation and provisioning stay in the app.
23
+ *
24
+ * Visible vs hidden pages use native `hidden`. Do not write layout `content=`.
25
+ * Step paint uses [step="pending"|"active"|"completed"] (slice A chrome).
26
+ *
27
+ * A11y is a step indicator + one visible region, not APG Tabs:
28
+ * aria-current="step" on the active tracker item
29
+ * [step-page] as role="region" labelled by its step when unlabeled
30
+ */
31
+ export type WizardOptions = {
32
+ root?: ParentNode;
33
+ shellSelector?: string;
34
+ trackerSelector?: string;
35
+ stepsSelector?: string;
36
+ stepSelector?: string;
37
+ pageSelector?: string;
38
+ navSelector?: string;
39
+ nextSelector?: string;
40
+ prevSelector?: string;
41
+ completeSelector?: string;
42
+ };
43
+ export type WizardController = {
44
+ destroy: () => void;
45
+ sync: () => void;
46
+ next: (target?: HTMLElement | null) => void;
47
+ prev: (target?: HTMLElement | null) => void;
48
+ goTo: (step: number | string, target?: HTMLElement | null) => void;
49
+ current: (target?: HTMLElement | null) => number;
50
+ };
51
+ export declare const createWizard: (options?: WizardOptions) => WizardController;
52
+ export declare const initWizard: (options?: WizardOptions) => WizardController;
53
+ export declare const startWizardRuntime: () => WizardController | null;
54
+ export declare const stopWizardRuntime: () => void;