elements-kit 0.20.0 → 0.22.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 +20 -19
- package/dist/attributes.d.mts +1 -1
- package/dist/await.d.mts +6 -5
- package/dist/await.mjs +0 -36
- package/dist/{types-ncUK9rki.d.mts → children-s3nFjpLA.d.mts} +125 -227
- package/dist/custom-elements-CdpilMDu.d.mts +87 -0
- package/dist/custom-elements.d.mts +2 -2
- package/dist/{element-D3om9yA6.mjs → element-Di0PYFX1.mjs} +15 -38
- package/dist/for.d.mts +9 -4
- package/dist/for.mjs +1 -1
- package/dist/{fragment-ROPRBJQd.mjs → fragment-Bvs1sGu1.mjs} +3 -3
- package/dist/hydrate/index.mjs +1 -1
- package/dist/{hydrate-6Qx4n4Su.mjs → hydrate-CHomBRY9.mjs} +4 -4
- package/dist/integrations/astro-client.mjs +2 -2
- package/dist/integrations/astro-server.mjs +2 -2
- package/dist/integrations/astro-slots.d.mts +6 -5
- package/dist/integrations/astro-slots.mjs +9 -8
- package/dist/integrations/react.d.mts +1 -1
- package/dist/integrations/react.mjs +1 -1
- package/dist/jsx-runtime/index.d.mts +2 -2
- package/dist/jsx-runtime/index.mjs +2 -2
- package/dist/polyfill-BVNd6ogU.d.mts +9 -0
- package/dist/render.mjs +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/{server-iFSng50i.mjs → server-CTkyXTV6.mjs} +2 -2
- package/dist/signals/index.d.mts +1 -1
- package/dist/slot.d.mts +83 -2
- package/dist/slot.mjs +179 -2
- package/dist/ui/badge/badge.css +5 -5
- package/dist/ui/button/button.css +15 -15
- package/dist/ui/card/card.css +2 -2
- package/dist/ui/group/group.css +61 -0
- package/dist/ui/marketing/marketing.css +5 -3
- package/dist/ui/otp-input/index.d.mts +132 -0
- package/dist/ui/otp-input/index.mjs +328 -0
- package/dist/ui/otp-input/otp-input.css +157 -0
- package/dist/ui/overlay/index.css +52 -4
- package/dist/ui/overlay/index.d.mts +237 -63
- package/dist/ui/overlay/index.mjs +658 -66
- package/dist/ui/overlay/overlay.css +58 -2
- package/dist/ui/styles/index.css +664 -0
- package/dist/ui/styles/radius.css +7 -7
- package/dist/ui/styles/unset.css +212 -210
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/async.d.mts +1 -1
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/promise.d.mts +1 -1
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/package.json +10 -1
- package/dist/custom-elements-DK5VUcWA.d.mts +0 -55
- package/dist/slot-BFWXeFRl.d.mts +0 -77
- package/dist/slot-Dvf30O0B.mjs +0 -138
- /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
- /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
|
@@ -1,27 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { Placement } from "@floating-ui/dom";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/overlay/constraint.d.ts
|
|
2
4
|
/**
|
|
3
|
-
* The
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The constraint — one of the two spatial primitives (with the anchor).
|
|
6
|
+
* A `Region` is a reactive rect; `constraint()` builds one from an
|
|
7
|
+
* element, a plain rect, or nothing (the live viewport). `confine()`
|
|
8
|
+
* applies a region to an overlay by syncing it into the
|
|
9
|
+
* `--overlay-constraint-top/-left/-width/-height` channels every location
|
|
10
|
+
* clamp and gesture bound derives from (declared in index.css with
|
|
11
|
+
* viewport defaults). Derived values build on regions — `detents()`
|
|
12
|
+
* quantizes one, `rubber()` resists at its edges.
|
|
9
13
|
*/
|
|
14
|
+
/** A reactive rect — the shape `createElementRect` returns, so an
|
|
15
|
+
* `Element` works directly and custom rects (a static region, a virtual
|
|
16
|
+
* area) can be supplied too. */
|
|
17
|
+
interface Region {
|
|
18
|
+
top(): number;
|
|
19
|
+
left(): number;
|
|
20
|
+
width(): number;
|
|
21
|
+
height(): number;
|
|
22
|
+
}
|
|
23
|
+
/** A plain rect a `Region` can be built from. */
|
|
24
|
+
interface RectInit {
|
|
25
|
+
top: number;
|
|
26
|
+
left: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds a {@link Region}: from an `Element` (observed via
|
|
32
|
+
* `ResizeObserver` through `createElementRect`; cleanup routes through
|
|
33
|
+
* the current scope), from a plain rect (static), or with no argument —
|
|
34
|
+
* the live viewport (read at call time, not observed).
|
|
35
|
+
*/
|
|
36
|
+
declare function constraint(source?: Element | RectInit): Region;
|
|
10
37
|
interface OverlayConstraint {
|
|
11
38
|
dispose(): void;
|
|
12
39
|
[Symbol.dispose](): void;
|
|
13
40
|
}
|
|
14
41
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
42
|
+
* Resolves a custom property holding a length to pixels. Plain `px` values
|
|
43
|
+
* parse directly; anything else (`svh` / `calc()` / fractions of the
|
|
44
|
+
* constraint) resolves natively by measuring a hidden probe. `fallback` is
|
|
45
|
+
* a CSS length expression used when the property is unset.
|
|
18
46
|
*/
|
|
19
|
-
|
|
20
|
-
top(): number;
|
|
21
|
-
left(): number;
|
|
22
|
-
width(): number;
|
|
23
|
-
height(): number;
|
|
24
|
-
}
|
|
47
|
+
declare function resolveVarPx(overlay: HTMLElement, name: string, axis: "height" | "width", fallback?: string): number;
|
|
25
48
|
/** Resolves the constraint rect every gesture bound derives from. */
|
|
26
49
|
declare function resolveConstraint(overlay: HTMLElement): {
|
|
27
50
|
top: number;
|
|
@@ -30,14 +53,14 @@ declare function resolveConstraint(overlay: HTMLElement): {
|
|
|
30
53
|
height: number;
|
|
31
54
|
};
|
|
32
55
|
/**
|
|
33
|
-
* Confines an overlay to a
|
|
34
|
-
* `--overlay-constraint-*` variables.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* from those variables, so the overlay re-clamps when the rect changes.
|
|
56
|
+
* Confines an overlay to a {@link Region} by syncing it into the
|
|
57
|
+
* `--overlay-constraint-*` variables. Every location clamp and gesture
|
|
58
|
+
* bound derives from those variables, so the overlay re-clamps when the
|
|
59
|
+
* region changes.
|
|
38
60
|
*
|
|
39
|
-
* Caveat:
|
|
40
|
-
* without resizing (e.g. page scroll) does not
|
|
61
|
+
* Caveat: an element region observes size changes (`ResizeObserver`) — a
|
|
62
|
+
* container that moves without resizing (e.g. page scroll) does not
|
|
63
|
+
* retrigger the sync.
|
|
41
64
|
*
|
|
42
65
|
* Registers its cleanup with the current scope (`onCleanup`) and also
|
|
43
66
|
* returns it as `dispose` / `Symbol.dispose`; disposing removes the
|
|
@@ -45,19 +68,100 @@ declare function resolveConstraint(overlay: HTMLElement): {
|
|
|
45
68
|
*
|
|
46
69
|
* @example
|
|
47
70
|
* ```ts
|
|
48
|
-
* import {
|
|
71
|
+
* import { constraint, confine } from "elements-kit/ui/overlay";
|
|
49
72
|
*
|
|
50
73
|
* const panel = document.querySelector("dialog.x-overlay")!;
|
|
51
|
-
*
|
|
74
|
+
* confine(panel, constraint(document.querySelector("main")!));
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare function confine(overlay: HTMLElement, region: Region): OverlayConstraint;
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/ui/overlay/anchor.d.ts
|
|
80
|
+
/**
|
|
81
|
+
* The anchor — one of the two spatial primitives (with the constraint).
|
|
82
|
+
* `anchor(overlay, follow?)` gives the overlay an anchor ELEMENT it
|
|
83
|
+
* follows for its whole life; the anchor element follows `follow` until
|
|
84
|
+
* something else moves it (a `draggable()` service, author code). The
|
|
85
|
+
* overlay itself has no states — dragging, tearing off, re-pinning are
|
|
86
|
+
* all things that happen to the anchor.
|
|
87
|
+
*
|
|
88
|
+
* Two engines, chosen once at wire time, never switched:
|
|
89
|
+
*
|
|
90
|
+
* - Native CSS anchor positioning (compound gate, no `within`/`arrow`):
|
|
91
|
+
* the overlay's `position-anchor` points at the anchor element; when
|
|
92
|
+
* `follow` is an element the anchor pins itself to it through a second
|
|
93
|
+
* native hop (`[data-follow]` rule in index.css mirrors the followed
|
|
94
|
+
* box via `anchor()`/`anchor-size()`). Placement, flip and scroll
|
|
95
|
+
* tracking are compositor-side through both hops — zero JS.
|
|
96
|
+
* - Floating UI (below the gate, or `within`/`arrow` requested — native
|
|
97
|
+
* CSS has no boundary control and no flip signal): `autoUpdate` writes
|
|
98
|
+
* the box center into the `--overlay-x`/`-y` channels while the
|
|
99
|
+
* overlay is open; a `dragmove` event from the drag service triggers
|
|
100
|
+
* an immediate reposition. The initial positioning write is instant;
|
|
101
|
+
* geometry transitions re-enable after it (Base UI's `data-instant`
|
|
102
|
+
* semantics), so re-pins and live area changes morph by the
|
|
103
|
+
* stylesheet. During an anchor drag, writes suppress geometry
|
|
104
|
+
* transitions again — the overlay must not ease behind the finger.
|
|
105
|
+
*
|
|
106
|
+
* `data-anchor="element"` is a static wiring marker (stamped here,
|
|
107
|
+
* removed on dispose, never toggled). `data-placed` is output state —
|
|
108
|
+
* the settled side, feeding the arrow and `transform-origin` (a hint
|
|
109
|
+
* from `--overlay-area` under the native engine, the real side under
|
|
110
|
+
* Floating UI). A first pointer-down from `draggable()` tears the
|
|
111
|
+
* follow pin (the `data-follow` contract); a fresh open re-pins.
|
|
112
|
+
*/
|
|
113
|
+
interface AnchorOptions {
|
|
114
|
+
/** Flip/shift boundary — placement confined to this region instead of
|
|
115
|
+
* the viewport. Forces the Floating UI engine. */
|
|
116
|
+
within?: Region;
|
|
117
|
+
/** Caret pointing at the anchor (`.x-overlay-arrow`, injected when not
|
|
118
|
+
* authored; a number sets `--overlay-arrow-size` in px). Forces the
|
|
119
|
+
* Floating UI engine. */
|
|
120
|
+
arrow?: number | boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Maps a `position-area` value to the Floating UI placement. Spanning
|
|
124
|
+
* toward an edge leaves the box flush with the *opposite* edge, so
|
|
125
|
+
* `span-*-end` is a `-start` alignment (and vice versa) — Floating UI
|
|
126
|
+
* resolves `-start`/`-end` logically, so the span tokens need no dir
|
|
127
|
+
* check; only the physical inline sides do. Unknown values fall back to
|
|
128
|
+
* `bottom` (the CSS default, `block-end`).
|
|
129
|
+
*/
|
|
130
|
+
declare function areaToPlacement(area: string, rtl?: boolean): Placement;
|
|
131
|
+
/**
|
|
132
|
+
* Gives `overlay` its anchor element and returns it. The overlay follows
|
|
133
|
+
* the anchor for life; the anchor follows `follow` (element or rect)
|
|
134
|
+
* until something moves it. Pass the returned element to `draggable()`
|
|
135
|
+
* to make the composition tearable — dragging moves the anchor.
|
|
136
|
+
*
|
|
137
|
+
* `follow` may be a getter reading a signal — re-pinning on change is
|
|
138
|
+
* how a shared popover slides between nav triggers: the native chain
|
|
139
|
+
* glides there on the anchor element's CSS transition; the channel
|
|
140
|
+
* engine lets that one write animate.
|
|
141
|
+
*
|
|
142
|
+
* Registers all cleanup with the current scope (`onCleanup`): the anchor
|
|
143
|
+
* element, the wiring, and the stamped attributes are removed together.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { anchor, draggable, rubber } from "elements-kit/ui/overlay";
|
|
148
|
+
*
|
|
149
|
+
* const a = anchor(panel, trigger);
|
|
150
|
+
* draggable(a, undefined, rubber()).attach(panel);
|
|
151
|
+
*
|
|
152
|
+
* // shared nav popover — re-anchors (and glides) when the signal changes
|
|
153
|
+
* const active = signal(firstTrigger);
|
|
154
|
+
* anchor(menu, () => active(), { arrow: true });
|
|
52
155
|
* ```
|
|
53
156
|
*/
|
|
54
|
-
declare function
|
|
157
|
+
declare function anchor(overlay: HTMLElement, follow?: Element | RectInit | (() => Element | RectInit | null | undefined), opts?: AnchorOptions): HTMLElement;
|
|
55
158
|
//#endregion
|
|
56
159
|
//#region src/ui/overlay/resize-strategy.d.ts
|
|
57
160
|
/**
|
|
58
161
|
* Resize strategies — pluggable policy for a resize drag's live bounds
|
|
59
162
|
* and resting size. Pure (no DOM); the gesture injects the context.
|
|
60
|
-
* Built-
|
|
163
|
+
* Built-in: `freeResize` (default). `detents()` (detents.ts) quantizes a
|
|
164
|
+
* constraint region and doubles as a strategy.
|
|
61
165
|
*/
|
|
62
166
|
/** How far (ms) a release velocity is projected when picking a rest. */
|
|
63
167
|
declare const PROJECTION_MS = 160;
|
|
@@ -112,12 +216,92 @@ declare function closestDetent(sizePx: number, detentsPx: readonly number[], vel
|
|
|
112
216
|
declare function freeResize(opts?: {
|
|
113
217
|
min?: number;
|
|
114
218
|
}): ResizeStrategy;
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/ui/overlay/detents.d.ts
|
|
115
221
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
222
|
+
* Detents — a customization of the constraint: the region, quantized.
|
|
223
|
+
* One snapping concept for both services: `resize()` (and the markup
|
|
224
|
+
* gestures) snap extents to the stops; `draggable()` snaps positions to
|
|
225
|
+
* them. A bottom sheet's size detents and its top-edge position detents
|
|
226
|
+
* were always the same thing — here they are literally the same object.
|
|
119
227
|
*/
|
|
120
|
-
|
|
228
|
+
/** A {@link Region} with quantized stops. Doubles as a `ResizeStrategy`
|
|
229
|
+
* (the stops resolve per axis through the gesture's `ResizeContext`). */
|
|
230
|
+
interface Space extends ResizeStrategy {
|
|
231
|
+
readonly region: Region;
|
|
232
|
+
readonly stops: readonly (number | string)[];
|
|
233
|
+
/** The numeric stops resolved against a region axis (px, sorted) —
|
|
234
|
+
* position snapping for `draggable()`. String stops (CSS lengths) need
|
|
235
|
+
* an element context and only apply to resizes. */
|
|
236
|
+
positions(axis: "width" | "height"): number[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Quantizes a region: each stop is a fraction of the region along the
|
|
240
|
+
* axis (number `0–1`) or a CSS length (string, resize-only). Flick-aware
|
|
241
|
+
* on release; shrinking past the smallest stop dismisses (when the
|
|
242
|
+
* consumer allows dismissal).
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* import { constraint, detents } from "elements-kit/ui/overlay";
|
|
247
|
+
*
|
|
248
|
+
* const d = detents(constraint(), [0.25, 0.6, 0.9]); // of the viewport
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
declare function detents(region: Region, stops: readonly (number | string)[]): Space;
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/ui/overlay/rubber.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* Effects — composable physics for motion through a space. Services
|
|
256
|
+
* (`draggable`, `resize`) run each axis value through the effect chain:
|
|
257
|
+
* `during` on every move, `settle` on release (`null` = dismiss signal).
|
|
258
|
+
* `rubber()` is the built-in; custom effects are just objects.
|
|
259
|
+
*/
|
|
260
|
+
interface Effect {
|
|
261
|
+
/** Transform a live value (px on one axis) against the axis bounds. */
|
|
262
|
+
during?(value: number, bounds: readonly [number, number]): number;
|
|
263
|
+
/** Pick the resting value on release, or `null` to signal dismissal. */
|
|
264
|
+
settle?(value: number, velocity: number, bounds: readonly [number, number]): number | null;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Edge resistance — values past the bounds move at a fraction of the
|
|
268
|
+
* pointer (the iOS rubber band). Pure `resist()` under the hood; no
|
|
269
|
+
* channels involved, so it applies to anything a service moves.
|
|
270
|
+
*/
|
|
271
|
+
declare function rubber(): Effect;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/ui/overlay/draggable.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* The drag service — moves a target element through a space. Generic by
|
|
276
|
+
* design: drag any positioned element by any handle. For overlays, the
|
|
277
|
+
* target is the anchor element from `anchor()` — dragging the anchor
|
|
278
|
+
* drags the overlay, with no overlay state involved.
|
|
279
|
+
*
|
|
280
|
+
* The pipeline runs per axis: live values go through each effect's
|
|
281
|
+
* `during` (e.g. `rubber()` resistance at the space edges); on release
|
|
282
|
+
* the value goes through each `settle`, then snaps to the space's
|
|
283
|
+
* numeric stops when a `detents()` space is given (`null` from a settle
|
|
284
|
+
* = dismiss signal, surfaced on the `dragend` detail). Events on the
|
|
285
|
+
* target: `dragmove` (`{x, y}`) every move, `dragend`
|
|
286
|
+
* (`{x, y, velocity, rest}`) on release.
|
|
287
|
+
*
|
|
288
|
+
* First pointer-down tears a `data-follow` pin (the `anchor()` contract):
|
|
289
|
+
* the target freezes at its current rect and the pointer takes over.
|
|
290
|
+
*/
|
|
291
|
+
interface DragService {
|
|
292
|
+
/** Move the target programmatically (through the `during` effects). */
|
|
293
|
+
update(point: {
|
|
294
|
+
x: number;
|
|
295
|
+
y: number;
|
|
296
|
+
}): void;
|
|
297
|
+
/** Wire the pointer plumbing to a handle. */
|
|
298
|
+
attach(handle: Element): {
|
|
299
|
+
dispose(): void;
|
|
300
|
+
};
|
|
301
|
+
dispose(): void;
|
|
302
|
+
[Symbol.dispose](): void;
|
|
303
|
+
}
|
|
304
|
+
declare function draggable(target: HTMLElement, space?: Region | Space, ...effects: Effect[]): DragService;
|
|
121
305
|
//#endregion
|
|
122
306
|
//#region src/ui/overlay/gestures.d.ts
|
|
123
307
|
interface OverlayGestureOptions {
|
|
@@ -163,47 +347,37 @@ interface OverlayGestures {
|
|
|
163
347
|
*
|
|
164
348
|
* @example
|
|
165
349
|
* ```ts
|
|
166
|
-
* import { createOverlayGestures, detents } from "elements-kit/ui/overlay";
|
|
350
|
+
* import { constraint, createOverlayGestures, detents } from "elements-kit/ui/overlay";
|
|
167
351
|
*
|
|
168
352
|
* const el = document.querySelector("dialog.x-overlay")!;
|
|
169
|
-
* createOverlayGestures(el, { resize: detents([0.25, 0.6, 0.9]) });
|
|
353
|
+
* createOverlayGestures(el, { resize: detents(constraint(), [0.25, 0.6, 0.9]) });
|
|
170
354
|
* el.addEventListener("resizechange", (e) => console.log(e.detail));
|
|
171
355
|
* ```
|
|
172
356
|
*/
|
|
173
357
|
declare function createOverlayGestures(overlay: HTMLElement, options?: OverlayGestureOptions): OverlayGestures;
|
|
174
358
|
//#endregion
|
|
175
|
-
//#region src/ui/overlay/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
359
|
+
//#region src/ui/overlay/resize.d.ts
|
|
360
|
+
/**
|
|
361
|
+
* The resize service — sizes a target through a space. The handle you
|
|
362
|
+
* `attach()` is the whole gesture zone (unlike the markup gestures,
|
|
363
|
+
* which zone-detect on the overlay surface); the side comes from the
|
|
364
|
+
* target's `data-resize` value, same vocabulary as the stylesheet.
|
|
365
|
+
*
|
|
366
|
+
* The space is any `ResizeStrategy` — pass a `detents()` space to snap,
|
|
367
|
+
* omit for `freeResize()`. Effects apply on release: each `settle` runs
|
|
368
|
+
* over the strategy's rested size (`null` = dismiss). Live rubber past
|
|
369
|
+
* the strategy bounds is built into the sessions.
|
|
370
|
+
*/
|
|
371
|
+
interface ResizeService {
|
|
182
372
|
/** Resize to a size (px) along the resize axis — animated by CSS. */
|
|
183
|
-
|
|
373
|
+
update(size: number): void;
|
|
374
|
+
/** Wire the pointer plumbing to a handle. */
|
|
375
|
+
attach(handle: Element): {
|
|
376
|
+
dispose(): void;
|
|
377
|
+
};
|
|
184
378
|
dispose(): void;
|
|
185
379
|
[Symbol.dispose](): void;
|
|
186
380
|
}
|
|
187
|
-
|
|
188
|
-
* One-call wiring for an interactive `.x-overlay`: optional constraint
|
|
189
|
-
* sync + pointer gestures, under a single disposable. Structure stays in
|
|
190
|
-
* markup (`data-resize` / `data-draggable`); policy is config.
|
|
191
|
-
*
|
|
192
|
-
* Registers its cleanup with the current scope (`onCleanup`) and also
|
|
193
|
-
* returns it as `dispose` / `Symbol.dispose`.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```ts
|
|
197
|
-
* import { overlay, detents } from "elements-kit/ui/overlay";
|
|
198
|
-
*
|
|
199
|
-
* const el = document.querySelector("dialog.x-overlay")!;
|
|
200
|
-
* const o = overlay(el, {
|
|
201
|
-
* constrain: document.querySelector("main")!,
|
|
202
|
-
* resize: detents([0.25, 0.6, 0.9]),
|
|
203
|
-
* onResize: (size) => console.log(size),
|
|
204
|
-
* });
|
|
205
|
-
* ```
|
|
206
|
-
*/
|
|
207
|
-
declare function overlay(el: HTMLElement, config?: OverlayConfig): OverlayController;
|
|
381
|
+
declare function resize(target: HTMLElement, space?: ResizeStrategy, ...effects: Effect[]): ResizeService;
|
|
208
382
|
//#endregion
|
|
209
|
-
export {
|
|
383
|
+
export { AnchorOptions, DragService, Effect, OverlayConstraint, OverlayGestureOptions, OverlayGestures, PROJECTION_MS, RectInit, Region, ResizeContext, ResizeService, ResizeStrategy, Space, anchor, areaToPlacement, clamp, closestDetent, confine, constraint, createOverlayGestures, detents, draggable, freeResize, resize, resolveConstraint, resolveVarPx, rubber };
|