@jsenv/navi 0.16.56 → 0.16.57

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.
@@ -5,7 +5,7 @@ import { createIterableWeakSet, mergeOneStyle, stringifyStyle, createPubSub, mer
5
5
  import { prefixFirstAndIndentRemainingLines } from "@jsenv/humanize";
6
6
  import { effect, signal, computed, batch, useSignal } from "@preact/signals";
7
7
  import { createValidity } from "@jsenv/validity";
8
- import { createContext, render, isValidElement, toChildArray, createRef, cloneElement } from "preact";
8
+ import { createContext, toChildArray, render, isValidElement, createRef, cloneElement } from "preact";
9
9
  import { createPortal, forwardRef } from "preact/compat";
10
10
 
11
11
  const actionPrivatePropertiesWeakMap = new WeakMap();
@@ -6468,25 +6468,26 @@ const Box = props => {
6468
6468
  innerChildren = children;
6469
6469
  }
6470
6470
  if (separator) {
6471
- if (Array.isArray(innerChildren)) {
6472
- const childCount = innerChildren.length;
6473
- if (childCount > 1) {
6474
- const childrenWithSeparators = [];
6475
- let i = 0;
6476
- while (true) {
6477
- const child = innerChildren[i];
6478
- childrenWithSeparators.push(child);
6479
- i++;
6480
- if (i === childCount) {
6481
- break;
6482
- }
6483
- // Support function separators that receive separator index
6484
- const separatorElement = typeof separator === "function" ? separator(i - 1) // i-1 because i was incremented after pushing child
6485
- : separator;
6486
- childrenWithSeparators.push(separatorElement);
6471
+ // Flatten nested arrays (e.g., from .map()) to treat each element as individual child
6472
+ const flattenedChildren = toChildArray(innerChildren);
6473
+ if (flattenedChildren.length > 1) {
6474
+ const childrenWithSeparators = [];
6475
+ let i = 0;
6476
+ while (true) {
6477
+ const child = flattenedChildren[i];
6478
+ childrenWithSeparators.push(child);
6479
+ i++;
6480
+ if (i === flattenedChildren.length) {
6481
+ break;
6487
6482
  }
6488
- innerChildren = childrenWithSeparators;
6483
+ // Support function separators that receive separator index
6484
+ const separatorElement = typeof separator === "function" ? separator(i - 1) // i-1 because i was incremented after pushing child
6485
+ : separator;
6486
+ childrenWithSeparators.push(separatorElement);
6489
6487
  }
6488
+ innerChildren = childrenWithSeparators;
6489
+ } else {
6490
+ innerChildren = flattenedChildren;
6490
6491
  }
6491
6492
  }
6492
6493
  return jsx(TagName, {