@rcarls/rc-common 0.2.0 → 0.3.1
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 +43 -3
- package/dist/rc-common.js +493 -152
- package/dist/rc-common.umd.cjs +13 -13
- package/dist/types/ItemsCollectionController.d.ts +100 -0
- package/dist/types/KeyboardInteractionDirective.d.ts +32 -0
- package/dist/types/KeyboardInteractionDirective.test.d.ts +1 -0
- package/dist/types/KeyboardNavigationDirective.d.ts +3 -10
- package/dist/types/MutationObserverController.d.ts +30 -0
- package/dist/types/MutationObserverController.test.d.ts +1 -0
- package/dist/types/RafScheduler.d.ts +16 -0
- package/dist/types/RafScheduler.test.d.ts +1 -0
- package/dist/types/TypeaheadController.d.ts +31 -0
- package/dist/types/TypeaheadController.test.d.ts +1 -0
- package/dist/types/findNearestScrollAncestor.d.ts +9 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/nativeChild.d.ts +54 -0
- package/dist/types/nativeChild.test.d.ts +1 -0
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# `@rcarls/rc-common`
|
|
2
2
|
|
|
3
|
-
Shared controllers
|
|
3
|
+
Shared controllers, directives, and DOM utilities for `rc-webcomponents`.
|
|
4
|
+
|
|
5
|
+
Docs: [https://richardcarls.github.io/rc-webcomponents/](https://richardcarls.github.io/rc-webcomponents/).
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -14,12 +16,50 @@ npm install @rcarls/rc-common
|
|
|
14
16
|
|
|
15
17
|
```js
|
|
16
18
|
import { DragController, ResizeController, AnchorController } from '@rcarls/rc-common';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
+
import {
|
|
20
|
+
ActiveDescendantController,
|
|
21
|
+
MutationObserverController,
|
|
22
|
+
RafScheduler,
|
|
23
|
+
ScrollObserverController,
|
|
24
|
+
TypeaheadController,
|
|
25
|
+
} from '@rcarls/rc-common';
|
|
26
|
+
import { RovingTabIndexMixin, keyInteraction, keyNavigation, mouseMove } from '@rcarls/rc-common';
|
|
27
|
+
import {
|
|
28
|
+
findNearestScrollAncestor,
|
|
29
|
+
getDirectChild,
|
|
30
|
+
getDirectChildren,
|
|
31
|
+
isFocusable,
|
|
32
|
+
snapToStep,
|
|
33
|
+
valueToPercent,
|
|
34
|
+
warnMissingDirectChild,
|
|
35
|
+
} from '@rcarls/rc-common';
|
|
19
36
|
```
|
|
20
37
|
|
|
21
38
|
All exports are tree-shakeable (`sideEffects: false`).
|
|
22
39
|
|
|
40
|
+
## Export inventory
|
|
41
|
+
|
|
42
|
+
Check this inventory before adding package-local interaction or DOM utility code.
|
|
43
|
+
|
|
44
|
+
| Export | Use for |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `ActiveDescendantController` | Managing `aria-activedescendant` virtual focus in listbox / combobox patterns |
|
|
47
|
+
| `AnchorController` | Positioning floating UI relative to an anchor with native CSS anchor positioning and polyfill fallback |
|
|
48
|
+
| `DragController` | Pointer and keyboard drag-to-move behavior |
|
|
49
|
+
| `KeyboardInteractionDirective` / `keyInteraction` | Tracking pointer vs keyboard interaction mode on a rendered element |
|
|
50
|
+
| `KeyboardNavigationDirective` / `keyNavigation` | Mapping APG arrow-key models to navigation actions |
|
|
51
|
+
| `MutationObserverController` | Lifecycle-safe `MutationObserver` wiring for light-DOM or shadow-DOM changes |
|
|
52
|
+
| `MouseMoveDirective` / `mouseMove` | Pointermove callbacks while a pointer drag is active |
|
|
53
|
+
| `NativeChildController`, `getDirectChild`, `getDirectChildren`, `warnMissingDirectChild` | Finding, validating, and tracking consumer-provided native light-DOM children |
|
|
54
|
+
| `RafScheduler` | Coalescing repeated work into one animation frame and canceling on disconnect |
|
|
55
|
+
| `ResizeController` | Pointer and keyboard resize behavior |
|
|
56
|
+
| `RovingTabIndexMixin` | Roving tabindex for components whose child controls receive real DOM focus |
|
|
57
|
+
| `ScrollObserverController` | Scroll threshold and delta observation for scroll-driven component state |
|
|
58
|
+
| `TypeaheadController` | Printable-key buffering for composite widget typeahead |
|
|
59
|
+
| `findNearestScrollAncestor` | Locating the nearest scrollable ancestor for scroll-driven behavior |
|
|
60
|
+
| `isFocusable` | Filtering focusable items for keyboard navigation |
|
|
61
|
+
| `snapToStep`, `valueToPercent` | Slider and range-slider numeric helpers |
|
|
62
|
+
|
|
23
63
|
---
|
|
24
64
|
|
|
25
65
|
## API
|