@citrusworx/juiceui 0.9.5 → 0.9.6
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 +28 -27
- package/dist/index.css +280 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1644 -1144
- package/dist/js/juice.d.ts +2 -0
- package/dist/js/src/shared/overlays.d.ts +3 -2
- package/dist/js/src/sheet/sheet-runtime.d.ts +94 -0
- package/package.json +1 -1
package/dist/js/juice.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export { createTouchableRow, initTouchableRow, startTouchableRowRuntime, stopTou
|
|
|
60
60
|
export type { TouchableRowController, TouchableRowOptions, TouchableRowState } from "./src/touchable-row/touchable-row-runtime.js";
|
|
61
61
|
export { createKeyboardAvoider, initKeyboardAvoider, startKeyboardAvoiderRuntime, stopKeyboardAvoiderRuntime } from "./src/keyboard-avoider/keyboard-avoider-runtime.js";
|
|
62
62
|
export type { KeyboardAvoiderController, KeyboardAvoiderOptions, KeyboardAvoiderState } from "./src/keyboard-avoider/keyboard-avoider-runtime.js";
|
|
63
|
+
export { createSheet, initSheet, startSheetRuntime, stopSheetRuntime } from "./src/sheet/sheet-runtime.js";
|
|
64
|
+
export type { SheetController, SheetDetent, SheetOptions, SheetState } from "./src/sheet/sheet-runtime.js";
|
|
63
65
|
export { JUICE_CHANGE_EVENT } from "./src/shared/change.js";
|
|
64
66
|
export type { JuiceChangeDetail } from "./src/shared/change.js";
|
|
65
67
|
export { prefersReducedMotion, subscribeReducedMotion, createMotionCancelToken, runMotion, createElementMotion } from "./src/shared/motion.js";
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Selectors match the polish A/B overlay contract.
|
|
4
4
|
*
|
|
5
5
|
* Yield order (highest owns Escape first):
|
|
6
|
-
* modal/drawer overlay → popover ≈ menu (same band) → combobox →
|
|
6
|
+
* modal/drawer/sheet overlay → popover ≈ menu (same band) → combobox →
|
|
7
7
|
* toast / tooltip. Menu closed vs open is native `hidden` on `[menu]`,
|
|
8
|
-
* not on `[menu-root]`.
|
|
8
|
+
* not on `[menu-root]`. Sheet closed vs open is native `hidden` on
|
|
9
|
+
* `[sheet-overlay]`, including `sheet-overlay="none"`.
|
|
9
10
|
*/
|
|
10
11
|
export declare const hasOpenDialogOverlay: () => boolean;
|
|
11
12
|
export declare const hasOpenPopover: () => boolean;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-first dialog runtime for Juice sheet chrome.
|
|
3
|
+
*
|
|
4
|
+
* Markup contract (slice A — do not rename attrs):
|
|
5
|
+
* [sheet-overlay][hidden] > [sheet role="dialog"]
|
|
6
|
+
* [sheet-handle] [sheet-header] [sheet-body] [sheet-footer] [sheet-close]
|
|
7
|
+
* Closed vs open is the native `hidden` attribute on the overlay.
|
|
8
|
+
* Enter removes `hidden`, then plays. Exit plays first; `hidden` is set
|
|
9
|
+
* only after it finishes. Focus moves in when a modal `hidden` is removed
|
|
10
|
+
* and restores when that `hidden` is set. Reduced motion (or a zero
|
|
11
|
+
* computed duration) does both in the same turn. An in-flight exit stays
|
|
12
|
+
* the open dialog for Escape and the focus trap until that commit, and a
|
|
13
|
+
* new open of that same overlay cancels it.
|
|
14
|
+
*
|
|
15
|
+
* Openers: any element whose `aria-controls` token list includes a
|
|
16
|
+
* `[sheet-overlay]` id. `[sheet-close]` closes the containing overlay.
|
|
17
|
+
* Backdrop click closes unless `sheet-overlay="static"` or
|
|
18
|
+
* `closeOnBackdrop` is false. `sheet-overlay="none"` is non-modal: no
|
|
19
|
+
* focus trap, no scroll lock, no backdrop close. Escape still closes.
|
|
20
|
+
*
|
|
21
|
+
* Scroll lock is modal only (boolean / omitted / "static"). A shared
|
|
22
|
+
* counter locks `document.body` overflow on the first modal sheet and
|
|
23
|
+
* restores the previous inline overflow when the last one closes, so
|
|
24
|
+
* nested and sibling modal sheets do not unlock early. Several sheets
|
|
25
|
+
* may be open together. This runtime does not close siblings.
|
|
26
|
+
*
|
|
27
|
+
* Detents. `sheet-detents` on `[sheet]` is the allowed set (`~=` words).
|
|
28
|
+
* Absent, or with no known word, the set is "half full". Rank is
|
|
29
|
+
* peek < half < full. On open the sheet rests at half when half is
|
|
30
|
+
* allowed, otherwise full when full is allowed, otherwise peek — the
|
|
31
|
+
* same rest slice A paints when `[detent]` is absent. `[detent]` is
|
|
32
|
+
* written whenever that rest changes. An already-open sheet keeps a
|
|
33
|
+
* valid `[detent]` until a gesture, the keyboard, or an open transition
|
|
34
|
+
* replaces it.
|
|
35
|
+
*
|
|
36
|
+
* Drag. Pointer events on `[sheet-handle]` and `[sheet-header]` track
|
|
37
|
+
* the finger after an 8px slop. `[sheet-body]` hands off only when
|
|
38
|
+
* `scrollTop` is 0 and the gesture moves down. `[dragging]` is set on
|
|
39
|
+
* the sheet and `data-motion-state` is `entered` for the gesture so the
|
|
40
|
+
* enter/exit animation does not fight the inline height. The finger is
|
|
41
|
+
* followed with inline height, plus `translateY` rubber-band (0.35 of
|
|
42
|
+
* the overflow) past the highest detent and below the lowest. Reduced
|
|
43
|
+
* motion clamps that visual and does not rubber-band; the logical
|
|
44
|
+
* height still tracks so a close can commit. Release snaps by projecting
|
|
45
|
+
* the logical height with velocity over 180ms and choosing the nearest
|
|
46
|
+
* allowed detent. Downward velocity of at least 0.5px/ms at or below the
|
|
47
|
+
* lowest detent, or a logical height more than 80px below it, closes.
|
|
48
|
+
* `pointercancel` drops the gesture and restores the detent it started
|
|
49
|
+
* on. Inline height/transform clear on the next frame after a snap so
|
|
50
|
+
* the detent height transition can run.
|
|
51
|
+
*
|
|
52
|
+
* Keyboard. A MutationObserver on `documentElement` attributes watches
|
|
53
|
+
* `[keyboard-open]`. While a sheet is open, gaining that attribute snaps
|
|
54
|
+
* it to `full` when full is allowed, otherwise the highest detent.
|
|
55
|
+
* Opening while the attribute is already set uses that same rest.
|
|
56
|
+
*
|
|
57
|
+
* State is `{ open, detent, dragging, modal }`. `juice:change` bubbles
|
|
58
|
+
* from the overlay with `detail.runtime === "sheet"`. The first
|
|
59
|
+
* observation is silent. Disabled (`disabled` / `aria-disabled="true"`)
|
|
60
|
+
* and invalid hosts (an overlay with no `[sheet]`) are ignored.
|
|
61
|
+
* Back button history is out of scope.
|
|
62
|
+
*
|
|
63
|
+
* Sheet is the thirty-second Emerging auto-enhance runtime.
|
|
64
|
+
*/
|
|
65
|
+
export type SheetDetent = 'peek' | 'half' | 'full';
|
|
66
|
+
export type SheetOptions = {
|
|
67
|
+
root?: ParentNode;
|
|
68
|
+
overlaySelector?: string;
|
|
69
|
+
dialogSelector?: string;
|
|
70
|
+
closeSelector?: string;
|
|
71
|
+
handleSelector?: string;
|
|
72
|
+
headerSelector?: string;
|
|
73
|
+
bodySelector?: string;
|
|
74
|
+
closeOnBackdrop?: boolean;
|
|
75
|
+
};
|
|
76
|
+
export type SheetState = {
|
|
77
|
+
open: boolean;
|
|
78
|
+
detent: SheetDetent;
|
|
79
|
+
dragging: boolean;
|
|
80
|
+
modal: boolean;
|
|
81
|
+
};
|
|
82
|
+
export type SheetController = {
|
|
83
|
+
destroy: () => void;
|
|
84
|
+
sync: () => void;
|
|
85
|
+
open: (target?: HTMLElement | null) => void;
|
|
86
|
+
close: (target?: HTMLElement | null) => void;
|
|
87
|
+
toggle: (target?: HTMLElement | null) => void;
|
|
88
|
+
isOpen: (target?: HTMLElement | null) => boolean;
|
|
89
|
+
getState: (target?: HTMLElement | null) => SheetState | null;
|
|
90
|
+
};
|
|
91
|
+
export declare const createSheet: (options?: SheetOptions) => SheetController;
|
|
92
|
+
export declare const initSheet: (options?: SheetOptions) => SheetController;
|
|
93
|
+
export declare const startSheetRuntime: () => SheetController | null;
|
|
94
|
+
export declare const stopSheetRuntime: () => void;
|