@lumx/react 4.9.0-next.4 → 4.9.0-next.5

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.
Files changed (3) hide show
  1. package/index.js +21 -5
  2. package/index.js.map +1 -1
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -10889,6 +10889,26 @@ function createActiveItemState(callbacks, signal, initialItem) {
10889
10889
  };
10890
10890
  }
10891
10891
 
10892
+ /**
10893
+ * Create a TreeWalker that iterates over elements matching a CSS selector
10894
+ * within a container.
10895
+ *
10896
+ * Uses `NodeFilter.SHOW_ELEMENT` and accepts nodes that match the given
10897
+ * selector, skipping everything else. The returned walker can be used with
10898
+ * `nextNode()` / `previousNode()` for lazy, sequential DOM traversal.
10899
+ *
10900
+ * @param container The root element to walk within.
10901
+ * @param selector CSS selector that items must match.
10902
+ * @returns A TreeWalker scoped to the container and filtered by the selector.
10903
+ */
10904
+ function createSelectorTreeWalker(container, selector) {
10905
+ return document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
10906
+ acceptNode(node) {
10907
+ return node.matches(selector) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
10908
+ }
10909
+ });
10910
+ }
10911
+
10892
10912
  /**
10893
10913
  * Create a focus navigation controller for a 1D list.
10894
10914
  *
@@ -10918,11 +10938,7 @@ function createListFocusNavigation(options, callbacks, signal) {
10918
10938
  */
10919
10939
  function createItemWalker(enabledOnly = true) {
10920
10940
  const selector = enabledOnly ? enabledItemSelector : itemSelector;
10921
- return document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
10922
- acceptNode(node) {
10923
- return node.matches(selector) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
10924
- }
10925
- });
10941
+ return createSelectorTreeWalker(container, selector);
10926
10942
  }
10927
10943
 
10928
10944
  /** Find the first enabled item in the container. */