@rcarls/rc-common 0.0.0-next-20260921045401

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,113 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export type AnchorPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
3
+ export interface AnchorOptions {
4
+ /** The anchor (trigger) element. Accepts an element reference or getter. */
5
+ anchor: Element | (() => Element | null);
6
+ /** The floating element to position. Accepts an element reference or getter. */
7
+ floating: Element | (() => Element | null);
8
+ /** Preferred placement relative to the anchor. Defaults to `'bottom-start'`. */
9
+ placement?: AnchorPlacement;
10
+ /** Gap between anchor and floating in px. Defaults to `4`. */
11
+ offset?: number;
12
+ /** Flip to opposite side when clipped by viewport. Defaults to `true`. */
13
+ flip?: boolean;
14
+ disabled?: boolean;
15
+ /**
16
+ * The LitElement shadow host. When provided, positioning CSS is injected into
17
+ * the shadow root's adoptedStyleSheets so it reaches shadow-DOM floating elements,
18
+ * including those promoted to the popover top layer. The polyfill is invoked
19
+ * with roots: [shadowHost] to scope its traversal to this shadow root.
20
+ */
21
+ shadowHost?: HTMLElement | (() => HTMLElement | null);
22
+ }
23
+ /**
24
+ * Positions a floating element relative to an anchor element using CSS
25
+ * Anchor Positioning (native-first, polyfill on unsupported browsers via
26
+ * `@oddbird/css-anchor-positioning`).
27
+ *
28
+ * For shadow DOM components (pass `shadowHost`), positioning CSS is injected
29
+ * into the shadow root's `adoptedStyleSheets` so it reaches floating elements
30
+ * including those promoted to the popover top layer. The polyfill is invoked
31
+ * with `roots: [shadowHost]` to scope its stylesheet traversal correctly.
32
+ *
33
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning
34
+ */
35
+ export declare class AnchorController implements ReactiveController {
36
+ private _opts;
37
+ private readonly _uid;
38
+ private _styleEl;
39
+ private _adoptedSheet;
40
+ private _connected;
41
+ private readonly _clampScheduler;
42
+ private _clampLoopActive;
43
+ private _settleFramesRemaining;
44
+ private _stableFrames;
45
+ private _lastNaturalRect;
46
+ private _appliedDx;
47
+ private _appliedDy;
48
+ private _geometryAbort;
49
+ private _resizeObserver;
50
+ private _intersectionObserver;
51
+ private _mutationObserver;
52
+ private _$observedAnchor;
53
+ private _$observedFloating;
54
+ private readonly _handleGeometryChange;
55
+ constructor(host: ReactiveControllerHost, options: AnchorOptions);
56
+ setOptions(next: Partial<AnchorOptions>): void;
57
+ /** Re-apply positioning after the popup becomes visible or the anchor moves. */
58
+ update(): void;
59
+ hostConnected(): void;
60
+ hostDisconnected(): void;
61
+ private _anchor;
62
+ private _floating;
63
+ private _shadowHost;
64
+ private _applyAndPolyfill;
65
+ /**
66
+ * Checks viewport overflow during a bounded post-open settling window.
67
+ * Observers and viewport events restart the window when geometry changes,
68
+ * avoiding permanent layout polling while a popup is idle.
69
+ */
70
+ private _scheduleClamp;
71
+ private _runClampTick;
72
+ private _stopClampLoop;
73
+ private _startWatchingGeometry;
74
+ private _stopWatchingGeometry;
75
+ /**
76
+ * Nudges the floating element back on-screen via `translate` if whatever
77
+ * positioned it (native or otherwise) still left it overflowing the
78
+ * viewport. `translate` is used rather than adjusting `left`/`top`/etc.
79
+ * directly because it's a pure visual offset on top of the existing
80
+ * positioning, independent of which mechanism produced it — no need to
81
+ * know or reconstruct the underlying `left`/`right`/`position-anchor`
82
+ * values to correct them. It's safe to apply even to a popover-promoted
83
+ * element with its own further-nested anchor-positioned descendants (e.g.
84
+ * a submenu): top-layer promotion means a nested popover isn't contained
85
+ * by this element's box for `position: fixed` purposes, so translating
86
+ * this one doesn't drag a nested popup along or break its own anchoring.
87
+ *
88
+ * `getBoundingClientRect()` reflects whatever `translate` the previous
89
+ * update applied, and computing the new correction directly
90
+ * off that rect would see the already-corrected (on-screen) position,
91
+ * clear the correction as unnecessary, then reapply it next frame once
92
+ * the underlying overflow reappears — an every-frame flicker confirmed
93
+ * by a real click landing on a mid-flicker frame in the browser test
94
+ * suite. `_appliedDx`/`_appliedDy` track the offset this method itself
95
+ * last applied so it can subtract it back out and compute against the
96
+ * element's natural, uncorrected position each time.
97
+ */
98
+ private _clampToViewport;
99
+ private _applyPolyfillOrFallback;
100
+ private _apply;
101
+ private _injectStyles;
102
+ /**
103
+ * Hand-rolled positioning for browsers where neither native anchor
104
+ * positioning nor the polyfill is usable. Handles all four placement
105
+ * sides (not just top/bottom — a side flyout like a cascading submenu
106
+ * needs its primary axis to be horizontal, offsetting by the anchor's
107
+ * own width/height rather than always stacking below it), with the
108
+ * `-start`/`-end` suffix controlling cross-axis alignment and an
109
+ * unsuffixed placement centering on the cross axis.
110
+ */
111
+ private _positionFallback;
112
+ private _cleanup;
113
+ }
@@ -0,0 +1,46 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export interface DragOptions {
3
+ /** The element to move. Its `left` / `top` styles are updated during drag. */
4
+ target: Element;
5
+ /** Element that initiates the drag. Defaults to `target`. */
6
+ handle?: Element | null;
7
+ /** Bounds constraint for movement. Defaults to `'viewport'`. */
8
+ bounds?: 'viewport' | 'parent' | Element;
9
+ /** Constrain movement to one axis. Defaults to `'both'`. */
10
+ axis?: 'x' | 'y' | 'both';
11
+ /** Keyboard arrow-key step in px. Shift multiplies by 10. Defaults to `4`. */
12
+ step?: number;
13
+ disabled?: boolean;
14
+ }
15
+ /**
16
+ * Makes an element draggable via pointer and keyboard.
17
+ *
18
+ * Attach to a host and pass a `target` element (the element to move) and
19
+ * optionally a `handle` element (the drag initiator). Arrow keys on the
20
+ * focused handle also move the target for keyboard accessibility.
21
+ *
22
+ * Named `DragController` internally; `movable` is the attribute name on
23
+ * `<rc-dialog>` to avoid colliding with the HTML `draggable` global attribute.
24
+ */
25
+ export declare class DragController implements ReactiveController {
26
+ private _opts;
27
+ private _dragging;
28
+ private _startLeft;
29
+ private _startTop;
30
+ private readonly _gesture;
31
+ private readonly _onKeyDown;
32
+ constructor(host: ReactiveControllerHost, options: DragOptions);
33
+ setOptions(next: Partial<DragOptions>): void;
34
+ hostConnected(): void;
35
+ hostDisconnected(): void;
36
+ private _handle;
37
+ private _target;
38
+ private _attachTo;
39
+ private _detachFrom;
40
+ private _canStartGesture;
41
+ private _startDrag;
42
+ private _moveDrag;
43
+ private _finishDrag;
44
+ private _handleKeyDown;
45
+ private _boundsRect;
46
+ }
@@ -0,0 +1,110 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export type DragGestureAxis = 'both' | 'x' | 'y';
3
+ export type DragGestureActivation = 'axis' | 'immediate';
4
+ export interface DragGestureDetail {
5
+ /** Pointer event that produced this lifecycle update. */
6
+ event: PointerEvent;
7
+ /** Pointer identifier for the active gesture. */
8
+ pointerId: number;
9
+ /** Pointer device type reported by Pointer Events. */
10
+ pointerType: string;
11
+ /** Horizontal coordinate where the gesture began. */
12
+ startX: number;
13
+ /** Vertical coordinate where the gesture began. */
14
+ startY: number;
15
+ /** Current horizontal coordinate. */
16
+ x: number;
17
+ /** Current vertical coordinate. */
18
+ y: number;
19
+ /** Horizontal distance from the starting coordinate. */
20
+ deltaX: number;
21
+ /** Vertical distance from the starting coordinate. */
22
+ deltaY: number;
23
+ /** Elapsed gesture duration in milliseconds. */
24
+ duration: number;
25
+ /** Recent horizontal velocity in pixels per second. */
26
+ velocityX: number;
27
+ /** Recent vertical velocity in pixels per second. */
28
+ velocityY: number;
29
+ }
30
+ export type DragGestureTarget = Element | null | (() => Element | null);
31
+ export interface DragGestureOptions {
32
+ /** Element that receives pointer input, or a resolver for a rendered element. */
33
+ target: DragGestureTarget;
34
+ /** Allowed drag axis. Defaults to both axes. */
35
+ axis?: DragGestureAxis;
36
+ /**
37
+ * Whether to activate immediately or wait for dominant-axis intent.
38
+ * Delayed axis activation preserves cross-axis scrolling.
39
+ */
40
+ activation?: DragGestureActivation;
41
+ /** Distance required before delayed axis activation. Defaults to 8 pixels. */
42
+ activationDistance?: number;
43
+ /** Required allowed-axis dominance over the cross axis. Defaults to 1.25. */
44
+ axisLockRatio?: number;
45
+ /** Recent sample window used for velocity. Defaults to 100 milliseconds. */
46
+ velocityWindow?: number;
47
+ /** Minimum sample duration used for velocity. Defaults to 8 milliseconds. */
48
+ minVelocityDuration?: number;
49
+ /** Whether pointerdown listeners run during capture. */
50
+ capture?: boolean;
51
+ /** Whether activation stops pointer event propagation. */
52
+ stopPropagation?: boolean;
53
+ /** Whether active gesture events prevent their browser default. */
54
+ preventDefault?: boolean;
55
+ /** Whether activation focuses the target element. */
56
+ focusOnStart?: boolean;
57
+ /** Rejects pointerdown before the controller starts tracking it. */
58
+ canStart?: (event: PointerEvent) => boolean;
59
+ /** Called once when the gesture activates. */
60
+ onStart?: (detail: DragGestureDetail) => void;
61
+ /** Called for each active pointer move. */
62
+ onMove?: (detail: DragGestureDetail) => void;
63
+ /** Called when the active pointer is released. */
64
+ onEnd?: (detail: DragGestureDetail) => void;
65
+ /** Called when the active gesture is cancelled or loses pointer capture. */
66
+ onCancel?: (detail: DragGestureDetail) => void;
67
+ }
68
+ /**
69
+ * Tracks a single-pointer drag gesture without assigning component meaning.
70
+ *
71
+ * The controller owns pointer capture, intent activation, lifecycle cleanup,
72
+ * deltas, and recent velocity. Consumers remain responsible for geometry,
73
+ * snapping, dismissal, and other semantic actions.
74
+ */
75
+ export declare class DragGestureController implements ReactiveController {
76
+ private _options;
77
+ private _$target;
78
+ private _pointerId;
79
+ private _startX;
80
+ private _startY;
81
+ private _startTime;
82
+ private _samples;
83
+ private _activated;
84
+ private _rejected;
85
+ constructor(host: ReactiveControllerHost, options: DragGestureOptions);
86
+ /** Updates behavior or the target resolver and safely rebinds listeners. */
87
+ setOptions(options: Partial<DragGestureOptions>): void;
88
+ hostConnected(): void;
89
+ hostUpdated(): void;
90
+ hostDisconnected(): void;
91
+ private _resolveTarget;
92
+ private _bindTarget;
93
+ private _unbindTarget;
94
+ private _onPointerDown;
95
+ private _onPointerMove;
96
+ private _onPointerUp;
97
+ private _onPointerCancel;
98
+ private _onLostPointerCapture;
99
+ private _resolveIntent;
100
+ private _activate;
101
+ private _cancel;
102
+ private _finish;
103
+ private _removeCycleListeners;
104
+ private _recordSample;
105
+ private _detail;
106
+ private _capturePointer;
107
+ private _releasePointer;
108
+ private _reset;
109
+ }
110
+ export default DragGestureController;
@@ -0,0 +1,119 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export interface ItemsCollectionBaseOption {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ data?: unknown;
7
+ }
8
+ export interface ItemsCollectionSelectableOption extends ItemsCollectionBaseOption {
9
+ kind?: 'option';
10
+ }
11
+ export interface ItemsCollectionActionOption extends ItemsCollectionBaseOption {
12
+ kind: 'action';
13
+ action: string;
14
+ }
15
+ export type ItemsCollectionOption = ItemsCollectionSelectableOption | ItemsCollectionActionOption;
16
+ export type ItemsCollectionFilterStrategy = 'prefix' | 'contains' | ((label: string, query: string) => boolean);
17
+ export interface ItemsCollectionControllerOptions {
18
+ /** Stable ID prefix for rendered option elements, e.g. `'rc-lb-1'`. */
19
+ idPrefix: string;
20
+ /**
21
+ * Called once on first connect when pre-rendered `<li>` children are found
22
+ * and `setOptions()` has not yet been called. Use to sync selection state
23
+ * after bootstrap.
24
+ */
25
+ onInitFromDom?: (options: ItemsCollectionOption[]) => void;
26
+ /** Called when the user activates an option by pointer. */
27
+ onActivate: (option: ItemsCollectionOption) => void;
28
+ }
29
+ /**
30
+ * Manages a `<ul role="presentation">` + `<li role="option">` DOM subtree
31
+ * inside the host element's light DOM.
32
+ *
33
+ * Options and selection state are driven imperatively; the controller syncs
34
+ * changes directly to the DOM without triggering Lit re-renders.
35
+ *
36
+ * On first connect the controller can bootstrap from pre-rendered `<li>`
37
+ * elements, enabling progressive enhancement. Once `setOptions()` is called
38
+ * at any point the DOM is fully controlled and bootstrap will not run again.
39
+ */
40
+ export declare class ItemsCollectionController implements ReactiveController {
41
+ private readonly _host;
42
+ private readonly _idPrefix;
43
+ private readonly _onInitFromDom?;
44
+ private readonly _onActivate;
45
+ private _ul;
46
+ private _options;
47
+ private _liElements;
48
+ private _createLi;
49
+ private _createOption;
50
+ private _selectedValues;
51
+ private _filterText;
52
+ private _filterStrategy;
53
+ private _checkmark;
54
+ private _optionsInitialized;
55
+ /**
56
+ * Movement (in CSS pixels) beyond which a pending touch activation is
57
+ * treated as a scroll gesture instead of a tap.
58
+ */
59
+ private static readonly _TOUCH_TAP_THRESHOLD;
60
+ /** Touch pointerdown awaiting pointerup to confirm a tap versus a scroll. */
61
+ private _pendingTouchActivation;
62
+ constructor(host: ReactiveControllerHost & Element, options: ItemsCollectionControllerOptions);
63
+ hostConnected(): void;
64
+ hostDisconnected(): void;
65
+ get allOptions(): readonly ItemsCollectionOption[];
66
+ get selectedValues(): string[];
67
+ get filterText(): string;
68
+ isSelected(value: string): boolean;
69
+ optionForElement(element: Element): ItemsCollectionOption | null;
70
+ /**
71
+ * Navigable option elements: visible (not `[hidden]`) and not `aria-disabled`.
72
+ * Includes the create option when set. Consumed by `ActiveDescendantController`.
73
+ */
74
+ get navigableItems(): Element[];
75
+ set checkmark(value: boolean);
76
+ /** Replace the full option list. Sets the controller as authoritative, preventing DOM bootstrap. */
77
+ setOptions(options: ItemsCollectionOption[]): void;
78
+ /** Append a single option without replacing the list. */
79
+ appendOption(opt: ItemsCollectionOption): void;
80
+ /** Update `aria-selected` on all option elements to match `values`. */
81
+ setSelectedValues(values: string[]): void;
82
+ /**
83
+ * Apply a filter — sets `[hidden]` on non-matching `<li>` elements.
84
+ * The strategy is stored and re-used when options change.
85
+ */
86
+ filterOptions(text: string, strategy?: ItemsCollectionFilterStrategy): void;
87
+ /** Remove `[hidden]` from all option elements. */
88
+ clearFilter(): void;
89
+ /**
90
+ * Show or hide the synthetic "Create" option at the end of the list.
91
+ * Pass `null` to remove it.
92
+ */
93
+ setCreateOption(label: string | null): void;
94
+ private _ensureContainer;
95
+ private _bootstrapFromDom;
96
+ private _syncOptionsToDom;
97
+ private _createLiElement;
98
+ private _setLabelText;
99
+ private _ensureCheckmark;
100
+ private _removeCheckmark;
101
+ private _syncCheckmarks;
102
+ private _syncSelectedToDom;
103
+ private _syncFilterToDom;
104
+ private _applyFilterToLi;
105
+ private _isVisible;
106
+ private _resolveOptionLi;
107
+ /**
108
+ * Claims a pointer event as an option activation: stops it from continuing
109
+ * to bubble/compose past this point (left unstopped, a composed event can
110
+ * still be observed by ancestors outside this component — e.g. a <label>
111
+ * wrapping an unrelated sibling control — and be reinterpreted as an
112
+ * interaction with something else entirely), then activates the option.
113
+ */
114
+ private _activateLi;
115
+ private _onPointerDown;
116
+ private _onPointerMove;
117
+ private _onPointerUp;
118
+ private _onPointerCancel;
119
+ }
@@ -0,0 +1,32 @@
1
+ import { PartInfo, ElementPart } from 'lit/directive.js';
2
+ import { AsyncDirective } from 'lit/async-directive.js';
3
+ /**
4
+ * Options for the keyInteraction directive.
5
+ */
6
+ export interface KeyInteractionOptions {
7
+ /**
8
+ * Element to set/remove `data-interaction-mode` on.
9
+ * Defaults to the element the directive is applied to.
10
+ * Pass the LitElement host (`this`) when the attribute needs to be visible
11
+ * to external CSS (e.g. for `::part()` theming via rc-theme-material).
12
+ */
13
+ attributeTarget?: Element;
14
+ }
15
+ declare class KeyboardInteractionDirective extends AsyncDirective {
16
+ private _element?;
17
+ private _options;
18
+ private _isPointerFocus;
19
+ private _onPointerdown;
20
+ private _onFocusin;
21
+ private _onKeydown;
22
+ private get _target();
23
+ constructor(partInfo: PartInfo);
24
+ protected _init(): void;
25
+ render(_options?: KeyInteractionOptions): symbol;
26
+ update(part: ElementPart, [options]: Parameters<this['render']>): void;
27
+ disconnected(): void;
28
+ reconnected(): void;
29
+ }
30
+ export declare const keyInteraction: (_options?: KeyInteractionOptions | undefined) => import('lit/directive.js').DirectiveResult<typeof KeyboardInteractionDirective>;
31
+ export type { KeyboardInteractionDirective };
32
+ export default keyInteraction;
@@ -0,0 +1,67 @@
1
+ import { PartInfo, ElementPart } from 'lit/directive.js';
2
+ import { AsyncDirective } from 'lit/async-directive.js';
3
+ export type KeyboardNavigationAction = 'next' | 'prev' | 'next-large' | 'prev-large' | 'start' | 'end' | 'open-to-first' | 'open-to-last' | 'escape' | 'activate' | 'toggle';
4
+ /**
5
+ * Options for the keyNavigation directive.
6
+ */
7
+ export interface KeyNavigationOptions {
8
+ /**
9
+ * Dispatch 'escape' action on Escape key.
10
+ * @default false
11
+ */
12
+ handleEscape?: boolean;
13
+ /**
14
+ * Dispatch 'activate' action on Enter/Space.
15
+ * When enabled, Enter/Space will dispatch 'activate' instead of 'toggle'.
16
+ * @default false
17
+ */
18
+ handleActivate?: boolean;
19
+ /**
20
+ * Explicitly set the navigation axis, overriding role-based auto-detection.
21
+ * The navigation axis determines which arrow keys map to 'next'/'prev'.
22
+ * Required when the element has no ARIA role (e.g. a menu-button trigger wrapper).
23
+ */
24
+ navigationAxis?: 'horizontal' | 'vertical';
25
+ /**
26
+ * Handle navigation-axis arrow keys ('next'/'prev') and Home/End ('start'/'end').
27
+ * Set to false for elements that don't navigate items themselves (e.g. menu buttons
28
+ * that let the parent menubar handle navigation).
29
+ * @default true
30
+ */
31
+ handleNavAxis?: boolean;
32
+ /**
33
+ * Handle open-axis arrow keys (perpendicular to the navigation axis).
34
+ * Dispatches 'open-to-first' and 'open-to-last' actions.
35
+ * For horizontal navigation axis: ArrowDown → 'open-to-first', ArrowUp → 'open-to-last'.
36
+ * For vertical navigation axis: ArrowRight → 'open-to-first', ArrowLeft → 'open-to-last'.
37
+ * @default false
38
+ */
39
+ handleOpenAxis?: boolean;
40
+ }
41
+ declare class KeyboardNavigationDirective extends AsyncDirective {
42
+ private _element?;
43
+ private _keyDownHandle;
44
+ private _callback;
45
+ private _options;
46
+ /**
47
+ * The navigation axis determines which arrow keys map to 'next'/'prev'.
48
+ * Checks the explicit `navigationAxis` option first, then auto-detects
49
+ * from the element's ARIA role and aria-orientation attribute.
50
+ */
51
+ protected get navigationAxis(): 'horizontal' | 'vertical';
52
+ constructor(partInfo: PartInfo);
53
+ private _normalizeKey;
54
+ protected _onKeydown(e: KeyboardEvent): void;
55
+ protected _init(): void;
56
+ /**
57
+ * @param _cb - Callback function invoked with the navigation action
58
+ * @param _options - Keyboard navigation behavior options.
59
+ */
60
+ render(_cb: (action: KeyboardNavigationAction) => void, _options?: KeyNavigationOptions): symbol;
61
+ update(part: ElementPart, [cb, options]: Parameters<this['render']>): void;
62
+ disconnected(): void;
63
+ reconnected(): void;
64
+ }
65
+ export declare const keyNavigation: (_cb: (action: KeyboardNavigationAction) => void, _options?: KeyNavigationOptions | undefined) => import('lit/directive.js').DirectiveResult<typeof KeyboardNavigationDirective>;
66
+ export type { KeyboardNavigationDirective };
67
+ export default keyNavigation;
@@ -0,0 +1,42 @@
1
+ import { PartInfo, ElementPart } from 'lit/directive.js';
2
+ import { AsyncDirective } from 'lit/async-directive.js';
3
+ /**
4
+ * Lit element directive that invokes a callback during an active pointer drag.
5
+ *
6
+ * The exported name remains `mouseMove` for compatibility, but the directive
7
+ * listens to Pointer Events so mouse, touch, and pen input share the same path.
8
+ */
9
+ declare class MouseMoveDirective extends AsyncDirective {
10
+ private _element?;
11
+ private readonly _pointerDownHandle;
12
+ private readonly _pointerMoveHandle;
13
+ private readonly _pointerEndHandle;
14
+ private _callback;
15
+ private _activePointerId;
16
+ constructor(partInfo: PartInfo);
17
+ /** Start a pointer drag cycle on the directive-decorated element. */
18
+ protected _onPointerDown(evt: PointerEvent): void;
19
+ /** Forward pointer movement during an active drag cycle. */
20
+ protected _onPointerMove(evt: PointerEvent): void;
21
+ /** Finish the active pointer drag cycle and remove temporary listeners. */
22
+ protected _onPointerEnd(evt: PointerEvent): void;
23
+ /** Attach the permanent pointerdown listener to the current element. */
24
+ protected _init(): void;
25
+ /** Remove all listeners associated with the active drag cycle. */
26
+ private _removePointerCycleListeners;
27
+ private _capturePointer;
28
+ private _releasePointer;
29
+ /** Render no DOM; this directive only wires pointer listeners. */
30
+ render(_cb: (e: MouseEvent) => void): symbol;
31
+ update(part: ElementPart, [cb]: Parameters<this['render']>): void;
32
+ disconnected(): void;
33
+ reconnected(): void;
34
+ }
35
+ /**
36
+ * Wire pointer-drag movement to an element without rendering DOM.
37
+ *
38
+ * The callback receives the `PointerEvent` as a `MouseEvent`-compatible object.
39
+ */
40
+ export declare const mouseMove: (_cb: (e: MouseEvent) => void) => import('lit/directive.js').DirectiveResult<typeof MouseMoveDirective>;
41
+ export type { MouseMoveDirective };
42
+ export default mouseMove;
@@ -0,0 +1,30 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export interface MutationObserverControllerOptions {
3
+ /** Node to observe. Accepts a node reference or getter. */
4
+ target: Node | (() => Node | null) | null;
5
+ /** Native observer callback. */
6
+ callback: MutationCallback;
7
+ /** Native observer options. Defaults to `{ childList: true }`. */
8
+ observerOptions?: MutationObserverInit;
9
+ /** When true, disconnects and stays inert. */
10
+ disabled?: boolean;
11
+ }
12
+ /**
13
+ * Lifecycle-safe wrapper around `MutationObserver`.
14
+ *
15
+ * A null target is silently inert; call `setOptions()` when the target or
16
+ * observer options change.
17
+ */
18
+ export declare class MutationObserverController implements ReactiveController {
19
+ private _attached;
20
+ private _observer;
21
+ private _options;
22
+ constructor(host: ReactiveControllerHost, options: MutationObserverControllerOptions);
23
+ setOptions(next: Partial<MutationObserverControllerOptions>): void;
24
+ hostConnected(): void;
25
+ hostDisconnected(): void;
26
+ private _resolveTarget;
27
+ private _attach;
28
+ private _detach;
29
+ }
30
+ export default MutationObserverController;
@@ -0,0 +1,33 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export interface NavigationIndicatorControllerOptions {
3
+ slot: () => HTMLSlotElement | null;
4
+ container: () => HTMLElement | null;
5
+ indicator: () => HTMLElement | null;
6
+ activeSelector: () => string;
7
+ indicatorTargetSelector: () => string;
8
+ }
9
+ /**
10
+ * Tracks slotted navigation links and positions an owned active indicator.
11
+ *
12
+ * The controller never moves or mutates consumer links. It only observes link
13
+ * state and writes geometry styles to the component-owned indicator element.
14
+ */
15
+ export declare class NavigationIndicatorController implements ReactiveController {
16
+ private readonly _host;
17
+ private readonly _options;
18
+ private _mutationObserver?;
19
+ private _resizeObserver?;
20
+ private _frame;
21
+ private _links;
22
+ constructor(host: ReactiveControllerHost & HTMLElement, options: NavigationIndicatorControllerOptions);
23
+ hostConnected(): void;
24
+ hostDisconnected(): void;
25
+ sync(): void;
26
+ update(): void;
27
+ private _collectLinks;
28
+ private _observeLinks;
29
+ private _activeLink;
30
+ private _targetFor;
31
+ private _positionIndicator;
32
+ }
33
+ export default NavigationIndicatorController;
@@ -0,0 +1,16 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export type RafSchedulerCallback = (timestamp: DOMHighResTimeStamp) => void;
3
+ /**
4
+ * Coalesces repeated work into one `requestAnimationFrame` callback and
5
+ * cancels pending work when the host disconnects.
6
+ */
7
+ export declare class RafScheduler implements ReactiveController {
8
+ private _callback;
9
+ private _frame;
10
+ constructor(host?: ReactiveControllerHost);
11
+ get pending(): boolean;
12
+ schedule(callback: RafSchedulerCallback): void;
13
+ cancel(): void;
14
+ hostDisconnected(): void;
15
+ }
16
+ export default RafScheduler;