@octanejs/base-ui 0.1.30 → 0.1.32
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,30 @@
|
|
|
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 resolveClassName_exports = {};
|
|
20
|
+
__export(resolveClassName_exports, {
|
|
21
|
+
resolveClassName: () => resolveClassName
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resolveClassName_exports);
|
|
24
|
+
function resolveClassName(className, state) {
|
|
25
|
+
return typeof className === "function" ? className(state) : className;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
resolveClassName
|
|
30
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
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 resolveRef_exports = {};
|
|
20
|
+
__export(resolveRef_exports, {
|
|
21
|
+
resolveRef: () => resolveRef
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resolveRef_exports);
|
|
24
|
+
function resolveRef(maybeRef) {
|
|
25
|
+
if (maybeRef == null) {
|
|
26
|
+
return maybeRef;
|
|
27
|
+
}
|
|
28
|
+
return "current" in maybeRef ? maybeRef.current : maybeRef;
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
resolveRef
|
|
33
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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 resolveStyle_exports = {};
|
|
20
|
+
__export(resolveStyle_exports, {
|
|
21
|
+
resolveStyle: () => resolveStyle
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resolveStyle_exports);
|
|
24
|
+
function resolveStyle(style, state) {
|
|
25
|
+
return typeof style === "function" ? style(state) : style;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
resolveStyle
|
|
30
|
+
});
|
|
@@ -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 serializeValue_exports = {};
|
|
20
|
+
__export(serializeValue_exports, {
|
|
21
|
+
serializeValue: () => serializeValue
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(serializeValue_exports);
|
|
24
|
+
function serializeValue(value) {
|
|
25
|
+
if (value == null) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === "string") {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return JSON.stringify(value);
|
|
33
|
+
} catch {
|
|
34
|
+
return String(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
serializeValue
|
|
40
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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 asc_exports = {};
|
|
20
|
+
__export(asc_exports, {
|
|
21
|
+
asc: () => asc
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(asc_exports);
|
|
24
|
+
function asc(a, b) {
|
|
25
|
+
return a - b;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
asc
|
|
30
|
+
});
|
|
@@ -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 getMidpoint_exports = {};
|
|
20
|
+
__export(getMidpoint_exports, {
|
|
21
|
+
getMidpoint: () => getMidpoint
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getMidpoint_exports);
|
|
24
|
+
function getMidpoint(element) {
|
|
25
|
+
const rect = element.getBoundingClientRect();
|
|
26
|
+
return {
|
|
27
|
+
x: (rect.left + rect.right) / 2,
|
|
28
|
+
y: (rect.top + rect.bottom) / 2
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
getMidpoint
|
|
34
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
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 getPushedThumbValues_exports = {};
|
|
20
|
+
__export(getPushedThumbValues_exports, {
|
|
21
|
+
getPushedThumbValues: () => getPushedThumbValues
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getPushedThumbValues_exports);
|
|
24
|
+
var import_clamp = require("../clamp.cjs");
|
|
25
|
+
function getPushedThumbValues({
|
|
26
|
+
values,
|
|
27
|
+
index,
|
|
28
|
+
nextValue,
|
|
29
|
+
min,
|
|
30
|
+
max,
|
|
31
|
+
step,
|
|
32
|
+
minStepsBetweenValues,
|
|
33
|
+
initialValues
|
|
34
|
+
}) {
|
|
35
|
+
if (values.length === 0) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const nextValues = values.slice();
|
|
39
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
40
|
+
const lastIndex = nextValues.length - 1;
|
|
41
|
+
const baseInitialValues = initialValues ?? values;
|
|
42
|
+
const indexMin = min + index * minValueDifference;
|
|
43
|
+
const indexMax = max - (lastIndex - index) * minValueDifference;
|
|
44
|
+
nextValues[index] = (0, import_clamp.clamp)(nextValue, indexMin, indexMax);
|
|
45
|
+
for (let i = index + 1; i <= lastIndex; i += 1) {
|
|
46
|
+
const minAllowed = nextValues[i - 1] + minValueDifference;
|
|
47
|
+
const maxAllowed = max - (lastIndex - i) * minValueDifference;
|
|
48
|
+
const initialValue = baseInitialValues[i] ?? nextValues[i];
|
|
49
|
+
let candidate = Math.max(nextValues[i], minAllowed);
|
|
50
|
+
if (initialValue < candidate) {
|
|
51
|
+
candidate = Math.max(initialValue, minAllowed);
|
|
52
|
+
}
|
|
53
|
+
nextValues[i] = (0, import_clamp.clamp)(candidate, minAllowed, maxAllowed);
|
|
54
|
+
}
|
|
55
|
+
for (let i = index - 1; i >= 0; i -= 1) {
|
|
56
|
+
const maxAllowed = nextValues[i + 1] - minValueDifference;
|
|
57
|
+
const minAllowed = min + i * minValueDifference;
|
|
58
|
+
const initialValue = baseInitialValues[i] ?? nextValues[i];
|
|
59
|
+
let candidate = Math.min(nextValues[i], maxAllowed);
|
|
60
|
+
if (initialValue > candidate) {
|
|
61
|
+
candidate = Math.min(initialValue, maxAllowed);
|
|
62
|
+
}
|
|
63
|
+
nextValues[i] = (0, import_clamp.clamp)(candidate, minAllowed, maxAllowed);
|
|
64
|
+
}
|
|
65
|
+
for (let i = 0; i <= lastIndex; i += 1) {
|
|
66
|
+
nextValues[i] = Number(nextValues[i].toFixed(12));
|
|
67
|
+
}
|
|
68
|
+
return nextValues;
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
getPushedThumbValues
|
|
73
|
+
});
|
|
@@ -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 getSliderValue_exports = {};
|
|
20
|
+
__export(getSliderValue_exports, {
|
|
21
|
+
getSliderValue: () => getSliderValue
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getSliderValue_exports);
|
|
24
|
+
var import_clamp = require("../clamp.cjs");
|
|
25
|
+
var import_replaceArrayItemAtIndex = require("./replaceArrayItemAtIndex.cjs");
|
|
26
|
+
function getSliderValue(valueInput, index, min, max, range, values) {
|
|
27
|
+
let newValue = valueInput;
|
|
28
|
+
newValue = (0, import_clamp.clamp)(newValue, min, max);
|
|
29
|
+
if (range) {
|
|
30
|
+
newValue = (0, import_replaceArrayItemAtIndex.replaceArrayItemAtIndex)(
|
|
31
|
+
values,
|
|
32
|
+
index,
|
|
33
|
+
// Bound the new value to the thumb's neighbours.
|
|
34
|
+
(0, import_clamp.clamp)(newValue, values[index - 1] ?? -Infinity, values[index + 1] ?? Infinity)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return newValue;
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getSliderValue
|
|
42
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
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 replaceArrayItemAtIndex_exports = {};
|
|
20
|
+
__export(replaceArrayItemAtIndex_exports, {
|
|
21
|
+
replaceArrayItemAtIndex: () => replaceArrayItemAtIndex
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(replaceArrayItemAtIndex_exports);
|
|
24
|
+
var import_asc = require("./asc.cjs");
|
|
25
|
+
function replaceArrayItemAtIndex(array, index, newValue) {
|
|
26
|
+
const output = array.slice();
|
|
27
|
+
output[index] = newValue;
|
|
28
|
+
return output.sort(import_asc.asc);
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
replaceArrayItemAtIndex
|
|
33
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
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 resolveThumbCollision_exports = {};
|
|
20
|
+
__export(resolveThumbCollision_exports, {
|
|
21
|
+
resolveThumbCollision: () => resolveThumbCollision
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resolveThumbCollision_exports);
|
|
24
|
+
var import_clamp = require("../clamp.cjs");
|
|
25
|
+
var import_getPushedThumbValues = require("./getPushedThumbValues.cjs");
|
|
26
|
+
function resolveThumbCollision({
|
|
27
|
+
behavior,
|
|
28
|
+
values,
|
|
29
|
+
currentValues,
|
|
30
|
+
initialValues,
|
|
31
|
+
pressedIndex,
|
|
32
|
+
nextValue,
|
|
33
|
+
min,
|
|
34
|
+
max,
|
|
35
|
+
step,
|
|
36
|
+
minStepsBetweenValues
|
|
37
|
+
}) {
|
|
38
|
+
const activeValues = currentValues ?? values;
|
|
39
|
+
const baselineValues = initialValues ?? values;
|
|
40
|
+
const range = activeValues.length > 1;
|
|
41
|
+
if (!range) {
|
|
42
|
+
return {
|
|
43
|
+
value: nextValue,
|
|
44
|
+
thumbIndex: 0,
|
|
45
|
+
didSwap: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
49
|
+
switch (behavior) {
|
|
50
|
+
case "swap": {
|
|
51
|
+
const pressedInitialValue = activeValues[pressedIndex];
|
|
52
|
+
const epsilon = 1e-7;
|
|
53
|
+
const candidateValues = activeValues.slice();
|
|
54
|
+
const previousNeighbor = candidateValues[pressedIndex - 1];
|
|
55
|
+
const nextNeighbor = candidateValues[pressedIndex + 1];
|
|
56
|
+
const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
|
|
57
|
+
const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
|
|
58
|
+
const constrainedValue = (0, import_clamp.clamp)(nextValue, lowerBound, upperBound);
|
|
59
|
+
const pressedValueAfterClamp = Number(constrainedValue.toFixed(12));
|
|
60
|
+
candidateValues[pressedIndex] = pressedValueAfterClamp;
|
|
61
|
+
const movingForward = nextValue > pressedInitialValue;
|
|
62
|
+
const movingBackward = nextValue < pressedInitialValue;
|
|
63
|
+
const shouldSwapForward = movingForward && nextNeighbor != null && nextValue >= nextNeighbor - epsilon;
|
|
64
|
+
const shouldSwapBackward = movingBackward && previousNeighbor != null && nextValue <= previousNeighbor + epsilon;
|
|
65
|
+
if (!shouldSwapForward && !shouldSwapBackward) {
|
|
66
|
+
return {
|
|
67
|
+
value: candidateValues,
|
|
68
|
+
thumbIndex: pressedIndex,
|
|
69
|
+
didSwap: false
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const targetIndex = shouldSwapForward ? pressedIndex + 1 : pressedIndex - 1;
|
|
73
|
+
const initialValuesForPush = candidateValues.map((_, index) => {
|
|
74
|
+
if (index === pressedIndex) {
|
|
75
|
+
return pressedValueAfterClamp;
|
|
76
|
+
}
|
|
77
|
+
const baseline = baselineValues[index];
|
|
78
|
+
if (baseline != null) {
|
|
79
|
+
return baseline;
|
|
80
|
+
}
|
|
81
|
+
return activeValues[index];
|
|
82
|
+
});
|
|
83
|
+
let nextValueForTarget = nextValue;
|
|
84
|
+
if (shouldSwapForward) {
|
|
85
|
+
nextValueForTarget = Math.max(nextValue, candidateValues[targetIndex]);
|
|
86
|
+
} else {
|
|
87
|
+
nextValueForTarget = Math.min(nextValue, candidateValues[targetIndex]);
|
|
88
|
+
}
|
|
89
|
+
const adjustedValues = (0, import_getPushedThumbValues.getPushedThumbValues)({
|
|
90
|
+
values: candidateValues,
|
|
91
|
+
index: targetIndex,
|
|
92
|
+
nextValue: nextValueForTarget,
|
|
93
|
+
min,
|
|
94
|
+
max,
|
|
95
|
+
step,
|
|
96
|
+
minStepsBetweenValues,
|
|
97
|
+
initialValues: initialValuesForPush
|
|
98
|
+
});
|
|
99
|
+
const neighborIndex = shouldSwapForward ? targetIndex - 1 : targetIndex + 1;
|
|
100
|
+
if (neighborIndex >= 0 && neighborIndex < adjustedValues.length) {
|
|
101
|
+
const previousValue = adjustedValues[neighborIndex - 1];
|
|
102
|
+
const nextValueAfter = adjustedValues[neighborIndex + 1];
|
|
103
|
+
let neighborLowerBound = previousValue != null ? previousValue + minValueDifference : min;
|
|
104
|
+
neighborLowerBound = Math.max(neighborLowerBound, min + neighborIndex * minValueDifference);
|
|
105
|
+
let neighborUpperBound = nextValueAfter != null ? nextValueAfter - minValueDifference : max;
|
|
106
|
+
neighborUpperBound = Math.min(
|
|
107
|
+
neighborUpperBound,
|
|
108
|
+
max - (adjustedValues.length - 1 - neighborIndex) * minValueDifference
|
|
109
|
+
);
|
|
110
|
+
const restoredValue = (0, import_clamp.clamp)(pressedValueAfterClamp, neighborLowerBound, neighborUpperBound);
|
|
111
|
+
adjustedValues[neighborIndex] = Number(restoredValue.toFixed(12));
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
value: adjustedValues,
|
|
115
|
+
thumbIndex: targetIndex,
|
|
116
|
+
didSwap: true
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
case "push": {
|
|
120
|
+
const nextValues = (0, import_getPushedThumbValues.getPushedThumbValues)({
|
|
121
|
+
values: activeValues,
|
|
122
|
+
index: pressedIndex,
|
|
123
|
+
nextValue,
|
|
124
|
+
min,
|
|
125
|
+
max,
|
|
126
|
+
step,
|
|
127
|
+
minStepsBetweenValues
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
value: nextValues,
|
|
131
|
+
thumbIndex: pressedIndex,
|
|
132
|
+
didSwap: false
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
case "none":
|
|
136
|
+
default: {
|
|
137
|
+
const candidateValues = activeValues.slice();
|
|
138
|
+
const previousNeighbor = candidateValues[pressedIndex - 1];
|
|
139
|
+
const nextNeighbor = candidateValues[pressedIndex + 1];
|
|
140
|
+
const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
|
|
141
|
+
const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
|
|
142
|
+
const constrainedValue = (0, import_clamp.clamp)(nextValue, lowerBound, upperBound);
|
|
143
|
+
candidateValues[pressedIndex] = Number(constrainedValue.toFixed(12));
|
|
144
|
+
return {
|
|
145
|
+
value: candidateValues,
|
|
146
|
+
thumbIndex: pressedIndex,
|
|
147
|
+
didSwap: false
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
resolveThumbCollision
|
|
155
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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 roundValueToStep_exports = {};
|
|
20
|
+
__export(roundValueToStep_exports, {
|
|
21
|
+
getDecimalPrecision: () => getDecimalPrecision,
|
|
22
|
+
roundValueToStep: () => roundValueToStep
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(roundValueToStep_exports);
|
|
25
|
+
function getDecimalPrecision(num) {
|
|
26
|
+
if (num === 0) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
if (Math.abs(num) < 1) {
|
|
30
|
+
const parts = num.toExponential().split("e-");
|
|
31
|
+
const matissaDecimalPart = parts[0].split(".")[1];
|
|
32
|
+
return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
|
|
33
|
+
}
|
|
34
|
+
const decimalPart = num.toString().split(".")[1];
|
|
35
|
+
return decimalPart ? decimalPart.length : 0;
|
|
36
|
+
}
|
|
37
|
+
function roundValueToStep(value, step, min) {
|
|
38
|
+
const nearest = Math.round((value - min) / step) * step + min;
|
|
39
|
+
return Number(nearest.toFixed(Math.max(getDecimalPrecision(step), getDecimalPrecision(min))));
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getDecimalPrecision,
|
|
44
|
+
roundValueToStep
|
|
45
|
+
});
|
|
@@ -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 validateMinimumDistance_exports = {};
|
|
20
|
+
__export(validateMinimumDistance_exports, {
|
|
21
|
+
validateMinimumDistance: () => validateMinimumDistance
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(validateMinimumDistance_exports);
|
|
24
|
+
function validateMinimumDistance(values, step, minStepsBetweenValues) {
|
|
25
|
+
if (!Array.isArray(values)) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
const distances = values.reduce((acc, val, index, vals) => {
|
|
29
|
+
if (index === vals.length - 1) {
|
|
30
|
+
return acc;
|
|
31
|
+
}
|
|
32
|
+
acc.push(Math.abs(val - vals[index + 1]));
|
|
33
|
+
return acc;
|
|
34
|
+
}, []);
|
|
35
|
+
return Math.min(...distances) >= step * minStepsBetweenValues;
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
validateMinimumDistance
|
|
40
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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 valueArrayToPercentages_exports = {};
|
|
20
|
+
__export(valueArrayToPercentages_exports, {
|
|
21
|
+
valueArrayToPercentages: () => valueArrayToPercentages
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(valueArrayToPercentages_exports);
|
|
24
|
+
var import_clamp = require("../clamp.cjs");
|
|
25
|
+
var import_valueToPercent = require("../valueToPercent.cjs");
|
|
26
|
+
function valueArrayToPercentages(values, min, max) {
|
|
27
|
+
const output = [];
|
|
28
|
+
for (let i = 0; i < values.length; i += 1) {
|
|
29
|
+
output.push((0, import_clamp.clamp)((0, import_valueToPercent.valueToPercent)(values[i], min, max), 0, 100));
|
|
30
|
+
}
|
|
31
|
+
return output;
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
valueArrayToPercentages
|
|
36
|
+
});
|