@rcarls/rc-common 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @rcarls/rc-common
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6683eb9: Add shared, lifecycle-safe click delegation and let interactive list items
8
+ forward plain surface clicks to same-root native action targets while
9
+ preserving nested and modified clicks.
10
+
11
+ ### Patch Changes
12
+
13
+ - ee7ba6c: Keep resize pinning, drag origins, and snapped bottom sheets correctly
14
+ positioned when a layout-containing ancestor establishes a non-viewport
15
+ containing block. Report animated snap changes only after the sheet settles so
16
+ consumers can defer discrete content and accessibility state changes until the
17
+ surface motion completes. Expose resize-start timing so content can be prepared
18
+ before an interactive expansion reveals it.
19
+ - 30eb232: Add icon-only activation-area sizing and Material icon-button variants. Align menu
20
+ selection and submenu affordances, and keep anchored popups within the viewport
21
+ across native and fallback positioning.
22
+
3
23
  ## 0.5.0
4
24
 
5
25
  ### Minor Changes
package/README.md CHANGED
@@ -19,10 +19,13 @@ import {
19
19
  AnchorController,
20
20
  DragController,
21
21
  DragGestureController,
22
+ ItemsCollectionController,
23
+ NavigationIndicatorController,
22
24
  ResizeController,
23
25
  } from '@rcarls/rc-common';
24
26
  import {
25
27
  ActiveDescendantController,
28
+ ClickDelegateController,
26
29
  MutationObserverController,
27
30
  RafScheduler,
28
31
  ScrollObserverController,
@@ -30,13 +33,17 @@ import {
30
33
  } from '@rcarls/rc-common';
31
34
  import { RovingTabIndexMixin, keyInteraction, keyNavigation, mouseMove } from '@rcarls/rc-common';
32
35
  import {
36
+ delegateClickTo,
37
+ DEFAULT_INTERACTIVE_SELECTOR,
33
38
  findExtremeSnapIndex,
34
39
  findNearestScrollAncestor,
35
40
  findNearestSnapIndex,
36
41
  findNextSnapIndex,
37
42
  getDirectChild,
38
43
  getDirectChildren,
44
+ isEventFromInteractiveDescendant,
39
45
  isFocusable,
46
+ pinElementBox,
40
47
  snapToStep,
41
48
  valueToPercent,
42
49
  warnMissingDirectChild,
@@ -53,12 +60,15 @@ Check this inventory before adding package-local interaction or DOM utility code
53
60
  | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
54
61
  | `ActiveDescendantController` | Managing `aria-activedescendant` virtual focus in listbox / combobox patterns |
55
62
  | `AnchorController` | Positioning floating UI relative to an anchor with native CSS anchor positioning and polyfill fallback |
63
+ | `ClickDelegateController` / `delegateClickTo` | Extending plain pointer clicks on a host to a same-root native anchor or button target |
56
64
  | `DragController` | Pointer and keyboard drag-to-move behavior |
57
65
  | `DragGestureController` | Single-pointer activation, capture, deltas, duration, and recent velocity |
66
+ | `ItemsCollectionController` | Filtering selectable and action items while preserving their distinct option kinds |
58
67
  | `KeyboardInteractionDirective` / `keyInteraction` | Tracking pointer vs keyboard interaction mode on a rendered element |
59
68
  | `KeyboardNavigationDirective` / `keyNavigation` | Mapping APG arrow-key models to navigation actions |
60
69
  | `MutationObserverController` | Lifecycle-safe `MutationObserver` wiring for light-DOM or shadow-DOM changes |
61
70
  | `MouseMoveDirective` / `mouseMove` | Pointermove callbacks while a pointer drag is active |
71
+ | `NavigationIndicatorController` | Positioning a shared visual indicator against the current navigation item |
62
72
  | `NativeChildController`, `getDirectChild`, `getDirectChildren`, `warnMissingDirectChild` | Finding, validating, and tracking consumer-provided native light-DOM children |
63
73
  | `RafScheduler` | Coalescing repeated work into one animation frame and canceling on disconnect |
64
74
  | `ResizeController` | Pointer and keyboard resize behavior |
@@ -68,6 +78,9 @@ Check this inventory before adding package-local interaction or DOM utility code
68
78
  | `findNearestScrollAncestor` | Locating the nearest scrollable ancestor for scroll-driven behavior |
69
79
  | `findNearestSnapIndex`, `findNextSnapIndex`, `findExtremeSnapIndex` | Choosing numeric anchor indices without assigning component meaning |
70
80
  | `isFocusable` | Filtering focusable items for keyboard navigation |
81
+ | `isEventFromInteractiveDescendant` | Detecting composed clicks already owned by a nested interactive control |
82
+ | `DEFAULT_INTERACTIVE_SELECTOR` | Reusing the default selector used to identify nested interactive descendants |
83
+ | `pinElementBox` | Converting an element's rendered box into explicit inline geometry for resize interactions |
71
84
  | `snapToStep`, `valueToPercent` | Slider and range-slider numeric helpers |
72
85
 
73
86
  ---
@@ -176,10 +189,10 @@ browsers; the polyfill does not support `position-try`.
176
189
 
177
190
  **Options:**
178
191
 
179
- | Option | Type | Description |
180
- | -------------- | ----------------------- | ---------------------------------------------------------- |
181
- | `anchor` | `() => Element \| null` | The anchor element getter |
182
- | `floating` | `() => Element \| null` | The floating element getter |
192
+ | Option | Type | Description |
193
+ | -------------- | ----------------------- | ------------------------------------------------------------------ |
194
+ | `anchor` | `() => Element \| null` | The anchor element getter |
195
+ | `floating` | `() => Element \| null` | The floating element getter |
183
196
  | `positionArea` | `string` | CSS `position-area` value (for example, `'block-end span-inline'`) |
184
197
 
185
198
  ---
@@ -237,6 +250,34 @@ Navigation axis is inferred automatically from the element's `role`:
237
250
 
238
251
  ---
239
252
 
253
+ ### Click delegation
254
+
255
+ `ClickDelegateController` extends plain primary clicks on a host surface to an
256
+ author-provided native anchor or button. It leaves clicks on nested interactive
257
+ content alone and rejects modifier-qualified or non-primary clicks because a
258
+ synthetic `.click()` cannot preserve alternate browser activation behavior.
259
+
260
+ ```ts
261
+ import { LitElement } from 'lit';
262
+
263
+ import { ClickDelegateController } from '@rcarls/rc-common';
264
+
265
+ class ActionRow extends LitElement {
266
+ constructor() {
267
+ super();
268
+ new ClickDelegateController(this, {
269
+ target: () => this.querySelector<HTMLElement>(':scope > a[href], :scope > button'),
270
+ disabled: () => this.hasAttribute('disabled'),
271
+ });
272
+ }
273
+ }
274
+ ```
275
+
276
+ Use `delegateClickTo()` directly for a non-Lit host. The target remains its own
277
+ keyboard tab stop; delegation extends pointer reach only.
278
+
279
+ ---
280
+
240
281
  ### `mouseMove` directive
241
282
 
242
283
  An `AsyncDirective` that fires a callback on pointer movement while a pointer drag is active. It