@jsenv/navi 0.16.52 → 0.16.53

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.
@@ -1,5 +1,5 @@
1
1
  import { installImportMetaCss } from "./jsenv_navi_side_effects.js";
2
- import { useErrorBoundary, useLayoutEffect, useEffect, useRef, useState, useCallback, useContext, useMemo, useImperativeHandle, useId } from "preact/hooks";
2
+ import { useErrorBoundary, useLayoutEffect, useEffect, useCallback, useRef, useState, useContext, useMemo, useImperativeHandle, useId } from "preact/hooks";
3
3
  import { jsxs, jsx, Fragment } from "preact/jsx-runtime";
4
4
  import { createIterableWeakSet, mergeOneStyle, stringifyStyle, createPubSub, mergeTwoStyles, normalizeStyles, createGroupTransitionController, getElementSignature, getBorderRadius, preventIntermediateScrollbar, createOpacityTransition, resolveCSSSize, findBefore, findAfter, createValueEffect, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, resolveCSSColor, createStyleController, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, hasCSSSizeUnit, activeElementSignal, canInterceptKeys, pickLightOrDark, resolveColorLuminance, initFocusGroup, dragAfterThreshold, getScrollContainer, stickyAsRelativeCoords, createDragToMoveGestureController, getDropTargetInfo, setStyles, useActiveElement, elementIsFocusable } from "@jsenv/dom";
5
5
  import { prefixFirstAndIndentRemainingLines } from "@jsenv/humanize";
@@ -4634,17 +4634,17 @@ const removeFromArray = (array, ...valuesToRemove) => {
4634
4634
 
4635
4635
  const useArraySignalMembership = (arraySignal, id) => {
4636
4636
  const array = arraySignal.value;
4637
- const found = array.includes(id);
4638
- return [
4639
- found,
4640
- (enabled) => {
4641
- if (enabled) {
4642
- arraySignal.value = addIntoArray(array, id);
4643
- } else {
4644
- arraySignal.value = removeFromArray(array, id);
4645
- }
4646
- },
4647
- ];
4637
+ const isMember = array.includes(id);
4638
+
4639
+ const add = useCallback(() => {
4640
+ arraySignal.value = addIntoArray(array, id);
4641
+ }, []);
4642
+
4643
+ const remove = useCallback(() => {
4644
+ arraySignal.value = removeFromArray(array, id);
4645
+ }, []);
4646
+
4647
+ return [isMember, add, remove];
4648
4648
  };
4649
4649
 
4650
4650
  /**