@octanejs/base-ui 0.1.31 → 0.1.33
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/dist/cjs/accordion.cjs +497 -0
- package/dist/cjs/alert-dialog.cjs +65 -0
- package/dist/cjs/avatar.cjs +234 -0
- package/dist/cjs/button.cjs +54 -0
- package/dist/cjs/checkbox-group.cjs +165 -0
- package/dist/cjs/checkbox.cjs +475 -0
- package/dist/cjs/collapsible.cjs +700 -0
- package/dist/cjs/context-menu.cjs +257 -0
- package/dist/cjs/csp-provider.cjs +40 -0
- package/dist/cjs/dialog.cjs +741 -0
- package/dist/cjs/direction-provider.cjs +35 -0
- package/dist/cjs/field.cjs +559 -0
- package/dist/cjs/fieldset.cjs +101 -0
- package/dist/cjs/form.cjs +177 -0
- package/dist/cjs/index.cjs +133 -0
- package/dist/cjs/input.cjs +32 -0
- package/dist/cjs/internal.cjs +51 -0
- package/dist/cjs/menu.cjs +2420 -0
- package/dist/cjs/menubar.cjs +132 -0
- package/dist/cjs/merge-props.cjs +34 -0
- package/dist/cjs/meter.cjs +169 -0
- package/dist/cjs/number-field.cjs +812 -0
- package/dist/cjs/popover.cjs +966 -0
- package/dist/cjs/preview-card.cjs +632 -0
- package/dist/cjs/progress.cjs +206 -0
- package/dist/cjs/radio-group.cjs +264 -0
- package/dist/cjs/radio.cjs +327 -0
- package/dist/cjs/separator.cjs +44 -0
- package/dist/cjs/slider.cjs +1384 -0
- package/dist/cjs/switch.cjs +306 -0
- package/dist/cjs/tabs.cjs +727 -0
- package/dist/cjs/toast.cjs +1766 -0
- package/dist/cjs/toggle-group.cjs +118 -0
- package/dist/cjs/toggle.cjs +121 -0
- package/dist/cjs/tooltip.cjs +835 -0
- package/dist/cjs/unstable-use-media-query.cjs +79 -0
- package/dist/cjs/use-render.cjs +40 -0
- package/dist/cjs/utils/CSPContext.cjs +38 -0
- package/dist/cjs/utils/CheckboxGroupContext.cjs +40 -0
- package/dist/cjs/utils/CompositeRootContext.cjs +40 -0
- package/dist/cjs/utils/ContextMenuRootContext.cjs +42 -0
- package/dist/cjs/utils/DirectionContext.cjs +34 -0
- package/dist/cjs/utils/FloatingPortalLite.cjs +47 -0
- package/dist/cjs/utils/InternalBackdrop.cjs +49 -0
- package/dist/cjs/utils/MenubarContext.cjs +40 -0
- package/dist/cjs/utils/RadioGroupContext.cjs +34 -0
- package/dist/cjs/utils/RequestQueue.cjs +111 -0
- package/dist/cjs/utils/TimeoutManager.cjs +50 -0
- package/dist/cjs/utils/ToggleGroupContext.cjs +40 -0
- package/dist/cjs/utils/adaptiveOriginMiddleware.cjs +94 -0
- package/dist/cjs/utils/addEventListener.cjs +33 -0
- package/dist/cjs/utils/areArraysEqual.cjs +30 -0
- package/dist/cjs/utils/clamp.cjs +30 -0
- package/dist/cjs/utils/closePart.cjs +70 -0
- package/dist/cjs/utils/collapsibleOpenStateMapping.cjs +42 -0
- package/dist/cjs/utils/composeRefs.cjs +68 -0
- package/dist/cjs/utils/composite/CompositeItem.cjs +59 -0
- package/dist/cjs/utils/composite/CompositeList.cjs +177 -0
- package/dist/cjs/utils/composite/CompositeListContext.cjs +43 -0
- package/dist/cjs/utils/composite/CompositeRoot.cjs +118 -0
- package/dist/cjs/utils/composite/grid-utils.cjs +343 -0
- package/dist/cjs/utils/composite/gridNavigation.cjs +92 -0
- package/dist/cjs/utils/composite/keys.cjs +174 -0
- package/dist/cjs/utils/composite/list-utils.cjs +90 -0
- package/dist/cjs/utils/composite/useCompositeItem.cjs +63 -0
- package/dist/cjs/utils/composite/useCompositeListItem.cjs +104 -0
- package/dist/cjs/utils/composite/useCompositeRoot.cjs +263 -0
- package/dist/cjs/utils/constants.cjs +56 -0
- package/dist/cjs/utils/contains.cjs +46 -0
- package/dist/cjs/utils/createChangeEventDetails.cjs +92 -0
- package/dist/cjs/utils/dom.cjs +35 -0
- package/dist/cjs/utils/empty.cjs +34 -0
- package/dist/cjs/utils/field/FieldItemContext.cjs +34 -0
- package/dist/cjs/utils/field/FieldRootContext.cjs +80 -0
- package/dist/cjs/utils/field/FormContext.cjs +41 -0
- package/dist/cjs/utils/field/LabelableContext.cjs +43 -0
- package/dist/cjs/utils/field/LabelableProvider.cjs +115 -0
- package/dist/cjs/utils/field/constants.cjs +68 -0
- package/dist/cjs/utils/field/getCombinedFieldValidityData.cjs +36 -0
- package/dist/cjs/utils/field/useAriaLabelledBy.cjs +87 -0
- package/dist/cjs/utils/field/useFieldControlRegistration.cjs +165 -0
- package/dist/cjs/utils/field/useFieldValidation.cjs +285 -0
- package/dist/cjs/utils/field/useLabel.cjs +99 -0
- package/dist/cjs/utils/field/useLabelableId.cjs +105 -0
- package/dist/cjs/utils/field/useRegisterFieldControl.cjs +60 -0
- package/dist/cjs/utils/findRootOwnerId.cjs +37 -0
- package/dist/cjs/utils/floating/FloatingDelayGroup.cjs +219 -0
- package/dist/cjs/utils/floating/FloatingFocusManager.cjs +685 -0
- package/dist/cjs/utils/floating/FloatingPortal.cjs +230 -0
- package/dist/cjs/utils/floating/FloatingRootStore.cjs +87 -0
- package/dist/cjs/utils/floating/FloatingTree.cjs +86 -0
- package/dist/cjs/utils/floating/FloatingTreeStore.cjs +41 -0
- package/dist/cjs/utils/floating/FocusGuard.cjs +54 -0
- package/dist/cjs/utils/floating/composite.cjs +42 -0
- package/dist/cjs/utils/floating/constants.cjs +34 -0
- package/dist/cjs/utils/floating/createAttribute.cjs +30 -0
- package/dist/cjs/utils/floating/createEventEmitter.cjs +44 -0
- package/dist/cjs/utils/floating/element.cjs +103 -0
- package/dist/cjs/utils/floating/enqueueFocus.cjs +51 -0
- package/dist/cjs/utils/floating/event.cjs +65 -0
- package/dist/cjs/utils/floating/getEmptyRootContext.cjs +42 -0
- package/dist/cjs/utils/floating/gridNavigation.cjs +45 -0
- package/dist/cjs/utils/floating/markOthers.cjs +181 -0
- package/dist/cjs/utils/floating/nodes.cjs +48 -0
- package/dist/cjs/utils/floating/safePolygon.cjs +301 -0
- package/dist/cjs/utils/floating/tabbable.cjs +242 -0
- package/dist/cjs/utils/floating/types.cjs +16 -0
- package/dist/cjs/utils/floating/useClick.cjs +153 -0
- package/dist/cjs/utils/floating/useClientPoint.cjs +225 -0
- package/dist/cjs/utils/floating/useDismiss.cjs +506 -0
- package/dist/cjs/utils/floating/useFloating.cjs +186 -0
- package/dist/cjs/utils/floating/useFloatingRootContext.cjs +75 -0
- package/dist/cjs/utils/floating/useFocus.cjs +184 -0
- package/dist/cjs/utils/floating/useHoverFloatingInteraction.cjs +231 -0
- package/dist/cjs/utils/floating/useHoverInteractionSharedState.cjs +113 -0
- package/dist/cjs/utils/floating/useHoverReferenceInteraction.cjs +380 -0
- package/dist/cjs/utils/floating/useHoverShared.cjs +65 -0
- package/dist/cjs/utils/floating/useListNavigation.cjs +665 -0
- package/dist/cjs/utils/floating/useSyncedFloatingRootContext.cjs +91 -0
- package/dist/cjs/utils/floating/useTypeahead.cjs +187 -0
- package/dist/cjs/utils/formatNumber.cjs +60 -0
- package/dist/cjs/utils/generateId.cjs +32 -0
- package/dist/cjs/utils/getCssDimensions.cjs +42 -0
- package/dist/cjs/utils/getDefaultFormSubmitter.cjs +42 -0
- package/dist/cjs/utils/getDisabledMountTransitionStyles.cjs +32 -0
- package/dist/cjs/utils/getElementRef.cjs +35 -0
- package/dist/cjs/utils/getPseudoElementBounds.cjs +56 -0
- package/dist/cjs/utils/getStateAttributesProps.cjs +46 -0
- package/dist/cjs/utils/hideMiddleware.cjs +42 -0
- package/dist/cjs/utils/inertValue.cjs +30 -0
- package/dist/cjs/utils/matchesFocusVisible.cjs +38 -0
- package/dist/cjs/utils/mergeCleanups.cjs +37 -0
- package/dist/cjs/utils/mergeObjects.cjs +39 -0
- package/dist/cjs/utils/mergeProps.cjs +182 -0
- package/dist/cjs/utils/noop.cjs +29 -0
- package/dist/cjs/utils/number/constants.cjs +34 -0
- package/dist/cjs/utils/number/parse.cjs +258 -0
- package/dist/cjs/utils/number/types.cjs +16 -0
- package/dist/cjs/utils/number/validate.cjs +104 -0
- package/dist/cjs/utils/owner.cjs +35 -0
- package/dist/cjs/utils/platform.cjs +83 -0
- package/dist/cjs/utils/popupStateMapping.cjs +74 -0
- package/dist/cjs/utils/popups/index.cjs +39 -0
- package/dist/cjs/utils/popups/inlineRect.cjs +218 -0
- package/dist/cjs/utils/popups/popupStoreUtils.cjs +379 -0
- package/dist/cjs/utils/popups/popupTriggerMap.cjs +76 -0
- package/dist/cjs/utils/popups/store.cjs +118 -0
- package/dist/cjs/utils/popups/useTriggerFocusGuards.cjs +72 -0
- package/dist/cjs/utils/resolveAriaLabelledBy.cjs +35 -0
- package/dist/cjs/utils/resolveClassName.cjs +30 -0
- package/dist/cjs/utils/resolveRef.cjs +33 -0
- package/dist/cjs/utils/resolveStyle.cjs +30 -0
- package/dist/cjs/utils/serializeValue.cjs +40 -0
- package/dist/cjs/utils/slider/asc.cjs +30 -0
- package/dist/cjs/utils/slider/getMidpoint.cjs +34 -0
- package/dist/cjs/utils/slider/getPushedThumbValues.cjs +73 -0
- package/dist/cjs/utils/slider/getSliderValue.cjs +42 -0
- package/dist/cjs/utils/slider/replaceArrayItemAtIndex.cjs +33 -0
- package/dist/cjs/utils/slider/resolveThumbCollision.cjs +155 -0
- package/dist/cjs/utils/slider/roundValueToStep.cjs +45 -0
- package/dist/cjs/utils/slider/validateMinimumDistance.cjs +40 -0
- package/dist/cjs/utils/slider/valueArrayToPercentages.cjs +36 -0
- package/dist/cjs/utils/store/ReactStore.cjs +135 -0
- package/dist/cjs/utils/store/Store.cjs +83 -0
- package/dist/cjs/utils/store/createSelector.cjs +74 -0
- package/dist/cjs/utils/store/useStore.cjs +51 -0
- package/dist/cjs/utils/stringifyLocale.cjs +36 -0
- package/dist/cjs/utils/useAnchorPositioning.cjs +421 -0
- package/dist/cjs/utils/useAnchoredPopupScrollLock.cjs +59 -0
- package/dist/cjs/utils/useAnimationFrame.cjs +93 -0
- package/dist/cjs/utils/useAnimationsFinished.cjs +98 -0
- package/dist/cjs/utils/useBaseUiId.cjs +36 -0
- package/dist/cjs/utils/useButton.cjs +177 -0
- package/dist/cjs/utils/useCheckboxGroupParent.cjs +114 -0
- package/dist/cjs/utils/useControlled.cjs +47 -0
- package/dist/cjs/utils/useEnhancedClickHandler.cjs +60 -0
- package/dist/cjs/utils/useFocusableWhenDisabled.cjs +77 -0
- package/dist/cjs/utils/useForcedRerendering.cjs +35 -0
- package/dist/cjs/utils/useIsHydrating.cjs +44 -0
- package/dist/cjs/utils/useMixedToggleClickHandler.cjs +66 -0
- package/dist/cjs/utils/useOnFirstRender.cjs +35 -0
- package/dist/cjs/utils/useOnMount.cjs +36 -0
- package/dist/cjs/utils/useOpenChangeComplete.cjs +57 -0
- package/dist/cjs/utils/useOpenInteractionType.cjs +69 -0
- package/dist/cjs/utils/usePopupAutoResize.cjs +191 -0
- package/dist/cjs/utils/usePopupViewport.cjs +283 -0
- package/dist/cjs/utils/usePositioner.cjs +53 -0
- package/dist/cjs/utils/usePressAndHold.cjs +51 -0
- package/dist/cjs/utils/usePreviousValue.cjs +47 -0
- package/dist/cjs/utils/useRefWithInit.cjs +41 -0
- package/dist/cjs/utils/useRegisteredLabelId.cjs +48 -0
- package/dist/cjs/utils/useRenderElement.cjs +106 -0
- package/dist/cjs/utils/useScrollLock.cjs +232 -0
- package/dist/cjs/utils/useStableCallback.cjs +41 -0
- package/dist/cjs/utils/useTimeout.cjs +66 -0
- package/dist/cjs/utils/useTransitionStatus.cjs +116 -0
- package/dist/cjs/utils/useValueAsRef.cjs +43 -0
- package/dist/cjs/utils/useValueChanged.cjs +55 -0
- package/dist/cjs/utils/valueToPercent.cjs +30 -0
- package/dist/cjs/utils/visuallyHidden.cjs +49 -0
- package/package.json +20 -8
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var unstable_use_media_query_exports = {};
|
|
20
|
+
__export(unstable_use_media_query_exports, {
|
|
21
|
+
useMediaQuery: () => useMediaQuery
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(unstable_use_media_query_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("./internal.cjs");
|
|
26
|
+
var import_addEventListener = require("./utils/addEventListener.cjs");
|
|
27
|
+
function useMediaQuery(...args) {
|
|
28
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
29
|
+
const slot = slotArg ?? (0, import_internal.S)("useMediaQuery");
|
|
30
|
+
const rawQuery = user[0];
|
|
31
|
+
const options = user[1] ?? {};
|
|
32
|
+
const supportMatchMedia = typeof window !== "undefined" && typeof window.matchMedia !== "undefined";
|
|
33
|
+
const normalizedQuery = rawQuery.replace(/^@media( ?)/m, "");
|
|
34
|
+
const {
|
|
35
|
+
defaultMatches = false,
|
|
36
|
+
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
37
|
+
ssrMatchMedia = null,
|
|
38
|
+
noSsr = false
|
|
39
|
+
} = options;
|
|
40
|
+
const getDefaultSnapshot = (0, import_octane.useCallback)(
|
|
41
|
+
() => defaultMatches,
|
|
42
|
+
[defaultMatches],
|
|
43
|
+
(0, import_internal.subSlot)(slot, "def")
|
|
44
|
+
);
|
|
45
|
+
const getServerSnapshot = (0, import_octane.useMemo)(
|
|
46
|
+
() => {
|
|
47
|
+
if (noSsr && matchMedia) {
|
|
48
|
+
return () => matchMedia(normalizedQuery).matches;
|
|
49
|
+
}
|
|
50
|
+
if (ssrMatchMedia !== null) {
|
|
51
|
+
const { matches } = ssrMatchMedia(normalizedQuery);
|
|
52
|
+
return () => matches;
|
|
53
|
+
}
|
|
54
|
+
return getDefaultSnapshot;
|
|
55
|
+
},
|
|
56
|
+
[getDefaultSnapshot, normalizedQuery, ssrMatchMedia, noSsr, matchMedia],
|
|
57
|
+
(0, import_internal.subSlot)(slot, "srv")
|
|
58
|
+
);
|
|
59
|
+
const [getSnapshot, subscribe] = (0, import_octane.useMemo)(
|
|
60
|
+
() => {
|
|
61
|
+
if (matchMedia === null) {
|
|
62
|
+
return [getDefaultSnapshot, () => () => {
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
const mediaQueryList = matchMedia(normalizedQuery);
|
|
66
|
+
return [
|
|
67
|
+
() => mediaQueryList.matches,
|
|
68
|
+
(notify) => (0, import_addEventListener.addEventListener)(mediaQueryList, "change", notify)
|
|
69
|
+
];
|
|
70
|
+
},
|
|
71
|
+
[getDefaultSnapshot, matchMedia, normalizedQuery],
|
|
72
|
+
(0, import_internal.subSlot)(slot, "sub")
|
|
73
|
+
);
|
|
74
|
+
return (0, import_octane.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot, (0, import_internal.subSlot)(slot, "store"));
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
useMediaQuery
|
|
79
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var use_render_exports = {};
|
|
20
|
+
__export(use_render_exports, {
|
|
21
|
+
useRender: () => useRender
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_render_exports);
|
|
24
|
+
var import_internal = require("./internal.cjs");
|
|
25
|
+
var import_useRenderElement = require("./utils/useRenderElement.cjs");
|
|
26
|
+
function useRender(...args) {
|
|
27
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
28
|
+
const slot = slotArg ?? (0, import_internal.S)("useRender");
|
|
29
|
+
const params = user[0];
|
|
30
|
+
return (0, import_useRenderElement.useRenderElement)(
|
|
31
|
+
params.defaultTagName ?? "div",
|
|
32
|
+
params,
|
|
33
|
+
params,
|
|
34
|
+
(0, import_internal.subSlot)(slot, "re")
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
useRender
|
|
40
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var CSPContext_exports = {};
|
|
20
|
+
__export(CSPContext_exports, {
|
|
21
|
+
CSPContext: () => CSPContext,
|
|
22
|
+
useCSPContext: () => useCSPContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(CSPContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const CSPContext = (0, import_octane.createContext)(void 0);
|
|
27
|
+
const DEFAULT_CSP_CONTEXT_VALUE = {
|
|
28
|
+
disableStyleElements: false
|
|
29
|
+
};
|
|
30
|
+
function useCSPContext(...args) {
|
|
31
|
+
void args;
|
|
32
|
+
return (0, import_octane.useContext)(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
CSPContext,
|
|
37
|
+
useCSPContext
|
|
38
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var CheckboxGroupContext_exports = {};
|
|
20
|
+
__export(CheckboxGroupContext_exports, {
|
|
21
|
+
CheckboxGroupContext: () => CheckboxGroupContext,
|
|
22
|
+
useCheckboxGroupContext: () => useCheckboxGroupContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(CheckboxGroupContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const CheckboxGroupContext = (0, import_octane.createContext)(void 0);
|
|
27
|
+
function useCheckboxGroupContext(optional = true) {
|
|
28
|
+
const context = (0, import_octane.useContext)(CheckboxGroupContext);
|
|
29
|
+
if (context === void 0 && !optional) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
CheckboxGroupContext,
|
|
39
|
+
useCheckboxGroupContext
|
|
40
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var CompositeRootContext_exports = {};
|
|
20
|
+
__export(CompositeRootContext_exports, {
|
|
21
|
+
CompositeRootContext: () => CompositeRootContext,
|
|
22
|
+
useCompositeRootContext: () => useCompositeRootContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(CompositeRootContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const CompositeRootContext = (0, import_octane.createContext)(void 0);
|
|
27
|
+
function useCompositeRootContext(optional = false) {
|
|
28
|
+
const context = (0, import_octane.useContext)(CompositeRootContext);
|
|
29
|
+
if (context === void 0 && !optional) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
CompositeRootContext,
|
|
39
|
+
useCompositeRootContext
|
|
40
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ContextMenuRootContext_exports = {};
|
|
20
|
+
__export(ContextMenuRootContext_exports, {
|
|
21
|
+
ContextMenuRootContext: () => ContextMenuRootContext,
|
|
22
|
+
useContextMenuRootContext: () => useContextMenuRootContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ContextMenuRootContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const ContextMenuRootContext = (0, import_octane.createContext)(
|
|
27
|
+
void 0
|
|
28
|
+
);
|
|
29
|
+
function useContextMenuRootContext(optional = true) {
|
|
30
|
+
const context = (0, import_octane.useContext)(ContextMenuRootContext);
|
|
31
|
+
if (context === void 0 && !optional) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
"Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>."
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
ContextMenuRootContext,
|
|
41
|
+
useContextMenuRootContext
|
|
42
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var DirectionContext_exports = {};
|
|
20
|
+
__export(DirectionContext_exports, {
|
|
21
|
+
DirectionContext: () => DirectionContext,
|
|
22
|
+
useDirection: () => useDirection
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(DirectionContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const DirectionContext = (0, import_octane.createContext)(void 0);
|
|
27
|
+
function useDirection() {
|
|
28
|
+
return (0, import_octane.useContext)(DirectionContext) ?? "ltr";
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
DirectionContext,
|
|
33
|
+
useDirection
|
|
34
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FloatingPortalLite_exports = {};
|
|
20
|
+
__export(FloatingPortalLite_exports, {
|
|
21
|
+
FloatingPortalLite: () => FloatingPortalLite
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(FloatingPortalLite_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("../internal.cjs");
|
|
26
|
+
var import_FloatingPortal = require("./floating/FloatingPortal.cjs");
|
|
27
|
+
function FloatingPortalLite(componentProps) {
|
|
28
|
+
const slot = (0, import_internal.S)("FloatingPortalLite");
|
|
29
|
+
const { children, container, className, render, style, ref, ...elementProps } = componentProps;
|
|
30
|
+
const { portalNode, portalSubtree } = (0, import_FloatingPortal.useFloatingPortalNode)(
|
|
31
|
+
{ container, ref, componentProps: { render, className, style }, elementProps },
|
|
32
|
+
(0, import_internal.subSlot)(slot, "node")
|
|
33
|
+
);
|
|
34
|
+
if (!portalSubtree && !portalNode) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return (0, import_octane.createElement)(import_octane.Fragment, {
|
|
38
|
+
children: [
|
|
39
|
+
(0, import_octane.createElement)(import_octane.Fragment, { key: "subtree", children: portalSubtree }),
|
|
40
|
+
portalNode ? (0, import_octane.createElement)(import_octane.Fragment, { key: "portal", children: (0, import_octane.createPortal)(children, portalNode) }) : null
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
FloatingPortalLite
|
|
47
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var InternalBackdrop_exports = {};
|
|
20
|
+
__export(InternalBackdrop_exports, {
|
|
21
|
+
InternalBackdrop: () => InternalBackdrop
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(InternalBackdrop_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
function InternalBackdrop(props) {
|
|
26
|
+
const { cutout, ref, ...otherProps } = props;
|
|
27
|
+
let clipPath;
|
|
28
|
+
if (cutout) {
|
|
29
|
+
const rect = cutout.getBoundingClientRect();
|
|
30
|
+
clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
|
|
31
|
+
}
|
|
32
|
+
return (0, import_octane.createElement)("div", {
|
|
33
|
+
ref,
|
|
34
|
+
role: "presentation",
|
|
35
|
+
["data-base-ui-inert"]: "",
|
|
36
|
+
...otherProps,
|
|
37
|
+
style: {
|
|
38
|
+
position: "fixed",
|
|
39
|
+
inset: 0,
|
|
40
|
+
userSelect: "none",
|
|
41
|
+
WebkitUserSelect: "none",
|
|
42
|
+
clipPath
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
InternalBackdrop
|
|
49
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MenubarContext_exports = {};
|
|
20
|
+
__export(MenubarContext_exports, {
|
|
21
|
+
MenubarContext: () => MenubarContext,
|
|
22
|
+
useMenubarContext: () => useMenubarContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(MenubarContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const MenubarContext = (0, import_octane.createContext)(null);
|
|
27
|
+
function useMenubarContext(optional) {
|
|
28
|
+
const context = (0, import_octane.useContext)(MenubarContext);
|
|
29
|
+
if (context === null && !optional) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
MenubarContext,
|
|
39
|
+
useMenubarContext
|
|
40
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var RadioGroupContext_exports = {};
|
|
20
|
+
__export(RadioGroupContext_exports, {
|
|
21
|
+
RadioGroupContext: () => RadioGroupContext,
|
|
22
|
+
useRadioGroupContext: () => useRadioGroupContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(RadioGroupContext_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
const RadioGroupContext = (0, import_octane.createContext)(void 0);
|
|
27
|
+
function useRadioGroupContext() {
|
|
28
|
+
return (0, import_octane.useContext)(RadioGroupContext);
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
RadioGroupContext,
|
|
33
|
+
useRadioGroupContext
|
|
34
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var RequestQueue_exports = {};
|
|
20
|
+
__export(RequestQueue_exports, {
|
|
21
|
+
RequestQueue: () => RequestQueue
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(RequestQueue_exports);
|
|
24
|
+
class RequestQueue {
|
|
25
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
26
|
+
queuedRequests = /* @__PURE__ */ new Map();
|
|
27
|
+
fetchFn;
|
|
28
|
+
maxConcurrentRequests;
|
|
29
|
+
getKeyId;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
this.fetchFn = options.fetchFn;
|
|
32
|
+
this.maxConcurrentRequests = options.maxConcurrentRequests ?? Infinity;
|
|
33
|
+
this.getKeyId = options.getKeyId ?? String;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the next `count` entries to process from the queue.
|
|
37
|
+
* Default is FIFO (oldest first). Subclasses can override for different ordering.
|
|
38
|
+
*/
|
|
39
|
+
pickEntries(count) {
|
|
40
|
+
const result = [];
|
|
41
|
+
const iterator = this.queuedRequests.entries();
|
|
42
|
+
for (let i = 0; i < count; i += 1) {
|
|
43
|
+
const { value } = iterator.next();
|
|
44
|
+
result.push(value);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
processQueue = async () => {
|
|
49
|
+
if (this.queuedRequests.size === 0 || this.pendingRequests.size >= this.maxConcurrentRequests) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const loopLength = Math.min(
|
|
53
|
+
this.maxConcurrentRequests - this.pendingRequests.size,
|
|
54
|
+
this.queuedRequests.size
|
|
55
|
+
);
|
|
56
|
+
if (loopLength === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const fetchPromises = [];
|
|
60
|
+
for (const [keyId, key] of this.pickEntries(loopLength)) {
|
|
61
|
+
this.queuedRequests.delete(keyId);
|
|
62
|
+
this.pendingRequests.set(keyId, key);
|
|
63
|
+
fetchPromises.push(
|
|
64
|
+
this.fetchFn(key).catch(() => {
|
|
65
|
+
this.pendingRequests.delete(keyId);
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
await Promise.all(fetchPromises);
|
|
70
|
+
if (this.queuedRequests.size > 0) {
|
|
71
|
+
await this.processQueue();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
queue = async (keys) => {
|
|
75
|
+
for (const key of keys) {
|
|
76
|
+
const keyId = this.getKeyId(key);
|
|
77
|
+
if (!this.pendingRequests.has(keyId)) {
|
|
78
|
+
this.queuedRequests.set(keyId, key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
await this.processQueue();
|
|
82
|
+
};
|
|
83
|
+
setRequestSettled = async (key) => {
|
|
84
|
+
const keyId = this.getKeyId(key);
|
|
85
|
+
this.pendingRequests.delete(keyId);
|
|
86
|
+
await this.processQueue();
|
|
87
|
+
};
|
|
88
|
+
clear = () => {
|
|
89
|
+
this.queuedRequests.clear();
|
|
90
|
+
this.pendingRequests.clear();
|
|
91
|
+
};
|
|
92
|
+
clearPendingRequest = async (key) => {
|
|
93
|
+
const keyId = this.getKeyId(key);
|
|
94
|
+
this.pendingRequests.delete(keyId);
|
|
95
|
+
await this.processQueue();
|
|
96
|
+
};
|
|
97
|
+
getRequestStatus = (key) => {
|
|
98
|
+
const keyId = this.getKeyId(key);
|
|
99
|
+
if (this.pendingRequests.has(keyId)) {
|
|
100
|
+
return "pending";
|
|
101
|
+
}
|
|
102
|
+
if (this.queuedRequests.has(keyId)) {
|
|
103
|
+
return "queued";
|
|
104
|
+
}
|
|
105
|
+
return "unknown";
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
RequestQueue
|
|
111
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var TimeoutManager_exports = {};
|
|
20
|
+
__export(TimeoutManager_exports, {
|
|
21
|
+
TimeoutManager: () => TimeoutManager
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(TimeoutManager_exports);
|
|
24
|
+
class TimeoutManager {
|
|
25
|
+
ids = /* @__PURE__ */ new Map();
|
|
26
|
+
/** Starts `fn` after `delay`, replacing any timeout already running under `key`. */
|
|
27
|
+
start = (key, delay, fn) => {
|
|
28
|
+
this.clear(key);
|
|
29
|
+
const id = setTimeout(() => {
|
|
30
|
+
this.ids.delete(key);
|
|
31
|
+
fn();
|
|
32
|
+
}, delay);
|
|
33
|
+
this.ids.set(key, id);
|
|
34
|
+
};
|
|
35
|
+
clear = (key) => {
|
|
36
|
+
const id = this.ids.get(key);
|
|
37
|
+
if (id != null) {
|
|
38
|
+
clearTimeout(id);
|
|
39
|
+
this.ids.delete(key);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
clearAll = () => {
|
|
43
|
+
this.ids.forEach(clearTimeout);
|
|
44
|
+
this.ids.clear();
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
TimeoutManager
|
|
50
|
+
});
|