@glasshome/ui 1.42.0 → 1.44.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/SPEC.md +8 -5
- package/dist/index.js +2 -2
- package/dist/lib/anchor-placement.d.ts +4 -0
- package/dist/lib/balance-rows.d.ts +10 -4
- package/dist/lib/behavior/anchored.d.ts +16 -3
- package/dist/lib/behavior/button-root.d.ts +7 -0
- package/dist/lib/behavior/collection.d.ts +8 -0
- package/dist/lib/behavior/dismiss.d.ts +6 -4
- package/dist/lib/behavior/focus-scope.d.ts +9 -1
- package/dist/lib/behavior/hide-outside.d.ts +1 -1
- package/dist/lib/behavior/layer-stack.d.ts +3 -2
- package/dist/lib/behavior/menu.d.ts +62 -0
- package/dist/lib/behavior/modal-root.d.ts +2 -0
- package/dist/lib/behavior/range.d.ts +44 -0
- package/dist/lib/color/color.d.ts +41 -0
- package/dist/lib/color/index.d.ts +2 -0
- package/dist/lib/color/intl.d.ts +40 -0
- package/dist/lib/dock-slot-classes.d.ts +2 -0
- package/dist/lib/hold.d.ts +1 -1
- package/dist/lib/locale.d.ts +3 -0
- package/dist/lib/menu-classes.d.ts +2 -0
- package/dist/lib/motion-classes.d.ts +2 -1
- package/dist/lib/overlay-classes.d.ts +1 -0
- package/dist/lib/scroll-track.d.ts +3 -2
- package/dist/lib/section-tokens.d.ts +1 -1
- package/dist/lib/segment-classes.d.ts +2 -0
- package/dist/lib/shadow-layer.d.ts +0 -45
- package/dist/lib/toggle-set.d.ts +44 -0
- package/dist/lib/visually-hidden.d.ts +3 -0
- package/dist/solid/accordion.d.ts +35 -11
- package/dist/solid/avatar.d.ts +8 -4
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +1 -1
- package/dist/solid/button.d.ts +5 -4
- package/dist/solid/charts.d.ts +1 -1
- package/dist/solid/checkbox.d.ts +14 -4
- package/dist/solid/collapsible.d.ts +33 -5
- package/dist/solid/color-disc.d.ts +1 -1
- package/dist/solid/color-slider.d.ts +1 -1
- package/dist/solid/color-wheel.d.ts +1 -1
- package/dist/solid/context-menu.d.ts +58 -24
- package/dist/solid/data-table.d.ts +4 -2
- package/dist/solid/dialog-parts.d.ts +8 -8
- package/dist/solid/dropdown-menu.d.ts +55 -24
- package/dist/solid/empty.d.ts +1 -1
- package/dist/solid/form.d.ts +5 -6
- package/dist/solid/hover-card.d.ts +65 -9
- package/dist/solid/index.d.ts +1 -1
- package/dist/solid/index.js +7752 -13493
- package/dist/solid/input-group.d.ts +6 -6
- package/dist/solid/item.d.ts +1 -1
- package/dist/solid/menu-parts.d.ts +175 -24
- package/dist/solid/option-card.d.ts +1 -4
- package/dist/solid/picker-row.d.ts +2 -0
- package/dist/solid/popover.d.ts +77 -12
- package/dist/solid/progress.d.ts +11 -3
- package/dist/solid/radio-group.d.ts +31 -6
- package/dist/solid/responsive-dialog.d.ts +1 -1
- package/dist/solid/scroll-area.d.ts +1 -1
- package/dist/solid/section-card.d.ts +2 -3
- package/dist/solid/select.d.ts +107 -10
- package/dist/solid/selection.d.ts +10 -1
- package/dist/solid/sheet.d.ts +1 -1
- package/dist/solid/sliding-indicator.d.ts +1 -1
- package/dist/solid/sonner.d.ts +1 -1
- package/dist/solid/toggle.d.ts +11 -3
- package/dist/solid/tooltip.d.ts +22 -22
- package/dist/tokens/index.js +54 -51
- package/dist/{utils-CxAii-e9.js → utils-BbIeGt7o.js} +376 -314
- package/package.json +3 -6
- package/src/lib/anchor-placement.ts +10 -3
- package/src/lib/balance-rows.ts +115 -40
- package/src/lib/behavior/anchored.ts +41 -9
- package/src/lib/behavior/button-root.tsx +103 -0
- package/src/lib/behavior/collection.ts +56 -28
- package/src/lib/behavior/dismiss.ts +61 -21
- package/src/lib/behavior/focus-scope.ts +75 -9
- package/src/lib/behavior/hide-outside.ts +2 -2
- package/src/lib/behavior/layer-stack.ts +33 -8
- package/src/lib/behavior/menu.ts +462 -0
- package/src/lib/behavior/modal-root.tsx +24 -18
- package/src/lib/behavior/polymorphic.tsx +1 -1
- package/src/lib/behavior/presence.ts +1 -1
- package/src/lib/behavior/range.ts +212 -0
- package/src/lib/clipboard.ts +2 -3
- package/src/lib/color/color.ts +746 -0
- package/src/lib/color/index.ts +2 -0
- package/src/lib/color/intl.ts +60 -0
- package/src/lib/dock-slot-classes.ts +3 -0
- package/src/lib/hold.ts +1 -1
- package/src/lib/locale.ts +62 -0
- package/src/lib/menu-classes.ts +3 -0
- package/src/lib/motion-classes.ts +8 -9
- package/src/lib/overlay-classes.ts +1 -3
- package/src/lib/scroll-track.ts +11 -6
- package/src/lib/section-tokens.ts +1 -1
- package/src/lib/segment-classes.ts +3 -0
- package/src/lib/shadow-layer.ts +0 -118
- package/src/lib/toggle-set.ts +133 -0
- package/src/lib/visually-hidden.ts +15 -0
- package/src/solid/accordion.tsx +294 -20
- package/src/solid/area-picker.tsx +4 -4
- package/src/solid/avatar.tsx +98 -24
- package/src/solid/bottom-sheet/arbitration.ts +4 -11
- package/src/solid/bottom-sheet/bottom-sheet.tsx +4 -5
- package/src/solid/bottom-sheet/drag-controller.ts +7 -20
- package/src/solid/button.tsx +12 -6
- package/src/solid/charts.tsx +1 -1
- package/src/solid/checkbox.tsx +167 -44
- package/src/solid/collapsible.tsx +260 -12
- package/src/solid/color-disc.tsx +11 -12
- package/src/solid/color-slider.tsx +114 -47
- package/src/solid/color-wheel.tsx +137 -39
- package/src/solid/context-menu.tsx +285 -94
- package/src/solid/data-table.tsx +48 -22
- package/src/solid/dialog-parts.tsx +39 -17
- package/src/solid/dock.tsx +44 -43
- package/src/solid/dropdown-menu.tsx +252 -115
- package/src/solid/empty.tsx +1 -1
- package/src/solid/entity-selector.tsx +3 -3
- package/src/solid/face-toggle.tsx +43 -18
- package/src/solid/form.tsx +5 -6
- package/src/solid/glyph-tile.tsx +48 -21
- package/src/solid/hover-card.tsx +287 -25
- package/src/solid/icon-picker.tsx +1 -2
- package/src/solid/image-picker.tsx +2 -2
- package/src/solid/index.ts +1 -3
- package/src/solid/input-group.tsx +2 -2
- package/src/solid/item.tsx +1 -1
- package/src/solid/menu-parts.tsx +610 -155
- package/src/solid/option-card.tsx +7 -13
- package/src/solid/picker-row.tsx +5 -1
- package/src/solid/popover.tsx +423 -80
- package/src/solid/preview-tile.tsx +1 -1
- package/src/solid/progress.tsx +84 -15
- package/src/solid/radio-group.tsx +271 -34
- package/src/solid/responsive-dialog.tsx +1 -1
- package/src/solid/schema-form.tsx +1 -6
- package/src/solid/scroll-area.tsx +1 -1
- package/src/solid/section-card.tsx +3 -4
- package/src/solid/select.tsx +939 -95
- package/src/solid/selection.tsx +165 -74
- package/src/solid/sheet.tsx +1 -1
- package/src/solid/slider.tsx +115 -65
- package/src/solid/sliding-indicator.tsx +4 -16
- package/src/solid/sonner.tsx +1 -1
- package/src/solid/tabs.tsx +12 -6
- package/src/solid/term.tsx +3 -4
- package/src/solid/toggle-group.tsx +34 -101
- package/src/solid/toggle.tsx +43 -9
- package/src/solid/tooltip.tsx +24 -24
- package/src/styles/globals.css +61 -50
- package/src/styles/theme.css +12 -6
- package/src/tokens/material.ts +11 -2
package/SPEC.md
CHANGED
|
@@ -269,8 +269,8 @@ Held by the `dialog-anatomy` gate in apps and in this package.
|
|
|
269
269
|
|
|
270
270
|
## Motion (the pillar)
|
|
271
271
|
|
|
272
|
-
Motion is one system, not per-component flair.
|
|
273
|
-
`lib/motion-classes.ts
|
|
272
|
+
Motion is one system, not per-component flair. The rules are held by
|
|
273
|
+
`lib/motion-classes.ts` and the `--glass-*` transition in
|
|
274
274
|
`globals.css`, on the theme tokens `--duration-*` / `--ease-*` (zeroed under
|
|
275
275
|
`prefers-reduced-motion`):
|
|
276
276
|
|
|
@@ -284,9 +284,12 @@ Motion is one system, not per-component flair. Four rules, all held by
|
|
|
284
284
|
a card with sub-options grows to reveal them (OptionCard's drawer), an
|
|
285
285
|
indicator slides and stretches (SelectionScope, position bars). Nothing is
|
|
286
286
|
swapped in below or beside its origin.
|
|
287
|
-
3. **Children arrive
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
3. **Children arrive with their panel.** Rows never animate one by one: the
|
|
288
|
+
panel's own motion carries them. Animations that run beside each other and
|
|
289
|
+
end at different times keep the main thread drawing every frame, and each of
|
|
290
|
+
those frames restyles every animating element. New motion
|
|
291
|
+
animates `transform`, `translate`, `scale` or `opacity`, which the compositor
|
|
292
|
+
runs; `clip-path` and registered custom properties run on the main thread.
|
|
290
293
|
4. **Leaving is the same path, faster.** Contract on `--ease-contract` at half
|
|
291
294
|
the arrival time. Pressables dip (`PRESS_DIP`).
|
|
292
295
|
5. **Ambient motion is an event.** A wallpaper or decorative loop runs for a
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, $t as t, An as n, B as r, C as i, Cn as a, Dn as ee, E as te, En as ne, F as o, G as s, Gt as c, H as l, I as u, It as d, J as f, Jt as p, K as m, L as h, M as g, N as _, O as v, On as y, P as b, Q as x, Sn as S, St as C, T as w, U as T, Ut as E, V as D, W as O, Wt as k, X as A, Y as j, Yt as M, Z as N, _ as P, _n as F, _t as I, an as L, at as R, b as z, bn as B, bt as V, c as H, cn as U, ct as W, d as G, dt as K, f as q, ft as J, g as Y, gn as X, gt as Z, h as re, hn as ie, ht as ae, i as oe, in as se, it as ce, j as le, jn as ue, kn as de, l as fe, ln as pe, lt as me, m as he, mn as ge, mt as _e, n as ve, nn as ye, nt as be, o as xe, ot as Se, p as Ce, pn as we, pt as Te, q as Ee, r as De, s as Oe, sn as ke, st as Ae, t as je, tn as Me, un as Ne, ut as Pe, v as Fe, vt as Q, w as Ie, wn as Le, x as Re, xn as ze, xt as Be, y as Ve, yn as He, yt as Ue, z as We } from "./utils-BbIeGt7o.js";
|
|
2
2
|
//#region src/lib/motion-window.ts
|
|
3
3
|
var $ = 3e4;
|
|
4
4
|
function Ge(e = $) {
|
|
@@ -17,4 +17,4 @@ function Ge(e = $) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { He as ALERT_CLASS, B as ALERT_CONTENT_CLASS, ze as ALERT_DESCRIPTION_CLASS, S as ALERT_ICON_BG_CLASS, a as ALERT_ICON_CLASS, Le as ALERT_ICON_PATHS, ne as ALERT_TITLE_CLASS, ee as ALERT_TONES, we as BUTTON_DEFAULT_CLASS, ge as BUTTON_OUTLINE_CLASS, d as CARD_BLUR, E as CARD_SURFACE, k as CARD_SURFACE_BASE, c as CARD_SURFACE_OPAQUE, R as CAROUSEL_DOTS, Se as CAROUSEL_VIEWPORT, re as CHIP, J as CONTROL_H, Fe as CONTROL_H_TOUCH, Te as CONTROL_ON, _e as FIELD_CHROME, ae as FIELD_CONTROL, t as FIELD_MOTION, Z as FIELD_TEXT, Re as FLOATING_PANEL, I as FOCUS_RING, g as HOLD_GRACE_MS, _ as HOLD_MS, ie as ICON_BUTTON_CLASS, Y as ICON_PILL, P as ICON_PILL_TINT, Q as INPUT_CLASS, Ue as INPUT_SURFACE, V as INVALID_RING, l as LOGO_DEFAULT_SIZE, T as LOGO_DEFAULT_SRC, O as LOGO_DEFAULT_SUB, s as LOGO_MARK_CLASS, m as LOGO_MARK_PX, Ee as LOGO_NAME_CLASS, f as LOGO_ROOT_CLASS, j as LOGO_SIZES, A as LOGO_STACK_CLASS, N as LOGO_SUB_CLASS, u as MENU_ITEM, h as MENU_ITEM_BASE, We as MENU_ITEM_X, r as MENU_LABEL, D as MENU_SEPARATOR, ve as MOBILE_BREAKPOINT, Me as MODAL_MOTION, ye as MORPH_MOTION, $ as MOTION_WINDOW_MS, X as OUTLINE_SURFACE, i as OVERLAY_BLUR, se as OVERLAY_MOTION, Ie as OVERLAY_SURFACE, w as OVERLAY_SURFACE_BASE, te as OVERLAY_SURFACE_OPAQUE, Ve as PICKER_LIST, z as PICKER_TRIGGER, Pe as POSITION_BAR, K as POSITION_BAR_LIT, L as PRESS_DIP, v as SCRIM_CLASS, ke as SCRIM_MOTION, G as SECTION_INNER_RADIUS, q as SECTION_OUTER_RADIUS, Ce as SECTION_PADDING, he as SECTION_ROW_CLASS, p as SECTION_ROW_SURFACE, fe as SEGMENT_ITEM, U as SETTLE_MOTION, pe as STAGGER, Ne as STALE_CONTENT, oe as THUMB_CLASS, xe as THUMB_RAIL_BLEED, Oe as THUMB_RAIL_PAD, H as THUMB_SIZE, M as TRACK_SURFACE, x as Z, e as Z_CLASS, y as alertBorder, de as alertFill, n as alertIconBgStyle, ue as alertIconFill, le as anchorToTriggerTop, F as buttonVariants, Ae as carouselDot, W as carouselItem, me as carouselTrack, je as cn, Be as copyImage, C as copyText, b as createHold, De as createIsMobile, be as glassToneText, o as spendLongPress, Ge as startMotionWindow, ce as toneTextMix };
|
|
@@ -12,6 +12,8 @@ export interface AnchorPlace {
|
|
|
12
12
|
align: Align;
|
|
13
13
|
offset: number;
|
|
14
14
|
matchAnchorWidth: boolean;
|
|
15
|
+
/** False keeps the chosen side even without room; the part only shifts to stay inside the viewport. */
|
|
16
|
+
flip?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export interface Placement {
|
|
17
19
|
left: number;
|
|
@@ -29,6 +31,8 @@ export declare function placeBeside(anchor: Box, floating: {
|
|
|
29
31
|
width: number;
|
|
30
32
|
height: number;
|
|
31
33
|
}, place: AnchorPlace): Placement;
|
|
34
|
+
/** The corner a control takes (rounded-lg is --radius), clamped to a capsule at its height; read from the theme so opening a panel asks the page for no style. */
|
|
35
|
+
export declare const controlRadius: (height: number) => string;
|
|
32
36
|
/** A panel that grows out of the element that opened it. The --morph-* values start the panel
|
|
33
37
|
* clipped to the element's box (MORPH_MOTION's keyframes), so it unrolls out of it. */
|
|
34
38
|
export declare function overAnchor(anchor: HTMLElement, width: number, height?: number): JSX.CSSProperties;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
2
|
+
/** Marks the element holding the items: a wrapping row until the column count is known, then a grid of that many equal columns (globals.css). */
|
|
3
|
+
export declare const BALANCED_ROWS = "data-balanced-rows";
|
|
4
|
+
/** Marks the node inside each item that sizes to its content in either layout. */
|
|
5
|
+
export declare const BALANCE_CONTENT = "data-balance-content";
|
|
3
6
|
/**
|
|
4
7
|
* Lays `items` out in `BALANCED_ROWS`. `sizer` is the element that fills its line once wrapped
|
|
5
|
-
* (it takes `data-wrapped` too); `item` selects the items among `items`' children
|
|
8
|
+
* (it takes `data-wrapped` too); `item` selects the items among `items`' children, each holding
|
|
9
|
+
* one `BALANCE_CONTENT` node. Sizes come from a ResizeObserver only, never a layout read: an
|
|
10
|
+
* item's own width is its content node's width plus its padding and border, the same in either
|
|
11
|
+
* layout, so only the column count waits a frame, and the wrapping row never overflows meanwhile.
|
|
6
12
|
*/
|
|
7
|
-
export declare function balanceRows(sizer: HTMLElement, items: HTMLElement, item: string): () => void;
|
|
13
|
+
export declare function balanceRows(sizer: HTMLElement, items: HTMLElement, item: string, members: Accessor<unknown>): () => void;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import type { Accessor } from "solid-js";
|
|
2
|
-
import { type Align, type Side } from "../anchor-placement";
|
|
2
|
+
import { type Align, type Box, type Side } from "../anchor-placement.js";
|
|
3
|
+
/** An element, or a point or box with no element of its own: a context menu opens at the pointer. */
|
|
4
|
+
export interface AnchorLike {
|
|
5
|
+
getBoundingClientRect: () => Box;
|
|
6
|
+
getRootNode?(): Node;
|
|
7
|
+
}
|
|
8
|
+
export interface Anchored {
|
|
9
|
+
/** Where the part was last placed, from the measure that placed it. */
|
|
10
|
+
placed: () => Box | undefined;
|
|
11
|
+
}
|
|
3
12
|
export interface AnchoredOptions {
|
|
4
|
-
anchor: Accessor<
|
|
13
|
+
anchor: Accessor<AnchorLike | undefined>;
|
|
5
14
|
floating: Accessor<HTMLElement | undefined>;
|
|
6
15
|
open: Accessor<boolean>;
|
|
7
16
|
side?: Accessor<Side>;
|
|
8
17
|
align?: Accessor<Align>;
|
|
9
18
|
offset?: number;
|
|
10
19
|
matchAnchorWidth?: boolean;
|
|
20
|
+
/** The anchor counts as its top edge and the part never flips: placed below, it covers the anchor. */
|
|
21
|
+
coverAnchor?: boolean;
|
|
22
|
+
/** A custom property the part gets the anchor's width in, for styles sized by the anchor. */
|
|
23
|
+
widthVar?: string;
|
|
11
24
|
}
|
|
12
|
-
export declare function createAnchored(options: AnchoredOptions):
|
|
25
|
+
export declare function createAnchored(options: AnchoredOptions): Anchored;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ComponentProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
export type ButtonRootProps<T extends ValidComponent = "button"> = Omit<ComponentProps<T>, "as" | "disabled"> & {
|
|
3
|
+
as?: T;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** A press target: a native button, a link, or any other element made one (role, Tab stop, Enter and Space). */
|
|
7
|
+
export declare function ButtonRoot<T extends ValidComponent = "button">(props: ButtonRootProps<T>): JSX.Element;
|
|
@@ -11,6 +11,8 @@ export interface CollectionOptions {
|
|
|
11
11
|
dir?: Accessor<"ltr" | "rtl">;
|
|
12
12
|
/** Keys that hold the tab stop while focus is outside, first present wins (a selected tab). */
|
|
13
13
|
preferred?: Accessor<readonly string[]>;
|
|
14
|
+
/** APG's focusable when disabled: an `aria-disabled` item stays in the arrow order and can hold the tab stop. */
|
|
15
|
+
disabledFocusable?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface Collection {
|
|
16
18
|
highlighted: Accessor<string | undefined>;
|
|
@@ -20,5 +22,11 @@ export interface Collection {
|
|
|
20
22
|
/** Items call this as they mount, unmount or change disabled, so the tab stop always sits on a present, enabled item. */
|
|
21
23
|
refresh: () => void;
|
|
22
24
|
}
|
|
25
|
+
export interface Typeahead {
|
|
26
|
+
/** The index in `texts` the key leads to: -1 when nothing matches, `undefined` when the key types nothing. */
|
|
27
|
+
match: (event: KeyboardEvent, texts: readonly string[], from: number) => number | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The typing buffer alone, for a list whose items are not in the DOM (a closed Select's trigger). */
|
|
30
|
+
export declare function createTypeahead(): Typeahead;
|
|
23
31
|
export declare function createCollection(options: CollectionOptions): Collection;
|
|
24
32
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Accessor } from "solid-js";
|
|
2
|
-
import { type LayerHandle } from "./layer-stack";
|
|
3
|
-
export type DismissReason = "escape" | "outside-press";
|
|
2
|
+
import { type LayerHandle } from "./layer-stack.js";
|
|
3
|
+
export type DismissReason = "escape" | "outside-press" | "focus-outside";
|
|
4
4
|
export interface DismissOptions {
|
|
5
5
|
layer: LayerHandle;
|
|
6
|
-
/** `event` is the keydown for `escape` and the
|
|
7
|
-
onDismiss: (reason: DismissReason, event: KeyboardEvent | PointerEvent) => void;
|
|
6
|
+
/** `event` is the keydown for `escape`, the pointerdown for `outside-press` and the focusin for `focus-outside`. */
|
|
7
|
+
onDismiss: (reason: DismissReason, event: KeyboardEvent | PointerEvent | FocusEvent) => void;
|
|
8
8
|
outsidePress?: Accessor<boolean>;
|
|
9
|
+
/** Off unless asked: a non-modal layer closes when focus lands outside it. */
|
|
10
|
+
focusOutside?: Accessor<boolean>;
|
|
9
11
|
escapeFrom?: "layer" | "document";
|
|
10
12
|
}
|
|
11
13
|
export declare function createDismiss(options: DismissOptions): void;
|
|
@@ -11,7 +11,15 @@ export interface FocusScope {
|
|
|
11
11
|
skipRestore(): void;
|
|
12
12
|
untrap(): void;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/** The focused element in the node's own root, kept from focusin and focusout, which a sealed widget receives without asking the page. */
|
|
15
|
+
export declare function focusedIn(node: Node): Element | null;
|
|
16
|
+
/** Whether focus sits on nothing, or still inside `el`, so a closing panel may hand it back. */
|
|
17
|
+
export declare function focusFell(el: Element): boolean;
|
|
18
|
+
/** Whether `el` holds focus, from its own focus and blur events, which a sealed widget receives without asking the page. */
|
|
19
|
+
export declare function trackFocus(el: Element): {
|
|
20
|
+
has: () => boolean;
|
|
21
|
+
stop: () => void;
|
|
22
|
+
};
|
|
15
23
|
export declare function focusWithoutTracking(el: HTMLElement | null | undefined, options?: {
|
|
16
24
|
preventScroll?: boolean;
|
|
17
25
|
}): boolean;
|
|
@@ -6,18 +6,19 @@ export interface LayerOptions {
|
|
|
6
6
|
open: Accessor<boolean>;
|
|
7
7
|
kind: LayerKind;
|
|
8
8
|
escape: Accessor<boolean>;
|
|
9
|
-
readsOwnEscape?: boolean;
|
|
10
9
|
dismiss?: () => void;
|
|
11
10
|
trigger?: Accessor<Element | undefined>;
|
|
12
11
|
topLayer?: TopLayer;
|
|
12
|
+
/** While open, the page takes no pointer events; this layer and the ones above it still do. */
|
|
13
|
+
blockPointer?: Accessor<boolean>;
|
|
13
14
|
}
|
|
14
15
|
export interface Layer {
|
|
15
16
|
readonly id: number;
|
|
16
17
|
readonly kind: LayerKind;
|
|
17
|
-
readonly readsOwnEscape: boolean;
|
|
18
18
|
element(): HTMLElement | undefined;
|
|
19
19
|
trigger(): Element | undefined;
|
|
20
20
|
escape(): boolean;
|
|
21
|
+
readonly blocksPointer: boolean;
|
|
21
22
|
dismiss?: () => void;
|
|
22
23
|
}
|
|
23
24
|
export interface LayerHandle {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
import type { Align, Side } from "../anchor-placement.js";
|
|
3
|
+
import type { Box } from "../anchor-placement.js";
|
|
4
|
+
import { type AnchorLike } from "./anchored.js";
|
|
5
|
+
export declare const SUBMENU_OPEN_DELAY_MS = 100;
|
|
6
|
+
export declare const POINTER_GRACE_MS = 300;
|
|
7
|
+
/** Where focus goes as a menu opens: an item, the panel itself, or nowhere (a submenu opened by hover). */
|
|
8
|
+
export type MenuFocus = "first" | "last" | "content" | "none";
|
|
9
|
+
type Dir = "ltr" | "rtl";
|
|
10
|
+
export interface MenuItemEntry {
|
|
11
|
+
disabled: Accessor<boolean>;
|
|
12
|
+
closeOnSelect: Accessor<boolean>;
|
|
13
|
+
onSelect: () => void;
|
|
14
|
+
submenu?: Menu;
|
|
15
|
+
}
|
|
16
|
+
export interface MenuOptions {
|
|
17
|
+
open: Accessor<boolean>;
|
|
18
|
+
onOpenChange: (open: boolean) => void;
|
|
19
|
+
parent?: Menu;
|
|
20
|
+
/** What the menu sits beside, given its trigger; unset, the trigger itself, as a submenu always does. */
|
|
21
|
+
anchor?: (trigger: HTMLElement | undefined) => AnchorLike | undefined;
|
|
22
|
+
/** The panel covers its anchor from the anchor's top edge, as createAnchored's coverAnchor. */
|
|
23
|
+
coverAnchor?: boolean;
|
|
24
|
+
side?: Accessor<Side>;
|
|
25
|
+
align?: Accessor<Align>;
|
|
26
|
+
offset?: number;
|
|
27
|
+
dir?: Accessor<Dir>;
|
|
28
|
+
/** A press on the trigger counts as outside: a context menu's trigger is the area it opens over. */
|
|
29
|
+
triggerIsArea?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface Menu {
|
|
32
|
+
parent: Menu | undefined;
|
|
33
|
+
open: Accessor<boolean>;
|
|
34
|
+
dir: Accessor<Dir>;
|
|
35
|
+
content: Accessor<HTMLElement | undefined>;
|
|
36
|
+
/** Where the open panel sits, as it was placed. */
|
|
37
|
+
placed: () => Box | undefined;
|
|
38
|
+
setContent: (el: HTMLElement | undefined) => void;
|
|
39
|
+
trigger: Accessor<HTMLElement | undefined>;
|
|
40
|
+
setTrigger: (el: HTMLElement | undefined) => void;
|
|
41
|
+
highlighted: Accessor<string | undefined>;
|
|
42
|
+
tabIndex: (key: string) => 0 | -1;
|
|
43
|
+
show: (focus: MenuFocus) => void;
|
|
44
|
+
/** Closes this menu and its submenus; with `returnFocus`, focus held inside goes back to the trigger. */
|
|
45
|
+
hide: (returnFocus: boolean) => void;
|
|
46
|
+
/** Closes every menu from the root down, as choosing an item does. */
|
|
47
|
+
closeTree: () => void;
|
|
48
|
+
register: (key: string, entry: MenuItemEntry) => void;
|
|
49
|
+
holdsFocus: () => boolean;
|
|
50
|
+
unhighlight: () => void;
|
|
51
|
+
/** A submenu joins its parent, so focus inside it counts as inside the tree. */
|
|
52
|
+
adopt: (child: Menu) => void;
|
|
53
|
+
}
|
|
54
|
+
export interface MenuButton {
|
|
55
|
+
onPointerDown: (event: PointerEvent) => void;
|
|
56
|
+
onClick: () => void;
|
|
57
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
58
|
+
}
|
|
59
|
+
export declare function createMenu(options: MenuOptions): Menu;
|
|
60
|
+
/** The APG menu button: a mouse press toggles, a finger toggles on its click, Enter, Space and ArrowDown open on the first item, ArrowUp on the last. */
|
|
61
|
+
export declare function createMenuButton(menu: Menu, disabled: Accessor<boolean>): MenuButton;
|
|
62
|
+
export {};
|
|
@@ -62,5 +62,7 @@ interface OutsideDetail<T extends Event> {
|
|
|
62
62
|
export type PointerDownOutsideEvent = CustomEvent<OutsideDetail<PointerEvent>>;
|
|
63
63
|
export type FocusOutsideEvent = CustomEvent<OutsideDetail<FocusEvent>>;
|
|
64
64
|
export type InteractOutsideEvent = PointerDownOutsideEvent | FocusOutsideEvent;
|
|
65
|
+
export declare function vetoed<E extends Event>(handler: ((event: E) => void) | undefined, event: E): boolean;
|
|
66
|
+
export declare function interactOutside<T extends PointerEvent | FocusEvent>(original: T, handle: (event: CustomEvent<OutsideDetail<T>>) => void): CustomEvent<OutsideDetail<T>>;
|
|
65
67
|
export declare function ModalFrame(props: ModalFrameProps): JSX.Element;
|
|
66
68
|
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
export type RangeKey = "decrease" | "increase" | "pageDown" | "pageUp" | "first" | "last";
|
|
3
|
+
export declare function rangeKeyOf(e: KeyboardEvent): RangeKey | undefined;
|
|
4
|
+
export interface RangeOptions {
|
|
5
|
+
values: Accessor<number[] | undefined>;
|
|
6
|
+
defaultValues: Accessor<number[]>;
|
|
7
|
+
min: Accessor<number>;
|
|
8
|
+
max: Accessor<number>;
|
|
9
|
+
step: Accessor<number>;
|
|
10
|
+
minStepsBetween?: Accessor<number>;
|
|
11
|
+
disabled: Accessor<boolean>;
|
|
12
|
+
onChange?: (values: number[]) => void;
|
|
13
|
+
onChangeEnd?: (values: number[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface Range {
|
|
16
|
+
values: Accessor<number[]>;
|
|
17
|
+
fraction: (value: number) => number;
|
|
18
|
+
valueAt: (fraction: number) => number;
|
|
19
|
+
setThumb: (index: number, value: number) => void;
|
|
20
|
+
closestThumb: (value: number) => number;
|
|
21
|
+
keyDown: (e: KeyboardEvent, index: number) => void;
|
|
22
|
+
blur: () => void;
|
|
23
|
+
dragEnd: () => void;
|
|
24
|
+
}
|
|
25
|
+
/** Thumbs on a stepped linear track that never cross; a key change ends on blur, a drag on release. */
|
|
26
|
+
export declare function createRange(options: RangeOptions): Range;
|
|
27
|
+
export declare const alongTrack: (e: PointerEvent, rect: DOMRect) => number;
|
|
28
|
+
type Pointer = PointerEvent & {
|
|
29
|
+
currentTarget: HTMLElement;
|
|
30
|
+
};
|
|
31
|
+
export interface DragOptions {
|
|
32
|
+
disabled: Accessor<boolean>;
|
|
33
|
+
start: (e: PointerEvent, rect: DOMRect) => void;
|
|
34
|
+
move: (e: PointerEvent, rect: DOMRect) => void;
|
|
35
|
+
end: () => void;
|
|
36
|
+
}
|
|
37
|
+
/** One primary-pointer drag at a time, captured on the pressed element, its rect read once per drag. */
|
|
38
|
+
export declare function createDrag(options: DragOptions): {
|
|
39
|
+
onPointerDown: (e: Pointer) => void;
|
|
40
|
+
onPointerMove: (e: Pointer) => void;
|
|
41
|
+
onPointerUp: (e: Pointer) => void;
|
|
42
|
+
onPointerCancel: (e: Pointer) => void;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ColorIntlTranslations } from "./intl.js";
|
|
2
|
+
type ColorFormat = "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla" | "hsb" | "hsba";
|
|
3
|
+
type ColorSpace = "rgb" | "hsl" | "hsb";
|
|
4
|
+
export type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
|
|
5
|
+
interface ColorAxes {
|
|
6
|
+
xChannel: ColorChannel;
|
|
7
|
+
yChannel: ColorChannel;
|
|
8
|
+
zChannel: ColorChannel;
|
|
9
|
+
}
|
|
10
|
+
interface ColorChannelRange {
|
|
11
|
+
minValue: number;
|
|
12
|
+
maxValue: number;
|
|
13
|
+
step: number;
|
|
14
|
+
pageSize: number;
|
|
15
|
+
}
|
|
16
|
+
/** A color value; every method that changes it returns a new one. */
|
|
17
|
+
export interface Color {
|
|
18
|
+
toFormat(format: ColorFormat): Color;
|
|
19
|
+
toString(format?: ColorFormat | "css"): string;
|
|
20
|
+
clone(): Color;
|
|
21
|
+
toHexInt(): number;
|
|
22
|
+
/** Throws when the channel is not in the color's space. */
|
|
23
|
+
getChannelValue(channel: ColorChannel): number;
|
|
24
|
+
/** Throws when the channel is not in the color's space. */
|
|
25
|
+
withChannelValue(channel: ColorChannel, value: number): Color;
|
|
26
|
+
getChannelRange(channel: ColorChannel): ColorChannelRange;
|
|
27
|
+
getChannelName(channel: ColorChannel, translations: ColorIntlTranslations): string;
|
|
28
|
+
getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
|
|
29
|
+
formatChannelValue(channel: ColorChannel): string;
|
|
30
|
+
getColorSpace(): ColorSpace;
|
|
31
|
+
getColorSpaceAxes(xyChannels: {
|
|
32
|
+
xChannel?: ColorChannel;
|
|
33
|
+
yChannel?: ColorChannel;
|
|
34
|
+
}): ColorAxes;
|
|
35
|
+
getColorChannels(): [ColorChannel, ColorChannel, ColorChannel];
|
|
36
|
+
getColorName(translations: ColorIntlTranslations): string;
|
|
37
|
+
getHueName(translations: ColorIntlTranslations): string;
|
|
38
|
+
}
|
|
39
|
+
/** Parses a color from a string value. Throws an error if the string could not be parsed. */
|
|
40
|
+
export declare function parseColor(value: string): Color;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const COLOR_INTL_TRANSLATIONS: {
|
|
2
|
+
hue: string;
|
|
3
|
+
saturation: string;
|
|
4
|
+
lightness: string;
|
|
5
|
+
brightness: string;
|
|
6
|
+
red: string;
|
|
7
|
+
green: string;
|
|
8
|
+
blue: string;
|
|
9
|
+
alpha: string;
|
|
10
|
+
colorName: (lightness: string, chroma: string, hue: string) => string;
|
|
11
|
+
transparentColorName: (lightness: string, chroma: string, hue: string, percentTransparent: string) => string;
|
|
12
|
+
"very dark": string;
|
|
13
|
+
dark: string;
|
|
14
|
+
light: string;
|
|
15
|
+
"very light": string;
|
|
16
|
+
pale: string;
|
|
17
|
+
grayish: string;
|
|
18
|
+
vibrant: string;
|
|
19
|
+
black: string;
|
|
20
|
+
white: string;
|
|
21
|
+
gray: string;
|
|
22
|
+
pink: string;
|
|
23
|
+
"pink red": string;
|
|
24
|
+
"red orange": string;
|
|
25
|
+
brown: string;
|
|
26
|
+
orange: string;
|
|
27
|
+
"orange yellow": string;
|
|
28
|
+
"brown yellow": string;
|
|
29
|
+
yellow: string;
|
|
30
|
+
"yellow green": string;
|
|
31
|
+
"green cyan": string;
|
|
32
|
+
cyan: string;
|
|
33
|
+
"cyan blue": string;
|
|
34
|
+
"blue purple": string;
|
|
35
|
+
purple: string;
|
|
36
|
+
"purple magenta": string;
|
|
37
|
+
magenta: string;
|
|
38
|
+
"magenta pink": string;
|
|
39
|
+
};
|
|
40
|
+
export type ColorIntlTranslations = typeof COLOR_INTL_TRANSLATIONS;
|
package/dist/lib/hold.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const HOLD_MS = 350;
|
|
|
6
6
|
export declare const HOLD_GRACE_MS = 100;
|
|
7
7
|
/** A fired hold spends the press: the browser's own long press (text selection, context menu)
|
|
8
8
|
* must not land on what the hold opened under the finger. Lasts until the release.
|
|
9
|
-
* @deprecated
|
|
9
|
+
* @deprecated `createHold`; removed in 2.0.0. */
|
|
10
10
|
export declare function spendLongPress(): void;
|
|
11
11
|
/** What a hold reads from a press: a PointerEvent fits, and so does a touch or a recorded point. */
|
|
12
12
|
export interface HoldPress {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const MENU_ITEM_BASE = "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]";
|
|
2
|
+
/** The rounded-sm in MENU_ITEM_BASE, for a selection flyer that crosses rows. */
|
|
3
|
+
export declare const MENU_ITEM_RADIUS = "var(--radius-sm)";
|
|
2
4
|
export declare const MENU_ITEM_X = "px-2";
|
|
3
5
|
export declare const MENU_ITEM = "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px] px-2";
|
|
4
6
|
export declare const MENU_LABEL = "px-2 py-1.5 font-medium text-muted-foreground text-xs";
|
|
@@ -2,6 +2,7 @@ export declare const OVERLAY_MOTION = "origin-(--kb-popper-content-transform-ori
|
|
|
2
2
|
export declare const FIELD_MOTION = "data-[closed]:animate-select-out data-[expanded]:animate-select-in";
|
|
3
3
|
export declare const MORPH_MOTION = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out";
|
|
4
4
|
export declare const ANCHORED_MOTION = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out";
|
|
5
|
+
/** @deprecated Rows arrive with their panel; the class does nothing. Removed in 2.0.0. */
|
|
5
6
|
export declare const STAGGER = "gh-stagger";
|
|
6
7
|
export declare const MODAL_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fill-mode-forwards data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]";
|
|
7
8
|
export declare const SCRIM_MOTION = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[expanded]:fade-in-0 data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:fill-mode-forwards data-[closed]:fade-out-0";
|
|
@@ -14,4 +15,4 @@ export declare const DOCK_ARRIVE_MOTION = "pointer-events-none absolute inset-0
|
|
|
14
15
|
export declare const DOCK_EDIT_MOTION = "data-[editing]:animate-dock-jiggle data-[editing]:nth-even:[animation-direction:alternate-reverse] data-[dragging]:animate-none";
|
|
15
16
|
export declare const RISE_MOTION = "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0";
|
|
16
17
|
export declare const TRAVEL_MOTION = "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)";
|
|
17
|
-
export declare const MOTION_EXIT_MS: Record<"overlay" | "modal" | "anchored" | "scrim" | "field" | "sheet", number>;
|
|
18
|
+
export declare const MOTION_EXIT_MS: Record<"overlay" | "modal" | "anchored" | "scrim" | "field" | "sheet" | "disclosure", number>;
|
|
@@ -8,6 +8,7 @@ export declare const SCRIM_CONTAIN = "overscroll-contain overflow-hidden";
|
|
|
8
8
|
export declare const PANEL_TAIL: string;
|
|
9
9
|
export declare const FLOATING_PANEL_SURFACE: string;
|
|
10
10
|
export declare const FLOATING_PANEL: string;
|
|
11
|
+
/** @deprecated Ignored; removed in 2.0.0. */
|
|
11
12
|
export declare const anchorToTriggerTop: (anchor?: HTMLElement) => {
|
|
12
13
|
x: number;
|
|
13
14
|
y: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
1
2
|
/** Fades whichever edge the track writes as clipped. */
|
|
2
3
|
export declare const SCROLL_TRACK_FADE = "data-[clip-end]:[mask-image:linear-gradient(to_right,black_85%,transparent)] data-[clip-start]:[mask-image:linear-gradient(to_left,black_85%,transparent)] data-[clip-start]:data-[clip-end]:[mask-image:linear-gradient(to_right,transparent,black_15%,black_85%,transparent)]";
|
|
3
|
-
/** Centres the segment matching `selected` whenever
|
|
4
|
+
/** Centres the segment matching `selected` whenever `selection` changes; drives
|
|
4
5
|
* scrollLeft, since scrollIntoView would scroll the page with it. */
|
|
5
|
-
export declare function trackScroll(list: HTMLElement, selected: string,
|
|
6
|
+
export declare function trackScroll(list: HTMLElement, selected: string, selection: Accessor<unknown>): () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SECTION_OUTER_RADIUS = "rounded-[var(--radius)]";
|
|
2
2
|
export declare const SECTION_INNER_RADIUS = "rounded-[max(0px,calc(var(--radius)-var(--spacing)*3))]";
|
|
3
3
|
export declare const SECTION_PADDING = "p-3";
|
|
4
|
-
/** @deprecated
|
|
4
|
+
/** @deprecated `SectionRow`, or `SECTION_ROW_SURFACE` from card-classes; removed in 2.0.0. */
|
|
5
5
|
export declare const SECTION_ROW_CLASS = "rounded-[max(0px,calc(var(--radius)-var(--spacing)*3))] border border-border/60 bg-card/60 p-3";
|
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
import { type Accessor } from "solid-js";
|
|
2
1
|
/** True for a node inside a shadow root, where page-level layer logic sees only the root's host. */
|
|
3
2
|
export declare const inShadowRoot: (node: Node | undefined) => boolean;
|
|
4
|
-
export declare const ReportCovered: import("solid-js").Context<((covered: Accessor<boolean>) => void) | undefined>;
|
|
5
|
-
/** True while a layer of this Kobalte root sits under an owned modal; the root drops `modal` then. */
|
|
6
|
-
export declare function createCoveredRoot(): {
|
|
7
|
-
covered: Accessor<boolean>;
|
|
8
|
-
report: (covered: Accessor<boolean>) => void;
|
|
9
|
-
};
|
|
10
|
-
type OutsideEvent = {
|
|
11
|
-
target: EventTarget | null;
|
|
12
|
-
preventDefault(): void;
|
|
13
|
-
};
|
|
14
|
-
type AutoFocusEvent = {
|
|
15
|
-
preventDefault(): void;
|
|
16
|
-
};
|
|
17
|
-
export interface LayerHandlers {
|
|
18
|
-
onInteractOutside: (e: OutsideEvent) => void;
|
|
19
|
-
onCloseAutoFocus: (e: AutoFocusEvent) => void;
|
|
20
|
-
/** The shadow root's host while the layer is in one: what the page sees as the target of anything inside. */
|
|
21
|
-
host: () => Element | undefined;
|
|
22
|
-
/** An owned modal sits above the layer: the modal owns every press and focus until it closes. */
|
|
23
|
-
covered: Accessor<boolean>;
|
|
24
|
-
}
|
|
25
|
-
interface ShadowLayerOptions {
|
|
26
|
-
content: Accessor<HTMLElement | undefined>;
|
|
27
|
-
open: Accessor<boolean>;
|
|
28
|
-
/** Absent for layers that close on pointer leave (tooltips, hover cards): they never join the stack. */
|
|
29
|
-
dismiss?: () => void;
|
|
30
|
-
/** A press on it is the trigger's own toggle, never an outside press. */
|
|
31
|
-
trigger?: Accessor<Element | undefined>;
|
|
32
|
-
/** Menus: any press outside the layer and the layers above it dismisses it, newest or not, as Kobalte's menus do. */
|
|
33
|
-
tree?: boolean;
|
|
34
|
-
consumer: {
|
|
35
|
-
onInteractOutside?: (e: never) => void;
|
|
36
|
-
onCloseAutoFocus?: (e: never) => void;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Kobalte decides "outside" from the page, where a press or focus inside a shadow root is one on
|
|
41
|
-
* the root's host, so a layer portaled into a shadow root would dismiss on every press inside it.
|
|
42
|
-
* The handlers ignore those; while the layer is open in a shadow root, a press elsewhere in that
|
|
43
|
-
* root dismisses the newest layer from a listener on the root itself. Outside a shadow root the
|
|
44
|
-
* handlers only pass the consumer's own through.
|
|
45
|
-
*/
|
|
46
|
-
export declare function shadowLayer(options: ShadowLayerOptions): LayerHandlers;
|
|
47
|
-
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Accessor } from "solid-js";
|
|
2
|
+
import { type Collection } from "./behavior/collection.js";
|
|
3
|
+
type Orientation = "horizontal" | "vertical";
|
|
4
|
+
export interface ToggleSet {
|
|
5
|
+
id: Accessor<string>;
|
|
6
|
+
orientation: Accessor<Orientation>;
|
|
7
|
+
isPressed: (value: string) => boolean;
|
|
8
|
+
toggle: (value: string) => void;
|
|
9
|
+
collection: Collection;
|
|
10
|
+
/** Changes as items mount and unmount. */
|
|
11
|
+
members: Accessor<number>;
|
|
12
|
+
joined: (delta: 1 | -1) => void;
|
|
13
|
+
}
|
|
14
|
+
/** The shared core of a row of toggles: which are pressed, what a press does, and the roving focus between them. */
|
|
15
|
+
export declare function createToggleSet(options: {
|
|
16
|
+
root: Accessor<HTMLElement | undefined>;
|
|
17
|
+
itemSelector: string;
|
|
18
|
+
values: Accessor<readonly string[]>;
|
|
19
|
+
setValues: (next: string[]) => void;
|
|
20
|
+
multiple: Accessor<boolean>;
|
|
21
|
+
orientation?: Accessor<Orientation>;
|
|
22
|
+
id?: Accessor<string | undefined>;
|
|
23
|
+
disabledFocusable?: boolean;
|
|
24
|
+
}): ToggleSet;
|
|
25
|
+
/** One toggle in a set: its ref, its pressed and roving-focus attributes, and its press, bound on the element so it works inside a closed shadow root. */
|
|
26
|
+
export declare function createToggleItem(set: ToggleSet, item: {
|
|
27
|
+
value: Accessor<string>;
|
|
28
|
+
disabled: Accessor<boolean>;
|
|
29
|
+
locked?: Accessor<boolean>;
|
|
30
|
+
}): {
|
|
31
|
+
ref: import("solid-js").Setter<HTMLElement | undefined>;
|
|
32
|
+
pressed: () => boolean;
|
|
33
|
+
props: {
|
|
34
|
+
id: string;
|
|
35
|
+
readonly tabIndex: -1 | 0;
|
|
36
|
+
readonly disabled: boolean;
|
|
37
|
+
readonly "aria-pressed": boolean;
|
|
38
|
+
readonly "data-pressed": "" | undefined;
|
|
39
|
+
readonly "data-disabled": "" | undefined;
|
|
40
|
+
readonly "data-key": string;
|
|
41
|
+
readonly "data-orientation": Orientation;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {};
|